From 1a2238d1bddc823df06f67312d96ccf9de2893cc Mon Sep 17 00:00:00 2001 From: root Date: Sat, 19 Dec 2015 13:13:57 +0000 Subject: CFE from danitool [without hostTools dir]: https://mega.nz/#!mwZyFK7a!CPT3BKC8dEw29kubtdYxhB91G9vIIismTkgzQ3iUy3k --- buildcfe.sh | 21 + cfe/build/broadcom/bcm63xx_ram/Makefile | 76 + cfe/build/broadcom/bcm63xx_rom/Makefile | 160 + cfe/cfe/api/Makefile | 47 + cfe/cfe/api/cfe_api.c | 534 + cfe/cfe/api/cfe_api.h | 192 + cfe/cfe/api/cfe_api_int.h | 168 + cfe/cfe/api/cfe_error.h | 101 + cfe/cfe/applets/Makefile | 64 + cfe/cfe/applets/README | 21 + cfe/cfe/applets/cfe_applet.lds | 37 + cfe/cfe/applets/download.c | 163 + cfe/cfe/applets/download.lds | 12 + cfe/cfe/applets/minicrt0.S | 95 + cfe/cfe/applets/test.c | 211 + cfe/cfe/applets/vapitest.S | 96 + .../mips/board/bcm63xx_ram/include/bcm63xx_util.h | 167 + .../mips/board/bcm63xx_ram/include/bcm_common.h | 32 + .../arch/mips/board/bcm63xx_ram/include/bcm_cpu.h | 32 + .../arch/mips/board/bcm63xx_ram/include/bcm_map.h | 32 + .../arch/mips/board/bcm63xx_ram/include/bcmmii.h | 164 + .../arch/mips/board/bcm63xx_ram/include/bcmtypes.h | 144 + .../mips/board/bcm63xx_ram/include/bsp_config.h | 94 + .../board/bcm63xx_ram/include/dev_bcm63xx_eth.h | 127 + .../board/bcm63xx_ram/include/dev_bcm63xx_flash.h | 38 + .../arch/mips/board/bcm63xx_ram/include/jffs2.h | 251 + cfe/cfe/arch/mips/board/bcm63xx_ram/src/Makefile | 55 + .../mips/board/bcm63xx_ram/src/bcm63xx_board.c | 830 + .../arch/mips/board/bcm63xx_ram/src/bcm63xx_cmd.c | 1878 + .../arch/mips/board/bcm63xx_ram/src/bcm63xx_devs.c | 734 + .../mips/board/bcm63xx_ram/src/bcm63xx_env_subr.c | 277 + .../mips/board/bcm63xx_ram/src/bcm63xx_httpd.c | 1031 + .../mips/board/bcm63xx_ram/src/bcm63xx_ldr_elf.c | 388 + .../mips/board/bcm63xx_ram/src/bcm63xx_ldr_raw.c | 368 + .../arch/mips/board/bcm63xx_ram/src/bcm63xx_main.c | 611 + .../mips/board/bcm63xx_ram/src/bcm63xx_net_icmp.c | 199 + .../mips/board/bcm63xx_ram/src/bcm63xx_ram_boot.S | 88 + .../arch/mips/board/bcm63xx_ram/src/bcm63xx_util.c | 1375 + .../mips/board/bcm63xx_ram/src/dev_bcm63xx_eth.c | 547 + .../mips/board/bcm63xx_ram/src/dev_bcm63xx_flash.c | 629 + .../mips/board/bcm63xx_ram/src/dev_bcm63xx_uart.c | 211 + .../arch/mips/board/bcm63xx_ram/src/html/ul.html | 48 + .../mips/board/bcm63xx_ram/src/html/ulinfo.html | 60 + cfe/cfe/arch/mips/board/bcm63xx_ram/src/ram_cfe.mk | 378 + .../arch/mips/board/bcm63xx_ram/src/robosw_reg.c | 615 + cfe/cfe/arch/mips/board/bcm63xx_rom/src/Makefile | 23 + .../mips/board/bcm63xx_rom/src/bcm6368_rom_boot.S | 548 + .../mips/board/bcm63xx_rom/src/bcm6368_sdramDqs.c | 439 + .../board/bcm63xx_rom/src/bcm63xx_impl1_rom_boot.S | 1818 + .../arch/mips/board/bcm63xx_rom/src/bcm63xx_main.c | 649 + cfe/cfe/arch/mips/board/bcm63xx_rom/src/memtest.c | 1031 + cfe/cfe/arch/mips/board/bcm63xx_rom/src/rom_cfe.mk | 370 + cfe/cfe/arch/mips/common/include/addrspace.h | 63 + cfe/cfe/arch/mips/common/include/disasm.h | 61 + cfe/cfe/arch/mips/common/include/exception.h | 223 + cfe/cfe/arch/mips/common/include/exchandler.h | 85 + cfe/cfe/arch/mips/common/include/initdata.h | 68 + cfe/cfe/arch/mips/common/include/lib_hssubr.h | 84 + cfe/cfe/arch/mips/common/include/lib_physio.h | 100 + cfe/cfe/arch/mips/common/include/lib_setjmp.h | 81 + cfe/cfe/arch/mips/common/include/mipsmacros.h | 376 + cfe/cfe/arch/mips/common/include/segtable.h | 97 + cfe/cfe/arch/mips/common/src/Makefile | 38 + cfe/cfe/arch/mips/common/src/cfe_ram_cached.lds | 40 + cfe/cfe/arch/mips/common/src/cfe_ram_uncached.lds | 40 + cfe/cfe/arch/mips/common/src/cfe_ramapp.lds | 41 + cfe/cfe/arch/mips/common/src/cfe_rom_cached.lds | 40 + .../arch/mips/common/src/cfe_rom_reloc_cached.lds | 43 + .../common/src/cfe_rom_reloc_cached_biendian.lds | 49 + .../mips/common/src/cfe_rom_reloc_uncached.lds | 41 + cfe/cfe/arch/mips/common/src/cfe_rom_uncached.lds | 39 + cfe/cfe/arch/mips/common/src/dev_flash_all.S | 220 + cfe/cfe/arch/mips/common/src/dev_flashop_engine.S | 695 + cfe/cfe/arch/mips/common/src/disasm.c | 2111 + cfe/cfe/arch/mips/common/src/exception.S | 546 + cfe/cfe/arch/mips/common/src/exchandler.c | 580 + cfe/cfe/arch/mips/common/src/init_mips.S | 683 + cfe/cfe/arch/mips/common/src/init_ram.S | 889 + cfe/cfe/arch/mips/common/src/lib_hssubr.S | 194 + cfe/cfe/arch/mips/common/src/lib_physio.S | 173 + cfe/cfe/arch/mips/common/src/lib_setjmp.S | 94 + cfe/cfe/arch/mips/common/src/mips_arena.c | 186 + cfe/cfe/arch/mips/common/src/tools.mk | 83 + cfe/cfe/arch/mips/common/src/ui_memtest.c | 282 + cfe/cfe/arch/mips/cpu/SIBYTE_PRIVATE_FILES | 2 + cfe/cfe/arch/mips/cpu/bcmcore/include/bcm4710.h | 58 + cfe/cfe/arch/mips/cpu/bcmcore/include/bcm47xx.h | 8 + cfe/cfe/arch/mips/cpu/bcmcore/include/bcmnvram.h | 123 + cfe/cfe/arch/mips/cpu/bcmcore/include/cpu_config.h | 62 + cfe/cfe/arch/mips/cpu/bcmcore/include/sbmips.h | 670 + cfe/cfe/arch/mips/cpu/bcmcore/include/sbsdram.h | 92 + cfe/cfe/arch/mips/cpu/bcmcore/src/Makefile | 8 + cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_arena.c | 170 + .../arch/mips/cpu/bcmcore/src/bcmcore_cpuinit.S | 490 + .../arch/mips/cpu/bcmcore/src/bcmcore_l1cache.S | 219 + cfe/cfe/dev/SIBYTE_PRIVATE_FILES | 6 + cfe/cfe/dev/bcm5700.h | 1007 + cfe/cfe/dev/bcm5821.h | 278 + cfe/cfe/dev/dc21143.h | 588 + cfe/cfe/dev/dev_atapi.c | 222 + cfe/cfe/dev/dev_bcm1250.c | 275 + cfe/cfe/dev/dev_bcm5700.c | 2557 ++ cfe/cfe/dev/dev_bcm5821.c | 1592 + cfe/cfe/dev/dev_dc21143.c | 2388 + cfe/cfe/dev/dev_dp83815.c | 2290 + cfe/cfe/dev/dev_ds17887clock.c | 422 + cfe/cfe/dev/dev_flash.c | 1367 + cfe/cfe/dev/dev_ht7520.c | 167 + cfe/cfe/dev/dev_ide_common.c | 1249 + cfe/cfe/dev/dev_ide_pci.c | 358 + cfe/cfe/dev/dev_newflash.c | 1428 + cfe/cfe/dev/dev_ns16550.c | 255 + cfe/cfe/dev/dev_ns16550_pci.c | 114 + cfe/cfe/dev/dev_null.c | 142 + cfe/cfe/dev/dev_promice.c | 402 + cfe/cfe/dev/dev_sp1011.c | 151 + cfe/cfe/dev/dev_tulip.c | 2985 ++ cfe/cfe/dev/dp83815.h | 559 + cfe/cfe/dev/ns16550.h | 143 + cfe/cfe/dev/pci_devs.c | 79 + cfe/cfe/hosttools/Makefile | 12 + cfe/cfe/hosttools/README | 49 + cfe/cfe/hosttools/installboot.c | 352 + cfe/cfe/hosttools/makereg.c | 481 + cfe/cfe/hosttools/memconfig.c | 654 + cfe/cfe/hosttools/mkbootimage.c | 314 + cfe/cfe/hosttools/mkflashimage.c | 347 + cfe/cfe/hosttools/mkpcidb.c | 157 + cfe/cfe/include/cfe.h | 101 + cfe/cfe/include/cfe_autoboot.h | 71 + cfe/cfe/include/cfe_boot.h | 58 + cfe/cfe/include/cfe_bootblock.h | 129 + cfe/cfe/include/cfe_console.h | 92 + cfe/cfe/include/cfe_devfuncs.h | 76 + cfe/cfe/include/cfe_device.h | 118 + cfe/cfe/include/cfe_error.h | 110 + cfe/cfe/include/cfe_fileops.h | 109 + cfe/cfe/include/cfe_flashimage.h | 64 + cfe/cfe/include/cfe_iocb.h | 211 + cfe/cfe/include/cfe_ioctl.h | 167 + cfe/cfe/include/cfe_irq.h | 103 + cfe/cfe/include/cfe_loader.h | 86 + cfe/cfe/include/cfe_mem.h | 79 + cfe/cfe/include/cfe_timer.h | 74 + cfe/cfe/include/cfe_xiocb.h | 202 + cfe/cfe/include/dev_flash.h | 168 + cfe/cfe/include/dev_ide.h | 90 + cfe/cfe/include/dev_ide_common.h | 204 + cfe/cfe/include/dev_newflash.h | 344 + cfe/cfe/include/elf.h | 194 + cfe/cfe/include/env_subr.h | 117 + cfe/cfe/include/foxconnCfg.h | 9 + cfe/cfe/include/lib_arena.h | 76 + cfe/cfe/include/lib_malloc.h | 78 + cfe/cfe/include/lib_printf.h | 69 + cfe/cfe/include/lib_queue.h | 85 + cfe/cfe/include/lib_string.h | 117 + cfe/cfe/include/lib_types.h | 120 + cfe/cfe/include/socregs.h | 63 + cfe/cfe/include/tftpd.h | 26 + cfe/cfe/include/ui_command.h | 140 + cfe/cfe/lib/lib_arena.c | 389 + cfe/cfe/lib/lib_malloc.c | 620 + cfe/cfe/lib/lib_misc.c | 229 + cfe/cfe/lib/lib_printf.c | 442 + cfe/cfe/lib/lib_qsort.c | 88 + cfe/cfe/lib/lib_queue.c | 219 + cfe/cfe/lib/lib_string.c | 386 + cfe/cfe/lib/lib_string2.c | 96 + cfe/cfe/lzma/LzmaDecode.c | 584 + cfe/cfe/lzma/LzmaDecode.h | 113 + cfe/cfe/lzma/LzmaDecodeSize.c | 712 + cfe/cfe/lzma/LzmaStateDecode.c | 521 + cfe/cfe/lzma/LzmaStateDecode.h | 96 + cfe/cfe/lzma/LzmaStateTest.c | 195 + cfe/cfe/lzma/LzmaTest.c | 342 + cfe/cfe/lzma/LzmaTypes.h | 45 + cfe/cfe/lzma/Makefile | 5 + cfe/cfe/lzma/dcapi.c | 50 + cfe/cfe/main/cfe.mk | 301 + cfe/cfe/main/cfe_attach.c | 265 + cfe/cfe/main/cfe_autoboot.c | 456 + cfe/cfe/main/cfe_background.c | 174 + cfe/cfe/main/cfe_boot.c | 248 + cfe/cfe/main/cfe_console.c | 1190 + cfe/cfe/main/cfe_devfuncs.c | 279 + cfe/cfe/main/cfe_error.c | 134 + cfe/cfe/main/cfe_fatfs.c | 1983 + cfe/cfe/main/cfe_filesys.c | 343 + cfe/cfe/main/cfe_httpfs.c | 396 + cfe/cfe/main/cfe_iocb_dispatch.c | 647 + cfe/cfe/main/cfe_ldr_elf.c | 396 + cfe/cfe/main/cfe_ldr_raw.c | 360 + cfe/cfe/main/cfe_ldr_srec.c | 557 + cfe/cfe/main/cfe_link.mk | 26 + cfe/cfe/main/cfe_loader.c | 135 + cfe/cfe/main/cfe_main.c | 636 + cfe/cfe/main/cfe_mem.c | 256 + cfe/cfe/main/cfe_rawfs.c | 293 + cfe/cfe/main/cfe_savedata.c | 123 + cfe/cfe/main/cfe_timer.c | 286 + cfe/cfe/main/cfe_version.mk | 12 + cfe/cfe/main/cfe_xreq.c | 346 + cfe/cfe/main/cfe_zlibfs.c | 453 + cfe/cfe/main/env_subr.c | 474 + cfe/cfe/main/nvram_subr.c | 300 + cfe/cfe/main/nvram_subr.h | 54 + cfe/cfe/net/README | 17 + cfe/cfe/net/dev_tcpconsole.c | 341 + cfe/cfe/net/mii.h | 187 + cfe/cfe/net/net_api.c | 1095 + cfe/cfe/net/net_api.h | 179 + cfe/cfe/net/net_arp.c | 865 + cfe/cfe/net/net_dhcp.c | 869 + cfe/cfe/net/net_dns.c | 354 + cfe/cfe/net/net_ebuf.h | 165 + cfe/cfe/net/net_ether.c | 705 + cfe/cfe/net/net_ether.h | 89 + cfe/cfe/net/net_icmp.c | 312 + cfe/cfe/net/net_ip.c | 722 + cfe/cfe/net/net_ip.h | 159 + cfe/cfe/net/net_ip_internal.h | 128 + cfe/cfe/net/net_nmrp.c | 656 + cfe/cfe/net/net_nmrp.h | 1 + cfe/cfe/net/net_tcp.c | 2215 + cfe/cfe/net/net_tcp.h | 83 + cfe/cfe/net/net_tcp_internal.h | 244 + cfe/cfe/net/net_tcpbuf.c | 298 + cfe/cfe/net/net_tcpbuf.h | 83 + cfe/cfe/net/net_tftp.c | 921 + cfe/cfe/net/net_udp.c | 637 + cfe/cfe/pccons/Makefile | 3 + cfe/cfe/pccons/README | 19 + cfe/cfe/pccons/dev_pcconsole.c | 339 + cfe/cfe/pccons/dev_pcconsole2.c | 298 + cfe/cfe/pccons/kbd_subr.c | 371 + cfe/cfe/pccons/kbd_subr.h | 82 + cfe/cfe/pccons/pcibios.h | 72 + cfe/cfe/pccons/vga.h | 76 + cfe/cfe/pccons/vga_subr.c | 285 + cfe/cfe/pccons/vga_subr.h | 82 + cfe/cfe/pccons/vgainit.c | 1164 + cfe/cfe/pccons/x86mem.c | 423 + cfe/cfe/pccons/x86mem.h | 109 + cfe/cfe/pci/cfe_pci.h | 52 + cfe/cfe/pci/devlist2h.awk | 220 + cfe/cfe/pci/ldtinit.c | 641 + cfe/cfe/pci/ldtreg.h | 184 + cfe/cfe/pci/pci_machdep.h | 35 + cfe/cfe/pci/pci_subr.c | 710 + cfe/cfe/pci/pciconf.c | 1296 + cfe/cfe/pci/pcidevs | 1355 + cfe/cfe/pci/pcidevs.h | 1360 + cfe/cfe/pci/pcidevs_data.h | 5873 +++ cfe/cfe/pci/pcireg.h | 615 + cfe/cfe/pci/pcivar.h | 216 + cfe/cfe/ui/ui_cmddisp.c | 252 + cfe/cfe/ui/ui_command.c | 990 + cfe/cfe/ui/ui_devcmds.c | 101 + cfe/cfe/ui/ui_envcmds.c | 190 + cfe/cfe/ui/ui_examcmds.c | 713 + cfe/cfe/ui/ui_flash.c | 554 + cfe/cfe/ui/ui_loadcmds.c | 366 + cfe/cfe/ui/ui_memcmds.c | 171 + cfe/cfe/ui/ui_misccmds.c | 178 + cfe/cfe/ui/ui_netcmds.c | 710 + cfe/cfe/ui/ui_pcicmds.c | 282 + cfe/cfe/ui/ui_tcpcmds.c | 828 + cfe/cfe/ui/ui_test_disk.c | 439 + cfe/cfe/ui/ui_test_ether.c | 202 + cfe/cfe/ui/ui_test_flash.c | 260 + cfe/cfe/ui/ui_test_uart.c | 117 + cfe/cfe/ui/ui_tftpd.c | 119 + cfe/cfe/ui/ui_toyclock.c | 275 + cfe/cfe/ui/url.c | 357 + cfe/cfe/ui/url.h | 52 + cfe/cfe/usb/Makefile | 8 + cfe/cfe/usb/README | 183 + cfe/cfe/usb/ohci.c | 2126 + cfe/cfe/usb/ohci.h | 490 + cfe/cfe/usb/usbchap9.h | 389 + cfe/cfe/usb/usbd.c | 1215 + cfe/cfe/usb/usbd.h | 308 + cfe/cfe/usb/usbdebug.c | 307 + cfe/cfe/usb/usbdevs.c | 168 + cfe/cfe/usb/usbeth.c | 850 + cfe/cfe/usb/usbeth.h | 112 + cfe/cfe/usb/usbhack.c | 528 + cfe/cfe/usb/usbhack.h | 66 + cfe/cfe/usb/usbhack.mk | 23 + cfe/cfe/usb/usbhid.c | 664 + cfe/cfe/usb/usbhub.c | 912 + cfe/cfe/usb/usbmain.c | 367 + cfe/cfe/usb/usbmass.c | 1199 + cfe/cfe/usb/usbserial.c | 713 + cfe/cfe/vendor/Makefile | 2 + cfe/cfe/vendor/cfe_vendor_cmds.c | 27 + cfe/cfe/vendor/cfe_vendor_iocb.h | 87 + cfe/cfe/vendor/cfe_vendor_iocb_dispatch.c | 179 + cfe/cfe/vendor/cfe_vendor_xiocb.h | 91 + cfe/cfe/vendor/cfe_vendor_xreq.c | 222 + cfe/cfe/verif/Makefile | 7 + cfe/cfe/verif/readme.txt | 342 + cfe/cfe/verif/ui_vapi.c | 300 + cfe/cfe/verif/vapi.S | 1150 + cfe/cfe/verif/vapi.h | 242 + cfe/cfe/verif/vapisubr.c | 122 + cfe/cfe/verif/vapitest.S | 108 + cfe/cfe/x86emu/LICENSE | 17 + cfe/cfe/x86emu/Makefile | 2 + cfe/cfe/x86emu/README | 12 + cfe/cfe/x86emu/debug.c | 462 + cfe/cfe/x86emu/decode.c | 1000 + cfe/cfe/x86emu/fpu.c | 945 + cfe/cfe/x86emu/ops.c | 11686 +++++ cfe/cfe/x86emu/ops2.c | 2802 ++ cfe/cfe/x86emu/prim_ops.c | 2915 ++ cfe/cfe/x86emu/sys.c | 603 + cfe/cfe/x86emu/validate.c | 765 + cfe/cfe/x86emu/x86emu.h | 198 + cfe/cfe/x86emu/x86emu/debug.h | 212 + cfe/cfe/x86emu/x86emu/decode.h | 87 + cfe/cfe/x86emu/x86emu/fpu.h | 61 + cfe/cfe/x86emu/x86emu/fpu_regs.h | 115 + cfe/cfe/x86emu/x86emu/ops.h | 45 + cfe/cfe/x86emu/x86emu/ops_protos.h | 277 + cfe/cfe/x86emu/x86emu/prim_asm.h | 971 + cfe/cfe/x86emu/x86emu/prim_ops.h | 231 + cfe/cfe/x86emu/x86emu/regs.h | 351 + cfe/cfe/x86emu/x86emu/types.h | 89 + cfe/cfe/x86emu/x86emu/x86emui.h | 109 + cfe/cfe/zlib/ChangeLog | 471 + cfe/cfe/zlib/FAQ | 72 + cfe/cfe/zlib/INDEX | 86 + cfe/cfe/zlib/Make_vms.com | 115 + cfe/cfe/zlib/Makefile | 28 + cfe/cfe/zlib/Makefile.in | 174 + cfe/cfe/zlib/Makefile.orig | 174 + cfe/cfe/zlib/Makefile.riscos | 151 + cfe/cfe/zlib/README | 148 + cfe/cfe/zlib/adler32.c | 48 + cfe/cfe/zlib/algorithm.txt | 213 + cfe/cfe/zlib/compress.c | 68 + cfe/cfe/zlib/configure | 212 + cfe/cfe/zlib/crc32.c | 162 + cfe/cfe/zlib/deflate.c | 1350 + cfe/cfe/zlib/deflate.h | 318 + cfe/cfe/zlib/descrip.mms | 48 + cfe/cfe/zlib/example.c | 556 + cfe/cfe/zlib/gzio.c | 875 + cfe/cfe/zlib/infblock.c | 398 + cfe/cfe/zlib/infblock.h | 39 + cfe/cfe/zlib/infcodes.c | 257 + cfe/cfe/zlib/infcodes.h | 27 + cfe/cfe/zlib/inffast.c | 170 + cfe/cfe/zlib/inffast.h | 17 + cfe/cfe/zlib/inffixed.h | 151 + cfe/cfe/zlib/inflate.c | 366 + cfe/cfe/zlib/inftrees.c | 455 + cfe/cfe/zlib/inftrees.h | 58 + cfe/cfe/zlib/infutil.c | 87 + cfe/cfe/zlib/infutil.h | 98 + cfe/cfe/zlib/maketree.c | 85 + cfe/cfe/zlib/minigzip.c | 320 + cfe/cfe/zlib/trees.c | 1214 + cfe/cfe/zlib/trees.h | 128 + cfe/cfe/zlib/uncompr.c | 58 + cfe/cfe/zlib/zconf.h | 279 + cfe/cfe/zlib/zlib.3 | 107 + cfe/cfe/zlib/zlib.h | 893 + cfe/cfe/zlib/zutil.c | 225 + cfe/cfe/zlib/zutil.h | 220 + cfe/docs/cfe.pdf | Bin 0 -> 395677 bytes shared/broadcom/include/bcm963xx/6328_common.h | 299 + shared/broadcom/include/bcm963xx/6328_map.h | 1886 + shared/broadcom/include/bcm963xx/6362_common.h | 326 + shared/broadcom/include/bcm963xx/6362_map.h | 2251 + shared/broadcom/include/bcm963xx/6368_common.h | 270 + shared/broadcom/include/bcm963xx/6368_map.h | 1592 + shared/broadcom/include/bcm963xx/6816_common.h | 351 + shared/broadcom/include/bcm963xx/6816_map.h | 2322 + shared/broadcom/include/bcm963xx/mocablock.h | 144 + shared/broadcom/include/bcm963xx/robosw_reg.h | 169 + shared/broadcom/include/bcm963xx/xtmprocregs.h | 602 + shared/opensource/boardparms/bcm963xx/Makefile | 16 + shared/opensource/boardparms/bcm963xx/boardparms.c | 3712 ++ .../boardparms/bcm963xx/boardparms_voice.c | 8804 ++++ shared/opensource/flash/Makefile | 41 + shared/opensource/flash/cfiflash.c | 1112 + shared/opensource/flash/flash_api.c | 350 + shared/opensource/flash/flash_common.c | 280 + shared/opensource/flash/nandflash.c | 1260 + shared/opensource/flash/spiflash.c | 969 + shared/opensource/include/bcm963xx/6328_cpu.h | 150 + shared/opensource/include/bcm963xx/6328_intr.h | 120 + shared/opensource/include/bcm963xx/6328_map_part.h | 1325 + shared/opensource/include/bcm963xx/6362_cpu.h | 150 + shared/opensource/include/bcm963xx/6362_intr.h | 123 + shared/opensource/include/bcm963xx/6362_map_part.h | 1478 + shared/opensource/include/bcm963xx/6368_cpu.h | 150 + shared/opensource/include/bcm963xx/6368_intr.h | 123 + shared/opensource/include/bcm963xx/6368_map_part.h | 1035 + shared/opensource/include/bcm963xx/6816_cpu.h | 150 + shared/opensource/include/bcm963xx/6816_intr.h | 116 + shared/opensource/include/bcm963xx/6816_map_part.h | 1487 + shared/opensource/include/bcm963xx/bcmSpi.h | 55 + shared/opensource/include/bcm963xx/bcmSpiRes.h | 101 + shared/opensource/include/bcm963xx/bcmTag.h | 175 + shared/opensource/include/bcm963xx/bcm_hwdefs.h | 193 + shared/opensource/include/bcm963xx/bcmnetlink.h | 47 + shared/opensource/include/bcm963xx/boardparms.h | 453 + .../opensource/include/bcm963xx/boardparms_voice.h | 392 + shared/opensource/include/bcm963xx/fap_mod_size.h | 2 + shared/opensource/include/bcm963xx/flash_api.h | 90 + shared/opensource/include/bcm963xx/flash_common.h | 103 + shared/opensource/include/bcm963xx/gpio_drv.h | 40 + shared/opensource/include/bcm963xx/wan_det.h | 245 + shared/opensource/include/bcm963xx/wps_led.h | 28 + shared/opensource/spi/Makefile | 30 + shared/opensource/spi/bcmHsSpi.c | 898 + shared/opensource/spi/bcmLegSpi.c | 774 + shared/opensource/spi/bcmSpiRes.c | 660 + uclibc-crosstools-gcc-4.4.2-1/.fakeroot.00000 | 0 .../lib/ld-uClibc-0.9.29.so | Bin 0 -> 22600 bytes uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc.so.0 | 1 + uclibc-crosstools-gcc-4.4.2-1/lib/libc.so.0 | 1 + .../lib/libcrypt-0.9.29.so | Bin 0 -> 11560 bytes uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt.so.0 | 1 + uclibc-crosstools-gcc-4.4.2-1/lib/libdl-0.9.29.so | Bin 0 -> 9452 bytes uclibc-crosstools-gcc-4.4.2-1/lib/libdl.so.0 | 1 + uclibc-crosstools-gcc-4.4.2-1/lib/libm-0.9.29.so | Bin 0 -> 104028 bytes uclibc-crosstools-gcc-4.4.2-1/lib/libm.so.0 | 1 + uclibc-crosstools-gcc-4.4.2-1/lib/libnsl-0.9.29.so | Bin 0 -> 1712 bytes uclibc-crosstools-gcc-4.4.2-1/lib/libnsl.so.0 | 1 + .../lib/libpthread-0.9.29.so | Bin 0 -> 94007 bytes uclibc-crosstools-gcc-4.4.2-1/lib/libpthread.so.0 | 1 + .../lib/libresolv-0.9.29.so | Bin 0 -> 1716 bytes uclibc-crosstools-gcc-4.4.2-1/lib/libresolv.so.0 | 1 + uclibc-crosstools-gcc-4.4.2-1/lib/librt-0.9.29.so | Bin 0 -> 4588 bytes uclibc-crosstools-gcc-4.4.2-1/lib/librt.so.0 | 1 + .../lib/libthread_db-0.9.29.so | Bin 0 -> 13400 bytes .../lib/libthread_db.so.1 | 1 + .../lib/libuClibc-0.9.29.so | Bin 0 -> 410084 bytes .../lib/libutil-0.9.29.so | Bin 0 -> 4884 bytes uclibc-crosstools-gcc-4.4.2-1/lib/libutil.so.0 | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldconfig | Bin 0 -> 22788 bytes uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldd | Bin 0 -> 14280 bytes .../usr/bin/mips-linux-addr2line | 1 + .../usr/bin/mips-linux-ar | 1 + .../usr/bin/mips-linux-as | 1 + .../usr/bin/mips-linux-c++ | 1 + .../usr/bin/mips-linux-c++filt | 1 + .../usr/bin/mips-linux-cc | 1 + .../usr/bin/mips-linux-cpp | 1 + .../usr/bin/mips-linux-g++ | 1 + .../usr/bin/mips-linux-gcc | 1 + .../usr/bin/mips-linux-gcc-4.4.2 | 1 + .../usr/bin/mips-linux-gccbug | 1 + .../usr/bin/mips-linux-gcov | 1 + .../usr/bin/mips-linux-gdb | 1 + .../usr/bin/mips-linux-gprof | 1 + .../usr/bin/mips-linux-ld | 1 + .../usr/bin/mips-linux-ldconfig | 1 + .../usr/bin/mips-linux-ldd | 1 + .../usr/bin/mips-linux-nm | 1 + .../usr/bin/mips-linux-objcopy | 1 + .../usr/bin/mips-linux-objdump | 1 + .../usr/bin/mips-linux-ranlib | 1 + .../usr/bin/mips-linux-readelf | 1 + .../usr/bin/mips-linux-size | 1 + .../usr/bin/mips-linux-sstrip | 1 + .../usr/bin/mips-linux-strings | 1 + .../usr/bin/mips-linux-strip | 1 + .../usr/bin/mips-linux-uclibc-addr2line | Bin 0 -> 3171381 bytes .../usr/bin/mips-linux-uclibc-ar | Bin 0 -> 3303875 bytes .../usr/bin/mips-linux-uclibc-as | Bin 0 -> 4688774 bytes .../usr/bin/mips-linux-uclibc-c++ | Bin 0 -> 461847 bytes .../usr/bin/mips-linux-uclibc-c++filt | Bin 0 -> 3149852 bytes .../usr/bin/mips-linux-uclibc-cc | 1 + .../usr/bin/mips-linux-uclibc-cpp | Bin 0 -> 461124 bytes .../usr/bin/mips-linux-uclibc-g++ | Bin 0 -> 461847 bytes .../usr/bin/mips-linux-uclibc-gcc | Bin 0 -> 460197 bytes .../usr/bin/mips-linux-uclibc-gcc-4.4.2 | Bin 0 -> 460197 bytes .../usr/bin/mips-linux-uclibc-gccbug | 558 + .../usr/bin/mips-linux-uclibc-gcov | Bin 0 -> 90782 bytes .../usr/bin/mips-linux-uclibc-gdb | Bin 0 -> 2970040 bytes .../usr/bin/mips-linux-uclibc-gprof | Bin 0 -> 3563218 bytes .../usr/bin/mips-linux-uclibc-ld | Bin 0 -> 5051954 bytes .../usr/bin/mips-linux-uclibc-ldconfig | 1 + .../usr/bin/mips-linux-uclibc-ldd | 1 + .../usr/bin/mips-linux-uclibc-nm | Bin 0 -> 3204106 bytes .../usr/bin/mips-linux-uclibc-objcopy | Bin 0 -> 3749936 bytes .../usr/bin/mips-linux-uclibc-objdump | Bin 0 -> 4047818 bytes .../usr/bin/mips-linux-uclibc-ranlib | Bin 0 -> 3303906 bytes .../usr/bin/mips-linux-uclibc-readelf | Bin 0 -> 589865 bytes .../usr/bin/mips-linux-uclibc-size | Bin 0 -> 3196486 bytes .../usr/bin/mips-linux-uclibc-sstrip | Bin 0 -> 33954 bytes .../usr/bin/mips-linux-uclibc-strings | Bin 0 -> 3173046 bytes .../usr/bin/mips-linux-uclibc-strip | Bin 0 -> 3749927 bytes uclibc-crosstools-gcc-4.4.2-1/usr/include/a.out.h | 5 + uclibc-crosstools-gcc-4.4.2-1/usr/include/alloca.h | 43 + uclibc-crosstools-gcc-4.4.2-1/usr/include/ar.h | 48 + .../usr/include/arpa/ftp.h | 105 + .../usr/include/arpa/inet.h | 106 + .../usr/include/arpa/nameser.h | 557 + .../usr/include/arpa/nameser_compat.h | 183 + .../usr/include/arpa/telnet.h | 316 + .../usr/include/arpa/tftp.h | 76 + .../usr/include/asm-generic/..install.cmd | 1 + .../usr/include/asm-generic/.install | 0 .../usr/include/asm-generic/errno-base.h | 39 + .../usr/include/asm-generic/errno.h | 109 + .../usr/include/asm-generic/fcntl.h | 151 + .../usr/include/asm-generic/int-l64.h | 32 + .../usr/include/asm-generic/int-ll64.h | 37 + .../usr/include/asm-generic/ioctl.h | 96 + .../usr/include/asm-generic/mman.h | 41 + .../usr/include/asm-generic/poll.h | 37 + .../usr/include/asm-generic/resource.h | 68 + .../usr/include/asm-generic/siginfo.h | 261 + .../usr/include/asm-generic/signal.h | 28 + .../usr/include/asm-generic/statfs.h | 80 + .../usr/include/asm/..install.cmd | 1 + .../usr/include/asm/.install | 0 .../usr/include/asm/auxvec.h | 4 + .../usr/include/asm/byteorder.h | 19 + .../usr/include/asm/cachectl.h | 26 + .../usr/include/asm/errno.h | 125 + .../usr/include/asm/fcntl.h | 61 + .../usr/include/asm/ioctl.h | 89 + .../usr/include/asm/ioctls.h | 109 + .../usr/include/asm/ipcbuf.h | 28 + .../usr/include/asm/mman.h | 77 + .../usr/include/asm/msgbuf.h | 47 + .../usr/include/asm/param.h | 25 + .../usr/include/asm/poll.h | 9 + .../usr/include/asm/posix_types.h | 73 + .../usr/include/asm/ptrace.h | 116 + .../usr/include/asm/resource.h | 35 + .../usr/include/asm/sembuf.h | 22 + .../usr/include/asm/setup.h | 7 + .../usr/include/asm/sgidefs.h | 44 + .../usr/include/asm/shmbuf.h | 38 + .../usr/include/asm/sigcontext.h | 78 + .../usr/include/asm/siginfo.h | 113 + .../usr/include/asm/signal.h | 123 + .../usr/include/asm/socket.h | 82 + .../usr/include/asm/sockios.h | 26 + .../usr/include/asm/stat.h | 132 + .../usr/include/asm/statfs.h | 96 + .../usr/include/asm/swab.h | 55 + .../usr/include/asm/sysmips.h | 25 + .../usr/include/asm/termbits.h | 226 + .../usr/include/asm/termios.h | 80 + .../usr/include/asm/types.h | 34 + .../usr/include/asm/unistd.h | 986 + uclibc-crosstools-gcc-4.4.2-1/usr/include/assert.h | 82 + uclibc-crosstools-gcc-4.4.2-1/usr/include/atomic.h | 261 + .../usr/include/bits/atomic.h | 303 + .../usr/include/bits/byteswap.h | 87 + .../usr/include/bits/cmathcalls.h | 158 + .../usr/include/bits/confname.h | 606 + .../usr/include/bits/dirent.h | 61 + .../usr/include/bits/dlfcn.h | 66 + .../usr/include/bits/elfclass.h | 14 + .../usr/include/bits/endian.h | 16 + .../usr/include/bits/environments.h | 78 + .../usr/include/bits/errno.h | 59 + .../usr/include/bits/errno_values.h | 135 + .../usr/include/bits/fcntl.h | 261 + .../usr/include/bits/fenv.h | 77 + .../usr/include/bits/fenvinline.h | 8 + .../usr/include/bits/getopt.h | 181 + .../usr/include/bits/huge_val.h | 55 + .../usr/include/bits/huge_valf.h | 53 + .../usr/include/bits/huge_vall.h | 29 + .../usr/include/bits/in.h | 170 + .../usr/include/bits/inf.h | 30 + .../usr/include/bits/initspin.h | 28 + .../usr/include/bits/ioctl-types.h | 76 + .../usr/include/bits/ioctls.h | 109 + .../usr/include/bits/ipc.h | 55 + .../usr/include/bits/kernel_types.h | 79 + .../usr/include/bits/local_lim.h | 87 + .../usr/include/bits/locale.h | 46 + .../usr/include/bits/mathcalls.h | 365 + .../usr/include/bits/mathdef.h | 48 + .../usr/include/bits/mathinline.h | 12 + .../usr/include/bits/mman.h | 106 + .../usr/include/bits/mqueue.h | 32 + .../usr/include/bits/msq.h | 93 + .../usr/include/bits/nan.h | 53 + .../usr/include/bits/netdb.h | 33 + .../usr/include/bits/poll.h | 50 + .../usr/include/bits/posix1_lim.h | 169 + .../usr/include/bits/posix2_lim.h | 91 + .../usr/include/bits/posix_opt.h | 180 + .../usr/include/bits/pthreadtypes.h | 142 + .../usr/include/bits/resource.h | 233 + .../usr/include/bits/sched.h | 132 + .../usr/include/bits/select.h | 35 + .../usr/include/bits/sem.h | 85 + .../usr/include/bits/setjmp.h | 72 + .../usr/include/bits/shm.h | 94 + .../usr/include/bits/sigaction.h | 89 + .../usr/include/bits/sigcontext.h | 84 + .../usr/include/bits/sigcontextinfo.h | 43 + .../usr/include/bits/siginfo.h | 311 + .../usr/include/bits/signum.h | 79 + .../usr/include/bits/sigset.h | 125 + .../usr/include/bits/sigstack.h | 55 + .../usr/include/bits/sigthread.h | 38 + .../usr/include/bits/sockaddr.h | 40 + .../usr/include/bits/socket.h | 328 + .../usr/include/bits/stackinfo.h | 28 + .../usr/include/bits/stat.h | 203 + .../usr/include/bits/statfs.h | 72 + .../usr/include/bits/statvfs.h | 107 + .../usr/include/bits/stdio.h | 23 + .../usr/include/bits/stdio_lim.h | 41 + .../usr/include/bits/syscalls.h | 1 + .../usr/include/bits/sysnum.h | 1028 + .../usr/include/bits/termios.h | 217 + .../usr/include/bits/time.h | 79 + .../usr/include/bits/types.h | 209 + .../usr/include/bits/typesizes.h | 66 + .../usr/include/bits/uClibc_arch_features.h | 41 + .../usr/include/bits/uClibc_clk_tck.h | 8 + .../usr/include/bits/uClibc_config.h | 189 + .../usr/include/bits/uClibc_ctype.h | 279 + .../usr/include/bits/uClibc_errno.h | 43 + .../usr/include/bits/uClibc_fpmax.h | 122 + .../usr/include/bits/uClibc_local_lim.h | 33 + .../usr/include/bits/uClibc_locale.h | 380 + .../usr/include/bits/uClibc_mutex.h | 88 + .../usr/include/bits/uClibc_page.h | 35 + .../usr/include/bits/uClibc_pthread.h | 50 + .../usr/include/bits/uClibc_stdio.h | 517 + .../usr/include/bits/uClibc_touplow.h | 55 + .../usr/include/bits/uClibc_uwchar.h | 57 + .../usr/include/bits/uClibc_va_copy.h | 40 + .../usr/include/bits/uio.h | 50 + .../usr/include/bits/ustat.h | 31 + .../usr/include/bits/utmp.h | 125 + .../usr/include/bits/utmpx.h | 103 + .../usr/include/bits/utsname.h | 29 + .../usr/include/bits/waitflags.h | 38 + .../usr/include/bits/waitstatus.h | 106 + .../usr/include/bits/wchar.h | 26 + .../usr/include/bits/wordsize.h | 19 + .../usr/include/bits/xopen_lim.h | 150 + .../usr/include/byteswap.h | 40 + .../usr/include/complex.h | 107 + uclibc-crosstools-gcc-4.4.2-1/usr/include/cpio.h | 74 + uclibc-crosstools-gcc-4.4.2-1/usr/include/crypt.h | 41 + uclibc-crosstools-gcc-4.4.2-1/usr/include/ctype.h | 383 + uclibc-crosstools-gcc-4.4.2-1/usr/include/dirent.h | 293 + uclibc-crosstools-gcc-4.4.2-1/usr/include/dlfcn.h | 201 + .../usr/include/drm/..install.cmd | 1 + .../usr/include/drm/.install | 0 .../usr/include/drm/drm.h | 744 + .../usr/include/drm/drm_mode.h | 268 + .../usr/include/drm/drm_sarea.h | 82 + .../usr/include/drm/i810_drm.h | 281 + .../usr/include/drm/i830_drm.h | 342 + .../usr/include/drm/i915_drm.h | 670 + .../usr/include/drm/mga_drm.h | 419 + .../usr/include/drm/r128_drm.h | 326 + .../usr/include/drm/radeon_drm.h | 754 + .../usr/include/drm/savage_drm.h | 210 + .../usr/include/drm/sis_drm.h | 67 + .../usr/include/drm/via_drm.h | 275 + uclibc-crosstools-gcc-4.4.2-1/usr/include/elf.h | 2928 ++ uclibc-crosstools-gcc-4.4.2-1/usr/include/endian.h | 58 + uclibc-crosstools-gcc-4.4.2-1/usr/include/err.h | 58 + uclibc-crosstools-gcc-4.4.2-1/usr/include/errno.h | 77 + uclibc-crosstools-gcc-4.4.2-1/usr/include/error.h | 52 + uclibc-crosstools-gcc-4.4.2-1/usr/include/fcntl.h | 228 + .../usr/include/features.h | 424 + .../usr/include/fnmatch.h | 72 + .../usr/include/fpu_control.h | 100 + uclibc-crosstools-gcc-4.4.2-1/usr/include/getopt.h | 4 + uclibc-crosstools-gcc-4.4.2-1/usr/include/glob.h | 208 + .../usr/include/gnu-versions.h | 53 + uclibc-crosstools-gcc-4.4.2-1/usr/include/grp.h | 207 + .../usr/include/hp-timing.h | 83 + .../usr/include/ieee754.h | 199 + .../usr/include/inttypes.h | 328 + .../usr/include/langinfo.h | 623 + .../usr/include/lastlog.h | 4 + .../usr/include/libc-internal.h | 3 + .../usr/include/libc-symbols.h | 726 + uclibc-crosstools-gcc-4.4.2-1/usr/include/libgen.h | 40 + uclibc-crosstools-gcc-4.4.2-1/usr/include/limits.h | 153 + uclibc-crosstools-gcc-4.4.2-1/usr/include/link.h | 238 + .../usr/include/linux/..install.cmd | 1 + .../usr/include/linux/.install | 0 .../usr/include/linux/acct.h | 116 + .../usr/include/linux/adb.h | 44 + .../usr/include/linux/adfs_fs.h | 44 + .../usr/include/linux/affs_hardblocks.h | 68 + .../usr/include/linux/agpgart.h | 111 + .../usr/include/linux/aio_abi.h | 111 + .../usr/include/linux/apm_bios.h | 135 + .../usr/include/linux/arcfb.h | 8 + .../usr/include/linux/atalk.h | 43 + .../usr/include/linux/atm.h | 241 + .../usr/include/linux/atm_eni.h | 23 + .../usr/include/linux/atm_he.h | 20 + .../usr/include/linux/atm_idt77105.h | 28 + .../usr/include/linux/atm_nicstar.h | 53 + .../usr/include/linux/atm_tcp.h | 61 + .../usr/include/linux/atm_zatm.h | 52 + .../usr/include/linux/atmapi.h | 29 + .../usr/include/linux/atmarp.h | 41 + .../usr/include/linux/atmbr2684.h | 117 + .../usr/include/linux/atmclip.h | 21 + .../usr/include/linux/atmdev.h | 215 + .../usr/include/linux/atmioc.h | 41 + .../usr/include/linux/atmlec.h | 98 + .../usr/include/linux/atmmpc.h | 126 + .../usr/include/linux/atmppp.h | 24 + .../usr/include/linux/atmsap.h | 162 + .../usr/include/linux/atmsvc.h | 55 + .../usr/include/linux/audit.h | 361 + .../usr/include/linux/auto_fs.h | 79 + .../usr/include/linux/auto_fs4.h | 164 + .../usr/include/linux/auxvec.h | 35 + .../usr/include/linux/ax25.h | 116 + .../usr/include/linux/b1lli.h | 73 + .../usr/include/linux/baycom.h | 39 + .../usr/include/linux/bfs_fs.h | 81 + .../usr/include/linux/binfmts.h | 20 + .../usr/include/linux/blkpg.h | 58 + .../usr/include/linux/blktrace_api.h | 141 + .../usr/include/linux/bpqether.h | 41 + .../usr/include/linux/bsg.h | 65 + .../usr/include/linux/byteorder/..install.cmd | 1 + .../usr/include/linux/byteorder/.install | 0 .../usr/include/linux/byteorder/big_endian.h | 105 + .../usr/include/linux/byteorder/little_endian.h | 105 + .../usr/include/linux/can.h | 111 + .../usr/include/linux/can/..install.cmd | 1 + .../usr/include/linux/can/.install | 0 .../usr/include/linux/can/bcm.h | 67 + .../usr/include/linux/can/error.h | 93 + .../usr/include/linux/can/raw.h | 31 + .../usr/include/linux/capability.h | 347 + .../usr/include/linux/capi.h | 131 + .../usr/include/linux/cciss_ioctl.h | 214 + .../usr/include/linux/cdk.h | 486 + .../usr/include/linux/cdrom.h | 912 + .../usr/include/linux/cgroupstats.h | 71 + .../usr/include/linux/chio.h | 168 + .../usr/include/linux/cm4000_cs.h | 62 + .../usr/include/linux/cn_proc.h | 100 + .../usr/include/linux/coda.h | 737 + .../usr/include/linux/coda_psdev.h | 27 + .../usr/include/linux/coff.h | 351 + .../usr/include/linux/comstats.h | 119 + .../usr/include/linux/connector.h | 98 + .../usr/include/linux/const.h | 24 + .../usr/include/linux/cramfs_fs.h | 93 + .../usr/include/linux/cuda.h | 28 + .../usr/include/linux/cyclades.h | 506 + .../usr/include/linux/cycx_cfm.h | 101 + .../usr/include/linux/dcbnl.h | 342 + .../usr/include/linux/dccp.h | 218 + .../usr/include/linux/dlm.h | 77 + .../usr/include/linux/dlm_device.h | 108 + .../usr/include/linux/dlm_netlink.h | 58 + .../usr/include/linux/dlm_plock.h | 44 + .../usr/include/linux/dlmconstants.h | 163 + .../usr/include/linux/dm-ioctl.h | 302 + .../usr/include/linux/dn.h | 149 + .../usr/include/linux/dqblk_xfs.h | 157 + .../usr/include/linux/dvb/..install.cmd | 1 + .../usr/include/linux/dvb/.install | 0 .../usr/include/linux/dvb/audio.h | 135 + .../usr/include/linux/dvb/ca.h | 90 + .../usr/include/linux/dvb/dmx.h | 151 + .../usr/include/linux/dvb/frontend.h | 385 + .../usr/include/linux/dvb/net.h | 52 + .../usr/include/linux/dvb/osd.h | 144 + .../usr/include/linux/dvb/version.h | 29 + .../usr/include/linux/dvb/video.h | 272 + .../usr/include/linux/edd.h | 191 + .../usr/include/linux/efs_fs_sb.h | 62 + .../usr/include/linux/elf-em.h | 55 + .../usr/include/linux/elf-fdpic.h | 62 + .../usr/include/linux/elf.h | 377 + .../usr/include/linux/elfcore.h | 95 + .../usr/include/linux/errno.h | 7 + .../usr/include/linux/errqueue.h | 26 + .../usr/include/linux/ethtool.h | 530 + .../usr/include/linux/eventpoll.h | 54 + .../usr/include/linux/ext2_fs.h | 556 + .../usr/include/linux/fadvise.h | 21 + .../usr/include/linux/falloc.h | 6 + .../usr/include/linux/fb.h | 393 + .../usr/include/linux/fcntl.h | 44 + .../usr/include/linux/fd.h | 380 + .../usr/include/linux/fdreg.h | 137 + .../usr/include/linux/fib_rules.h | 71 + .../usr/include/linux/fiemap.h | 66 + .../usr/include/linux/filter.h | 128 + .../usr/include/linux/firewire-cdev.h | 634 + .../usr/include/linux/firewire-constants.h | 67 + .../usr/include/linux/flat.h | 58 + .../usr/include/linux/fs.h | 356 + .../usr/include/linux/fuse.h | 480 + .../usr/include/linux/futex.h | 151 + .../usr/include/linux/gameport.h | 28 + .../usr/include/linux/gen_stats.h | 67 + .../usr/include/linux/generic_serial.h | 36 + .../usr/include/linux/genetlink.h | 83 + .../usr/include/linux/gfs2_ondisk.h | 451 + .../usr/include/linux/gigaset_dev.h | 30 + .../usr/include/linux/hayesesp.h | 17 + .../usr/include/linux/hdlc.h | 23 + .../usr/include/linux/hdlc/..install.cmd | 1 + .../usr/include/linux/hdlc/.install | 0 .../usr/include/linux/hdlc/ioctl.h | 81 + .../usr/include/linux/hdlcdrv.h | 110 + .../usr/include/linux/hdreg.h | 642 + .../usr/include/linux/hid.h | 67 + .../usr/include/linux/hiddev.h | 212 + .../usr/include/linux/hidraw.h | 47 + .../usr/include/linux/hpet.h | 23 + .../usr/include/linux/hysdn_if.h | 33 + .../usr/include/linux/i2c-dev.h | 71 + .../usr/include/linux/i2c.h | 149 + .../usr/include/linux/i2o-dev.h | 421 + .../usr/include/linux/i8k.h | 46 + .../usr/include/linux/icmp.h | 97 + .../usr/include/linux/icmpv6.h | 164 + .../usr/include/linux/if.h | 223 + .../usr/include/linux/if_addr.h | 61 + .../usr/include/linux/if_addrlabel.h | 34 + .../usr/include/linux/if_arcnet.h | 138 + .../usr/include/linux/if_arp.h | 156 + .../usr/include/linux/if_bonding.h | 125 + .../usr/include/linux/if_bridge.h | 104 + .../usr/include/linux/if_cablemodem.h | 22 + .../usr/include/linux/if_ec.h | 36 + .../usr/include/linux/if_eql.h | 54 + .../usr/include/linux/if_ether.h | 121 + .../usr/include/linux/if_fc.h | 51 + .../usr/include/linux/if_fddi.h | 108 + .../usr/include/linux/if_frad.h | 127 + .../usr/include/linux/if_hippi.h | 158 + .../usr/include/linux/if_infiniband.h | 29 + .../usr/include/linux/if_link.h | 191 + .../usr/include/linux/if_ltalk.h | 9 + .../usr/include/linux/if_packet.h | 139 + .../usr/include/linux/if_phonet.h | 16 + .../usr/include/linux/if_plip.h | 28 + .../usr/include/linux/if_ppp.h | 173 + .../usr/include/linux/if_pppol2tp.h | 66 + .../usr/include/linux/if_pppox.h | 123 + .../usr/include/linux/if_slip.h | 30 + .../usr/include/linux/if_strip.h | 27 + .../usr/include/linux/if_tr.h | 95 + .../usr/include/linux/if_tun.h | 87 + .../usr/include/linux/if_tunnel.h | 69 + .../usr/include/linux/if_vlan.h | 62 + .../usr/include/linux/igmp.h | 129 + .../usr/include/linux/in.h | 254 + .../usr/include/linux/in6.h | 274 + .../usr/include/linux/in_route.h | 32 + .../usr/include/linux/inet_diag.h | 124 + .../usr/include/linux/inotify.h | 73 + .../usr/include/linux/input.h | 982 + .../usr/include/linux/ioctl.h | 7 + .../usr/include/linux/ip.h | 136 + .../usr/include/linux/ip6_tunnel.h | 32 + .../usr/include/linux/ip_vs.h | 405 + .../usr/include/linux/ipc.h | 81 + .../usr/include/linux/ipmi.h | 456 + .../usr/include/linux/ipmi_msgdefs.h | 121 + .../usr/include/linux/ipsec.h | 47 + .../usr/include/linux/ipv6.h | 159 + .../usr/include/linux/ipv6_route.h | 58 + .../usr/include/linux/ipx.h | 75 + .../usr/include/linux/irda.h | 254 + .../usr/include/linux/irqnr.h | 8 + .../usr/include/linux/isdn.h | 142 + .../usr/include/linux/isdn/..install.cmd | 1 + .../usr/include/linux/isdn/.install | 0 .../usr/include/linux/isdn/capicmd.h | 115 + .../usr/include/linux/isdn_divertif.h | 26 + .../usr/include/linux/isdn_ppp.h | 67 + .../usr/include/linux/isdnif.h | 56 + .../usr/include/linux/iso_fs.h | 165 + .../usr/include/linux/ivtv.h | 69 + .../usr/include/linux/ivtvfb.h | 38 + .../usr/include/linux/ixjuser.h | 720 + .../usr/include/linux/jffs2.h | 222 + .../usr/include/linux/joystick.h | 136 + .../usr/include/linux/kd.h | 182 + .../usr/include/linux/kdev_t.h | 11 + .../usr/include/linux/kernel.h | 51 + .../usr/include/linux/kernelcapi.h | 47 + .../usr/include/linux/keyboard.h | 442 + .../usr/include/linux/keyctl.h | 56 + .../usr/include/linux/limits.h | 20 + .../usr/include/linux/llc.h | 73 + .../usr/include/linux/loop.h | 90 + .../usr/include/linux/lp.h | 100 + .../usr/include/linux/magic.h | 53 + .../usr/include/linux/major.h | 176 + .../usr/include/linux/map_to_7segment.h | 187 + .../usr/include/linux/matroxfb.h | 43 + .../usr/include/linux/mempolicy.h | 56 + .../usr/include/linux/meye.h | 66 + .../usr/include/linux/mii.h | 150 + .../usr/include/linux/minix_fs.h | 106 + .../usr/include/linux/mman.h | 13 + .../usr/include/linux/mmtimer.h | 56 + .../usr/include/linux/mqueue.h | 53 + .../usr/include/linux/mroute.h | 141 + .../usr/include/linux/mroute6.h | 137 + .../usr/include/linux/msdos_fs.h | 165 + .../usr/include/linux/msg.h | 75 + .../usr/include/linux/mtio.h | 206 + .../usr/include/linux/n_r3964.h | 99 + .../usr/include/linux/nbd.h | 68 + .../usr/include/linux/ncp.h | 198 + .../usr/include/linux/ncp_fs.h | 147 + .../usr/include/linux/ncp_mount.h | 72 + .../usr/include/linux/ncp_no.h | 19 + .../usr/include/linux/neighbour.h | 161 + .../usr/include/linux/net.h | 55 + .../usr/include/linux/net_dropmon.h | 57 + .../usr/include/linux/netdevice.h | 92 + .../usr/include/linux/netfilter.h | 59 + .../usr/include/linux/netfilter/..install.cmd | 1 + .../usr/include/linux/netfilter/.install | 0 .../include/linux/netfilter/nf_conntrack_common.h | 148 + .../usr/include/linux/netfilter/nf_conntrack_ftp.h | 19 + .../include/linux/netfilter/nf_conntrack_sctp.h | 26 + .../usr/include/linux/netfilter/nf_conntrack_tcp.h | 47 + .../linux/netfilter/nf_conntrack_tuple_common.h | 13 + .../usr/include/linux/netfilter/nfnetlink.h | 51 + .../usr/include/linux/netfilter/nfnetlink_compat.h | 62 + .../include/linux/netfilter/nfnetlink_conntrack.h | 172 + .../usr/include/linux/netfilter/nfnetlink_log.h | 96 + .../usr/include/linux/netfilter/nfnetlink_queue.h | 90 + .../usr/include/linux/netfilter/x_tables.h | 175 + .../usr/include/linux/netfilter/xt_CLASSIFY.h | 10 + .../usr/include/linux/netfilter/xt_CONNMARK.h | 32 + .../usr/include/linux/netfilter/xt_CONNSECMARK.h | 15 + .../usr/include/linux/netfilter/xt_DSCP.h | 26 + .../usr/include/linux/netfilter/xt_LED.h | 15 + .../usr/include/linux/netfilter/xt_MARK.h | 27 + .../usr/include/linux/netfilter/xt_NFLOG.h | 20 + .../usr/include/linux/netfilter/xt_NFQUEUE.h | 18 + .../usr/include/linux/netfilter/xt_RATEEST.h | 15 + .../usr/include/linux/netfilter/xt_SECMARK.h | 28 + .../usr/include/linux/netfilter/xt_TCPMSS.h | 12 + .../usr/include/linux/netfilter/xt_TCPOPTSTRIP.h | 13 + .../usr/include/linux/netfilter/xt_TPROXY.h | 14 + .../usr/include/linux/netfilter/xt_cluster.h | 17 + .../usr/include/linux/netfilter/xt_comment.h | 10 + .../usr/include/linux/netfilter/xt_connbytes.h | 27 + .../usr/include/linux/netfilter/xt_connlimit.h | 20 + .../usr/include/linux/netfilter/xt_connmark.h | 25 + .../usr/include/linux/netfilter/xt_conntrack.h | 84 + .../usr/include/linux/netfilter/xt_dccp.h | 25 + .../usr/include/linux/netfilter/xt_dscp.h | 31 + .../usr/include/linux/netfilter/xt_esp.h | 16 + .../usr/include/linux/netfilter/xt_hashlimit.h | 68 + .../usr/include/linux/netfilter/xt_helper.h | 8 + .../usr/include/linux/netfilter/xt_iprange.h | 19 + .../usr/include/linux/netfilter/xt_length.h | 11 + .../usr/include/linux/netfilter/xt_limit.h | 24 + .../usr/include/linux/netfilter/xt_mac.h | 8 + .../usr/include/linux/netfilter/xt_mark.h | 16 + .../usr/include/linux/netfilter/xt_multiport.h | 32 + .../usr/include/linux/netfilter/xt_owner.h | 18 + .../usr/include/linux/netfilter/xt_physdev.h | 23 + .../usr/include/linux/netfilter/xt_pkttype.h | 8 + .../usr/include/linux/netfilter/xt_policy.h | 64 + .../usr/include/linux/netfilter/xt_quota.h | 20 + .../usr/include/linux/netfilter/xt_rateest.h | 37 + .../usr/include/linux/netfilter/xt_realm.h | 12 + .../usr/include/linux/netfilter/xt_recent.h | 28 + .../usr/include/linux/netfilter/xt_sctp.h | 92 + .../usr/include/linux/netfilter/xt_state.h | 13 + .../usr/include/linux/netfilter/xt_statistic.h | 36 + .../usr/include/linux/netfilter/xt_string.h | 35 + .../usr/include/linux/netfilter/xt_tcpmss.h | 11 + .../usr/include/linux/netfilter/xt_tcpudp.h | 38 + .../usr/include/linux/netfilter/xt_time.h | 25 + .../usr/include/linux/netfilter/xt_u32.h | 40 + .../usr/include/linux/netfilter_arp.h | 19 + .../usr/include/linux/netfilter_arp/..install.cmd | 1 + .../usr/include/linux/netfilter_arp/.install | 0 .../usr/include/linux/netfilter_arp/arp_tables.h | 218 + .../usr/include/linux/netfilter_arp/arpt_mangle.h | 26 + .../usr/include/linux/netfilter_bridge.h | 27 + .../include/linux/netfilter_bridge/..install.cmd | 1 + .../usr/include/linux/netfilter_bridge/.install | 0 .../usr/include/linux/netfilter_bridge/ebt_802_3.h | 61 + .../usr/include/linux/netfilter_bridge/ebt_among.h | 65 + .../usr/include/linux/netfilter_bridge/ebt_arp.h | 34 + .../include/linux/netfilter_bridge/ebt_arpreply.h | 11 + .../usr/include/linux/netfilter_bridge/ebt_ip.h | 43 + .../usr/include/linux/netfilter_bridge/ebt_limit.h | 23 + .../usr/include/linux/netfilter_bridge/ebt_log.h | 19 + .../include/linux/netfilter_bridge/ebt_mark_m.h | 15 + .../include/linux/netfilter_bridge/ebt_mark_t.h | 24 + .../usr/include/linux/netfilter_bridge/ebt_nat.h | 14 + .../include/linux/netfilter_bridge/ebt_pkttype.h | 11 + .../include/linux/netfilter_bridge/ebt_redirect.h | 11 + .../usr/include/linux/netfilter_bridge/ebt_stp.h | 46 + .../usr/include/linux/netfilter_bridge/ebt_ulog.h | 36 + .../usr/include/linux/netfilter_bridge/ebt_vlan.h | 20 + .../usr/include/linux/netfilter_bridge/ebtables.h | 275 + .../usr/include/linux/netfilter_decnet.h | 72 + .../usr/include/linux/netfilter_ipv4.h | 75 + .../usr/include/linux/netfilter_ipv4/..install.cmd | 1 + .../usr/include/linux/netfilter_ipv4/.install | 0 .../usr/include/linux/netfilter_ipv4/ip_queue.h | 64 + .../usr/include/linux/netfilter_ipv4/ip_tables.h | 236 + .../include/linux/netfilter_ipv4/ipt_CLASSIFY.h | 7 + .../include/linux/netfilter_ipv4/ipt_CLUSTERIP.h | 34 + .../include/linux/netfilter_ipv4/ipt_CONNMARK.h | 19 + .../usr/include/linux/netfilter_ipv4/ipt_DSCP.h | 18 + .../usr/include/linux/netfilter_ipv4/ipt_ECN.h | 31 + .../usr/include/linux/netfilter_ipv4/ipt_LOG.h | 18 + .../usr/include/linux/netfilter_ipv4/ipt_MARK.h | 18 + .../usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h | 16 + .../usr/include/linux/netfilter_ipv4/ipt_REJECT.h | 20 + .../usr/include/linux/netfilter_ipv4/ipt_SAME.h | 19 + .../usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h | 9 + .../usr/include/linux/netfilter_ipv4/ipt_TOS.h | 12 + .../usr/include/linux/netfilter_ipv4/ipt_TTL.h | 21 + .../usr/include/linux/netfilter_ipv4/ipt_ULOG.h | 49 + .../include/linux/netfilter_ipv4/ipt_addrtype.h | 25 + .../usr/include/linux/netfilter_ipv4/ipt_ah.h | 16 + .../usr/include/linux/netfilter_ipv4/ipt_comment.h | 10 + .../include/linux/netfilter_ipv4/ipt_connbytes.h | 18 + .../include/linux/netfilter_ipv4/ipt_connmark.h | 7 + .../include/linux/netfilter_ipv4/ipt_conntrack.h | 28 + .../usr/include/linux/netfilter_ipv4/ipt_dccp.h | 15 + .../usr/include/linux/netfilter_ipv4/ipt_dscp.h | 21 + .../usr/include/linux/netfilter_ipv4/ipt_ecn.h | 33 + .../usr/include/linux/netfilter_ipv4/ipt_esp.h | 10 + .../include/linux/netfilter_ipv4/ipt_hashlimit.h | 14 + .../usr/include/linux/netfilter_ipv4/ipt_helper.h | 7 + .../usr/include/linux/netfilter_ipv4/ipt_iprange.h | 21 + .../usr/include/linux/netfilter_ipv4/ipt_length.h | 7 + .../usr/include/linux/netfilter_ipv4/ipt_limit.h | 8 + .../usr/include/linux/netfilter_ipv4/ipt_mac.h | 7 + .../usr/include/linux/netfilter_ipv4/ipt_mark.h | 9 + .../include/linux/netfilter_ipv4/ipt_multiport.h | 15 + .../usr/include/linux/netfilter_ipv4/ipt_owner.h | 20 + .../usr/include/linux/netfilter_ipv4/ipt_physdev.h | 17 + .../usr/include/linux/netfilter_ipv4/ipt_pkttype.h | 7 + .../usr/include/linux/netfilter_ipv4/ipt_policy.h | 23 + .../usr/include/linux/netfilter_ipv4/ipt_realm.h | 7 + .../usr/include/linux/netfilter_ipv4/ipt_recent.h | 21 + .../usr/include/linux/netfilter_ipv4/ipt_sctp.h | 105 + .../usr/include/linux/netfilter_ipv4/ipt_state.h | 15 + .../usr/include/linux/netfilter_ipv4/ipt_string.h | 10 + .../usr/include/linux/netfilter_ipv4/ipt_tcpmss.h | 7 + .../usr/include/linux/netfilter_ipv4/ipt_tos.h | 13 + .../usr/include/linux/netfilter_ipv4/ipt_ttl.h | 21 + .../usr/include/linux/netfilter_ipv6.h | 72 + .../usr/include/linux/netfilter_ipv6/..install.cmd | 1 + .../usr/include/linux/netfilter_ipv6/.install | 0 .../usr/include/linux/netfilter_ipv6/ip6_tables.h | 297 + .../usr/include/linux/netfilter_ipv6/ip6t_HL.h | 22 + .../usr/include/linux/netfilter_ipv6/ip6t_LOG.h | 18 + .../usr/include/linux/netfilter_ipv6/ip6t_MARK.h | 9 + .../usr/include/linux/netfilter_ipv6/ip6t_REJECT.h | 18 + .../usr/include/linux/netfilter_ipv6/ip6t_ah.h | 21 + .../usr/include/linux/netfilter_ipv6/ip6t_esp.h | 10 + .../usr/include/linux/netfilter_ipv6/ip6t_frag.h | 24 + .../usr/include/linux/netfilter_ipv6/ip6t_hl.h | 22 + .../include/linux/netfilter_ipv6/ip6t_ipv6header.h | 27 + .../usr/include/linux/netfilter_ipv6/ip6t_length.h | 8 + .../usr/include/linux/netfilter_ipv6/ip6t_limit.h | 8 + .../usr/include/linux/netfilter_ipv6/ip6t_mac.h | 7 + .../usr/include/linux/netfilter_ipv6/ip6t_mark.h | 9 + .../usr/include/linux/netfilter_ipv6/ip6t_mh.h | 15 + .../include/linux/netfilter_ipv6/ip6t_multiport.h | 14 + .../usr/include/linux/netfilter_ipv6/ip6t_opts.h | 23 + .../usr/include/linux/netfilter_ipv6/ip6t_owner.h | 18 + .../include/linux/netfilter_ipv6/ip6t_physdev.h | 17 + .../usr/include/linux/netfilter_ipv6/ip6t_policy.h | 23 + .../usr/include/linux/netfilter_ipv6/ip6t_rt.h | 33 + .../usr/include/linux/netlink.h | 155 + .../usr/include/linux/netrom.h | 34 + .../usr/include/linux/nfs.h | 128 + .../usr/include/linux/nfs2.h | 74 + .../usr/include/linux/nfs3.h | 99 + .../usr/include/linux/nfs4.h | 146 + .../usr/include/linux/nfs4_mount.h | 71 + .../usr/include/linux/nfs_fs.h | 59 + .../usr/include/linux/nfs_idmap.h | 65 + .../usr/include/linux/nfs_mount.h | 73 + .../usr/include/linux/nfsacl.h | 29 + .../usr/include/linux/nfsd/..install.cmd | 1 + .../usr/include/linux/nfsd/.install | 0 .../usr/include/linux/nfsd/const.h | 30 + .../usr/include/linux/nfsd/debug.h | 40 + .../usr/include/linux/nfsd/export.h | 47 + .../usr/include/linux/nfsd/nfsfh.h | 120 + .../usr/include/linux/nfsd/stats.h | 17 + .../usr/include/linux/nfsd/syscall.h | 109 + .../usr/include/linux/nl80211.h | 1065 + .../usr/include/linux/nubus.h | 244 + .../usr/include/linux/nvram.h | 16 + .../usr/include/linux/oom.h | 10 + .../usr/include/linux/param.h | 6 + .../usr/include/linux/parport.h | 95 + .../usr/include/linux/patchkey.h | 33 + .../usr/include/linux/pci.h | 41 + .../usr/include/linux/pci_regs.h | 654 + .../usr/include/linux/personality.h | 65 + .../usr/include/linux/pfkeyv2.h | 369 + .../usr/include/linux/pg.h | 63 + .../usr/include/linux/phantom.h | 49 + .../usr/include/linux/phonet.h | 173 + .../usr/include/linux/pkt_cls.h | 494 + .../usr/include/linux/pkt_sched.h | 521 + .../usr/include/linux/pktcdvd.h | 111 + .../usr/include/linux/pmu.h | 135 + .../usr/include/linux/poll.h | 7 + .../usr/include/linux/posix_types.h | 49 + .../usr/include/linux/ppdev.h | 99 + .../usr/include/linux/ppp-comp.h | 210 + .../usr/include/linux/ppp_defs.h | 180 + .../usr/include/linux/prctl.h | 88 + .../usr/include/linux/ptrace.h | 52 + .../usr/include/linux/qnx4_fs.h | 89 + .../usr/include/linux/qnxtypes.h | 28 + .../usr/include/linux/quota.h | 176 + .../usr/include/linux/radeonfb.h | 15 + .../usr/include/linux/raid/..install.cmd | 1 + .../usr/include/linux/raid/.install | 0 .../usr/include/linux/raid/md_p.h | 277 + .../usr/include/linux/raid/md_u.h | 156 + .../usr/include/linux/random.h | 46 + .../usr/include/linux/raw.h | 18 + .../usr/include/linux/reboot.h | 39 + .../usr/include/linux/reiserfs_fs.h | 35 + .../usr/include/linux/reiserfs_xattr.h | 25 + .../usr/include/linux/resource.h | 75 + .../usr/include/linux/romfs_fs.h | 56 + .../usr/include/linux/rose.h | 87 + .../usr/include/linux/route.h | 68 + .../usr/include/linux/rtc.h | 101 + .../usr/include/linux/rtnetlink.h | 614 + .../usr/include/linux/scc.h | 172 + .../usr/include/linux/sched.h | 43 + .../usr/include/linux/screen_info.h | 69 + .../usr/include/linux/sdla.h | 119 + .../usr/include/linux/selinux_netlink.h | 48 + .../usr/include/linux/sem.h | 80 + .../usr/include/linux/serial.h | 175 + .../usr/include/linux/serial_core.h | 171 + .../usr/include/linux/serial_reg.h | 328 + .../usr/include/linux/serio.h | 76 + .../usr/include/linux/shm.h | 75 + .../usr/include/linux/signal.h | 8 + .../usr/include/linux/signalfd.h | 52 + .../usr/include/linux/smb.h | 64 + .../usr/include/linux/smb_fs.h | 25 + .../usr/include/linux/smb_mount.h | 27 + .../usr/include/linux/smbno.h | 363 + .../usr/include/linux/snmp.h | 257 + .../usr/include/linux/socket.h | 303 + .../usr/include/linux/sockios.h | 146 + .../usr/include/linux/som.h | 154 + .../usr/include/linux/sonet.h | 60 + .../usr/include/linux/sonypi.h | 143 + .../usr/include/linux/sound.h | 27 + .../usr/include/linux/soundcard.h | 1278 + .../usr/include/linux/spi/..install.cmd | 1 + .../usr/include/linux/spi/.install | 0 .../usr/include/linux/spi/spidev.h | 129 + .../usr/include/linux/stat.h | 45 + .../usr/include/linux/stddef.h | 14 + .../usr/include/linux/string.h | 7 + .../usr/include/linux/sunrpc/..install.cmd | 1 + .../usr/include/linux/sunrpc/.install | 0 .../usr/include/linux/sunrpc/debug.h | 48 + .../usr/include/linux/suspend_ioctls.h | 33 + .../usr/include/linux/swab.h | 282 + .../usr/include/linux/synclink.h | 295 + .../usr/include/linux/sysctl.h | 940 + .../usr/include/linux/taskstats.h | 212 + .../usr/include/linux/tc_act/..install.cmd | 1 + .../usr/include/linux/tc_act/.install | 0 .../usr/include/linux/tc_act/tc_gact.h | 35 + .../usr/include/linux/tc_act/tc_ipt.h | 21 + .../usr/include/linux/tc_act/tc_mirred.h | 29 + .../usr/include/linux/tc_act/tc_nat.h | 29 + .../usr/include/linux/tc_act/tc_pedit.h | 37 + .../usr/include/linux/tc_act/tc_skbedit.h | 44 + .../usr/include/linux/tc_ematch/..install.cmd | 1 + .../usr/include/linux/tc_ematch/.install | 0 .../usr/include/linux/tc_ematch/tc_em_cmp.h | 27 + .../usr/include/linux/tc_ematch/tc_em_meta.h | 96 + .../usr/include/linux/tc_ematch/tc_em_nbyte.h | 14 + .../usr/include/linux/tc_ematch/tc_em_text.h | 20 + .../usr/include/linux/tcp.h | 174 + .../usr/include/linux/telephony.h | 262 + .../usr/include/linux/termios.h | 22 + .../usr/include/linux/time.h | 74 + .../usr/include/linux/times.h | 13 + .../usr/include/linux/timex.h | 160 + .../usr/include/linux/tiocl.h | 39 + .../usr/include/linux/tipc.h | 213 + .../usr/include/linux/tipc_config.h | 418 + .../usr/include/linux/toshiba.h | 38 + .../usr/include/linux/tty.h | 8 + .../usr/include/linux/types.h | 38 + .../usr/include/linux/udf_fs_i.h | 21 + .../usr/include/linux/udp.h | 39 + .../usr/include/linux/uinput.h | 136 + .../usr/include/linux/uio.h | 49 + .../usr/include/linux/ultrasound.h | 103 + .../usr/include/linux/un.h | 11 + .../usr/include/linux/unistd.h | 9 + .../usr/include/linux/usb/..install.cmd | 1 + .../usr/include/linux/usb/.install | 0 .../usr/include/linux/usb/audio.h | 53 + .../usr/include/linux/usb/cdc.h | 250 + .../usr/include/linux/usb/ch9.h | 782 + .../usr/include/linux/usb/g_printer.h | 35 + .../usr/include/linux/usb/gadgetfs.h | 88 + .../usr/include/linux/usb/midi.h | 112 + .../usr/include/linux/usb/tmc.h | 43 + .../usr/include/linux/usb/vstusb.h | 71 + .../usr/include/linux/usbdevice_fs.h | 152 + .../usr/include/linux/utime.h | 11 + .../usr/include/linux/utsname.h | 34 + .../usr/include/linux/version.h | 2 + .../usr/include/linux/veth.h | 12 + .../usr/include/linux/videodev.h | 340 + .../usr/include/linux/videodev2.h | 1557 + .../usr/include/linux/videotext.h | 125 + .../usr/include/linux/virtio_9p.h | 12 + .../usr/include/linux/virtio_balloon.h | 23 + .../usr/include/linux/virtio_blk.h | 62 + .../usr/include/linux/virtio_config.h | 31 + .../usr/include/linux/virtio_console.h | 23 + .../usr/include/linux/virtio_net.h | 129 + .../usr/include/linux/virtio_pci.h | 64 + .../usr/include/linux/virtio_ring.h | 112 + .../usr/include/linux/virtio_rng.h | 10 + .../usr/include/linux/vt.h | 66 + .../usr/include/linux/wait.h | 21 + .../usr/include/linux/wanrouter.h | 452 + .../usr/include/linux/watchdog.h | 55 + .../usr/include/linux/wimax.h | 234 + .../usr/include/linux/wimax/..install.cmd | 1 + .../usr/include/linux/wimax/.install | 0 .../usr/include/linux/wimax/i2400m.h | 581 + .../usr/include/linux/wireless.h | 1126 + .../usr/include/linux/x25.h | 150 + .../usr/include/linux/xattr.h | 17 + .../usr/include/linux/xfrm.h | 483 + uclibc-crosstools-gcc-4.4.2-1/usr/include/locale.h | 225 + uclibc-crosstools-gcc-4.4.2-1/usr/include/malloc.h | 191 + uclibc-crosstools-gcc-4.4.2-1/usr/include/math.h | 468 + uclibc-crosstools-gcc-4.4.2-1/usr/include/memory.h | 34 + uclibc-crosstools-gcc-4.4.2-1/usr/include/mntent.h | 98 + uclibc-crosstools-gcc-4.4.2-1/usr/include/mqueue.h | 90 + .../usr/include/mtd/..install.cmd | 1 + .../usr/include/mtd/.install | 0 .../usr/include/mtd/inftl-user.h | 91 + .../usr/include/mtd/jffs2-user.h | 34 + .../usr/include/mtd/mtd-abi.h | 152 + .../usr/include/mtd/mtd-user.h | 19 + .../usr/include/mtd/nftl-user.h | 76 + .../usr/include/mtd/ubi-user.h | 412 + .../usr/include/net/ethernet.h | 76 + uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if.h | 205 + .../usr/include/net/if_arp.h | 176 + .../usr/include/net/if_packet.h | 37 + .../usr/include/net/if_ppp.h | 169 + .../usr/include/net/if_shaper.h | 59 + .../usr/include/net/if_slip.h | 25 + .../usr/include/net/ppp-comp.h | 1 + .../usr/include/net/ppp_defs.h | 10 + .../usr/include/net/route.h | 145 + .../usr/include/netax25/ax25.h | 171 + uclibc-crosstools-gcc-4.4.2-1/usr/include/netdb.h | 658 + .../usr/include/neteconet/ec.h | 52 + .../usr/include/netinet/ether.h | 54 + .../usr/include/netinet/icmp6.h | 346 + .../usr/include/netinet/if_ether.h | 105 + .../usr/include/netinet/if_fddi.h | 37 + .../usr/include/netinet/if_tr.h | 41 + .../usr/include/netinet/igmp.h | 126 + .../usr/include/netinet/in.h | 512 + .../usr/include/netinet/in_systm.h | 41 + .../usr/include/netinet/ip.h | 249 + .../usr/include/netinet/ip6.h | 188 + .../usr/include/netinet/ip_fw.h | 1 + .../usr/include/netinet/ip_icmp.h | 283 + .../usr/include/netinet/ip_tcp.h | 72 + .../usr/include/netinet/ip_udp.h | 1 + .../usr/include/netinet/protocols.h | 62 + .../usr/include/netinet/tcp.h | 225 + .../usr/include/netinet/udp.h | 55 + .../usr/include/netipx/ipx.h | 113 + .../usr/include/netpacket/packet.h | 64 + .../usr/include/nl_types.h | 59 + .../usr/include/obstack.h | 605 + uclibc-crosstools-gcc-4.4.2-1/usr/include/paths.h | 80 + uclibc-crosstools-gcc-4.4.2-1/usr/include/poll.h | 1 + .../usr/include/protocols/routed.h | 101 + .../usr/include/protocols/rwhod.h | 67 + .../usr/include/protocols/talkd.h | 113 + .../usr/include/protocols/timed.h | 97 + .../usr/include/pthread.h | 691 + uclibc-crosstools-gcc-4.4.2-1/usr/include/pty.h | 44 + uclibc-crosstools-gcc-4.4.2-1/usr/include/pwd.h | 186 + .../usr/include/rdma/..install.cmd | 1 + .../usr/include/rdma/.install | 0 .../usr/include/rdma/ib_user_mad.h | 203 + uclibc-crosstools-gcc-4.4.2-1/usr/include/regex.h | 580 + uclibc-crosstools-gcc-4.4.2-1/usr/include/regexp.h | 222 + uclibc-crosstools-gcc-4.4.2-1/usr/include/resolv.h | 395 + .../usr/include/rpc/auth.h | 224 + .../usr/include/rpc/auth_des.h | 112 + .../usr/include/rpc/auth_unix.h | 90 + .../usr/include/rpc/clnt.h | 421 + .../usr/include/rpc/des_crypt.h | 97 + .../usr/include/rpc/key_prot.h | 346 + .../usr/include/rpc/netdb.h | 74 + .../usr/include/rpc/pmap_clnt.h | 98 + .../usr/include/rpc/pmap_prot.h | 108 + .../usr/include/rpc/pmap_rmt.h | 68 + .../usr/include/rpc/rpc.h | 110 + .../usr/include/rpc/rpc_des.h | 72 + .../usr/include/rpc/rpc_msg.h | 202 + .../usr/include/rpc/svc.h | 316 + .../usr/include/rpc/svc_auth.h | 54 + .../usr/include/rpc/types.h | 108 + .../usr/include/rpc/xdr.h | 385 + uclibc-crosstools-gcc-4.4.2-1/usr/include/sched.h | 86 + .../usr/include/scsi/scsi.h | 226 + .../usr/include/scsi/scsi_ioctl.h | 34 + .../usr/include/scsi/sg.h | 275 + uclibc-crosstools-gcc-4.4.2-1/usr/include/search.h | 175 + .../usr/include/semaphore.h | 87 + uclibc-crosstools-gcc-4.4.2-1/usr/include/setjmp.h | 104 + .../usr/include/sgidefs.h | 73 + uclibc-crosstools-gcc-4.4.2-1/usr/include/sgtty.h | 41 + uclibc-crosstools-gcc-4.4.2-1/usr/include/shadow.h | 149 + uclibc-crosstools-gcc-4.4.2-1/usr/include/signal.h | 401 + .../usr/include/sound/..install.cmd | 1 + .../usr/include/sound/.install | 0 .../usr/include/sound/asequencer.h | 614 + .../usr/include/sound/asound.h | 894 + .../usr/include/sound/asound_fm.h | 134 + .../usr/include/sound/emu10k1.h | 371 + .../usr/include/sound/hdsp.h | 109 + .../usr/include/sound/hdspm.h | 134 + .../usr/include/sound/sb16_csp.h | 115 + .../usr/include/sound/sfnt_info.h | 212 + .../usr/include/sound/sscape_ioctl.h | 21 + uclibc-crosstools-gcc-4.4.2-1/usr/include/stdint.h | 332 + uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio.h | 873 + .../usr/include/stdio_ext.h | 87 + uclibc-crosstools-gcc-4.4.2-1/usr/include/stdlib.h | 865 + uclibc-crosstools-gcc-4.4.2-1/usr/include/string.h | 437 + .../usr/include/strings.h | 95 + .../usr/include/sys/acct.h | 77 + .../usr/include/sys/asm.h | 473 + .../usr/include/sys/bitypes.h | 3 + .../usr/include/sys/cachectl.h | 42 + .../usr/include/sys/cdefs.h | 320 + .../usr/include/sys/dir.h | 28 + .../usr/include/sys/epoll.h | 110 + .../usr/include/sys/errno.h | 1 + .../usr/include/sys/fcntl.h | 1 + .../usr/include/sys/file.h | 56 + .../usr/include/sys/fpregdef.h | 61 + .../usr/include/sys/fsuid.h | 36 + .../usr/include/sys/inotify.h | 92 + .../usr/include/sys/ioctl.h | 46 + .../usr/include/sys/ipc.h | 58 + uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kd.h | 35 + .../usr/include/sys/kdaemon.h | 33 + .../usr/include/sys/klog.h | 34 + .../usr/include/sys/mman.h | 174 + .../usr/include/sys/mount.h | 119 + .../usr/include/sys/msg.h | 81 + .../usr/include/sys/mtio.h | 277 + .../usr/include/sys/param.h | 72 + .../usr/include/sys/personality.h | 73 + .../usr/include/sys/poll.h | 76 + .../usr/include/sys/prctl.h | 32 + .../usr/include/sys/procfs.h | 112 + .../usr/include/sys/ptrace.h | 129 + .../usr/include/sys/queue.h | 557 + .../usr/include/sys/quota.h | 158 + .../usr/include/sys/reboot.h | 49 + .../usr/include/sys/regdef.h | 80 + .../usr/include/sys/resource.h | 103 + .../usr/include/sys/select.h | 130 + .../usr/include/sys/sem.h | 58 + .../usr/include/sys/sendfile.h | 52 + .../usr/include/sys/shm.h | 64 + .../usr/include/sys/signal.h | 1 + .../usr/include/sys/socket.h | 236 + .../usr/include/sys/socketvar.h | 3 + .../usr/include/sys/soundcard.h | 1 + .../usr/include/sys/stat.h | 366 + .../usr/include/sys/statfs.h | 68 + .../usr/include/sys/statvfs.h | 91 + .../usr/include/sys/swap.h | 43 + .../usr/include/sys/syscall.h | 37 + .../usr/include/sys/sysctl.h | 72 + .../usr/include/sys/sysinfo.h | 67 + .../usr/include/sys/syslog.h | 206 + .../usr/include/sys/sysmacros.h | 69 + .../usr/include/sys/sysmips.h | 44 + .../usr/include/sys/tas.h | 67 + .../usr/include/sys/termios.h | 4 + .../usr/include/sys/time.h | 192 + .../usr/include/sys/timeb.h | 46 + .../usr/include/sys/times.h | 53 + .../usr/include/sys/timex.h | 127 + .../usr/include/sys/ttydefaults.h | 100 + .../usr/include/sys/types.h | 275 + .../usr/include/sys/ucontext.h | 117 + .../usr/include/sys/uio.h | 54 + uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/un.h | 47 + .../usr/include/sys/unistd.h | 1 + .../usr/include/sys/user.h | 217 + .../usr/include/sys/ustat.h | 38 + .../usr/include/sys/utsname.h | 74 + .../usr/include/sys/vfs.h | 4 + uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vt.h | 1 + .../usr/include/sys/wait.h | 186 + .../usr/include/sys/xattr.h | 104 + .../usr/include/syscall.h | 1 + .../usr/include/sysexits.h | 114 + uclibc-crosstools-gcc-4.4.2-1/usr/include/syslog.h | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/include/tar.h | 108 + uclibc-crosstools-gcc-4.4.2-1/usr/include/termio.h | 6 + .../usr/include/termios.h | 110 + uclibc-crosstools-gcc-4.4.2-1/usr/include/tgmath.h | 430 + .../usr/include/thread_db.h | 459 + uclibc-crosstools-gcc-4.4.2-1/usr/include/time.h | 435 + uclibc-crosstools-gcc-4.4.2-1/usr/include/ttyent.h | 65 + .../usr/include/ucontext.h | 32 + uclibc-crosstools-gcc-4.4.2-1/usr/include/ulimit.h | 48 + uclibc-crosstools-gcc-4.4.2-1/usr/include/unistd.h | 1110 + uclibc-crosstools-gcc-4.4.2-1/usr/include/ustat.h | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/include/utime.h | 52 + uclibc-crosstools-gcc-4.4.2-1/usr/include/utmp.h | 97 + uclibc-crosstools-gcc-4.4.2-1/usr/include/values.h | 71 + .../usr/include/video/..install.cmd | 1 + .../usr/include/video/.install | 0 .../usr/include/video/edid.h | 13 + .../usr/include/video/sisfb.h | 209 + .../usr/include/video/uvesafb.h | 60 + uclibc-crosstools-gcc-4.4.2-1/usr/include/wait.h | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/include/wchar.h | 752 + uclibc-crosstools-gcc-4.4.2-1/usr/include/wctype.h | 330 + uclibc-crosstools-gcc-4.4.2-1/usr/info/cpp.info | 5351 +++ .../usr/info/cppinternals.info | 1036 + uclibc-crosstools-gcc-4.4.2-1/usr/info/dir | 26 + uclibc-crosstools-gcc-4.4.2-1/usr/info/gcc.info | 44027 +++++++++++++++++++ .../usr/info/gccinstall.info | 4234 ++ uclibc-crosstools-gcc-4.4.2-1/usr/info/gccint.info | 43962 ++++++++++++++++++ .../usr/info/libgomp.info | 2455 ++ uclibc-crosstools-gcc-4.4.2-1/usr/lib/Scrt1.o | Bin 0 -> 1024 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/crt1.o | Bin 0 -> 1024 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/crti.o | Bin 0 -> 1280 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/crtn.o | Bin 0 -> 1100 bytes .../usr/lib/gcc/mips-linux-uclibc/4.4.2/crtbegin.o | Bin 0 -> 2632 bytes .../lib/gcc/mips-linux-uclibc/4.4.2/crtbeginS.o | Bin 0 -> 2764 bytes .../lib/gcc/mips-linux-uclibc/4.4.2/crtbeginT.o | Bin 0 -> 2632 bytes .../usr/lib/gcc/mips-linux-uclibc/4.4.2/crtend.o | Bin 0 -> 1664 bytes .../usr/lib/gcc/mips-linux-uclibc/4.4.2/crtendS.o | Bin 0 -> 1696 bytes .../mips-linux-uclibc/4.4.2/include-fixed/README | 14 + .../4.4.2/include-fixed/features.h | 433 + .../mips-linux-uclibc/4.4.2/include-fixed/limits.h | 125 + .../4.4.2/include-fixed/obstack.h | 614 + .../4.4.2/include-fixed/syslimits.h | 8 + .../gcc/mips-linux-uclibc/4.4.2/include/float.h | 238 + .../gcc/mips-linux-uclibc/4.4.2/include/iso646.h | 45 + .../gcc/mips-linux-uclibc/4.4.2/include/loongson.h | 690 + .../mips-linux-uclibc/4.4.2/include/mf-runtime.h | 244 + .../lib/gcc/mips-linux-uclibc/4.4.2/include/omp.h | 105 + .../gcc/mips-linux-uclibc/4.4.2/include/stdarg.h | 130 + .../gcc/mips-linux-uclibc/4.4.2/include/stdbool.h | 50 + .../gcc/mips-linux-uclibc/4.4.2/include/stddef.h | 416 + .../gcc/mips-linux-uclibc/4.4.2/include/stdfix.h | 204 + .../gcc/mips-linux-uclibc/4.4.2/include/unwind.h | 276 + .../gcc/mips-linux-uclibc/4.4.2/include/varargs.h | 7 + .../4.4.2/install-tools/fixinc_list | 1 + .../4.4.2/install-tools/gsyslimits.h | 8 + .../4.4.2/install-tools/include/README | 14 + .../4.4.2/install-tools/include/limits.h | 125 + .../4.4.2/install-tools/macro_list | 7 + .../4.4.2/install-tools/mkheaders.conf | 5 + .../usr/lib/gcc/mips-linux-uclibc/4.4.2/libgcc.a | Bin 0 -> 6214602 bytes .../lib/gcc/mips-linux-uclibc/4.4.2/libgcc_eh.a | Bin 0 -> 142504 bytes .../usr/lib/gcc/mips-linux-uclibc/4.4.2/libgcov.a | Bin 0 -> 135484 bytes .../usr/lib/ldscripts/elf32btsmip.x | 261 + .../usr/lib/ldscripts/elf32btsmip.xbn | 259 + .../usr/lib/ldscripts/elf32btsmip.xc | 264 + .../usr/lib/ldscripts/elf32btsmip.xd | 261 + .../usr/lib/ldscripts/elf32btsmip.xdc | 264 + .../usr/lib/ldscripts/elf32btsmip.xdw | 264 + .../usr/lib/ldscripts/elf32btsmip.xn | 261 + .../usr/lib/ldscripts/elf32btsmip.xr | 201 + .../usr/lib/ldscripts/elf32btsmip.xs | 247 + .../usr/lib/ldscripts/elf32btsmip.xsc | 246 + .../usr/lib/ldscripts/elf32btsmip.xsw | 246 + .../usr/lib/ldscripts/elf32btsmip.xu | 202 + .../usr/lib/ldscripts/elf32btsmip.xw | 264 + .../usr/lib/ldscripts/elf32btsmipn32.x | 254 + .../usr/lib/ldscripts/elf32btsmipn32.xbn | 252 + .../usr/lib/ldscripts/elf32btsmipn32.xc | 257 + .../usr/lib/ldscripts/elf32btsmipn32.xd | 254 + .../usr/lib/ldscripts/elf32btsmipn32.xdc | 257 + .../usr/lib/ldscripts/elf32btsmipn32.xdw | 257 + .../usr/lib/ldscripts/elf32btsmipn32.xn | 254 + .../usr/lib/ldscripts/elf32btsmipn32.xr | 194 + .../usr/lib/ldscripts/elf32btsmipn32.xs | 240 + .../usr/lib/ldscripts/elf32btsmipn32.xsc | 239 + .../usr/lib/ldscripts/elf32btsmipn32.xsw | 239 + .../usr/lib/ldscripts/elf32btsmipn32.xu | 195 + .../usr/lib/ldscripts/elf32btsmipn32.xw | 257 + .../usr/lib/ldscripts/elf32ltsmip.x | 261 + .../usr/lib/ldscripts/elf32ltsmip.xbn | 259 + .../usr/lib/ldscripts/elf32ltsmip.xc | 264 + .../usr/lib/ldscripts/elf32ltsmip.xd | 261 + .../usr/lib/ldscripts/elf32ltsmip.xdc | 264 + .../usr/lib/ldscripts/elf32ltsmip.xdw | 264 + .../usr/lib/ldscripts/elf32ltsmip.xn | 261 + .../usr/lib/ldscripts/elf32ltsmip.xr | 201 + .../usr/lib/ldscripts/elf32ltsmip.xs | 247 + .../usr/lib/ldscripts/elf32ltsmip.xsc | 246 + .../usr/lib/ldscripts/elf32ltsmip.xsw | 246 + .../usr/lib/ldscripts/elf32ltsmip.xu | 202 + .../usr/lib/ldscripts/elf32ltsmip.xw | 264 + .../usr/lib/ldscripts/elf32ltsmipn32.x | 254 + .../usr/lib/ldscripts/elf32ltsmipn32.xbn | 252 + .../usr/lib/ldscripts/elf32ltsmipn32.xc | 257 + .../usr/lib/ldscripts/elf32ltsmipn32.xd | 254 + .../usr/lib/ldscripts/elf32ltsmipn32.xdc | 257 + .../usr/lib/ldscripts/elf32ltsmipn32.xdw | 257 + .../usr/lib/ldscripts/elf32ltsmipn32.xn | 254 + .../usr/lib/ldscripts/elf32ltsmipn32.xr | 194 + .../usr/lib/ldscripts/elf32ltsmipn32.xs | 240 + .../usr/lib/ldscripts/elf32ltsmipn32.xsc | 239 + .../usr/lib/ldscripts/elf32ltsmipn32.xsw | 239 + .../usr/lib/ldscripts/elf32ltsmipn32.xu | 195 + .../usr/lib/ldscripts/elf32ltsmipn32.xw | 257 + .../usr/lib/ldscripts/elf64btsmip.x | 253 + .../usr/lib/ldscripts/elf64btsmip.xbn | 251 + .../usr/lib/ldscripts/elf64btsmip.xc | 256 + .../usr/lib/ldscripts/elf64btsmip.xd | 253 + .../usr/lib/ldscripts/elf64btsmip.xdc | 256 + .../usr/lib/ldscripts/elf64btsmip.xdw | 256 + .../usr/lib/ldscripts/elf64btsmip.xn | 253 + .../usr/lib/ldscripts/elf64btsmip.xr | 193 + .../usr/lib/ldscripts/elf64btsmip.xs | 240 + .../usr/lib/ldscripts/elf64btsmip.xsc | 239 + .../usr/lib/ldscripts/elf64btsmip.xsw | 239 + .../usr/lib/ldscripts/elf64btsmip.xu | 194 + .../usr/lib/ldscripts/elf64btsmip.xw | 256 + .../usr/lib/ldscripts/elf64ltsmip.x | 253 + .../usr/lib/ldscripts/elf64ltsmip.xbn | 251 + .../usr/lib/ldscripts/elf64ltsmip.xc | 256 + .../usr/lib/ldscripts/elf64ltsmip.xd | 253 + .../usr/lib/ldscripts/elf64ltsmip.xdc | 256 + .../usr/lib/ldscripts/elf64ltsmip.xdw | 256 + .../usr/lib/ldscripts/elf64ltsmip.xn | 253 + .../usr/lib/ldscripts/elf64ltsmip.xr | 193 + .../usr/lib/ldscripts/elf64ltsmip.xs | 240 + .../usr/lib/ldscripts/elf64ltsmip.xsc | 239 + .../usr/lib/ldscripts/elf64ltsmip.xsw | 239 + .../usr/lib/ldscripts/elf64ltsmip.xu | 194 + .../usr/lib/ldscripts/elf64ltsmip.xw | 256 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libc.a | Bin 0 -> 1478600 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/libc.so | 4 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libc_pic.a | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libcrypt.a | Bin 0 -> 15398 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/libcrypt.so | 1 + .../usr/lib/libcrypt_pic.a | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libdl.a | Bin 0 -> 23158 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/libdl.so | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libdl_pic.a | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libiberty.a | Bin 0 -> 669282 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/libm.a | Bin 0 -> 306818 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/libm.so | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libm_pic.a | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libnsl.a | Bin 0 -> 1188 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/libnsl.so | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libnsl_pic.a | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libpthread.a | Bin 0 -> 120840 bytes .../usr/lib/libpthread.so | 1 + .../usr/lib/libpthread_pic.a | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libresolv.a | Bin 0 -> 1196 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/libresolv.so | 1 + .../usr/lib/libresolv_pic.a | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/librt.a | Bin 0 -> 15940 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/librt.so | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/librt_pic.a | 1 + .../usr/lib/libthread_db.a | Bin 0 -> 53244 bytes .../usr/lib/libthread_db.so | 1 + .../usr/lib/libthread_db_pic.a | 1 + uclibc-crosstools-gcc-4.4.2-1/usr/lib/libutil.a | Bin 0 -> 9644 bytes uclibc-crosstools-gcc-4.4.2-1/usr/lib/libutil.so | 1 + .../usr/lib/libutil_pic.a | 1 + .../usr/lib/uclibc_nonshared.a | Bin 0 -> 1244 bytes .../usr/libexec/gcc/mips-linux-uclibc/4.4.2/cc1 | Bin 0 -> 27871003 bytes .../libexec/gcc/mips-linux-uclibc/4.4.2/cc1plus | Bin 0 -> 30396241 bytes .../libexec/gcc/mips-linux-uclibc/4.4.2/collect2 | Bin 0 -> 312327 bytes .../4.4.2/install-tools/fixinc.sh | 498 + .../mips-linux-uclibc/4.4.2/install-tools/fixincl | Bin 0 -> 298351 bytes .../4.4.2/install-tools/mkheaders | 109 + .../4.4.2/install-tools/mkinstalldirs | 158 + .../usr/man/man1/mips-linux-uclibc-cpp.1 | 979 + .../usr/man/man1/mips-linux-uclibc-g++.1 | 15367 +++++++ .../usr/man/man1/mips-linux-uclibc-gcc.1 | 15367 +++++++ .../usr/man/man1/mips-linux-uclibc-gcov.1 | 635 + .../usr/man/man7/fsf-funding.7 | 192 + uclibc-crosstools-gcc-4.4.2-1/usr/man/man7/gfdl.7 | 591 + uclibc-crosstools-gcc-4.4.2-1/usr/man/man7/gpl.7 | 849 + uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux | 1 + .../usr/mips-linux-uclibc/bin/ar | Bin 0 -> 3303875 bytes .../usr/mips-linux-uclibc/bin/as | Bin 0 -> 4688774 bytes .../usr/mips-linux-uclibc/bin/c++ | Bin 0 -> 461847 bytes .../usr/mips-linux-uclibc/bin/cc | 1 + .../usr/mips-linux-uclibc/bin/g++ | Bin 0 -> 461847 bytes .../usr/mips-linux-uclibc/bin/gcc | Bin 0 -> 460197 bytes .../usr/mips-linux-uclibc/bin/gdb | 1 + .../usr/mips-linux-uclibc/bin/ld | Bin 0 -> 5051954 bytes .../usr/mips-linux-uclibc/bin/nm | Bin 0 -> 3204106 bytes .../usr/mips-linux-uclibc/bin/objcopy | Bin 0 -> 3749936 bytes .../usr/mips-linux-uclibc/bin/objdump | Bin 0 -> 4047818 bytes .../usr/mips-linux-uclibc/bin/ranlib | Bin 0 -> 3303906 bytes .../usr/mips-linux-uclibc/bin/sstrip | 1 + .../usr/mips-linux-uclibc/bin/strip | Bin 0 -> 3749927 bytes .../mips-linux-uclibc/include/c++/4.4.2/algorithm | 68 + .../usr/mips-linux-uclibc/include/c++/4.4.2/array | 60 + .../include/c++/4.4.2/backward/auto_ptr.h | 292 + .../include/c++/4.4.2/backward/backward_warning.h | 56 + .../include/c++/4.4.2/backward/binders.h | 168 + .../include/c++/4.4.2/backward/hash_fun.h | 167 + .../include/c++/4.4.2/backward/hash_map | 590 + .../include/c++/4.4.2/backward/hash_set | 558 + .../include/c++/4.4.2/backward/hashtable.h | 1125 + .../include/c++/4.4.2/backward/strstream | 176 + .../include/c++/4.4.2/bits/algorithmfwd.h | 805 + .../include/c++/4.4.2/bits/allocator.h | 181 + .../include/c++/4.4.2/bits/atomic_0.h | 463 + .../include/c++/4.4.2/bits/atomic_2.h | 453 + .../include/c++/4.4.2/bits/atomicfwd_c.h | 174 + .../include/c++/4.4.2/bits/atomicfwd_cxx.h | 109 + .../include/c++/4.4.2/bits/basic_ios.h | 474 + .../include/c++/4.4.2/bits/basic_ios.tcc | 187 + .../include/c++/4.4.2/bits/basic_string.h | 2692 ++ .../include/c++/4.4.2/bits/basic_string.tcc | 1144 + .../include/c++/4.4.2/bits/boost_concept_check.h | 787 + .../include/c++/4.4.2/bits/char_traits.h | 575 + .../include/c++/4.4.2/bits/cmath.tcc | 55 + .../include/c++/4.4.2/bits/codecvt.h | 497 + .../include/c++/4.4.2/bits/concept_check.h | 80 + .../include/c++/4.4.2/bits/cpp_type_traits.h | 419 + .../include/c++/4.4.2/bits/deque.tcc | 863 + .../include/c++/4.4.2/bits/forward_list.h | 1306 + .../include/c++/4.4.2/bits/forward_list.tcc | 478 + .../include/c++/4.4.2/bits/fstream.tcc | 926 + .../include/c++/4.4.2/bits/functexcept.h | 93 + .../include/c++/4.4.2/bits/functional_hash.h | 68 + .../include/c++/4.4.2/bits/gslice.h | 182 + .../include/c++/4.4.2/bits/gslice_array.h | 216 + .../include/c++/4.4.2/bits/hashtable.h | 58 + .../include/c++/4.4.2/bits/indirect_array.h | 210 + .../include/c++/4.4.2/bits/ios_base.h | 982 + .../include/c++/4.4.2/bits/istream.tcc | 1022 + .../include/c++/4.4.2/bits/list.tcc | 416 + .../include/c++/4.4.2/bits/locale_classes.h | 812 + .../include/c++/4.4.2/bits/locale_classes.tcc | 271 + .../include/c++/4.4.2/bits/locale_facets.h | 2602 ++ .../include/c++/4.4.2/bits/locale_facets.tcc | 1345 + .../include/c++/4.4.2/bits/locale_facets_nonio.h | 1914 + .../include/c++/4.4.2/bits/locale_facets_nonio.tcc | 1330 + .../include/c++/4.4.2/bits/localefwd.h | 183 + .../include/c++/4.4.2/bits/mask_array.h | 206 + .../include/c++/4.4.2/bits/move.h | 98 + .../include/c++/4.4.2/bits/ostream.tcc | 407 + .../include/c++/4.4.2/bits/ostream_insert.h | 127 + .../include/c++/4.4.2/bits/postypes.h | 241 + .../include/c++/4.4.2/bits/shared_ptr.h | 1591 + .../include/c++/4.4.2/bits/slice_array.h | 272 + .../include/c++/4.4.2/bits/sstream.tcc | 273 + .../include/c++/4.4.2/bits/stl_algo.h | 6090 +++ .../include/c++/4.4.2/bits/stl_algobase.h | 1153 + .../include/c++/4.4.2/bits/stl_bvector.h | 1024 + .../include/c++/4.4.2/bits/stl_construct.h | 148 + .../include/c++/4.4.2/bits/stl_deque.h | 1819 + .../include/c++/4.4.2/bits/stl_function.h | 715 + .../include/c++/4.4.2/bits/stl_heap.h | 578 + .../include/c++/4.4.2/bits/stl_iterator.h | 1041 + .../c++/4.4.2/bits/stl_iterator_base_funcs.h | 197 + .../c++/4.4.2/bits/stl_iterator_base_types.h | 168 + .../include/c++/4.4.2/bits/stl_list.h | 1533 + .../include/c++/4.4.2/bits/stl_map.h | 871 + .../include/c++/4.4.2/bits/stl_multimap.h | 800 + .../include/c++/4.4.2/bits/stl_multiset.h | 697 + .../include/c++/4.4.2/bits/stl_numeric.h | 373 + .../include/c++/4.4.2/bits/stl_pair.h | 261 + .../include/c++/4.4.2/bits/stl_queue.h | 586 + .../include/c++/4.4.2/bits/stl_raw_storage_iter.h | 106 + .../include/c++/4.4.2/bits/stl_relops.h | 131 + .../include/c++/4.4.2/bits/stl_set.h | 708 + .../include/c++/4.4.2/bits/stl_stack.h | 299 + .../include/c++/4.4.2/bits/stl_tempbuf.h | 206 + .../include/c++/4.4.2/bits/stl_tree.h | 1495 + .../include/c++/4.4.2/bits/stl_uninitialized.h | 478 + .../include/c++/4.4.2/bits/stl_vector.h | 1233 + .../include/c++/4.4.2/bits/stream_iterator.h | 211 + .../include/c++/4.4.2/bits/streambuf.tcc | 174 + .../include/c++/4.4.2/bits/streambuf_iterator.h | 392 + .../include/c++/4.4.2/bits/stringfwd.h | 77 + .../include/c++/4.4.2/bits/unique_ptr.h | 450 + .../include/c++/4.4.2/bits/valarray_after.h | 549 + .../include/c++/4.4.2/bits/valarray_array.h | 699 + .../include/c++/4.4.2/bits/valarray_array.tcc | 241 + .../include/c++/4.4.2/bits/valarray_before.h | 730 + .../include/c++/4.4.2/bits/vector.tcc | 681 + .../usr/mips-linux-uclibc/include/c++/4.4.2/bitset | 1396 + .../include/c++/4.4.2/c++0x_warning.h | 36 + .../mips-linux-uclibc/include/c++/4.4.2/cassert | 45 + .../mips-linux-uclibc/include/c++/4.4.2/ccomplex | 44 + .../usr/mips-linux-uclibc/include/c++/4.4.2/cctype | 101 + .../usr/mips-linux-uclibc/include/c++/4.4.2/cerrno | 53 + .../usr/mips-linux-uclibc/include/c++/4.4.2/cfenv | 61 + .../usr/mips-linux-uclibc/include/c++/4.4.2/cfloat | 60 + .../usr/mips-linux-uclibc/include/c++/4.4.2/chrono | 672 + .../mips-linux-uclibc/include/c++/4.4.2/cinttypes | 71 + .../mips-linux-uclibc/include/c++/4.4.2/ciso646 | 33 + .../mips-linux-uclibc/include/c++/4.4.2/climits | 60 + .../mips-linux-uclibc/include/c++/4.4.2/clocale | 61 + .../usr/mips-linux-uclibc/include/c++/4.4.2/cmath | 631 + .../mips-linux-uclibc/include/c++/4.4.2/complex | 1587 + .../mips-linux-uclibc/include/c++/4.4.2/complex.h | 42 + .../include/c++/4.4.2/condition_variable | 225 + .../mips-linux-uclibc/include/c++/4.4.2/csetjmp | 64 + .../mips-linux-uclibc/include/c++/4.4.2/csignal | 60 + .../mips-linux-uclibc/include/c++/4.4.2/cstdarg | 60 + .../mips-linux-uclibc/include/c++/4.4.2/cstdatomic | 848 + .../mips-linux-uclibc/include/c++/4.4.2/cstdbool | 44 + .../mips-linux-uclibc/include/c++/4.4.2/cstddef | 56 + .../mips-linux-uclibc/include/c++/4.4.2/cstdint | 79 + .../usr/mips-linux-uclibc/include/c++/4.4.2/cstdio | 205 + .../mips-linux-uclibc/include/c++/4.4.2/cstdlib | 242 + .../mips-linux-uclibc/include/c++/4.4.2/cstring | 123 + .../mips-linux-uclibc/include/c++/4.4.2/ctgmath | 41 + .../usr/mips-linux-uclibc/include/c++/4.4.2/ctime | 78 + .../usr/mips-linux-uclibc/include/c++/4.4.2/cwchar | 291 + .../mips-linux-uclibc/include/c++/4.4.2/cwctype | 126 + .../include/c++/4.4.2/cxxabi-forced.h | 51 + .../mips-linux-uclibc/include/c++/4.4.2/cxxabi.h | 608 + .../include/c++/4.4.2/debug/bitset | 369 + .../include/c++/4.4.2/debug/debug.h | 130 + .../include/c++/4.4.2/debug/deque | 515 + .../include/c++/4.4.2/debug/formatter.h | 392 + .../include/c++/4.4.2/debug/functions.h | 383 + .../mips-linux-uclibc/include/c++/4.4.2/debug/list | 653 + .../include/c++/4.4.2/debug/macros.h | 246 + .../mips-linux-uclibc/include/c++/4.4.2/debug/map | 37 + .../include/c++/4.4.2/debug/map.h | 412 + .../include/c++/4.4.2/debug/multimap.h | 400 + .../include/c++/4.4.2/debug/multiset.h | 396 + .../include/c++/4.4.2/debug/safe_base.h | 220 + .../include/c++/4.4.2/debug/safe_iterator.h | 643 + .../include/c++/4.4.2/debug/safe_iterator.tcc | 143 + .../include/c++/4.4.2/debug/safe_sequence.h | 183 + .../mips-linux-uclibc/include/c++/4.4.2/debug/set | 37 + .../include/c++/4.4.2/debug/set.h | 401 + .../include/c++/4.4.2/debug/string | 1074 + .../include/c++/4.4.2/debug/unordered_map | 608 + .../include/c++/4.4.2/debug/unordered_set | 601 + .../include/c++/4.4.2/debug/vector | 551 + .../usr/mips-linux-uclibc/include/c++/4.4.2/deque | 75 + .../mips-linux-uclibc/include/c++/4.4.2/exception | 151 + .../include/c++/4.4.2/exception_defines.h | 49 + .../include/c++/4.4.2/exception_ptr.h | 171 + .../include/c++/4.4.2/ext/algorithm | 524 + .../include/c++/4.4.2/ext/array_allocator.h | 154 + .../include/c++/4.4.2/ext/atomicity.h | 113 + .../include/c++/4.4.2/ext/bitmap_allocator.h | 1145 + .../mips-linux-uclibc/include/c++/4.4.2/ext/cast.h | 113 + .../c++/4.4.2/ext/codecvt_specializations.h | 507 + .../include/c++/4.4.2/ext/concurrence.h | 322 + .../include/c++/4.4.2/ext/debug_allocator.h | 124 + .../include/c++/4.4.2/ext/enc_filebuf.h | 62 + .../include/c++/4.4.2/ext/extptr_allocator.h | 176 + .../include/c++/4.4.2/ext/functional | 425 + .../include/c++/4.4.2/ext/hash_map | 590 + .../include/c++/4.4.2/ext/hash_set | 558 + .../include/c++/4.4.2/ext/iterator | 113 + .../include/c++/4.4.2/ext/malloc_allocator.h | 134 + .../mips-linux-uclibc/include/c++/4.4.2/ext/memory | 195 + .../include/c++/4.4.2/ext/mt_allocator.h | 751 + .../include/c++/4.4.2/ext/new_allocator.h | 130 + .../include/c++/4.4.2/ext/numeric | 146 + .../include/c++/4.4.2/ext/numeric_traits.h | 135 + .../c++/4.4.2/ext/pb_ds/assoc_container.hpp | 683 + .../basic_tree_policy/basic_tree_policy_base.hpp | 173 + .../basic_tree_policy/null_node_metadata.hpp | 67 + .../ext/pb_ds/detail/basic_tree_policy/traits.hpp | 85 + .../c++/4.4.2/ext/pb_ds/detail/basic_types.hpp | 211 + .../detail/bin_search_tree_/bin_search_tree_.hpp | 497 + .../bin_search_tree_/cond_dtor_entry_dealtor.hpp | 70 + .../cond_key_dtor_entry_dealtor.hpp | 81 + .../constructors_destructor_fn_imps.hpp | 218 + .../detail/bin_search_tree_/debug_fn_imps.hpp | 272 + .../detail/bin_search_tree_/erase_fn_imps.hpp | 120 + .../pb_ds/detail/bin_search_tree_/find_fn_imps.hpp | 182 + .../pb_ds/detail/bin_search_tree_/info_fn_imps.hpp | 64 + .../detail/bin_search_tree_/insert_fn_imps.hpp | 211 + .../detail/bin_search_tree_/iterators_fn_imps.hpp | 136 + .../detail/bin_search_tree_/node_iterators.hpp | 237 + .../detail/bin_search_tree_/point_iterators.hpp | 381 + .../bin_search_tree_/policy_access_fn_imps.hpp | 56 + .../detail/bin_search_tree_/r_erase_fn_imps.hpp | 120 + .../detail/bin_search_tree_/rotate_fn_imps.hpp | 156 + .../detail/bin_search_tree_/split_join_fn_imps.hpp | 146 + .../ext/pb_ds/detail/bin_search_tree_/traits.hpp | 250 + .../ext/pb_ds/detail/binary_heap_/binary_heap_.hpp | 357 + .../pb_ds/detail/binary_heap_/const_iterator.hpp | 152 + .../detail/binary_heap_/const_point_iterator.hpp | 144 + .../constructors_destructor_fn_imps.hpp | 159 + .../pb_ds/detail/binary_heap_/debug_fn_imps.hpp | 72 + .../ext/pb_ds/detail/binary_heap_/entry_cmp.hpp | 93 + .../ext/pb_ds/detail/binary_heap_/entry_pred.hpp | 93 + .../pb_ds/detail/binary_heap_/erase_fn_imps.hpp | 246 + .../ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp | 91 + .../ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp | 64 + .../pb_ds/detail/binary_heap_/insert_fn_imps.hpp | 183 + .../detail/binary_heap_/iterators_fn_imps.hpp | 72 + .../detail/binary_heap_/policy_access_fn_imps.hpp | 56 + .../pb_ds/detail/binary_heap_/resize_policy.hpp | 253 + .../detail/binary_heap_/split_join_fn_imps.hpp | 172 + .../pb_ds/detail/binary_heap_/trace_fn_imps.hpp | 78 + .../pb_ds/detail/binomial_heap_/binomial_heap_.hpp | 116 + .../constructors_destructor_fn_imps.hpp | 61 + .../pb_ds/detail/binomial_heap_/debug_fn_imps.hpp | 49 + .../binomial_heap_base_/binomial_heap_base_.hpp | 234 + .../constructors_destructor_fn_imps.hpp | 97 + .../detail/binomial_heap_base_/debug_fn_imps.hpp | 98 + .../detail/binomial_heap_base_/erase_fn_imps.hpp | 192 + .../detail/binomial_heap_base_/find_fn_imps.hpp | 73 + .../detail/binomial_heap_base_/insert_fn_imps.hpp | 216 + .../binomial_heap_base_/split_join_fn_imps.hpp | 232 + .../pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp | 636 + .../detail/cc_hash_table_map_/cmp_fn_imps.hpp | 83 + .../cond_key_dtor_entry_dealtor.hpp | 117 + .../constructor_destructor_fn_imps.hpp | 191 + ...onstructor_destructor_no_store_hash_fn_imps.hpp | 55 + .../constructor_destructor_store_hash_fn_imps.hpp | 56 + .../detail/cc_hash_table_map_/debug_fn_imps.hpp | 74 + .../debug_no_store_hash_fn_imps.hpp | 49 + .../debug_store_hash_fn_imps.hpp | 53 + .../cc_hash_table_map_/entry_list_fn_imps.hpp | 91 + .../detail/cc_hash_table_map_/erase_fn_imps.hpp | 103 + .../erase_no_store_hash_fn_imps.hpp | 101 + .../erase_store_hash_fn_imps.hpp | 95 + .../detail/cc_hash_table_map_/find_fn_imps.hpp | 71 + .../cc_hash_table_map_/find_store_hash_fn_imps.hpp | 41 + .../detail/cc_hash_table_map_/info_fn_imps.hpp | 100 + .../detail/cc_hash_table_map_/insert_fn_imps.hpp | 43 + .../insert_no_store_hash_fn_imps.hpp | 70 + .../insert_store_hash_fn_imps.hpp | 71 + .../cc_hash_table_map_/iterators_fn_imps.hpp | 83 + .../cc_hash_table_map_/policy_access_fn_imps.hpp | 88 + .../detail/cc_hash_table_map_/resize_fn_imps.hpp | 133 + .../resize_no_store_hash_fn_imps.hpp | 54 + .../resize_store_hash_fn_imps.hpp | 54 + .../detail/cc_hash_table_map_/size_fn_imps.hpp | 59 + .../cc_hash_table_map_/standard_policies.hpp | 46 + .../detail/cc_hash_table_map_/trace_fn_imps.hpp | 72 + .../c++/4.4.2/ext/pb_ds/detail/cond_dealtor.hpp | 125 + .../detail/constructors_destructor_fn_imps.hpp | 103 + .../ext/pb_ds/detail/container_base_dispatch.hpp | 332 + .../c++/4.4.2/ext/pb_ds/detail/debug_map_base.hpp | 360 + .../4.4.2/ext/pb_ds/detail/eq_fn/eq_by_less.hpp | 68 + .../4.4.2/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp | 179 + .../constructor_destructor_fn_imps.hpp | 223 + ...onstructor_destructor_no_store_hash_fn_imps.hpp | 53 + .../constructor_destructor_store_hash_fn_imps.hpp | 54 + .../detail/gp_hash_table_map_/debug_fn_imps.hpp | 55 + .../debug_no_store_hash_fn_imps.hpp | 71 + .../debug_store_hash_fn_imps.hpp | 77 + .../detail/gp_hash_table_map_/erase_fn_imps.hpp | 100 + .../erase_no_store_hash_fn_imps.hpp | 85 + .../erase_store_hash_fn_imps.hpp | 86 + .../detail/gp_hash_table_map_/find_fn_imps.hpp | 70 + .../find_no_store_hash_fn_imps.hpp | 46 + .../gp_hash_table_map_/find_store_hash_fn_imps.hpp | 40 + .../pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp | 677 + .../detail/gp_hash_table_map_/info_fn_imps.hpp | 58 + .../detail/gp_hash_table_map_/insert_fn_imps.hpp | 43 + .../insert_no_store_hash_fn_imps.hpp | 111 + .../insert_store_hash_fn_imps.hpp | 118 + .../detail/gp_hash_table_map_/iterator_fn_imps.hpp | 83 + .../gp_hash_table_map_/policy_access_fn_imps.hpp | 100 + .../detail/gp_hash_table_map_/resize_fn_imps.hpp | 137 + .../resize_no_store_hash_fn_imps.hpp | 72 + .../resize_store_hash_fn_imps.hpp | 74 + .../gp_hash_table_map_/standard_policies.hpp | 74 + .../detail/gp_hash_table_map_/trace_fn_imps.hpp | 74 + .../hash_fn/direct_mask_range_hashing_imp.hpp | 58 + .../hash_fn/direct_mod_range_hashing_imp.hpp | 58 + .../pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp | 53 + .../detail/hash_fn/mask_based_range_hashing.hpp | 107 + .../detail/hash_fn/mod_based_range_hashing.hpp | 108 + .../ext/pb_ds/detail/hash_fn/probe_fn_base.hpp | 59 + .../detail/hash_fn/quadratic_probe_fn_imp.hpp | 53 + .../ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp | 359 + .../ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp | 327 + .../ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp | 73 + .../pb_ds/detail/hash_fn/sample_range_hashing.hpp | 77 + .../pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp | 77 + .../detail/hash_fn/sample_ranged_probe_fn.hpp | 77 + .../const_iterator.hpp | 162 + .../const_point_iterator.hpp | 154 + .../constructors_destructor_fn_imps.hpp | 152 + .../debug_fn_imps.hpp | 141 + .../erase_fn_imps.hpp | 150 + .../left_child_next_sibling_heap_/info_fn_imps.hpp | 64 + .../insert_fn_imps.hpp | 175 + .../iterators_fn_imps.hpp | 88 + .../left_child_next_sibling_heap_.hpp | 349 + .../detail/left_child_next_sibling_heap_/node.hpp | 123 + .../null_metadata.hpp | 55 + .../policy_access_fn_imps.hpp | 52 + .../trace_fn_imps.hpp | 95 + .../constructor_destructor_fn_imps.hpp | 141 + .../detail/list_update_map_/debug_fn_imps.hpp | 57 + .../list_update_map_/entry_metadata_base.hpp | 60 + .../detail/list_update_map_/erase_fn_imps.hpp | 135 + .../pb_ds/detail/list_update_map_/find_fn_imps.hpp | 90 + .../pb_ds/detail/list_update_map_/info_fn_imps.hpp | 57 + .../detail/list_update_map_/insert_fn_imps.hpp | 106 + .../detail/list_update_map_/iterators_fn_imps.hpp | 80 + .../ext/pb_ds/detail/list_update_map_/lu_map_.hpp | 359 + .../detail/list_update_map_/trace_fn_imps.hpp | 59 + .../list_update_policy/counter_lu_metadata.hpp | 86 + .../list_update_policy/counter_lu_policy_imp.hpp | 51 + .../list_update_policy/mtf_lu_policy_imp.hpp | 55 + .../list_update_policy/sample_update_policy.hpp | 74 + .../ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp | 74 + .../constructors_destructor_fn_imps.hpp | 273 + .../pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp | 84 + .../pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp | 193 + .../ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp | 60 + .../pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp | 63 + .../detail/ov_tree_map_/iterators_fn_imps.hpp | 103 + .../pb_ds/detail/ov_tree_map_/node_iterators.hpp | 292 + .../ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp | 522 + .../detail/ov_tree_map_/policy_access_fn_imps.hpp | 51 + .../detail/ov_tree_map_/split_join_fn_imps.hpp | 137 + .../4.4.2/ext/pb_ds/detail/ov_tree_map_/traits.hpp | 183 + .../constructors_destructor_fn_imps.hpp | 91 + .../pb_ds/detail/pairing_heap_/debug_fn_imps.hpp | 53 + .../pb_ds/detail/pairing_heap_/erase_fn_imps.hpp | 236 + .../pb_ds/detail/pairing_heap_/find_fn_imps.hpp | 50 + .../pb_ds/detail/pairing_heap_/insert_fn_imps.hpp | 101 + .../pb_ds/detail/pairing_heap_/pairing_heap_.hpp | 216 + .../detail/pairing_heap_/split_join_fn_imps.hpp | 140 + .../ext/pb_ds/detail/pat_trie_/child_iterator.hpp | 93 + .../detail/pat_trie_/cond_dtor_entry_dealtor.hpp | 79 + .../detail/pat_trie_/const_child_iterator.hpp | 111 + .../pat_trie_/constructors_destructor_fn_imps.hpp | 214 + .../ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp | 117 + .../ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp | 319 + .../ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp | 269 + .../c++/4.4.2/ext/pb_ds/detail/pat_trie_/head.hpp | 124 + .../ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp | 58 + .../pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp | 465 + .../ext/pb_ds/detail/pat_trie_/internal_node.hpp | 599 + .../pb_ds/detail/pat_trie_/iterators_fn_imps.hpp | 120 + .../c++/4.4.2/ext/pb_ds/detail/pat_trie_/leaf.hpp | 171 + .../4.4.2/ext/pb_ds/detail/pat_trie_/node_base.hpp | 128 + .../ext/pb_ds/detail/pat_trie_/node_iterators.hpp | 338 + .../pb_ds/detail/pat_trie_/node_metadata_base.hpp | 86 + .../4.4.2/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp | 515 + .../ext/pb_ds/detail/pat_trie_/point_iterators.hpp | 484 + .../detail/pat_trie_/policy_access_fn_imps.hpp | 63 + .../ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp | 103 + .../ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp | 150 + .../ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp | 254 + .../detail/pat_trie_/split_join_branch_bag.hpp | 93 + .../detail/pat_trie_/synth_e_access_traits.hpp | 229 + .../ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp | 113 + .../4.4.2/ext/pb_ds/detail/pat_trie_/traits.hpp | 350 + .../ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp | 55 + .../pb_ds/detail/priority_queue_base_dispatch.hpp | 91 + .../constructors_destructor_fn_imps.hpp | 100 + .../pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp | 78 + .../pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp | 289 + .../ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp | 39 + .../ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp | 46 + .../pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp | 115 + .../4.4.2/ext/pb_ds/detail/rb_tree_map_/node.hpp | 138 + .../ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp | 280 + .../detail/rb_tree_map_/split_join_fn_imps.hpp | 313 + .../4.4.2/ext/pb_ds/detail/rb_tree_map_/traits.hpp | 124 + .../constructors_destructor_fn_imps.hpp | 88 + .../detail/rc_binomial_heap_/debug_fn_imps.hpp | 121 + .../detail/rc_binomial_heap_/erase_fn_imps.hpp | 107 + .../detail/rc_binomial_heap_/insert_fn_imps.hpp | 154 + .../ext/pb_ds/detail/rc_binomial_heap_/rc.hpp | 262 + .../detail/rc_binomial_heap_/rc_binomial_heap_.hpp | 198 + .../rc_binomial_heap_/split_join_fn_imps.hpp | 81 + .../detail/rc_binomial_heap_/trace_fn_imps.hpp | 53 + ...hash_max_collision_check_resize_trigger_imp.hpp | 211 + .../hash_exponential_size_policy_imp.hpp | 90 + .../hash_load_check_resize_trigger_imp.hpp | 289 + .../hash_load_check_resize_trigger_size_base.hpp | 94 + .../resize_policy/hash_prime_size_policy_imp.hpp | 161 + .../hash_standard_resize_policy_imp.hpp | 249 + .../detail/resize_policy/sample_resize_policy.hpp | 125 + .../detail/resize_policy/sample_resize_trigger.hpp | 137 + .../detail/resize_policy/sample_size_policy.hpp | 73 + .../constructors_destructor_fn_imps.hpp | 102 + .../ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp | 74 + .../ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp | 157 + .../ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp | 99 + .../ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp | 39 + .../pb_ds/detail/splay_tree_/insert_fn_imps.hpp | 93 + .../4.4.2/ext/pb_ds/detail/splay_tree_/node.hpp | 125 + .../ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp | 283 + .../ext/pb_ds/detail/splay_tree_/splay_tree_.hpp | 298 + .../detail/splay_tree_/split_join_fn_imps.hpp | 112 + .../4.4.2/ext/pb_ds/detail/splay_tree_/traits.hpp | 113 + .../4.4.2/ext/pb_ds/detail/standard_policies.hpp | 136 + .../thin_heap_/constructors_destructor_fn_imps.hpp | 106 + .../ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp | 112 + .../ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp | 296 + .../ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp | 51 + .../ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp | 326 + .../pb_ds/detail/thin_heap_/split_join_fn_imps.hpp | 126 + .../ext/pb_ds/detail/thin_heap_/thin_heap_.hpp | 351 + .../ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp | 55 + .../detail/tree_policy/node_metadata_selector.hpp | 116 + .../detail/tree_policy/null_node_update_imp.hpp | 50 + .../detail/tree_policy/order_statistics_imp.hpp | 141 + .../detail/tree_policy/sample_tree_node_update.hpp | 72 + .../c++/4.4.2/ext/pb_ds/detail/tree_trace_base.hpp | 209 + .../detail/trie_policy/node_metadata_selector.hpp | 116 + .../detail/trie_policy/null_node_update_imp.hpp | 50 + .../detail/trie_policy/order_statistics_imp.hpp | 183 + .../trie_policy/prefix_search_node_update_imp.hpp | 151 + .../trie_policy/sample_trie_e_access_traits.hpp | 89 + .../detail/trie_policy/sample_trie_node_update.hpp | 72 + .../string_trie_e_access_traits_imp.hpp | 99 + .../pb_ds/detail/trie_policy/trie_policy_base.hpp | 249 + .../c++/4.4.2/ext/pb_ds/detail/type_utils.hpp | 167 + .../c++/4.4.2/ext/pb_ds/detail/types_traits.hpp | 82 + .../detail/unordered_iterator/const_iterator.hpp | 129 + .../unordered_iterator/const_point_iterator.hpp | 151 + .../pb_ds/detail/unordered_iterator/iterator.hpp | 150 + .../detail/unordered_iterator/point_iterator.hpp | 143 + .../include/c++/4.4.2/ext/pb_ds/exception.hpp | 103 + .../include/c++/4.4.2/ext/pb_ds/hash_policy.hpp | 604 + .../c++/4.4.2/ext/pb_ds/list_update_policy.hpp | 136 + .../include/c++/4.4.2/ext/pb_ds/priority_queue.hpp | 125 + .../include/c++/4.4.2/ext/pb_ds/tag_and_trait.hpp | 363 + .../include/c++/4.4.2/ext/pb_ds/tree_policy.hpp | 162 + .../include/c++/4.4.2/ext/pb_ds/trie_policy.hpp | 355 + .../include/c++/4.4.2/ext/pod_char_traits.h | 182 + .../include/c++/4.4.2/ext/pointer.h | 551 + .../include/c++/4.4.2/ext/pool_allocator.h | 263 + .../include/c++/4.4.2/ext/rb_tree | 93 + .../include/c++/4.4.2/ext/rc_string_base.h | 718 + .../mips-linux-uclibc/include/c++/4.4.2/ext/rope | 2958 ++ .../include/c++/4.4.2/ext/ropeimpl.h | 1701 + .../mips-linux-uclibc/include/c++/4.4.2/ext/slist | 1077 + .../include/c++/4.4.2/ext/sso_string_base.h | 568 + .../include/c++/4.4.2/ext/stdio_filebuf.h | 157 + .../include/c++/4.4.2/ext/stdio_sync_filebuf.h | 279 + .../include/c++/4.4.2/ext/string_conversions.h | 94 + .../include/c++/4.4.2/ext/throw_allocator.h | 448 + .../include/c++/4.4.2/ext/type_traits.h | 204 + .../include/c++/4.4.2/ext/typelist.h | 544 + .../include/c++/4.4.2/ext/vstring.h | 2575 ++ .../include/c++/4.4.2/ext/vstring.tcc | 696 + .../include/c++/4.4.2/ext/vstring_fwd.h | 87 + .../include/c++/4.4.2/ext/vstring_util.h | 180 + .../usr/mips-linux-uclibc/include/c++/4.4.2/fenv.h | 58 + .../include/c++/4.4.2/forward_list | 46 + .../mips-linux-uclibc/include/c++/4.4.2/fstream | 918 + .../mips-linux-uclibc/include/c++/4.4.2/functional | 78 + .../include/c++/4.4.2/initializer_list | 72 + .../mips-linux-uclibc/include/c++/4.4.2/iomanip | 296 + .../usr/mips-linux-uclibc/include/c++/4.4.2/ios | 47 + .../usr/mips-linux-uclibc/include/c++/4.4.2/iosfwd | 160 + .../mips-linux-uclibc/include/c++/4.4.2/iostream | 76 + .../mips-linux-uclibc/include/c++/4.4.2/istream | 833 + .../mips-linux-uclibc/include/c++/4.4.2/iterator | 70 + .../usr/mips-linux-uclibc/include/c++/4.4.2/limits | 1256 + .../usr/mips-linux-uclibc/include/c++/4.4.2/list | 74 + .../usr/mips-linux-uclibc/include/c++/4.4.2/locale | 45 + .../usr/mips-linux-uclibc/include/c++/4.4.2/map | 68 + .../usr/mips-linux-uclibc/include/c++/4.4.2/memory | 100 + .../c++/4.4.2/mips-linux-uclibc/bits/atomic_word.h | 47 + .../c++/4.4.2/mips-linux-uclibc/bits/basic_file.h | 108 + .../4.4.2/mips-linux-uclibc/bits/c++allocator.h | 37 + .../c++/4.4.2/mips-linux-uclibc/bits/c++config.h | 1431 + .../c++/4.4.2/mips-linux-uclibc/bits/c++io.h | 49 + .../c++/4.4.2/mips-linux-uclibc/bits/c++locale.h | 91 + .../c++/4.4.2/mips-linux-uclibc/bits/cpu_defines.h | 33 + .../c++/4.4.2/mips-linux-uclibc/bits/ctype_base.h | 63 + .../4.4.2/mips-linux-uclibc/bits/ctype_inline.h | 73 + .../4.4.2/mips-linux-uclibc/bits/ctype_noninline.h | 92 + .../4.4.2/mips-linux-uclibc/bits/cxxabi_tweaks.h | 58 + .../4.4.2/mips-linux-uclibc/bits/error_constants.h | 175 + .../c++/4.4.2/mips-linux-uclibc/bits/extc++.h | 69 + .../4.4.2/mips-linux-uclibc/bits/gthr-default.h | 895 + .../c++/4.4.2/mips-linux-uclibc/bits/gthr-posix.h | 895 + .../c++/4.4.2/mips-linux-uclibc/bits/gthr-single.h | 292 + .../c++/4.4.2/mips-linux-uclibc/bits/gthr-tpf.h | 229 + .../c++/4.4.2/mips-linux-uclibc/bits/gthr.h | 173 + .../mips-linux-uclibc/bits/messages_members.h | 90 + .../c++/4.4.2/mips-linux-uclibc/bits/os_defines.h | 44 + .../c++/4.4.2/mips-linux-uclibc/bits/stdc++.h | 111 + .../c++/4.4.2/mips-linux-uclibc/bits/stdtr1c++.h | 53 + .../4.4.2/mips-linux-uclibc/bits/time_members.h | 90 + .../usr/mips-linux-uclibc/include/c++/4.4.2/mutex | 774 + .../usr/mips-linux-uclibc/include/c++/4.4.2/new | 112 + .../mips-linux-uclibc/include/c++/4.4.2/numeric | 78 + .../mips-linux-uclibc/include/c++/4.4.2/ostream | 568 + .../include/c++/4.4.2/parallel/algo.h | 2364 + .../include/c++/4.4.2/parallel/algobase.h | 281 + .../include/c++/4.4.2/parallel/algorithm | 40 + .../include/c++/4.4.2/parallel/algorithmfwd.h | 898 + .../c++/4.4.2/parallel/balanced_quicksort.h | 477 + .../include/c++/4.4.2/parallel/base.h | 471 + .../include/c++/4.4.2/parallel/basic_iterator.h | 42 + .../include/c++/4.4.2/parallel/checkers.h | 154 + .../include/c++/4.4.2/parallel/compatibility.h | 350 + .../c++/4.4.2/parallel/compiletime_settings.h | 75 + .../include/c++/4.4.2/parallel/equally_split.h | 87 + .../include/c++/4.4.2/parallel/features.h | 104 + .../include/c++/4.4.2/parallel/find.h | 401 + .../include/c++/4.4.2/parallel/find_selectors.h | 192 + .../include/c++/4.4.2/parallel/for_each.h | 97 + .../c++/4.4.2/parallel/for_each_selectors.h | 360 + .../include/c++/4.4.2/parallel/iterator.h | 200 + .../include/c++/4.4.2/parallel/list_partition.h | 176 + .../include/c++/4.4.2/parallel/losertree.h | 1021 + .../include/c++/4.4.2/parallel/merge.h | 261 + .../c++/4.4.2/parallel/multiseq_selection.h | 633 + .../include/c++/4.4.2/parallel/multiway_merge.h | 2140 + .../c++/4.4.2/parallel/multiway_mergesort.h | 475 + .../include/c++/4.4.2/parallel/numeric | 500 + .../include/c++/4.4.2/parallel/numericfwd.h | 203 + .../include/c++/4.4.2/parallel/omp_loop.h | 118 + .../include/c++/4.4.2/parallel/omp_loop_static.h | 117 + .../include/c++/4.4.2/parallel/par_loop.h | 135 + .../include/c++/4.4.2/parallel/parallel.h | 42 + .../include/c++/4.4.2/parallel/partial_sum.h | 220 + .../include/c++/4.4.2/parallel/partition.h | 429 + .../include/c++/4.4.2/parallel/queue.h | 149 + .../include/c++/4.4.2/parallel/quicksort.h | 179 + .../include/c++/4.4.2/parallel/random_number.h | 124 + .../include/c++/4.4.2/parallel/random_shuffle.h | 519 + .../include/c++/4.4.2/parallel/search.h | 172 + .../include/c++/4.4.2/parallel/set_operations.h | 524 + .../include/c++/4.4.2/parallel/settings.h | 281 + .../include/c++/4.4.2/parallel/sort.h | 229 + .../include/c++/4.4.2/parallel/tags.h | 191 + .../include/c++/4.4.2/parallel/types.h | 155 + .../include/c++/4.4.2/parallel/unique_copy.h | 192 + .../include/c++/4.4.2/parallel/workstealing.h | 306 + .../usr/mips-linux-uclibc/include/c++/4.4.2/queue | 67 + .../usr/mips-linux-uclibc/include/c++/4.4.2/random | 70 + .../usr/mips-linux-uclibc/include/c++/4.4.2/ratio | 303 + .../usr/mips-linux-uclibc/include/c++/4.4.2/regex | 68 + .../usr/mips-linux-uclibc/include/c++/4.4.2/set | 68 + .../mips-linux-uclibc/include/c++/4.4.2/sstream | 576 + .../usr/mips-linux-uclibc/include/c++/4.4.2/stack | 64 + .../include/c++/4.4.2/stdatomic.h | 218 + .../mips-linux-uclibc/include/c++/4.4.2/stdexcept | 150 + .../mips-linux-uclibc/include/c++/4.4.2/streambuf | 799 + .../usr/mips-linux-uclibc/include/c++/4.4.2/string | 59 + .../include/c++/4.4.2/system_error | 353 + .../mips-linux-uclibc/include/c++/4.4.2/tgmath.h | 42 + .../usr/mips-linux-uclibc/include/c++/4.4.2/thread | 284 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/array | 54 + .../include/c++/4.4.2/tr1/bessel_function.tcc | 627 + .../include/c++/4.4.2/tr1/beta_function.tcc | 197 + .../include/c++/4.4.2/tr1/ccomplex | 34 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/cctype | 49 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/cfenv | 53 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/cfloat | 42 + .../include/c++/4.4.2/tr1/cinttypes | 63 + .../include/c++/4.4.2/tr1/climits | 46 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/cmath | 507 + .../include/c++/4.4.2/tr1/complex | 91 + .../include/c++/4.4.2/tr1/complex.h | 34 + .../include/c++/4.4.2/tr1/cstdarg | 34 + .../include/c++/4.4.2/tr1/cstdbool | 40 + .../include/c++/4.4.2/tr1/cstdint | 76 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/cstdio | 54 + .../include/c++/4.4.2/tr1/cstdlib | 54 + .../include/c++/4.4.2/tr1/ctgmath | 34 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/ctime | 34 + .../include/c++/4.4.2/tr1/ctype.h | 34 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/cwchar | 54 + .../include/c++/4.4.2/tr1/cwctype | 54 + .../include/c++/4.4.2/tr1/ell_integral.tcc | 750 + .../include/c++/4.4.2/tr1/exp_integral.tcc | 524 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/fenv.h | 34 + .../include/c++/4.4.2/tr1/float.h | 34 + .../include/c++/4.4.2/tr1/functional | 63 + .../include/c++/4.4.2/tr1/functional_hash.h | 53 + .../include/c++/4.4.2/tr1/gamma.tcc | 471 + .../include/c++/4.4.2/tr1/hashtable.h | 53 + .../include/c++/4.4.2/tr1/hypergeometric.tcc | 774 + .../include/c++/4.4.2/tr1/inttypes.h | 34 + .../include/c++/4.4.2/tr1/legendre_function.tcc | 305 + .../include/c++/4.4.2/tr1/limits.h | 34 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/math.h | 186 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/memory | 67 + .../include/c++/4.4.2/tr1/modified_bessel_func.tcc | 436 + .../include/c++/4.4.2/tr1/poly_hermite.tcc | 124 + .../include/c++/4.4.2/tr1/poly_laguerre.tcc | 329 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/random | 66 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/regex | 64 + .../include/c++/4.4.2/tr1/riemann_zeta.tcc | 435 + .../include/c++/4.4.2/tr1/shared_ptr.h | 1020 + .../include/c++/4.4.2/tr1/special_function_util.h | 144 + .../include/c++/4.4.2/tr1/stdarg.h | 34 + .../include/c++/4.4.2/tr1/stdbool.h | 34 + .../include/c++/4.4.2/tr1/stdint.h | 34 + .../include/c++/4.4.2/tr1/stdio.h | 34 + .../include/c++/4.4.2/tr1/stdlib.h | 52 + .../include/c++/4.4.2/tr1/tgmath.h | 34 + .../mips-linux-uclibc/include/c++/4.4.2/tr1/tuple | 422 + .../include/c++/4.4.2/tr1/type_traits | 249 + .../include/c++/4.4.2/tr1/unordered_map | 61 + .../include/c++/4.4.2/tr1/unordered_set | 61 + .../include/c++/4.4.2/tr1/utility | 56 + .../include/c++/4.4.2/tr1/wchar.h | 34 + .../include/c++/4.4.2/tr1/wctype.h | 34 + .../include/c++/4.4.2/tr1_impl/array | 287 + .../c++/4.4.2/tr1_impl/boost_sp_counted_base.h | 239 + .../include/c++/4.4.2/tr1_impl/cctype | 43 + .../include/c++/4.4.2/tr1_impl/cfenv | 70 + .../include/c++/4.4.2/tr1_impl/cinttypes | 64 + .../include/c++/4.4.2/tr1_impl/cmath | 902 + .../include/c++/4.4.2/tr1_impl/complex | 370 + .../include/c++/4.4.2/tr1_impl/cstdint | 75 + .../include/c++/4.4.2/tr1_impl/cstdio | 44 + .../include/c++/4.4.2/tr1_impl/cstdlib | 65 + .../include/c++/4.4.2/tr1_impl/cwchar | 58 + .../include/c++/4.4.2/tr1_impl/cwctype | 43 + .../include/c++/4.4.2/tr1_impl/functional | 2130 + .../include/c++/4.4.2/tr1_impl/functional_hash.h | 183 + .../include/c++/4.4.2/tr1_impl/hashtable | 1266 + .../include/c++/4.4.2/tr1_impl/hashtable_policy.h | 865 + .../include/c++/4.4.2/tr1_impl/random | 2407 + .../include/c++/4.4.2/tr1_impl/random.tcc | 1577 + .../include/c++/4.4.2/tr1_impl/regex | 2708 ++ .../include/c++/4.4.2/tr1_impl/type_traits | 501 + .../include/c++/4.4.2/tr1_impl/unordered_map | 370 + .../include/c++/4.4.2/tr1_impl/unordered_set | 360 + .../include/c++/4.4.2/tr1_impl/utility | 120 + .../usr/mips-linux-uclibc/include/c++/4.4.2/tuple | 697 + .../include/c++/4.4.2/type_traits | 605 + .../mips-linux-uclibc/include/c++/4.4.2/typeinfo | 196 + .../include/c++/4.4.2/unordered_map | 78 + .../include/c++/4.4.2/unordered_set | 78 + .../mips-linux-uclibc/include/c++/4.4.2/utility | 94 + .../mips-linux-uclibc/include/c++/4.4.2/valarray | 1087 + .../usr/mips-linux-uclibc/include/c++/4.4.2/vector | 77 + .../usr/mips-linux-uclibc/lib/libgcc_s.so | 1 + .../usr/mips-linux-uclibc/lib/libgcc_s.so.1 | Bin 0 -> 1577014 bytes .../usr/mips-linux-uclibc/lib/libgomp.a | Bin 0 -> 326204 bytes .../usr/mips-linux-uclibc/lib/libgomp.la | 41 + .../usr/mips-linux-uclibc/lib/libgomp.so | 1 + .../usr/mips-linux-uclibc/lib/libgomp.so.1 | 1 + .../usr/mips-linux-uclibc/lib/libgomp.so.1.0.0 | Bin 0 -> 236610 bytes .../usr/mips-linux-uclibc/lib/libgomp.spec | 3 + .../usr/mips-linux-uclibc/lib/libiberty.a | Bin 0 -> 663434 bytes .../usr/mips-linux-uclibc/lib/libmudflap.a | Bin 0 -> 385022 bytes .../usr/mips-linux-uclibc/lib/libmudflap.la | 41 + .../usr/mips-linux-uclibc/lib/libmudflap.so | 1 + .../usr/mips-linux-uclibc/lib/libmudflap.so.0 | 1 + .../usr/mips-linux-uclibc/lib/libmudflap.so.0.0.0 | Bin 0 -> 289118 bytes .../usr/mips-linux-uclibc/lib/libmudflapth.a | Bin 0 -> 321180 bytes .../usr/mips-linux-uclibc/lib/libmudflapth.la | 41 + .../usr/mips-linux-uclibc/lib/libmudflapth.so | 1 + .../usr/mips-linux-uclibc/lib/libmudflapth.so.0 | 1 + .../mips-linux-uclibc/lib/libmudflapth.so.0.0.0 | Bin 0 -> 298103 bytes .../usr/mips-linux-uclibc/lib/libstdc++.a | Bin 0 -> 7147930 bytes .../usr/mips-linux-uclibc/lib/libstdc++.la | 41 + .../usr/mips-linux-uclibc/lib/libstdc++.so | 1 + .../usr/mips-linux-uclibc/lib/libstdc++.so.6 | 1 + .../usr/mips-linux-uclibc/lib/libstdc++.so.6.0.13 | Bin 0 -> 3894991 bytes .../usr/mips-linux-uclibc/lib/libsupc++.a | Bin 0 -> 551266 bytes .../usr/mips-linux-uclibc/lib/libsupc++.la | 41 + .../usr/mips-linux-uclibc/sys-include | 1 + .../usr/mips-linux-uclibc/target_utils/gdbserver | Bin 0 -> 82124 bytes .../usr/mips-linux-uclibc/target_utils/ldd | Bin 0 -> 14395 bytes .../usr/share/info/as.info | 22073 ++++++++++ .../usr/share/info/bfd.info | 11288 +++++ .../usr/share/info/binutils.info | 4493 ++ .../usr/share/info/configure.info | 2773 ++ uclibc-crosstools-gcc-4.4.2-1/usr/share/info/dir | 43 + .../usr/share/info/gprof.info | 2469 ++ .../usr/share/info/ld.info | 7611 ++++ .../usr/share/info/standards.info | 5576 +++ .../share/man/man1/mips-linux-uclibc-addr2line.1 | 273 + .../usr/share/man/man1/mips-linux-uclibc-ar.1 | 429 + .../usr/share/man/man1/mips-linux-uclibc-as.1 | 1208 + .../usr/share/man/man1/mips-linux-uclibc-c++filt.1 | 345 + .../usr/share/man/man1/mips-linux-uclibc-dlltool.1 | 529 + .../usr/share/man/man1/mips-linux-uclibc-gprof.1 | 772 + .../usr/share/man/man1/mips-linux-uclibc-ld.1 | 2355 + .../usr/share/man/man1/mips-linux-uclibc-nlmconv.1 | 251 + .../usr/share/man/man1/mips-linux-uclibc-nm.1 | 523 + .../usr/share/man/man1/mips-linux-uclibc-objcopy.1 | 935 + .../usr/share/man/man1/mips-linux-uclibc-objdump.1 | 803 + .../usr/share/man/man1/mips-linux-uclibc-ranlib.1 | 199 + .../usr/share/man/man1/mips-linux-uclibc-readelf.1 | 420 + .../usr/share/man/man1/mips-linux-uclibc-size.1 | 275 + .../usr/share/man/man1/mips-linux-uclibc-strings.1 | 264 + .../usr/share/man/man1/mips-linux-uclibc-strip.1 | 399 + .../usr/share/man/man1/mips-linux-uclibc-windmc.1 | 359 + .../usr/share/man/man1/mips-linux-uclibc-windres.1 | 362 + 2344 files changed, 729603 insertions(+) create mode 100755 buildcfe.sh create mode 100755 cfe/build/broadcom/bcm63xx_ram/Makefile create mode 100755 cfe/build/broadcom/bcm63xx_rom/Makefile create mode 100644 cfe/cfe/api/Makefile create mode 100644 cfe/cfe/api/cfe_api.c create mode 100644 cfe/cfe/api/cfe_api.h create mode 100644 cfe/cfe/api/cfe_api_int.h create mode 100644 cfe/cfe/api/cfe_error.h create mode 100644 cfe/cfe/applets/Makefile create mode 100644 cfe/cfe/applets/README create mode 100644 cfe/cfe/applets/cfe_applet.lds create mode 100644 cfe/cfe/applets/download.c create mode 100644 cfe/cfe/applets/download.lds create mode 100644 cfe/cfe/applets/minicrt0.S create mode 100644 cfe/cfe/applets/test.c create mode 100644 cfe/cfe/applets/vapitest.S create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm63xx_util.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_common.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_cpu.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_map.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcmmii.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcmtypes.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/bsp_config.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/dev_bcm63xx_eth.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/dev_bcm63xx_flash.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/include/jffs2.h create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/Makefile create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_board.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_cmd.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_devs.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_env_subr.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_httpd.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ldr_elf.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ldr_raw.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_main.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_net_icmp.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ram_boot.S create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_util.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_eth.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_flash.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_uart.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/html/ul.html create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/html/ulinfo.html create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/ram_cfe.mk create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_ram/src/robosw_reg.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_rom/src/Makefile create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm6368_rom_boot.S create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm6368_sdramDqs.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm63xx_impl1_rom_boot.S create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm63xx_main.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_rom/src/memtest.c create mode 100755 cfe/cfe/arch/mips/board/bcm63xx_rom/src/rom_cfe.mk create mode 100644 cfe/cfe/arch/mips/common/include/addrspace.h create mode 100644 cfe/cfe/arch/mips/common/include/disasm.h create mode 100644 cfe/cfe/arch/mips/common/include/exception.h create mode 100644 cfe/cfe/arch/mips/common/include/exchandler.h create mode 100644 cfe/cfe/arch/mips/common/include/initdata.h create mode 100644 cfe/cfe/arch/mips/common/include/lib_hssubr.h create mode 100644 cfe/cfe/arch/mips/common/include/lib_physio.h create mode 100644 cfe/cfe/arch/mips/common/include/lib_setjmp.h create mode 100755 cfe/cfe/arch/mips/common/include/mipsmacros.h create mode 100755 cfe/cfe/arch/mips/common/include/segtable.h create mode 100755 cfe/cfe/arch/mips/common/src/Makefile create mode 100644 cfe/cfe/arch/mips/common/src/cfe_ram_cached.lds create mode 100644 cfe/cfe/arch/mips/common/src/cfe_ram_uncached.lds create mode 100755 cfe/cfe/arch/mips/common/src/cfe_ramapp.lds create mode 100755 cfe/cfe/arch/mips/common/src/cfe_rom_cached.lds create mode 100644 cfe/cfe/arch/mips/common/src/cfe_rom_reloc_cached.lds create mode 100644 cfe/cfe/arch/mips/common/src/cfe_rom_reloc_cached_biendian.lds create mode 100644 cfe/cfe/arch/mips/common/src/cfe_rom_reloc_uncached.lds create mode 100644 cfe/cfe/arch/mips/common/src/cfe_rom_uncached.lds create mode 100644 cfe/cfe/arch/mips/common/src/dev_flash_all.S create mode 100644 cfe/cfe/arch/mips/common/src/dev_flashop_engine.S create mode 100644 cfe/cfe/arch/mips/common/src/disasm.c create mode 100644 cfe/cfe/arch/mips/common/src/exception.S create mode 100644 cfe/cfe/arch/mips/common/src/exchandler.c create mode 100755 cfe/cfe/arch/mips/common/src/init_mips.S create mode 100755 cfe/cfe/arch/mips/common/src/init_ram.S create mode 100644 cfe/cfe/arch/mips/common/src/lib_hssubr.S create mode 100644 cfe/cfe/arch/mips/common/src/lib_physio.S create mode 100644 cfe/cfe/arch/mips/common/src/lib_setjmp.S create mode 100644 cfe/cfe/arch/mips/common/src/mips_arena.c create mode 100755 cfe/cfe/arch/mips/common/src/tools.mk create mode 100644 cfe/cfe/arch/mips/common/src/ui_memtest.c create mode 100644 cfe/cfe/arch/mips/cpu/SIBYTE_PRIVATE_FILES create mode 100644 cfe/cfe/arch/mips/cpu/bcmcore/include/bcm4710.h create mode 100644 cfe/cfe/arch/mips/cpu/bcmcore/include/bcm47xx.h create mode 100644 cfe/cfe/arch/mips/cpu/bcmcore/include/bcmnvram.h create mode 100755 cfe/cfe/arch/mips/cpu/bcmcore/include/cpu_config.h create mode 100644 cfe/cfe/arch/mips/cpu/bcmcore/include/sbmips.h create mode 100644 cfe/cfe/arch/mips/cpu/bcmcore/include/sbsdram.h create mode 100755 cfe/cfe/arch/mips/cpu/bcmcore/src/Makefile create mode 100755 cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_arena.c create mode 100755 cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_cpuinit.S create mode 100755 cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_l1cache.S create mode 100644 cfe/cfe/dev/SIBYTE_PRIVATE_FILES create mode 100644 cfe/cfe/dev/bcm5700.h create mode 100644 cfe/cfe/dev/bcm5821.h create mode 100644 cfe/cfe/dev/dc21143.h create mode 100644 cfe/cfe/dev/dev_atapi.c create mode 100644 cfe/cfe/dev/dev_bcm1250.c create mode 100644 cfe/cfe/dev/dev_bcm5700.c create mode 100644 cfe/cfe/dev/dev_bcm5821.c create mode 100644 cfe/cfe/dev/dev_dc21143.c create mode 100644 cfe/cfe/dev/dev_dp83815.c create mode 100644 cfe/cfe/dev/dev_ds17887clock.c create mode 100644 cfe/cfe/dev/dev_flash.c create mode 100644 cfe/cfe/dev/dev_ht7520.c create mode 100644 cfe/cfe/dev/dev_ide_common.c create mode 100644 cfe/cfe/dev/dev_ide_pci.c create mode 100644 cfe/cfe/dev/dev_newflash.c create mode 100644 cfe/cfe/dev/dev_ns16550.c create mode 100644 cfe/cfe/dev/dev_ns16550_pci.c create mode 100644 cfe/cfe/dev/dev_null.c create mode 100644 cfe/cfe/dev/dev_promice.c create mode 100644 cfe/cfe/dev/dev_sp1011.c create mode 100644 cfe/cfe/dev/dev_tulip.c create mode 100644 cfe/cfe/dev/dp83815.h create mode 100644 cfe/cfe/dev/ns16550.h create mode 100644 cfe/cfe/dev/pci_devs.c create mode 100644 cfe/cfe/hosttools/Makefile create mode 100644 cfe/cfe/hosttools/README create mode 100644 cfe/cfe/hosttools/installboot.c create mode 100644 cfe/cfe/hosttools/makereg.c create mode 100644 cfe/cfe/hosttools/memconfig.c create mode 100644 cfe/cfe/hosttools/mkbootimage.c create mode 100644 cfe/cfe/hosttools/mkflashimage.c create mode 100644 cfe/cfe/hosttools/mkpcidb.c create mode 100755 cfe/cfe/include/cfe.h create mode 100644 cfe/cfe/include/cfe_autoboot.h create mode 100644 cfe/cfe/include/cfe_boot.h create mode 100644 cfe/cfe/include/cfe_bootblock.h create mode 100755 cfe/cfe/include/cfe_console.h create mode 100644 cfe/cfe/include/cfe_devfuncs.h create mode 100644 cfe/cfe/include/cfe_device.h create mode 100644 cfe/cfe/include/cfe_error.h create mode 100644 cfe/cfe/include/cfe_fileops.h create mode 100644 cfe/cfe/include/cfe_flashimage.h create mode 100644 cfe/cfe/include/cfe_iocb.h create mode 100644 cfe/cfe/include/cfe_ioctl.h create mode 100644 cfe/cfe/include/cfe_irq.h create mode 100644 cfe/cfe/include/cfe_loader.h create mode 100644 cfe/cfe/include/cfe_mem.h create mode 100644 cfe/cfe/include/cfe_timer.h create mode 100644 cfe/cfe/include/cfe_xiocb.h create mode 100644 cfe/cfe/include/dev_flash.h create mode 100644 cfe/cfe/include/dev_ide.h create mode 100644 cfe/cfe/include/dev_ide_common.h create mode 100644 cfe/cfe/include/dev_newflash.h create mode 100644 cfe/cfe/include/elf.h create mode 100644 cfe/cfe/include/env_subr.h create mode 100755 cfe/cfe/include/foxconnCfg.h create mode 100644 cfe/cfe/include/lib_arena.h create mode 100644 cfe/cfe/include/lib_malloc.h create mode 100755 cfe/cfe/include/lib_printf.h create mode 100644 cfe/cfe/include/lib_queue.h create mode 100644 cfe/cfe/include/lib_string.h create mode 100644 cfe/cfe/include/lib_types.h create mode 100644 cfe/cfe/include/socregs.h create mode 100755 cfe/cfe/include/tftpd.h create mode 100644 cfe/cfe/include/ui_command.h create mode 100644 cfe/cfe/lib/lib_arena.c create mode 100644 cfe/cfe/lib/lib_malloc.c create mode 100644 cfe/cfe/lib/lib_misc.c create mode 100644 cfe/cfe/lib/lib_printf.c create mode 100644 cfe/cfe/lib/lib_qsort.c create mode 100644 cfe/cfe/lib/lib_queue.c create mode 100644 cfe/cfe/lib/lib_string.c create mode 100644 cfe/cfe/lib/lib_string2.c create mode 100755 cfe/cfe/lzma/LzmaDecode.c create mode 100755 cfe/cfe/lzma/LzmaDecode.h create mode 100755 cfe/cfe/lzma/LzmaDecodeSize.c create mode 100755 cfe/cfe/lzma/LzmaStateDecode.c create mode 100755 cfe/cfe/lzma/LzmaStateDecode.h create mode 100755 cfe/cfe/lzma/LzmaStateTest.c create mode 100755 cfe/cfe/lzma/LzmaTest.c create mode 100755 cfe/cfe/lzma/LzmaTypes.h create mode 100755 cfe/cfe/lzma/Makefile create mode 100755 cfe/cfe/lzma/dcapi.c create mode 100644 cfe/cfe/main/cfe.mk create mode 100644 cfe/cfe/main/cfe_attach.c create mode 100644 cfe/cfe/main/cfe_autoboot.c create mode 100644 cfe/cfe/main/cfe_background.c create mode 100644 cfe/cfe/main/cfe_boot.c create mode 100755 cfe/cfe/main/cfe_console.c create mode 100755 cfe/cfe/main/cfe_devfuncs.c create mode 100644 cfe/cfe/main/cfe_error.c create mode 100644 cfe/cfe/main/cfe_fatfs.c create mode 100755 cfe/cfe/main/cfe_filesys.c create mode 100644 cfe/cfe/main/cfe_httpfs.c create mode 100755 cfe/cfe/main/cfe_iocb_dispatch.c create mode 100644 cfe/cfe/main/cfe_ldr_elf.c create mode 100644 cfe/cfe/main/cfe_ldr_raw.c create mode 100644 cfe/cfe/main/cfe_ldr_srec.c create mode 100644 cfe/cfe/main/cfe_link.mk create mode 100644 cfe/cfe/main/cfe_loader.c create mode 100644 cfe/cfe/main/cfe_main.c create mode 100644 cfe/cfe/main/cfe_mem.c create mode 100644 cfe/cfe/main/cfe_rawfs.c create mode 100644 cfe/cfe/main/cfe_savedata.c create mode 100644 cfe/cfe/main/cfe_timer.c create mode 100755 cfe/cfe/main/cfe_version.mk create mode 100644 cfe/cfe/main/cfe_xreq.c create mode 100644 cfe/cfe/main/cfe_zlibfs.c create mode 100644 cfe/cfe/main/env_subr.c create mode 100644 cfe/cfe/main/nvram_subr.c create mode 100644 cfe/cfe/main/nvram_subr.h create mode 100644 cfe/cfe/net/README create mode 100644 cfe/cfe/net/dev_tcpconsole.c create mode 100644 cfe/cfe/net/mii.h create mode 100755 cfe/cfe/net/net_api.c create mode 100755 cfe/cfe/net/net_api.h create mode 100755 cfe/cfe/net/net_arp.c create mode 100644 cfe/cfe/net/net_dhcp.c create mode 100755 cfe/cfe/net/net_dns.c create mode 100644 cfe/cfe/net/net_ebuf.h create mode 100644 cfe/cfe/net/net_ether.c create mode 100644 cfe/cfe/net/net_ether.h create mode 100644 cfe/cfe/net/net_icmp.c create mode 100755 cfe/cfe/net/net_ip.c create mode 100755 cfe/cfe/net/net_ip.h create mode 100644 cfe/cfe/net/net_ip_internal.h create mode 100755 cfe/cfe/net/net_nmrp.c create mode 100755 cfe/cfe/net/net_nmrp.h create mode 100755 cfe/cfe/net/net_tcp.c create mode 100755 cfe/cfe/net/net_tcp.h create mode 100755 cfe/cfe/net/net_tcp_internal.h create mode 100644 cfe/cfe/net/net_tcpbuf.c create mode 100644 cfe/cfe/net/net_tcpbuf.h create mode 100644 cfe/cfe/net/net_tftp.c create mode 100644 cfe/cfe/net/net_udp.c create mode 100644 cfe/cfe/pccons/Makefile create mode 100644 cfe/cfe/pccons/README create mode 100644 cfe/cfe/pccons/dev_pcconsole.c create mode 100644 cfe/cfe/pccons/dev_pcconsole2.c create mode 100644 cfe/cfe/pccons/kbd_subr.c create mode 100644 cfe/cfe/pccons/kbd_subr.h create mode 100644 cfe/cfe/pccons/pcibios.h create mode 100644 cfe/cfe/pccons/vga.h create mode 100644 cfe/cfe/pccons/vga_subr.c create mode 100644 cfe/cfe/pccons/vga_subr.h create mode 100644 cfe/cfe/pccons/vgainit.c create mode 100644 cfe/cfe/pccons/x86mem.c create mode 100644 cfe/cfe/pccons/x86mem.h create mode 100644 cfe/cfe/pci/cfe_pci.h create mode 100644 cfe/cfe/pci/devlist2h.awk create mode 100644 cfe/cfe/pci/ldtinit.c create mode 100644 cfe/cfe/pci/ldtreg.h create mode 100644 cfe/cfe/pci/pci_machdep.h create mode 100644 cfe/cfe/pci/pci_subr.c create mode 100644 cfe/cfe/pci/pciconf.c create mode 100644 cfe/cfe/pci/pcidevs create mode 100644 cfe/cfe/pci/pcidevs.h create mode 100644 cfe/cfe/pci/pcidevs_data.h create mode 100644 cfe/cfe/pci/pcireg.h create mode 100644 cfe/cfe/pci/pcivar.h create mode 100644 cfe/cfe/ui/ui_cmddisp.c create mode 100644 cfe/cfe/ui/ui_command.c create mode 100644 cfe/cfe/ui/ui_devcmds.c create mode 100644 cfe/cfe/ui/ui_envcmds.c create mode 100644 cfe/cfe/ui/ui_examcmds.c create mode 100644 cfe/cfe/ui/ui_flash.c create mode 100644 cfe/cfe/ui/ui_loadcmds.c create mode 100644 cfe/cfe/ui/ui_memcmds.c create mode 100644 cfe/cfe/ui/ui_misccmds.c create mode 100644 cfe/cfe/ui/ui_netcmds.c create mode 100644 cfe/cfe/ui/ui_pcicmds.c create mode 100644 cfe/cfe/ui/ui_tcpcmds.c create mode 100644 cfe/cfe/ui/ui_test_disk.c create mode 100644 cfe/cfe/ui/ui_test_ether.c create mode 100644 cfe/cfe/ui/ui_test_flash.c create mode 100644 cfe/cfe/ui/ui_test_uart.c create mode 100755 cfe/cfe/ui/ui_tftpd.c create mode 100644 cfe/cfe/ui/ui_toyclock.c create mode 100644 cfe/cfe/ui/url.c create mode 100644 cfe/cfe/ui/url.h create mode 100644 cfe/cfe/usb/Makefile create mode 100644 cfe/cfe/usb/README create mode 100644 cfe/cfe/usb/ohci.c create mode 100644 cfe/cfe/usb/ohci.h create mode 100644 cfe/cfe/usb/usbchap9.h create mode 100644 cfe/cfe/usb/usbd.c create mode 100644 cfe/cfe/usb/usbd.h create mode 100644 cfe/cfe/usb/usbdebug.c create mode 100644 cfe/cfe/usb/usbdevs.c create mode 100644 cfe/cfe/usb/usbeth.c create mode 100644 cfe/cfe/usb/usbeth.h create mode 100644 cfe/cfe/usb/usbhack.c create mode 100644 cfe/cfe/usb/usbhack.h create mode 100644 cfe/cfe/usb/usbhack.mk create mode 100644 cfe/cfe/usb/usbhid.c create mode 100644 cfe/cfe/usb/usbhub.c create mode 100644 cfe/cfe/usb/usbmain.c create mode 100644 cfe/cfe/usb/usbmass.c create mode 100644 cfe/cfe/usb/usbserial.c create mode 100644 cfe/cfe/vendor/Makefile create mode 100644 cfe/cfe/vendor/cfe_vendor_cmds.c create mode 100644 cfe/cfe/vendor/cfe_vendor_iocb.h create mode 100644 cfe/cfe/vendor/cfe_vendor_iocb_dispatch.c create mode 100644 cfe/cfe/vendor/cfe_vendor_xiocb.h create mode 100644 cfe/cfe/vendor/cfe_vendor_xreq.c create mode 100644 cfe/cfe/verif/Makefile create mode 100644 cfe/cfe/verif/readme.txt create mode 100644 cfe/cfe/verif/ui_vapi.c create mode 100644 cfe/cfe/verif/vapi.S create mode 100644 cfe/cfe/verif/vapi.h create mode 100644 cfe/cfe/verif/vapisubr.c create mode 100644 cfe/cfe/verif/vapitest.S create mode 100644 cfe/cfe/x86emu/LICENSE create mode 100644 cfe/cfe/x86emu/Makefile create mode 100644 cfe/cfe/x86emu/README create mode 100644 cfe/cfe/x86emu/debug.c create mode 100644 cfe/cfe/x86emu/decode.c create mode 100644 cfe/cfe/x86emu/fpu.c create mode 100644 cfe/cfe/x86emu/ops.c create mode 100644 cfe/cfe/x86emu/ops2.c create mode 100644 cfe/cfe/x86emu/prim_ops.c create mode 100644 cfe/cfe/x86emu/sys.c create mode 100644 cfe/cfe/x86emu/validate.c create mode 100644 cfe/cfe/x86emu/x86emu.h create mode 100644 cfe/cfe/x86emu/x86emu/debug.h create mode 100644 cfe/cfe/x86emu/x86emu/decode.h create mode 100644 cfe/cfe/x86emu/x86emu/fpu.h create mode 100644 cfe/cfe/x86emu/x86emu/fpu_regs.h create mode 100644 cfe/cfe/x86emu/x86emu/ops.h create mode 100644 cfe/cfe/x86emu/x86emu/ops_protos.h create mode 100644 cfe/cfe/x86emu/x86emu/prim_asm.h create mode 100644 cfe/cfe/x86emu/x86emu/prim_ops.h create mode 100644 cfe/cfe/x86emu/x86emu/regs.h create mode 100644 cfe/cfe/x86emu/x86emu/types.h create mode 100644 cfe/cfe/x86emu/x86emu/x86emui.h create mode 100644 cfe/cfe/zlib/ChangeLog create mode 100644 cfe/cfe/zlib/FAQ create mode 100644 cfe/cfe/zlib/INDEX create mode 100644 cfe/cfe/zlib/Make_vms.com create mode 100644 cfe/cfe/zlib/Makefile create mode 100644 cfe/cfe/zlib/Makefile.in create mode 100644 cfe/cfe/zlib/Makefile.orig create mode 100644 cfe/cfe/zlib/Makefile.riscos create mode 100644 cfe/cfe/zlib/README create mode 100644 cfe/cfe/zlib/adler32.c create mode 100644 cfe/cfe/zlib/algorithm.txt create mode 100644 cfe/cfe/zlib/compress.c create mode 100755 cfe/cfe/zlib/configure create mode 100644 cfe/cfe/zlib/crc32.c create mode 100644 cfe/cfe/zlib/deflate.c create mode 100644 cfe/cfe/zlib/deflate.h create mode 100644 cfe/cfe/zlib/descrip.mms create mode 100644 cfe/cfe/zlib/example.c create mode 100644 cfe/cfe/zlib/gzio.c create mode 100644 cfe/cfe/zlib/infblock.c create mode 100644 cfe/cfe/zlib/infblock.h create mode 100644 cfe/cfe/zlib/infcodes.c create mode 100644 cfe/cfe/zlib/infcodes.h create mode 100644 cfe/cfe/zlib/inffast.c create mode 100644 cfe/cfe/zlib/inffast.h create mode 100644 cfe/cfe/zlib/inffixed.h create mode 100644 cfe/cfe/zlib/inflate.c create mode 100644 cfe/cfe/zlib/inftrees.c create mode 100644 cfe/cfe/zlib/inftrees.h create mode 100644 cfe/cfe/zlib/infutil.c create mode 100644 cfe/cfe/zlib/infutil.h create mode 100644 cfe/cfe/zlib/maketree.c create mode 100644 cfe/cfe/zlib/minigzip.c create mode 100644 cfe/cfe/zlib/trees.c create mode 100644 cfe/cfe/zlib/trees.h create mode 100644 cfe/cfe/zlib/uncompr.c create mode 100644 cfe/cfe/zlib/zconf.h create mode 100644 cfe/cfe/zlib/zlib.3 create mode 100644 cfe/cfe/zlib/zlib.h create mode 100644 cfe/cfe/zlib/zutil.c create mode 100644 cfe/cfe/zlib/zutil.h create mode 100755 cfe/docs/cfe.pdf create mode 100755 shared/broadcom/include/bcm963xx/6328_common.h create mode 100755 shared/broadcom/include/bcm963xx/6328_map.h create mode 100755 shared/broadcom/include/bcm963xx/6362_common.h create mode 100755 shared/broadcom/include/bcm963xx/6362_map.h create mode 100755 shared/broadcom/include/bcm963xx/6368_common.h create mode 100755 shared/broadcom/include/bcm963xx/6368_map.h create mode 100755 shared/broadcom/include/bcm963xx/6816_common.h create mode 100755 shared/broadcom/include/bcm963xx/6816_map.h create mode 100755 shared/broadcom/include/bcm963xx/mocablock.h create mode 100755 shared/broadcom/include/bcm963xx/robosw_reg.h create mode 100755 shared/broadcom/include/bcm963xx/xtmprocregs.h create mode 100755 shared/opensource/boardparms/bcm963xx/Makefile create mode 100755 shared/opensource/boardparms/bcm963xx/boardparms.c create mode 100755 shared/opensource/boardparms/bcm963xx/boardparms_voice.c create mode 100755 shared/opensource/flash/Makefile create mode 100755 shared/opensource/flash/cfiflash.c create mode 100755 shared/opensource/flash/flash_api.c create mode 100755 shared/opensource/flash/flash_common.c create mode 100755 shared/opensource/flash/nandflash.c create mode 100755 shared/opensource/flash/spiflash.c create mode 100755 shared/opensource/include/bcm963xx/6328_cpu.h create mode 100755 shared/opensource/include/bcm963xx/6328_intr.h create mode 100755 shared/opensource/include/bcm963xx/6328_map_part.h create mode 100755 shared/opensource/include/bcm963xx/6362_cpu.h create mode 100755 shared/opensource/include/bcm963xx/6362_intr.h create mode 100755 shared/opensource/include/bcm963xx/6362_map_part.h create mode 100755 shared/opensource/include/bcm963xx/6368_cpu.h create mode 100755 shared/opensource/include/bcm963xx/6368_intr.h create mode 100755 shared/opensource/include/bcm963xx/6368_map_part.h create mode 100755 shared/opensource/include/bcm963xx/6816_cpu.h create mode 100755 shared/opensource/include/bcm963xx/6816_intr.h create mode 100755 shared/opensource/include/bcm963xx/6816_map_part.h create mode 100755 shared/opensource/include/bcm963xx/bcmSpi.h create mode 100755 shared/opensource/include/bcm963xx/bcmSpiRes.h create mode 100755 shared/opensource/include/bcm963xx/bcmTag.h create mode 100755 shared/opensource/include/bcm963xx/bcm_hwdefs.h create mode 100755 shared/opensource/include/bcm963xx/bcmnetlink.h create mode 100755 shared/opensource/include/bcm963xx/boardparms.h create mode 100755 shared/opensource/include/bcm963xx/boardparms_voice.h create mode 100644 shared/opensource/include/bcm963xx/fap_mod_size.h create mode 100755 shared/opensource/include/bcm963xx/flash_api.h create mode 100755 shared/opensource/include/bcm963xx/flash_common.h create mode 100755 shared/opensource/include/bcm963xx/gpio_drv.h create mode 100755 shared/opensource/include/bcm963xx/wan_det.h create mode 100755 shared/opensource/include/bcm963xx/wps_led.h create mode 100755 shared/opensource/spi/Makefile create mode 100755 shared/opensource/spi/bcmHsSpi.c create mode 100755 shared/opensource/spi/bcmLegSpi.c create mode 100755 shared/opensource/spi/bcmSpiRes.c create mode 100644 uclibc-crosstools-gcc-4.4.2-1/.fakeroot.00000 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc.so.0 create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libc.so.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt.so.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libdl-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libdl.so.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libm-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libm.so.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libnsl-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libnsl.so.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libpthread-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libpthread.so.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libresolv-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libresolv.so.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/librt-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/librt.so.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libthread_db-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libthread_db.so.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libuClibc-0.9.29.so create mode 100644 uclibc-crosstools-gcc-4.4.2-1/lib/libutil-0.9.29.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/lib/libutil.so.0 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldconfig create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldd create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-addr2line create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ar create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-as create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-c++ create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-c++filt create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-cc create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-cpp create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-g++ create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcc create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcc-4.4.2 create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gccbug create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcov create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gdb create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gprof create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ld create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ldconfig create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ldd create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-nm create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-objcopy create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-objdump create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ranlib create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-readelf create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-size create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-sstrip create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-strings create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-strip create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-addr2line create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ar create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-as create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-c++ create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-c++filt create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-cc create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-cpp create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-g++ create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcc create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcc-4.4.2 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gccbug create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcov create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gdb create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gprof create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ld create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ldconfig create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ldd create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-nm create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-objcopy create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-objdump create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ranlib create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-readelf create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-size create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-sstrip create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-strings create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-strip create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/a.out.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/alloca.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/ar.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/ftp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/inet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/nameser.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/nameser_compat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/telnet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/tftp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/errno-base.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/errno.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/fcntl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/int-l64.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/int-ll64.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/mman.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/poll.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/resource.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/siginfo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/signal.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/statfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/auxvec.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/byteorder.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/cachectl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/errno.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/fcntl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ioctls.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ipcbuf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/mman.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/msgbuf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/param.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/poll.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/posix_types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ptrace.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/resource.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sembuf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/setup.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sgidefs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/shmbuf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sigcontext.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/siginfo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/signal.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/socket.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sockios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/stat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/statfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/swab.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sysmips.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/termbits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/termios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/unistd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/assert.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/atomic.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/atomic.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/byteswap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/cmathcalls.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/confname.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/dirent.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/dlfcn.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/elfclass.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/endian.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/environments.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/errno.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/errno_values.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fcntl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fenv.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fenvinline.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/getopt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_val.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_valf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_vall.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/in.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/inf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/initspin.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ioctl-types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ioctls.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ipc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/kernel_types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/local_lim.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/locale.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathcalls.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathdef.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathinline.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mman.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mqueue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/msq.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/nan.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/netdb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/poll.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix1_lim.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix2_lim.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix_opt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/pthreadtypes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/resource.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sched.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/select.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sem.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/setjmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/shm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigaction.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigcontext.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigcontextinfo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/siginfo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/signum.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigset.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigstack.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigthread.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sockaddr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/socket.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stackinfo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/statfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/statvfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stdio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stdio_lim.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/syscalls.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sysnum.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/termios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/time.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/typesizes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_arch_features.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_clk_tck.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_config.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_ctype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_errno.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_fpmax.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_local_lim.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_locale.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_mutex.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_page.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_pthread.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_stdio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_touplow.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_uwchar.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_va_copy.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ustat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utmpx.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utsname.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/waitflags.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/waitstatus.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/wchar.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/wordsize.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/xopen_lim.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/byteswap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/complex.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/cpio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/crypt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/ctype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/dirent.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/dlfcn.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm_mode.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm_sarea.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/i810_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/i830_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/i915_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/mga_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/r128_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/radeon_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/savage_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/sis_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/via_drm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/elf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/endian.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/err.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/errno.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/error.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/fcntl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/features.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/fnmatch.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/fpu_control.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/getopt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/glob.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/gnu-versions.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/grp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/hp-timing.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/ieee754.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/inttypes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/langinfo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/lastlog.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/libc-internal.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/libc-symbols.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/libgen.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/limits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/link.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/acct.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/adb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/adfs_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/affs_hardblocks.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/agpgart.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/aio_abi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/apm_bios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/arcfb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atalk.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_eni.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_he.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_idt77105.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_nicstar.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_tcp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_zatm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmapi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmarp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmbr2684.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmclip.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmdev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmioc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmlec.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmmpc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmppp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmsap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmsvc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/audit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auto_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auto_fs4.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auxvec.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ax25.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/b1lli.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/baycom.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bfs_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/binfmts.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/blkpg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/blktrace_api.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bpqether.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bsg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/big_endian.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/little_endian.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/bcm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/error.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/raw.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/capability.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/capi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cciss_ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cdk.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cdrom.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cgroupstats.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/chio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cm4000_cs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cn_proc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coda.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coda_psdev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coff.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/comstats.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/connector.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/const.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cramfs_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cuda.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cyclades.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cycx_cfm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dcbnl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dccp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_device.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_netlink.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_plock.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlmconstants.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dm-ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dn.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dqblk_xfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/audio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/ca.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/dmx.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/frontend.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/net.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/osd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/version.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/video.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/edd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/efs_fs_sb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf-em.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf-fdpic.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elfcore.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/errno.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/errqueue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ethtool.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/eventpoll.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ext2_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fadvise.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/falloc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fcntl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fdreg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fib_rules.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fiemap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/filter.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/firewire-cdev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/firewire-constants.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/flat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fuse.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/futex.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gameport.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gen_stats.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/generic_serial.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/genetlink.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gfs2_ondisk.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gigaset_dev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hayesesp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlcdrv.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdreg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hid.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hiddev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hidraw.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hpet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hysdn_if.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2c-dev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2c.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2o-dev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i8k.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/icmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/icmpv6.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_addr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_addrlabel.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_arcnet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_arp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_bonding.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_bridge.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_cablemodem.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ec.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_eql.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ether.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_fc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_fddi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_frad.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_hippi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_infiniband.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_link.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ltalk.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_packet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_phonet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_plip.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ppp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_pppol2tp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_pppox.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_slip.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_strip.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tun.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tunnel.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_vlan.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/igmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in6.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in_route.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/inet_diag.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/inotify.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/input.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip6_tunnel.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip_vs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipmi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipmi_msgdefs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipsec.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipv6.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipv6_route.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipx.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/irda.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/irqnr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/capicmd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn_divertif.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn_ppp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdnif.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/iso_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ivtv.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ivtvfb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ixjuser.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/jffs2.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/joystick.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kdev_t.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kernel.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kernelcapi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/keyboard.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/keyctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/limits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/llc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/loop.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/lp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/magic.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/major.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/map_to_7segment.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/matroxfb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mempolicy.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/meye.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mii.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/minix_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mman.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mmtimer.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mqueue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mroute.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mroute6.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/msdos_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/msg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mtio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/n_r3964.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nbd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_mount.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_no.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/neighbour.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/net.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/net_dropmon.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netdevice.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_common.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_ftp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_sctp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_tcp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_tuple_common.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_compat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_conntrack.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_log.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_queue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/x_tables.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CLASSIFY.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CONNMARK.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CONNSECMARK.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_DSCP.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_LED.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_MARK.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_NFLOG.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_NFQUEUE.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_RATEEST.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_SECMARK.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TCPMSS.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TPROXY.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_cluster.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_comment.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connbytes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connlimit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connmark.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_conntrack.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_dccp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_dscp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_esp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_hashlimit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_helper.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_iprange.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_length.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_limit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_mac.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_mark.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_multiport.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_owner.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_physdev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_pkttype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_policy.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_quota.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_rateest.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_realm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_recent.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_sctp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_state.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_statistic.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_string.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_tcpmss.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_tcpudp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_time.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_u32.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/arp_tables.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/arpt_mangle.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_802_3.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_among.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_arp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_arpreply.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_ip.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_limit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_log.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_mark_m.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_mark_t.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_nat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_pkttype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_redirect.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_stp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_ulog.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_vlan.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebtables.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_decnet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ip_queue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ip_tables.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CONNMARK.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_DSCP.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ECN.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_LOG.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_MARK.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_REJECT.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_SAME.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TOS.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TTL.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ULOG.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_addrtype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ah.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_comment.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_connbytes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_connmark.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_conntrack.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_dccp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_dscp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ecn.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_esp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_helper.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_iprange.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_length.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_limit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_mac.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_mark.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_multiport.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_owner.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_physdev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_pkttype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_policy.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_realm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_recent.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_sctp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_state.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_string.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_tcpmss.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_tos.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ttl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6_tables.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_HL.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_LOG.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_MARK.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_ah.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_esp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_frag.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_hl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_length.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_limit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mac.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mark.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mh.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_multiport.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_opts.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_owner.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_physdev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_policy.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_rt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netlink.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netrom.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs2.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs3.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs4.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs4_mount.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_idmap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_mount.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsacl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/const.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/debug.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/export.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/nfsfh.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/stats.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/syscall.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nl80211.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nubus.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nvram.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/oom.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/param.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/parport.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/patchkey.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pci.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pci_regs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/personality.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pfkeyv2.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/phantom.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/phonet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pkt_cls.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pkt_sched.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pktcdvd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pmu.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/poll.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/posix_types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppdev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppp-comp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppp_defs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/prctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ptrace.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/qnx4_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/qnxtypes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/quota.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/radeonfb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/md_p.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/md_u.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/random.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raw.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reboot.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reiserfs_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reiserfs_xattr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/resource.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/romfs_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rose.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/route.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rtc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rtnetlink.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/scc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sched.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/screen_info.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sdla.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/selinux_netlink.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sem.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial_core.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial_reg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/shm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/signal.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/signalfd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb_mount.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smbno.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/snmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/socket.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sockios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/som.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sonet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sonypi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sound.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/soundcard.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/spidev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/stat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/stddef.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/string.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/debug.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/suspend_ioctls.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/swab.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/synclink.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sysctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/taskstats.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_gact.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_ipt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_mirred.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_nat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_pedit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_skbedit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_cmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_meta.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_nbyte.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_text.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tcp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/telephony.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/termios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/time.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/times.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/timex.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tiocl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tipc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tipc_config.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/toshiba.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tty.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/udf_fs_i.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/udp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/uinput.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/uio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ultrasound.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/un.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/unistd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/audio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/cdc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/ch9.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/g_printer.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/gadgetfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/midi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/tmc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/vstusb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usbdevice_fs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/utime.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/utsname.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/version.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/veth.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videodev.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videodev2.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videotext.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_9p.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_balloon.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_blk.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_config.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_console.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_net.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_pci.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_ring.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_rng.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/vt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wait.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wanrouter.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/watchdog.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/i2400m.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wireless.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/x25.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/xattr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/xfrm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/locale.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/malloc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/math.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/memory.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mntent.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mqueue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/inftl-user.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/jffs2-user.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/mtd-abi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/mtd-user.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/nftl-user.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/ubi-user.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ethernet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_arp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_packet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_ppp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_shaper.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_slip.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ppp-comp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ppp_defs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/net/route.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netax25/ax25.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netdb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/neteconet/ec.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ether.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/icmp6.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_ether.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_fddi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_tr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/igmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/in.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/in_systm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip6.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_fw.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_icmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_tcp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_udp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/protocols.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/tcp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/udp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netipx/ipx.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/netpacket/packet.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/nl_types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/obstack.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/paths.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/poll.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/routed.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/rwhod.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/talkd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/timed.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/pthread.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/pty.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/pwd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/ib_user_mad.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/regex.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/regexp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/resolv.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth_des.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth_unix.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/clnt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/des_crypt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/key_prot.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/netdb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_clnt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_prot.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_rmt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc_des.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc_msg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/svc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/svc_auth.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/xdr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sched.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/scsi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/scsi_ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/sg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/search.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/semaphore.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/setjmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sgidefs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sgtty.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/shadow.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/signal.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asequencer.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asound.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asound_fm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/emu10k1.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/hdsp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/hdspm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sb16_csp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sfnt_info.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sscape_ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/stdint.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio_ext.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/stdlib.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/string.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/strings.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/acct.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/asm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/bitypes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/cachectl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/cdefs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/dir.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/epoll.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/errno.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fcntl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/file.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fpregdef.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fsuid.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/inotify.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ioctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ipc.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kdaemon.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/klog.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mman.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mount.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/msg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mtio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/param.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/personality.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/poll.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/prctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/procfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ptrace.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/queue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/quota.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/reboot.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/regdef.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/resource.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/select.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sem.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sendfile.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/shm.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/signal.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/socket.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/socketvar.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/soundcard.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/stat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/statfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/statvfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/swap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/syscall.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysctl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysinfo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/syslog.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysmacros.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysmips.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/tas.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/termios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/time.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/timeb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/times.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/timex.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ttydefaults.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ucontext.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/uio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/un.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/unistd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/user.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ustat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/utsname.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vfs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/wait.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/xattr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/syscall.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/sysexits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/syslog.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/tar.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/termio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/termios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/tgmath.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/thread_db.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/time.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/ttyent.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/ucontext.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/ulimit.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/unistd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/ustat.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/utime.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/utmp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/values.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/video/..install.cmd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/video/.install create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/video/edid.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/video/sisfb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/video/uvesafb.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/wait.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/wchar.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/include/wctype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/info/cpp.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/info/cppinternals.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/info/dir create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/info/gcc.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/info/gccinstall.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/info/gccint.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/info/libgomp.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/Scrt1.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/crt1.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/crti.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/crtn.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/crtbegin.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/crtbeginS.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/crtbeginT.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/crtend.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/crtendS.o create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include-fixed/README create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include-fixed/features.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include-fixed/limits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include-fixed/obstack.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include-fixed/syslimits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/float.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/iso646.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/loongson.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/mf-runtime.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/omp.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/stdarg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/stdbool.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/stddef.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/stdfix.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/unwind.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/include/varargs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/install-tools/fixinc_list create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/install-tools/gsyslimits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/install-tools/include/README create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/install-tools/include/limits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/install-tools/macro_list create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/install-tools/mkheaders.conf create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/libgcc.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/libgcc_eh.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/gcc/mips-linux-uclibc/4.4.2/libgcov.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.x create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xbn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xdc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xdw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xr create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xs create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xsc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xsw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xu create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmip.xw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.x create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xbn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xdc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xdw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xr create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xs create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xsc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xsw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xu create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32btsmipn32.xw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.x create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xbn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xdc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xdw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xr create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xs create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xsc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xsw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xu create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmip.xw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.x create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xbn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xdc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xdw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xr create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xs create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xsc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xsw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xu create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf32ltsmipn32.xw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.x create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xbn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xdc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xdw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xr create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xs create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xsc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xsw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xu create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64btsmip.xw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.x create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xbn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xdc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xdw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xn create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xr create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xs create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xsc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xsw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xu create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/ldscripts/elf64ltsmip.xw create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libc.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libc.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libc_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libcrypt.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libcrypt.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libcrypt_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libdl.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libdl.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libdl_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libiberty.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libm.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libm.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libm_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libnsl.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libnsl.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libnsl_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libpthread.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libpthread.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libpthread_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libresolv.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libresolv.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libresolv_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/librt.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/librt.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/librt_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libthread_db.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libthread_db.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libthread_db_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libutil.a create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libutil.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/lib/libutil_pic.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/lib/uclibc_nonshared.a create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/libexec/gcc/mips-linux-uclibc/4.4.2/cc1 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/libexec/gcc/mips-linux-uclibc/4.4.2/cc1plus create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/libexec/gcc/mips-linux-uclibc/4.4.2/collect2 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/libexec/gcc/mips-linux-uclibc/4.4.2/install-tools/fixinc.sh create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/libexec/gcc/mips-linux-uclibc/4.4.2/install-tools/fixincl create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/libexec/gcc/mips-linux-uclibc/4.4.2/install-tools/mkheaders create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/libexec/gcc/mips-linux-uclibc/4.4.2/install-tools/mkinstalldirs create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/man/man1/mips-linux-uclibc-cpp.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/man/man1/mips-linux-uclibc-g++.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/man/man1/mips-linux-uclibc-gcc.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/man/man1/mips-linux-uclibc-gcov.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/man/man7/fsf-funding.7 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/man/man7/gfdl.7 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/man/man7/gpl.7 create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/ar create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/as create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/c++ create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/cc create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/g++ create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/gcc create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/gdb create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/ld create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/nm create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/objcopy create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/objdump create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/ranlib create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/sstrip create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin/strip create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/algorithm create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/array create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/backward/auto_ptr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/backward/backward_warning.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/backward/binders.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/backward/hash_fun.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/backward/hash_map create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/backward/hash_set create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/backward/hashtable.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/backward/strstream create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/algorithmfwd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/atomic_0.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/atomic_2.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/atomicfwd_c.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/atomicfwd_cxx.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/basic_ios.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/basic_ios.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/basic_string.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/basic_string.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/boost_concept_check.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/char_traits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/cmath.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/codecvt.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/concept_check.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/cpp_type_traits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/deque.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/forward_list.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/forward_list.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/fstream.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/functexcept.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/functional_hash.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/gslice.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/gslice_array.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/hashtable.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/indirect_array.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/ios_base.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/istream.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/list.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/locale_classes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/locale_classes.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/locale_facets.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/locale_facets.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/locale_facets_nonio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/locale_facets_nonio.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/localefwd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/mask_array.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/move.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/ostream.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/ostream_insert.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/postypes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/shared_ptr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/slice_array.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/sstream.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_algo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_algobase.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_bvector.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_construct.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_deque.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_function.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_heap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_iterator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_iterator_base_funcs.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_iterator_base_types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_list.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_map.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_multimap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_multiset.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_numeric.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_pair.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_queue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_raw_storage_iter.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_relops.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_set.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_stack.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_tempbuf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_tree.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_uninitialized.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stl_vector.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stream_iterator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/streambuf.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/streambuf_iterator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/stringfwd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/unique_ptr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/valarray_after.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/valarray_array.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/valarray_array.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/valarray_before.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bits/vector.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/bitset create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/c++0x_warning.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cassert create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ccomplex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cctype create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cerrno create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cfenv create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cfloat create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/chrono create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cinttypes create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ciso646 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/climits create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/clocale create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cmath create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/complex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/complex.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/condition_variable create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/csetjmp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/csignal create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cstdarg create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cstdatomic create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cstdbool create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cstddef create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cstdint create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cstdio create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cstdlib create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cstring create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ctgmath create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ctime create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cwchar create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cwctype create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cxxabi-forced.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/cxxabi.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/bitset create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/debug.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/deque create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/formatter.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/functions.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/list create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/macros.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/map create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/map.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/multimap.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/multiset.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/safe_base.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/safe_iterator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/safe_iterator.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/safe_sequence.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/set create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/set.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/string create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/unordered_map create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/unordered_set create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/debug/vector create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/deque create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/exception create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/exception_defines.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/exception_ptr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/algorithm create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/array_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/atomicity.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/bitmap_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/cast.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/codecvt_specializations.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/concurrence.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/debug_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/enc_filebuf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/extptr_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/functional create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/hash_map create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/hash_set create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/iterator create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/malloc_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/memory create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/mt_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/new_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/numeric create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/numeric_traits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/assoc_container.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/basic_tree_policy/traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/basic_types.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/bin_search_tree_/traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/const_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/entry_pred.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/resize_policy.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/cond_dealtor.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/container_base_dispatch.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/debug_map_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/eq_fn/eq_by_less.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/lu_map_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/ov_tree_map_/traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/child_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/head.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/internal_node.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/leaf.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/node_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/node_iterators.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/point_iterators.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/priority_queue_base_dispatch.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/node.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rb_tree_map_/traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/node.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/splay_tree_/traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/standard_policies.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/tree_trace_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/type_utils.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/types_traits.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/unordered_iterator/iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/exception.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/hash_policy.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/list_update_policy.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/priority_queue.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/tag_and_trait.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/tree_policy.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pb_ds/trie_policy.hpp create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pod_char_traits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pointer.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/pool_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/rb_tree create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/rc_string_base.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/rope create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/ropeimpl.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/slist create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/sso_string_base.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/stdio_filebuf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/stdio_sync_filebuf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/string_conversions.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/throw_allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/type_traits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/typelist.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/vstring.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/vstring.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/vstring_fwd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ext/vstring_util.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/fenv.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/forward_list create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/fstream create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/functional create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/initializer_list create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/iomanip create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ios create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/iosfwd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/iostream create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/istream create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/iterator create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/limits create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/list create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/locale create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/map create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/memory create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/atomic_word.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/basic_file.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/c++allocator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/c++config.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/c++io.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/c++locale.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/cpu_defines.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/ctype_base.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/ctype_inline.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/ctype_noninline.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/cxxabi_tweaks.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/error_constants.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/extc++.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/gthr-default.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/gthr-posix.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/gthr-single.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/gthr-tpf.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/gthr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/messages_members.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/os_defines.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/stdc++.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/stdtr1c++.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mips-linux-uclibc/bits/time_members.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/mutex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/new create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/numeric create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ostream create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/algo.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/algobase.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/algorithm create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/algorithmfwd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/balanced_quicksort.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/base.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/basic_iterator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/checkers.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/compatibility.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/compiletime_settings.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/equally_split.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/features.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/find.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/find_selectors.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/for_each.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/for_each_selectors.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/iterator.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/list_partition.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/losertree.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/merge.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/multiseq_selection.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/multiway_merge.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/multiway_mergesort.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/numeric create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/numericfwd.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/omp_loop.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/omp_loop_static.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/par_loop.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/parallel.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/partial_sum.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/partition.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/queue.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/quicksort.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/random_number.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/random_shuffle.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/search.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/set_operations.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/settings.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/sort.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/tags.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/types.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/unique_copy.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/parallel/workstealing.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/queue create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/random create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/ratio create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/regex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/set create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/sstream create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/stack create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/stdatomic.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/stdexcept create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/streambuf create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/string create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/system_error create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tgmath.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/thread create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/array create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/bessel_function.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/beta_function.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/ccomplex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cctype create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cfenv create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cfloat create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cinttypes create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/climits create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cmath create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/complex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/complex.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cstdarg create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cstdbool create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cstdint create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cstdio create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cstdlib create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/ctgmath create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/ctime create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/ctype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cwchar create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/cwctype create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/ell_integral.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/exp_integral.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/fenv.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/float.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/functional create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/functional_hash.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/gamma.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/hashtable.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/hypergeometric.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/inttypes.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/legendre_function.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/limits.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/math.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/memory create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/modified_bessel_func.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/poly_hermite.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/poly_laguerre.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/random create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/regex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/riemann_zeta.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/shared_ptr.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/special_function_util.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/stdarg.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/stdbool.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/stdint.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/stdio.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/stdlib.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/tgmath.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/tuple create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/type_traits create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/unordered_map create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/unordered_set create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/utility create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/wchar.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1/wctype.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/array create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/boost_sp_counted_base.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cctype create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cfenv create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cinttypes create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cmath create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/complex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cstdint create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cstdio create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cstdlib create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cwchar create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/cwctype create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/functional create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/functional_hash.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/hashtable create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/hashtable_policy.h create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/random create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/random.tcc create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/regex create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/type_traits create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/unordered_map create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/unordered_set create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tr1_impl/utility create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/tuple create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/type_traits create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/typeinfo create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/unordered_map create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/unordered_set create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/utility create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/valarray create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/include/c++/4.4.2/vector create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libgcc_s.so create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libgcc_s.so.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libgomp.a create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libgomp.la create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libgomp.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libgomp.so.1 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libgomp.so.1.0.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libgomp.spec create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libiberty.a create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflap.a create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflap.la create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflap.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflap.so.0 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflap.so.0.0.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflapth.a create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflapth.la create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflapth.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflapth.so.0 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libmudflapth.so.0.0.0 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libstdc++.a create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libstdc++.la create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libstdc++.so create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libstdc++.so.6 create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libstdc++.so.6.0.13 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libsupc++.a create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/lib/libsupc++.la create mode 120000 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/sys-include create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/target_utils/gdbserver create mode 100755 uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/target_utils/ldd create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/info/as.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/info/bfd.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/info/binutils.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/info/configure.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/info/dir create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/info/gprof.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/info/ld.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/info/standards.info create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-addr2line.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-ar.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-as.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-c++filt.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-dlltool.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-gprof.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-ld.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-nlmconv.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-nm.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-objcopy.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-objdump.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-ranlib.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-readelf.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-size.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-strings.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-strip.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-windmc.1 create mode 100644 uclibc-crosstools-gcc-4.4.2-1/usr/share/man/man1/mips-linux-uclibc-windres.1 diff --git a/buildcfe.sh b/buildcfe.sh new file mode 100755 index 0000000..654718b --- /dev/null +++ b/buildcfe.sh @@ -0,0 +1,21 @@ +#!/bin/bash +currdir=`pwd` + +#CLEAN +rm cfe* +cd cfe/build/broadcom/bcm63xx_rom +make clean + + +#BUILD +#USAGE: make BRCM_CHIP=[6328|6362|6368|6816] BLD_NAND=1 +#BLD_NAND=1 <--- build with NAND flash support + +make BRCM_CHIP=6328 +#make BRCM_CHIP=6328 BLD_NAND=1 + +cp cfe6328.bin $currdir +cp ../bcm63xx_ram/cfe6328 $currdir/cfe6328_ram + + +echo DONE diff --git a/cfe/build/broadcom/bcm63xx_ram/Makefile b/cfe/build/broadcom/bcm63xx_ram/Makefile new file mode 100755 index 0000000..970da8f --- /dev/null +++ b/cfe/build/broadcom/bcm63xx_ram/Makefile @@ -0,0 +1,76 @@ + +CFG_MLONG64 ?= 0 +CFG_LITTLE ?= 0 # Mindbender +CFG_RELOC ?= 0 +CFG_UNCACHED ?= 0 # Mindbender +CFG_NEWRELOC ?= 0 +CFG_VAPI ?= 0 +CFG_BOOTRAM ?= 0 +CFG_RAMAPP ?= 1 +CFG_BOARDNAME = "BCM9$(BRCM_CHIP)" +CFG_PCI = 0 +CFG_ZLIB = 0 # enable zlib + +COMPRESS ?= cmplzma + +TOP = ../../../cfe +ARCH = mips +CPU = bcmcore +BOARD = bcm63xx_ram + +HOSTTOOLS = ../../../../hostTools +SHARED_DIR = ../../../../shared +BOARDPARMS_DIR = $(SHARED_DIR)/opensource/boardparms/bcm963xx +FLASH_DIR = $(SHARED_DIR)/opensource/flash +BCMSPI_DIR = $(SHARED_DIR)/opensource/spi +INC_SHARED_PUB_PATH = $(SHARED_DIR)/opensource/include/bcm963xx +INC_SHARED_PRIV_PATH = $(SHARED_DIR)/broadcom/include/bcm963xx +ROM_BUILD = ../bcm63xx_rom +ASM_FILE =$(ROM_BUILD)/flashimg.S + +ifeq ($(strip $(CFG_SBP)),1) + CFLAGS += -DUSE_SINGLE_BOARD_PARAM +endif + +include $(TOP)/arch/mips/board/$(BOARD)/src/ram_cfe.mk + +VPATH += ${ARCH_TOP}/board/$(BOARD)/src/html ${BOARDPARMS_DIR} $(BCMSPI_DIR) ${FLASH_DIR} +INCDIRS += -I${INC_SHARED_PUB_PATH} -I${INC_SHARED_PRIV_PATH} + +$(HOSTTOOLS)/$(COMPRESS): + $(MAKE) -C $(HOSTTOOLS) build_cmplzma + +ALL: sanity_check $(HOSTTOOLS)/$(COMPRESS) + find $(SHARED_DIR) -name "*.o" -exec rm -f "{}" ";" + find $(BOARDPARMS_DIR) -name "*.o" -exec rm -f "{}" ";" + ${MAKE} cfe$(BRCM_CHIP) + $(HOSTTOOLS)/$(COMPRESS) -s -c -2 cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin $(ASM_FILE) + +sanity_check: + @if [ "$(BRCM_CHIP)" = "" ]; then \ + echo You must specify chip ID using 'gmake BRCM_CHIP=[6328|6362|6368|6816]'; exit 1; \ + fi + +$(ASM_FILE): cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin + +cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin: $(CRT0OBJS) $(BSPOBJS) $(LIBCFE) + $(GLD) -o cfe$(BRCM_CHIP) -Map cfe$(BRCM_CHIP).map $(LDFLAGS) $(CRT0OBJS) $(BSPOBJS) -L. -lcfe $(LDLIBS) + $(OBJDUMP) -d cfe$(BRCM_CHIP) > cfe$(BRCM_CHIP).dis + $(OBJCOPY) --output-target=binary cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin +ifeq ($(strip $(INC_NAND_FLASH_DRIVER)),1) + printf "0: %08x%08x%08x" `$(OBJDUMP) -x cfe$(BRCM_CHIP) | sed -n -e "/start address/{s?start address ??p}" -e "/LOAD off/{s?^ *LOAD off.*vaddr ??; s? paddr .*??p}" -e "/ _end/{s? g.* _end??; s?^...?0x000?p}"` | xxd -r > cferamhdr.bin; \ + cat cferamhdr.bin cfe$(BRCM_CHIP).bin > cfe$(BRCM_CHIP)ram.bin; \ + rm cferamhdr.bin +endif + +clean : + rm -f *.o *~ cfe* + rm -f build_date.c + rm -f libcfe.a + rm -f $(ASM_FILE) + +distclean : clean + + + + diff --git a/cfe/build/broadcom/bcm63xx_rom/Makefile b/cfe/build/broadcom/bcm63xx_rom/Makefile new file mode 100755 index 0000000..819cb21 --- /dev/null +++ b/cfe/build/broadcom/bcm63xx_rom/Makefile @@ -0,0 +1,160 @@ + +CFG_MLONG64 ?= 0 +CFG_LITTLE ?= 0 # Mindbender +CFG_RELOC ?= 0 +CFG_UNCACHED ?= 0 # Mindbender +CFG_NEWRELOC ?= 0 +CFG_VAPI ?= 0 +CFG_BOOTRAM ?= 0 +CFG_RAMAPP ?= 0 # EPI +CFG_BOARDNAME = "BCM9$(BRCM_CHIP)" +CFG_PCI ?= 0 +CFG_ZLIB ?= 0 # enable zlib +CFG_SBP ?= 0 # use Single Board Parameter if defined to 1 + +TOP = ../../../cfe +ARCH = mips +CPU = bcmcore +BOARD = bcm63xx_rom + +LINUX_KERNEL_DIR=../../../../kernel/linux +HOSTTOOLS = ../../../../hostTools +TARGETS_DIR = ../../../../targets +SHARED_DIR = ../../../../shared +INC_SHARED_PUB_PATH = $(SHARED_DIR)/opensource/include/bcm963xx +INC_SHARED_PRIV_PATH = $(SHARED_DIR)/broadcom/include/bcm963xx +FLASH_DIR = $(SHARED_DIR)/opensource/flash +BCMSPI_DIR = $(SHARED_DIR)/opensource/spi + +BOOT_DIR = ${ARCH_TOP}/board/$(BOARD)/src +ASM_FILE = flashimg.S +RAM_BUILD = ../bcm63xx_ram + +TOOLS=../../../../uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux- + +include $(TOP)/arch/mips/board/$(BOARD)/src/rom_cfe.mk + +VPATH += ${FLASH_DIR} $(BCMSPI_DIR) +INCDIRS += -I${ARCH_TOP}/board/bcm63xx_ram/include -I${INC_SHARED_PUB_PATH} -I${INC_SHARED_PRIV_PATH} + +BSPOBJS_ROM := $(BSPOBJS) +ifneq ($(strip $(BRCM_IKOS)),y) +BSPOBJS += flashimg.o $(LZMAOBJS) +endif + +export INC_CFI_FLASH_DRIVER INC_SPI_FLASH_DRIVER INC_NAND_FLASH_DRIVER INC_SPI_PROG_NAND + +ALL : sanity_check cfe$(BRCM_CHIP) +ifneq ($(strip $(INC_NAND_FLASH_DRIVER)),1) + gcc -o ${HOSTTOOLS}/addvtoken -I ${INC_SHARED_PUB_PATH} ${HOSTTOOLS}/addvtoken.c + @if [ $(shell find . -name cfe$(BRCM_CHIP).bin -printf '%s\n') -le 65536 ] ; then \ + ${HOSTTOOLS}/addvtoken cfe$(BRCM_CHIP).bin bcm9$(BRCM_CHIP)_cfe.w; \ + else \ + find . -name cfe$(BRCM_CHIP).bin -printf '\nERROR: cfe.bin size, %s, is greater than 65536 maximum size.\n'; \ + rm cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin; \ + fi +endif + @echo done + +untar_check: + @if [ ! -e $(TOP)/api ]; then \ + echo Untarring original CFE source...; \ + (cd ../../.. && tar xfzk cfe*.tar.gz 2> /dev/null || true); \ + fi + +sanity_check: + @if [ "$(BRCM_CHIP)" = "" ]; then \ + echo You must specify chip ID using 'make BRCM_CHIP=[6328|6362|6368|6816]'; exit 1; \ + fi + @if [ ! -e $(TOP)/api ]; then \ + echo Untarring original CFE source...; \ + (cd ../../.. && tar xfzk cfe*.tar.gz 2> /dev/null || true); \ + $(MAKE) BRCM_CHIP=$(BRCM_CHIP) BLD_NAND=$(BLD_NAND); \ + fi + +mksbp: ALL + @echo done + +sbp: + ${MAKE} clean + ${MAKE} CFG_SBP?=1 mksbp + +ifeq ($(strip $(INC_NAND_FLASH_DRIVER)),1) +# Build NAND flash boot loader +cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin : $(CRT0OBJS) $(BSPOBJS_ROM) $(LIBCFE) noflashimg + $(MAKE) -C $(RAM_BUILD) + $(GLD) -o cfe$(BRCM_CHIP)rom -Map cfe$(BRCM_CHIP)rom.map $(LDFLAGS) $(CRT0OBJS) $(BSPOBJS_ROM) noflashimg.o -L. -lcfe $(LDLIBS) + $(OBJCOPY) --output-target=binary cfe$(BRCM_CHIP)rom cfe$(BRCM_CHIP)rom.bin + rm noflashimg.* + +noflashimg: + echo "char *_binArrayStart = (char *) 0, *_binArrayEnd = (char *) 0;" > $@.c; \ + echo "int decompressLZMA(unsigned char *s, unsigned int sl, unsigned char *d, unsigned int dl);" >> $@.c; \ + echo "int decompressLZMA(unsigned char *s, unsigned int sl, unsigned char *d, unsigned int dl){return 0;}" >> $@.c + $(GCC) $(CFLAGS) -o $@.o $@.c + +else +# Build NOR flash boot loader +cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin : $(CRT0OBJS) $(BSPOBJS) $(LIBCFE) $(ASM_FILE) + $(GLD) -o cfe$(BRCM_CHIP) -Map cfe$(BRCM_CHIP).map $(LDFLAGS) $(CRT0OBJS) $(BSPOBJS) -L. -lcfe $(LDLIBS) + $(OBJDUMP) -d cfe$(BRCM_CHIP) > cfe$(BRCM_CHIP).dis + $(OBJCOPY) --output-target=binary cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin + +$(ASM_FILE) : $(TOP)/arch/mips/board/bcm63xx_ram/src + rm -f $(ASM_FILE) + $(MAKE) -C $(RAM_BUILD) +endif + + +clean : untar_check + rm -f *.o *~ cfe* *.w *.srec + rm -f build_date.c + rm -f noflashimg.c >& /dev/null + rm -f libcfe.a + $(MAKE) -C $(RAM_BUILD) clean + +distclean : clean + +release : untar_check + $(MAKE) clean + $(MAKE) BRCM_CHIP=6328 + cp -f cfe*.bin $(TARGETS_DIR)/cfe + $(MAKE) clean + $(MAKE) BRCM_CHIP=6328 BLD_NAND=1 + cp -f cfe*.bin $(TARGETS_DIR)/cfe + cp -f $(RAM_BUILD)/cfe*ram.bin $(TARGETS_DIR)/cfe + $(MAKE) clean + $(MAKE) BRCM_CHIP=6362 + cp -f cfe*.bin $(TARGETS_DIR)/cfe + $(MAKE) clean + $(MAKE) BRCM_CHIP=6362 BLD_NAND=1 + cp -f cfe*.bin $(TARGETS_DIR)/cfe + cp -f $(RAM_BUILD)/cfe*ram.bin $(TARGETS_DIR)/cfe + $(MAKE) clean + $(MAKE) BRCM_CHIP=6368 + cp -f cfe*.bin $(TARGETS_DIR)/cfe + $(MAKE) clean + $(MAKE) BRCM_CHIP=6368 BLD_NAND=1 + cp -f cfe*.bin $(TARGETS_DIR)/cfe + cp -f $(RAM_BUILD)/cfe*ram.bin $(TARGETS_DIR)/cfe + $(MAKE) clean + $(MAKE) BRCM_CHIP=6816 + cp -f cfe*.bin $(TARGETS_DIR)/cfe + $(MAKE) clean + $(MAKE) BRCM_CHIP=6816 BLD_NAND=1 + cp -f cfe*.bin $(TARGETS_DIR)/cfe + cp -f $(RAM_BUILD)/cfe*ram.bin $(TARGETS_DIR)/cfe + $(MAKE) clean + +CFE_RAM_START_ADDR := $(OBJDUMP) -f $(RAM_BUILD)/cfe$(BRCM_CHIP) | grep start | cut -d'x' -f2 +VMLINUX_START_ADDR := $(OBJDUMP) -f $(LINUX_KERNEL_DIR)/vmlinux | grep start | cut -d'x' -f2 + +# Must be called from base Linux build directory. +ikos_finish: + @xxd -g4 cfe$(BRCM_CHIP) | sed -e "s/694b6f31/$(shell $(CFE_RAM_START_ADDR))/" | xxd -r > cfe$(BRCM_CHIP).tmp + @mv cfe$(BRCM_CHIP).tmp cfe$(BRCM_CHIP) + @xxd -g4 $(RAM_BUILD)/cfe$(BRCM_CHIP) | sed -e "s/694b6f32/$(shell $(VMLINUX_START_ADDR))/" | xxd -r > $(RAM_BUILD)/cfe$(BRCM_CHIP).tmp + @mv $(RAM_BUILD)/cfe$(BRCM_CHIP).tmp $(RAM_BUILD)/cfe$(BRCM_CHIP) + $(OBJCOPY) --output-target=binary cfe$(BRCM_CHIP) cfe$(BRCM_CHIP).bin + $(OBJCOPY) --output-target=srec $(RAM_BUILD)/cfe$(BRCM_CHIP) cferam$(BRCM_CHIP).srec + diff --git a/cfe/cfe/api/Makefile b/cfe/cfe/api/Makefile new file mode 100644 index 0000000..9f2eb7c --- /dev/null +++ b/cfe/cfe/api/Makefile @@ -0,0 +1,47 @@ +TOOLS_PREFIX = sb1-elf- +CPPFLAGS = -I../include +CFLAGS = -O2 -fomit-frame-pointer \ + -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror + +CC = $(TOOLS_PREFIX)gcc +AR = $(TOOLS_PREFIX)ar + +all: cfe_api.a cfe_api.o + +API_OBJS = \ + api_close.o \ + api_common.o \ + api_cpu_start.o \ + api_cpu_stop.o \ + api_enumenv.o \ + api_enummem.o \ + api_exit.o \ + api_flushcache.o \ + api_getdevinfo.o \ + api_getenv.o \ + api_getfwinfo.o \ + api_getstdhandle.o \ + api_getticks.o \ + api_inpstat.o \ + api_ioctl.o \ + api_open.o \ + api_read.o \ + api_readblk.o \ + api_setenv.o \ + api_strlen.o \ + api_write.o \ + api_writeblk.o + +cfe_api.a: $(API_OBJS) + $(AR) cru cfe_api.a $? + +$(API_OBJS): api_%.o: cfe_api.c Makefile cfe_api.h cfe_api_int.h + $(CC) -c -o $@ -DCFE_API_$* $(CPPFLAGS) $(CFLAGS) $< + +cfe_api.o: cfe_api.c Makefile cfe_api.h cfe_api_int.h + $(CC) -c -o $@ -DCFE_API_ALL $(CPPFLAGS) $(CFLAGS) $< + +.PHONY: clean + +clean: + rm -f *.o *.a *~ diff --git a/cfe/cfe/api/cfe_api.c b/cfe/cfe/api/cfe_api.c new file mode 100644 index 0000000..70cb3d2 --- /dev/null +++ b/cfe/cfe/api/cfe_api.c @@ -0,0 +1,534 @@ +/* $Id: cfe_api.c,v 1.17 2003/02/07 17:27:56 cgd Exp $ */ + +/* + * Copyright 2000, 2001, 2002 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and copied only + * in accordance with the following terms and conditions. Subject to these + * conditions, you may download, copy, install, use, modify and distribute + * modified or unmodified copies of this software in source and/or binary + * form. No title or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce and + * retain this copyright notice and list of conditions as they appear in + * the source file. + * + * 2) No right is granted to use any trade name, trademark, or logo of + * Broadcom Corporation. The "Broadcom Corporation" name may not be + * used to endorse or promote products derived from this software + * without the prior written permission of Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE + * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE + * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* ********************************************************************* + * + * Broadcom Common Firmware Environment (CFE) + * + * Device Function stubs File: cfe_api.c + * + * This module contains device function stubs (small routines to + * call the standard "iocb" interface entry point to CFE). + * There should be one routine here per iocb function call. + * + * Authors: Mitch Lichtenberg, Chris Demetriou + * + ********************************************************************* */ + +#include "cfe_api.h" +#include "cfe_api_int.h" + +/* Cast from a native pointer to a cfe_xptr_t and back. */ +#define XPTR_FROM_NATIVE(n) ((cfe_xptr_t) (intptr_t) (n)) +#define NATIVE_FROM_XPTR(x) ((void *) (intptr_t) (x)) + +#ifdef CFE_API_IMPL_NAMESPACE +#define cfe_iocb_dispatch(a) __cfe_iocb_dispatch(a) +#endif +int cfe_iocb_dispatch(cfe_xiocb_t *xiocb); + +#if defined(CFE_API_common) || defined(CFE_API_ALL) +/* + * Declare the dispatch function with args of "intptr_t". + * This makes sure whatever model we're compiling in + * puts the pointers in a single register. For example, + * combining -mlong64 and -mips1 or -mips2 would lead to + * trouble, since the handle and IOCB pointer will be + * passed in two registers each, and CFE expects one. + */ + +static int (*cfe_dispfunc)(intptr_t handle, intptr_t xiocb) = 0; +static cfe_xuint_t cfe_handle = 0; + +int +cfe_init(cfe_xuint_t handle, cfe_xuint_t ept) +{ + cfe_dispfunc = NATIVE_FROM_XPTR(ept); + cfe_handle = handle; + return 0; +} + +int +cfe_iocb_dispatch(cfe_xiocb_t *xiocb) +{ + if (!cfe_dispfunc) return -1; + return (*cfe_dispfunc)((intptr_t)cfe_handle, (intptr_t)xiocb); +} +#endif /* CFE_API_common || CFE_API_ALL */ + +#if defined(CFE_API_close) || defined(CFE_API_ALL) +int +cfe_close(int handle) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_CLOSE; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = handle; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = 0; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; + +} +#endif /* CFE_API_close || CFE_API_ALL */ + +#if defined(CFE_API_cpu_start) || defined(CFE_API_ALL) +int +cfe_cpu_start(int cpu, void (*fn)(void), long sp, long gp, long a1) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_cpuctl_t); + xiocb.plist.xiocb_cpuctl.cpu_number = cpu; + xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_START; + xiocb.plist.xiocb_cpuctl.gp_val = gp; + xiocb.plist.xiocb_cpuctl.sp_val = sp; + xiocb.plist.xiocb_cpuctl.a1_val = a1; + xiocb.plist.xiocb_cpuctl.start_addr = (long)fn; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; +} +#endif /* CFE_API_cpu_start || CFE_API_ALL */ + +#if defined(CFE_API_cpu_stop) || defined(CFE_API_ALL) +int +cfe_cpu_stop(int cpu) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_cpuctl_t); + xiocb.plist.xiocb_cpuctl.cpu_number = cpu; + xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_STOP; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; +} +#endif /* CFE_API_cpu_stop || CFE_API_ALL */ + +#if defined(CFE_API_enumenv) || defined(CFE_API_ALL) +int +cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_ENV_SET; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_envbuf_t); + xiocb.plist.xiocb_envbuf.enum_idx = idx; + xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); + xiocb.plist.xiocb_envbuf.name_length = namelen; + xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(val); + xiocb.plist.xiocb_envbuf.val_length = vallen; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; +} +#endif /* CFE_API_enumenv || CFE_API_ALL */ + +#if defined(CFE_API_enummem) || defined(CFE_API_ALL) +int +cfe_enummem(int idx, int flags, cfe_xuint_t *start, cfe_xuint_t *length, + cfe_xuint_t *type) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_FW_MEMENUM; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = flags; + xiocb.xiocb_psize = sizeof(xiocb_meminfo_t); + xiocb.plist.xiocb_meminfo.mi_idx = idx; + + cfe_iocb_dispatch(&xiocb); + + if (xiocb.xiocb_status < 0) + return xiocb.xiocb_status; + + *start = xiocb.plist.xiocb_meminfo.mi_addr; + *length = xiocb.plist.xiocb_meminfo.mi_size; + *type = xiocb.plist.xiocb_meminfo.mi_type; + + return 0; +} +#endif /* CFE_API_enummem || CFE_API_ALL */ + +#if defined(CFE_API_exit) || defined(CFE_API_ALL) +int +cfe_exit(int warm, int status) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_FW_RESTART; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = warm ? CFE_FLG_WARMSTART : 0; + xiocb.xiocb_psize = sizeof(xiocb_exitstat_t); + xiocb.plist.xiocb_exitstat.status = status; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; +} +#endif /* CFE_API_exit || CFE_API_ALL */ + +#if defined(CFE_API_flushcache) || defined(CFE_API_ALL) +int +cfe_flushcache(int flg) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_FW_FLUSHCACHE; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = flg; + xiocb.xiocb_psize = 0; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; +} +#endif /* CFE_API_flushcache || CFE_API_ALL */ + +#if defined(CFE_API_getdevinfo) || defined(CFE_API_ALL) +int +cfe_getdevinfo(char *name) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_GETINFO; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_buffer_t); + xiocb.plist.xiocb_buffer.buf_offset = 0; + xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(name); + xiocb.plist.xiocb_buffer.buf_length = cfe_strlen(name); + + cfe_iocb_dispatch(&xiocb); + + if (xiocb.xiocb_status < 0) + return xiocb.xiocb_status; + return xiocb.plist.xiocb_buffer.buf_devflags; +} +#endif /* CFE_API_getdevinfo || CFE_API_ALL */ + +#if defined(CFE_API_getenv) || defined(CFE_API_ALL) +int +cfe_getenv(char *name, char *dest, int destlen) +{ + cfe_xiocb_t xiocb; + + *dest = 0; + + xiocb.xiocb_fcode = CFE_CMD_ENV_GET; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_envbuf_t); + xiocb.plist.xiocb_envbuf.enum_idx = 0; + xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); + xiocb.plist.xiocb_envbuf.name_length = cfe_strlen(name); + xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(dest); + xiocb.plist.xiocb_envbuf.val_length = destlen; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; +} +#endif /* CFE_API_getenv || CFE_API_ALL */ + +#if defined(CFE_API_getfwinfo) || defined(CFE_API_ALL) +int +cfe_getfwinfo(cfe_fwinfo_t *info) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_FW_GETINFO; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_fwinfo_t); + + cfe_iocb_dispatch(&xiocb); + + if (xiocb.xiocb_status < 0) + return xiocb.xiocb_status; + + info->fwi_version = xiocb.plist.xiocb_fwinfo.fwi_version; + info->fwi_totalmem = xiocb.plist.xiocb_fwinfo.fwi_totalmem; + info->fwi_flags = xiocb.plist.xiocb_fwinfo.fwi_flags; + info->fwi_boardid = xiocb.plist.xiocb_fwinfo.fwi_boardid; + info->fwi_bootarea_va = xiocb.plist.xiocb_fwinfo.fwi_bootarea_va; + info->fwi_bootarea_pa = xiocb.plist.xiocb_fwinfo.fwi_bootarea_pa; + info->fwi_bootarea_size = xiocb.plist.xiocb_fwinfo.fwi_bootarea_size; +#if 0 + info->fwi_reserved1 = xiocb.plist.xiocb_fwinfo.fwi_reserved1; + info->fwi_reserved2 = xiocb.plist.xiocb_fwinfo.fwi_reserved2; + info->fwi_reserved3 = xiocb.plist.xiocb_fwinfo.fwi_reserved3; +#endif + + return 0; +} +#endif /* CFE_API_getfwinfo || CFE_API_ALL */ + +#if defined(CFE_API_getstdhandle) || defined(CFE_API_ALL) +int +cfe_getstdhandle(int flg) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_GETHANDLE; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = flg; + xiocb.xiocb_psize = 0; + + cfe_iocb_dispatch(&xiocb); + + if (xiocb.xiocb_status < 0) + return xiocb.xiocb_status; + return xiocb.xiocb_handle; + +} +#endif /* CFE_API_getstdhandle || CFE_API_ALL */ + +#if defined(CFE_API_getticks) || defined(CFE_API_ALL) +int64_t +#ifdef CFE_API_IMPL_NAMESPACE +__cfe_getticks(void) +#else +cfe_getticks(void) +#endif +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_FW_GETTIME; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_time_t); + xiocb.plist.xiocb_time.ticks = 0; + + cfe_iocb_dispatch(&xiocb); + + return xiocb.plist.xiocb_time.ticks; + +} +#endif /* CFE_API_getticks || CFE_API_ALL */ + +#if defined(CFE_API_inpstat) || defined(CFE_API_ALL) +int +cfe_inpstat(int handle) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_INPSTAT; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = handle; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_inpstat_t); + xiocb.plist.xiocb_inpstat.inp_status = 0; + + cfe_iocb_dispatch(&xiocb); + + if (xiocb.xiocb_status < 0) + return xiocb.xiocb_status; + return xiocb.plist.xiocb_inpstat.inp_status; + +} +#endif /* CFE_API_inpstat || CFE_API_ALL */ + +#if defined(CFE_API_ioctl) || defined(CFE_API_ALL) +int +cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer, int length, + int *retlen, cfe_xuint_t offset) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_IOCTL; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = handle; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_buffer_t); + xiocb.plist.xiocb_buffer.buf_offset = offset; + xiocb.plist.xiocb_buffer.buf_ioctlcmd = ioctlnum; + xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); + xiocb.plist.xiocb_buffer.buf_length = length; + + cfe_iocb_dispatch(&xiocb); + + if (retlen) + *retlen = xiocb.plist.xiocb_buffer.buf_retlen; + return xiocb.xiocb_status; +} +#endif /* CFE_API_ioctl || CFE_API_ALL */ + +#if defined(CFE_API_open) || defined(CFE_API_ALL) +int +cfe_open(char *name) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_OPEN; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_buffer_t); + xiocb.plist.xiocb_buffer.buf_offset = 0; + xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(name); + xiocb.plist.xiocb_buffer.buf_length = cfe_strlen(name); + + cfe_iocb_dispatch(&xiocb); + + if (xiocb.xiocb_status < 0) + return xiocb.xiocb_status; + return xiocb.xiocb_handle; +} +#endif /* CFE_API_open || CFE_API_ALL */ + +#if defined(CFE_API_read) || defined(CFE_API_ALL) +int +cfe_read(int handle, unsigned char *buffer, int length) +{ + return cfe_readblk(handle, 0, buffer, length); +} +#endif /* CFE_API_read || CFE_API_ALL */ + +#if defined(CFE_API_readblk) || defined(CFE_API_ALL) +int +cfe_readblk(int handle, cfe_xint_t offset, unsigned char *buffer, int length) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_READ; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = handle; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_buffer_t); + xiocb.plist.xiocb_buffer.buf_offset = offset; + xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); + xiocb.plist.xiocb_buffer.buf_length = length; + + cfe_iocb_dispatch(&xiocb); + + if (xiocb.xiocb_status < 0) + return xiocb.xiocb_status; + return xiocb.plist.xiocb_buffer.buf_retlen; +} +#endif /* CFE_API_readblk || CFE_API_ALL */ + +#if defined(CFE_API_setenv) || defined(CFE_API_ALL) +int +cfe_setenv(char *name, char *val) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_ENV_SET; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = 0; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_envbuf_t); + xiocb.plist.xiocb_envbuf.enum_idx = 0; + xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); + xiocb.plist.xiocb_envbuf.name_length = cfe_strlen(name); + xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(val); + xiocb.plist.xiocb_envbuf.val_length = cfe_strlen(val); + + cfe_iocb_dispatch(&xiocb); + + return xiocb.xiocb_status; +} +#endif /* CFE_API_setenv || CFE_API_ALL */ + +#if (defined(CFE_API_strlen) || defined(CFE_API_ALL)) \ + && !defined(CFE_API_STRLEN_CUSTOM) +int +cfe_strlen(char *name) +{ + int count = 0; + + while (*name++) + count++; + + return count; +} +#endif /* CFE_API_strlen || CFE_API_ALL */ + +#if defined(CFE_API_write) || defined(CFE_API_ALL) +int +cfe_write(int handle, unsigned char *buffer, int length) +{ + return cfe_writeblk(handle, 0, buffer, length); +} +#endif /* CFE_API_write || CFE_API_ALL */ + +#if defined(CFE_API_writeblk) || defined(CFE_API_ALL) +int +cfe_writeblk(int handle, cfe_xint_t offset, unsigned char *buffer, int length) +{ + cfe_xiocb_t xiocb; + + xiocb.xiocb_fcode = CFE_CMD_DEV_WRITE; + xiocb.xiocb_status = 0; + xiocb.xiocb_handle = handle; + xiocb.xiocb_flags = 0; + xiocb.xiocb_psize = sizeof(xiocb_buffer_t); + xiocb.plist.xiocb_buffer.buf_offset = offset; + xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); + xiocb.plist.xiocb_buffer.buf_length = length; + + cfe_iocb_dispatch(&xiocb); + + if (xiocb.xiocb_status < 0) + return xiocb.xiocb_status; + return xiocb.plist.xiocb_buffer.buf_retlen; +} +#endif /* CFE_API_writeblk || CFE_API_ALL */ diff --git a/cfe/cfe/api/cfe_api.h b/cfe/cfe/api/cfe_api.h new file mode 100644 index 0000000..ea598f0 --- /dev/null +++ b/cfe/cfe/api/cfe_api.h @@ -0,0 +1,192 @@ +/* $Id: cfe_api.h,v 1.30 2003/02/07 17:27:56 cgd Exp $ */ + +/* + * Copyright 2000, 2001, 2002 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and copied only + * in accordance with the following terms and conditions. Subject to these + * conditions, you may download, copy, install, use, modify and distribute + * modified or unmodified copies of this software in source and/or binary + * form. No title or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce and + * retain this copyright notice and list of conditions as they appear in + * the source file. + * + * 2) No right is granted to use any trade name, trademark, or logo of + * Broadcom Corporation. The "Broadcom Corporation" name may not be + * used to endorse or promote products derived from this software + * without the prior written permission of Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE + * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE + * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* ********************************************************************* + * + * Broadcom Common Firmware Environment (CFE) + * + * Device function prototypes File: cfe_api.h + * + * This file contains declarations for doing callbacks to + * cfe from an application. It should be the only header + * needed by the application to use this library + * + * Authors: Mitch Lichtenberg, Chris Demetriou + * + ********************************************************************* */ + +#ifndef CFE_API_H +#define CFE_API_H + +/* + * Apply customizations here for different OSes. These need to: + * * typedef uint64_t, int64_t, intptr_t, uintptr_t. + * * define cfe_strlen() if use of an existing function is desired. + * * define CFE_API_IMPL_NAMESPACE if API functions are to use + * names in the implementation namespace. + * Also, optionally, if the build environment does not do so automatically, + * CFE_API_* can be defined here as desired. + */ +/* Begin customization. */ +#include "lib_types.h" +/* End customization. */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +/* Seal indicating CFE's presence, passed to user program. */ +#define CFE_EPTSEAL 0x43464531 + +#define CFE_MI_RESERVED 0 /* memory is reserved, do not use */ +#define CFE_MI_AVAILABLE 1 /* memory is available */ + +#define CFE_FLG_WARMSTART 0x00000001 +#define CFE_FLG_FULL_ARENA 0x00000001 +#define CFE_FLG_ENV_PERMANENT 0x00000001 + +#define CFE_CPU_CMD_START 1 +#define CFE_CPU_CMD_STOP 0 + +#define CFE_STDHANDLE_CONSOLE 0 + +#define CFE_DEV_NETWORK 1 +#define CFE_DEV_DISK 2 +#define CFE_DEV_FLASH 3 +#define CFE_DEV_SERIAL 4 +#define CFE_DEV_CPU 5 +#define CFE_DEV_NVRAM 6 +#define CFE_DEV_CLOCK 7 +#define CFE_DEV_OTHER 8 +#define CFE_DEV_MASK 0x0F + +#define CFE_CACHE_FLUSH_D 1 +#define CFE_CACHE_INVAL_I 2 +#define CFE_CACHE_INVAL_D 4 +#define CFE_CACHE_INVAL_L2 8 + +#define CFE_FWI_64BIT 0x00000001 +#define CFE_FWI_32BIT 0x00000002 +#define CFE_FWI_RELOC 0x00000004 +#define CFE_FWI_UNCACHED 0x00000008 +#define CFE_FWI_MULTICPU 0x00000010 +#define CFE_FWI_FUNCSIM 0x00000020 +#define CFE_FWI_RTLSIM 0x00000040 + +typedef struct { + int64_t fwi_version; /* major, minor, eco version */ + int64_t fwi_totalmem; /* total installed mem */ + int64_t fwi_flags; /* various flags */ + int64_t fwi_boardid; /* board ID */ + int64_t fwi_bootarea_va; /* VA of boot area */ + int64_t fwi_bootarea_pa; /* PA of boot area */ + int64_t fwi_bootarea_size; /* size of boot area */ +} cfe_fwinfo_t; + + +/* + * cfe_strlen is handled specially: If already defined, it has been + * overridden in this environment with a standard strlen-like function. + */ +#ifdef cfe_strlen +# define CFE_API_STRLEN_CUSTOM +#else +# ifdef CFE_API_IMPL_NAMESPACE +# define cfe_strlen(a) __cfe_strlen(a) +# endif +int cfe_strlen(char *name); +#endif + +/* + * Defines and prototypes for functions which take no arguments. + */ +#ifdef CFE_API_IMPL_NAMESPACE +int64_t __cfe_getticks(void); +#define cfe_getticks() __cfe_getticks() +#else +int64_t cfe_getticks(void); +#endif + +/* + * Defines and prototypes for the rest of the functions. + */ +#ifdef CFE_API_IMPL_NAMESPACE +#define cfe_close(a) __cfe_close(a) +#define cfe_cpu_start(a,b,c,d,e) __cfe_cpu_start(a,b,c,d,e) +#define cfe_cpu_stop(a) __cfe_cpu_stop(a) +#define cfe_enumenv(a,b,d,e,f) __cfe_enumenv(a,b,d,e,f) +#define cfe_enummem(a,b,c,d,e) __cfe_enummem(a,b,c,d,e) +#define cfe_exit(a,b) __cfe_exit(a,b) +#define cfe_flushcache(a) __cfe_cacheflush(a) +#define cfe_getdevinfo(a) __cfe_getdevinfo(a) +#define cfe_getenv(a,b,c) __cfe_getenv(a,b,c) +#define cfe_getfwinfo(a) __cfe_getfwinfo(a) +#define cfe_getstdhandle(a) __cfe_getstdhandle(a) +#define cfe_init(a,b) __cfe_init(a,b) +#define cfe_inpstat(a) __cfe_inpstat(a) +#define cfe_ioctl(a,b,c,d,e,f) __cfe_ioctl(a,b,c,d,e,f) +#define cfe_open(a) __cfe_open(a) +#define cfe_read(a,b,c) __cfe_read(a,b,c) +#define cfe_readblk(a,b,c,d) __cfe_readblk(a,b,c,d) +#define cfe_setenv(a,b) __cfe_setenv(a,b) +#define cfe_write(a,b,c) __cfe_write(a,b,c) +#define cfe_writeblk(a,b,c,d) __cfe_writeblk(a,b,c,d) +#endif /* CFE_API_IMPL_NAMESPACE */ + +int cfe_close(int handle); +int cfe_cpu_start(int cpu, void (*fn)(void), long sp, long gp, long a1); +int cfe_cpu_stop(int cpu); +int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen); +int cfe_enummem(int idx, int flags, uint64_t *start, uint64_t *length, + uint64_t *type); +int cfe_exit(int warm,int status); +int cfe_flushcache(int flg); +int cfe_getdevinfo(char *name); +int cfe_getenv(char *name, char *dest, int destlen); +int cfe_getfwinfo(cfe_fwinfo_t *info); +int cfe_getstdhandle(int flg); +int cfe_init(uint64_t handle,uint64_t ept); +int cfe_inpstat(int handle); +int cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer, + int length, int *retlen, uint64_t offset); +int cfe_open(char *name); +int cfe_read(int handle, unsigned char *buffer, int length); +int cfe_readblk(int handle, int64_t offset, unsigned char *buffer, int length); +int cfe_setenv(char *name, char *val); +int cfe_write(int handle, unsigned char *buffer, int length); +int cfe_writeblk(int handle, int64_t offset, unsigned char *buffer, + int length); + +#endif /* CFE_API_H */ diff --git a/cfe/cfe/api/cfe_api_int.h b/cfe/cfe/api/cfe_api_int.h new file mode 100644 index 0000000..4bac86d --- /dev/null +++ b/cfe/cfe/api/cfe_api_int.h @@ -0,0 +1,168 @@ +/* $Id: cfe_api_int.h,v 1.22 2003/02/07 17:27:56 cgd Exp $ */ + +/* + * Copyright 2000, 2001, 2002 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and copied only + * in accordance with the following terms and conditions. Subject to these + * conditions, you may download, copy, install, use, modify and distribute + * modified or unmodified copies of this software in source and/or binary + * form. No title or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce and + * retain this copyright notice and list of conditions as they appear in + * the source file. + * + * 2) No right is granted to use any trade name, trademark, or logo of + * Broadcom Corporation. The "Broadcom Corporation" name may not be + * used to endorse or promote products derived from this software + * without the prior written permission of Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE + * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE + * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* ********************************************************************* + * + * Broadcom Common Firmware Environment (CFE) + * + * Device function prototypes File: cfe_api_int.h + * + * This header defines all internal types and macros for the + * library. This is stuff that's not exported to an app + * using the library. + * + * Authors: Mitch Lichtenberg, Chris Demetriou + * + ********************************************************************* */ + +#ifndef CFE_API_INT_H +#define CFE_API_INT_H + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define CFE_CMD_FW_GETINFO 0 +#define CFE_CMD_FW_RESTART 1 +#define CFE_CMD_FW_BOOT 2 +#define CFE_CMD_FW_CPUCTL 3 +#define CFE_CMD_FW_GETTIME 4 +#define CFE_CMD_FW_MEMENUM 5 +#define CFE_CMD_FW_FLUSHCACHE 6 + +#define CFE_CMD_DEV_GETHANDLE 9 +#define CFE_CMD_DEV_ENUM 10 +#define CFE_CMD_DEV_OPEN 11 +#define CFE_CMD_DEV_INPSTAT 12 +#define CFE_CMD_DEV_READ 13 +#define CFE_CMD_DEV_WRITE 14 +#define CFE_CMD_DEV_IOCTL 15 +#define CFE_CMD_DEV_CLOSE 16 +#define CFE_CMD_DEV_GETINFO 17 + +#define CFE_CMD_ENV_ENUM 20 +#define CFE_CMD_ENV_GET 22 +#define CFE_CMD_ENV_SET 23 +#define CFE_CMD_ENV_DEL 24 + +#define CFE_CMD_MAX 32 + +#define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */ + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef uint64_t cfe_xuint_t; +typedef int64_t cfe_xint_t; +typedef int64_t cfe_xptr_t; + +typedef struct xiocb_buffer_s { + cfe_xuint_t buf_offset; /* offset on device (bytes) */ + cfe_xptr_t buf_ptr; /* pointer to a buffer */ + cfe_xuint_t buf_length; /* length of this buffer */ + cfe_xuint_t buf_retlen; /* returned length (for read ops) */ + cfe_xuint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */ +} xiocb_buffer_t; + +#define buf_devflags buf_ioctlcmd /* returned device info flags */ + +typedef struct xiocb_inpstat_s { + cfe_xuint_t inp_status; /* 1 means input available */ +} xiocb_inpstat_t; + +typedef struct xiocb_envbuf_s { + cfe_xint_t enum_idx; /* 0-based enumeration index */ + cfe_xptr_t name_ptr; /* name string buffer */ + cfe_xint_t name_length; /* size of name buffer */ + cfe_xptr_t val_ptr; /* value string buffer */ + cfe_xint_t val_length; /* size of value string buffer */ +} xiocb_envbuf_t; + +typedef struct xiocb_cpuctl_s { + cfe_xuint_t cpu_number; /* cpu number to control */ + cfe_xuint_t cpu_command; /* command to issue to CPU */ + cfe_xuint_t start_addr; /* CPU start address */ + cfe_xuint_t gp_val; /* starting GP value */ + cfe_xuint_t sp_val; /* starting SP value */ + cfe_xuint_t a1_val; /* starting A1 value */ +} xiocb_cpuctl_t; + +typedef struct xiocb_time_s { + cfe_xint_t ticks; /* current time in ticks */ +} xiocb_time_t; + +typedef struct xiocb_exitstat_s { + cfe_xint_t status; +} xiocb_exitstat_t; + +typedef struct xiocb_meminfo_s { + cfe_xint_t mi_idx; /* 0-based enumeration index */ + cfe_xint_t mi_type; /* type of memory block */ + cfe_xuint_t mi_addr; /* physical start address */ + cfe_xuint_t mi_size; /* block size */ +} xiocb_meminfo_t; + +typedef struct xiocb_fwinfo_s { + cfe_xint_t fwi_version; /* major, minor, eco version */ + cfe_xint_t fwi_totalmem; /* total installed mem */ + cfe_xint_t fwi_flags; /* various flags */ + cfe_xint_t fwi_boardid; /* board ID */ + cfe_xint_t fwi_bootarea_va; /* VA of boot area */ + cfe_xint_t fwi_bootarea_pa; /* PA of boot area */ + cfe_xint_t fwi_bootarea_size; /* size of boot area */ + cfe_xint_t fwi_reserved1; + cfe_xint_t fwi_reserved2; + cfe_xint_t fwi_reserved3; +} xiocb_fwinfo_t; + +typedef struct cfe_xiocb_s { + cfe_xuint_t xiocb_fcode; /* IOCB function code */ + cfe_xint_t xiocb_status; /* return status */ + cfe_xint_t xiocb_handle; /* file/device handle */ + cfe_xuint_t xiocb_flags; /* flags for this IOCB */ + cfe_xuint_t xiocb_psize; /* size of parameter list */ + union { + xiocb_buffer_t xiocb_buffer; /* buffer parameters */ + xiocb_inpstat_t xiocb_inpstat; /* input status parameters */ + xiocb_envbuf_t xiocb_envbuf; /* environment function parameters */ + xiocb_cpuctl_t xiocb_cpuctl; /* CPU control parameters */ + xiocb_time_t xiocb_time; /* timer parameters */ + xiocb_meminfo_t xiocb_meminfo; /* memory arena info parameters */ + xiocb_fwinfo_t xiocb_fwinfo; /* firmware information */ + xiocb_exitstat_t xiocb_exitstat; /* Exit Status */ + } plist; +} cfe_xiocb_t; + +#endif /* CFE_API_INT_H */ diff --git a/cfe/cfe/api/cfe_error.h b/cfe/cfe/api/cfe_error.h new file mode 100644 index 0000000..6301c56 --- /dev/null +++ b/cfe/cfe/api/cfe_error.h @@ -0,0 +1,101 @@ +/* $Id: cfe_error.h,v 1.3 2003/02/07 17:27:56 cgd Exp $ */ + +/* + * Copyright 2000, 2001, 2002 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and copied only + * in accordance with the following terms and conditions. Subject to these + * conditions, you may download, copy, install, use, modify and distribute + * modified or unmodified copies of this software in source and/or binary + * form. No title or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce and + * retain this copyright notice and list of conditions as they appear in + * the source file. + * + * 2) No right is granted to use any trade name, trademark, or logo of + * Broadcom Corporation. The "Broadcom Corporation" name may not be + * used to endorse or promote products derived from this software + * without the prior written permission of Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE + * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE + * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* ********************************************************************* + * + * Broadcom Common Firmware Environment (CFE) + * + * Error codes File: cfe_error.h + * + * CFE's global error code list is here. + * + * Author: Mitch Lichtenberg + * + ********************************************************************* */ + + +#define CFE_OK 0 +#define CFE_ERR -1 /* generic error */ +#define CFE_ERR_INV_COMMAND -2 +#define CFE_ERR_EOF -3 +#define CFE_ERR_IOERR -4 +#define CFE_ERR_NOMEM -5 +#define CFE_ERR_DEVNOTFOUND -6 +#define CFE_ERR_DEVOPEN -7 +#define CFE_ERR_INV_PARAM -8 +#define CFE_ERR_ENVNOTFOUND -9 +#define CFE_ERR_ENVREADONLY -10 + +#define CFE_ERR_NOTELF -11 +#define CFE_ERR_NOT32BIT -12 +#define CFE_ERR_WRONGENDIAN -13 +#define CFE_ERR_BADELFVERS -14 +#define CFE_ERR_NOTMIPS -15 +#define CFE_ERR_BADELFFMT -16 +#define CFE_ERR_BADADDR -17 + +#define CFE_ERR_FILENOTFOUND -18 +#define CFE_ERR_UNSUPPORTED -19 + +#define CFE_ERR_HOSTUNKNOWN -20 + +#define CFE_ERR_TIMEOUT -21 + +#define CFE_ERR_PROTOCOLERR -22 + +#define CFE_ERR_NETDOWN -23 +#define CFE_ERR_NONAMESERVER -24 + +#define CFE_ERR_NOHANDLES -25 +#define CFE_ERR_ALREADYBOUND -26 + +#define CFE_ERR_CANNOTSET -27 +#define CFE_ERR_NOMORE -28 +#define CFE_ERR_BADFILESYS -29 +#define CFE_ERR_FSNOTAVAIL -30 + +#define CFE_ERR_INVBOOTBLOCK -31 +#define CFE_ERR_WRONGDEVTYPE -32 +#define CFE_ERR_BBCHECKSUM -33 +#define CFE_ERR_BOOTPROGCHKSUM -34 + +#define CFE_ERR_LDRNOTAVAIL -35 + +#define CFE_ERR_NOTREADY -36 + +#define CFE_ERR_GETMEM -37 +#define CFE_ERR_SETMEM -38 + +#define CFE_ERR_NOTCONN -39 +#define CFE_ERR_ADDRINUSE -40 diff --git a/cfe/cfe/applets/Makefile b/cfe/cfe/applets/Makefile new file mode 100644 index 0000000..42e1e4f --- /dev/null +++ b/cfe/cfe/applets/Makefile @@ -0,0 +1,64 @@ + +CFG_MLONG64=0 + +CFE_DIRS = ../include ../arch/mips/cpu/sb1250/include ../lib ../verif ../api +CFE_INCLUDES = $(patsubst %,-I%,$(subst :, ,$(CFE_DIRS))) + +VPATH = $(CFE_DIRS) + +INCLUDES = -I. $(CFE_INCLUDES) +COMFLAGS = -g -c -mcpu=sb1 -ffreestanding +CFLAGS = $(INCLUDES) $(COMFLAGS) -O -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -G 0 -DCFE_API_ALL + +GCC = $(TOOLS)sb1-elf-gcc +GLD = $(TOOLS)sb1-elf-ld +OBJCOPY = $(TOOLS)sb1-elf-objcopy + +ifeq (${CFG_MLONG64},1) +CFLAGS += -mlong64 -D__long64 +endif + +LDFLAGS = --script cfe_applet.lds -g + +ifeq (CFG_LITTLE,1) +CFLAGS += -EL +LDFLAGS += -EL +else +CFLAGS += -EB +LDFLAGS += -EB +endif + + +%.o : %.c + $(GCC) $(CFLAGS) -o $@ $< + +%.o : %.S + $(GCC) $(CFLAGS) -o $@ $< + + +LIBOBJS = lib_printf.o lib_string.o cfe_api.o + +all : test vapitest + echo done + +test : test.o minicrt0.o $(LIBOBJS) + $(GLD) -o test.elfraw -Map test.mapraw $(LDFLAGS) minicrt0.o test.o $(LIBOBJS) + $(GLD) -o test.elf -Ttext 0x20000000 -Map test.map $(LDFLAGS) minicrt0.o test.o $(LIBOBJS) + $(OBJCOPY) -O binary test.elfraw test + $(OBJCOPY) -O srec test.elfraw test.srec + +download : download.o minicrt0.o $(LIBOBJS) + $(GLD) -o download.elf -Ttext 0x80001000 -Map download.map $(LDFLAGS) minicrt0.o download.o $(LIBOBJS) + $(OBJCOPY) --strip-unneeded download.elf s.download.elf + gzip --best -c s.download.elf > download.elf.gz + $(GLD) -Tdownload.lds -bbinary -o download.data download.elf.gz + +vapitest : vapitest.o + $(GLD) -o vapitest -Ttext 0x80020000 -Map vapitest.map vapitest.o + $(OBJCOPY) -O srec vapitest vapitest.srec + +clean : + rm -f *.o *~ *.map *.mapraw + rm -f test test.elf test.srec test.elfraw + rm -f *download.elf *.gz + rm -f vapitest vapitest.srec diff --git a/cfe/cfe/applets/README b/cfe/cfe/applets/README new file mode 100644 index 0000000..b622997 --- /dev/null +++ b/cfe/cfe/applets/README @@ -0,0 +1,21 @@ + +This directory contains "applets" - simple programs to let +us test the callbacks into CFE. + +You should be able to compile these programs and load them +via the TFTP loader in CFE, and when run, they will call +the APIs in CFE to display messages and such. + +The files cfe_api.c, cfe_api.h, and cfe_api_int.h are versions +of the same files from ../applets, customized to build with this +stand-alone build environment. Typically you won't want to copy +these. Instead, you'll want to copy the versions in ../applets and +customize them as needed. + +Pay particular attention to the MIPS calling conventions +you are using. In particular, CFE uses 64-bit register +values. If you compile your program with -mips1 or -mips2, +the 64-bit arguments will be passed as 2 32-bt registers. + +In most cases, CFE only uses the lower 32 bits, since +it can be called from either 32 or 64-bit applications. diff --git a/cfe/cfe/applets/cfe_applet.lds b/cfe/cfe/applets/cfe_applet.lds new file mode 100644 index 0000000..e1b33e9 --- /dev/null +++ b/cfe/cfe/applets/cfe_applet.lds @@ -0,0 +1,37 @@ +OUTPUT_ARCH(mips) +ENTRY(__start) +SECTIONS +{ + . = 0x20000000; +/* . = 0x81000000; */ + .text : + { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.fini) + *(.rodata) + _etext = .; + } + + .data : + { + _gp = ALIGN(16) + 0x8000; + _fdata = . ; + *(.data) + CONSTRUCTORS + *(.sdata) + } + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + _end = .; +} diff --git a/cfe/cfe/applets/download.c b/cfe/cfe/applets/download.c new file mode 100644 index 0000000..911c649 --- /dev/null +++ b/cfe/cfe/applets/download.c @@ -0,0 +1,163 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Null device mode driver File: download.c + * + * Small program (placeholder) to download to a 1250 in PCI Device Mode + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_api.h" + +int conhandle; + + +void appletmain(long handle,long vector, + long reserved,long seal); + + + + +/* ********************************************************************* + * console_write(buffer,length) + * + * Write text to the console. If the console is not open and + * we're "saving" text, put the text on the in-memory queue + * + * Input parameters: + * buffer - pointer to data + * length - number of characters to write + * + * Return value: + * number of characters written or <0 if error + ********************************************************************* */ + +static int console_write(unsigned char *buffer,int length) +{ + int res; + + /* + * Do nothing if no console + */ + + if (conhandle == -1) return -1; + + /* + * Write text to device + */ + + for (;;) { + res = cfe_write(conhandle,buffer,length); + if (res < 0) break; + buffer += res; + length -= res; + if (length == 0) break; + } + + if (res < 0) return -1; + return 0; +} + + +/* ********************************************************************* + * console_xprint(str) + * + * printf callback for the console device. the "xprintf" + * routine ends up calling this. This routine also cooks the + * output, turning "\n" into "\r\n" + * + * Input parameters: + * str - string to write + * + * Return value: + * number of characters written + ********************************************************************* */ + +static int console_xprint(const char *str) +{ + int count = 0; + int len; + const char *p; + + /* Convert CR to CRLF as we write things out */ + + while ((p = strchr(str,'\n'))) { + console_write((char *) str,p-str); + console_write("\r\n",2); + count += (p-str); + str = p + 1; + } + + len = strlen(str); + console_write((char *) str, len); + count += len; + + return count; +} + + +void appletmain(long handle,long vector, + long ept,long seal) +{ + void (*reboot)(void) = (void *) (uintptr_t) (int) 0xBFC00000; + char str[100]; + + xprinthook = console_xprint; + + cfe_init(handle,ept); + + conhandle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); + + str[0] = 0; + cfe_getenv("BOOT_CONSOLE",str,sizeof(str)); + + xprintf("\nHello, world. Console = %s\n",str); + + xprintf("\nThis is a null device driver that just restarts CFE\n"); + xprintf("Rebuild the host's CFE to replace it with your driver.\n\n"); + + xprintf("Exiting to CFE\n\n"); + + cfe_exit(CFE_FLG_WARMSTART,0); + + (*reboot)(); +} diff --git a/cfe/cfe/applets/download.lds b/cfe/cfe/applets/download.lds new file mode 100644 index 0000000..7f6e6be --- /dev/null +++ b/cfe/cfe/applets/download.lds @@ -0,0 +1,12 @@ +OUTPUT_FORMAT("elf32-bigmips") +OUTPUT_ARCH("mipssb1") + +SECTIONS +{ + .rodata : + { + download_start = .; + *(.data); + download_end = .; + } +} diff --git a/cfe/cfe/applets/minicrt0.S b/cfe/cfe/applets/minicrt0.S new file mode 100644 index 0000000..937f240 --- /dev/null +++ b/cfe/cfe/applets/minicrt0.S @@ -0,0 +1,95 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Mini startup module for CFE apps File: minicrt0.S + * + * About the most minimal startup routine you can get. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" + +/* + * This module should be linked first! + */ + +#define STACK_SIZE 8192 + + .bss + .comm stack_bottom,STACK_SIZE + .comm __junk,4 + + .text + + .extern appletmain + .globl __start + +__start: + + /* + * Set up our GP (in case we're using it) + * Set up the stack pointer (don't use CFE's stack) + */ + + la gp,_gp + la sp,stack_bottom+STACK_SIZE-32 + + /* + * Zero BSS. No need to do this very efficiently, do it + * 32 bits at a time to ensure we can compile this + * with -mips1. + */ + + la t0,_fbss + la t1,_end + +1: sw zero,0(t0) + add t0,4 + blt t0,t1,1b + + /* + * Jump to main program. Note that we didn't trash A0..A3, + * our application will need them. So, if you add stuff here, + * be sure to preserve the A0..A3 registers for the C code. + */ + + j appletmain + diff --git a/cfe/cfe/applets/test.c b/cfe/cfe/applets/test.c new file mode 100644 index 0000000..9122456 --- /dev/null +++ b/cfe/cfe/applets/test.c @@ -0,0 +1,211 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * API test program File: test.c + * + * Small program to test CFE's external API + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_api.h" + +int conhandle; + + +void appletmain(unsigned long handle,unsigned long vector, + unsigned long reserved,unsigned long seal); + + + + +/* ********************************************************************* + * console_write(buffer,length) + * + * Write text to the console. If the console is not open and + * we're "saving" text, put the text on the in-memory queue + * + * Input parameters: + * buffer - pointer to data + * length - number of characters to write + * + * Return value: + * number of characters written or <0 if error + ********************************************************************* */ + +static int console_write(unsigned char *buffer,int length) +{ + int res; + + /* + * Do nothing if no console + */ + + if (conhandle == -1) return -1; + + /* + * Write text to device + */ + + for (;;) { + res = cfe_write(conhandle,buffer,length); + if (res < 0) break; + buffer += res; + length -= res; + if (length == 0) break; + } + + if (res < 0) return -1; + return 0; +} + + +/* ********************************************************************* + * console_xprint(str) + * + * printf callback for the console device. the "xprintf" + * routine ends up calling this. This routine also cooks the + * output, turning "\n" into "\r\n" + * + * Input parameters: + * str - string to write + * + * Return value: + * number of characters written + ********************************************************************* */ + +static int console_xprint(const char *str) +{ + int count = 0; + int len; + const char *p; + + /* Convert CR to CRLF as we write things out */ + + while ((p = strchr(str,'\n'))) { + console_write((char *) str,p-str); + console_write("\r\n",2); + count += (p-str); + str = p + 1; + } + + len = strlen(str); + console_write((char *) str, len); + count += len; + + return count; +} + + +#if 0 +static int myxprinthook(const char *str) +{ + int count = 0; + int len; + const char *p; + + /* Convert CR to CRLF as we write things out */ + + while ((p = strchr(str,'\r'))) { + cfe_write(conhandle,(char *) str,p-str+1); + cfe_write(conhandle,"\n",1); + count += (p-str); + str = p + 1; + } + + len = strlen(str); + cfe_write(conhandle,(char *) str, len); + count += len; + + return count; +} +#endif + +void appletmain(unsigned long handle,unsigned long vector, + unsigned long ept,unsigned long seal) +{ + void (*reboot)(void) = (void *) (uintptr_t) (int) 0xBFC00000; + char str[100]; + cfe_fwinfo_t info; + int idx; + int res; + uint64_t start,length,type; + + xprinthook = console_xprint; + + cfe_init(handle,ept); + + conhandle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); + + str[0] = 0; + cfe_getenv("BOOT_CONSOLE",str,sizeof(str)); + + xprintf("Hello, world. Console = %s\n",str); + xprintf("API Seal = %08X\n",(int)seal); + xprintf("Entrypoint=%08X Handle=%08X\n",(int)ept,(int)handle); + idx = 0; + + cfe_getfwinfo(&info); + xprintf("CFE version: %08llX\n",info.fwi_version); + xprintf("Flags: %08llX\n",info.fwi_flags); + xprintf("Total memory: %08llX\n",info.fwi_totalmem); + xprintf("Board ID: %08llX\n",info.fwi_boardid); + xprintf("Bootarea VA: %08llX\n",info.fwi_bootarea_va); + xprintf("Bootarea PA: %08llX\n",info.fwi_bootarea_pa); + xprintf("Bootarea Size: %08llX\n",info.fwi_bootarea_size); + + xprintf("Memory map:\n"); + for (;;) { + if ((res = cfe_enummem(idx,1,&start,&length,&type) != 0)) break; + xprintf("Memory at %016llX length %016llX type %ld\n", + start,length,type); + idx++; + } + + xprintf("Exiting to CFE\n\n"); + + cfe_exit(CFE_FLG_WARMSTART,0); + + (*reboot)(); + +} diff --git a/cfe/cfe/applets/vapitest.S b/cfe/cfe/applets/vapitest.S new file mode 100644 index 0000000..a57a563 --- /dev/null +++ b/cfe/cfe/applets/vapitest.S @@ -0,0 +1,96 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Verification Test APIs File: vapitest.S + * + * This module contains special low-level routines for use + * by verification programs. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" + + +#include "vapi.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + .text + +LEAF(_start) + + VAPI_LOG_SETBUF(0x80030000,0x80040000) + + + VAPI_LOG_CONST(0x100,0xABCDEF) + VAPI_LOG_REG(0x101,sp) + VAPI_LOG_BUFFER(0x102,testbuf,10) + VAPI_PUTS("Hello world.\n") + VAPI_LOG_SOCSTATE(0x103,SOC_AGENT_DUART) + VAPI_PRINTGPRS(); + VAPI_LOG_CONST(0x1EE,0xEEEEEEEE) + VAPI_LOG_GPRS(0x199) + VAPI_SETLEDS('V','A','P','I') + + VAPI_EXIT_CONST(0) + + +END(_start) + +testbuf: .dword 0x123456789ABCDEF0 + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xFEDCBA9876543210 + + + +/* ********************************************************************* + * End + ********************************************************************* */ + + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm63xx_util.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm63xx_util.h new file mode 100755 index 0000000..273b9c7 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm63xx_util.h @@ -0,0 +1,167 @@ +/*************************************************************************** + * Broadcom Corp. Confidential + * Copyright 2001, 2002 Broadcom Corp. All Rights Reserved. + * + * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED + * SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM. + * YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT + * SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. + * + *************************************************************************** + * File Name : bcm63xx_util.h + * + * Created on : 04/18/2002 seanl + ***************************************************************************/ + +#if !defined(_BCM63XX_UTIL_H_) +#define _BCM63XX_UTIL_H_ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" +#include "cfe_ioctl.h" +#include "cfe_error.h" +#include "env_subr.h" +#include "ui_command.h" +#include "cfe.h" +#include "net_ebuf.h" +#include "net_ether.h" +#include "net_api.h" +#include "cfe_fileops.h" +#include "bsp_config.h" +#include "cfe_mem.h" +#include "cfe_loader.h" +#include "addrspace.h" + +#include "dev_bcm63xx_flash.h" +#include "bcm_hwdefs.h" +#include "bcmTag.h" +#include "boardparms.h" +#include "boardparms_voice.h" +#include "bcm_map.h" + +extern unsigned long cfe_sdramsize; + +#define NAND_FLASH_BOOT_IMAGE_NAME "vmlinux.lz" + +#define BOARD_IMAGE_DOWNLOAD_ADDRESS \ + ((cfe_sdramsize > 0x00800000) ? 0x80800000 : 0x80000000) +#define BOARD_IMAGE_DOWNLOAD_SIZE \ + ((cfe_sdramsize > 0x00800000) ? cfe_sdramsize - 0x00800000 : 0x00400000) + +#define MAX_PROMPT_LEN 50 // assume no one wants to type more than 50 chars +#define MAX_MAC_STR_LEN 19 // mac address string 18+1 in regular format +#define PROMPT_DEFINE_LEN 2 +#define MASK_LEN 8 // vxworks like ffffff00 + +typedef struct +{ + char* promptName; + char* errorPrompt; + char promptDefine[PROMPT_DEFINE_LEN]; + char parameter[MAX_PROMPT_LEN]; + int maxValueLength; + int (*func)(char *); + int enabled; +} PARAMETER_SETTING, *PPARAMETER_SETTING; + +#define IP_PROMPT "Invalid ip address. eg. 192.168.1.200[:ffffff00]" +#define RUN_FROM_PROMPT "f = jump to flash; h = tftpd from host" +#define HOST_FN_PROMPT "eg. vmlinux" +#define FLASH_FN_PROMPT "eg. bcm963xx_fs_kernel" +#define BOOT_DELAY_PROMPT "range 0-9, 0=forever prompt" +#define BOOT_PARTITION_PROMPT "1 = latest image, 2 = previous image" +#define AFE_PROMPT "Invalid AFE ID eg. 0x10608100" + +// error input prompts +#define BOARDID_STR_PROMPT "Invalid board ID" +#define MAC_CT_PROMPT "Invalid MAC addresses number: 1 - 32" +#define MAC_ADDR_PROMPT "Invalid MAC address format: eg. 12:34:56:ab:cd:ef or 123456abcdef" +#define PSI_SIZE_PROMPT "Invalid PSI size: (1-64) Kbytes" +#define BACKUP_PSI_PROMPT "Enable Backup PSI (0 or 1)" +#define SYSLOG_SIZE_PROMPT "Invalid System Log size: (0-256) Kbytes" +#define CPU_TP_PROMPT "Invalid thread number: [0|1]" +#define GPON_SN_PROMPT "Invalid GPON Serial Number" +#define GPON_PW_PROMPT "Invalid GPON Password" +#define WPS_DEVICE_PIN_PROMPT "Invalid WPS Device Pin" + +// bootline definition: +// Space is the deliminator of the parameters. Currently supports following parameters: +// t=xxx.xxx.xxx.xxx h=xxx.xxx.xxx.xxx g=xxx.xxx.xxx.xxx r=f/h (run from flash or host) +// f=vmlinux (if r=h) i=bcm963xx_fs_kernel d=3 (default delay, range 0-9, 0=forever prompt) + +#define BOOT_IP_LEN 18 // "t=xxx.xxx.xxx.xxx" +#define BOOT_FILENAME_LEN 50 // "f=vmlinux" + +typedef struct +{ + char boardIp[BOOT_IP_LEN]; + char boardMask[BOOT_IP_LEN]; // set for the board only and ignore for the host/gw. fmt :ffffff00 + char hostIp[BOOT_IP_LEN]; + char gatewayIp[BOOT_IP_LEN]; + char runFrom; + char hostFileName[BOOT_FILENAME_LEN]; + char flashFileName[BOOT_FILENAME_LEN]; + int bootDelay; + char bootPartition; +} BOOT_INFO, *PBOOT_INFO; + +#define LED_OFF 0 +#define LED_ON 1 + +extern void getBootLine(void); +extern void setDefaultBootline(void); +extern int printSysInfo(void); +extern int changeBootLine(void); +extern int changeAfeId(void); +extern void dumpHex(unsigned char *start, int len); +extern BOOT_INFO bootInfo; +extern void enet_init(void); +extern int verifyTag(PFILE_TAG pTag, int verbose); +extern int flashImage(unsigned char *ptr); +extern int writeWholeImage(unsigned char *ptr, int size); + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +extern int bcm63xx_run(int breakIntoCfe); +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +extern int getPartitionFromTag( PFILE_TAG pTag ); +extern PFILE_TAG getTagFromPartition(int imageNumber); +extern PFILE_TAG getBootImageTag(void); +extern int parsexdigit(char str); +extern int setDefaultBoardParam(void); /* Bob added to set default board parameters, 11/01/2010 */ +extern int setBoardParam(void); +extern int setGponBoardParam(void); +extern int setWpsDevicePinBoardParam(void); +extern int setVoiceBoardParam(void); +extern int getBoardParam(void); +extern void displayBoardParam(void); +extern int processPrompt(PPARAMETER_SETTING promptPtr, int promptCt); +extern UINT32 getCrc32(unsigned char *pdata, UINT32 size, UINT32 crc); +extern int yesno(void); +extern int bcm63xx_cfe_rawload(cfe_loadargs_t *la); +extern int bcm63xx_cfe_elfload(cfe_loadargs_t *la); +extern void setGpio (unsigned short led_gpio, unsigned short led_state); +extern void setLed ( unsigned short led, unsigned short led_state ); +extern void setAllLedsOff(void); +extern void setPowerOnLedOn(void); +extern void setBreakIntoCfeLed(void); +extern void softReset(void); +extern void validateNandPartTbl(PNVRAM_DATA pNvramData); +extern void writeNvramData(PNVRAM_DATA pNvramData); +extern int readNvramData(PNVRAM_DATA pNvramData); + +/* Foxconn add start by Jenny Zhao, 07/02/2008*/ +extern int nmrp_led_toggle(void); +extern int power_led_toggle(int state); +extern int verify_board_id(char *buf); +/* Foxconn add end by Jenny Zhao, 07/02/2008*/ +#endif // _BCM63XX_UTIL_H_ + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_common.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_common.h new file mode 100755 index 0000000..136267a --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_common.h @@ -0,0 +1,32 @@ +/* +<:copyright-broadcom + + Copyright (c) 2004 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +#ifndef __BCM_COMMON_H +#define __BCM_COMMON_H + +#if defined (_BCM96328_) +#include "6328_common.h" +#endif +#if defined (_BCM96362_) +#include "6362_common.h" +#endif +#if defined (_BCM96368_) +#include "6368_common.h" +#endif +#if defined (_BCM96816_) +#include "6816_common.h" +#endif + +#endif diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_cpu.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_cpu.h new file mode 100755 index 0000000..e033936 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_cpu.h @@ -0,0 +1,32 @@ +/* +<:copyright-broadcom + + Copyright (c) 2004 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +#ifndef __BCM_CPU_H +#define __BCM_CPU_H + +#if defined (_BCM96328_) +#include "6328_cpu.h" +#endif +#if defined (_BCM96362_) +#include "6362_cpu.h" +#endif +#if defined (_BCM96368_) +#include "6368_cpu.h" +#endif +#if defined (_BCM96816_) +#include "6816_cpu.h" +#endif + +#endif diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_map.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_map.h new file mode 100755 index 0000000..0383431 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcm_map.h @@ -0,0 +1,32 @@ +/* +<:copyright-broadcom + + Copyright (c) 2004 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +#ifndef __BCM_MAP_H +#define __BCM_MAP_H + +#if defined (_BCM96328_) +#include "6328_map.h" +#endif +#if defined (_BCM96362_) +#include "6362_map.h" +#endif +#if defined (_BCM96368_) +#include "6368_map.h" +#endif +#if defined (_BCM96816_) +#include "6816_map.h" +#endif + +#endif diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcmmii.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcmmii.h new file mode 100755 index 0000000..a33de5c --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcmmii.h @@ -0,0 +1,164 @@ +/* +<:copyright-broadcom + + Copyright (c) 2004 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +#ifndef _BCMMII_H_ +#define _BCMMII_H_ + +#include "dev_bcm63xx_eth.h" + +/*---------------------------------------------------------------------*/ +/* Broadcom PHY MII register address */ +/* use when PhyType is BP_ENET_INTERNAL_PHY */ +/*---------------------------------------------------------------------*/ +#define BCM_PHY_ID_M 0x1F +#define IsExtPhyId(id) ((id & BCM_PHY_ID_M) >= 0x10) +//#define BCM_WAN_PORT 0x40 +//#define IsWanPort(id) (((id) & BCM_WAN_PORT) && ((id) != 0xFF)) + +#define MII_ASR 0x19 +#define MII_INTERRUPT 0x1A +#define MII_RESERVED_1B 0x1B +#define MII_BRCM_TEST 0x1F + +/* MII ASR register. */ +#define MII_ASR_DONE(r) ((r & 0x8000) != 0) +#define MII_ASR_LINK(r) ((r & 0x0004) != 0) +#define MII_ASR_FDX(r) (((r & 0x0700) == 0x0700) || ((r & 0x0700) == 0x0500) || ((r & 0x0700) == 0x0200)) +#define MII_ASR_1000(r) (((r & 0x0700) == 0x0700) || ((r & 0x0700) == 0x0600)) +#define MII_ASR_100(r) (((r & 0x0700) == 0x0500) || ((r & 0x0700) == 0x0300)) +#define MII_ASR_10(r) (((r & 0x0700) == 0x0200) || ((r & 0x0700) == 0x0100)) + +/* Reserved 0x1B register */ +#define MII_RESERVED_1B_ACT_LED 0x0004 + +/* Broadcom Test register. */ +#define MII_BRCM_TEST_SHADOW2_ENABLE 0x0004 + +/* MII Interrupt register. */ +#define MII_INTR_ENABLE 0x4000 + +#define BCM54610_PHYID2 0xBD63 +#define BCM_PHYID_M 0xFFF0 + +#define MII_REGISTER_1C 0x1c + #define MII_1C_WRITE_ENABLE (1 << 15) + #define MII_1C_SHADOW_REG_SEL_S 10 + #define MII_1C_SHADOW_REG_SEL_M 0x1F +#define MII_1C_SHADOW_CLK_ALIGN_CTRL 0x3 + #define GTXCLK_DELAY_BYPASS_DISABLE (1 << 9) +#define MII_1C_SHADOW_LED_CONTROL 0x9 + #define ACT_LINK_LED_ENABLE (1 << 4) +#define MII_1C_EXTERNAL_CONTROL_1 0xB + #define LOM_LED_MODE (1 << 2) + +#define PAGE_CONTROL 0x00 +#define PAGE_SELECT 0xff +#define PAGE_MANAGEMENT 0x02 + +/* Control page registers */ +#define REG_MII_PORT_CONTROL 0x08 +#define REG_SWITCH_MODE 0x0b +#define REG_CONTROL_MII1_PORT_STATE_OVERRIDE 0x0e +#define REG_POWER_DOWN_MODE 0x0f + +/* MII Port Control Register, Page 0x00 Address 0x08 */ +#define REG_MII_PORT_CONTROL_RX_UCST_EN 0x10 +#define REG_MII_PORT_CONTROL_RX_MCST_EN 0x08 +#define REG_MII_PORT_CONTROL_RX_BCST_EN 0x04 + +/* Switch mode register, Page 0x00 Address 0x0b */ +#define REG_SWITCH_MODE_FRAME_MANAGE_MODE 0x01 +#define REG_SWITCH_MODE_SW_FWDG_EN 0x02 + +/* MII1 Port State Override Register Page 0x00 Address 0x0e */ +#define REG_CONTROL_MPSO_MII_SW_OVERRIDE 0x80 +#define REG_CONTROL_MPSO_REVERSE_MII 0x10 +#define REG_CONTROL_MPSO_LP_FLOW_CONTROL 0x08 +#define REG_CONTROL_MPSO_SPEED100 0x04 +#define REG_CONTROL_MPSO_SPEED1000 0x08 +#define REG_CONTROL_MPSO_FDX 0x02 +#define REG_CONTROL_MPSO_LINKPASS 0x01 + +/* Power down mode register Page 0x00 Address 0x0f */ +#define REG_POWER_DOWN_MODE_PORT1_PHY_DISABLE 0x01 +#define REG_POWER_DOWN_MODE_PORT2_PHY_DISABLE 0x02 +#define REG_POWER_DOWN_MODE_PORT3_PHY_DISABLE 0x04 +#define REG_POWER_DOWN_MODE_PORT4_PHY_DISABLE 0x08 +#define REG_POWER_DOWN_MODE_PORT5_PHY_DISABLE 0x10 + +/* Switch control register page 0x0 */ +#define REG_SWITCH_CONTROL 0x20 +#define REG_SWITCH_CONTROL_MII_DUMP_FWD_EN 0x1 + +/* Device ID register page 0x02 */ +#define REG_DEVICE_ID 0x30 +#define REG_GLOBAL_CONFIG 0x00 +#define REG_BRCM_HDR_CTRL 0x03 + +/* Global Configuration Regiater Page 0x02 Address 0x00 */ +#define ENABLE_MII_PORT 0x80 + +/* Broadcom Header Control Register Page 0x02 Address 0x03*/ +#define REG_BRCM_HDR_ENABLE 0x01 + + + +/*---------------------------------------------------------------------*/ +/* 5325 Switch SPI Interface */ +/* use when configuration type is BP_ENET_CONFIG_SPI_SSB_x */ +/*---------------------------------------------------------------------*/ +#define BCM5325_SPI_CMD_LEN 1 +#define BCM5325_SPI_ADDR_LEN 1 +#define BCM5325_SPI_PREPENDCNT (BCM5325_SPI_CMD_LEN+BCM5325_SPI_ADDR_LEN) + +/* 5325 SPI Status Register */ +#define BCM5325_SPI_STS 0xfe + +/* 5325 SPI Status Register definition */ +#define BCM5325_SPI_CMD_RACK 0x20 + +/* 5325 Command Byte definition */ +#define BCM5325_SPI_CMD_READ 0x00 /* bit 0 - Read/Write */ +#define BCM5325_SPI_CMD_WRITE 0x01 /* bit 0 - Read/Write */ +#define BCM5325_SPI_CHIPID_MASK 0x7 /* bit 3:1 - Chip ID */ +#define BCM5325_SPI_CHIPID_SHIFT 1 +#define BCM5325_SPI_CMD_NORMAL 0x60 /* bit 7:4 - Mode */ +#define BCM5325_SPI_CMD_FAST 0x10 /* bit 4 - Mode */ + +/*---------------------------------------------------------------------*/ +/* 5325 Switch Pseudo PHY MII Register */ +/* use when configuration type is BP_ENET_CONFIG_MDIO_PSEUDO_PHY */ +/*---------------------------------------------------------------------*/ +#define PSEUDO_PHY_ADDR 0x1e /* Pseduo PHY address */ + +/* Pseudo PHY MII registers */ +#define REG_PSEUDO_PHY_MII_REG16 0x10 /* register 16 - Switch Register Set Access Control Register */ +#define REG_PSEUDO_PHY_MII_REG17 0x11 /* register 17 - Switch Register Set Read/Write Control Register */ +#define REG_PSEUDO_PHY_MII_REG24 0x18 /* register 24 - Switch Accesss Register bit 15:0 */ +#define REG_PSEUDO_PHY_MII_REG25 0x19 /* register 25 - Switch Accesss Register bit 31:16 */ +#define REG_PSEUDO_PHY_MII_REG26 0x20 /* register 26 - Switch Accesss Register bit 47:32 */ +#define REG_PSEUDO_PHY_MII_REG27 0x21 /* register 27 - Switch Accesss Register bit 63:48 */ + +/*Pseudo PHY MII register 16 Switch Register Set Access Control Register */ +#define REG_PPM_REG16_SWITCH_PAGE_NUMBER_SHIFT 8 /* bit 8..15 - switch page number */ +#define REG_PPM_REG16_MDIO_ENABLE 0x01 /* bit 0 - set MDC/MDIO access enable */ + +/*Pseudo PHY MII register 17 Switch Register Set Read/Write Control Register */ +#define REG_PPM_REG17_REG_NUMBER_SHIFT 8 /* bit 8..15 - switch register number */ +#define REG_PPM_REG17_OP_DONE 0x00 /* bit 0..1 - no operation */ +#define REG_PPM_REG17_OP_WRITE 0x01 /* bit 0..1 - write operation */ +#define REG_PPM_REG17_OP_READ 0x02 /* bit 0..1 - read operation */ + +#endif /* _BCMMII_H_ */ diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcmtypes.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcmtypes.h new file mode 100755 index 0000000..9359663 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bcmtypes.h @@ -0,0 +1,144 @@ +// +// bcmtypes.h - misc useful typedefs +// +#ifndef BCMTYPES_H +#define BCMTYPES_H + +// These are also defined in typedefs.h in the application area, so I need to +// protect against re-definition. + +#ifndef _TYPEDEFS_H_ +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned long uint32; +typedef unsigned long long uint64; +typedef signed char int8; +typedef signed short int16; +typedef signed long int32; +typedef signed long long int64; +#if !defined(__cplusplus) +typedef int bool; +#endif +#endif + +typedef unsigned char byte; +typedef unsigned long sem_t; + +typedef unsigned long HANDLE,*PULONG,DWORD,*PDWORD; +typedef signed long LONG,*PLONG; + +typedef unsigned int *PUINT; +typedef signed int INT; + +typedef unsigned short *PUSHORT; +typedef signed short SHORT,*PSHORT,WORD,*PWORD; + +typedef unsigned char *PUCHAR; +typedef signed char *PCHAR; + +typedef void *PVOID; + +typedef unsigned char BOOLEAN, *PBOOL, *PBOOLEAN; + +typedef unsigned char BYTE,*PBYTE; + +//#ifndef __GNUC__ +//The following has been defined in Vxworks internally: vxTypesOld.h +//redefine under vxworks will cause error +typedef signed int *PINT; + +typedef signed char INT8; +typedef signed short INT16; +typedef signed long INT32; + +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef unsigned long UINT32; + +typedef unsigned char UCHAR; +typedef unsigned short USHORT; +typedef unsigned int UINT; +typedef unsigned long ULONG; + +typedef void VOID; +typedef unsigned char BOOL; + +//#endif /* __GNUC__ */ + + +// These are also defined in typedefs.h in the application area, so I need to +// protect against re-definition. +#ifndef TYPEDEFS_H + +#define MAX_INT16 32767 +#define MIN_INT16 -32768 + +// Useful for true/false return values. This uses the +// Taligent notation (k for constant). +typedef enum +{ + kFalse = 0, + kTrue = 1 +} Bool; + +#endif + +/* macros to protect against unaligned accesses */ + +#if 0 +/* first arg is an address, second is a value */ +#define PUT16( a, d ) { \ + *((byte *)a) = (byte)((d)>>8); \ + *(((byte *)a)+1) = (byte)(d); \ +} + +#define PUT32( a, d ) { \ + *((byte *)a) = (byte)((d)>>24); \ + *(((byte *)a)+1) = (byte)((d)>>16); \ + *(((byte *)a)+2) = (byte)((d)>>8); \ + *(((byte *)a)+3) = (byte)(d); \ +} + +/* first arg is an address, returns a value */ +#define GET16( a ) ( \ + (*((byte *)a) << 8) | \ + (*(((byte *)a)+1)) \ +) + +#define GET32( a ) ( \ + (*((byte *)a) << 24) | \ + (*(((byte *)a)+1) << 16) | \ + (*(((byte *)a)+2) << 8) | \ + (*(((byte *)a)+3)) \ +) +#endif + +#ifndef YES +#define YES 1 +#endif + +#ifndef NO +#define NO 0 +#endif + +#ifndef IN +#define IN +#endif + +#ifndef OUT +#define OUT +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#define READ32(addr) (*(volatile UINT32 *)((ULONG)&addr)) +#define READ16(addr) (*(volatile UINT16 *)((ULONG)&addr)) +#define READ8(addr) (*(volatile UINT8 *)((ULONG)&addr)) + +#endif diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bsp_config.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bsp_config.h new file mode 100755 index 0000000..57e51bb --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/bsp_config.h @@ -0,0 +1,94 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * BSP Configuration file File: bsp_config.h + * + * This module contains global parameters and conditional + * compilation settings for building CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#define CFG_CMT 1 + +#define CFG_INIT_L1 1 /* initialize the L1 cache */ +#define CFG_INIT_L2 0 /* there is no L2 cache */ + +#define CFG_INIT_DRAM 1 /* initialize DRAM controller */ +#define CFG_DRAM_SIZE xxx /* size of DRAM if you don't initialize */ + /* NOTE : Size is in kilobytes. */ + +#define CFG_NETWORK 1 /* define to include network support */ + +#define CFG_FATFS 0 +#define CFG_UI 1 /* Define to enable user interface */ + +#define CFG_MULTI_CPUS 0 /* no multi-cpu support */ + +#define CFG_HEAP_SIZE 1024 /* heap size in kilobytes */ + +#define CFG_STACK_SIZE 8192 /* stack size (bytes, rounded up to K) */ + +#define CFG_SERIAL_BAUD_RATE 115200 /* normal console speed */ + +#define CFG_VENDOR_EXTENSIONS 0 +#define CFG_MINIMAL_SIZE 1 + +/* + * These parameters control the flash driver's sector buffer. + * If you write environment variables or make small changes to + * flash sectors from user applications, you + * need to have the heap big enough to store a temporary sector + * for merging in small changes to flash sectors, so you + * should set CFG_FLASH_ALLOC_SECTOR_BUFFER in that case. + * Otherwise, you can provide an address in unallocated memory + * of where to place the sector buffer. + */ + +#define CFG_FLASH_ALLOC_SECTOR_BUFFER 0 /* '1' to allocate sector buffer from the heap */ +#define CFG_FLASH_SECTOR_BUFFER_ADDR (1*1024*1024-128*1024) /* 1MB - 128K */ +#define CFG_FLASH_SECTOR_BUFFER_SIZE (128*1024) + +/* + * The flash staging buffer is where we store a flash image before we write + * it to the flash. It's too big for the heap. + */ + +#define CFG_FLASH_STAGING_BUFFER_ADDR (1*1024*1024) +#define CFG_FLASH_STAGING_BUFFER_SIZE (1*1024*1024) diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/dev_bcm63xx_eth.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/dev_bcm63xx_eth.h new file mode 100755 index 0000000..7432231 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/dev_bcm63xx_eth.h @@ -0,0 +1,127 @@ +/* +<:copyright-broadcom + + Copyright (c) 2002 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +#ifndef __BCM63XX_ETH_H +#define __BCM63XX_ETH_H + +#include "bcm_hwdefs.h" +#include "bcm_map.h" +#include "boardparms.h" + +// from linux if_ether.h +#define ETH_ALEN 6 /* Octets in one ethernet addr */ +#define ETH_HLEN 14 /* Total octets in header. */ +#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ +#define ETH_DATA_LEN 1500 /* Max. octets in payload */ +#define ETH_CRC_LEN 4 /* CRC length */ +// end if_ether.h + +/*---------------------------------------------------------------------*/ +/* specify number of BDs and buffers to use */ +/*---------------------------------------------------------------------*/ +#define NR_TX_BDS 20 +#define NR_RX_BDS 20 +#define ENET_MAX_MTU_SIZE 1522 /* Body(1500) + EH_SIZE(14) + FCS(4) + VLAN(4) */ +#define DMA_MAX_BURST_LENGTH 8 /* in 64 bit words */ +#define ENET_BUF_SIZE ((ENET_MAX_MTU_SIZE + 63) & ~63) +#define DMA_FC_THRESH_LO 5 +#define DMA_FC_THRESH_HI 10 +#define EMAC_TX_WATERMARK 32 + +#define MAKE4(x) ((x[3] & 0xFF) | ((x[2] & 0xFF) << 8) | ((x[1] & 0xFF) << 16) | ((x[0] & 0xFF) << 24)) +#define MAKE2(x) ((x[1] & 0xFF) | ((x[0] & 0xFF) << 8)) + + +#define ERROR(x) xsprintf x +#ifndef ASSERT +#define ASSERT(x) if (x); else ERROR(("assert: "__FILE__" line %d\n", __LINE__)); +#endif + +//#define DUMP_TRACE + +#if defined(DUMP_TRACE) +#define TRACE (x) xprintf x +#else +#define TRACE(x) +#endif + +typedef struct PM_Addr { + uint16 valid; /* 1 indicates the corresponding address is valid */ + unsigned char dAddr[ETH_ALEN];/* perfect match register's destination address */ + unsigned int ref; /* reference count */ +} PM_Addr; +#define MAX_PMADDR 4 /* # of perfect match address */ + +#define NUM_PORTS 1 + +typedef struct gpio_reg_addrs_t { + volatile uint16 *gpio_direction_reg;/* GPIO direction register */ + volatile uint16 *gpio_value_reg; /* GPIO value register */ +} gpio_reg_addrs_t; + +typedef struct ethsw_info_t { + gpio_reg_addrs_t sbh; + uint32 ssl, clk, mosi, miso; /* GPIO mapping */ + int cid, page; /* Current chip ID and page */ +} ethsw_info_t; + +typedef struct bcmenet_softc { + + volatile DmaRegs *dmaCtrl; + + /* transmit variables */ + volatile DmaChannelCfg *txDma; /* location of transmit DMA register set */ + volatile DmaDesc *txBds; /* Memory location of tx Dma BD ring */ + volatile DmaDesc *txFirstBdPtr; /* ptr to first allocated Tx BD */ + volatile DmaDesc *txNextBdPtr; /* ptr to next Tx BD to transmit with */ + volatile DmaDesc *txLastBdPtr; /* ptr to last allocated Tx BD */ + + /* receive variables */ + volatile DmaChannelCfg *rxDma; /* location of receive DMA register set */ + volatile DmaDesc *rxBds; /* Memory location of rx bd ring */ + volatile DmaDesc *rxFirstBdPtr; /* ptr to first allocated rx bd */ + volatile DmaDesc *rxBdReadPtr; /* ptr to next rx bd to be processed */ + volatile DmaDesc *rxLastBdPtr; /* ptr to last allocated rx bd */ + + uint32_t rxBuffers; + uint32_t txBuffers; + + uint16 chipId; /* chip's id */ + uint16 chipRev; /* step */ + uint8_t hwaddr[ETH_ALEN]; + ethsw_info_t ethSwitch; /* external switch */ + ETHERNET_MAC_INFO EnetInfo; + uint32_t dmaPort; + uint32_t linkCheck; +} bcmenet_softc; + + + +#define IncRxBdPtr(x, s) if (x == ((bcmenet_softc *)s)->rxLastBdPtr) \ + x = ((bcmenet_softc *)s)->rxBds; \ + else x++ +#define InctxBdPtr(x, s) if (x == ((bcmenet_softc *)s)->txLastBdPtr) \ + x = ((bcmenet_softc *)s)->txBds; \ + else x++ + +// extern and function prototype + +extern int32_t _getticks(void); + +#ifdef DUMP_DATA +static void hexdump( unsigned char * src, int srclen, int rowlen, int rows ); +#endif + +#endif // __BCM63XX_ETH_H diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/dev_bcm63xx_flash.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/dev_bcm63xx_flash.h new file mode 100755 index 0000000..d8e7f1d --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/dev_bcm63xx_flash.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Broadcom Corp. Confidential + * Copyright 2001 Broadcom Corp. All Rights Reserved. + * + * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED + * SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM. + * YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT + * SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. + * + *************************************************************************** + * File Name : dev_bcm63xx_flash.h + * + * Created on : 04/18/2002 seanl + ***************************************************************************/ + +#if !defined(_DEV_BCM63XX_FLASH_) +#define _DEV_BCM63XX_FLASH_ + +#include "bcmtypes.h" +#include "bcm_hwdefs.h" + +// Used for images that do not contain a FILE_TAG record. +#define FLASH_IMAGE_START_ADDR (FLASH_BASE + FLASH_LENGTH_BOOT_ROM) + +// FLASH_ADDR_INFO is now defined in flash_common.h +#include "flash_common.h" + +extern void kerSysFlashInit(void); +extern void kerSysFlashAddrInfoGet(PFLASH_ADDR_INFO pflash_addr_info); +extern int kerSysNvRamSet(unsigned char *string,int strLen,int offset); +extern int kerSysNvRamGet(unsigned char *string,int strLen,int offset); +extern int kerSysBcmImageSet( int flash_start_addr, unsigned char *string, int size, int fWholeImage); +extern int kerSysErasePsi(void); +extern int kerSysEraseNvRam(void); +extern unsigned long kerSysReadFromFlash(void *toaddr, unsigned long fromaddr, unsigned long len); + +#endif /* _DEV_BCM63XX_FLASH_ */ + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/include/jffs2.h b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/jffs2.h new file mode 100755 index 0000000..586fb55 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/include/jffs2.h @@ -0,0 +1,251 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001-2003 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in the + * jffs2 directory. + * + * $Id: jffs2.h,v 1.38 2005/09/26 11:37:23 havasi Exp $ + * + */ + +#ifndef __LINUX_JFFS2_H__ +#define __LINUX_JFFS2_H__ + +//include + +/* You must include something which defines the C99 uintXX_t types. + We don't do it from here because this file is used in too many + different environments. */ + +/* Values we may expect to find in the 'magic' field */ +#define JFFS2_OLD_MAGIC_BITMASK 0x1984 +#define JFFS2_MAGIC_BITMASK 0x1985 +#define KSAMTIB_CIGAM_2SFFJ 0x8519 /* For detecting wrong-endian fs */ +#define JFFS2_EMPTY_BITMASK 0xffff +#define JFFS2_DIRTY_BITMASK 0x0000 + +#if defined(CONFIG_MTD_BRCMNAND) +/* JFFS2 eraseblock header compat/incompat/rocompat features set */ +#define JFFS2_EBH_COMPAT_FSET 0x00 +#define JFFS2_EBH_INCOMPAT_FSET 0x00 +#define JFFS2_EBH_ROCOMPAT_FSET 0x00 +#endif + +/* Summary node MAGIC marker */ +#define JFFS2_SUM_MAGIC 0x02851885 + +/* We only allow a single char for length, and 0xFF is empty flash so + we don't want it confused with a real length. Hence max 254. +*/ +#define JFFS2_MAX_NAME_LEN 254 + +/* How small can we sensibly write nodes? */ +#define JFFS2_MIN_DATA_LEN 128 + +#define JFFS2_COMPR_NONE 0x00 +#define JFFS2_COMPR_ZERO 0x01 +#define JFFS2_COMPR_RTIME 0x02 +#define JFFS2_COMPR_RUBINMIPS 0x03 +#define JFFS2_COMPR_COPY 0x04 +#define JFFS2_COMPR_DYNRUBIN 0x05 +#define JFFS2_COMPR_ZLIB 0x06 +/* Compatibility flags. */ +#define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ +#define JFFS2_NODE_ACCURATE 0x2000 +/* INCOMPAT: Fail to mount the filesystem */ +#define JFFS2_FEATURE_INCOMPAT 0xc000 +/* ROCOMPAT: Mount read-only */ +#define JFFS2_FEATURE_ROCOMPAT 0x8000 +/* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */ +#define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000 +/* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */ +#define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000 + +#define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1) +#define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2) +#define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) +#define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4) + +#define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6) + +#define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8) +#define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9) + +#if defined(CONFIG_MTD_BRCMNAND) +#define JFFS2_NODETYPE_ERASEBLOCK_HEADER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 5) +#endif + +/* XATTR Related */ +#define JFFS2_XPREFIX_USER 1 /* for "user." */ +#define JFFS2_XPREFIX_SECURITY 2 /* for "security." */ +#define JFFS2_XPREFIX_ACL_ACCESS 3 /* for "system.posix_acl_access" */ +#define JFFS2_XPREFIX_ACL_DEFAULT 4 /* for "system.posix_acl_default" */ +#define JFFS2_XPREFIX_TRUSTED 5 /* for "trusted.*" */ + +#define JFFS2_ACL_VERSION 0x0001 + +// Maybe later... +//#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) +//#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) + + +#define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at + mount time, don't wait for it to + happen later */ +#define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific + compression type */ + + +/* These can go once we've made sure we've caught all uses without + byteswapping */ + +typedef struct { + uint32_t v32; +} __attribute__((packed)) jint32_t; + +typedef struct { + uint32_t m; +} __attribute__((packed)) jmode_t; + +typedef struct { + uint16_t v16; +} __attribute__((packed)) jint16_t; + +struct jffs2_unknown_node +{ + /* All start like this */ + jint16_t magic; + jint16_t nodetype; + jint32_t totlen; /* So we can skip over nodes we don't grok */ + jint32_t hdr_crc; +}; + +struct jffs2_raw_dirent +{ + jint16_t magic; + jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t pino; + jint32_t version; + jint32_t ino; /* == zero for unlink */ + jint32_t mctime; + uint8_t nsize; + uint8_t type; + uint8_t unused[2]; + jint32_t node_crc; + jint32_t name_crc; + uint8_t name[0]; +}; + +/* The JFFS2 raw inode structure: Used for storage on physical media. */ +/* The uid, gid, atime, mtime and ctime members could be longer, but + are left like this for space efficiency. If and when people decide + they really need them extended, it's simple enough to add support for + a new type of raw node. +*/ +struct jffs2_raw_inode +{ + jint16_t magic; /* A constant magic number. */ + jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */ + jint32_t totlen; /* Total length of this node (inc data, etc.) */ + jint32_t hdr_crc; + jint32_t ino; /* Inode number. */ + jint32_t version; /* Version number. */ + jmode_t mode; /* The file's type or mode. */ + jint16_t uid; /* The file's owner. */ + jint16_t gid; /* The file's group. */ + jint32_t isize; /* Total resultant size of this inode (used for truncations) */ + jint32_t atime; /* Last access time. */ + jint32_t mtime; /* Last modification time. */ + jint32_t ctime; /* Change time. */ + jint32_t offset; /* Where to begin to write. */ + jint32_t csize; /* (Compressed) data size */ + jint32_t dsize; /* Size of the node's data. (after decompression) */ + uint8_t compr; /* Compression algorithm used */ + uint8_t usercompr; /* Compression algorithm requested by the user */ + jint16_t flags; /* See JFFS2_INO_FLAG_* */ + jint32_t data_crc; /* CRC for the (compressed) data. */ + jint32_t node_crc; /* CRC for the raw inode (excluding data) */ + uint8_t data[0]; +}; + +struct jffs2_raw_xattr { + jint16_t magic; + jint16_t nodetype; /* = JFFS2_NODETYPE_XATTR */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t xid; /* XATTR identifier number */ + jint32_t version; + uint8_t xprefix; + uint8_t name_len; + jint16_t value_len; + jint32_t data_crc; + jint32_t node_crc; + uint8_t data[0]; +} __attribute__((packed)); + +struct jffs2_raw_xref +{ + jint16_t magic; + jint16_t nodetype; /* = JFFS2_NODETYPE_XREF */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t ino; /* inode number */ + jint32_t xid; /* XATTR identifier number */ + jint32_t xseqno; /* xref sequencial number */ + jint32_t node_crc; +} __attribute__((packed)); + +struct jffs2_raw_summary +{ + jint16_t magic; + jint16_t nodetype; /* = JFFS2_NODETYPE_SUMMARY */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t sum_num; /* number of sum entries*/ + jint32_t cln_mkr; /* clean marker size, 0 = no cleanmarker */ + jint32_t padded; /* sum of the size of padding nodes */ + jint32_t sum_crc; /* summary information crc */ + jint32_t node_crc; /* node crc */ + jint32_t sum[0]; /* inode summary info */ +}; + +#if defined(CONFIG_MTD_BRCMNAND) +struct jffs2_raw_ebh +{ + jint16_t magic; + jint16_t nodetype; /* == JFFS2_NODETYPE_ERASEBLOCK_HEADER */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t node_crc; + uint8_t reserved; /* reserved for future use and alignment */ + uint8_t compat_fset; + uint8_t incompat_fset; + uint8_t rocompat_fset; + jint32_t erase_count; /* the erase count of this erase block */ + jint32_t data[0]; +} __attribute__((packed)); +#endif + +union jffs2_node_union +{ + struct jffs2_raw_inode i; + struct jffs2_raw_dirent d; + struct jffs2_raw_xattr x; + struct jffs2_raw_xref r; + struct jffs2_raw_summary s; + struct jffs2_unknown_node u; +}; + +/* Data payload for device nodes. */ +union jffs2_device_node { + jint16_t old; + jint32_t new; +}; + +#endif /* __LINUX_JFFS2_H__ */ diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/Makefile b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/Makefile new file mode 100755 index 0000000..7320c9d --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/Makefile @@ -0,0 +1,55 @@ +BSPOBJS += \ + dev_bcm63xx_eth.o \ + dev_bcm63xx_uart.o \ + dev_bcm63xx_flash.o \ + flash_api.o \ + flash_common.o \ + bcm63xx_ram_boot.o \ + bcm63xx_devs.o \ + bcm63xx_board.o \ + bcm63xx_cmd.o \ + bcm63xx_util.o \ + bcm63xx_ldr_raw.o \ + bcm63xx_ldr_elf.o \ + bcm63xx_main.o \ + bcm63xx_env_subr.o \ + bcm63xx_net_icmp.o \ + bcm63xx_httpd.o \ + bcmSpiRes.o \ + bcmLegSpi.o \ + boardparms.o \ + boardparms_voice.o + +ifneq ($(strip $(BRCM_CHIP)),6368) +BSPOBJS += \ + bcmHsSpi.o +endif + +BSPOBJS += \ + robosw_reg.o + +ifeq ($(strip ${INC_CFI_FLASH_DRIVER}),1) +BSPOBJS += \ + cfiflash.o +endif + +ifeq ($(strip ${INC_SPI_FLASH_DRIVER}),1) +BSPOBJS += \ + spiflash.o +endif + +ifeq ($(strip ${INC_SPI_PROG_NAND}),1) +BSPOBJS += \ + nandflash.o +endif + +ifeq ($(strip ${INC_NAND_FLASH_DRIVER}),1) +BSPOBJS += \ + nandflash.o +endif + +ifeq ($(strip ${CFG_WEB_SERVER}),1) +BSPOBJS += \ + ul.o \ + ulinfo.o +endif diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_board.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_board.c new file mode 100755 index 0000000..5baa66c --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_board.c @@ -0,0 +1,830 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * bcm63xx_board.c utility functions for bcm63xx board + * + * Created on : 09/25/2002 seanl + * + ********************************************************************* + +<:copyright-broadcom + + Copyright (c) 2002 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ + +#include "bcm63xx_util.h" +#include "foxconnCfg.h" + +#define MAX_BOARD_ID_NAMES 16 +#define MAX_VOICE_BOARD_ID_NAMES 20 + +static char g_boardIdNames[BP_BOARD_ID_LEN * MAX_BOARD_ID_NAMES]; +static int g_numBoardIdNames = 0; + +static char g_voiceBoardIdNames[BP_BOARD_ID_LEN * MAX_VOICE_BOARD_ID_NAMES]; +static int g_numVoiceBoardIdNames = 0; + +static int parsehwaddr(char *, uint8_t *); +static int parseBoardIdStr(char *); +static int parseVoiceBoardIdStr(char *); +static int parsePsiSize(char *); +static int parseBackupPsi(char *tpStr); +static int parseSyslogSize(char *tpStr); +static int parseMainTp(char *); +static int parseMacAddrCount(char *); +static int parseMacAddr(char *); +static int charIsHex(char ch); +static int parseGponSN(char *snStr); +static int parseGponPW(char *pwStr); +static int macNumToStr(unsigned char *, char *); +static void getGponBoardParam(void); +static int gponParamsInitialized(NVRAM_DATA *pNvramData); + +static int parseWpsDevicePin(char *pinStr); +static void getWpsDevicePinBoardParam(void); +#define PARAM_IDX_BOARD_NAME 0 +#define PARAM_IDX_NUM_MAC_ADDR 1 +#define PARAM_IDX_BASE_MAC_ADDR 2 +#define PARAM_IDX_PSI_SIZE 3 +#define PARAM_IDX_ENABLE_BACKUP_PSI 4 +#define PARAM_IDX_SYSLOG_SIZE 5 +#define PARAM_IDX_MAIN_THREAD_NUM 6 + +#define PARAM_IDX_GPON_SN 0 +#define PARAM_IDX_GPON_PW 1 + +#define PARAM_IDX_WPS_DEVICE_PIN 0 + +#define PARAM_IDX_VOICE_BOARD_NAME 0 + +static PARAMETER_SETTING gBoardParam[] = +{ + // prompt name Error Prompt Define Param Validation function + {"Board Id (0-# :", BOARDID_STR_PROMPT, "", "", 2, + parseBoardIdStr, TRUE}, + {"Number of MAC Addresses (1-32) :", MAC_CT_PROMPT, "", "", 2, + parseMacAddrCount, TRUE}, + {"Base MAC Address :", MAC_ADDR_PROMPT, "", "", 17, + parseMacAddr, TRUE}, + {"PSI Size (1-64) KBytes :", PSI_SIZE_PROMPT, "", "", 2, + parsePsiSize, TRUE}, + {"Enable Backup PSI [0|1] :", BACKUP_PSI_PROMPT, "", "", 1, + parseBackupPsi, TRUE}, + {"System Log Size (0-256) KBytes :", SYSLOG_SIZE_PROMPT, "", "", 3, + parseSyslogSize, TRUE}, + {"Main Thread Number [0|1] :", CPU_TP_PROMPT, "", "", 1, + parseMainTp, TRUE}, + {NULL} +}; + +static int gNumBoardParams = (sizeof(gBoardParam) / sizeof(PARAMETER_SETTING))-1; + +static PARAMETER_SETTING gGponBoardParam[] = +{ + // prompt name Error Prompt Define Param Validation function + {"GPON Serial Number :", GPON_SN_PROMPT, "", "", 12, + parseGponSN, TRUE}, + {"GPON Password :", GPON_PW_PROMPT, "", "", 10, + parseGponPW, TRUE}, + {NULL} +}; + +static int gNumGponBoardParams = (sizeof(gGponBoardParam) / sizeof(PARAMETER_SETTING))-1; +static int gGponParamsInitialized = 0; + + +static PARAMETER_SETTING gWpsDevicePinBoardParam[] = +{ + // prompt name Error Prompt Define Param Validation function + {"Device Pin :", WPS_DEVICE_PIN_PROMPT, "", "", 8, + parseWpsDevicePin, TRUE}, + {NULL} +}; + +static int gNumWpsDevicePinBoardParams = (sizeof(gWpsDevicePinBoardParam) / sizeof(PARAMETER_SETTING))-1; +static int gWpsDevicePinInitialized = 0; + +static PARAMETER_SETTING gVoiceBoardParam[] = +{ + // prompt name Error Prompt Define Param Validation function + {"Voice Board Configuration (0-# :", BOARDID_STR_PROMPT, "", "", 2, + parseVoiceBoardIdStr, FALSE}, + {NULL} +}; + +static int gNumVoiceBoardParams = (sizeof(gVoiceBoardParam) / sizeof(PARAMETER_SETTING))-1; +static int gVoiceParamsInitialized = 0; + + +static int parsehwaddr(char *str,uint8_t *hwaddr) +{ + int digit1,digit2; + int idx = 6; + + if (strlen(str) == (MAX_MAC_STR_LEN - 7)) { // no ':' mac input format ie. 021800100801 + while (*str && (idx > 0)) { + digit1 = parsexdigit(*str); + if (digit1 < 0) + return -1; + str++; + if (!*str) + return -1; + digit2 = parsexdigit(*str); + if (digit2 < 0) + return -1; + *hwaddr++ = (digit1 << 4) | digit2; + idx--; + str++; + } + return 0; + } + + if (strlen(str) != MAX_MAC_STR_LEN-2) + return -1; + if (*(str+2) != ':' || *(str+5) != ':' || *(str+8) != ':' || *(str+11) != ':' || *(str+14) != ':') + return -1; + + while (*str && (idx > 0)) { + digit1 = parsexdigit(*str); + if (digit1 < 0) + return -1; + str++; + if (!*str) + return -1; + + if (*str == ':') { + digit2 = digit1; + digit1 = 0; + } + else { + digit2 = parsexdigit(*str); + if (digit2 < 0) + return -1; + str++; + } + + *hwaddr++ = (digit1 << 4) | digit2; + idx--; + + if (*str == ':') + str++; + } + return 0; +} + + +static int parseMacAddr(char * macStr) +{ + unsigned char tmpBuf[MAX_PROMPT_LEN]; + + return (parsehwaddr(macStr, tmpBuf)); +} + + +static int parseBoardIdStr(char *boardIdStr) +{ + int ret = 1; + int boardId; + + if (strlen (boardIdStr) != 0) { + boardId = atoi(boardIdStr); + if (boardId >= 0 && boardId < g_numBoardIdNames) + ret = 0; + } + + return ret; +} + + +static int parseVoiceBoardIdStr(char *boardIdStr) +{ + int ret = 1; + int boardId; + + if (strlen (boardIdStr) != 0) { + boardId = atoi(boardIdStr); + if (boardId >= 0 && boardId < g_numVoiceBoardIdNames) + ret = 0; + } + + return ret; +} + + +static int parseMacAddrCount(char *ctStr) +{ + int count = atoi(ctStr); + + if (count >= 1 && count <= NVRAM_MAC_COUNT_MAX) + return 0; + else + return 1; +} + +static int parsePsiSize(char *tpStr) +{ + int psiSize = atoi(tpStr); + + if (psiSize >= 1 && psiSize <= NVRAM_MAX_PSI_SIZE) + return 0; + else + return 1; +} + +static int parseBackupPsi(char *tpStr) +{ + int enable = atoi(tpStr); + + if (enable == 0 || enable == 1) + return 0; + else + return 1; +} + +static int parseSyslogSize(char *tpStr) +{ + int syslogSize = atoi(tpStr); + + if (syslogSize >= 0 && syslogSize <= NVRAM_MAX_SYSLOG_SIZE) + return 0; + else + return 1; +} + + +static int parseMainTp(char *tpStr) +{ + int tpNum = atoi(tpStr); + + if (tpNum == 0 || tpNum == 1) + return 0; + else + return 1; +} + +static int charIsHex(char ch) +{ + if (((ch >= '0') && (ch <= '9')) || + ((ch >= 'a') && (ch <= 'f')) || + ((ch >= 'A') && (ch <= 'F'))) + return 1; + else + return 0; +} + +static int parseGponSN(char *snStr) +{ + int i; + int ret = 0; + + if(strlen(snStr) == NVRAM_GPON_SERIAL_NUMBER_LEN-1) { + for(i=4; igponSerialNumber[i] != (char)0xFF) && + (pNvramData->gponSerialNumber[i] != '\0')) { + erased = 0; + break; + } + } + + if(erased) { + for(i=0; igponPassword[i] != (char)0xFF) && + (pNvramData->gponPassword[i] != '\0')) { + erased = 0; + break; + } + } + } + + return (erased) ? 0 : 1; +} + +static void getGponBoardParam(void) +{ + NVRAM_DATA nvramData; + int erased; + int i; + int writeNvram = 0; + + readNvramData(&nvramData); + + erased = 1; + for(i=0; iwpsDevicePin[i]) > 0x39) || + ( (unsigned char)(pNvramData->wpsDevicePin[i]) < 0x30) ) { + return 0; + } + } + + return 1; +} + +static void getWpsDevicePinBoardParam(void) +{ + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + + if ( gWpsDevicePinParamsInitialized( &nvramData) ) { + memcpy(gWpsDevicePinBoardParam[PARAM_IDX_WPS_DEVICE_PIN].parameter, + nvramData.wpsDevicePin, NVRAM_WPS_DEVICE_PIN_LEN); + (gWpsDevicePinBoardParam[PARAM_IDX_WPS_DEVICE_PIN].parameter)[NVRAM_WPS_DEVICE_PIN_LEN] = + '\0'; + } + else { + /*Set Default Device Pin*/ + memcpy(nvramData.wpsDevicePin, DEFAULT_WPS_DEVICE_PIN, NVRAM_WPS_DEVICE_PIN_LEN); + writeNvramData(&nvramData); + + memcpy(gWpsDevicePinBoardParam[PARAM_IDX_WPS_DEVICE_PIN].parameter, + nvramData.wpsDevicePin, + NVRAM_WPS_DEVICE_PIN_LEN); + (gWpsDevicePinBoardParam[PARAM_IDX_WPS_DEVICE_PIN].parameter)[NVRAM_WPS_DEVICE_PIN_LEN] = + '\0'; + } + +} + +int setWpsDevicePinBoardParam(void) +{ + NVRAM_DATA nvramData; + int ret = 0; + + getWpsDevicePinBoardParam(); + + readNvramData(&nvramData); + + if (processPrompt(gWpsDevicePinBoardParam, gNumWpsDevicePinBoardParams)) { + memcpy(nvramData.wpsDevicePin, + gWpsDevicePinBoardParam[PARAM_IDX_WPS_DEVICE_PIN].parameter, + NVRAM_WPS_DEVICE_PIN_LEN); + // save the buf to nvram + writeNvramData(&nvramData); + ret = 1; + } + + return ret; +} + + +static int voiceParamsInitialized(NVRAM_DATA *pNvramData) +{ + int rc = 0; + NVRAM_DATA nvramData; + readNvramData(&nvramData); + + if ( BpSetBoardId(nvramData.szBoardId) == BP_SUCCESS ) { + if ( BpGetVoipDspConfig( 0 ) == NULL ) { + gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].enabled = FALSE; + } + else { + gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].enabled = TRUE; + rc = 1; + } + } + + return rc; +} + +static void getVoiceBoardParam(void) +{ + NVRAM_DATA nvramData; + char *ptr; + char tmp[10]; + + if (g_numVoiceBoardIdNames == 0) + g_numVoiceBoardIdNames = BpGetVoiceBoardIds(g_voiceBoardIdNames, MAX_VOICE_BOARD_ID_NAMES); + + ptr = strchr(gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].promptName, '#'); + if (ptr != NULL) { + sprintf(tmp, "%d)", g_numVoiceBoardIdNames - 1); + memcpy(ptr, tmp, strlen(tmp)); + } + + readNvramData(&nvramData); + + memcpy(gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].parameter, nvramData.szVoiceBoardId, NVRAM_BOARD_ID_STRING_LEN); + gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].parameter[NVRAM_BOARD_ID_STRING_LEN] = '\0'; +} + +int setVoiceBoardParam(void) +{ + NVRAM_DATA nvramData; + char voiceBoardIdPrompt[1000]; + int i; + char tmp[3]; + char *voiceBoardIdPromptPtr, *savedVoiceBoardIdPromptPtr; + int ret = 0; + + getVoiceBoardParam(); + + readNvramData(&nvramData); + + // Create prompt string with voice board ID name selection + voiceBoardIdPromptPtr = voiceBoardIdPrompt; + for (i = 0; i < g_numVoiceBoardIdNames; i++) { + sprintf (tmp, "%d", i); + sprintf (voiceBoardIdPromptPtr, "%-17s-- %2s\n", &g_voiceBoardIdNames[i * BP_BOARD_ID_LEN], tmp); + voiceBoardIdPromptPtr += strlen(voiceBoardIdPromptPtr); + } + strcpy (voiceBoardIdPromptPtr, gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].promptName); + + // Save existing prompt string + savedVoiceBoardIdPromptPtr = gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].promptName; + // Set newly created prompt string + gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].promptName = voiceBoardIdPrompt; + + // Convert board ID string to numeric value + for (i = 0; i < g_numVoiceBoardIdNames; i++) { + if (!strcmp(gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].parameter, &g_voiceBoardIdNames[i * BP_BOARD_ID_LEN])) { + sprintf(gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].parameter, "%d", i); + } + } + + if (processPrompt(gVoiceBoardParam, gNumVoiceBoardParams)) { + // At least one field was changed + i = atoi(gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].parameter); + strcpy(nvramData.szVoiceBoardId, &g_voiceBoardIdNames[i * BP_BOARD_ID_LEN]); + + // save the buf to nvram + writeNvramData(&nvramData); + ret = 1; + } + + // Convert numeric value of voice board ID to string + gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].promptName = savedVoiceBoardIdPromptPtr; + i = atoi(gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].parameter); + strcpy(gVoiceBoardParam[PARAM_IDX_VOICE_BOARD_NAME].parameter, &g_voiceBoardIdNames[i * BP_BOARD_ID_LEN]); + + return ret; +} + + +// +// getBoardParam: convert the board param data and put them in the gBoardParam struct +// +int getBoardParam(void) +{ + NVRAM_DATA nvramData; + char *ptr; + char tmp[10]; + int ret = 0; + + if (g_numBoardIdNames == 0) + g_numBoardIdNames = BpGetBoardIds(g_boardIdNames, MAX_BOARD_ID_NAMES); + + ptr = strchr(gBoardParam[PARAM_IDX_BOARD_NAME].promptName, '#'); + if (ptr != NULL) { + sprintf(tmp, "%d)", g_numBoardIdNames - 1); + memcpy(ptr, tmp, strlen(tmp)); + } + + readNvramData(&nvramData); + + if(!gGponParamsInitialized) { + gGponParamsInitialized = gponParamsInitialized(&nvramData); + } + + /*WPS Device Pin Initialized?*/ + if(!gWpsDevicePinInitialized) { + gWpsDevicePinInitialized = gWpsDevicePinParamsInitialized(&nvramData); + } + + if (nvramData.ulVersion == -1) { + // Set default values + nvramData.ulVersion = NVRAM_VERSION_NUMBER; + nvramData.szBoardId[0] = '\0'; + nvramData.ulNumMacAddrs = DEFAULT_MAC_NUM; + parsehwaddr(DEFAULT_BOARD_MAC, nvramData.ucaBaseMacAddr); + nvramData.ulMainTpNum = DEFAULT_TP_NUM; + nvramData.szVoiceBoardId[0] = '\0'; + nvramData.ulPsiSize = DEFAULT_PSI_SIZE; + nvramData.backupPsi = 0; + nvramData.ulSyslogSize = 0; + writeNvramData(&nvramData); + } + else if (nvramData.ulVersion != NVRAM_VERSION_NUMBER) { + // When upgrading from older bootloader initialize new fields + printf("*** Upgrading NVRAM (version %d to version %d) ***\n\n", + nvramData.ulVersion, NVRAM_VERSION_NUMBER); + nvramData.ulVersion = NVRAM_VERSION_NUMBER; + if (nvramData.ulMainTpNum == -1) + nvramData.ulMainTpNum = DEFAULT_TP_NUM; + if ((nvramData.ulPsiSize == -1) || (nvramData.ulPsiSize == 0)) + nvramData.ulPsiSize = DEFAULT_PSI_SIZE; + nvramData.szVoiceBoardId[0] = '\0'; + if (nvramData.backupPsi == -1) + nvramData.backupPsi = 0; + if (nvramData.ulSyslogSize == -1) + nvramData.ulSyslogSize = 0; + writeNvramData(&nvramData); + ret = 1; + } + + gVoiceParamsInitialized = voiceParamsInitialized(&nvramData); + + // When backupPsi and syslog were introduced, the NVRAM version number + // was not bumped up. So convert -1 (unitialized) to 0 so it looks better. + if (nvramData.backupPsi == -1) + nvramData.backupPsi = 0; + if (nvramData.ulSyslogSize == -1) + nvramData.ulSyslogSize = 0; + + strcpy(gBoardParam[PARAM_IDX_BOARD_NAME].parameter, nvramData.szBoardId); + sprintf(gBoardParam[PARAM_IDX_NUM_MAC_ADDR].parameter, "%d", nvramData.ulNumMacAddrs); + macNumToStr(nvramData.ucaBaseMacAddr, gBoardParam[PARAM_IDX_BASE_MAC_ADDR].parameter); + sprintf(gBoardParam[PARAM_IDX_PSI_SIZE].parameter, "%d", nvramData.ulPsiSize); + sprintf(gBoardParam[PARAM_IDX_ENABLE_BACKUP_PSI].parameter, "%d", nvramData.backupPsi); + sprintf(gBoardParam[PARAM_IDX_SYSLOG_SIZE].parameter, "%d", nvramData.ulSyslogSize); + sprintf(gBoardParam[PARAM_IDX_MAIN_THREAD_NUM].parameter, "%d", nvramData.ulMainTpNum); + + return ret; +} + +/* Bob added start to set default board parameters, 11/01/2010 */ +int setDefaultBoardParam(void) +{ + NVRAM_DATA nvramData; + int ret = 0; + + if (getBoardParam()) { + /* New NVRAM version */ + return ret; + } + + readNvramData(&nvramData); + + { + // At least one field was changed + nvramData.ulVersion = NVRAM_VERSION_NUMBER; + strcpy(nvramData.szBoardId, "963281TAN"); + strcpy(nvramData.szFirmwareUpgradeBoardId, FOXCONN_BOARD_ID); + nvramData.ulNumMacAddrs = 10; + parsehwaddr("00:00:00:00:00:01", nvramData.ucaBaseMacAddr); + nvramData.ulPsiSize = 24; + nvramData.backupPsi = 0; + nvramData.ulSyslogSize = 0; + nvramData.ulMainTpNum = 0; + + // save the buf to nvram + writeNvramData(&nvramData); + ret = 1; + } + + return ret; +} +/* Bob added end to set default board parameters, 11/01/2010 */ + +// +// setBoardParam: Set the board Id string, mac addresses, psi size, etc... +// +int setBoardParam(void) +{ + char boardIdPrompt[1000]; + NVRAM_DATA nvramData; + int i; + char tmp[3]; + char *boardIdPromptPtr, *savedBoardIdPromptPtr; + int ret = 0; + + if (getBoardParam()) { + /* New NVRAM version */ + return ret; + } + + readNvramData(&nvramData); + + // Create prompt string with board ID name selection + boardIdPromptPtr = boardIdPrompt; + for (i = 0; i < g_numBoardIdNames; i++) { + sprintf (tmp, "%d", i); + sprintf (boardIdPromptPtr, "%-17s------- %2s\n", &g_boardIdNames[i * BP_BOARD_ID_LEN], tmp); + boardIdPromptPtr += strlen(boardIdPromptPtr); + } + strcpy (boardIdPromptPtr, gBoardParam[PARAM_IDX_BOARD_NAME].promptName); + + // Save existing prompt string + savedBoardIdPromptPtr = gBoardParam[PARAM_IDX_BOARD_NAME].promptName; + // Set newly created prompt string + gBoardParam[PARAM_IDX_BOARD_NAME].promptName = boardIdPrompt; + + // Convert board ID string to numeric value + for (i = 0; i < g_numBoardIdNames; i++) { + if (!strcmp(gBoardParam[PARAM_IDX_BOARD_NAME].parameter, &g_boardIdNames[i * BP_BOARD_ID_LEN])) { + sprintf(gBoardParam[PARAM_IDX_BOARD_NAME].parameter, "%d", i); + } + } + + if (processPrompt(gBoardParam, gNumBoardParams)) { + // At least one field was changed + nvramData.ulVersion = NVRAM_VERSION_NUMBER; + + // Convert numeric value of board ID to string + i = atoi(gBoardParam[PARAM_IDX_BOARD_NAME].parameter); + strcpy(nvramData.szBoardId, &g_boardIdNames[i * BP_BOARD_ID_LEN]); + + nvramData.ulNumMacAddrs = atoi(gBoardParam[PARAM_IDX_NUM_MAC_ADDR].parameter); + parsehwaddr(gBoardParam[PARAM_IDX_BASE_MAC_ADDR].parameter, nvramData.ucaBaseMacAddr); + nvramData.ulPsiSize = atoi(gBoardParam[PARAM_IDX_PSI_SIZE].parameter); + nvramData.backupPsi = atoi(gBoardParam[PARAM_IDX_ENABLE_BACKUP_PSI].parameter); + nvramData.ulSyslogSize = atoi(gBoardParam[PARAM_IDX_SYSLOG_SIZE].parameter); + nvramData.ulMainTpNum = atoi(gBoardParam[PARAM_IDX_MAIN_THREAD_NUM].parameter); + + // save the buf to nvram + writeNvramData(&nvramData); + ret = 1; + } + + // restore gBoardParam + // Convert numeric value of board ID to string + gBoardParam[PARAM_IDX_BOARD_NAME].promptName = savedBoardIdPromptPtr; + i = atoi(gBoardParam[PARAM_IDX_BOARD_NAME].parameter); + strcpy(gBoardParam[PARAM_IDX_BOARD_NAME].parameter, &g_boardIdNames[i * BP_BOARD_ID_LEN]); + + if(gGponParamsInitialized) { + printf("\n"); + ret += setGponBoardParam(); + } + + if(gWpsDevicePinInitialized) { + printf("\n"); + ret += setWpsDevicePinBoardParam(); + } + + gVoiceParamsInitialized = voiceParamsInitialized(&nvramData); + + if(gVoiceParamsInitialized) { + printf("\n"); + ret += setVoiceBoardParam(); + } + + return ret; +} + +void displayBoardParam(void) +{ + int i; + + getBoardParam(); + + for (i = 0; i < gNumBoardParams; i++) { + if( gBoardParam[i].enabled ) + printf("%s %s \n", gBoardParam[i].promptName, gBoardParam[i].parameter); + } + + if(gGponParamsInitialized) { + getGponBoardParam(); + + for (i = 0; i < gNumGponBoardParams; i++) + if( gGponBoardParam[i].enabled ) + printf("%s \"%s\" \n", gGponBoardParam[i].promptName, gGponBoardParam[i].parameter); + } + + /*Show WPS Device PIN */ + if(gWpsDevicePinInitialized) { + getWpsDevicePinBoardParam(); + if ( gWpsDevicePinBoardParam[PARAM_IDX_WPS_DEVICE_PIN].enabled) + printf("%s \"%s\" \n", gWpsDevicePinBoardParam[PARAM_IDX_WPS_DEVICE_PIN].promptName, \ + gWpsDevicePinBoardParam[PARAM_IDX_WPS_DEVICE_PIN].parameter); + } + + if(gVoiceParamsInitialized) { + getVoiceBoardParam(); + + for (i = 0; i < gNumVoiceBoardParams; i++) + if( gVoiceBoardParam[i].enabled ) + printf("%s %s \n", gVoiceBoardParam[i].promptName, gVoiceBoardParam[i].parameter); + } +} diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_cmd.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_cmd.c new file mode 100755 index 0000000..111e73f --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_cmd.c @@ -0,0 +1,1878 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * + * bcm63xx board specific routines and commands. + * + * by: seanl + * + * April 1, 2002 + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "bcm63xx_util.h" +#include "flash_api.h" +#include "jffs2.h" + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#include "tftpd.h" + +#include "net_nmrp.h" + + +extern int nmrp_server_detected; +extern unsigned long cfe_sdramsize; +extern int ui_init_tftpdcmds(void); +int verify_checksum(char *buf, unsigned long buf_len, unsigned long chksum); +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +#define je16_to_cpu(x) ((x).v16) +#define je32_to_cpu(x) ((x).v32) +#define FLASH_STAGING_BUFFER BOARD_IMAGE_DOWNLOAD_ADDRESS +#define FLASH_STAGING_BUFFER_SIZE BOARD_IMAGE_DOWNLOAD_SIZE + +extern int decompressLZMA(unsigned char *in, unsigned insize, unsigned char *out, unsigned outsize); + +// global +int g_processing_cmd = 0; + +char fakeConsole[2] = " "; + +/* Foxconn add start by Jenny Zhao, 07/02/2008*/ +struct image_header +{ + unsigned long magic; /* magic */ + unsigned long header_len; /* Length of header */ + unsigned char reserved[8]; + unsigned long kernel_chksum; /* Kernel image chksum */ + unsigned long rootfs_chksum; /* rootfs image chksum */ + unsigned long kernel_len; /* Length of kernel */ + unsigned long rootfs_len; /* Length of rootfs */ + unsigned long image_chksum; /* checksum across length of image */ + unsigned long header_chksum; /* checksum across length of header */ +}; + +#define swap32(val) \ + ((unsigned int)( \ + (((unsigned int)(val) & (unsigned int)0x000000ffUL)) | \ + (((unsigned int)(val) & (unsigned int)0x0000ff00UL)) | \ + (((unsigned int)(val) & (unsigned int)0x00ff0000UL)) | \ + (((unsigned int)(val) & (unsigned int)0xff000000UL)) )) + +/* pling added 12/04/2008, define the Foxconn board ID length */ +#define FOXCONN_BOARD_ID_LEN 64 +/* Foxconn add end by Jenny Zhao, 07/02/2008*/ + +static int ui_cmd_set_board_param(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int ret = 0; + int i = 0; + int reset = 0; + + if(!argc) + { + reset += setBoardParam(); + } + + while(argc && !ret) + { + if(!strcmp(argv[i], "g")) + { + reset += setGponBoardParam(); + } + else { + /*Setup WPS Device Pin*/ + if(!strcmp(argv[i], "w")) + { + reset += setWpsDevicePinBoardParam(); + } + else + { + ret = -1; + } + } + + argc--; + i++; + } + + if(reset) + softReset(); + + return ret; +} + +static int ui_cmd_reset(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + softReset(); + return 0; +} + +// return 0 if 'y' +int yesno(void) +{ + char ans[5]; + + printf(" (y/n):"); + console_readline ("", ans, sizeof (ans)); + if (ans[0] != 'y') + return -1; + + return 0; +} + +// erase Persistent sector +static int ui_cmd_erase_psi(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + printf("Erase persisten storage data?"); + if (yesno()) + return -1; + + kerSysErasePsi(); + + return 0; +} + +static int ui_cmd_erase_nand(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + +#if (INC_NAND_FLASH_DRIVER==1) + char *flag; + int i, blk_end; + + flag = cmd_getarg(cmd,0); + + if (!flag) + { + printf("'e b' to reinitialize NAND flash or 'e a' to erase kernel\n"); + return 0; + } + + switch (*flag) + { + case 'b': + printf("Reinitialize NAND flash?"); + if (yesno()) + return 0; + printf("\nNow think carefully. Do you really,\n" + "really want to reinitialize the NAND flag?"); + if (yesno()) + return 0; + flash_sector_erase_int(NAND_REINIT_FLASH); + break; + case 'a': + printf("Erase NAND flash? The modem will not be able to boot from " + "flash"); + if (yesno()) + return 0; + + blk_end = flash_get_numsectors(); + for (i = 1; i < blk_end; i++) + { + printf("."); + flash_sector_erase_int(i); + } + printf("\n"); + break; + case 's': + { + extern void dump_spare(void); + dump_spare(); + } + break; + + case 'r': + { + extern unsigned char *mem_topofmem; + unsigned char *buf = (unsigned char *) mem_topofmem + 1024; + char *pszLen = cmd_getarg(cmd, 2); + int len = (pszLen) ? atoi(pszLen) : 64; + char *pszBlk = cmd_getarg(cmd, 1); + if( flash_read_buf(atoi(pszBlk), 0, buf, 16 * 1024) > 0 ) + { + void ui_dumpaddr( unsigned char *pAddr, int nLen ); + printf("block read into buffer at 0x%8.8lx\n", (unsigned long)buf); + ui_dumpaddr(buf, len); /* dump first few bytes */ + } + else + printf("block NOT read into buffer at 0x%8.8lx\n",(unsigned long)buf); + /* Can break into JTAG now to view entire block contents. */ + } + break; + default: + printf("Erase [n]vram, [p]ersistent storage or [a]ll flash except bootrom\nusage: e [n/p/a]\n"); + return 0; + } +#elif (INC_SPI_PROG_NAND==1) + char *flag; + int i, blk_end; + + flash_change_flash_type(FLASH_IFC_NAND); + + flag = cmd_getarg(cmd,0); + + if (!flag) + { + printf("'n b' to reinitialize NAND flash or 'n a' to erase kernel on NAND\n"); + goto finish; + } + + switch (*flag) + { + case 'b': + printf("Reinitialize NAND flash?"); + if (yesno()) + goto finish; + printf("\nNow think carefully. Do you really,\n" + "really want to reinitialize the NAND flag?"); + if (yesno()) + goto finish; + flash_sector_erase_int(NAND_REINIT_FLASH); + break; + case 'a': + printf("Erase NAND flash? The modem will not be able to boot from " + "flash"); + if (yesno()) + goto finish; + + blk_end = flash_get_numsectors(); + for (i = 1; i < blk_end; i++) + { + printf("."); + flash_sector_erase_int(i); + } + printf("\n"); + break; + case 's': + { + extern void dump_spare(void); + dump_spare(); + } + break; + + case 'r': + { + extern unsigned char *mem_topofmem; + unsigned char *buf = (unsigned char *) mem_topofmem + 1024; + char *pszBlk = cmd_getarg(cmd, 1); + if( flash_read_buf(atoi(pszBlk), 0, buf, 16 * 1024) > 0 ) + { + void ui_dumpaddr( unsigned char *pAddr, int nLen ); + printf("block read into buffer at 0x%8.8lx\n", (unsigned long)buf); + ui_dumpaddr(buf, 64); /* dump first few bytes */ + } + else + printf("block NOT read into buffer at 0x%8.8lx\n",(unsigned long)buf); + /* Can break into JTAG now to view entire block contents. */ + } + break; + default: + printf("Erase [n]vram, [p]ersistent storage or [a]ll flash except bootrom on NAND\nusage: n [n/p/a]\n"); + } +finish: + flash_change_flash_type(FLASH_IFC_SPI); + +#endif + + return 0; +} + +// erase some sectors +static int ui_cmd_erase(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + + //FILE_TAG cfeTag; + PFILE_TAG pTag; + char *flag; + int i, blk_start, blk_end; + + flag = cmd_getarg(cmd,0); + + if (!flag) + { + printf("Erase [n]vram, [p]ersistent storage or [a]ll flash except bootrom\nusage: e [n/p/a]\n"); + return 0; + } + + switch (*flag) + { + case 'b': + printf("Erase boot loader?"); + if (yesno()) + return 0; + printf("\nNow think carefully. Do you really,\n" + "really want to erase the boot loader?"); + if (yesno()) + return 0; + flash_sector_erase_int(0); + break; + case 'n': + printf("Erase nvram?"); + if (yesno()) + return 0; + kerSysEraseNvRam(); + softReset(); + break; + case 'a': + + printf("Erase all flash (except bootrom)?"); + if (yesno()) + return 0; + + blk_end = flash_get_numsectors(); + if ((pTag = getTagFromPartition(1)) != NULL) + blk_start = flash_get_blk(atoi(pTag->rootfsAddress) + BOOT_OFFSET); + else // just erase all after cfe + { + FLASH_ADDR_INFO flash_info; + + kerSysFlashAddrInfoGet(&flash_info); + for( blk_start = 0, i = 0; i 0 ) + { + for (i = blk_start; i < blk_end; i++) + { + printf("."); + flash_sector_erase_int(i); + } + printf("\n"); + } + + /* Preserve the NVRAM fields that are used in the 'b' command. */ + softReset(); + break; + case 'p': + ui_cmd_erase_psi(cmd,argc,argv); + break; + default: + printf("Erase [n]vram, [p]ersistent storage or [a]ll flash except bootrom\nusage: e [n/p/a]\n"); + return 0; + } + + return 0; +} + + +static int loadRaw(char *hostImageName, uint8_t *ptr) +{ + cfe_loadargs_t la; + int res; + + printf("Loading %s ...\n", hostImageName); + + // tftp only + la.la_filesys = "tftp"; + la.la_filename = hostImageName; + la.la_device = NULL; + la.la_address = (long)ptr; + la.la_options = NULL; + la.la_maxsize = FLASH_STAGING_BUFFER_SIZE; + la.la_flags = LOADFLG_SPECADDR; + + res = bcm63xx_cfe_rawload(&la); + if (res < 0) + { + ui_showerror(res, "Loading failed."); + return res; + } + printf("Finished loading %d bytes\n", res); + + return res; +} + +// flash the image +static int ui_cmd_flash_image(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char hostImageName[BOOT_FILENAME_LEN + BOOT_IP_LEN]; + char *imageName; + int res; + uint8_t *ptr = (uint8_t *) KERNADDR(FLASH_STAGING_BUFFER); + + g_processing_cmd = 1; + + imageName = cmd_getarg(cmd, 0); + + if (imageName) + { + if (strchr(imageName, ':')) + strcpy(hostImageName, imageName); + else + { + strcpy(hostImageName, bootInfo.hostIp); + strcat(hostImageName, ":"); + strcat(hostImageName, imageName); + } + } + else // use default flash file name + { + strcpy(hostImageName, bootInfo.hostIp); + strcat(hostImageName, ":"); + strcat(hostImageName, bootInfo.flashFileName); + } + + if ((res = loadRaw(hostImageName, ptr)) < 0) + { + g_processing_cmd = 0; + return res; + } + + // check and flash image + res = flashImage(ptr); + + if( res == 0 ) + { + char *p; + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + + for( p = nvramData.szBootline; p[2] != '\0'; p++ ) { + if( p[0] == 'r' && p[1] == '=' && p[2] == 'h' ) + { + /* Change boot source to "boot from flash". */ + p[2] = 'f'; + writeNvramData(&nvramData); + break; + } + } + softReset(); + } + + g_processing_cmd = 0; + return( res ); +} + +static int ui_cmd_write_chk_image(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char hostImageName[BOOT_FILENAME_LEN + BOOT_IP_LEN]; + char *imageName; + uint8_t *ptr = (uint8_t *) KERNADDR(FLASH_STAGING_BUFFER); + int res; + struct image_header *header; + unsigned long image_len, image_chksum; + + unsigned long header_len = 0; + unsigned long board_id_len = 0; + char board_id[FOX_BOARD_ID_MAX_LEN]; + uint8_t *tmp; + + g_processing_cmd = 1; + + imageName = cmd_getarg(cmd, 0); + if (!imageName) + return ui_showusage(cmd); + + if (strchr(imageName, ':')) + strcpy(hostImageName, imageName); + else + { + strcpy(hostImageName, bootInfo.hostIp); + strcat(hostImageName, ":"); + strcat(hostImageName, imageName); + } + + if ((res = loadRaw(hostImageName, ptr)) < 0) + { + g_processing_cmd = 0; + return res; + } + + /* check chk file */ + header = (struct image_header *)ptr; + header_len = swap32(header->header_len); + image_len = swap32(header->kernel_len); + image_chksum = swap32(header->kernel_chksum); + board_id_len = header_len - sizeof(struct image_header); + + memset(board_id, 0, sizeof(board_id)); + memcpy(board_id, header+1, board_id_len); + + printf("total:%d header:%d kernel:%d \n", res, header_len, image_len); + + tmp = ptr; + ptr += header_len; + res -= header_len; + + if (verify_checksum((char*)ptr, image_len, image_chksum)) { + printf("fail to comapre checksum ... \n "); + return CFE_ERR_BADIMAGE; + } + + memcpy(tmp, ptr, res); + + // check and flash image + res = writeWholeImage(tmp, res); + + printf("Finished flashing image.\n"); +/* + if (res == 0) + { + softReset(); + } +*/ + g_processing_cmd = 0; + return( res ); +} + +// write the whole image +static int ui_cmd_write_whole_image(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char hostImageName[BOOT_FILENAME_LEN + BOOT_IP_LEN]; + char *imageName; + uint8_t *ptr = (uint8_t *) KERNADDR(FLASH_STAGING_BUFFER); + int res; + + g_processing_cmd = 1; + + imageName = cmd_getarg(cmd, 0); + if (!imageName) + return ui_showusage(cmd); + + if (strchr(imageName, ':')) + strcpy(hostImageName, imageName); + else + { + strcpy(hostImageName, bootInfo.hostIp); + strcat(hostImageName, ":"); + strcat(hostImageName, imageName); + } + + if ((res = loadRaw(hostImageName, ptr)) < 0) + { + g_processing_cmd = 0; + return res; + } + + // check and flash image + res = writeWholeImage(ptr, res); + + printf("Finished flashing image.\n"); + + if (res == 0) + { + softReset(); + } + + g_processing_cmd = 0; + return( res ); +} + + +static int ui_cmd_flash_router_image(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char hostImageName[BOOT_FILENAME_LEN + BOOT_IP_LEN]; + char *imageName; + uint8_t *ptr = (uint8_t *) KERNADDR(FLASH_STAGING_BUFFER); + +#if (INC_NAND_FLASH_DRIVER==1) + uint8_t *tmp; +#endif + + int res; + + char board_id[FOX_BOARD_ID_MAX_LEN]; //Silver + int update=0; + char board_id_test[PROJECT_ID_LEN]; + +#if (INC_NAND_FLASH_DRIVER==1) + NVRAM_DATA nvramData; +#endif + + imageName = cmd_getarg(cmd, 0); + if (!imageName) + return ui_showusage(cmd); + + if (strchr(imageName, ':')) + strcpy(hostImageName, imageName); + else + { + strcpy(hostImageName, ""); + strcat(hostImageName, ":"); + strcat(hostImageName, ""); + } + + set_tftpd_state(TFTPD_STATE_WAIT_IMAGE); + if ((res = loadRaw(hostImageName, ptr)) < 0) { + printf("fail to load raw file ... \n"); + return res; + } + + if ( nmrp_server_detected == 0) + { + set_tftpd_state(TFTPD_STATE_OFF); // Foxconn added to turn on RED. + setPowerOnLedOn(); // Foxconn added to turn on RED. + } + + /* Foxconn add start by Jenny Zhao, 07/02/2008*/ + if (1) { + struct image_header *header; + unsigned long image_len, image_chksum; + + unsigned long header_len = 0; + unsigned long board_id_len = 0; + + header = (struct image_header *)ptr; + header_len = swap32(header->header_len); + image_len = swap32(header->kernel_len); + image_chksum = swap32(header->kernel_chksum); + /* Check Board ID first */ + board_id_len = header_len - sizeof(struct image_header); + memset(board_id, 0, sizeof(board_id)); + //for(i=0;i>> kerSysBcmImageSet= 0x%x\n", FLASH_IMAGE_START_ADDR); +#if (INC_NAND_FLASH_DRIVER==1) + memcpy(tmp, ptr, res); + if ((res = writeWholeImage(tmp, res) )!= 0) +#else + if ((res = kerSysBcmImageSet(FLASH_IMAGE_START_ADDR, ptr, res, 0)) != 0) +#endif + printf("Failed to flash image. Error: %d\n", res); + else + { + /* Foxconn added start, Silver Shih for burn board Id */ + if( strlen(board_id) < FOX_BOARD_ID_MAX_LEN) + { + if(strcmp(board_id_test, board_id) != 0) + //if (strcmp((char *)BOARD_DATA_ADDR, board_id) != 0) + { + //printf("board id not match, addr:0x%x\n", BOARD_DATA_ADDR); + //5 is indicated to burn board id +#if (INC_NAND_FLASH_DRIVER==0) + kerSysBcmImageSet(BOARD_DATA_ADDR, (unsigned char *)board_id, strlen(board_id)+1 , 5); +#endif + } + } + /* Foxconn added end, Silver Shih for burn board Id */ + + update=1; + printf("Finished flashing image in NMRP mode.\n"); + } + } + /* Foxconn added start pling 12/04/2008, for 'tftpd' */ +#if (INC_NAND_FLASH_DRIVER==0) + else if ((res = kerSysBcmImageSet(FLASH_IMAGE_START_ADDR, ptr, res, 0)) != 0) + printf("Failed to flash image. Error: %d\n", res); +#endif + else + printf("finishing flash image for flashimage command ... \n"); + + /* Foxconn added end pling 12/04/2008 */ + if (res == 0) + { + char *p; + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + + memcpy(nvramData.szFirmwareUpgradeBoardId, board_id, strlen(board_id)); + + for( p = nvramData.szBootline; p[2] != '\0'; p++ ) { + if( p[0] == 'r' && p[1] == '=' && p[2] == 'h' ) + { + /* Change boot source to "boot from flash". */ + p[2] = 'f'; + //writeNvramData(&nvramData); + break; + } + } + writeNvramData(&nvramData); + // softReset(); //remove by EricHuang + } + + if (nmrp_server_detected==1 && update==1) //NMRP mode + { + // Restore to factory default. + printf("try to restore to default, addr=0x%x\n", BOARD_FOXNVRAM_ADDR); +#if (INC_NAND_FLASH_DRIVER==0) + kerSysBcmImageSet(BOARD_FOXNVRAM_ADDR, (unsigned char *)"", 0x10000 , 5); +#endif + } + + return( res ); +} + +/************************************************************************ + * cfe_go(la) + * + * Starts a previously loaded program. cfe_loadargs.la_entrypt + * must be set to the entry point of the program to be started + * + * Input parameters: + * la - loader args + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_go(cfe_loadargs_t *la) +{ + if (la->la_entrypt == 0) { + xprintf("No program has been loaded.\n"); + return; + } + + if (net_getparam(NET_DEVNAME)) { + xprintf("Closing network.\n"); + net_uninit(); + } + + xprintf("Starting program at 0x%p\n",la->la_entrypt); + + setPowerOnLedOn(); + + cfe_start(la->la_entrypt); +} + +static int bootImage(char *fileSys, char *device, int zflag, char *imageName) +{ + cfe_loadargs_t la; + int res; + + // elf only + la.la_filesys = fileSys; + la.la_filename = imageName; + la.la_device = device; + la.la_options = 0; + la.la_maxsize = 0; + la.la_address = 0; + la.la_flags = zflag; + + res = bcm63xx_cfe_elfload(&la); + if (res != 0) + return res; + + if (la.la_flags & LOADFLG_NOISY) + xprintf("Entry at 0x%p\n",la.la_entrypt); + if ((la.la_flags & LOADFLG_EXECUTE) && (la.la_entrypt != 0)) { + cfe_go(&la); + } + + return res; +} + +// Compressed image head format in Big Endia: +// 1) Text Start address: 4 bytes +// 2) Program Entry point: 4 bytes +// 3) Compress image Length: 4 bytes +// 4) Compress data starts: compressed data +static int bootCompressedImage(unsigned int *puiCmpImage, int retry) +{ + unsigned char *pucSrc; + unsigned char *pucDst; + unsigned char *pucEntry; + unsigned int dataLen; + int ret = 0; + cfe_loadargs_t la; + + if( (unsigned long) puiCmpImage > FLASH_BASE ) + { + /* Boot compressed image from flash. */ + unsigned int *puiOrigCmpImage = puiCmpImage; + unsigned int *puiNewCmpImage = NULL; + unsigned int *puiOldCmpImage = NULL; + unsigned int *puiFs = NULL; + PFILE_TAG pTag1 = getTagFromPartition(1); + PFILE_TAG pTag2 = getTagFromPartition(2); + PFILE_TAG pCurTag = NULL; + unsigned int *puiImg= NULL; + int nImgLen = 0; + unsigned long ulCrc, ulImgCrc; + + if( pTag1 && pTag2 ) + { + /* Two images are on flash. Determine which one is being booted. */ + PFILE_TAG pNewTag = NULL; + PFILE_TAG pOldTag = NULL; + int seq1 = atoi(pTag1->imageSequence); + int seq2 = atoi(pTag2->imageSequence); + + if( seq1 > seq2 ) + { + pNewTag = pTag1; + pOldTag = pTag2; + } + else + { + pNewTag = pTag2; + pOldTag = pTag1; + } + + puiNewCmpImage = (unsigned int *) + (atoi(pNewTag->kernelAddress) + BOOT_OFFSET); + puiOldCmpImage = (unsigned int *) + (atoi(pOldTag->kernelAddress) + BOOT_OFFSET); + + if( puiOrigCmpImage == puiOldCmpImage ) + { + printf("Booting from previous image (0x%8.8lx) ...\n", + (unsigned long) atoi(pOldTag->rootfsAddress) + + BOOT_OFFSET - TAG_LEN); + pCurTag = pOldTag; + } + else + { + printf("Booting from latest image (0x%8.8lx) ...\n", + (unsigned long) atoi(pNewTag->rootfsAddress) + + BOOT_OFFSET - TAG_LEN); + pCurTag = pNewTag; + } + } + else + if( pTag1 || pTag2 ) + { + /* Only one image on flash. */ + pCurTag = (pTag1) ? pTag1 : pTag2; + printf("Booting from only image (0x%8.8lx) ...\n", + (unsigned long) atoi(pCurTag->rootfsAddress) + + BOOT_OFFSET - TAG_LEN); + } + else + { + /* No image on flash. */ + printf("No valid boot image\n"); + ret = -1; + } + + if( ret == 0 ) + { + /* Copy compressed image to SDRAM. */ + extern unsigned char *mem_topofmem; + FLASH_ADDR_INFO info; + unsigned char *pDest = (unsigned char *) mem_topofmem + 1024; + unsigned char *pImgEnd; + + kerSysFlashAddrInfoGet( &info ); + pImgEnd = flash_get_memptr( info.flash_meta_start_blk ); + kerSysReadFromFlash( pDest, (unsigned long) puiCmpImage, + (unsigned long) pImgEnd - (unsigned long) puiCmpImage ); + + puiCmpImage = (unsigned int *) pDest; + + /* Copy file system to SDRAM. */ + pDest += (unsigned long) pImgEnd - (unsigned long) + puiOrigCmpImage + 1024; + kerSysReadFromFlash( pDest, (unsigned long) + atoi(pCurTag->rootfsAddress) + BOOT_OFFSET, + atoi(pCurTag->rootfsLen)); + + puiFs = (unsigned int *) pDest; + + pucDst = (unsigned char *) *puiCmpImage; + pucEntry = (unsigned char *) *(puiCmpImage + 1); + dataLen = (unsigned int) *(puiCmpImage + 2); + pucSrc = (unsigned char*) (puiCmpImage + 3); + + printf("Code Address: 0x%08X, Entry Address: 0x%08x\n", + (unsigned int) pucDst, (unsigned int) pucEntry); + + + /* Check Linux file system CRC */ + ulImgCrc = *(unsigned long *) (pCurTag->imageValidationToken + + CRC_LEN); + if( ulImgCrc ) + { + if( puiFs ) + puiImg = puiFs; + else + { + puiImg = (unsigned int *) (atoi(pCurTag->rootfsAddress) + + BOOT_OFFSET); + } + nImgLen = atoi(pCurTag->rootfsLen); + + ulCrc = CRC32_INIT_VALUE; + ulCrc = getCrc32((unsigned char *) puiImg, (UINT32) nImgLen, ulCrc); + if( ulCrc != ulImgCrc) + { + printf("Linux file system CRC error. Corrupted image?\n"); + ret = -1; + } + } + + /* Check Linux kernel CRC */ + ulImgCrc = *(unsigned long *) (pCurTag->imageValidationToken + + (CRC_LEN * 2)); + if( ulImgCrc ) + { + puiImg = (unsigned int *) puiCmpImage; + nImgLen = atoi(pCurTag->kernelLen); + + ulCrc = CRC32_INIT_VALUE; + ulCrc = getCrc32((unsigned char *) puiImg, (UINT32) nImgLen, ulCrc); + if( ulCrc != ulImgCrc) + { + printf("Linux kernel CRC error. Corrupted image?\n"); + ret = -1; + } + } + + if( ret == 0 ) + { + ret = decompressLZMA(pucSrc, dataLen, pucDst, 23*1024*1024); + if (ret != 0) + printf("Failed to decompress image. Corrupted image?\n"); + } + + if (ret != 0) + { + /* Try to boot from the other flash image, if one exists. */ + if( retry == TRUE && pTag1 && pTag2 ) + { + int blk = 0; + unsigned char *pBase = flash_get_memptr(0); + unsigned int *flash_addr_kernel; + FLASH_ADDR_INFO flash_info; + + /* The boot image is bad. Erase the sector with the tag so + * the image is not tried in subsequent boots. + */ + kerSysFlashAddrInfoGet(&flash_info); + if( pCurTag == pTag1 ) + { + blk = flash_get_blk((int)(pBase + + flash_info.flash_rootfs_start_offset)); + } + else + if( pCurTag == pTag2 ) + { + blk = flash_get_blk((int) (pBase + + (flash_get_total_size()/2))); + } + + if( blk ) + flash_sector_erase_int(blk); + + /* Boot from the other flash image. */ + if( puiOrigCmpImage == puiOldCmpImage ) + flash_addr_kernel = puiNewCmpImage; + else + flash_addr_kernel = puiOldCmpImage; + + ret = bootCompressedImage( flash_addr_kernel, FALSE ); + } + } + else + { + printf("Decompression OK!\n"); + la.la_entrypt = (long) pucEntry; + printf("Entry at 0x%p\n",la.la_entrypt); + cfe_go(&la); // never return... + } + + } + } + else + { + /* Boot compressed image that was downloaded to RAM. */ + pucDst = (unsigned char *) *puiCmpImage; + pucEntry = (unsigned char *) *(puiCmpImage + 1); + dataLen = (unsigned int) *(puiCmpImage + 2); + pucSrc = (unsigned char*) (puiCmpImage + 3); + + printf("Code Address: 0x%08X, Entry Address: 0x%08x\n", + (unsigned int) pucDst, (unsigned int) pucEntry); + + ret = decompressLZMA(pucSrc, dataLen, pucDst, 23*1024*1024); + if (ret == 0) + { + printf("Decompression OK!\n"); + la.la_entrypt = (long) pucEntry; + printf("Entry at 0x%p\n",la.la_entrypt); + cfe_go(&la); // never return... + } + else + printf("Failed on decompression. Corrupted image?\n"); + } + + return ret; +} + +static int bootNandImageFromRootfs(int start_blk, int end_blk) +{ + extern unsigned char *mem_topofmem; + char fname[] = NAND_FLASH_BOOT_IMAGE_NAME; + int fname_len = strlen(fname); + int len = flash_get_sector_size(0); + unsigned char *buf = (unsigned char *) mem_topofmem + 1024; + unsigned char *pDest = (unsigned char *) buf + len; + unsigned long *pulDest = (unsigned long *) pDest; + unsigned char *p; + unsigned long version = 0; + unsigned long ino = 0; + int i, done; + struct jffs2_raw_dirent *pdir; + struct jffs2_raw_inode *pino; + int ret = 0; + + /* Find the directory entry. */ + for( i = start_blk, done = 0; i < end_blk && done == 0; i++ ) + { + if( flash_read_buf(i, 0, buf, len) > 0 ) + { + p = buf; + while( p < buf + len ) + { + pdir = (struct jffs2_raw_dirent *) p; + if( je16_to_cpu(pdir->magic) == JFFS2_MAGIC_BITMASK ) + { + if( je16_to_cpu(pdir->nodetype) == JFFS2_NODETYPE_DIRENT && + fname_len == pdir->nsize && + !memcmp(fname, pdir->name, fname_len) ) + { + if( je32_to_cpu(pdir->version) > version ) + { + if( (ino = je32_to_cpu(pdir->ino)) != 0 ) + { + version = je32_to_cpu(pdir->version); + + /* Setting 'done = 1' assumes there is only one + * version of the directory entry. This may not + * be correct if the file is updated after it + * was initially flashed. + * + * TBD. Look for a higher version of the + * directory entry without searching the entire + * flash part. + */ + done = 1; + break; + } + } + } + + p += (je32_to_cpu(pdir->totlen) + 0x03) & ~0x03; + } + else + break; + } + } + } + + if( version ) + { + unsigned char *pucSrc; + unsigned char *pucDst; + unsigned char *pucEntry; + unsigned int dataLen; + unsigned long cur_isize = 0; + + /* Get the file contents. */ + for( i = start_blk, done = 0; i < end_blk && done == 0; i++ ) + { + if( flash_read_buf(i, 0, buf, len) > 0 ) + { + p = buf; + while( p < buf + len ) + { + pino = (struct jffs2_raw_inode *) p; + if( je16_to_cpu(pino->magic) == JFFS2_MAGIC_BITMASK ) + { + if(je16_to_cpu(pino->nodetype)==JFFS2_NODETYPE_INODE && + je32_to_cpu(pino->ino) == ino) + { + unsigned long size = je32_to_cpu(pino->dsize); + unsigned long ofs = je32_to_cpu(pino->offset); + unsigned long isize = je32_to_cpu(pino->isize); + + if( size ) + { + memcpy(pDest + ofs, pino->data, size); + if( (cur_isize += size) >= isize ) + { + done = 1; + break; + } + } + } + + p += (je32_to_cpu(pino->totlen) + 0x03) & ~0x03; + } + else + break; + } + } + } + + pucDst = (unsigned char *) *pulDest; + pucEntry = (unsigned char *) *(pulDest + 1); + dataLen = (unsigned int) *(pulDest + 2); + pucSrc = (unsigned char *) (pulDest + 3); + + ret = decompressLZMA(pucSrc, dataLen, pucDst, 23*1024*1024); + if (ret != 0) + printf("Failed to decompress image. Corrupted image?\n"); + else + { + cfe_loadargs_t la; + + /* Save the rootfs offset of the rootfs that the Linux image + * is loaded from at the memory location before the Linux load + * address. The Linux image uses this value to determine the + * the rootfs to use. + */ + *(unsigned long *) (pucDst - 4) = (start_blk * len) / 1024; + + printf("Decompression OK!\n"); + la.la_entrypt = (long) pucEntry; + printf("Entry at 0x%p\n",la.la_entrypt); + cfe_go(&la); // never return... + } + } + else + printf("ERROR: A JFFS2 directory entry for %s was not found.\n",fname); + + return( ret ); +} + +static int bootNandImage(void) +{ + int ret = -1; + char *msgA, *msgB; + PFILE_TAG pTag1 = getTagFromPartition(1); + PFILE_TAG pTag2 = getTagFromPartition(2); + int seq1 = (pTag1) ? atoi(pTag1->imageSequence) : -1; + int seq2 = (pTag2) ? atoi(pTag2->imageSequence) : -1; + int start_blk, end_blk, rootfsA, rootfsB; + int len = flash_get_sector_size(0) / 1024; + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + validateNandPartTbl(&nvramData); + + if( pTag1 && pTag2 ) + { + if( bootInfo.bootPartition == BOOT_LATEST_IMAGE ) + { + msgA = "Booting from latest image (0x%8.8lx) ...\n"; + msgB = "Booting from previous image (0x%8.8lx) ...\n"; + rootfsA = (seq2 > seq1) ? NP_ROOTFS_2 : NP_ROOTFS_1; + } + else /* Boot from the previous image. */ + { + msgA = "Booting from previous image (0x%8.8lx) ...\n"; + msgB = "Booting from latest image (0x%8.8lx) ...\n"; + rootfsA = (seq2 <= seq1) ? NP_ROOTFS_2 : NP_ROOTFS_1; + } + + rootfsB = (rootfsA == NP_ROOTFS_2) ? NP_ROOTFS_1 : NP_ROOTFS_2; + start_blk = nvramData.ulNandPartOfsKb[rootfsA] / len; + end_blk = start_blk + + (nvramData.ulNandPartSizeKb[rootfsA] / len); + printf(msgA, FLASH_BASE + (nvramData.ulNandPartOfsKb[rootfsA] * 1024)); + if( (ret = bootNandImageFromRootfs(start_blk, end_blk)) != 0 ) + { + start_blk = nvramData.ulNandPartOfsKb[rootfsB] / len; + end_blk = start_blk + + (nvramData.ulNandPartSizeKb[rootfsB] / len); + printf(msgB, FLASH_BASE+(nvramData.ulNandPartOfsKb[rootfsB]*1024)); + if( (ret = bootNandImageFromRootfs(start_blk, end_blk)) != 0 ) + printf("Unable to boot image.\n"); + } + } + else + { + if( pTag1 ) + rootfsA = NP_ROOTFS_1; + else + if( pTag2 ) + rootfsA = NP_ROOTFS_2; + + if( pTag1 || pTag2 ) + { + start_blk = nvramData.ulNandPartOfsKb[rootfsA] / len; + end_blk = start_blk + + (nvramData.ulNandPartSizeKb[rootfsA] / len); + printf("Booting from only image (0x%8.8lx) ...\n", + FLASH_BASE + (nvramData.ulNandPartOfsKb[rootfsA] * 1024)); + if( (ret = bootNandImageFromRootfs(start_blk, end_blk)) != 0 ) + printf("Unable to boot image.\n"); + } + else + printf("No image found.\n"); + } + + return( ret ); +} + +static int autoRun(char *imageName) +{ + char ipImageName[BOOT_FILENAME_LEN + BOOT_IP_LEN]; + int ret; + + if (bootInfo.runFrom == 'f' && !imageName) + { + if (!imageName) + { + if( flash_get_flash_type() != FLASH_IFC_NAND ) + { + PFILE_TAG pTag = getBootImageTag(); + int flash_addr_kernel = atoi(pTag->kernelAddress) + BOOT_OFFSET; + + ret = bootCompressedImage((unsigned int *)flash_addr_kernel, TRUE); + } + else + ret = bootNandImage(); + } + else + printf("Image name not allowed for boot from flash.\n"); + } + else // loading from host + { + if (imageName) + { + if (strchr(imageName, ':')) + strcpy(ipImageName, imageName); + else + { + strcpy(ipImageName, bootInfo.hostIp); + strcat(ipImageName, ":"); + strcat(ipImageName, imageName); + } + } + else // use default host file name + { + strcpy(ipImageName, bootInfo.hostIp); + strcat(ipImageName, ":"); + strcat(ipImageName, bootInfo.hostFileName); + } + + // try uncompressed image first + ret = bootImage("tftp", "eth0", LOADFLG_EXECUTE | LOADFLG_NOISY, ipImageName); + + if( ret == CFE_ERR_NOTELF ) + { + uint8_t *ptr = (uint8_t *) KERNADDR(FLASH_STAGING_BUFFER); + // next try as a compressed image + printf("Retry loading it as a compressed image.\n"); + if ((ret = loadRaw(ipImageName, ptr)) > 0) + bootCompressedImage((unsigned int *) ptr, TRUE); + } + } + + return ret; +} + + +// run program from compressed image in flash or from tftped program from host +static int ui_cmd_run_program(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int ret; + + if( getBootImageTag() || bootInfo.runFrom == 'r' ) + { + char *imageName; + + imageName = cmd_getarg(cmd, 0); + g_processing_cmd = 1; + ret = autoRun(imageName); + } + else + { + printf("ERROR: There is not a valid image to boot from.\n"); + ret = CFE_ERR_FILENOTFOUND; + } + + return( ret ); +} + + +static int ui_cmd_print_system_info(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + return printSysInfo(); +} + +static int ui_cmd_change_bootline(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + return changeBootLine(); +} + +static int ui_cmd_set_afe_id(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + return changeAfeId(); +} + +void ui_dumpaddr( unsigned char *pAddr, int nLen ); +void ui_dumpaddr( unsigned char *pAddr, int nLen ) +{ + static char szHexChars[] = "0123456789abcdef"; + char szLine[80]; + char *p = szLine; + unsigned char ch, *q; + int i = 0, j, size = 0; + unsigned long ul; + unsigned short us; + + if( ((unsigned long) pAddr & 0xff000000) == 0xff000000 || + ((unsigned long) pAddr & 0xff000000) == 0xb0000000 ) + { + if (nLen == 2) { + pAddr = (unsigned char *) ((unsigned long) pAddr & ~0x01); + } else if (nLen != 1) { + /* keeping the old logic as is. */ + if( ((unsigned long) pAddr & 0x03) != 0 ) + nLen += 4; + pAddr = (unsigned char *) ((unsigned long) pAddr & ~0x03); + } + } + while( nLen > 0 ) + { + sprintf( szLine, "%8.8lx: ", (unsigned long) pAddr ); + p = szLine + strlen(szLine); + + if( ((unsigned long) pAddr & 0xff000000) == 0xff000000 || + ((unsigned long) pAddr & 0xff000000) == 0xb0000000 ) + { + for(i = 0; i < 6 && nLen > 0; i += sizeof(long), nLen -= sizeof(long)) + { + if (nLen == 1) { + q = pAddr; + size = 1; + } else if (nLen == 2) { + us = *(unsigned short *)pAddr; + q = (unsigned char *) &us; + size = 2; + } else { + ul = *(unsigned long *) &pAddr[i]; + q = (unsigned char *) &ul; + size = sizeof(long); + } + for( j = 0; j < size; j++ ) + { + *p++ = szHexChars[q[j] >> 4]; + *p++ = szHexChars[q[j] & 0x0f]; + } + *p++ = ' '; + } + } + else + { + for(i = 0; i < 16 && nLen > 0; i++, nLen-- ) + { + ch = pAddr[i]; + + *p++ = szHexChars[ch >> 4]; + *p++ = szHexChars[ch & 0x0f]; + *p++ = ' '; + } + } + + for( j = 0; j < 16 - i; j++ ) + *p++ = ' ', *p++ = ' ', *p++ = ' '; + + *p++ = ' ', *p++ = ' ', *p++ = ' '; + + for( j = 0; j < i; j++ ) + { + ch = pAddr[j]; + *p++ = (ch >= ' ' && ch <= '~') ? ch : '.'; + } + + *p++ = '\0'; + printf( "%s\r\n", szLine ); + + pAddr += i; + } + printf( "\r\n" ); +} /* ui_dumpaddr */ + +static int ui_cmd_dump_mem(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *pszAddr = cmd_getarg(cmd, 0); + char *pszLen = cmd_getarg(cmd, 1); + if( pszAddr && pszLen ) + ui_dumpaddr((unsigned char *) xtoi(pszAddr), atoi(pszLen)); + else + printf("dm address_in_hex length_in_decimal\n"); + + return( 0 ); +} + +static int ui_cmd_set_mem(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *pszAddr = cmd_getarg(cmd, 0); + char *pszValue = cmd_getarg(cmd, 1); + char *pszSize = cmd_getarg(cmd, 2); + if( pszAddr && pszValue && pszSize ) + { + unsigned long ulAddr = (unsigned long) xtoi(pszAddr); + unsigned long ulValue = (unsigned long) atoi(pszValue); + int nSize = atoi(pszSize); + unsigned long *pul = (unsigned long *) ulAddr; + unsigned short *pus = (unsigned short *) ulAddr; + unsigned char *puc = (unsigned char *) ulAddr; + switch( nSize ) + { + case 4: + *pul = (unsigned long) ulValue; + break; + + case 2: + *pus = (unsigned short) ulValue; + break; + + case 1: + *puc = (unsigned char) ulValue; + break; + + default: + printf("sm address_in_hex value_in_hex size_4_2_or_1"); + break; + } + + ui_dumpaddr((unsigned char *) ulAddr, 4); + } + else + printf("sm address_in_hex value_in_hex size_4_2_or_1"); + + return( 0 ); +} + +static int ui_cmd_check_mem(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + #define RAM_BASE_ADDRESS 0xa0000000 + #define BOOT_CODE_SIZE 256 * 1024 // 256KB + #define CFE_MEM_SPACE 0xa0400000 + #define CFE_MEM_SIZE 4*1024*1024 // 4MB + #define MEMORY_SIZE 32*1024*1024 // 32MB + #define MAGIC_NUMBER 0xacacacac + + #define NAND_SECTOR_SIZE (16*1024) // 16KB + #define NAND_TEST_SIZE (30*1024*1024) // 30MB + + unsigned char *addr = NULL; + int pass=1; + +#if 0 + unsigned int buf1[NAND_SECTOR_SIZE/4]; + unsigned int buf2[NAND_SECTOR_SIZE/4]; + int i, j; +#endif + + printf("Verifying DRAM access...\n"); + for(addr=(unsigned char *)(RAM_BASE_ADDRESS+BOOT_CODE_SIZE); addr< (unsigned char *)(RAM_BASE_ADDRESS+MEMORY_SIZE); addr+=4) + { + if( addr< (unsigned char *)CFE_MEM_SPACE || addr > (unsigned char *)CFE_MEM_SPACE+CFE_MEM_SIZE ) + { + *(unsigned long *)addr = MAGIC_NUMBER; + } + } + + for(addr=(unsigned char *)(RAM_BASE_ADDRESS+BOOT_CODE_SIZE); addr< (unsigned char *)(RAM_BASE_ADDRESS+MEMORY_SIZE); addr+=4) + { + if( addr< (unsigned char *)CFE_MEM_SPACE || addr > (unsigned char *)CFE_MEM_SPACE+CFE_MEM_SIZE ) + { + if( *(unsigned long *)addr != MAGIC_NUMBER ) + pass=0; + } + } + if(pass) + printf("DRAM check OK!!!!\n"); + else + printf("DRAM check NG!!!!\n"); + +#if 0 + //printf("Verifying NAND flash access...\n"); + pass=1; + + for(i=0; i0) + offset = nvramData.ulNandPartOfsKb[NP_ROOTFS_2] * 1024; + else + offset = nvramData.ulNandPartOfsKb[NP_ROOTFS_1] * 1024; + + printf("Verifying NAND flash access from 0x%08x...\n", FLASH_BASE+offset); + + for(i=0; i -- if no filename, tftped from host with file name in 'Default host flash file name'", + ""); + + cmd_addcmd("c", + ui_cmd_change_bootline, + NULL, + "Change booline parameters", + "", + ""); + + cmd_addcmd("p", + ui_cmd_print_system_info, + NULL, + "Print boot line and board parameter info", + "", + ""); + + cmd_addcmd("r", + ui_cmd_run_program, + NULL, + "Run program from flash image or from host depend on [f/h] flag", + "eg. r [[hostip:]filenaem] if no filename, use the file name in 'Default host run file name'", + ""); + +#if (INC_SPI_PROG_NAND==1) + cmd_addcmd("n", + ui_cmd_erase_nand, + NULL, + "Erase NAND flash", + "e [a]", + ""); +#else + if( flash_get_flash_type() == FLASH_IFC_NAND ) + cmd_addcmd("e", + ui_cmd_erase_nand, + NULL, + "Erase NAND flash", + "e [a]", + ""); + else +#endif + cmd_addcmd("e", + ui_cmd_erase, + NULL, + "Erase [n]vram or [a]ll flash except bootrom", + "e [n/a]", + ""); + + cmd_addcmd("w", + ui_cmd_write_whole_image, + NULL, + "Write the whole image start from beginning of the flash", + "eg. w [hostip:]whole_image_file_name", + ""); + + cmd_addcmd("chw", + ui_cmd_write_chk_image, + NULL, + "Write chkw image start from beginning of the flash", + "eg. chkw [hostip:]whole_image_file_name", + ""); + + cmd_addcmd("dm", + ui_cmd_dump_mem, + NULL, + "Dump memory or registers.", + "eg. dm address_in_hex length_in_decimal", + ""); + + cmd_addcmd("sm", + ui_cmd_set_mem, + NULL, + "Set memory or registers.", + "eg. sm address_in_hex value_in_hex size_4_2_or_1", + ""); + + cmd_addcmd("nmrp", + ui_cmd_nmrp, + NULL, + "start memory or registers.", + "eg. nmrp ", + ""); + + cmd_addcmd("fr", + ui_cmd_flash_read, + NULL, + "read data from flash.", + "eg. fr addr ", + ""); + + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + cmd_addcmd("checkmem", + ui_cmd_check_mem, + NULL, + "Check memory.", + "Check memory.", + ""); + + ui_init_tftpdcmds(); + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + return 0; +} + + +static int runDelay(int delayCount) +{ + int goAuto = 0; + + if (delayCount == 0) + return goAuto; + + printf("*** Press any key to stop auto run (%d seconds) ***\n", delayCount); + printf("Auto run second count down: %d", delayCount); + + cfe_sleep(CFE_HZ/8); // about 1/4 second + + while (1) + { + printf("\b%d", delayCount); + cfe_sleep(CFE_HZ); // about 1 second + if (console_status()) + break; + if (--delayCount == 0) + { + goAuto = 1; + break; + } + } + printf("\b%d\n", delayCount); + + return goAuto; +} + + +int bcm63xx_run(int breakIntoCfe) +{ + int goAuto; + + ui_init_bcm63xx_cmds(); + printSysInfo(); + enet_init(); + + goAuto = runDelay(bootInfo.bootDelay); + if (!breakIntoCfe && runDelay(bootInfo.bootDelay)) + { + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + if(_start_nmrp() != 0) + autoRun(NULL); // never returns + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + } + return goAuto; +} + + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_devs.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_devs.c new file mode 100755 index 0000000..ac75083 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_devs.c @@ -0,0 +1,734 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Board device initialization File: bcm94710_devs.c + * + * This is the "C" part of the board support package. The + * routines to create and initialize the console, wire up + * device drivers, and do other customization live here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * XX Copyright 2000,2001 + * Broadcom Corporation. All rights reserved. + * + * BROADCOM PROPRIETARY AND CONFIDENTIAL + * + * This software is furnished under license and may be used and + * copied only in accordance with the license. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_printf.h" + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#include "lib_string.h" +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +#include "cfe_timer.h" +#include "cfe.h" +#include "bcm_map.h" +#include "bcm_hwdefs.h" +#include "bcmTag.h" +#include "dev_bcm63xx_flash.h" +#include "bcm63xx_util.h" +#include "flash_api.h" + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#include "tftpd.h" +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +static int checkForResetToDefaultHold( unsigned short rstToDfltIrq ); + +/* Foxconn added start , 1/29/2010 */ +#include "gpio_drv.h" +#include "foxconnCfg.h" + +typedef enum +{ + kGpioInactive, + kGpioActive +} GPIO_STATE_t; +static int test_led_control(int on_off); +int power_led_toggle(int state); +int nmrp_led_toggle(void); +int verify_board_id(char *buf); +int verify_checksum(char *buf, unsigned long buf_len, unsigned long chksum); +#define NR_LED 24 +/* Foxconn added end , 1/29/2010 */ + +/* ********************************************************************* + * Devices we're importing + ********************************************************************* */ + +extern cfe_driver_t bcm63xx_uart; +extern cfe_driver_t bcm63xx_enet; + +/* ********************************************************************* + * board_console_init() + * + * Add the console device and set it to be the primary + * console. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void board_console_init(void) +{ + /* Add the serial port driver. */ + cfe_add_device(&bcm63xx_uart,0,0,0); + + cfe_set_console( "uart0" ); +} + + +/* ********************************************************************* + * board_device_init() + * + * Initialize and add other devices. Add everything you need + * for bootstrap here, like disk drives, flash memory, UARTs, + * network controllers, etc. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void board_device_init(void) +{ + unsigned short GPIOOverlays; + + kerSysFlashInit(); + +#if defined (_BCM96328_) + if( BpGetGPIOverlays(&GPIOOverlays) == BP_SUCCESS ) { + /* Start with all HW LEDs disabled */ + LED->ledHWDis |= 0xFFFFFF; + if (GPIOOverlays & BP_OVERLAY_SERIAL_LEDS) { + GPIO->PinMuxSel |= PINMUX_SERIAL_LED_DATA; + GPIO->PinMuxSel |= PINMUX_SERIAL_LED_CLK; + LED->ledInit |= LED_SERIAL_LED_EN; + } + /* Enable LED controller to drive GPIO */ + /* foxconn modified start to let hardware control only act LEDs, Bob, 08/04/2010 */ + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_0) { + GPIO->PinMuxSel |= PINMUX_EPHY0_ACT_LED; + //GPIO->GPIOMode |= (1 << EPHY0_SPD_LED); + //LED->ledHWDis &= ~(1 << EPHY0_SPD_LED); + } + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_1) { + GPIO->PinMuxSel |= PINMUX_EPHY1_ACT_LED; + //GPIO->GPIOMode |= (1 << EPHY1_SPD_LED); + //LED->ledHWDis &= ~(1 << EPHY1_SPD_LED); + } + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_2) { + GPIO->PinMuxSel |= PINMUX_EPHY2_ACT_LED; + //GPIO->GPIOMode |= (1 << EPHY2_SPD_LED); + //LED->ledHWDis &= ~(1 << EPHY2_SPD_LED); + } + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_3) { + GPIO->PinMuxSel |= PINMUX_EPHY3_ACT_LED; + //GPIO->GPIOMode |= (1 << EPHY3_SPD_LED); + //LED->ledHWDis &= ~(1 << EPHY3_SPD_LED); + } + /* foxconn modified end, Bob, 08/04/2010 */ + } +#endif + +#if defined (_BCM96362_) + if( BpGetGPIOverlays(&GPIOOverlays) == BP_SUCCESS ) { + /* Start with all HW LEDs disabled */ + LED->ledHWDis |= 0xFFFFFF; + if (GPIOOverlays & BP_OVERLAY_SERIAL_LEDS) { + GPIO->GPIOMode |= (GPIO_MODE_SERIAL_LED_CLK | GPIO_MODE_SERIAL_LED_DATA); + LED->ledInit |= LED_SERIAL_LED_EN; + } + /* Map HW LEDs to LED controller inputs and enable LED controller to drive GPIO */ + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_0) { + LED->ledLinkActSelHigh |= ((1 << (LED_ENET0 - 4)) << LED_4_LINK_SHIFT); + GPIO->LEDCtrl |= (1 << LED_ENET0); + LED->ledHWDis &= ~(1 << LED_ENET0); + } + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_1) { + LED->ledLinkActSelHigh |= ((1 << (LED_ENET1 - 4)) << LED_5_LINK_SHIFT); + GPIO->LEDCtrl |= (1 << LED_ENET1); + LED->ledHWDis &= ~(1 << LED_ENET1); + } + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_2) { + LED->ledLinkActSelHigh |= ((1 << (LED_ENET2 - 4)) << LED_6_LINK_SHIFT); + GPIO->LEDCtrl |= (1 << LED_ENET2); + LED->ledHWDis &= ~(1 << LED_ENET2); + } + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_3) { + LED->ledLinkActSelHigh |= ((1 << (LED_ENET3 - 4)) << LED_7_LINK_SHIFT); + GPIO->LEDCtrl |= (1 << LED_ENET3); + LED->ledHWDis &= ~(1 << LED_ENET3); + } + } +#endif + +#if defined (_BCM96368_) + TIMER->WDResetCount = 50000; // Assert reset for 1ms only. If reset asserted for too + // long chip reboots twice + if( BpGetGPIOverlays(&GPIOOverlays) == BP_SUCCESS ) { + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_0) { + GPIO->GPIOMode |= GPIO_MODE_EPHY0_LED; + GPIO->GPIODir |= GPIO_MODE_EPHY0_LED; + } + + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_1) { + GPIO->GPIOMode |= GPIO_MODE_EPHY1_LED; + GPIO->GPIODir |= GPIO_MODE_EPHY1_LED; + } + + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_2) { + GPIO->GPIOMode |= GPIO_MODE_EPHY2_LED; + GPIO->GPIODir |= GPIO_MODE_EPHY2_LED; + } + + if (GPIOOverlays & BP_OVERLAY_EPHY_LED_3) { + GPIO->GPIOMode |= GPIO_MODE_EPHY3_LED; + GPIO->GPIODir |= GPIO_MODE_EPHY3_LED; + } + + if (GPIOOverlays & BP_OVERLAY_SERIAL_LEDS) { + GPIO->GPIOMode |= (GPIO_MODE_SERIAL_LED_CLK | GPIO_MODE_SERIAL_LED_DATA); + GPIO->GPIODir |= (GPIO_MODE_SERIAL_LED_CLK | GPIO_MODE_SERIAL_LED_DATA); + GPIO->SerialLed = 0xffffffff; + } + } + + /* These blocks will be enabled by the appropriate driver if they are + * compiled into a router image. + */ + PERF->blkEnables &= ~(USBH_CLK_EN | PCM_CLK_EN | SAR_CLK_EN | USBD_CLK_EN); +#endif + +#if defined (_BCM96816_) + TIMER->WDResetCount = 50000; // Assert reset for 1ms only. If reset asserted for too + // long chip reboots twice + + if( BpGetGPIOverlays(&GPIOOverlays) == BP_SUCCESS ) { + if (GPIOOverlays & BP_OVERLAY_GPHY_LED_0) { + GPIO->GPIOMode |= GPIO_MODE_GPHY0_LED; + GPIO->GPIODir |= GPIO_MODE_GPHY0_LED; + } + + if (GPIOOverlays & BP_OVERLAY_GPHY_LED_1) { + GPIO->GPIOMode |= GPIO_MODE_GPHY1_LED; + GPIO->GPIODir |= GPIO_MODE_GPHY1_LED; + } + + if (GPIOOverlays & BP_OVERLAY_SERIAL_LEDS) { + GPIO->GPIOMode |= (GPIO_MODE_SERIAL_LED_CLK | GPIO_MODE_SERIAL_LED_DATA); + GPIO->GPIODir |= (GPIO_MODE_SERIAL_LED_CLK | GPIO_MODE_SERIAL_LED_DATA); + GPIO->SerialLed = 0xffffffff; + } + + if (GPIOOverlays & BP_OVERLAY_MOCA_LED) { + GPIO->GPIOMode |= GPIO_MODE_MOCA_LED; + GPIO->GPIODir |= GPIO_MODE_MOCA_LED; + } + } + + MISC->miscMoCARst &= ~(MISC_MOCA_RST_REF_DIV2RST | MISC_MOCA_RST_REF_FBDIVRST); + MISC->miscMoCARst &= ~MISC_MOCA_RST_REF_VCRST; + MISC->miscMoCARst &= ~(MISC_MOCA_RST_REF_OUTDIV_RESET_M_MASK | MISC_MOCA_RST_REF_MDIV2RST); + MISC->miscMoCACtl |= (7 << MISC_MOCA_CTL_REF_QP_ICTRL_SHIFT); + MISC->miscMoCARst &= ~MISC_MOCA_RST_REF_LD_RESET_STRT; + PERF->softResetB &= ~(SOFT_RST_MOCA_CPU | SOFT_RST_MOCA_SYS | SOFT_RST_MOCA); +#endif + +#if defined (_BCM96328_) || defined (_BCM96362_) + LED->ledInit &= ~LED_FAST_INTV_MASK; + LED->ledInit |= (LED_INTERVAL_20MS * 4) << LED_FAST_INTV_SHIFT; +#else + /* Set blink rate for hardware LEDs. */ + GPIO->LEDCtrl &= ~LED_INTERVAL_SET_MASK; + GPIO->LEDCtrl |= LED_INTERVAL_SET_80MS; +#endif + + /* Add the ethernet driver. */ + cfe_add_device( &bcm63xx_enet, 0, 0, 0); +} + + +void setGpio (unsigned short led_gpio, unsigned short led_state) +{ +#if 0 + unsigned short gpio_state; + + if (((led_gpio & BP_ACTIVE_LOW) && (led_state == LED_ON)) || + (!(led_gpio & BP_ACTIVE_LOW) && (led_state == LED_OFF))) + gpio_state = 0; + else + gpio_state = 1; +#endif + + GPIO->GPIODir |= GPIO_NUM_TO_MASK(led_gpio); + if( led_state ) + GPIO->GPIOio |= GPIO_NUM_TO_MASK(led_gpio); + else + GPIO->GPIOio &= ~GPIO_NUM_TO_MASK(led_gpio); +} + + +/* ********************************************************************* + * board_final_init() + * + * Do any final initialization, such as adding commands to the + * user interface. + * + * If you don't want a user interface, put the startup code here. + * This routine is called just before CFE starts its user interface. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void board_final_init(void) +{ + unsigned short rstToDfltIrq; + int breakIntoCfe = 0; + + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + int goAuto; + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + setAllLedsOff(); + setPowerOnLedOn(); + setGpio(GPIO_POWER_RED_LED, GPIO_POWER_RED_LED_ON); +#if (INC_SPI_PROG_NAND==1) + rstToDfltIrq = 1 ; + breakIntoCfe = rstToDfltIrq; +#else + if( (bootInfo.runFrom == 'f') && getBootImageTag() == NULL ) { + setBreakIntoCfeLed(); + printf("** Flash image not found. **\n\n"); + kerSysErasePsi(); + breakIntoCfe = 1; + } + + if( BpGetResetToDefaultExtIntr( &rstToDfltIrq ) == BP_SUCCESS ) { + if (checkForResetToDefaultHold( rstToDfltIrq )) { + kerSysErasePsi(); + /* Reset the default bootline if the board IP address has changed. */ + if (strcmp(bootInfo.boardIp, DEFAULT_BOARD_IP) != 0) { + setDefaultBootline(); + } + /* Foxconn modified start pling 09/09/2008 */ + /* just load default, don't break into console */ + //breakIntoCfe = 1; + printf("\n** Load default! **\n\n"); + /* Foxconn modified end pling 09/09/2008 */ + } + } +#endif + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + goAuto = bcm63xx_run(breakIntoCfe); + setBreakIntoCfeLed(); + if(goAuto) + { + ui_docommand("tftpd"); + } + /* Foxconn add end by Cliff Wang, 03/23/2010 */ +} + +/* ********************************************************************* + * Miscellaneous Board Functions + ********************************************************************* */ + +/* ********************************************************************* + * checkForResetToDefaultHold() + * + * Determines if the user is holding the reset to default button. + * + * Input parameters: + * Reset to default irq# + * + * Return value: + * 1 - break into the CFE, 0 - continue boot sequence + ********************************************************************* */ +#if (INC_SPI_PROG_NAND==0) +static int checkForResetToDefaultHold( unsigned short rstToDfltIrq ) +{ + const int nBreakIntoCfeDelay = 5; + int ret = 0; + int i; + uint32 irqBit; + volatile uint32 *extIrqReg; + + extIrqReg = &PERF->ExtIrqCfg; + irqBit = 1 << (rstToDfltIrq + EI_STATUS_SHFT); + +#if defined(_BCM96368_) + if (rstToDfltIrq >= BP_EXT_INTR_4 && rstToDfltIrq <= BP_EXT_INTR_5) { + extIrqReg = &PERF->ExtIrqCfg1; + irqBit = 1 << (rstToDfltIrq - BP_EXT_INTR_4 + EI_STATUS_SHFT); + } +#endif + + /* Loop while the reset to default button is depressed. */ + for(i = 0; !(*extIrqReg & irqBit); i++) { + if (i == nBreakIntoCfeDelay) { + setBreakIntoCfeLed(); + printf("\n*** Break into CFE console ***\n\n"); + ret = 1; + break; + } + cfe_sleep(CFE_HZ); + } + + return( ret ); +} +#endif +/* ********************************************************************* + * setLed(led_gpio, led_state) + * + * Turns on an LED. + * + * Input parameters: + * LED purpose + * LED State + * + * Return value: + * nothing + ********************************************************************* */ + +void setLed (unsigned short led_gpio, unsigned short led_state) +{ + unsigned short gpio_state; + + if (((led_gpio & BP_ACTIVE_LOW) && (led_state == LED_ON)) || + (!(led_gpio & BP_ACTIVE_LOW) && (led_state == LED_OFF))) + gpio_state = 0; + else + gpio_state = 1; + +#if defined(_BCM96328_) + /* Enable LED controller to drive this GPIO */ + if (!(led_gpio & BP_GPIO_SERIAL)) + GPIO->GPIOMode |= GPIO_NUM_TO_MASK(led_gpio); +#endif + +#if defined(_BCM96362_) + /* Enable LED controller to drive this GPIO */ + if (!(led_gpio & BP_GPIO_SERIAL)) + GPIO->LEDCtrl |= GPIO_NUM_TO_MASK(led_gpio); +#endif + +#if defined(_BCM96328_) || defined(_BCM96362_) + LED->ledMode &= ~(LED_MODE_MASK << GPIO_NUM_TO_LED_MODE_SHIFT(led_gpio)); + if( gpio_state ) + LED->ledMode |= (LED_MODE_OFF << GPIO_NUM_TO_LED_MODE_SHIFT(led_gpio)); + else + LED->ledMode |= (LED_MODE_ON << GPIO_NUM_TO_LED_MODE_SHIFT(led_gpio)); + +#else + if (led_gpio & BP_GPIO_SERIAL) { + while (GPIO->SerialLedCtrl & SER_LED_BUSY); + if( gpio_state ) + GPIO->SerialLed |= GPIO_NUM_TO_MASK(led_gpio); + else + GPIO->SerialLed &= ~GPIO_NUM_TO_MASK(led_gpio); + } + else { + GPIO->GPIODir |= GPIO_NUM_TO_MASK(led_gpio); + if( gpio_state ) + GPIO->GPIOio |= GPIO_NUM_TO_MASK(led_gpio); + else + GPIO->GPIOio &= ~GPIO_NUM_TO_MASK(led_gpio); + } +#endif +} + +/* ********************************************************************* + * setAllLedsOff() + * + * Turns off all board LEDs on init + * + * Input parameters: + * LED purpose + * + * Return value: + * nothing + ********************************************************************* */ + +void setAllLedsOff(void) +{ + unsigned short gpio; + + if( BpGetAdslLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetAdslFailLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetSecAdslLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetSecAdslFailLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetWirelessSesLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetHpnaLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetWanDataLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetWanErrorLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetBootloaderPowerOnLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetBootloaderStopLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetVoipLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetVoip1LedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetVoip2LedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetPotsLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetGponLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetMoCALedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetGponFailLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetMoCAFailLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); +} + +/* ********************************************************************* + * setPowerOnLedOn() + * + * Turns on the Power LED. + * + * Input parameters: + * LED purpose + * + * Return value: + * nothing + ********************************************************************* */ + +void setPowerOnLedOn(void) +{ + unsigned short gpio; + if( BpGetBootloaderStopLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + if( BpGetBootloaderPowerOnLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_ON ); +} + + +/* ********************************************************************* + * setBreakIntoCfeLed() + * + * Turns on the alarm LED. + * + * Input parameters: + * LED purpose + * + * Return value: + * nothing + ********************************************************************* */ + +void setBreakIntoCfeLed(void) +{ + unsigned short gpio; + if( BpGetBootloaderStopLedGpio( &gpio ) == BP_SUCCESS ) { + setLed( gpio, LED_ON ); + if( BpGetBootloaderPowerOnLedGpio( &gpio ) == BP_SUCCESS ) + setLed( gpio, LED_OFF ); + } +} + +/* ********************************************************************* + * softReset() + * + * Resets the board. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void softReset(void) +{ + printf( "\nResetting board...\n" ); +#if defined (_BCM96816_) + /* Work around reset issues */ + HVG->reg_hvg_cha_misc |= HVG_SOFT_INIT_0; + HVG->reg_hvg_chb_misc |= HVG_SOFT_INIT_0; +#endif + +#if defined(_BCM96328_) + TIMER->SoftRst |= SOFT_RESET; +#else + PERF->pll_control |= SOFT_RESET; // soft reset mips +#if defined(_BCM96368_) || defined(_BCM96816_) + PERF->pll_control = 0; +#endif +#endif + while (1); +} + +/* Foxconn added start , 1/29/2010 */ +extern int nmrp_server_detected; + +int test_led_control(int on_off) +{ + // unsigned short gpio; + int tftpd_state = get_tftpd_state(); + + if (tftpd_state == TFTPD_STATE_OFF) + { + setGpio(GPIO_POWER_RED_LED, GPIO_POWER_RED_LED_ON); //turn red power led + } + else if ( (tftpd_state == TFTPD_STATE_WAIT_IMAGE) || (tftpd_state == TFTPD_STATE_WRITE_IMAGE) ) + { + if (on_off==1) + { + setGpio(GPIO_POWER_RED_LED, GPIO_POWER_RED_LED_ON); + } + else + { + setGpio(GPIO_POWER_RED_LED, GPIO_POWER_RED_LED_OFF); + } + } + + return 0; +} + +int power_led_toggle(int state) +{ + test_led_control(state); + return 0; +} + +int nmrp_led_toggle(void) +{ + static int led_state = 0; + + /* Foxconn added end for U12H154 */ + + if (led_state == 0) + { + led_state = 1; + setGpio(18, 1); + } + else + { + led_state = 0; + setGpio(18, 0); + } + + return 0; +} + + +static unsigned long calculate_checksum (int action, char *s, int size) +{ + static unsigned long c0, c1; + unsigned long checksum, b; + int i; + switch (action) + { + case 0: + c0 = c1 = 0; + break; + + case 1: + for (i = 0; i < size; i++) + { + c0 += s[i] & 0xff; + c1 += c0; + /* check the lan/wan ports status, Foxconn added by EricHuang, 10/24/2006 */ + if ((i % 90000) == 0) + { + printf("."); +// bcm_robo_check_link_status(); + } + } + break; + + case 2: + b = (c0 & 65535) + ((c0 >> 16) & 65535); + c0 = ((b >> 16) + b) & 65535; + + b = (c1 & 65535) + ((c1 >> 16) & 65535); + c1 = ((b >> 16) + b) & 65535; + + checksum = ((c1 << 16) | c0); + + return checksum; + } + return 0; +} + +int verify_checksum(char *buf, unsigned long buf_len, unsigned long chksum) +{ + unsigned long cal_chksum = 0; + + xprintf("Loading ."); + calculate_checksum (0, NULL, 0); + calculate_checksum (1, buf, buf_len); + cal_chksum = calculate_checksum (2, NULL, 0); + printf("\n"); + + + if (cal_chksum != chksum) { + xprintf("Image chksum: 0x%08X\n", chksum); + xprintf("Calc chksum: 0x%08X\n", cal_chksum); + return -1; + } + +#ifdef _DEBUG + //printf("verify_checksum calculate_checksum = 0x%08X\n", cal_chksum); + //printf("verify_checksum image_chksum = 0x%08X\n", chksum); +#endif + + return 0; +} + +int verify_board_id(char *buf) +{ + /* char *board_id = ( char *)BOARD_DATA_ADDR; */ + char board_id[PROJECT_ID_LEN]; + + kerSysReadFromFlash(board_id, BOARD_DATA_ADDR, PROJECT_ID_LEN); + + if(nmrp_server_detected==1) // in NMRP mode + { + if (strncmp(buf, board_id, PROJECT_ID_LEN) != 0) + { + printf("verify_board_id failed: (%s)\n", buf); + return -1; + } + } + else + { + if (strcmp(buf, board_id) != 0) + { + /* Foxconn removed start pling 12/10/2008 */ + /* Don't check board ID in 'tftpd' mode */ + printf("verify_board_id failed: (%s)\n", buf); + //return -1; + /* Foxconn removed end pling 12/10/2008 */ + } + } + return 0; +} + +/* Foxconn added end , 1/29/2010 */ + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_env_subr.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_env_subr.c new file mode 100755 index 0000000..3ce3a28 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_env_subr.c @@ -0,0 +1,277 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Environment variable subroutines File: env_subr.c + * + * This module contains routines to muck with environment variables + * (manage the list, read/write to nvram, etc.) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "env_subr.h" +///#include "nvram_subr.h" + +#include "cfe_error.h" +#include "cfe.h" + +/* ********************************************************************* + * Types + ********************************************************************* */ + +typedef struct cfe_envvar_s { + queue_t qb; + int flags; + char *name; + char *value; + /* name and value go here */ +} cfe_envvar_t; + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +queue_t env_envvars = {&env_envvars,&env_envvars}; +extern unsigned int cfe_startflags; + +/* ********************************************************************* + * env_findenv(name) + * + * Locate an environment variable in the in-memory list + * + * Input parameters: + * name - name of env var to find + * + * Return value: + * cfe_envvar_t pointer, or NULL if not found + ********************************************************************* */ + +static cfe_envvar_t *env_findenv(const char *name) +{ + queue_t *qb; + cfe_envvar_t *env; + + for (qb = env_envvars.q_next; qb != &env_envvars; qb = qb->q_next) { + env = (cfe_envvar_t *) qb; + if (strcmp(env->name,name) == 0) break; + } + + if (qb == &env_envvars) return NULL; + + return (cfe_envvar_t *) qb; + +} + +/* ********************************************************************* + * env_enum(idx,name,namelen,val,vallen) + * + * Enumerate environment variables. This routine locates + * the nth environment variable and copies its name and value + * to user buffers. + * + * The namelen and vallen variables must be preinitialized to + * the maximum size of the output buffer. + * + * Input parameters: + * idx - variable index to find (starting with zero) + * name,namelen - name buffer and length + * val,vallen - value buffer and length + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int env_enum(int idx,char *name,int *namelen,char *val,int *vallen) +{ + queue_t *qb; + cfe_envvar_t *env; + + for (qb = env_envvars.q_next; qb != &env_envvars; qb = qb->q_next) { + if (idx == 0) break; + idx--; + } + + if (qb == &env_envvars) return CFE_ERR_ENVNOTFOUND; + env = (cfe_envvar_t *) qb; + + *namelen = xstrncpy(name,env->name,*namelen); + *vallen = xstrncpy(val,env->value,*vallen); + + return 0; + +} + +/* ********************************************************************* + * env_envtype(name) + * + * Return the type of the environment variable + * + * Input parameters: + * name - name of environment variable + * + * Return value: + * flags, or <0 if error occured + ********************************************************************* */ +int env_envtype(const char *name) +{ + cfe_envvar_t *env; + + env = env_findenv(name); + + if (env) { + return env->flags; + } + + return CFE_ERR_ENVNOTFOUND; +} + + + +/* ********************************************************************* + * env_delenv(name) + * + * Delete an environment variable + * + * Input parameters: + * name - environment variable to delete + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int env_delenv(const char *name) +{ + cfe_envvar_t *env; + + env = env_findenv(name); + + if (!env) return 0; + + if (!(env->flags & ENV_FLG_READONLY)) { + q_dequeue((queue_t *) env); + KFREE(env); + return 0; + } + + return CFE_ERR_ENVNOTFOUND; +} + +/* ********************************************************************* + * env_getenv(name) + * + * Retrieve the value of an environment variable + * + * Input parameters: + * name - name of environment variable to find + * + * Return value: + * value, or NULL if variable is not found + ********************************************************************* */ + +char *env_getenv(const char *name) +{ + cfe_envvar_t *env; + + env = env_findenv(name); + + if (env) { + return env->value; + } + + return NULL; +} + + +/* ********************************************************************* + * env_setenv(name,value,flags) + * + * Set the value of an environment variable + * + * Input parameters: + * name - name of variable + * value - value of variable + * flags - flags for variable (ENV_FLG_xxx) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int env_setenv(const char *name,char *value,int flags) +{ + cfe_envvar_t *env; + int namelen; + + env = env_findenv(name); + if (env) { + if (!(flags & ENV_FLG_ADMIN)) { + if (env->flags & ENV_FLG_READONLY) return CFE_ERR_ENVREADONLY; + } + q_dequeue((queue_t *) env); + KFREE(env); + } + + namelen = strlen(name); + + env = KMALLOC(sizeof(cfe_envvar_t) + namelen + 1 + strlen(value) + 1,0); + if (!env) return CFE_ERR_NOMEM; + + env->name = (char *) (env+1); + env->value = env->name + namelen + 1; + env->flags = (flags & ENV_FLG_MASK); + + strcpy(env->name,name); + strcpy(env->value,value); + + q_enqueue(&env_envvars,(queue_t *) env); + + return 0; +} +int env_save(void) +{ + return 0; +} diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_httpd.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_httpd.c new file mode 100755 index 0000000..dcd5b0a --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_httpd.c @@ -0,0 +1,1031 @@ +/* milli_httpd - pretty small HTTP server +** A combination of +** micro_httpd - really small HTTP server +** and +** mini_httpd - small HTTP server +** +** Copyright 1999,2000 by Jef Poskanzer . +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +*/ + +#if (CFG_WEB_SERVER==1) + +/** Includes. **/ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_timer.h" +#include "cfe_error.h" +#include "cfe.h" +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" + +#include "bsp_config.h" + +#include "bcmTag.h" +#include "bcm63xx_util.h" + + +/** Externs. **/ + +extern char ul_html[]; +extern char ulinfo_html[]; +extern int ul_html_size; +extern int ulinfo_html_size; + +extern int g_console_abort; +extern int g_processing_cmd; + +/** Defines. **/ + +#define SERVER_NAME "micro_httpd" +#define SERVER_URL "http://www.acme.com/software/micro_httpd/" +#define SERVER_PORT 80 +#define PROTOCOL "HTTP/1.0" +#define POST_DATA_START (unsigned char *) \ + BOARD_IMAGE_DOWNLOAD_ADDRESS +#define SOCKET_CLOSED -100 +#define NUM_SOCKETS 4 + +/* Return codes from cfe_web_gets. */ +#define WEB_GETS_DONE 1 +#define WEB_GETS_PENDING 2 +#define WEB_GETS_ERROR 3 + +/* HTTP states. */ +#define HTTP_INITIAL 0 +#define HTTP_READ_FIRST_HDR 1 +#define HTTP_READ_REMAINING_HDRS 2 +#define HTTP_READ_POST_DATA 3 + +/* HTTP POST status */ +#define UPLOAD_OK '0' +#define UPLOAD_FAIL_NO_MEM '1' +#define UPLOAD_FAIL_NO_FILENAME '2' +#define UPLOAD_FAIL_ILLEGAL_IMAGE '3' +#define UPLOAD_FAIL_IMAGE_TOOBIG '4' +#define UPLOAD_FAIL_CORRUPT_IMAGE '5' +#define UPLOAD_FAIL_FLASH '6' +#define UPLOAD_FATAL '7' +#define UPLOAD_PENDING '8' +#define UPLOAD_TCP_ERROR '9' + +/* HTTP upload image formats. */ +#define NO_IMAGE_FORMAT 0 +#define BROADCOM_IMAGE_FORMAT 1 +#define FLASH_IMAGE_FORMAT 2 + + +/** Structs. **/ + +typedef struct +{ + int s; + int state; + int web_buf_idx; + int post_content_length; + char web_first_buf[128]; + char web_buf[256]; +} SOCKET_INFO, *PSOCKET_INFO; + +typedef struct +{ + char *wp_name; + char *wp_content_buf; + int *wp_content_size; + char *wp_mime_type; +} WEB_PAGE_MAP, *PWEB_PAGE_MAP; + + +/** Globals. **/ + +static int g_listen_idx = 0; +static unsigned char *g_image_start = NULL; +static int g_image_len = 0; +static int g_image_format = NO_IMAGE_FORMAT; +static int g_post_data_in_progress = 0; +static int g_post_data_idx = 0; + +static SOCKET_INFO g_socket_info[NUM_SOCKETS]; + +static WEB_PAGE_MAP g_web_page_map[] = + { + {"/", ul_html, &ul_html_size, "text/html"}, + {"/upload.html", ul_html, &ul_html_size, "text/html"}, + {"/uploadinfo.html", ulinfo_html, &ulinfo_html_size, "text/html"}, + {NULL, NULL, 0, NULL} + }; + + +/** Prototypes. **/ + +int cfe_web_check(void); +void cfe_web_fg_process(void); +void cfe_web_poll(void *x); +static void cfe_web_listen( int *listen_idx_ptr ); +static void cfe_web_bg_process(PSOCKET_INFO si); +static int cfe_web_gets( char *web_buf, int web_buf_size, + int *web_buf_idx_ptr, int s ); +static int read_first_hdr(int s, char *web_buf, int web_buf_size, + int *web_buf_idx_ptr, int *close_tcp_ptr); +static int read_remaining_hdrs(int s, char *web_buf, int web_buf_size, + int *web_buf_idx_ptr, int *close_tcp_ptr, int *content_length_ptr); +static char read_post_data( int s, unsigned char *post_data_start, + int content_length, int *post_data_idx_ptr ); +static char parse_post_data( int s, unsigned char *post_data_start, + int post_data_length, unsigned char **image_start_ptr, int *image_len_ptr, + int *image_format_ptr ); +static void send_error( int s, int status, char* title, char* extra_header, + char* text ); +static void send_error( int s, int status, char* title, char* extra_header, + char* text ); +static void send_headers( int s, int status, char* title, char* extra_header, + char* mime_type ); +static void send_page( int s, char *path, int send_headers_flag, + char **substs, int num_substs ); +static int cfe_web_tcp_send( int s, char *buf, int size ); +void * memmove(void * dest,const void *src,size_t count); + + +/*************************************************************************** + * Function Name: cfe_web_check + * Description : Checks if an image has been downloaded through an HTTP POST + * request and is ready to be written to flash memory. + * Returns : 1 - image is ready to be flashed, 0 - nothing to do + ***************************************************************************/ +int cfe_web_check(void) +{ + return( (g_image_format != NO_IMAGE_FORMAT) ? 1 : 0 ); +} /* cfe_web_check */ + + +/*************************************************************************** + * Function Name: cfe_web_process + * Description : Calls the appropriate functions to write an image to + * flash memory. + * Returns : None. + ***************************************************************************/ +void cfe_web_fg_process(void) +{ + /* Wait so the uploadinfo web page can be displayed on the browser. */ + cfe_sleep(CFE_HZ * 2); + if( g_image_format == BROADCOM_IMAGE_FORMAT ) + flashImage( g_image_start ); + else + if( g_image_format == FLASH_IMAGE_FORMAT ) + writeWholeImage( g_image_start, g_image_len ); + + if( g_image_format != NO_IMAGE_FORMAT ) + softReset(); + +} /* cfe_web_process */ + + +/*************************************************************************** + * Function Name: cfe_web_poll + * Description : The entry point function that is called in the background + * at polled intervals. It listens for and processes HTTP + * requests. + * Returns : None. + ***************************************************************************/ +void cfe_web_poll(void *x) +{ + static int first_time = 1; + static int in_cfe_web_poll = 0; + + PSOCKET_INFO si; + int i; + + if( in_cfe_web_poll == 0 ) + { + in_cfe_web_poll = 1; + + /* If this is the first time that this function was called, initialize + * the socket info data array. + */ + if( first_time == 1 ) + { + first_time = 0; + for( i = 0, si = g_socket_info; i < NUM_SOCKETS; i++, si++ ) + { + si->s = SOCKET_CLOSED; + si->state = HTTP_READ_FIRST_HDR; + si->web_buf_idx = 0; + si->post_content_length = 0; + } + } + + /* Check the connection state of each socket. */ + for( i = 0, si = g_socket_info; i < NUM_SOCKETS; i++, si++ ) + { + cfe_web_listen( &g_listen_idx ); + if( si->s >= 0 ) + { + unsigned int connflag; + tcp_status( si->s, &connflag, NULL, NULL ); + if( connflag == TCPSTATUS_CONNECTED ) + { + cfe_web_bg_process( si ); + POLL(); + } + else + if( connflag == TCPSTATUS_NOTCONN ) + { + console_log("web warning: Unexpected TCP disconnect."); + tcp_close(si->s); + si->s = SOCKET_CLOSED; + si->state = HTTP_READ_FIRST_HDR; + si->web_buf_idx = 0; + } + } + } + + in_cfe_web_poll = 0; + } +} /* cfe_web_poll */ + + +/*************************************************************************** + * Function Name: cfe_web_listen + * Description : This function checks to see if TCP listen can be issued + * on the HTTP port and issues the listen if it can. + * Returns : None. + ***************************************************************************/ +static void cfe_web_listen( int *listen_idx_ptr ) +{ + static int port = SERVER_PORT; + + int listen_idx = *listen_idx_ptr; + PSOCKET_INFO si = &g_socket_info[listen_idx]; + + /* If a TCP socket has been opened, check its connection status. */ + if( si->s >= 0 ) + { + unsigned int connflag; + tcp_status( si->s, &connflag, NULL, NULL ); + + /* If the socket is connection, set the next socket index to listen for + * a TCP connection. + */ + if( connflag == TCPSTATUS_CONNECTED ) + { + listen_idx = (listen_idx + 1) % NUM_SOCKETS; + si = &g_socket_info[listen_idx]; + } + } + + /* If the TCP socket has not been opened, open it and listen for a TCP + * connection. + */ + if( si->s == SOCKET_CLOSED ) + { + /* Open the socket in non-blocking mode. */ + POLL(); + if( (si->s = tcp_socket()) >= 0 ) + { + console_log("web info: Waiting for connection on socket %d.", si->s); + if( tcp_listen(si->s, port) != 0 ) + console_log("web error: listen error on %d.", si->s); + } + else + { + console_log("web error %d: Could not create TCP socket.", si->s); + si->s = SOCKET_CLOSED; + } + } + + *listen_idx_ptr = listen_idx; +} /* cfe_web_listen */ + + +/*************************************************************************** + * Function Name: cfe_web_bg_process + * Description : This function processes an HTTP request on a socket. + * Returns : None. + ***************************************************************************/ +static void cfe_web_bg_process(PSOCKET_INFO si) +{ + char post_subst[] = {UPLOAD_FATAL, '\0'}; + char *post_substs[] = {post_subst}; + int close_tcp = 0; + + switch( si->state ) + { + case HTTP_READ_FIRST_HDR: + if( read_first_hdr( si->s, si->web_first_buf, + sizeof(si->web_first_buf), &si->web_buf_idx, &close_tcp ) == 0 ) + { + /* Not all of the first header has been read yet. Try again later.*/ + break; + } + + /* The first header has been read. */ + si->state = HTTP_READ_REMAINING_HDRS; + + /* fall thru */ + + case HTTP_READ_REMAINING_HDRS: + if( read_remaining_hdrs( si->s, si->web_buf, sizeof(si->web_buf), + &si->web_buf_idx, &close_tcp, &si->post_content_length ) ) + { + if( g_processing_cmd == 0 ) + { + char *method = NULL; + char *path = NULL; + char *ptr = (char *) si->web_first_buf; + + method = gettoken(&ptr); + if( method ) + path = gettoken(&ptr); + + /* Process the HTTP request. Only GET and POST are supported. */ + if( method && path ) + { + if( !strcmpi( method, "get" ) ) + { + send_page( si->s, path, 1, NULL, 0 ); + close_tcp = 1; + } + else + { + if( !strcmpi( method, "post" ) ) + { + if( g_post_data_in_progress == 0 ) + { + g_post_data_in_progress = 1; + si->state = HTTP_READ_POST_DATA; + } + else + { + send_error( si->s, 501, "Upload Busy", + (char*) 0, + "An image is already being uploaded." ); + close_tcp = 1; + } + } + else + { + send_error( si->s, 501, "Not Implemented", + (char*) 0, + "That method is not implemented." ); + close_tcp = 1; + } + } + } + else + { + send_error( si->s, 400, "Bad Request", (char *) 0, + "Can't parse request." ); + close_tcp = 1; + } + } + else + { + /* A download and flash image command is being executed from + * the serial port console. + */ + send_error( si->s, 400, "Bad Request", (char *) 0, + "Console command is in progress." ); + close_tcp = 1; + } + } + + if( si->state != HTTP_READ_POST_DATA ) + break; + + case HTTP_READ_POST_DATA: + /* Read the post data, which contains an image to flash, into low + * memory. + */ + if( (post_subst[0] = read_post_data( si->s, POST_DATA_START, + si->post_content_length, &g_post_data_idx )) == UPLOAD_OK ) + { + /* Verify that the post data is a valid image to flash. */ + post_subst[0] = parse_post_data( si->s, POST_DATA_START, + g_post_data_idx, (unsigned char **) &g_image_start, &g_image_len, + &g_image_format ); + } + + switch( post_subst[0] ) + { + case UPLOAD_PENDING: + break; + + case UPLOAD_TCP_ERROR: + close_tcp = 1; + g_post_data_in_progress = 0; + g_post_data_idx = 0; + break; + + case UPLOAD_OK: + /* Notify foreground to abort the console input so it can + * write the image to flash memory. + */ + g_console_abort = 1; + + send_page(si->s, "/uploadinfo.html", 0, post_substs, 1); + close_tcp = 1; + g_post_data_idx = 0; + break; + + default: + /* The image was downloaded OK but there was a problem with it + * so it could not be written to flash memory. + */ + send_page(si->s, "/uploadinfo.html", 0, post_substs, 1); + close_tcp = 1; + g_post_data_in_progress = 0; + g_post_data_idx = 0; + break; + } + break; + } + + /* Close the socket if the HTTP transaction is done. */ + if( close_tcp ) + { + POLL(); + tcp_close(si->s); + si->s = SOCKET_CLOSED; + si->state = HTTP_READ_FIRST_HDR; + si->web_buf_idx = 0; + si->post_content_length = 0; + } +} /* cfe_web_poll */ + + +/*************************************************************************** + * Function Name: cfe_web_gets + * Description : Reads from a socket up to a or . The socket + * is non-blocking. + * Returns : WEB_GETS_DONE - Complete line was read. + * WEB_GETS_PENDING - Line partially read. + * WEB_GETS_ERROR - Socket error. + ***************************************************************************/ +static int cfe_web_gets( char *web_buf, int web_buf_size, + int *web_buf_idx_ptr, int s ) +{ + int ret = WEB_GETS_PENDING; + unsigned char ch; + int web_buf_idx = *web_buf_idx_ptr; + char *p = web_buf + web_buf_idx; + int continue_reading = 1; + + while( web_buf_idx < web_buf_size && continue_reading ) + { + switch( tcp_recv( s, &ch, 1 ) ) + { + case 0: /* no characters are available to receive */ + continue_reading = 0; + break; + + case 1: /* character was read */ + if( ch == '\n' ) + { + *p = '\0'; + continue_reading = 0; + ret = WEB_GETS_DONE; + } + else + if( ch != '\r' ) + { + *p++ = ch; + web_buf_idx++; + } + break; + + default: + continue_reading = 0; + ret = WEB_GETS_ERROR; + break; + } + } + + if( web_buf_idx == web_buf_size ) + { + web_buf[web_buf_idx - 1] = '\0'; + ret = WEB_GETS_DONE; + } + + *web_buf_idx_ptr = web_buf_idx; + + return( ret ); +} /* cfe_web_gets */ + + +/*************************************************************************** + * Function Name: read_first_hdr + * Description : This function reads the first HTTP header which contains + * the method (GET, POST), path and protocol. For example, + * GET /upload.html HTTP/1.1 + * Returns : 1 - First header was read, 0 - was not read. + ***************************************************************************/ +static int read_first_hdr(int s, char *web_buf, int web_buf_size, + int *web_buf_idx_ptr, int *close_tcp_ptr) +{ + int ret = 0; + int sts = cfe_web_gets( web_buf, web_buf_size, web_buf_idx_ptr, s ); + + switch( sts ) + { + case WEB_GETS_DONE: + /* The first HTTP header has been read into web_buf. */ + *web_buf_idx_ptr = 0; + ret = 1; + break; + + case WEB_GETS_ERROR: + console_log("web error: TCP read error."); + *close_tcp_ptr = 1; + break; + } + + return( ret ); +} /* read_first_hdr */ + + +/*************************************************************************** + * Function Name: read_remaining_hdrs + * Description : This function reads the remaining HTTP headers. + * Returns : 1 - Remaining headers were read, 0 - were not read. + ***************************************************************************/ +static int read_remaining_hdrs(int s, char *web_buf, int web_buf_size, + int *web_buf_idx_ptr, int *close_tcp_ptr, int *content_length_ptr) +{ + int ret = 0; + int sts = WEB_GETS_DONE; + + while( sts == WEB_GETS_DONE ) + { + sts = cfe_web_gets( web_buf, web_buf_size, web_buf_idx_ptr, s ); + switch( sts ) + { + case WEB_GETS_DONE: + if( *web_buf_idx_ptr == 0 ) + { + /* The remaining HTTP headers have been read. */ + ret = 1; + sts = WEB_GETS_PENDING; + } + else + { + char *p2 = web_buf; + char *p1 = gettoken(&p2); + if( !strcmpi( p1, "Content-Length:" ) ) + *content_length_ptr=atoi(p2); + *web_buf_idx_ptr = 0; + } + break; + + case WEB_GETS_ERROR: + console_log("web error: TCP read error."); + *close_tcp_ptr = 1; + break; + } + } + + return( ret ); +} /* read_remaining_hdrs */ + + +/*************************************************************************** + * Function Name: read_post_data + * Description : This function reads HTTP POST data which is the contents of + * a new image to write to flash memory. + * Returns : UPLOAD_OK - all data read + * UPLOAD_PENDING - not all data read + * UPLOAD_TCP_ERROR - TCP error + ***************************************************************************/ +static char read_post_data( int s, unsigned char *post_data_start, + int content_length, int *post_data_idx_ptr ) +{ + char ret = UPLOAD_PENDING; + int post_data_idx = *post_data_idx_ptr; + int len; + + do + { + len = tcp_recv( s, (unsigned char*)(post_data_start + post_data_idx), + content_length - post_data_idx ); + post_data_idx += len; + POLL(); + cfe_web_listen( &g_listen_idx ); + } while( len > 0 && post_data_idx < content_length ); + + *post_data_idx_ptr = post_data_idx; + + if( len < 0 ) + { + console_log("web error: TCP read error receiving post data."); + ret = UPLOAD_TCP_ERROR; + } + else + if( post_data_idx == content_length ) + ret = UPLOAD_OK; + + return( ret ); +} /* read_post_data */ + + +/*************************************************************************** + * Function Name: parse_post_data + * Description : This function parses HTTP POST data which is the contents of + * a new image to write to flash memory. + * Returns : UPLOAD_OK or UPLOAD_xxx error + ***************************************************************************/ +static char parse_post_data( int s, unsigned char *post_data_start, + int post_data_length, unsigned char **image_start_ptr, int *image_len_ptr, + int *image_format_ptr ) +{ + char ret = UPLOAD_OK; + unsigned char *p = post_data_start; + int boundary_size = 0; + + /* Convert the start boundary field into a string. It will be compared + * against the end boundary field below. + */ + while( *p != '\r' && *p != '\n' && + ((int) p - (int) post_data_start) < post_data_length ) + { + p++; + } + + if( *p == '\r' || *p == '\n' ) + { + *p++ = '\0'; + boundary_size = strlen((char*)post_data_start); + } + else + { + console_log("web error: HTTP POST start bound field not found."); + ret = UPLOAD_FATAL; + } + + /* Verify that a filename has been entered. */ + if( ret == UPLOAD_OK ) + { + unsigned char *fname = NULL; + while( memcmp( p, "\r\n\r\n", strlen("\r\n\r\n") ) ) + { + if( *p == 'f' && !memcmp( p, "filename=", strlen("filename=" ) ) ) + { + p += strlen("filename="); + fname = p + 1; + if( p[0] == '"' && p[1] != '"' ) + { + p++; + while( *p != '"' && *p != '\r' && *p != '\n' ) + p++; + *p = '\0'; + } + else + { + console_log("web error: HTTP POST filename not specified."); + ret = UPLOAD_FAIL_NO_FILENAME; + } + break; + } + + p++; + } + + if( fname == NULL ) + { + console_log("web error: HTTP POST filename field not found."); + ret = UPLOAD_FATAL; + } + } + + /* Find the start of the image which starts after two consecutive + * carriage return, linefeed pairs. + */ + if( ret == UPLOAD_OK ) + { + while( memcmp( p, "\r\n\r\n", strlen("\r\n\r\n") ) ) + p++; + + p += strlen("\r\n\r\n"); + if( p[0] != '\r' || p[1] != '\n' || + memcmp(p + 2, post_data_start, boundary_size ) ) + { + *image_start_ptr = p; + } + else + { + console_log("web error: HTTP POST no image data."); + ret = UPLOAD_FAIL_ILLEGAL_IMAGE; + } + } + + /* Find the end of the image which contains the same boundary field as + * at the start of the buffer. + */ + if( ret == UPLOAD_OK ) + { + p = post_data_start + post_data_length - 1; + while( *p == '\r' || *p == '\n' || *p == '-' ) + p--; + p[1] = '\0'; + p -= boundary_size + 1; + if( !memcmp( p + strlen("\r\n"), post_data_start, boundary_size ) ) + *image_len_ptr = (int) p - (int) *image_start_ptr; + else + { + console_log("web error: HTTP POST end bound field not found."); + ret = UPLOAD_FATAL; + } + } + + /* Verify that the image is (or should be) a Broadcom flash format file or + * a flash image format. + */ + if( ret == UPLOAD_OK ) + { + /* Align the image on a 16 byte boundary */ + if( ((unsigned long) *image_start_ptr & 0x0f) != 0 ) + { + unsigned char *dest = (unsigned char *) + ((unsigned long) *image_start_ptr & ~0x0f); + unsigned char *src = *image_start_ptr; + memmove( dest, src, *image_len_ptr ); + *image_start_ptr = dest; + } + + /* Check if the first part of the image is the Broadcom defined TAG + * record. + */ + if( verifyTag( (FILE_TAG *) *image_start_ptr, 0 ) == -1 ) + { + /* It is not a Broadcom flash format file. Now check if it is a + * flash image format file. A flash image format file must have a + * CRC at the end of the image. + */ + unsigned char *image_ptr = *image_start_ptr; + unsigned long image_len = (unsigned long) *image_len_ptr - TOKEN_LEN; + unsigned long crc = CRC32_INIT_VALUE; + + crc = getCrc32(image_ptr, image_len, crc); + if (memcmp(&crc, image_ptr + image_len, CRC_LEN) == 0) + { + console_log("web info: Upload %lu bytes, flash image format.", + *image_len_ptr); + *image_format_ptr = FLASH_IMAGE_FORMAT; + } + else + { + console_log("web info: Upload %lu bytes, invalid image format.", + *image_len_ptr); + ret = UPLOAD_FAIL_ILLEGAL_IMAGE; + } + } + else + { + console_log("web info: Upload %lu bytes, Broadcom image format.", + *image_len_ptr); + *image_format_ptr = BROADCOM_IMAGE_FORMAT; + } + } + + return( ret ); +} /* parse_post_data */ + + +/*************************************************************************** + * Function Name: send_error + * Description : This function sends an HTTP error response to the browser. + * Returns : None. + ***************************************************************************/ +static void send_error( int s, int status, char* title, char* extra_header, + char* text ) +{ + int tcpret = 0; + char buf[128]; + send_headers( s, status, title, extra_header, "text/html" ); + sprintf( (char *) buf, "%d %s\n" + "

%d %s

\n", status, title, status, + title ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + sprintf( (char *) buf, "%s\n", text ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + sprintf( (char *) buf, "
\n
%s
\n" + "\n", SERVER_URL, SERVER_NAME ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + + if( tcpret < 0 ) + console_log("web error: TCP write error sending error response."); +} /* send_error */ + + +/*************************************************************************** + * Function Name: send_headers + * Description : This function sends an HTTP response to the browser. + * Returns : None. + ***************************************************************************/ +static void send_headers( int s, int status, char* title, char* extra_header, + char* mime_type ) +{ + int tcpret = 0; + char buf[128]; + unsigned long secs = (unsigned long) cfe_ticks / CFE_HZ; + + sprintf( buf, "%s %d %s\r\n", PROTOCOL, status, title ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + sprintf( buf, "Server: %s\r\n", SERVER_NAME ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + sprintf( buf, "Date: Thu, 01 Jan 1970 %2.2d:%2.2d:%2.2d GMT\r\n", + secs / 3600, (secs % 3600) / 60, secs % 60 ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + if ( extra_header != (char*) 0 ) + { + sprintf( buf, "%s\r\n", extra_header ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + } + if ( mime_type != (char*) 0 ) + { + sprintf( buf, "Content-Type: %s\r\n", mime_type ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + } + sprintf( buf, "Connection: close\r\n\r\n" ); + tcpret = tcp_send( s, (unsigned char*)buf, strlen(buf) ); + + if( tcpret < 0 ) + console_log("web error: TCP write error sending header."); +} /* send_headers */ + + +/*************************************************************************** + * Function Name: send_page + * Description : This function sends a web page to the browser. + * Returns : None. + ***************************************************************************/ +static void send_page( int s, char *path, int send_headers_flag, + char **substs, int num_substs ) +{ + PWEB_PAGE_MAP map; + + /* Find the specified web page. */ + for( map = g_web_page_map; map->wp_name; map++ ) + { + if( !strcmp( map->wp_name, path ) ) + { + /* Found the web page. */ + char *p2 = NULL; + char *p = (char *) map->wp_content_buf; + int size = *map->wp_content_size; + int i = 0; + + if( send_headers_flag ) + send_headers( s, 200, "Ok", (char *) 0, map->wp_mime_type ); + + /* Make substitutions. */ + while( i < num_substs && (p2 = strnchr( p, '<', size )) != NULL ) + { + if( p2[1] == '%' ) + { + /* Found a substituion pattern. Send up to that point. */ + if( cfe_web_tcp_send( s, p, (int) (p2 - p) ) < 0 ) + break; + + /* Send substitution value. */ + if( cfe_web_tcp_send( s, substs[i], strlen(substs[i]) ) < 0 ) + break; + + i++; + + /* Skip to end of substitution pattern. */ + p = p2 + 2; /* skip '<%' */ + while( p[0] != '%' || p[1] != '>' ) + p++; + p += 2; /* skip '%.' */ + } + else + { + /* Was not a substitution pattern. Send up that point. */ + p2++; + if( cfe_web_tcp_send( s, p, (int) (p2 - p) ) < 0 ) + break; + + p = p2; + } + + size = *map->wp_content_size - ((int)p-(int)map->wp_content_buf); + } + + /* Send remaining part of web page after the last substitution. */ + cfe_web_tcp_send( s, p, size ); + + break; /* for loop */ + } + } + + if( map->wp_name == NULL ) + send_error( s, 404, "Not Found", (char*) 0, "File not found." ); +} /* send_page */ + + +/*************************************************************************** + * Function Name: cfe_web_tcp_send + * Description : Sends data on a TCP non blocking connection and waits for + * it to finish. + * Returns : > 0 - bytes send, < 0 - TCP error + ***************************************************************************/ +static int cfe_web_tcp_send( int s, char *buf, int size ) +{ + int i, len = 0; + + for( i = 0; i < size; i += len ) + { + POLL(); + cfe_web_listen( &g_listen_idx ); + len = tcp_send( s, (unsigned char*)(buf + i), size - i ); + if( len < 0 ) + { + console_log("web error: TCP write error sending a web page."); + break; + } + } + + return( len ); +} /* cfe_web_tcp_send */ + + +/** + * memmove - Copy one area of memory to another + * @dest: Where to copy to + * @src: Where to copy from + * @count: The size of the area. + * + * Unlike memcpy(), memmove() copes with overlapping areas. + */ +void * memmove(void * dest,const void *src,size_t count) +{ + char *tmp, *s; + + if (dest <= src) { + tmp = (char *) dest; + s = (char *) src; + while (count--) + *tmp++ = *s++; + } + else { + tmp = (char *) dest + count; + s = (char *) src + count; + while (count--) + *--tmp = *--s; + } + + return dest; +} + +#else + +/*************************************************************************** + * Function Name: Functions stubs. + * Description : Used when the web server is not compiled into the CFE. + * Returns : None. + ***************************************************************************/ + +int cfe_web_check(void); +void cfe_web_fg_process(void); +void cfe_web_poll(void *x); + +int cfe_web_check(void) +{ + return(0); +} + +void cfe_web_fg_process(void) +{ +} + +void cfe_web_poll(void *x) +{ +} + +#endif + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ldr_elf.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ldr_elf.c new file mode 100755 index 0000000..fb3f122 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ldr_elf.c @@ -0,0 +1,388 @@ + +//********** for boot -elf thing from cfe_ldr_elf.c +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * ELF Program Loader File: cfe_ldr_elf.c + * + * This program parses ELF executables and loads them into memory. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_error.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" +#include "cfe_mem.h" + +#include "cfe.h" +#include "cfe_loader.h" +#include "cfe_fileops.h" +#include "elf.h" + +#include "cfe_boot.h" + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +int bcm63xx_cfe_elfload(cfe_loadargs_t *la); + +const cfe_loader_t elfloader = { + "elf", + bcm63xx_cfe_elfload, + 0}; + +/* ********************************************************************* + * readprogsegment(fsctx,ref,addr,size) + * + * Read a program segment, generally corresponding to one + * section of the file. + * + * Input parameters: + * fsctx - file I/O dispatch + * ref - reference data for open file handle + * addr - target virtual address + * size - size of region to read + * + * Return value: + * Number of bytes copied or <0 if error occured + ********************************************************************* */ + +static int readprogsegment(fileio_ctx_t *fsctx,void *ref, + void *addr,int size,int flags) +{ + int res; + +#ifdef __long64 + if (flags & LOADFLG_NOISY) xprintf("0x%016llx/%d ",addr,size); +#else + if (flags & LOADFLG_NOISY) xprintf("0x%x/%d ",addr,size); +#endif + + res = fs_read(fsctx,ref,addr,size); + + if (res < 0) return CFE_ERR_IOERR; + if (res != size) return CFE_ERR_BADELFFMT; + + return size; +} + + +/* ********************************************************************* + * readclearbss(addr,size) + * + * Process a BSS section, zeroing memory corresponding to + * the BSS. + * + * Input parameters: + * addr - address to zero + * size - length of area to zero + * + * Return value: + * number of zeroed bytes or <0 if error occured + ********************************************************************* */ + +static int readclearbss(void *addr,int size,int flags) +{ + +#ifdef __long64 + if (flags & LOADFLG_NOISY) xprintf("0x%016llx/%d ",addr,size); +#else + if (flags & LOADFLG_NOISY) xprintf("0x%x/%d ",addr,size); +#endif + + if (size > 0) memset(addr,0,size); + return size; +} + + +/* ********************************************************************* + * elfgetshdr(ops,ref,ep) + * + * Get a section header from the ELF file + * + * Input parameters: + * ops - file I/O dispatch + * ref - reference data for open file + * ep - extended header info + * + * Return value: + * copy of section header (malloc'd) or NULL if no memory + ********************************************************************* */ + +static Elf32_Shdr *elfgetshdr(fileio_ctx_t *fsctx,void *ref,Elf32_Ehdr *ep) +{ + Elf32_Shdr *shtab; + unsigned size = ep->e_shnum * sizeof(Elf32_Shdr); + + shtab = (Elf32_Shdr *) KMALLOC(size,0); + if (!shtab) { + return NULL; + } + + if (fs_seek(fsctx,ref,ep->e_shoff,FILE_SEEK_BEGINNING) != ep->e_shoff || + fs_read(fsctx,ref,(uint8_t *)shtab,size) != size) { + KFREE(shtab); + return NULL; + } + + return (shtab); +} + +/* ********************************************************************* + * elfload_internal(ops,ref,entrypt,flags) + * + * Read an ELF file (main routine) + * + * Input parameters: + * ops - file I/O dispatch + * ref - open file handle + * entrypt - filled in with entry vector + * flags - generic boot flags + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int elfload_internal(fileio_ctx_t *fsctx,void *ref, + long *entrypt,int flags) +{ + Elf32_Ehdr *ep; + Elf32_Phdr *phtab = 0; + Elf32_Shdr *shtab = 0; + unsigned int nbytes; + int i; + int res; + Elf32_Ehdr ehdr; + + ep = &ehdr; + if (fs_read(fsctx,ref,(uint8_t *) ep,sizeof(*ep)) != sizeof(*ep)) { + return CFE_ERR_IOERR; + } + + /* check header validity */ + if (ep->e_ident[EI_MAG0] != ELFMAG0 || + ep->e_ident[EI_MAG1] != ELFMAG1 || + ep->e_ident[EI_MAG2] != ELFMAG2 || + ep->e_ident[EI_MAG3] != ELFMAG3) { + return CFE_ERR_NOTELF; + } + + if (ep->e_ident[EI_CLASS] != ELFCLASS32) return CFE_ERR_NOT32BIT; + +#ifdef __MIPSEB + if (ep->e_ident[EI_DATA] != ELFDATA2MSB) return CFE_ERR_WRONGENDIAN; /* big endian */ +#endif +#ifdef __MIPSEL + if (ep->e_ident[EI_DATA] != ELFDATA2LSB) return CFE_ERR_WRONGENDIAN; /* little endian */ +#endif + + if (ep->e_ident[EI_VERSION] != EV_CURRENT) return CFE_ERR_BADELFVERS; + if (ep->e_machine != EM_MIPS) return CFE_ERR_NOTMIPS; + + /* Is there a program header? */ + if (ep->e_phoff == 0 || ep->e_phnum == 0 || + ep->e_phentsize != sizeof(Elf32_Phdr)) { + return CFE_ERR_BADELFFMT; + } + + /* Load program header */ + nbytes = ep->e_phnum * sizeof(Elf32_Phdr); + phtab = (Elf32_Phdr *) KMALLOC(nbytes,0); + if (!phtab) { + return CFE_ERR_NOMEM; + } + + if (fs_seek(fsctx,ref,ep->e_phoff,FILE_SEEK_BEGINNING) != ep->e_phoff || + fs_read(fsctx,ref,(uint8_t *)phtab,nbytes) != nbytes) { + KFREE(phtab); + return CFE_ERR_IOERR; + } + + /* + * From now on we've got no guarantee about the file order, + * even where the section header is. Hopefully most linkers + * will put the section header after the program header, when + * they know that the executable is not demand paged. We assume + * that the symbol and string tables always follow the program + * segments. + */ + + /* read section table (if before first program segment) */ + if (ep->e_shoff < phtab[0].p_offset) { + shtab = elfgetshdr(fsctx,ref,ep); + } + + /* load program segments */ + /* We cope with a badly sorted program header, as produced by + * older versions of the GNU linker, by loading the segments + * in file offset order, not in program header order. */ + + while (1) { + Elf32_Off lowest_offset = ~0; + Elf32_Phdr *ph = 0; + + /* find nearest loadable segment */ + for (i = 0; i < ep->e_phnum; i++) + if ((phtab[i].p_type == PT_LOAD) && (phtab[i].p_offset < lowest_offset)) { + ph = &phtab[i]; + lowest_offset = ph->p_offset; + } + if (!ph) { + break; /* none found, finished */ + } + /* load the segment */ + if (ph->p_filesz) { + if (fs_seek(fsctx,ref,ph->p_offset,FILE_SEEK_BEGINNING) != ph->p_offset) { + if (shtab) KFREE(shtab); + KFREE(phtab); + return CFE_ERR_BADELFFMT; + } + res = readprogsegment(fsctx,ref, + (void *)(intptr_t)(signed)ph->p_vaddr, + ph->p_filesz,flags); + if (res != ph->p_filesz) { + if (shtab) KFREE(shtab); + KFREE(phtab); + return res; + } + } + if (ph->p_filesz < ph->p_memsz) { + res = readclearbss((void *)(intptr_t)(signed)ph->p_vaddr + ph->p_filesz, + ph->p_memsz - ph->p_filesz,flags); + if (res < 0) { + if (shtab) KFREE(shtab); + KFREE(phtab); + return res; + } + } + + ph->p_type = PT_NULL; /* remove from consideration */ + } + + KFREE(phtab); + + *entrypt = (intptr_t)ep->e_entry; /* return entry point */ + return 0; +} + + + +/* ********************************************************************* + * cfe_elfload(ops,file,flags) + * + * Read an ELF file (main entry point) + * + * Input parameters: + * ops - fileio dispatch + * file - name of file to read + * ept - where to put entry point + * flags - load flags + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int bcm63xx_cfe_elfload(cfe_loadargs_t *la) +{ + fileio_ctx_t *fsctx; + void *ref; + int res; + + /* + * Look up the file system type and get a context + */ + + + res = fs_init(la->la_filesys,&fsctx,la->la_device); + if (res != 0) { + return res; + } + + /* + * Turn on compression if we're doing that. + */ + + if (la->la_flags & LOADFLG_COMPRESSED) { + res = fs_hook(fsctx,"z"); + if (res != 0) { + return res; + } + } + + /* + * Open the remote file + */ + + res = fs_open(fsctx,&ref,la->la_filename,FILE_MODE_READ); + if (res != 0) { + fs_uninit(fsctx); + return CFE_ERR_FILENOTFOUND; + } + + /* + * Load the image. + */ + + la->la_entrypt = 0; + res = elfload_internal(fsctx,ref,&(la->la_entrypt),la->la_flags); + + /* + * All done, release resources + */ + + fs_close(fsctx,ref); + fs_uninit(fsctx); + + return res; +} + + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ldr_raw.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ldr_raw.c new file mode 100755 index 0000000..eaabf14 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ldr_raw.c @@ -0,0 +1,368 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * RAW Program Loader File: cfe_ldr_raw.c + * + * This program reads raw binaries into memory. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_error.h" +#include "cfe_devfuncs.h" + +#include "cfe.h" +#include "cfe_fileops.h" + +#include "cfe_boot.h" +#include "cfe_bootblock.h" + +#include "cfe_loader.h" + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +int bcm63xx_cfe_rawload(cfe_loadargs_t *la); + +const cfe_loader_t rawloader = { + "raw", + bcm63xx_cfe_rawload, + 0}; + +/* ********************************************************************* + * cfe_findbootblock(la,fsctx,ref) + * + * Find the boot block on the specified device. + * + * Input parameters: + * la - loader args (to be filled in) + * ops - file operations + * ref - reference for open file handle + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ +static int cfe_findbootblock(cfe_loadargs_t *la, + fileio_ctx_t *fsctx, + void *ref, + struct boot_block *bootblock) +{ + uint32_t checksum = 0; + uint32_t calcsum = 0; + uint32_t secsize = 0; + uint64_t secoffset = 0; + int res; + int curblk; + + /* + * Search for the boot block. Stop when we find + * something with a matching checksum and magic + * number. + */ + + fs_seek(fsctx,ref,0,FILE_SEEK_BEGINNING); + + for (curblk = 0; curblk < BOOT_BLOCK_MAXLOC; curblk++) { + + + /* Read a block */ + + res = fs_read(fsctx,ref, + (unsigned char *) bootblock, + sizeof(struct boot_block)); + + if (res != sizeof(struct boot_block)) { + return CFE_ERR_IOERR; + } + + /* Verify magic number */ + +#if defined(CONFIG_MIPS_BRCM) + continue; +#else + if (bootblock->bb_magic != BOOT_MAGIC_NUMBER) { + continue; + } +#endif + + /* Extract fields from block */ + + checksum = ((uint32_t) (bootblock->bb_hdrinfo & BOOT_HDR_CHECKSUM_MASK)); + bootblock->bb_hdrinfo &= ~BOOT_HDR_CHECKSUM_MASK; + secsize = ((uint32_t) (bootblock->bb_secsize & BOOT_SECSIZE_MASK)); + secoffset = bootblock->bb_secstart; + + /* Verify block's checksum */ + + CHECKSUM_BOOT_DATA(&(bootblock->bb_magic),BOOT_BLOCK_SIZE,&calcsum); + + if (checksum == calcsum) { + break; + } + } + + /* + * Okay, determine if we were successful. + */ + +#if !defined(CONFIG_MIPS_BRCM) + if (bootblock->bb_magic != BOOT_MAGIC_NUMBER) { + return CFE_ERR_INVBOOTBLOCK; + } +#endif + + if (checksum != calcsum) { + return CFE_ERR_BBCHECKSUM; + } + + /* + * If we get here, we had a valid boot block. + */ + + return 0; +} + + +/* ********************************************************************* + * cfe_rawload(la) + * + * Read a raw (unformatted) boot file + * + * Input parameters: + * la - loader args + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ +int bcm63xx_cfe_rawload(cfe_loadargs_t *la) +{ + int res; + fileio_ctx_t *fsctx; + const fileio_dispatch_t *ops; + void *ref; + int ttlcopy = 0; + int findbb; + int devinfo; + struct boot_block bootblock; + uint8_t *ptr; + uint8_t *bootcode; +#if !defined(CONFIG_MIPS_BRCM) + uint32_t checksum,calcsum; +#endif + uint64_t secoffset = 0; + int32_t maxsize; + int amtcopy; + int thisamt; + uint32_t loadflags; + int onedot; + + loadflags = la->la_flags; + + /* + * Set starting address and maximum size. You can either + * explicitly set this (with LOADFLG_SPECADDR) or + * let CFE decide. If CFE decides, the load address + * will be BOOT_START_ADDRESS in all cases. + * The size is dependant on the device type: block and flash + * devices will get this info from the boot block, + * and network devices will get the info by reaching EOF + * on reads, up to the maximum size of the boot area. + */ + + if (loadflags & LOADFLG_SPECADDR) { + bootcode = (uint8_t *) la->la_address; + maxsize = la->la_maxsize; + findbb = FALSE; /* don't find a boot block */ + } + else { + bootcode = (uint8_t *) BOOT_START_ADDRESS; + maxsize = BOOT_AREA_SIZE; + findbb = FALSE; + devinfo = la->la_device ? cfe_getdevinfo(la->la_device) : 0; + + /* + * If the device is either a disk or a flash device, + * we will expect to find a boot block. + * Serial and network devices do not have boot blocks. + */ + if ((devinfo >= 0) && + ( ((devinfo & CFE_DEV_MASK) == CFE_DEV_DISK) || + ((devinfo & CFE_DEV_MASK) == CFE_DEV_FLASH) )) { + findbb = TRUE; + } + } + + + /* + * merge in any filesystem-specific flags + */ + + ops = cfe_findfilesys(la->la_filesys); + if (!ops) return CFE_ERR_FSNOTAVAIL; + loadflags |= ops->loadflags; + + /* + * turn off the boot block if requested. + */ + + if (loadflags & LOADFLG_NOBB) findbb = FALSE; + + /* + * Create a file system context + */ + + res = fs_init(la->la_filesys,&fsctx,la->la_device); + if (res != 0) { + return res; + } + + /* + * Turn on compression if we're doing that. + */ + + if (!findbb && (la->la_flags & LOADFLG_COMPRESSED)) { + res = fs_hook(fsctx,"z"); + if (res != 0) { + return res; + } + } + + /* + * Open the boot device + */ + + res = fs_open(fsctx,&ref,la->la_filename,FILE_MODE_READ); + if (res != 0) { + fs_uninit(fsctx); + return res; + } + + /* + * If we need to find a boot block, do it now. + */ + + if (findbb) { + res = cfe_findbootblock(la,fsctx,ref,&bootblock); + + /* + * If we found the boot block, seek to the part of the + * disk where the boot code is. + * Otherwise, get out now, since the disk has no boot block. + */ + + if (res == 0) { + maxsize = (int) ((uint32_t) (bootblock.bb_secsize & BOOT_SECSIZE_MASK)); + secoffset = bootblock.bb_secstart; + fs_seek(fsctx,ref,secoffset,FILE_SEEK_BEGINNING); + } + else { + fs_close(fsctx,ref); + fs_uninit(fsctx); + return res; + } + + } + + /* + * Okay, go load the boot file. + */ + + ptr = bootcode; + amtcopy = maxsize; + ttlcopy = 0; + + onedot = amtcopy / 10; /* ten dots for entire load */ + if (onedot < 4096) onedot = 4096; /* but minimum 4096 bytes per dot */ + onedot = (onedot + 1) & ~4095; /* round to multiple of 4096 */ + + while (amtcopy > 0) { + thisamt = onedot; + if (thisamt > amtcopy) thisamt = amtcopy; + + res = fs_read(fsctx,ref,ptr,thisamt); + if (la->la_flags & LOADFLG_NOISY) { + xprintf("."); + } + if (res <= 0) break; + ptr += res; + amtcopy -= res; + ttlcopy += res; + } + + /* + * We're done with the file. + */ + + fs_close(fsctx,ref); + fs_uninit(fsctx); + + /* + * Verify the boot loader checksum if we were reading + * the disk. + */ + +#if !defined(CONFIG_MIPS_BRCM) + if (findbb) { + CHECKSUM_BOOT_DATA(bootcode,maxsize,&calcsum); + checksum = (uint32_t) ((bootblock.bb_secsize & BOOT_DATA_CHECKSUM_MASK) + >> BOOT_DATA_CHECKSUM_SHIFT); + + if (checksum != calcsum) { + return CFE_ERR_BOOTPROGCHKSUM; + } + } +#endif + + la->la_entrypt = (uintptr_t) bootcode; + + if (la->la_flags & LOADFLG_NOISY) xprintf(" %d bytes read\n",ttlcopy); + + return (res < 0) ? res : ttlcopy; + +} diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_main.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_main.c new file mode 100755 index 0000000..2cf2546 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_main.c @@ -0,0 +1,611 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Main Module File: cfe_main.c + * + * This module contains the main "C" routine for CFE and + * the main processing loop. There should not be any board-specific + * stuff in here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_timer.h" + +#include "env_subr.h" +#include "cfe_mem.h" +#include "cfe.h" + +#include "exception.h" + +#include "bsp_config.h" +#include "bcm_hwdefs.h" +#include "boardparms.h" +#include "bcm_map.h" +#include "bcm_cpu.h" +#include "bcm63xx_util.h" + +#include "segtable.h" +#include "initdata.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#ifndef CFG_STACK_SIZE +#define STACK_SIZE 8192 +#else +#define STACK_SIZE ((CFG_STACK_SIZE+1023) & ~1023) +#endif + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +void cfe_main(int,int); +void cfe_command_restart(uint64_t status); + +extern void cfe_device_poll(void *x); + +extern int cfe_web_check(void); +extern void cfe_web_fg_process(void); +extern void cfe_web_poll(void *x); + +extern const char *builddate; +extern const char *builduser; + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +extern int ui_init_netcmds(void); +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +const char *cfe_boardname = CFG_BOARDNAME; +unsigned int cfe_startflags = 0; +#if defined (_BCM96368_) +static int cfe_bus_speed = 0; +static int cfe_ref_speed = 0; +#endif +#if defined (_BCM96328_) || defined (_BCM96362_) || defined (_BCM96816_) +static int cfe_bus_speed = 0; +static int cfe_ddr_speed = 0; +#endif +unsigned long cfe_sdramsize = 8 * 1024 * 1024; + +static void calculateCpuSpeed(void); + +#if defined (_BCM96328_) +const uint32 cpu_speed_table[0x20] = { + 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, + 0, 320, 160, 200, 160, 200, 400, 320, 320, 160, 384, 320, 192, 320, 320, 320 +}; +const uint32 ddr_speed_table[0x20] = { + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 0, 80, 100, 100, 160, 200, 400, 400, 80, 160, 160, 160, 192, 192, 240, 320 +}; +const uint32 bus_speed_table[0x20] = { + 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 0, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160 +}; +#endif + +#if defined (_BCM96362_) +const uint32 cpu_speed_table[0x20] = { + 320, 320, 320, 240, 160, 400, 440, 384, 320, 320, 320, 240, 160, 320, 400, 320, + 320, 320, 320, 240, 160, 200, 400, 384, 320, 320, 320, 240, 160, 200, 400, 400 +}; +const uint32 ddr_speed_table[0x20] = { + 320, 400, 192, 320, 200, 400, 367, 320, 320, 400, 192, 320, 200, 400, 400, 320, + 320, 400, 192, 320, 200, 267, 400, 320, 320, 320, 192, 320, 200, 200, 400, 333 +}; +const uint32 bus_speed_table[0x20] = { + 160, 200, 96, 160, 100, 160, 183, 160, 160, 200, 96, 160, 100, 160, 200, 160, + 160, 200, 96, 160, 100, 100, 200, 160, 160, 160, 96, 160, 100, 100, 200, 166 +}; +#endif + +#if defined (_BCM96816_) +const uint32 cpu_speed_table[0x20] = { + 200, 400, 400, 320, 200, 400, 333, 333, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 400, 400, 200, 360, 400, 400, 300, 300, 320, 320, 400, 400 +}; +const uint32 ddr_speed_table[0x20] = { + 200, 333, 200, 200, 200, 333, 333, 333, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 400, 200, 200, 300, 300, 300, 300, 300, 400, 400, 400, 400 +}; +const uint32 bus_speed_table[0x20] = { + 200, 200, 200, 160, 100, 167, 200, 167, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 200, 200, 160, 180, 171, 200, 171, 200, 160, 200, 160, 200 +}; +#endif + +static unsigned long cfe_get_sdram_size(void); + +/* ********************************************************************* + * cfe_setup_default_env() + * + * Initialize the default environment for CFE. These are all + * the temporary variables that do not get stored in the NVRAM + * but are available to other programs and command-line macros. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void cfe_setup_default_env(void) +{ + char buffer[80]; + + xsprintf(buffer,"%d.%d.%d",CFE_VER_MAJOR,CFE_VER_MINOR,CFE_VER_BUILD); + env_setenv("CFE_VERSION",buffer,ENV_FLG_BUILTIN | ENV_FLG_READONLY); + + if (cfe_boardname) { + env_setenv("CFE_BOARDNAME",(char *) cfe_boardname, + ENV_FLG_BUILTIN | ENV_FLG_READONLY); + } +} + + +/* ********************************************************************* + * cfe_ledstr(leds) + * + * Display a string on the board's LED display, if it has one. + * This routine depends on the board-support package to + * include a "driver" to write to the actual LED, if the board + * does not have one this routine will do nothing. + * + * The LEDs are written at various places in the initialization + * sequence, to debug board problems. + * + * Input parameters: + * leds - pointer to four-character ASCII string + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_ledstr(const char *leds) +{ +#if 0 + unsigned int val; + + val = ((((unsigned int) leds[0]) << 24) | + (((unsigned int) leds[1]) << 16) | + (((unsigned int) leds[2]) << 8) | + ((unsigned int) leds[3])); + + cfe_leds(val); +#endif +} + + +/* ********************************************************************* + * cfe_say_hello() + * + * Print out the CFE startup message and copyright notice + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_command_restart(uint64_t status) +{ +} + +static void cfe_say_hello(void) +{ + xprintf("\n\n"); + xprintf("CFE version 2.0.3" +#ifdef CFE_VER_RELEASE + ".%d" +#endif + " for DGN2200v2 (%s)\n", + //CFE_VER_MAJOR,CFE_VER_MINOR,CFE_VER_BUILD, BCM63XX_MAJOR, BCM63XX_MINOR, +#ifdef CFE_VER_RELEASE + CFE_VER_RELEASE, +#endif + //cfe_boardname, +#ifdef __long64 + "64bit," +#else + "32bit," +#endif +#if CFG_MULTI_CPUS + "MP," +#else + "SP," +#endif +#ifdef __MIPSEL + "LE" +#endif +#ifdef __MIPSEB + "BE" +#endif +#if CFG_VAPI + ",VAPI" +#endif + ); + + xprintf("Build Date: %s (%s)\n",builddate,builduser); + xprintf("Copyright (C) 2000-2009 Broadcom Corporation.\n"); + xprintf("\n"); +} + + +/* ********************************************************************* + * cfe_restart() + * + * Restart CFE from scratch, jumping back to the boot vector. + * + * Input parameters: + * nothing + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_restart(void) +{ + _exc_restart(); +} + + +/* ********************************************************************* + * cfe_start(ept) + * + * Start a user program + * + * Input parameters: + * ept - entry point + * + * Return value: + * nothing + ********************************************************************* */ +void cfe_start(unsigned long ept) +{ + cfe_launch(ept); +} + +/* ********************************************************************* + * cfe_startup_info() + * + * Display startup memory configuration messages + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void cfe_startup_info(void) +{ + xprintf("Chip ID: BCM%X%X, ", (PERF->RevID & 0xFFFF0000) >> 16, PERF->RevID & 0xFF); + xprintf("MIPS: %dMHz",cfe_cpu_speed/1000000); +#if defined (_BCM96328_) || defined (_BCM96362_) || defined (_BCM96816_) + xprintf(", DDR: %dMHz, Bus: %dMHz\n", cfe_ddr_speed/1000000, cfe_bus_speed/1000000); +#else + xprintf("\n"); +#endif + { + unsigned long tp; + __asm __volatile( + "mfc0 $9, $22, 3;" + "move %0, $9" + :"=r" (tp)); + tp = ((tp & CP0_CMT_TPID) == CP0_CMT_TPID) ? 1 : 0; + xprintf("Main Thread: TP%d\n", tp); + } +#if defined (_BCM96328_) || defined (_BCM96362_) || defined (_BCM96816_) + if (DDR->TEST_CFG1 & 0x2) { /* Memory Test is finished */ + xprintf("Memory Test "); + if (DDR->TEST_CFG1 & 0x4) { + xprintf("Failed\n"); + } + else { + xprintf("Passed\n"); + } + } +#endif + cfe_sdramsize = cfe_get_sdram_size(); + xprintf("Total Memory: %lu bytes (%luMB)\n", cfe_sdramsize, cfe_sdramsize >> 20); + xprintf("Boot Address: 0x%x\n\n", FLASH_BASE); +} + +#if defined (_BCM96816_) +/* ********************************************************************* + * apm_hvg_init() + * + * Work around 6816-specific reset logic + * + * Input parameters: + * nothing + * + * Return value: + * does not return + ********************************************************************* */ + +static void apm_hvg_init(void) +{ + HVG->reg_hvg_cha_misc ^= HVG_SOFT_INIT_0; + HVG->reg_hvg_chb_misc ^= HVG_SOFT_INIT_0; +} +#endif + +/* ********************************************************************* + * cfe_main(a,b) + * + * It's gotta start somewhere. + * + * Input parameters: + * a,b - not used + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_main(int a,int b) +{ + /* + * By the time this routine is called, the following things have + * already been done: + * + * 1. The processor(s) is(are) initialized. + * 2. The caches are initialized. + * 3. The memory controller is initialized. + * 4. BSS has been zeroed. + * 5. The data has been moved to R/W space. + * 6. The "C" Stack has been initialized. + */ + + cfe_bg_init(); /* init background processing */ + cfe_attach_init(); + calculateCpuSpeed(); + cfe_timer_init(); /* Timer process */ + cfe_bg_add(cfe_device_poll,NULL); + + /* + * Initialize the memory allocator + */ + KMEMINIT((unsigned char *) (uintptr_t) mem_heapstart, + ((CFG_HEAP_SIZE)*1024)); + + /* + * Initialize the console. It is done before the other devices + * get turned on. + */ + + board_console_init(); + cfe_setup_exceptions(); + cfe_say_hello(); + +#if defined(CONFIG_BRCM_IKOS) + { + /*0x694b6f32 (iKo2) is replaced with actual addr during the build process*/ + static unsigned long linuxStartAddr=0x694b6f32; + printf("IKOS Build: Jump to Linux start address 0x%8.8lx.\n\n", + linuxStartAddr); + cfe_launch(linuxStartAddr); + } +#endif + + cfe_arena_init(); + board_device_init(); + cfe_startup_info(); + cfe_setup_default_env(); + ui_init_cmddisp(); + getBootLine(); + getBoardParam(); +#if defined (_BCM96816_) + apm_hvg_init(); +#endif + + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + ui_init_netcmds(); + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + board_final_init(); + cfe_command_loop(); + + +} + + +/* ********************************************************************* + * cfe_command_loop() + * + * This routine reads and processes user commands + * + * Input parameters: + * nothing + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_command_loop() +{ + char buffer[300]; + int status; + char *prompt; + + /* Start Web interface. */ + cfe_bg_add(cfe_web_poll,NULL); + + for (;;) { + prompt = env_getenv("PROMPT"); + if (!prompt) prompt = "CFE> "; + console_readline(prompt,buffer,sizeof(buffer)); + + if (cfe_web_check()) + cfe_web_fg_process(); + else { + status = ui_docommands(buffer); + if (status != CMD_ERR_BLANK) { + xprintf("*** command status = %d\n", status); + } + } + } +} + +/* ********************************************************************* + * cfe_errortext(err) + * + * Returns an error message with a number in it. The number can be + * looked up in cfe_error.h. + * + * Input parameters: + * err - error code + * + * Return value: + * string description of error + ********************************************************************* */ + +const char *cfe_errortext(int err) +{ + static char err_buf[20]; + + sprintf(err_buf, "CFE error %d", err); + return (const char *) err_buf; +} + +#if defined (_BCM96368_) +/* ********************************************************************* + * calculateCpuSpeed() + * Calculate BCM6368 CPU speed by reading the PLL Config register + * and applying the following formula: + * Fref_clk = (64 * (P2/P1) * (MIPSDDR_NDIV / REF_MDIV) + * Fbus_clk = (64 * (P2/P1) * (MIPSDDR_NDIV / DDR_MDIV) + * Fcpu_clk = (64 * (P2/P1) * (MIPSDDR_NDIV / CPU_MDIV) + * Input parameters: + * none + * Return value: + * none + ********************************************************************* */ +void static calculateCpuSpeed(void) +{ + UINT32 numerator; + UINT32 pllConfig = DDR->MIPSDDRPLLConfig; + UINT32 pllMDiv = DDR->MIPSDDRPLLMDiv; + + numerator = 64000000 / ((pllConfig & MIPSDDR_P1_MASK) >> MIPSDDR_P1_SHFT) * + ((pllConfig & MIPSDDR_P2_MASK) >> MIPSDDR_P2_SHFT) * + ((pllConfig & MIPSDDR_NDIV_MASK) >> MIPSDDR_NDIV_SHFT); + + cfe_cpu_speed = numerator / ((pllMDiv & MIPS_MDIV_MASK) >> MIPS_MDIV_SHFT); + cfe_bus_speed = numerator / ((pllMDiv & DDR_MDIV_MASK) >> DDR_MDIV_SHFT); + cfe_ref_speed = numerator / ((pllConfig & REF_MDIV_MASK) >> REF_MDIV_SHFT); +} +#endif + +#if defined (_BCM96328_) || defined (_BCM96362_) || (_BCM96816_) +/* ********************************************************************* + * calculateCpuSpeed() + * Calculate CPU speed by reading strap register + * Input parameters: + * none + * Return value: + * none + ********************************************************************* */ +void static calculateCpuSpeed(void) +{ + uint32 mips_pll_fvco; + + mips_pll_fvco = MISC->miscStrapBus & MISC_STRAP_BUS_MIPS_PLL_FVCO_MASK; + mips_pll_fvco >>= MISC_STRAP_BUS_MIPS_PLL_FVCO_SHIFT; + cfe_cpu_speed = cpu_speed_table[mips_pll_fvco] * 1000000; + cfe_ddr_speed = ddr_speed_table[mips_pll_fvco] * 1000000; + cfe_bus_speed = bus_speed_table[mips_pll_fvco] * 1000000; +} +#endif + +/* ********************************************************************* + * cfe_get_sdram_size(void) + * + * Return amount of SDRAM on the board. + * + * Input parameters: + * None. + * + * Return value: + * Amount of SDRAM on the board. + ********************************************************************* */ +static unsigned long cfe_get_sdram_size(void) +{ +#if defined (_BCM96368_) + uint32 size; + uint32 memCfg; + + size = 1; + memCfg = MEMC->Config; + /* Number of column bits */ + size <<= (((memCfg & MEMC_COL_MASK) >> MEMC_COL_SHFT) + 8); + /* Plus number of row bits */ + size <<= (((memCfg & MEMC_ROW_MASK) >> MEMC_ROW_SHFT) + 11); + /* Plus bus width */ + if (((memCfg & MEMC_WIDTH_MASK) >> MEMC_WIDTH_SHFT) == MEMC_32BIT_BUS) + size <<= 2; + else + size <<= 1; + + /* Plus number of banks */ + size <<= 2; + + return( size ); +#else + return (DDR->CSEND << 24); +#endif +} diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_net_icmp.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_net_icmp.c new file mode 100755 index 0000000..89802f8 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_net_icmp.c @@ -0,0 +1,199 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * ICMP Protocol File: net_icmp.c + * + * This module implements portions of the ICMP protocol. Note + * that it is not a complete implementation, just enough to + * generate and respond to ICMP echo requests. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_timer.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_ip.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define ICMP_CODE_ECHO 0 +#define ICMP_TYPE_ECHOREPLY 0 +#define ICMP_TYPE_ECHOREQ 8 + +#define ICMPMSG(type,code) (((type)<<8)|(code)) + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +struct icmp_info_s { + ip_info_t *icmp_ipinfo; + queue_t icmp_echoreplies; + int icmp_maxreplies; +}; + +/* ********************************************************************* + * ICMP_RX_CALLBACK(ref,buf,dst,src) + * + * This routine is called by the IP layer when we receive + * ICMP protocol messages. + * + * Input parameters: + * ref - reference data (an icmp_info_t) + * buf - the ebuf containing the buffer + * dst - destination IP address (us, usually) + * src - source IP address + * + * Return value: + * ETH_KEEP to keep packet, ETH_DROP to cause packet to be freed + ********************************************************************* */ + +static int icmp_rx_callback(void *ref,ebuf_t *buf,uint8_t *dst,uint8_t *src) +{ + icmp_info_t *icmp = (icmp_info_t *)ref; + ip_info_t *ipi = icmp->icmp_ipinfo; + uint16_t imsg; + uint16_t cksum; + ebuf_t *txbuf; + uint8_t *icmphdr; + int res; + + imsg = ICMPMSG(buf->eb_ptr[0],buf->eb_ptr[1]); + + res = ETH_DROP; /* assume we're dropping the pkt */ + + switch (imsg) { + case ICMPMSG(ICMP_TYPE_ECHOREQ,ICMP_CODE_ECHO): + txbuf = _ip_alloc(ipi); + if (txbuf) { + /* Construct reply from the original packet. */ + icmphdr = txbuf->eb_ptr; + ebuf_append_bytes(txbuf,buf->eb_ptr,buf->eb_length); + icmphdr[0] = ICMP_TYPE_ECHOREPLY; + icmphdr[1] = ICMP_CODE_ECHO; + icmphdr[2] = 0; icmphdr[3] = 0; + cksum = ~ip_chksum(0,icmphdr,ebuf_length(txbuf)); + icmphdr[2] = (cksum >> 8) & 0xFF; + icmphdr[3] = (cksum & 0xFF); + if (_ip_send(ipi,txbuf,src,IPPROTO_ICMP) < 0) { + _ip_free(ipi,txbuf); + } + } + break; + + case ICMPMSG(ICMP_TYPE_ECHOREPLY,ICMP_CODE_ECHO): + if (q_count(&(icmp->icmp_echoreplies)) < icmp->icmp_maxreplies) { + /* We're keeping this packet, put it on the queue and don't + free it in the driver. */ + q_enqueue(&(icmp->icmp_echoreplies),(queue_t *) buf); + res = ETH_KEEP; + } + break; + + default: + res = ETH_DROP; + } + + return res; +} + + +/* ********************************************************************* + * _ICMP_INIT(ipi) + * + * Initialize the ICMP layer. + * + * Input parameters: + * ipi - ipinfo structure of IP layer to attach to + * + * Return value: + * icmp_info_t structure or NULL if error occurs + ********************************************************************* */ + +icmp_info_t *_icmp_init(ip_info_t *ipi) +{ + icmp_info_t *icmp; + + icmp = (icmp_info_t *) KMALLOC(sizeof(icmp_info_t),0); + if (!icmp) return NULL; + + icmp->icmp_ipinfo = ipi; + q_init(&(icmp->icmp_echoreplies)); + icmp->icmp_maxreplies = 0; + + _ip_register(ipi,IPPROTO_ICMP,icmp_rx_callback,icmp); + + return icmp; +} + +/* ********************************************************************* + * _ICMP_UNINIT(icmp) + * + * Un-initialize the ICMP layer. + * + * Input parameters: + * icmp - icmp_info_t structure + * + * Return value: + * nothing + ********************************************************************* */ + +void _icmp_uninit(icmp_info_t *icmp) +{ + _ip_deregister(icmp->icmp_ipinfo,IPPROTO_ICMP); + + KFREE(icmp); +} + +int _icmp_ping(icmp_info_t *icmp,uint8_t *dest,int seq,int len) +{ + return 0; +} diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ram_boot.S b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ram_boot.S new file mode 100755 index 0000000..cf48de0 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_ram_boot.S @@ -0,0 +1,88 @@ +#include "sbmips.h" + +/* ********************************************************************* + * BOARD_EARLYINIT() + * + * Initialize board registers. This is the earliest + * time the BSP gets control. This routine cannot assume that + * memory is operational, and therefore all code in this routine + * must run from registers only. The $ra register must not + * be modified, as it contains the return address. + * + * This routine will be called from uncached space, before + * the caches are initialized. If you want to make + * subroutine calls from here, you must use the CALLKSEG1 macro. + * + * Among other things, this is where the GPIO registers get + * programmed to make on-board LEDs function, or other startup + * that has to be done before anything will work. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ +LEAF(board_earlyinit) + j ra +END(board_earlyinit) + +/* ********************************************************************* + * BOARD_DRAMINFO + * + * Return the address of the DRAM information table + * + * Input parameters: + * nothing + * + * Return value: + * v0 - DRAM info table, return 0 to use default table + ********************************************************************* */ +LEAF(board_draminfo) + j ra +END(board_draminfo) + +/* ********************************************************************* + * BOARD_DRAMINIT + * + * This routine should activate memory. + * + * Input parameters: + * a0 - points to configuration table returned by board_draminfo + * or 0 to use an automatic table + * + * Return value: + * v0 - total memory installed + * + * Registers used: + * can use all registers. + ********************************************************************* */ +LEAF(board_draminit) + j ra +END(board_draminit) + +/* ********************************************************************* + * BOARD_SETLEDS(x) + * + * Set LEDs for boot-time progress indication. Not used if + * the board does not have progress LEDs. This routine + * must not call any other routines, since it may be invoked + * either from KSEG0 or KSEG1 and it may be invoked + * whether or not the icache is operational. + * + * Input parameters: + * a0 - LED value (8 bits per character, 4 characters) + * + * Return value: + * nothing + * + * Registers used: + * t0,t1,t2,t3 + ********************************************************************* */ +LEAF(board_setleds) + j ra +END(board_setleds) + +LEAF(bcmcore_tp1_switch) + j ra +END(bcmcore_tp1_switch) diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_util.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_util.c new file mode 100755 index 0000000..91e1ad0 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_util.c @@ -0,0 +1,1375 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * bcm63xx utility functions + * + * Created on : 04/18/2002 seanl + * + ********************************************************************* + +<:copyright-broadcom + + Copyright (c) 2002 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ + +#define BCMTAG_EXE_USE +#include "bcm63xx_util.h" +#include "flash_api.h" +#include "jffs2.h" + +#define je16_to_cpu(x) ((x).v16) +#define je32_to_cpu(x) ((x).v32) + +static void convertBootInfo(void); +static int checkChipId(int tagChipId, char *sig2); +static void UpdateImageSequenceNumber( char *imageSequence ); + +BOOT_INFO bootInfo; + +static int parseFilename(char *fn) +{ + if (strlen(fn) < BOOT_FILENAME_LEN) + return 0; + else + return 1; +} + +static int parseChoiceFh(char *choice) +{ + + if (*choice == 'f' || *choice == 'h') + return 0; + else + return 1; +} + + +static int parseBootPartition(char *choice) +{ + return( (*choice == BOOT_LATEST_IMAGE || *choice == BOOT_PREVIOUS_IMAGE) + ? 0 : 1 ); +} + +static int parseChoice09(char *choice) +{ + int bChoice = *choice - '0'; + + if (bChoice >= 0 && bChoice <= 9) + return 0; + else + return 1; +} + +static int parseIpAddr(char *ipStr); +static int parseGwIpAddr(char *ipStr); +static int parseAfeId(char *afeIdStr); + +#define PARAM_IDX_BOARD_IPADDR 0 +#define PARAM_IDX_HOST_IPADDR 1 +#define PARAM_IDX_GW_IPADDR 2 +#define PARAM_IDX_RUN_FROM 3 +#define PARAM_IDX_RUN_FILENAME 4 +#define PARAM_IDX_FLASH_FILENAME 5 +#define PARAM_IDX_BOOT_DELAY 6 +#define PARAM_IDX_BOOT_IMAGE 7 + +static PARAMETER_SETTING gBootParam[] = +{ + // prompt name Error Prompt Boot Define Boot Param Validation function + {"Board IP address :", IP_PROMPT , "e=", + "", 24, parseIpAddr, TRUE}, // index 0 + {"Host IP address :", IP_PROMPT , "h=", + "", 15, parseIpAddr, TRUE}, // index 1 + {"Gateway IP address :", IP_PROMPT , "g=", + "", 15, parseGwIpAddr, TRUE}, // index 2 + {"Run from flash/host (f/h) :", RUN_FROM_PROMPT , "r=", + "", 1, parseChoiceFh, TRUE}, // index 3 + {"Default host run file name :", HOST_FN_PROMPT , "f=", + "", MAX_PROMPT_LEN - 1, parseFilename, TRUE}, // index 4 + {"Default host flash file name :", FLASH_FN_PROMPT , "i=", + "", MAX_PROMPT_LEN - 1, parseFilename, TRUE}, // index 5 + {"Boot delay (0-9 seconds) :", BOOT_DELAY_PROMPT, "d=", + "", 1, parseChoice09, TRUE}, // index 6 + {"Boot image (0=latest, 1=previous) :", BOOT_PARTITION_PROMPT, "p=", + "", 1, parseBootPartition, TRUE}, // index 7 + {NULL}, +}; + +static int gNumBootParams = (sizeof(gBootParam) / sizeof(PARAMETER_SETTING))-1; + +static PARAMETER_SETTING gAfeId[] = +{ + // prompt name Error Prompt Boot Define Boot Param Validation function + {"Primary AFE ID :", AFE_PROMPT, "", "", 12, parseAfeId, TRUE}, // index 0 + {"Bonding AFE ID :", AFE_PROMPT, "", "", 12, parseAfeId, TRUE}, // index 1 + {NULL}, +}; +static int gAfeIdParams = (sizeof(gAfeId) / sizeof(PARAMETER_SETTING))-1; + +// move from lib_misc.c +int parseipaddr(const char *ipaddr,uint8_t *dest) +{ + int a,b,c,d; + char *x; + + /* make sure it's all digits and dots. */ + x = (char *) ipaddr; + while (*x) { + if ((*x == '.') || ((*x >= '0') && (*x <= '9'))) { + x++; + continue; + } + return -1; + } + + x = (char *) ipaddr; + a = lib_atoi(ipaddr); + x = lib_strchr(x,'.'); + if (!x) return -1; + b = lib_atoi(x+1); + x = lib_strchr(x+1,'.'); + if (!x) return -1; + c = lib_atoi(x+1); + x = lib_strchr(x+1,'.'); + if (!x) return -1; + d = lib_atoi(x+1); + + if ((a < 0) || (a > 255)) return -1; + if ((b < 0) || (b > 255)) return -1; + if ((c < 0) || (c > 255)) return -1; + if ((d < 0) || (d > 255)) return -1; + + dest[0] = (uint8_t) a; + dest[1] = (uint8_t) b; + dest[2] = (uint8_t) c; + dest[3] = (uint8_t) d; + + return 0; +} + +#if 0 +static const char hextable[16] = "0123456789ABCDEF"; +void dumpHex(unsigned char *start, int len) +{ + unsigned char *ptr = start, + *end = start + len; + + while (ptr < end) + { + long offset = ptr - start; + unsigned char text[120], + *p = text; + while (ptr < end && p < &text[16 * 3]) + { + *p++ = hextable[*ptr >> 4]; + *p++ = hextable[*ptr++ & 0xF]; + *p++ = ' '; + } + p[-1] = 0; + printf("%4lX %s\n", offset, text); + } +} + +#endif + +int parsexdigit(char str) +{ + int digit; + + if ((str >= '0') && (str <= '9')) + digit = str - '0'; + else if ((str >= 'a') && (str <= 'f')) + digit = str - 'a' + 10; + else if ((str >= 'A') && (str <= 'F')) + digit = str - 'A' + 10; + else + return -1; + + return digit; +} + + +// convert in = fffffff00 to out=255.255.255.0 +// return 0 = OK, 1 failed. +static int convertMaskStr(char *in, char *out) +{ + int i; + char twoHex[4]; + uint8_t dest[4]; + char mask[BOOT_IP_LEN]; + + if (strlen(in) != MASK_LEN) // mask len has to 8 + return 1; + + memset(twoHex, 0, sizeof(twoHex)); + for (i = 0; i < 4; i++) + { + twoHex[0] = (uint8_t)*in++; + twoHex[1] = (uint8_t)*in++; + if (parsexdigit(*twoHex) == -1) + return 1; + dest[i] = (uint8_t) xtoi(twoHex); + } + sprintf(mask, "%d.%d.%d.%d", dest[0], dest[1], dest[2], dest[3]); + strcpy(out, mask); + return 0; +} + +// return 0 - OK, !0 - Bad ip +static int parseIpAddr(char *ipStr) +{ + char *x; + uint8_t dest[4]; + char mask[BOOT_IP_LEN]; + char ipMaskStr[2*BOOT_IP_LEN]; + + strcpy(ipMaskStr, ipStr); + + x = strchr(ipMaskStr,':'); + if (!x) // no mask + return parseipaddr(ipMaskStr, dest); + + *x = '\0'; + + if (parseipaddr(ipMaskStr, dest)) // ipStr is not ok + return 1; + + x++; + return convertMaskStr(x, mask); // mask is not used here + +} + +// return 0 - OK, !0 - Bad ip +static int parseGwIpAddr(char *ipStr) +{ + int ret = 0; + if( *ipStr ) + ret = parseIpAddr(ipStr); + return(ret); +} + +// return 0 - OK, !0 - Bad ip +static int parseAfeId(char *afeIdStr) +{ + return 0; +} + +// port from ifconfig command in ui_netcmds.c +void enet_init(void) +{ + char devname[] = "eth0"; + uint8_t addr[IP_ADDR_LEN]; + int res; + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + + if (net_getparam(NET_DEVNAME) == NULL) { + res = net_init(devname); /* turn interface on */ + if (res < 0) { + ui_showerror(res, "Could not activate network interface '%s'", devname); + return; + } + } + + net_setparam(NET_HWADDR, nvramData.ucaBaseMacAddr); + + parseipaddr(bootInfo.boardIp, addr); + net_setparam(NET_IPADDR, addr); + + if (strlen(bootInfo.boardMask) > 0) { + parseipaddr(bootInfo.boardMask, addr); + net_setparam(NET_NETMASK, addr); + } + + if (strlen(bootInfo.gatewayIp) > 0) { + parseipaddr(bootInfo.gatewayIp, addr); + net_setparam(NET_GATEWAY, addr); + } + + net_setnetvars(); +} + +/*************************************************************************** +// Function Name: getCrc32 +// Description : caculate the CRC 32 of the given data. +// Parameters : pdata - array of data. +// size - number of input data bytes. +// crc - either CRC32_INIT_VALUE or previous return value. +// Returns : crc. +****************************************************************************/ +UINT32 getCrc32(byte *pdata, UINT32 size, UINT32 crc) +{ + while (size-- > 0) + crc = (crc >> 8) ^ Crc32_table[(crc ^ *pdata++) & 0xff]; + + return crc; +} + + +// return 0, ok. return -1 = wrong chip +static int checkChipId(int tagChipId, char *sig2) +{ + unsigned int chipId = (PERF->RevID & 0xFFFE0000) >> 16; + int result = 0; + + /* Force BCM681x variants to be be BCM6816) */ + if( (chipId & 0xfff0) == 0x6810 ) + chipId = 0x6816; + + if (tagChipId == chipId) + result = 0; + else { + printf("Chip Id error. Image Chip Id = %04x, Board Chip Id = %04x.\n", tagChipId, chipId); + result = -1; + } + + return result; +} + +// return -1: fail. +// 0: OK. +int verifyTag( PFILE_TAG pTag, int verbose ) +{ + UINT32 crc; + FLASH_ADDR_INFO info; + int tagVer, curVer; + + kerSysFlashAddrInfoGet( &info ); + + tagVer = atoi(pTag->tagVersion); + curVer = atoi(BCM_TAG_VER); + + if (tagVer != curVer) + { + if( verbose ) + { + printf("Firmware tag version [%d] is not compatible with the current Tag version [%d].\n", \ + tagVer, curVer); + } + return -1; + } + + if (checkChipId(xtoi(pTag->chipId), pTag->signiture_2) != 0) + return -1; + + // check tag validate token first + crc = CRC32_INIT_VALUE; + crc = getCrc32((byte *) pTag, (UINT32)TAG_LEN-TOKEN_LEN, crc); + + if (crc != (UINT32)(*(UINT32*)(pTag->tagValidationToken))) + { + if( verbose ) + printf("Illegal image ! Tag crc failed.\n"); + return -1; + } + return 0; +} + +#if (INC_NAND_FLASH_DRIVER==0) +PFILE_TAG getTagFromPartition(int imageNumber) +{ + static unsigned char sectAddr1[sizeof(FILE_TAG)]; + static unsigned char sectAddr2[sizeof(FILE_TAG)]; + int blk = 0; + UINT32 crc; + PFILE_TAG pTag = NULL; + unsigned char *pBase = flash_get_memptr(0); + unsigned char *pSectAddr = NULL; + + /* The image tag for the first image is always after the boot loader. + * The image tag for the second image, if it exists, is at one half + * of the flash size. + */ + if( imageNumber == 1 ) + { + + FLASH_ADDR_INFO flash_info; + + kerSysFlashAddrInfoGet(&flash_info); + blk = flash_get_blk((int)(pBase+flash_info.flash_rootfs_start_offset)); + pSectAddr = sectAddr1; + } + else + if( imageNumber == 2 ) + { + blk = flash_get_blk((int) (pBase + (flash_get_total_size() / 2))); + pSectAddr = sectAddr2; + } + + if( blk ) + { + memset(pSectAddr, 0x00, sizeof(FILE_TAG)); + flash_read_buf((unsigned short) blk, 0, pSectAddr, sizeof(FILE_TAG)); + crc = CRC32_INIT_VALUE; + crc = getCrc32(pSectAddr, (UINT32)TAG_LEN-TOKEN_LEN, crc); + pTag = (PFILE_TAG) pSectAddr; + if (crc != (UINT32)(*(UINT32*)(pTag->tagValidationToken))) + pTag = NULL; + } + + return( pTag ); +} +#else +#define tag_not_searched 0 +#define tag_not_found 1 +#define tag_found 2 +PFILE_TAG getTagFromPartition(int imageNumber) +{ + extern unsigned char *mem_topofmem; + static FILE_TAG Tag1 = {{tag_not_searched}}; + static FILE_TAG Tag2 = {{tag_not_searched}}; + PFILE_TAG pTag = (imageNumber == 2) ? &Tag2 : &Tag1; + PFILE_TAG ret = NULL; + + switch( pTag->tagVersion[0] ) + { + case tag_not_searched: + { + int rootfs = (imageNumber == 2) ? NP_ROOTFS_2 : NP_ROOTFS_1; + char fname[] = NAND_CFE_RAM_NAME; + int fname_actual_len = strlen(fname); + int fname_cmp_len = strlen(fname) - 3; /* last three are digits */ + unsigned char *buf = (unsigned char *) mem_topofmem + 1024; + unsigned char *p; + int len = flash_get_sector_size(0); + int num_blks = flash_get_numsectors(); + int i, done, start_blk, end_blk; + struct jffs2_raw_dirent *pdir; + unsigned long version = 0; + NVRAM_DATA nvramData; + + pTag->tagVersion[0] = tag_not_found; + readNvramData(&nvramData); + validateNandPartTbl(&nvramData); + + if( nvramData.ulNandPartOfsKb[rootfs] > 0 && + nvramData.ulNandPartOfsKb[rootfs] < ((num_blks * len) / 1024) && + nvramData.ulNandPartSizeKb[rootfs] > 0 && + nvramData.ulNandPartSizeKb[rootfs] < ((num_blks * len) / 1024) ) + { + const int max_not_jffs2 = 10; + int not_jffs2 = 0; + + start_blk = nvramData.ulNandPartOfsKb[rootfs] / (len / 1024); + end_blk = + start_blk + (nvramData.ulNandPartSizeKb[rootfs] / (len / 1024)); + + /* Find the directory entry. */ + for( i = start_blk, done = 0; i < end_blk && done == 0; i++ ) + { + if( flash_read_buf(i, 0, buf, len) > 0 ) + { + p = buf; + while( p < buf + len ) + { + pdir = (struct jffs2_raw_dirent *) p; + if( je16_to_cpu(pdir->magic) == JFFS2_MAGIC_BITMASK ) + { + if( je16_to_cpu(pdir->nodetype) == + JFFS2_NODETYPE_DIRENT && + fname_actual_len == pdir->nsize && + !memcmp(fname, pdir->name, fname_cmp_len) ) + { + if( je32_to_cpu(pdir->version) > version ) + { + if( je32_to_cpu(pdir->ino) != 0 ) + { + unsigned char *seq = + pdir->name + fname_cmp_len; + pTag->imageSequence[0] = seq[0]; + pTag->imageSequence[1] = seq[1]; + pTag->imageSequence[2] = seq[2]; + pTag->imageSequence[3] = '\0'; + pTag->tagVersion[0] = tag_found; + + version = je32_to_cpu(pdir->version); + + /* Setting 'done = 1' assumes there is + * only one version of the directory + * entry. + */ + done = 1; + ret = pTag; + break; + } + } + } + + p += (je32_to_cpu(pdir->totlen) + 0x03) & ~0x03; + not_jffs2 = 0; + } + else + { + if( not_jffs2++ > max_not_jffs2 ) + done = 1; + break; + } + } + } + } + } + } + break; + + case tag_found: + ret = pTag; + break; + + case tag_not_found: + ret = NULL; + break; + } + + return(ret); +} +#endif + + +int getPartitionFromTag( PFILE_TAG pTag ) +{ + int ret = 0; + + if( pTag ) + { + PFILE_TAG pTag1 = getTagFromPartition(1); + PFILE_TAG pTag2 = getTagFromPartition(2); + int sequence = atoi(pTag->imageSequence); + int sequence1 = (pTag1) ? atoi(pTag1->imageSequence) : -1; + int sequence2 = (pTag2) ? atoi(pTag2->imageSequence) : -1; + + if( pTag1 && sequence == sequence1 ) + ret = 1; + else + if( pTag2 && sequence == sequence2 ) + ret = 2; + } + + return( ret ); +} + +PFILE_TAG getBootImageTag(void) +{ + PFILE_TAG pTag = NULL; + + if( flash_get_flash_type() != FLASH_IFC_NAND ) + { + PFILE_TAG pTag1 = getTagFromPartition(1); + + /* Foxconn modified end pling 10/13/2008 */ + PFILE_TAG pTag2 = NULL; + // PFILE_TAG pTag2 = getTagFromPartition(2); + //* Foxconn modified end pling 10/13/2008 */ + + if( pTag1 && pTag2 ) + { + /* Two images are flashed. */ + int sequence1 = atoi(pTag1->imageSequence); + int sequence2 = atoi(pTag2->imageSequence); + + if( bootInfo.bootPartition == BOOT_LATEST_IMAGE ) + pTag = (sequence2 > sequence1) ? pTag2 : pTag1; + else /* Boot from the previous image. */ + pTag = (sequence2 < sequence1) ? pTag2 : pTag1; + } + else + /* One image is flashed. */ + pTag = (pTag2) ? pTag2 : pTag1; + } + else + { + /* TBD. Verify that linux is on the file system. */ + /* pTag pointer is only compared to NULL for NAND flash boot. */ + pTag = (PFILE_TAG) 1; + } + + return( pTag ); +} + +static void UpdateImageSequenceNumber( char *imageSequence ) +{ + int newImageSequence = 0; + PFILE_TAG pTag = getTagFromPartition(1); + + if( pTag ) + newImageSequence = atoi(pTag->imageSequence); + + pTag = getTagFromPartition(2); + if( pTag && atoi(pTag->imageSequence) > newImageSequence ) + newImageSequence = atoi(pTag->imageSequence); + + newImageSequence++; + sprintf(imageSequence, "%d", newImageSequence); +} + +// return -1: fail. +// 0: OK. +int flashImage(uint8_t *imagePtr) +{ + UINT32 crc; + FLASH_ADDR_INFO info; + int totalImageSize = 0; + int cfeSize; + int cfeAddr, rootfsAddr, kernelAddr; + int status = 0; + PFILE_TAG pTag = (PFILE_TAG) imagePtr; + NVRAM_DATA nvramData, tmpNvramData; + + if( flash_get_flash_type() == FLASH_IFC_NAND ) + { + printf("ERROR: Image is not a valid NAND flash image.\n"); + return -1; + } + + // save existing NVRAM data into a local structure + readNvramData(&nvramData); + + if( verifyTag( pTag, 1 ) == -1 ) + return -1; + + kerSysFlashAddrInfoGet( &info ); + + // check imageCrc + totalImageSize = atoi(pTag->totalImageLen); + crc = CRC32_INIT_VALUE; + crc = getCrc32((imagePtr+TAG_LEN), (UINT32) totalImageSize, crc); + + if (crc != (UINT32) (*(UINT32*)(pTag->imageValidationToken))) + { + printf(" Illegal image ! Image crc failed.\n"); + return -1; + } + + cfeSize = cfeAddr = rootfsAddr = kernelAddr = 0; + + // check cfe's existence + cfeAddr = atoi(pTag->cfeAddress); + if (cfeAddr) + { + cfeSize = atoi(pTag->cfeLen); + if( (cfeSize <= 0) ) + { + printf("Illegal cfe size [%d].\n", cfeSize ); + return -1; + } + + printf("\nFlashing CFE: "); + if ((status = kerSysBcmImageSet(cfeAddr+BOOT_OFFSET, imagePtr+TAG_LEN, + cfeSize, 0)) != 0) + { + printf("Failed to flash CFE. Error: %d\n", status); + return status; + } + + // Check if the new image has valid NVRAM + if ((readNvramData(&tmpNvramData) != 0) || (BpSetBoardId(tmpNvramData.szBoardId) != BP_SUCCESS) || (BpSetVoiceBoardId(tmpNvramData.szBoardId) != BP_SUCCESS)) + writeNvramData(&nvramData); + } + + // check root filesystem and kernel existence + rootfsAddr = atoi(pTag->rootfsAddress); + kernelAddr = atoi(pTag->kernelAddress); + + if( rootfsAddr && kernelAddr ) + { + char *p; + unsigned char *tagFs = imagePtr; + unsigned int baseAddr = (unsigned int) flash_get_memptr(0); + unsigned int totalSize = (unsigned int) flash_get_total_size(); + unsigned int reservedBytesAtEnd; + unsigned int availableSizeOneImg; + unsigned int reserveForTwoImages; + unsigned int availableSizeTwoImgs; + unsigned int newImgSize = atoi(pTag->rootfsLen)+atoi(pTag->kernelLen); + PFILE_TAG pCurTag = getBootImageTag(); + UINT32 crc; + unsigned int curImgSize = 0; + unsigned int rootfsOffset = (unsigned int)rootfsAddr-IMAGE_BASE-TAG_LEN; + FLASH_ADDR_INFO flash_info; + + kerSysFlashAddrInfoGet(&flash_info); + if( rootfsOffset < flash_info.flash_rootfs_start_offset ) + { + // Increase rootfs and kernel addresses by the difference between + // rootfs offset and what it needs to be. + rootfsAddr += flash_info.flash_rootfs_start_offset - rootfsOffset; + kernelAddr += flash_info.flash_rootfs_start_offset - rootfsOffset; + sprintf(pTag->rootfsAddress,"%lu", (unsigned long) rootfsAddr); + sprintf(pTag->kernelAddress,"%lu", (unsigned long) kernelAddr); + crc = CRC32_INIT_VALUE; + crc = getCrc32((unsigned char *)pTag,(UINT32)TAG_LEN-TOKEN_LEN,crc); + *(unsigned long *) &pTag->tagValidationToken[0] = crc; + } + + rootfsAddr += BOOT_OFFSET; + kernelAddr += BOOT_OFFSET; + + reservedBytesAtEnd = flash_get_reserved_bytes_at_end(&flash_info); + availableSizeOneImg = totalSize - ((unsigned int)rootfsAddr-baseAddr) - + reservedBytesAtEnd; + reserveForTwoImages = + (flash_info.flash_rootfs_start_offset > reservedBytesAtEnd) + ? flash_info.flash_rootfs_start_offset : reservedBytesAtEnd; + availableSizeTwoImgs = (totalSize / 2) - reserveForTwoImages; + +// printf("availableSizeOneImage=%dKB availableSizeTwoImgs=%dKB reserve=%dKB\n", +// availableSizeOneImg/1024, availableSizeTwoImgs/1024, reserveForTwoImages/1024); + + if( pCurTag ) + curImgSize = atoi(pCurTag->rootfsLen) + atoi(pCurTag->kernelLen); + + if( newImgSize > availableSizeOneImg) + { + printf("Illegal image size %d. Image size must not be greater " + "than %d.\n", newImgSize, availableSizeOneImg); + return -1; + } + + // tag is alway at the sector start of fs + if (cfeAddr) + { + // will trash cfe memory, but cfe is already flashed + tagFs = imagePtr + cfeSize; + memcpy(tagFs, imagePtr, TAG_LEN); + } + + // If the current image fits in half the flash space and the new + // image to flash also fits in half the flash space, then flash it + // in the partition that is not currently being used to boot from. + if( curImgSize <= availableSizeTwoImgs && + newImgSize <= availableSizeTwoImgs && + getPartitionFromTag( pCurTag ) == 1 ) + { + // Update rootfsAddr to point to the second boot partition. + int offset = (totalSize / 2) + TAG_LEN; + + sprintf(((PFILE_TAG) tagFs)->kernelAddress, "%lu", + (unsigned long) IMAGE_BASE + offset + (kernelAddr-rootfsAddr)); + kernelAddr = baseAddr + offset + (kernelAddr - rootfsAddr); + + sprintf(((PFILE_TAG) tagFs)->rootfsAddress, "%lu", + (unsigned long) IMAGE_BASE + offset); + rootfsAddr = baseAddr + offset; + } + + UpdateImageSequenceNumber( ((PFILE_TAG) tagFs)->imageSequence ); + crc = CRC32_INIT_VALUE; + crc = getCrc32((unsigned char *)tagFs, (UINT32)TAG_LEN-TOKEN_LEN, crc); + *(unsigned long *) &((PFILE_TAG) tagFs)->tagValidationToken[0] = crc; + + printf("\nFlashing root file system and kernel at 0x%8.8lx: ", + rootfsAddr - TAG_LEN); + if( (status = kerSysBcmImageSet((rootfsAddr-TAG_LEN), tagFs, + TAG_LEN + newImgSize, 0)) != 0 ) + { + printf("Failed to flash root file system. Error: %d\n", status); + return status; + } + + for( p = nvramData.szBootline; p[2] != '\0'; p++ ) + { + if( p[0] == 'p' && p[1] == '=' && p[2] != BOOT_LATEST_IMAGE ) + { + // Change boot partition to boot from new image. + p[2] = BOOT_LATEST_IMAGE; + writeNvramData(&nvramData); + break; + } + } + } + + printf(".\n*** Image flash done *** !\n"); + + return status; +} + +static int nandUpdateImageSequenceNumber( uint8_t *imagePtr, int imageSize ) +{ + unsigned char *buf, *p; + char fname[] = NAND_CFE_RAM_NAME; + int fname_actual_len = strlen(fname); + int fname_cmp_len = strlen(fname) - 3; /* last three are digits */ + int len = flash_get_sector_size(0); + struct jffs2_raw_dirent *pdir; + unsigned long version = 0; + PFILE_TAG pTag1 = getTagFromPartition(1); + PFILE_TAG pTag2 = getTagFromPartition(2); + int seq = (pTag1) ? atoi(pTag1->imageSequence) : -1; + int seq2 = (pTag2) ? atoi(pTag2->imageSequence) : -1; + int ret = 0; + + if( seq2 > seq ) + seq = seq2; + + if( seq != -1 ) + { + int done = 0; + + /* Increment the new highest sequence number. Add it to the CFE RAM + * file name. + */ + seq++; + + for(buf = imagePtr; buf < imagePtr+imageSize && done == 0; buf += len) + { + p = buf; + while( p < buf + len ) + { + pdir = (struct jffs2_raw_dirent *) p; + if( je16_to_cpu(pdir->magic) == JFFS2_MAGIC_BITMASK ) + { + if( je16_to_cpu(pdir->nodetype) == JFFS2_NODETYPE_DIRENT && + fname_actual_len == pdir->nsize && + !memcmp(fname, pdir->name, fname_cmp_len) && + je32_to_cpu(pdir->version) > version && + je32_to_cpu(pdir->ino) != 0 ) + { + p = pdir->name + fname_cmp_len; + p[0] = (seq / 100) + '0'; + p[1] = ((seq % 100) / 10) + '0'; + p[2] = ((seq % 100) % 10) + '0'; + p[3] = '\0'; + + je32_to_cpu(pdir->name_crc) = getCrc32(pdir->name, + (unsigned long) fname_actual_len, 0); + + version = je32_to_cpu(pdir->version); + + /* Setting 'done = 1' assumes there is only one version + * of the directory entry. + */ + done = 1; + ret = (buf - imagePtr) / len; /* block number */ + break; + } + + p += (je32_to_cpu(pdir->totlen) + 0x03) & ~0x03; + } + else + break; + } + } + } + + return(ret); +} + +// return -1: fail. +// 0: OK. +int writeWholeImage(uint8_t *imagePtr, int wholeImageSize) +{ + UINT32 crc; + int status = 0; + int offset = 0; + int imageSize = wholeImageSize - TOKEN_LEN; + unsigned char crcBuf[CRC_LEN]; + NVRAM_DATA nvramData, tmpNvramData; + WFI_TAG wfiTag; +#if (INC_SPI_PROG_NAND==1) + if( flash_get_flash_type() != FLASH_IFC_NAND && wholeImageSize > FLASH_LENGTH_BOOT_ROM) + flash_change_flash_type(FLASH_IFC_NAND); +#endif + + // if whole image size (plus TOKEN_LEN of crc) is greater than total flash size, return error + if (wholeImageSize > (flash_get_total_size() + TOKEN_LEN)) + { + printf("Image size too big\n"); + return -1; + } + + memcpy(&wfiTag, imagePtr + imageSize, sizeof(wfiTag)); + if( (wfiTag.wfiVersion & WFI_ANY_VERS_MASK) == WFI_ANY_VERS && + checkChipId(wfiTag.wfiChipId, NULL) != 0 ) + return -1; + + // check tag validate token first + crc = CRC32_INIT_VALUE; + crc = getCrc32(imagePtr, (UINT32)imageSize, crc); + memcpy(crcBuf, imagePtr+imageSize, CRC_LEN); + if (memcmp(&crc, crcBuf, CRC_LEN) != 0) + { + printf("Illegal whole flash image\n"); + return -1; + } + + // save existing NVRAM data into a local structure + readNvramData(&nvramData); + + if( flash_get_flash_type() == FLASH_IFC_NAND ) + { + /* The CFE ROM boot loader saved the rootfs partition index at the + * memory location before CFE RAM load address. + */ + extern unsigned char _ftext; + + /* Allow addition blocks to flash cfram block that has sequence number + * and is flashed last. + */ + const int overhead_blocks = 8; + + int rootfs = (int) *(&_ftext - 1); + int blksize = flash_get_sector_size(0) / 1024; + int sectsize = flash_get_sector_size(0); + int i, cferam_blk, after_cferam, cferam_overhead; + + if( (wfiTag.wfiVersion & WFI_ANY_VERS_MASK) == WFI_ANY_VERS && + ((blksize == 16 && wfiTag.wfiFlashType != WFI_NAND16_FLASH) || + (blksize == 128 && wfiTag.wfiFlashType != WFI_NAND128_FLASH)) ) + { + printf("\nERROR: NAND flash block size does not match image " + "block size\n\n"); + return -1; + } + + if( *(unsigned short *) imagePtr != JFFS2_MAGIC_BITMASK ) + { + /* Flash block 0 (cferom). */ + PNVRAM_DATA pnd = (PNVRAM_DATA) (imagePtr + NVRAM_DATA_OFFSET); + char *p; + + /* Copy NVRAM data to block to be flashed so it is preserved. */ + memcpy((unsigned char *) pnd, (unsigned char *) &nvramData, + sizeof(NVRAM_DATA)); + for( p = pnd->szBootline; p[2] != '\0'; p++ ) + { + if( p[0] == 'p' && p[1] == '=' && p[2] != BOOT_LATEST_IMAGE ) + { + // Change boot partition to boot from new image. + p[2] = BOOT_LATEST_IMAGE; + break; + } + } + + /* Recalculate the nvramData CRC. */ + pnd->ulCheckSum = 0; + pnd->ulCheckSum = getCrc32((unsigned char *) pnd, + sizeof(NVRAM_DATA), CRC32_INIT_VALUE); + + if((status = kerSysBcmImageSet(FLASH_BASE,imagePtr,sectsize,0)) != 0) + printf("Failed to flash block 0. Error: %d\n", status); + imagePtr += sectsize; + imageSize -= sectsize; + } + + validateNandPartTbl(&nvramData); + cferam_blk = nandUpdateImageSequenceNumber(imagePtr, imageSize); + + /* rootfs is the partition that the CFE RAM booted from. Write the + * image to the other rootfs partition. + */ + if(rootfs == NP_ROOTFS_1 && nvramData.ulNandPartSizeKb[NP_ROOTFS_2]>0) + offset = nvramData.ulNandPartOfsKb[NP_ROOTFS_2] * 1024; + else + offset = nvramData.ulNandPartOfsKb[NP_ROOTFS_1] * 1024; + + after_cferam = (cferam_blk + 1) * sectsize; + cferam_overhead = overhead_blocks * sectsize; + + /* Erase block with cferam JFFS2 directory entry so if flashing this + * image does not finish, the partition will not be valid. + */ + for( i = 0; i < (cferam_blk + 1 + overhead_blocks); i++ ) + flash_sector_erase_int((offset / sectsize) + i); + + /* Flash image after cferam directory entry. */ + printf("\nFlashing root file system at 0x%8.8lx: ", FLASH_BASE+offset); + if((status = kerSysBcmImageSet(FLASH_BASE + offset + after_cferam + + cferam_overhead, imagePtr + after_cferam, imageSize - after_cferam, + 1)) != 0) + { + printf("Failed to flash whole image. Error: %d\n", status); + return status; + } + + /* Flash block(s) up to and including the block with cferam JFFS2 + * directory entry. + */ + if((status = kerSysBcmImageSet(FLASH_BASE + offset, imagePtr, + after_cferam, 0)) != 0) + { + printf("Failed to flash whole image. Error: %d\n", status); + return status; + } + } + else /* NOR FLASH */ + { + printf("\nFlashing root file system and kernel at 0x%8.8lx\n", + FLASH_BASE+offset); + + if( (wfiTag.wfiVersion & WFI_ANY_VERS_MASK) == WFI_ANY_VERS && + wfiTag.wfiFlashType != WFI_NOR_FLASH ) + { + printf("\nERROR: Image does not support a NOR flash device.\n\n"); + return -1; + } + + if((status = kerSysBcmImageSet(FLASH_BASE+offset, imagePtr, imageSize, + 1)) != 0) + { + printf("Failed to flash whole image. Error: %d\n", status); + return status; + } + } + + // Check if the new image has valid NVRAM + // Also check if the new image still supports currently configured board ID + if( (readNvramData(&tmpNvramData) != 0) || + (BpSetBoardId(tmpNvramData.szBoardId) != BP_SUCCESS) || + (BpSetVoiceBoardId(tmpNvramData.szVoiceBoardId) != BP_SUCCESS) ) + { + // Don't write NVRAM area if we are flashing tiny bridge image. + // unlike cfe.w, the tiny bridge .w image will not have NVRAM_DATA_ID set + if (*(unsigned long *) &tmpNvramData == NVRAM_DATA_ID) + writeNvramData(&nvramData); + } + + return status; +} + +int processPrompt(PPARAMETER_SETTING promptPtr, int promptCt) +{ + char tmpBuf[MAX_PROMPT_LEN]; + int i = 0; + int bChange = FALSE; + + printf("Press: to use current value\r\n"); + printf(" '-' to go previous parameter\r\n"); + printf(" '.' to clear the current value\r\n"); + printf(" 'x' to exit this command\r\n"); + + memset(tmpBuf, 0, MAX_PROMPT_LEN); + while (i < promptCt) + { + if( (promptPtr+i)->enabled == FALSE ) + { + if( tmpBuf[0] == '-' ) + { + if( i > 0 ) + { + i--; + continue; + } + } + else + { + i++; + continue; + } + } + + if (strlen((promptPtr+i)->parameter) > 0) + printf("%s %s ", (promptPtr+i)->promptName, (promptPtr+i)->parameter); + else + printf("%s %s", (promptPtr+i)->promptName, (promptPtr+i)->parameter); + + memset(tmpBuf, 0, MAX_PROMPT_LEN); + console_readline ("", tmpBuf, (promptPtr+i)->maxValueLength + 1); + + switch (tmpBuf[0]) + { + case '-': // go back one parameter + if (i > 0) + i--; + break; + case 'x': // get out the b command + if ((promptPtr+i)->func != 0) // validate function is supplied, do a check + { + if ((promptPtr+i)->func((promptPtr+i)->parameter)) + { + printf("\n%s; Try again!\n", (promptPtr+i)->errorPrompt); + break; + } + } + i = promptCt; + break; + case '.': // clear the current parameter and advance + if ((promptPtr+i)->func != 0) // validate function is supplied, do a check + { + if ((promptPtr+i)->func("")) + { + printf("\n%s; Try again!\n", (promptPtr+i)->errorPrompt); + break; + } + } + memset((promptPtr+i)->parameter, 0, MAX_PROMPT_LEN); + i++; + bChange = TRUE; + break; + case 0: // no input; use default if it is OK + if ((promptPtr+i)->func != 0) // validate function is supplied, do a check + { + if ((promptPtr+i)->func((promptPtr+i)->parameter)) + { + printf("\n%s; Try again!\n", (promptPtr+i)->errorPrompt); + break; + } + } + i++; + break; + default: // new parameter + if ((promptPtr+i)->func != 0) // validate function is supplied, do a check + { + if ((promptPtr+i)->func(tmpBuf)) + { + printf("\n%s; Try again!\n", (promptPtr+i)->errorPrompt); + break; + } + } + memset((promptPtr+i)->parameter, 0, MAX_PROMPT_LEN); + memcpy((promptPtr+i)->parameter, tmpBuf, strlen(tmpBuf)); + i++; + bChange = TRUE; + } + } + + return bChange; + +} // processPrompt + +// write the nvramData struct to nvram after CRC is calculated +void writeNvramData(PNVRAM_DATA pNvramData) +{ + UINT32 crc = CRC32_INIT_VALUE; + + pNvramData->ulCheckSum = 0; + crc = getCrc32((unsigned char *)pNvramData, sizeof(NVRAM_DATA), crc); + pNvramData->ulCheckSum = crc; + kerSysNvRamSet((unsigned char *)pNvramData, sizeof(NVRAM_DATA), 0); +} + +// read the nvramData struct from nvram +// return -1: crc fail, 0 ok +int readNvramData(PNVRAM_DATA pNvramData) +{ + UINT32 crc = CRC32_INIT_VALUE, savedCrc; + + kerSysNvRamGet((unsigned char *)pNvramData, sizeof(NVRAM_DATA), 0); + savedCrc = pNvramData->ulCheckSum; + pNvramData->ulCheckSum = 0; + crc = getCrc32((unsigned char *)pNvramData, sizeof(NVRAM_DATA), crc); + if (savedCrc != crc) + return -1; + + return 0; +} + +static void convertBootInfo(void) +{ + char *x; + + memset(&bootInfo, 0, sizeof(BOOT_INFO)); + strcpy(bootInfo.boardIp, gBootParam[PARAM_IDX_BOARD_IPADDR].parameter); + + if ((x = strchr(bootInfo.boardIp, ':'))) // has mask + { + *x = '\0'; + convertMaskStr((x+1), bootInfo.boardMask); + } + strcpy(bootInfo.hostIp, gBootParam[PARAM_IDX_HOST_IPADDR].parameter); + if ((x = strchr(bootInfo.hostIp, ':'))) // ignore host mask + *x = '\0'; + strcpy(bootInfo.gatewayIp, gBootParam[PARAM_IDX_GW_IPADDR].parameter); + if ((x = strchr(bootInfo.gatewayIp, ':'))) // ignore gw mask + *x = '\0'; + bootInfo.runFrom = gBootParam[PARAM_IDX_RUN_FROM].parameter[0]; + strcpy(bootInfo.hostFileName, gBootParam[PARAM_IDX_RUN_FILENAME].parameter); + strcpy(bootInfo.flashFileName, gBootParam[PARAM_IDX_FLASH_FILENAME].parameter); + bootInfo.bootDelay = (int)(gBootParam[PARAM_IDX_BOOT_DELAY].parameter[0] - '0'); + bootInfo.bootPartition = gBootParam[PARAM_IDX_BOOT_IMAGE].parameter[0]; +} + +void getBootLine(void) +{ + int i; + char *curPtr; + char *dPtr; + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + + if ((nvramData.szBootline[0] == (char)0xff) || + (nvramData.szBootline[0] == (char)0)) + { + setDefaultBootline(); + return; + } + + curPtr = nvramData.szBootline; + for (i = 0; (i < gNumBootParams) && (curPtr != 0); i++) + { + curPtr = strchr(curPtr, '='); + if (curPtr) // found '=' and get the param. + { + dPtr = strchr(curPtr, ' '); // find param. deliminator ' ' + memset(gBootParam[i].parameter, 0, MAX_PROMPT_LEN); + memcpy(gBootParam[i].parameter, curPtr+1, dPtr-curPtr-1); + // move to next param. + curPtr = dPtr; + } + } // for loop + + if (i < gNumBootParams) { + setDefaultBootline(); + return; + } + + convertBootInfo(); +} + +// print the bootline and board parameter info and fill in the struct for later use +// +int printSysInfo(void) +{ + int i; + ETHERNET_MAC_INFO EnetInfos[BP_MAX_ENET_MACS]; + + // display the bootline info + + if( getTagFromPartition(1) == NULL || getTagFromPartition(2) == NULL ) + gBootParam[PARAM_IDX_BOOT_IMAGE].enabled = FALSE; + + for (i = 0; i < gNumBootParams; i++) + if( gBootParam[i].enabled ) + printf("%s %s \n", gBootParam[i].promptName, gBootParam[i].parameter); + + // display the board param + displayBoardParam(); + + if( BpGetEthernetMacInfo( EnetInfos, BP_MAX_ENET_MACS ) == BP_SUCCESS ) + { + // Here we should print whether EMAC1 or EMAC2 is selected + } + + printf("\n"); + + return 0; +} + + +//************************************************************************** +// Function Name: changeBootLine +// Description : Use vxWorks bootrom style parameter input method: +// Press to use default, '-' to go to previous parameter +// Note: Parameter is set to current value in the menu. +// Returns : None. +//************************************************************************** +int changeBootLine(void) +{ + int i; + char boardIpSaved[BOOT_IP_LEN]; + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + + strcpy(boardIpSaved, bootInfo.boardIp); + + if (processPrompt(gBootParam, gNumBootParams)) + { + char *blPtr = nvramData.szBootline; + int paramLen; + + memset(blPtr, 0, NVRAM_BOOTLINE_LEN); + for (i = 0; i < gNumBootParams; i++) + { + memcpy(blPtr, gBootParam[i].promptDefine, PROMPT_DEFINE_LEN); + blPtr += PROMPT_DEFINE_LEN; + paramLen = strlen(gBootParam[i].parameter); + memcpy(blPtr, gBootParam[i].parameter, paramLen); + blPtr += paramLen; + if (!(gBootParam[i].parameter[0] == ' ')) + { + memcpy(blPtr, " ", 1); + blPtr += 1; + } + } + writeNvramData(&nvramData); + } + + getBootLine(); + + // if board ip differs, do enet init + if (strcmp(boardIpSaved, bootInfo.boardIp) != 0) + enet_init(); + + return 0; + +} + +void setDefaultBootline(void) +{ + char boardIpSaved[BOOT_IP_LEN]; + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + strcpy(boardIpSaved, bootInfo.boardIp); + + memset(nvramData.szBootline, 0, NVRAM_BOOTLINE_LEN); + strncpy(nvramData.szBootline, DEFAULT_BOOTLINE, strlen(DEFAULT_BOOTLINE)); + printf("Use default boot line parameters: %s\n", DEFAULT_BOOTLINE); + writeNvramData(&nvramData); + + getBootLine(); + + // if board ip differs, do enet init + if (strcmp(boardIpSaved, bootInfo.boardIp) != 0) + enet_init(); +} + +//************************************************************************** +// Function Name: changeAfeId +// Description : Use vxWorks bootrom style parameter input method: +// Press to use default, '-' to go to previous parameter +// Note: Parameter is set to current value in the menu. +// Returns : None. +//************************************************************************** +static void hex2Str(unsigned long num, char *str) +{ + static const char hextable[16] = "0123456789ABCDEF"; + unsigned long i, n; + str[0] = '0'; + str[1] = 'x'; + if (0 == num) { + str[2] = '0'; + str[3] = 0; + return; + } + str +=2; + n = num >> 28; + i = 0; + while (0 == n) { + num <<= 4; + n = num >> 28; + i++; + } + for (; i < 8; i++) { + *str++ = hextable[num >> 28]; + num <<= 4; + } + *str = 0; +} + +int changeAfeId(void) +{ + NVRAM_DATA nvramData; + + readNvramData(&nvramData); + hex2Str(nvramData.afeId[0], gAfeId[0].parameter); + hex2Str(nvramData.afeId[1], gAfeId[1].parameter); + if (processPrompt(gAfeId, gAfeIdParams)) + { + nvramData.afeId[0] = lib_atoi(gAfeId[0].parameter); + nvramData.afeId[1] = lib_atoi(gAfeId[1].parameter); + writeNvramData(&nvramData); + } + return 0; +} diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_eth.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_eth.c new file mode 100755 index 0000000..c4ea465 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_eth.c @@ -0,0 +1,547 @@ +/* +<:copyright-broadcom + + Copyright (c) 2002 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ + +/** Includes. **/ +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_string.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_ioctl.h" +#include "cfe_device.h" +#include "cfe_devfuncs.h" +#include "sbmips.h" +#include "cfe_timer.h" +#include "dev_bcm63xx_eth.h" +#include "dev_bcm63xx_flash.h" +#include "mii.h" +#include "robosw_reg.h" + +#define DMA_RX_CHAN (softc->dmaPort * 2) +#define DMA_TX_CHAN (softc->dmaPort * 2 + 1) + +#define CACHE_ALIGN 16 +extern void _cfe_flushcache(int, uint8_t *, uint8_t *); +#define INVAL_RANGE(s,l) _cfe_flushcache(CFE_CACHE_INVAL_RANGE,((uint8_t *) (s)),((uint8_t *) (s))+(l)) +#define FLUSH_RANGE(s,l) _cfe_flushcache(CFE_CACHE_FLUSH_RANGE,((uint8_t *) (s)),((uint8_t *) (s))+(l)) + +/** Externs. **/ +extern unsigned long sysGetEnetModeFlag(void); + +/** Prototypes. **/ +static void bcm63xx_ether_probe( cfe_driver_t * drv, unsigned long probe_a, + unsigned long probe_b, void * probe_ptr ); +static int bcm63xx_ether_open(cfe_devctx_t *ctx); +static int bcm63xx_ether_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm63xx_ether_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int bcm63xx_ether_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm63xx_ether_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm63xx_ether_close(cfe_devctx_t *ctx); +static int internal_open(bcmenet_softc * softc); + +/** Variables. **/ +const static cfe_devdisp_t bcm63xx_ether_dispatch = { + bcm63xx_ether_open, + bcm63xx_ether_read, + bcm63xx_ether_inpstat, + bcm63xx_ether_write, + bcm63xx_ether_ioctl, + bcm63xx_ether_close, + NULL, + NULL +}; + +const cfe_driver_t bcm63xx_enet = { + "BCM63xx Ethernet", + "eth", + CFE_DEV_NETWORK, + &bcm63xx_ether_dispatch, + bcm63xx_ether_probe +}; + +/** Functions. **/ +static void bcm63xx_ether_probe( cfe_driver_t * drv, unsigned long probe_a, + unsigned long probe_b, void * probe_ptr ) +{ + bcmenet_softc * softc; + char descr[100]; + + softc = (bcmenet_softc *) KMALLOC( sizeof(bcmenet_softc), CACHE_ALIGN ); + if( softc == NULL ) { + xprintf( "BCM63xx : Failed to allocate softc memory.\n" ); + } else { + memset( softc, 0, sizeof(bcmenet_softc) ); + + if (internal_open( softc ) == -1) + xprintf("Failed initializing enet hardware\n"); + else + { + cfe_attach( drv, softc, NULL, descr ); + } + } +} + +static int bcm63xx_ether_open(cfe_devctx_t *ctx) +{ + /* FIXME -- See if this can be returned to its normal place. */ + return 0; +} + +/* + * init_dma: Initialize DMA control register + */ +static void init_dma(bcmenet_softc *softc) +{ + uint32 *StateRam; + int i; + + /* + * clear State RAM + */ + StateRam = (UINT32 *)&softc->dmaCtrl->stram.s[0]; + for (i = 0; i < sizeof(DmaStateRam) / sizeof(UINT32) * NUM_PORTS * 2; i++) + StateRam[i] = 0; + + /* + * initialize IUDMA controller register + */ + softc->dmaCtrl->controller_cfg = DMA_FLOWC_CH1_EN; + softc->dmaCtrl->flowctl_ch1_thresh_lo = DMA_FC_THRESH_LO; + softc->dmaCtrl->flowctl_ch1_thresh_hi = DMA_FC_THRESH_HI; + softc->dmaCtrl->flowctl_ch1_alloc = 0; + + // transmit + softc->txDma->cfg = 0; /* initialize first (will enable later) */ + softc->txDma->maxBurst = DMA_MAX_BURST_LENGTH; + softc->txDma->intMask = 0; /* mask all ints */ + /* clr any pending interrupts on channel */ + softc->txDma->intStat = DMA_DONE|DMA_NO_DESC|DMA_BUFF_DONE; + softc->txDma->intMask = DMA_DONE; + softc->dmaCtrl->stram.s[DMA_TX_CHAN].baseDescPtr = (uint32)K1_TO_PHYS((uint32_t)(softc->txFirstBdPtr)); + + // receive + softc->rxDma->cfg = 0; // initialize first (will enable later) + softc->rxDma->maxBurst = DMA_MAX_BURST_LENGTH; + softc->rxDma->intMask = 0; /* mask all ints */ + /* clr any pending interrupts on channel */ + softc->rxDma->intStat = DMA_DONE|DMA_NO_DESC|DMA_BUFF_DONE; + softc->rxDma->intMask = DMA_DONE; + softc->dmaCtrl->stram.s[DMA_RX_CHAN].baseDescPtr = (uint32)K1_TO_PHYS((uint32_t)(softc->rxFirstBdPtr)); +} + + +static int internal_open(bcmenet_softc * softc) +{ + int i; + void *p; + + robosw_init(); + softc->dmaCtrl = (DmaRegs *)(SWITCH_DMA_BASE); + + softc->rxDma = &softc->dmaCtrl->chcfg[DMA_RX_CHAN]; + softc->txDma = &softc->dmaCtrl->chcfg[DMA_TX_CHAN]; + + // If doing SW reboot in EPI the controller can still be active + softc->rxDma->cfg = 0; + softc->txDma->cfg = 0; + softc->dmaCtrl->controller_cfg &= ~DMA_MASTER_EN; + + p = KMALLOC( NR_TX_BDS * sizeof(DmaDesc), CACHE_ALIGN ); + if( p == NULL ) { + xprintf( "BCM63xx : Failed to allocate txBds memory.\n" ); + return -1; + } + INVAL_RANGE(p, NR_TX_BDS * sizeof(DmaDesc)); + softc->txBds = (DmaDesc *)K0_TO_K1((uint32) p); + + p = KMALLOC( NR_RX_BDS * sizeof(DmaDesc), CACHE_ALIGN ); + if( p== NULL ) { + xprintf( "BCM63xx : Failed to allocate rxBds memory.\n" ); + KFREE( (void *)(softc->txBds) ); + softc->txBds = NULL; + return -1; + } + INVAL_RANGE(p, NR_RX_BDS * sizeof(DmaDesc)); + softc->rxBds = (DmaDesc *)K0_TO_K1((uint32) p); + + softc->rxBuffers = (uint32_t)KMALLOC( NR_RX_BDS * ENET_BUF_SIZE, CACHE_ALIGN ); + if( softc->rxBuffers == NULL ) { + xprintf( "BCM63xx : Failed to allocate RxBuffer memory.\n" ); + KFREE( (void *)(softc->txBds) ); + softc->txBds = NULL; + KFREE( (void *)(softc->rxBds) ); + softc->rxBds = NULL; + return -1; + } + INVAL_RANGE(softc->rxBuffers, NR_RX_BDS * ENET_BUF_SIZE); + + softc->txBuffers = (uint32_t)KMALLOC( NR_TX_BDS * ENET_BUF_SIZE, CACHE_ALIGN ); + if( softc->txBuffers == NULL ) { + xprintf( "BCM63xx : Failed to allocate txBuffer memory.\n" ); + KFREE( (void *)(softc->rxBuffers) ); + softc->rxBuffers = NULL; + KFREE( (void *)(softc->txBds) ); + softc->txBds = NULL; + KFREE( (void *)(softc->rxBds) ); + softc->rxBds = NULL; + return -1; + } + INVAL_RANGE(softc->txBuffers, NR_TX_BDS * ENET_BUF_SIZE); + + /* Init the Receive Buffer Descriptor Ring. */ + softc->rxFirstBdPtr = softc->rxBdReadPtr = softc->rxBds; + softc->rxLastBdPtr = softc->rxBds + NR_RX_BDS - 1; + + for(i = 0; i < NR_RX_BDS; i++) { + (softc->rxBds + i)->status = DMA_OWN; + (softc->rxBds + i)->length = ENET_BUF_SIZE; + (softc->rxBds + i)->address = softc->rxBuffers + i * ENET_BUF_SIZE; + (softc->rxBds + i)->address = K1_TO_PHYS( (softc->rxBds + i)->address ); + softc->dmaCtrl->flowctl_ch1_alloc = 1; + } + softc->rxLastBdPtr->status |= DMA_WRAP; + + /* Init Transmit Buffer Descriptor Ring. */ + softc->txFirstBdPtr = softc->txNextBdPtr = softc->txBds; + softc->txLastBdPtr = softc->txBds + NR_TX_BDS - 1; + + for(i = 0; i < NR_TX_BDS; i++) { + (softc->txBds + i)->status = 0; + (softc->txBds + i)->length = 0; + (softc->txBds + i)->address = softc->txBuffers + i * ENET_BUF_SIZE; + (softc->txBds + i)->address = K1_TO_PHYS( (softc->txBds + i)->address ); + } + softc->txLastBdPtr->status = DMA_WRAP; + + /* init dma registers */ + init_dma(softc); + + robosw_configure_ports(); + + softc->dmaCtrl->controller_cfg |= DMA_MASTER_EN; + + softc->rxDma->cfg |= DMA_ENABLE; + + softc->linkCheck = 0; + + return 0; +} + +static int bcm63xx_ether_read( cfe_devctx_t * ctx, iocb_buffer_t * buffer ) +{ + unsigned char * dstptr; + unsigned char * srcptr; + volatile DmaDesc * CurrentBdPtr; + bcmenet_softc * softc = (bcmenet_softc *) ctx->dev_softc; + uint16 dmaFlag; + + if( ctx == NULL ) { + xprintf( "No context\n" ); + return -1; + } + + if( buffer == NULL ) { + xprintf( "No dst buffer\n" ); + return -1; + } + + if( softc == NULL ) { + xprintf( "softc has not been initialized.\n" ); + return -1; + } + + dmaFlag = (uint16) softc->rxBdReadPtr->status; + if (!(dmaFlag & DMA_EOP)) + { + xprintf("dmaFlag (return -1)[%04x]\n", dmaFlag); + return -1; + } + + dstptr = buffer->buf_ptr; + CurrentBdPtr = softc->rxBdReadPtr; + + srcptr = (unsigned char *)( PHYS_TO_K1(CurrentBdPtr->address) ); + + buffer->buf_retlen = ((CurrentBdPtr->length < buffer->buf_length) ? CurrentBdPtr->length : buffer->buf_length); + + memcpy( dstptr, srcptr, buffer->buf_retlen ); + + CurrentBdPtr->length = ENET_BUF_SIZE; + CurrentBdPtr->status &= DMA_WRAP; + CurrentBdPtr->status |= DMA_OWN; + + IncRxBdPtr( CurrentBdPtr, softc ); + softc->rxBdReadPtr = CurrentBdPtr; + softc->dmaCtrl->flowctl_ch1_alloc = 1; + + // enable rx dma + softc->rxDma->cfg = DMA_ENABLE; + return 0; +} + + +static int bcm63xx_ether_inpstat( cfe_devctx_t * ctx, iocb_inpstat_t * inpstat ) +{ + bcmenet_softc * softc; + volatile DmaDesc * CurrentBdPtr; + + /* ============================= ASSERTIONS ============================= */ + + if( ctx == NULL ) { + xprintf( "No context\n" ); + return -1; + } + + if( inpstat == NULL ) { + xprintf( "No inpstat buffer\n" ); + return -1; + } + + softc = (bcmenet_softc *)ctx->dev_softc; + if( softc == NULL ) { + xprintf( "softc has not been initialized.\n" ); + return -1; + } + + /* ====================================================================== */ + + + CurrentBdPtr = softc->rxBdReadPtr; + + // inp_status == 1 -> data available + inpstat->inp_status = (CurrentBdPtr->status & DMA_OWN) ? 0 : 1; + + if (!inpstat->inp_status || (++softc->linkCheck > 100)) { + // Don't check link state too often when receiving data + softc->linkCheck = 0; + robosw_check_ports(); + } + + return 0; +} + + +static int bcm63xx_ether_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + uint32_t status; + unsigned char * dstptr; + bcmenet_softc * softc; + volatile DmaDesc * CurrentBdPtr; + volatile uint32 txEvents = 0; + + /* ============================= ASSERTIONS ============================= */ + + if( ctx == NULL ) { + xprintf( "No context\n" ); + return -1; + } + + if( buffer == NULL ) { + xprintf( "No dst buffer\n" ); + return -1; + } + + if( buffer->buf_length > ENET_MAX_MTU_SIZE ) { + xprintf( "src buffer too large.\n" ); + xprintf( "size is %d\n", buffer->buf_length ); + return -1; + } + + softc = (bcmenet_softc *) ctx->dev_softc; + if( softc == NULL ) { + xprintf( "softc has not been initialized.\n" ); + return -1; + } + + /* ====================================================================== */ + + CurrentBdPtr = softc->txNextBdPtr; + + /* Find out if the next BD is available. */ + if( CurrentBdPtr->status & DMA_OWN ) { + xprintf( "No tx BD available ?!\n" ); + return -1; + } + + dstptr = (unsigned char *)PHYS_TO_K1( CurrentBdPtr->address ); + memcpy( dstptr, buffer->buf_ptr, buffer->buf_length ); + + /* Set status of DMA BD to be transmitted. */ + status = DMA_SOP | DMA_EOP | DMA_APPEND_CRC | DMA_OWN; + if( CurrentBdPtr == softc->txLastBdPtr ) { + status |= DMA_WRAP; + } + + CurrentBdPtr->length = ((buffer->buf_length < ETH_ZLEN) ? ETH_ZLEN : buffer->buf_length); + CurrentBdPtr->status = status; + + // Enable DMA for this channel + softc->txDma->cfg |= DMA_ENABLE; + + // poll the dma status until done + do + { + txEvents = CurrentBdPtr->status; + } while (txEvents & DMA_OWN); + + + //Advance BD pointer to next in the chain. + InctxBdPtr( CurrentBdPtr, softc ); + softc->txNextBdPtr = CurrentBdPtr; + + return 0; +} + +static int bcm63xx_ether_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + bcmenet_softc *softc = (bcmenet_softc *) ctx->dev_softc; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_ETHER_GETHWADDR: + memcpy(buffer->buf_ptr, softc->hwaddr, sizeof(softc->hwaddr)); + return 0; + + case IOCTL_ETHER_SETHWADDR: + memcpy(softc->hwaddr, buffer->buf_ptr, sizeof(softc->hwaddr)); + return 0; + + default: + return -1; + } + + return 0; +} + +/* + * bcm63xx_ether_flush: Flushes packets from the DMA receive ring + */ +static int bcm63xx_ether_flush(bcmenet_softc * softc) +{ + volatile DmaDesc * CurrentBdPtr; + uint16 dmaFlag; + unsigned char * srcptr; + uint16 len; + uint32 rxBdsCount = 0; + int i; + + if( softc == NULL ) { + xprintf( "softc has not been initialized.\n" ); + return -1; + } + + xprintf("Disabling Switch ports.\n"); + + /* disable forwarding */ + SWITCH->SwitchMode &= ~SwitchMode_FwdgEn; + + /* Bring the link down on all switch ports */ + for(i=0; i<8; ++i) { + SWITCH->PortOverride[i] &= ~PortOverride_Linkup; + /* disable Rx and Tx */ + SWITCH->PortCtrl[i] = PortCtrl_DisableTx | PortCtrl_DisableRx; + } + + for(i=0; i<1000; ++i) { + cfe_usleep(1000); + } + + xprintf("Flushing Receive Buffers...\n"); + + while(!((dmaFlag = (uint16) softc->rxBdReadPtr->status) & DMA_OWN)) { + + if (!(dmaFlag & DMA_EOP)) + { + xprintf("dmaFlag (return -1)[%04x]\n", dmaFlag); + return -1; + } + + CurrentBdPtr = softc->rxBdReadPtr; + + srcptr = (unsigned char *)( PHYS_TO_K1(CurrentBdPtr->address) ); + + len = CurrentBdPtr->length; + + ++rxBdsCount; + + CurrentBdPtr->length = ENET_BUF_SIZE; + CurrentBdPtr->status &= DMA_WRAP; + CurrentBdPtr->status |= DMA_OWN; + + IncRxBdPtr( CurrentBdPtr, softc ); + softc->rxBdReadPtr = CurrentBdPtr; + softc->dmaCtrl->flowctl_ch1_alloc = 1; + + // enable rx dma + softc->rxDma->cfg = DMA_ENABLE; + } + + xprintf("%d buffers found.\n", rxBdsCount); + + return 0; +} + +static int bcm63xx_ether_close(cfe_devctx_t *ctx) +{ + int i; + bcmenet_softc * softc = (bcmenet_softc *) ctx->dev_softc; + unsigned long sts; + + /* flush Rx DMA Channel */ + bcm63xx_ether_flush(softc); + + xprintf("Closing DMA Channels.\n"); + + sts = softc->rxDma->intStat; + softc->rxDma->intStat = sts; + softc->rxDma->intMask = 0; + softc->rxDma->cfg = 0; + // wait the current packet to complete before turning off EMAC, otherwise memory corruption can occur. + for(i=0; softc->rxDma->cfg & DMA_ENABLE; i++) { + // put the line below inside - it seems the signal can be lost and DMA never stops + softc->rxDma->cfg = 0; + if (i >= 20) { + xprintf("Rx Timeout !!!\n"); + break; + } + cfe_usleep(100); + } + + sts = softc->txDma->intStat; + softc->txDma->intStat = sts; + softc->txDma->intMask = 0; + softc->txDma->cfg = 0; + for(i=0; softc->txDma->cfg & DMA_ENABLE; i++) { + // put the line below inside - it seems the signal can be lost and DMA never stops + softc->txDma->cfg = 0; + if (i >= 20) { + xprintf("Tx Timeout !!!\n"); + break; + } + cfe_usleep(100); + } + + /* return buffer allocation register internal count to 0 */ + softc->dmaCtrl->flowctl_ch1_alloc = (DMA_BUF_ALLOC_FORCE | 0); + + softc->dmaCtrl->controller_cfg &= ~DMA_MASTER_EN; + + KFREE( (void *)(softc->txBuffers) ); + KFREE( (void *)(softc->rxBuffers) ); + KFREE( (void *)(softc->txBds) ); + KFREE( (void *)(softc->rxBds) ); + return 0; +} diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_flash.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_flash.c new file mode 100755 index 0000000..cf38104 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_flash.c @@ -0,0 +1,629 @@ +/*************************************************************************** + * Broadcom Corp. Confidential + * Copyright 2001 Broadcom Corp. All Rights Reserved. + * + * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED + * SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM. + * YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT + * SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. + * + *************************************************************************** + * File Name : bcm63xx_flash.c + * + * Description: This file contains the flash device driver for bcm63xx board. Very similar to + * board.c in linux development. + * + * Created on : 4/18/2002 seanl + * + ***************************************************************************/ + + +/* Includes. */ +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_string.h" +#include "lib_printf.h" + +#include "bcm_map.h" +#include "bcm_hwdefs.h" +#include "dev_bcm63xx_flash.h" +#include "flash_api.h" +#include "boardparms.h" +#include "boardparms_voice.h" +#include "bcm63xx_util.h" + +//#define DEBUG_FLASH + +/* This driver determines the NVRAM and persistent storage flash address and + * length. + */ +/* Foxconn start jenny add for timeout */ +extern int NMRPKeepAlive(void); +extern int NMRPTFTPWaiting(void); +extern int g_nmrp_keepalive; +extern int nmrp_server_detected; +/* Foxconn end jenny add for timeout*/ + +static FLASH_ADDR_INFO fInfo; + +//************************************************************************************** +// Flash read/write and image downloading.. +//************************************************************************************** + +void kerSysFlashInit( void ) +{ + NVRAM_DATA nvramData; + + flash_init(); + + while ((readNvramData(&nvramData) != 0) || (BpSetBoardId(nvramData.szBoardId) != BP_SUCCESS)) + { + printf("\n*** Board is not initialized properly ***\n\n"); + //setBoardParam(); /* Bob removed to set default board parameters, 11/01/2010 */ + setDefaultBoardParam(); /* Bob added to set default board parameters, 11/01/2010 */ + } + + fInfo.flash_rootfs_start_offset = flash_get_sector_size(0); + if( fInfo.flash_rootfs_start_offset < FLASH_LENGTH_BOOT_ROM ) + fInfo.flash_rootfs_start_offset = FLASH_LENGTH_BOOT_ROM; + + flash_init_info(&nvramData, &fInfo); + +#if (INC_NAND_FLASH_DRIVER==1) + validateNandPartTbl(&nvramData); + + /* Check if spare area data contains non 0xff values after JFFS2 clean + * marker. Early version of this CFE driver filled bytes 8 - 11 with + * 0 which Linux does not like. + */ + { + extern int read_spare_data(int blk, unsigned char *buf, int bufsize); + + int blk_size = flash_get_sector_size(0) / 1024; + int blk_start = nvramData.ulNandPartOfsKb[NP_DATA] / blk_size; + unsigned char spare[64]; + + memset(spare, 0xff, sizeof(spare)); + if( read_spare_data(blk_start, spare, sizeof(spare)) == FLASH_API_OK ) + { + const int spare_len = 8; /* Linux JFFS2 spare area is 8 bytes */ + int i; + + for( i = spare_len; i < sizeof(spare); i++ ) + { + if( spare[i] != 0xff ) + { + printf("Data spare area is not correct, erasing psi\n"); + printf("%8.8lx %8.8lx %8.8lx %8.8lx\n", + *(unsigned long *) &spare[0],*(unsigned long *)&spare[4], + *(unsigned long *) &spare[8],*(unsigned long *)&spare[12]); + kerSysErasePsi(); + break; + } + } + } + } +#endif +} + +#if (INC_NAND_FLASH_DRIVER==1) || (INC_SPI_PROG_NAND==1) +/*********************************************************************** + * Function Name: validateNandPartTbl + * Description : Checks the NAND partition table fields in NVRAM data. + * If nay of the fields are not valid, new values are set. + * Returns : None. + ***********************************************************************/ +void validateNandPartTbl(PNVRAM_DATA pNvramData) +{ + unsigned long ulBlockSizeKb = (unsigned long)flash_get_sector_size(0)/1024; + unsigned long ulTotalSizeKb = (unsigned long)flash_get_total_size() / 1024; + +#if (INC_SPI_PROG_NAND==1) + if( flash_get_flash_type() != FLASH_IFC_NAND ) + return; +#endif + if( pNvramData->ulNandPartSizeKb[NP_BOOT] != ulBlockSizeKb || + pNvramData->ulNandPartSizeKb[NP_DATA] != NAND_DATA_SIZE_KB || + (pNvramData->ulNandPartSizeKb[NP_BBT] != NAND_BBT_SMALL_SIZE_KB && + pNvramData->ulNandPartSizeKb[NP_BBT] != NAND_BBT_BIG_SIZE_KB) ) + { + /* Initialize NAND flash partition table. */ + unsigned long ulRootfsSizeKb; + unsigned long ulBbtSizeKb = (ulTotalSizeKb > NAND_BBT_THRESHOLD_KB) + ? NAND_BBT_BIG_SIZE_KB : NAND_BBT_SMALL_SIZE_KB; + + /* The Boot partition is first and is one block in size. */ + pNvramData->ulNandPartOfsKb[NP_BOOT] = 0; + pNvramData->ulNandPartSizeKb[NP_BOOT] = ulBlockSizeKb; + + /* The Bad Block Table partition is last and is a constant size. */ + pNvramData->ulNandPartOfsKb[NP_BBT] = ulTotalSizeKb - ulBbtSizeKb; + pNvramData->ulNandPartSizeKb[NP_BBT] = ulBbtSizeKb; + + /* The Data partition is before the BBT and is a constant size. */ + pNvramData->ulNandPartOfsKb[NP_DATA] = + pNvramData->ulNandPartOfsKb[NP_BBT] - NAND_DATA_SIZE_KB; + pNvramData->ulNandPartSizeKb[NP_DATA] = NAND_DATA_SIZE_KB; + + /* The first rootfs partition starts at the second sector. */ + pNvramData->ulNandPartOfsKb[NP_ROOTFS_1] = ulBlockSizeKb; + + /* The size of the two root file system partitions is whatever is left + * after the Boot, Data and BBT paritions divided by 2 and evenly + * divisible by the NAND flash block size. + */ + ulRootfsSizeKb = ((pNvramData->ulNandPartOfsKb[NP_DATA] - + pNvramData->ulNandPartOfsKb[NP_ROOTFS_1]) / 2); + ulRootfsSizeKb = (ulRootfsSizeKb / ulBlockSizeKb) * ulBlockSizeKb; + +#if 1 /* support two file system partitions */ + pNvramData->ulNandPartSizeKb[NP_ROOTFS_1] = ulRootfsSizeKb; + + pNvramData->ulNandPartOfsKb[NP_ROOTFS_2] = + pNvramData->ulNandPartOfsKb[NP_ROOTFS_1] + ulRootfsSizeKb; + pNvramData->ulNandPartSizeKb[NP_ROOTFS_2] = ulRootfsSizeKb; +#else /* support one file system partition */ + pNvramData->ulNandPartSizeKb[NP_ROOTFS_1] = ulRootfsSizeKb * 2; + + pNvramData->ulNandPartOfsKb[NP_ROOTFS_2] = ulTotalSizeKb; + pNvramData->ulNandPartSizeKb[NP_ROOTFS_2] = 0; +#endif + + writeNvramData(pNvramData); + +#if defined(DEBUG_FLASH) + printf("boot offset=0x%8.8lx, size=0x%8.8lx\n", + pNvramData->ulNandPartOfsKb[NP_BOOT], + pNvramData->ulNandPartSizeKb[NP_BOOT]); + printf("rootfs1 offset=0x%8.8lx, size=0x%8.8lx\n", + pNvramData->ulNandPartOfsKb[NP_ROOTFS_1], + pNvramData->ulNandPartSizeKb[NP_ROOTFS_1]); + printf("rootfs2 offset=0x%8.8lx, size=0x%8.8lx\n", + pNvramData->ulNandPartOfsKb[NP_ROOTFS_2], + pNvramData->ulNandPartSizeKb[NP_ROOTFS_2]); + printf("data offset=0x%8.8lx, size=0x%8.8lx\n", + pNvramData->ulNandPartOfsKb[NP_DATA], + pNvramData->ulNandPartSizeKb[NP_DATA]); + printf("bbt offset=0x%8.8lx, size=0x%8.8lx\n", + pNvramData->ulNandPartOfsKb[NP_BBT], + pNvramData->ulNandPartSizeKb[NP_BBT]); +#endif + } +} +#else +void validateNandPartTbl(PNVRAM_DATA pNvramData) +{ +} +#endif + + +/*********************************************************************** + * Function Name: kerSysFlashAddrInfoGet + * Description : Fills in a structure with information about the NVRAM + * and persistent storage sections of flash memory. + * Returns : None. + ***********************************************************************/ +void kerSysFlashAddrInfoGet(PFLASH_ADDR_INFO pflash_addr_info) +{ + memcpy(pflash_addr_info, &fInfo, sizeof(FLASH_ADDR_INFO)); +} + +// get shared blks into *** pTempBuf *** which has to be released bye the caller! +// return: if pTempBuf != NULL, poits to the data with the dataSize of the buffer +// !NULL -- ok +// NULL -- fail +static unsigned char *getSharedBlks(int start_blk, int num_blks) +{ + int i = 0; + int usedBlkSize = 0; + int sect_size = 0; + unsigned char *pTempBuf = NULL; + unsigned char *pBuf = NULL; + + for (i = start_blk; i < (start_blk + num_blks); i++) + usedBlkSize += flash_get_sector_size((unsigned short) i); + + if ((pTempBuf = (unsigned char *) KMALLOC(usedBlkSize, sizeof(long))) == NULL) + { + printf("failed to allocate memory with size: %d\n", usedBlkSize); + return pTempBuf; + } + + pBuf = pTempBuf; + for (i = start_blk; i < (start_blk + num_blks); i++) + { + sect_size = flash_get_sector_size((unsigned short) i); +#if defined(DEBUG_FLASH) + printf("getShareBlks: blk=%d, sect_size=%d\n", i, sect_size); +#endif + flash_read_buf((unsigned short)i, 0, pBuf, sect_size); + pBuf += sect_size; + } + + return pTempBuf; +} + + + +// Set the pTempBuf to flash from start_blk for num_blks +// return: +// 0 -- ok +// -1 -- fail +static int setSharedBlks(int start_blk, int num_blks, unsigned char *pTempBuf) +{ + int i = 0; + int sect_size = 0; + int sts = 0; + unsigned char *pBuf = pTempBuf; + + for (i = start_blk; i < (start_blk + num_blks); i++) + { + sect_size = flash_get_sector_size((unsigned short) i); + flash_sector_erase_int(i); + if (flash_write_buf(i, 0, pBuf, sect_size) != sect_size) + { + printf("Error writing flash sector %d.", i); + sts = -1; + break; + } + +#if defined(DEBUG_FLASH) + printf("setShareBlks: blk=%d, sect_size=%d\n", i, sect_size); +#endif + + pBuf += sect_size; + } + + return sts; +} + + + +/******************************************************************************* + * NVRAM functions + *******************************************************************************/ + +// get nvram data +// return: +// 0 - ok +// -1 - fail +int kerSysNvRamGet(unsigned char *string, int strLen, int offset) +{ + unsigned char *pBuf = NULL; + + if ((pBuf = getSharedBlks(NVRAM_SECTOR, 1)) == NULL) + return -1; + + // get string off the memory buffer + memcpy(string, (pBuf + NVRAM_DATA_OFFSET + offset), strLen); + + KFREE(pBuf); + + return 0; +} + + +// set nvram +// return: +// 0 - ok +// -1 - fail +int kerSysNvRamSet(unsigned char *string, int strLen, int offset) +{ + int sts = 0; + unsigned char *pBuf = NULL; + + if ((pBuf = getSharedBlks(NVRAM_SECTOR, 1)) == NULL) + return -1; + + // set string to the memory buffer + memcpy((pBuf + NVRAM_DATA_OFFSET + offset), string, strLen); + + if (setSharedBlks(NVRAM_SECTOR, 1, pBuf) != 0) + sts = -1; + + KFREE(pBuf); + + return sts; +} + +/*********************************************************************** + * Function Name: kerSysEraseNvRam + * Description : Erase the NVRAM storage section of flash memory. + * Returns : 1 -- ok, 0 -- fail + ***********************************************************************/ +int kerSysEraseNvRam(void) +{ + int sts = 1; + unsigned char *tempStorage = KMALLOC(NVRAM_LENGTH, sizeof(long)); + + // just write the whole buf with '0xff' to the flash + if (!tempStorage) + sts = 0; + else + { + memset(tempStorage, 0xff, NVRAM_LENGTH); + if (kerSysNvRamSet(tempStorage, NVRAM_LENGTH, 0) != 0) + sts = 0; + KFREE(tempStorage); + } + + return sts; +} + + +/******************************************************************************* + * PSI functions + *******************************************************************************/ + +#if (INC_NAND_FLASH_DRIVER!=1) +/** set psi while preserving any other data that might be sharing sectors with + * the psi, e.g. scratch pad. + * + * @param string (IN) buffer that holds the data to be written. + * @param strLen (IN) length of buffer. + * + * @return 0 if OK, -1 on failure. + */ +static int kerSysPsiSet(const unsigned char *string, int strLen) +{ + int sts = 0; + unsigned char *pBuf = NULL; + + if ((pBuf = getSharedBlks(fInfo.flash_persistent_start_blk, + fInfo.flash_persistent_number_blk)) == NULL) + return -1; + + // set string to the memory buffer + memcpy((pBuf + fInfo.flash_persistent_blk_offset), string, strLen); + + if (setSharedBlks(fInfo.flash_persistent_start_blk, + fInfo.flash_persistent_number_blk, pBuf) != 0) + sts = -1; + + KFREE(pBuf); + + return sts; +} + +/** set backup psi + * + * Backup PSI does not share its sectors with anything else, so this + * function does not need to read first and write. Just write. + * This function expects the length of the buffer to be exactly the + * length of the entire PSI. + * + * @param string (IN) buffer that holds the data to be written. + * + * @return 0 if OK, -1 on failure. + */ +static int kerSysBackupPsiSet(const unsigned char *string) +{ + int sts = 0; + + if (setSharedBlks(fInfo.flash_backup_psi_start_blk, + fInfo.flash_backup_psi_number_blk, + (unsigned char *) string) != 0) + sts = -1; + + return sts; +} + +/*********************************************************************** + * Function Name: kerSysErasePsi + * Description : Erase the Psi storage section of flash memory. + * Returns : 1 -- ok, 0 -- fail + ***********************************************************************/ +int kerSysErasePsi(void) +{ + int sts = 1; + unsigned char *tempStorage; + + if (fInfo.flash_persistent_start_blk == 0) { + sts = 0; + } + else { + tempStorage = KMALLOC(fInfo.flash_persistent_length, sizeof(long)); + // just write the whole buf with '0xff' to the flash + if (!tempStorage) + sts = 0; + else + { + memset(tempStorage, 0xff, fInfo.flash_persistent_length); + if (kerSysPsiSet(tempStorage, fInfo.flash_persistent_length) != 0) + sts = 0; + + // Also erase backup psi if it is there + if (fInfo.flash_backup_psi_number_blk > 0) + { + if (kerSysBackupPsiSet(tempStorage) != 0) + sts = 0; + } + + KFREE(tempStorage); + } + } + return sts; +} +#else +int kerSysErasePsi(void) +{ + int sts = 1; + NVRAM_DATA nvramData; + + if( readNvramData(&nvramData) == 0 ) + { + int blk_size = flash_get_sector_size(0) / 1024; + int blk_start = nvramData.ulNandPartOfsKb[NP_DATA] / blk_size; + int total_blks = + blk_start + (nvramData.ulNandPartSizeKb[NP_DATA]) / blk_size; + + while( blk_start < total_blks ) + { + flash_sector_erase_int(blk_start); + blk_start++; + } + sts = 0; + } + + return(sts); +} +#endif + +// flash bcm image +// return: +// 0 - ok +// !0 - the sector number fail to be flashed (should not be 0) +int kerSysBcmImageSet( int flash_start_addr, unsigned char *string, int size, int fWholeImage) +{ + int sts; + int sect_size; + int blk_start; + // int savedSize = size; + int total_blks = flash_get_numsectors(); + + /* Foxconn add by Cliff Wang, 03/23/2010 */ + unsigned char *pTempBuf = NULL; + int savedBlkStart; + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + if( flash_get_flash_type() == FLASH_IFC_NAND ) + { + if( flash_start_addr == FLASH_BASE ) + total_blks = 1; + else + { + NVRAM_DATA nvramData; + + if( readNvramData(&nvramData) == 0 ) + { + sect_size = flash_get_sector_size(0); + int rootfs = + ((flash_start_addr - FLASH_BASE) / 1024 == + nvramData.ulNandPartOfsKb[NP_ROOTFS_2]) + ? NP_ROOTFS_2 : NP_ROOTFS_1; + + total_blks = (nvramData.ulNandPartOfsKb[rootfs] + + nvramData.ulNandPartSizeKb[rootfs]) / (sect_size/ 1024); + } + } + } + +#if defined(DEBUG_FLASH) + printf("kerSysBcmImageSet: flash_start_addr=0x%x string=%p len=%d wholeImage=%d\n", + flash_start_addr, string, size, fWholeImage); +#endif + + blk_start = flash_get_blk(flash_start_addr); + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + savedBlkStart = blk_start; + if( blk_start < 0 ) + return( -1 ); + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + /* write image to flash memory */ + do + { + g_nmrp_keepalive = 1; /* Foxconn add by Cliff Wang, 03/23/2010 */ + + sect_size = flash_get_sector_size(blk_start); + +#if defined(DEBUG_FLASH) + printf("Image flashing on block: %d\n", blk_start); +#endif + + // share the blk with psi only when fWholeImage == 0 + // Foxconn modified by Silver Shih for burn board Id + if ((!fWholeImage && blk_start == fInfo.flash_persistent_start_blk) || (fWholeImage == 5)) + { + +#if 0 + if (size > (sect_size - fInfo.flash_persistent_length)) + { + printf("Image is too big\n"); + break; // image is too big. Can not overwrite to psi + } +#endif + + if ((pTempBuf = (unsigned char *) KMALLOC(sect_size, sizeof(long))) == NULL) + { + printf("Failed to allocate memory with size: %d\n", sect_size); + break; + } + flash_read_buf((unsigned short)blk_start, 0, pTempBuf, sect_size); + memcpy(pTempBuf, string, size); + flash_sector_erase_int(blk_start); // erase blk before flash + + + if (flash_write_buf(blk_start, 0, pTempBuf, sect_size) == sect_size) + size = 0; // break out and say all is ok + break; + } + + flash_sector_erase_int(blk_start); // erase blk before flash + + if (sect_size > size) + { + if (size & 1) + size++; + sect_size = size; + } + if (flash_write_buf(blk_start, 0, string, sect_size) != sect_size) { + if( flash_get_flash_type() != FLASH_IFC_NAND ) + break; + blk_start++; + } + else { + printf("."); + blk_start++; + string += sect_size; + size -= sect_size; + + /* Foxconn added start by jenny @NMRP */ + if(nmrp_server_detected==1) // in NMRP mode + { + if(blk_start - savedBlkStart == 30) + { + savedBlkStart = blk_start; + printf("\n"); + NMRPKeepAlive(); + } + } + /* Foxconn added end by jenny @NMRP */ + } + } while (size > 0); + g_nmrp_keepalive = 0; /* Foxconn added by jenny add for timeout */ + +#if 0 /* Foxconn removed by EricHuang */ + if (size == 0 && fWholeImage && savedSize > FLASH_LENGTH_BOOT_ROM) + { + // If flashing a whole image, erase to end of flash. + while( blk_start < total_blks ) + { + flash_sector_erase_int(blk_start); + printf("."); + blk_start++; + } + } +#endif + + printf("\n\n"); + + if( size == 0 ) + sts = 0; // ok + else + sts = blk_start; // failed to flash this sector + + g_nmrp_keepalive = 0; /* Foxconn jenny add for timeout */ + return sts; +} + +unsigned long kerSysReadFromFlash( void *toaddr, unsigned long fromaddr, + unsigned long len ) +{ + int sect = flash_get_blk((int) fromaddr); + unsigned char *start = flash_get_memptr(sect); + flash_read_buf( sect, (int) fromaddr - (int) start, toaddr, len ); + + return(len); +} + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_uart.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_uart.c new file mode 100755 index 0000000..3b2ce63 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/dev_bcm63xx_uart.c @@ -0,0 +1,211 @@ +#include "cfe.h" +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" + +#include "sbmips.h" +#include "bsp_config.h" + +#include "bcm_hwdefs.h" +#include "bcm_map.h" + +static void bcm63xx_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +static int bcm63xx_uart_open(cfe_devctx_t *ctx); +static int bcm63xx_uart_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm63xx_uart_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int bcm63xx_uart_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm63xx_uart_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm63xx_uart_close(cfe_devctx_t *ctx); + +const static cfe_devdisp_t bcm63xx_uart_dispatch = { + bcm63xx_uart_open, + bcm63xx_uart_read, + bcm63xx_uart_inpstat, + bcm63xx_uart_write, + bcm63xx_uart_ioctl, + bcm63xx_uart_close, + NULL, + NULL +}; + + +const cfe_driver_t bcm63xx_uart = { + "BCM63xx DUART", + "uart", + CFE_DEV_SERIAL, + &bcm63xx_uart_dispatch, + bcm63xx_uart_probe +}; + + +typedef struct bcm63xx_uart_s { + int baudrate; +} bcm63xx_uart_t; + + +static void bcm63xx_set_baudrate( bcm63xx_uart_t * softc ) +{ + uint32_t baudwd; + + baudwd = (FPERIPH / softc->baudrate) / 16; + if( baudwd & 0x1 ) { + baudwd = baudwd / 2; + } else { + baudwd = baudwd / 2 - 1; + } + UART->baudword = baudwd; +} + + +static void bcm63xx_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + bcm63xx_uart_t * softc; + char descr[80]; + + /* enable the transmitter interrupt? */ + + /* + * probe_a is the DUART base address. + * probe_b is the channel-number-within-duart (0 or 1) + * probe_ptr is unused. + */ + softc = (bcm63xx_uart_t *) KMALLOC(sizeof(bcm63xx_uart_t),0); + if (softc) { + xsprintf( descr, "%s channel %d", drv->drv_description, probe_b ); + cfe_attach( drv, softc, NULL, descr ); + } +} + +static int bcm63xx_uart_open(cfe_devctx_t *ctx) +{ + bcm63xx_uart_t * softc = ctx->dev_softc; + + /* Enable the UART clock */ + softc->baudrate = CFG_SERIAL_BAUD_RATE; + bcm63xx_set_baudrate( softc ); + + UART->control = BRGEN | TXEN | RXEN; + UART->config = BITS8SYM | ONESTOP; + UART->fifoctl = RSTTXFIFOS | RSTRXFIFOS; + UART->intMask = 0; + + return 0; +} + + +static int bcm63xx_uart_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + unsigned char * bptr; + int blen; + uint32_t status; + char inval; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + while (blen > 0) { + status = UART->intStatus; + if(status & (RXOVFERR | RXPARERR | RXFRAMERR | RXBRK)) { + /* RX over flow */ + if(status & RXOVFERR) { + /* reset RX FIFO to clr interrupt */ + UART->fifoctl |= RSTRXFIFOS; + } + + /* other errors just read the bad character to clear the bit */ + inval = UART->Data; + } + else if(status & RXFIFONE) { + *bptr++ = UART->Data; + blen--; + } + else + break; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + + +static int bcm63xx_uart_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + inpstat->inp_status = UART->intStatus & RXFIFONE; + return 0; +} + + +static int bcm63xx_uart_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + unsigned char * bptr; + int blen; + uint32_t status; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + status = 0; + while( (blen > 0) && !status ) { + /* Wait for the buffer to empty before we write the next character */ + /* FIXME - The serial port should be able to accept more than one */ + /* character at a time. Why doesn't it work though? */ + do { + status = UART->intStatus & TXFIFOEMT; + } while( !status ); + UART->Data = *bptr; + bptr++; + blen--; + + status = UART->intStatus & (TXOVFERR|TXUNDERR); + } + + if( status ) { + /* Reset TX FIFO */ + UART->fifoctl |= RSTTXFIFOS; + blen++; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + + +static int bcm63xx_uart_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + bcm63xx_uart_t * softc = ctx->dev_softc; + unsigned int * info = (unsigned int *) buffer->buf_ptr; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_SERIAL_GETSPEED: + *info = softc->baudrate; + break; + case IOCTL_SERIAL_SETSPEED: + softc->baudrate = *info; + bcm63xx_set_baudrate( softc ); + break; + case IOCTL_SERIAL_GETFLOW: + *info = SERIAL_FLOW_NONE; + break; + case IOCTL_SERIAL_SETFLOW: + break; + default: + return -1; + } + + return 0; +} + + +static int bcm63xx_uart_close(cfe_devctx_t *ctx) +{ + /* Turn off the UART clock. */ + return 0; +} diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/html/ul.html b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/html/ul.html new file mode 100755 index 0000000..a663a35 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/html/ul.html @@ -0,0 +1,48 @@ + + + + + + +
+
+ Update Software
+
+ Step 1: Obtain an updated software image file from your ISP.
+
+ Step 2: Enter the path to the image file location in the box below or + click the "Browse" button to locate the image file.
+
+ Step 3: Click the "Update Software" button once to upload the new image + file.
+
+ NOTE: The update process takes about 2 minutes to complete, and your DSL Router + will reboot.
+
+ + + + + +
Software File Name:  +
+

+
+
+ + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/html/ulinfo.html b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/html/ulinfo.html new file mode 100755 index 0000000..1edb2ae --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/html/ulinfo.html @@ -0,0 +1,60 @@ + + + + + + +
DSL Router Software Upgrade
+
+ +
+
+
+ +
+
+ + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/ram_cfe.mk b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/ram_cfe.mk new file mode 100755 index 0000000..a540170 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/ram_cfe.mk @@ -0,0 +1,378 @@ + +# +# CFE's version number +# + +include ${TOP}/main/cfe_version.mk + +# +# Default values for certain parameters +# + +CFG_MLONG64 ?= 0 +CFG_LITTLE ?= 0 +CFG_RELOC ?= 0 +CFG_UNCACHED ?= 0 +CFG_NEWRELOC ?= 0 +CFG_BOOTRAM ?= 0 +CFG_VGACONSOLE ?= 0 +CFG_PCI ?= 1 +CFG_LDT_REV_017 ?= 0 +CFG_ZLIB ?= 0 +CFG_BIENDIAN ?= 0 +CFG_DOWNLOAD ?= 0 +CFG_RAMAPP ?= 0 +CFG_USB ?= 0 + +# +# Paths to other parts of the firmware. Everything's relative to ${TOP} +# so that you can actually do a build anywhere you want. +# + +ARCH_TOP = ${TOP}/arch/${ARCH} +ARCH_SRC = ${ARCH_TOP}/common/src +ARCH_INC = ${ARCH_TOP}/common/include +CPU_SRC = ${ARCH_TOP}/cpu/${CPU}/src +CPU_INC = ${ARCH_TOP}/cpu/${CPU}/include + +# +# It's actually optional to have a 'board' +# directory. If you don't specify BOARD, +# don't include the files. +# + +ifneq ("$(strip ${BOARD})","") +BOARD_SRC = ${ARCH_TOP}/board/${BOARD}/src +BOARD_INC = ${ARCH_TOP}/board/${BOARD}/include +endif + +# +# Preprocessor defines for CFE's version number +# + +VDEF = -DCFE_VER_MAJ=${CFE_VER_MAJ} -DCFE_VER_MIN=${CFE_VER_MIN} -DCFE_VER_ECO=${CFE_VER_ECO} + +# +# Construct the list of paths that will eventually become the include +# paths and VPATH +# + +SRCDIRS = ${ARCH_SRC} ${CPU_SRC} ${LZMZ_SRC} ${BOARD_SRC} ${TOP}/main ${TOP}/vendor ${TOP}/include ${TOP}/net ${TOP}/dev ${TOP}/pci ${TOP}/ui ${TOP}/lib ${TOP}/common ${TOP}/verif ${TOP}/lzma + +CFE_INC = ${TOP}/include ${TOP}/pci ${TOP}/net + +ifeq ($(strip ${CFG_VGACONSOLE}),1) +SRCDIRS += ${TOP}/x86emu ${TOP}/pccons +CFE_INC += ${TOP}/x86emu ${TOP}/pccons +endif + +ifeq ($(strip ${CFG_VAPI}),1) +SRCDIRS += ${TOP}/verif +CFE_INC += ${TOP}/verif +endif + +ifeq ($(strip ${CFG_ZLIB}),1) +SRCDIRS += ${TOP}/zlib +CFE_INC += ${TOP}/zlib +endif + + +INCDIRS = $(patsubst %,-I%,$(subst :, ,$(ARCH_INC) $(CPU_INC) $(BOARD_INC) $(CFE_INC))) + +VPATH = $(SRCDIRS) + +# +# Bi-endian support: If we're building the little-endian +# version, use a different linker script so we can locate the +# ROM at a higher address. You'd think we could do this with +# normal linker command line switches, but there appears to be no +# command-line way to override the 'AT' qualifier in the linker script. +# + +CFG_TEXTAT1MB=0 +ifeq ($(strip ${CFG_BIENDIAN}),1) + ifeq ($(strip ${CFG_LITTLE}),1) + CFG_TEXTAT1MB=1 + endif +endif + + +# +# Configure tools and basic tools flags. This include sets up +# macros for calling the C compiler, basic flags, +# and linker scripts. +# + +include ${ARCH_SRC}/tools.mk + +# +# Add some common flags that are used on any architecture. +# + +CFLAGS += -I. $(INCDIRS) +CFLAGS += -D_CFE_ ${VDEF} -DCFG_BOARDNAME=\"${CFG_BOARDNAME}\" -DCONFIG_MIPS_BRCM + +# +# Add flash driver support. +# +# INC_xxx_FLASH_DRIVER is exported from rom_cfe.mk + +CFLAGS += -DINC_CFI_FLASH_DRIVER=$(INC_CFI_FLASH_DRIVER) +CFLAGS += -DINC_SPI_FLASH_DRIVER=$(INC_SPI_FLASH_DRIVER) +CFLAGS += -DINC_NAND_FLASH_DRIVER=$(INC_NAND_FLASH_DRIVER) +CFLAGS += -DINC_SPI_PROG_NAND=$(INC_SPI_PROG_NAND) + +# +# Set CFG_TCP=0 to not include the TCP protocol. +# + +CFG_TCP=1 +ifeq ($(strip ${CFG_TCP}),1) +CFLAGS += -DCFG_TCP +endif + +# +# Set CFG_WEB_SERVER=0 to not include the web server. +# + +CFG_WEB_SERVER=1 +CFLAGS += -DCFG_WEB_SERVER=${CFG_WEB_SERVER} + +# +# Gross - allow more options to be supplied from command line +# + +ifdef CFG_OPTIONS +OPTFLAGS = $(patsubst %,-D%,$(subst :, ,$(CFG_OPTIONS))) +CFLAGS += ${OPTFLAGS} +endif + + +# +# IKOS Build +# + +ifeq ($(strip $(BRCM_IKOS)),y) +CFLAGS += -DCONFIG_BRCM_IKOS +endif + +# +# This is the makefile's main target. Note that we actually +# do most of the work in 'ALL' not 'all', since we include +# other makefiles after this point. +# + +all : build_date.c ALL + +# +# Macros that expand to the list of arch-independent files +# + +LZMAOBJS = LzmaDecode.o dcapi.o +DEVOBJS = +## dev_newflash.o dev_null.o dev_promice.o dev_ide_common.o dev_ns16550.o dev_ds17887clock.o dev_flash.o +LIBOBJS = lib_malloc.o lib_printf.o lib_queue.o lib_string.o lib_string2.o \ + lib_setjmp.o lib_arena.o +##lib_hssubr.o lib_physio.o lib_misc.o lib_qsort.o + +## Foxconn add start by Cliff Wang, 03/23/2010 ## +#NETOBJS = net_ether.o net_tftp.o net_ip.o net_udp.o net_dns.o net_arp.o \ + net_api.o net_tcp.o net_tcpbuf.o +NETOBJS = net_ether.o net_tftp.o net_ip.o net_udp.o net_dns.o net_arp.o \ + net_api.o net_tcp.o net_tcpbuf.o net_nmrp.o +## Foxconn add end by Cliff Wang, 03/23/2010 + +## dev_tcpconsole.o net_dhcp.o net_icmp.o +CFEOBJS = cfe_attach.o cfe_iocb_dispatch.o cfe_devfuncs.o \ + cfe_console.o cfe_mem.o cfe_timer.o \ + cfe_background.o build_date.o \ + cfe_xreq.o cfe_filesys.o +## cfe_error.o cfe_rawfs.o cfe_fatfs.o cfe_httpfs.o cfe_ldr_srec.o cfe_autoboot.o cfe_boot.o cfe_ldr_elf.o cfe_ldr_raw.o cfe_loader.o +## cfe_main.o nvram_subr.o url.o cfe_savedata.o env_subr.o cfe_zlibfs.o + +#UIOBJS = ui_command.o ui_cmddisp.o +# Foxconn add start by Cliff Wang, 03/23/2010 +UIOBJS = ui_command.o ui_cmddisp.o ui_tftpd.o ui_netcmds.o + +## ui_pcicmds.o \ui_tcpcmds.o ui_memcmds.o ui_loadcmds.o ui_flash.o ui_envcmds.o ui_devcmds.o ui_netcmds.o +## ui_examcmds.o ui_misccmds.o \ +## ui_test_disk.o ui_test_ether.o ui_test_flash.o ui_test_uart.o + +# +# Add more object files if we're supporting PCI +# + +ifeq ($(strip ${CFG_PCI}),1) +PCIOBJS = pciconf.o ldtinit.o pci_subr.o +PCIOBJS += pci_devs.o +DEVOBJS += dev_sp1011.o dev_ht7520.o +DEVOBJS += dev_ide_pci.o dev_ns16550_pci.o +DEVOBJS += dev_tulip.o dev_dp83815.o +CFLAGS += -DCFG_PCI=1 +ifeq ($(strip ${CFG_LDT_REV_017}),1) +CFLAGS += -DCFG_LDT_REV_017=1 +endif +ifeq ($(strip ${CFG_DOWNLOAD}),1) +DEVOBJS += dev_bcm1250.o download.data +CFLAGS += -DCFG_DOWNLOAD=1 +endif +endif + +# +# If doing bi-endian, add the compiler switch to change +# the way the vectors are generated. These switches are +# only added to the big-endian portion of the ROM, +# which is located at the real boot vector. +# + +ifeq ($(strip ${CFG_BIENDIAN}),1) + ifeq ($(strip ${CFG_LITTLE}),0) + CFLAGS += -DCFG_BIENDIAN=1 + endif +endif + +# +# Include the makefiles for the architecture-common, cpu-specific, +# and board-specific directories. Each of these will supply +# some files to "ALLOBJS". The BOARD directory is optional +# as some ports are so simple they don't need boad-specific stuff. +# + +include ${ARCH_SRC}/Makefile +include ${CPU_SRC}/Makefile + +ifneq ("$(strip ${BOARD})","") +include ${BOARD_SRC}/Makefile +endif + +# +# Add the common object files here. +# + +ALLOBJS += $(LIBOBJS) $(DEVOBJS) $(CFEOBJS) $(VENOBJS) $(UIOBJS) $(NETOBJS) $(LZMAOBJS) +#$(PCIOBJS) + +# +# VAPI continues to be a special case. +# + +ifeq ($(strip ${CFG_VAPI}),1) +include ${TOP}/verif/Makefile +endif + +# +# USB support +# + +ifeq ($(strip ${CFG_USB}),1) +SRCDIRS += ${TOP}/usb +CFE_INC += ${TOP}/usb +include ${TOP}/usb/Makefile +endif + +# +# If we're doing the VGA console thing, pull in the x86 emulator +# and the pcconsole subsystem +# + +ifeq ($(strip ${CFG_VGACONSOLE}),1) +include ${TOP}/x86emu/Makefile +include ${TOP}/pccons/Makefile +endif + +# +# If we're including ZLIB, then add its makefile. +# + +ifeq ($(strip ${CFG_ZLIB}),1) +include ${TOP}/zlib/Makefile +CFLAGS += -DCFG_ZLIB=1 -DMY_ZCALLOC -DNO_MEMCPY +endif + +# +# Vendor extensions come next - they live in their own directory. +# + +include ${TOP}/vendor/Makefile + +.PHONY : all +.PHONY : ALL +.PHONY : build_date.c + +# +# Build the local tools that we use to construct other source files +# + +mkpcidb : ${TOP}/hosttools/mkpcidb.c + gcc -o mkpcidb ${TOP}/hosttools/mkpcidb.c + +memconfig : ${TOP}/hosttools/memconfig.c + gcc -o memconfig -D_MCSTANDALONE_ -D_MCSTANDALONE_NOISY_ -I${TOP}/arch/mips/cpu/sb1250/include ${TOP}/hosttools/memconfig.c ${TOP}/arch/${ARCH}/cpu/${CPU}/src/sb1250_draminit.c + +pcidevs_data2.h : mkpcidb ${TOP}/pci/pcidevs_data.h + ./mkpcidb > pcidevs_data2.h + +mkflashimage : ${TOP}/hosttools/mkflashimage.c + gcc -o mkflashimage -I${TOP}/include ${TOP}/hosttools/mkflashimage.c + +pci_subr.o : ${TOP}/pci/pci_subr.c pcidevs_data2.h + +build_date.c : + echo "const char *builddate = \"`date`\";" > build_date.c + echo "const char *builduser = \"`whoami`@`hostname`\";" >> build_date.c + +# +# Make a define for the board name +# + +CFLAGS += -D_$(patsubst "%",%,${CFG_BOARDNAME})_ + +LIBCFE = libcfe.a + +%.o : %.c + $(GCC) $(CFLAGS) -o $@ $< + +%.o : %.S + $(GCC) $(CFLAGS) -o $@ $< + +%.o : %.html + echo unsigned char $*_html[] = { > $*.c + hexdump -v -e '" " 12/1 "0x%2.2x, " "\n"' $< | sed -e "s/ 0x .*$\//" -e "\$$s/, *$$//" >> $*.c + echo ' };' >> $*.c + echo 'int $*_html_size = sizeof($*_html);' >> $*.c + echo >> $*.c + $(GCC) $(CFLAGS) -o $@ $*.c + rm -f $*.c + +%.o : %.css + echo unsigned char $*_css[] = { > $*.c + hexdump -v -e '" " 12/1 "0x%2.2x, " "\n"' $< | sed -e "s/ 0x .*$\//" -e "\$$s/, *$$//" >> $*.c + echo ' };' >> $*.c + echo 'int $*_css_size = sizeof($*_css);' >> $*.c + echo >> $*.c + $(GCC) $(CFLAGS) -o $@ $*.c + rm -f $*.c + +%.o : %.gif + echo unsigned char $*_gif[] = { > $*.c + hexdump -v -e '" " 12/1 "0x%2.2x, " "\n"' $< | sed -e "s/ 0x .*$\//" -e "\$$s/, *$$//" >> $*.c + echo ' };' >> $*.c + echo 'int $*_gif_size = sizeof($*_gif);' >> $*.c + echo >> $*.c + $(GCC) $(CFLAGS) -o $@ $*.c + rm -f $*.c + +# +# This rule constructs "libcfe.a" which contains most of the object +# files. +# + +$(LIBCFE) : $(ALLOBJS) + rm -f $(LIBCFE) + $(AR) cr $(LIBCFE) $(ALLOBJS) + $(RANLIB) $(LIBCFE) + + + + + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_ram/src/robosw_reg.c b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/robosw_reg.c new file mode 100755 index 0000000..15dad53 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_ram/src/robosw_reg.c @@ -0,0 +1,615 @@ +/* +<:copyright-broadcom + + Copyright (c) 2007 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ + +#include "bcm_map.h" +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "mii.h" +#include "bcmmii.h" +#include "sbmips.h" +#include "cfe_iocb.h" +#include "cfe_timer.h" +#include "robosw_reg.h" +#include "dev_bcm63xx_eth.h" +#include "bcmSpiRes.h" + +static uint32 mii_read(uint32 uPhyAddr, uint32 uRegAddr); +static void mii_write(uint32 uPhyAddr, uint32 uRegAddr, uint32 data); + +static int ext_switch_init(void); +static int ethsw_spi_ss_id(void); +static void ethsw_spi_select(int page); +static void ethsw_spi_rreg(int page, int reg, uint8 *data, int len); +static void ethsw_spi_wreg(int page, int reg, uint8 *data, int len); + +void ethsw_rreg_ext(int access_type, int page, int reg, uint8 *data, int len); +void ethsw_wreg_ext(int access_type, int page, int reg, uint8 *data, int len); + + +static ETHERNET_MAC_INFO EnetInfo[BP_MAX_ENET_MACS]; +static uint16 PortLinkState[BP_MAX_SWITCH_PORTS]; + +#define MDIO_BUS 0 +#define SPI_BUS 1 +#define TX_BDS 3 +#define RX_BDS 16 +#define CACHE_ALIGN 16 +#define BUF_LENGTH 160 +extern void _cfe_flushcache(int, uint8_t *, uint8_t *); +#define INVAL_RANGE(s,l) _cfe_flushcache(CFE_CACHE_INVAL_RANGE,((uint8_t *) (s)),((uint8_t *) (s))+(l)) + +/* read a value from the MII */ +static uint32 mii_read(uint32 uPhyAddr, uint32 uRegAddr) +{ + SWITCH->MdioCtrl = 0x0; + SWITCH->MdioCtrl = MdioCtrl_Read | (IsExtPhyId(uPhyAddr) ? MdioCtrl_Ext : 0) | + ((uPhyAddr << MdioCtrl_ID_Shift) & MdioCtrl_ID_Mask) | + (uRegAddr << MdioCtrl_Addr_Shift); + cfe_usleep(100); + return SWITCH->MdioData; +} + +/* write a value to the MII */ +static void mii_write(uint32 uPhyAddr, uint32 uRegAddr, uint32 data) +{ + SWITCH->MdioCtrl = 0x0; + SWITCH->MdioCtrl = MdioCtrl_Write | (IsExtPhyId(uPhyAddr) ? MdioCtrl_Ext : 0) | + ((uPhyAddr << MdioCtrl_ID_Shift) & MdioCtrl_ID_Mask) | + (uRegAddr << MdioCtrl_Addr_Shift) | data; + cfe_usleep(100); +} + +static int clkHz = 781000; +#if !defined(_BCM96328_) +static int clk781k = 2; +#endif +static int ethsw_spi_ss_id() +{ + int slave_select; + + switch(EnetInfo[1].usConfigType) { + case BP_ENET_CONFIG_SPI_SSB_0: + slave_select = 0; + break; + case BP_ENET_CONFIG_SPI_SSB_1: + slave_select = 1; + break; + case BP_ENET_CONFIG_SPI_SSB_2: + slave_select = 2; + break; + case BP_ENET_CONFIG_SPI_SSB_3: + slave_select = 3; + break; + default: + slave_select = 1; + xprintf("Invalid SPI_SS in usConfigType, Assuming 1\n"); + break; + } + return slave_select; +} + +static void ethsw_spi_select(int page) +{ + unsigned char buf[3]; + int spi_ss, cid = 0; + + spi_ss = ethsw_spi_ss_id(); + /* Select new chip */ + buf[0] = BCM5325_SPI_CMD_NORMAL | BCM5325_SPI_CMD_WRITE | + ((cid & BCM5325_SPI_CHIPID_MASK) << BCM5325_SPI_CHIPID_SHIFT); + + /* Select new page */ + buf[1] = PAGE_SELECT; + buf[2] = (char)page; +#if defined(_BCM96328_) + BcmSpi_Write(buf, sizeof(buf), HS_SPI_BUS_NUM, spi_ss, clkHz); +#else + BcmSpi_Write(buf, sizeof(buf), LEG_SPI_BUS_NUM, spi_ss, clkHz); +#endif + +} + +static void ethsw_spi_rreg(int page, int reg, uint8 *data, int len) +{ + unsigned char buf[64]; + int rc; + int i; + int max_check_spi_sts; + int prependCnt = BCM5325_SPI_PREPENDCNT, spi_ss, cid = 0; + + spi_ss = ethsw_spi_ss_id(); + + ethsw_spi_select(page); + + /* write command byte and register address */ + buf[0] = BCM5325_SPI_CMD_NORMAL | BCM5325_SPI_CMD_READ | + ((cid & BCM5325_SPI_CHIPID_MASK) << BCM5325_SPI_CHIPID_SHIFT); + buf[1] = (unsigned char)reg; +#if defined(_BCM96328_) + rc = BcmSpi_Read(buf, prependCnt, 1, HS_SPI_BUS_NUM, spi_ss, clkHz); +#else + rc = BcmSpi_Read(buf, prependCnt, 1, LEG_SPI_BUS_NUM, spi_ss, clkHz); +#endif + + if (rc == SPI_STATUS_OK) { + max_check_spi_sts = 0; + do { + /* write command byte and read spi_sts address */ + buf[0] = BCM5325_SPI_CMD_NORMAL | BCM5325_SPI_CMD_READ | + ((cid & BCM5325_SPI_CHIPID_MASK) << BCM5325_SPI_CHIPID_SHIFT); + buf[1] = (unsigned char)BCM5325_SPI_STS; +#if defined(_BCM96328_) + rc = BcmSpi_Read(buf, prependCnt, 1, HS_SPI_BUS_NUM, spi_ss, clkHz); +#else + rc = BcmSpi_Read(buf, prependCnt, 1, LEG_SPI_BUS_NUM, spi_ss, clkHz); +#endif + if (rc == SPI_STATUS_OK) { + /* check the bit 0 RACK bit is set */ + if (buf[0] & BCM5325_SPI_CMD_RACK) { + break; + } + cfe_usleep(10000); + } else { + break; + } + } while (max_check_spi_sts++ < 10); + + if (rc == SPI_STATUS_OK) { + for (i = 0; i < len; i++) { + buf[0] = BCM5325_SPI_CMD_NORMAL | BCM5325_SPI_CMD_READ | + ((cid & BCM5325_SPI_CHIPID_MASK) << BCM5325_SPI_CHIPID_SHIFT); + buf[1] = (unsigned char)0xf0; +#if defined(_BCM96328_) + rc = BcmSpi_Read(buf, prependCnt, 1, HS_SPI_BUS_NUM, spi_ss, clkHz); +#else + rc = BcmSpi_Read(buf, prependCnt, 1, LEG_SPI_BUS_NUM, spi_ss, clkHz); +#endif + if (rc == SPI_STATUS_OK) { + *(data + (len - i - 1)) = buf[0]; + } + } + } + } +} + +static void ethsw_spi_wreg(int page, int reg, uint8 *data, int len) +{ + unsigned char buf[64]; + int i; + int spi_ss, cid = 0; + + ethsw_spi_select(page); + + spi_ss = ethsw_spi_ss_id(); + buf[0] = BCM5325_SPI_CMD_NORMAL | BCM5325_SPI_CMD_WRITE | + ((cid & BCM5325_SPI_CHIPID_MASK) << BCM5325_SPI_CHIPID_SHIFT); + + buf[1] = (char)reg; + for (i = 0; i < len; i++) { + /* Write the data out in LE format to the switch */ + buf[BCM5325_SPI_PREPENDCNT+i] = *(data + (len - i - 1)); + } + BcmSpi_Write(buf, len+BCM5325_SPI_PREPENDCNT, LEG_SPI_BUS_NUM, spi_ss, clkHz); +} + +/* External switch register access through MDC/MDIO */ +static void ethsw_mdio_rreg(int page, int reg, uint8 *data, int len) +{ + uint32 cmd, res, ret; + int max_retry = 0; + + cmd = (page << REG_PPM_REG16_SWITCH_PAGE_NUMBER_SHIFT) | REG_PPM_REG16_MDIO_ENABLE; + mii_write(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG16, cmd); + + cmd = (reg << REG_PPM_REG17_REG_NUMBER_SHIFT) | REG_PPM_REG17_OP_READ; + mii_write(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG17, cmd); + + do { + res = mii_read(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG17); + cfe_usleep(10); + } while (((res & (REG_PPM_REG17_OP_WRITE|REG_PPM_REG17_OP_READ)) != REG_PPM_REG17_OP_DONE) && + (max_retry++ < 5)); + + ret = 0; + ret |= mii_read(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG24) << 0; + ret |= mii_read(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG25) << 16; + switch (len) { + case 1: + *data = (uint8)ret; + break; + case 2: + *(uint16 *)data = (uint16)ret; + break; + case 4: + *(uint32 *)data = ret; + break; + } +} + +static void ethsw_mdio_wreg(int page, int reg, uint8 *data, int len) +{ + uint32 cmd, res; + uint32 val = 0; + int max_retry = 0; + + switch (len) { + case 1: + val = *data; + break; + case 2: + val = *(uint16 *)data; + break; + case 4: + val = *(uint32 *)data; + break; + } + cmd = (page << REG_PPM_REG16_SWITCH_PAGE_NUMBER_SHIFT) | REG_PPM_REG16_MDIO_ENABLE; + mii_write(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG16, cmd); + + cmd = val>>0 & 0xffff; + mii_write(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG24, cmd); + cmd = val>>16 & 0xffff; + mii_write(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG25, cmd); + cmd = 0; + mii_write(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG26, cmd); + cmd = 0; + mii_write(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG27, cmd); + + cmd = (reg << REG_PPM_REG17_REG_NUMBER_SHIFT) | REG_PPM_REG17_OP_WRITE; + mii_write(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG17, cmd); + + do { + res = mii_read(PSEUDO_PHY_ADDR, REG_PSEUDO_PHY_MII_REG17); + cfe_usleep(10); + } while (((res & (REG_PPM_REG17_OP_WRITE|REG_PPM_REG17_OP_READ)) != REG_PPM_REG17_OP_DONE) && + (max_retry++ < 5)); +} + +void ethsw_rreg_ext(int access_type, int page, int reg, uint8 *data, int len) +{ + if (access_type == MDIO_BUS) { + ethsw_mdio_rreg(page, reg, data, len); + + } else { + ethsw_spi_rreg(page, reg, data, len); + } +} + +void ethsw_wreg_ext(int access_type, int page, int reg, uint8 *data, int len) +{ + if (access_type == MDIO_BUS) { + ethsw_mdio_wreg(page, reg, data, len); + } else { + ethsw_spi_wreg(page, reg, data, len); + } +} + +int ext_switch_init(void) +{ + uint8 data8; + uint32 data32, access_type; +#if !defined(_BCM96328_) + uint32 clkSave; +#endif + + switch (EnetInfo[1].usConfigType) { + case BP_ENET_CONFIG_SPI_SSB_0: + case BP_ENET_CONFIG_SPI_SSB_1: + case BP_ENET_CONFIG_SPI_SSB_2: + case BP_ENET_CONFIG_SPI_SSB_3: + access_type = SPI_BUS; +#if !defined(_BCM96328_) + clkSave = SPI->spiClkCfg & SPI_CLK_MASK; + xprintf("spiClkCfg = %x; clkSave = %d \n", SPI->spiClkCfg, clkSave); + SPI->spiClkCfg = (SPI->spiClkCfg & ~SPI_CLK_MASK) | clk781k; +#endif + break; + + case BP_ENET_CONFIG_MDIO_PSEUDO_PHY: + access_type = MDIO_BUS; + break; + + default: + xprintf("Unknown PHY configuration type\n"); + return -1; + } + + ethsw_rreg_ext(access_type, PAGE_MANAGEMENT, REG_DEVICE_ID, (uint8 *)&data32, sizeof(data32)); + xprintf("External switch id = %x \n", data32); + + if (data32 == 0x53115) + { + /* setup Switch MII1 port state override */ + data8 = (REG_CONTROL_MPSO_MII_SW_OVERRIDE | + REG_CONTROL_MPSO_SPEED1000 | + REG_CONTROL_MPSO_FDX | + REG_CONTROL_MPSO_LINKPASS); + ethsw_wreg_ext(access_type, PAGE_CONTROL, + REG_CONTROL_MII1_PORT_STATE_OVERRIDE, &data8, sizeof(data8)); + /* management mode, enable forwarding */ + data8 = REG_SWITCH_MODE_FRAME_MANAGE_MODE | REG_SWITCH_MODE_SW_FWDG_EN; + ethsw_wreg_ext(access_type, PAGE_CONTROL, + REG_SWITCH_MODE, &data8, sizeof(data8)); + /* Enable IMP Port */ + data8 = ENABLE_MII_PORT; + ethsw_wreg_ext(access_type, PAGE_MANAGEMENT, + REG_GLOBAL_CONFIG, &data8, sizeof(data8)); + /* Disable BRCM Tag for IMP */ + data8 = ~REG_BRCM_HDR_ENABLE; + ethsw_wreg_ext(access_type, PAGE_MANAGEMENT, + REG_BRCM_HDR_CTRL, &data8, sizeof(data8)); + /* enable rx bcast, ucast and mcast of imp port */ + data8 = (REG_MII_PORT_CONTROL_RX_UCST_EN | + REG_MII_PORT_CONTROL_RX_MCST_EN | + REG_MII_PORT_CONTROL_RX_BCST_EN); + ethsw_wreg_ext(access_type, PAGE_CONTROL, REG_MII_PORT_CONTROL, &data8, sizeof(data8)); + } + +#if !defined(_BCM96328_) + if (access_type == SPI_BUS) + SPI->spiClkCfg = (SPI->spiClkCfg & ~SPI_CLK_MASK) | clkSave; +#endif + return 0; +} + + +void robosw_init(void) +{ + int port; + + BpGetEthernetMacInfo(EnetInfo, BP_MAX_ENET_MACS); + + // Power up and reset EPHYs + GPIO->RoboswEphyCtrl = 0; + cfe_usleep(1000); + + // Take EPHYs out of reset + GPIO->RoboswEphyCtrl = + EPHY_RST_4 | + EPHY_RST_3 | + EPHY_RST_2 | + EPHY_RST_1; + cfe_usleep(1000); + +#if defined(_BCM96328_) || defined(_BCM96362_) + GPIO->RoboswSwitchCtrl |= (RSW_MII_DUMB_FWDG_EN | RSW_HW_FWDG_EN); +#endif +#if defined(_BCM96368_) || defined(_BCM96816_) + GPIO->RoboswEphyCtrl |= (RSW_MII_DUMB_FWDG_EN | RSW_HW_FWDG_EN); +#endif + + // Enable Switch clock + PERF->blkEnables |= ROBOSW_CLK_EN; +#if defined(_BCM96368_) + PERF->blkEnables |= SWPKT_SAR_CLK_EN | SWPKT_USB_CLK_EN; +#endif +#if defined(_BCM96816_) + PERF->blkEnables |= SWPKT_GPON_CLK_EN | SWPKT_USB_CLK_EN; +#endif + + cfe_usleep(1000); + + PERF->softResetB &= ~SOFT_RST_SWITCH; + cfe_usleep(1000); + PERF->softResetB |= SOFT_RST_SWITCH; + cfe_usleep(1000); + + /* Disable Rx and Tx on all Ethernet Ports */ + for (port = 0; port < EPHY_PORTS; port++) { + SWITCH->PortCtrl[port] = 0x03; + } + + if (EnetInfo[1].ucPhyType == BP_ENET_EXTERNAL_SWITCH) { + ext_switch_init(); + } + +} + +void robosw_configure_ports() +{ + uint16 data; + int i; + + for (i = 0; i < 6; i++) { + if ((EnetInfo[0].sw.port_map & (1 << i)) != 0) { + if (EnetInfo[0].sw.phy_id[i] == 0xff) { +#if defined(_BCM96368_) + if (i == 4) + GPIO->GPIOBaseMode |= (EN_GMII1); + if (i == 5) + GPIO->GPIOBaseMode |= (EN_GMII2); +#endif + continue; + } + if (IsWanPort(EnetInfo[0].sw.phy_id[i])) { + *(SWITCH_PBVLAN + i) = PBMAP_MIPS; + SWITCH->DisableLearn |= (1 << i); + } + // Reset + mii_write(EnetInfo[0].sw.phy_id[i], MII_BMCR, BMCR_RESET); + PortLinkState[i] = 0; + if (!IsExtPhyId(EnetInfo[0].sw.phy_id[i])) { + // Configure PHY link/act LED +#if defined(_BCM96368_) + // Enable status change notification */ + mii_write(EnetInfo[0].sw.phy_id[i], MII_INTERRUPT, MII_INTR_ENABLE); + // Configure LEDs + data = mii_read(EnetInfo[0].sw.phy_id[i], MII_RESERVED_1B); + mii_write(EnetInfo[0].sw.phy_id[i], MII_RESERVED_1B, data | MII_RESERVED_1B_ACT_LED); +#elif defined(_BCM96816_) + // Configure LEDs + mii_write(EnetInfo[0].sw.phy_id[i], 0x1c, 0xa410); +#elif defined(_BCM96328_) || defined(_BCM96362_) + // Configure LEDs + // Enable Shadow register 2 + data = mii_read(EnetInfo[0].sw.phy_id[i], MII_BRCM_TEST); + mii_write(EnetInfo[0].sw.phy_id[i], MII_BRCM_TEST, (data | MII_BRCM_TEST_SHADOW2_ENABLE)); + // Set LED0 to speed. Set LED1 to blinky link + mii_write(EnetInfo[0].sw.phy_id[i], 0x15, 0x71); + // Disable Shadow register 2 + mii_write(EnetInfo[0].sw.phy_id[i], MII_BRCM_TEST, (data & ~MII_BRCM_TEST_SHADOW2_ENABLE)); +#endif + } else { +#if defined(_BCM96368_) + if (i == 4) + GPIO->GPIOBaseMode |= (EN_GMII1); + if (i == 5) + GPIO->GPIOBaseMode |= (EN_GMII2); +#endif +#if defined(_BCM96816_) + if (i == 2) + GPIO->GPIOBaseMode |= (EN_GMII1); + if (i == 3) + GPIO->GPIOBaseMode |= (EN_GMII2); +#endif +#if defined(_BCM96362_) + if (i == 4) + GPIO->RoboswSwitchCtrl |= (RSW_MII_SEL_2P5V << RSW_MII_SEL_SHIFT); + if (i == 5) + GPIO->RoboswSwitchCtrl |= (RSW_MII_2_IFC_EN | (RSW_MII_SEL_2P5V << RSW_MII_2_SEL_SHIFT)); +#endif +#if defined(_BCM96328_) + if (i == 4) + MISC->miscPadCtrlHigh |= (MISC_MII_SEL_2P5V << MISC_MII_SEL_SHIFT); +#endif + // Reset + mii_write(EnetInfo[0].sw.phy_id[i], MII_BMCR, BMCR_RESET); + // Enable auto-negotiation + mii_write(EnetInfo[0].sw.phy_id[i], MII_ANAR, ANAR_TXFD | ANAR_TXHD | ANAR_10FD | ANAR_10HD | PSB_802_3); + + // Configure LED for link/activity + data = MII_1C_SHADOW_LED_CONTROL << MII_1C_SHADOW_REG_SEL_S; + mii_write(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C, data); + data = mii_read(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C); + data |= ACT_LINK_LED_ENABLE; + data |= MII_1C_WRITE_ENABLE; + mii_write(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C, data); + + data = mii_read(EnetInfo[0].sw.phy_id[i], MII_PHYIDR2); + if ((data & BCM_PHYID_M) == (BCM54610_PHYID2 & BCM_PHYID_M)) { + // Configure RGMII timing for 54610 GPHY + data = MII_1C_SHADOW_CLK_ALIGN_CTRL << MII_1C_SHADOW_REG_SEL_S; + mii_write(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C, data); + data = mii_read(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C); + data &= (~GTXCLK_DELAY_BYPASS_DISABLE); + data |= MII_1C_WRITE_ENABLE; + mii_write(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C, data); + + // Configure LOM LED Mode + data = MII_1C_EXTERNAL_CONTROL_1 << MII_1C_SHADOW_REG_SEL_S; + mii_write(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C, data); + data = mii_read(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C); + data |= LOM_LED_MODE; + data |= MII_1C_WRITE_ENABLE; + mii_write(EnetInfo[0].sw.phy_id[i], MII_REGISTER_1C, data); + } + } + // Restart auto-negotiation + data = mii_read(EnetInfo[0].sw.phy_id[i], MII_BMCR); + mii_write(EnetInfo[0].sw.phy_id[i], MII_BMCR, data | BMCR_RESTARTAN); + } + } + +#if defined(_BCM96816_) + // Disable SERDES, MoCA, USB and GPON port + SWITCH->PortOverride[SERDES_PORT_ID] = PortOverride_Enable; + SWITCH->PortOverride[MOCA_PORT_ID] = PortOverride_Enable; + SWITCH->PortOverride[USB_PORT_ID] = PortOverride_Enable; + SWITCH->PortOverride[GPON_PORT_ID] = PortOverride_Enable; +#endif + +#if defined(_BCM96328_) || defined(_BCM96362_) + // Ports 6 and 7 are not used on 6328 and 6362 + SWITCH->PortOverride[PORT_6_PORT_ID] = PortOverride_Enable; + SWITCH->PortOverride[PORT_7_PORT_ID] = PortOverride_Enable; +#endif + +#if defined(_BCM96368_) + // Disable SAR and USB port + SWITCH->PortOverride[USB_PORT_ID] = PortOverride_Enable; + SWITCH->PortOverride[SAR_PORT_ID] = PortOverride_Enable; +#endif + + // Enable the GMII clocks. + SWITCH->ImpRgmiiCtrlP4 |= ImpRgmiiCtrl_GMII_En; + /* RGMII Delay Programming. Enable ID mode */ + SWITCH->ImpRgmiiCtrlP4 |= ImpRgmiiCtrl_Timing_Sel; + +#if !defined(_BCM96328_) + SWITCH->ImpRgmiiCtrlP5 |= ImpRgmiiCtrl_GMII_En; + SWITCH->ImpRgmiiCtrlP5 |= ImpRgmiiCtrl_Timing_Sel; +#endif + + // Reset MIB counters + SWITCH->GlbMgmt = GlbMgmt_ResetMib; + cfe_usleep(100); + SWITCH->GlbMgmt = 0; + + SWITCH->ImpOverride |= ImpOverride_Force | ImpOverride_Linkup; + +} + +void robosw_check_ports() +{ + uint16 data; + uint8 PortOverride; + int i; + + for (i = 0; i < EPHY_PORTS; i++) { + if ((EnetInfo[0].sw.port_map & (1 << i)) != 0) { + if (EnetInfo[0].sw.phy_id[i] == 0xff) { + PortOverride = PortOverride_Enable | PortOverride_1000Mbs | + PortOverride_Fdx | PortOverride_Linkup; + if ((SWITCH->PortOverride[i] & PortOverride) != PortOverride) { + SWITCH->PortOverride[i] = PortOverride; + SWITCH->PortCtrl[i] = 0; + PortLinkState[i] = 1; + } + continue; + } + PortOverride = PortOverride_Enable; + data = mii_read(EnetInfo[0].sw.phy_id[i], MII_ASR); + if (PortLinkState[i] != MII_ASR_LINK(data)) { + + if (MII_ASR_LINK(data)) + PortOverride |= PortOverride_Linkup; + + if (MII_ASR_DONE(data)) { + if (MII_ASR_FDX(data)) + PortOverride |= PortOverride_Fdx; + if (MII_ASR_1000(data)) + PortOverride |= PortOverride_1000Mbs; + else if (MII_ASR_100(data)) + PortOverride |= PortOverride_100Mbs; + else + PortOverride |= PortOverride_10Mbs; + } + + SWITCH->PortOverride[i] = PortOverride; + + if(PortOverride & PortOverride_Linkup) { + /* Enable Rx and Tx */ + SWITCH->PortCtrl[i] = 0; + } + + PortLinkState[i] = MII_ASR_LINK(data); + } + } + } +} + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_rom/src/Makefile b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/Makefile new file mode 100755 index 0000000..808ddc2 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/Makefile @@ -0,0 +1,23 @@ +ifeq ($(strip ${CFG_BOARDNAME}),"BCM96328") +BSPOBJS += \ + bcm63xx_impl1_rom_boot.o +endif +ifeq ($(strip ${CFG_BOARDNAME}),"BCM96362") +BSPOBJS += \ + bcm63xx_impl1_rom_boot.o +endif +ifeq ($(strip ${CFG_BOARDNAME}),"BCM96368") +BSPOBJS += \ + bcm6368_rom_boot.o \ + bcm6368_sdramDqs.o +endif +ifeq ($(strip ${CFG_BOARDNAME}),"BCM96816") +BSPOBJS += \ + bcm63xx_impl1_rom_boot.o +endif +ifeq ($(strip ${INC_NAND_FLASH_DRIVER}),1) +BSPOBJS += \ + nandflash.o +endif +BSPOBJS += \ + bcm63xx_main.o diff --git a/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm6368_rom_boot.S b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm6368_rom_boot.S new file mode 100755 index 0000000..f1cba19 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm6368_rom_boot.S @@ -0,0 +1,548 @@ +#include "sbmips.h" +#include "bsp_config.h" + +#include "6368_cpu.h" +#include "6368_common.h" +#include "bcm_hwdefs.h" +#include "boardparms.h" +#include "mipsmacros.h" + +#define SETLEDS1(a,b,c,d) \ + li a0,(((a)<<24)|((b)<<16)|((c)<<8)|(d)) ; \ + bal board_setleds + +/* ********************************************************************* + * BOARD_EARLYINIT() + * + * Initialize board registers. This is the earliest + * time the BSP gets control. This routine cannot assume that + * memory is operational, and therefore all code in this routine + * must run from registers only. The $ra register must not + * be modified, as it contains the return address. + * + * This routine will be called from uncached space, before + * the caches are initialized. If you want to make + * subroutine calls from here, you must use the CALLKSEG1 macro. + * + * Among other things, this is where the GPIO registers get + * programmed to make on-board LEDs function, or other startup + * that has to be done before anything will work. + * + * Input parameters: + * a0 - Flash base address (address of MIPS reset) + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(board_earlyinit) + + .set noreorder + + mfc0 t1, C0_BCM_CONFIG, 3 + li t2, CP0_CMT_TPID + and t1, t2 + bnez t1, 2f # if we are running on thread 1, skip init + nop + +#if 0 + /* wait for a while to allow catch by jtag debugger */ + li t8, -(200000000*3) /* we will count up to 0 to delay a couple of seconds */ + /* and give the emulator a chance to catch us */ + mtc0 t8, C0_COUNT +catchloop: + bltz t8, catchloop + mfc0 t8, C0_COUNT +#endif + + /**--------------------------------------------------------------**/ + /** platform specific code **/ + /**--------------------------------------------------------------**/ + /**----- Enable I Cache -----------------------------------------**/ + mfc0 t1, C0_BCM_CONFIG + or t1, (CP0_BCM_CFG_ICSHEN | CP0_BCM_CFG_DCSHEN) + mtc0 t1, C0_BCM_CONFIG # Enable I Cache + + // In the begining MIPS core registers are mapped to 0xbfax_xxxx + li t1, 0x1FA0000C # Set up CBR to 1FAx_xxxx + mtc0 t1, C0_BCM_CONFIG, 6 + + li t1, MIPS_BASE_BOOT + lw t2, MIPS_LMB_CR(t1) + or t2, 0xC0000000 # enable ffxx_xxxx space + sw t2, MIPS_LMB_CR(t1) + li t2, 0xFFF80001 # SBR FFF8_xxxx and enable + sw t2, MIPS_SBR(t1) + + // Now map MIPS core registers to 0xFF4x_xxxx space + li t1, 0xFF40000C # CBR FF4x_xxxx (and reserved bits 0xc). + mtc0 t1, C0_BCM_CONFIG, 6 + + /**----- Initialize EBI -----------------------------------------**/ + li t1, MPI_BASE + li t2, EBI_SIZE_32M + or t2, a0 + sw t2, CS0BASE(t1) # CS[0] Base + li t2, THREEWT|EBI_WORD_WIDE|EBI_ENABLE + sw t2, CS0CNTL(t1) # CS[0] Control + + /**----- Initialize Serial --------------------------------------**/ + li t3, ((FPERIPH / 115200) / 16) + /* + # Baudword = (FPeriph)/Baud/32-1. We have to perform rounding + # and subtraction. Above we divided by 16 (instead of 32). If + # bit0 is set, we round up. However, we then subtract 1, so final + # result should be t3/2. If bit0 is 0, then we truncate and subtract + # 1, t3=t3/2-1. + */ + andi t0, t3, 0x1 + bne t0,zero,1f # do shift only (in delay slot) + # and jump to apply + srl t3,1 # do divide by 2 + addiu t3, -1 # subtract 1 +1: + + # t3 contains the UART BAUDWORD + li t0, UART_BASE + sw t3, UART0BAUD(t0) # Store BaudRate + li t1, BITS8SYM|ONESTOP + sb t1, UART0CONFIG(t0) # 8 Bits/1 Stop + li t1, TXEN|RXEN|BRGEN + sb t1, UART0CONTROL(t0) # Enable, No Parity + move t1, zero + sh t1, UART0INTMASK(t0) + + .set reorder +2: + j ra +END(board_earlyinit) + +/* ********************************************************************* + * BOARD_DRAMINFO + * + * Return the address of the DRAM information table + * + * Input parameters: + * nothing + * + * Return value: + * v0 - DRAM info table, return 0 to use default table + ********************************************************************* */ +LEAF(board_draminfo) + j ra +END(board_draminfo) + +/* ********************************************************************* + * BOARD_DRAMINIT + * + * This routine should activate memory. + * + * Input parameters: + * None + * + * Return value: + * None + * + * Registers used: + * can use all registers. + ********************************************************************* */ +LEAF(board_draminit) + .set noreorder + + li t0, MEMC_BASE + li t1, DDR_BASE + + li t4, (7 << 28) | (7 << 24) | (1 << 20) | (7 << 16) # UBUS_CNTR_CYCLES = 7, LLMB_CNTR_CYCLES = 7, PH_CNTR_EN = 1, PH_CNTR_CYCLES = 7 + sw t4, DDR_MIPS_PHASE_CNTL(t1) + + # Calculate a value for a 90 degree phase shift. + + lw t2, DDR_MIPSDDR_PLL_MDIV(t1) + srl t2, 8 # Shift and mask off DDR_MDIV + and t2, 0xff + sll t2, 2 # PI_steps = (90deg * 16 * MBUS(t2) + 2)/360 ~= MBUS * 4 + or t2, (1 << 14) # set the count direction + + lw t3, DDR_DDR3_4_PHASE_CNTL(t1) # Get current DDR3/4 value. + ori t3, 0x7fff # Clear low 15 bits (DDR3 value). + xori t3, 0x7fff + or t3, t2 # Set new DDR3 value, preserving existing DDR4 value. + sw t3, DDR_DDR3_4_PHASE_CNTL(t1) + + li t4, (1 << 28) | (7 << 24) | (1 << 23) | (1 << 20) | (7 << 16) # UBUS_CNTR_CYCLES = 1, LLMB_CNTR_CYCLES = 7, UBUS_CNTR_EN = 1, PH_CNTR_EN = 1, PH_CNTR_CYCLES = 7 + sw t4, DDR_MIPS_PHASE_CNTL(t1) + + li t4, 0x103e + sw t4, DDR_UBUS_PI_DSK1(t1) + li t4, 0x40000000 + sw t4, DDR_UBUS_PI_DSK0(t1) + + ## Set PI mask, and frequnecy of updates + # bit[5:0] 1 to 31, controls how often feedback is send back to PI + # bit[7] update register in sampling logic to take the new value in bit[5:0] + # bit[14:8] masking bits for the sampling result + + li t2, 0x00000010 # 0x8 for 8 DDR cycles, 0x10 for 16 DDR cycles, 0x4 for 4 DDR cycles, can take values from 1 to 31 + sw t2, DDR_UBUS_PI_DSK0(t1) # set PI update to 16 ddr cycles + li t2, 0x00000090 # update value + sw t2, DDR_UBUS_PI_DSK0(t1) + li t2, 0x00000c90 # set mask to 0001100; 0x1890 will set mask to 0011000 + sw t2, DDR_UBUS_PI_DSK0(t1) + + ###### Check to see if we found the edge... + ###### Ideally we want to loop here until we find an edge.... + + li t3, 0 + li t2, 10000 + +1: + # Looking for a rising edge. + lw t4, DDR_UBUS_PI_DSK0(t1) # Read a sample value. + srl t4, 16 # The sample is in the upper 16 bits. + andi t4, 0x41 # Look at the 2 outermost bits; if the LSB is 0 and the MSB is 1, + beq t4, 0x40, 2f # then there is an edge somewhere in the sample. + + addi t3, 1 + bne t2, t3, 1b + nop + +2: + + /**----- Configure DDR controller ------------------------------------**/ + li v0, 16 + li t2, ((MEMC_12BIT_ROW << MEMC_ROW_SHFT) | (MEMC_9BIT_COL << MEMC_COL_SHFT)) + or t2, (MEMC_16BIT_BUS << MEMC_WIDTH_SHFT) + or t2, (MEMC_SEL_PRIORITY) + or t2, (2 << MEMC_EARLY_HDR_CNT_SHFT) + or t2, (MEMC_USE_HDR_CNT) +// or t2, (MEMC_EN_FAST_REPLY) + or t2, (MEMC_RR_ARB) + or t2, (MEMC_DQS_GATE_EN | MEMC_MEMTYPE_DDR) + sw t2, MEMC_CONFIG(t0) # Enable DDR Mem & SEQ EN, 16MB + + li t2, 0x7 # Reduce drive strength for command pins (per John Lorek) + sw t2, DDR_CMD_PAD_CNTL(t1) + + li t2, 0x00A778DD + sw t2, MEMC_DRAM_TIM(t0) # DDR Timing Set Latency 2.5 Latency,tRAS period =7,tRFC period=12, tWR=3 + li t2, 0x00000003 + sw t2, MEMC_CONTROL(t0) # Turn on CKE + li t2, 0x0000000B + sw t2, MEMC_CONTROL(t0) # PreCharge + li t2, 0x00004002 + sw t2, MEMC_M_EM_BUF(t0) # Value for Extended Mode Register, DDR Reduced Drive Strength On + li t2, 0x00000013 + sw t2, MEMC_CONTROL(t0) # MRS command + li t2, 0x00000163 + sw t2, MEMC_M_EM_BUF(t0) # Reset DLL, Burst Length = 8, Burst Type Sequential 2.5 Latency + li t2, 0x00000013 + sw t2, MEMC_CONTROL(t0) # MRS command + nop # Delay 200 DDR clock cycles (~1.5 uS) + nop + nop + li t2, 0x0000000B + sw t2, MEMC_CONTROL(t0) # Precharge + li t2, 0x0000840f + sw t2, MEMC_REF_PD_CONTROL(t0) # Enable auto refresh + li t2, 0x00000007 + sw t2, MEMC_CONTROL(t0) # Set Auto Refresh Mode + li t2, 0x00000007 + sw t2, MEMC_CONTROL(t0) # Set Auto Refresh Mode + li t2, 0x00000063 + sw t2, MEMC_M_EM_BUF(t0) # Reset DLL, Burst Length = 8, Burst Type Sequential 2.5 Latency + li t2, 0x00000013 + sw t2, MEMC_CONTROL(t0) # MRS + + .set reorder + + li sp, 0x80001000 + sub sp, 8 + sw ra, 0(sp) + sw v0, 4(sp) + bal sdramDqsPhaseSet + lw v0, 4(sp) + lw ra, 0(sp) + add sp, 8 + + /**----- switch to sync -----------------------------------------**/ + li t0, 0xff410000 + li t1, DDR_BASE + li t2, 4048 + li t3, 1 + +1: + lw t4, 0x40(t0) # Read a sample value. + srl t4, 16 # The sample is in the upper 16 bits. + + andi t4, t4, 0x41 # Look at the 2 outermost bits; if the LSB is 0 and the MSB is 1, + beq t4, 0x40, 2f # then there is an edge somewhere in the sample. + + lw t5, DDR_MIPS_PHASE_CNTL(t1) + and t5, 0xffff0000 + or t5, t3 + or t5, (1<<14) + sw t5, DDR_MIPS_PHASE_CNTL(t1) + + lw t5, 0x40(t0) # Delay before reading another sample. + add t3, 1 + bne t2, t3, 1b + b 3f + +2: + # Success + lw t2, DDR_MIPS_PHASE_CNTL(t1) # Turn on auto-PI mode. + and t2, 0xf0ffffff + or t2, (1 << 24) | (1 << 21) # LLMB_CNTR_CYCLES_CNTL = 1, LLMB_CNTR_EN = 1 + sw t2, DDR_MIPS_PHASE_CNTL(t1) + + li t2, 0x0010 # Set PI mask to 0000110, and check new value every 16 MIPS cycles. + sw t2, 0x40(t0) # set PI update to 16 ddr cycles + li t2, 0x80000090 # Enable MIPS auto-PI | Enable update period | Set 16 clock update + sw t2, 0x40(t0) + li t2, 0x80000c90 # Enable MIPS auto-PI | Enable comparator | Enable update period | Set 16 clock update + sw t2, 0x40(t0) + + lw t2, 0x40(t0) # Do a few reads to wait till the edge is stable... + lw t2, 0x40(t0) + lw t2, 0x40(t0) + lw t2, 0x40(t0) + lw t2, 0x40(t0) + + mfc0 t1, C0_BCM_CONFIG, 5 + and t1, ~(0x1 << 28) + mtc0 t1, C0_BCM_CONFIG, 5 + + /**----- Enable RAC and LMB -------------------------------------**/ + li t1, MIPS_BASE + lw t2, MIPS_LMB_CR(t1) + or t2, LMB_EN # Enable LMB + sw t2, MIPS_LMB_CR(t1) + + li t2, 0xFFF << RAC_UPB_SHFT # Enable prefetch for RAM address range up to 256MB + sw t2, MIPS_RAC_ARR(t1) + + lw t2, MIPS_RAC_CR0(t1) + or t2, (RAC_C_INV | RAC_I | RAC_PF_I) + sw t2, MIPS_RAC_CR0(t1) + + lw t2, MIPS_RAC_CR1(t1) + or t2, (RAC_C_INV | RAC_I | RAC_PF_I) + sw t2, MIPS_RAC_CR1(t1) + +3: + /**----- Enable branch prediction and non-blocking data cache ---**/ + mfc0 t1, C0_BCM_CONFIG + and t1, ~CP0_BCM_CFG_BTHD + or t1, CP0_BCM_CFG_NBK + or t1, CP0_BCM_CFG_CLF + mtc0 t1, C0_BCM_CONFIG + + /* Test whether memory is 16 or 32 bit wide */ + li t0, MEMC_BASE + lw t2, MEMC_CONFIG(t0) + and t2, ~MEMC_WIDTH_MASK + or t2, (MEMC_32BIT_BUS << MEMC_WIDTH_SHFT) + sw t2, MEMC_CONFIG(t0) + + li t3, DRAM_BASE_NOCACHE + li t4, 0x12345678 + sw t4, 0(t3) + li t4, 0x87654321 + sw t4, 4(t3) + nop + nop + nop + nop + nop + nop + li t4, 0x12345678 + lw t5, 0(t3) + beq t4, t5, 4f + + /* 16 bit wide memory */ + lw t2, MEMC_CONFIG(t0) + and t2, ~MEMC_WIDTH_MASK + or t2, (MEMC_16BIT_BUS << MEMC_WIDTH_SHFT) + sw t2, MEMC_CONFIG(t0) +4: + j ra + +END(board_draminit) + +/* ********************************************************************* + * BOARD_SETLEDS(x) + * + * Set LEDs for boot-time progress indication. Not used if + * the board does not have progress LEDs. This routine + * must not call any other routines, since it may be invoked + * either from KSEG0 or KSEG1 and it may be invoked + * whether or not the icache is operational. + * + * Input parameters: + * a0 - LED value (8 bits per character, 4 characters) + * + * Return value: + * nothing + * + * Registers used: + * t0,t1,t2,t3 + ********************************************************************* */ +LEAF(board_setleds) +#if 0 + li t0, UART_BASE + li t2, TXFIFOEMT + +1: lh t1, UART0INTSTAT(t0) + and t1, t2 + bne t1, t2, 1b + + srl t3, a0, 24 + sb t3, UART0DATA(t0) + srl t3, a0, 16 + sb t3, UART0DATA(t0) + srl t3, a0, 8 + sb t3, UART0DATA(t0) + sb a0, UART0DATA(t0) + li a0, '\r' + sb a0, UART0DATA(t0) + li a0, '\n' + sb a0, UART0DATA(t0) +#endif + j ra +END(board_setleds) + +/* ********************************************************************* + * BCMCORE_TP1_SWITCH() + * + * Check if the thread switch is required. If we are already + * running on thread 1 this function will do nothing and just return + * If we are running on thread 0 this function will take thread 1 + * out of reset and put thread 0 to sleep waiting for singnal from + * thread 1. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ +LEAF(bcmcore_tp1_switch) + + mfc0 t1, C0_BCM_CONFIG, 3 + li t2, CP0_CMT_TPID + and t1, t2 + bnez t1, tp1 # Already running on thread 1 + +# Start TP1 +# Set boot address for TP1 + li t1, MIPS_BASE + li t2, 0x98000000 | ENABLE_ALT_BV + sw t2, MIPS_TP1_ALT_BV(t1) + +# Set a flag so we can wait for TP1 to catch up + li t1, 0x0 + mtc0 t1, $31 # CO_DESAVE + +# Take TP1 out of reset + mfc0 t1, C0_BCM_CONFIG, 2 + or t1, CP0_CMT_RSTSE + mtc0 t1, C0_BCM_CONFIG, 2 + + /* wait until second thread catches up with the first */ +waittp1: + mfc0 t0, $31 # CO_DESAVE + beqz t0, waittp1 + + li t0, THREAD_NUM_ADDRESS + FIXUP(t0) + lw t0, 0(t0) + li t1, 1 + bne t0, t1, return # Linux will run on TP0, continue running bootloader + +# Voice will run on TP0. Set it up and put it to sleep + + # enable interrupts and enable SW IRQ 0 + li t0, M_SR_IE | M_SR_IBIT1 + mtc0 t0, C0_SR + + # Set up to use alternate exception vector 0x80000200 + li t0, M_CAUSE_IV + mtc0 t0, C0_CAUSE + + mfc0 t1, C0_BCM_CONFIG, 1 + # set all ints except IRQ1 to TP1 and cross over SW IRQ 0 + or t1, (CP0_CMT_XIR_4 | CP0_CMT_XIR_3 | CP0_CMT_XIR_2 | CP0_CMT_XIR_0 | CP0_CMT_SIR_0 | CP0_CMT_NMIR_TP1) + mtc0 t1, C0_BCM_CONFIG, 1 + + mfc0 t1, C0_BCM_CONFIG, 2 + # Set debug on TP1, give priority to TP0, and + # set TLB exception serialization to ignore SCNT value in CP0 reg22 sel 4 + and t1, ~CP0_CMT_TPS_MASK; + or t1, (CP0_CMT_DSU_TP1 | CP0_CMT_PRIO_TP0 | (1 << CP0_CMT_TPS_SHFT)) + mtc0 t1, C0_BCM_CONFIG, 2 + + # Enable Data RAC on TP0 + li t1, MIPS_BASE + lw t2, MIPS_RAC_CR0(t1) + or t2, (RAC_D | RAC_PF_D) + sw t2, MIPS_RAC_CR0(t1) + +2: + li t8, 0 + b wait_for_wake + +tp1: +# Running on TP1.... +# First signal to TP0 that TP1 is up + li t1, 0x1 + mtc0 t1, $31 # CO_DESAVE + + li t0, THREAD_NUM_ADDRESS + FIXUP(t0) + lw t0, 0(t0) + li t1, 1 + beq t0, t1, return # Linux will run on TP1, continue running bootloader + +# Voice will run on TP1. Set it up and put it to sleep + + # enable interrupts and enable SW IRQ 0 + li t0, M_SR_IE | M_SR_IBIT1 + mtc0 t0, C0_SR + + # Set up to use alternate exception vector 0x80000200 + li t0, M_CAUSE_IV + mtc0 t0, C0_CAUSE + + mfc0 t1, C0_BCM_CONFIG, 1 + # set IRQ1 to TP1 and cross over SW IRQ 0 + or t1, (CP0_CMT_XIR_1 | CP0_CMT_SIR_0 | CP0_CMT_NMIR_TP0) + mtc0 t1, C0_BCM_CONFIG, 1 + + mfc0 t1, C0_BCM_CONFIG, 2 + # Set debug on TP0, give priority to TP1, and + # set TLB exception serialization to ignore SCNT value in CP0 reg22 sel 4 + and t1, ~CP0_CMT_TPS_MASK; + or t1, (CP0_CMT_PRIO_TP1 | (1 << CP0_CMT_TPS_SHFT)) + mtc0 t1, C0_BCM_CONFIG, 2 + + # Enable Data RAC on TP1 + li t1, MIPS_BASE + lw t2, MIPS_RAC_CR1(t1) + or t2, (RAC_D | RAC_PF_D) + sw t2, MIPS_RAC_CR1(t1) + b 2b + +return: + j ra + +END(bcmcore_tp1_switch) + +# align this code to cache line. NAND flash is not memory mapped after system boots +# so when we are signaling to the second TP to wake we need +# jal instruction to be in cache + .align 4 +LEAF(wait_for_wake) + sync + wait # wait for interrupt + jal t8 # jump to entry point +END(wait_for_wake) diff --git a/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm6368_sdramDqs.c b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm6368_sdramDqs.c new file mode 100755 index 0000000..96d5000 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm6368_sdramDqs.c @@ -0,0 +1,439 @@ +/*************************************************************************** +* +* Copyright (c) 2004 Broadcom Corporation, All Rights Reserved. +* Contains proprietary and confidential information. +* +* No portions of this material may be reproduced in any form without the +* written permission of: +* +* Broadcom Corporation +* 16215 Alton Parkway +* P.O. Box 57013 +* Irvine, California 92619-7013 +* +* All information contained in this document is Broadcom Corporation +* company private, proprietary, and trade secret. +* +****************************************************************************/ +#include "lib_types.h" +#include "bcm_map.h" + +// Uncomment out the below line to use MemoryTestSuite() +// #define EXTENDED_MEMORY_TESTS + +/* ---- Private Constants and Types -------------------------------------- */ +#define VCDL_PHASE_DEFAULT 16 +#define VCDL_PHASE_MAX 47 /* 154.69 degree */ +#define VCDL_PHASE_MIN 0 /* 22.5 degree */ + +typedef unsigned long u; + +#define N 32*1024 // Size of the copy operation + // Must be at least equal to the L2 cache size +#define S (1*sizeof(u)) + +/* ---- Private Function Prototypes -------------------------------------- */ +inline static int MemoryTest(void) __attribute__((always_inline)); +inline static void PI_upper_set(volatile uint32 *, int bitOffset, int shift) __attribute__((always_inline)); +inline static void PI_shmoo(volatile uint32 *PI_reg, int bitOffset, int minValue, int maxValue, int increment) __attribute__((always_inline)); +inline static void shmooVcdl(int minValue, int maxValue, int increment) __attribute__((always_inline)); + +// #define DEBUG_SHMOO 1 +#if DEBUG_SHMOO +inline static void dumpChar(uint8 c) __attribute__((always_inline)); +inline static void dumpChar(uint8 c) +{ + //wait till tx fifo below threshold + while (UART->txf_levl > 14); + UART->Data = c; +} + +#else +#define dumpChar(c) +#endif + +#if defined(EXTENDED_MEMORY_TESTS) +#include "memtest.c"/* Suite memory tests SCAN, MARCH, SLIDING, SHIFT ADDRESS */ +inline static int MemoryTestSuite(void) __attribute__((always_inline)); +#endif + +/* ==== Public Functions ================================================= */ +void sdramDqsPhaseSet(void); +void vcdlCalibration(void); + +/*******************************************************************************/ +void sdramDqsPhaseSet(void) +{ + int dqOutPhaseMax; + int delay; + int ubusPhase, mipsPhase; + int equalCount = 0; + + // Reset VCDL + DDR->Spare1 |= 0x1; + delay = 1000; + while(delay--); + DDR->Spare1 &= ~0x1; + + // Calculate max phase offset from PLL config register. + dqOutPhaseMax = ((DDR->MIPSDDRPLLMDiv & DDR_MDIV_MASK) >> DDR_MDIV_SHFT) * 8; + + dumpChar('\n'); + dumpChar('\r'); + + // Start by setting VCDL to the default. This almost always works. + // Enable squelch + DDR->WSliceCntl |= (0x1<<20) | (0x1<<4); + DDR->VCDLPhaseCntl0 = (VCDL_PHASE_DEFAULT << 22) | (VCDL_PHASE_DEFAULT << 16) | (VCDL_PHASE_DEFAULT << 6) | VCDL_PHASE_DEFAULT; + DDR->VCDLPhaseCntl1 = (VCDL_PHASE_DEFAULT << 22) | (VCDL_PHASE_DEFAULT << 16) | (VCDL_PHASE_DEFAULT << 6) | VCDL_PHASE_DEFAULT; + DDR->WSliceCntl &= ~((0x1<<20) | (0x1<<4)); + + // Now shmoo over DQ phase to find an optimum value. + dumpChar('D');dumpChar('D');dumpChar('R');dumpChar('2'); + dumpChar('\n'); + dumpChar('\r'); + PI_shmoo(&DDR->DDR1_2PhaseCntl0, 16, -dqOutPhaseMax, dqOutPhaseMax, 1); + + dumpChar('V');dumpChar('C');dumpChar('D');dumpChar('L'); + dumpChar('\n'); + dumpChar('\r'); + shmooVcdl(VCDL_PHASE_MIN, VCDL_PHASE_MAX, 1); + + // Now setup the UBUS clock + dumpChar('U');dumpChar('B');dumpChar('U');dumpChar('S'); + dumpChar('\n'); + dumpChar('\r'); + + MEMC->RefreshPdControl &= ~MEMC_REFRESH_ENABLE; // Turn off refresh while messing with UBus clock + + DDR->MIPSPhaseCntl &= ~(0x1<<23); // turn off ubus PI auto mode + + mipsPhase = DDR->MIPSPhaseCntl; + do { + if (DDR->MIPSPhaseCntl == mipsPhase) + equalCount++; + else { + equalCount = 0; + mipsPhase = DDR->MIPSPhaseCntl; + } + } while (equalCount < 3); + + ubusPhase = ((DDR->UBUSPhaseCntl) & 0x3ffe); // make it even and decrease count + DDR->UBUSPhaseCntl = ubusPhase; + + // Wait until we match several times in a row, to be sure we wait long enough + do { + if (DDR->UBUSPhaseCntl == ubusPhase) + equalCount++; + else + equalCount = 0; + } while (equalCount < 3); + + MEMC->RefreshPdControl |= MEMC_REFRESH_ENABLE; +} + + +/* ==== Private Functions ================================================ */ + +inline static void PI_upper_set(volatile uint32 *PI_reg, int bitOffset, int shift) +{ + uint32 oldVal; + uint32 newVal; + int32 oldPhase; + int32 newPhase; + int equalCount = 0; + + oldVal = *PI_reg; // get the phase config (may have other controls in other 16 bits) + + oldPhase = ( oldVal >> bitOffset ) & 0x3fff; + if ( oldPhase & (0x1<<13) ) { + oldPhase |= ~0x3fff; // sign extend + } + + newPhase = shift & 0x3fff; // set up phase shift value[13:0] + if (shift > oldPhase) { // set up up/down [14], shift is signed value + newPhase |= 0x1<<14; + } + + newPhase = newPhase << bitOffset; + oldVal = oldVal & (0xffff << (16-bitOffset)); // Keep the other control bits + newVal = newPhase | oldVal; + *PI_reg = newVal; + + // Wait until we match several times in a row, to be sure we wait long enough + do { + if (*PI_reg == newVal) + equalCount++; + else + equalCount = 0; + } while (equalCount < 3); +} + + +inline static void PI_shmoo(volatile uint32 *PI_reg, int bitOffset, int minValue, int maxValue, int increment) +{ + int piPhase, piPhaseCnt, passStatus; + int pass1Start, pass1Fail, pass2Start, pass2Fail; + int pass1Cnt, pass2Cnt; + + PI_upper_set(PI_reg, bitOffset, minValue); + + passStatus = 0; + pass1Start = maxValue; + pass1Fail = minValue; + pass2Start = minValue; + pass2Fail = minValue; + + for (piPhase = minValue; piPhase <= maxValue; piPhase += increment) { + + // if (MemoryTestSuite()) + if (MemoryTest()) + { + if (passStatus == 0x0) { // first_pass start + passStatus = 0x1; + pass1Start = piPhase; + } + else if (passStatus == 0x2) { // second_pass start + passStatus = 0x3; + pass2Start = piPhase; + } + dumpChar('p'); + } + else { + if (passStatus == 0x1) { // fisrt_pass end + passStatus = 0x2; + pass1Fail = piPhase; + } + else if (passStatus == 0x3) { // second_pass end + passStatus = 0x4; + pass2Fail = piPhase; + } + dumpChar('.'); + } + + piPhaseCnt = ( piPhase + 0x01) & 0x3fff; + if (increment) { + piPhaseCnt |= (0x01<<14); + } + + *PI_reg = (*PI_reg & (0xffff << (16-bitOffset))) | (piPhaseCnt<> 1; // mid-point of the pass window + } else { + piPhaseCnt = (pass1Start + pass1Fail - 0x1) >> 1; // mid-point of the pass window + } + } + else if ((pass1Start == minValue) && (pass2Start != minValue) && (pass2Fail == minValue)) { // valid window 2 + pass1Cnt = pass1Fail - minValue; + pass2Cnt = maxValue - pass2Start + 1; + passStatus= (pass1Cnt + pass2Cnt) >> 1; + if (passStatus < pass1Cnt) { // mid-point of the overall pass window is in sub-window 1 + piPhaseCnt = minValue + ( pass1Cnt - passStatus ); + } + else { + piPhaseCnt = pass2Start - 0x1 + passStatus; + } + } + else { + piPhaseCnt = 0x0; // shmoo failed. + } + + piPhaseCnt &= ~0x01; // make it even number + + PI_upper_set(PI_reg, bitOffset, piPhaseCnt); // set the final phase value + + dumpChar('\n'); + dumpChar('\r'); +} + + +inline static void shmooVcdl(int minValue, int maxValue, int increment) +{ + UINT32 dqsInPhase; + UINT32 dqsInSum = 0; + UINT32 passCnt = 0; + volatile int delay; + + for (dqsInPhase = minValue; dqsInPhase <= maxValue; dqsInPhase += increment) { + delay = 1000; + while(delay--); + // Enable squelch + DDR->WSliceCntl |= (0x1<<20) | (0x1<<4); + DDR->VCDLPhaseCntl0 = (dqsInPhase << 22) | (dqsInPhase << 16) | (dqsInPhase << 6) | dqsInPhase; + DDR->VCDLPhaseCntl1 = (dqsInPhase << 22) | (dqsInPhase << 16) | (dqsInPhase << 6) | dqsInPhase; + DDR->WSliceCntl &= ~((0x1<<20) | (0x1<<4)); + + delay = 1000; + while(delay--); + +#if defined(EXTENDED_MEMORY_TESTS) + if (MemoryTestSuite() == MEMTEST_SUCCESS ) +#else + if (MemoryTest()) +#endif + { + dqsInSum += dqsInPhase; + passCnt++; + dumpChar('p'); + } + else { + dumpChar('.'); + } + } + delay = 1000; + while(delay--); + // Enable squelch + DDR->WSliceCntl |= (0x1<<20) | (0x1<<4); + if (passCnt > 0) { + dqsInPhase = dqsInSum / passCnt; + DDR->VCDLPhaseCntl0 = (dqsInPhase << 22) | (dqsInPhase << 16) | (dqsInPhase << 6) | dqsInPhase; + DDR->VCDLPhaseCntl1 = (dqsInPhase << 22) | (dqsInPhase << 16) | (dqsInPhase << 6) | dqsInPhase; + } + else { + DDR->VCDLPhaseCntl0 = (VCDL_PHASE_DEFAULT << 22) | (VCDL_PHASE_DEFAULT << 16) | (VCDL_PHASE_DEFAULT << 6) | VCDL_PHASE_DEFAULT; + DDR->VCDLPhaseCntl1 = (VCDL_PHASE_DEFAULT << 22) | (VCDL_PHASE_DEFAULT << 16) | (VCDL_PHASE_DEFAULT << 6) | VCDL_PHASE_DEFAULT; + } + DDR->WSliceCntl &= ~((0x1<<20) | (0x1<<4)); + dumpChar('\n'); + dumpChar('\r'); +} + +#if defined(EXTENDED_MEMORY_TESTS) + +// Define the memory size for use by the memory test suite +#define MEMORY_SIZE (2 * 1024) + +int MemoryTestSuite(void) +{ + int test = 1; + uint32_t * memory = (uint32_t*) (0xa0000000); + Pattern_t pat32, patIx; + + for (patIx = PATTERN_0x00000000; patIx < PATTERN_MAX; patIx++ ) + { + pat32 = pattern[ patIx ]; + + fill_memory( memory, MEMORY_SIZE, 0x0 ); + if ( scanWordValue( memory, MEMORY_SIZE, pat32 ) == MEMTEST_FAILURE ) + goto exit_tests; + + test++; + + fill_memory( memory, MEMORY_SIZE, 0x0 ); + if ( scanBulkValue( memory, MEMORY_SIZE, pat32 ) == MEMTEST_FAILURE ) + goto exit_tests; + + test++; + + fill_memory( memory, MEMORY_SIZE, 0x0 ); + if ( scanBulkAltInv( memory, MEMORY_SIZE, pat32 ) == MEMTEST_FAILURE ) + goto exit_tests; + + test++; + + fill_memory( memory, MEMORY_SIZE, 0x0 ); + if ( slidingAltInv( memory, MEMORY_SIZE, pat32 ) == MEMTEST_FAILURE ) + goto exit_tests; + + test++; + + fill_memory( memory, MEMORY_SIZE, 0x0 ); + if ( slidingDiag( memory, MEMORY_SIZE, pat32 ) == MEMTEST_FAILURE ) + goto exit_tests; + + test++; + } + + fill_memory( memory, MEMORY_SIZE, 0x0 ); + if ( scanWordSelf( memory, MEMORY_SIZE ) == MEMTEST_FAILURE ) + goto exit_tests; + + test++; + + fill_memory( memory, MEMORY_SIZE, 0x0 ); + if ( scanBulkSelf( memory, MEMORY_SIZE ) == MEMTEST_FAILURE ) + goto exit_tests; + + test++; + + fill_alt_memory( memory, MEMORY_SIZE, 0XAAAAAAAA, 0x55555555 ); + if ( memoryBulkCopy( memory, (memory + ((MEMORY_SIZE/2)/sizeof(uint32_t))), + MEMORY_SIZE/2 ) == MEMTEST_FAILURE ) + goto exit_tests; + + // return tests; + return MEMTEST_SUCCESS; + +exit_tests: + return MEMTEST_FAILURE; + +} +#endif /* defined(EXTENDED_MEMORY_TESTS) */ + +// +// Returns: 0=FAILURE, 1=SUCCESS +inline static int MemoryTest(void) +{ + // Test 32-bit write/read + volatile uint32 *memAddr; + uint32 memBase; + uint32 testValue; + int i; + int j; + int k; + + memBase = 0xa0000000; + for (i = 2; i < 24; i++) { + memAddr = (void *) (memBase + (1 << i)); + for (k = 0; k < 2; k++) { + /* walking one */ + testValue = 1; + for (j = 0; j < 32; j++) { + *memAddr = testValue; + if (*memAddr != testValue) + return 0; + + testValue <<= 1; + } + /* walking zero */ + testValue = ~1; + for (j = 0; j < 32; j++) { + *memAddr = testValue; + if (*memAddr != testValue) + return 0; + + testValue = (testValue << 1) | 1; + } + /* shift in zeroes */ + testValue = -1; + for (j = 0; j < 32; j++) { + *memAddr = testValue; + *(uint32*)memBase = 0; + if (*memAddr != testValue) + return 0; + + testValue <<= 1; + } + /* shift in ones */ + testValue = 1; + for (j = 0; j < 32; j++) { + *memAddr = testValue; + *(uint32*)memBase = 0; + if (*memAddr != testValue) + return 0; + + testValue = (testValue << 1) | 1; + } + } + } + return 1; +} + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm63xx_impl1_rom_boot.S b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm63xx_impl1_rom_boot.S new file mode 100755 index 0000000..b3986ed --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm63xx_impl1_rom_boot.S @@ -0,0 +1,1818 @@ +#include "sbmips.h" +#include "bsp_config.h" + +#include "bcm_cpu.h" +#include "bcm_common.h" + +#include "bcm_hwdefs.h" +#include "boardparms.h" +#include "mipsmacros.h" + +#define DDR_TEST 1 +#define UBUS_SYNC_ENABLE 1 +#define LMB_SYNC_ENABLE 1 +#define MIPS_SYNC_ENABLE 1 +#define LMB_ENABLE 1 + +/* Memory mapping table for different size DRAMs (256Mb, 512Mb, 1Gb, 2Gb) */ + .globl dram_map_table_x8 +dram_map_table_x8: + // 128Mb 64B Interleaving (x8 Mode) 32MB + // This is just a place holder. This memory does not exist + _LONG_ 0x0F0E0D0C, 0x13121110, 0x17161514, 0x00000018 // Row00_0 Row00_1 Row01_0 Row01_1 + _LONG_ 0x04000000, 0x0A090805, 0x0000000B, 0x00000000 // Col00_0 Col00_1 Col01_0 Col01_1 + _LONG_ 0x00080706, 0x00000002, 0x00000055 // Bank CS_End Dramsize + + // 256Mb 64B Interleaving (x8 Mode) 64MB + _LONG_ 0x100F0E0D, 0x14131211, 0x18171615, 0x00000019 // Row00_0 Row00_1 Row01_0 Row01_1 + _LONG_ 0x04000000, 0x0A090805, 0x00000C0B, 0x00000000 // Col00_0 Col00_1 Col01_0 Col01_1 + _LONG_ 0x00000706, 0x00000004, 0x00000066 // Bank CS_End Dramsize + + // 512Mb 64B Interleaving (x8 Mode) 128MB + _LONG_ 0x100F0E0D, 0x14131211, 0x18171615, 0x00001A19 // Row00_0 Row00_1 Row01_0 Row01_1 + _LONG_ 0x04000000, 0x0A090805, 0x00000C0B, 0x00000000 // Col00_0 Col00_1 Col01_0 Col01_1 + _LONG_ 0x00000706, 0x00000008, 0x00000077 // Bank CS_End Dramsize + + // 1Gb 64B Interleaving (x8 Mode) 256MB + _LONG_ 0x11100F0E, 0x15141312, 0x19181716, 0x00001B1A // Row00_0 Row00_1 Row01_0 Row01_1 + _LONG_ 0x04000000, 0x0B0A0905, 0x00000D0C, 0x00000000 // Col00_0 Col00_1 Col01_0 Col01_1 + _LONG_ 0x00080706, 0x00000010, 0x00000088 // Bank CS_End Dramsize + + .globl dram_map_table_x16 +dram_map_table_x16: + // 256Mb 64B Interleaving (x16 Mode) 32MB + _LONG_ 0x0F0E0D0C, 0x13121110, 0x17161514, 0x00000018 // Row00_0 Row00_1 Row01_0 Row01_1 + _LONG_ 0x04000000, 0x0A090805, 0x0000000B, 0x00000000 // Col00_0 Col00_1 Col01_0 Col01_1 + _LONG_ 0x00000706, 0x00000002, 0x00000055 // Bank CS_End Dramsize + + // 512Mb 64B Interleaving (x16 Mode) 64MB + _LONG_ 0x100F0E0D, 0x14131211, 0x18171615, 0x00000019 // Row00_0 Row00_1 Row01_0 Row01_1 + _LONG_ 0x04000000, 0x0A090805, 0x00000C0B, 0x00000000 // Col00_0 Col00_1 Col01_0 Col01_1 + _LONG_ 0x00000706, 0x00000004, 0x00000066 // Bank CS_End Dramsize + + // 1Gb 64B Interleaving (x16 Mode) 128MB + _LONG_ 0x11100F0E, 0x15141312, 0x19181716, 0x0000001A // Row00_0 Row00_1 Row01_0 Row01_1 + _LONG_ 0x04000000, 0x0B0A0905, 0x00000D0C, 0x00000000 // Col00_0 Col00_1 Col01_0 Col01_1 + _LONG_ 0x00080706, 0x00000008, 0x00000077 // Bank CS_End Dramsize + + // 2Gb 64B Interleaving (x16 Mode) 256MB + _LONG_ 0x11100F0E, 0x15141312, 0x19181716, 0x00001B1A // Row00_0 Row00_1 Row01_0 Row01_1 + _LONG_ 0x04000000, 0x0B0A0905, 0x00000D0C, 0x00000000 // Col00_0 Col00_1 Col01_0 Col01_1 + _LONG_ 0x00080706, 0x00000010, 0x00000088 // Bank CS_End Dramsize + + .globl dram_tRefi_table +dram_tRefi_table: /* Refresh Interval table for different Speed DRAMs (100-200, 300-333, 400) */ + _LONG_ 0x16, 0x49, 0x5D // 100-200 300-333 400 (MHz) + + .globl dram_tRFC_table +dram_tRFC_table: /* tRFC table for different size & Speed DRAMs (256Mb, 512Mb, 1Gb)/(200, 333, 400) */ +// 200 333 400 (MHz) + _LONG_ 0xF, 0x19, 0x1E // 256Mb + _LONG_ 0x15, 0x23, 0x2A // 512Mb + _LONG_ 0x1A, 0x2B, 0x33 // 1Gb + _LONG_ 0x28, 0x42, 0x4F // 2Gb + + .globl dram_timing_table +dram_timing_table: /* */ +// tRCD tCL tWR tWL tRP tRRD tRC tFAW tW2R tR2W tR2R tAL tRTP tW2W +// --------------------------------------------------------------------- + .byte 0x03,0x04,0x03,0x03,0x03,0x02,0x11,0x00,0x01,0x01,0x00,0x02,0x02,0x00,0x00,0x00 // 200MHz + .byte 0x05,0x05,0x05,0x04,0x05,0x04,0x13,0x00,0x02,0x01,0x00,0x04,0x03,0x00,0x00,0x00 // 300MHz + .byte 0x05,0x05,0x06,0x04,0x06,0x05,0x18,0x00,0x02,0x01,0x00,0x04,0x03,0x00,0x00,0x00 // 400MHz + + .globl dram_sync_table +dram_sync_table: /* Bit vector table for Ubus sync modes and Lmb sync modes */ +#if defined(_BCM96328_) + _LONG_ 0x8E10FFFF, 0x8A10FFFF, 0xEDC2FFFF // UBUS Sync , LMB Sync, Mips Sync +#elif defined(_BCM96362_) + _LONG_ 0xFFBFBFBF, 0x6341C101, 0xE7E5E5E5 // UBUS Sync , LMB Sync, Mips Sync +#elif defined(_BCM96816_) + _LONG_ 0xC03033B5, 0x80303095, 0xFF90FFFF // UBUS Sync , LMB Sync, Mips Sync +#endif + .globl dram_speed_table +dram_speed_table: /* Memory Speed Table for different clock strap values */ + /* 0=200Mhz 1=333MHz 2=400MHz */ +#if defined(_BCM96328_) + .byte 0 // 0x0 + .byte 0 // 0x1 + .byte 0 // 0x2 + .byte 0 // 0x3 + .byte 0 // 0x4 + .byte 0 // 0x5 + .byte 0 // 0x6 + .byte 0 // 0x7 + .byte 0 // 0x8 + .byte 0 // 0x9 + .byte 0 // 0xa + .byte 0 // 0xb + .byte 0 // 0xc + .byte 0 // 0xd + .byte 0 // 0xe + .byte 0 // 0xf + .byte 0 // 0x10 + .byte 0 // 0x11 + .byte 0 // 0x12 + .byte 0 // 0x13 + .byte 0 // 0x14 + .byte 0 // 0x15 + .byte 2 // 0x16 + .byte 2 // 0x17 + .byte 0 // 0x18 + .byte 0 // 0x19 + .byte 0 // 0x1a + .byte 0 // 0x1b + .byte 0 // 0x1c + .byte 0 // 0x1d + .byte 0 // 0x1e + .byte 1 // 0x1f +#elif defined(_BCM96362_) + .byte 1 // 0x0 + .byte 2 // 0x1 + .byte 0 // 0x2 + .byte 1 // 0x3 + .byte 0 // 0x4 + .byte 2 // 0x5 + .byte 2 // 0x6 + .byte 1 // 0x7 + .byte 1 // 0x8 + .byte 2 // 0x9 + .byte 0 // 0xa + .byte 1 // 0xb + .byte 0 // 0xc + .byte 2 // 0xd + .byte 2 // 0xe + .byte 1 // 0xf + .byte 1 // 0x10 + .byte 2 // 0x11 + .byte 0 // 0x12 + .byte 1 // 0x13 + .byte 0 // 0x14 + .byte 1 // 0x15 // 267MHz. Need to change tREFI if this is used. + .byte 2 // 0x16 + .byte 1 // 0x17 + .byte 1 // 0x18 + .byte 1 // 0x19 + .byte 0 // 0x1a + .byte 1 // 0x1b + .byte 0 // 0x1c + .byte 0 // 0x1d + .byte 2 // 0x1e + .byte 1 // 0x1f +#elif defined(_BCM96816_) + .byte 0 // 0x0 + .byte 1 // 0x1 + .byte 0 // 0x2 + .byte 0 // 0x3 + .byte 0 // 0x4 + .byte 1 // 0x5 + .byte 1 // 0x6 + .byte 1 // 0x7 + .byte 1 // 0x8 + .byte 1 // 0x9 + .byte 1 // 0xa + .byte 2 // 0xb + .byte 2 // 0xc + .byte 2 // 0xd + .byte 2 // 0xe + .byte 2 // 0xf + .byte 2 // 0x10 + .byte 2 // 0x11 + .byte 2 // 0x12 + .byte 2 // 0x13 + .byte 2 // 0x14 + .byte 0 // 0x15 + .byte 0 // 0x16 + .byte 1 // 0x17 + .byte 1 // 0x18 + .byte 1 // 0x19 + .byte 1 // 0x1a + .byte 1 // 0x1b + .byte 2 // 0x1c + .byte 2 // 0x1d + .byte 2 // 0x1e + .byte 2 // 0x1f +#endif + + .globl memc_ubus_ratio_table +memc_ubus_ratio_table: /* Memory Speed Table for different clock strap values */ +#if defined(_BCM96328_) +// 6328 Clock Speed Table + .byte 3 // 0x0 + .byte 3 // 0x1 + .byte 3 // 0x2 + .byte 3 // 0x3 + .byte 3 // 0x4 + .byte 3 // 0x5 + .byte 3 // 0x6 + .byte 3 // 0x7 + .byte 3 // 0x8 + .byte 3 // 0x9 + .byte 3 // 0xa + .byte 3 // 0xb + .byte 3 // 0xc + .byte 3 // 0xd + .byte 3 // 0xe + .byte 3 // 0xf + .byte 3 // 0x10 + .byte 3 // 0x11 + .byte 0xf // 0x12 + .byte 0xf // 0x13 + .byte 3 // 0x14 + .byte 9 // 0x15 + .byte 9 // 0x16 + .byte 9 // 0x17 + .byte 3 // 0x18 + .byte 3 // 0x19 + .byte 3 // 0x1a + .byte 3 // 0x1b + .byte 0xb // 0x1c + .byte 0xb // 0x1d + .byte 0xb // 0x1e + .byte 3 // 0x1f +#elif defined(_BCM96362_) +// 6362 Clock Speed Table + .byte 3 // 0x0 + .byte 3 // 0x1 + .byte 3 // 0x2 + .byte 3 // 0x3 + .byte 3 // 0x4 + .byte 3 // 0x5 + .byte 3 // 0x6 + .byte 3 // 0x7 + .byte 3 // 0x8 + .byte 3 // 0x9 + .byte 3 // 0xa + .byte 3 // 0xb + .byte 3 // 0xc + .byte 3 // 0xd + .byte 3 // 0xe + .byte 3 // 0xf + .byte 3 // 0x10 + .byte 3 // 0x11 + .byte 3 // 0x12 + .byte 3 // 0x13 + .byte 4 // 0x14 + .byte 4 // 0x15 + .byte 15 // 0x16 + .byte 3 // 0x17 + .byte 3 // 0x18 + .byte 3 // 0x19 + .byte 3 // 0x1a + .byte 3 // 0x1b + .byte 3 // 0x1c + .byte 3 // 0x1d + .byte 3 // 0x1e + .byte 3 // 0x1f +#elif defined(_BCM96816_) +// 6816 Clock Speed Table + .byte 3 // 0x0 + .byte 9 // 0x1 + .byte 3 // 0x2 + .byte 4 // 0x3 + .byte 3 // 0x4 + .byte 3 // 0x5 + .byte 9 // 0x6 + .byte 3 // 0x7 + .byte 3 // 0x8 + .byte 3 // 0x9 + .byte 2 // 0xa + .byte 4 // 0xb + .byte 2 // 0xc + .byte 3 // 0xd + .byte 4 // 0xe + .byte 9 // 0xf + .byte 1 // 0x10 + .byte 1 // 0x11 + .byte 1 // 0x12 + .byte 1 // 0x13 + .byte 3 // 0x14 + .byte 3 // 0x15 + .byte 4 // 0x16 + .byte 9 // 0x17 + .byte 6 // 0x18 + .byte 2 // 0x19 + .byte 6 // 0x1a + .byte 2 // 0x1b + .byte 4 // 0x1c + .byte 3 // 0x1d + .byte 4 // 0x1e + .byte 3 // 0x1f +#endif + +#if defined(_BCM96816_) + .globl periph_fix_table +periph_fix_table: // Periph Clock fix vector for different clock strap values + _LONG_ 0xAA30A047 +#endif + +#define SETLEDS1(a,b,c,d) \ + li a0,(((a)<<24)|((b)<<16)|((c)<<8)|(d)) ; \ + bal board_setleds; \ + nop + +/* ********************************************************************* + * BOARD_EARLYINIT() + * + * Initialize board registers. This is the earliest + * time the BSP gets control. This routine cannot assume that + * memory is operational, and therefore all code in this routine + * must run from registers only. The $ra register must not + * be modified, as it contains the return address. + * + * This routine will be called from uncached space, before + * the caches are initialized. If you want to make + * subroutine calls from here, you must use the CALLKSEG1 macro. + * + * Among other things, this is where the GPIO registers get + * programmed to make on-board LEDs function, or other startup + * that has to be done before anything will work. + * + * Input parameters: + * a0 - Flash base address (address of MIPS reset) + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(board_earlyinit) + + .set noreorder + + mfc0 t1, C0_BCM_CONFIG, 3 + li t2, CP0_CMT_TPID + and t1, t2 + bnez t1, 3f # if we are running on thread 1, skip init + nop + + /**-------------------------------------------------------------**/ + /** platform specific code **/ + /**-------------------------------------------------------------**/ + +#if defined(_BCM96816_) + /**----- Offset UBUS Clock 180 degrees -------------------------**/ + li t2, MISC_BASE + lw t1, MISC_STRAP_BUS(t2) + + srl t1, MISC_STRAP_BUS_MIPS_PLL_FVCO_SHIFT + andi t1, 0x1f // Mask out strap bits + + move s0,ra + LOADREL(t2, periph_fix_table) + lw t2, 0(t2) + srl t2, t1 + andi t2, 1 + move ra,s0 + + beq t2, zero, 2f + nop + + li t0, DDR_BASE + li t1, 0x00070000 // send new phase value to PLL every 8 cycles + sw t1, DDR_CTL_PI_UBUS_CTL(t0) + ori t1, 0x4080 // shift 128 steps in the positive direction to be 180 degree's offset VCO 1.6GHz + sw t1, DDR_CTL_PI_UBUS_CTL(t0) + li t1, 0x00000001 + sw t1, DDR_CTL_PI_GCF(t0) + + li t1, 0x10000 // delay +1: + bnez t1, 1b + addi t1, -1 + +2: + /**----- Set 1.2V and 2.5V Voltage regulators ------------------**/ + li t1, GPIO_BASE + lw t2, GPIO_SWREG_CONFIG(t1) + and t2, ~GPIO_SW_VREG_SEL_MASK + or t2, (0x0 << GPIO_SW_VREG_SEL_SHIFT) + and t2, ~GPIO_LIN_VREG_ADJ_MASK + or t2, (0x0 << GPIO_LIN_VREG_ADJ_SHIFT) + sw t2, GPIO_SWREG_CONFIG(t1) + + li t1, 0x10000 +1: + bnez t1, 1b + addi t1, -1 +#endif + +#if defined (_BCM96328_) || defined (_BCM96362_) + /* slow down mips clk (div 4) to unlock memory */ + mfc0 t1, C0_BCM_CONFIG, 5 + or t2, t1, 0x40000000 + mtc0 t2, C0_BCM_CONFIG, 5 + nop + + mtc0 t1, C0_BCM_CONFIG, 5 + nop +#endif + +#if defined (_BCM96362_) + /* Adjust VREG frequency up by 50% to improve DSL performance */ + li t2, MISC_BASE + + /* First set ramp control */ + lw t1, MISC_VREG_CONTROL0(t2) + or t1, (0x2 << MISC_VREG_CONTROL0_VREG_RAMP1P8_SHIFT) | (0x2 << MISC_VREG_CONTROL0_VREG_RAMP1P2_SHIFT) + sw t1, MISC_VREG_CONTROL0(t2) + + /* wait 10ms for the setting to take effect */ + li t8, -2000000 + mtc0 t8, C0_COUNT +1: + bltz t8, 1b + mfc0 t8, C0_COUNT + + and t1, ~((0x7 << MISC_VREG_CONTROL0_VREG_RAMP1P8_SHIFT) | (0x7 << MISC_VREG_CONTROL0_VREG_RAMP1P2_SHIFT)) + or t1, (0x3 << MISC_VREG_CONTROL0_VREG_ADJ_SHIFT) + sw t1, MISC_VREG_CONTROL0(t2) + + /* Increase 2.5V regulator to provide increased range for 1.8V */ + lw t1, MISC_VREG_CONTROL1(t2) + and t1, ~MISC_VREG_CONTROL1_VREG_ISEL2P5_MASK + or t1, (MISC_VREG_LDO_2P61 << MISC_VREG_CONTROL1_VREG_ISEL2P5_SHIFT) + sw t1, MISC_VREG_CONTROL1(t2) +#endif + +#if 0 + /* wait for a while to allow catch by jtag debugger */ + li t8, -(200000000*3) /* we will count up to 0 to delay a couple of seconds */ + /* and give the emulator a chance to catch us */ + mtc0 t8, C0_COUNT +catchloop: + bltz t8, catchloop + mfc0 t8, C0_COUNT +#endif + + /**----- Enable I Cache -----------------------------------------**/ + mfc0 t1, C0_BCM_CONFIG + or t1, (CP0_BCM_CFG_ICSHEN | CP0_BCM_CFG_DCSHEN) + mtc0 t1, C0_BCM_CONFIG # Enable I Cache + + // In the begining MIPS core registers are mapped to 0xbfax_xxxx + li t1, 0x1FA0000C # Set up CBR to 1FAx_xxxx + mtc0 t1, C0_BCM_CONFIG, 6 + + li t1, MIPS_BASE_BOOT + lw t2, MIPS_LMB_CR(t1) + or t2, 0xC0000000 # enable ffxx_xxxx space + sw t2, MIPS_LMB_CR(t1) + li t2, 0xFFF80001 # SBR FFF8_xxxx and enable + sw t2, MIPS_SBR(t1) + + // Now map MIPS core registers to 0xFF4x_xxxx space + li t1, 0xFF40000C # CBR FF4x_xxxx (and reserved bits 0xc). + mtc0 t1, C0_BCM_CONFIG, 6 + +#if defined(_BCM96816_) + /**----- Initialize EBI -----------------------------------------**/ + li t1, MPI_BASE + li t2, EBI_SIZE_32M + or t2, a0 + sw t2, CS0BASE(t1) # CS[0] Base + li t2, THREEWT|EBI_WORD_WIDE|EBI_ENABLE + sw t2, CS0CNTL(t1) # CS[0] Control +#endif + + /**----- Initialize Serial --------------------------------------**/ + li t3, ((FPERIPH / 115200) / 16) + /* + # Baudword = (FPeriph)/Baud/32-1. We have to perform rounding + # and subtraction. Above we divided by 16 (instead of 32). If + # bit0 is set, we round up. However, we then subtract 1, so final + # result should be t3/2. If bit0 is 0, then we truncate and subtract + # 1, t3=t3/2-1. + */ + andi t0, t3, 0x1 + bne t0,zero,1f # do shift only (in delay slot) + # and jump to apply + srl t3,1 # do divide by 2 + addiu t3, -1 # subtract 1 +1: + + // t3 contains the UART BAUDWORD + li t0, UART_BASE + sw t3, UART0BAUD(t0) # Store BaudRate + li t1, BITS8SYM|ONESTOP + sb t1, UART0CONFIG(t0) # 8 Bits/1 Stop + li t1, TXEN|RXEN|BRGEN + sb t1, UART0CONTROL(t0) # Enable, No Parity + move t1, zero + sh t1, UART0INTMASK(t0) + + .set reorder +3: + j ra +END(board_earlyinit) + +/* ********************************************************************* + * BOARD_DRAMINFO + * + * Return the address of the DRAM information table + * + * Input parameters: + * nothing + * + * Return value: + * v0 - DRAM info table, return 0 to use default table + ********************************************************************* */ +LEAF(board_draminfo) + j ra +END(board_draminfo) + +/* ********************************************************************* + * BOARD_DRAMINIT + * + * This routine should activate memory. + * + * Input parameters: + * None + * + * Return value: + * None + * + * Registers used: + * can use all registers. + ********************************************************************* */ +LEAF(board_draminit) + .set noreorder + + move s0,ra + +/***** Load DDR Base *************************************/ + li t0, DDR_BASE + +/***** Disable Auto refresh ******************************/ + li t1, 0x10000 + sw t1, DDR_CTL_CLKS(t0) + SETLEDS1('-','-','-', '-') + SETLEDS1('P','H','Y','S') + + li t1, 0x10 // Loop count value + li t3, 1 + +zq_loop: + sub t1, t3 // Decrement count by 1 + beq t1, zero, zq_error + nop + + sw zero, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Reset the calibration engine + li t4, (1 << 26) + sw t4, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Start the calibration + + li t2, 0x100 // Timeout value + +wait_zq1: + beq t2, zero, zq_timeout + nop + + lw t4, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Read the calibration result + move t5, t4 // Save calibration result1 + and t4, (1 << 28) + beq t4, zero, wait_zq1 + sub t2, t3 + + sw zero, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Reset the calibration engine + li t4, (1 << 26) + sw t4, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Start the calibration + + li t2, 0x100 // Timeout value + +wait_zq2: + beq t2, zero, zq_timeout + nop + + lw t4, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Read the calibration result + move t6, t4 // Save calibration result1 + and t4, (1 << 28) + beq t4, zero, wait_zq2 + sub t2, t3 + + sw zero, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Reset the calibration engine + li t4, (1 << 26) + sw t4, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Start the calibration + + li t2, 0x100 // Timeout value + +wait_zq3: + beq t2, zero, zq_timeout + nop + + lw t4, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Read the calibration result + move t7, t4 // Save calibration result1 + and t4, (1 << 28) + beq t4, zero, wait_zq3 + sub t2, t3 + + bne t5, t6, zq_loop + nop + bne t5, t7, zq_loop + nop + bne t6, t7, zq_loop + nop + + b zq_done; + nop + +zq_error: + SETLEDS1('Z','Q','E','R') + b zq_done + nop + +zq_timeout: + SETLEDS1('Z','Q','T','O') + nop +zq_done: + sw zero, PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL(t0) // Reset the calibration engine + + SETLEDS1('Z','Q','D','N') + nop + +/****** Set control pad strength to half ********/ + lw t2, PHY_CONTROL_REGS_DRIVE_PAD_CTL(t0) + or t2, 0x4 + sw t2, PHY_CONTROL_REGS_DRIVE_PAD_CTL(t0) + +#if defined(_BCM96816_) +/****** Disable byte lanes 2 and 3 ********/ + li t1, 0x800fffff + sw t1, PHY_BYTE_LANE_2_IDLE_PAD_CONTROL(t0) + sw t1, PHY_BYTE_LANE_3_IDLE_PAD_CONTROL(t0) +#endif + +/****** Disable byte lane 1 clock ********/ + li t1, 1 + sw t1, PHY_BYTE_LANE_1_CLOCK_PAD_DISABLE(t0) + +ddr_x8: + +/****** Change the slew and receiver power to full strength in the byte lanes ********/ + li t1, 0xFFFFFFFC + lw t2, PHY_BYTE_LANE_0_DRIVE_PAD_CTL(t0) + and t2, t2, t1 + sw t2, PHY_BYTE_LANE_0_DRIVE_PAD_CTL(t0) + lw t2, PHY_BYTE_LANE_1_DRIVE_PAD_CTL(t0) + and t2, t2, t1 + sw t2, PHY_BYTE_LANE_1_DRIVE_PAD_CTL(t0) + +/****** Hardware calibrate VDL *******/ + li t1, 3 + sw t1, PHY_BYTE_LANE_0_VDL_CALIBRATE(t0) + sw t1, PHY_BYTE_LANE_1_VDL_CALIBRATE(t0) + + li t1, 0x1000 +1: + bnez t1, 1b + addi t1, -1 + +/****** Check strap value to figure out 400MHz or 200Mhz DDR ******/ + li t2, MISC_BASE + lw t1, MISC_STRAP_BUS(t2) + + srl t1, MISC_STRAP_BUS_MIPS_PLL_FVCO_SHIFT + andi t1, 0x1f // Mask out strap bits + + LOADREL(t2, dram_speed_table) + + add t2, t1 + lb t1, 0x00(t2) + beq t1, zero, ddr_clk_200 + li t2, 1 + beq t1, t2, ddr_clk_300 + nop + +/****** Software override rd_en VDL and ADDRESS VDL ********/ +ddr_clk_450: +ddr_clk_400: + li a1, 2 // Set speed to 400MHz (2) + b 1f + nop +ddr_clk_300: + li a1, 1 // Set speed to 300MHz (1) + +/* At higher frequencies set Read_en VDL value to calibrated VDL value + 10 */ +1: li t2, 0x10000 + lw t1, PHY_BYTE_LANE_0_VDL_STATUS(t0) + srl t1, 8 + addi t1, 0xA + or t1, t1, t2 + sw t1, PHY_BYTE_LANE_0_VDL_OVERRIDE_2(t0) + lw t1, PHY_BYTE_LANE_1_VDL_STATUS(t0) + srl t1, 8 + addi t1, 0xA + or t1, t1, t2 + sw t1, PHY_BYTE_LANE_1_VDL_OVERRIDE_2(t0) + b vdl_override_cont + nop + +ddr_clk_200: + li a1, 0 // Set speed to 200MHz (0) + li t3, 0x1f // Set maximum VDL step size for 200MHz + b 1f + nop + +vdl_override_cont: + lw t2, PHY_BYTE_LANE_0_VDL_STATUS(t0) + andi t3, t2, 0x1f00 + srl t3, 8 + addi t3, t3, 0x4 // Add Stepsize 4 + +1: li t1, 0x110000 // Enable & Force Override + or t1, t3 // Fine rise and fine fall are set to 0 + + sw t1, PHY_CONTROL_REGS_STATIC_VDL_OVERRIDE(t0) + li t1, 0x0c + sw t1, DDR_CTL_DCMD(t0) // Set VDL + + SETLEDS1('P','H','Y','E') + +/* Program MC Timing Registers + + Read each timing parameter based on the speed and then create the + timing registers and program them. +*/ + LOADREL(t2, dram_timing_table) + + li t1, 0x10 // size of dram_timing_table element + mult t1, a1 + mflo t1 // dram_timing_table offset + add t2, t1 + + move t3, zero + lb t1, 0x00(t2) // tRCD + andi t1, 0xf + move t3, t1 + lb t1, 0x01(t2) // tCL + andi t1, 0xf + + move t4, t1 + and t4, 0x7 // Make sure that only 3 bits are written to DRAM's tCL field + sll t4, 20 + sw t4, DDR_CTL_DMODE_0 (t0) // Write tCL to the MRS register holder + + sll t1, 4 + or t3, t1 + lb t1, 0x02(t2) // tWR + andi t1, 0xf + + // Here we create the MRS register values + move t4, t1 + li t5, 1 + subu t4, t5 // tWR written to DRAM is 1 less than real tWR value + andi t4, 0x7 + sll t4, 25 + li t5, 0x01030000 // Sequential burst mode, burst of 8, reset DLL + or t4, t5 + lw t5, DDR_CTL_DMODE_0 (t0) + or t5, t4 + sw t5, DDR_CTL_DMODE_0 (t0) // Add tWR to the MRS register holder + + sll t1, 9 + or t3, t1 + lb t1, 0x03(t2) // tWL + andi t1, 0xf + sll t1, 12 + or t3, t1 + lb t1, 0x04(t2) // tRP + andi t1, 0xf + sll t1, 16 + or t3, t1 + lb t1, 0x05(t2) // tRRD + andi t1, 0xf + sll t1, 20 + or t3, t1 + lb t1, 0x06(t2) // tRC + andi t1, 0x1f + sll t1, 24 // tRCw + or t3, t1 + sw t3, DDR_CTL_TIM1_0(t0) // Program TIM1_0 register + + move t3, zero + lb t1, 0x06(t2) // tRC + andi t1, 0x1f + or t3, t1 // tRCr + lb t1, 0x07(t2) // tFAW + andi t1, 0x3f + sll t1, 8 + or t3, t1 + li t1, 0xff // tRFC = 0xff (Set to max value first. + sll t1, 16 // We'll fix it after we determine dram size) + or t3, t1 + + // We skip tFIFO since it needs to be 0 + + lb t1, 0x08(t2) // tW2R + andi t1, 0x3 + sll t1, 26 + or t3, t1 + lb t1, 0x09(t2) // tR2W + andi t1, 0x3 + sll t1, 28 + or t3, t1 + lb t1, 0x0a(t2) // tR2R + andi t1, 0x1 + sll t1, 30 + or t3, t1 + sw t3, DDR_CTL_TIM1_1(t0) // Program TIM1_1 register + + move t3, zero + lb t1, 0x0b(t2) // tAL + andi t1, 0xf + + // Here we create the EMRS register values + move t4, t1 + andi t4, 0x7 + sll t4, 3 + li t5, 0x384 // RTT=75ohm, OCD Enter + or t4, t5 + lw t5, DDR_CTL_DMODE_0 (t0) + or t5, t4 + sw t5, DDR_CTL_DMODE_0 (t0) // Store required values in EMRS holding register + + or t3, t1 + lb t1, 0x0c(t2) // tRTP + andi t1, 0x7 + sll t1, 4 + or t3, t1 + lb t1, 0x0d(t2) // tW2W + andi t1, 0x3 + sll t1, 8 + or t3, t1 + sw t3, DDR_CTL_TIM2(t0) // Program TIM2 register + +/* +// (tRRD is incremented by 1 due to tFAW bug for >=1Gb devices) + li t1, 0x18564c55 // tRCD=5,tWR=6,tCL=5,tWL=4,tRP=6,tRRD=5,tRCw=0x18 +// li t1, 0x13554a55 // tRCD=5,tWR=5,tCL=5,tWL=4,tRP=5,tRRD=5,tRCw=0x13 + sw t1, DDR_CTL_TIM1_0(t0) + li t1, 0x18330018 // tR2W=1,tR2R=0,tW2R=2,tFIFO=0,tRFC=0x33,tFAW=0,tRCr=0x18 +// li t1, 0x182b0013 // tR2W=1,tR2R=0,tW2R=2,tFIFO=0,tRFC=0x2b,tFAW=0,tRCr=0x13 + sw t1, DDR_CTL_TIM1_1(t0) + li t1, 0x00000034 // tAL=4 (tRCD-1), tRTP=3, tW2W=0 + sw t1, DDR_CTL_TIM2(t0) +*/ + +// Set x16 mode and Page policy + li t1, 0x100 + sw t1, DDR_CTL_DMODE_1(t0) + +// Enable ODT for writes + li t1, 0x104 + sw t1, DDR_CTL_ODT(t0) + +/***** Turn on CKE ***************/ + li t1, 0x35 + sw t1, DDR_CTL_DCMD(t0) + + li t1, 0x200 +2: + bnez t1, 2b + addi t1, -1 + +/***** Set arbitor for Burst Round Robin Mode ***/ + lw t1, DDR_CTL_ARB(t0) + or t1, 4 << 16 + sw t1, DDR_CTL_ARB(t0) + +/***** Issue Precharge All Banks Command ***/ + li t1, 0x32 + sw t1, DDR_CTL_DCMD(t0) + +/***** Issue EMRS2 Command ***/ + li t1, 0x0 + lw t2, DDR_CTL_DMODE_0 (t0) // Load previous value to t2 to preserve it + nop + sw t1, DDR_CTL_DMODE_0 (t0) + li t1, 0x38 + sw t1, DDR_CTL_DCMD(t0) + +/***** Issue EMRS3 Command***/ + li t1, 0x0 + sw t1, DDR_CTL_DMODE_0 (t0) + li t1, 0x39 + sw t1, DDR_CTL_DCMD(t0) + +// Enable DLL by issuing EMRS Command +// li t1, 0x0 +// sw t1, DDR_CTL_DMODE_0 (t0) + sw t2, DDR_CTL_DMODE_0 (t0) // Use the saved value back to DMODE_0 register + li t1, 0x30 + sw t1, DDR_CTL_DCMD(t0) + +/* +// Issue MRS Command tCL=5 tWL=4 + li t1, 0x0b530000 +// li t1, 0x07530000 // tCL=5 tWR=5, Reset DLL, Sequential Mode, Burst Length = 8 + sw t1, DDR_CTL_DMODE_0 (t0) + li t1, 0x31 + sw t1, DDR_CTL_DCMD(t0) +*/ +// Issue MRS Command. Set Reset DLL bit + li t1, 0x31 + sw t1, DDR_CTL_DCMD(t0) + +// Issue Precharge All Banks Command + li t1, 0x32 + sw t1, DDR_CTL_DCMD(t0) + +// Issue Autorefresh Command + li t1, 0x33 + sw t1, DDR_CTL_DCMD(t0) + li t1, 0x33 + sw t1, DDR_CTL_DCMD(t0) + + li t1, 0x200 +3: + bnez t1, 3b + addi t1, -1 + +/* +// Clear DLL Reset by Issuing MRS Command, tCL=5 tWL=4 + li t1, 0x0a530000 + sw t1, DDR_CTL_DMODE_0 (t0) + li t1, 0x31 + sw t1, DDR_CTL_DCMD(t0) +*/ + +// Issue MRS Command w/ DLL Reset bit set to 0 + lw t1, DDR_CTL_DMODE_0 (t0) + li t2, 0xFEFFFFFF // Reset DLL reset bit + and t1, t2 + sw t1, DDR_CTL_DMODE_0 (t0) + li t1, 0x31 + sw t1, DDR_CTL_DCMD(t0) + +/* +// Issue EMRS Command (Enter OCD Calibration) + li t1, 0x380 + sw t1, DDR_CTL_DMODE_0 (t0) + li t1, 0x30 + sw t1, DDR_CTL_DCMD(t0) +*/ + +// Issue EMRS Command (Enter OCD Calibration) 75 Ohm, Full strength Drive, tAL=tRCD-1 + li t1, 0x30 + sw t1, DDR_CTL_DCMD(t0) + +// Issue EMRS Command (Exit OCD Calibration) + lw t1, DDR_CTL_DMODE_0 (t0) + li t2, 0xFC7F // Reset OCD field for exit mode + and t1, t2 + sw t1, DDR_CTL_DMODE_0 (t0) + li t1, 0x30 + sw t1, DDR_CTL_DCMD(t0) + +// Check x8 or x16 DDR + li t1, 0x12345678 + li t3, 0xA0000000 + sw zero, 0(t3) + sw t1, 0(t3) + lw t2, 0(t3) + bne t1, t2, 3f // Failed + nop +// Do the test twice. Just in case random values match... + li t1, 0x87654321 + sw t1, 0(t3) + lw t2, 0(t3) + beq t1, t2, 1f // Clock lines are enabled as needed + nop + +3: +// Memory test failed. Need to re-enable byte lane 1 clock + sw zero, PHY_BYTE_LANE_1_CLOCK_PAD_DISABLE(t0) + li t1, 0x200 +2: + bnez t1, 2b // Delay after enabling clocks + addi t1, -1 + b ddr_x8 + nop + +1: +// Find memory size. a3 keeps the size: 0=256Mb, 1=512Mb, 2=1Gb, 3=2Gb +// Start from 2Gb device + LOADREL(t7, dram_map_table_x8) + lw t1, PHY_BYTE_LANE_1_CLOCK_PAD_DISABLE(t0) + beqz t1, 1f + nop + LOADREL(t7, dram_map_table_x16) + +1: + li a3, 4 +ddr_size: + addi a3, -1 + + li t1, 0x2c // size of dram_map_table element + mult t1, a3 + mflo t2 // dram_map_table offset + add t2, t7 + + lw t1, 0x00(t2) // Row00_0 + sw t1, DDR_CTL_ROW00_0(t0) + + lw t1, 0x04(t2) // Row00_1 + sw t1, DDR_CTL_ROW00_1(t0) + + lw t1, 0x08(t2) // Row01_0 + sw t1, DDR_CTL_ROW01_0(t0) + + lw t1, 0x0C(t2) // Row01_1 + sw t1, DDR_CTL_ROW01_1(t0) + + lw t1, 0x10(t2) // Col00_0 + sw t1, DDR_CTL_COL00_0(t0) + + lw t1, 0x14(t2) // Col00_1 + sw t1, DDR_CTL_COL00_1(t0) + + lw t1, 0x18(t2) // Col01_0 + sw t1, DDR_CTL_COL01_0(t0) + + lw t1, 0x1C(t2) // Col01_1 + sw t1, DDR_CTL_COL01_1(t0) + + lw t1, 0x20(t2) // Bank + sw t1, DDR_CTL_BNK10(t0) + + li t1, 0x0 // CS_Start + sw t1, DDR_CTL_CSST(t0) + + lw t1, 0x24(t2) // CS_End + sw t1, DDR_CTL_CSEND(t0) + + li t1, 0x0 // CS Interleaving CFG + sw t1, DDR_CTL_CNFG(t0) + + lw t3, 0x28(t2) // Dram Size + lw t1, DDR_CTL_GCFG(t0) // GCFG + li t2, 0xFFFFFF00 + and t1, t1, t2 // Mask out Dram Size Fields + or t1, t3, t1 // insert new DRAM Size value + sw t1, DDR_CTL_GCFG(t0) + beqz a3, ddr_speed + nop + +// Check for memory aliasing +// This assumes that the bank interleaving is below address bits 8. + li t1, 8 + li t2, 24 + add t2, a3 // Scan up to maximum memory size + li t3, 0xA0000000 + +check_alias: + li t4, 1 + sll t4, t1 + add t4, t3 + + sw zero, 0(t3) + li t5, -1 + sw t5, 0(t4) + lw t6, 0(t3) + + beq t5, t6, ddr_size + nop + + bne t1, t2, check_alias + addi t1, 1 + +ddr_speed: + li t1, 3 + lw t2, PHY_BYTE_LANE_1_CLOCK_PAD_DISABLE(t0) + beqz t2, 1f + nop + li t1, 2 +1: + blt a3, t1, tRefi_update // If smaller than 1Gb device, keep tRRD same + nop + + lw t1, DDR_CTL_TIM1_0(t0) // Load DDR_CTL_TIM1_0 register + move t2, t1 + srl t2, 20 + andi t2, 0xf + addi t2, 1 // Increment ttRRD by one (software work around for a bug) + sll t2, 20 + li t3, 0xFF0FFFFF + and t1, t3 // Clear tRRD field + or t1, t2 // Insert the new tRRD value + sw t1, DDR_CTL_TIM1_0(t0) // Store DDR_CTL_TIM1_0 register + nop + +tRefi_update: + LOADREL(t2, dram_tRefi_table) + + li t1, 0x4 // size of dram_tRefi_table entry + mult t1, a1 + mflo t1 // dram_tRefi_table offset + add t2, t1 + + lw t1, 0x0(t2) // tRefi + sll t1, 8 + sw t1, DDR_CTL_CLKS(t0) + + LOADREL(t2, dram_tRFC_table) + + li t1, 0x4 // size of dram_tRFC_table entry + mult t1, a1 + mflo t1 // dram_tRefi_table offset + add t2, t1 // Calculate address in the row + + li t1, 0xc // size of dram_tRFC_table row + mult t1, a3 + mflo t1 // dram_tRefi_table offset + add t2, t1 // Calculate address in the column + + lw t3, 0x0(t2) // Load tRFC value + andi t3, 0xFF // Mask tRFC to 8-bits + sll t3, 16 // Move it to bit location [23:16] + + lw t1, DDR_CTL_TIM1_1(t0) // Load DDR_CTL_TIM1_1 register + li t2, 0xFF00FFFF + and t1, t1, t2 // Mask out tRFC Field + or t1, t3, t1 // insert new tRFC value + sw t1, DDR_CTL_TIM1_1(t0) // Write to TIM1_1 register + + SETLEDS1('D','I','N','T') + +/***** UBUS align to MEMC *****/ +align_memc: + +/*** check MEMC clk ratio to set sampling freq *****/ + li t2, MISC_BASE + lw t1, MISC_STRAP_BUS(t2) + + srl t1, MISC_STRAP_BUS_MIPS_PLL_FVCO_SHIFT + andi t1, 0x1f // Mask out strap bits + +#if defined(_BCM96816_) + LOADREL(t2, periph_fix_table) + lw t2, 0(t2) + srl t2, t1 + andi t2, 1 + bne t2, zero, 2f +#endif + + LOADREL(t2, memc_ubus_ratio_table) + + add t2, t1 + lb t1, 0x00(t2) + sll t4,t1,28 // Update Sampling Period Field + +pi_ubus: + li t2, 4048 + li t3, 1 + + sw zero, DDR_CTL_PI_GCF(t0) + li t1, 0x00001c0b // send feedback command every 11 cycles + or t1, t1, t4 + sw t1, DDR_CTL_PI_UBUS_SMPL(t0) + ori t1, 0x80 // trigger stoke signal to latch in new counter value + sw t1, DDR_CTL_PI_UBUS_SMPL(t0) + li t1, 0x00040000 // send new phase value to PLL every 5 cycles + sw t1, DDR_CTL_PI_UBUS_CTL(t0) + li t1, 0x00000001 // enable enable counter that change PLL phase + sw t1, DDR_CTL_PI_GCF(t0) + nop + +#if defined (_BCM96328_) || defined(_BCM96362_) +// Enable PHY MIPS PI + li t1, 0x00130000 + sw t1, DDR_CTL_PI_DSL_MIPS_CTL(t0) + nop +#endif + +1: + lw t4, DDR_CTL_PI_UBUS_SMPL(t0) // Read a sample value. + srl t4, 16 // The sample is in the upper 16 bits. + + andi t4, t4, 0x22 // Look at the 2 outermost bits; if the LSB is 0 and the MSB is 1, + beq t4, 0x20, 2f // then there is an edge somewhere in the sample. + nop + lw t5, DDR_CTL_PI_UBUS_CTL(t0) + and t5, 0xffff0000 + or t5, t3 + or t5, (1<<14) // move phase in positive direction + sw t5, DDR_CTL_PI_UBUS_CTL(t0) + nop + lw t5, DDR_CTL_PI_UBUS_CTL(t0) // Delay before reading another sample. + add t3, 1 + bne t2, t3, 1b + nop + + SETLEDS1('U','A','S','Y') + SETLEDS1('L','A','S','Y') + SETLEDS1('M','A','S','Y') + b run_async // failed to set sync mode + nop + +2: +/*** check MIPS clk ratio *****/ + li t4, 0xff410010 + li t2, MISC_BASE + lw t1, MISC_STRAP_BUS(t2) + + srl t1, MISC_STRAP_BUS_MIPS_PLL_FVCO_SHIFT + andi t1, 0x1f // Mask out strap bits + + b _mips_align_2_ubus // none of the above means it is either 1/1 or 2/1 + nop + + +_mips_align_2_ubus: + +/***** MIPS align to UBUS *****/ + li t1, 0xff410000 + + li t2, 0x00040000 // update PLL phase value every 5 MC cycles + sw t2, DDR_CTL_PI_MIPS_CTL(t0) + + li t2, 0xc0001c03 // force update on mclk_period + sw t2, 0x40(t1) + li t2, 0x80001c83 + sw t2, 0x40(t1) + + lw t2, DDR_CTL_PI_MIPS_CTL(t0) // add delay + li t3, 1 + +1: lw t4, 0x40(t1) // Read a sample value. + srl t4, 16 // The sample is in the upper 16 bits. + + andi t4, t4, 0x22 // Look at the 2 outermost bits, if the LSB is 0 and the MSB is 1, + beq t4, 0x20, 2f // then there is an edge somewhere in the sample. + nop + lw t5, DDR_CTL_PI_MIPS_CTL(t0) + and t5, 0xffff0000 + or t5, t3 + or t5, (1<<14) // move phase in positive direction + sw t5, DDR_CTL_PI_MIPS_CTL(t0) + nop + lw t5, DDR_CTL_PI_MIPS_CTL(t0) // Delay before reading another sample. + add t3, 1 + bne t2, t3, 1b + nop + + SETLEDS1('U','A','S','Y') + SETLEDS1('L','A','S','Y') + SETLEDS1('M','A','S','Y') + b run_async // failed to set sync mode + nop +2: + // Success + lw t2, DDR_CTL_PI_MIPS_CTL(t0) // Turn on auto-PI mode. + or t2, (1 << 20) // PI_UBUS_CTL_Hw_Cntr_En = 1 + sw t2, DDR_CTL_PI_MIPS_CTL(t0) + + /**----- Enable DDR/UBUS and DDR/LMB sync mode ------------------**/ + /*** only MIPS in sync mode for these strap options */ + + li t2, MISC_BASE + lw t1, MISC_STRAP_BUS(t2) + + srl t1, MISC_STRAP_BUS_MIPS_PLL_FVCO_SHIFT + andi t1, 0x1f // Mask out strap bits + + li t3, 0 // Used to keep MC/MIPS and MC/UBUS sync/async mode + + LOADREL(t2, dram_sync_table) + + lw t4, 0x0(t2) // Ubus Sync vector + lw t5, 0x4(t2) // Lmb Sync vector + +#if defined (_96816_) + move t4, t6 +#endif + lw t6, 0x8(t2) // Mips Sync vector + + srl t4, t1 // Get the ubus sync flag + srl t5, t1 // Get the lmb sync flag + srl t6, t1 // Get the mips sync flag + andi t4, 1 // Mask out other bits + andi t5, 1 // Mask out other bits + andi t6, 1 // Mask out other bits + + li t2, 1 + bne t4, t2, ubus_async // 1f below. If ubus is not sync, lmb can't be in sync + nop // Go to ubus_async (1f) + + // Ubus Sync Mode. Turn on Ubus Clock tracking + lw t2, DDR_CTL_PI_UBUS_CTL(t0) // Turn on auto-PI mode. + or t2, (1 << 20) // PI_UBUS_CTL_Hw_Cntr_En = 1 + sw t2, DDR_CTL_PI_UBUS_CTL(t0) + + // Is LMB Sync as well? + li t2, 1 + beq t5, t2, memc_all_sync // If both ubus and lmb are sync, go to memc_all_sync + nop + +memc_ubus_sync: +#if UBUS_SYNC_ENABLE +// set MC/UBUS to SYNC + li t3, 0x4 + SETLEDS1('L','A','S','Y') + SETLEDS1('U','S','Y','N') +#else +// set MC/UBUS to ASYNC + li t3, 0xc + SETLEDS1('L','A','S','Y') + SETLEDS1('U','A','S','Y') +#endif + + b update_sync_mode + nop + +memc_all_sync: +#if LMB_SYNC_ENABLE +// set MC/MIPS to SYNC + nop + SETLEDS1('L','S','Y','N') +#else +// set MC/MIPS to ASYNC + li t1, 0x4 + or t3, t1 + SETLEDS1('L','A','S','Y') +#endif +#if UBUS_SYNC_ENABLE +// set MC/UBUS to SYNC + nop + SETLEDS1('U','S','Y','N') +#else +// set MC/UBUS to ASYNC + li t1, 0x8 + or t3, t1 + SETLEDS1('U','A','S','Y') +#endif + +update_sync_mode: + li t1, MISC_BASE + sw t3, MISC_MEMC_CONTROL(t1) + b 2f + nop +1: +ubus_async: + SETLEDS1('L','A','S','Y') + SETLEDS1('U','A','S','Y') + +2: + // Can Mips run in sync mode? If not, skip all below + beq t6, zero, run_async + nop + +#if MIPS_SYNC_ENABLE + /**----- Clear MIPS Async mode bit ------------------------------**/ + mfc0 t1, C0_BCM_CONFIG, 5 + and t1, ~(0x1 << 28) + mtc0 t1, C0_BCM_CONFIG, 5 + + SETLEDS1('M','S','Y','N') +#else + SETLEDS1('M','A','S','Y') +#endif + +3: + /**----- Enable RAC and LMB -------------------------------------**/ + li t0, MIPS_BASE + lw t2, MIPS_LMB_CR(t0) +#if LMB_ENABLE + or t2, LMB_EN // Enable LMB + SETLEDS1('L','M','B','E') +#else + SETLEDS1('L','M','B','D') +#endif + sw t2, MIPS_LMB_CR(t0) + + li t2, 0xFFF << RAC_UPB_SHFT // Enable prefetch for RAM address range up to 256MB + sw t2, MIPS_RAC_ARR(t0) + + lw t2, MIPS_RAC_CR0(t0) + or t2, (RAC_C_INV | RAC_I | RAC_PF_I) + sw t2, MIPS_RAC_CR0(t0) + + lw t2, MIPS_RAC_CR1(t0) + or t2, (RAC_C_INV | RAC_I | RAC_PF_I) + sw t2, MIPS_RAC_CR1(t0) + +run_async: + /**----- Enable branch prediction and non-blocking data cache ---**/ + mfc0 t1, C0_BCM_CONFIG + and t1, ~CP0_BCM_CFG_BTHD + or t1, CP0_BCM_CFG_NBK + or t1, CP0_BCM_CFG_CLF + mtc0 t1, C0_BCM_CONFIG + +#if DDR_TEST +####################################### +# Run test on DRAM using Test Engine # +####################################### +#define BACKGND_MODE_DATA 0x0 +#define BACKGND_MODE_LFSR 0x400 +#define BACKGND_MODE_PRBS 0x800 +#define BACKGND_MODE_NOT_PRBS 0xc00 +#define BACKGND_MODE_PAT 0x1000 +#define BACKGND_MODE_NOT_PAT 0x1400 + +#define VICT_MODE_PRBS 0 +#define VICT_MODE_NOT_PRBS 0x100 +#define VICT_MODE_PAT 0x200 +#define VICT_MODE_NOT_PAT 0x300 + +#define VICT_ENABLE 0x8000 +#define VICT_SWEEP_ENABLE 0x10000 +#define VICT_COUNT 0x0 + +#define PRBS_ORDER(x) ((x & 0x3) << 13) + +#define TEST_COUNT 0x1000 +#define TEST_ADDR 0x0 +#define TEST_ADDR_UPDT 0x1 +#define TEST_PATTERN0 0x5555 +#define TEST_PATTERN1 0xaaaa +#define TEST_PATTERN (TEST_PATTERN1 << 16 | TEST_PATTERN0) + +#define TEST_ENABLE 0x1 +#define TEST_DONE 0x2 +#define TEST_ERROR 0x4 +#define TEST_WRITE 0x10 +#define TEST_READ 0x0 + +#define BACKGND_DATA0 0xa5a5a5a5 +#define BACKGND_DATA1 0x5a5a5a5a +#define BACKGND_DATA2 0xa5a5a5a5 +#define BACKGND_DATA3 0x5a5a5a5a + +#define TEST_DATA0 0x02468ace +#define TEST_DATA1 0x13579bdf +#define TEST_DATA2 0x33cccc33 +#define TEST_DATA3 0x55aaaa55 + +/***** Load DDR Base *************************************/ + li t0, DDR_BASE + li t1, BACKGND_DATA0 + sw t1, DDR_CTL_TEST_DATA0(t0) + li t1, BACKGND_DATA1 + sw t1, DDR_CTL_TEST_DATA1(t0) + li t1, BACKGND_DATA2 + sw t1, DDR_CTL_TEST_DATA2(t0) + li t1, BACKGND_DATA3 + sw t1, DDR_CTL_TEST_DATA3(t0) + li t1, TEST_COUNT + li t2, VICT_COUNT + or t1, t2 # add victim count value + sw t1, DDR_CTL_TEST_COUNT(t0) + li t1, TEST_ADDR + sw t1, DDR_CTL_TEST_ADDR(t0) + li t1, TEST_ADDR_UPDT + sw t1, DDR_CTL_TEST_ADDR_UPDT(t0) + li t1, TEST_PATTERN + sw t1, DDR_CTL_TEST_PAT(t0) + +# Write a background pattern first + li t1, BACKGND_MODE_DATA + li t2, TEST_WRITE + or t1, t2 + li t2, TEST_ENABLE + or t1, t2 + sw t1, DDR_CTL_TEST_CFG1(t0) + + li t2, 0x2 + li t3, MISC_BASE + + li t5, 0x10000 +2: li t1, 0x100 +1: addiu t1, -1 + bnez t1, 1b + nop + + lw t4, MISC_MEMC_CONTROL(t3) + and t4, 0x2 + beq t4, t2, backgnd_write_done + nop + addiu t5, -1 + bnez t5, 2b + nop + +# Background write operation is finished + +backgnd_write_done: + li t1, TEST_DATA0 + sw t1, DDR_CTL_TEST_DATA0(t0) + li t1, TEST_DATA1 + sw t1, DDR_CTL_TEST_DATA1(t0) + li t1, TEST_DATA2 + sw t1, DDR_CTL_TEST_DATA2(t0) + li t1, TEST_DATA3 + sw t1, DDR_CTL_TEST_DATA3(t0) + li t1, TEST_COUNT + li t2, VICT_COUNT + or t1, t2 # add victim count value + sw t1, DDR_CTL_TEST_COUNT(t0) + li t1, TEST_ADDR + sw t1, DDR_CTL_TEST_ADDR(t0) + li t1, TEST_ADDR_UPDT + sw t1, DDR_CTL_TEST_ADDR_UPDT(t0) + li t1, TEST_PATTERN + sw t1, DDR_CTL_TEST_PAT(t0) + +# li t1, BACKGND_MODE_DATA +# li t1, BACKGND_MODE_PAT +# li t2, VICT_MODE_NOT_PAT + li t1, BACKGND_MODE_PRBS + li t2, VICT_MODE_NOT_PRBS + + or t1, t2 + li t2, VICT_ENABLE + or t1, t2 + li t2, VICT_SWEEP_ENABLE + or t1, t2 + li t2, PRBS_ORDER(0) + or t1, t2 + li t2, TEST_WRITE + or t1, t2 + li t2, TEST_ENABLE + or t1, t2 + sw t1, DDR_CTL_TEST_CFG1(t0) + + li t2, 0x2 + li t3, MISC_BASE + + li t5, 0x10000 +2: li t1, 0x100 +1: addiu t1, -1 + bnez t1, 1b + nop + + lw t4, MISC_MEMC_CONTROL(t3) + and t4, 0x2 + beq t4, t2, test_write_done + nop + addiu t5, -1 + bnez t5, 2b + nop + +# Test write operation is finished + +test_write_done: + li t1, TEST_DATA0 + sw t1, DDR_CTL_TEST_DATA0(t0) + li t1, TEST_DATA1 + sw t1, DDR_CTL_TEST_DATA1(t0) + li t1, TEST_DATA2 + sw t1, DDR_CTL_TEST_DATA2(t0) + li t1, TEST_DATA3 + sw t1, DDR_CTL_TEST_DATA3(t0) + li t1, TEST_COUNT + li t2, VICT_COUNT + or t1, t2 # add victim count value + sw t1, DDR_CTL_TEST_COUNT(t0) + li t1, TEST_ADDR + sw t1, DDR_CTL_TEST_ADDR(t0) + li t1, TEST_ADDR_UPDT + sw t1, DDR_CTL_TEST_ADDR_UPDT(t0) + li t1, TEST_PATTERN + sw t1, DDR_CTL_TEST_PAT(t0) + +# li t1, BACKGND_MODE_DATA +# li t1, BACKGND_MODE_PAT +# li t2, VICT_MODE_NOT_PAT + li t1, BACKGND_MODE_PRBS + li t2, VICT_MODE_NOT_PRBS + + or t1, t2 + li t2, VICT_ENABLE + or t1, t2 + li t2, VICT_SWEEP_ENABLE + or t1, t2 + li t2, PRBS_ORDER(0) + or t1, t2 + li t2, TEST_READ + or t1, t2 + li t2, TEST_ENABLE + or t1, t2 + sw t1, DDR_CTL_TEST_CFG1(t0) + + li t3, MISC_BASE + li t2, 0x2 + + li t5, 0x10000 +2: li t1, 0x100 +1: addiu t1, -1 + bnez t1, 1b + nop + + lw t4, MISC_MEMC_CONTROL(t3) + and t4, 0x2 + beq t4, t2, test_read_done + nop + addiu t5, -1 + bnez t5, 2b + nop + +# Test read operation is finished + +test_read_done: + lw t1, DDR_CTL_TEST_CFG1(t0) + srl t1, 2 + and t1, 1 + beq t1, zero, test_passed + nop + +test_failed: + SETLEDS1('F','A','I','L') + b 1f + nop +test_passed: + SETLEDS1('P','A','S','S') +1: + SETLEDS1('-','-','-', '-') +#endif + + move ra,s0 + j ra + nop + + .set reorder + +END(board_draminit) + +/* ********************************************************************* + * BOARD_SETLEDS(x) + * + * Set LEDs for boot-time progress indication. Not used if + * the board does not have progress LEDs. This routine + * must not call any other routines, since it may be invoked + * either from KSEG0 or KSEG1 and it may be invoked + * whether or not the icache is operational. + * + * Input parameters: + * a0 - LED value (8 bits per character, 4 characters) + * + * Return value: + * nothing + * + * Registers used: + * t7,t8,t9 + ********************************************************************* */ +LEAF(board_setleds) +#if 1 + li t7, UART_BASE + li t8, TXFIFOEMT + +1: lh t9, UART0INTSTAT(t7) + and t9, t8 + bne t9, t8, 1b + + srl t8, a0, 24 + sb t8, UART0DATA(t7) + srl t8, a0, 16 + sb t8, UART0DATA(t7) + srl t8, a0, 8 + sb t8, UART0DATA(t7) + sb a0, UART0DATA(t7) + li a0, '\r' + sb a0, UART0DATA(t7) + li a0, '\n' + sb a0, UART0DATA(t7) +#endif + j ra +END(board_setleds) + +/* ********************************************************************* + * BCMCORE_TP1_SWITCH() + * + * Check if the thread switch is required. If we are already + * running on thread 1 this function will do nothing and just return + * If we are running on thread 0 this function will take thread 1 + * out of reset and put thread 0 to sleep waiting for singnal from + * thread 1. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ +LEAF(bcmcore_tp1_switch) + +#if defined(_BCM96328_) + li t1, OTP_BASE + addi t1, OTP_USER_BITS + addi t1, 0xc - ((OTP_TP1_DISABLE_BIT / 8) & ~3) + lw t0, 0(t1) + andi t0, 1 << (OTP_TP1_DISABLE_BIT % 32) + beqz t0, 1f + j ra +1: +#endif + mfc0 t1, C0_BCM_CONFIG, 3 + li t2, CP0_CMT_TPID + and t1, t2 + bnez t1, tp1 # Already running on thread 1 + +# Start TP1 +# Set boot address for TP1 + li t1, MIPS_BASE + li t2, 0x98000000 | ENABLE_ALT_BV + sw t2, MIPS_TP1_ALT_BV(t1) + +# Set a flag so we can wait for TP1 to catch up + li t1, 0x0 + mtc0 t1, $31 # CO_DESAVE + +# Take TP1 out of reset + mfc0 t1, C0_BCM_CONFIG, 2 + or t1, CP0_CMT_RSTSE + mtc0 t1, C0_BCM_CONFIG, 2 + + /* wait until second thread catches up with the first */ +waittp1: + mfc0 t0, $31 # CO_DESAVE + beqz t0, waittp1 + + li t0, THREAD_NUM_ADDRESS + FIXUP(t0) + lw t0, 0(t0) + li t1, 1 + bne t0, t1, return # Linux will run on TP0, continue running bootloader + +# Voice will run on TP0. Set it up and put it to sleep + + # enable interrupts and enable SW IRQ 0 + li t0, M_SR_IE | M_SR_IBIT1 + mtc0 t0, C0_SR + + # Set up to use alternate exception vector 0x80000200 + li t0, M_CAUSE_IV + mtc0 t0, C0_CAUSE + + mfc0 t1, C0_BCM_CONFIG, 1 + # set all ints except IRQ1 to TP1 and cross over SW IRQ 0 + or t1, (CP0_CMT_XIR_4 | CP0_CMT_XIR_3 | CP0_CMT_XIR_2 | CP0_CMT_XIR_0 | CP0_CMT_SIR_0 | CP0_CMT_NMIR_TP1) + mtc0 t1, C0_BCM_CONFIG, 1 + + mfc0 t1, C0_BCM_CONFIG, 2 + # Set debug on TP1, give priority to TP0, and + # set TLB exception serialization to ignore SCNT value in CP0 reg22 sel 4 + and t1, ~CP0_CMT_TPS_MASK; + or t1, (CP0_CMT_DSU_TP1 | CP0_CMT_PRIO_TP0 | (1 << CP0_CMT_TPS_SHFT)) + mtc0 t1, C0_BCM_CONFIG, 2 + + # Enable Data RAC on TP0 + li t1, MIPS_BASE + lw t2, MIPS_RAC_CR0(t1) + or t2, (RAC_D | RAC_PF_D) + sw t2, MIPS_RAC_CR0(t1) + +2: + b wait_for_wake + +tp1: +# Running on TP1.... +# First signal to TP0 that TP1 is up + li t1, 0x1 + mtc0 t1, $31 # CO_DESAVE + + li t0, THREAD_NUM_ADDRESS + FIXUP(t0) + lw t0, 0(t0) + li t1, 1 + beq t0, t1, return # Linux will run on TP1, continue running bootloader + +# Voice will run on TP1. Set it up and put it to sleep + + # enable interrupts and enable SW IRQ 0 + li t0, M_SR_IE | M_SR_IBIT1 + mtc0 t0, C0_SR + + # Set up to use alternate exception vector 0x80000200 + li t0, M_CAUSE_IV + mtc0 t0, C0_CAUSE + + mfc0 t1, C0_BCM_CONFIG, 1 + # set IRQ1 to TP1 and cross over SW IRQ 0 + or t1, (CP0_CMT_XIR_1 | CP0_CMT_SIR_0 | CP0_CMT_NMIR_TP0) + mtc0 t1, C0_BCM_CONFIG, 1 + + mfc0 t1, C0_BCM_CONFIG, 2 + # Set debug on TP0, give priority to TP1, and + # set TLB exception serialization to ignore SCNT value in CP0 reg22 sel 4 + and t1, ~CP0_CMT_TPS_MASK; + or t1, (CP0_CMT_PRIO_TP1 | (1 << CP0_CMT_TPS_SHFT)) + mtc0 t1, C0_BCM_CONFIG, 2 + + # Enable Data RAC on TP1 + li t1, MIPS_BASE + lw t2, MIPS_RAC_CR1(t1) + or t2, (RAC_D | RAC_PF_D) + sw t2, MIPS_RAC_CR1(t1) + b 2b + +return: + j ra + +END(bcmcore_tp1_switch) + +# align this code to cache line. NAND flash is not memory mapped after system boots +# so when we are signaling to the second TP to wake we need +# jal instruction to be in cache + .align 4 +LEAF(wait_for_wake) + sync + wait # wait for interrupt + jal t8 # jump to entry point +END(wait_for_wake) diff --git a/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm63xx_main.c b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm63xx_main.c new file mode 100755 index 0000000..201d6d8 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/bcm63xx_main.c @@ -0,0 +1,649 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Main Module File: bcm63xxBoot_main.c + * + * This module contains the main "C" routine for CFE bootstrap loader + * and decompressor to decompress the real CFE to ram and jump over. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * Revised: seanl + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_timer.h" + +#include "env_subr.h" +#include "ui_command.h" +#include "cfe_mem.h" +#include "cfe.h" + +#include "bsp_config.h" +#include "bcm_hwdefs.h" +#include "bcm_map.h" + +#include "exception.h" + +#include "segtable.h" + +#include "initdata.h" + +#if defined(_BCM96368_) || defined(_BCM96362_) || defined(_BCM96328_) || defined(_BCM96816_) +#include "flash_api.h" +#include "jffs2.h" +#endif + +#if CFG_PCI +#include "pcivar.h" +#endif + + + +int cfe_size_ram(void); +inline static int is_aliased(int max_bits) __attribute__((always_inline)); + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#ifndef CFG_STACK_SIZE +#define STACK_SIZE 8192 +#else +#define STACK_SIZE ((CFG_STACK_SIZE+1023) & ~1023) +#endif + +inline static int is_aliased(int max_bits) +{ + volatile uint32 *mem_base; + volatile uint32 *test_ptr; + uint32 tmp; + int bit; + int res = 0; + + mem_base = (uint32*)DRAM_BASE_NOCACHE; + + *mem_base = 0; + + for (bit = 8; bit < max_bits; bit++) { + test_ptr = (uint32*)((uint32)mem_base | 1 << bit); + /* ram may contain useful data, save location before modifying */ + tmp = *test_ptr; + *test_ptr = -1; + if (*mem_base == *test_ptr) { + *test_ptr = tmp; + res = 1; + break; + } + *test_ptr = tmp; + } + return res; +} + +#define MEMC_MAX_ROWS 14 + +int cfe_size_ram(void) +{ +#if !(defined(_BCM96328_) || defined (_BCM96362_) || defined(_BCM96816_)) + uint32 col_bits, row_bits, bus_bits, bank_bits; + uint32 size; + + /* Bus width is configured during early boot */ + if (((MEMC->Config & MEMC_WIDTH_MASK) >> MEMC_WIDTH_SHFT) == MEMC_32BIT_BUS) + bus_bits = 2; + else + bus_bits = 1; + + bank_bits = 2; + /* Start from setting to the lowest possible configuration */ + col_bits = 8; + row_bits = 11; + + MEMC->Config &= ~MEMC_COL_MASK; + MEMC->Config |= ((col_bits - 8) << MEMC_COL_SHFT); + + MEMC->Config &= ~MEMC_ROW_MASK; + MEMC->Config |= ((row_bits - 11) << MEMC_ROW_SHFT); + + /* Determine number of rows */ + for (row_bits = 12; row_bits <= MEMC_MAX_ROWS; row_bits++) { + MEMC->Config &= ~MEMC_ROW_MASK; + MEMC->Config |= ((row_bits - 11) << MEMC_ROW_SHFT); + /* check if this address bit is valid */ + if (is_aliased (col_bits + row_bits + bus_bits + bank_bits)) + break; + } + row_bits -= 1; + MEMC->Config &= ~MEMC_ROW_MASK; + MEMC->Config |= ((row_bits - 11) << MEMC_ROW_SHFT); + + /* Determine number of columns */ + for (col_bits = 9; col_bits <= 11; col_bits++) { + MEMC->Config &= ~MEMC_COL_MASK; + MEMC->Config |= ((col_bits - 8) << MEMC_COL_SHFT); + /* check if this address bit is valid */ + if (is_aliased (col_bits + row_bits + bus_bits + bank_bits)) + break; + } + col_bits -= 1; + MEMC->Config &= ~MEMC_COL_MASK; + MEMC->Config |= ((col_bits - 8) << MEMC_COL_SHFT); + + /* Compute memory size in MB */ + size = 1 << (bus_bits + col_bits + row_bits + bank_bits - 20); + + return size; +#else + return (DDR->CSEND << 24); +#endif +} + +// fake functions for not to modifying init_mips.S +void _exc_entry(void); +void cfe_command_restart(void); +void cfe_doxreq(void); + +void _exc_entry(void) +{ +} + +void cfe_command_restart(void) +{ +} +void cfe_doxreq(void) +{ +} + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +void cfe_main(int,int); + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +void cfe_ledstr(const char *leds) +{ +} + +#if !defined(CONFIG_BRCM_IKOS) +extern void _binArrayStart(void); +extern void _binArrayEnd(void); +extern int decompressLZMA(unsigned char *in, unsigned insize, unsigned char *out, unsigned outsize); + +#if (INC_NAND_FLASH_DRIVER==1) || (INC_SPI_PROG_NAND==1) +#define je16_to_cpu(x) ((x).v16) +#define je32_to_cpu(x) ((x).v32) +extern void rom_nand_flash_init(void); +extern int nand_flash_get_sector_size(unsigned short sector); +extern int nand_flash_get_numsectors(void); +extern int nand_flash_read_buf(unsigned short blk, int offset, + unsigned char *buffer, int len); +extern void board_setleds(unsigned long); + +void *lib_memcpy(void *dest,const void *src,size_t cnt) +{ + unsigned char *d; + const unsigned char *s; + + d = (unsigned char *) dest; + s = (const unsigned char *) src; + + while (cnt) { + *d++ = *s++; + cnt--; + } + + return dest; +} + +int lib_memcmp(const void *dest,const void *src,size_t cnt) +{ + const unsigned char *d; + const unsigned char *s; + + d = (const unsigned char *) dest; + s = (const unsigned char *) src; + + while (cnt) { + if (*d < *s) return -1; + if (*d > *s) return 1; + d++; s++; cnt--; + } + + return 0; +} + +#if (INC_NAND_FLASH_DRIVER==1) +/* Find uncompressed file cferam.bin on the JFFS2 file system, load it into + * memory and jump to its entry point function. + */ +char g_fname[] = NAND_CFE_RAM_NAME; +int g_fname_actual_len = sizeof(g_fname) - 1; +int g_fname_cmp_len = sizeof(g_fname) - 4; /* last three are digits */ +static void bootImageFromNand(void) +{ + const unsigned long bv_invalid = 0xfffffff; + const int max_not_jffs2 = 10; + + struct rootfs_info + { + int rootfs; + int start_blk; + int end_blk; + unsigned long boot_val; + unsigned long ino; + } rfs_info[2], *prfs_info[2], *rfsi; + + unsigned char *buf = (unsigned char *) mem_heapstart; + unsigned long version = 0; + struct jffs2_raw_dirent *pdir; + struct jffs2_raw_inode *pino; + unsigned char *p; + int i, j, k, done, not_jffs2; + int num_blks; + int len; + int boot_prev; + PNVRAM_DATA nd; + static int err0=0, err1=1; + + rom_nand_flash_init(); + num_blks = nand_flash_get_numsectors(); + len = nand_flash_get_sector_size(0); + nd = (PNVRAM_DATA) (buf + len); + + NAND->NandNandBootConfig = NBC_AUTO_DEV_ID_CFG | 0x101; + NAND->NandCsNandXor = 1; + + memcpy((unsigned char *) nd, (unsigned char *) + FLASH_BASE + NVRAM_DATA_OFFSET, sizeof(NVRAM_DATA)); + + NAND->NandNandBootConfig = NBC_AUTO_DEV_ID_CFG | 0x2; + NAND->NandCsNandXor = 0; + + /* Look at config to determine whether to boot current or previous image.*/ + for( i = 0, p = (unsigned char *) nd->szBootline, boot_prev = 0; + i < NVRAM_BOOTLINE_LEN; i++, p++ ) + { + if( p[0] == ' ' && p[1] == 'p' && p[2] == '=' ) + { + boot_prev = p[3] - '0'; + if( boot_prev != 0 && boot_prev != 1 ) + boot_prev = '0'; + break; + } + } + + /* Find the CFE ram inode entry point for both root file systems. */ + board_setleds((boot_prev == 0) ? 0x4e414e30 : 0x4e414e31); + for( k = 0, rfsi = rfs_info; k < 2; k++, rfsi++ ) + { + version = 0; + not_jffs2 = 0; + rfsi->rootfs = k + NP_ROOTFS_1; + rfsi->boot_val = bv_invalid; + if( nd->ulNandPartOfsKb[rfsi->rootfs] > 0 && + nd->ulNandPartOfsKb[rfsi->rootfs] < ((num_blks * len) / 1024)) + { + rfsi->start_blk = nd->ulNandPartOfsKb[rfsi->rootfs] / (len/1024); + rfsi->end_blk = rfsi->start_blk + + (nd->ulNandPartSizeKb[rfsi->rootfs] / (len / 1024)); + } + else + rfsi->start_blk = rfsi->end_blk = 0; + + if( rfsi->start_blk == 0 || rfsi->start_blk >= rfsi->end_blk || + rfsi->start_blk >= num_blks || rfsi->end_blk >= num_blks ) + { + /* NVRAM_DATA fields for this rootfs are not valid. */ + if( k == 0 ) + { + /* Skip this rootfs. */ + board_setleds(0x4e414e36); + continue; + } + + if( rfs_info[0].boot_val == bv_invalid ) + { + /* File system info cannot be found for either rootfs. + * NVRAM_DATA may not be set. Use default values. + */ + board_setleds(0x4e414e37); + rfsi = rfs_info; + rfsi->start_blk = 1; + rfsi->end_blk = num_blks; + } + } + + /* Find the directory entry. */ + for( i = rfsi->start_blk, done = 0; i < rfsi->end_blk && done == 0; i++ ) + { + /* This loop sequentially reads a NAND flash block into memory and + * processes it. + */ + if( nand_flash_read_buf(i, 0, buf, len) > 0 ) + { + /* This loop reads inodes in a block. */ + p = buf; + while( p < buf + len ) + { + pdir = (struct jffs2_raw_dirent *) p; + if( je16_to_cpu(pdir->magic) == JFFS2_MAGIC_BITMASK ) + { + if( je16_to_cpu(pdir->nodetype) == + JFFS2_NODETYPE_DIRENT && + g_fname_actual_len == pdir->nsize && + !memcmp(g_fname, pdir->name, g_fname_cmp_len) ) + { + /* The desired directory was found. */ + if( je32_to_cpu(pdir->version) > version ) + { + if( (rfsi->ino = je32_to_cpu(pdir->ino)) != 0 ) + { + unsigned char *fname = + pdir->name + g_fname_cmp_len; + rfsi->boot_val = + ((fname[0] - '0') * 100) + + ((fname[1] - '0') * 10) + + ((fname[2] - '0') * 1); + version = je32_to_cpu(pdir->version); + + board_setleds(0x42540000 + + ((unsigned long) fname[1] << 8) + + (unsigned long) fname[2]); + + /* Setting 'done = 1' assumes there is only + * one version of the directory entry. This + * may not be correct if the file is + * updated after it was initially flashed. + * + * TBD. Look for a higher version of the + * directory entry without searching the + * entire flash part. + */ + done = 1; + break; + } + } + } + + p += (je32_to_cpu(pdir->totlen) + 0x03) & ~0x03; + not_jffs2 = 0; + } + else + { + if( not_jffs2++ > max_not_jffs2 ) + { + /* No JFFS2 magic bitmask for consecutive blocks. + * Assume this partion does not have a file system + * on it. + */ + board_setleds(0x53544F50); + done = 1; + } + break; + } + } + } + else + { + if(!err0) + { + err0=1; + board_setleds(0x45525230); + } + } + } + board_setleds(0x4e414e39); + } + + /* Set the rfs_info to the index to boot from. */ + if( (boot_prev == 0 && rfs_info[0].boot_val > rfs_info[1].boot_val) || + (boot_prev == 1 && rfs_info[0].boot_val < rfs_info[1].boot_val) || + rfs_info[1].boot_val == bv_invalid ) + { + /* Boot from the most recent image. */ + prfs_info[0] = &rfs_info[0]; + prfs_info[1] = &rfs_info[1]; + } + else + { + /* Boot from the previous image. */ + prfs_info[0] = &rfs_info[1]; + prfs_info[1] = &rfs_info[0]; + } + + /* If the directory entry for the desired file, which is the CFE RAM image, + * is found, read it into memory and jump to its entry point function. + * This loop checks for CFE RAM image in two possible rootfs file sytems. + */ + for( k = 0; k < 2; k++ ) + { + unsigned char *pucDest = NULL; + unsigned char *pucEntry = NULL; + long isize = 0; + + board_setleds(0x4e414e33); + rfsi = prfs_info[k]; + if( rfsi->boot_val == bv_invalid ) + continue; + + /* When j == 0, get the first inode to find the entry point address. + * When j == 1, read the file contents into memory. + */ + for( j = 0; j < 2; j++ ) + { + /* This loop sequentially reads a NAND flash block into memory and + * processes it. + */ + for(i = rfsi->start_blk, done = 0; iend_blk && done==0; i++) + { + if( nand_flash_read_buf(i, 0, buf, len) > 0 ) + { + /* This loop reads inodes in a block. */ + p = buf; + while( p < buf + len ) + { + /* Verify the first short word is the JFFS2 magic + * number. + */ + pino = (struct jffs2_raw_inode *) p; + if( je16_to_cpu(pino->magic) == JFFS2_MAGIC_BITMASK ) + { + if( je16_to_cpu(pino->nodetype) == + JFFS2_NODETYPE_INODE && + je32_to_cpu(pino->ino) == rfsi->ino ) + { + unsigned long size = je32_to_cpu(pino->dsize); + unsigned long ofs = je32_to_cpu(pino->offset); + + if( size ) + { + /* A node of the CFE RAM file was found + * with data. */ + if( pucDest == NULL ) + { + /* The entry point and copy destination + * addresses have not been obtained. + * If this is the first node of the CFE + * RAM file, obtain this information. + */ + if( ofs == 0 ) + { + /* The first 12 bytes contain a + * header. The first word is the + * entry point address. + */ + pucEntry = (unsigned char *) + *(unsigned long *) pino->data; + pucDest = pucEntry - 12; + isize = je32_to_cpu(pino->isize); + done = 1; + board_setleds(0x52465330 | + rfsi->rootfs); + break; + } + } + else + { + /* Copy the image to memory. Stop when + * the entire image has been copied. + */ + memcpy(pucDest+ofs, pino->data, size); + if( (isize -= size) <= 0 ) + { + done = 1; + break; + } + } + } + } + + /* Skip to the next inode entry. */ + p += (je32_to_cpu(pino->totlen) + 0x03) & ~0x03; + } + else + break; + } + } + else + { + if(!err1) + { + err1=1; + board_setleds(0x45525231); + } + } + } + } + + if( pucEntry && isize <= 0 ) + { + board_setleds(0x4e414e35); + + /* Save the rootfs partition that the CFE RAM image boots from + * at the memory location before the CFE RAM load address. The + * CFE RAM image uses this value to determine the partition to + * flash a new rootfs to. + */ + *(pucEntry - 1) = (unsigned char) rfsi->rootfs; + + cfe_launch((unsigned long) pucEntry); // never return... + } + board_setleds(0x4e414e38); + } + + /* Error occurred. */ + board_setleds(0x44494530); + while(1); +} +#endif +#endif + +/* ********************************************************************* + * cfe_main(a,b) + * + * It's gotta start somewhere. + * Input parameters: + * a,b - not used + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_main(int a,int b) +{ + unsigned char *pucSrc; + unsigned char *pucDst; + unsigned int *entryPoint; + unsigned int binArrayStart = (unsigned int) _binArrayStart; + unsigned int binArrayEnd = (unsigned int) _binArrayEnd; + unsigned int dataLen = binArrayEnd - binArrayStart - 4; + int ret; + + KMEMINIT((unsigned char *) (uint32_t) mem_heapstart, + ((CFG_HEAP_SIZE)*1024)); + +#if (INC_NAND_FLASH_DRIVER==1) && (defined(_BCM96816_) || defined(_BCM96362_) || defined(_BCM96328_)) + if( ((MISC->miscStrapBus & MISC_STRAP_BUS_BOOT_SEL_MASK) >> + MISC_STRAP_BUS_BOOT_SEL_SHIFT) == MISC_STRAP_BUS_BOOT_NAND ) + { + bootImageFromNand(); /* Will not return. */ + } +#elif (INC_NAND_FLASH_DRIVER==1) && defined(_BCM96368_) + if( ((GPIO->StrapBus & MISC_STRAP_BUS_BOOT_SEL_MASK) >> + MISC_STRAP_BUS_BOOT_SEL_SHIFT) == MISC_STRAP_BUS_BOOT_NAND ) + { + bootImageFromNand(); /* Will not return. */ + } +#endif + + entryPoint = (unsigned int*) binArrayStart; + pucSrc = (unsigned char *) (binArrayStart + 4); + + pucDst = (unsigned char *) *entryPoint; + ret = decompressLZMA((unsigned char*)pucSrc, + (unsigned int)dataLen, + (unsigned char *) pucDst, + 23*1024*1024); + + if (ret != 0) + while (1); // if not decompressed ok, loop for EJTAG + + cfe_launch((unsigned long) pucDst); // never return... +} +#else +/* 0x694b6f31 (iKo1) is replaced with actual address during the build process.*/ +unsigned long cfeRamStartAddr=0x694b6f31; +void cfe_main(int a,int b) +{ + cfe_size_ram(); + cfe_launch(cfeRamStartAddr); // never return... +} +#endif + diff --git a/cfe/cfe/arch/mips/board/bcm63xx_rom/src/memtest.c b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/memtest.c new file mode 100755 index 0000000..310fb40 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/memtest.c @@ -0,0 +1,1031 @@ +/* + *----------------------------------------------------------------------------* + * Collection of Memory Tests. + *----------------------------------------------------------------------------* + */ + +// +// NOTE: Blatant inlining ... (not sure whether caller supports EABI calls). +// WARNING CFE: Must NOT use function calls !!! +// +#define _ALWAYS_INLINE_ __attribute__((always_inline)) +#define _INLINE_ inline static + +typedef enum memTestResult { + MEMTEST_FAILURE = 0, + MEMTEST_SUCCESS, + MEMTEST_ERROR, +} MemTestResult_t; + +/* ------------------------------------------------------------------------- */ + +#undef PATTERN +#define PATTERN(x) PATTERN_##x, + +/* + * For each pattern listed, the inverse pattern is also automatically used. + * E.g. 0x55555555, the inverse of defined 0xAAAAAAAA is covered. + */ +typedef enum pattern { + PATTERN(0x00000000) + PATTERN(0xAAAAAAAA) + PATTERN(0xCCCCCCCC) + PATTERN(0x77777777) + PATTERN(0xF0F0F0F0) + PATTERN(0xFF00FF00) + PATTERN(0xFFFF0000) + PATTERN(0x01234567) + PATTERN(0x89ABCDEF) + PATTERN_MAX, +} Pattern_t; + +#undef PATTERN +#define PATTERN(x) x, +const uint32_t pattern[] = { + PATTERN(0x00000000) + PATTERN(0xAAAAAAAA) + PATTERN(0xCCCCCCCC) + PATTERN(0x77777777) + PATTERN(0xF0F0F0F0) + PATTERN(0xFF00FF00) + PATTERN(0xFFFF0000) + PATTERN(0x01234567) + PATTERN(0x89ABCDEF) + PATTERN_MAX, +}; + +/* ------------------------------------------------------------------------- */ + +#ifndef NBBY +#define NBBY 8 /* FreeBSD style: Number Bits per BYte */ +#endif + +/* ------------------------------------------------------------------------- */ + +#define NBITS(type) (sizeof(type) * NBBY) +#define NBITVAL(nbits) (1 << (nbits)) +#define MAXBITVAL(nbits) ( NBITVAL(nbits) - 1) +#define NBITMASK(nbits) MAXBITVAL(nbits) +#define MAXNBVAL(nbyte) MAXBITVAL((nbyte) * NBBY) + +#define DIVBY(val32,by) ((val32)>>(by)) +#define MODBY(val32,by) ((val32) & ((1 <<(by)) - 1) ) + +#define IS_POWEROF2(val32) ( (((val32)-1) & (val32)) == 0 ) + +#define ROUNDDN(addr, align) ( (addr) & ~((align) - 1) ) +#define ROUNDUP(addr, align) ( ((addr) + (align) - 1) & ~((align) - 1) ) +//#define ROUNDUP(x,y) ((((x)+((y)-1))/(y))*(y)) +#define ALIGN_ADDR(addr, bytes) (void *)( ((uint32_t *)(addr) + (bytes) - 1) \ + & ~((bytes) - 1) ) +#define IS_ALIGNED(addr, bytes) (((uint32_t)(addr) & ((bytes)-1)) == 0) + +#define OFFSET_OF(stype,member) ((uint32_t) &((struct stype *)0)->member) +#define RELOC(base,stype,member) ((base) + OFFSET_OF(stype, member)) + +#define RROTATE32(val32) (((val32) << 31) | ((val32) >> 1)) +#define LROTATE32(val32) (((val32) << 1) | ((val32) >> 31)) + +/* ------------------------------------------------------------------------- */ + +/* Aligned (32bit register) read/write access */ +#define RD16(addr16) (*(volatile uint32_t *)(addr16)) +#define WR16(addr16,val16) (*(volatile uint32_t *)(addr16))=(val16) +#define RD32(addr32) (*(volatile uint32_t *)(addr32)) +#define WR32(addr32,val32) (*(volatile uint32_t *)(addr32))=(val32) + +/*---------------------------------------------------------------------------*/ + +/* Forward declaration */ +_INLINE_ void fill_memory( uint32_t * addr, uint32_t bytes, uint32_t fill32) + _ALWAYS_INLINE_; +_INLINE_ void fill_alt_memory(uint32_t * addr, uint32_t bytes, + uint32_t fillA32, uint32_t fillB32) _ALWAYS_INLINE_; + +void fill_memory( uint32_t * addr, uint32_t bytes, uint32_t fill32) +{ + uint32_t * at, * end_p; + uint32_t words; + words = bytes / sizeof(uint32_t); + if ( words == 0 ) return; + + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + WR32( at, fill32 ); +} + +void fill_alt_memory( uint32_t * addr, uint32_t bytes, + uint32_t fillA32, uint32_t fillB32) +{ + uint32_t * at, * end_p; + uint32_t words; + words = bytes / sizeof(uint32_t); + words = ROUNDDN( words, 2 ); + if ( words == 0 ) return; + + end_p = addr + words; + for ( at = addr; at < end_p; at+=2 ) + { + WR32( at+0, fillA32 ); + WR32( at+1, fillB32 ); + } +} + +/* Forward declaration */ +_INLINE_ MemTestResult_t scanWordValue( uint32_t * addr, uint32_t bytes, + uint32_t pat32 ) _ALWAYS_INLINE_; +_INLINE_ MemTestResult_t scanBulkValue( uint32_t * addr, uint32_t bytes, + uint32_t pat32 ) _ALWAYS_INLINE_; +_INLINE_ MemTestResult_t scanBulkAltInv( uint32_t * addr, uint32_t bytes, + uint32_t pat32 ) _ALWAYS_INLINE_; +_INLINE_ MemTestResult_t scanWordSelf( uint32_t * addr, uint32_t bytes ) + _ALWAYS_INLINE_; +_INLINE_ MemTestResult_t scanBulkSelf( uint32_t * addr, uint32_t bytes ) + _ALWAYS_INLINE_; +_INLINE_ MemTestResult_t slidingAltInv( uint32_t * addr, uint32_t bytes, + uint32_t pat32 ) _ALWAYS_INLINE_; +_INLINE_ MemTestResult_t slidingDiag( uint32_t * addr, uint32_t bytes, + uint32_t pat32 ) _ALWAYS_INLINE_; +_INLINE_ MemTestResult_t memoryBulkCopy( uint32_t * saddr, uint32_t * daddr, + uint32_t bytes ) _ALWAYS_INLINE_; + +/* + *----------------------------------------------------------------------------- + * Function: scanWordValue + * + * Description: + * 4 Passes are conducted on the memory region. + * Pass 1. In INcreasing memory address, write a word with value and verify. + * Pass 2. In DEcreasing memory address, write a word with value and verify. + * Pass 3. In INcreasing memory address, write a word with INVERSE and verify. + * Pass 4. In DEcreasing memory address, write a word with INVERSE and verify. + * Pass 5. In INcreasing shifted memory address, write word with value verify. + * Pass 6. In INcreasing shifted memory address, write word with INVERSE verify. + * + * Parameters: + * addr: word aligned pointer to memory region + * bytes: size in bytes of memory region to test + * pat32: 32bit pattern, e.g. 0x0U, 0xAAAAAAAA, 0xFF00FF00, 0xFFFF0000, + * 0xF0F0F0F0, 0xC3C3C3C3, 0x87878787 + *----------------------------------------------------------------------------- + */ +MemTestResult_t scanWordValue( uint32_t * addr, uint32_t bytes, uint32_t pat32 ) +{ + volatile uint32_t * at, * end_p; + uint32_t expected, read, words; + uint32_t shift; + + if ( ! IS_ALIGNED(addr,4) ) return MEMTEST_ERROR; + + words = bytes / sizeof(uint32_t); /* in whole words (4byte multiple) */ + if ( words == 0 ) + return MEMTEST_ERROR; + + expected = pat32; /* ORIGINAL value */ + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + WR32( at, expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + WR32( at, expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + expected = ~pat32; /* INVERSE value */ + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + WR32( at, expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + WR32( at, expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* PASS 5: Shifting address walk, ORIGINAL */ + expected = pat32; /* ORIGINAL value */ + + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + WR32( at, expected ); + WR32( addr, ~expected ); /* noise at base addr */ + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + expected = ~pat32; /* INVERSE value */ + + /* PASS 6: Shifting address walk, INVERSE */ + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + WR32( at, expected ); + WR32( addr, ~expected ); /* noise at base addr */ + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + return MEMTEST_SUCCESS; +} + +/* + *----------------------------------------------------------------------------- + * Function: scanBulkValue + * + * Description: + * Pass 1. Fill entire memory in INcreasing memory address with value + * then in INcreasing memory address read and verify. + * Pass 2. Fill entire memory in DEcreasing memory address with value + * then in DEcreasing memory address read and verify. + * Pass 3. Fill entire memory in INcreasing memory address with inverse value + * then in INcreasing memory address read and verify. + * Pass 4. Fill entire memory in DEcreasing memory address with inverse value + * then in DEcreasing memory address read and verify. + * Pass 5. INcreasing shifted, ORIGINAL + * Pass 6. INcreasing shifted, INVERSE + * + * Parameters: + * addr: word aligned pointer to memory region + * bytes: size in bytes of memory region to test + * pat32: 32bit pattern, e.g. 0x0U, 0xAAAAAAAA, 0xFF00FF00, 0xFFFF0000, + * 0xF0F0F0F0, 0xC3C3C3C3, 0x87878787 + *----------------------------------------------------------------------------- + */ +MemTestResult_t scanBulkValue( uint32_t * addr, uint32_t bytes, uint32_t pat32 ) +{ + volatile uint32_t * at, * end_p; + uint32_t expected, read, words; + uint32_t shift; + + if ( ! IS_ALIGNED(addr,4) ) return MEMTEST_ERROR; + + words = bytes / sizeof(uint32_t); /* in whole words (4byte multiple) */ + if ( words == 0 ) return MEMTEST_ERROR; + + expected = pat32; /* ORIGINAL value */ + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + WR32( at, expected ); + } + for ( at = addr; at < end_p; at++ ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + WR32( at, expected ); + } + for ( at = addr + words - 1; at >= end_p; at-- ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + expected = ~pat32; /* INVERSE value */ + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + WR32( at, expected ); + } + for ( at = addr; at < end_p; at++ ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + WR32( at, expected ); + } + for ( at = addr + words - 1; at >= end_p; at-- ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* Pass 5. INCREASING Shifted traversal */ + expected = pat32; /* ORIGINAL value */ + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + WR32( at, expected ); + WR32( addr, ~expected ); /* noise at base addr */ + } + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + expected = ~pat32; /* INVERSE value */ + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + WR32( at, expected ); + WR32( addr, ~expected ); /* noise at base addr */ + } + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + return MEMTEST_SUCCESS; +} + +/* + *----------------------------------------------------------------------------- + * Function: scanBulkAltInv + * + * Description: + * Pass 1. Fill entire memory in INcreasing memory address with alternating + * value, then in INcreasing memory address read and verify. + * Pass 2. Fill entire memory in DEcreasing memory address with alternating + * value, then in DEcreasing memory address read and verify. + * Pass 3. Same as one but with shifted address. + * + * Parameters: + * addr: word aligned pointer to memory region + * bytes: size in bytes of memory region to test + * pat32: 32bit pattern, e.g. 0x0U, 0xAAAAAAAA, 0xFF00FF00, 0xFFFF0000, + * 0xF0F0F0F0, 0xC3C3C3C3, 0x87878787 + *----------------------------------------------------------------------------- + */ +MemTestResult_t scanBulkAltInv( uint32_t * addr, uint32_t bytes, uint32_t pat32 ) +{ + volatile uint32_t * at, * end_p; + uint32_t read, words; + uint32_t shift; + + if ( ! IS_ALIGNED(addr,4) ) return MEMTEST_ERROR; + + words = bytes / sizeof(uint32_t); /* in whole words (4byte multiple) */ + words = ROUNDDN( words, 2 ); + if ( words == 0 ) return MEMTEST_ERROR; + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at+=2 ) + { + WR32( at+0, pat32 ); + WR32( at+1, ~pat32 ); + } + for ( at = addr; at < end_p; at+=2 ) + { + read = RD32( at+0 ); + if ( read != pat32 ) + { + return MEMTEST_FAILURE; + } + read = RD32( at+1 ); + if ( read != ~pat32 ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-=2 ) + { + WR32( at+0, pat32 ); + WR32( at+1, ~pat32 ); + } + for ( at = addr + words - 1; at >= end_p; at-=2 ) + { + read = RD32( at+0 ); + if ( read != pat32 ) + { + return MEMTEST_FAILURE; + } + read = RD32( at+1 ); + if ( read != ~pat32 ) + { + return MEMTEST_FAILURE; + } + } + + /* INCREASING SHIFTED traversal */ + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + WR32( at+0, pat32 ); + WR32( addr, 0 ); + WR32( at+1, ~pat32 ); + WR32( addr, 0 ); + } + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + read = RD32( at+0 ); + if ( read != pat32 ) + { + return MEMTEST_FAILURE; + } + read = RD32( at+1 ); + if ( read != ~pat32 ) + { + return MEMTEST_FAILURE; + } + } + + return MEMTEST_SUCCESS; +} + + +/* + *----------------------------------------------------------------------------- + * Function: scanWordSelf + * + * Description: + * 4 Passes are conducted on the memory region. + * Pass 1. In INcreasing memory address, write a word with selfaddr and verify. + * Pass 2. In DEcreasing memory address, write a word with INVERSE and verify. + * Pass 3. In INcreasing memory address, write a word with INVERSE and verify. + * Pass 4. In DEcreasing memory address, write a word with selfaddr and verify. + * Pass 5. value = ORIGINAL address, INCREASING SHIFTED traversal. + * Pass 6. value = INVERSE address, INCREASING SHIFTED traversal. + * + * In Pass 2 Read+Modify+Write, and in Pass 3, Read+Write is used + * + * Parameters: + * addr: word aligned pointer to memory region + * bytes: size in bytes of memory region to test + * + *----------------------------------------------------------------------------- + */ +MemTestResult_t scanWordSelf( uint32_t * addr, uint32_t bytes ) +{ + volatile uint32_t * at, * end_p; + uint32_t expected, read, words; + uint32_t shift; + + if ( ! IS_ALIGNED(addr,4) ) return MEMTEST_FAILURE; + + words = bytes / sizeof(uint32_t); /* in whole words (4byte multiple) */ + if ( words == 0 ) return MEMTEST_ERROR; + + /* ORIGINAL value */ + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + expected = (uint32_t)at; + WR32( at, expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + expected = ~( (uint32_t)RD32(at) ); + WR32( at, expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + expected = ((uint32_t)RD32(at)); + WR32( at, expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + expected = ~((uint32_t)at); + WR32( at, expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* value = ORIGINAL address, INCREASING SHIFTED traversal */ + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + expected = (uint32_t)at; /* Not read modify write */ + WR32( at, expected ); + WR32( addr, ~expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* value = INVERSE address, INCREASING SHIFTED traversal */ + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + expected = ~(uint32_t)(at); /* Not read modify write */ + WR32( at, expected ); + WR32( addr, ~expected ); + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + return MEMTEST_SUCCESS; +} + +/* + *----------------------------------------------------------------------------- + * Function: scanBulkSelf + * + * Description: + * Pass 1. Fill entire memory in INcreasing memory address with self address + * then in INcreasing memory address read and verify. + * Pass 2. Fill entire memory in DEcreasing memory address with self address + * then in DEcreasing memory address read and verify. + * Pass 3. Fill entire memory in INcreasing memory address with inverse addr + * then in INcreasing memory address read and verify. + * Pass 4. Fill entire memory in DEcreasing memory address with inverse addr + * then in DEcreasing memory address read and verify. + * Pass 5. Same as Pass 1 but with shifted address + * Pass 6. Same as Pass 3 but with shifted address + * + * Parameters: + * addr: word aligned pointer to memory region + * bytes: size in bytes of memory region to test + *----------------------------------------------------------------------------- + */ +MemTestResult_t scanBulkSelf( uint32_t * addr, uint32_t bytes ) +{ + volatile uint32_t * at, * end_p; + uint32_t read, words; + uint32_t shift; + + if ( ! IS_ALIGNED(addr,4) ) return MEMTEST_ERROR; + + words = bytes / sizeof(uint32_t); /* in whole words (4byte multiple) */ + if ( words == 0 ) return MEMTEST_ERROR; + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + WR32( at, (uint32_t)at ); + } + for ( at = addr; at < end_p; at++ ) + { + read = RD32(at); + if ( read != (uint32_t)at ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + WR32( at, (uint32_t)at ); + } + for ( at = addr + words - 1; at >= end_p; at-- ) + { + read = RD32(at); + if ( read != (uint32_t)at ) + { + return MEMTEST_FAILURE; + } + } + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + WR32( at, ~((uint32_t)at) ); + } + for ( at = addr; at < end_p; at++ ) + { + read = RD32(at); + if ( read != ~((uint32_t)at) ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + WR32( at, ~((uint32_t)at) ); + } + for ( at = addr + words - 1; at >= end_p; at-- ) + { + read = RD32(at); + if ( read != ~((uint32_t)at) ) + { + return MEMTEST_FAILURE; + } + } + + /* INCREASING traversal */ + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + WR32( at, (uint32_t)at ); + WR32( addr, ~((uint32_t)at) ); + } + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + read = RD32(at); + if ( read != (uint32_t)at ) + { + return MEMTEST_FAILURE; + } + } + + /* INCREASING traversal */ + end_p = addr + words; + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + WR32( at, ~((uint32_t)at) ); + WR32( addr, ((uint32_t)at) ); + } + shift = sizeof(uint32_t); + for ( at = addr + shift; at < end_p; shift <<= 1, at = addr + shift ) + { + read = RD32(at); + if ( read != ~((uint32_t)at) ) + { + return MEMTEST_FAILURE; + } + } + + return MEMTEST_SUCCESS; +} + + +/* + *----------------------------------------------------------------------------- + * Function: slidingAltInv + * + * Description: + * This is the same as scanBulkAltInv, where in each invocation the value is + * rotated to the right. The starting value is usedefined. + * + * Parameters: + * addr: word aligned pointer to memory region + * bytes: size in bytes of memory region to test + * pat32: pattern to slide per pass + *----------------------------------------------------------------------------- + */ +MemTestResult_t slidingAltInv( uint32_t * addr, uint32_t bytes, uint32_t pat32 ) +{ + uint32_t sliding_pat32, i; + + if ( pat32 == 0x0 ) pat32 = 0x80000000; + if ( pat32 == ~0x0 ) pat32 = 0x7FFFFFFF; + + sliding_pat32 = pat32; + + for ( i=0; i<32; i++ ) + { + if ( scanBulkAltInv( addr, bytes, sliding_pat32 ) + == MEMTEST_FAILURE ) + { + return MEMTEST_FAILURE; + } + + sliding_pat32 = RROTATE32( sliding_pat32 ); + } + + sliding_pat32 = pat32; + for (i=0; i<32; i++) + { + if ( scanBulkAltInv( addr, bytes, sliding_pat32 ) + == MEMTEST_FAILURE ) + { + return MEMTEST_FAILURE; + } + + sliding_pat32 = LROTATE32( sliding_pat32 ); + } + + return MEMTEST_SUCCESS; +} + +/* + *----------------------------------------------------------------------------- + * Function: slidingDiag + * + * Description: + * Pass 1. Fill entire memory in INcreasing memory address with pattern right + * shifted. Then read in INcreasing order and verify. + * Pass 2. Fill entire memory in DEcreasing memory address with inverse of + * read value. Then read in DEcreasing order and verify. + * Pass 3. Fill entire memory in DEcreasing memory address with pattern right + * shifted. Then read in DEcreasing order and verify. + * Pass 4. Fill entire memory in INcreasing memory address with inverse of + * read value. Then read in INcreasing order and verify. + * + * Parameters: + * addr: word aligned pointer to memory region + * bytes: size in bytes of memory region to test + * pat32: pattern to be filled shifted each write + *----------------------------------------------------------------------------- + */ +MemTestResult_t slidingDiag( uint32_t * addr, uint32_t bytes, uint32_t pat32 ) +{ + volatile uint32_t * at, * end_p; + uint32_t expected, read = 0, words, last; + + if ( ! IS_ALIGNED(addr,4) ) return MEMTEST_ERROR; + + words = bytes / sizeof(uint32_t); /* in whole words (4byte multiple) */ + if ( words == 0 ) return MEMTEST_ERROR; + + + /* INCREASING traversal */ + expected = pat32; /* ORIGINAL value */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + WR32( at, expected ); + expected = RROTATE32( expected ); /* next expected */ + } + expected = pat32; /* ORIGINAL value */ + for ( at = addr; at < end_p; at++ ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + expected = RROTATE32( expected ); /* next expected */ + } + + last = ~( read ); /* Starting value for decreasing traversal, next */ + + /* DECREASING traversal */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + expected = ~( RD32(at) ); + WR32( at, expected ); + } + expected = last; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + expected = LROTATE32( expected ); + } + + /* DECREASING traversal */ + expected = pat32; /* ORIGINAL value */ + end_p = addr; + for ( at = addr + words - 1; at >= end_p; at-- ) + { + WR32( at, expected ); + expected = RROTATE32( expected ); /* next expected */ + } + expected = pat32; /* ORIGINAL value */ + for ( at = addr + words - 1; at >= end_p; at-- ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + expected = RROTATE32( expected ); /* next expected */ + } + + last = ~( read ); + + /* INCREASING traversal */ + end_p = addr + words; + for ( at = addr; at < end_p; at++ ) + { + expected = ~( RD32(at) ); + WR32( at, expected ); + } + expected = last; + for ( at = addr; at < end_p; at++ ) + { + read = RD32(at); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + expected = LROTATE32( expected ); + } + + return MEMTEST_SUCCESS; +} + +/* + *----------------------------------------------------------------------------- + * Function: memoryBulkCopy + * + * Description: + * Pass 1. Copy entire ORIGINAL memory in INcreasing memory address, then verify + * Pass 2. Copy entire ORIGINAL memory in DEcreasing memory address, then verify + * Pass 3. Copy entire INVERSE memory in INcreasing memory address, then verify + * Pass 4. Copy entire INVERSE memory in DEcreasing memory address, then verify + *----------------------------------------------------------------------------- + */ +MemTestResult_t memoryBulkCopy( uint32_t * saddr, uint32_t * daddr, + uint32_t bytes ) +{ + volatile uint32_t * src_p, * dst_p, * end_p; + uint32_t expected, read, words; + + if ( ! IS_ALIGNED(saddr,4) ) return MEMTEST_ERROR; + if ( ! IS_ALIGNED(daddr,4) ) return MEMTEST_ERROR; + + words = bytes / sizeof(uint32_t); /* in whole words (4byte multiple) */ + if ( words == 0 ) return MEMTEST_ERROR; + + if ( (uint32_t)saddr < (uint32_t)daddr ) + { + if ( (uint32_t)(saddr + words) > (uint32_t)daddr ) + return MEMTEST_ERROR; + } + else if ( (uint32_t)daddr < (uint32_t)saddr ) + { + if ( (uint32_t)(daddr + words) > (uint32_t)saddr ) + return MEMTEST_ERROR; + } + + /* INCREASING traversal ORIGINAL */ + end_p = saddr + words; + for ( src_p = saddr, dst_p = daddr; src_p < end_p; src_p++, dst_p++ ) + { + expected = RD32( dst_p ); + WR32( src_p, expected ); + } + for ( src_p = saddr, dst_p = daddr; src_p < end_p; src_p++, dst_p++ ) + { + expected = RD32( dst_p ); + read = RD32( src_p ); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal ORIGINAL */ + end_p = saddr; + for ( src_p = saddr + words - 1, dst_p = daddr + words - 1; + src_p >= end_p; src_p--, dst_p-- ) + { + expected = RD32( dst_p ); + WR32( src_p, expected ); + } + for ( src_p = saddr + words - 1, dst_p = daddr + words - 1; + src_p >= end_p; src_p--, dst_p-- ) + { + expected = RD32( dst_p ); + read = RD32( src_p ); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* INCREASING traversal INVERSE */ + end_p = saddr + words; + for ( src_p = saddr, dst_p = daddr; src_p < end_p; src_p++, dst_p++ ) + { + expected = ~( RD32( dst_p ) ); + WR32( src_p, expected ); + } + for ( src_p = saddr, dst_p = daddr; src_p < end_p; src_p++, dst_p++ ) + { + expected = ~( RD32( dst_p ) ); + read = RD32( src_p ); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + /* DECREASING traversal INVERSE */ + end_p = saddr; + for ( src_p = saddr + words - 1, dst_p = daddr + words - 1; + src_p >= end_p; src_p--, dst_p-- ) + { + expected = ~( RD32( dst_p ) ); + WR32( src_p, expected ); + } + for ( src_p = saddr + words - 1, dst_p = daddr + words - 1; + src_p >= end_p; src_p--, dst_p-- ) + { + expected = ~( RD32( dst_p ) ); + read = RD32( src_p ); + if ( read != expected ) + { + return MEMTEST_FAILURE; + } + } + + return MEMTEST_SUCCESS; +} + +/*---------------------------------------------------------------------------*/ diff --git a/cfe/cfe/arch/mips/board/bcm63xx_rom/src/rom_cfe.mk b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/rom_cfe.mk new file mode 100755 index 0000000..c45aea7 --- /dev/null +++ b/cfe/cfe/arch/mips/board/bcm63xx_rom/src/rom_cfe.mk @@ -0,0 +1,370 @@ + +# +# CFE's version number +# + +include ${TOP}/main/cfe_version.mk + +# +# Default values for certain parameters +# + +CFG_MLONG64 ?= 0 +CFG_LITTLE ?= 0 +CFG_RELOC ?= 0 +CFG_UNCACHED ?= 0 +CFG_NEWRELOC ?= 0 +CFG_BOOTRAM ?= 0 +CFG_VGACONSOLE ?= 0 +CFG_PCI ?= 1 +CFG_LDT_REV_017 ?= 0 +CFG_ZLIB ?= 0 +CFG_BIENDIAN ?= 0 +CFG_DOWNLOAD ?= 0 +CFG_RAMAPP ?= 0 +CFG_USB ?= 0 + +# +# Paths to other parts of the firmware. Everything's relative to ${TOP} +# so that you can actually do a build anywhere you want. +# + +ARCH_TOP = ${TOP}/arch/${ARCH} +ARCH_SRC = ${ARCH_TOP}/common/src +ARCH_INC = ${ARCH_TOP}/common/include +CPU_SRC = ${ARCH_TOP}/cpu/${CPU}/src +CPU_INC = ${ARCH_TOP}/cpu/${CPU}/include +# +# It's actually optional to have a 'board' +# directory. If you don't specify BOARD, +# don't include the files. +# + +ifneq ("$(strip ${BOARD})","") +BOARD_SRC = ${ARCH_TOP}/board/${BOARD}/src +BOARD_INC = ${ARCH_TOP}/board/${BOARD}/include +endif + +# +# Preprocessor defines for CFE's version number +# + +VDEF = -DCFE_VER_MAJ=${CFE_VER_MAJ} -DCFE_VER_MIN=${CFE_VER_MIN} -DCFE_VER_ECO=${CFE_VER_ECO} + +# +# Construct the list of paths that will eventually become the include +# paths and VPATH +# + +SRCDIRS = ${ARCH_SRC} ${CPU_SRC} ${BOARD_SRC} ${TOP}/main ${TOP}/vendor ${TOP}/include ${TOP}/net ${TOP}/dev ${TOP}/pci ${TOP}/ui ${TOP}/lib ${TOP}/common ${TOP}/verif ${TOP}/lzma + +CFE_INC = ${TOP}/include ${TOP}/pci ${TOP}/net + +ifeq ($(strip ${CFG_VGACONSOLE}),1) +SRCDIRS += ${TOP}/x86emu ${TOP}/pccons +CFE_INC += ${TOP}/x86emu ${TOP}/pccons +endif + +ifeq ($(strip ${CFG_VAPI}),1) +SRCDIRS += ${TOP}/verif +CFE_INC += ${TOP}/verif +endif + +ifeq ($(strip ${CFG_ZLIB}),1) +SRCDIRS += ${TOP}/zlib +CFE_INC += ${TOP}/zlib +endif + + +INCDIRS = $(patsubst %,-I%,$(subst :, ,$(ARCH_INC) $(CPU_INC) $(BOARD_INC) $(CFE_INC))) + +VPATH = $(SRCDIRS) + +# +# Bi-endian support: If we're building the little-endian +# version, use a different linker script so we can locate the +# ROM at a higher address. You'd think we could do this with +# normal linker command line switches, but there appears to be no +# command-line way to override the 'AT' qualifier in the linker script. +# + +CFG_TEXTAT1MB=0 +ifeq ($(strip ${CFG_BIENDIAN}),1) + ifeq ($(strip ${CFG_LITTLE}),1) + CFG_TEXTAT1MB=1 + endif +endif + + +# +# Configure tools and basic tools flags. This include sets up +# macros for calling the C compiler, basic flags, +# and linker scripts. +# + +include ${ARCH_SRC}/tools.mk + +# +# Add some common flags that are used on any architecture. +# + +CFLAGS += -I. $(INCDIRS) +CFLAGS += -D_CFE_ ${VDEF} -DCFG_BOARDNAME=\"${CFG_BOARDNAME}\" + +# +# Gross - allow more options to be supplied from command line +# + +ifdef CFG_OPTIONS +OPTFLAGS = $(patsubst %,-D%,$(subst :, ,$(CFG_OPTIONS))) +CFLAGS += ${OPTFLAGS} +endif + +ifeq ($(strip $(BRCM_IKOS)),y) +CFLAGS += -DCONFIG_BRCM_IKOS +endif + +# +# Add flash driver support. +# + +ifeq ($(strip $(BLD_NAND)),1) +# BUILD NAND flash boot loader +ifeq ($(strip $(BRCM_CHIP)),6328) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=0 +INC_NAND_FLASH_DRIVER=1 +endif +ifeq ($(strip $(BRCM_CHIP)),6362) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=0 +INC_NAND_FLASH_DRIVER=1 +endif +ifeq ($(strip $(BRCM_CHIP)),6368) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=0 +INC_NAND_FLASH_DRIVER=1 +endif +ifeq ($(strip $(BRCM_CHIP)),6816) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=0 +INC_NAND_FLASH_DRIVER=1 +endif + +else +# BUILD NOR flash boot loader +ifeq ($(strip $(BRCM_CHIP)),6328) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=1 +INC_NAND_FLASH_DRIVER=0 +endif +ifeq ($(strip $(BRCM_CHIP)),6362) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=1 +INC_NAND_FLASH_DRIVER=0 +endif +ifeq ($(strip $(BRCM_CHIP)),6368) +INC_CFI_FLASH_DRIVER=1 +INC_SPI_FLASH_DRIVER=1 +INC_NAND_FLASH_DRIVER=0 +endif +ifeq ($(strip $(BRCM_CHIP)),6816) +INC_CFI_FLASH_DRIVER=1 +INC_SPI_FLASH_DRIVER=1 +INC_NAND_FLASH_DRIVER=0 +endif +endif + +ifeq ($(strip $(BLD_SPI_NAND)),1) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=1 +INC_NAND_FLASH_DRIVER=0 +INC_SPI_PROG_NAND=1 +else +INC_SPI_PROG_NAND=0 +endif + +CFLAGS += -DINC_CFI_FLASH_DRIVER=$(INC_CFI_FLASH_DRIVER) +CFLAGS += -DINC_SPI_FLASH_DRIVER=$(INC_SPI_FLASH_DRIVER) +CFLAGS += -DINC_NAND_FLASH_DRIVER=$(INC_NAND_FLASH_DRIVER) +CFLAGS += -DINC_SPI_PROG_NAND=$(INC_SPI_PROG_NAND) + +# +# This is the makefile's main target. Note that we actually +# do most of the work in 'ALL' not 'all', since we include +# other makefiles after this point. +# + +all : build_date.c ALL + +# +# Macros that expand to the list of arch-independent files +# + +LZMAOBJS = LzmaDecode.o dcapi.o +DEVOBJS = lib_malloc.o +## dev_newflash.o dev_null.o dev_promice.o dev_ide_common.o dev_ns16550.o dev_ds17887clock.o dev_flash.o + +##lib_hssubr.o lib_physio.o lib_printf.o lib_misc.o \ lib_arena.o lib_queue.o +## lib_qsort.o lib_string.o lib_string2.o + +NETOBJS = +## net_tcp.o net_tcpbuf.o dev_tcpconsole.o net_dhcp.o net_icmp.o net_ether.o net_tftp.o net_ip.o net_udp.o net_dns.o net_arp.o net_api.o + +CFEOBJS = +## cfe_iocb_dispatch.o cfe_devfuncs.o \ cfe_console.o cfe_timer.o cfe_attach.o cfe_background.o cfe_zlibfs.o +## cfe_mem.o +## cfe_error.o build_date.o \ +## cfe_rawfs.o cfe_xreq.o cfe_filesys.o +## cfe_fatfs.o cfe_httpfs.o cfe_ldr_srec.o cfe_autoboot.o cfe_boot.o cfe_ldr_elf.o cfe_ldr_raw.o cfe_loader.o +## cfe_main.o nvram_subr.o url.o cfe_savedata.o env_subr.o +UIOBJS = +##ui_command.o ui_cmddisp.o +## ui_pcicmds.o \ui_tcpcmds.o ui_memcmds.o ui_loadcmds.o ui_flash.o ui_netcmds.o ui_envcmds.o ui_devcmds.o +## ui_examcmds.o ui_misccmds.o \ +## ui_test_disk.o ui_test_ether.o ui_test_flash.o ui_test_uart.o + +# +# Add more object files if we're supporting PCI +# + +ifeq ($(strip ${CFG_PCI}),1) +PCIOBJS = pciconf.o ldtinit.o pci_subr.o +PCIOBJS += pci_devs.o +DEVOBJS += dev_sp1011.o dev_ht7520.o +DEVOBJS += dev_ide_pci.o dev_ns16550_pci.o +DEVOBJS += dev_tulip.o dev_dp83815.o +CFLAGS += -DCFG_PCI=1 +ifeq ($(strip ${CFG_LDT_REV_017}),1) +CFLAGS += -DCFG_LDT_REV_017=1 +endif +ifeq ($(strip ${CFG_DOWNLOAD}),1) +DEVOBJS += dev_bcm1250.o download.data +CFLAGS += -DCFG_DOWNLOAD=1 +endif +endif + +# +# If doing bi-endian, add the compiler switch to change +# the way the vectors are generated. These switches are +# only added to the big-endian portion of the ROM, +# which is located at the real boot vector. +# + +ifeq ($(strip ${CFG_BIENDIAN}),1) + ifeq ($(strip ${CFG_LITTLE}),0) + CFLAGS += -DCFG_BIENDIAN=1 + endif +endif + +# +# Include the makefiles for the architecture-common, cpu-specific, +# and board-specific directories. Each of these will supply +# some files to "ALLOBJS". The BOARD directory is optional +# as some ports are so simple they don't need boad-specific stuff. +# + +include ${ARCH_SRC}/Makefile +include ${CPU_SRC}/Makefile + +ifneq ("$(strip ${BOARD})","") +include ${BOARD_SRC}/Makefile +endif + +# +# Add the common object files here. +# + +ALLOBJS += $(LIBOBJS) $(DEVOBJS) $(CFEOBJS) $(VENOBJS) $(UIOBJS) $(NETOBJS) +#$(PCIOBJS) + +# +# VAPI continues to be a special case. +# + +ifeq ($(strip ${CFG_VAPI}),1) +include ${TOP}/verif/Makefile +endif + +# +# USB support +# + +ifeq ($(strip ${CFG_USB}),1) +SRCDIRS += ${TOP}/usb +CFE_INC += ${TOP}/usb +include ${TOP}/usb/Makefile +endif + +# +# If we're doing the VGA console thing, pull in the x86 emulator +# and the pcconsole subsystem +# + +ifeq ($(strip ${CFG_VGACONSOLE}),1) +include ${TOP}/x86emu/Makefile +include ${TOP}/pccons/Makefile +endif + +# +# If we're including ZLIB, then add its makefile. +# + +##ifeq ($(strip ${CFG_ZLIB}),1) +##include ${TOP}/zlib/Makefile +CFLAGS += -DCFG_ZLIB=1 -DMY_ZCALLOC -DNO_MEMCPY +##endif + +.PHONY : all +.PHONY : ALL +.PHONY : build_date.c + +# +# Build the local tools that we use to construct other source files +# + +mkpcidb : ${TOP}/hosttools/mkpcidb.c + gcc -o mkpcidb ${TOP}/hosttools/mkpcidb.c + +memconfig : ${TOP}/hosttools/memconfig.c + gcc -o memconfig -D_MCSTANDALONE_ -D_MCSTANDALONE_NOISY_ -I${TOP}/arch/mips/cpu/sb1250/include ${TOP}/hosttools/memconfig.c ${TOP}/arch/${ARCH}/cpu/${CPU}/src/sb1250_draminit.c + +pcidevs_data2.h : mkpcidb ${TOP}/pci/pcidevs_data.h + ./mkpcidb > pcidevs_data2.h + +mkflashimage : ${TOP}/hosttools/mkflashimage.c + gcc -o mkflashimage -I${TOP}/include ${TOP}/hosttools/mkflashimage.c + +pci_subr.o : ${TOP}/pci/pci_subr.c pcidevs_data2.h + +##build_date.c : +## echo "const char *builddate = \"`date`\";" > build_date.c +## echo "const char *builduser = \"`whoami`@`hostname`\";" >> build_date.c + +# +# Make a define for the board name +# + +CFLAGS += -D_$(patsubst "%",%,${CFG_BOARDNAME})_ + +LIBCFE = libcfe.a + +%.o : %.c + $(GCC) $(CFLAGS) -o $@ $< + +%.o : %.S + $(GCC) $(CFLAGS) -o $@ $< + +# +# This rule constructs "libcfe.a" which contains most of the object +# files. +# + +$(LIBCFE) : $(ALLOBJS) + rm -f $(LIBCFE) + $(AR) cr $(LIBCFE) $(ALLOBJS) + $(RANLIB) $(LIBCFE) + + + + diff --git a/cfe/cfe/arch/mips/common/include/addrspace.h b/cfe/cfe/arch/mips/common/include/addrspace.h new file mode 100644 index 0000000..6330851 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/addrspace.h @@ -0,0 +1,63 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Address space macros File: addrspace.h + * + * Macros to deal with physical, virtual, and uncached addresses. + * for MIPS, these map to the appropriate KSEG0/KSEG1 macros + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" + +#define PHYSADDR(x) K0_TO_PHYS(x) + +/* If running uncached, force all kernel addresses to be uncached */ +#if CFG_RUNFROMKSEG0 +#define KERNADDR(x) PHYS_TO_K0(x) +#else +#define KERNADDR(x) PHYS_TO_K1(x) +#endif + +#define UNCADDR(x) PHYS_TO_K1(x) + + + diff --git a/cfe/cfe/arch/mips/common/include/disasm.h b/cfe/cfe/arch/mips/common/include/disasm.h new file mode 100644 index 0000000..8a8e7b7 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/disasm.h @@ -0,0 +1,61 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * MIPS disassembler File: disasm.h + * + * MIPS disassembler (used by ui_examcmds.c) + * + * Author: Justin Carlson (carlson@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef DISASM_H +#define DISASM_H + +/* Returns a pointer to a read-only string containing the intstruction name */ +char *disasm_inst_name(uint32_t inst); + +/* Copies a disassembled version of the instruction into buf, null terminating the +string. Will not exceed buf_size bytes written; if the disassembled string is +longer than buf_size, buf_size-1 bytes of the string will be written and that string +will be null-terminated */ +void disasm_inst(char *buf, int buf_size, uint32_t inst, uint64_t pc); +#endif + + + diff --git a/cfe/cfe/arch/mips/common/include/exception.h b/cfe/cfe/arch/mips/common/include/exception.h new file mode 100644 index 0000000..70e87c2 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/exception.h @@ -0,0 +1,223 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Exception/trap handler defs File: exception.h + * + * This module describes the exception handlers, exception + * trap frames, and dispatch. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifdef __ASSEMBLER__ +#define _XAIDX(x) (8*(x)) +#else +#define _XAIDX(x) (x) +#endif + + +/* ********************************************************************* + * Exception vectors from the MIPS specification + ********************************************************************* */ + +#define MIPS_ROM_VEC_RESET 0x0000 +#define MIPS_ROM_VEC_TLBFILL 0x0200 +#define MIPS_ROM_VEC_XTLBFILL 0x0280 +#define MIPS_ROM_VEC_CACHEERR 0x0300 +#define MIPS_ROM_VEC_EXCEPTION 0x0380 +#define MIPS_ROM_VEC_INTERRUPT 0x0400 +#define MIPS_ROM_VEC_EJTAG 0x0480 + +#define MIPS_RAM_VEC_TLBFILL 0x0000 +#define MIPS_RAM_VEC_XTLBFILL 0x0080 +#define MIPS_RAM_VEC_EXCEPTION 0x0180 +#define MIPS_RAM_VEC_INTERRUPT 0x0200 +#define MIPS_RAM_VEC_CACHEERR 0x0100 +#define MIPS_RAM_VEC_END 0x0300 + +#define MIPS_RAM_EXL_VEC_TLBFILL 0x0100 +#define MIPS_RAM_EXL_VEC_XTLBFILL 0x0180 + + +/* ********************************************************************* + * Fixed locations of other low-memory objects. We stuff some + * important data in the spaces between the vectors. + ********************************************************************* */ + +#define CFE_LOCORE_GLOBAL_GP 0x0040 /* our "handle" */ +#define CFE_LOCORE_GLOBAL_SP 0x0048 /* Stack pointer for exceptions */ +#define CFE_LOCORE_GLOBAL_K0TMP 0x0050 /* Used by cache error handler */ +#define CFE_LOCORE_GLOBAL_K1TMP 0x0058 /* Used by cache error handler */ +#define CFE_LOCORE_GLOBAL_RATMP 0x0060 /* Used by cache error handler */ +#define CFE_LOCORE_GLOBAL_GPTMP 0x0068 /* Used by cache error handler */ +#define CFE_LOCORE_GLOBAL_CERRH 0x0070 /* Pointer to cache error handler */ + +#define CFE_LOCORE_GLOBAL_T0TMP 0x0240 /* used by cache error handler */ +#define CFE_LOCORE_GLOBAL_T1TMP 0x0248 /* used by cache error handler */ +#define CFE_LOCORE_GLOBAL_T2TMP 0x0250 /* used by cache error handler */ +#define CFE_LOCORE_GLOBAL_T3TMP 0x0258 /* used by cache error handler */ + +/* ********************************************************************* + * Offsets into our exception handler table. + ********************************************************************* */ + +#define XTYPE_RESET 0 +#define XTYPE_TLBFILL 8 +#define XTYPE_XTLBFILL 16 +#define XTYPE_CACHEERR 24 +#define XTYPE_EXCEPTION 32 +#define XTYPE_INTERRUPT 40 +#define XTYPE_EJTAG 48 + +/* ********************************************************************* + * Exception frame definitions. + ********************************************************************* */ + +/* + * The exception frame is divided up into pieces, representing the different + * parts of the processor that the data comes from: + * + * CP0: Words 0..7 + * Int Regs: Words 8..41 + * FP Regs: Words 42..73 + * Total size: 74 words + */ + +#define EXCEPTION_SIZE _XAIDX(74) + +#define XCP0_BASE 0 +#define XGR_BASE 8 +#define XFR_BASE 42 + +#define _XCP0IDX(x) _XAIDX((x)+XCP0_BASE) +#define XCP0_SR _XCP0IDX(0) +#define XCP0_CAUSE _XCP0IDX(1) +#define XCP0_EPC _XCP0IDX(2) +#define XCP0_VADDR _XCP0IDX(3) +#define XCP0_PRID _XCP0IDX(4) + +#define _XGRIDX(x) _XAIDX((x)+XGR_BASE) +#define XGR_ZERO _XGRIDX(0) +#define XGR_AT _XGRIDX(1) +#define XGR_V0 _XGRIDX(2) +#define XGR_V1 _XGRIDX(3) +#define XGR_A0 _XGRIDX(4) +#define XGR_A1 _XGRIDX(5) +#define XGR_A2 _XGRIDX(6) +#define XGR_A3 _XGRIDX(7) +#define XGR_T0 _XGRIDX(8) +#define XGR_T1 _XGRIDX(9) +#define XGR_T2 _XGRIDX(10) +#define XGR_T3 _XGRIDX(11) +#define XGR_T4 _XGRIDX(12) +#define XGR_T5 _XGRIDX(13) +#define XGR_T6 _XGRIDX(14) +#define XGR_T7 _XGRIDX(15) +#define XGR_S0 _XGRIDX(16) +#define XGR_S1 _XGRIDX(17) +#define XGR_S2 _XGRIDX(18) +#define XGR_S3 _XGRIDX(19) +#define XGR_S4 _XGRIDX(20) +#define XGR_S5 _XGRIDX(21) +#define XGR_S6 _XGRIDX(22) +#define XGR_S7 _XGRIDX(23) +#define XGR_T8 _XGRIDX(24) +#define XGR_T9 _XGRIDX(25) +#define XGR_K0 _XGRIDX(26) +#define XGR_K1 _XGRIDX(27) +#define XGR_GP _XGRIDX(28) +#define XGR_SP _XGRIDX(29) +#define XGR_FP _XGRIDX(30) +#define XGR_RA _XGRIDX(31) +#define XGR_LO _XGRIDX(32) +#define XGR_HI _XGRIDX(33) + + +#define _XFRIDX(x) _XAIDX((x)+XFR_BASE) +#define XR_F0 _XFRIDX(0) +#define XR_F1 _XFRIDX(1) +#define XR_F2 _XFRIDX(2) +#define XR_F3 _XFRIDX(3) +#define XR_F4 _XFRIDX(4) +#define XR_F5 _XFRIDX(5) +#define XR_F6 _XFRIDX(6) +#define XR_F7 _XFRIDX(7) +#define XR_F8 _XFRIDX(8) +#define XR_F9 _XFRIDX(9) +#define XR_F10 _XFRIDX(10) +#define XR_F11 _XFRIDX(11) +#define XR_F12 _XFRIDX(12) +#define XR_F13 _XFRIDX(13) +#define XR_F14 _XFRIDX(14) +#define XR_F15 _XFRIDX(15) +#define XR_F16 _XFRIDX(16) +#define XR_F17 _XFRIDX(17) +#define XR_F18 _XFRIDX(18) +#define XR_F19 _XFRIDX(19) +#define XR_F20 _XFRIDX(20) +#define XR_F21 _XFRIDX(21) +#define XR_F22 _XFRIDX(22) +#define XR_F23 _XFRIDX(23) +#define XR_F24 _XFRIDX(24) +#define XR_F25 _XFRIDX(25) +#define XR_F26 _XFRIDX(26) +#define XR_F27 _XFRIDX(27) +#define XR_F28 _XFRIDX(28) +#define XR_F29 _XFRIDX(29) +#define XR_F30 _XFRIDX(30) +#define XR_F31 _XFRIDX(31) +#define XR_FCR _XFRIDX(32) +#define XR_FID _XFRIDX(33) + + +#ifndef __ASSEMBLER__ +extern void _exc_setvector(int vectype, void *vecaddr); +extern void _exc_crash_sim(void); +extern void _exc_cache_crash_sim(void); +extern void _exc_restart(void); +extern void _exc_clear_sr_exl(void); +extern void _exc_clear_sr_erl(void); +void cfe_exception(int code,uint64_t *info); +void cfe_setup_exceptions(void); +#endif + + + + + diff --git a/cfe/cfe/arch/mips/common/include/exchandler.h b/cfe/cfe/arch/mips/common/include/exchandler.h new file mode 100644 index 0000000..af268f1 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/exchandler.h @@ -0,0 +1,85 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Exception Handler definitions File: exchandler.h + * + * Exception handler functions and constants + * + * Author: Binh Vo (binh@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _LIB_SETJMP_H +#include "lib_setjmp.h" +#endif + +#ifndef _LIB_QUEUE_H +#include "lib_queue.h" +#endif + +#define MEM_BYTE 1 +#define MEM_HALFWORD 2 +#define MEM_WORD 3 +#define MEM_QUADWORD 4 + +#define EXC_NORMAL_RETURN 0 +#define EXC_CHAIN_EXC 1 + +typedef struct jmpbuf_s { + queue_t stack; + jmp_buf jmpbuf; +} jmpbuf_t; + +typedef struct exc_handler_s { + int catch_exc; + int chain_exc; + queue_t jmpbuf_stack; +} exc_handler_t; + +extern exc_handler_t exc_handler; + +jmpbuf_t *exc_initialize_block(void); +void exc_cleanup_block(jmpbuf_t *); +void exc_cleanup_handler(jmpbuf_t *, int); +void exc_longjmp_handler(void); +int mem_peek(void*, long, int); +int mem_poke(long, uint64_t, int); + + +#define exc_try(jb) (lib_setjmp(((jb)->jmpbuf))) diff --git a/cfe/cfe/arch/mips/common/include/initdata.h b/cfe/cfe/arch/mips/common/include/initdata.h new file mode 100644 index 0000000..c5fc0d8 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/initdata.h @@ -0,0 +1,68 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Data stored in initialization module File: initdata.h + * + * This file contains data declared by the init module. It also + * contains externs for that data so we can keep the types straight. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#if defined(__ASSEMBLER__) +#define DECLARE_INITVAR(x) \ + .globl x ; \ +x: _LONG_ 0 +#else +#define DECLARE_INITVAR(x) \ + extern long x; +#endif + +DECLARE_INITVAR(mem_textreloc) +DECLARE_INITVAR(mem_textbase) +DECLARE_INITVAR(mem_textsize) +DECLARE_INITVAR(mem_totalsize) +DECLARE_INITVAR(mem_topofmem) +DECLARE_INITVAR(mem_heapstart) +DECLARE_INITVAR(mem_bottomofmem) +DECLARE_INITVAR(mem_datareloc) +DECLARE_INITVAR(cpu_prid) + + diff --git a/cfe/cfe/arch/mips/common/include/lib_hssubr.h b/cfe/cfe/arch/mips/common/include/lib_hssubr.h new file mode 100644 index 0000000..b4df439 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/lib_hssubr.h @@ -0,0 +1,84 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * "Hyperspace" access routines File: lib_hssubr.h + * + * Constants, macros, and definitions for routines to deal with + * hyperspace (beyond 256MB) on MIPS processors. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _LIB_HSSUBR_H +#define _LIB_HSSUBR_H + +/* + * If __long64 we can do this via macros. Otherwise, call + * the magic functions. + */ + +#if __long64 + +typedef long hsaddr_t; + +#define hs_write8(a,b) *((volatile uint8_t *) (a)) = (b) +#define hs_write16(a,b) *((volatile uint16_t *) (a)) = (b) +#define hs_write32(a,b) *((volatile uint32_t *) (a)) = (b) +#define hs_write64(a,b) *((volatile uint32_t *) (a)) = (b) +#define hs_read8(a) *((volatile uint8_t *) (a)) +#define hs_read16(a) *((volatile uint16_t *) (a)) +#define hs_read32(a) *((volatile uint32_t *) (a)) +#define hs_read64(a) *((volatile uint64_t *) (a)) + +#else /* not __long64 */ + +typedef long long hsaddr_t; + +extern void hs_write8(hsaddr_t a,uint8_t b); +extern void hs_write16(hsaddr_t a,uint16_t b); +extern void hs_write32(hsaddr_t a,uint32_t b); +extern void hs_write64(hsaddr_t a,uint64_t b); +extern uint8_t hs_read8(hsaddr_t a); +extern uint16_t hs_read16(hsaddr_t a); +extern uint32_t hs_read32(hsaddr_t a); +extern uint64_t hs_read64(hsaddr_t a); +#endif + +#endif diff --git a/cfe/cfe/arch/mips/common/include/lib_physio.h b/cfe/cfe/arch/mips/common/include/lib_physio.h new file mode 100644 index 0000000..00d0093 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/lib_physio.h @@ -0,0 +1,100 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Physical memory peek/poke routines File: lib_physio.h + * + * Little stub routines to allow access to arbitrary physical + * addresses. In most cases this should not be needed, as + * many physical addresses are within kseg1, but this handles + * the cases that are not automagically, so we don't need + * to mess up the code with icky macros and such. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _LIB_PHYSIO_H +#define _LIB_PHYSIO_H + +//#ifndef _SB_MIPS_H +//#include "sbmips.h" +//#endif + +/* + * If __long64 we can do this via macros. Otherwise, call + * the magic functions. + */ + +#if __long64 + +typedef long physaddr_t; +#define _PHYSADDR_T_DEFINED_ + +/*#define __UNCADDRX(x) PHYS_TO_XKSEG_UNCACHED(x)*/ +#define __UNCADDRX(x) (((physaddr_t)(x))|0x9000000000000000) + + +#define phys_write8(a,b) *((volatile uint8_t *) __UNCADDRX(a)) = (b) +#define phys_write16(a,b) *((volatile uint16_t *) __UNCADDRX(a)) = (b) +#define phys_write32(a,b) *((volatile uint32_t *) __UNCADDRX(a)) = (b) +#define phys_write64(a,b) *((volatile uint64_t *) __UNCADDRX(a)) = (b) +#define phys_read8(a) *((volatile uint8_t *) __UNCADDRX(a)) +#define phys_read16(a) *((volatile uint16_t *) __UNCADDRX(a)) +#define phys_read32(a) *((volatile uint32_t *) __UNCADDRX(a)) +#define phys_read64(a) *((volatile uint64_t *) __UNCADDRX(a)) + +#else /* not __long64 */ + +#ifdef _MIPSREGS32_ +typedef long physaddr_t; /* 32-bit-only processors can't have >32bit pa's */ +#else +typedef long long physaddr_t; /* Otherwise, they might. */ +#endif + +extern void phys_write8(physaddr_t a,uint8_t b); +extern void phys_write16(physaddr_t a,uint16_t b); +extern void phys_write32(physaddr_t a,uint32_t b); +extern void phys_write64(physaddr_t a,uint64_t b); +extern uint8_t phys_read8(physaddr_t a); +extern uint16_t phys_read16(physaddr_t a); +extern uint32_t phys_read32(physaddr_t a); +extern uint64_t phys_read64(physaddr_t a); +#endif + +#endif diff --git a/cfe/cfe/arch/mips/common/include/lib_setjmp.h b/cfe/cfe/arch/mips/common/include/lib_setjmp.h new file mode 100644 index 0000000..b673222 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/lib_setjmp.h @@ -0,0 +1,81 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * setjmp/longjmp defs File: lib_setjmp.h + * + * Description of the jmp_buf structure for setjmp and longjmp + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* + * Note that while lib_setjmp() and lib_longjmp() behave like setjmp() + * and longjmp() normally do, gcc 3.1.x (and later) assumes things about + * how setjmp() and longjmp() should work (even with -fno-builtins). We + * don't want it to do those, so these functions must be named differently. + */ + +#ifdef __ASSEMBLER__ +#define _JBIDX(x) (8*(x)) +#else +#define _JBIDX(x) (x) +#endif + + +#define JMPB_S0 _JBIDX(0) +#define JMPB_S1 _JBIDX(1) +#define JMPB_S2 _JBIDX(2) +#define JMPB_S3 _JBIDX(3) +#define JMPB_S4 _JBIDX(4) +#define JMPB_S5 _JBIDX(5) +#define JMPB_S6 _JBIDX(6) +#define JMPB_S7 _JBIDX(7) +#define JMPB_FP _JBIDX(8) +#define JMPB_SP _JBIDX(9) +#define JMPB_RA _JBIDX(10) + +#define JMPB_SIZE _JBIDX(11) + +#ifndef __ASSEMBLER__ +typedef long long jmp_buf[JMPB_SIZE]; +extern int lib_setjmp(jmp_buf); +extern void lib_longjmp(jmp_buf,int val); +#endif + diff --git a/cfe/cfe/arch/mips/common/include/mipsmacros.h b/cfe/cfe/arch/mips/common/include/mipsmacros.h new file mode 100755 index 0000000..072a5e6 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/mipsmacros.h @@ -0,0 +1,376 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * MIPS Macros File: mipsmacros.h + * + * Macros to deal with various mips-related things. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* ********************************************************************* + * 32/64-bit macros + ********************************************************************* */ + +#ifdef __long64 +#define _VECT_ .dword +#define _LONG_ .dword +#define SR sd +#define LR ld +#define ADD dadd +#define SUB dsub +#define MFC0 dmfc0 +#define MTC0 dmtc0 +#define REGSIZE 8 +#define BPWSIZE 3 /* bits per word size */ +#define _TBLIDX(x) ((x)*REGSIZE) +#else +#define _VECT_ .word +#define _LONG_ .word +#define SR sw +#define LR lw +#define ADD add +#define SUB sub +#define MFC0 mfc0 +#define MTC0 mtc0 +#define REGSIZE 4 +#define BPWSIZE 2 +#define _TBLIDX(x) ((x)*REGSIZE) +#endif + + +/* ********************************************************************* + * NORMAL_VECTOR(addr,vecname,vecdest) + * NORMAL_XVECTOR(addr,vecname,vecdest,code) + * + * Declare a trap or dispatch vector. There are two flavors, + * DECLARE_XVECTOR sets up an indentifying code in k0 before + * jumping to the dispatch routine. + * + * Input parameters: + * addr - vector address + * vecname - for label at that address + * vecdest - destination (place vector jumps to) + * code - code to place in k0 before jumping + * + * Return value: + * nothing + ********************************************************************* */ + + +#define NORMAL_VECTOR(addr,vecname,vecdest) \ + .globl vecname ; \ + .org addr ; \ +vecname: b vecdest ; \ + nop; + +#define NORMAL_XVECTOR(addr,vecname,vecdest,code) \ + .globl vecname ; \ + .org addr ; \ +vecname: b vecdest ; \ + li k0,code ; \ + nop; + + +/* ********************************************************************* + * Evil macros for bi-endian support. + * + * The magic here is in the instruction encoded as 0x10000014. + * + * This instruction in big-endian is: "b .+0x54" + * this instruction in little-endian is: "bne zero,zero,.+0x44" + * + * So, depending on what the system endianness is, it will either + * branch to .+0x54 or not branch at all. + * + * the instructions that follow are: + * + * 0x10000014 "magic branch" (either-endian) + * 0x00000000 nop (bds) (either-endian) + * 0xD0BF1A3C lui k0,0xBFD0 (little-endian) + * 0xxxxx5A27 addu k0,vector (little-endian) + * 0x08004003 jr k0 (little-endian) + * 0x00000000 nop (bds) (little-endian) + * ... space up to offset 0x54 + * ......... b vecaddr (big-endian) + * + * The idea is that the big-endian firmware is first, from 0..1MB + * in the flash, and the little-endian firmware is second, + * from 1..2MB in the flash. The little-endian firmware is + * set to load at BFD00000, so that its initial routines will + * work until relocation is completed. + * + * the instructions at the vectors will either jump to the + * big-endian or little-endian code based on system endianness. + * + * The ROM is built by compiling CFE twice, first with + * CFG_BIENDIAN=1 and CFG_LITTLE=0 (big-endian) and again + * with CFG_BIENDIAN=1 and CFG_LITTLE=1. The resulting + * cfe.bin files are located at 0xBFC00000 and 0xBFD00000 + * for big and little-endian versions, respectively. + * + * More information about how this works can be found in the + * CFE Manual. + ********************************************************************* */ + +#define __SWAPW(x) ((((x) & 0xFF) << 8) | (((x) & 0xFF00) >> 8)) + +#define BIENDIAN_VECTOR(addr,vecname,vecdest) \ + .globl vecname ; \ + .org addr ; \ +vecname: .word 0x10000014 ; \ + .word 0 ; \ + .word ((__SWAPW(BIENDIAN_LE_BASE >> 16)) << 16) | 0x1A3C ; \ + .word (0x00005A27 | (((addr) & 0xFF) << 24) | (((addr) & 0xFF00) << 8)) ; \ + .word 0x08004003 ; \ + .word 0 ; \ + .org ((addr) + 0x54) ; \ + b vecdest ; \ + nop; + +#define BIENDIAN_XVECTOR(addr,vecname,vecdest,code) \ + .globl vecname ; \ + .org addr ; \ +vecname: .word 0x10000014 ; \ + .word 0 ; \ + .word ((__SWAPW(BIENDIAN_LE_BASE >> 16)) << 16) | 0x1A3C ; \ + .word (0x00005A27 | (((addr) & 0xFF) << 24) | (((addr) & 0xFF00) << 8)) ; \ + .word 0x08004003 ; \ + .word 0 ; \ + .org ((addr) + 0x54) ; \ + b vecdest ; \ + li k0,code ; \ + nop; + + + +/* ********************************************************************* + * Declare the right versions of DECLARE_VECTOR and + * DECLARE_XVECTOR depending on how we're building stuff. + * Generally, we only use the biendian version if we're building + * as CFG_BIENDIAN=1 and we're doing the big-endian MIPS version. + ********************************************************************* */ + +#if (CFG_BIENDIAN) && defined(__MIPSEB) +#define DECLARE_VECTOR BIENDIAN_VECTOR +#define DECLARE_XVECTOR BIENDIAN_XVECTOR +#else +#define DECLARE_VECTOR NORMAL_VECTOR +#define DECLARE_XVECTOR NORMAL_XVECTOR +#endif + + + +/* ********************************************************************* + * LOADREL(reg,label) + * + * Load the address of a label, but do it in a position-independent + * way. + * + * Input parameters: + * reg - register to load + * label - label whose address to load + * + * Return value: + * ra is trashed! + ********************************************************************* */ + +#if (!(CFG_RAMAPP)) +#define LOADREL(reg,label) \ + la reg, label ; \ + la ra, 100f ; \ + sub reg, ra ; \ + .set push ; \ + .set noreorder ; \ + bal 100f ; \ + nop ; \ + .set pop ; \ +100: ; \ + addu reg, ra +#else +#define LOADREL(reg,label) \ + la reg,label +#endif + +#if (CFG_RAMAPP) +#define FIXUP(addr) +#else +#define FIXUP(addr) \ + addu addr, s6 +#endif + + + +/* ********************************************************************* + * CALLINIT_KSEG1(label,table,offset) + * CALLINIT_KSEG0(label,table,offset) + * + * Call an initialization routine (usually in another module). + * If initialization routine lives in KSEG1 it may need + * special fixing if using the cached version of CFE (this is + * the default case). CFE is linked at a KSEG0 address. + * + * Embedded PIC is especially tricky, since the "la" + * instruction expands to calculations involving GP. + * In that case, use our table of offsets to + * load the routine address from a table in memory. + * + * Input parameters: + * label - routine to call if we can call directly + * table - symbol name of table containing routine addresses + * offset - offset within the above table + * + * Return value: + * k1,ra is trashed. + ********************************************************************* */ + + +#if CFG_RUNFROMKSEG0 +/* Cached PIC code - call indirect through table */ +#define CALLINIT_KSEG1(table,tableoffset) \ + LOADREL(k1,table) ; \ + or k1,K1BASE ; \ + LR k1,tableoffset(k1) ; \ + FIXUP (k1); \ + or k1,K1BASE ; \ + jal k1 +#define CALLINIT_KSEG0(table,tableoffset) \ + LOADREL(k1,table) ; \ + LR k1,tableoffset(k1) ; \ + FIXUP (k1); \ + jal k1 +#else +/* Uncached PIC code - call indirect through table, always same KSEG */ +#define CALLINIT_KSEG1(table,tableoffset) \ + LOADREL(k1,table) ; \ + LR k1,tableoffset(k1) ; \ + FIXUP (k1); \ + jal k1 +#define CALLINIT_KSEG0 CALLINIT_KSEG1 +#endif + +/* + * CALLINIT_RELOC is used once CFE's relocation is complete and + * the "mem_textreloc" variable is set up. (yes, this is nasty.) + * If 'gp' is set, we can presume that we've relocated + * and it's safe to read "mem_textreloc", otherwise use the + * address as-is from the table. + */ + +#define CALLINIT_RELOC CALLINIT_KSEG0 + +/* ********************************************************************* + * SPIN_LOCK(lock,reg1,reg2) + * + * Acquire a spin lock. + * + * Input parameters: + * lock - symbol (address) of lock to acquire + * reg1,reg2 - registers we can use to acquire lock + * + * Return value: + * nothing (lock acquired) + ********************************************************************* */ + +#define SPIN_LOCK(lock,reg1,reg2) \ + la reg1,lock ; \ +1: sync ; \ + ll reg2,0(reg1) ; \ + bne reg2,zero,1b ; \ + li reg2,1 ; \ + sc reg2,0(reg1) ; \ + beq reg2,zero,1b ; \ + nop + +/* ********************************************************************* + * SPIN_UNLOCK(lock,reg1) + * + * Release a spin lock. + * + * Input parameters: + * lock - symbol (address) of lock to release + * reg1 - a register we can use + * + * Return value: + * nothing (lock released) + ********************************************************************* */ + + +#define SPIN_UNLOCK(lock,reg1) \ + la reg1,lock ; \ + sw zero,0(reg1) + + +/* ********************************************************************* + * SETCCAMODE(treg,mode) + * + * Set cacheability mode. For some of the pass1 workarounds we + * do this alot, so here's a handy macro. + * + * Input parameters: + * treg - temporary register we can use + * mode - new mode (K_CFG_K0COH_xxx) + * + * Return value: + * nothing + ********************************************************************* */ + +#define SETCCAMODE(treg,mode) \ + mfc0 treg,C0_CONFIG ; \ + srl treg,treg,3 ; \ + sll treg,treg,3 ; \ + or treg,treg,mode ; \ + mtc0 treg,C0_CONFIG ; \ + HAZARD + + +/* ********************************************************************* + * Declare variables + ********************************************************************* */ + +#define DECLARE_LONG(x) \ + .global x ; \ +x: _LONG_ 0 + + + + +/* + * end + */ diff --git a/cfe/cfe/arch/mips/common/include/segtable.h b/cfe/cfe/arch/mips/common/include/segtable.h new file mode 100755 index 0000000..8a003f0 --- /dev/null +++ b/cfe/cfe/arch/mips/common/include/segtable.h @@ -0,0 +1,97 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Segment Table definitions File: segtable.h + * + * The 'segment table' (bad name) is just a list of addresses + * of important stuff used during initialization. We use these + * indirections to make life less complicated during code + * relocation. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#if !defined(__ASSEMBLER__) +#define _TBLIDX(x) (x) /* C handles indexing for us */ +typedef long segtable_t; /* 32 for long32, 64 for long64 */ +#endif + +/* + * Definitions for the segment_table + */ + +#define R_SEG_ETEXT _TBLIDX(0) /* end of text segment */ +#define R_SEG_FDATA _TBLIDX(1) /* Beginning of data segment */ +#define R_SEG_EDATA _TBLIDX(2) /* end of data segment */ +#define R_SEG_END _TBLIDX(3) /* End of BSS */ +#define R_SEG_FTEXT _TBLIDX(4) /* Beginning of text segment */ +#define R_SEG_FBSS _TBLIDX(5) /* Beginning of BSS */ +#define R_SEG_GP _TBLIDX(6) /* Global Pointer */ +#define R_SEG_RELOCSTART _TBLIDX(7) /* Start of reloc table */ +#define R_SEG_RELOCEND _TBLIDX(8) /* End of reloc table */ +#define R_SEG_APIENTRY _TBLIDX(9) /* API Entry address */ + +/* + * Definitions for the init_table + */ + +#define R_INIT_EARLYINIT _TBLIDX(0) /* pointer to board_earlyinit */ +#define R_INIT_SETLEDS _TBLIDX(1) /* pointer to board_setleds */ +#define R_INIT_DRAMINFO _TBLIDX(2) /* pointer to board_draminfo */ +#define R_INIT_CPUINIT _TBLIDX(3) /* pointer tp cpuinit */ +#define R_INIT_ALTCPU_START1 _TBLIDX(4) /* pointer to altcpu_start1 */ +#define R_INIT_ALTCPU_START2 _TBLIDX(5) /* pointer to altcpu_start2 */ +#define R_INIT_ALTCPU_RESET _TBLIDX(6) /* pointer to altcpu_reset */ +#define R_INIT_CPURESTART _TBLIDX(7) /* pointer to cpurestart */ +#define R_INIT_DRAMINIT _TBLIDX(8) /* pointer to draminit */ +#define R_INIT_CACHEOPS _TBLIDX(9) /* pointer to cacheops */ +#define R_INIT_TLBHANDLER _TBLIDX(10) /* pointer to TLB fault handler */ +#define R_INIT_CMDSTART _TBLIDX(11) /* pointer to cfe_main */ +#define R_INIT_CMDRESTART _TBLIDX(12) /* pointer to cfe_cmd_restart */ +#define R_INIT_DOXREQ _TBLIDX(13) /* pointer to cfe_doxreq */ +#define R_INIT_TP1_SWITCH _TBLIDX(14) /* pointer to tp1_switch */ +#define R_INIT_SIZERAM _TBLIDX(15) /* pointer to board_sizeram */ + +/* + * Definitions for the diag_table + */ + +#define R_DIAG_TEST1 _TBLIDX(0) /* after CPU and cache init, before DRAM init */ +#define R_DIAG_TEST2 _TBLIDX(1) /* after DRAM init, before main */ diff --git a/cfe/cfe/arch/mips/common/src/Makefile b/cfe/cfe/arch/mips/common/src/Makefile new file mode 100755 index 0000000..638113d --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/Makefile @@ -0,0 +1,38 @@ + +# +# This is just a Makefile fragment -- it is included by the master +# makefile, cfe.mk +# +# This file should just append object file names to "ALLOBJS", +# but since it is mean to be linked *first*, it will append +# modules to "CRT0OBJS" +# + +ifndef INIT_MIPS +INIT_MIPS = init_mips.o +endif + +ifeq ($(strip ${CFG_RAMAPP}),1) +CRT0OBJS += init_ram.o exception.o +else +CRT0OBJS += $(INIT_MIPS) +endif + +ifeq ($(strip ${CFG_RAMAPP}),1) +ALLOBJS += lib_hssubr.o lib_setjmp.o mips_arena.o exchandler.o +ALLOBJS += dev_flash_all.o dev_flashop_engine.o +ALLOBJS += ui_memtest.o +endif + +makereg : ${TOP}/hosttools/makereg.c + gcc -o makereg ${TOP}/hosttools/makereg.c + +%.inc : %.regdef makereg + ./makereg $< $@ + +ui_soccmds.o : ${CPU_SRC}/ui_soccmds.c ${CPU}_socregs.inc + +vapi.o : ${TOP}/verif/vapi.S sb1250_socregs.inc + + + diff --git a/cfe/cfe/arch/mips/common/src/cfe_ram_cached.lds b/cfe/cfe/arch/mips/common/src/cfe_ram_cached.lds new file mode 100644 index 0000000..4b8ce87 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/cfe_ram_cached.lds @@ -0,0 +1,40 @@ +OUTPUT_ARCH(mips) +ENTRY(vec_reset) +SECTIONS +{ + . = 0x9fc00000; /* was 0x9fc00000 */ + .text : +/* AT ( 0xBFC00000 ) */ /* was 0xbfc00000 */ + { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.fini) + *(.rodata) + _etext = .; + } + + .data : + { + _fdata = ALIGN(16) ; + *(.data) + CONSTRUCTORS + . = ALIGN(16); + _gp = . + 0x8000; + *(.sdata) + } + . = ALIGN(16); + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + . = ALIGN(16); + _end = .; +} diff --git a/cfe/cfe/arch/mips/common/src/cfe_ram_uncached.lds b/cfe/cfe/arch/mips/common/src/cfe_ram_uncached.lds new file mode 100644 index 0000000..4295fe4 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/cfe_ram_uncached.lds @@ -0,0 +1,40 @@ +OUTPUT_ARCH(mips) +ENTRY(vec_reset) +SECTIONS +{ + . = 0xbfc00000; /* was 0x9fc00000 */ + .text : +/* AT ( 0xBFC00000 ) */ /* was 0xbfc00000 */ + { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.fini) + *(.rodata) + _etext = .; + } + + .data : + { + _fdata = ALIGN(16) ; + *(.data) + CONSTRUCTORS + . = ALIGN(16); + _gp = . + 0x8000; + *(.sdata) + } + . = ALIGN(16); + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + . = ALIGN(16); + _end = .; +} diff --git a/cfe/cfe/arch/mips/common/src/cfe_ramapp.lds b/cfe/cfe/arch/mips/common/src/cfe_ramapp.lds new file mode 100755 index 0000000..5a7a377 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/cfe_ramapp.lds @@ -0,0 +1,41 @@ +OUTPUT_ARCH(mips) +ENTRY(vec_reset) +SECTIONS +{ + . = 0x80601000; + .text : + { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.fini) + *(.rodata) + *(.rodata.str1.4) + *(.gnu.linkonce.r.*) + _etext = .; + } + + .data : + { + _fdata = ALIGN(16) ; + *(.data) + CONSTRUCTORS + . = ALIGN(16); + _gp = . + 0x8000; + *(.sdata) + } + . = ALIGN(16); + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + . = ALIGN(16); + _end = .; +} diff --git a/cfe/cfe/arch/mips/common/src/cfe_rom_cached.lds b/cfe/cfe/arch/mips/common/src/cfe_rom_cached.lds new file mode 100755 index 0000000..2ca1353 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/cfe_rom_cached.lds @@ -0,0 +1,40 @@ +OUTPUT_ARCH(mips) +ENTRY(vec_reset) +SECTIONS +{ + . = 0x80000000; + .text : + { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.fini) + *(.rodata) + _etext = .; + } + + .data : + { + _fdata = ALIGN(16) ; + *(.data) + CONSTRUCTORS + . = ALIGN(16); + _gp = . + 0x8000; + *(.sdata) + } + . = ALIGN(16); + _edata = .; + .reginfo : {} + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + . = ALIGN(16); + _end = .; +} diff --git a/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_cached.lds b/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_cached.lds new file mode 100644 index 0000000..ee94831 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_cached.lds @@ -0,0 +1,43 @@ +OUTPUT_ARCH(mips) +ENTRY(vec_reset) +SECTIONS +{ + . = 0x9FC00000; + .text : + AT ( 0xBFC00000 ) + { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + *(.rodata) + _etext = .; + } + .data 0x80001000 : + AT ( ((ADDR(.text)|0xB0000000) + SIZEOF ( .text ) + 15) & 0xFFFFFFF0) + { + _gp = ALIGN(16) + 0x8000; + _fdata = .; + *(.rdata) + *(.data) + CONSTRUCTORS + *(.sdata) + } + . = ALIGN(16); + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + . = ALIGN(16); + _end = .; +} diff --git a/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_cached_biendian.lds b/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_cached_biendian.lds new file mode 100644 index 0000000..78421a4 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_cached_biendian.lds @@ -0,0 +1,49 @@ +/* + * This linker script is exactly the same as cfe_rom_reloc_cached.lds + * except our start address is at BFD00000, 1MB into the + * ROM. We locate the little-endian version of CFE at this address + * in bi-endian ROM support. + */ +OUTPUT_ARCH(mips) +ENTRY(vec_reset) +SECTIONS +{ + . = 0x9FD00000; + .text : + AT ( 0xBFD00000 ) + { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + *(.rodata) + _etext = .; + } + .data 0x80001000 : + AT ( ((ADDR(.text)|0xB0000000) + SIZEOF ( .text ) + 15) & 0xFFFFFFF0) + { + _gp = ALIGN(16) + 0x8000; + _fdata = .; + *(.rdata) + *(.data) + CONSTRUCTORS + *(.sdata) + } + . = ALIGN(16); + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + . = ALIGN(16); + _end = .; +} diff --git a/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_uncached.lds b/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_uncached.lds new file mode 100644 index 0000000..0c62889 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/cfe_rom_reloc_uncached.lds @@ -0,0 +1,41 @@ +OUTPUT_ARCH(mips) +ENTRY(vec_reset) +SECTIONS +{ + . = 0xBFC00000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + *(.rodata) + _etext = .; + } + .data 0xA0001000 : + AT ( ((ADDR(.text)|0xB0000000) + SIZEOF ( .text ) + 15) & 0xFFFFFFF0) + { + _gp = ALIGN(16) + 0x8000; + _fdata = .; + *(.rdata) + *(.data) + CONSTRUCTORS + *(.sdata) + } + . = ALIGN(16); + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + . = ALIGN(16); + _end = .; +} diff --git a/cfe/cfe/arch/mips/common/src/cfe_rom_uncached.lds b/cfe/cfe/arch/mips/common/src/cfe_rom_uncached.lds new file mode 100644 index 0000000..a0362ba --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/cfe_rom_uncached.lds @@ -0,0 +1,39 @@ +OUTPUT_ARCH(mips) +ENTRY(vec_reset) +SECTIONS +{ + . = 0xBFC00000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.fini) + *(.rodata) + _etext = .; + } + + .data 0xA1F00000 : + AT ( ((ADDR(.text)|0xB0000000) + SIZEOF ( .text ) + 15) & 0xFFFFFFF0) + { + _fdata = ALIGN(16) ; + *(.data) + CONSTRUCTORS + . = ALIGN(16); + _gp = . + 0x8000; + *(.sdata) + } + . = ALIGN(16); + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + . = ALIGN(16); + _end = .; +} diff --git a/cfe/cfe/arch/mips/common/src/dev_flash_all.S b/cfe/cfe/arch/mips/common/src/dev_flash_all.S new file mode 100644 index 0000000..6dbb581 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/dev_flash_all.S @@ -0,0 +1,220 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash "self-write" module File: flash_write_all.S + * + * This module takes care of the case of writing to the flash + * memory that CFE is currently reading its code from. It is + * assumed that you'll be doing a complete flash update, + * so this code erases the affected sectors, reprograms them, + * and jumps to the boot sector. + * + * Note: this code is written to be position-independent, even + * for non-PIC versions of CFE! It will be copied (with memcpy) + * into the heap for execution. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "sbmips.h" +#include "dev_flash.h" +#include "mipsmacros.h" + +#define WRITEFLASH(base,offset,value) \ + li t0,value ; \ + sb t0,offset(base) + + +/* ********************************************************************* + * flash_write_all(data,flashbase,size,secsize) + * + * Write bytes to flash, erasing affected sectors first. + * + * Input parameters: + * a0 - data - pointer to data to write + * a1 - flashbase - base (phys addr) of flash area + * a2 - size - number of bytes to write + * a3 - secsize - flash sector size + * + * Return value: + * does not return + ********************************************************************* */ + +#define data a0 +#define flashbase a1 +#define datasize a2 +#define secsize a3 + +#define secidx t4 +#define secptr t5 + +LEAF(flash_write_all) + + /* + * Mask all interrupts. An exception with BEV set would be very bad. + */ + + mfc0 v0,C0_SR # Get current interrupt flag + li v1,M_SR_IE # master interrupt control + not v1 # disable interrupts + and v0,v1 # SR now has IE=0 + mtc0 v0,C0_SR # put back into CP0 + + /* + * Get KSEG1 addr of flash + */ + + or flashbase,K1BASE + + + /* + * Do an "unlock write" sequence (cycles 1-2) + */ + + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* + * send the erase command (cycle 3) + */ + + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_ERASE_3) + + /* + * Do an "unlock write" sequence (cycles 4-5) + */ + + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* + * Send the "erase all" qualifier (cycle 6) + */ + + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_ERASE_ALL_6) + + /* + * Wait for the erase to complete + */ + +1: lb t0,0(secptr) # get byte + and t0,0xFF # test hi byte + bne t0,0xFF,1b # go till bit is set + + + /* + * Okay, now loop through the bytes and write them to the + * flash. + */ + + move secptr,flashbase + move secidx,datasize + +proglp: + + /* + * Do an "unlock write" sequence + */ + + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* + * Send a program command + */ + WRITEFLASH(flashbase,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_PROGRAM) + + /* + * Write a byte + */ + + lbu t0,0(data) + sb t0,0(secptr) # t0 = byte written to flash + + + /* + * Wait for write to complete + */ + +1: lbu t2,0(secptr) # t2 = byte from flash + + and t1,t2,0x80 # done if bit7 of flash + and t0,t0,0x80 # is same as bit7 of data + beq t1,t0,2f + + and t1,t2,0x20 # not done if bit5 + bne t1,0x20,1b # is still set +2: + + /* + * next byte... + */ + + add a0,1 # next source byte + add secptr,1 # next dest byte + sub datasize,1 # one less count + bgt datasize,0,proglp + + /* + * All done, reboot system + */ + + li v0,0xBFC00000 + j v0 + +flash_write_all_end: + nop + +END(flash_write_all) + +/* ********************************************************************* + * Data + ********************************************************************* */ + + .sdata + + .globl flash_write_all_ptr + .globl flash_write_all_len + +flash_write_all_ptr: + _VECT_ flash_write_all +flash_write_all_len: + .word flash_write_all_end-flash_write_all + + diff --git a/cfe/cfe/arch/mips/common/src/dev_flashop_engine.S b/cfe/cfe/arch/mips/common/src/dev_flashop_engine.S new file mode 100644 index 0000000..29ade6a --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/dev_flashop_engine.S @@ -0,0 +1,695 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash "self-write" module File: dev_flashop_engine.S + * + * This module takes care of the case of writing to the flash + * memory that CFE is currently reading its code from. + * + * Note: this code is written to be position-independent, even + * for non-PIC versions of CFE! It will be copied (with memcpy) + * into the heap for execution. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "sbmips.h" +#include "mipsmacros.h" + +#include "bsp_config.h" +#include "dev_newflash.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define FLASHCMD_8(base,offset,value) \ + li t0,value ; \ + sb t0,offset(base) + +#define FLASHCMD_16(base,offset,value) \ + li t0,value ; \ + sh t0,((offset)<<1)(base) + +#define FLASHCMD_16B(base,offset,value) \ + li t0,value ; \ + sb t0,((offset)<<1)(base) + + +/* ********************************************************************* + * flashop_engine + * + * This routine is written in a PIC method to allow us to do + * flash operations without any help from CFE. We need to do + * this when we're not relocated and want to muck with the + * flash we're running from. + * + * This routine follows some simple instructions in a table, + * so you can batch up the operations in one place. + * + * Input parameters: + * a0 - pointer to instruction list + * + * Return value: + * v0 - 0 if all instructions succeeded + * else less than zero, # of failing instructions + ********************************************************************* */ + + .text + +#define reg_op t3 +#define reg_base t4 +#define reg_dest t5 +#define reg_src t6 +#define reg_cnt t7 + +LEAF(flashop_engine) + +instloop: LR reg_op,FEINST_OP(a0) /* Load instruction */ + LR reg_base,FEINST_BASE(a0) + LR reg_dest,FEINST_DEST(a0) + LR reg_src,FEINST_SRC(a0) + LR reg_cnt,FEINST_CNT(a0) + li v0,0 /* total of result values */ + li v1,0 /* result for this function */ + +#ifdef __long64 + dli t0,0x9000000000000000 /* uncached - XKPHYS */ + or reg_base,t0 /* so we can access flash beyond KSEG */ +#else + or reg_base,K1BASE /* 32-bit, regular KSEG */ +#endif + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + bne reg_op,FEOP_RETURN,99f /* Return to main prog */ + + j ra +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_REBOOT,99f /* restart system */ + + li t0,0xBFC00000 /* jump to boot vector */ + j t0 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_READ8,99f /* Read, 8-bit mode */ + + ADD reg_src,reg_src,reg_base + +1: lbu t0,0(reg_src) /* Copy user data */ + sb t0,0(reg_dest) + ADD reg_src,1 + add reg_dest,1 + sub reg_cnt,1 + bgt reg_cnt,zero,1b + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_READ16,99f /* Read, 16-bit mode */ + + ADD reg_src,reg_src,reg_base + + li t0,1 /* test bottom bit */ + and t0,t0,reg_src /* t0 == 1 if odd */ + beq t0,zero,1f /* no odd byte to worry about */ + + SUB reg_src,reg_src,t0 /* make even value */ + lh t0,0(reg_src) /* interesting byte is odd */ +#ifdef __MIPSEB + sb t0,0(reg_dest) /* interesting byte in low 8 bits */ +#else + srl t0,t0,8 /* little endian */ + sb t0,0(reg_dest) /* interesting byte is high 8 bits */ +#endif + + ADD reg_src,2 /* advance one word (we made addr even above) */ + add reg_dest,1 /* dest always written by bytes */ + sub reg_cnt,1 + +1: beq reg_cnt,zero,nextinst + + lh t0,0(reg_src) /* Copy user data */ + +#ifdef __MIPSEB + sb t0,1(reg_dest) /* Big endian to memory */ + srl t0,t0,8 /* t0 = 0x1234 -> 0x12 0x34 */ + sb t0,0(reg_dest) +#else + sb t0,0(reg_dest) /* little endian */ + srl t0,t0,8 /* t0 = 0x1234 -> 0x34 0x12 */ + sb t0,1(reg_dest) +#endif + + ADD reg_src,2 + add reg_dest,2 + sub reg_cnt,2 + bgt reg_cnt,1,1b + + beq reg_cnt,zero,nextinst /* no straggler */ + + lh t0,0(reg_src) /* interesting byte is odd */ +#ifdef __MIPSEB + srl t0,t0,8 /* little endian */ + sb t0,0(reg_dest) /* interesting byte in high 8 bits */ +#else + sb t0,0(reg_dest) /* interesting byte is low 8 bits */ +#endif + + b nextinst +/* CFI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#if (FLASH_DRIVERS & FLASH_DRIVER_CFI) +99: bne reg_op,FEOP_CFIQUERY8,99f /* CFI Query 8-bit */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_8(reg_base,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_MODE) + +1: lbu t0,0(reg_src) /* Copy CFI data */ + sb t0,0(reg_dest) + ADD reg_src,1 + add reg_dest,1 + sub reg_cnt,1 + bgt reg_cnt,zero,1b + + FLASHCMD_8(reg_base,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_EXIT) + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_CFIQUERY16,99f /* CFI Query 16-bit in word mode */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_16(reg_base,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_MODE) + +1: lh t0,0(reg_src) /* Copy CFI data */ + sh t0,0(reg_dest) + ADD reg_src,2 + add reg_dest,2 + sub reg_cnt,2 + bgt reg_cnt,zero,1b + + FLASHCMD_16(reg_base,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_EXIT) + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_CFIQUERY16B,99f /* CFI Query 16-bit in byte mode */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_16B(reg_base,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_MODE) + +1: lb t0,0(reg_src) /* Copy CFI data */ + sb t0,0(reg_dest) + ADD reg_src,1 + add reg_dest,1 + sub reg_cnt,1 + bgt reg_cnt,zero,1b + + FLASHCMD_16B(reg_base,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_EXIT) + + b nextinst +#endif + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_MEMCPY,99f /* Generic memcpy */ + +1: lbu t0,0(reg_src) + sb t0,0(reg_dest) + add reg_src,1 + add reg_dest,1 + sub reg_cnt,1 + bgt reg_cnt,zero,1b + + b nextinst + + +/* AMD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#if (FLASH_DRIVERS & FLASH_DRIVER_AMD) +99: bne reg_op,FEOP_AMD_ERASE8,99f /* AMD erase (8-bit) */ + + ADD reg_dest,reg_dest,reg_base + + /* Do an "unlock write" sequence (cycles 1-2) */ + + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* send the erase command (cycle 3) */ + + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_ERASE_3) + + /* Do an "unlock write" sequence (cycles 4-5) */ + + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* Send the "erase sector" qualifier (cycle 6) */ + + FLASHCMD_8(reg_dest,0,AMD_FLASH_ERASE_SEC_6) + + /* Wait for the erase to complete */ + +1: lb t0,0(reg_dest) # get byte + and t0,0xFF # test hi byte + bne t0,0xFF,1b # go till bit is set + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_ERASE16,99f /* AMD erase (16-bit in word mode) */ + + ADD reg_dest,reg_dest,reg_base + + /* Do an "unlock write" sequence (cycles 1-2) */ + + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* send the erase command (cycle 3) */ + + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_ERASE_3) + + /* Do an "unlock write" sequence (cycles 4-5) */ + + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* Send the "erase sector" qualifier (cycle 6) */ + + FLASHCMD_16(reg_dest,0,AMD_FLASH_ERASE_SEC_6) + + /* Wait for the erase to complete */ + +1: lh t0,0(reg_dest) # get word + and t0,0xFF # test byte + bne t0,0xFF,1b # go till erased + + b nextinst + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_ERASE16B,99f /* AMD erase (16-bit in byte mode) */ + + ADD reg_dest,reg_dest,reg_base + + /* Do an "unlock write" sequence (cycles 1-2) */ + + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* send the erase command (cycle 3) */ + + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_ERASE_3) + + /* Do an "unlock write" sequence (cycles 4-5) */ + + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* Send the "erase sector" qualifier (cycle 6) */ + + FLASHCMD_16B(reg_dest,0,AMD_FLASH_ERASE_SEC_6) + + /* Wait for the erase to complete */ + +1: lh t0,0(reg_dest) # get word + and t0,0xFF # test byte + bne t0,0xFF,1b # go till erased + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_PGM8,99f /* AMD 8-bit program */ + + ADD reg_dest,reg_dest,reg_base + + /* Do an "unlock write" sequence (cycles 1-2) */ +11: + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* Send a program command (cycle 3) */ + + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_PROGRAM) + + /* Write a byte (cycle 4) */ + + lbu t0,0(reg_src) + sb t0,0(reg_dest) # t0 = byte written to flash + + /* Wait for write to complete */ + +1: lbu t2,0(reg_dest) # t2 = byte from flash + + and t1,t2,0x80 # done if bit7 of flash + and t0,t0,0x80 # is same as bit7 of data + beq t1,t0,2f + + and t1,t2,0x20 # not done if bit5 + bne t1,0x20,1b # is still set +2: + + /* next byte... */ + + add reg_src,1 # next source byte + ADD reg_dest,1 # next dest byte + sub reg_cnt,1 # one less count + bgt reg_cnt,0,11b + + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_PGM16,99f /* AMD 16-bit program */ + + ADD reg_dest,reg_dest,reg_base + + /* Do an "unlock write" sequence (cycles 1-2) */ +11: + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* Send a program command (cycle 3) */ + + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_PROGRAM) + + /* Write a byte (cycle 4) */ + + lh t0,0(reg_src) + sh t0,0(reg_dest) # t0 = byte written to flash + + /* Wait for write to complete */ + +1: lh t2,0(reg_dest) # t2 = byte from flash + + and t1,t2,0x80 # done if bit7 of flash + and t0,t0,0x80 # is same as bit7 of data + beq t1,t0,2f + + and t1,t2,0x20 # not done if bit5 + bne t1,0x20,1b # is still set +2: + + /* next byte... */ + + add reg_src,2 # next source word + ADD reg_dest,2 # next dest word + sub reg_cnt,2 # one less count + bgt reg_cnt,0,11b + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_PGM16B,99f /* AMD 16-bit pgm in 8-bit mode */ + + ADD reg_dest,reg_dest,reg_base + + /* Do an "unlock write" sequence (cycles 1-2) */ +11: + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + + /* Send a program command (cycle 3) */ + + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_PROGRAM) + + /* Write a byte (cycle 4) */ + + lb t0,0(reg_src) + sb t0,0(reg_dest) # t0 = byte written to flash + + /* Wait for write to complete */ + +1: lb t2,0(reg_dest) # t2 = byte from flash + + and t1,t2,0x80 # done if bit7 of flash + and t0,t0,0x80 # is same as bit7 of data + beq t1,t0,2f + + and t1,t2,0x20 # not done if bit5 + bne t1,0x20,1b # is still set +2: + + /* next byte... */ + + add reg_src,1 # next source word + ADD reg_dest,1 # next dest word + sub reg_cnt,1 # one less count + bgt reg_cnt,0,11b + + b nextinst + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_DEVCODE8,99f /* AMD 8-bit - Boot Block Location */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_AUTOSEL) + + lbu t0,AMD_FLASH_DEVCODE8(reg_src) + sb t0,0(reg_dest) + li t0,AMD_FLASH_RESET + sb t0,0(reg_src) + + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_DEVCODE16,99f /* AMD 8-bit - Boot Block Location */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_AUTOSEL) + + lw t0,0(reg_src) +#ifdef __MIPSEB + srl t0,t0,8 /* ((3-AMD_FLASH_DEVCODE16)*8) */ +#else + srl t0,t0,16 /* (AMD_FLASH_DEVCODE16*8) */ +#endif + sb t0,0(reg_dest) + li t0,AMD_FLASH_RESET + sb t0,0(reg_src) + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_DEVCODE16B,99f /* AMD 8-bit - Boot Block Location */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_AUTOSEL) + + lw t0,0(reg_src) +#ifdef __MIPSEB +#else + srl t0,t0,16 /* (AMD_FLASH_DEVCODE16B*8)*/ +#endif + + sb t0,0(reg_dest) + li t0,AMD_FLASH_RESET + sb t0,0(reg_src) + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_MANID8,99f /* AMD 8-bit - Boot Block Location */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + FLASHCMD_8(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_AUTOSEL) + + lbu t0,AMD_FLASH_MANID(reg_src) + sb t0,0(reg_dest) + li t0,AMD_FLASH_RESET + sb t0,0(reg_src) + + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_MANID16,99f /* AMD 8-bit - Boot Block Location */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + FLASHCMD_16(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_AUTOSEL) + + lw t0,0(reg_src) +#ifdef __MIPSEB + srl t0,t0,((3-AMD_FLASH_MANID)*8) +#else + srl t0,t0,(AMD_FLASH_MANID*8) +#endif + sb t0,0(reg_dest) + li t0,AMD_FLASH_RESET + sb t0,0(reg_src) + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_AMD_MANID16B,99f /* AMD 8-bit - Boot Block Location */ + + ADD reg_src,reg_src,reg_base + + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1) + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2) + FLASHCMD_16B(reg_base,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_AUTOSEL) + + lbu t0,AMD_FLASH_MANID(reg_src) + + sb t0,0(reg_dest) + li t0,AMD_FLASH_RESET + sb t0,0(reg_src) + + b nextinst + +#endif + +/* INTEL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#if (FLASH_DRIVERS & FLASH_DRIVER_INTEL) +99: bne reg_op,FEOP_INTEL_ERASE8,99f /* Intel erase 8-bit */ + + ADD reg_dest,reg_dest,reg_base + + FLASHCMD_8(reg_dest,0,INTEL_FLASH_ERASE_BLOCK) + FLASHCMD_8(reg_dest,0,INTEL_FLASH_ERASE_CONFIRM) + +1: lbu t0,0(reg_dest) /* loop till bit 7 is set */ + andi t0,0x80 + beq t0,zero,1b + + FLASHCMD_8(reg_dest,0,INTEL_FLASH_READ_MODE) + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_INTEL_ERASE16,99f /* Intel erase 16-bit */ + + ADD reg_dest,reg_dest,reg_base + +/* XXX copy of 8-bit erase, is this right? */ + + FLASHCMD_8(reg_dest,0,INTEL_FLASH_ERASE_BLOCK) + FLASHCMD_8(reg_dest,0,INTEL_FLASH_ERASE_CONFIRM) + +1: lbu t0,0(reg_dest) /* loop till bit 7 is set */ + andi t0,0x80 + beq t0,zero,1b + + FLASHCMD_8(reg_dest,0,INTEL_FLASH_READ_MODE) + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_INTEL_PGM8,99f /* Intel 8-bit program */ + + ADD reg_dest,reg_dest,reg_base + +11: FLASHCMD_8(reg_dest,0,INTEL_FLASH_PROGRAM) + + lbu t0,0(reg_src) + sb t0,0(reg_dest) + +1: lbu t0,0(reg_dest) /* loop till bit 7 is set */ + andi t0,0x80 + beq t0,zero,1b + + lbu t0,0(reg_dest) /* contains final result */ + /* If good, bits 1, 3, 4 will not be set */ + + add reg_src,1 + ADD reg_dest,1 + sub reg_cnt,1 + bgt reg_cnt,zero,11b + + FLASHCMD_8(reg_dest,0,INTEL_FLASH_READ_MODE) + + b nextinst +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: bne reg_op,FEOP_INTEL_PGM16,99f /* Intel 16-bit prog */ + + ADD reg_dest,reg_dest,reg_base + +11: FLASHCMD_16(reg_dest,0,INTEL_FLASH_PROGRAM) + + lh t0,0(reg_src) + sh t0,0(reg_dest) + +1: lh t0,0(reg_dest) /* loop till bit 7 is set */ + andi t0,0x80 + beq t0,zero,1b + + lh t0,0(reg_dest) /* contains final result */ + /* If good, bits 1, 3, 4 will not be set */ + + add reg_src,2 + ADD reg_dest,2 + sub reg_cnt,2 + bgt reg_cnt,zero,11b + + FLASHCMD_16(reg_dest,0,INTEL_FLASH_READ_MODE) + + b nextinst +#endif +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +99: li v1,-1 /* invalid command */ + +nextinst: SR v1,FEINST_RESULT(a0) /* store result of instruction */ + ADD v0,v0,v1 /* add to total */ + ADD a0,FEINST_SIZE /* advance to next instr. */ + b instloop + +flashop_engine_end: + nop + +END(flashop_engine) + + .sdata + + .globl flashop_engine_ptr + .globl flashop_engine_len + +flashop_engine_ptr: + _VECT_ flashop_engine +flashop_engine_len: + .word flashop_engine_end-flashop_engine + + + +/* ********************************************************************* + * end + ********************************************************************* */ + + diff --git a/cfe/cfe/arch/mips/common/src/disasm.c b/cfe/cfe/arch/mips/common/src/disasm.c new file mode 100644 index 0000000..1b76fee --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/disasm.c @@ -0,0 +1,2111 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * MIPS disassembler File: disasm.c + * + * MIPS disassembler (used by ui_examcmds.c) + * + * Author: Justin Carlson (carlson@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "disasm.h" +#include "lib_printf.h" + +#define UINT64_T(x) ((uint64_t) (x)) +#define PF_64 "ll" +#define PF_32 "" +/* These aren't guaranteed to be portable, either */ +#define SEXT_32(bit, val) \ + ((((int32_t)(val))<<(31-(bit)))>>(31-(bit))) +#define SEXT_64(bit, val) \ + ((((int64_t)(val))<<(63-(bit)))>>(63-(bit))) + +#define DATASEG __attribute__ ((section(".text"))) + + +#define REGNAME(r) (&_regnames[(r)*5]) +static const char * const _regnames = + "zero\0" + "AT\0 " + "v0\0 " + "v1\0 " + "a0\0 " + "a1\0 " + "a2\0 " + "a3\0 " + "t0\0 " + "t1\0 " + "t2\0 " + "t3\0 " + "t4\0 " + "t5\0 " + "t6\0 " + "t7\0 " + "s0\0 " + "s1\0 " + "s2\0 " + "s3\0 " + "s4\0 " + "s5\0 " + "s6\0 " + "s7\0 " + "t8\0 " + "t9\0 " + "k0\0 " + "k1\0 " + "gp\0 " + "sp\0 " + "fp\0 " + "ra\0 "; + +#define CP0REGNAME(r) (&_cp0names[(r)*12]) +static const char * const _cp0names = + "C0_INX\0 " + "C0_RAND\0 " + "C0_TLBLO0\0 " + "C0_TLBLO1\0 " + + "C0_CTEXT\0 " + "C0_PGMASK\0 " + "C0_WIRED\0 " + "C0_reserved\0" + + "C0_BADVADDR\0" + "C0_COUNT\0 " + "C0_TLBHI\0 " + "C0_COMPARE\0 " + + "C0_SR\0 " + "C0_CAUSE\0 " + "C0_EPC\0 " + "C0_PRID\0 " + + "C0_CONFIG\0 " + "C0_LLADDR\0 " + "C0_WATCHLO\0 " + "C0_WATCHHI\0 " + + "C0_XCTEXT\0 " + "C0_reserved\0" + "C0_reserved\0" + "C0_reserved\0" + + "C0_reserved\0" + "C0_reserved\0" + "C0_reserved\0" + "C0_reserved\0" + + "C0_TAGLO\0 " + "C0_TAGHI\0 " + "C0_ERREPC\0 " + "C0_reserved\0"; + + + +/* + * MIPS instruction set disassembly module. + */ + +typedef enum { + DC_RD_RS_RT, + DC_RD_RT_RS, + DC_RT_RS_SIMM, + DC_RT_RS_XIMM, + DC_RS_RT_OFS, + DC_RS_OFS, + DC_RD_RT_SA, + DC_RT_UIMM, + DC_RD, + DC_J, + DC_RD_RS, + DC_RS_RT, + DC_RT_RS, + DC_RT_RD_SEL, + DC_RT_CR_SEL, + DC_RS, + DC_RS_SIMM, + DC_RT_OFS_BASE, + DC_FT_OFS_BASE, + DC_FD_IDX_BASE, + DC_FS_IDX_BASE, + DC_FD_FS_FT, + DC_FD_FS_RT, + DC_FD_FS, + DC_PREF_OFS, + DC_PREF_IDX, + DC_CC_OFS, + DC_FD_FS_CC, + DC_RD_RS_CC, + DC_FD_FR_FS_FT, + DC_FD_FS_FT_RS, + DC_CC_FS_FT, + DC_BARE, + DC_RT_FS, + DC_SYSCALL, + DC_BREAK, + DC_VD_VS_VT_VEC, + DC_VD_VS_VT, + DC_VS_VT, + DC_VS_VT_VEC, + DC_VD_VS_VT_RS, + DC_VD_VS_VT_IMM, + DC_VD_VT, + DC_VD, + DC_VS, + DC_DEREF, + DC_OOPS +} DISASM_CLASS; + + + + +/* We're pulling some trickery here. Most of the time, this structure operates + exactly as one would expect. The special case, when type == DC_DREF, + means name points to a byte that is an index into a dereferencing array. */ + +/* + * To make matters worse, the whole module has been coded to reduce the + * number of relocations present, so we don't actually store pointers + * in the dereferencing array. Instead, we store fixed-width strings + * and use digits to represent indicies into the deref array. + * + * This is all to make more things fit in the relocatable version, + * since every initialized pointer goes into our small data segment. + */ + +typedef struct { + char name[15]; + char type; +} disasm_t; + +typedef struct { + const disasm_t *ptr; + int shift; + uint32_t mask; +} disasm_deref_t; + +/* Forward declaration of deref array, we need this for the disasm_t definitions */ + + +extern const disasm_deref_t disasm_deref[]; + +static const disasm_t disasm_normal[64] DATASEG = +{{"$1" , DC_DEREF }, + {"$2" , DC_DEREF }, + {"j" , DC_J }, + {"jal" , DC_J }, + {"beq" , DC_RS_RT_OFS }, + {"bne" , DC_RS_RT_OFS }, + {"blez" , DC_RS_OFS }, + {"bgtz" , DC_RS_OFS }, + {"addi" , DC_RT_RS_SIMM }, + {"addiu" , DC_RT_RS_SIMM }, + {"slti" , DC_RT_RS_SIMM }, + {"sltiu" , DC_RT_RS_SIMM }, + {"andi" , DC_RT_RS_XIMM }, + {"ori" , DC_RT_RS_XIMM }, + {"xori" , DC_RT_RS_XIMM }, + {"lui" , DC_RT_UIMM }, + {"$4" , DC_DEREF }, + {"$6" , DC_DEREF }, + {"invalid" , DC_BARE }, + {"$15" , DC_DEREF }, + {"beql" , DC_RS_RT_OFS }, + {"bnel" , DC_RS_RT_OFS }, + {"blezl" , DC_RS_OFS }, + {"bgtzl" , DC_RS_OFS }, + {"daddi" , DC_RT_RS_SIMM }, + {"daddiu" , DC_RT_RS_SIMM }, + {"ldl" , DC_RT_OFS_BASE }, + {"ldr" , DC_RT_OFS_BASE }, + {"$3" , DC_DEREF }, + {"invalid" , DC_BARE }, + {"$18" , DC_DEREF }, + {"invalid" , DC_BARE }, + {"lb" , DC_RT_OFS_BASE }, + {"lh" , DC_RT_OFS_BASE }, + {"lwl" , DC_RT_OFS_BASE }, + {"lw" , DC_RT_OFS_BASE }, + {"lbu" , DC_RT_OFS_BASE }, + {"lhu" , DC_RT_OFS_BASE }, + {"lwr" , DC_RT_OFS_BASE }, + {"lwu" , DC_RT_OFS_BASE }, + {"sb" , DC_RT_OFS_BASE }, + {"sh" , DC_RT_OFS_BASE }, + {"swl" , DC_RT_OFS_BASE }, + {"sw" , DC_RT_OFS_BASE }, + {"sdl" , DC_RT_OFS_BASE }, + {"sdr" , DC_RT_OFS_BASE }, + {"swr" , DC_RT_OFS_BASE }, + {"cache" , DC_BARE }, + {"ll" , DC_RT_OFS_BASE }, + {"lwc1" , DC_FT_OFS_BASE }, + {"invalid" , DC_BARE }, + {"pref" , DC_PREF_OFS }, + {"lld" , DC_RT_OFS_BASE }, + {"ldc1" , DC_FT_OFS_BASE }, + {"invalid" , DC_BARE }, + {"ld" , DC_RT_OFS_BASE }, + {"sc" , DC_RT_OFS_BASE }, + {"swc1" , DC_FT_OFS_BASE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"scd" , DC_RT_OFS_BASE }, + {"sdc1" , DC_FT_OFS_BASE }, + {"invalid" , DC_BARE }, + {"sd" , DC_RT_OFS_BASE }}; + +static const disasm_t disasm_special[64] DATASEG = +{{"sll" , DC_RD_RT_SA }, + {"$16" , DC_DEREF }, + {"srl" , DC_RD_RT_SA }, + {"sra" , DC_RD_RT_SA }, + {"sllv" , DC_RD_RT_RS }, + {"invalid" , DC_BARE }, + {"srlv" , DC_RD_RT_RS }, + {"srav" , DC_RD_RT_RS }, + {"jr" , DC_RS }, + {"jalr" , DC_RD_RS }, + {"movz" , DC_RD_RS_RT }, + {"movn" , DC_RD_RS_RT }, + {"syscall" , DC_SYSCALL }, + {"break" , DC_BREAK }, + {"invalid" , DC_BARE }, + {"sync" , DC_BARE }, + {"mfhi" , DC_RD }, + {"mthi" , DC_RS }, + {"mflo" , DC_RD }, + {"mtlo" , DC_RS }, + {"dsllv" , DC_RD_RT_RS }, + {"invalid" , DC_BARE }, + {"dsrlv" , DC_RD_RT_RS }, + {"dsrav" , DC_RD_RT_RS }, + {"mult" , DC_RS_RT }, + {"multu" , DC_RS_RT }, + {"div" , DC_RS_RT }, + {"divu" , DC_RS_RT }, + {"dmult" , DC_RS_RT }, + {"dmultu" , DC_RS_RT }, + {"ddiv" , DC_RS_RT }, + {"ddivu" , DC_RS_RT }, + {"add" , DC_RD_RS_RT }, + {"addu" , DC_RD_RS_RT }, + {"sub" , DC_RD_RS_RT }, + {"subu" , DC_RD_RS_RT }, + {"and" , DC_RD_RS_RT }, + {"or" , DC_RD_RS_RT }, + {"xor" , DC_RD_RS_RT }, + {"nor" , DC_RD_RS_RT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"slt" , DC_RD_RS_RT }, + {"sltu" , DC_RD_RS_RT }, + {"dadd" , DC_RD_RS_RT }, + {"daddu" , DC_RD_RS_RT }, + {"dsub" , DC_RD_RS_RT }, + {"dsubu" , DC_RD_RS_RT }, + {"tge" , DC_RS_RT }, + {"tgeu" , DC_RS_RT }, + {"tlt" , DC_RS_RT }, + {"tltu" , DC_RS_RT }, + {"teq" , DC_RS_RT }, + {"invalid" , DC_BARE }, + {"tne" , DC_RS_RT }, + {"invalid" , DC_BARE }, + {"dsll" , DC_RD_RT_SA }, + {"invalid" , DC_BARE }, + {"dsrl" , DC_RD_RT_SA }, + {"dsra" , DC_RD_RT_SA }, + {"dsll32" , DC_RD_RT_SA }, + {"invalid" , DC_BARE }, + {"dsrl32" , DC_RD_RT_SA }, + {"dsra32" , DC_RD_RT_SA }}; + +static const disasm_t disasm_movci[2] DATASEG = +{{"movf" , DC_RD_RS_CC }, + {"movt" , DC_RD_RS_CC }}; + +static const disasm_t disasm_regimm[32] DATASEG = +{{"bltz" , DC_RS_OFS }, + {"bgez" , DC_RS_OFS }, + {"bltzl" , DC_RS_OFS }, + {"bgezl" , DC_RS_OFS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"tgei" , DC_RS_SIMM }, + {"tgeiu" , DC_RS_SIMM }, + {"tlti" , DC_RS_SIMM }, + {"tltiu" , DC_RS_SIMM }, + {"teqi" , DC_RS_SIMM }, + {"invalid" , DC_BARE }, + {"tnei" , DC_RS_SIMM }, + {"invalid" , DC_BARE }, + {"bltzal" , DC_RS_OFS }, + {"bgezal" , DC_RS_OFS }, + {"bltzall" , DC_RS_OFS }, + {"bgezall" , DC_RS_OFS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }}; + +static const disasm_t disasm_spec2[64] DATASEG = +{{"madd" , DC_RS_RT }, + {"maddu" , DC_RS_RT }, + {"mul" , DC_RD_RS_RT }, + {"invalid" , DC_BARE }, + {"msub" , DC_RS_RT }, + {"msubu" , DC_RS_RT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"clz" , DC_RT_RS }, + {"clo" , DC_RT_RS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"dclz" , DC_RT_RS }, + {"dclo" , DC_RT_RS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"sdbbp" , DC_BARE }}; + +static const disasm_t disasm_cop0[32] DATASEG = +{{"mfc0@1" , DC_RT_CR_SEL }, + {"dmfc0@1" , DC_RT_CR_SEL }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"mtc0@1" , DC_RT_CR_SEL }, + {"dmtc0@1" , DC_RT_CR_SEL }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }, + {"$5" , DC_DEREF }}; + +static const disasm_t disasm_cop0_c0[64] DATASEG = +{{"invalid" , DC_BARE }, + {"tlbr" , DC_BARE }, + {"tlbwi" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"tlbwr" , DC_BARE }, + {"invalid" , DC_BARE }, + {"tlbp" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"eret" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"deret" , DC_BARE }, + {"wait" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }}; + +static const disasm_t disasm_cop1[32] DATASEG = +{{"mfc1" , DC_RT_FS }, + {"dmfc1" , DC_RT_FS }, + {"cfc1" , DC_RT_FS }, + {"invalid" , DC_BARE }, + {"mtc1" , DC_RT_FS }, + {"dmtc1" , DC_RT_FS }, + {"ctc1" , DC_RT_FS }, + {"invalid" , DC_BARE }, + {"$17" , DC_DEREF }, + {"$36" , DC_DEREF }, + {"$37" , DC_DEREF }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"$7" , DC_DEREF }, + {"$9" , DC_DEREF }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"$11" , DC_DEREF }, + {"$12" , DC_DEREF }, + {"$13" , DC_DEREF }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }}; + +static const disasm_t disasm_cop1_bc1[4] DATASEG = +{{"bc1f" , DC_CC_OFS }, + {"bc1t" , DC_CC_OFS }, + {"bc1fl" , DC_CC_OFS }, + {"bc1tl" , DC_CC_OFS }, +}; + +static const disasm_t disasm_cop1_bc1any2[2] DATASEG = +{{"bc1any2f" , DC_CC_OFS }, + {"bc1any2t" , DC_CC_OFS }, +}; + +static const disasm_t disasm_cop1_bc1any4[2] DATASEG = +{{"bc1any4f" , DC_CC_OFS }, + {"bc1any4t" , DC_CC_OFS }, +}; + +static const disasm_t disasm_cop1_s[64] DATASEG = +{{"add.s" , DC_FD_FS_FT }, + {"sub.s" , DC_FD_FS_FT }, + {"mul.s" , DC_FD_FS_FT }, + {"div.s" , DC_FD_FS_FT }, + {"sqrt.s" , DC_FD_FS }, + {"abs.s" , DC_FD_FS }, + {"mov.s" , DC_FD_FS }, + {"neg.s" , DC_FD_FS }, + {"round.l.s" , DC_FD_FS }, + {"trunc.l.s" , DC_FD_FS }, + {"ceil.l.s" , DC_FD_FS }, + {"floor.l.s" , DC_FD_FS }, + {"round.w.s" , DC_FD_FS }, + {"trunc.w.s" , DC_FD_FS }, + {"ceil.w.s" , DC_FD_FS }, + {"floor.w.s" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"$8" , DC_DEREF }, + {"movz.s" , DC_FD_FS_RT }, + {"movn.s" , DC_FD_FS_RT }, + {"invalid" , DC_BARE }, + {"recip.s" , DC_FD_FS }, + {"rsqrt.s" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"recip2.s" , DC_FD_FS_FT }, + {"recip1.s" , DC_FD_FS }, + {"rsqrt1.s" , DC_FD_FS }, + {"rsqrt2.s" , DC_FD_FS_FT }, + {"invalid" , DC_BARE }, + {"cvt.d.s" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"cvt.w.s" , DC_FD_FS }, + {"cvt.l.s" , DC_FD_FS }, + {"cvt.ps.s" , DC_FD_FS_FT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"$38" , DC_DEREF }, + {"$39" , DC_DEREF }, + {"$40" , DC_DEREF }, + {"$41" , DC_DEREF }, + {"$42" , DC_DEREF }, + {"$43" , DC_DEREF }, + {"$44" , DC_DEREF }, + {"$45" , DC_DEREF }, + {"$46" , DC_DEREF }, + {"$47" , DC_DEREF }, + {"$48" , DC_DEREF }, + {"$49" , DC_DEREF }, + {"$50" , DC_DEREF }, + {"$51" , DC_DEREF }, + {"$52" , DC_DEREF }, + {"$53" , DC_DEREF }}; + +static const disasm_t disasm_cop1_s_mvcf[2] DATASEG = +{{"movf.s" , DC_FD_FS_CC }, + {"movt.s" , DC_FD_FS_CC }}; + +static const disasm_t disasm_cop1_d[64] DATASEG = +{{"add.d" , DC_FD_FS_FT }, + {"sub.d" , DC_FD_FS_FT }, + {"mul.d" , DC_FD_FS_FT }, + {"div.d" , DC_FD_FS_FT }, + {"sqrt.d" , DC_FD_FS }, + {"abs.d" , DC_FD_FS }, + {"mov.d" , DC_FD_FS }, + {"neg.d" , DC_FD_FS }, + {"round.l.d" , DC_FD_FS }, + {"trunc.l.d" , DC_FD_FS }, + {"ceil.l.d" , DC_FD_FS }, + {"floor.l.d" , DC_FD_FS }, + {"round.w.d" , DC_FD_FS }, + {"trunc.w.d" , DC_FD_FS }, + {"ceil.w.d" , DC_FD_FS }, + {"floor.w.d" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"$10" , DC_DEREF }, + {"movz.d" , DC_FD_FS_RT }, + {"movn.d" , DC_FD_FS_RT }, + {"invalid" , DC_BARE }, + {"recip.d" , DC_FD_FS }, + {"rsqrt.d" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"recip2.d" , DC_FD_FS_FT }, + {"recip1.d" , DC_FD_FS }, + {"rsqrt1.d" , DC_FD_FS }, + {"rsqrt2.d" , DC_FD_FS_FT }, + {"cvt.s.d" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"cvt.w.d" , DC_FD_FS }, + {"cvt.l.d" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"$54" , DC_DEREF }, + {"$55" , DC_DEREF }, + {"$56" , DC_DEREF }, + {"$57" , DC_DEREF }, + {"$58" , DC_DEREF }, + {"$59" , DC_DEREF }, + {"$60" , DC_DEREF }, + {"$61" , DC_DEREF }, + {"$62" , DC_DEREF }, + {"$63" , DC_DEREF }, + {"$64" , DC_DEREF }, + {"$65" , DC_DEREF }, + {"$66" , DC_DEREF }, + {"$67" , DC_DEREF }, + {"$68" , DC_DEREF }, + {"$69" , DC_DEREF }}; + +static const disasm_t disasm_cop1_d_mvcf[2] DATASEG = +{{"movf.d" , DC_FD_FS_CC }, + {"movt.d" , DC_FD_FS_CC }}; + +static const disasm_t disasm_cop1_w[64] DATASEG = +{{"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"cvt.s.w" , DC_FD_FS }, + {"cvt.d.w" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"cvt.ps.pw" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }}; + +static const disasm_t disasm_cop1_l[64] DATASEG = +{{"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"cvt.s.l" , DC_FD_FS }, + {"cvt.d.l" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }}; + +static const disasm_t disasm_cop1_ps[64] DATASEG = +{{"add.ps" , DC_FD_FS_FT }, + {"sub.ps" , DC_FD_FS_FT }, + {"mul.ps" , DC_FD_FS_FT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"abs.ps" , DC_FD_FS }, + {"mov.ps" , DC_FD_FS }, + {"neg.ps" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"$14" , DC_DEREF }, + {"movz.ps" , DC_FD_FS_RT }, + {"movn.ps" , DC_FD_FS_RT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"addr.ps" , DC_FD_FS_FT }, + {"invalid" , DC_BARE }, + {"mulr.ps" , DC_FD_FS_FT }, + {"invalid" , DC_BARE }, + {"recip2.ps" , DC_FD_FS_FT }, + {"recip1.ps" , DC_FD_FS }, + {"rsqrt1.ps" , DC_FD_FS }, + {"rsqrt2.ps" , DC_FD_FS_FT }, + {"cvt.s.pu" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"cvt.pw.ps" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"cvt.s.pl" , DC_FD_FS }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"pll.ps" , DC_FD_FS_FT }, + {"plu.ps" , DC_FD_FS_FT }, + {"pul.ps" , DC_FD_FS_FT }, + {"puu.ps" , DC_FD_FS_FT }, + {"$70" , DC_DEREF }, + {"$71" , DC_DEREF }, + {"$72" , DC_DEREF }, + {"$73" , DC_DEREF }, + {"$74" , DC_DEREF }, + {"$75" , DC_DEREF }, + {"$76" , DC_DEREF }, + {"$77" , DC_DEREF }, + {"$78" , DC_DEREF }, + {"$79" , DC_DEREF }, + {"$80" , DC_DEREF }, + {"$81" , DC_DEREF }, + {"$82" , DC_DEREF }, + {"$83" , DC_DEREF }, + {"$84" , DC_DEREF }, + {"$85" , DC_DEREF }}; + +static const disasm_t disasm_cop1_c_f_s[2] DATASEG = +{{"c.f.s" , DC_CC_FS_FT }, + {"cabs.f.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_un_s[2] DATASEG = +{{"c.un.s" , DC_CC_FS_FT }, + {"cabs.un.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_eq_s[2] DATASEG = +{{"c.eq.s" , DC_CC_FS_FT }, + {"cabs.eq.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ueq_s[2] DATASEG = +{{"c.ueq.s" , DC_CC_FS_FT }, + {"cabs.ueq.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_olt_s[2] DATASEG = +{{"c.olt.s" , DC_CC_FS_FT }, + {"cabs.olt.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ult_s[2] DATASEG = +{{"c.ult.s" , DC_CC_FS_FT }, + {"cabs.ult.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ole_s[2] DATASEG = +{{"c.ole.s" , DC_CC_FS_FT }, + {"cabs.ole.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ule_s[2] DATASEG = +{{"c.ule.s" , DC_CC_FS_FT }, + {"cabs.ule.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_sf_s[2] DATASEG = +{{"c.sf.s" , DC_CC_FS_FT }, + {"cabs.sf.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngle_s[2] DATASEG = +{{"c.ngle.s" , DC_CC_FS_FT }, + {"cabs.ngle.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_seq_s[2] DATASEG = +{{"c.seq.s" , DC_CC_FS_FT }, + {"cabs.seq.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngl_s[2] DATASEG = +{{"c.ngl.s" , DC_CC_FS_FT }, + {"cabs.ngl.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_lt_s[2] DATASEG = +{{"c.lt.s" , DC_CC_FS_FT }, + {"cabs.lt.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_nge_s[2] DATASEG = +{{"c.nge.s" , DC_CC_FS_FT }, + {"cabs.nge.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_le_s[2] DATASEG = +{{"c.le.s" , DC_CC_FS_FT }, + {"cabs.le.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngt_s[2] DATASEG = +{{"c.ngt.s" , DC_CC_FS_FT }, + {"cabs.ngt.s" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_f_d[2] DATASEG = +{{"c.f.d" , DC_CC_FS_FT }, + {"cabs.f.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_un_d[2] DATASEG = +{{"c.un.d" , DC_CC_FS_FT }, + {"cabs.un.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_eq_d[2] DATASEG = +{{"c.eq.d" , DC_CC_FS_FT }, + {"cabs.eq.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ueq_d[2] DATASEG = +{{"c.ueq.d" , DC_CC_FS_FT }, + {"cabs.ueq.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_olt_d[2] DATASEG = +{{"c.olt.d" , DC_CC_FS_FT }, + {"cabs.olt.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ult_d[2] DATASEG = +{{"c.ult.d" , DC_CC_FS_FT }, + {"cabs.ult.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ole_d[2] DATASEG = +{{"c.ole.d" , DC_CC_FS_FT }, + {"cabs.ole.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ule_d[2] DATASEG = +{{"c.ule.d" , DC_CC_FS_FT }, + {"cabs.ule.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_sf_d[2] DATASEG = +{{"c.sf.d" , DC_CC_FS_FT }, + {"cabs.sf.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngle_d[2] DATASEG = +{{"c.ngle.d" , DC_CC_FS_FT }, + {"cabs.ngle.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_seq_d[2] DATASEG = +{{"c.seq.d" , DC_CC_FS_FT }, + {"cabs.seq.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngl_d[2] DATASEG = +{{"c.ngl.d" , DC_CC_FS_FT }, + {"cabs.ngl.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_lt_d[2] DATASEG = +{{"c.lt.d" , DC_CC_FS_FT }, + {"cabs.lt.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_nge_d[2] DATASEG = +{{"c.nge.d" , DC_CC_FS_FT }, + {"cabs.nge.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_le_d[2] DATASEG = +{{"c.le.d" , DC_CC_FS_FT }, + {"cabs.le.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngt_d[2] DATASEG = +{{"c.ngt.d" , DC_CC_FS_FT }, + {"cabs.ngt.d" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_f_ps[2] DATASEG = +{{"c.f.ps" , DC_CC_FS_FT }, + {"cabs.f.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_un_ps[2] DATASEG = +{{"c.un.ps" , DC_CC_FS_FT }, + {"cabs.un.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_eq_ps[2] DATASEG = +{{"c.eq.ps" , DC_CC_FS_FT }, + {"cabs.eq.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ueq_ps[2] DATASEG = +{{"c.ueq.ps" , DC_CC_FS_FT }, + {"cabs.ueq.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_olt_ps[2] DATASEG = +{{"c.olt.ps" , DC_CC_FS_FT }, + {"cabs.olt.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ult_ps[2] DATASEG = +{{"c.ult.ps" , DC_CC_FS_FT }, + {"cabs.ult.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ole_ps[2] DATASEG = +{{"c.ole.ps" , DC_CC_FS_FT }, + {"cabs.ole.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ule_ps[2] DATASEG = +{{"c.ule.ps" , DC_CC_FS_FT }, + {"cabs.ule.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_sf_ps[2] DATASEG = +{{"c.sf.ps" , DC_CC_FS_FT }, + {"cabs.sf.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngle_ps[2] DATASEG = +{{"c.ngle.ps" , DC_CC_FS_FT }, + {"cabs.ngle.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_seq_ps[2] DATASEG = +{{"c.seq.ps" , DC_CC_FS_FT }, + {"cabs.seq.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngl_ps[2] DATASEG = +{{"c.ngl.ps" , DC_CC_FS_FT }, + {"cabs.ngl.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_lt_ps[2] DATASEG = +{{"c.lt.ps" , DC_CC_FS_FT }, + {"cabs.lt.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_nge_ps[2] DATASEG = +{{"c.nge.ps" , DC_CC_FS_FT }, + {"cabs.nge.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_le_ps[2] DATASEG = +{{"c.le.ps" , DC_CC_FS_FT }, + {"cabs.le.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_c_ngt_ps[2] DATASEG = +{{"c.ngt.ps" , DC_CC_FS_FT }, + {"cabs.ngt.ps" , DC_CC_FS_FT }}; + +static const disasm_t disasm_cop1_ps_mvcf[2] DATASEG = +{{"movf.ps" , DC_FD_FS_CC }, + {"movt.ps" , DC_FD_FS_CC }}; + +static const disasm_t disasm_cop1x[64] DATASEG = +{{"lwxc1" , DC_FD_IDX_BASE }, + {"ldxc1" , DC_FD_IDX_BASE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"luxc1" , DC_FD_IDX_BASE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"swxc1" , DC_FS_IDX_BASE }, + {"sdxc1" , DC_FS_IDX_BASE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"suxc1" , DC_FS_IDX_BASE }, + {"invalid" , DC_BARE }, + {"prefx" , DC_PREF_IDX }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"alnv.ps" , DC_FD_FS_FT_RS }, + {"invalid" , DC_BARE }, + {"madd.s" , DC_FD_FR_FS_FT }, + {"madd.d" , DC_FD_FR_FS_FT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"madd.ps" , DC_FD_FR_FS_FT }, + {"invalid" , DC_BARE }, + {"msub.s" , DC_FD_FR_FS_FT }, + {"msub.d" , DC_FD_FR_FS_FT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"msub.ps" , DC_FD_FR_FS_FT }, + {"invalid" , DC_BARE }, + {"nmadd.s" , DC_FD_FR_FS_FT }, + {"nmadd.d" , DC_FD_FR_FS_FT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"nmadd.ps" , DC_FD_FR_FS_FT }, + {"invalid" , DC_BARE }, + {"nmsub.s" , DC_FD_FR_FS_FT }, + {"nmsub.d" , DC_FD_FR_FS_FT }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"invalid" , DC_BARE }, + {"nmsub.ps" , DC_FD_FR_FS_FT }, + {"invalid" , DC_BARE }}; + +static const disasm_t disasm_mdmx[8] DATASEG = +{{ "$20" , DC_DEREF }, + { "$19" , DC_DEREF }, + { "$20" , DC_DEREF }, + { "$33" , DC_DEREF }, + { "$20" , DC_DEREF }, + { "$19" , DC_DEREF }, + { "$20" , DC_DEREF }, + { "$33" , DC_DEREF }, +}; + +static const disasm_t disasm_mdmx_qh[64] DATASEG = +{{ "msgn.qh" , DC_VD_VS_VT_VEC}, + { "c.eq.qh" , DC_VS_VT_VEC }, + { "pickf.qh" , DC_VD_VS_VT_VEC}, + { "pickt.qh" , DC_VD_VS_VT_VEC}, + { "c.lt.qh" , DC_VS_VT_VEC }, + { "c.le.qh" , DC_VS_VT_VEC }, + { "min.qh" , DC_VD_VS_VT_VEC}, + { "max.qh" , DC_VD_VS_VT_VEC}, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "sub.qh" , DC_VD_VS_VT_VEC}, + { "add.qh" , DC_VD_VS_VT_VEC}, + { "and.qh" , DC_VD_VS_VT_VEC}, + { "xor.qh" , DC_VD_VS_VT_VEC}, + { "or.qh" , DC_VD_VS_VT_VEC}, + { "nor.qh" , DC_VD_VS_VT_VEC}, + + { "sll.qh" , DC_VD_VS_VT_VEC}, + { "invalid" , DC_BARE }, + { "srl.qh" , DC_VD_VS_VT_VEC}, + { "sra.qh" , DC_VD_VS_VT_VEC}, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "alni.ob" , DC_VD_VS_VT_IMM}, + { "alnv.ob" , DC_VD_VS_VT_RS }, + { "alni.qh" , DC_VD_VS_VT_IMM}, + { "alnv.qh" , DC_VD_VS_VT_RS }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "$34" , DC_DEREF }, + + { "rzu.qh" , DC_VD_VT }, + { "rnau.qh" , DC_VD_VT }, + { "rneu.qh" , DC_VD_VT }, + { "invalid" , DC_BARE }, + { "rzs.qh" , DC_VD_VT }, + { "rnas.qh" , DC_VD_VT }, + { "rnes.qh" , DC_VD_VT }, + { "invalid" , DC_BARE }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "mul.qh" , DC_VD_VS_VT_VEC}, + { "invalid" , DC_BARE }, + { "$21" , DC_DEREF }, + { "$22" , DC_DEREF }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "$23" , DC_DEREF }, + { "$24" , DC_DEREF }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "$25" , DC_DEREF }, + { "$26" , DC_DEREF }, +}; + +static const disasm_t disasm_mdmx_ob[64] DATASEG = +{{ "invalid" , DC_BARE }, + { "c.eq.ob" , DC_VS_VT_VEC }, + { "pickf.ob" , DC_VD_VS_VT_VEC}, + { "pickt.ob" , DC_VD_VS_VT_VEC}, + { "c.lt.ob" , DC_VS_VT_VEC }, + { "c.le.ob" , DC_VS_VT_VEC }, + { "min.ob" , DC_VD_VS_VT_VEC}, + { "max.ob" , DC_VD_VS_VT_VEC}, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "sub.ob" , DC_VD_VS_VT_VEC}, + { "add.ob" , DC_VD_VS_VT_VEC}, + { "and.ob" , DC_VD_VS_VT_VEC}, + { "xor.ob" , DC_VD_VS_VT_VEC}, + { "or.ob" , DC_VD_VS_VT_VEC}, + { "nor.ob" , DC_VD_VS_VT_VEC}, + + { "sll.ob" , DC_VD_VS_VT_VEC}, + { "invalid" , DC_BARE }, + { "srl.ob" , DC_VD_VS_VT_VEC}, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "alni.ob" , DC_VD_VS_VT_IMM}, + { "alnv.ob" , DC_VD_VS_VT_RS }, + { "alni.qh" , DC_VD_VS_VT_IMM}, + { "alnv.qh" , DC_VD_VS_VT_RS }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "$35" , DC_DEREF }, + + { "rzu.ob" , DC_VD_VT }, + { "rnau.ob" , DC_VD_VT }, + { "rneu.ob" , DC_VD_VT }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "mul.ob" , DC_VD_VS_VT_VEC}, + { "invalid" , DC_BARE }, + { "$27" , DC_DEREF }, + { "$28" , DC_DEREF }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "$29" , DC_DEREF }, + { "$30" , DC_DEREF }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "$31" , DC_DEREF }, + { "$32" , DC_DEREF }, +}; + +static const disasm_t disasm_mdmx_alni[64] DATASEG = +{{ "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "alni.ob" , DC_VD_VS_VT_IMM}, + { "alnv.ob" , DC_VD_VS_VT_RS }, + { "alni.qh" , DC_VD_VS_VT_IMM}, + { "alnv.qh" , DC_VD_VS_VT_RS }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, +}; + +static const disasm_t disasm_mdmx_muls_qh[2] DATASEG = +{{ "muls.qh" , DC_VS_VT_VEC }, + { "mulsl.qh" , DC_VS_VT_VEC }, +}; + +static const disasm_t disasm_mdmx_mul_qh[2] DATASEG = +{{ "mula.qh" , DC_VS_VT_VEC }, + { "mull.qh" , DC_VS_VT_VEC }, +}; + +static const disasm_t disasm_mdmx_sub_qh[2] DATASEG = +{{ "suba.qh" , DC_VS_VT_VEC }, + { "subl.qh" , DC_VS_VT_VEC }, +}; + +static const disasm_t disasm_mdmx_add_qh[2] DATASEG = +{{ "adda.qh" , DC_VS_VT_VEC }, + { "addl.qh" , DC_VS_VT_VEC }, +}; + +static const disasm_t disasm_mdmx_wac_qh[4] DATASEG = +{{ "wacl.qh" , DC_VS_VT }, + { "invalid" , DC_BARE }, + { "wach.qh" , DC_VS }, + { "invalid" , DC_BARE }, +}; + +static const disasm_t disasm_mdmx_rac_qh[4] DATASEG = +{{ "racl.qh" , DC_VD }, + { "racm.qh" , DC_VD }, + { "rach.qh" , DC_VD }, + { "invalid" , DC_BARE }, +}; + +static const disasm_t disasm_mdmx_muls_ob[2] DATASEG = +{{ "muls.ob" , DC_VS_VT_VEC }, + { "mulsl.ob" , DC_VS_VT_VEC }, +}; + +static const disasm_t disasm_mdmx_mul_ob[2] DATASEG = +{{ "mula.ob" , DC_VS_VT_VEC }, + { "mull.ob" , DC_VS_VT_VEC }, +}; + +static const disasm_t disasm_mdmx_sub_ob[2] DATASEG = +{{ "suba.ob" , DC_VS_VT_VEC }, + { "subl.ob" , DC_VS_VT_VEC }, +}; + +static const disasm_t disasm_mdmx_add_ob[2] DATASEG = +{{ "adda.ob" , DC_VS_VT_VEC }, + { "addl.ob" , DC_VS_VT_VEC }, +}; + +static const disasm_t disasm_mdmx_wac_ob[4] DATASEG = +{{ "wacl.ob" , DC_VS_VT }, + { "invalid" , DC_BARE }, + { "wach.ob" , DC_VS }, + { "invalid" , DC_BARE }, +}; + +static const disasm_t disasm_mdmx_rac_ob[4] DATASEG = +{{ "racl.ob" , DC_VD }, + { "racm.ob" , DC_VD }, + { "rach.ob" , DC_VD }, + { "invalid" , DC_BARE }, +}; + +static const disasm_t disasm_mdmx_shfl_ob[16] DATASEG = +{{ "shfl.upsl.ob" , DC_VD_VS_VT }, + { "shfl.pach.ob" , DC_VD_VS_VT }, + { "shfl.mixh.ob" , DC_VD_VS_VT }, + { "shfl.mixl.ob" , DC_VD_VS_VT }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, +}; + +static const disasm_t disasm_mdmx_shfl_qh[8] DATASEG = +{{ "shfl.bfla.qh" , DC_VD_VS_VT }, + { "shfl.pach.qh" , DC_VD_VS_VT }, + { "shfl.mixh.qh" , DC_VD_VS_VT }, + { "shfl.mixl.qh" , DC_VD_VS_VT }, + { "shfl.repa.qh" , DC_VD_VS_VT }, + { "shfl.repb.qh" , DC_VD_VS_VT }, + { "invalid" , DC_BARE }, + { "invalid" , DC_BARE }, +}; + + + +const disasm_deref_t disasm_deref[] = +/* Disasm array shft msk */ +{{ disasm_normal , 26, 0x3f }, /* 0 */ + { disasm_special , 0, 0x3f }, /* 1 */ + { disasm_regimm , 16, 0x1f }, /* 2 */ + { disasm_spec2 , 0, 0x3f }, /* 3 */ + { disasm_cop0 , 21, 0x1f }, /* 4 */ + { disasm_cop0_c0 , 0, 0x3f }, /* 5 */ + { disasm_cop1 , 21, 0x1f }, /* 6 */ + { disasm_cop1_s , 0, 0x3f }, /* 7 */ + { disasm_cop1_s_mvcf , 16, 0x1 }, /* 8 */ + { disasm_cop1_d , 0, 0x3f }, /* 9 */ + { disasm_cop1_d_mvcf , 16, 0x1 }, /* 10 */ + { disasm_cop1_w , 0, 0x3f }, /* 11 */ + { disasm_cop1_l , 0, 0x3f }, /* 12 */ + { disasm_cop1_ps , 0, 0x3f }, /* 13 */ + { disasm_cop1_ps_mvcf, 16, 0x1 }, /* 14 */ + { disasm_cop1x , 0, 0x3f }, /* 15 */ + { disasm_movci , 16, 0x1 }, /* 16 */ + { disasm_cop1_bc1 , 16, 0x3 }, /* 17 */ + { disasm_mdmx , 21, 0x7 }, /* 18 */ + { disasm_mdmx_qh , 0, 0x3f }, /* 19 */ + { disasm_mdmx_ob , 0, 0x3f }, /* 20 */ + { disasm_mdmx_muls_qh, 10, 0x1 }, /* 21 */ + { disasm_mdmx_mul_qh , 10, 0x1 }, /* 22 */ + { disasm_mdmx_sub_qh , 10, 0x1 }, /* 23 */ + { disasm_mdmx_add_qh , 10, 0x1 }, /* 24 */ + { disasm_mdmx_wac_qh , 24, 0x3 }, /* 25 */ + { disasm_mdmx_rac_qh , 24, 0x3 }, /* 26 */ + { disasm_mdmx_muls_ob, 10, 0x1 }, /* 27 */ + { disasm_mdmx_mul_ob , 10, 0x1 }, /* 28 */ + { disasm_mdmx_sub_ob , 10, 0x1 }, /* 29 */ + { disasm_mdmx_add_ob , 10, 0x1 }, /* 30 */ + { disasm_mdmx_wac_ob , 24, 0x3 }, /* 31 */ + { disasm_mdmx_rac_ob , 24, 0x3 }, /* 32 */ + { disasm_mdmx_alni , 0, 0x3f }, /* 33 */ + { disasm_mdmx_shfl_ob, 22, 0xf }, /* 34 */ + { disasm_mdmx_shfl_qh, 23, 0x7 }, /* 35 */ + { disasm_cop1_bc1any2, 16, 0x1 }, /* 36 */ + { disasm_cop1_bc1any4, 16, 0x1 }, /* 37 */ + { disasm_cop1_c_f_s , 6, 0x1 }, /* 38 */ + { disasm_cop1_c_un_s , 6, 0x1 }, /* 39 */ + { disasm_cop1_c_eq_s , 6, 0x1 }, /* 40 */ + { disasm_cop1_c_ueq_s, 6, 0x1 }, /* 41 */ + { disasm_cop1_c_olt_s, 6, 0x1 }, /* 42 */ + { disasm_cop1_c_ult_s, 6, 0x1 }, /* 43 */ + { disasm_cop1_c_ole_s, 6, 0x1 }, /* 44 */ + { disasm_cop1_c_ule_s, 6, 0x1 }, /* 45 */ + { disasm_cop1_c_sf_s , 6, 0x1 }, /* 46 */ + { disasm_cop1_c_ngle_s, 6, 0x1 }, /* 47 */ + { disasm_cop1_c_seq_s, 6, 0x1 }, /* 48 */ + { disasm_cop1_c_ngl_s, 6, 0x1 }, /* 49 */ + { disasm_cop1_c_lt_s , 6, 0x1 }, /* 50 */ + { disasm_cop1_c_nge_s, 6, 0x1 }, /* 51 */ + { disasm_cop1_c_le_s , 6, 0x1 }, /* 52 */ + { disasm_cop1_c_ngt_s, 6, 0x1 }, /* 53 */ + { disasm_cop1_c_f_d , 6, 0x1 }, /* 54 */ + { disasm_cop1_c_un_d , 6, 0x1 }, /* 55 */ + { disasm_cop1_c_eq_d , 6, 0x1 }, /* 56 */ + { disasm_cop1_c_ueq_d, 6, 0x1 }, /* 57 */ + { disasm_cop1_c_olt_d, 6, 0x1 }, /* 58 */ + { disasm_cop1_c_ult_d, 6, 0x1 }, /* 59 */ + { disasm_cop1_c_ole_d, 6, 0x1 }, /* 60 */ + { disasm_cop1_c_ule_d, 6, 0x1 }, /* 61 */ + { disasm_cop1_c_sf_d , 6, 0x1 }, /* 62 */ + { disasm_cop1_c_ngle_d, 6, 0x1 }, /* 63 */ + { disasm_cop1_c_seq_d, 6, 0x1 }, /* 64 */ + { disasm_cop1_c_ngl_d, 6, 0x1 }, /* 65 */ + { disasm_cop1_c_lt_d , 6, 0x1 }, /* 66 */ + { disasm_cop1_c_nge_d, 6, 0x1 }, /* 67 */ + { disasm_cop1_c_le_d , 6, 0x1 }, /* 68 */ + { disasm_cop1_c_ngt_d, 6, 0x1 }, /* 69 */ + { disasm_cop1_c_f_ps , 6, 0x1 }, /* 70 */ + { disasm_cop1_c_un_ps, 6, 0x1 }, /* 71 */ + { disasm_cop1_c_eq_ps, 6, 0x1 }, /* 72 */ + { disasm_cop1_c_ueq_ps, 6, 0x1 }, /* 73 */ + { disasm_cop1_c_olt_ps, 6, 0x1 }, /* 74 */ + { disasm_cop1_c_ult_ps, 6, 0x1 }, /* 75 */ + { disasm_cop1_c_ole_ps, 6, 0x1 }, /* 76 */ + { disasm_cop1_c_ule_ps, 6, 0x1 }, /* 77 */ + { disasm_cop1_c_sf_ps, 6, 0x1 }, /* 78 */ + { disasm_cop1_c_ngle_ps, 6, 0x1 }, /* 79 */ + { disasm_cop1_c_seq_ps, 6, 0x1 }, /* 80 */ + { disasm_cop1_c_ngl_ps, 6, 0x1 }, /* 81 */ + { disasm_cop1_c_lt_ps, 6, 0x1 }, /* 82 */ + { disasm_cop1_c_nge_ps, 6, 0x1 }, /* 83 */ + { disasm_cop1_c_le_ps, 6, 0x1 }, /* 84 */ + { disasm_cop1_c_ngt_ps, 6, 0x1 }, /* 85 */ +}; + +#define PREFHINT(x) (&pref_hints[(x)*9]) +static char *pref_hints = + "load \0" + "store \0" + "reserved\0" + "reserved\0" + + "ld_strm \0" + "st_strm \0" + "ld_retn \0" + "st_retn \0" + + "reserved\0" + "reserved\0" + "reserved\0" + "reserved\0" + + "reserved\0" + "reserved\0" + "reserved\0" + "reserved\0" + + "reserved\0" + "reserved\0" + "reserved\0" + "reserved\0" + + "reserved\0" + "reserved\0" + "reserved\0" + "reserved\0" + + "reserved\0" + "wb_inval\0" + "reserved\0" + "reserved\0" + + "reserved\0" + "reserved\0" + "reserved\0" + "reserved\0"; + + +static int snprintf(char *buf,int len,const char *templat,...) +{ + va_list marker; + int count; + + va_start(marker,templat); + count = xvsprintf(buf,templat,marker); + va_end(marker); + + return count; +} + +static const disasm_t *get_disasm_field(uint32_t inst) +{ + const disasm_deref_t *tmp = &disasm_deref[0]; + const disasm_t *rec; + do { + rec = &(tmp->ptr[(inst>>tmp->shift) & tmp->mask]); + tmp = &disasm_deref[atoi(&(rec->name[1]))]; + } while (rec->type == DC_DEREF); + return rec; +} + +char *disasm_inst_name(uint32_t inst) +{ + return (char *)(get_disasm_field(inst)->name); +} + +void disasm_inst(char *buf, int buf_size, uint32_t inst, uint64_t pc) +{ + const disasm_t *tmp; + char instname[32]; + int commentmode = 0; + char *x; + + tmp = get_disasm_field(inst); + + strcpy(instname,(char *) tmp->name); + + if ((x = strchr(instname,'@'))) { + *x++ = 0; + commentmode = atoi(x); + } + + switch (tmp->type) { + case DC_RD_RS_RT: + snprintf(buf, buf_size, "%-8s %s,%s,%s", + instname, + REGNAME((inst>>11) & 0x1f), + REGNAME((inst>>21) & 0x1f), + REGNAME((inst>>16) & 0x1f)); + break; + case DC_RD_RT_RS: + snprintf(buf, buf_size, "%-8s %s,%s,%s", + instname, + REGNAME((inst>>11) & 0x1f), + REGNAME((inst>>16) & 0x1f), + REGNAME((inst>>21) & 0x1f)); + break; + case DC_RT_RS_SIMM: + snprintf(buf, buf_size, "%-8s %s,%s,#%" PF_32 "d", + instname, + REGNAME((inst>>16) & 0x1f), + REGNAME((inst>>21) & 0x1f), + SEXT_32(15, inst & 0xffff)); + break; + case DC_RT_RS_XIMM: + snprintf(buf, buf_size, "%-8s %s,%s,#0x%" PF_32 "x", + instname, + REGNAME((inst>>16) & 0x1f), + REGNAME((inst>>21) & 0x1f), + inst & 0xffff); + break; + case DC_RS_RT_OFS: + snprintf(buf, buf_size, "%-8s %s,%s,0x%" PF_64 "x", + instname, + REGNAME((inst>>21) & 0x1f), + REGNAME((inst>>16) & 0x1f), + pc + 4 + (SEXT_64(15, inst & 0xffff)<<2)); + break; + case DC_RS_OFS: + snprintf(buf, buf_size, "%-8s %s,0x%" PF_64 "x", + instname, + REGNAME((inst>>21) & 0x1f), + pc + 4 + (SEXT_64(16, inst & 0xffff)<<2)); + break; + case DC_RD_RT_SA: + snprintf(buf, buf_size, "%-8s %s,%s,#%d", + instname, + REGNAME((inst>>11) & 0x1f), + REGNAME((inst>>16) & 0x1f), + (inst>>6) & 0x1f); + break; + case DC_RT_UIMM: + snprintf(buf, buf_size, "%-8s %s,#%d", + instname, + REGNAME((inst>>16) & 0x1f), + inst & 0xffff); + break; + case DC_RD: + snprintf(buf, buf_size, "%-8s %s", + instname, + REGNAME((inst>>11) & 0x1f)); + break; + case DC_J: + snprintf(buf, buf_size, "%-8s 0x%" PF_64 "x", + instname, + (pc & UINT64_T(0xfffffffff0000000)) | ((inst & 0x3ffffff)<<2)); + break; + case DC_RD_RS: + snprintf(buf, buf_size, "%-8s %s,%s", + instname, + REGNAME((inst>>11) & 0x1f), + REGNAME((inst>>21) & 0x1f)); + break; + case DC_RS_RT: + snprintf(buf, buf_size, "%-8s %s,%s", + instname, + REGNAME((inst>>21) & 0x1f), + REGNAME((inst>>16) & 0x1f)); + break; + case DC_RT_RS: + snprintf(buf, buf_size, "%-8s %s,%s", + instname, + REGNAME((inst>>16) & 0x1f), + REGNAME((inst>>21) & 0x1f)); + break; + case DC_RT_RD_SEL: + snprintf(buf, buf_size, "%-8s %s,%s,#%d", + instname, + REGNAME((inst>>16) & 0x1f), + REGNAME((inst>>11) & 0x1f), + inst & 0x3); + break; + case DC_RT_CR_SEL: + snprintf(buf, buf_size, "%-8s %s,%d,#%d", + instname, + REGNAME((inst>>16) & 0x1f), + (inst>>11) & 0x1f, + inst & 0x3); + break; + case DC_RS: + snprintf(buf, buf_size, "%-8s %s", + instname, + REGNAME((inst>>21) & 0x1f)); + break; + case DC_RS_SIMM: + snprintf(buf, buf_size, "%-8s %s,#%" PF_32 "d", + instname, + REGNAME((inst>>21) & 0x1f), + SEXT_32(15, inst & 0xffff)); + break; + case DC_RT_OFS_BASE: + snprintf(buf, buf_size, "%-8s %s,#%" PF_32 "d(%s)", + instname, + REGNAME((inst>>16) & 0x1f), + SEXT_32(15, inst), + REGNAME((inst>>21) & 0x1f)); + break; + case DC_FT_OFS_BASE: + snprintf(buf, buf_size, "%-8s f%d,#%" PF_32 "d(%s)", + instname, + (inst>>16) & 0x1f, + SEXT_32(15, inst), + REGNAME((inst>>21) & 0x1f)); + break; + case DC_FD_IDX_BASE: + snprintf(buf, buf_size, "%-8s f%d,%s(%s)", + instname, + (inst>>6) & 0x1f, + REGNAME((inst>>16) & 0x1f), + REGNAME((inst>>21) & 0x1f)); + break; + case DC_FS_IDX_BASE: + snprintf(buf, buf_size, "%-8s f%d,%s(%s)", + instname, + (inst>>11) & 0x1f, + REGNAME((inst>>16) & 0x1f), + REGNAME((inst>>21) & 0x1f)); + break; + case DC_FD_FS_FT: + snprintf(buf, buf_size, "%-8s f%d,f%d,f%d", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + case DC_FD_FS_RT: + snprintf(buf, buf_size, "%-8s f%d,f%d,%s", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + REGNAME((inst>>16) & 0x1f)); + break; + case DC_FD_FS: + snprintf(buf, buf_size, "%-8s f%d,f%d", + instname, + (inst>>6)&0x1f, + (inst>>11)&0x1f); + break; + case DC_PREF_OFS: + snprintf(buf, buf_size, "%-8s #%" PF_32 "d(%s) /* %s */", + instname, + SEXT_32(15, inst & 0xffff), + REGNAME((inst>>21) & 0x1f), + PREFHINT((inst>>16) & 0x1f)); + break; + case DC_PREF_IDX: + snprintf(buf, buf_size, "%-8s %s(%s) /* %s */", + instname, + REGNAME((inst>>16) & 0x1f), + REGNAME((inst>>21) & 0x1f), + PREFHINT((inst>>16) & 0x1f)); + break; + case DC_CC_OFS: + snprintf(buf, buf_size, "%-8s %d,0x%" PF_64 "x", + instname, + (inst>>18) & 0x7, + pc + 4 + (SEXT_64(15, inst & 0xffff)<<2)); + break; + case DC_RD_RS_CC: + snprintf(buf, buf_size, "%-8s %s,%s,%d", + instname, + REGNAME((inst>>11) & 0x1f), + REGNAME((inst>>21) & 0x1f), + (inst>>18) & 0x7); + break; + case DC_FD_FS_CC: + snprintf(buf, buf_size, "%-8s f%d,f%d,%d", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>18) & 0x7); + break; + case DC_FD_FR_FS_FT: + snprintf(buf, buf_size, "%-8s f%d,f%d,f%d,f%d", + instname, + (inst>>6) & 0x1f, + (inst>>21) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + case DC_FD_FS_FT_RS: + snprintf(buf, buf_size, "%-8s f%d,f%d,f%d,%s", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f, + REGNAME((inst>>21) & 0x1f)); + break; + case DC_CC_FS_FT: + snprintf(buf, buf_size, "%-8s %d,f%d,f%d", + instname, + (inst>>8) & 0x7, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + case DC_BARE: + snprintf(buf, buf_size, "%-8s", instname); + break; + case DC_RT_FS: + snprintf(buf, buf_size, "%-8s %s,f%d", + instname, + REGNAME((inst>>16) & 0x1f), + (inst>>11) & 0x1f); + break; + case DC_VS: + snprintf(buf, buf_size, "%-8s $v%d", + instname, + (inst>>11) & 0x1f); + break; + case DC_VD: + snprintf(buf, buf_size, "%-8s $v%d", + instname, + (inst>>6) & 0x1f); + break; + case DC_VD_VT: + snprintf(buf, buf_size, "%-8s $v%d,$v%d", + instname, + (inst>>6) & 0x1f, + (inst>>16) & 0x1f); + break; + case DC_VD_VS_VT_IMM: + snprintf(buf, buf_size, "%-8s $v%d,$v%d,$v%d,#%d", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f, + (inst>>21) & 0x7); + break; + case DC_VD_VS_VT_RS: + snprintf(buf, buf_size, "%-8s $v%d,$v%d,$v%d,%s", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f, + REGNAME((inst>>21) & 0x1f)); + break; + case DC_VD_VS_VT: + snprintf(buf, buf_size, "%-8s $v%d,$v%d,$v%d", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + case DC_VS_VT: + snprintf(buf, buf_size, "%-8s $v%d,$v%d", + instname, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + case DC_VS_VT_VEC: + switch((inst>>24) & 0x3) { + case 0: + case 1: + /* element select */ + if ((inst>>21) & 1) { + /* QH */ + snprintf(buf, buf_size, "%-8s $v%d,$v%d[%d]", + instname, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f, + (inst>>23) & 0x3); + } else { + /* OB */ + snprintf(buf, buf_size, "%-8s $v%d,$v%d[%d]", + instname, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f, + (inst>>22) & 0x7); + + } + break; + case 2: + /* Vector select */ + snprintf(buf, buf_size, "%-8s $v%d,$v%d", + instname, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + case 3: + /* immediate select */ + snprintf(buf, buf_size, "%-8s $v%d,$#%d", + instname, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + } + break; + + case DC_VD_VS_VT_VEC: + switch((inst>>24) & 0x3) { + case 0: + case 1: + /* element select */ + if ((inst>>21) & 1) { + /* QH */ + snprintf(buf, buf_size, "%-8s $v%d,$v%d,$v%d[%d]", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f, + (inst>>23) & 0x3); + } else { + /* OB */ + snprintf(buf, buf_size, "%-8s $v%d,$v%d,$v%d[%d]", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f, + (inst>>22) & 0x7); + + } + break; + case 2: + /* Vector select */ + snprintf(buf, buf_size, "%-8s $v%d,$v%d,$v%d", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + case 3: + /* immediate select */ + snprintf(buf, buf_size, "%-8s $v%d,$v%d,$#%d", + instname, + (inst>>6) & 0x1f, + (inst>>11) & 0x1f, + (inst>>16) & 0x1f); + break; + } + break; + + case DC_SYSCALL: + snprintf(buf, buf_size, "%-8s #%d", + instname, + (inst>>6) & 0xfffff); + break; + case DC_BREAK: + snprintf(buf, buf_size, "%-8s %d", instname, (inst>>6)&0xfffff); + break; + case DC_OOPS: + snprintf(buf, buf_size, "%s OOPS! FIXME!", instname); + break; + default: + /* Hit something we don't know about...Shouldn't happen. */ + break; + } + + /* + * Handle comment field + */ + + + switch (commentmode) { + case 1: /* CP0 ops */ + if ((inst & 3) == 0) { /* select 0 */ + snprintf(buf + strlen(buf),buf_size-strlen(buf)," /* %s */", + CP0REGNAME((inst >> 11) & 0x1f)); + } + break; + default: + break; + } + + buf[buf_size-1] = 0; + +} diff --git a/cfe/cfe/arch/mips/common/src/exception.S b/cfe/cfe/arch/mips/common/src/exception.S new file mode 100644 index 0000000..8036b35 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/exception.S @@ -0,0 +1,546 @@ +/* ********************************************************************* + * SB1250 Board Support Package + * + * Exception Handler File: exception.S + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "exception.h" +#include "mipsmacros.h" +#include "cpu_config.h" /* for definition of HAZARD and ERET */ +#include "bsp_config.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#ifdef _MIPSREGS32_ +#define LREG lw +#define SREG sw +#define SRL srl +#define SLL sll +#else +#define LREG ld +#define SREG sd +#define SRL dsrl +#define SLL dsll +#endif + + +/* ********************************************************************* + * Data + ********************************************************************* */ + + .sdata + + .globl _exc_vectab +_exc_vectab: _LONG_ 0 # XTYPE_RESET + _LONG_ 0 # XTYPE_TLBFILL (not used) + _LONG_ 0 # XTYPE_XTLBFILL + _LONG_ 0 # XTYPE_CACHEERR (not used) + _LONG_ 0 # XTYPE_EXCEPTION + _LONG_ 0 # XTYPE_INTERRUPT + _LONG_ 0 # XTYPE_EJTAG + +/* ********************************************************************* + * Common Data + ********************************************************************* */ + + .bss + + +/* ********************************************************************* + * Code + ********************************************************************* */ + + .text + +#define R_EXC_CERR_TEMPLATE _TBLIDX(0) +#define R_EXC_CERR_TEMPLATE_END _TBLIDX(1) + + .globl _exc_cerr_htable +_exc_cerr_htable: + _LONG_ _exc_cerr_template + _LONG_ _exc_cerr_template_end + + +/* ********************************************************************* + * _exc_cerr_template + * + * This is a template routine for our cache error handler. + * We save a couple of registers in our magic save area, then + * dispatch to code elsewhere in CFE. + * + * This code is copied right to the vector address, so it has + * to be kept tiny! + * + * Input parameters: + * nothing - running uncached, all registers trashed + * + * Return value: + * might return, might not + ********************************************************************* */ + +LEAF(_exc_cerr_template) + + /* + * Magic! When the cache error handler is running, + * we are in a very special state, running uncached + * and with translations turned off. We can use offsets + * from r0(zero) to store registers we need to use + * during the error handler. + */ + + .set push ; .set noreorder + + SR k0,CFE_LOCORE_GLOBAL_K0TMP(zero) + SR k1,CFE_LOCORE_GLOBAL_K1TMP(zero) + SR ra,CFE_LOCORE_GLOBAL_RATMP(zero) + SR gp,CFE_LOCORE_GLOBAL_GPTMP(zero) + + LR k0,CFE_LOCORE_GLOBAL_CERRH(zero) + jal k0 + nop + + LR k0,CFE_LOCORE_GLOBAL_K0TMP(zero) + LR k1,CFE_LOCORE_GLOBAL_K1TMP(zero) + LR ra,CFE_LOCORE_GLOBAL_RATMP(zero) + LR gp,CFE_LOCORE_GLOBAL_GPTMP(zero) + ERET + + .set pop + + /* + * Note: make sure this routine does not exceed 128 bytes + */ + +_exc_cerr_template_end: + +END(_exc_cerr_template) + +/* ********************************************************************* + * _exc_setup_locore(cerrh) + * + * Set global data into the low-memory region. We do this in + * assembly language so it's easier to deal with the 32-bit/64-bit + * issues that arise in the "C" code. + * + * Input parameters: + * a0 - cache error handler + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(_exc_setup_locore) + + move t4,ra + + /* + * Save GP for easy re-use, using uncached writes. + */ + + li t0,PHYS_TO_K1(CFE_LOCORE_GLOBAL_GP) + SR gp,0(t0) + + /* + * Initialize cache error handler pointer. Make it + * uncached, since cache error handlers should not + * touch the cache. + */ + + li t1,(K0SIZE-1) + and a0,a0,t1 # keep just physical part + li t1,K1BASE + or a0,a0,t1 # make into an uncached address + + li t0,PHYS_TO_K1(CFE_LOCORE_GLOBAL_CERRH) + SR a0,0(t0) + + /* + * Move the cache error handler into low RAM. + */ + + li t0,PHYS_TO_K1(MIPS_RAM_VEC_CACHEERR) + + LOADREL(t1,_exc_cerr_htable) + LR t2,R_EXC_CERR_TEMPLATE_END(t1) + LR t1,R_EXC_CERR_TEMPLATE(t1) + +1: lw t3,0(t1) # get a word + sw t3,0(t0) # write a word + ADD t0,4 # next word... + ADD t1,4 + blt t1,t2,1b # till done + + /* + * Now do the whole thing again, but with cached writes. + * Writing uncached makes sure the data is actually in memory, + * and writing cached makes sure we write the same + * stuff again when the cache is evicted. + * This way we don't have to bother with cacheops, + * a bonus on the BCM1250 with its funky L2. + */ + + li t0,PHYS_TO_K0(CFE_LOCORE_GLOBAL_GP) + SR gp,0(t0) + + li t0,PHYS_TO_K0(CFE_LOCORE_GLOBAL_CERRH) + SR a0,0(t0) + + li t0,PHYS_TO_K0(MIPS_RAM_VEC_CACHEERR) + + LOADREL(t1,_exc_cerr_htable) + LR t2,R_EXC_CERR_TEMPLATE_END(t1) + LR t1,R_EXC_CERR_TEMPLATE(t1) + +1: lw t3,0(t1) # get a word + sw t3,0(t0) # write a word + ADD t0,4 # next word... + ADD t1,4 + blt t1,t2,1b # till done + + + /* + * done! + */ + + move ra,t4 + j ra + +END(_exc_setup_locore) + + + + +/* ********************************************************************* + * _exc_setvector(xtype,addr) + * + * Set an exception vector address + * + * Input parameters: + * xtype - exception vector type + * addr - routine address + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(_exc_setvector) + + la v0,_exc_vectab + srl a0,3 /* convert 8-byte index to array index */ + sll a0,BPWSIZE /* convert back to index appropriate for word size */ + add v0,a0 + SR a1,(v0) + j ra + +END(_exc_setvector) + + +/* ********************************************************************* + * _exc_crash_sim() + * + * Crash the GDB simulator, causing it to exit. + * + * Input parameters: + * nothing + * + * Return value: + * nothing - does not return + ********************************************************************* */ + + +LEAF(_exc_crash_sim) + + li $2,1 + li $3,0xdead + li $4,0 + syscall 0xca +1: b 1b + +END(_exc_crash_sim) + + +/* ********************************************************************* + * _exc_cache_crash_sim() + * + * As _exc_crash_sim, but distinguish cache error exception. + * + * Input parameters: + * nothing + * + * Return value: + * nothing - does not return + ********************************************************************* */ + + +LEAF(_exc_cache_crash_sim) + + li $2,1 + li $3,0xbadc + li $4,0 + syscall 0xca +1: b 1b + +END(_exc_cache_crash_sim) + + +/* ********************************************************************* + * _exc_restart() + * + * Restart the firmware at the boot address + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(_exc_restart) + + li t0,0xBFC00000 # ROM restart vector + jr t0 + +END(_exc_restart) + +/* ********************************************************************* + * _exc_entry(k0) + * + * Main exception entry point. + * + * Input parameters: + * k0 - exception type + * + * Return value: + * ... + ********************************************************************* */ + +LEAF(_exc_entry) + + .set noreorder + .set noat + + subu k1,sp,EXCEPTION_SIZE + SRL k1,3 + SLL k1,3 + + SREG zero,XGR_ZERO(k1) + SREG AT,XGR_AT(k1) + + SREG v0,XGR_V0(k1) + SREG v1,XGR_V1(k1) + + SREG a0,XGR_A0(k1) + SREG a1,XGR_A1(k1) + SREG a2,XGR_A2(k1) + SREG a3,XGR_A3(k1) + + SREG t0,XGR_T0(k1) + SREG t1,XGR_T1(k1) + SREG t2,XGR_T2(k1) + SREG t3,XGR_T3(k1) + SREG t4,XGR_T4(k1) + SREG t5,XGR_T5(k1) + SREG t6,XGR_T6(k1) + SREG t7,XGR_T7(k1) + + SREG s0,XGR_S0(k1) + SREG s1,XGR_S1(k1) + SREG s2,XGR_S2(k1) + SREG s3,XGR_S3(k1) + SREG s4,XGR_S4(k1) + SREG s5,XGR_S5(k1) + SREG s6,XGR_S6(k1) + SREG s7,XGR_S7(k1) + + SREG t8,XGR_T8(k1) + SREG t9,XGR_T9(k1) + + SREG gp,XGR_GP(k1) + SREG sp,XGR_SP(k1) + SREG fp,XGR_FP(k1) + SREG ra,XGR_RA(k1) + + mfc0 t0,C0_CAUSE + mfc0 t1,C0_SR + MFC0 t2,C0_BADVADDR + MFC0 t3,C0_EPC + mfc0 t4,C0_PRID + mflo t5 + mfhi t6 + SREG t0,XCP0_CAUSE(k1) + SREG t1,XCP0_SR(k1) + SREG t2,XCP0_VADDR(k1) + SREG t3,XCP0_EPC(k1) + SREG t4,XCP0_PRID(k1) + SREG t5,XGR_LO(k1) + SREG t6,XGR_HI(k1) + +#if CFG_EMBEDDED_PIC + la gp,PHYS_TO_K0(CFE_LOCORE_GLOBAL_GP) + LR gp,0(gp) # get our GP handle from low memory vector +#else + la gp,_gp # Load up GP, not relocated so it's easy +#endif + + move a0,k0 # Pass exception type + move a1,k1 # Pass frame to exception handler + la t0,_exc_vectab # get base of exception vectors + srl k0,3 # convert 8-byte index to array index + sll k0,BPWSIZE # convert back to index appropriate for word size + addu t0,k0 # get vector address + LR t0,(t0) # to call handler + + move sp,k1 # "C" gets fresh stack area + + jalr t0 # Call exception handler + nop + + move k1, sp + LREG AT,XGR_AT(k1) + + LREG t0,XGR_LO(k1) + LREG t1,XGR_HI(k1) + mtlo t0 + mthi t1 + + LREG a0,XGR_A0(k1) + LREG a1,XGR_A1(k1) + LREG a2,XGR_A2(k1) + LREG a3,XGR_A3(k1) + + LREG t0,XGR_T0(k1) + LREG t1,XGR_T1(k1) + LREG t2,XGR_T2(k1) + LREG t3,XGR_T3(k1) + LREG t4,XGR_T4(k1) + LREG t5,XGR_T5(k1) + LREG t6,XGR_T6(k1) + LREG t7,XGR_T7(k1) + + LREG s0,XGR_S0(k1) + LREG s1,XGR_S1(k1) + LREG s2,XGR_S2(k1) + LREG s3,XGR_S3(k1) + LREG s4,XGR_S4(k1) + LREG s5,XGR_S5(k1) + LREG s6,XGR_S6(k1) + LREG s7,XGR_S7(k1) + + LREG t8,XGR_T8(k1) + LREG t9,XGR_T9(k1) + + LREG gp,XGR_GP(k1) + LREG sp,XGR_SP(k1) + LREG fp,XGR_FP(k1) + LREG ra,XGR_RA(k1) + +/* do any CP0 cleanup here */ + + LREG v0,XGR_V0(k1) + LREG v1,XGR_V1(k1) + + ERET + + .set at + .set reorder + + +END(_exc_entry) + + +/* ********************************************************************* + * _exc_clear_sr_exl() + * + * Clear SR(EXL) and return to caller. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(_exc_clear_sr_exl) + + mfc0 t0,C0_SR + and t0,t0,~(0x02) # clear SR(EXL). Bit 1 + mtc0 t0,C0_SR + + HAZARD + + j ra + +END(_exc_clear_sr_exl) + +/* ********************************************************************* + * _exc_clear_sr_erl() + * + * Clear SR(ERL) and return to caller. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(_exc_clear_sr_erl) + + mfc0 t0,C0_SR + and t0,t0,~(0x04) # clear SR(ERL). Bit 2 + mtc0 t0,C0_SR + + HAZARD + + j ra + +END(_exc_clear_sr_erl) + + +/* ********************************************************************* + * End + ********************************************************************* */ + + diff --git a/cfe/cfe/arch/mips/common/src/exchandler.c b/cfe/cfe/arch/mips/common/src/exchandler.c new file mode 100644 index 0000000..d69b980 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/exchandler.c @@ -0,0 +1,580 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Exception Handler File: exchandler.c + * + * This is the "C" part of the exception handler and the + * associated setup routines. We call these routines from + * the assembly-language exception handler. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "exception.h" +#include "cfe.h" +#include "cfe_error.h" +#include "cfe_iocb.h" +#include "exchandler.h" +#include "cpu_config.h" +#include "bsp_config.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +/* + * Temporary until all our CPU packages support a cache error handler + */ + +#ifndef CPUCFG_CERRHANDLER +#define CPUCFG_CERRHANDLER 0xBFC00000 +#else +extern void CPUCFG_CERRHANDLER(void); +#endif + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +exc_handler_t exc_handler; +extern void _exc_entry(void); +extern void _exc_setup_locore(long); +extern void CPUCFG_TLBHANDLER(void); +extern void cfe_flushcache(uint32_t,long,long); +extern uint32_t _getstatus(void); +extern void _setstatus(uint32_t); + +static const char *regnames = "0 ATv0v1a0a1a2a3t0t1t2t3t4t5t6t7" + "s0s1s2s3s4s5s6s7t8t9k0k1gpspfpra"; +static const char *excnames = + "Interrupt" /* 0 */ + "TLBMod " /* 1 */ + "TLBMissRd" /* 2 */ + "TLBMissWr" /* 3 */ + "AddrErrRd" /* 4 */ + "AddrErrWr" /* 5 */ + "BusErrRd " /* 6 */ + "BusErrWr " /* 7 */ + "Syscall " /* 8 */ + "Breakpt " /* 9 */ + "InvOpcode" /* 10 */ + "CoProcUnu" /* 11 */ + "ArithOvfl" /* 12 */ + "TrapExc " /* 13 */ + "VCEI " /* 14 */ + "FPUExc " /* 15 */ + "CP2Exc " /* 16 */ + "Exc17 " /* 17 */ + "Exc18 " /* 18 */ + "Exc19 " /* 19 */ + "Exc20 " /* 20 */ + "Exc21 " /* 21 */ + "Exc22 " /* 22 */ + "Watchpt " /* 23 */ + "Exc24 " /* 24 */ + "Exc25 " /* 25 */ + "Exc26 " /* 26 */ + "Exc27 " /* 27 */ + "Exc28 " /* 28 */ + "Exc29 " /* 29 */ + "Exc30 " /* 30 */ + "VCED "; /* 31 */ + + + +/* ********************************************************************* + * cfe_exception(code,info) + * + * Exception handler. This routine is called when any CPU + * exception that is handled by the assembly-language + * vectors is reached. The usual thing to do here is just to + * reboot. + * + * Input parameters: + * code - exception type + * info - exception stack frame + * + * Return value: + * usually reboots + ********************************************************************* */ + +void cfe_exception(int code,uint64_t *info) +{ + int idx; + + SETLEDS("EXC!"); + + if(exc_handler.catch_exc == 1) { + /*Deal with exception without restarting CFE.*/ + + /*Clear relevant SR bits*/ + _exc_clear_sr_exl(); + _exc_clear_sr_erl(); + + /*Reset flag*/ + exc_handler.catch_exc = 0; + + exc_longjmp_handler(); + } + + +#ifdef _MIPSREGS32_ + xprintf("**Exception %d: EPC=%08X, Cause=%08X (%9s)\n", + code,(uint32_t)info[XCP0_EPC], + (uint32_t)info[XCP0_CAUSE], + excnames + G_CAUSE_EXC((uint32_t)info[XCP0_CAUSE])*9); + xprintf(" RA=%08X, VAddr=%08X\n", + (uint32_t)info[XGR_RA],(uint32_t)info[XCP0_VADDR]); + xprintf("\n"); + for (idx = 0;idx < 32; idx+= 2) { + xprintf(" %2s ($%2d) = %08X %2s ($%2d) = %08X\n", + regnames+(idx*2), + idx,(uint32_t)info[XGR_ZERO+idx], + regnames+((idx+1)*2), + idx+1,(uint32_t)info[XGR_ZERO+idx+1]); + } +#else + xprintf("**Exception %d: EPC=%016llX, Cause=%08X (%9s)\n", + code,info[XCP0_EPC],info[XCP0_CAUSE], + excnames + G_CAUSE_EXC((uint32_t)info[XCP0_CAUSE])*9); + xprintf(" RA=%016llX, VAddr=%016llX\n", + info[XGR_RA],info[XCP0_VADDR]); + xprintf("\n"); + for (idx = 0;idx < 32; idx+= 2) { + xprintf(" %2s ($%2d) = %016llX %2s ($%2d) = %016llX\n", + regnames+(idx*2), + idx,info[XGR_ZERO+idx], + regnames+((idx+1)*2), + idx+1,info[XGR_ZERO+idx+1]); + } +#endif + + xprintf("\n"); + _exc_restart(); +} + +#if (!CFG_BOOTRAM) && (CFG_RUNFROMKSEG0) +/* ********************************************************************* + * exc_setup_hw_vector(vecoffset,target,k0code) + * + * Install a patch of code at the specified offset in low + * KSEG0 memory that will jump to 'target' and load k0 + * with the specified code value. This is used when we + * run with RAM vectors. + * + * Input parameters: + * vecoffset - offset into KSEG0 + * target - location where we should branch when vector is called + * k0code - value to load into K0 before branching + * + * Return value: + * nothing + ********************************************************************* */ + +static void exc_setup_hw_vector(uint32_t vecoffset, + void *target, + uint32_t k0code) +{ + uint32_t *vec; + uint32_t new; + uint32_t lower,upper; + + new = (uint32_t) (intptr_t) target; /* warning: assumes compatibility addresses! */ + + lower = new & 0xffff; + upper = (new >> 16) & 0xffff; + if ((lower & 0x8000) != 0) { + upper++; + } + + /* + * Get a KSEG0 version of the vector offset. + */ + vec = (uint32_t *) PHYS_TO_K0(vecoffset); + + /* + * Patch in the vector. Note that we have to flush + * the L1 Dcache and invalidate the L1 Icache before + * we can use this. + */ + + vec[0] = 0x3c1b0000 | upper; /* lui k1, HIGH(new) */ + vec[1] = 0x277b0000 | lower; /* addiu k1, k1, LOW(new) */ + vec[2] = 0x03600008; /* jr k1 */ + vec[3] = 0x241a0000 | k0code; /* li k0, code */ + +} + + +/* ********************************************************************* + * exc_install_ram_vectors() + * + * Install all of the hardware vectors into low memory, + * flush the cache, and clear the BEV bit so we can start + * using them. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void exc_install_ram_vectors(void) +{ + uint32_t *ptr; + int idx; + + /* Debug: blow away the vector area so we can see what we did */ + ptr = (uint32_t *) PHYS_TO_K0(0); + for (idx = 0; idx < 0x1000/sizeof(uint32_t); idx++) *ptr++ = 0; + + /* + * Set up the vectors. The cache error handler is set up + * specially. + */ + + exc_setup_hw_vector(MIPS_RAM_VEC_TLBFILL, CPUCFG_TLBHANDLER,XTYPE_TLBFILL); + exc_setup_hw_vector(MIPS_RAM_VEC_XTLBFILL, _exc_entry,XTYPE_XTLBFILL); + exc_setup_hw_vector(MIPS_RAM_VEC_CACHEERR, _exc_entry,XTYPE_CACHEERR); + exc_setup_hw_vector(MIPS_RAM_VEC_EXCEPTION,_exc_entry,XTYPE_EXCEPTION); + exc_setup_hw_vector(MIPS_RAM_VEC_INTERRUPT,_exc_entry,XTYPE_INTERRUPT); + + /* + * Flush the D-cache and invalidate the I-cache so we can start + * using these vectors. + */ + + cfe_flushcache(CFE_CACHE_FLUSH_D | CFE_CACHE_INVAL_I,0,0); + + /* + * Write the handle into our low memory space. If we need to save + * other stuff down there, this is a good place to do it. + * This call uses uncached writes - we have not touched the + * memory in the handlers just yet, so they should not be + * in our caches. + */ + + _exc_setup_locore((intptr_t) CPUCFG_CERRHANDLER); + + /* + * Finally, clear BEV so we'll use the vectors in RAM. + */ + + _setstatus(_getstatus() & ~M_SR_BEV); + + /* + * XXX There's a hazard here, but we're not going to worry about + * XXX it. It is unlikely we'll use the vectors any time soon. + */ +} +#endif + +/* ********************************************************************* + * cfe_setup_exceptions() + * + * Set up the exception handlers. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ +void cfe_setup_exceptions(void) +{ + _exc_setvector(XTYPE_TLBFILL, (void *) cfe_exception); + _exc_setvector(XTYPE_XTLBFILL, (void *) cfe_exception); + _exc_setvector(XTYPE_CACHEERR, (void *) _exc_cache_crash_sim); + _exc_setvector(XTYPE_EXCEPTION,(void *) cfe_exception); + _exc_setvector(XTYPE_INTERRUPT,(void *) cfe_exception); + _exc_setvector(XTYPE_EJTAG, (void *) cfe_exception); + + exc_handler.catch_exc = 0; + q_init( &(exc_handler.jmpbuf_stack)); + +#if (!CFG_BOOTRAM) && (CFG_RUNFROMKSEG0) + /* + * Install RAM vectors, and clear the BEV bit in the status + * register. Don't do this if we're running from PromICE RAM + */ + exc_install_ram_vectors(); +#endif +} + + + +/* ********************************************************************* + * exc_initialize_block() + * + * Set up the exception handler. Allow exceptions to be caught. + * Allocate memory for jmpbuf and store it away. + * + * Returns NULL if error in memory allocation. + * + * Input parameters: + * nothing + * + * Return value: + * jmpbuf_t structure, or NULL if no memory + ********************************************************************* */ +jmpbuf_t *exc_initialize_block(void) +{ + jmpbuf_t *jmpbuf_local; + + exc_handler.catch_exc = 1; + + /* Create the jmpbuf_t object */ + jmpbuf_local = (jmpbuf_t *) KMALLOC((sizeof(jmpbuf_t)),0); + + if (jmpbuf_local == NULL) { + return NULL; + } + + q_enqueue( &(exc_handler.jmpbuf_stack), &((*jmpbuf_local).stack)); + + return jmpbuf_local; +} + +/* ********************************************************************* + * exc_cleanup_block(dq_jmpbuf) + * + * Remove dq_jmpbuf from the exception handler stack and free + * the memory. + * + * Input parameters: + * dq_jmpbuf - block to deallocate + * + * Return value: + * nothing + ********************************************************************* */ + +void exc_cleanup_block(jmpbuf_t *dq_jmpbuf) +{ + int count; + + if (dq_jmpbuf == NULL) { + return; + } + + count = q_count( &(exc_handler.jmpbuf_stack)); + + if( count > 0 ) { + q_dequeue( &(*dq_jmpbuf).stack ); + KFREE(dq_jmpbuf); + } +} + +/* ********************************************************************* + * exc_cleanup_handler(dq_jmpbuf,chain_exc) + * + * Clean a block, then chain to the next exception if required. + * + * Input parameters: + * dq_jmpbuf - current exception + * chain_exc - true if we should chain to the next handler + * + * Return value: + * nothing + ********************************************************************* */ + +void exc_cleanup_handler(jmpbuf_t *dq_jmpbuf, int chain_exc) +{ + exc_cleanup_block(dq_jmpbuf); + + if( chain_exc == EXC_CHAIN_EXC ) { + /*Go to next exception on stack */ + exc_longjmp_handler(); + } +} + + + +/* ********************************************************************* + * exc_longjmp_handler() + * + * This routine long jumps to the exception handler on the top + * of the exception stack. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ +void exc_longjmp_handler(void) +{ + int count; + jmpbuf_t *jmpbuf_local; + + count = q_count( &(exc_handler.jmpbuf_stack)); + + if( count > 0 ) { + jmpbuf_local = (jmpbuf_t *) q_getlast(&(exc_handler.jmpbuf_stack)); + + SETLEDS("CFE "); + + lib_longjmp( (*jmpbuf_local).jmpbuf, -1); + } +} + + +/* ********************************************************************* + * mem_peek(d,addr,type) + * + * Read memory of the specified type at the specified address. + * Exceptions are caught in the case of a bad memory reference. + * + * Input parameters: + * d - pointer to where data should be placed + * addr - address to read + * type - type of read to do (MEM_BYTE, etc.) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int mem_peek(void *d, long addr, int type) +{ + + jmpbuf_t *jb; + + jb = exc_initialize_block(); + if( jb == NULL ) { + return CFE_ERR_NOMEM; + } + + if (exc_try(jb) == 0) { + + switch (type) { + case MEM_BYTE: + *(uint8_t *)d = *((volatile uint8_t *) addr); + break; + case MEM_HALFWORD: + *(uint16_t *)d = *((volatile uint16_t *) addr); + break; + case MEM_WORD: + *(uint32_t *)d = *((volatile uint32_t *) addr); + break; + case MEM_QUADWORD: + *(uint64_t *)d = *((volatile uint64_t *) addr); + break; + default: + return CFE_ERR_INV_PARAM; + } + + exc_cleanup_block(jb); + } + else { + /*Exception handler*/ + + exc_cleanup_handler(jb, EXC_NORMAL_RETURN); + return CFE_ERR_GETMEM; + } + + return 0; +} + +/* ********************************************************************* + * Write memory of type at address addr with value val. + * Exceptions are caught, handled (error message) and function + * returns with 0. + * + * 1 success + * 0 failure + ********************************************************************* */ + +int mem_poke(long addr, uint64_t val, int type) +{ + + jmpbuf_t *jb; + + jb = exc_initialize_block(); + if( jb == NULL ) { + return CFE_ERR_NOMEM; + } + + if (exc_try(jb) == 0) { + + switch (type) { + case MEM_BYTE: + *((volatile uint8_t *) addr) = (uint8_t) val; + break; + case MEM_HALFWORD: + *((volatile uint16_t *) addr) = (uint16_t) val; + break; + case MEM_WORD: + *((volatile uint32_t *) addr) = (uint32_t) val; + break; + case MEM_QUADWORD: + *((volatile uint64_t *) addr) = (uint64_t) val; + break; + default: + return CFE_ERR_INV_PARAM; + } + + exc_cleanup_block(jb); + } + else { + /*Exception handler*/ + + exc_cleanup_handler(jb, EXC_NORMAL_RETURN); + return CFE_ERR_SETMEM; + } + + return 0; +} + + + + + + + + + + diff --git a/cfe/cfe/arch/mips/common/src/init_mips.S b/cfe/cfe/arch/mips/common/src/init_mips.S new file mode 100755 index 0000000..3f59539 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/init_mips.S @@ -0,0 +1,683 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * CPU init module File: init_mips.S + * + * This module contains the vectors and lowest-level CPU startup + * functions for CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "exception.h" + +#include "bsp_config.h" +#include "cpu_config.h" + +#ifdef _CFE_ +#include "cfe_devfuncs.h" +#else + +#define cfe_command_restart 0 +#endif + +/* BCM63XX specific change. */ +#include "bcm_hwdefs.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#include "mipsmacros.h" + + +/* ********************************************************************* + * SETLEDS(a,b,c,d) + * SETLEDS1(a,b,c,d) + * + * Sets the on-board LED display (if present). Two variants + * of this routine are provided. If you're running KSEG1, + * call the SETLEDS1 variant, else call SETLEDS. + * + * Input parameters: + * a,b,c,d - four ASCII characters (literal constants) + * + * Return value: + * a0,k1,ra trashed + ********************************************************************* */ + +#define SETLEDS(a,b,c,d) \ + li a0,(((a)<<24)|((b)<<16)|((c)<<8)|(d)) ; \ + CALLINIT_KSEG0(init_table,R_INIT_SETLEDS) + +#define SETLEDS1(a,b,c,d) \ + li a0,(((a)<<24)|((b)<<16)|((c)<<8)|(d)) ; \ + CALLINIT_KSEG1(init_table,R_INIT_SETLEDS) + + +/* ********************************************************************* + * Other constants + ********************************************************************* */ + +/* + * This is the size of the stack, rounded to KByte boundaries. + */ + +#ifndef CFG_STACK_SIZE +#error "CFG_STACK_SIZE not defined" +#else +#define STACK_SIZE ((CFG_STACK_SIZE+1023) & ~1023) +#endif + +#ifdef __MIPSEB +#define TEXTSECTION 0x2e746578 # ".tex", big-endian +#else +#define TEXTSECTION 0x7865742e # ".tex", little-endian +#endif + +/* + * Duplicates from cfe_iocb.h -- warning! + */ + +#define CFE_CACHE_FLUSH_D 1 +#define CFE_CACHE_INVAL_I 2 +#define CFE_CACHE_INVAL_D 4 +#define CFE_CACHE_INVAL_L2 8 +#define CFE_CACHE_FLUSH_L2 16 +#define CFE_CACHE_INVAL_RANGE 32 +#define CFE_CACHE_FLUSH_RANGE 64 + + +/* + * To make life easier reading this code, define "KSEGBASE" + * to either K0BASE or K1BASE depending on whether we're running + * uncached. + */ + +#if CFG_RUNFROMKSEG0 +#define KSEGBASE K0BASE +#else +#define KSEGBASE K1BASE +#endif + + +/* ********************************************************************* + * Names of registers used in this module + ********************************************************************* */ + +#define RELOCOFFSET s8 /* $30 (fp) */ +#define TEXTOFFSET t9 /* $25 (t9) */ +#define MEMTOP t8 /* $24 (t8) */ +#define TEXTBASE s7 /* $23 (s7) */ +#undef BOOT_OFFSET +#define BOOT_OFFSET s6 /* $22 (s6) */ + + .sdata + +#include "initdata.h" /* declare variables we use here */ + +#if CFG_MULTI_CPUS + .globl cfe_spinlock +cfe_spinlock: .word 0 +#endif + + .extern _fdata + .extern _edata + .extern _etext + +/* ********************************************************************* + * uninitialized data + ********************************************************************* */ + + .bss + + .comm __junk,4 + +/* ********************************************************************* + * Exception Vectors + ********************************************************************* */ + + .text + + .set noreorder + +/* + * Declare the actual vectors. This expands to code that + * must be at the very beginning of the text segment. + */ + +DECLARE_VECTOR(0x0000,vec_reset,cpu_reset) + + .set reorder + +/* ********************************************************************* + * Some offsets depend on our current configuration + ********************************************************************* */ + +#define RUNTIME_RELOC_START 0 +#define RUNTIME_RELOC_STOP 0 + +/* ********************************************************************* + * Segment Table. + * + * Addresses of data segments and of certain routines we're going + * to call from KSEG1. These are here mostly for the embedded + * PIC case, since we can't count on the 'la' instruction to + * do the expected thing (the assembler expands it into a macro + * for doing GP-relative stuff, and the code is NOT GP-relative. + * So, we (relocatably) get the offset of this table and then + * index within it. + * + * Pointer values in this segment will be relative to KSEG0 for + * cached versions of CFE, so we need to OR in K1BASE in the + * case of calling to a uncached address. + * + * The LOADREL macro handles most of the nastiness here. + ********************************************************************* */ + +#include "segtable.h" +#include "cfe.h" + + .org 0x570 + .byte 'c','f','e','-','v',CFE_VER_MAJOR,CFE_VER_MINOR,CFE_VER_BUILD,BCM63XX_MAJOR,BCM63XX_MINOR # CFE version info for applications + .org 0x580 # move past exception vectors + + /* + * BCM963XX NVRAM Data Storage + */ + + .globl nvram_data_storage +nvram_data_storage: + .word NVRAM_DATA_ID + .space 0x400 + + .globl segment_table +segment_table: + _LONG_ _etext # [ 0] End of text (R_SEG_ETEXT) + _LONG_ _fdata # [ 1] Beginning of data (R_SEG_FDATA) + _LONG_ _edata # [ 2] End of data (R_SEG_EDATA) + _LONG_ _end # [ 3] End of BSS (R_SEG_END) + _LONG_ _ftext # [ 4] Beginning of text (R_SEG_FTEXT) + _LONG_ _fbss # [ 5] Beginning of BSS (R_SEG_FBSS) + _LONG_ _gp # [ 6] Global Pointer (R_SEG_GP) + _LONG_ 0 # [ 7] Beginning of reloc entries + _LONG_ 0 # [ 8] End of reloc entries + _LONG_ 0 # [ 9] R_SEG_APIENTRY + +/* ********************************************************************* + * Init Table. + * + * This is like segment_table except it contains pointers to + * routines used during initialization. It serves both as a + * table for doing PIC stuff and also to separate out + * machine-specific init routines. + * + * The CALLINIT_xxx macros are used to call routines in this table. + ********************************************************************* */ + + + .globl init_table +init_table: + _LONG_ board_earlyinit # [ 0] R_INIT_EARLYINIT + _LONG_ board_setleds # [ 1] R_INIT_SETLEDS + _LONG_ board_draminfo # [ 2] R_INIT_DRAMINFO + _LONG_ CPUCFG_CPUINIT # [ 3] R_INIT_CPUINIT + _LONG_ CPUCFG_ALTCPU_START1 # [ 4] R_INIT_ALTCPU_START1 + _LONG_ CPUCFG_ALTCPU_START2 # [ 5] R_INIT_ALTCPU_START2 + _LONG_ CPUCFG_ALTCPU_RESET # [ 6] R_INIT_ALTCPU_RESET + _LONG_ CPUCFG_CPURESTART # [ 7] R_INIT_CPURESTART + _LONG_ CPUCFG_DRAMINIT # [ 8] R_INIT_DRAMINIT + _LONG_ CPUCFG_CACHEOPS # [ 9] R_INIT_CACHEOPS + _LONG_ CPUCFG_TLBHANDLER # [ 10] R_INIT_TLBHANDLER + _LONG_ cfe_main # [ 11] R_INIT_CMDSTART + _LONG_ cfe_command_restart # [ 12] R_INIT_CMDRESTART + _LONG_ cfe_doxreq # [ 13] R_INIT_DOXREQ + _LONG_ CPUCFG_TP1_SWITCH # [ 14] R_INIT_TP1_SWITCH + _LONG_ cfe_size_ram # [ 15] R_INIT_SIZERAM + +/* ********************************************************************* + * CPU Startup Code + ********************************************************************* */ + +cpu_reset: + + /* + * Start with GP as zero. Nobody should touch + * this or set it to any other value until we're ready + * to use it. This is used to tell when we should start + * using relocated references in the init table, + * so beware! (see CALLINIT_RELOC in mipsmacros.h) + */ + + move gp,zero # start with no GP. + + .set noreorder + bal 1f + nop +1: nop + .set reorder + li BOOT_OFFSET, 0x1fff0000 + and BOOT_OFFSET, ra + +#------------------------------------------------------------------------------ + + /* + * Do low-level board initialization. This is our first + * chance to customize the startup sequence. + */ + move a0, BOOT_OFFSET + + CALLINIT_KSEG1(init_table,R_INIT_EARLYINIT) + + SETLEDS1('H','E','L','O') + + CALLINIT_KSEG1(init_table,R_INIT_CPUINIT) + +#------------------------------------------------------------------------------ + + /* + * Now, switch from KSEG1 to KSEG0 + */ + +#if CFG_RUNFROMKSEG0 + bal cpu_kseg0_switch +#endif + +#------------------------------------------------------------------------------ + /* + * Now running on cpu0 in K0SEG. + */ + +#if CFG_CMT + /* + * Check if the thread switch is required. If we are already + * running on thread 1 this function will do nothing and just return + * If we are running on thread 0 this function will take thread 1 + * out of reset and put thread 0 to sleep waiting for singnal from + * thread 1. + */ + CALLINIT_KSEG0(init_table,R_INIT_TP1_SWITCH) +#endif + +#if CFG_INIT_DRAM + SETLEDS('D','R','A','M') + + CALLINIT_KSEG0(init_table,R_INIT_DRAMINFO) + + move a0,v0 # pass these params + CALLINIT_KSEG0(init_table,R_INIT_DRAMINIT) + CALLINIT_KSEG0(init_table,R_INIT_SIZERAM) + move k0,v0 # Save in k0 for now +#else + li k0,(CFG_DRAM_SIZE * 1024) +#endif + +#------------------------------------------------------------------------------ + +#if CFG_BOOTRAM + b have_ram # No RAM is ok if using emulator RAM +#endif + + bne k0,zero,have_ram + + SETLEDS('R','A','M','X') # die here if no ram + +die1: b die1 + +have_ram: + + /* + * If this is the 64-bit version, turn on the KX bit + * to allow 64-bit accesses. + */ + +#ifdef __long64 + mfc0 t0,C0_SR + or t0,t0,M_SR_KX + mtc0 t0,C0_SR +#endif + +#------------------------------------------------------------------------------ + /* + * K0 contains the RAM size (and therefore the top of RAM + * offset). Start there, and subtract the amount of memory + * we expect to use. If we have more than 256MB of + * physical memory, work backwards from the 256MB + * boundary. + */ + +__CalcMemTop: li MEMTOP,256 # 256MB boundary + bgt k0,MEMTOP,1f # use 256MB if k0 is greater + move MEMTOP,k0 # otherwise keep top +1: sll MEMTOP,20 # make into byte amount + + li RELOCOFFSET,0 # not relocating, no offset + li TEXTOFFSET,0 + + /* + * DRAM is now running, and we're alive in cacheable memory + * on cpu0 in K0SEG. Set up GP. + */ + + LOADREL(a0,segment_table) + LR gp,R_SEG_GP(a0) + add gp,RELOCOFFSET + +#------------------------------------------------------------------------------ + /* + * Zero BSS + */ + + SETLEDS('Z','B','S','S') + + LOADREL(a0,segment_table) +__ZeroBss: + + LR v0,R_SEG_FBSS(a0) + LR v1,R_SEG_END(a0) + ADD v0,RELOCOFFSET # Relocate to actual data segment + ADD v1,RELOCOFFSET + +1: SR zero,0(v0) # Zero one cacheline at a time + SR zero,(REGSIZE*1)(v0) + SR zero,(REGSIZE*2)(v0) + SR zero,(REGSIZE*3)(v0) + add v0,REGSIZE*4 + blt v0,v1,1b + +#------------------------------------------------------------------------------ + /* + * Copy code + */ + + SETLEDS('C','O','D','E') + + LOADREL(a0,segment_table) +__CopyCode: + + LR t1,R_SEG_FTEXT(a0) # destination address + move TEXTBASE,t1 + + LR t2,R_SEG_FTEXT(a0) # Source address + FIXUP (t2); + LR t3,R_SEG_ETEXT(a0) + FIXUP (t3); + +1: LR t4,0(t2) # read one cache line + LR t5,(REGSIZE*1)(t2) + LR t6,(REGSIZE*2)(t2) + LR t7,(REGSIZE*3)(t2) + SR t4,0(t1) # write one cache line + SR t5,(REGSIZE*1)(t1) + SR t6,(REGSIZE*2)(t1) + SR t7,(REGSIZE*3)(t1) + add t1,REGSIZE*4 + add t2,REGSIZE*4 + bltu t2,t3,1b + +#------------------------------------------------------------------------------ + /* + * Copy initialized data + */ + +#if (CFG_BOOTRAM == 0) + + SETLEDS('D','A','T','A') + + LOADREL(a0,segment_table) + +__CopyData: + LR t1,R_SEG_FDATA(a0) + FIXUP (t1); + li t0,15 + add t1,t0 + not t0 + and t1,t0 # t1 = _etext rounded up to 16-byte boundary + + LR t2,R_SEG_FDATA(a0) + LR t3,R_SEG_EDATA(a0) + ADD t2,RELOCOFFSET # Relocate to actual data segment + ADD t3,RELOCOFFSET + +1: LR t4,0(t1) # read one cache line + LR t5,(REGSIZE*1)(t1) + LR t6,(REGSIZE*2)(t1) + LR t7,(REGSIZE*3)(t1) + SR t4,0(t2) # write one cache line + SR t5,(REGSIZE*1)(t2) + SR t6,(REGSIZE*2)(t2) + SR t7,(REGSIZE*3)(t2) + add t1,(REGSIZE*4) + add t2,(REGSIZE*4) + bltu t2,t3,1b + +#endif + +#------------------------------------------------------------------------------ + + /* + * Flush the cache, then switch to relocated code + * We need to flush the cache since we just moved the code and + * it may still live in our L1 DCache. We also need to + * flush L2, since there are some rare times we run + * uncached from DRAM, like when we start/stop a CPU. + * + * In the case of running completely uncached, don't flush the + * cache. It should not have any dirty lines in it, but you + * never know... + */ + +__GoRelo: + +#if CFG_RUNFROMKSEG0 + SETLEDS('L','1','2','F') + + li a0,CFE_CACHE_FLUSH_D | CFE_CACHE_FLUSH_L2 + CALLINIT_KSEG0(init_table,R_INIT_CACHEOPS) + li a0,CFE_CACHE_INVAL_I + CALLINIT_KSEG0(init_table,R_INIT_CACHEOPS) +#endif /* CFG_RUNFROMKSEG0 */ + + la t0,gorelo # Now jump to an address code was compiled for + j t0 # and go there +gorelo: nop + li BOOT_OFFSET, 0 # no longer running at offset + + /* + * Remember total amount of memory. This is *still* in k0 + * after all this time. Hopefully. + */ + +__MemVars: + SR k0,mem_totalsize + SR RELOCOFFSET,mem_datareloc + + move v0,zero + + LOADREL(a0,segment_table) # trashed by l2 cache flush + LR v0,R_SEG_FDATA(a0) + ADD v0,RELOCOFFSET + LR v1,R_SEG_END(a0) + ADD v1,RELOCOFFSET + + SR v0,mem_bottomofmem + SR v1,mem_heapstart + + add v1,(CFG_HEAP_SIZE*1024) # Otherwise + add v1,STACK_SIZE + SR v1,mem_topofmem + + SR TEXTOFFSET,mem_textreloc + + /* At this point it's safe to use the CALLINIT_RELOC macro */ + + LR t1,R_SEG_FTEXT(a0) + FIXUP (t1); + LR t0,R_SEG_ETEXT(a0) + FIXUP (t0); + sub t0,t0,t1 + SR t0,mem_textsize + add t1,TEXTOFFSET + SR t1,mem_textbase + + +#------------------------------------------------------------------------------ + + /* + * Stash away some config register stuff + */ + + mfc0 v0,C0_PRID + SR v0,cpu_prid + + +#------------------------------------------------------------------------------ + + /* + * Set up the "C" stack and jump to the main routine. + */ + + SETLEDS('M','A','I','N') + + LR sp,mem_heapstart + ADD sp,((CFG_HEAP_SIZE*1024)+STACK_SIZE - 8) + li a0,0 # call as "cfe_main(0,0)" + li a1,0 + + CALLINIT_RELOC(init_table,R_INIT_CMDSTART) # should not return + +/* ********************************************************************* + * CFE_LAUNCH + * + * Start the user program. The program is passed a handle + * that must be passed back when calling the firmware. + * + * Parameters passed to the called program are as follows: + * + * a0 - CFE handle + * a1 - entry vector + * a2 - reserved, will be 0 + * a3 - entrypoint signature. + * + * Input parameters: + * a0 - entry vector + * + * Return value: + * does not return + ********************************************************************* */ + +LEAF(cfe_launch) + + sub sp,8 + SR a0,0(sp) + + /* + * This function runs in RAM so BOOT_OFFSET is 0. It is called from + * C which could have modified the BOOT_OFFSET register, s6. + */ + li BOOT_OFFSET, 0 + + + /* + * Mask all interrupts. + */ + mfc0 v0,C0_SR # Get current interrupt flag + li v1,M_SR_IE # master interrupt control + not v1 # disable interrupts + and v0,v1 # SR now has IE=0 + mtc0 v0,C0_SR # put back into CP0 + + + /* + * Flush the D-Cache, since the program we loaded is "data". + * Invalidate the I-Cache, so that addresses in the program + * region will miss and need to be filled from the data we + * just flushed above. + */ + + li a0,CFE_CACHE_FLUSH_D|CFE_CACHE_INVAL_I + CALLINIT_RELOC(init_table,R_INIT_CACHEOPS) + + + /* + * Set things up for launching the program. Pass the + * handle in A0 - apps need to remember that and pass it + * back. + */ + + j RunProgram + +END(cfe_launch) + + /* + * This is a nice place to set a breakpoint. + */ +LEAF(RunProgram) + LR t0,0(sp) # entry point + + j t0 # go for it. +END(RunProgram) + +/* ********************************************************************* + * CPU_KSEG0_SWITCH + * + * Hack the return address so we will come back in KSEG0 + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(cpu_kseg0_switch) + + and ra,(K0SIZE-1) + or ra,K0BASE + jr ra + +END(cpu_kseg0_switch) + +/* ********************************************************************* + * End + ********************************************************************* */ + + diff --git a/cfe/cfe/arch/mips/common/src/init_ram.S b/cfe/cfe/arch/mips/common/src/init_ram.S new file mode 100755 index 0000000..2531700 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/init_ram.S @@ -0,0 +1,889 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * CPU init module File: init_ram.S + * + * This module contains the vectors and lowest-level CPU startup + * functions for CFE. + * + * This is very similar to "init_mips.S" but is used when + * you want to locate CFE in DRAM, loading it like an + * application program. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "exception.h" + +#include "bsp_config.h" +#include "cpu_config.h" + +#include "cfe_devfuncs.h" + +/* ********************************************************************* + * Check some stuff + ********************************************************************* */ + +#if CFG_RELOC +#error "RAM version is not compatible with relocation." +#endif +#if !(CFG_RUNFROMKSEG0) +#error "RAM version should be run cached" +#endif + +#if CFG_MULTI_CPUS +#error "Multiple CPUs not compatible with RAM version" +#endif + + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#include "mipsmacros.h" + + +/* ********************************************************************* + * SETLEDS(a,b,c,d) + * + * Sets the on-board LED display (if present). + * + * Input parameters: + * a,b,c,d - four ASCII characters (literal constants) + * + * Return value: + * a0,k1,ra trashed + ********************************************************************* */ + + +#define SETLEDS(a,b,c,d) \ + li a0,(((a)<<24)|((b)<<16)|((c)<<8)|(d)) ; \ + jal board_setleds ; + + +/* ********************************************************************* + * Other constants + ********************************************************************* */ + +/* + * This is the size of the stack, rounded to KByte boundaries. + */ + +#ifndef CFG_STACK_SIZE +#error "CFG_STACK_SIZE not defined" +#else +#define STACK_SIZE ((CFG_STACK_SIZE+1023) & ~1023) +#endif + +/* + * Duplicates from cfe_iocb.h -- warning! + */ + +#define CFE_CACHE_FLUSH_D 1 +#define CFE_CACHE_INVAL_I 2 +#define CFE_CACHE_INVAL_D 4 +#define CFE_CACHE_INVAL_L2 8 +#define CFE_CACHE_FLUSH_L2 16 +#define CFE_CACHE_INVAL_RANGE 32 +#define CFE_CACHE_FLUSH_RANGE 64 + + +/* + * To make life easier reading this code, define "KSEGBASE" + * to either K0BASE or K1BASE depending on whether we're running + * uncached. + */ + +#define KSEGBASE K0BASE /* RAM version always cached */ + + +/* ********************************************************************* + * Names of registers used in this module + ********************************************************************* */ + + .sdata + +#include "initdata.h" /* declare variables we use here */ + +#if CFG_MULTI_CPUS + .globl cfe_spinlock +cfe_spinlock: .word 0 +#endif + + .extern _fdata + .extern _edata + .extern _etext + +/* ********************************************************************* + * uninitialized data + ********************************************************************* */ + + .bss + + .comm __junk,4 + + .text + + .set noreorder + + +/* ********************************************************************* + * CFE Entry Point (used by OS boot loaders and such) + ********************************************************************* */ + + .set noreorder + + .globl vec_reset + +vec_reset: b cpu_reset + nop + + +vec_apientry: b cpu_apientry + nop + .word CFE_EPTSEAL + .word CFE_EPTSEAL + + .set reorder + + +/* ********************************************************************* + * Segment Table. + * + * Addresses of data segments and of certain routines we're going + * to call from KSEG1. These are here mostly for the embedded + * PIC case, since we can't count on the 'la' instruction to + * do the expected thing (the assembler expands it into a macro + * for doing GP-relative stuff, and the code is NOT GP-relative. + * So, we (relocatably) get the offset of this table and then + * index within it. + * + * Pointer values in this segment will be relative to KSEG0 for + * cached versions of CFE, so we need to OR in K1BASE in the + * case of calling to a uncached address. + * + * The LOADREL macro handles most of the nastiness here. + ********************************************************************* */ + + +#include "segtable.h" + + .globl segment_table +segment_table: + _LONG_ _etext # [ 0] End of text (R_SEG_ETEXT) + _LONG_ _fdata # [ 1] Beginning of data (R_SEG_FDATA) + _LONG_ _edata # [ 2] End of data (R_SEG_EDATA) + _LONG_ _end # [ 3] End of BSS (R_SEG_END) + _LONG_ _ftext # [ 4] Beginning of text (R_SEG_FTEXT) + _LONG_ _fbss # [ 5] Beginning of BSS (R_SEG_FBSS) + _LONG_ _gp # [ 6] Global Pointer (R_SEG_GP) + _LONG_ 0 # [ 7] Beginning of reloc entries + _LONG_ 0 # [ 8] End of reloc entries + _LONG_ cpu_apientry # [ 9] R_SEG_APIENTRY + + +/* ********************************************************************* + * Init Table. + * + * This is like segment_table except it contains pointers to + * routines used during initialization. It serves both as a + * table for doing PIC stuff and also to separate out + * machine-specific init routines. + * + * The CALLINIT_xxx macros are used to call routines in this table. + ********************************************************************* */ + + + .globl init_table +init_table: + _LONG_ board_earlyinit # [ 0] R_INIT_EARLYINIT + _LONG_ board_setleds # [ 1] R_INIT_SETLEDS + _LONG_ board_draminfo # [ 2] R_INIT_DRAMINFO + _LONG_ CPUCFG_CPUINIT # [ 3] R_INIT_CPUINIT + _LONG_ CPUCFG_ALTCPU_START1 # [ 4] R_INIT_ALTCPU_START1 + _LONG_ CPUCFG_ALTCPU_START2 # [ 5] R_INIT_ALTCPU_START2 + _LONG_ CPUCFG_ALTCPU_RESET # [ 6] R_INIT_ALTCPU_RESET + _LONG_ CPUCFG_CPURESTART # [ 7] R_INIT_CPURESTART + _LONG_ CPUCFG_DRAMINIT # [ 8] R_INIT_DRAMINIT + _LONG_ CPUCFG_CACHEOPS # [ 9] R_INIT_CACHEOPS + _LONG_ CPUCFG_TLBHANDLER # [ 10] R_INIT_TLBHANDLER + _LONG_ cfe_main # [ 11] R_INIT_CMDSTART + _LONG_ cfe_command_restart # [ 12] R_INIT_CMDRESTART + _LONG_ cfe_doxreq # [ 13] R_INIT_DOXREQ + _LONG_ CPUCFG_TP1_SWITCH # [ 14] R_INIT_TP1_SWITCH + _LONG_ bcmcore_null # [ 15] R_INIT_SIZERAM + +/* ********************************************************************* + * CPU Startup Code + ********************************************************************* */ + + +cpu_reset: + +#------------------------------------------------------------------------------ + + /* + * Do low-level board initialization. This is our first + * chance to customize the startup sequence. + */ + + CALLINIT_KSEG0(init_table,R_INIT_EARLYINIT) + + SETLEDS('H','E','L','O') + +#------------------------------------------------------------------------------ + + /* + * DRAM is now running, and we're alive in cacheable memory + * on cpu0 in K0SEG. Set up GP. + */ + + LOADREL(a0,segment_table) + LR gp,R_SEG_GP(a0) + +#------------------------------------------------------------------------------ + /* + * Zero BSS + */ + + SETLEDS('Z','B','S','S') + + LOADREL(a0,segment_table) +__ZeroBss: + + LR v0,R_SEG_FBSS(a0) + LR v1,R_SEG_END(a0) + +1: SR zero,0(v0) # Zero one cacheline at a time + SR zero,(REGSIZE*1)(v0) + SR zero,(REGSIZE*2)(v0) + SR zero,(REGSIZE*3)(v0) + add v0,REGSIZE*4 + blt v0,v1,1b + + +#------------------------------------------------------------------------------ + + li k0,256 # memory size in megabytes + + +#ifdef __long64 + mfc0 t0,C0_SR + or t0,t0,M_SR_KX + mtc0 t0,C0_SR +#endif + +#------------------------------------------------------------------------------ + + /* + * Remember total amount of memory. This is *still* in k0 + * after all this time. Hopefully. + */ + +__MemVars: + SR k0,mem_totalsize + SR zero,mem_datareloc + + move v0,zero + + LOADREL(a0,segment_table) # trashed by l2 cache flush + LR v0,R_SEG_FTEXT(a0) # bottom = beginning of text + LR v1,R_SEG_END(a0) + + SR v0,mem_bottomofmem + SR v1,mem_heapstart + + add v1,(CFG_HEAP_SIZE*1024) # Otherwise + add v1,STACK_SIZE + SR v1,mem_topofmem + + SR zero,mem_textreloc + + + LR t1,R_SEG_FTEXT(a0) + LR t0,R_SEG_ETEXT(a0) + sub t0,t0,t1 + SR t0,mem_textsize + SR t1,mem_textbase + + +#------------------------------------------------------------------------------ + +#if CFG_MULTI_CPUS + /* + * Let secondary CPU(s) run their idle loops. Set the + * mailbox register to our relocation factor so we can read + * it out of the mailbox register and relocate GP properly. + */ + + move a0,zero + CALLINIT_KSEG0(init_table,R_INIT_ALTCPU_START2) +#endif + + /* + * Stash away some config register stuff + */ + + mfc0 v0,C0_PRID + SR v0,cpu_prid + + +#------------------------------------------------------------------------------ + + /* + * Set up the "C" stack and jump to the main routine. + */ + + SETLEDS('M','A','I','N') + + LR sp,mem_heapstart + ADD sp,((CFG_HEAP_SIZE*1024)+STACK_SIZE - 8) + li a0,0 # call as "cfe_main(0,0)" + li a1,0 + + CALLINIT_KSEG0(init_table,R_INIT_CMDSTART) # should not return + + + /* + * Terminate the simulator. + */ + +crash_sim: li $2,1 + li $4,0 + syscall 0xCA + b cpu_reset + + + +/* ********************************************************************* + * CFE_WARMSTART + * + * Restart the command interpreter + * + * Input parameters: + * A0 - command status + * nothing (GP has already been set up for us) + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(cfe_warmstart) + + SR a0,0(sp) # store on old stack + LOADREL(v0,init_table) + LR v0,R_INIT_CPURESTART(v0) + jal v0 # had better not trash GP or K1 + LR a0,0(sp) + + LR sp,mem_heapstart + ADD sp,((CFG_HEAP_SIZE*1024)+STACK_SIZE - 8) + + /* + * If someone called the API to do a warm start, clear the + * spin lock, since the call will never return. + */ + +#if CFG_MULTI_CPUS + SPIN_UNLOCK(cfe_spinlock,t0) +#endif + + CALLINIT_KSEG0(init_table,R_INIT_CMDRESTART) # should not return + +END(cfe_warmstart) + +/* ********************************************************************* + * CFE_FLUSHCACHE + * + * Perform certain cache operations + * + * Input parameters: + * a0 - flags (CFE_CACHE_xxx flags, or zero for a default) + * a1,a2 - start/end of range for "range invalidate" operations + * (not used otherwise) + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(_cfe_flushcache) + + sub sp,32 + SR ra,0(sp) + SR a0,8(sp) + SR s0,16(sp) + SR v1,24(sp) + + + CALLINIT_KSEG0(init_table,R_INIT_CACHEOPS) + + LR v1,24(sp) + LR s0,16(sp) + LR a0,8(sp) + LR ra,0(sp) + add sp,32 + j ra + +END(_cfe_flushcache) + + +/* ********************************************************************* + * CFE_LAUNCH + * + * Start the user program. The program is passed a handle + * that must be passed back when calling the firmware. + * + * Parameters passed to the called program are as follows: + * + * a0 - CFE handle + * a1 - entry vector + * a2 - reserved, will be 0 + * a3 - entrypoint signature. + * + * Input parameters: + * a0 - entry vector + * + * Return value: + * does not return + ********************************************************************* */ + +LEAF(cfe_launch) + + sub sp,8 + SR a0,0(sp) + + /* + * Mask all interrupts. + */ + mfc0 v0,C0_SR # Get current interrupt flag + li v1,M_SR_IE # master interrupt control + not v1 # disable interrupts + and v0,v1 # SR now has IE=0 + mtc0 v0,C0_SR # put back into CP0 + + /* + * Flush the D-Cache, since the program we loaded is "data". + * Invalidate the I-Cache, so that addresses in the program + * region will miss and need to be filled from the data we + * just flushed above. + */ + + li a0,CFE_CACHE_FLUSH_D|CFE_CACHE_INVAL_I + CALLINIT_KSEG0(init_table,R_INIT_CACHEOPS) + + /* + * Set things up for launching the program. Pass the + * handle in A0 - apps need to remember that and pass it + * back. + */ + + j RunProgram + +END(cfe_launch) + + /* + * This is a nice place to set a breakpoint. + */ +LEAF(RunProgram) + + LOADREL(a2,segment_table) + LR a2,R_SEG_APIENTRY(a2) # A2 = code entry + move t0,a0 # + move a1,zero # A1 = 0 + move a0,gp # A0 = handle + li a3,CFE_EPTSEAL # A3 = entrypoint signature + LR t0,0(sp) # entry point + j t0 # go for it. +END(RunProgram) + + + + +/* ********************************************************************* + * CFE_LEDS + * + * Set the on-board LEDs. + * + * Input parameters: + * a0 - LEDs + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(cfe_leds) + + j board_setleds # jump to BSP routine + +END(cfe_leds) + +/* ********************************************************************* + * TLB Fill Exeption Handler + ********************************************************************* */ + +cpu_tlbfill: + move k0,ra # Save, we're about to trash + LOADREL(k1,init_table) # Load offset of init table + LR k1,R_INIT_TLBHANDLER(k1) # Get entry from table + move ra,k0 # restore trashed ra + j k1 # Dispatch to handler + +/* ********************************************************************* + * XTLB Fill Exception Handler + ********************************************************************* */ + +cpu_xtlbfill: + j _exc_entry + +/* ********************************************************************* + * Cache Error Exception Handler + ********************************************************************* */ + +cpu_cacheerr: + j _exc_entry + + +/* ********************************************************************* + * General Exception Handler + ********************************************************************* */ + +cpu_exception: + j _exc_entry + + +/* ********************************************************************* + * General Interrupt Handler + ********************************************************************* */ + +cpu_interrupt: + j _exc_entry + + +/* ********************************************************************* + * EJTAG Debug Exception Handler + ********************************************************************* */ + +cpu_ejtag: + j cpu_reset + +/* ********************************************************************* + * cpu_apientry(handle,iocb) + * + * API entry point for external apps. + * + * Input parameters: + * a0 - firmware handle (used to determine the location of + * our relocated data) + * a1 - pointer to IOCB to execute + * + * Return value: + * v0 - return code, 0 if ok + ********************************************************************* */ + +#define _regidx(x) ((x)*8) + +#define CAE_SRSAVE _regidx(0) +#define CAE_GPSAVE _regidx(1) +#define CAE_RASAVE _regidx(2) +#define CAE_S0SAVE _regidx(3) +#define CAE_S1SAVE _regidx(4) +#define CAE_S2SAVE _regidx(5) +#define CAE_S3SAVE _regidx(6) +#define CAE_S4SAVE _regidx(7) +#define CAE_S5SAVE _regidx(8) +#define CAE_S6SAVE _regidx(9) +#define CAE_S7SAVE _regidx(10) + +#define CAE_STKSIZE _regidx(11) + +LEAF(cpu_apientry) + + sub sp,CAE_STKSIZE # Make room for our stuff + + mfc0 v0,C0_SR # Get current interrupt flag + SR v0,CAE_SRSAVE(sp) # save on stack + li t0,M_SR_IE # master interrupt control + not t0 # disable interrupts + and v0,t0 # SR now has IE=0 + mtc0 v0,C0_SR # put back into CP0 + + SR gp,CAE_GPSAVE(sp) # save GP + SR ra,CAE_RASAVE(sp) # and old RA + + SR s0,CAE_S0SAVE(sp) + SR s1,CAE_S1SAVE(sp) + SR s2,CAE_S2SAVE(sp) + SR s3,CAE_S3SAVE(sp) + SR s4,CAE_S4SAVE(sp) + SR s5,CAE_S5SAVE(sp) + SR s6,CAE_S6SAVE(sp) + SR s7,CAE_S7SAVE(sp) + + move gp,a0 # set up new GP + move a0,a1 # A0 points at IOCB + + +#if CFG_MULTI_CPUS + SPIN_LOCK(cfe_spinlock,t0,t1) +#endif + + CALLINIT_KSEG0(init_table,R_INIT_DOXREQ) # should not return + +#if CFG_MULTI_CPUS + SPIN_UNLOCK(cfe_spinlock,t0) +#endif + + # + # Restore the saved registers. + # + + LR s7,CAE_S7SAVE(sp) + LR s6,CAE_S6SAVE(sp) + LR s5,CAE_S5SAVE(sp) + LR s4,CAE_S4SAVE(sp) + LR s3,CAE_S3SAVE(sp) + LR s2,CAE_S2SAVE(sp) + LR s1,CAE_S1SAVE(sp) + LR s0,CAE_S0SAVE(sp) + + LR ra,CAE_RASAVE(sp) # unwind the stack + LR gp,CAE_GPSAVE(sp) + + LR t0,CAE_SRSAVE(sp) # old interrupt mask + + add sp,CAE_STKSIZE # restore old stack pointer + + mtc0 t0,C0_SR # restore interrupts + j ra + nop + +END(cpu_apientry) + + +/* ********************************************************************* + * CPU_KSEG0_SWITCH + * + * Hack the return address so we will come back in KSEG0 + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(cpu_kseg0_switch) + + and ra,(K0SIZE-1) + or ra,K0BASE + jr ra + +END(cpu_kseg0_switch) + + + + +/* ********************************************************************* + * _GETSTATUS() + * + * Read the STATUS register into v0 + * + * Input parameters: + * nothing + * + * Return value: + * v0 - Status register + ********************************************************************* */ + +LEAF(_getstatus) + + mfc0 v0,C0_SR + j ra +END(_getstatus) + + +/* ********************************************************************* + * _SETSTATUS() + * + * Set the STATUS register to the value in a0 + * + * Input parameters: + * nothing + * + * Return value: + * v0 - Status register + ********************************************************************* */ + +LEAF(_setstatus) + + mtc0 a0,C0_SR + j ra +END(_setstatus) + +/* ********************************************************************* + * _GETCAUSE() + * + * Read the CAUSE register into v0 + * + * Input parameters: + * nothing + * + * Return value: + * v0 - Cause register + ********************************************************************* */ + +LEAF(_getcause) + + mfc0 v0,C0_CAUSE + j ra +END(_getcause) + + +/* ********************************************************************* + * _GETTICKS() + * + * Read the COUNT register into v0 + * + * Input parameters: + * nothing + * + * Return value: + * v0 - count register + ********************************************************************* */ + +LEAF(_getticks) + + mfc0 v0,C0_COUNT + j ra +END(_getticks) + + +/* ********************************************************************* + * _SETALARM(ticks) + * + * Set the C0_Compare register from a0 + * + * Input parameters: + * a0 - compare register + * + * Return value: + * none + ********************************************************************* */ + +LEAF(_setalarm) + + mtc0 a0,C0_COMPARE + j ra +END(_setalarm) + + +/* ********************************************************************* + * _SETCONTEXT() + * + * Set the CONTEXT register. + * + * Input parameters: + * a0 - context + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(_setcontext) + + mtc0 a0,C0_CTEXT + j ra +END(_setcontext) + +/* ********************************************************************* + * _GETSEGTBL() + * + * Return the address of the segment table. We use this + * to display the startup messages. + * + * You can't just address the table from C because it lives + * in the text segment. + * + * Input parameters: + * nothing + * + * Return value: + * address of table + ********************************************************************* */ + + +LEAF(_getsegtbl) + move t0,ra + LOADREL(v0,segment_table) + move ra,t0 + j ra +END(_getsegtbl) + + +/* ********************************************************************* + * _wbflush() + * + * Flush the write buffer. This is probably not necessary + * on SiByte CPUs, but we have it for completeness. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(_wbflush) + + sync /* drain the buffers */ + la t0,__junk /* do an uncached read to force it out */ + or t0,K1BASE + lw zero,0(t0) + j ra + +END(_wbflush) + + +/* ********************************************************************* + * End + ********************************************************************* */ + + diff --git a/cfe/cfe/arch/mips/common/src/lib_hssubr.S b/cfe/cfe/arch/mips/common/src/lib_hssubr.S new file mode 100644 index 0000000..07085e3 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/lib_hssubr.S @@ -0,0 +1,194 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Hyperspace Subroutines File: lib_hssubr.S + * + * Little stub routines to allow access to KXSEG from 32-bit progs. + * + * Author: Mitch Lichtenberg (mitch@sibyte.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "mipsmacros.h" +#include "cpu_config.h" /* for definition of HAZARD */ + + +/* ********************************************************************* + * hs_read8 - read 8-bit bytes + ********************************************************************* */ + + +LEAF(hs_read8) + mfc0 t2,C0_SR + or t1,t2,M_SR_KX + mtc0 t1,C0_SR + HAZARD + + lbu v0,(a0) + + mtc0 t2,C0_SR + HAZARD + j ra +END(hs_read8) + +/* ********************************************************************* + * hs_read16 - read 16-bit shorts + ********************************************************************* */ + +LEAF(hs_read16) + mfc0 t2,C0_SR + or t1,t2,M_SR_KX + mtc0 t1,C0_SR + HAZARD + + lhu v0,(a0) + + mtc0 t2,C0_SR + HAZARD + j ra +END(hs_read16) + +/* ********************************************************************* + * hs_read32 - read 32-bit ints + ********************************************************************* */ + +LEAF(hs_read32) + mfc0 t2,C0_SR + or t1,t2,M_SR_KX + mtc0 t1,C0_SR + HAZARD + + lw v0,(a0) + + mtc0 t2,C0_SR + HAZARD + j ra +END(hs_read32) + +/* ********************************************************************* + * hs_read64 - read 64-bit longs + ********************************************************************* */ + +LEAF(hs_read64) + mfc0 t2,C0_SR + or t1,t2,M_SR_KX + mtc0 t1,C0_SR + HAZARD + + ld v0,(a0) + + mtc0 t2,C0_SR + HAZARD + j ra +END(hs_read64) + +/* ********************************************************************* + * hs_write8 - write 8-bit bytes + ********************************************************************* */ + +LEAF(hs_write8) + mfc0 t2,C0_SR + or t1,t2,M_SR_KX + mtc0 t1,C0_SR + HAZARD + + sb a1,(a0) + + mtc0 t2,C0_SR + HAZARD + j ra +END(hs_write8) + +/* ********************************************************************* + * hs_write16 - write 16-bit shorts + ********************************************************************* */ + +LEAF(hs_write16) + mfc0 t2,C0_SR + or t1,t2,M_SR_KX + mtc0 t1,C0_SR + HAZARD + + sh a1,(a0) + + mtc0 t2,C0_SR + HAZARD + j ra +END(hs_write16) + +/* ********************************************************************* + * hs_write32 - write 32-bit longs + ********************************************************************* */ + +LEAF(hs_write32) + mfc0 t2,C0_SR + or t1,t2,M_SR_KX + mtc0 t1,C0_SR + HAZARD + + sw a1,(a0) + + mtc0 t2,C0_SR + HAZARD + j ra +END(hs_write32) + +/* ********************************************************************* + * hs_write64 - write 64-bit longs + ********************************************************************* */ + +LEAF(hs_write64) + mfc0 t2,C0_SR + or t1,t2,M_SR_KX + mtc0 t1,C0_SR + HAZARD + + sd a1,(a0) + + mtc0 t2,C0_SR + HAZARD + j ra +END(hs_write64) + + +/* ********************************************************************* + * End + ********************************************************************* */ + diff --git a/cfe/cfe/arch/mips/common/src/lib_physio.S b/cfe/cfe/arch/mips/common/src/lib_physio.S new file mode 100644 index 0000000..7f57fea --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/lib_physio.S @@ -0,0 +1,173 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Physical memory peek/poke routines File: lib_physio.S + * + * Little stub routines to allow access to arbitrary physical + * addresses. In most cases this should not be needed, as + * many physical addresses are within kseg1, but this handles + * the cases that are not automagically, so we don't need + * to mess up the code with icky macros and such. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "mipsmacros.h" +#include "cpu_config.h" /* for definition of HAZARD */ + + +/* ********************************************************************* + * PHYSOP(inst,a) + * + * Macro to construct code for doing the physical I/O + * We try to avoid messing with KX or doing 64-bit stuff + * unless necessary. + * + * Input parameters: + * INST - instruction name to run + * A - register containing arg or return value + * + * Return value: + * nothing + ********************************************************************* */ + + + +#ifdef _MIPSREGS32_ +#define PHYSOP(INST,A) \ + or a0,a0,K1BASE ; \ + INST A,0(a0) ; \ + j ra ; +#else +#define PHYSOP(INST,A) \ + lui t0,0x2000 ; \ + bgeu a0,t0,1f ; \ + or a0,a0,K1BASE ; \ + INST A,0(a0) ; \ + j ra ; \ +1: lui t0,0x9000 ; \ + dsll t0,t0,32 ; \ + or a0,a0,t0 ; \ + mfc0 t1,C0_SR ; \ + and t0,t1,M_SR_KX ; \ + beq t0,zero,1f ; \ + INST A,0(a0) ; \ + j ra ; \ +1: or t0,t1,M_SR_KX ; \ + mtc0 t0,C0_SR ; \ + HAZARD ; \ + INST A,0(a0) ; \ + mtc0 t1,C0_SR ; \ + HAZARD ; \ + j ra ; +#endif + + +/* ********************************************************************* + * phys_read8 - read 8-bit bytes + ********************************************************************* */ + + +LEAF(phys_read8) +PHYSOP(lbu,v0) +END(phys_read8) + +/* ********************************************************************* + * phys_read16 - read 16-bit shorts + ********************************************************************* */ + +LEAF(phys_read16) +PHYSOP(lh,v0) +END(phys_read16) + +/* ********************************************************************* + * phys_read32 - read 32-bit ints + ********************************************************************* */ + +LEAF(phys_read32) +PHYSOP(lw,v0) +END(phys_read32) + +/* ********************************************************************* + * phys_read64 - read 64-bit longs + ********************************************************************* */ + +LEAF(phys_read64) +PHYSOP(ld,v0) +END(phys_read64) + +/* ********************************************************************* + * phys_write8 - write 8-bit bytes + ********************************************************************* */ + +LEAF(phys_write8) +PHYSOP(sb,a1) +END(phys_write8) + +/* ********************************************************************* + * phys_write16 - write 16-bit shorts + ********************************************************************* */ + +LEAF(phys_write16) +PHYSOP(sh,a1) +END(phys_write16) + +/* ********************************************************************* + * phys_write32 - write 32-bit longs + ********************************************************************* */ + +LEAF(phys_write32) +PHYSOP(sw,a1) +END(phys_write32) + +/* ********************************************************************* + * phys_write64 - write 64-bit longs + ********************************************************************* */ + +LEAF(phys_write64) +PHYSOP(sd,a1) +END(phys_write64) + + +/* ********************************************************************* + * End + ********************************************************************* */ + diff --git a/cfe/cfe/arch/mips/common/src/lib_setjmp.S b/cfe/cfe/arch/mips/common/src/lib_setjmp.S new file mode 100644 index 0000000..b8c82b3 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/lib_setjmp.S @@ -0,0 +1,94 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Simple setjmp/longjmp File: lib_setjmp.S + * + * A very simple SETJMP and LONGJMP + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + + +#include "sbmips.h" +#include "lib_setjmp.h" + +#ifdef _MIPSREGS32_ +#define SREG sw +#define LREG lw +#else +#define SREG sd +#define LREG ld +#endif + +LEAF(lib_setjmp) + + SREG s0,JMPB_S0(a0) + SREG s1,JMPB_S1(a0) + SREG s2,JMPB_S2(a0) + SREG s3,JMPB_S3(a0) + SREG s4,JMPB_S4(a0) + SREG s5,JMPB_S5(a0) + SREG s6,JMPB_S6(a0) + SREG s7,JMPB_S7(a0) + SREG fp,JMPB_FP(a0) + SREG sp,JMPB_SP(a0) + SREG ra,JMPB_RA(a0) + move v0,zero + j ra + +END(lib_setjmp) + +LEAF(lib_longjmp) + LREG s0,JMPB_S0(a0) + LREG s1,JMPB_S1(a0) + LREG s2,JMPB_S2(a0) + LREG s3,JMPB_S3(a0) + LREG s4,JMPB_S4(a0) + LREG s5,JMPB_S5(a0) + LREG s6,JMPB_S6(a0) + LREG s7,JMPB_S7(a0) + LREG fp,JMPB_FP(a0) + LREG sp,JMPB_SP(a0) + LREG ra,JMPB_RA(a0) + move v0,a1 + jr ra +END(lib_longjmp) + diff --git a/cfe/cfe/arch/mips/common/src/mips_arena.c b/cfe/cfe/arch/mips/common/src/mips_arena.c new file mode 100644 index 0000000..d96fee6 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/mips_arena.c @@ -0,0 +1,186 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Physical Memory (arena) manager File: sb1250_arena.c + * + * This module describes the physical memory available to the + * firmware. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_arena.h" + +#include "cfe_error.h" + +#include "cfe.h" +#include "cfe_mem.h" + +#include "initdata.h" + +#define _NOPROTOS_ +#include "cfe_boot.h" +#undef _NOPROTOS_ + +#include "cpu_config.h" + +#include "addrspace.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + + +#define MEG (1024*1024) +#define KB 1024 +#define PAGESIZE 4096 +#define CFE_BOOTAREA_SIZE (256*KB) +#define CFE_BOOTAREA_ADDR 0x20000000 + + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +extern arena_t cfe_arena; +uint64_t *cfe_pagetable = NULL; + +extern void CPUCFG_PAGETBLINIT(uint64_t *ptaddr,unsigned int ptstart); + +void cfe_bootarea_init(void); +extern void _setcontext(int64_t); + + +/* ********************************************************************* + * CFE_BOOTAREA_INIT() + * + * Initialize the page table and map our boot program area. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_bootarea_init(void) +{ + unsigned char *pte; + int64_t pte_int; + unsigned int addr = 16*MEG; + unsigned int topmem; + unsigned int topcfe; + unsigned int botcfe; + unsigned int beforecfe; + unsigned int aftercfe; + + /* + * Calculate the location where the boot area will + * live. It lives either above or below the + * firmware, depending on where there's more space. + */ + + /* + * The firmware will always be loaded in the first + * 256M. Calculate the top of that region. The bottom + * of that region is always the beginning of our + * data segment. + */ + if (mem_totalsize > (uint64_t)256) { + topmem = 256*MEG; + } + else { + topmem = (unsigned int) (mem_totalsize << 20); + } + botcfe = (unsigned int) K1_TO_PHYS(mem_bottomofmem); + topcfe = (unsigned int) K1_TO_PHYS(mem_topofmem); + + beforecfe = botcfe; + aftercfe = topmem-topcfe; + + if (beforecfe > aftercfe) { + botcfe -= (PAGESIZE-1); + botcfe &= ~(PAGESIZE-1); /* round down to page boundary */ + addr = botcfe - CFE_BOOTAREA_SIZE; /* this is the address */ + } + else { + topcfe += (PAGESIZE-1); /* round *up* to a page address */ + topcfe &= ~(PAGESIZE-1); + addr = topcfe; + } + + mem_bootarea_start = addr; + mem_bootarea_size = CFE_BOOTAREA_SIZE; + + /* + * Allocate the page table + */ + + pte = KMALLOC(1024,1024); + +#ifdef __long64 + pte_int = (int64_t) pte; +#else + pte_int = (int64_t) ((int) pte); +#endif + + /* + * Set the CP0 CONTEXT register to point at the page table + */ + + pte_int <<= 13; + cfe_pagetable = (uint64_t *) pte; + + _setcontext(pte_int); + + + /* + * Initialize page table entries + */ + + CPUCFG_PAGETBLINIT(cfe_pagetable,addr); + + +} + diff --git a/cfe/cfe/arch/mips/common/src/tools.mk b/cfe/cfe/arch/mips/common/src/tools.mk new file mode 100755 index 0000000..d195de9 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/tools.mk @@ -0,0 +1,83 @@ +# +# Basic compiler options and preprocessor flags +# + +CFLAGS += -g -c -ffreestanding +CFLAGS += -O1 -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes + +# +# Tools locations +# + +ifndef TOOLS +TOOLS=/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux- +endif + +GCC ?= $(TOOLS)gcc +GLD ?= $(TOOLS)ld +AR ?= $(TOOLS)ar +OBJDUMP ?= $(TOOLS)objdump +OBJCOPY ?= $(TOOLS)objcopy +RANLIB ?= $(TOOLS)ranlib + +# +# Check for 64-bit mode +# + +ifeq ($(strip ${CFG_MLONG64}),1) + CFLAGS += -mlong64 -D__long64 +endif + +# +# Figure out which linker script to use +# + +ifeq ($(strip ${CFG_RAMAPP}),1) + CFLAGS += -DCFG_RAMAPP=1 + LDFLAGS = -g --script ${ARCH_SRC}/cfe_ramapp.lds + CFLAGS += -DCFG_RUNFROMKSEG0=1 +else + ifeq ($(strip ${CFG_RELOC}),0) + ifeq ($(strip ${CFG_BOOTRAM}),1) + CFLAGS += -DCFG_BOOTRAM=1 + ROMRAM = ram + else + CFLAGS += -DCFG_BOOTRAM=0 + ROMRAM = rom + endif + ifeq ($(strip ${CFG_UNCACHED}),1) + CFLAGS += -DCFG_RUNFROMKSEG0=0 + LDFLAGS = -g --script ${ARCH_SRC}/cfe_${ROMRAM}_uncached.lds + else + CFLAGS += -DCFG_RUNFROMKSEG0=1 + LDFLAGS = -g --script ${ARCH_SRC}/cfe_${ROMRAM}_cached.lds + endif + else + CFLAGS += -membedded-pic -mlong-calls -DCFG_EMBEDDED_PIC=1 + ifeq ($(strip ${CFG_UNCACHED}),1) + CFLAGS += -DCFG_RUNFROMKSEG0=0 + LDFLAGS = -g --script ${ARCH_SRC}/cfe_rom_reloc_uncached.lds --embedded-relocs + else + CFLAGS += -DCFG_RUNFROMKSEG0=1 + ifeq ($(strip ${CFG_TEXTAT1MB}),1) + LDFLAGS = -g --script ${ARCH_SRC}/cfe_rom_reloc_cached_biendian.lds --embedded-relocs + else + LDFLAGS = -g --script ${ARCH_SRC}/cfe_rom_reloc_cached.lds --embedded-relocs + endif + endif + endif +endif +# +# Determine target endianness +# + +ifeq ($(strip ${CFG_LITTLE}),1) + ENDIAN = -EL + CFLAGS += -EL + LDFLAGS += -EL +else + ENDIAN = -EB + CFLAGS += -EB + LDFLAGS += -EB +endif + diff --git a/cfe/cfe/arch/mips/common/src/ui_memtest.c b/cfe/cfe/arch/mips/common/src/ui_memtest.c new file mode 100644 index 0000000..5388fd8 --- /dev/null +++ b/cfe/cfe/arch/mips/common/src/ui_memtest.c @@ -0,0 +1,282 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Test commands File: ui_memtest.c + * + * A simple memory test + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" + +#include "cfe_error.h" + +#include "ui_command.h" +#include "cfe.h" + +#include "bsp_config.h" + +#include "cfe_mem.h" + + +#ifdef __long64 +static int ui_cmd_memorytest(ui_cmdline_t *cmd,int argc,char *argv[]); +#endif + +#ifndef _SB_MAKE64 +#define _SB_MAKE64(x) ((uint64_t)(x)) +#endif +#ifndef _SB_MAKEMASK +#define _SB_MAKEMASK(v,n) (_SB_MAKE64((_SB_MAKE64(1)<<(v))-1) << _SB_MAKE64(n)) +#endif +#ifndef _SB_MAKEMASK1 +#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n)) +#endif + + +int ui_init_memtestcmds(void); + +int ui_init_memtestcmds(void) +{ +#ifdef __long64 + cmd_addcmd("memorytest", + ui_cmd_memorytest, + NULL, + "Tests all available memory", + "", + "-loop;Loop forever or until keypress|" + "-stoponerror;Stop if error occurs while looping|" + "-cca=*;Use specified cacheability attribute|" + "-arena=*;Test only specified arena index"); +#endif + return 0; +} + + +#ifdef __long64 +/* extensive memory tests */ + +static void inline uacwrite(volatile long *srcadr,long *dstadr) +{ +__asm __volatile ("ld $8, 0(%0) ; " + "ld $9, 8(%0) ; " + "ld $10, 16(%0) ; " + "ld $11, 24(%0) ; " + "sync ; " + "sd $8, 0(%1) ; " + "sd $9, 8(%1) ; " + "sd $10, 16(%1) ; " + "sd $11, 24(%1) ; " + "sync" :: "r"(srcadr),"r"(dstadr) : "$8","$9","$10","$11"); +} + + +#define TEST_DATA_LEN 4 +#define CACHE_LINE_LEN 32 + +static int ui_cmd_memorytest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + + static volatile long test_data[TEST_DATA_LEN] = { + 0xaaaaaaaaaaaaaaaa, 0x5555555555555555, 0xcccccccccccccccc, 0x3333333333333333, /* one cache line */ + }; + int arena, exitLoop; + int error; + int arena_type; + uint64_t arena_start, arena_size; + long phys_addr, offset, mem_base, cache_mem_base, i; + long *dst_adr, *cache_dst_adr; + long cda,tda; + int forever; + int passcnt; + int stoponerr = 0; + int cca = K_CALG_UNCACHED_ACCEL; + int arenanum = -1; + char *x; + + arena = 0; + exitLoop = 0; + offset = 0; + mem_base = 0; + passcnt = 0; + error = 0; + + forever = cmd_sw_isset(cmd,"-loop"); + stoponerr = cmd_sw_isset(cmd,"-stoponerror"); + if (cmd_sw_value(cmd,"-cca",&x)) cca = atoi(x); + if (cmd_sw_value(cmd,"-arena",&x)) arenanum = atoi(x); + + printf("Available memory arenas:\n"); + while (cfe_arena_enum(arena, &arena_type, &arena_start, &arena_size, FALSE) == 0) { + phys_addr = (long) arena_start; /* actual physical address */ + mem_base = PHYS_TO_XKPHYS(cca, phys_addr); /* virtual address */ + xprintf("phys = %016llX, virt = %016llX, size = %016llX\n", phys_addr, mem_base, arena_size); + arena++; + } + + printf("\nTesting memory.\n"); + do { + + passcnt++; + if (forever) { + if (console_status()) break; + printf("***** Iteration %d *****\n",passcnt); + } + + arena = 0; + exitLoop = 0; + error = 0; + + while (cfe_arena_enum(arena, &arena_type, &arena_start, &arena_size, FALSE) == 0) { + + if ((arenanum >= 0) && (arena != arenanum)) { + arena++; + continue; + } + + test_data[0] = 0xAAAAAAAAAAAAAAAA; + test_data[1] = 0x5555555555555555; + test_data[2] = 0xCCCCCCCCCCCCCCCC; + test_data[3] = 0x3333333333333333; + + phys_addr = (long) arena_start; /* actual physical address */ + mem_base = PHYS_TO_XKPHYS(cca, phys_addr); /* virtual address */ + cache_mem_base = PHYS_TO_K0(phys_addr); + + xprintf("\n"); + xprintf("Testing: phys = %016llX, virt = %016llX, size = %016llX\n", phys_addr, mem_base, arena_size); + + xprintf("Writing: a/5/c/3\n"); + + for (offset = 0; (offset < arena_size); offset += CACHE_LINE_LEN) { + dst_adr = (long*)(mem_base+offset); + uacwrite(test_data, dst_adr); + } + + xprintf("Reading: a/5/c/3\n"); + + for (offset = 0; (offset < arena_size); offset += CACHE_LINE_LEN) { + dst_adr = (long*)(mem_base+offset); + cache_dst_adr = (long*)(mem_base+offset); + for (i = 0; i < TEST_DATA_LEN; i++) { + cda = cache_dst_adr[i]; + tda = test_data[i]; + if (cda != tda) { + xprintf("mem[%016llX] %016llX != %016llX\n", + mem_base+offset+(i*8), cda, tda); + exitLoop = 1; + } + } + if (exitLoop) break; + } + + + if (exitLoop) { + exitLoop = 0; + error++; + arena++; + continue; + } + + xprintf("Writing: address|5555/inv/aaaa|address\n"); + exitLoop = 0; + + for (offset = 0; (offset < arena_size); offset += CACHE_LINE_LEN) { + dst_adr = (long*)(mem_base+offset); + test_data[0] = ((long)dst_adr<<32)|0x55555555; + test_data[1] = ~test_data[0]; + test_data[2] = 0xaaaaaaaa00000000|((long)dst_adr & 0xffffffff); + test_data[3] = ~test_data[2]; + uacwrite(test_data, dst_adr); + } + + xprintf("Reading: address|5555/inv/aaaa|address\n"); + + for (offset = 0; (offset < arena_size); offset += CACHE_LINE_LEN) { + dst_adr = (long*)(mem_base+offset); + test_data[0] = ((long)dst_adr<<32)|0x55555555; + test_data[1] = ~test_data[0]; + test_data[2] = 0xaaaaaaaa00000000|((long)dst_adr & 0xffffffff); + test_data[3] = ~test_data[2]; + cache_dst_adr = (long*)(mem_base+offset); + for (i = 0; i < TEST_DATA_LEN; i++) { + cda = cache_dst_adr[i]; + tda = test_data[i]; + if (cda != tda) { + xprintf("mem[%016llX] %016llX != %016llX\n", + mem_base+offset+(i*8),cda,tda); + exitLoop = 1; + } + } + if (exitLoop) break; + } + + if (exitLoop) { + error++; + exitLoop = 0; + if (stoponerr) forever = 0; + } + + arena++; + } + } while (forever); + + if (error) printf("Failing address: %016llX\n",mem_base+offset); + + return error ? -1 : 0; +} + +#endif + + + + diff --git a/cfe/cfe/arch/mips/cpu/SIBYTE_PRIVATE_FILES b/cfe/cfe/arch/mips/cpu/SIBYTE_PRIVATE_FILES new file mode 100644 index 0000000..1e7d4b6 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/SIBYTE_PRIVATE_FILES @@ -0,0 +1,2 @@ +bcmcore +bcm1400 diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/include/bcm4710.h b/cfe/cfe/arch/mips/cpu/bcmcore/include/bcm4710.h new file mode 100644 index 0000000..f499bc9 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/include/bcm4710.h @@ -0,0 +1,58 @@ +/* + Copyright 2001, Broadcom Corporation + All Rights Reserved. + + This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; + the contents of this file may not be disclosed to third parties, copied or + duplicated in any form, in whole or in part, without the prior written + permission of Broadcom Corporation. +*/ +/* + * BCM4710 address space map and definitions + * + * Think twice before adding to this file, this is not the kitchen sink + * These definitions are not guaranteed for all 47xx chips, only the 4710 + * + * Copyright (C) 2000 Broadcom Corporation + * $Id: bcm4710.h,v 1.1 2001/10/31 18:49:25 mpl Exp $ + */ + +#ifndef _bcm4710_h_ +#define _bcm4710_h_ + +/* Address map */ +#define BCM4710_SDRAM 0x00000000 /* Physical SDRAM */ +#define BCM4710_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */ +#define BCM4710_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */ +#define BCM4710_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */ +#define BCM4710_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */ +#define BCM4710_ENUM 0x18000000 /* Beginning of core enumeration space */ + +/* Core register space */ +#define BCM4710_REG_SDRAM 0x18000000 /* SDRAM core registers */ +#define BCM4710_REG_ILINE20 0x18001000 /* InsideLine20 core registers */ +#define BCM4710_REG_EMAC0 0x18002000 /* Ethernet MAC 0 core registers */ +#define BCM4710_REG_CODEC 0x18003000 /* Codec core registers */ +#define BCM4710_REG_USB 0x18004000 /* USB core registers */ +#define BCM4710_REG_PCI 0x18005000 /* PCI core registers */ +#define BCM4710_REG_MIPS 0x18006000 /* MIPS core registers */ +#define BCM4710_REG_EXTIF 0x18007000 /* External Interface core registers */ +#define BCM4710_REG_EMAC1 0x18008000 /* Ethernet MAC 1 core registers */ + +#define BCM4710_EXTIF 0x1f000000 /* External Interface base address */ +#define BCM4710_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */ + +#define BCM4710_UART (BCM4710_REG_EXTIF + 0x00000300) + +#define BCM4710_EUART (BCM4710_EXTIF + 0x00800000) +#define BCM4710_LED (BCM4710_EXTIF + 0x00900000) + +#ifdef CONFIG_VSIM +#define BCM4710_TRACE(trval) do { *((int *)0xa0002ff8) = (trval); } while (0) +#else +#define BCM4710_TRACE(trval) do { *((unsigned char *)KSEG1ADDR(BCM4710_LED)) = (trval); \ + *((int *)0xa0002ff8) = (trval); } while (0) +#endif + + +#endif /* _bcm4710_h_ */ diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/include/bcm47xx.h b/cfe/cfe/arch/mips/cpu/bcmcore/include/bcm47xx.h new file mode 100644 index 0000000..eb752e5 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/include/bcm47xx.h @@ -0,0 +1,8 @@ +#ifndef _BCM47XX_H +#define _BCM47XX_H + +/* uart defaults */ +#define DIV_LO 0x36 +#define DIV_HI 0 + +#endif diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/include/bcmnvram.h b/cfe/cfe/arch/mips/cpu/bcmcore/include/bcmnvram.h new file mode 100644 index 0000000..b9d37e6 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/include/bcmnvram.h @@ -0,0 +1,123 @@ +/* + Copyright 2001, Broadcom Corporation + All Rights Reserved. + + This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; + the contents of this file may not be disclosed to third parties, copied or + duplicated in any form, in whole or in part, without the prior written + permission of Broadcom Corporation. +*/ +/* + * NVRAM variable manipulation + * + * Copyright (C) 2001 Broadcom Corporation + * + * $Id: bcmnvram.h,v 1.1 2001/10/31 18:49:25 mpl Exp $ + */ + +#ifndef _bcmnvram_h_ +#define _bcmnvram_h_ + +#ifndef _LANGUAGE_ASSEMBLY + +struct nvram_header { + unsigned long magic; + unsigned long len; + unsigned long crc_ver_init; /* 0:7 crc, 8:15 ver, 16:27 init, mem. test 28, 29-31 reserved */ + unsigned long config_refresh; /* 0:15 config, 16:31 refresh */ + unsigned long reserved; +}; + +struct nvram_tuple { + char *name; + char *value; + struct nvram_tuple *next; +}; + +/* Compatibility */ +typedef struct nvram_tuple EnvRec; + +/* + * Get the value of an NVRAM variable + * @param name name of variable to get + * @return value of variable or NULL if undefined + */ +extern char * nvram_get(const char *name); + +/* + * Get the value of an NVRAM variable + * @param name name of variable to get + * @return value of variable or NUL if undefined + */ +#define nvram_safe_get(name) (nvram_get(name) ? : "") + +/* + * Match an NVRAM variable + * @param name name of variable to match + * @param match value to compare against value of variable + * @return TRUE if variable is defined and its value is string equal to match or FALSE otherwise + */ +#define nvram_match(name, match) ({ \ + const char *value = nvram_get(name); \ + (value && !strcmp(value, match)); \ +}) + +/* + * Match an NVRAM variable + * @param name name of variable to match + * @param match value to compare against value of variable + * @return TRUE if variable is defined and its value is not string equal to invmatch or FALSE otherwise + */ +#define nvram_invmatch(name, invmatch) ({ \ + const char *value = nvram_get(name); \ + (value && strcmp(value, invmatch)); \ +}) + +/* + * Set the value of an NVRAM variable + * @param name name of variable to set + * @param value value of variable + * @return 0 on success and errno on failure + * NOTE: use nvram_commit to commit this change to flash. + */ +extern int nvram_set(const char *name, const char *value); + +/* + * Unset an NVRAM variable + * @param name name of variable to unset + * @return 0 on success and errno on failure + * NOTE: use nvram_commit to commit this change to flash. + */ +extern int nvram_unset(const char *name); + +/* + * Permanently commit NVRAM variables + * @return 0 on success and errno on failure + */ +extern int nvram_commit(void); + +/* + * Get all NVRAM variables (format name=value\0 ... \0\0) + * @param buf buffer to store variables + * @param count size of buffer in bytes + * @return 0 on success and errno on failure + */ +extern int nvram_getall(char *buf, int count); + +/* + * Invalidate the current NVRAM header + * @return 0 on success and errno on failure + */ +extern int nvram_invalidate(void); + +#endif /* _LANGUAGE_ASSEMBLY */ + +#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ +#define NVRAM_VERSION 1 +#define NVRAM_HEADER_SIZE 20 +#define NVRAM_FIRST_LOC 0xbfcf8000 +#define NVRAM_LAST_LOC 0xbfff8000 +#define NVRAM_LOC_GAP 0x100000 +#define NVRAM_SPACE 0x8000 + +#endif /* _bcmnvram_h_ */ diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/include/cpu_config.h b/cfe/cfe/arch/mips/cpu/bcmcore/include/cpu_config.h new file mode 100755 index 0000000..51cf4e1 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/include/cpu_config.h @@ -0,0 +1,62 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * CPU Configuration file File: cpu_config.h + * + * This file contains the names of the routines to be used + * in the dispatch table in init_mips.S + * + * It lives here in the CPU directory so we can direct + * the init calls to routines named in this directory. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * XX Copyright 2000,2001 + * Broadcom Corporation. All rights reserved. + * + * BROADCOM PROPRIETARY AND CONFIDENTIAL + * + * This software is furnished under license and may be used and + * copied only in accordance with the license. + ********************************************************************* */ + +/* + */ + +#define CPUCFG_CPUINIT bcmcore_cpuinit +#define CPUCFG_ALTCPU_START1 bcmcore_null +#define CPUCFG_ALTCPU_START2 bcmcore_null +#define CPUCFG_ALTCPU_RESET bcmcore_null +#define CPUCFG_CPURESTART bcmcore_cpurestart +#define CPUCFG_DRAMINIT board_draminit /* no dram on CPU */ +#define CPUCFG_CACHEOPS bcmcore_cacheops +#define CPUCFG_ARENAINIT bcmcore_arena_init +#define CPUCFG_PAGETBLINIT bcmcore_pagetable_init +#define CPUCFG_TLBHANDLER bcmcore_tlbhandler +#define CPUCFG_DIAG_TEST1 bcmcore_null +#define CPUCFG_DIAG_TEST2 bcmcore_null +#if CFG_CMT +#define CPUCFG_TP1_SWITCH bcmcore_tp1_switch +#else +#define CPUCFG_TP1_SWITCH bcmcore_null +#endif +/* + * The BCMCORE ticks CP0 every other cycle. + */ + +#define CPUCFG_CYCLESPERCPUTICK 2 + +/* + * Hazard macro + */ + +#define HAZARD nop ; nop ; nop ; nop ; nop ; nop ; nop +#define ERET \ + .set push ; \ + .set mips4 ; \ + eret ; \ + .set pop + + diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/include/sbmips.h b/cfe/cfe/arch/mips/cpu/bcmcore/include/sbmips.h new file mode 100644 index 0000000..0f4e055 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/include/sbmips.h @@ -0,0 +1,670 @@ +/* ********************************************************************* + * SB1250 Board Support Package + * + * MIPS64 CPU definitions File: sbmips.h + * + * This module contains constants and macros specific to the + * SB1 MIPS64 core. + * + * Author: Mitch Lichtenberg (mitch@sibyte.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _SB_MIPS_H +#define _SB_MIPS_H + +/* ********************************************************************* + * Configure language + ********************************************************************* */ + +#if defined(__ASSEMBLER__) +#define _ATYPE_ +#define _ATYPE32_ +#define _ATYPE64_ +#else +#define _ATYPE_ (__SIZE_TYPE__) +#define _ATYPE32_ (int) +#define _ATYPE64_ (long long) +#endif + + +/* ********************************************************************* + * Bitfield macros + ********************************************************************* */ + +/* + * Make a mask for 1 bit at position 'n' + */ + +#define _MM_MAKEMASK1(n) (1 << (n)) + +/* + * Make a mask for 'v' bits at position 'n' + */ + +#define _MM_MAKEMASK(v,n) (((1<<(v))-1) << (n)) + +/* + * Make a value at 'v' at bit position 'n' + */ + +#define _MM_MAKEVALUE(v,n) ((v) << (n)) + +/* + * Retrieve a value from 'v' at bit position 'n' with 'm' mask bits + */ + +#define _MM_GETVALUE(v,n,m) (((v) & (m)) >> (n)) + + + +/* ********************************************************************* + * 32-bit MIPS Address Spaces + ********************************************************************* */ + +#ifdef __ASSEMBLER__ +#define _ACAST32_ +#define _ACAST64_ +#else +#define _ACAST32_ _ATYPE_ _ATYPE32_ /* widen if necessary */ +#define _ACAST64_ _ATYPE64_ /* do _not_ narrow */ +#endif + +/* 32-bit address map */ +#define UBASE 0x00000000 /* user+ mapped */ +#define USIZE 0x80000000 +#define K0BASE (_ACAST32_ 0x80000000) /* kernel unmapped cached */ +#define K0SIZE 0x20000000 +#define K1BASE (_ACAST32_ 0xa0000000) /* kernel unmapped uncached */ +#define K1SIZE 0x20000000 +#define KSBASE (_ACAST32_ 0xc0000000) /* supervisor+ mapped */ +#define KSSIZE 0x20000000 +#define K3BASE (_ACAST32_ 0xe0000000) /* kernel mapped */ +#define K3SIZE 0x20000000 + +/* 64-bit address map additions to the above (sign-extended) ranges */ +#define XUBASE (_ACAST64_ 0x0000000080000000) /* user+ mapped */ +#define XUSIZE (_ACAST64_ 0x00000FFF80000000) +#define XSSEGBASE (_ACAST64_ 0x4000000000000000) /* supervisor+ mapped */ +#define XSSEGSIZE (_ACAST64_ 0x0000100000000000) +#define XKPHYSBASE (_ACAST64_ 0x8000000000000000) /* kernel unmapped */ +#define XKPHYSSIZE (_ACAST64_ 0x0000100000000000) +#define XKSEGBASE (_ACAST64_ 0xC000000000000000) /* kernel mapped */ +#define XKSEGSIZE (_ACAST64_ 0x00000FFF80000000) + +#define GEN_VECT (_ACAST32_ 0x80000080) +#define UTLB_VECT (_ACAST32_ 0x80000000) + +/* ********************************************************************* + * Address space coercion macros + ********************************************************************* */ + +#define PHYS_TO_K0(pa) (K0BASE | (pa)) +#define PHYS_TO_K1(pa) (K1BASE | (pa)) +#define K0_TO_PHYS(va) ((va) & (K0SIZE-1)) +#define K1_TO_PHYS(va) ((va) & (K1SIZE-1)) +#define K0_TO_K1(va) ((va) | K1SIZE) +#define K1_TO_K0(va) ((va) & ~K1SIZE) + +#define PHYS_TO_XK1(p) (_ACAST64_ (0xffffffffa0000000 | (p))) +#define XK1_TO_PHYS(p) ((p) & (K1SIZE-1)) +#define PHYS_TO_XKPHYS(cca,p) (_SB_MAKEMASK1(63) | (_SB_MAKE64(cca) << 59) | (p)) +#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED,(p)) +#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE,(p)) +#define XKPHYS_TO_PHYS(p) ((p) & _SB_MAKEMASK(0,59)) + + +#if !defined(__ASSEMBLER__) +#define mips_wbflush() __asm__ __volatile__ ("sync" : : : "memory") +#define ISK0SEG(va) ((va) >= K0BASE && (va) <= (K0BASE + K0SIZE - 1)) +#define ISK1SEG(va) ((va) >= K1BASE && (va) <= (K1BASE + K1SIZE - 1)) +#endif + +/* ********************************************************************* + * Register aliases + ********************************************************************* */ + +#if defined(__ASSEMBLER__) +#define zero $0 +#define AT $1 /* assembler temporaries */ +#define v0 $2 /* value holders */ +#define v1 $3 +#define a0 $4 /* arguments */ +#define a1 $5 +#define a2 $6 +#define a3 $7 +#define t0 $8 /* temporaries */ +#define t1 $9 +#define t2 $10 +#define t3 $11 +#define t4 $12 +#define t5 $13 +#define t6 $14 +#define t7 $15 +#define ta0 $12 +#define ta1 $13 +#define ta2 $14 +#define ta3 $15 +#define s0 $16 /* saved registers */ +#define s1 $17 +#define s2 $18 +#define s3 $19 +#define s4 $20 +#define s5 $21 +#define s6 $22 +#define s7 $23 +#define t8 $24 /* temporaries */ +#define t9 $25 +#define k0 $26 /* kernel registers */ +#define k1 $27 +#define gp $28 /* global pointer */ +#define sp $29 /* stack pointer */ +#define s8 $30 /* saved register */ +#define fp $30 /* frame pointer */ +#define ra $31 /* return address */ +#endif + +/* ********************************************************************* + * CP0 Registers + ********************************************************************* */ + +#if defined(__ASSEMBLER__) +#define C0_INX $0 /* CP0: TLB Index */ +#define C0_RAND $1 /* CP0: TLB Random */ +#define C0_TLBLO0 $2 /* CP0: TLB EntryLo0 */ +#define C0_TLBLO C0_TLBLO0 /* CP0: TLB EntryLo0 */ +#define C0_TLBLO1 $3 /* CP0: TLB EntryLo1 */ +#define C0_CTEXT $4 /* CP0: Context */ +#define C0_PGMASK $5 /* CP0: TLB PageMask */ +#define C0_WIRED $6 /* CP0: TLB Wired */ +#define C0_BADVADDR $8 /* CP0: Bad Virtual Address */ +#define C0_COUNT $9 /* CP0: Count */ +#define C0_TLBHI $10 /* CP0: TLB EntryHi */ +#define C0_COMPARE $11 /* CP0: Compare */ +#define C0_SR $12 /* CP0: Processor Status */ +#define C0_STATUS C0_SR /* CP0: Processor Status */ +#define C0_CAUSE $13 /* CP0: Exception Cause */ +#define C0_EPC $14 /* CP0: Exception PC */ +#define C0_PRID $15 /* CP0: Processor Revision Indentifier */ +#define C0_CONFIG $16 /* CP0: Config */ +#define C0_LLADDR $17 /* CP0: LLAddr */ +#define C0_WATCHLO $18 /* CP0: WatchpointLo */ +#define C0_WATCHHI $19 /* CP0: WatchpointHi */ +#define C0_XCTEXT $20 /* CP0: XContext */ +#define C0_ECC $26 /* CP0: ECC */ +#define C0_CACHEERR $27 /* CP0: CacheErr */ +#define C0_TAGLO $28 /* CP0: TagLo */ +#define C0_TAGHI $29 /* CP0: TagHi */ +#define C0_ERREPC $30 /* CP0: ErrorEPC */ +#else +#define C0_INX 0 /* CP0: TLB Index */ +#define C0_RAND 1 /* CP0: TLB Random */ +#define C0_TLBLO0 2 /* CP0: TLB EntryLo0 */ +#define C0_TLBLO C0_TLBLO0 /* CP0: TLB EntryLo0 */ +#define C0_TLBLO1 3 /* CP0: TLB EntryLo1 */ +#define C0_CTEXT 4 /* CP0: Context */ +#define C0_PGMASK 5 /* CP0: TLB PageMask */ +#define C0_WIRED 6 /* CP0: TLB Wired */ +#define C0_BADVADDR 8 /* CP0: Bad Virtual Address */ +#define C0_COUNT 9 /* CP0: Count */ +#define C0_TLBHI 10 /* CP0: TLB EntryHi */ +#define C0_COMPARE 11 /* CP0: Compare */ +#define C0_SR 12 /* CP0: Processor Status */ +#define C0_STATUS C0_SR /* CP0: Processor Status */ +#define C0_CAUSE 13 /* CP0: Exception Cause */ +#define C0_EPC 14 /* CP0: Exception PC */ +#define C0_PRID 15 /* CP0: Processor Revision Indentifier */ +#define C0_CONFIG 16 /* CP0: Config */ +#define C0_LLADDR 17 /* CP0: LLAddr */ +#define C0_WATCHLO 18 /* CP0: WatchpointLo */ +#define C0_WATCHHI 19 /* CP0: WatchpointHi */ +#define C0_XCTEXT 20 /* CP0: XContext */ +#define C0_ECC 26 /* CP0: ECC */ +#define C0_CACHEERR 27 /* CP0: CacheErr */ +#define C0_TAGLO 28 /* CP0: TagLo */ +#define C0_TAGHI 29 /* CP0: TagHi */ +#define C0_ERREPC 30 /* CP0: ErrorEPC */ +#endif + +/* ********************************************************************* + * CP1 (floating point) control registers + ********************************************************************* */ + +#define FPA_IRR 0 /* CP1: Implementation/Revision */ +#define FPA_CSR 31 /* CP1: Control/Status */ + +/* ********************************************************************* + * Macros for generating assembly language routines + ********************************************************************* */ + +#if defined(__ASSEMBLER__) + +/* global leaf function (does not call other functions) */ +#define LEAF(name) \ + .globl name; \ + .ent name; \ +name: + +/* global alternate entry to (local or global) leaf function */ +#define XLEAF(name) \ + .globl name; \ + .aent name; \ +name: + +/* end of a global function */ +#define END(name) \ + .size name,.-name; \ + .end name + +/* local leaf function (does not call other functions) */ +#define SLEAF(name) \ + .ent name; \ +name: + +/* local alternate entry to (local or global) leaf function */ +#define SXLEAF(name) \ + .aent name; \ +name: + +/* end of a local function */ +#define SEND(name) \ + END(name) + +/* define & export a symbol */ +#define EXPORT(name) \ + .globl name; \ +name: + +/* import a symbol */ +#define IMPORT(name, size) \ + .extern name,size + +/* define a zero-fill common block (BSS if not overridden) with a global name */ +#define COMM(name,size) \ + .comm name,size + +/* define a zero-fill common block (BSS if not overridden) with a local name */ +#define LCOMM(name,size) \ + .lcomm name,size + +#endif + + +/* Floating-Point Control register bits */ +#define CSR_C 0x00800000 +#define CSR_EXC 0x0003f000 +#define CSR_EE 0x00020000 +#define CSR_EV 0x00010000 +#define CSR_EZ 0x00008000 +#define CSR_EO 0x00004000 +#define CSR_EU 0x00002000 +#define CSR_EI 0x00001000 +#define CSR_TV 0x00000800 +#define CSR_TZ 0x00000400 +#define CSR_TO 0x00000200 +#define CSR_TU 0x00000100 +#define CSR_TI 0x00000080 +#define CSR_SV 0x00000040 +#define CSR_SZ 0x00000020 +#define CSR_SO 0x00000010 +#define CSR_SU 0x00000008 +#define CSR_SI 0x00000004 +#define CSR_RM 0x00000003 + +/* Status Register */ +#define M_SR_CUMASK _MM_MAKEMASK(4,28) /* coprocessor usable bits */ +#define M_SR_CU3 _MM_MAKEMASK1(31) /* coprocessor 3 usable */ +#define M_SR_CU2 _MM_MAKEMASK1(30) /* coprocessor 2 usable */ +#define M_SR_CU1 _MM_MAKEMASK1(29) /* coprocessor 1 usable */ +#define M_SR_CU0 _MM_MAKEMASK1(28) /* coprocessor 0 usable */ + +#define M_SR_RP _MM_MAKEMASK1(27) /* reduced power mode */ +#define M_SR_FR _MM_MAKEMASK1(26) /* fpu regs any data */ +#define M_SR_RE _MM_MAKEMASK1(25) /* reverse endian */ +#define M_SR_MX _MM_MAKEMASK1(24) /* MDMX */ +#define M_SR_PX _MM_MAKEMASK1(23) /* 64-bit ops in user mode */ +#define M_SR_BEV _MM_MAKEMASK1(22) /* boot exception vectors */ +#define M_SR_TS _MM_MAKEMASK1(21) /* TLB is shut down */ +#define M_SR_SR _MM_MAKEMASK1(20) /* soft reset */ +#define M_SR_NMI _MM_MAKEMASK1(19) /* nonmaskable interrupt */ + +#define M_SR_IMASK _MM_MAKEMASK(8,8) /* all interrupt mask bits */ + +#define M_SR_IBIT8 _MM_MAKEMASK1(15) /* individual bits */ +#define M_SR_IBIT7 _MM_MAKEMASK1(14) +#define M_SR_IBIT6 _MM_MAKEMASK1(13) +#define M_SR_IBIT5 _MM_MAKEMASK1(12) +#define M_SR_IBIT4 _MM_MAKEMASK1(11) +#define M_SR_IBIT3 _MM_MAKEMASK1(10) +#define M_SR_IBIT2 _MM_MAKEMASK1(9) +#define M_SR_IBIT1 _MM_MAKEMASK1(8) + +#define M_SR_IMASK8 0 /* masks for nested int levels */ +#define M_SR_IMASK7 _MM_MAKEMASK(1,15) +#define M_SR_IMASK6 _MM_MAKEMASK(2,14) +#define M_SR_IMASK5 _MM_MAKEMASK(3,13) +#define M_SR_IMASK4 _MM_MAKEMASK(4,12) +#define M_SR_IMASK3 _MM_MAKEMASK(5,11) +#define M_SR_IMASK2 _MM_MAKEMASK(6,10) +#define M_SR_IMASK1 _MM_MAKEMASK(7,9) +#define M_SR_IMASK0 _MM_MAKEMASK(8,8) + +#define M_SR_KX _MM_MAKEMASK1(7) /* 64-bit access for kernel */ +#define M_SR_SX _MM_MAKEMASK1(6) /* .. for supervisor */ +#define M_SR_UX _MM_MAKEMASK1(5) /* .. for user */ + +#define S_SR_KSU 3 /* base operating mode mode */ +#define M_SR_KSU _MM_MAKEMASK(2,S_SR_KSU) +#define V_SR_KSU(x) _MM_MAKEVALUE(x,S_SR_KSU) +#define G_SR_KSU(x) _MM_GETVALUE(x,S_SR_KSU,M_SR_KSU) +#define K_SR_KSU_KERNEL 0 +#define K_SR_KSU_SUPR 1 +#define K_SR_KSU_USER 2 + +#define M_SR_UM _MM_MAKEMASK1(4) +#define M_SR_ERL _MM_MAKEMASK1(2) +#define M_SR_EXL _MM_MAKEMASK1(1) +#define M_SR_IE _MM_MAKEMASK1(0) + +/* + * Cause Register + */ +#define M_CAUSE_BD _MM_MAKEMASK1(31) /* exception in BD slot */ + +#define S_CAUSE_CE 28 /* coprocessor error */ +#define M_CAUSE_CE _MM_MAKEMASK(2,S_CAUSE_CE) +#define V_CAUSE_CE(x) _MM_MAKEVALUE(x,S_CAUSE_CE) +#define G_CAUSE_CE(x) _MM_GETVALUE(x,S_CAUSE_CE,M_CAUSE_CE) + +#define M_CAUSE_IV _MM_MAKEMASK1(23) /* special interrupt */ +#define M_CAUSE_WP _MM_MAKEMASK1(22) /* watch interrupt deferred */ + +#define S_CAUSE_IPMASK 8 +#define M_CAUSE_IPMASK _MM_MAKEMASK(8,S_CAUSE_IPMASK) +#define M_CAUSE_IP8 _MM_MAKEMASK1(15) /* hardware interrupts */ +#define M_CAUSE_IP7 _MM_MAKEMASK1(14) +#define M_CAUSE_IP6 _MM_MAKEMASK1(13) +#define M_CAUSE_IP5 _MM_MAKEMASK1(12) +#define M_CAUSE_IP4 _MM_MAKEMASK1(11) +#define M_CAUSE_IP3 _MM_MAKEMASK1(10) +#define M_CAUSE_SW2 _MM_MAKEMASK1(9) /* software interrupts */ +#define M_CAUSE_SW1 _MM_MAKEMASK1(8) + +#define S_CAUSE_EXC 2 +#define M_CAUSE_EXC _MM_MAKEMASK(5,S_CAUSE_EXC) +#define V_CAUSE_EXC(x) _MM_MAKEVALUE(x,S_CAUSE_EXC) +#define G_CAUSE_EXC(x) _MM_GETVALUE(x,S_CAUSE_EXC,M_CAUSE_EXC) + +/* Exception Code */ +#define K_CAUSE_EXC_INT 0 /* External interrupt */ +#define K_CAUSE_EXC_MOD 1 /* TLB modification */ +#define K_CAUSE_EXC_TLBL 2 /* TLB miss (Load or Ifetch) */ +#define K_CAUSE_EXC_TLBS 3 /* TLB miss (Save) */ +#define K_CAUSE_EXC_ADEL 4 /* Address error (Load or Ifetch) */ +#define K_CAUSE_EXC_ADES 5 /* Address error (Save) */ +#define K_CAUSE_EXC_IBE 6 /* Bus error (Ifetch) */ +#define K_CAUSE_EXC_DBE 7 /* Bus error (data load or store) */ +#define K_CAUSE_EXC_SYS 8 /* System call */ +#define K_CAUSE_EXC_BP 9 /* Break point */ +#define K_CAUSE_EXC_RI 10 /* Reserved instruction */ +#define K_CAUSE_EXC_CPU 11 /* Coprocessor unusable */ +#define K_CAUSE_EXC_OVF 12 /* Arithmetic overflow */ +#define K_CAUSE_EXC_TRAP 13 /* Trap exception */ +#define K_CAUSE_EXC_VCEI 14 /* Virtual Coherency Exception (I) */ +#define K_CAUSE_EXC_FPE 15 /* Floating Point Exception */ +#define K_CAUSE_EXC_CP2 16 /* Cp2 Exception */ +#define K_CAUSE_EXC_WATCH 23 /* Watchpoint exception */ +#define K_CAUSE_EXC_VCED 31 /* Virtual Coherency Exception (D) */ + +#define K_NTLBENTRIES 64 + +#define HI_HALF(x) ((x) >> 16) +#define LO_HALF(x) ((x) & 0xffff) + +/* FPU stuff */ + +#if defined(__ASSEMBLER__) +#define C1_CSR $31 +#define C1_FRID $0 +#else +#define C1_CSR 31 +#define C1_FRID 0 +#endif + +#define S_FCSR_CAUSE 12 +#define M_FCSR_CAUSE _MM_MAKEMASK(5,S_FCSR_CAUSE) +#define V_FCSR_CAUSE(x) _MM_MAKEVALUE(x,S_FCSR_CAUSE) +#define G_FCSR_CAUSE(x) _MM_GETVALUE(x,S_FCSR_CAUSE,M_FCSR_CAUSE) + +#define S_FCSR_ENABLES 7 +#define M_FCSR_ENABLES _MM_MAKEMASK(5,S_FCSR_ENABLES) +#define V_FCSR_ENABLES(x) _MM_MAKEVALUE(x,S_FCSR_ENABLES) +#define G_FCSR_ENABLES(x) _MM_GETVALUE(x,S_FCSR_ENABLES,M_FCSR_ENABLES) + +#define S_FCSR_FLAGS 2 +#define M_FCSR_FLAGS _MM_MAKEMASK(5,S_FCSR_FLAGS) +#define V_FCSR_FLAGS(x) _MM_MAKEVALUE(x,S_FCSR_FLAGS) +#define G_FCSR_FLAGS(x) _MM_GETVALUE(x,S_FCSR_FLAGS,M_FCSR_FLAGS) + + +/* + * MIPS64 Config Register (select 0) + */ +#define M_CFG_CFG1 _MM_MAKEMASK1(31) /* config1 select1 is impl */ +#define M_CFG_BE _MM_MAKEMASK1(15) /* big-endian mode */ + +#define S_CFG_AT 13 /* Architecture Type */ +#define M_CFG_AT _MM_MAKEMASK(2,S_CFG_AT) +#define V_CFG_AT(x) _MM_MAKEVALUE(x,S_CFG_AT) +#define G_CFG_AT(x) _MM_GETVALUE(x,S_CFG_AT,M_CFG_AT) +#define K_CFG_AT_MIPS32 0 +#define K_CFG_AT_MIPS64_32 1 +#define K_CFG_AT_MIPS64 2 + +#define S_CFG_AR 10 /* Architecture Revision */ +#define M_CFG_AR _MM_MAKEMASK(3,S_CFG_AR) +#define V_CFG_AR(x) _MM_MAKEVALUE(x,S_CFG_AR) +#define G_CFG_AR(x) _MM_GETVALUE(x,S_CFG_AR,M_CFG_AR) +#define K_CFG_AR_REV1 0 + +#define S_CFG_MMU 7 /* MMU Type */ +#define M_CFG_MMU _MM_MAKEMASK(3,S_CFG_MMU) +#define V_CFG_MMU(x) _MM_MAKEVALUE(x,S_CFG_MMU) +#define G_CFG_MMU(x) _MM_GETVALUE(x,S_CFG_MMU,M_CFG_MMU) +#define K_CFG_MMU_NONE 0 +#define K_CFG_MMU_TLB 1 +#define K_CFG_MMU_BAT 2 +#define K_CFG_MMU_FIXED 3 + +#define S_CFG_K0COH 0 /* K0seg coherency */ +#define M_CFG_K0COH _MM_MAKEMASK(3,S_CFG_K0COH) +#define V_CFG_K0COH(x) _MM_MAKEVALUE(x,S_CFG_K0COH) +#define G_CFG_K0COH(x) _MM_GETVALUE(x,S_CFG_K0COH,M_CFG_K0COH) +#define K_CFG_K0COH_UNCACHED 2 +#define K_CFG_K0COH_CACHEABLE 3 +#define K_CFG_K0COH_COHERENT 5 + +/* + * MIPS64 Config Register (select 1) + */ + +#define M_CFG_CFG2 _MM_MAKEMASK1(31) /* config2 select2 is impl */ + +#define S_CFG_MMUSIZE 25 +#define M_CFG_MMUSIZE _MM_MAKEMASK(6,S_CFG_MMUSIZE) + +#define S_CFG_IS 22 +#define M_CFG_IS _MM_MAKEMASK(3,S_CFG_IS) +#define V_CFG_IS(x) _MM_MAKEVALUE(x,S_CFG_IS) +#define G_CFG_IS(x) _MM_GETVALUE(x,S_CFG_IS,M_CFG_IS) + +#define S_CFG_IL 19 +#define M_CFG_IL _MM_MAKEMASK(S_CFG_IL,3) +#define V_CFG_IL(x) _MM_MAKEVALUE(x,S_CFG_IL) +#define G_CFG_IL(x) _MM_GETVALUE(x,S_CFG_IL,M_CFG_IL) + +#define S_CFG_IA 16 +#define M_CFG_IA _MM_MAKEMASK(3,S_CFG_IA) +#define V_CFG_IA(x) _MM_MAKEVALUE(x,S_CFG_IA) +#define G_CFG_IA(x) _MM_GETVALUE(x,S_CFG_IA,M_CFG_IA) + +#define S_CFG_DS 13 +#define M_CFG_DS _MM_MAKEMASK(3,S_CFG_DS) +#define V_CFG_DS(x) _MM_MAKEVALUE(x,S_CFG_DS) +#define G_CFG_DS(x) _MM_GETVALUE(x,S_CFG_DS,M_CFG_DS) + +#define S_CFG_DL 10 +#define M_CFG_DL _MM_MAKEMASK(3,S_CFG_DL) +#define V_CFG_DL(x) _MM_MAKEVALUE(x,S_CFG_DL) +#define G_CFG_DL(x) _MM_GETVALUE(x,S_CFG_DL,M_CFG_DL) + +#define S_CFG_DA 7 +#define M_CFG_DA _MM_MAKEMASK(3,S_CFG_DA) +#define V_CFG_DA(x) _MM_MAKEVALUE(x,S_CFG_DA) +#define G_CFG_DA(x) _MM_GETVALUE(x,S_CFG_DA,M_CFG_DA) + +#define M_CFG_PC _MM_MAKEMASK1(4) /* perf ctrs present */ +#define M_CFG_WR _MM_MAKEMASK1(3) /* watch regs present */ +#define M_CFG_CA _MM_MAKEMASK1(2) /* MIPS16 present */ +#define M_CFG_EP _MM_MAKEMASK1(1) /* EJTAG present */ +#define M_CFG_FP _MM_MAKEMASK1(0) /* FPU present */ + + + +/* + * Primary Cache TagLo + */ + +#define S_TAGLO_PTAG 8 +#define M_TAGLO_PTAG _MM_MAKEMASK(56,S_TAGLO_PTAG) + +#define S_TAGLO_PSTATE 6 +#define M_TAGLO_PSTATE _MM_MAKEMASK(2,S_TAGLO_PSTATE) +#define V_TAGLO_PSTATE(x) _MM_MAKEVALUE(x,S_TAGLO_PSTATE) +#define G_TAGLO_PSTATE(x) _MM_GETVALUE(x,S_TAGLO_PSTATE,M_TAGLO_PSTATE) +#define K_TAGLO_PSTATE_INVAL 0 +#define K_TAGLO_PSTATE_SHARED 1 +#define K_TAGLO_PSTATE_CLEAN_EXCL 2 +#define K_TAGLO_PSTATE_DIRTY_EXCL 3 + +#define M_TAGLO_LOCK _MM_MAKEMASK1(5) +#define M_TAGLO_PARITY _MM_MAKEMASK1(0) + + +/* + * CP0 CacheErr register + */ +#define M_CERR_DATA _MM_MAKEMASK1(31) /* err in D space */ +#define M_CERR_SCACHE _MM_MAKEMASK1(30) /* err in l2, not l1 */ +#define M_CERR_DERR _MM_MAKEMASK1(29) /* data error */ +#define M_CERR_TERR _MM_MAKEMASK1(28) /* tag error */ +#define M_CERR_EXTRQ _MM_MAKEMASK1(27) /* external req caused err */ +#define M_CERR_BPAR _MM_MAKEMASK1(26) /* bus parity err */ +#define M_CERR_ADATA _MM_MAKEMASK1(25) /* additional data */ +#define M_CERR_IDX _MM_MAKEMASK(22,0) + + + +/* + * Primary Cache operations + */ +#define Index_Invalidate_I 0x0 /* 0 0 */ +#define Index_Writeback_Inv_D 0x1 /* 0 1 */ +#define Index_Invalidate_SI 0x2 /* 0 2 */ +#define Index_Writeback_Inv_SD 0x3 /* 0 3 */ +#define Index_Load_Tag_I 0x4 /* 1 0 */ +#define Index_Load_Tag_D 0x5 /* 1 1 */ +#define Index_Load_Tag_SI 0x6 /* 1 2 */ +#define Index_Load_Tag_SD 0x7 /* 1 3 */ +#define Index_Store_Tag_I 0x8 /* 2 0 */ +#define Index_Store_Tag_D 0x9 /* 2 1 */ +#define Index_Store_Tag_SI 0xA /* 2 2 */ +#define Index_Store_Tag_SD 0xB /* 2 3 */ +#define Create_Dirty_Exc_D 0xD /* 3 1 */ +#define Create_Dirty_Exc_SD 0xF /* 3 3 */ +#define Hit_Invalidate_I 0x10 /* 4 0 */ +#define Hit_Invalidate_D 0x11 /* 4 1 */ +#define Hit_Invalidate_SI 0x12 /* 4 2 */ +#define Hit_Invalidate_SD 0x13 /* 4 3 */ +#define Fill_I 0x14 /* 5 0 */ +#define Hit_Writeback_Inv_D 0x15 /* 5 1 */ +#define Hit_Writeback_Inv_SD 0x17 /* 5 3 */ +#define Hit_Writeback_I 0x18 /* 6 0 */ +#define Hit_Writeback_D 0x19 /* 6 1 */ +#define Hit_Writeback_SD 0x1B /* 6 3 */ +#define Hit_Set_Virtual_SI 0x1E /* 7 2 */ +#define Hit_Set_Virtual_SD 0x1F /* 7 3 */ + +/* Watchpoint Register */ +#define M_WATCH_PA 0xfffffff8 +#define M_WATCH_R 0x00000002 +#define M_WATCH_W 0x00000001 + + +/* TLB entries */ +#define M_TLBHI_ASID _MM_MAKEMASK(0,8) +#define M_TLBHI_VPN2 _MM_MAKEMASK(27,13) + +#define M_TLBLO_G _MM_MAKEMASK1(0) +#define M_TLBLO_V _MM_MAKEMASK1(1) +#define M_TLBLO_D _MM_MAKEMASK1(2) + +#define S_TLBLO_CALG 3 +#define M_TLBLO_CALG _MM_MAKEMASK(3,S_TLBLO_CALG) +#define V_TLBLO_CALG(x) _MM_MAKEVALUE(x,S_TLBLO_CALG) +#define G_TLBLO_CALG(x) _MM_GETVALUE(x,S_TLBLO_CALG,M_TLBLO_CALG) + +#define K_CALG_COH_EXCL1_NOL2 0 +#define K_CALG_COH_SHRL1_NOL2 1 +#define K_CALG_UNCACHED 2 +#define K_CALG_NONCOHERENT 3 +#define K_CALG_COH_EXCL 4 +#define K_CALG_COH_SHAREABLE 5 +#define K_CALG_NOTUSED 6 +#define K_CALG_UNCACHED_ACCEL 7 + +#define S_TLBLO_PFNMASK 6 +#define M_TLBLO_PFNMASK _MM_MAKEMASK(24,S_TLBLO_PFNMASK) +#define V_TLBLO_PFNMASK(x) _MM_MAKEVALUE(x,S_TLBLO_PFNMASK) +#define G_TLBLO_PFNMASK(x) _MM_GETVALUE(x,S_TLBLO_PFNMASK,M_TLBLO_PFNMASK) + + + +#endif /* _SB_MIPS_H */ + + diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/include/sbsdram.h b/cfe/cfe/arch/mips/cpu/bcmcore/include/sbsdram.h new file mode 100644 index 0000000..80e93e3 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/include/sbsdram.h @@ -0,0 +1,92 @@ +/* + Copyright 2001, Broadcom Corporation + All Rights Reserved. + + This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; + the contents of this file may not be disclosed to third parties, copied or + duplicated in any form, in whole or in part, without the prior written + permission of Broadcom Corporation. +*/ +/* + * BCM47XX Sonics SiliconBackplane SDRAM controller core hardware definitions. + * + * $Id: sbsdram.h,v 1.1 2001/10/31 18:49:26 mpl Exp $ + */ + +#ifndef _SBSDRAM_H +#define _SBSDRAM_H + +#ifndef _LANGUAGE_ASSEMBLY + +/* Sonics side: SDRAM core registers */ +typedef volatile struct sbsdramregs { + uint32 initcontrol; /* Generates external SDRAM initialization sequence */ + uint32 config; /* Initializes external SDRAM mode register */ + uint32 refresh; /* Controls external SDRAM refresh rate */ + uint32 pad1; + uint32 pad2; +} sbsdramregs_t; + +#endif + +/* SDRAM initialization control (initcontrol) register bits */ +#define SDRAM_CBR 0x0001 /* Writing 1 generates refresh cycle and toggles bit */ +#define SDRAM_PRE 0x0002 /* Writing 1 generates precharge cycle and toggles bit */ +#define SDRAM_MRS 0x0004 /* Writing 1 generates mode register select cycle and toggles bit */ +#define SDRAM_EN 0x0008 /* When set, enables access to SDRAM */ +#define SDRAM_16Mb 0x0000 /* Use 16 Megabit SDRAM */ +#define SDRAM_64Mb 0x0010 /* Use 64 Megabit SDRAM */ +#define SDRAM_128Mb 0x0020 /* Use 128 Megabit SDRAM */ +#define SDRAM_RSVMb 0x0030 /* Use special SDRAM */ +#define SDRAM_RST 0x0080 /* Writing 1 causes soft reset of controller */ +#define SDRAM_SELFREF 0x0100 /* Writing 1 enables self refresh mode */ +#define SDRAM_PWRDOWN 0x0200 /* Writing 1 causes controller to power down */ +#define SDRAM_32BIT 0x0400 /* When set, indicates 32 bit SDRAM interface */ +#define SDRAM_9BITCOL 0x0800 /* When set, indicates 9 bit column */ + +/* SDRAM configuration (config) register bits */ +#define SDRAM_BURSTFULL 0x0000 /* Use full page bursts */ +#define SDRAM_BURST8 0x0001 /* Use burst of 8 */ +#define SDRAM_BURST4 0x0002 /* Use burst of 4 */ +#define SDRAM_BURST2 0x0003 /* Use burst of 2 */ +#define SDRAM_CAS3 0x0000 /* Use CAS latency of 3 */ +#define SDRAM_CAS2 0x0004 /* Use CAS latency of 2 */ + +/* SDRAM refresh control (refresh) register bits */ +#define SDRAM_REF(p) (((p)&0xff) | SDRAM_REF_EN) /* Refresh period */ +#define SDRAM_REF_EN 0x8000 /* Writing 1 enables periodic refresh */ + +/* SDRAM Core Init values (OCP ID 0x803) */ + +#define SDRAM_CONFIG SDRAM_BURSTFULL +#define SDRAM_REFRESH SDRAM_REF(0x40) + +#if defined(MEM1MX16_KM) +#define SDRAM_INIT 0x009 +#elif defined(MEM1MX16X2_KM) +#define SDRAM_INIT 0x409 +#elif defined(MEM2MX8X2_KM) +#define SDRAM_INIT 0x809 +#elif defined(MEM2MX8X4_KM) +#define SDRAM_INIT 0xc09 +#elif defined(MEM2MX32_KM) +#define SDRAM_INIT 0x439 +#elif defined(MEM4MX16_KM) +#define SDRAM_INIT 0x019 +#elif defined(MEM4MX16X2_KM) +#define SDRAM_INIT 0x419 +#elif defined(MEM8MX8X2_KM) +#define SDRAM_INIT 0x819 +#elif defined(MEM8MX8X4_KM) +#define SDRAM_INIT 0xc19 +#elif defined(MEM8MX16_KM) +#define SDRAM_INIT 0x829 +#elif defined(MEM8MX16X2_KM) +#define SDRAM_INIT 0xc29 +#elif defined(MEM4MX32_KM) +#define SDRAM_INIT 0x429 +#else /* DEFAULT MEM */ +#define SDRAM_INIT 0x419 +#endif + +#endif /* _SBSDRAM_H */ diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/src/Makefile b/cfe/cfe/arch/mips/cpu/bcmcore/src/Makefile new file mode 100755 index 0000000..76662a0 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/src/Makefile @@ -0,0 +1,8 @@ + +ALLOBJS += bcmcore_cpuinit.o bcmcore_l1cache.o +ifeq ($(strip ${CFG_RAMAPP}),1) +ALLOBJS += bcmcore_arena.o +endif +CFLAGS += -mips32 -D_MIPSREGS32_ -mno-abicalls -fPIC +# CFLAGS += -mips2 -D_MIPSREGS32_ + diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_arena.c b/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_arena.c new file mode 100755 index 0000000..b368158 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_arena.c @@ -0,0 +1,170 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Physical Memory (arena) manager File: bcmcore_arena.c + * + * This module describes the physical memory available to the + * firmware. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "sbmips.h" + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_arena.h" + +#include "cfe_error.h" + +#include "cfe.h" +#include "cfe_mem.h" + +#include "initdata.h" + +#define _NOPROTOS_ +#include "cfe_boot.h" +#undef _NOPROTOS_ + + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define ARENA_RANGE(bottom,top,type) arena_markrange(&cfe_arena,(uint64_t)(bottom), \ + (uint64_t)(top)-(uint64_t)bottom+1,(type),NULL) + +#define MEG (1024*1024) +#define KB 1024 +#define PAGESIZE 4096 +#define CFE_BOOTAREA_SIZE (256*KB) +#define CFE_BOOTAREA_ADDR 0x20000000 + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +extern arena_t cfe_arena; + +unsigned int mem_bootarea_start; +unsigned int mem_bootarea_size; + +void bcmcore_arena_init(void); +void bcmcore_pagetable_init(uint64_t *ptaddr,unsigned int physaddr); + + +/* ********************************************************************* + * bcmcore_arena_init() + * + * Create the initial map of physical memory + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void bcmcore_arena_init(void) +{ + int64_t memleft; + +#if 1 /* defined(CONFIG_MIPS_BRCM) */ + arena_init(&cfe_arena,0x0,0x0); /* 2^32 physical bytes */ +#else + arena_init(&cfe_arena,0x0,0x100000000); /* 2^32 physical bytes */ +#endif + + /* + * Mark the ranges from the SB1250's memory map + */ + + ARENA_RANGE(0x0000000000,0x000FFFFFFF,MEMTYPE_DRAM_NOTINSTALLED); + + /* + * Now, fix up the map with what is known about *this* system. + * + * Do each 256MB chunk. + */ + + memleft = ((int64_t) mem_totalsize) << 20; + + arena_markrange(&cfe_arena,0x00000000,memleft,MEMTYPE_DRAM_AVAILABLE,NULL); + + /* + * Do the boot ROM + */ + + arena_markrange(&cfe_arena,0x1FC00000,2*1024*1024,MEMTYPE_BOOTROM,NULL); + +} + + +/* ********************************************************************* + * BCMCORE_PAGETABLE_INIT(ptaddr,physaddr) + * + * This routine constructs the page table. 256KB is mapped + * starting at physical address 'physaddr' - the resulting + * table entries are placed at 'ptaddr' + * + * Input parameters: + * ptaddr - base of page table + * physaddr - starting physical addr of area to map + * + * Return value: + * nothing + ********************************************************************* */ + +void bcmcore_pagetable_init(uint64_t *ptaddr,unsigned int physaddr) +{ + int idx; + + for (idx = 0; idx < (CFE_BOOTAREA_SIZE/PAGESIZE); idx++) { + ptaddr[idx] = (physaddr >> 6) | + V_TLBLO_CALG(K_CALG_NONCOHERENT) | + M_TLBLO_V | + M_TLBLO_D; + physaddr += PAGESIZE; + } + +} + diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_cpuinit.S b/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_cpuinit.S new file mode 100755 index 0000000..7c04b51 --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_cpuinit.S @@ -0,0 +1,490 @@ +/* ********************************************************************* + * SB1250 Board Support Package + * + * CPU initialization File: bcmcore_cpuinit.S + * + * This module contains code to initialize the CPU cores. + * + * Note: all the routines in this module rely on registers only, + * since DRAM may not be active yet. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * XX Copyright 2000,2001 + * Broadcom Corporation. All rights reserved. + * + * BROADCOM PROPRIETARY AND CONFIDENTIAL + * + * This software is furnished under license and may be used and + * copied only in accordance with the license. + ********************************************************************* */ + +#include "sbmips.h" +#include "exception.h" +#include "bsp_config.h" +#include "mipsmacros.h" +#include "cpu_config.h" /* for ERET and HAZARD */ + + + .text + + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define LINESIZE 16 + +#define CACHEOP(cachename,op) ((cachename) | ((op) << 2)) + +#define CACHE_OP_IDXINVAL 0 +#define CACHE_OP_IDXLOADTAG 1 +#define CACHE_OP_IDXSTORETAG 2 +#define CACHE_OP_IMPLRSVD 3 +#define CACHE_OP_HITINVAL 4 +#define CACHE_OP_FILL 5 +#define CACHE_OP_HITWRITEBACK_INVAL 5 +#define CACHE_OP_HITWRITEBACK 6 +#define CACHE_OP_FETCHLOCK 7 + +#define L2C 3 +#define L1C_I 0 +#define L1C_D 1 + + +/* + * Duplicates from cfe_iocb.h -- warning! + */ + +#define CFE_CACHE_FLUSH_D 1 +#define CFE_CACHE_INVAL_I 2 +#define CFE_CACHE_INVAL_D 4 +#define CFE_CACHE_INVAL_L2 8 +#define CFE_CACHE_FLUSH_L2 16 +#define CFE_CACHE_INVAL_RANGE 32 +#define CFE_CACHE_FLUSH_RANGE 64 + +#define BCMCORE_NTLBENTRIES 32 + + + +#define SENDCHAR(c) \ + li t0,0xBF800000 ; \ + li t1,c ; \ + sb t1,0(t0) + + +#define R_CPU_CP0INIT _TBLIDX(0) +#define R_CPU_L1CINIT _TBLIDX(1) +#define R_CPU_SETLEDS _TBLIDX(2) +#define R_CPU_L1CFLASHD _TBLIDX(3) +#define R_CPU_L1CINVALI _TBLIDX(4) + +#define SETLEDS1(a,b,c,d) \ + li a0,(((a)<<24)|((b)<<16)|((c)<<8)|(d)) ; \ + CALLINIT_KSEG1(cpuinit_table,R_CPU_SETLEDS) +#define SETLEDS(a,b,c,d) \ + li a0,(((a)<<24)|((b)<<16)|((c)<<8)|(d)) ; \ + CALLINIT_KSEG0(cpuinit_table,R_CPU_SETLEDS) + +cpuinit_table: + _LONG_ bcmcore_cp0_init # [ 0 ] R_CPU_CP0INIT + _LONG_ bcmcore_l1cache_init # [ 1 ] R_CPU_L1CINIT + _LONG_ board_setleds # [ 2 ] R_CPU_SETLEDS + _LONG_ bcmcore_l1cache_flush_d # [ 3 ] R_CPU_L1CFLASHD + _LONG_ bcmcore_l1cache_inval_i # [ 4 ] R_CPU_L1CINVALI + + +/* ********************************************************************* + * BCMCORE_CP0_INIT() + * + * Initialize an BCMCORE CPU's CP0 registers + * + * Input parameters: + * nothing + * + * Return value: + * nothing + * + * Registers used: + * all + ********************************************************************* */ + + +LEAF(bcmcore_cp0_init) + + .set noreorder + + mtc0 zero,C0_WATCHLO # Watch registers. + mtc0 zero,C0_WATCHHI + mtc0 zero,C0_CAUSE # must clear before writing SR + + mfc0 v0,C0_SR # Get status register + and v0,M_SR_SR # preserve soft reset +#ifdef DEBUG_ENV_ICE + and v0,~M_SR_BEV +#else + or v0,M_SR_BEV # exceptions to boot vector +#endif + mtc0 v0,C0_SR # set up the status register + + + mfc0 v0,C0_CONFIG # get current CONFIG register + srl v0,v0,3 # strip out K0 bits + sll v0,v0,3 # k0 bits now zero + or v0,v0,K_CFG_K0COH_CACHEABLE # K0 is cacheable. + mtc0 v0,C0_CONFIG + nop + + mtc0 zero,C0_WATCHLO # Watch registers. + mtc0 zero,C0_WATCHHI + + mtc0 zero,C0_TLBHI # TLB entry (high half) + nop + + + # + # This is probably not the right init value for C0_COMPARE, + # but it seems to be necessary for the sim model right now. + # + + li v0,-1 + mtc0 v0,C0_COMPARE + nop + + # + # Initialize all the TLB entries to some invalid value + # + + mtc0 zero,C0_TLBLO0 /* tlblo0 = invalid */ + nop + mtc0 zero,C0_TLBLO1 /* tlblo1 = invalid */ + nop + mtc0 zero,C0_PGMASK /* 4K pages */ + nop + + li t0,K1BASE /* tlbhi = impossible vpn */ + li t1,(BCMCORE_NTLBENTRIES-1) /* index */ + + + nop +1: mtc0 t0,C0_TLBHI + nop + mtc0 t1,C0_INX + nop + addu t0,0x2000 /* inc vpn */ + tlbwi + bnez t1,1b + subu t1,1 # BDSLOT + .set reorder + + +/* + * XXX What other CP0 initialization do I need? + */ + + jr ra + + +END(bcmcore_cp0_init) + + +/* ********************************************************************* + * BCMCORE_CPUINIT + * + * Do initialization of the Broadcom core + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + + +LEAF(bcmcore_cpuinit) + + move fp,ra + + SETLEDS1('C','P','U','I') + CALLINIT_KSEG1(cpuinit_table,R_CPU_CP0INIT) + + SETLEDS1('L','1','C','I') + CALLINIT_KSEG1(cpuinit_table,R_CPU_L1CINIT) + + move ra,fp + j ra + +END(bcmcore_cpuinit) + + +/* ********************************************************************* + * BCMCORE_KSEG0_SWITCH + * + * Return to the address of the routine that called us, except + * in K0seg instead of K1seg + * + * Input parameters: + * nothing - ra is return address + * + * Return value: + * ra = same return address in K0 + ********************************************************************* */ + +LEAF(bcmcore_kseg0_switch) + + and ra,(K0SIZE-1) + or ra,K0BASE + jr ra + +END(bcmcore_kseg0_switch) + +/* ********************************************************************* + * BCMCORE_NULL + * + * Dummy handler for routines we don't need to implement, like + * the multiprocessor stuff + * + * Input parameters: + * nothing + * + * Return value: + * nothing + * + * Registers used: + * none + ********************************************************************* */ + +LEAF(bcmcore_null) + + j ra + +END(bcmcore_null) + + +/* ********************************************************************* + * BCMCORE_CPURESTART + * + * This routine is called when someone soft-exits to CFE. We + * reinitialize any CP0 stuff here. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(bcmcore_cpurestart) + + j ra + +END(bcmcore_cpurestart) + + +/* ********************************************************************* + * BCMCORE_CACHEOPS + * + * Perform various cache operations on a BCM Core + * + * Input parameters: + * a0 - flag bits (CFE_CACHE_xxx) + * + * Return value: + * nothing + * + * Registers used: + * t0,t1,t2,t3,v1,s0 + ********************************************************************* */ + +LEAF(bcmcore_cacheops) + + move s0,ra + + move v1,a0 + + /* + * With no flags, we flush L1D and invalid L1I + */ + + bne v1,zero,1f + li v1,CFE_CACHE_FLUSH_D | CFE_CACHE_INVAL_I +1: + + /* + * Flush the D-Cache, since the program we loaded is "data". + */ + + and a0,v1,CFE_CACHE_FLUSH_D + beq a0,zero,1f + CALLINIT_KSEG1(cpuinit_table,R_CPU_L1CFLASHD) +1: + + /* + * Invalidate the I-Cache, so that addresses in the program + * region will miss and need to be filled from the data we + * just flushed above. + */ + + and a0,v1,CFE_CACHE_INVAL_I + beq a0,zero,1f + CALLINIT_KSEG1(cpuinit_table,R_CPU_L1CINVALI) +1: + + + .set push + .set mips32 + + /* + * Invalidate cache range + */ + + and a0,v1,CFE_CACHE_INVAL_RANGE + beq a0,zero,2f + + move t0,a1 +1: cache CACHEOP(L1C_D,CACHE_OP_HITINVAL),0(t0) + add t0,LINESIZE + blt t0,a2,1b + + /* + * Flush cache range + */ + + +2: + and a0,v1,CFE_CACHE_FLUSH_RANGE + beq a0,zero,2f + + move t0,a1 +1: cache CACHEOP(L1C_D,CACHE_OP_HITWRITEBACK_INVAL),0(t0) + add t0,LINESIZE + blt t0,a2,1b + +2: + + .set pop + + + move ra,s0 + j ra + +END(bcmcore_cacheops) + + + +/* ********************************************************************* + * BCMCORE_TLBHANDLER + * + * This is the TLB exception handler for the bcmcore + * + * Note: only K0 and K1 are available to us at this time. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + + +LEAF(bcmcore_tlbhandler) + .set noreorder + .set noat + +/* + * XXX XXX XXX XXX XXX + * + * This won't work as-is on the BCMCORE. The CONTEXT register is not + * wide enough! In fact, it's broken on all pre-mips4 CPUs. + * + * XXX XXX XXX XXX XXX + */ + +/* + * This requires a bit of explanation: We only support 256KB + * of mapped space for the boot program. This space will be + * mapped from 0x2000_0000 to 0x2004_0000 to some physical + * memory allocated by the firmware. This is 64 pages + * of 4KB each. + * + * We know our BadVPN2 will be in the range + * 0x100000 to 0x1001F0, since the memory is mapped from + * 0x2000_0000 to 0x2004_0000. BadVPN2 plus the four bits + * of zeroes at the end are bits 31..9 + * + * We also want to place the PTEbase on something other than + * a 16MB boundary. Each entry is 16 bytes, and there + * are 64 entries, so we need only 10 bits to address + * the entire table (it can therefore be aligned on a + * 1KB boundary). + * + * To make this work, we'll shift PTEbase to the right, leaving + * the bottom ten bits for the page number, as: + * + * Bits 31..10: PTEbase + * Bits 9..4: BadVPN + * Bits 3..0: 16 bytes for table entry + * + * Therefore: + * PTEbase gets shifted right 13 bits. + * BadVPN gets masked at 6 bits (mask is 0x3F0) + * The bottom 4 bits are zero. + * + * To range check the address, we can shift the Bad VPN + * right by 9 bits, and check for values of 0x1000 and + * 0x1001. + */ + + + /* + * This part range checks the VPN2 field in the + * context register. We only handle + * VPN2s in the range 0x100000 to 0x1001F0 + */ + mfc0 k0,C0_TLBHI + + mfc0 k0,C0_CTEXT # Get context + sra k0,8 # keep hi part + and k0,0x1FFF # of VPN2 + li k1,0x1000 # 0x1000 is ok + beq k0,k1,1f # + nop # BDSLOT + li k1,0x1001 # 0x1001 is ok + beq k0,k1,1f # + nop # BDSLOT + + li k0,XTYPE_TLBFILL # all other bits are not + b _exc_entry + nop # BDSLOT + +1: mfc0 k0,C0_CTEXT # Get context + sra k0,13 # Shift PTEbase + li k1,0x3FF # Generate mask to kill + not k1 # BadVPN2 bits + and k0,k1 # keep only PTEBase part. + + mfc0 k1,C0_CTEXT # Get Context + and k1,0x3F0 # Keep only BadVPN2 bits + or k1,k0 # Replace PTEBase + + ld k0,0(k1) # Load entrylo0 + ld k1,8(k1) # Load entrylo1 + mtc0 k0,C0_TLBLO0 # and write to CP0 + mtc0 k1,C0_TLBLO1 + tlbwr # put it in the TLB + ERET + nop + + .set reorder + .set at + +END(bcmcore_tlbhandler) + + +/* ********************************************************************* + * End + ********************************************************************* */ + diff --git a/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_l1cache.S b/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_l1cache.S new file mode 100755 index 0000000..fa39bfd --- /dev/null +++ b/cfe/cfe/arch/mips/cpu/bcmcore/src/bcmcore_l1cache.S @@ -0,0 +1,219 @@ +/* ********************************************************************* + * SB1250 Board Support Package + * + * L1C initialization File: bcmcore_l1cache.S + * + * This module contains code to initialize the CPU's caches + * + * Note: all the routines in this module rely on registers only, + * since DRAM may not be active yet. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * XX Copyright 2000,2001 + * Broadcom Corporation. All rights reserved. + * + * BROADCOM PROPRIETARY AND CONFIDENTIAL + * + * This software is furnished under license and may be used and + * copied only in accordance with the license. + ********************************************************************* */ + +#include "sbmips.h" +#include "bsp_config.h" + + .text + + .set push + .set mips32 + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define CP0_CFG_ISMSK (0x7 << 22) +#define CP0_CFG_ISSHF 22 +#define CP0_CFG_ILMSK (0x7 << 19) +#define CP0_CFG_ILSHF 19 +#define CP0_CFG_IAMSK (0x7 << 16) +#define CP0_CFG_IASHF 16 +#define CP0_CFG_DSMSK (0x7 << 13) +#define CP0_CFG_DSSHF 13 +#define CP0_CFG_DLMSK (0x7 << 10) +#define CP0_CFG_DLSHF 10 +#define CP0_CFG_DAMSK (0x7 << 7) +#define CP0_CFG_DASHF 7 + +#define cacheop(kva, size, linesize, op) \ + .set noreorder; \ + addu t1, kva, size; \ + subu t2, linesize, 1; \ + not t2; \ + and t0, kva, t2; \ + addu t1, -1; \ + and t1, t2; \ +10: cache op, 0(t0); \ + bne t0, t1, 10b; \ + addu t0, linesize; \ +11: \ + .set reorder + +#define size_icache(size, linesize) \ + mfc0 t7, C0_CONFIG, 1; \ + and t0, t7, CP0_CFG_ILMSK; \ + srl t0, t0, CP0_CFG_ILSHF; \ + move linesize, zero; \ + beq t0, zero,1f; \ + add t0, 1; \ + li linesize, 1; \ + sll linesize, t0; \ +1: and t0, t7, CP0_CFG_ISMSK; \ + srl t0, t0, CP0_CFG_ISSHF; \ + li size, 64; \ + sll size, t0; \ + and t0, t7, CP0_CFG_IAMSK; \ + srl t0, t0, CP0_CFG_IASHF; \ + add t0, 1; \ + mult size, t0; \ + mflo size; \ + mult size, linesize; \ + mflo size + +#define size_dcache(size, linesize) \ + mfc0 t7, C0_CONFIG, 1; \ + and t0, t7, CP0_CFG_DLMSK; \ + srl t0, t0, CP0_CFG_DLSHF; \ + move linesize, zero; \ + beq t0, zero,1f; \ + add t0, 1; \ + li linesize, 1; \ + sll linesize, t0; \ +1: and t0, t7, CP0_CFG_DSMSK; \ + srl t0, t0, CP0_CFG_DSSHF; \ + li size, 64; \ + sll size, t0; \ + and t0, t7, CP0_CFG_DAMSK; \ + srl t0, t0, CP0_CFG_DASHF; \ + add t0, 1; \ + mult size, t0; \ + mflo size; \ + mult size, linesize; \ + mflo size + + +/* ********************************************************************* + * BCMCORE_L1CACHE_INIT() + * + * Initialize the L1 Cache + * + * Input parameters: + * nothing + * + * Return value: + * nothing + * + * Registers used: + * t0,t1,t2 + ********************************************************************* */ + +LEAF(bcmcore_l1cache_init) + + mtc0 zero, C0_TAGLO # Initialize TAGLO register + mtc0 zero, C0_TAGLO,1 # Initialize DataLo register + + li a0, K0BASE # Initialise primary instruction cache. + size_icache(a1, a2) + cacheop(a0, a1, a2, Index_Store_Tag_I) + + li a0, K0BASE # Initialise primary data cache. + size_dcache(a1, a2) + cacheop(a0, a1, a2, Index_Store_Tag_D) + + jr ra + +END(bcmcore_l1cache_init) + +/* ********************************************************************* + * BCMCORE_L1CACHE_INVAL_I() + * + * Invalidate the entire ICache + * + * Input parameters: + * nothing + * + * Return value: + * nothing + * + * Registers used: + * t0,t1,t2 + ********************************************************************* */ +LEAF(bcmcore_l1cache_inval_i) + + li a0, K0BASE + size_icache(a1, a2) + cacheop(a0, a1, a2, Index_Invalidate_I) + + j ra + +END(bcmcore_l1cache_inval_i) + +/* ********************************************************************* + * BCMCORE_L1CACHE_FLUSH_D() + * + * Flush the entire DCache + * + * Input parameters: + * nothing + * + * Return value: + * nothing + * + * Registers used: + * t0,t1,t2 + ********************************************************************* */ +LEAF(bcmcore_l1cache_flush_d) + + li a0, K0BASE + size_dcache(a1, a2) + +# before flushing cache clear tags pointing to flash memory to avoid writes into flash + addu t1, a0, a1 + subu t2, a2, 1 + not t2 + and t0, a0, t2 + addu t1, -1 + and t1, t2 +1: + cache Index_Load_Tag_D, 0(t0) + nop + nop + nop + nop + nop + nop + mfc0 t2, C0_TAGLO # Read TAGLO register + and t2, 0x1f000000 # check address + li t3, 0x1f000000 + bne t2, t3, 2f + mtc0 zero, C0_TAGLO + cache Index_Store_Tag_D, 0(t0) # Reset tag for flash memory locations +2: + .set noreorder; + bne t0, t1, 1b + addu t0, a2 + .set reorder + + cacheop(a0, a1, a2, Index_Writeback_Inv_D) + + j ra + +END(bcmcore_l1cache_flush_d) + + .set pop + +/* ********************************************************************* + * End + ********************************************************************* */ + diff --git a/cfe/cfe/dev/SIBYTE_PRIVATE_FILES b/cfe/cfe/dev/SIBYTE_PRIVATE_FILES new file mode 100644 index 0000000..eae0411 --- /dev/null +++ b/cfe/cfe/dev/SIBYTE_PRIVATE_FILES @@ -0,0 +1,6 @@ +dev_ptflash.c +bcm5700.h +dev_bcm5700.c +bcm5821.h +dev_bcm5821.c + diff --git a/cfe/cfe/dev/bcm5700.h b/cfe/cfe/dev/bcm5700.h new file mode 100644 index 0000000..76aa3ea --- /dev/null +++ b/cfe/cfe/dev/bcm5700.h @@ -0,0 +1,1007 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * BCM5700 (10/100/1K EthernetMAC) registers File: bcm5700.c + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _BCM5700_H_ +#define _BCM5700_H_ + +/* + * Register and bit definitions for the Broadcom BCM570X family (aka + * Tigon3) of Integrated MACs. + * + * References: + * + * Host Programmer Interface Specification for the BCM570X Family + * of Highly-Integrated Media Access Controllers, 570X-PG106-R. + * Broadcom Corp., 16215 Alton Parkway, Irvine CA, 09/27/02 + * + * Simplified Programmer Interface Specification for the BCM570X Family + * of Highly Integrated Media Access Controllers, 570X-PG202-R. + * Broadcom Corp., 16215 Alton Parkway, Irvine CA, 10/14/02 + */ + +#define K_PCI_VENDOR_BROADCOM 0x14e4 +#define K_PCI_ID_BCM5700 0x1644 +#define K_PCI_ID_BCM5701 0x1645 +#define K_PCI_ID_BCM5702 0x16A6 +#define K_PCI_ID_BCM5703 0x16A7 +#define K_PCI_ID_BCM5704C 0x1648 +#define K_PCI_ID_BCM5704S 0x16A8 +#define K_PCI_ID_BCM5705 0x1653 + +#define _DD_MAKEMASK1(n) (1 << (n)) +#define _DD_MAKEMASK(v,n) ((((1)<<(v))-1) << (n)) +#define _DD_MAKEVALUE(v,n) ((v) << (n)) +#define _DD_GETVALUE(v,n,m) (((v) & (m)) >> (n)) + + +/* Registers 0x0000 - 0x00FF are PCI Configuration registers (shadow) */ + +#define PCI_PCIX_CMD_REG 0x40 +#define PCI_PCIX_STAT_REG 0x44 + +#define PCI_PMC_REG 0x48 +#define PCI_PMCSR_REG 0x4C + +#define R_MISC_HOST_CTRL 0x0068 +#define R_DMA_RW_CTRL 0x006C +#define R_PCI_STATE 0x0070 +#define R_PCI_CLK_CTRL 0x0074 +#define R_REG_BASE_ADDR 0x0078 +#define R_MEMWIN_BASE_ADDR 0x007C +#define R_REG_DATA 0x0080 +#define R_MEMWIN_DATA 0x0084 +/* For 5700 and 5701, 0x0088-0x0090 shadow 0x6800-0x6808 */ +#define R_INT_MBOX0 0x0B0 /* 8 bytes, shadows R_INT_MBOX(0) */ + +/* Registers 0x0200 - 0x03FF are High Priority Mailbox registers */ + +#define R_INT_MBOX(n) (0x0200 + 8*(n)) /* 0 <= n < 4 */ +#define R_GEN_MBOX(n) (0x0220 + 8*(n)-8) /* 1 <= n <= 8 */ +#define R_RELOAD_STATS_MBOX 0x0260 +#define R_RCV_BD_STD_PI 0x0268 +#define R_RCV_BD_JUMBO_PI 0x0270 +#define R_RCV_BD_MINI_PI 0x0278 +#define R_RCV_BD_RTN_CI(n) (0x0280 + 8*(n)-8) /* 1 <= n <= 16 */ +#define R_SND_BD_PI(n) (0x0300 + 8*(n)-8) /* 1 <= n <= 16 */ +#define R_SND_BD_NIC_PI(n) (0x0380 + 8*(n)-8) /* 1 <= n <= 16 */ + +/* Registers 0x0400 - 0x0BFF are MAC Control registers */ + +#define R_MAC_MODE 0x0400 +#define R_MAC_STATUS 0x0404 +#define R_MAC_EVENT_ENB 0x0408 +#define R_MAC_LED_CTRL 0x040C + +#define R_MAC_ADDR1_HIGH 0x0410 +#define R_MAC_ADDR1_LOW 0x0414 +#define R_MAC_ADDR2_HIGH 0x0418 +#define R_MAC_ADDR2_LOW 0x041C +#define R_MAC_ADDR3_HIGH 0x0420 +#define R_MAC_ADDR3_LOW 0x0424 +#define R_MAC_ADDR4_HIGH 0x0428 +#define R_MAC_ADDR4_LOW 0x042C + +#define R_WOL_PATTERN_PTR 0x0430 +#define R_WOL_PATTERN_CFG 0x0434 +#define R_TX_BACKOFF 0x0438 +#define R_RX_MTU 0x043C +#define R_PCS_TEST 0x0440 +#define R_TX_AUTONEG 0x0444 +#define R_RX_AUTONEG 0x0448 + +#define R_MI_COMM 0x044C +#define R_MI_STATUS 0x0450 +#define R_MI_MODE 0x0454 + +#define R_AUTOPOLL_STAT 0x0458 +#define R_TX_MODE 0x045C +#define R_TX_STAT 0x0460 +#define R_TX_LENS 0x0464 +#define R_RX_MODE 0x0468 +#define R_RX_STAT 0x046C + +#define R_MAC_HASH(n) (0x0470 + 4*(n)) /* 0 <= n < 4 */ + +#define R_RX_BD_RULES_CTRL(n) (0x0480 + 8*(n)) /* 0 <= n < 16 */ +#define R_RX_BD_RULES_MASK(n) (0x0484 + 8*(n)) + +#define R_RX_RULES_CFG 0x0500 +#define R_RX_FRAMES_LOW 0x0504 +#define R_MAC_HASH_EXT(n) (0x0520 + 4*(n)) /* 0 <= n < 4 */ +#define R_MAC_ADDR_EXT(n) (0x0530 + 8*(n)) /* 0 <= n < 12 */ +#define R_SERDES_CTRL 0x0590 +#define R_SERDES_STAT 0x0594 +#define R_RX_STATS_MEM 0x0800 +#define R_TX_STATS_MEM 0x0880 + + +/* + * Note on Buffer Descriptor (BD) Ring indices: + * Numbering follows Broadcom literature, which uses indices 1-16. + * PI = producer index, CI = consumer index. + */ + +/* Registers 0x0C00 - 0x0FFF are Send Data Initiator Control registers */ + +#define R_SND_DATA_MODE 0x0C00 +#define R_SND_DATA_STAT 0x0C04 +#define R_SND_DATA_STATS_CTRL 0x0C08 +#define R_SND_DATA_STATS_ENB 0x0C0C +#define R_SND_DATA_STATS_INCR 0x0C10 + +#define R_STATS_CTR_SND_COS(n) (0x0C80 + 4*(n)-4) /* 1 <= n <= 16 */ +#define R_STATS_DMA_RDQ_FULL 0x0CC0 +#define R_STATS_DMA_HP_RDQ_FULL 0x0CC4 +#define R_STATS_SDCQ_FULL 0x0CC8 +#define R_STATS_NIC_SET_SND_PI 0x0CCC +#define R_STATS_STAT_UPDATED 0x0CD0 +#define R_STATS_IRQS 0x0CD4 +#define R_STATS_IRQS_AVOIDED 0x0CD8 +#define R_STATS_SND_THRSH_HIT 0x0CDC + +/* Registers 0x1000 - 0x13FF are Send Data Completion Control registers */ + +#define R_SND_DATA_COMP_MODE 0x1000 + +/* Registers 0x1400 - 0x17FF are Send BD Ring Selection Control registers */ + +#define R_SND_BD_SEL_MODE 0x1400 +#define R_SND_BD_SEL_STAT 0x1404 +#define R_SND_BD_DIAG 0x1408 +#define R_SND_BD_SEL_CI(n) (0x1440 + 4*(n)-4) /* 1 <= n <= 16 */ + +/* Registers 0x1800 - 0x1BFF are Send BD Initiator Control registers */ + +#define R_SND_BD_INIT_MODE 0x1800 +#define R_SND_BD_INIT_STAT 0x1804 +#define R_SND_BD_INIT_PI(n) (0x1808 + 4*(n)-4) /* 1 <= n <= 16 */ + +/* Registers 0x1C00 - 0x1FFF are Send BD Completion Control registers */ + +#define R_SND_BD_COMP_MODE 0x1C00 + +/* Registers 0x2000 - 0x23FF are Receive List Placement Control registers */ + +#define R_RCV_LIST_MODE 0x2000 +#define R_RCV_LIST_STAT 0x2004 +#define R_RCV_LIST_LOCK 0x2008 +#define R_RCV_NONEMPTY_BITS 0x200C +#define R_RCV_LIST_CFG 0x2010 +#define R_RCV_LIST_STATS_CTRL 0x2014 +#define R_RCV_LIST_STATS_ENB 0x2018 +#define R_RCV_LIST_STATS_INC 0x201C +#define R_RCV_LIST_HEAD(n) (0x2100 + 16*(n)-16) /* 1 <= n <= 16 */ +#define R_RCV_LIST_TAIL(n) (0x2104 + 16*(n)-16) +#define R_RCV_LIST_CNT(n) (0x2108 + 16*(n)-16) +#define R_STATS_CTR_RCV_COS(n) (0x2200 + 4*(n)-4) /* 1 <= n <= 16 */ +#define R_STATS_FILT_DROP 0x2240 +#define R_STATS_DMA_WRQ_FULL 0x2244 +#define R_STATS_DMA_HP_WRQ_FULL 0x2248 +#define R_STATS_NO_RCV_BDS 0x224C +#define R_STATS_IN_DISCARDS 0x2250 +#define R_STATS_IN_ERRORS 0x2254 +#define R_STATS_RCV_THRSH_HIT 0x2258 + +/* Registers 0x2400 - 0x27FF are Receive Data/BD Initiator Control registers */ + +#define R_RCV_DATA_INIT_MODE 0x2400 +#define R_RCV_DATA_INIT_STAT 0x2404 +#define R_JUMBO_RCV_BD_RCB 0x2440 /* 16 bytes */ +#define R_STD_RCV_BD_RCB 0x2450 /* 16 bytes */ +#define R_MINI_RCV_BD_RCB 0x2460 /* 16 bytes */ +#define R_RCV_BD_INIT_JUMBO_CI 0x2470 +#define R_RCV_BD_INIT_STD_CI 0x2474 +#define R_RCV_BD_INIT_MINI_CI 0x2478 +#define R_RCV_BD_INIT_RTN_PI(n) (0x2480 + 4*(n)-4) /* 1 <= n <= 16 */ +#define R_RCV_BD_INIT_DIAG 0x24C0 + +/* Registers 0x2800 - 0x2BFF are Receive Data Completion Control registers */ + +#define R_RCV_COMP_MODE 0x2800 + +/* Registers 0x2C00 - 0x2FFF are Receive BD Initiator Control registers */ + +#define R_RCV_BD_INIT_MODE 0x2C00 +#define R_RCV_BD_INIT_STAT 0x2C04 +#define R_RCV_BD_INIT_JUMBO_PI 0x2C08 +#define R_RCV_BD_INIT_STD_PI 0x2C0C +#define R_RCV_BD_INIT_MINI_PI 0x2C10 +#define R_MINI_RCV_BD_THRESH 0x2C14 +#define R_STD_RCV_BD_THRESH 0x2C18 +#define R_JUMBO_RCV_BD_THRESH 0x2C1C + +/* Registers 0x3000 - 0x33FF are Receive BD Completion Control registers */ + +#define R_RCV_BD_COMP_MODE 0x3000 +#define R_RCV_BD_COMP_STAT 0x3004 +#define R_NIC_JUMBO_RCV_BD_PI 0x3008 +#define R_NIC_STD_RCV_BD_PI 0x300C +#define R_NIC_MINI_RCV_BD_PI 0x3010 + +/* Registers 0x3400 - 0x37FF are Receive List Selector Control registers */ + +#define R_RCV_LIST_SEL_MODE 0x3400 +#define R_RCV_LIST_SEL_STATUS 0x3404 + +/* Registers 0x3800 - 0x3BFF are Mbuf Cluster Free registers */ + +#define R_MBUF_FREE_MODE 0x3800 +#define R_MBUF_FREE_STATUS 0x3804 + +/* Registers 0x3C00 - 0x3FFF are Host Coalescing Control registers */ + +#define R_HOST_COAL_MODE 0x3C00 +#define R_HOST_COAL_STAT 0x3C04 +#define R_RCV_COAL_TICKS 0x3C08 +#define R_SND_COAL_TICKS 0x3C0C +#define R_RCV_COAL_MAX_CNT 0x3C10 +#define R_SND_COAL_MAX_CNT 0x3C14 +#define R_RCV_COAL_INT_TICKS 0x3C18 +#define R_SND_COAL_INT_TICKS 0x3C1C +#define R_RCV_COAL_INT_CNT 0x3C20 +#define R_SND_COAL_INT_CNT 0x3C24 +#define R_STATS_TICKS 0x3C28 +#define R_STATS_HOST_ADDR 0x3C30 /* 8 bytes */ +#define R_STATUS_HOST_ADDR 0x3C38 /* 8 bytes */ +#define R_STATS_BASE_ADDR 0x3C40 +#define R_STATUS_BASE_ADDR 0x3C44 +#define R_FLOW_ATTN 0x3C48 +#define R_NIC_JUMBO_RCV_BD_CI 0x3C50 +#define R_NIC_STD_RCV_BD_CI 0x3C54 +#define R_NIC_MINI_RCV_BD_CI 0x3C58 +#define R_NIC_RTN_PI(n) (0x3C80 + 4*(n)-4) /* 1 <= n <= 16 */ +#define R_NIC_SND_BD_CD(n) (0x3CC0 + 4*(n)-4) /* 1 <= n <= 16 */ + +/* Registers 0x4000 - 0x43FF are Memory Arbiter registers */ + +#define R_MEM_MODE 0x4000 +#define R_MEM_STATUS 0x4004 +#define R_MEM_TRAP_LOW 0x4008 +#define R_MEM_TRAP_HIGH 0x400C + + +/* Registers 0x4400 - 0x47FF are Buffer Manager Control registers */ + +#define R_BMGR_MODE 0x4400 +#define R_BMGR_STATUS 0x4404 +#define R_BMGR_MBUF_BASE 0x4408 +#define R_BMGR_MBUF_LEN 0x440C +#define R_BMGR_MBUF_DMA_LOW 0x4410 +#define R_BMGR_MBUF_RX_LOW 0x4414 +#define R_BMGR_MBUF_HIGH 0x4418 + +#define R_BMGR_DMA_BASE 0x442C +#define R_BMGR_DMA_LEN 0x4430 +#define R_BMGR_DMA_LOW 0x4434 +#define R_BMGR_DMA_HIGH 0x4438 + +#define R_BMGR_DIAG1 0x444C +#define R_BMGR_DIAG2 0x4450 +#define R_BMGR_DIAG3 0x4454 +#define R_BMGR_RCV_FLOW_THRESH 0x4458 + +/* Registers 0x4800 - 0x4BFF are Read DMA Control registers */ + +#define R_RD_DMA_MODE 0x4800 +#define R_RD_DMA_STAT 0x4804 + +/* Registers 0x4C00 - 0x4FFF are Write DMA Control registers */ + +#define R_WR_DMA_MODE 0x4C00 +#define R_WR_DMA_STAT 0x4C04 + +/* Registers 0x5000 - 0x53FF are RX RISC registers */ + +#define R_RX_RISC_MODE 0x5000 +#define R_RX_RISC_STATE 0x5004 +#define R_RX_RISC_PC 0x501C + +/* Registers 0x5400 - 0x57FF are TX RISC registers */ + +#define R_TX_RISC_MODE 0x5400 +#define R_TX_RISC_STATE 0x5404 +#define R_TX_RISC_PC 0x541C + +/* Registers 0x5800 - 0x5BFF are Low Priority Mailbox registers (8 bytes) */ + +#define R_LP_INT_MBOX(n) (0x5800 + 8*(n)) /* 0 <= n < 4 */ +#define R_LP_GEN_MBOX(n) (0x5820 + 8*(n)-8) /* 1 <= n <= 8 */ +#define R_LP_RELOAD_STATS_MBOX 0x5860 +#define R_LP_RCV_BD_STD_PI 0x5868 +#define R_LP_RCV_BD_JUMBO_PI 0x5870 +#define R_LP_RCV_BD_MINI_PI 0x5878 +#define R_LP_RCV_BD_RTN_CI(n) (0x5880 + 8*(n)-8) /* 1 <= n <= 16 */ +#define R_LP_SND_BD_PI(n) (0x5900 + 8*(n)-8) /* 1 <= n <= 16 */ + +/* Registers 0x5C00 - 0x5C03 are Flow Through Queues */ + +#define R_FTQ_RESET 0x5C00 + +/* Registers 0x6000 - 0x63FF are Message Signaled Interrupt registers */ + +/* Registers 0x6400 - 0x67FF are DMA Completion registers */ + +#define R_DMA_COMP_MODE 0x6400 + +/* Registers 0x6800 - 0x68ff are General Control registers */ + +#define R_MODE_CTRL 0x6800 +#define R_MISC_CFG 0x6804 +#define R_MISC_LOCAL_CTRL 0x6808 +#define R_TIMER 0x680C +#define R_MEM_PWRUP 0x6030 /* 8 bytes */ +#define R_EEPROM_ADDR 0x6838 +#define R_EEPROM_DATA 0x683C +#define R_EEPROM_CTRL 0x6840 +#define R_MDI_CTRL 0x6844 +#define R_EEPROM_DELAY 0x6848 + +/* Registers 0x6C00 - 0x6CFF are ASF Support registers (NYI) */ + +/* Registers 0x7000 - 0x7024 are NVM Interface registers (NYI) */ + + +/* PCI Capability registers (should be moved to PCI headers) */ + +/* PCI-X Capability and Command Register (0x40) */ + +#define PCIX_CMD_DPREC_ENABLE 0x00010000 +#define PCIX_CMD_RLXORDER_ENABLE 0x00020000 +#define PCIX_CMD_RD_CNT_SHIFT 18 +#define PCIX_CMD_RD_CNT_MASK 0x000C0000 +#define PCIX_CMD_MAX_SPLIT_SHIFT 20 +#define PCIX_CMD_MAX_SPLIT_MASK 0x00700000 + +/* PCI-X Status Register (0x44) */ + + +/* Generic bit fields shared by most MODE and STATUS registers */ + +#define M_MODE_RESET _DD_MAKEMASK1(0) +#define M_MODE_ENABLE _DD_MAKEMASK1(1) +#define M_MODE_ATTNENABLE _DD_MAKEMASK1(2) + +#define M_STAT_ERROR _DD_MAKEMASK1(1) + +/* Generic bit fields shared by STATS_CTRL registers */ + +#define M_STATS_ENABLE _DD_MAKEMASK1(0) +#define M_STATS_FASTUPDATE _DD_MAKEMASK1(1) +#define M_STATS_CLEAR _DD_MAKEMASK1(2) +#define M_STATS_FLUSH _DD_MAKEMASK1(3) +#define M_STATS_ZERO _DD_MAKEMASK1(4) + +/* Private PCI Configuration registers (p 335) */ + +/* MHC: Miscellaneous Host Control Register (0x68) */ + +#define M_MHC_CLEARINTA _DD_MAKEMASK1(0) +#define M_MHC_MASKPCIINT _DD_MAKEMASK1(1) +#define M_MHC_ENBYTESWAP _DD_MAKEMASK1(2) +#define M_MHC_ENWORDSWAP _DD_MAKEMASK1(3) +#define M_MHC_ENPCISTATERW _DD_MAKEMASK1(4) +#define M_MHC_ENCLKCTRLRW _DD_MAKEMASK1(5) +#define M_MHC_ENREGWORDSWAP _DD_MAKEMASK1(6) +#define M_MHC_ENINDIRECT _DD_MAKEMASK1(7) +#define S_MHC_ASICREV 16 +#define M_MHC_ASICREV _DD_MAKEMASK(16,S_MHC_ASICREV) +#define G_MHC_ASICREV(x) _DD_GETVALUE(x,S_MHC_ASICREV,M_MHC_ASICREV) + +/* DMAC: DMA Read/Write Control Register (0x6c) */ + +#define S_DMAC_MINDMA 0 +#define M_DMAC_MINDMA _DD_MAKEMASK(8,S_DMAC_MINDMA) +#define V_DMAC_MINDMA(x) _DD_MAKEVALUE(x,S_DMAC_MINDMA) +#define G_DMAC_MINDMA(x) _DD_GETVALUE(x,S_DMAC_MINDMA,M_DMAC_MINDMA) + +#define M_DMAC_MEMRDMULT _DD_MAKEMASK1(22) /* 570{0,1} only */ +#define M_DMAC_BEALL _DD_MAKEMASK1(23) /* 570{0,1} only */ + +#define S_DMAC_RDCMD 24 /* 570{0,1} only */ +#define M_DMAC_RDCMD _DD_MAKEMASK(4,S_DMAC_RDCMD) +#define V_DMAC_RDCMD(x) _DD_MAKEVALUE(x,S_DMAC_RDCMD) +#define G_DMAC_RDCMD(x) _DD_GETVALUE(x,S_DMAC_RDCMD,M_DMAC_RDCMD) +#define K_PCI_MEMRD 0x6 + +#define S_DMAC_WRCMD 28 +#define M_DMAC_WRCMD _DD_MAKEMASK(4,S_DMAC_WRCMD) +#define V_DMAC_WRCMD(x) _DD_MAKEVALUE(x,S_DMAC_WRCMD) +#define G_DMAC_WRCMD(x) _DD_GETVALUE(x,S_DMAC_WRCMD,M_DMAC_WRCMD) +#define K_PCI_MEMWR 0x7 + +/* PCIS: PCI State Register (0x70) */ + +#define M_PCIS_RESET _DD_MAKEMASK1(0) +#define M_PCIS_INT _DD_MAKEMASK1(1) +#define M_PCIS_MODE _DD_MAKEMASK1(2) +#define M_PCIS_33MHZ _DD_MAKEMASK1(3) +#define M_PCIS_32BIT _DD_MAKEMASK1(4) +#define M_PCIS_ROMEN _DD_MAKEMASK1(5) +#define M_PCIS_ROMRETRY _DD_MAKEMASK1(6) +#define M_PCIS_FLATVIEW _DD_MAKEMASK1(8) +/* ... more ... */ + +/* PCI Clock Control Register (0x74) */ + +/* Register Base Address Register (0x78) */ + +/* Memory Window Base Address Register (0x7c) */ + + +/* High Priority Mailboxes (p 323) */ + + +/* Ethernet MAC Control registers (p 358) */ + +/* MACM: Ethernet MAC Mode Register (0x400) */ + +#define M_MACM_GLBRESET _DD_MAKEMASK1(0) +#define M_MACM_HALFDUPLEX _DD_MAKEMASK1(1) + +#define S_MACM_PORTMODE 2 +#define M_MACM_PORTMODE _DD_MAKEMASK(2,S_MACM_PORTMODE) +#define V_MACM_PORTMODE(x) _DD_MAKEVALUE(x,S_MACM_PORTMODE) +#define G_MACM_PORTMODE(x) _DD_GETVALUE(x,S_MACM_PORTMODE,M_MACM_PORTMODE) +#define K_MACM_PORTMODE_NONE 0x0 +#define K_MACM_PORTMODE_MII 0x1 +#define K_MACM_PORTMODE_GMII 0x2 +#define K_MACM_PORTMODE_TBI 0x3 + +#define M_MACM_LOOPBACK _DD_MAKEMASK1(4) +#define M_MACM_TAGGEDMAC _DD_MAKEMASK1(7) +#define M_MACM_TXBURST _DD_MAKEMASK1(8) +#define M_MACM_MAXDEFER _DD_MAKEMASK1(9) +#define M_MACM_LINKPOLARITY _DD_MAKEMASK1(10) +#define M_MACM_RXSTATSENB _DD_MAKEMASK1(11) +#define M_MACM_RXSTATSCLR _DD_MAKEMASK1(12) +#define M_MACM_RXSTATSFLUSH _DD_MAKEMASK1(13) +#define M_MACM_TXSTATSENB _DD_MAKEMASK1(14) +#define M_MACM_TXSTATSCLR _DD_MAKEMASK1(15) +#define M_MACM_TXSTATSFLUSH _DD_MAKEMASK1(16) +#define M_MACM_SENDCFGS _DD_MAKEMASK1(17) +#define M_MACM_MAGICPKT _DD_MAKEMASK1(18) +#define M_MACM_ACPI _DD_MAKEMASK1(19) +#define M_MACM_MIPENB _DD_MAKEMASK1(20) +#define M_MACM_TDEENB _DD_MAKEMASK1(21) +#define M_MACM_RDEENB _DD_MAKEMASK1(22) +#define M_MACM_FHDEENB _DD_MAKEMASK1(23) + +/* MACSTAT: Ethernet MAC Status Register (0x404) */ +/* MACEVNT: Ethernet MAC Event Enable Register (0x408) */ + +/* Status Register only */ +#define M_MACSTAT_PCSSYNC _DD_MAKEMASK1(0) +#define M_MACSTAT_SIGDET _DD_MAKEMASK1(1) +#define M_MACSTAT_RCVCFG _DD_MAKEMASK1(2) +#define M_MACSTAT_CFGCHNG _DD_MAKEMASK1(3) +#define M_MACSTAT_SYNCCHNG _DD_MAKEMASK1(4) +/* Status and Enable Registers */ +#define M_EVT_PORTERR _DD_MAKEMASK1(10) +#define M_EVT_LINKCHNG _DD_MAKEMASK1(12) +#define M_EVT_MICOMPLETE _DD_MAKEMASK1(22) +#define M_EVT_MIINT _DD_MAKEMASK1(23) +#define M_EVT_APERR _DD_MAKEMASK1(24) +#define M_EVT_ODIERR _DD_MAKEMASK1(25) +#define M_EVT_RXSTATOVRUN _DD_MAKEMASK1(26) +#define M_EVT_TXSTATOVRUN _DD_MAKEMASK1(27) + +/* MICOMM: MI Communication Register (0x44c) */ + +#define S_MICOMM_DATA 0 +#define M_MICOMM_DATA _DD_MAKEMASK(16,S_MICOMM_DATA) +#define V_MICOMM_DATA(x) _DD_MAKEVALUE(x,S_MICOMM_DATA) +#define G_MICOMM_DATA(x) _DD_GETVALUE(x,S_MICOMM_DATA,M_MICOMM_DATA) + +#define S_MICOMM_REG 16 +#define M_MICOMM_REG _DD_MAKEMASK(5,S_MICOMM_REG) +#define V_MICOMM_REG(x) _DD_MAKEVALUE(x,S_MICOMM_REG) +#define G_MICOMM_REG(x) _DD_GETVALUE(x,S_MICOMM_REG,M_MICOMM_REG) + +#define S_MICOMM_PHY 21 +#define M_MICOMM_PHY _DD_MAKEMASK(5,S_MICOMM_PHY) +#define V_MICOMM_PHY(x) _DD_MAKEVALUE(x,S_MICOMM_PHY) +#define G_MICOMM_PHY(x) _DD_GETVALUE(x,S_MICOMM_PHY,M_MICOMM_PHY) + +#define S_MICOMM_CMD 26 +#define M_MICOMM_CMD _DD_MAKEMASK(2,S_MICOMM_CMD) +#define V_MICOMM_CMD(x) _DD_MAKEVALUE(x,S_MICOMM_CMD) +#define G_MICOMM_CMD(x) _DD_GETVALUE(x,S_MICOMM_CMD,M_MICOMM_CMD) +#define K_MICOMM_CMD_WR 0x1 +#define K_MICOMM_CMD_RD 0x2 +#define V_MICOMM_CMD_WR V_MICOMM_CMD(K_MICOMM_CMD_WR) +#define V_MICOMM_CMD_RD V_MICOMM_CMD(K_MICOMM_CMD_RD) + +#define M_MICOMM_RDFAIL _DD_MAKEMASK1(28) +#define M_MICOMM_BUSY _DD_MAKEMASK1(29) + +/* MISTAT: MI Status Register (0x450) */ + +#define M_MISTAT_LINKED _DD_MAKEMASK1(0) +#define M_MISTAT_10MBPS _DD_MAKEMASK1(1) + +/* MIMODE: MI Mode Register (0x454) */ + +#define M_MIMODE_SHORTPREAMBLE _DD_MAKEMASK1(1) +#define M_MIMODE_POLLING _DD_MAKEMASK1(4) + +#define S_MIMODE_CLKCNT 16 +#define M_MIMODE_CLKCNT _DD_MAKEMASK(5,S_MIMODE_CLKCNT) +#define V_MIMODE_CLKCNT(x) _DD_MAKEVALUE(x,S_MIMODE_CLKCNT) +#define G_MIMODE_CLKCNT(x) _DD_GETVALUE(x,S_MIMODE_CLKCNT,M_MIMODE_CLKCNT) + +/* TXLEN: Transmit MAC Lengths Register (0x464) */ + +#define S_TXLEN_SLOT 0 +#define M_TXLEN_SLOT _DD_MAKEMASK(8,S_TXLEN_SLOT) +#define V_TXLEN_SLOT(x) _DD_MAKEVALUE(x,S_TXLEN_SLOT) +#define G_TXLEN_SLOT(x) _DD_GETVALUE(x,S_TXLEN_SLOT,M_TXLEN_SLOT) + +#define S_TXLEN_IPG 8 +#define M_TXLEN_IPG _DD_MAKEMASK(4,S_TXLEN_IPG) +#define V_TXLEN_IPG(x) _DD_MAKEVALUE(x,S_TXLEN_IPG) +#define G_TXLEN_IPG(x) _DD_GETVALUE(x,S_TXLEN_IPG,M_TXLEN_IPG) + +#define S_TXLEN_IPGCRS 12 +#define M_TXLEN_IPGCRS _DD_MAKEMASK(2,S_TXLEN_IPGCRS) +#define V_TXLEN_IPGCRS(x) _DD_MAKEVALUE(x,S_TXLEN_IPGCRS) +#define G_TXLEN_IPGCRS(x) _DD_GETVALUE(x,S_TXLEN_IPGCRS,M_TXLEN_IPGCRS) + +/* RULESCFG: Receive Rules Configuration Register (0x500) */ + +#define S_RULESCFG_DEFAULT 3 +#define M_RULESCFG_DEFAULT _DD_MAKEMASK(5,S_RULESCFG_DEFAULT) +#define V_RULESCFG_DEFAULT(x) _DD_MAKEVALUE(x,S_RULESCFG_DEFAULT) +#define G_RULESCFG_DEFAULT(x) _DD_GETVALUE(x,S_RULESCFG_DEFAULT,M_RULESCFG_DEFAULT) + + +/* Send Data Initiator Control Registers (p 383) */ +/* Send BD Ring Selector Control Registers (p 387) */ +/* Send BD Initiator Control Registers (p 389) */ + + +/* Receive List Placement Control Registers (p 392) */ + +/* LISTCFG: Receive List Placement Configuration Register (0x2010) */ + +#define S_LISTCFG_GROUP 0 +#define M_LISTCFG_GROUP _DD_MAKEMASK(3,S_LISTCFG_GROUP) +#define V_LISTCFG_GROUP(x) _DD_MAKEVALUE(x,S_LISTCFG_GROUP) +#define G_LISTCFG_GROUP(x) _DD_GETVALUE(x,S_LISTCFG_GROUP,M_LISTCFG_GROUP) + +#define S_LISTCFG_ACTIVE 3 +#define M_LISTCFG_ACTIVE _DD_MAKEMASK(5,S_LISTCFG_ACTIVE) +#define V_LISTCFG_ACTIVE(x) _DD_MAKEVALUE(x,S_LISTCFG_ACTIVE) +#define G_LISTCFG_ACTIVE(x) _DD_GETVALUE(x,S_LISTCFG_ACTIVE,M_LISTCFG_ACTIVE) + +#define S_LISTCFG_BAD 8 +#define M_LISTCFG_BAD _DD_MAKEMASK(5,S_LISTCFG_BAD) +#define V_LISTCFG_BAD(x) _DD_MAKEVALUE(x,S_LISTCFG_BAD) +#define G_LISTCFG_BAD(x) _DD_GETVALUE(x,S_LISTCFG_BAD,M_LISTCFG_BAD) + +#define S_LISTCFG_DEFAULT 13 +#define M_LISTCFG_DEFAULT _DD_MAKEMASK(2,S_LISTCFG_DEFAULT) +#define V_LISTCFG_DEFAULT(x) _DD_MAKEVALUE(x,S_LISTCFG_DEFAULT) +#define G_LISTCFG_DEFAULT(x) _DD_GETVALUE(x,S_LISTCFG_DEFAULT,M_LISTCFG_DEFAULT) + + +/* Receive Data and Receive BD Initiator Control Registers (p 399) */ + +/* RCVINITMODE: Receive Data and Receive BD Initiator Mode Register (0x2400) */ + +#define M_RCVINITMODE_JUMBO _DD_MAKEMASK1(2) +#define M_RCVINITMODE_FRMSIZE _DD_MAKEMASK1(3) +#define M_RCVINITMODE_RTNSIZE _DD_MAKEMASK1(4) + + +/* Receive Initiator Control Registers (p 404) */ +/* Receive BD Completion Control Registers (p 406) */ +/* Receive List Selector Control Registers (p 408) */ +/* Mbuf Cluster Free Registers (p 409) */ + + +/* Host Coalescing Control registers (p 410) */ + +/* HCM: Host Coalescing Mode Register (0x3C00) */ + +#define M_HCM_RESET _DD_MAKEMASK1(0) +#define M_HCM_ENABLE _DD_MAKEMASK1(1) +#define M_HCM_ATTN _DD_MAKEMASK1(2) +#define M_HCM_COAL_NOW _DD_MAKEMASK1(3) + +#define S_HCM_MSIBITS 4 +#define M_HCM_MSIBITS _DD_MAKEMASK(3,S_HCM_MSIBITS) +#define V_HCM_MSIBITS(x) _DD_MAKEVALUE(x,S_HCM_MSIBITS) +#define G_HCM_MSIBITS _DD_GETVALUE(x,S_HCM_MSIBITS,M_HCM_MSIBITS) + +#define S_HCM_SBSIZE 7 +#define M_HCM_SBSIZE _DD_MAKEMASK(2,S_HCM_SBSIZE) +#define V_HCM_SBSIZE(x) _DD_MAKEVALUE(x,S_HCM_SBSIZE) +#define G_HCM_SBSIZE _DD_GETVALUE(x,S_HCM_SBSIZE,M_HCM_SBSIZE) +#define K_HCM_SBSIZE_80 0x0 +#define K_HCM_SBSIZE_64 0x1 +#define K_HCM_SBSIZE_32 0x2 +/* ... more ... */ + + +/* Memory Arbiter Registers (p 420) */ + +/* MAM: Memory Arbiter Mode Register (0x4000) */ + +#define M_MAM_RESET _DD_MAKEMASK1(0) +#define M_MAM_ENABLE _DD_MAKEMASK1(1) + +/* Memory Arbiter Status Register (0x4004) */ + +/* Memory Arbiter Trap Low and Trap High Registers (0x4008, 0x400C) */ + + +/* Buffer Manager Control Registers (p 424) */ + +/* BMODE: Buffer Manager Control Register (0x4400) */ + +#define M_BMODE_RESET _DD_MAKEMASK1(0) +#define M_BMODE_ENABLE _DD_MAKEMASK1(1) +#define M_BMODE_ATTN _DD_MAKEMASK1(2) +#define M_BMODE_TEST _DD_MAKEMASK1(3) +#define M_BMODE_MBUFLOWATTN _DD_MAKEMASK1(4) + + +/* Read DMA Control Registers (p 428) */ +/* Write DMA Control Registers (p 431) */ + +/* Bit fields shared by DMA_MODE and DMA_STATUS registers */ + +#define M_ATTN_TGTABORT _DD_MAKEMASK1(2) +#define M_ATTN_MSTRABORT _DD_MAKEMASK1(3) +#define M_ATTN_PERR _DD_MAKEMASK1(4) +#define M_ATTN_ADDROVFL _DD_MAKEMASK1(5) +#define M_ATTN_FIFOOVFL _DD_MAKEMASK1(6) +#define M_ATTN_FIFOUNFL _DD_MAKEMASK1(7) +#define M_ATTN_FIFOREAD _DD_MAKEMASK1(8) +#define M_ATTN_LENERR _DD_MAKEMASK1(9) +#define M_ATTN_ALL (M_ATTN_TGTABORT | M_ATTN_MSTRABORT | \ + M_ATTN_PERR | M_ATTN_ADDROVFL | \ + M_ATTN_FIFOOVFL | M_ATTN_FIFOUNFL | \ + M_ATTN_FIFOREAD | M_ATTN_LENERR) + +/* Read DMA Mode Register (0x4800) */ +/* Write DMA Mode Register (0x4C00) */ + +/* Read DMA Status Register (0x4804) */ +/* Write DMA Status Register (0x4C04) */ + + +/* RX RISC Registers (p 433) */ +/* TX RISC Registers (p 437) */ +/* Low Priority Mailboxes (p 441) */ +/* Flow Through Queues (p 445) */ +/* Message Signaled Interrupt Registers (p 447) */ +/* DMA Completion Registers (p 449) */ + + +/* General Control registers (p 450) */ + +/* MCTL: Miscellaneous Host Control Register (0x6800) */ + +#define M_MCTL_UPDATE _DD_MAKEMASK1(0) +#define M_MCTL_BSWAPCTRL _DD_MAKEMASK1(1) +#define M_MCTL_WSWAPCTRL _DD_MAKEMASK1(2) +#define M_MCTL_BSWAPDATA _DD_MAKEMASK1(4) +#define M_MCTL_WSWAPDATA _DD_MAKEMASK1(5) +#define M_MCTL_NOCRACK _DD_MAKEMASK1(9) +#define M_MCTL_NOCRC _DD_MAKEMASK1(10) +#define M_MCTL_ACCEPTBAD _DD_MAKEMASK1(11) +#define M_MCTL_NOTXINT _DD_MAKEMASK1(13) +#define M_MCTL_NORTRNINT _DD_MAKEMASK1(14) +#define M_MCTL_PCI32 _DD_MAKEMASK1(15) +#define M_MCTL_HOSTUP _DD_MAKEMASK1(16) +#define M_MCTL_HOSTBDS _DD_MAKEMASK1(17) +#define M_MCTL_NOTXPHSUM _DD_MAKEMASK1(20) +#define M_MCTL_NORXPHSUM _DD_MAKEMASK1(23) +#define M_MCTL_TXINT _DD_MAKEMASK1(24) +#define M_MCTL_RXINT _DD_MAKEMASK1(25) +#define M_MCTL_MACINT _DD_MAKEMASK1(26) +#define M_MCTL_DMAINT _DD_MAKEMASK1(27) +#define M_MCTL_FLOWINT _DD_MAKEMASK1(28) +#define M_MCTL_4XRINGS _DD_MAKEMASK1(29) +#define M_MCTL_MCASTEN _DD_MAKEMASK1(30) + +/* MCFG: Miscellaneous Configuration Register (0x6804) */ + +#define M_MCFG_CORERESET _DD_MAKEMASK1(0) +#define S_MCFG_PRESCALER 1 +#define M_MCFG_PRESCALER _DD_MAKEMASK(7,S_MCFG_PRESCALER) +#define V_MCFG_PRESCALER(x) _DD_MAKEVALUE(x,S_MCFG_PRESCALER) +#define G_MCFG_PRESCALER(x) _DD_GETVALUE(x,S_MCFG_PRESCALER,M_MCFG_PRESCALER) + +/* MLCTL: Miscellaneous Local Control Register (0x6808) */ + +#define M_MLCTL_INTSTATE _DD_MAKEMASK1(0) +#define M_MLCTL_INTCLR _DD_MAKEMASK1(1) +#define M_MLCTL_INTSET _DD_MAKEMASK1(2) +#define M_MLCTL_INTATTN _DD_MAKEMASK1(3) +/* ... */ +#define M_MLCTL_EPAUTOACCESS _DD_MAKEMASK1(24) + +/* EPADDR: Serial EEPROM Address Register (0x6838) */ + +#define S_EPADDR_ADDR 0 +#define M_EPADDR_ADDR (_DD_MAKEMASK(16,S_EPADDR_ADDR) & ~3) +#define V_EPADDR_ADDR(x) _DD_MAKEVALUE(x,S_EPADDR_ADDR) +#define G_EPADDR_ADDR(x) _DD_GETVALUE(x,S_EPADDR_ADDR,M_EPADDR_ADDR) + +#define S_EPADDR_HPERIOD 16 +#define M_EPADDR_HPERIOD _DD_MAKEMASK(9,S_EPADDR_HPERIOD) +#define V_EPADDR_HPERIOD(x) _DD_MAKEVALUE(x,S_EPADDR_HPERIOD) +#define G_EPADDR_HPERIOD(x) _DD_GETVALUE(x,S_EPADDR_HPERIOD,M_EPADDR_HPERIOD) + +#define M_EPADDR_START _DD_MAKEMASK1(25) + +#define S_EPADDR_DEVID 26 +#define M_EPADDR_DEVID _DD_MAKEMASK(3,S_EPADDR_DEVID) +#define V_EPADDR_DEVID(x) _DD_MAKEVALUE(x,S_EPADDR_DEVID) +#define G_EPADDR_DEVID(x) _DD_GETVALUE(x,S_EPADDR_DEVID,M_EPADDR_DEVID) + +#define M_EPADDR_RESET _DD_MAKEMASK1(29) +#define M_EPADDR_COMPLETE _DD_MAKEMASK1(30) +#define M_EPADDR_RW _DD_MAKEMASK1(31) + +/* EPDATA: Serial EEPROM Data Register (0x683C) */ + +/* EPCTL: Serial EEPROM Control Register (0x6840) */ + +#define M_EPCTL_CLOCKTS0 _DD_MAKEMASK1(0) +#define M_EPCTL_CLOCKO _DD_MAKEMASK1(1) +#define M_EPCTL_CLOCKI _DD_MAKEMASK1(2) +#define M_EPCTL_DATATSO _DD_MAKEMASK1(3) +#define M_EPCTL_DATAO _DD_MAKEMASK1(4) +#define M_EPCTL_DATAI _DD_MAKEMASK1(5) + +/* MDCTL: MDI Control Register (0x6844) */ + +#define M_MDCTL_DATA _DD_MAKEMASK1(0) +#define M_MDCTL_ENABLE _DD_MAKEMASK1(1) +#define M_MDCTL_SELECT _DD_MAKEMASK1(2) +#define M_MDCTL_CLOCK _DD_MAKEMASK1(3) + + +/* Ring Control Blocks (p 97) */ + +#define RCB_HOST_ADDR_HIGH 0x0 +#define RCB_HOST_ADDR_LOW 0x4 +#define RCB_CTRL 0x8 +#define RCB_NIC_ADDR 0xC + +#define RCB_SIZE 0x10 + +#define RCB_FLAG_USE_EXT_RCV_BD _DD_MAKEMASK1(0) +#define RCB_FLAG_RING_DISABLED _DD_MAKEMASK1(1) + +#define S_RCB_MAXLEN 16 +#define M_RCB_MAXLEN _DD_MAKEMASK(16,S_RCB_MAXLEN) +#define V_RCB_MAXLEN(x) _DD_MAKEVALUE(x,S_RCB_MAXLEN) +#define G_RCB_MAXLEN(x) _DD_GETVALUE(x,S_RCB_MAXLEN,M_RCB_MAXLEN) + + +/* On-chip Memory Map (Tables 70 and 71, pp 178-179) This is the map + for the 5700 with no external SRAM, the 5701, 5702 and 5703. The + 5705 does not fully implement some ranges and maps the buffer pool + differently. */ + +/* Locations 0x0000 - 0x00FF are Page Zero */ + +/* Locations 0x0100 - 0x01FF are Send Producer Ring RCBs */ + +#define A_SND_RCBS 0x0100 +#define L_SND_RCBS (16*RCB_SIZE) +#define A_SND_RCB(n) (A_SND_RCBS + ((n)-1)*RCB_SIZE) + +/* Locations 0x0200 - 0x02FF are Receive Return Ring RCBs */ + +#define A_RTN_RCBS 0x0200 +#define L_RTN_RCBS (16*RCB_SIZE) +#define A_RTN_RCB(n) (A_RTN_RCBS + ((n)-1)*RCB_SIZE) + +/* Locations 0x0300 - 0x0AFF are Statistics Block */ + +#define A_MAC_STATS 0x0300 +#define L_MAC_STATS (0x0B00-A_MAC_STATS) + +/* Locations 0x0B00 - 0x0B4F are Status Block */ + +#define A_MAC_STATUS 0x0B00 +#define L_MAC_STATUS (0x0B50-A_MAC_STATUS) + +/* Locations 0x0B50 - 0x0FFF are Software General Communication */ + +#define A_PXE_MAILBOX 0x0B50 +#define T3_MAGIC_NUMBER 0x4B657654 + +/* Locations 0x1000 - 0x1FFF are unmapped */ + +/* Locations 0x2000 - 0x3FFF are DMA Descriptors */ + +#define A_DMA_DESCS 0x2000 +#define L_DMA_DESCS (0x4000-A_DMA_DESCS) + +/* Locations 0x4000 - 0x5FFF are Send Rings 1-4 */ + +#define A_SND_RINGS 0x4000 +#define L_SND_RINGS (0x6000-A_SND_RINGS) + +/* Locations 0x6000 - 0x6FFF are Standard Receive Rings */ + +#define A_STD_RCV_RINGS 0x6000 +#define L_STD_RCV_RINGS (0x7000-A_STD_RCV_RINGS) + +/* Locations 0x7000 - 0x7FFF are Jumbo Receive Rings */ + +#define A_JUMBO_RCV_RINGS 0x7000 +#define L_JUMBO_RCV_RINGS (0x8000-A_JUMBO_RCV_RINGS) + +/* Locations 0x08000 - 0x0FFFF are Buffer Pool 1 */ +/* Locations 0x10000 - 0x17FFF are Buffer Pool 2 */ +/* Locations 0x18000 - 0x1FFFF are Buffer Pool 3 */ + +#define A_BUFFER_POOL 0x08000 +#define L_BUFFER_POOL (0x20000-A_BUFFER_POOL) + +/* Locations 0x08000 - 0x09FFF are TXMBUF (5705) */ +/* Locations 0x10000 - 0x1DFFF are RXMBUF (5705) */ + +#define A_TXMBUF 0x080000 +#define L_TXMBUF (0x0A000-A_TXMBUF) +#define A_RXMBUF 0x100000 +#define L_RXMBUF (0x1E000-A_RXMBUF) + + +/* Indices of (8-byte) counters in the Statistics Block. */ + +#define ifHCInOctets 32 +#define etherStatsFragments 34 +#define ifHCInUcastPkts 35 +#define ifHCInMulticastPkts 36 +#define ifHCInBroadcastPkts 37 +#define dot3StatsFCSErrors 38 +#define dot3StatsAlignmentErrors 39 +#define xonPauseFramesReceived 40 +#define xoffPauseFramesReceived 41 +#define macControlFramesReceived 42 +#define xoffSateEntered 43 +#define dot3StatsFrameTooLongs 44 +#define etherStatsJabbers 45 +#define etherStatsUndersizePkts 46 +#define inRangeLengthError 47 +#define outRangeLengthError 48 +#define etherStatsPkts64Octets 49 +#define etherStatsPkts65to127Octets 50 +#define etherStatsPkts128to255Octets 51 +#define etherStatsPkts256to511Octets 52 +#define etherStatsPkts512to1023Octets 53 +#define etherStatsPkts1024to1522Octets 54 +#define etherStatsPkts1523to2047Octets 55 +#define etherStatsPkts2048to4095Octets 56 +#define etherStatsPkts4096to8191Octets 57 +#define etherStatsPkts8192to9022Octets 58 + +#define ifHCOutOctets 96 +#define etherStatsCollisions 98 +#define outXonSent 99 +#define outXoffSent 100 +#define flowControlDone 101 +#define dot3StatsInternalMacTransmitErrors 102 +#define dot3StatsSingleCollisionFrames 103 +#define dot3StatsMultipleCollisionFrames 104 +#define dot3StatsDeferredTransmissions 105 +#define dot3StatsExcessiveCollisions 107 +#define dot3StatsLateCollisions 108 +#define dot3Collided2Times 109 +#define dot3Collided3Times 110 +#define dot3Collided4Times 111 +#define dot3Collided5Times 112 +#define dot3Collided6Times 113 +#define dot3Collided7Times 114 +#define dot3Collided8Times 115 +#define dot3Collided9Times 116 +#define dot3Collided10Times 117 +#define dot3Collided11Times 118 +#define dot3Collided12Times 119 +#define dot3Collided13Times 120 +#define dot3Collided14Times 121 +#define dot3Collided15Times 122 +#define ifHCOutUcastPkts 123 +#define ifHCOutMulticastPkts 124 +#define ifHCOutBroadcastPkts 125 +#define dot3StatsCarrierSenseErrors 126 +#define ifOutDiscards 127 +#define ifOutErrors 128 + +#define COSifHCInPkts1 160 +#define COSifHCInPkts2 161 +#define COSifHCInPkts3 162 +#define COSifHCInPkts4 163 +#define COSifHCInPkts5 164 +#define COSifHCInPkts6 165 +#define COSifHCInPkts7 166 +#define COSifHCInPkts8 167 +#define COSifHCInPkts9 168 +#define COSifHCInPkts10 169 +#define COSifHCInPkts11 170 +#define COSifHCInPkts12 171 +#define COSifHCInPkts13 172 +#define COSifHCInPkts14 173 +#define COSifHCInPkts15 174 +#define COSifHCInPkts16 175 +#define COSFramesDroppedDueToFilters 176 +#define nicDmaWriteQueueFull 177 +#define nicDmaWriteHighPriQueueFull 178 +#define nicNoMoreRxBDs 179 +#define ifInDiscards 180 +#define ifInErrors 181 +#define nicRecvThresholdHit 182 + +#define COSifHCOutPkts1 192 +#define COSifHCOutPkts2 193 +#define COSifHCOutPkts3 194 +#define COSifHCOutPkts4 195 +#define COSifHCOutPkts5 196 +#define COSifHCOutPkts6 197 +#define COSifHCOutPkts7 198 +#define COSifHCOutPkts8 199 +#define COSifHCOutPkts9 200 +#define COSifHCOutPkts10 201 +#define COSifHCOutPkts11 202 +#define COSifHCOutPkts12 203 +#define COSifHCOutPkts13 204 +#define COSifHCOutPkts14 205 +#define COSifHCOutPkts15 206 +#define COSifHCOutPkts16 207 +#define nicDmaReadQueueFull 208 +#define nicDmaReadHighPriQueueFull 209 +#define nicSendDataCompQueueFull 210 +#define nicRingSetSendProdIndex 211 +#define nicRingStatusUpdate 212 +#define nicInterrupts 213 +#define nicAvoidedInterrupts 214 +#define nicSendThresholdHit 215 + +#endif /* _BCM_5700_H_ */ diff --git a/cfe/cfe/dev/bcm5821.h b/cfe/cfe/dev/bcm5821.h new file mode 100644 index 0000000..29ece60 --- /dev/null +++ b/cfe/cfe/dev/bcm5821.h @@ -0,0 +1,278 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * BCM5821 cryptoaccelerator File: bcm5821.h + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _BCM5821_H_ +#define _BCM5821_H_ + +/* Register and field definitions for the Broadcom BCM5821 crypto + accelerator. The BCM5820 implements a compatible (modulo bugs) + subset of the BCM5821. */ + +#define K_PCI_VENDOR_BROADCOM 0x14e4 +#define K_PCI_ID_BCM5820 0x5820 +#define K_PCI_ID_BCM5821 0x5821 + +#define _DD_MAKEMASK1(n) (1 << (n)) +#define _DD_MAKEMASK(v,n) ((((1)<<(v))-1) << (n)) +#define _DD_MAKEVALUE(v,n) ((v) << (n)) +#define _DD_GETVALUE(v,n,m) (((v) & (m)) >> (n)) + + +/* DMA Control and Status Register offsets */ + +#define R_MCR1 0x00 +#define R_DMA_CTRL 0x04 +#define R_DMA_STAT 0x08 +#define R_DMA_ERR 0x0C +#define R_MCR2 0x10 + + +/* 0x00 MCR1@: Master Command Record 1 Address */ +/* 0x10 MCR2@: Master Command Record 2 Address */ + + +/* 0x04 DMA Control */ + +#define M_DMA_CTRL_WR_BURST _DD_MAKEMASK1(16) /* Not 5820 */ + +#define K_DMA_WR_BURST_128 0 +#define K_DMA_WR_BURST_240 M_DMA_CRTL_WR_BURST + +#define M_DMA_CTRL_MOD_NORM _DD_MAKEMASK1(22) +#define M_DMA_CTRL_RNG_MODE _DD_MAKEMASK1(23) +#define M_DMA_CTRL_DMAERR_EN _DD_MAKEMASK1(25) +#define M_DMA_CTRL_NORM_PCI _DD_MAKEMASK1(26) /* Not 5820 */ +#define M_DMA_CTRL_LE_CRYPTO _DD_MAKEMASK1(27) /* Not 5820 */ +#define M_DMA_CTRL_MCR1_INT_EN _DD_MAKEMASK1(29) +#define M_DMA_CTRL_MCR2_INT_EN _DD_MAKEMASK1(30) +#define M_DMA_CTRL_RESET _DD_MAKEMASK1(31) + + +/* 0x08 DMA Status */ + +#define M_DMA_STAT_MCR2_EMPTY _DD_MAKEMASK1(24) /* Not 5820 */ +#define M_DMA_STAT_MCR1_EMPTY _DD_MAKEMASK1(25) /* Not 5820 */ +#define M_DMA_STAT_MCR2_INTR _DD_MAKEMASK1(26) +#define M_DMA_STAT_MCR2_FULL _DD_MAKEMASK1(27) +#define M_DMA_STAT_DMAERR_INTR _DD_MAKEMASK1(28) +#define M_DMA_STAT_MCR1_INTR _DD_MAKEMASK1(29) +#define M_DMA_STAT_MCR1_FULL _DD_MAKEMASK1(30) +#define M_DMA_STAT_MSTR_ACCESS _DD_MAKEMASK1(31) + +/* 0x0C DMA Error Address */ + +#define M_DMA_ERR_RD_FAULT _DD_MAKEMASK1(1) +#define M_DMA_ERR_ADDR 0xFFFFFFFC + + +/* Master Command Record Header Format */ + +#define S_MCR_NUM_PACKETS 0 +#define M_MCR_NUM_PACKETS _DD_MAKEMASK(16,S_MCR_NUM_PACKETS) +#define V_MCR_NUM_PACKETS(x) _DD_MAKEVALUE(x,S_MCR_NUM_PACKETS) +#define G_MCR_NUM_PACKETS(x) _DD_GETVALUE(x,S_MCR_NUM_PACKETS,M_MCR_NUM_PACKETS) + +/* Input flags */ + +#define M_MCR_SUPPRESS_INTR _DD_MAKEMASK1(31) + +/* Output flags */ + +#define M_MCR_DONE _DD_MAKEMASK1(16) +#define M_MCR_ERROR _DD_MAKEMASK1(17) + +#define S_MCR_ERROR_CODE 24 +#define M_MCR_ERROR_CODE _DD_MAKEMASK(8,S_MCR_ERROR_CODE) +#define V_MCR_ERROR_CODE(x) _DD_MAKEVALUE(x,S_MCR_ERROR_CODE) +#define G_MCR_ERROR_CODE(x) _DD_GETVALUE(x,S_MCR_ERROR_CODE,M_MCR_ERROR_CODE) +#define K_MCR_ERROR_OK 0 +#define K_MCR_ERROR_UNKNOWN_OP 1 +#define K_MCR_ERROR_DSA_SHORT 2 +#define K_MCR_ERROR_PKI_SHORT 3 +#define K_MCR_ERROR_PKO_SHORT 4 /* Not 5820 */ +#define K_MCR_ERROR_CHAIN_SHORT 5 /* Not 5820 */ +#define K_MCR_ERROR_FIFO 6 /* Not 5820 */ + +/* In both cases, the header word is followed by an array of N PD entries: + commandContext[0] + dataBuffer[0] + pktLen[0] + outputBuffer[0] + ... + commandContext[n-1] + dataBuffer[n-1] + pktLen[n-1] + outputBuffer[n-1] +*/ + +#define MCR_WORDS(n) (1+8*(n)) +#define MCR_BYTES(n) ((1+8*(n))*4) + + +/* Data Buffer Chain Entry Offsets */ + +#define DBC_ADDR 0 +#define DBC_NEXT 4 +#define DBC_LEN 8 + +#define CHAIN_WORDS 3 + +#define S_DBC_DATA_LEN 0 +#define M_DBC_DATA_LEN _DD_MAKEMASK(16,S_DBC_DATA_LEN) +#define V_DBC_DATA_LEN(x) _DD_MAKEVALUE(x,S_DBC_DATA_LEN) +#define G_DBC_DATA_LEN(x) _DD_GETVALUE(x,S_DBC_DATA_LEN,M_DBC_DATA_LEN) + +/* Packet Descriptor Offsets */ + +#define PD_CC_ADDR 0 +#define PD_INPUT_FRAG 4 +#define PD_INPUT_FRAG_ADDR (PD_INPUT_FRAG+DBC_ADDR) +#define PD_INPUT_FRAG_NEXT (PD_INPUT_FRAG+DBC_NEXT) +#define PD_INPUT_FRAG_LEN (PD_INPUT_FRAG+DBC_LEN) +#define PD_PKT_LEN 16 +#define PD_OUTPUT_FRAG 20 +#define PD_OUTPUT_FRAG_ADDR (PD_OUTPUT_FRAG+DBC_ADDR) +#define PD_OUTPUT_FRAG_NEXT (PD_OUTPUT_FRAG+DBC_NEXT) +#define PD_OUTPUT_FRAG_LEN (PD_OUTPUT_FRAG+DBC_LEN) + +#define PD_SIZE 32 + +#define S_PD_PKT_LEN 16 +#define M_PD_PKT_LEN _DD_MAKEMASK(16,S_PD_PKT_LEN) +#define V_PD_PKT_LEN(x) _DD_MAKEVALUE(x,S_PD_PKT_LEN) +#define G_PD_PKT_LEN(x) _DD_GETVALUE(x,S_PD_PKT_LEN,M_PD_PKT_LEN) + + +/* Crypotographic Operations */ + +/* MCR1 only (symmetric) */ +#define K_IPSEC_3DES 0x0000 /* Not 5820 */ +#define K_SSL_MAC 0x0001 +#define K_TLS_HMAC 0x0002 +#define K_SSL_3DES 0x0003 +#define K_ARC4 0x0004 +#define K_HASH 0x0005 + +/* MCR2 only (asymmetric) */ +#define K_DH_PK_GEN 0x0001 +#define K_DH_SK_GEN 0x0002 +#define K_RSA_PK_OP 0x0003 +#define K_RSA_SK_OP 0x0004 +#define K_DSA_SIGN 0x0005 +#define K_DSA_VERIF 0x0006 +#define K_RNG_DIRECT 0x0041 +#define K_RNG_SHA1 0x0042 +#define K_MOD_ADD 0x0043 +#define K_MOD_SUB 0x0044 +#define K_MOD_MUL 0x0045 +#define K_MOD_REDUCE 0x0046 +#define K_MOD_EXP 0x0047 +#define K_MOD_INV 0x0048 /* Not 5821 */ +#define K_MOD_2EXP 0x0049 /* Not 5820 */ + + +/* Command Context Header */ + +/* Word 0 */ + +#define S_CC_OPCODE 16 +#define M_CC_OPCODE _DD_MAKEMASK(16,S_CC_OPCODE) +#define V_CC_OPCODE(x) _DD_MAKEVALUE(x,S_CC_OPCODE) +#define G_CC_OPCODE(x) _DD_GETVALUE(x,S_CC_OPCODE,M_CC_OPCODE) + +#define S_CC_LEN 0 +#define M_CC_LEN _DD_MAKEMASK(16,S_CC_LEN) +#define V_CC_LEN(x) _DD_MAKEVALUE(x,S_CC_LEN) +#define G_CC_LEN(x) _DD_GETVALUE(x,S_CC_LEN,M_CC_LEN) + +/* Word 1 */ + +#define S_CC_FLAGS 12 +#define M_CC_FLAGS _DD_MAKEMASK(4,S_CC_FLAGS) +#define V_CC_FLAGS(x) _DD_MAKEVALUE(x,S_CC_FLAGS) +#define G_CC_FLAGS(x) _DD_GETVALUE(x,S_CC_OPCODE,M_CC_OPCODE) + +/* The remaining command context fields depend on the opcode. */ + +/* IPSEC 3DES (K_IPSEC_3DES) */ + +/* SSL MAC (K_SSL_MAC) */ +/* TLS HMAC (K_TLS_HMAC) */ +/* Pure MD5/SHA-1 Hash (K_HASH) */ + +#define K_HASH_FLAGS_MD5 1 +#define K_HASH_FLAGS_SHA1 2 + +/* SSL MAC (K_SSL_MAC) */ + +#define SSL_MAC_CMD_WORDS 22 + +/* TLS HMAC (K_TLS_HMAC) */ + +#define TLS_HMAC_CMD_WORDS 16 + +/* Pure MD5/SHA-1 Hash (K_HASH) */ + +/* SSL/TLS DES/3DES (K_SSL_3DES) */ + +/* ARCFOUR (K_ARC4) */ + +#define ARC4_STATE_WORDS (1 + 256/4) +#define ARC4_CMD_WORDS (2 + ARC4_STATE_WORDS) + +#define M_ARC4_FLAGS_KEY _DD_MAKEMASK1(10) +#define M_ARC4_FLAGS_WRITEBACK _DD_MAKEMASK1(11) +#define M_ARC4_FLAGS_NULLDATA _DD_MAKEMASK1(12) + + +/* Random number generation (K_RNG_DIRECT, K_RNG_SHA1) */ + +/* Modular arithmetic (K_MOD_ADD, K_MOD_SUB, K_MOD_MUL) */ + +/* Modular Remainder (K_MOD_REDUCE) */ + +/* Modular Exponentiation (K_MOD_EXP) */ + +/* Double Modular Exponentiation (K_MOD_2EXP) */ + + +#endif /* _BCM_5821_H_ */ diff --git a/cfe/cfe/dev/dc21143.h b/cfe/cfe/dev/dc21143.h new file mode 100644 index 0000000..65f3255 --- /dev/null +++ b/cfe/cfe/dev/dc21143.h @@ -0,0 +1,588 @@ +/* + * Register and bit definitions for the DEC/Intel 21143 Ethernet controller, + * part of the Tulip family of 10 and 10/100 controllers. + * Reference: + * 21143 PCI/CardBus 10/100 Mb/s Ethernet LAN Controller, + * Hardware Reference Manual, Revision 1.0. + * Document No. 278074-001 + * Intel Corp., October 1998 + * Includes extensions/alternatives for the DEC 21040, 21041 and 21140(A) + * Ethernet controllers. + */ +#ifndef _DC21143_H_ +#define _DC21143_H_ + +#define _DD_MAKEMASK1(n) (1 << (n)) +#define _DD_MAKEMASK(v,n) ((((1)<<(v))-1) << (n)) +#define _DD_MAKEVALUE(v,n) ((v) << (n)) +#define _DD_GETVALUE(v,n,m) (((v) & (m)) >> (n)) + + +/* ********************************************************************* + * PCI Configuration Register offsets (Tulip nomenclature) + ********************************************************************* */ + +#define R_CFG_CFID PCI_ID_REG +#define K_PCI_VENDOR_DEC 0x1011 +#define K_PCI_ID_DC21040 0x0002 +#define K_PCI_ID_DC21041 0x0014 +#define K_PCI_ID_DC21140 0x0009 +#define K_PCI_ID_DC21143 0x0019 + +#define R_CFG_CFRV PCI_CLASS_REG + +#define R_CFG_CBIO PCI_MAPREG(0) +#define R_CFG_CBMA PCI_MAPREG(1) + +#define R_CFG_CFIT PCI_BPARAM_INTERRUPT_REG + +/* Tulip extensions */ +#define R_CFG_CFDD 0x40 + +#define M_CFDD_SLEEP __DD_MAKEMASK1(31) +#define M_CFDD_SNOOZE __DD_MAKEMASK1(30) + +#define R_CFG_CPMS 0xE0 + + +/* ********************************************************************* + * CSRs: offsets + ********************************************************************* */ + +#define R_CSR_BUSMODE 0x00 +#define R_CSR_TXPOLL 0x08 +#define R_CSR_RXPOLL 0x10 +#define R_CSR_RXRING 0x18 +#define R_CSR_TXRING 0x20 +#define R_CSR_STATUS 0x28 +#define R_CSR_OPMODE 0x30 +#define R_CSR_INTMASK 0x38 +#define R_CSR_MISSEDFRAME 0x40 +#define R_CSR_ROM_MII 0x48 +#define R_CSR_BOOTROM_ADRR 0x50 +#define R_CSR_GENTIMER 0x58 + +/* The following registers are specific to the 21040 */ + +#define R_CSR_FDUPLEX 0x58 + +/* The following registers are specific to the 21040/21041 and 21142/21143 */ + +#define R_CSR_SIASTATUS 0x60 +#define R_CSR_SIAMODE0 0x68 +#define R_CSR_SIAMODE1 0x70 +#define R_CSR_SIAMODE2 0x78 + +/* The following registers are specific to the 21140/21140A */ + +#define R_CSR_GENPORT 0x60 +#define R_CSR_WATCHDOG_TIMER 0x78 + + +/* CSR0: Bus Mode register */ + +#define M_CSR0_SWRESET _DD_MAKEMASK1(0) +#define M_CSR0_BUSARB _DD_MAKEMASK1(1) + +#define S_CSR0_SKIPLEN 2 +#define M_CSR0_SKIPLEN _DD_MAKEMASK(5,S_CSR0_SKIPLEN) +#define V_CSR0_SKIPLEN(x) _DD_MAKEVALUE(x,S_CSR0_SKIPLEN) +#define G_CSR0_SKIPLEN(x) _DD_GETVALUE(x,S_CSR0_SKIPLEN,M_CSR0_SKIPLEN) + +#define M_CSR0_BIGENDIAN _DD_MAKEMASK1(7) + +#define S_CSR0_BURSTLEN 8 +#define M_CSR0_BURSTLEN _DD_MAKEMASK(6,S_CSR0_BURSTLEN) +#define V_CSR0_BURSTLEN(x) _DD_MAKEVALUE(x,S_CSR0_BURSTLEN) +#define G_CSR0_BURSTLEN(x) _DD_GETVALUE(x,S_CSR0_BURSTLEN,M_CSR0_BURSTLEN) + +#define S_CSR0_CACHEALIGN 14 +#define M_CSR0_CACHEALIGN _DD_MAKEMASK(2,S_CSR0_CACHEALIGN) +#define V_CSR0_CACHEALIGN(x) _DD_MAKEVALUE(x,S_CSR0_CACHEALIGN) +#define G_CSR0_CACHEALIGN(x) _DD_GETVALUE(x,S_CSR0_CACHEALIGN,M_CSR0_CACHEALIGN) + +#define S_CSR0_TXAUTOPOLL 17 +#define M_CSR0_TXAUTOPOLL _DD_MAKEMASK(3,S_CSR0_AUTOPOLL) +#define V_CSR0_TXAUTOPOLL(x) _DD_MAKEVALUE(x,S_CSR0_TXAUTOPOLL) +#define G_CSR0_TXAUTOPOLL(x) _DD_GETVALUE(x,S_CSR0_TXAUTOPOLL,M_CSR0_TXAUTOPOLL) + +#define M_CSR0_DESCBYTEORDER _DD_MAKEMASK1(20) /* not 21040 */ +#define M_CSR0_READMULTENAB _DD_MAKEMASK1(21) /* not 2104{0,1} */ +#define M_CSR0_READLINEENAB _DD_MAKEMASK1(23) /* not 2104{0,1} */ +#define M_CSR0_WRITEINVALENAB _DD_MAKEMASK1(24) /* not 2104{0,1} */ + +#define K_CSR0_TAPDISABLED 0x00 +#define K_CSR0_TAP200US 0x01 +#define K_CSR0_TAP800US 0x02 +#define K_CSR0_TAP1600US 0x03 + +#define K_CSR0_ALIGNNONE 0 +#define K_CSR0_ALIGN32 1 +#define K_CSR0_ALIGN64 2 +#define K_CSR0_ALIGN128 3 + +#define K_CSR0_BURST32 32 +#define K_CSR0_BURST16 16 +#define K_CSR0_BURST8 8 +#define K_CSR0_BURST4 4 +#define K_CSR0_BURST2 2 +#define K_CSR0_BURST1 1 + + +#define M_CSR3_RXDSCRADDR 0xFFFFFFFC +#define M_CSR4_TXDSCRADDR 0xFFFFFFFC + + +/* CSR5: Status register */ + +#define M_CSR5_TXINT _DD_MAKEMASK1(0) +#define M_CSR5_TXSTOP _DD_MAKEMASK1(1) +#define M_CSR5_TXBUFUNAVAIL _DD_MAKEMASK1(2) +#define M_CSR5_TXJABTIMEOUT _DD_MAKEMASK1(3) +#define M_CSR5_LINKPASS _DD_MAKEMASK1(4) /* not 21040 */ +#define M_CSR5_TXUNDERFLOW _DD_MAKEMASK1(5) +#define M_CSR5_RXINT _DD_MAKEMASK1(6) +#define M_CSR5_RXBUFUNAVAIL _DD_MAKEMASK1(7) +#define M_CSR5_RXSTOPPED _DD_MAKEMASK1(8) +#define M_CSR5_RXWDOGTIMEOUT _DD_MAKEMASK1(9) +#define M_CSR5_AUITPPIN _DD_MAKEMASK1(10) /* 21040 only */ +#define M_CSR5_TXEARLYINT _DD_MAKEMASK1(10) /* not 2104{0,1} */ +#define M_CSR5_FDSHORTFRAME _DD_MAKEMASK1(11) /* 21040 only */ +#define M_CSR5_GPTIMEREXPIRE _DD_MAKEMASK1(11) /* not 21040 */ +#define M_CSR5_LINKFAIL _DD_MAKEMASK1(12) +#define M_CSR5_FATALBUSERROR _DD_MAKEMASK1(13) +#define M_CSR5_RXEARLYINT _DD_MAKEMASK1(14) /* not 21040 */ +#define M_CSR5_ABNORMALINT _DD_MAKEMASK1(15) +#define M_CSR5_NORMALINT _DD_MAKEMASK1(16) + +#define S_CSR5_RXPROCSTATE 17 +#define M_CSR5_RXPROCSTATE _DD_MAKEMASK(3,S_CSR5_RXPROCSTATE) +#define V_CSR5_RXPROCSTATE(x) _DD_MAKEVALUE(x,S_CSR5_RXPROCSTATE) +#define G_CSR5_RXPROCSTATE(x) _DD_GETVALUE(x,S_CSR5_RXPROCSTATE,M_CSR5_RXPROCSTATE) + +#define K_CSR5_RXSTOPPED 0x00 /* RESET or STOP command */ +#define K_CSR5_RXFETCH 0x01 /* fetching rx desc */ +#define K_CSR5_RXCHECK 0x02 /* checking end of rx pkt */ +#define K_CSR5_RXWAIT 0x03 /* waiting for rx pkt */ +#define K_CSR5_RXSUSPEND 0x04 /* unavailable rx buffer */ +#define K_CSR5_RXCLOSE 0x05 /* closing rx desc */ +#define K_CSR5_RXFLUSH 0x06 /* flushing rx frame */ +#define K_CSR5_RXQUEUE 0x07 /* reading rx frame from FIFO */ + +#define S_CSR5_TXPROCSTATE 20 +#define M_CSR5_TXPROCSTATE _DD_MAKEMASK(3,S_CSR5_TXPROCSTATE) +#define V_CSR5_TXPROCSTATE(x) _DD_MAKEVALUE(x,S_CSR5_TXPROCSTATE) +#define G_CSR5_TXPROCSTATE(x) _DD_GETVALUE(x,S_CSR5_TXPROCSTATE,M_CSR5_TXPROCSTATE) + +#define K_CSR5_TXSTOPPED 0x00 /* RESET or STOP command */ +#define K_CSR5_TXFETCH 0x01 /* fetching tx desc */ +#define K_CSR5_TXWAIT 0x02 /* waiting for end of tx */ +#define K_CSR5_TXREAD 0x03 /* reading buffer into FIFO */ +#define K_CSR5_TXSETUP 0x05 /* setup packet */ +#define K_CSR5_TXSUSPEND 0x06 /* tx underflow or no tx desc */ +#define K_CSR5_TXCLOSE 0x07 /* closing tx desc */ + +#define S_CSR5_ERRORBITS 23 +#define M_CSR5_ERRORBITS _DD_MAKEMASK(3,S_CSR5_ERRORBITS) +#define V_CSR5_ERRORBITS(x) _DD_MAKEVALUE(x,S_CSR5_ERRORBITS) +#define G_CSR5_ERRORBITS(x) _DD_GETVALUE(x,S_CSR5_ERRORBITS,M_CSR5_ERRORBITS) + +#define K_CSR5_FBE_PARITY 0x00 +#define K_CSR5_FBE_MABORT 0x01 +#define K_CSR5_FBE_TABORT 0x02 + +#define M_CSR5_GPPORTINT _DD_MAKEMASK1(26) /* not 2104{0,1} */ +#define M_CSR5_LINKCHANGED _DD_MAKEMASK1(27) /* not 2104{0,1} */ + + +/* CSR6: Operating Mode register */ + +#define M_CSR6_RXHASHFILT _DD_MAKEMASK1(0) +#define M_CSR6_RXSTART _DD_MAKEMASK1(1) +#define M_CSR6_HASHONLY _DD_MAKEMASK1(2) +#define M_CSR6_PASSBADFRAMES _DD_MAKEMASK1(3) +#define M_CSR6_INVERSEFILT _DD_MAKEMASK1(4) +#define M_CSR6_STOPBACKOFF _DD_MAKEMASK1(5) +#define M_CSR6_PROMISCUOUS _DD_MAKEMASK1(6) +#define M_CSR6_PASSALLMULTI _DD_MAKEMASK1(7) +#define M_CSR6_FULLDUPLEX _DD_MAKEMASK1(9) + +#define M_CSR6_INTLOOPBACK _DD_MAKEMASK1(10) +#define M_CSR6_EXTLOOPBACK _DD_MAKEMASK1(11) + +#define S_CSR6_OPMODE 10 +#define M_CSR6_OPMODE _DD_MAKEMASK(2,S_CSR6_OPMODE) +#define V_CSR6_OPMODE(x) _DD_MAKEVALUE(x,S_CSR6_OPMODE) +#define G_CSR6_OPMODE(x) _DD_GETVALUE(x,S_CSR6_OPMODE,M_CSR6_OPMODE) + +#define M_CSR6_FORCECOLL _DD_MAKEMASK1(12) +#define M_CSR6_TXSTART _DD_MAKEMASK1(13) + +#define S_CSR6_THRESHCONTROL 14 +#define M_CSR6_THRESHCONTROL _DD_MAKEMASK(2,S_CSR6_THRESHCONTROL) +#define V_CSR6_THRESHCONTROL(x) _DD_MAKEVALUE(x,S_CSR6_THRESHCONTROL) +#define G_CSR6_THRESHCONTROL(x) _DD_GETVALUE(x,S_CSR6_THRESHCONTROL,M_CSR6_THRESHCONTROL) + +#define M_CSR6_BACKPRESSURE _DD_MAKEMASK1(16) /* 21040 only */ +#define M_CSR6_CAPTUREEFFECT _DD_MAKEMASK1(17) + +#define M_CSR6_PORTSEL _DD_MAKEMASK1(18) /* not 2104{0,1} */ +#define M_CSR6_HBDISABLE _DD_MAKEMASK1(19) /* not 2104{0,1} */ +#define M_CSR6_STOREFWD _DD_MAKEMASK1(21) /* not 2104{0,1} */ +#define M_CSR6_TXTHRESH _DD_MAKEMASK1(22) /* not 2104{0,1} */ +#define M_CSR6_PCSFUNC _DD_MAKEMASK1(23) /* not 2104{0,1} */ +#define M_CSR6_SCRAMMODE _DD_MAKEMASK1(24) /* not 2104{0,1} */ +#define M_CSR6_MBO _DD_MAKEMASK1(25) /* not 2104{0,1} */ +#define M_CSR6_RXALL _DD_MAKEMASK1(30) /* not 2104{0,1} */ + +#define M_CSR6_SPECCAP _DD_MAKEMASK1(31) /* not 21040 */ + +#define K_CSR6_TXTHRES_128_72 0x00 +#define K_CSR6_TXTHRES_256_96 0x01 +#define K_CSR6_TXTHRES_512_128 0x02 +#define K_CSR6_TXTHRES_1024_160 0x03 + + +#define M_CSR6_SPEED_10 (M_CSR6_TXTHRESH) + +#define M_CSR6_SPEED_100 (M_CSR6_HBDISABLE | \ + M_CSR6_SCRAMMODE | \ + M_CSR6_PCSFUNC | \ + M_CSR6_PORTSEL) + +#define M_CSR6_SPEED_10_MII (M_CSR6_TXTHRESH | \ + M_CSR6_PORTSEL) + +#define M_CSR6_SPEED_100_MII (M_CSR6_HBDISABLE | \ + M_CSR6_PORTSEL) + + +/* CSR7: Interrupt mask register */ + +#define M_CSR7_TXINT _DD_MAKEMASK1(0) +#define M_CSR7_TXSTOP _DD_MAKEMASK1(1) +#define M_CSR7_TXBUFUNAVAIL _DD_MAKEMASK1(2) +#define M_CSR7_TXJABTIMEOUT _DD_MAKEMASK1(3) +#define M_CSR7_LINKPASS _DD_MAKEMASK1(4) /* not 21040 */ +#define M_CSR7_TXUNDERFLOW _DD_MAKEMASK1(5) +#define M_CSR7_RXINT _DD_MAKEMASK1(6) +#define M_CSR7_RXBUFUNAVAIL _DD_MAKEMASK1(7) +#define M_CSR7_RXSTOPPED _DD_MAKEMASK1(8) +#define M_CSR7_RXWDOGTIMEOUT _DD_MAKEMASK1(9) +#define M_CSR7_AUITPSW _DD_MAKEMASK1(10) /* 21040 only */ +#define M_CSR7_TXEARLY _DD_MAKEMASK1(10) /* not 2104{0,1} */ +#define M_CSR7_FD _DD_MAKEMASK1(11) /* 21040 only */ +#define M_CSR7_GPTIMER _DD_MAKEMASK1(11) /* not 21040 */ +#define M_CSR7_LINKFAIL _DD_MAKEMASK1(12) +#define M_CSR7_FATALBUSERROR _DD_MAKEMASK1(13) +#define M_CSR7_RXEARLY _DD_MAKEMASK1(14) /* not 21040 */ +#define M_CSR7_ABNORMALINT _DD_MAKEMASK1(15) +#define M_CSR7_NORMALINT _DD_MAKEMASK1(16) +#define M_CSR7_GPPORT _DD_MAKEMASK1(26) /* not 2104{0,1} */ +#define M_CSR7_LINKCHANGED _DD_MAKEMASK1(27) /* not 2104{0,1} */ + + +/* CSR8: Missed Frame register */ + +#define M_CSR8_RXOVER_WRAP _DD_MAKEMASK1(28) /* not 2104{0,1} */ +#define S_CSR8_RXOVER 17 +#define M_CSR8_RXOVER _DD_MAKEMASK(11,S_CSR8_RXOVER) /* not 2104{0,1} */ +#define V_CSR8_RXOVER(x) _DD_MAKEVALUE(x,S_CSR8_RXOVER) +#define G_CSR8_RXOVER(x) _DD_GETVALUE(x,S_CSR8_RXOVER,M_CSR8_RXOVER) + +#define M_CSR8_MISSEDWRAP _DD_MAKEMASK1(16) +#define S_CSR8_MISSED 0 +#define M_CSR8_MISSED _DD_MAKEMASK(16,S_CSR8_MISSED) +#define V_CSR8_MISSED(x) _DD_MAKEVALUE(x,S_CSR8_MISSED) +#define G_CSR8_MISSED(x) _DD_GETVALUE(x,S_CSR8_MISSED,M_CSR8_MISSED) + + +/* CSR9: ROM and MII register */ + +#define S_CSR9_ROMDATA 0 +#define M_CSR9_ROMDATA _DD_MAKEMASK(8,S_CSR9_ROMDATA) +#define V_CSR9_ROMDATA(x) _DD_MAKEVALUE(x,S_CSR9_ROMDATA) +#define G_CSR9_ROMDATA(x) _DD_GETVALUE(x,S_CSR9_ROMDATA,M_CSR9_ROMDATA) + +#define M_CSR9_SROMCHIPSEL _DD_MAKEMASK1(0) /* not 21040 */ +#define M_CSR9_SROMCLOCK _DD_MAKEMASK1(1) /* not 21040 */ +#define M_CSR9_SROMDATAIN _DD_MAKEMASK1(2) /* not 21040 */ +#define M_CSR9_SROMDATAOUT _DD_MAKEMASK1(3) /* not 21040 */ + +#define M_CSR9_REGSELECT _DD_MAKEMASK1(10) /* not 21040 */ +#define M_CSR9_SERROMSEL _DD_MAKEMASK1(11) /* not 21040 */ +#define M_CSR9_ROMSEL _DD_MAKEMASK1(12) /* not 21040 */ +#define M_CSR9_ROMWRITE _DD_MAKEMASK1(13) /* not 21040 */ +#define M_CSR9_ROMREAD _DD_MAKEMASK1(14) /* not 21040 */ +#define M_CSR9_MODESEL _DD_MAKEMASK1(15) /* 21041 only */ +#define M_CSR9_MDC _DD_MAKEMASK1(16) /* not 2104{0,1} */ +#define M_CSR9_MDO _DD_MAKEMASK1(17) /* not 2104{0,1} */ +#define M_CSR9_MIIMODE _DD_MAKEMASK1(18) /* not 2104{0,1} */ +#define M_CSR9_MDI _DD_MAKEMASK1(19) /* not 2104{0,1} */ + +#define M_CSR9_DATANOTVALID _DD_MAKEMASK1(31) /* 21040 only */ + +#define M_CSR10_BOOTROMADDR _DD_MAKEMASK(18,0) /* not 21040 */ + + +/* CSR11 General Purpose Timer register */ + +#define S_CSR11_GPTIMER 0 /* not 21040 */ +#define M_CSR11_GPTIMER _DD_MAKEMASK(16,S_CSR11_GPTIMER) +#define V_CSR11_GPTIMER(x) _DD_MAKEVALUE(x,S_CSR11_GPTIMER) +#define G_CSR11_GPTIMER(x) _DD_GETVALUE(x,S_CSR11_GPTIMER,M_CSR11_GPTIMER) + + +#define M_CSR11_GPTIMERCONT _DD_MAKEMASK1(16) /* not 21040 */ + +#define S_CSR11_FDAUTOCONF 0 /* 21040 only */ +#define M_CSR11_FDAUTOCONF _DD_MAKEMASK(16,S_CSR11_FDAUTOCONF) +#define V_CSR11_FDAUTOCONF(x) _DD_MAKEVALUE(x,S_CSR11_FDAUTOCONF) +#define G_CSR11_FRAUTOCONF(x) _DD_GETVALUE(x,S_CSR11_FDAUTOCONF,M_CSR11_AUTOCONF) + + +/* CSR12: SIA Status register (21143) */ + +#define M_CSR12_MIIRPA _DD_MAKEMASK1(0) +#define M_CSR12_100MBLINK _DD_MAKEMASK1(1) +#define M_CSR12_10MBLINK _DD_MAKEMASK1(2) +#define M_CSR12_AUTOPOLSTATE _DD_MAKEMASK1(3) + +#define M_CSR12_RXAUIACT _DD_MAKEMASK1(8) +#define M_CSR12_RX10BASETACT _DD_MAKEMASK1(9) +#define M_CSR12_NLPDETECT _DD_MAKEMASK1(10) +#define M_CSR12_TXREMFAULT _DD_MAKEMASK1(11) + +#define S_CSR12_AUTONEGARBIT 12 +#define M_CSR12_AUTONEGARBIT _DD_MAKEMASK(3,S_CSR12_AUTONEGARBIT) +#define V_CSR12_AUTONEGARBIT(x) _DD_MAKEVALUE(x,S_CSR12_AUTONEGARBIT) +#define G_CSR12_AUTONEGARBIT(x) _DD_GETVALUE(x,S_CSR12_AUTONEGARBIT,M_CSR12_AUTONEGARBIT) + +#define M_CSR12_LINKPARTNEG _DD_MAKEMASK1(15) + +#define S_CSR12_LINKPARTCODE 16 +#define M_CSR12_LINKPARTCODE _DD_MAKEMASK(16,S_CSR12_LINKPARTCODE) +#define V_CSR12_LINKPARTCODE(x) _DD_MAKEVALUE(x,S_CSR12_LINKPARTCODE) +#define G_CSR12_LINKPARTCODE(x) _DD_GETVALUE(x,S_CSR12_LINKPARTCODE,M_CSR12_LINKPARTCODE) + + +/* CSR12: SIA Status register (21041, also 31:12, 3:3 as for 21143) */ + +#define M_CSR12_NETCONNERR _DD_MAKEMASK1(1) +#define M_CSR12_LINKFAIL _DD_MAKEMASK1(2) +#define M_CSR12_SELPORTACT _DD_MAKEMASK1(8) +#define M_CSR12_NONSELPORTACT _DD_MAKEMASK1(9) +#define M_CSR12_AUTONEGRESTART _DD_MAKEMASK1(10) +#define M_CSR12_UNSTABLENLP _DD_MAKEMASK1(11) + + +/* CSR12: General Purpose Port register (21140) */ + +#define S_CSR12_DATA 0 +#define M_CSR12_DATA _DD_MAKEMASK(8,S_CSR12_DATA) +#define V_CSR12_DATA _DD_MAKEVALUE(x,S_CSR12_DATA,M_CSR12_DATA) +#define G_CSR12_DATA(x) _DD_GETVALUE(x,S_CSR12_DATA,M_CSR12_DATA) + +#define M_CSR12_CONTROL _DD_MAKEMASK1(8) + + +/* CSR13: SIA Mode 0 register (21143 and 21041) */ + +#define M_CSR13_CONN_NOT_RESET _DD_MAKEMASK1(0) +#define M_CSR13_CONN_CSR_AUTO _DD_MAKEMAKS1(2) /* 21041 only */ +#define M_CSR13_CONN_AUI_10BT _DD_MAKEMASK1(3) + + +/* CSR14: SIA Mode 1 register (21143 and 21041) */ + +#define M_CSR14_ENCODER _DD_MAKEMASK1(0) +#define M_CSR14_LOOPBACK _DD_MAKEMASK1(1) +#define M_CSR14_DRIVER _DD_MAKEMASK1(2) +#define M_CSR14_LINKPULSE _DD_MAKEMASK1(3) + +#define S_CSR14_COMPENSATE 4 +#define M_CSR14_COMPENSATE _DD_MAKEMASK(2,S_CSR14_COMPENSATE) +#define V_CSR15_COMPENSATE(x) _DD_MAKEVALUE(x,S_CSR15_COMPENSATE) +#define G_CSR15_COMPENSATE(x) _DD_GETVALUE(x,S_CSR15_COMPENSATE,M_CSR15_COMPENSATE) + +#define M_CSR14_HALFDUPLEX10BASET _DD_MAKEMASK1(6) +#define M_CSR14_AUTONEGOTIATE _DD_MAKEMASK1(7) +#define M_CSR14_RXSQUELCH _DD_MAKEMASK1(8) +#define M_CSR14_COLLSQUELCH _DD_MAKEMASK1(9) +#define M_CSR14_COLLDETECT _DD_MAKEMASK1(10) +#define M_CSR14_SIGQUALGEN _DD_MAKEMASK1(11) +#define M_CSR14_LINKTEST _DD_MAKEMASK1(12) +#define M_CSR14_AUTOPOLARITY _DD_MAKEMASK1(13) +#define M_CSR14_SETPOLARITY _DD_MAKEMASK1(14) +#define M_CSR14_10BASETAUIAUTO _DD_MAKEMASK1(15) +#define M_CSR14_100BASETHALFDUP _DD_MAKEMASK1(16) /* not 21041 */ +#define M_CSR14_100BASETFULLDUP _DD_MAKEMASK1(17) /* not 21041 */ +#define M_CSR14_100BASET4 _DD_MAKEMASK1(18) /* not 21041 */ + +#define M_CSR14_10BT_HD 0x7F3F +#define M_CSR14_10BT_FD 0x7F3D + + +/* CSR15: SIA Mode 2 register (21143 and 21041) */ + +#define M_CSR15_GP_JABBERDIS _DD_MAKEMASK1(0) /* 21041 only */ +#define M_CSR15_GP_HOSTUNJAB _DD_MAKEMASK1(1) +#define M_CSR15_GP_JABBERCLK _DD_MAKEMASK1(2) +#define M_CSR15_GP_AUIBNC _DD_MAKEMASK1(3) +#define M_CSR15_GP_RXWATCHDIS _DD_MAKEMASK1(4) +#define M_CSR15_GP_RXWATCHREL _DD_MAKEMASK1(5) + +/* (CSR15: 21143 only) */ + +#define S_CSR15_GP_GPDATA 16 +#define M_CSR15_GP_GPDATA _DD_MAKEMASK(4,S_CSR15_GP_GPDATA) +#define V_CSR15_GP_GPDATA(x) _DD_MAKEVALUE(x,S_CSR15_GP_GPDATA) +#define G_CSR15_GP_GPDATA(x) _DD_GETVALUE(x,S_CSR15_GP_GPDATA,M_CSR15_GP_GPDATA) + +#define M_CSR15_GP_LED0 _DD_MAKEMASK1(20) +#define M_CSR15_GP_LED1 _DD_MAKEMASK1(21) +#define M_CSR15_GP_LED2 _DD_MAKEMASK1(22) +#define M_CSR15_GP_LED3 _DD_MAKEMASK1(23) +#define M_CSR15_GP_INTPORT0 _DD_MAKEMASK1(24) +#define M_CSR15_GP_INTPORT1 _DD_MAKEMASK1(25) +#define M_CSR15_GP_RXMATCH _DD_MAKEMASK1(26) +#define M_CSR15_GP_CONTROLWRITE _DD_MAKEMASK1(27) +#define M_CSR15_GP_GPINT0 _DD_MAKEMASK1(28) +#define M_CSR15_GP_GPINT1 _DD_MAKEMASK1(29) +#define M_CSR15_GP_RXMATCHINT _DD_MAKEMASK1(30) + +#define M_CSR15_DEFAULT_VALUE 0x00050008 +#define M_CSR15_CONFIG_GEPS_LEDS 0x08af0000 + +/* (CSR15: 21041 only) */ + +#define M_CSR15_GP_LED1ENB _DD_MAKEMASK1(6) +#define M_CSR15_GP_LED1VALUE _DD_MAKEMASK1(7) +#define M_CSR15_GP_TSTCLK _DD_MAKEMASK1(8) +#define M_CSR15_GP_FORCEUNSQ _DD_MAKEMASK1(9) +#define M_CSR15_GP_FORCEFAIL _DD_MAKEMASK1(10) +#define M_CSR15_GP_LEDSTRDIS _DD_MAKEMASK1(11) +#define M_CSR15_GP_PLLTEST _DD_MAKEMASK1(12) +#define M_CSR15_GP_FORCERXLOW _DD_MAKEMASK1(13) +#define M_CSR15_GP_LED2ENB _DD_MAKEMASK1(14) +#define M_CSR15_GP_LED2VALUE _DD_MAKEMASK1(15) + + +/* CSR15: Watchdog Timer register (21140) */ + +#define M_CSR15_WT_JABBER _DD_MAKEMASK1(0) +#define M_CSR15_WT_HOSTUNJAB _DD_MAKEMASK1(1) +#define M_CSR15_WT_JABBERCLK _DD_MAKEMASK1(2) +#define M_CSR15_WT_RXWATCHDIS _DD_MAKEMASK1(4) +#define M_CSR15_WT_RXWATCHREL _DD_MAKEMASK1(5) + + +/* ********************************************************************* + * Receive Descriptors + ********************************************************************* */ + +#define M_RDES0_OWNSYS 0 +#define M_RDES0_OWNADAP _DD_MAKEMASK1(31) + +#define S_RDES0_FRAMELEN 16 +#define M_RDES0_FRAMELEN _DD_MAKEMASK(14,S_RDES0_FRAMELEN) +#define V_RDES0_FRAMELEN(x) _DD_MAKEVALUE(x,S_RDES0_FRAMELEN) +#define G_RDES0_FRAMELEN(x) _DD_GETVALUE(x,S_RDES0_FRAMELEN,M_RDES0_FRAMELEN) + +#define M_RDES0_ZERO _DD_MAKEMASK1(0) +#define M_RDES0_OVFL _DD_MAKEMAKS1(0) /* 21041 only */ +#define M_RDES0_CRCERR _DD_MAKEMASK1(1) +#define M_RDES0_DRIBBLE _DD_MAKEMASK1(2) +#define M_RDES0_MIIERROR _DD_MAKEMASK1(3) /* not 21041 */ +#define M_RDES0_WDOGTIMER _DD_MAKEMASK1(4) +#define M_RDES0_FRAMETYPE _DD_MAKEMASK1(5) +#define M_RDES0_COLLSEEN _DD_MAKEMASK1(6) +#define M_RDES0_FRAMETOOLONG _DD_MAKEMASK1(7) +#define M_RDES0_LASTDES _DD_MAKEMASK1(8) +#define M_RDES0_FIRSTDES _DD_MAKEMASK1(9) +#define M_RDES0_MCASTFRAME _DD_MAKEMASK1(10) +#define M_RDES0_RUNTFRAME _DD_MAKEMASK1(11) + +#define S_RDES0_DATATYPE 12 +#define M_RDES0_DATATYPE _DD_MAKEMASK(2,S_RDES0_DATATYPE) +#define V_RDES0_DATATYPE(x) _DD_MAKEVALUE(x,S_RDES0_DATATYPE) +#define G_RDES0_DATATYPE(x) _DD_GETVALUE(x,S_RDES0_DATATYPE,M_RDES0_DATATYPE) + +#define M_RDES0_ERROR _DD_MAKEMASK1(14) +#define M_RDES0_ERRORSUM _DD_MAKEMASK1(15) +#define M_RDES0_FILTFAIL _DD_MAKEMASK1(30) /* not 21041 */ + +#define S_RDES1_BUF1SIZE 0 +#define M_RDES1_BUF1SIZE _DD_MAKEMASK(11,S_TDES1_BUF1SIZE) +#define V_RDES1_BUF1SIZE(x) _DD_MAKEVALUE(x,S_RDES1_BUF1SIZE) +#define G_RDES1_BUF1SIZE(x) _DD_GETVALUE(x,S_RDES1_BUF1SIZE,M_RDES1_BUF1SIZE) + +#define S_RDES1_BUF2SIZE 11 +#define M_RDES1_BUF2SIZE _DD_MAKEMASK(11,S_TDES2_BUF2SIZE) +#define V_RDES1_BUF2SIZE(x) _DD_MAKEVALUE(x,S_RDES1_BUF2SIZE) +#define G_RDES1_BUF2SIZE(x) _DD_GETVALUE(x,S_RDES1_BUF2SIZE,M_RDES1_BUF2SIZE) + +#define M_RDES1_CHAINED _DD_MAKEMASK1(24) +#define M_RDES1_ENDOFRING _DD_MAKEMASK1(25) + +#define M_RDES2_BUFADDR 0xFFFFFFFF +#define M_RDES3_BUFADDR 0xFFFFFFFF + +/* ********************************************************************* + * Transmit Descriptors + ********************************************************************* */ + +#define M_TDES0_OWNSYS 0 +#define M_TDES0_OWNADAP _DD_MAKEMASK1(31) + +#define M_TDES0_DEFERRED _DD_MAKEMASK1(0) +#define M_TDES0_UNDERFLOW _DD_MAKEMASK1(1) +#define M_TDES0_LINK_FAIL _DD_MAKEMASK1(2) + +#define S_TDES0_COLLCOUNT 3 +#define M_TDES0_COLLCOUNT _DD_MAKEMASK(4,S_TDES0_COLLCOUNT) +#define V_TDES0_COLLCOUNT(x) _DD_MAKEVALUE(x,S_TDES0_COLLCOUNT) +#define G_TDES0_COLLCOUNT(x) _DD_GETVALUE(x,S_TDES0_COLLCOUNT,M_TDES0_COLLCOUNT) + +#define M_TDES0_HEARTBEAT_FAIL _DD_MAKEMASK1(7) +#define M_TDES0_EXCESSIVE_COLLISIONS _DD_MAKEMASK1(8) +#define M_TDES0_LATE_COLLISION _DD_MAKEMASK1(9) +#define M_TDES0_NO_CARRIER _DD_MAKEMASK1(10) +#define M_TDES0_LOSS_OF_CARRIER _DD_MAKEMASK1(11) +#define M_TDES0_TX_JABBER_TIMEOUT _DD_MAKEMASK1(14) +#define M_TDES0_ERROR_SUMMARY _DD_MAKEMASK1(15) +#define M_TDES0_OWN_BIT _DD_MAKEMASK1(31) + +#define S_TDES1_BUF1SIZE 0 +#define M_TDES1_BUF1SIZE _DD_MAKEMASK(11,S_TDES1_BUF1SIZE) +#define V_TDES1_BUF1SIZE(x) _DD_MAKEVALUE(x,S_TDES1_BUF1SIZE) +#define G_TDES1_BUF1SIZE(x) _DD_GETVALUE(x,S_TDES1_BUF1SIZE,M_TDES1_BUF1SIZE) + +#define S_TDES1_BUF2SIZE 11 +#define M_TDES1_BUF2SIZE _DD_MAKEMASK(11,S_TDES2_BUF2SIZE) +#define V_TDES1_BUF2SIZE(x) _DD_MAKEVALUE(x,S_TDES1_BUF2SIZE) +#define G_TDES1_BUF2SIZE(x) _DD_GETVALUE(x,S_TDES1_BUF2SIZE,M_TDES1_BUF2SIZE) + +#define M_TDES1_FT0 _DD_MAKEMASK1(22) +#define M_TDES1_NOPADDING _DD_MAKEMASK1(23) +#define M_TDES1_CHAINED _DD_MAKEMASK1(24) +#define M_TDES1_ENDOFRING _DD_MAKEMASK1(25) +#define M_TDES1_NOADDCRC _DD_MAKEMASK1(26) +#define M_TDES1_SETUP _DD_MAKEMASK1(27) +#define M_TDES1_FT1 _DD_MAKEMASK1(28) +#define M_TDES1_FIRSTSEG _DD_MAKEMASK1(29) +#define M_TDES1_LASTSEG _DD_MAKEMASK1(30) +#define M_TDES1_INTERRUPT _DD_MAKEMASK1(31) + +#define M_TDES2_BUFADDR 0xFFFFFFFF +#define M_TDES3_BUFADDR 0xFFFFFFFF + + +/* CAM */ + +#define CAM_HASH_THRESHOLD 14 +#define CAM_PERFECT_ENTRIES 16 + +#define CAM_SETUP_BUFFER_SIZE 192 + +#endif /* _DC21143_H_ */ diff --git a/cfe/cfe/dev/dev_atapi.c b/cfe/cfe/dev/dev_atapi.c new file mode 100644 index 0000000..b5f4d9a --- /dev/null +++ b/cfe/cfe/dev/dev_atapi.c @@ -0,0 +1,222 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * ATAPI device driver File: dev_atapi.c + * + * This is a simple driver for ATAPI devices. The disks + * are expected to be connected to the generic bus (this + * driver doesn't support PCI). + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_timer.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" + +#include "dev_ide_common.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define GETWORD_LE(buf,wordidx) (((unsigned int) (buf)[(wordidx)*2]) + \ + (((unsigned int) (buf)[(wordidx)*2+1]) << 8)) + + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + +extern void _wbflush(void); +static void atapidrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +const static cfe_devdisp_t atapidrv_dispatch = { + idecommon_open, + idecommon_read, + idecommon_inpstat, + idecommon_write, + idecommon_ioctl, + idecommon_close, + NULL, + NULL +}; + +const cfe_driver_t atapidrv = { + "ATAPI device", + "atapi", + CFE_DEV_DISK, + &atapidrv_dispatch, + atapidrv_probe +}; + + + +/* ********************************************************************* + * Port I/O routines + * + * These routines are called back from the common code to do + * I/O cycles to the IDE disk. We provide routines for + * reading and writing bytes, words, and strings of words. + ********************************************************************* */ + +static uint8_t atapidrv_inb(idecommon_dispatch_t *disp,uint32_t reg) +{ + return *((volatile uint8_t *) PHYS_TO_K1(reg+disp->baseaddr)); +} + +static uint16_t atapidrv_inw(idecommon_dispatch_t *disp,uint32_t reg) +{ + return *((volatile uint16_t *) PHYS_TO_K1((reg+disp->baseaddr))); +} + +static void atapidrv_ins(idecommon_dispatch_t *disp,uint32_t reg,uint8_t *buf,int len) +{ + uint16_t data; + + while (len > 0) { + data = *((volatile uint16_t *) PHYS_TO_K1(reg+disp->baseaddr)); + +#ifdef _BYTESWAP_ + *buf++ = (data >> 8) & 0xFF; + *buf++ = (data & 0xFF); +#else + *buf++ = (data & 0xFF); + *buf++ = (data >> 8) & 0xFF; +#endif + len--; + len--; + } + +} + +static void atapidrv_outb(idecommon_dispatch_t *disp,uint32_t reg,uint8_t val) +{ + *((volatile uint8_t *) PHYS_TO_K1(reg+disp->baseaddr)) = val; + _wbflush(); +} + +static void atapidrv_outw(idecommon_dispatch_t *disp,uint32_t reg,uint16_t val) +{ + *((volatile uint16_t *) PHYS_TO_K1(reg+disp->baseaddr)) = val; + _wbflush(); +} + +static void atapidrv_outs(idecommon_dispatch_t *disp,uint32_t reg,uint8_t *buf,int len) +{ + uint16_t data; + + while (len > 0) { +#ifdef _BYTESWAP_ + data = (uint16_t) buf[1] + ((uint16_t) buf[0] << 8); +#else + data = (uint16_t) buf[0] + ((uint16_t) buf[1] << 8); +#endif + + *((volatile uint16_t *) PHYS_TO_K1(reg+disp->baseaddr)) = data; + _wbflush(); + + buf++; + buf++; + len--; + len--; + } +} + + + +static void atapidrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + idecommon_t *softc; + idecommon_dispatch_t *disp; + char descr[80]; + char unitstr[50]; + int res; + + /* + * probe_a is the IDE base address + * probe_b is the unit number and other flags + * probe_ptr is unused. + */ + + softc = (idecommon_t *) KMALLOC(sizeof(idecommon_t),0); + disp = (idecommon_dispatch_t *) KMALLOC(sizeof(idecommon_dispatch_t),0); + + if (softc && disp) { + softc->idecommon_addr = probe_a; + softc->idecommon_unit = probe_b; + + disp->ref = softc; + disp->baseaddr = softc->idecommon_addr; + softc->idecommon_dispatch = disp; + + disp->outb = atapidrv_outb; + disp->outw = atapidrv_outw; + disp->outs = atapidrv_outs; + + disp->inb = atapidrv_inb; + disp->inw = atapidrv_inw; + disp->ins = atapidrv_ins; + + res = idecommon_devprobe(softc); + if (res < 0) { + KFREE(softc); + KFREE(disp); + return; + } + + xsprintf(descr,"%s unit %d at %08X",drv->drv_description,probe_b,probe_a); + xsprintf(unitstr,"%d",probe_b); + cfe_attach(drv,softc,unitstr,descr); + } +} + + diff --git a/cfe/cfe/dev/dev_bcm1250.c b/cfe/cfe/dev/dev_bcm1250.c new file mode 100644 index 0000000..8343a46 --- /dev/null +++ b/cfe/cfe/dev/dev_bcm1250.c @@ -0,0 +1,275 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * BCM1250 (BCM1250 as PCI device) driver File: dev_bcm1250.c + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" + +#ifndef _SB_MAKE64 +#define _SB_MAKE64(x) ((uint64_t)(x)) +#endif +#ifndef _SB_MAKEMASK1 +#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n)) +#endif + +#include "lib_types.h" +#include "lib_hssubr.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_error.h" +#include "cfe_device.h" + +#include "pcivar.h" +#include "pcireg.h" + +#include "bsp_config.h" + +/* Note that PHYSADDR only works with 32-bit addresses */ +#define PHYSADDR(x) (K0_TO_PHYS((uint32_t)(uintptr_t)(x))) + + +static void bcm1250_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +static int bcm1250_open(cfe_devctx_t *ctx); +static int bcm1250_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm1250_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int bcm1250_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm1250_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm1250_close(cfe_devctx_t *ctx); + +const static cfe_devdisp_t bcm1250_dispatch = { + bcm1250_open, + bcm1250_read, + bcm1250_inpstat, + bcm1250_write, + bcm1250_ioctl, + bcm1250_close, + NULL, + NULL +}; + +const cfe_driver_t bcm1250drv = { + "BCM1250", + "widget", + CFE_DEV_OTHER, + &bcm1250_dispatch, + bcm1250_probe +}; + + +typedef struct bcm1250_s { + uint64_t mailbox; + uint64_t mem_base; + uint8_t irq; /* interrupt mapping */ + pcitag_t tag; /* tag for configuration register */ + + int downloaded; /* code has already been downloaded. */ +} bcm1250_t; + + +/* + * BCM1250_PROBE + * probe_a, probe_b and probe_ptr all unused + */ + +static void +bcm1250_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + int index; + + index = 0; + for (;;) { + pcitag_t tag; + + if (pci_find_device(0x166d, 0x0001, index, &tag) != 0) + break; + + if (tag != 0x00000000) { /* don't configure ourselves */ + bcm1250_t *softc; + char descr[80]; + phys_addr_t pa; + + softc = (bcm1250_t *) KMALLOC(sizeof(bcm1250_t), 0); + if (softc == NULL) { + xprintf("BCM1250: No memory to complete probe\n"); + break; + } + + softc->tag = tag; + + pci_map_mem(tag, PCI_MAPREG(0), PCI_MATCH_BYTES, &pa); + xsprintf(descr, "%s at 0x%X", drv->drv_description, (uint32_t)pa); + softc->mem_base = PHYS_TO_XKSEG_UNCACHED(pa); + + /* Map the CPU0 mailbox registers of the device 1250. + Note that our BAR2 space maps to its "alias" mailbox + registers. Set bit 3 for mbox_set; clear bit 3 for + reading. Address bits 15-4 are don't cares. */ + pci_map_mem(tag, PCI_MAPREG(2), PCI_MATCH_BYTES, &pa); + softc->mailbox = PHYS_TO_XKSEG_UNCACHED(pa); + + softc->downloaded = 0; + + cfe_attach(drv, softc, NULL, descr); + } + index++; + } +} + + +#include "elf.h" + +static int +elf_header (const uint8_t *hdr) +{ + return (hdr[EI_MAG0] == ELFMAG0 && + hdr[EI_MAG1] == ELFMAG1 && + hdr[EI_MAG2] == ELFMAG2 && + hdr[EI_MAG3] == ELFMAG3); +} + + +#include "cfe_timer.h" + +typedef struct { + uint32_t addr; /* source address, in device's PCI space */ + uint32_t len; /* length of this chunk */ +} chunk_desc; + + +#define MBOX_SET_BIT 0x8 + +extern void download_start(void), download_end(void); + +static int +bcm1250_open(cfe_devctx_t *ctx) +{ + bcm1250_t *softc = ctx->dev_softc; + uint64_t cmd_p = softc->mailbox + 4; + + if (softc->downloaded) { + xprintf("bcm1250_open: Warning: Device previously downloaded\n"); + softc->downloaded = 0; + } + + if (hs_read32(cmd_p) != 0) { + xprintf("bcm1250_open: Device not in initial state\n"); + return -1; + } + + return 0; +} + +static int +bcm1250_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + return -1; +} + +static int +bcm1250_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + return -1; +} + +static int +bcm1250_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + bcm1250_t *softc = ctx->dev_softc; + uint64_t arg_p = softc->mailbox + 0; + uint64_t cmd_p = softc->mailbox + 4; + chunk_desc code; + uint32_t cmd; + int64_t timer; + int res; + + /* Note: This code assumes that PHYSADDR gives a PCI memory space + address that is accessible via our BAR4 or BAR5 */ + + code.addr = PHYSADDR((uint8_t *)buffer->buf_ptr); + code.len = buffer->buf_length; + + cmd = 0x1; /* load */ + if (!elf_header((uint8_t *)buffer->buf_ptr)) { + /* No recognizable elf seal, so assume compressed. */ + cmd |= 0x2; + } + + hs_write32(arg_p | MBOX_SET_BIT, PHYSADDR(&code)); + hs_write32(cmd_p | MBOX_SET_BIT, cmd); /* load */ + + /* Wait for handshake */ + + res = CFE_ERR_TIMEOUT; + TIMER_SET(timer, 5*CFE_HZ); + while (!TIMER_EXPIRED(timer)) { + if ((hs_read32(cmd_p) & 0x3) == 0) { + softc->downloaded = 1; + buffer->buf_retlen = 0; /* XXX check this */ + /* Note that the result code need not be translated only + because we are assuming a CFE in the device that is + compatible with us. */ + res = (int)hs_read32(arg_p); + break; + } + POLL(); + } + + return res; +} + +static int +bcm1250_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + return -1; +} + +static int +bcm1250_close(cfe_devctx_t *ctx) +{ + return 0; +} diff --git a/cfe/cfe/dev/dev_bcm5700.c b/cfe/cfe/dev/dev_bcm5700.c new file mode 100644 index 0000000..a7bef89 --- /dev/null +++ b/cfe/cfe/dev/dev_bcm5700.c @@ -0,0 +1,2557 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * BCM5700/Tigon3 (10/100/1000 EthernetMAC) driver File: dev_bcm5700.c + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "sbmips.h" + +#ifndef _SB_MAKE64 +#define _SB_MAKE64(x) ((uint64_t)(x)) +#endif +#ifndef _SB_MAKEMASK1 +#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n)) +#endif + +#include "lib_types.h" +#include "lib_hssubr.h" +#include "lib_malloc.h" +#include "lib_string.h" +#define blockcopy memcpy +#include "lib_printf.h" +#include "lib_queue.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_error.h" +#include "cfe_irq.h" + +#include "pcivar.h" +#include "pcireg.h" + +#include "bcm5700.h" +#include "mii.h" + +/* This is a driver for the Broadcom 570x ("Tigon 3") 10/100/1000 MAC. + Currently, only the 5700, 5701 and 5705 have been tested. The 5704 + dual MAC is not supported, nor is any device with a SerDes PHY. + + Reference: + Host Programmer Interface Specification for the BCM570X Family + of Highly-Integrated Media Access Controllers, 570X-PG106-R. + Broadcom Corp., 16215 Alton Parkway, Irvine CA, 09/27/02 + + This BCM1250 version takes advantage of DMA coherence and uses + "preserve bit lanes" addresses for all accesses that cross the + ZBbus-PCI bridge. + + Note that the 5705 does not fully map all address ranges. Per + the manual, reads and writes of the unmapped regions are permitted + and do not fault; however, it apparently has some poisoned registers, + at least in early revs, that should not be touched. See the + conditionals in the code. */ + +/* PIOSWAP controls whether word-swapping takes place for transactions + in which the 570x is the target device. In theory, either value + should work (with access macros adjusted as below) and it should be + set to be consistent with the settings for 570x as initiator. + Empirically, however, some combinations work with the bit clear: + + SWAP=0 SWAP=1 + 5700 32 PCI OK OK + 5700 64 Sturgeon OK OK + 5701-32 32 PCI OK OK + 5701-32 64 Sturgeon OK OK + 5701-32 64 Golem OK OK + 5701-64 64 Sturgeon OK OK + 5701-64 64 Golem OK FAIL + 5705 32 PCI OK OK + 5705 64 Sturgeon (OK)* FAIL + 5705 64 Golem OK OK + + * PCI status/interrupt ordering problem under load. */ + +#define PIOSWAP 0 + +#ifndef T3_DEBUG +#define T3_DEBUG 0 +#endif + +#ifndef T3_BRINGUP +#define T3_BRINGUP 0 +#endif + +/* Broadcom recommends using PHY interrupts instead of autopolling, + but I haven't made it work yet. */ +#define T3_AUTOPOLL 1 + +/* Set IPOLL to drive processing through the pseudo-interrupt + dispatcher. Set XPOLL to drive processing by an external polling + agent. One must be set; setting both is ok. */ + +#ifndef IPOLL +#define IPOLL 0 +#endif +#ifndef XPOLL +#define XPOLL 1 +#endif + +#define ENET_ADDR_LEN 6 /* size of an ethernet address */ +#define MIN_ETHER_PACK 64 /* min size of a packet */ +#define MAX_ETHER_PACK 1518 /* max size of a packet */ +#define VLAN_TAG_LEN 4 /* VLAN type plus tag */ +#define CRC_SIZE 4 /* size of CRC field */ + +/* Packet buffers. For the Tigon 3, packet buffer alignment is + arbitrary and can be to any byte boundary. We would like it + aligned to a cache line boundary for performance, although there is + a trade-off with IP/TCP header alignment. */ + +#define ETH_PKTBUF_LEN (((MAX_ETHER_PACK+31)/32)*32) + +#if __long64 +typedef struct eth_pkt_s { + queue_t next; /* 16 */ + uint8_t *buffer; /* 8 */ + uint32_t flags; /* 4 */ + int32_t length; /* 4 */ + uint8_t data[ETH_PKTBUF_LEN]; +} eth_pkt_t; +#else +typedef struct eth_pkt_s { + queue_t next; /* 8 */ + uint8_t *buffer; /* 4 */ + uint32_t flags; /* 4 */ + int32_t length; /* 4 */ + uint32_t unused[3]; /* 12 */ + uint8_t data[ETH_PKTBUF_LEN]; +} eth_pkt_t; +#endif + +#define CACHE_ALIGN 32 +#define ETH_PKTBUF_LINES ((sizeof(eth_pkt_t) + (CACHE_ALIGN-1))/CACHE_ALIGN) +#define ETH_PKTBUF_SIZE (ETH_PKTBUF_LINES*CACHE_ALIGN) +#define ETH_PKTBUF_OFFSET (offsetof(eth_pkt_t, data)) + +#define ETH_PKT_BASE(data) ((eth_pkt_t *)((data) - ETH_PKTBUF_OFFSET)) + +static void +show_packet(char c, eth_pkt_t *pkt) +{ + int i; + int n = (pkt->length < 32 ? pkt->length : 32); + + xprintf("%c[%4d]:", c, pkt->length); + for (i = 0; i < n; i++) { + if (i % 4 == 0) + xprintf(" "); + xprintf("%02x", pkt->buffer[i]); + } + xprintf("\n"); +} + + +static void t3_ether_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +/* BCM570X Hardware Common Data Structures + XXX These work for 1250 big endian. Need endian testing. + XXX Should they move to the header file? */ + +/* Chip documentation numbers the rings with 1-origin. */ + +#define RI(n) ((n)-1) + +/* BCM570x Ring Sizes (no external memory). Pages 97-98 */ + +#define TXP_MAX_RINGS 16 +#define TXP_INTERNAL_RINGS 4 +#define TXP_RING_ENTRIES 512 + +#define RXP_STD_ENTRIES 512 + +#define RXR_MAX_RINGS 16 +#define RXR_RING_ENTRIES 1024 + +#define RXR_MAX_RINGS_05 1 +#define RXR_RING_ENTRIES_05 512 + + +/* BCM570x Send Buffer Descriptors as a struct. Pages 100-101 */ + +typedef struct t3_snd_bd_s { + uint32_t bufptr_hi; + uint32_t bufptr_lo; +#ifdef __MIPSEB + uint16_t length; + uint16_t flags; + uint16_t pad; + uint16_t vlan_tag; +#elif __MIPSEL + uint16_t flags; + uint16_t length; + uint16_t vlan_tag; + uint16_t pad; +#else +#error "bcm5700: endian not set" +#endif +} t3_snd_bd_t; + +#define SND_BD_SIZE 16 + +#define TX_FLAG_TCP_CKSUM 0x0001 +#define TX_FLAG_IP_CKSUM 0x0002 +#define TX_FLAG_PACKET_END 0x0004 +#define TX_FLAG_IP_FRAG 0x0008 +#define TX_FLAG_IP_FRAG_END 0x0010 +#define TX_FLAG_VLAN_TAG 0x0040 +#define TX_FLAG_COAL_NOW 0x0080 +#define TX_FLAG_CPU_PRE_DMA 0x0100 +#define TX_FLAG_CPU_POST_DMA 0x0200 +#define TX_FLAG_ADD_SRC 0x1000 +#define TX_FLAG_SRC_ADDR_SEL 0x6000 +#define TX_FLAG_NO_CRC 0x8000 + +/* BCM570x Receive Buffer Descriptors as a struct. Pages 105-107 */ + +typedef struct t3_rcv_bd_s { + uint32_t bufptr_hi; + uint32_t bufptr_lo; +#ifdef __MIPSEB + uint16_t index; + uint16_t length; + uint16_t type; + uint16_t flags; + uint16_t ip_cksum; + uint16_t tcp_cksum; + uint16_t error_flag; + uint16_t vlan_tag; +#elif __MIPSEL + uint16_t length; + uint16_t index; + uint16_t flags; + uint16_t type; + uint16_t tcp_cksum; + uint16_t ip_cksum; + uint16_t vlan_tag; + uint16_t error_flag; +#else +#error "bcm5700: endian not set" +#endif + uint32_t pad; + uint32_t opaque; +} t3_rcv_bd_t; + +#define RCV_BD_SIZE 32 + +#define RX_FLAG_PACKET_END 0x0004 +#define RX_FLAG_JUMBO_RING 0x0020 +#define RX_FLAG_VLAN_TAG 0x0040 +#define RX_FLAG_ERROR 0x0400 +#define RX_FLAG_MINI_RING 0x0800 +#define RX_FLAG_IP_CKSUM 0x1000 +#define RX_FLAG_TCP_CKSUM 0x2000 +#define RX_FLAG_IS_TCP 0x4000 + +#define RX_ERR_BAD_CRC 0x0001 +#define RX_ERR_COLL_DETECT 0x0002 +#define RX_ERR_LINK_LOST 0x0004 +#define RX_ERR_PHY_DECODE 0x0008 +#define RX_ERR_DRIBBLE 0x0010 +#define RX_ERR_MAC_ABORT 0x0020 +#define RX_ERR_SHORT_PKT 0x0040 +#define RX_ERR_TRUNC_NO_RES 0x0080 +#define RX_ERR_GIANT_PKT 0x0100 + +/* BCM570x Status Block format as a struct (not BCM5705). Pages 110-111. */ + +typedef struct t3_status_s { + uint32_t status; + uint32_t tag; +#ifdef __MIPSEB + uint16_t rxc_std_index; + uint16_t rxc_jumbo_index; + uint16_t reserved2; + uint16_t rxc_mini_index; + struct { + uint16_t send_c; + uint16_t return_p; + } index [16]; +#elif __MIPSEL + uint16_t rxc_jumbo_index; + uint16_t rxc_std_index; + uint16_t rxc_mini_index; + uint16_t reserved2; + struct { + uint16_t return_p; + uint16_t send_c; + } index [16]; +#else +#error "bcm5700: endian not set" +#endif +} t3_status_t; + +#define M_STATUS_UPDATED 0x00000001 +#define M_STATUS_LINKCHNG 0x00000002 +#define M_STATUS_ERROR 0x00000004 + +/* BCM570x Statistics Block format as a struct. Pages 112-120 */ + +typedef struct t3_stats_s { + uint64_t stats[L_MAC_STATS/sizeof(uint64_t)]; +} t3_stats_t; + +/* End of 570X defined data structures */ + + +typedef enum { + eth_state_uninit, + eth_state_off, + eth_state_on, +} eth_state_t; + +typedef struct t3_ether_s { + /* status block */ + volatile t3_status_t *status; /* should be cache-aligned */ + + /* PCI access information */ + uint32_t regbase; + uint32_t membase; + uint8_t irq; + pcitag_t tag; /* tag for configuration registers */ + + uint8_t hwaddr[6]; + uint16_t device; /* chip device code */ + uint8_t revision; /* chip revision */ + + eth_state_t state; /* current state */ + uint32_t intmask; /* interrupt mask */ + + /* packet lists */ + queue_t freelist; + uint8_t *pktpool; + queue_t rxqueue; + + /* rings */ + /* For now, support only the standard Rx Producer Ring */ + t3_rcv_bd_t *rxp_std; /* Standard Rx Producer Ring */ + uint32_t rxp_std_index; + uint32_t prev_rxp_std_index; + + /* For now, support only 1 priority */ + uint32_t rxr_entries; + t3_rcv_bd_t *rxr_1; /* Rx Return Ring 1 */ + uint32_t rxr_1_index; + t3_snd_bd_t *txp_1; /* Send Ring 1 */ + uint32_t txp_1_index; + uint32_t txc_1_index; + + cfe_devctx_t *devctx; + + /* PHY access */ + int phy_addr; + uint16_t phy_status; + uint16_t phy_ability; + uint16_t phy_xability; + + /* MII polling control */ + int phy_change; + int mii_polling; + + /* statistics block */ + t3_stats_t *stats; /* should be cache-aligned */ + + /* additional driver statistics */ + uint32_t rx_interrupts; + uint32_t tx_interrupts; + uint32_t bogus_interrupts; +} t3_ether_t; + + +/* Address mapping macros */ + +#define PTR_TO_PHYS(x) (K0_TO_PHYS((uintptr_t)(x))) +#define PHYS_TO_PTR(a) ((uint8_t *)PHYS_TO_K0(a)) + +/* All mappings through the PCI host bridge use match bits mode. */ +#define PHYS_TO_PCI(a) ((uint32_t) (a) | 0x20000000) +#define PCI_TO_PHYS(a) ((uint32_t) (a) & 0x1FFFFFFF) + +#define PCI_TO_PTR(a) (PHYS_TO_PTR(PCI_TO_PHYS(a))) +#define PTR_TO_PCI(x) (PHYS_TO_PCI(PTR_TO_PHYS(x))) + + +/* Chip access macros */ + +/* These macros attempt to be compatible with match-bits mode, + which may put the data and byte masks into the wrong 32-bit word + for 64-bit accesses. See the comment above on PIOSWAP. + Externally mastered DMA (control and data) uses match-bits and does + specify word-swaps when operating big endian. */ + +/* Most registers are 32 bits wide and are accessed by 32-bit + transactions. The mailbox registers and on-chip RAM are 64-bits + wide but are generally accessed by 32-bit transactions. + Furthermore, the documentation is ambiguous about which 32-bits of + the mailbox is significant. To localize the potential confusions, + we define macros for the 3 different cases. */ + +#if __long64 +#define READCSR(sc,csr) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr))))) + +#define WRITECSR(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr)))) = (val)) + +#if PIOSWAP +#define READMBOX(sc,csr) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->regbase+((csr)+4))))) + +#define WRITEMBOX(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->regbase+((csr)+4)))) = (val)) + +#define READMEM(sc,csr) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->membase+(csr))))) + +#define WRITEMEM(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->membase+(csr)))) = (val)) + +#else +#define READMBOX(sc,csr) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr))))) + +#define WRITEMBOX(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr)))) = (val)) + +#define READMEM(sc,csr) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->membase+((csr) ^ 4))))) + +#define WRITEMEM(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->membase+((csr) ^ 4)))) = (val)) + +#endif +#else +#define READCSR(sc,csr) \ + (hs_read32(PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr)))) + +#define WRITECSR(sc,csr,val) \ + (hs_write32(PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr), (val)))) + +#define READMBOX(sc,csr) \ + (hs_read32(PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr))))) + +#define WRITEMBOX(sc,csr,val) \ + (hs_write32(PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr)))) = (val)) + +#define READMEM(sc,csr) \ + (hs_read32(PHYS_TO_XKSEG_UNCACHED((sc)->membase+(csr)))) + +#define WRITEMEM(sc,csr,val) \ + (hs_write32(PHYS_TO_XKSEG_UNCACHED((sc)->membase+(csr), (val)))) + +#endif + + +/* Entry to and exit from critical sections (currently relative to + interrupts only, not SMP) */ + +#if CFG_INTERRUPTS +#define CS_ENTER(sc) cfe_disable_irq(sc->irq) +#define CS_EXIT(sc) cfe_enable_irq(sc->irq) +#else +#define CS_ENTER(sc) ((void)0) +#define CS_EXIT(sc) ((void)0) +#endif + + +static void +dumpseq(t3_ether_t *sc, int start, int next) +{ + int offset, i, j; + int columns = 4; + int lines = (((next - start)/4 + 1) + 3)/columns; + int step = lines*4; + + offset = start; + for (i = 0; i < lines; i++) { + xprintf("\nCSR"); + for (j = 0; j < columns; j++) { + if (offset + j*step < next) + xprintf(" %04X: %08X ", + offset+j*step, READCSR(sc, offset+j*step)); + } + offset += 4; + } + xprintf("\n"); +} + +static void +dumpcsrs(t3_ether_t *sc, const char *legend) +{ + xprintf("%s:\n", legend); + + /* Some device-specific PCI configuration registers */ + xprintf("-----PCI-----"); + dumpseq(sc, 0x68, 0x78); + + /* Some general control registers */ + xprintf("---General---"); + dumpseq(sc, 0x6800, 0x6810); + + xprintf("-------------\n"); +} + + +/* Packet management */ + +#define ETH_PKTPOOL_SIZE 64 +#define MIN_RXP_STD_BDS 32 + + +static eth_pkt_t * +eth_alloc_pkt(t3_ether_t *sc) +{ + eth_pkt_t *pkt; + + CS_ENTER(sc); + pkt = (eth_pkt_t *) q_deqnext(&sc->freelist); + CS_EXIT(sc); + if (!pkt) return NULL; + + pkt->buffer = pkt->data; + pkt->length = ETH_PKTBUF_LEN; + pkt->flags = 0; + + return pkt; +} + + +static void +eth_free_pkt(t3_ether_t *sc, eth_pkt_t *pkt) +{ + CS_ENTER(sc); + q_enqueue(&sc->freelist, &pkt->next); + CS_EXIT(sc); +} + +static void +eth_initfreelist(t3_ether_t *sc) +{ + int idx; + uint8_t *ptr; + eth_pkt_t *pkt; + + q_init(&sc->freelist); + + ptr = sc->pktpool; + for (idx = 0; idx < ETH_PKTPOOL_SIZE; idx++) { + pkt = (eth_pkt_t *) ptr; + eth_free_pkt(sc, pkt); + ptr += ETH_PKTBUF_SIZE; + } +} + + +/* Utilities */ + +static const char * +t3_devname(t3_ether_t *sc) +{ + return (sc->devctx != NULL ? cfe_device_name(sc->devctx) : "eth?"); +} + + +/* CRCs */ + +#define IEEE_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- either endian */ + +uint32_t eth_crc32(const uint8_t *databuf, unsigned int datalen); +/*static*/ uint32_t +eth_crc32(const uint8_t *databuf, unsigned int datalen) +{ + unsigned int idx, bit, data; + uint32_t crc; + + crc = 0xFFFFFFFFUL; + for (idx = 0; idx < datalen; idx++) + for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) + crc = (crc >> 1) ^ (((crc ^ data) & 1) ? IEEE_CRC32_POLY : 0); + return crc; +} + + +/* Descriptor ring management */ + +static int +t3_add_rcvbuf(t3_ether_t *sc, eth_pkt_t *pkt) +{ + t3_rcv_bd_t *rxp; + + rxp = &(sc->rxp_std[sc->rxp_std_index]); + rxp->bufptr_lo = PTR_TO_PCI(pkt->buffer); + rxp->length = ETH_PKTBUF_LEN; + sc->rxp_std_index++; + if (sc->rxp_std_index == RXP_STD_ENTRIES) + sc->rxp_std_index = 0; + return 0; +} + +static void +t3_fillrxring(t3_ether_t *sc) +{ + eth_pkt_t *pkt; + unsigned rxp_ci, rxp_onring; + + rxp_ci = sc->status->rxc_std_index; /* Get a snapshot */ + + if (sc->rxp_std_index >= rxp_ci) + rxp_onring = sc->rxp_std_index - rxp_ci; + else + rxp_onring = (sc->rxp_std_index + RXP_STD_ENTRIES) - rxp_ci; + + while (rxp_onring < MIN_RXP_STD_BDS) { + pkt = eth_alloc_pkt(sc); + if (pkt == NULL) { + /* could not allocate a buffer */ + break; + } + if (t3_add_rcvbuf(sc, pkt) != 0) { + /* could not add buffer to ring */ + eth_free_pkt(sc, pkt); + break; + } + rxp_onring++; + } +} + +static void +t3_rx_callback(t3_ether_t *sc, eth_pkt_t *pkt) +{ + if (T3_DEBUG) show_packet('>', pkt); /* debug */ + + CS_ENTER(sc); + q_enqueue(&sc->rxqueue, &pkt->next); + CS_EXIT(sc); +} + +static void +t3_procrxring(t3_ether_t *sc) +{ + eth_pkt_t *pkt; + t3_rcv_bd_t *rxc; + volatile t3_status_t *status = sc->status; + + rxc = &(sc->rxr_1[sc->rxr_1_index]); + do { + pkt = ETH_PKT_BASE(PCI_TO_PTR(rxc->bufptr_lo)); + pkt->length = rxc->length; + if ((rxc->flags & RX_FLAG_ERROR) == 0) + t3_rx_callback(sc, pkt); + else { +#if T3_BRINGUP + xprintf("%s: rx error %04X\n", t3_devname(sc), rxc->error_flag); +#endif + eth_free_pkt(sc, pkt); /* Could optimize */ + } + sc->rxr_1_index++; + rxc++; + if (sc->rxr_1_index == sc->rxr_entries) { + sc->rxr_1_index = 0; + rxc = &(sc->rxr_1[0]); + } + } while (status->index[RI(1)].return_p != sc->rxr_1_index); + + /* Update the return ring */ + WRITEMBOX(sc, R_RCV_BD_RTN_CI(1), sc->rxr_1_index); + + /* Refill the producer ring */ + t3_fillrxring(sc); +} + + +static int +t3_transmit(t3_ether_t *sc, eth_pkt_t *pkt) +{ + t3_snd_bd_t *txp; + + if (T3_DEBUG) show_packet('<', pkt); /* debug */ + + txp = &(sc->txp_1[sc->txp_1_index]); + txp->bufptr_hi = 0; + txp->bufptr_lo = PTR_TO_PCI(pkt->buffer); + txp->length = pkt->length; + txp->flags = TX_FLAG_PACKET_END; + + sc->txp_1_index++; + if (sc->txp_1_index == TXP_RING_ENTRIES) + sc->txp_1_index = 0; + + WRITEMBOX(sc, R_SND_BD_PI(1), sc->txp_1_index); + + return 0; +} + + +static void +t3_proctxring(t3_ether_t *sc) +{ + eth_pkt_t *pkt; + t3_snd_bd_t *txc; + volatile t3_status_t *status = sc->status; + + txc = &(sc->txp_1[sc->txc_1_index]); + do { + pkt = ETH_PKT_BASE(PCI_TO_PTR(txc->bufptr_lo)); + eth_free_pkt(sc, pkt); + sc->txc_1_index++; + txc++; + if (sc->txc_1_index == TXP_RING_ENTRIES) { + sc->txc_1_index = 0; + txc = &(sc->txp_1[0]); + } + } while (status->index[RI(1)].send_c != sc->txc_1_index); +} + + +static void +t3_initrings(t3_ether_t *sc) +{ + int i; + t3_rcv_bd_t *rxp; + volatile t3_status_t *status = sc->status; + + /* Clear all Producer BDs */ + rxp = &(sc->rxp_std[0]); + for (i = 0; i < RXP_STD_ENTRIES; i++) { + rxp->bufptr_hi = rxp->bufptr_lo = 0; + rxp->length = 0; + rxp->index = i; + rxp->flags = 0; + rxp->type = 0; + rxp->ip_cksum = rxp->tcp_cksum = 0; + rxp++; + } + + /* Init the ring pointers */ + + sc->rxp_std_index = 0; status->rxc_std_index = 0; + sc->rxr_1_index = 0; status->index[RI(1)].return_p = 0; + sc->txp_1_index = 0; status->index[RI(1)].send_c = 0; + + /* Allocate some initial buffers for the Producer BD ring */ + sc->prev_rxp_std_index = 0; + t3_fillrxring(sc); + + /* Nothing consumed yet */ + sc->txc_1_index = 0; +} + +static void +t3_init(t3_ether_t *sc) +{ + /* Allocate buffer pool */ + sc->pktpool = KMALLOC(ETH_PKTPOOL_SIZE*ETH_PKTBUF_SIZE, CACHE_ALIGN); + eth_initfreelist(sc); + q_init(&sc->rxqueue); + + t3_initrings(sc); +} + +static void +t3_reinit(t3_ether_t *sc) +{ + eth_initfreelist(sc); + q_init(&sc->rxqueue); + + t3_initrings(sc); +} + + +/* Byte swap utilities. */ + +#define SWAP4(x) \ + ((((x) & 0x00FF) << 24) | \ + (((x) & 0xFF00) << 8) | \ + (((x) >> 8) & 0xFF00) | \ + (((x) >> 24) & 0x00FF)) + +static uint32_t +swap4(uint32_t x) +{ + uint32_t t; + + t = ((x & 0xFF00FF00) >> 8) | ((x & 0x00FF00FF) << 8); + return (t >> 16) | ((t & 0xFFFF) << 16); +} + + +/* EEPROM access functions (BCM5700 and BCM5701 version) */ + +/* The 570x chips support multiple access methods. We use "Auto Access", + which requires that + Miscellaneous_Local_Control.Auto_SEEPROM_Access be set, + Serial_EEprom.Address.HalfClock be programmed for <= 400 Hz. + (both done by initialization code) */ + +#define EP_MAX_RETRIES 500 +#define EP_DEVICE_ID 0x00 /* default ATMEL device ID */ + +static void +eeprom_access_init(t3_ether_t *sc) +{ + uint32_t mlctl; + + WRITECSR(sc, R_EEPROM_ADDR, M_EPADDR_RESET | V_EPADDR_HPERIOD(0x60)); + + mlctl = READCSR(sc, R_MISC_LOCAL_CTRL); + mlctl |= M_MLCTL_EPAUTOACCESS; + WRITECSR(sc, R_MISC_LOCAL_CTRL, mlctl); +} + + +static uint32_t +eeprom_read_word(t3_ether_t *sc, unsigned int offset) +{ + /* Assumes that SEEPROM is already set up for auto access. */ + uint32_t epaddr, epdata; + volatile uint32_t temp; + int i; + + epaddr = READCSR(sc, R_EEPROM_ADDR); + epaddr &= M_EPADDR_HPERIOD; + epaddr |= (V_EPADDR_ADDR(offset) | V_EPADDR_DEVID(EP_DEVICE_ID) + | M_EPADDR_RW | M_EPADDR_START | M_EPADDR_COMPLETE); + WRITECSR(sc, R_EEPROM_ADDR, epaddr); + temp = READCSR(sc, R_EEPROM_ADDR); /* push */ + + for (i = 0; i < EP_MAX_RETRIES; i++) { + temp = READCSR(sc, R_EEPROM_ADDR); + if ((temp & M_EPADDR_COMPLETE) != 0) + break; + cfe_usleep(10); + } + if (i == EP_MAX_RETRIES) + xprintf("%s: eeprom_read_word: no SEEPROM response @ %x\n", + t3_devname(sc), offset); + + epdata = READCSR(sc, R_EEPROM_DATA); /* little endian */ +#ifdef __MIPSEB + return swap4(epdata); +#else + return epdata; +#endif +} + +static int +eeprom_read_range(t3_ether_t *sc, unsigned int offset, unsigned int len, + uint32_t buf[]) +{ + int index; + + offset &= ~3; len &= ~3; /* 4-byte words only */ + index = 0; + + while (len > 0) { + buf[index++] = eeprom_read_word(sc, offset); + offset += 4; len -= 4; + } + + return index; +} + +static void +eeprom_dump_range(const char *label, + uint32_t buf[], unsigned int offset, unsigned int len) +{ + int index; + + xprintf("EEPROM: %s", label); + + offset &= ~3; len &= ~3; /* 4-byte words only */ + index = 0; + + for (index = 0; len > 0; index++) { + if (index % 8 == 0) + xprintf("\n %04x: ", offset); + xprintf(" %08x", buf[offset/4]); + offset += 4; len -= 4; + } + xprintf("\n"); +} + + +/* MII access functions. */ + +/* BCM5401 device specific registers */ + +#define MII_ISR 0x1A /* Interrupt Status Register */ +#define MII_IMR 0x1B /* Interrupt Mask Register */ + +#define M_INT_LINKCHNG 0x0002 + + +/* The 570x chips support multiple access methods. We use "Auto + Access", which requires that MDI_Control_Register.MDI_Select be + clear (done by initialization code) */ + +#define MII_MAX_RETRIES 5000 + +static void +mii_access_init(t3_ether_t *sc) +{ + WRITECSR(sc, R_MDI_CTRL, 0); /* here for now */ +#if !T3_AUTOPOLL + WRITECSR(sc, R_MI_MODE, V_MIMODE_CLKCNT(0x1F)); /* max divider */ +#endif +} + +/* XXX Autopolling should be disabled during reads and writes per the + manual, but doing so currently generates recurvise LINKCHNG + attentions. */ + +static uint16_t +mii_read_register(t3_ether_t *sc, int phy, int index) +{ + uint32_t mode; + uint32_t comm, val; + int i; + + mode = READCSR(sc, R_MI_MODE); +#if 0 /* for now */ + if (mode & M_MIMODE_POLLING) { + WRITECSR(sc, R_MI_MODE, mode & ~M_MIMODE_POLLING); + cfe_usleep(40); + } +#endif + + comm = (V_MICOMM_CMD_RD | V_MICOMM_PHY(phy) | V_MICOMM_REG(index) + | M_MICOMM_BUSY); + WRITECSR(sc, R_MI_COMM, comm); + + for (i = 0; i < MII_MAX_RETRIES; i++) { + val = READCSR(sc, R_MI_COMM); + if ((val & M_MICOMM_BUSY) == 0) + break; + } + if (i == MII_MAX_RETRIES) + xprintf("%s: mii_read_register: MII always busy\n", t3_devname(sc)); + +#if 0 + if (mode & M_MIMODE_POLLING) + WRITECSR(sc, R_MI_MODE, mode); +#endif + + return G_MICOMM_DATA(val); +} + +/* Register reads occasionally return spurious 0's. Verify a zero by + doing a second read, or spinning when a zero is "impossible". */ +static uint16_t +mii_read_register_v(t3_ether_t *sc, int phy, int index, int spin) +{ + uint32_t val; + + val = mii_read_register(sc, phy, index); + if (val == 0) { + do { + val = mii_read_register(sc, phy, index); + } while (spin && val == 0); + } + return val; +} + +static void +mii_write_register(t3_ether_t *sc, int phy, int index, uint16_t value) +{ + uint32_t mode; + uint32_t comm, val; + int i; + + mode = READCSR(sc, R_MI_MODE); +#if 0 /* for now */ + if (mode & M_MIMODE_POLLING) { + WRITECSR(sc, R_MI_MODE, mode & ~M_MIMODE_POLLING); + cfe_usleep(40); + } +#endif + + comm = (V_MICOMM_CMD_WR | V_MICOMM_PHY(phy) | V_MICOMM_REG(index) + | V_MICOMM_DATA(value) | M_MICOMM_BUSY); + WRITECSR(sc, R_MI_COMM, comm); + + for (i = 0; i < MII_MAX_RETRIES; i++) { + val = READCSR(sc, R_MI_COMM); + if ((val & M_MICOMM_BUSY) == 0) + break; + } + if (i == MII_MAX_RETRIES) + xprintf("%s: mii_write_register: MII always busy\n", t3_devname(sc)); + +#if 0 + if (mode & M_MIMODE_POLLING) + WRITECSR(sc, R_MI_MODE, mode); +#endif +} + +static int +mii_probe(t3_ether_t *sc) +{ +#if T3_AUTOPOLL /* With autopolling, the code below is not reliable. */ + return 1; /* Guaranteed for integrated PHYs */ +#else + int i; + uint16_t id1, id2; + + for (i = 0; i < 32; i++) { + id1 = mii_read_register(sc, i, MII_PHYIDR1); + id2 = mii_read_register(sc, i, MII_PHYIDR2); + if ((id1 != 0x0000 && id1 != 0xFFFF) || + (id2 != 0x0000 && id2 != 0xFFFF)) { + if (id1 != id2) return i; + } + } + return -1; +#endif +} + +#if T3_DEBUG +#define OUI_BCM 0x001018 +#define IDR_BCM 0x000818 +/* 5400: 4, 5401: 5, 5411: 6, 5421: e, 5701: 11 */ + +static void +mii_dump(t3_ether_t *sc, const char *label) +{ + int i; + uint16_t r; + uint32_t idr, part; + + xprintf("%s, MII:\n", label); + idr = part = 0; + + /* Required registers */ + for (i = 0x0; i <= 0x6; ++i) { + r = mii_read_register(sc, sc->phy_addr, i); + xprintf(" REG%02X: %04X", i, r); + if (i == 3 || i == 6) + xprintf("\n"); + if (i == MII_PHYIDR1) { + idr |= r << 6; + } + else if (i == MII_PHYIDR2) { + idr |= (r >> 10) & 0x3F; + part = (r >> 4) & 0x3F; + } + } + + /* GMII extensions */ + for (i = 0x9; i <= 0xA; ++i) { + r = mii_read_register(sc, sc->phy_addr, i); + xprintf(" REG%02X: %04X", i, r); + } + r = mii_read_register(sc, sc->phy_addr, 0xF); + xprintf(" REG%02X: %04X\n", 0xF, r); + + /* Broadcom extensions (54xx family) */ + if (idr == IDR_BCM) { + for (i = 0x10; i <= 0x14; i++) { + r = mii_read_register(sc, sc->phy_addr, i); + xprintf(" REG%02X: %04X", i, r); + } + xprintf("\n"); + for (i = 0x18; i <= 0x1A; i++) { + r = mii_read_register(sc, sc->phy_addr, i); + xprintf(" REG%02X: %04X", i, r); + } + xprintf("\n"); + } +} +#else +#define mii_dump(sc,label) +#endif + +static void +mii_enable_interrupts(t3_ether_t *sc) +{ + mii_write_register(sc, sc->phy_addr, MII_IMR, ~M_INT_LINKCHNG); +} + + +/* For 5700/5701, LINKCHNG is read-only in the status register and + cleared by writing to CFGCHNG | SYNCCHNG. For the 5705 + (empirically), LINKCHNG is cleared by writing a one, while CFGCHNG + and SYNCCHNG are unimplemented. Thus we can safely clear the + interrupt by writing ones to all the above bits. */ + +#define M_LINKCHNG_CLR \ + (M_EVT_LINKCHNG | M_MACSTAT_CFGCHNG | M_MACSTAT_SYNCCHNG) + +static int +mii_poll(t3_ether_t *sc) +{ + uint32_t macstat; + uint16_t status, ability, xability; + uint16_t isr; + + macstat = READCSR(sc, R_MAC_STATUS); + if ((macstat & (M_EVT_LINKCHNG | M_EVT_MIINT)) != 0) + WRITECSR(sc, R_MAC_STATUS, M_LINKCHNG_CLR); + + /* BMSR has read-to-clear bits; read twice. */ + + status = mii_read_register(sc, sc->phy_addr, MII_BMSR); + status = mii_read_register_v(sc, sc->phy_addr, MII_BMSR, 1); + ability = mii_read_register_v(sc, sc->phy_addr, MII_ANLPAR, 0); + if (status & BMSR_1000BT_XSR) + xability = mii_read_register_v(sc, sc->phy_addr, MII_K1STSR, 0); + else + xability = 0; + isr = mii_read_register(sc, sc->phy_addr, MII_ISR); + + if (status != sc->phy_status + || ability != sc->phy_ability || xability != sc->phy_xability) { +#if T3_DEBUG + xprintf("[%04x]", isr); + xprintf((macstat & (M_EVT_LINKCHNG | M_EVT_MIINT)) != 0 ? "+" : "-"); + + if (status != sc->phy_status) + xprintf(" ST: %04x %04x", sc->phy_status, status); + if (ability != sc->phy_ability) + xprintf(" AB: %04x %04x", sc->phy_ability, ability); + if (xability != sc->phy_xability) + xprintf(" XA: %04x %04x", sc->phy_xability, xability); + xprintf("\n"); +#endif + sc->phy_status = status; + sc->phy_ability = ability; + sc->phy_xability = xability; + return 1; + } + else if ((macstat & (M_EVT_LINKCHNG | M_EVT_MIINT)) != 0) { + isr = mii_read_register(sc, sc->phy_addr, MII_ISR); + } + return 0; +} + +static void +mii_set_speed(t3_ether_t *sc, int speed) +{ + uint16_t control; + + control = mii_read_register(sc, sc->phy_addr, MII_BMCR); + + control &= ~(BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, sc->phy_addr, MII_BMCR, control); + control &= ~(BMCR_SPEED0 | BMCR_SPEED1 | BMCR_DUPLEX); + + switch (speed) { + case ETHER_SPEED_10HDX: + default: + break; + case ETHER_SPEED_10FDX: + control |= BMCR_DUPLEX; + break; + case ETHER_SPEED_100HDX: + control |= BMCR_SPEED100; + break; + case ETHER_SPEED_100FDX: + control |= BMCR_SPEED100 | BMCR_DUPLEX ; + break; + } + + mii_write_register(sc, sc->phy_addr, MII_BMCR, control); +} + +static void +mii_autonegotiate(t3_ether_t *sc) +{ + uint16_t control, status, remote, xremote; + unsigned int timeout; + int linkspeed; + uint32_t mode; + + linkspeed = ETHER_SPEED_UNKNOWN; + + /* Read twice to clear latching bits */ + status = mii_read_register(sc, sc->phy_addr, MII_BMSR); + status = mii_read_register_v(sc, sc->phy_addr, MII_BMSR, 1); + mii_dump(sc, "query PHY"); + + if ((status & (BMSR_AUTONEG | BMSR_LINKSTAT)) == + (BMSR_AUTONEG | BMSR_LINKSTAT)) + control = mii_read_register(sc, sc->phy_addr, MII_BMCR); + else { + for (timeout = 4*CFE_HZ; timeout > 0; timeout -= CFE_HZ/2) { + status = mii_read_register(sc, sc->phy_addr, MII_BMSR); + if ((status & BMSR_ANCOMPLETE) != 0 || timeout <= 0) + break; + cfe_sleep(CFE_HZ/2); + } + } + + remote = mii_read_register_v(sc, sc->phy_addr, MII_ANLPAR, 0); + + /* XXX Empirically, it appears best to set/keep PortMode non-null to + get STATUS_LINKCHNG assertions. */ + mode = READCSR(sc, R_MAC_MODE); + + xprintf("%s: Link speed: ", t3_devname(sc)); + if ((status & BMSR_ANCOMPLETE) != 0) { + /* A link partner was negogiated... */ + + if (status & BMSR_1000BT_XSR) + xremote = mii_read_register_v(sc, sc->phy_addr, MII_K1STSR, 0); + else + xremote = 0; + + mode &= ~(M_MACM_PORTMODE | M_MACM_HALFDUPLEX); + + if ((xremote & K1STSR_LP1KFD) != 0) { + xprintf("1000BaseT FDX\n"); + linkspeed = ETHER_SPEED_1000FDX; + mode |= V_MACM_PORTMODE(K_MACM_PORTMODE_GMII); + } + else if ((xremote & K1STSR_LP1KHD) != 0) { + xprintf("1000BaseT HDX\n"); + linkspeed = ETHER_SPEED_1000HDX; + mode |= V_MACM_PORTMODE(K_MACM_PORTMODE_GMII) | M_MACM_HALFDUPLEX; + } + else if ((remote & ANLPAR_TXFD) != 0) { + xprintf("100BaseT FDX\n"); + linkspeed = ETHER_SPEED_100FDX; + mode |= V_MACM_PORTMODE(K_MACM_PORTMODE_MII); + } + else if ((remote & ANLPAR_TXHD) != 0) { + xprintf("100BaseT HDX\n"); + linkspeed = ETHER_SPEED_100HDX; + mode |= V_MACM_PORTMODE(K_MACM_PORTMODE_MII) | M_MACM_HALFDUPLEX; + } + else if ((remote & ANLPAR_10FD) != 0) { + xprintf("10BaseT FDX\n"); + linkspeed = ETHER_SPEED_10FDX; + mode |= V_MACM_PORTMODE(K_MACM_PORTMODE_MII); + } + else if ((remote & ANLPAR_10HD) != 0) { + xprintf("10BaseT HDX\n"); + linkspeed = ETHER_SPEED_10HDX; + mode |= V_MACM_PORTMODE(K_MACM_PORTMODE_MII) | M_MACM_HALFDUPLEX; + } + + WRITECSR(sc, R_MAC_MODE, mode); + } + else { + /* no link partner convergence */ + xprintf("Unknown\n"); + linkspeed = ETHER_SPEED_UNKNOWN; + remote = xremote = 0; + if (G_MACM_PORTMODE(mode) == K_MACM_PORTMODE_NONE) { + /* Keep any previous port mode as the one most likely to reappear. + Otherwise, choose one, and 10/100FDX is more likely. */ + mode |= V_MACM_PORTMODE(K_MACM_PORTMODE_MII); + WRITECSR(sc, R_MAC_MODE, mode); + } + } + + /* clear latching bits, XXX fix flakey reads */ + status = mii_read_register_v(sc, sc->phy_addr, MII_BMSR, 1); + (void)mii_read_register(sc, sc->phy_addr, MII_ISR); + + sc->phy_status = status; + sc->phy_ability = remote; + sc->phy_xability = xremote; + + mii_dump(sc, "final PHY"); +} + + +static void +t3_clear(t3_ether_t *sc, unsigned reg, uint32_t mask) +{ + uint32_t val; + int timeout; + + val = READCSR(sc, reg); + val &= ~mask; + WRITECSR(sc, reg, val); + val = READCSR(sc, reg); + + for (timeout = 4000; (val & mask) != 0 && timeout > 0; timeout -= 100) { + cfe_usleep(100); + val = READCSR(sc, reg); + } + if (timeout <= 0) + xprintf("%s: cannot clear %04X/%08X\n", t3_devname(sc), reg, mask); +} + + +/* The following functions collectively implement the recommended + BCM5700 Initialization Procedure (Section 8: Device Control) */ + +static int +t3_coldreset(t3_ether_t *sc) +{ + pcireg_t cmd; + pcireg_t bhlc, subsysid; + pcireg_t bar0, bar1; + pcireg_t cmdx; + uint32_t mhc, mcr, mcfg; + uint32_t mode; + int timeout; + + /* Steps 1-18 */ + /* Enable memory, also clear R/WC status bits (1) */ + cmd = pci_conf_read(sc->tag, PCI_COMMAND_STATUS_REG); + cmd |= PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE; + pci_conf_write(sc->tag, PCI_COMMAND_STATUS_REG, cmd); + + /* Clear and disable INTA output. (2) */ + mhc = READCSR(sc, R_MISC_HOST_CTRL); + mhc |= M_MHC_MASKPCIINT | M_MHC_CLEARINTA; + WRITECSR(sc, R_MISC_HOST_CTRL, mhc); + + /* Save some config registers modified by core clock reset (3). */ + bhlc = pci_conf_read(sc->tag, PCI_BHLC_REG); + subsysid = pci_conf_read(sc->tag, PCI_SUBSYS_ID_REG); + /* Empirically, these are clobbered too. */ + bar0 = pci_conf_read(sc->tag, PCI_MAPREG(0)); + bar1 = pci_conf_read(sc->tag, PCI_MAPREG(1)); + + /* Reset the core clocks (4, 5). */ + mcfg = READCSR(sc, R_MISC_CFG); + mcfg |= M_MCFG_CORERESET; + WRITECSR(sc, R_MISC_CFG, mcfg); + cfe_usleep(100); /* 100 usec delay */ + + /* NB: Until the BARs are restored and reenabled, only PCI + configuration reads and writes will succeed. */ + + /* Reenable MAC memory (7) */ + pci_conf_write(sc->tag, PCI_MAPREG(0), bar0); + pci_conf_write(sc->tag, PCI_MAPREG(1), bar1); + (void)pci_conf_read(sc->tag, PCI_MAPREG(1)); /* push */ + pci_conf_write(sc->tag, PCI_COMMAND_STATUS_REG, cmd); + (void)pci_conf_read(sc->tag, PCI_COMMAND_STATUS_REG); /* push */ + + /* Undo some of the resets (6) */ + mhc = READCSR(sc, R_MISC_HOST_CTRL); + mhc |= M_MHC_MASKPCIINT; + WRITECSR(sc, R_MISC_HOST_CTRL, mhc); + + /* Verify that core clock resets completed and autocleared. */ + mcfg = READCSR(sc, R_MISC_CFG); + if ((mcfg & M_MCFG_CORERESET) != 0) { + xprintf("bcm5700: core clocks stuck in reset\n"); + } + + /* Configure PCI-X (8) */ + if (sc->device != K_PCI_ID_BCM5705) { + cmdx = pci_conf_read(sc->tag, PCI_PCIX_CMD_REG); + cmdx &= ~PCIX_CMD_RLXORDER_ENABLE; + pci_conf_write(sc->tag, PCI_PCIX_CMD_REG, cmdx); + } + + /* Enable memory arbiter (9) */ + mode = READCSR(sc, R_MEM_MODE); + mode |= M_MAM_ENABLE; /* enable memory arbiter */ + WRITECSR(sc, R_MEM_MODE, mode); + + /* Assume no external SRAM for now (10) */ + + /* Set up MHC for endianness and write enables (11-15) */ + mhc = READCSR(sc, R_MISC_HOST_CTRL); +#ifdef __MIPSEL + mhc |= M_MHC_ENWORDSWAP; /* XXX check this */ +#endif +#ifdef __MIPSEB + /* Since we use match-bits for Direct PCI access, don't swap bytes. */ +#if PIOSWAP + mhc |= M_MHC_ENWORDSWAP; +#endif +#endif + mhc |= M_MHC_ENINDIRECT | M_MHC_ENPCISTATERW | M_MHC_ENCLKCTRLRW; + WRITECSR(sc, R_MISC_HOST_CTRL, mhc); + + /* Set byte swapping (16, 17) */ + mcr = READCSR(sc, R_MODE_CTRL); +#ifdef __MIPSEL + mcr &= ~M_MCTL_BSWAPDATA; + mcr |= M_MCTL_WSWAPCTRL | M_MCTL_WSWAPDATA; /* XXX check this */ +#endif +#ifdef __MIPSEB + mcr &= ~(M_MCTL_BSWAPCTRL | M_MCTL_BSWAPDATA); + mcr |= M_MCTL_WSWAPCTRL | M_MCTL_WSWAPDATA; +#endif + WRITECSR(sc, R_MODE_CTRL, mcr); + + /* Disable PXE restart, wait for firmware (18, 19) */ + if (READMEM(sc, A_PXE_MAILBOX) != T3_MAGIC_NUMBER) { + /* Apparently, if the magic number is already set, firmware + ignores this attempted handshake. */ + WRITEMEM(sc, A_PXE_MAILBOX, T3_MAGIC_NUMBER); + for (timeout = CFE_HZ; timeout > 0; timeout -= CFE_HZ/10) { + if (READMEM(sc, A_PXE_MAILBOX) == ~T3_MAGIC_NUMBER) + break; + cfe_sleep(CFE_HZ/10); + } + if (READMEM(sc, A_PXE_MAILBOX) != ~T3_MAGIC_NUMBER) + xprintf("bcm5700: no firmware PXE rendevous\n"); + } + else + xprintf("bcm5700: PXE magic number already set\n"); + + /* Clear Ethernet MAC Mode (20) */ + WRITECSR(sc, R_MAC_MODE, 0x00000000); + + /* Restore remaining config registers (21) */ + pci_conf_write(sc->tag, PCI_BHLC_REG, bhlc); + pci_conf_write(sc->tag, PCI_SUBSYS_ID_REG, subsysid); + + return 0; +} + +/* XXX Not clear that the following is useful. */ +static int +t3_warmreset(t3_ether_t *sc) +{ + uint32_t mode; + + /* Enable memory arbiter (9) */ + mode = READCSR(sc, R_MEM_MODE); + mode |= M_MAM_ENABLE; /* enable memory arbiter */ + WRITECSR(sc, R_MEM_MODE, mode); + + /* Clear Ethernet MAC Mode (20) */ + WRITECSR(sc, R_MAC_MODE, 0x00000000); + + return 0; +} + + +static int +t3_init_registers(t3_ether_t *sc) +{ + unsigned offset; + uint32_t dmac, mcr, mcfg; + + /* Steps 22-29 */ + + /* Clear MAC statistics block (22) */ + for (offset = A_MAC_STATS; offset < A_MAC_STATS+L_MAC_STATS; offset += 4) { + WRITEMEM(sc, offset, 0); + } + + /* Clear driver status memory region (23) */ + /* ASSERT (sizeof(t3_status_t) == L_MAC_STATUS) */ + memset((uint8_t *)sc->status, 0, sizeof(t3_status_t)); + + /* Set up PCI DMA control (24) */ + dmac = READCSR(sc, R_DMA_RW_CTRL); + dmac &= ~(M_DMAC_RDCMD | M_DMAC_WRCMD | M_DMAC_MINDMA); + dmac |= V_DMAC_RDCMD(K_PCI_MEMRD) | V_DMAC_WRCMD(K_PCI_MEMWR); + switch (sc->device) { + case K_PCI_ID_BCM5700: + case K_PCI_ID_BCM5701: + case K_PCI_ID_BCM5702: + dmac |= V_DMAC_MINDMA(0xF); /* "Recommended" */ + break; + default: + dmac |= V_DMAC_MINDMA(0x0); + break; + } + WRITECSR(sc, R_DMA_RW_CTRL, dmac); + + /* Set DMA byte swapping (25) - XXX repeat of (17) */ + mcr = READCSR(sc, R_MODE_CTRL); +#ifdef __MIPSEL + mcr &= ~M_MCTL_BSWAPDATA; + mcr |= M_MCTL_WSWAPCTRL | M_MCTL_WSWAPDATA; /* XXX check this */ +#endif +#ifdef __MIPSEB + mcr &= ~(M_MCTL_BSWAPCTRL | M_MCTL_BSWAPDATA); + mcr |= M_MCTL_WSWAPCTRL | M_MCTL_WSWAPDATA; +#endif + WRITECSR(sc, R_MODE_CTRL, mcr); + + /* Configure host rings (26) */ + mcr |= M_MCTL_HOSTBDS; + WRITECSR(sc, R_MODE_CTRL, mcr); + + /* Indicate driver ready, disable checksums (27, 28) */ + mcr |= M_MCTL_HOSTUP; + mcr |= (M_MCTL_NOTXPHSUM | M_MCTL_NORXPHSUM); + WRITECSR(sc, R_MODE_CTRL, mcr); + + /* Configure timer (29) */ + mcfg = READCSR(sc, R_MISC_CFG); + mcfg &= ~M_MCFG_PRESCALER; + mcfg |= V_MCFG_PRESCALER(66-1); /* 66 MHz */ + WRITECSR(sc, R_MISC_CFG, mcfg); + + return 0; +} + +static int +t3_init_pools(t3_ether_t *sc) +{ + uint32_t mode; + int timeout; + + /* Steps 30-36. These use "recommended" settings (p 150) */ + + /* Configure the MAC memory pool (30) */ + if (sc->device != K_PCI_ID_BCM5705) { + WRITECSR(sc, R_BMGR_MBUF_BASE, A_BUFFER_POOL); + WRITECSR(sc, R_BMGR_MBUF_LEN, L_BUFFER_POOL); + } + else { + /* Note: manual appears to recommend not even writing these (?) */ + /* WRITECSR(sc, R_BMGR_MBUF_BASE, A_RXMBUF); */ + /* WRITECSR(sc, R_BMGR_MBUF_LEN, 0x8000); */ + } + + /* Configure the MAC DMA resource pool (31) */ + WRITECSR(sc, R_BMGR_DMA_BASE, A_DMA_DESCS); + WRITECSR(sc, R_BMGR_DMA_LEN, L_DMA_DESCS); + + /* Configure the MAC memory watermarks (32) */ + WRITECSR(sc, R_BMGR_MBUF_DMA_LOW, 0x50); + WRITECSR(sc, R_BMGR_MBUF_RX_LOW, 0x20); + WRITECSR(sc, R_BMGR_MBUF_HIGH, 0x60); + + /* Configure the DMA resource watermarks (33) */ + WRITECSR(sc, R_BMGR_DMA_LOW, 5); + WRITECSR(sc, R_BMGR_DMA_HIGH, 10); + + /* Enable the buffer manager (34, 35) */ + mode = READCSR(sc, R_BMGR_MODE); + mode |= (M_BMODE_ENABLE | M_BMODE_MBUFLOWATTN); + WRITECSR(sc, R_BMGR_MODE, mode); + for (timeout = CFE_HZ/2; timeout > 0; timeout -= CFE_HZ/10) { + mode = READCSR(sc, R_BMGR_MODE); + if ((mode & M_BMODE_ENABLE) != 0) + break; + cfe_sleep(CFE_HZ/10); + } + if ((mode & M_BMODE_ENABLE) == 0) + xprintf("bcm5700: buffer manager not enabled\n"); + + /* Enable internal queues (36) */ + WRITECSR(sc, R_FTQ_RESET, 0xFFFFFFFF); + (void)READCSR(sc, R_FTQ_RESET); /* push */ + cfe_sleep(1); + WRITECSR(sc, R_FTQ_RESET, 0x00000000); + + return 0; +} + +static int +t3_init_rings(t3_ether_t *sc) +{ + unsigned rcbp; + int i; + + /* Steps 37-46 */ + + /* Initialize RCBs for Standard Receive Buffer Ring (37) */ + WRITECSR(sc, R_STD_RCV_BD_RCB+RCB_HOST_ADDR_HIGH, 0); + WRITECSR(sc, R_STD_RCV_BD_RCB+RCB_HOST_ADDR_LOW, PTR_TO_PCI(sc->rxp_std)); + WRITECSR(sc, R_STD_RCV_BD_RCB+RCB_CTRL, V_RCB_MAXLEN(ETH_PKTBUF_LEN)); + WRITECSR(sc, R_STD_RCV_BD_RCB+RCB_NIC_ADDR, A_STD_RCV_RINGS); + + /* Disable RCBs for Jumbo and Mini Receive Buffer Rings (38,39) */ + WRITECSR(sc, R_JUMBO_RCV_BD_RCB+RCB_CTRL, + RCB_FLAG_USE_EXT_RCV_BD | RCB_FLAG_RING_DISABLED); + WRITECSR(sc, R_JUMBO_RCV_BD_RCB+RCB_NIC_ADDR, A_JUMBO_RCV_RINGS); + WRITECSR(sc, R_MINI_RCV_BD_RCB+RCB_CTRL, RCB_FLAG_RING_DISABLED); + WRITECSR(sc, R_MINI_RCV_BD_RCB+RCB_NIC_ADDR, 0xe000); + + /* Set BD ring replenish thresholds (40) */ + WRITECSR(sc, R_MINI_RCV_BD_THRESH, 128); +#if T3_BRINGUP + WRITECSR(sc, R_STD_RCV_BD_THRESH, 1); +#else + WRITECSR(sc, R_STD_RCV_BD_THRESH, 25); +#endif + WRITECSR(sc, R_JUMBO_RCV_BD_THRESH, 16); + + /* Disable unused send producer rings 2-16 (41) */ + for (rcbp = A_SND_RCB(1); rcbp <= A_SND_RCB(16); rcbp += RCB_SIZE) + WRITEMEM(sc, rcbp+RCB_CTRL, RCB_FLAG_RING_DISABLED); + + /* Initialize send producer index registers (42) */ + for (i = 1; i <= TXP_MAX_RINGS; i++) { + WRITEMBOX(sc, R_SND_BD_PI(i), 0); + WRITEMBOX(sc, R_SND_BD_NIC_PI(i), 0); + } + + /* Initialize send producer ring 1 (43) */ + WRITEMEM(sc, A_SND_RCB(1)+RCB_HOST_ADDR_HIGH, 0); + WRITEMEM(sc, A_SND_RCB(1)+RCB_HOST_ADDR_LOW, PTR_TO_PCI(sc->txp_1)); + WRITEMEM(sc, A_SND_RCB(1)+RCB_CTRL, V_RCB_MAXLEN(TXP_RING_ENTRIES)); + WRITEMEM(sc, A_SND_RCB(1)+RCB_NIC_ADDR, A_SND_RINGS); + + /* Disable unused receive return rings (44) */ + for (rcbp = A_RTN_RCB(1); rcbp <= A_RTN_RCB(16); rcbp += RCB_SIZE) + WRITEMEM(sc, rcbp+RCB_CTRL, RCB_FLAG_RING_DISABLED); + + /* Initialize receive return ring 1 (45) */ + WRITEMEM(sc, A_RTN_RCB(1)+RCB_HOST_ADDR_HIGH, 0); + WRITEMEM(sc, A_RTN_RCB(1)+RCB_HOST_ADDR_LOW, PTR_TO_PCI(sc->rxr_1)); + WRITEMEM(sc, A_RTN_RCB(1)+RCB_CTRL, V_RCB_MAXLEN(sc->rxr_entries)); + WRITEMEM(sc, A_RTN_RCB(1)+RCB_NIC_ADDR, 0x0000); + + /* Initialize receive producer ring mailboxes (46) */ + WRITEMBOX(sc, R_RCV_BD_STD_PI, 0); + WRITEMBOX(sc, R_RCV_BD_JUMBO_PI, 0); + WRITEMBOX(sc, R_RCV_BD_MINI_PI, 0); + + return 0; +} + +static int +t3_configure_mac(t3_ether_t *sc) +{ + uint32_t low, high; + uint32_t seed; + int i; + + /* Steps 47-52 */ + + /* Configure the MAC unicast address (47) */ + high = (sc->hwaddr[0] << 8) | (sc->hwaddr[1]); + low = ((sc->hwaddr[2] << 24) | (sc->hwaddr[3] << 16) + | (sc->hwaddr[4] << 8) | sc->hwaddr[5]); + /* For now, use a single MAC address */ + WRITECSR(sc, R_MAC_ADDR1_HIGH, high); WRITECSR(sc, R_MAC_ADDR1_LOW, low); + WRITECSR(sc, R_MAC_ADDR2_HIGH, high); WRITECSR(sc, R_MAC_ADDR2_LOW, low); + WRITECSR(sc, R_MAC_ADDR3_HIGH, high); WRITECSR(sc, R_MAC_ADDR3_LOW, low); + WRITECSR(sc, R_MAC_ADDR4_HIGH, high); WRITECSR(sc, R_MAC_ADDR4_LOW, low); + + /* Configure the random backoff seed (48) */ + seed = 0; + for (i = 0; i < 6; i++) + seed += sc->hwaddr[i]; + seed &= 0x3FF; + WRITECSR(sc, R_TX_BACKOFF, seed); + + /* Configure the MTU (49) */ + WRITECSR(sc, R_RX_MTU, MAX_ETHER_PACK+VLAN_TAG_LEN); + + /* Configure the tx IPG (50) */ + WRITECSR(sc, R_TX_LENS, + V_TXLEN_SLOT(0x20) | V_TXLEN_IPG(0x6) | V_TXLEN_IPGCRS(0x2)); + + /* Configure the default rx return ring 1 (51) */ + WRITECSR(sc, R_RX_RULES_CFG, V_RULESCFG_DEFAULT(1)); + + /* Configure the receive lists and enable statistics (52) */ + WRITECSR(sc, R_RCV_LIST_CFG, + V_LISTCFG_GROUP(1) | V_LISTCFG_ACTIVE(1) | V_LISTCFG_BAD(1)); + /* was V_LISTCFG_DEFAULT(1) | V_LISTCFG_ACTIVE(16) | V_LISTCFG_BAD(1) */ + + return 0; +} + +static int +t3_enable_stats(t3_ether_t *sc) +{ + uint32_t ctrl; + + /* Steps 53-56 */ + + /* Enable rx stats (53,54) */ + WRITECSR(sc, R_RCV_LIST_STATS_ENB, 0xFFFFFF); + ctrl = READCSR(sc, R_RCV_LIST_STATS_CTRL); + ctrl |= M_STATS_ENABLE; + WRITECSR(sc, R_RCV_LIST_STATS_CTRL, ctrl); + + /* Enable tx stats (55,56) */ + WRITECSR(sc, R_SND_DATA_STATS_ENB, 0xFFFFFF); + ctrl = READCSR(sc, R_SND_DATA_STATS_CTRL); + ctrl |= (M_STATS_ENABLE | M_STATS_FASTUPDATE); + WRITECSR(sc, R_SND_DATA_STATS_CTRL, ctrl); + + return 0; +} + +static int +t3_init_coalescing(t3_ether_t *sc) +{ + uint32_t mode; + int timeout; + + /* Steps 57-68 */ + + /* Disable the host coalescing engine (57, 58) */ + WRITECSR(sc, R_HOST_COAL_MODE, 0); + for (timeout = CFE_HZ/2; timeout > 0; timeout -= CFE_HZ/10) { + mode = READCSR(sc, R_HOST_COAL_MODE); + if (mode == 0) + break; + cfe_sleep(CFE_HZ/10); + } + if (mode != 0) + xprintf("bcm5700: coalescing engine not disabled\n"); + + /* Set coalescing parameters (59-62) */ +#if T3_BRINGUP + WRITECSR(sc, R_RCV_COAL_TICKS, 0); + WRITECSR(sc, R_RCV_COAL_MAX_CNT, 1); +#else + WRITECSR(sc, R_RCV_COAL_TICKS, 150); + WRITECSR(sc, R_RCV_COAL_MAX_CNT, 10); +#endif + WRITECSR(sc, R_RCV_COAL_INT_TICKS, 0); + WRITECSR(sc, R_RCV_COAL_INT_CNT, 0); +#if T3_BRINGUP + WRITECSR(sc, R_SND_COAL_TICKS, 0); + WRITECSR(sc, R_SND_COAL_MAX_CNT, 1); +#else + WRITECSR(sc, R_SND_COAL_TICKS, 150); + WRITECSR(sc, R_SND_COAL_MAX_CNT, 10); +#endif + WRITECSR(sc, R_SND_COAL_INT_TICKS, 0); + WRITECSR(sc, R_SND_COAL_INT_CNT, 0); + + /* Initialize host status block address (63) */ + WRITECSR(sc, R_STATUS_HOST_ADDR, 0); + WRITECSR(sc, R_STATUS_HOST_ADDR+4, PTR_TO_PCI(sc->status)); + + /* Initialize host statistics block address (64) */ + WRITECSR(sc, R_STATS_HOST_ADDR, 0); + WRITECSR(sc, R_STATS_HOST_ADDR+4, PTR_TO_PCI(sc->stats)); + + /* Set statistics block NIC address and tick count (65, 66) */ + WRITECSR(sc, R_STATS_TICKS, 1000000); + WRITECSR(sc, R_STATS_BASE_ADDR, A_MAC_STATS); + + /* Set status block NIC address (67) */ + WRITECSR(sc, R_STATUS_BASE_ADDR, A_MAC_STATUS); + + /* Enable the host coalescing engine (68) */ + WRITECSR(sc, R_HOST_COAL_MODE, M_HCM_ENABLE); + + return 0; +} + +static int +t3_init_dma(t3_ether_t *sc) +{ + uint32_t mode; + + /* Steps 69-87 */ + + /* Enable receive BD completion, placement, and selector blocks (69-71) */ + WRITECSR(sc, R_RCV_BD_COMP_MODE, M_MODE_ENABLE | M_MODE_ATTNENABLE); + WRITECSR(sc, R_RCV_LIST_MODE, M_MODE_ENABLE); + if (sc->device != K_PCI_ID_BCM5705) { + WRITECSR(sc, R_RCV_LIST_SEL_MODE, M_MODE_ENABLE | M_MODE_ATTNENABLE); + } + + /* Enable DMA engines, enable and clear statistics (72, 73) */ + mode = READCSR(sc, R_MAC_MODE); + mode |= (M_MACM_FHDEENB | M_MACM_RDEENB | M_MACM_TDEENB | + M_MACM_RXSTATSENB | M_MACM_RXSTATSCLR | + M_MACM_TXSTATSENB | M_MACM_TXSTATSCLR); +#if T3_AUTOPOLL + mode |= V_MACM_PORTMODE(K_MACM_PORTMODE_MII); +#endif + + WRITECSR(sc, R_MAC_MODE, mode); + +#if T3_AUTOPOLL + WRITECSR(sc, R_MISC_LOCAL_CTRL, M_MLCTL_INTATTN); +#endif + + /* Configure GPIOs (74) - skipped */ + + /* Clear interrupt mailbox (75) */ + WRITEMBOX(sc, R_INT_MBOX(0), 0); + + /* Enable DMA completion block (76) */ + if (sc->device != K_PCI_ID_BCM5705) { + WRITECSR(sc, R_DMA_COMP_MODE, M_MODE_ENABLE); + } + + /* Configure write and read DMA modes (77, 78) */ + WRITECSR(sc, R_WR_DMA_MODE, M_MODE_ENABLE | M_ATTN_ALL); + WRITECSR(sc, R_RD_DMA_MODE, M_MODE_ENABLE | M_ATTN_ALL); + + return 0; +} + +static int +t3_init_enable(t3_ether_t *sc) +{ + uint32_t mhc; + uint32_t pmcs; +#if T3_AUTOPOLL + uint32_t mode, mask; +#else + int i; +#endif + + /* Steps 79-97 */ + + /* Enable completion functional blocks (79-82) */ + WRITECSR(sc, R_RCV_COMP_MODE, M_MODE_ENABLE | M_MODE_ATTNENABLE); + if (sc->device != K_PCI_ID_BCM5705) { + WRITECSR(sc, R_MBUF_FREE_MODE, M_MODE_ENABLE); + } + WRITECSR(sc, R_SND_DATA_COMP_MODE, M_MODE_ENABLE); + WRITECSR(sc, R_SND_BD_COMP_MODE, M_MODE_ENABLE | M_MODE_ATTNENABLE); + + /* Enable initiator functional blocks (83-86) */ + WRITECSR(sc, R_RCV_BD_INIT_MODE, M_MODE_ENABLE | M_MODE_ATTNENABLE); + WRITECSR(sc, R_RCV_DATA_INIT_MODE, M_MODE_ENABLE | M_RCVINITMODE_RTNSIZE); + WRITECSR(sc, R_SND_DATA_MODE, M_MODE_ENABLE); + WRITECSR(sc, R_SND_BD_INIT_MODE, M_MODE_ENABLE | M_MODE_ATTNENABLE); + + /* Enable the send BD selector (87) */ + WRITECSR(sc, R_SND_BD_SEL_MODE, M_MODE_ENABLE | M_MODE_ATTNENABLE); + + /* Download firmware (88) - skipped */ + + /* Enable the MAC (89,90) */ + WRITECSR(sc, R_TX_MODE, M_MODE_ENABLE); /* optional flow control */ + WRITECSR(sc, R_RX_MODE, M_MODE_ENABLE); /* other options */ + + /* Disable auto-polling (91) */ + mii_access_init(sc); + + /* Configure power state (92) */ + pmcs = READCSR(sc, PCI_PMCSR_REG); + pmcs &= ~PCI_PMCSR_STATE_MASK; + pmcs |= PCI_PMCSR_STATE_D0; + WRITECSR(sc, PCI_PMCSR_REG, pmcs); + +#if T3_AUTOPOLL + /* Program hardware LED control (93) */ + WRITECSR(sc, R_MAC_LED_CTRL, 0x00); /* LEDs at PHY layer */ +#endif + +#if T3_AUTOPOLL + /* Ack/clear link change events */ + WRITECSR(sc, R_MAC_STATUS, M_LINKCHNG_CLR); + WRITECSR(sc, R_MI_STATUS, 0); + + /* Enable autopolling */ + mode = READCSR(sc, R_MI_MODE); + mode |= M_MIMODE_POLLING | 0x000c000; + WRITECSR(sc, R_MI_MODE, mode); + + /* Enable link state attentions */ + mask = READCSR(sc, R_MAC_EVENT_ENB); + mask |= M_EVT_LINKCHNG; + WRITECSR(sc, R_MAC_EVENT_ENB, mask); +#else + /* Initialize link (94) */ + WRITECSR(sc, R_MI_STATUS, M_MISTAT_LINKED); + + /* Start autonegotiation (95) - see t3_initlink below */ + + /* Setup multicast filters (96) */ + for (i = 0; i < 4; i++) + WRITECSR(sc, R_MAC_HASH(i), 0); +#endif /* T3_AUTOPOLL */ + + /* Enable interrupts (97) */ + mhc = READCSR(sc, R_MISC_HOST_CTRL); + mhc &= ~M_MHC_MASKPCIINT; + WRITECSR(sc, R_MISC_HOST_CTRL, mhc); + + return 0; +} + + +static void +t3_initlink(t3_ether_t *sc) +{ + uint32_t mcr; + + sc->phy_addr = mii_probe(sc); + if (sc->phy_addr < 0) { + xprintf("%s: no PHY found\n", t3_devname(sc)); + return; + } +#if T3_DEBUG + xprintf("%s: PHY addr %d\n", t3_devname(sc), sc->phy_addr); +#endif + if (1) /* XXX Support only autonegotiation for now */ + mii_autonegotiate(sc); + else + mii_set_speed(sc, ETHER_SPEED_10HDX); + + mii_enable_interrupts(sc); + + mcr = READCSR(sc, R_MODE_CTRL); + mcr |= M_MCTL_MACINT; + WRITECSR(sc, R_MODE_CTRL, mcr); + + sc->mii_polling = 0; + sc->phy_change = 0; +} + +static void +t3_shutdownlink(t3_ether_t *sc) +{ + uint32_t mcr; + + mcr = READCSR(sc, R_MODE_CTRL); + mcr &= ~M_MCTL_MACINT; + WRITECSR(sc, R_MODE_CTRL, mcr); + + WRITECSR(sc, R_MAC_EVENT_ENB, 0); + + /* The manual is fuzzy about what to do with the PHY at this + point. Empirically, resetting the 5705 PHY (but not others) + will cause it to get stuck in 10/100 MII mode. */ + if (sc->device != K_PCI_ID_BCM5705) + mii_write_register(sc, sc->phy_addr, MII_BMCR, BMCR_RESET); + + sc->mii_polling = 0; + sc->phy_change = 0; +} + + +static void +t3_hwinit(t3_ether_t *sc) +{ + if (sc->state != eth_state_on) { + + if (sc->state == eth_state_uninit) { + WRITECSR(sc, R_MEMWIN_BASE_ADDR, 0); /* Default memory window */ + t3_coldreset(sc); + } + else + t3_warmreset(sc); + + t3_init_registers(sc); + t3_init_pools(sc); + t3_init_rings(sc); + t3_configure_mac(sc); + t3_enable_stats(sc); + t3_init_coalescing(sc); + t3_init_dma(sc); + t3_init_enable(sc); +#if T3_DEBUG + dumpcsrs(sc, "end init"); +#else + (void)dumpcsrs; +#endif + + eeprom_access_init(sc); +#if T3_DEBUG + { + uint32_t eeprom[0x100/4]; + int i; + + cfe_sleep(1); + /* XXX Apparently a few reads can be required to get the + AutoAccess logic into a good state. ??? */ + for (i = 0; i < 4; i++) { + eeprom_read_range(sc, 0, 4, eeprom); + } + + eeprom_read_range(sc, 0, sizeof(eeprom), eeprom); + eeprom_dump_range("Boot Strap", eeprom, 0x00, 20); + eeprom_dump_range("Manufacturing Info", eeprom, 0x74, 140); + } +#else + (void)eeprom_read_range; + (void)eeprom_dump_range; +#endif + + t3_initlink(sc); + + sc->state = eth_state_off; + } +} + +static void +t3_hwshutdown(t3_ether_t *sc) +{ + /* Receive path shutdown */ + t3_clear(sc, R_RX_MODE, M_MODE_ENABLE); + t3_clear(sc, R_RCV_BD_INIT_MODE, M_MODE_ENABLE); + t3_clear(sc, R_RCV_LIST_MODE, M_MODE_ENABLE); + if (sc->device != K_PCI_ID_BCM5705) { + t3_clear(sc, R_RCV_LIST_SEL_MODE, M_MODE_ENABLE); + } + t3_clear(sc, R_RCV_DATA_INIT_MODE, M_MODE_ENABLE); + t3_clear(sc, R_RCV_COMP_MODE, M_MODE_ENABLE); + t3_clear(sc, R_RCV_BD_COMP_MODE, M_MODE_ENABLE); + + /* Transmit path shutdown */ + t3_clear(sc, R_SND_BD_SEL_MODE, M_MODE_ENABLE); + t3_clear(sc, R_SND_BD_INIT_MODE, M_MODE_ENABLE); + t3_clear(sc, R_SND_DATA_MODE, M_MODE_ENABLE); + t3_clear(sc, R_RD_DMA_MODE, M_MODE_ENABLE); + t3_clear(sc, R_SND_DATA_COMP_MODE, M_MODE_ENABLE); + if (sc->device != K_PCI_ID_BCM5705) { + t3_clear(sc, R_DMA_COMP_MODE, M_MODE_ENABLE); + } + t3_clear(sc, R_SND_BD_COMP_MODE, M_MODE_ENABLE); + t3_clear(sc, R_TX_MODE, M_MODE_ENABLE); + + /* Memory shutdown */ + t3_clear(sc, R_HOST_COAL_MODE, M_HCM_ENABLE); + t3_clear(sc, R_WR_DMA_MODE, M_MODE_ENABLE); + if (sc->device != K_PCI_ID_BCM5705) { + t3_clear(sc, R_MBUF_FREE_MODE, M_MODE_ENABLE); + } + WRITECSR(sc, R_FTQ_RESET, 0xFFFFFFFF); + cfe_sleep(1); + WRITECSR(sc, R_FTQ_RESET, 0x00000000); + t3_clear(sc, R_BMGR_MODE, M_BMODE_ENABLE); + t3_clear(sc, R_MEM_MODE, M_MAM_ENABLE); + + t3_shutdownlink(sc); + + WRITECSR(sc, R_MEMWIN_BASE_ADDR, 0); /* Default memory window */ + t3_coldreset(sc); + + sc->state = eth_state_uninit; +} + + +static void +t3_isr(void *arg) +{ + t3_ether_t *sc = (t3_ether_t *)arg; + volatile t3_status_t *status = sc->status; + uint32_t mac_status; + int handled; + + do { + WRITEMBOX(sc, R_INT_MBOX(0), 1); + + handled = 0; + mac_status = READCSR(sc, R_MAC_STATUS); /* force ordering */ + status->status &= ~M_STATUS_UPDATED; + + if (status->index[RI(1)].return_p != sc->rxr_1_index) { + handled = 1; + if (IPOLL) sc->rx_interrupts++; + t3_procrxring(sc); + } + + if (status->index[RI(1)].send_c != sc->txc_1_index) { + handled = 1; + if (IPOLL) sc->tx_interrupts++; + t3_proctxring(sc); + } + + if ((status->status & M_STATUS_LINKCHNG) != 0) { + handled = 1; +#if T3_AUTOPOLL + WRITECSR(sc, R_MAC_STATUS, M_LINKCHNG_CLR); +#endif + WRITECSR(sc, R_MAC_STATUS, M_EVT_MICOMPLETE); + + status->status &= ~M_STATUS_LINKCHNG; + sc->phy_change = 1; + } + + WRITEMBOX(sc, R_INT_MBOX(0), 0); + (void)READMBOX(sc, R_INT_MBOX(0)); /* push */ + +#if (!XPOLL) + if (!handled) + sc->bogus_interrupts++; +#endif + + } while ((status->status & M_STATUS_UPDATED) != 0); + + if (sc->rxp_std_index != sc->prev_rxp_std_index) { + sc->prev_rxp_std_index = sc->rxp_std_index; + WRITEMBOX(sc, R_RCV_BD_STD_PI, sc->rxp_std_index); + } +} + + +static void +t3_start(t3_ether_t *sc) +{ + t3_hwinit(sc); + + sc->intmask = 0; + +#if IPOLL + cfe_request_irq(sc->irq, t3_isr, sc, CFE_IRQ_FLAGS_SHARED, 0); + +#if T3_AUTOPOLL + sc->intmask |= M_EVT_LINKCHNG; +#else + sc->intmask |= M_EVT_LINKCHNG | M_EVT_MIINT; +#endif + WRITECSR(sc, R_MAC_EVENT_ENB, sc->intmask); +#endif + + /* Post some Rcv Producer buffers */ + sc->prev_rxp_std_index = sc->rxp_std_index; + WRITEMBOX(sc, R_RCV_BD_STD_PI, sc->rxp_std_index); + + sc->state = eth_state_on; +} + +static void +t3_stop(t3_ether_t *sc) +{ + WRITECSR(sc, R_MAC_EVENT_ENB, 0); + sc->intmask = 0; +#if IPOLL + cfe_free_irq(sc->irq, 0); +#endif + + if (sc->state == eth_state_on) { + sc->state = eth_state_off; + t3_hwshutdown(sc); + t3_reinit(sc); + } +} + + +static int t3_ether_open(cfe_devctx_t *ctx); +static int t3_ether_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int t3_ether_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int t3_ether_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int t3_ether_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int t3_ether_close(cfe_devctx_t *ctx); +static void t3_ether_poll(cfe_devctx_t *ctx, int64_t ticks); +static void t3_ether_reset(void *softc); + +const static cfe_devdisp_t t3_ether_dispatch = { + t3_ether_open, + t3_ether_read, + t3_ether_inpstat, + t3_ether_write, + t3_ether_ioctl, + t3_ether_close, + t3_ether_poll, + t3_ether_reset +}; + +cfe_driver_t bcm5700drv = { + "BCM570x Ethernet", + "eth", + CFE_DEV_NETWORK, + &t3_ether_dispatch, + t3_ether_probe +}; + + +static void +t3_delete_sc(t3_ether_t *sc) +{ + xprintf("BCM570x attach: No memory to complete probe\n"); + if (sc != NULL) { + if (sc->txp_1 != NULL) + KFREE(sc->txp_1); + if (sc->rxr_1 != NULL) + KFREE(sc->rxr_1); + if (sc->rxp_std != NULL) + KFREE(sc->rxp_std); + if (sc->stats != NULL) + KFREE(sc->stats); + if (sc->status != NULL) + KFREE((t3_ether_t *)sc->status); + KFREE(sc); + } +} + +static int +t3_ether_attach(cfe_driver_t *drv, pcitag_t tag, int index) +{ + t3_ether_t *sc; + char descr[80]; + phys_addr_t pa; + uint32_t base; + uint32_t pcictrl; + uint32_t addr; + pcireg_t device, class; + const char *devname; + int i; + + pci_map_mem(tag, PCI_MAPREG(0), PCI_MATCH_BITS, &pa); + base = (uint32_t)pa; + + sc = (t3_ether_t *) KMALLOC(sizeof(t3_ether_t), 0); + if (sc == NULL) { + t3_delete_sc(sc); + return 0; + } + + memset(sc, 0, sizeof(*sc)); + + sc->status = NULL; + sc->stats = NULL; + + device = pci_conf_read(tag, PCI_ID_REG); + class = pci_conf_read(tag, PCI_CLASS_REG); + sc->tag = tag; + sc->device = PCI_PRODUCT(device); + sc->revision = PCI_REVISION(class); + + sc->status = (t3_status_t *) KMALLOC(sizeof(t3_status_t), CACHE_ALIGN); + if (sc->status == NULL) { + t3_delete_sc(sc); + return 0; + } + + sc->stats = (t3_stats_t *) KMALLOC(sizeof(t3_stats_t), CACHE_ALIGN); + if (sc->stats == NULL) { + t3_delete_sc(sc); + return 0; + } + + if (sc->device == K_PCI_ID_BCM5705) + sc->rxr_entries = RXR_RING_ENTRIES_05; + else + sc->rxr_entries = RXR_RING_ENTRIES; + + sc->rxp_std = + (t3_rcv_bd_t *) KMALLOC(RXP_STD_ENTRIES*RCV_BD_SIZE, CACHE_ALIGN); + sc->rxr_1 = + (t3_rcv_bd_t *) KMALLOC(sc->rxr_entries*RCV_BD_SIZE, CACHE_ALIGN); + sc->txp_1 = + (t3_snd_bd_t *) KMALLOC(TXP_RING_ENTRIES*SND_BD_SIZE, CACHE_ALIGN); + if (sc->rxp_std == NULL || sc->rxr_1 == NULL || sc->txp_1 == NULL) { + t3_delete_sc(sc); + return 0; + } + + sc->regbase = base; + + /* NB: the relative base of memory depends on the access model */ + pcictrl = pci_conf_read(tag, R_PCI_STATE); +#if 0 /* XXX This gets spontaneously reset somehow! */ + if ((pcictrl & M_PCIS_FLATVIEW) != 0) + sc->membase = base + 0x01000000; /* Flat mode */ + else +#endif + sc->membase = base + 0x8000; /* Normal mode: 32K window */ + + sc->irq = pci_conf_read(tag, PCI_BPARAM_INTERRUPT_REG) & 0xFF; + + sc->devctx = NULL; + + /* Assume on-chip firmware has initialized the MAC address. */ + addr = READCSR(sc, R_MAC_ADDR1_HIGH); + for (i = 0; i < 2; i++) + sc->hwaddr[i] = (addr >> (8*(1-i))) & 0xff; + addr = READCSR(sc, R_MAC_ADDR1_LOW); + for (i = 0; i < 4; i++) + sc->hwaddr[2+i] = (addr >> (8*(3-i))) & 0xff; + + t3_init(sc); + + sc->state = eth_state_uninit; + + switch (sc->device) { + case K_PCI_ID_BCM5700: + devname = "BCM5700"; break; + case K_PCI_ID_BCM5701: + devname = "BCM5701"; break; + case K_PCI_ID_BCM5702: + devname = "BCM5702"; break; + case K_PCI_ID_BCM5703: + devname = "BCM5703"; break; + case K_PCI_ID_BCM5705: + devname = "BCM5705"; break; + default: + devname = "BCM570x"; break; + } + xsprintf(descr, "%s Ethernet at 0x%X (%02X-%02X-%02X-%02X-%02X-%02X)", + devname, sc->regbase, + sc->hwaddr[0], sc->hwaddr[1], sc->hwaddr[2], + sc->hwaddr[3], sc->hwaddr[4], sc->hwaddr[5]); + + cfe_attach(drv, sc, NULL, descr); + return 1; +} + +static void +t3_ether_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + int index; + int n; + + n = 0; + index = 0; + for (;;) { + pcitag_t tag; + pcireg_t device; + + if (pci_find_class(PCI_CLASS_NETWORK, index, &tag) != 0) + break; + + index++; + + device = pci_conf_read(tag, PCI_ID_REG); + if (PCI_VENDOR(device) == K_PCI_VENDOR_BROADCOM) { + switch (PCI_PRODUCT(device)) { + case K_PCI_ID_BCM5700: + case K_PCI_ID_BCM5701: + case K_PCI_ID_BCM5702: + case K_PCI_ID_BCM5703: + case K_PCI_ID_BCM5705: + t3_ether_attach(drv, tag, n); + n++; + break; + default: + break; + } + } + } +} + + +/* The functions below are called via the dispatch vector for the Tigon 3 */ + +static int +t3_ether_open(cfe_devctx_t *ctx) +{ + t3_ether_t *sc = ctx->dev_softc; + t3_stats_t *stats = sc->stats; + int i; + + if (sc->state == eth_state_on) + t3_stop(sc); + + sc->devctx = ctx; + + sc->rx_interrupts = sc->tx_interrupts = sc->bogus_interrupts = 0; + for (i = 0; i < L_MAC_STATS/sizeof(uint64_t); i++) + stats->stats[i] = 0; + + t3_start(sc); + + if (XPOLL) t3_isr(sc); + return 0; +} + +static int +t3_ether_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + t3_ether_t *sc = ctx->dev_softc; + eth_pkt_t *pkt; + int blen; + + if (XPOLL) t3_isr(sc); + + if (sc->state != eth_state_on) return -1; + + CS_ENTER(sc); + pkt = (eth_pkt_t *) q_deqnext(&(sc->rxqueue)); + CS_EXIT(sc); + + if (pkt == NULL) { + buffer->buf_retlen = 0; + return 0; + } + + blen = buffer->buf_length; + if (blen > pkt->length) blen = pkt->length; + + blockcopy(buffer->buf_ptr, pkt->buffer, blen); + buffer->buf_retlen = blen; + + eth_free_pkt(sc, pkt); + + if (XPOLL) t3_isr(sc); + return 0; +} + +static int +t3_ether_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + t3_ether_t *sc = ctx->dev_softc; + + if (XPOLL) t3_isr(sc); + + if (sc->state != eth_state_on) return -1; + + /* We avoid an interlock here because the result is a hint and an + interrupt cannot turn a non-empty queue into an empty one. */ + inpstat->inp_status = (q_isempty(&(sc->rxqueue))) ? 0 : 1; + + return 0; +} + +static int +t3_ether_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + t3_ether_t *sc = ctx->dev_softc; + eth_pkt_t *pkt; + int blen; + + if (XPOLL) t3_isr(sc); + + if (sc->state != eth_state_on) return -1; + + pkt = eth_alloc_pkt(sc); + if (!pkt) return CFE_ERR_NOMEM; + + blen = buffer->buf_length; + if (blen > pkt->length) blen = pkt->length; + + blockcopy(pkt->buffer, buffer->buf_ptr, blen); + pkt->length = blen; + + if (t3_transmit(sc, pkt) != 0) { + eth_free_pkt(sc,pkt); + return CFE_ERR_IOERR; + } + + if (XPOLL) t3_isr(sc); + return 0; +} + +static int +t3_ether_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + t3_ether_t *sc = ctx->dev_softc; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_ETHER_GETHWADDR: + memcpy(buffer->buf_ptr, sc->hwaddr, sizeof(sc->hwaddr)); + return 0; + + default: + return -1; + } +} + +static int +t3_ether_close(cfe_devctx_t *ctx) +{ + t3_ether_t *sc = ctx->dev_softc; + t3_stats_t *stats = sc->stats; + uint32_t inpkts, outpkts, interrupts; + int i; + + t3_stop(sc); + +#if T3_BRINGUP + for (i = 0; i < L_MAC_STATS/sizeof(uint64_t); i++) { + if (stats->stats[i] != 0) + xprintf(" stats[%d] = %8lld\n", i, stats->stats[i]); + } +#else + (void) i; +#endif + + inpkts = stats->stats[ifHCInUcastPkts] + + stats->stats[ifHCInMulticastPkts] + + stats->stats[ifHCInBroadcastPkts]; + outpkts = stats->stats[ifHCOutUcastPkts] + + stats->stats[ifHCOutMulticastPkts] + + stats->stats[ifHCOutBroadcastPkts]; + interrupts = stats->stats[nicInterrupts]; + + /* Empirically, counters on the 5705 are always zero. */ + if (sc->device != K_PCI_ID_BCM5705) { + xprintf("%s: %d sent, %d received, %d interrupts\n", + t3_devname(sc), outpkts, inpkts, interrupts); + if (IPOLL) { + xprintf(" %d rx interrupts, %d tx interrupts", + sc->rx_interrupts, sc->tx_interrupts); + if (sc->bogus_interrupts != 0) + xprintf(", %d bogus interrupts", sc->bogus_interrupts); + xprintf("\n"); + } + } + + sc->devctx = NULL; + return 0; +} + +static void +t3_ether_poll(cfe_devctx_t *ctx, int64_t ticks) +{ + t3_ether_t *sc = ctx->dev_softc; + int changed; + + if (sc->phy_change && sc->state != eth_state_uninit && !sc->mii_polling) { + uint32_t mask; + + sc->mii_polling++; + mask = READCSR(sc, R_MAC_EVENT_ENB); + WRITECSR(sc, R_MAC_EVENT_ENB, 0); + + changed = mii_poll(sc); + if (changed) { + mii_autonegotiate(sc); + } + sc->phy_change = 0; + sc->mii_polling--; + + WRITECSR(sc, R_MAC_EVENT_ENB, mask); + } +} + +static void +t3_ether_reset(void *softc) +{ + t3_ether_t *sc = (t3_ether_t *)softc; + + /* Turn off the Ethernet interface. */ + + if (sc->state == eth_state_on) + t3_stop(sc); + + sc->state = eth_state_uninit; +} diff --git a/cfe/cfe/dev/dev_bcm5821.c b/cfe/cfe/dev/dev_bcm5821.c new file mode 100644 index 0000000..3dede0f --- /dev/null +++ b/cfe/cfe/dev/dev_bcm5821.c @@ -0,0 +1,1592 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * BC5821 crypto accelerator driver File: dev_bcm5821.c + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* + CFE Driver plus test programs for the BCM5820 and BCM5821 crypto + coprocessor chips. + Reference: + BCM5821 Super-eCommerce Processor + Data Sheet 5821-DS105-D1 (draft, 7/26/02) + Broadcom Corp., 16215 Alton Parkway, Irvine, CA. +*/ + +/* The performance counter usage assumes a BCM11xx or BCM1250 part */ +#ifndef _SB14XX_ + +#include "sbmips.h" +#include "sb1250_defs.h" +#include "sb1250_regs.h" + +#ifndef _SB_MAKE64 +#define _SB_MAKE64(x) ((uint64_t)(x)) +#endif +#ifndef _SB_MAKEMASK1 +#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n)) +#endif + +#include "lib_types.h" +#include "lib_hssubr.h" +#include "lib_malloc.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "lib_queue.h" + +#include "addrspace.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_timer.h" +#include "cfe_devfuncs.h" +#include "cfe_irq.h" + +#include "pcivar.h" +#include "pcireg.h" + +#include "bcm5821.h" + +/* The version that works by polling the CPU's Cause register doesn't + do handshakes or checks to detect merged interrupts. It currently + works when the 5821 is on the direct PCI bus but can behave + erratically when the 5821 is behind an LDT-to-PCI bridge that does + interrupt mapping and relies on EOI. */ + +extern int32_t _getcause(void); /* return value of CP0 CAUSE */ + +#define IMR_POINTER(cpu,reg) \ + ((volatile uint64_t *)(PHYS_TO_K1(A_IMR_REGISTER(cpu,reg)))) + +#define CACHE_LINE_SIZE 32 + +static void bcm5821_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +typedef struct bcm5821_state_s { + uint32_t regbase; + uint8_t irq; + pcitag_t tag; /* tag for configuration registers */ + + uint16_t device; /* chip device code */ + uint8_t revision; /* chip revision */ + +} bcm5821_state_t; + + +/* Address mapping macros */ + +/* Note that PTR_TO_PHYS only works with 32-bit addresses, but then + so does the bcm528x. */ +#define PTR_TO_PHYS(x) (K0_TO_PHYS((uintptr_t)(x))) +#define PHYS_TO_PTR(a) ((void *)PHYS_TO_K0(a)) + +/* For the 5821, all mappings through the PCI host bridge use match + bits mode. This works because the NORM_PCI bit in DMA Control is + clear. The 5820 does not have such a bit, so pointers to data byte + sequences use match bytes, but control blocks use match bits. */ +#define PHYS_TO_PCI(a) ((uint32_t) (a) | 0x20000000) +#define PHYS_TO_PCI_D(a) (a) +#define PCI_TO_PHYS(a) ((uint32_t) (a) & 0x1FFFFFFF) + +#if __long64 +#define READCSR(sc,csr) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr))))) + +#define WRITECSR(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr)))) = (val)) +#else +#define READCSR(sc,csr) \ + (hs_read32(PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr)))) + +#define WRITECSR(sc,csr,val) \ + (hs_write32(PHYS_TO_XKSEG_UNCACHED((sc)->regbase+(csr)), (val))) +#endif + +static void +dumpcsrs(bcm5821_state_t *sc, const char *legend) +{ + xprintf("%s:\n", legend); + xprintf("---DMA---\n"); + /* DMA control and status registers */ + xprintf("MCR1: %08X CTRL: %08X STAT: %08X ERR: %08X\n", + READCSR(sc, R_MCR1), READCSR(sc, R_DMA_CTRL), + READCSR(sc, R_DMA_STAT), READCSR(sc, R_DMA_ERR)); + xprintf("MCR2: %08X\n", READCSR(sc, R_MCR2)); + xprintf("-------------\n"); +} + + +static void +bcm5821_init(bcm5821_state_t *sc) +{ +} + +static void +bcm5821_hwinit(bcm5821_state_t *sc) +{ + uint32_t ctrl; + uint32_t status; + + ctrl = (M_DMA_CTRL_MCR1_INT_EN | M_DMA_CTRL_MCR2_INT_EN | + M_DMA_CTRL_DMAERR_EN); + if (sc->device == K_PCI_ID_BCM5820) + ctrl |= (M_DMA_CTRL_NORM_PCI | M_DMA_CTRL_LE_CRYPTO); + /* Note for 5821: M_DMA_CTRL_NORM_PCI, M_DMA_CTRL_LE_CRYPTO not set. */ +#if 0 /* Empirically, this reduces performance. */ + if (sc->device != K_PCI_ID_BCM5820) + ctrl |= M_DMA_CTRL_WR_BURST; +#endif + WRITECSR(sc, R_DMA_CTRL, ctrl); + + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* reset write-to-clear bits */ + status = READCSR(sc, R_DMA_STAT); + + dumpcsrs(sc, "init"); +} + + +static void +bcm5821_start(bcm5821_state_t *sc) +{ + bcm5821_hwinit(sc); +} + +static void +bcm5821_stop(bcm5821_state_t *sc) +{ + WRITECSR(sc, R_DMA_CTRL, 0); +} + + +static int bcm5821_open(cfe_devctx_t *ctx); +static int bcm5821_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm5821_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int bcm5821_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm5821_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int bcm5821_close(cfe_devctx_t *ctx); + +const static cfe_devdisp_t bcm5821_dispatch = { + bcm5821_open, + bcm5821_read, + bcm5821_inpstat, + bcm5821_write, + bcm5821_ioctl, + bcm5821_close, + NULL, + NULL +}; + +cfe_driver_t bcm5821drv = { + "BCM582x crypto", + "crypt", + CFE_DEV_OTHER, + &bcm5821_dispatch, + bcm5821_probe +}; + + +static int +bcm5821_attach(cfe_driver_t *drv, pcitag_t tag, int index) +{ + bcm5821_state_t *sc; + char descr[80]; + phys_addr_t pa; + uint32_t base; + pcireg_t device, class; + + pci_map_mem(tag, PCI_MAPREG(0), PCI_MATCH_BITS, &pa); + base = (uint32_t)pa; + + sc = (bcm5821_state_t *) KMALLOC(sizeof(bcm5821_state_t),0); + if (sc == NULL) { + xprintf("BCM5821: No memory to complete probe\n"); + return 0; + } + + memset(sc, 0, sizeof(*sc)); + + sc->regbase = base; + + sc->irq = pci_conf_read(tag, PCI_BPARAM_INTERRUPT_REG) & 0xFF; + + device = pci_conf_read(tag, PCI_ID_REG); + class = pci_conf_read(tag, PCI_CLASS_REG); + + sc->tag = tag; + sc->device = PCI_PRODUCT(device); + sc->revision = PCI_REVISION(class); + + bcm5821_init(sc); + + xsprintf(descr, "BCM%04X Crypto at 0x%08X", sc->device, base); + cfe_attach(drv, sc, NULL, descr); + + return 1; +} + +static void +bcm5821_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + int index; + int n; + + n = 0; + index = 0; + for (;;) { + pcitag_t tag; + pcireg_t device; + + if (pci_find_class(PCI_CLASS_PROCESSOR, index, &tag) != 0) + break; + + index++; + + device = pci_conf_read(tag, PCI_ID_REG); + if (PCI_VENDOR(device) == K_PCI_VENDOR_BROADCOM) { + if (PCI_PRODUCT(device) == K_PCI_ID_BCM5820 || + PCI_PRODUCT(device) == K_PCI_ID_BCM5821) { + bcm5821_attach(drv, tag, n); + n++; + } + } + } +} + + +/* The functions below are called via the dispatch vector for the 5821 */ + +static int +bcm5821_open(cfe_devctx_t *ctx) +{ + bcm5821_state_t *sc = ctx->dev_softc; + + bcm5821_start(sc); + return 0; +} + +static int +bcm5821_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + return -1; +} + +static int +bcm5821_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + return 0; +} + +static int +bcm5821_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + return -1; +} + +static int +bcm5821_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + return -1; +} + +static int +bcm5821_close(cfe_devctx_t *ctx) +{ + bcm5821_state_t *sc = ctx->dev_softc; + + bcm5821_stop(sc); + return 0; +} + + +/* Additional hooks for testing. */ + +static int +bcm5821_dump_cc1 (uint32_t *cc) +{ + int i; + unsigned op = G_CC_OPCODE(cc[0]); + unsigned cc_words = G_CC_LEN(cc[0])/4; + int chain_out; /* Whether the output is chained or fixed */ + + chain_out = 1; /* default */ + + switch (op) { + + case K_SSL_MAC: + xprintf("(SSL_MAC)\n"); + for (i = 0; i < SSL_MAC_CMD_WORDS; i++) + xprintf(" %2d: %08x\n", i, cc[i]); + chain_out = 0; + break; + + case K_ARC4: + xprintf("(ARCFOUR)\n"); + for (i = 0; i < 3; i++) + xprintf(" %2d: %08x\n", i, cc[i]); + for (i = 0; i < 256/4; i += 4) + xprintf(" %2d: %08x %08x %08x %08x\n", + i+3, cc[i+3], cc[i+4], cc[i+5], cc[i+6]); + break; + + case K_HASH: + xprintf("(HASH)\n"); + for (i = 0; i < 2; i++) + xprintf(" %2d: %08x\n", i, cc[i]); + chain_out = 0; + break; + + case K_TLS_HMAC: + chain_out = 0; + /* fall through */ + + default: /* NYI: K_IPSEC_3DES (5821 only), K_SSL_3DES */ + xprintf("\n"); + for (i = 0; i < cc_words; i++) + xprintf(" %2d: %08x\n", i, cc[i]); + break; + } + + return chain_out; +} + +static int +bcm5821_dump_cc2 (uint32_t *cc) +{ + int i; + unsigned op = G_CC_OPCODE(cc[0]); + unsigned cc_words = G_CC_LEN(cc[0])/4; + int chain_out; /* Whether the output is chained or fixed */ + + chain_out = 1; /* default */ + + switch (op) { + + case K_RNG_DIRECT: + xprintf(" RNG_DIRECT\n"); + chain_out = 0; + for (i = 0; i < 1; i++) + xprintf(" %2d: %08x\n", i, cc[i]); + break; + + case K_RNG_SHA1: + xprintf(" RNG_SHA1\n"); + chain_out = 0; + for (i = 0; i < 1; i++) + xprintf(" %2d: %08x\n", i, cc[i]); + break; + + default: /* NYI: K_DH_*_GEN, K_RSA_*_OP, K_DSA_*, K_MOD_* */ + xprintf(" %04x\n", op); + for (i = 0; i < cc_words; i++) + xprintf(" %2d: %08x\n", i, cc[i]); + break; + } + return chain_out; +} + +static void +bcm5821_dump_pkt (uint32_t *pkt, int port) +{ + uint32_t *cc = PHYS_TO_PTR(PCI_TO_PHYS(pkt[0])); + uint32_t *chain; + int chain_out; + int i, j; + + xprintf(" %2d: %08x ", 0, pkt[0]); + chain_out = (port == 1 ? bcm5821_dump_cc1 : bcm5821_dump_cc2)(cc); + + for (i = 1; i < PD_SIZE/4; i++) { + xprintf(" %2d: %08x\n", i, pkt[i]); + + if (pkt[i] != 0) { + switch (i) { + case 2: + chain = PHYS_TO_PTR(PCI_TO_PHYS(pkt[i])); + for (j = 0; j < CHAIN_WORDS; j++) + xprintf(" %2d: %08x\n", j, chain[j]); + break; + case 6: + if (chain_out) { + chain = PHYS_TO_PTR(PCI_TO_PHYS(pkt[i])); + for (j = 0; j < CHAIN_WORDS; j++) + xprintf(" %2d: %08x\n", j, chain[j]); + } + break; + default: + break; + } + } + } +} + +static void +bcm5821_dump_mcr (uint32_t mcr[], int port) +{ + unsigned i; + unsigned npkts = G_MCR_NUM_PACKETS(mcr[0]); + + xprintf("MCR header %08x at %p:\n", mcr[0], mcr); + for (i = 0; i < npkts; i++) { + xprintf(" packet %d:\n", i+1); + bcm5821_dump_pkt(&mcr[1 + i*(PD_SIZE/4)], port); + } +} + + +static void +bcm5821_show_pkt1 (uint32_t *pkt) +{ + uint32_t *cc = PHYS_TO_PTR(PCI_TO_PHYS(pkt[0])); + unsigned op = G_CC_OPCODE(cc[0]); + int i; + + switch (op) { + case K_SSL_MAC: + { + uint32_t *hash = PHYS_TO_PTR(PCI_TO_PHYS(pkt[6])); + xprintf("SSL_MAC hash:\n"); + xprintf(" %08x %08x %08x %08x\n", + hash[0], hash[1], hash[2], hash[3]); + xprintf(" %08x\n", hash[4]); + } + break; + case K_TLS_HMAC: + { + uint32_t *hash = PHYS_TO_PTR(PCI_TO_PHYS(pkt[7])); + xprintf("TLS_HMAC hash:\n"); + xprintf(" %08x %08x %08x %08x\n", + hash[0], hash[1], hash[2], hash[3]); + xprintf(" %08x\n", hash[4]); + } + break; + case K_ARC4: + { + uint32_t *output = PHYS_TO_PTR(PCI_TO_PHYS(pkt[5])); + uint32_t *chain = PHYS_TO_PTR(PCI_TO_PHYS(pkt[6])); + uint32_t *update = PHYS_TO_PTR(PCI_TO_PHYS(chain[0])); + + xprintf("ARCFOUR output\n"); + for (i = 0; i < 64; i += 4) + xprintf (" %08x %08x %08x %08x\n", + output[i+0], output[i+1], output[i+2], output[i+3]); + xprintf("ARCFOUR update\n"); + xprintf(" %08x\n", update[0]); + for (i = 0; i < 256/4; i += 4) + xprintf (" %08x %08x %08x %08x\n", + update[i+1], update[i+2], update[i+3], update[i+4]); + } + break; + case K_HASH: + { + uint8_t *digest = PHYS_TO_PTR(PCI_TO_PHYS(pkt[6])); + + xprintf("HASH digest "); + for (i = 0; i < 16; i++) + xprintf("%02x", digest[i]); + xprintf("\n"); + } + break; + default: + break; + } +} + +static void +bcm5821_show_pkt2 (uint32_t *pkt) +{ + uint32_t *cc = PHYS_TO_PTR(PCI_TO_PHYS(pkt[0])); + unsigned op = G_CC_OPCODE(cc[0]); + int i; + + switch (op) { + case K_RNG_DIRECT: + case K_RNG_SHA1: + { + uint32_t *output = PHYS_TO_PTR(PCI_TO_PHYS(pkt[5])); + size_t len = V_DBC_DATA_LEN(pkt[7])/sizeof(uint32_t); + + xprintf("RNG output\n"); + for (i = 0; i < len; i += 4) + xprintf (" %08x %08x %08x %08x\n", + output[i+0], output[i+1], output[i+2], output[i+3]); + } + break; + default: + break; + } +} + +static void +bcm5821_show_mcr (uint32_t mcr[], int port) +{ + unsigned i; + unsigned npkts = G_MCR_NUM_PACKETS(mcr[0]); + + xprintf("MCR at %p:\n", mcr); + for (i = 0; i < npkts; i++) { + xprintf("packet %d:\n", i+1); + if (port == 1) + bcm5821_show_pkt1(&mcr[1 + i*(PD_SIZE/4)]); + else + bcm5821_show_pkt2(&mcr[1 + i*(PD_SIZE/4)]); + } +} + + +static uint32_t * +bcm5821_alloc_hash (const uint8_t *msg, size_t msg_len, int swap) +{ + uint32_t *mcr; + uint32_t *cmd; /* always reads at least 64 bytes */ + uint8_t *message; + uint8_t *digest; + int i; + + message = KMALLOC(msg_len, CACHE_LINE_SIZE); + for (i = 0; i < msg_len; i++) + message[i] = msg[i]; + + digest = KMALLOC(16, CACHE_LINE_SIZE); + for (i = 0; i < 16; i++) + digest[i] = 0; + + mcr = KMALLOC(MCR_WORDS(1)*4, CACHE_LINE_SIZE); + mcr[0] = V_MCR_NUM_PACKETS(1); + + cmd = KMALLOC(64, CACHE_LINE_SIZE); /* Always allocate >= 64 bytes */ + cmd[0] = V_CC_OPCODE(K_HASH) | V_CC_LEN(8); + cmd[1] = V_CC_FLAGS(K_HASH_FLAGS_MD5); + + mcr[1] = PHYS_TO_PCI(PTR_TO_PHYS(cmd)); + + /* input fragment */ + mcr[2] = swap ? PHYS_TO_PCI_D(PTR_TO_PHYS(message)) + : PHYS_TO_PCI(PTR_TO_PHYS(message)); + mcr[3] = 0; + mcr[4] = V_DBC_DATA_LEN(msg_len); + + mcr[5] = V_PD_PKT_LEN(msg_len); + + mcr[6] = 0; + mcr[7] = swap ? PHYS_TO_PCI_D(PTR_TO_PHYS(digest)) + : PHYS_TO_PCI(PTR_TO_PHYS(digest)); + mcr[8] = 0; + + return mcr; +} + +static void +bcm5821_free_hash (uint32_t mcr[]) +{ + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[1]))); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[2]))); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[7]))); + + KFREE(mcr); +} + + +static uint32_t * +bcm5821_alloc_hmac (const char *key, int key_len, + const char *msg, int msg_len, + int swap) +{ + uint32_t *message; + uint32_t *cmd; + uint32_t *mcr; + uint32_t *hash; + int i; + + message = KMALLOC(msg_len, CACHE_LINE_SIZE); + memcpy((uint8_t *)message, msg, msg_len); + + mcr = KMALLOC(MCR_WORDS(1)*4, CACHE_LINE_SIZE); + mcr[0] = V_MCR_NUM_PACKETS(1); + + /* packet 1 */ + + cmd = KMALLOC(TLS_HMAC_CMD_WORDS*4, CACHE_LINE_SIZE); + cmd[0] = V_CC_OPCODE(K_TLS_HMAC) | V_CC_LEN(TLS_HMAC_CMD_WORDS*4); + cmd[1] = V_CC_FLAGS(K_HASH_FLAGS_MD5); + + /* XXX This is not correct. The key is used to compute the inner + and outer states. */ + for (i = 2; i < 7; i++) + cmd[i] = 0x36363636; /* XXX MAC write secret */ + cmd[6] = 0x00000000; /* must be zero for SSL */ + for (i = 8; i < 13; i++) + cmd[i] = 0x5c5c5c5c; + cmd[13] = 0; /* seq num */ + cmd[14] = 1; + cmd[15] = 0x03000000 | (msg_len << 8); /* XXX type/len/rsvd */ + + mcr[1] = PHYS_TO_PCI(PTR_TO_PHYS(cmd)); + + /* input fragment */ + mcr[2] = swap ? PHYS_TO_PCI_D(PTR_TO_PHYS(message)) + : PHYS_TO_PCI(PTR_TO_PHYS(message)); + mcr[3] = 0; + mcr[4] = V_DBC_DATA_LEN(msg_len); + + mcr[5] = V_PD_PKT_LEN(msg_len); + + hash = KMALLOC(5*4, CACHE_LINE_SIZE); + for (i = 0; i < 5; i++) + hash[i] = 0; + + mcr[6] = 0; + mcr[7] = swap ? PHYS_TO_PCI_D(PTR_TO_PHYS(hash)) + : PHYS_TO_PCI(PTR_TO_PHYS(hash)); + mcr[8] = 0; + + return mcr; +} + +static void +bcm5821_free_hmac (uint32_t mcr[]) +{ + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[1]))); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[2]))); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[7]))); + + KFREE(mcr); +} + + +static int test_init = 0; + +/* Timing */ + +/* For Pass 1, dedicate an SCD peformance counter to use as a counter + of ZBbus cycles. */ +#include "sb1250_scd.h" +#define ZCTR_MODULUS 0x10000000000LL + +/* The counter is a shared resource that must be reset periodically + since it doesn't roll over. Furthermore, there is a pass one bug + that makes the interrupt unreliable and the final value either all + ones or all zeros. We therefore reset the count when it exceeds + half the modulus. We also assume that intervals of interest + are much less than half the modulus and attempt to adjust for + the reset in zclk_elapsed. */ + +static void +zclk_init(uint64_t val) +{ + *((volatile uint64_t *) UNCADDR(A_SCD_PERF_CNT_0)) = val; + *((volatile uint64_t *) UNCADDR(A_SCD_PERF_CNT_CFG)) = + V_SPC_CFG_SRC0(1) | M_SPC_CFG_ENABLE; +} + +static uint64_t +zclk_get(void) +{ + uint64_t ticks; + + ticks = *((volatile uint64_t *) UNCADDR(A_SCD_PERF_CNT_0)); + if (ticks == 0 || ticks == ZCTR_MODULUS-1) { + ticks = 0; + zclk_init(ticks); + } + else if (ticks >= ZCTR_MODULUS/2) { + ticks -= ZCTR_MODULUS/2; + zclk_init(ticks); /* Ignore the fudge and lose a few ticks */ + } + return ticks; +} + +static uint64_t +zclk_elapsed(uint64_t stop, uint64_t start) +{ + return ((stop >= start) ? stop : stop + ZCTR_MODULUS/2) - start; +} + + +/* Auxiliary functions */ + +static uint32_t * +bcm5821_alloc_composite(int input_size) +{ + uint32_t *input, *output; + uint32_t *cmd; + uint32_t *chain; + uint32_t *mcr; + uint32_t *hash; + uint32_t *update; + uint8_t *arc4_state; + int i; + + input = KMALLOC(input_size, CACHE_LINE_SIZE); + for (i = 0; i < input_size; i++) + ((uint8_t *)input)[i] = i & 0xFF; + output = KMALLOC(input_size + 16, CACHE_LINE_SIZE); + for (i = 0; i < input_size + 16; i++) + ((uint8_t *)output)[i] = 0xFF; + + mcr = KMALLOC(MCR_WORDS(2)*4, CACHE_LINE_SIZE); + mcr[0] = V_MCR_NUM_PACKETS(2); + + /* packet 1 */ + + cmd = KMALLOC(SSL_MAC_CMD_WORDS*4, CACHE_LINE_SIZE); + cmd[0] = V_CC_OPCODE(K_SSL_MAC) | V_CC_LEN(SSL_MAC_CMD_WORDS*4); + cmd[1] = V_CC_FLAGS(K_HASH_FLAGS_MD5); + for (i = 2; i < 6; i++) + cmd[i] = 0x01020304; /* XXX MAC write secret */ + cmd[6] = 0x00000000; /* must be zero for SSL */ + for (i = 7; i < 19; i++) + cmd[i] = 0x36363636; + cmd[19] = 0; /* seq num */ + cmd[20] = 1; + cmd[21] = 0x03000000 | (input_size << 8); /* type/len/rsvd */ + + mcr[1] = PHYS_TO_PCI(PTR_TO_PHYS(cmd)); + + /* input fragment */ + mcr[2] = PHYS_TO_PCI(PTR_TO_PHYS(input)); + mcr[3] = 0; + mcr[4] = V_DBC_DATA_LEN(input_size); + + mcr[5] = V_PD_PKT_LEN(input_size); + + hash = KMALLOC(5*4, CACHE_LINE_SIZE); + for (i = 0; i < 5; i++) + hash[i] = 0; + + mcr[6] = 0; + mcr[7] = PHYS_TO_PCI(PTR_TO_PHYS(hash)); + mcr[8] = 0; + + /* packet 2 */ + + cmd = KMALLOC(ARC4_CMD_WORDS*4, CACHE_LINE_SIZE); + cmd[0] = V_CC_OPCODE(K_ARC4) | V_CC_LEN(ARC4_CMD_WORDS*4); + cmd[1] = M_ARC4_FLAGS_WRITEBACK; + cmd[2] = 0x000100F3; + arc4_state = (uint8_t *)&cmd[3]; + for (i = 0; i < 256; i++) + arc4_state[i] = i; + + mcr[8+1] = PHYS_TO_PCI(PTR_TO_PHYS(cmd)); + + /* input fragment */ + chain = KMALLOC(CHAIN_WORDS*4, CACHE_LINE_SIZE); + + mcr[8+2] = PHYS_TO_PCI(PTR_TO_PHYS(input)); + mcr[8+3] = PHYS_TO_PCI(PTR_TO_PHYS(chain)); + mcr[8+4] = V_DBC_DATA_LEN(input_size); + + /* MAC fragment */ + chain[0] = PHYS_TO_PCI(PTR_TO_PHYS(hash)); + chain[1] = 0; + chain[2] = V_DBC_DATA_LEN(16); + + mcr[8+5] = V_PD_PKT_LEN(input_size + 16); + + /* output fragment */ + chain = KMALLOC(CHAIN_WORDS*4, CACHE_LINE_SIZE); + + mcr[8+6] = PHYS_TO_PCI(PTR_TO_PHYS(output)); + mcr[8+7] = PHYS_TO_PCI(PTR_TO_PHYS(chain)); + mcr[8+8] = V_DBC_DATA_LEN(input_size + 16); + + update = KMALLOC(ARC4_STATE_WORDS*4, CACHE_LINE_SIZE); + for (i = 0; i < ARC4_STATE_WORDS; i++) + update[i] = 0xFFFFFFFF; + + /* output update */ + chain[0] = PHYS_TO_PCI(PTR_TO_PHYS(update)); + chain[1] = 0; + chain[2] = V_DBC_DATA_LEN(ARC4_STATE_WORDS*4); /* not actually used */ + + return mcr; +} + +static void +bcm5821_free_composite (uint32_t mcr[]) +{ + uint32_t *chain; + + /* packet 1 */ + + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[1]))); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[2]))); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[7]))); + + /* packet 2 */ + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[8+1]))); + /* mcr[8+2] already freed */ + chain = PHYS_TO_PTR(PCI_TO_PHYS(mcr[8+3])); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(chain[0]))); KFREE(chain); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(mcr[8+6]))); + chain = PHYS_TO_PTR(PCI_TO_PHYS(mcr[8+7])); + KFREE(PHYS_TO_PTR(PCI_TO_PHYS(chain[0]))); KFREE(chain); + + KFREE(mcr); +} + + +static void +flush_l2(void) +{ + /* Temporary hack: churn through all of L2 */ + volatile uint64_t *lomem; + uint64_t t; + int i; + + lomem = (uint64_t *)(0xFFFFFFFF80000000LL); /* kseg0 @ 0 */ + t = 0; + for (i = 0; i < (512/8)*1024; i++) + t ^= lomem[i]; +} + +#ifdef IRQ +static void +bcm5821_interrupt(void *ctx) +{ +} +#endif + + +#define POOL_SIZE 4 +#define MCR_QUEUE_DEPTH 2 + +static int +bcm5821_composite (bcm5821_state_t *sc, size_t len, int trials) +{ + uint32_t *mcr[POOL_SIZE]; + uint32_t status; + uint64_t start, stop, ticks; + uint64_t tpb, Mbs; + int i; + int next, last, run; + + for (i = 0; i < POOL_SIZE; i++) + mcr[i] = bcm5821_alloc_composite(len); + + (void)bcm5821_dump_mcr; /*bcm5821_dump_mcr(mcr[0], 1);*/ + + next = last = 0; + run = 0; + + /* Force all descriptors and buffers out of L1 */ + cfe_flushcache(CFE_CACHE_FLUSH_D); + (void)flush_l2; /* XXX for now */ + + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ + status = READCSR(sc, R_DMA_STAT); + + for (i = 0; i < 1000; i++) { + status = READCSR(sc, R_DMA_STAT); + if ((status & M_DMA_STAT_MCR1_FULL) == 0) + break; + cfe_sleep(1); + } + if (i == 1000) { + dumpcsrs(sc, "bcm5821: full bit never clears"); + return -1; + } + +#ifdef IRQ + /* Enable interrupt polling, but the handler is never called. */ + cfe_request_irq(sc->irq, bcm5821_interrupt, NULL, 0, 0); +#endif + + zclk_init(0); /* Time origin is arbitrary. */ + start = zclk_get(); + + /* MCR ports are double buffered. */ + for (i = 0; i < MCR_QUEUE_DEPTH; i++) { + while ((READCSR(sc, R_DMA_STAT) & M_DMA_STAT_MCR1_FULL) != 0) + continue; + WRITECSR(sc, R_MCR1, PHYS_TO_PCI(PTR_TO_PHYS(mcr[next]))); + next = (next + 1) % POOL_SIZE; + } + + while (1) { +#ifdef IRQ + while ((_getcause() & M_CAUSE_IP2) == 0) + continue; + + status = READCSR(sc, R_DMA_STAT); + if ((status & M_DMA_STAT_MCR1_INTR) == 0) { + /* This apparently is MCR1_ALL_EMPTY, timing of which is unclear. */ + WRITECSR(sc, R_DMA_STAT, + M_DMA_STAT_DMAERR_INTR | M_DMA_STAT_MCR1_INTR); + continue; + } + + stop = zclk_get(); + WRITECSR(sc, R_DMA_STAT, + M_DMA_STAT_DMAERR_INTR | M_DMA_STAT_MCR1_INTR); +#else + volatile uint32_t *last_mcr = mcr[last]; + + while ((*last_mcr & M_MCR_DONE) == 0) + continue; + + stop = zclk_get(); +#endif + + run++; + if (run == trials) + break; + + while ((READCSR(sc, R_DMA_STAT) & M_DMA_STAT_MCR1_FULL) != 0) + continue; + WRITECSR(sc, R_MCR1, PHYS_TO_PCI(PTR_TO_PHYS(mcr[next]))); + next = (next + 1) % POOL_SIZE; + + /* Clear the DONE and ERROR bits. This will bring one line of + the MCR back into L1. Flush? */ + mcr[last][0] = V_MCR_NUM_PACKETS(2); + last = (last + 1) % POOL_SIZE; + } + +#ifdef IRQ + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ + cfe_free_irq(sc->irq, 0); +#endif + + ticks = zclk_elapsed(stop, start) / trials; + xprintf("bcm5821: Composite %lld ticks for %d bytes, %d packets\n", + ticks, len, trials); + /* Scaling for two decimal places. */ + tpb = (ticks*100) / len; + Mbs = (2000*100)*100 / tpb; + xprintf(" rate %lld.%02lld Mbps\n", Mbs/100, Mbs % 100); + + if (trials == 1) + { + bcm5821_show_mcr(mcr[0], 1); + } + + for (i = 0; i < POOL_SIZE; i++) + bcm5821_free_composite(mcr[i]); + + return 0; +} + + +/* The following code depends on having a separate interrupt per + device, and there are only 4 PCI interrupts. */ +#define MAX_DEVICES 4 + +struct dev_info { + bcm5821_state_t *sc; + uint64_t irq_mask; + int index[MCR_QUEUE_DEPTH]; +}; + + +#define N_DEVICES 2 + +static int +bcm5821_composite2 (bcm5821_state_t *sc0, bcm5821_state_t *sc1, + size_t len, int trials) +{ + uint32_t *mcr[POOL_SIZE]; + uint32_t ring[POOL_SIZE]; + uint32_t status; + uint64_t start, stop, ticks; + uint64_t tpb, Mbs; + int i; + int next, last; + int started, run; + int d; + struct dev_info dev[N_DEVICES]; + uint64_t masks; + bcm5821_state_t *sc; +#ifdef IRQ + volatile uint64_t *irqstat = IMR_POINTER(0, R_IMR_INTERRUPT_SOURCE_STATUS); +#endif + uint64_t pending; + + dev[0].sc = sc0; dev[1].sc = sc1; + + for (i = 0; i < POOL_SIZE; i++) + mcr[i] = bcm5821_alloc_composite(len); + for (i = 0; i < POOL_SIZE; i++) + ring[i] = i; + next = last = 0; + + (void)bcm5821_dump_mcr; /*bcm5821_dump_mcr(mcr[0], 1);*/ + + started = run = 0; + + /* Force all descriptors and buffers out of L1 */ + cfe_flushcache(CFE_CACHE_FLUSH_D); + (void)flush_l2; /* XXX for now */ + + masks = 0; + for (d = 0; d < N_DEVICES; d++) { + sc = dev[d].sc; + dev[d].irq_mask = 1LL << (sc->irq); + masks |= dev[d].irq_mask; + + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ + status = READCSR(sc, R_DMA_STAT); + + for (i = 0; i < 1000; i++) { + status = READCSR(sc, R_DMA_STAT); + if ((status & M_DMA_STAT_MCR1_FULL) == 0) + break; + cfe_sleep(1); + } + + if (i == 1000) { + dumpcsrs(sc, "bcm5821: full bit never clears"); + return -1; + } + +#ifdef IRQ + /* Enable interrupt polling, but the handler is never called. */ + cfe_request_irq(sc->irq, bcm5821_interrupt, NULL, 0, 0); +#endif + } + + stop = 0; /* Keep compiler happy */ + zclk_init(0); /* Time origin is arbitrary. */ + start = zclk_get(); + + for (d = 0; d < N_DEVICES; d++) { + sc = dev[d].sc; + + /* MCR ports are double buffered. */ + for (i = 0; i < 2; i++) { + int index = ring[next]; + while ((READCSR(sc, R_DMA_STAT) & M_DMA_STAT_MCR1_FULL) != 0) + continue; + WRITECSR(sc, R_MCR1, PHYS_TO_PCI(PTR_TO_PHYS(mcr[index]))); + dev[d].index[i] = index; + next = (next + 1) % POOL_SIZE; + started++; + } + } + + while (trials == 0 || run != trials) { +#ifdef IRQ + while ((_getcause() & M_CAUSE_IP2) == 0) + continue; + + pending = *irqstat; +#else + pending = 0; + while (pending == 0) { + for (d = 0; d < N_DEVICES; d++) { + volatile uint32_t *last_mcr = mcr[dev[d].index[0]]; + + if ((*last_mcr & M_MCR_DONE) != 0) + pending |= dev[d].irq_mask; + } + } +#endif + + stop = zclk_get(); + + for (d = 0; d < N_DEVICES; d++) { + if ((dev[d].irq_mask & pending) != 0) { + sc = dev[d].sc; + +#ifdef IRQ + status = READCSR(sc, R_DMA_STAT); + if ((status & M_DMA_STAT_MCR1_INTR) == 0) { + /* Apparently MCR1_ALL_EMPTY, timing of which is unclear. */ + WRITECSR(sc, R_DMA_STAT, + M_DMA_STAT_DMAERR_INTR | M_DMA_STAT_MCR1_INTR); + continue; + } + WRITECSR(sc, R_DMA_STAT, + M_DMA_STAT_DMAERR_INTR | M_DMA_STAT_MCR1_INTR); +#endif + ring[last] = dev[d].index[0]; + /* Clear the DONE and ERROR bits. This will bring one line of + the MCR back into L1. Flush? */ + mcr[ring[last]][0] = V_MCR_NUM_PACKETS(2); + last = (last + 1) % POOL_SIZE; + + run++; + if (run == trials) + break; + + dev[d].index[0] = dev[d].index[1]; + if (trials == 0 || started < trials) { + int index = ring[next]; + while ((READCSR(sc, R_DMA_STAT) & M_DMA_STAT_MCR1_FULL) != 0) + continue; + WRITECSR(sc, R_MCR1, PHYS_TO_PCI(PTR_TO_PHYS(mcr[index]))); + dev[d].index[1] = index; + next = (next + 1) % POOL_SIZE; + started++; + } + } + } + } + + for (d = 0; d < N_DEVICES; d++) { + sc = dev[d].sc; + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ +#ifdef IRQ + cfe_free_irq(sc->irq, 0); +#endif + } + + ticks = zclk_elapsed(stop, start) / trials; + xprintf("bcm5821: Composite %lld ticks for %d bytes, %d packets\n", + ticks, len, trials); + /* Scaling for two decimal places. */ + tpb = (ticks*100) / len; + Mbs = (2000*100)*100 / tpb; + xprintf(" rate %lld.%02lld Mbps\n", Mbs/100, Mbs % 100); + + for (i = 0; i < POOL_SIZE; i++) + bcm5821_free_composite(mcr[i]); + + return 0; +} + + +extern cfe_devctx_t *cfe_handle_table[]; + +int bcm5821_test (int device, int trials); +int +bcm5821_test (int device, int trials) +{ + cfe_devctx_t *ctx = cfe_handle_table[device]; + bcm5821_state_t *sc = ctx->dev_softc; + + if (!test_init) { + zclk_init(0); /* Time origin is arbitrary */ + test_init = 1; + } + + bcm5821_composite(sc, 1472, trials); + + return 0; +} + +int bcm5821_test2 (int device0, int device2, int trials); +int +bcm5821_test2 (int device0, int device1, int trials) +{ + cfe_devctx_t *ctx0 = cfe_handle_table[device0]; + cfe_devctx_t *ctx1 = cfe_handle_table[device1]; + bcm5821_state_t *sc0 = ctx0->dev_softc; + bcm5821_state_t *sc1 = ctx1->dev_softc; + + if (!test_init) { + zclk_init(0); /* Time origin is arbitrary */ + test_init = 1; + } + + bcm5821_composite2(sc0, sc1, 1472, trials); + + return 0; +} + + +static int +bcm5821_hash_md5 (bcm5821_state_t *sc, const char *msg) +{ + size_t len = strlen(msg); + uint32_t *mcr; + uint32_t status; + int i; + int swap = (sc->device == K_PCI_ID_BCM5820); + + mcr = bcm5821_alloc_hash(msg, len, swap); + + /* bcm5821_dump_mcr(mcr, 1); */ + + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ + status = READCSR(sc, R_DMA_STAT); + + for (i = 0; i < 1000; i++) { + status = READCSR(sc, R_DMA_STAT); + if ((status & M_DMA_STAT_MCR1_FULL) == 0) + break; + cfe_sleep(1); + } + if (i == 1000) { + dumpcsrs(sc, "bcm5821: full bit never clears"); + return -1; + } + + WRITECSR(sc, R_MCR1, PHYS_TO_PCI(PTR_TO_PHYS(mcr))); + + for (i = 0; i < 1000; i++) { +#ifdef IRQ + status = READCSR(sc, R_DMA_STAT); + if ((status & M_DMA_STAT_MCR1_INTR) != 0) + break; +#else + if ((mcr[0] & M_MCR_DONE) != 0) + break; +#endif + cfe_sleep(1); + } + if (i == 1000) { + dumpcsrs(sc, "bcm5821: done bit never sets"); + /*return -1;*/ + } + + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ + + /* bcm5821_dump_mcr(mcr, 1); */ + + bcm5821_show_mcr(mcr, 1); + + bcm5821_free_hash(mcr); + + return 0; +} + + +static int +bcm5821_hmac_md5 (bcm5821_state_t *sc, + const uint8_t key[], size_t key_len, + const uint8_t data[], size_t data_len) +{ + uint32_t *mcr; + uint32_t status; + int i; + int swap = (sc->device == K_PCI_ID_BCM5820); + + mcr = bcm5821_alloc_hmac(key, key_len, data, data_len, swap); + + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ + status = READCSR(sc, R_DMA_STAT); + + for (i = 0; i < 1000; i++) { + status = READCSR(sc, R_DMA_STAT); + if ((status & M_DMA_STAT_MCR1_FULL) == 0) + break; + cfe_sleep(1); + } + if (i == 1000) { + dumpcsrs(sc, "bcm5821: full bit never clears"); + return -1; + } +#if 0 /* disable: work in progress */ + + while ((READCSR(sc, R_DMA_STAT) & M_DMA_STAT_MCR1_FULL) != 0) + continue; + WRITECSR(sc, R_MCR1, PHYS_TO_PCI(PTR_TO_PHYS(mcr))); + + for (i = 0; i < 1000; i++) { + if ((mcr[0] & M_MCR_DONE) != 0) + break; + cfe_sleep(1); + } + if (i == 1000) { + dumpcsrs(sc, "bcm5821: done bit never sets"); + return -1; + } + + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ + + bcm5821_show_mcr(mcr, 1); +#endif + + bcm5821_free_hmac(mcr); + return 0; +} + +/* Sanity check on the implementation using RFC test suites. */ + +int bcm5821_check (int device); +int +bcm5821_check (int device) +{ + static unsigned char k1[16] = { + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b + }; + static unsigned char m1[] = "Hi There"; + + static unsigned char k2[] = "Jefe"; + static unsigned char m2[] = "what do ya want for nothing?"; + + static unsigned char k3[16] = { + 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, + 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA + }; + static unsigned char m3[50] = { + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD + }; + + cfe_devctx_t *ctx = cfe_handle_table[device]; + bcm5821_state_t *sc = ctx->dev_softc; + + if (!test_init) { + zclk_init(0); /* Time origin is arbitrary */ + test_init = 1; + } + +#if 0 /* 5821 cannot handle 0-length fragments (see Appendix B) */ + bcm5821_hash_md5(sc, ""); +#endif + bcm5821_hash_md5(sc, "a"); + bcm5821_hash_md5(sc, "abc"); + bcm5821_hash_md5(sc, "message digest"); + bcm5821_hash_md5(sc, "abcdefghijklmnopqrstuvwxyz"); + bcm5821_hash_md5(sc, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); + bcm5821_hash_md5(sc, "12345678901234567890123456789012345678901234567890123456789012345678901234567890"); + + bcm5821_hmac_md5(sc, k1, sizeof(k1), m1, strlen(m1)); + bcm5821_hmac_md5(sc, k2, strlen(k2), m2, strlen(m2)); + bcm5821_hmac_md5(sc, k3, sizeof(k3), m3, sizeof(m3)); + + return 0; +} + +/* Output of md5 test suite (md5 -x) + +MD5 test suite: +MD5 ("") = d41d8cd98f00b204e9800998ecf8427e +MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 +MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 +MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 +MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b +MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = d174ab98d277d9f5a5611c2c9f419d9f +MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a + +*/ + +/* HMAC-MD5 test suite + +Test Vectors (Trailing '\0' of a character string not included in test): + + key = 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b + key_len = 16 bytes + data = "Hi There" + data_len = 8 bytes + digest = 0x9294727a3638bb1c13f48ef8158bfc9d + + key = "Jefe" + data = "what do ya want for nothing?" + data_len = 28 bytes + digest = 0x750c783e6ab0b503eaa86e310a5db738 + + key = 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + key_len 16 bytes + data = 0xDDDDDDDDDDDDDDDDDDDD... + ..DDDDDDDDDDDDDDDDDDDD... + ..DDDDDDDDDDDDDDDDDDDD... + ..DDDDDDDDDDDDDDDDDDDD... + ..DDDDDDDDDDDDDDDDDDDD + data_len = 50 bytes + digest = 0x56be34521d144c88dbb8c733f0e8b3f6 + +*/ +#endif /* !_BCM14XX_ */ + + +#if 0 /* ---------- XXX still under construction XXX ---------- */ + +static uint32_t * +bcm5821_alloc_rng (int output_size) +{ + uint32_t *output; + uint32_t *mcr; + uint32_t *cmd; + int i; + + output = (uint32_t *)KMALLOC(output_size, CACHE_LINE_SIZE); + for (i = 0; i < output_size/sizeof(uint32_t); i++) + output[i] = 0xDEADBEEF; + + mcr = KMALLOC(MCR_WORDS(1)*4, CACHE_LINE_SIZE); + mcr[0] = V_MCR_NUM_PACKETS(1); + + cmd = KMALLOC(16, CACHE_LINE_SIZE); /* Always allocate >= 64 bytes */ + cmd[0] = V_CC_OPCODE(K_RNG_DIRECT) | V_CC_LEN(4); + + mcr[1] = PHYS_TO_PCI(PTR_TO_PHYS(cmd)); + + /* input fragment */ + mcr[2] = 0; + mcr[3] = 0; + mcr[4] = V_DBC_DATA_LEN(0); + + mcr[5] = V_PD_PKT_LEN(output_size); + + /* output fragment */ + mcr[6] = PHYS_TO_PCI(PTR_TO_PHYS(output)); + mcr[7] = 0; + mcr[8] = V_DBC_DATA_LEN(sizeof(output)); + + return mcr; +} + + +static uint32_t * +bcm5821_alloc_ssl_mac (int msg_size) +{ + uint32_t *message; + uint32_t *cmd; + uint32_t *mcr; + uint32_t *hash; + int i; + + message = KMALLOC(msg_size, CACHE_LINE_SIZE); + for (i = 0; i < msg_size; i++) + ((uint8_t *)message)[i] = i & 0xFF; /* was 0xDEADBEEF */ + + mcr = KMALLOC(MCR_WORDS(1)*4, CACHE_LINE_SIZE); + mcr[0] = V_MCR_NUM_PACKETS(1); + + /* packet 1 */ + + cmd = KMALLOC(SSL_MAC_CMD_WORDS*4, CACHE_LINE_SIZE); + cmd[0] = V_CC_OPCODE(K_SSL_MAC) | V_CC_LEN(SSL_MAC_CMD_WORDS*4); + cmd[1] = V_CC_FLAGS(K_HASH_FLAGS_MD5); + for (i = 2; i < 6; i++) + cmd[i] = 0x01020304; /* XXX MAC write secret */ + cmd[6] = 0x00000000; /* must be zero for SSL */ + for (i = 7; i < 19; i++) + cmd[i] = 0x36363636; + cmd[19] = 0; /* seq num */ + cmd[20] = 1; + cmd[21] = 0x03000000 | (msg_size << 8); /* type/len/rsvd */ + + mcr[1] = PHYS_TO_PCI(PTR_TO_PHYS(cmd)); + + /* input fragment */ + mcr[2] = PHYS_TO_PCI(PTR_TO_PHYS(message)); + mcr[3] = 0; + mcr[4] = V_DBC_DATA_LEN(msg_size); + + mcr[5] = V_PD_PKT_LEN(msg_size); + + hash = KMALLOC(5*4, CACHE_LINE_SIZE); + for (i = 0; i < 5; i++) + hash[i] = 0; + + mcr[6] = 0; + mcr[7] = PHYS_TO_PCI(PTR_TO_PHYS(hash)); + mcr[8] = 0; + + return mcr; +} + +static uint32_t * +bcm5821_alloc_arc4 (int input_size) +{ + uint32_t *mcr; + uint32_t cmd[3 + 256/4]; + uint32_t input[64], output[64]; + uint32_t chain[3]; + uint32_t update[1 + 256/4]; + uint32_t status; + uint8_t *arc4_state; + int i; + + xprintf("\nARC4\n"); + + status = READCSR(sc, R_DMA_STAT); + WRITECSR(sc, R_DMA_STAT, status); /* clear pending bits */ + status = READCSR(sc, R_DMA_STAT); + + for (i = 0; i < 64; i++) +#if 0 + input[i] = (i << 24) | ((i+1) << 16) | ((i+2) << 8) | (i+3); +#else + input[i] = 0x5555AAAA; +#endif + for (i = 0; i < 64; i++) + output[i] = 0xDEADBEEF; + for (i = 0; i < 1 + 256/4; i++) + update[i] = 0xFEEDFACE; + + cmd[0] = V_CC_OPCODE(K_ARC4) | V_CC_LEN(sizeof(cmd)); + cmd[1] = M_ARC4_FLAGS_WRITEBACK; +#if 0 + cmd[2] = 0x000100F3; +#else + cmd[2] = 0x00000000; +#endif + arc4_state = (uint8_t *)&cmd[3]; + for (i = 0; i < 256; i++) + arc4_state[i] = i; + + mcr[0] = V_MCR_NUM_PACKETS(1); + + /* packet 1 */ + mcr[1] = PHYS_TO_PCI(PTR_TO_PHYS(cmd)); + + /* input fragment */ + mcr[2] = PHYS_TO_PCI(PTR_TO_PHYS(input)); + mcr[3] = 0; + mcr[4] = V_DBC_DATA_LEN(sizeof(input)); + + mcr[5] = V_PD_PKT_LEN(sizeof(input)); + + /* output fragment */ + mcr[6] = PHYS_TO_PCI(PTR_TO_PHYS(output)); + mcr[7] = PHYS_TO_PCI(PTR_TO_PHYS(chain)); + mcr[8] = V_DBC_DATA_LEN(sizeof(output)); + + /* output update */ + chain[0] = PHYS_TO_PCI(PTR_TO_PHYS(update)); + chain[1] = 0; + chain[2] = V_DBC_DATA_LEN(sizeof(update)); /* not actually used */ + + return mcr; +} +#endif /* 0 */ diff --git a/cfe/cfe/dev/dev_dc21143.c b/cfe/cfe/dev/dev_dc21143.c new file mode 100644 index 0000000..f133cbb --- /dev/null +++ b/cfe/cfe/dev/dev_dc21143.c @@ -0,0 +1,2388 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * DC2114x Ethernet Driver File: dev_dc21143.c + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "sbmips.h" + +#ifndef _SB_MAKE64 +#define _SB_MAKE64(x) ((uint64_t)(x)) +#endif +#ifndef _SB_MAKEMASK1 +#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n)) +#endif + +#include "lib_types.h" +#include "lib_hssubr.h" +#include "lib_malloc.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "lib_queue.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_irq.h" + +#include "pcivar.h" +#include "pcireg.h" + +#include "dc21143.h" +#include "mii.h" + +/* This is a driver for specific configurations of the DC21041, + DC21140A and DC21143, not a generic Tulip driver. The prefix + "tulip_" is used to indicate generic Tulip functions, while + "dc21041_", "dc21140_" or "dc21143_" indicates functions specific + to a chip variant. + + The 21041 driver assumes a 10BT HD interface, since autonegotiation + is known to be broken in the early revisons of that chip. Example + cards come from DEC. + + The 21140 driver assumes that the PHY uses a standard MII interface + for both 100BT and 10BT. Example cards come from DEC (National DP83840 + Twister PHY) and Netgear (Level One PHY). + + The 21143 driver assumes that the PHY uses the SYM ("5 wire") interface + for 100BT with pass-through for 10BT. Example cards come from DEC + (MicroLinear ML6694 PHY) and Znyx (Kendin KS8761 PHY). There is no + support for MII or AUI interfaces. + + This SB1250 version takes advantage of DMA coherence and uses + "preserve bit lanes" addresses for all accesses that cross the + ZBbus-PCI bridge. */ + +#ifndef TULIP_DEBUG +#define TULIP_DEBUG 0 +#endif + +#ifndef TULIP_TUNE +#define TULIP_TUNE 1 +#endif + +#define ENET_ADDR_LEN 6 /* size of an ethernet address */ +#define MAX_ETHER_PACK 1518 /* max size of a packet */ +#define CRC_SIZE 4 /* size of CRC field */ + +/* The following must be a multiple of 4. In late versions of the + tulip, the rx DMA engine also apparently writes beyond 1520 bytes + for received packets > 1516 bytes (WriteInvalidate only?). */ +#define ETH_BUFFER_SIZE 1536 + +typedef struct eth_pkt_s { + queue_t next; + void *devctx; + unsigned char *buffer; + unsigned int flags; + int length; + /* packet data goes here, should always be longword aligned */ +} eth_pkt_t; + +/* packet flags */ +#define ETH_TX_SETUP 1 + +static void +show_packet(eth_pkt_t *pkt) +{ + int i; + int n = (pkt->length < 32 ? pkt->length : 32); + + xprintf("[%4d]:", pkt->length); + for (i = 0; i < n; i++) { + if (i % 4 == 0) + xprintf(" "); + xprintf("%02x", pkt->buffer[i]); + } + xprintf("\n"); +} + + +/* Descriptor structures */ + +typedef struct rx_dscr { + uint32_t rxd_flags; + uint32_t rxd_bufsize; + uint32_t rxd_bufaddr1; + uint32_t rxd_bufaddr2; +} rx_dscr; + +typedef struct tx_dscr { + uint32_t txd_flags; + uint32_t txd_bufsize; + uint32_t txd_bufaddr1; + uint32_t txd_bufaddr2; +} tx_dscr; + +/* CAM structure */ + +typedef union { + struct { + uint32_t physical[CAM_PERFECT_ENTRIES][3]; + } p; + struct { + uint32_t hash[32]; + uint32_t mbz[7]; + uint32_t physical[3]; + } h; +} tulip_cam; + + +typedef enum { + eth_state_uninit, + eth_state_setup, + eth_state_off, + eth_state_on, + eth_state_broken +} eth_state_t; + +#define ETH_PKTPOOL_SIZE 20 +#define ETH_PKTBUF_SIZE (sizeof(eth_pkt_t) + ((ETH_BUFFER_SIZE+7)&~7)) + +typedef struct tulip_softc { + uint32_t membase; + uint8_t irq; /* interrupt mapping (not currently used) */ + pcitag_t tag; /* tag for configuration registers */ + + uint8_t hwaddr[ENET_ADDR_LEN]; + uint16_t device; /* chip device code */ + uint8_t revision; /* chip revision and step (Table 3-7) */ + + /* current state */ + eth_state_t state; + int bus_errors; + + /* These fields are the chip startup values. */ +// uint16_t media; /* media type */ + uint32_t opmode; /* operating mode */ + uint32_t intmask; /* interrupt mask */ + + /* This field is set before calling dc2114x_hwinit */ + int linkspeed; /* encoding from cfe_ioctl */ + + /* Packet free list */ + queue_t freelist; + uint8_t *pktpool; + queue_t rxqueue; + + /* The descriptor tables */ + uint8_t *rxdscrmem; /* receive descriptors */ + uint8_t *txdscrmem; /* transmit descriptors */ + + eth_pkt_t **rxdscrinfo; + eth_pkt_t **txdscrinfo; + + /* These fields keep track of where we are in tx/rx processing */ + volatile rx_dscr *rxdscr_start; /* beginning of ring */ + volatile rx_dscr *rxdscr_end; /* end of ring */ + volatile rx_dscr *rxdscr_remove; /* next one we expect tulip to use */ + volatile rx_dscr *rxdscr_add; /* next place to put a buffer */ + int rxdscr_onring; + + volatile tx_dscr *txdscr_start; /* beginning of ring */ + volatile tx_dscr *txdscr_end; /* end of ring */ + volatile tx_dscr *txdscr_remove; /* next one we will use for tx */ + volatile tx_dscr *txdscr_add; /* next place to put a buffer */ + + /* These fields describe the PHY */ + int mii_addr; + +} tulip_softc; + + +/* Driver parameterization */ + +#define MAXRXDSCR 16 +#define MAXTXDSCR 16 +#define MINRXRING 8 + +#define MEDIA_UNKNOWN 0 +#define MEDIA_AUI 1 +#define MEDIA_BNC 2 +#define MEDIA_UTP_FULL_DUPLEX 3 +#define MEDIA_UTP_NO_LINK_TEST 4 +#define MEDIA_UTP 5 + +/* Prototypes */ + +static void tulip_ether_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +/* Address mapping macros */ + +/* Note that PHYSADDR only works with 32-bit addresses, but the + so does the Tulip. */ +#define PHYSADDR(sc,x) (K0_TO_PHYS((uintptr_t)(x))) + +#define PCIADDR(a,b) ((uint32_t) (b)) +#define PCIADDRX(a,b) ((uint32_t) (b) | 0x20000000) +#define PCI_TO_CPU(a) (a) + +#if __long64 +#define READCSR(sc,csr) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED(PCI_TO_CPU((sc)->membase)+(csr))))) + +#define WRITECSR(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED(PCI_TO_CPU((sc)->membase)+(csr)))) = (val)) + +#else +#define READCSR(sc,csr) \ + (hs_read32(PHYS_TO_XKSEG_UNCACHED(PCI_TO_CPU((sc)->membase)+(csr)))) + +#define WRITECSR(sc,csr,val) \ + (hs_write32(PHYS_TO_XKSEG_UNCACHED(PCI_TO_CPU((sc)->membase)+(csr)), \ + (val))) + +#endif + + +#define RESET_ADAPTER(sc) \ + { \ + WRITECSR((sc), R_CSR_BUSMODE, M_CSR0_SWRESET); \ + cfe_sleep(CFE_HZ/10); \ + } + + +/* Debugging */ + +static void +dumpstat(tulip_softc *sc) +{ + xprintf("-- CSR 5 = %08X CSR 6 = %08x\n", + READCSR(sc, R_CSR_STATUS), READCSR(sc, R_CSR_OPMODE)); +} + +static void +dumpcsrs(tulip_softc *sc) +{ + int idx; + + xprintf("-------------\n"); + for (idx = 0; idx < 16; idx++) { + xprintf("CSR %2d = %08X\n", idx, READCSR(sc, idx*8)); + } + xprintf("-------------\n"); +} + + +/* Packet management */ + +/* ********************************************************************* + * ETH_ALLOC_PKT(s) + * + * Allocate a packet from the free list. + * + * Input parameters: + * s - eth structure + * + * Return value: + * pointer to packet structure, or NULL if none available + ********************************************************************* */ +#define ETHPKT_ALIGN ((uintptr_t) 4) + +static eth_pkt_t * +eth_alloc_pkt(tulip_softc *s) +{ + uintptr_t addr; + eth_pkt_t *pkt; + + pkt = (eth_pkt_t *) q_deqnext(&s->freelist); + if (!pkt) return NULL; + + addr = (uintptr_t) (pkt+1); + if (addr & (ETHPKT_ALIGN-1)) { + addr = (addr + ETHPKT_ALIGN) & ~(ETHPKT_ALIGN-1); + } + + pkt->buffer = (uint8_t *) addr; + pkt->length = ETH_BUFFER_SIZE; + pkt->flags = 0; + + return pkt; +} + + +/* ********************************************************************* + * ETH_FREE_PKT(s,pkt) + * + * Return a packet to the free list + * + * Input parameters: + * s - sbmac structure + * pkt - packet to return + * + * Return value: + * nothing + ********************************************************************* */ +static void +eth_free_pkt(tulip_softc *s, eth_pkt_t *pkt) +{ + q_enqueue(&s->freelist, &pkt->next); +} + + +/* ********************************************************************* + * ETH_INITFREELIST(s) + * + * Initialize the buffer free list for this mac. The memory + * allocated to the free list is carved up and placed on a linked + * list of buffers for use by the mac. + * + * Input parameters: + * s - eth structure + * + * Return value: + * nothing + ********************************************************************* */ +static void +eth_initfreelist(tulip_softc *s) +{ + int idx; + unsigned char *ptr; + eth_pkt_t *pkt; + + q_init(&s->freelist); + + ptr = s->pktpool; + for (idx = 0; idx < ETH_PKTPOOL_SIZE; idx++) { + pkt = (eth_pkt_t *) ptr; + eth_free_pkt(s, pkt); + ptr += ETH_PKTBUF_SIZE; + } +} + + +/* Descriptor ring management */ + +static int +tulip_add_rcvbuf(tulip_softc *sc, eth_pkt_t *pkt) +{ + volatile rx_dscr *rxd; + volatile rx_dscr *nextrxd; + int idx; + uint32_t flags = 0; + + rxd = sc->rxdscr_add; + + /* Figure out where the next descriptor will go */ + nextrxd = rxd+1; + if (nextrxd == sc->rxdscr_end) { + nextrxd = sc->rxdscr_start; + flags = M_RDES1_ENDOFRING; + } + + /* + * If the next one is the same as our remove pointer, + * the ring is considered full. (it actually has room for + * one more, but we reserve the remove == add case for "empty") + */ + if (nextrxd == sc->rxdscr_remove) return -1; + + /* Save this packet pointer. */ + idx = rxd - sc->rxdscr_start; + sc->rxdscrinfo[idx] = pkt; + + rxd->rxd_bufsize = V_RDES1_BUF1SIZE(ETH_BUFFER_SIZE) | flags; + rxd->rxd_bufaddr1 = PCIADDRX(sc, PHYSADDR(sc, pkt->buffer)); + rxd->rxd_bufaddr2 = 0; + rxd->rxd_flags = M_RDES0_OWNADAP; + + /* success, advance the pointer */ + sc->rxdscr_add = nextrxd; + sc->rxdscr_onring++; + + return 0; +} + +static void +tulip_fillrxring(tulip_softc *sc) +{ + eth_pkt_t *pkt; + + while (sc->rxdscr_onring < MINRXRING) { + pkt = eth_alloc_pkt(sc); + if (pkt == NULL) { + /* could not allocate a buffer */ + break; + } + if (tulip_add_rcvbuf(sc, pkt) != 0) { + /* could not add buffer to ring */ + eth_free_pkt(sc, pkt); + break; + } + } +} + + +/* ********************************************************************* + * TULIP_RX_CALLBACK(sc, pkt) + * + * Receive callback routine. This routine is invoked when a + * buffer queued for receives is filled. In this simple driver, + * all we do is add the packet to a per-MAC queue for later + * processing, and try to put a new packet in the place of the one + * that was removed from the queue. + * + * Input parameters: + * sc - interface + * ptk - packet context (sbeth_pkt structure) + * + * Return value: + * nothing + ********************************************************************* */ +static void +tulip_rx_callback(tulip_softc *sc, eth_pkt_t *pkt) +{ + if (TULIP_DEBUG) show_packet(pkt); /* debug */ + + q_enqueue(&sc->rxqueue, &pkt->next); + + tulip_fillrxring(sc); +} + + +static void +tulip_procrxring(tulip_softc *sc) +{ + volatile rx_dscr *rxd; + eth_pkt_t *pkt; + eth_pkt_t *newpkt; + int idx; + uint32_t flags; + + for (;;) { + rxd = (volatile rx_dscr *) sc->rxdscr_remove; + idx = rxd - sc->rxdscr_start; + + flags = rxd->rxd_flags; + + if (flags & M_RDES0_OWNADAP) { + /* end of ring, no more packets */ + break; + } + + pkt = sc->rxdscrinfo[idx]; + + /* Drop error packets */ + if (flags & M_RDES0_ERRORSUM) { + xprintf("DC2114x: rx error %04X\n", flags & 0xFFFF); + tulip_add_rcvbuf(sc, pkt); + goto next; + } + + /* Pass up the packet */ + pkt->length = G_RDES0_FRAMELEN(flags) - CRC_SIZE; + tulip_rx_callback(sc, pkt); + + /* put a buffer back on the ring to replace this one */ + newpkt = eth_alloc_pkt(sc); + if (newpkt) tulip_add_rcvbuf(sc, newpkt); + +next: + /* update the pointer, accounting for buffer wrap. */ + rxd++; + if (rxd == sc->rxdscr_end) + rxd = sc->rxdscr_start; + + sc->rxdscr_remove = (rx_dscr *) rxd; + sc->rxdscr_onring--; + } +} + + +static int +tulip_add_txbuf(tulip_softc *sc, eth_pkt_t *pkt) +{ + volatile tx_dscr *txd; + volatile tx_dscr *nexttxd; + int idx; + uint32_t bufsize = 0; + + txd = sc->txdscr_add; + + /* Figure out where the next descriptor will go */ + nexttxd = (txd+1); + if (nexttxd == sc->txdscr_end) { + nexttxd = sc->txdscr_start; + bufsize = M_TDES1_ENDOFRING; + } + + /* If the next one is the same as our remove pointer, + the ring is considered full. (it actually has room for + one more, but we reserve the remove == add case for "empty") */ + + if (nexttxd == sc->txdscr_remove) return -1; + + /* Save this packet pointer. */ + idx = txd - sc->txdscr_start; + sc->txdscrinfo[idx] = pkt; + + bufsize |= V_TDES1_BUF1SIZE(pkt->length) | + M_TDES1_FIRSTSEG | M_TDES1_LASTSEG | M_TDES1_INTERRUPT; + if (pkt->flags & ETH_TX_SETUP) { + /* For a setup packet, FIRSTSEG and LASTSEG should be clear (!) */ + bufsize ^= M_TDES1_SETUP | M_TDES1_FIRSTSEG | M_TDES1_LASTSEG; + } + txd->txd_bufsize = bufsize; + txd->txd_bufaddr1 = PCIADDRX(sc, PHYSADDR(sc, pkt->buffer)); + txd->txd_bufaddr2 = 0; + txd->txd_flags = M_TDES0_OWNADAP; + + /* success, advance the pointer */ + sc->txdscr_add = nexttxd; + + return 0; +} + + +static int +tulip_transmit(tulip_softc *sc,eth_pkt_t *pkt) +{ + tulip_add_txbuf(sc, pkt); + + WRITECSR(sc, R_CSR_TXPOLL, 1); + return 0; +} + + +static void +tulip_proctxring(tulip_softc *sc) +{ + volatile tx_dscr *txd; + eth_pkt_t *pkt; + int idx; + uint32_t flags; + + for (;;) { + txd = (volatile tx_dscr *) sc->txdscr_remove; + idx = txd - sc->txdscr_start; + + flags = txd->txd_flags; + + if (txd == sc->txdscr_add) { + /* ring is empty, no buffers to process */ + break; + } + + if (flags & M_RDES0_OWNADAP) { + /* Reached a packet still being transmitted */ + break; + } + + /* Check for a completed setup packet */ + pkt = sc->txdscrinfo[idx]; + if (pkt->flags & ETH_TX_SETUP) { + if (sc->state == eth_state_setup) { + /* check flag bits */ + sc->state = eth_state_on; + } + pkt->flags &=~ ETH_TX_SETUP; + } + + /* Just free the packet */ + eth_free_pkt(sc, pkt); + + /* update the pointer, accounting for buffer wrap. */ + txd++; + if (txd == sc->txdscr_end) + txd = sc->txdscr_start; + + sc->txdscr_remove = (tx_dscr *) txd; + } +} + + +static void +tulip_initrings(tulip_softc *sc) +{ + volatile tx_dscr *txd; + volatile rx_dscr *rxd; + + /* Claim ownership of all transmit descriptors */ + + for (txd = sc->txdscr_start; txd != sc->txdscr_end; txd++) + txd->txd_flags = 0; + for (rxd = sc->rxdscr_start; rxd != sc->rxdscr_end; rxd++) + rxd->rxd_flags = 0; + + /* Init the ring pointers */ + + sc->txdscr_add = sc->txdscr_remove = sc->txdscr_start; + sc->rxdscr_add = sc->rxdscr_remove = sc->rxdscr_start; + sc->rxdscr_onring = 0; + + /* Add stuff to the receive ring */ + + tulip_fillrxring(sc); +} + + +static int +tulip_init(tulip_softc *sc) +{ + /* Allocate descriptor rings and lookaside lists */ + sc->rxdscrmem = KMALLOC(MAXRXDSCR*sizeof(rx_dscr),sizeof(rx_dscr)); + sc->txdscrmem = KMALLOC(MAXTXDSCR*sizeof(tx_dscr),sizeof(tx_dscr)); + sc->rxdscrinfo = KMALLOC(MAXRXDSCR*sizeof(eth_pkt_t *),sizeof(eth_pkt_t)); + sc->txdscrinfo = KMALLOC(MAXTXDSCR*sizeof(eth_pkt_t *),sizeof(eth_pkt_t)); + + /* Allocate buffer pool */ + sc->pktpool = KMALLOC(ETH_PKTPOOL_SIZE*ETH_PKTBUF_SIZE, 0); + eth_initfreelist(sc); + q_init(&sc->rxqueue); + + /* Fill in pointers to the rings */ + sc->rxdscr_start = (rx_dscr *) (sc->rxdscrmem); + sc->rxdscr_end = sc->rxdscr_start + MAXRXDSCR; + sc->rxdscr_add = sc->rxdscr_start; + sc->rxdscr_remove = sc->rxdscr_start; + sc->rxdscr_onring = 0; + + sc->txdscr_start = (tx_dscr *) (sc->txdscrmem); + sc->txdscr_end = sc->txdscr_start + MAXTXDSCR; + sc->txdscr_add = sc->txdscr_start; + sc->txdscr_remove = sc->txdscr_start; + + tulip_initrings(sc); + + return 0; +} + + +static void +tulip_resetrings(tulip_softc *sc) +{ + volatile tx_dscr *txd; + volatile rx_dscr *rxd; + int idx; + + /* Free already-sent descriptors and buffers */ + tulip_proctxring(sc); + + /* Free any pending but unsent */ + txd = (volatile tx_dscr *) sc->txdscr_remove; + while (txd != sc->txdscr_add) { + idx = txd - sc->txdscr_start; + eth_free_pkt(sc, sc->txdscrinfo[idx]); + txd->txd_flags &=~ M_TDES0_OWNADAP; + + txd++; + if (txd == sc->txdscr_end) + txd = sc->txdscr_start; + } + sc->txdscr_add = sc->txdscr_remove; + + /* Discard any received packets as well as all free buffers */ + rxd = (volatile rx_dscr *) sc->rxdscr_remove; + while (rxd != sc->rxdscr_add) { + idx = rxd - sc->rxdscr_start; + eth_free_pkt(sc, sc->rxdscrinfo[idx]); + rxd->rxd_flags &=~ M_RDES0_OWNADAP; + + rxd++; + if (rxd == sc->rxdscr_end) + rxd = sc->rxdscr_start; + sc->rxdscr_onring--; + } + + /* Reestablish the initial state. */ + tulip_initrings(sc); +} + + +/* CRCs */ + +#define IEEE_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- either endian */ + +static uint32_t +tulip_crc32(const uint8_t *databuf, unsigned int datalen) +{ + unsigned int idx, bit, data; + uint32_t crc; + + crc = 0xFFFFFFFFUL; + for (idx = 0; idx < datalen; idx++) + for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) + crc = (crc >> 1) ^ (((crc ^ data) & 1) ? IEEE_CRC32_POLY : 0); + return crc; +} + +#define tulip_mchash(mca) (tulip_crc32((mca), 6) & 0x1FF) + + +/* Serial ROM access */ + +/**************************************************************************** + * tulip_spin(sc, ns) + * + * Spin for a short interval (nominally in nanoseconds) + * + * Input Parameters: ns - minimum required nsec. + * + * The delay loop uses uncached PCI reads, each of which requires + * at least 3 PCI bus clocks (45 ns at 66 MHz) to complete. The + * actual delay will be longer (much longer if preempted). + ***************************************************************************/ + +#define PCI_MIN_DELAY 45 + +static void +tulip_spin(tulip_softc *sc, long nanoseconds) +{ + long delay; + volatile uint32_t t; + + for (delay = nanoseconds; delay > 0; delay -= PCI_MIN_DELAY) + t = READCSR(sc, R_CSR_BUSMODE); +} + + +/* + * Delays below are chosen to meet specs for NS93C64 (slow M variant). + * Current parts are faster. + * Reference: NS Memory Data Book, 1994 + */ + +#define SROM_SIZE 128 +#define SROM_MAX_CYCLES 32 + +#define SROM_CMD_BITS 3 +#define SROM_ADDR_BITS 6 + +#define K_SROM_READ_CMD 06 +#define K_SROM_WRITE_CMD 05 + +#define SROM_ADDR_OFFSET 0x14 +#define SROM_CRC_OFFSET (SROM_SIZE-2) + + +static void +srom_idle_state(tulip_softc *sc) +{ + uint32_t csr9; + unsigned int i; + + csr9 = READCSR(sc, R_CSR_ROM_MII); + + csr9 |= M_CSR9_SROMCHIPSEL; + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 100); /* CS setup (Tcss=100) */ + + /* Run the clock through the maximum number of pending read cycles */ + for (i = 0; i < SROM_MAX_CYCLES*2; i++) { + csr9 ^= M_CSR9_SROMCLOCK; + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 1000); /* SK period (Fsk=0.5MHz) */ + } + + /* Deassert SROM Chip Select */ + csr9 &=~ M_CSR9_SROMCHIPSEL; + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 50); /* CS recovery (Tsks=50) */ +} + +static void +srom_send_command_bit(tulip_softc *sc, unsigned int data) +{ + uint32_t csr9; + + csr9 = READCSR(sc, R_CSR_ROM_MII); + + /* Place the data bit on the bus */ + if (data == 1) + csr9 |= M_CSR9_SROMDATAIN; + else + csr9 &=~ M_CSR9_SROMDATAIN; + + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 360); /* setup: Tdis=200 */ + + /* Now clock the data into the SROM */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_SROMCLOCK); + tulip_spin(sc, 900); /* clock high, Tskh=500 */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 450); /* clock low, Tskl=250 */ + + /* Now clear the data bit */ + csr9 &=~ M_CSR9_SROMDATAIN; /* data invalid, Tidh=20 for SK^ */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 270); /* min cycle, 1/Fsk=2000 */ +} + +static uint16_t +srom_read_bit(tulip_softc *sc) +{ + uint32_t csr9; + + csr9 = READCSR(sc, R_CSR_ROM_MII); + + /* Generate a clock cycle before doing a read */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_SROMCLOCK); /* rising edge */ + tulip_spin(sc, 1000); /* clock high, Tskh=500, Tpd=1000 */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); /* falling edge */ + tulip_spin(sc, 1000); /* clock low, 1/Fsk=2000 */ + + csr9 = READCSR(sc, R_CSR_ROM_MII); + return ((csr9 & M_CSR9_SROMDATAOUT) != 0 ? 1 : 0); +} + +#define CMD_BIT_MASK (1 << (SROM_CMD_BITS+SROM_ADDR_BITS-1)) + +static uint16_t +srom_read_word(tulip_softc *sc, unsigned int index) +{ + uint16_t command, word; + uint32_t csr9; + unsigned int i; + + csr9 = READCSR(sc, R_CSR_ROM_MII) | M_CSR9_SROMCHIPSEL; + + /* Assert the SROM CS line */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 100); /* CS setup, Tcss = 100 */ + + /* Send the read command to the SROM */ + command = (K_SROM_READ_CMD << SROM_ADDR_BITS) | index; + for (i = 0; i < SROM_CMD_BITS+SROM_ADDR_BITS; i++) { + srom_send_command_bit(sc, (command & CMD_BIT_MASK) != 0 ? 1 : 0); + command <<= 1; + } + + /* Now read the bits from the SROM (MSB first) */ + word = 0; + for (i = 0; i < 16; ++i) { + word <<= 1; + word |= srom_read_bit(sc); + } + + /* Clear the SROM CS Line, CS hold, Tcsh = 0 */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 &~ M_CSR9_SROMCHIPSEL); + + return word; +} + + +/**************************************************************************** + * srom_calc_crc() + * + * Calculate the CRC of the SROM and return it. We compute the + * CRC per Appendix A of the 21140A ROM/external register data + * sheet (EC-QPQWA-TE). + ***************************************************************************/ + +static uint16_t +srom_calc_crc(tulip_softc *sc, uint8_t srom[], int length) +{ + uint32_t crc = tulip_crc32(srom, length) ^ 0xffffffff; + + return (uint16_t)(crc & 0xffff); +} + +/**************************************************************************** + * srom_read_all(sc, uint8_t dest) + * + * Read the entire SROM into the srom array + * + * Input parameters: + * sc - tulip state + ***************************************************************************/ + +#define STORED_CRC(rom) \ + ((rom)[SROM_CRC_OFFSET] | ((rom)[SROM_CRC_OFFSET+1] << 8)) + +static int +srom_read_all(tulip_softc *sc, uint8_t dest[]) +{ + int i; + uint16_t crc, temp; + + WRITECSR(sc, R_CSR_ROM_MII, M_CSR9_SERROMSEL|M_CSR9_ROMREAD); + + srom_idle_state(sc); + + for (i = 0; i < SROM_SIZE/2; i++) { + temp = srom_read_word(sc, i); + dest[2*i] = temp & 0xff; + dest[2*i+1] =temp >> 8; + } + + WRITECSR(sc, R_CSR_ROM_MII, 0); /* CS hold, Tcsh=0 */ + + crc = srom_calc_crc(sc, dest, SROM_CRC_OFFSET); + if (crc != STORED_CRC(dest)) { + crc = srom_calc_crc(sc, dest, 94); /* "alternative" */ + if (crc != STORED_CRC(dest)) { + xprintf("DC2114x: Invalid SROM CRC, calc %04x, stored %04x\n", + crc, STORED_CRC(dest)); + return 0/*-1*/; + } + } + return 0; +} + +static int +srom_read_addr(tulip_softc *sc, uint8_t buf[]) +{ + uint8_t srom[SROM_SIZE]; + + if (srom_read_all(sc, srom) == 0) { + memcpy(buf, &srom[SROM_ADDR_OFFSET], ENET_ADDR_LEN); + return 0; + } + + return -1; +} + + +/**************************************************************************** + * MII access utility routines + ***************************************************************************/ + +/* MII clock limited to 2.5 MHz, transactions end with MDIO tristated */ + +static void +mii_write_bits(tulip_softc *sc, uint32_t data, unsigned int count) +{ + uint32_t csr9; + uint32_t bitmask; + + csr9 = READCSR(sc, R_CSR_ROM_MII) &~ (M_CSR9_MDC | M_CSR9_MIIMODE); + + for (bitmask = 1 << (count-1); bitmask != 0; bitmask >>= 1) { + csr9 &=~ M_CSR9_MDO; + if ((data & bitmask) != 0) csr9 |= M_CSR9_MDO; + WRITECSR(sc, R_CSR_ROM_MII, csr9); + + tulip_spin(sc, 2000); /* setup */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_MDC); + tulip_spin(sc, 2000); /* hold */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + } +} + +static void +mii_turnaround(tulip_softc *sc) +{ + uint32_t csr9; + + csr9 = READCSR(sc, R_CSR_ROM_MII) | M_CSR9_MIIMODE; + + /* stop driving data */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 2000); /* setup */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_MDC); + tulip_spin(sc, 2000); /* clock high */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + + /* read back and check for 0 here? */ +} + +/**************************************************************************** + * mii_read_register + * + * This routine reads a register from the PHY chip using the MII + * serial management interface. + * + * Input parameters: + * index - index of register to read (0-31) + * + * Return value: + * word read from register + ***************************************************************************/ + +static uint16_t +mii_read_register(tulip_softc *sc, unsigned int index) +{ + /* Send the command and address to the PHY. The sequence is + a synchronization sequence (32 1 bits) + a "start" command (2 bits) + a "read" command (2 bits) + the PHY addr (5 bits) + the register index (5 bits) + */ + uint32_t csr9; + uint16_t word; + int i; + + mii_write_bits(sc, 0xff, 8); + mii_write_bits(sc, 0xffffffff, 32); + mii_write_bits(sc, MII_COMMAND_START, 2); + mii_write_bits(sc, MII_COMMAND_READ, 2); + mii_write_bits(sc, sc->mii_addr /* XXX sc->phy.index */, 5); + mii_write_bits(sc, index, 5); + + mii_turnaround(sc); + + csr9 = (READCSR(sc, R_CSR_ROM_MII) &~ M_CSR9_MDC) | M_CSR9_MIIMODE; + word = 0; + + for (i = 0; i < 16; i++) { + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 2000); /* clock width low */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_MDC); + tulip_spin(sc, 2000); /* clock width high */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 1000); /* output delay */ + word <<= 1; + if ((READCSR(sc, R_CSR_ROM_MII) & M_CSR9_MDI) != 0) + word |= 0x0001; + } + + return word; + + /* reset to output mode? */ +} + +/**************************************************************************** + * mii_write_register + * + * This routine writes a register in the PHY chip using the MII + * serial management interface. + * + * Input parameters: + * index - index of register to write (0-31) + * value - word to write + ***************************************************************************/ + +static void +mii_write_register(tulip_softc *sc, unsigned int index, uint16_t value) +{ + mii_write_bits(sc, 0xff, 8); + mii_write_bits(sc, 0xffffffff, 32); + mii_write_bits(sc, MII_COMMAND_START, 2); + mii_write_bits(sc, MII_COMMAND_WRITE, 2); + mii_write_bits(sc, sc->mii_addr /* XXX sc->phy.index */, 5); + mii_write_bits(sc, index, 5); + mii_write_bits(sc, MII_COMMAND_ACK, 2); + mii_write_bits(sc, value, 16); + + /* reset to input mode? */ +} + + +static int +mii_probe(tulip_softc *sc) +{ + int i; + uint16_t id1, id2; + + for (i = 0; i < 32; i++) { + sc->mii_addr = i; + id1 = mii_read_register(sc, MII_PHYIDR1); + id2 = mii_read_register(sc, MII_PHYIDR2); + if ((id1 != 0xffff || id2 != 0xffff) && + (id1 != 0x0000 || id2 != 0x0000)) { + return 0; + } + } + return -1; +} + +#if 0 +static void +mii_dump(tulip_softc *sc) +{ + int i; + uint16_t r; + + for (i = 0; i <=6; ++i) { + r = mii_read_register(sc, i); + if (r != 0) xprintf("MII_REG%02x: %04x\n", i, r); + } + for (i = 21; i <= 25; ++i) { + r = mii_read_register(sc, i); + if (r != 0) printf("MII_REG%02x: %04x\n", i, r); + } +} +#else +#define mii_dump(sc) +#endif + + +#if 0 +static void +tulip_getaddr(tulip_softc *sc, uint8_t *buf) +{ + memcpy(buf, sc->hwaddr, ENET_ADDR_LEN); +} +#endif + + +/* Chip specific code */ + +static void +dc21143_set_speed(tulip_softc *sc, int speed) +{ + uint32_t opmode = 0; + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + + switch (speed) { + case ETHER_SPEED_AUTO: + break; + case ETHER_SPEED_10HDX: + default: + WRITECSR(sc, R_CSR_SIAMODE1, M_CSR14_10BT_HD); + WRITECSR(sc, R_CSR_SIAMODE2, M_CSR15_DEFAULT_VALUE); + opmode = M_CSR6_SPEED_10; + break; + case ETHER_SPEED_10FDX: + WRITECSR(sc, R_CSR_SIAMODE1, M_CSR14_10BT_FD); + WRITECSR(sc, R_CSR_SIAMODE2, M_CSR15_DEFAULT_VALUE); + opmode = M_CSR6_SPEED_10 | M_CSR6_FULLDUPLEX; + break; + case ETHER_SPEED_100HDX: + WRITECSR(sc, R_CSR_SIAMODE1, 0); + WRITECSR(sc, R_CSR_SIAMODE2, M_CSR15_DEFAULT_VALUE); + opmode = M_CSR6_SPEED_100; + break; + case ETHER_SPEED_100FDX: + WRITECSR(sc, R_CSR_SIAMODE1, 0); + WRITECSR(sc, R_CSR_SIAMODE2, M_CSR15_DEFAULT_VALUE); + opmode = M_CSR6_SPEED_100 | M_CSR6_FULLDUPLEX; + break; + } + + WRITECSR(sc, R_CSR_SIAMODE0, M_CSR13_CONN_NOT_RESET); + + opmode |= M_CSR6_MBO; +#if TULIP_TUNE + opmode |= V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72); +#else + opmode |= M_CSR6_STOREFWD; +#endif + WRITECSR(sc, R_CSR_OPMODE, opmode); +} + +static void +dc21143_autonegotiate(tulip_softc *sc) +{ + uint32_t opmode; + uint32_t tempword; + int count; + int linkspeed; + + linkspeed = ETHER_SPEED_UNKNOWN; + + /* Program the media setup into the CSRs. */ + /* reset SIA */ + WRITECSR(sc, R_CSR_SIAMODE0, 0); + + /* set to speed_10, fullduplex to start_nway */ + opmode = + M_CSR6_SPEED_10 | + M_CSR6_FULLDUPLEX | + M_CSR6_MBO; + WRITECSR(sc, R_CSR_OPMODE, opmode); + + /* Choose advertised capabilities */ + tempword = + M_CSR14_100BASETHALFDUP | + M_CSR14_100BASETFULLDUP | + M_CSR14_HALFDUPLEX10BASET; + WRITECSR(sc, R_CSR_SIAMODE1, tempword); + + /* Enable autonegotiation */ + tempword |= M_CSR14_AUTONEGOTIATE | 0xffff; + WRITECSR(sc, R_CSR_SIAMODE1, tempword); + WRITECSR(sc, R_CSR_SIAMODE2, M_CSR15_DEFAULT_VALUE); + WRITECSR(sc, R_CSR_OPMODE, opmode); + WRITECSR(sc, R_CSR_SIAMODE0, M_CSR13_CONN_NOT_RESET); + + /* STATE check nway, poll until a valid 10/100mbs signal seen */ + WRITECSR(sc, R_CSR_STATUS, M_CSR5_LINKPASS); /* try to clear this... */ + + /* (Re)start negotiation */ + tempword = READCSR(sc, R_CSR_SIASTATUS); + tempword &=~ M_CSR12_AUTONEGARBIT; + tempword |= V_CSR12_AUTONEGARBIT(0x1); + + for (count = 0; count <= 130; count++) { + tempword = READCSR(sc, R_CSR_STATUS); + if (tempword & M_CSR5_LINKPASS) + break; + cfe_sleep(CFE_HZ/100); + } + + if (count > 130) + xprintf("DC21143: Link autonegotiation failed\n"); + + /* STATE configure nway, check to see if any abilities common to us. + If they do, set to highest mode, if not, we will see if the partner + will do 100mb or 10mb - then set it */ + + tempword = READCSR(sc, R_CSR_SIASTATUS); + /* clear the autonegogiate complete bit */ + WRITECSR(sc, R_CSR_STATUS, M_CSR5_LINKPASS); + + if (tempword & M_CSR12_LINKPARTNEG) { + /* A link partner was negogiated... */ + + xprintf("DC21143: Negotiated "); + if (tempword & 0x01000000) { /* 100FD */ + xprintf("100Mb/s FDX"); + linkspeed = ETHER_SPEED_100FDX; + } + else if (tempword & 0x00800000) { /* 100HD */ + xprintf("100Mb/s HDX"); + linkspeed = ETHER_SPEED_100HDX; + } + else if (tempword & 0x00400000) { /* 10FD */ + xprintf("10Mb/s FDX"); + linkspeed = ETHER_SPEED_10FDX; + } + else if (tempword & 0x00200000) { /* 10HD */ + xprintf("10Mb/s HDX"); + linkspeed = ETHER_SPEED_10HDX; + } + xprintf("\n"); + } + else { + /* no link partner negotiation */ + /* disable link for 1.3 seconds to break any existing connections */ + + /* xprintf("Disabling link, setting to 10mb half duplex\n"); */ + dc21143_set_speed(sc, ETHER_SPEED_10HDX); + cfe_sleep(CFE_HZ/8); + + tempword = READCSR(sc, R_CSR_SIASTATUS); + + if ((tempword & 0x02) == 0) { + /* 100 mb signal present set to 100mb */ + xprintf("No link partner... setting to 100mb/s HDX\n"); + linkspeed = ETHER_SPEED_100HDX; + } + else if ((tempword & 0x04) == 0) { + /* 10 mb signal present */ + xprintf("No link partner... setting to 10mb/s HDX\n"); + linkspeed = ETHER_SPEED_10HDX; + } + else { + /* couldn't determine line speed, so set to 10mbs */ + xprintf("Unknown; defaulting to 10Mb/s HDX\n"); + linkspeed = ETHER_SPEED_10HDX; + } + } + + dc21143_set_speed(sc, linkspeed); +} + +static void +dc21143_set_loopback(tulip_softc *sc, int mode) +{ + uint32_t v; + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + if (mode == ETHER_LOOPBACK_EXT) { + /* deal with CSRs 13-15 */ + } + cfe_sleep(CFE_HZ/10); /* check this */ + + /* Update the SIA registers */ + v = READCSR(sc, R_CSR_SIAMODE0); + WRITECSR(sc, R_CSR_SIAMODE0, v &~ 0xFFFF); + v = READCSR(sc, R_CSR_SIAMODE1); + WRITECSR(sc, R_CSR_SIAMODE1, v &~ 0xFFFF); + v = READCSR(sc, R_CSR_SIAMODE2); + WRITECSR(sc, R_CSR_SIAMODE2, v | 0xC000); /* WC of HCKR, RMP */ + WRITECSR(sc, R_CSR_SIAMODE2, (v &~ 0xFFFF) | M_CSR15_GP_AUIBNC); + + WRITECSR(sc, R_CSR_SIAMODE0, M_CSR13_CONN_NOT_RESET); +} + +static void +dc21143_hwinit(tulip_softc *sc) +{ + uint32_t v; + uint32_t csr6word, csr14word; + + /* CSR0 - bus mode */ + WRITECSR(sc, R_CSR_SIAMODE2, M_CSR15_CONFIG_GEPS_LEDS); +#if TULIP_TUNE + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN32) | + M_CSR0_READMULTENAB | M_CSR0_READLINEENAB | + M_CSR0_WRITEINVALENAB | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#else + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN128) | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#endif +#ifdef __MIPSEB + v |= M_CSR0_BIGENDIAN; /* big-endian data serialization */ +#endif + WRITECSR(sc, R_CSR_BUSMODE, v); + + /* CSR6 - operation mode */ + v = M_CSR6_PORTSEL | +#if TULIP_TUNE + V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72) | +#else + M_CSR6_STOREFWD | +#endif + M_CSR6_MBO | + M_CSR6_PCSFUNC | + M_CSR6_SCRAMMODE; + WRITECSR(sc, R_CSR_OPMODE, v); + + /* About to muck the SIA, reset it.(?) */ + /* WRITECSR(sc, R_CSR_SIASTATUS, 1); */ + + /* Must shut off all transmit/receive in order to attempt to + achieve Full Duplex */ + csr6word = READCSR(sc, R_CSR_OPMODE); + WRITECSR(sc, R_CSR_OPMODE, csr6word &~ (M_CSR6_TXSTART | M_CSR6_RXSTART)); + csr6word = READCSR(sc, R_CSR_OPMODE); + + WRITECSR(sc, R_CSR_RXRING, PCIADDRX(sc, PHYSADDR(sc, sc->rxdscr_start))); + WRITECSR(sc, R_CSR_TXRING, PCIADDRX(sc, PHYSADDR(sc, sc->txdscr_start))); + + if (sc->linkspeed == ETHER_SPEED_AUTO) { + dc21143_autonegotiate(sc); + } + else { + /* disable autonegotiate so we can set full duplex to on */ + WRITECSR(sc, R_CSR_SIAMODE0, 0); + csr14word = READCSR(sc, R_CSR_SIAMODE1); + csr14word &=~ M_CSR14_AUTONEGOTIATE; + WRITECSR(sc, R_CSR_SIAMODE1, csr14word); + WRITECSR(sc, R_CSR_SIAMODE0, M_CSR13_CONN_NOT_RESET); + + dc21143_set_speed(sc, sc->linkspeed); + } +} + + +static void +dc21140_set_speed(tulip_softc *sc, int speed, int autoneg) +{ + uint16_t control; + uint16_t pcr; + uint32_t opmode = 0; + + pcr = mii_read_register(sc, 0x17); + pcr |= (0x400|0x100|0x40|0x20); + mii_write_register(sc, 0x17, pcr); + + control = mii_read_register(sc, MII_BMCR); + + if (!autoneg) { + control &=~ (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + control &=~ (BMCR_SPEED0 | BMCR_SPEED1 | BMCR_DUPLEX); + } + + switch (speed) { + case ETHER_SPEED_10HDX: + default: + opmode = M_CSR6_SPEED_10_MII; + break; + case ETHER_SPEED_10FDX: + control |= BMCR_DUPLEX; + opmode = M_CSR6_SPEED_10_MII | M_CSR6_FULLDUPLEX; + break; + case ETHER_SPEED_100HDX: + control |= BMCR_SPEED100; + opmode = M_CSR6_SPEED_100_MII; + break; + case ETHER_SPEED_100FDX: + control |= BMCR_SPEED100 | BMCR_DUPLEX ; + opmode = M_CSR6_SPEED_100_MII | M_CSR6_FULLDUPLEX; + break; + } + + if (!autoneg) + mii_write_register(sc, MII_BMCR, control); + + opmode |= M_CSR6_MBO; +#if TULIP_TUNE + opmode |= V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72); +#else + opmode |= M_CSR6_STOREFWD; +#endif + WRITECSR(sc, R_CSR_OPMODE, opmode); +#if 0 + xprintf("setspeed PHY\n"); mii_dump(sc); +#endif +} + +static void +dc21140_autonegotiate(tulip_softc *sc) +{ + uint16_t control, status, cap; + unsigned int timeout; + int linkspeed; + int autoneg; + + linkspeed = ETHER_SPEED_UNKNOWN; + + /* Read twice to clear latching bits */ + status = mii_read_register(sc, MII_BMSR); + status = mii_read_register(sc, MII_BMSR); +#if 0 + xprintf("query PHY\n"); mii_dump(sc); +#endif + + if ((status & (BMSR_AUTONEG | BMSR_LINKSTAT)) == + (BMSR_AUTONEG | BMSR_LINKSTAT)) + control = mii_read_register(sc, MII_BMCR); + else { + /* reset the PHY */ + mii_write_register(sc, MII_BMCR, BMCR_RESET); + timeout = 3000; + for (;;) { + control = mii_read_register(sc, MII_BMCR); + if ((control && BMCR_RESET) == 0) break; + cfe_sleep(CFE_HZ/2); + timeout -= 500; + if (timeout <= 0) break; + } + if ((control & BMCR_RESET) != 0) { + xprintf("DC21140: PHY reset failed\n"); + return; + } + + status = mii_read_register(sc, MII_BMSR); + cap = ((status >> 6) & (ANAR_TXFD | ANAR_TXHD | ANAR_10FD | ANAR_10HD)) + | PSB_802_3; + mii_write_register(sc, MII_ANAR, cap); + control |= (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + + timeout = 3000; + for (;;) { + status = mii_read_register(sc, MII_BMSR); + if ((status & BMSR_ANCOMPLETE) != 0) break; + cfe_sleep(CFE_HZ/2); + timeout -= 500; + if (timeout <= 0) break; + } +#if 0 + xprintf("done PHY\n"); mii_dump(sc); +#endif + } + + if ((status & BMSR_ANCOMPLETE) != 0) { + /* A link partner was negogiated... */ + + uint16_t remote = mii_read_register(sc, MII_ANLPAR); + + autoneg = 1; + xprintf("DC21140: Negotiated "); + if ((remote & ANLPAR_TXFD) != 0) { + xprintf("100Mb/s FDX"); + linkspeed = ETHER_SPEED_100FDX; + } + else if ((remote & ANLPAR_TXHD) != 0) { + xprintf("100Mb/s HDX"); + linkspeed = ETHER_SPEED_100HDX; + } + else if ((remote & ANLPAR_10FD) != 0) { + xprintf("10Mb/s FDX"); + linkspeed = ETHER_SPEED_10FDX; + } + else if ((remote & ANLPAR_10HD) != 0) { + xprintf("10Mb/s HDX"); + linkspeed = ETHER_SPEED_10HDX; + } + xprintf("\n"); + } + else { + /* no link partner negotiation */ + + autoneg = 0; + xprintf("DC21140: MII negotiation failed, assuming 10BT\n"); + control &=~ (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + linkspeed = ETHER_SPEED_10HDX; + } + + if ((status & BMSR_LINKSTAT) == 0) + mii_write_register(sc, MII_BMCR, control); + dc21140_set_speed(sc, linkspeed, autoneg); + + status = mii_read_register(sc, MII_BMSR); /* clear latching bits */ +#if 0 + xprintf("final PHY\n"); mii_dump(sc); +#endif +} + +static void +dc21140_set_loopback(tulip_softc *sc, int mode) +{ + if (mode == ETHER_LOOPBACK_EXT) + xprintf("DC21140: external loopback mode NYI\n"); +} + +static void +dc21140_hwinit(tulip_softc *sc) +{ + uint32_t v; + uint32_t csr6word; + + /* The following assume GP port bits wired per the DEC reference design. + XXX Interpret the srom initialization strings instead */ + WRITECSR(sc, R_CSR_GENPORT, M_CSR12_CONTROL | 0x1F); + WRITECSR(sc, R_CSR_GENPORT, 0); /* release PHY reset */ + + /* Select MII interface */ + WRITECSR(sc, R_CSR_OPMODE, M_CSR6_PORTSEL); + RESET_ADAPTER(sc); + + mii_probe(sc); + + /* CSR0 - bus mode */ +#if TULIP_TUNE + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN32) | + M_CSR0_READMULTENAB | M_CSR0_READLINEENAB | + M_CSR0_WRITEINVALENAB | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#else + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN128) | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#endif +#ifdef __MIPSEB + v |= M_CSR0_BIGENDIAN; /* big-endian data serialization */ +#endif + WRITECSR(sc, R_CSR_BUSMODE, v); + + /* CSR6 - operation mode */ + v = M_CSR6_PORTSEL | +#if TULIP_TUNE + V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72) | +#else + M_CSR6_STOREFWD | +#endif + M_CSR6_MBO; + WRITECSR(sc, R_CSR_OPMODE, v); + + /* Must shut off all transmit/receive in order to attempt to + achieve Full Duplex */ + csr6word = READCSR(sc, R_CSR_OPMODE); + WRITECSR(sc, R_CSR_OPMODE, csr6word &~ (M_CSR6_TXSTART | M_CSR6_RXSTART)); + csr6word = READCSR(sc, R_CSR_OPMODE); + + WRITECSR(sc, R_CSR_RXRING, PCIADDRX(sc, PHYSADDR(sc, sc->rxdscr_start))); + WRITECSR(sc, R_CSR_TXRING, PCIADDRX(sc, PHYSADDR(sc, sc->txdscr_start))); + + if (sc->linkspeed == ETHER_SPEED_AUTO) { + dc21140_autonegotiate(sc); + } + else { + dc21140_set_speed(sc, sc->linkspeed, 0); + } +} + + +static void +dc21041_set_loopback(tulip_softc *sc, int mode) +{ + uint32_t v; + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + if (mode == ETHER_LOOPBACK_EXT) { + /* deal with CSRs 13-15 */ + } + cfe_sleep(CFE_HZ/10); /* check this */ + + /* Update the SIA registers */ + v = READCSR(sc, R_CSR_SIAMODE0); + WRITECSR(sc, R_CSR_SIAMODE0, v &~ 0xFFFF); + WRITECSR(sc, R_CSR_SIAMODE1, 0x7A3F); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0008); + + WRITECSR(sc, R_CSR_SIAMODE0, 0xEF01); +} + +static void +dc21041_hwinit(tulip_softc *sc) +{ + uint32_t v; + uint32_t opmode; + + /* CSR0 - bus mode */ + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN128) | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#ifdef __MIPSEB + v |= M_CSR0_BIGENDIAN; /* big-endian data serialization */ +#endif + WRITECSR(sc, R_CSR_BUSMODE, v); + + /* set initial interrupt mask here? */ + + WRITECSR(sc, R_CSR_RXRING, PCIADDRX(sc, PHYSADDR(sc, sc->rxdscr_start))); + WRITECSR(sc, R_CSR_TXRING, PCIADDRX(sc, PHYSADDR(sc, sc->txdscr_start))); + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + + /* For now, always force 10BT, HDX */ + WRITECSR(sc, R_CSR_SIAMODE1, 0x7F3F); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0008); + opmode = M_CSR6_SPEED_10; + + WRITECSR(sc, R_CSR_SIAMODE0, 0xEF01); + cfe_sleep(CFE_HZ/10); + + opmode |= V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72); + WRITECSR(sc, R_CSR_OPMODE, opmode); +} + + +static void +tulip_hwinit(tulip_softc *sc) +{ + if (sc->state == eth_state_uninit) { + RESET_ADAPTER(sc); + sc->state = eth_state_off; + sc->bus_errors = 0; + + switch (sc->device) { + case K_PCI_ID_DC21041: + dc21041_hwinit(sc); + break; + case K_PCI_ID_DC21140: + dc21140_hwinit(sc); + break; + case K_PCI_ID_DC21143: + dc21143_hwinit(sc); + break; + default: + break; + } + } +} + + +static void +tulip_isr(tulip_softc *sc) +{ + uint32_t status; + uint32_t csr5; + + for (;;) { + + /* Read the interrupt status. */ + csr5 = READCSR(sc, R_CSR_STATUS); +// status &= sc->intmask; /* keep only the bits we like. */ + status = csr5 & ( + M_CSR5_RXINT | M_CSR5_RXBUFUNAVAIL | + M_CSR5_TXINT | M_CSR5_TXUNDERFLOW | + M_CSR5_FATALBUSERROR); + + /* if there are no more interrupts, leave now. */ + if (status == 0) break; + + /* Clear the pending interrupt. */ + WRITECSR(sc, R_CSR_STATUS, status); + + /* Now, test each unmasked bit in the interrupt register and + handle each interrupt type appropriately. */ + + if (status & M_CSR5_FATALBUSERROR) { + xprintf("DC21143: bus error %02x\n", G_CSR5_ERRORBITS(csr5)); + dumpstat(sc); + sc->bus_errors++; + if (sc->bus_errors >= 2) { + dumpcsrs(sc); + RESET_ADAPTER(sc); + sc->state = eth_state_off; + sc->bus_errors = 0; + } + } + + if (status & M_CSR5_RXINT) { + tulip_procrxring(sc); + } + + if (status & M_CSR5_TXINT) { + tulip_proctxring(sc); + } + + if (status & (M_CSR5_TXUNDERFLOW | M_CSR5_RXBUFUNAVAIL)) { + if (status & M_CSR5_TXUNDERFLOW) { + xprintf("DC21143: tx underrun, %08x\n", csr5); + /* Try to restart */ + WRITECSR(sc, R_CSR_TXPOLL, 1); + } + if (status & M_CSR5_RXBUFUNAVAIL) { + /* Try to restart */ + WRITECSR(sc, R_CSR_RXPOLL, 1); + } + } + } +} + + +static void +tulip_start(tulip_softc *sc) +{ + uint32_t opmode; + int idx; + tulip_cam *cam; + eth_pkt_t *pkt; + + tulip_hwinit(sc); + + WRITECSR(sc, R_CSR_RXRING, PCIADDRX(sc, PHYSADDR(sc, sc->rxdscr_start))); + WRITECSR(sc, R_CSR_TXRING, PCIADDRX(sc, PHYSADDR(sc, sc->txdscr_start))); + + opmode = READCSR(sc, R_CSR_OPMODE); + opmode &=~ M_CSR6_OPMODE; /* no loopback */ + opmode |= (M_CSR6_TXSTART | M_CSR6_RXSTART); + + sc->intmask = 0; + WRITECSR(sc, R_CSR_INTMASK, 0); /* no interrupts */ + WRITECSR(sc, R_CSR_OPMODE, opmode); + + pkt = eth_alloc_pkt(sc); + if (pkt) { + pkt->length = CAM_SETUP_BUFFER_SIZE; + cam = (tulip_cam *) pkt->buffer; + +#ifdef __MIPSEB + cam->p.physical[0][0] = (((uint32_t) sc->hwaddr[0] << 8) | + (uint32_t) sc->hwaddr[1]) << 16; + cam->p.physical[0][1] = (((uint32_t) sc->hwaddr[2] << 8) | + (uint32_t) sc->hwaddr[3]) << 16; + cam->p.physical[0][2] = (((uint32_t) sc->hwaddr[4] << 8) | + (uint32_t) sc->hwaddr[5]) << 16; + for (idx = 1; idx < CAM_PERFECT_ENTRIES; idx++) { + cam->p.physical[idx][0] = 0xFFFF0000; + cam->p.physical[idx][1] = 0xFFFF0000; + cam->p.physical[idx][2] = 0xFFFF0000; + } +#else + cam->p.physical[0][0] = ((uint32_t) sc->hwaddr[0]) | + (((uint32_t) sc->hwaddr[1]) << 8); + cam->p.physical[0][1] = ((uint32_t) sc->hwaddr[2]) | + (((uint32_t) sc->hwaddr[3]) << 8); + cam->p.physical[0][2] = ((uint32_t) sc->hwaddr[4]) | + (((uint32_t) sc->hwaddr[5]) << 8); + for (idx = 1; idx < CAM_PERFECT_ENTRIES; idx++) { + cam->p.physical[idx][0] = 0x0000FFFF; + cam->p.physical[idx][1] = 0x0000FFFF; + cam->p.physical[idx][2] = 0x0000FFFF; + } +#endif + + pkt->flags |= ETH_TX_SETUP; + if (tulip_transmit(sc, pkt) != 0) { + xprintf("DC21143: failed setup\n"); + dumpstat(sc); + eth_free_pkt(sc, pkt); + return; + } + sc->state = eth_state_setup; + } +} + +static void +tulip_stop(tulip_softc *sc) +{ + uint32_t opmode; + uint32_t status; + int count; + + WRITECSR(sc, R_CSR_INTMASK, 0); + sc->intmask = 0; + + opmode = READCSR(sc, R_CSR_OPMODE); + opmode &=~ (M_CSR6_TXSTART | M_CSR6_RXSTART); + WRITECSR(sc, R_CSR_OPMODE, opmode); + + /* wait for any DMA activity to terminate */ + for (count = 0; count <= 130; count++) { + status = READCSR(sc, R_CSR_STATUS); + if ((status & (M_CSR5_RXPROCSTATE | M_CSR5_TXPROCSTATE)) == 0) + break; + cfe_sleep(CFE_HZ/10); + } + if (count > 130) { + xprintf("DC21143: idle state not achieved\n"); + dumpstat(sc); + } +} + + +static void +tulip_start_loopback(tulip_softc *sc, int mode) +{ + uint32_t opmode; + + opmode = READCSR(sc, R_CSR_OPMODE); + + switch (sc->device) { + case K_PCI_ID_DC21041: + dc21041_set_loopback(sc, mode); + break; + case K_PCI_ID_DC21140: + dc21140_set_loopback(sc, mode); + break; + case K_PCI_ID_DC21143: + dc21143_set_loopback(sc, mode); + break; + default: + break; + } + cfe_sleep(CFE_HZ/10); + + WRITECSR(sc, R_CSR_RXRING, PCIADDRX(sc, PHYSADDR(sc, sc->rxdscr_start))); + WRITECSR(sc, R_CSR_TXRING, PCIADDRX(sc, PHYSADDR(sc, sc->txdscr_start))); + + sc->intmask = 0; /* no interrupts */ + WRITECSR(sc, R_CSR_INTMASK, 0); + + opmode &=~ (M_CSR6_OPMODE | M_CSR6_FULLDUPLEX); + opmode |= M_CSR6_PORTSEL; + if (mode == ETHER_LOOPBACK_EXT) + opmode |= M_CSR6_EXTLOOPBACK; + else + opmode |= M_CSR6_INTLOOPBACK; + opmode |= M_CSR6_TXSTART | M_CSR6_RXSTART; + WRITECSR(sc, R_CSR_OPMODE, opmode); +} + + +/* ********************************************************************* + * ETH_PARSE_XDIGIT(c) + * + * Parse a hex digit, returning its value + * + * Input parameters: + * c - character + * + * Return value: + * hex value, or -1 if invalid + ********************************************************************* */ +static int +eth_parse_xdigit(char c) +{ + int digit; + + if ((c >= '0') && (c <= '9')) digit = c - '0'; + else if ((c >= 'a') && (c <= 'f')) digit = c - 'a' + 10; + else if ((c >= 'A') && (c <= 'F')) digit = c - 'A' + 10; + else digit = -1; + + return digit; +} + +/* ********************************************************************* + * ETH_PARSE_HWADDR(str,hwaddr) + * + * Convert a string in the form xx:xx:xx:xx:xx:xx into a 6-byte + * Ethernet address. + * + * Input parameters: + * str - string + * hwaddr - pointer to hardware address + * + * Return value: + * 0 if ok, else -1 + ********************************************************************* */ +static int +eth_parse_hwaddr(char *str, uint8_t *hwaddr) +{ + int digit1, digit2; + int idx = ENET_ADDR_LEN; + + while (*str && (idx > 0)) { + digit1 = eth_parse_xdigit(*str); + if (digit1 < 0) return -1; + str++; + if (!*str) return -1; + + if ((*str == ':') || (*str == '-')) { + digit2 = digit1; + digit1 = 0; + } + else { + digit2 = eth_parse_xdigit(*str); + if (digit2 < 0) return -1; + str++; + } + + *hwaddr++ = (digit1 << 4) | digit2; + idx--; + + if ((*str == ':') || (*str == '-')) + str++; + } + return 0; +} + +/* ********************************************************************* + * ETH_INCR_HWADDR(hwaddr,incr) + * + * Increment a 6-byte Ethernet hardware address, with carries + * + * Input parameters: + * hwaddr - pointer to hardware address + * incr - desired increment + * + * Return value: + * none + ********************************************************************* */ +static void +eth_incr_hwaddr(uint8_t *hwaddr, unsigned incr) +{ + int idx; + int carry; + + idx = 5; + carry = incr; + while (idx >= 0 && carry != 0) { + unsigned sum = hwaddr[idx] + carry; + + hwaddr[idx] = sum & 0xff; + carry = sum >> 8; + idx--; + } +} + + +/* ********************************************************************* + * Declarations for CFE Device Driver Interface routines + ********************************************************************* */ + +static int tulip_ether_open(cfe_devctx_t *ctx); +static int tulip_ether_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tulip_ether_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int tulip_ether_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tulip_ether_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tulip_ether_close(cfe_devctx_t *ctx); + +/* ********************************************************************* + * CFE Device Driver dispatch structure + ********************************************************************* */ + +const static cfe_devdisp_t tulip_ether_dispatch = { + tulip_ether_open, + tulip_ether_read, + tulip_ether_inpstat, + tulip_ether_write, + tulip_ether_ioctl, + tulip_ether_close, + NULL, + NULL +}; + +/* ********************************************************************* + * CFE Device Driver descriptor + ********************************************************************* */ + +const cfe_driver_t dc21143drv = { + "DC2114x Ethernet", + "eth", + CFE_DEV_NETWORK, + &tulip_ether_dispatch, + tulip_ether_probe +}; + + +static int +tulip_ether_attach(cfe_driver_t *drv, + pcitag_t tag, int index, uint8_t hwaddr[], int host) +{ + tulip_softc *softc; + uint32_t device; + uint32_t class; + uint32_t reg; + phys_addr_t pa; + char descr[100]; + uint8_t romaddr[ENET_ADDR_LEN]; +#if 0 /* temporary */ + int i; + uint8_t srom[SROM_SIZE]; +#endif + + device = pci_conf_read(tag, R_CFG_CFID); + + class = pci_conf_read(tag, R_CFG_CFRV); + + reg = pci_conf_read(tag, R_CFG_CPMS); + + reg = pci_conf_read(tag, R_CFG_CFDD); + pci_conf_write(tag, R_CFG_CFDD, 0); + reg = pci_conf_read(tag, R_CFG_CFDD); + +#if 1 + /* Use memory space for the CSRs */ + pci_map_mem(tag, R_CFG_CBMA, PCI_MATCH_BITS, &pa); +#else + /* Use i/o space for the CSRs */ + pci_map_io(tag, R_CFG_CBIO, PCI_MATCH_BITS, &pa); +#endif + + softc = (tulip_softc *) KMALLOC(sizeof(tulip_softc), 0); + if (softc == NULL) { + xprintf("DC2114x: No memory to complete probe\n"); + return 0; + } + + memset(softc, 0, sizeof(*softc)); + + softc->membase = (uint32_t)pa; + + /* If we are in Host mode, we can receive interrupts. Otherwise, + we can see the CSRs but our CPU will not get interrupts. */ + if (host) + softc->irq = pci_conf_read(tag, R_CFG_CFIT) & 0xFF; + else + softc->irq = 0xFF; + + softc->tag = tag; + softc->device = PCI_PRODUCT(device); + softc->revision = PCI_REVISION(class); +#if 1 + softc->linkspeed = ETHER_SPEED_AUTO; /* select autonegotiation */ +#else + softc->linkspeed = ETHER_SPEED_100HDX; /* 100 Mbps, full duplex */ +#endif + memcpy(softc->hwaddr, hwaddr, ENET_ADDR_LEN); + + tulip_init(softc); + + /* Prefer address in srom */ + if (srom_read_addr(softc, romaddr) == 0) + memcpy(softc->hwaddr, romaddr, ENET_ADDR_LEN); + + softc->state = eth_state_uninit; + + xsprintf(descr, "%s at 0x%X (%02x-%02x-%02x-%02x-%02x-%02x)", + drv->drv_description, softc->membase, + softc->hwaddr[0], softc->hwaddr[1], softc->hwaddr[2], + softc->hwaddr[3], softc->hwaddr[4], softc->hwaddr[5]); + cfe_attach(drv, softc, NULL, descr); + return 1; +} + + +/* ********************************************************************* + * TULIP_ETHER_PROBE(drv,probe_a,probe_b,probe_ptr) + * + * Probe and install drivers for all DC2114x Ethernet controllers. + * For each, creates a context structure and attaches to the + * specified MAC devices. + * + * Input parameters: + * drv - driver descriptor + * probe_a - not used + * probe_b - not used + * probe_ptr - string pointer to hardware address for the first + * MAC, in the form xx:xx:xx:xx:xx:xx + * + * Return value: + * nothing + ********************************************************************* */ +static void +tulip_ether_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + int index; + int n; + uint8_t hwaddr[ENET_ADDR_LEN]; + + if (probe_ptr) + eth_parse_hwaddr((char *) probe_ptr, hwaddr); + else { + /* use default address 40-00-00-10-11-11 */ + hwaddr[0] = 0x40; hwaddr[1] = 0x00; + hwaddr[2] = 0x00; hwaddr[3] = 0x10; + hwaddr[4] = 0x11; hwaddr[5] = 0x11; + } + + n = 0; + index = 0; + for (;;) { + pcitag_t tag; + pcireg_t device; + + if (pci_find_class(PCI_CLASS_NETWORK, index, &tag) != 0) + break; + + index++; + + device = pci_conf_read(tag, R_CFG_CFID); + if (PCI_VENDOR(device) != K_PCI_VENDOR_DEC) + continue; + switch (PCI_PRODUCT(device)) { + case K_PCI_ID_DC21041: + break; + case K_PCI_ID_DC21140: + break; + case K_PCI_ID_DC21143: + break; + default: + continue; + } + + tulip_ether_attach(drv, tag, index, hwaddr, 1); + + n++; + eth_incr_hwaddr(hwaddr, 1); + } +} + + +/* The functions below are called via the dispatch vector for the 2114x. */ + +/* ********************************************************************* + * TULIP_ETHER_OPEN(ctx) + * + * Open the Ethernet device. The MAC is reset, initialized, and + * prepared to receive and send packets. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_open(cfe_devctx_t *ctx) +{ + tulip_softc *softc = ctx->dev_softc; + + if (softc->state == eth_state_on) + tulip_stop(softc); + + tulip_start(softc); + softc->state = eth_state_on; + + return 0; +} + +/* ********************************************************************* + * TULIP_ETHER_READ(ctx,buffer) + * + * Read a packet from the Ethernet device. If no packets are + * available, the read will succeed but return 0 bytes. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + tulip_softc *softc = ctx->dev_softc; + eth_pkt_t *pkt; + int blen; + + if (softc->state != eth_state_on) return -1; + + tulip_isr(softc); + + pkt = (eth_pkt_t *) q_deqnext(&(softc->rxqueue)); + + if (pkt == NULL) { + buffer->buf_retlen = 0; + return 0; + } + + blen = buffer->buf_length; + if (blen > pkt->length) blen = pkt->length; + + memcpy(buffer->buf_ptr, pkt->buffer, blen); + buffer->buf_retlen = blen; + + eth_free_pkt(softc,pkt); + tulip_fillrxring(softc); + tulip_isr(softc); + + return 0; +} + +/* ********************************************************************* + * TULIP_ETHER_INPSTAT(ctx,inpstat) + * + * Check for received packets on the Ethernet device + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * inpstat - pointer to input status structure + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + tulip_softc *softc = ctx->dev_softc; + + if (softc->state != eth_state_on) return -1; + + tulip_isr(softc); + + inpstat->inp_status = (q_isempty(&(softc->rxqueue))) ? 0 : 1; + + return 0; +} + +/* ********************************************************************* + * TULIP_ETHER_WRITE(ctx,buffer) + * + * Write a packet to the Ethernet device. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + tulip_softc *softc = ctx->dev_softc; + eth_pkt_t *pkt; + int blen; + + if (softc->state != eth_state_on) return -1; + + pkt = eth_alloc_pkt(softc); + if (!pkt) return -1; + + blen = buffer->buf_length; + if (blen > pkt->length) blen = pkt->length; + + memcpy(pkt->buffer, buffer->buf_ptr, blen); + pkt->length = blen; + + tulip_isr(softc); + + if (tulip_transmit(softc, pkt) != 0) { + eth_free_pkt(softc,pkt); + return -1; + } + + tulip_isr(softc); + + return 0; +} + +/* ********************************************************************* + * TULIP_ETHER_IOCTL(ctx,buffer) + * + * Do device-specific I/O control operations for the device + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + tulip_softc *softc = ctx->dev_softc; + int mode; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_ETHER_GETHWADDR: + memcpy(buffer->buf_ptr, softc->hwaddr, sizeof(softc->hwaddr)); + return 0; + + case IOCTL_ETHER_SETHWADDR: + return -1; /* need to do this carefully */ + + /* XXX IOCTLs to set speed, etc.? */ + + case IOCTL_ETHER_GETLOOPBACK: + *((int *) buffer) = 0; /* XXX place holder */ + return 0; + + case IOCTL_ETHER_SETLOOPBACK: + tulip_stop(softc); + tulip_resetrings(softc); + mode = *((int *) buffer->buf_ptr); + if (mode == ETHER_LOOPBACK_INT || mode == ETHER_LOOPBACK_EXT) { + tulip_start_loopback(softc, mode); + } + else if (mode == ETHER_LOOPBACK_OFF) { + tulip_start(softc); + } + softc->state = eth_state_on; + return 0; + + default: + return -1; + } +} + +/* ********************************************************************* + * TULIP_ETHER_CLOSE(ctx) + * + * Close the Ethernet device. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_close(cfe_devctx_t *ctx) +{ + tulip_softc *softc = ctx->dev_softc; + + tulip_stop(softc); + softc->state = eth_state_off; + + /* resynchronize descriptor rings */ + tulip_resetrings(softc); + + return 0; +} diff --git a/cfe/cfe/dev/dev_dp83815.c b/cfe/cfe/dev/dev_dp83815.c new file mode 100644 index 0000000..b9fb644 --- /dev/null +++ b/cfe/cfe/dev/dev_dp83815.c @@ -0,0 +1,2290 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * NS DP83815 Ethernet Driver File: dev_dp83815.c + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "sbmips.h" + +#ifndef _SB_MAKE64 +#define _SB_MAKE64(x) ((uint64_t)(x)) +#endif +#ifndef _SB_MAKEMASK1 +#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n)) +#endif + +#include "lib_types.h" +#include "lib_hssubr.h" +#include "lib_malloc.h" +#include "lib_string.h" +#define blockcopy memcpy +#include "lib_printf.h" +#include "lib_queue.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_error.h" +#include "cfe_irq.h" + +#include "pcivar.h" +#include "pcireg.h" + +#include "dp83815.h" +#include "mii.h" + +/* This is a driver for the National Semiconductor DP83815 (MacPhyter) + 10/100 MAC with integrated PHY. + + The current version has been developed for the Netgear FA311 and + FA312 NICs. These include an EEPROM with automatically loaded + setup information that includes station address filtering. + Operation without such an EEPROM has not been tested. + + This SB1250 version takes advantage of DMA coherence and uses + "preserve bit lanes" addresses for all accesses that cross the + ZBbus-PCI bridge. */ + +#ifndef MACPHYTER_DEBUG +#define MACPHYTER_DEBUG 0 +#endif +#ifndef MACPHYTER_TEST +#define MACPHYTER_TEST 0 +#endif + +/* Set IPOLL to drive processing through the pseudo-interrupt + dispatcher. Set XPOLL to drive processing by an external polling + agent. Setting both is ok. */ + +#ifndef IPOLL +#define IPOLL 0 +#endif +#ifndef XPOLL +#define XPOLL 1 +#endif + +#define ENET_ADDR_LEN 6 /* size of an ethernet address */ +#define MIN_ETHER_PACK 64 /* min size of a packet */ +#define MAX_ETHER_PACK 1518 /* max size of a packet */ +#define CRC_SIZE 4 /* size of CRC field */ + +/* Packet buffers. For the DP83815, an rx packet must be aligned to a + 32-bit word boundary, and we would like it aligned to a cache line + boundary for performance. Also, the buffers "should" be allocated + in 32 byte multiples (5.3.2). */ + +#define ETH_PKTBUF_LEN (((MAX_ETHER_PACK+31)/32)*32) + +#if __long64 +typedef struct eth_pkt_s { + queue_t next; /* 16 */ + uint8_t *buffer; /* 8 */ + uint32_t flags; /* 4 */ + int32_t length; /* 4 */ + uint8_t data[ETH_PKTBUF_LEN]; +} eth_pkt_t; +#else +typedef struct eth_pkt_s { + queue_t next; /* 8 */ + uint8_t *buffer; /* 4 */ + uint32_t flags; /* 4 */ + int32_t length; /* 4 */ + uint32_t unused[3]; /* 12 */ + uint8_t data[ETH_PKTBUF_LEN]; +} eth_pkt_t; +#endif + +#define CACHE_ALIGN 32 +#define ETH_PKTBUF_LINES ((sizeof(eth_pkt_t) + (CACHE_ALIGN-1))/CACHE_ALIGN) +#define ETH_PKTBUF_SIZE (ETH_PKTBUF_LINES*CACHE_ALIGN) +#define ETH_PKTBUF_OFFSET (offsetof(eth_pkt_t, data)) + +#define ETH_PKT_BASE(data) ((eth_pkt_t *)((data) - ETH_PKTBUF_OFFSET)) + +/* packet flags */ +#define ETH_TX_SETUP 1 /* assumes Perfect Filtering format */ + +static void +show_packet(char c, eth_pkt_t *pkt) +{ + int i; + int n = (pkt->length < 32 ? pkt->length : 32); + + xprintf("%c[%4d]:", c, pkt->length); + for (i = 0; i < n; i++) { + if (i % 4 == 0) + xprintf(" "); + xprintf("%02x", pkt->buffer[i]); + } + xprintf("\n"); +} + + +/* Descriptor structures. NOTE: To avoid having descriptors straddle + cache lines, we append a pad word, ignored by DMA, to each. */ + +typedef struct rx_dscr { + pci_addr_t rxd_link; + uint32_t rxd_cmdsts; + pci_addr_t rxd_bufptr; + uint32_t rxd_pad; +} rx_dscr; + +typedef struct tx_dscr { + pci_addr_t txd_link; + uint32_t txd_cmdsts; + pci_addr_t txd_bufptr; + uint32_t txd_pad; +} tx_dscr; + + +/* Driver data structures */ + +typedef enum { + eth_state_uninit, + eth_state_off, + eth_state_on, + eth_state_broken +} eth_state_t; + +#define ETH_PKTPOOL_SIZE 32 + +typedef struct dp83815_softc { + uint32_t membase; + uint8_t irq; /* interrupt mapping (used if IPOLL) */ + pcitag_t tag; /* tag for configuration registers */ + + uint8_t hwaddr[ENET_ADDR_LEN]; + uint16_t device; /* chip device code */ + uint8_t revision; /* chip revision and step */ + + eth_state_t state; /* current state */ + uint32_t intmask; /* interrupt mask */ + + /* These fields are set before calling dp83815_hwinit */ + int linkspeed; /* encodings from cfe_ioctl */ + int loopback; + + /* Packet free list */ + queue_t freelist; + uint8_t *pktpool; + queue_t rxqueue; + + /* The descriptor tables */ + uint8_t *rxdscrmem; /* receive descriptors */ + uint8_t *txdscrmem; /* transmit descriptors */ + + /* These fields keep track of where we are in tx/rx processing */ + volatile rx_dscr *rxdscr_start; /* beginning of ring */ + volatile rx_dscr *rxdscr_end; /* end of ring */ + volatile rx_dscr *rxdscr_remove; /* next one we expect DMA to use */ + volatile rx_dscr *rxdscr_add; /* next place to put a buffer */ + int rxdscr_onring; + + volatile tx_dscr *txdscr_start; /* beginning of ring */ + volatile tx_dscr *txdscr_end; /* end of ring */ + volatile tx_dscr *txdscr_remove; /* next one we will use for tx */ + volatile tx_dscr *txdscr_add; /* next place to put a buffer */ + + cfe_devctx_t *devctx; + + /* These fields describe the PHY */ + int phy_addr; + int phy_check; + uint32_t phy_status; + + /* Statistics */ + uint32_t inpkts; + uint32_t outpkts; + uint32_t interrupts; + uint32_t rx_interrupts; + uint32_t tx_interrupts; + uint32_t bus_errors; +} dp83815_softc; + + +/* Entry to and exit from critical sections (currently relative to + interrupts only, not SMP) */ + +#if CFG_INTERRUPTS +#define CS_ENTER(sc) cfe_disable_irq(sc->irq) +#define CS_EXIT(sc) cfe_enable_irq(sc->irq) +#else +#define CS_ENTER(sc) ((void)0) +#define CS_EXIT(sc) ((void)0) +#endif + + +/* Driver parameterization */ + +#define MAXRXDSCR 32 +#define MAXTXDSCR 32 +#define MINRXRING 8 + + +/* Prototypes */ + +static void dp83815_ether_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +/* Address mapping macros */ + +/* Note that PTR_TO_PHYS only works with 32-bit addresses, but then + so does the dp83815. */ +#define PTR_TO_PHYS(x) (K0_TO_PHYS((uintptr_t)(x))) +#define PHYS_TO_PTR(a) ((uint8_t *)PHYS_TO_K0(a)) + +/* All mappings through the PCI host bridge use match bits mode. */ +#define PHYS_TO_PCI(a) ((uint32_t) (a) | 0x20000000) +#define PCI_TO_PHYS(a) ((uint32_t) (a) & 0x1FFFFFFF) + +#define PCI_TO_PTR(a) (PHYS_TO_PTR(PCI_TO_PHYS(a))) +#define PTR_TO_PCI(x) (PHYS_TO_PCI(PTR_TO_PHYS(x))) + +#if __long64 +#define READCSR(sc,csr) \ + (*((volatile uint32_t *) (PHYS_TO_XKSEG_UNCACHED((sc)->membase + (csr))))) + +#define WRITECSR(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->membase + (csr)))) = (val)) + +#else +#define READCSR(sc,csr) \ + (hs_read32(PHYS_TO_XKSEG_UNCACHED((sc)->membase + (csr)))) + +#define WRITECSR(sc,csr,val) \ + (hs_write32(PHYS_TO_XKSEG_UNCACHED((sc)->membase + (csr)), (val))) + +#endif + +#define RESET_ADAPTER(sc) \ + { \ + /* XXX */ \ + } + + +/* Debugging */ + +static void +dumpstat(dp83815_softc *sc) +{ + xprintf("-- CR = %08X CFG = %08x\n", + READCSR(sc, R_CR), READCSR(sc, R_CFG)); +} + +static void +dumpcsrs(dp83815_softc *sc) +{ + int reg; + + xprintf("-------------\n"); + for (reg = 0; reg < R_MIBC; reg += 4) { + xprintf("CSR %02X = %08X\n", reg, READCSR(sc, reg)); + } + xprintf("-------------\n"); +} + + +/* Packet management */ + +/* ********************************************************************* + * ETH_ALLOC_PKT(sc) + * + * Allocate a packet from the free list. + * + * Input parameters: + * sc - eth structure + * + * Return value: + * pointer to packet structure, or NULL if none available + ********************************************************************* */ +static eth_pkt_t * +eth_alloc_pkt(dp83815_softc *sc) +{ + eth_pkt_t *pkt; + + CS_ENTER(sc); + pkt = (eth_pkt_t *) q_deqnext(&sc->freelist); + CS_EXIT(sc); + if (!pkt) return NULL; + + pkt->buffer = pkt->data; + pkt->length = ETH_PKTBUF_LEN; + pkt->flags = 0; + + return pkt; +} + + +/* ********************************************************************* + * ETH_FREE_PKT(sc,pkt) + * + * Return a packet to the free list + * + * Input parameters: + * sc - sbmac structure + * pkt - packet to return + * + * Return value: + * nothing + ********************************************************************* */ +static void +eth_free_pkt(dp83815_softc *sc, eth_pkt_t *pkt) +{ + CS_ENTER(sc); + q_enqueue(&sc->freelist, &pkt->next); + CS_EXIT(sc); +} + + +/* ********************************************************************* + * ETH_INITFREELIST(sc) + * + * Initialize the buffer free list for this mac. The memory + * allocated to the free list is carved up and placed on a linked + * list of buffers for use by the mac. + * + * Input parameters: + * sc - eth structure + * + * Return value: + * nothing + ********************************************************************* */ +static void +eth_initfreelist(dp83815_softc *sc) +{ + int idx; + uint8_t *ptr; + eth_pkt_t *pkt; + + q_init(&sc->freelist); + + ptr = sc->pktpool; + for (idx = 0; idx < ETH_PKTPOOL_SIZE; idx++) { + pkt = (eth_pkt_t *) ptr; + eth_free_pkt(sc, pkt); + ptr += ETH_PKTBUF_SIZE; + } +} + + +/* Utilities */ + +static const char * +dp83815_devname(dp83815_softc *sc) +{ + return (sc->devctx != NULL ? cfe_device_name(sc->devctx) : "eth?"); +} + + +/* Descriptor ring management */ + +static int +dp83815_add_rcvbuf(dp83815_softc *sc, eth_pkt_t *pkt) +{ + volatile rx_dscr *rxd; + volatile rx_dscr *nextrxd; + + rxd = sc->rxdscr_add; + + /* Figure out where the next descriptor will go */ + nextrxd = rxd+1; + if (nextrxd == sc->rxdscr_end) { + nextrxd = sc->rxdscr_start; + } + + /* + * If the next one is the same as our remove pointer, + * the ring is considered full. (it actually has room for + * one more, but we reserve the remove == add case for "empty") + */ + if (nextrxd == sc->rxdscr_remove) return -1; + + rxd->rxd_bufptr = PTR_TO_PCI(pkt->buffer); + rxd->rxd_cmdsts = M_DES1_INTR | V_DES1_SIZE(ETH_PKTBUF_LEN); + + /* success, advance the pointer */ + sc->rxdscr_add = nextrxd; + CS_ENTER(sc); + sc->rxdscr_onring++; + CS_EXIT(sc); + + return 0; +} + +static void +dp83815_fillrxring(dp83815_softc *sc) +{ + eth_pkt_t *pkt; + + while (1) { + CS_ENTER(sc); + if (sc->rxdscr_onring >= MINRXRING) { + CS_EXIT(sc); + break; + } + CS_EXIT(sc); + pkt = eth_alloc_pkt(sc); + if (pkt == NULL) { + /* could not allocate a buffer */ + break; + } + if (dp83815_add_rcvbuf(sc, pkt) != 0) { + /* could not add buffer to ring */ + eth_free_pkt(sc, pkt); + break; + } + } +} + + +/* ********************************************************************* + * DP83815_RX_CALLBACK(sc, pkt) + * + * Receive callback routine. This routine is invoked when a + * buffer queued for receives is filled. In this simple driver, + * all we do is add the packet to a per-MAC queue for later + * processing, and try to put a new packet in the place of the one + * that was removed from the queue. + * + * Input parameters: + * sc - interface + * ptk - packet context (eth_pkt structure) + * + * Return value: + * nothing + ********************************************************************* */ +static void +dp83815_rx_callback(dp83815_softc *sc, eth_pkt_t *pkt) +{ + if (MACPHYTER_DEBUG) show_packet('>', pkt); /* debug */ + + CS_ENTER(sc); + q_enqueue(&sc->rxqueue, &pkt->next); + CS_EXIT(sc); + sc->inpkts++; + + dp83815_fillrxring(sc); +} + + +static void +dp83815_procrxring(dp83815_softc *sc) +{ + volatile rx_dscr *rxd; + eth_pkt_t *pkt; + eth_pkt_t *newpkt; + uint32_t cmdsts; + + for (;;) { + rxd = (volatile rx_dscr *) sc->rxdscr_remove; + + cmdsts = rxd->rxd_cmdsts; + if ((cmdsts & M_DES1_OWN) == 0) { + /* end of ring, no more packets */ + break; + } + + pkt = ETH_PKT_BASE(PCI_TO_PTR(rxd->rxd_bufptr)); + pkt->length = G_DES1_SIZE(cmdsts) - CRC_SIZE; + + /* Drop error packets */ + if (cmdsts & M_DES1_RX_ERRORS) { +#if MACPHYTER_DEBUG + if (pkt->length >= MIN_ETHER_PACK - CRC_SIZE) + xprintf("%s: rx error %08X\n", dp83815_devname(sc), cmdsts); +#endif + dp83815_add_rcvbuf(sc, pkt); + goto next; + } + + /* Pass up the packet */ + dp83815_rx_callback(sc, pkt); + + /* put a buffer back on the ring to replace this one */ + newpkt = eth_alloc_pkt(sc); + if (newpkt) dp83815_add_rcvbuf(sc, newpkt); + +next: + /* update the pointer, accounting for buffer wrap. */ + rxd++; + if (rxd == sc->rxdscr_end) + rxd = sc->rxdscr_start; + + sc->rxdscr_remove = (rx_dscr *) rxd; + CS_ENTER(sc); + sc->rxdscr_onring--; + CS_EXIT(sc); + } +} + + +static int +dp83815_add_txbuf(dp83815_softc *sc, eth_pkt_t *pkt) +{ + volatile tx_dscr *txd; + volatile tx_dscr *nexttxd; + + txd = sc->txdscr_add; + + /* Figure out where the next descriptor will go */ + nexttxd = (txd+1); + if (nexttxd == sc->txdscr_end) { + nexttxd = sc->txdscr_start; + } + + /* If the next one is the same as our remove pointer, + the ring is considered full. (it actually has room for + one more, but we reserve the remove == add case for "empty") */ + + if (nexttxd == sc->txdscr_remove) return -1; + + txd->txd_bufptr = PTR_TO_PCI(pkt->buffer); + txd->txd_cmdsts = M_DES1_INTR | M_DES1_OWN | V_DES1_SIZE(pkt->length); + + /* success, advance the pointer */ + sc->txdscr_add = nexttxd; + + return 0; +} + + +static int +dp83815_transmit(dp83815_softc *sc,eth_pkt_t *pkt) +{ + int rv; + + if (MACPHYTER_DEBUG) show_packet('<', pkt); /* debug */ + + rv = dp83815_add_txbuf(sc, pkt); + sc->outpkts++; + + WRITECSR(sc, R_CR, M_CR_TXE | M_CR_RXE); + return rv; +} + + +static void +dp83815_proctxring(dp83815_softc *sc) +{ + volatile tx_dscr *txd; + eth_pkt_t *pkt; + uint32_t cmdsts; + + for (;;) { + txd = (volatile tx_dscr *) sc->txdscr_remove; + + if (txd == sc->txdscr_add) { + /* ring is empty, no buffers to process */ + break; + } + + cmdsts = txd->txd_cmdsts; + if (cmdsts & M_DES1_OWN) { + /* Reached a packet still being transmitted */ + break; + } + + /* Just free the packet */ + pkt = ETH_PKT_BASE(PCI_TO_PTR(txd->txd_bufptr)); + eth_free_pkt(sc, pkt); + + /* update the pointer, accounting for buffer wrap. */ + txd++; + if (txd == sc->txdscr_end) + txd = sc->txdscr_start; + + sc->txdscr_remove = (tx_dscr *) txd; + } +} + + +static void +dp83815_initrings(dp83815_softc *sc) +{ + volatile tx_dscr *txd, *txn; + volatile rx_dscr *rxd, *rxn; + + /* Claim ownership of all descriptors for the driver */ + + for (txd = sc->txdscr_start; txd != sc->txdscr_end; txd++) { + txn = txd + 1; + if (txn == sc->txdscr_end) txn = sc->txdscr_start; + txd->txd_link = PTR_TO_PCI(txn); + txd->txd_cmdsts = 0; + txd->txd_pad = 0; + } + for (rxd = sc->rxdscr_start; rxd != sc->rxdscr_end; rxd++) { + rxn = rxd + 1; + if (rxn == sc->rxdscr_end) rxn = sc->rxdscr_start; + rxd->rxd_link = PTR_TO_PCI(rxn); + rxd->rxd_cmdsts = M_DES1_OWN; + rxd->rxd_pad = 0; + } + + /* Init the ring pointers */ + + sc->txdscr_add = sc->txdscr_remove = sc->txdscr_start; + sc->rxdscr_add = sc->rxdscr_remove = sc->rxdscr_start; + sc->rxdscr_onring = 0; + + /* Add stuff to the receive ring */ + + dp83815_fillrxring(sc); +} + + +static int +dp83815_init(dp83815_softc *sc) +{ + /* Allocate descriptor rings */ + sc->rxdscrmem = KMALLOC(MAXRXDSCR*sizeof(rx_dscr), sizeof(rx_dscr)); + sc->txdscrmem = KMALLOC(MAXTXDSCR*sizeof(tx_dscr), sizeof(tx_dscr)); + + /* Allocate buffer pool */ + sc->pktpool = KMALLOC(ETH_PKTPOOL_SIZE*ETH_PKTBUF_SIZE, CACHE_ALIGN); + eth_initfreelist(sc); + q_init(&sc->rxqueue); + + /* Fill in pointers to the rings */ + sc->rxdscr_start = (rx_dscr *) (sc->rxdscrmem); + sc->rxdscr_end = sc->rxdscr_start + MAXRXDSCR; + sc->rxdscr_add = sc->rxdscr_start; + sc->rxdscr_remove = sc->rxdscr_start; + sc->rxdscr_onring = 0; + + sc->txdscr_start = (tx_dscr *) (sc->txdscrmem); + sc->txdscr_end = sc->txdscr_start + MAXTXDSCR; + sc->txdscr_add = sc->txdscr_start; + sc->txdscr_remove = sc->txdscr_start; + + dp83815_initrings(sc); + + return 0; +} + + +static void +dp83815_resetrings(dp83815_softc *sc) +{ + volatile tx_dscr *txd; + volatile rx_dscr *rxd; + eth_pkt_t *pkt; + + /* Free already-sent descriptors and buffers */ + dp83815_proctxring(sc); + + /* Free any pending but unsent */ + txd = (volatile tx_dscr *) sc->txdscr_remove; + while (txd != sc->txdscr_add) { + txd->txd_cmdsts &=~ M_DES1_OWN; + pkt = ETH_PKT_BASE(PCI_TO_PTR(txd->txd_bufptr)); + eth_free_pkt(sc, pkt); + + txd++; + if (txd == sc->txdscr_end) + txd = sc->txdscr_start; + } + sc->txdscr_add = sc->txdscr_remove; + + /* Discard any received packets as well as all free buffers */ + rxd = (volatile rx_dscr *) sc->rxdscr_remove; + while (rxd != sc->rxdscr_add) { + rxd->rxd_cmdsts |= M_DES1_OWN; + pkt = ETH_PKT_BASE(PCI_TO_PTR(rxd->rxd_bufptr)); + eth_free_pkt(sc, pkt); + + rxd++; + if (rxd == sc->rxdscr_end) + rxd = sc->rxdscr_start; + CS_ENTER(sc); + sc->rxdscr_onring--; + CS_EXIT(sc); + } + + /* Reestablish the initial state. */ + dp83815_initrings(sc); +} + + +#if 0 /* XXX Multicast filtering not yet implemented. */ +/* CRCs */ + +#define IEEE_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- either endian */ + +static uint32_t +dp83815_crc32(const uint8_t *databuf, unsigned int datalen) +{ + unsigned int idx, bit, data; + uint32_t crc; + + crc = 0xFFFFFFFFUL; + for (idx = 0; idx < datalen; idx++) + for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) + crc = (crc >> 1) ^ (((crc ^ data) & 1) ? IEEE_CRC32_POLY : 0); + return crc; +} + +#define dp83815_mchash(mca) (dp83815_crc32((mca), 6) & 0x1FF) +#endif + + +#if MACPHYTER_TEST +/* EEPROM access */ + +/* Current NICs use the EEPROM auto-load feature and there is no need + for explicit EEPROM access. The following routines are included + for future applications and have been tested (Netgear FA311). */ + +/**************************************************************************** + * dp83815_spin(sc, ns) + * + * Spin for a short interval (nominally in nanoseconds) + * + * Input Parameters: ns - minimum required nsec. + * + * The delay loop uses uncached PCI reads, each of which requires + * at least 3 PCI bus clocks (45 ns at 66 MHz) to complete. The + * actual delay will be longer (much longer if preempted). + ***************************************************************************/ + +#define PCI_MIN_DELAY 45 + +static void +dp83815_spin(dp83815_softc *sc, long nanoseconds) +{ + long delay; + volatile uint32_t t; + + for (delay = nanoseconds; delay > 0; delay -= PCI_MIN_DELAY) + t = READCSR(sc, R_SRR); +} + + +/* + * The recommended EEPROM is the NM9306. + * Delays below are chosen to meet specs for NS93C64 (slow M variant). + * Current parts are faster. + * Reference: NS Memory Data Book, 1994 + */ + +#define EEPROM_SIZE (2*0x0C) +#define EEPROM_MAX_CYCLES 32 + +#define EEPROM_CMD_BITS 3 +#define EEPROM_ADDR_BITS 6 + +#define K_EEPROM_READ_CMD 06 +#define K_EEPROM_WRITE_CMD 05 + +#define EEPROM_CRC_INDEX (EEPROM_SIZE-2) + +#define EEPROM_WORD(rom,offset) ((rom)[offset] | ((rom)[offset+1] << 8)) + +static void +eeprom_idle_state(dp83815_softc *sc) +{ + uint32_t ctrl; + unsigned int i; + + ctrl = READCSR(sc, R_MEAR); + + ctrl |= M_MEAR_EESEL; + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 100); /* CS setup (Tcss=100) */ + + /* Run the clock through the maximum number of pending read cycles */ + for (i = 0; i < EEPROM_MAX_CYCLES*2; i++) { + ctrl ^= M_MEAR_EECLK; + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 1000); /* SK period (Fsk=0.5MHz) */ + } + + /* Deassert EEPROM Chip Select */ + ctrl &=~ M_MEAR_EESEL; + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 50); /* CS recovery (Tsks=50) */ +} + +static void +eeprom_send_command_bit(dp83815_softc *sc, unsigned int data) +{ + uint32_t ctrl; + + ctrl = READCSR(sc, R_MEAR); + + /* Place the data bit on the bus */ + if (data == 1) + ctrl |= M_MEAR_EEDI; + else + ctrl &=~ M_MEAR_EEDI; + + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 360); /* setup: Tdis=200 */ + + /* Now clock the data into the EEPROM */ + WRITECSR(sc, R_MEAR, ctrl | M_MEAR_EECLK); + dp83815_spin(sc, 900); /* clock high, Tskh=500 */ + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 450); /* clock low, Tskl=250 */ + + /* Now clear the data bit */ + ctrl &=~ M_MEAR_EEDI; /* data invalid, Tidh=20 for SK^ */ + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 270); /* min cycle, 1/Fsk=2000 */ +} + +static uint16_t +eeprom_read_bit(dp83815_softc *sc) +{ + uint32_t ctrl; + + ctrl = READCSR(sc, R_MEAR); + + /* Generate a clock cycle before doing a read */ + WRITECSR(sc, R_MEAR, ctrl | M_MEAR_EECLK); /* rising edge */ + dp83815_spin(sc, 1000); /* clock high, Tskh=500, Tpd=1000 */ + WRITECSR(sc, R_MEAR, ctrl); /* falling edge */ + dp83815_spin(sc, 1000); /* clock low, 1/Fsk=2000 */ + + ctrl = READCSR(sc, R_MEAR); + return ((ctrl & M_MEAR_EEDO) != 0 ? 1 : 0); +} + +#define CMD_BIT_MASK (1 << (EEPROM_CMD_BITS+EEPROM_ADDR_BITS-1)) + +static uint16_t +eeprom_read_word(dp83815_softc *sc, unsigned int index) +{ + uint16_t command, word; + uint32_t ctrl; + unsigned int i; + + ctrl = READCSR(sc, R_MEAR) | M_MEAR_EESEL; + + /* Assert the EEPROM CS line */ + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 100); /* CS setup, Tcss = 100 */ + + /* Send the read command to the EEPROM */ + command = (K_EEPROM_READ_CMD << EEPROM_ADDR_BITS) | index; + for (i = 0; i < EEPROM_CMD_BITS+EEPROM_ADDR_BITS; i++) { + eeprom_send_command_bit(sc, (command & CMD_BIT_MASK) != 0 ? 1 : 0); + command <<= 1; + } + + /* Now read the bits from the EEPROM (MSB first) */ + word = 0; + for (i = 0; i < 16; ++i) { + word <<= 1; + word |= eeprom_read_bit(sc); + } + + /* Clear the EEPROM CS Line, CS hold, Tcsh = 0 */ + WRITECSR(sc, R_MEAR, ctrl &~ M_MEAR_EESEL); + + return word; +} + + +/**************************************************************************** + * eeprom_checksum() + * + * Calculate the checksum of the EEPROM and return it. See Section + * 4.2.4 for the algorithm. + ***************************************************************************/ + +static uint16_t +eeprom_checksum(const uint8_t rom[]) +{ + uint16_t sum; + int i; + + sum = 0; + for (i = 0; i < EEPROM_SIZE-1; i++) + sum += rom[i]; + sum ^= 0xFF; + return (((sum + 1) & 0xFF) << 8) | 0x55; +} + + +/**************************************************************************** + * eeprom_read_all(sc, uint8_t dest) + * + * Read the entire EEPROM into the srom array + * + * Input parameters: + * sc - dp83815 state + ***************************************************************************/ + +static int +eeprom_read_all(dp83815_softc *sc, uint8_t dest[]) +{ + int i; + uint16_t cksum, temp; + + WRITECSR(sc, R_MEAR, M_MEAR_EESEL); + + eeprom_idle_state(sc); + + for (i = 0; i < EEPROM_SIZE/2; i++) { + temp = eeprom_read_word(sc, i); + dest[2*i] = temp & 0xFF; + dest[2*i+1] = temp >> 8; + } + + WRITECSR(sc, R_MEAR, 0); /* CS hold, Tcsh=0 */ + + cksum = eeprom_checksum(dest);; + if (cksum != EEPROM_WORD(dest, EEPROM_CRC_INDEX)) { + xprintf("%s: Invalid EEPROM CHECKSUM, calc %04x, stored %04x\n", + dp83815_devname(sc), + cksum, EEPROM_WORD(dest, EEPROM_CRC_INDEX)); + return 0/*-1*/; + } + return 0; +} + +static int +eeprom_read_addr(const uint8_t rom[], uint8_t buf[]) +{ + uint16_t s; + unsigned offset, mask; + int i, j; + + if (eeprom_checksum(rom) != EEPROM_WORD(rom, EEPROM_SIZE-2)) + return -1; + + s = 0; + offset = 2*6; mask = 0x1; + i = j = 0; + do { + s >>= 1; + if ((EEPROM_WORD(rom, offset) & mask) != 0) s |= 0x8000; + mask >>= 1; + if (mask == 0) { + offset +=2; mask = 0x8000; + } + i++; + if (i % 16 == 0) { + buf[j++] = s & 0xFF; + buf[j++] = s >> 8; + s = 0; + } + } while (i < ENET_ADDR_LEN*8); + + return 0; +} +#endif /* MACPHYTER_TEST */ + +#if 0 +static void +eeprom_dump(uint8_t srom[]) +{ + int i; + + xprintf("DP83815: EEPROM data:"); + for (i = 0; i < EEPROM_SIZE; i++) { + if (i % 16 == 0) + xprintf("\n %02x: ", i); + xprintf(" %02x", srom[i]); + } + xprintf("\n"); +} +#else +#define eeprom_dump(srom) +#endif + + +static int +dp83815_get_pm_addr(dp83815_softc *sc, uint8_t buf[]) +{ + uint32_t rfcr; + unsigned rfaddr; + unsigned i; + uint32_t rfdata; + + rfcr = READCSR(sc, R_RFCR); + rfaddr = K_RFCR_PMATCH_ADDR; + + for (i = 0; i < ENET_ADDR_LEN/2; i++) { + rfcr &=~ M_RFCR_RFADDR; + rfcr |= V_RFCR_RFADDR(rfaddr); + WRITECSR(sc, R_RFCR, rfcr); + rfdata = READCSR(sc, R_RFDR); + buf[2*i] = rfdata & 0xFF; + buf[2*i+1] = (rfdata >> 8) & 0xFF; + rfaddr += 2; + } + + return 0; +} + + +#if MACPHYTER_TEST +/* MII access */ + +/* Current NICs use the internal PHY, which can be accessed more + simply via internal registers. The following routines are + primarily for management access to an external PHY and are retained + for future applications. They have been tested on a Netgear FA311. */ + +/**************************************************************************** + * MII access utility routines + ***************************************************************************/ + +/* MII clock limited to 2.5 MHz (DP83815 allows 25 MHz), transactions + end with MDIO tristated */ + +static void +mii_write_bits(dp83815_softc *sc, uint32_t data, unsigned int count) +{ + uint32_t ctrl; + uint32_t bitmask; + + ctrl = READCSR(sc, R_MEAR) & ~M_MEAR_MDC; + ctrl |= M_MEAR_MDDIR; + + for (bitmask = 1 << (count-1); bitmask != 0; bitmask >>= 1) { + ctrl &=~ M_MEAR_MDIO; + if ((data & bitmask) != 0) ctrl |= M_MEAR_MDIO; + WRITECSR(sc, R_MEAR, ctrl); + + dp83815_spin(sc, 2000); /* setup */ + WRITECSR(sc, R_MEAR, ctrl | M_MEAR_MDC); + dp83815_spin(sc, 2000); /* hold */ + WRITECSR(sc, R_MEAR, ctrl); + } +} + +static void +mii_turnaround(dp83815_softc *sc) +{ + uint32_t ctrl; + + ctrl = READCSR(sc, R_MEAR) &~ M_MEAR_MDDIR; + + /* stop driving data */ + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 2000); /* setup */ + WRITECSR(sc, R_MEAR, ctrl | M_MEAR_MDC); + dp83815_spin(sc, 2000); /* clock high */ + WRITECSR(sc, R_MEAR, ctrl); + + /* read back and check for 0 here? */ +} + +/**************************************************************************** + * mii_read_register + * + * This routine reads a register from the PHY chip using the MII + * serial management interface. + * + * Input parameters: + * index - index of register to read (0-31) + * + * Return value: + * word read from register + ***************************************************************************/ + +static uint16_t +mii_read_register(dp83815_softc *sc, unsigned int index) +{ + /* Send the command and address to the PHY. The sequence is + a synchronization sequence (32 1 bits) + a "start" command (2 bits) + a "read" command (2 bits) + the PHY addr (5 bits) + the register index (5 bits) + */ + uint32_t ctrl; + uint16_t word; + int i; + + mii_write_bits(sc, 0xFF, 8); + mii_write_bits(sc, 0xFFFFFFFF, 32); + mii_write_bits(sc, MII_COMMAND_START, 2); + mii_write_bits(sc, MII_COMMAND_READ, 2); + mii_write_bits(sc, sc->phy_addr, 5); + mii_write_bits(sc, index, 5); + + mii_turnaround(sc); + + ctrl = READCSR(sc, R_MEAR) &~ (M_MEAR_MDC | M_MEAR_MDDIR); + word = 0; + + for (i = 0; i < 16; i++) { + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 2000); /* clock width low */ + WRITECSR(sc, R_MEAR, ctrl | M_MEAR_MDC); + dp83815_spin(sc, 2000); /* clock width high */ + WRITECSR(sc, R_MEAR, ctrl); + dp83815_spin(sc, 1000); /* output delay */ + word <<= 1; + if ((READCSR(sc, R_MEAR) & M_MEAR_MDIO) != 0) + word |= 0x0001; + } + + return word; + + /* reset to output mode? */ +} + +/**************************************************************************** + * mii_write_register + * + * This routine writes a register in the PHY chip using the MII + * serial management interface. + * + * Input parameters: + * index - index of register to write (0-31) + * value - word to write + ***************************************************************************/ + +static void +mii_write_register(dp83815_softc *sc, unsigned int index, uint16_t value) +{ + mii_write_bits(sc, 0xFF, 8); + mii_write_bits(sc, 0xFFFFFFFF, 32); + mii_write_bits(sc, MII_COMMAND_START, 2); + mii_write_bits(sc, MII_COMMAND_WRITE, 2); + mii_write_bits(sc, sc->phy_addr, 5); + mii_write_bits(sc, index, 5); + mii_write_bits(sc, MII_COMMAND_ACK, 2); + mii_write_bits(sc, value, 16); + + /* reset to input mode? */ +} + + +static int +mii_probe(dp83815_softc *sc) +{ + int i; + uint16_t id1, id2; + + /* Empirically, bit-banged access will return register 0 of the + integrated PHY for all registers of all unpopulated PHY + addresses. */ + for (i = 0; i < 32; i++) { + sc->phy_addr = i; + id1 = mii_read_register(sc, MII_PHYIDR1); + id2 = mii_read_register(sc, MII_PHYIDR2); + if ((id1 != 0x0000 && id1 != 0xFFFF) || + (id2 != 0x0000 && id2 != 0xFFFF)) { + if (id1 != id2) return 0; + } + } + return -1; +} + +#if 0 +#define OUI_NAT_SEMI 0x080017 +#define IDR_NAT_SEMI 0x080017 /* NSC does not bit-reverse each byte */ +#define PART_83815 0x02 + +static void +mii_dump(dp83815_softc *sc, const char *label) +{ + int i; + uint16_t r; + uint32_t idr, part; + + xprintf("%s\n", label); + idr = 0; + for (i = 0; i <= 6; ++i) { + r = mii_read_register(sc, i); + xprintf("MII_REG%02x: %04x\n", i, r); + if (i == MII_PHYIDR1) { + idr |= r << 6; + } + else if (i == MII_PHYIDR2) { + idr |= (r >> 10) & 0x3F; + part = (r >> 4) & 0x3F; + } + } + if (idr == IDR_NAT_SEMI && part == PART_83815) { + r = mii_read_register(sc, 7); + xprintf("MII_REG%02x: %04x\n", i, r); + for (i = 0x10; i <= 0x16; ++i) { + r = mii_read_register(sc, i); + xprintf("MII_REG%02x: %04x\n", i, r); + } + for (i = 0x19; i <= 0x1A; ++i) { + r = mii_read_register(sc, i); + xprintf("MII_REG%02x: %04x\n", i, r); + } + } +} +#else +#define mii_dump(sc,label) +#endif + + +/* The following functions are suitable for explicit MII access. */ + +static void +mii_set_speed(dp83815_softc *sc, int speed) +{ + uint16_t control; + + control = mii_read_register(sc, MII_BMCR); + + control &=~ (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + control &=~ (BMCR_SPEED0 | BMCR_SPEED1 | BMCR_DUPLEX); + + switch (speed) { + case ETHER_SPEED_10HDX: + default: + break; + case ETHER_SPEED_10FDX: + control |= BMCR_DUPLEX; + break; + case ETHER_SPEED_100HDX: + control |= BMCR_SPEED100; + break; + case ETHER_SPEED_100FDX: + control |= BMCR_SPEED100 | BMCR_DUPLEX ; + break; + } + + mii_write_register(sc, MII_BMCR, control); +} + +static void +mii_autonegotiate(dp83815_softc *sc) +{ + uint16_t control, status, cap; + int timeout; + int linkspeed; + + linkspeed = ETHER_SPEED_UNKNOWN; + + /* Read twice to clear latching bits */ + status = mii_read_register(sc, MII_BMSR); + status = mii_read_register(sc, MII_BMSR); + mii_dump(sc, "query PHY"); + + if ((status & (BMSR_AUTONEG | BMSR_LINKSTAT)) == + (BMSR_AUTONEG | BMSR_LINKSTAT)) + control = mii_read_register(sc, MII_BMCR); + else { + /* reset the PHY */ + mii_write_register(sc, MII_BMCR, BMCR_RESET); + timeout = 3*CFE_HZ; + for (;;) { + control = mii_read_register(sc, MII_BMCR); + if ((control && BMCR_RESET) == 0 || timeout <= 0) + break; + cfe_sleep(CFE_HZ/2); + timeout -= CFE_HZ/2; + } + if ((control & BMCR_RESET) != 0) { + xprintf("%s: PHY reset failed\n", dp83815_devname(sc)); + return; + } + + status = mii_read_register(sc, MII_BMSR); + cap = ((status >> 6) & (ANAR_TXFD | ANAR_TXHD | ANAR_10FD | ANAR_10HD)) + | PSB_802_3; + mii_write_register(sc, MII_ANAR, cap); + control |= (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + + timeout = 3*CFE_HZ; + for (;;) { + status = mii_read_register(sc, MII_BMSR); + if ((status & BMSR_ANCOMPLETE) != 0 || timeout <= 0) + break; + cfe_sleep(CFE_HZ/2); + timeout -= CFE_HZ/2; + } + mii_dump(sc, "done PHY"); + } + + xprintf("%s: Link speed: ", dp83815_devname(sc)); + if ((status & BMSR_ANCOMPLETE) != 0) { + /* A link partner was negogiated... */ + + uint16_t remote = mii_read_register(sc, MII_ANLPAR); + + if ((remote & ANLPAR_TXFD) != 0) { + xprintf("100BaseT FDX\n"); + linkspeed = ETHER_SPEED_100FDX; + } + else if ((remote & ANLPAR_TXHD) != 0) { + xprintf("100BaseT HDX\n"); + linkspeed = ETHER_SPEED_100HDX; + } + else if ((remote & ANLPAR_10FD) != 0) { + xprintf("10BaseT FDX\n"); + linkspeed = ETHER_SPEED_10FDX; + } + else if ((remote & ANLPAR_10HD) != 0) { + xprintf("10BaseT HDX\n"); + linkspeed = ETHER_SPEED_10HDX; + } + } + else { + /* no link partner negotiation */ + control &=~ (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + xprintf("10BaseT HDX (assumed)\n"); + linkspeed = ETHER_SPEED_10HDX; + if ((status & BMSR_LINKSTAT) == 0) + mii_write_register(sc, MII_BMCR, control); + mii_set_speed(sc, linkspeed); + } + + status = mii_read_register(sc, MII_BMSR); /* clear latching bits */ + mii_dump(sc, "final PHY"); +} +#endif /* MACPHYTER_TEST */ + + +static void +dp83815_phyupdate(dp83815_softc *sc, uint32_t status) +{ + xprintf("%s: Link speed: ", dp83815_devname(sc)); + if ((status & M_CFG_LNKSTS) != 0) { + switch (status & (M_CFG_SPEED100 | M_CFG_FDUP)) { + case (M_CFG_SPEED100 | M_CFG_FDUP): + sc->linkspeed = ETHER_SPEED_100FDX; + xprintf("100BaseT FDX\n"); + break; + case (M_CFG_SPEED100): + sc->linkspeed = ETHER_SPEED_100HDX; + xprintf("100BaseT HDX\n"); + break; + case (M_CFG_FDUP): + sc->linkspeed = ETHER_SPEED_10FDX; + xprintf("10BaseT FDX\n"); + break; + default: + sc->linkspeed = ETHER_SPEED_10HDX; + xprintf("10BaseT HDX\n"); + break; + } + if ((status & M_CFG_SPEED100) != 0) { + uint32_t t; + + /* This is a reputed fix that improves 100BT rx + performance on short cables with "a small number" + of DP83815 chips. It comes from Bruce at NatSemi + via the Soekris support web page (see appended + note). */ + + WRITECSR(sc, R_PGSEL, 0x0001); + (void)READCSR(sc, R_PGSEL); /* push */ + t = READCSR(sc, R_DSPCFG); + WRITECSR(sc, R_DSPCFG, (t & 0xFFF) | 0x1000); + cfe_sleep(1); + t = READCSR(sc, R_TSTDAT) & 0xFF; + if ((t & 0x0080) == 0 || ((t > 0x00D8) && (t <= 0x00FF))) { + WRITECSR(sc, R_TSTDAT, 0x00E8); + t = READCSR(sc, R_DSPCFG); + WRITECSR(sc, R_DSPCFG, t | 0x0020); + } + WRITECSR(sc, R_PGSEL, 0); + } + if ((status & M_CFG_FDUP) != (sc->phy_status & M_CFG_FDUP)) { + uint32_t txcfg; + + txcfg = READCSR(sc, R_TXCFG); + if (status & M_CFG_FDUP) + txcfg |= M_TXCFG_CSI; + else + txcfg &= ~M_TXCFG_CSI; + WRITECSR(sc, R_RXCFG, txcfg); + } + } + else { + xprintf("Unknown\n"); + } + + sc->phy_status = status; +} + +static void +dp83815_hwinit(dp83815_softc *sc) +{ + if (sc->state == eth_state_uninit) { + uint32_t cfg; + uint32_t txcfg, rxcfg; + uint32_t ready; + int timeout; + + /* RESET_ADAPTER(sc); */ + sc->state = eth_state_off; + sc->bus_errors = 0; + + cfg = READCSR(sc, R_CFG); + cfg |= M_CFG_BEM; /* We will use match bits */ + WRITECSR(sc, R_CFG, cfg); + + sc->phy_status = 0; + dp83815_phyupdate(sc, cfg & M_CFG_LNKSUMMARY); + + txcfg = READCSR(sc, R_TXCFG); + txcfg |= M_TXCFG_ATP; + /* XXX fix up FLTH, DRTH? */ + WRITECSR(sc, R_TXCFG, txcfg); + + rxcfg = READCSR(sc, R_RXCFG); + /* Set an aggressive rx drain threshhold of 16 (2*8) bytes */ + rxcfg &= ~M_RXCFG_DRTH; + rxcfg |= V_RXCFG_DRTH(2); + WRITECSR(sc, R_RXCFG, rxcfg); + +#if MACPHYTER_TEST + { + uint8_t srom[EEPROM_SIZE]; + uint8_t addr[ENET_ADDR_LEN]; + + eeprom_read_all(sc, srom); + eeprom_dump(srom); + xprintf(" checksum %04x\n", eeprom_checksum(srom)); + if (eeprom_read_addr(srom, addr) == 0) + xprintf(" addr: %02x-%02x-%02x-%02x-%02x-%02x\n", + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); + + mii_probe(sc); + xprintf("MII address %02x\n", sc->phy_addr); + mii_dump(sc, "DP83815 PHY:"); + (void)mii_autonegotiate; + } +#endif /* MACPHYTER_TEST */ + + /* XXX fix up rx filtering here. We are relying on the EEPROM. */ + + /* XXX This is inappropriate on a restart. */ + timeout = 2*CFE_HZ; + ready = 0; + for (;;) { + ready |= READCSR(sc, R_ISR); + if ((ready & (M_INT_TXRCMP | M_INT_RXRCMP)) + == (M_INT_TXRCMP | M_INT_RXRCMP) || timeout <= 0) + break; + cfe_sleep(CFE_HZ/10); + timeout -= CFE_HZ/10; + } + if ((ready & M_INT_TXRCMP) == 0) + xprintf("%s: tx reset failed\n", dp83815_devname(sc)); + if ((ready & M_INT_RXRCMP) == 0) + xprintf("%s: rx reset failed\n", dp83815_devname(sc)); + } +} + +static void +dp83815_setspeed(dp83815_softc *sc, int speed) +{ + /* XXX Not yet implemented - autonegotiation only. */ +} + +static void +dp83815_setloopback(dp83815_softc *sc, int mode) +{ + /* XXX Not yet implemented. */ +} + + +static void +dp83815_isr(void *arg) +{ + dp83815_softc *sc = (dp83815_softc *)arg; + uint32_t status; + uint32_t isr; + +#if IPOLL + sc->interrupts++; +#endif + + for (;;) { + + /* Read (and clear) the interrupt status. */ + isr = READCSR(sc, R_ISR); + status = isr & sc->intmask; + + /* if there are no more interrupts, leave now. */ + if (status == 0) break; + + /* Now, test each unmasked bit in the interrupt register and + handle each interrupt type appropriately. */ + + if (status & (M_INT_RTABT | M_INT_RMABT)) { + WRITECSR(sc, R_IER, 0); + + xprintf("%s: bus error\n", dp83815_devname(sc)); + dumpstat(sc); + sc->bus_errors++; + if (sc->bus_errors >= 2) { + dumpcsrs(sc); + RESET_ADAPTER(sc); + sc->state = eth_state_off; + sc->bus_errors = 0; + } +#if IPOLL + else + WRITECSR(sc, R_IMR, sc->intmask); +#endif + } + + if (status & M_INT_RXDESC) { +#if IPOLL + sc->rx_interrupts++; +#endif + dp83815_procrxring(sc); + } + + if (status & M_INT_TXDESC) { +#if IPOLL + sc->tx_interrupts++; +#endif + dp83815_proctxring(sc); + } + + if (status & (M_INT_TXURN | M_INT_RXORN)) { + if (status & M_INT_TXURN) { + xprintf("%s: tx underrun, %08x\n", dp83815_devname(sc), isr); + /* XXX Try to restart */ + } + if (status & M_INT_RXORN) { + xprintf("%s: tx overrun, %08x\n", dp83815_devname(sc), isr); + /* XXX Try to restart */ + } + } + + if (status & M_INT_PHY) { + sc->intmask &= ~ M_INT_PHY; + WRITECSR(sc, R_IMR, sc->intmask); + (void)READCSR(sc, R_MISR); /* Clear at PHY */ + sc->phy_check = 1; + } + + } +} + +static void +dp83815_checkphy(dp83815_softc *sc) +{ + uint32_t cfg; + uint32_t status; + + (void)READCSR(sc, R_MISR); /* Clear at PHY */ + cfg = READCSR(sc, R_CFG); + status = cfg & M_CFG_LNKSUMMARY; + if (status != sc->phy_status) { + /* XXX Can we really do the phy update with active rx and tx? */ + dp83815_phyupdate(sc, status); + } + + sc->intmask |= M_INT_PHY; + WRITECSR(sc, R_IMR, sc->intmask); +} + + +static void +dp83815_start(dp83815_softc *sc) +{ + dp83815_hwinit(sc); + + /* Set up loopback here */ + + sc->intmask = 0; + WRITECSR(sc, R_IER, 0); /* no interrupts */ + WRITECSR(sc, R_IMR, 0); + (void)READCSR(sc, R_ISR); /* clear any pending */ + + sc->phy_status = READCSR(sc, R_CFG) & M_CFG_LNKSUMMARY; + sc->phy_check = 0; + + sc->intmask = M_INT_RXDESC | M_INT_TXDESC; + sc->intmask |= M_INT_RTABT | M_INT_RMABT | M_INT_RXORN | M_INT_TXURN; + sc->intmask |= M_INT_PHY; + +#if IPOLL + cfe_request_irq(sc->irq, dp83815_isr, sc, CFE_IRQ_FLAGS_SHARED, 0); + WRITECSR(sc, R_IMR, sc->intmask); + WRITECSR(sc, R_IER, M_IER_IE); +#endif + + (void)READCSR(sc, R_MISR); /* clear any pending */ + WRITECSR(sc, R_MISR, MISR_MSKJAB | MISR_MSKRF | MISR_MSKFHF | MISR_MSKRHF); + WRITECSR(sc, R_MICR, MICR_INTEN); + + WRITECSR(sc, R_TXDP, PTR_TO_PCI(sc->txdscr_start)); + WRITECSR(sc, R_RXDP, PTR_TO_PCI(sc->rxdscr_start)); + + WRITECSR(sc, R_MIBC, M_MIBC_ACLR); /* zero hw MIB counters */ + + WRITECSR(sc, R_CR, M_CR_TXE | M_CR_RXE); + sc->state = eth_state_on; +} + +static void +dp83815_stop(dp83815_softc *sc) +{ + uint32_t status; + int count; + + /* Make sure that no further interrutps will be processed. */ + sc->intmask = 0; + WRITECSR(sc, R_IER, 0); + WRITECSR(sc, R_IMR, 0); + +#if IPOLL + (void)READCSR(sc, R_IER); /* Push */ + cfe_free_irq(sc->irq, 0); +#endif + + WRITECSR(sc, R_CR, M_CR_TXD | M_CR_RXD); + + /* wait for any DMA activity to terminate */ + for (count = 0; count <= 13; count++) { + status = READCSR(sc, R_CR); + if ((status & (M_CR_TXE | M_CR_RXE)) == 0) + break; + cfe_sleep(CFE_HZ/10); + } + if (count > 13) { + xprintf("%s: idle state not achieved\n", dp83815_devname(sc)); + dumpstat(sc); + RESET_ADAPTER(sc); + sc->state = eth_state_uninit; +#if 1 + sc->linkspeed = ETHER_SPEED_AUTO; +#endif + } +#if 0 /* XXX Not yet implemented. */ + else if (sc->loopback != ETHER_LOOPBACK_OFF) { + dp83815_setloopback(sc, ETHER_LOOPBACK_OFF); + } +#endif + + (void)READCSR(sc, R_ISR); /* Clear any stragglers. */ +} + + +/* ********************************************************************* + * ETH_PARSE_XDIGIT(c) + * + * Parse a hex digit, returning its value + * + * Input parameters: + * c - character + * + * Return value: + * hex value, or -1 if invalid + ********************************************************************* */ +static int +eth_parse_xdigit(char c) +{ + int digit; + + if ((c >= '0') && (c <= '9')) digit = c - '0'; + else if ((c >= 'a') && (c <= 'f')) digit = c - 'a' + 10; + else if ((c >= 'A') && (c <= 'F')) digit = c - 'A' + 10; + else digit = -1; + + return digit; +} + +/* ********************************************************************* + * ETH_PARSE_HWADDR(str,hwaddr) + * + * Convert a string in the form xx:xx:xx:xx:xx:xx into a 6-byte + * Ethernet address. + * + * Input parameters: + * str - string + * hwaddr - pointer to hardware address + * + * Return value: + * 0 if ok, else -1 + ********************************************************************* */ +static int +eth_parse_hwaddr(char *str, uint8_t *hwaddr) +{ + int digit1, digit2; + int idx = ENET_ADDR_LEN; + + while (*str && (idx > 0)) { + digit1 = eth_parse_xdigit(*str); + if (digit1 < 0) return -1; + str++; + if (!*str) return -1; + + if ((*str == ':') || (*str == '-')) { + digit2 = digit1; + digit1 = 0; + } + else { + digit2 = eth_parse_xdigit(*str); + if (digit2 < 0) return -1; + str++; + } + + *hwaddr++ = (digit1 << 4) | digit2; + idx--; + + if ((*str == ':') || (*str == '-')) + str++; + } + return 0; +} + +/* ********************************************************************* + * ETH_INCR_HWADDR(hwaddr,incr) + * + * Increment a 6-byte Ethernet hardware address, with carries + * + * Input parameters: + * hwaddr - pointer to hardware address + * incr - desired increment + * + * Return value: + * none + ********************************************************************* */ +static void +eth_incr_hwaddr(uint8_t *hwaddr, unsigned incr) +{ + int idx; + int carry; + + idx = 5; + carry = incr; + while (idx >= 0 && carry != 0) { + unsigned sum = hwaddr[idx] + carry; + + hwaddr[idx] = sum & 0xFF; + carry = sum >> 8; + idx--; + } +} + + +/* ********************************************************************* + * Declarations for CFE Device Driver Interface routines + ********************************************************************* */ + +static int dp83815_ether_open(cfe_devctx_t *ctx); +static int dp83815_ether_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int dp83815_ether_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int dp83815_ether_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int dp83815_ether_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int dp83815_ether_close(cfe_devctx_t *ctx); +static void dp83815_ether_poll(cfe_devctx_t *ctx, int64_t ticks); +static void dp83815_ether_reset(void *softc); + +/* ********************************************************************* + * CFE Device Driver dispatch structure + ********************************************************************* */ + +const static cfe_devdisp_t dp83815_ether_dispatch = { + dp83815_ether_open, + dp83815_ether_read, + dp83815_ether_inpstat, + dp83815_ether_write, + dp83815_ether_ioctl, + dp83815_ether_close, + dp83815_ether_poll, + dp83815_ether_reset +}; + +/* ********************************************************************* + * CFE Device Driver descriptor + ********************************************************************* */ + +const cfe_driver_t dp83815drv = { + "DP83815 Ethernet", + "eth", + CFE_DEV_NETWORK, + &dp83815_ether_dispatch, + dp83815_ether_probe +}; + + +static int +dp83815_ether_attach(cfe_driver_t *drv, + pcitag_t tag, int index, uint8_t hwaddr[]) +{ + dp83815_softc *sc; + uint32_t device; + uint32_t class; + phys_addr_t pa; + uint8_t promaddr[ENET_ADDR_LEN]; + char descr[100]; + uint32_t srr; + + device = pci_conf_read(tag, R_CFGID); + class = pci_conf_read(tag, R_CFGRID); + +#if 1 + /* Use memory space for the CSRs */ + pci_map_mem(tag, R_CFGMA, PCI_MATCH_BITS, &pa); +#else + /* Use i/o space for the CSRs */ + pci_map_io(tag, R_CFGIOA, PCI_MATCH_BITS, &pa); +#endif + + sc = (dp83815_softc *) KMALLOC(sizeof(dp83815_softc), 0); + + if (sc == NULL) { + xprintf("DP83815: No memory to complete probe\n"); + return 0; + } + memset(sc, 0, sizeof(*sc)); + + sc->membase = (uint32_t)pa; + sc->irq = pci_conf_read(tag, R_CFGINT) & 0xFF; + sc->tag = tag; + sc->device = PCI_PRODUCT(device); + sc->revision = PCI_REVISION(class); + sc->devctx = NULL; + +#if 1 + sc->linkspeed = ETHER_SPEED_AUTO; /* select autonegotiation */ +#else + sc->linkspeed = ETHER_SPEED_100FDX; /* 100 Mbps, full duplex */ +#endif + sc->loopback = ETHER_LOOPBACK_OFF; + memcpy(sc->hwaddr, hwaddr, ENET_ADDR_LEN); + + srr = READCSR(sc, R_SRR); +#if 0 + /* The NS data sheet recommends the following for "optimal + performance" of CVNG parts. Tested on a sample of one CVNG + part on an NS "Macphyter Demo II" eval board, it seemed to + produce slightly less reliable initial behavior. */ + if (G_SRR_REV(srr) == K_REV_CVNG) { + /* Update PHY DSP registers per data sheet. */ + WRITECSR(sc, R_PGSEL, 0x0001); + (void)READCSR(sc, R_PGSEL); /* push */ + WRITECSR(sc, R_PMDCSR, 0x189C); + WRITECSR(sc, R_TSTDAT, 0x0000); + WRITECSR(sc, R_DSPCFG, 0x5040); + WRITECSR(sc, R_SDCFG, 0x008C); + } +#endif + + dp83815_init(sc); + + /* Prefer the address in EEPROM. This will be read into the + PMATCH register upon power up. Unfortunately, how to test for + completion of the auto-load (but see PTSCR_EELOAD_EN). */ + if (dp83815_get_pm_addr(sc, promaddr) == 0) { + memcpy(sc->hwaddr, promaddr, ENET_ADDR_LEN); + } + + sc->state = eth_state_uninit; + + xsprintf(descr, "%s at 0x%X (%02x-%02x-%02x-%02x-%02x-%02x)", + drv->drv_description, sc->membase, + sc->hwaddr[0], sc->hwaddr[1], sc->hwaddr[2], + sc->hwaddr[3], sc->hwaddr[4], sc->hwaddr[5]); + + cfe_attach(drv, sc, NULL, descr); + return 1; +} + + +/* ********************************************************************* + * DP83815_ETHER_PROBE(drv,probe_a,probe_b,probe_ptr) + * + * Probe and install drivers for all dp83815 Ethernet controllers. + * For each, create a context structure and attach to the + * specified network device. + * + * Input parameters: + * drv - driver descriptor + * probe_a - not used + * probe_b - not used + * probe_ptr - string pointer to hardware address for the first + * MAC, in the form xx:xx:xx:xx:xx:xx + * + * Return value: + * nothing + ********************************************************************* */ +static void +dp83815_ether_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + int n; + uint8_t hwaddr[ENET_ADDR_LEN]; + + if (probe_ptr) + eth_parse_hwaddr((char *) probe_ptr, hwaddr); + else { + /* use default address 02-00-00-10-0B-00 */ + hwaddr[0] = 0x02; hwaddr[1] = 0x00; hwaddr[2] = 0x00; + hwaddr[3] = 0x10; hwaddr[4] = 0x0B; hwaddr[5] = 0x00; + } + + n = 0; + for (;;) { + pcitag_t tag; + + if (pci_find_device(K_PCI_VENDOR_NSC, K_PCI_ID_DP83815, n, &tag) != 0) + break; + dp83815_ether_attach(drv, tag, n, hwaddr); + n++; + eth_incr_hwaddr(hwaddr, 1); + } +} + + +/* The functions below are called via the dispatch vector for the 83815. */ + +/* ********************************************************************* + * DP83815_ETHER_OPEN(ctx) + * + * Open the Ethernet device. The MAC is reset, initialized, and + * prepared to receive and send packets. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +dp83815_ether_open(cfe_devctx_t *ctx) +{ + dp83815_softc *sc = ctx->dev_softc; + + if (sc->state == eth_state_on) + dp83815_stop(sc); + + sc->devctx = ctx; + + sc->inpkts = sc->outpkts = 0; + sc->interrupts = 0; + sc->rx_interrupts = sc->tx_interrupts = 0; + + dp83815_start(sc); + +#if XPOLL + dp83815_isr(sc); +#endif + + return 0; +} + +/* ********************************************************************* + * DP83815_ETHER_READ(ctx,buffer) + * + * Read a packet from the Ethernet device. If no packets are + * available, the read will succeed but return 0 bytes. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +dp83815_ether_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + dp83815_softc *sc = ctx->dev_softc; + eth_pkt_t *pkt; + int blen; + +#if XPOLL + dp83815_isr(sc); +#endif + + if (sc->state != eth_state_on) return -1; + + CS_ENTER(sc); + pkt = (eth_pkt_t *) q_deqnext(&(sc->rxqueue)); + CS_EXIT(sc); + + if (pkt == NULL) { + buffer->buf_retlen = 0; + return 0; + } + + blen = buffer->buf_length; + if (blen > pkt->length) blen = pkt->length; + + blockcopy(buffer->buf_ptr, pkt->buffer, blen); + buffer->buf_retlen = blen; + + eth_free_pkt(sc, pkt); + dp83815_fillrxring(sc); + +#if XPOLL + dp83815_isr(sc); +#endif + + return 0; +} + +/* ********************************************************************* + * DP83815_ETHER_INPSTAT(ctx,inpstat) + * + * Check for received packets on the Ethernet device + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * inpstat - pointer to input status structure + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +dp83815_ether_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + dp83815_softc *sc = ctx->dev_softc; + +#if XPOLL + dp83815_isr(sc); +#endif + + if (sc->state != eth_state_on) return -1; + + /* We avoid an interlock here because the result is a hint and an + interrupt cannot turn a non-empty queue into an empty one. */ + inpstat->inp_status = (q_isempty(&(sc->rxqueue))) ? 0 : 1; + + return 0; +} + +/* ********************************************************************* + * DP83815_ETHER_WRITE(ctx,buffer) + * + * Write a packet to the Ethernet device. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +dp83815_ether_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + dp83815_softc *sc = ctx->dev_softc; + eth_pkt_t *pkt; + int blen; + +#if XPOLL + dp83815_isr(sc); +#endif + + if (sc->state != eth_state_on) return -1; + + pkt = eth_alloc_pkt(sc); + if (!pkt) return CFE_ERR_NOMEM; + + blen = buffer->buf_length; + if (blen > pkt->length) blen = pkt->length; + + blockcopy(pkt->buffer, buffer->buf_ptr, blen); + pkt->length = blen; + + if (dp83815_transmit(sc, pkt) != 0) { + eth_free_pkt(sc,pkt); + return CFE_ERR_IOERR; + } + +#if XPOLL + dp83815_isr(sc); +#endif + + return 0; +} + +/* ********************************************************************* + * DP83815_ETHER_IOCTL(ctx,buffer) + * + * Do device-specific I/O control operations for the device + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +dp83815_ether_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + dp83815_softc *sc = ctx->dev_softc; + int *argp; + int mode; + int speed; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_ETHER_GETHWADDR: + memcpy(buffer->buf_ptr, sc->hwaddr, sizeof(sc->hwaddr)); + return 0; + + case IOCTL_ETHER_SETHWADDR: + return -1; /* not supported */ + + case IOCTL_ETHER_GETSPEED: + argp = (int *) buffer->buf_ptr; + *argp = sc->linkspeed; + return 0; + + case IOCTL_ETHER_SETSPEED: + dp83815_stop(sc); + dp83815_resetrings(sc); + speed = *((int *) buffer->buf_ptr); + dp83815_setspeed(sc, speed); + dp83815_start(sc); + sc->state = eth_state_on; + return 0; + + case IOCTL_ETHER_GETLINK: + argp = (int *) buffer->buf_ptr; + *argp = sc->linkspeed; + return 0; + + case IOCTL_ETHER_GETLOOPBACK: + *((int *) buffer) = sc->loopback; + return 0; + + case IOCTL_ETHER_SETLOOPBACK: + dp83815_stop(sc); + dp83815_resetrings(sc); + mode = *((int *) buffer->buf_ptr); + sc->loopback = ETHER_LOOPBACK_OFF; /* default */ + if (mode == ETHER_LOOPBACK_INT || mode == ETHER_LOOPBACK_EXT) { + dp83815_setloopback(sc, mode); + } + dp83815_start(sc); + sc->state = eth_state_on; + return 0; + + default: + return -1; + } +} + +/* ********************************************************************* + * DP83815_ETHER_CLOSE(ctx) + * + * Close the Ethernet device. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +dp83815_ether_close(cfe_devctx_t *ctx) +{ + dp83815_softc *sc = ctx->dev_softc; + + sc->state = eth_state_off; + dp83815_stop(sc); + + /* resynchronize descriptor rings */ + dp83815_resetrings(sc); + + xprintf("%s: %d sent, %d received, %d interrupts\n", + dp83815_devname(sc), sc->outpkts, sc->inpkts, sc->interrupts); + xprintf(" %d rx interrupts, %d tx interrupts\n", + sc->rx_interrupts, sc->tx_interrupts); + + sc->devctx = NULL; + return 0; +} + + +/* ********************************************************************* + * DP83815_ETHER_POLL(ctx,ticks) + * + * TBD + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * ticks- current time in ticks + * + * Return value: + * nothing + ********************************************************************* */ + +static void +dp83815_ether_poll(cfe_devctx_t *ctx, int64_t ticks) +{ + dp83815_softc *sc = ctx->dev_softc; + + if (sc->phy_check) { + sc->phy_check = 0; + dp83815_checkphy(sc); + } +} + + +/* ********************************************************************* + * DP83815_ETHER_RESET(softc) + * + * This routine is called when CFE is restarted after a + * program exits. We can clean up pending I/Os here. + * + * Input parameters: + * softc - pointer to dp83815_softc + * + * Return value: + * nothing + ********************************************************************* */ + +static void +dp83815_ether_reset(void *softc) +{ + dp83815_softc *sc = (dp83815_softc *)softc; + + /* Turn off the Ethernet interface. */ + + /* RESET_ADAPTER(sc); */ + + sc->state = eth_state_uninit; +} diff --git a/cfe/cfe/dev/dev_ds17887clock.c b/cfe/cfe/dev/dev_ds17887clock.c new file mode 100644 index 0000000..2ee82a3 --- /dev/null +++ b/cfe/cfe/dev/dev_ds17887clock.c @@ -0,0 +1,422 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * DS17887-3 RTC driver File: dev_sb1250_ds17887clock.c + * + * This module contains a CFE driver for a DS17887-3 generic bus + * real-time-clock. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" + +#include "lib_physio.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +/* + * Register bits + */ + +#define DS17887REGA_UIP 0x80 /* Update-in-progress */ +#define DS17887REGA_DV2 0x40 /* Countdown chain */ +#define DS17887REGA_DV1 0x20 /* Oscillator enable */ +#define DS17887REGA_DV0 0x10 /* Bank Select */ +#define DS17887REGA_RS3 0x08 /* Rate-selection bits */ +#define DS17887REGA_RS2 0x04 +#define DS17887REGA_RS1 0x02 +#define DS17887REGA_RS0 0x01 + +#define DS17887REGB_SET 0x80 /* Set bit */ +#define DS17887REGB_PIE 0x40 /* Periodic Interrupt Enable */ +#define DS17887REGB_AIE 0x20 /* Alarm Interrupt Enable */ +#define DS17887REGB_UIE 0x10 /* Update-ended Interrupt Enable */ +#define DS17887REGB_SQWE 0x08 /* Square-wave Enable */ +#define DS17887REGB_DM 0x04 /* Data Mode (binary) */ +#define DS17887REGB_24 0x02 /* 24-hour mode control bit */ +#define DS17887REGB_DSE 0x01 /* Daylight Savings Enable */ + +#define DS17887REGC_IRQF 0x80 /* Interrupt request flag */ +#define DS17887REGC_PF 0x40 /* Periodic interrupt flag */ +#define DS17887REGC_AF 0x20 /* Alarm interrupt flag */ +#define DS17887REGC_UF 0x10 /* Update ended interrupt flag */ + +#define DS17887REGD_VRT 0x80 /* Valid RAM and time */ + +/* + * Register numbers + */ + +#define DS17887REG_SC 0x00 /* seconds */ +#define DS17887REG_SCA 0x01 /* seconds alarm */ +#define DS17887REG_MN 0x02 /* minutes */ +#define DS17887REG_MNA 0x03 /* minutes alarm */ +#define DS17887REG_HR 0x04 /* hours */ +#define DS17887REG_HRA 0x05 /* hours alarm */ +#define DS17887REG_DW 0x06 /* day of week */ +#define DS17887REG_DM 0x07 /* day of month */ +#define DS17887REG_MO 0x08 /* month */ +#define DS17887REG_YR 0x09 /* year */ +#define DS17887REG_A 0x0A /* register A */ +#define DS17887REG_B 0x0B /* register B */ +#define DS17887REG_C 0x0C /* register C */ +#define DS17887REG_D 0x0D /* register D */ + +#define DS17887REG_CE 0x48 /* century (bank 1 only) */ + +#define BCD(x) (((x) % 10) + (((x) / 10) << 4)) +#define SET_TIME 0x00 +#define SET_DATE 0x01 + +#define WRITECSR(p,v) phys_write8((p),(v)) +#define READCSR(p) phys_read8((p)) + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + +static void ds17887_clock_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +static int ds17887_clock_open(cfe_devctx_t *ctx); +static int ds17887_clock_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int ds17887_clock_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int ds17887_clock_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int ds17887_clock_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int ds17887_clock_close(cfe_devctx_t *ctx); + + +/* ********************************************************************* + * Device dispatch + ********************************************************************* */ + +const static cfe_devdisp_t ds17887_clock_dispatch = { + ds17887_clock_open, + ds17887_clock_read, + ds17887_clock_inpstat, + ds17887_clock_write, + ds17887_clock_ioctl, + ds17887_clock_close, + NULL, + NULL +}; + +const cfe_driver_t ds17887_clock = { + "DS17887 RTC", + "clock", + CFE_DEV_CLOCK, + &ds17887_clock_dispatch, + ds17887_clock_probe +}; + + +/* ********************************************************************* + * Structures + ********************************************************************* */ +typedef struct ds17887_clock_s { + physaddr_t clock_base; +} ds17887_clock_t; + +/* ********************************************************************* + * ds17887_clock_probe(drv,a,b,ptr) + * + * Probe routine for this driver. This routine creates the + * local device context and attaches it to the driver list + * within CFE. + * + * Input parameters: + * drv - driver handle + * a,b - probe hints (longs) + * ptr - probe hint (pointer) + * + * Return value: + * nothing + ********************************************************************* */ + +static void ds17887_clock_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + ds17887_clock_t *softc; + char descr[80]; + + softc = (ds17887_clock_t *) KMALLOC(sizeof(ds17887_clock_t),0); + + /* + * Probe_a is the clock base address + * Probe_b is unused. + * Probe_ptr is unused. + */ + + softc->clock_base = probe_a; + + xsprintf(descr,"%s at 0x%X", + drv->drv_description,(uint32_t)probe_a); + cfe_attach(drv,softc,NULL,descr); + +} + +/* ********************************************************************* + * ds17887_clock_open(ctx) + * + * Open this device. For the DS17887, we do a quick test + * read to be sure the device is out there. + * + * Input parameters: + * ctx - device context (can obtain our softc here) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int ds17887_clock_open(cfe_devctx_t *ctx) +{ + ds17887_clock_t *softc = ctx->dev_softc; + uint8_t byte; + physaddr_t clockbase; + + clockbase = softc->clock_base; + + /* Make sure battery is still good and RTC valid */ + if ( !(READCSR(clockbase+DS17887REG_D) & DS17887REGD_VRT) ) { + printf("Warning: Battery has failed. Clock setting is not accurate.\n"); + } + + /* Switch to bank 1. Mainly for century byte */ + byte = (uint8_t) (READCSR(clockbase+DS17887REG_A) & 0xFF); + WRITECSR(clockbase+DS17887REG_A,DS17887REGA_DV0 | DS17887REGA_DV1 | byte); + + /* Set data mode to BCD, 24-hour mode, and enable daylight savings */ + byte = (uint8_t) (READCSR(clockbase+DS17887REG_B) & 0xFF); + byte &= (~DS17887REGB_DM & ~DS17887REGB_AIE); + WRITECSR(clockbase+DS17887REG_B, DS17887REGB_24 | DS17887REGB_DSE | byte ); + + return 0; +} + +/* ********************************************************************* + * ds17887_clock_read(ctx,buffer) + * + * Read time/date from the RTC. Read a total of 8 bytes in this format: + * hour-minute-second-month-day-year1-year2 + * + * Input parameters: + * ctx - device context (can obtain our softc here) + * buffer - buffer descriptor (target buffer, length, offset) + * + * Return value: + * number of bytes read + * -1 if an error occured + ********************************************************************* */ + +static int ds17887_clock_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + + ds17887_clock_t *softc = ctx->dev_softc; + unsigned char *bptr; + physaddr_t clockbase; + + clockbase = softc->clock_base; + + bptr = buffer->buf_ptr; + + *bptr++ = READCSR(clockbase+DS17887REG_HR); + *bptr++ = READCSR(clockbase+DS17887REG_MN); + *bptr++ = READCSR(clockbase+DS17887REG_SC); + *bptr++ = READCSR(clockbase+DS17887REG_MO); + *bptr++ = READCSR(clockbase+DS17887REG_DM); + *bptr++ = READCSR(clockbase+DS17887REG_YR); + *bptr++ = READCSR(clockbase+DS17887REG_CE); + + buffer->buf_retlen = 8; + return 0; +} + +/* ********************************************************************* + * ds17887_clock_write(ctx,buffer) + * + * Write time/date to the RTC. Write in this format: + * hour-minute-second-month-day-year1-year2-(time/date flag) + * + * Input parameters: + * ctx - device context (can obtain our softc here) + * buffer - buffer descriptor (target buffer, length, offset) + * + * Return value: + * number of bytes written + * -1 if an error occured + ********************************************************************* */ + +static int ds17887_clock_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + ds17887_clock_t *softc = ctx->dev_softc; + uint8_t byte; + unsigned char *bptr; + uint8_t hr,min,sec; + uint8_t mo,day,yr,y2k; + uint8_t timeDateFlag; + physaddr_t clockbase; + + clockbase = softc->clock_base; + + bptr = buffer->buf_ptr; + + /* Set SET bit */ + byte = (uint8_t) (READCSR(clockbase+DS17887REG_B) & 0xFF); + WRITECSR(clockbase+DS17887REG_B,DS17887REGB_SET | byte); + + timeDateFlag = *(bptr + 7); + + /* write time or date */ + if(timeDateFlag == SET_TIME) { + + hr = (uint8_t) *bptr; + WRITECSR(clockbase+DS17887REG_HR,BCD(hr)); + + min = (uint8_t) *(bptr+1); + WRITECSR(clockbase+DS17887REG_MN,BCD(min)); + + sec = (uint8_t) *(bptr+2); + WRITECSR(clockbase+DS17887REG_SC,BCD(sec)); + + buffer->buf_retlen = 3; + } + else if(timeDateFlag == SET_DATE) { + + mo = (uint8_t) *(bptr+3); + WRITECSR(clockbase+DS17887REG_MO,BCD(mo)); + + day = (uint8_t) *(bptr+4); + WRITECSR(clockbase+DS17887REG_DM,BCD(day)); + + yr = (uint8_t) *(bptr+5); + WRITECSR(clockbase+DS17887REG_YR,BCD(yr)); + + y2k = (uint8_t) *(bptr+6); + WRITECSR(clockbase+DS17887REG_CE,y2k); + + buffer->buf_retlen = 4; + } + else { + return -1; + } + + /* clear SET bit */ + byte = (uint8_t) (READCSR(clockbase+DS17887REG_B) & 0xFF); + WRITECSR(clockbase+DS17887REG_B,~DS17887REGB_SET & byte); + + return 0; +} + +/* ********************************************************************* + * ds17887_clock_inpstat(ctx,inpstat) + * + * Test input (read) status for the device + * + * Input parameters: + * ctx - device context (can obtain our softc here) + * inpstat - input status descriptor to receive value + * + * Return value: + * 0 if ok + * -1 if an error occured + ********************************************************************* */ + +static int ds17887_clock_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + inpstat->inp_status = 1; + + return 0; +} + +/* ********************************************************************* + * ds17887_clock_ioctl(ctx,buffer) + * + * Perform miscellaneous I/O control operations on the device. + * + * Input parameters: + * ctx - device context (can obtain our softc here) + * buffer - buffer descriptor (target buffer, length, offset) + * + * Return value: + * number of bytes read + * -1 if an error occured + ********************************************************************* */ + +static int ds17887_clock_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + return 0; +} + +/* ********************************************************************* + * ds17887_clock_close(ctx,buffer) + * + * Close the device. + * + * Input parameters: + * ctx - device context (can obtain our softc here) + * + * Return value: + * 0 if ok + * -1 if an error occured + ********************************************************************* */ + +static int ds17887_clock_close(cfe_devctx_t *ctx) +{ + return 0; +} + + + + + + + + diff --git a/cfe/cfe/dev/dev_flash.c b/cfe/cfe/dev/dev_flash.c new file mode 100644 index 0000000..98ad3e7 --- /dev/null +++ b/cfe/cfe/dev/dev_flash.c @@ -0,0 +1,1367 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash device driver File: dev_flash.c + * + * This driver supports various types of flash + * parts. You can also put the environment storage in + * the flash - the top sector is reserved for that purpose. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "addrspace.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_error.h" + +#include "dev_flash.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define FLASHCMD(sc,x,y) *((volatile unsigned char *)(sc->flashdrv_cmdaddr+ \ + ((x)<<(sc)->flashdrv_widemode))) = (y) +#define FLASHSTATUS(sc,x) *((volatile unsigned char *)(sc->flashdrv_cmdaddr+ \ + ((x)<<(sc)->flashdrv_widemode))) + +#define WRITEFLASH_K1(sc,x,y) *((volatile unsigned char *)(sc->flashdrv_cmdaddr+(x))) = (y) +#define READFLASH_K1(sc,x) *((volatile unsigned char *)(sc->flashdrv_cmdaddr+(x))) + +#define WRITEFLASH_K1W(sc,x,y) *((volatile unsigned short *)(sc->flashdrv_cmdaddr+(x))) = (y) +#define READFLASH_K1W(sc,x) *((volatile unsigned short *)(sc->flashdrv_cmdaddr+(x))) + + +#define GETCFIBYTE(softc,offset) READFLASH_K1(softc,((offset) << (softc->flashdrv_widemode))) + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + + +static void flashdrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +static int flashdrv_open(cfe_devctx_t *ctx); +static int flashdrv_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int flashdrv_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int flashdrv_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int flashdrv_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int flashdrv_close(cfe_devctx_t *ctx); + +/* ********************************************************************* + * Device dispatch + ********************************************************************* */ + +const static cfe_devdisp_t flashdrv_dispatch = { + flashdrv_open, + flashdrv_read, + flashdrv_inpstat, + flashdrv_write, + flashdrv_ioctl, + flashdrv_close, + NULL, + NULL +}; + +const cfe_driver_t flashdrv = { + "CFI flash", + "flash", + CFE_DEV_FLASH, + &flashdrv_dispatch, + flashdrv_probe +}; + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct flash_cfidata_s { + unsigned int cfidata_cmdset; /* ID of primary command set */ + unsigned int cfidata_devif; /* device interface byte */ + unsigned int cfidata_size; /* probed device size */ +} flash_cfidata_t; + +typedef struct flashops_s flashops_t; + +typedef struct flashdrv_s { + flash_probe_t flashdrv_probe; /* data from probe */ + int flashdrv_devsize; /* size reported by driver */ + unsigned char *flashdrv_cmdaddr; /* virtual address (K1) */ + int flashdrv_widemode; /* 1=wide flash in byte mode, 0=narrow flash */ + int flashdrv_initialized; /* true if we've probed already */ + flash_info_t flashdrv_info; + int flashdrv_nvram_ok; /* true if we can use as NVRAM */ + int flashdrv_unlocked; /* true if we can r/w past devsize */ + nvram_info_t flashdrv_nvraminfo; + flashops_t *flashdrv_ops; + flash_cfidata_t flashdrv_cfidata; +} flashdrv_t; + +struct flashops_s { + int (*erasesector)(flashdrv_t *f,int offset); + int (*writeblk)(flashdrv_t *f,int offset,void *buf,int len); +}; + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define FLASHOP_ERASE_SECTOR(softc,sect) (*((softc)->flashdrv_ops->erasesector))((softc),(sect)) +#define FLASHOP_WRITE_BLOCK(softc,off,buf,len) (*((softc)->flashdrv_ops->writeblk))((softc),(off),(buf),(len)) + +/* ********************************************************************* + * forward declarations + ********************************************************************* */ + + +static int flash_sector_query(flashdrv_t *softc,flash_sector_t *sector); + +static int amd_flash_write_block(flashdrv_t *softc,int offset,void *buf,int len); +static int amd_flash_erase_sector(flashdrv_t *softc,int offset); + +static int intel_flash_write_block(flashdrv_t *softc,int offset,void *buf,int len); +static int intel_flash_erase_sector(flashdrv_t *softc,int offset); + +static flashops_t amd_flashops = { + amd_flash_erase_sector, + amd_flash_write_block, +}; + +static flashops_t intel_flashops = { + intel_flash_erase_sector, + intel_flash_write_block, +}; + +#define FLASHOPS_DEFAULT amd_flashops + + + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern void *flash_write_all_ptr; +extern int flash_write_all_len; + +extern void _cfe_flushcache(int); + + +#if 0 +/* ********************************************************************* + * jedec_flash_maufacturer(softc) + * + * Return the manufacturer ID for this flash part. + * + * Input parameters: + * softc - flash context + * + * Return value: + * nothing + ********************************************************************* */ + +static unsigned int jedec_flash_manufacturer(flashdrv_t *softc) +{ + unsigned int res; + + /* Do an "unlock write" sequence */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1); + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2); + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_AUTOSEL); + + res = FLASHSTATUS(softc,FLASH_JEDEC_OFFSET_MFR) & 0xFF; + + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_RESET); + + return res; +} + +/* ********************************************************************* + * jedec_flash_type(softc) + * + * Return the manufacturer's type for the flash + * + * Input parameters: + * softc - flash context + * + * Return value: + * nothing + ********************************************************************* */ +static unsigned int jedec_flash_type(flashdrv_t *softc) +{ + unsigned int res; + + /* Do an "unlock write" sequence */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1); + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2); + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_AUTOSEL); + + res = FLASHSTATUS(softc,FLASH_JEDEC_OFFSET_DEV) & 0xFF; + + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_RESET); + + return res; +} + +#endif + +/* ********************************************************************* + * amd_flash_write_byte(softc,offset,val) + * + * Write a single byte to the flash. The sector that the flash + * byte is in should have been previously erased, or else this + * routine may hang. + * + * Input parameters: + * softc - flash context + * offset - distance in bytes into the flash + * val - byte to write + * + * Return value: + * 0 if ok + * else if flash could not be written + ********************************************************************* */ +static inline int amd_flash_write_byte(flashdrv_t *softc,int offset, unsigned char val) +{ + unsigned int value; + + /* Do an "unlock write" sequence */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1); + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2); + + /* Send a program command */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_PROGRAM); + + /* Write a byte */ + WRITEFLASH_K1(softc,offset,val); + + for (;;) { + value = READFLASH_K1(softc,offset) & 0xFF; + + if ((value & 0x80) == (val & 0x80)) { + return 0; + } + if ((value & 0x20) != 0x20) { + continue; + } + + if ((READFLASH_K1(softc,offset) & 0x80) == (val & 0x80)) { + return 0; + } + else { + return -1; + } + } +} + + +/* ********************************************************************* + * amd_flash_write_block(softc,offset,val) + * + * Write a single byte to the flash. The sector that the flash + * byte is in should have been previously erased, or else this + * routine may hang. + * + * Input parameters: + * softc - flash context + * offset - distance in bytes into the flash + * buf - buffer of bytes to write + * len - number of bytes to write + * + * Return value: + * number of bytes written + ********************************************************************* */ +static int amd_flash_write_block(flashdrv_t *softc,int offset,void *buf,int len) +{ + unsigned char *ptr; + + ptr = buf; + + while (len) { + if (amd_flash_write_byte(softc,offset,*ptr) < 0) break; + len--; + ptr++; + offset++; + + } + + return (ptr - (unsigned char *)buf); +} + + +/* ********************************************************************* + * amd_flash_erase_sector(softc,offset) + * + * Erase a single sector in the flash device + * + * Input parameters: + * softc - device context + * offset - offset in flash of sector to erase + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int amd_flash_erase_sector(flashdrv_t *softc,int offset) +{ + /* Do an "unlock write" sequence */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1); /* cycles 1-2 */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2); + + /* send the erase command */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_ERASE_3); /* cycle 3 */ + + /* Do an "unlock write" sequence */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_1,AMD_FLASH_MAGIC_1); /* cycles 4-5 */ + FLASHCMD(softc,AMD_FLASH_MAGIC_ADDR_2,AMD_FLASH_MAGIC_2); + + /* + * Send the "erase sector" qualifier - don't use FLASHCMD + * because it changes the offset. + */ + WRITEFLASH_K1(softc,offset,AMD_FLASH_ERASE_SEC_6); + + while ((READFLASH_K1(softc,offset) & 0x80) != 0x80) { + /* NULL LOOP */ + } + + return 0; +} + + + +/* ********************************************************************* + * intel_flash_write_byte(softc,offset,val) + * + * Write a single byte to the flash. The sector that the flash + * byte is in should have been previously erased, or else this + * routine may hang. + * + * Input parameters: + * softc - flash context + * offset - distance in bytes into the flash + * val - byte to write + * + * Return value: + * 0 if ok + * else if flash could not be written + ********************************************************************* */ +static inline int intel_flash_write_byte(flashdrv_t *softc, + int offset, unsigned char val) +{ + unsigned int value; + + /* Send a program command */ + WRITEFLASH_K1(softc,offset,INTEL_FLASH_PROGRAM); + + /* Write a byte */ + WRITEFLASH_K1(softc,offset,val); + + + while ((READFLASH_K1(softc,offset) & 0x80) != 0x80) { + /* NULL LOOP */ + } + + value = READFLASH_K1(softc,offset) & 0xFF; + + if (value & (0x01|0x08|0x10)) return -1; + return 0; +} + +/* ********************************************************************* + * intel_flash_write_word(softc,offset,val) + * + * Write a single word to the flash. The sector that the flash + * byte is in should have been previously erased, or else this + * routine may hang. + * + * Input parameters: + * softc - flash context + * offset - distance in bytes into the flash + * val - word to write + * + * Return value: + * 0 if ok + * else if flash could not be written + ********************************************************************* */ +static inline int intel_flash_write_word(flashdrv_t *softc, + int offset, unsigned short val) +{ + unsigned int value; + + + /* Send a program command */ + WRITEFLASH_K1W(softc,offset,INTEL_FLASH_PROGRAM); + + /* Write a byte */ + WRITEFLASH_K1W(softc,offset,val); + + + while ((READFLASH_K1W(softc,offset) & 0x80) != 0x80) { + /* NULL LOOP */ + } + + value = READFLASH_K1W(softc,offset) & 0xFF; + + if (value & (0x01|0x08|0x10)) return -1; + return 0; +} + +/* ********************************************************************* + * intel_flash_write_block(softc,offset,val) + * + * Write a single byte to the flash. The sector that the flash + * byte is in should have been previously erased, or else this + * routine may hang. + * + * Input parameters: + * softc - flash context + * offset - distance in bytes into the flash + * buf - buffer of bytes to write + * len - number of bytes to write + * + * Return value: + * number of bytes written + ********************************************************************* */ +static int intel_flash_write_block(flashdrv_t *softc,int offset,void *buf,int len) +{ + unsigned char *ptr; + unsigned short *ptrw; + + if (softc->flashdrv_probe.flash_flags & FLASH_FLG_16BIT) { + ptrw = buf; + offset &= ~1; /* offset must be even */ + while (len > 0) { + if (intel_flash_write_word(softc,offset,*ptrw) < 0) break; + len-=2; + ptrw++; + offset+=2; + } + WRITEFLASH_K1(softc,offset,INTEL_FLASH_READ_MODE); + return ((unsigned char *) ptrw - (unsigned char *)buf); + } + else { + ptr = buf; + while (len) { + if (intel_flash_write_byte(softc,offset,*ptr) < 0) break; + len--; + ptr++; + offset++; + } + WRITEFLASH_K1(softc,offset,INTEL_FLASH_READ_MODE); + return (ptr - (unsigned char *)buf); + } + +} + + +/* ********************************************************************* + * intel_flash_erase_sector(softc,offset) + * + * Erase a single sector on the flash device + * + * Input parameters: + * softc - device context + * offset - offset in flash of sector to erase + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ +static int intel_flash_erase_sector(flashdrv_t *softc,int offset) +{ + WRITEFLASH_K1(softc,offset,INTEL_FLASH_ERASE_BLOCK); + WRITEFLASH_K1(softc,offset,INTEL_FLASH_ERASE_CONFIRM); + + while ((READFLASH_K1(softc,offset) & 0x80) != 0x80) { + /* NULL LOOP */ + } + WRITEFLASH_K1(softc,offset,INTEL_FLASH_READ_MODE); + + return 0; +} + + + + + +/* ********************************************************************* + * FLASH_ERASE_RANGE(softc,range) + * + * Erase a range of sectors + * + * Input parameters: + * softc - our flash + * range - range structure + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +static int flash_erase_range(flashdrv_t *softc,flash_range_t *range) +{ + flash_sector_t sector; + int res; + + if (softc->flashdrv_info.flash_type != FLASH_TYPE_FLASH) { + return CFE_ERR_UNSUPPORTED; + } + + + if (range->range_base+range->range_length > softc->flashdrv_devsize) { + return CFE_ERR_INV_PARAM; + } + + res = 0; + + sector.flash_sector_idx = 0; + + for (;;) { + res = flash_sector_query(softc,§or); + if (res != 0) break; + if (sector.flash_sector_status == FLASH_SECTOR_INVALID) { + break; + } + + if ((sector.flash_sector_offset >= range->range_base) && + (sector.flash_sector_offset < + (range->range_base+range->range_length-1))) { + + if (softc->flashdrv_nvram_ok && + (sector.flash_sector_offset >= softc->flashdrv_nvraminfo.nvram_offset)) { + break; + } + res = FLASHOP_ERASE_SECTOR(softc,sector.flash_sector_offset); + if (res != 0) break; + } + sector.flash_sector_idx++; + } + + return res; + +} + +/* ********************************************************************* + * FLASH_ERASE_ALL(softc) + * + * Erase the entire flash device, except the NVRAM area, + * sector-by-sector. + * + * Input parameters: + * softc - our flash + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int flash_erase_all(flashdrv_t *softc) +{ + flash_range_t range; + + range.range_base = 0; + range.range_length = softc->flashdrv_devsize; + + return flash_erase_range(softc,&range); +} + +/* ********************************************************************* + * FLASH_CFI_GETSECTORS(softc) + * + * Query the CFI information and store the sector info in our + * private probe structure. + * + * Input parameters: + * softc - our flash info + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int flash_cfi_getsectors(flashdrv_t *softc) +{ + int idx; + int regcnt; + int nblks; + int blksiz; + + regcnt = GETCFIBYTE(softc,FLASH_CFI_REGION_COUNT); + + softc->flashdrv_probe.flash_nsectors = regcnt; + + for (idx = 0; idx < regcnt; idx++) { + nblks = ((int)GETCFIBYTE(softc,FLASH_CFI_REGION_TABLE+0+idx*4) + + (int)(GETCFIBYTE(softc,FLASH_CFI_REGION_TABLE+1+idx*4)<<8)) + 1; + blksiz = ((int)GETCFIBYTE(softc,FLASH_CFI_REGION_TABLE+2+idx*4) + + (int)(GETCFIBYTE(softc,FLASH_CFI_REGION_TABLE+3+idx*4)<<8)) * 256; + softc->flashdrv_probe.flash_sectors[idx] = + FLASH_SECTOR_RANGE(nblks,blksiz); + } + + + return 0; +} + +/* ********************************************************************* + * FLASH_SECTOR_QUERY(softc,sector) + * + * Query the sector information about a particular sector. You can + * call this iteratively to find out about all of the sectors. + * + * Input parameters: + * softc - our flash info + * sector - structure to receive sector information + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int flash_sector_query(flashdrv_t *softc,flash_sector_t *sector) +{ + int idx; + int nblks; + int blksiz; + unsigned int offset; + int curblk; + + if (softc->flashdrv_info.flash_type != FLASH_TYPE_FLASH) { + return CFE_ERR_UNSUPPORTED; + } + + if (softc->flashdrv_probe.flash_nsectors == 0) { + return CFE_ERR_UNSUPPORTED; + } + + offset = 0; + curblk = 0; + for (idx = 0; idx < softc->flashdrv_probe.flash_nsectors; idx++) { + nblks = FLASH_SECTOR_NBLKS(softc->flashdrv_probe.flash_sectors[idx]); + blksiz = FLASH_SECTOR_SIZE(softc->flashdrv_probe.flash_sectors[idx]); + if (sector->flash_sector_idx < curblk+nblks) { + sector->flash_sector_status = FLASH_SECTOR_OK; + sector->flash_sector_offset = + offset + (sector->flash_sector_idx-curblk)*blksiz; + sector->flash_sector_size = blksiz; + break; + } + + offset += (nblks)*blksiz; + curblk += nblks; + } + + + if (idx == softc->flashdrv_probe.flash_nsectors) { + sector->flash_sector_status = FLASH_SECTOR_INVALID; + } + + return 0; +} + + +/* ********************************************************************* + * FLASH_SET_CMDSET(softc,cmdset) + * + * Set the command-set that we'll honor for this flash. + * + * Input parameters: + * softc - our flash + * cmdset - FLASH_CFI_CMDSET_xxx + * + * Return value: + * nothing + ********************************************************************* */ + +static void flash_set_cmdset(flashdrv_t *softc,int cmdset) +{ + switch (cmdset) { + case FLASH_CFI_CMDSET_INTEL_ECS: + case FLASH_CFI_CMDSET_INTEL_STD: + softc->flashdrv_ops = &intel_flashops; + /* XXX: Intel flashes don't have the "a-1" line. Yay. */ + softc->flashdrv_widemode = 0; + break; + case FLASH_CFI_CMDSET_AMD_STD: + case FLASH_CFI_CMDSET_AMD_ECS: + softc->flashdrv_ops = &amd_flashops; + break; + default: + /* we don't understand the command set - treat it like ROM */ + softc->flashdrv_info.flash_type = FLASH_TYPE_ROM; + } +} + + +/* ********************************************************************* + * FLASH_CFI_PROBE(softc) + * + * Try to do a CFI query on this device. If we find the m + * magic signature, extract some useful information from the + * query structure. + * + * Input parameters: + * softc - out flash + * + * Return value: + * 0 if successful, <0 if error + ********************************************************************* */ +static int flash_cfi_probe(flashdrv_t *softc) +{ + FLASHCMD(softc,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_MODE); + + if (!((GETCFIBYTE(softc,FLASH_CFI_SIGNATURE+0) == 'Q') && + (GETCFIBYTE(softc,FLASH_CFI_SIGNATURE+1) == 'R') && + (GETCFIBYTE(softc,FLASH_CFI_SIGNATURE+2) == 'Y'))) { + + FLASHCMD(softc,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_EXIT); + return CFE_ERR_UNSUPPORTED; + } + + /* + * Gather info from flash + */ + + softc->flashdrv_cfidata.cfidata_cmdset = + ((unsigned int) (GETCFIBYTE(softc,FLASH_CFI_COMMAND_SET))) + + (((unsigned int) (GETCFIBYTE(softc,FLASH_CFI_COMMAND_SET+1))) << 8); + + softc->flashdrv_cfidata.cfidata_devif = + ((unsigned int) (GETCFIBYTE(softc,FLASH_CFI_DEVICE_INTERFACE))) + + (((unsigned int) (GETCFIBYTE(softc,FLASH_CFI_DEVICE_INTERFACE+1))) << 8); + + softc->flashdrv_cfidata.cfidata_size = + 1 << ((unsigned int) (GETCFIBYTE(softc,FLASH_CFI_DEVICE_SIZE))); + + flash_cfi_getsectors(softc); + + /* + * Don't need to be in query mode anymore. + */ + + FLASHCMD(softc,FLASH_CFI_QUERY_ADDR,FLASH_CFI_QUERY_EXIT); + + softc->flashdrv_info.flash_type = FLASH_TYPE_FLASH; + + flash_set_cmdset(softc,softc->flashdrv_cfidata.cfidata_cmdset); + + return 0; + +} + +/* ********************************************************************* + * FLASH_GETWIDTH(softc,info) + * + * Try to determine the width of the flash. This is needed for + * management purposes, since some 16-bit flash parts in 8-bit mode + * have an "A-1" (address line -1) wire to select bytes within + * a 16-bit word. When this is present, the flash commands + * will have different offsets. + * + * Input parameters: + * softc - our flash + * info - flash info structure + * + * Return value: + * nothing + ********************************************************************* */ + +static void flash_getwidth(flashdrv_t *softc,flash_info_t *info) +{ + softc->flashdrv_widemode = 0; /* first try narrow */ + + if (flash_cfi_probe(softc) == 0) { + return; + } + + softc->flashdrv_widemode = 1; /* then wide */ + + if (flash_cfi_probe(softc) == 0) { + return; + } + + /* Just return, assume not wide if no CFI interface */ + softc->flashdrv_widemode = 0; + + softc->flashdrv_info.flash_type = FLASH_TYPE_ROM; /* no CFI: treat as ROM */ +} + +/* ********************************************************************* + * flash_getinfo(softc) + * + * Try to determine if the specified region is flash, ROM, SRAM, + * or something else. + * + * Input parameters: + * softc - our context + * + * Return value: + * nothing + ********************************************************************* */ + +static void flash_getinfo(flashdrv_t *softc) +{ + uint8_t save0,save1; + volatile uint8_t *ptr; + flash_info_t *info = &(softc->flashdrv_info); + + /* + * Set up some defaults based on the probe data + */ + + softc->flashdrv_widemode = 0; + info->flash_base = softc->flashdrv_probe.flash_phys; + info->flash_size = softc->flashdrv_probe.flash_size; + softc->flashdrv_devsize = softc->flashdrv_probe.flash_size; + info->flash_type = FLASH_TYPE_UNKNOWN; + info->flash_flags = 0; + + /* + * If we've been told not to try probing, just assume + * we're a flash part. + */ + + if (softc->flashdrv_probe.flash_flags & FLASH_FLG_MANUAL) { + info->flash_type = FLASH_TYPE_FLASH; + if (softc->flashdrv_probe.flash_flags & FLASH_FLG_WIDE) { + softc->flashdrv_widemode = TRUE; + } + if (softc->flashdrv_probe.flash_cmdset) { + flash_set_cmdset(softc,softc->flashdrv_probe.flash_cmdset); + } + return; + } + + /* + * Attempt to read/write byte zero. If it is changable, + * this is SRAM (or maybe a ROM emulator with the write line hooked up) + */ + + ptr = (volatile uint8_t *) UNCADDR(softc->flashdrv_probe.flash_phys); + save0 = *ptr; /* save old value */ + save1 = *(ptr+1); /* save old value */ + *(ptr) = 0x55; + if ((*ptr) == 0x55) { + *(ptr) = 0xAA; + if ((*ptr) == 0xAA) { + info->flash_type = FLASH_TYPE_SRAM; + } + } + + if (*ptr == save0) info->flash_type = FLASH_TYPE_ROM; + else (*ptr) = save0; /* restore old value */ + + /* + * If we thought it was ROM, try doing a CFI query + * to see if it was flash. This check is kind of kludgey + * but should work. + */ + + if (info->flash_type == FLASH_TYPE_ROM) { + flash_getwidth(softc,info); + if (info->flash_type == FLASH_TYPE_FLASH) { + } + } +} + +/* ********************************************************************* + * flashdrv_setup_nvram(softc) + * + * If we're going to be using a sector of the flash for NVRAM, + * go find that sector and set it up. + * + * Input parameters: + * softc - our flash + * + * Return value: + * nothing. flashdrv_nvram_ok might change though. + ********************************************************************* */ + +static void flashdrv_setup_nvram(flashdrv_t *softc) +{ + flash_sector_t sector; + int res; + + softc->flashdrv_nvram_ok = FALSE; + + if (softc->flashdrv_info.flash_type != FLASH_TYPE_FLASH) { + return; + } + + sector.flash_sector_idx = 0; + for (;;) { + res = flash_sector_query(softc,§or); + if (res == CFE_ERR_UNSUPPORTED) break; + if (res == 0) { + if (sector.flash_sector_status != FLASH_SECTOR_INVALID) { + sector.flash_sector_idx++; + continue; + } + } + break; + } + + /* The sector offset will still contain the value at the end + of the last successful call. That's the last sector, so + we can now use this to fill in the NVRAM info structure */ + + if (res != CFE_ERR_UNSUPPORTED) { + softc->flashdrv_nvraminfo.nvram_offset = sector.flash_sector_offset; + softc->flashdrv_nvraminfo.nvram_size = sector.flash_sector_size; + softc->flashdrv_nvraminfo.nvram_eraseflg = TRUE; /* needs erase */ + softc->flashdrv_nvram_ok = TRUE; + /* + * Set the flash's size as reported in the flash_info structure + * to be the size without the NVRAM sector at the end. + */ + softc->flashdrv_info.flash_size = sector.flash_sector_offset; + softc->flashdrv_devsize = sector.flash_sector_offset; + } + +} + + +/* ********************************************************************* + * flashdrv_probe(drv,probe_a,probe_b,probe_ptr) + * + * Device probe routine. Attach the flash device to + * CFE's device table. + * + * Input parameters: + * drv - driver descriptor + * probe_a - physical address of flash + * probe_b - size of flash (bytes) + * probe_ptr - unused + * + * Return value: + * nothing + ********************************************************************* */ + +static void flashdrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + flashdrv_t *softc; + flash_probe_t *probe; + char descr[80]; + + probe = (flash_probe_t *) probe_ptr; + + /* + * probe_a is the flash base address + * probe_b is the size of the flash + * probe_ptr is unused. + */ + + softc = (flashdrv_t *) KMALLOC(sizeof(flashdrv_t),0); + if (softc) { + memset(softc,0,sizeof(flashdrv_t)); + + if (probe) { + /* Passed probe structure, do fancy stuff */ + memcpy(&(softc->flashdrv_probe),probe,sizeof(flash_probe_t)); + if (softc->flashdrv_probe.flash_prog_phys == 0) { + softc->flashdrv_probe.flash_prog_phys = + softc->flashdrv_probe.flash_phys; + } + } + else { + /* Didn't pass probe structure, do the compatible thing */ + softc->flashdrv_probe.flash_phys = probe_a; + softc->flashdrv_probe.flash_prog_phys = probe_a; + softc->flashdrv_probe.flash_size = probe_b; + softc->flashdrv_probe.flash_flags = FLASH_FLG_NVRAM; + } + + softc->flashdrv_cmdaddr = (char *) UNCADDR(softc->flashdrv_probe.flash_prog_phys); + softc->flashdrv_initialized = 0; + softc->flashdrv_ops = &FLASHOPS_DEFAULT; + xsprintf(descr,"%s at %08X size %uKB",drv->drv_description, + softc->flashdrv_probe.flash_phys, + softc->flashdrv_probe.flash_size/1024); + cfe_attach(drv,softc,NULL,descr); + } + +} + + +/* ********************************************************************* + * flashdrv_open(ctx) + * + * Called when the flash device is opened. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 if ok else error code + ********************************************************************* */ + +static int flashdrv_open(cfe_devctx_t *ctx) +{ + flashdrv_t *softc = ctx->dev_softc; + + /* + * do initialization + */ + + if (!softc->flashdrv_initialized) { + + /* + * Assume it's not an NVRAM-capable flash + */ + + softc->flashdrv_nvram_ok = FALSE; + + /* + * Probe flash for geometry + */ + flash_getinfo(softc); + + /* + * Find the last sector if in NVRAM mode + */ + + if (softc->flashdrv_probe.flash_flags & FLASH_FLG_NVRAM) { + flashdrv_setup_nvram(softc); + } + + softc->flashdrv_initialized = TRUE; + } + + return 0; +} + + +/* ********************************************************************* + * flashdrv_read(ctx,buffer) + * + * Read data from the flash device. The flash device is + * considered to be like a disk (you need to specify the offset). + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int flashdrv_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + flashdrv_t *softc = ctx->dev_softc; + unsigned char *bptr; + unsigned char *flashbase; + int offset; + int blen; + + /* + * For now, read the flash from K1 (always). Eventually + * we need to flush the cache after a write. + */ + + flashbase = (unsigned char *) UNCADDR(softc->flashdrv_probe.flash_phys); + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + offset = (int) buffer->buf_offset; + + if (!(softc->flashdrv_unlocked)) { + if ((offset + blen) > softc->flashdrv_devsize) { + blen = softc->flashdrv_devsize - offset; + } + } + +#ifdef _FLASH_BROKEN_BYTEREAD_ + /* + * BCM1250 users: don't worry about this. This hack is for + * something else and should not be used with the BCM1250. + */ + if (softc->flashdrv_probe.flash_flags & FLASH_FLG_16BIT) { + uint16_t *src; + int len = blen; + int idx = 0; + union { + uint16_t x; + char b[2]; + } u; + + src = (uint16_t *) flashbase; + while (len > 0) { + u.x = src[(idx+offset)>>1]; + *bptr++ = u.b[(idx+offset)&1]; + len--; + idx++; + } + } + else { + memcpy(bptr,flashbase + offset, blen); + } +#else + memcpy(bptr,flashbase + offset, blen); +#endif + + buffer->buf_retlen = blen; + + return 0; +} + +/* ********************************************************************* + * flashdrv_inpstat(ctx,inpstat) + * + * Return "input status". For flash devices, we always return true. + * + * Input parameters: + * ctx - device context + * inpstat - input status structure + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int flashdrv_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + /* flashdrv_t *softc = ctx->dev_softc; */ + + inpstat->inp_status = 1; + return 0; +} + + +/* ********************************************************************* + * flash_writeall(softc,buffer) + * + * Write the entire flash and reboot. This is a special case + * used for when the flash currently being used for CFE's + * execution is updated. A small assembly routine is relocated + * to DRAM to do the update (so that the programming routine is + * not erased while we're running it), and then the update + * is done. When completed, CFE is restarted. + * + * (we could get really sleazy here and touch the routine first + * so it will stay in the cache, thereby eliminating the need + * to relocate it, but that's dangerous) + * + * Input parameters: + * softc - our context + * buffer - buffer descriptor + * + * Return value: + * does not return + ********************************************************************* */ + +static int flash_writeall(flashdrv_t *softc,iocb_buffer_t *buffer) +{ + void *rptr; + void (*routine)(unsigned char *data,unsigned int flashbase, + unsigned int size,unsigned int secsize); + + rptr = KMALLOC(flash_write_all_len,0); + + if (!rptr) return CFE_ERR_NOMEM; + + memcpy(rptr,flash_write_all_ptr,flash_write_all_len); + + _cfe_flushcache(0); + + routine = rptr; + + (*routine)(buffer->buf_ptr, + softc->flashdrv_probe.flash_phys, + buffer->buf_length, + 65536); + + return -1; +} + + +/* ********************************************************************* + * flashdrv_write(ctx,buffer) + * + * Write data to the flash device. The flash device is + * considered to be like a disk (you need to specify the offset). + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int flashdrv_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + flashdrv_t *softc = ctx->dev_softc; + unsigned char *bptr; + int offset; + int blen; + int res; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + offset = (int) buffer->buf_offset; + + if (!(softc->flashdrv_unlocked)) { + if ((offset + blen) > softc->flashdrv_devsize) { + blen = softc->flashdrv_devsize - offset; + } + } + + res = FLASHOP_WRITE_BLOCK(softc,offset,bptr,blen); + + buffer->buf_retlen = res; + + /* XXX flush the cache here? */ + + return (res == blen) ? 0 : CFE_ERR_IOERR; +} + +/* ********************************************************************* + * flashdrv_ioctl(ctx,buffer) + * + * Handle special IOCTL functions for the flash. Flash devices + * support NVRAM information, sector and chip erase, and a + * special IOCTL for updating the running copy of CFE. + * + * Input parameters: + * ctx - device context + * buffer - descriptor for IOCTL parameters + * + * Return value: + * 0 if ok else error + ********************************************************************* */ +static int flashdrv_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + flashdrv_t *softc = ctx->dev_softc; + nvram_info_t *info; + int offset; + + /* + * If using flash to store environment, only the last sector + * is used for environment stuff. + */ + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_NVRAM_ERASE: + if (softc->flashdrv_nvram_ok == FALSE) return CFE_ERR_UNSUPPORTED; + FLASHOP_ERASE_SECTOR(softc,softc->flashdrv_nvraminfo.nvram_offset); + return 0; + + case IOCTL_NVRAM_GETINFO: + info = (nvram_info_t *) buffer->buf_ptr; + if (buffer->buf_length != sizeof(nvram_info_t)) return CFE_ERR_INV_PARAM; + if (softc->flashdrv_nvram_ok == FALSE) return CFE_ERR_UNSUPPORTED; + info->nvram_offset = softc->flashdrv_nvraminfo.nvram_offset; + info->nvram_size = softc->flashdrv_nvraminfo.nvram_size; + info->nvram_eraseflg = softc->flashdrv_nvraminfo.nvram_eraseflg; + buffer->buf_retlen = sizeof(nvram_info_t); + return 0; + + case IOCTL_FLASH_ERASE_SECTOR: + offset = (int) buffer->buf_offset; + if (!(softc->flashdrv_unlocked)) { + if (offset >= softc->flashdrv_devsize) return -1; + } + FLASHOP_ERASE_SECTOR(softc,offset); + return 0; + + case IOCTL_FLASH_ERASE_ALL: + offset = (int) buffer->buf_offset; + if (offset != 0) return -1; + flash_erase_all(softc); + return 0; + + case IOCTL_FLASH_WRITE_ALL: + flash_writeall(softc,buffer); + return -1; /* should not return */ + + case IOCTL_FLASH_GETINFO: + memcpy(buffer->buf_ptr,&(softc->flashdrv_info),sizeof(flash_info_t)); + return 0; + + case IOCTL_FLASH_GETSECTORS: + return flash_sector_query(softc,(flash_sector_t *) buffer->buf_ptr); + + + case IOCTL_FLASH_ERASE_RANGE: + return flash_erase_range(softc,(flash_range_t *) buffer->buf_ptr); + + case IOCTL_NVRAM_UNLOCK: + softc->flashdrv_unlocked = TRUE; + break; + + default: + return -1; + } + + return -1; +} + + +/* ********************************************************************* + * flashdrv_close(ctx) + * + * Close the flash device. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 + ********************************************************************* */ +static int flashdrv_close(cfe_devctx_t *ctx) +{ + /* flashdrv_t *softc = ctx->dev_softc; */ + + /* XXX Invalidate the cache */ + + return 0; +} + + diff --git a/cfe/cfe/dev/dev_ht7520.c b/cfe/cfe/dev/dev_ht7520.c new file mode 100644 index 0000000..8e64971 --- /dev/null +++ b/cfe/cfe/dev/dev_ht7520.c @@ -0,0 +1,167 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * HT7520 (Golem) Bridge Support File: dev_ht7520.c + * + ********************************************************************* + * + * Copyright 2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_physio.h" + +#include "pcireg.h" +#include "pcivar.h" + +extern int eoi_implemented; + +void ht7520apic_preset (pcitag_t tag); +void ht7520apic_setup (pcitag_t tag); + + +/* PLX HT7520 (LDT to PCI-X bridge + APIC) specific definitions */ + +#define PCI_VENDOR_AMD 0x1022 +#define PCI_PRODUCT_PLX_HT7520 0x7450 +#define PCI_PRODUCT_PLX_HT7520_APIC 0x7451 + +/* HT7520 specific registers */ + +/* APIC configuration registers */ + +#define APIC_CONTROL_REG 0x0044 + +#define APIC_CONTROL_OSVISBAR (1 << 0) +#define APIC_CONTROL_IOAEN (1 << 1) + +#define APIC_BASE_ADDR_REG 0x0048 + +/* APIC registers in BAR0 memory space */ + +#define HT7520_APIC_INDEX_REG 0x0000 +#define HT7520_APIC_DATA_REG 0x0010 + +#define APIC_ID_INDEX 0x00 +#define APIC_VERSION_INDEX 0x01 +#define APIC_ARBID_INDEX 0x02 +#define APIC_RDR_BASE_INDEX 0x10 +#define APIC_RDR_LO_INDEX(n) (APIC_RDR_BASE_INDEX + 2*(n)) +#define APIC_RDR_HI_INDEX(n) (APIC_RDR_BASE_INDEX + 2*(n) + 1) + +#define RDR_HI_DEST_SHIFT (56-32) +#define RDR_HI_DEST_MASK (0xff << RDR_HI_DEST_SHIFT) +#define RDR_LO_IM (1 << 16) +#define RDR_LO_TM (1 << 15) +#define RDR_LO_IRR (1 << 14) +#define RDR_LO_POL (1 << 13) +#define RDR_LO_DS (1 << 12) +#define RDR_LO_DM (1 << 11) +#define RDR_LO_MT_SHIFT 8 +#define RDR_LO_MT_MASK (3 << RDR_LO_MT_SHIFT) +#define RDR_LO_IV_SHIFT 0 +#define RDR_LO_IV_MASK (0xff << RDR_LO_IV_SHIFT) + +void +ht7520apic_preset (pcitag_t tag) +{ + pcireg_t ctrl; + + /* For some reason, BAR0 (necessary for setting the interrupt + mapping) is hidden by default; the following makes it + visible. */ + ctrl = pci_conf_read(tag, APIC_CONTROL_REG); + ctrl |= APIC_CONTROL_IOAEN | APIC_CONTROL_OSVISBAR; + pci_conf_write(tag, APIC_CONTROL_REG, ctrl); + ctrl = pci_conf_read(tag, APIC_CONTROL_REG); /* push */ +} + +void +ht7520apic_setup (pcitag_t tag) +{ + int bus, device, function; + pcitag_t br_tag; + int secondary; + struct pci_bus *pb; + unsigned offset; + phys_addr_t apic_addr; + uint32_t rdrh, rdrl; + int i; + + /* The HT7520 splits the bridge and APIC functionality between two + functions. The following code depends upon a known + relationship between the bridge and APIC tags, with a temporary + fudge for the simulator. NB: We assume that the bridge + function has already been initialized. */ + + pci_break_tag(tag, &bus, &device, &function); + +#ifdef _FUNCSIM_ + br_tag = pci_make_tag(bus, device-2, 0); +#else + br_tag = pci_make_tag(bus, device, function-1); +#endif + secondary = (pci_conf_read(br_tag, PPB_BUSINFO_REG) >> 8) & 0xff; + pb = &_pci_bus[secondary]; + + /* Set up interrupt mappings. */ + pci_map_mem(tag, PCI_MAPREG(0), PCI_MATCH_BITS, &apic_addr); + + offset = pb->inta_shift % 4; + for (i = 0; i < 4; i++) { + phys_write32(apic_addr + HT7520_APIC_INDEX_REG, APIC_RDR_HI_INDEX(i)); + rdrh = 0x03 << RDR_HI_DEST_SHIFT; /* CPU 0 + CPU 1 */ + phys_write32(apic_addr + HT7520_APIC_DATA_REG, rdrh); + rdrh = phys_read32(apic_addr + HT7520_APIC_DATA_REG); /* push */ + + phys_write32(apic_addr + HT7520_APIC_INDEX_REG, APIC_RDR_LO_INDEX(i)); + if (eoi_implemented) { + /* Passes >=2 have working EOI. Trigger=Level */ + rdrl = (RDR_LO_TM | /* Level */ + RDR_LO_POL | /* Active Low */ + RDR_LO_DM | /* Logical */ + 0x0 << RDR_LO_MT_SHIFT | /* Fixed */ + (56+offset) << RDR_LO_IV_SHIFT); /* Vector */ + } else { + /* Pass 1 lacks working EOI. Trigger=Edge. Note that + LO_POL appears mis-documented for edges. */ + rdrl = (RDR_LO_DM | /* Logical */ + 0x0 << RDR_LO_MT_SHIFT | /* Fixed */ + (56+offset) << RDR_LO_IV_SHIFT); /* Vector */ + } + phys_write32(apic_addr + HT7520_APIC_DATA_REG, rdrl); + offset = (offset + 1) % 4; + } +} diff --git a/cfe/cfe/dev/dev_ide_common.c b/cfe/cfe/dev/dev_ide_common.c new file mode 100644 index 0000000..e15ac8a --- /dev/null +++ b/cfe/cfe/dev/dev_ide_common.c @@ -0,0 +1,1249 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Generic IDE disk driver File: dev_ide_common.c + * + * This is a simple driver for IDE hard disks. The mechanics + * of talking to the I/O ports are abstracted sufficiently to make + * this driver usable for various bus interfaces. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_timer.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_error.h" + +#include "dev_ide_common.h" + +#include "dev_ide.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define DISK_MASTER 0 +#define DISK_SLAVE 1 + +#define IDE_WRITEREG8(ide,reg,val) IDEDISP_WRITEREG8(ide->idecommon_dispatch,reg,val) +#define IDE_WRITEREG16(ide,reg,val) IDEDISP_WRITEREG8(ide->idecommon_dispatch,reg,val) +#define IDE_WRITEBUF(ide,reg,buf,len) IDEDISP_WRITEBUF(ide->idecommon_dispatch,reg,buf,len) +#define IDE_READREG8(ide,reg) IDEDISP_READREG8(ide->idecommon_dispatch,reg) +#define IDE_READREG16(ide,reg) IDEDISP_READREG16(ide->idecommon_dispatch,reg) +#define IDE_READBUF(ide,reg,buf,len) IDEDISP_READBUF(ide->idecommon_dispatch,reg,buf,len) + +#define GETWORD_LE(buf,wordidx) (((unsigned int) (buf)[(wordidx)*2]) + \ + (((unsigned int) (buf)[(wordidx)*2+1]) << 8)) + +#define _IDE_DEBUG_ + + +static void idecommon_testdrq(idecommon_t *ide); + +/* ********************************************************************* + * idecommon_sectorshift(size) + * + * Given a sector size, return log2(size). We cheat; this is + * only needed for 2048 and 512-byte sectors. + * Explicitly using shifts and masks in sector number calculations + * helps on 32-bit-only platforms, since we probably won't need + * a helper library. + * + * Input parameters: + * size - sector size + * + * Return value: + * # of bits to shift + ********************************************************************* */ + +#define idecommon_sectorshift(size) (((size)==2048)?11:9) + +/* ********************************************************************* + * idecommon_waitnotbusy(ide) + * + * Wait for an IDE device to report "not busy" + * + * Input parameters: + * ide - IDE interface + * + * Return value: + * 0 if ok, else -1 if timeout + ********************************************************************* */ + +static int idecommon_waitnotbusy(idecommon_t *ide) +{ + int32_t timer; + uint8_t status; + + TIMER_SET(timer,10*CFE_HZ); + + while (!TIMER_EXPIRED(timer)) { + status = IDE_READREG8(ide,IDE_REG_STATUS); + if (!(status & IDE_STS_BSY) && (status & IDE_STS_DRQ)) { + idecommon_testdrq(ide); + continue; + } + if ((status & (IDE_STS_BSY | IDE_STS_DRQ )) == 0) return 0; + POLL(); + } + +#ifdef _IDE_DEBUG_ + xprintf("Device did not become unbusy\n"); +#endif + return -1; +} + +#if 0 +/* ********************************************************************* + * idecommon_waitready(ide) + * + * Wait for the specified device to become ready. + * + * Input parameters: + * ide - IDE interface + * + * Return value: + * 0 if device became ready + * -1 if device did not become ready + ********************************************************************* */ + +static int idecommon_waitready(idecommon_t *ide) +{ + int32_t timer; + uint8_t status; + + TIMER_SET(timer,10*CFE_HZ); + + while (!TIMER_EXPIRED(timer)) { + status = IDE_READREG8(ide,IDE_REG_STATUS); + if (status & IDE_STS_RDY) return 0; + POLL(); + } + +#ifdef _IDE_DEBUG_ + xprintf("Disk did not become ready\n"); +#endif + + return -1; +} +#endif + +/* ********************************************************************* + * idecommon_waitbusy(idx) + * + * Wait for an IDE disk to start processing a command, or at + * least long enough to indicate that it is doing so. + * The code below looks suspiciously like a timing loop. + * unfortunately, that's what it is, determined empirically + * for certain ATA flash cards. Without this many reads to the + * ALTSTAT register, the PCMCIA controller deasserts the + * card detect pins briefly. Anyone have any clues? + * + * Input parameters: + * ide - IDE interface + * + * Return value: + * void + ********************************************************************* */ + +static void idecommon_waitbusy(idecommon_t *ide) +{ + int idx; + + for (idx = 0; idx < 10; idx++) { + IDE_READREG8(ide,IDE_REG_ALTSTAT); + IDE_READREG8(ide,IDE_REG_ALTSTAT); + IDE_READREG8(ide,IDE_REG_ALTSTAT); + IDE_READREG8(ide,IDE_REG_ALTSTAT); + } +} + + +/* ********************************************************************* + * idecommon_wait_drq(ide) + * + * Wait for the BUSY bit to be clear and the DRQ bit to be set. + * This is usually the indication that it's time to transfer data. + * + * Input parameters: + * ide - IDE interface + * 0 if DRQ is set + * -1 if timeout occured + ********************************************************************* */ + +static int idecommon_wait_drq(idecommon_t *ide) +{ + int32_t timer; + uint8_t status; + + TIMER_SET(timer,10*CFE_HZ); + + while (!TIMER_EXPIRED(timer)) { + POLL(); + status = IDE_READREG8(ide,IDE_REG_STATUS); + if (!(status & IDE_STS_BSY) && (status & IDE_STS_ERR)) { + xprintf("Drive status: %02X error %02X\n",status, + IDE_READREG8(ide,IDE_REG_ERROR)); + return -1; + } + if (!(status & IDE_STS_BSY) && (status & IDE_STS_DRQ)) return 0; + } + +#ifdef _IDE_DEBUG_ + xprintf("Timeout waiting for disk\n"); +#endif + + return -1; +} + +/* ********************************************************************* + * idecommon_testdrq(ide) + * + * Debug routine. Check the DRQ bit. If it's set, it is not + * supposed to be, so transfer data until it clears and report + * how much we had to transfer. + * + * Input parameters: + * ide - IDE interface + * + * Return value: + * nothing + ********************************************************************* */ + +#ifdef _IDE_DEBUG_ +static void idecommon_testdrq(idecommon_t *ide) +{ + uint8_t status; + uint16_t data; + int idx; + + status = IDE_READREG8(ide,IDE_REG_STATUS); + if (status & IDE_STS_DRQ) { + xprintf("Error: DRQ should be zero\n"); + idx = 0; + while (status & IDE_STS_DRQ) { + data = IDE_READREG16(ide,IDE_REG_DATA); + idx++; + status = IDE_READREG8(ide,IDE_REG_STATUS); + } + xprintf("Had to read data %d times to clear DRQ\n",idx); + } +} +#else +#define idecommon_testdrq(ide) +#endif + + +/* ********************************************************************* + * idecommon_dumpregs(ide) + * + * Dump out the IDE registers. (debug routine) + * + * Input parameters: + * ide - ide disk + * + * Return value: + * nothing + ********************************************************************* */ + +static void idecommon_dumpregs(idecommon_t *ide) +{ +#if 0 + uint8_t reg = 0; + + reg = IDE_READREG8(ide,IDE_REG_STATUS); + xprintf("Status:%02X ",reg); + + reg = IDE_READREG8(ide,IDE_REG_DRVHD); + xprintf("DrvHd:%02X ",reg); + + reg = IDE_READREG8(ide,IDE_REG_CYLLSB); + xprintf("CylLSB:%02X ",reg); + + reg = IDE_READREG8(ide,IDE_REG_CYLMSB); + xprintf("CylMSB:%02X ",reg); + + reg = IDE_READREG8(ide,IDE_REG_SECNUM); + xprintf("SecNum:%02X ",reg); + + reg = IDE_READREG8(ide,IDE_REG_SECCNT); + xprintf("SecCnt:%02X ",reg); + + xprintf("\n"); +#endif +} + + +/* ********************************************************************* + * idecommon_reset(ide) + * + * Reset the IDE interface. + * + * Input parameters: + * ide - IDE interface + * + * Return value: + * 0 if ok, else -1 if a timeout occured + ********************************************************************* */ + +static int idecommon_reset(idecommon_t *ide) +{ + return 0; +} + +/* ********************************************************************* + * idecommon_identify(ide,buffer) + * + * Execute an IDENTIFY command to get information about the disk. + * + * Input parameters: + * ide - IDE interface + * buffer - pointer to 512 byte buffer + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int idecommon_identify(idecommon_t *ide,unsigned char *buffer) +{ + + /* Device Select Protocol; see ATAPI-4 sect 9.6 */ + + if (idecommon_waitnotbusy(ide) < 0) return -1; + IDE_WRITEREG8(ide,IDE_REG_DRVHD,(ide->idecommon_unit<<4)|0); + if (idecommon_waitnotbusy(ide) < 0) return -1; + + /* Set device registers */ + + IDE_WRITEREG8(ide,IDE_REG_CYLLSB,0); + IDE_WRITEREG8(ide,IDE_REG_CYLMSB,0); + IDE_WRITEREG8(ide,IDE_REG_SECNUM,1); + IDE_WRITEREG8(ide,IDE_REG_SECCNT,1); + + idecommon_testdrq(ide); + + /* Issue command, then read ALT STATUS (9.7) */ + + if (ide->idecommon_atapi) { + IDE_WRITEREG8(ide,IDE_REG_COMMAND,IDE_CMD_ATAPI_IDENTIFY); + } + else { + IDE_WRITEREG8(ide,IDE_REG_COMMAND,IDE_CMD_DRIVE_INFO); + } + + IDE_READREG8(ide,IDE_REG_ALTSTAT); + idecommon_waitbusy(ide); /* should not be necessary */ + + /* Wait BSY=0 && DRQ=1, then read buffer, see sect 9.7 */ + + if (idecommon_wait_drq(ide) < 0) return -1; + IDE_READBUF(ide,IDE_REG_DATA,buffer,DISK_SECTORSIZE); + + idecommon_testdrq(ide); + + return 0; +} + +/* ********************************************************************* + * idecommon_packet(ide,packet,pktlen,databuf,datalen) + * + * Process an IDE "packet" command, for ATAPI devices + * + * Input parameters: + * ide - IDE interface + * packet,pktlen - command packet + * databuf,datalen - data buffer + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int idecommon_packet(idecommon_t *ide, + uint8_t *packet,int pktlen, + uint8_t *databuf,int datalen) +{ + uint8_t status; + + /* + * Not valid on non-ATAPI disks + */ + + if (!ide->idecommon_atapi) return -1; + + /* + * Set up the standard IDE registers for an ATAPI PACKET command + */ + + /* Device Select Protocol */ + if (idecommon_waitnotbusy(ide) < 0) return -1; + IDE_WRITEREG8(ide,IDE_REG_DRVHD,(ide->idecommon_unit<<4)); + if (idecommon_waitnotbusy(ide) < 0) return -1; + + /* Device Registers */ + IDE_WRITEREG8(ide,IDE_REG_BCLSB,(datalen & 0xFF)); + IDE_WRITEREG8(ide,IDE_REG_BCMSB,((datalen >> 8) & 0xFF)); + IDE_WRITEREG8(ide,IDE_REG_SECNUM,0); + IDE_WRITEREG8(ide,IDE_REG_SECCNT,0); + IDE_WRITEREG8(ide,IDE_REG_COMMAND,IDE_CMD_ATAPI_PACKET); + + /* + * Wait for the DRQ bit to indicate that we should send + * the packet. + */ + + if (idecommon_wait_drq(ide) < 0) return -1; + + status = IDE_READREG8(ide,IDE_REG_IR); + + /* + * Send the packet to the device + */ + + IDE_WRITEBUF(ide,IDE_REG_DATA,packet,pktlen); + + /* + * Wait for BSY to be cleared and DRQ to be set. + */ + + if (idecommon_wait_drq(ide) < 0) return -1; + status = IDE_READREG8(ide,IDE_REG_ALTSTAT); + if (idecommon_wait_drq(ide) < 0) return -1; + status = IDE_READREG8(ide,IDE_REG_IR); + + + /* + * Transfer data, if necessary. The direction will depend + * on what the drive says. If this is a non-data command, + * passing databuf == NULL can avoid all this. + */ + + if (databuf) { + status = IDE_READREG8(ide,IDE_REG_IR); + if (status & IDE_IR_CD) { + xprintf("Error: Command/data should be zero\n"); + } + + if (status & IDE_IR_IO) { /* from device (READ) */ + IDE_READBUF(ide,IDE_REG_DATA,databuf,datalen); + } + else { /* to device (WRITE) */ + IDE_WRITEBUF(ide,IDE_REG_DATA,databuf,datalen); + } + + } + + + idecommon_testdrq(ide); + + return 0; + +} + + +/* ********************************************************************* + * idecommon_request_sense(ide) + * + * Request sense data. This also clears a UNIT_ATTENTION condition + * + * Input parameters: + * ide - IDE interface + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ +static int idecommon_request_sense(idecommon_t *ide) +{ + uint8_t cdb[12]; + uint8_t sensedata[32]; + int res; + int numbytes; + + numbytes = sizeof(sensedata); + + cdb[0] = CDB_CMD_REQSENSE; + cdb[1] = 0; + cdb[2] = 0; + cdb[3] = 0; + cdb[4] = sizeof(sensedata); + cdb[5] = 0; + cdb[6] = 0; + cdb[7] = 0; + cdb[8] = 0; + cdb[9] = 0; + cdb[10] = 0; + cdb[11] = 0; + + memset(sensedata,0,sizeof(sensedata)); + + res = idecommon_packet(ide,cdb,sizeof(cdb),sensedata,numbytes); + +#if 0 + xprintf("Sense data: "); + xprintf("Err:%02X ",sensedata[0]); + xprintf("Key:%02X ",sensedata[1]); + xprintf("Information:%02X%02X ",sensedata[2],sensedata[3]); + xprintf("ASC:%02X ASCQ:%02X ",sensedata[12],sensedata[13]); + xprintf("\n"); +#endif + + idecommon_testdrq(ide); + + return res; +} + + +/* ********************************************************************* + * idecommon_read_atapi(ide,lba,numsec,buffer) + * + * Read sector(s) from the device. This version is for ATAPI devs. + * + * Input parameters: + * ide - IDE interface + * lba - logical block address + * numsec - number of sectors + * buffer - buffer address + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int idecommon_read_atapi(idecommon_t *ide,uint64_t lba, + int numsec,unsigned char *buffer) +{ + uint8_t cdb[12]; + int res = 0; + int numbytes; + int idx; + + numbytes = numsec << idecommon_sectorshift(ide->idecommon_sectorsize); + + cdb[0] = CDB_CMD_READ; + cdb[1] = 0; + cdb[2] = ((lba >> 24) & 0xFF); + cdb[3] = ((lba >> 16) & 0xFF); + cdb[4] = ((lba >> 8) & 0xFF); + cdb[5] = ((lba >> 0) & 0xFF); + cdb[6] = 0; + cdb[7] = ((numsec >> 8) & 0xFF); + cdb[8] = ((numsec >> 0) & 0xFF); + cdb[9] = 0; + cdb[10] = 0; + cdb[11] = 0; + + for (idx = 0; idx < 4; idx++) { + res = idecommon_packet(ide,cdb,sizeof(cdb),buffer,numbytes); + if (res < 0) { + idecommon_request_sense(ide); + continue; + } + break; + } + + return res; +} + + +/* ********************************************************************* + * idecommon_write_atapi(ide,lba,numsec,buffer) + * + * Write sector(s) to the device. This version is for ATAPI disks + * + * Input parameters: + * ide - IDE interface + * lba - logical block address + * numsec - number of sectors + * buffer - buffer address + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int idecommon_write_atapi(idecommon_t *ide,uint64_t lba, + int numsec,unsigned char *buffer) +{ + uint8_t cdb[12]; + int res; + int numbytes; + + numbytes = numsec << idecommon_sectorshift(ide->idecommon_sectorsize); + + cdb[0] = CDB_CMD_WRITE; + cdb[1] = 0; + cdb[2] = ((lba >> 24) & 0xFF); + cdb[3] = ((lba >> 16) & 0xFF); + cdb[4] = ((lba >> 8) & 0xFF); + cdb[5] = ((lba >> 0) & 0xFF); + cdb[6] = 0; + cdb[7] = ((numsec >> 8) & 0xFF); + cdb[8] = ((numsec >> 0) & 0xFF); + cdb[9] = 0; + cdb[10] = 0; + cdb[11] = 0; + + res = idecommon_packet(ide,cdb,sizeof(cdb),buffer,numbytes); + + return res; +} + + +/* ********************************************************************* + * idecommon_read_lba(ide,lba,numsec,buffer) + * + * Read sector(s) from the device. + * + * Input parameters: + * ide - IDE interface + * lba - logical block address + * numsec - number of sectors + * buffer - buffer address + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int idecommon_read_lba(idecommon_t *ide,uint64_t lba,int numsec,unsigned char *buffer) +{ + int secidx; + unsigned char *ptr; + + if (idecommon_waitnotbusy(ide) < 0) return -1; + IDE_WRITEREG8(ide,IDE_REG_DRVHD,(ide->idecommon_unit<<4) | ((lba >> 24) & 0x0F) | 0x40); + if (idecommon_waitnotbusy(ide) < 0) return -1; + + IDE_WRITEREG8(ide,IDE_REG_CYLMSB,((lba >> 16) & 0xFF)); + IDE_WRITEREG8(ide,IDE_REG_CYLLSB,((lba >> 8) & 0xFF)); + IDE_WRITEREG8(ide,IDE_REG_SECNUM,(lba & 0xFF)); + IDE_WRITEREG8(ide,IDE_REG_SECCNT,numsec); + + idecommon_testdrq(ide); + + IDE_WRITEREG8(ide,IDE_REG_COMMAND,IDE_CMD_READ); + + idecommon_waitbusy(ide); + if (idecommon_wait_drq(ide) < 0) return -1; + + ptr = buffer; + + for (secidx = 0; secidx < numsec; secidx++) { + IDE_READBUF(ide,IDE_REG_DATA,ptr,ide->idecommon_sectorsize); + ptr += ide->idecommon_sectorsize; + } + + idecommon_testdrq(ide); + + return 0; +} + + +/* ********************************************************************* + * idecommon_write_lba(ide,lba,numsec,buffer) + * + * Write sector(s) from the device. + * + * Input parameters: + * ide - IDE interface + * lba - logical block address + * numsec - number of sectors + * buffer - buffer address + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int idecommon_write_lba(idecommon_t *ide,uint64_t lba,int numsec,unsigned char *buffer) +{ + int secidx; + uint8_t *ptr; + + if (idecommon_waitnotbusy(ide) < 0) return -1; + IDE_WRITEREG8(ide,IDE_REG_DRVHD,(ide->idecommon_unit<<4) | ((lba >> 24) & 0x0F) | 0x40); + if (idecommon_waitnotbusy(ide) < 0) return -1; + + IDE_WRITEREG8(ide,IDE_REG_CYLMSB,((lba >> 16) & 0xFF)); + IDE_WRITEREG8(ide,IDE_REG_CYLLSB,((lba >> 8) & 0xFF)); + IDE_WRITEREG8(ide,IDE_REG_SECNUM,(lba & 0xFF)); + IDE_WRITEREG8(ide,IDE_REG_SECCNT,numsec); + + IDE_WRITEREG8(ide,IDE_REG_COMMAND,IDE_CMD_WRITE); + + if (idecommon_wait_drq(ide) < 0) return -1; + + ptr = buffer; + + for (secidx = 0; secidx < numsec; secidx++) { + IDE_WRITEBUF(ide,IDE_REG_DATA,ptr,ide->idecommon_sectorsize); + ptr += ide->idecommon_sectorsize; + } + + idecommon_testdrq(ide); + + return 0; +} + + +/* ********************************************************************* + * idecommon_diagnostic(ide) + * + * run the device diagnostics on the IDE device. This also + * helps us determine if it's an IDE or ATAPI disk, since the + * diagnostic will leave a signature in the registers. + * + * Input parameters: + * softc - IDE interface + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int idecommon_diagnostic(idecommon_t *softc) +{ + if (idecommon_waitnotbusy(softc) < 0) return -1; + IDE_WRITEREG8(softc,IDE_REG_DRVHD,(softc->idecommon_unit<<4)); + if (idecommon_waitnotbusy(softc) < 0) return -1; + + IDE_WRITEREG8(softc,IDE_REG_COMMAND,IDE_CMD_DIAGNOSTIC); + if (idecommon_waitnotbusy(softc) < 0) return -1; + + cfe_sleep(CFE_HZ/2); + idecommon_dumpregs(softc); + + return 0; +} + + +/* ********************************************************************* + * idecommon_getmodel(buffer,model) + * + * Get the ASCII model name out of an IDE identify buffer. some + * byte swapping is involved here. The trailing blanks are trimmed. + * + * Input parameters: + * buffer - 512-byte buffer from IDENTIFY command + * model - 41-byte string (max) for model name + * + * Return value: + * nothing + ********************************************************************* */ + +static void idecommon_getmodel(uint8_t *buffer,char *model) +{ + uint16_t w; + int idx; + + for (idx = 0; idx < 20; idx++) { + w = GETWORD_LE(buffer,27+idx); + model[idx*2] = w >> 8; + model[idx*2+1] = w & 0xFF; + } + for (idx = 39; idx > 0; idx--) { + if (model[idx] != ' ') { + model[idx+1] = '\0'; + break; + } + } + +} + +/* ********************************************************************* + * idecommon_devprobe(softc) + * + * Probe the IDE device, to determine if it's actually present + * or not. If present, determine if it's IDE or ATAPI and + * get the device size. Init our internal structures so we know + * how to talk to the device. + * + * Input parameters: + * softc - IDE structure + * noisy - display stuff as we probe + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int idecommon_devprobe(idecommon_t *softc,int noisy) +{ + int res; + int atapi; + unsigned char buffer[DISK_SECTORSIZE]; + unsigned char model[41]; + uint64_t ttlsect; + int devtype; + uint16_t w; + char *typename; + + /* + * Reset the drive + */ + + res = idecommon_reset(softc); + if (res < 0) return -1; + + /* + * Run diagnostic to get the signature. + */ + + res = idecommon_diagnostic(softc); + if (res < 0) return res; + + /* + * Test signature + */ + + atapi = 0; + if ((IDE_READREG8(softc,IDE_REG_CYLLSB) == ATAPI_SIG_LSB) && + (IDE_READREG8(softc,IDE_REG_CYLMSB) == ATAPI_SIG_MSB)) { + atapi = 1; + } + + if (noisy) { + if (atapi) xprintf("ATAPI: "); + else xprintf("IDE: "); + } + + /* + * Do tha appropriate IDENTIFY command to get device information + */ + + softc->idecommon_atapi = atapi; + res = idecommon_identify(softc,buffer); + if (res < 0) return -1; + + /* + * Using that information, determine our device type + */ + + if (!atapi) { + devtype = IDE_DEVTYPE_DISK; + typename = "Disk"; + } + else { + w = GETWORD_LE(buffer,0); + switch ((w >> 8) & 31) { + case 5: /* CD-ROM */ + devtype = IDE_DEVTYPE_CDROM; + typename = "CD-ROM"; + break; + default: + devtype = IDE_DEVTYPE_ATAPIDISK; + typename = "Disk"; + break; + } + } + + /* + * Say nice things about the device. + */ + + idecommon_getmodel(buffer,model); + if (noisy) xprintf("%s, \"%s\"",typename,model); + + +#ifdef _IDE_DEBUG_ + if (!softc->idecommon_atapi) { + ttlsect = (GETWORD_LE(buffer,57) + (GETWORD_LE(buffer,58) << 16)); + if (noisy) xprintf(", Sectors: %llu (%lld MB)",ttlsect, + (uint64_t) (ttlsect/2048)); + } + else { + ttlsect = 0; + } +#endif + if (noisy) xprintf("\n"); + + /* + * Initialize internal structure info, especially pointers to the + * read/write routines and the sector size. + */ + + softc->idecommon_ttlsect = ttlsect; + idecommon_init(softc,devtype); + + return res; +} + +/* ********************************************************************* + * idecommon_open(ctx) + * + * Process the CFE OPEN call for this device. For IDE disks, + * the device is reset and identified, and the geometry is + * determined. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + + +int idecommon_open(cfe_devctx_t *ctx) +{ + idecommon_t *softc = ctx->dev_softc; + int res; + + if (softc->idecommon_deferprobe) { + res = idecommon_devprobe(softc,0); + if (res < 0) return res; + } + + return 0; +} + +/* ********************************************************************* + * idecommon_read(ctx,buffer) + * + * Process a CFE READ command for the IDE device. This is + * more complex than it looks, since CFE offsets are byte offsets + * and we may need to read partial sectors. + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * number of bytes read, or <0 if an error occured + ********************************************************************* */ + +int idecommon_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + idecommon_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + int numsec; + int res = 0; + int amtcopy; + uint64_t lba; + uint64_t offset; + unsigned char sector[MAX_SECTORSIZE]; + int sectorshift; + + sectorshift = idecommon_sectorshift(softc->idecommon_sectorsize); + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + offset = buffer->buf_offset; + numsec = (blen + softc->idecommon_sectorsize - 1) >> sectorshift; + + if (offset & (softc->idecommon_sectorsize-1)) { + lba = (offset >> sectorshift); + res = (*softc->idecommon_readfunc)(softc,lba,1,sector); + if (res < 0) goto out; + amtcopy = softc->idecommon_sectorsize - (offset & (softc->idecommon_sectorsize-1)); + if (amtcopy > blen) amtcopy = blen; + memcpy(bptr,§or[offset & (softc->idecommon_sectorsize-1)],amtcopy); + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + + while (blen >= softc->idecommon_sectorsize) { + lba = (offset >> sectorshift); + amtcopy = softc->idecommon_sectorsize; + res = (*softc->idecommon_readfunc)(softc,lba,1,bptr); + if (res < 0) goto out; + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + + if (blen) { + lba = (offset >> sectorshift); + res = (*softc->idecommon_readfunc)(softc,lba,1,sector); + if (res < 0) goto out; + amtcopy = blen; + memcpy(bptr,sector,amtcopy); + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + +out: + buffer->buf_retlen = bptr - buffer->buf_ptr; + + return res; +} + +/* ********************************************************************* + * idecommon_inpstat(ctx,inpstat) + * + * Test input status for the IDE disk. Disks are always ready + * to read. + * + * Input parameters: + * ctx - device context + * inpstat - input status structure + * + * Return value: + * 0 + ********************************************************************* */ + +int idecommon_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + /* idecommon_t *softc = ctx->dev_softc; */ + + inpstat->inp_status = 1; + return 0; +} + +/* ********************************************************************* + * idecommon_write(ctx,buffer) + * + * Process a CFE WRITE command for the IDE device. If the write + * involves partial sectors, the affected sectors are read first + * and the changes are merged in. + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * number of bytes write, or <0 if an error occured + ********************************************************************* */ + +int idecommon_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + idecommon_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + int numsec; + int res = 0; + int amtcopy; + uint64_t offset; + uint64_t lba; + unsigned char sector[MAX_SECTORSIZE]; + int sectorshift; + + sectorshift = (softc->idecommon_sectorsize == 2048) ? 11 : 9; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + offset = buffer->buf_offset; + numsec = (blen + softc->idecommon_sectorsize - 1) >> sectorshift; + + if (offset & (softc->idecommon_sectorsize-1)) { + lba = (offset >> sectorshift); + res = (*softc->idecommon_readfunc)(softc,lba,1,sector); + if (res < 0) goto out; + amtcopy = softc->idecommon_sectorsize - (offset & (softc->idecommon_sectorsize-1)); + if (amtcopy > blen) amtcopy = blen; + memcpy(§or[offset & (softc->idecommon_sectorsize-1)],bptr,amtcopy); + res = (*softc->idecommon_writefunc)(softc,lba,1,sector); + if (res < 0) goto out; + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + + while (blen >= softc->idecommon_sectorsize) { + amtcopy = softc->idecommon_sectorsize; + lba = (offset >> sectorshift); + res = (*softc->idecommon_writefunc)(softc,lba,1,bptr); + if (res < 0) goto out; + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + + if (blen) { + lba = (offset >> sectorshift); + res = (*softc->idecommon_readfunc)(softc,lba,1,sector); + if (res < 0) goto out; + amtcopy = blen; + memcpy(sector,bptr,amtcopy); + res = (*softc->idecommon_writefunc)(softc,lba,1,sector); + if (res < 0) goto out; + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + +out: + buffer->buf_retlen = bptr - buffer->buf_ptr; + + return res; +} + + +/* ********************************************************************* + * idecommon_ioctl(ctx,buffer) + * + * Process device I/O control requests for the IDE device. + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int idecommon_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + idecommon_t *softc = ctx->dev_softc; + unsigned int *info = (unsigned int *) buffer->buf_ptr; + unsigned long long *linfo = (unsigned long long *) buffer->buf_ptr; + blockdev_info_t *devinfo; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_BLOCK_GETBLOCKSIZE: + *info = softc->idecommon_sectorsize; + break; + case IOCTL_BLOCK_GETTOTALBLOCKS: + *linfo = softc->idecommon_ttlsect; + break; + case IOCTL_BLOCK_GETDEVTYPE: + devinfo = (blockdev_info_t *) buffer->buf_ptr; + devinfo->blkdev_totalblocks = softc->idecommon_ttlsect; + devinfo->blkdev_blocksize = softc->idecommon_sectorsize; + devinfo->blkdev_devtype = (softc->idecommon_devtype == IDE_DEVTYPE_CDROM) ? + BLOCK_DEVTYPE_CDROM : BLOCK_DEVTYPE_DISK; + break; + default: + return -1; + } + + return 0; +} + +/* ********************************************************************* + * idecommon_close(ctx) + * + * Close the I/O device. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int idecommon_close(cfe_devctx_t *ctx) +{ + /* idecommon_t *softc = ctx->dev_softc; */ + + return 0; +} + + +/* ********************************************************************* + * idecommon_init(ide,devtype) + * + * Set up internal values based on the device type + * + * Input parameters: + * ide - IDE interface + * devtype - device type + * + * Return value: + * nothing + ********************************************************************* */ + +void idecommon_init(idecommon_t *ide,int devtype) +{ + + ide->idecommon_devtype = devtype; + + switch (ide->idecommon_devtype) { + case IDE_DEVTYPE_DISK: + ide->idecommon_atapi = FALSE; + ide->idecommon_sectorsize = DISK_SECTORSIZE; + break; + case IDE_DEVTYPE_CDROM: + ide->idecommon_atapi = TRUE; + ide->idecommon_sectorsize = CDROM_SECTORSIZE; + break; + case IDE_DEVTYPE_ATAPIDISK: + ide->idecommon_atapi = TRUE; + ide->idecommon_sectorsize = DISK_SECTORSIZE; + break; + default: + ide->idecommon_atapi = FALSE; + ide->idecommon_sectorsize = DISK_SECTORSIZE; + break; + } + + if (ide->idecommon_atapi) { + ide->idecommon_readfunc = idecommon_read_atapi; + ide->idecommon_writefunc = idecommon_write_atapi; + } + else { + ide->idecommon_readfunc = idecommon_read_lba; + ide->idecommon_writefunc = idecommon_write_lba; + } +} + +/* ********************************************************************* + * idecommon_attach(devdisp) + * + * Set up a cfe_devdisp structure that points at the idecommon + * structures. + * + * Input parameters: + * devdisp - cfe_devdisp_t structure + * + * Return value: + * nothing + ********************************************************************* */ +void idecommon_attach(cfe_devdisp_t *disp) +{ + disp->dev_open = idecommon_open; + disp->dev_read = idecommon_read; + disp->dev_inpstat = idecommon_inpstat; + disp->dev_write = idecommon_write; + disp->dev_ioctl = idecommon_ioctl; + disp->dev_close = idecommon_close; + disp->dev_poll = NULL; + disp->dev_reset = NULL; +} diff --git a/cfe/cfe/dev/dev_ide_pci.c b/cfe/cfe/dev/dev_ide_pci.c new file mode 100644 index 0000000..ecf4c2a --- /dev/null +++ b/cfe/cfe/dev/dev_ide_pci.c @@ -0,0 +1,358 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PCI IDE disk driver File: dev_ide_pci.c + * + * This is a simple driver for IDE hard disks that are connected + * to PCI IDE controllers, such as a Promise UltraXX. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_timer.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" + +#include "dev_ide_common.h" + +#include "dev_ide.h" + +#include "pcivar.h" +#include "pcireg.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define _BYTESWAP_ /* don't byteswap these disks */ + +#define OUTB(x,y) outb(x,y) +#define OUTW(x,y) outw(x,y) +#define INB(x) inb(x) +#define INW(x) inw(x) + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + +extern void _wbflush(void); + +static void idedrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +/* ********************************************************************* + * Device Dispatch + ********************************************************************* */ + +static cfe_devdisp_t idedrv_dispatch = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +const cfe_driver_t pciidedrv = { + "PCI IDE disk", + "ide", + CFE_DEV_DISK, + &idedrv_dispatch, + idedrv_probe +}; + +const cfe_driver_t pciatapidrv = { + "PCI ATAPI device", + "atapi", + CFE_DEV_DISK, + &idedrv_dispatch, + idedrv_probe +}; + +/* ********************************************************************* + * Supported PCI devices + ********************************************************************* */ + +#define DEVID(vid,pid) (((pid)<<16)|(vid)) + +static uint32_t pciidedrv_devlist[] = { + DEVID(0x105a,0x4d33), /* Promise Ultra33 */ + DEVID(0x1095,0x0649), /* CMD PCI0649 */ + DEVID(0x1095,0x0648), /* CMD PCI0648 */ + 0xFFFFFFFF +}; + + +/* ********************************************************************* + * Port I/O routines + * + * These routines are called back from the common code to do + * I/O cycles to the IDE disk. We provide routines for + * reading and writing bytes, words, and strings of words. + ********************************************************************* */ + +static uint8_t idedrv_inb(idecommon_dispatch_t *disp,uint32_t reg) +{ + return INB(reg+disp->baseaddr); +} + +static uint16_t idedrv_inw(idecommon_dispatch_t *disp,uint32_t reg) +{ + return INW(reg+disp->baseaddr); +} + +static void idedrv_ins(idecommon_dispatch_t *disp,uint32_t reg,uint8_t *buf,int len) +{ + uint16_t data; + + while (len > 0) { + data = INW(reg+disp->baseaddr); + +#ifdef _BYTESWAP_ + *buf++ = (data >> 8) & 0xFF; + *buf++ = (data & 0xFF); +#else + *buf++ = (data & 0xFF); + *buf++ = (data >> 8) & 0xFF; +#endif + len--; + len--; + } + +} + +static void idedrv_outb(idecommon_dispatch_t *disp,uint32_t reg,uint8_t val) +{ + OUTB(reg+disp->baseaddr,val); +} + +static void idedrv_outw(idecommon_dispatch_t *disp,uint32_t reg,uint16_t val) +{ + OUTW(reg+disp->baseaddr,val); +} + +static void idedrv_outs(idecommon_dispatch_t *disp,uint32_t reg,uint8_t *buf,int len) +{ + uint16_t data; + + while (len > 0) { +#ifdef _BYTESWAP_ + data = (uint16_t) buf[1] + ((uint16_t) buf[0] << 8); +#else + data = (uint16_t) buf[0] + ((uint16_t) buf[1] << 8); +#endif + + OUTW(reg+disp->baseaddr,data); + + buf++; + buf++; + len--; + len--; + } +} + + +/* ********************************************************************* + * pciidedrv_find(devid,list) + * + * Find a particular product ID on the list. Return >= 0 if + * the ID is valid. + * + * Input parameters: + * devid - product and device ID we have + * list - list of product and device IDs we're looking for + * + * Return value: + * index into table, or -1 if not found + ********************************************************************* */ +static int pciidedrv_find(uint32_t devid,uint32_t *list) +{ + int idx = 0; + + while (list[idx] != 0xFFFFFFFF) { + if (list[idx] == devid) return idx; + idx++; + } + + return -1; +} + + +/* ********************************************************************* + * idedrv_probe(drv,probe_a,probe_b,probe_ptr) + * + * Our probe routine. Attach an IDE device to the firmware. + * + * Input parameters: + * drv - driver structure + * probe_a - physical address of IDE registers + * probe_b - unit number + * probe_ptr - not used + * + * Return value: + * nothing + ********************************************************************* */ + +static void idedrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + idecommon_t *softc; + idecommon_dispatch_t *disp; + char descr[80]; + char unitstr[50]; + pcitag_t tag; + int index; + uint32_t devid; + uint32_t reg; + int res; + int unit; + cfe_driver_t *realdrv; + int attached = 0; + + /* + * probe_a is unused + * probe_b is unused + * probe_ptr is unused. + */ + + index = 0; + + for (;;) { + if (pci_find_class(PCI_CLASS_MASS_STORAGE,index,&tag) != 0) break; + index++; + devid = pci_conf_read(tag,PCI_ID_REG); + + if (pciidedrv_find(devid,pciidedrv_devlist) < 0) { + continue; + } + + + reg = pci_conf_read(tag,PCI_MAPREG(0)); + + if (PCI_MAPREG_TYPE(reg) != PCI_MAPREG_TYPE_IO) { + xprintf("Skipping this IDE device, we don't do memory mapped IDE yet\n"); + continue; + } + + reg &= ~PCI_MAPREG_TYPE_MASK; + + for (unit = 0; unit < 2; unit++) { + + /* + * If we've deliberately disabled probing of this + * device, then skip it. + */ + + if (IDE_PROBE_GET_TYPE(probe_b,unit) == IDE_DEVTYPE_NOPROBE) { + continue; + } + + softc = (idecommon_t *) KMALLOC(sizeof(idecommon_t),0); + disp = (idecommon_dispatch_t *) KMALLOC(sizeof(idecommon_dispatch_t),0); + + if (!softc || !disp) { + if (softc) KFREE(softc); + if (disp) KFREE(disp); + return; /* out of memory, stop here */ + } + + + softc->idecommon_addr = reg; + disp->ref = softc; + disp->baseaddr = softc->idecommon_addr; + softc->idecommon_deferprobe = 0; + softc->idecommon_dispatch = disp; + softc->idecommon_unit = unit; + + disp->outb = idedrv_outb; + disp->outw = idedrv_outw; + disp->outs = idedrv_outs; + + disp->inb = idedrv_inb; + disp->inw = idedrv_inw; + disp->ins = idedrv_ins; + + /* + * If we're autoprobing, do it now. Loop back if we have + * trouble finding the device. + * + * If not autoprobing, assume the device is there and set the + * common routines to double check later. + */ + + if (IDE_PROBE_GET_TYPE(probe_b,unit) == IDE_DEVTYPE_AUTO) { + res = idecommon_devprobe(softc,1); + if (res < 0) { + KFREE(softc); + KFREE(disp); + continue; + } + } + else { + idecommon_init(softc,IDE_PROBE_GET_TYPE(probe_b,unit)); + softc->idecommon_deferprobe = 1; + } + + xsprintf(descr,"%s unit %d at I/O %04X",drv->drv_description, + softc->idecommon_unit,softc->idecommon_addr); + xsprintf(unitstr,"%d",unit); + + realdrv = (cfe_driver_t *) (softc->idecommon_atapi ? &pciatapidrv : &pciidedrv); + + idecommon_attach(&idedrv_dispatch); + cfe_attach(realdrv,softc,unitstr,descr); + attached++; + } + + } + + xprintf("PCIIDE: %d controllers found\n",attached); +} + + diff --git a/cfe/cfe/dev/dev_newflash.c b/cfe/cfe/dev/dev_newflash.c new file mode 100644 index 0000000..d196e92 --- /dev/null +++ b/cfe/cfe/dev/dev_newflash.c @@ -0,0 +1,1428 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * "New" Flash device driver File: dev_newflash.c + * + * This driver supports various types of flash + * parts. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "addrspace.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_error.h" + +#include "bsp_config.h" +#include "dev_newflash.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define GETCFIBYTE(arr,x) (arr[(x)*2]) + +#define min(a,b) ((a) < (b) ? (a) : (b)) +#define max(a,b) ((a) > (b) ? (a) : (b)) + +/* + * Get the address of the flash sector buffer from the + * config file. Addresses are PHYSICAL. + */ + +#ifndef CFG_FLASH_SECTOR_BUFFER_ADDR +#define CFG_FLASH_SECTOR_BUFFER_ADDR (100*1024*1024-128*1024) +#endif + +#ifndef CFG_FLASH_SECTOR_BUFFER_SIZE +#define CFG_FLASH_SECTOR_BUFFER_SIZE (128*1024) +#endif + + +/*#define _NEWFLASH_DEBUG_ */ + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + + +static void flashdrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +static int flashdrv_open(cfe_devctx_t *ctx); +static int flashdrv_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int flashdrv_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int flashdrv_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int flashdrv_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int flashdrv_close(cfe_devctx_t *ctx); + +/* ********************************************************************* + * Device dispatch + ********************************************************************* */ + +const static cfe_devdisp_t flashdrv_dispatch = { + flashdrv_open, + flashdrv_read, + flashdrv_inpstat, + flashdrv_write, + flashdrv_ioctl, + flashdrv_close, + NULL, + NULL +}; + +const cfe_driver_t newflashdrv = { + "New CFI flash", + "flash", + CFE_DEV_FLASH, + &flashdrv_dispatch, + flashdrv_probe +}; + + + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern void *flashop_engine_ptr; +extern int flashop_engine_len; + +extern void _cfe_flushcache(int); + +static int flash_sector_query(flashdev_t *softc,flash_sector_t *sector); + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +/* + * This is a pointer to a DRAM version of our flash subroutines. + * We make a global here so that it doesn't get copied multiple + * times for each flash we instantiate. + */ + +static int (*flashop_engine_ram)(flashinstr_t *prog) = NULL; +static uint8_t *flash_sector_buffer = NULL; + +/* ********************************************************************* + * FLASH_OP_BEGIN(softc) + * + * Reset the pointer to the flash operations so that we can + * begin filling in new instructions to execute + * + * Input parameters: + * softc - our softc. + * + * Return value: + * nothing + ********************************************************************* */ + +#define flash_op_begin(softc) softc->fd_iptr = 0; + +/* ********************************************************************* + * FLASH_OP_ADD(softc,op,dest,src,cnt) + * + * Add an instruction to the flashop table + * + * Input parameters: + * softc - our flash + * op,dest,src,cnt - data for the opcode + * + * Return value: + * nothing + ********************************************************************* */ + +static void flash_op_add(flashdev_t *softc,long base,long op,long dest,long src,long cnt) +{ + flashinstr_t *fi = &(softc->fd_inst[softc->fd_iptr]); + + fi->fi_op = op; + fi->fi_base = base; + fi->fi_dest = dest; + fi->fi_src = src; + fi->fi_cnt = cnt; + + softc->fd_iptr++; +} + + +/* ********************************************************************* + * FLASH_OP_EXECUTE(softc) + * + * Execute the stored "flash operations" + * + * Input parameters: + * softc - our flash + * + * Return value: + * 0 if ok, else # of failures (less than zero) + ********************************************************************* */ + +static int flash_op_execute(flashdev_t *softc) +{ + flash_op_add(softc,softc->fd_probe.flash_phys,FEOP_RETURN,0,0,0); + +#ifdef _NEWFLASH_DEBUG_ + if (1) { + int idx; + printf("---------------\nCalling engine @ %08X\n",flashop_engine_ram); + for (idx = 0; idx < softc->fd_iptr; idx++) { + printf("%2d %08X %08X %08X %08X\n", + softc->fd_inst[idx].fi_op, + softc->fd_inst[idx].fi_base, + softc->fd_inst[idx].fi_dest, + softc->fd_inst[idx].fi_src, + softc->fd_inst[idx].fi_cnt); + } + } +#endif + + /* + * If someone hooked the flashop engine, call the hook. + */ + if (softc->fd_probe.flash_engine_hook) { + return (*(softc->fd_probe.flash_engine_hook))(&(softc->fd_inst[0])); + } + + /* + * Otherwise, call the standard one. + */ + if (!flashop_engine_ram) return CFE_ERR_UNSUPPORTED; + return (*flashop_engine_ram)(&(softc->fd_inst[0])); +} + + +/* ********************************************************************* + * FLASH_SETUP_ENGINE() + * + * Set up the "flash engine", copying the routine to DRAM + * and flushing the cache so we can call it. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void flash_setup_engine(void) +{ +#if ((CFG_RAMAPP) || (CFG_EMBEDDED_PIC)) + /* CFE is relocated, no need to copy flash engine to heap */ + flashop_engine_ram = (void *) flashop_engine_ptr; +#else + /* Copy flash engine to heap */ + uint32_t *dst,*src; + int idx; + + if (flashop_engine_ram) return; /* already done */ + + /* + * Allocate space for engine + */ + + flashop_engine_ram = (void *) KMALLOC(flashop_engine_len,0); + if (!flashop_engine_ram) return; + + /* + * Copy engine to RAM - do it 32-bits at a time to avoid + * a certain platform with broken byte reads (no, not the 1250) + */ + + dst = (uint32_t *) flashop_engine_ram; + src = (uint32_t *) flashop_engine_ptr; + for (idx = 0; idx < flashop_engine_len/sizeof(uint32_t); idx++) { + *dst++ = *src++; + } + + /* + * Flush the d-cache, invalidate the I-cache. + */ + + _cfe_flushcache(1); + _cfe_flushcache(2); +#endif +} + +/* ********************************************************************* + * FLASH_ERASE_RANGE(softc,range) + * + * Erase a range of sectors + * + * Input parameters: + * softc - our flash + * range - range structure + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +static int flash_erase_range(flashdev_t *softc,flash_range_t *range) +{ + flash_sector_t sector; + int res; + + if (softc->fd_probe.flash_type != FLASH_TYPE_FLASH) { + return CFE_ERR_UNSUPPORTED; + } + + if (range->range_base+range->range_length > softc->fd_probe.flash_size) { + return CFE_ERR_INV_PARAM; + } + + res = 0; + + sector.flash_sector_idx = 0; + + for (;;) { + res = flash_sector_query(softc,§or); + if (res != 0) break; + if (sector.flash_sector_status == FLASH_SECTOR_INVALID) { + break; + } + + if ((sector.flash_sector_offset >= range->range_base) && + (sector.flash_sector_offset < + (range->range_base+range->range_length-1))) { + + flash_op_begin(softc); + flash_op_add(softc,softc->fd_probe.flash_phys, + softc->fd_erasefunc, + sector.flash_sector_offset, + 0,0); + res = flash_op_execute(softc); + + if (res != 0) break; + } + sector.flash_sector_idx++; + } + + return res; + +} + +/* ********************************************************************* + * FLASH_ERASE_ALL(softc) + * + * Erase the entire flash device, except the NVRAM area, + * sector-by-sector. + * + * Input parameters: + * softc - our flash + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int flash_erase_all(flashdev_t *softc) +{ + flash_range_t range; + + range.range_base = 0; + range.range_length = softc->fd_probe.flash_size * + softc->fd_probe.flash_nchips; + + return flash_erase_range(softc,&range); +} + + +/* ********************************************************************* + * flash_range_intersection(sector,inrange,outrange) + * + * Compute the intersection between a flash range and a + * sector. + * + * Input parameters: + * sector - sector to examine + * range - range we are checking + * outrange - where to put resulting intersection range + * + * Return value: + * 1 - range is an entire sector + * 0 - range is a partial sector + * -1 - range has no intersection + ********************************************************************* */ + +static int flash_range_intersection(flash_sector_t *sector, + flash_range_t *inrange, + flash_range_t *outrange) +{ + int start,end; + + /* + * compute the start and end pointers + */ + + start = (int) (max(sector->flash_sector_offset, + inrange->range_base)); + + end = (int) (min((sector->flash_sector_offset+sector->flash_sector_size), + (inrange->range_base+inrange->range_length))); + + /* + * if the end is in the right place wrt the start, + * there is an intersection. + */ + + if (end > start) { + outrange->range_base = (unsigned int) start; + outrange->range_length = (unsigned int) (end-start); + + if ((sector->flash_sector_offset == outrange->range_base) && + (sector->flash_sector_size == outrange->range_length)) { + return 1; /* instersection: entire sector */ + } + else { + return 0; /* intersection: partial sector */ + } + } + else { + outrange->range_base = (unsigned int) start; + outrange->range_length = 0; + return -1; /* intersection: none */ + } +} + + +/* ********************************************************************* + * FLASH_SECTOR_QUERY(softc,sector) + * + * Query the sector information about a particular sector. You can + * call this iteratively to find out about all of the sectors. + * + * Input parameters: + * softc - our flash info + * sector - structure to receive sector information + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int flash_sector_query(flashdev_t *softc,flash_sector_t *sector) +{ + int idx; + int nblks; + int blksiz; + unsigned int offset; + int whichchip; + int secidx; + int curblk; + + if (softc->fd_probe.flash_type != FLASH_TYPE_FLASH) { + return CFE_ERR_UNSUPPORTED; + } + + if (softc->fd_probe.flash_nsectors == 0) { + return CFE_ERR_UNSUPPORTED; + } + + /* Figure out which chip */ + whichchip = sector->flash_sector_idx / softc->fd_ttlsect; + if (whichchip >= softc->fd_probe.flash_nchips) { + sector->flash_sector_status = FLASH_SECTOR_INVALID; + return 0; + } + + /* Within that chip, get sector info */ + offset = softc->fd_probe.flash_size * whichchip; + secidx = sector->flash_sector_idx % softc->fd_ttlsect; + curblk = 0; + + for (idx = 0; idx < softc->fd_probe.flash_nsectors; idx++) { + nblks = FLASH_SECTOR_NBLKS(softc->fd_probe.flash_sectors[idx]); + blksiz = FLASH_SECTOR_SIZE(softc->fd_probe.flash_sectors[idx]); + if (secidx < curblk+nblks) { + sector->flash_sector_status = FLASH_SECTOR_OK; + sector->flash_sector_offset = + offset + (secidx-curblk)*blksiz; + sector->flash_sector_size = blksiz; + break; + } + + offset += (nblks)*blksiz; + curblk += nblks; + } + + + if (idx == softc->fd_probe.flash_nsectors) { + sector->flash_sector_status = FLASH_SECTOR_INVALID; + } + + return 0; +} + + +/* ********************************************************************* + * FLASH_SET_CMDSET(softc,cmdset,bus16,dev16) + * + * Set the command-set that we'll honor for this flash. + * + * Input parameters: + * softc - our flash + * cmdset - FLASH_CFI_CMDSET_xxx + * bus16 - true if bus is 16 bits wide + * dev16 - true if device supports 16-bit operation + * + * So: bus16 && dev16 -> 16-bit commands + * !bus16 && dev16 -> 8-bit commands to 16-bit flash with BYTE# + * !bus16 && !dev16 -> 8-bit commands + * + * Return value: + * nothing + ********************************************************************* */ + +static void flash_set_cmdset(flashdev_t *softc,int cmdset,int bus16,int dev16) +{ + switch (cmdset) { +#if (FLASH_DRIVERS & FLASH_DRIVER_INTEL) + case FLASH_CFI_CMDSET_INTEL_ECS: + case FLASH_CFI_CMDSET_INTEL_STD: + if (bus16) { + softc->fd_erasefunc = FEOP_INTEL_ERASE16; + softc->fd_pgmfunc = FEOP_INTEL_PGM16; + softc->fd_readfunc = FEOP_READ16; + } + else { + softc->fd_erasefunc = FEOP_INTEL_ERASE8; + softc->fd_pgmfunc = FEOP_INTEL_PGM8; + softc->fd_readfunc = FEOP_READ8; + } + break; +#endif +#if (FLASH_DRIVERS & FLASH_DRIVER_AMD) + case FLASH_CFI_CMDSET_AMD_STD: + case FLASH_CFI_CMDSET_AMD_ECS: + if (!bus16 && !dev16) { /* 8-bit bus, 8-bit flash */ + softc->fd_erasefunc = FEOP_AMD_ERASE8; + softc->fd_pgmfunc = FEOP_AMD_PGM8; + softc->fd_readfunc = FEOP_READ8; + } + else if (bus16 && dev16) { /* 16-bit bus, 16-bit flash */ + softc->fd_erasefunc = FEOP_AMD_ERASE16; + softc->fd_pgmfunc = FEOP_AMD_PGM16; + softc->fd_readfunc = FEOP_READ16; + } + else { /* 8-bit bus, 16-bit flash w/BYTE# */ + softc->fd_erasefunc = FEOP_AMD_ERASE16B; + softc->fd_pgmfunc = FEOP_AMD_PGM16B; + softc->fd_readfunc = FEOP_READ8; + } + break; +#endif + default: + /* we don't understand the command set - treat it like ROM */ + softc->fd_erasefunc = FEOP_RETURN; + softc->fd_pgmfunc = FEOP_RETURN; + softc->fd_readfunc = bus16 ? FEOP_READ16 : FEOP_READ8; + break; + } +} + +#if (FLASH_DRIVERS & FLASH_DRIVER_CFI) +/* ********************************************************************* + * FLASH_CFI_PROBE(softc) + * + * Try to do a CFI query on this device. If we find the m + * magic signature, extract some useful information from the + * query structure. + * + * Input parameters: + * softc - out flash + * + * Return value: + * 0 if successful, <0 if error + ********************************************************************* */ +static int flash_cfi_probe(flashdev_t *softc) +{ + uint8_t cfidata[FLASH_MAX_CFIDATA]; + unsigned int cmdset; + unsigned int devif; + int bus16 = 0; + int dev16 = 0; + int idx; + int found = 0; + int regcnt; + int nblks; + int blksiz; + int insane = 0; + uint8_t insaner = 0; + + if (softc->fd_probe.flash_flags & FLASH_FLG_BUS16) { + bus16 = 1; + } + + /* + * Do a CFI query (16-bit) + */ + + idx = FEOP_CFIQUERY8; + if (softc->fd_probe.flash_flags & FLASH_FLG_DEV16) { + idx = (softc->fd_probe.flash_flags & FLASH_FLG_BUS16) ? + FEOP_CFIQUERY16 : FEOP_CFIQUERY16B; + } + + flash_op_begin(softc); + flash_op_add(softc,softc->fd_probe.flash_phys, + idx,(long)cfidata,0,FLASH_MAX_CFIDATA); + flash_op_execute(softc); + + /* + * Look for signature. + */ + + + if ((GETCFIBYTE(cfidata,FLASH_CFI_SIGNATURE+0) == 'Q') && + (GETCFIBYTE(cfidata,FLASH_CFI_SIGNATURE+1) == 'R') && + (GETCFIBYTE(cfidata,FLASH_CFI_SIGNATURE+2) == 'Y')) { + found = 1; + } + + + /* + * No CFI, bail. First, set the command set to an invalid + * value so that we'll use default routines to read but not do programming + */ + + if (!found) { + flash_set_cmdset(softc,-1,bus16,dev16); + return CFE_ERR_UNSUPPORTED; + } + + softc->fd_probe.flash_type = FLASH_TYPE_FLASH; + + /* + * Gather info from flash + */ + + cmdset = ((unsigned int) (GETCFIBYTE(cfidata,FLASH_CFI_COMMAND_SET))) + + (((unsigned int) (GETCFIBYTE(cfidata,FLASH_CFI_COMMAND_SET+1))) << 8); + + + devif = ((unsigned int) (GETCFIBYTE(cfidata,FLASH_CFI_DEVICE_INTERFACE))) + + (((unsigned int) (GETCFIBYTE(cfidata,FLASH_CFI_DEVICE_INTERFACE+1))) << 8); + + + softc->fd_probe.flash_size = (1 << (unsigned int)(GETCFIBYTE(cfidata,FLASH_CFI_DEVICE_SIZE))); + + /* + * It's a 16-bit device if it is either always 16 bits or can be. + * we'll use "bus16" to decide if the BYTE# pin was strapped + */ + + dev16 = 0; + if ((devif == FLASH_CFI_DEVIF_X16) || (devif == FLASH_CFI_DEVIF_X8X16)) dev16 = 1; + + regcnt = GETCFIBYTE(cfidata,FLASH_CFI_REGION_COUNT); + + softc->fd_probe.flash_nsectors = regcnt; + +#if 1 + /* + * Hiss! Some AMD top-boot flash parts have broken CFI tables - they are backwards! + * Do some extra probing to find it. + */ + + if (cmdset == FLASH_CFI_CMDSET_AMD_STD) { + idx = FEOP_AMD_DEVCODE8; + if (softc->fd_probe.flash_flags & FLASH_FLG_DEV16) { + idx = (softc->fd_probe.flash_flags & FLASH_FLG_BUS16) ? + FEOP_AMD_DEVCODE16 : FEOP_AMD_DEVCODE16B; + } + + flash_op_begin(softc); + flash_op_add(softc,softc->fd_probe.flash_phys, + idx,(long)&insaner,0,0); + flash_op_execute(softc); +#ifdef _NEWFLASH_DEBUG_ + xprintf("Insaner = 0x%x\n", insaner); +#endif /* _NEWFLASH_DEBUG_ */ + if(((insaner & 0xFF) == 0xC4)||((insaner & 0xFF) == 0xF6)){ + insane = 1; +#ifdef _NEWFLASH_DEBUG_ + xprintf("Warning: insane AMD part, backwards CFI table!\n"); +#endif /* _NEWFLASH_DEBUG_ */ + } + } +#else + insane = insaner = 1; +#endif /* 0 */ + + + for (idx = 0; idx < regcnt; idx++) { + nblks = ((int)GETCFIBYTE(cfidata,FLASH_CFI_REGION_TABLE+0+idx*4) + + (int)(GETCFIBYTE(cfidata,FLASH_CFI_REGION_TABLE+1+idx*4)<<8)) + 1; + blksiz = ((int)GETCFIBYTE(cfidata,FLASH_CFI_REGION_TABLE+2+idx*4) + + (int)(GETCFIBYTE(cfidata,FLASH_CFI_REGION_TABLE+3+idx*4)<<8)) * 256; + + if (insane) { + /* Insane */ + softc->fd_probe.flash_sectors[((regcnt-1)-idx)] = + FLASH_SECTOR_RANGE(nblks,blksiz); + } + else { + /* Sane */ + softc->fd_probe.flash_sectors[idx] = + FLASH_SECTOR_RANGE(nblks,blksiz); + } + } + + /* + * Set the command set we're going to use. + */ + + flash_set_cmdset(softc,cmdset,bus16,dev16); + + return 0; + +} + + + +/* ********************************************************************* + * FLASH_DO_PROBE(softc) + * + * Probe to see if we're ROM or RAM. If ROM, see if we're flash. + * If flash, do CFI query. + * + * Input parameters: + * softc - our structure + * + * Return value: + * FLASH_TYPE_xxx + ********************************************************************* */ +static int flash_do_probe(flashdev_t *softc) +{ + uint8_t test_byte0,test_byte1; + uint8_t save0,save1; + volatile uint8_t *ptr; + + /* + * flash_do_probe is called before we open the device, so we + * need to allocate space for instructions so the flashop + * engine will work. + */ + + softc->fd_inst = KMALLOC(FLASH_MAX_INST*sizeof(flashinstr_t),0); + if (!softc->fd_inst) return FLASH_TYPE_ROM; + + /* + * Attempt to read/write byte zero. If it is changable, + * this is SRAM (or maybe a ROM emulator with the write line hooked up) + */ + + ptr = (volatile uint8_t *) UNCADDR(softc->fd_probe.flash_phys); + save0 = *ptr; /* save old value */ + save1 = *(ptr+1); /* save old value */ + + test_byte0 = (save0 != 0x88) ? 0x88 : 0x89; + test_byte1 = (save1 != 0x99) ? 0x99 : 0x91; + + *(ptr) = test_byte0; + *(ptr+1) = test_byte1; + + if ((*ptr == test_byte0) && (*(ptr+1) == test_byte1)) { + softc->fd_probe.flash_type = FLASH_TYPE_SRAM; + + /*Only write back saved values if it's RAM*/ + *(ptr) = save0; + *(ptr+1) = save1; + +#ifdef _NEWFLASH_DEBUG_ + xprintf("Flash type SRAM\n"); +#endif + + } + else { + softc->fd_probe.flash_type = FLASH_TYPE_ROM; + +#ifdef _NEWFLASH_DEBUG_ + xprintf("Flash type ROM\n"); +#endif + + } + + /* + * If we thought it was ROM, try doing a CFI query + * to see if it was flash. This check is kind of kludgey + * but should work. + */ + + if (softc->fd_probe.flash_type == FLASH_TYPE_ROM) { + flash_cfi_probe(softc); + } + + + KFREE(softc->fd_inst); + softc->fd_inst = NULL; + + return softc->fd_probe.flash_type; +} + +#endif /* (FLASH_DRIVERS & FLASH_DRIVER_CFI) */ + + +/* ********************************************************************* + * flash_do_parts(probe,parts) + * + * Partition the flash into the sizes specified. We use + * the sizes in the table to generate a table of {offset,size} + * pairs that eventually become partitions. + * + * The only thing magical about this is that size "0" means + * "fill to max" and that partitions beyond the "0" are aligned + * to the top of the flash. Therefore, if you had a 4MB + * flash and listed four partitions, 512K, 0, 512K, 512K, + * then there would be a 2.5M partition in the middle and two + * 512K partitions at the top. + * + * Input parameters: + * probe - flash probe data (user-supplied table) + * parts - our partition table (output) + * + * Return value: + * nothing + ********************************************************************* */ + +static void flash_do_parts(flashdev_t *softc) +{ + int idx; + int middlepart = -1; + int lobound = 0; + newflash_probe_t *probe = &(softc->fd_probe); + flashpart_t *parts = &(softc->fd_parts[0]); + int hibound = probe->flash_size*probe->flash_nchips; + + for (idx = 0; idx < probe->flash_nparts; idx++) { + if (probe->flash_parts[idx].fp_size == 0) { + middlepart = idx; + break; + } + parts[idx].fp_offset = lobound; + parts[idx].fp_size = probe->flash_parts[idx].fp_size; + lobound += probe->flash_parts[idx].fp_size; + } + + if (idx != probe->flash_nparts) { + for (idx = probe->flash_nparts - 1; idx > middlepart; + idx--) { + parts[idx].fp_size = probe->flash_parts[idx].fp_size; + hibound -= probe->flash_parts[idx].fp_size; + parts[idx].fp_offset = hibound; + } + } + + if (middlepart != -1) { + parts[middlepart].fp_offset = lobound; + parts[middlepart].fp_size = hibound - lobound; + } + +#ifdef _NEWFLASH_DEBUG_ + printf("Partition information:\n"); + for (idx = 0; idx < probe->flash_nparts;idx++) { + printf("#%02d %08X -> %08X (%d)\n",idx, + parts[idx].fp_offset,parts[idx].fp_offset+parts[idx].fp_size-1, + parts[idx].fp_size); + } +#endif +} + + +/* ********************************************************************* + * flashdrv_allocbuf(dev) + * + * Allocate sector buffer for flash programming. Use a global + * buffer for all devices. + * + * Input parameters: + * dev - our device + * + * Return value: + * nothing + ********************************************************************* */ +static void flashdrv_allocbuf(flashdev_t *softc) +{ + if (!flash_sector_buffer) { +#if CFG_FLASH_ALLOC_SECTOR_BUFFER + flash_sector_buffer = KMALLOC(CFG_FLASH_SECTOR_BUFFER_SIZE,0); + if (!flash_sector_buffer) { + printf("FLASH: Could not allocate sector buffer, using default\n"); + flash_sector_buffer = (uint8_t *) KERNADDR(CFG_FLASH_SECTOR_BUFFER_SIZE); + } +#else + flash_sector_buffer = (uint8_t *) KERNADDR(CFG_FLASH_SECTOR_BUFFER_ADDR); +#endif + } + + softc->fd_sectorbuffer = flash_sector_buffer; +} + +/* ********************************************************************* + * flashdrv_probe(drv,probe_a,probe_b,probe_ptr) + * + * Device probe routine. Attach the flash device to + * CFE's device table. + * + * Input parameters: + * drv - driver descriptor + * probe_a - physical address of flash + * probe_b - size of flash (bytes) + * probe_ptr - unused + * + * Return value: + * nothing + ********************************************************************* */ + +static void flashdrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + flashdev_t *softc; + newflash_probe_t *probe; + int idx; + char descr[80]; + static int flashidx = 0; + char *x; + + /* + * First thing to do is configure the flashop engine + * if not already done. Basically we copy a bit of + * position-independent code into the DRAM. + */ + + flash_setup_engine(); + + /* + * Now, on with the probing. + */ + + probe = (newflash_probe_t *) probe_ptr; + + /* + * probe_a is the flash base address + * probe_b is the size of the flash + * probe_ptr is unused. + */ + + softc = (flashdev_t *) KMALLOC(sizeof(flashdev_t),0); + if (softc) { + memset(softc,0,sizeof(flashdev_t)); + + flashdrv_allocbuf(softc); + + if (probe) { + /* + * Passed probe structure, do fancy stuff + */ + memcpy(&(softc->fd_probe),probe,sizeof(newflash_probe_t)); + if (softc->fd_probe.flash_nchips == 0) { + softc->fd_probe.flash_nchips = 1; + } + } + else { + /* Didn't pass probe structure, do the compatible thing */ + softc->fd_probe.flash_phys = probe_a; + softc->fd_probe.flash_size = (probe_b & FLASH_SIZE_MASK); + softc->fd_probe.flash_flags = (probe_b & FLASH_FLG_MASK); + softc->fd_probe.flash_nchips = 1; + } + + if (softc->fd_probe.flash_flags & FLASH_FLG_MANUAL) { + /* Manual probing, just set the command set. */ + flash_set_cmdset(softc,softc->fd_probe.flash_cmdset, + ((softc->fd_probe.flash_flags & FLASH_FLG_BUS16) ? 1 : 0), + ((softc->fd_probe.flash_flags & FLASH_FLG_DEV16) ? 1 : 0)); + } + else { + /* Do automatic probing */ +#if (FLASH_DRIVERS & FLASH_DRIVER_CFI) + flash_do_probe(softc); +#else + return; /* No automatic probing, bail! */ +#endif + } + + /* Remember total size of all devices */ + softc->fd_ttlsize = softc->fd_probe.flash_nchips * softc->fd_probe.flash_size; + + /* Set description */ + x = descr; + x += xsprintf(x,"%s at %08X size %uKB",drv->drv_description, + softc->fd_probe.flash_phys, + softc->fd_ttlsize/1024); + if (softc->fd_probe.flash_nchips > 1) { + xsprintf(x," (%d chips)",softc->fd_probe.flash_nchips); + } + + /* + * If flash is not partitioned, just instantiate one + * device. Otherwise, instantiate multiple flashes + * to cover the entire device. + */ + + if (softc->fd_probe.flash_nparts == 0) { + softc->fd_parts[0].fp_dev = softc; + softc->fd_parts[0].fp_offset = 0; + softc->fd_parts[0].fp_size = softc->fd_probe.flash_size; + cfe_attach(drv,&(softc->fd_parts[0]),NULL,descr); + } + else { + /* + * Partition flash into chunks + */ + flash_do_parts(softc); + + /* + * Instantiate devices for each piece + */ + + for (idx = 0; idx < softc->fd_probe.flash_nparts; idx++) { + char name[32]; + char *nptr; + + xsprintf(descr,"%s at %08X offset %08X size %uKB", + drv->drv_description, + softc->fd_probe.flash_phys, + softc->fd_parts[idx].fp_offset, + (softc->fd_parts[idx].fp_size+1023)/1024); + + softc->fd_parts[idx].fp_dev = softc; + if (softc->fd_probe.flash_parts[idx].fp_name == NULL) { + sprintf(name,"%d",idx); + nptr = name; + } + else { + nptr = softc->fd_probe.flash_parts[idx].fp_name; + } + cfe_attach_idx(drv, + flashidx, + &(softc->fd_parts[idx]), + nptr, + descr); + } + } + + flashidx++; + + /* Count total sectors on the device */ + + softc->fd_ttlsect = 0; + for (idx = 0; idx < softc->fd_probe.flash_nsectors; idx++) { + softc->fd_ttlsect += FLASH_SECTOR_NBLKS(softc->fd_probe.flash_sectors[idx]); + } + + } + +} + + +/* ********************************************************************* + * flashdrv_open(ctx) + * + * Called when the flash device is opened. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 if ok else error code + ********************************************************************* */ + +static int flashdrv_open(cfe_devctx_t *ctx) +{ + flashpart_t *part = ctx->dev_softc; + flashdev_t *softc = part->fp_dev; + int ttlsect = softc->fd_ttlsect; + + /* + * Calculate number of flashop instructions we'll need at most. + * This will be two for each sector plus two more for the first + * and last sectors, plus two extra + */ + + ttlsect = (ttlsect * 2 * softc->fd_probe.flash_nchips) + 6; + + /* + * Allocate memory for instructions. + */ + +#ifdef _NEWFLASH_DEBUG_ + printf("%s: allocating %d instructions\n",cfe_device_name(ctx),ttlsect); +#endif + + softc->fd_inst = KMALLOC(ttlsect*sizeof(flashinstr_t),0); + if (!softc->fd_inst) return CFE_ERR_NOMEM; + + return 0; +} + + +/* ********************************************************************* + * flashdrv_read(ctx,buffer) + * + * Read data from the flash device. The flash device is + * considered to be like a disk (you need to specify the offset). + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int flashdrv_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + flashpart_t *part = ctx->dev_softc; + flashdev_t *softc = part->fp_dev; + int blen; + int offset; + + blen = buffer->buf_length; + offset = (long)buffer->buf_offset; + + if ((offset + blen) > part->fp_size) { + blen = part->fp_size - offset; + } + + offset += part->fp_offset; + + if (blen > 0) { + flash_op_begin(softc); + flash_op_add(softc,softc->fd_probe.flash_phys, + softc->fd_readfunc,(long)buffer->buf_ptr,offset,blen); + flash_op_execute(softc); + } + + buffer->buf_retlen = blen; + + return 0; +} + +/* ********************************************************************* + * flashdrv_inpstat(ctx,inpstat) + * + * Return "input status". For flash devices, we always return true. + * + * Input parameters: + * ctx - device context + * inpstat - input status structure + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int flashdrv_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + inpstat->inp_status = 1; + return 0; +} + + +/* ********************************************************************* + * flashdrv_write(ctx,buffer) + * + * Write data to the flash device. The flash device is + * considered to be like a disk (you need to specify the offset). + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int flashdrv_write2(cfe_devctx_t *ctx,iocb_buffer_t *buffer,int reboot) +{ + flashpart_t *part = ctx->dev_softc; + flashdev_t *softc = part->fp_dev; + int blen; + int res; + int offset; + int whichchip; + long chipbase; + flash_range_t outrange; + flash_range_t inrange; + flash_sector_t sector; + + blen = buffer->buf_length; + offset = (long)buffer->buf_offset; + + /* Compute range within physical flash */ + + if ((offset + blen) > part->fp_size) { + blen = part->fp_size - offset; + } + + offset += part->fp_offset; + + /* Handle case of writing nothing */ + + if (blen == 0) { + buffer->buf_retlen = blen; + return (buffer->buf_length == blen) ? 0 : CFE_ERR_IOERR; + } + + /* now, offset/blen forms the range we want to write to. */ + + inrange.range_base = offset; + inrange.range_length = blen; + + sector.flash_sector_idx = 0; + + flash_op_begin(softc); + + for (;;) { + res = flash_sector_query(softc,§or); + if (res != 0) break; + if (sector.flash_sector_status == FLASH_SECTOR_INVALID) { + break; + } + + whichchip = sector.flash_sector_idx / softc->fd_ttlsect; + chipbase = softc->fd_probe.flash_phys + + (long) (whichchip * softc->fd_probe.flash_size); + + res = flash_range_intersection(§or,&inrange,&outrange); + + switch (res) { + case 1: /* Erease/program entire sector */ + flash_op_add(softc,chipbase, + softc->fd_erasefunc, + sector.flash_sector_offset, + 0,0); + flash_op_add(softc,chipbase, + softc->fd_pgmfunc, + outrange.range_base, + ((long)buffer->buf_ptr)+(outrange.range_base-inrange.range_base), + outrange.range_length); + break; + + case 0: /* Erase/reprogram partial sector */ + /* Save old sector */ + flash_op_add(softc,chipbase, + softc->fd_readfunc, + (long)(softc->fd_sectorbuffer), + sector.flash_sector_offset, + sector.flash_sector_size); + /* Copy in new stuff */ + flash_op_add(softc,chipbase, + FEOP_MEMCPY, + ((long)(softc->fd_sectorbuffer))+(outrange.range_base-sector.flash_sector_offset), + ((long)buffer->buf_ptr)+(outrange.range_base-inrange.range_base), + outrange.range_length); + /* Erase sector */ + flash_op_add(softc,chipbase, + softc->fd_erasefunc, + sector.flash_sector_offset, + 0,0); + /* Program sector */ + flash_op_add(softc,chipbase, + softc->fd_pgmfunc, + sector.flash_sector_offset, + (long)(softc->fd_sectorbuffer), + sector.flash_sector_size); + break; + + case -1: /* No intersection */ + break; + } + + sector.flash_sector_idx++; + + } + + if (reboot) { + flash_op_add(softc,softc->fd_probe.flash_phys,FEOP_REBOOT,0,0,0); + } + + res = flash_op_execute(softc); + + buffer->buf_retlen = blen; + + return (res == 0) ? 0 : CFE_ERR_IOERR; +} + +static int flashdrv_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + return flashdrv_write2(ctx,buffer,0); +} + + +/* ********************************************************************* + * flashdrv_ioctl(ctx,buffer) + * + * Handle special IOCTL functions for the flash. Flash devices + * support NVRAM information, sector and chip erase, and a + * special IOCTL for updating the running copy of CFE. + * + * Input parameters: + * ctx - device context + * buffer - descriptor for IOCTL parameters + * + * Return value: + * 0 if ok else error + ********************************************************************* */ +static int flashdrv_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + flashpart_t *part = ctx->dev_softc; + flashdev_t *softc = part->fp_dev; + nvram_info_t *nvinfo; + flash_info_t *info; + flash_range_t range; + int offset; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_NVRAM_GETINFO: + /* + * We only support NVRAM on flashes that have been partitioned + * into at least two partitions. Every partition supports + * being an NVRAM in that case, but we'll only attach one + * of them to the environment subsystem. + */ + if (softc->fd_probe.flash_nparts <= 1) { + return CFE_ERR_UNSUPPORTED; + } + nvinfo = (nvram_info_t *) buffer->buf_ptr; + if (buffer->buf_length != sizeof(nvram_info_t)) return CFE_ERR_INV_PARAM; + + nvinfo->nvram_offset = 0; + nvinfo->nvram_size = part->fp_size; + nvinfo->nvram_eraseflg = 1; + buffer->buf_retlen = sizeof(nvram_info_t); + return 0; + break; + + case IOCTL_FLASH_ERASE_SECTOR: + offset = (int) buffer->buf_offset; + offset += part->fp_offset; + if (offset >= softc->fd_probe.flash_size) return -1; + + flash_op_begin(softc); + flash_op_add(softc, + softc->fd_probe.flash_phys, + softc->fd_erasefunc, + offset, + 0,0); + flash_op_execute(softc); + return 0; + + case IOCTL_FLASH_ERASE_ALL: + offset = (int) buffer->buf_offset; + if (offset != 0) return -1; + flash_erase_all(softc); + return 0; + + case IOCTL_FLASH_WRITE_ALL: + /* Write file and reboot */ + flashdrv_write2(ctx,buffer,1); + return -1; /* should not return */ + + case IOCTL_FLASH_GETINFO: + info = (flash_info_t *) buffer->buf_ptr; + info->flash_base = softc->fd_probe.flash_phys; + info->flash_size = softc->fd_probe.flash_size; + info->flash_type = softc->fd_probe.flash_type; + info->flash_flags = FLASH_FLAG_NOERASE; + return 0; + + case IOCTL_FLASH_GETSECTORS: + return flash_sector_query(softc,(flash_sector_t *) buffer->buf_ptr); + + case IOCTL_FLASH_ERASE_RANGE: + memcpy(&range,buffer->buf_ptr,sizeof(flash_range_t)); + range.range_base += part->fp_offset; + if (range.range_length > part->fp_size) { + range.range_length = part->fp_size; + } + return flash_erase_range(softc,&range); + + default: + /* Call hook if present. */ + if (softc->fd_probe.flash_ioctl_hook) { + return (*(softc->fd_probe.flash_ioctl_hook))(ctx,buffer); + } + return -1; + } + + return -1; +} + + +/* ********************************************************************* + * flashdrv_close(ctx) + * + * Close the flash device. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 + ********************************************************************* */ +static int flashdrv_close(cfe_devctx_t *ctx) +{ + flashpart_t *part = ctx->dev_softc; + flashdev_t *softc = part->fp_dev; + + if (softc->fd_inst) { + KFREE(softc->fd_inst); + } + + softc->fd_inst = NULL; + + /* XXX Invalidate the cache ?!?! */ + + return 0; +} + + diff --git a/cfe/cfe/dev/dev_ns16550.c b/cfe/cfe/dev/dev_ns16550.c new file mode 100644 index 0000000..a70eecf --- /dev/null +++ b/cfe/cfe/dev/dev_ns16550.c @@ -0,0 +1,255 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * NS16550 UART driver File: dev_ns16550.c + * + * This is a console device driver for an NS16550 UART, either + * on-board or as a PCI-device. In the case of a PCI device, + * our probe routine is called from the PCI probe code + * over in dev_ns16550_pci.c + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" + +#include "lib_physio.h" + +#include "bsp_config.h" + +#include "ns16550.h" + +#define WRITECSR(p,v) phys_write8((p),(v)) +#define READCSR(p) phys_read8((p)) + +static int ns16550_uart_open(cfe_devctx_t *ctx); +static int ns16550_uart_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int ns16550_uart_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int ns16550_uart_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int ns16550_uart_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int ns16550_uart_close(cfe_devctx_t *ctx); + +void ns16550_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +const cfe_devdisp_t ns16550_uart_dispatch = { + ns16550_uart_open, + ns16550_uart_read, + ns16550_uart_inpstat, + ns16550_uart_write, + ns16550_uart_ioctl, + ns16550_uart_close, + NULL, + NULL +}; + +const cfe_driver_t ns16550_uart = { + "NS16550 UART", + "uart", + CFE_DEV_SERIAL, + &ns16550_uart_dispatch, + ns16550_uart_probe +}; + +typedef struct ns16550_uart_s { + physaddr_t uart_base; + int uart_flowcontrol; + int uart_speed; +} ns16550_uart_t; + + +/* + * NS16550-compatible UART. + * probe_a: physical address of UART + */ + +void ns16550_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + ns16550_uart_t *softc; + char descr[80]; + + softc = (ns16550_uart_t *) KMALLOC(sizeof(ns16550_uart_t),0); + if (softc) { + softc->uart_base = probe_a; + softc->uart_speed = CFG_SERIAL_BAUD_RATE; + softc->uart_flowcontrol = SERIAL_FLOW_NONE; + xsprintf(descr, "%s at 0x%X", drv->drv_description, (uint32_t)probe_a); + + cfe_attach(drv, softc, NULL, descr); + } +} + +#define DELAY(n) delay(n) +extern int32_t _getticks(void); +static void delay(int ticks) +{ + int32_t t; + + t = _getticks() + ticks; + while (_getticks() < t) + ; /* NULL LOOP */ +} + +static void ns16550_uart_setflow(ns16550_uart_t *softc) +{ + /* noop for now */ +} + + +static int ns16550_uart_open(cfe_devctx_t *ctx) +{ + ns16550_uart_t *softc = ctx->dev_softc; + int baudrate = CFG_SERIAL_BAUD_RATE; + unsigned int brtc; + + brtc = BRTC(baudrate); + + WRITECSR(softc->uart_base+R_UART_CFCR,CFCR_DLAB); + WRITECSR(softc->uart_base+R_UART_DATA,brtc & 0xFF); + WRITECSR(softc->uart_base+R_UART_IER,brtc>>8); + WRITECSR(softc->uart_base+R_UART_CFCR,CFCR_8BITS); + WRITECSR(softc->uart_base+R_UART_MCR,MCR_DTR | MCR_RTS | MCR_IENABLE); + WRITECSR(softc->uart_base+R_UART_IER,0); + + WRITECSR(softc->uart_base+R_UART_FIFO,FIFO_ENABLE); + DELAY(100); + WRITECSR(softc->uart_base+R_UART_FIFO, + FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1); + DELAY(100); + + if ((READCSR(softc->uart_base+R_UART_IIR) & IIR_FIFO_MASK) != IIR_FIFO_MASK) { + WRITECSR(softc->uart_base+R_UART_FIFO,0); + } + ns16550_uart_setflow(softc); + + return 0; +} + +static int ns16550_uart_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + ns16550_uart_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + while ((blen > 0) && (READCSR(softc->uart_base+R_UART_LSR) & LSR_RXRDY)) { + *bptr++ = (READCSR(softc->uart_base+R_UART_DATA) & 0xFF); + blen--; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + +static int ns16550_uart_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + ns16550_uart_t *softc = ctx->dev_softc; + + inpstat->inp_status = (READCSR(softc->uart_base+R_UART_LSR) & LSR_RXRDY) ? 1 : 0; + + return 0; +} + +static int ns16550_uart_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + ns16550_uart_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + while ((blen > 0) && (READCSR(softc->uart_base+R_UART_LSR) & LSR_TXRDY)) { + WRITECSR(softc->uart_base+R_UART_DATA, *bptr++); + blen--; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + +static int ns16550_uart_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + ns16550_uart_t *softc = ctx->dev_softc; + + unsigned int *info = (unsigned int *) buffer->buf_ptr; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_SERIAL_GETSPEED: + *info = softc->uart_speed; + break; + case IOCTL_SERIAL_SETSPEED: + softc->uart_speed = *info; + /* NYI */ + break; + case IOCTL_SERIAL_GETFLOW: + *info = softc->uart_flowcontrol; + break; + case IOCTL_SERIAL_SETFLOW: + softc->uart_flowcontrol = *info; + ns16550_uart_setflow(softc); + break; + default: + return -1; + } + + return 0; +} + +static int ns16550_uart_close(cfe_devctx_t *ctx) +{ + ns16550_uart_t *softc = ctx->dev_softc; + + WRITECSR(softc->uart_base+R_UART_MCR,0); + + return 0; +} + + diff --git a/cfe/cfe/dev/dev_ns16550_pci.c b/cfe/cfe/dev/dev_ns16550_pci.c new file mode 100644 index 0000000..021f34c --- /dev/null +++ b/cfe/cfe/dev/dev_ns16550_pci.c @@ -0,0 +1,114 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * NS16550 UART driver (PCI) File: dev_ns16550_pci.c + * + * This is a console device driver for a PCI NS16550 UART + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" + +#include "pcivar.h" +#include "pcireg.h" + + +/* Probe routine for real UART driver */ +extern void ns16550_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +/* Probe routine for this UART driver. */ +static void ns16550pci_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +/* We just glom onto the dispatch table in the real driver */ +extern const cfe_devdisp_t ns16550_uart_dispatch; + +const cfe_driver_t ns16550pci_uart = { + "PCI NS16550 UART", + "uart", + CFE_DEV_SERIAL, + &ns16550_uart_dispatch, + ns16550pci_uart_probe +}; + + +static void ns16550pci_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + phys_addr_t pa; + pcitag_t tag; + int index = 0; + + /* + * NS16550-compatible UART on the PCI bus + * probe_a, probe_b and probe_ptr are unused. + */ + + /* + * This is for a SIIG card. Should probably do a little + * vendor ID table like we did for the IDE driver so + * we can spport other cards. + */ + + for (;;) { + + if (pci_find_device(0x131f,0x2000,index,&tag) != 0) { + break; + } + + pci_map_io(tag, PCI_MAPREG(0), PCI_MATCH_BYTES, &pa); + xprintf("NS16550PCI: I/O mapped registers start at %08X", (uint32_t)pa); + + ns16550_uart_probe(drv,pa,0,NULL); + + index++; + } +} + diff --git a/cfe/cfe/dev/dev_null.c b/cfe/cfe/dev/dev_null.c new file mode 100644 index 0000000..d995919 --- /dev/null +++ b/cfe/cfe/dev/dev_null.c @@ -0,0 +1,142 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Null console device File: dev_null.c + * + * This is a null console device, useful for console-less + * operation, or when using chip simulators. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" + +static void nulldrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +static int nulldrv_open(cfe_devctx_t *ctx); +static int nulldrv_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int nulldrv_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int nulldrv_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int nulldrv_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int nulldrv_close(cfe_devctx_t *ctx); + +const static cfe_devdisp_t nulldrv_dispatch = { + nulldrv_open, + nulldrv_read, + nulldrv_inpstat, + nulldrv_write, + nulldrv_ioctl, + nulldrv_close, + NULL, + NULL +}; + +const cfe_driver_t nulldrv = { + "Null console device", + "null", + CFE_DEV_SERIAL, + &nulldrv_dispatch, + nulldrv_probe +}; + + +static void nulldrv_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + cfe_attach(drv,NULL,NULL,drv->drv_description); +} + + +static int nulldrv_open(cfe_devctx_t *ctx) +{ +/* nulldrv_t *softc = ctx->dev_softc; */ + + return 0; +} + +static int nulldrv_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ +/* nulldrv_t *softc = ctx->dev_softc; */ + + buffer->buf_retlen = buffer->buf_length; + return 0; +} + +static int nulldrv_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ +/* nulldrv_t *softc = ctx->dev_softc; */ + + inpstat->inp_status = 0; + + return 0; +} + +static int nulldrv_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ +/* nulldrv_t *softc = ctx->dev_softc; */ + + buffer->buf_retlen = buffer->buf_length; + return 0; +} + +static int nulldrv_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ +/* nulldrv_t *softc = ctx->dev_softc;*/ + + return -1; +} + +static int nulldrv_close(cfe_devctx_t *ctx) +{ +/* nulldrv_t *softc = ctx->dev_softc; */ + + return 0; +} + + diff --git a/cfe/cfe/dev/dev_promice.c b/cfe/cfe/dev/dev_promice.c new file mode 100644 index 0000000..fe79086 --- /dev/null +++ b/cfe/cfe/dev/dev_promice.c @@ -0,0 +1,402 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PromICE console device File: dev_promice.c + * + * This device driver supports Grammar Engine's PromICE AI2 + * serial communications options. With this console, you can + * communicate with the firmware using only uncached reads in the + * boot ROM space. See Grammar Engine's PromICE manuals + * for more information at http://www.gei.com + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* + * Example PromICE initialization file: + * + * ----------------------- + * output=com1 + * pponly=lpt1 + * rom=27040 + * word=8 + * file=cfe.srec + * ailoc 7FC00,9600 + * ----------------------- + * + * The offset specified in the 'ailoc' line must be the location where you + * will configure the AI2 serial port. In this example, the ROM is assumed + * to be 512KB, and the AI2 serial port is at 511KB, or offset 0x7FC00. + * This area is filled with 0xCC to detect AI2's initialization sequence + * properly (see the PromICE manual). You should connect your + * PromICE's serial port up to the PC and run a terminal emulator on it. + * The parallel port will be used for downloading data to the PromICE. + * + * If you have connected the write line to the PromICE, then you can + * define the _AIDIRT_ symbol to increase performance. + */ + + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "addrspace.h" + +#define _AIDIRT_ + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +static void promice_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +static int promice_open(cfe_devctx_t *ctx); +static int promice_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int promice_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int promice_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int promice_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int promice_close(cfe_devctx_t *ctx); + +/* ********************************************************************* + * Device dispatch table + ********************************************************************* */ + +const static cfe_devdisp_t promice_dispatch = { + promice_open, + promice_read, + promice_inpstat, + promice_write, + promice_ioctl, + promice_close, + NULL, + NULL +}; + +/* ********************************************************************* + * Device descriptor + ********************************************************************* */ + +const cfe_driver_t promice_uart = { + "PromICE AI2 Serial Port", + "promice", + CFE_DEV_SERIAL, + &promice_dispatch, + promice_probe +}; + +/* ********************************************************************* + * Local constants and structures + ********************************************************************* */ + +/* + * If your PromICE is connected to a 32-bit host (emulating four + * flash ROMs) and the SB1250 is set to boot from that host, define + * the PROMICE_32BITS symbol to make sure the AI2 interface is + * configured correctly. + */ + +/*#define PROMICE_32BITS*/ + +#ifdef PROMICE_32BITS +#define WORDSIZE 4 +#define WORDTYPE uint32_t +#else +#define WORDSIZE 1 +#define WORDTYPE uint8_t +#endif + + +#define ZERO_OFFSET (0) +#define ONE_OFFSET (1) +#define DATA_OFFSET (2) +#define STATUS_OFFSET (3) + +#define TDA 0x01 /* Target data available */ +#define HDA 0x02 /* Host data available */ +#define OVR 0x04 /* Host data overflow */ + +typedef struct promice_s { + unsigned long ai2_addr; + unsigned int ai2_wordsize; + volatile WORDTYPE *zero; + volatile WORDTYPE *one; + volatile WORDTYPE *data; + volatile WORDTYPE *status; +} promice_t; + + +/* ********************************************************************* + * promice_probe(drv,probe_a,probe_b,probe_ptr) + * + * Device "Probe" routine. This routine creates the soft + * context for the device and calls the attach routine. + * + * Input parameters: + * drv - driver structure + * probe_a,probe_b,probe_ptr - probe args + * + * Return value: + * nothing + ********************************************************************* */ + + +static void promice_probe(cfe_driver_t *drv, + unsigned long probe_a, + unsigned long probe_b, + void *probe_ptr) +{ + promice_t *softc; + char descr[80]; + + /* + * probe_a is the address in the ROM of the AI2 interface + * on the PromICE. + * probe_b is the word size (1,2,4) + */ + + softc = (promice_t *) KMALLOC(sizeof(promice_t),0); + if (softc) { + softc->ai2_addr = probe_a; + if (probe_b) softc->ai2_wordsize = probe_b; + else softc->ai2_wordsize = WORDSIZE; + xsprintf(descr,"%s at 0x%X",drv->drv_description,probe_a); + cfe_attach(drv,softc,NULL,descr); + } +} + + + +/* ********************************************************************* + * promice_open(ctx) + * + * Open the device + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ +static int promice_open(cfe_devctx_t *ctx) +{ + promice_t *softc = ctx->dev_softc; + uint8_t dummy; + + softc->zero = (volatile WORDTYPE *) + UNCADDR(softc->ai2_addr + (ZERO_OFFSET*softc->ai2_wordsize)); + softc->one = (volatile WORDTYPE *) + UNCADDR(softc->ai2_addr + (ONE_OFFSET*softc->ai2_wordsize)); + softc->data = (volatile WORDTYPE *) + UNCADDR(softc->ai2_addr + (DATA_OFFSET*softc->ai2_wordsize)); + softc->status = (volatile WORDTYPE *) + UNCADDR(softc->ai2_addr + (STATUS_OFFSET*softc->ai2_wordsize)); + + /* + * Wait for bit 3 to clear so we know the interface is ready. + */ + + while (*(softc->status) == 0xCC) ; /* NULL LOOP */ + + /* + * a dummy read is required to clear out the interface. + */ + + dummy = *(softc->data); + + return 0; +} + +/* ********************************************************************* + * promice_read(ctx,buffer) + * + * Read data from the device + * + * Input parameters: + * ctx - device context + * buffer - I/O buffer descriptor + * + * Return value: + * number of bytes transferred, or <0 if error + ********************************************************************* */ +static int promice_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + promice_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + while ((blen > 0) && (*(softc->status) & HDA)) { + *bptr++ = *(softc->data); + blen--; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + +/* ********************************************************************* + * promice_inpstat(ctx,inpstat) + * + * Determine if read data is available + * + * Input parameters: + * ctx - device context + * inpstat - input status structure + * + * Return value: + * 0 + ********************************************************************* */ + +static int promice_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + promice_t *softc = ctx->dev_softc; + + inpstat->inp_status = (*(softc->status) & HDA) ? 1 : 0; + + return 0; +} + +/* ********************************************************************* + * promice_write(ctx,buffer) + * + * Write data to the device + * + * Input parameters: + * ctx - device context + * buffer - I/O buffer descriptor + * + * Return value: + * number of bytes transferred, or <0 if error + ********************************************************************* */ +static int promice_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + promice_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + uint8_t data; +#ifndef _AIDIRT_ + uint8_t dummy; + int count; +#endif + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + + /* + * The AI2 interface requires you to transmit characters + * one bit at a time. First a '1' start bit, + * then 8 data bits (lsb first) then another '1' stop bit. + * + * Just reference the right memory location to transmit a bit. + */ + + while ((blen > 0) && !(*(softc->status) & TDA)) { + +#ifdef _AIDIRT_ + data = *bptr++; + *(softc->zero) = data; +#else + dummy = *(softc->one); /* send start bit */ + + data = *bptr++; + + for (count = 0; count < 8; count++) { + if (data & 1) dummy = *(softc->one); + else dummy = *(softc->zero); + data >>= 1; /* shift in next bit */ + } + + dummy = *(softc->one); /* send stop bit */ +#endif + + blen--; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + +/* ********************************************************************* + * promice_ioctl(ctx,buffer) + * + * Do I/O control operations + * + * Input parameters: + * ctx - device context + * buffer - I/O control args + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int promice_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + return -1; +} + +/* ********************************************************************* + * promice_close(ctx) + * + * Close the device. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 + ********************************************************************* */ + +static int promice_close(cfe_devctx_t *ctx) +{ + return 0; +} + + diff --git a/cfe/cfe/dev/dev_sp1011.c b/cfe/cfe/dev/dev_sp1011.c new file mode 100644 index 0000000..8e0d16b --- /dev/null +++ b/cfe/cfe/dev/dev_sp1011.c @@ -0,0 +1,151 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * SP1011 (Sturgeon) Support File: dev_sp1011.c + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" + +#include "pcireg.h" +#include "pcivar.h" + +extern int eoi_implemented; + +void sturgeon_setup (pcitag_t tag, pci_flags_t flags); + + +/* Sturgeon LDT-to-PCI bridge (LPB) specific definitions. */ + +#define PCI_VENDOR_API 0x14d9 +#define PCI_PRODUCT_API_STURGEON 0x0010 + +/* Sturgeon specific registers */ +#define LPB_READ_CTRL_REG 0x60 +#define LPB_READ_CTRL_MASK 0xffffff + +#define LPB_READ_CTRL_PREF_EN (1 << 0) +#define LPB_READ_CTRL_RD_PREF_EN (1 << 1) +#define LPB_READ_CTRL_MULT_PREF_SHIFT 2 +#define LPB_READ_CTRL_MULT_PREF_MASK (7 << LPB_READ_CTRL_MULT_PREF_SHIFT) +#define LPB_READ_CTRL_LINE_PREF_SHIFT 5 +#define LPB_READ_CTRL_LINE_PREF_MASK (7 << LPB_READ_CTRL_LINE_PREF_SHIFT) +#define LPB_READ_CTRL_DEL_REQ_SHIFT 8 +#define LPB_READ_CTRL_DEL_REQ_MASK (3 << LPB_READ_CTRL_DEL_REQ_SHIFT) + +#define LPB_INT_CTRL_BASE 0xa0 + +#define LPB_INT_CTRL_ENABLE (1 << 15) +#define LPB_INT_CTRL_DESTMODE (1 << 14) +#define LPB_INT_CTRL_DEST_SHIFT 6 +#define LPB_INT_CTRL_DEST_MASK (0xff << LPB_INT_CTRL_DEST_SHIFT) +#define LPB_INT_CTRL_MSGTYPE_SHIFT 4 +#define LPB_INT_CTRL_MSGTYPE_MASK (0x3 << LPB_INT_CTRL_MSGTYPE_SHIFT) +#define LPB_INT_CTRL_POLARITY (1 << 3) +#define LPB_INT_CTRL_TRIGGERMODE (1 << 2) +#define LPB_INT_CTRL_VECTOR_SHIFT 0 +#define LPB_INT_CTRL_VECTOR_MASK (0x3 << 0) + +#define LPB_INT_BLOCK1_REG 0xc4 + +void +sturgeon_setup (pcitag_t tag, pci_flags_t flags) +{ + int bus, device, function; + int secondary; + struct pci_bus *pb; + unsigned offset; + pcireg_t t, ctrl, intmap; + + pci_break_tag(tag, &bus, &device, &function); + + secondary = (pci_conf_read(tag, PPB_BUSINFO_REG) >> 8) & 0xff; + pb = &_pci_bus[secondary]; + + /* set up READ CONTROL register for selected prefetch option */ + ctrl = pci_conf_read(tag, LPB_READ_CTRL_REG) & ~LPB_READ_CTRL_MASK; + if ((flags & PCI_FLG_LDT_PREFETCH) != 0) { + /* Prefetch enable: all cycle types, 2 delayed requests, + 4 lines of fetch ahead for MemRdMult */ + ctrl |= (LPB_READ_CTRL_PREF_EN + | LPB_READ_CTRL_RD_PREF_EN + | (3 << LPB_READ_CTRL_MULT_PREF_SHIFT) + | (1 << LPB_READ_CTRL_DEL_REQ_SHIFT)); + } else { + /* No prefetch */ + ctrl |= 0; + } + pci_conf_write(tag, LPB_READ_CTRL_REG, ctrl); + + /* It's apparently not possible for software to distinguish + the CSWARM's debug Sturgeon (which has floating interrupt + inputs), so we route interrupts only if there are secondary + devices. */ + if (pb->ndev > 0) { + /* Setup interrupt mapping for Block 1: + Enabled, Dest=Logical (CPU 0 + CPU 1), Type=Fixed */ + intmap = (LPB_INT_CTRL_ENABLE | + LPB_INT_CTRL_DESTMODE | /* Logical */ + (0x3 << LPB_INT_CTRL_DEST_SHIFT) | /* CPU 0+1 */ + (0x0 << LPB_INT_CTRL_MSGTYPE_SHIFT)); /* Fixed */ + if (eoi_implemented) { + /* Passes >=2 have working EOI. Trigger=Level */ + intmap |= LPB_INT_CTRL_TRIGGERMODE; /* Level */ + } else { + /* Pass 1 lacks working EOI. Trigger=Edge */ + intmap |= 0; /* Edge */ + } + + offset = pb->inta_shift % 4; + t = (intmap + offset); + offset = (offset+1) % 4; + t |= (intmap + offset) << 16; + pci_conf_write(tag, LPB_INT_CTRL_BASE + 8, t); + + offset = (offset+1) % 4; + t = (intmap + offset); + offset = (offset+1) % 4; + t |= (intmap + offset) << 16; + pci_conf_write(tag, LPB_INT_CTRL_BASE + 12, t); + + t = pci_conf_read(tag, LPB_INT_BLOCK1_REG); + t &= 0xffffff00; + t |= (0x40 | (56 >> 2)); + pci_conf_write(tag, LPB_INT_BLOCK1_REG, t); + } +} diff --git a/cfe/cfe/dev/dev_tulip.c b/cfe/cfe/dev/dev_tulip.c new file mode 100644 index 0000000..dec6b56 --- /dev/null +++ b/cfe/cfe/dev/dev_tulip.c @@ -0,0 +1,2985 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * DC21x4x Ethernet Driver File: dev_tulip.c + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "sbmips.h" + +#ifndef _SB_MAKE64 +#define _SB_MAKE64(x) ((uint64_t)(x)) +#endif +#ifndef _SB_MAKEMASK1 +#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n)) +#endif + +#include "lib_types.h" +#include "lib_hssubr.h" +#include "lib_malloc.h" +#include "lib_string.h" +#define blockcopy memcpy +#include "lib_printf.h" +#include "lib_queue.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_error.h" +#include "cfe_irq.h" + +#include "pcivar.h" +#include "pcireg.h" + +#include "dc21143.h" +#include "mii.h" + +/* This is a driver for specific configurations of the DC21040, DC21041, + DC21140A and DC21143, not a generic Tulip driver. The prefix + "tulip_" is used to indicate generic Tulip functions, while + "dc21040_", "dc21041_", "dc21140_" or "dc21143_" indicates functions + specific to a chip variant. + + The 21041 driver assumes a 10BT HD interface, since autonegotiation + is known to be broken in the early revisons of that chip. Example + cards come from DEC and SMC. Essentially the same driver is used + for 21040 cards. + + The 21140 driver assumes that the PHY uses a standard MII interface + for both 100BT and 10BT. Example cards come from DEC (National DP83840 + plus Twister PHY) and Netgear (Level One PHY). + + Some early 21140 boards are exceptions and use SYM plus SRL + with different PHY chips for 10 and 100 (limited support). + + The 21143 driver assumes by default that the PHY uses the SYM ("5 + wire") interface for 100BT with pass-through for 10BT. Example + cards come from DEC (MicroLinear ML6694 PHY) and Znyx (QS6611 or + Kendin KS8761 PHY). It also supports an MII interface for + recognized adapters. An example card comes from Adaptec (National + DP83840A and Twister PHY). There is no support for AUI interfaces. + + This SB1250 version takes advantage of DMA coherence and uses + "preserve bit lanes" addresses for all accesses that cross the + ZBbus-PCI bridge. */ + +#ifndef TULIP_DEBUG +#define TULIP_DEBUG 0 +#endif + +#ifndef TULIP_TUNE +#define TULIP_TUNE 1 +#endif + +/* Set IPOLL to drive processing through the pseudo-interrupt + dispatcher. Set XPOLL to drive processing by an external polling + agent. Setting both is ok. */ + +#ifndef IPOLL +#define IPOLL 0 +#endif +#ifndef XPOLL +#define XPOLL 1 +#endif + +#define ENET_ADDR_LEN 6 /* size of an ethernet address */ +#define MAX_ETHER_PACK 1518 /* max size of a packet */ +#define CRC_SIZE 4 /* size of CRC field */ + +/* Packet buffers. For tulip, the packet must be aligned to a 32-bit + word boundary, and we would like it aligned to a cache line + boundary for performance. */ + +#define CACHE_ALIGN 32 + +#if __long64 +typedef struct eth_pkt_s { + queue_t next; /* 16 */ + uint8_t *buffer; /* 8 */ + uint32_t flags; /* 4 */ + int32_t length; /* 4 */ + uint8_t data[MAX_ETHER_PACK]; +} eth_pkt_t; +#else +typedef struct eth_pkt_s { + queue_t next; /* 8 */ + uint8_t *buffer; /* 4 */ + uint32_t flags; /* 4 */ + int32_t length; /* 4 */ + uint32_t unused[3]; /* 12 */ + uint8_t data[MAX_ETHER_PACK]; +} eth_pkt_t; +#endif + +#define ETH_PKTBUF_LINES ((sizeof(eth_pkt_t) + (CACHE_ALIGN-1))/CACHE_ALIGN) +#define ETH_PKTBUF_SIZE (ETH_PKTBUF_LINES*CACHE_ALIGN) +#define ETH_PKTBUF_OFFSET (offsetof(eth_pkt_t, data)) + +#define ETH_PKT_BASE(data) ((eth_pkt_t *)((data) - ETH_PKTBUF_OFFSET)) + +/* packet flags */ +#define ETH_TX_SETUP 1 /* assumes Perfect Filtering format */ + +static void +show_packet(char c, eth_pkt_t *pkt) +{ + int i; + int n = (pkt->length < 32 ? pkt->length : 32); + + xprintf("%c[%4d]:", c, pkt->length); + for (i = 0; i < n; i++) { + if (i % 4 == 0) + xprintf(" "); + xprintf("%02x", pkt->buffer[i]); + } + xprintf("\n"); +} + + +/* Descriptor structures */ + +typedef struct rx_dscr { + uint32_t rxd_flags; + uint32_t rxd_bufsize; + pci_addr_t rxd_bufaddr1; + pci_addr_t rxd_bufaddr2; +} rx_dscr; + +typedef struct tx_dscr { + uint32_t txd_flags; + uint32_t txd_bufsize; + pci_addr_t txd_bufaddr1; + pci_addr_t txd_bufaddr2; +} tx_dscr; + +/* CAM structure */ + +typedef union { + struct { + uint32_t physical[CAM_PERFECT_ENTRIES][3]; + } p; + struct { + uint32_t hash[32]; + uint32_t mbz[7]; + uint32_t physical[3]; + } h; +} tulip_cam; + + +/* Driver data structures */ + +typedef enum { + eth_state_uninit, + eth_state_setup, + eth_state_off, + eth_state_on, + eth_state_broken +} eth_state_t; + +#define ETH_PKTPOOL_SIZE 32 +#define ETH_PKT_SIZE MAX_ETHER_PACK + +typedef struct tulip_softc { + uint32_t membase; + uint8_t irq; /* interrupt mapping (used if IPOLL) */ + pcitag_t tag; /* tag for configuration registers */ + + uint8_t hwaddr[ENET_ADDR_LEN]; + uint16_t device; /* chip device code */ + uint8_t revision; /* chip revision and step (Table 3-7) */ + + /* current state */ + eth_state_t state; + + /* These fields are the chip startup values. */ +// uint16_t media; /* media type */ + uint32_t opmode; /* operating mode */ + uint32_t intmask; /* interrupt mask */ + uint32_t gpdata; /* output bits for csr15 (21143) */ + + /* These fields are set before calling dc21x4x_hwinit */ + int linkspeed; /* encodings from cfe_ioctl */ + int loopback; + + /* Packet free list */ + queue_t freelist; + uint8_t *pktpool; + queue_t rxqueue; + + /* The descriptor tables */ + uint8_t *rxdscrmem; /* receive descriptors */ + uint8_t *txdscrmem; /* transmit descriptors */ + + /* These fields keep track of where we are in tx/rx processing */ + volatile rx_dscr *rxdscr_start; /* beginning of ring */ + volatile rx_dscr *rxdscr_end; /* end of ring */ + volatile rx_dscr *rxdscr_remove; /* next one we expect tulip to use */ + volatile rx_dscr *rxdscr_add; /* next place to put a buffer */ + int rxdscr_onring; + + volatile tx_dscr *txdscr_start; /* beginning of ring */ + volatile tx_dscr *txdscr_end; /* end of ring */ + volatile tx_dscr *txdscr_remove; /* next one we will use for tx */ + volatile tx_dscr *txdscr_add; /* next place to put a buffer */ + + cfe_devctx_t *devctx; + + /* These fields describe the PHY */ + enum {SRL, MII, SYM} phy_type; + int mii_addr; + + /* Statistics */ + uint32_t inpkts; + uint32_t outpkts; + uint32_t interrupts; + uint32_t rx_interrupts; + uint32_t tx_interrupts; + uint32_t bus_errors; +} tulip_softc; + + +/* Entry to and exit from critical sections (currently relative to + interrupts only, not SMP) */ + +#if CFG_INTERRUPTS +#define CS_ENTER(sc) cfe_disable_irq(sc->irq) +#define CS_EXIT(sc) cfe_enable_irq(sc->irq) +#else +#define CS_ENTER(sc) ((void)0) +#define CS_EXIT(sc) ((void)0) +#endif + + +/* Driver parameterization */ + +#define MAXRXDSCR 32 +#define MAXTXDSCR 32 +#define MINRXRING 8 + +#define MEDIA_UNKNOWN 0 +#define MEDIA_AUI 1 +#define MEDIA_BNC 2 +#define MEDIA_UTP_FULL_DUPLEX 3 +#define MEDIA_UTP_NO_LINK_TEST 4 +#define MEDIA_UTP 5 + +/* Prototypes */ + +static void tulip_ether_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +/* Address mapping macros */ + +/* Note that PTR_TO_PHYS only works with 32-bit addresses, but then + so does the Tulip. */ +#define PTR_TO_PHYS(x) (K0_TO_PHYS((uintptr_t)(x))) +#define PHYS_TO_PTR(a) ((uint8_t *)PHYS_TO_K0(a)) + +/* All mappings through the PCI host bridge use match bits mode. */ +#define PHYS_TO_PCI(a) ((uint32_t) (a) | 0x20000000) +#define PCI_TO_PHYS(a) ((uint32_t) (a) & 0x1FFFFFFF) + +#define PCI_TO_PTR(a) (PHYS_TO_PTR(PCI_TO_PHYS(a))) +#define PTR_TO_PCI(x) (PHYS_TO_PCI(PTR_TO_PHYS(x))) + +#if __long64 +#define READCSR(sc,csr) \ + (*((volatile uint32_t *) (PHYS_TO_XKSEG_UNCACHED((sc)->membase + (csr))))) + +#define WRITECSR(sc,csr,val) \ + (*((volatile uint32_t *) \ + (PHYS_TO_XKSEG_UNCACHED((sc)->membase + (csr)))) = (val)) + +#else +#define READCSR(sc,csr) \ + (hs_read32(PHYS_TO_XKSEG_UNCACHED((sc)->membase + (csr)))) + +#define WRITECSR(sc,csr,val) \ + (hs_write32(PHYS_TO_XKSEG_UNCACHED((sc)->membase + (csr)), (val))) + +#endif + +#define RESET_ADAPTER(sc) \ + { \ + WRITECSR((sc), R_CSR_BUSMODE, M_CSR0_SWRESET); \ + cfe_sleep(CFE_HZ/10); \ + } + + +/* Debugging */ + +static void +dumpstat(tulip_softc *sc) +{ + xprintf("-- CSR 5 = %08X CSR 6 = %08x\n", + READCSR(sc, R_CSR_STATUS), READCSR(sc, R_CSR_OPMODE)); +} + +static void +dumpcsrs(tulip_softc *sc) +{ + int idx; + + xprintf("-------------\n"); + for (idx = 0; idx < 16; idx++) { + xprintf("CSR %2d = %08X\n", idx, READCSR(sc, idx*8)); + } + xprintf("-------------\n"); +} + + +/* Packet management */ + +/* ********************************************************************* + * ETH_ALLOC_PKT(sc) + * + * Allocate a packet from the free list. + * + * Input parameters: + * sc - eth structure + * + * Return value: + * pointer to packet structure, or NULL if none available + ********************************************************************* */ +static eth_pkt_t * +eth_alloc_pkt(tulip_softc *sc) +{ + eth_pkt_t *pkt; + + CS_ENTER(sc); + pkt = (eth_pkt_t *) q_deqnext(&sc->freelist); + CS_EXIT(sc); + if (!pkt) return NULL; + + pkt->buffer = pkt->data; + pkt->length = ETH_PKT_SIZE; + pkt->flags = 0; + + return pkt; +} + + +/* ********************************************************************* + * ETH_FREE_PKT(sc,pkt) + * + * Return a packet to the free list + * + * Input parameters: + * sc - sbmac structure + * pkt - packet to return + * + * Return value: + * nothing + ********************************************************************* */ +static void +eth_free_pkt(tulip_softc *sc, eth_pkt_t *pkt) +{ + CS_ENTER(sc); + q_enqueue(&sc->freelist, &pkt->next); + CS_EXIT(sc); +} + + +/* ********************************************************************* + * ETH_INITFREELIST(sc) + * + * Initialize the buffer free list for this mac. The memory + * allocated to the free list is carved up and placed on a linked + * list of buffers for use by the mac. + * + * Input parameters: + * sc - eth structure + * + * Return value: + * nothing + ********************************************************************* */ +static void +eth_initfreelist(tulip_softc *sc) +{ + int idx; + uint8_t *ptr; + eth_pkt_t *pkt; + + q_init(&sc->freelist); + + ptr = sc->pktpool; + for (idx = 0; idx < ETH_PKTPOOL_SIZE; idx++) { + pkt = (eth_pkt_t *) ptr; + eth_free_pkt(sc, pkt); + ptr += ETH_PKTBUF_SIZE; + } +} + + +/* Utilities */ + +static const char * +tulip_devname(tulip_softc *sc) +{ + return (sc->devctx != NULL ? cfe_device_name(sc->devctx) : "eth?"); +} + + +/* Descriptor ring management */ + +static int +tulip_add_rcvbuf(tulip_softc *sc, eth_pkt_t *pkt) +{ + volatile rx_dscr *rxd; + volatile rx_dscr *nextrxd; + uint32_t flags = 0; + + rxd = sc->rxdscr_add; + + /* Figure out where the next descriptor will go */ + nextrxd = rxd+1; + if (nextrxd == sc->rxdscr_end) { + nextrxd = sc->rxdscr_start; + flags = M_RDES1_ENDOFRING; + } + + /* + * If the next one is the same as our remove pointer, + * the ring is considered full. (it actually has room for + * one more, but we reserve the remove == add case for "empty") + */ + if (nextrxd == sc->rxdscr_remove) return -1; + + rxd->rxd_bufsize = V_RDES1_BUF1SIZE(1520) | flags; + rxd->rxd_bufaddr1 = PTR_TO_PCI(pkt->buffer); + rxd->rxd_bufaddr2 = 0; + rxd->rxd_flags = M_RDES0_OWNADAP; + + /* success, advance the pointer */ + sc->rxdscr_add = nextrxd; + CS_ENTER(sc); + sc->rxdscr_onring++; + CS_EXIT(sc); + + return 0; +} + +static void +tulip_fillrxring(tulip_softc *sc) +{ + eth_pkt_t *pkt; + + while (1) { + CS_ENTER(sc); + if (sc->rxdscr_onring >= MINRXRING) { + CS_EXIT(sc); + break; + } + CS_EXIT(sc); + pkt = eth_alloc_pkt(sc); + if (pkt == NULL) { + /* could not allocate a buffer */ + break; + } + if (tulip_add_rcvbuf(sc, pkt) != 0) { + /* could not add buffer to ring */ + eth_free_pkt(sc, pkt); + break; + } + } +} + + +/* ********************************************************************* + * TULIP_RX_CALLBACK(sc, pkt) + * + * Receive callback routine. This routine is invoked when a + * buffer queued for receives is filled. In this simple driver, + * all we do is add the packet to a per-MAC queue for later + * processing, and try to put a new packet in the place of the one + * that was removed from the queue. + * + * Input parameters: + * sc - interface + * ptk - packet context (eth_pkt structure) + * + * Return value: + * nothing + ********************************************************************* */ +static void +tulip_rx_callback(tulip_softc *sc, eth_pkt_t *pkt) +{ + if (TULIP_DEBUG) show_packet('>', pkt); /* debug */ + + CS_ENTER(sc); + q_enqueue(&sc->rxqueue, &pkt->next); + CS_EXIT(sc); + sc->inpkts++; + + tulip_fillrxring(sc); +} + + +static void +tulip_procrxring(tulip_softc *sc) +{ + volatile rx_dscr *rxd; + eth_pkt_t *pkt; + eth_pkt_t *newpkt; + uint32_t flags; + + for (;;) { + rxd = (volatile rx_dscr *) sc->rxdscr_remove; + + flags = rxd->rxd_flags; + if (flags & M_RDES0_OWNADAP) { + /* end of ring, no more packets */ + break; + } + + pkt = ETH_PKT_BASE(PCI_TO_PTR(rxd->rxd_bufaddr1)); + + /* Drop error packets */ + if (flags & M_RDES0_ERRORSUM) { + xprintf("%s: rx error %04X\n", tulip_devname(sc), flags & 0xFFFF); + tulip_add_rcvbuf(sc, pkt); + goto next; + } + + /* Pass up the packet */ + pkt->length = G_RDES0_FRAMELEN(flags) - CRC_SIZE; + tulip_rx_callback(sc, pkt); + + /* put a buffer back on the ring to replace this one */ + newpkt = eth_alloc_pkt(sc); + if (newpkt) tulip_add_rcvbuf(sc, newpkt); + +next: + /* update the pointer, accounting for buffer wrap. */ + rxd++; + if (rxd == sc->rxdscr_end) + rxd = sc->rxdscr_start; + + sc->rxdscr_remove = (rx_dscr *) rxd; + CS_ENTER(sc); + sc->rxdscr_onring--; + CS_EXIT(sc); + } +} + + +static int +tulip_add_txbuf(tulip_softc *sc, eth_pkt_t *pkt) +{ + volatile tx_dscr *txd; + volatile tx_dscr *nexttxd; + uint32_t bufsize = 0; + + txd = sc->txdscr_add; + + /* Figure out where the next descriptor will go */ + nexttxd = (txd+1); + if (nexttxd == sc->txdscr_end) { + nexttxd = sc->txdscr_start; + bufsize = M_TDES1_ENDOFRING; + } + + /* If the next one is the same as our remove pointer, + the ring is considered full. (it actually has room for + one more, but we reserve the remove == add case for "empty") */ + + if (nexttxd == sc->txdscr_remove) return -1; + + bufsize |= V_TDES1_BUF1SIZE(pkt->length) | + M_TDES1_FIRSTSEG | M_TDES1_LASTSEG | M_TDES1_INTERRUPT; + if (pkt->flags & ETH_TX_SETUP) { + /* For a setup packet, FIRSTSEG and LASTSEG should be clear (!) */ + bufsize ^= M_TDES1_SETUP | M_TDES1_FIRSTSEG | M_TDES1_LASTSEG; + } + txd->txd_bufsize = bufsize; + txd->txd_bufaddr1 = PTR_TO_PCI(pkt->buffer); + txd->txd_bufaddr2 = 0; + txd->txd_flags = M_TDES0_OWNADAP; + + /* success, advance the pointer */ + sc->txdscr_add = nexttxd; + + return 0; +} + + +static int +tulip_transmit(tulip_softc *sc,eth_pkt_t *pkt) +{ + int rv; + + if (TULIP_DEBUG) show_packet('<', pkt); /* debug */ + + rv = tulip_add_txbuf(sc, pkt); + sc->outpkts++; + + WRITECSR(sc, R_CSR_TXPOLL, 1); + return rv; +} + + +static void +tulip_proctxring(tulip_softc *sc) +{ + volatile tx_dscr *txd; + eth_pkt_t *pkt; + uint32_t flags; + + for (;;) { + txd = (volatile tx_dscr *) sc->txdscr_remove; + + if (txd == sc->txdscr_add) { + /* ring is empty, no buffers to process */ + break; + } + + flags = txd->txd_flags; + if (flags & M_TDES0_OWNADAP) { + /* Reached a packet still being transmitted */ + break; + } + + /* Check for a completed setup packet */ + pkt = ETH_PKT_BASE(PCI_TO_PTR(txd->txd_bufaddr1)); + if (pkt->flags & ETH_TX_SETUP) { + if (sc->state == eth_state_setup) { + uint32_t opmode; + + /* check flag bits */ + opmode = READCSR(sc, R_CSR_OPMODE); + opmode |= M_CSR6_RXSTART; + WRITECSR(sc, R_CSR_OPMODE, opmode); + sc->inpkts = sc->outpkts = 0; + sc->state =eth_state_on; + } + pkt->flags &=~ ETH_TX_SETUP; + } + + /* Just free the packet */ + eth_free_pkt(sc, pkt); + + /* update the pointer, accounting for buffer wrap. */ + txd++; + if (txd == sc->txdscr_end) + txd = sc->txdscr_start; + + sc->txdscr_remove = (tx_dscr *) txd; + } +} + + +static void +tulip_initrings(tulip_softc *sc) +{ + volatile tx_dscr *txd; + volatile rx_dscr *rxd; + + /* Claim ownership of all descriptors for the driver */ + + for (txd = sc->txdscr_start; txd != sc->txdscr_end; txd++) + txd->txd_flags = 0; + for (rxd = sc->rxdscr_start; rxd != sc->rxdscr_end; rxd++) + rxd->rxd_flags = 0; + + /* Init the ring pointers */ + + sc->txdscr_add = sc->txdscr_remove = sc->txdscr_start; + sc->rxdscr_add = sc->rxdscr_remove = sc->rxdscr_start; + sc->rxdscr_onring = 0; + + /* Add stuff to the receive ring */ + + tulip_fillrxring(sc); +} + + +static int +tulip_init(tulip_softc *sc) +{ + /* Allocate descriptor rings */ + sc->rxdscrmem = KMALLOC(MAXRXDSCR*sizeof(rx_dscr), sizeof(rx_dscr)); + sc->txdscrmem = KMALLOC(MAXTXDSCR*sizeof(tx_dscr), sizeof(tx_dscr)); + + /* Allocate buffer pool */ + sc->pktpool = KMALLOC(ETH_PKTPOOL_SIZE*ETH_PKTBUF_SIZE, CACHE_ALIGN); + eth_initfreelist(sc); + q_init(&sc->rxqueue); + + /* Fill in pointers to the rings */ + sc->rxdscr_start = (rx_dscr *) (sc->rxdscrmem); + sc->rxdscr_end = sc->rxdscr_start + MAXRXDSCR; + sc->rxdscr_add = sc->rxdscr_start; + sc->rxdscr_remove = sc->rxdscr_start; + sc->rxdscr_onring = 0; + + sc->txdscr_start = (tx_dscr *) (sc->txdscrmem); + sc->txdscr_end = sc->txdscr_start + MAXTXDSCR; + sc->txdscr_add = sc->txdscr_start; + sc->txdscr_remove = sc->txdscr_start; + + tulip_initrings(sc); + + return 0; +} + + +static void +tulip_resetrings(tulip_softc *sc) +{ + volatile tx_dscr *txd; + volatile rx_dscr *rxd; + eth_pkt_t *pkt; + + /* Free already-sent descriptors and buffers */ + tulip_proctxring(sc); + + /* Free any pending but unsent */ + txd = (volatile tx_dscr *) sc->txdscr_remove; + while (txd != sc->txdscr_add) { + txd->txd_flags &=~ M_TDES0_OWNADAP; + pkt = ETH_PKT_BASE(PCI_TO_PTR(txd->txd_bufaddr1)); + eth_free_pkt(sc, pkt); + + txd++; + if (txd == sc->txdscr_end) + txd = sc->txdscr_start; + } + sc->txdscr_add = sc->txdscr_remove; + + /* Discard any received packets as well as all free buffers */ + rxd = (volatile rx_dscr *) sc->rxdscr_remove; + while (rxd != sc->rxdscr_add) { + rxd->rxd_flags &=~ M_RDES0_OWNADAP; + pkt = ETH_PKT_BASE(PCI_TO_PTR(rxd->rxd_bufaddr1)); + eth_free_pkt(sc, pkt); + + rxd++; + if (rxd == sc->rxdscr_end) + rxd = sc->rxdscr_start; + CS_ENTER(sc); + sc->rxdscr_onring--; + CS_EXIT(sc); + } + + /* Reestablish the initial state. */ + tulip_initrings(sc); +} + + +/* CRCs */ + +#define IEEE_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- either endian */ + +static uint32_t +tulip_crc32(const uint8_t *databuf, unsigned int datalen) +{ + unsigned int idx, bit, data; + uint32_t crc; + + crc = 0xFFFFFFFFUL; + for (idx = 0; idx < datalen; idx++) + for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) + crc = (crc >> 1) ^ (((crc ^ data) & 1) ? IEEE_CRC32_POLY : 0); + return crc; +} + +#define tulip_mchash(mca) (tulip_crc32((mca), 6) & 0x1FF) + + +/* Serial ROM access */ + +/**************************************************************************** + * tulip_spin(sc, ns) + * + * Spin for a short interval (nominally in nanoseconds) + * + * Input Parameters: ns - minimum required nsec. + * + * The delay loop uses uncached PCI reads, each of which requires + * at least 3 PCI bus clocks (45 ns at 66 MHz) to complete. The + * actual delay will be longer (much longer if preempted). + ***************************************************************************/ + +#define PCI_MIN_DELAY 45 + +static void +tulip_spin(tulip_softc *sc, long nanoseconds) +{ + long delay; + volatile uint32_t t; + + for (delay = nanoseconds; delay > 0; delay -= PCI_MIN_DELAY) + t = READCSR(sc, R_CSR_BUSMODE); +} + + +/* + * Delays below are chosen to meet specs for NS93C64 (slow M variant). + * Current parts are faster. + * Reference: NS Memory Data Book, 1994 + */ + +#define SROM_SIZE 128 +#define SROM_MAX_CYCLES 32 + +#define SROM_CMD_BITS 3 +#define SROM_ADDR_BITS 6 + +#define K_SROM_READ_CMD 06 +#define K_SROM_WRITE_CMD 05 + +#define SROM_VENDOR_INDEX 0x00 +#define SROM_FORMAT_INDEX 0x12 +#define SROM_ADDR_INDEX 0x14 + +#define SROM_DEVICE0_INDEX 0x1A +#define SROM_LEAF0_OFFSET_INDEX 0x1B + +#define SROM_CRC_INDEX (SROM_SIZE-2) +/* Note recent chips supporting wake-on-lan have CRC in bytes 94, 95 */ + +#define SROM_WORD(rom,offset) ((rom)[offset] | ((rom)[offset+1] << 8)) + +static void +srom_idle_state(tulip_softc *sc) +{ + uint32_t csr9; + unsigned int i; + + csr9 = READCSR(sc, R_CSR_ROM_MII); + + csr9 |= M_CSR9_SROMCHIPSEL; + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 100); /* CS setup (Tcss=100) */ + + /* Run the clock through the maximum number of pending read cycles */ + for (i = 0; i < SROM_MAX_CYCLES*2; i++) { + csr9 ^= M_CSR9_SROMCLOCK; + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 1000); /* SK period (Fsk=0.5MHz) */ + } + + /* Deassert SROM Chip Select */ + csr9 &=~ M_CSR9_SROMCHIPSEL; + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 50); /* CS recovery (Tsks=50) */ +} + +static void +srom_send_command_bit(tulip_softc *sc, unsigned int data) +{ + uint32_t csr9; + + csr9 = READCSR(sc, R_CSR_ROM_MII); + + /* Place the data bit on the bus */ + if (data == 1) + csr9 |= M_CSR9_SROMDATAIN; + else + csr9 &=~ M_CSR9_SROMDATAIN; + + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 360); /* setup: Tdis=200 */ + + /* Now clock the data into the SROM */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_SROMCLOCK); + tulip_spin(sc, 900); /* clock high, Tskh=500 */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 450); /* clock low, Tskl=250 */ + + /* Now clear the data bit */ + csr9 &=~ M_CSR9_SROMDATAIN; /* data invalid, Tidh=20 for SK^ */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 270); /* min cycle, 1/Fsk=2000 */ +} + +static uint16_t +srom_read_bit(tulip_softc *sc) +{ + uint32_t csr9; + + csr9 = READCSR(sc, R_CSR_ROM_MII); + + /* Generate a clock cycle before doing a read */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_SROMCLOCK); /* rising edge */ + tulip_spin(sc, 1000); /* clock high, Tskh=500, Tpd=1000 */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); /* falling edge */ + tulip_spin(sc, 1000); /* clock low, 1/Fsk=2000 */ + + csr9 = READCSR(sc, R_CSR_ROM_MII); + return ((csr9 & M_CSR9_SROMDATAOUT) != 0 ? 1 : 0); +} + +#define CMD_BIT_MASK (1 << (SROM_CMD_BITS+SROM_ADDR_BITS-1)) + +static uint16_t +srom_read_word(tulip_softc *sc, unsigned int index) +{ + uint16_t command, word; + uint32_t csr9; + unsigned int i; + + csr9 = READCSR(sc, R_CSR_ROM_MII) | M_CSR9_SROMCHIPSEL; + + /* Assert the SROM CS line */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 100); /* CS setup, Tcss = 100 */ + + /* Send the read command to the SROM */ + command = (K_SROM_READ_CMD << SROM_ADDR_BITS) | index; + for (i = 0; i < SROM_CMD_BITS+SROM_ADDR_BITS; i++) { + srom_send_command_bit(sc, (command & CMD_BIT_MASK) != 0 ? 1 : 0); + command <<= 1; + } + + /* Now read the bits from the SROM (MSB first) */ + word = 0; + for (i = 0; i < 16; ++i) { + word <<= 1; + word |= srom_read_bit(sc); + } + + /* Clear the SROM CS Line, CS hold, Tcsh = 0 */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 &~ M_CSR9_SROMCHIPSEL); + + return word; +} + + +/**************************************************************************** + * srom_calc_crc() + * + * Calculate the CRC of the SROM and return it. We compute the + * CRC per Appendix A of the 21140A ROM/external register data + * sheet (EC-QPQWA-TE). + ***************************************************************************/ + +static uint16_t +srom_calc_crc(tulip_softc *sc, uint8_t srom[], int length) +{ + uint32_t crc = tulip_crc32(srom, length) ^ 0xFFFFFFFF; + + return (uint16_t)(crc & 0xFFFF); +} + +/**************************************************************************** + * srom_read_all(sc, uint8_t dest) + * + * Read the entire SROM into the srom array + * + * Input parameters: + * sc - tulip state + ***************************************************************************/ + +static int +srom_read_all(tulip_softc *sc, uint8_t dest[]) +{ + int i; + uint16_t crc, temp; + + WRITECSR(sc, R_CSR_ROM_MII, M_CSR9_SERROMSEL|M_CSR9_ROMREAD); + + srom_idle_state(sc); + + for (i = 0; i < SROM_SIZE/2; i++) { + temp = srom_read_word(sc, i); + dest[2*i] = temp & 0xFF; + dest[2*i+1] =temp >> 8; + } + + WRITECSR(sc, R_CSR_ROM_MII, 0); /* CS hold, Tcsh=0 */ + + crc = srom_calc_crc(sc, dest, SROM_CRC_INDEX); + if (crc != SROM_WORD(dest, SROM_CRC_INDEX)) { + crc = srom_calc_crc(sc, dest, 94); /* "alternative" */ + if (crc != SROM_WORD(dest, 94)) { + xprintf("%s: Invalid SROM CRC, calc %04x, stored %04x\n", + tulip_devname(sc), crc, SROM_WORD(dest, 94)); + return 0/*-1*/; + } + } + return 0; +} + +static int +srom_read_addr(tulip_softc *sc, uint8_t buf[]) +{ + uint8_t srom[SROM_SIZE]; + + if (srom_read_all(sc, srom) == 0) { + memcpy(buf, &srom[SROM_ADDR_INDEX], ENET_ADDR_LEN); + return 0; + } + + return -1; +} + + +/**************************************************************************** + * earom_read_all(sc, uint8_t dest) + * + * Read the entire Ethernet address ROM into the srom array (21040 only) + * + * Input parameters: + * sc - tulip state + ***************************************************************************/ + +static int +earom_read_all(tulip_softc *sc, uint8_t dest[]) +{ + int i; + uint32_t csr9; + + WRITECSR(sc, R_CSR_ROM_MII, 0); /* reset pointer */ + + for (i = 0; i < SROM_SIZE; i++) { + for (;;) { + csr9 = READCSR(sc, R_CSR_ROM_MII); + if ((csr9 & M_CSR9_DATANOTVALID) == 0) + break; + POLL(); /* XXX need a timeout */ + } + dest[i] = G_CSR9_ROMDATA(csr9); + } + + return 0; +} + +static int +earom_read_addr(tulip_softc *sc, uint8_t buf[]) +{ + uint8_t srom[SROM_SIZE]; + + if (earom_read_all(sc, srom) == 0) { + memcpy(buf, &srom[0], ENET_ADDR_LEN); + return 0; + } + + return -1; +} + + +static int +rom_read_all(tulip_softc *sc, uint8_t buf[]) +{ + if (sc->device == K_PCI_ID_DC21040) + return earom_read_all(sc, buf); + else + return srom_read_all(sc, buf); +} + +static int +rom_read_addr(tulip_softc *sc, uint8_t buf[]) +{ + if (sc->device == K_PCI_ID_DC21040) + return earom_read_addr(sc, buf); + else + return srom_read_addr(sc, buf); +} + +#if 0 +static void +rom_dump(uint8_t srom[]) +{ + int i; + + xprintf("DC21x4x: SROM data:"); + for (i = 0; i < SROM_SIZE; i++) { + if (i % 16 == 0) + xprintf("\n %02x: ", i); + xprintf(" %02x", srom[i]); + } + xprintf("\n"); +} +#else +#define rom_dump(srom) +#endif + + +/**************************************************************************** + * MII access utility routines + ***************************************************************************/ + +/* MII clock limited to 2.5 MHz, transactions end with MDIO tristated */ + +static void +mii_write_bits(tulip_softc *sc, uint32_t data, unsigned int count) +{ + uint32_t csr9; + uint32_t bitmask; + + csr9 = READCSR(sc, R_CSR_ROM_MII) &~ (M_CSR9_MDC | M_CSR9_MIIMODE); + + for (bitmask = 1 << (count-1); bitmask != 0; bitmask >>= 1) { + csr9 &=~ M_CSR9_MDO; + if ((data & bitmask) != 0) csr9 |= M_CSR9_MDO; + WRITECSR(sc, R_CSR_ROM_MII, csr9); + + tulip_spin(sc, 2000); /* setup */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_MDC); + tulip_spin(sc, 2000); /* hold */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + } +} + +static void +mii_turnaround(tulip_softc *sc) +{ + uint32_t csr9; + + csr9 = READCSR(sc, R_CSR_ROM_MII) | M_CSR9_MIIMODE; + + /* stop driving data */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 2000); /* setup */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_MDC); + tulip_spin(sc, 2000); /* clock high */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + + /* read back and check for 0 here? */ +} + +/**************************************************************************** + * mii_read_register + * + * This routine reads a register from the PHY chip using the MII + * serial management interface. + * + * Input parameters: + * index - index of register to read (0-31) + * + * Return value: + * word read from register + ***************************************************************************/ + +static uint16_t +mii_read_register(tulip_softc *sc, unsigned int index) +{ + /* Send the command and address to the PHY. The sequence is + a synchronization sequence (32 1 bits) + a "start" command (2 bits) + a "read" command (2 bits) + the PHY addr (5 bits) + the register index (5 bits) + */ + uint32_t csr9; + uint16_t word; + int i; + + mii_write_bits(sc, 0xFF, 8); + mii_write_bits(sc, 0xFFFFFFFF, 32); + mii_write_bits(sc, MII_COMMAND_START, 2); + mii_write_bits(sc, MII_COMMAND_READ, 2); + mii_write_bits(sc, sc->mii_addr, 5); + mii_write_bits(sc, index, 5); + + mii_turnaround(sc); + + csr9 = (READCSR(sc, R_CSR_ROM_MII) &~ M_CSR9_MDC) | M_CSR9_MIIMODE; + word = 0; + + for (i = 0; i < 16; i++) { + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 2000); /* clock width low */ + WRITECSR(sc, R_CSR_ROM_MII, csr9 | M_CSR9_MDC); + tulip_spin(sc, 2000); /* clock width high */ + WRITECSR(sc, R_CSR_ROM_MII, csr9); + tulip_spin(sc, 1000); /* output delay */ + word <<= 1; + if ((READCSR(sc, R_CSR_ROM_MII) & M_CSR9_MDI) != 0) + word |= 0x0001; + } + + return word; + + /* reset to output mode? */ +} + +/**************************************************************************** + * mii_write_register + * + * This routine writes a register in the PHY chip using the MII + * serial management interface. + * + * Input parameters: + * index - index of register to write (0-31) + * value - word to write + ***************************************************************************/ + +static void +mii_write_register(tulip_softc *sc, unsigned int index, uint16_t value) +{ + mii_write_bits(sc, 0xFF, 8); + mii_write_bits(sc, 0xFFFFFFFF, 32); + mii_write_bits(sc, MII_COMMAND_START, 2); + mii_write_bits(sc, MII_COMMAND_WRITE, 2); + mii_write_bits(sc, sc->mii_addr, 5); + mii_write_bits(sc, index, 5); + mii_write_bits(sc, MII_COMMAND_ACK, 2); + mii_write_bits(sc, value, 16); + + /* reset to input mode? */ +} + + +static int +mii_probe(tulip_softc *sc) +{ + int i; + uint16_t id1, id2; + + for (i = 0; i < 32; i++) { + sc->mii_addr = i; + id1 = mii_read_register(sc, MII_PHYIDR1); + id2 = mii_read_register(sc, MII_PHYIDR2); + if ((id1 != 0x0000 && id1 != 0xFFFF) || + (id2 != 0x0000 && id2 != 0xFFFF)) { + return 0; + } + } + return -1; +} + +#if 0 +#define OUI_NAT_SEMI 0x080017 +#define OUI_LEVEL_ONE 0x1E0400 /* 0x00207B, bit reversed and truncated */ + +static void +mii_dump(tulip_softc *sc, const char *label) +{ + int i; + uint16_t r; + uint32_t oui, part; + + xprintf("%s\n", label); + oui = 0; + for (i = 0; i <= 6; ++i) { + r = mii_read_register(sc, i); + if (r != 0) xprintf("MII_REG%02x: %04x\n", i, r); + if (i == MII_PHYIDR1) { + oui = r << 6; + } + else if (i == MII_PHYIDR2) { + oui |= (r >> 10) & 0x3F; + part = (r >> 4) & 0x3F; + } + } + if (oui == OUI_NAT_SEMI) { /* DP83840, DP83840A */ + for (i = 0x15; i <= 0x19; ++i) { + r = mii_read_register(sc, i); + if (r != 0) xprintf("MII_REG%02x: %04x\n", i, r); + } + } + else if (oui == OUI_LEVEL_ONE) { /* LXT970, etc. */ + for (i = 0x10; i <= 0x14; ++i) { + r = mii_read_register(sc, i); + if (r != 0) xprintf("MII_REG%02x: %04x\n", i, r); + } + } +} +#else +#define mii_dump(sc,label) +#endif + + +/* The following functions are suitable for all tulips with MII + interfaces. */ + +static void +mii_set_speed(tulip_softc *sc, int speed, int autoneg) +{ + uint16_t control; + uint16_t pcr; + uint32_t opmode = 0; + + /* This is really just for NS DP83840/A. Needed? */ + pcr = mii_read_register(sc, 0x17); + pcr |= (0x400|0x100|0x40|0x20); + mii_write_register(sc, 0x17, pcr); + + control = mii_read_register(sc, MII_BMCR); + + if (!autoneg) { + control &=~ (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + control &=~ (BMCR_SPEED0 | BMCR_SPEED1 | BMCR_DUPLEX); + } + + switch (speed) { + case ETHER_SPEED_10HDX: + default: + opmode = M_CSR6_SPEED_10_MII; + break; + case ETHER_SPEED_10FDX: + control |= BMCR_DUPLEX; + opmode = M_CSR6_SPEED_10_MII | M_CSR6_FULLDUPLEX; + break; + case ETHER_SPEED_100HDX: + control |= BMCR_SPEED100; + opmode = M_CSR6_SPEED_100_MII; + break; + case ETHER_SPEED_100FDX: + control |= BMCR_SPEED100 | BMCR_DUPLEX ; + opmode = M_CSR6_SPEED_100_MII | M_CSR6_FULLDUPLEX; + break; + } + + if (!autoneg) + mii_write_register(sc, MII_BMCR, control); + + opmode |= M_CSR6_MBO; +#if TULIP_TUNE + opmode |= V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72); +#else + opmode |= M_CSR6_STOREFWD; +#endif + WRITECSR(sc, R_CSR_OPMODE, opmode); + mii_dump(sc, "setspeed PHY"); +} + +static void +mii_autonegotiate(tulip_softc *sc) +{ + uint16_t control, status, cap; + unsigned int timeout; + int linkspeed; + int autoneg; + + linkspeed = ETHER_SPEED_UNKNOWN; + + /* Read twice to clear latching bits */ + status = mii_read_register(sc, MII_BMSR); + status = mii_read_register(sc, MII_BMSR); + mii_dump(sc, "query PHY"); + + if ((status & (BMSR_AUTONEG | BMSR_LINKSTAT)) == + (BMSR_AUTONEG | BMSR_LINKSTAT)) + control = mii_read_register(sc, MII_BMCR); + else { + /* reset the PHY */ + mii_write_register(sc, MII_BMCR, BMCR_RESET); + timeout = 3000; + for (;;) { + control = mii_read_register(sc, MII_BMCR); + if ((control && BMCR_RESET) == 0) break; + cfe_sleep(CFE_HZ/2); + timeout -= 500; + if (timeout <= 0) break; + } + if ((control & BMCR_RESET) != 0) { + xprintf("%s: PHY reset failed\n", tulip_devname(sc)); + return; + } + + status = mii_read_register(sc, MII_BMSR); + cap = ((status >> 6) & (ANAR_TXFD | ANAR_TXHD | ANAR_10FD | ANAR_10HD)) + | PSB_802_3; + mii_write_register(sc, MII_ANAR, cap); + control |= (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + + timeout = 3000; + for (;;) { + status = mii_read_register(sc, MII_BMSR); + if ((status & BMSR_ANCOMPLETE) != 0) break; + cfe_sleep(CFE_HZ/2); + timeout -= 500; + if (timeout <= 0) break; + } + mii_dump(sc, "done PHY"); + } + + xprintf("%s: Link speed: ", tulip_devname(sc)); + if ((status & BMSR_ANCOMPLETE) != 0) { + /* A link partner was negogiated... */ + + uint16_t remote = mii_read_register(sc, MII_ANLPAR); + + autoneg = 1; + if ((remote & ANLPAR_TXFD) != 0) { + xprintf("100BaseT FDX"); + linkspeed = ETHER_SPEED_100FDX; + } + else if ((remote & ANLPAR_TXHD) != 0) { + xprintf("100BaseT HDX"); + linkspeed = ETHER_SPEED_100HDX; + } + else if ((remote & ANLPAR_10FD) != 0) { + xprintf("10BaseT FDX"); + linkspeed = ETHER_SPEED_10FDX; + } + else if ((remote & ANLPAR_10HD) != 0) { + xprintf("10BaseT HDX"); + linkspeed = ETHER_SPEED_10HDX; + } + xprintf("\n"); + } + else { + /* no link partner negotiation */ + + autoneg = 0; + xprintf("Unknown, assuming 10BaseT\n"); + control &=~ (BMCR_ANENABLE | BMCR_RESTARTAN); + mii_write_register(sc, MII_BMCR, control); + linkspeed = ETHER_SPEED_10HDX; + } + + if ((status & BMSR_LINKSTAT) == 0) + mii_write_register(sc, MII_BMCR, control); + mii_set_speed(sc, linkspeed, autoneg); + + status = mii_read_register(sc, MII_BMSR); /* clear latching bits */ + mii_dump(sc, "final PHY"); +} + + +/* Chip specific code */ + +static void +dc21143_set_speed(tulip_softc *sc, int speed) +{ + uint32_t opmode = 0; + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + + switch (speed) { + case ETHER_SPEED_AUTO: + break; + case ETHER_SPEED_10HDX: + default: + WRITECSR(sc, R_CSR_SIAMODE1, M_CSR14_10BT_HD); + WRITECSR(sc, R_CSR_SIAMODE2, sc->gpdata); + opmode = M_CSR6_SPEED_10; + break; + case ETHER_SPEED_10FDX: + WRITECSR(sc, R_CSR_SIAMODE1, M_CSR14_10BT_FD); + WRITECSR(sc, R_CSR_SIAMODE2, sc->gpdata); + opmode = M_CSR6_SPEED_10 | M_CSR6_FULLDUPLEX; + break; + case ETHER_SPEED_100HDX: + WRITECSR(sc, R_CSR_SIAMODE1, 0); + WRITECSR(sc, R_CSR_SIAMODE2, sc->gpdata); + opmode = M_CSR6_SPEED_100; + break; + case ETHER_SPEED_100FDX: + WRITECSR(sc, R_CSR_SIAMODE1, 0); + WRITECSR(sc, R_CSR_SIAMODE2, sc->gpdata); + opmode = M_CSR6_SPEED_100 | M_CSR6_FULLDUPLEX; + break; + } + + WRITECSR(sc, R_CSR_SIAMODE0, M_CSR13_CONN_NOT_RESET); + + opmode |= M_CSR6_MBO; +#if TULIP_TUNE + opmode |= V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72); +#else + opmode |= M_CSR6_STOREFWD; +#endif + WRITECSR(sc, R_CSR_OPMODE, opmode); +} + +static void +dc21143_autonegotiate(tulip_softc *sc) +{ + uint32_t opmode; + uint32_t tempword; + int count; + int linkspeed; + + linkspeed = ETHER_SPEED_UNKNOWN; + + /* Program the media setup into the CSRs. */ + /* reset SIA */ + WRITECSR(sc, R_CSR_SIAMODE0, 0); + + /* set to speed_10, fullduplex to start_nway */ + opmode = + M_CSR6_SPEED_10 | + M_CSR6_FULLDUPLEX | + M_CSR6_MBO; + WRITECSR(sc, R_CSR_OPMODE, opmode); + + /* Choose advertised capabilities */ + tempword = + M_CSR14_100BASETHALFDUP | + M_CSR14_100BASETFULLDUP | + M_CSR14_HALFDUPLEX10BASET; + WRITECSR(sc, R_CSR_SIAMODE1, tempword); + + /* Enable autonegotiation */ + tempword |= M_CSR14_AUTONEGOTIATE | 0xFFFF; + WRITECSR(sc, R_CSR_SIAMODE1, tempword); + WRITECSR(sc, R_CSR_SIAMODE2, sc->gpdata); + WRITECSR(sc, R_CSR_OPMODE, opmode); + WRITECSR(sc, R_CSR_SIAMODE0, M_CSR13_CONN_NOT_RESET); + + /* STATE check nway, poll until a valid 10/100mbs signal seen */ + WRITECSR(sc, R_CSR_STATUS, M_CSR5_LINKPASS); /* try to clear this... */ + + /* (Re)start negotiation */ + tempword = READCSR(sc, R_CSR_SIASTATUS); + tempword &=~ M_CSR12_AUTONEGARBIT; + tempword |= V_CSR12_AUTONEGARBIT(0x1); + + for (count = 0; count <= 13; count++) { + tempword = READCSR(sc, R_CSR_STATUS); + if (tempword & M_CSR5_LINKPASS) + break; + cfe_sleep(CFE_HZ/10); + } + + if (count > 13) + xprintf("%s: Link autonegotiation failed\n", tulip_devname(sc)); + + /* STATE configure nway, check to see if any abilities common to us. + If they do, set to highest mode, if not, we will see if the partner + will do 100mb or 10mb - then set it */ + + tempword = READCSR(sc, R_CSR_SIASTATUS); + /* clear the autonegogiate complete bit */ + WRITECSR(sc, R_CSR_STATUS, M_CSR5_LINKPASS); + + if (tempword & M_CSR12_LINKPARTNEG) { + /* A link partner was negogiated... */ + + xprintf("%s: Link speed: ", tulip_devname(sc)); + if (tempword & 0x01000000) { /* 100FD */ + xprintf("100BaseT FDX"); + linkspeed = ETHER_SPEED_100FDX; + } + else if (tempword & 0x00800000) { /* 100HD */ + xprintf("100BaseT HDX"); + linkspeed = ETHER_SPEED_100HDX; + } + else if (tempword & 0x00400000) { /* 10FD */ + xprintf("10BaseT FDX"); + linkspeed = ETHER_SPEED_10FDX; + } + else if (tempword & 0x00200000) { /* 10HD */ + xprintf("10BaseT HDX"); + linkspeed = ETHER_SPEED_10HDX; + } + xprintf("\n"); + } + else { + /* no link partner negotiation */ + /* disable link for 1.3 seconds to break any existing connections */ + + xprintf("%s: ", tulip_devname(sc)); + dc21143_set_speed(sc, ETHER_SPEED_10HDX); + cfe_sleep(CFE_HZ/8); + + tempword = READCSR(sc, R_CSR_SIASTATUS); + + if ((tempword & 0x02) == 0) { + /* 100 mb signal present set to 100mb */ + xprintf("No link partner... setting to 100BaseT HDX\n"); + linkspeed = ETHER_SPEED_100HDX; + } + else if ((tempword & 0x04) == 0) { + /* 10 mb signal present */ + xprintf("No link partner... setting to 10BaseT HDX\n"); + linkspeed = ETHER_SPEED_10HDX; + } + else { + /* couldn't determine line speed, so set to 10mbs */ + xprintf("Unknown; defaulting to 10BaseT HDX\n"); + linkspeed = ETHER_SPEED_10HDX; + } + } + + dc21143_set_speed(sc, linkspeed); +} + +static void +dc21143_set_loopback(tulip_softc *sc, int mode) +{ + uint32_t v; + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + if (mode == ETHER_LOOPBACK_EXT) { + /* deal with CSRs 13-15 */ + } + cfe_sleep(CFE_HZ/10); /* check this */ + + /* Update the SIA registers */ + v = READCSR(sc, R_CSR_SIAMODE0); + WRITECSR(sc, R_CSR_SIAMODE0, v &~ 0xFFFF); + v = READCSR(sc, R_CSR_SIAMODE1); + WRITECSR(sc, R_CSR_SIAMODE1, v &~ 0xFFFF); + v = READCSR(sc, R_CSR_SIAMODE2); + WRITECSR(sc, R_CSR_SIAMODE2, v | 0xC000); /* WC of HCKR, RMP */ + if (mode == ETHER_LOOPBACK_OFF) + WRITECSR(sc, R_CSR_SIAMODE2, sc->gpdata); + else + WRITECSR(sc, R_CSR_SIAMODE2, (v &~ 0xFFFF) | M_CSR15_GP_AUIBNC); + + WRITECSR(sc, R_CSR_SIAMODE0, M_CSR13_CONN_NOT_RESET); + + sc->loopback = mode; +} + +/* Known vendors with cards requiring special initialization. */ +#define K_PCI_VENDOR_COGENT 0x1109 /* inherited by Adaptec */ +#define K_PCI_VENDOR_PHOBOS 0x13D8 +#define K_PCI_VENDOR_ZNYZ 0x110D +#define K_PCI_VENDOR_KINGSTON 0x2646 + +static void +dc21143_hwinit(tulip_softc *sc, uint8_t srom[]) +{ + uint32_t v; + uint32_t csr6word, csr14word; + + if (SROM_WORD(srom, SROM_VENDOR_INDEX) == K_PCI_VENDOR_COGENT) { + /* Cogent/Adaptec MII (ANA-6911A). */ + sc->phy_type = MII; + WRITECSR(sc, R_CSR_SIAMODE2, 0x0821 << 16); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0001 << 16); + cfe_sleep(CFE_HZ/10); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0000 << 16); + cfe_sleep(CFE_HZ/2); + sc->gpdata = 0; + } + else if (SROM_WORD(srom, SROM_VENDOR_INDEX) == K_PCI_VENDOR_ZNYZ) { + /* Znyz 34xQ adapters */ + sc->phy_type = SYM; + + /* The ZX345Q with wake-on-LAN enabled apparently clears ANE and + TAS on power up (but not cold reset) */ + WRITECSR(sc, R_CSR_SIAMODE1, 0xFFFFFFFF); + + /* The following is a reset workaround for QS/Kendin PHYs + as suggested by an Intel app note. Bit 0x40000 is the PHY + reset (low true) on Znyx cards. */ + WRITECSR(sc, R_CSR_SIAMODE2, + M_CSR15_GP_CONTROLWRITE | + 0xF0000 | /* all outputs */ + M_CSR15_GP_LED1 | + M_CSR15_GP_AUIBNC); + cfe_sleep(CFE_HZ/5); + WRITECSR(sc, R_CSR_SIAMODE2, 0x40000); /* release reset */ + cfe_sleep(CFE_HZ/5); + sc->gpdata = 0x40000 | M_CSR15_GP_AUIBNC; + } + else if (SROM_WORD(srom, SROM_VENDOR_INDEX) == K_PCI_VENDOR_KINGSTON) { + /* Kingston KNE100TX */ + sc->phy_type = MII; + sc->gpdata = 0; + } + else if (SROM_WORD(srom, SROM_VENDOR_INDEX) == K_PCI_VENDOR_PHOBOS) { + /* Phobos 430TX quad card */ + sc->phy_type = MII; +#if 0 /* per EEPROM */ + WRITECSR(sc, R_CSR_SIAMODE2, 0x080E << 16); + WRITECSR(sc, R_CSR_SIAMODE2, 0x000E << 16); + cfe_sleep(CFE_HZ/10); + sc->gpdata = 0x0E; +#else /* following Adaptec 21143 with MII interface */ + WRITECSR(sc, R_CSR_SIAMODE2, 0x0821 << 16); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0001 << 16); + cfe_sleep(CFE_HZ/10); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0000 << 16); + cfe_sleep(CFE_HZ/2); + sc->gpdata = 0; +#endif + } + else { + /* Most 21143 cards use the SYM interface. */ + sc->phy_type = SYM; + WRITECSR(sc, R_CSR_SIAMODE2, M_CSR15_CONFIG_GEPS_LEDS); + sc->gpdata = M_CSR15_DEFAULT_VALUE; + } + + if (sc->phy_type == MII) { + mii_probe(sc); + } + + /* CSR0 - bus mode */ +#if TULIP_TUNE + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN32) | + M_CSR0_READMULTENAB | M_CSR0_READLINEENAB | + M_CSR0_WRITEINVALENAB | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#else + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN32) | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#endif +#ifdef __MIPSEB + v |= M_CSR0_BIGENDIAN; /* big-endian data serialization */ +#endif + WRITECSR(sc, R_CSR_BUSMODE, v); + + /* CSR6 - operation mode */ + v = M_CSR6_PORTSEL | +#if TULIP_TUNE + V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72) | +#else + M_CSR6_STOREFWD | +#endif + M_CSR6_MBO; + if (sc->phy_type == SYM) + v |= M_CSR6_PCSFUNC |M_CSR6_SCRAMMODE; + WRITECSR(sc, R_CSR_OPMODE, v); + + /* About to muck with the SIA, reset it.(?) */ + /* WRITECSR(sc, R_CSR_SIASTATUS, 0); */ + + /* Must shut off all transmit/receive in order to attempt to + achieve Full Duplex */ + csr6word = READCSR(sc, R_CSR_OPMODE); + WRITECSR(sc, R_CSR_OPMODE, csr6word &~ (M_CSR6_TXSTART | M_CSR6_RXSTART)); + csr6word = READCSR(sc, R_CSR_OPMODE); + + WRITECSR(sc, R_CSR_RXRING, PTR_TO_PCI(sc->rxdscr_start)); + WRITECSR(sc, R_CSR_TXRING, PTR_TO_PCI(sc->txdscr_start)); + + if (sc->phy_type == MII) { + if (sc->linkspeed == ETHER_SPEED_AUTO) + mii_autonegotiate(sc); + else + mii_set_speed(sc, sc->linkspeed, 0); + } + else { + if (sc->linkspeed == ETHER_SPEED_AUTO) { + dc21143_autonegotiate(sc); + } + else { + /* disable autonegotiate so we can set full duplex to on */ + WRITECSR(sc, R_CSR_SIAMODE0, 0); + csr14word = READCSR(sc, R_CSR_SIAMODE1); + csr14word &=~ M_CSR14_AUTONEGOTIATE; + WRITECSR(sc, R_CSR_SIAMODE1, csr14word); + WRITECSR(sc, R_CSR_SIAMODE0, M_CSR13_CONN_NOT_RESET); + + dc21143_set_speed(sc, sc->linkspeed); + } + } +} + + +static void +dc21140_set_speed(tulip_softc *sc, int speed, int autoneg) +{ + mii_set_speed(sc, speed, autoneg); +} + +static void +dc21140_set_loopback(tulip_softc *sc, int mode) +{ + if (mode == ETHER_LOOPBACK_EXT) { + xprintf("%s: external loopback mode NYI\n", tulip_devname(sc)); + mode = ETHER_LOOPBACK_OFF; + } + else if (mode != ETHER_LOOPBACK_INT) + mode = ETHER_LOOPBACK_OFF; + + sc->loopback = mode; +} + +static void +dc21140_hwinit(tulip_softc *sc, uint8_t srom[]) +{ + uint16_t leaf; + uint8_t gpr_control, gpr_data; + uint32_t v; + uint32_t opmode; + + if (srom[SROM_FORMAT_INDEX] == 0 || srom[SROM_FORMAT_INDEX] > 4) { + gpr_control = 0x1F; + gpr_data = 0x00; + sc->phy_type = MII; /* Most 21140 cards use MII */ + } + else { + leaf = SROM_WORD(srom, SROM_LEAF0_OFFSET_INDEX); + gpr_control = srom[leaf+2]; + /* XXX We should parse and check all the leaf info */ + if ((srom[leaf+4] & 0x80) == 0) { + gpr_data = 0x85; /* SYM, 100 Mb/s */ + sc->phy_type = SYM; + } + else { + gpr_data = 0x00; /* MII */ + sc->phy_type = MII; + } + } + + /* Assume that we will use MII or SYM interface */ + WRITECSR(sc, R_CSR_OPMODE, M_CSR6_PORTSEL); + RESET_ADAPTER(sc); + + WRITECSR(sc, R_CSR_GENPORT, M_CSR12_CONTROL | gpr_control); + WRITECSR(sc, R_CSR_GENPORT, gpr_data); /* setup PHY */ + + if (sc->phy_type == MII) { + mii_probe(sc); + } + + /* CSR0 - bus mode */ +#if TULIP_TUNE + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN32) | + M_CSR0_READMULTENAB | M_CSR0_READLINEENAB | + M_CSR0_WRITEINVALENAB | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#else + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN32) | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#endif +#ifdef __MIPSEB + v |= M_CSR0_BIGENDIAN; /* big-endian data serialization */ +#endif + WRITECSR(sc, R_CSR_BUSMODE, v); + + /* CSR6 - operation mode */ + v = M_CSR6_PORTSEL | +#if TULIP_TUNE + V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72) | +#else + M_CSR6_STOREFWD | +#endif + M_CSR6_MBO; + WRITECSR(sc, R_CSR_OPMODE, v); + + /* Must shut off all transmit/receive in order to attempt to + achieve Full Duplex */ + opmode = READCSR(sc, R_CSR_OPMODE); + WRITECSR(sc, R_CSR_OPMODE, opmode &~ (M_CSR6_TXSTART | M_CSR6_RXSTART)); + opmode = READCSR(sc, R_CSR_OPMODE); + + WRITECSR(sc, R_CSR_RXRING, PTR_TO_PCI(sc->rxdscr_start)); + WRITECSR(sc, R_CSR_TXRING, PTR_TO_PCI(sc->txdscr_start)); + + if (sc->phy_type == MII) { + if (sc->linkspeed == ETHER_SPEED_AUTO) + mii_autonegotiate(sc); + else + mii_set_speed(sc, sc->linkspeed, 0); + } + else { + /* XXX The 21140 requires a soft reset after changing PORTSEL. + For now, remain committed to the SYM port (100 Mb/s) */ + switch (sc->linkspeed) { + default: + sc->linkspeed = ETHER_SPEED_100HDX; /* for now */ + /* fall through */ + case ETHER_SPEED_100HDX: + opmode |= M_CSR6_SPEED_100; + break; + case ETHER_SPEED_100FDX: + opmode |= M_CSR6_SPEED_100 | M_CSR6_FULLDUPLEX; + break; + } + + /* XXX Need to reset and reinitialize if we choose SPEED_10 above */ + WRITECSR(sc, R_CSR_OPMODE, opmode); + } +} + + +static void +dc21041_set_speed(tulip_softc *sc, int speed) +{ + uint32_t opmode = 0; + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + + /* For now, always force 10BT, HDX (21041, Table 3-62) */ + switch (speed) { + case ETHER_SPEED_10HDX: + default: + WRITECSR(sc, R_CSR_SIAMODE1, 0x7F3F); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0008); + opmode = M_CSR6_SPEED_10; + break; + } + + WRITECSR(sc, R_CSR_SIAMODE0, 0xEF00 | M_CSR13_CONN_NOT_RESET); + cfe_sleep(CFE_HZ/10); + + opmode |= V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72); + WRITECSR(sc, R_CSR_OPMODE, opmode); +} + +static void +dc21041_set_loopback(tulip_softc *sc, int mode) +{ + /* For now, always assume 10BT */ + uint32_t mode0; + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + cfe_sleep(CFE_HZ/10); /* check this */ + + /* Update the SIA registers */ + if (mode == ETHER_LOOPBACK_EXT) { + /* NB: this is really just internal but through the 10BT endec */ + WRITECSR(sc, R_CSR_SIAMODE1, 0x7A3F); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0008); + mode0 = 0; + } + else if (mode == ETHER_LOOPBACK_INT) { + /* MAC internal loopback, no SIA */ + WRITECSR(sc, R_CSR_SIAMODE1, 0x0000); + WRITECSR(sc, R_CSR_SIAMODE2, 0x000E); + mode0 = M_CSR13_CONN_AUI_10BT; + } + else { + mode = ETHER_LOOPBACK_OFF; + WRITECSR(sc, R_CSR_SIAMODE1, 0x7F3F); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0008); + mode0 = 0; + } + + WRITECSR(sc, R_CSR_SIAMODE0, 0xEF00 | mode0 | M_CSR13_CONN_NOT_RESET ); + + sc->loopback = mode; +} + +static void +dc21041_hwinit(tulip_softc *sc, uint8_t srom[]) +{ + uint32_t v; + + sc->phy_type = SRL; + + /* CSR0 - bus mode */ + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN32) | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#ifdef __MIPSEB + v |= M_CSR0_BIGENDIAN; /* big-endian data serialization */ +#endif + WRITECSR(sc, R_CSR_BUSMODE, v); + + WRITECSR(sc, R_CSR_INTMASK, 0); + + WRITECSR(sc, R_CSR_RXRING, PTR_TO_PCI(sc->rxdscr_start)); + WRITECSR(sc, R_CSR_TXRING, PTR_TO_PCI(sc->txdscr_start)); + + /* For now, always force 10BT, HDX (21041, Table 3-62) */ + dc21041_set_speed(sc, ETHER_SPEED_10HDX); +} + + +static void +dc21040_set_speed(tulip_softc *sc, int speed) +{ + uint32_t opmode = 0; + + WRITECSR(sc, R_CSR_SIAMODE0, 0); + + /* For now, force 10BT, HDX unless FDX requested (21040, Table 3-53) */ + switch (speed) { + case ETHER_SPEED_10HDX: + default: + WRITECSR(sc, R_CSR_SIAMODE1, 0xFFFF); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0000); + opmode = 0; + break; + case ETHER_SPEED_10FDX: + WRITECSR(sc, R_CSR_SIAMODE1, 0xFFFD); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0000); + opmode = M_CSR6_FULLDUPLEX; + break; + } + + WRITECSR(sc, R_CSR_SIAMODE0, 0xEF00 | M_CSR13_CONN_NOT_RESET); + cfe_sleep(CFE_HZ/10); + + opmode |= V_CSR6_THRESHCONTROL(K_CSR6_TXTHRES_128_72); + WRITECSR(sc, R_CSR_OPMODE, opmode); +} + +static void +dc21040_set_loopback(tulip_softc *sc, int mode) +{ + WRITECSR(sc, R_CSR_SIAMODE0, 0); + cfe_sleep(CFE_HZ/10); /* check this */ + + /* Update the SIA registers */ + if (mode == ETHER_LOOPBACK_EXT) { + /* NB: this is on-chip loopback through the 10BT endec */ + WRITECSR(sc, R_CSR_SIAMODE1, 0xFEFB); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0008); + } + else if (mode == ETHER_LOOPBACK_INT) { + /* MAC internal loopback, no SIA */ + WRITECSR(sc, R_CSR_SIAMODE1, 0x0000); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0000); + } + else { + mode = ETHER_LOOPBACK_OFF; + WRITECSR(sc, R_CSR_SIAMODE1, 0xFFFF); + WRITECSR(sc, R_CSR_SIAMODE2, 0x0000); + } + + WRITECSR(sc, R_CSR_SIAMODE0, 0x8F00 | M_CSR13_CONN_NOT_RESET ); + + sc->loopback = mode; +} + +static void +dc21040_hwinit(tulip_softc *sc, uint8_t srom[]) +{ + uint32_t v; + + sc->phy_type = SRL; + + /* CSR0 - bus mode */ + v = V_CSR0_SKIPLEN(0) | + V_CSR0_CACHEALIGN(K_CSR0_ALIGN32) | + V_CSR0_BURSTLEN(K_CSR0_BURST32); +#ifdef __MIPSEB + v |= M_CSR0_BIGENDIAN; /* big-endian data serialization */ +#endif + WRITECSR(sc, R_CSR_BUSMODE, v); + + WRITECSR(sc, R_CSR_INTMASK, 0); + + dc21040_set_speed(sc, sc->linkspeed); +} + + +static void +tulip_hwinit(tulip_softc *sc) +{ + if (sc->state == eth_state_uninit) { + uint8_t srom[SROM_SIZE]; + + /* Wake-on-LAN apparently powers up with PORTSEL = 1 */ + WRITECSR(sc, R_CSR_OPMODE, + READCSR(sc, R_CSR_OPMODE) &~ M_CSR6_PORTSEL); + + RESET_ADAPTER(sc); + sc->state = eth_state_off; + sc->bus_errors = 0; + + rom_read_all(sc, srom); /* XXX read just once? */ + rom_dump(srom); + + switch (sc->device) { + case K_PCI_ID_DC21040: + dc21040_hwinit(sc, srom); + break; + case K_PCI_ID_DC21041: + dc21041_hwinit(sc, srom); + break; + case K_PCI_ID_DC21140: + dc21140_hwinit(sc, srom); + break; + case K_PCI_ID_DC21143: + dc21143_hwinit(sc, srom); + break; + default: + break; + } + } +} + +static void +tulip_setaddr(tulip_softc *sc) +{ + int idx; + tulip_cam *cam; + eth_pkt_t *pkt; + + pkt = eth_alloc_pkt(sc); + if (pkt) { + pkt->length = CAM_SETUP_BUFFER_SIZE; + cam = (tulip_cam *) pkt->buffer; + +#ifdef __MIPSEB + cam->p.physical[0][0] = (((uint32_t) sc->hwaddr[0] << 8) | + (uint32_t) sc->hwaddr[1]) << 16; + cam->p.physical[0][1] = (((uint32_t) sc->hwaddr[2] << 8) | + (uint32_t) sc->hwaddr[3]) << 16; + cam->p.physical[0][2] = (((uint32_t) sc->hwaddr[4] << 8) | + (uint32_t) sc->hwaddr[5]) << 16; + for (idx = 1; idx < CAM_PERFECT_ENTRIES; idx++) { + cam->p.physical[idx][0] = 0xFFFF0000; + cam->p.physical[idx][1] = 0xFFFF0000; + cam->p.physical[idx][2] = 0xFFFF0000; + } +#else + cam->p.physical[0][0] = ((uint32_t) sc->hwaddr[0]) | + (((uint32_t) sc->hwaddr[1]) << 8); + cam->p.physical[0][1] = ((uint32_t) sc->hwaddr[2]) | + (((uint32_t) sc->hwaddr[3]) << 8); + cam->p.physical[0][2] = ((uint32_t) sc->hwaddr[4]) | + (((uint32_t) sc->hwaddr[5]) << 8); + for (idx = 1; idx < CAM_PERFECT_ENTRIES; idx++) { + cam->p.physical[idx][0] = 0x0000FFFF; + cam->p.physical[idx][1] = 0x0000FFFF; + cam->p.physical[idx][2] = 0x0000FFFF; + } +#endif + + pkt->flags |= ETH_TX_SETUP; + sc->state = eth_state_setup; + if (tulip_transmit(sc, pkt) != 0) { + xprintf("%s: failed setup\n", tulip_devname(sc)); + dumpstat(sc); + eth_free_pkt(sc, pkt); + } + } +} + +static void +tulip_setspeed(tulip_softc *sc, int speed) +{ + switch (sc->device) { + case K_PCI_ID_DC21040: + dc21040_set_speed(sc, speed); + break; + case K_PCI_ID_DC21041: + dc21041_set_speed(sc, speed); + break; + case K_PCI_ID_DC21140: + dc21140_set_speed(sc, speed, 0); + break; + case K_PCI_ID_DC21143: + dc21143_set_speed(sc, speed); + break; + default: + break; + } +} + +static void +tulip_setloopback(tulip_softc *sc, int mode) +{ + switch (sc->device) { + case K_PCI_ID_DC21040: + dc21040_set_loopback(sc, mode); + break; + case K_PCI_ID_DC21041: + dc21041_set_loopback(sc, mode); + break; + case K_PCI_ID_DC21140: + dc21140_set_loopback(sc, mode); + break; + case K_PCI_ID_DC21143: + dc21143_set_loopback(sc, mode); + break; + default: + break; + } + cfe_sleep(CFE_HZ/10); +} + + +static void +tulip_isr(void *arg) +{ + uint32_t status; + uint32_t csr5; + tulip_softc *sc = (tulip_softc *)arg; + +#if IPOLL + sc->interrupts++; +#endif + + for (;;) { + + /* Read the interrupt status. */ + csr5 = READCSR(sc, R_CSR_STATUS); + status = csr5 & ( + M_CSR5_RXINT | M_CSR5_RXBUFUNAVAIL | + M_CSR5_TXINT | M_CSR5_TXUNDERFLOW | + M_CSR5_FATALBUSERROR); + + /* if there are no more interrupts, leave now. */ + if (status == 0) break; + + /* Clear the pending interrupt. */ + WRITECSR(sc, R_CSR_STATUS, status); + + /* Now, test each unmasked bit in the interrupt register and + handle each interrupt type appropriately. */ + + if (status & M_CSR5_FATALBUSERROR) { + WRITECSR(sc, R_CSR_INTMASK, 0); + + xprintf("%s: bus error %02x\n", + tulip_devname(sc), G_CSR5_ERRORBITS(csr5)); + dumpstat(sc); + sc->bus_errors++; + if (sc->bus_errors >= 2) { + dumpcsrs(sc); + RESET_ADAPTER(sc); + sc->state = eth_state_off; + sc->bus_errors = 0; + } +#if IPOLL + else + WRITECSR(sc, R_CSR_INTMASK, sc->intmask); +#endif + } + + if (status & M_CSR5_RXINT) { +#if IPOLL + sc->rx_interrupts++; +#endif + tulip_procrxring(sc); + } + + if (status & M_CSR5_TXINT) { +#if IPOLL + sc->tx_interrupts++; +#endif + tulip_proctxring(sc); + } + + if (status & (M_CSR5_TXUNDERFLOW | M_CSR5_RXBUFUNAVAIL)) { + if (status & M_CSR5_TXUNDERFLOW) { + xprintf("%s: tx underrun, %08x\n", tulip_devname(sc), csr5); + /* Try to restart */ + WRITECSR(sc, R_CSR_TXPOLL, 1); + } + if (status & M_CSR5_RXBUFUNAVAIL) { + /* Try to restart */ + WRITECSR(sc, R_CSR_RXPOLL, 1); + } + } + } +} + + +static void +tulip_start(tulip_softc *sc) +{ + uint32_t opmode; + + tulip_hwinit(sc); + + WRITECSR(sc, R_CSR_RXRING, PTR_TO_PCI(sc->rxdscr_start)); + WRITECSR(sc, R_CSR_TXRING, PTR_TO_PCI(sc->txdscr_start)); + + opmode = READCSR(sc, R_CSR_OPMODE); + opmode &=~ M_CSR6_OPMODE; /* no loopback */ + if (sc->loopback != ETHER_LOOPBACK_OFF) { + opmode &=~ M_CSR6_FULLDUPLEX; + opmode |= M_CSR6_PORTSEL; + if (sc->loopback == ETHER_LOOPBACK_EXT) + opmode |= M_CSR6_EXTLOOPBACK; + else + opmode |= M_CSR6_INTLOOPBACK; + } + + sc->intmask = 0; + WRITECSR(sc, R_CSR_INTMASK, 0); /* no interrupts */ + WRITECSR(sc, R_CSR_STATUS, 0x1FFFF); /* clear any pending */ + READCSR(sc, R_CSR_STATUS); /* push the write */ + + sc->interrupts = 0; + sc->rx_interrupts = sc->tx_interrupts = 0; + +#if IPOLL + cfe_request_irq(sc->irq, tulip_isr, sc, CFE_IRQ_FLAGS_SHARED, 0); + + sc->intmask = M_CSR7_RXINT | M_CSR7_TXINT | + M_CSR7_NORMALINT; + sc->intmask |= M_CSR7_FATALBUSERROR | M_CSR7_TXUNDERFLOW | + M_CSR7_ABNORMALINT; + WRITECSR(sc, R_CSR_INTMASK, sc->intmask); +#endif + + if (sc->loopback == ETHER_LOOPBACK_OFF) { + opmode |= M_CSR6_TXSTART; + WRITECSR(sc, R_CSR_OPMODE, opmode); + tulip_setaddr(sc); + } + else { + opmode |= M_CSR6_TXSTART | M_CSR6_RXSTART; + WRITECSR(sc, R_CSR_OPMODE, opmode); + } +} + +static void +tulip_stop(tulip_softc *sc) +{ + uint32_t opmode; + uint32_t status; + int count; + + WRITECSR(sc, R_CSR_INTMASK, 0); + sc->intmask = 0; +#if IPOLL + cfe_free_irq(sc->irq, 0); +#endif + WRITECSR(sc, R_CSR_STATUS, 0x1FFFF); + opmode = READCSR(sc, R_CSR_OPMODE); + opmode &=~ (M_CSR6_TXSTART | M_CSR6_RXSTART); + WRITECSR(sc, R_CSR_OPMODE, opmode); + + /* wait for any DMA activity to terminate */ + for (count = 0; count <= 13; count++) { + status = READCSR(sc, R_CSR_STATUS); + if ((status & (M_CSR5_RXPROCSTATE | M_CSR5_TXPROCSTATE)) == 0) + break; + cfe_sleep(CFE_HZ/10); + } + if (count > 13) { + xprintf("%s: idle state not achieved\n", tulip_devname(sc)); + dumpstat(sc); + RESET_ADAPTER(sc); + sc->state = eth_state_uninit; +#if 1 + sc->linkspeed = ETHER_SPEED_AUTO; +#endif + } + else if (sc->loopback != ETHER_LOOPBACK_OFF) { + tulip_setloopback(sc, ETHER_LOOPBACK_OFF); + opmode &=~ M_CSR6_OPMODE; + WRITECSR(sc, R_CSR_OPMODE, opmode); + } + + if (sc->outpkts > 1) { + /* heuristic: suppress stats for initial mode changes */ + xprintf("%s: %d sent, %d received, %d interrupts\n", + tulip_devname(sc), sc->outpkts, sc->inpkts, sc->interrupts); + xprintf(" %d rx interrupts, %d tx interrupts\n", + sc->rx_interrupts, sc->tx_interrupts); + } +} + + +/* ********************************************************************* + * ETH_PARSE_XDIGIT(c) + * + * Parse a hex digit, returning its value + * + * Input parameters: + * c - character + * + * Return value: + * hex value, or -1 if invalid + ********************************************************************* */ +static int +eth_parse_xdigit(char c) +{ + int digit; + + if ((c >= '0') && (c <= '9')) digit = c - '0'; + else if ((c >= 'a') && (c <= 'f')) digit = c - 'a' + 10; + else if ((c >= 'A') && (c <= 'F')) digit = c - 'A' + 10; + else digit = -1; + + return digit; +} + +/* ********************************************************************* + * ETH_PARSE_HWADDR(str,hwaddr) + * + * Convert a string in the form xx:xx:xx:xx:xx:xx into a 6-byte + * Ethernet address. + * + * Input parameters: + * str - string + * hwaddr - pointer to hardware address + * + * Return value: + * 0 if ok, else -1 + ********************************************************************* */ +static int +eth_parse_hwaddr(char *str, uint8_t *hwaddr) +{ + int digit1, digit2; + int idx = ENET_ADDR_LEN; + + while (*str && (idx > 0)) { + digit1 = eth_parse_xdigit(*str); + if (digit1 < 0) return -1; + str++; + if (!*str) return -1; + + if ((*str == ':') || (*str == '-')) { + digit2 = digit1; + digit1 = 0; + } + else { + digit2 = eth_parse_xdigit(*str); + if (digit2 < 0) return -1; + str++; + } + + *hwaddr++ = (digit1 << 4) | digit2; + idx--; + + if ((*str == ':') || (*str == '-')) + str++; + } + return 0; +} + +/* ********************************************************************* + * ETH_INCR_HWADDR(hwaddr,incr) + * + * Increment a 6-byte Ethernet hardware address, with carries + * + * Input parameters: + * hwaddr - pointer to hardware address + * incr - desired increment + * + * Return value: + * none + ********************************************************************* */ +static void +eth_incr_hwaddr(uint8_t *hwaddr, unsigned incr) +{ + int idx; + int carry; + + idx = 5; + carry = incr; + while (idx >= 0 && carry != 0) { + unsigned sum = hwaddr[idx] + carry; + + hwaddr[idx] = sum & 0xFF; + carry = sum >> 8; + idx--; + } +} + + +/* ********************************************************************* + * Declarations for CFE Device Driver Interface routines + ********************************************************************* */ + +static int tulip_ether_open(cfe_devctx_t *ctx); +static int tulip_ether_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tulip_ether_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int tulip_ether_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tulip_ether_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tulip_ether_close(cfe_devctx_t *ctx); +#if 0 +static void tulip_ether_reset(void *softc); +#endif + +/* ********************************************************************* + * CFE Device Driver dispatch structure + ********************************************************************* */ + +const static cfe_devdisp_t tulip_ether_dispatch = { + tulip_ether_open, + tulip_ether_read, + tulip_ether_inpstat, + tulip_ether_write, + tulip_ether_ioctl, + tulip_ether_close, + NULL, /* tulip_ether_poll */ + NULL /* tulip_ether_reset */ +}; + +/* ********************************************************************* + * CFE Device Driver descriptor + ********************************************************************* */ + +const cfe_driver_t dc21143drv = { + "DC21x4x Ethernet", + "eth", + CFE_DEV_NETWORK, + &tulip_ether_dispatch, + tulip_ether_probe +}; + + +static int +tulip_ether_attach(cfe_driver_t *drv, + pcitag_t tag, int index, uint8_t hwaddr[]) +{ + tulip_softc *softc; + uint32_t device; + uint32_t class; + uint32_t reg; + phys_addr_t pa; + const char *devname; + char descr[100]; + uint8_t romaddr[ENET_ADDR_LEN]; + + device = pci_conf_read(tag, R_CFG_CFID); + class = pci_conf_read(tag, R_CFG_CFRV); + + reg = pci_conf_read(tag, R_CFG_CPMS); + + reg = pci_conf_read(tag, R_CFG_CFDD); + pci_conf_write(tag, R_CFG_CFDD, 0); + reg = pci_conf_read(tag, R_CFG_CFDD); + +#if 1 + /* Use memory space for the CSRs */ + pci_map_mem(tag, R_CFG_CBMA, PCI_MATCH_BITS, &pa); +#else + /* Use i/o space for the CSRs */ + pci_map_io(tag, R_CFG_CBIO, PCI_MATCH_BITS, &pa); +#endif + + softc = (tulip_softc *) KMALLOC(sizeof(tulip_softc), 0); + if (softc == NULL) { + xprintf("DC21x4x: No memory to complete probe\n"); + return 0; + } + memset(softc, 0, sizeof(*softc)); + + softc->membase = (uint32_t)pa; + softc->irq = pci_conf_read(tag, R_CFG_CFIT) & 0xFF; + + softc->tag = tag; + softc->device = PCI_PRODUCT(device); + softc->revision = PCI_REVISION(class); + softc->devctx = NULL; + +#if 1 + softc->linkspeed = ETHER_SPEED_AUTO; /* select autonegotiation */ +#else + softc->linkspeed = ETHER_SPEED_100FDX; /* 100 Mbps, full duplex */ +#endif + softc->loopback = ETHER_LOOPBACK_OFF; + memcpy(softc->hwaddr, hwaddr, ENET_ADDR_LEN); + + tulip_init(softc); + + /* Prefer address in srom */ + if (rom_read_addr(softc, romaddr) == 0) { + memcpy(softc->hwaddr, romaddr, ENET_ADDR_LEN); + } + + softc->state = eth_state_uninit; + + switch (PCI_PRODUCT(device)) { + case K_PCI_ID_DC21040: + devname = "DC21040"; break; + case K_PCI_ID_DC21041: + devname = "DC21041"; break; + case K_PCI_ID_DC21140: + devname = "DC21140"; break; + case K_PCI_ID_DC21143: + devname = "DC21143"; break; + default: + devname = "DC21x4x"; break; + } + + xsprintf(descr, "%s Ethernet at 0x%X (%02X-%02X-%02X-%02X-%02X-%02X)", + devname, softc->membase, + softc->hwaddr[0], softc->hwaddr[1], softc->hwaddr[2], + softc->hwaddr[3], softc->hwaddr[4], softc->hwaddr[5]); + + cfe_attach(drv, softc, NULL, descr); + return 1; +} + + +/* ********************************************************************* + * TULIP_ETHER_PROBE(drv,probe_a,probe_b,probe_ptr) + * + * Probe and install drivers for all DC21x4x Ethernet controllers. + * For each, create a context structure and attach to the + * specified network device. + * + * Input parameters: + * drv - driver descriptor + * probe_a - not used + * probe_b - not used + * probe_ptr - string pointer to hardware address for the first + * MAC, in the form xx:xx:xx:xx:xx:xx + * + * Return value: + * nothing + ********************************************************************* */ +static void +tulip_ether_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + int index; + int n; + uint8_t hwaddr[ENET_ADDR_LEN]; + + if (probe_ptr) + eth_parse_hwaddr((char *) probe_ptr, hwaddr); + else { + /* use default address 40-00-00-10-11-11 */ + hwaddr[0] = 0x40; hwaddr[1] = 0x00; hwaddr[2] = 0x00; + hwaddr[3] = 0x10; hwaddr[4] = 0x11; hwaddr[5] = 0x11; + } + + n = 0; + index = 0; + for (;;) { + pcitag_t tag; + pcireg_t device; + + if (pci_find_class(PCI_CLASS_NETWORK, index, &tag) != 0) + break; + + index++; + + device = pci_conf_read(tag, R_CFG_CFID); + if (PCI_VENDOR(device) == K_PCI_VENDOR_DEC) { +#if 0 /* this currently (2.1.1) generates a bad code in PIC mode */ + switch (PCI_PRODUCT(device)) { + case K_PCI_ID_DC21040: + case K_PCI_ID_DC21041: + case K_PCI_ID_DC21140: + case K_PCI_ID_DC21143: + tulip_ether_attach(drv, tag, n, hwaddr); + n++; + eth_incr_hwaddr(hwaddr, 1); + break; + default: + break; + } +#else + if (PCI_PRODUCT(device) == K_PCI_ID_DC21040 || + PCI_PRODUCT(device) == K_PCI_ID_DC21041 || + PCI_PRODUCT(device) == K_PCI_ID_DC21140 || + PCI_PRODUCT(device) == K_PCI_ID_DC21143) { + + tulip_ether_attach(drv, tag, n, hwaddr); + n++; + eth_incr_hwaddr(hwaddr, 1); + } +#endif + } + } +} + + +/* The functions below are called via the dispatch vector for the 21x4x. */ + +/* ********************************************************************* + * TULIP_ETHER_OPEN(ctx) + * + * Open the Ethernet device. The MAC is reset, initialized, and + * prepared to receive and send packets. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_open(cfe_devctx_t *ctx) +{ + tulip_softc *softc = ctx->dev_softc; + + if (softc->state == eth_state_on) + tulip_stop(softc); + + softc->devctx = ctx; + tulip_start(softc); + +#if XPOLL + tulip_isr(softc); +#endif + + return 0; +} + +/* ********************************************************************* + * TULIP_ETHER_READ(ctx,buffer) + * + * Read a packet from the Ethernet device. If no packets are + * available, the read will succeed but return 0 bytes. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + tulip_softc *softc = ctx->dev_softc; + eth_pkt_t *pkt; + int blen; + +#if XPOLL + tulip_isr(softc); +#endif + + if (softc->state != eth_state_on) return -1; + + CS_ENTER(softc); + pkt = (eth_pkt_t *) q_deqnext(&(softc->rxqueue)); + CS_EXIT(softc); + + if (pkt == NULL) { + buffer->buf_retlen = 0; + return 0; + } + + blen = buffer->buf_length; + if (blen > pkt->length) blen = pkt->length; + + blockcopy(buffer->buf_ptr, pkt->buffer, blen); + buffer->buf_retlen = blen; + + eth_free_pkt(softc, pkt); + tulip_fillrxring(softc); + +#if XPOLL + tulip_isr(softc); +#endif + + return 0; +} + +/* ********************************************************************* + * TULIP_ETHER_INPSTAT(ctx,inpstat) + * + * Check for received packets on the Ethernet device + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * inpstat - pointer to input status structure + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + tulip_softc *softc = ctx->dev_softc; + +#if XPOLL + tulip_isr(softc); +#endif + + if (softc->state != eth_state_on) return -1; + + /* We avoid an interlock here because the result is a hint and an + interrupt cannot turn a non-empty queue into an empty one. */ + inpstat->inp_status = (q_isempty(&(softc->rxqueue))) ? 0 : 1; + + return 0; +} + +/* ********************************************************************* + * TULIP_ETHER_WRITE(ctx,buffer) + * + * Write a packet to the Ethernet device. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + tulip_softc *softc = ctx->dev_softc; + eth_pkt_t *pkt; + int blen; + +#if XPOLL + tulip_isr(softc); +#endif + + if (softc->state != eth_state_on) return -1; + + pkt = eth_alloc_pkt(softc); + if (!pkt) return CFE_ERR_NOMEM; + + blen = buffer->buf_length; + if (blen > pkt->length) blen = pkt->length; + + blockcopy(pkt->buffer, buffer->buf_ptr, blen); + pkt->length = blen; + + if (tulip_transmit(softc, pkt) != 0) { + eth_free_pkt(softc,pkt); + return CFE_ERR_IOERR; + } + +#if XPOLL + tulip_isr(softc); +#endif + + return 0; +} + +/* ********************************************************************* + * TULIP_ETHER_IOCTL(ctx,buffer) + * + * Do device-specific I/O control operations for the device + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * buffer - pointer to buffer descriptor. + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + tulip_softc *softc = ctx->dev_softc; + int *argp; + int mode; + int speed; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_ETHER_GETHWADDR: + memcpy(buffer->buf_ptr, softc->hwaddr, sizeof(softc->hwaddr)); + return 0; + + case IOCTL_ETHER_SETHWADDR: + return -1; /* not supported */ + + case IOCTL_ETHER_GETSPEED: + argp = (int *) buffer->buf_ptr; + *argp = softc->linkspeed; + return 0; + + case IOCTL_ETHER_SETSPEED: + tulip_stop(softc); + tulip_resetrings(softc); + speed = *((int *) buffer->buf_ptr); + tulip_setspeed(softc, speed); + tulip_start(softc); + softc->state = eth_state_on; + return 0; + + case IOCTL_ETHER_GETLINK: + argp = (int *) buffer->buf_ptr; + *argp = softc->linkspeed; + return 0; + + case IOCTL_ETHER_GETLOOPBACK: + *((int *) buffer) = softc->loopback; + return 0; + + case IOCTL_ETHER_SETLOOPBACK: + tulip_stop(softc); + tulip_resetrings(softc); + mode = *((int *) buffer->buf_ptr); + softc->loopback = ETHER_LOOPBACK_OFF; /* default */ + if (mode == ETHER_LOOPBACK_INT || mode == ETHER_LOOPBACK_EXT) { + tulip_setloopback(softc, mode); + } + tulip_start(softc); + softc->state = eth_state_on; + return 0; + + default: + return -1; + } +} + +/* ********************************************************************* + * TULIP_ETHER_CLOSE(ctx) + * + * Close the Ethernet device. + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * + * Return value: + * status, 0 = ok + ********************************************************************* */ +static int +tulip_ether_close(cfe_devctx_t *ctx) +{ + tulip_softc *softc = ctx->dev_softc; + + softc->state = eth_state_off; + tulip_stop(softc); + + /* resynchronize descriptor rings */ + tulip_resetrings(softc); + + softc->devctx = NULL; + return 0; +} + + +#if 0 +/* ********************************************************************* + * TULIP_ETHER_POLL(ctx,ticks) + * + * TBD + * + * Input parameters: + * ctx - device context (includes ptr to our softc) + * ticks- current time in ticks + * + * Return value: + * nothing + ********************************************************************* */ + +static void +tulip_ether_poll(cfe_devctx_t *ctx, int64_t ticks) +{ +} + +/* ********************************************************************* + * TULIP_ETHER_RESET(softc) + * + * This routine is called when CFE is restarted after a + * program exits. We can clean up pending I/Os here. + * + * Input parameters: + * softc - pointer to tulip_softc + * + * Return value: + * nothing + ********************************************************************* */ + +static void +tulip_ether_reset(void *softc) +{ + tulip_softc *sc = (tulip_softc *)softc; + + /* Turn off the Ethernet interface. */ + + RESET_ADAPTER(sc); +} +#endif diff --git a/cfe/cfe/dev/dp83815.h b/cfe/cfe/dev/dp83815.h new file mode 100644 index 0000000..1d50422 --- /dev/null +++ b/cfe/cfe/dev/dp83815.h @@ -0,0 +1,559 @@ +/* + * Register and bit definitions for the National Semiconductor + * DP83815 10/100 Integrated Ethernet MAC and PHY. + * Reference: + * DP83815 10/100 Mb/s Integrated PCI Ethernet Media Access + * Controller and Physical Layer (MacPhyter) + * Hardware Reference Manual, Revision 1.0. + * National Semiconductor Corp., December 2000 + */ +#ifndef _DP83815_H_ +#define _DP83815_H_ + +#define _DD_MAKEMASK1(n) (1 << (n)) +#define _DD_MAKEMASK(v,n) ((((1)<<(v))-1) << (n)) +#define _DD_MAKEVALUE(v,n) ((v) << (n)) +#define _DD_GETVALUE(v,n,m) (((v) & (m)) >> (n)) + + +/* PCI Configuration Register offsets (MacPhyter nomenclature) */ + +#define R_CFGID PCI_ID_REG +#define K_PCI_VENDOR_NSC 0x100B +#define K_PCI_ID_DP83815 0x0020 + +#define R_CFGCS PCI_COMMAND_STATUS_REG +#define R_CFGRID PCI_CLASS_REG +#define R_CFGLAT PCI_BHLC_REG + +#define R_CFGIOA PCI_MAPREG(0) +#define R_CFGMA PCI_MAPREG(1) + +#define R_CFGSID PCI_SUBSYS_ID_REG +#define R_CFGROM PCI_MAPREG_ROM +#define R_CAPPTR PCI_CAPLISTPTR_REG +#define R_CFGINT PCI_BPARAM_INTERRUPT_REG + +/* Power management capability */ +#define R_PMCAP 0x40 +#define R_PMCSR 0x44 + + +/* MacPhyter Operational Register offsets */ + +#define R_CR 0x00 +#define R_CFG 0x04 +#define R_MEAR 0x08 +#define R_PTSCR 0x0C +#define R_ISR 0x10 +#define R_IMR 0x14 +#define R_IER 0x18 +#define R_TXDP 0x20 +#define R_TXCFG 0x24 +#define R_RXDP 0x30 +#define R_RXCFG 0x34 +#define R_CCSR 0x3C +#define R_WCSR 0x40 +#define R_PCR 0x44 +#define R_RFCR 0x48 +#define R_RFDR 0x4C +#define R_BRAR 0x50 +#define R_BRDR 0x54 +#define R_SRR 0x58 +#define R_MIBC 0x5C +#define R_MIB(n) (0x60+4*(n)) + +/* MacPhyter MIB Registers */ + +#define R_MIB_RXErroredPkts R_MIB(0) +#define R_MIB_RXFCSErrors R_MIB(1) +#define R_MIB_RXMsdPktErrors R_MIB(2) +#define R_MIB_RXFAErrors R_MIB(3) +#define R_MIB_RXSymbolErrors R_MIB(4) +#define R_MIB_RXFrameTooLong R_MIB(5) +#define R_MIB_TXSQEErrors R_MIB(6) + +#define N_MIB_REGISTERS 7 + + +/* MacPhyter Internal PHY Register offsets */ + +#define R_BMCR 0x80 +#define R_BMSR 0x84 +#define R_PHYIDR1 0x88 +#define R_PHYIDR2 0x8C +#define R_ANAR 0x90 +#define R_ANLPAR 0x94 +#define R_ANER 0x98 +#define R_ANNPTR 0x9C +#define R_PHYSTS 0xC0 +#define R_MICR 0xC4 +#define R_MISR 0xC8 +#define R_FCSCR 0xD0 +#define R_RECR 0xD4 +#define R_PHYCR 0xE4 +#define R_TBTSCR 0xE8 + +/* Undocumented, updated for CVNG (SRR=0x0302) parts */ + +#define R_PGSEL 0xCC +#define R_PMDCSR 0xE4 /* R_PHYCR */ +#define R_DSPCFG 0xF4 +#define R_SDCFG 0xF8 +#define R_TSTDAT 0xFC + + +/* 0x00 CR: Command Register */ + +#define M_CR_TXE _DD_MAKEMASK1(0) +#define M_CR_TXD _DD_MAKEMASK1(1) +#define M_CR_RXE _DD_MAKEMASK1(2) +#define M_CR_RXD _DD_MAKEMASK1(3) +#define M_CR_TXR _DD_MAKEMASK1(4) +#define M_CR_RXR _DD_MAKEMASK1(5) +#define M_CR_SWI _DD_MAKEMASK1(7) +#define M_CR_RST _DD_MAKEMASK1(8) + + +/* 0x04 CFG: Configuration and Media Status Register */ + +#define M_CFG_BEM _DD_MAKEMASK1(0) +#define M_CFG_BROM_DIS _DD_MAKEMASK1(2) +#define M_CFG_PESEL _DD_MAKEMASK1(3) +#define M_CFG_EXD _DD_MAKEMASK1(4) +#define M_CFG_POW _DD_MAKEMASK1(5) +#define M_CFG_SB _DD_MAKEMASK1(6) +#define M_CFG_REQALG _DD_MAKEMASK1(7) +#define M_CFG_EUPHCOMP _DD_MAKEMASK1(8) +#define M_CFG_PHY_DIS _DD_MAKEMASK1(9) +#define M_CFG_PHY_RST _DD_MAKEMASK1(10) +#define M_CFG_EXT_PHY _DD_MAKEMASK1(12) + +#define S_CFG_ANEG_SEL 13 +#define M_CFG_ANEG_SEL _DD_MAKEMASK(3,S_CFG_ANEG_SEL) +#define V_CFG_ANEG_SEL(x) _DD_MAKEVALUE(x,S_CFG_ANEG_SEL) +#define G_CFG_ANEG_SEL(x) _DD_GETVALUE(x,S_CFG_ANEG_SEL,M_CFG_ANEG_SEL) + +#define K_ANEG_10H 0x0 +#define K_ANEG_100H 0x2 +#define K_ANEG_10F 0x4 +#define K_ANEG_100F 0x6 +#define K_ANEG_10HF 0x1 +#define K_ANEG_10H_100H 0x3 +#define K_ANEG_100HF 0x5 +#define K_ANEG_10HF_100HF 0x7 +#define K_ANEG_ALL 0x7 + +#define M_CFG_PAUSE_ADV _DD_MAKEMASK1(16) +#define M_CFG_PINT_ACEN _DD_MAKEMASK1(17) + +#define S_CFG_PHY_CFG 18 +#define M_CFG_PHY_CFG _DD_MAKEMASK(6,S_CFG_PHY_CFG) + +#define M_CFG_ANEG_DN _DD_MAKEMASK1(27) +#define M_CFG_POL _DD_MAKEMASK1(28) +#define M_CFG_FDUP _DD_MAKEMASK1(29) +#define M_CFG_SPEED100 _DD_MAKEMASK1(30) +#define M_CFG_LNKSTS _DD_MAKEMASK1(31) +#define M_CFG_LNKSUMMARY (M_CFG_LNKSTS | M_CFG_SPEED100 | M_CFG_FDUP) + + +/* 0x08 MEAR: EEPROM Access Register (see 4.2.4 for EEPROM Map) */ + +#define M_MEAR_EEDI _DD_MAKEMASK1(0) +#define M_MEAR_EEDO _DD_MAKEMASK1(1) +#define M_MEAR_EECLK _DD_MAKEMASK1(2) +#define M_MEAR_EESEL _DD_MAKEMASK1(3) +#define M_MEAR_MDIO _DD_MAKEMASK1(4) +#define M_MEAR_MDDIR _DD_MAKEMASK1(5) +#define M_MEAR_MDC _DD_MAKEMASK1(6) + + +/* 0x0C PTSCR: PCI Test Control Register */ + +#define M_PTSCR_EEBIST_FAIL _DD_MAKEMASK1(0) +#define M_PTSCR_EEBIST_EN _DD_MAKEMASK1(1) +#define M_PTSCR_EELOAD_EN _DD_MAKEMASK1(2) +#define M_PTSCR_RBIST_RXFFAIL _DD_MAKEMASK1(3) +#define M_PTSCR_RBIST_TXFAIL _DD_MAKEMASK1(4) +#define M_PTSCR_RBIST_RXFAIL _DD_MAKEMASK1(5) +#define M_PTSCR_RBIST_DONE _DD_MAKEMASK1(6) +#define M_PTSCR_RBIST_EN _DD_MAKEMASK1(7) +#define M_PTSCR_MBZ8 _DD_MAKEMASK1(8) +#define M_PTSCR_MBZ9 _DD_MAKEMASK1(9) +#define M_PTSCR_RBIST_RST _DD_MAKEMASK1(10) +#define M_PTSCR_MBZ12 _DD_MAKEMASK1(12) + + +/* 0x10 ISR: Interrupt Status Register */ +/* 0x14 IMR: Interrupt Mask Register */ + +#define M_INT_RXOK _DD_MAKEMASK1(0) +#define M_INT_RXDESC _DD_MAKEMASK1(1) +#define M_INT_RXERR _DD_MAKEMASK1(2) +#define M_INT_RXEARLY _DD_MAKEMASK1(3) +#define M_INT_RXIDLE _DD_MAKEMASK1(4) +#define M_INT_RXORN _DD_MAKEMASK1(5) +#define M_INT_TXOK _DD_MAKEMASK1(6) +#define M_INT_TXDESC _DD_MAKEMASK1(7) +#define M_INT_TXERR _DD_MAKEMASK1(8) +#define M_INT_TXIDLE _DD_MAKEMASK1(9) +#define M_INT_TXURN _DD_MAKEMASK1(10) +#define M_INT_MIB _DD_MAKEMASK1(11) +#define M_INT_SWI _DD_MAKEMASK1(12) +#define M_INT_PME _DD_MAKEMASK1(13) +#define M_INT_PHY _DD_MAKEMASK1(14) +#define M_INT_HIBERR _DD_MAKEMASK1(15) +#define M_INT_RXSOVR _DD_MAKEMASK1(16) +#define M_INT_RTABT _DD_MAKEMASK1(20) +#define M_INT_RMABT _DD_MAKEMASK1(21) +#define M_INT_SSERR _DD_MAKEMASK1(22) +#define M_INT_DPERR _DD_MAKEMASK1(23) +#define M_INT_RXRCMP _DD_MAKEMASK1(24) +#define M_INT_TXRCMP _DD_MAKEMASK1(25) + + +/* 0x18 IER: Interrupt Enable Register */ + +#define M_IER_IE _DD_MAKEMASK1(0) + + +/* 0x20 TXDP: Transmit Descriptor Pointer Register */ + + +/* 0x24 TXCFG: Transmit Configuration Register */ + +#define S_TXCFG_DRTH 0 +#define M_TXCFG_DRTH _DD_MAKEMASK(6,S_TXCFG_DRTH) +#define V_TXCFG_DRTH(x) _DD_MAKEVALUE(x,S_TXCFG_DRTH) +#define G_TXCFG_DRTH(x) _DD_GETVALUE(x,S_TXCFG_DRTH,M_TXCFG_DRTH) + +#define S_TXCFG_FLTH 8 +#define M_TXCFG_FLTH _DD_MAKEMASK(6,S_TXCFG_FLTH) +#define V_TXCFG_FLTH(x) _DD_MAKEVALUE(x,S_TXCFG_FLTH) +#define G_TXCFG_FLTH(x) _DD_GETVALUE(x,S_TXCFG_FLTH,M_TXCFG_FLTH) + +#define S_TXCFG_MXDMA 20 +#define M_TXCFG_MXDMA _DD_MAKEMASK(3,S_TXCFG_MXDMA) +#define V_TXCFG_MXDMA(x) _DD_MAKEVALUE(x,S_TXCFG_MXDMA) +#define G_TXCFG_MXDMA(x) _DD_GETVALUE(x,S_TXCFG_MXDMA,M_TXCFG_MXDMA) + +/* Max DMA burst size (bytes) - RX also */ +#define K_MXDMA_512 0x0 +#define K_MXDMA_4 0x1 +#define K_MXDMA_8 0x2 +#define K_MXDMA_16 0x3 +#define K_MXDMA_32 0x4 +#define K_MXDMA_64 0x5 +#define K_MXDMA_128 0x6 +#define K_MXDMA_256 0x7 + +#define M_TXCFG_ECRETRY _DD_MAKEMASK1(23) + +#define S_TXCFG_IFG 26 +#define M_TXCFG_IFG _DD_MAKEMASK(2,S_TXCFG_IFG) +#define V_TXCFG_IFG(x) _DD_MAKEVALUE(x,S_TXCFG_IFG) +#define G_TXCFG_IFG(x) _DD_GETVALUE(x,S_TXCFG_IFG,M_TXCFG_IFG) + +#define M_TXCFG_ATP _DD_MAKEMASK1(28) +#define M_TXCFG_MLB _DD_MAKEMASK1(29) +#define M_TXCFG_HBI _DD_MAKEMASK1(30) +#define M_TXCFG_CSI _DD_MAKEMASK1(31) + + +/* 0x30 RXDP: Receive Descriptor Pointer Register */ + + +/* 0x34 RXCFG: Receive Configuration Register */ + +#define S_RXCFG_DRTH 1 +#define M_RXCFG_DRTH _DD_MAKEMASK(5,S_RXCFG_DRTH) +#define V_RXCFG_DRTH(x) _DD_MAKEVALUE(x,S_RXCFG_DRTH) +#define G_RXCFG_DRTH(x) _DD_GETVALUE(x,S_RXCFG_DRTH,M_RXCFG_DRTH) + +#define S_RXCFG_MXDMA 20 +#define M_RXCFG_MXDMA _DD_MAKEMASK(3,S_RXCFG_MXDMA) +#define V_RXCFG_MXDMA(x) _DD_MAKEVALUE(x,S_RXCFG_MXDMA) +#define G_RXCFG_MXDMA(x) _DD_GETVALUE(x,S_RXCFG_MXDMA,M_RXCFG_MXDMA) + +#define M_RXCFG_ALP _DD_MAKEMASK1(27) +#define M_RXCFG_ATX _DD_MAKEMASK1(28) +#define M_RXCFG_ARP _DD_MAKEMASK1(30) +#define M_RXCFG_AEP _DD_MAKEMASK1(31) + + +/* 0x3C CCSR: CLKRUN Control/Status Register */ + +#define M_CCSR_CLKRUN_EN _DD_MAKEMASK1(0) +#define M_CCSR_PMEEN _DD_MAKEMASK1(8) +#define M_CCSR_PMESTS _DD_MAKEMASK1(15) + + +/* 0x40 WCSR: Wake Command/Status Register */ + +#define M_WCSR_WKPHY _DD_MAKEMASK1(0) +#define M_WCSR_WKUCP _DD_MAKEMASK1(1) +#define M_WCSR_WKMCP _DD_MAKEMASK1(2) +#define M_WCSR_WKBCP _DD_MAKEMASK1(3) +#define M_WCSR_WKARP _DD_MAKEMASK1(4) +#define M_WCSR_WKPAT0 _DD_MAKEMASK1(5) +#define M_WCSR_WKPAT1 _DD_MAKEMASK1(6) +#define M_WCSR_WKPAT2 _DD_MAKEMASK1(7) +#define M_WCSR_WKPAT3 _DD_MAKEMASK1(8) +#define M_WCSR_WKMAG _DD_MAKEMASK1(9) +#define M_WCSR_MPSOE _DD_MAKEMASK1(10) +#define M_WCSR_SOHACK _DD_MAKEMASK1(20) +#define M_WCSR_PHYINT _DD_MAKEMASK1(22) +#define M_WCSR_UCASTR _DD_MAKEMASK1(23) +#define M_WCSR_MCASTR _DD_MAKEMASK1(24) +#define M_WCSR_BCASTR _DD_MAKEMASK1(25) +#define M_WCSR_ARPR _DD_MAKEMASK1(26) +#define M_WCSR_PATM0 _DD_MAKEMASK1(27) +#define M_WCSR_PATM1 _DD_MAKEMASK1(28) +#define M_WCSR_PATM2 _DD_MAKEMASK1(29) +#define M_WCSR_PATM3 _DD_MAKEMASK1(30) +#define M_WCSR_MPR _DD_MAKEMASK1(31) + + +/* 0x44 PCR: Pause Control/Status Register */ + +#define S_PCR_PAUSE_CNT 0 +#define M_PCR_PAUSE_CNT _DD_MAKEMASK(16,S_PCR_PAUSE_CNT) +#define V_PCR_PAUSE_CNT(x) _DD_MAKEVALUE(x,S_PCR_PAUSE_CNT) +#define G_PCR_PAUSE_CNT(x) _DD_GETVALUE(x,S_PCR_PAUSE_CNT,M_PCR_PAUSE_CNT) + +#define M_PCR_MLD_EN _DD_MAKEMASK1(16) +#define M_PCR_PSNEG _DD_MAKEMASK1(21) +#define M_PCR_PS_RCVD _DD_MAKEMASK1(22) +#define M_PCR_PS_ACT _DD_MAKEMASK1(23) +#define M_PCR_PS_DA _DD_MAKEMASK1(29) +#define M_PCR_PS_MCAST _DD_MAKEMASK1(30) +#define M_PCR_PSEN _DD_MAKEMASK1(31) + + +/* 0x48 RFCR: Receive Filter/Match Control Register */ + + +#define S_RFCR_RFADDR 0 +#define M_RFCR_RFADDR _DD_MAKEMASK(10,S_RFCR_RFADDR) +#define V_RFCR_RFADDR(x) _DD_MAKEVALUE(x,S_RFCR_RFADDR) +#define G_RFCR_RFADDR(x) _DD_GETVALUE(x,S_RFCR_RFADDR,M_RFCR_RFADDR) + +#define K_RFCR_PMATCH_ADDR 0x000 +#define K_RFCR_PCOUNT_ADDR 0x006 +#define K_RFCR_FILTER_ADDR 0x200 + +#define M_RFCR_ULM _DD_MAKEMASK1(19) +#define M_RFCR_UHEN _DD_MAKEMASK1(20) +#define M_RFCR_MHEN _DD_MAKEMASK1(21) +#define M_RFCR_AARP _DD_MAKEMASK1(22) +#define M_RFCR_APAT0 _DD_MAKEMASK1(23) +#define M_RFCR_APAT1 _DD_MAKEMASK1(24) +#define M_RFCR_APAT2 _DD_MAKEMASK1(25) +#define M_RFCR_APAT3 _DD_MAKEMASK1(26) +#define M_RFCR_APAT (M_RFCR_APAT0 | M_RFCR_APAT1 | \ + M_RFCR_APAT2 | M_RFCR_APAT3 ) +#define M_RFCR_APM _DD_MAKEMASK1(27) +#define M_RFCR_AAU _DD_MAKEMASK1(28) +#define M_RFCR_AAM _DD_MAKEMASK1(29) +#define M_RFCR_AAB _DD_MAKEMASK1(30) +#define M_RFCR_RFEN _DD_MAKEMASK1(31) + + +/* 0x4C RFDR: Receive Filter/Match Data Register */ + +#define S_RFDR_RFDATA 0 +#define M_RFDR_RFDATA _DD_MAKEMASK(16,S_RFDR_RFDATA) +#define V_RFDR_RFDATA(x) _DD_MAKEVALUE(x,S_RFDR_RFDATA) +#define G_RFDR_RFDATA(x) _DD_GETVALUE(x,S_RFDR_RFDATA,M_RFDR_RFDATA) + +#define S_RFDR_BMASK 16 +#define M_RFDR_BMASK _DD_MAKEMASK(2,S_RFDR_BMASK) +#define V_RFDR_BMASK(x) _DD_MAKEVALUE(x,S_RFDR_BMASK) +#define G_RFDR_BMASK(x) _DD_GETVALUE(x,S_RFDR_BMASK,M_RFDR_BMASK) + + +/* 0x50 BRAR: Boot ROM Address Register */ + +#define S_BRAR_ADDR 0 +#define M_BRAR_ADDR _DD_MAKEMASK(16,S_BRAR_ADDR) +#define V_BRAR_ADDR(x) _DD_MAKEVALUE(x,S_BRAR_ADDR) +#define G_BRAR_ADDR(x) _DD_GETVALUE(x,S_BRAR_ADDR,M_BRAR_ADDR) + +#define M_BRAR_AUTOINC _DD_MAKEMASK1(31) + + +/* 0x54 BRDR: Boot ROM Data Register */ + + +/* 0x58 SRR: Silicon Revision Register */ + +#define S_SRR_REV 0 +#define M_SRR_REV _DD_MAKEMASK(16,S_SRR_REV) +#define V_SRR_REV(x) _DD_MAKEVALUE(x,S_SRR_REV) +#define G_SRR_REV(x) _DD_GETVALUE(x,S_SRR_REV,M_SRR_REV) + +#define K_REV_CVNG 0x00000302 +#define K_REV_DVNG_UJB 0x00000403 + + +/* 0x5C MIBC: Management Information Base Control Register */ + +#define M_MIBC_WRN _DD_MAKEMASK1(0) +#define M_MIBC_FRZ _DD_MAKEMASK1(1) +#define M_MIBC_ACLR _DD_MAKEMASK1(2) +#define M_MIBC_MIBS _DD_MAKEMASK1(3) + + +/* MIB Counters */ + +/* 0x60 RXErroredPkts */ +/* 0x64 RXFCSErrors */ +/* 0x68 RXMsdPktErrors */ +/* 0x6C RXFAErrors */ +/* 0x70 RXSymbolErrors */ +/* 0x74 RXFrameTooLong */ +/* 0x78 TXSQEErrors */ + + +/* See ../net/mii.h for fields of standard (MII) PHY registers */ + +#define K_83815_PHYID1 0x2000 +#define K_83815_PHYID2 0x5C21 + +#define K_ANNPTR_NULL 0x0001 + + +/* 0xC0 PHYSTS: PHY Status Register */ + +#define PHYSTS_RXERRLATCH 0x2000 +#define PHYSTS_POLARITYSTAT 0x1000 +#define PHYSTS_FALSECARRLATCH 0x0800 +#define PHYSTS_SIGNALDETECT 0x0400 +#define PHYSTS_DESCRAMBLOCK 0x0200 +#define PHYSTS_PAGERECVD 0x0100 +#define PHYSTS_MIIINT 0x0080 +#define PHYSTS_REMOTEFAULT 0x0040 +#define PHYSTS_JABBERDET 0x0020 +#define PHYSTS_ANCOMPLETE 0x0010 +#define PHYSTS_LOOPBACK 0x0008 +#define PHYSTS_DUPLEX 0x0004 +#define PHYSTS_SPEED10 0x0002 +#define PHYSTS_LINKSTAT 0x0001 + + +/* 0xC4 MICR: MII Interrupt Control Register */ + +#define MICR_INTEN 0x0002 +#define MICR_TINT 0x0001 + + +/* 0xC8 MISR: MII Interrupt Status and Misc. Control Register */ + +#define MISR_MINT 0x8000 +#define MISR_MSKLINK 0x4000 +#define MISR_MSKJAB 0x2000 +#define MISR_MSKRF 0x1000 +#define MISR_MSKANC 0x0800 +#define MISR_MSKFHF 0x0400 +#define MISR_MSKRHF 0x0200 + + +/* 0xD0 FCSCR: False Carrier Sense Counter Register */ + +#define FCSCR_FCSCNT 0x00FF + + +/* 0xD4 RECR: Receiver Error Counter Register */ + +#define RECR_RXERCNT 0x00FF + + +/* 0xD8 PCSR: 100 Mb/s PCS Configuration and Status Register */ + +#define PCSR_BYP4B5B 0x1000 +#define PCSR_FREECLK 0x0800 +#define PCSR_TQEN 0x0400 +#define PCSR_SDFORCEB 0x0200 +#define PCSR_SDOPTION 0x0100 +#define PCSR_FORCE100OK 0x0020 +#define PCSR_NRZIBYPASS 0x0004 + + +/* 0xE4 PHYCR: PHY Control Register */ + +#define PHYCR_PSR15 0x0800 +#define PHYCR_BISTSTATUS 0x0400 +#define PHYCR_BISTSTART 0x0200 +#define PHYCR_BPSTRETCH 0x0100 +#define PHYCR_PAUSESTS 0x0080 +#define PHYCR_PHYADDR 0x001F + + +/* 0xE8 TBTSCR: 10Base-T Status/Control Register */ + +#define TBTSCR_LPBK10DIS 0x0100 +#define TBTSCR_LPDIS 0x0080 +#define TBTSCR_FORCELINK10 0x0040 +#define TBTSCR_FORCEPOLCOR 0x0020 +#define TBTSCR_POLARITY 0x0010 +#define TBTSCR_AUTOPOLDIS 0x0008 +#define TBTSCR_HBDIS 0x0002 +#define TBTSCR_JABBERDIS 0x0001 + + +/* MacPhyter Transmit and Receive Descriptors */ + +/* Common Command/Status Fields */ +#define S_DES1_SIZE 0 +#define M_DES1_SIZE _DD_MAKEMASK(12,S_DES1_SIZE) +#define V_DES1_SIZE(x) _DD_MAKEVALUE(x,S_DES1_SIZE) +#define G_DES1_SIZE(x) _DD_GETVALUE(x,S_DES1_SIZE,M_DES1_SIZE) + +#define M_DES1_OK _DD_MAKEMASK1(27) +#define M_DES1_INTR _DD_MAKEMASK1(29) +#define M_DES1_MORE _DD_MAKEMASK1(30) +#define M_DES1_OWN _DD_MAKEMASK1(31) + +/* Transmit Command/Status Bits */ +#define S_DES1_CCNT 16 +#define M_DES1_CCNT _DD_MAKEMASK(4,S_DES1_CCNT) +#define V_DES1_CCNT(x) _DD_MAKEVALUE(x,S_DES1_CCNT) +#define G_DES1_CCNT(x) _DD_GETVALUE(x,S_DES1_CCNT,M_DES1_CCNT) + +#define M_DES1_EC _DD_MAKEMASK1(20) +#define M_DES1_OWC _DD_MAKEMASK1(21) +#define M_DES1_ED _DD_MAKEMASK1(22) +#define M_DES1_TD _DD_MAKEMASK1(23) +#define M_DES1_CRS _DD_MAKEMASK1(24) +#define M_DES1_TFU _DD_MAKEMASK1(25) +#define M_DES1_TXA _DD_MAKEMASK1(26) +#define M_DES1_SUPCRC _DD_MAKEMASK1(28) + +/* Receive Command/Status Bits */ +#define M_DES1_COL _DD_MAKEMASK1(16) +#define M_DES1_LBP _DD_MAKEMASK1(17) +#define M_DES1_FAE _DD_MAKEMASK1(18) +#define M_DES1_CRCE _DD_MAKEMASK1(19) +#define M_DES1_ISE _DD_MAKEMASK1(20) +#define M_DES1_RUNT _DD_MAKEMASK1(21) +#define M_DES1_LONG _DD_MAKEMASK1(22) +#define M_DES1_RX_ERRORS (M_DES1_CRCE | \ + M_DES1_COL | M_DES1_FAE | M_DES1_ISE | \ + M_DES1_RUNT | M_DES1_LONG | M_DES1_RXO) + +#define S_DES1_DEST 23 +#define M_DES1_DEST _DD_MAKEMASK(2,S_DES1_DEST) +#define V_DES1_DEST(x) _DD_MAKEVALUE(x,S_DES1_DEST) +#define G_DES1_DEST(x) _DD_GETVALUE(x,S_DES1_DEST,M_DES1_DEST) + +#define K_DEST_REJECT 0 +#define K_DEST_UNICAST 1 +#define K_DEST_MULTICAST 2 +#define K_DEST_BROADCAST 3 + +#define M_DES1_RXO _DD_MAKEMASK1(25) +#define M_DES1_RXA _DD_MAKEMASK1(26) +#define M_DES1_INCCRC _DD_MAKEMASK1(28) + +#endif /* _DP83815_H_ */ diff --git a/cfe/cfe/dev/ns16550.h b/cfe/cfe/dev/ns16550.h new file mode 100644 index 0000000..b603ccc --- /dev/null +++ b/cfe/cfe/dev/ns16550.h @@ -0,0 +1,143 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * NS16550 Serial Port definitions File: ns16550.h + * + * This defines the hardware registers of 16550 compatible UARTs + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* + * NS16550 UART registers + */ + +#ifndef _NS16550_H_ +#define _NS16550_H_ + +#ifndef NS16550_HZ +#define NS16550_HZ 1843200 +#endif + +/* + * NS16550 UART registers + */ + +/* Register definitions */ + +#define R_UART_DATA 0 +#define R_UART_IER 1 +#define R_UART_IIR 2 +#define R_UART_FIFO R_UART_IIR +#define R_UART_CFCR 3 +#define R_UART_MCR 4 +#define R_UART_LSR 5 +#define R_UART_MSR 6 +#define R_UART_SCR 7 + +/* 16 bit baud rate divisor (lower byte in UART_DATA, upper in UART_IER) */ +#define BRTC(x) (NS16550_HZ / (16*(x))) + +/* interrupt enable register */ +#define IER_ERXRDY 0x1 /* int on rx ready */ +#define IER_ETXRDY 0x2 /* int on tx ready */ +#define IER_ERLS 0x4 /* int on line status change */ +#define IER_EMSC 0x8 /* int on modem status change */ + +/* interrupt identification register */ +#define IIR_IMASK 0xf /* mask */ +#define IIR_RXTOUT 0xc /* receive timeout */ +#define IIR_RLS 0x6 /* receive line status */ +#define IIR_RXRDY 0x4 /* receive ready */ +#define IIR_TXRDY 0x2 /* transmit ready */ +#define IIR_NOPEND 0x1 /* nothing */ +#define IIR_MLSC 0x0 /* modem status */ +#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */ + +/* fifo control register */ +#define FIFO_ENABLE 0x01 /* enable fifo */ +#define FIFO_RCV_RST 0x02 /* reset receive fifo */ +#define FIFO_XMT_RST 0x04 /* reset transmit fifo */ +#define FIFO_DMA_MODE 0x08 /* enable dma mode */ +#define FIFO_TRIGGER_1 0x00 /* trigger at 1 char */ +#define FIFO_TRIGGER_4 0x40 /* trigger at 4 chars */ +#define FIFO_TRIGGER_8 0x80 /* trigger at 8 chars */ +#define FIFO_TRIGGER_14 0xc0 /* trigger at 14 chars */ + +/* character format control register */ +#define CFCR_DLAB 0x80 /* divisor latch */ +#define CFCR_SBREAK 0x40 /* send break */ +#define CFCR_PZERO 0x30 /* zero parity */ +#define CFCR_PONE 0x20 /* one parity */ +#define CFCR_PEVEN 0x10 /* even parity */ +#define CFCR_PODD 0x00 /* odd parity */ +#define CFCR_PENAB 0x08 /* parity enable */ +#define CFCR_STOPB 0x04 /* 2 stop bits */ +#define CFCR_8BITS 0x03 /* 8 data bits */ +#define CFCR_7BITS 0x02 /* 7 data bits */ +#define CFCR_6BITS 0x01 /* 6 data bits */ +#define CFCR_5BITS 0x00 /* 5 data bits */ + +/* modem control register */ +#define MCR_LOOPBACK 0x10 /* loopback */ +#define MCR_IENABLE 0x08 /* output 2 = int enable */ +#define MCR_DRS 0x04 /* output 1 = xxx */ +#define MCR_RTS 0x02 /* enable RTS */ +#define MCR_DTR 0x01 /* enable DTR */ + +/* line status register */ +#define LSR_RCV_FIFO 0x80 /* error in receive fifo */ +#define LSR_TSRE 0x40 /* transmitter empty */ +#define LSR_TXRDY 0x20 /* transmitter ready */ +#define LSR_BI 0x10 /* break detected */ +#define LSR_FE 0x08 /* framing error */ +#define LSR_PE 0x04 /* parity error */ +#define LSR_OE 0x02 /* overrun error */ +#define LSR_RXRDY 0x01 /* receiver ready */ +#define LSR_RCV_MASK 0x1f + +/* modem status register */ +#define MSR_DCD 0x80 /* DCD active */ +#define MSR_RI 0x40 /* RI active */ +#define MSR_DSR 0x20 /* DSR active */ +#define MSR_CTS 0x10 /* CTS active */ +#define MSR_DDCD 0x08 /* DCD changed */ +#define MSR_TERI 0x04 /* RI changed */ +#define MSR_DDSR 0x02 /* DSR changed */ +#define MSR_DCTS 0x01 /* CTS changed */ + +#endif /* _NS16550_H_ */ diff --git a/cfe/cfe/dev/pci_devs.c b/cfe/cfe/dev/pci_devs.c new file mode 100644 index 0000000..a1ba789 --- /dev/null +++ b/cfe/cfe/dev/pci_devs.c @@ -0,0 +1,79 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PCI device selection and initialization File: pci_devs.c + * + * These are the routines to include the PCI drivers and to hook any + * devices with special configuration requirements.. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#if CFG_PCI +#include "sbmips.h" +#include "lib_types.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "dev_ide.h" +#include "env_subr.h" + +extern cfe_driver_t pciidedrv; /* PCI IDE controller */ +extern cfe_driver_t dc21143drv; /* Tulip Ethernet */ +extern cfe_driver_t dp83815drv; /* MacPhyter Ethernet */ +#if CFG_DOWNLOAD +extern cfe_driver_t bcm1250drv; /* BCM1250 as a device */ +#endif +extern cfe_driver_t ns16550pci_uart; /* PCI serial port */ + +void pci_add_devices(int init_pci); +void pci_add_devices(int init_pci) +{ + if (init_pci) { + cfe_add_device(&pciidedrv,0,IDE_PROBE_MASTER_TYPE(IDE_DEVTYPE_DISK),NULL); + cfe_add_device(&dc21143drv,0,0,env_getenv("TULIP0_HWADDR")); + cfe_add_device(&dp83815drv,0,0,NULL); + +#if CFG_DOWNLOAD + /* Access to bcm1250 in PCI device mode */ + cfe_add_device(&bcm1250drv,0,0,NULL); +#endif + cfe_add_device(&ns16550pci_uart,0,0,0); + } +} +#endif /* CFG_PCI */ + diff --git a/cfe/cfe/hosttools/Makefile b/cfe/cfe/hosttools/Makefile new file mode 100644 index 0000000..2f04639 --- /dev/null +++ b/cfe/cfe/hosttools/Makefile @@ -0,0 +1,12 @@ + +CC = gcc +CFLAGS = -I ../include + +all : mkbootimage installboot + +mkbootimage : mkbootimage.c + $(CC) $(CFLAGS) -o mkbootimage mkbootimage.c + +installboot : installboot.c + $(CC) $(CFLAGS) -o installboot installboot.c + diff --git a/cfe/cfe/hosttools/README b/cfe/cfe/hosttools/README new file mode 100644 index 0000000..7976c6d --- /dev/null +++ b/cfe/cfe/hosttools/README @@ -0,0 +1,49 @@ + +This directory contains some "host tools" that may be useful for +porting CFE. + +MKBOOTIMAGE +----------- + +The 'mkbootimage' program is used to attach a CFE boot block to +an image file. Boot blocks are used on block-structured devices +such as disks and CD-ROM. + +The boot block contains information to help CFE locate the boot +loader program and verify its validity. To create boot file, +link your boot loader to be executable within CFE's boot +environment (it should be a binary file, not an ELF file). + +Convert the file to a boot block using: + + mkbootimage [-EB] [-EL] myfile.elf myfile.boot + +Supply the -EB or -EL switch to configure the target endianness, +since the values in the boot block are endian-specific. + + +INSTALLBOOT +----------- + +Once you have a boot file, the 'installboot' program can +insert the boot file into a simulated disk file (such as the +file that you can use with the IDE emulation in the +BCM12500's functional simulator). The 'installboot' program +installs your boot file into a disk image file starting at +the first sector, preserving the beginning part of the boot +sector where the the boot block lives. + +Install the boot block using: + + installboot myfile.boot my_disk_image.dsk + +Where the "my_disk_image.dsk" is the simulated disk file for +the functional simulator. + +installboot could probably be ported to the target OS to +install boot blocks on raw disk devices. + + + + + diff --git a/cfe/cfe/hosttools/installboot.c b/cfe/cfe/hosttools/installboot.c new file mode 100644 index 0000000..2f61415 --- /dev/null +++ b/cfe/cfe/hosttools/installboot.c @@ -0,0 +1,352 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Boot program installer File: installboot.c + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + * This program converts a binary file (bootstrap program) + * into a boot block by prepending the boot block sector + * to the program. It generates the appropriate + * boot block checksums and such. The resulting file may + * be used by installboot (for example) to put into a disk + * image for the simulator. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include +#include + +typedef unsigned long long uint64_t; +typedef unsigned long uint32_t; + +#include "cfe_bootblock.h" +#include +#include +#include +#include + +#define roundup(x,align) (((x)+(align)-1)&~((align)-1)) +#define howmany(x,align) (((x)+(align)-1)/(align)) + +static int verbose = 0; +static int big_endian = 1; +static int swapflg = 1; +static unsigned long bootcode_offset = 2; +static unsigned long bootsect_offset = 1; + +static void usage(void) +{ + fprintf(stderr,"usage: installboot [-bootsect ] [-bootcode ]\n" + " [-v] [-EB] [-EL] bootloaderfile.bin devicefile\n\n"); + fprintf(stderr,"This program installs a boot block onto a disk. Typically, installboot\n" + "is used to install sibyl or other OS bootloaders. The binary you install\n" + "should be a raw program (not ELF) located to run in CFE's boot area\n" + "at address 0x2000_0000. The devicefile should be the name of the raw device\n" + "such as /dev/hda on Linux.\n\n" + "Care must be taken when choosing the values for -bootsect and -bootcode\n" + "not to interfere with other partitions on your disk. When partitioning,\n" + "it's a good idea to reserve 3 cylinders at the beginning of the disk for\n" + "the boot loader.\n\n" + "-bootsect nn specifies that the boot sector will be placed on sector 'nn'\n" + "-bootcode nn specifies that the boot program itself will be placed\n" + " on sectors starting with 'nn'. The boot sector will point\n" + " to this sector.\n"); + + exit(1); +} + +static void bswap32(uint32_t *ptr) +{ + unsigned char b; + unsigned char *bptr; + + if (swapflg) { + bptr = (unsigned char *) ptr; + b = bptr[0]; bptr[0] = bptr[3]; bptr[3] = b; + b = bptr[1]; bptr[1] = bptr[2]; bptr[2] = b; + } +} + +static void bswap64(uint64_t *ptr) +{ + unsigned char b; + unsigned char *bptr; + + bptr = (unsigned char *) ptr; + + if (swapflg) { + b = bptr[0]; bptr[0] = bptr[7]; bptr[7] = b; + b = bptr[1]; bptr[1] = bptr[6]; bptr[6] = b; + b = bptr[2]; bptr[2] = bptr[5]; bptr[5] = b; + b = bptr[3]; bptr[3] = bptr[4]; bptr[4] = b; + } +} + + +static void bswap_bootblock(struct boot_block *bb) +{ + int idx; + + for (idx = 59; idx <= 63; idx++) { + bswap64(&(bb->bb_data[idx])); + } +} + +static void do_checksum(void *ptr,int length,uint32_t *csptr,int swap) +{ + uint32_t *p; + uint32_t chksum = 0; + uint32_t d; + + p = (uint32_t *) ptr; + + length /= sizeof(uint32_t); + + while (length) { + d = *p; + if (swap) bswap32(&d); + chksum += d; + p++; + length--; + } + + if (swap) bswap32(&chksum); + + *csptr = chksum; +} + + +static void dumpbootblock(struct boot_block *bb) +{ + int idx; + + fprintf(stderr,"Magic Number: %016llX\n", + bb->bb_magic); + fprintf(stderr,"Boot code offset: %llu\n", + (unsigned long long)bb->bb_secstart); + fprintf(stderr,"Boot code size: %u\n", + (uint32_t) (bb->bb_secsize & BOOT_SECSIZE_MASK)); + fprintf(stderr,"Header checksum: %08X\n", + (uint32_t) (bb->bb_hdrinfo & BOOT_HDR_CHECKSUM_MASK)); + fprintf(stderr,"Header version: %d\n", + (uint32_t) ((bb->bb_hdrinfo & BOOT_HDR_VER_MASK) >> BOOT_HDR_VER_SHIFT)); + fprintf(stderr,"Data checksum: %08X\n", + (uint32_t) ((bb->bb_secsize & BOOT_DATA_CHECKSUM_MASK) >> BOOT_DATA_CHECKSUM_SHIFT)); + fprintf(stderr,"Architecture info: %08X\n", + (uint32_t) (bb->bb_archinfo & BOOT_ARCHINFO_MASK)); + fprintf(stderr,"\n"); + + for (idx = 59; idx <= 63; idx++) { + fprintf(stderr,"Word %d = %016llX\n",idx,bb->bb_data[idx]); + } +} + +static int host_is_little(void) +{ + unsigned long var = 1; + unsigned char *pvar = (unsigned char *) &var; + + return (*pvar == 1); +} + +int main(int argc, char *argv[]) +{ + int fh; + long bootsize; + long bootbufsize; + unsigned char *bootcode; + struct boot_block bootblock; + uint32_t datacsum,hdrcsum; + int host_le; + + while ((argc > 1) && (argv[1][0] == '-')) { + if (strcmp(argv[1],"-v") == 0) { + verbose = 1; + } + else if (strcmp(argv[1],"-EB") == 0) { + big_endian = 1; + } + else if (strcmp(argv[1],"-EL") == 0) { + big_endian = 0; + } + else if (strcmp(argv[1],"-bootsect") == 0) { + char *tmp_ptr; + argv++; + argc--; + if (argc == 1) { + fprintf(stderr,"-bootsect requires an argument\n"); + exit(1); + } + bootsect_offset = strtoul(argv[1], &tmp_ptr, 0); + bootcode_offset = bootsect_offset + 1; /* default if -bootcode not specified */ + if (*tmp_ptr) { + fprintf(stderr,"Unable to parse %s as a sector offset\n", argv[1]); + exit(1); + } + } + else if (strcmp(argv[1],"-bootcode") == 0) { + char *tmp_ptr; + argv++; + argc--; + if (argc == 1) { + fprintf(stderr,"-bootcode requires an argument\n"); + exit(1); + } + bootcode_offset = strtoul(argv[1], &tmp_ptr, 0); + if (*tmp_ptr) { + fprintf(stderr,"Unable to parse %s as a sector offset\n", argv[1]); + exit(1); + } + } + else { + fprintf(stderr,"Invalid switch: %s\n",argv[1]); + exit(1); + } + argv++; + argc--; + } + + /* + * We need to swap things around if the host and + * target are different endianness + */ + + swapflg = 0; + host_le = host_is_little(); + + if (big_endian && host_is_little()) swapflg = 1; + if ((big_endian == 0) && !(host_is_little())) swapflg = 1; + + fprintf(stderr,"Host is %s-endian.\n",host_le ? "little" : "big"); + fprintf(stderr,"Target is %s-endian.\n",big_endian ? "big" : "little"); + + if (argc != 3) { + usage(); + } + + /* + * Read in the boot file + */ + + fh = open(argv[1],O_RDONLY); + if (fh < 0) { + perror(argv[1]); + } + + bootsize = lseek(fh,0L,SEEK_END); + lseek(fh,0L,SEEK_SET); + + bootbufsize = roundup(bootsize,BOOT_BLOCK_BLOCKSIZE); + + bootcode = malloc(bootbufsize); + if (bootcode == NULL) { + perror("malloc"); + exit(1); + } + memset(bootcode,0,bootbufsize); + if (read(fh,bootcode,bootsize) != bootsize) { + perror("read"); + exit(1); + } + + close(fh); + + /* + * Construct the boot block + */ + + + /* Checksum the boot code */ + do_checksum(bootcode,bootbufsize,&datacsum,1); + bswap32(&datacsum); + + + /* fill in the boot block fields, and checksum the boot block */ + bootblock.bb_magic = BOOT_MAGIC_NUMBER; + bootblock.bb_hdrinfo = (((uint64_t) BOOT_HDR_VERSION) << BOOT_HDR_VER_SHIFT); + bootblock.bb_secstart = (bootcode_offset * 512); + bootblock.bb_secsize = ((uint64_t) bootbufsize) | + (((uint64_t) datacsum) << BOOT_DATA_CHECKSUM_SHIFT); + bootblock.bb_archinfo = 0; /* XXX */ + + do_checksum(&(bootblock.bb_magic),BOOT_BLOCK_SIZE,&hdrcsum,0); + bootblock.bb_hdrinfo |= (uint64_t) hdrcsum; + + if (verbose) dumpbootblock(&bootblock); + + bswap_bootblock(&bootblock); + + /* + * Now write the output file + */ + + fh = open(argv[2],O_RDWR|O_CREAT,S_IREAD|S_IWRITE); + if (fh < 0) { + perror(argv[2]); + exit(1); + } + + fprintf(stderr,"Installing boot block\n"); + if (lseek(fh, bootsect_offset * 512, SEEK_SET) != (bootsect_offset * 512)) { + perror(argv[2]); + exit(1); + } + if (write(fh,&bootblock,sizeof(bootblock)) != sizeof(bootblock)) { + perror(argv[2]); + exit(1); + } + fprintf(stderr,"Installing bootstrap program\n"); + if (lseek(fh, bootcode_offset * 512, SEEK_SET) != (bootcode_offset * 512)) { + perror(argv[2]); + exit(1); + } + if (write(fh,bootcode,bootbufsize) != bootbufsize) { + perror(argv[2]); + exit(1); + } + + close(fh); + + fprintf(stderr,"Done. %s installed on %s\n",argv[1],argv[2]); + + exit(0); + + +} + diff --git a/cfe/cfe/hosttools/makereg.c b/cfe/cfe/hosttools/makereg.c new file mode 100644 index 0000000..0ff53e1 --- /dev/null +++ b/cfe/cfe/hosttools/makereg.c @@ -0,0 +1,481 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Register Table Generator File: makereg.c + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + * Warning: don't eat your lunch before reading this program. + * It's nasty! + * + * This program generates tables of SOC registers and values + * that are easy for us to display. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include +#include +#include +#include + +#if defined(_MSC_VER) || defined(__CYGWIN__) +#define TEXTMODE "t" +#else +#define TEXTMODE "" +#endif + +typedef struct Cons { + char *str; + int num; +} CONS; + +typedef struct RegInfo { + unsigned long reg_mask; + char *reg_agent; + int reg_agentidx; + char *reg_addr; + char *reg_inst; + char *reg_subinst; + char *reg_printfunc; + char *reg_description; +} REGINFO; + +typedef struct ConstInfo { + char *name; + unsigned int value; +} CONSTINFO; + +#define MAXCONST 64 +CONSTINFO constants[MAXCONST]; +int constcnt = 0; + +#define MAXREGS 2000 +REGINFO allregs[MAXREGS]; +int regcnt = 0; + +int maskcnt = 0; + +#define MAXAGENTS 32 +char *agentnames[MAXAGENTS]; +int agentcnt; + +#define CMD_AGENT 1 +#define CMD_ENDAGENT 2 + +CONS commands[] = { + {"!agent",CMD_AGENT}, + {"!endagent",CMD_ENDAGENT}, + {NULL,0}}; + + +int assoc(CONS *list,char *str) +{ + while (list->str) { + if (strcmp(list->str,str) == 0) return list->num; + list++; + } + + return -1; +} + +char *gettoken(char **ptr) +{ + char *p = *ptr; + char *ret; + + /* skip white space */ + + while (*p && isspace(*p)) p++; + ret = p; + + /* check for end of string */ + + if (!*p) { + *ptr = p; + return NULL; + } + + /* skip non-whitespace */ + + while (*p) { + if (isspace(*p)) break; + + /* do quoted strings */ + + if (*p == '"') { + p++; + ret = p; + while (*p && (*p != '"')) p++; + if (*p == '"') *p = '\0'; + } + + p++; + + } + + if (*p) { + *p++ = '\0'; + } + *ptr = p; + + return ret; +} + +static int readline(FILE *str,char *dest,int destlen) +{ + char *x; + + for (;;) { + if (!fgets(dest,destlen,str)) return -1; + if (x = strchr(dest,'\n')) *x = '\0'; + if (dest[0] == '\0') continue; + if (dest[0] == ';') continue; + break; + } + + return 0; +} + + +static void fatal(char *str,char *val) +{ + fprintf(stderr,"fatal error: %s %s\n",str,val ? val : ""); + exit(1); +} + +static unsigned int newmask(void) +{ + int res; + + res = maskcnt; + + if (maskcnt == 32) { + fatal("Out of mask bits",NULL); + } + + maskcnt++; + + return 1<= 0) && (rmax < 100)) { + char *atext,*subinst,*pfunc,*descr; + + if (regline[0] == '!') break; + + ptr = regline; + atext = gettoken(&ptr); + subinst = gettoken(&ptr); + pfunc = gettoken(&ptr); + descr = gettoken(&ptr); + + if (!descr) { + fatal("Missing fields for ",atext); + } + + regs[rmax].reg_addr = strdup(atext); + regs[rmax].reg_subinst = strdup(subinst); + regs[rmax].reg_printfunc = strdup(pfunc); + regs[rmax].reg_description = strdup(descr); + regs[rmax].reg_mask = 0; + rmax++; + } + + if (rmax == 100) fatal("Too many registers in section ",agentname); + + inst = strtok(instances,","); + + cumlmask = 0; + while (inst) { + char defname[100]; + unsigned int curmask; + + sprintf(defname,"SOC_AGENT_%s%s", + agentname,inst[0] == '*' ? "" : inst); + + curmask = newmask(); + cumlmask |= curmask; + + addconst(defname,curmask); + + for (idx = 0; idx < rmax; idx++) { + char descr[100]; + char atext[200]; + + macroexpand(regs[idx].reg_addr,inst,atext); +#if 0 + strcpy(descr,agentname); + if (inst[0] != '*') { + strcat(descr,inst); + } + strcat(descr," "); + if (regs[idx].reg_subinst[0] != '*') { + strcat(descr,regs[idx].reg_subinst); + strcat(descr," "); + } + strcat(descr,regs[idx].reg_description); +#else + strcpy(descr,regs[idx].reg_description); +#endif + + addreg(agentname, + agentidx, + curmask, + atext, + inst, + regs[idx].reg_subinst, + regs[idx].reg_printfunc, + descr); + } + inst = strtok(NULL,","); + } + + if (instances[0] != '*') { + sprintf(cumlname,"SOC_AGENT_%s",agentname); + addconst(cumlname,cumlmask); + } +} + +static void docommand(FILE *str,char *line) +{ + char *cmd; + + cmd = gettoken(&line); + if (!cmd) return; + + switch (assoc(commands,cmd)) { + case CMD_AGENT: + doagentcmd(str,line); + break; + default: + fatal("Invalid command",cmd); + break; + } + +} + +static int ingestfile(FILE *str) +{ + char line[500]; + + while (readline(str,line,sizeof(line)) >= 0) { + if (line[0] == '!') { + docommand(str,line); + } + else { + fatal("Command string required before register data",NULL); + } + } +} + + +void saveincfile(char *fname) +{ + FILE *str; + int idx; + + str = fopen(fname,"w" TEXTMODE); + if (!str) { + perror(fname); + exit(1); + } + + fprintf(str,"\n\n"); + + fprintf(str,"#ifndef %s\n",constants[0].name); + for (idx = 0; idx < constcnt; idx++) { + fprintf(str,"#define %s 0x%08X\n",constants[idx].name, + constants[idx].value); + } + fprintf(str,"#endif\n"); + + fprintf(str,"\n\n"); + + fprintf(str,"#ifdef _CFE_\n"); + fprintf(str,"#ifdef __ASSEMBLER__\n"); + fprintf(str,"\t.globl socstatetable\n"); + fprintf(str,"socstatetable:\n"); + for (idx = 0; idx < regcnt; idx++) { + fprintf(str,"\t\t.word 0x%08X,%s\n", + allregs[idx].reg_mask,allregs[idx].reg_addr); + } + fprintf(str,"\t\t.word 0,0\n"); + fprintf(str,"#endif\n"); + + fprintf(str,"\n\n"); + fprintf(str,"#ifndef __ASSEMBLER__\n"); + + /* Addr Agent Inst Subinst Mask Printfunc Descr */ + + fprintf(str,"char *socagents[] = {\n"); + for (idx = 0; idx < agentcnt; idx++) { + fprintf(str,"\t\"%s\",\n",agentnames[idx]); + } + fprintf(str,"\tNULL};\n\n"); + + fprintf(str,"const socreg_t socregs[] = {\n"); + for (idx = 0; idx < regcnt; idx++) { + fprintf(str," {%s,%d,\"%s\",\"%s\",\n 0x%08X,%s,\"%s\"},\n", + allregs[idx].reg_addr, + allregs[idx].reg_agentidx, + allregs[idx].reg_inst, + allregs[idx].reg_subinst, + allregs[idx].reg_mask, + allregs[idx].reg_printfunc, + allregs[idx].reg_description); + } + fprintf(str," {0,0,NULL,NULL,0,NULL,NULL}};\n\n"); + + fprintf(str,"#endif\n"); + fprintf(str,"#endif\n"); + fclose(str); +} + +int main(int argc,char *argv[]) +{ + FILE *str; + int idx; + + if (argc != 3) { + fprintf(stderr,"usage: makereg inputfile outputfile\n"); + exit(1); + } + + str = fopen(argv[1],"r" TEXTMODE); + + if (!str) { + perror(argv[1]); + exit(1); + } + + ingestfile(str); + + fclose(str); + + fprintf(stderr,"Total registers: %d\n",regcnt); + + saveincfile(argv[2]); + + exit(0); + return 0; +} diff --git a/cfe/cfe/hosttools/memconfig.c b/cfe/cfe/hosttools/memconfig.c new file mode 100644 index 0000000..3d84b05 --- /dev/null +++ b/cfe/cfe/hosttools/memconfig.c @@ -0,0 +1,654 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Memory Config Utility File: memconfig.c + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + * This host tool lets you enter DRAM parameters and run CFE's + * standard memory configuration to calculate the relevant timing + * parameters. It's a good way to see what CFE would have done, + * to find bogus timing calculations. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include +#include + +/* ********************************************************************* + * Basic types + ********************************************************************* */ + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint32_t; +typedef unsigned long long uint64_t; + +/* ********************************************************************* + * SB1250 stuff + ********************************************************************* */ + +#include "sb1250_defs.h" +#include "sb1250_mc.h" +#include "sb1250_draminit.h" +#include "sb1250_regs.h" +#include "sb1250_scd.h" + +/* ********************************************************************* + * BCD macros + ********************************************************************* */ + +#define DECTO10THS(x) ((((x) >> 4)*10)+((x) & 0x0F)) + +/* ********************************************************************* + * Global defaults + ********************************************************************* */ + +#define MIN_tMEMCLK DRT10(8,0) +#define tROUNDTRIP DRT10(2,5) + +/* ********************************************************************* + * Types + ********************************************************************* */ + +typedef struct encvalue_s { + char *name; + uint8_t val; +} encvalue_t; + +typedef struct spdbyte_s { + char *name; + uint8_t *data; + int decimal; + encvalue_t *values; + char *units; + char *description; + char *deflt; +} spdbyte_t; + +#define SPD_DEC_BCD 1 +#define SPD_DEC_QTR 2 +#define SPD_ENCODED 3 +#define SPD_ENCODED2 4 + +/* ********************************************************************* + * Globals + ********************************************************************* */ + + +uint8_t spd[64] = {0}; /* SPD data */ +uint8_t mintmemclk = MIN_tMEMCLK; /* Default value: 8.0ns */ +uint8_t roundtrip = tROUNDTRIP; /* Default value: 2.5ns */ +uint8_t dramtype = JEDEC; /* Regular DDR SDRAMs */ +uint8_t plldiv = 10; /* 500 MHz using 100Mhz refclk */ +uint8_t refclk = 100; /* 100Mhz reference clock */ +uint8_t portintlv = 0; /* no port interleaving */ + +uint8_t addrskew = 0xF; +uint8_t dqoskew = 0x8; +uint8_t dqiskew = 0x8; +uint8_t addrdrive = 0xF; +uint8_t datadrive = 0xF; +uint8_t clkdrive = 0; + +uint64_t mc0_mclkcfg; /* Value programmed by draminit */ +uint64_t mc0_timing1; /* Value programmed by draminit */ +uint64_t smbus0_start = 0; /* Rememberd SMBus register value */ +uint64_t smbus0_cmd = 0; /* Rememberd SMBus register value */ + +extern int sb1250_refclk; /* from draminit - reference clock */ +extern int dram_cas_latency; /* from draminit - calc'd cas latency */ +extern int dram_tMemClk; /* from draminit - calc'd tMemClk */ + +draminittab_t inittab[16]; /* our init tab */ + +int debug = 0; + +/* ********************************************************************* + * Parameter and value tables + ********************************************************************* */ + +encvalue_t caslatencies[] = { + {"3.5",JEDEC_CASLAT_35}, + {"3.0",JEDEC_CASLAT_30}, + {"2.5",JEDEC_CASLAT_25}, + {"2.0",JEDEC_CASLAT_20}, + {"1.5",JEDEC_CASLAT_15}, + {"1.0",JEDEC_CASLAT_10}, + {NULL,0}}; + +encvalue_t refreshrates[] = { + {"64",JEDEC_RFSH_64khz}, + {"256",JEDEC_RFSH_256khz}, + {"128",JEDEC_RFSH_128khz}, + {"32",JEDEC_RFSH_32khz}, + {"16",JEDEC_RFSH_16khz}, + {"8",JEDEC_RFSH_8khz}, + {NULL,0}}; + +encvalue_t modattribs[] = { + {"none",0}, + {"reg",JEDEC_ATTRIB_REG}, + {"diffclk",0x20}, + {NULL,0}}; + +encvalue_t dramtypes[] = { + {"jedec",JEDEC}, + {"fcram",FCRAM}, + {"sgram",SGRAM}, + {NULL,0}}; + +spdbyte_t spdfields[] = { + {"mintmemclk",&mintmemclk,SPD_DEC_BCD,NULL,"ns","Minimum value for tMEMCLK","8.0"}, + {"roundtrip", &roundtrip, SPD_DEC_BCD,NULL,"ns","Round trip time from CLK to returned DQS","2.5"}, + {"plldiv", &plldiv, 0,NULL,"","PLL Ratio (System Config Register)","10"}, + {"refclk", &refclk, 0,NULL,"Mhz","Reference clock, usually 100Mhz","100"}, +// {"portintlv", &portintlv, 0,NULL,"","Port interleave (1=on)","0"}, + {"memtype", &dramtype, SPD_ENCODED,dramtypes,"","Memory type (jedec, fcram, sgram)","jedec"}, + {"rows", &spd[JEDEC_SPD_ROWS],0,NULL,"","[3 ] Number of row bits","13"}, + {"cols", &spd[JEDEC_SPD_COLS],0,NULL,"","[4 ] Number of column bits","9"}, + {"banks", &spd[JEDEC_SPD_BANKS],0,NULL,"","[17] Number of banks","4"}, + {"tCK25", &spd[JEDEC_SPD_tCK25],SPD_DEC_BCD,NULL,"ns","[9 ] tCK value for CAS Latency 2.5","7.5"}, + {"tCK20", &spd[JEDEC_SPD_tCK20],SPD_DEC_BCD,NULL,"ns","[23] tCK value for CAS Latency 2.0","0"}, + {"tCK10", &spd[JEDEC_SPD_tCK10],SPD_DEC_BCD,NULL,"ns","[25] tCK value for CAS Latency 1.0","0"}, + {"rfsh", &spd[JEDEC_SPD_RFSH],SPD_ENCODED,refreshrates,"","[12] Refresh rate (KHz)","8"}, + {"caslat", &spd[JEDEC_SPD_CASLATENCIES],SPD_ENCODED2,caslatencies,"","[18] CAS Latencies supported","2.5"}, + {"attrib", &spd[JEDEC_SPD_ATTRIBUTES],SPD_ENCODED,modattribs,"","[21] Module attributes","none"}, + {"tRAS", &spd[JEDEC_SPD_tRAS],0,NULL,"ns","[30]","45"}, + {"tRP", &spd[JEDEC_SPD_tRP],SPD_DEC_QTR,NULL,"ns","[27]","20.0"}, + {"tRRD", &spd[JEDEC_SPD_tRRD],SPD_DEC_QTR,NULL,"ns","[28]","15.0"}, + {"tRCD", &spd[JEDEC_SPD_tRCD],SPD_DEC_QTR,NULL,"ns","[29]","20.0"}, + {"tRFC", &spd[JEDEC_SPD_tRFC],0,NULL,"ns","[42]","0"}, + {"tRC", &spd[JEDEC_SPD_tRC],0,NULL,"ns","[41]","0"}, + + {"addrskew", &addrskew, 0, NULL, "","Address Skew","0x0F"}, + {"dqoskew", &dqoskew, 0, NULL, "","DQO Skew","0x08"}, + {"dqikew", &dqiskew, 0, NULL, "","DQI Skew","0x08"}, + {"addrdrive", &addrdrive, 0, NULL, "","Address Drive","0x0F"}, + {"datadrive", &datadrive, 0, NULL, "","Data Drive","0x0F"}, + {"clkdrive", &clkdrive, 0, NULL, "","Clock Drive","0"}, + {NULL,0,0,NULL,NULL,NULL,NULL}}; + +char *lookupstr(encvalue_t *ev,uint8_t val) +{ + while (ev->name) { + if (ev->val == val) return ev->name; + ev++; + } + return "unknown"; +} + +uint64_t sbreadcsr(uint64_t reg) +{ + uint64_t val = 0; + + if (debug) printf("READ %08X\n",(uint32_t) reg); + + switch ((uint32_t) reg) { + case A_SCD_SYSTEM_REVISION: + val = V_SYS_PART(0x1250) | V_SYS_WID(0) | V_SYS_REVISION(1) | 0xFF; + break; + case A_SCD_SYSTEM_CFG: + val = V_SYS_PLL_DIV(plldiv); + break; + case A_SMB_STATUS_0: + val = 0; + break; + case A_SMB_CMD_0: + val = smbus0_cmd; + break; + case A_SMB_START_0: + val = smbus0_start; + break; + case A_SMB_DATA_0: + val = spd[smbus0_cmd & 0x3F]; + break; + } + return val; +} + +void sbwritecsr(uint64_t reg,uint64_t val) +{ + if (debug) printf("WRITE %08X %016llX\n",(uint32_t) reg,val); + + switch ((uint32_t) reg) { + case A_MC_REGISTER(0,R_MC_MCLK_CFG): + mc0_mclkcfg = val; + break; + case A_MC_REGISTER(0,R_MC_TIMING1): + mc0_timing1 = val; + break; + case A_SMB_CMD_0: + smbus0_cmd = val; + break; + case A_SMB_START_0: + smbus0_start = val; + break; + } +} + + +int procfield(char *txt) +{ + int num = 0; + int a,b; + spdbyte_t *sf; + encvalue_t *ev; + char *x; + char *tok; + + x = strchr(txt,'='); + if (!x) { + printf("Fields must be specified as 'name=value'\n"); + exit(1); + } + *x++ = '\0'; + + sf = spdfields; + while (sf->name) { + if (strcmp(sf->name,txt) == 0) break; + sf++; + } + + if (sf->name == NULL) { + printf("Invalid field name: %s\n",txt); + return -1; + } + + if (memcmp(x,"0x",2) == 0) { + sscanf(x+2,"%x",&num); + } + else { + if (strchr(x,'.')) { + if (sscanf(x,"%d.%d",&a,&b) != 2) { + printf("%s: invalid number: %s\n",sf->name,x); + return -1; + } + } + else { + a = atoi(x); + b = 0; + } + + switch (sf->decimal) { + case SPD_DEC_BCD: + if ((b < 0) || (b > 9)) { + printf("%s: Invalid BCD number: %s\n",sf->name,x); + return -1; + } + num = (a*16)+b; + break; + case SPD_DEC_QTR: + if ((b != 0) && (b != 25) && (b != 50) && (b != 75)) { + printf("%s: Invalid 2-bit fraction number: %s\n",sf->name,x); + printf("(number after decimal should be 0,25,50,75)\n"); + exit(1); + } + num = (a*4)+(b/25); + break; + case SPD_ENCODED: + ev = sf->values; + while (ev->name) { + if (strcmp(ev->name,x) == 0) break; + ev++; + } + if (!ev->name) { + printf("%s: Invalid value. Valid values are: ",x); + ev = sf->values; + while (ev->name) { printf("%s ",ev->name); ev++; } + printf("\n"); + return -1; + } + num = ev->val; + break; + case SPD_ENCODED2: + tok = strtok(x," ,"); + num = 0; + while (tok) { + ev = sf->values; + while (ev->name) { + if (strcmp(ev->name,tok) == 0) break; + ev++; + } + if (!ev->name) { + printf("%s: Invalid value. Valid values are: ",tok); + ev = sf->values; + while (ev->name) { printf("%s ",ev->name); ev++; } + printf("\n"); + return -1; + } + num |= ev->val; + tok = strtok(NULL," ,"); + } + break; + default: + num = a; + break; + } + } + + *(sf->data) = num; + + return 0; +} + +void interactive(void) +{ + spdbyte_t *sf; + char field[100]; + char ask[100]; + char prompt[100]; + char *x; + + sf = spdfields; + + printf("%-65.65s: Value\n","Parameter"); + printf("%-65.65s: -----\n","-----------------------------------------------------------------"); + + while (sf->name) { + for (;;) { + x = prompt; + x += sprintf(x,"%s (%s", sf->name,sf->description); + if (sf->units && sf->units[0]) { + if (sf->description && sf->description[0]) x += sprintf(x,", "); + x += sprintf(x,"%s",sf->units); + } + x += sprintf(x,"): [%s]", sf->deflt); + printf("%-65.65s: ",prompt); + + fgets(ask,sizeof(ask),stdin); + if ((x = strchr(ask,'\n'))) *x = '\0'; + if (ask[0] == 0) strcpy(ask,sf->deflt); + sprintf(field,"%s=%s",sf->name,ask); + if (procfield(field) < 0) continue; + break; + } + sf++; + } + + printf("\n\n"); +} + +int swcnt = 0; +char *swnames[32]; + +int proc_args(int argc,char *argv[]) +{ + int inidx,outidx; + + outidx = 1; + + for (inidx = 1; inidx < argc; inidx++) { + if (argv[inidx][0] != '-') { + argv[outidx++] = argv[inidx]; + } + else { + swnames[swcnt] = argv[inidx]; + swcnt++; + } + } + + return outidx; +} + +int swisset(char *x) +{ + int idx; + + for (idx = 0; idx < swcnt; idx++) { + if (strcmp(x,swnames[idx]) == 0) return 1; + } + return 0; +} + +void dumpmclkcfg(uint64_t val) +{ + printf("clk_ratio = %d\n",G_MC_CLK_RATIO(val)); + printf("ref_rate = %d\n",G_MC_REF_RATE(val)); + +} + +void dumptiming1(uint64_t val) +{ + printf("w2rIdle = %d\n",(val & M_MC_w2rIDLE_TWOCYCLES) ? 1 : 0); + printf("r2rIdle = %d\n",(val & M_MC_r2rIDLE_TWOCYCLES) ? 1 : 0); + printf("r2wIdle = %d\n",(val & M_MC_r2wIDLE_TWOCYCLES) ? 1 : 0); + printf("tCrD = %d\n",(int)G_MC_tCrD(val)); + printf("tCrDh = %d\n",(val & M_MC_tCrDh) ? 1 : 0); + printf("tFIFO = %d\n",(int)G_MC_tFIFO(val)); + printf("tCwD = %d\n",(int)G_MC_tCwD(val)); + + printf("tRP = %d\n",(int)G_MC_tRP(val)); + printf("tRRD = %d\n",(int)G_MC_tRRD(val)); + printf("tRCD = %d\n",(int)G_MC_tRCD(val)); + + printf("tRFC = %d\n",(int)G_MC_tRFC(val)); + printf("tRCw = %d\n",(int)G_MC_tRCw(val)); + printf("tRCr = %d\n",(int)G_MC_tRCr(val)); + printf("tCwCr = %d\n",(int)G_MC_tCwCr(val)); +} + +int main(int argc,char *argv[]) +{ + spdbyte_t *sf; + uint8_t t; + int idx; + int mclk; + draminittab_t *init; + + spd[JEDEC_SPD_MEMTYPE] = JEDEC_MEMTYPE_DDRSDRAM2; + spd[JEDEC_SPD_ROWS] = 13; + spd[JEDEC_SPD_COLS] = 9; + spd[JEDEC_SPD_BANKS] = 2; + spd[JEDEC_SPD_SIDES] = 1; + spd[JEDEC_SPD_WIDTH] = 72; + + argc = proc_args(argc,argv); + + if ((argc == 1) && !swisset("-i")) { + printf("usage: memconfig name=value name=value ...\n"); + printf("\n"); + printf("Available fields: "); + sf = spdfields; + while (sf->name) { + printf("%s ",sf->name); + sf++; + } + printf("\n"); + exit(1); + } + + if (swisset("-i")) { + interactive(); + } + else { + for (idx = 1; idx < argc; idx++) { + if (procfield(argv[idx]) < 0) exit(1); + } + } + + debug = swisset("-d"); + + printf("-------Memory Parameters---------\n"); + + sf = spdfields; + while (sf->name) { + char buffer[64]; + char *p = buffer; + + t = *(sf->data); + printf("%-10.10s = 0x%02X ",sf->name,t); + switch (sf->decimal) { + case SPD_DEC_BCD: + p += sprintf(p,"(%d.%d)", + t >> 4, t & 0x0F); + break; + case SPD_DEC_QTR: + p += sprintf(p,"(%d.%02d)", + t/4,(t&3)*25); + break; + case SPD_ENCODED: + p += sprintf(p,"(%s)",lookupstr(sf->values,t)); + break; + default: + p += sprintf(p,"(%d)",t); + break; + } + + p += sprintf(p," %s",sf->units); + printf("%-16.16s %s\n",buffer,sf->description); + sf++; + } + + printf("\n"); + + init = &inittab[0]; + memset(inittab,0,sizeof(inittab)); + + init->gbl.gbl_type = MCR_GLOBALS; + init->gbl.gbl_intlv_ch = portintlv; + init++; + + init->cfg.cfg_type = MCR_CHCFG; + init->cfg.cfg_chan = 0; + init->cfg.cfg_mintmemclk = mintmemclk; + init->cfg.cfg_dramtype = dramtype; + init->cfg.cfg_pagepolicy = CASCHECK; + init->cfg.cfg_blksize = BLKSIZE32; + init->cfg.cfg_intlv_cs = NOCSINTLV; + init->cfg.cfg_ecc = 0; + init->cfg.cfg_roundtrip = roundtrip; + init++; + + init->clk.clk_type = MCR_CLKCFG; + init->clk.clk_addrskew = addrskew; + init->clk.clk_dqoskew = dqoskew; + init->clk.clk_dqiskew = dqiskew; + init->clk.clk_addrdrive = addrdrive; + init->clk.clk_datadrive = datadrive; + init->clk.clk_clkdrive = clkdrive; + init++; + + init->geom.geom_type = MCR_GEOM; + init->geom.geom_csel = 0; + init->geom.geom_rows = spd[JEDEC_SPD_ROWS]; + init->geom.geom_cols = spd[JEDEC_SPD_COLS]; + init->geom.geom_banks = spd[JEDEC_SPD_BANKS]; + init++; + +#if 0 + init->tmg.tmg_type = MCR_TIMING; + init->tmg.tmg_tCK = spd[JEDEC_SPD_tCK25]; + init->tmg.tmg_rfsh = spd[JEDEC_SPD_RFSH]; + init->tmg.tmg_caslatency = spd[JEDEC_SPD_CASLATENCIES]; + init->tmg.tmg_attributes = spd[JEDEC_SPD_ATTRIBUTES]; + init->tmg.tmg_tRAS = spd[JEDEC_SPD_tRAS]; + init->tmg.tmg_tRP = spd[JEDEC_SPD_tRP]; + init->tmg.tmg_tRRD = spd[JEDEC_SPD_tRRD]; + init->tmg.tmg_tRCD = spd[JEDEC_SPD_tRCD]; + init->tmg.tmg_tRFC = spd[JEDEC_SPD_tRFC]; + init->tmg.tmg_tRC = spd[JEDEC_SPD_tRC]; + init++; +#else + init->spd.spd_type = MCR_SPD; + init->spd.spd_csel = 0; + init->spd.spd_flags = 0; + init->spd.spd_smbuschan = 0; + init->spd.spd_smbusdev = 0x50; + init++; +#endif + + init->mcr.mcr_type = MCR_EOT; + + + sb1250_refclk = (int) refclk; + + sb1250_dram_init(inittab); + + + printf("-----Memory Timing Register Values-----\n"); + printf("System Clock %dMHz\n",plldiv*refclk/2); + printf("CAS latency %d.%d\n",dram_cas_latency>>1,(dram_cas_latency&1)?5:0); + printf("tMemClk %d.%d ns\n",dram_tMemClk/10,dram_tMemClk%10); + mclk = (plldiv*refclk)*10/2/((int)G_MC_CLK_RATIO(mc0_mclkcfg)); + printf("MCLK Freq %d.%dMHz\n",mclk/10,mclk%10); + printf("\n"); + printf("MC_TIMING1 = %016llX\n",mc0_timing1); + printf("MCLK_CONFIG = %016llX\n",mc0_mclkcfg); + printf("\n"); + + printf("-----Memory Timing Register Fields-----\n"); + dumptiming1(mc0_timing1); + + printf("-----Memory Clock Config Register Fields-----\n"); + dumpmclkcfg(mc0_mclkcfg); + + printf("---Done!---\n"); + + printf("%s ",argv[0]); + sf = spdfields; + while (sf->name) { + char buffer[64]; + char *p = buffer; + + t = *(sf->data); + + p += sprintf(p,"%s=",sf->name); + switch (sf->decimal) { + case SPD_DEC_BCD: + p += sprintf(p,"%d.%d", + t >> 4, t & 0x0F); + break; + case SPD_DEC_QTR: + p += sprintf(p,"%d.%02d", + t/4,(t&3)*25); + break; + case SPD_ENCODED: + default: + p += sprintf(p,"0x%02X",t); + break; + } + + printf("%s ",buffer); + sf++; + } + + printf("\n"); + + return 0; +} diff --git a/cfe/cfe/hosttools/mkbootimage.c b/cfe/cfe/hosttools/mkbootimage.c new file mode 100644 index 0000000..862f8ed --- /dev/null +++ b/cfe/cfe/hosttools/mkbootimage.c @@ -0,0 +1,314 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Boot block generator File: mkbootimage.c + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + * This program converts a binary file (bootstrap program) + * into a boot block by prepending the boot block sector + * to the program. It generates the appropriate + * boot block checksums and such. The resulting file may + * be used by installboot (for example) to put into a disk + * image for the simulator. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include +#include + +typedef unsigned long long uint64_t; +typedef unsigned long uint32_t; + +#include "cfe_bootblock.h" +#include +#include +#include +#include + +#define roundup(x,align) (((x)+(align)-1)&~((align)-1)) +#define howmany(x,align) (((x)+(align)-1)/(align)) + +static int verbose = 0; +static int big_endian = 1; +static int swapflg = 1; +static unsigned long sector_offset = 0; + +static void usage(void) +{ + fprintf(stderr,"usage: mkbootimage [-S ] [-v] [-EB] [-EL] inputfile outputfile\n"); + exit(1); +} + +static void bswap32(uint32_t *ptr) +{ + unsigned char b; + unsigned char *bptr; + + if (swapflg) { + bptr = (unsigned char *) ptr; + b = bptr[0]; bptr[0] = bptr[3]; bptr[3] = b; + b = bptr[1]; bptr[1] = bptr[2]; bptr[2] = b; + } +} + +static void bswap64(uint64_t *ptr) +{ + unsigned char b; + unsigned char *bptr; + + bptr = (unsigned char *) ptr; + + if (swapflg) { + b = bptr[0]; bptr[0] = bptr[7]; bptr[7] = b; + b = bptr[1]; bptr[1] = bptr[6]; bptr[6] = b; + b = bptr[2]; bptr[2] = bptr[5]; bptr[5] = b; + b = bptr[3]; bptr[3] = bptr[4]; bptr[4] = b; + } +} + + +static void bswap_bootblock(struct boot_block *bb) +{ + int idx; + + for (idx = 59; idx <= 63; idx++) { + bswap64(&(bb->bb_data[idx])); + } +} + +static void do_checksum(void *ptr,int length,uint32_t *csptr,int swap) +{ + uint32_t *p; + uint32_t chksum = 0; + uint32_t d; + + p = (uint32_t *) ptr; + + length /= sizeof(uint32_t); + + while (length) { + d = *p; + if (swap) bswap32(&d); + chksum += d; + p++; + length--; + } + + if (swap) bswap32(&chksum); + + *csptr = chksum; +} + + +static void dumpbootblock(struct boot_block *bb) +{ + int idx; + + fprintf(stderr,"Magic Number: %016llX\n", + bb->bb_magic); + fprintf(stderr,"Boot code offset: %llu\n", + (unsigned long long)bb->bb_secstart); + fprintf(stderr,"Boot code size: %u\n", + (uint32_t) (bb->bb_secsize & BOOT_SECSIZE_MASK)); + fprintf(stderr,"Header checksum: %08X\n", + (uint32_t) (bb->bb_hdrinfo & BOOT_HDR_CHECKSUM_MASK)); + fprintf(stderr,"Header version: %d\n", + (uint32_t) ((bb->bb_hdrinfo & BOOT_HDR_VER_MASK) >> BOOT_HDR_VER_SHIFT)); + fprintf(stderr,"Data checksum: %08X\n", + (uint32_t) ((bb->bb_secsize & BOOT_DATA_CHECKSUM_MASK) >> BOOT_DATA_CHECKSUM_SHIFT)); + fprintf(stderr,"Architecture info: %08X\n", + (uint32_t) (bb->bb_archinfo & BOOT_ARCHINFO_MASK)); + fprintf(stderr,"\n"); + + for (idx = 59; idx <= 63; idx++) { + fprintf(stderr,"Word %d = %016llX\n",idx,bb->bb_data[idx]); + } +} + +static int host_is_little(void) +{ + unsigned long var = 1; + unsigned char *pvar = (unsigned char *) &var; + + return (*pvar == 1); +} + +int main(int argc, char *argv[]) +{ + int fh; + long bootsize; + long bootbufsize; + unsigned char *bootcode; + struct boot_block bootblock; + uint32_t datacsum,hdrcsum; + int host_le; + + while ((argc > 1) && (argv[1][0] == '-')) { + if (strcmp(argv[1],"-v") == 0) { + verbose = 1; + } + else if (strcmp(argv[1],"-EB") == 0) { + big_endian = 1; + } + else if (strcmp(argv[1],"-EL") == 0) { + big_endian = 0; + } + else if (strcmp(argv[1],"-S") == 0) { + char *tmp_ptr; + argv++; + argc--; + if (argc == 1) { + fprintf(stderr,"-S requires an argument\n"); + exit(1); + } + sector_offset = strtoul(argv[1], &tmp_ptr, 0); + if (*tmp_ptr) { + fprintf(stderr,"Unable to parse %s as a sector offset\n", argv[1]); + exit(1); + } + } + else { + fprintf(stderr,"Invalid switch: %s\n",argv[1]); + exit(1); + } + argv++; + argc--; + } + + /* + * We need to swap things around if the host and + * target are different endianness + */ + + swapflg = 0; + host_le = host_is_little(); + + if (big_endian && host_is_little()) swapflg = 1; + if ((big_endian == 0) && !(host_is_little())) swapflg = 1; + + fprintf(stderr,"Host is %s-endian.\n",host_le ? "little" : "big"); + fprintf(stderr,"Target is %s-endian.\n",big_endian ? "big" : "little"); + + if (argc != 3) { + usage(); + } + + /* + * Read in the boot file + */ + + fh = open(argv[1],O_RDONLY); + if (fh < 0) { + perror(argv[1]); + } + + bootsize = lseek(fh,0L,SEEK_END); + lseek(fh,0L,SEEK_SET); + + bootbufsize = roundup(bootsize,BOOT_BLOCK_BLOCKSIZE); + + bootcode = malloc(bootbufsize); + if (bootcode == NULL) { + perror("malloc"); + exit(1); + } + memset(bootcode,0,bootbufsize); + if (read(fh,bootcode,bootsize) != bootsize) { + perror("read"); + exit(1); + } + + close(fh); + + /* + * Construct the boot block + */ + + + /* Checksum the boot code */ + do_checksum(bootcode,bootbufsize,&datacsum,1); + bswap32(&datacsum); + + + /* fill in the boot block fields, and checksum the boot block */ + bootblock.bb_magic = BOOT_MAGIC_NUMBER; + bootblock.bb_hdrinfo = (((uint64_t) BOOT_HDR_VERSION) << BOOT_HDR_VER_SHIFT); + bootblock.bb_secstart = BOOT_BLOCK_BLOCKSIZE + (sector_offset * 512); + bootblock.bb_secsize = ((uint64_t) bootbufsize) | + (((uint64_t) datacsum) << BOOT_DATA_CHECKSUM_SHIFT); + bootblock.bb_archinfo = 0; /* XXX */ + + do_checksum(&(bootblock.bb_magic),BOOT_BLOCK_SIZE,&hdrcsum,0); + bootblock.bb_hdrinfo |= (uint64_t) hdrcsum; + + if (verbose) dumpbootblock(&bootblock); + + bswap_bootblock(&bootblock); + + /* + * Now write the output file + */ + + fh = open(argv[2],O_RDWR|O_CREAT,S_IREAD|S_IWRITE); + if (fh < 0) { + perror(argv[2]); + exit(1); + } + if (lseek(fh, sector_offset * 512, SEEK_SET) != (sector_offset * 512)) { + perror(argv[2]); + exit(1); + } + if (write(fh,&bootblock,sizeof(bootblock)) != sizeof(bootblock)) { + perror(argv[2]); + exit(1); + } + if (write(fh,bootcode,bootbufsize) != bootbufsize) { + perror(argv[2]); + exit(1); + } + + close(fh); + + fprintf(stderr,"%s -> %s : OK\n",argv[1],argv[2]); + + exit(0); + + +} + diff --git a/cfe/cfe/hosttools/mkflashimage.c b/cfe/cfe/hosttools/mkflashimage.c new file mode 100644 index 0000000..84ec77c --- /dev/null +++ b/cfe/cfe/hosttools/mkflashimage.c @@ -0,0 +1,347 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash Image generator File: mkflashimage.c + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + * This program sticks a header on the front of a binary + * file making it suitable for use with the 'flash' command + * in CFE. The header contains the CFE version # and board + * type, a CRC, and other info to help prevent us from + * flashing bad stuff onto a board. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include +#include + +#ifndef _SYS_INT_TYPES_H +typedef unsigned char uint8_t; +typedef unsigned long long uint64_t; +typedef unsigned long uint32_t; +#endif + +#include "cfe_flashimage.h" +#include +#include +#include +#include + + +static int verbose = 0; +static int big_endian = 1; +static int both_endian = 0; +int mlong64 = 0; +char boardname[32]; + +/* + * This is the offset in the flash where the little-endian image goes + * if we're making a bi-endian flash. + */ + +#define CFE_BIENDIAN_LE_OFFSET (1024*1024) + +static void usage(void) +{ + fprintf(stderr,"usage: mkflashimage [-v] [-EB] [-EL] [-64] [-B boardname] [-V v.v.v] binfile outfile\n"); + fprintf(stderr,"\n"); + fprintf(stderr," mkflashimage [-v] -EX [-64] [-B boardname] [-V v.v.v] BE-binfile LE-binfile outfile\n"); + fprintf(stderr," (this variant used for making bi-endian flash files)\n"); + exit(1); +} + + +static int host_is_little(void) +{ + unsigned long var = 1; + unsigned char *pvar = (unsigned char *) &var; + + return (*pvar == 1); +} + +#define CRC32_POLY 0xEDB88320UL /* CRC-32 Poly */ + +static unsigned int +crc32(const unsigned char *databuf, unsigned int datalen) +{ + unsigned int idx, bit, data, crc = 0xFFFFFFFFUL; + + for (idx = 0; idx < datalen; idx++) { + for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) { + crc = (crc >> 1) ^ (((crc ^ data) & 1) ? CRC32_POLY : 0); + } + } + + return crc; +} + + +void stuff_be32(uint8_t *dest,unsigned int src) +{ + *dest++ = (src >> 24) & 0xFF; + *dest++ = (src >> 16) & 0xFF; + *dest++ = (src >> 8) & 0xFF; + *dest++ = (src >> 0) & 0xFF; +} + +int main(int argc, char *argv[]) +{ + int fh; + int flashsize; + unsigned char *flashcode; + cfe_flashimage_t header; + int host_le; + int majver,minver,ecover; + uint32_t crc; + uint32_t flags; + char *outfile; + + majver = minver = ecover = 0; + boardname[0] = 0; + + while ((argc > 1) && (argv[1][0] == '-')) { + if (strcmp(argv[1],"-v") == 0) { + verbose = 1; + } + else if (strcmp(argv[1],"-EX") == 0) { + if (verbose) fprintf(stderr,"[Image file will be marked Bi-Endian]\n"); + both_endian = 1; + } + else if (strcmp(argv[1],"-EB") == 0) { + if (verbose) fprintf(stderr,"[Image file will be marked Big-Endian]\n"); + big_endian = 1; + } + else if (strcmp(argv[1],"-EL") == 0) { + if (verbose) fprintf(stderr,"[Image file will be marked Little-Endian]\n"); + big_endian = 0; + } + else if (strcmp(argv[1],"-64") == 0) { + if (verbose) fprintf(stderr,"[Image file will be marked 64-bit]\n"); + mlong64 = 1; + } + else if (strcmp(argv[1],"-B") == 0) { + argc--; + argv++; + strcpy(boardname,argv[1]); + if (verbose) fprintf(stderr,"[Board name: %s]\n",boardname); + } + else if (strcmp(argv[1],"-V") == 0) { + argc--; + argv++; + sscanf(argv[1],"%d.%d.%d",&majver,&minver,&ecover); + if (verbose) fprintf(stderr,"[Image version: %d.%d.%d]\n",majver,minver,ecover); + } + else { + fprintf(stderr,"Invalid switch: %s\n",argv[1]); + exit(1); + } + argv++; + argc--; + } + + /* + * We need to swap things around if the host and + * target are different endianness + */ + + host_le = host_is_little(); + + if (verbose) { + fprintf(stderr,"Host is %s-endian.\n",host_le ? "little" : "big"); + if (both_endian) { + fprintf(stderr,"Target is bi-endian.\n"); + } + else { + fprintf(stderr,"Target is %s-endian.\n",big_endian ? "big" : "little"); + } + } + + if ((both_endian && (argc != 4)) || (!both_endian && (argc != 3))) { + usage(); + } + + /* + * Read in the boot file(s) + */ + + flags = 0; + + if (both_endian) { + int be_size; + + flags |= (CFE_IMAGE_EB | CFE_IMAGE_EL); + + if (verbose) fprintf(stderr,"Reading: %s\n",argv[2]); + + fh = open(argv[2],O_RDONLY); + if (fh < 0) { + perror(argv[2]); + } + + flashsize = lseek(fh,0L,SEEK_END); + lseek(fh,0L,SEEK_SET); + + flashcode = malloc(flashsize+CFE_BIENDIAN_LE_OFFSET); + if (flashcode == NULL) { + perror("malloc"); + exit(1); + } + memset(flashcode,0xFF,flashsize+CFE_BIENDIAN_LE_OFFSET); + + if (read(fh,flashcode+CFE_BIENDIAN_LE_OFFSET,flashsize) != flashsize) { + perror("read"); + exit(1); + } + + close(fh); + + if (memcmp(flashcode+CFE_BIENDIAN_LE_OFFSET,CFE_IMAGE_SEAL,4) == 0) { + fprintf(stderr,"File '%s' already has an image header.\n",argv[2]); + exit(1); + } + + flashsize += CFE_BIENDIAN_LE_OFFSET; /* actual file size */ + + if (verbose) fprintf(stderr,"Reading: %s\n",argv[1]); + + fh = open(argv[1],O_RDONLY); + if (fh < 0) { + perror(argv[1]); + exit(1); + } + + be_size = lseek(fh,0L,SEEK_END); + lseek(fh,0L,SEEK_SET); + if (be_size > CFE_BIENDIAN_LE_OFFSET) { + fprintf(stderr,"File '%s' will not fit within first %d bytes of flash image\n", + argv[1],CFE_BIENDIAN_LE_OFFSET); + close(fh); + exit(1); + } + + if (read(fh,flashcode,be_size) != be_size) { + perror("read"); + exit(1); + } + + close(fh); + + outfile = argv[3]; + + } + else { + if (big_endian) flags |= CFE_IMAGE_EB; + else flags |= CFE_IMAGE_EL; + + fh = open(argv[1],O_RDONLY); + if (fh < 0) { + perror(argv[1]); + exit(1); + } + + flashsize = lseek(fh,0L,SEEK_END); + lseek(fh,0L,SEEK_SET); + + flashcode = malloc(flashsize); + if (flashcode == NULL) { + perror("malloc"); + exit(1); + } + memset(flashcode,0,flashsize); + if (read(fh,flashcode,flashsize) != flashsize) { + perror("read"); + exit(1); + } + + close(fh); + + if (memcmp(flashcode,CFE_IMAGE_SEAL,4) == 0) { + fprintf(stderr,"File '%s' already has an image header.\n",argv[1]); + exit(1); + } + + outfile = argv[2]; + } + + + /* + * Construct the flash header + */ + + if (mlong64) flags |= CFE_IMAGE_MLONG64; + crc = crc32(flashcode,flashsize); + + memset(&header,0,sizeof(header)); + memcpy(header.seal,CFE_IMAGE_SEAL,sizeof(header.seal)); + stuff_be32(header.flags,flags); + stuff_be32(header.size,flashsize); + stuff_be32(header.crc,crc); + header.majver = majver; + header.minver = minver; + header.ecover = ecover; + header.miscver = 0; + strcpy(header.boardname,boardname); + + /* + * Now write the output file + */ + + fh = open(outfile,O_RDWR|O_CREAT|O_TRUNC,S_IREAD|S_IWRITE|S_IRGRP|S_IWGRP|S_IROTH); + if (fh < 0) { + perror(outfile); + exit(1); + } + if (write(fh,&header,sizeof(header)) != sizeof(header)) { + perror(outfile); + exit(1); + } + if (write(fh,flashcode,flashsize) != flashsize) { + perror(outfile); + exit(1); + } + + fprintf(stderr,"Wrote %d bytes to %s\n",sizeof(header)+flashsize,outfile); + + close(fh); + + exit(0); + + +} + diff --git a/cfe/cfe/hosttools/mkpcidb.c b/cfe/cfe/hosttools/mkpcidb.c new file mode 100644 index 0000000..fe7d314 --- /dev/null +++ b/cfe/cfe/hosttools/mkpcidb.c @@ -0,0 +1,157 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PCI Table Generator File: mkpcidb.c + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + * This program munges the PCI table into a form that uses + * fewer embedded pointers. Pointers are evil for the + * relocatable version of CFE since they chew up valuable + * initialized data segment space, and we only have + * 64KB of that. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include + +typedef unsigned short pci_vendor_id_t; +typedef unsigned short pci_product_id_t; + +struct pci_knowndev { + pci_vendor_id_t vendor; + pci_product_id_t product; + int flags; + char *vendorname, *productname; +}; + +#include "../pci/pcidevs.h" +#define PCI_KNOWNDEV_NOPROD 0x01 +#include "../pci/pcidevs_data.h" + + + +struct pci_knowndev2 { + pci_vendor_id_t vendor; + pci_product_id_t product; + int flags; + int vendorname; + int productname; +}; + +#define MAXPCIDEVS 5000 +#define MAXSTRINGTABLE (1024*1024) + +struct pci_knowndev2 knowndevs[MAXPCIDEVS]; +char stringtable[MAXSTRINGTABLE]; +int curstringptr = 0; + +int allocstring(char *string) +{ + int ptr; + + if (!string) return -1; + + ptr = curstringptr; + strcpy(&stringtable[ptr],string); + curstringptr += strlen(string)+1; + return ptr; +} + +int main(int argc,char *argv[]) +{ + struct pci_knowndev2 *outdev; + const struct pci_knowndev *indev; + int cnt = 0; + int idx; + + indev = pci_knowndevs; + outdev = knowndevs; + cnt = 0; + + while (indev->vendorname) { + outdev->vendor = indev->vendor; + outdev->product = indev->product; + outdev->flags = indev->flags; + outdev->vendorname = allocstring(indev->vendorname); + outdev->productname = allocstring(indev->productname); + cnt++; + indev++; + outdev++; + } + + outdev->vendor = 0; + outdev->product = 0; + outdev->flags = 0; + outdev->vendorname = -1; + outdev->productname = -1; + cnt++; + + fprintf(stderr,"%d total devices (%d bytes), %d bytes of strings\n", + cnt,cnt*sizeof(struct pci_knowndev2),curstringptr); + + printf("\n\n\n"); + printf("const static struct pci_knowndev2 _pci_knowndevs[] __attribute__ ((section (\".text\"))) = {\n"); + for (idx = 0; idx < cnt; idx++) { + printf("\t{0x%04X,0x%04X,0x%08X,%d,%d},\n", + knowndevs[idx].vendor, + knowndevs[idx].product, + knowndevs[idx].flags, + knowndevs[idx].vendorname, + knowndevs[idx].productname); + } + printf("};\n\n\n"); + printf("const static char _pci_knowndevs_text[] __attribute__ ((section (\".text\"))) = {\n"); + for (idx = 0; idx < curstringptr; idx++) { + if ((idx % 16) == 0) printf("\t"); + printf("0x%02X,",stringtable[idx]); + if ((idx % 16) == 15) printf("\n"); + } + printf("0};\n\n"); + + printf("static const struct pci_knowndev2 *pci_knowndevs = _pci_knowndevs;\n"); + printf("static const char *pci_knowndevs_text = _pci_knowndevs_text;\n"); + printf("#define PCI_STRING_NULL (-1)\n"); + printf("#define PCI_STRING(x) (&pci_knowndevs_text[(x)])\n\n"); + + + + exit(0); +} + + diff --git a/cfe/cfe/include/cfe.h b/cfe/cfe/include/cfe.h new file mode 100755 index 0000000..013fb13 --- /dev/null +++ b/cfe/cfe/include/cfe.h @@ -0,0 +1,101 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * CFE version # and prototypes File: cfe.h + * + * CFE's version # temporarily lives here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Version number + ********************************************************************* */ + +#define CFE_VER_MAJOR CFE_VER_MAJ +#define CFE_VER_MINOR CFE_VER_MIN +#define CFE_VER_BUILD CFE_VER_ECO + +/* Numbers must not exceed 255 */ +#define BCM63XX_MAJOR 106 +#define BCM63XX_MINOR 24 + +/* ********************************************************************* + * Some runtime startup parameters + ********************************************************************* */ +#if !defined(__ASSEMBLER__) +extern unsigned cfe_startflags; +#endif + +#define CFE_INIT_USER 0x0000FFFF /* these are BSP-specific flags */ +#define CFE_INIT_SAFE 0x00010000 /* "Safe mode" */ +#define CFE_INIT_PCI 0x00020000 /* Initialize PCI */ +#define CFE_LDT_SLAVE 0x00040000 /* Select LDT slave mode */ + +/* ********************************************************************* + * Other constants + ********************************************************************* */ + +#define CFE_MAX_HANDLE 64 /* max file handles */ + +#if !defined(__ASSEMBLER__) + +/* ********************************************************************* + * prototypes + ********************************************************************* */ + +void board_console_init(void); +void board_device_init(void); +void board_final_init(void); +void board_device_reset(void); +#define CFE_BUFFER_CONSOLE "buffer" +int cfe_set_console(char *); +int cfe_set_envdevice(char *); +void cfe_restart(void); +void cfe_command_loop(void); +void cfe_leds(unsigned int val); +void cfe_ledstr(const char *str); +void cfe_launch(unsigned long ept); +void cfe_start(unsigned long ept); +void cfe_warmstart(unsigned long long); +#define SETLEDS(x) cfe_ledstr(x) +const char *cfe_errortext(int err); + +#endif diff --git a/cfe/cfe/include/cfe_autoboot.h b/cfe/cfe/include/cfe_autoboot.h new file mode 100644 index 0000000..603803b --- /dev/null +++ b/cfe/cfe/include/cfe_autoboot.h @@ -0,0 +1,71 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Automatic OS bootstrap File: cfe_autoboot.h + * + * This module handles OS bootstrap stuff. We use this version + * to do "automatic" booting; walking down a list of possible boot + * options, trying them until something good happens. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#define CFE_AUTOBOOT_END 0 +#define CFE_AUTOBOOT_NETWORK 1 +#define CFE_AUTOBOOT_DISK 2 +#define CFE_AUTOBOOT_RAW 3 + +typedef struct cfe_autoboot_method_s { + queue_t ab_qblock; + int ab_type; + int ab_flags; + char *ab_dev; + char *ab_loader; + char *ab_filesys; + char *ab_file; +} cfe_autoboot_method_t; + +#define CFE_AUTOFLG_POLLCONSOLE 1 /* boot can be interrupted */ +#define CFE_AUTOFLG_TRYFOREVER 2 /* keep trying forever */ + +int cfe_autoboot(char *dev,int flags); +int cfe_add_autoboot(int type,int flags,char *dev,char *loader,char *filesys,char *file); + + diff --git a/cfe/cfe/include/cfe_boot.h b/cfe/cfe/include/cfe_boot.h new file mode 100644 index 0000000..93c3c6d --- /dev/null +++ b/cfe/cfe/include/cfe_boot.h @@ -0,0 +1,58 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Bootstrap prototypes File: cfe_boot.h + * + * Prototypes for main bootstrap routines + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define BOOT_START_ADDRESS 0x20000000 /* VA of boot area */ +#define BOOT_AREA_SIZE (256*1024) /* 256K */ + + + + diff --git a/cfe/cfe/include/cfe_bootblock.h b/cfe/cfe/include/cfe_bootblock.h new file mode 100644 index 0000000..c3a93f0 --- /dev/null +++ b/cfe/cfe/include/cfe_bootblock.h @@ -0,0 +1,129 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Boot Block File: cfe_bootblock.h + * + * The structure of the boot block used on block-style devices + * like disks and CDROMs + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* + * CFE boot block, modeled loosely on Alpha. + * + * It consists of: + * + * BSD disk label + * + * Boot block info (5 u_int_64s) + * + * The boot block portion looks like: + * + * + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * | BOOT_MAGIC_NUMBER | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * | Flags | Reserved | Vers | Header Checksum | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * | Secondary Loader Location (bytes) | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * | Loader Checksum | Size of loader (bytes) | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * | Reserved | Architecture Information | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * Boot block fields should always be read as 64-bit numbers. + * + */ + + +struct boot_block { + uint64_t bb_data[64]; /* data (disklabel, also as below) */ +}; +#define bb_magic bb_data[59] /* magic number */ +#define bb_hdrinfo bb_data[60] /* header checksum, ver, flags */ +#define bb_secstart bb_data[61] /* secondary start (bytes) */ +#define bb_secsize bb_data[62] /* secondary size (bytes) */ +#define bb_archinfo bb_data[63] /* architecture info */ + +#define BOOT_BLOCK_OFFSET 0 /* offset of boot block. */ +#define BOOT_BLOCK_BLOCKSIZE 512 /* block size for sec. size/start, + * and for boot block itself + */ +#define BOOT_BLOCK_SIZE 40 /* 5 64-bit words */ + +/* + * This is the highest block number that we look at when + * searching for a valid boot block + */ +#define BOOT_BLOCK_MAXLOC 16 + +/* + * Fields within the boot block + */ +#define _U64(x) ((uint64_t) x) +#define BOOT_MAGIC_NUMBER _U64(0x43465631424f4f54) +#define BOOT_HDR_CHECKSUM_MASK _U64(0x00000000FFFFFFFF) +#define BOOT_HDR_VER_MASK _U64(0x000000FF00000000) +#define BOOT_HDR_VER_SHIFT 32 +#define BOOT_HDR_FLAGS_MASK _U64(0xFF00000000000000) +#define BOOT_SECSIZE_MASK _U64(0x00000000FFFFFFFF) +#define BOOT_DATA_CHECKSUM_MASK _U64(0xFFFFFFFF00000000) +#define BOOT_DATA_CHECKSUM_SHIFT 32 +#define BOOT_ARCHINFO_MASK _U64(0x00000000FFFFFFFF) + +#define BOOT_HDR_VERSION 1 + +#define CHECKSUM_BOOT_DATA(data,len,cksum) \ + do { \ + uint32_t *_ptr = (uint32_t *) (data); \ + uint32_t _cksum; \ + int _i; \ + \ + _cksum = 0; \ + for (_i = 0; \ + _i < ((len) / sizeof (uint32_t)); \ + _i++) \ + _cksum += _ptr[_i]; \ + *(cksum) = _cksum; \ + } while (0) + + diff --git a/cfe/cfe/include/cfe_console.h b/cfe/cfe/include/cfe_console.h new file mode 100755 index 0000000..7ee1056 --- /dev/null +++ b/cfe/cfe/include/cfe_console.h @@ -0,0 +1,92 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Console prototypes File: cfe_console.c + * + * Prototypes for routines dealing with the console. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define VKEY(x) (0x100|(x)) +#define VKEY_UP VKEY(1) +#define VKEY_DOWN VKEY(2) +#define VKEY_LEFT VKEY(3) +#define VKEY_RIGHT VKEY(4) +#define VKEY_PGUP VKEY(5) +#define VKEY_PGDN VKEY(6) +#define VKEY_HOME VKEY(7) +#define VKEY_END VKEY(8) +#define VKEY_F1 VKEY(0x10) +#define VKEY_F2 VKEY(0x11) +#define VKEY_F3 VKEY(0x12) +#define VKEY_F4 VKEY(0x13) +#define VKEY_F5 VKEY(0x14) +#define VKEY_F6 VKEY(0x15) +#define VKEY_F7 VKEY(0x16) +#define VKEY_F8 VKEY(0x17) +#define VKEY_F9 VKEY(0x18) +#define VKEY_F10 VKEY(0x19) +#define VKEY_F11 VKEY(0x1A) +#define VKEY_F12 VKEY(0x1B) +#define VKEY_ESC 27 + + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int console_open(char *name); +int console_close(void); +int console_read(char *buffer,int length); +int console_write(char *buffer,int length); +int console_status(void); +int console_readkey(void); +int console_readline(char *prompt,char *str,int len); +int console_readline_noedit(char *prompt,char *str,int len); +int console_readline(char *prompt,char *str,int len); +extern char *console_name; +extern int console_handle; +void console_log(const char *tmplt,...); + + diff --git a/cfe/cfe/include/cfe_devfuncs.h b/cfe/cfe/include/cfe_devfuncs.h new file mode 100644 index 0000000..207c4a6 --- /dev/null +++ b/cfe/cfe/include/cfe_devfuncs.h @@ -0,0 +1,76 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Device function prototypes File: cfe_devfuncs.h + * + * This module contains prototypes for cfe_devfuncs.c, a set + * of wrapper routines to the IOCB interface. This file, + * along with cfe_devfuncs.c, can be incorporated into programs + * that need to call CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#define CFE_EPTSEAL 0x43464531 +#if (CFG_BIENDIAN) && defined(__MIPSEB) +#define CFE_EPTSEAL_REV 0x31454643 +#endif + +#define CFE_APISEAL 0xBFC004E0 +#define CFE_APIENTRY 0xBFC00500 + + + +#ifndef __ASSEMBLER__ +int cfe_open(char *name); +int cfe_close(int handle); +int cfe_readblk(int handle,cfe_offset_t offset,unsigned char *buffer,int length); +int cfe_read(int handle,unsigned char *buffer,int length); +int cfe_writeblk(int handle,cfe_offset_t offset,unsigned char *buffer,int length); +int cfe_write(int handle,unsigned char *buffer,int length); +int cfe_ioctl(int handle,unsigned int ioctlnum,unsigned char *buffer,int length,int *retlen, + cfe_offset_t offset); +int cfe_inpstat(int handle); +int cfe_getenv(char *name,char *dest,int destlen); +long long cfe_getticks(void); +int cfe_exit(int warm,int code); +int cfe_flushcache(int flg); +int cfe_getdevinfo(char *name); +int cfe_flushcache(int); +#endif diff --git a/cfe/cfe/include/cfe_device.h b/cfe/cfe/include/cfe_device.h new file mode 100644 index 0000000..f90b167 --- /dev/null +++ b/cfe/cfe/include/cfe_device.h @@ -0,0 +1,118 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Device manager definitions File: cfe_device.h + * + * Structures, constants, etc. for the device manager, which keeps + * track of installed devices in CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _CFE_DEVICE_H +#define _CFE_DEVICE_H + +#include "lib_queue.h" + +typedef struct cfe_devdisp_s cfe_devdisp_t; + + +/* + * The Device structure defines a particular instance of a device. + * They are generated as a result of calling the cfe_attach call. + */ + +typedef struct cfe_device_s { + queue_t dev_next; + char *dev_fullname; + void *dev_softc; + int dev_class; + const cfe_devdisp_t *dev_dispatch; + int dev_opencount; + char *dev_description; +} cfe_device_t; + +/* + * This is what gets returned from the OPEN call + */ +typedef struct cfe_devctx_s { + cfe_device_t *dev_dev; + void *dev_softc; + void *dev_openinfo; +} cfe_devctx_t; + + +/* + * This defines a given device class. Even though there are + * three identical MACs, there is only one of these. + */ + +struct cfe_devdisp_s { + int (*dev_open)(cfe_devctx_t *ctx); + int (*dev_read)(cfe_devctx_t *ctx,iocb_buffer_t *buffer); + int (*dev_inpstat)(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); + int (*dev_write)(cfe_devctx_t *ctx,iocb_buffer_t *buffer); + int (*dev_ioctl)(cfe_devctx_t *ctx,iocb_buffer_t *buffer); + int (*dev_close)(cfe_devctx_t *ctx); + void (*dev_poll)(cfe_devctx_t *ctx,int64_t ticks); + void (*dev_reset)(void *softc); /* called when device is closed, so no devctx_t */ +}; + + + +typedef struct cfe_driver_s { + char *drv_description; /* Description of device for SHOW commands */ + char *drv_bootname; /* Device's name prefix for open() */ + int drv_class; + const cfe_devdisp_t *drv_dispatch; + void (*drv_probe)(struct cfe_driver_s *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); +} cfe_driver_t; + +char *cfe_device_name(cfe_devctx_t *ctx); +void cfe_attach(cfe_driver_t *devname,void *softc,char *bootinfo,char *description); +int cfe_attach_idx(cfe_driver_t *drv,int idx,void *softc,char *bootinfo,char *description); +cfe_device_t *cfe_finddev(char *name); +void cfe_attach_init(void); +#define cfe_add_device(devdescr,a,b,ptr) (devdescr)->drv_probe(devdescr,a,b,ptr) +void cfe_device_reset(void); + +#endif diff --git a/cfe/cfe/include/cfe_error.h b/cfe/cfe/include/cfe_error.h new file mode 100644 index 0000000..9c564e1 --- /dev/null +++ b/cfe/cfe/include/cfe_error.h @@ -0,0 +1,110 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Error codes File: cfe_error.h + * + * CFE's global error code list is here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + + +#define CFE_OK 0 +#define CFE_ERR -1 /* generic error */ +#define CFE_ERR_INV_COMMAND -2 +#define CFE_ERR_EOF -3 +#define CFE_ERR_IOERR -4 +#define CFE_ERR_NOMEM -5 +#define CFE_ERR_DEVNOTFOUND -6 +#define CFE_ERR_DEVOPEN -7 +#define CFE_ERR_INV_PARAM -8 +#define CFE_ERR_ENVNOTFOUND -9 +#define CFE_ERR_ENVREADONLY -10 + +#define CFE_ERR_NOTELF -11 +#define CFE_ERR_NOT32BIT -12 +#define CFE_ERR_WRONGENDIAN -13 +#define CFE_ERR_BADELFVERS -14 +#define CFE_ERR_NOTMIPS -15 +#define CFE_ERR_BADELFFMT -16 +#define CFE_ERR_BADADDR -17 + +#define CFE_ERR_FILENOTFOUND -18 +#define CFE_ERR_UNSUPPORTED -19 + +#define CFE_ERR_HOSTUNKNOWN -20 + +#define CFE_ERR_TIMEOUT -21 + +#define CFE_ERR_PROTOCOLERR -22 + +#define CFE_ERR_NETDOWN -23 +#define CFE_ERR_NONAMESERVER -24 + +#define CFE_ERR_NOHANDLES -25 +#define CFE_ERR_ALREADYBOUND -26 + +#define CFE_ERR_CANNOTSET -27 +#define CFE_ERR_NOMORE -28 +#define CFE_ERR_BADFILESYS -29 +#define CFE_ERR_FSNOTAVAIL -30 + +#define CFE_ERR_INVBOOTBLOCK -31 +#define CFE_ERR_WRONGDEVTYPE -32 +#define CFE_ERR_BBCHECKSUM -33 +#define CFE_ERR_BOOTPROGCHKSUM -34 + +#define CFE_ERR_LDRNOTAVAIL -35 + +#define CFE_ERR_NOTREADY -36 + +#define CFE_ERR_GETMEM -37 +#define CFE_ERR_SETMEM -38 + +#define CFE_ERR_NOTCONN -39 +#define CFE_ERR_ADDRINUSE -40 + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#define CFE_ERR_INTR -41 +#define CFE_ERR_BADIMAGE -42 +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + + diff --git a/cfe/cfe/include/cfe_fileops.h b/cfe/cfe/include/cfe_fileops.h new file mode 100644 index 0000000..f119037 --- /dev/null +++ b/cfe/cfe/include/cfe_fileops.h @@ -0,0 +1,109 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Filesystem dispatch defs File: cfe_fileops.h + * + * CFE supports multiple access methods to files on boot + * media. This module contains the dispatch table structures + * for "file systems". + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define FILE_SEEK_BEGINNING 0 +#define FILE_SEEK_CURRENT 1 + +#define FILE_MODE_READ 1 +#define FILE_MODE_WRITE 2 + +/* These flags should not conflict with the loader arg flags (see cfe_loadargs_t) */ +#define FSYS_TYPE_NETWORK 0x40000000 + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define BDINIT(ops,fsctx,name) (ops)->init((fsctx),(name)) +#define BDOPEN(ops,ref,fsctx,name) (ops)->open((ref),(fsctx),(name),FILE_MODE_READ) +#define BDOPEN2(ops,ref,fsctx,name,mode) (ops)->open((ref),(fsctx),(name),(mode)) +#define BDOPEN_WR(ops,ref,fsctx,name) (ops)->open((ref),(fsctx),(name),FILE_MODE_WRITE) +#define BDREAD(ops,ref,buf,len) (ops)->read((ref),(buf),(len)) +#define BDWRITE(ops,ref,buf,len) (ops)->write((ref),(buf),(len)) +#define BDCLOSE(ops,ref) (ops)->close((ref)) +#define BDUNINIT(ops,ref) (ops)->uninit((ref)) +#define BDSEEK(ops,ref,offset,how) (ops)->seek((ref),(offset),(how)) + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct fileio_dispatch_s { + const char *method; + unsigned int loadflags; + int (*init)(void **fsctx,void *device); + int (*open)(void **ref,void *fsctx,char *filename,int mode); + int (*read)(void *ref,uint8_t *buf,int len); + int (*write)(void *ref,uint8_t *buf,int len); + int (*seek)(void *ref,int offset,int how); + void (*close)(void *ref); + void (*uninit)(void *devctx); +} fileio_dispatch_t; + +typedef struct fileio_ctx_s { + const fileio_dispatch_t *ops; + void *fsctx; +} fileio_ctx_t; + +const fileio_dispatch_t *cfe_findfilesys(const char *name); + +int fs_init(char *fsname,fileio_ctx_t **fsctx,void *device); +int fs_uninit(fileio_ctx_t *); +int fs_open(fileio_ctx_t *,void **ref,char *filename,int mode); +int fs_close(fileio_ctx_t *,void *ref); +int fs_read(fileio_ctx_t *,void *ref,uint8_t *buffer,int len); +int fs_write(fileio_ctx_t *,void *ref,uint8_t *buffer,int len); +int fs_seek(fileio_ctx_t *,void *ref,int offset,int how); +int fs_hook(fileio_ctx_t *fsctx,char *fsname); + + diff --git a/cfe/cfe/include/cfe_flashimage.h b/cfe/cfe/include/cfe_flashimage.h new file mode 100644 index 0000000..4e4647c --- /dev/null +++ b/cfe/cfe/include/cfe_flashimage.h @@ -0,0 +1,64 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash Image defs File: cfe_flashimage.h + * + * This file contains stuff that describes the image header on + * the front of our flash images. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +typedef struct cfe_flashimage_s { + uint8_t seal[4]; /* CFE1 */ + uint8_t flags[4]; /* Various flags, always big-endian */ + uint8_t size[4]; /* Image size, in bytes, always big-endian */ + uint8_t crc[4]; /* CRC-32, always big-endian */ + uint8_t boardname[32]; /* Board name */ + uint8_t majver,minver,ecover,miscver; /* Firmware version */ + uint8_t reserved[12]; /* not used just yet */ +} cfe_flashimage_t; /* should be 64 bytes */ + + +#define CFE_IMAGE_SEAL "CFE1" +#define CFE_IMAGE_EB 0x00000001 +#define CFE_IMAGE_EL 0x00000002 +#define CFE_IMAGE_MLONG64 0x00000004 + diff --git a/cfe/cfe/include/cfe_iocb.h b/cfe/cfe/include/cfe_iocb.h new file mode 100644 index 0000000..bc62078 --- /dev/null +++ b/cfe/cfe/include/cfe_iocb.h @@ -0,0 +1,211 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCB definitions File: cfe_iocb.h + * + * This module describes CFE's IOCB structure, the main + * data structure used to communicate API requests with CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _CFE_IOCB_H +#define _CFE_IOCB_H + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define CFE_CMD_FW_GETINFO 0 +#define CFE_CMD_FW_RESTART 1 +#define CFE_CMD_FW_BOOT 2 +#define CFE_CMD_FW_CPUCTL 3 +#define CFE_CMD_FW_GETTIME 4 +#define CFE_CMD_FW_MEMENUM 5 +#define CFE_CMD_FW_FLUSHCACHE 6 + +#define CFE_CMD_DEV_GETHANDLE 9 +#define CFE_CMD_DEV_ENUM 10 +#define CFE_CMD_DEV_OPEN 11 +#define CFE_CMD_DEV_INPSTAT 12 +#define CFE_CMD_DEV_READ 13 +#define CFE_CMD_DEV_WRITE 14 +#define CFE_CMD_DEV_IOCTL 15 +#define CFE_CMD_DEV_CLOSE 16 +#define CFE_CMD_DEV_GETINFO 17 + +#define CFE_CMD_ENV_ENUM 20 +#define CFE_CMD_ENV_GET 22 +#define CFE_CMD_ENV_SET 23 +#define CFE_CMD_ENV_DEL 24 + +#define CFE_CMD_MAX 32 + +#define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */ + +#define CFE_MI_RESERVED 0 /* memory is reserved, do not use */ +#define CFE_MI_AVAILABLE 1 /* memory is available */ + +#define CFE_FLG_WARMSTART 0x00000001 +#define CFE_FLG_FULL_ARENA 0x00000001 +#define CFE_FLG_ENV_PERMANENT 0x00000001 + +#define CFE_CPU_CMD_START 1 +#define CFE_CPU_CMD_STOP 0 + +#define CFE_STDHANDLE_CONSOLE 0 + +#define CFE_DEV_NETWORK 1 +#define CFE_DEV_DISK 2 +#define CFE_DEV_FLASH 3 +#define CFE_DEV_SERIAL 4 +#define CFE_DEV_CPU 5 +#define CFE_DEV_NVRAM 6 +#define CFE_DEV_CLOCK 7 +#define CFE_DEV_OTHER 8 +#define CFE_DEV_MASK 0x0F + +#define CFE_CACHE_FLUSH_D 1 +#define CFE_CACHE_INVAL_I 2 +#define CFE_CACHE_INVAL_D 4 +#define CFE_CACHE_INVAL_L2 8 +#define CFE_CACHE_FLUSH_L2 16 +#define CFE_CACHE_INVAL_RANGE 32 +#define CFE_CACHE_FLUSH_RANGE 64 + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +#define unsigned signed /* Kludge to get unsigned size-shaped type. */ +typedef __SIZE_TYPE__ cfe_int_t; +#undef unsigned +typedef __SIZE_TYPE__ cfe_uint_t; +typedef unsigned long long cfe_offset_t; +typedef long long cfe_int64_t; +typedef unsigned char *cfe_ptr_t; + +typedef struct iocb_buffer_s { + cfe_offset_t buf_offset; /* offset on device (bytes) */ + cfe_ptr_t buf_ptr; /* pointer to a buffer */ + cfe_uint_t buf_length; /* length of this buffer */ + cfe_uint_t buf_retlen; /* returned length (for read ops) */ + cfe_uint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */ +} iocb_buffer_t; + +#define buf_devflags buf_ioctlcmd /* returned device info flags */ + +typedef struct iocb_inpstat_s { + cfe_uint_t inp_status; /* 1 means input available */ +} iocb_inpstat_t; + +typedef struct iocb_envbuf_s { + int enum_idx; /* 0-based enumeration index */ + cfe_ptr_t name_ptr; /* name string buffer */ + cfe_int_t name_length; /* size of name buffer */ + cfe_ptr_t val_ptr; /* value string buffer */ + cfe_int_t val_length; /* size of value string buffer */ +} iocb_envbuf_t; + +typedef struct iocb_cpuctl_s { + cfe_uint_t cpu_number; /* cpu number to control */ + cfe_uint_t cpu_command; /* command to issue to CPU */ + cfe_uint_t start_addr; /* CPU start address */ + cfe_uint_t gp_val; /* starting GP value */ + cfe_uint_t sp_val; /* starting SP value */ + cfe_uint_t a1_val; /* starting A1 value */ +} iocb_cpuctl_t; + +typedef struct iocb_time_s { + long long ticks; /* current time in ticks */ +} iocb_time_t; + +typedef struct iocb_exitstat_s { + cfe_int_t status; +} iocb_exitstat_t; + +typedef struct iocb_meminfo_s { + cfe_int_t mi_idx; /* 0-based enumeration index */ + cfe_int_t mi_type; /* type of memory block */ + cfe_int64_t mi_addr; /* physical start address */ + cfe_int64_t mi_size; /* block size */ +} iocb_meminfo_t; + +#define CFE_FWI_64BIT 0x00000001 +#define CFE_FWI_32BIT 0x00000002 +#define CFE_FWI_RELOC 0x00000004 +#define CFE_FWI_UNCACHED 0x00000008 +#define CFE_FWI_MULTICPU 0x00000010 +#define CFE_FWI_FUNCSIM 0x00000020 +#define CFE_FWI_RTLSIM 0x00000040 + +typedef struct iocb_fwinfo_s { + cfe_int64_t fwi_version; /* major, minor, eco version */ + cfe_int64_t fwi_totalmem; /* total installed mem */ + cfe_int64_t fwi_flags; /* various flags */ + cfe_int64_t fwi_boardid; /* board ID */ + cfe_int64_t fwi_bootarea_va; /* VA of boot area */ + cfe_int64_t fwi_bootarea_pa; /* PA of boot area */ + cfe_int64_t fwi_bootarea_size; /* size of boot area */ + cfe_int64_t fwi_reserved1; + cfe_int64_t fwi_reserved2; + cfe_int64_t fwi_reserved3; +} iocb_fwinfo_t; + + +typedef struct cfe_iocb_s { + cfe_uint_t iocb_fcode; /* IOCB function code */ + cfe_int_t iocb_status; /* return status */ + cfe_int_t iocb_handle; /* file/device handle */ + cfe_uint_t iocb_flags; /* flags for this IOCB */ + cfe_uint_t iocb_psize; /* size of parameter list */ + union { + iocb_buffer_t iocb_buffer; /* buffer parameters */ + iocb_inpstat_t iocb_inpstat; /* input status parameters */ + iocb_envbuf_t iocb_envbuf; /* environment function parameters */ + iocb_cpuctl_t iocb_cpuctl; /* CPU control parameters */ + iocb_time_t iocb_time; /* timer parameters */ + iocb_meminfo_t iocb_meminfo; /* memory arena info parameters */ + iocb_fwinfo_t iocb_fwinfo; /* firmware information */ + iocb_exitstat_t iocb_exitstat; /* Exit Status */ + } plist; +} cfe_iocb_t; + + +#endif diff --git a/cfe/cfe/include/cfe_ioctl.h b/cfe/cfe/include/cfe_ioctl.h new file mode 100644 index 0000000..1a389f8 --- /dev/null +++ b/cfe/cfe/include/cfe_ioctl.h @@ -0,0 +1,167 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCTL definitions File: cfe_ioctl.h + * + * IOCTL function numbers and I/O data structures. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * NVFAM and FLASH stuff + ********************************************************************* */ + +#define IOCTL_NVRAM_GETINFO 1 /* return nvram_info_t */ +#define IOCTL_NVRAM_ERASE 2 /* erase sector containing nvram_info_t area */ +#define IOCTL_FLASH_ERASE_SECTOR 3 /* erase an arbitrary sector */ +#define IOCTL_FLASH_ERASE_ALL 4 /* Erase the entire flash */ +#define IOCTL_FLASH_WRITE_ALL 5 /* write entire flash */ +#define IOCTL_FLASH_GETINFO 6 /* get flash device info */ +#define IOCTL_FLASH_GETSECTORS 7 /* get sector information */ +#define IOCTL_FLASH_ERASE_RANGE 8 /* erase range of bytes */ +#define IOCTL_NVRAM_UNLOCK 9 /* allow r/w beyond logical end of device */ +#define IOCTL_FLASH_PROTECT_RANGE 10 /* Protect a group of sectors */ +#define IOCTL_FLASH_UNPROTECT_RANGE 11 /* unprotect a group of sectors */ +#define IOCTL_FLASH_DATA_WIDTH_MODE 12 /* switch flash and gen bus to support 8 or 16-bit mode I/Os */ +#define IOCTL_FLASH_BURST_MODE 13 /* configure gen bus for burst mode */ + +typedef struct flash_range_s { + unsigned int range_base; + unsigned int range_length; +} flash_range_t; + +typedef struct flash_info_s { + unsigned long long flash_base; /* flash physical base address */ + unsigned int flash_size; /* available device size in bytes */ + unsigned int flash_type; /* type, from FLASH_TYPE below */ + unsigned int flash_flags; /* Various flags (FLASH_FLAG_xxx) */ +} flash_info_t; + +typedef struct flash_sector_s { + int flash_sector_idx; + int flash_sector_status; + unsigned int flash_sector_offset; + unsigned int flash_sector_size; +} flash_sector_t; + +#define FLASH_SECTOR_OK 0 +#define FLASH_SECTOR_INVALID -1 + +#define FLASH_TYPE_UNKNOWN 0 /* not sure what kind of flash */ +#define FLASH_TYPE_SRAM 1 /* not flash: it's SRAM */ +#define FLASH_TYPE_ROM 2 /* not flash: it's ROM */ +#define FLASH_TYPE_FLASH 3 /* it's flash memory of some sort */ + +#define FLASH_FLAG_NOERASE 1 /* Byte-range writes supported, + Erasing is not necessary */ + +typedef struct nvram_info_s { + int nvram_offset; /* offset of environment area */ + int nvram_size; /* size of environment area */ + int nvram_eraseflg; /* true if we need to erase first */ +} nvram_info_t; + +/* ********************************************************************* + * Ethernet stuff + ********************************************************************* */ + +#define IOCTL_ETHER_GETHWADDR 1 /* Get hardware address (6bytes) */ +#define IOCTL_ETHER_SETHWADDR 2 /* Set hardware address (6bytes) */ +#define IOCTL_ETHER_GETSPEED 3 /* Get Speed and Media (int) */ +#define IOCTL_ETHER_SETSPEED 4 /* Set Speed and Media (int) */ +#define IOCTL_ETHER_GETLINK 5 /* get link status (int) */ +#define IOCTL_ETHER_GETLOOPBACK 7 /* get loopback state */ +#define IOCTL_ETHER_SETLOOPBACK 8 /* set loopback state */ +#define IOCTL_ETHER_SETPACKETFIFO 9 /* set packet fifo mode (int) */ +#define IOCTL_ETHER_SETSTROBESIG 10 /* set strobe signal (int) */ + +#define ETHER_LOOPBACK_OFF 0 /* no loopback */ +#define ETHER_LOOPBACK_INT 1 /* Internal loopback */ +#define ETHER_LOOPBACK_EXT 2 /* External loopback (through PHY) */ + +#define ETHER_SPEED_AUTO 0 /* Auto detect */ +#define ETHER_SPEED_UNKNOWN 0 /* Speed not known (on link status) */ +#define ETHER_SPEED_10HDX 1 /* 10MB hdx and fdx */ +#define ETHER_SPEED_10FDX 2 +#define ETHER_SPEED_100HDX 3 /* 100MB hdx and fdx */ +#define ETHER_SPEED_100FDX 4 +#define ETHER_SPEED_1000HDX 5 /* 1000MB hdx and fdx */ +#define ETHER_SPEED_1000FDX 6 + +#define ETHER_FIFO_8 0 /* 8-bit packet fifo mode */ +#define ETHER_FIFO_16 1 /* 16-bit packet fifo mode */ +#define ETHER_ETHER 2 /* Standard ethernet mode */ + +#define ETHER_STROBE_GMII 0 /* GMII style strobe signal */ +#define ETHER_STROBE_ENCODED 1 /* Encoded */ +#define ETHER_STROBE_SOP 2 /* SOP flagged. Only in 8-bit mode*/ +#define ETHER_STROBE_EOP 3 /* EOP flagged. Only in 8-bit mode*/ + +/* ********************************************************************* + * Serial Ports + ********************************************************************* */ + +#define IOCTL_SERIAL_SETSPEED 1 /* get baud rate (int) */ +#define IOCTL_SERIAL_GETSPEED 2 /* set baud rate (int) */ +#define IOCTL_SERIAL_SETFLOW 3 /* Set Flow Control */ +#define IOCTL_SERIAL_GETFLOW 4 /* Get Flow Control */ + +#define SERIAL_FLOW_NONE 0 /* no flow control */ +#define SERIAL_FLOW_SOFTWARE 1 /* software flow control (not impl) */ +#define SERIAL_FLOW_HARDWARE 2 /* hardware flow control */ + +/* ********************************************************************* + * Block device stuff + ********************************************************************* */ + +#define IOCTL_BLOCK_GETBLOCKSIZE 1 /* get block size (int) */ +#define IOCTL_BLOCK_GETTOTALBLOCKS 2 /* get total bocks (long long) */ +#define IOCTL_BLOCK_GETDEVTYPE 3 /* get device type (struct) */ + +typedef struct blockdev_info_s { + unsigned long long blkdev_totalblocks; + unsigned int blkdev_blocksize; + unsigned int blkdev_devtype; +} blockdev_info_t; + +#define BLOCK_DEVTYPE_DISK 0 +#define BLOCK_DEVTYPE_CDROM 1 + diff --git a/cfe/cfe/include/cfe_irq.h b/cfe/cfe/include/cfe_irq.h new file mode 100644 index 0000000..7605b5e --- /dev/null +++ b/cfe/cfe/include/cfe_irq.h @@ -0,0 +1,103 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IRQ related definitions File: cfe_irq.h + * + * This module describes CFE's interface for dispatching + * to driver-supplied service routines. Dispatch can be based + * either on asynchronous interrupt events or on synchrnous + * polling of the interrupt status registers from the idle loop. + * + * The interface attempts to accomodate the concept of interrupt + * mapping as is common on high-integration parts with standard + * cores. The details are motivated by the bcm1250/MIPS + * architecture, where the mapping abstraction is somewhat violated + * by CP0 interrupts that do not go through the mapper. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define NR_IRQS 64 + +#define CFE_IRQ_FLAGS_SHARED 0x1 + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +/* ********************************************************************* + * Functions + ********************************************************************* */ + +void cfe_irq_init(void); + + +/* Functions that use interrupt mapping, i.e., the irq argument is the + interrupt number at the input to the mapper. */ + +void cfe_mask_irq(int cpu, unsigned int irq); +void cfe_unmask_irq(int cpu, unsigned int irq); + +void cfe_enable_irq(unsigned int irq); +void cfe_disable_irq(unsigned int irq); + +int cfe_request_irq(unsigned int irq, + void (*handler)(void *), void *arg, + unsigned long irqflags, int device); +void cfe_free_irq(unsigned int irq, int device); + +/* pseudo-interrupts, by polling request lines and invoking handlers */ + +void cfe_irq_poll(void *); + + +/* Functions that bypass interrupt mapping, i.e., the ip argument + is the interrupt number at the output of the mapper and/or the + input to the CPU. */ + +typedef void (* ip_handler_t)(int ip); + +void cfe_irq_setvector(int ip, ip_handler_t handler); + +/* enable/disable interrupts at the CPU level. */ + +void cfe_irq_enable(int mask); +int cfe_irq_disable(void); diff --git a/cfe/cfe/include/cfe_loader.h b/cfe/cfe/include/cfe_loader.h new file mode 100644 index 0000000..9ed0c13 --- /dev/null +++ b/cfe/cfe/include/cfe_loader.h @@ -0,0 +1,86 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Loader API File: cfe_loader.h + * + * This is the main API for the program loader. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _CFE_LOADER_H_ +#define _CFE_LOADER_H_ + +#define LOADFLG_NOISY 0x0001 /* print out noisy info */ +#define LOADFLG_EXECUTE 0x0002 /* execute loaded program */ +#define LOADFLG_SPECADDR 0x0004 /* Use a specific size & addr */ +#define LOADFLG_NOBB 0x0008 /* don't look for a boot block */ +#define LOADFLG_NOCLOSE 0x0010 /* don't close network */ +#define LOADFLG_COMPRESSED 0x0020 /* file is compressed */ +#define LOADFLG_BATCH 0x0040 /* batch file */ + +typedef struct cfe_loadargs_s { + char *la_filename; /* name of file on I/O device */ + char *la_filesys; /* file system name */ + char *la_device; /* device name (ide0, etc.) */ + char *la_options; /* args to pass to loaded prog */ + char *la_loader; /* binary file loader to use */ + unsigned int la_flags; /* various flags */ + long la_address; /* used by SPECADDR only */ + unsigned long la_maxsize; /* used by SPECADDR only */ + long la_entrypt; /* returned entry point */ +} cfe_loadargs_t; + + +typedef struct cfe_loader_s { + char *name; /* name of loader */ + int (*loader)(cfe_loadargs_t *); /* access function */ + int flags; /* flags */ +} cfe_loader_t; + +#define LDRLOAD(ldr,arg) (*((ldr)->loader))(arg) + +int cfe_load_program(char *name,cfe_loadargs_t *la); +const cfe_loader_t *cfe_findloader(char *name); +void splitpath(char *path,char **devname,char **filename); +void cfe_go(cfe_loadargs_t *la); +int cfe_boot(char *ldrname,cfe_loadargs_t *la); +int cfe_savedata(char *fsname,char *devname,char *filename,uint8_t *start,uint8_t *end); + +#endif /* _CFE_LOADER_H_ */ diff --git a/cfe/cfe/include/cfe_mem.h b/cfe/cfe/include/cfe_mem.h new file mode 100644 index 0000000..83c3be2 --- /dev/null +++ b/cfe/cfe/include/cfe_mem.h @@ -0,0 +1,79 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Memory manager definitions File: cfe_mem.h + * + * Function prototypes and contants for the memory manager + * (used to manage the physical memory arena) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define MEMTYPE_EMPTY 0 +#define MEMTYPE_DRAM_AVAILABLE 1 /* must match value in cfe_iocb.h */ +#define MEMTYPE_DRAM_NOTINSTALLED 2 +#define MEMTYPE_DRAM_USEDBYFIRMWARE 3 +#define MEMTYPE_BOOTROM 4 +#define MEMTYPE_IOREGISTERS 5 +#define MEMTYPE_RESERVED 6 +#define MEMTYPE_L2CACHE 7 +#define MEMTYPE_LDT_PCI 8 +#define MEMTYPE_DRAM_BOOTPROGRAM 9 + +/* ********************************************************************* + * External data + ********************************************************************* */ + +extern unsigned int mem_bootarea_start; +extern unsigned int mem_bootarea_size; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +void cfe_arena_init(void); +int cfe_arena_loadcheck(uintptr_t start,unsigned int size); +int cfe_arena_enum(int idx,int *type,uint64_t *start,uint64_t *size,int allrecs); +void cfe_pagetable_init(void); + diff --git a/cfe/cfe/include/cfe_timer.h b/cfe/cfe/include/cfe_timer.h new file mode 100644 index 0000000..8c6a26f --- /dev/null +++ b/cfe/cfe/include/cfe_timer.h @@ -0,0 +1,74 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Timer defs and prototypes File: cfe_timer.h + * + * Definitions, prototypes, and macros related to the timer. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _CFE_TIMER_T +#define _CFE_TIMER_T + +void cfe_bg_init(void); +void cfe_bg_add(void (*func)(void *),void *arg); +void cfe_bg_remove(void (*func)(void *)); + +void background(void); + +#define POLL() background() + +typedef int64_t cfe_timer_t; + +void cfe_timer_init(void); +extern volatile int64_t cfe_ticks; +extern int cfe_cpu_speed; + +void cfe_sleep(int ticks); +void cfe_usleep(int usec); + +#define CFE_HZ 10 /* ticks per second */ + +#define TIMER_SET(x,v) x = cfe_ticks + (v) +#define TIMER_EXPIRED(x) ((x) && (cfe_ticks > (x))) +#define TIMER_CLEAR(x) x = 0 +#define TIMER_RUNNING(x) ((x) != 0) + +#endif diff --git a/cfe/cfe/include/cfe_xiocb.h b/cfe/cfe/include/cfe_xiocb.h new file mode 100644 index 0000000..75a336a --- /dev/null +++ b/cfe/cfe/include/cfe_xiocb.h @@ -0,0 +1,202 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCB definitions File: cfe_iocb.h + * + * This module describes CFE's IOCB structure, the main + * data structure used to communicate API requests with CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _CFE_XIOCB_H +#define _CFE_XIOCB_H + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define CFE_CMD_FW_GETINFO 0 +#define CFE_CMD_FW_RESTART 1 +#define CFE_CMD_FW_BOOT 2 +#define CFE_CMD_FW_CPUCTL 3 +#define CFE_CMD_FW_GETTIME 4 +#define CFE_CMD_FW_MEMENUM 5 +#define CFE_CMD_FW_FLUSHCACHE 6 + +#define CFE_CMD_DEV_GETHANDLE 9 +#define CFE_CMD_DEV_ENUM 10 +#define CFE_CMD_DEV_OPEN 11 +#define CFE_CMD_DEV_INPSTAT 12 +#define CFE_CMD_DEV_READ 13 +#define CFE_CMD_DEV_WRITE 14 +#define CFE_CMD_DEV_IOCTL 15 +#define CFE_CMD_DEV_CLOSE 16 +#define CFE_CMD_DEV_GETINFO 17 + +#define CFE_CMD_ENV_ENUM 20 +#define CFE_CMD_ENV_GET 22 +#define CFE_CMD_ENV_SET 23 +#define CFE_CMD_ENV_DEL 24 + +#define CFE_CMD_MAX 32 + +#define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */ + +#define CFE_MI_RESERVED 0 /* memory is reserved, do not use */ +#define CFE_MI_AVAILABLE 1 /* memory is available */ + +#define CFE_FLG_WARMSTART 0x00000001 +#define CFE_FLG_FULL_ARENA 0x00000001 +#define CFE_FLG_ENV_PERMANENT 0x00000001 + +#define CFE_CPU_CMD_START 1 +#define CFE_CPU_CMD_STOP 0 + +#define CFE_STDHANDLE_CONSOLE 0 + +#define CFE_DEV_NETWORK 1 +#define CFE_DEV_DISK 2 +#define CFE_DEV_FLASH 3 +#define CFE_DEV_SERIAL 4 +#define CFE_DEV_CPU 5 +#define CFE_DEV_NVRAM 6 +#define CFE_DEV_CLOCK 7 +#define CFE_DEV_OTHER 8 +#define CFE_DEV_MASK 0x0F + +#define CFE_CACHE_FLUSH_D 1 +#define CFE_CACHE_INVAL_I 2 +#define CFE_CACHE_INVAL_D 4 +#define CFE_CACHE_INVAL_L2 8 + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef unsigned long long cfe_xuint_t; +typedef long long cfe_xint_t; +typedef long long cfe_xptr_t; + +typedef struct xiocb_buffer_s { + cfe_xuint_t buf_offset; /* offset on device (bytes) */ + cfe_xptr_t buf_ptr; /* pointer to a buffer */ + cfe_xuint_t buf_length; /* length of this buffer */ + cfe_xuint_t buf_retlen; /* returned length (for read ops) */ + cfe_xuint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */ +} xiocb_buffer_t; + +#define buf_devflags buf_ioctlcmd /* returned device info flags */ + +typedef struct xiocb_inpstat_s { + cfe_xuint_t inp_status; /* 1 means input available */ +} xiocb_inpstat_t; + +typedef struct xiocb_envbuf_s { + cfe_xint_t enum_idx; /* 0-based enumeration index */ + cfe_xptr_t name_ptr; /* name string buffer */ + cfe_xint_t name_length; /* size of name buffer */ + cfe_xptr_t val_ptr; /* value string buffer */ + cfe_xint_t val_length; /* size of value string buffer */ +} xiocb_envbuf_t; + +typedef struct xiocb_cpuctl_s { + cfe_xuint_t cpu_number; /* cpu number to control */ + cfe_xuint_t cpu_command; /* command to issue to CPU */ + cfe_xuint_t start_addr; /* CPU start address */ + cfe_xuint_t gp_val; /* starting GP value */ + cfe_xuint_t sp_val; /* starting SP value */ + cfe_xuint_t a1_val; /* starting A1 value */ +} xiocb_cpuctl_t; + +typedef struct xiocb_time_s { + cfe_xint_t ticks; /* current time in ticks */ +} xiocb_time_t; + +typedef struct xiocb_exitstat_s { + cfe_xint_t status; +} xiocb_exitstat_t; + +typedef struct xiocb_meminfo_s { + cfe_xint_t mi_idx; /* 0-based enumeration index */ + cfe_xint_t mi_type; /* type of memory block */ + cfe_xuint_t mi_addr; /* physical start address */ + cfe_xuint_t mi_size; /* block size */ +} xiocb_meminfo_t; + +#define CFE_FWI_64BIT 0x00000001 +#define CFE_FWI_32BIT 0x00000002 +#define CFE_FWI_RELOC 0x00000004 +#define CFE_FWI_UNCACHED 0x00000008 +#define CFE_FWI_MULTICPU 0x00000010 +#define CFE_FWI_FUNCSIM 0x00000020 +#define CFE_FWI_RTLSIM 0x00000040 + +typedef struct xiocb_fwinfo_s { + cfe_xint_t fwi_version; /* major, minor, eco version */ + cfe_xint_t fwi_totalmem; /* total installed mem */ + cfe_xint_t fwi_flags; /* various flags */ + cfe_xint_t fwi_boardid; /* board ID */ + cfe_xint_t fwi_bootarea_va; /* VA of boot area */ + cfe_xint_t fwi_bootarea_pa; /* PA of boot area */ + cfe_xint_t fwi_bootarea_size; /* size of boot area */ + cfe_xint_t fwi_reserved1; + cfe_xint_t fwi_reserved2; + cfe_xint_t fwi_reserved3; +} xiocb_fwinfo_t; + +typedef struct cfe_xiocb_s { + cfe_xuint_t xiocb_fcode; /* IOCB function code */ + cfe_xint_t xiocb_status; /* return status */ + cfe_xint_t xiocb_handle; /* file/device handle */ + cfe_xuint_t xiocb_flags; /* flags for this IOCB */ + cfe_xuint_t xiocb_psize; /* size of parameter list */ + union { + xiocb_buffer_t xiocb_buffer; /* buffer parameters */ + xiocb_inpstat_t xiocb_inpstat; /* input status parameters */ + xiocb_envbuf_t xiocb_envbuf; /* environment function parameters */ + xiocb_cpuctl_t xiocb_cpuctl; /* CPU control parameters */ + xiocb_time_t xiocb_time; /* timer parameters */ + xiocb_meminfo_t xiocb_meminfo; /* memory arena info parameters */ + xiocb_fwinfo_t xiocb_fwinfo; /* firmware information */ + xiocb_exitstat_t xiocb_exitstat; /* Exit Status */ + } plist; +} cfe_xiocb_t; + +#endif diff --git a/cfe/cfe/include/dev_flash.h b/cfe/cfe/include/dev_flash.h new file mode 100644 index 0000000..8cbce48 --- /dev/null +++ b/cfe/cfe/include/dev_flash.h @@ -0,0 +1,168 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash memory definitions File: dev_flash.h + * + * Stuff we use when manipulating flash memory devices. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* + * AMD Flash commands and magic offsets + */ + +#define AMD_FLASH_MAGIC_ADDR_1 0x555 /* AAA for 16-bit devices in 8-bit mode */ +#define AMD_FLASH_MAGIC_ADDR_2 0x2AA /* 554 for 16-bit devices in 8-bit mode */ + +#define AMD_FLASH_RESET 0xF0 +#define AMD_FLASH_MAGIC_1 0xAA +#define AMD_FLASH_MAGIC_2 0x55 +#define AMD_FLASH_AUTOSEL 0x90 +#define AMD_FLASH_PROGRAM 0xA0 +#define AMD_FLASH_UNLOCK_BYPASS 0x20 +#define AMD_FLASH_ERASE_3 0x80 +#define AMD_FLASH_ERASE_4 0xAA +#define AMD_FLASH_ERASE_5 0x55 +#define AMD_FLASH_ERASE_ALL_6 0x10 +#define AMD_FLASH_ERASE_SEC_6 0x30 + +/* + * INTEL Flash commands and magic offsets + */ + +#define INTEL_FLASH_READ_MODE 0xFF +#define INTEL_FLASH_ERASE_BLOCK 0x20 +#define INTEL_FLASH_ERASE_CONFIRM 0xD0 +#define INTEL_FLASH_PROGRAM 0x40 + +/* INTEL Flash commands for 16-bit mode */ +#define INTEL_FLASH_16BIT_READ_MODE 0xFF00 +#define INTEL_FLASH_16BIT_ERASE_BLOCK 0x2000 +#define INTEL_FLASH_16BIT_ERASE_CONFIRM 0xD000 +#define INTEL_FLASH_16BIT_PROGRAM 0x4000 +#define INTEL_FLASH_8BIT 0 +#define INTEL_FLASH_16BIT 1 + + +/* + * Common Flash Interface (CFI) commands and offsets + */ + +#define FLASH_CFI_QUERY_ADDR 0x55 +#define FLASH_CFI_QUERY_MODE 0x98 +#define FLASH_CFI_QUERY_EXIT 0xFF + +#define FLASH_CFI_MANUFACTURER 0x00 +#define FLASH_CFI_DEVICE 0x01 +#define FLASH_CFI_SIGNATURE 0x10 +#define FLASH_CFI_QUERY_STRING 0x10 +#define FLASH_CFI_COMMAND_SET 0x13 +#define FLASH_CFI_DEVICE_SIZE 0x27 +#define FLASH_CFI_DEVICE_INTERFACE 0x28 +#define FLASH_CFI_REGION_COUNT 0x2C +#define FLASH_CFI_REGION_TABLE 0x2D + +#define FLASH_CFI_CMDSET_INTEL_ECS 0x0001 /* Intel extended */ +#define FLASH_CFI_CMDSET_AMD_STD 0x0002 /* AMD Standard */ +#define FLASH_CFI_CMDSET_INTEL_STD 0x0003 /* Intel Standard */ +#define FLASH_CFI_CMDSET_AMD_ECS 0x0004 /* AMD Extended */ + +#define FLASH_CFI_DEVIF_X8 0x0000 /* 8-bit asynchronous */ +#define FLASH_CFI_DEVIF_X16 0x0001 /* 16-bit asynchronous */ +#define FLASH_CFI_DEVIF_X8X16 0x0002 /* 8 or 16-bit with BYTE# pin */ +#define FLASH_CFI_DEVIF_X32 0x0003 /* 32-bit asynchronous */ + +/* + * JEDEC offsets + */ + +#define FLASH_JEDEC_OFFSET_MFR 0 +#define FLASH_JEDEC_OFFSET_DEV 1 + +/* Vendor-specific flash identifiers */ + +#define FLASH_MFR_HYUNDAI 0xAD + +/* ********************************************************************* + * Macros for defining custom sector tables + ********************************************************************* */ + +#define FLASH_SECTOR_RANGE(nblks,size) (((nblks)-1) << 16) + ((size)/256) +#define FLASH_SECTOR_NBLKS(x) (((x) >> 16)+1) +#define FLASH_SECTOR_SIZE(x) (((x) & 0xFFFF)*256) +#define FLASH_MAXSECTORS 8 + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +/* + * This structure is passed in the "probe_ptr" field of the + * flash's probe routines and can be used for advanced + * configuration. If you pass this structure, probe_a and + * probe_b will be ignored by the driver + * + * flash_prog_phys is the base address you use for flash commands - + * you can put 0 here if it's the same as flash_phys. some boards, + * like the Algor P5064, have a different PA region used for doing + * byte accesses to the flash. In this case the special + * "flash_prog_phys" field is used for that. + */ + + +#define FLASH_FLG_NVRAM 0x00000001 /* Reserve space for NVRAM */ +#define FLASH_FLG_AUTOSIZE 0x00000002 /* resize to actual device size */ +#define FLASH_FLG_16BIT 0x00000004 /* it's a 16-bit ROM in 16-bit mode */ +#define FLASH_FLG_MANUAL 0x00000008 /* Not CFI, manual sectoring */ +#define FLASH_FLG_WIDE 0x00000010 /* must shift control addresses left one bit */ + +#ifndef __ASSEMBLER__ +typedef struct flash_probe_t { + long flash_phys; + long flash_prog_phys; /* base address for programming, if different */ + int flash_size; /* total flash size */ + int flash_flags; + /* The following are used when manually sectoring */ + int flash_cmdset; + int flash_nsectors; /* number of ranges */ + int flash_sectors[FLASH_MAXSECTORS]; +} flash_probe_t; +#endif diff --git a/cfe/cfe/include/dev_ide.h b/cfe/cfe/include/dev_ide.h new file mode 100644 index 0000000..96d3e18 --- /dev/null +++ b/cfe/cfe/include/dev_ide.h @@ -0,0 +1,90 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IDE disk driver File: dev_ide.h + * + * Probe constants for the IDE disk device. Various flags + * can be passed to the probe routine to configure various + * things. This is where they are defined. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +/* + * Use the macros below to set the type of the master and slave devices + * on the IDE bus. If you want automatic probing, then you need + * to specify that IDE_DEV_TYPE_AUTO as the device type. + */ + + +/* + * XXX: If you have more than one PCI IDE controller + * installed, this will be applied to all installed + * controllers. Clearly not right, we'll need to add + * a field here for a controller index. + */ + + +#define IDE_PROBE_TYPE_MASK 0x0F +#define IDE_PROBE_MASTER_SHIFT 0 +#define IDE_PROBE_SLAVE_SHIFT 4 + +#define IDE_PROBE_MASTER_TYPE(x) ((x) << IDE_PROBE_MASTER_SHIFT) +#define IDE_PROBE_SLAVE_TYPE(x) ((x) << IDE_PROBE_SLAVE_SHIFT) + +#define IDE_PROBE_GET_TYPE(pb,unit) (((pb) >> (unit*4)) & IDE_PROBE_TYPE_MASK) + +/* + * Device types. + */ + +#define IDE_DEVTYPE_NOPROBE 0 /* none */ +#define IDE_DEVTYPE_AUTO 0x0F /* automatically probe */ + +#define IDE_DEVTYPE_DISK 1 /* hard drives */ +#define IDE_DEVTYPE_CDROM 2 /* CD-ROMs */ +#define IDE_DEVTYPE_ATAPIDISK 3 /* ZIP disks, etc. */ + + + diff --git a/cfe/cfe/include/dev_ide_common.h b/cfe/cfe/include/dev_ide_common.h new file mode 100644 index 0000000..736fd99 --- /dev/null +++ b/cfe/cfe/include/dev_ide_common.h @@ -0,0 +1,204 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Generic IDE disk driver File: dev_ide_common.c + * + * This file contains common constants and structures for IDE + * disks and CFE drivers for them. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define IDE_REG_DATA 0x0 +#define IDE_REG_ERROR 0x1 +#define IDE_REG_PRECOMP 0x1 +#define IDE_REG_SECCNT 0x2 +#define IDE_REG_IR 0x2 /* ATAPI */ +#define IDE_REG_SECNUM 0x3 +#define IDE_REG_BCLSB 0x4 /* ATAPI */ +#define IDE_REG_BCMSB 0x5 /* ATAPI */ +#define IDE_REG_CYLLSB 0x4 +#define IDE_REG_CYLMSB 0x5 +#define IDE_REG_DRVHD 0x6 +#define IDE_REG_STATUS 0x7 +#define IDE_REG_COMMAND 0x7 +#define IDE_REG_ALTSTAT 0x6 /* Note: ALTSTAT is really 0x3F6, what do we do? */ +#define IDE_REG_DIGOUT 0x6 + +#define IDE_IR_CD 0x01 /* 1 = command, 0 = data */ +#define IDE_IR_IO 0x02 /* 1 = from device, 0 = to device */ +#define IDE_IR_REL 0x04 + +#define IDE_ERR_BBK 0x80 /* sector marked bad by host */ +#define IDE_ERR_UNC 0x40 /* uncorrectable error */ +#define IDE_ERR_MC 0x20 /* medium changed */ +#define IDE_ERR_NID 0x10 /* no ID mark found */ +#define IDE_ERR_MCR 0x08 /* medium change required */ +#define IDE_ERR_ABT 0x04 /* command aborted */ +#define IDE_ERR_NT0 0x02 /* track 0 not found */ +#define IDE_ERR_NDM 0x01 /* address mark not found */ + +#define IDE_DRV_SLAVE 0x10 +#define IDE_DRV_LBA 0x40 +#define IDE_DRV_MBO 0xA0 +#define IDE_DRV_HDMASK 0x0F + +#define IDE_STS_BSY 0x80 /* drive is busy */ +#define IDE_STS_RDY 0x40 /* drive is ready */ +#define IDE_STS_WFT 0x20 /* write fault */ +#define IDE_STS_SKC 0x10 /* seek complete */ +#define IDE_STS_DRQ 0x08 /* data can be transferred */ +#define IDE_STS_CORR 0x04 /* correctable data error */ +#define IDE_STS_IDX 0x02 /* index mark just passed */ +#define IDE_STS_ERR 0x01 /* Error register contains info */ + +#define IDE_CMD_RECAL 0x10 +#define IDE_CMD_READ 0x20 +#define IDE_CMD_READRETRY 0x21 +#define IDE_CMD_WRITE 0x30 +#define IDE_CMD_READVERIFY 0x40 +#define IDE_CMD_DIAGNOSTIC 0x90 +#define IDE_CMD_INITPARAMS 0x91 +#define IDE_CMD_SETMULTIPLE 0xC6 +#define IDE_CMD_POWER_MODE 0xE5 +#define IDE_CMD_DRIVE_INFO 0xEC + +#define IDE_CMD_ATAPI_SOFTRESET 0x08 +#define IDE_CMD_ATAPI_PACKET 0xA0 +#define IDE_CMD_ATAPI_IDENTIFY 0xA1 +#define IDE_CMD_ATAPI_SERVICE 0xA2 + +#define IDE_DOR_SRST 0x04 +#define IDE_DOR_IEN 0x02 + +#define DISK_SECTORSIZE 512 +#define CDROM_SECTORSIZE 2048 +#define MAX_SECTORSIZE 2048 + +#define ATAPI_SENSE_MASK 0xF0 +#define ATAPI_SENSE_NONE 0x00 +#define ATAPI_SENSE_RECOVERED 0x10 +#define ATAPI_SENSE_NOTREADY 0x20 +#define ATAPI_SENSE_MEDIUMERROR 0x30 +#define ATAPI_SENSE_HWERROR 0x40 +#define ATAPI_SENSE_ILLREQUEST 0x50 +#define ATAPI_SENSE_ATTENTION 0x60 +#define ATAPI_SENSE_PROTECT 0x70 +#define ATAPI_SENSE_BLANKCHECK 0x80 +#define ATAPI_SENSE_VSPECIFIC 0x90 +#define ATAPI_SENSE_COPYABORT 0xA0 +#define ATAPI_SENSE_CMDABORT 0xB0 +#define ATAPI_SENSE_EQUAL 0xC0 +#define ATAPI_SENSE_VOLOVERFLOW 0xD0 +#define ATAPI_SENSE_MISCOMPARE 0xE0 +#define ATAPI_SENSE_RESERVED 0xF0 + +#define ATAPI_SIG_LSB 0x14 +#define ATAPI_SIG_MSB 0xEB + +#define CDB_CMD_READ 0x28 +#define CDB_CMD_WRITE 0x2A +#define CDB_CMD_REQSENSE 0x03 + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct idecommon_dispatch_s idecommon_dispatch_t; + +struct idecommon_dispatch_s { + void *ref; + uint32_t baseaddr; + uint8_t (*inb)(idecommon_dispatch_t *disp,uint32_t reg); + uint16_t (*inw)(idecommon_dispatch_t *disp,uint32_t reg); + void (*ins)(idecommon_dispatch_t *disp,uint32_t reg,uint8_t *buf,int len); + + void (*outb)(idecommon_dispatch_t *disp,uint32_t reg,uint8_t val); + void (*outw)(idecommon_dispatch_t *disp,uint32_t reg,uint16_t val); + void (*outs)(idecommon_dispatch_t *disp,uint32_t reg,uint8_t *buf,int len); +}; + +#define IDEDISP_WRITEREG8(ide,reg,val) (*((ide)->outb))(ide,reg,val) +#define IDEDISP_WRITEREG16(ide,reg,val) (*((ide)->outw))(ide,reg,val) +#define IDEDISP_WRITEBUF(ide,reg,buf,len) (*((ide)->outs))(ide,reg,buf,len) +#define IDEDISP_READREG8(ide,reg) (*((ide)->inb))(ide,reg) +#define IDEDISP_READREG16(ide,reg) (*((ide)->inw))(ide,reg) +#define IDEDISP_READBUF(ide,reg,buf,len) (*((ide)->ins))(ide,reg,buf,len) + +typedef struct idecommon_s idecommon_t; + +struct idecommon_s { + idecommon_dispatch_t *idecommon_dispatch; + unsigned long idecommon_addr; /* physical address */ + int idecommon_unit; /* 0 or 1 master/slave */ + int idecommon_sectorsize; /* size of each sector */ + long long idecommon_ttlsect; /* total sectors */ + int idecommon_atapi; /* 1 if ATAPI device */ + int idecommon_devtype; /* device type */ + uint64_t idecommon_deferprobe; /* Defer probe to open */ + uint32_t idecommon_flags; /* flags for underlying driver */ + int (*idecommon_readfunc)(idecommon_t *ide,uint64_t lba,int numsec,uint8_t *buffer); + int (*idecommon_writefunc)(idecommon_t *ide,uint64_t lba,int numsec,uint8_t *buffer); + + uint32_t timer; +}; + + + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +extern void idecommon_init(idecommon_t *ide,int devtype); +extern int idecommon_open(cfe_devctx_t *ctx); +extern int idecommon_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +extern int idecommon_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +extern int idecommon_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +extern int idecommon_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +extern int idecommon_identify(idecommon_t *ide,unsigned char *buffer); +extern int idecommon_close(cfe_devctx_t *ctx); +extern int idecommon_devprobe(idecommon_t *ide,int noisy); +void idecommon_attach(cfe_devdisp_t *disp); + diff --git a/cfe/cfe/include/dev_newflash.h b/cfe/cfe/include/dev_newflash.h new file mode 100644 index 0000000..5efced0 --- /dev/null +++ b/cfe/cfe/include/dev_newflash.h @@ -0,0 +1,344 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash memory definitions File: dev_newflash.h + * + * Stuff we use when manipulating flash memory devices. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef __ASSEMBLER__ +#include "cfe_device.h" +#include "cfe_iocb.h" +#endif + +/* ********************************************************************* + * Configuration + ********************************************************************* */ + +/* Bits for compile-time removal of features */ +#define FLASH_DRIVER_INTEL 1 /* support Intel cmd sets */ +#define FLASH_DRIVER_AMD 2 /* support AMD cmd sets */ +#define FLASH_DRIVER_CFI 4 /* support auto probing */ + +/* Default value unless overridden in bsp_config.h */ +#ifndef FLASH_DRIVERS +#define FLASH_DRIVERS (FLASH_DRIVER_INTEL | FLASH_DRIVER_AMD | FLASH_DRIVER_CFI) +#endif + +/* ********************************************************************* + * Flash magic numbers + ********************************************************************* */ + +/* + * AMD Flash commands and magic offsets + */ + +#define AMD_FLASH_MAGIC_ADDR_1 0x555 /* AAA for 16-bit devices in 8-bit mode */ +#define AMD_FLASH_MAGIC_ADDR_2 0x2AA /* 554 for 16-bit devices in 8-bit mode */ + +#define AMD_FLASH_RESET 0xF0 +#define AMD_FLASH_MAGIC_1 0xAA +#define AMD_FLASH_MAGIC_2 0x55 +#define AMD_FLASH_AUTOSEL 0x90 +#define AMD_FLASH_DEVCODE8 0x2 +#define AMD_FLASH_DEVCODE16 0x1 +#define AMD_FLASH_DEVCODE16B 0x2 +#define AMD_FLASH_MANID 0x0 +#define AMD_FLASH_PROGRAM 0xA0 +#define AMD_FLASH_UNLOCK_BYPASS 0x20 +#define AMD_FLASH_ERASE_3 0x80 +#define AMD_FLASH_ERASE_4 0xAA +#define AMD_FLASH_ERASE_5 0x55 +#define AMD_FLASH_ERASE_ALL_6 0x10 +#define AMD_FLASH_ERASE_SEC_6 0x30 + +/* + * INTEL Flash commands and magic offsets + */ + +#define INTEL_FLASH_READ_MODE 0xFF +#define INTEL_FLASH_ERASE_BLOCK 0x20 +#define INTEL_FLASH_ERASE_CONFIRM 0xD0 +#define INTEL_FLASH_PROGRAM 0x40 + +/* INTEL Flash commands for 16-bit mode */ +#define INTEL_FLASH_16BIT_READ_MODE 0xFF00 +#define INTEL_FLASH_16BIT_ERASE_BLOCK 0x2000 +#define INTEL_FLASH_16BIT_ERASE_CONFIRM 0xD000 +#define INTEL_FLASH_16BIT_PROGRAM 0x4000 +#define INTEL_FLASH_8BIT 0 +#define INTEL_FLASH_16BIT 1 + + +/* + * Common Flash Interface (CFI) commands and offsets + */ + +#define FLASH_CFI_QUERY_ADDR 0x55 +#define FLASH_CFI_QUERY_MODE 0x98 +#define FLASH_CFI_QUERY_EXIT 0xFF + +#define FLASH_CFI_MANUFACTURER 0x00 +#define FLASH_CFI_DEVICE 0x01 +#define FLASH_CFI_SIGNATURE 0x10 +#define FLASH_CFI_QUERY_STRING 0x10 +#define FLASH_CFI_COMMAND_SET 0x13 +#define FLASH_CFI_DEVICE_SIZE 0x27 +#define FLASH_CFI_DEVICE_INTERFACE 0x28 +#define FLASH_CFI_REGION_COUNT 0x2C +#define FLASH_CFI_REGION_TABLE 0x2D + +#define FLASH_CFI_CMDSET_INTEL_ECS 0x0001 /* Intel extended */ +#define FLASH_CFI_CMDSET_AMD_STD 0x0002 /* AMD Standard */ +#define FLASH_CFI_CMDSET_INTEL_STD 0x0003 /* Intel Standard */ +#define FLASH_CFI_CMDSET_AMD_ECS 0x0004 /* AMD Extended */ + +#define FLASH_CFI_DEVIF_X8 0x0000 /* 8-bit asynchronous */ +#define FLASH_CFI_DEVIF_X16 0x0001 /* 16-bit asynchronous */ +#define FLASH_CFI_DEVIF_X8X16 0x0002 /* 8 or 16-bit with BYTE# pin */ +#define FLASH_CFI_DEVIF_X32 0x0003 /* 32-bit asynchronous */ + +/* + * JEDEC offsets + */ + +#define FLASH_JEDEC_OFFSET_MFR 0 +#define FLASH_JEDEC_OFFSET_DEV 1 + +/* Vendor-specific flash identifiers */ + +#define FLASH_MFR_HYUNDAI 0xAD +#define FLASH_MFR_AMD 0x01 + +/* ********************************************************************* + * Macros for defining custom sector tables + ********************************************************************* */ + +#define FLASH_SECTOR_RANGE(nblks,size) (((nblks)-1) << 16) + ((size)/256) +#define FLASH_SECTOR_NBLKS(x) (((x) >> 16)+1) +#define FLASH_SECTOR_SIZE(x) (((x) & 0xFFFF)*256) +#define FLASH_MAXSECTORS 8 + +/* ********************************************************************* + * Flashop engine constants and structures + * The flashop engine interprets a little table of commands + * to manipulate flash parts - we do this so we can operate + * on the flash that we're currently running from. + ********************************************************************* */ + +/* + * Structure of the "instruction" table is six words, + * size dependant on the machine word size (32 or 64 bits). + * + * opcode + * flash base + * destination + * source + * length + * result + */ + +#define FEINST_OP _TBLIDX(0) +#define FEINST_BASE _TBLIDX(1) +#define FEINST_DEST _TBLIDX(2) +#define FEINST_SRC _TBLIDX(3) +#define FEINST_CNT _TBLIDX(4) +#define FEINST_RESULT _TBLIDX(5) +#define FEINST_SIZE _TBLIDX(6) /* size of an instruction */ + +#ifndef __ASSEMBLER__ +typedef struct flashinstr_s { /* must match offsets above */ + long fi_op; + long fi_base; + long fi_dest; + long fi_src; + long fi_cnt; + long fi_result; +} flashinstr_t; +#endif + +/* + * Flash opcodes + */ + +#define FEOP_RETURN 0 /* return to CFE */ +#define FEOP_REBOOT 1 /* Reboot system */ +#define FEOP_READ8 2 /* read, 8 bits at a time */ +#define FEOP_READ16 3 /* read, 16 bits at a time */ +#define FEOP_CFIQUERY8 4 /* CFI Query 8-bit */ +#define FEOP_CFIQUERY16 5 /* CFI Query 16-bit */ +#define FEOP_CFIQUERY16B 6 /* CFI Query 16-bit */ +#define FEOP_MEMCPY 7 /* generic memcpy */ +#define FEOP_AMD_ERASE8 8 /* AMD-style 8-bit erase-sector */ +#define FEOP_AMD_ERASE16 9 /* AMD-style 16-bit erase-sector */ +#define FEOP_AMD_ERASE16B 10 /* AMD-style 16-bit erase-sector */ +#define FEOP_AMD_PGM8 11 /* AMD-style 8-bit program */ +#define FEOP_AMD_PGM16 12 /* AMD-style 16-bit program */ +#define FEOP_AMD_PGM16B 13 /* AMD-style 16-bit program */ +#define FEOP_AMD_DEVCODE8 14 /* AMD-style 8-bit Boot Block Info */ +#define FEOP_AMD_DEVCODE16 15 /* AMD-style 8-bit Boot Block Info */ +#define FEOP_AMD_DEVCODE16B 16 /* AMD-style 8-bit Boot Block Info */ +#define FEOP_AMD_MANID8 17 /* AMD-style 8-bit Boot Block Info */ +#define FEOP_AMD_MANID16 18 /* AMD-style 8-bit Boot Block Info */ +#define FEOP_AMD_MANID16B 19 /* AMD-style 8-bit Boot Block Info */ +#define FEOP_INTEL_ERASE8 20 /* Intel-style 8-bit erase-sector */ +#define FEOP_INTEL_ERASE16 21 /* Intel-style 16-bit erase-sector */ +#define FEOP_INTEL_PGM8 22 /* Intel-style 8-bit program */ +#define FEOP_INTEL_PGM16 23 /* Intel-style 16-bit program */ + +/* + * Flashop result values. + */ + +#define FERES_OK 0 +#define FERES_ERROR -1 + + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +/* + * Flags. If you instantiate the driver with probe_a = physical + * address and probe_b = size, you should also OR in the + * bus and device width below. + */ + +#define FLASH_FLG_AUTOSIZE 0x00000002 /* resize to actual device size */ +#define FLASH_FLG_BUS8 0 +#define FLASH_FLG_BUS16 0x00000004 /* ROM is connected to 16-bit bus */ +#define FLASH_FLG_DEV8 0 +#define FLASH_FLG_DEV16 0x00000010 /* ROM has 16-bit data width */ +#define FLASH_FLG_MANUAL 0x00000008 /* Not CFI, manual sectoring */ +#define FLASH_FLG_MASK 0x000000FF /* mask of probe bits for flags */ +#define FLASH_SIZE_MASK 0xFFFFFF00 /* mask of probe bits for size */ +/* you don't have to shift the size, we assume it's in multiples of 256bytes */ + +#ifndef __ASSEMBLER__ + +/* + * Partition structure - use this to define a flash "partition." + * The partitions are assigned in order from the beginning of the flash. + * The special size '0' means 'fill to end of flash', and you can + * have more partitions after that which are aligned with the top + * of the flash. + * Therefore if you have a 1MB flash and set up + * partitions for 256KB, 0, 128KB, the 128KB part will be aligned + * to the top of the flash and the middle block will be 768KB. + * Partitions can be on byte boundaries. + */ + +typedef struct newflash_part_t { + int fp_size; + char *fp_name; +} newflash_part_t; +#define FLASH_MAX_PARTITIONS 8 + +/* + * Probe structure - this is used when we want to describe to the flash + * driver the layout of our flash, particularly when you want to + * manually describe the sectors. + */ + +typedef struct newflash_probe_t { + long flash_phys; /* physical address of flash */ + int flash_size; /* total flash size */ + int flash_flags; /* flags (FLASH_FLG_xxx) */ + int flash_type; /* FLASH_TYPE_xxx */ + /* The following are used when manually sectoring */ + int flash_cmdset; /* FLASH_CMDSET_xxx */ + int flash_nsectors; /* number of ranges */ + int flash_sectors[FLASH_MAXSECTORS]; + /* This says how many contiguous flash chips are in this region */ + int flash_nchips; /* "flash_size" is just for one chip */ + /* The following are used for partitioned flashes */ + int flash_nparts; /* zero means not partitioned */ + newflash_part_t flash_parts[FLASH_MAX_PARTITIONS]; + /* The following are used for whacky, weird flashes */ + int (*flash_ioctl_hook)(cfe_devctx_t *ctx,iocb_buffer_t *buffer); + /* You can replace the flash engine with your own */ + int (*flash_engine_hook)(flashinstr_t *prog); +} newflash_probe_t; + + +/* ********************************************************************* + * PRIVATE STRUCTURES + * + * These structures are actually the "property" of the + * flash driver. The only reason a board package might + * want to dig around in here is if it implements a hook + * or overrides functions to support special, weird flash parts. + ********************************************************************* */ + +typedef struct flashdev_s flashdev_t; + +typedef struct flashpart_s { + flashdev_t *fp_dev; + int fp_offset; + int fp_size; +} flashpart_t; + +#define FLASH_MAX_CFIDATA 256 /* total size of CFI Data */ +#define FLASH_MAX_INST 8 /* instructions we use during probing */ + +struct flashdev_s { + newflash_probe_t fd_probe; /* probe information */ + + uint8_t fd_erasefunc; /* Erase routine to use */ + uint8_t fd_pgmfunc; /* program routine to use */ + uint8_t fd_readfunc; /* Read routine to use */ + flashpart_t fd_parts[FLASH_MAX_PARTITIONS]; + + uint8_t *fd_sectorbuffer; /* sector copy buffer */ + int fd_ttlsect; /* total sectors on one device */ + int fd_ttlsize; /* total size of all devices (flash size * nchips) */ + + int fd_iptr; /* flashop engine instructions */ + flashinstr_t *fd_inst; +}; + + + +#endif + + + diff --git a/cfe/cfe/include/elf.h b/cfe/cfe/include/elf.h new file mode 100644 index 0000000..944aab4 --- /dev/null +++ b/cfe/cfe/include/elf.h @@ -0,0 +1,194 @@ +/* + * ELF data structures and values + */ + +typedef unsigned short Elf32_Half; +typedef unsigned int Elf32_Word; +typedef signed int Elf32_Sword; +typedef unsigned int Elf32_Off; +typedef unsigned int Elf32_Addr; +typedef unsigned char Elf_Char; + +/* + * File Header + */ + +#define EI_NIDENT 16 + +typedef struct { + Elf_Char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +/* e_indent */ +#define EI_MAG0 0 /* File identification byte 0 index */ +#define EI_MAG1 1 /* File identification byte 1 index */ +#define EI_MAG2 2 /* File identification byte 2 index */ +#define EI_MAG3 3 /* File identification byte 3 index */ +#define EI_CLASS 4 /* File class */ +#define ELFCLASSNONE 0 /* Invalid class */ +#define ELFCLASS32 1 /* 32-bit objects */ +#define ELFCLASS64 2 /* 64-bit objects */ +#define EI_DATA 5 /* Data encoding */ +#define ELFDATANONE 0 /* Invalid data encoding */ +#define ELFDATA2LSB 1 /* 2's complement, little endian */ +#define ELFDATA2MSB 2 /* 2's complement, big endian */ +#define EI_VERSION 6 /* File version */ +#define EI_PAD 7 /* Start of padding bytes */ + +#define ELFMAG0 0x7F /* Magic number byte 0 */ +#define ELFMAG1 'E' /* Magic number byte 1 */ +#define ELFMAG2 'L' /* Magic number byte 2 */ +#define ELFMAG3 'F' /* Magic number byte 3 */ + +/* e_type */ +#define ET_NONE 0 /* No file type */ +#define ET_REL 1 /* Relocatable file */ +#define ET_EXEC 2 /* Executable file */ +#define ET_DYN 3 /* Shared object file */ +#define ET_CORE 4 /* Core file */ +#define ET_LOPROC 0xFF00 /* Processor-specific */ +#define ET_HIPROC 0xFFFF /* Processor-specific */ + +/* e_machine */ +#define EM_NONE 0 /* No machine */ +#define EM_M32 1 /* AT&T WE 32100 */ +#define EM_SPARC 2 /* SUN SPARC */ +#define EM_386 3 /* Intel 80386 */ +#define EM_68K 4 /* Motorola m68k family */ +#define EM_88K 5 /* Motorola m88k family */ +#define EM_860 7 /* Intel 80860 */ +#define EM_MIPS 8 /* MIPS R3000 */ + +/* e_version */ +#define EV_NONE 0 /* Invalid ELF version */ +#define EV_CURRENT 1 /* Current version */ + + +/* + * Program Header + */ +typedef struct { + Elf32_Word p_type; /* Identifies program segment type */ + Elf32_Off p_offset; /* Segment file offset */ + Elf32_Addr p_vaddr; /* Segment virtual address */ + Elf32_Addr p_paddr; /* Segment physical address */ + Elf32_Word p_filesz; /* Segment size in file */ + Elf32_Word p_memsz; /* Segment size in memory */ + Elf32_Word p_flags; /* Segment flags */ + Elf32_Word p_align; /* Segment alignment, file & memory */ +} Elf32_Phdr; + + +/* p_type */ +#define PT_NULL 0 /* Program header table entry unused */ +#define PT_LOAD 1 /* Loadable program segment */ +#define PT_DYNAMIC 2 /* Dynamic linking information */ +#define PT_INTERP 3 /* Program interpreter */ +#define PT_NOTE 4 /* Auxiliary information */ +#define PT_SHLIB 5 /* Reserved, unspecified semantics */ +#define PT_PHDR 6 /* Entry for header table itself */ +#define PT_LOPROC 0x70000000 /* Processor-specific */ +#define PT_HIPROC 0x7FFFFFFF /* Processor-specific */ + +/* p_flags */ +#define PF_X (1 << 0) /* Segment is executable */ +#define PF_W (1 << 1) /* Segment is writable */ +#define PF_R (1 << 2) /* Segment is readable */ +#define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */ + + +/* + * Section Header + */ +typedef struct { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +/* sh_type */ +#define SHT_NULL 0 /* Section header table entry unused */ +#define SHT_PROGBITS 1 /* Program specific (private) data */ +#define SHT_SYMTAB 2 /* Link editing symbol table */ +#define SHT_STRTAB 3 /* A string table */ +#define SHT_RELA 4 /* Relocation entries with addends */ +#define SHT_HASH 5 /* A symbol hash table */ +#define SHT_DYNAMIC 6 /* Information for dynamic linking */ +#define SHT_NOTE 7 /* Information that marks file */ +#define SHT_NOBITS 8 /* Section occupies no space in file */ +#define SHT_REL 9 /* Relocation entries, no addends */ +#define SHT_SHLIB 10 /* Reserved, unspecified semantics */ +#define SHT_DYNSYM 11 /* Dynamic linking symbol table */ +#define SHT_LOPROC 0x70000000 /* Processor-specific semantics, lo */ +#define SHT_HIPROC 0x7FFFFFFF /* Processor-specific semantics, hi */ +#define SHT_LOUSER 0x80000000 /* Application-specific semantics */ +#define SHT_HIUSER 0x8FFFFFFF /* Application-specific semantics */ + +/* sh_flags */ +#define SHF_WRITE (1 << 0) /* Writable data during execution */ +#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ +#define SHF_EXECINSTR (1 << 2) /* Executable machine instructions */ +#define SHF_MASKPROC 0xF0000000 /* Processor-specific semantics */ + + +/* + * Symbol Table + */ +typedef struct { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + Elf_Char st_info; + Elf_Char st_other; + Elf32_Half st_shndx; +} Elf32_Sym; + + +#define ELF_ST_BIND(val) (((unsigned int)(val)) >> 4) +#define ELF_ST_TYPE(val) ((val) & 0xF) +#define ELF_ST_INFO(bind,type) (((bind) << 4) | ((type) & 0xF)) + +/* symbol binding */ +#define STB_LOCAL 0 /* Symbol not visible outside obj */ +#define STB_GLOBAL 1 /* Symbol visible outside obj */ +#define STB_WEAK 2 /* Like globals, lower precedence */ +#define STB_LOPROC 13 /* Application-specific semantics */ +#define STB_HIPROC 15 /* Application-specific semantics */ + +/* symbol type */ +#define STT_NOTYPE 0 /* Symbol type is unspecified */ +#define STT_OBJECT 1 /* Symbol is a data object */ +#define STT_FUNC 2 /* Symbol is a code object */ +#define STT_SECTION 3 /* Symbol associated with a section */ +#define STT_FILE 4 /* Symbol gives a file name */ +#define STT_LOPROC 13 /* Application-specific semantics */ +#define STT_HIPROC 15 /* Application-specific semantics */ + +/* special values st_shndx */ +#define SHN_UNDEF 0 /* Undefined section reference */ +#define SHN_LORESERV 0xFF00 /* Begin range of reserved indices */ +#define SHN_LOPROC 0xFF00 /* Begin range of appl-specific */ +#define SHN_HIPROC 0xFF1F /* End range of appl-specific */ +#define SHN_ABS 0xFFF1 /* Associated symbol is absolute */ +#define SHN_COMMON 0xFFF2 /* Associated symbol is in common */ +#define SHN_HIRESERVE 0xFFFF /* End range of reserved indices */ diff --git a/cfe/cfe/include/env_subr.h b/cfe/cfe/include/env_subr.h new file mode 100644 index 0000000..f5dfb9f --- /dev/null +++ b/cfe/cfe/include/env_subr.h @@ -0,0 +1,117 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Environment helper routines File: env_subr.h + * + * Definitions and prototypes for environment variable subroutines + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + + +/* + * TLV types. These codes are used in the "type-length-value" + * encoding of the items stored in the NVRAM device (flash or EEPROM) + * + * The layout of the flash/nvram is as follows: + * + * + * + * The type code of "ENV_TLV_TYPE_END" marks the end of the list. + * The "length" field marks the length of the data section, not + * including the type and length fields. + * + * Environment variables are stored as follows: + * + * = + * + * If bit 0 (low bit) is set, the length is an 8-bit value. + * If bit 0 (low bit) is clear, the length is a 16-bit value + * + * Bit 7 set indicates "user" TLVs. In this case, bit 0 still + * indicates the size of the length field. + * + * Flags are from the constants below: + * + */ + +#define ENV_LENGTH_16BITS 0x00 /* for low bit */ +#define ENV_LENGTH_8BITS 0x01 + +#define ENV_TYPE_USER 0x80 + +#define ENV_CODE_SYS(n,l) (((n)<<1)|(l)) +#define ENV_CODE_USER(n,l) ((((n)<<1)|(l)) | ENV_TYPE_USER) + +/* + * The actual TLV types we support + */ + +#define ENV_TLV_TYPE_END 0x00 +#define ENV_TLV_TYPE_ENV ENV_CODE_SYS(0,ENV_LENGTH_8BITS) + +/* + * Environment variable flags + */ + +#define ENV_FLG_NORMAL 0x00 /* normal read/write */ +#define ENV_FLG_BUILTIN 0x01 /* builtin - not stored in flash */ +#define ENV_FLG_READONLY 0x02 /* read-only - cannot be changed */ + +#define ENV_FLG_MASK 0xFF /* mask of attributes we keep */ +#define ENV_FLG_ADMIN 0x100 /* lets us internally override permissions */ + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int env_delenv(const char *name); +char *env_getenv(const char *name); +int env_setenv(const char *name,char *value,int flags); +int env_load(void); +int env_save(void); +int env_enum(int idx,char *name,int *namelen,char *val,int *vallen); +int env_envtype(const char *name); + diff --git a/cfe/cfe/include/foxconnCfg.h b/cfe/cfe/include/foxconnCfg.h new file mode 100755 index 0000000..3c43675 --- /dev/null +++ b/cfe/cfe/include/foxconnCfg.h @@ -0,0 +1,9 @@ +#ifndef _FOXCONNCFG_H +#define _FOXCONNCFG_H + +#define FOXCONN_BOARD_ID "U12L161T00_NETGEAR" +#define GPIO_POWER_RED_LED 18 +#define GPIO_POWER_RED_LED_ON 1 +#define GPIO_POWER_RED_LED_OFF 0 + +#endif \ No newline at end of file diff --git a/cfe/cfe/include/lib_arena.h b/cfe/cfe/include/lib_arena.h new file mode 100644 index 0000000..2ae49d6 --- /dev/null +++ b/cfe/cfe/include/lib_arena.h @@ -0,0 +1,76 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Arena definitions File: lib_arena.h + * + * Definitions for the arena manager, which is used to keep + * track of ranges of physical memory. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct arena_node_s { + queue_t an_next; + uint64_t an_address; + uint64_t an_length; + int an_type; + char *an_descr; +} arena_node_t; + + +typedef struct arena_s { + queue_t arena_list; + uint64_t arena_base; + uint64_t arena_size; +} arena_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int arena_markrange(arena_t *arena,uint64_t address,uint64_t length, + int type,char *descr); +void arena_init(arena_t *arena,uint64_t physmembase,uint64_t physmemsize); + diff --git a/cfe/cfe/include/lib_malloc.h b/cfe/cfe/include/lib_malloc.h new file mode 100644 index 0000000..da1e27b --- /dev/null +++ b/cfe/cfe/include/lib_malloc.h @@ -0,0 +1,78 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Local memory manager File: mempool.h + * + * This routine is used to manage memory allocated within the + * firmware. You give it a chunk of memory to manage, and then + * these routines manage suballocations from there. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _LIB_MALLOC_H +#define _LIB_MALLOC_H + +typedef struct memstats_s { + int mem_totalbytes; + int mem_allocbytes; + int mem_freebytes; + int mem_allocnodes; + int mem_freenodes; + int mem_largest; +} memstats_t; + +typedef struct mempool_s mempool_t; +void kmeminit(mempool_t *pool,unsigned char *buffer,int length); +void kfree(mempool_t *pool,void *ptr); +void *kmalloc(mempool_t *pool,unsigned int size,unsigned int align); +int kmemchk(mempool_t *pool,int verbose); +extern mempool_t kmempool; +void *kmempoolbase(mempool_t *pool); +int kmempoolsize(mempool_t *pool); +int kmemstats(mempool_t *pool,memstats_t *stats); + +#define KMEMINIT(buffer,length) kmeminit(&kmempool,(buffer),(length)) +#define KMEMPOOLBASE() kmempoolbase(&kmempool) +#define KMEMPOOLSIZE() kmempoolsize(&kmempool) +#define KMALLOC(size,align) kmalloc(&kmempool,(size),(align)) +#define KFREE(ptr) kfree(&kmempool,(ptr)) +#define KMEMSTATS(s) kmemstats(&kmempool,(s)) + +#endif diff --git a/cfe/cfe/include/lib_printf.h b/cfe/cfe/include/lib_printf.h new file mode 100755 index 0000000..e4d2860 --- /dev/null +++ b/cfe/cfe/include/lib_printf.h @@ -0,0 +1,69 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * simple printf File: lib_printf.h + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + * This module contains a very, very, very simple printf + * suitable for use in the boot ROM. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include + +int xvsprintf(char *outbuf,const char *templat,va_list marker); +int xsprintf(char *buf,const char *templat,...); +#if CFG_RAMAPP +int xprintf(const char *templat,...); +#else +#define xprintf(...) +#endif + +extern int (*xprinthook)(const char *); +int xvprintf(const char *template,va_list marker); + +/* + * compatibility macros + */ + + +#define printf xprintf +#define sprintf xsprintf +#define vsprintf xvsprintf +#define vprintf xvprintf diff --git a/cfe/cfe/include/lib_queue.h b/cfe/cfe/include/lib_queue.h new file mode 100644 index 0000000..530c70f --- /dev/null +++ b/cfe/cfe/include/lib_queue.h @@ -0,0 +1,85 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Queue management prototypes File: lib_queue.h + * + * Constants, structures, and function prototypes for the queue + * manager. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _LIB_QUEUE_H +#define _LIB_QUEUE_H + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define q_init(q) (q)->q_prev = (q), (q)->q_next = (q) +#define q_isempty(q) ((q)->q_next == (q)) +#define q_getfirst(q) ((q)->q_next) +#define q_getlast(q) ((q)->q_prev) + +/* ********************************************************************* + * Types + ********************************************************************* */ + + +typedef struct queue_s { + struct queue_s *q_next; + struct queue_s *q_prev; +} queue_t; + + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +void q_enqueue(queue_t *,queue_t *); +void q_dequeue(queue_t *); +queue_t *q_deqnext(queue_t *); +int q_map(queue_t *qb,int (*func)(queue_t *,unsigned int,unsigned int), + unsigned int a,unsigned int b); +int q_count(queue_t *); +int q_find(queue_t *,queue_t *); + + +#endif diff --git a/cfe/cfe/include/lib_string.h b/cfe/cfe/include/lib_string.h new file mode 100644 index 0000000..4d0f3d8 --- /dev/null +++ b/cfe/cfe/include/lib_string.h @@ -0,0 +1,117 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * string prototypes File: lib_string.h + * + * Function prototypes for the string routines + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +char *lib_strcpy(char *dest,const char *src); +char *lib_strncpy(char *dest,const char *src,size_t cnt); +size_t lib_xstrncpy(char *dest,const char *src,size_t cnt); +size_t lib_strlen(const char *str); + +int lib_strcmp(const char *dest,const char *src); + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +int lib_strncmp(const char *dest, const char *src, size_t cnt ); +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +int lib_strcmpi(const char *dest,const char *src); +char *lib_strchr(const char *dest,int c); +char *lib_strrchr(const char *dest,int c); +int lib_memcmp(const void *dest,const void *src,size_t cnt); +void *lib_memcpy(void *dest,const void *src,size_t cnt); +void *lib_memset(void *dest,int c,size_t cnt); +char *lib_strdup(char *str); +void lib_trimleading(char *str); +void lib_chop_filename(char *str,char **host,char **file); +void lib_strupr(char *s); +char lib_toupper(char c); +char *lib_strcat(char *dest,const char *src); +char *lib_gettoken(char **str); +char *lib_strnchr(const char *dest,int c,size_t cnt); +int lib_parseipaddr(const char *ipaddr,uint8_t *dest); +int lib_atoi(const char *dest); +int lib_lookup(const cons_t *list,char *str); +int lib_setoptions(const cons_t *list,char *str,unsigned int *flags); +int lib_xtoi(const char *dest); +uint64_t lib_xtoq(const char *dest); + + + +#ifndef _LIB_NO_MACROS_ +#define strcpy(d,s) lib_strcpy(d,s) +#define strncpy(d,s,c) lib_strncpy(d,s,c) +#define xstrncpy(d,s,c) lib_xstrncpy(d,s,c) +#define strlen(s) lib_strlen(s) +#define strchr(s,c) lib_strchr(s,c) +#define strrchr(s,c) lib_strrchr(s,c) +#define strdup(s) lib_strdup(s) +#define strcmp(d,s) lib_strcmp(d,s) + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#define strncmp(d,s,c) lib_strncmp(d,s,c) +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +#define strcmpi(d,s) lib_strcmpi(d,s) +#define memcmp(d,s,c) lib_memcmp(d,s,c) +#define memset(d,s,c) lib_memset(d,s,c) +#define memcpy(d,s,c) lib_memcpy(d,s,c) +#define bcopy(s,d,c) lib_memcpy(d,s,c) +#define bzero(d,c) lib_memset(d,0,c) +#define strupr(s) lib_strupr(s) +#define toupper(c) lib_toupper(c) +#define strcat(d,s) lib_strcat(d,s) +#define gettoken(s) lib_gettoken(s) +#define strnchr(d,ch,cnt) lib_strnchr(d,ch,cnt) +#define atoi(d) lib_atoi(d) +#define xtoi(d) lib_xtoi(d) +#define xtoq(d) lib_xtoq(d) +#define parseipaddr(i,d) lib_parseipaddr(i,d) +#define lookup(x,y) lib_lookup(x,y) +#define setoptions(x,y,z) lib_setoptions(x,y,z) +#endif + +void +qsort(void *bot, size_t nmemb, size_t size, int (*compar)(const void *,const void *)); + diff --git a/cfe/cfe/include/lib_types.h b/cfe/cfe/include/lib_types.h new file mode 100644 index 0000000..7453a0d --- /dev/null +++ b/cfe/cfe/include/lib_types.h @@ -0,0 +1,120 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Basic types File: lib_types.h + * + * This module defines the basic types used in CFE. Simple + * types, such as uint64_t, are defined here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifdef __mips +#if ((defined(__MIPSEB)+defined(__MIPSEL)) != 1) +#error "Either __MIPSEB or __MIPSEL must be defined!" +#endif +#endif + + +#ifndef _LIB_TYPES_H +#define _LIB_TYPES_H + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +/* ********************************************************************* + * Basic types + ********************************************************************* */ + +typedef int size_t; + +typedef char int8_t; +typedef unsigned char uint8_t; + +typedef short int16_t; +typedef unsigned short uint16_t; + +#ifdef __long64 +typedef int int32_t; +typedef unsigned int uint32_t; +#else +typedef long int32_t; +typedef unsigned long uint32_t; +#endif + +typedef long long int64_t; +typedef unsigned long long uint64_t; + +#define unsigned signed /* Kludge to get unsigned size-shaped type. */ +typedef __SIZE_TYPE__ intptr_t; +#undef unsigned +typedef __SIZE_TYPE__ uintptr_t; + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&((type *)0)->memb) +#endif + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct cons_s { + char *str; + int num; +} cons_t; + +#endif diff --git a/cfe/cfe/include/socregs.h b/cfe/cfe/include/socregs.h new file mode 100644 index 0000000..835f8aa --- /dev/null +++ b/cfe/cfe/include/socregs.h @@ -0,0 +1,63 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * SOC Register table defs File: socregs.h + * + * Data structures related to the "show soc" command and the + * "makereg" program. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +typedef struct socreg_s socreg_t; + +struct socreg_s { + uint32_t reg_addr; + uint32_t reg_agent; + const char *reg_inst; + const char *reg_subinst; + uint32_t reg_mask; + void (*reg_printfunc)(const socreg_t *reg,uint64_t value); + const char *reg_descr; +}; + + + + diff --git a/cfe/cfe/include/tftpd.h b/cfe/cfe/include/tftpd.h new file mode 100755 index 0000000..d7a15a9 --- /dev/null +++ b/cfe/cfe/include/tftpd.h @@ -0,0 +1,26 @@ +/*************************************************************************** +*** +*** Copyright 2005 Hon Hai Precision Ind. Co. Ltd. +*** All Rights Reserved. +*** No portions of this material shall be reproduced in any form without the +*** written permission of Hon Hai Precision Ind. Co. Ltd. +*** +*** All information contained in this document is Hon Hai Precision Ind. +*** Co. Ltd. company private, proprietary, and trade secret property and +*** are protected by international intellectual property laws and treaties. +*** +****************************************************************************/ + +#ifndef __TFTPD_H +#define __TFTPD_H + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#define TFTPD_STATE_OFF 0 +#define TFTPD_STATE_WAIT_IMAGE 1 +#define TFTPD_STATE_WRITE_IMAGE 2 + +extern int get_tftpd_state(void); +extern int set_tftpd_state(int state); +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +#endif diff --git a/cfe/cfe/include/ui_command.h b/cfe/cfe/include/ui_command.h new file mode 100644 index 0000000..e85a3ae --- /dev/null +++ b/cfe/cfe/include/ui_command.h @@ -0,0 +1,140 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Command interpreter defs File: ui_command.h + * + * This file contains structures related to the + * command interpreter. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _LIB_QUEUE_H +#include "lib_queue.h" +#endif + +typedef struct ui_cmdsw_s { + int swidx; + char *swname; + char *swvalue; +} ui_cmdsw_t; + +#define MAX_TOKENS 64 +#define MAX_SWITCHES 16 +#define MAX_TOKEN_SIZE 1000 +typedef struct ui_cmdline_s { + int argc; + char *argv[MAX_TOKENS]; + int swc; + ui_cmdsw_t swv[MAX_SWITCHES]; + int (*func)(struct ui_cmdline_s *,int argc,char *argv[]); + int argidx; + char *ref; + char *usage; + char *switches; +} ui_cmdline_t; + +typedef struct ui_command_s { + queue_t list; + int term; + char *ptr; + queue_t head; +} ui_command_t; + +typedef struct ui_token_s { + queue_t qb; + char token; +} ui_token_t; + +#define CMD_TERM_EOL 0 +#define CMD_TERM_SEMI 1 +#define CMD_TERM_AND 2 +#define CMD_TERM_OR 3 + +int cmd_sw_value(ui_cmdline_t *cmd,char *swname,char **swvalue); +int cmd_sw_posn(ui_cmdline_t *cmd,char *swname); +char *cmd_sw_name(ui_cmdline_t *cmd,int swidx); +int cmd_sw_isset(ui_cmdline_t *cmd,char *swname); +char *cmd_getarg(ui_cmdline_t *cmd,int argnum); +void cmd_free(ui_cmdline_t *cmd); +int cmd_sw_validate(ui_cmdline_t *cmd,char *validstr); +void cmd_parse(ui_cmdline_t *cmd,char *line); +int cmd_addcmd(char *command, + int (*func)(ui_cmdline_t *,int argc,char *argv[]), + void *ref, + char *help, + char *usage, + char *switches); +int cmd_lookup(queue_t *head,ui_cmdline_t *cmd); +void cmd_init(void); +int cmd_getcommand(ui_cmdline_t *cmd); +void cmd_showusage(ui_cmdline_t *cmd); + + + +#define CMD_ERR_INVALID -1 +#define CMD_ERR_AMBIGUOUS -2 +#define CMD_ERR_BLANK -3 + + +/* ********************************************************************* + * Prototypes (public routines) + ********************************************************************* */ + +const char *ui_errstring(int errcode); +int ui_showerror(int errcode,char *tmplt,...); +int ui_showusage(ui_cmdline_t *cmd); +int ui_docommands(char *str); +#define ui_docommand(str) ui_docommands(str) +void ui_restart(int); +int ui_init_cmddisp(void); + + +/* ********************************************************************* + * Prototypes (internal routines) + ********************************************************************* */ + +ui_command_t *cmd_readcommand(queue_t *head); +void cmd_build_list(queue_t *qb,char *buf); +void cmd_walk_and_expand(queue_t *qb); +ui_command_t *cmd_readcommand(queue_t *head); +void cmd_free_tokens(queue_t *list); +void cmd_build_cmdline(queue_t *head, ui_cmdline_t *cmd); + + diff --git a/cfe/cfe/lib/lib_arena.c b/cfe/cfe/lib/lib_arena.c new file mode 100644 index 0000000..41867dc --- /dev/null +++ b/cfe/cfe/lib/lib_arena.c @@ -0,0 +1,389 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Arena Manager File lib_arena.c + * + * This module manages the _arena_, a sorted linked list of + * memory regions and attributes. We use this to keep track + * of physical memory regions and what is assigned to them. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_queue.h" +#include "lib_arena.h" +#include "lib_malloc.h" + +/* ********************************************************************* + * arena_print(arena,msg) + * + * Debug routine to print out an arena entry + * + * Input parameters: + * arena - arena descriptor + * msg - heading message + * + * Return value: + * nothing + ********************************************************************* */ + +#ifdef _TESTPROG_ +static void arena_print(arena_t *arena,char *msg) +{ + arena_node_t *node; + queue_t *qb; + + printf("%s\n",msg); + + for (qb = (arena->arena_list.q_next); qb != &(arena->arena_list); + qb = qb->q_next) { + node = (arena_node_t *) qb; + + printf("Start %5I64d End %5I64d Type %d\n", + node->an_address, + node->an_address+node->an_length, + node->an_type); + + } + +} +#endif + +/* ********************************************************************* + * arena_init(arena,physmembase,physmemsize) + * + * Initialize an arena descriptor. The arena is typically + * created to describe the entire physical memory address space. + * + * Input parameters: + * arena - arena descriptor + * physmembase - base of region to manage (usually 0) + * physmemsize - size of region to manage (typically maxint) + * + * Return value: + * nothing + ********************************************************************* */ + +void arena_init(arena_t *arena,uint64_t physmembase,uint64_t physmemsize) +{ + arena_node_t *an = NULL; + + an = (arena_node_t *) KMALLOC(sizeof(arena_node_t),sizeof(uint64_t)); + + /* XXX check return value */ + + arena->arena_base = physmembase; + arena->arena_size = physmemsize; + + an->an_address = physmembase; + an->an_length = physmemsize; + an->an_type = 0; + an->an_descr = NULL; + + q_init(&(arena->arena_list)); + q_enqueue(&(arena->arena_list),(queue_t *) an); +} + + +/* ********************************************************************* + * arena_find(arena,pt) + * + * Locate the arena node containing a particular point in the + * address space. This routine walks the list and finds the node + * whose address range contains the specified point. + * + * Input parameters: + * arena - arena descriptor + * pt - point to look for + * + * Return value: + * arena node pointer, or NULL if no node found + ********************************************************************* */ + +static arena_node_t *arena_find(arena_t *arena,uint64_t pt) +{ + queue_t *qb; + arena_node_t *an; + + for (qb = (arena->arena_list.q_next); qb != &(arena->arena_list); + qb = qb->q_next) { + an = (arena_node_t *) qb; + + if ((pt >= an->an_address) && + (pt < (an->an_address + an->an_length))) return an; + + } + + return NULL; +} + +/* ********************************************************************* + * arena_split(arena,splitpoint) + * + * Split the node containing the specified point. When we carve + * the arena up, we split the arena at the points on the edges + * of the new region, change their types, and then coalesce the + * arena. This handles the "split" part of that process. + * + * Input parameters: + * arena - arena descriptor + * splitpoint - address to split arena at + * + * Return value: + * 0 if ok + * -1 if could not split + ********************************************************************* */ + +static int arena_split(arena_t *arena,uint64_t splitpoint) +{ + arena_node_t *node; + arena_node_t *newnode; + + /* + * Don't need to split if it's the *last* address in the arena + */ + + if (splitpoint == (arena->arena_base+arena->arena_size)) return 0; + + /* + * Find the block that contains the split point. + */ + + node = arena_find(arena,splitpoint); + if (node == NULL) return -1; /* should not happen */ + + /* + * If the address matches exactly, don't need to split + */ + if (node->an_address == splitpoint) return 0; + + /* + * Allocate a new node and adjust the length of the node we're + * splitting. + */ + + newnode = (arena_node_t *) KMALLOC(sizeof(arena_node_t),sizeof(uint64_t)); + + newnode->an_length = node->an_length - (splitpoint - node->an_address); + node->an_length = splitpoint - node->an_address; + newnode->an_address = splitpoint; + newnode->an_type = node->an_type; + + /* + * Put the new node in the arena + */ + + q_enqueue(node->an_next.q_next,(queue_t *) newnode); + + return 0; +} + +/* ********************************************************************* + * arena_coalesce(arena) + * + * Coalesce the arena, merging regions that have the same type + * together. After coalescing, no two adjacent nodes will + * have the same type. + * + * Input parameters: + * arena - arena descriptor + * + * Return value: + * nothing + ********************************************************************* */ + +static void arena_coalesce(arena_t *arena) +{ + arena_node_t *node; + arena_node_t *nextnode; + int removed; + queue_t *qb; + + do { + removed = 0; + for (qb = (arena->arena_list.q_next); qb != &(arena->arena_list); + qb = qb->q_next) { + + node = (arena_node_t *) qb; + nextnode = (arena_node_t *) node->an_next.q_next; + + if ((queue_t *) nextnode == &(arena->arena_list)) break; + + if (node->an_type == nextnode->an_type) { + node->an_length += nextnode->an_length; + q_dequeue((queue_t *) nextnode); + KFREE(nextnode); + removed++; + } + } + } while (removed > 0); +} + + +/* ********************************************************************* + * arena_markrange(arena,address,length,type,descr) + * + * Mark a region in the arena, changing the types of nodes and + * splitting nodes as necessary. This routine is called for + * each region we want to add. The order of marking regions is + * important, since new marks overwrite old ones. Therefore, you + * could mark a whole range as DRAM, and then mark sub-regions + * within that as used by firmware. + * + * Input parameters: + * arena - arena descriptor + * address,length - region to mark + * type - type code for region + * descr - text description of region (optional) + * + * Return value: + * 0 if ok + * -1 if error + ********************************************************************* */ + +int arena_markrange(arena_t *arena,uint64_t address,uint64_t length,int type,char *descr) +{ + queue_t *qb; + arena_node_t *node; + + /* + * Range check the region we want to mark + */ + + if ((address < arena->arena_base) || + ((address+length) > (arena->arena_base + arena->arena_size))) { + return -1; + } + + /* + * Force the arena to be split at the two points at the + * beginning and end of the range we want. If we have + * problems, coalesce the arena again and get out. + */ + + if (arena_split(arena,address) < 0) { + /* don't need to coalesce, we didn't split */ + return -1; + } + if (arena_split(arena,(address+length)) < 0) { + /* recombine nodes split above */ + arena_coalesce(arena); + return -1; + } + + /* + * Assuming we've split the arena at the beginning and ending + * split points, we'll never mark any places outside the range + * specified in the "Address,length" args. + */ + + for (qb = (arena->arena_list.q_next); qb != &(arena->arena_list); + qb = qb->q_next) { + node = (arena_node_t *) qb; + + if ((node->an_address >= address) && + ((node->an_address + node->an_length) <= (address+length))) { + node->an_type = type; + node->an_descr = descr; + } + } + + /* + * Now, coalesce adjacent pieces with the same type back together again + */ + + arena_coalesce(arena); + + return 0; +} + + + +/* ********************************************************************* + * main(argc,argv) + * + * Test program. + * + * Input parameters: + * argc,argv - guess + * + * Return value: + * nothing + ********************************************************************* */ + +#ifdef _TESTPROG_ +void main(int argc,char *argv[]) +{ + arena_t arena; + + arena_init(&arena,0,1024); +#if 0 + arena_print(&arena,"empty arena------------"); + + arena_split(&arena,5); + arena_print(&arena,"split at 5-------------"); + + arena_split(&arena,300); + arena_print(&arena,"split at 300-----------"); + + arena_split(&arena,100); + arena_print(&arena,"split at 100-----------"); + + arena_coalesce(&arena); + arena_print(&arena,"coalesced again--------"); + + arena_markrange(&arena,100,50,1); + arena_print(&arena,"addrange 100-150-------"); + arena_markrange(&arena,10,50,1); + arena_print(&arena,"addrange 10-60---------"); + arena_markrange(&arena,1000,24,3); + arena_print(&arena,"addrange 1000-1023-----"); +#endif + + arena_markrange(&arena,100,10,1); + arena_markrange(&arena,120,10,2); + arena_markrange(&arena,140,10,3); + arena_print(&arena,"Before big markrange---------"); + + arena_markrange(&arena,50,200,4); + arena_print(&arena,"after big markrange---------"); + +} +#endif diff --git a/cfe/cfe/lib/lib_malloc.c b/cfe/cfe/lib/lib_malloc.c new file mode 100644 index 0000000..f7e33b2 --- /dev/null +++ b/cfe/cfe/lib/lib_malloc.c @@ -0,0 +1,620 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Local memory manager File: cfe_malloc.c + * + * This routine is used to manage memory allocated within the + * firmware. You give it a chunk of memory to manage, and then + * these routines manage suballocations from there. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifdef TESTPROG +#include +#include +#include +#endif + +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_malloc.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define MEMNODE_SEAL 0xFAAFA123 /* just some random constant */ +#define MINBLKSIZE 64 + +/* ********************************************************************* + * Types + ********************************************************************* */ + +typedef enum { memnode_free = 0, memnode_alloc } memnode_status_t; + +typedef struct memnode_s { + unsigned int seal; + struct memnode_s *next; /* pointer to next node */ + unsigned int length; /* length of the entire data section */ + memnode_status_t status; /* alloc/free status */ + unsigned char *data; /* points to actual user data */ + void *memnodeptr; /* memnode back pointer (see comments) */ +} memnode_t; + +struct mempool_s { + memnode_t *root; /* pointer to root node */ + unsigned char *base; /* base of memory region */ + unsigned int length; /* size of memory region */ +}; + +#define memnode_data(t,m) (t) (((memnode_t *) (m))+1) + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +mempool_t kmempool; /* default pool */ + +/* ********************************************************************* + * kmeminit(pool,buffer,length) + * + * Initialize the memory manager, given a pointer to an area + * of memory and a size. This routine simply initializes the + * root node to be a single block of empty space. + * + * Input parameters: + * pool - pool pointer + * buffer - beginning of buffer area, must be pointer-aligned + * length - length of buffer area + * + * Return value: + * nothing + ********************************************************************* */ + + +void kmeminit(mempool_t *pool,unsigned char *buffer,int length) +{ + pool->root = (memnode_t *) buffer; + pool->root->seal = MEMNODE_SEAL; + pool->root->length = length - sizeof(memnode_t); + pool->root->data = memnode_data(unsigned char *,pool->root); + pool->root->status = memnode_free; + pool->root->next = NULL; + + pool->base = buffer; + pool->length = length; +} + + +/* ********************************************************************* + * kmempoolbase(pool) + * + * Returns the base address of the specified memory pool + * + * Input parameters: + * pool - pool pointer + * + * Return value: + * pointer to beginning of pool's memory + ********************************************************************* */ +void *kmempoolbase(mempool_t *pool) +{ + return pool->base; +} + +/* ********************************************************************* + * kmempoolsize(pool) + * + * Returns the total size of the specified memory pool + * + * Input parameters: + * pool - pool pointer + * + * Return value: + * size of pool in bytes + ********************************************************************* */ + +int kmempoolsize(mempool_t *pool) +{ + return pool->length; +} + +/* ********************************************************************* + * kmemcompact(pool) + * + * Compact the memory blocks, coalescing consectutive free blocks + * on the list. + * + * Input parameters: + * pool - pool descriptor + * + * Return value: + * nothing + ********************************************************************* */ + +static void kmemcompact(mempool_t *pool) +{ + memnode_t *m; + int compacted; + + do { + compacted = 0; + + for (m = pool->root; m; m = m->next) { + + /* Check seal to be sure that we're doing ok */ + + if (m->seal != MEMNODE_SEAL) { +#ifdef TESTPROG + printf("Memory list corrupted!\n"); +#endif + return; + } + + /* + * If we're not on the last block and both this + * block and the next one are free, combine them + */ + + if (m->next && + (m->status == memnode_free) && + (m->next->status == memnode_free)) { + m->length += sizeof(memnode_t) + m->next->length; + m->next->seal = 0; + m->next = m->next->next; + compacted++; + } + + /* Keep going till we make a pass without doing anything. */ + } + } while (compacted > 0); +} + + +/* ********************************************************************* + * kfree(ptr) + * + * Return some memory to the pool. + * + * Input parameters: + * ptr - pointer to something allocated via kmalloc() + * + * Return value: + * nothing + ********************************************************************* */ + +void kfree(mempool_t *pool,void *ptr) +{ + memnode_t **backptr; + memnode_t *m; + + if (((unsigned char *) ptr < pool->base) || + ((unsigned char *) ptr >= (pool->base+pool->length))) { +#ifdef TESTPROG + printf("Pointer %08X does not belong to pool %08X\n",ptr,pool); +#endif + return; + } + + backptr = (memnode_t **) (((unsigned char *) ptr) - sizeof(memnode_t *)); + m = *backptr; + + if (m->seal != MEMNODE_SEAL) { +#ifdef TESTPROG + printf("Invalid node freed: %08X\n",m); +#endif + return; + } + + m->status = memnode_free; + + kmemcompact(pool); +} + +/* ********************************************************************* + * lib_outofmemory() + * + * Called when we run out of memory. + * XXX replace with something real someday + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void lib_outofmemory(void); +void lib_outofmemory(void) +{ + xprintf("PANIC: out of memory!\n"); +} + +/* ********************************************************************* + * kmalloc(pool,size,align) + * + * Allocate some memory from the pool. + * + * Input parameters: + * pool - pool structure + * size - size of item to allocate + * align - alignment (must be zero or a power of 2) + * + * Return value: + * pointer to data, or NULL if no memory left + ********************************************************************* */ + +void *kmalloc(mempool_t *pool,unsigned int size,unsigned int align) +{ + memnode_t *m; + memnode_t *newm; + memnode_t **backptr; + uintptr_t daddr = 0; + uintptr_t realsize = 0; + uintptr_t extra; + uintptr_t blkend; + uintptr_t ptralign; + + /* + * Everything should be aligned by at least the + * size of an int64 + */ + + ptralign = (uintptr_t) align; + if (ptralign < sizeof(void *)) ptralign = sizeof(uint64_t); + + /* + * Everything should be at least a multiple of the + * size of a pointer. + */ + + if (size == 0) size = sizeof(void *); + if (size & (sizeof(void *)-1)) { + size += sizeof(void *); + size &= ~(sizeof(void *)-1); + } + + /* + * Find a memnode at least big enough to hold the storage we + * want. + */ + + for (m = pool->root; m; m = m->next) { + + if (m->status == memnode_alloc) continue; + + /* + * If we wanted a particular alignment, we will + * need to adjust the size. + */ + + daddr = memnode_data(uintptr_t,m); + extra = 0; + if (daddr & (ptralign-1)) { + extra = size + (ptralign - (daddr & (ptralign-1))); + } + realsize = size + extra; + + if (m->length < realsize) continue; + break; + } + + /* + * If m is null, there's no memory left. + */ + + if (m == NULL) { + lib_outofmemory(); + return NULL; + } + + /* + * Otherwise, use this block. Calculate the address of the data + * to preserve the alignment. + */ + + if (daddr & (ptralign-1)) { + daddr += ptralign; + daddr &= ~(ptralign-1); + } + + /* Mark this node as allocated. */ + + m->data = (unsigned char *) daddr; + m->status = memnode_alloc; + + /* + * Okay, this is ugly. Store a pointer to the original + * memnode just before what we've allocated. It's guaranteed + * to be aligned at least well enough for this pointer. + * If for some reason the memnode was already exactly + * aligned, backing up will put us inside the memnode + * structure itself... that's why the memnodeptr field + * is there, as a placeholder for this eventuality. + */ + + backptr = (memnode_t **) (m->data - sizeof(memnode_t *)); + *backptr = m; + + /* + * See if we need to split it. + * Don't bother to split if the resulting size will be + * less than MINBLKSIZE bytes + */ + + if (m->length - realsize < MINBLKSIZE) { + return m->data; + } + + /* + * Split this block. Align the address on a pointer-size + * boundary. + */ + + daddr += size; + if (daddr & (uintptr_t)(sizeof(void *)-1)) { + daddr += (uintptr_t)sizeof(void *); + daddr &= ~(uintptr_t)(sizeof(void *)-1); + } + + blkend = memnode_data(uintptr_t,m) + (uintptr_t)(m->length); + + newm = (memnode_t *) daddr; + + newm->next = m->next; + m->length = (unsigned int) (daddr - memnode_data(uintptr_t,m)); + m->next = newm; + m->status = memnode_alloc; + newm->seal = MEMNODE_SEAL; + newm->data = memnode_data(unsigned char *,newm); + newm->length = (unsigned int) (blkend - memnode_data(uintptr_t,newm)); + newm->status = memnode_free; + + return m->data; +} + + +int kmemstats(mempool_t *pool,memstats_t *stats) +{ + memnode_t *m; + memnode_t **backptr; + uintptr_t daddr; + + stats->mem_totalbytes = pool->length; + stats->mem_allocbytes = 0; + stats->mem_freebytes = 0; + stats->mem_allocnodes = 0; + stats->mem_freenodes = 0; + stats->mem_largest = 0; + + for (m = pool->root; m; m = m->next) { + if (m->status) { + stats->mem_allocnodes++; + stats->mem_allocbytes += m->length; + } + else { + stats->mem_freenodes++; + stats->mem_freebytes += m->length; + if (m->length > stats->mem_largest) { + stats->mem_largest = m->length; + } + } + + daddr = memnode_data(uintptr_t,m); + if (m->seal != MEMNODE_SEAL) { + return -1; + } + if (m->next && ((daddr + m->length) != (uintptr_t) m->next)) { + return -1; + } + if (m->next && (m->next < m)) { + return -1; + } + if (m->data < (unsigned char *) m) { + return -1; + } + if (m->status == memnode_alloc) { + backptr = (memnode_t **) (m->data - sizeof(void *)); + if (*backptr != m) { + return -1; + } + } + } + + return 0; +} + + +/* ********************************************************************* + * kmemchk() + * + * Check the consistency of the memory pool. + * + * Input parameters: + * pool - pool pointer + * + * Return value: + * 0 - pool is consistent + * -1 - pool is corrupt + ********************************************************************* */ + +#ifdef TESTPROG +int kmemchk(mempool_t *pool,int verbose) +{ + memnode_t *m; + memnode_t **backptr; + unsigned int daddr; + + for (m = pool->root; m; m = m->next) { + if (verbose) { + printf("%08X: Next=%08X Len=%5u %s Data=%08X ", + m,m->next,m->length, + m->status ? "alloc" : "free ", + m->data); + } + daddr = memnode_data(uintptr_t,m); + if (m->seal != MEMNODE_SEAL) { + if (verbose) printf("BadSeal "); + else return -1; + } + if (m->next && (daddr + m->length != (unsigned int) m->next)) { + if (verbose) printf("BadLength "); + else return -1; + } + if (m->next && (m->next < m)) { + if (verbose) printf("BadOrder "); + else return -1; + } + if (m->data < (unsigned char *) m) { + if (verbose) printf("BadData "); + else return -1; + } + if (m->status == memnode_alloc) { + backptr = (memnode_t **) (m->data - sizeof(void *)); + if (*backptr != m) { + if (verbose) printf("BadBackPtr "); + else return -1; + } + } + if (verbose) printf("\n"); + } + + return 0; +} + + +#define MEMSIZE 1024*1024 + +unsigned char *ptrs[4096]; +unsigned int sizes[4096]; + +/* ********************************************************************* + * main(argc,argv) + * + * Test program for the memory allocator + * + * Input parameters: + * argc,argv + * + * Return value: + * nothing + ********************************************************************* */ + + +void main(int argc,char *argv[]) +{ + unsigned char *mem; + int items = 0; + int idx; + int size; + int totalsize = 0; + int nfree,freecnt; + mempool_t *pool = &kmempool; + + mem = malloc(MEMSIZE); + kmeminit(pool,mem,MEMSIZE); + + items = 0; + + for (;;) { + + for (;;) { + if (items == 4096) break; + size = rand() % 1024; + ptrs[items] = kmalloc(pool,size,1<<(rand() & 7)); + if (!ptrs[items]) break; + sizes[items] = size; + items++; + totalsize += size; + } + + printf("%d items allocated, %d total bytes\n",items,totalsize); + + if (kmemchk(pool,0) < 0) { + kmemchk(pool,1); + exit(1); + } + + /* Scramble the pointers */ + idx = items - 1; + + while (idx) { + if (rand() & 2) { + mem = ptrs[0]; + ptrs[0] = ptrs[idx]; + ptrs[idx] = mem; + + nfree = sizes[0]; + sizes[0] = sizes[idx]; + sizes[idx] = nfree; + } + idx--; + } + + /* now free a random number of elements */ + + nfree = rand() % items; + freecnt = 0; + + for (idx = nfree; idx < items; idx++) { + kfree(pool,ptrs[idx]); + totalsize -= sizes[idx]; + freecnt++; + ptrs[idx] = NULL; + sizes[idx] = 0; + if (kmemchk(pool,0) < 0) { + kmemchk(pool,1); + exit(1); + } + } + + items -= freecnt; + + printf("."); + + } + + kmemchk(pool,1); + + exit(0); +} + +#endif /* TESTPROG */ diff --git a/cfe/cfe/lib/lib_misc.c b/cfe/cfe/lib/lib_misc.c new file mode 100644 index 0000000..e5a2a02 --- /dev/null +++ b/cfe/cfe/lib/lib_misc.c @@ -0,0 +1,229 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Misc. library routines File: lib_misc.c + * + * Miscellaneous library routines. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#define _LIB_NO_MACROS_ +#include "lib_string.h" + + +/* ********************************************************************* + * lib_parseipaddr(ipaddr,dest) + * + * Parse an IP address. + * + * Input parameters: + * ipaddr - string of IP address + * dest - pointer to 4 bytes to receive binary IP address + * + * Return value: + * 0 if ok + * -1 if ip address is invalid + ********************************************************************* */ + +int lib_parseipaddr(const char *ipaddr,uint8_t *dest) +{ + int a,b,c,d; + char *x; + + /* make sure it's all digits and dots. */ + x = (char *) ipaddr; + while (*x) { + if ((*x == '.') || ((*x >= '0') && (*x <= '9'))) { + x++; + continue; + } + return -1; + } + + x = (char *) ipaddr; + a = lib_atoi(ipaddr); + x = lib_strchr(x,'.'); + if (!x) return -1; + b = lib_atoi(x+1); + x = lib_strchr(x+1,'.'); + if (!x) return -1; + c = lib_atoi(x+1); + x = lib_strchr(x+1,'.'); + if (!x) return -1; + d = lib_atoi(x+1); + + if ((a < 0) || (a > 255)) return -1; + if ((b < 0) || (b > 255)) return -1; + if ((c < 0) || (c > 255)) return -1; + if ((d < 0) || (d > 255)) return -1; + + dest[0] = (uint8_t) a; + dest[1] = (uint8_t) b; + dest[2] = (uint8_t) c; + dest[3] = (uint8_t) d; + + return 0; +} + + +/* ********************************************************************* + * lib_lookup(list,str) + * + * Look up an element on a {string,value} list. + * + * Input parameters: + * list - list to search + * str - string to find on the list + * + * Return value: + * 0 if string was not found + * else number associated with this string + ********************************************************************* */ + +int lib_lookup(const cons_t *list,char *str) +{ + while (list->str) { + if (lib_strcmp(list->str,str) == 0) return list->num; + list++; + } + + return 0; + +} + +/* ********************************************************************* + * lib_findinlist(list,str) + * + * Like lib_lookup but returns cons structure instead of value + * + * Input parameters: + * list - list of associations + * str - what to find + * + * Return value: + * cons_t or null if not found + ********************************************************************* */ + +static const cons_t *lib_findinlist(const cons_t *list,char *str) +{ + while (list->str) { + if (lib_strcmp(list->str,str) == 0) return list; + list++; + } + return NULL; +} + + +/* ********************************************************************* + * lib_setoptions(list,str,flags) + * + * Set or reset one or more bits in a flags variable based + * on the list of valid bits and a string containing what + * to change. flags starts off as a default value. + * + * The input string is a comma-separated list of options, + * optionally prefixed by "no_" or "no" to invert the + * sense of the option. negative values in the table + * remove options, positive add options (you can't use + * bit 31 as an option for this reason). + * + * Input parameters: + * list - list of valid options + * str - options to parse + * flags - pointer to variable to be modified + * + * Return value: + * number of options we did not understand, 0=ok + ********************************************************************* */ + +int lib_setoptions(const cons_t *list,char *str,unsigned int *flags) +{ + char *dupstr; + char *x; + char *ptr; + const cons_t *val; + int newbits; + int errors = 0; + + if (!list || !str || !flags) return 0; + + dupstr = lib_strdup(str); + if (!dupstr) return 0; + + ptr = dupstr; + + while (*ptr) { + if ((x = lib_strchr(ptr,','))) { + *x = '\0'; + } + + val = lib_findinlist(list,ptr); + newbits = 0; + if (!val) { + if (lib_memcmp(ptr,"no_",3) == 0) { + val = lib_findinlist(list,ptr+3); + } + else if (lib_memcmp(ptr,"no",2) == 0) { + val = lib_findinlist(list,ptr+2); + } + if (val) newbits = ~((unsigned int) (val->num)); + else errors++; + } + else { + newbits = (val->num); + } + + /* if new bits are negative, it's an AND mask + otherwise it's an OR mask */ + + if (newbits < 0) *flags &= (unsigned int) newbits; + else *flags |= (unsigned int) newbits; + + if (x) ptr = x+1; + else break; + } + + KFREE(dupstr); + + return errors; +} diff --git a/cfe/cfe/lib/lib_printf.c b/cfe/cfe/lib/lib_printf.c new file mode 100644 index 0000000..7dc3442 --- /dev/null +++ b/cfe/cfe/lib/lib_printf.c @@ -0,0 +1,442 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * simple printf File: lib_printf.c + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + * This module contains a very, very, very simple printf + * suitable for use in the boot ROM. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include +#include "lib_types.h" +#include "lib_printf.h" + +/* ********************************************************************* + * Externs * + ********************************************************************* */ + +/* ********************************************************************* + * Globals * + ********************************************************************* */ + +static const char digits[17] = "0123456789ABCDEF"; +static const char ldigits[17] = "0123456789abcdef"; + +int (*xprinthook)(const char *str) = NULL; + +/* ********************************************************************* + * __atox(buf,num,radix,width) + * + * Convert a number to a string + * + * Input Parameters: + * buf - where to put characters + * num - number to convert + * radix - radix to convert number to (usually 10 or 16) + * width - width in characters + * + * Return Value: + * number of digits placed in output buffer + ********************************************************************* */ +static int __atox(char *buf,unsigned int num,unsigned int radix,int width, + const char *digits) +{ + char buffer[16]; + char *op; + int retval; + + op = &buffer[0]; + retval = 0; + + do { + *op++ = digits[num % radix]; + retval++; + num /= radix; + } while (num != 0); + + if (width && (width > retval)) { + width = width - retval; + while (width) { + *op++ = '0'; + retval++; + width--; + } + } + + while (op != buffer) { + op--; + *buf++ = *op; + } + + return retval; +} + + +/* ********************************************************************* + * __llatox(buf,num,radix,width) + * + * Convert a long number to a string + * + * Input Parameters: + * buf - where to put characters + * num - number to convert + * radix - radix to convert number to (usually 10 or 16) + * width - width in characters + * + * Return Value: + * number of digits placed in output buffer + ********************************************************************* */ +static int __llatox(char *buf,unsigned long long num,unsigned int radix, + int width,const char *digits) +{ + char buffer[16]; + char *op; + int retval; + + op = &buffer[0]; + retval = 0; + +#ifdef _MIPSREGS32_ + /* + * Hack: to avoid pulling in the helper library that isn't necessarily + * compatible with PIC code, force radix to 16, use shifts and masks + */ + do { + *op++ = digits[num & 0x0F]; + retval++; + num >>= 4; + } while (num != 0); +#else + do { + *op++ = digits[num % radix]; + retval++; + num /= radix; + } while (num != 0); +#endif + + if (width && (width > retval)) { + width = width - retval; + while (width) { + *op++ = '0'; + retval++; + width--; + } + } + + while (op != buffer) { + op--; + *buf++ = *op; + } + + return retval; +} + +/* ********************************************************************* + * xvsprintf(outbuf,template,arglist) + * + * Format a string into the output buffer + * + * Input Parameters: + * outbuf - output buffer + * template - template string + * arglist - parameters + * + * Return Value: + * number of characters copied + ********************************************************************* */ +#define isdigit(x) (((x) >= '0') && ((x) <= '9')) +int xvsprintf(char *outbuf,const char *templat,va_list marker) +{ + char *optr; + const char *iptr; + unsigned char *tmpptr; + unsigned int x; + unsigned long long lx; + int i; + long long ll; + int leadingzero; + int leadingnegsign; + int islong; + int width; + int width2 = 0; + int hashash = 0; + + optr = outbuf; + iptr = templat; + + while (*iptr) { + if (*iptr != '%') {*optr++ = *iptr++; continue;} + + iptr++; + + if (*iptr == '#') { hashash = 1; iptr++; } + if (*iptr == '-') { + leadingnegsign = 1; + iptr++; + } + else leadingnegsign = 0; + + if (*iptr == '0') leadingzero = 1; + else leadingzero = 0; + + width = 0; + while (*iptr && isdigit(*iptr)) { + width += (*iptr - '0'); + iptr++; + if (isdigit(*iptr)) width *= 10; + } + if (*iptr == '.') { + iptr++; + width2 = 0; + while (*iptr && isdigit(*iptr)) { + width2 += (*iptr - '0'); + iptr++; + if (isdigit(*iptr)) width2 *= 10; + } + } + + islong = 0; + if (*iptr == 'l') { islong++; iptr++; } + if (*iptr == 'l') { islong++; iptr++; } + + switch (*iptr) { + case 'I': + tmpptr = (unsigned char *) va_arg(marker,unsigned char *); + optr += __atox(optr,*tmpptr++,10,0,digits); + *optr++ = '.'; + optr += __atox(optr,*tmpptr++,10,0,digits); + *optr++ = '.'; + optr += __atox(optr,*tmpptr++,10,0,digits); + *optr++ = '.'; + optr += __atox(optr,*tmpptr++,10,0,digits); + break; + case 's': + tmpptr = (unsigned char *) va_arg(marker,unsigned char *); + if (!tmpptr) tmpptr = (unsigned char *) "(null)"; + if ((width == 0) & (width2 == 0)) { + while (*tmpptr) *optr++ = *tmpptr++; + break; + } + while (width && *tmpptr) { + *optr++ = *tmpptr++; + width--; + } + while (width) { + *optr++ = ' '; + width--; + } + break; + case 'a': + tmpptr = (unsigned char *) va_arg(marker,unsigned char *); + for (x = 0; x < 5; x++) { + optr += __atox(optr,*tmpptr++,16,2,digits); + *optr++ = '-'; + } + optr += __atox(optr,*tmpptr++,16,2,digits); + break; + case 'd': + switch (islong) { + case 0: + case 1: + i = va_arg(marker,int); + if (i < 0) { *optr++='-'; i = -i;} + optr += __atox(optr,i,10,width,digits); + break; + case 2: + ll = va_arg(marker,long long int); + if (ll < 0) { *optr++='-'; ll = -ll;} + optr += __llatox(optr,ll,10,width,digits); + break; + } + break; + case 'u': + switch (islong) { + case 0: + case 1: + x = va_arg(marker,unsigned int); + optr += __atox(optr,x,10,width,digits); + break; + case 2: + lx = va_arg(marker,unsigned long long); + optr += __llatox(optr,lx,10,width,digits); + break; + } + break; + case 'X': + case 'x': + switch (islong) { + case 0: + case 1: + x = va_arg(marker,unsigned int); + optr += __atox(optr,x,16,width, + (*iptr == 'X') ? digits : ldigits); + break; + case 2: + lx = va_arg(marker,unsigned long long); + optr += __llatox(optr,lx,16,width, + (*iptr == 'X') ? digits : ldigits); + break; + } + break; + case 'p': + case 'P': +#ifdef __long64 + lx = va_arg(marker,unsigned long long); + optr += __llatox(optr,lx,16,16, + (*iptr == 'P') ? digits : ldigits); +#else + x = va_arg(marker,unsigned int); + optr += __atox(optr,x,16,8, + (*iptr == 'P') ? digits : ldigits); +#endif + break; + case 'w': + x = va_arg(marker,unsigned int); + x &= 0x0000FFFF; + optr += __atox(optr,x,16,4,digits); + break; + case 'b': + x = va_arg(marker,unsigned int); + x &= 0x0000FF; + optr += __atox(optr,x,16,2,digits); + break; + case 'Z': + x = va_arg(marker,unsigned int); + tmpptr = va_arg(marker,unsigned char *); + while (x) { + optr += __atox(optr,*tmpptr++,16,2,digits); + x--; + } + break; + case 'c': + x = va_arg(marker, int); + *optr++ = x & 0xff; + break; + + default: + *optr++ = *iptr; + break; + } + iptr++; + } + + *optr = '\0'; + + return (optr - outbuf); +} + + +/* ********************************************************************* + * xsprintf(buf,template,params..) + * + * format messages from template into a buffer. + * + * Input Parameters: + * buf - output buffer + * template - template string + * params... parameters + * + * Return Value: + * number of bytes copied to buffer + ********************************************************************* */ +int xsprintf(char *buf,const char *templat,...) +{ + va_list marker; + int count; + + va_start(marker,templat); + count = xvsprintf(buf,templat,marker); + va_end(marker); + + return count; +} + +/* ********************************************************************* + * xprintf(template,...) + * + * A miniature printf. + * + * %a - Ethernet address (16 bytes) + * %s - unpacked string, null terminated + * %x - hex word (machine size) + * %w - hex word (16 bits) + * %b - hex byte (8 bits) + * %Z - buffer (put length first, then buffer address) + * + * Return value: + * number of bytes written + ********************************************************************* */ + +int xprintf(const char *templat,...) +{ + va_list marker; + int count; + char buffer[512]; + + va_start(marker,templat); + count = xvsprintf(buffer,templat,marker); + va_end(marker); + + if (xprinthook) (*xprinthook)(buffer); + + return count; +} + + +int xvprintf(const char *templat,va_list marker) +{ + int count; + char buffer[512]; + + count = xvsprintf(buffer,templat,marker); + + if (xprinthook) (*xprinthook)(buffer); + + return count; +} + + + + + + + + diff --git a/cfe/cfe/lib/lib_qsort.c b/cfe/cfe/lib/lib_qsort.c new file mode 100644 index 0000000..f3c60b8 --- /dev/null +++ b/cfe/cfe/lib/lib_qsort.c @@ -0,0 +1,88 @@ +#include "lib_types.h" +#include "lib_string.h" + +#define CHAR_BIT 8 +#define MAXSTACK (sizeof(int) * CHAR_BIT) + +static void qsexchange(void *a, void *b, size_t size) +{ + size_t i; + + /****************** + * exchange a,b * + ******************/ + + for (i = sizeof(int); i <= size; i += sizeof(int)) { + int t = *((int *)a); + *(((int *)a)++) = *((int *)b); + *(((int *)b)++) = t; + } + for (i = i - sizeof(int) + 1; i <= size; i++) { + char t = *((char *)a); + *(((char *)a)++) = *((char *)b); + *(((char *)b)++) = t; + } +} + +void qsort(void *base, size_t nmemb, size_t size, + int (*compar)(const void *, const void *)) +{ + void *lbStack[MAXSTACK], *ubStack[MAXSTACK]; + int sp; + unsigned int offset; + + /******************** + * ANSI-C qsort() * + ********************/ + + lbStack[0] = (char *)base; + ubStack[0] = (char *)base + (nmemb-1)*size; + for (sp = 0; sp >= 0; sp--) { + char *lb, *ub, *m; + char *P, *i, *j; + + lb = lbStack[sp]; + ub = ubStack[sp]; + + while (lb < ub) { + + /* select pivot and exchange with 1st element */ + offset = (ub - lb) >> 1; + P = lb + offset - offset % size; + qsexchange (lb, P, size); + + /* partition into two segments */ + i = lb + size; + j = ub; + while (1) { + while (i < j && compar(lb, i) > 0) i += size; + while (j >= i && compar(j, lb) > 0) j -= size; + if (i >= j) break; + qsexchange (i, j, size); + j -= size; + i += size; + } + + /* pivot belongs in A[j] */ + qsexchange (lb, j, size); + m = j; + + /* keep processing smallest segment, and stack largest */ + if (m - lb <= ub - m) { + if (m + size < ub) { + lbStack[sp] = m + size; + ubStack[sp++] = ub; + } + ub = m - size; + } + else { + if (m - size > lb) { + lbStack[sp] = lb; + ubStack[sp++] = m - size; + } + lb = m + size; + } + } + } +} + diff --git a/cfe/cfe/lib/lib_queue.c b/cfe/cfe/lib/lib_queue.c new file mode 100644 index 0000000..0712adf --- /dev/null +++ b/cfe/cfe/lib/lib_queue.c @@ -0,0 +1,219 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Queue Management routines File: lib_queue.c + * + * Routines to manage doubly-linked queues. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_queue.h" + + +/* ********************************************************************* + * Q_ENQUEUE(qb,item) + * + * Add item to a queue + * + * Input Parameters: + * qb - queue block + * item - item to add + * + * Return Value: + * Nothing. + ********************************************************************* */ + +void q_enqueue(queue_t *qb,queue_t *item) +{ + qb->q_prev->q_next = item; + item->q_next = qb; + item->q_prev = qb->q_prev; + qb->q_prev = item; +} + + +/* ********************************************************************* + * Q_DEQUEUE(element) + * + * Remove an element from the queue + * + * Input Parameters: + * element - element to remove + * + * Return Value: + * Nothing. + ********************************************************************* */ + +void q_dequeue(queue_t *item) +{ + item->q_prev->q_next = item->q_next; + item->q_next->q_prev = item->q_prev; +} + + +/* ********************************************************************* + * Q_DEQNEXT(qb) + * + * Dequeue next element from the specified queue + * + * Input Parameters: + * qb - queue block + * + * Return Value: + * next element, or NULL + ********************************************************************* */ + +queue_t *q_deqnext(queue_t *qb) +{ + if (qb->q_next == qb) { + return NULL; + } + + qb = qb->q_next; + + qb->q_prev->q_next = qb->q_next; + qb->q_next->q_prev = qb->q_prev; + + return qb; +} + + +/* ********************************************************************* + * Q_MAP(qb) + * + * "Map" a queue, calling the specified function for each + * element in the queue + * + * If the function returns nonzero, q_map will terminate. + * + * Input Parameters: + * qb - queue block + * fn - function pointer + * a,b - parameters for the function + * + * Return Value: + * return value from function, or zero if entire queue + * was mapped. + ********************************************************************* */ + +int q_map(queue_t *qb, int (*func)(queue_t *,unsigned int,unsigned int), + unsigned int a,unsigned int b) +{ + queue_t *qe; + queue_t *nextq; + int res; + + qe = qb; + + qe = qb->q_next; + + while (qe != qb) { + nextq = qe->q_next; + if ((res = (*func)(qe,a,b))) return res; + qe = nextq; + } + + return 0; +} + + + + + +/* ********************************************************************* + * Q_COUNT(qb) * + * * + * Counts the elements on a queue (not interlocked) * + * * + * Input Parameters: * + * qb - queue block * + * * + * Return Value: * + * number of elements * + ********************************************************************* */ +int q_count(queue_t *qb) +{ + queue_t *qe; + int res = 0; + + qe = qb; + + while (qe->q_next != qb) { + qe = qe->q_next; + res++; + } + + return res; +} + + + + +/* ********************************************************************* + * Q_FIND(qb,item) + * + * Determines if a particular element is on a queue. + * + * Input Parameters: + * qb - queue block + * item - queue element + * + * Return Value: + * 0 - not on queue + * >0 - position on queue + ********************************************************************* */ +int q_find(queue_t *qb,queue_t *item) +{ + queue_t *q; + int res = 1; + + q = qb->q_next; + + while (q != item) { + if (q == qb) return 0; + q = q->q_next; + res++; + } + + return res; +} + diff --git a/cfe/cfe/lib/lib_string.c b/cfe/cfe/lib/lib_string.c new file mode 100644 index 0000000..08e9ee7 --- /dev/null +++ b/cfe/cfe/lib/lib_string.c @@ -0,0 +1,386 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * String routines File: lib_string.c + * + * Some standard routines for messing with strings. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + + +#include "lib_types.h" +#define _LIB_NO_MACROS_ +#include "lib_string.h" + +char *lib_strcpy(char *dest,const char *src) +{ + char *ptr = dest; + + while (*src) *ptr++ = *src++; + *ptr = '\0'; + + return dest; +} + +char *lib_strncpy(char *dest,const char *src,size_t cnt) +{ + char *ptr = dest; + + while (*src && (cnt > 0)) { + *ptr++ = *src++; + cnt--; + } + if (cnt > 0) *ptr = '\0'; + + return dest; +} + + +size_t lib_xstrncpy(char *dest,const char *src,size_t cnt) +{ + char *ptr = dest; + size_t copied = 0; + + while (*src && (cnt > 1)) { + *ptr++ = *src++; + cnt--; + copied++; + } + *ptr = '\0'; + + return copied; +} + +size_t lib_strlen(const char *str) +{ + size_t cnt = 0; + + while (*str) { + str++; + cnt++; + } + + return cnt; +} + + +int lib_strcmp(const char *dest,const char *src) +{ + while (*src && *dest) { + if (*dest < *src) return -1; + if (*dest > *src) return 1; + dest++; + src++; + } + + if (*dest && !*src) return 1; + if (!*dest && *src) return -1; + return 0; +} + +/* Foxconn add start by Jenny Zhao, 07/02/2008*/ +int lib_strncmp(const char *dest, const char *src, size_t cnt ) +{ + while (*src && *dest && cnt) { + if (*dest < *src ) return -1; + if (*dest > *src) return 1; + dest++; + src++; + cnt--; + } + + if (!cnt) return 0; + if (*dest && !*src) return 1; + if (!*dest && *src) return -1; + return 0; +} +/* Foxconn add start by Jenny Zhao, 07/02/2008*/ + + +int lib_strcmpi(const char *dest,const char *src) +{ + char dc,sc; + + while (*src && *dest) { + dc = lib_toupper(*dest); + sc = lib_toupper(*src); + if (dc < sc) return -1; + if (dc > sc) return 1; + dest++; + src++; + } + + if (*dest && !*src) return 1; + if (!*dest && *src) return -1; + return 0; +} + + +char *lib_strchr(const char *dest,int c) +{ + while (*dest) { + if (*dest == c) return (char *) dest; + dest++; + } + return NULL; +} + +char *lib_strnchr(const char *dest,int c,size_t cnt) +{ + while (*dest && (cnt > 0)) { + if (*dest == c) return (char *) dest; + dest++; + cnt--; + } + return NULL; +} + +char *lib_strrchr(const char *dest,int c) +{ + char *ret = NULL; + + while (*dest) { + if (*dest == c) ret = (char *) dest; + dest++; + } + + return ret; +} + + +int lib_memcmp(const void *dest,const void *src,size_t cnt) +{ + const unsigned char *d; + const unsigned char *s; + + d = (const unsigned char *) dest; + s = (const unsigned char *) src; + + while (cnt) { + if (*d < *s) return -1; + if (*d > *s) return 1; + d++; s++; cnt--; + } + + return 0; +} + +void *lib_memcpy(void *dest,const void *src,size_t cnt) +{ + unsigned char *d; + const unsigned char *s; + + d = (unsigned char *) dest; + s = (const unsigned char *) src; + + while (cnt) { + *d++ = *s++; + cnt--; + } + + return dest; +} + +void *lib_memset(void *dest,int c,size_t cnt) +{ + unsigned char *d; + + d = dest; + + while (cnt) { + *d++ = (unsigned char) c; + cnt--; + } + + return d; +} + +char lib_toupper(char c) +{ + if ((c >= 'a') && (c <= 'z')) c -= 32; + return c; +} + +void lib_strupr(char *str) +{ + while (*str) { + *str = lib_toupper(*str); + str++; + } +} + +char *lib_strcat(char *dest,const char *src) +{ + char *ptr = dest; + + while (*ptr) ptr++; + while (*src) *ptr++ = *src++; + *ptr = '\0'; + + return dest; +} + +#define isspace(x) (((x) == ' ') || ((x) == '\t')) + +char *lib_gettoken(char **ptr) +{ + char *p = *ptr; + char *ret; + + /* skip white space */ + + while (*p && isspace(*p)) p++; + ret = p; + + /* check for end of string */ + + if (!*p) { + *ptr = p; + return NULL; + } + + /* skip non-whitespace */ + + while (*p) { + if (isspace(*p)) break; + + /* do quoted strings */ + + if (*p == '"') { + p++; + ret = p; + while (*p && (*p != '"')) p++; + if (*p == '"') *p = '\0'; + } + + p++; + + } + + if (*p) { + *p++ = '\0'; + } + *ptr = p; + + return ret; +} + + +int lib_atoi(const char *dest) +{ + int x = 0; + int digit; + + if ((*dest == '0') && (*(dest+1) == 'x')) { + return lib_xtoi(dest+2); + } + + while (*dest) { + if ((*dest >= '0') && (*dest <= '9')) { + digit = *dest - '0'; + } + else { + break; + } + x *= 10; + x += digit; + dest++; + } + + return x; +} + +uint64_t lib_xtoq(const char *dest) +{ + uint64_t x = 0; + unsigned int digit; + + if ((*dest == '0') && (*(dest+1) == 'x')) dest += 2; + + while (*dest) { + if ((*dest >= '0') && (*dest <= '9')) { + digit = *dest - '0'; + } + else if ((*dest >= 'A') && (*dest <= 'F')) { + digit = 10 + *dest - 'A'; + } + else if ((*dest >= 'a') && (*dest <= 'f')) { + digit = 10 + *dest - 'a'; + } + else { + break; + } + x *= 16; + x += digit; + dest++; + } + + return x; +} + +int lib_xtoi(const char *dest) +{ + int x = 0; + int digit; + + if ((*dest == '0') && (*(dest+1) == 'x')) dest += 2; + + while (*dest) { + if ((*dest >= '0') && (*dest <= '9')) { + digit = *dest - '0'; + } + else if ((*dest >= 'A') && (*dest <= 'F')) { + digit = 10 + *dest - 'A'; + } + else if ((*dest >= 'a') && (*dest <= 'f')) { + digit = 10 + *dest - 'a'; + } + else { + break; + } + x *= 16; + x += digit; + dest++; + } + + return x; +} diff --git a/cfe/cfe/lib/lib_string2.c b/cfe/cfe/lib/lib_string2.c new file mode 100644 index 0000000..e42070a --- /dev/null +++ b/cfe/cfe/lib/lib_string2.c @@ -0,0 +1,96 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * More string routines File: lib_string2.c + * + * More routines to muck with strings; these routines typically + * need malloc to operate. This way lib_string.c can be incorporated + * into other programs that don't need malloc + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#include "lib_types.h" +#include "lib_malloc.h" +#define _LIB_NO_MACROS_ +#include "lib_string.h" + + +char *lib_strdup(char *str) +{ + char *buf; + + buf = KMALLOC(lib_strlen(str)+1,0); + if (buf) { + lib_strcpy(buf,str); + } + + return buf; +} + +void lib_trimleading(char *path) +{ + if (*path == '/') { + lib_strcpy(path, path+1); + } + + return; +} + +void lib_chop_filename(char *str,char **host,char **file) +{ + char *p; + + *host = str; + + p = lib_strchr(str,':'); + if (!p) p = lib_strchr(str,'/'); + + if (p) { + *p++ = '\0'; + *file = p; + } + else { + *file = NULL; + } +} + + diff --git a/cfe/cfe/lzma/LzmaDecode.c b/cfe/cfe/lzma/LzmaDecode.c new file mode 100755 index 0000000..cb83453 --- /dev/null +++ b/cfe/cfe/lzma/LzmaDecode.c @@ -0,0 +1,584 @@ +/* + LzmaDecode.c + LZMA Decoder (optimized for Speed version) + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this Code, expressly permits you to + statically or dynamically link your Code (or bind by name) to the + interfaces of this file without subjecting your linked Code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#include "LzmaDecode.h" + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_READ_BYTE (*Buffer++) + +#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ + { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} + +#ifdef _LZMA_IN_CB + +#define RC_TEST { if (Buffer == BufferLim) \ + { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ + BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} + +#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 + +#else + +#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } + +#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 + +#endif + +#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } + +#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) +#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; +#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; + +#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ + { UpdateBit0(p); mi <<= 1; A0; } else \ + { UpdateBit1(p); mi = (mi + mi) + 1; A1; } + +#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) + +#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ + { int i = numLevels; res = 1; \ + do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ + res -= (1 << numLevels); } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) +{ + unsigned char prop0; + if (size < LZMA_PROPERTIES_SIZE) + return LZMA_RESULT_DATA_ERROR; + prop0 = propsData[0]; + if (prop0 >= (9 * 5 * 5)) + return LZMA_RESULT_DATA_ERROR; + { + for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); + for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); + propsRes->lc = prop0; + /* + unsigned char remainder = (unsigned char)(prop0 / 9); + propsRes->lc = prop0 % 9; + propsRes->pb = remainder / 5; + propsRes->lp = remainder % 5; + */ + } + + #ifdef _LZMA_OUT_READ + { + int i; + propsRes->DictionarySize = 0; + for (i = 0; i < 4; i++) + propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); + if (propsRes->DictionarySize == 0) + propsRes->DictionarySize = 1; + } + #endif + return LZMA_RESULT_OK; +} + +#define kLzmaStreamWasFinishedId (-1) + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *InCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) +{ + CProb *p = vs->Probs; + SizeT nowPos = 0; + Byte previousByte = 0; + UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; + UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; + int lc = vs->Properties.lc; + + #ifdef _LZMA_OUT_READ + + UInt32 Range = vs->Range; + UInt32 Code = vs->Code; + #ifdef _LZMA_IN_CB + const Byte *Buffer = vs->Buffer; + const Byte *BufferLim = vs->BufferLim; + #else + const Byte *Buffer = inStream; + const Byte *BufferLim = inStream + inSize; + #endif + int state = vs->State; + UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; + int len = vs->RemainLen; + UInt32 globalPos = vs->GlobalPos; + UInt32 distanceLimit = vs->DistanceLimit; + + Byte *dictionary = vs->Dictionary; + UInt32 dictionarySize = vs->Properties.DictionarySize; + UInt32 dictionaryPos = vs->DictionaryPos; + + Byte tempDictionary[4]; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + if (len == kLzmaStreamWasFinishedId) + return LZMA_RESULT_OK; + + if (dictionarySize == 0) + { + dictionary = tempDictionary; + dictionarySize = 1; + tempDictionary[0] = vs->TempDictionary[0]; + } + + if (len == kLzmaNeedInitId) + { + { + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + UInt32 i; + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + rep0 = rep1 = rep2 = rep3 = 1; + state = 0; + globalPos = 0; + distanceLimit = 0; + dictionaryPos = 0; + dictionary[dictionarySize - 1] = 0; + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + } + len = 0; + } + while(len != 0 && nowPos < outSize) + { + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + len--; + } + if (dictionaryPos == 0) + previousByte = dictionary[dictionarySize - 1]; + else + previousByte = dictionary[dictionaryPos - 1]; + + #else /* if !_LZMA_OUT_READ */ + + int state = 0; + UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; + int len = 0; + const Byte *Buffer; + const Byte *BufferLim; + UInt32 Range; + UInt32 Code; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + + { + UInt32 i; + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + } + + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + + #endif /* _LZMA_OUT_READ */ + + while(nowPos < outSize) + { + CProb *prob; + UInt32 bound; + int posState = (int)( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & posStateMask); + + prob = p + IsMatch + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + int symbol = 1; + UpdateBit0(prob) + prob = p + Literal + (LZMA_LIT_SIZE * + ((( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & literalPosMask) << lc) + (previousByte >> (8 - lc)))); + + if (state >= kNumLitStates) + { + int matchByte; + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + matchByte = dictionary[pos]; + #else + matchByte = outStream[nowPos - rep0]; + #endif + do + { + int bit; + CProb *probLit; + matchByte <<= 1; + bit = (matchByte & 0x100); + probLit = prob + 0x100 + bit + symbol; + RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) + } + while (symbol < 0x100); + } + while (symbol < 0x100) + { + CProb *probLit = prob + symbol; + RC_GET_BIT(probLit, symbol) + } + previousByte = (Byte)symbol; + + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #endif + if (state < 4) state = 0; + else if (state < 10) state -= 3; + else state -= 6; + } + else + { + UpdateBit1(prob); + prob = p + IsRep + state; + IfBit0(prob) + { + UpdateBit0(prob); + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + state = state < kNumLitStates ? 0 : 3; + prob = p + LenCoder; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG0 + state; + IfBit0(prob) + { + UpdateBit0(prob); + prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + #ifdef _LZMA_OUT_READ + UInt32 pos; + #endif + UpdateBit0(prob); + + #ifdef _LZMA_OUT_READ + if (distanceLimit == 0) + #else + if (nowPos == 0) + #endif + return LZMA_RESULT_DATA_ERROR; + + state = state < kNumLitStates ? 9 : 11; + #ifdef _LZMA_OUT_READ + pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + #endif + + continue; + } + else + { + UpdateBit1(prob); + } + } + else + { + UInt32 distance; + UpdateBit1(prob); + prob = p + IsRepG1 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep1; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG2 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep2; + } + else + { + UpdateBit1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = p + RepLenCoder; + } + { + int numBits, offset; + CProb *probLen = prob + LenChoice; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + numBits = kLenNumLowBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenChoice2; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + numBits = kLenNumMidBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + numBits = kLenNumHighBits; + } + } + RangeDecoderBitTreeDecode(probLen, numBits, len); + len += offset; + } + + if (state < 4) + { + int posSlot; + state += kNumLitStates; + prob = p + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + rep0 = (2 | ((UInt32)posSlot & 1)); + if (posSlot < kEndPosModelIndex) + { + rep0 <<= numDirectBits; + prob = p + SpecPos + rep0 - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + RC_NORMALIZE + Range >>= 1; + rep0 <<= 1; + if (Code >= Range) + { + Code -= Range; + rep0 |= 1; + } + } + while (--numDirectBits != 0); + prob = p + Align; + rep0 <<= kNumAlignBits; + numDirectBits = kNumAlignBits; + } + { + int i = 1; + int mi = 1; + do + { + CProb *prob3 = prob + mi; + RC_GET_BIT2(prob3, mi, ; , rep0 |= i); + i <<= 1; + } + while(--numDirectBits != 0); + } + } + else + rep0 = posSlot; + if (++rep0 == (UInt32)(0)) + { + /* it's for stream version */ + len = kLzmaStreamWasFinishedId; + break; + } + } + + len += kMatchMinLen; + #ifdef _LZMA_OUT_READ + if (rep0 > distanceLimit) + #else + if (rep0 > nowPos) + #endif + return LZMA_RESULT_DATA_ERROR; + + #ifdef _LZMA_OUT_READ + if (dictionarySize - distanceLimit > (UInt32)len) + distanceLimit += len; + else + distanceLimit = dictionarySize; + #endif + + do + { + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + len--; + outStream[nowPos++] = previousByte; + } + while(len != 0 && nowPos < outSize); + } + } + RC_NORMALIZE; + + #ifdef _LZMA_OUT_READ + vs->Range = Range; + vs->Code = Code; + vs->DictionaryPos = dictionaryPos; + vs->GlobalPos = globalPos + (UInt32)nowPos; + vs->DistanceLimit = distanceLimit; + vs->Reps[0] = rep0; + vs->Reps[1] = rep1; + vs->Reps[2] = rep2; + vs->Reps[3] = rep3; + vs->State = state; + vs->RemainLen = len; + vs->TempDictionary[0] = tempDictionary[0]; + #endif + + #ifdef _LZMA_IN_CB + vs->Buffer = Buffer; + vs->BufferLim = BufferLim; + #else + *inSizeProcessed = (SizeT)(Buffer - inStream); + #endif + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} diff --git a/cfe/cfe/lzma/LzmaDecode.h b/cfe/cfe/lzma/LzmaDecode.h new file mode 100755 index 0000000..2870eeb --- /dev/null +++ b/cfe/cfe/lzma/LzmaDecode.h @@ -0,0 +1,113 @@ +/* + LzmaDecode.h + LZMA Decoder interface + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#ifndef __LZMADECODE_H +#define __LZMADECODE_H + +#include "LzmaTypes.h" + +/* #define _LZMA_IN_CB */ +/* Use callback for input data */ + +/* #define _LZMA_OUT_READ */ +/* Use read function for output data */ + +/* #define _LZMA_PROB32 */ +/* It can increase speed on some 32-bit CPUs, + but memory usage will be doubled in that case */ + +/* #define _LZMA_LOC_OPT */ +/* Enable local speed optimizations inside code */ + +#ifdef _LZMA_PROB32 +#define CProb UInt32 +#else +#define CProb UInt16 +#endif + +#define LZMA_RESULT_OK 0 +#define LZMA_RESULT_DATA_ERROR 1 + +#ifdef _LZMA_IN_CB +typedef struct _ILzmaInCallback +{ + int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); +} ILzmaInCallback; +#endif + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + +#define LZMA_PROPERTIES_SIZE 5 + +typedef struct _CLzmaProperties +{ + int lc; + int lp; + int pb; + #ifdef _LZMA_OUT_READ + UInt32 DictionarySize; + #endif +}CLzmaProperties; + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); + +#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) + +#define kLzmaNeedInitId (-2) + +typedef struct _CLzmaDecoderState +{ + CLzmaProperties Properties; + CProb *Probs; + + #ifdef _LZMA_IN_CB + const unsigned char *Buffer; + const unsigned char *BufferLim; + #endif + + #ifdef _LZMA_OUT_READ + unsigned char *Dictionary; + UInt32 Range; + UInt32 Code; + UInt32 DictionaryPos; + UInt32 GlobalPos; + UInt32 DistanceLimit; + UInt32 Reps[4]; + int State; + int RemainLen; + unsigned char TempDictionary[4]; + #endif +} CLzmaDecoderState; + +#ifdef _LZMA_OUT_READ +#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } +#endif + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *inCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); + +#endif diff --git a/cfe/cfe/lzma/LzmaDecodeSize.c b/cfe/cfe/lzma/LzmaDecodeSize.c new file mode 100755 index 0000000..a3a5eb9 --- /dev/null +++ b/cfe/cfe/lzma/LzmaDecodeSize.c @@ -0,0 +1,712 @@ +/* + LzmaDecodeSize.c + LZMA Decoder (optimized for Size version) + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#include "LzmaDecode.h" + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +typedef struct _CRangeDecoder +{ + const Byte *Buffer; + const Byte *BufferLim; + UInt32 Range; + UInt32 Code; + #ifdef _LZMA_IN_CB + ILzmaInCallback *InCallback; + int Result; + #endif + int ExtraBytes; +} CRangeDecoder; + +Byte RangeDecoderReadByte(CRangeDecoder *rd) +{ + if (rd->Buffer == rd->BufferLim) + { + #ifdef _LZMA_IN_CB + SizeT size; + rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size); + rd->BufferLim = rd->Buffer + size; + if (size == 0) + #endif + { + rd->ExtraBytes = 1; + return 0xFF; + } + } + return (*rd->Buffer++); +} + +/* #define ReadByte (*rd->Buffer++) */ +#define ReadByte (RangeDecoderReadByte(rd)) + +void RangeDecoderInit(CRangeDecoder *rd + #ifndef _LZMA_IN_CB + , const Byte *stream, SizeT bufferSize + #endif + ) +{ + int i; + #ifdef _LZMA_IN_CB + rd->Buffer = rd->BufferLim = 0; + #else + rd->Buffer = stream; + rd->BufferLim = stream + bufferSize; + #endif + rd->ExtraBytes = 0; + rd->Code = 0; + rd->Range = (0xFFFFFFFF); + for(i = 0; i < 5; i++) + rd->Code = (rd->Code << 8) | ReadByte; +} + +#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code; +#define RC_FLUSH_VAR rd->Range = range; rd->Code = code; +#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; } + +UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits) +{ + RC_INIT_VAR + UInt32 result = 0; + int i; + for (i = numTotalBits; i != 0; i--) + { + /* UInt32 t; */ + range >>= 1; + + result <<= 1; + if (code >= range) + { + code -= range; + result |= 1; + } + /* + t = (code - range) >> 31; + t &= 1; + code -= range & (t - 1); + result = (result + result) | (1 - t); + */ + RC_NORMALIZE + } + RC_FLUSH_VAR + return result; +} + +int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd) +{ + UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob; + if (rd->Code < bound) + { + rd->Range = bound; + *prob += (kBitModelTotal - *prob) >> kNumMoveBits; + if (rd->Range < kTopValue) + { + rd->Code = (rd->Code << 8) | ReadByte; + rd->Range <<= 8; + } + return 0; + } + else + { + rd->Range -= bound; + rd->Code -= bound; + *prob -= (*prob) >> kNumMoveBits; + if (rd->Range < kTopValue) + { + rd->Code = (rd->Code << 8) | ReadByte; + rd->Range <<= 8; + } + return 1; + } +} + +#define RC_GET_BIT2(prob, mi, A0, A1) \ + UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \ + if (code < bound) \ + { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \ + else \ + { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \ + RC_NORMALIZE + +#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;) + +int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) +{ + int mi = 1; + int i; + #ifdef _LZMA_LOC_OPT + RC_INIT_VAR + #endif + for(i = numLevels; i != 0; i--) + { + #ifdef _LZMA_LOC_OPT + CProb *prob = probs + mi; + RC_GET_BIT(prob, mi) + #else + mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd); + #endif + } + #ifdef _LZMA_LOC_OPT + RC_FLUSH_VAR + #endif + return mi - (1 << numLevels); +} + +int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) +{ + int mi = 1; + int i; + int symbol = 0; + #ifdef _LZMA_LOC_OPT + RC_INIT_VAR + #endif + for(i = 0; i < numLevels; i++) + { + #ifdef _LZMA_LOC_OPT + CProb *prob = probs + mi; + RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i)) + #else + int bit = RangeDecoderBitDecode(probs + mi, rd); + mi = mi + mi + bit; + symbol |= (bit << i); + #endif + } + #ifdef _LZMA_LOC_OPT + RC_FLUSH_VAR + #endif + return symbol; +} + +Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd) +{ + int symbol = 1; + #ifdef _LZMA_LOC_OPT + RC_INIT_VAR + #endif + do + { + #ifdef _LZMA_LOC_OPT + CProb *prob = probs + symbol; + RC_GET_BIT(prob, symbol) + #else + symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd); + #endif + } + while (symbol < 0x100); + #ifdef _LZMA_LOC_OPT + RC_FLUSH_VAR + #endif + return symbol; +} + +Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte) +{ + int symbol = 1; + #ifdef _LZMA_LOC_OPT + RC_INIT_VAR + #endif + do + { + int bit; + int matchBit = (matchByte >> 7) & 1; + matchByte <<= 1; + #ifdef _LZMA_LOC_OPT + { + CProb *prob = probs + 0x100 + (matchBit << 8) + symbol; + RC_GET_BIT2(prob, symbol, bit = 0, bit = 1) + } + #else + bit = RangeDecoderBitDecode(probs + 0x100 + (matchBit << 8) + symbol, rd); + symbol = (symbol << 1) | bit; + #endif + if (matchBit != bit) + { + while (symbol < 0x100) + { + #ifdef _LZMA_LOC_OPT + CProb *prob = probs + symbol; + RC_GET_BIT(prob, symbol) + #else + symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd); + #endif + } + break; + } + } + while (symbol < 0x100); + #ifdef _LZMA_LOC_OPT + RC_FLUSH_VAR + #endif + return symbol; +} + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + +int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState) +{ + if(RangeDecoderBitDecode(p + LenChoice, rd) == 0) + return RangeDecoderBitTreeDecode(p + LenLow + + (posState << kLenNumLowBits), kLenNumLowBits, rd); + if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0) + return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid + + (posState << kLenNumMidBits), kLenNumMidBits, rd); + return kLenNumLowSymbols + kLenNumMidSymbols + + RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd); +} + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) +{ + unsigned char prop0; + if (size < LZMA_PROPERTIES_SIZE) + return LZMA_RESULT_DATA_ERROR; + prop0 = propsData[0]; + if (prop0 >= (9 * 5 * 5)) + return LZMA_RESULT_DATA_ERROR; + { + for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); + for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); + propsRes->lc = prop0; + /* + unsigned char remainder = (unsigned char)(prop0 / 9); + propsRes->lc = prop0 % 9; + propsRes->pb = remainder / 5; + propsRes->lp = remainder % 5; + */ + } + + #ifdef _LZMA_OUT_READ + { + int i; + propsRes->DictionarySize = 0; + for (i = 0; i < 4; i++) + propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); + if (propsRes->DictionarySize == 0) + propsRes->DictionarySize = 1; + } + #endif + return LZMA_RESULT_OK; +} + +#define kLzmaStreamWasFinishedId (-1) + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *InCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) +{ + CProb *p = vs->Probs; + SizeT nowPos = 0; + Byte previousByte = 0; + UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; + UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; + int lc = vs->Properties.lc; + CRangeDecoder rd; + + #ifdef _LZMA_OUT_READ + + int state = vs->State; + UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; + int len = vs->RemainLen; + UInt32 globalPos = vs->GlobalPos; + UInt32 distanceLimit = vs->DistanceLimit; + + Byte *dictionary = vs->Dictionary; + UInt32 dictionarySize = vs->Properties.DictionarySize; + UInt32 dictionaryPos = vs->DictionaryPos; + + Byte tempDictionary[4]; + + rd.Range = vs->Range; + rd.Code = vs->Code; + #ifdef _LZMA_IN_CB + rd.InCallback = InCallback; + rd.Buffer = vs->Buffer; + rd.BufferLim = vs->BufferLim; + #else + rd.Buffer = inStream; + rd.BufferLim = inStream + inSize; + #endif + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + if (len == kLzmaStreamWasFinishedId) + return LZMA_RESULT_OK; + + if (dictionarySize == 0) + { + dictionary = tempDictionary; + dictionarySize = 1; + tempDictionary[0] = vs->TempDictionary[0]; + } + + if (len == kLzmaNeedInitId) + { + { + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + UInt32 i; + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + rep0 = rep1 = rep2 = rep3 = 1; + state = 0; + globalPos = 0; + distanceLimit = 0; + dictionaryPos = 0; + dictionary[dictionarySize - 1] = 0; + RangeDecoderInit(&rd + #ifndef _LZMA_IN_CB + , inStream, inSize + #endif + ); + #ifdef _LZMA_IN_CB + if (rd.Result != LZMA_RESULT_OK) + return rd.Result; + #endif + if (rd.ExtraBytes != 0) + return LZMA_RESULT_DATA_ERROR; + } + len = 0; + } + while(len != 0 && nowPos < outSize) + { + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + len--; + } + if (dictionaryPos == 0) + previousByte = dictionary[dictionarySize - 1]; + else + previousByte = dictionary[dictionaryPos - 1]; + + #ifdef _LZMA_IN_CB + rd.Result = LZMA_RESULT_OK; + #endif + rd.ExtraBytes = 0; + + #else /* if !_LZMA_OUT_READ */ + + int state = 0; + UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; + int len = 0; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + + { + UInt32 i; + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + } + + #ifdef _LZMA_IN_CB + rd.InCallback = InCallback; + #endif + RangeDecoderInit(&rd + #ifndef _LZMA_IN_CB + , inStream, inSize + #endif + ); + + #ifdef _LZMA_IN_CB + if (rd.Result != LZMA_RESULT_OK) + return rd.Result; + #endif + if (rd.ExtraBytes != 0) + return LZMA_RESULT_DATA_ERROR; + + #endif /* _LZMA_OUT_READ */ + + + while(nowPos < outSize) + { + int posState = (int)( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & posStateMask); + #ifdef _LZMA_IN_CB + if (rd.Result != LZMA_RESULT_OK) + return rd.Result; + #endif + if (rd.ExtraBytes != 0) + return LZMA_RESULT_DATA_ERROR; + if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0) + { + CProb *probs = p + Literal + (LZMA_LIT_SIZE * + ((( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & literalPosMask) << lc) + (previousByte >> (8 - lc)))); + + if (state >= kNumLitStates) + { + Byte matchByte; + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + matchByte = dictionary[pos]; + #else + matchByte = outStream[nowPos - rep0]; + #endif + previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte); + } + else + previousByte = LzmaLiteralDecode(probs, &rd); + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #endif + if (state < 4) state = 0; + else if (state < 10) state -= 3; + else state -= 6; + } + else + { + if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1) + { + if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0) + { + if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0) + { + #ifdef _LZMA_OUT_READ + UInt32 pos; + #endif + + #ifdef _LZMA_OUT_READ + if (distanceLimit == 0) + #else + if (nowPos == 0) + #endif + return LZMA_RESULT_DATA_ERROR; + + state = state < 7 ? 9 : 11; + #ifdef _LZMA_OUT_READ + pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + outStream[nowPos++] = previousByte; + + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + #endif + continue; + } + } + else + { + UInt32 distance; + if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0) + distance = rep1; + else + { + if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0) + distance = rep2; + else + { + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + len = LzmaLenDecode(p + RepLenCoder, &rd, posState); + state = state < 7 ? 8 : 11; + } + else + { + int posSlot; + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + state = state < 7 ? 7 : 10; + len = LzmaLenDecode(p + LenCoder, &rd, posState); + posSlot = RangeDecoderBitTreeDecode(p + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits), kNumPosSlotBits, &rd); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits); + if (posSlot < kEndPosModelIndex) + { + rep0 += RangeDecoderReverseBitTreeDecode( + p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd); + } + else + { + rep0 += RangeDecoderDecodeDirectBits(&rd, + numDirectBits - kNumAlignBits) << kNumAlignBits; + rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd); + } + } + else + rep0 = posSlot; + if (++rep0 == (UInt32)(0)) + { + /* it's for stream version */ + len = kLzmaStreamWasFinishedId; + break; + } + } + + len += kMatchMinLen; + #ifdef _LZMA_OUT_READ + if (rep0 > distanceLimit) + #else + if (rep0 > nowPos) + #endif + return LZMA_RESULT_DATA_ERROR; + + #ifdef _LZMA_OUT_READ + if (dictionarySize - distanceLimit > (UInt32)len) + distanceLimit += len; + else + distanceLimit = dictionarySize; + #endif + + do + { + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + len--; + outStream[nowPos++] = previousByte; + } + while(len != 0 && nowPos < outSize); + } + } + + + #ifdef _LZMA_OUT_READ + vs->Range = rd.Range; + vs->Code = rd.Code; + vs->DictionaryPos = dictionaryPos; + vs->GlobalPos = globalPos + (UInt32)nowPos; + vs->DistanceLimit = distanceLimit; + vs->Reps[0] = rep0; + vs->Reps[1] = rep1; + vs->Reps[2] = rep2; + vs->Reps[3] = rep3; + vs->State = state; + vs->RemainLen = len; + vs->TempDictionary[0] = tempDictionary[0]; + #endif + + #ifdef _LZMA_IN_CB + vs->Buffer = rd.Buffer; + vs->BufferLim = rd.BufferLim; + #else + *inSizeProcessed = (SizeT)(rd.Buffer - inStream); + #endif + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} diff --git a/cfe/cfe/lzma/LzmaStateDecode.c b/cfe/cfe/lzma/LzmaStateDecode.c new file mode 100755 index 0000000..e50f88b --- /dev/null +++ b/cfe/cfe/lzma/LzmaStateDecode.c @@ -0,0 +1,521 @@ +/* + LzmaStateDecode.c + LZMA Decoder (State version) + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this Code, expressly permits you to + statically or dynamically link your Code (or bind by name) to the + interfaces of this file without subjecting your linked Code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#include "LzmaStateDecode.h" + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_READ_BYTE (*Buffer++) + +#define RC_INIT Code = 0; Range = 0xFFFFFFFF; \ + { int i; for(i = 0; i < 5; i++) { Code = (Code << 8) | RC_READ_BYTE; }} + +#define RC_NORMALIZE if (Range < kTopValue) { Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } + +#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) +#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; +#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; + +#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ + { UpdateBit0(p); mi <<= 1; A0; } else \ + { UpdateBit1(p); mi = (mi + mi) + 1; A1; } + +#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) + +#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ + { int i = numLevels; res = 1; \ + do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ + res -= (1 << numLevels); } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +/* kRequiredInBufferSize = number of required input bytes for worst case: + longest match with longest distance. + kLzmaInBufferSize must be larger than kRequiredInBufferSize + 23 bits = 2 (match select) + 10 (len) + 6 (distance) + 4(align) + 1 (RC_NORMALIZE) +*/ + +#define kRequiredInBufferSize ((23 * (kNumBitModelTotalBits - kNumMoveBits + 1) + 26 + 9) / 8) + +#define kLzmaStreamWasFinishedId (-1) + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) +{ + unsigned char prop0; + if (size < LZMA_PROPERTIES_SIZE) + return LZMA_RESULT_DATA_ERROR; + prop0 = propsData[0]; + if (prop0 >= (9 * 5 * 5)) + return LZMA_RESULT_DATA_ERROR; + { + for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); + for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); + propsRes->lc = prop0; + /* + unsigned char remainder = (unsigned char)(prop0 / 9); + propsRes->lc = prop0 % 9; + propsRes->pb = remainder / 5; + propsRes->lp = remainder % 5; + */ + } + + { + int i; + propsRes->DictionarySize = 0; + for (i = 0; i < 4; i++) + propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); + if (propsRes->DictionarySize == 0) + propsRes->DictionarySize = 1; + return LZMA_RESULT_OK; + } +} + +int LzmaDecode( + CLzmaDecoderState *vs, + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed, + int finishDecoding) +{ + UInt32 Range = vs->Range; + UInt32 Code = vs->Code; + + unsigned char *Buffer = vs->Buffer; + int BufferSize = vs->BufferSize; /* don't change it to unsigned int */ + CProb *p = vs->Probs; + + int state = vs->State; + unsigned char previousByte; + UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; + SizeT nowPos = 0; + UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; + UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; + int lc = vs->Properties.lc; + int len = vs->RemainLen; + UInt32 globalPos = vs->GlobalPos; + UInt32 distanceLimit = vs->DistanceLimit; + + unsigned char *dictionary = vs->Dictionary; + UInt32 dictionarySize = vs->Properties.DictionarySize; + UInt32 dictionaryPos = vs->DictionaryPos; + + unsigned char tempDictionary[4]; + + (*inSizeProcessed) = 0; + (*outSizeProcessed) = 0; + if (len == kLzmaStreamWasFinishedId) + return LZMA_RESULT_OK; + + if (dictionarySize == 0) + { + dictionary = tempDictionary; + dictionarySize = 1; + tempDictionary[0] = vs->TempDictionary[0]; + } + + if (len == kLzmaNeedInitId) + { + while (inSize > 0 && BufferSize < kLzmaInBufferSize) + { + Buffer[BufferSize++] = *inStream++; + (*inSizeProcessed)++; + inSize--; + } + if (BufferSize < 5) + { + vs->BufferSize = BufferSize; + return finishDecoding ? LZMA_RESULT_DATA_ERROR : LZMA_RESULT_OK; + } + { + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + UInt32 i; + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + rep0 = rep1 = rep2 = rep3 = 1; + state = 0; + globalPos = 0; + distanceLimit = 0; + dictionaryPos = 0; + dictionary[dictionarySize - 1] = 0; + RC_INIT; + } + len = 0; + } + while(len != 0 && nowPos < outSize) + { + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + len--; + } + if (dictionaryPos == 0) + previousByte = dictionary[dictionarySize - 1]; + else + previousByte = dictionary[dictionaryPos - 1]; + + while(1) + { + int bufferPos = (int)(Buffer - vs->Buffer); + if (BufferSize - bufferPos < kRequiredInBufferSize) + { + int i; + BufferSize -= bufferPos; + if (BufferSize < 0) + return LZMA_RESULT_DATA_ERROR; + for (i = 0; i < BufferSize; i++) + vs->Buffer[i] = Buffer[i]; + Buffer = vs->Buffer; + while (inSize > 0 && BufferSize < kLzmaInBufferSize) + { + Buffer[BufferSize++] = *inStream++; + (*inSizeProcessed)++; + inSize--; + } + if (BufferSize < kRequiredInBufferSize && !finishDecoding) + break; + } + if (nowPos >= outSize) + break; + { + CProb *prob; + UInt32 bound; + int posState = (int)((nowPos + globalPos) & posStateMask); + + prob = p + IsMatch + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + int symbol = 1; + UpdateBit0(prob) + prob = p + Literal + (LZMA_LIT_SIZE * + ((((nowPos + globalPos)& literalPosMask) << lc) + (previousByte >> (8 - lc)))); + + if (state >= kNumLitStates) + { + int matchByte; + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + matchByte = dictionary[pos]; + do + { + int bit; + CProb *probLit; + matchByte <<= 1; + bit = (matchByte & 0x100); + probLit = prob + 0x100 + bit + symbol; + RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) + } + while (symbol < 0x100); + } + while (symbol < 0x100) + { + CProb *probLit = prob + symbol; + RC_GET_BIT(probLit, symbol) + } + previousByte = (unsigned char)symbol; + + outStream[nowPos++] = previousByte; + if (distanceLimit < dictionarySize) + distanceLimit++; + + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + if (state < 4) state = 0; + else if (state < 10) state -= 3; + else state -= 6; + } + else + { + UpdateBit1(prob); + prob = p + IsRep + state; + IfBit0(prob) + { + UpdateBit0(prob); + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + state = state < kNumLitStates ? 0 : 3; + prob = p + LenCoder; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG0 + state; + IfBit0(prob) + { + UpdateBit0(prob); + prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + UInt32 pos; + UpdateBit0(prob); + if (distanceLimit == 0) + return LZMA_RESULT_DATA_ERROR; + if (distanceLimit < dictionarySize) + distanceLimit++; + state = state < kNumLitStates ? 9 : 11; + pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + outStream[nowPos++] = previousByte; + continue; + } + else + { + UpdateBit1(prob); + } + } + else + { + UInt32 distance; + UpdateBit1(prob); + prob = p + IsRepG1 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep1; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG2 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep2; + } + else + { + UpdateBit1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = p + RepLenCoder; + } + { + int numBits, offset; + CProb *probLen = prob + LenChoice; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + numBits = kLenNumLowBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenChoice2; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + numBits = kLenNumMidBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + numBits = kLenNumHighBits; + } + } + RangeDecoderBitTreeDecode(probLen, numBits, len); + len += offset; + } + + if (state < 4) + { + int posSlot; + state += kNumLitStates; + prob = p + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + rep0 = (2 | ((UInt32)posSlot & 1)); + if (posSlot < kEndPosModelIndex) + { + rep0 <<= numDirectBits; + prob = p + SpecPos + rep0 - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + RC_NORMALIZE + Range >>= 1; + rep0 <<= 1; + if (Code >= Range) + { + Code -= Range; + rep0 |= 1; + } + } + while (--numDirectBits != 0); + prob = p + Align; + rep0 <<= kNumAlignBits; + numDirectBits = kNumAlignBits; + } + { + int i = 1; + int mi = 1; + do + { + CProb *prob3 = prob + mi; + RC_GET_BIT2(prob3, mi, ; , rep0 |= i); + i <<= 1; + } + while(--numDirectBits != 0); + } + } + else + rep0 = posSlot; + if (++rep0 == (UInt32)(0)) + { + /* it's for stream version */ + len = kLzmaStreamWasFinishedId; + break; + } + } + + len += kMatchMinLen; + if (rep0 > distanceLimit) + return LZMA_RESULT_DATA_ERROR; + if (dictionarySize - distanceLimit > (UInt32)len) + distanceLimit += len; + else + distanceLimit = dictionarySize; + + do + { + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + len--; + outStream[nowPos++] = previousByte; + } + while(len != 0 && nowPos < outSize); + } + } + } + RC_NORMALIZE; + + BufferSize -= (int)(Buffer - vs->Buffer); + if (BufferSize < 0) + return LZMA_RESULT_DATA_ERROR; + { + int i; + for (i = 0; i < BufferSize; i++) + vs->Buffer[i] = Buffer[i]; + } + vs->BufferSize = BufferSize; + vs->Range = Range; + vs->Code = Code; + vs->DictionaryPos = dictionaryPos; + vs->GlobalPos = (UInt32)(globalPos + nowPos); + vs->DistanceLimit = distanceLimit; + vs->Reps[0] = rep0; + vs->Reps[1] = rep1; + vs->Reps[2] = rep2; + vs->Reps[3] = rep3; + vs->State = state; + vs->RemainLen = len; + vs->TempDictionary[0] = tempDictionary[0]; + + (*outSizeProcessed) = nowPos; + return LZMA_RESULT_OK; +} diff --git a/cfe/cfe/lzma/LzmaStateDecode.h b/cfe/cfe/lzma/LzmaStateDecode.h new file mode 100755 index 0000000..26490d6 --- /dev/null +++ b/cfe/cfe/lzma/LzmaStateDecode.h @@ -0,0 +1,96 @@ +/* + LzmaStateDecode.h + LZMA Decoder interface (State version) + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#ifndef __LZMASTATEDECODE_H +#define __LZMASTATEDECODE_H + +#include "LzmaTypes.h" + +/* #define _LZMA_PROB32 */ +/* It can increase speed on some 32-bit CPUs, + but memory usage will be doubled in that case */ + +#ifdef _LZMA_PROB32 +#define CProb UInt32 +#else +#define CProb UInt16 +#endif + +#define LZMA_RESULT_OK 0 +#define LZMA_RESULT_DATA_ERROR 1 + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + +#define LZMA_PROPERTIES_SIZE 5 + +typedef struct _CLzmaProperties +{ + int lc; + int lp; + int pb; + UInt32 DictionarySize; +}CLzmaProperties; + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); + +#define LzmaGetNumProbs(lzmaProps) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((lzmaProps)->lc + (lzmaProps)->lp))) + +#define kLzmaInBufferSize 64 /* don't change it. it must be larger than kRequiredInBufferSize */ + +#define kLzmaNeedInitId (-2) + +typedef struct _CLzmaDecoderState +{ + CLzmaProperties Properties; + CProb *Probs; + unsigned char *Dictionary; + + unsigned char Buffer[kLzmaInBufferSize]; + int BufferSize; + + UInt32 Range; + UInt32 Code; + UInt32 DictionaryPos; + UInt32 GlobalPos; + UInt32 DistanceLimit; + UInt32 Reps[4]; + int State; + int RemainLen; /* -2: decoder needs internal initialization + -1: stream was finished, + 0: ok + > 0: need to write RemainLen bytes as match Reps[0], + */ + unsigned char TempDictionary[4]; /* it's required when DictionarySize = 0 */ +} CLzmaDecoderState; + +#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; (vs)->BufferSize = 0; } + +/* LzmaDecode: decoding from input stream to output stream. + If finishDecoding != 0, then there are no more bytes in input stream + after inStream[inSize - 1]. */ + +int LzmaDecode(CLzmaDecoderState *vs, + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed, + int finishDecoding); + +#endif diff --git a/cfe/cfe/lzma/LzmaStateTest.c b/cfe/cfe/lzma/LzmaStateTest.c new file mode 100755 index 0000000..5df4e43 --- /dev/null +++ b/cfe/cfe/lzma/LzmaStateTest.c @@ -0,0 +1,195 @@ +/* +LzmaStateTest.c +Test application for LZMA Decoder (State version) + +This file written and distributed to public domain by Igor Pavlov. +This file is part of LZMA SDK 4.26 (2005-08-02) +*/ + +#include +#include +#include + +#include "LzmaStateDecode.h" + +const char *kCantReadMessage = "Can not read input file"; +const char *kCantWriteMessage = "Can not write output file"; +const char *kCantAllocateMessage = "Can not allocate memory"; + +#define kInBufferSize (1 << 15) +#define kOutBufferSize (1 << 15) + +unsigned char g_InBuffer[kInBufferSize]; +unsigned char g_OutBuffer[kOutBufferSize]; + +size_t MyReadFile(FILE *file, void *data, size_t size) + { return fread(data, 1, size, file); } + +int MyReadFileAndCheck(FILE *file, void *data, size_t size) + { return (MyReadFile(file, data, size) == size); } + +int PrintError(char *buffer, const char *message) +{ + sprintf(buffer + strlen(buffer), "\nError: "); + sprintf(buffer + strlen(buffer), message); + return 1; +} + +int main3(FILE *inFile, FILE *outFile, char *rs) +{ + /* We use two 32-bit integers to construct 64-bit integer for file size. + You can remove outSizeHigh, if you don't need >= 4GB supporting, + or you can use UInt64 outSize, if your compiler supports 64-bit integers*/ + UInt32 outSize = 0; + UInt32 outSizeHigh = 0; + + int waitEOS = 1; + /* waitEOS = 1, if there is no uncompressed size in headers, + so decoder will wait EOS (End of Stream Marker) in compressed stream */ + + int i; + int res = 0; + CLzmaDecoderState state; /* it's about 140 bytes structure, if int is 32-bit */ + unsigned char properties[LZMA_PROPERTIES_SIZE]; + SizeT inAvail = 0; + unsigned char *inBuffer = 0; + + if (sizeof(UInt32) < 4) + return PrintError(rs, "LZMA decoder needs correct UInt32"); + + /* Read LZMA properties for compressed stream */ + + if (!MyReadFileAndCheck(inFile, properties, sizeof(properties))) + return PrintError(rs, kCantReadMessage); + + /* Read uncompressed size */ + + for (i = 0; i < 8; i++) + { + unsigned char b; + if (!MyReadFileAndCheck(inFile, &b, 1)) + return PrintError(rs, kCantReadMessage); + if (b != 0xFF) + waitEOS = 0; + if (i < 4) + outSize += (UInt32)(b) << (i * 8); + else + outSizeHigh += (UInt32)(b) << ((i - 4) * 8); + } + + /* Decode LZMA properties and allocate memory */ + + if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) + return PrintError(rs, "Incorrect stream properties"); + state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb)); + if (state.Probs == 0) + return PrintError(rs, kCantAllocateMessage); + + if (state.Properties.DictionarySize == 0) + state.Dictionary = 0; + else + { + state.Dictionary = (unsigned char *)malloc(state.Properties.DictionarySize); + if (state.Dictionary == 0) + { + free(state.Probs); + return PrintError(rs, kCantAllocateMessage); + } + } + + /* Decompress */ + + LzmaDecoderInit(&state); + + do + { + SizeT inProcessed, outProcessed; + int finishDecoding; + UInt32 outAvail = kOutBufferSize; + if (!waitEOS && outSizeHigh == 0 && outAvail > outSize) + outAvail = outSize; + if (inAvail == 0) + { + inAvail = (SizeT)MyReadFile(inFile, g_InBuffer, kInBufferSize); + inBuffer = g_InBuffer; + } + finishDecoding = (inAvail == 0); + res = LzmaDecode(&state, + inBuffer, inAvail, &inProcessed, + g_OutBuffer, outAvail, &outProcessed, + finishDecoding); + if (res != 0) + { + sprintf(rs + strlen(rs), "\nDecoding error = %d\n", res); + res = 1; + break; + } + inAvail -= inProcessed; + inBuffer += inProcessed; + + if (outFile != 0) + if (fwrite(g_OutBuffer, 1, outProcessed, outFile) != outProcessed) + { + PrintError(rs, kCantWriteMessage); + res = 1; + break; + } + + if (outSize < outProcessed) + outSizeHigh--; + outSize -= (UInt32)outProcessed; + outSize &= 0xFFFFFFFF; + + if (outProcessed == 0 && finishDecoding) + { + if (!waitEOS && (outSize != 0 || outSizeHigh != 0)) + res = 1; + break; + } + } + while ((outSize != 0 && outSizeHigh == 0) || outSizeHigh != 0 || waitEOS); + + free(state.Dictionary); + free(state.Probs); + return res; +} + +int main2(int numArgs, const char *args[], char *rs) +{ + FILE *inFile = 0; + FILE *outFile = 0; + int res; + + sprintf(rs + strlen(rs), "\nLZMA Decoder 4.26 Copyright (c) 1999-2005 Igor Pavlov 2005-08-02\n"); + if (numArgs < 2 || numArgs > 3) + { + sprintf(rs + strlen(rs), "\nUsage: lzmadec file.lzma [outFile]\n"); + return 1; + } + + inFile = fopen(args[1], "rb"); + if (inFile == 0) + return PrintError(rs, "Can not open input file"); + + if (numArgs > 2) + { + outFile = fopen(args[2], "wb+"); + if (outFile == 0) + return PrintError(rs, "Can not open output file"); + } + + res = main3(inFile, outFile, rs); + + if (outFile != 0) + fclose(outFile); + fclose(inFile); + return res; +} + +int main(int numArgs, const char *args[]) +{ + char rs[800] = { 0 }; + int res = main2(numArgs, args, rs); + printf(rs); + return res; +} diff --git a/cfe/cfe/lzma/LzmaTest.c b/cfe/cfe/lzma/LzmaTest.c new file mode 100755 index 0000000..f95a753 --- /dev/null +++ b/cfe/cfe/lzma/LzmaTest.c @@ -0,0 +1,342 @@ +/* +LzmaTest.c +Test application for LZMA Decoder + +This file written and distributed to public domain by Igor Pavlov. +This file is part of LZMA SDK 4.26 (2005-08-05) +*/ + +#include +#include +#include + +#include "LzmaDecode.h" + +const char *kCantReadMessage = "Can not read input file"; +const char *kCantWriteMessage = "Can not write output file"; +const char *kCantAllocateMessage = "Can not allocate memory"; + +size_t MyReadFile(FILE *file, void *data, size_t size) +{ + if (size == 0) + return 0; + return fread(data, 1, size, file); +} + +int MyReadFileAndCheck(FILE *file, void *data, size_t size) + { return (MyReadFile(file, data, size) == size);} + +size_t MyWriteFile(FILE *file, const void *data, size_t size) +{ + if (size == 0) + return 0; + return fwrite(data, 1, size, file); +} + +int MyWriteFileAndCheck(FILE *file, const void *data, size_t size) + { return (MyWriteFile(file, data, size) == size); } + +#ifdef _LZMA_IN_CB +#define kInBufferSize (1 << 15) +typedef struct _CBuffer +{ + ILzmaInCallback InCallback; + FILE *File; + unsigned char Buffer[kInBufferSize]; +} CBuffer; + +int LzmaReadCompressed(void *object, const unsigned char **buffer, SizeT *size) +{ + CBuffer *b = (CBuffer *)object; + *buffer = b->Buffer; + *size = (SizeT)MyReadFile(b->File, b->Buffer, kInBufferSize); + return LZMA_RESULT_OK; +} +CBuffer g_InBuffer; + +#endif + +#ifdef _LZMA_OUT_READ +#define kOutBufferSize (1 << 15) +unsigned char g_OutBuffer[kOutBufferSize]; +#endif + +int PrintError(char *buffer, const char *message) +{ + sprintf(buffer + strlen(buffer), "\nError: "); + sprintf(buffer + strlen(buffer), message); + return 1; +} + +int main3(FILE *inFile, FILE *outFile, char *rs) +{ + /* We use two 32-bit integers to construct 64-bit integer for file size. + You can remove outSizeHigh, if you don't need >= 4GB supporting, + or you can use UInt64 outSize, if your compiler supports 64-bit integers*/ + UInt32 outSize = 0; + UInt32 outSizeHigh = 0; + #ifndef _LZMA_OUT_READ + SizeT outSizeFull; + unsigned char *outStream; + #endif + + int waitEOS = 1; + /* waitEOS = 1, if there is no uncompressed size in headers, + so decoder will wait EOS (End of Stream Marker) in compressed stream */ + + #ifndef _LZMA_IN_CB + SizeT compressedSize; + unsigned char *inStream; + #endif + + CLzmaDecoderState state; /* it's about 24-80 bytes structure, if int is 32-bit */ + unsigned char properties[LZMA_PROPERTIES_SIZE]; + + int res; + + #ifdef _LZMA_IN_CB + g_InBuffer.File = inFile; + #endif + + if (sizeof(UInt32) < 4) + return PrintError(rs, "LZMA decoder needs correct UInt32"); + + #ifndef _LZMA_IN_CB + { + long length; + fseek(inFile, 0, SEEK_END); + length = ftell(inFile); + fseek(inFile, 0, SEEK_SET); + if ((long)(SizeT)length != length) + return PrintError(rs, "Too big compressed stream"); + compressedSize = (SizeT)(length - (LZMA_PROPERTIES_SIZE + 8)); + } + #endif + + /* Read LZMA properties for compressed stream */ + + if (!MyReadFileAndCheck(inFile, properties, sizeof(properties))) + return PrintError(rs, kCantReadMessage); + + /* Read uncompressed size */ + + { + int i; + for (i = 0; i < 8; i++) + { + unsigned char b; + if (!MyReadFileAndCheck(inFile, &b, 1)) + return PrintError(rs, kCantReadMessage); + if (b != 0xFF) + waitEOS = 0; + if (i < 4) + outSize += (UInt32)(b) << (i * 8); + else + outSizeHigh += (UInt32)(b) << ((i - 4) * 8); + } + + #ifndef _LZMA_OUT_READ + if (waitEOS) + return PrintError(rs, "Stream with EOS marker is not supported"); + outSizeFull = (SizeT)outSize; + if (sizeof(SizeT) >= 8) + outSizeFull |= (((SizeT)outSizeHigh << 16) << 16); + else if (outSizeHigh != 0 || (UInt32)(SizeT)outSize != outSize) + return PrintError(rs, "Too big uncompressed stream"); + #endif + } + + /* Decode LZMA properties and allocate memory */ + + if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) + return PrintError(rs, "Incorrect stream properties"); + state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb)); + + #ifdef _LZMA_OUT_READ + if (state.Properties.DictionarySize == 0) + state.Dictionary = 0; + else + state.Dictionary = (unsigned char *)malloc(state.Properties.DictionarySize); + #else + if (outSizeFull == 0) + outStream = 0; + else + outStream = (unsigned char *)malloc(outSizeFull); + #endif + + #ifndef _LZMA_IN_CB + if (compressedSize == 0) + inStream = 0; + else + inStream = (unsigned char *)malloc(compressedSize); + #endif + + if (state.Probs == 0 + #ifdef _LZMA_OUT_READ + || (state.Dictionary == 0 && state.Properties.DictionarySize != 0) + #else + || (outStream == 0 && outSizeFull != 0) + #endif + #ifndef _LZMA_IN_CB + || (inStream == 0 && compressedSize != 0) + #endif + ) + { + free(state.Probs); + #ifdef _LZMA_OUT_READ + free(state.Dictionary); + #else + free(outStream); + #endif + #ifndef _LZMA_IN_CB + free(inStream); + #endif + return PrintError(rs, kCantAllocateMessage); + } + + /* Decompress */ + + #ifdef _LZMA_IN_CB + g_InBuffer.InCallback.Read = LzmaReadCompressed; + #else + if (!MyReadFileAndCheck(inFile, inStream, compressedSize)) + return PrintError(rs, kCantReadMessage); + #endif + + #ifdef _LZMA_OUT_READ + { + #ifndef _LZMA_IN_CB + SizeT inAvail = compressedSize; + const unsigned char *inBuffer = inStream; + #endif + LzmaDecoderInit(&state); + do + { + #ifndef _LZMA_IN_CB + SizeT inProcessed; + #endif + SizeT outProcessed; + SizeT outAvail = kOutBufferSize; + if (!waitEOS && outSizeHigh == 0 && outAvail > outSize) + outAvail = (SizeT)outSize; + res = LzmaDecode(&state, + #ifdef _LZMA_IN_CB + &g_InBuffer.InCallback, + #else + inBuffer, inAvail, &inProcessed, + #endif + g_OutBuffer, outAvail, &outProcessed); + if (res != 0) + { + sprintf(rs + strlen(rs), "\nDecoding error = %d\n", res); + res = 1; + break; + } + #ifndef _LZMA_IN_CB + inAvail -= inProcessed; + inBuffer += inProcessed; + #endif + + if (outFile != 0) + if (!MyWriteFileAndCheck(outFile, g_OutBuffer, (size_t)outProcessed)) + { + PrintError(rs, kCantWriteMessage); + res = 1; + break; + } + + if (outSize < outProcessed) + outSizeHigh--; + outSize -= (UInt32)outProcessed; + outSize &= 0xFFFFFFFF; + + if (outProcessed == 0) + { + if (!waitEOS && (outSize != 0 || outSizeHigh != 0)) + res = 1; + break; + } + } + while ((outSize != 0 && outSizeHigh == 0) || outSizeHigh != 0 || waitEOS); + } + + #else + { + #ifndef _LZMA_IN_CB + SizeT inProcessed; + #endif + SizeT outProcessed; + res = LzmaDecode(&state, + #ifdef _LZMA_IN_CB + &g_InBuffer.InCallback, + #else + inStream, compressedSize, &inProcessed, + #endif + outStream, outSizeFull, &outProcessed); + if (res != 0) + { + sprintf(rs + strlen(rs), "\nDecoding error = %d\n", res); + res = 1; + } + else if (outFile != 0) + { + if (!MyWriteFileAndCheck(outFile, outStream, (size_t)outProcessed)) + { + PrintError(rs, kCantWriteMessage); + res = 1; + } + } + } + #endif + + free(state.Probs); + #ifdef _LZMA_OUT_READ + free(state.Dictionary); + #else + free(outStream); + #endif + #ifndef _LZMA_IN_CB + free(inStream); + #endif + return res; +} + +int main2(int numArgs, const char *args[], char *rs) +{ + FILE *inFile = 0; + FILE *outFile = 0; + int res; + + sprintf(rs + strlen(rs), "\nLZMA Decoder 4.26 Copyright (c) 1999-2005 Igor Pavlov 2005-08-05\n"); + if (numArgs < 2 || numArgs > 3) + { + sprintf(rs + strlen(rs), "\nUsage: lzmadec file.lzma [outFile]\n"); + return 1; + } + + inFile = fopen(args[1], "rb"); + if (inFile == 0) + return PrintError(rs, "Can not open input file"); + + if (numArgs > 2) + { + outFile = fopen(args[2], "wb+"); + if (outFile == 0) + return PrintError(rs, "Can not open output file"); + } + + res = main3(inFile, outFile, rs); + + if (outFile != 0) + fclose(outFile); + fclose(inFile); + return res; +} + +int main(int numArgs, const char *args[]) +{ + char rs[800] = { 0 }; + int res = main2(numArgs, args, rs); + printf(rs); + return res; +} diff --git a/cfe/cfe/lzma/LzmaTypes.h b/cfe/cfe/lzma/LzmaTypes.h new file mode 100755 index 0000000..288c5e4 --- /dev/null +++ b/cfe/cfe/lzma/LzmaTypes.h @@ -0,0 +1,45 @@ +/* +LzmaTypes.h + +Types for LZMA Decoder + +This file written and distributed to public domain by Igor Pavlov. +This file is part of LZMA SDK 4.40 (2006-05-01) +*/ + +#ifndef __LZMATYPES_H +#define __LZMATYPES_H + +#ifndef _7ZIP_BYTE_DEFINED +#define _7ZIP_BYTE_DEFINED +typedef unsigned char Byte; +#endif + +#ifndef _7ZIP_UINT16_DEFINED +#define _7ZIP_UINT16_DEFINED +typedef unsigned short UInt16; +#endif + +#ifndef _7ZIP_UINT32_DEFINED +#define _7ZIP_UINT32_DEFINED +#ifdef _LZMA_UINT32_IS_ULONG +typedef unsigned long UInt32; +#else +typedef unsigned int UInt32; +#endif +#endif + +/* #define _LZMA_SYSTEM_SIZE_T */ +/* Use system's size_t. You can use it to enable 64-bit sizes supporting */ + +#ifndef _7ZIP_SIZET_DEFINED +#define _7ZIP_SIZET_DEFINED +#ifdef _LZMA_SYSTEM_SIZE_T +#include +typedef size_t SizeT; +#else +typedef UInt32 SizeT; +#endif +#endif + +#endif diff --git a/cfe/cfe/lzma/Makefile b/cfe/cfe/lzma/Makefile new file mode 100755 index 0000000..3611459 --- /dev/null +++ b/cfe/cfe/lzma/Makefile @@ -0,0 +1,5 @@ + +BSPOBJS += \ + dcapi.o \ + LzmaDecode.o + diff --git a/cfe/cfe/lzma/dcapi.c b/cfe/cfe/lzma/dcapi.c new file mode 100755 index 0000000..b8f59b0 --- /dev/null +++ b/cfe/cfe/lzma/dcapi.c @@ -0,0 +1,50 @@ +#include "LzmaDecode.h" +#include "bcm63xx_util.h" +#include "lib_malloc.h" + +#define LZMA_ORIGSIZE_SIZE 8 + +int decompressLZMA(unsigned char *in, unsigned insize, unsigned char *out, unsigned outsize); + +// Call ANSI C LZMA decoder to decompress a LZMA block +int decompressLZMA(unsigned char *in, unsigned insize, unsigned char *out, unsigned outsize) +{ + + SizeT inProcessed, outProcessed; + unsigned origsize; + int ret; + CLzmaDecoderState state; + + ret = LzmaDecodeProperties(&state.Properties, in, LZMA_PROPERTIES_SIZE); + if (ret != LZMA_RESULT_OK) { + return ret; + } + in += LZMA_PROPERTIES_SIZE; + + state.Probs = (CProb *)KMALLOC(LzmaGetNumProbs(&state.Properties) * sizeof(CProb), 0); + if (!state.Probs) { + return 1001; + } + + if (in[4]==0 && in[5]==0 && in[6]==0 && in[7]==0) { // uncompressed size < 4GB (should be) + origsize = in[0] | (in[1] << 8) | (in[2] << 16) | (in[3] << 24); + in += LZMA_ORIGSIZE_SIZE; + if (origsize <= outsize) { + ret = LzmaDecode(&state, in, insize, &inProcessed, out, origsize, &outProcessed); + } + else { + // output buffer too small + ret = 1000; + } + } + else { // uncompressed size > 4GB, old lzma format or corrupted image, assume old format here + printf("LZMA: Prossible old LZMA format, trying to decompress..\n"); + LzmaDecode(&state, in, insize, &inProcessed, out, outsize, &outProcessed); + ret = 0; // It would return an error code as the output buffer size doesn't match. We need to ignore the code. + } + + KFREE(state.Probs); + + return ret; +} + diff --git a/cfe/cfe/main/cfe.mk b/cfe/cfe/main/cfe.mk new file mode 100644 index 0000000..05b16b6 --- /dev/null +++ b/cfe/cfe/main/cfe.mk @@ -0,0 +1,301 @@ + +# +# CFE's version number +# + +include ${TOP}/main/cfe_version.mk + +# +# Default values for certain parameters +# + +CFG_MLONG64 ?= 0 +CFG_LITTLE ?= 0 +CFG_RELOC ?= 0 +CFG_UNCACHED ?= 0 +CFG_NEWRELOC ?= 0 +CFG_BOOTRAM ?= 0 +CFG_VGACONSOLE ?= 0 +CFG_PCI ?= 1 +CFG_LDT_REV_017 ?= 0 +CFG_ZLIB ?= 0 +CFG_BIENDIAN ?= 0 +CFG_DOWNLOAD ?= 0 +CFG_RAMAPP ?= 0 +CFG_USB ?= 0 + +# +# Paths to other parts of the firmware. Everything's relative to ${TOP} +# so that you can actually do a build anywhere you want. +# + +ARCH_TOP = ${TOP}/arch/${ARCH} +ARCH_SRC = ${ARCH_TOP}/common/src +ARCH_INC = ${ARCH_TOP}/common/include +CPU_SRC = ${ARCH_TOP}/cpu/${CPU}/src +CPU_INC = ${ARCH_TOP}/cpu/${CPU}/include + +# +# It's actually optional to have a 'board' +# directory. If you don't specify BOARD, +# don't include the files. +# + +ifneq ("$(strip ${BOARD})","") +BOARD_SRC = ${ARCH_TOP}/board/${BOARD}/src +BOARD_INC = ${ARCH_TOP}/board/${BOARD}/include +endif + +# +# Preprocessor defines for CFE's version number +# + +VDEF = -DCFE_VER_MAJ=${CFE_VER_MAJ} -DCFE_VER_MIN=${CFE_VER_MIN} -DCFE_VER_ECO=${CFE_VER_ECO} + +# +# Construct the list of paths that will eventually become the include +# paths and VPATH +# + +SRCDIRS = ${ARCH_SRC} ${CPU_SRC} ${BOARD_SRC} ${TOP}/main ${TOP}/vendor ${TOP}/include ${TOP}/net ${TOP}/dev ${TOP}/pci ${TOP}/ui ${TOP}/lib ${TOP}/common ${TOP}/verif + +CFE_INC = ${TOP}/include ${TOP}/pci ${TOP}/net + +ifeq ($(strip ${CFG_VGACONSOLE}),1) +SRCDIRS += ${TOP}/x86emu ${TOP}/pccons +CFE_INC += ${TOP}/x86emu ${TOP}/pccons +endif + +ifeq ($(strip ${CFG_VAPI}),1) +SRCDIRS += ${TOP}/verif +CFE_INC += ${TOP}/verif +endif + +ifeq ($(strip ${CFG_ZLIB}),1) +SRCDIRS += ${TOP}/zlib +CFE_INC += ${TOP}/zlib +endif + + +INCDIRS = $(patsubst %,-I%,$(subst :, ,$(ARCH_INC) $(CPU_INC) $(BOARD_INC) $(CFE_INC))) + +VPATH = $(SRCDIRS) + +# +# Bi-endian support: If we're building the little-endian +# version, use a different linker script so we can locate the +# ROM at a higher address. You'd think we could do this with +# normal linker command line switches, but there appears to be no +# command-line way to override the 'AT' qualifier in the linker script. +# + +CFG_TEXTAT1MB=0 +ifeq ($(strip ${CFG_BIENDIAN}),1) + ifeq ($(strip ${CFG_LITTLE}),1) + CFG_TEXTAT1MB=1 + endif +endif + + +# +# Configure tools and basic tools flags. This include sets up +# macros for calling the C compiler, basic flags, +# and linker scripts. +# + +include ${ARCH_SRC}/tools.mk + +# +# Add some common flags that are used on any architecture. +# + +CFLAGS += -I. $(INCDIRS) +CFLAGS += -D_CFE_ ${VDEF} -DCFG_BOARDNAME=\"${CFG_BOARDNAME}\" + +# +# Gross - allow more options to be supplied from command line +# + +ifdef CFG_OPTIONS +OPTFLAGS = $(patsubst %,-D%,$(subst :, ,$(CFG_OPTIONS))) +CFLAGS += ${OPTFLAGS} +endif + + +# +# This is the makefile's main target. Note that we actually +# do most of the work in 'ALL' not 'all', since we include +# other makefiles after this point. +# + +all : build_date.c makereg pcidevs_data2.h ALL + +# +# Macros that expand to the list of arch-independent files +# + +DEVOBJS = dev_flash.o dev_newflash.o dev_null.o dev_promice.o \ + dev_ide_common.o dev_ns16550.o dev_ds17887clock.o +LIBOBJS = lib_malloc.o lib_printf.o lib_queue.o lib_string.o lib_string2.o \ + lib_arena.o lib_misc.o lib_setjmp.o lib_qsort.o lib_hssubr.o lib_physio.o +NETOBJS = net_ether.o net_arp.o net_ip.o net_udp.o net_api.o net_dns.o \ + net_dhcp.o net_tftp.o net_icmp.o net_tcp.o net_tcpbuf.o dev_tcpconsole.o +CFEOBJS = env_subr.o cfe_attach.o cfe_iocb_dispatch.o cfe_devfuncs.o \ + nvram_subr.o cfe_console.o cfe_main.o cfe_mem.o cfe_timer.o \ + cfe_background.o cfe_error.o build_date.o \ + cfe_rawfs.o cfe_zlibfs.o cfe_xreq.o cfe_fatfs.o cfe_httpfs.o cfe_filesys.o cfe_boot.o \ + cfe_autoboot.o cfe_ldr_elf.o cfe_ldr_raw.o cfe_ldr_srec.o cfe_loader.o url.o \ + cfe_savedata.o +UIOBJS = ui_command.o ui_cmddisp.o ui_envcmds.o ui_devcmds.o \ + ui_netcmds.o ui_tcpcmds.o ui_memcmds.o ui_loadcmds.o ui_pcicmds.o \ + ui_examcmds.o ui_flash.o ui_misccmds.o \ + ui_test_disk.o ui_test_ether.o ui_test_flash.o ui_test_uart.o + +# +# Add more object files if we're supporting PCI +# + +ifeq ($(strip ${CFG_PCI}),1) +PCIOBJS = pciconf.o ldtinit.o pci_subr.o +PCIOBJS += pci_devs.o +DEVOBJS += dev_sp1011.o dev_ht7520.o +DEVOBJS += dev_ide_pci.o dev_ns16550_pci.o +DEVOBJS += dev_tulip.o dev_dp83815.o +CFLAGS += -DCFG_PCI=1 +ifeq ($(strip ${CFG_LDT_REV_017}),1) +CFLAGS += -DCFG_LDT_REV_017=1 +endif +ifeq ($(strip ${CFG_DOWNLOAD}),1) +DEVOBJS += dev_bcm1250.o download.data +CFLAGS += -DCFG_DOWNLOAD=1 +endif +endif + +# +# If doing bi-endian, add the compiler switch to change +# the way the vectors are generated. These switches are +# only added to the big-endian portion of the ROM, +# which is located at the real boot vector. +# + +ifeq ($(strip ${CFG_BIENDIAN}),1) + ifeq ($(strip ${CFG_LITTLE}),0) + CFLAGS += -DCFG_BIENDIAN=1 + endif +endif + +# +# Include the makefiles for the architecture-common, cpu-specific, +# and board-specific directories. Each of these will supply +# some files to "ALLOBJS". The BOARD directory is optional +# as some ports are so simple they don't need boad-specific stuff. +# + +include ${ARCH_SRC}/Makefile +include ${CPU_SRC}/Makefile + +ifneq ("$(strip ${BOARD})","") +include ${BOARD_SRC}/Makefile +endif + +# +# Add the common object files here. +# + +ALLOBJS += $(LIBOBJS) $(DEVOBJS) $(CFEOBJS) $(VENOBJS) $(UIOBJS) $(NETOBJS) $(PCIOBJS) + +# +# VAPI continues to be a special case. +# + +ifeq ($(strip ${CFG_VAPI}),1) +include ${TOP}/verif/Makefile +endif + +# +# USB support +# + +ifeq ($(strip ${CFG_USB}),1) +SRCDIRS += ${TOP}/usb +CFE_INC += ${TOP}/usb +include ${TOP}/usb/Makefile +endif + +# +# If we're doing the VGA console thing, pull in the x86 emulator +# and the pcconsole subsystem +# + +ifeq ($(strip ${CFG_VGACONSOLE}),1) +include ${TOP}/x86emu/Makefile +include ${TOP}/pccons/Makefile +endif + +# +# If we're including ZLIB, then add its makefile. +# + +ifeq ($(strip ${CFG_ZLIB}),1) +include ${TOP}/zlib/Makefile +CFLAGS += -DCFG_ZLIB=1 -DMY_ZCALLOC -DNO_MEMCPY +endif + +# +# Vendor extensions come next - they live in their own directory. +# + +include ${TOP}/vendor/Makefile + +.PHONY : all +.PHONY : ALL +.PHONY : build_date.c + +# +# Build the local tools that we use to construct other source files +# + +mkpcidb : ${TOP}/hosttools/mkpcidb.c + gcc -o mkpcidb ${TOP}/hosttools/mkpcidb.c + +memconfig : ${TOP}/hosttools/memconfig.c + gcc -o memconfig -D_MCSTANDALONE_ -D_MCSTANDALONE_NOISY_ -I${TOP}/arch/mips/cpu/sb1250/include ${TOP}/hosttools/memconfig.c ${TOP}/arch/${ARCH}/cpu/${CPU}/src/sb1250_draminit.c + +pcidevs_data2.h : mkpcidb ${TOP}/pci/pcidevs_data.h + ./mkpcidb > pcidevs_data2.h + +mkflashimage : ${TOP}/hosttools/mkflashimage.c + gcc -o mkflashimage -I${TOP}/include ${TOP}/hosttools/mkflashimage.c + +pci_subr.o : ${TOP}/pci/pci_subr.c pcidevs_data2.h + +build_date.c : + echo "const char *builddate = \"`date`\";" > build_date.c + echo "const char *builduser = \"`whoami`@`hostname`\";" >> build_date.c + +# +# Make a define for the board name +# + +CFLAGS += -D_$(patsubst "%",%,${CFG_BOARDNAME})_ + +LIBCFE = libcfe.a + +%.o : %.c + $(GCC) $(CFLAGS) -o $@ $< + +%.o : %.S + $(GCC) $(CFLAGS) -o $@ $< + +# +# This rule constructs "libcfe.a" which contains most of the object +# files. +# + +$(LIBCFE) : $(ALLOBJS) + rm -f $(LIBCFE) + $(AR) cr $(LIBCFE) $(ALLOBJS) + $(RANLIB) $(LIBCFE) + + + diff --git a/cfe/cfe/main/cfe_attach.c b/cfe/cfe/main/cfe_attach.c new file mode 100644 index 0000000..1235d6e --- /dev/null +++ b/cfe/cfe/main/cfe_attach.c @@ -0,0 +1,265 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Device Attach routines File: cfe_attach.c + * + * This module manages the list of device drivers. When a driver + * is probed, it can call cfe_attach to create actual device + * instances. The routines in this module manage the + * device list and the assignment of device names. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_queue.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_iocb.h" +#include "cfe_device.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define CFE_MAX_DEVINST 64 /* max # of instances of devices */ + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +/* + * Our device list. + */ + +queue_t cfe_devices = {&cfe_devices, &cfe_devices}; + +/* ********************************************************************* + * cfe_finddev(name) + * + * Locate a device in the device list by its name and return + * a pointer to the device structure. + * + * Input parameters: + * name - name of device, e.g., "uart0" + * + * Return value: + * cfe_device_t pointer or NULL + ********************************************************************* */ + +cfe_device_t *cfe_finddev(char *name) +{ + queue_t *qb; + cfe_device_t *dev; + + for (qb = cfe_devices.q_next; qb != &cfe_devices; qb = qb->q_next) { + dev = (cfe_device_t *) qb; + if (strcmp(dev->dev_fullname,name) == 0) { + return dev; + } + } + + return NULL; +} + + +/* ********************************************************************* + * cfe_device_reset() + * + * Call all the "reset" methods in the devices on the device + * list. Note that the methods get called even when the + * devices are closed! + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_device_reset(void) +{ + queue_t *qb; + cfe_device_t *dev; + + for (qb = cfe_devices.q_next; qb != &cfe_devices; qb = qb->q_next) { + dev = (cfe_device_t *) qb; + if (dev->dev_dispatch->dev_reset) { + (*(dev->dev_dispatch->dev_reset))(dev->dev_softc); + } + } +} + +/* ********************************************************************* + * cfe_attach_idx(drv,idx,softc,bootinfo,description) + * + * Add a device to the device list at a specific index. This + * is mainly used for devices like SCSI disks or CD-ROMs so + * we can use an index that matches the target ID or LUN. + * + * Input parameters: + * drv - driver structure (from the device driver module) + * idx - requested index (e.g., uartn where 'n' is the idx) + * softc - Unique information maintained for this device + * bootinfo - suffix for long form of the device name. For + * example, scsi0.3.1 might mean SCSI controller + * 0, device ID 3, LUN 1. The bootinfo would be + * "3.1" + * description - something nice to say for the devices command + * + * Return value: + * 0 if device has already been added at this index + * <0 for other problems + * 1 if we were successful. + ********************************************************************* */ + +int cfe_attach_idx(cfe_driver_t *drv,int idx,void *softc, + char *bootinfo,char *description) +{ + char name[64]; + cfe_device_t *dev; + + xsprintf(name,"%s%d",drv->drv_bootname,idx); + + if (bootinfo) { + strcat(name,"."); + strcat(name,bootinfo); + } + + if (cfe_finddev(name) != NULL) { + return 0; + } + + dev = (cfe_device_t *) KMALLOC(sizeof(cfe_device_t),0); + if (!dev) return -1; + + dev->dev_fullname = strdup(name); + dev->dev_softc = softc; + dev->dev_class = drv->drv_class; + dev->dev_dispatch = drv->drv_dispatch; + dev->dev_description = description ? strdup(description) : NULL; + dev->dev_opencount = 0; + + q_enqueue(&cfe_devices,(queue_t *) dev); + + return 1; + +} + + + +/* ********************************************************************* + * cfe_attach(drv,softc,bootinfo,description + * + * Add a device to the system. This is a callback from the + * probe routine, and is used to actually add devices to CFE's + * device list. + * + * Input parameters: + * drv - driver structure (from the device driver module) + * softc - Unique information maintained for this device + * bootinfo - suffix for long form of the device name. For + * example, scsi0.3.1 might mean SCSI controller + * 0, device ID 3, LUN 1. The bootinfo would be + * "3.1" + * description - something nice to say for the devices command + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_attach(cfe_driver_t *drv,void *softc, + char *bootinfo, + char *description) +{ + int idx; + int res; + + /* + * Try device indicies 0..CFE_MAX_DEVINST to assign a unique + * device name for this device. This is a really braindead way to + * do this, but how many devices are we expecting anyway? + */ + + for (idx = 0; idx < CFE_MAX_DEVINST; idx++) { + + res = cfe_attach_idx(drv,idx,softc,bootinfo,description); + + if (res < 0) break; /* out of memory or other badness */ + if (res > 0) break; /* success! */ + /* otherwise, try again, slot is taken */ + } + +} + +/* ********************************************************************* + * cfe_attach_init() + * + * Initialize this module. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ +void cfe_attach_init(void) +{ + q_init(&(cfe_devices)); +} + + +/* ********************************************************************* + * cfe_device_name(ctx) + * + * Given a device context, return a device name + * + * Input parameters: + * ctx - context + * + * Return value: + * name + ********************************************************************* */ + +char *cfe_device_name(cfe_devctx_t *ctx) +{ + return ctx->dev_dev->dev_fullname; +} diff --git a/cfe/cfe/main/cfe_autoboot.c b/cfe/cfe/main/cfe_autoboot.c new file mode 100644 index 0000000..14f3d3c --- /dev/null +++ b/cfe/cfe/main/cfe_autoboot.c @@ -0,0 +1,456 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Automatic OS bootstrap File: cfe_autoboot.c + * + * This module handles OS bootstrap stuff. We use this version + * to do "automatic" booting; walking down a list of possible boot + * options, trying them until something good happens. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" + +#include "cfe_error.h" + +#include "env_subr.h" +#include "cfe.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_api.h" +#include "cfe_fileops.h" +#include "cfe_bootblock.h" +#include "bsp_config.h" +#include "cfe_boot.h" + +#include "cfe_loader.h" + +#include "cfe_autoboot.h" + +/* ********************************************************************* + * data + ********************************************************************* */ + +queue_t cfe_autoboot_list = {&cfe_autoboot_list,&cfe_autoboot_list}; + +extern cfe_loadargs_t cfe_loadargs; /* from cfe_boot.c */ +extern const char *bootvar_device; +extern const char *bootvar_file; +extern const char *bootvar_flags; + +extern char *varchars; + +/* ********************************************************************* + * macroexpand(instr,outstr) + * + * Expand environment variables in "instr" to "outstr" + * + * Input parameters: + * instr - to be expanded + * outstr - expanded. + * + * Return value: + * nothing + ********************************************************************* */ + +static void macroexpand(char *instr,char *outstr) +{ + char macroname[50]; + char *m; + + while (*instr) { + if (*instr == '$') { + instr++; + m = macroname; + while (*instr && strchr(varchars,*instr)) { + *m++ = *instr++; + } + *m = '\0'; + m = env_getenv(macroname); + if (m) { + while (*m) *outstr++ = *m++; + } + } + else { + *outstr++ = *instr++; + } + } + + *outstr = '\0'; +} + +/* ********************************************************************* + * cfe_tryauto_common(method,loadargs) + * + * Common portion of autoboot + * + * Input parameters: + * method - details on device to boot from + * filename - canonical name of file to load + * loadargs - cfe_loadargs_t of digested load parameters. + * + * Return value: + * does not return if successful + ********************************************************************* */ + +static int cfe_tryauto_common(cfe_autoboot_method_t *method, + char *filename, + cfe_loadargs_t *la) +{ + int res; + + la->la_filename = filename; + la->la_options = env_getenv(bootvar_flags); + la->la_filesys = method->ab_filesys; + la->la_device = method->ab_dev; + la->la_flags = method->ab_flags | LOADFLG_NOISY | LOADFLG_EXECUTE; + la->la_address = 0; + la->la_maxsize = 0; + la->la_entrypt = 0; + + /* okay, go for it. */ + + xprintf("Loader:%s Filesys:%s Dev:%s File:%s Options:%s\n", + method->ab_loader,la->la_filesys,la->la_device,la->la_filename,la->la_options); + + res = cfe_boot(method->ab_loader,&cfe_loadargs); + + return res; + +} + + +/* ********************************************************************* + * cfe_tryauto_network(method) + * + * Try to autoboot from a network device. + * + * Input parameters: + * method - details on device to boot from + * + * Return value: + * does not return unless there is an error + ********************************************************************* */ + +#if CFG_NETWORK +static int cfe_tryauto_network(cfe_autoboot_method_t *method) +{ + int res; + dhcpreply_t *reply = NULL; + cfe_loadargs_t *la = &cfe_loadargs; + char buffer[512]; + char *x; + + /* + * First turn off any network interface that is currently active. + */ + + net_uninit(); + + /* + * Now activate the network hardware. + */ + + res = net_init(method->ab_dev); + if (res < 0) { + printf("Could not initialize network device %s: %s\n", + method->ab_dev, + cfe_errortext(res)); + return res; + } + + /* + * Do a DHCP query. + */ + + res = dhcp_bootrequest(&reply); + if (res < 0) { + printf("DHCP request failed on device %s: %s\n",method->ab_dev, + cfe_errortext(res)); + net_uninit(); + return res; + } + + net_setparam(NET_IPADDR,reply->dr_ipaddr); + net_setparam(NET_NETMASK,reply->dr_netmask); + net_setparam(NET_GATEWAY,reply->dr_gateway); + net_setparam(NET_NAMESERVER,reply->dr_nameserver); + net_setparam(NET_DOMAIN,reply->dr_domainname); + + /* Set all our environment variables. */ + net_setnetvars(); + dhcp_set_envvars(reply); + + if (reply) dhcp_free_reply(reply); + + /* + * Interface is now configured and ready, we can + * load programs now. + */ + + /* + * Construct the file name to load. If the method does not + * specify a file name directly, get it from DHCP. + * + * For network booting, the format of the file name + * is 'hostname:filename' + * + * If the method's filename includes a hostname, ignore + * BOOT_SERVER. Otherwise, combine BOOT_SERVER with the + * filename. This way we can provide the name here + * but have the file come off the server specified in the + * DHCP message. + */ + + if (method->ab_file && strchr(method->ab_file,':')) { + macroexpand(method->ab_file,buffer); + } + else { + buffer[0] = '\0'; + x = env_getenv("BOOT_SERVER"); + if (x) { + strcat(buffer,x); + strcat(buffer,":"); + } + + x = method->ab_file; + if (!x) x = env_getenv(bootvar_file); + if (x) { + strcat(buffer,x); + } + } + + /* Okay, do it. */ + + cfe_tryauto_common(method,buffer,la); + + /* If we get here, something bad happened. */ + + net_uninit(); + + return res; + +} + +#endif + + +/* ********************************************************************* + * cfe_tryauto_disk(method) + * + * Try to autoboot from a disk device. + * + * Input parameters: + * method - details on device to boot from + * + * Return value: + * does not return unless there is an error + ********************************************************************* */ +static int cfe_tryauto_disk(cfe_autoboot_method_t *method) +{ + int res; + cfe_loadargs_t *la = &cfe_loadargs; + char buffer[512]; + char *filename; + + buffer[0] = '\0'; + + if (method->ab_file) { + macroexpand(method->ab_file,buffer); + filename = buffer; + } + else { + filename = env_getenv("BOOT_FILE"); + if (filename) strcpy(buffer,filename); + } + + res = cfe_tryauto_common(method,filename,la); + + return res; +} + +/* ********************************************************************* + * cfe_tryauto(method) + * + * Try a single autoboot method. + * + * Input parameters: + * method - autoboot method to try + * + * Return value: + * does not return if bootstrap is successful + * else error code + ********************************************************************* */ + +static int cfe_tryauto(cfe_autoboot_method_t *method) +{ + switch (method->ab_type) { +#if CFG_NETWORK + case CFE_AUTOBOOT_NETWORK: + return cfe_tryauto_network(method); + break; +#endif + + case CFE_AUTOBOOT_DISK: + case CFE_AUTOBOOT_RAW: + return cfe_tryauto_disk(method); + break; + } + + return -1; +} + +/* ********************************************************************* + * cfe_autoboot(dev,flags) + * + * Try to perform an automatic system bootstrap + * + * Input parameters: + * dev - if not NULL, restrict bootstrap to named device + * flags - controls behaviour of cfe_autoboot + * + * Return value: + * should not return if bootstrap is successful, otherwise + * error code + ********************************************************************* */ +int cfe_autoboot(char *dev,int flags) +{ + queue_t *qb; + cfe_autoboot_method_t *method; + int res; + cfe_timer_t timer; + int forever; + int pollconsole; + + forever = (flags & CFE_AUTOFLG_TRYFOREVER) ? 1 : 0; + pollconsole = (flags & CFE_AUTOFLG_POLLCONSOLE) ? 1 : 0; + + do { /* potentially forever */ + for (qb = cfe_autoboot_list.q_next; qb != &cfe_autoboot_list; qb = qb->q_next) { + + method = (cfe_autoboot_method_t *) qb; + + /* + * Skip other devices if we passed in a specific one. + */ + + if (dev && (strcmp(dev,method->ab_dev) != 0)) continue; + + printf("\n*** Autoboot: Trying device '%s' ", method->ab_dev); + if (method->ab_file) printf("file %s ",method->ab_file); + printf("(%s,%s)\n\n",method->ab_dev,method->ab_filesys,method->ab_loader); + + /* + * Scan keyboard if requested. + */ + if (pollconsole) { + TIMER_SET(timer,CFE_HZ); + while (!TIMER_EXPIRED(timer)) { + POLL(); + if (console_status()) goto done; + } + } + + /* + * Try something. may not return. + */ + + res = cfe_tryauto(method); + } + } while (forever); + + /* bail. */ +done: + + printf("\n*** Autoboot failed.\n\n"); + + return -1; +} + + +/* ********************************************************************* + * cfe_add_autoboot(type,flags,dev,loader,filesys,file) + * + * Add an autoboot method to the table. + * This is typically called in the board_finalinit one or more + * times to provide a list of bootstrap methods to try for autoboot + * + * Input parameters: + * type - CFE_AUTOBOOT_xxx (disk,network,raw) + * flags - loader flags (LOADFLG_xxx) + * loader - loader string (elf, raw, srec) + * filesys - file system string (raw, tftp, fat) + * file - name of file to load (if null, will try to guess) + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int cfe_add_autoboot(int type,int flags,char *dev,char *loader,char *filesys,char *file) +{ + cfe_autoboot_method_t *method; + + method = (cfe_autoboot_method_t *) KMALLOC(sizeof(cfe_autoboot_method_t),0); + + if (!method) return CFE_ERR_NOMEM; + + method->ab_type = type; + method->ab_flags = flags; + method->ab_dev = dev; + method->ab_loader = loader; + method->ab_filesys = filesys; + method->ab_file = file; + + q_enqueue(&cfe_autoboot_list,(queue_t *)method); + return 0; +} diff --git a/cfe/cfe/main/cfe_background.c b/cfe/cfe/main/cfe_background.c new file mode 100644 index 0000000..9a64e0a --- /dev/null +++ b/cfe/cfe/main/cfe_background.c @@ -0,0 +1,174 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Timer routines File: cfe_timer.c + * + * This module manages the list of routines to call periodically + * during "background processing." CFE has no interrupts or + * multitasking, so this is just where all the polling routines + * get called from. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" + +#include "cfe_timer.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define MAX_BACKGROUND_TASKS 16 + + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +static void (*cfe_bg_tasklist[MAX_BACKGROUND_TASKS])(void *); +static void *cfe_bg_args[MAX_BACKGROUND_TASKS]; + + +/* ********************************************************************* + * cfe_bg_init() + * + * Initialize the background task list + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_bg_init(void) +{ + memset(cfe_bg_tasklist,0,sizeof(cfe_bg_tasklist)); +} + + +/* ********************************************************************* + * cfe_bg_add(func,arg) + * + * Add a function to be called periodically in the background + * polling loop. + * + * Input parameters: + * func - function pointer + * arg - arg to pass to function + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_bg_add(void (*func)(void *x),void *arg) +{ + int idx; + + for (idx = 0; idx < MAX_BACKGROUND_TASKS; idx++) { + if (cfe_bg_tasklist[idx] == NULL) { + cfe_bg_tasklist[idx] = func; + cfe_bg_args[idx] = arg; + return; + } + } +} + +/* ********************************************************************* + * cfe_bg_remove(func) + * + * Remove a function from the background polling loop + * + * Input parameters: + * func - function pointer + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_bg_remove(void (*func)(void *)) +{ + int idx; + + for (idx = 0; idx < MAX_BACKGROUND_TASKS; idx++) { + if (cfe_bg_tasklist[idx] == func) break; + } + + if (idx == MAX_BACKGROUND_TASKS) return; + + for (; idx < MAX_BACKGROUND_TASKS-1; idx++) { + cfe_bg_tasklist[idx] = cfe_bg_tasklist[idx+1]; + cfe_bg_args[idx] = cfe_bg_args[idx+1]; + } + + cfe_bg_tasklist[idx] = NULL; + cfe_bg_args[idx] = NULL; +} + + +/* ********************************************************************* + * background() + * + * The main loop and other places that wait for stuff call + * this routine to make sure the background handlers get their + * time. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void background(void) +{ + int idx; + void (*func)(void *arg); + + for (idx = 0; idx < MAX_BACKGROUND_TASKS; idx++) { + func = cfe_bg_tasklist[idx]; + if (func == NULL) break; + (*func)(cfe_bg_args[idx]); + } +} diff --git a/cfe/cfe/main/cfe_boot.c b/cfe/cfe/main/cfe_boot.c new file mode 100644 index 0000000..12fecaa --- /dev/null +++ b/cfe/cfe/main/cfe_boot.c @@ -0,0 +1,248 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * OS bootstrap File: cfe_boot.c + * + * This module handles OS bootstrap stuff + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" + +#include "cfe_error.h" + +#include "env_subr.h" +#include "cfe.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_api.h" +#include "cfe_fileops.h" +#include "cfe_bootblock.h" +#include "bsp_config.h" +#include "cfe_boot.h" + +#include "cfe_loader.h" + +#if CFG_UI +extern int ui_docommands(char *buf); +#endif + +/* ********************************************************************* + * data + ********************************************************************* */ + +const char *bootvar_device = "BOOT_DEVICE"; +const char *bootvar_file = "BOOT_FILE"; +const char *bootvar_flags = "BOOT_FLAGS"; + +cfe_loadargs_t cfe_loadargs; + +/* ********************************************************************* + * splitpath(path,devname,filename) + * + * Split a path name (a boot path, in the form device:filename) + * into its parts + * + * Input parameters: + * path - pointer to path string + * devname - receives pointer to device name + * filename - receives pointer to file name + * + * Return value: + * nothing + ********************************************************************* */ + +void splitpath(char *path,char **devname,char **filename) +{ + char *x; + + *devname = NULL; + *filename = NULL; + + x = strchr(path,':'); + + if (!x) { + *devname = NULL; /* path consists of device name */ + *filename = path; + } + else { + *x++ = '\0'; /* have both device and file name */ + *filename = x; + *devname = path; + } +} + + +/* ********************************************************************* + * cfe_go(la) + * + * Starts a previously loaded program. cfe_loadargs.la_entrypt + * must be set to the entry point of the program to be started + * + * Input parameters: + * la - loader args + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_go(cfe_loadargs_t *la) +{ + if (la->la_entrypt == 0) { + xprintf("No program has been loaded.\n"); + return; + } + +#if CFG_NETWORK + if (!(la->la_flags & LOADFLG_NOCLOSE)) { + if (net_getparam(NET_DEVNAME)) { + xprintf("Closing network.\n"); + net_uninit(); + } + } +#endif + + xprintf("Starting program at 0x%p\n",la->la_entrypt); + + cfe_start(la->la_entrypt); +} + + +/* ********************************************************************* + * cfe_boot(la) + * + * Bootstrap the system. + * + * Input parameters: + * la - loader arguments + * + * Return value: + * error, or does not return + ********************************************************************* */ +int cfe_boot(char *ldrname,cfe_loadargs_t *la) +{ + int res; + + la->la_entrypt = 0; + + if (la->la_flags & LOADFLG_NOISY) { + xprintf("Loading: "); + } + + res = cfe_load_program(ldrname,la); + + if (res < 0) { + if (la->la_flags & LOADFLG_NOISY) { + xprintf("Failed.\n"); + } + return res; + } + + /* + * Special case: If loading a batch file, just do the commands here + * and return. For batch files we don't want to set up the + * environment variables. + */ + + if (la->la_flags & LOADFLG_BATCH) { +#if CFG_UI + ui_docommands((char *) la->la_entrypt); +#endif + return 0; + } + + /* + * Otherwise set up for running a real program. + */ + + if (la->la_flags & LOADFLG_NOISY) { + xprintf("Entry at 0x%p\n",la->la_entrypt); + } + + /* + * Set up the environment variables for the bootstrap + */ + + if (la->la_device) { + env_setenv(bootvar_device,la->la_device,ENV_FLG_BUILTIN); + } + else { + env_delenv(bootvar_device); + } + + if (la->la_filename) { + env_setenv(bootvar_file,la->la_filename,ENV_FLG_BUILTIN); + } + else { + env_delenv(bootvar_file); + } + + if (la->la_options) { + env_setenv(bootvar_flags,la->la_options,ENV_FLG_BUILTIN); + } + else { + env_delenv(bootvar_flags); + } + + /* + * Banzai! Run the program. + */ + + if ((la->la_flags & LOADFLG_EXECUTE) && + (la->la_entrypt != 0)) { + cfe_go(la); + } + + return 0; +} + diff --git a/cfe/cfe/main/cfe_console.c b/cfe/cfe/main/cfe_console.c new file mode 100755 index 0000000..a9464f1 --- /dev/null +++ b/cfe/cfe/main/cfe_console.c @@ -0,0 +1,1190 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Console Interface File: cfe_console.c + * + * This module contains high-level routines for dealing with + * the console (TTY-style) device. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" +#include "cfe_error.h" +#include "env_subr.h" +#include "cfe_console.h" +#include "cfe.h" + +#include "bsp_config.h" + + +/* + * Escape sequences: + * + * Sequence Descr Emulator + * + * ESC [ A UP xterm + * ESC [ B DOWN xterm + * ESC [ C RIGHT xterm + * ESC [ D LEFT xterm + * + * ESC O P F1 xterm + * ESC O Q F2 xterm + * ESC O R F3 xterm + * ESC O S F4 xterm + * + * ESC [ 1 1 ~ F1 teraterm + * ESC [ 1 2 ~ F2 teraterm + * ESC [ 1 3 ~ F3 teraterm + * ESC [ 1 4 ~ F4 teraterm + * + * ESC [ 1 5 ~ F5 xterm,teraterm + * ESC [ 1 7 ~ F6 xterm,teraterm + * ESC [ 1 8 ~ F7 xterm,teraterm + * ESC [ 1 9 ~ F8 xterm,teraterm + * ESC [ 2 0 ~ F9 xterm,teraterm + * ESC [ 2 1 ~ F10 xterm,teraterm + * ESC [ 2 3 ~ F11 xterm,teraterm + * ESC [ 2 4 ~ F12 xterm,teraterm + * + * ESC [ 5 ~ PGUP xterm + * ESC [ 6 ~ PGDN xterm + * ESC [ F HOME xterm + * ESC [ H END xterm + * + * ESC [ 2 ~ HOME teraterm + * ESC [ 3 ~ PGUP teraterm + * ESC [ 5 ~ END teraterm + * ESC [ 6 ~ PGDN teraterm + * + */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + + +#define CTRL(x) ((x)-'@') + +#define GETCHAR(x) while (console_read(&(x),1) != 1) { POLL(); } + +#define XTERM 0 +#define TERATERM 1 + +#define MAXSAVELINES 30 +#define MSGQUEUEMAX 10 /* number of chunks of log to keep */ +#define MSGQUEUESIZE 256 /* size of each chunk of console log */ + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct msgqueue_s { /* saved console log message */ + queue_t link; + int len; + char data[MSGQUEUESIZE]; +} msgqueue_t; + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +#if !CFG_MINIMAL_SIZE +int console_nextsave = 0; +char *console_savedlines[MAXSAVELINES] = {0}; +static char *console_killbuffer = NULL; +queue_t console_msgq = {&console_msgq,&console_msgq}; +static int console_buffer_flg = 0; +static int console_mode = XTERM; + +static void console_flushbuffer(void); +static void console_save(unsigned char *buffer,int length); + +#endif + +#if defined(CONFIG_MIPS_BRCM) +int g_console_abort = 0; +#endif +int console_handle = -1; +static int console_xprint(const char *str); +char *console_name = NULL; +static int console_inreadline = 0; +static int console_redisplay = 0; + +/* ********************************************************************* + * console_log(tmplt,...) + * + * Sort of like printf, but used during things that might be + * called in the polling loop. If you print out a message + * using this call and it happens to be printed while processing + * the console "readline" loop, the readline and the associated + * prompt will be redisplayed. Don't include the \r\n in the + * string to be displayed. + * + * Input parameters: + * tmplt, ... - printf parameters + * + * Return value: + * nothing + ********************************************************************* */ + +void console_log(const char *tmplt,...) +{ + char buffer[256]; + va_list marker; + int count; + + va_start(marker,tmplt); + count = xvsprintf(buffer,tmplt,marker); + va_end(marker); + xprintf("\r%s\033[J\r\n",buffer); + + if (console_inreadline) console_redisplay = 1; +} + +/* ********************************************************************* + * console_open(name) + * + * Open the specified device and make it the console + * + * Input parameters: + * name - name of device + * + * Return value: + * 0 if ok, else return code. + * console_handle contains the console's handle + ********************************************************************* */ + +int console_open(char *name) +{ +#if CFG_MINIMAL_SIZE + if (console_handle != -1) { + console_close(); + } + + console_handle = cfe_open(name); + if (console_handle < 0) return CFE_ERR_DEVNOTFOUND; + +#else + + int flushbuf; + + console_name = NULL; + + if (console_handle != -1) { + console_close(); + } + + flushbuf = console_buffer_flg; + console_buffer_flg = 0; + + console_handle = cfe_open(name); + if (console_handle < 0) return CFE_ERR_DEVNOTFOUND; + + console_name = name; + if (flushbuf) console_flushbuffer(); +#endif + + return 0; +} + +/* ********************************************************************* + * console_close() + * + * Close the console device + * + * Input parameters: + * nothing + * + * Return value: + * 0 + ********************************************************************* */ + +int console_close(void) +{ + if (console_handle != -1) { + cfe_close(console_handle); + } + + console_handle = -1; + + return 0; +} + +/* ********************************************************************* + * console_read(buffer,length) + * + * Read characters from the console. + * + * Input parameters: + * buffer - pointer to buffer to receive characters + * length - total size of the buffer + * + * Return value: + * number of characters received, or <0 if error code + ********************************************************************* */ + +int console_read(char *buffer,int length) +{ + if (console_handle == -1) return -1; + + return cfe_read(console_handle,(unsigned char*)buffer,length); +} + + +/* ********************************************************************* + * console_write(buffer,length) + * + * Write text to the console. If the console is not open and + * we're "saving" text, put the text on the in-memory queue + * + * Input parameters: + * buffer - pointer to data + * length - number of characters to write + * + * Return value: + * number of characters written or <0 if error + ********************************************************************* */ + +int console_write(char *buffer,int length) +{ + int res; + +#if !CFG_MINIMAL_SIZE + /* + * Buffer text if requested + */ + if (console_buffer_flg) { + console_save(buffer,length); + return length; + } +#endif + + /* + * Do nothing if no console + */ + + if (console_handle == -1) return -1; + + /* + * Write text to device + */ + + for (;;) { + res = cfe_write(console_handle,(unsigned char*)buffer,length); + if (res < 0) break; + buffer += res; + length -= res; + if (length == 0) break; + } + + if (res < 0) return -1; + return 0; +} + +/* ********************************************************************* + * console_status() + * + * Return the status of input for the console. + * + * Input parameters: + * nothing + * + * Return value: + * 0 if no characters are available + * 1 if characters are available. + ********************************************************************* */ + +int console_status(void) +{ + if (console_handle == -1) return 0; + + return cfe_inpstat(console_handle); +} + +/* ********************************************************************* + * console_xprint(str) + * + * printf callback for the console device. the "xprintf" + * routine ends up calling this. This routine also cooks the + * output, turning "\n" into "\r\n" + * + * Input parameters: + * str - string to write + * + * Return value: + * number of characters written + ********************************************************************* */ + +static int console_xprint(const char *str) +{ + int count = 0; + int len; + const char *p; + + /* Convert CR to CRLF as we write things out */ + + while ((p = strchr(str,'\n'))) { + console_write((char*)str,p-str); + console_write("\r\n",2); + count += (p-str); + str = p + 1; + } + + len = strlen(str); + console_write((char*)str, len); + count += len; + + return count; +} + + +/* ********************************************************************* + * console_readline_noedit(str,len) + * + * A simple 'gets' type routine for the console. We support + * backspace and carriage return. No line editing support here, + * this routine is used in places where we don't want it. + * + * Input parameters: + * prompt - prompt string + * str - pointer to user buffer + * len - length of user buffer + * + * Return value: + * number of characters read (terminating newline is not + * placed in the buffer) + ********************************************************************* */ + +int console_readline_noedit(char *prompt,char *str,int len) +{ + int reading = 1; + char ch; + int res = -1; + int idx = 0; + + console_inreadline++; + + if (prompt && *prompt) console_write(prompt,strlen(prompt)); + + POLL(); + while (reading) { + + /* + * If someone used console_log (above) or hit Control-C (below), + * redisplay the prompt and the string we've got so far. + */ + + if (console_redisplay) { + if (prompt && *prompt) console_write(prompt,strlen(prompt)); + console_write(str,idx); + console_redisplay = 0; + continue; + } + +#if defined(CONFIG_MIPS_BRCM) + + /* + * If a background process has set the global g_console_abort flag, stop + * reading from the keyboard. + */ + + if (g_console_abort) { + g_console_abort = 0; + break; + } + +#endif + + /* + * if nobody's typed anything, keep polling + */ + + if (console_status() == 0) { + POLL(); + continue; + } + + /* + * Get the char from the keyboard + */ + + res = console_read(&ch,1); + if (res < 0) break; + if (res == 0) continue; + + /* + * And dispatch it + */ + + switch (ch) { + case 3: /* Ctrl-C */ + console_write("^C\r\n",4); + console_redisplay = 1; + idx = 0; + break; + case 0x7f: + case '\b': + if (idx > 0) { + idx--; + console_write("\b \b",3); + } + break; + case 21: /* Ctrl-U */ + while (idx > 0) { + idx--; + console_write("\b \b",3); + } + break; + case '\r': + case '\n': + console_write("\r\n",2); + reading = 0; + break; + default: + if (ch >= ' ') { + if (idx < (len-1)) { + str[idx] = ch; + idx++; + console_write(&ch,1); + } + } + break; + } + } + POLL(); + + console_inreadline--; + + str[idx] = 0; + return idx; +} + + +/* ********************************************************************* + * cfe_set_console(name) + * + * This routine is usually called from the BSP's initialization + * module to set up the console device. We set the xprintf + * callback and open the console device. If we open a special + * magic console device (CFE_BUFFER_CONSOLE) the console subsystem + * will buffer text instead. A later call to cfe_set_console + * with a real console name will cause this text to be flushed. + * + * Input parameters: + * name - name of console device + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int cfe_set_console(char *name) +{ + xprinthook = console_xprint; + +#if !CFG_MINIMAL_SIZE + if (strcmp(name,CFE_BUFFER_CONSOLE) == 0) { + console_buffer_flg = 1; + return 0; + } +#endif + + if (name) { + int res; + res = env_setenv("BOOT_CONSOLE",name, + ENV_FLG_BUILTIN | ENV_FLG_READONLY | ENV_FLG_ADMIN); + return console_open(name); + } + return -1; +} + +#if !CFG_MINIMAL_SIZE + +/* ********************************************************************* + * console_flushbuffer() + * + * Flush queued (saved) console messages to the real console + * device. This is used if we need to delay console + * initialization until after other devices are initialized, + * for example, with a VGA console that won't work until + * after PCI initialization. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void console_flushbuffer(void) +{ + msgqueue_t *msg; + char *buffer; + int length; + int res; + + /* + * Remove console messages from the queue + */ + + while ((msg = (msgqueue_t *) q_deqnext(&console_msgq))) { + + buffer = msg->data; + length = msg->len; + res = 0; + + /* + * Write each message to the console + */ + + for (;;) { + res = cfe_write(console_handle,buffer,length); + if (res < 0) break; + buffer += res; + length -= res; + if (length == 0) break; + } + + /* + * Free the storage + */ + + KFREE(msg); + } +} + + +/* ********************************************************************* + * console_save(buffer,length) + * + * This is used when we want to generate console output + * before the device is initialized. The console_save + * routine saves a copy of the log messages in a queue + * for later retrieval when the console device is open. + * + * Input parameters: + * buffer - message text to save + * length - number of bytes + * + * Return value: + * nothing + ********************************************************************* */ + +static void console_save(unsigned char *buffer,int length) +{ + msgqueue_t *msg; + + /* + * Get a pointer to the last message in the queue. If + * it's full, preprare to allocate a new one + */ + + msg = (msgqueue_t *) console_msgq.q_prev; + if (q_isempty(&(console_msgq)) || (msg->len == MSGQUEUESIZE)) { + msg = NULL; + } + + /* + * Stuff characters into message chunks till we're done + */ + + while (length) { + + /* + * New chunk + */ + if (msg == NULL) { + + msg = (msgqueue_t *) KMALLOC(sizeof(msgqueue_t),0); + if (msg == NULL) return; + msg->len = 0; + q_enqueue(&console_msgq,(queue_t *) msg); + + /* + * Remove chunks to prevent chewing too much memory + */ + + while (q_count(&console_msgq) > MSGQUEUEMAX) { + msgqueue_t *dropmsg; + dropmsg = (msgqueue_t *) q_deqnext(&console_msgq); + if (dropmsg) KFREE(dropmsg); + } + } + + /* + * Save text. If we run off the end of the buffer, prepare + * to allocate a new one + */ + msg->data[msg->len++] = *buffer++; + length--; + if (msg->len == MSGQUEUESIZE) msg = NULL; + } +} + + +/* ********************************************************************* + * console_readnum(num,ch) + * + * Read digits from the console until we get a non-digit. This + * is used to process escape sequences like ESC [ digits ~ + * + * Input parameters: + * num - where to put returned number + * ch - pointer to character that starts sequence, returns + * character that terminated sequence + * + * Return value: + * nothing + ********************************************************************* */ + +static void console_readnum(int *num,char *ch) +{ + int total = 0; + + for (;;) { + total = (total * 10) + (*ch - '0'); + while (console_read(ch,1) != 1) { POLL(); } + if (!((*ch >= '0') && (*ch <= '9'))) break; + } + + *num = total; +} + + +/* ********************************************************************* + * console_readkey(void) + * + * Very simple ANSI escape sequence parser, returns virtual + * key codes for function keys, arrows, etc. + * + * Hold your lunch, three levels of nested switch statements! :-) + * + * Input parameters: + * nothing + * + * Return value: + * virtual key code + ********************************************************************* */ + +int console_readkey(void) +{ + unsigned char ch; + int num; + + GETCHAR(ch); + + switch (ch) { + case VKEY_ESC: + GETCHAR(ch); + switch (ch) { + case 'O': + GETCHAR(ch); + switch (ch) { + case 'P': + return VKEY_F1; + case 'Q': + return VKEY_F2; + case 'R': + return VKEY_F3; + case 'S': + return VKEY_F4; + } + return (int)ch; + + case '[': + GETCHAR(ch); + if ((ch >= '0') && (ch <= '9')) { + console_readnum(&num,&ch); + if (ch == '~') { + switch (num) { + case 2: + return VKEY_HOME; + case 3: + return VKEY_PGUP; + case 5: + if (console_mode == XTERM) return VKEY_PGUP; + return VKEY_END; + case 6: + if (console_mode == XTERM) return VKEY_PGDN; + return VKEY_PGDN; + case 11: + return VKEY_F1; + case 12: + return VKEY_F2; + case 13: + return VKEY_F3; + case 14: + return VKEY_F4; + case 15: + return VKEY_F5; + case 17: + return VKEY_F6; + case 18: + return VKEY_F7; + case 19: + return VKEY_F8; + case 20: + return VKEY_F9; + case 21: + return VKEY_F10; + case 23: + return VKEY_F11; + case 24: + return VKEY_F12; + } + return (int)ch; + } + } + else { + switch (ch) { + case 'A': + return VKEY_UP; + case 'B': + return VKEY_DOWN; + case 'C': + return VKEY_RIGHT; + case 'D': + return VKEY_LEFT; + case 'F': + return VKEY_HOME; + case 'H': + return VKEY_END; + default: + return (int) ch; + } + } + default: + return (int)ch; + + } + default: + return (int) ch; + } +} + + +/* ********************************************************************* + * console_xxx(...) + * + * Various small routines to write out cursor control sequences. + * + * Input parameters: + * # of iterations, if necessary + * + * Return value: + * nothing + ********************************************************************* */ + +static void console_backspace(int n) +{ + int t; + + for (t = 0; t < n; t++) console_write("\b",1); +} + +static void console_whiteout(int n) +{ + int t; + + for (t = 0; t < n; t++) console_write(" ",1); + for (t = 0; t < n; t++) console_write("\b",1); +} + + +static void console_eraseeol(void) +{ + console_write("\033[K",3); +} + +static void console_crlf(void) +{ + console_write("\r\n",2); +} + +/* ********************************************************************* + * console_readline(str,len) + * + * A simple 'gets' type routine for the console, with line + * editing support. + * + * Input parameters: + * prompt - prompt string + * str - pointer to user buffer + * len - length of user buffer + * + * Return value: + * number of characters read (terminating newline is not + * placed in the buffer) + ********************************************************************* */ + +int console_readline(char *prompt,char *str,int maxlen) +{ + int reading = 1; + int ch; + int idx = 0; + int len = 0; + int t; + int klen; + int recall; + int nosave = 0; + char *x; + char env[10]; + + console_inreadline++; + recall = console_nextsave; + + if (console_savedlines[console_nextsave]) { + KFREE(console_savedlines[console_nextsave]); + console_savedlines[console_nextsave] = NULL; + } + console_savedlines[console_nextsave] = strdup(""); + + if (prompt && *prompt) console_write(prompt,strlen(prompt)); + + POLL(); + while (reading) { + + /* + * If someone used console_log (above) or hit Control-C (below), + * redisplay the prompt and the string we've got so far. + */ + + if (console_redisplay) { + if (prompt && *prompt) console_write(prompt,strlen(prompt)); + console_write(str,idx); + console_redisplay = 0; + continue; + } + +#if defined(CONFIG_MIPS_BRCM) + + /* + * If a background process has set the global g_console_abort flag, stop + * reading from the keyboard. + */ + + if (g_console_abort) { + g_console_abort = 0; + break; + } + +#endif + + /* + * if nobody's typed anything, keep polling + */ + + if (console_status() == 0) { + POLL(); + continue; + } + + /* + * Get the char from the keyboard + */ + + ch = console_readkey(); + if (ch < 0) break; + if (ch == 0) continue; + + /* + * And dispatch it. Lots of yucky character manipulation follows + */ + + switch (ch) { + case CTRL('C'): /* Ctrl-C - cancel line */ + console_write("^C\r\n",4); + console_redisplay = 1; + nosave = 1; + idx = 0; + break; + + case 0x7f: /* Backspace, Delete */ + case CTRL('H'): + if (idx > 0) { + nosave = 0; + len--; + idx--; + console_write("\b",1); + if (len != idx) { + for (t = idx; t < len; t++) str[t] = str[t+1]; + console_write(&str[idx],len-idx); + console_whiteout(1); + console_backspace(len-idx); + } + else { + console_whiteout(1); + } + } + break; + + case CTRL('D'): /* Ctrl-D */ + if ((idx >= 0) && (len != idx)) { + nosave = 0; + len--; + for (t = idx; t < len; t++) str[t] = str[t+1]; + console_write(&str[idx],len-idx); + console_whiteout(1); + console_backspace(len-idx); + } + break; + + case CTRL('B'): /* cursor left */ + case VKEY_LEFT: + if (idx > 0) { + idx--; + console_backspace(1); + } + break; + + case CTRL('F'): /* cursor right */ + case VKEY_RIGHT: + if (idx < len) { + console_write(&str[idx],1); + idx++; + } + break; + + case CTRL('A'): /* cursor to BOL */ + console_backspace(idx); + idx = 0; + break; + + case CTRL('E'): /* cursor to EOL */ + if (len-idx > 0) console_write(&str[idx],len-idx); + idx = len; + break; + + case CTRL('K'): /* Kill to EOL */ + if (idx != len) { + str[len] = '\0'; + if (console_killbuffer) KFREE(console_killbuffer); + console_killbuffer = strdup(&str[idx]); + console_whiteout(len-idx); + len = idx; + nosave = 0; + } + break; + + case CTRL('Y'): /* Yank killed data */ + if (console_killbuffer == NULL) break; + klen = strlen(console_killbuffer); + if (klen == 0) break; + if (len + klen > maxlen) break; + nosave = 0; + for (t = len + klen; t > idx; t--) { + str[t-1] = str[t-klen-1]; + } + for (t = 0; t < klen; t++) str[t+idx] = console_killbuffer[t]; + len += klen; + console_write(&str[idx],len-idx); + idx += klen; + console_backspace(len-idx-1); + break; + + case CTRL('R'): /* Redisplay line */ + str[len] = 0; + console_crlf(); + console_write(prompt,strlen(prompt)); + console_write(str,len); + console_backspace(len-idx); + break; + + case CTRL('U'): /* Cancel line */ + console_backspace(idx); + console_eraseeol(); + if (len > 0) nosave = 1; + idx = 0; + len = 0; + break; + + case CTRL('M'): /* terminate */ + case CTRL('J'): + console_crlf(); + reading = 0; + break; + + case CTRL('P'): + case VKEY_UP: /* recall previous line */ + t = recall; + t--; + if (t < 0) t = MAXSAVELINES-1; + if (console_savedlines[t] == NULL) break; + recall = t; + console_backspace(idx); + strcpy(str,console_savedlines[recall]); + len = idx = strlen(console_savedlines[recall]); + console_eraseeol(); + console_write(str,len); + nosave = (t == ((console_nextsave - 1) % MAXSAVELINES)); + break; + + case CTRL('N'): + case VKEY_DOWN: /* Recall next line */ + t = recall; + t++; + if (t == MAXSAVELINES) t = 0; + if (console_savedlines[t] == NULL) break; + recall = t; + console_backspace(idx); + strcpy(str,console_savedlines[recall]); + len = idx = strlen(console_savedlines[recall]); + console_eraseeol(); + console_write(str,len); + nosave = 1; + break; + + case VKEY_F1: + case VKEY_F2: + case VKEY_F3: + case VKEY_F4: + case VKEY_F5: + case VKEY_F6: + case VKEY_F7: + case VKEY_F8: + case VKEY_F9: + case VKEY_F10: + case VKEY_F11: + case VKEY_F12: + sprintf(env,"F%d",ch-VKEY_F1+1); + x = env_getenv(env); + if (x) { + console_backspace(idx); + strcpy(str,x); + idx = len = strlen(str); + console_eraseeol(); + console_write(str,len); + console_crlf(); + reading = 0; + nosave = 1; + } + /* + * If F12 is undefined, it means "repeat last command" + */ + if (ch == VKEY_F12) { + t = recall; + t--; + if (t < 0) t = MAXSAVELINES-1; + if (console_savedlines[t] == NULL) break; + recall = t; + console_backspace(idx); + strcpy(str,console_savedlines[recall]); + len = idx = strlen(console_savedlines[recall]); + console_eraseeol(); + console_write(str,len); + console_crlf(); + reading = 0; + nosave = 1; + } + break; + + default: /* insert character */ + if (ch >= ' ') { + if (idx < (maxlen-1)) { + nosave = 0; + for (t = len; t > idx; t--) { + str[t] = str[t-1]; + } + str[idx] = ch; + len++; + if (len != idx) { + console_write(&str[idx],len-idx); + console_backspace(len-idx-1); + } + idx++; + } + } + break; + } + } + POLL(); + + console_inreadline--; + + str[len] = 0; + + if ((len != 0) && !nosave) { + if (console_savedlines[console_nextsave]) { + KFREE(console_savedlines[console_nextsave]); + } + console_savedlines[console_nextsave] = strdup(str); + console_nextsave++; + if (console_nextsave == MAXSAVELINES) console_nextsave = 0; + } + + return len; +} + +#else /* CFG_MINIMAL_SIZE */ +/* ********************************************************************* + * console_readline(str,len) + * + * A simple 'gets' type routine for the console, + * just calls the "noedit" variant for minimal code + * size builds. + * + * Input parameters: + * prompt - prompt string + * str - pointer to user buffer + * len - length of user buffer + * + * Return value: + * number of characters read (terminating newline is not + * placed in the buffer) + ********************************************************************* */ + +int console_readline(char *prompt,char *str,int len) +{ + return console_readline_noedit(prompt,str,len); +} + +#endif diff --git a/cfe/cfe/main/cfe_devfuncs.c b/cfe/cfe/main/cfe_devfuncs.c new file mode 100755 index 0000000..c3ab905 --- /dev/null +++ b/cfe/cfe/main/cfe_devfuncs.c @@ -0,0 +1,279 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Device Function stubs File: cfe_devfuncs.c + * + * This module contains device function stubs (small routines to + * call the standard "iocb" interface entry point to CFE). + * There should be one routine here per iocb function call. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" + +extern int cfe_iocb_dispatch(cfe_iocb_t *iocb); + +static int cfe_strlen(char *name) +{ + int count = 0; + + while (*name) { + count++; + name++; + } + + return count; +} + +int cfe_open(char *name) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_DEV_OPEN; + iocb.iocb_status = 0; + iocb.iocb_handle = 0; + iocb.iocb_flags = 0; + iocb.iocb_psize = sizeof(iocb_buffer_t); + iocb.plist.iocb_buffer.buf_offset = 0; + iocb.plist.iocb_buffer.buf_ptr = (unsigned char*)name; + iocb.plist.iocb_buffer.buf_length = cfe_strlen(name); + + cfe_iocb_dispatch(&iocb); + + return (iocb.iocb_status < 0) ? iocb.iocb_status : iocb.iocb_handle; +} + +int cfe_close(int handle) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_DEV_CLOSE; + iocb.iocb_status = 0; + iocb.iocb_handle = handle; + iocb.iocb_flags = 0; + iocb.iocb_psize = 0; + + cfe_iocb_dispatch(&iocb); + + return (iocb.iocb_status); + +} + +int cfe_readblk(int handle,cfe_offset_t offset,unsigned char *buffer,int length) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_DEV_READ; + iocb.iocb_status = 0; + iocb.iocb_handle = handle; + iocb.iocb_flags = 0; + iocb.iocb_psize = sizeof(iocb_buffer_t); + iocb.plist.iocb_buffer.buf_offset = offset; + iocb.plist.iocb_buffer.buf_ptr = buffer; + iocb.plist.iocb_buffer.buf_length = length; + + cfe_iocb_dispatch(&iocb); + + return (iocb.iocb_status < 0) ? iocb.iocb_status : iocb.plist.iocb_buffer.buf_retlen; +} + +int cfe_read(int handle,unsigned char *buffer,int length) +{ + return cfe_readblk(handle,0,buffer,length); +} + + +int cfe_writeblk(int handle,cfe_offset_t offset,unsigned char *buffer,int length) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_DEV_WRITE; + iocb.iocb_status = 0; + iocb.iocb_handle = handle; + iocb.iocb_flags = 0; + iocb.iocb_psize = sizeof(iocb_buffer_t); + iocb.plist.iocb_buffer.buf_offset = offset; + iocb.plist.iocb_buffer.buf_ptr = buffer; + iocb.plist.iocb_buffer.buf_length = length; + + cfe_iocb_dispatch(&iocb); + + return (iocb.iocb_status < 0) ? iocb.iocb_status : iocb.plist.iocb_buffer.buf_retlen; +} + +int cfe_write(int handle,unsigned char *buffer,int length) +{ + return cfe_writeblk(handle,0,buffer,length); +} + + +int cfe_ioctl(int handle,unsigned int ioctlnum, + unsigned char *buffer,int length,int *retlen, + cfe_offset_t offset) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_DEV_IOCTL; + iocb.iocb_status = 0; + iocb.iocb_handle = handle; + iocb.iocb_flags = 0; + iocb.iocb_psize = sizeof(iocb_buffer_t); + iocb.plist.iocb_buffer.buf_offset = offset; + iocb.plist.iocb_buffer.buf_ioctlcmd = (cfe_offset_t) ioctlnum; + iocb.plist.iocb_buffer.buf_ptr = buffer; + iocb.plist.iocb_buffer.buf_length = length; + + cfe_iocb_dispatch(&iocb); + + if (retlen) *retlen = iocb.plist.iocb_buffer.buf_retlen; + return iocb.iocb_status; +} + +int cfe_inpstat(int handle) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_DEV_INPSTAT; + iocb.iocb_status = 0; + iocb.iocb_handle = handle; + iocb.iocb_flags = 0; + iocb.iocb_psize = sizeof(iocb_inpstat_t); + iocb.plist.iocb_inpstat.inp_status = 0; + + cfe_iocb_dispatch(&iocb); + + if (iocb.iocb_status < 0) return iocb.iocb_status; + + return iocb.plist.iocb_inpstat.inp_status; + +} + +long long cfe_getticks(void) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_FW_GETTIME; + iocb.iocb_status = 0; + iocb.iocb_handle = 0; + iocb.iocb_flags = 0; + iocb.iocb_psize = sizeof(iocb_time_t); + iocb.plist.iocb_time.ticks = 0; + + cfe_iocb_dispatch(&iocb); + + return iocb.plist.iocb_time.ticks; + +} + +int cfe_getenv(char *name,char *dest,int destlen) +{ + cfe_iocb_t iocb; + + *dest = NULL; + + iocb.iocb_fcode = CFE_CMD_ENV_GET; + iocb.iocb_status = 0; + iocb.iocb_handle = 0; + iocb.iocb_flags = 0; + iocb.iocb_psize = sizeof(iocb_envbuf_t); + iocb.plist.iocb_envbuf.enum_idx = 0; + iocb.plist.iocb_envbuf.name_ptr = (unsigned char*)name; + iocb.plist.iocb_envbuf.name_length = strlen(name)+1; + iocb.plist.iocb_envbuf.val_ptr = (unsigned char*)dest; + iocb.plist.iocb_envbuf.val_length = destlen; + + cfe_iocb_dispatch(&iocb); + + return iocb.iocb_status; +} + +int cfe_exit(int warm,int code) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_FW_RESTART; + iocb.iocb_status = 0; + iocb.iocb_handle = 0; + iocb.iocb_flags = warm ? CFE_FLG_WARMSTART : 0; + iocb.iocb_psize = sizeof(iocb_exitstat_t); + iocb.plist.iocb_exitstat.status = code; + + cfe_iocb_dispatch(&iocb); + + return (iocb.iocb_status); + +} + +int cfe_flushcache(int flg) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_FW_FLUSHCACHE; + iocb.iocb_status = 0; + iocb.iocb_handle = 0; + iocb.iocb_flags = flg; + iocb.iocb_psize = 0; + + cfe_iocb_dispatch(&iocb); + + return iocb.iocb_status; +} + +int cfe_getdevinfo(char *name) +{ + cfe_iocb_t iocb; + + iocb.iocb_fcode = CFE_CMD_DEV_GETINFO; + iocb.iocb_status = 0; + iocb.iocb_handle = 0; + iocb.iocb_flags = 0; + iocb.iocb_psize = sizeof(iocb_buffer_t); + iocb.plist.iocb_buffer.buf_offset = 0; + iocb.plist.iocb_buffer.buf_ptr = (unsigned char*)name; + iocb.plist.iocb_buffer.buf_length = cfe_strlen(name); + + cfe_iocb_dispatch(&iocb); + + return (iocb.iocb_status < 0) ? iocb.iocb_status : (int)iocb.plist.iocb_buffer.buf_devflags; +} diff --git a/cfe/cfe/main/cfe_error.c b/cfe/cfe/main/cfe_error.c new file mode 100644 index 0000000..198e7a4 --- /dev/null +++ b/cfe/cfe/main/cfe_error.c @@ -0,0 +1,134 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Error strings File: cfe_error.h + * + * This file contains a mapping from error codes to strings + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "cfe.h" +#include "cfe_error.h" + +/* ********************************************************************* + * Types + ********************************************************************* */ + + +typedef struct errmap_s { + int errcode; + const char *string; +} errmap_t; + +/* ********************************************************************* + * Error code list + ********************************************************************* */ + +errmap_t cfe_errorstrings[] = { + {CFE_OK ,"No error"}, + {CFE_ERR ,"Error"}, + {CFE_ERR_INV_COMMAND ,"Invalid command"}, + {CFE_ERR_EOF ,"End of file reached"}, + {CFE_ERR_IOERR ,"I/O error"}, + {CFE_ERR_NOMEM ,"Insufficient memory"}, + {CFE_ERR_DEVNOTFOUND ,"Device not found"}, + {CFE_ERR_DEVOPEN ,"Device is open"}, + {CFE_ERR_INV_PARAM ,"Invalid parameter"}, + {CFE_ERR_ENVNOTFOUND ,"Environment variable not found"}, + {CFE_ERR_ENVREADONLY ,"Environment variable is read-only"}, + {CFE_ERR_NOTELF ,"Not an ELF-format executable"}, + {CFE_ERR_NOT32BIT ,"Not a 32-bit executable"}, + {CFE_ERR_WRONGENDIAN ,"Executable is wrong-endian"}, + {CFE_ERR_BADELFVERS ,"Invalid ELF file version"}, + {CFE_ERR_NOTMIPS ,"Not a MIPS ELF file"}, + {CFE_ERR_BADELFFMT ,"Invalid ELF file"}, + {CFE_ERR_BADADDR ,"Section would load outside available DRAM"}, + {CFE_ERR_FILENOTFOUND ,"File not found"}, + {CFE_ERR_UNSUPPORTED ,"Unsupported function"}, + {CFE_ERR_HOSTUNKNOWN ,"Host name unknown"}, + {CFE_ERR_TIMEOUT ,"Timeout occured"}, + {CFE_ERR_PROTOCOLERR ,"Network protocol error"}, + {CFE_ERR_NETDOWN ,"Network is down"}, + {CFE_ERR_NONAMESERVER ,"No name server configured"}, + {CFE_ERR_NOHANDLES ,"No more handles"}, + {CFE_ERR_ALREADYBOUND ,"Already bound"}, + {CFE_ERR_CANNOTSET ,"Cannot set network parameter"}, + {CFE_ERR_NOMORE ,"No more enumerated items"}, + {CFE_ERR_BADFILESYS ,"File system not recognized"}, + {CFE_ERR_FSNOTAVAIL ,"File system not available"}, + {CFE_ERR_INVBOOTBLOCK ,"Invalid boot block on disk"}, + {CFE_ERR_WRONGDEVTYPE ,"Device type is incorrect for boot method"}, + {CFE_ERR_BBCHECKSUM ,"Boot block checksum is invalid"}, + {CFE_ERR_BOOTPROGCHKSUM ,"Boot program checksum is invalid"}, + {CFE_ERR_LDRNOTAVAIL, "Loader is not available"}, + {CFE_ERR_NOTREADY, "Device is not ready"}, + {CFE_ERR_GETMEM, "Cannot get memory at specified address"}, + {CFE_ERR_SETMEM, "Cannot set memory at specified address"}, + {CFE_ERR_NOTCONN, "Socket is not connected"}, + {CFE_ERR_ADDRINUSE, "Address is in use"}, + {0,NULL}}; + + +/* ********************************************************************* + * cfe_errortext(err) + * + * Returns the text corresponding to a CFE error code + * + * Input parameters: + * err - error code + * + * Return value: + * string description of error + ********************************************************************* */ + +const char *cfe_errortext(int err) +{ + errmap_t *e = cfe_errorstrings; + + while (e->string) { + if (e->errcode == err) return e->string; + e++; + } + + return (const char *) "Unknown error"; +} + diff --git a/cfe/cfe/main/cfe_fatfs.c b/cfe/cfe/main/cfe_fatfs.c new file mode 100644 index 0000000..f2fa49f --- /dev/null +++ b/cfe/cfe/main/cfe_fatfs.c @@ -0,0 +1,1983 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * FAT file system File: cfe_fatfs.c + * + * This module knows how to read files from a FAT formatted + * file system (12 or 16 bit fats only for now) + * + * Eventually, we'll also include support for the FAT Translation + * Layer (FTL) on PCMCIA flash file systems. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_error.h" +#include "cfe_fileops.h" +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" + +#include "cfe_loader.h" + +#include "cfe.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define SECTORSIZE 512 +#define DIRENTRYSIZE 32 +#define DIRPERSECTOR (SECTORSIZE/DIRENTRYSIZE) + +/*#define _FATFS_DEBUG_*/ + +/* + * Bios Parameter Block offsets and values + */ + +#define BPB_JMPINSTR 0x00 +#define BPB_JMPINSTR_VALUE 0xEB +#define BPB_JMPINSTR_VALUE2 0xE9 +#define BPB_SEAL 0x1FE +#define BPB_SEAL_VALUE 0xAA55 + +#define BPB_BYTESPERSECTOR 0x0B +#define BPB_SECTORSPERCLUSTER 0x0D +#define BPB_RESERVEDSECTORS 0x0E +#define BPB_NUMFATS 0x10 +#define BPB_MAXROOTDIR 0x11 +#define BPB_TOTALSECTORS 0x13 +#define BPB_SECTORSPERFAT 0x16 +#define BPB_SECTORSPERTRACK 0x18 +#define BPB_NUMHEADS 0x1A +#define BPB_HIDDENSECTORS 0x1C +#define BPB_SYSTEMID 54 +#define BPB_MEDIADESCRIPTOR 21 +#define BPB_SIGNATURE 38 +#define BPB_SIGNATURE_VALUE1 0x28 +#define BPB_SIGNATURE_VALUE2 0x29 + +/* + * Partition types + */ + +#define PARTTYPE_EMPTY 0 +#define PARTTYPE_FAT12 1 +#define PARTTYPE_FAT16 4 +#define PARTTYPE_FAT16BIG 6 +#define PARTTYPE_FAT32 0x0B + +/* + * Partition table offsets + */ +#define PTABLE_STATUS 0 +#define PTABLE_STARTHEAD 1 +#define PTABLE_STARTSECCYL 2 /* 2 bytes */ +#define PTABLE_TYPE 4 +#define PTABLE_ENDHEAD 5 +#define PTABLE_ENDSECCYL 6 /* 2 bytes */ +#define PTABLE_BOOTSECTOR 8 /* 4 bytes */ +#define PTABLE_NUMSECTORS 12 /* 4 bytes */ + +#define PTABLE_SIZE 16 +#define PTABLE_COUNT 4 +#define PTABLE_OFFSET (512-2-(PTABLE_COUNT*PTABLE_SIZE)) + +#define PTABLE_STATUS_ACTIVE 0x80 + +/* + * Directory attributes + */ + +#define ATTRIB_NORMAL 0x00 +#define ATTRIB_READONLY 0x01 +#define ATTRIB_HIDDEN 0x02 +#define ATTRIB_SYSTEM 0x04 +#define ATTRIB_LABEL 0x08 +#define ATTRIB_DIR 0x10 +#define ATTRIB_ARCHIVE 0x20 + +#define ATTRIB_LFN 0x0F + +/* + * Macros to read fields in directory & BPB entries + */ + +#define READWORD(buffer,x) (((unsigned int) (buffer)[(x)]) | \ + (((unsigned int) (buffer)[(x)+1]) << 8)) + +#define READWORD32(buffer,x) (READWORD(buffer,(x)) | (READWORD(buffer,(x)+2) << 16)) + +#define READBYTE(buffer,x) ((unsigned int) (buffer)[(x)]) + +/* + * Directory entry offsets and values + */ + +#define DIR_CHECKSUM 13 +#define DIR_FILELENGTH 28 +#define DIR_STARTCLUSTER 26 +#define DIR_ATTRIB 11 +#define DIR_NAMEOFFSET 0 +#define DIR_NAMELEN 8 +#define DIR_EXTOFFSET 8 +#define DIR_EXTLEN 3 + +#define DIRENTRY_CHECKSUM(e) READBYTE(e,DIR_CHECKSUM) +#define DIRENTRY_FILELENGTH(e) READWORD32(e,DIR_FILELENGTH) +#define DIRENTRY_STARTCLUSTER(e) READWORD(e,DIR_STARTCLUSTER) +#define DIRENTRY_ATTRIB(e) READBYTE(e,DIR_ATTRIB) + +#define DIRENTRY_LAST 0 +#define DIRENTRY_DELETED 0xE5 +#define DIRENTRY_PARENTDIR 0x2E + +#define DIRENTRY_LFNIDX(e) READBYTE(e,0) +#define LFNIDX_MASK 0x1F +#define LFNIDX_END 0x40 +#define LFNIDX_MAX 20 + +/* ********************************************************************* + * Types + ********************************************************************* */ + +/* + * Internalized BPB + */ + +typedef struct bpb_s { + unsigned int bpb_bytespersector; + unsigned int bpb_sectorspercluster; + unsigned int bpb_reservedsectors; + unsigned int bpb_numfats; + unsigned int bpb_maxrootdir; + unsigned int bpb_totalsectors; + unsigned int bpb_sectorsperfat; + unsigned int bpb_sectorspertrack; + unsigned int bpb_numheads; + unsigned int bpb_hiddensectors; +} bpb_t; + +/* + * FAT Filesystem descriptor - contains working information + * about an "open" file system + */ + +typedef struct fatfs_s { + int fat_fh; + int fat_refcnt; + bpb_t fat_bpb; + int fat_twelvebit; + int fat_partstart; + uint8_t fat_dirsector[SECTORSIZE]; + int fat_dirsecnum; + uint8_t fat_fatsector[SECTORSIZE]; + int fat_fatsecnum; +} fatfs_t; + +/* + * FAT Chain - describes a series of FAT entries + */ + +typedef struct fatchain_s { + int fat_start; + uint16_t *fat_entries; + int fat_count; +} fatchain_t; + +/* + * FAT File descriptor - contains working information + * about an open file (including the filesystem info) + */ + +typedef struct fatfile_s { + fatfs_t *ff_fat; + int ff_filelength; + fatchain_t ff_chain; + int ff_curpos; + int ff_cursector; + uint8_t ff_sector[SECTORSIZE]; +} fatfile_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +static int fatfs_fileop_xinit(void **fsctx,void *filename); +static int fatfs_fileop_pinit(void **fsctx,void *filename); +static int fatfs_fileop_open(void **ref,void *fsctx,char *filename,int mode); +static int fatfs_fileop_read(void *ref,uint8_t *buf,int len); +static int fatfs_fileop_write(void *ref,uint8_t *buf,int len); +static int fatfs_fileop_seek(void *ref,int offset,int how); +static void fatfs_fileop_close(void *ref); +static void fatfs_fileop_uninit(void *fsctx); + +static int fatfs_check_for_partition_table(fatfs_t *fatfs); + +/* ********************************************************************* + * FAT fileio dispatch table + ********************************************************************* */ + +/* + * Raw FAT (no partition table) - used only on floppies + */ + +const fileio_dispatch_t fatfs_fileops = { + "rfat", + LOADFLG_NOBB, + fatfs_fileop_xinit, + fatfs_fileop_open, + fatfs_fileop_read, + fatfs_fileop_write, + fatfs_fileop_seek, + fatfs_fileop_close, + fatfs_fileop_uninit +}; + +/* + * Partitioned FAT - used on Zip disks, removable hard disks, + * hard disks, flash cards, etc. + */ + +const fileio_dispatch_t pfatfs_fileops = { + "fat", + LOADFLG_NOBB, + fatfs_fileop_pinit, + fatfs_fileop_open, + fatfs_fileop_read, + fatfs_fileop_write, + fatfs_fileop_seek, + fatfs_fileop_close, + fatfs_fileop_uninit +}; + + +/* ********************************************************************* + * fat_readsector(fatfs,sector,numsec,buffer) + * + * Read one or more sectors from the disk into memory + * + * Input parameters: + * fatfs - fat filesystem descriptor + * sector - sector number + * numsec - number of sectors to read + * buffer - buffer to read sectors into + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int fat_readsector(fatfs_t *fatfs,int sector,int numsec,uint8_t *buffer) +{ + int res; + + res = cfe_readblk(fatfs->fat_fh,(sector+fatfs->fat_partstart)*SECTORSIZE, + buffer,numsec*SECTORSIZE); + + if (res != numsec*SECTORSIZE) return CFE_ERR_IOERR; + + return 0; +} + + +/* ********************************************************************* + * fat_dumpbpb(bpb) + * + * Debug function; display fields in a BPB + * + * Input parameters: + * bpb - BIOS parameter block structure + * + * Return value: + * nothing + ********************************************************************* */ + +#ifdef _FATFS_DEBUG_ +static void fat_dumpbpb(bpb_t *bpb) +{ + xprintf("Bytes per sector %d\n",bpb->bpb_bytespersector); + xprintf("Sectors per cluster %d\n",bpb->bpb_sectorspercluster); + xprintf("Reserved sectors %d\n",bpb->bpb_reservedsectors); + xprintf("Number of FATs %d\n",bpb->bpb_numfats); + xprintf("Root dir entries %d\n",bpb->bpb_maxrootdir); + xprintf("Total sectors %d\n",bpb->bpb_totalsectors); + xprintf("Sectors per FAT %d\n",bpb->bpb_sectorsperfat); + xprintf("Sectors per track %d\n",bpb->bpb_sectorspertrack); + xprintf("Number of heads %d\n",bpb->bpb_numheads); + xprintf("Hidden sectors %d\n",bpb->bpb_hiddensectors); +} +#endif + +/* ********************************************************************* + * fat_findpart(fatfs) + * + * For partitioned disks, locate the active partition + * and set "fat_partstart" accordingly + * + * Input parameters: + * fatfs - FAT filesystem descriptor + * + * Return value: + * 0 if we found a valid partition table; else error code + ********************************************************************* */ + +static int fat_findpart(fatfs_t *fatfs) +{ + uint8_t buffer[SECTORSIZE]; + uint8_t *part; + int res; + int idx; + + fatfs->fat_partstart = 0; /* make sure we get real boot sector */ + res = fat_readsector(fatfs,0,1,buffer); + if (res < 0) return res; + + /* + * Normally you're supposed to check for a JMP instruction. + * At least that's what many people do. Flash MBRs don't start + * with JMP instructions, so just look for the seal. + * + * + * if (READBYTE(buffer,BPB_JMPINSTR) != BPB_JMPINSTR_VALUE) { + * return CFE_ERR_BADFILESYS; + * } + */ + + /* + * Check the seal at the end of th sector + */ + + if (READWORD(buffer,BPB_SEAL) != BPB_SEAL_VALUE) return CFE_ERR_BADFILESYS; + + /* + * Look for an active FAT partition. The partition we want must + * be the active one. We do not deal with extended partitions + * here. Hey, this is supposed to be boot code! + */ + + part = &buffer[PTABLE_OFFSET]; + for (idx = 0; idx < PTABLE_COUNT; idx++) { + if ((part[PTABLE_STATUS] == PTABLE_STATUS_ACTIVE) && + ((part[PTABLE_TYPE] == PARTTYPE_FAT12) || + (part[PTABLE_TYPE] == PARTTYPE_FAT16) || + (part[PTABLE_TYPE] == PARTTYPE_FAT16BIG))) { + break; + } + + part += PTABLE_SIZE; + } + + if (idx == PTABLE_COUNT) return CFE_ERR_BADFILESYS; + + /* + * The info we want is really just the pointer to the + * boot (BPB) sector. Get that and we'll use it for an + * offset into the disk later. + */ + + fatfs->fat_partstart = READWORD32(part,PTABLE_BOOTSECTOR); + + return 0; +} + + +/* ********************************************************************* + * fat_readbpb(fatfs) + * + * Read and internalize the BIOS Parameter Block + * + * Input parameters: + * fatfs - FAT filesystem descriptor + * + * Return value: + * 0 if ok + * else error code (usually, BPB is not valid) + ********************************************************************* */ + +static int fat_readbpb(fatfs_t *fatfs) +{ + uint8_t buffer[SECTORSIZE]; + int res; + + res = fat_readsector(fatfs,0,1,buffer); + if (res < 0) return res; + + if (READBYTE(buffer,BPB_JMPINSTR) != BPB_JMPINSTR_VALUE) return CFE_ERR_BADFILESYS; + if (READWORD(buffer,BPB_SEAL) != BPB_SEAL_VALUE) return CFE_ERR_BADFILESYS; + + fatfs->fat_bpb.bpb_bytespersector = READWORD(buffer,BPB_BYTESPERSECTOR); + fatfs->fat_bpb.bpb_sectorspercluster = READBYTE(buffer,BPB_SECTORSPERCLUSTER); + fatfs->fat_bpb.bpb_reservedsectors = READWORD(buffer,BPB_RESERVEDSECTORS); + fatfs->fat_bpb.bpb_numfats = READBYTE(buffer,BPB_NUMFATS); + fatfs->fat_bpb.bpb_maxrootdir = READWORD(buffer,BPB_MAXROOTDIR); + fatfs->fat_bpb.bpb_totalsectors = READWORD(buffer,BPB_TOTALSECTORS); + fatfs->fat_bpb.bpb_sectorsperfat = READWORD(buffer,BPB_SECTORSPERFAT); + fatfs->fat_bpb.bpb_sectorspertrack = READWORD(buffer,BPB_SECTORSPERTRACK); + fatfs->fat_bpb.bpb_numheads = READWORD(buffer,BPB_NUMHEADS); + fatfs->fat_bpb.bpb_hiddensectors = READWORD(buffer,BPB_HIDDENSECTORS); + + fatfs->fat_twelvebit = 1; + if (memcmp(&buffer[0x36],"FAT16 ",8) == 0) fatfs->fat_twelvebit = 0; + + if (fatfs->fat_bpb.bpb_bytespersector != SECTORSIZE) return CFE_ERR_BADFILESYS; + if (fatfs->fat_bpb.bpb_numfats > 2) return CFE_ERR_BADFILESYS; + + /* + * XXX sanity check other fields + */ + +#ifdef _FATFS_DEBUG_ + fat_dumpbpb(&(fatfs->fat_bpb)); +#endif + + return 0; +} + + + +/* ********************************************************************* + * fat_getentry(fatfs,entry) + * + * Read a FAT entry. This is more involved than you'd think, + * since we have to deal with 12 and 16 (and someday 32) bit FATs, + * and the nasty case where a 12-bit FAT entry crosses a sector + * boundary. + * + * Input parameters: + * fatfs - FAT filesystem descriptor + * entry - index of FAT entry + * + * Return value: + * FAT entry, or <0 if an error occured + ********************************************************************* */ + +static int fat_getfatentry(fatfs_t *fatfs,int entry) +{ + int fatsect; + int byteoffset; + int fatstart; + int fatoffset; + uint8_t b1,b2,b3; + int res; + + fatstart = fatfs->fat_bpb.bpb_reservedsectors; + + if (fatfs->fat_twelvebit) { + int odd; + odd = entry & 1; + byteoffset = ((entry & ~1) * 3) / 2; + fatsect = byteoffset / SECTORSIZE; + fatoffset = byteoffset % SECTORSIZE; + + if (fatfs->fat_fatsecnum != fatsect) { + res = fat_readsector(fatfs,fatsect+fatstart,1,fatfs->fat_fatsector); + if (res < 0) { + return res; + } + fatfs->fat_fatsecnum = fatsect; + } + + b1 = fatfs->fat_fatsector[fatoffset]; + + if ((fatoffset+1) >= SECTORSIZE) { + res = fat_readsector(fatfs,fatsect+1+fatstart,1,fatfs->fat_fatsector); + if (res < 0) { + return res; + } + fatfs->fat_fatsecnum = fatsect+1; + fatoffset -= SECTORSIZE; + } + + b2 = fatfs->fat_fatsector[fatoffset+1]; + + if ((fatoffset+2) >= SECTORSIZE) { + res = fat_readsector(fatfs,fatsect+1+fatstart,1,fatfs->fat_fatsector); + if (res < 0) { + return res; + } + fatfs->fat_fatsecnum = fatsect+1; + fatoffset -= SECTORSIZE; + } + + b3 = fatfs->fat_fatsector[fatoffset+2]; + + if (odd) { + return ((unsigned int) b3 << 4) + ((unsigned int) (b2 & 0xF0) >> 4); + } + else { + return ((unsigned int) (b2 & 0x0F) << 8) + ((unsigned int) b1); + } + + } + else { + byteoffset = entry * 2; + fatsect = byteoffset / SECTORSIZE; + fatoffset = byteoffset % SECTORSIZE; + + if (fatfs->fat_fatsecnum != fatsect) { + res = fat_readsector(fatfs,fatsect+fatstart,1,fatfs->fat_fatsector); + if (res < 0) { + return res; + } + fatfs->fat_fatsecnum = fatsect; + } + + b1 = fatfs->fat_fatsector[fatoffset]; + b2 = fatfs->fat_fatsector[fatoffset+1]; + return ((unsigned int) b1) + (((unsigned int) b2) << 8); + } +} + +/* ********************************************************************* + * fat_getrootdirentry(fatfs,entryidx,entry) + * + * Read a root directory entry. The FAT12/16 root directory + * is a contiguous group of sectors, whose size is specified in + * the BPB. This routine just digs out an entry from there + * + * Input parameters: + * fatfs - FAT filesystem descriptor + * entryidx - 0-based entry index to read + * entry - pointer to directory entry (32 bytes) + * + * Return value: + * 0 if ok + * <0 if error occured + ********************************************************************* */ + +static int fat_getrootdirentry(fatfs_t *fatfs,int entryidx,uint8_t *entry) +{ + int rootdirstart; + int rootdirsize; + int dirsecnum; + int res; + + if (entryidx >= fatfs->fat_bpb.bpb_maxrootdir) { + memset(entry,0,DIRENTRYSIZE); + return CFE_ERR_INV_PARAM; + } + + rootdirstart = fatfs->fat_bpb.bpb_reservedsectors + + fatfs->fat_bpb.bpb_numfats * fatfs->fat_bpb.bpb_sectorsperfat; + + rootdirsize = fatfs->fat_bpb.bpb_maxrootdir / DIRENTRYSIZE; + + dirsecnum = rootdirstart + entryidx / DIRPERSECTOR; + + if (fatfs->fat_dirsecnum != dirsecnum) { + res = fat_readsector(fatfs,dirsecnum,1,fatfs->fat_dirsector); + if (res < 0) { + return res; + } + fatfs->fat_dirsecnum = dirsecnum; + } + + memcpy(entry,&(fatfs->fat_dirsector[(entryidx % DIRPERSECTOR)*DIRENTRYSIZE]), + DIRENTRYSIZE); + + return 0; +} + +/* ********************************************************************* + * fat_checksumname(name) + * + * Calculate the "long filename" checksum for a given short name. + * All LFN directory entries associated with the short name are + * given the same checksum byte, to help keep the long name + * consistent. + * + * Input parameters: + * name - pointer to 32-byte directory entry + * + * Return value: + * checksum value + ********************************************************************* */ + +static uint8_t fat_checksumname(uint8_t *name) +{ + uint8_t sum = 0; + uint8_t newbit; + int idx; + + for (idx = 0; idx < 11; idx++) { + newbit = (sum & 1) ? 0x80 : 0x00; + sum >>= 1; + sum |= newbit; + sum += name[idx]; + } + + return sum; +} + +#ifdef _FATFS_DEBUG_ +void fat_dumpdirentry(uint8_t *entry); +void fat_dumpdirentry(uint8_t *entry) +{ + uint8_t name[32]; + int idx; + + if (entry[11] != ATTRIB_LFN) { + memcpy(name,entry,11); + name[11] = 0; + xprintf("%s %02X %04X %d\n", + name,DIRENTRY_ATTRIB(entry), + DIRENTRY_STARTCLUSTER(entry), + DIRENTRY_FILELENGTH(entry)); + } + else { + for (idx = 0; idx < 5; idx++) { + name[idx] = entry[(idx*2)+1]; + } + for (idx = 0; idx < 6; idx++) { + name[idx+5] = entry[(idx*2)+14]; + } + for (idx = 0; idx < 2; idx++) { + name[idx+11] = entry[(idx*2)+28]; + } + name[13] = '\0'; + xprintf("%02X: %s %04X cksum %02X\n",entry[0], + name,READWORD(entry,0x1A),entry[13]); + } +} +#endif + + +/* ********************************************************************* + * fat_walkfatchain(fat,start,arg,func) + * + * Walk a FAT chain, calling a callback routine for each entry + * we find along the way. + * + * Input parameters: + * fat - FAT filesystem descriptor + * start - starting FAT entry (from the directory, usually) + * arg - argument to pass to callback routine + * func - function to call for each FAT entry + * + * Return value: + * 0 if all elements processed + * <0 if error occured + * >0 if callback routine returned a nonzero value + ********************************************************************* */ + +static int fat_walkfatchain(fatfs_t *fat,int start, + void *arg, + int (*func)(fatfs_t *fat, + int e, + int prev_e, + void *arg)) +{ + int prev_e = 0; + int ending_e; + int e; + int res = 0; + + e = start; + + /* Note: ending FAT entry can be 0x(F)FF8..0x(F)FFF. We assume that the + 'getfatentry' call won't return values above that. */ + if (fat->fat_twelvebit) { + ending_e = 0xFF8; + } + else { + ending_e = 0xFFF8; + } + + while (e < ending_e) { + res = (*func)(fat,e,prev_e,arg); + if (res) break; + prev_e = e; + e = fat_getfatentry(fat,e); + if (e < 0) return e; + } + + return res; +} + +/* ********************************************************************* + * fat_getwalkfunc(fat,e,prev_e,arg) + * + * Callback routien to collect all of the FAT entries into + * a FAT chain descriptor + * + * Input parameters: + * fat - FAT filesystem descriptor + * e - current entry + * prev_e - previous entry (0 if first entry) + * arg - argument passed to fat_walkfatchain + * + * Return value: + * 0 to keep walking + * else value to return from fat_walkfatchain + ********************************************************************* */ + +static int fat_getwalkfunc(fatfs_t *fat,int e, + int prev_e,void *arg) +{ + fatchain_t *chain = arg; + + if (chain->fat_entries) { + chain->fat_entries[chain->fat_count] = (uint16_t) e; + } + + chain->fat_count++; + + return 0; +} + +/* ********************************************************************* + * fat_getchain(fat,start,chain) + * + * Walk an entire FAT chain and remember the chain in a + * FAT chain descriptor + * + * Input parameters: + * fat - FAT filesystem descriptor + * start - starting FAT entry + * chain - chain descriptor + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int fat_getchain(fatfs_t *fat,int start,fatchain_t *chain) +{ + int res; + + chain->fat_entries = NULL; + chain->fat_count = 0; + chain->fat_start = start; + + /* + * walk once to count the entries. + * + * For regular files, you probably don't have to do this + * since you can predict exactly how many FAT entries + * there are given the file length. + */ + + res = fat_walkfatchain(fat,start,chain,fat_getwalkfunc); + if (res < 0) return res; + + /* + * allocate space for the entries. Include one extra + * slot for the first entry, since the first entry + * does not actually appear in the FAT (the fat is + * only the 'next' pointers). + */ + + if (chain->fat_count == 0) return 0; + chain->fat_entries = KMALLOC((chain->fat_count+1)*sizeof(uint16_t),0); + chain->fat_count = 0; + + /* + * walk again to collect entries + */ + res = fat_walkfatchain(fat,start,chain,fat_getwalkfunc); + if (res < 0) return res; + + return chain->fat_count; +} + + +/* ********************************************************************* + * fat_freechain(chain) + * + * Free memory associated with a FAT chain + * + * Input parameters: + * chain - chain descriptor + * + * Return value: + * nothing + ********************************************************************* */ + +static void fat_freechain(fatchain_t *chain) +{ + if (chain->fat_entries) { + KFREE(chain->fat_entries); + chain->fat_entries = NULL; + } + chain->fat_count = 0; +} + +/* ********************************************************************* + * fat_clusteridx(fat,chain,idx) + * + * Index into a FAT chain and return the nth cluster number + * from the chain + * + * Input parameters: + * fat - fat filesystem descriptor + * chain - chain descriptor + * idx - index into FAT chain + * + * Return value: + * FAT entry at the nth index, or + * <0 if an error occured + ********************************************************************* */ +static int fat_clusteridx(fatfs_t *fat,fatchain_t *chain,int idx) +{ + if (idx >= chain->fat_count) return CFE_ERR_INV_PARAM; /* error! */ + return (int) (unsigned int) chain->fat_entries[idx]; +} + +/* ********************************************************************* + * fat_sectoridx(fat,chain,idx) + * + * Return the sector nunber of the nth sector in a given + * FAT chain. This routine knows how to translate cluster + * numbers into sector numbers. + * + * Input parameters: + * fat - FAT filesystem descriptor + * chain - FAT chain + * idx - index of which sector to find + * + * Return value: + * sector number + * <0 if an error occured + ********************************************************************* */ +static int fat_sectoridx(fatfs_t *fat,fatchain_t *chain,int idx) +{ + int clusteridx; + int sectoridx; + int sector; + int fatentry; + + clusteridx = idx / fat->fat_bpb.bpb_sectorspercluster; + sectoridx = idx % fat->fat_bpb.bpb_sectorspercluster; + + fatentry = fat_clusteridx(fat,chain,clusteridx); + + if (fatentry < 0) xprintf("ran off end of fat chain!\n"); + if (fatentry < 2) xprintf("fat entries should be >= 2\n"); + + sector = fat->fat_bpb.bpb_reservedsectors + + (fat->fat_bpb.bpb_maxrootdir * DIRENTRYSIZE)/SECTORSIZE + + (fat->fat_bpb.bpb_numfats * fat->fat_bpb.bpb_sectorsperfat) + + (fatentry - 2) * fat->fat_bpb.bpb_sectorspercluster + + sectoridx; + + return sector; +} + +/* ********************************************************************* + * fat_getsubdirentry(fat,chain,idx,direntry) + * + * This routine is similar to fat_getrootdirentry except it + * works on a subdirectory. FAT subdirectories are like files + * containing directory entries, so we use the "get nth sector + * in chain" routines to walk the chains of sectors reading directory + * entries. + * + * Input parameters: + * fat - FAT filesystem descriptor + * chain - FAT chain + * idx - index of entry to read + * direntry - place to put directory entry we read + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int fat_getsubdirentry(fatfs_t *fat,fatchain_t *chain, + int idx,uint8_t *direntry) +{ + int sector; + int res; + + sector = fat_sectoridx(fat,chain,idx/DIRPERSECTOR); + + if (sector < 0) return sector; + + if (fat->fat_dirsecnum != sector) { + res = fat_readsector(fat,sector,1,fat->fat_dirsector); + if (res < 0) { + return res; + } + fat->fat_dirsecnum = sector; + } + + memcpy(direntry,&(fat->fat_dirsector[(idx % DIRPERSECTOR)*DIRENTRYSIZE]), + DIRENTRYSIZE); + + return 0; +} + +/* ********************************************************************* + * fat_getshortname(direntry,name) + * + * Read the short filename from a directory entry, converting + * it into its classic 8.3 form + * + * Input parameters: + * direntry - directory entry + * name - place to put 8.3 name + * + * Return value: + * nothing + ********************************************************************* */ + +static void fat_getshortname(uint8_t *direntry,char *name) +{ + int idx; + + /* + * Collect the base file name + */ + + for (idx = DIR_NAMEOFFSET; idx < (DIR_NAMEOFFSET+DIR_NAMELEN); idx++) { + if (direntry[idx] == ' ') break; + *name++ = direntry[idx]; + } + + /* + * Put in the dot for the extension only if there + * is an extension. + */ + + if (direntry[DIR_EXTOFFSET] != ' ') *name++ = '.'; + + /* + * Collect the extension + */ + + for (idx = DIR_EXTOFFSET; idx < (DIR_EXTOFFSET+DIR_EXTLEN); idx++) { + if (direntry[idx] == ' ') break; + *name++ = direntry[idx]; + } + + *name = '\0'; +} + + +/* ********************************************************************* + * fat_getlongname(fat,chain,diridx,shortentry,longname) + * + * Look backwards in the directory to locate the long file name + * that corresponds to the short file name passed in 'shortentry' + * + * Input parameters: + * fat - FAT filesystem descriptor + * chain - chain describing current directory, or NULL + * if the current directory is the root directory + * diridx - index of the short file name + * shortentry - points to the short directory entry + * longname - buffer to receive long file name (up to 261 chars) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int fat_getlongname(fatfs_t *fat,fatchain_t *chain,int diridx, + uint8_t *shortentry,char *longname) +{ + int lfnidx = 1; + uint8_t checksum; + uint8_t direntry[DIRENTRYSIZE]; + int idx; + char *lfnptr; + int badlfn = 0; + + *longname = '\0'; + + /* + * idx is the entry # of the short name + */ + + checksum = fat_checksumname(shortentry); + + /* + * Start working backwards from current entry + * and collect pieces of the lfn + */ + + lfnptr = longname; + diridx--; + + while (diridx > 0) { + + /* + * Read previous entry + */ + + if (chain) { + fat_getsubdirentry(fat,chain,diridx,direntry); + } + else { + fat_getrootdirentry(fat,diridx,direntry); + } + + /* + * Checksum must match, it must have the right entry index, + * and it must have the LFN attribute + */ + + if (DIRENTRY_CHECKSUM(direntry) != checksum) { + badlfn = 1; + break; + } + if ((DIRENTRY_LFNIDX(direntry) & LFNIDX_MASK) != lfnidx) { + badlfn = 1; + break; + } + + if (DIRENTRY_ATTRIB(direntry) != ATTRIB_LFN) { + badlfn = 1; + break; + } + + /* + * Collect the chars from the filename. Note we + * don't deal well with real unicode chars here. + */ + + for (idx = 0; idx < 5; idx++) { + *lfnptr++ = direntry[(idx*2)+1]; + } + for (idx = 0; idx < 6; idx++) { + *lfnptr++ = direntry[(idx*2)+14]; + } + for (idx = 0; idx < 2; idx++) { + *lfnptr++ = direntry[(idx*2)+28]; + } + + /* + * Don't go too far + */ + + if (DIRENTRY_LFNIDX(direntry) & LFNIDX_END) break; + lfnidx++; + if (lfnidx > LFNIDX_MAX) { + badlfn = 1; + break; + } + + diridx--; + } + + /* + * Null terminate the lfn + */ + + *lfnptr = 0; + + if (badlfn) { + longname[0] = 0; + return CFE_ERR_FILENOTFOUND; + } + + return 0; +} + + +/* ********************************************************************* + * fat_scandir(fat,chain,name,direntry) + * + * Scan a single directory looking for a file name + * + * Input parameters: + * fat - FAT filesystem descriptor + * chain - FAT chain for directory or NULL for root directory + * name - name of file to look for (short or long name) + * direntry - place to put directory entry if we find one + * + * Return value: + * 1 if name was found + * 0 if name was not found + * else <0 is error code + ********************************************************************* */ + + +static int fat_scandir(fatfs_t *fat,fatchain_t *chain, + char *name,uint8_t *direntry) +{ + int idx; + int count; + char shortname[16]; + char longname[280]; + + /* + * Get directory size + */ + + if (chain) { + count = (chain->fat_count * fat->fat_bpb.bpb_sectorspercluster) * DIRPERSECTOR; + } + else { + count = (int) fat->fat_bpb.bpb_maxrootdir; + } + + /* + * Scan whole directory + */ + + for (idx = 0; idx < count; idx++) { + + /* + * Get entry by root or chain depending... + */ + + if (chain) { + fat_getsubdirentry(fat,chain,idx,direntry); + } + else { + fat_getrootdirentry(fat,idx,direntry); + } + + /* + * Ignore stuff we don't want to see + */ + + if (direntry[0] == DIRENTRY_LAST) break; /* stop if at end of dir */ + if (direntry[0] == DIRENTRY_DELETED) continue; /* skip deleted entries */ + if (direntry[0] == DIRENTRY_PARENTDIR) continue; /* skip ./.. entries */ + + if (DIRENTRY_ATTRIB(direntry) == ATTRIB_LFN) continue; /* skip LFNs */ + if (DIRENTRY_ATTRIB(direntry) & ATTRIB_LABEL) continue; /* skip volume labels */ + + /* + * Get actual file names from directory + */ + + fat_getshortname(direntry,shortname); + fat_getlongname(fat,chain,idx,direntry,longname); + + + if (name) { + if (strcmpi(name,shortname) == 0) return 1; + if (longname[0] && (strcmpi(name,longname) == 0)) return 1; + } + else { + xprintf("%-30s",longname[0] ? longname : shortname); +// xprintf(" Clus=%04X",DIRENTRY_STARTCLUSTER(direntry)); +// xprintf(" Attrib=%02X",DIRENTRY_ATTRIB(direntry)); +// xprintf(" Size=%d",DIRENTRY_FILELENGTH(direntry)); + xprintf("%d",DIRENTRY_FILELENGTH(direntry)); + xprintf("\n"); + } + } + + return 0; +} + +/* ********************************************************************* + * fat_findfile(fat,name,direntry) + * + * Locate a directory entry given a complete path name + * + * Input parameters: + * fat - FAT filesystem descriptor + * name - name of file to locate (forward or reverse slashses ok) + * direntry - place to put directory entry we find + * + * Return value: + * 0 if file not found + * 1 if file was found + * <0 if error occurs + ********************************************************************* */ + +static int fat_findfile(fatfs_t *fat,char *name,uint8_t *direntry) +{ + char *namecopy; + char *namepart; + char *ptr; + fatchain_t chain; + int res; + int e; + + /* + * Copy the name, we're going to hack it up + */ + + namecopy = strdup(name); + + /* + * Chew off the first piece up to the first slash. Remove + * a leading slash if it is there. + */ + + ptr = namecopy; + + if ((*ptr == '/') || (*ptr == '\\')) ptr++; + + namepart = ptr; + while (*ptr && (*ptr != '/') && (*ptr != '\\')) ptr++; + if (*ptr) *ptr++ = '\0'; + + /* + * Scan the root directory looking for the first piece + */ + + res = fat_scandir(fat,NULL,namepart,direntry); + if (res == 0) { + KFREE(namecopy); + return 0; /* file not found */ + } + + + /* + * Start scanning subdirectories until we run out + * of directory components. + */ + + namepart = ptr; + while (*ptr && (*ptr != '/') && (*ptr != '\\')) ptr++; + if (*ptr) *ptr++ = '\0'; + if (!*namepart) namepart = NULL; + + + while (namepart) { + + /* + * Scan the subdirectory + */ + + e = DIRENTRY_STARTCLUSTER(direntry); + memset(&chain,0,sizeof(chain)); + fat_getchain(fat,e,&chain); + res = fat_scandir(fat,&chain,namepart,direntry); + if (res == 0) { + break; + } + fat_freechain(&chain); + + /* + * Advance to the next piece + */ + + namepart = ptr; + while (*ptr && (*ptr != '/') && (*ptr != '\\')) ptr++; + if (*ptr) *ptr++ = '\0'; + if (!*namepart) namepart = NULL; + + /* + * If there's more to go and we hit something that + * is not a directory, stop here. + */ + + if (namepart && !(DIRENTRY_ATTRIB(direntry) & ATTRIB_DIR)) { + res = 0; + } + } + + KFREE(namecopy); + + /* + * The last piece we enumerate has to be a file. + */ + + if ((res > 0) && + (DIRENTRY_ATTRIB(direntry) & ATTRIB_DIR)) { + return 0; + } + + return res; +} + + +/* ********************************************************************* + * fat_init(fat,name) + * + * Create the filesystem descriptor and attach to the hardware + * device. + * + * Input parameters: + * fat - filesystem descriptor + * name - hardware device name + * part - true to look for partition tables + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int fat_init(fatfs_t *fat,char *name,int part) +{ + int res; + + memset(fat,0,sizeof(fatfs_t)); + fat->fat_dirsecnum = -1; + fat->fat_fatsecnum = -1; + + fat->fat_fh = cfe_open(name); + + if (fat->fat_fh < 0) return fat->fat_fh; + + res = fatfs_check_for_partition_table(fat); + /* If we were able to figure it out, use that as the default */ + if (res >= 0) part = res; + + if (part) { + res = fat_findpart(fat); + if (res < 0) { + cfe_close(fat->fat_fh); + fat->fat_fh = -1; + return res; + } + } + + res = fat_readbpb(fat); + if (res != 0) { + cfe_close(fat->fat_fh); + fat->fat_fh = -1; + return res; + } + + return 0; +} + +/* ********************************************************************* + * fat_uninit(fat) + * + * Uninit the filesystem descriptor and release any resources + * we allocated. + * + * Input parameters: + * fat - filesystem descriptor + * + * Return value: + * nothing + ********************************************************************* */ + +static void fat_uninit(fatfs_t *fat) +{ + if (fat->fat_fh >= 0) cfe_close(fat->fat_fh); + fat->fat_fh = -1; +} + +int fatfs_fileop_dir(void *fsctx); +int fatfs_fileop_dir(void *fsctx) +{ + fatfs_t *fatfs = fsctx; + uint8_t direntry[32]; + + fat_scandir(fatfs,NULL,NULL,direntry); + + return 0; +} + +/* ********************************************************************* + * fatfs_fileop_init(fsctx,devname) + * + * Create a FAT filesystem context and open the associated + * block device. + * + * Input parameters: + * fsctx - file system context (return pointer) + * devname - device name to open + * part - true to look for a partition table + * + * Return value: + * 0 if ok, else error + ********************************************************************* */ + +static int fatfs_fileop_init(void **fsctx,char *devname,int part) +{ + int res; + fatfs_t *fatfs; + + /* + * Allocate a file system context + */ + + fatfs = (fatfs_t *) KMALLOC(sizeof(fatfs_t),0); + if (!fatfs) return CFE_ERR_NOMEM; + + /* + * Open a handle to the underlying device + */ + + res = fat_init(fatfs,devname,part); + if (res != 0) { + KFREE(fatfs); + return res; + } + + *fsctx = fatfs; + + return 0; +} + +/* ********************************************************************* + * fatfs_check_for_partition_table(fatfs) + * + * This routine attempts to determine if the disk contains a + * partition table or if it contains a standard MS-DOS boot recod. + * We try to find both, and return what we find, or an error + * if it is still unclear. + * + * Input parameters: + * fatfs - fat filesystem context + * + * Return value: + * 0 if no partition table + * 1 if partition table + * <0 = error occured, could not tell or I/O error + ********************************************************************* */ + +static int fatfs_check_for_partition_table(fatfs_t *fatfs) +{ + int res; + uint8_t buffer[SECTORSIZE]; + uint8_t *part; + int idx; + int foundit = 0; + + /* + * Read sector 0 + */ + + fatfs->fat_partstart = 0; + res = fat_readsector(fatfs,0,1,buffer); + if (res < 0) return res; + + /* + * Check the seal at the end of th sector. Both + * boot sector and MBR should contain this seal. + */ + if (READWORD(buffer,BPB_SEAL) != BPB_SEAL_VALUE) { + res = CFE_ERR_BADFILESYS; + return res; + } + + /* + * See Microsoft Knowledgebase article # Q140418, it contains + * a good description of the boot sector format. + * + * If the extended information is present, and SystemID is "FAT" + * and the "bytes per sector" is 512, assume it's a regular boot block + */ + + if (((buffer[BPB_SIGNATURE] == BPB_SIGNATURE_VALUE1) || + (buffer[BPB_SIGNATURE] == BPB_SIGNATURE_VALUE2)) && + (memcmp(&buffer[BPB_SYSTEMID],"FAT",3) == 0) && + (READWORD(buffer,BPB_BYTESPERSECTOR) == 512)) { + /* Not partitioned */ + res = 0; + return res; + } + + /* If no extended information is present, check a few other key values. */ + + if ((READWORD(buffer,BPB_BYTESPERSECTOR) == 512) && + (READWORD(buffer,BPB_RESERVEDSECTORS) >= 1) && + ((READWORD(buffer,BPB_MEDIADESCRIPTOR) & 0xF0) == 0xF0)) { + res = 0; + return res; + } + + /* + * If we're still confused, look for a partition table with a valid FAT + * partition on it. We might not detect a partition table that has + * only non-FAT partitions on it, like a disk with all Linux partitions, + * but that is fine here in the FATFS module, since we only want to + * find FAT partitions anyway. + */ + part = &buffer[PTABLE_OFFSET]; + for (idx = 0; idx < PTABLE_COUNT; idx++) { + + if (((part[PTABLE_STATUS] == PTABLE_STATUS_ACTIVE) || + (part[PTABLE_STATUS] == 0x00)) && + ((part[PTABLE_TYPE] == PARTTYPE_FAT12) || + (part[PTABLE_TYPE] == PARTTYPE_FAT16) || + (part[PTABLE_TYPE] == PARTTYPE_FAT16BIG))) { + foundit = 1; + res = 1; /*Partition table present*/ + break; + } + part += PTABLE_SIZE; + } + + /* + * If at this point we did not find what we were looking for, + * return an error. + */ + if (foundit) { + res = 1; /*Partition table is present.*/ + } + else { + /*Error! We can't decide if partition table exists or not*/ + res = CFE_ERR_BADFILESYS; + } + + return res; +} + +static int fatfs_fileop_xinit(void **fsctx,void *dev) +{ + char *devname = (char *) dev; + + return fatfs_fileop_init(fsctx,devname,0); +} + +static int fatfs_fileop_pinit(void **fsctx,void *dev) +{ + char *devname = (char *) dev; + + return fatfs_fileop_init(fsctx,devname,1); +} + + + +/* ********************************************************************* + * fatfs_fileop_open(ref,name) + * + * Open a file on the FAT device. + * + * Input parameters: + * ref - place to store pointer to fileinfo + * fsctx - filesystem context + * name - name of file to open + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int fatfs_fileop_open(void **ref,void *fsctx,char *name,int mode) +{ + int res; + uint8_t direntry[DIRENTRYSIZE]; + fatfile_t *ff; + fatfs_t *fatfs; + + if (mode != FILE_MODE_READ) return CFE_ERR_UNSUPPORTED; + + fatfs = (fatfs_t *) fsctx; + + ff = (fatfile_t *) KMALLOC(sizeof(fatfile_t),0); + if (ff == NULL) return CFE_ERR_NOMEM; + + memset(ff,0,sizeof(fatfile_t)); + + ff->ff_fat = fatfs; + + res = fat_findfile(ff->ff_fat,name,direntry); + if (res <= 0) { + return CFE_ERR_FILENOTFOUND; /* not found */ + } + + /* + * Okay, the file was found. Enumerate the FAT chain + * associated with this file. + */ + + ff->ff_filelength = DIRENTRY_FILELENGTH(direntry); + + ff->ff_curpos = 0; + ff->ff_cursector = -1; + + res = fat_getchain(ff->ff_fat, + DIRENTRY_STARTCLUSTER(direntry), + &(ff->ff_chain)); + + if (res < 0) { + KFREE(ff); + return res; + } + + /* + * Return the file handle + */ + + + fatfs->fat_refcnt++; + *ref = (void *) ff; + return 0; +} + + +/* ********************************************************************* + * fatfs_fileop_close(ref) + * + * Close the file. + * + * Input parameters: + * ref - pointer to open file information + * + * Return value: + * nothing + ********************************************************************* */ + +static void fatfs_fileop_close(void *ref) +{ + fatfile_t *file = (fatfile_t *) ref; + fatfs_t *fatctx = file->ff_fat; + + fatctx->fat_refcnt--; + + fat_freechain(&(file->ff_chain)); + KFREE(file); +} + + +/* ********************************************************************* + * fatfs_fileop_uninit(ref) + * + * Uninitialize the file system. + * + * Input parameters: + * fsctx - filesystem context + * + * Return value: + * nothing + ********************************************************************* */ +static void fatfs_fileop_uninit(void *fsctx) +{ + fatfs_t *fatctx = (fatfs_t *) fsctx; + + if (fatctx->fat_refcnt) { + xprintf("fatfs_fileop_unint: warning: refcnt should be zero\n"); + } + + fat_uninit(fatctx); + + KFREE(fatctx); +} + + +/* ********************************************************************* + * fatfs_fileop_seek(ref,offset,how) + * + * Move the file pointer within the file + * + * Input parameters: + * ref - pointer to open file information + * offset - new file location or distance to move + * how - method for moving + * + * Return value: + * new file offset + * <0 if error occured + ********************************************************************* */ + +static int fatfs_fileop_seek(void *ref,int offset,int how) +{ + fatfile_t *file = (fatfile_t *) ref; + + switch (how) { + case FILE_SEEK_BEGINNING: + file->ff_curpos = offset; + break; + case FILE_SEEK_CURRENT: + file->ff_curpos += offset; + break; + default: + break; + } + + if (file->ff_curpos >= file->ff_filelength) { + file->ff_curpos = file->ff_filelength; + } + + return file->ff_curpos; +} + + +/* ********************************************************************* + * fatfs_fileop_read(ref,buf,len) + * + * Read data from the file. + * + * Input parameters: + * ref - pointer to open file information + * buf - buffer to read data into + * len - number of bytes to read + * + * Return value: + * number of bytes read + * <0 if error occured + * 0 means eof + ********************************************************************* */ + +static int fatfs_fileop_read(void *ref,uint8_t *buf,int len) +{ + fatfile_t *file = (fatfile_t *) ref; + int amtcopy; + int ttlcopy = 0; + int offset; + int sector; + int secidx; + int origpos; + int res; + uint8_t temp_buf[SECTORSIZE]; + + /* + * Remember orig position in case we have an error + */ + + origpos = file->ff_curpos; + + /* + * bounds check the length based on the file length + */ + + if ((file->ff_curpos + len) > file->ff_filelength) { + len = file->ff_filelength - file->ff_curpos; + } + + res = 0; + + /* + * while ther is still data to be transferred + */ + + + while (len) { + + /* + * Calculate the sector offset and index in the sector + */ + + offset = file->ff_curpos % SECTORSIZE; + secidx = file->ff_curpos / SECTORSIZE; + + sector = fat_sectoridx(file->ff_fat,&(file->ff_chain),secidx); + + if (sector < 0) { + xprintf("should not happen, sector = -1!\n"); + return sector; + } + + /* + * first transfer up to the sector boundary + */ + + amtcopy = len; + if (amtcopy > (SECTORSIZE-offset)) { + amtcopy = (SECTORSIZE-offset); + } + + /* + * If transferring exactly a sector, on a sector + * boundary, read the data directly into the user buffer + * + * Extra credit: See if we can transfer more than one + * sector at a time, by determining if we can read a run of + * contiguous sectors (very likely) + * + * Otherwise: read into the sector buffer and + * transfer the data to user memory. + */ + + if ((offset == 0) && (amtcopy == SECTORSIZE)) { + res = fat_readsector(file->ff_fat,sector,1,temp_buf); + if (res < 0) { + xprintf("I/O error!\n"); + break; + } + memcpy(buf,temp_buf,amtcopy); + } + else { + if (file->ff_cursector != sector) { + res = fat_readsector(file->ff_fat,sector,1,file->ff_sector); + if (res < 0) { + break; + } + file->ff_cursector = sector; + } + memcpy(buf,&(file->ff_sector[offset]),amtcopy); + } + + /* + * Adjust/update all our pointers. + */ + + buf += amtcopy; + file->ff_curpos += amtcopy; + ttlcopy += amtcopy; + len -= amtcopy; + + /* + * see if we ran off the end of the file. Should not + * be necessary. + */ + + if (file->ff_curpos >= file->ff_filelength) { + /* should not be necessary */ + break; + } + } + + /* + * If an error occured, get out now. + */ + + if (res < 0) { + file->ff_curpos = origpos; + return res; + } + + return ttlcopy; + +} + +static int fatfs_fileop_write(void *ref,uint8_t *buf,int len) +{ + return CFE_ERR_UNSUPPORTED; +} + + +#if 0 + +void main(int argc,char *argv[]) +{ + fatfs_t fat; + int idx; + unsigned int e; + uint8_t direntry[DIRENTRYSIZE]; + fatchain_t chain; + int res; + + + fat_init(&fat,"floppy.raw"); + + + if (fat_readbpb(&fat) == 0) { + fat_dumpbpb(&fat.fat_bpb); + } + +#if 0 + for (idx = 0; idx < (int) fat.fat_bpb.bpb_maxrootdir; idx++) { + fat_getrootdirentry(&fat,idx,direntry); + if (direntry[0] == 0) break; + if (direntry[0] == 0xE5) continue; + xprintf("%3d: ",idx); + fat_dumpdirentry(direntry); + } +#endif + + fat_scandir(&fat,NULL,NULL,direntry); + + for (e = 0x150; e < 0x160; e++) { + xprintf("Entry %03X is %03X\n",e,fat_getfatentry(&fat,e)); + } + +#if 0 + e = 0x36E; + while (e != 0xFFF) { + e = fat_getfatentry(&fat,e); + xprintf("%03X ",e); + } +#endif + + + xprintf("\n\n"); + e = 0x36E; + memset(&chain,0,sizeof(chain)); + fat_getchain(&fat,e,&chain); + fat_scandir(&fat,&chain,NULL,direntry); + fat_freechain(&chain); + + xprintf("\n\n"); + e = 0x36F; + memset(&chain,0,sizeof(chain)); + fat_getchain(&fat,e,&chain); + fat_scandir(&fat,&chain,NULL,direntry); + fat_freechain(&chain); + + xprintf("\n\n"); + e = 0x370; + memset(&chain,0,sizeof(chain)); + fat_getchain(&fat,e,&chain); + fat_scandir(&fat,&chain,NULL,direntry); + fat_freechain(&chain); + + xprintf("\n\n"); + + res = fat_findfile(&fat,argc > 1 ? argv[1] : "/usr/local/include/ansidecl.h",direntry); + xprintf("res = %d\n",res); + + if (res) fat_dumpdirentry(direntry); + + close(fat.fat_fh); +} + +void main(int argc,char *argv[]) +{ + void *ref; + int res; + char buffer[257]; + int total = 0; + +// res = fatfs_fileop_open(&ref,"floppy.raw:/usr/local/include/bfdlink.h"); + res = fatfs_fileop_open(&ref,"floppy.raw:/idedrv.h"); + + if (res != 0) { + xprintf("Could not open file: %d\n",res); + exit(1); + } + + for (;;) { + res = fatfs_fileop_read(ref,buffer,39); +// xprintf("read returned %d\n",res); + if (res <= 0) break; + + if (res > 0) { + total += res; + buffer[res] = 0; + xprintf("%s",buffer); + } + } + + if (res < 0) xprintf("error! \n"); + + xprintf("[total %d]\n",total); + + fatfs_fileop_close(ref); + + exit(0); + +} + +#endif diff --git a/cfe/cfe/main/cfe_filesys.c b/cfe/cfe/main/cfe_filesys.c new file mode 100755 index 0000000..569d7bc --- /dev/null +++ b/cfe/cfe/main/cfe_filesys.c @@ -0,0 +1,343 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Filesystem manager File: cfe_filesys.c + * + * This module maintains the list of available file systems. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_malloc.h" + +#include "cfe_error.h" +#include "cfe_fileops.h" + +#include "cfe.h" + +#include "bsp_config.h" + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern const fileio_dispatch_t raw_fileops; +#if CFG_NETWORK +extern const fileio_dispatch_t tftp_fileops; +#if (CFG_TCP) && (CFG_HTTPFS) +extern const fileio_dispatch_t http_fileops; +#endif +#endif +#if CFG_FATFS +extern const fileio_dispatch_t fatfs_fileops; +extern const fileio_dispatch_t pfatfs_fileops; +#endif +#if CFG_ZLIB +extern const fileio_dispatch_t zlibfs_fileops; +#endif + +/* ********************************************************************* + * File system list + ********************************************************************* */ + +static const fileio_dispatch_t * const cfe_filesystems[] = { +#if !defined(CONFIG_MIPS_BRCM) + &raw_fileops, +#endif +#if CFG_NETWORK + &tftp_fileops, +#if (CFG_TCP) & (CFG_HTTPFS) + &http_fileops, +#endif +#endif +#if CFG_FATFS + &fatfs_fileops, + &pfatfs_fileops, +#endif +#if CFG_ZLIB + &zlibfs_fileops, +#endif + NULL +}; + +/* ********************************************************************* + * cfe_findfilesys(name) + * + * Locate the dispatch record for a particular file system. + * + * Input parameters: + * name - name of filesys to locate + * + * Return value: + * pointer to dispatch table or NULL if not found + ********************************************************************* */ + +const fileio_dispatch_t *cfe_findfilesys(const char *name) +{ + const fileio_dispatch_t * const *disp; + + disp = cfe_filesystems; + + while (*disp) { + if (strcmp((*disp)->method,name) == 0) return *disp; + disp++; + } + + return NULL; +} + +/* ********************************************************************* + * fs_init(name,fsctx,device) + * + * Initialize a filesystem context + * + * Input parameters: + * name - name of file system + * fsctx - returns a filesystem context + * device - device name or other info + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ +int fs_init(char *fsname,fileio_ctx_t **fsctx,void *device) +{ + fileio_ctx_t *ctx; + int res; + const fileio_dispatch_t *ops; + + ops = cfe_findfilesys((const char *)fsname); + if (!ops) return CFE_ERR_FSNOTAVAIL; + + ctx = (fileio_ctx_t *) KMALLOC(sizeof(fileio_ctx_t),0); + if (!ctx) return CFE_ERR_NOMEM; + + ctx->ops = ops; + res = BDINIT(ops,&(ctx->fsctx),device); + + if (res != 0) { + KFREE(ctx); + } + + *fsctx = ctx; + + return res; +} + + +/* ********************************************************************* + * fs_hook(fsctx,name) + * + * "Hook" a filesystem to attach a filter, like a decompression + * or decryption engine. + * + * Input parameters: + * fsctx - result from a previous fs_init + * name - name of fs to hook onto the beginning + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +int fs_hook(fileio_ctx_t *fsctx,char *fsname) +{ + void *hookfsctx; + const fileio_dispatch_t *ops; + int res; + + /* + * Find the hook filesystem (well, actually a filter) + */ + + ops = cfe_findfilesys((const char *)fsname); + if (!ops) return CFE_ERR_FSNOTAVAIL; + + /* + * initialize our hook file filter. + */ + + res = BDINIT(ops,&hookfsctx,fsctx); + if (res != 0) return res; + + /* + * Now replace dispatch table for current filesystem + * with the hook's dispatch table. When fs_read is called, + * we'll go to the hook, and the hook will call the original. + * + * When fs_uninit is called, the hook will call the original's + * uninit routine. + */ + + fsctx->ops = ops; + fsctx->fsctx = hookfsctx; + + return 0; + +} + +/* ********************************************************************* + * fs_uninit(fsctx) + * + * Uninitialize a file system context. + * + * Input parameters: + * fsctx - filesystem context to remove (from fs_init) + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ +int fs_uninit(fileio_ctx_t *fsctx) +{ + BDUNINIT(fsctx->ops,fsctx->fsctx); + + KFREE(fsctx); + + return 0; +} + + +/* ********************************************************************* + * fs_open(fsctx,ref,filename,mode) + * + * Open a file on the file system + * + * Input parameters: + * fsctx - filesystem context (from fs_init) + * ref - returns file handle + * filename - name of file to open + * mode - file open mode + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ +int fs_open(fileio_ctx_t *fsctx,void **ref,char *filename,int mode) +{ + return BDOPEN2(fsctx->ops,ref,fsctx->fsctx,filename,mode); +} + +/* ********************************************************************* + * fs_close(fsctx,ref) + * + * Close a file on the file system + * + * Input parameters: + * fsctx - filesystem context (from fs_init) + * ref - file handle (from fs_open) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ +int fs_close(fileio_ctx_t *fsctx,void *ref) +{ + BDCLOSE(fsctx->ops,ref); + + return 0; +} + + +/* ********************************************************************* + * fs_read(fsctx,ref,buffer,len) + * + * Read data from the device. + * + * Input parameters: + * fsctx - filesystem context (from fs_init) + * ref - file handle (from fs_open) + * buffer - buffer pointer + * len - length + * + * Return value: + * number of bytes read + * 0=eof + * <0 = error + ********************************************************************* */ + +int fs_read(fileio_ctx_t *fsctx,void *ref,uint8_t *buffer,int len) +{ + return BDREAD(fsctx->ops,ref,buffer,len); +} + +/* ********************************************************************* + * fs_write(fsctx,ref,buffer,len) + * + * write data from the device. + * + * Input parameters: + * fsctx - filesystem context (from fs_init) + * ref - file handle (from fs_open) + * buffer - buffer pointer + * len - length + * + * Return value: + * number of bytes written + * 0=eof + * <0 = error + ********************************************************************* */ + +int fs_write(fileio_ctx_t *fsctx,void *ref,uint8_t *buffer,int len) +{ + return BDWRITE(fsctx->ops,ref,buffer,len); +} + +/* ********************************************************************* + * fs_seek(fsctx,ref,offset,how) + * + * move file pointer on the device + * + * Input parameters: + * fsctx - filesystem context (from fs_init) + * ref - file handle (from fs_open) + * offset - distance to move + * how - origin (FILE_SEEK_xxx) + * + * Return value: + * new offset + * <0 = error + ********************************************************************* */ + +int fs_seek(fileio_ctx_t *fsctx,void *ref,int offset,int how) +{ + return BDSEEK(fsctx->ops,ref,offset,how); +} diff --git a/cfe/cfe/main/cfe_httpfs.c b/cfe/cfe/main/cfe_httpfs.c new file mode 100644 index 0000000..4ebad4c --- /dev/null +++ b/cfe/cfe/main/cfe_httpfs.c @@ -0,0 +1,396 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * "HTTP" file system File: cfe_httpfs.c + * + * This filesystem driver lets you read files from an HTTP + * server. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_error.h" +#include "cfe_fileops.h" +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_console.h" + +#include "cfe.h" + +#include "bsp_config.h" + +#if (CFG_TCP) && (CFG_HTTPFS) + +#include "net_ebuf.h" +#include "net_api.h" + + +/* ********************************************************************* + * HTTP context + ********************************************************************* */ + +/* + * File system context - describes overall file system info, + * such as the handle to the underlying device. + */ + +typedef struct http_fsctx_s { + int http_tmp; /* context not really needed */ +} http_fsctx_t; + +/* + * File context - describes an open file on the file system. + */ + +#define HTTP_BUFSIZE 1024 +typedef struct http_file_s { + http_fsctx_t *http_fsctx; + int http_socket; + uint8_t http_buffer[HTTP_BUFSIZE]; + uint8_t *http_bptr; + int http_blen; + int http_offset; + char *http_filename; +} http_file_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +static int http_fileop_init(void **fsctx,void *devicename); +static int http_fileop_open(void **ref,void *fsctx,char *filename,int mode); +static int http_fileop_read(void *ref,uint8_t *buf,int len); +static int http_fileop_write(void *ref,uint8_t *buf,int len); +static int http_fileop_seek(void *ref,int offset,int how); +static void http_fileop_close(void *ref); +static void http_fileop_uninit(void *fsctx); + +/* ********************************************************************* + * RAW fileio dispatch table + ********************************************************************* */ + +const fileio_dispatch_t http_fileops = { + "http", + FSYS_TYPE_NETWORK, + http_fileop_init, + http_fileop_open, + http_fileop_read, + http_fileop_write, + http_fileop_seek, + http_fileop_close, + http_fileop_uninit +}; + +static int http_fileop_init(void **newfsctx,void *dev) +{ + http_fsctx_t *fsctx; + + *newfsctx = NULL; + + fsctx = KMALLOC(sizeof(http_fsctx_t),0); + if (!fsctx) { + return CFE_ERR_NOMEM; + } + + fsctx->http_tmp = 0; + *newfsctx = fsctx; + + return 0; +} + +static int http_fileop_open(void **ref,void *fsctx_arg,char *filename,int mode) +{ + http_fsctx_t *fsctx; + http_file_t *file; + char temp[200]; + char *hostname, *filen; + int hlen; + int termidx; + int res; + int err = 0; + char *hptr; + char *tok; + uint8_t hostaddr[IP_ADDR_LEN]; + uint8_t termstr[4]; + uint8_t b; + + if (mode != FILE_MODE_READ) return CFE_ERR_UNSUPPORTED; + + fsctx = (http_fsctx_t *) fsctx_arg; + + file = KMALLOC(sizeof(http_file_t),0); + if (!file) { + return CFE_ERR_NOMEM; + } + + file->http_filename = lib_strdup(filename); + if (!file->http_filename) { + KFREE(file); + return CFE_ERR_NOMEM; + } + + lib_chop_filename(file->http_filename,&hostname,&filen); + + /* + * Look up remote host + */ + + res = dns_lookup(hostname,hostaddr); + if (res < 0) { + KFREE(file); + return res; + } + + file->http_socket = tcp_socket(); + if (file->http_socket < 0) { + KFREE(file->http_filename); + KFREE(file); + return -1; + } + + /* + * Connect to remote host. + */ + + tcp_setflags(file->http_socket,0); /* set socket to blocking */ + res = tcp_connect(file->http_socket,hostaddr,80); + + if (res < 0) { + tcp_close(file->http_socket); + KFREE(file->http_filename); + KFREE(file); + return res; + } + + /* + * Send GET command. Supply the hostname (for HTTP 1.1 requirements) + * and set the connection to close as soon as all the data is received. + */ + + hlen = sprintf(temp,"GET /%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",filen,hostname); + + res = tcp_send(file->http_socket,temp,hlen); + if (res < 0) { + tcp_close(file->http_socket); + KFREE(file->http_filename); + KFREE(file); + return res; + } + + /* + * Read bytes until we either reach EOF or we see "\r\n\r\n" + * This is the server's status string. + */ + + termstr[0] = '\r'; termstr[1] = '\n'; + termstr[2] = '\r'; termstr[3] = '\n'; + termidx = 0; + + file->http_offset = 0; + file->http_blen = 0; + file->http_bptr = file->http_buffer; + + res = 0; + for (;;) { + res = tcp_recv(file->http_socket,&b,1); + if (res < 0) break; + if (b == termstr[termidx]) { + termidx++; + if (termidx == 4) break; + } + else { + termidx = 0; + } + + /* + * Save the bytes from the header up to our buffer + * size. It's okay if we don't save it all, + * since all we want is the result code which comes + * first. + */ + + if (file->http_blen < (HTTP_BUFSIZE-1)) { + *(file->http_bptr) = b; + file->http_bptr++; + file->http_blen++; + } + } + + /* + * Premature EOFs are not good, bail now. + */ + + if (res < 0) { + err = CFE_ERR_EOF; + goto protocolerr; + } + + /* + * Skip past the HTTP response header and grab the result code. + * Sanity check it a little. + */ + + *(file->http_bptr) = 0; + + hptr = file->http_buffer; + tok = lib_gettoken(&hptr); + if (!tok || (memcmp(tok,"HTTP",4) != 0)) { + err = CFE_ERR_PROTOCOLERR; + goto protocolerr; + } + + tok = lib_gettoken(&hptr); + if (!tok) { + err = CFE_ERR_PROTOCOLERR; + goto protocolerr; + } + + switch (lib_atoi(tok)) { + case 200: + err = 0; + break; + case 404: + err = CFE_ERR_FILENOTFOUND; + break; + + } + + /* + * If we get to here, the file is okay and we're about to receive data. + */ + + if (err == 0) { + *ref = file; + return 0; + } + +protocolerr: + tcp_close(file->http_socket); + KFREE(file->http_filename); + KFREE(file); + *ref = NULL; + return err; +} + +static int http_fileop_read(void *ref,uint8_t *buf,int len) +{ + http_file_t *file = (http_file_t *) ref; + int res; + + res = tcp_recv(file->http_socket,buf,len); + + if (res > 0) { + file->http_offset += res; + return res; + } + + return 0; /* Any error becomes "EOF" */ +} + +static int http_fileop_write(void *ref,uint8_t *buf,int len) +{ + return CFE_ERR_UNSUPPORTED; +} + +static int http_fileop_seek(void *ref,int offset,int how) +{ + http_file_t *file = (http_file_t *) ref; + int newoffset; + int res; + int buflen; + + switch (how) { + case FILE_SEEK_BEGINNING: + newoffset = offset; + break; + case FILE_SEEK_CURRENT: + newoffset = file->http_offset + offset; + break; + default: + newoffset = offset; + break; + } + + /* + * Can't seek backwards. + */ + if (newoffset < file->http_offset) { + return CFE_ERR_UNSUPPORTED; + } + + /* + * Eat data till offset reaches where we want. + */ + + while (file->http_offset != newoffset) { + buflen = HTTP_BUFSIZE; + if (buflen > (newoffset - file->http_offset)) buflen = (newoffset-file->http_offset); + res = tcp_recv(file->http_socket,file->http_buffer,buflen); + if (res < 0) break; + file->http_offset += res; + } + + return file->http_offset; +} + + +static void http_fileop_close(void *ref) +{ + http_file_t *file = (http_file_t *) ref; + + tcp_close(file->http_socket); + KFREE(file->http_filename); + KFREE(file); +} + +static void http_fileop_uninit(void *fsctx_arg) +{ + http_fsctx_t *fsctx = (http_fsctx_t *) fsctx_arg; + + KFREE(fsctx); +} + +#endif diff --git a/cfe/cfe/main/cfe_iocb_dispatch.c b/cfe/cfe/main/cfe_iocb_dispatch.c new file mode 100755 index 0000000..24aea0a --- /dev/null +++ b/cfe/cfe/main/cfe_iocb_dispatch.c @@ -0,0 +1,647 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCB dispatcher File: cfe_iocb_dispatch.c + * + * This routine is the main API dispatch for CFE. User API + * calls, via the ROM entry point, get dispatched to routines + * in this module. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_queue.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_iocb.h" +#include "cfe_error.h" +#include "cfe_device.h" +#include "cfe_timer.h" +#include "cfe_mem.h" +#include "cfe_fileops.h" +#include "cfe_boot.h" +#include "env_subr.h" +#include "cfe.h" +#include "cfe_console.h" +#include "bsp_config.h" +#include "initdata.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define HV 1 /* handle valid */ + +#ifndef CFG_BOARD_ID +#define CFG_BOARD_ID 0 +#endif + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +cfe_devctx_t *cfe_handle_table[CFE_MAX_HANDLE]; + +extern void _cfe_flushcache(int); + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int cfe_iocb_dispatch(cfe_iocb_t *iocb); +void cfe_device_poll(void *); + +#if CFG_MULTI_CPUS +extern int altcpu_cmd_start(uint64_t,uint64_t *); +extern int altcpu_cmd_stop(uint64_t); +#endif + +/* ********************************************************************* + * Dispatch table + ********************************************************************* */ + +struct cfe_cmd_dispatch_s { + int plistsize; + int flags; + int (*func)(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +}; + + +static int cfe_cmd_fw_getinfo(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_fw_restart(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_fw_boot(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_fw_cpuctl(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_fw_gettime(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_fw_memenum(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_fw_flushcache(cfe_devctx_t *ctx,cfe_iocb_t *iocb); + +static int cfe_cmd_dev_gethandle(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_dev_enum(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_dev_open(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_dev_inpstat(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_dev_read(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_dev_write(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_dev_ioctl(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_dev_close(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_dev_getinfo(cfe_devctx_t *ctx,cfe_iocb_t *iocb); + +static int cfe_cmd_env_enum(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_env_get(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_env_set(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +static int cfe_cmd_env_del(cfe_devctx_t *ctx,cfe_iocb_t *iocb); + +const static struct cfe_cmd_dispatch_s cfe_cmd_dispatch_table[CFE_CMD_MAX] = { + {sizeof(iocb_fwinfo_t), 0, cfe_cmd_fw_getinfo}, /* 0 : CFE_CMD_FW_GETINFO */ + {sizeof(iocb_exitstat_t),0, cfe_cmd_fw_restart}, /* 1 : CFE_CMD_FW_RESTART */ + {sizeof(iocb_buffer_t), 0, cfe_cmd_fw_boot}, /* 2 : CFE_CMD_FW_BOOT */ + {sizeof(iocb_cpuctl_t), 0, cfe_cmd_fw_cpuctl}, /* 3 : CFE_CMD_FW_CPUCTL */ + {sizeof(iocb_time_t), 0, cfe_cmd_fw_gettime}, /* 4 : CFE_CMD_FW_GETTIME */ + {sizeof(iocb_meminfo_t),0, cfe_cmd_fw_memenum}, /* 5 : CFE_CMD_FW_MEMENUM */ + {0, 0, cfe_cmd_fw_flushcache}, /* 6 : CFE_CMD_FW_FLUSHCACHE */ + {-1, 0, NULL}, /* 7 : */ + {-1, 0, NULL}, /* 8 : */ + {0, 0, cfe_cmd_dev_gethandle}, /* 9 : CFE_CMD_DEV_GETHANDLE */ + {sizeof(iocb_envbuf_t), 0, cfe_cmd_dev_enum}, /* 10 : CFE_CMD_DEV_ENUM */ + {sizeof(iocb_buffer_t), 0, cfe_cmd_dev_open}, /* 11 : CFE_CMD_DEV_OPEN */ + {sizeof(iocb_inpstat_t),HV, cfe_cmd_dev_inpstat}, /* 12 : CFE_CMD_DEV_INPSTAT */ + {sizeof(iocb_buffer_t), HV, cfe_cmd_dev_read}, /* 13 : CFE_CMD_DEV_READ */ + {sizeof(iocb_buffer_t), HV, cfe_cmd_dev_write}, /* 14 : CFE_CMD_DEV_WRITE */ + {sizeof(iocb_buffer_t), HV, cfe_cmd_dev_ioctl}, /* 15 : CFE_CMD_DEV_IOCTL */ + {0, HV, cfe_cmd_dev_close}, /* 16 : CFE_CMD_DEV_CLOSE */ + {sizeof(iocb_buffer_t), 0, cfe_cmd_dev_getinfo}, /* 17 : CFE_CMD_DEV_GETINFO */ + {-1, 0, NULL}, /* 18 : */ + {-1, 0, NULL}, /* 19 : */ + {sizeof(iocb_envbuf_t), 0, cfe_cmd_env_enum}, /* 20 : CFE_CMD_ENV_ENUM */ + {-1, 0, NULL}, /* 21 : */ + {sizeof(iocb_envbuf_t), 0, cfe_cmd_env_get}, /* 22 : CFE_CMD_ENV_GET */ + {sizeof(iocb_envbuf_t), 0, cfe_cmd_env_set}, /* 23 : CFE_CMD_ENV_SET */ + {sizeof(iocb_envbuf_t), 0, cfe_cmd_env_del}, /* 24 : CFE_CMD_ENV_DEL */ + {-1, 0, NULL}, /* 25 : */ + {-1, 0, NULL}, /* 26 : */ + {-1, 0, NULL}, /* 27 : */ + {-1, 0, NULL}, /* 28 : */ + {-1, 0, NULL}, /* 29 : */ + {-1, 0, NULL}, /* 30 : */ + {-1, 0, NULL} /* 31 : */ +}; + +/* ********************************************************************* + * IOCB dispatch routines + ********************************************************************* */ + +void cfe_device_poll(void *x) +{ + int idx; + cfe_devctx_t **ctx = cfe_handle_table; + + for (idx = 0; idx < CFE_MAX_HANDLE; idx++,ctx++) { + if ((*ctx) && ((*ctx)->dev_dev->dev_dispatch->dev_poll)) { + (*ctx)->dev_dev->dev_dispatch->dev_poll(*ctx,cfe_ticks); + } + } +} + +int cfe_iocb_dispatch(cfe_iocb_t *iocb) +{ + const struct cfe_cmd_dispatch_s *disp; + int res; + cfe_devctx_t *ctx; + + /* + * Check for commands codes out of range + */ + + if ((iocb->iocb_fcode < 0) || (iocb->iocb_fcode >= CFE_CMD_MAX)) { + iocb->iocb_status = CFE_ERR_INV_COMMAND; + return iocb->iocb_status; + } + + /* + * Check for command codes in range but invalid + */ + + disp = &cfe_cmd_dispatch_table[iocb->iocb_fcode]; + + if (disp->plistsize < 0) { + iocb->iocb_status = CFE_ERR_INV_COMMAND; + return iocb->iocb_status; + } + + /* + * Check for invalid parameter list size + */ + + if (disp->plistsize != iocb->iocb_psize) { + iocb->iocb_status = CFE_ERR_INV_PARAM; + return iocb->iocb_status; + } + + /* + * Determine handle + */ + + ctx = NULL; + if (disp->flags & HV) { + if ((iocb->iocb_handle >= CFE_MAX_HANDLE) || + (iocb->iocb_handle < 0) || + (cfe_handle_table[iocb->iocb_handle] == NULL)){ + iocb->iocb_status = CFE_ERR_INV_PARAM; + return iocb->iocb_status; + } + ctx = cfe_handle_table[iocb->iocb_handle]; + } + + /* + * Dispatch to handler routine + */ + + res = (*disp->func)(ctx,iocb); + + iocb->iocb_status = res; + return res; +} + +static int cfe_newhandle(void) +{ + int idx; + + for (idx = 0; idx < CFE_MAX_HANDLE; idx++) { + if (cfe_handle_table[idx] == NULL) break; + } + + if (idx == CFE_MAX_HANDLE) return -1; + + return idx; +} + + +/* ********************************************************************* + * Implementation routines for each IOCB function + ********************************************************************* */ + +static int cfe_cmd_fw_getinfo(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + iocb_fwinfo_t *info = &iocb->plist.iocb_fwinfo; + + info->fwi_version = (CFE_VER_MAJOR << 16) | + (CFE_VER_MINOR << 8) | + (CFE_VER_BUILD); + info->fwi_totalmem = ((cfe_int64_t) mem_totalsize) << 20; + info->fwi_flags = +#ifdef __long64 + CFE_FWI_64BIT | +#else + CFE_FWI_32BIT | +#endif +#if (CFG_EMBEDDED_PIC) + CFE_FWI_RELOC | +#endif +#if (!CFG_RUNFROMKSEG0) + CFE_FWI_UNCACHED | +#endif +#if CFG_MULTI_CPUS + CFE_FWI_MULTICPU | +#endif +#ifdef _VERILOG_ + CFE_FWI_RTLSIM | +#endif +#ifdef _FUNCSIM_ + CFE_FWI_FUNCSIM | +#endif + 0; + + info->fwi_boardid = CFG_BOARD_ID; + info->fwi_bootarea_pa = (cfe_int64_t) mem_bootarea_start; + info->fwi_bootarea_va = BOOT_START_ADDRESS; + info->fwi_bootarea_size = (cfe_int64_t) mem_bootarea_size; + info->fwi_reserved1 = 0; + info->fwi_reserved2 = 0; + info->fwi_reserved3 = 0; + + return CFE_OK; +} + +static int cfe_cmd_fw_restart(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + if (iocb->iocb_flags & CFE_FLG_WARMSTART) { + cfe_warmstart(iocb->plist.iocb_exitstat.status); + } + else { + cfe_restart(); + } + + /* should not get here */ + + return CFE_OK; +} + +static int cfe_cmd_fw_boot(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + return CFE_ERR_INV_COMMAND; /* not implemented yet */ +} + +static int cfe_cmd_fw_cpuctl(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ +#if CFG_MULTI_CPUS + int res; + uint64_t startargs[4]; + + switch (iocb->plist.iocb_cpuctl.cpu_command) { + case CFE_CPU_CMD_START: + + startargs[0] = iocb->plist.iocb_cpuctl.start_addr; + startargs[1] = iocb->plist.iocb_cpuctl.sp_val; + startargs[2] = iocb->plist.iocb_cpuctl.gp_val; + startargs[3] = iocb->plist.iocb_cpuctl.a1_val; + + res = altcpu_cmd_start(iocb->plist.iocb_cpuctl.cpu_number, + startargs); + break; + case CFE_CPU_CMD_STOP: + res = altcpu_cmd_stop(iocb->plist.iocb_cpuctl.cpu_number); + break; + default: + res = CFE_ERR_INV_PARAM; + } + + return res; +#else + return CFE_ERR_INV_COMMAND; +#endif +} + +static int cfe_cmd_fw_gettime(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + POLL(); + + iocb->plist.iocb_time.ticks = cfe_ticks; + + return CFE_OK; +} + +static int cfe_cmd_fw_memenum(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int type; + int res; + uint64_t addr,size; + + res = cfe_arena_enum(iocb->plist.iocb_meminfo.mi_idx, + &type, + &addr, + &size, + (iocb->iocb_flags & CFE_FLG_FULL_ARENA) ? TRUE : FALSE); + + iocb->plist.iocb_meminfo.mi_addr = addr; + iocb->plist.iocb_meminfo.mi_size = size; + iocb->plist.iocb_meminfo.mi_type = type; + + if (res == 0) { + if (type == MEMTYPE_DRAM_AVAILABLE) { + iocb->plist.iocb_meminfo.mi_type = CFE_MI_AVAILABLE; + } + else { + iocb->plist.iocb_meminfo.mi_type = CFE_MI_RESERVED; + } + } + + return res; +} + +static int cfe_cmd_fw_flushcache(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + _cfe_flushcache(iocb->iocb_flags); + return CFE_OK; +} + +static int cfe_cmd_dev_enum(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + return CFE_ERR_INV_COMMAND; +} + +static int cfe_cmd_dev_gethandle(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + switch (iocb->iocb_flags) { + case CFE_STDHANDLE_CONSOLE: + if (console_handle == -1) return CFE_ERR_DEVNOTFOUND; + iocb->iocb_handle = console_handle; + return CFE_OK; + break; + default: + return CFE_ERR_INV_PARAM; + } +} + +static int cfe_cmd_dev_open(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int h; + cfe_device_t *dev; + char devname[64]; + int res; + + /* + * Get device name + */ + + xstrncpy(devname,(char*)iocb->plist.iocb_buffer.buf_ptr,sizeof(devname)); + + /* + * Find device in device table + */ + + dev = cfe_finddev(devname); + if (!dev) return CFE_ERR_DEVNOTFOUND; + + /* + * Fail if someone else already has the device open + */ + + if (dev->dev_opencount > 0) return CFE_ERR_DEVOPEN; + + /* + * Generate a new handle + */ + + h = cfe_newhandle(); + if (h < 0) return CFE_ERR_NOMEM; + + /* + * Allocate a context + */ + + ctx = (cfe_devctx_t *) KMALLOC(sizeof(cfe_devctx_t),0); + if (ctx == NULL) return CFE_ERR_NOMEM; + + /* + * Fill in the context + */ + + ctx->dev_dev = dev; + ctx->dev_softc = dev->dev_softc; + ctx->dev_openinfo = NULL; + + /* + * Call driver's open func + */ + + res = dev->dev_dispatch->dev_open(ctx); + + if (res != 0) { + KFREE(ctx); + return res; + } + + /* + * Increment refcnt and save handle + */ + + dev->dev_opencount++; + cfe_handle_table[h] = ctx; + iocb->iocb_handle = h; + + /* + * Success! + */ + + return CFE_OK; +} + +static int cfe_cmd_dev_inpstat(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int status; + + status = ctx->dev_dev->dev_dispatch->dev_inpstat(ctx,&(iocb->plist.iocb_inpstat)); + + return status; +} + +static int cfe_cmd_dev_read(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int status; + + status = ctx->dev_dev->dev_dispatch->dev_read(ctx,&(iocb->plist.iocb_buffer)); + + return status; +} + +static int cfe_cmd_dev_write(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int status; + + status = ctx->dev_dev->dev_dispatch->dev_write(ctx,&(iocb->plist.iocb_buffer)); + + return status; +} + +static int cfe_cmd_dev_ioctl(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int status; + + status = ctx->dev_dev->dev_dispatch->dev_ioctl(ctx,&(iocb->plist.iocb_buffer)); + + return status; +} + +static int cfe_cmd_dev_close(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + /* + * Call device close function + */ + + ctx->dev_dev->dev_dispatch->dev_close(ctx); + + /* + * Decrement refcnt + */ + + ctx->dev_dev->dev_opencount--; + + /* + * Wipe out handle + */ + + cfe_handle_table[iocb->iocb_handle] = NULL; + + /* + * Release device context + */ + + KFREE(ctx); + + return CFE_OK; +} + +static int cfe_cmd_dev_getinfo(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + cfe_device_t *dev; + char devname[64]; + char *x; + + /* + * Get device name + */ + + xstrncpy(devname,(char*)iocb->plist.iocb_buffer.buf_ptr,sizeof(devname)); + + /* + * Find device in device table + */ + + if ((x = strchr(devname,':'))) *x = '\0'; + dev = cfe_finddev(devname); + if (!dev) return CFE_ERR_DEVNOTFOUND; + + /* + * Return device class + */ + + iocb->plist.iocb_buffer.buf_devflags = dev->dev_class; + + return CFE_OK; +} + +static int cfe_cmd_env_enum(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int vallen,namelen,res; + + namelen = iocb->plist.iocb_envbuf.name_length; + vallen = iocb->plist.iocb_envbuf.val_length; + + res = env_enum(iocb->plist.iocb_envbuf.enum_idx, + (char*)iocb->plist.iocb_envbuf.name_ptr, + &namelen, + (char*)iocb->plist.iocb_envbuf.val_ptr, + &vallen); + + if (res < 0) return CFE_ERR_ENVNOTFOUND; + + return CFE_OK; +} + + +static int cfe_cmd_env_get(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + char *env; + + env = env_getenv((char*)iocb->plist.iocb_envbuf.name_ptr); + + if (env == NULL) return CFE_ERR_ENVNOTFOUND; + + xstrncpy((char*)iocb->plist.iocb_envbuf.val_ptr, + env, + iocb->plist.iocb_envbuf.val_length); + + return CFE_OK; +} + +static int cfe_cmd_env_set(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int res; + int flg; + + + flg = (iocb->iocb_flags & CFE_FLG_ENV_PERMANENT) ? + ENV_FLG_NORMAL : ENV_FLG_BUILTIN; + + res = env_setenv((char*)iocb->plist.iocb_envbuf.name_ptr, + (char*)iocb->plist.iocb_envbuf.val_ptr, + flg); + + if (res == 0) { + if (iocb->iocb_flags & CFE_FLG_ENV_PERMANENT) res = env_save(); + } + + if (res < 0) return res; + + return CFE_OK; +} + +static int cfe_cmd_env_del(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + int res; + + res = env_delenv((char*)iocb->plist.iocb_envbuf.name_ptr); + + return res; +} + + + diff --git a/cfe/cfe/main/cfe_ldr_elf.c b/cfe/cfe/main/cfe_ldr_elf.c new file mode 100644 index 0000000..0581241 --- /dev/null +++ b/cfe/cfe/main/cfe_ldr_elf.c @@ -0,0 +1,396 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * ELF Program Loader File: cfe_ldr_elf.c + * + * This program parses ELF executables and loads them into memory. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_error.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" +#include "cfe_mem.h" + +#include "cfe.h" +#include "cfe_loader.h" +#include "cfe_fileops.h" +#include "elf.h" + +#include "cfe_boot.h" + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +static int cfe_elfload(cfe_loadargs_t *la); + +const cfe_loader_t elfloader = { + "elf", + cfe_elfload, + 0}; + +/* ********************************************************************* + * readprogsegment(fsctx,ref,addr,size) + * + * Read a program segment, generally corresponding to one + * section of the file. + * + * Input parameters: + * fsctx - file I/O dispatch + * ref - reference data for open file handle + * addr - target virtual address + * size - size of region to read + * + * Return value: + * Number of bytes copied or <0 if error occured + ********************************************************************* */ + +static int readprogsegment(fileio_ctx_t *fsctx,void *ref, + void *addr,int size,int flags) +{ + int res; + +#ifdef __long64 + if (flags & LOADFLG_NOISY) xprintf("0x%016llx/%d ",addr,size); +#else + if (flags & LOADFLG_NOISY) xprintf("0x%x/%d ",addr,size); +#endif + + if (!cfe_arena_loadcheck((uintptr_t) addr,size)) { + return CFE_ERR_BADADDR; + } + + res = fs_read(fsctx,ref,addr,size); + + if (res < 0) return CFE_ERR_IOERR; + if (res != size) return CFE_ERR_BADELFFMT; + + return size; +} + + +/* ********************************************************************* + * readclearbss(addr,size) + * + * Process a BSS section, zeroing memory corresponding to + * the BSS. + * + * Input parameters: + * addr - address to zero + * size - length of area to zero + * + * Return value: + * number of zeroed bytes or <0 if error occured + ********************************************************************* */ + +static int readclearbss(void *addr,int size,int flags) +{ + +#ifdef __long64 + if (flags & LOADFLG_NOISY) xprintf("0x%016llx/%d ",addr,size); +#else + if (flags & LOADFLG_NOISY) xprintf("0x%x/%d ",addr,size); +#endif + + if (!cfe_arena_loadcheck((uintptr_t) addr,size)) { + return CFE_ERR_BADADDR; + } + + if (size > 0) memset(addr,0,size); + return size; +} + + +/* ********************************************************************* + * elfgetshdr(ops,ref,ep) + * + * Get a section header from the ELF file + * + * Input parameters: + * ops - file I/O dispatch + * ref - reference data for open file + * ep - extended header info + * + * Return value: + * copy of section header (malloc'd) or NULL if no memory + ********************************************************************* */ + +static Elf32_Shdr *elfgetshdr(fileio_ctx_t *fsctx,void *ref,Elf32_Ehdr *ep) +{ + Elf32_Shdr *shtab; + unsigned size = ep->e_shnum * sizeof(Elf32_Shdr); + + shtab = (Elf32_Shdr *) KMALLOC(size,0); + if (!shtab) { + return NULL; + } + + if (fs_seek(fsctx,ref,ep->e_shoff,FILE_SEEK_BEGINNING) != ep->e_shoff || + fs_read(fsctx,ref,(uint8_t *)shtab,size) != size) { + KFREE(shtab); + return NULL; + } + + return (shtab); +} + +/* ********************************************************************* + * elfload_internal(ops,ref,entrypt,flags) + * + * Read an ELF file (main routine) + * + * Input parameters: + * ops - file I/O dispatch + * ref - open file handle + * entrypt - filled in with entry vector + * flags - generic boot flags + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int elfload_internal(fileio_ctx_t *fsctx,void *ref, + unsigned long *entrypt,int flags) +{ + Elf32_Ehdr *ep; + Elf32_Phdr *phtab = 0; + Elf32_Shdr *shtab = 0; + unsigned int nbytes; + int i; + int res; + Elf32_Ehdr ehdr; + + ep = &ehdr; + if (fs_read(fsctx,ref,(uint8_t *) ep,sizeof(*ep)) != sizeof(*ep)) { + return CFE_ERR_IOERR; + } + + /* check header validity */ + if (ep->e_ident[EI_MAG0] != ELFMAG0 || + ep->e_ident[EI_MAG1] != ELFMAG1 || + ep->e_ident[EI_MAG2] != ELFMAG2 || + ep->e_ident[EI_MAG3] != ELFMAG3) { + return CFE_ERR_NOTELF; + } + + if (ep->e_ident[EI_CLASS] != ELFCLASS32) return CFE_ERR_NOT32BIT; + +#ifdef __MIPSEB + if (ep->e_ident[EI_DATA] != ELFDATA2MSB) return CFE_ERR_WRONGENDIAN; /* big endian */ +#endif +#ifdef __MIPSEL + if (ep->e_ident[EI_DATA] != ELFDATA2LSB) return CFE_ERR_WRONGENDIAN; /* little endian */ +#endif + + if (ep->e_ident[EI_VERSION] != EV_CURRENT) return CFE_ERR_BADELFVERS; + if (ep->e_machine != EM_MIPS) return CFE_ERR_NOTMIPS; + + /* Is there a program header? */ + if (ep->e_phoff == 0 || ep->e_phnum == 0 || + ep->e_phentsize != sizeof(Elf32_Phdr)) { + return CFE_ERR_BADELFFMT; + } + + /* Load program header */ + nbytes = ep->e_phnum * sizeof(Elf32_Phdr); + phtab = (Elf32_Phdr *) KMALLOC(nbytes,0); + if (!phtab) { + return CFE_ERR_NOMEM; + } + + if (fs_seek(fsctx,ref,ep->e_phoff,FILE_SEEK_BEGINNING) != ep->e_phoff || + fs_read(fsctx,ref,(uint8_t *)phtab,nbytes) != nbytes) { + KFREE(phtab); + return CFE_ERR_IOERR; + } + + /* + * From now on we've got no guarantee about the file order, + * even where the section header is. Hopefully most linkers + * will put the section header after the program header, when + * they know that the executable is not demand paged. We assume + * that the symbol and string tables always follow the program + * segments. + */ + + /* read section table (if before first program segment) */ + if (ep->e_shoff < phtab[0].p_offset) { + shtab = elfgetshdr(fsctx,ref,ep); + } + + /* load program segments */ + /* We cope with a badly sorted program header, as produced by + * older versions of the GNU linker, by loading the segments + * in file offset order, not in program header order. */ + + while (1) { + Elf32_Off lowest_offset = ~0; + Elf32_Phdr *ph = 0; + + /* find nearest loadable segment */ + for (i = 0; i < ep->e_phnum; i++) + if ((phtab[i].p_type == PT_LOAD) && (phtab[i].p_offset < lowest_offset)) { + ph = &phtab[i]; + lowest_offset = ph->p_offset; + } + if (!ph) { + break; /* none found, finished */ + } + + /* load the segment */ + if (ph->p_filesz) { + if (fs_seek(fsctx,ref,ph->p_offset,FILE_SEEK_BEGINNING) != ph->p_offset) { + if (shtab) KFREE(shtab); + KFREE(phtab); + return CFE_ERR_BADELFFMT; + } + res = readprogsegment(fsctx,ref, + (void *)(intptr_t)(signed)ph->p_vaddr, + ph->p_filesz,flags); + if (res != ph->p_filesz) { + if (shtab) KFREE(shtab); + KFREE(phtab); + return res; + } + } + + if (ph->p_filesz < ph->p_memsz) { + res = readclearbss((void *)(intptr_t)(signed)ph->p_vaddr + ph->p_filesz, + ph->p_memsz - ph->p_filesz,flags); + if (res < 0) { + if (shtab) KFREE(shtab); + KFREE(phtab); + return res; + } + } + + ph->p_type = PT_NULL; /* remove from consideration */ + } + + KFREE(phtab); + + *entrypt = (intptr_t)(signed)ep->e_entry; /* return entry point */ + return 0; +} + + + +/* ********************************************************************* + * cfe_elfload(ops,file,flags) + * + * Read an ELF file (main entry point) + * + * Input parameters: + * ops - fileio dispatch + * file - name of file to read + * ept - where to put entry point + * flags - load flags + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int cfe_elfload(cfe_loadargs_t *la) +{ + fileio_ctx_t *fsctx; + void *ref; + int res; + + /* + * Look up the file system type and get a context + */ + + + res = fs_init(la->la_filesys,&fsctx,la->la_device); + if (res != 0) { + return res; + } + + /* + * Turn on compression if we're doing that. + */ + + if (la->la_flags & LOADFLG_COMPRESSED) { + res = fs_hook(fsctx,"z"); + if (res != 0) { + return res; + } + } + + /* + * Open the remote file + */ + + res = fs_open(fsctx,&ref,la->la_filename,FILE_MODE_READ); + if (res != 0) { + fs_uninit(fsctx); + return CFE_ERR_FILENOTFOUND; + } + + /* + * Load the image. + */ + + la->la_entrypt = 0; + res = elfload_internal(fsctx,ref,&(la->la_entrypt),la->la_flags); + + /* + * All done, release resources + */ + + fs_close(fsctx,ref); + fs_uninit(fsctx); + + return res; +} + + diff --git a/cfe/cfe/main/cfe_ldr_raw.c b/cfe/cfe/main/cfe_ldr_raw.c new file mode 100644 index 0000000..d436849 --- /dev/null +++ b/cfe/cfe/main/cfe_ldr_raw.c @@ -0,0 +1,360 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * RAW Program Loader File: cfe_ldr_raw.c + * + * This program reads raw binaries into memory. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_error.h" +#include "cfe_devfuncs.h" + +#include "cfe.h" +#include "cfe_fileops.h" + +#include "cfe_boot.h" +#include "cfe_bootblock.h" + +#include "cfe_loader.h" + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +static int cfe_rawload(cfe_loadargs_t *la); + +const cfe_loader_t rawloader = { + "raw", + cfe_rawload, + 0}; + +/* ********************************************************************* + * cfe_findbootblock(la,fsctx,ref) + * + * Find the boot block on the specified device. + * + * Input parameters: + * la - loader args (to be filled in) + * ops - file operations + * ref - reference for open file handle + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ +static int cfe_findbootblock(cfe_loadargs_t *la, + fileio_ctx_t *fsctx, + void *ref, + struct boot_block *bootblock) +{ + uint32_t checksum = 0; + uint32_t calcsum; + uint32_t secsize = 0; + uint64_t secoffset = 0; + int res; + int curblk; + + /* + * Search for the boot block. Stop when we find + * something with a matching checksum and magic + * number. + */ + + fs_seek(fsctx,ref,0,FILE_SEEK_BEGINNING); + + for (curblk = 0; curblk < BOOT_BLOCK_MAXLOC; curblk++) { + + + /* Read a block */ + + res = fs_read(fsctx,ref, + (unsigned char *) bootblock, + sizeof(struct boot_block)); + + if (res != sizeof(struct boot_block)) { + return CFE_ERR_IOERR; + } + + /* Verify magic number */ + + if (bootblock->bb_magic != BOOT_MAGIC_NUMBER) { + continue; + } + + /* Extract fields from block */ + + checksum = ((uint32_t) (bootblock->bb_hdrinfo & BOOT_HDR_CHECKSUM_MASK)); + bootblock->bb_hdrinfo &= ~BOOT_HDR_CHECKSUM_MASK; + secsize = ((uint32_t) (bootblock->bb_secsize & BOOT_SECSIZE_MASK)); + secoffset = bootblock->bb_secstart; + + /* Verify block's checksum */ + + CHECKSUM_BOOT_DATA(&(bootblock->bb_magic),BOOT_BLOCK_SIZE,&calcsum); + + if (checksum == calcsum) { + break; + } + } + + /* + * Okay, determine if we were successful. + */ + + if (bootblock->bb_magic != BOOT_MAGIC_NUMBER) { + return CFE_ERR_INVBOOTBLOCK; + } + + if (checksum != calcsum) { + return CFE_ERR_BBCHECKSUM; + } + + /* + * If we get here, we had a valid boot block. + */ + + return 0; +} + + +/* ********************************************************************* + * cfe_rawload(la) + * + * Read a raw (unformatted) boot file + * + * Input parameters: + * la - loader args + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ +static int cfe_rawload(cfe_loadargs_t *la) +{ + int res; + fileio_ctx_t *fsctx; + const fileio_dispatch_t *ops; + void *ref; + int ttlcopy = 0; + int findbb; + int devinfo; + struct boot_block bootblock; + uint8_t *ptr; + uint8_t *bootcode; + uint32_t checksum,calcsum; + uint64_t secoffset = 0; + int32_t maxsize; + int amtcopy; + int thisamt; + uint32_t loadflags; + int onedot; + + loadflags = la->la_flags; + + /* + * Set starting address and maximum size. You can either + * explicitly set this (with LOADFLG_SPECADDR) or + * let CFE decide. If CFE decides, the load address + * will be BOOT_START_ADDRESS in all cases. + * The size is dependant on the device type: block and flash + * devices will get this info from the boot block, + * and network devices will get the info by reaching EOF + * on reads, up to the maximum size of the boot area. + */ + + if (loadflags & LOADFLG_SPECADDR) { + bootcode = (uint8_t *) la->la_address; + maxsize = la->la_maxsize; + findbb = FALSE; /* don't find a boot block */ + } + else { + bootcode = (uint8_t *) BOOT_START_ADDRESS; + maxsize = BOOT_AREA_SIZE; + findbb = FALSE; + devinfo = la->la_device ? cfe_getdevinfo(la->la_device) : 0; + + /* + * If the device is either a disk or a flash device, + * we will expect to find a boot block. + * Serial and network devices do not have boot blocks. + */ + if ((devinfo >= 0) && + ( ((devinfo & CFE_DEV_MASK) == CFE_DEV_DISK) || + ((devinfo & CFE_DEV_MASK) == CFE_DEV_FLASH) )) { + findbb = TRUE; + } + } + + + /* + * merge in any filesystem-specific flags + */ + + ops = cfe_findfilesys(la->la_filesys); + if (!ops) return CFE_ERR_FSNOTAVAIL; + loadflags |= ops->loadflags; + + /* + * turn off the boot block if requested. + */ + + if (loadflags & LOADFLG_NOBB) findbb = FALSE; + + /* + * Create a file system context + */ + + res = fs_init(la->la_filesys,&fsctx,la->la_device); + if (res != 0) { + return res; + } + + /* + * Turn on compression if we're doing that. + */ + + if (!findbb && (la->la_flags & LOADFLG_COMPRESSED)) { + res = fs_hook(fsctx,"z"); + if (res != 0) { + return res; + } + } + + /* + * Open the boot device + */ + + res = fs_open(fsctx,&ref,la->la_filename,FILE_MODE_READ); + if (res != 0) { + fs_uninit(fsctx); + return res; + } + + /* + * If we need to find a boot block, do it now. + */ + + if (findbb) { + res = cfe_findbootblock(la,fsctx,ref,&bootblock); + + /* + * If we found the boot block, seek to the part of the + * disk where the boot code is. + * Otherwise, get out now, since the disk has no boot block. + */ + + if (res == 0) { + maxsize = (int) ((uint32_t) (bootblock.bb_secsize & BOOT_SECSIZE_MASK)); + secoffset = bootblock.bb_secstart; + fs_seek(fsctx,ref,secoffset,FILE_SEEK_BEGINNING); + } + else { + fs_close(fsctx,ref); + fs_uninit(fsctx); + return res; + } + + } + + /* + * Okay, go load the boot file. + */ + + ptr = bootcode; + amtcopy = maxsize; + ttlcopy = 0; + + onedot = amtcopy / 10; /* ten dots for entire load */ + if (onedot < 4096) onedot = 4096; /* but minimum 4096 bytes per dot */ + onedot = (onedot + 1) & ~4095; /* round to multiple of 4096 */ + + while (amtcopy > 0) { + thisamt = onedot; + if (thisamt > amtcopy) thisamt = amtcopy; + + res = fs_read(fsctx,ref,ptr,thisamt); + if (la->la_flags & LOADFLG_NOISY) { + xprintf("."); + } + if (res <= 0) break; + ptr += res; + amtcopy -= res; + ttlcopy += res; + } + + /* + * We're done with the file. + */ + + fs_close(fsctx,ref); + fs_uninit(fsctx); + + /* + * Verify the boot loader checksum if we were reading + * the disk. + */ + + if (findbb) { + CHECKSUM_BOOT_DATA(bootcode,maxsize,&calcsum); + checksum = (uint32_t) ((bootblock.bb_secsize & BOOT_DATA_CHECKSUM_MASK) + >> BOOT_DATA_CHECKSUM_SHIFT); + + if (checksum != calcsum) { + return CFE_ERR_BOOTPROGCHKSUM; + } + } + + la->la_entrypt = (uintptr_t) bootcode; + + if (la->la_flags & LOADFLG_NOISY) xprintf(" %d bytes read\n",ttlcopy); + + return (res < 0) ? res : ttlcopy; + +} + diff --git a/cfe/cfe/main/cfe_ldr_srec.c b/cfe/cfe/main/cfe_ldr_srec.c new file mode 100644 index 0000000..b067f2b --- /dev/null +++ b/cfe/cfe/main/cfe_ldr_srec.c @@ -0,0 +1,557 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * SREC Program Loader File: cfe_ldr_srec.c + * + * This program reads Motorola S-record files into memory + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_error.h" +#include "cfe_devfuncs.h" + +#include "cfe.h" +#include "cfe_fileops.h" + +#include "cfe_boot.h" +#include "cfe_bootblock.h" + +#include "cfe_loader.h" + +#include "cfe_mem.h" + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +static int cfe_srecload(cfe_loadargs_t *la); + +const cfe_loader_t srecloader = { + "srec", + cfe_srecload, + 0}; + + +typedef struct linebuf_s { + char linebuf[256]; + int curidx; + int buflen; + int eof; + void *ref; + fileio_ctx_t *fsctx; +} linebuf_t; + +#define initlinebuf(b,r,o) (b)->curidx = 0; (b)->buflen = 0; \ + (b)->eof = 0 ; (b)->ref = r; (b)->fsctx = o + + +/* ********************************************************************* + * readchar(file) + * + * Read a character from a file. It's kind of like getchar + * on "C" FILE devices, but not so fancy. + * + * Input parameters: + * file - pointer to a linebuf_t containing reader state + * + * Return value: + * character, or -1 if at EOF + ********************************************************************* */ + +static int readchar(linebuf_t *file) +{ + int ch; + int res; + + if (file->eof) return -1; + + if (file->curidx == file->buflen) { + for (;;) { + res = fs_read(file->fsctx,file->ref,file->linebuf,sizeof(file->linebuf)); + if (res < 0) { + file->eof = -1; + return -1; + } + if (res == 0) continue; + file->buflen = res; + file->curidx = 0; + break; + } + } + + ch = file->linebuf[file->curidx]; + file->curidx++; + return ch; +} + + +/* ********************************************************************* + * readline(file,buffer,maxlen) + * + * Read a line of text from a file using our crude file stream + * mechanism. + * + * Input parameters: + * file - pointer to a linebuf_t containing reader state + * buffer - will receive line of text + * maxlen - number of bytes that will fit in buffer + * + * Return value: + * 0 if ok, else <0 if at EOF + ********************************************************************* */ + +static int readline(linebuf_t *file,char *buffer,int maxlen) +{ + int ch; + char *ptr; + + ptr = buffer; + maxlen--; /* account for terminating null */ + + while (maxlen) { + ch = readchar(file); + if (ch == -1) return -1; + if (ch == 27) return -1; /* ESC */ + if ((ch == '\n') || (ch == '\r')) break; + *ptr++ = (char) ch; + maxlen--; + } + + *ptr = '\0'; + + return 0; +} + + +/* ********************************************************************* + * getxdigit(c) + * + * Convert a hex digit into its numeric equivalent + * + * Input parameters: + * c - character + * + * Return value: + * value + ********************************************************************* */ + +static int getxdigit(char c) +{ + if ((c >= '0') && (c <= '9')) return c - '0'; + if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10; + if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10; + return -1; +} + +/* ********************************************************************* + * getbyte(line) + * + * Process two hex digits and return the value + * + * Input parameters: + * line - pointer to pointer to characters (updated on exit) + * + * Return value: + * byte value, or <0 if bad hex digits + ********************************************************************* */ + +static int getbyte(char **line) +{ + int res; + int c1,c2; + + c1 = getxdigit(*(*(line)+0)); + if (c1 < 0) return -1; + + c2 = getxdigit(*(*(line)+1)); + if (c2 < 0) return -1; + + res = (c1*16+c2); + (*line) += 2; + + return res; +} + + +/* ********************************************************************* + * procsrec(line,loadaddr,blklen,data) + * + * Process an S-record, reading the data into a local buffer + * and returning the block's address. + * + * Input parameters: + * line - line of text (s-record line) + * loadaddr - will be filled with address where data should go + * blklen - will be filled in with size of record + * data - points to buffer to receive data + * + * Return value: + * <0 if error occured (not an s-record) + ********************************************************************* */ + +static int procsrec(char *line, + unsigned int *loadaddr, + unsigned int *blklen, + unsigned char *data) +{ + char rectype; + unsigned char b; + unsigned int len; + unsigned int minlen; + unsigned int linelen; + unsigned int addr; + unsigned int chksum; + + int idx; + int ret = 0; + + addr = 0; + + if (*line++ != 'S') + return -1; /* not an S record */ + + rectype = *line++; + + minlen = 3; /* type 1 record */ + switch (rectype) { + case '0': + break; + + /* + * data bytes + */ + case '3': + minlen++; + /* fall through */ + case '2': + minlen++; + /* fall through */ + case '1': + chksum = 0; + linelen = getbyte(&line); + if (linelen < minlen) { + xprintf("srec: line too short\n"); + return -1; + } + chksum += (unsigned int)linelen; + + /* + * There are two address bytes in a type 1 record, and three + * in a type 2 record. The high-order byte is first, then + * one or two lower-order bytes. Build up the adddress. + */ + b = getbyte(&line); + chksum += (unsigned int)b; + addr = b; + b = getbyte(&line); + chksum += (unsigned int)b; + addr <<= 8; + addr += b; + if (rectype == '2') { + b = getbyte(&line); + chksum += (unsigned int)b; + addr <<= 8; + addr += b; + } + if (rectype == '3') { + b = getbyte(&line); + chksum += (unsigned int)b; + addr <<= 8; + addr += b; + b = getbyte(&line); + chksum += (unsigned int)b; + addr <<= 8; + addr += b; + } + +#if VERBOSE + printf("Addr: %08X Len: %3u(0x%x)\n", addr , linelen - minlen, + linelen-minlen); +#endif + + *loadaddr = addr; + len = linelen - minlen; + *blklen = len; + + for (idx = 0; idx < len; idx++) { + b = getbyte(&line); + chksum += (unsigned int) b; + data[idx] = (unsigned char ) b; + } + + b = getbyte(&line); + chksum = (~chksum) & 0x000000FF; + if (chksum != b) { + xprintf("Checksum error in s-record file\n"); + return -1; + } + ret = 1; + break; + + case '9': + linelen = getbyte(&line); + b = getbyte(&line); + addr = b; + b = getbyte(&line); + addr <<= 8; + addr += b; + *loadaddr = addr; + ret = -2; + break; + + case '8': + linelen = getbyte(&line); + b = getbyte(&line); + addr = b; + b = getbyte(&line); + addr <<= 8; + addr += b; + b = getbyte(&line); + addr <<= 8; + addr += b; + *loadaddr = addr; + ret = -2; + break; + + case '7': + linelen = getbyte(&line); + b = getbyte(&line); + addr = b; + b = getbyte(&line); + addr <<= 8; + addr += b; + b = getbyte(&line); + addr <<= 8; + addr += b; + b = getbyte(&line); + addr <<= 8; + addr += b; + *loadaddr = addr; + ret = -2; + break; + + default: + xprintf("Unknown S-record type: %c\n",rectype); + return -1; + break; + } + + return ret; +} + + +/* ********************************************************************* + * cfe_srecload(la) + * + * Read an s-record file + * + * Input parameters: + * la - loader args + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ +static int cfe_srecload(cfe_loadargs_t *la) +{ + int res; + fileio_ctx_t *fsctx; + void *ref; + int devinfo; + int serial = FALSE; + unsigned int loadaddr; + unsigned int blklen; + linebuf_t lb; + char line[256]; + uint8_t data[256]; + int cnt; + unsigned int specaddr; /* current address if loading to a special address */ + int specflg; /* true if in "special address" mode */ + int firstrec = 1; /* true if we have not seen the first record */ + + /* + * We might want to know something about the boot device. + */ + + devinfo = la->la_device ? cfe_getdevinfo(la->la_device) : 0; + + /* + * Figure out if we're loading to a "special address". This lets + * us load S-records into a temporary buffer, ignoring the + * addresses in the records (but using them so we'll know where + * they go relative to each other + */ + + specflg = (la->la_flags & LOADFLG_SPECADDR) ? 1 : 0; + specaddr = 0; + + /* + * If the device is a serial port, we want to know that. + */ + + if ((devinfo >= 0) && + ((devinfo & CFE_DEV_MASK) == CFE_DEV_SERIAL)) { + serial = TRUE; + } + + /* + * Create a file system context + */ + + res = fs_init(la->la_filesys,&fsctx,la->la_device); + if (res != 0) { + return res; + } + + /* + * Turn on compression if we're doing that. + */ + + if (la->la_flags & LOADFLG_COMPRESSED) { + res = fs_hook(fsctx,"z"); + if (res != 0) { + return res; + } + } + + /* + * Open the boot device + */ + + res = fs_open(fsctx,&ref,la->la_filename,FILE_MODE_READ); + if (res != 0) { + fs_uninit(fsctx); + return res; + } + + /* + * Okay, go load the boot file. Process S-records until + * we get an entry point record (usually at the end). + * + * XXX what if it's *not* at the end? + */ + + initlinebuf(&lb,ref,fsctx); + + cnt = 0; + for (;;) { + /* + * Read a line of text + */ + res = readline(&lb,line,sizeof(line)); + if (res < 0) break; /* reached EOF */ + + /* + * Process the S-record. If at EOF, procsrec returns 0. + * Invalid s-records returns -1. + */ + + if (line[0] == 0) continue; + + res = procsrec(line,&loadaddr,&blklen,data); + +#if 0 + if (res == -2 || res >= 0) + xprintf("."); +#endif + if (res < 0) break; + + /* + * Handle "special address" mode. All S-records will be + * loaded into a buffer passed by the caller to the loader. + * We use the addresses in the S-records to determine + * relative placement of the data, keying on the first + * S-record in the file. + */ + + if ((res == 1) && (specflg)) { + if (firstrec) { + /* First S-record seen sets the base for all that follow */ + specaddr = loadaddr; + firstrec = 0; + } + loadaddr = la->la_address + (intptr_t) (loadaddr - specaddr); + } + + cnt++; + + if (res == 1) { + if (!cfe_arena_loadcheck((intptr_t) loadaddr,blklen)) { + xprintf("Invalid address: %P\n",loadaddr); + res = -1; + break; + } + memcpy((uint8_t *) (intptr_t) (signed)loadaddr,data,blklen); + } + } + + /* + * We're done with the file. + */ + + fs_close(fsctx,ref); + fs_uninit(fsctx); + + /* + * Say something cute on the LEDs. + * Don't do this for every s-record, because if logging the LED + * changes out the serial port, that can take a Long Time. Just + * goes to show: too much cuteness is a _very_ bad thing. + */ + xsprintf(line,"%04d",cnt); + cfe_ledstr(line); + + if (res == -2) { + la->la_entrypt = (intptr_t) (signed) loadaddr; + res = 0; + } + + return res; +} + + diff --git a/cfe/cfe/main/cfe_link.mk b/cfe/cfe/main/cfe_link.mk new file mode 100644 index 0000000..7529dc4 --- /dev/null +++ b/cfe/cfe/main/cfe_link.mk @@ -0,0 +1,26 @@ +# +# This Makefile snippet takes care of linking the firmware. +# + +pci : $(PCICOMMON) $(PCIMACHDEP) + echo done + +cfe cfe.bin : $(CRT0OBJS) $(BSPOBJS) $(LIBCFE) + $(GLD) -o cfe -Map cfe.map $(LDFLAGS) $(CRT0OBJS) $(BSPOBJS) -L. -lcfe $(LDLIBS) + $(OBJDUMP) -d cfe > cfe.dis + $(OBJCOPY) --output-target=binary cfe cfe.bin + $(OBJCOPY) --input-target=binary --output-target=srec cfe.bin cfe.srec + +cfe.flash : cfe.bin mkflashimage + ./mkflashimage -v ${ENDIAN} -B ${CFG_BOARDNAME} -V ${CFE_VER_MAJ}.${CFE_VER_MIN}.${CFE_VER_ECO} cfe.bin cfe.flash + $(OBJCOPY) --input-target=binary --output-target=srec cfe.flash cfe.flash.srec + + +clean : + rm -f *.o *~ cfe cfe.bin cfe.dis cfe.map cfe.srec + rm -f makereg ${CPU}_socregs.inc mkpcidb pcidevs_data2.h mkflashimage + rm -f build_date.c + rm -f libcfe.a + rm -f cfe.flash cfe.flash.srec $(CLEANOBJS) + +distclean : clean diff --git a/cfe/cfe/main/cfe_loader.c b/cfe/cfe/main/cfe_loader.c new file mode 100644 index 0000000..bbd3eb4 --- /dev/null +++ b/cfe/cfe/main/cfe_loader.c @@ -0,0 +1,135 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Loader API File: cfe_loader.c + * + * This is the main API for the program loader. CFE supports + * multiple "installable" methods for loading programs, allowing + * us to deal with a variety of methods for moving programs + * into memory for execution. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" + +#include "cfe_error.h" + +#include "cfe.h" +#include "cfe_fileops.h" + +#include "cfe_loader.h" + +#include "bsp_config.h" + + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern const cfe_loader_t elfloader; +extern const cfe_loader_t rawloader; +extern const cfe_loader_t srecloader; + +/* ********************************************************************* + * Loader list + ********************************************************************* */ + +const cfe_loader_t * const cfe_loaders[] = { + &elfloader, +#if !CFG_MINIMAL_SIZE + &rawloader, + &srecloader, +#endif + NULL}; + +/* ********************************************************************* + * cfe_findloader(name) + * + * Find a loader by name + * + * Input parameters: + * name - name of loader to find + * + * Return value: + * pointer to loader structure or NULL + ********************************************************************* */ + +const cfe_loader_t *cfe_findloader(char *name) +{ + const cfe_loader_t * const *ldr; + + ldr = cfe_loaders; + + while (*ldr) { + if (strcmp(name,(*ldr)->name) == 0) return (*ldr); + ldr++; + } + + return NULL; +} + + +/* ********************************************************************* + * cfe_load_progam(name,args) + * + * Look up a loader and call it. + * + * Input parameters: + * name - name of loader to run + * args - arguments to pass + * + * Return value: + * return value + ********************************************************************* */ + +int cfe_load_program(char *name,cfe_loadargs_t *la) +{ + const cfe_loader_t *ldr; + int res; + + ldr = cfe_findloader(name); + if (!ldr) return CFE_ERR_LDRNOTAVAIL; + + res = LDRLOAD(ldr,la); + + return res; +} diff --git a/cfe/cfe/main/cfe_main.c b/cfe/cfe/main/cfe_main.c new file mode 100644 index 0000000..1a451a6 --- /dev/null +++ b/cfe/cfe/main/cfe_main.c @@ -0,0 +1,636 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Main Module File: cfe_main.c + * + * This module contains the main "C" routine for CFE and + * the main processing loop. There should not be any board-specific + * stuff in here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_timer.h" + +#include "env_subr.h" +#include "ui_command.h" +#include "cfe_mem.h" +#include "cfe.h" + +#include "exception.h" + +#include "bsp_config.h" + +#include "segtable.h" + +#include "initdata.h" + +#if CFG_PCI +#include "pcivar.h" +#endif + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#ifndef CFG_STACK_SIZE +#define STACK_SIZE 8192 +#else +#define STACK_SIZE ((CFG_STACK_SIZE+1023) & ~1023) +#endif + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +void cfe_main(int,int); +extern void cfe_device_poll(void *x); + +extern int ui_init_envcmds(void); +extern int ui_init_devcmds(void); +extern int ui_init_netcmds(void); +extern int ui_init_memcmds(void); +extern int ui_init_loadcmds(void); +extern int ui_init_pcicmds(void); +extern int ui_init_examcmds(void); +extern int ui_init_flashcmds(void); +extern int ui_init_misccmds(void); +#if CFG_VAPI +extern int ui_init_vapicmds(void); +#endif + +#if CFG_VENDOR_EXTENSIONS +extern int ui_init_vendorcmds(void); +#endif + +void cfe_command_restart(uint64_t status); + +extern segtable_t *_getsegtbl(void); + +extern const char *builddate; +extern const char *builduser; + +#if CFG_MULTI_CPUS +extern int altcpu_cmd_start(uint64_t,uint64_t *); +extern int altcpu_cmd_stop(uint64_t); +#endif + + + + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +const char *cfe_boardname = CFG_BOARDNAME; +unsigned int cfe_startflags = +#if CFG_PCI + CFE_INIT_PCI | +#endif + 0; + +/* ********************************************************************* + * cfe_setup_default_env() + * + * Initialize the default environment for CFE. These are all + * the temporary variables that do not get stored in the NVRAM + * but are available to other programs and command-line macros. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void cfe_setup_default_env(void) +{ + char buffer[80]; + + xsprintf(buffer,"%d.%d.%d",CFE_VER_MAJOR,CFE_VER_MINOR,CFE_VER_BUILD); + env_setenv("CFE_VERSION",buffer,ENV_FLG_BUILTIN | ENV_FLG_READONLY); + + if (cfe_boardname) { + env_setenv("CFE_BOARDNAME",(char *) cfe_boardname, + ENV_FLG_BUILTIN | ENV_FLG_READONLY); + } + + xsprintf(buffer,"%d",mem_totalsize); + env_setenv("CFE_MEMORYSIZE",buffer,ENV_FLG_BUILTIN | ENV_FLG_READONLY); + +} + + +/* ********************************************************************* + * cfe_init_ui() + * + * Call all the other UI initialization modules. Each of these + * modules usually calls back to the UI dispatcher to add command + * tables. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +#if CFG_MINIMAL_SIZE +#define OPTIONAL(x) +#else +#define OPTIONAL(x) x +#endif + +static void cfe_init_ui(void) +{ + ui_init_cmddisp(); + + ui_init_envcmds(); + OPTIONAL(ui_init_devcmds()); +#if CFG_NETWORK + ui_init_netcmds(); +#endif + ui_init_loadcmds(); + OPTIONAL(ui_init_memcmds()); + +#if CFG_PCI + ui_init_pcicmds(); +#endif + OPTIONAL(ui_init_examcmds()); + ui_init_flashcmds(); +#if CFG_VAPI + ui_init_vapicmds(); +#endif + +#if CFG_VENDOR_EXTENSIONS + ui_init_vendorcmds(); +#endif + + OPTIONAL(ui_init_misccmds()); + +} + + +/* ********************************************************************* + * cfe_ledstr(leds) + * + * Display a string on the board's LED display, if it has one. + * This routine depends on the board-support package to + * include a "driver" to write to the actual LED, if the board + * does not have one this routine will do nothing. + * + * The LEDs are written at various places in the initialization + * sequence, to debug board problems. + * + * Input parameters: + * leds - pointer to four-character ASCII string + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_ledstr(const char *leds) +{ + unsigned int val; + + val = ((((unsigned int) leds[0]) << 24) | + (((unsigned int) leds[1]) << 16) | + (((unsigned int) leds[2]) << 8) | + ((unsigned int) leds[3])); + + cfe_leds(val); +} + + +/* ********************************************************************* + * cfe_say_hello() + * + * Print out the CFE startup message and copyright notice + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + + +static void cfe_say_hello(void) +{ + xprintf("\n\n"); + xprintf("CFE version 2.0.2" +#ifdef CFE_VER_RELEASE + ".%d" +#endif + " for DGN2200v2 (%s)\n", + //CFE_VER_MAJOR,CFE_VER_MINOR,CFE_VER_BUILD, +#ifdef CFE_VER_RELEASE + CFE_VER_RELEASE, +#endif + //cfe_boardname, +#ifdef __long64 + "64bit," +#else + "32bit," +#endif +#if CFG_MULTI_CPUS + "MP," +#else + "SP," +#endif +#ifdef __MIPSEL + "LE" +#endif +#ifdef __MIPSEB + "BE" +#endif +#if CFG_VAPI + ",VAPI" +#endif + ); + + xprintf("Build Date: %s (%s)\n",builddate,builduser); + xprintf("Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.\n"); + xprintf("\n"); +} + + +/* ********************************************************************* + * cfe_restart() + * + * Restart CFE from scratch, jumping back to the boot vector. + * + * Input parameters: + * nothing + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_restart(void) +{ + _exc_restart(); +} + + +/* ********************************************************************* + * cfe_start(ept) + * + * Start a user program + * + * Input parameters: + * ept - entry point + * + * Return value: + * nothing + ********************************************************************* */ +void cfe_start(unsigned long ept) +{ + SETLEDS("RUN!"); + cfe_launch(ept); +} + + +/* ********************************************************************* + * cfe_startup_info() + * + * Display startup memory configuration messages + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void cfe_startup_info(void) +{ + segtable_t *segtbl; + + segtbl = _getsegtbl(); + xprintf("CPU type 0x%X: ",(uint32_t)cpu_prid); + if (cfe_cpu_speed < 1000000) xprintf("%dKHz\n",cfe_cpu_speed/1000); + else xprintf("%dMHz\n",cfe_cpu_speed/1000000); + xprintf("Total memory: 0x%llX bytes (%dMB)\n", + (((uint64_t)mem_totalsize) << 20),(uint32_t)mem_totalsize); + + xprintf("\n"); + xprintf("Total memory used by CFE: 0x%08X - 0x%08X (%d)\n", + (uint32_t) mem_bottomofmem, + (uint32_t) mem_topofmem, + (uint32_t) mem_topofmem-mem_bottomofmem); + xprintf("Initialized Data: 0x%08X - 0x%08X (%d)\n", + (uint32_t) (segtbl[R_SEG_FDATA] + mem_datareloc), + (uint32_t) (segtbl[R_SEG_EDATA] + mem_datareloc), + (uint32_t) (segtbl[R_SEG_EDATA] - segtbl[R_SEG_FDATA])); + xprintf("BSS Area: 0x%08X - 0x%08X (%d)\n", + (uint32_t) (segtbl[R_SEG_FBSS] + mem_datareloc), + (uint32_t) (segtbl[R_SEG_END] + mem_datareloc), + (uint32_t) (segtbl[R_SEG_END] - segtbl[R_SEG_FBSS])); + xprintf("Local Heap: 0x%08X - 0x%08X (%d)\n", + (uint32_t)(mem_heapstart), + (uint32_t)(mem_heapstart + (CFG_HEAP_SIZE*1024)), + (CFG_HEAP_SIZE*1024)); + xprintf("Stack Area: 0x%08X - 0x%08X (%d)\n", + (uint32_t)(mem_heapstart + (CFG_HEAP_SIZE*1024)), + (uint32_t)(mem_heapstart + (CFG_HEAP_SIZE*1024) + STACK_SIZE), + STACK_SIZE); + xprintf("Text (code) segment: 0x%08X - 0x%08X (%d)\n", + (uint32_t)mem_textbase, + (uint32_t)(mem_textbase+mem_textsize), + (uint32_t) mem_textsize); + xprintf("Boot area (physical): 0x%08X - 0x%08X\n", + mem_bootarea_start,mem_bootarea_start+mem_bootarea_size); + xprintf("Relocation Factor: I:%08X - D:%08X\n", + (uint32_t) mem_textreloc,(uint32_t) mem_datareloc); + +} + + +/* ********************************************************************* + * cfe_autostart() + * + * Process automatic commands at startup + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void cfe_autostart(void) +{ + char *env; + int noauto = 0; + char ch; + + env = env_getenv("STARTUP"); + if (!env) return; + + while (console_status()) { + console_read(&ch,1); + if (ch == 3) noauto = TRUE; /* Ctrl-C means no auto */ + } + + if (noauto) { + xprintf("Automatic startup canceled via Ctrl-C\n"); + return; + } + + ui_docommands(env); +} + +/* ********************************************************************* + * cfe_main(a,b) + * + * It's gotta start somewhere. + * + * Input parameters: + * a,b - not used + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_main(int a,int b) +{ + + /* + * By the time this routine is called, the following things have + * already been done: + * + * 1. The processor(s) is(are) initialized. + * 2. The caches are initialized. + * 3. The memory controller is initialized. + * 4. BSS has been zeroed. + * 5. The data has been moved to R/W space. + * 6. The "C" Stack has been initialized. + */ + + cfe_bg_init(); /* init background processing */ + cfe_attach_init(); + cfe_timer_init(); /* Timer process */ + cfe_bg_add(cfe_device_poll,NULL); + + /* + * Initialize the memory allocator + */ + + SETLEDS("KMEM"); + KMEMINIT((unsigned char *) (uintptr_t) mem_heapstart, + ((CFG_HEAP_SIZE)*1024)); + + /* + * Initialize the console. It is done before the other devices + * get turned on. The console init also sets the variable that + * contains the CPU speed. + */ + + SETLEDS("CONS"); + board_console_init(); + + /* + * Set up the exception vectors + */ + + cfe_setup_exceptions(); + + /* + * Say hello. + */ + + SETLEDS("CIOK"); + cfe_say_hello(); + + /* + * Initialize the other devices. + */ + + SETLEDS("AREN"); + xprintf("Initializing Arena.\n"); + cfe_arena_init(); + +#if CFG_PCI + if (cfe_startflags & CFE_INIT_PCI) { + pci_flags_t flags = PCI_FLG_NORMAL | PCI_FLG_LDT_PREFETCH; + char *str; + extern cons_t pci_optnames[]; + + flags = PCI_FLG_NORMAL | PCI_FLG_LDT_PREFETCH; +#if CFG_LDT_REV_017 + flags |= PCI_FLG_LDT_REV_017; +#endif + str = env_getenv("PCI_OPTIONS"); + setoptions(pci_optnames,str,&flags); + + xprintf("Initializing PCI. [%s]\n",str ? str : "normal"); + pci_configure(flags); + } +#endif + + SETLEDS("DEVI"); + xprintf("Initializing Devices.\n"); + board_device_init(); + + cfe_startup_info(); + SETLEDS("ENVI"); + cfe_setup_default_env(); + + xprintf("\n"); + + cfe_init_ui(); + + board_final_init(); + + cfe_autostart(); + + cfe_command_loop(); +} + +/* ********************************************************************* + * cfe_command_restart() + * + * This routine is called when an application wants to restart + * the firmware's command processor. Reopen the console and + * jump back into the command loop. + * + * Input parameters: + * status - A0 value of program returning to firmware + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_command_restart(uint64_t status) +{ + /* + * Stop alternate CPU(s). If they're already stopped, this + * command will make sure they're stopped. + */ + +#if CFG_MULTI_CPUS + altcpu_cmd_stop(1); /* stop CPU 1 (XXX more CPUs?) */ +#endif + + /* + * Call board reset functions + */ + board_device_reset(); + + /* + * Reset devices + */ + cfe_device_reset(); + + /* + * Reset timers + */ + cfe_timer_init(); + + /* + * Reopen console + */ + console_open(console_name); + + /* + * Display program return status + */ + + xprintf("*** program exit status = %d\n", (int)status); + + /* + * Back to processing user commands + */ + cfe_command_loop(); +} + + + +/* ********************************************************************* + * cfe_command_loop() + * + * This routine reads and processes user commands + * + * Input parameters: + * nothing + * + * Return value: + * does not return + ********************************************************************* */ + +void cfe_command_loop() +{ + char buffer[300]; + int status; + char *prompt; + + SETLEDS("CFE "); + + for (;;) { + prompt = env_getenv("PROMPT"); +#if CFG_RAMAPP + SETLEDS("CFE*"); + if (!prompt) prompt = "CFE_RAM> "; +#else + if (!prompt) prompt = "CFE> "; +#endif + console_readline(prompt,buffer,sizeof(buffer)); + + status = ui_docommands(buffer); + + if (status != CMD_ERR_BLANK) { + xprintf("*** command status = %d\n", status); + } + } +} + + + + + diff --git a/cfe/cfe/main/cfe_mem.c b/cfe/cfe/main/cfe_mem.c new file mode 100644 index 0000000..1c424e1 --- /dev/null +++ b/cfe/cfe/main/cfe_mem.c @@ -0,0 +1,256 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Physical Memory (arena) manager File: cfe_mem.c + * + * This module describes the physical memory available to the + * firmware. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_arena.h" + +#include "cfe_error.h" + +#include "cfe.h" +#include "cfe_mem.h" + +#include "initdata.h" + +#define _NOPROTOS_ +#include "cfe_boot.h" +#undef _NOPROTOS_ + +#include "cpu_config.h" /* for definition of CPUCFG_ARENAINIT */ + +#include "addrspace.h" /* for macros dealing with addresses */ + + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define ARENA_RANGE(bottom,top,type) arena_markrange(&cfe_arena,(uint64_t)(bottom), \ + (uint64_t)(top)-(uint64_t)bottom+1,(type),NULL) + +#define MEG (1024*1024) +#define KB 1024 +#define PAGESIZE 4096 +#define CFE_BOOTAREA_SIZE (256*KB) +#define CFE_BOOTAREA_ADDR 0x20000000 + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +arena_t cfe_arena; +extern void _setcontext(int64_t); + +unsigned int mem_bootarea_start; +unsigned int mem_bootarea_size; + +extern void CPUCFG_ARENAINIT(void); +extern void cfe_bootarea_init(void); +extern void CPUCFG_PAGETBLINIT(uint64_t *ptaddr,unsigned int ptstart); + + + +/* ********************************************************************* + * cfe_arena_init() + * + * Create the initial map of physical memory + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_arena_init(void) +{ + uint64_t memlo,memhi; + + /* + * This macro expands via cpu_config.h to an appropriate function + * name for creating an empty arena appropriately for our CPU + */ + + CPUCFG_ARENAINIT(); + + /* + * Round the area used by the firmware to a page boundary and + * mark it in use + */ + + memhi = PHYSADDR((mem_topofmem + 4095) & ~4095); + memlo = PHYSADDR(mem_bottomofmem) & ~4095; + + ARENA_RANGE(memlo,memhi-1,MEMTYPE_DRAM_USEDBYFIRMWARE); + + /* + * Create the initial page table + */ + + cfe_bootarea_init(); + +} + + +/* ********************************************************************* + * cfe_arena_enum(idx,type,start,size) + * + * Enumerate available memory. This is called by the user + * API dispatcher so that operating systems can determine what + * memory regions are available to them. + * + * Input parameters: + * idx - index. Start at zero and increment until an error + * is returned. + * type,start,size: pointers to variables to receive the + * arena entry's information + * allrecs - true to retrieve all records, false to retrieve + * only available DRAM + * + * Return value: + * 0 if ok + * CFE_ERR_NOMORE if idx is beyond the last entry + ********************************************************************* */ + +int cfe_arena_enum(int idx,int *type,uint64_t *start,uint64_t *size,int allrecs) +{ + arena_node_t *node; + queue_t *qb; + arena_t *arena = &cfe_arena; + + + for (qb = (arena->arena_list.q_next); qb != &(arena->arena_list); + qb = qb->q_next) { + node = (arena_node_t *) qb; + + if (allrecs || (!allrecs && (node->an_type == MEMTYPE_DRAM_AVAILABLE))) { + if (idx == 0) { + *type = node->an_type; + *start = node->an_address; + *size = node->an_length; + return 0; + } + idx--; + } + } + + return CFE_ERR_NOMORE; + +} + +/* ********************************************************************* + * cfe_arena_loadcheck(start,size) + * + * Determine if the specified memory area is within the available + * DRAM. This is used while loading executables to be sure we + * don't trash the firmware. + * + * Input parameters: + * start - starting physical address + * size - size of requested region + * + * Return value: + * true - ok to copy memory here + * false - not ok, memory overlaps firmware + ********************************************************************* */ + +int cfe_arena_loadcheck(uintptr_t start,unsigned int size) +{ + arena_node_t *node; + queue_t *qb; + arena_t *arena = &cfe_arena; + + /* + * If the address is in our boot area, it's okay + * for it to be a virtual address. + */ + + if ((start >= BOOT_START_ADDRESS) && + ((start+size) <= (BOOT_START_ADDRESS+BOOT_AREA_SIZE))) { + return TRUE; + } + + /* + * Otherwise, make a physical address. + */ + + start = PHYSADDR(start); + + /* + * Because all of the arena nodes of the same type are + * coalesced together, all we need to do is determine if the + * requested region is entirely within an arena node, + * so there's no need to look for things that span nodes. + */ + + for (qb = (arena->arena_list.q_next); qb != &(arena->arena_list); + qb = qb->q_next) { + node = (arena_node_t *) qb; + + /* If the memory is available, the region is OK. */ + + if ((start >= node->an_address) && + ((start+size) <= (node->an_address+node->an_length)) && + (node->an_type == MEMTYPE_DRAM_AVAILABLE)) { + return TRUE; + } + } + + /* + * Otherwise, it's not. We could go through the arena again and + * look for regions of other types that intersect the requested + * region, to get a more detailed error, but this'll do. + */ + + return FALSE; + +} + diff --git a/cfe/cfe/main/cfe_rawfs.c b/cfe/cfe/main/cfe_rawfs.c new file mode 100644 index 0000000..4c29349 --- /dev/null +++ b/cfe/cfe/main/cfe_rawfs.c @@ -0,0 +1,293 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * "Raw" file system File: cfe_rawfs.c + * + * This filesystem dispatch is used to read files directly + * from a block device. For example, you can 'dd' an elf + * file directly onto a disk or flash card and then run + * it using this module. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_error.h" +#include "cfe_fileops.h" +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_console.h" + +#include "cfe.h" + +/* ********************************************************************* + * RAW context + ********************************************************************* */ + +/* + * File system context - describes overall file system info, + * such as the handle to the underlying device. + */ + +typedef struct raw_fsctx_s { + int raw_dev; + int raw_isconsole; + int raw_refcnt; +} raw_fsctx_t; + +/* + * File context - describes an open file on the file system. + * For raw devices, this is pretty meaningless, but we do + * keep track of where we are. + */ + +typedef struct raw_file_s { + raw_fsctx_t *raw_fsctx; + int raw_fileoffset; + int raw_baseoffset; /* starting offset of raw "file" */ + int raw_length; /* length of file, -1 for whole device */ +} raw_file_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +static int raw_fileop_init(void **fsctx,void *devicename); +static int raw_fileop_open(void **ref,void *fsctx,char *filename,int mode); +static int raw_fileop_read(void *ref,uint8_t *buf,int len); +static int raw_fileop_write(void *ref,uint8_t *buf,int len); +static int raw_fileop_seek(void *ref,int offset,int how); +static void raw_fileop_close(void *ref); +static void raw_fileop_uninit(void *fsctx); + +/* ********************************************************************* + * RAW fileio dispatch table + ********************************************************************* */ + +const fileio_dispatch_t raw_fileops = { + "raw", + 0, + raw_fileop_init, + raw_fileop_open, + raw_fileop_read, + raw_fileop_write, + raw_fileop_seek, + raw_fileop_close, + raw_fileop_uninit +}; + +static int raw_fileop_init(void **newfsctx,void *dev) +{ + raw_fsctx_t *fsctx; + char *devicename = (char *) dev; + + *newfsctx = NULL; + + fsctx = KMALLOC(sizeof(raw_fsctx_t),0); + if (!fsctx) { + return CFE_ERR_NOMEM; + } + + if (strcmp(devicename,console_name) == 0) { + fsctx->raw_dev = console_handle; + fsctx->raw_isconsole = TRUE; + } + else { + fsctx->raw_dev = cfe_open(devicename); + fsctx->raw_isconsole = FALSE; + } + + fsctx->raw_refcnt = 0; + + if (fsctx->raw_dev >= 0) { + *newfsctx = fsctx; + return 0; + } + + KFREE(fsctx); + + return CFE_ERR_FILENOTFOUND; +} + +static int raw_fileop_open(void **ref,void *fsctx_arg,char *filename,int mode) +{ + raw_fsctx_t *fsctx; + raw_file_t *file; + char temp[100]; + char *len; + + if (mode != FILE_MODE_READ) return CFE_ERR_UNSUPPORTED; + + fsctx = (raw_fsctx_t *) fsctx_arg; + + file = KMALLOC(sizeof(raw_file_t),0); + if (!file) { + return CFE_ERR_NOMEM; + } + + file->raw_fileoffset = 0; + file->raw_fsctx = fsctx; + + /* Assume the whole device. */ + file->raw_baseoffset = 0; + file->raw_length = -1; + + /* + * If a filename was specified, it will be in the form + * offset,length - for example, 0x10000,0x200 + * Parse this into two pieces and set up our internal + * file extent information. you can use either decimal + * or "0x" notation. + */ + if (filename) { + lib_trimleading(filename); + strncpy(temp,filename,sizeof(temp)); + len = strchr(temp,','); + if (len) *len++ = '\0'; + if (temp[0]) { + file->raw_baseoffset = lib_atoi(temp); + } + if (len) { + file->raw_length = lib_atoi(len); + } + } + + fsctx->raw_refcnt++; + + *ref = file; + return 0; +} + +static int raw_fileop_read(void *ref,uint8_t *buf,int len) +{ + raw_file_t *file = (raw_file_t *) ref; + int res; + + /* + * Bound the length based on our "file length" if one + * was specified. + */ + + if (file->raw_length >= 0) { + if ((file->raw_length - file->raw_fileoffset) < len) { + len = file->raw_length - file->raw_fileoffset; + } + } + + if (len == 0) return 0; + + /* + * Read the data, adding in the base address. + */ + + res = cfe_readblk(file->raw_fsctx->raw_dev, + file->raw_baseoffset + file->raw_fileoffset, + buf,len); + + if (res > 0) { + file->raw_fileoffset += res; + } + + return res; +} + +static int raw_fileop_write(void *ref,uint8_t *buf,int len) +{ + return CFE_ERR_UNSUPPORTED; +} + +static int raw_fileop_seek(void *ref,int offset,int how) +{ + raw_file_t *file = (raw_file_t *) ref; + + switch (how) { + case FILE_SEEK_BEGINNING: + file->raw_fileoffset = offset; + break; + case FILE_SEEK_CURRENT: + file->raw_fileoffset += offset; + if (file->raw_fileoffset < 0) file->raw_fileoffset = 0; + break; + default: + break; + } + + /* + * Make sure we don't attempt to seek past the end of the file. + */ + + if (file->raw_length >= 0) { + if (file->raw_fileoffset > file->raw_length) { + file->raw_fileoffset = file->raw_length; + } + } + + return file->raw_fileoffset; +} + + +static void raw_fileop_close(void *ref) +{ + raw_file_t *file = (raw_file_t *) ref; + + file->raw_fsctx->raw_refcnt--; + + KFREE(file); +} + +static void raw_fileop_uninit(void *fsctx_arg) +{ + raw_fsctx_t *fsctx = (raw_fsctx_t *) fsctx_arg; + + if (fsctx->raw_refcnt) { + xprintf("raw_fileop_uninit: warning: refcnt not zero\n"); + } + + if (fsctx->raw_isconsole == FALSE) { + cfe_close(fsctx->raw_dev); + } + + KFREE(fsctx); +} diff --git a/cfe/cfe/main/cfe_savedata.c b/cfe/cfe/main/cfe_savedata.c new file mode 100644 index 0000000..e1d27c4 --- /dev/null +++ b/cfe/cfe/main/cfe_savedata.c @@ -0,0 +1,123 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Data Save routine File: cfe_savedata.c + * + * This module is used for dumping memory to an output device + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_error.h" +#include "cfe_devfuncs.h" + +#include "cfe.h" +#include "cfe_fileops.h" + +#include "cfe_loader.h" + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +/* ********************************************************************* + * cfe_savedata(fsname,filename,start,end) + * + * Write memory contents to the specified device + * + * Input parameters: + * fsname - name of file system + * filename - name of file within file system + * start - starting address (pointer) + * end - ending address (pointer) + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ +int cfe_savedata(char *fsname,char *devname,char *filename,uint8_t *start,uint8_t *end) +{ + int res; + fileio_ctx_t *fsctx; + void *ref; + + /* + * Create a file system context + */ + + res = fs_init(fsname,&fsctx,devname); + if (res != 0) { + return res; + } + + /* + * Open the device + */ + + res = fs_open(fsctx,&ref,filename,FILE_MODE_WRITE); + if (res != 0) { + fs_uninit(fsctx); + return res; + } + + /* + * Write the data + */ + + res = fs_write(fsctx,ref,start,end-start); + + /* + * Close + */ + + fs_close(fsctx,ref); + fs_uninit(fsctx); + + return res; + +} + diff --git a/cfe/cfe/main/cfe_timer.c b/cfe/cfe/main/cfe_timer.c new file mode 100644 index 0000000..2b8a0fc --- /dev/null +++ b/cfe/cfe/main/cfe_timer.c @@ -0,0 +1,286 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Timer routines File: cfe_timer.c + * + * This module contains routines to keep track of the system time,. + * Since we don't have any interrupts in the firmware, even the + * timer is polled. The timer must be called often enough + * to prevent missing the overflow of the CP0 COUNT + * register, approximately 2 billion cycles (half the count) + * + * Be sure to use the POLL() macro each time you enter a loop + * where you are waiting for some I/O event to occur or + * are waiting for time to elapse. + * + * It is *not* a time-of-year clock. The timer is only used + * for timing I/O events. + * + * Internally, time is maintained in units of "CLOCKSPERTICK", + * which should be about tenths of seconds. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_printf.h" + +#include "cfe_timer.h" + +#include "cfe.h" + +#include "bsp_config.h" +#include "cpu_config.h" + +/* Foxconn add start by Jenny Zhao, 07/02/2008*/ +#include "boardparms.h" +#include "bcm63xx_util.h" +#include "tftpd.h" +/* Foxconn add end by Jenny Zhao, 07/02/2008*/ + +#ifndef CFG_CPU_SPEED +#define CFG_CPU_SPEED 500000 /* CPU speed in Hz */ +#endif + +#ifndef CPUCFG_CYCLESPERCPUTICK +#define CPUCFG_CYCLESPERCPUTICK 1 /* CPU clock ticks per CP0 COUNT */ +#endif + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern int32_t _getticks(void); /* return value of CP0 COUNT */ + +/* ********************************************************************* + * Data + ********************************************************************* */ + +volatile int64_t cfe_ticks; /* current system time */ + +int cfe_cpu_speed = CFG_CPU_SPEED; /* CPU speed in clocks/second */ + +static unsigned int cfe_clocks_per_usec; +static unsigned int cfe_clocks_per_tick; + +static int32_t cfe_oldcount; /* For keeping track of ticks */ +static int32_t cfe_remticks; +static int cfe_timer_initflg = 0; + +/* + * C0_COUNT clocks per microsecond and per tick. Some CPUs tick CP0 + * every 'n' cycles, that's what CPUCFG_CYCLESPERCPUTICK is for. */ +#define CFE_CLOCKSPERUSEC (cfe_cpu_speed/1000000/(CPUCFG_CYCLESPERCPUTICK)) +#define CFE_CLOCKSPERTICK (cfe_cpu_speed/(CFE_HZ)/(CPUCFG_CYCLESPERCPUTICK)) + +/* Foxconn add start by Jenny Zhao, 07/02/2008*/ +extern int ui_docommands(char *str); + +extern int g_tftp_upgrade_success; +extern int nmrp_server_detected; + +//extern int g_reboot; +///* Foxconn add end by Jenny Zhao, 07/02/2008*/ + +/* ********************************************************************* + * cfe_timer_task() + * + * This routine is called as part of normal device polling to + * update the system time. We read the CP0 COUNT register, + * add the delta into our current time, convert to ticks, + * and keep track of the COUNT register overflow + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + + +static void cfe_timer_task(void *arg) +{ + int32_t count; + int32_t deltaticks; + int32_t clockspertick; + + /* Foxconn add start by Jenny Zhao, 07/02/2008*/ + static int64_t nmrp_previous_trigger_ticks = 0; + static int64_t tftp_previous_trigger_ticks = 0; + static int tftp_led_state = 0; + /* Foxconn add start by Jenny Zhao, 07/02/2008*/ + + clockspertick = CFE_CLOCKSPERTICK; + + count = _getticks(); + + if (count >= cfe_oldcount) { + deltaticks = (count - cfe_oldcount) / clockspertick; + cfe_remticks += (count - cfe_oldcount) % clockspertick; + } + else { + deltaticks = (cfe_oldcount - count) / clockspertick; + cfe_remticks += (cfe_oldcount - count) % clockspertick; + } + + cfe_ticks += deltaticks + (cfe_remticks / clockspertick); + cfe_remticks %= clockspertick; + cfe_oldcount = count; + + /* Foxconn add start by Jenny Zhao, 07/02/2008*/ + if(g_tftp_upgrade_success==1) + { + if((cfe_ticks - nmrp_previous_trigger_ticks) > 5) //500 ms + { + nmrp_previous_trigger_ticks = cfe_ticks; + nmrp_led_toggle(); + } + } + + /* Blink Power LED in tftpd mode */ + if ( (get_tftpd_state() != TFTPD_STATE_OFF) && (nmrp_server_detected==0) ) + { + if(tftp_led_state == 0) //led is off + { + if((cfe_ticks - tftp_previous_trigger_ticks) > 7) //700ms, spec. is 750ms + { + tftp_led_state = 1; + power_led_toggle(tftp_led_state); + tftp_previous_trigger_ticks = cfe_ticks; + } + } + else // led is currently on + { + if((cfe_ticks - tftp_previous_trigger_ticks) > 3) //300ms, spec. is 250ms + { + tftp_led_state = 0; + power_led_toggle(tftp_led_state); + tftp_previous_trigger_ticks = cfe_ticks; + } + } + } + /* Foxconn add end by Jenny Zhao, 07/02/2008*/ +} + + +/* ********************************************************************* + * cfe_timer_init() + * + * Initialize the timer module. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_timer_init(void) +{ + cfe_clocks_per_tick = CFE_CLOCKSPERTICK; + cfe_clocks_per_usec = CFE_CLOCKSPERUSEC; + if (cfe_clocks_per_usec == 0) + cfe_clocks_per_usec = 1; /* for the simulator */ + + cfe_oldcount = _getticks(); /* get current COUNT register */ + cfe_ticks = 0; + + if (!cfe_timer_initflg) { + cfe_bg_add(cfe_timer_task,NULL); /* add task for background polling */ + cfe_timer_initflg = 1; + } +} + + +/* ********************************************************************* + * cfe_sleep(ticks) + * + * Sleep for 'ticks' ticks. Background tasks are processed while + * we wait. + * + * Input parameters: + * ticks - number of ticks to sleep (note: *not* clocks!) + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_sleep(int ticks) +{ + int64_t timer; + + TIMER_SET(timer,ticks); + while (!TIMER_EXPIRED(timer)) { + POLL(); + } +} + + + +/* ********************************************************************* + * cfe_usleep(usec) + * + * Sleep for approximately the specified number of microseconds. + * + * Input parameters: + * usec - number of microseconds to wait + * + * Return value: + * nothing + ********************************************************************* */ + +void cfe_usleep(int usec) +{ + uint32_t newcount; + uint32_t now; + + /* XXX fix the wrap problem */ + + now = _getticks(); + newcount = now + usec*cfe_clocks_per_usec; + + if (newcount < now) /* wait for wraparound */ + while (_getticks() > now) + ; + + + while (_getticks() < newcount) + ; +} diff --git a/cfe/cfe/main/cfe_version.mk b/cfe/cfe/main/cfe_version.mk new file mode 100755 index 0000000..653cbf9 --- /dev/null +++ b/cfe/cfe/main/cfe_version.mk @@ -0,0 +1,12 @@ + +# +# CFE's version number +# Warning: Don't put spaces on either side of the equal signs +# Put just the version number in here. This file is sourced +# like a shell script in some cases! +# + +CFE_VER_MAJ=1 +CFE_VER_MIN=0 +CFE_VER_ECO=37 + diff --git a/cfe/cfe/main/cfe_xreq.c b/cfe/cfe/main/cfe_xreq.c new file mode 100644 index 0000000..d12b1f2 --- /dev/null +++ b/cfe/cfe/main/cfe_xreq.c @@ -0,0 +1,346 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCB dispatcher File: cfe_xreq.c + * + * This routine is the main API dispatch for CFE. User API + * calls, via the ROM entry point, get dispatched to routines + * in this module. + * + * This module looks similar to cfe_iocb_dispatch - it is different + * in that the data structure used, cfe_xiocb_t, uses fixed + * size field members (specifically, all 64-bits) no matter how + * the firmware is compiled. This ensures a consistent API + * interface on any implementation. When you call CFE + * from another program, the entry vector comes here first. + * + * Should the normal cfe_iocb interface change, this one should + * be kept the same for backward compatibility reasons. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "bsp_config.h" +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_queue.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_iocb.h" +#include "cfe_xiocb.h" +#if CFG_VENDOR_EXTENSIONS +#include "cfe_vendor_iocb.h" +#include "cfe_vendor_xiocb.h" +#endif +#include "cfe_error.h" +#include "cfe_device.h" +#include "cfe_timer.h" +#include "cfe_mem.h" +#include "env_subr.h" +#include "cfe.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +/* enum values for various plist types */ + +#define PLBUF 1 /* iocb_buffer_t */ +#define PLCPU 2 /* iocb_cpuctl_t */ +#define PLMEM 3 /* iocb_meminfo_t */ +#define PLENV 4 /* iocb_envbuf_t */ +#define PLINP 5 /* iocb_inpstat_t */ +#define PLTIM 6 /* iocb_time_t */ +#define PLINF 7 /* iocb_fwinfo_t */ +#define PLEXIT 8 /* iocb_exitstat_t */ + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +struct cfe_xcmd_dispatch_s { + int xplistsize; + int iplistsize; + int plisttype; +}; + + +/* ********************************************************************* + * Command conversion table + * This table contains useful information for converting + * iocbs to xiocbs. + ********************************************************************* */ + +const static struct cfe_xcmd_dispatch_s cfe_xcmd_dispatch_table[CFE_CMD_MAX] = { + {sizeof(xiocb_fwinfo_t), sizeof(iocb_fwinfo_t), PLINF}, /* 0 : CFE_CMD_FW_GETINFO */ + {sizeof(xiocb_exitstat_t),sizeof(iocb_exitstat_t),PLEXIT}, /* 1 : CFE_CMD_FW_RESTART */ + {sizeof(xiocb_buffer_t), sizeof(iocb_buffer_t), PLBUF}, /* 2 : CFE_CMD_FW_BOOT */ + {sizeof(xiocb_cpuctl_t), sizeof(iocb_cpuctl_t), PLCPU}, /* 3 : CFE_CMD_FW_CPUCTL */ + {sizeof(xiocb_time_t), sizeof(iocb_time_t), PLTIM}, /* 4 : CFE_CMD_FW_GETTIME */ + {sizeof(xiocb_meminfo_t),sizeof(iocb_meminfo_t),PLMEM}, /* 5 : CFE_CMD_FW_MEMENUM */ + {0, 0, 0}, /* 6 : CFE_CMD_FW_FLUSHCACHE */ + {-1, 0, 0}, /* 7 : */ + {-1, 0, 0}, /* 8 : */ + {0, 0, 0}, /* 9 : CFE_CMD_DEV_GETHANDLE */ + {sizeof(xiocb_envbuf_t), sizeof(iocb_envbuf_t), PLENV}, /* 10 : CFE_CMD_DEV_ENUM */ + {sizeof(xiocb_buffer_t), sizeof(iocb_buffer_t), PLBUF}, /* 11 : CFE_CMD_DEV_OPEN_*/ + {sizeof(xiocb_inpstat_t),sizeof(iocb_inpstat_t),PLINP}, /* 12 : CFE_CMD_DEV_INPSTAT */ + {sizeof(xiocb_buffer_t), sizeof(iocb_buffer_t), PLBUF}, /* 13 : CFE_CMD_DEV_READ */ + {sizeof(xiocb_buffer_t), sizeof(iocb_buffer_t), PLBUF}, /* 14 : CFE_CMD_DEV_WRITE */ + {sizeof(xiocb_buffer_t), sizeof(iocb_buffer_t), PLBUF}, /* 15 : CFE_CMD_DEV_IOCTL */ + {0, 0, 0}, /* 16 : CFE_CMD_DEV_CLOSE */ + {sizeof(xiocb_buffer_t), sizeof(iocb_buffer_t), PLBUF}, /* 17 : CFE_CMD_DEV_GETINFO */ + {-1, 0, 0}, /* 18 : */ + {-1, 0, 0}, /* 19 : */ + {sizeof(xiocb_envbuf_t), sizeof(iocb_envbuf_t), PLENV}, /* 20 : CFE_CMD_ENV_ENUM */ + {-1, 0, 0}, /* 21 : */ + {sizeof(xiocb_envbuf_t), sizeof(iocb_envbuf_t), PLENV}, /* 22 : CFE_CMD_ENV_GET */ + {sizeof(xiocb_envbuf_t), sizeof(iocb_envbuf_t), PLENV}, /* 23 : CFE_CMD_ENV_SET */ + {sizeof(xiocb_envbuf_t), sizeof(iocb_envbuf_t), PLENV}, /* 24 : CFE_CMD_ENV_DEL */ + {-1, 0, 0}, /* 25 : */ + {-1, 0, 0}, /* 26 : */ + {-1, 0, 0}, /* 27 : */ + {-1, 0, 0}, /* 28 : */ + {-1, 0, 0}, /* 29 : */ + {-1, 0, 0}, /* 30 : */ + {-1, 0, 0} /* 31 : */ +}; + + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern int cfe_iocb_dispatch(cfe_iocb_t *iocb); +cfe_int_t cfe_doxreq(cfe_xiocb_t *xiocb); +#if CFG_VENDOR_EXTENSIONS +extern cfe_int_t cfe_vendor_doxreq(cfe_vendor_xiocb_t *xiocb); +#endif + +/* ********************************************************************* + * cfe_doxreq(xiocb) + * + * Process an xiocb request. This routine converts an xiocb + * into an iocb, calls the IOCB dispatcher, converts the results + * back into the xiocb, and returns. + * + * Input parameters: + * xiocb - pointer to user xiocb + * + * Return value: + * command status, <0 if error occured + ********************************************************************* */ + +cfe_int_t cfe_doxreq(cfe_xiocb_t *xiocb) +{ + const struct cfe_xcmd_dispatch_s *disp; + cfe_iocb_t iiocb; + cfe_int_t res; + + /* + * Call out to customer-specific IOCBs. Customers may choose + * to implement their own XIOCBs directly, or go through their own + * translation layer (xiocb->iocb like CFE does) to insulate + * themselves from IOCB changes in the future. + */ + if (xiocb->xiocb_fcode >= CFE_CMD_VENDOR_USE) { +#if CFG_VENDOR_EXTENSIONS + return cfe_vendor_doxreq((cfe_vendor_xiocb_t *)xiocb); +#else + return CFE_ERR_INV_COMMAND; +#endif + } + + /* + * Check for commands codes out of range + */ + + if ((xiocb->xiocb_fcode < 0) || (xiocb->xiocb_fcode >= CFE_CMD_MAX)) { + xiocb->xiocb_status = CFE_ERR_INV_COMMAND; + return xiocb->xiocb_status; + } + + /* + * Check for command codes in range but invalid + */ + + disp = &cfe_xcmd_dispatch_table[xiocb->xiocb_fcode]; + + if (disp->xplistsize < 0) { + xiocb->xiocb_status = CFE_ERR_INV_COMMAND; + return xiocb->xiocb_status; + } + + /* + * Check for invalid parameter list size + */ + + if (disp->xplistsize != xiocb->xiocb_psize) { + xiocb->xiocb_status = CFE_ERR_INV_PARAM; + return xiocb->xiocb_status; + } + + /* + * Okay, copy parameters into the internal IOCB. + * First, the fixed header. + */ + + iiocb.iocb_fcode = (unsigned int) xiocb->xiocb_fcode; + iiocb.iocb_status = (int) xiocb->xiocb_status; + iiocb.iocb_handle = (int) xiocb->xiocb_handle; + iiocb.iocb_flags = (unsigned int) xiocb->xiocb_flags; + iiocb.iocb_psize = (unsigned int) disp->iplistsize; + + /* + * Now the parameter list + */ + + switch (disp->plisttype) { + case PLBUF: + iiocb.plist.iocb_buffer.buf_offset = (cfe_offset_t) xiocb->plist.xiocb_buffer.buf_offset; + iiocb.plist.iocb_buffer.buf_ptr = (unsigned char *) (uintptr_t) xiocb->plist.xiocb_buffer.buf_ptr; + iiocb.plist.iocb_buffer.buf_length = (unsigned int) xiocb->plist.xiocb_buffer.buf_length; + iiocb.plist.iocb_buffer.buf_retlen = (unsigned int) xiocb->plist.xiocb_buffer.buf_retlen; + iiocb.plist.iocb_buffer.buf_ioctlcmd = (unsigned int) xiocb->plist.xiocb_buffer.buf_ioctlcmd; + break; + case PLCPU: + iiocb.plist.iocb_cpuctl.cpu_number = (unsigned int) xiocb->plist.xiocb_cpuctl.cpu_number; + iiocb.plist.iocb_cpuctl.cpu_command = (unsigned int) xiocb->plist.xiocb_cpuctl.cpu_command; + iiocb.plist.iocb_cpuctl.start_addr = (unsigned long) xiocb->plist.xiocb_cpuctl.start_addr; + iiocb.plist.iocb_cpuctl.gp_val = (unsigned long) xiocb->plist.xiocb_cpuctl.gp_val; + iiocb.plist.iocb_cpuctl.sp_val = (unsigned long) xiocb->plist.xiocb_cpuctl.sp_val; + iiocb.plist.iocb_cpuctl.a1_val = (unsigned long) xiocb->plist.xiocb_cpuctl.a1_val; + break; + case PLMEM: + iiocb.plist.iocb_meminfo.mi_idx = (int) xiocb->plist.xiocb_meminfo.mi_idx; + iiocb.plist.iocb_meminfo.mi_type = (int) xiocb->plist.xiocb_meminfo.mi_type; + iiocb.plist.iocb_meminfo.mi_addr = (unsigned long long) xiocb->plist.xiocb_meminfo.mi_addr; + iiocb.plist.iocb_meminfo.mi_size = (unsigned long long) xiocb->plist.xiocb_meminfo.mi_size; + break; + case PLENV: + iiocb.plist.iocb_envbuf.enum_idx = (int) xiocb->plist.xiocb_envbuf.enum_idx; + iiocb.plist.iocb_envbuf.name_ptr = (unsigned char *) (uintptr_t) xiocb->plist.xiocb_envbuf.name_ptr; + iiocb.plist.iocb_envbuf.name_length = (int) xiocb->plist.xiocb_envbuf.name_length; + iiocb.plist.iocb_envbuf.val_ptr = (unsigned char *) (uintptr_t) xiocb->plist.xiocb_envbuf.val_ptr; + iiocb.plist.iocb_envbuf.val_length = (int) xiocb->plist.xiocb_envbuf.val_length; + break; + case PLINP: + iiocb.plist.iocb_inpstat.inp_status = (int) xiocb->plist.xiocb_inpstat.inp_status; + break; + case PLTIM: + iiocb.plist.iocb_time.ticks = (long long) xiocb->plist.xiocb_time.ticks; + break; + case PLINF: + break; + case PLEXIT: + iiocb.plist.iocb_exitstat.status = (long long) xiocb->plist.xiocb_exitstat.status; + break; + } + + /* + * Do the internal function dispatch + */ + + res = (cfe_int_t) cfe_iocb_dispatch(&iiocb); + + /* + * Now convert the parameter list members back + */ + + switch (disp->plisttype) { + case PLBUF: + xiocb->plist.xiocb_buffer.buf_offset = (cfe_uint_t) iiocb.plist.iocb_buffer.buf_offset; + xiocb->plist.xiocb_buffer.buf_ptr = (cfe_xptr_t) (uintptr_t) iiocb.plist.iocb_buffer.buf_ptr; + xiocb->plist.xiocb_buffer.buf_length = (cfe_uint_t) iiocb.plist.iocb_buffer.buf_length; + xiocb->plist.xiocb_buffer.buf_retlen = (cfe_uint_t) iiocb.plist.iocb_buffer.buf_retlen; + xiocb->plist.xiocb_buffer.buf_ioctlcmd = (cfe_uint_t) iiocb.plist.iocb_buffer.buf_ioctlcmd; + break; + case PLCPU: + xiocb->plist.xiocb_cpuctl.cpu_number = (cfe_uint_t) iiocb.plist.iocb_cpuctl.cpu_number; + xiocb->plist.xiocb_cpuctl.cpu_command = (cfe_uint_t) iiocb.plist.iocb_cpuctl.cpu_command; + xiocb->plist.xiocb_cpuctl.start_addr = (cfe_uint_t) iiocb.plist.iocb_cpuctl.start_addr; + break; + case PLMEM: + xiocb->plist.xiocb_meminfo.mi_idx = (cfe_int_t) iiocb.plist.iocb_meminfo.mi_idx; + xiocb->plist.xiocb_meminfo.mi_type = (cfe_int_t) iiocb.plist.iocb_meminfo.mi_type; + xiocb->plist.xiocb_meminfo.mi_addr = (cfe_int64_t) iiocb.plist.iocb_meminfo.mi_addr; + xiocb->plist.xiocb_meminfo.mi_size = (cfe_int64_t) iiocb.plist.iocb_meminfo.mi_size; + break; + case PLENV: + xiocb->plist.xiocb_envbuf.enum_idx = (cfe_int_t) iiocb.plist.iocb_envbuf.enum_idx; + xiocb->plist.xiocb_envbuf.name_ptr = (cfe_xptr_t) (uintptr_t) iiocb.plist.iocb_envbuf.name_ptr; + xiocb->plist.xiocb_envbuf.name_length = (cfe_int_t) iiocb.plist.iocb_envbuf.name_length; + xiocb->plist.xiocb_envbuf.val_ptr = (cfe_xptr_t) (uintptr_t) iiocb.plist.iocb_envbuf.val_ptr; + xiocb->plist.xiocb_envbuf.val_length = (cfe_int_t) iiocb.plist.iocb_envbuf.val_length; + break; + case PLINP: + xiocb->plist.xiocb_inpstat.inp_status = (cfe_int_t) iiocb.plist.iocb_inpstat.inp_status; + break; + case PLTIM: + xiocb->plist.xiocb_time.ticks = (cfe_int_t) iiocb.plist.iocb_time.ticks; + break; + case PLINF: + xiocb->plist.xiocb_fwinfo.fwi_version = iiocb.plist.iocb_fwinfo.fwi_version; + xiocb->plist.xiocb_fwinfo.fwi_totalmem = iiocb.plist.iocb_fwinfo.fwi_totalmem; + xiocb->plist.xiocb_fwinfo.fwi_flags = iiocb.plist.iocb_fwinfo.fwi_flags; + xiocb->plist.xiocb_fwinfo.fwi_boardid = iiocb.plist.iocb_fwinfo.fwi_boardid; + xiocb->plist.xiocb_fwinfo.fwi_bootarea_va = iiocb.plist.iocb_fwinfo.fwi_bootarea_va; + xiocb->plist.xiocb_fwinfo.fwi_bootarea_pa = iiocb.plist.iocb_fwinfo.fwi_bootarea_pa; + xiocb->plist.xiocb_fwinfo.fwi_bootarea_size = iiocb.plist.iocb_fwinfo.fwi_bootarea_size; + xiocb->plist.xiocb_fwinfo.fwi_reserved1 = iiocb.plist.iocb_fwinfo.fwi_reserved1; + xiocb->plist.xiocb_fwinfo.fwi_reserved2 = iiocb.plist.iocb_fwinfo.fwi_reserved2; + xiocb->plist.xiocb_fwinfo.fwi_reserved3 = iiocb.plist.iocb_fwinfo.fwi_reserved3; + break; + case PLEXIT: + xiocb->plist.xiocb_exitstat.status = (cfe_int_t) iiocb.plist.iocb_exitstat.status; + break; + } + + /* + * And the fixed header + */ + + xiocb->xiocb_status = (cfe_int_t) iiocb.iocb_status; + xiocb->xiocb_handle = (cfe_int_t) iiocb.iocb_handle; + xiocb->xiocb_flags = (cfe_uint_t) iiocb.iocb_flags; + + return xiocb->xiocb_status; +} diff --git a/cfe/cfe/main/cfe_zlibfs.c b/cfe/cfe/main/cfe_zlibfs.c new file mode 100644 index 0000000..7ad0847 --- /dev/null +++ b/cfe/cfe/main/cfe_zlibfs.c @@ -0,0 +1,453 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * "Compressed" file system File: cfe_zlibfs.c + * + * This is more of a filesystem "hook" than an actual file system. + * You can stick it on the front of the chain of file systems + * that CFE calls and it will route data read from the + * underlying filesystem through ZLIB before passing it up to the + * user. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#if CFG_ZLIB + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_error.h" +#include "cfe_fileops.h" +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_console.h" + +#include "cfe.h" + +#include "zlib.h" + +/* ********************************************************************* + * ZLIBFS context + ********************************************************************* */ + +/* + * File system context - describes overall file system info, + * such as the handle to the underlying device. + */ + +typedef struct zlibfs_fsctx_s { + void *zlibfsctx_subfsctx; + const fileio_dispatch_t *zlibfsctx_subops; + int zlibfsctx_refcnt; +} zlibfs_fsctx_t; + +/* + * File context - describes an open file on the file system. + * For raw devices, this is pretty meaningless, but we do + * keep track of where we are. + */ + +#define ZLIBFS_BUFSIZE 1024 +typedef struct zlibfs_file_s { + zlibfs_fsctx_t *zlibfs_fsctx; + int zlibfs_fileoffset; + void *zlibfs_subfile; + z_stream zlibfs_stream; + uint8_t *zlibfs_inbuf; + uint8_t *zlibfs_outbuf; + int zlibfs_outlen; + uint8_t *zlibfs_outptr; + int zlibfs_eofseen; +} zlibfs_file_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +static int zlibfs_fileop_init(void **fsctx,void *ctx); +static int zlibfs_fileop_open(void **ref,void *fsctx,char *filename,int mode); +static int zlibfs_fileop_read(void *ref,uint8_t *buf,int len); +static int zlibfs_fileop_write(void *ref,uint8_t *buf,int len); +static int zlibfs_fileop_seek(void *ref,int offset,int how); +static void zlibfs_fileop_close(void *ref); +static void zlibfs_fileop_uninit(void *fsctx); + +voidpf zcalloc(voidpf opaque,unsigned items, unsigned size); +void zcfree(voidpf opaque,voidpf ptr); + +/* ********************************************************************* + * ZLIB fileio dispatch table + ********************************************************************* */ + + +static uint8_t gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ + + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +const fileio_dispatch_t zlibfs_fileops = { + "z", + 0, + zlibfs_fileop_init, + zlibfs_fileop_open, + zlibfs_fileop_read, + zlibfs_fileop_write, + zlibfs_fileop_seek, + zlibfs_fileop_close, + zlibfs_fileop_uninit +}; + +/* + * Utility functions needed by the ZLIB routines + */ +voidpf zcalloc(voidpf opaque,unsigned items, unsigned size) +{ + void *ptr; + + ptr = KMALLOC(items*size,0); + if (ptr) lib_memset(ptr,0,items*size); + return ptr; +} + +void zcfree(voidpf opaque,voidpf ptr) +{ + KFREE(ptr); +} + + +static int zlibfs_fileop_init(void **newfsctx,void *curfsvoid) +{ + zlibfs_fsctx_t *fsctx; + fileio_ctx_t *curfsctx = (fileio_ctx_t *) curfsvoid; + + *newfsctx = NULL; + + fsctx = KMALLOC(sizeof(zlibfs_fsctx_t),0); + if (!fsctx) { + return CFE_ERR_NOMEM; + } + + fsctx->zlibfsctx_refcnt = 0; + fsctx->zlibfsctx_subops = curfsctx->ops; + fsctx->zlibfsctx_subfsctx = curfsctx->fsctx; + + *newfsctx = fsctx; + + return 0; +} + + +static int get_byte(zlibfs_file_t *file,uint8_t *ch) +{ + int res; + + res = BDREAD(file->zlibfs_fsctx->zlibfsctx_subops, + file->zlibfs_subfile, + ch, + 1); + + return res; +} + + +static int check_header(zlibfs_file_t *file) +{ + int method; /* method byte */ + int flags; /* flags byte */ + uInt len; + uint8_t c; + int res; + + /* Check the gzip magic header */ + for (len = 0; len < 2; len++) { + res = get_byte(file,&c); + if (c != gz_magic[len]) { + return -1; + } + } + + get_byte(file,&c); method = (int) c; + get_byte(file,&c); flags = (int) c; + + if (method != Z_DEFLATED || (flags & RESERVED) != 0) { + return -1; + } + + /* Discard time, xflags and OS code: */ + for (len = 0; len < 6; len++) (void)get_byte(file,&c); + + if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ + get_byte(file,&c); + len = (uInt) c; + get_byte(file,&c); + len += ((uInt)c)<<8; + /* len is garbage if EOF but the loop below will quit anyway */ + while ((len-- != 0) && (get_byte(file,&c) == 1)) ; + } + if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ + while ((get_byte(file,&c) == 1) && (c != 0)) ; + } + if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ + while ((get_byte(file,&c) == 1) && (c != 0)) ; + } + if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ + for (len = 0; len < 2; len++) (void)get_byte(file,&c); + } + + return 0; +} + +static int zlibfs_fileop_open(void **ref,void *fsctx_arg,char *filename,int mode) +{ + zlibfs_fsctx_t *fsctx; + zlibfs_file_t *file; + int err; + + if (mode != FILE_MODE_READ) return CFE_ERR_UNSUPPORTED; + + fsctx = (zlibfs_fsctx_t *) fsctx_arg; + + file = KMALLOC(sizeof(zlibfs_file_t),0); + if (!file) { + return CFE_ERR_NOMEM; + } + + file->zlibfs_fileoffset = 0; + file->zlibfs_fsctx = fsctx; + file->zlibfs_inbuf = NULL; + file->zlibfs_outbuf = NULL; + file->zlibfs_eofseen = 0; + + err = BDOPEN(fsctx->zlibfsctx_subops,&(file->zlibfs_subfile), + fsctx->zlibfsctx_subfsctx,filename); + + if (err != 0) { + goto error2; + return err; + } + + /* Open the zstream */ + + file->zlibfs_inbuf = KMALLOC(ZLIBFS_BUFSIZE,0); + file->zlibfs_outbuf = KMALLOC(ZLIBFS_BUFSIZE,0); + + if (!file->zlibfs_inbuf || !file->zlibfs_outbuf) { + err = CFE_ERR_NOMEM; + goto error; + } + + file->zlibfs_stream.next_in = NULL; + file->zlibfs_stream.avail_in = 0; + file->zlibfs_stream.next_out = file->zlibfs_outbuf; + file->zlibfs_stream.avail_out = ZLIBFS_BUFSIZE; + file->zlibfs_stream.zalloc = (alloc_func)0; + file->zlibfs_stream.zfree = (free_func)0; + + file->zlibfs_outlen = 0; + file->zlibfs_outptr = file->zlibfs_outbuf; + + err = inflateInit2(&(file->zlibfs_stream),-15); + if (err != Z_OK) { + err = CFE_ERR; + goto error; + } + + check_header(file); + + fsctx->zlibfsctx_refcnt++; + + *ref = file; + return 0; + +error: + BDCLOSE(file->zlibfs_fsctx->zlibfsctx_subops,file->zlibfs_subfile); +error2: + if (file->zlibfs_inbuf) KFREE(file->zlibfs_inbuf); + if (file->zlibfs_outbuf) KFREE(file->zlibfs_outbuf); + KFREE(file); + return err; +} + +static int zlibfs_fileop_read(void *ref,uint8_t *buf,int len) +{ + zlibfs_file_t *file = (zlibfs_file_t *) ref; + int res = 0; + int err; + int amtcopy; + int ttlcopy = 0; + + if (len == 0) return 0; + + while (len) { + + /* Figure the amount to copy. This is the min of what we + have left to do and what is available. */ + amtcopy = len; + if (amtcopy > file->zlibfs_outlen) { + amtcopy = file->zlibfs_outlen; + } + + /* Copy the data. */ + + if (buf) { + memcpy(buf,file->zlibfs_outptr,amtcopy); + buf += amtcopy; + } + + /* Update the pointers. */ + file->zlibfs_outptr += amtcopy; + file->zlibfs_outlen -= amtcopy; + len -= amtcopy; + ttlcopy += amtcopy; + + /* If we've eaten all of the output, reset and call inflate + again. */ + + if (file->zlibfs_outlen == 0) { + /* If no input data to decompress, get some more if we can. */ + if (file->zlibfs_eofseen) break; + if (file->zlibfs_stream.avail_in == 0) { + res = BDREAD(file->zlibfs_fsctx->zlibfsctx_subops, + file->zlibfs_subfile, + file->zlibfs_inbuf, + ZLIBFS_BUFSIZE); + /* If at EOF or error, get out. */ + if (res <= 0) break; + file->zlibfs_stream.next_in = file->zlibfs_inbuf; + file->zlibfs_stream.avail_in = res; + } + + /* inflate the input data. */ + file->zlibfs_stream.next_out = file->zlibfs_outbuf; + file->zlibfs_stream.avail_out = ZLIBFS_BUFSIZE; + file->zlibfs_outptr = file->zlibfs_outbuf; + err = inflate(&(file->zlibfs_stream),Z_SYNC_FLUSH); + if (err == Z_STREAM_END) { + /* We can get a partial buffer fill here. */ + file->zlibfs_eofseen = 1; + } + else if (err != Z_OK) { + res = CFE_ERR; + break; + } + file->zlibfs_outlen = file->zlibfs_stream.next_out - + file->zlibfs_outptr; + } + + } + + file->zlibfs_fileoffset += ttlcopy; + + return (res < 0) ? res : ttlcopy; +} + +static int zlibfs_fileop_write(void *ref,uint8_t *buf,int len) +{ + return CFE_ERR_UNSUPPORTED; +} + +static int zlibfs_fileop_seek(void *ref,int offset,int how) +{ + zlibfs_file_t *file = (zlibfs_file_t *) ref; + int res; + int delta; + + switch (how) { + case FILE_SEEK_BEGINNING: + delta = offset - file->zlibfs_fileoffset; + break; + case FILE_SEEK_CURRENT: + delta = offset; + break; + default: + return CFE_ERR_UNSUPPORTED; + break; + } + + /* backward seeking not allowed on compressed streams */ + if (delta < 0) { + return CFE_ERR_UNSUPPORTED; + } + + res = zlibfs_fileop_read(ref,NULL,delta); + + if (res < 0) return res; + + return file->zlibfs_fileoffset; +} + + +static void zlibfs_fileop_close(void *ref) +{ + zlibfs_file_t *file = (zlibfs_file_t *) ref; + + file->zlibfs_fsctx->zlibfsctx_refcnt--; + + inflateEnd(&(file->zlibfs_stream)); + + BDCLOSE(file->zlibfs_fsctx->zlibfsctx_subops,file->zlibfs_subfile); + + KFREE(file); +} + +static void zlibfs_fileop_uninit(void *fsctx_arg) +{ + zlibfs_fsctx_t *fsctx = (zlibfs_fsctx_t *) fsctx_arg; + + if (fsctx->zlibfsctx_refcnt) { + xprintf("zlibfs_fileop_uninit: warning: refcnt not zero\n"); + } + + BDUNINIT(fsctx->zlibfsctx_subops,fsctx->zlibfsctx_subfsctx); + + KFREE(fsctx); +} + + +#endif diff --git a/cfe/cfe/main/env_subr.c b/cfe/cfe/main/env_subr.c new file mode 100644 index 0000000..5f12359 --- /dev/null +++ b/cfe/cfe/main/env_subr.c @@ -0,0 +1,474 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Environment variable subroutines File: env_subr.c + * + * This module contains routines to muck with environment variables + * (manage the list, read/write to nvram, etc.) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "env_subr.h" +#include "nvram_subr.h" + +#include "cfe_error.h" +#include "cfe.h" + +/* ********************************************************************* + * Types + ********************************************************************* */ + +typedef struct cfe_envvar_s { + queue_t qb; + int flags; + char *name; + char *value; + /* name and value go here */ +} cfe_envvar_t; + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +queue_t env_envvars = {&env_envvars,&env_envvars}; +extern unsigned int cfe_startflags; + +/* ********************************************************************* + * env_findenv(name) + * + * Locate an environment variable in the in-memory list + * + * Input parameters: + * name - name of env var to find + * + * Return value: + * cfe_envvar_t pointer, or NULL if not found + ********************************************************************* */ + +static cfe_envvar_t *env_findenv(const char *name) +{ + queue_t *qb; + cfe_envvar_t *env; + + for (qb = env_envvars.q_next; qb != &env_envvars; qb = qb->q_next) { + env = (cfe_envvar_t *) qb; + if (strcmp(env->name,name) == 0) break; + } + + if (qb == &env_envvars) return NULL; + + return (cfe_envvar_t *) qb; + +} + +/* ********************************************************************* + * env_enum(idx,name,namelen,val,vallen) + * + * Enumerate environment variables. This routine locates + * the nth environment variable and copies its name and value + * to user buffers. + * + * The namelen and vallen variables must be preinitialized to + * the maximum size of the output buffer. + * + * Input parameters: + * idx - variable index to find (starting with zero) + * name,namelen - name buffer and length + * val,vallen - value buffer and length + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int env_enum(int idx,char *name,int *namelen,char *val,int *vallen) +{ + queue_t *qb; + cfe_envvar_t *env; + + for (qb = env_envvars.q_next; qb != &env_envvars; qb = qb->q_next) { + if (idx == 0) break; + idx--; + } + + if (qb == &env_envvars) return CFE_ERR_ENVNOTFOUND; + env = (cfe_envvar_t *) qb; + + *namelen = xstrncpy(name,env->name,*namelen); + *vallen = xstrncpy(val,env->value,*vallen); + + return 0; + +} + +/* ********************************************************************* + * env_envtype(name) + * + * Return the type of the environment variable + * + * Input parameters: + * name - name of environment variable + * + * Return value: + * flags, or <0 if error occured + ********************************************************************* */ +int env_envtype(const char *name) +{ + cfe_envvar_t *env; + + env = env_findenv(name); + + if (env) { + return env->flags; + } + + return CFE_ERR_ENVNOTFOUND; +} + + + +/* ********************************************************************* + * env_delenv(name) + * + * Delete an environment variable + * + * Input parameters: + * name - environment variable to delete + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int env_delenv(const char *name) +{ + cfe_envvar_t *env; + + env = env_findenv(name); + + if (!env) return 0; + + if (!(env->flags & ENV_FLG_READONLY)) { + q_dequeue((queue_t *) env); + KFREE(env); + return 0; + } + + return CFE_ERR_ENVNOTFOUND; +} + +/* ********************************************************************* + * env_getenv(name) + * + * Retrieve the value of an environment variable + * + * Input parameters: + * name - name of environment variable to find + * + * Return value: + * value, or NULL if variable is not found + ********************************************************************* */ + +char *env_getenv(const char *name) +{ + cfe_envvar_t *env; + + env = env_findenv(name); + + if (env) { + return env->value; + } + + return NULL; +} + + +/* ********************************************************************* + * env_setenv(name,value,flags) + * + * Set the value of an environment variable + * + * Input parameters: + * name - name of variable + * value - value of variable + * flags - flags for variable (ENV_FLG_xxx) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int env_setenv(const char *name,char *value,int flags) +{ + cfe_envvar_t *env; + int namelen; + + env = env_findenv(name); + if (env) { + if (!(flags & ENV_FLG_ADMIN)) { + if (env->flags & ENV_FLG_READONLY) return CFE_ERR_ENVREADONLY; + } + q_dequeue((queue_t *) env); + KFREE(env); + } + + namelen = strlen(name); + + env = KMALLOC(sizeof(cfe_envvar_t) + namelen + 1 + strlen(value) + 1,0); + if (!env) return CFE_ERR_NOMEM; + + env->name = (char *) (env+1); + env->value = env->name + namelen + 1; + env->flags = (flags & ENV_FLG_MASK); + + strcpy(env->name,name); + strcpy(env->value,value); + + q_enqueue(&env_envvars,(queue_t *) env); + + return 0; +} + + +/* ********************************************************************* + * env_load() + * + * Load the environment from the NVRAM device. + * + * Input parameters: + * nothing + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + + +int env_load(void) +{ + int size; + unsigned char *buffer; + unsigned char *ptr; + unsigned char *envval; + unsigned int reclen; + unsigned int rectype; + int offset; + int flg; + int retval = -1; + char valuestr[256]; + + /* + * If in 'safe mode', don't read the environment the first time. + */ + + if (cfe_startflags & CFE_INIT_SAFE) { + cfe_startflags &= ~CFE_INIT_SAFE; + return 0; + } + + flg = nvram_open(); + if (flg < 0) return flg; + + size = nvram_getsize(); + buffer = KMALLOC(size,0); + + if (buffer == NULL) return CFE_ERR_NOMEM; + + ptr = buffer; + offset = 0; + + /* Read the record type and length */ + if (nvram_read(ptr,offset,1) != 1) { + retval = CFE_ERR_IOERR; + goto error; + } + + while ((*ptr != ENV_TLV_TYPE_END) && (size > 1)) { + + /* Adjust pointer for TLV type */ + rectype = *(ptr); + offset++; + size--; + + /* + * Read the length. It can be either 1 or 2 bytes + * depending on the code + */ + if (rectype & ENV_LENGTH_8BITS) { + /* Read the record type and length - 8 bits */ + if (nvram_read(ptr,offset,1) != 1) { + retval = CFE_ERR_IOERR; + goto error; + } + reclen = *(ptr); + size--; + offset++; + } + else { + /* Read the record type and length - 16 bits, MSB first */ + if (nvram_read(ptr,offset,2) != 2) { + retval = CFE_ERR_IOERR; + goto error; + } + reclen = (((unsigned int) *(ptr)) << 8) + (unsigned int) *(ptr+1); + size -= 2; + offset += 2; + } + + if (reclen > size) break; /* should not happen, bad NVRAM */ + + switch (rectype) { + case ENV_TLV_TYPE_ENV: + /* Read the TLV data */ + if (nvram_read(ptr,offset,reclen) != reclen) goto error; + flg = *ptr++; + envval = (unsigned char *) strnchr(ptr,'=',(reclen-1)); + if (envval) { + *envval++ = '\0'; + memcpy(valuestr,envval,(reclen-1)-(envval-ptr)); + valuestr[(reclen-1)-(envval-ptr)] = '\0'; + env_setenv(ptr,valuestr,flg); + } + break; + + default: + /* Unknown TLV type, skip it. */ + break; + } + + /* + * Advance to next TLV + */ + + size -= (int)reclen; + offset += reclen; + + /* Read the next record type */ + ptr = buffer; + if (nvram_read(ptr,offset,1) != 1) goto error; + } + + retval = 0; /* success! */ + +error: + KFREE(buffer); + nvram_close(); + + return retval; + +} + + +/* ********************************************************************* + * env_save() + * + * Write the environment to the NVRAM device. + * + * Input parameters: + * nothing + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int env_save(void) +{ + int size; + unsigned char *buffer; + unsigned char *buffer_end; + unsigned char *ptr; + queue_t *qb; + cfe_envvar_t *env; + int namelen; + int valuelen; + int flg; + + flg = nvram_open(); + if (flg < 0) return flg; + + nvram_erase(); + + size = nvram_getsize(); + buffer = KMALLOC(size,0); + + if (buffer == NULL) return CFE_ERR_NOMEM; + + buffer_end = buffer + size; + + ptr = buffer; + + for (qb = env_envvars.q_next; qb != &env_envvars; qb = qb->q_next) { + env = (cfe_envvar_t *) qb; + + if (env->flags & (ENV_FLG_BUILTIN)) continue; + + namelen = strlen(env->name); + valuelen = strlen(env->value); + + if ((ptr + 2 + namelen + valuelen + 1 + 1 + 1) > buffer_end) break; + + *ptr++ = ENV_TLV_TYPE_ENV; /* TLV record type */ + *ptr++ = (namelen + valuelen + 1 + 1); /* TLV record length */ + + *ptr++ = (unsigned char)env->flags; + memcpy(ptr,env->name,namelen); /* TLV record data */ + ptr += namelen; + *ptr++ = '='; + memcpy(ptr,env->value,valuelen); + ptr += valuelen; + + } + + *ptr++ = ENV_TLV_TYPE_END; + + size = nvram_write(buffer,0,ptr-buffer); + + KFREE(buffer); + + nvram_close(); + + return (size == (ptr-buffer)) ? 0 : CFE_ERR_IOERR; +} diff --git a/cfe/cfe/main/nvram_subr.c b/cfe/cfe/main/nvram_subr.c new file mode 100644 index 0000000..2c44bca --- /dev/null +++ b/cfe/cfe/main/nvram_subr.c @@ -0,0 +1,300 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * NVRAM subroutines File: nvram_subr.c + * + * High-level routines to read/write the NVRAM device. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_ioctl.h" + +#include "cfe_error.h" +#include "env_subr.h" +#include "nvram_subr.h" +#include "cfe.h" + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +static int nvram_handle = -1; +static nvram_info_t nvram_info; +static char *nvram_devname = NULL; + +/* ********************************************************************* + * nvram_getinfo(info) + * + * Obtain information about the NVRAM device from the device + * driver. A flash device might only dedicate a single sector + * to the environment, so we need to ask the driver first. + * + * Input parameters: + * info - nvram info + * + * Return value: + * 0 if ok + * <0 = error code + ********************************************************************* */ + +static int nvram_getinfo(nvram_info_t *info) +{ + int retlen; + + if (nvram_handle == -1) return -1; + + cfe_ioctl(nvram_handle,IOCTL_NVRAM_UNLOCK,NULL,0,NULL,0); + + if (cfe_ioctl(nvram_handle,IOCTL_NVRAM_GETINFO, + (unsigned char *) info, + sizeof(nvram_info_t), + &retlen,0) != 0) { + return -1; + } + + return 0; + +} + +/* ********************************************************************* + * nvram_open() + * + * Open the default NVRAM device and get the information from the + * device driver. + * + * Input parameters: + * nothing + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int nvram_open(void) +{ + if (nvram_handle != -1) { + nvram_close(); + } + + if (nvram_devname == NULL) { + return CFE_ERR_DEVNOTFOUND; + } + + nvram_handle = cfe_open(nvram_devname); + + if (nvram_handle < 0) { + return CFE_ERR_DEVNOTFOUND; + } + + if (nvram_getinfo(&nvram_info) < 0) { + nvram_close(); + return CFE_ERR_IOERR; + } + + return 0; +} + +/* ********************************************************************* + * nvram_close() + * + * Close the NVRAM device + * + * Input parameters: + * nothing + * + * Return value: + * 0 + ********************************************************************* */ + +int nvram_close(void) +{ + if (nvram_handle != -1) { + cfe_close(nvram_handle); + nvram_handle = -1; + } + + return 0; +} + + +/* ********************************************************************* + * nvram_getsize() + * + * Return the total size of the NVRAM device. Note that + * this is the total size that is used for the NVRAM functions, + * not the size of the underlying media. + * + * Input parameters: + * nothing + * + * Return value: + * size. <0 if error + ********************************************************************* */ + +int nvram_getsize(void) +{ + if (nvram_handle < 0) return 0; + return nvram_info.nvram_size; +} + + +/* ********************************************************************* + * nvram_read(buffer,offset,length) + * + * Read data from the NVRAM device + * + * Input parameters: + * buffer - destination buffer + * offset - offset of data to read + * length - number of bytes to read + * + * Return value: + * number of bytes read, or <0 if error occured + ********************************************************************* */ +int nvram_read(unsigned char *buffer,int offset,int length) +{ + if (nvram_handle == -1) return -1; + + return cfe_readblk(nvram_handle, + (cfe_offset_t) (offset+nvram_info.nvram_offset), + buffer, + length); +} + +/* ********************************************************************* + * nvram_write(buffer,offset,length) + * + * Write data to the NVRAM device + * + * Input parameters: + * buffer - source buffer + * offset - offset of data to write + * length - number of bytes to write + * + * Return value: + * number of bytes written, or -1 if error occured + ********************************************************************* */ +int nvram_write(unsigned char *buffer,int offset,int length) +{ + if (nvram_handle == -1) return -1; + + return cfe_writeblk(nvram_handle, + (cfe_offset_t) (offset+nvram_info.nvram_offset), + buffer, + length); +} + + +/* ********************************************************************* + * nvram_erase() + * + * Erase the NVRAM device. Not all devices need to be erased, + * but flash memory does. + * + * Input parameters: + * nothing + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int nvram_erase(void) +{ + int retlen; + + if (nvram_handle < 0) { + return -1; + } + + if (nvram_info.nvram_eraseflg == FALSE) return 0; + + if (cfe_ioctl(nvram_handle,IOCTL_NVRAM_ERASE, + (unsigned char *) &nvram_info, + sizeof(nvram_info_t), + &retlen,0) != 0) { + return -1; + } + + return 0; +} + + +/* ********************************************************************* + * cfe_set_envdevice(name) + * + * Set the environment NVRAM device name + * + * Input parameters: + * name - name of device to use for NVRAM + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int cfe_set_envdevice(char *name) +{ + int res; + + nvram_devname = strdup(name); + + res = nvram_open(); + + if (res != 0) { + xprintf("!! Could not open NVRAM device %s\n",nvram_devname); + return res; + } + + nvram_close(); + + res = env_load(); + + return res; +} diff --git a/cfe/cfe/main/nvram_subr.h b/cfe/cfe/main/nvram_subr.h new file mode 100644 index 0000000..f614ec2 --- /dev/null +++ b/cfe/cfe/main/nvram_subr.h @@ -0,0 +1,54 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * NVRAM prototypes File: nvram_subr.h + * + * Prototypes for NVRAM routines. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +int nvram_getsize(void); +int nvram_read(unsigned char *buffer,int,int); +int nvram_write(unsigned char *buffer,int,int); +int nvram_open(void); +int nvram_close(void); +int nvram_erase(void); + diff --git a/cfe/cfe/net/README b/cfe/cfe/net/README new file mode 100644 index 0000000..f4c1c8c --- /dev/null +++ b/cfe/cfe/net/README @@ -0,0 +1,17 @@ + +This directory contains the network modules for CFE. The +following standards are implemented here: + +* Ethernet datalink +* ARP +* IP +* UDP +* ICMP +* TFTP +* BOOTP/DHCP +* DNS (for queries only) +* TCP + +If anyone really screams for it, I've considered putting a simple +(very simple) TCP stack in here as well, but it doesn't seem worth it. + diff --git a/cfe/cfe/net/dev_tcpconsole.c b/cfe/cfe/net/dev_tcpconsole.c new file mode 100644 index 0000000..43b4f1c --- /dev/null +++ b/cfe/cfe/net/dev_tcpconsole.c @@ -0,0 +1,341 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * TCP Console Driver File: dev_tcpconsole.c + * + * Evil hack: A console driver that uses a TCP socket. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "addrspace.h" + +#include "cfe_timer.h" + +#include "bsp_config.h" + +#if CFG_TCP +#include "net_ebuf.h" +#include "net_api.h" + +/* + * Friendly warning: Don't put printfs in here or enable any + * debugging messages in the TCP stack if you're really + * going to use this for your console device. You'll end up + * with a recursion loop! + */ + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define TCPCONSOLE_DEFAULT_PORT 23 /* telnet */ + +/* ********************************************************************* + * Forward + ********************************************************************* */ + +static void tcpconsole_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +static int tcpconsole_open(cfe_devctx_t *ctx); +static int tcpconsole_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tcpconsole_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int tcpconsole_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tcpconsole_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int tcpconsole_close(cfe_devctx_t *ctx); + +const static cfe_devdisp_t tcpconsole_dispatch = { + tcpconsole_open, + tcpconsole_read, + tcpconsole_inpstat, + tcpconsole_write, + tcpconsole_ioctl, + tcpconsole_close, + NULL, + NULL +}; + +const cfe_driver_t tcpconsole = { + "TCP Console", + "tcpconsole", + CFE_DEV_SERIAL, + &tcpconsole_dispatch, + tcpconsole_probe +}; + + +/* ********************************************************************* + * tcpconsole structure + ********************************************************************* */ + +/* + * States our connection can be in + */ + +#define TCPCONSTAT_IDLE 0 +#define TCPCONSTAT_LISTEN 1 +#define TCPCONSTAT_CONNECTED 2 +#define TCPCONSTAT_DISCONNECTED 3 +#define TCPCONSTAT_BROKEN 4 + +/* + * state information + */ + +typedef struct tcpconsole_s { + int tcp_socket; + int tcp_status; + int tcp_port; +} tcpconsole_t; + + +static void tcpconsole_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + tcpconsole_t *softc; + char descr[80]; + + softc = (tcpconsole_t *) KMALLOC(sizeof(tcpconsole_t),0); + if (softc) { + softc->tcp_socket = -1; + softc->tcp_status = TCPCONSTAT_IDLE; + xsprintf(descr, "%s", drv->drv_description); + + if (probe_a == 0) probe_a = TCPCONSOLE_DEFAULT_PORT; + + softc->tcp_port = (int)probe_a; + + cfe_attach(drv, softc, NULL, descr); + } +} + + +static int tcpconsole_isready(tcpconsole_t *softc,int *rxbytes) +{ + int res; + int connstat,rxeof; + + res = tcp_status(softc->tcp_socket,&connstat,rxbytes,&rxeof); + + /* + * Return: + * -1 if we could not get status + * 0 if we are not connected or are connected and at EOF + * 1 if we are connected. + */ + + if (res < 0) return res; + if (connstat != TCPSTATUS_CONNECTED) return 0; + if (!rxeof) return 1; + + return 0; +} + + +static int tcpconsole_process(tcpconsole_t *softc) +{ + int res = 0; + + switch (softc->tcp_status) { + case TCPCONSTAT_IDLE: + /* Idle, set up listening socket */ + res = tcp_socket(); + if (res < 0) { + softc->tcp_status = TCPCONSTAT_BROKEN; + return res; + } + softc->tcp_socket = res; + + res = tcp_listen(softc->tcp_socket,softc->tcp_port); + + if (res < 0) { + tcp_close(softc->tcp_socket); + softc->tcp_status = TCPCONSTAT_BROKEN; + softc->tcp_socket = -1; + return res; + } + softc->tcp_status = TCPCONSTAT_LISTEN; + break; + + case TCPCONSTAT_LISTEN: + /* Still waiting for a connection */ + res = 0; + if (tcpconsole_isready(softc,NULL) > 0) { + softc->tcp_status = TCPCONSTAT_CONNECTED; + } + break; + + case TCPCONSTAT_CONNECTED: + res = 0; /* do nothing, we're okay */ + break; + + case TCPCONSTAT_DISCONNECTED: + /* Currently connected, kill off this connection */ + tcp_close(softc->tcp_socket); + softc->tcp_socket = -1; + softc->tcp_status = TCPCONSTAT_IDLE; + break; + + case TCPCONSTAT_BROKEN: + /* Broken. Stay broken. */ + res = 0; + break; + } + + return res; +} + + +static int tcpconsole_open(cfe_devctx_t *ctx) +{ + return 0; +} + +static int tcpconsole_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + tcpconsole_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + int res; + + POLL(); + tcpconsole_process(softc); + + buffer->buf_retlen = 0; + + if (softc->tcp_status == TCPCONSTAT_CONNECTED) { + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + if (tcpconsole_isready(softc,NULL) <= 0) { + softc->tcp_status = TCPCONSTAT_DISCONNECTED; + return 0; + } + + res = tcp_recv(softc->tcp_socket,bptr,blen); + + if (res > 0) { + buffer->buf_retlen = res; + } + } + + return 0; +} + +static int tcpconsole_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + tcpconsole_t *softc = ctx->dev_softc; + unsigned int rxbytes; + + POLL(); + tcpconsole_process(softc); + + inpstat->inp_status = 0; + + if (softc->tcp_status == TCPCONSTAT_CONNECTED) { + if (tcpconsole_isready(softc,&rxbytes) <= 0) { + softc->tcp_status = TCPCONSTAT_DISCONNECTED; + } + else { + inpstat->inp_status = (rxbytes > 0); + } + } + + return 0; +} + +static int tcpconsole_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + tcpconsole_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + int res; + + POLL(); + tcpconsole_process(softc); + + buffer->buf_retlen = 0; + + if (softc->tcp_status == TCPCONSTAT_CONNECTED) { + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + if (tcpconsole_isready(softc,NULL) <= 0) { + softc->tcp_status = TCPCONSTAT_DISCONNECTED; + return 0; + } + + res = tcp_send(softc->tcp_socket,bptr,blen); + + if (res > 0) { + buffer->buf_retlen = res; + } + } + + return 0; +} + +static int tcpconsole_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + return -1; +} + +static int tcpconsole_close(cfe_devctx_t *ctx) +{ + tcpconsole_t *softc = ctx->dev_softc; + + if (softc->tcp_status == TCPCONSTAT_CONNECTED) { + softc->tcp_status = TCPCONSTAT_DISCONNECTED; + } + + return 0; +} + + +#endif diff --git a/cfe/cfe/net/mii.h b/cfe/cfe/net/mii.h new file mode 100644 index 0000000..ac56958 --- /dev/null +++ b/cfe/cfe/net/mii.h @@ -0,0 +1,187 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * MII register definitions File: mii.h + * + * Register and bit definitions for the standard MII management + * interface. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _MII_H_ +#define _MII_H_ + +/* Access/command codes */ + +#define MII_COMMAND_START 0x01 +#define MII_COMMAND_READ 0x02 +#define MII_COMMAND_WRITE 0x01 +#define MII_COMMAND_ACK 0x02 + + +/* Registers */ + +#define MII_BMCR 0x00 /* Basic Mode Control (rw) */ +#define MII_BMSR 0x01 /* Basic Mode Status (ro) */ +#define MII_PHYIDR1 0x02 +#define MII_PHYIDR2 0x03 +#define MII_ANAR 0x04 /* Autonegotiation Advertisement */ +#define MII_ANLPAR 0x05 /* Autonegotiation Link Partner Ability (rw) */ +#define MII_ANER 0x06 /* Autonegotiation Expansion */ +#define MII_K1CTL 0x09 /* 1000baseT control */ +#define MII_K1STSR 0x0A /* 1K Status Register (ro) */ +#define MII_AUXCTL 0x18 /* aux control register */ + + +/* Basic Mode Control register (RW) */ + +#define BMCR_RESET 0x8000 +#define BMCR_LOOPBACK 0x4000 +#define BMCR_SPEED0 0x2000 +#define BMCR_ANENABLE 0x1000 +#define BMCR_POWERDOWN 0x0800 +#define BMCR_ISOLATE 0x0400 +#define BMCR_RESTARTAN 0x0200 +#define BMCR_DUPLEX 0x0100 +#define BMCR_COLTEST 0x0080 +#define BMCR_SPEED1 0x0040 +#define BMCR_SPEED1000 (BMCR_SPEED1) +#define BMCR_SPEED100 (BMCR_SPEED0) +#define BMCR_SPEED10 0 + + +/* Basic Mode Status register (RO) */ + +#define BMSR_100BT4 0x8000 +#define BMSR_100BT_FDX 0x4000 +#define BMSR_100BT_HDX 0x2000 +#define BMSR_10BT_FDX 0x1000 +#define BMSR_10BT_HDX 0x0800 +#define BMSR_100BT2_FDX 0x0400 +#define BMSR_100BT2_HDX 0x0200 +#define BMSR_1000BT_XSR 0x0100 +#define BMSR_PRESUP 0x0040 +#define BMSR_ANCOMPLETE 0x0020 +#define BMSR_REMFAULT 0x0010 +#define BMSR_AUTONEG 0x0008 +#define BMSR_LINKSTAT 0x0004 +#define BMSR_JABDETECT 0x0002 +#define BMSR_EXTCAPAB 0x0001 + + +/* PHY Identifer registers (RO) */ + +#define PHYIDR1 0x2000 +#define PHYIDR2 0x5C60 + + +/* Autonegotiation Advertisement register (RW) */ + +#define ANAR_NP 0x8000 +#define ANAR_RF 0x2000 +#define ANAR_ASYPAUSE 0x0800 +#define ANAR_PAUSE 0x0400 +#define ANAR_T4 0x0200 +#define ANAR_TXFD 0x0100 +#define ANAR_TXHD 0x0080 +#define ANAR_10FD 0x0040 +#define ANAR_10HD 0x0020 +#define ANAR_PSB 0x001F + +#define PSB_802_3 0x0001 /* 802.3 */ + +/* Autonegotiation Link Partner Abilities register (RW) */ + +#define ANLPAR_NP 0x8000 +#define ANLPAR_ACK 0x4000 +#define ANLPAR_RF 0x2000 +#define ANLPAR_ASYPAUSE 0x0800 +#define ANLPAR_PAUSE 0x0400 +#define ANLPAR_T4 0x0200 +#define ANLPAR_TXFD 0x0100 +#define ANLPAR_TXHD 0x0080 +#define ANLPAR_10FD 0x0040 +#define ANLPAR_10HD 0x0020 +#define ANLPAR_PSB 0x001F + + +/* Autonegotiation Expansion register (RO) */ + +#define ANER_PDF 0x0010 +#define ANER_LPNPABLE 0x0008 +#define ANER_NPABLE 0x0004 +#define ANER_PAGERX 0x0002 +#define ANER_LPANABLE 0x0001 + + +#define ANNPTR_NP 0x8000 +#define ANNPTR_MP 0x2000 +#define ANNPTR_ACK2 0x1000 +#define ANNPTR_TOGTX 0x0800 +#define ANNPTR_CODE 0x0008 + +#define ANNPRR_NP 0x8000 +#define ANNPRR_MP 0x2000 +#define ANNPRR_ACK3 0x1000 +#define ANNPRR_TOGTX 0x0800 +#define ANNPRR_CODE 0x0008 + + +#define K1TCR_TESTMODE 0x0000 +#define K1TCR_MSMCE 0x1000 +#define K1TCR_MSCV 0x0800 +#define K1TCR_RPTR 0x0400 +#define K1TCR_1000BT_FDX 0x200 +#define K1TCR_1000BT_HDX 0x100 + +#define K1STSR_MSMCFLT 0x8000 +#define K1STSR_MSCFGRES 0x4000 +#define K1STSR_LRSTAT 0x2000 +#define K1STSR_RRSTAT 0x1000 +#define K1STSR_LP1KFD 0x0800 +#define K1STSR_LP1KHD 0x0400 +#define K1STSR_LPASMDIR 0x0200 + +#define K1SCR_1KX_FDX 0x8000 +#define K1SCR_1KX_HDX 0x4000 +#define K1SCR_1KT_FDX 0x2000 +#define K1SCR_1KT_HDX 0x1000 + +#endif /* _MII_H_ */ diff --git a/cfe/cfe/net/net_api.c b/cfe/cfe/net/net_api.c new file mode 100755 index 0000000..c9f119e --- /dev/null +++ b/cfe/cfe/net/net_api.c @@ -0,0 +1,1095 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Top-level API to network File: net_api.c + * + * This routine contains the highest-level API to the network + * routines. The global handle to the network state is right here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "bsp_config.h" + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" + +#include "cfe_error.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "cfe_timer.h" + +#include "net_ip.h" +#include "net_ip_internal.h" +#include "net_api.h" + +#include "env_subr.h" + +#if CFG_TCP +#include "net_tcp.h" +#endif + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +/* + * Net context. All the soft context structures of all the + * layers of the network stack are bundled here. There's only one + * of these in the system when the network is active. + */ + +typedef struct net_ctx_s { + /* Global info */ + int64_t timer; + + /* device name */ + char *devname; + + /* Run-time info for IP interface */ + ip_info_t *ipinfo; + + /* Info for Ethernet interface */ + ether_info_t *ethinfo; + + /* Info specific to UDP */ + udp_info_t *udpinfo; + + /* Info specific to ICMP */ + icmp_info_t *icmpinfo; + +#if CFG_TCP + /* Info specific to TCP */ + tcp_info_t *tcpinfo; +#endif +} net_ctx_t; + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +net_ctx_t *netctx = NULL; +// static net_ctx_t *netctx = NULL; +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +/* ********************************************************************* + * UDP INTERFACE + ********************************************************************* */ + +/* ********************************************************************* + * udp_alloc() + * + * Allocate an ebuf with fields reserved for the UDP layer. + * + * Input parameters: + * nothing + * + * Return value: + * pointer to ebuf, or NULL if no EBUFs are available + ********************************************************************* */ + +ebuf_t *udp_alloc(void) +{ + if (!netctx) return NULL; + return _udp_alloc(netctx->udpinfo); +} + +/* ********************************************************************* + * udp_free(buf) + * + * Return an ebuf to the pool. The ebuf was presumably allocated + * via udp_alloc() first. + * + * Input parameters: + * buf - ebuf to return to the pool + * + * Return value: + * nothing + ********************************************************************* */ +void udp_free(ebuf_t *buf) +{ + if (!netctx) return; + _udp_free(netctx->udpinfo,buf); +} + +/* ********************************************************************* + * udp_socket(port) + * + * Open a UDP socket. Once open, datagrams sent on the socket will + * go to the specified port number. You can change the port later + * using the "udp_connect" function. + * + * Input parameters: + * port - port number + * + * Return value: + * UDP port handle, or -1 if no ports are available. + ********************************************************************* */ + +int udp_socket(uint16_t port) +{ + if (!netctx) return -1; + + return _udp_socket(netctx->udpinfo,port); +} + +/* ********************************************************************* + * udp_close(sock) + * + * Close a udp socket. You pass this handle returned from a previous + * call to udp_open. + * + * Input parameters: + * handle - UDP port handle, from udp_open() + * + * Return value: + * nothing + ********************************************************************* */ + +void udp_close(int portnum) +{ + if (!netctx) return; + + _udp_close(netctx->udpinfo,portnum); +} + + +/* ********************************************************************* + * udp_send(s,buf,dest) + * + * Send a datagram to the specified destination address. The + * source and destination UDP port numbers are taken from the + * values passed to earlier calls to udp_open, udp_bind, and + * udp_connect. + * + * Input parameters: + * s - socket handle, from udp_open + * buf - ebuf to send (allocated via udp_alloc) + * dest - pointer to 4-byte destination IP address + * + * Return value: + * 0 if ok + * <0 if an error occured. + ********************************************************************* */ + +int udp_send(int s,ebuf_t *buf,uint8_t *dest) +{ + if (!netctx) return -1; + + return _udp_send(netctx->udpinfo,s,buf,dest); +} + +/* ********************************************************************* + * udp_bind(s,port) + * + * Re-"bind" the specified udp socket to a new source port. + * This changes the source port number that will be transmitted + * in subsequent calls to udp_send() + * + * Input parameters: + * s - socket handle + * port - new port number + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int udp_bind(int s,uint16_t port) +{ + if (!netctx) return -1; + + return _udp_bind(netctx->udpinfo,s,port); +} + + +/* ********************************************************************* + * udp_connect(s,port) + * + * Set the port number to be used in the destination port field + * for subsequent calls to udp_send(). + * + * Input parameters: + * s - udp socket handle + * port - new destination port number + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int udp_connect(int s,uint16_t port) +{ + if (!netctx) return -1; + + return _udp_connect(netctx->udpinfo,s,port); +} + +/* ********************************************************************* + * udp_recv(s) + * + * Return the next packet from the receive queue for this port. + * If no packets are available, NULL is returned. + * + * Input parameters: + * s - udp port handle + * + * Return value: + * ebuf (if a packet is available) + * NULL (no packet available) + ********************************************************************* */ + +ebuf_t *udp_recv(int s) +{ + if (!netctx) return NULL; + + return _udp_recv(netctx->udpinfo,s); +} + + +/* ********************************************************************* + * udp_recv_with_timeout(s,seconds) + * + * Return the next packet from the receive queue for this socket, + * waiting for one to arrive if there are none available. + * + * Input parameters: + * s - udp socket handle + * seconds - number of seconds to wait + * + * Return value: + * ebuf (if a packet is available) + * NULL (no packet available after timeout) + ********************************************************************* */ + +ebuf_t *udp_recv_with_timeout(int s,int seconds) +{ + ebuf_t *buf = NULL; + int64_t timer; + + if (!netctx) return NULL; + + TIMER_SET(timer,seconds*CFE_HZ); + + while (!TIMER_EXPIRED(timer)) { + POLL(); + buf = _udp_recv(netctx->udpinfo,s); + if (buf) break; + } + + return buf; +} + + + +#if CFG_TCP +/* ********************************************************************* + * TCP INTERFACE + ********************************************************************* */ + + +/* ********************************************************************* + * tcp_socket() + * + * Create a new TCP port. + * + * Input parameters: + * nothing. + * + * Return value: + * TCP port handle, or <0 if no ports are available. + ********************************************************************* */ + +int tcp_socket(void) +{ + if (!netctx) return -1; + + return _tcp_socket(netctx->tcpinfo); +} + +/* ********************************************************************* + * tcp_connect(handle,dest,port) + * + * Connect to a remote TCP destination. + * + * Input parameters: + * handle - returned from tcp_create + * dest - destination IP address + * port - destination port number + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int tcp_connect(int s,uint8_t *dest,uint16_t port) +{ + int res; + unsigned int flags; + unsigned int connflag; + + if (!netctx) return -1; + + /* + * Get socket's blocking status + * If nonblocking, just call the tcp stack + * and return what it returns. + */ + + res = _tcp_getflags(netctx->tcpinfo,s,&flags); + if (res < 0) return res; + + if (flags & TCPFLG_NBIO) { + return _tcp_connect(netctx->tcpinfo,s,dest,port); + } + + /* + * Otherwise, call connect and poll till the status + * changes. We want to see a transition to the + * CONNECTED state, so we loop while we see "CONNECTING" + * and return a status based on what it changes to. + */ + + res = _tcp_connect(netctx->tcpinfo,s,dest,port); + if (res < 0) return res; + connflag = TCPSTATUS_NOTCONN; + + for (;;) { + POLL(); + + res = _tcp_status(netctx->tcpinfo,s,&connflag,NULL,NULL); + if (res < 0) break; + + if (connflag == TCPSTATUS_CONNECTING) continue; + break; + } + + if (connflag != TCPSTATUS_CONNECTED) return CFE_ERR_NOTCONN; + + return res; +} + +/* ********************************************************************* + * tcp_close(s) + * + * Disconnect a connection (cleanly) + * + * Input parameters: + * s - handle from tcp_create + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +int tcp_close(int s) +{ + if (!netctx) return -1; + + return _tcp_close(netctx->tcpinfo,s); +} + + + +/* ********************************************************************* + * tcp_send(s,buf,len) + * + * Send a buffer to the other TCP, buffering as much data as + * will fit in the send buffer. + * + * Input parameters: + * s - port handle, from tcp_open + * buf - buffer pointer + * len - length of buffer to send + * + * Return value: + * >=0 if ok (number of bytes sent) + * <0 if an error occured. + ********************************************************************* */ + +int tcp_send(int s,uint8_t *buf,int len) +{ + unsigned int flags; + int res; + int total = 0; + + if (!netctx) return -1; + + /* + * Get socket's blocking status + * If nonblocking, just call the tcp stack + * and return what it returns. + */ + + res = _tcp_getflags(netctx->tcpinfo,s,&flags); + if (res < 0) return res; + + if (flags & TCPFLG_NBIO) { + return _tcp_send(netctx->tcpinfo,s,buf,len); + } + + /* + * The first time we'll check the return code for an + * error so we can pass up the failure. + */ + + res = _tcp_send(netctx->tcpinfo,s,buf,len); + if (res < 0) return res; + + buf += res; + len -= res; + total += res; + + while (len > 0) { + /* + * Give the TCP stack and devices a chance to run + */ + + POLL(); + + /* + * Try to send some more. If we get an error, get out. + * otherwise, keep going till all the data is gone. + */ + + res = _tcp_send(netctx->tcpinfo,s,buf,len); + if (res < 0) break; + buf += res; + len -= res; + total += res; + } + + /* + * If we sent nothing and have an error, return the error. + * Otherwise return the amount of data we sent. + */ + if ((total == 0) && (res < 0)) return res; + else return total; +} + +/* ********************************************************************* + * tcp_recv(s,buf,len) + * + * Receive data from the remote TCP session + * + * Input parameters: + * s - port handle, from tcp_open + * buf - buffer pointer + * len - length of buffer to send + * + * Return value: + * >=0 if ok (number of bytes received) + * <0 if an error occured. + ********************************************************************* */ + +int tcp_recv(int s,uint8_t *buf,int len) +{ + unsigned int flags; + int res; + int total = 0; + + if (!netctx) return -1; + + /* + * Get socket's blocking status + * If nonblocking, just call the tcp stack + * and return what it returns. + */ + + res = _tcp_getflags(netctx->tcpinfo,s,&flags); + if (res < 0) return res; + + if (flags & TCPFLG_NBIO) { + return _tcp_recv(netctx->tcpinfo,s,buf,len); + } + + /* + * The first time we'll check the return code for an + * error so we can pass up the failure. + */ + + res = _tcp_recv(netctx->tcpinfo,s,buf,len); + if (res < 0) return res; + + buf += res; + len -= res; + total += res; + + while (len > 0) { + /* + * Give the TCP stack and devices a chance to run + */ + + POLL(); + + /* + * Try to receive some more. If we get an error, get out. + * otherwise, keep going till all the data is gone. + */ + + res = _tcp_recv(netctx->tcpinfo,s,buf,len); + if (res < 0) break; + + if (res == 0) { + _tcp_status(netctx->tcpinfo,s,&flags,NULL,NULL); + if (flags != TCPSTATUS_CONNECTED) { + res = CFE_ERR_NOTCONN; + break; + } + } + + buf += res; + len -= res; + total += res; + } + + /* + * If we sent received and have an error, return the error. + * Otherwise return the amount of data we sent. + */ + if ((total == 0) && (res < 0)) return res; + else return total; + +} + +/* ********************************************************************* + * tcp_bind(s,port) + * + * Re-"bind" the specified tcp port handle to a new source port. + * + * Used for listening sockets. + * + * Input parameters: + * s - port handle + * port - new port number + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int tcp_bind(int s,uint16_t port) +{ + if (!netctx) return -1; + + return _tcp_bind(netctx->tcpinfo,s,port); +} + +/* ********************************************************************* + * tcp_peeraddr(s,addr,port) + * + * Return the address of the remote peer. + * + * Input parameters: + * s - port handle + * addr - points to 4-byte buffer to receive IP address + * port - points to uint16 to receive port number + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int tcp_peeraddr(int s,uint8_t *addr,uint16_t *port) +{ + if (!netctx) return -1; + + return _tcp_peeraddr(netctx->tcpinfo,s,addr,port); +} + +/* ********************************************************************* + * tcp_setflags(s,addr,flags) + * + * Set per-socket flags (nodelay, etc.) + * + * Input parameters: + * s - port handle + * flags - flags for this socket + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int tcp_setflags(int s,unsigned int flags) +{ + if (!netctx) return -1; + + return _tcp_setflags(netctx->tcpinfo,s,flags); +} + +/* ********************************************************************* + * tcp_getflags(s,addr,flags) + * + * Get per-socket flags (nodelay, etc.) + * + * Input parameters: + * s - port handle + * flags - flags for this socket + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int tcp_getflags(int s,unsigned int *flags) +{ + if (!netctx) return -1; + + return _tcp_getflags(netctx->tcpinfo,s,flags); +} + + +/* ********************************************************************* + * tcp_listen(s) + * + * Set the socket into "listen" mode. + * + * Input parameters: + * s - port handle + * port - port # to listen on + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +int tcp_listen(int s,uint16_t port) +{ + if (!netctx) return -1; + + return _tcp_listen(netctx->tcpinfo,s,port); +} + +/* ********************************************************************* + * tcp_status(s,connflag,rxready,rxeof) + * + * Return the TCP connection's status + * + * Input parameters: + * s - port handle + * connflag - points to flag to receive connected status + * rxready - returns # of bytes ready to receive + * rxeof - returns TRUE if we've been FINed. + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +int tcp_status(int s,unsigned int *connflag,int *rxready,int *rxeof) +{ + if (!netctx) return -1; + + return _tcp_status(netctx->tcpinfo,s,connflag,rxready,rxeof); +} + +/* ********************************************************************* + * tcp_debug(s,arg) + * + * Call the debug routine in the tcp stack. + * + * Input parameters: + * s - socket handle + * arg - passed to debug routine + * + * Return value: + * return value from debug routine + ********************************************************************* */ + +int tcp_debug(int s,int arg) +{ + if (!netctx) return -1; + return _tcp_debug(netctx->tcpinfo,s,arg); +} + +#endif + +/* ********************************************************************* + * ARP FUNCTIONS + ********************************************************************* */ + + +/* ********************************************************************* + * arp_add(destip,desthw) + * + * Add a permanent entry to the ARP table. This entry will + * persist until deleted or the interface is deactivated. + * This may cause a stale entry to be deleted if the table is full + * + * Input parameters: + * destip - pointer to 4-byte destination IP address + * desthw - pointer to 6-byte destination hardware address + * + * Return value: + * nothing + ********************************************************************* */ + +void arp_add(uint8_t *destip,uint8_t *desthw) +{ + if (netctx) _arp_add(netctx->ipinfo,destip,desthw); +} + +/* ********************************************************************* + * arp_lookup(destip) + * + * Look up the hardware address for an IP address. + * + * Input parameters: + * destip - pointer to 4-byte IP address + * + * Return value: + * pointer to 6-byte hardware address, or NULL if there are + * no matching entries in the table. + ********************************************************************* */ + +uint8_t *arp_lookup(uint8_t *destip) +{ + if (!netctx) return NULL; + return _arp_lookup(netctx->ipinfo,destip); +} + + +/* ********************************************************************* + * arp_enumerate(entrynum,ipaddr,hwaddr) + * + * Return an entry from the ARP table. + * + * Input parameters: + * entrynum - entry number to return, starting with zero + * ipaddr - pointer to 4 bytes to receive IP address + * hwaddr - pointer to 6 bytes to receive hardware address + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int arp_enumerate(int entrynum,uint8_t *ipaddr,uint8_t *hwaddr) +{ + if (!netctx) return -1; + return _arp_enumerate(netctx->ipinfo,entrynum,ipaddr,hwaddr); +} + +/* ********************************************************************* + * arp_delete(ipaddr) + * + * Delete an entry from the ARP table. + * + * Input parameters: + * ipaddr - pointer to 4-byte IP address + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int arp_delete(uint8_t *ipaddr) +{ + if (!netctx) return -1; + return _arp_delete(netctx->ipinfo,ipaddr); +} + +/* ********************************************************************* + * ICMP FUNCTIONS + ********************************************************************* */ + +/* ********************************************************************* + * icmp_ping(dest,seq,len) + * + * Ping a remote host, transmitting the ICMP_ECHO message and + * waiting for the corresponding ICMP_ECHO_REPLY. + * + * Input parameters: + * dest - pointer to 4-byte destination IP address + * seq - sequence number to put in to the ICMP packet + * len - length of data to place in ICMP packet + * + * Return value: + * 0 if ok (remote host responded) + * else error code + ********************************************************************* */ + +int icmp_ping(uint8_t *dest,int seq,int len) +{ + if (!netctx) return -1; + return _icmp_ping(netctx->icmpinfo,dest,seq,len); +} + +/* ********************************************************************* + * INIT/CONFIG FUNCTIONS + ********************************************************************* */ + +/* ********************************************************************* + * net_getparam(param) + * + * Return a parameter from the current IP configuration. This is + * the main call to set the IP address, netmask, gateway, + * name server, host name, etc. + * + * Input parameters: + * param - parameter number (see net_api.h) + * + * Return value: + * pointer to value of parameter, or NULL if parameter + * ID is invalid + ********************************************************************* */ + +uint8_t *net_getparam(int param) +{ + if (!netctx) return NULL; + if (param == NET_DEVNAME) return (uint8_t *) netctx->devname; + return _ip_getparam(netctx->ipinfo,param); + +} + +/* ********************************************************************* + * net_setparam(param,ptr) + * + * Set the value of an IP configuration parameter + * + * Input parameters: + * param - parameter number (see net_api.h) + * ptr - pointer to parameter's new value + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int net_setparam(int param,uint8_t *ptr) +{ + if (!netctx) return NULL; + return _ip_setparam(netctx->ipinfo,param,ptr); +} + +/* ********************************************************************* + * net_poll() + * + * Process background tasks for the network stack, maintaining + * the ARP table, receive queues, etc. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +static void net_poll(void *arg) +{ + if (netctx) { + eth_poll(netctx->ethinfo); + if (TIMER_EXPIRED(netctx->timer)) { + _ip_timer_tick(netctx->ipinfo); + TIMER_SET(netctx->timer,CFE_HZ); + } + } +} + +/* ********************************************************************* + * net_init(devname) + * + * Initialize the network interface. This is the main call, once + * completed you should call net_setparam to set up the network + * addresses and stuff. + * + * Input parameters: + * devname - CFE device name for network device + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int net_init(char *devname) +{ + net_ctx_t *ctx; + + if (netctx) net_uninit(); + + ctx = KMALLOC(sizeof(net_ctx_t),0); + + if (!ctx) return -1; + + ctx->devname = strdup(devname); + + ctx->ethinfo = eth_init(devname); + if (ctx->ethinfo == NULL) { + return -1; + } + + ctx->ipinfo = _ip_init(ctx->ethinfo); + if (ctx->ipinfo == NULL) { + eth_uninit(ctx->ethinfo); + return -1; + } + + ctx->udpinfo = _udp_init(ctx->ipinfo,ctx->ipinfo); + if (ctx->udpinfo == NULL) { + _ip_uninit(ctx->ipinfo); + eth_uninit(ctx->ethinfo); + return -1; + } + + ctx->icmpinfo = _icmp_init(ctx->ipinfo); + if (ctx->icmpinfo == NULL) { + _udp_uninit(ctx->udpinfo); + _ip_uninit(ctx->ipinfo); + eth_uninit(ctx->ethinfo); + return -1; + } + + cfe_bg_add(net_poll,ctx); + TIMER_SET(ctx->timer,CFE_HZ); + +#if CFG_TCP + ctx->tcpinfo = _tcp_init(ctx->ipinfo,ctx->ipinfo); + cfe_bg_add(_tcp_poll,ctx->tcpinfo); +#endif + + netctx = ctx; + + return 0; +} + + +/* ********************************************************************* + * net_uninit() + * + * Uninitialize the network, deallocating all resources allocated + * to the network and closing all open device handles + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void net_uninit(void) +{ + if (netctx) { +#if CFG_TCP + cfe_bg_remove(_tcp_poll); + _tcp_uninit(netctx->tcpinfo); +#endif + TIMER_CLEAR(netctx->timer); + _icmp_uninit(netctx->icmpinfo); + _udp_uninit(netctx->udpinfo); + _ip_uninit(netctx->ipinfo); + eth_uninit(netctx->ethinfo); + KFREE(netctx->devname); + KFREE(netctx); + netctx = NULL; + cfe_bg_remove(net_poll); + } +} + + +/* ********************************************************************* + * net_setnetvars() + * + * Set environment variables related to the network. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void net_setnetvars(void) +{ + char *x; + uint8_t *addr; + char str[60]; + + /* Clear out all the environment variables */ + env_delenv("NET_DEVICE"); + env_delenv("NET_IPADDR"); + env_delenv("NET_NETMASK"); + env_delenv("NET_GATEWAY"); + env_delenv("NET_NAMESERVER"); + env_delenv("NET_DOMAIN"); + + x = (char *) net_getparam(NET_DEVNAME); + if (!x) { + return; + } + + x = (char *) net_getparam(NET_DEVNAME); + if (x) env_setenv("NET_DEVICE",x,ENV_FLG_BUILTIN); + + x = (char *) net_getparam(NET_DOMAIN); + if (x) env_setenv("NET_DOMAIN",x,ENV_FLG_BUILTIN); + + addr = net_getparam(NET_IPADDR); + if (addr) { + xsprintf(str,"%I",addr); + env_setenv("NET_IPADDR",str,ENV_FLG_BUILTIN); + } + + addr = net_getparam(NET_NETMASK); + if (addr) { + xsprintf(str,"%I",addr); + env_setenv("NET_NETMASK",str,ENV_FLG_BUILTIN); + } + + addr = net_getparam(NET_GATEWAY); + if (addr) { + xsprintf(str,"%I",addr); + env_setenv("NET_GATEWAY",str,ENV_FLG_BUILTIN); + } + + addr = net_getparam(NET_NAMESERVER); + if (addr) { + xsprintf(str,"%I",addr); + env_setenv("NET_NAMESERVER",str,ENV_FLG_BUILTIN); + } + +} + diff --git a/cfe/cfe/net/net_api.h b/cfe/cfe/net/net_api.h new file mode 100755 index 0000000..f28b917 --- /dev/null +++ b/cfe/cfe/net/net_api.h @@ -0,0 +1,179 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * High-level network API defs File: net_api.h + * + * This module contains prototypes and constants for the + * network (TCP/IP) interface. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#ifndef IP_ADDR_LEN +#define IP_ADDR_LEN 4 +#endif + +/* ********************************************************************* + * DHCP Protocol + ********************************************************************* */ + +typedef struct dhcpreply_s { + uint8_t dr_ipaddr[IP_ADDR_LEN]; + uint8_t dr_netmask[IP_ADDR_LEN]; + uint8_t dr_gateway[IP_ADDR_LEN]; + uint8_t dr_nameserver[IP_ADDR_LEN]; + uint8_t dr_dhcpserver[IP_ADDR_LEN]; + uint8_t dr_bootserver[IP_ADDR_LEN]; + char *dr_hostname; + char *dr_domainname; + char *dr_bootfile; + char *dr_rootpath; + char *dr_swapserver; + char *dr_script; + char *dr_options; +} dhcpreply_t; + + +int dhcp_bootrequest(dhcpreply_t **reply); +void dhcp_free_reply(dhcpreply_t *reply); +void dhcp_set_envvars(dhcpreply_t *reply); + +/* ********************************************************************* + * IP Layer + ********************************************************************* */ + +void ip_uninit(void); +int ip_init(char *,uint8_t *); +ebuf_t *ip_alloc(void); +void ip_free(ebuf_t *buf); +int ip_send(ebuf_t *buf,uint8_t *destaddr,uint8_t proto); +uint16_t ip_chksum(uint16_t initchksum,uint8_t *ptr,int len); + +/* ********************************************************************* + * UDP Layer + ********************************************************************* */ + +ebuf_t *udp_alloc(void); +void udp_free(ebuf_t *buf); + +int udp_socket(uint16_t port); +int udp_bind(int portnum,uint16_t port); +int udp_connect(int portnum,uint16_t port); +void udp_close(int portnum); +int udp_send(int portnum,ebuf_t *buf,uint8_t *dest); +ebuf_t *udp_recv_with_timeout(int portnum,int seconds); +ebuf_t *udp_recv(int portnum); + +/* ********************************************************************* + * TCP Layer + ********************************************************************* */ + +#if CFG_TCP +#ifndef TCPFLG_NODELAY /* XXX should be kept in sync with net_tcp.h */ +#define TCPFLG_NODELAY 1 /* disable nagle */ +#define TCPFLG_NBIO 2 /* non-blocking I/O */ + +#define TCPSTATUS_NOTCONN 0 +#define TCPSTATUS_CONNECTING 1 +#define TCPSTATUS_CONNECTED 2 +#endif +int tcp_socket(void); +void tcp_destroy(int portnum); +int tcp_connect(int s,uint8_t *dest,uint16_t port); +int tcp_close(int s); +int tcp_send(int s,uint8_t *buf,int len); +int tcp_recv(int s,uint8_t *buf,int len); +int tcp_bind(int s,uint16_t port); +int tcp_peeraddr(int s,uint8_t *addr,uint16_t *port); +int tcp_listen(int s,uint16_t port); +int tcp_status(int s,unsigned int *connflag,int *rxready,int *rxeof); +int tcp_debug(int s,int arg); +int tcp_setflags(int s,unsigned int flags); +int tcp_getflags(int s,unsigned int *flags); +#endif + +/* ********************************************************************* + * ARP Layer + ********************************************************************* */ + +uint8_t *arp_lookup(uint8_t *destip); +void arp_add(uint8_t *destip,uint8_t *desthw); +int arp_enumerate(int entrynum,uint8_t *ipaddr,uint8_t *hwaddr); +int arp_delete(uint8_t *ipaddr); + +/* ********************************************************************* + * Network Configuration + ********************************************************************* */ + +#ifndef NET_IPADDR +#define NET_IPADDR 0 +#define NET_NETMASK 1 +#define NET_GATEWAY 2 +#define NET_NAMESERVER 3 +#define NET_HWADDR 4 +#define NET_DOMAIN 5 +#define NET_HOSTNAME 6 +#define NET_SPEED 7 +#define NET_LOOPBACK 8 +#endif +#define NET_DEVNAME 10 + +uint8_t *net_getparam(int param); +int net_setparam(int param,uint8_t *ptr); +int net_init(char *devname); +void net_uninit(void); +void net_setnetvars(void); + +/* ********************************************************************* + * DNS + ********************************************************************* */ + +int dns_lookup(char *hostname,uint8_t *ipaddr); + +/* ********************************************************************* + * ICMP + ********************************************************************* */ + +int icmp_ping(uint8_t *dest,int seq,int len); + diff --git a/cfe/cfe/net/net_arp.c b/cfe/cfe/net/net_arp.c new file mode 100755 index 0000000..1c12457 --- /dev/null +++ b/cfe/cfe/net/net_arp.c @@ -0,0 +1,865 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Address Resolution Protocol File: net_arp.c + * + * This module implements RFC826, the Address Resolution Protocol. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_ip.h" +#include "net_ip_internal.h" + + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +static int arp_tx_query(ip_info_t *ipi,uint8_t *destaddr); +static void arp_delete(arpentry_t *ae); +static void arp_tx_waiting(arpentry_t *ae); +static arpentry_t *arp_new_entry(ip_info_t *ipi); +static arpentry_t *arp_find_entry(ip_info_t *ipi,uint8_t *ipaddr); +static int arp_rx_query(ip_info_t *ipi,uint8_t *srcaddr, + uint8_t *targethw,uint8_t *targetip); +static int arp_rx_response(ip_info_t *ipi,uint8_t *senderhw, + uint8_t *senderip); +static int arp_rx_callback(ebuf_t *buf,void *ref); + + +/* ********************************************************************* + * arp_tx_query(ipi,destaddr) + * + * Transmit an ARP QUERY message. ARP QUERY messages are sent + * to the Ethernet broadcast address. + * + * Input parameters: + * ipi - IP information + * destaddr - IP address to query + * + * Return value: + * 0 - success + * <0 - failure + ********************************************************************* */ + +static int arp_tx_query(ip_info_t *ipi,uint8_t *destaddr) +{ + ebuf_t *buf; + uint8_t hwaddr[ENET_ADDR_LEN]; + + /* + * Get a buffer. + */ + + buf = eth_alloc(ipi->eth_info,ipi->arp_port); + if (!buf) return -1; + + /* + * fill in the fields + */ + + ebuf_append_u16_be(buf,ARP_HWADDRSPACE_ETHERNET); + ebuf_append_u16_be(buf,PROTOSPACE_IP); + ebuf_append_u8(buf,ENET_ADDR_LEN); + ebuf_append_u8(buf,IP_ADDR_LEN); + ebuf_append_u16_be(buf,ARP_OPCODE_REQUEST); + ebuf_append_bytes(buf,ipi->arp_hwaddr,ENET_ADDR_LEN); + ebuf_append_bytes(buf,ipi->net_info.ip_addr,IP_ADDR_LEN); + memset(hwaddr,0,ENET_ADDR_LEN); + ebuf_append_bytes(buf,hwaddr,ENET_ADDR_LEN); + ebuf_append_bytes(buf,destaddr,IP_ADDR_LEN); + + /* + * Transmit the packet + */ + + eth_send(buf,(uint8_t *)eth_broadcast); + eth_free(buf); + + return 0; +} + + +/* ********************************************************************* + * arp_delete(ae) + * + * Delete an ARP entry. The usual reason for calling this routine + * is to reclaim unused ARP entries, but an ARP entry may be + * manually deleted as well. + * + * Input parameters: + * ae - arp entry + * + * Return value: + * nothing + ********************************************************************* */ + +static void arp_delete(arpentry_t *ae) +{ + ebuf_t *buf; + + /* + * Free any buffers associated with the ARP entry. + */ + + while ((buf = (ebuf_t *) q_deqnext(&(ae->ae_txqueue)))) { + eth_free(buf); + } + + /* + * Reset the important fields + */ + + ae->ae_timer = 0; + ae->ae_usage = 0; + ae->ae_retries = 0; + ae->ae_state = ae_unused; +} + + +/* ********************************************************************* + * _arp_add(ipi,destip,desthw) + * + * Add a new ARP entry to the ARP table [internal routine]. If + * there is no room in the table, some other entry is kicked + * out. + * + * Input parameters: + * ipi - IP information + * destip - target IP address + * desthw - target hardware address + * + * Return value: + * nothing + ********************************************************************* */ + +void _arp_add(ip_info_t *ipi,uint8_t *destip,uint8_t *desthw) +{ + arpentry_t *ae; + + ae = arp_find_entry(ipi,desthw); + if (!ae) { + ae = arp_new_entry(ipi); + } + + memcpy(ae->ae_ipaddr,destip,IP_ADDR_LEN); + memcpy(ae->ae_ethaddr,desthw,ENET_ADDR_LEN); + + ae->ae_retries = 0; + ae->ae_timer = 0; /* keep forever */ + ae->ae_permanent = TRUE; + ae->ae_state = ae_established; + + arp_tx_waiting(ae); +} + + +/* ********************************************************************* + * _arp_lookup(ipi,destip) + * + * Look up an ARP entry [internal routine]. Given an IP address, + * return the hardware address to send the packets to, or + * NULL if no ARP entry exists. + * + * Input parameters: + * ipi - IP information + * destip - destination IP address + * + * Return value: + * pointer to Ethernet hardware address, or NULL if not found + ********************************************************************* */ + +uint8_t *_arp_lookup(ip_info_t *ipi,uint8_t *destip) +{ + arpentry_t *ae; + + ae = arp_find_entry(ipi,destip); + if (ae == NULL) return NULL; + + return ae->ae_ethaddr; +} + +/* ********************************************************************* + * _arp_lookup_and_send(ipi,buf,dest) + * + * Transmit a packet [internal routine]. This routine is called + * by the IP layer when it wants to send a packet. We look + * through the ARP table to find a suitable destination host and + * transmit the packet. If there is no ARP entry, an ARP request + * is transmitted and the packet is saved on a queue for when + * the address is resolved. + * + * Input parameters: + * ipi - IP information + * buf - ebuf to transmit + * dest - destination IP address + * + * Return value: + * 0 if ok + * <0 if error + ********************************************************************* */ + +int _arp_lookup_and_send(ip_info_t *ipi,ebuf_t *buf,uint8_t *dest) +{ + arpentry_t *ae; + + ae = arp_find_entry(ipi,dest); + + if (ae == NULL) { + /* + * No ARP entry yet, create one and send the query + */ + ae = arp_new_entry(ipi); + memcpy(ae->ae_ipaddr,dest,IP_ADDR_LEN); + q_enqueue(&(ae->ae_txqueue),(queue_t *) buf); + ae->ae_retries = ARP_QUERY_RETRIES; + ae->ae_timer = ARP_QUERY_TIMER; + ae->ae_state = ae_arping; + arp_tx_query(ipi,ae->ae_ipaddr); + } + else { + /* + * have an ARP entry. If established, just send the + * packet now. Otherwise, queue on arp queue if there's room. + */ + if (ae->ae_state == ae_established) { + ae->ae_usage++; + if (!ae->ae_permanent) { + ae->ae_timer = ARP_KEEP_TIMER; + } + eth_send(buf,ae->ae_ethaddr); + eth_free(buf); + } + else { + if (q_count(&(ae->ae_txqueue)) < ARP_TXWAIT_MAX) { + q_enqueue(&(ae->ae_txqueue),(queue_t *) buf); + } + else { + /* no room, silently drop */ + eth_free(buf); + } + } + } + + return 0; +} + +/* ********************************************************************* + * arp_tx_waiting(ae) + * + * Transmit all pending packets on the specified ARP entry's + * queue. Packets get queued to an ARP entry when the address + * has not completed resolution. Once resolved, this routine + * is called to flush the packets out. + * + * Input parameters: + * ae - arp entry + * + * Return value: + * nothing + ********************************************************************* */ + +static void arp_tx_waiting(arpentry_t *ae) +{ + ebuf_t *buf; + + while ((buf = (ebuf_t *) q_deqnext(&(ae->ae_txqueue)))) { + eth_send(buf,ae->ae_ethaddr); + eth_free(buf); + } +} + + +/* ********************************************************************* + * arp_new_entry(ipi) + * + * Create a new ARP entry, deleting an active entry if necessary. + * + * Input parameters: + * ipi - IP information + * + * Return value: + * arp entry pointer + ********************************************************************* */ + +static arpentry_t *arp_new_entry(ip_info_t *ipi) +{ + arpentry_t *ae; + arpentry_t *victim = NULL; + int idx; + int minusage = 0x7FFFFFFF; + + /* + * First scan the table and find an empty entry. + */ + + ae = ipi->arp_table; + for (idx = 0; idx < ARP_TABLE_SIZE; idx++,ae++) { + if (ae->ae_state == ae_unused) { + return ae; + } + } + + /* + * If all entries are in use, pick the one with the + * lowest usage count. This isn't very scientific, + * and perhaps should use a timer of some sort. + */ + + ae = ipi->arp_table; + for (idx = 0; idx < ARP_TABLE_SIZE; idx++,ae++) { + if (ae->ae_usage < minusage) { + victim = ae; + minusage = ae->ae_usage; + } + } + + /* + * In the highly unlikely event that all entries have + * overflow values in their usage counters, just take the + * first table entry. + */ + + if (victim == NULL) victim = ipi->arp_table; + + /* + * Clear out the old entry and use it. + */ + + arp_delete(victim); + + return victim; +} + +/* ********************************************************************* + * arp_find_entry(ipi,ipaddr) + * + * Find an ARP entry in the table. Given an IP address, this + * routine locates the corresponding ARP table entry. We also + * reset the expiration timer for the ARP entry, to prevent + * it from from being deleted. + * + * Input parameters: + * ipi - IP info + * ipaddr - IP address we're looking for + * + * Return value: + * arp entry pointer, or NULL if not found + ********************************************************************* */ + +static arpentry_t *arp_find_entry(ip_info_t *ipi,uint8_t *ipaddr) +{ + arpentry_t *ae; + int idx; + + ae = ipi->arp_table; + + for (idx = 0; idx < ARP_TABLE_SIZE; idx++,ae++) { + if (ae->ae_state != ae_unused) { + if (memcmp(ae->ae_ipaddr,ipaddr,IP_ADDR_LEN) == 0) { + if (ae->ae_state == ae_established) + ae->ae_timer = ARP_KEEP_TIMER; + return ae; + } + } + } + return NULL; +} + + +/* ********************************************************************* + * arp_rx_query(ipi,srcaddr,targethw,targetip) + * + * Process a received ARP QUERY message. When we get an ARP, + * transmit a reply to the sender. + * + * Input parameters: + * ipi - IP information + * srcaddr - source IP address + * targethw - target hardware address + * targetip - target IP address (should be our address) + * + * Input parameters: + * 0 if ok + * else <0 = error + ********************************************************************* */ + +static int arp_rx_query(ip_info_t *ipi,uint8_t *srcaddr, + uint8_t *targethw,uint8_t *targetip) +{ + ebuf_t *txbuf; + + /* + * Allocate a packet and form the reply + */ + + txbuf = eth_alloc(ipi->eth_info,ipi->arp_port); + if (!txbuf) return -1; + + ebuf_append_u16_be(txbuf,ARP_HWADDRSPACE_ETHERNET); + ebuf_append_u16_be(txbuf,PROTOSPACE_IP); + ebuf_append_u8(txbuf,ENET_ADDR_LEN); + ebuf_append_u8(txbuf,IP_ADDR_LEN); + ebuf_append_u16_be(txbuf,ARP_OPCODE_REPLY); + + ebuf_append_bytes(txbuf,ipi->arp_hwaddr,ENET_ADDR_LEN); + ebuf_append_bytes(txbuf,ipi->net_info.ip_addr,IP_ADDR_LEN); + + ebuf_append_bytes(txbuf,targethw,ENET_ADDR_LEN); + ebuf_append_bytes(txbuf,targetip,IP_ADDR_LEN); + + eth_send(txbuf,srcaddr); + eth_free(txbuf); + + return 0; +} + +/* ********************************************************************* + * arp_rx_response(ipi,senderhw,senderip) + * + * Process a received ARP RESPONSE packet. This packet contains + * the hardware address of some host we were querying. Fill + * in the rest of the entries in the ARP table and + * transmit any pending packets. + * + * Input parameters: + * ipi - IP information + * senderhw - sender's hardware address + * senderip - sender's IP address + * + * Return value: + * 0 + ********************************************************************* */ + +static int arp_rx_response(ip_info_t *ipi,uint8_t *senderhw,uint8_t *senderip) +{ + int idx; + arpentry_t *ae; + + ae = ipi->arp_table; + + for (idx = 0; idx < ARP_TABLE_SIZE; idx++,ae++) { + if (ae->ae_state != ae_unused) { + if (memcmp(ae->ae_ipaddr,senderip,IP_ADDR_LEN) == 0) { + memcpy(ae->ae_ethaddr,senderhw,ENET_ADDR_LEN); + ae->ae_state = ae_established; + ae->ae_timer = ARP_KEEP_TIMER; + ae->ae_retries = 0; + ae->ae_permanent = FALSE; + arp_tx_waiting(ae); + } + } + } + + return 0; +} + +/* ********************************************************************* + * arp_rx_callback(buf,ref) + * + * Callback for ARP protocol packets. This routine is called + * by the datalink layer when we receive an ARP packet. Parse + * the packet and call any packet-specific processing routines + * + * Input parameters: + * buf - ebuf that we received + * ref - reference data when we opened the port. This is + * our IP information structure + * + * Return value: + * ETH_DROP or ETH_KEEP. + ********************************************************************* */ + +static int arp_rx_callback(ebuf_t *buf,void *ref) +{ + ip_info_t *ipi = ref; + uint16_t t16; + uint8_t t8; + uint16_t opcode; + uint8_t senderip[IP_ADDR_LEN]; + uint8_t senderhw[ENET_ADDR_LEN]; + uint8_t targetip[IP_ADDR_LEN]; + uint8_t targethw[ENET_ADDR_LEN]; + + /* + * ARP packets have to be at least 28 bytes + */ + + if (ebuf_length(buf) < 28) goto drop; + + /* + * We only do the Ethernet hardware space + */ + + ebuf_get_u16_be(buf,t16); + if (t16 != ARP_HWADDRSPACE_ETHERNET) goto drop; + + /* + * We only do the IP protocol space + */ + + ebuf_get_u16_be(buf,t16); + if (t16 != PROTOSPACE_IP) goto drop; + + /* + * The IP and Ethernet address lengths had better be right. + */ + + ebuf_get_u8(buf,t8); + if (t8 != ENET_ADDR_LEN) goto drop; + + ebuf_get_u8(buf,t8); + if (t8 != IP_ADDR_LEN) goto drop; + + /* + * Get the opcode and other fields. + */ + + ebuf_get_u16_be(buf,opcode); + + ebuf_get_bytes(buf,senderhw,ENET_ADDR_LEN); + ebuf_get_bytes(buf,senderip,IP_ADDR_LEN); + ebuf_get_bytes(buf,targethw,ENET_ADDR_LEN); + ebuf_get_bytes(buf,targetip,IP_ADDR_LEN); + + /* + * If it's not for us, just drop it. + */ + + if (memcmp(targetip,ipi->net_info.ip_addr,IP_ADDR_LEN) != 0) goto drop; + + /* + * Dispatch to an appropriate routine. + */ + + switch (opcode) { + case ARP_OPCODE_REQUEST: + arp_rx_query(ipi,ebuf_srcaddr(buf),senderhw,senderip); + break; + case ARP_OPCODE_REPLY: + arp_rx_response(ipi,senderhw,senderip); + break; + } + +drop: + return ETH_DROP; +} + +/* ********************************************************************* + * _arp_timer_tick(ipi) + * + * ARP timer processing [internal routine]. This routine + * counts down timer ticks in the ARP entries, causing retransmits + * or ARP entry expirations to happen. + * + * Input parameters: + * ipi - IP information + * + * Return value: + * nothing + ********************************************************************* */ + +void _arp_timer_tick(ip_info_t *ipi) +{ + int idx; + arpentry_t *ae; + + ae = ipi->arp_table; + + /* + * Walk through the ARP table. + */ + + for (idx = 0; idx < ARP_TABLE_SIZE; idx++,ae++) { + + switch (ae->ae_state) { + case ae_unused: + /* + * Unused entry. Do nothing. + */ + break; + + case ae_arping: + /* + * Entry is arping. Count down the timer, and retransmit + * the ARP message. + */ + ae->ae_timer--; + if (ae->ae_timer <= 0) { + if (ae->ae_retries == 0) { + arp_delete(ae); + } + else { + ae->ae_retries--; + ae->ae_timer = ARP_QUERY_TIMER; + arp_tx_query(ipi,ae->ae_ipaddr); + } + } + break; + + case ae_established: + /* + * Established entry. Count down the timer and + * delete the ARP entry. If the timer is zero + * already, it's a permanent ARP entry. + */ + if (ae->ae_timer == 0) break; + ae->ae_timer--; + if (ae->ae_timer == 0) arp_delete(ae); + break; + } + } + +} + +/* ********************************************************************* + * _arp_send_gratuitous(ipi) + * + * Transmit the "gratuitous arp" (an ARP for our own IP address). + * This is done customarily when an interface is initialized. + * + * Input parameters: + * ipi - IP information + * + * Return value: + * nothing + ********************************************************************* */ + +void _arp_send_gratuitous(ip_info_t *ipi) +{ + if (!ip_addriszero(ipi->net_info.ip_addr)) { + arp_tx_query(ipi,ipi->net_info.ip_addr); + } +} + +/* ********************************************************************* + * _arp_init(ipi) + * + * Initialize the ARP layer [internal routine] + * + * Input parameters: + * ipi - IP information + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _arp_init(ip_info_t *ipi) +{ + int8_t arpproto[2]; + int idx; + arpentry_t *ae; + + /* + * Allocate space for the ARP table + */ + + ipi->arp_table = KMALLOC(ARP_TABLE_SIZE*sizeof(arpentry_t),0); + + if (ipi->arp_table == NULL) return NULL; + + /* + * Initialize the ARP table. + */ + + ae = ipi->arp_table; + for (idx = 0; idx < ARP_TABLE_SIZE; idx++) { + ae->ae_state = ae_unused; + ae->ae_timer = 0; + ae->ae_usage = 0; + ae->ae_retries = 0; + ae->ae_permanent = 0; + q_init(&(ae->ae_txqueue)); + ae++; + } + + /* + * Open the Ethernet portal for ARP packets + */ + + arpproto[0] = (PROTOSPACE_ARP >> 8) & 0xFF; + arpproto[1] = (PROTOSPACE_ARP & 0xFF); + ipi->arp_port = eth_open(ipi->eth_info,ETH_PTYPE_DIX,arpproto,arp_rx_callback,ipi); + + if (ipi->arp_port < 0) { + KFREE(ipi->arp_table); + ipi->arp_table = NULL; + return -1; + } + + /* + * Remember our hardware address + */ + + eth_gethwaddr(ipi->eth_info,ipi->arp_hwaddr); + + /* + * Send a query for ourselves if our IP address is set + */ + + _arp_send_gratuitous(ipi); + + return 0; + +} + + +/* ********************************************************************* + * _arp_uninit(ipi) + * + * Uninitialize the ARP interface. This is called when the + * network module is shut down. + * + * Input parameters: + * ipi - IP information + * + * Return value: + * nothing + ********************************************************************* */ + +void _arp_uninit(ip_info_t *ipi) +{ + int idx; + arpentry_t *ae; + + /* + * Close the Ethernet portal + */ + + eth_close(ipi->eth_info,ipi->arp_port); + + /* + * Clear out the ARP Table. + */ + + ae = ipi->arp_table; + for (idx = 0; idx < ARP_TABLE_SIZE; idx++) { + if (ae->ae_state != ae_unused) arp_delete(ae); + ae++; + } + + /* + * Free up the memory. + */ + + KFREE(ipi->arp_table); + ipi->arp_table = NULL; + ipi->arp_port = -1; +} + + +/* ********************************************************************* + * _arp_enumerate(ipi,entrynum,ipaddr,hwaddr) + * + * Enumerate the ARP table. This is used by user-interface + * routines to display the current contents of the ARP table. + * + * Input parameters: + * ipi - IP information + * entrynum - entry index + * ipaddr - buffer to copy entry's IP address to + * hwaddr - buffer to copy entry's hardware address to + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _arp_enumerate(ip_info_t *ipi,int entrynum,uint8_t *ipaddr,uint8_t *hwaddr) +{ + arpentry_t *ae; + int idx; + + ae = ipi->arp_table; + for (idx = 0; idx < ARP_TABLE_SIZE; idx++) { + if (ae->ae_state != ae_unused) { + if (entrynum == 0) { + memcpy(ipaddr,ae->ae_ipaddr,IP_ADDR_LEN); + memcpy(hwaddr,ae->ae_ethaddr,ENET_ADDR_LEN); + return 0; + } + entrynum--; + } + ae++; + } + + return -1; +} + + +/* ********************************************************************* + * _arp_delete(ipi,ipaddr) + * + * Delete an ARP entry. This routine takes an IP address, looks + * up its ARP table entry, and removes it from the table. + * + * Input parameters: + * ipi - IP information + * ipaddr - IP address whose entry to delete + * + * Return value: + * 0 if entry was deleted + * <0 if entry was not found + ********************************************************************* */ + +int _arp_delete(ip_info_t *ipi,uint8_t *ipaddr) +{ + arpentry_t *ae; + + ae = arp_find_entry(ipi,ipaddr); + + if (ae) { + arp_delete(ae); + return 0; + } + return -1; +} diff --git a/cfe/cfe/net/net_dhcp.c b/cfe/cfe/net/net_dhcp.c new file mode 100644 index 0000000..84a39e6 --- /dev/null +++ b/cfe/cfe/net/net_dhcp.c @@ -0,0 +1,869 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * DHCP Client File: net_dhcp.c + * + * This module contains a DHCP client. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "env_subr.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_error.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "cfe.h" + +#include "net_api.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + + +#define UDP_PORT_BOOTPS 67 +#define UDP_PORT_BOOTPC 68 + +#define DHCP_REQ_TIMEOUT (1*CFE_HZ) +#define DHCP_NUM_RETRIES 8 + +#define DHCP_OP_BOOTREQUEST 1 +#define DHCP_OP_BOOTREPLY 2 + +#define DHCP_HWTYPE_ETHERNET 1 + +#define DHCP_TAG_FUNCTION 53 +#define DHCP_FUNCTION_DISCOVER 1 +#define DHCP_FUNCTION_OFFER 2 +#define DHCP_FUNCTION_REQUEST 3 +#define DHCP_FUNCTION_ACK 5 + +#define DHCP_TAG_NETMASK 1 +#define DHCP_TAG_DOMAINNAME 0x0F +#define DHCP_TAG_GATEWAY 0x03 +#define DHCP_TAG_NAMESERVER 0x06 +#define DHCP_TAG_SWAPSERVER 0x10 +#define DHCP_TAG_ROOTPATH 0x11 +#define DHCP_TAG_EXTENSIONS 0x12 +#define DHCP_TAG_SERVERIDENT 54 +#define DHCP_TAG_PARAMLIST 55 +#define DHCP_TAG_CLIENTID 61 +#define DHCP_TAG_CLASSID 60 +#define DHCP_TAG_REQADDR 50 +#define DHCP_TAG_LEASE_TIME 51 +#define DHCP_TAG_SCRIPT 130 /* CFE extended option */ +#define DHCP_TAG_OPTIONS 131 /* CFE extended option */ + +#define DHCP_TAG_END 0xFF + +#define DHCP_MAGIC_NUMBER 0x63825363 + +/*#define _DEBUG_*/ + + +/* ********************************************************************* + * dhcp_set_envvars(reply) + * + * Using the supplied DHCP reply data, set environment variables + * to contain data from the reply. + * + * Input parameters: + * reply - dhcp reply + * + * Return value: + * nothing + ********************************************************************* */ + +void dhcp_set_envvars(dhcpreply_t *reply) +{ + char buffer[50]; + + env_delenv("BOOT_SERVER"); + env_delenv("BOOT_FILE"); + env_delenv("BOOT_SCRIPT"); + env_delenv("BOOT_OPTIONS"); + + if (reply->dr_bootserver[0] | reply->dr_bootserver[1] | + reply->dr_bootserver[2] | reply->dr_bootserver[3]) { + sprintf(buffer,"%I",reply->dr_bootserver); + env_setenv("BOOT_SERVER",buffer,ENV_FLG_BUILTIN); + } + + if (reply->dr_bootfile && reply->dr_bootfile[0]) { + env_setenv("BOOT_FILE",reply->dr_bootfile,ENV_FLG_BUILTIN); + } + + if (reply->dr_script && reply->dr_script[0]) { + env_setenv("BOOT_SCRIPT",reply->dr_script,ENV_FLG_BUILTIN); + } + + if (reply->dr_options && reply->dr_options[0]) { + env_setenv("BOOT_OPTIONS",reply->dr_options,ENV_FLG_BUILTIN); + } +} + +/* ********************************************************************* + * dhcp_dumptag(tag,len,buf) + * + * Dump out information from a DHCP tag + * + * Input parameters: + * tag - tag ID + * len - length of data + * buf - data + * + * Return value: + * nothing + ********************************************************************* */ + +#ifdef _DEBUG_ +static void dhcp_dumptag(uint8_t tag,uint8_t len,uint8_t *buf) +{ + unsigned int idx; + + xprintf("DHCP: "); + + switch (tag) { + case DHCP_TAG_FUNCTION: + xprintf("DHCP Function: %d\n",buf[0]); + break; + case DHCP_TAG_LEASE_TIME: + idx = (((unsigned int) buf[0]) << 24) | + (((unsigned int) buf[1]) << 16) | + (((unsigned int) buf[2]) << 8) | + (((unsigned int) buf[3]) << 0); + xprintf("Lease Time: %d seconds\n",idx); + break; + case DHCP_TAG_SERVERIDENT: + xprintf("DHCP Server ID: %d.%d.%d.%d\n", + buf[0],buf[1],buf[2],buf[3]); + break; + case DHCP_TAG_NETMASK: + xprintf("Netmask: %d.%d.%d.%d\n",buf[0],buf[1],buf[2],buf[3]); + break; + case DHCP_TAG_DOMAINNAME: + buf[len] = 0; + xprintf("Domain: %s\n",buf); + break; + case DHCP_TAG_GATEWAY: + xprintf("Gateway: %d.%d.%d.%d\n",buf[0],buf[1],buf[2],buf[3]); + break; + case DHCP_TAG_NAMESERVER: + xprintf("Nameserver: %d.%d.%d.%d\n",buf[0],buf[1],buf[2],buf[3]); + break; + case DHCP_TAG_SWAPSERVER: + buf[len] = 0; + xprintf("Swapserver: %s\n",buf); + break; + case DHCP_TAG_ROOTPATH: + buf[len] = 0; + xprintf("Rootpath: %s\n",buf); + break; + case DHCP_TAG_SCRIPT: + buf[len] = 0; + xprintf("CFE Script: %s\n",buf); + break; + case DHCP_TAG_OPTIONS: + buf[len] = 0; + xprintf("CFE Boot Options: %s\n",buf); + break; + default: + xprintf("Tag %d len %d [",tag,len); + for (idx = 0; idx < len; idx++) { + if ((buf[idx] >= 32) && (buf[idx] < 127)) xprintf("%c",buf[idx]); + } + xprintf("]\n"); + break; + + } +} +#endif + +/* ********************************************************************* + * dhcp_free_reply(reply) + * + * Free memory associated with a DHCP reply. + * + * Input parameters: + * reply - pointer to DHCP reply + * + * Return value: + * nothing + ********************************************************************* */ + +void dhcp_free_reply(dhcpreply_t *reply) +{ + if (reply->dr_hostname) KFREE(reply->dr_hostname); + if (reply->dr_domainname) KFREE(reply->dr_domainname); + if (reply->dr_bootfile) KFREE(reply->dr_bootfile); + if (reply->dr_rootpath) KFREE(reply->dr_rootpath); + if (reply->dr_swapserver) KFREE(reply->dr_swapserver); + if (reply->dr_script) KFREE(reply->dr_script); + if (reply->dr_options) KFREE(reply->dr_options); + KFREE(reply); +} + +/* ********************************************************************* + * dhcp_build_discover() + * + * Build a DHCP DISCOVER packet + * + * Input parameters: + * hwaddr - our hardware address + * idptr - pointer to int to receive the DHCP packet ID + * serveraddr - pointer to server address (REQUEST) or + * NULL (DISCOVER) + * ebufptr - receives pointer to ebuf + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int dhcp_build_discover(uint8_t *hwaddr, + uint32_t id, + ebuf_t **ebufptr) +{ + uint8_t ipaddr[IP_ADDR_LEN]; + ebuf_t *buf; + uint8_t junk[128]; + + /* + * Get a buffer and fill it in. + */ + + ipaddr[0] = 0; ipaddr[1] = 0; ipaddr[2] = 0; ipaddr[3] = 0; + memset(junk,0,sizeof(junk)); + + buf = udp_alloc(); + + if (buf == NULL) { + return CFE_ERR_NOMEM; + } + + memset(buf->eb_ptr,0,548); + + ebuf_append_u8(buf,DHCP_OP_BOOTREQUEST); + ebuf_append_u8(buf,DHCP_HWTYPE_ETHERNET); + ebuf_append_u8(buf,ENET_ADDR_LEN); + ebuf_append_u8(buf,0); /* hops */ + ebuf_append_u32_be(buf,id); + ebuf_append_u16_be(buf,0); /* sec since boot */ + ebuf_append_u16_be(buf,0); /* flags */ + + ebuf_append_bytes(buf,ipaddr,IP_ADDR_LEN); /* ciaddr */ + ebuf_append_bytes(buf,ipaddr,IP_ADDR_LEN); /* yiaddr */ + ebuf_append_bytes(buf,ipaddr,IP_ADDR_LEN); /* siaddr */ + ebuf_append_bytes(buf,ipaddr,IP_ADDR_LEN); /* giaddr */ + + ebuf_append_bytes(buf,hwaddr,ENET_ADDR_LEN); /* chaddr */ + ebuf_append_bytes(buf,junk,10); /* rest of chaddr */ + ebuf_append_bytes(buf,junk,64); /* sname */ + ebuf_append_bytes(buf,junk,128); /* file */ + + ebuf_append_u32_be(buf,DHCP_MAGIC_NUMBER); + + ebuf_append_u8(buf,DHCP_TAG_FUNCTION); /* function code */ + ebuf_append_u8(buf,1); + ebuf_append_u8(buf,DHCP_FUNCTION_DISCOVER); + + ebuf_append_u8(buf,DHCP_TAG_PARAMLIST); + ebuf_append_u8(buf,8); /* count of tags that follow */ + ebuf_append_u8(buf,DHCP_TAG_NETMASK); + ebuf_append_u8(buf,DHCP_TAG_DOMAINNAME); + ebuf_append_u8(buf,DHCP_TAG_GATEWAY); + ebuf_append_u8(buf,DHCP_TAG_NAMESERVER); + ebuf_append_u8(buf,DHCP_TAG_SWAPSERVER); + ebuf_append_u8(buf,DHCP_TAG_ROOTPATH); + ebuf_append_u8(buf,DHCP_TAG_SCRIPT); + ebuf_append_u8(buf,DHCP_TAG_OPTIONS); + + + ebuf_append_u8(buf,DHCP_TAG_END); /* terminator */ + + /* + * Return the packet + */ + + *ebufptr = buf; + + return 0; +} + +/* ********************************************************************* + * dhcp_build_request() + * + * Build a DHCP DISCOVER or REQUEST packet + * + * Input parameters: + * hwaddr - our hardware address + * idptr - pointer to int to receive the DHCP packet ID + * serveraddr - pointer to server address (REQUEST) or + * NULL (DISCOVER) + * ebufptr - receives pointer to ebuf + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int dhcp_build_request(uint8_t *hwaddr, + uint32_t id, + uint8_t *serveraddr, + uint8_t *reqip, + ebuf_t **ebufptr) +{ + uint8_t ipaddr[IP_ADDR_LEN]; + ebuf_t *buf; + uint8_t junk[128]; + + /* + * Get a buffer and fill it in. + */ + + ipaddr[0] = 0; ipaddr[1] = 0; ipaddr[2] = 0; ipaddr[3] = 0; + memset(junk,0,sizeof(junk)); + + buf = udp_alloc(); + + if (buf == NULL) { + return CFE_ERR_NOMEM; + } + + memset(buf->eb_ptr,0,548); + + ebuf_append_u8(buf,DHCP_OP_BOOTREQUEST); + ebuf_append_u8(buf,DHCP_HWTYPE_ETHERNET); + ebuf_append_u8(buf,ENET_ADDR_LEN); + ebuf_append_u8(buf,0); /* hops */ + ebuf_append_u32_be(buf,id); + ebuf_append_u16_be(buf,0); /* sec since boot */ + ebuf_append_u16_be(buf,0); /* flags */ + + ebuf_append_bytes(buf,ipaddr,IP_ADDR_LEN); /* ciaddr */ + ebuf_append_bytes(buf,ipaddr,IP_ADDR_LEN); /* yiaddr */ + ebuf_append_bytes(buf,ipaddr,IP_ADDR_LEN); /* siaddr */ + ebuf_append_bytes(buf,ipaddr,IP_ADDR_LEN); /* giaddr */ + + ebuf_append_bytes(buf,hwaddr,ENET_ADDR_LEN); /* chaddr */ + ebuf_append_bytes(buf,junk,10); /* rest of chaddr */ + + ebuf_append_bytes(buf,junk,64); /* sname */ + + ebuf_append_bytes(buf,junk,128); /* file */ + + ebuf_append_u32_be(buf,DHCP_MAGIC_NUMBER); + + ebuf_append_u8(buf,DHCP_TAG_FUNCTION); /* function code */ + ebuf_append_u8(buf,1); + + ebuf_append_u8(buf,DHCP_FUNCTION_REQUEST); + + ebuf_append_u8(buf,DHCP_TAG_REQADDR); + ebuf_append_u8(buf,IP_ADDR_LEN); + ebuf_append_bytes(buf,reqip,IP_ADDR_LEN); + + ebuf_append_u8(buf,DHCP_TAG_SERVERIDENT); /* server ID */ + ebuf_append_u8(buf,IP_ADDR_LEN); + ebuf_append_bytes(buf,serveraddr,IP_ADDR_LEN); + + ebuf_append_u8(buf,DHCP_TAG_CLIENTID); /* client ID */ + ebuf_append_u8(buf,7); + ebuf_append_u8(buf,1); + ebuf_append_bytes(buf,hwaddr,ENET_ADDR_LEN); + + ebuf_append_u8(buf,DHCP_TAG_PARAMLIST); + ebuf_append_u8(buf,8); /* count of tags that follow */ + ebuf_append_u8(buf,DHCP_TAG_NETMASK); + ebuf_append_u8(buf,DHCP_TAG_DOMAINNAME); + ebuf_append_u8(buf,DHCP_TAG_GATEWAY); + ebuf_append_u8(buf,DHCP_TAG_NAMESERVER); + ebuf_append_u8(buf,DHCP_TAG_SWAPSERVER); + ebuf_append_u8(buf,DHCP_TAG_ROOTPATH); + ebuf_append_u8(buf,DHCP_TAG_SCRIPT); + ebuf_append_u8(buf,DHCP_TAG_OPTIONS); + + + ebuf_append_u8(buf,DHCP_TAG_END); /* terminator */ + + /* + * Return the packet + */ + + *ebufptr = buf; + + return 0; +} + + +/* ********************************************************************* + * dhcp_wait_reply(s,id,reply,serveraddr) + * + * Wait for a reply from the DHCP server + * + * Input parameters: + * s - socket + * id - ID of request we sent + * reply - structure to store results in + * expfcode - expected DHCP_FUNCTION tag value + * + * Return value: + * 0 if ok (reply found) + * else error + ********************************************************************* */ + +static int dhcp_wait_reply(int s,uint32_t id,dhcpreply_t *reply,int expfcode) +{ + uint32_t tmpd; + uint8_t tmpb; + int64_t timer; + int nres = 0; + uint8_t ciaddr[IP_ADDR_LEN]; + uint8_t yiaddr[IP_ADDR_LEN]; + uint8_t siaddr[IP_ADDR_LEN]; + uint8_t giaddr[IP_ADDR_LEN]; + uint8_t junk[128]; + char *hostname; + char *bootfile; + ebuf_t *buf; + int fcode = -1; + + /* + * Set a timer for the response + */ + + TIMER_SET(timer,DHCP_REQ_TIMEOUT); + + /* + * Start waiting... + */ + + while (!TIMER_EXPIRED(timer)) { + POLL(); + + buf = udp_recv(s); + if (!buf) continue; + + ebuf_get_u8(buf,tmpb); + if (tmpb != DHCP_OP_BOOTREPLY) { + goto drop; + } + + ebuf_get_u8(buf,tmpb); + if (tmpb != DHCP_HWTYPE_ETHERNET) { + goto drop; + } + + ebuf_get_u8(buf,tmpb); + if (tmpb != ENET_ADDR_LEN) { + goto drop; + } + + ebuf_skip(buf,1); /* hops */ + + ebuf_get_u32_be(buf,tmpd); /* check ID */ + if (tmpd != id) { + goto drop; + } + + ebuf_skip(buf,2); /* seconds since boot */ + ebuf_skip(buf,2); /* flags */ + + ebuf_get_bytes(buf,ciaddr,IP_ADDR_LEN); + ebuf_get_bytes(buf,yiaddr,IP_ADDR_LEN); + ebuf_get_bytes(buf,siaddr,IP_ADDR_LEN); + ebuf_get_bytes(buf,giaddr,IP_ADDR_LEN); + + ebuf_skip(buf,16); /* hardware address */ + hostname = ebuf_ptr(buf); + ebuf_skip(buf,64); + bootfile = ebuf_ptr(buf); + + ebuf_skip(buf,128); + +#ifdef _DEBUG_ + xprintf("Client IP: %d.%d.%d.%d\n",ciaddr[0],ciaddr[1],ciaddr[2],ciaddr[3]); + xprintf("Your IP: %d.%d.%d.%d\n",yiaddr[0],yiaddr[1],yiaddr[2],yiaddr[3]); + xprintf("Server IP: %d.%d.%d.%d\n",siaddr[0],siaddr[1],siaddr[2],siaddr[3]); + xprintf("Gateway IP: %d.%d.%d.%d\n",giaddr[0],giaddr[1],giaddr[2],giaddr[3]); + xprintf("hostname: %s\n",hostname); + xprintf("boot file: %s\n",bootfile); +#endif + + memcpy(reply->dr_ipaddr,yiaddr,IP_ADDR_LEN); + memcpy(reply->dr_gateway,giaddr,IP_ADDR_LEN); + memcpy(reply->dr_bootserver,siaddr,IP_ADDR_LEN); + if (*hostname) reply->dr_hostname = strdup(hostname); + if (*bootfile) reply->dr_bootfile = strdup(bootfile); + + /* + * Test for options - look for magic number + */ + + ebuf_get_u32_be(buf,tmpd); + + memcpy(reply->dr_dhcpserver,buf->eb_usrptr,IP_ADDR_LEN); + + if (tmpd == DHCP_MAGIC_NUMBER) { + uint8_t tag; + uint8_t len; + + while (buf->eb_length > 0) { + ebuf_get_u8(buf,tag); + if (tag == DHCP_TAG_END) break; + ebuf_get_u8(buf,len); + ebuf_get_bytes(buf,junk,len); + +#ifdef _DEBUG_ + dhcp_dumptag(tag,len,junk); +#endif + + switch (tag) { + case DHCP_TAG_FUNCTION: + fcode = (uint8_t) junk[0]; + break; + case DHCP_TAG_NETMASK: + memcpy(reply->dr_netmask,junk,IP_ADDR_LEN); + break; + case DHCP_TAG_GATEWAY: + memcpy(reply->dr_gateway,junk,IP_ADDR_LEN); + break; + case DHCP_TAG_NAMESERVER: + memcpy(reply->dr_nameserver,junk,IP_ADDR_LEN); + break; + case DHCP_TAG_DOMAINNAME: + junk[len] = 0; + if (len) reply->dr_domainname = strdup(junk); + break; + case DHCP_TAG_SWAPSERVER: + junk[len] = 0; + if (len) reply->dr_swapserver = strdup(junk); + break; + case DHCP_TAG_SERVERIDENT: + if (len == IP_ADDR_LEN) { + memcpy(reply->dr_dhcpserver,junk,len); + } + break; + case DHCP_TAG_ROOTPATH: + junk[len] = 0; + if (len) reply->dr_rootpath = strdup(junk); + break; + case DHCP_TAG_SCRIPT: + junk[len] = 0; + if (len) reply->dr_script = strdup(junk); + break; + case DHCP_TAG_OPTIONS: + junk[len] = 0; + if (len) reply->dr_options = strdup(junk); + break; + } + } + } + + if (fcode != expfcode) { + goto drop; + } + + udp_free(buf); + nres++; + break; + + drop: + udp_free(buf); + } + + if (nres > 0) return 0; + else return CFE_ERR_TIMEOUT; +} + + +/* ********************************************************************* + * dhcp_do_dhcpdiscover(s,hwaddr,reply) + * + * Request an IP address from the DHCP server. On success, the + * dhcpreply_t structure will be filled in + * + * Input parameters: + * s - udp socket + * hwaddr - our hardware address + * reply - pointer to reply buffer. + * + * Return value: + * 0 if a response was received + * else error code + ********************************************************************* */ + +static int dhcp_do_dhcpdiscover(int s,uint8_t *hwaddr,dhcpreply_t *reply) +{ + ebuf_t *buf; + uint32_t id; + uint8_t ipaddr[IP_ADDR_LEN]; + int res; + + /* + * Packet ID is the current time + */ + + id = (uint32_t)cfe_ticks; + + /* + * Build the DISCOVER request + */ + + res = dhcp_build_discover(hwaddr,id,&buf); + if (res != 0) return res; + + /* + * Send the packet to the IP broadcast (255.255.255.255) + */ + + ipaddr[0] = 0xFF; ipaddr[1] = 0xFF; ipaddr[2] = 0xFF; ipaddr[3] = 0xFF; + udp_send(s,buf,ipaddr); + + /* + * Wait for a reply + */ + + res = dhcp_wait_reply(s,id,reply,DHCP_FUNCTION_OFFER); + + return res; +} + + +/* ********************************************************************* + * dhcp_do_dhcprequest(s,hwaddr,reply,discover_reply) + * + * Request an IP address from the DHCP server. On success, the + * dhcpreply_t structure will be filled in + * + * Input parameters: + * s - udp socket + * hwaddr - our hardware address + * reply - pointer to reply buffer. + * discover_reply - pointer to previously received DISCOVER data + * + * Return value: + * 0 if a response was received + * else error code + ********************************************************************* */ + +static int dhcp_do_dhcprequest(int s,uint8_t *hwaddr, + dhcpreply_t *reply, + dhcpreply_t *discover_reply) +{ + ebuf_t *buf; + uint32_t id; + uint8_t ipaddr[IP_ADDR_LEN]; + int res; + + /* + * Packet ID is the current time + */ + + id = (uint32_t)cfe_ticks; + + /* + * Build the DHCP REQUEST request + */ + + res = dhcp_build_request(hwaddr, + id, + discover_reply->dr_dhcpserver, + discover_reply->dr_ipaddr, + &buf); + + if (res != 0) return res; + + /* + * Send the packet to the IP broadcast (255.255.255.255) + */ + + ipaddr[0] = 0xFF; ipaddr[1] = 0xFF; ipaddr[2] = 0xFF; ipaddr[3] = 0xFF; + udp_send(s,buf,ipaddr); + + /* + * Wait for a reply + */ + + res = dhcp_wait_reply(s,id,reply,DHCP_FUNCTION_ACK); + + return res; +} + + +/* ********************************************************************* + * dhcp_bootrequest(reply) + * + * Request an IP address from the DHCP server. On success, the + * dhcpreply_t structure will be allocated. + * + * Input parameters: + * reply - pointer to pointer to reply. + * + * Return value: + * 0 if no responses received + * >0 for some responses received + * else error code + ********************************************************************* */ + +int dhcp_bootrequest(dhcpreply_t **rep) +{ + uint8_t *hwaddr; + int s; + dhcpreply_t *discover_reply; + dhcpreply_t *request_reply; + int nres = 0; + int retries; + uint32_t id; + + id = (uint32_t) cfe_ticks; + + /* + * Start with empty reply buffers. Since we use a portion of the + * discover reply in the request, we'll keep two of them. + */ + + discover_reply = KMALLOC(sizeof(dhcpreply_t),0); + if (discover_reply == NULL) { + return CFE_ERR_NOMEM; + } + memset(discover_reply,0,sizeof(dhcpreply_t)); + + request_reply = KMALLOC(sizeof(dhcpreply_t),0); + if (request_reply == NULL) { + KFREE(discover_reply); + return CFE_ERR_NOMEM; + } + memset(request_reply,0,sizeof(dhcpreply_t)); + + + /* + * Get our hw addr + */ + + hwaddr = net_getparam(NET_HWADDR); + if (!hwaddr) { + KFREE(discover_reply); + KFREE(request_reply); + return CFE_ERR_NETDOWN; + } + + /* + * Open UDP port + */ + + s = udp_socket(UDP_PORT_BOOTPS); + if (s < 0) { + KFREE(discover_reply); + KFREE(request_reply); + return CFE_ERR_NOHANDLES; + } + + udp_bind(s,UDP_PORT_BOOTPC); + + /* + * Do the boot request. Start by sending the OFFER message + */ + + nres = CFE_ERR_TIMEOUT; + for (retries = 0; retries < DHCP_NUM_RETRIES; retries++) { + nres = dhcp_do_dhcpdiscover(s,hwaddr,discover_reply); + if (nres == 0) break; + if (nres == CFE_ERR_TIMEOUT) continue; + break; + } + + /* + * If someone sent us a response, send the REQUEST message + * to get a lease. + */ + + if (nres == 0) { + + /* + * Now, send the REQUEST message and get a response. + */ + + for (retries = 0; retries < DHCP_NUM_RETRIES; retries++) { + nres = dhcp_do_dhcprequest(s,hwaddr, + request_reply, + discover_reply); + if (nres == 0) break; + if (nres == CFE_ERR_TIMEOUT) continue; + break; + } + } + + /* + * All done with the discover reply. + */ + + dhcp_free_reply(discover_reply); + + /* + * All done with UDP + */ + + udp_close(s); + + /* + * Return the reply info. + */ + + if (nres == 0) { + *rep = request_reply; + } + else { + *rep = NULL; + dhcp_free_reply(request_reply); + } + + return nres; +} diff --git a/cfe/cfe/net/net_dns.c b/cfe/cfe/net/net_dns.c new file mode 100755 index 0000000..89b50b1 --- /dev/null +++ b/cfe/cfe/net/net_dns.c @@ -0,0 +1,354 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Domain Name System Resolver File: net_dns.c + * + * This module provides minimal support for looking up IP addresses + * from DNS name servers (RFCxxxx) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_timer.h" +#include "cfe_error.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "cfe.h" + +#include "net_api.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define ip_addriszero(a) (((a)[0]|(a)[1]|(a)[2]|(a)[3]) == 0) + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define UDP_PORT_DNS 53 + +#define DNS_FLG_QUERY 0x0000 +#define DNS_FLG_RESPONSE 0x8000 +#define DNS_OPCODE_QUERY 0x0000 +#define DNS_FLG_AA 0x0400 +#define DNS_FLG_TC 0x0200 +#define DNS_FLG_RD 0x0100 +#define DNS_FLG_RA 0x0080 +#define DNS_RCODE_MASK 0x000F +#define DNS_RCODE_OK 0x0000 +#define DNS_RCODE_NAMEERR 0x0003 + + +#define QTYPE_HOSTADDR 1 +#define QCLASS_INTERNET 1 + +#define DNS_QUERY_TIMEOUT 1 /* seconds */ +#define DNS_RETRY_COUNT 8 + + +/* ********************************************************************* + * dns_dolookup(s,hostname,ipaddr) + * + * Look up a host name and return its IP address. + * + * Input parameters: + * s - udp socket + * server - name server to query + * hostname - host name to find + * ipaddr - buffer to place IP address + * + * Return value: + * 0 if no responses found + * >0 to indicate number of response records (usually 1) + * else error code + ********************************************************************* */ + +static int dns_dolookup(int s,uint8_t *server,char *hostname,uint8_t *ipaddr) +{ + ebuf_t *buf; + uint16_t id; + uint16_t tmp; + char *tok; + char *ptr; + int64_t timer; + int nres = 0; + uint16_t nqr,nar,nns,nxr; + uint8_t tmpb; + int expired; + + + /* + * Use the current time for our request ID + */ + + id = (uint16_t) cfe_ticks; + + /* + * Get a buffer and fill it in. + */ + + buf = udp_alloc(); + + ebuf_append_u16_be(buf,id); + ebuf_append_u16_be(buf,(DNS_FLG_QUERY | DNS_OPCODE_QUERY | DNS_FLG_RD)); + ebuf_append_u16_be(buf,1); /* one question */ + ebuf_append_u16_be(buf,0); /* no answers */ + ebuf_append_u16_be(buf,0); /* no server resource records */ + ebuf_append_u16_be(buf,0); /* no additional records */ + + /* + * Chop up the hostname into pieces, basically replacing + * the dots with length indicators. + */ + + ptr = hostname; + + while ((tok = strchr(ptr,'.'))) { + ebuf_append_u8(buf,(tok-ptr)); + ebuf_append_bytes(buf,ptr,(tok-ptr)); + ptr = tok + 1; + } + + ebuf_append_u8(buf,strlen(ptr)); + ebuf_append_bytes(buf,ptr,strlen(ptr)); + ebuf_append_u8(buf,0); + ebuf_append_u16_be(buf,QTYPE_HOSTADDR); + ebuf_append_u16_be(buf,QCLASS_INTERNET); + + /* + * Send the request to the name server + */ + + udp_send(s,buf,server); + + /* + * Set a timer for the response + */ + + TIMER_SET(timer,DNS_QUERY_TIMEOUT*CFE_HZ); + + /* + * Start waiting... + */ + + while (!(expired = TIMER_EXPIRED(timer))) { + POLL(); + + buf = udp_recv(s); + if (!buf) continue; + + /* IDs must match */ + + ebuf_get_u16_be(buf,tmp); + if (id != tmp) goto drop; + + /* It must be a response */ + + ebuf_get_u16_be(buf,tmp); + + if ((tmp & DNS_FLG_RESPONSE) == 0) goto drop; + + if ((tmp & DNS_RCODE_MASK) != DNS_RCODE_OK) { + udp_free(buf); + /* name error */ + break; + } + + ebuf_get_u16_be(buf,nqr); + ebuf_get_u16_be(buf,nar); + ebuf_get_u16_be(buf,nns); + ebuf_get_u16_be(buf,nxr); + + if (nar == 0) { + goto drop; + } + + while (nqr > 0) { + if (ebuf_length(buf) <= 0) { + goto drop; + } + for (;;) { + ebuf_get_u8(buf,tmpb); + if (tmpb == 0) break; + ebuf_skip(buf,tmpb); + if (ebuf_length(buf) <= 0) { + goto drop; + } + } + ebuf_skip(buf,2); /* skip QTYPE */ + ebuf_skip(buf,2); /* skip QCLASS */ + nqr--; /* next question record */ + } + + /* + * Loop through the answer records to find + * a HOSTADDR record. Ignore any other records + * we find. + */ + + while (nar > 0) { + uint16_t rname,rtype,rclass,dlen; + + ebuf_get_u16_be(buf,rname); /* resource name */ + + ebuf_get_u16_be(buf,rtype); /* resource type */ + + ebuf_get_u16_be(buf,rclass); /* resource class */ + + ebuf_skip(buf,4); /* time to live */ + + ebuf_get_u16_be(buf,dlen); /* length of data */ + + if (rtype != QTYPE_HOSTADDR) { + ebuf_skip(buf,dlen); + nar--; + continue; + } + if (rclass != QCLASS_INTERNET) { + ebuf_skip(buf,dlen); + nar--; + continue; + } + + if (dlen != IP_ADDR_LEN) { + ebuf_skip(buf,dlen); + nar--; + continue; + } + + ebuf_get_bytes(buf,ipaddr,IP_ADDR_LEN); + break; + } + + if (nar == 0) goto drop; + + udp_free(buf); + nres++; + break; + + drop: + udp_free(buf); + } + + if (expired) return CFE_ERR_TIMEOUT; + if (nres == 0) return CFE_ERR_HOSTUNKNOWN; + return nres; +} + + +/* ********************************************************************* + * dns_lookup(hostname,ipaddr) + * + * Look up a host name and return its IP address. + * + * Input parameters: + * hostname - host name to find + * ipaddr - buffer to place IP address + * + * Return value: + * 0 if no responses found + * >0 to indicate number of response records (usually 1) + * else error code + ********************************************************************* */ + +int dns_lookup(char *hostname,uint8_t *ipaddr) +{ + int s; + int nres = 0; + int retries; + char temphostname[100]; + uint8_t *server; + uint8_t *tok; + + /* + * If it's a valid IP address, don't look it up. + */ + + if (parseipaddr(hostname,ipaddr) == 0) return 1; + + /* + * Add default domain if no domain was specified + */ + + if (strchr(hostname,'.') == NULL) { + tok = net_getparam(NET_DOMAIN); + if (tok) { + xsprintf(temphostname,"%s.%s",hostname,tok); + hostname = temphostname; + } + } + + /* + * Figure out who the name server is + */ + + server = net_getparam(NET_NAMESERVER); + + if (!server) return CFE_ERR_NETDOWN; + if (ip_addriszero(server)) return CFE_ERR_NONAMESERVER; + + /* + * Go do the name server lookup + */ + + s = udp_socket(UDP_PORT_DNS); + if (s < 0) return CFE_ERR_NOHANDLES; + + for (retries = 0; retries < DNS_RETRY_COUNT; retries++) { + nres = dns_dolookup(s,server,hostname,ipaddr); + if (nres == CFE_ERR_TIMEOUT) continue; + if (nres >= 0) break; + } + + udp_close(s); + + return nres; + +} diff --git a/cfe/cfe/net/net_ebuf.h b/cfe/cfe/net/net_ebuf.h new file mode 100644 index 0000000..11d83c1 --- /dev/null +++ b/cfe/cfe/net/net_ebuf.h @@ -0,0 +1,165 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Network EBUF macros File: net_ebuf.h + * + * This file contains macros and function prototypes for + * messing with "ebuf" buffers. ebufs describe network + * packets. They're sort of like poor-man's mbufs :-) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + + +#define ENET_MAX_PKT 1514 +#define ENET_CRC_SIZE 4 +#define ENET_ADDR_LEN 6 +#define ENET_DIX_HEADER 14 + +/* ********************************************************************* + * Structures + ********************************************************************* */ + + +typedef struct ebuf_s { + queue_t eb_qblock; /* linkage */ + unsigned int eb_length; /* length of area at eb_ptr */ + unsigned int eb_status; /* rx/tx status */ + int eb_port; /* eth port that owns buffer */ + void *eb_device; /* underlying net device */ + int eb_usrdata; /* user-defined stuff */ + uint8_t *eb_usrptr; /* user-defined stuff */ + uint8_t *eb_ptr; /* current ptr within pkt */ + uint8_t eb_data[0x5F0]; /* data, must be > ENET_MAX_PKT */ + /* and divisible by sizeof(uint) */ +} ebuf_t; + +/* + * Macros to initialize ebufs + */ + +#define ebuf_init_rx(eb) (eb)->eb_ptr = (eb)->eb_data; \ + (eb)->eb_length = 0; \ + (eb)->eb_status = 0 + +#define ebuf_init_tx(eb) (eb)->eb_ptr = (eb)->eb_data; \ + (eb)->eb_length = 0; \ + (eb)->eb_status = 0 + +/* + * Macros to move the currens position within an ebuf + */ + +#define ebuf_prepend(eb,amt) (eb)->eb_ptr -= amt; (eb)->eb_length += (amt) +#define ebuf_adjust(eb,amt) (eb)->eb_ptr += (amt); (eb)->eb_length += (amt) +#define ebuf_seek(eb,amt) (eb)->eb_ptr += (amt) + +#define ebuf_remlen(eb) ((eb)->eb_length) +#define ebuf_length(eb) ((eb)->eb_length) +#define ebuf_ptr(eb) ((eb)->eb_ptr) +#define ebuf_setlength(eb,amt) (eb)->eb_length = (amt) + +/* + * ebuf_append_xxx macros - these macros add data to the + * end of a packet, adjusting the length + */ + +#define ebuf_append_u8(eb,b) ((eb)->eb_ptr[(eb)->eb_length++]) = (b) ; +#define ebuf_append_u16_be(eb,w) ebuf_append_u8(eb,((w) >> 8) & 0xFF) ; \ + ebuf_append_u8(eb,((w) & 0xFF)) + +#define ebuf_append_u32_be(eb,w) ebuf_append_u8(eb,((w) >> 24) & 0xFF) ; \ + ebuf_append_u8(eb,((w) >> 16) & 0xFF) ; \ + ebuf_append_u8(eb,((w) >> 8) & 0xFF) ; \ + ebuf_append_u8(eb,((w) & 0xFF)) + +#define ebuf_append_bytes(eb,b,l) memcpy(&((eb)->eb_ptr[(eb)->eb_length]),(b),(l)); \ + (eb)->eb_length += (l) + +/* + * ebuf_put_xxx macros - these macros modify data in the middle + * of a packet, typically in an area already allocated with + * ebuf_adjust. The length is not updated, but the pointer is. + */ + +#define ebuf_put_u8(eb,b) *((eb)->eb_ptr++) = (b) +#define ebuf_put_u16_be(eb,w) ebuf_put_u8(eb,((w) >> 8) & 0xFF) ; \ + ebuf_put_u8(eb,((w) & 0xFF)) + +#define ebuf_put_u32_be(eb,w) ebuf_put_u8(eb,((w) >> 24) & 0xFF) ; \ + ebuf_put_u8(eb,((w) >> 16) & 0xFF) ; \ + ebuf_put_u8(eb,((w) >> 8) & 0xFF) ; \ + ebuf_put_u8(eb,((w) & 0xFF)) + +#define ebuf_put_bytes(eb,b,l) memcpy((buf)->eb_ptr,(b),(l)) ; (buf)->eb_ptr += (l) + +#define ebuf_srcaddr(eb) &((eb)->eb_data[6]) +#define ebuf_destaddr(eb) &((eb)->eb_data[0]) + +/* return next byte from the ebuf, and advance pointer */ + +#define ebuf_skip(eb,amt) (eb)->eb_length -= (amt); (eb)->eb_ptr += (amt) + +#define ebuf_get_u8(eb,v) (eb)->eb_length--; \ + v = (*((eb)->eb_ptr++)) + +/* return next u16 from the ebuf, big-endian */ + +#define ebuf_get_u16_be(eb,v) (eb)->eb_ptr+=2; \ + (eb)->eb_length-=2; \ + v = ( ((uint16_t)*((eb)->eb_ptr-1)) | \ + (((uint16_t)*((eb)->eb_ptr-2)) << 8) ) + +/* return next u32 from the ebuf, big-endian */ + +#define ebuf_get_u32_be(eb,v) (eb)->eb_ptr+=4; \ + (eb)->eb_length-=4; \ + v = ( ((uint32_t)*((eb)->eb_ptr-1)) | \ + (((uint32_t)*((eb)->eb_ptr-2)) << 8) | \ + (((uint32_t)*((eb)->eb_ptr-3)) << 16) | \ + (((uint32_t)*((eb)->eb_ptr-4)) << 24) ) + +#define ebuf_get_bytes(eb,b,l) memcpy((b),(buf)->eb_ptr,(l)) ; (eb)->eb_ptr += (l) ; (eb)->eb_length -= (l) + + diff --git a/cfe/cfe/net/net_ether.c b/cfe/cfe/net/net_ether.c new file mode 100644 index 0000000..0dec6e8 --- /dev/null +++ b/cfe/cfe/net/net_ether.c @@ -0,0 +1,705 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Ethernet Datalink File: net_ether.c + * + * This module provides a simple datalink (LLC1) interface + * capable of demultiplexing standard DIX-style Ethernet packets. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_ioctl.h" +#include "cfe_error.h" + +#include "net_ebuf.h" +#include "net_ether.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define ETH_MAX_PORTS 4 +#define ETH_MAX_BUFFERS 8 + +/* ********************************************************************* + * Types + ********************************************************************* */ + +typedef struct ether_port_s { + int ep_dev; + uint8_t ep_proto[8]; + int ep_ptype; + int ep_mtu; + int (*ep_rxcallback)(ebuf_t *buf,void *ref); + void *ep_ref; +} ether_port_t; + +struct ether_info_s { + ether_port_t *eth_ports; + queue_t eth_freelist; + uint8_t eth_hwaddr[6]; + int eth_devhandle; + ebuf_t *eth_bufpool; +}; + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +const uint8_t eth_broadcast[ENET_ADDR_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; + + +/* ********************************************************************* + * eth_open(eth,ptye,pdata,cb) + * + * Open an Ethernet portal. + * + * Input parameters: + * eth - ethernet context + * ptype - protocol type (ETH_PTYPE_xxx) + * pdata - protocol data (two bytes for DIX protocols) + * cb - callback for receive packets + * + * Return value: + * portal number + * or <0 if error occured + ********************************************************************* */ + +int eth_open(ether_info_t *eth,int ptype,char *pdata, + int (*cb)(ebuf_t *buf,void *ref),void *ref) +{ + ether_port_t *p; + int portnum; + + p = eth->eth_ports; + + for (portnum = 0; portnum < ETH_MAX_PORTS; portnum++,p++) { + if (p->ep_rxcallback == NULL) break; + } + + if (portnum == ETH_MAX_PORTS) { + return CFE_ERR_NOHANDLES; /* no ports left */ + } + + switch (ptype) { + case ETH_PTYPE_DIX: + p->ep_proto[0] = pdata[0]; + p->ep_proto[1] = pdata[1]; + p->ep_mtu = ENET_MAX_PKT - ENET_DIX_HEADER; + break; + + case ETH_PTYPE_802SAP: + case ETH_PTYPE_802SNAP: + default: + /* + * we only support DIX etypes right now. If we ever want to support + * non-IP stacks (unlikely) this will need to change. + */ + return CFE_ERR_UNSUPPORTED; + } + + p->ep_ptype = ptype; + p->ep_rxcallback = cb; + p->ep_dev = eth->eth_devhandle; + p->ep_ref = ref; + + return portnum; +} + + +/* ********************************************************************* + * eth_close(eth,port) + * + * Close an Ethernet portal, freeing resources allocated to it. + * + * Input parameters: + * eth - ethernet context + * port - portal number + * + * Return value: + * nothing + ********************************************************************* */ + +void eth_close(ether_info_t *eth,int port) +{ + ether_port_t *p = &(eth->eth_ports[port]); + + p->ep_ptype = 0; + p->ep_rxcallback = NULL; + p->ep_dev = 0; + memset(&(p->ep_proto[0]),0,sizeof(p->ep_proto)); +} + + +/* ********************************************************************* + * eth_findport(eth,buf) + * + * Locate the portal associated with a particular Ethernet packet. + * Parse the packet enough to determine if it's addressed + * correctly and to a valid protocol, and then look up the + * corresponding portal. + * + * Input parameters: + * eth - ethernet context + * buf - ethernet buffer to check + * + * Return value: + * eth_port_t structure or NULL if packet should be dropped + ********************************************************************* */ + +static ether_port_t *eth_findport(ether_info_t *eth,ebuf_t *buf) +{ + int idx; + ether_port_t *p; + + /* + * A few pre-flight checks: packets *from* multicast addresses + * are not allowed. + */ + + if (buf->eb_ptr[6] & 1) return NULL; + + /* + * Packets smaller than minimum size are not allowed. + */ + + if (buf->eb_length < 60) return NULL; + + /* + * Packets with bad status are not allowed + */ + + /* XXX if (buf->eb_status != 0) return NULL; */ + + /* + * Okay, scan the port list and find the matching portal. + */ + + for (idx = 0, p = eth->eth_ports; idx < ETH_MAX_PORTS; idx++,p++) { + if (!p->ep_rxcallback) continue; /* port not in use */ + + switch (p->ep_ptype) { + case ETH_PTYPE_DIX: + if ((p->ep_proto[0] == buf->eb_ptr[12]) && + (p->ep_proto[1] == buf->eb_ptr[13])) { + ebuf_skip(buf,ENET_DIX_HEADER); + return p; + } + break; + case ETH_PTYPE_802SAP: + case ETH_PTYPE_802SNAP: + default: + break; + } + } + + return NULL; +} + +/* ********************************************************************* + * eth_poll(eth) + * + * Poll devices and process inbound packets. If new packets arrive, + * call the appropriate callback routine. + * + * Input parameters: + * eth - ethernet context + * + * Return value: + * nothing + ********************************************************************* */ + +void eth_poll(ether_info_t *eth) +{ + ebuf_t *buf; + ether_port_t *p; + int res; + + /* XXX should this loop until all packets are processed? */ + + /* + * If no packets, just get out now + */ + + if (cfe_inpstat(eth->eth_devhandle) == 0) return; + + /* + * get a packet from the free list + */ + + buf = (ebuf_t *) q_deqnext(&(eth->eth_freelist)); + if (!buf) return; + + /* + * Receive network data into the packet buffer + */ + + ebuf_init_rx(buf); + res = cfe_read(eth->eth_devhandle,buf->eb_ptr,ENET_MAX_PKT); + + /* + * if receive error, get out now. + */ + + if (res <= 0) { + q_enqueue(&(eth->eth_freelist),(queue_t *) buf); + return; + } + + /* + * init the rest of the fields in the ebuf + */ + + buf->eb_length = res; + buf->eb_status = 0; + buf->eb_device = eth; + buf->eb_usrdata = 0; + + /* + * Look up the portal to receive the new packet + */ + + p = eth_findport(eth,buf); + + /* + * Call the callback routine if we want to keep this + * buffer. Otherwise, drop it on the floor + */ + + if (p) { + buf->eb_port = p - eth->eth_ports; + res = (*(p->ep_rxcallback))(buf,p->ep_ref); + if (res == ETH_DROP) eth_free(buf); + } + else { + eth_free(buf); + } +} + + +/* ********************************************************************* + * eth_gethwaddr(eth,hwaddr) + * + * Obtain the hardware address of the Ethernet interface. + * + * Input parameters: + * eth - ethernet context + * hwaddr - place to put hardware address - 6 bytes + * + * Return value: + * nothing + ********************************************************************* */ + +void eth_gethwaddr(ether_info_t *eth,uint8_t *hwaddr) +{ + memcpy(hwaddr,eth->eth_hwaddr,ENET_ADDR_LEN); +} + +/* ********************************************************************* + * eth_sethwaddr(eth,hwaddr) + * + * Set the hardware address of the Ethernet interface. + * + * Input parameters: + * eth - ethernet context + * hwaddr - new hardware address - 6 bytes + * + * Return value: + * nothing + ********************************************************************* */ + +void eth_sethwaddr(ether_info_t *eth,uint8_t *hwaddr) +{ + int retlen; + + memcpy(eth->eth_hwaddr,hwaddr,ENET_ADDR_LEN); + cfe_ioctl(eth->eth_devhandle,IOCTL_ETHER_SETHWADDR,&(eth->eth_hwaddr[0]), + sizeof(eth->eth_hwaddr),&retlen,0); + +} + + + +/* ********************************************************************* + * eth_setspeed(eth,speed) + * + * Set the speed of the Ethernet interface. + * + * Input parameters: + * eth - ethernet context + * speed - target speed (or auto for automatic) + * + * Return value: + * nothing + ********************************************************************* */ + +int eth_setspeed(ether_info_t *eth,int speed) +{ + int retlen; + + return cfe_ioctl(eth->eth_devhandle,IOCTL_ETHER_SETSPEED, + (uint8_t *) &speed,sizeof(speed),&retlen,0); + +} + +/* ********************************************************************* + * eth_setloopback(eth,loop) + * + * Configure loopback mode options for the Ethernet + * + * Input parameters: + * eth - ethernet context + * loop - loopback mode to set + * + * Return value: + * nothing + ********************************************************************* */ + +int eth_setloopback(ether_info_t *eth,int loop) +{ + int retlen; + + return cfe_ioctl(eth->eth_devhandle,IOCTL_ETHER_SETLOOPBACK, + (uint8_t *) &loop,sizeof(loop),&retlen,0); + +} + +/* ********************************************************************* + * eth_getspeed(eth,speed) + * + * Get the current setting for the Ethernet speed (note that this + * is the speed we want to achieve, not the current speed) + * + * Input parameters: + * eth - ethernet context + * speed - pointer to int to receive speed + * + * Return value: + * nothing + ********************************************************************* */ + +int eth_getspeed(ether_info_t *eth,int *speed) +{ + int retlen; + + return cfe_ioctl(eth->eth_devhandle,IOCTL_ETHER_GETSPEED, + (uint8_t *) speed,sizeof(*speed),&retlen,0); + +} + +/* ********************************************************************* + * eth_getloopback(eth,loop) + * + * Read the loopback state of the Ethernet interface + * + * Input parameters: + * eth - ethernet context + * loop - pointer to int to receive loopback state + * + * Return value: + * nothing + ********************************************************************* */ + +int eth_getloopback(ether_info_t *eth,int *loop) +{ + int retlen; + + return cfe_ioctl(eth->eth_devhandle,IOCTL_ETHER_GETLOOPBACK, + (uint8_t *) loop,sizeof(*loop),&retlen,0); + +} + +/* ********************************************************************* + * eth_send(buf,dest) + * + * Transmit a packet. + * + * Input parameters: + * buf - ebuf structure describing packet + * dest - destination hardware address + * + * Return value: + * 0 - no error + * else error code + ********************************************************************* */ + +int eth_send(ebuf_t *buf,uint8_t *dest) +{ + ether_info_t *eth = buf->eb_device; + ether_port_t *p = &(eth->eth_ports[buf->eb_port]); + int res; + + switch (p->ep_ptype) { + case ETH_PTYPE_DIX: + ebuf_seek(buf,-ENET_DIX_HEADER); + ebuf_put_bytes(buf,dest,ENET_ADDR_LEN); + ebuf_put_bytes(buf,eth->eth_hwaddr,ENET_ADDR_LEN); + ebuf_put_bytes(buf,p->ep_proto,2); + /* adjust pointer and add in DIX header length */ + ebuf_prepend(buf,ENET_DIX_HEADER); + break; + case ETH_PTYPE_802SAP: + case ETH_PTYPE_802SNAP: + default: + eth_free(buf); /* should not happen */ + return CFE_ERR_UNSUPPORTED; + } + + res = cfe_write(p->ep_dev,ebuf_ptr(buf),ebuf_length(buf)); + + /* XXX - should we free buffers here? */ + + return res; +} + +/* ********************************************************************* + * eth_alloc(eth,port) + * + * Allocate an Ethernet buffer. Ethernet buffers know what + * ports they are associated with, since we need to reserve + * space for the EThernet header, which might vary in size + * for DIX, 802, etc. + * + * Input parameters: + * eth - ethernet context + * port - portal ID + * + * Return value: + * ebuf, or NULL if no ebufs left + ********************************************************************* */ + +ebuf_t *eth_alloc(ether_info_t *eth,int port) +{ + ebuf_t *buf; + ether_port_t *p = &(eth->eth_ports[port]); + + buf = (ebuf_t *) q_deqnext(&(eth->eth_freelist)); + if (buf == NULL) return NULL; + + buf->eb_status = 0; + buf->eb_port = port; + buf->eb_device = eth; + ebuf_init_tx(buf); + + switch (p->ep_ptype) { + case ETH_PTYPE_NONE: + break; + case ETH_PTYPE_DIX: + ebuf_seek(buf,ENET_DIX_HEADER); + break; + case ETH_PTYPE_802SAP: + case ETH_PTYPE_802SNAP: + default: + /* XXX Other ether types here */ + break; + } + + /* + * 'eb_ptr' points at new data, length is cleared. + * We will add the length back in at send time when the + * ethernet header is filled in. + */ + buf->eb_length = 0; + + return buf; +} + +/* ********************************************************************* + * eth_free(buf) + * + * Free an ebuf. + * + * Input parameters: + * buf - ebuf to free + * + * Return value: + * nothing + ********************************************************************* */ + +void eth_free(ebuf_t *buf) +{ + ether_info_t *eth = buf->eb_device; + + q_enqueue(&(eth->eth_freelist),(queue_t *) buf); +} + + +/* ********************************************************************* + * eth_getmtu(eth,port) + * + * Return the mtu of the specified Ethernet port. The mtu + * is the maximum number of bytes you can put in the buffer, + * excluding the Ethernet header. + * + * Input parameters: + * eth - ethernet context + * port - portal ID + * + * Return value: + * number of bytes + ********************************************************************* */ + + +int eth_getmtu(ether_info_t *eth,int port) +{ + ether_port_t *p = &(eth->eth_ports[port]); + + return p->ep_mtu; +} + + +/* ********************************************************************* + * eth_init(devname) + * + * Create an Ethernet context for a particular Ethernet device. + * + * Input parameters: + * devname - device name for underlying Ethernet driver + * + * Return value: + * ethernet context, or NULL of it could not be created. + ********************************************************************* */ + +ether_info_t *eth_init(char *devname) +{ + int idx; + ebuf_t *buf; + ether_info_t *eth; + int devhandle; + int retlen; + + /* + * Open the device driver + */ + + devhandle = cfe_open(devname); + if (devhandle < 0) return NULL; + + eth = KMALLOC(sizeof(ether_info_t),0); + if (!eth) { + cfe_close(devhandle); + return NULL; + } + + memset(eth,0,sizeof(ether_info_t)); + + /* + * Obtain hardware address + */ + + cfe_ioctl(devhandle,IOCTL_ETHER_GETHWADDR,&(eth->eth_hwaddr[0]), + sizeof(eth->eth_hwaddr),&retlen,0); + + /* + * Allocate portal table + */ + + eth->eth_ports = KMALLOC(ETH_MAX_PORTS*sizeof(ether_port_t),0); + if (!eth->eth_ports) { + cfe_close(devhandle); + KFREE(eth); + return NULL; + } + + memset(eth->eth_ports,0,ETH_MAX_PORTS*sizeof(ether_port_t)); + + /* + * Allocate buffer pool + */ + + eth->eth_bufpool = (ebuf_t *) KMALLOC(sizeof(ebuf_t)*ETH_MAX_BUFFERS,0); + if (!eth->eth_bufpool) { + cfe_close(devhandle); + KFREE(eth->eth_ports); + KFREE(eth); + return NULL; + } + + /* + * Chain buffers onto the free list + */ + + q_init(&(eth->eth_freelist)); + buf = eth->eth_bufpool; + for (idx = 0; idx < ETH_MAX_BUFFERS; idx++) { + q_enqueue(&(eth->eth_freelist),(queue_t *) buf); + buf++; + } + + /* + * Remember the device handle + */ + + eth->eth_devhandle = devhandle; + + return eth; +} + + +/* ********************************************************************* + * eth_uninit(eth) + * + * Close and free up an Ethernet context + * + * Input parameters: + * eth - ethernet context + * + * Return value: + * nothing + ********************************************************************* */ + +void eth_uninit(ether_info_t *eth) +{ + cfe_close(eth->eth_devhandle); + KFREE(eth->eth_bufpool); + KFREE(eth->eth_ports); + KFREE(eth); +} + + diff --git a/cfe/cfe/net/net_ether.h b/cfe/cfe/net/net_ether.h new file mode 100644 index 0000000..a94130b --- /dev/null +++ b/cfe/cfe/net/net_ether.h @@ -0,0 +1,89 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Ethernet protocol demux defns File: net_ether.h + * + * constants and prototypes for the Ethernet datalink + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define ETH_PTYPE_NONE 0 +#define ETH_PTYPE_DIX 1 +#define ETH_PTYPE_802SAP 2 +#define ETH_PTYPE_802SNAP 3 + +#define ETH_KEEP 1 +#define ETH_DROP 0 + +/* ********************************************************************* + * types + ********************************************************************* */ + +typedef struct ether_info_s ether_info_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int eth_open(ether_info_t *eth,int ptype,char *pdata,int (*cb)(ebuf_t *buf,void *ref),void *ref); +void eth_close(ether_info_t *eth,int port); +void eth_poll(ether_info_t *eth); +int eth_send(ebuf_t *buf,uint8_t *dest); +ebuf_t *eth_alloc(ether_info_t *eth,int port); +void eth_free(ebuf_t *buf); +ether_info_t *eth_init(char *devname); +void eth_uninit(ether_info_t *eth); +int eth_getmtu(ether_info_t *,int port); +void eth_gethwaddr(ether_info_t *,uint8_t *hwaddr); +void eth_sethwaddr(ether_info_t *,uint8_t *hwaddr); +int eth_getspeed(ether_info_t *,int *speed); +int eth_setspeed(ether_info_t *,int speed); +int eth_getloopback(ether_info_t *,int *loop); +int eth_setloopback(ether_info_t *,int loop); +extern const uint8_t eth_broadcast[ENET_ADDR_LEN]; + + + diff --git a/cfe/cfe/net/net_icmp.c b/cfe/cfe/net/net_icmp.c new file mode 100644 index 0000000..e98bc87 --- /dev/null +++ b/cfe/cfe/net/net_icmp.c @@ -0,0 +1,312 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * ICMP Protocol File: net_icmp.c + * + * This module implements portions of the ICMP protocol. Note + * that it is not a complete implementation, just enough to + * generate and respond to ICMP echo requests. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_timer.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_ip.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define ICMP_CODE_ECHO 0 +#define ICMP_TYPE_ECHOREPLY 0 +#define ICMP_TYPE_ECHOREQ 8 + +#define ICMPMSG(type,code) (((type)<<8)|(code)) + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +struct icmp_info_s { + ip_info_t *icmp_ipinfo; + queue_t icmp_echoreplies; + int icmp_maxreplies; +}; + +/* ********************************************************************* + * ICMP_RX_CALLBACK(ref,buf,dst,src) + * + * This routine is called by the IP layer when we receive + * ICMP protocol messages. + * + * Input parameters: + * ref - reference data (an icmp_info_t) + * buf - the ebuf containing the buffer + * dst - destination IP address (us, usually) + * src - source IP address + * + * Return value: + * ETH_KEEP to keep packet, ETH_DROP to cause packet to be freed + ********************************************************************* */ + +static int icmp_rx_callback(void *ref,ebuf_t *buf,uint8_t *dst,uint8_t *src) +{ + icmp_info_t *icmp = (icmp_info_t *)ref; + ip_info_t *ipi = icmp->icmp_ipinfo; + uint16_t imsg; + uint16_t cksum; + ebuf_t *txbuf; + uint8_t *icmphdr; + int res; + + imsg = ICMPMSG(buf->eb_ptr[0],buf->eb_ptr[1]); + + res = ETH_DROP; /* assume we're dropping the pkt */ + + switch (imsg) { + case ICMPMSG(ICMP_TYPE_ECHOREQ,ICMP_CODE_ECHO): + txbuf = _ip_alloc(ipi); + if (txbuf) { + /* Construct reply from the original packet. */ + icmphdr = txbuf->eb_ptr; + ebuf_append_bytes(txbuf,buf->eb_ptr,buf->eb_length); + icmphdr[0] = ICMP_TYPE_ECHOREPLY; + icmphdr[1] = ICMP_CODE_ECHO; + icmphdr[2] = 0; icmphdr[3] = 0; + cksum = ~ip_chksum(0,icmphdr,ebuf_length(txbuf)); + icmphdr[2] = (cksum >> 8) & 0xFF; + icmphdr[3] = (cksum & 0xFF); + if (_ip_send(ipi,txbuf,src,IPPROTO_ICMP) < 0) { + _ip_free(ipi,txbuf); + } + } + break; + + case ICMPMSG(ICMP_TYPE_ECHOREPLY,ICMP_CODE_ECHO): + if (q_count(&(icmp->icmp_echoreplies)) < icmp->icmp_maxreplies) { + /* We're keeping this packet, put it on the queue and don't + free it in the driver. */ + q_enqueue(&(icmp->icmp_echoreplies),(queue_t *) buf); + res = ETH_KEEP; + } + break; + + default: + res = ETH_DROP; + } + + return res; +} + + +/* ********************************************************************* + * _ICMP_INIT(ipi) + * + * Initialize the ICMP layer. + * + * Input parameters: + * ipi - ipinfo structure of IP layer to attach to + * + * Return value: + * icmp_info_t structure or NULL if error occurs + ********************************************************************* */ + +icmp_info_t *_icmp_init(ip_info_t *ipi) +{ + icmp_info_t *icmp; + + icmp = (icmp_info_t *) KMALLOC(sizeof(icmp_info_t),0); + if (!icmp) return NULL; + + icmp->icmp_ipinfo = ipi; + q_init(&(icmp->icmp_echoreplies)); + icmp->icmp_maxreplies = 0; + + _ip_register(ipi,IPPROTO_ICMP,icmp_rx_callback,icmp); + + return icmp; +} + +/* ********************************************************************* + * _ICMP_UNINIT(icmp) + * + * Un-initialize the ICMP layer. + * + * Input parameters: + * icmp - icmp_info_t structure + * + * Return value: + * nothing + ********************************************************************* */ + +void _icmp_uninit(icmp_info_t *icmp) +{ + _ip_deregister(icmp->icmp_ipinfo,IPPROTO_ICMP); + + KFREE(icmp); +} + + +/* ********************************************************************* + * _ICMP_PING(icmp,dest,seq,len) + * + * Transmit an ICMP echo request and wait for a reply. + * + * Input parameters: + * icmp - icmp_info_t structure + * dest - destination IP address + * seq - sequence number for ICMP packet + * len - length of data portion of ICMP packet + * + * Return value: + * <0 = error + * 0 = timeout + * >0 = reply received + ********************************************************************* */ + +int _icmp_ping(icmp_info_t *icmp,uint8_t *dest,int seq,int len) +{ + ebuf_t *buf; + int64_t timer; + uint16_t cksum; + uint8_t *icmphdr; + uint16_t id; + int idx; + int result = 0; + + /* + * Get an ebuf + */ + + buf = _ip_alloc(icmp->icmp_ipinfo); + if (buf == NULL) return -1; + + /* + * Remember where the ICMP header is going to be so we can + * calculate the checksum later. + */ + + icmphdr = buf->eb_ptr; + + id = (uint16_t) cfe_ticks; + + /* + * Construct the ICMP header and data portion. + */ + + ebuf_append_u8(buf,8); /* echo message */ + ebuf_append_u8(buf,0); /* code = 0 */ + ebuf_append_u16_be(buf,0); /* empty checksum for now */ + ebuf_append_u16_be(buf,id); /* packet ID */ + ebuf_append_u16_be(buf,((uint16_t)seq)); /* sequence # */ + + for (idx = 0; idx < len; idx++) { + ebuf_append_u8(buf,((idx+0x40)&0xFF)); /* data */ + } + + /* + * Calculate and install the checksum + */ + + cksum = ~ip_chksum(0,icmphdr,ebuf_length(buf)); + icmphdr[2] = (cksum >> 8) & 0xFF; + icmphdr[3] = (cksum & 0xFF); + + /* + * Transmit the ICMP echo + */ + + icmp->icmp_maxreplies = 1; /* allow ICMP replies */ + _ip_send(icmp->icmp_ipinfo,buf,dest,IPPROTO_ICMP); + buf = NULL; + + /* + * Wait for a reply + */ + + TIMER_SET(timer,2*CFE_HZ); + + while (!TIMER_EXPIRED(timer)) { + + POLL(); + buf = (ebuf_t *) q_deqnext(&(icmp->icmp_echoreplies)); + + /* If we get a packet, make sure it matches. */ + + if (buf) { + uint16_t rxid,rxseq; + + cksum = ip_chksum(0,buf->eb_ptr,ebuf_length(buf)); + if (cksum == 0xFFFF) { + ebuf_skip(buf,2); + ebuf_skip(buf,2); /* skip checksum */ + ebuf_get_u16_be(buf,rxid); + ebuf_get_u16_be(buf,rxseq); + + if ((id == rxid) && ((uint16_t) seq == rxseq)) { + result = 1; + break; + } + } + _ip_free(icmp->icmp_ipinfo,buf); + } + } + + /* + * Don't accept any more replies. + */ + + icmp->icmp_maxreplies = 0; /* allow ICMP replies */ + + if (buf) _ip_free(icmp->icmp_ipinfo,buf); + + return result; + +} diff --git a/cfe/cfe/net/net_ip.c b/cfe/cfe/net/net_ip.c new file mode 100755 index 0000000..86303e2 --- /dev/null +++ b/cfe/cfe/net/net_ip.c @@ -0,0 +1,722 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Internet Protocol File: net_ip.c + * + * This module implements the IP layer (RFC791) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_ip.h" +#include "net_ip_internal.h" + +#include "cfe_error.h" + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + +static int ip_rx_callback(ebuf_t *buf,void *ref); + +/* ********************************************************************* + * _ip_alloc(ipi) + * + * Allocate an ebuf and reserve space for the IP header in it. + * + * Input parameters: + * ipi - IP stack information + * + * Return value: + * ebuf - an ebuf, or NULL if there are none left + ********************************************************************* */ + +ebuf_t *_ip_alloc(ip_info_t *ipi) +{ + ebuf_t *buf; + + buf = eth_alloc(ipi->eth_info,ipi->ip_port); + + if (buf == NULL) return buf; + + ebuf_seek(buf,IPHDR_LENGTH); + ebuf_setlength(buf,0); + + return buf; +} + + +/* ********************************************************************* + * ip_chksum(initcksum,ptr,len) + * + * Do an IP checksum for the specified buffer. You can pass + * an initial checksum if you're continuing a previous checksum + * calculation, such as for UDP headers and pseudoheaders. + * + * Input parameters: + * initcksum - initial checksum (usually zero) + * ptr - pointer to buffer to checksum + * len - length of data in bytes + * + * Return value: + * checksum (16 bits) + ********************************************************************* */ + +uint16_t ip_chksum(uint16_t initcksum,uint8_t *ptr,int len) +{ + unsigned int cksum; + int idx; + int odd; + + cksum = (unsigned int) initcksum; + + odd = len & 1; + len -= odd; + + for (idx = 0; idx < len; idx += 2) { + cksum += ((unsigned long) ptr[idx] << 8) + ((unsigned long) ptr[idx+1]); + } + + if (odd) { /* buffer is odd length */ + cksum += ((unsigned long) ptr[idx] << 8); + } + + /* + * Fold in the carries + */ + + while (cksum >> 16) { + cksum = (cksum & 0xFFFF) + (cksum >> 16); + } + + return cksum; +} + + +/* ********************************************************************* + * _ip_send(ipi,buf,destaddr,proto) + * + * Send an IP datagram. We only support non-fragmented datagrams + * at this time. + * + * Input parameters: + * ipi - IP stack information + * buf - an ebuf + * destaddr - destination IP address + * proto - IP protocol number + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _ip_send(ip_info_t *ipi,ebuf_t *buf,uint8_t *destaddr,uint8_t proto) +{ + uint16_t cksum; + uint8_t masksrc[IP_ADDR_LEN]; + uint8_t maskdest[IP_ADDR_LEN]; + int pktlen; + uint8_t *ptr; + + /* Move to the beginning of the IP hdeader */ + + ebuf_seek(buf,-IPHDR_LENGTH); + + pktlen = ebuf_length(buf) + IPHDR_LENGTH; + + ipi->ip_id++; + + /* Insert the IP header */ + + ebuf_put_u8(buf,IPHDR_VER_4 | IPHDR_LEN_20); + ebuf_put_u8(buf,IPHDR_TOS_DEFAULT); + ebuf_put_u16_be(buf,pktlen); + ebuf_put_u16_be(buf,ipi->ip_id); + ebuf_put_u16_be(buf,0); + ebuf_put_u8(buf,IPHDR_TTL_DEFAULT); + ebuf_put_u8(buf,proto); + ebuf_put_u16_be(buf,0); /* checksum */ + ebuf_put_bytes(buf,ipi->net_info.ip_addr,IP_ADDR_LEN); + ebuf_put_bytes(buf,destaddr,IP_ADDR_LEN); + + /* adjust pointer and add in the header length */ + + ebuf_prepend(buf,IPHDR_LENGTH); + + /* Checksum the header */ + + ptr = ebuf_ptr(buf); + cksum = ip_chksum(0,ptr,IPHDR_LENGTH); + cksum = ~cksum; + ptr[10] = (cksum >> 8) & 0xFF; + ptr[11] = (cksum >> 0) & 0xFF; + + /* + * If sending to the IP broadcast address, + * send to local broadcast. + */ + + if (ip_addrisbcast(destaddr)) { + eth_send(buf,(uint8_t *) eth_broadcast); + eth_free(buf); + return 0; + } + + /* + * If the mask has not been set, don't try to + * determine if we should use the gateway or not. + */ + + if (ip_addriszero(ipi->net_info.ip_netmask)) { + return _arp_lookup_and_send(ipi,buf,destaddr); + } + + /* + * Compute (dest-addr & netmask) and (my-addr & netmask) + */ + + ip_mask(masksrc,destaddr,ipi->net_info.ip_netmask); + ip_mask(maskdest,ipi->net_info.ip_addr,ipi->net_info.ip_netmask); + + /* + * if destination and my address are on the same subnet, + * send the packet directly. Otherwise, send via + * the gateway. + */ + + if (ip_compareaddr(masksrc,maskdest) == 0) { + return _arp_lookup_and_send(ipi,buf,destaddr); + } + else { + /* if no gw configured, drop packet */ + if (ip_addriszero(ipi->net_info.ip_gateway)) { + eth_free(buf); /* silently drop */ + return 0; + } + else { + return _arp_lookup_and_send(ipi,buf,ipi->net_info.ip_gateway); + } + } + +} + + +/* ********************************************************************* + * ip_rx_callback(buf,ref) + * + * Receive callback for IP packets. This routine is called + * by the Ethernet datalink. We look up a suitable protocol + * handler and pass the packet off. + * + * Input parameters: + * buf - ebuf we received + * ref - reference data from the ethernet datalink + * + * Return value: + * ETH_KEEP to keep the packet + * ETH_DROP to drop the packet + ********************************************************************* */ + +static int ip_rx_callback(ebuf_t *buf,void *ref) +{ + ip_info_t *ipi = ref; + uint8_t tmp; + int hdrlen; + uint8_t *hdr; + uint16_t origchksum; + uint16_t calcchksum; + uint16_t length; + uint16_t tmp16; + uint8_t proto; + uint8_t srcip[IP_ADDR_LEN]; + uint8_t dstip[IP_ADDR_LEN]; + ip_protodisp_t *pdisp; + int res; + int idx; + + hdr = ebuf_ptr(buf); /* save current posn */ + + ebuf_get_u8(buf,tmp); /* version and header length */ + + /* + * Check IP version + */ + + if ((tmp & 0xF0) != IPHDR_VER_4) { + goto drop; /* not IPV4 */ + } + hdrlen = (tmp & 0x0F) * 4; + + /* + * Check header size + */ + + if (hdrlen < IPHDR_LENGTH) { + goto drop; /* header < 20 bytes */ + } + + /* + * Check the checksum + */ + origchksum = ((uint16_t) hdr[10] << 8) | (uint16_t) hdr[11]; + hdr[10] = hdr[11] = 0; + calcchksum = ~ip_chksum(0,hdr,hdrlen); + if (calcchksum != origchksum) { + goto drop; + } + + /* + * Okay, now go back and check other fields. + */ + + ebuf_skip(buf,1); /* skip TOS field */ + + ebuf_get_u16_be(buf,length); + ebuf_skip(buf,2); /* skip ID field */ + + ebuf_get_u16_be(buf,tmp16); /* get Fragment Offset field */ + + /* + * If the fragment offset field is nonzero, or the + * "more fragments" bit is set, then this is a packet + * fragment. Our trivial IP implementation does not + * deal with fragments, so drop the packets. + */ + if ((tmp16 & (IPHDR_FRAGOFFSET | IPHDR_MOREFRAGMENTS)) != 0) { + goto drop; /* packet is fragmented */ + } + + ebuf_skip(buf,1); /* skip TTL */ + ebuf_get_u8(buf,proto); /* get protocol */ + ebuf_skip(buf,2); /* skip checksum */ + + ebuf_get_bytes(buf,srcip,IP_ADDR_LEN); + ebuf_get_bytes(buf,dstip,IP_ADDR_LEN); + + ebuf_skip(buf,hdrlen-IPHDR_LENGTH); /* skip rest of header */ + + ebuf_setlength(buf,length-hdrlen); /* set length to just data portion */ + + /* + * If our address is not set, let anybody in. We need this to + * properly pass up DHCP replies that get forwarde through routers. + * Otherwise, only let in matching addresses or broadcasts. + */ + + if (!ip_addriszero(ipi->net_info.ip_addr)) { + if ((ip_compareaddr(dstip,ipi->net_info.ip_addr) != 0) && + !(ip_addrisbcast(dstip))) { + goto drop; /* not for us */ + } + } + + /* + * ebuf's pointer now starts at beginning of protocol data + */ + + /* + * Find matching protocol dispatch + */ + + pdisp = ipi->ip_protocols; + res = ETH_DROP; + for (idx = 0; idx < IP_MAX_PROTOCOLS; idx++) { + if (pdisp->cb && (pdisp->protocol == proto)) { + res = (*(pdisp->cb))(pdisp->ref,buf,dstip,srcip); + break; + } + pdisp++; + } + + + return res; + +drop: + return ETH_DROP; +} + + +/* ********************************************************************* + * _ip_init(eth) + * + * Initialize the IP layer, attaching it to an underlying Ethernet + * datalink interface. + * + * Input parameters: + * eth - Ethernet datalink information + * + * Return value: + * ip_info pointer (IP stack information) or NULL if error + ********************************************************************* */ + +ip_info_t *_ip_init(ether_info_t *eth) +{ + ip_info_t *ipi; + int8_t ipproto[2]; + + /* + * Allocate IP stack info + */ + + ipi = KMALLOC(sizeof(ip_info_t),0); + if (ipi == NULL) return NULL; + + memset(ipi,0,sizeof(ip_info_t)); + + ipi->eth_info = eth; + + /* + * Initialize ARP + */ + + if (_arp_init(ipi) < 0) { + KFREE(ipi); + return NULL; + } + + /* + * Open the Ethernet portal for IP packets + */ + + ipproto[0] = (PROTOSPACE_IP >> 8) & 0xFF; ipproto[1] = PROTOSPACE_IP & 0xFF; + ipi->ip_port = eth_open(ipi->eth_info,ETH_PTYPE_DIX,ipproto,ip_rx_callback,ipi); + + if (ipi->ip_port < 0) { + _arp_uninit(ipi); + KFREE(ipi); + return NULL; + } + + return ipi; +} + + +/* ********************************************************************* + * _ip_uninit(ipi) + * + * Un-initialize the IP layer, freeing resources + * + * Input parameters: + * ipi - IP stack information + * + * Return value: + * nothing + ********************************************************************* */ + +void _ip_uninit(ip_info_t *ipi) +{ + /* + * Close the IP portal + */ + + eth_close(ipi->eth_info,ipi->ip_port); + + /* + * Turn off the ARP layer. + */ + + _arp_uninit(ipi); + + + /* + * free strings containing the domain and host names + */ + + if (ipi->net_info.ip_domain) { + KFREE(ipi->net_info.ip_domain); + } + + if (ipi->net_info.ip_hostname) { + KFREE(ipi->net_info.ip_hostname); + } + + /* + * Free the stack information + */ + + KFREE(ipi); +} + + +/* ********************************************************************* + * _ip_timer_tick(ipi) + * + * Called once per second while the IP stack is active. + * + * Input parameters: + * ipi - ip stack information + * + * Return value: + * nothing + ********************************************************************* */ + + +void _ip_timer_tick(ip_info_t *ipi) +{ + _arp_timer_tick(ipi); +} + + +/* ********************************************************************* + * _ip_free(ipi,buf) + * + * Free an ebuf allocated via _ip_alloc + * + * Input parameters: + * ipi - IP stack information + * buf - ebuf to free + * + * Return value: + * nothing + ********************************************************************* */ + +void _ip_free(ip_info_t *ipi,ebuf_t *buf) +{ + eth_free(buf); +} + +/* ********************************************************************* + * _ip_getaddr(ipi,buf) + * + * Return our IP address (is this used?) + * + * Input parameters: + * ipi - IP stack information + * buf - pointer to 4-byte buffer to receive IP address + * + * Return value: + * nothing + ********************************************************************* */ + +void _ip_getaddr(ip_info_t *ipi,uint8_t *buf) +{ + memcpy(buf,ipi->net_info.ip_addr,IP_ADDR_LEN); +} + +/* ********************************************************************* + * _ip_getparam(ipi,param) + * + * Return the value of an IP parameter (address, netmask, etc.). + * The return value may need to be coerced if it's not normally + * a uint8_t* pointer. + * + * Input parameters: + * ipi - IP stack information + * param - parameter number + * + * Return value: + * parameter value, or NULL if the parameter is invalid or + * not set. + ********************************************************************* */ + +uint8_t *_ip_getparam(ip_info_t *ipinfo,int param) +{ + uint8_t *ret = NULL; + + switch (param) { + case NET_IPADDR: + ret = ipinfo->net_info.ip_addr; + break; + case NET_NETMASK: + ret = ipinfo->net_info.ip_netmask; + break; + case NET_GATEWAY: + ret = ipinfo->net_info.ip_gateway; + break; + case NET_NAMESERVER: + ret = ipinfo->net_info.ip_nameserver; + break; + case NET_HWADDR: + ret = ipinfo->arp_hwaddr; + break; + case NET_DOMAIN: + ret = ipinfo->net_info.ip_domain; + break; + case NET_HOSTNAME: + ret = ipinfo->net_info.ip_hostname; + break; + case NET_SPEED: + return NULL; + break; + case NET_LOOPBACK: + return NULL; + break; + } + + return ret; +} + +/* ********************************************************************* + * _ip_getparam(ipi,param,value) + * + * Set the value of an IP parameter (address, netmask, etc.). + * The value may need to be coerced if it's not normally + * a uint8_t* pointer. + * + * Input parameters: + * ipi - IP stack information + * param - parameter number + * value - parameter's new value + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int _ip_setparam(ip_info_t *ipinfo,int param,uint8_t *ptr) +{ + int res = -1; + + switch (param) { + case NET_IPADDR: + memcpy(ipinfo->net_info.ip_addr,ptr,IP_ADDR_LEN); + _arp_send_gratuitous(ipinfo); + res = 0; + break; + case NET_NETMASK: + memcpy(ipinfo->net_info.ip_netmask,ptr,IP_ADDR_LEN); + res = 0; + break; + case NET_GATEWAY: + memcpy(ipinfo->net_info.ip_gateway,ptr,IP_ADDR_LEN); + res = 0; + break; + case NET_NAMESERVER: + memcpy(ipinfo->net_info.ip_nameserver,ptr,IP_ADDR_LEN); + res = 0; + break; + case NET_DOMAIN: + if (ipinfo->net_info.ip_domain) { + KFREE(ipinfo->net_info.ip_domain); + ipinfo->net_info.ip_domain = NULL; + } + if (ptr) ipinfo->net_info.ip_domain = (uint8_t*)strdup((char *) ptr); + break; + case NET_HOSTNAME: + if (ipinfo->net_info.ip_hostname) { + KFREE(ipinfo->net_info.ip_hostname); + ipinfo->net_info.ip_hostname = NULL; + } + if (ptr) ipinfo->net_info.ip_hostname = (uint8_t*)strdup((char *) ptr); + break; + case NET_HWADDR: + memcpy(ipinfo->arp_hwaddr,ptr,ENET_ADDR_LEN); + eth_sethwaddr(ipinfo->eth_info,ptr); + res = 0; + break; + case NET_SPEED: + res = eth_setspeed(ipinfo->eth_info,*(int *)ptr); + break; + case NET_LOOPBACK: + res = eth_setloopback(ipinfo->eth_info,*(int *)ptr); + break; + } + + return res; +} + +/* ********************************************************************* + * _ip_register(ipinfo,proto,cb) + * + * Register a protocol handler with the IP layer. IP client + * protocols such as UDP, ICMP, etc. call this to register their + * callbacks. + * + * Input parameters: + * ipinfo - IP stack information + * proto - IP protocol number + * cb - callback routine to register + * + * Return value: + * nothing + ********************************************************************* */ + +void _ip_register(ip_info_t *ipinfo, + int proto, + int (*cb)(void *ref,ebuf_t *buf,uint8_t *dst,uint8_t *src),void *ref) +{ + int idx; + + for (idx = 0; idx < IP_MAX_PROTOCOLS; idx++) { + if (ipinfo->ip_protocols[idx].cb == NULL) break; + } + + if (idx == IP_MAX_PROTOCOLS) return; + + ipinfo->ip_protocols[idx].protocol = (uint8_t) proto; + ipinfo->ip_protocols[idx].cb = cb; + ipinfo->ip_protocols[idx].ref = ref; +} + + +/* ********************************************************************* + * _ip_deregister(ipinfo,proto) + * + * Deregister an IP protocol. + * + * Input parameters: + * ipinfo - IP stack information + * proto - protocol number + * + * Return value: + * nothing + ********************************************************************* */ + +void _ip_deregister(ip_info_t *ipinfo,int proto) +{ + int idx; + + for (idx = 0; idx < IP_MAX_PROTOCOLS; idx++) { + if (ipinfo->ip_protocols[idx].protocol == (uint8_t) proto) { + ipinfo->ip_protocols[idx].protocol = 0; + ipinfo->ip_protocols[idx].ref = 0; + ipinfo->ip_protocols[idx].cb = NULL; + } + } +} + diff --git a/cfe/cfe/net/net_ip.h b/cfe/cfe/net/net_ip.h new file mode 100755 index 0000000..7b1b4be --- /dev/null +++ b/cfe/cfe/net/net_ip.h @@ -0,0 +1,159 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IP Protocol Definitions File: net_ip.h + * + * This is the main include file for the CFE network stack. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +/* ********************************************************************* + * Global info + ********************************************************************* */ + +#ifndef IP_ADDR_LEN +#define IP_ADDR_LEN 4 +#endif + +typedef struct ip_info_s ip_info_t; + +typedef struct net_info_s { + /* Configuration info for IP interface */ + uint8_t ip_addr[IP_ADDR_LEN]; + uint8_t ip_netmask[IP_ADDR_LEN]; + uint8_t ip_gateway[IP_ADDR_LEN]; + uint8_t ip_nameserver[IP_ADDR_LEN]; + uint8_t *ip_domain; + uint8_t *ip_hostname; +} net_info_t; + +/* ********************************************************************* + * ARP Information + ********************************************************************* */ + +int _arp_lookup_and_send(ip_info_t *ipi,ebuf_t *buf,uint8_t *dest); +void _arp_timer_tick(ip_info_t *ipi); +int _arp_init(ip_info_t *ipi); +void _arp_uninit(ip_info_t *ipi); +void _arp_add(ip_info_t *ipi,uint8_t *destip,uint8_t *desthw); +void _arp_send_gratuitous(ip_info_t *ipi); +uint8_t *_arp_lookup(ip_info_t *ipi,uint8_t *destip); +int _arp_enumerate(ip_info_t *ipi,int entrynum,uint8_t *ipaddr,uint8_t *hwaddr); +int _arp_delete(ip_info_t *ipi,uint8_t *ipaddr); + + +/* ********************************************************************* + * IP protocol + ********************************************************************* */ + + +#define IPPROTO_TCP 6 +#define IPPROTO_UDP 17 +#define IPPROTO_ICMP 1 + +int _ip_send(ip_info_t *ipi,ebuf_t *buf,uint8_t *destaddr,uint8_t proto); +ip_info_t *_ip_init(ether_info_t *); +void _ip_timer_tick(ip_info_t *ipi); +void _ip_uninit(ip_info_t *ipi); +ebuf_t *_ip_alloc(ip_info_t *ipi); +void _ip_free(ip_info_t *ipi,ebuf_t *buf); +void _ip_getaddr(ip_info_t *ipi,uint8_t *buf); +uint8_t *_ip_getparam(ip_info_t *ipinfo,int param); +int _ip_setparam(ip_info_t *ipinfo,int param,uint8_t *ptr); +uint16_t ip_chksum(uint16_t initcksum,uint8_t *ptr,int len); +void _ip_deregister(ip_info_t *ipinfo,int proto); +void _ip_register(ip_info_t *ipinfo, + int proto, + int (*cb)(void *ref,ebuf_t *buf,uint8_t *dst,uint8_t *src),void *ref); + + +#define ip_mask(dest,a,b) (dest)[0] = (a)[0] & (b)[0] ; \ + (dest)[1] = (a)[1] & (b)[1] ; \ + (dest)[2] = (a)[2] & (b)[2] ; \ + (dest)[3] = (a)[3] & (b)[3] + +#define ip_compareaddr(a,b) memcmp(a,b,IP_ADDR_LEN) + +#define ip_addriszero(a) (((a)[0]|(a)[1]|(a)[2]|(a)[3]) == 0) +#define ip_addrisbcast(a) ((a[0] == 0xFF) && (a[1] == 0xFF) && (a[2] == 0xFF) && (a[3] == 0xFF)) + +#ifndef NET_IPADDR +#define NET_IPADDR 0 +#define NET_NETMASK 1 +#define NET_GATEWAY 2 +#define NET_NAMESERVER 3 +#define NET_HWADDR 4 +#define NET_DOMAIN 5 +#define NET_HOSTNAME 6 +#define NET_SPEED 7 +#define NET_LOOPBACK 8 +#endif + +/* ********************************************************************* + * UDP Protocol + ********************************************************************* */ + +typedef struct udp_info_s udp_info_t; + +int _udp_socket(udp_info_t *info,uint16_t port); +void _udp_close(udp_info_t *info,int s); +int _udp_send(udp_info_t *info,int s,ebuf_t *buf,uint8_t *dest); +udp_info_t *_udp_init(ip_info_t *ipi,void *ref); +void _udp_uninit(udp_info_t *info); +int _udp_bind(udp_info_t *info,int s,uint16_t port); +int _udp_connect(udp_info_t *info,int s,uint16_t port); +ebuf_t *_udp_recv(udp_info_t *info,int s); +ebuf_t *_udp_alloc(udp_info_t *info); +void _udp_free(udp_info_t *info,ebuf_t *buf); + +/* ********************************************************************* + * ICMP protocol + ********************************************************************* */ + +typedef struct icmp_info_s icmp_info_t; + +icmp_info_t *_icmp_init(ip_info_t *ipi); +void _icmp_uninit(icmp_info_t *icmp); + +int _icmp_ping(icmp_info_t *icmp,uint8_t *ipaddr,int seq,int len); + + diff --git a/cfe/cfe/net/net_ip_internal.h b/cfe/cfe/net/net_ip_internal.h new file mode 100644 index 0000000..94401e2 --- /dev/null +++ b/cfe/cfe/net/net_ip_internal.h @@ -0,0 +1,128 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Internal IP structures File: net_ip_internal.h + * + * This module contains non-public IP stack constants, + * structures, and function prototypes. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * ARP Protocol + ********************************************************************* */ + +#define ARP_OPCODE_REQUEST 1 +#define ARP_OPCODE_REPLY 2 + +#define ARP_HWADDRSPACE_ETHERNET 1 + +#define PROTOSPACE_IP 0x0800 +#define PROTOSPACE_ARP 0x0806 + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#define PROTOSPACE_NMRP 0x0912 +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +#define ARP_KEEP_TIMER 60 +#define ARP_QUERY_TIMER 1 +#define ARP_QUERY_RETRIES 4 +#define ARP_TXWAIT_MAX 2 +#define ARP_TABLE_SIZE 8 + +typedef enum { ae_unused, ae_arping, ae_established } arpstate_t; + +typedef struct arpentry_s { + arpstate_t ae_state; + int ae_usage; + int ae_timer; + int ae_retries; + int ae_permanent; + uint8_t ae_ipaddr[IP_ADDR_LEN]; + uint8_t ae_ethaddr[ENET_ADDR_LEN]; + queue_t ae_txqueue; +} arpentry_t; + + +/* ********************************************************************* + * IP Protocol + ********************************************************************* */ + +#define IPHDR_VER_4 0x40 +#define IPHDR_LEN_20 0x05 +#define IPHDR_LENGTH 20 +#define IPHDR_TOS_DEFAULT 0x00 +#define IPHDR_TTL_DEFAULT 100 + +#define IPHDR_RESERVED 0x8000 +#define IPHDR_DONTFRAGMENT 0x4000 +#define IPHDR_MOREFRAGMENTS 0x2000 +#define IPHDR_FRAGOFFSET 0x01FFF + +typedef struct ip_protodisp_s { + uint8_t protocol; + int (*cb)(void *ref,ebuf_t *buf,uint8_t *dst,uint8_t *src); + void *ref; +} ip_protodisp_t; + +#define IP_MAX_PROTOCOLS 4 + + +struct ip_info_s { + net_info_t net_info; + + /* Ethernet info */ + ether_info_t *eth_info; + + /* Info specific to IP */ + uint16_t ip_id; + int ip_port; + + /* IP protocol dispatch table */ + ip_protodisp_t ip_protocols[IP_MAX_PROTOCOLS]; + + /* Info specific to ARP */ + arpentry_t *arp_table; + int arp_port; + uint8_t arp_hwaddr[ENET_ADDR_LEN]; +}; + + diff --git a/cfe/cfe/net/net_nmrp.c b/cfe/cfe/net/net_nmrp.c new file mode 100755 index 0000000..696d04d --- /dev/null +++ b/cfe/cfe/net/net_nmrp.c @@ -0,0 +1,656 @@ +#include "bsp_config.h" + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" + +#include "cfe_error.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "cfe_timer.h" + +#include "net_ip.h" +#include "net_ip_internal.h" +#include "net_api.h" + +#include "env_subr.h" + +#if CFG_TCP +#include "net_tcp.h" +#endif + +#include "ui_command.h" + +typedef struct net_ctx_s { + /* Global info */ + int64_t timer; + + /* device name */ + char *devname; + + /* Run-time info for IP interface */ + ip_info_t *ipinfo; + + /* Info for Ethernet interface */ + ether_info_t *ethinfo; + + /* Info specific to UDP */ + udp_info_t *udpinfo; + + /* Info specific to ICMP */ + icmp_info_t *icmpinfo; + +#if CFG_TCP + /* Info specific to TCP */ + tcp_info_t *tcpinfo; +#endif +} net_ctx_t; + + +#pragma pack(1) + +typedef uint8_t BYTE; +typedef uint16_t WORD; +typedef uint32_t DWORD; + +/* NMRP timeouts */ +enum _nmrp_timeouts_ { + NMRP_TIMEOUT_REQ = 1/2, /* 0.5 sec */ + NMRP_TIMEOUT_LISTEN = 3, /* 3 sec */ + NMRP_TIMEOUT_ACTIVE = 60000, /* 1 minute */ + NMRP_TIMEOUT_CLOSE = 6000, /* 6 sec */ + NMRP_TIMEOUT_ADVERTISE = 500 /* 0.5 sec */ +}; + +enum _nmrp_errors_ { + NMRP_ERR_NONE = 0, + NMRP_ERR_MSG_INVALID_LEN, + NMRP_ERR_MSG_TOO_LONG, + NMRP_ERR_MSG_TOO_MANY_OPT, + NMRP_ERR_MSG_UNKNOWN_OPT, + NMRP_ERR_MSG_INVALID_OPT, + NMRP_ERR_NO_BUF, + NMRP_ERR_GENERAL +}; + +/* NMRP codes */ +enum _nmrp_codes_ { + NMRP_CODE_ADVERTISE = 0x01, + NMRP_CODE_CONF_REQ = 0x02, + NMRP_CODE_CONF_ACK = 0x03, + NMRP_CODE_CLOSE_REQ = 0x04, + NMRP_CODE_CLOSE_ACK = 0x05, + NMRP_CODE_KEEP_ALIVE_REQ = 0x06, + NMRP_CODE_KEEP_ALIVE_ACK = 0x07, + NMRP_CODE_TFTP_UL_REQ = 0x10 +}; + +/* NMRP option types */ +enum _nmrp_option_types_ { + NMRP_OPT_MAGIC_NO = 0x0001, + NMRP_OPT_DEV_IP = 0x0002, + NMRP_OPT_FW_UP = 0x0101 +}; + +typedef enum { + NMRPC_L2_NO_ERROR = 0, + NMRPC_L2_TX_PKT_TOO_LONG, + NMRPC_L2_TX_ETHER_PREPEND_FAIL, + NMRPC_L2_TX_ERROR, + NMRPC_L2_GEN_ERR +} NMRPC_L2_RET_CODE; + +/* NMRP REQ max retries */ +enum _nmrp_req_max_retries_ { + NMRP_MAX_RETRY_CONF = 5, + NMRP_MAX_RETRY_CLOSE = 9999, + NMRP_MAX_RETRY_TFTP_UL = 4 +}; + + +enum _nmrp_state_ { + NMRP_STATE_LISTEN = 0, + NMRP_STATE_CONFIGURE, + NMRP_STATE_TRANSFER, + NMRP_STATE_CLOSE +}; + +#define NMRP_MAX_OPT_PER_MSG (6) +#define ETHER_NMRP (0x0912) + +#define NMRP_HDR_LEN (sizeof(NMRP_MSG) - sizeof(NMRP_OPT)) +#define NMRP_MIN_OPT_LEN (sizeof(NMRP_OPT) - 1) + +#define NMRP_MAGIC_NO "\x4E\x54\x47\x52" +#define NMRP_MAGIC_NO_LEN (sizeof(NMRP_MAGIC_NO) - 1) + +typedef struct { + uint8_t destMAC[6]; + uint8_t srcMAC[6]; + uint16_t etherType; +} ETHER_HDR; + +typedef struct { + uint16_t type; + uint16_t len; + uint8_t value; +} NMRP_OPT; + +typedef struct { + uint16_t reserved; + uint8_t code; + uint8_t id; + uint16_t length; + + NMRP_OPT opt; +} NMRP_MSG; + +typedef struct { + ETHER_HDR etherHdr; + NMRP_MSG nmrpMsg; +} ETHER_NMRP_PKT; + +typedef struct { + uint16_t type; + uint16_t len; + + union { + uint8_t byteVal; + uint16_t wordVal; + uint32_t dwordVal; + const uint8_t *streamVal; + } value; +} NMRP_PARSED_OPT; + +typedef struct { + uint8_t code; + uint8_t id; + uint16_t length; + + int numOptions; + NMRP_PARSED_OPT options[NMRP_MAX_OPT_PER_MSG]; +} NMRP_PARSED_MSG; + +typedef struct { + int reqCode; + const char reqName[32], respName[32]; + + int (* RespParser) (const void *pkt, int pktLen, const BYTE *serverMac, void *userData); +} NMRP_REQ_CUSTOM; + +typedef struct { + + BYTE peerMac[6]; + BYTE myMac[6]; + + DWORD peerIp; + DWORD myIp; + WORD ipId; + + WORD peerPort; + WORD myPort; +} NET_INFO; + +#pragma pack() + +#define MIN_ETHER_NMRP_LEN (sizeof(ETHER_HDR) + NMRP_HDR_LEN) + +#if 0 +#define HTONCS(constWord) ((((constWord) & 0xff00) >> 8) | (((constWord) & 0xff) << 8)) +#define NTOHCS(constWord) HTONCS(constWord) +#define HTONCL(constDword) ((((constDword) & 0xff000000) >> 24) | (((constDword) & 0xff0000) >> 8) | (((constDword) & 0xff00) << 8) | (((constDword) & 0xff) << 24)) +#define NTOHCL(constDword) HTONCL(constDword) +#endif + +#define HTONCS(constWord) constWord +#define NTOHCS(constWord) constWord +#define HTONCL(constDword) constDword +#define NTOHCL(constDword) constDword +/* +#define IS_NMRP_PKT(etherNmrpPkt, pktLen, parsedNmrpMsg, sourceMAC) \ + ((pktLen) > MIN_ETHER_NMRP_LEN && (etherNmrpPkt)->etherHdr.etherType == HTONCS(ETHER_NMRP) && \ + ((sourceMAC) == NULL || memcmp((sourceMAC), (etherNmrpPkt)->etherHdr.srcMAC, 6) == 0) && \ + NMRP_MsgParsing(&(etherNmrpPkt)->nmrpMsg, (pktLen) - sizeof(ETHER_HDR), (parsedNmrpMsg)) == NMRP_ERR_NONE) +*/ + +#define IS_NMRP_PKT(etherNmrpPkt, pktLen, parsedNmrpMsg, sourceMAC) \ + ((pktLen) > MIN_ETHER_NMRP_LEN && (etherNmrpPkt)->etherHdr.etherType == HTONCS(ETHER_NMRP) && \ + ((sourceMAC) == NULL || memcmp((sourceMAC), (etherNmrpPkt)->etherHdr.srcMAC, 6) == 0)) + +static int nmrp_rx_callback(ebuf_t *buf,void *ref); +int NMRP_MsgParsing(const NMRP_MSG *pkt, int pktLen, NMRP_PARSED_MSG *msg); +NMRP_PARSED_OPT *NMRP_MsgGetOpt(NMRP_PARSED_MSG *msg, uint16_t optType); +//int NMRPRequest( const BYTE *serverMac, const BYTE *clientMac, NMRP_REQ_CUSTOM *custom, void *userData); +static int NMRPConfiguring( const BYTE *serverMac, const BYTE *clientMac, DWORD *ipAddr, DWORD *ipSubnetMask, int *fwUpgrade); +static int NMRPConfAckParser(const void *pkt, int pktLen, const BYTE *serverMac, void *userData); +//int NMRPTFTPWaiting(const NET_INFO *netInfo, DWORD *peerIp, WORD *peerPort, WORD *ipId); +int NMRPTFTPWaiting(void); +int NMRPKeepAlive(void); +static int NMRPClosing(void); +static int NMRPSend(NMRP_REQ_CUSTOM *custom); + +int nmrp_server_detected; +int g_nmrp_config_acked; +int g_nmrp_close_acked; +//int g_Listening; +int g_NMRP_State; +extern net_ctx_t *netctx; + +NET_INFO g_NetInfo; +//ebuf_t *g_nmrp_txbuf = NULL; +int g_portal_number; +NMRP_PARSED_MSG g_nmrpMsg; +int g_tftp_upgrade_success; +int g_nmrp_keepalive;//jenny add for fixed NMRP server timeout issue +unsigned char g_received_packet[1600]; + +int gpio_control(int gpio, int value); +extern int32_t _getticks(void); /* return value of CP0 COUNT */ +static unsigned long seed = 1; + +void srand(unsigned long local_seed); +unsigned long rand(void); +int _start_nmrp(void); + +void srand(unsigned long local_seed) +{ + seed = local_seed; +} + +unsigned long rand(void) +{ + + long x, hi, lo, t; + + x = seed; + hi = x / 127773; + lo = x % 127773; + t = 16807 * lo - 2836 * hi; + if (t <= 0) t += 0x7fffffff; + seed = t; + return t; +} + +int _start_nmrp (void) +{ + uint8_t nmrpproto[2]; + + int ret = 0; + int ui_cmd_status; + int fwUpgrade; + int64_t timer; + DWORD ipSubnetMask; + char buf[512]; + unsigned char *pIP, *pMask; + + srand( (unsigned long)_getticks()); + + //net_init("eth0"); + nmrpproto[0] = (PROTOSPACE_NMRP >> 8) & 0xFF; + nmrpproto[1] = (PROTOSPACE_NMRP & 0xFF); + g_tftp_upgrade_success = 0; + g_nmrp_keepalive = 0;//jenny add for timeout + + g_portal_number = eth_open(netctx->ethinfo, ETH_PTYPE_DIX, (char*)nmrpproto, nmrp_rx_callback, NULL); + if(g_portal_number < 0) + { + ret = -1; + goto _clean_and_exit; + } + + eth_gethwaddr(netctx->ethinfo, g_NetInfo.myMac); +//_retry: + g_NMRP_State = NMRP_STATE_LISTEN; + nmrp_server_detected = 0; + TIMER_SET(timer, NMRP_TIMEOUT_LISTEN*CFE_HZ); + while (!TIMER_EXPIRED(timer)) + { + POLL(); + if(nmrp_server_detected) + { + xprintf ("find server.\n"); + break; + } + } + + if(!nmrp_server_detected) + { + ret = -1; + goto _clean_and_exit; + } + + g_nmrp_config_acked = 0; + + if (NMRPConfiguring( g_NetInfo.peerMac, g_NetInfo.myMac, &g_NetInfo.myIp, &ipSubnetMask, &fwUpgrade) == -1) + { + ret = -1; + goto _clean_and_exit; + } + + pIP = (unsigned char *)&g_NetInfo.myIp; + pMask = (unsigned char *)&ipSubnetMask; + + sprintf(buf, "ifconfig eth0 -addr=%u.%u.%u.%u -mask=%u.%u.%u.%u", *(pIP), *(pIP+1), *(pIP+2), *(pIP+3), + *(pMask), *(pMask+1), *(pMask+2), *(pMask+3) ); + ui_docommand(buf); + + +_retry_tftp: + + NMRPTFTPWaiting(); + //eth_close(netctx->ethinfo, g_portal_number); + //g_portal_number = 0; + //net_init("eth0"); + ui_cmd_status = ui_docommand("tftpd nmrp"); + + + sprintf(buf, "ifconfig eth0 -addr=%u.%u.%u.%u -mask=%u.%u.%u.%u", *(pIP), *(pIP+1), *(pIP+2), *(pIP+3), + *(pMask), *(pMask+1), *(pMask+2), *(pMask+3) ); + + ui_docommand(buf); + + //net_init("eth0"); + g_portal_number = eth_open(netctx->ethinfo, ETH_PTYPE_DIX, (char*)nmrpproto, nmrp_rx_callback, NULL); + + if(ui_cmd_status != 0) + { + goto _retry_tftp; + } + + g_nmrp_close_acked = 0; + /* Foxconn modified start, zacker,04/07/2008 */ + /* ui_docommand("nvram erase"); */ + // nvram_unset("restore_defaults"); + // nvram_commit(); + /* Foxconn modified end, zacker,04/07/2008 */ + + NMRPClosing(); + g_tftp_upgrade_success = 1; + // gpio_control(7, 1); //turn off power led + +_clean_and_exit: + + if(g_portal_number > 0) + eth_close(netctx->ethinfo, g_portal_number); + + return ret; +} + +extern void setPowerOnLedOn(void); +static int nmrp_rx_callback(ebuf_t *buf,void *ref) +{ + int pktLen = 0; + NMRP_PARSED_MSG nmrpMsg; + const ETHER_NMRP_PKT *pkt; + unsigned char *p; + + pkt = (const ETHER_NMRP_PKT *)buf->eb_data; + pktLen = buf->eb_length + sizeof(ETHER_HDR) - 4; + + p=(unsigned char *)pkt; + + if(g_NMRP_State == NMRP_STATE_LISTEN) + { + if (IS_NMRP_PKT(pkt, pktLen, &nmrpMsg, NULL) && (*(p+16) == NMRP_CODE_ADVERTISE ) ) + { + if (NMRP_MsgParsing(&(pkt)->nmrpMsg, (pktLen) - sizeof(ETHER_HDR), &nmrpMsg) == NMRP_ERR_NONE) + { + if(NMRP_MsgGetOpt(&nmrpMsg, NMRP_OPT_MAGIC_NO) != NULL) + { + memcpy(g_NetInfo.peerMac, buf->eb_data+6, 6); + g_NMRP_State = NMRP_STATE_CONFIGURE; + nmrp_server_detected = 1; + setPowerOnLedOn(); /* Foxconn added for U12H154, turn on TEST LED */ + } + } + } + } + else if(g_NMRP_State == NMRP_STATE_CONFIGURE) + { + if (IS_NMRP_PKT(pkt, pktLen, &nmrpMsg, NULL) && (*(p+16) == NMRP_CODE_CONF_ACK ) ) + { + memcpy(g_received_packet, pkt, pktLen); + pkt = (const ETHER_NMRP_PKT *)g_received_packet; + if (NMRP_MsgParsing(&(pkt)->nmrpMsg, (pktLen) - sizeof(ETHER_HDR), &nmrpMsg) == NMRP_ERR_NONE) + { + if(NMRPConfAckParser(pkt, pktLen, g_NetInfo.peerMac, &nmrpMsg)) + { + g_nmrpMsg = nmrpMsg; + g_nmrp_config_acked = 1; + g_NMRP_State = NMRP_STATE_TRANSFER; + } + } + } + } + else if(g_NMRP_State == NMRP_STATE_TRANSFER) + { + if (IS_NMRP_PKT(pkt, pktLen, &nmrpMsg, NULL) && (*(p+16) == NMRP_CODE_CLOSE_ACK ) ) + { + if (NMRP_MsgParsing(&(pkt)->nmrpMsg, (pktLen) - sizeof(ETHER_HDR), &nmrpMsg) == NMRP_ERR_NONE) + { + g_NMRP_State =NMRP_STATE_CLOSE; + g_nmrp_close_acked = 1; + } + } + } + + return ETH_DROP; +} + +static int NMRP_OptValParsing(NMRP_PARSED_OPT *optParsed, const uint8_t *value) +{ + int retVal = NMRP_ERR_NONE; + + switch (optParsed->type) { + case NMRP_OPT_MAGIC_NO: /* We require the lenght MUST be correct for the MAGIC-NO option */ + if (optParsed->len != (NMRP_MIN_OPT_LEN + NMRP_MAGIC_NO_LEN) || memcmp(value, NMRP_MAGIC_NO, NMRP_MAGIC_NO_LEN)) + { + retVal = NMRP_ERR_MSG_INVALID_OPT; + } + else + { + optParsed->value.streamVal = value; + } + break; + + case NMRP_OPT_DEV_IP: /* save the value of IP in the byte stream format, the actual IP is streamVal[0].streamVal[1].streamVal[2].streamVal[3]. */ + //if ( optParsed->len != (NMRP_MIN_OPT_LEN + 8) || !IsIPAddrValid(ntohl(*(DWORD *) value), ntohl(*(DWORD *) (value + 4))) ) + if ( optParsed->len != (NMRP_MIN_OPT_LEN + 8) ) + retVal = NMRP_ERR_MSG_INVALID_OPT; + else + optParsed->value.streamVal = value; + break; + + case NMRP_OPT_FW_UP: /* don't check the length of FW-UP option for future compatibility */ + break; + + default: + retVal = NMRP_ERR_MSG_UNKNOWN_OPT; + break; + } + + return retVal; +} + +int NMRP_MsgParsing(const NMRP_MSG *pkt, int pktLen, NMRP_PARSED_MSG *msg) +{ + if (pktLen < NMRP_HDR_LEN) + return NMRP_ERR_MSG_INVALID_LEN; + + msg->code = pkt->code; + msg->id = pkt->id; + + if ((msg->length = NTOHCS(pkt->length)) <= pktLen && msg->length >= NMRP_HDR_LEN) { + int retVal; + uint16_t optLen; + NMRP_OPT *opt; + NMRP_PARSED_OPT *optParsed; + + opt = (NMRP_OPT *)(((uint8_t *) pkt) + NMRP_HDR_LEN); + optParsed = msg->options; + msg->numOptions = 0; + + /* use the length indicated in the NMRP header */ + for (pktLen = msg->length - NMRP_HDR_LEN; pktLen >= NMRP_MIN_OPT_LEN; ) + { + optParsed->type = NTOHCS(opt->type); + optParsed->len = optLen = NTOHCS(opt->len); + + if (optParsed->len > pktLen) + return NMRP_ERR_MSG_INVALID_OPT; + + if ((retVal = NMRP_OptValParsing(optParsed, &opt->value)) == NMRP_ERR_NONE) + { + optParsed++; + + if (++msg->numOptions >= NMRP_MAX_OPT_PER_MSG) + return NMRP_ERR_MSG_TOO_MANY_OPT; + } + else if (retVal != NMRP_ERR_MSG_UNKNOWN_OPT) + { + return NMRP_ERR_MSG_INVALID_OPT; + } + + pktLen -= optLen; + opt = (NMRP_OPT *)(((uint8_t *) opt) + optLen); + } + } /* end if the msg->length is larger than the received packet length */ + + return pktLen == 0 ? NMRP_ERR_NONE : NMRP_ERR_MSG_INVALID_LEN; +} + +NMRP_PARSED_OPT *NMRP_MsgGetOpt(NMRP_PARSED_MSG *msg, uint16_t optType) +{ + NMRP_PARSED_OPT *opt, *optEnd; + + optEnd = &msg->options[msg->numOptions]; + + for (opt = msg->options; opt != optEnd; opt++) + if (opt->type == optType) + break; + + return msg->numOptions == 0 ? NULL : (opt == optEnd ? NULL : opt); +} + +static int NMRPClosing(void) +{ + int ret, retries=0; + static NMRP_REQ_CUSTOM reqClose = { NMRP_CODE_CLOSE_REQ, "CLOSE-REQ", "CLOSE-ACK", NULL }; + + do { + ret = NMRPSend(&reqClose); + if( !ret) + { + cfe_sleep(CFE_HZ/2); + if(g_nmrp_close_acked) + { + break; + } + } + } while(++retries <= NMRP_MAX_RETRY_CLOSE); + + return 0; +} + +int NMRPTFTPWaiting(void) +{ + static NMRP_REQ_CUSTOM reqTftpUl = { NMRP_CODE_TFTP_UL_REQ, "TFTP-UL-REQ", "TFTP-WRQ", NULL }; + + return NMRPSend(&reqTftpUl); +} + +/* Foxconn modify start by Jenny Zhao, 08/07/2008, for fixed timeout issue*/ +int NMRPKeepAlive(void) +{ + static NMRP_REQ_CUSTOM reqkeepalive = { NMRP_CODE_KEEP_ALIVE_REQ, "KEEPALIVE_REQ", "KEEPALIVE-ACK", NULL }; + + return NMRPSend(&reqkeepalive); +} +/* Foxconn modify end by Jenny Zhao, 08/07/2008*/ + +static int NMRPConfAckParser(const void *pkt, int pktLen, const BYTE *serverMac, void *userData) +{ + NMRP_PARSED_MSG *nmrpMsg = (NMRP_PARSED_MSG *) userData; + + return NMRP_MsgGetOpt(nmrpMsg, NMRP_OPT_DEV_IP) != NULL; + /* + return IS_NMRP_PKT((const ETHER_NMRP_PKT *)pkt, pktLen, nmrpMsg, serverMac) && + nmrpMsg->code == NMRP_CODE_CONF_ACK && + NMRP_MsgGetOpt(nmrpMsg, NMRP_OPT_DEV_IP) != NULL; + */ +} + + +static int NMRPConfiguring( const BYTE *serverMac, + const BYTE *clientMac, + DWORD *ipAddr, DWORD *ipSubnetMask, + int *fwUpgrade) +{ + //int ret, retries=0; + int ret; + NMRP_PARSED_OPT *devIp; + static NMRP_REQ_CUSTOM reqConf = { NMRP_CODE_CONF_REQ, "CONF-REQ", "CONF-ACK", NMRPConfAckParser }; + + do { + + ret = NMRPSend(&reqConf); + if( !ret) + { + cfe_sleep(CFE_HZ/2); + if(g_nmrp_config_acked) + { + break; + } + } + + //}while(++retries <= NMRP_MAX_RETRY_CLOSE); + } while(1); + + if(g_nmrp_config_acked) + { + devIp = NMRP_MsgGetOpt(&g_nmrpMsg, NMRP_OPT_DEV_IP); + *ipAddr = (* (DWORD *) devIp->value.streamVal); + *ipSubnetMask = (* (DWORD *) (devIp->value.streamVal + 4)); + *fwUpgrade = NMRP_MsgGetOpt(&g_nmrpMsg, NMRP_OPT_FW_UP) != NULL; + return 0; + } + return -1; +} + +static int NMRPSend(NMRP_REQ_CUSTOM *custom) +{ + ebuf_t *txbuf; + NMRP_MSG *msg; + unsigned long random_backoff; + + txbuf = eth_alloc(netctx->ethinfo, g_portal_number); + if (!txbuf) + { + return -1; + } + msg = (NMRP_MSG *)(txbuf->eb_data + 14); + msg->reserved = 0; + msg->code = custom->reqCode; + msg->id = 0; + msg->length = HTONCS(NMRP_HDR_LEN); /* header only, no option */ + txbuf->eb_length = NMRP_HDR_LEN; + + random_backoff = rand(); + random_backoff = random_backoff % 30; + xprintf("%s sent...Waiting for %s...\n", custom->reqName, custom->respName); + cfe_sleep(random_backoff); + eth_send(txbuf, (uint8_t *)g_NetInfo.peerMac); + eth_free(txbuf); + + return 0; +} + diff --git a/cfe/cfe/net/net_nmrp.h b/cfe/cfe/net/net_nmrp.h new file mode 100755 index 0000000..052ff19 --- /dev/null +++ b/cfe/cfe/net/net_nmrp.h @@ -0,0 +1 @@ +int _start_nmrp(void); diff --git a/cfe/cfe/net/net_tcp.c b/cfe/cfe/net/net_tcp.c new file mode 100755 index 0000000..377c3c8 --- /dev/null +++ b/cfe/cfe/net/net_tcp.c @@ -0,0 +1,2215 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * TCP Protocol File: net_tcp.c + * + * This file contains a very simple TCP. The basic goals of this + * tcp are to be "good enough for firmware." We try to be + * correct in our protocol implementation, but not very fancy. + * In particular, we don't deal with out-of-order segments, + * we don't hesitate to copy data more then necessary, etc. + * We strive to implement important protocol features + * like slow start, nagle, etc., but even these things are + * subsetted and simplified as much as possible. + * + * Current "todo" list: + * slow start + * good testing of retransmissions, + * round-trip delay calculations + * Process received TCP options, particularly segment size + * Ignore urgent data (remove from datastream) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_ip.h" +#include "net_ip_internal.h" + +#include "cfe_timer.h" + +#include "cfe_error.h" + +#include "net_tcpbuf.h" +#include "net_tcp_internal.h" +#include "net_tcp.h" + +/* ********************************************************************* + * Config + ********************************************************************* */ + +//#define _TCP_DEBUG_ + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +struct tcp_info_s { + void *ti_ref; /* ref data for IP layer */ + ip_info_t *ti_ipinfo; /* IP layer handle */ + cfe_timer_t ti_fasttimer; /* 200ms timer */ + queue_t ti_tcblist; /* list of known TCBs */ + int ti_onqueue; /* number of TCBs on queue */ + uint32_t ti_iss; /* initial sequence number */ + tcb_t *ti_ports[TCP_MAX_PORTS]; /* table of active sockets */ +}; + +/* ********************************************************************* + * Forward Declarations + ********************************************************************* */ + +static void _tcp_protosend(tcp_info_t *ti,tcb_t *tcb); +static int _tcp_rx_callback(void *ref,ebuf_t *buf,uint8_t *destaddr,uint8_t *srcaddr); +static void _tcp_output(tcp_info_t *ti,tcb_t *tcb); +static void _tcp_aborttcb(tcp_info_t *ti,tcb_t *tcb); +static void _tcp_closetcb(tcp_info_t *ti,tcb_t *tcb); +static tcb_t *_tcp_find_lclport(tcp_info_t *ti,uint16_t port); +static void _tcp_freetcb(tcp_info_t *ti,tcb_t *tcb); +static void _tcp_sendctlmsg(tcp_info_t *ti,tcb_t *tcb,uint16_t flags,int timeout); + + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#ifdef _TCP_DEBUG_ +#define _tcp_setstate(tcb,state) (tcb)->tcb_state = (state); \ + printf("tcp state = " #state "\n"); +#define DEBUGMSG(x) printf x +#else +#define _tcp_setstate(tcb,state) (tcb)->tcb_state = (state); +#define DEBUGMSG(x) +#endif + +#define _tcp_preparectlmsg(tcb,flags) (tcb)->tcb_txflags = (flags) ; \ + (tcb)->tcb_flags |= TCB_FLG_SENDMSG; + +#define _tcp_canceltimers(tcb) \ + TIMER_CLEAR((tcb)->tcb_timer_retx); \ + TIMER_CLEAR((tcb)->tcb_timer_keep); \ + TIMER_CLEAR((tcb)->tcb_timer_2msl); \ + TIMER_CLEAR((tcb)->tcb_timer_pers); + + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +#ifdef _TCP_DEBUG_ +int _tcp_dumpflags = 1; +#else +int _tcp_dumpflags = 0; +#endif + +/* ********************************************************************* + * _tcp_init(ipi,ref) + * + * Initialize the TCP module. We set up our data structures + * and register ourselves with the IP layer. + * + * Input parameters: + * ipi - IP information + * ref - will be passed back to IP as needed + * + * Return value: + * tcp_info_t structure, or NULL if problems + ********************************************************************* */ + +tcp_info_t *_tcp_init(ip_info_t *ipi,void *ref) +{ + tcp_info_t *ti; + int idx; + + ti = (tcp_info_t *) KMALLOC(sizeof(tcp_info_t),0); + if (!ti) return NULL; + + ti->ti_ref = ref; + ti->ti_ipinfo = ipi; + + /* + * Start the "fast" timer + */ + + TIMER_SET(ti->ti_fasttimer,TCP_FAST_TIMER); + + /* + * Initialize the TCB list + */ + + q_init(&(ti->ti_tcblist)); + + for (idx = 0; idx < TCP_MAX_PORTS; idx++) { + ti->ti_ports[idx] = NULL; + } + + ti->ti_onqueue = 0; + + /* + * Set up the initial sequence number + */ + + extern int32_t _getticks(void); /* return value of CP0 COUNT */ + ti->ti_iss = (uint32_t) _getticks(); /* XXX nonportable */ + + /* + * Register our protocol with IP + */ + + _ip_register(ipi,IPPROTO_TCP,_tcp_rx_callback,ti); + + return ti; +} + + +/* ********************************************************************* + * _tcp_uninit(info) + * + * De-initialize the TCP layer, unregistering from the IP layer. + * + * Input parameters: + * info - our tcp_info_t, from _tcp_init() + * + * Return value: + * nothing + ********************************************************************* */ + +void _tcp_uninit(tcp_info_t *info) +{ + tcb_t *tcb; + + /* + * Destroy all allocated TCBs, forcefully. + */ + + while (!q_isempty(&(info->ti_tcblist))) { + tcb = (tcb_t *) q_getfirst(&(info->ti_tcblist)); + /* tcp_freetcb removes tcb from the queue */ + _tcp_freetcb(info,tcb); + } + + /* + * Deregister with IP + */ + + _ip_deregister(info->ti_ipinfo,IPPROTO_TCP); + + /* + * Free up the info structure + */ + + KFREE(info); +} + + +/* ********************************************************************* + * _tcp_freetcb(ti,tcb) + * + * Called when the TIME_WAIT timer expires, we use this to + * free up the TCB for good. + * + * Input parameters: + * ti - tcp information + * tcb - tcb to free + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_freetcb(tcp_info_t *ti,tcb_t *tcb) +{ + /* + * Undo socket number + */ + + if (tcb->tcb_socknum >= 0) ti->ti_ports[tcb->tcb_socknum] = NULL; + tcb->tcb_socknum = -1; + + /* + * Remove from queue + */ + + ti->ti_onqueue--; + q_dequeue(&(tcb->tcb_qb)); + + /* + * Free buffers (could probably be done in tcb_destroy) + */ + + tmb_free(&(tcb->tcb_txbuf)); + tmb_free(&(tcb->tcb_rxbuf)); + + /* + * Free the TCB + */ + + KFREE(tcb); + +} + +/* ********************************************************************* + * _tcp_socket(info) + * + * Create a new tcp socket (a new tcb structure is allocated + * and entered into the socket table) + * + * Input parameters: + * info - tcp information + * + * Return value: + * new socket number, or <0 if an error occured + ********************************************************************* */ + +int _tcp_socket(tcp_info_t *info) +{ + int idx; + tcb_t *tcb; + + /* + * Find an empty slot. + */ + + for (idx = 0; idx < TCP_MAX_PORTS; idx++) { + if (!info->ti_ports[idx]) break; + } + + if (idx == TCP_MAX_PORTS) { + return CFE_ERR_NOHANDLES; + } + + /* + * See if we can create another TCB + */ + + if (info->ti_onqueue >= TCP_MAX_TCBS) return CFE_ERR_NOMEM; + + /* + * Allocate data structures + */ + + tcb = KMALLOC(sizeof(tcb_t),0); + if (!tcb) return CFE_ERR_NOMEM; + + memset(tcb,0,sizeof(tcb_t)); + + if (tmb_alloc(&tcb->tcb_txbuf,TCP_BUF_SIZE) < 0) goto error; + if (tmb_alloc(&tcb->tcb_rxbuf,TCP_BUF_SIZE) < 0) goto error; + + /* + * XXX Temp: our MTU is always 1400. We could/should + * XXX get this from the lower layer. + */ + + tcb->tcb_mtu = 1400; + + /* + * Default socket flags + */ + + tcb->tcb_sockflags = TCPFLG_NBIO; + + /* + * Set up initial state. Find an empty port number. + * note that the way we do this is pretty gruesome, but it will + * work for our small TCP, where the number of TCBs outstanding + * will be very small compared to the port number space. + * + * Try to look up the port number we want - if we find it, increment + * it and try again until we find an unused one. + * Stay away from ports 0..1023. + */ + + _tcp_setstate(tcb,TCPSTATE_CLOSED); + tcb->tcb_lclport = (uint16_t) (((uint16_t) cfe_ticks) + 1024); + + while (_tcp_find_lclport(info,tcb->tcb_lclport) != NULL) { + tcb->tcb_lclport++; + if (tcb->tcb_lclport == 0) tcb->tcb_lclport = 1024; + } + + /* + * Remember this socket in the table + */ + + info->ti_ports[idx] = tcb; + tcb->tcb_socknum = idx; + + info->ti_onqueue++; + q_enqueue(&(info->ti_tcblist),&(tcb->tcb_qb)); + + return idx; + +error: + tmb_free(&(tcb->tcb_txbuf)); + tmb_free(&(tcb->tcb_rxbuf)); + KFREE(tcb); + return CFE_ERR_NOMEM; +} + + +/* ********************************************************************* + * _tcp_connect(ti,s,dest,port) + * + * Connect a socket to a remote port. + * + * Input parameters: + * ti - TCP information + * s - socket number, allocated via _tcp_create + * dest - destination IP address + * port - destination port number + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_connect(tcp_info_t *ti,int s,uint8_t *dest,uint16_t port) +{ + tcb_t *tcb; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + memcpy(tcb->tcb_peeraddr,dest,IP_ADDR_LEN); + tcb->tcb_peerport = port; + + tcb->tcb_rcvnext = 0; + tcb->tcb_rcvack = 0; + + tcb->tcb_sendnext = ti->ti_iss; + tcb->tcb_sendunack = ti->ti_iss; + tcb->tcb_sendwindow = 0; + + tmb_init(&tcb->tcb_txbuf); + tmb_init(&tcb->tcb_rxbuf); + + TIMER_SET(tcb->tcb_timer_keep,TCP_KEEPALIVE_TIMER); + _tcp_setstate(tcb,TCPSTATE_SYN_SENT); + + _tcp_sendctlmsg(ti,tcb,TCPFLG_SYN,TCP_RETX_TIMER); + + return 0; +} + + +/* ********************************************************************* + * _tcp_close(ti,s) + * + * Disconnect a TCP socket nicely. Sends a FIN packet to get + * us into the disconnect state. + * + * Input parameters: + * ti - tcp information + * s - socket number + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_close(tcp_info_t *ti,int s) +{ + tcb_t *tcb; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + +#if defined(CONFIG_MIPS_BRCM) + /* + * Flush output data. + */ + + _tcp_output(ti,tcb); +#endif + + /* + * Reclaim this socket number for future use + */ + + ti->ti_ports[s] = NULL; + tcb->tcb_socknum = -1; + + /* + * Decide what action to take based on current state + */ + + switch (tcb->tcb_state) { + case TCPSTATE_SYN_RECEIVED: + case TCPSTATE_ESTABLISHED: + /* + * Transmit the FIN/ACK and wait for a FIN/ACK. + * + * XXX probably want to wait till all unacked data is + * acked before sending the fin?? This would be sort + * of like the "linger" option + */ + _tcp_setstate(tcb,TCPSTATE_FINWAIT_1); + _tcp_sendctlmsg(ti,tcb,TCPFLG_ACK | TCPFLG_FIN,TCP_RETX_TIMER); + break; + + case TCPSTATE_CLOSED: + case TCPSTATE_LISTEN: + case TCPSTATE_SYN_SENT: + /* + * Disconnect during our attempt, or from some + * idle state that does not require sending anything. + * Go back to CLOSED. + */ + _tcp_closetcb(ti,tcb); + _tcp_freetcb(ti,tcb); + break; + + case TCPSTATE_CLOSE_WAIT: + _tcp_setstate(tcb,TCPSTATE_LAST_ACK); + _tcp_sendctlmsg(ti,tcb,TCPFLG_ACK | TCPFLG_FIN,TCP_RETX_TIMER); + break; + + case TCPSTATE_TIME_WAIT: + case TCPSTATE_FINWAIT_1: + case TCPSTATE_FINWAIT_2: + case TCPSTATE_CLOSING: + case TCPSTATE_LAST_ACK: + default: + break; + } + + return 0; +} + + + +/* ********************************************************************* + * _tcp_aborttcb(ti,tcb) + * + * Forcefully terminate a TCP connection. Sends an RST packet + * to nuke the other end. The socket is forced into the CLOSED + * state. + * + * Input parameters: + * ti - tcp information + * tcb -tcb to abort + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_aborttcb(tcp_info_t *ti,tcb_t *tcb) +{ + DEBUGMSG(("tcp_abort from state %d\n",tcb->tcb_state)); + + /* + * Decide what action to take based on current state + * If we're in SYN_SENT, RECEIVED, ESTABLISHED, FINWAIT_1, + * FINWAIT_2, CLOSING, LAST_ACK, or CLOSE_WAIT we've sent + * some traffic on this TCB, so send an RST to kill off + * the remote TCB. + */ + + if (TCPSTATE_IN_SET(tcb->tcb_state,M_TCPSTATE_ABORTSTATES)) { + /* Send RST with no timeout, don't retransmit it. */ + _tcp_canceltimers(tcb); + _tcp_sendctlmsg(ti,tcb,TCPFLG_ACK | TCPFLG_RST,0); + } + + /* + * No matter what, it's now CLOSED. + */ + + _tcp_closetcb(ti,tcb); + +} + + +/* ********************************************************************* + * _tcp_closetcb(ti,tcb) + * + * Close a TCB, switching the state to "closed" and resetting + * internal variables. The TCB is *not* freed. + * + * Input parameters: + * ti - tcp information + * tcb - tcb to close + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_closetcb(tcp_info_t *ti,tcb_t *tcb) +{ + /* + * Set state to "closed" and reset timers + */ + + _tcp_setstate(tcb,TCPSTATE_CLOSED); + tcb->tcb_flags = 0; + _tcp_canceltimers(tcb); + + /* + * Reinitialize the buffers to waste the stored send data and + * clear out any receive data + */ + + tmb_init(&tcb->tcb_txbuf); + tmb_init(&tcb->tcb_rxbuf); +} + +/* ********************************************************************* + * _tcp_send(ti,s,buf,len) + * + * Queue some data to be transmitted via a TCP socket + * + * Input parameters: + * ti - TCP information + * s - socket number + * buf - buffer of data to send + * len - size of buffer to send + * + * Return value: + * number of bytes queued + * <0 if an error occured + ********************************************************************* */ + +int _tcp_send(tcp_info_t *ti,int s,uint8_t *buf,int len) +{ + tcb_t *tcb; + int retlen; + int curlen; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + /* + * State must be ESTABLISHED or CLOSE_WAIT. CLOSE_WAIT + * means we've received a fin, but we can still send in + * the outbound direction. + */ + + if (!TCPSTATE_IN_SET(tcb->tcb_state,M_TCPSTATE_SEND_OK)) { + return CFE_ERR_NOTCONN; + } + + /* + * Copy the user data into the transmit buffer. + */ + + curlen = tmb_curlen(&(tcb->tcb_txbuf)); + retlen = tmb_copyin(&(tcb->tcb_txbuf),buf,len,TRUE); + + /* + * Cause some output on the device. + */ + + /* + * Nagle: Call _tcp_output only if there is no outstanding + * unacknowledged data. The way our transmit buffer + * works, it only holds unacknowledged data, so this + * test is easy. It isn't really 100% correct to + * do it this way, but the effect is the same; we will + * not transmit tinygrams. + */ + + if ((curlen == 0) || (tcb->tcb_sockflags & TCPFLG_NODELAY)) { + _tcp_output(ti,tcb); + } + + return retlen; +} + +/* ********************************************************************* + * _tcp_recv(ti,s,buf,len) + * + * Get buffered receive data from the TCP socket + * + * Input parameters: + * ti - tcp information + * s - socket number + * buf - pointer to receive buffer area + * len - size of receive buffer area + * + * Return value: + * number of bytes received + * <0 if an error occured + * ==0 if no data available (or tcp session is closed) + ********************************************************************* */ + +int _tcp_recv(tcp_info_t *ti,int s,uint8_t *buf,int len) +{ + tcb_t *tcb; + int retlen; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + if (!TCPSTATE_IN_SET(tcb->tcb_state,M_TCPSTATE_RECV_OK)) { + return CFE_ERR_NOTCONN; + } + + retlen = tmb_copyout(&(tcb->tcb_rxbuf),buf,len,TRUE); + + /* + * If we've drained all of the data out of the buffer + * send an ack. This isn't ideal, but it will + * prevent us from keeping the window closed. + */ + +// if (retlen && (tmb_curlen(&(tcb->tcb_rxbuf)) == 0)) { +// _tcp_preparectlmsg(tcb,TCPFLG_ACK); +// _tcp_protosend(ti,tcb); +// tcb->tcb_flags &= ~TCB_FLG_DLYACK; +// } + + return retlen; +} + + +/* ********************************************************************* + * _tcp_bind(ti,s,port) + * + * "bind" a TCP socket to a particular port - this sets the + * outbound local (source) port number. + * + * Input parameters: + * ti - tcp information + * s - socket number + * port - port number + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_bind(tcp_info_t *ti,int s,uint16_t port) +{ + tcb_t *tcb; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + /* XXX test state - must be in 'closed' */ + + if (_tcp_find_lclport(ti,port)) return CFE_ERR_ADDRINUSE; + + tcb->tcb_lclport = port; + + return 0; +} + +/* ********************************************************************* + * _tcp_setflags(ti,s,flags) + * + * Set per-socket flags. + * + * Input parameters: + * ti - tcp information + * s - socket number + * flags - flags to set + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_setflags(tcp_info_t *ti,int s,unsigned int flags) +{ + tcb_t *tcb; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + tcb->tcb_sockflags = flags; + + return 0; +} + +/* ********************************************************************* + * _tcp_getflags(ti,s,flags) + * + * Get per-socket flags. + * + * Input parameters: + * ti - tcp information + * s - socket number + * flags - pointer to int to receive flags + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_getflags(tcp_info_t *ti,int s,unsigned int *flags) +{ + tcb_t *tcb; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + *flags = tcb->tcb_sockflags; + + return 0; +} + + +/* ********************************************************************* + * _tcp_peeraddr(ti,s,addr,port) + * + * Return the address of the computer on the other end of this + * connection. + * + * Input parameters: + * ti - tcp information + * s - socket number + * addr - receives IP address of remote + * port - port number + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_peeraddr(tcp_info_t *ti,int s,uint8_t *addr,uint16_t *port) +{ + tcb_t *tcb; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + /* + * Test for any of the states where we believe the peeraddr in the tcb + * is valid. + */ + + if (!TCPSTATE_IN_SET(tcb->tcb_state,M_TCPSTATE_PEERADDR_OK)) { + return CFE_ERR_NOTCONN; + } + + if (addr) memcpy(addr,tcb->tcb_peeraddr,IP_ADDR_LEN); + if (port) *port = tcb->tcb_peerport; + + return 0; +} + +/* ********************************************************************* + * _tcp_listen(ti,s,port) + * + * Set a socket for listening mode, allowing inbound connections + * to occur. + * + * Input parameters: + * ti - tcp information + * s - socket nunber + * port - port number to listen for (implicit tcp_bind) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_listen(tcp_info_t *ti,int s,uint16_t port) +{ + tcb_t *tcb; + queue_t *qb; + + /* + * See if another TCB is listening to this port + */ + + for (qb = ti->ti_tcblist.q_next; qb != &(ti->ti_tcblist); qb = qb->q_next) { + tcb = (tcb_t *) qb; + + if ((tcb->tcb_lclport == port) && + (tcb->tcb_state == TCPSTATE_LISTEN) && + (tcb->tcb_peerport == 0)) return CFE_ERR_ADDRINUSE; + + } + + /* + * Otherwise, we're good to go. + */ + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + tcb->tcb_lclport = port; + _tcp_setstate(tcb,TCPSTATE_LISTEN); + + tcb->tcb_sendnext = 0; + tcb->tcb_sendunack = 0; + tcb->tcb_sendwindow = 0; + _tcp_canceltimers(tcb); + + tcb->tcb_rcvnext = 0; + tcb->tcb_rcvack = 0; + + tmb_init(&tcb->tcb_txbuf); + tmb_init(&tcb->tcb_rxbuf); + + tcb->tcb_txflags = 0; + + return 0; +} + +/* ********************************************************************* + * _tcp_status(ti,s,connflag,rxready,rxeof) + * + * Get status information about the TCP session + * + * Input parameters: + * ti - tcp information + * s - socket nunber + * connflag - points to an int to receive connection status + * (1=connected,0=not connected) + * rxready - number of bytes in receive queue + * rxeof - returns 1 if we've been FINed. + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_status(tcp_info_t *ti,int s,unsigned int *connflag,int *rxready,int *rxeof) +{ + tcb_t *tcb; + int rxlen; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + rxlen = tmb_curlen(&(tcb->tcb_rxbuf)); + + /* + * We consider the connection "connected" if it's established + * or it's in CLOSE_WAIT (FIN received) but we have not drained + * all of the receive data. + * + * Otherwise: If it's not in one of the connection establishment states, + * it's not connected. + */ + + if (connflag) { + if ((tcb->tcb_state == TCPSTATE_ESTABLISHED) || + ((rxlen != 0) && (tcb->tcb_state == TCPSTATE_CLOSE_WAIT))) { + *connflag = TCPSTATUS_CONNECTED; + } + else if (TCPSTATE_IN_SET(tcb->tcb_state,M_TCPSTATE_CONNINPROGRESS)) { + *connflag = TCPSTATUS_CONNECTING; + } + else { + *connflag = TCPSTATUS_NOTCONN; + } + } + + if (rxready) { + *rxready = rxlen; + } + + if (rxeof) { + *rxeof = 0; + if ((tcb->tcb_state == TCPSTATE_CLOSE_WAIT) || + (tcb->tcb_state == TCPSTATE_LAST_ACK)) { + *rxeof = 1; + } + } + + return 0; +} + +/* ********************************************************************* + * _tcp_debug(ti,s,arg) + * + * Perform debug functions on a socket + * + * Input parameters: + * ti - tcp information + * s - socket number + * arg - argument + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _tcp_debug(tcp_info_t *ti,int s,int arg) +{ + tcb_t *tcb; + + tcb = ti->ti_ports[s]; + if (!tcb) return CFE_ERR_INV_PARAM; + + printf("State=%d SendNext=%u SendUnack=%u ", + tcb->tcb_state,tcb->tcb_sendnext,tcb->tcb_sendunack); + printf("SendWin=%d Ack=%u Rxlen=%d\n", + tcb->tcb_sendwindow, + tcb->tcb_rcvack,tmb_curlen(&(tcb->tcb_rxbuf))); + + return 0; +} + + +#ifdef _TCP_DEBUG_ +/* ********************************************************************* + * _tcp_dumppktstate(label,flags,ack,seq,len) + * + * A debug function. + * + * Input parameters: + * label - printed before packet state + * flags - transmit flags for packet + * ack,seq,len - from the packet + * + * Return value: + * nothing + ********************************************************************* */ +static void _tcp_dumppktstate(char *label,uint16_t flags, + uint32_t ack,uint32_t seq,int len) +{ + printf("%s: ",label); + if (flags & TCPFLG_FIN) printf("FIN "); + if (flags & TCPFLG_SYN) printf("SYN "); + if (flags & TCPFLG_RST) printf("RST "); + if (flags & TCPFLG_PSH) printf("PSH "); + if (flags & TCPFLG_ACK) printf("ACK "); + if (flags & TCPFLG_URG) printf("URG "); + printf("Ack=%u Seq=%u Data=%d\n",ack,seq,len); +} +#endif + + +/* ********************************************************************* + * _tcp_output(ti,tcb) + * + * Try to perform some output on this TCB. If there is + * data to send and we can transmit it (i.e., the remote's + * receive window will allow it), segment the data from the + * buffer and transmit it, updating local state variables. + * + * Input parameters: + * ti - tcp information + * tcb - the tcb to send data on + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_output(tcp_info_t *ti,tcb_t *tcb) +{ + ebuf_t *b; + int tcplen; + int window; + uint16_t flags; + uint8_t *cksumptr; + uint8_t *tcphdr; + uint16_t cksum; + int hdrlen; + uint8_t pseudoheader[12]; + int offset; + uint32_t sendmax; + uint32_t windowmax; + uint32_t cwndmax; + + /* + * sendmax is (one plus) the highest sequence number we have + * data for. + * + * windowmax is (one plus) the highest sequence number in the + * send window. + * + * cwndmax is (one plus) the highest sequence number in the + * congestion window. + */ + + sendmax = tcb->tcb_sendunack + tmb_curlen(&(tcb->tcb_txbuf)); + windowmax = tcb->tcb_sendunack + tcb->tcb_sendwindow; + cwndmax = tcb->tcb_sendunack + 5*1400; + + /* + * We'll send up to 'sendmax', 'cwndmax', or 'windowmax' bytes, whichever + * is sooner. Set 'sendmax' to the earliest sequence number. + */ + + if (TCPSEQ_GT(sendmax,windowmax)) sendmax = windowmax; + if (TCPSEQ_GT(sendmax,cwndmax)) sendmax = cwndmax; + + /* + * The (receive) window is whatever it takes to fill the buffer. + */ + + window = tmb_remlen(&(tcb->tcb_rxbuf)); + if (window > 65000) window = 65000; + + /* + * Spit out packets until "sendnext" either catches up + * or exceeds the remote window + */ + + while (TCPSEQ_LT(tcb->tcb_sendnext,sendmax)) { + + /* + * This is the offset into the transmit buffer to start with. + * Offset 0 in the transmit buffer corresponds to "send unack" + * received acks move this pointer. + */ + + offset = tcb->tcb_sendnext - tcb->tcb_sendunack; + + /* + * Allocate a buffer and remember the pointer to where + * the header starts. + */ + + b = _ip_alloc(ti->ti_ipinfo); + if (!b) break; + + tcphdr = ebuf_ptr(b) + ebuf_length(b); + + flags = TCPFLG_ACK | TCPHDRFLG(TCP_HDR_LENGTH); + hdrlen = TCP_HDR_LENGTH; + + /* + * Fill in the fields according to the RFC. + */ + + tcb->tcb_rcvack = tcb->tcb_rcvnext; /* Update our "most recent ack" */ + + ebuf_append_u16_be(b,tcb->tcb_lclport); /* Local and remote ports */ + ebuf_append_u16_be(b,tcb->tcb_peerport); + ebuf_append_u32_be(b,tcb->tcb_sendnext); /* sequence and ack numbers */ + ebuf_append_u32_be(b,tcb->tcb_rcvack); + ebuf_append_u16_be(b,flags); /* Flags */ + ebuf_append_u16_be(b,window); /* Window size */ + cksumptr = ebuf_ptr(b) + ebuf_length(b); + ebuf_append_u16_be(b,0); /* dummy checksum for calculation */ + ebuf_append_u16_be(b,0); /* Urgent Pointer (not used) */ + + /* + * Append the data, copying pieces out of the transmit buffer + * without adjusting its pointers. + */ + + tcplen = tmb_copyout2(&(tcb->tcb_txbuf), + b->eb_ptr + b->eb_length, + offset, + tcb->tcb_mtu); + + b->eb_length += tcplen; + +#ifdef _TCP_DEBUG_ + if (_tcp_dumpflags) _tcp_dumppktstate("TX_DATA",flags, + tcb->tcb_sendnext, + tcb->tcb_rcvack,tcplen); +#endif + + /* + * Adjust the "send next" sequence number to account for what + * we're about to send. + */ + + tcb->tcb_sendnext += tcplen; + + + /* + * Build the pseudoheader, which is part of the checksum calculation + */ + + _ip_getaddr(ti->ti_ipinfo,&pseudoheader[0]); + memcpy(&pseudoheader[4],tcb->tcb_peeraddr,IP_ADDR_LEN); + pseudoheader[8] = 0; + pseudoheader[9] = IPPROTO_TCP; + pseudoheader[10] = ((tcplen+hdrlen) >> 8) & 0xFF; + pseudoheader[11] = ((tcplen+hdrlen) & 0xFF); + + /* + * Checksum the packet and insert the checksum into the header + */ + + cksum = ip_chksum(0,pseudoheader,sizeof(pseudoheader)); + cksum = ip_chksum(cksum,tcphdr,tcplen + hdrlen); + cksum = ~cksum; + cksumptr[0] = (cksum >> 8) & 0xFF; + cksumptr[1] = (cksum & 0xFF); + + /* + * Transmit the packet. The layer below us will free it. + */ + + _ip_send(ti->ti_ipinfo,b,tcb->tcb_peeraddr,IPPROTO_TCP); + + /* + * Set the timer that we'll use to wait for an acknowledgement. + * If this timer goes off, we'll rewind "sendnext" back to + * "sendunack" and transmit stuff again. + */ + + TIMER_SET(tcb->tcb_timer_retx,TCP_RETX_TIMER); + + /* + * We just sent an ack, so cancel the delayed ack timer. + */ + + tcb->tcb_flags &= ~TCB_FLG_DLYACK; + + } + +} + +/* ********************************************************************* + * _tcp_protosend(ti,tcb) + * + * Transmit "protocol messages" on the tcb. This is used for + * sending SYN, FIN, ACK, and other control packets. + * + * Input parameters: + * ti - tcp infomration + * tcb - tcb we're interested in + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_protosend(tcp_info_t *ti,tcb_t *tcb) +{ + ebuf_t *b; + int tcplen; + int window; + uint16_t flags; + uint8_t *cksumptr; + uint8_t *tcphdr; + uint16_t cksum; + int hdrlen; + uint8_t pseudoheader[12]; + + /* + * Allocate a buffer and remember the pointer to where + * the header starts. + */ + + b = _ip_alloc(ti->ti_ipinfo); + if (!b) return; + + tcphdr = ebuf_ptr(b) + ebuf_length(b); + + /* + * We're going to send something, so we can clear the flag. + * Also clear the delay-ack flag since everything's an ack. + */ + + tcb->tcb_flags &= ~(TCB_FLG_SENDMSG | TCB_FLG_DLYACK); + + /* + * Build the TCP header + */ + + /* The flags are the current flags + the header length */ + if (tcb->tcb_txflags & TCPFLG_SYN) { + flags = tcb->tcb_txflags | (TCPHDRFLG(TCP_HDR_LENGTH + 4)); + hdrlen = TCP_HDR_LENGTH + 4; + } + else { + flags = tcb->tcb_txflags | (TCPHDRFLG(TCP_HDR_LENGTH)); + hdrlen = TCP_HDR_LENGTH; + } + + +#ifdef _TCP_DEBUG_ + if (_tcp_dumpflags) _tcp_dumppktstate("TX_CTL",flags, + tcb->tcb_sendnext, + tcb->tcb_rcvack,0); +#endif + + /* + * The (receive) window is whatever it takes to fill the buffer. + */ + + window = tmb_remlen(&(tcb->tcb_rxbuf)); + if (window > 65000) window = 65000; + + /* + * Fill in the fields according to the RFC. + */ + + tcb->tcb_rcvack = tcb->tcb_rcvnext; /* update last tx ack */ + + ebuf_append_u16_be(b,tcb->tcb_lclport); /* Local and remote ports */ + ebuf_append_u16_be(b,tcb->tcb_peerport); + ebuf_append_u32_be(b,tcb->tcb_sendnext); /* sequence and ack numbers */ + ebuf_append_u32_be(b,tcb->tcb_rcvack); + ebuf_append_u16_be(b,flags); /* Flags */ + ebuf_append_u16_be(b,window); /* Window size */ + cksumptr = ebuf_ptr(b) + ebuf_length(b); + ebuf_append_u16_be(b,0); /* dummy checksum for calculation */ + ebuf_append_u16_be(b,0); /* Urgent Pointer (not used) */ + + /* + * Append TCP options on SYN packet + */ + + if (flags & TCPFLG_SYN) { + ebuf_append_u16_be(b,TCP_MAX_SEG_OPT); + ebuf_append_u16_be(b,TCP_MAX_SEG_SIZE); + } + + tcplen = 0; /* don't transmit data here */ + + /* + * SYN and FIN packets consume a sequence number, so + * increment the "sendnext" variable. If we need to retransmit + * these segments, we'll wind "sendnext" back to "sendunack" + * + * XXX: Can you send a SYN and FIN at the same time? + */ + + if (flags & (TCPFLG_SYN | TCPFLG_FIN)) tcb->tcb_sendnext++; + + /* + * Build the pseudoheader, which is part of the checksum calculation + */ + + _ip_getaddr(ti->ti_ipinfo,&pseudoheader[0]); + memcpy(&pseudoheader[4],tcb->tcb_peeraddr,IP_ADDR_LEN); + pseudoheader[8] = 0; + pseudoheader[9] = IPPROTO_TCP; + pseudoheader[10] = ((tcplen+hdrlen) >> 8) & 0xFF; + pseudoheader[11] = ((tcplen+hdrlen) & 0xFF); + + /* + * Checksum the packet and insert the checksum into the header + */ + + cksum = ip_chksum(0,pseudoheader,sizeof(pseudoheader)); + cksum = ip_chksum(cksum,tcphdr,tcplen + hdrlen); + cksum = ~cksum; + cksumptr[0] = (cksum >> 8) & 0xFF; + cksumptr[1] = (cksum & 0xFF); + + /* + * Transmit the packet. The layer below us will free it. + */ + + _ip_send(ti->ti_ipinfo,b,tcb->tcb_peeraddr,IPPROTO_TCP); +} + +/* ********************************************************************* + * _tcp_sendreset(ti,dstipaddr,ack,srcport,dstport) + * + * Transmit "protocol messages" on the tcb. This is used for + * sending SYN, FIN, ACK, and other control packets. + * + * Input parameters: + * ti - tcp infomration + * tcb - tcb we're interested in + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_sendreset(tcp_info_t *ti,uint8_t *dstipaddr,uint32_t ack, + uint16_t srcport,uint16_t dstport) +{ + tcb_t tcb; /* fake TCB so we can use _tcp_protosend */ + + memset(&tcb,0,sizeof(tcb)); + memcpy(tcb.tcb_peeraddr,dstipaddr,IP_ADDR_LEN); + tcb.tcb_peerport = dstport; + tcb.tcb_lclport = srcport; + tcb.tcb_txflags = TCPFLG_RST|TCPFLG_ACK; + tcb.tcb_rcvnext = ack; + + _tcp_protosend(ti,&tcb); +} + + +/* ********************************************************************* + * _tcp_sendctlmsg(ti,tcb,flags,timeout) + * + * Set up for and transmit a control message. This is usually + * called on a state transition where we need to send a control + * message like a SYN or FIN, with a timeout. We reset the + * retry counter, set the retransmit timer, and fire off the message + * right here. + * + * Input parameters: + * ti - tcp information + * tcb - the tcb for this TCP session + * flags - packet flags (TCPFLG_xxx) + * timeout - timeout value , in ticks + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_sendctlmsg(tcp_info_t *ti,tcb_t *tcb,uint16_t flags,int timeout) +{ + tcb->tcb_txflags = flags; + tcb->tcb_retrycnt = 0; + + if (timeout >= 0) { + if (timeout) { + TIMER_SET(tcb->tcb_timer_retx,timeout); + } + else { + TIMER_CLEAR(tcb->tcb_timer_retx); + } + } + + _tcp_protosend(ti,tcb); +} + + +/* ********************************************************************* + * _tcp_find_lclport(ti,port) + * + * Find the specified local port - mostly to see if it is + * already in use. + * + * Input parameters: + * ti - tcp information + * port - local port + * + * Return value: + * tcb owning this port, or NULL if none found + ********************************************************************* */ +static tcb_t *_tcp_find_lclport(tcp_info_t *ti,uint16_t port) +{ + tcb_t *tcb = NULL; + queue_t *qb; + + for (qb = ti->ti_tcblist.q_next; qb != &(ti->ti_tcblist); qb = qb->q_next) { + tcb = (tcb_t *) qb; + + if (tcb->tcb_lclport == port) return tcb; + + } + + return NULL; + +} + +/* ********************************************************************* + * _tcp_find_tcb(ti,srcport,dstport,saddr) + * + * Locate the TCB in the active TCBs. This is used to match + * an inbound TCP packet to a TCB. + * + * Input parameters: + * ti - tcp information + * srcport,dstport - source and dest ports from TCP header + * saddr - source IP address of sending host + * + * Return value: + * tcb pointer or NULL if no TCB was found + ********************************************************************* */ + +static tcb_t *_tcp_find_tcb(tcp_info_t *ti,uint16_t srcport,uint16_t dstport,uint8_t *saddr) +{ + tcb_t *tcb = NULL; + queue_t *qb; + + for (qb = ti->ti_tcblist.q_next; qb != &(ti->ti_tcblist); qb = qb->q_next) { + tcb = (tcb_t *) qb; + + /* Try active TCBs */ + if ((tcb->tcb_peerport != 0) && + (tcb->tcb_lclport == dstport) && + (tcb->tcb_peerport == srcport) && + (memcmp(saddr,tcb->tcb_peeraddr,IP_ADDR_LEN) == 0)) break; + } + + /* Found it on our active list. */ + if (qb != &(ti->ti_tcblist)) return tcb; + + /* no dice, try listening ports */ + for (qb = ti->ti_tcblist.q_next; qb != &(ti->ti_tcblist); qb = qb->q_next) { + tcb = (tcb_t *) qb; + + /* Try active TCBs */ + if ((tcb->tcb_peerport == 0) && + (tcb->tcb_lclport == dstport)) break; + } + + /* Found it on our passive list. */ + if (qb != &(ti->ti_tcblist)) return tcb; + + return NULL; +} + +/* ********************************************************************* + * _tcp_procack(ti,tcb,ack,flags) + * + * Process a received acknowledgement. + * + * Input parameters: + * ti - tcp information + * tcb - tcb for this tcb session + * ack - acknum from received packet + * flags - flags from received packet + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_procack(tcp_info_t *ti,tcb_t *tcb,uint32_t ack,uint16_t flags) +{ + int ackamt; + int unacklen; + + /* This is the number of unacknowledged bytes we have */ + unacklen = tmb_curlen(&(tcb->tcb_txbuf)); + + switch (tcb->tcb_state) { + + case TCPSTATE_ESTABLISHED: + /* + * The ack is valid if it's in the range of + * unacknowledged data we're holding onto. + * + * sendunack < ack <= (sendunack+datalen) + * + * Do the first comparison as "<=" instead of just "<" + * so we can catch duplicate acks. + */ + + if (!(TCPSEQ_LEQ(tcb->tcb_sendunack,ack) && + TCPSEQ_LEQ(ack,(tcb->tcb_sendunack+unacklen)))) { + DEBUGMSG(("Ack is out of range: %u\n",ack)); + return; + } + + /* + * Compute the # of bytes spanned by this ack + */ + + ackamt = TCPSEQ_DIFF(ack,tcb->tcb_sendunack); + + /* + * If we actually acked something, adjust the tx buffer + * to remove the bytes covered by the ack, then update + * the 'next' sequence number so we'll start there next + * time. + */ + + if (ackamt > 0) { + tmb_adjust(&tcb->tcb_txbuf,ackamt); + tcb->tcb_txflags = TCPFLG_ACK; + tcb->tcb_sendunack = ack; + tcb->tcb_dup_ackcnt = 0; /* not a duplicate */ + } + else { + tcb->tcb_dup_ackcnt++; + //DEBUGMSG(("Duplicate ack received\n")); + /* + * Duplicate ack received + * XXX This is where we'd be doing stuff for + * XXX slow-start, fast retransmit, etc. + */ + } + + /* + * If we're all caught up, we can cancel the + * retransmit timer. Otherwise, try to do + * some output on the interface. This will + * reset the retransmit timer if we did anything. + */ + + if (tmb_curlen(&(tcb->tcb_txbuf)) != 0) { + tcb->tcb_flags |= TCB_FLG_OUTPUT; + } + else { + TIMER_CLEAR(tcb->tcb_timer_retx); + } + + break; + + case TCPSTATE_FINWAIT_1: + ackamt = TCPSEQ_DIFF(ack,tcb->tcb_sendunack); + if (ackamt == 1) { + tcb->tcb_sendunack = ack; + if (flags & TCPFLG_FIN) { + _tcp_setstate(tcb,TCPSTATE_TIME_WAIT); + _tcp_canceltimers(tcb); + _tcp_preparectlmsg(tcb,TCPFLG_ACK); + TIMER_SET(tcb->tcb_timer_2msl,TCP_TIMEWAIT_TIMER); + } + else { + _tcp_setstate(tcb,TCPSTATE_FINWAIT_2); + } + } + break; + + } +} + +/* ********************************************************************* + * _tcp_procdata(ti,tcb,seqnum,flags,buf) + * + * Process data in a received TCP packet - we'll put the + * data into the receive ring buffer, process the seqnum + * field, and prepare to send an ack. + * + * Input parameters: + * ti - tcp information + * tcb - tcb describing TCP session + * seqnum,flags - from the header of the received TCP packet + * buf - ebuf contianing data + * + * Return value: + * nothing + ********************************************************************* */ + +static void _tcp_procdata(tcp_info_t *ti,tcb_t *tcb,uint32_t seqnum, + uint16_t flags,ebuf_t *buf) +{ + int datalen; + uint8_t *bp; + int rxwin,rwin; + uint32_t endseqnum; + uint32_t endrxwindow; + int reallen; + + /* + * Figure out how much we're going to take. This should not + * exceed our buffer size because we advertised a window + * only big enough to fill our buffer. + */ + + bp = ebuf_ptr(buf); /* pointer to TCP data */ + datalen = ebuf_remlen(buf); /* Size of TCP data */ + + /* + * If there's no data in the buffer, we can skip the data-related + * stuff and check for a possible FIN. + */ + + if (datalen != 0) { + + /* + * Figure out if the data fits within the window. We don't deal + * with out-of-order segments, so the test is relatively + * simple: The received segment must contain (or match) + * the sequence number from "rcvnext" to the end of the receive + * window. + * + * Therefore: seqnum <= rcvnext < seqnum+datalen + */ + + rxwin = tmb_remlen(&(tcb->tcb_rxbuf)); /* receive window size */ + endseqnum = (seqnum + datalen); /* seq # of end of segment */ + endrxwindow = tcb->tcb_rcvack + rxwin; /* end of receive window */ + + /* + * The segment might include data outside the receive window + * (it's not supposed to, but it can). Crop the 'endseqnum' + * value at the rx window if necessary. Keep the earlier seqnum. + */ +// +// XXX This is just plain broken - "endrxwindow" is the wrong thing to test. +// if (TCPSEQ_LT(endrxwindow,endseqnum)) { +// endseqnum = endrxwindow; +// } + + /* + * Test to see if the data is in sequence. + */ + + rwin = (TCPSEQ_LEQ(seqnum,tcb->tcb_rcvnext) && + TCPSEQ_LT(tcb->tcb_rcvnext,endseqnum)); + + if (!rwin) { + DEBUGMSG(("Dropping out-of-order packet %u %u %u\n",seqnum, + tcb->tcb_rcvnext,endseqnum)); + return; + } + + /* + * The actual amount of new data is the distance from + * the "rcvnext" pointer to the end sequence number. + * typically this will be the entire packet, but we + * handle the case of receiving a partial duplicate segment. + * Do this by shortening the data length we're going to + * copy and adjusting the buffer pointer to point past the + * duplicate data. Normally this won't do anything. + */ + + reallen = endseqnum - tcb->tcb_rcvnext; + bp += (tcb->tcb_rcvnext - seqnum); + + if (reallen != datalen) { + DEBUGMSG(("newdata(%d) does not match real length(%d)\n",reallen,datalen)); + } + + if (reallen > 0) { + + /* + * Copy the data into the receive buffer. In the + * unlikely event that it doesn't fit, update the + * length so we'll only ack what we took. + */ + + reallen = tmb_copyin(&(tcb->tcb_rxbuf),bp,reallen,TRUE); + + tcb->tcb_rcvnext += reallen; + + /* + * Set the delayed-ack flag. If it's already set, + * then we've already received some data without acking + * it, so send the ack now, to encourage us to + * ack every other segment at least. + */ + + if (tcb->tcb_flags & TCB_FLG_DLYACK) { + _tcp_preparectlmsg(tcb,TCPFLG_ACK); + } + else { + tcb->tcb_flags |= TCB_FLG_DLYACK; + } + } + } + + /* + * Handle the case of data in a FIN packet. + */ + + if (flags & TCPFLG_FIN) { + + tcb->tcb_rcvnext++; /* Consume the FIN */ + + DEBUGMSG(("FIN rcvd in %d ack %u\n",tcb->tcb_state,tcb->tcb_rcvnext)); + + switch (tcb->tcb_state) { + case TCPSTATE_ESTABLISHED: + + /* + * If a FIN is received in the ESTABLISHED state, + * go to CLOSE_WAIT. + */ + + tcb->tcb_flags &= ~TCB_FLG_DLYACK; + _tcp_setstate(tcb,TCPSTATE_CLOSE_WAIT); + _tcp_sendctlmsg(ti,tcb,TCPFLG_ACK,-1); + break; + + case TCPSTATE_FINWAIT_1: + + /* + * Two choices: Either we got a FIN or a FIN ACK. + * In either case, send an ack. The difference + * is what state we end up in. + */ + + if (flags & TCPFLG_ACK) { + /* Received: FIN ACK - go directly to TIME_WAIT */ + _tcp_canceltimers(tcb); + _tcp_preparectlmsg(tcb,TCPFLG_ACK); + _tcp_setstate(tcb,TCPSTATE_TIME_WAIT); +#if defined(CONFIG_MIPS_BRCM) + TIMER_SET(tcb->tcb_timer_2msl,TCP_SEND_TIMER); +#else + TIMER_SET(tcb->tcb_timer_2msl,TCP_TIMEWAIT_TIMER); +#endif + } + else { + /* Received: FIN - simultaneous close, go to CLOSING */ + _tcp_setstate(tcb,TCPSTATE_CLOSING); + _tcp_preparectlmsg(tcb,TCPFLG_ACK); + } + break; + + case TCPSTATE_FINWAIT_2: + + /* + * Received a FIN in FINWAIT_2 - just transmit + * an ack and go to TIME_WAIT. + */ + + _tcp_canceltimers(tcb); + _tcp_preparectlmsg(tcb,TCPFLG_ACK); + _tcp_setstate(tcb,TCPSTATE_TIME_WAIT); + TIMER_SET(tcb->tcb_timer_2msl,TCP_TIMEWAIT_TIMER); + break; + } + } + +} + +/* ********************************************************************* + * _tcp_rx_callback(ref,buf,destaddr,srcaddr) + * + * The IP layer calls this routine when a TCP packet is received. + * We dispatch the packet to appropriate handlers from here. + * + * Input parameters: + * ref - our tcp information (held by the ip stack for us) + * buf - the ebuf that we received + * destaddr,srcaddr - destination and source IP addresses + * + * Return value: + * ETH_DROP or ETH_KEEP, depending if we keep the packet or not + ********************************************************************* */ + +static int _tcp_rx_callback(void *ref,ebuf_t *buf,uint8_t *destaddr,uint8_t *srcaddr) +{ + uint8_t pseudoheader[12]; + int tcplen; + uint16_t calccksum; + uint16_t origcksum; + uint8_t *tcphdr; + uint16_t srcport; + uint16_t dstport; + uint32_t seqnum; + uint32_t acknum; + uint16_t window; + uint16_t flags; + tcb_t *tcb; + tcp_info_t *ti = (tcp_info_t *) ref; + + /* + * get a pointer to the TCP header + */ + + tcplen = ebuf_length(buf); + tcphdr = ebuf_ptr(buf); + + /* + * construct the pseudoheader for the cksum calculation + */ + + memcpy(&pseudoheader[0],srcaddr,IP_ADDR_LEN); + memcpy(&pseudoheader[4],destaddr,IP_ADDR_LEN); + pseudoheader[8] = 0; + pseudoheader[9] = IPPROTO_TCP; + pseudoheader[10] = (tcplen >> 8) & 0xFF; + pseudoheader[11] = (tcplen & 0xFF); + + origcksum = ((uint16_t) tcphdr[16] << 8) | (uint16_t) tcphdr[17]; + tcphdr[16] = tcphdr[17] = 0; + + calccksum = ip_chksum(0,pseudoheader,sizeof(pseudoheader)); + calccksum = ip_chksum(calccksum,tcphdr,tcplen); + calccksum = ~calccksum; + + if (calccksum != origcksum) { + return ETH_DROP; + } + + /* Read the other TCP header fields from the packet */ + + ebuf_get_u16_be(buf,srcport); + ebuf_get_u16_be(buf,dstport); + ebuf_get_u32_be(buf,seqnum); + ebuf_get_u32_be(buf,acknum); + ebuf_get_u16_be(buf,flags); + ebuf_get_u16_be(buf,window); + ebuf_skip(buf,4); /* skip checksum and urgent pointer */ + + /* Skip options in header */ + if (TCPHDRSIZE(flags) < TCP_HDR_LENGTH) { + return ETH_DROP; + } + ebuf_skip(buf,(TCPHDRSIZE(flags) - TCP_HDR_LENGTH)); + + /* + * Okay, start looking for a matching TCB. If no matching TCB, + * send a RST. + * XXX Extra credit: rate-limit the RSTs. + */ + + tcb = _tcp_find_tcb(ti,srcport,dstport,srcaddr); + if (!tcb) { + DEBUGMSG(("Invalid TCB from %I, srcport=%u dstport=%u\n",srcaddr,srcport,dstport)); + _tcp_sendreset(ti,srcaddr,seqnum+1,dstport,srcport); + return ETH_DROP; /* drop packet if no matching port */ + } + + /* + * Any activity on a TCB is enough to reset the keepalive timer + */ + + if (TCPSTATE_IN_SET(tcb->tcb_state,M_TCPSTATE_RESETKEEPALIVE)) { + TIMER_SET(tcb->tcb_timer_keep,TCP_KEEPALIVE_TIMER); + } + + /* + * Some debugging + */ + +#ifdef _TCP_DEBUG_ + if (_tcp_dumpflags) _tcp_dumppktstate("Received",flags, + acknum,seqnum,ebuf_length(buf)); +#endif + + /* + * If someone tries to reset us, just kill off the port. + * (except: if we were in SYN_RECEIVED, go back to LISTEN) + */ + + if (flags & TCPFLG_RST) { + if (tcb->tcb_state == TCPSTATE_SYN_RECEIVED) { + _tcp_setstate(tcb,TCPSTATE_LISTEN); + } + else { + _tcp_closetcb(ti,tcb); + } + return ETH_DROP; + } + + /* + * Remember the window we got. + */ + + tcb->tcb_sendwindow = window; + + /* + * What we do here depends on the current connection state + * Most of this is just from the connection state diagram we've + * all see way too often. + */ + + switch ( tcb->tcb_state ) { + + case TCPSTATE_LISTEN: + if (flags & TCPFLG_SYN) { + tcb->tcb_rcvnext = seqnum + 1; + tcb->tcb_peerport = srcport; + memcpy(tcb->tcb_peeraddr,srcaddr,IP_ADDR_LEN); + TIMER_SET(tcb->tcb_timer_keep,TCP_KEEPALIVE_TIMER); + _tcp_setstate(tcb,TCPSTATE_SYN_RECEIVED); + _tcp_sendctlmsg(ti,tcb,TCPFLG_SYN | TCPFLG_ACK,TCP_RETX_TIMER); + } + return ETH_DROP; /* we ignore everything else */ + break; + + case TCPSTATE_SYN_SENT: + + /* + * The only packets we pay attention to in SYN_SENT + * are packets with SYN flags. + */ + if (flags & TCPFLG_SYN) { + + /* + * Two choices: Either we got a SYN ACK (normal) + * or just a SYN (simultaneous open, rare) + */ + + if ((flags & TCPFLG_ACK) && + (acknum == (tcb->tcb_sendunack + 1))) { + /* + * If we received a SYN ACK and the acknum + * matches our SYN's seqnum + 1, we want + * to transition from SYN_SENT to ESTABLISHED. + */ + TIMER_SET(tcb->tcb_timer_keep,TCP_KEEPALIVE_TIMER); + _tcp_setstate(tcb,TCPSTATE_ESTABLISHED); + tcb->tcb_sendunack = acknum; + tcb->tcb_sendnext = tcb->tcb_sendunack; + tcb->tcb_rcvnext = seqnum + 1; + /* + * Send an ack, but don't bother with the timer. + * If the remote does not get our ack, it will + * retransmit the SYN ACK and we'll ack it from + * the "ESTABLISHED" state. + * Actually, is that really true? + */ + _tcp_sendctlmsg(ti,tcb,TCPFLG_ACK,0); + } + else { + DEBUGMSG(("Simultaneous open: SYN received in SYN_SENT state\n")); + tcb->tcb_rcvnext++; /* consume the SYN */ + _tcp_setstate(tcb,TCPSTATE_SYN_RECEIVED); + _tcp_sendctlmsg(ti,tcb,TCPFLG_SYN|TCPFLG_ACK,TCP_RETX_TIMER); + } + } + + return ETH_DROP; + break; + + case TCPSTATE_SYN_RECEIVED: + /* + * If we've received a SYN and someone sends us a SYN, + * and the sequence numbers don't match, + * send back a SYN ACK. (this doesn't sound right, + * does it? It's sort of what we do from LISTEN) + */ + + if (flags & TCPFLG_SYN) { + _tcp_sendctlmsg(ti,tcb,TCPFLG_SYN | TCPFLG_ACK,TCP_RETX_TIMER); + } + + /* + * If we got an ack and the acknum is correct, + * switch the state to 'ESTABLISHED' and cancel + * the timer. We're ready to rock. + */ + + if ((flags & TCPFLG_ACK) && + (acknum == (tcb->tcb_sendunack + 1))) { + _tcp_sendctlmsg(ti,tcb,TCPFLG_ACK,0); + tcb->tcb_sendunack = acknum; + tcb->tcb_sendnext = tcb->tcb_sendunack; + TIMER_SET(tcb->tcb_timer_keep,TCP_KEEPALIVE_TIMER); + _tcp_setstate(tcb,TCPSTATE_ESTABLISHED); + } + + return ETH_DROP; + break; + + case TCPSTATE_ESTABLISHED: + case TCPSTATE_FINWAIT_1: + case TCPSTATE_FINWAIT_2: + + /* + * ESTABLISHED, FINWAIT_1, and FINWAIT_2 can all + * carry data. Process the data here. If the + * segment also contains a FIN, these routines + * will handle that. + */ + + if (flags & TCPFLG_ACK) { + _tcp_procack(ti,tcb,acknum,flags); + } + _tcp_procdata(ti,tcb,seqnum,flags,buf); + break; + + case TCPSTATE_CLOSING: + if (acknum == (tcb->tcb_sendunack + 1)) { + _tcp_setstate(tcb,TCPSTATE_TIME_WAIT); + _tcp_canceltimers(tcb); + TIMER_SET(tcb->tcb_timer_2msl,TCP_TIMEWAIT_TIMER); + } + break; + + case TCPSTATE_LAST_ACK: + if (acknum == (tcb->tcb_sendunack + 1)) { + /* Ack matches, just close the TCB here. */ + _tcp_closetcb(ti,tcb); + /* and free it. */ + _tcp_freetcb(ti,tcb); + } + else { + _tcp_sendctlmsg(ti,tcb,TCPFLG_ACK | TCPFLG_FIN,TCP_RETX_TIMER); + } + break; + + case TCPSTATE_TIME_WAIT: + if (!(flags & TCPFLG_RST)) { + tcb->tcb_txflags = TCPFLG_ACK; + TIMER_SET(tcb->tcb_timer_2msl,TCP_TIMEWAIT_TIMER); + _tcp_protosend(ti,tcb); + } + break; + } + + /* + * If we're expected to transmit something, do it now. + */ + + if (tcb->tcb_flags & TCB_FLG_OUTPUT) { + _tcp_output(ti,tcb); + tcb->tcb_flags &= ~(TCB_FLG_OUTPUT | TCB_FLG_SENDMSG); + } + + if (tcb->tcb_flags & TCB_FLG_SENDMSG) { + _tcp_protosend(ti,tcb); + } + + /* We always make a copy of the data, so drop the packet. */ + return ETH_DROP; +} + +/* ********************************************************************* + * _tcp_fasttimo(ti) + * + * Handle "fast timeout" for active TCP sockets. + * + * Input parameters: + * ti - tcp_info structure + * + * Return value: + * nothing + ********************************************************************* */ +static void _tcp_fasttimo(tcp_info_t *ti) +{ + tcb_t *tcb; + queue_t *qb; + + /* + * First, reset the timer so we'll end up here + * again in another 200ms + */ + + TIMER_SET(ti->ti_fasttimer,TCP_FAST_TIMER); /* 200ms */ + + /* + * Now, walk down the list of TCBs and handle + * all the timers. + */ + + for (qb = ti->ti_tcblist.q_next; qb != &(ti->ti_tcblist); qb = qb->q_next) { + tcb = (tcb_t *) qb; + if (tcb->tcb_flags & TCB_FLG_DLYACK) { + tcb->tcb_flags &= ~TCB_FLG_DLYACK; + _tcp_sendctlmsg(ti,tcb,TCPFLG_ACK,-1); + } + } + + /* + * While we're here, increment TCP's initial sequence number. + * BSD suggests 128000 every second, so we'll add 25600 every 200ms. + */ + + ti->ti_iss += 25600; + +} + + +/* ********************************************************************* + * _tcp_poll(arg) + * + * CFE calls this routine periodically to allow us to check + * and update timers, etc. + * + * Input parameters: + * arg - our tcp information (held by the timer module for us) + * + * Return value: + * nothing + ********************************************************************* */ + +void _tcp_poll(void *arg) +{ + tcb_t *tcb; + queue_t *qb; + tcp_info_t *ti = (tcp_info_t *) arg; + + /* + * Handle the "fast" timer. We do this every 200ms + */ + + if (TIMER_EXPIRED(ti->ti_fasttimer)) { + _tcp_fasttimo(ti); + /* timer will be reset by the _tcp_fasttimo routine */ + } + + /* + * Check the TCBs for the "slow" timers. + */ + + for (qb = ti->ti_tcblist.q_next; qb != &(ti->ti_tcblist); qb = qb->q_next) { + tcb = (tcb_t *) qb; + + /* + * Check the retransmit timer. This is used during connection + * attempts to retransmit control messages, or also during + * regular data transfer to retransmit messages that are not + * acknowledged. + * + * XXX use the computed round-trip timer here + */ + + if (TIMER_EXPIRED(tcb->tcb_timer_retx)) { + TIMER_CLEAR(tcb->tcb_timer_retx); /* unless it is reset */ + + DEBUGMSG(("Retransmit timer expired, retrycnt=%d\n",tcb->tcb_retrycnt)); + + switch (tcb->tcb_state) { + case TCPSTATE_ESTABLISHED: + /* + * wind the send seqnum back to the last unacknowledged data, + * and send it out again. + */ + TIMER_SET(tcb->tcb_timer_retx,TCP_RETX_TIMER); + tcb->tcb_retrycnt++; + tcb->tcb_sendnext = tcb->tcb_sendunack; + _tcp_output(ti,tcb); + break; + + case TCPSTATE_SYN_SENT: + TIMER_SET(tcb->tcb_timer_retx,(TCP_RETX_TIMER << tcb->tcb_retrycnt)); + tcb->tcb_retrycnt++; + tcb->tcb_sendnext = tcb->tcb_sendunack; + _tcp_protosend(ti,tcb); + break; + + } + } + + /* + * Check the keepalive timer. This is used during connection + * attempts to time out the connection, and _can_ be used for + * keepalives during established sessions. + * + * Our TCP does not bother with keepalive messages. + */ + + if (TIMER_EXPIRED(tcb->tcb_timer_keep)) { + TIMER_CLEAR(tcb->tcb_timer_keep); /* unless it is reset */ + DEBUGMSG(("Keepalive timer expired in state %d\n",tcb->tcb_state)); + if (TCPSTATE_IN_SET(tcb->tcb_state,M_TCPSTATE_CONNINPROGRESS)) { + DEBUGMSG(("Canceling pending connection\n")); + _tcp_aborttcb(ti,tcb); + } + } + + /* + * Check the 2MSL timer. This is used in the TIME_WAIT state + * to return the tcb to the free list after the time wait + * period elapses. + */ + + if (TIMER_EXPIRED(tcb->tcb_timer_2msl)) { + TIMER_CLEAR(tcb->tcb_timer_2msl); /* will not be reset */ + DEBUGMSG(("2MSL timer expired in state %d\n",tcb->tcb_state)); + if (tcb->tcb_state == TCPSTATE_TIME_WAIT) { + DEBUGMSG(("Freeing TCB\n")); + _tcp_closetcb(ti,tcb); + _tcp_freetcb(ti,tcb); + } + } + + } + +} + + diff --git a/cfe/cfe/net/net_tcp.h b/cfe/cfe/net/net_tcp.h new file mode 100755 index 0000000..fa772e6 --- /dev/null +++ b/cfe/cfe/net/net_tcp.h @@ -0,0 +1,83 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * TCP Protocol Definitions File: net_tcp.h + * + * This file contains TCP protocol-specific definitions + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * TCP Flags - keep in sync with net_api.h + ********************************************************************* */ + +#define TCPFLG_NODELAY 1 /* disable nagle */ +#define TCPFLG_NBIO 2 /* Non-blocking I/O */ + +#define TCPSTATUS_NOTCONN 0 +#define TCPSTATUS_CONNECTING 1 +#define TCPSTATUS_CONNECTED 2 + +/* ********************************************************************* + * TCP API + ********************************************************************* */ + +typedef struct tcp_info_s tcp_info_t; + +tcp_info_t *_tcp_init(ip_info_t *ipi,void *ref); +void _tcp_uninit(tcp_info_t *info); + +int _tcp_socket(tcp_info_t *info); +int _tcp_connect(tcp_info_t *ti,int s,uint8_t *dest,uint16_t port); +int _tcp_close(tcp_info_t *ti,int s); +int _tcp_send(tcp_info_t *ti,int s,uint8_t *buf,int len); +int _tcp_recv(tcp_info_t *ti,int s,uint8_t *buf,int len); +int _tcp_bind(tcp_info_t *ti,int s,uint16_t port); +int _tcp_peeraddr(tcp_info_t *ti,int s,uint8_t *addr,uint16_t *port); +int _tcp_listen(tcp_info_t *ti,int s,uint16_t port); +int _tcp_status(tcp_info_t *ti,int s,unsigned int *connflag,int *rxready,int *rxeof); +int _tcp_debug(tcp_info_t *ti,int s,int arg); +int _tcp_setflags(tcp_info_t *ti,int s,unsigned int flags); +int _tcp_getflags(tcp_info_t *ti,int s,unsigned int *flags); + +void _tcp_poll(void *arg); + + diff --git a/cfe/cfe/net/net_tcp_internal.h b/cfe/cfe/net/net_tcp_internal.h new file mode 100755 index 0000000..1e3fc6d --- /dev/null +++ b/cfe/cfe/net/net_tcp_internal.h @@ -0,0 +1,244 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * TCP Protocol Internal Definitions File: net_tcp_internal.h + * + * This file contains the structures and constants needed to + * maintain TCP connections. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +/* ********************************************************************* + * TCP Constants + ********************************************************************* */ + + +#define TCP_MAX_PORTS 8 +#define TCP_MAX_TCBS 16 +#if defined(CONFIG_MIPS_BRCM) +#define TCP_BUF_SIZE (20 * 1024) +#else +#define TCP_BUF_SIZE 65536 +#endif + +#define TCP_MAX_SEG_SIZE 1400 + +#define TCP_CONNECT_TIMER (30*CFE_HZ) +#define TCP_RETX_TIMER (1*CFE_HZ) +#define TCP_TIMEWAIT_TIMER (30*CFE_HZ) +#define TCP_SEND_TIMER (CFE_HZ) + +#define TCP_FAST_TIMER (CFE_HZ/5) /* 200ms */ +#define TCP_KEEPALIVE_TIMER (CFE_HZ*60) /* one minute */ + + +/* ********************************************************************* + * TCP Protocol + ********************************************************************* */ + +#define TCPFLG_FIN 0x0001 +#define TCPFLG_SYN 0x0002 +#define TCPFLG_RST 0x0004 +#define TCPFLG_PSH 0x0008 +#define TCPFLG_ACK 0x0010 +#define TCPFLG_URG 0x0020 +#define TCPHDRSIZE(flg) (((flg) >> 12)*4) +#define TCPHDRFLG(size) (((size)/4)<<12) + +#define TCP_HDR_LENGTH 20 + +#define TCP_MAX_SEG_OPT 0x0204 + +/* ********************************************************************* + * TCP State machine + ********************************************************************* */ + +/* + * TCB states, see RFC + */ + +#define TCPSTATE_CLOSED 0 +#define TCPSTATE_LISTEN 1 +#define TCPSTATE_SYN_SENT 2 +#define TCPSTATE_SYN_RECEIVED 3 +#define TCPSTATE_ESTABLISHED 4 +#define TCPSTATE_CLOSE_WAIT 5 +#define TCPSTATE_FINWAIT_1 6 +#define TCPSTATE_FINWAIT_2 7 +#define TCPSTATE_CLOSING 8 +#define TCPSTATE_LAST_ACK 9 +#define TCPSTATE_TIME_WAIT 10 + +/* + * Masks for TCP states - we use these so we can make + * bit vectors of states for easy tests. + */ + +#define M_TCPSTATE_CLOSED (1 << TCPSTATE_CLOSED) +#define M_TCPSTATE_LISTEN (1 << TCPSTATE_LISTEN) +#define M_TCPSTATE_SYN_SENT (1 << TCPSTATE_SYN_SENT) +#define M_TCPSTATE_SYN_RECEIVED (1 << TCPSTATE_SYN_RECEIVED) +#define M_TCPSTATE_ESTABLISHED (1 << TCPSTATE_ESTABLISHED) +#define M_TCPSTATE_CLOSE_WAIT (1 << TCPSTATE_CLOSE_WAIT) +#define M_TCPSTATE_FINWAIT_1 (1 << TCPSTATE_FINWAIT_1) +#define M_TCPSTATE_FINWAIT_2 (1 << TCPSTATE_FINWAIT_2) +#define M_TCPSTATE_CLOSING (1 << TCPSTATE_CLOSING) +#define M_TCPSTATE_LAST_ACK (1 << TCPSTATE_LAST_ACK) +#define M_TCPSTATE_TIME_WAIT (1 << TCPSTATE_TIME_WAIT) +#define M_TCPSTATE_CLOSED (1 << TCPSTATE_CLOSED) + +/* + * This macro returns true if a given state is in a + * set of states (defined below) + */ + +#define TCPSTATE_IN_SET(state,set) ((1 << (state)) & (set)) + +/* + * Intresting groups of TCP states + */ + +/* ABORTSTATES - tcp_abort will send a RST if our TCB is one of these. */ +#define M_TCPSTATE_ABORTSTATES \ + M_TCPSTATE_SYN_SENT | M_TCPSTATE_SYN_RECEIVED | M_TCPSTATE_ESTABLISHED | \ + M_TCPSTATE_FINWAIT_1 | M_TCPSTATE_FINWAIT_2 | M_TCPSTATE_CLOSING | \ + M_TCPSTATE_LAST_ACK | M_TCPSTATE_CLOSE_WAIT + +/* SEND_OK - tcp_send will send data if our TCB is one of these */ +#define M_TCPSTATE_SEND_OK \ + M_TCPSTATE_ESTABLISHED | M_TCPSTATE_CLOSE_WAIT + +/* RECV_OK - tcp_recv will pass up data if our TCB is in one of these */ +#define M_TCPSTATE_RECV_OK \ + M_TCPSTATE_ESTABLISHED | M_TCPSTATE_CLOSE_WAIT + +/* PEERADDR_OK - tcp_peeraddr will return a value if TCB is in one of these */ +#define M_TCPSTATE_PEERADDR_OK \ + M_TCPSTATE_SYN_SENT | M_TCPSTATE_SYN_RECEIVED | M_TCPSTATE_ESTABLISHED | \ + M_TCPSTATE_FINWAIT_1 | M_TCPSTATE_FINWAIT_2 | M_TCPSTATE_CLOSING | \ + M_TCPSTATE_LAST_ACK | M_TCPSTATE_CLOSE_WAIT + +/* RESETKEEPALIVE - reset keepalive timer in these states */ +#define M_TCPSTATE_RESETKEEPALIVE \ + M_TCPSTATE_ESTABLISHED | M_TCPSTATE_CLOSE_WAIT | M_TCPSTATE_FINWAIT_1 | \ + M_TCPSTATE_FINWAIT_2 | M_TCPSTATE_CLOSING | M_TCPSTATE_LAST_ACK + +#define CONNINPROGRESS - connection is in progress in these states */ +#define M_TCPSTATE_CONNINPROGRESS \ + M_TCPSTATE_LISTEN | M_TCPSTATE_SYN_SENT | M_TCPSTATE_SYN_RECEIVED + + +/* + * TCP flags for the control block + */ + +#define TCB_FLG_OUTPUT 1 /* need to call tcp_output */ +#define TCB_FLG_SENDMSG 2 +#define TCB_FLG_DLYACK 4 /* delayed ack is pending */ + +/* ********************************************************************* + * TCP Control Block + ********************************************************************* */ + +typedef struct tcb_s { + queue_t tcb_qb; /* next/previous in list */ + int tcb_socknum; /* socket number, index into table */ + + int tcb_state; /* current connection state */ + + uint8_t tcb_peeraddr[IP_ADDR_LEN]; /* Peer's IP Address */ + uint16_t tcb_peerport; /* Peer's port address */ + uint16_t tcb_lclport; /* My port address */ + + uint16_t tcb_txflags; /* packet flags for next tx packet */ + + cfe_timer_t tcb_timer_2msl; /* 2MSL timer, used in TIME_WAIT */ + cfe_timer_t tcb_timer_keep; /* Timer for keepalives and connections */ + cfe_timer_t tcb_timer_retx; /* send retransmission timer */ + cfe_timer_t tcb_timer_pers; /* Persist timer */ + + int tcb_retrycnt; /* Retry counter */ + + int tcb_mtu; /* MTU if underlying link */ + unsigned int tcb_flags; /* Misc protocol flags */ + unsigned int tcb_sockflags; /* flags set by user api */ + + /* + * Buffers + */ + + tcpmodbuf_t tcb_txbuf; /* Transmit buffer */ + tcpmodbuf_t tcb_rxbuf; /* Receive buffer */ + + /* + * Send sequence variables + */ + + uint32_t tcb_sendunack; /* oldest unacknowledged seqnum */ + uint32_t tcb_sendnext; /* Next seqnum to send */ + uint32_t tcb_sendwindow; /* Last advertised send window */ + + /* + * Receive sequence variables + */ + + uint32_t tcb_rcvnext; /* next in-order receive seq num */ + uint32_t tcb_rcvack; /* last transmitted acknowledgement */ + + /* + * Window management variables + */ + int tcb_dup_ackcnt; /* Duplicate ack counter */ + +} tcb_t; + +/* ********************************************************************* + * Macros to muck with sequence numbers + ********************************************************************* */ + +#define TCPSEQ_LT(a,b) ((int)((a)-(b)) < 0) +#define TCPSEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) +#define TCPSEQ_GT(a,b) ((int)((a)-(b)) > 0) +#define TCPSEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) + +#define TCPSEQ_DIFF(a,b) ((int)((a)-(b))) + diff --git a/cfe/cfe/net/net_tcpbuf.c b/cfe/cfe/net/net_tcpbuf.c new file mode 100644 index 0000000..08e690b --- /dev/null +++ b/cfe/cfe/net/net_tcpbuf.c @@ -0,0 +1,298 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * TCP Protocol File: net_tcp.c + * + * This file contains a very simple TCP. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_error.h" + +#include "net_tcpbuf.h" + + + +/* ********************************************************************* + * tmb_init(buf) + * + * Initialize a modulo buffer's pointers to the "empty" state + * + * Input parameters: + * buf - modulo buffer structure + * + * Return value: + * nothing + ********************************************************************* */ + +void tmb_init(tcpmodbuf_t *buf) +{ + buf->tmb_addptr = 0; + buf->tmb_remptr = 0; + buf->tmb_len = 0; +} + +/* ********************************************************************* + * tmb_adjust(buf,amt) + * + * Move the "remove" pointer ahead by 'amt' without retrieving the + * data. + * + * Input parameters: + * buf - modulo buffer structure + * amt - number of bytes to move + * + * Return value: + * nothing + ********************************************************************* */ + + +void tmb_adjust(tcpmodbuf_t *buf,int amt) +{ + /* XXX should we check for moving to far? */ + buf->tmb_len -= amt; + buf->tmb_remptr = (buf->tmb_remptr + amt) % buf->tmb_bufsize; +} + +/* ********************************************************************* + * tmb_alloc(buf,size) + * + * Allocate memory for the modulo buffer. + * + * Input parameters: + * buf - modulo buffer structure + * size - size of data in modulo buffer + * + * Return value: + * 0 if ok + * -1 if error + ********************************************************************* */ + +int tmb_alloc(tcpmodbuf_t *buf,int size) +{ + buf->tmb_buf = KMALLOC(size,0); + if (!buf->tmb_buf) return -1; + buf->tmb_bufsize = size; + + tmb_init(buf); + + return 0; +} + +/* ********************************************************************* + * tmb_free(buf) + * + * Free memory associated with the modulo buffer + * + * Input parameters: + * buf - modulo buffer + * + * Return value: + * nothing + ********************************************************************* */ + +void tmb_free(tcpmodbuf_t *buf) +{ + if (buf->tmb_buf) KFREE(buf->tmb_buf); + buf->tmb_buf = NULL; +} + + +/* ********************************************************************* + * tmb_copyin(tmb,buf,len,update) + * + * Copy data into the modulo buffer at the 'add' pointer + * + * Input parameters: + * tmb - modulo buffer structure + * buf,len - buffer and length of buffer to copy in + * update - true to advance 'add' pointer (usually true for copyin) + * + * Return value: + * number of bytes actually added to the buffer + ********************************************************************* */ + +int tmb_copyin(tcpmodbuf_t *tmb,uint8_t *buf,int len,int update) +{ + int maxlen; + int l; + int newptr; + int retlen; + + if (len == 0) return 0; + + /* Set 'maxlen' to the max # of bytes we will send now */ + maxlen = tmb->tmb_bufsize - tmb->tmb_len; + if (maxlen > len) maxlen = len; + + retlen = maxlen; /* we'll return this later. */ + + /* Copy the bytes into the buffer and deal with buffer wrap */ + l = tmb->tmb_bufsize - tmb->tmb_addptr; + if (l > maxlen) l = maxlen; + + memcpy(tmb->tmb_buf + tmb->tmb_addptr,buf,l); + maxlen -= l; + buf += l; + + if (maxlen) { + memcpy(tmb->tmb_buf,buf,maxlen); + newptr = maxlen; + } + else { + newptr = tmb->tmb_addptr + l; + } + + if (update) { + tmb->tmb_len += retlen; /* this many more in the buffer */ + tmb->tmb_addptr = newptr; + } + + return retlen; +} + +/* ********************************************************************* + * tmb_copyout(tmb,buf,len,update) + * + * Copy data out of the modulo buffer from the 'remove' pointer + * + * Input parameters: + * tmb - modulo buffer structure + * buf,len - buffer and length of buffer to copy out + * update - true to advance 'remove' pointer + * + * Return value: + * number of bytes actually removed from the buffer + ********************************************************************* */ + +int tmb_copyout(tcpmodbuf_t *tmb,uint8_t *buf,int len,int update) +{ + int maxlen; + int l; + int newptr; + int retlen; + + /* Compute how many bytes to return */ + maxlen = tmb->tmb_len; + if (maxlen > len) maxlen = len; + + retlen = maxlen; + + l = tmb->tmb_bufsize - tmb->tmb_remptr; + if (l > maxlen) l = maxlen; + + memcpy(buf,tmb->tmb_buf + tmb->tmb_remptr,l); + buf += l; + maxlen -= l; + + if (maxlen) { + memcpy(buf,tmb->tmb_buf,maxlen); + newptr = maxlen; + } + else { + newptr = tmb->tmb_remptr + l; + } + + if (update) { + tmb->tmb_len -= retlen; + tmb->tmb_remptr = newptr; + } + + return retlen; +} + +/* ********************************************************************* + * tmb_copyout2(tmb,buf,offset,len) + * + * Copy data out of the modulo buffer from a specific offset from + * the remove pointer. This is done without updating the + * remove pointer - we use this to dig data out when segmenting + * packets for transmission. + * + * Input parameters: + * tmb - modulo buffer structure + * buf,len - buffer and length of buffer to copy out + * offset - offset from remove pointer to start + * + * Return value: + * number of bytes actually copied out of the buffer + ********************************************************************* */ + +int tmb_copyout2(tcpmodbuf_t *tmb,uint8_t *buf,int offset,int len) +{ + int maxlen; + int l; + int retlen; + int remptr; + + /* Compute how many bytes to return */ + maxlen = tmb->tmb_len - offset; + + /* if offset is beyond length, get out now. */ + if (maxlen <= 0) return 0; + + /* otherwise choose min(max_can_copy,max_to_copy) */ + if (maxlen > len) maxlen = len; + retlen = maxlen; + + /* Adjust remove pointer for offset */ + remptr = (tmb->tmb_remptr + offset) % tmb->tmb_bufsize; + + l = tmb->tmb_bufsize - remptr; + if (l > maxlen) l = maxlen; + + memcpy(buf,tmb->tmb_buf + remptr,l); + buf += l; + maxlen -= l; + + if (maxlen) { + memcpy(buf,tmb->tmb_buf,maxlen); + } + + return retlen; +} + diff --git a/cfe/cfe/net/net_tcpbuf.h b/cfe/cfe/net/net_tcpbuf.h new file mode 100644 index 0000000..0c251e3 --- /dev/null +++ b/cfe/cfe/net/net_tcpbuf.h @@ -0,0 +1,83 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * TCP Protocol Definitions File: net_tcp.h + * + * This file contains TCP protocol-specific definitions + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define tmb_remlen(tmb) ((tmb)->tmb_bufsize - (tmb)->tmb_len) +#define tmb_curlen(tmb) ((tmb)->tmb_len) + + +/* ********************************************************************* + * Modulo Buffer + ********************************************************************* */ + +typedef struct tcpmodbuf_s { + uint8_t *tmb_buf; /* Buffer */ + int tmb_bufsize; /* size of buffer */ + int tmb_addptr; /* current "add" pointer */ + int tmb_remptr; /* current "remove" pointer */ + int tmb_len; /* amount of data in the buffer */ +} tcpmodbuf_t; + + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +void tmb_init(tcpmodbuf_t *buf); +void tmb_adjust(tcpmodbuf_t *buf,int amt); +int tmb_alloc(tcpmodbuf_t *buf,int size); +void tmb_free(tcpmodbuf_t *buf); +int tmb_copyin(tcpmodbuf_t *tmb,uint8_t *buf,int len,int update); +int tmb_copyout(tcpmodbuf_t *tmb,uint8_t *buf,int len,int update); +int tmb_copyout2(tcpmodbuf_t *tmb,uint8_t *buf,int offset,int len); + + + + + diff --git a/cfe/cfe/net/net_tftp.c b/cfe/cfe/net/net_tftp.c new file mode 100644 index 0000000..1c3e799 --- /dev/null +++ b/cfe/cfe/net/net_tftp.c @@ -0,0 +1,921 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * TFTP Client File: net_tftp.c + * + * This module contains a TFTP client. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_error.h" +#include "cfe_fileops.h" + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#include "cfe_console.h" +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "cfe.h" + +#include "cfe_loader.h" + +#include "net_api.h" + + + +/* ********************************************************************* + * TFTP protocol + ********************************************************************* */ + +#define UDP_PROTO_TFTP 69 + +#define TFTP_BLOCKSIZE 512 + +#define TFTP_OP_RRQ 1 +#define TFTP_OP_WRQ 2 +#define TFTP_OP_DATA 3 +#define TFTP_OP_ACK 4 +#define TFTP_OP_ERROR 5 + +#define TFTP_ERR_DISKFULL 3 + +#define TFTP_MAX_RETRIES 8 + +#define TFTP_RRQ_TIMEOUT 1 /* seconds */ +#define TFTP_RECV_TIMEOUT 1 /* seconds */ + +/* ********************************************************************* + * TFTP context + ********************************************************************* */ + +typedef struct tftp_fsctx_s { + int dummy; +} tftp_fsctx_t; + +typedef struct tftp_info_s { + int tftp_socket; + uint8_t tftp_data[TFTP_BLOCKSIZE]; + int tftp_blklen; + int tftp_blkoffset; + int tftp_fileoffset; + uint16_t tftp_blknum; + uint8_t tftp_ipaddr[IP_ADDR_LEN]; + int tftp_lastblock; + int tftp_error; + int tftp_filemode; + char *tftp_filename; +} tftp_info_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +static int tftp_fileop_init(void **fsctx,void *devicename); +static int tftp_fileop_open(void **ref,void *fsctx,char *filename,int mode); +static int tftp_fileop_read(void *ref,uint8_t *buf,int len); +static int tftp_fileop_write(void *ref,uint8_t *buf,int len); +static int tftp_fileop_seek(void *ref,int offset,int how); +static void tftp_fileop_close(void *ref); +static void tftp_fileop_uninit(void *fsctx); + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +int tftp_max_retries = TFTP_MAX_RETRIES; +int tftp_rrq_timeout = TFTP_RRQ_TIMEOUT; +int tftp_recv_timeout = TFTP_RECV_TIMEOUT; +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +/* ********************************************************************* + * TFTP fileio dispatch table + ********************************************************************* */ + +const fileio_dispatch_t tftp_fileops = { + "tftp", + LOADFLG_NOBB | FSYS_TYPE_NETWORK, + tftp_fileop_init, + tftp_fileop_open, + tftp_fileop_read, + tftp_fileop_write, + tftp_fileop_seek, + tftp_fileop_close, + tftp_fileop_uninit +}; + + +/* ********************************************************************* + * _tftp_open(info,hostname,filename,mode) + * + * Open a file on a remote host, using the TFTP protocol. + * + * Input parameters: + * info - TFTP information + * hostname - host name or IP address of remote host + * filename - name of file on remote system + * mode - file open mode, read or write + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int _tftp_open(tftp_info_t *info,char *hostname,char *filename,int mode) +{ + ebuf_t *buf = NULL; + const char *datamode = "octet"; + uint16_t type,error,block; + int res; + int retries; + + /* + * Look up the remote host's IP address + */ + + res = dns_lookup(hostname,info->tftp_ipaddr); + if (res < 0) return res; + + /* + * Open a UDP socket to the TFTP server + */ + + info->tftp_socket = udp_socket(UDP_PROTO_TFTP); + info->tftp_lastblock = 0; + info->tftp_error = 0; + info->tftp_filemode = mode; + + /* + * Try to send the RRQ packet to open the file + */ + + for (retries = 0; retries < TFTP_MAX_RETRIES; retries++) { + + buf = udp_alloc(); + if (!buf) break; + + if (info->tftp_filemode == FILE_MODE_READ) { + ebuf_append_u16_be(buf,TFTP_OP_RRQ); /* read file */ + } + else { + ebuf_append_u16_be(buf,TFTP_OP_WRQ); /* write file */ + } + ebuf_append_bytes(buf,filename,strlen(filename)+1); + ebuf_append_bytes(buf,datamode,strlen(datamode)+1); + + udp_send(info->tftp_socket,buf,info->tftp_ipaddr); + + buf = udp_recv_with_timeout(info->tftp_socket,TFTP_RRQ_TIMEOUT); + if (buf) break; + } + + /* + * If we got no response, bail now. + */ + + if (!buf) { + udp_close(info->tftp_socket); + info->tftp_socket = -1; + return CFE_ERR_TIMEOUT; + } + + /* + * Otherwise, process the response. + */ + + ebuf_get_u16_be(buf,type); + + switch (type) { + case TFTP_OP_ACK: + /* + * Acks are what we get back on a WRQ command, + * but are otherwise unexpected. + */ + if (info->tftp_filemode == FILE_MODE_WRITE) { + udp_connect(info->tftp_socket,(uint16_t) buf->eb_usrdata); + info->tftp_blknum = 1; + info->tftp_blklen = 0; + udp_free(buf); + return 0; + break; + } + /* fall through */ + case TFTP_OP_RRQ: + case TFTP_OP_WRQ: + default: + /* + * we aren't expecting any of these messages + */ + udp_free(buf); + udp_close(info->tftp_socket); + info->tftp_socket = -1; + return CFE_ERR_PROTOCOLERR; + + case TFTP_OP_ERROR: + /* + * Process the error return (XXX: remove xprintf here) + */ + ebuf_get_u16_be(buf,error); + xprintf("TFTP error %d: %s\n",error,ebuf_ptr(buf)); + udp_free(buf); + udp_close(info->tftp_socket); + info->tftp_socket = -1; + return CFE_ERR_PROTOCOLERR; + + case TFTP_OP_DATA: + /* + * Yay, we've got data! Store the first block. + */ + ebuf_get_u16_be(buf,block); + udp_connect(info->tftp_socket,(uint16_t) buf->eb_usrdata); + info->tftp_blknum = block; + info->tftp_blklen = ebuf_length(buf); + ebuf_get_bytes(buf,info->tftp_data,ebuf_length(buf)); + udp_free(buf); + if (info->tftp_blklen < TFTP_BLOCKSIZE) { + info->tftp_lastblock = 1; /* EOF */ + } + return 0; + break; + + } +} + + +/* ********************************************************************* + * _tftp_readmore(info) + * + * Read the next block of the file. We do this by acking the + * previous block. Once that block is acked, the TFTP server + * should send the next block to us. + * + * Input parameters: + * info - TFTP information + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int _tftp_readmore(tftp_info_t *info) +{ + ebuf_t *buf; + uint16_t cmd,block; + int retries; + + /* + * If we've already read the last block, there is no more + */ + + if (info->tftp_lastblock) return 1; + if (info->tftp_error) return CFE_ERR_TIMEOUT; + + /* + * Otherwise, ack the current block so another one will come + */ + + for (retries = 0; retries < TFTP_MAX_RETRIES; retries++) { + + buf = udp_alloc(); + if (!buf) return -1; + + /* + * Send the ack + */ + + ebuf_append_u16_be(buf,TFTP_OP_ACK); + ebuf_append_u16_be(buf,info->tftp_blknum); + udp_send(info->tftp_socket,buf,info->tftp_ipaddr); + + /* + * Wait for some response, retransmitting as necessary + */ + + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + buf = udp_recv_with_timeout(info->tftp_socket,tftp_recv_timeout); + // buf = udp_recv_with_timeout(info->tftp_socket,TFTP_RECV_TIMEOUT); + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + if (buf == NULL) continue; + + /* + * Got a response, make sure it's right + */ + + ebuf_get_u16_be(buf,cmd); + if (cmd != TFTP_OP_DATA) { + udp_free(buf); + continue; + } + + ebuf_get_u16_be(buf,block); + if (block != (info->tftp_blknum+1)) { + udp_free(buf); + continue; + } + + /* + * It's the correct response. Copy the user data + */ + + info->tftp_blknum = block; + info->tftp_blklen = ebuf_length(buf); + ebuf_get_bytes(buf,info->tftp_data,ebuf_length(buf)); + udp_free(buf); + break; + } + + /* + * If the block is less than 512 bytes long, it's the EOF block. + */ + + if (retries == TFTP_MAX_RETRIES) { + info->tftp_error = 1; + return CFE_ERR_TIMEOUT; + } + + if (info->tftp_blklen < TFTP_BLOCKSIZE) { + info->tftp_lastblock = 1; /* EOF */ + } + + return 0; +} + +/* ********************************************************************* + * _tftp_writemore(info) + * + * Write the next block of the file, sending the data from our + * holding buffer. Note that the holding buffer must be full + * or else we consider this to be an EOF. + * + * Input parameters: + * info - TFTP information + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int _tftp_writemore(tftp_info_t *info) +{ + ebuf_t *buf; + uint16_t cmd,block,error; + int retries; + + /* + * If we've already written the last block, there is no more + */ + + if (info->tftp_lastblock) return 1; + if (info->tftp_error) return CFE_ERR_TIMEOUT; + + /* + * Otherwise, send a block + */ + + for (retries = 0; retries < TFTP_MAX_RETRIES; retries++) { + + buf = udp_alloc(); + if (!buf) return -1; + + /* + * Send the data + */ + + ebuf_append_u16_be(buf,TFTP_OP_DATA); + ebuf_append_u16_be(buf,info->tftp_blknum); + ebuf_append_bytes(buf,info->tftp_data,info->tftp_blklen); + udp_send(info->tftp_socket,buf,info->tftp_ipaddr); + + /* + * Wait for some response, retransmitting as necessary + */ + + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + buf = udp_recv_with_timeout(info->tftp_socket, tftp_recv_timeout); + // buf = udp_recv_with_timeout(info->tftp_socket,TFTP_RECV_TIMEOUT); + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + if (buf == NULL) continue; + + /* + * Got a response, make sure it's right + */ + + ebuf_get_u16_be(buf,cmd); + + if (cmd == TFTP_OP_ERROR) { + /* + * Process the error return (XXX: remove xprintf here) + */ + ebuf_get_u16_be(buf,error); + xprintf("TFTP write error %d: %s\n",error,ebuf_ptr(buf)); + info->tftp_error = 1; + info->tftp_lastblock = 1; + udp_free(buf); + return CFE_ERR_IOERR; + } + + if (cmd != TFTP_OP_ACK) { + udp_free(buf); + continue; + } + + ebuf_get_u16_be(buf,block); + if (block != (info->tftp_blknum)) { + udp_free(buf); + continue; + } + + /* + * It's the correct response. Update the block # + */ + + info->tftp_blknum++; + if (info->tftp_blklen != TFTP_BLOCKSIZE) info->tftp_lastblock = 1; + udp_free(buf); + break; + } + + /* + * If we had some failure, mark the stream with an error + */ + + if (retries == TFTP_MAX_RETRIES) { + info->tftp_error = 1; + return CFE_ERR_TIMEOUT; + } + + return 0; +} + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +static int _tftpd_open(tftp_info_t *info,char *hostname,char *filename,int mode) +{ + ebuf_t *buf = NULL; + uint16_t type; + int res; + int retries; + char ch = 0; + + /* + * * Open a UDP socket + * */ + + info->tftp_socket = udp_socket(UDP_PROTO_TFTP); + info->tftp_lastblock = 0; + info->tftp_error = 0; + info->tftp_filemode = mode; + + /* + * * Listen for requests + * */ + + res = udp_bind(info->tftp_socket,UDP_PROTO_TFTP); + if (res < 0) return res; + + res = CFE_ERR_TIMEOUT; + + for (retries = 0; retries < tftp_max_retries; retries++) { + while (console_status()) { + console_read(&ch,1); + if (ch == 3) break; + } + + if (ch == 3) { + res = CFE_ERR_INTR; + break; + } + + buf = udp_recv_with_timeout(info->tftp_socket,tftp_recv_timeout); + if (buf == NULL) continue; + + /* + * * Process the request + * */ + + ebuf_get_u16_be(buf,type); + + switch (type) { + case TFTP_OP_RRQ: + udp_connect(info->tftp_socket,(uint16_t) buf->eb_usrdata); + memcpy(info->tftp_ipaddr,buf->eb_usrptr,IP_ADDR_LEN); + info->tftp_blknum = 1; + info->tftp_blklen = 0; + res = 0; + break; + + case TFTP_OP_WRQ: + udp_connect(info->tftp_socket,(uint16_t) buf->eb_usrdata); + memcpy(info->tftp_ipaddr,buf->eb_usrptr,IP_ADDR_LEN); + info->tftp_blknum = 0; + res = _tftp_readmore(info); + break; + + default: + /* + * aren't expecting any of these messages + * */ + res = CFE_ERR_PROTOCOLERR; + break; + } + + udp_free(buf); + break; + } + + if (res) { + udp_close(info->tftp_socket); + info->tftp_socket = -1; + } + + return res; +} + + +/* ********************************************************************* + * _tftp_close(info) + * + * Close a TFTP file. There are two cases for what we do + * here. If we're closing the file mid-stream, send an error + * packet to tell the host we're getting out early. Otherwise, + * just ack the final packet and the connection will close + * gracefully. + * + * Input parameters: + * info - TFTP info + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int _tftp_close(tftp_info_t *info) +{ + ebuf_t *buf; + const char *emsg = "transfer cancelled"; /* some error message */ + + if (info->tftp_socket == -1) return 0; + + if (info->tftp_filemode == FILE_MODE_READ) { + buf = udp_alloc(); + if (buf) { + /* If we're on the EOF packet, just send an ack */ + if (info->tftp_lastblock) { + ebuf_append_u16_be(buf,TFTP_OP_ACK); + ebuf_append_u16_be(buf,info->tftp_blknum); + } + else { + ebuf_append_u16_be(buf,TFTP_OP_ERROR); + ebuf_append_u16_be(buf,TFTP_ERR_DISKFULL); + ebuf_append_bytes(buf,emsg,strlen(emsg)+1); + } + udp_send(info->tftp_socket,buf,info->tftp_ipaddr); + } + } + else { + /* Just flush out the remaining write data, if any */ + _tftp_writemore(info); + } + + udp_close(info->tftp_socket); + info->tftp_socket = -1; + return 0; +} + + + +/* ********************************************************************* + * tftp_fileop_init(fsctx,device) + * + * Create a file system device context for the TFTP service + * + * Input parameters: + * fsctx - location to place context information + * device - underlying device (unused) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int tftp_fileop_init(void **fsctx,void *dev) +{ + void *ref; + + ref = KMALLOC(sizeof(tftp_fsctx_t),0); + + if (!ref) return CFE_ERR_NOMEM; + *fsctx = ref; + return 0; +} + +/* ********************************************************************* + * tftp_fileop_open(ref,fsctx,filename,mode) + * + * This is the filesystem entry point for opening a TFTP file. + * Allocate a tftp_info structure, open the TFTP file, and + * return a handle. + * + * Input parameters: + * ref - location to place reference data (the TFTP structure) + * fsctx - filesystem context + * filename - name of remote file to open + * mode - FILE_MODE_READ or FILE_MODE_WRITE + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int tftp_fileop_open(void **ref,void *fsctx,char *filename,int mode) +{ + tftp_info_t *info; + char *host; + char *file; + int res; + + if ((mode != FILE_MODE_READ) && (mode != FILE_MODE_WRITE)) { + /* must be either read or write, not both */ + return CFE_ERR_UNSUPPORTED; + } + + /* Allocate the tftp info structure */ + + info = KMALLOC(sizeof(tftp_info_t),0); + if (!info) { + return CFE_ERR_NOMEM; + } + + + info->tftp_filename = lib_strdup(filename); + if (!info->tftp_filename) { + KFREE(info); + return CFE_ERR_NOMEM; + } + + lib_chop_filename(info->tftp_filename,&host,&file); + + /* Open the file */ + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + if (!*host && !*file) { + /* TFTP server if hostname and filename are not specified */ + res = _tftpd_open(info,host,file,mode); + } else { + res = _tftp_open(info,host,file,mode); + } + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + if (res == 0) { + info->tftp_blkoffset = 0; + info->tftp_fileoffset = 0; + *ref = info; + } + else { + KFREE(info->tftp_filename); + KFREE(info); + *ref = NULL; + } + return res; +} + +/* ********************************************************************* + * tftp_fileop_read(ref,buf,len) + * + * Read some bytes from the remote TFTP file. Do this by copying + * data from the block buffer, and reading more data from the + * remote file as necessary. + * + * Input parameters: + * ref - tftp_info structure + * buf - destination buffer address (NULL to read data and + * not copy it anywhere) + * len - number of bytes to read + * + * Return value: + * number of bytes read, 0 for EOF, <0 if an error occured. + ********************************************************************* */ + +static int tftp_fileop_read(void *ref,uint8_t *buf,int len) +{ + tftp_info_t *info = (tftp_info_t *) ref; + int copied = 0; + int amtcopy; + int res; + + if (info->tftp_error) return CFE_ERR_IOERR; + if (info->tftp_filemode == FILE_MODE_WRITE) return CFE_ERR_UNSUPPORTED; + + while (len) { + + if (info->tftp_blkoffset >= info->tftp_blklen) break; + amtcopy = len; + + if (amtcopy > (info->tftp_blklen-info->tftp_blkoffset)) { + amtcopy = (info->tftp_blklen-info->tftp_blkoffset); + } + + if (buf) { + memcpy(buf,&(info->tftp_data[info->tftp_blkoffset]),amtcopy); + buf += amtcopy; + } + + info->tftp_blkoffset += amtcopy; + len -= amtcopy; + info->tftp_fileoffset += amtcopy; + copied += amtcopy; + + if (info->tftp_blkoffset >= info->tftp_blklen) { + res = _tftp_readmore(info); + if (res != 0) break; + info->tftp_blkoffset = 0; + } + } + + return copied; +} + +/* ********************************************************************* + * tftp_fileop_write(ref,buf,len) + * + * Write some bytes to the remote TFTP file. Do this by copying + * data to the block buffer, and writing data to the + * remote file as necessary. + * + * Input parameters: + * ref - tftp_info structure + * buf - source buffer address + * len - number of bytes to write + * + * Return value: + * number of bytes written, 0 for EOF, <0 if an error occured. + ********************************************************************* */ + +static int tftp_fileop_write(void *ref,uint8_t *buf,int len) +{ + tftp_info_t *info = (tftp_info_t *) ref; + int copied = 0; + int amtcopy; + int res; + + if (info->tftp_error) return CFE_ERR_IOERR; + if (info->tftp_filemode == FILE_MODE_READ) return CFE_ERR_UNSUPPORTED; + + while (len) { + + amtcopy = len; + if (amtcopy > (TFTP_BLOCKSIZE - info->tftp_blklen)) { + amtcopy = (TFTP_BLOCKSIZE - info->tftp_blklen); + } + + memcpy(&(info->tftp_data[info->tftp_blklen]),buf,amtcopy); + buf += amtcopy; + + info->tftp_blklen += amtcopy; + len -= amtcopy; + info->tftp_fileoffset += amtcopy; + copied += amtcopy; + + if (info->tftp_blklen == TFTP_BLOCKSIZE) { + res = _tftp_writemore(info); + if (res != 0) { + break; + } + info->tftp_blklen = 0; + } + } + + return copied; +} + +/* ********************************************************************* + * tftp_fileop_seek(ref,offset,how) + * + * Seek within a TFTP file. Note that you can only seek *forward*, + * as TFTP doesn't really let you go backwards. (I suppose you + * could reopen the file, but thus far nobody needs to go + * backwards). You can only seek in a file in read mode. + * + * Input parameters: + * ref - our tftp information + * offset - distance to move + * how - how to move, (FILE_SEEK_*) + * + * Return value: + * new offset, or <0 if an error occured. + ********************************************************************* */ + +static int tftp_fileop_seek(void *ref,int offset,int how) +{ + tftp_info_t *info = (tftp_info_t *) ref; + int delta; + int startloc; + int res; + + if (info->tftp_filemode == FILE_MODE_WRITE) return CFE_ERR_UNSUPPORTED; + + switch (how) { + case FILE_SEEK_BEGINNING: + startloc = info->tftp_fileoffset; + break; + case FILE_SEEK_CURRENT: + startloc = 0; + break; + default: + startloc = 0; + break; + } + + delta = offset - startloc; + if (delta < 0) { + xprintf("Warning: negative seek on tftp file attempted\n"); + return CFE_ERR_UNSUPPORTED; + } + res = tftp_fileop_read(ref,NULL,delta); + if (res < 0) return res; + + return info->tftp_fileoffset; +} + + +/* ********************************************************************* + * tftp_fileop_close(ref) + * + * Close the TFTP file. + * + * Input parameters: + * ref - our TFTP info + * + * Return value: + * nothing + ********************************************************************* */ + +static void tftp_fileop_close(void *ref) +{ + tftp_info_t *info = (tftp_info_t *) ref; + + _tftp_close(info); + + KFREE(info->tftp_filename); + KFREE(info); +} + + +/* ********************************************************************* + * tftp_fileop_uninit(fsctx) + * + * Uninitialize the filesystem context, freeing allocated + * resources. + * + * Input parameters: + * fsctx - our context + * + * Return value: + * nothing + ********************************************************************* */ + +static void tftp_fileop_uninit(void *fsctx) +{ + KFREE(fsctx); +} diff --git a/cfe/cfe/net/net_udp.c b/cfe/cfe/net/net_udp.c new file mode 100644 index 0000000..968081a --- /dev/null +++ b/cfe/cfe/net/net_udp.c @@ -0,0 +1,637 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * User Datagram Protocol File: net_udp.c + * + * This module implements the User Datagram Protocol (RFCxxxx) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_timer.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_ip.h" + +#include "cfe_error.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define UDP_HDR_LENGTH 8 +#define UDP_PORTBASE 1024 +#define UDP_MAX_PORTS 4 + +/* ********************************************************************* + * Types + ********************************************************************* */ + +typedef struct udp_port_s udp_port_t; + +/* + * UDP port structure - describes an open UDP port. + */ + +struct udp_port_s { + uint16_t up_destport; /* destination port number */ + uint16_t up_srcport; /* source port number */ + queue_t up_rxqueue; /* queue of received packets */ + int up_maxqueue; /* max # of elements on rx queue */ + int up_inuse; /* nonzero if port is in use */ +}; + + +/* + * UDP stack information - describes the entire UDP layer. + */ + +struct udp_info_s { + uint16_t ui_portbase; + void *ui_ref; + ip_info_t *ui_ipinfo; + udp_port_t ui_ports[UDP_MAX_PORTS]; +}; + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + +static int _udp_rx_callback(void *ref,ebuf_t *buf,uint8_t *destaddr,uint8_t *srcaddr); + + +/* ********************************************************************* + * udp_find_port(info,port) + * + * Locate an open port. Scan the list of ports looking for one + * that is both open and has a matching source port number. + * + * Input parameters: + * info - UDP stack information + * port - source port # we're looking for + * + * Return value: + * udp_port_t pointer or NULL if no port was found + ********************************************************************* */ + +static udp_port_t *_udp_find_port(udp_info_t *info,uint16_t port) +{ + int idx; + udp_port_t *udp = info->ui_ports; + + for (idx = 0; idx < UDP_MAX_PORTS; idx++) { + if (udp->up_inuse && (udp->up_srcport == port)) { + return udp; + } + udp++; + } + + return NULL; +} + +/* ********************************************************************* + * _udp_socket(info,port) + * + * Open a UDP socket. This is an internal function used by + * the network API layer. + * + * Input parameters: + * info - UDP stack information + * port - port number to open + * + * Return value: + * port number (0 based) or an error code (<0) if an error + * occured. + ********************************************************************* */ + +int _udp_socket(udp_info_t *info,uint16_t port) +{ + extern int32_t _getticks(void); /* return value of CP0 COUNT */ + int idx; + udp_port_t *udp; + uint16_t srcport = UDP_PORTBASE + (_getticks() & 0xFFF); + + while (_udp_find_port(info,srcport)) { /* should always exit */ + srcport++; + if (srcport > (UDP_PORTBASE+4096)) srcport = UDP_PORTBASE; + } + + udp = info->ui_ports; + + for (idx = 0; idx < UDP_MAX_PORTS; idx++) { + if (!udp->up_inuse) break; + udp++; + } + + if (idx == UDP_MAX_PORTS) return CFE_ERR_NOHANDLES; + + udp->up_destport = port; + udp->up_srcport = srcport; + udp->up_maxqueue = 2; + udp->up_inuse = TRUE; + q_init(&(udp->up_rxqueue)); + + return idx; +} + + +/* ********************************************************************* + * _udp_close(info,s) + * + * Internal function to close an open UDP port. This routine is + * called by the high-level network API. + * + * Input parameters: + * info - UDP stack information + * s - an open UDP socket handle (returned from _udp_open) + * + * Return value: + * nothing + ********************************************************************* */ + +void _udp_close(udp_info_t *info,int s) +{ + udp_port_t *udp = &(info->ui_ports[s]); + ebuf_t *buf; + + while ((buf = (ebuf_t *) q_deqnext(&(udp->up_rxqueue)))) { + _ip_free(info->ui_ipinfo,buf); + } + + udp->up_srcport = 0; + udp->up_destport = 0; + udp->up_maxqueue = 0; + udp->up_inuse = FALSE; +} + +/* ********************************************************************* + * _udp_send(info,s,buf,dest) + * + * Transmit a UDP datagram. Note that we never send fragmented + * datagrams, so all datagrams must be less than the MTU. + * + * Input parameters: + * info - UDP stack information + * s - an open UDP socket handle (returned from _udp_open) + * buf - an ebuf to send + * dest - destination IP address + * + * Return value: + * 0 if packet was sent + * else error code + ********************************************************************* */ + +int _udp_send(udp_info_t *info,int s,ebuf_t *buf,uint8_t *dest) +{ + udp_port_t *udp = &(info->ui_ports[s]); + uint8_t *udphdr; + int udplen; + uint8_t pseudoheader[12]; + uint16_t cksum; + + /* + * Calculate the length of the IP datagram (includes UDP header) + */ + + udplen = ebuf_length(buf) + UDP_HDR_LENGTH; + + /* + * Build the pseudoheader, which is part of the checksum calculation + */ + + _ip_getaddr(info->ui_ipinfo,&pseudoheader[0]); + memcpy(&pseudoheader[4],dest,IP_ADDR_LEN); + pseudoheader[8] = 0; + pseudoheader[9] = IPPROTO_UDP; + pseudoheader[10] = (udplen >> 8) & 0xFF; + pseudoheader[11] = (udplen & 0xFF); + + /* + * Back up and build the actual UDP header in the packet + */ + + ebuf_seek(buf,-UDP_HDR_LENGTH); + udphdr = ebuf_ptr(buf); + + ebuf_put_u16_be(buf,udp->up_srcport); + ebuf_put_u16_be(buf,udp->up_destport); + ebuf_put_u16_be(buf,udplen); + ebuf_put_u16_be(buf,0); + + ebuf_prepend(buf,UDP_HDR_LENGTH); + + /* + * Checksum the packet and insert the checksum into the header + */ + + cksum = ip_chksum(0,pseudoheader,sizeof(pseudoheader)); + cksum = ip_chksum(cksum,udphdr,udplen); + cksum = ~cksum; + if (cksum == 0) cksum = 0xFFFF; + udphdr[6] = (cksum >> 8) & 0xFF; + udphdr[7] = (cksum & 0xFF); + + /* + * Off it goes! + */ + + _ip_send(info->ui_ipinfo,buf,dest,IPPROTO_UDP); + + return 0; +} + +/* ********************************************************************* + * _udp_bind(info,s,port) + * + * Bind a UDP socket to a particular port number. Basically, + * all this means is we set the "source" port number. + * + * Input parameters: + * info - UDP stack information + * s - an open UDP socket (from _udp_open) + * port - port number to assign to the UDP socket + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +int _udp_bind(udp_info_t *info,int s,uint16_t port) +{ + udp_port_t *udp = &(info->ui_ports[s]); + + if (_udp_find_port(info,port)) return CFE_ERR_ALREADYBOUND; + + udp->up_srcport = port; + + return 0; +} + + +/* ********************************************************************* + * _udp_connect(info,s,port) + * + * "connect" a UDP socket to a particular port number. Basically, + * this just sets the "destination" port number. It is used for + * protocols like TFTP where the destination port number changes + * after the port is open. + * + * Input parameters: + * info - UDP stack information + * s - an open UDP socket (from _udp_open) + * port - port number to assign to the UDP socket + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int _udp_connect(udp_info_t *info,int s,uint16_t port) +{ + udp_port_t *udp = &(info->ui_ports[s]); + + udp->up_destport = port; + + return 0; +} + +/* ********************************************************************* + * _udp_rx_callback(ref,buf,destaddr,srcaddr) + * + * Receive callback routine from the IP layer. When an IP + * packet of protocol type "UDP" is received, this routine gets + * called. + * + * Input parameters: + * ref - reference data (pointer to our UDP stack info) + * buf - the ebuf, currently pointing at the UDP header + * destaddr - the destination IP address (usually our IP address) + * srcaddr - the source IP address + * + * Return value: + * ETH_KEEP to keep (not deallocate) the packet + * ETH_DROP to deallocate the packet. + ********************************************************************* */ + +static int _udp_rx_callback(void *ref,ebuf_t *buf,uint8_t *destaddr,uint8_t *srcaddr) +{ + uint8_t pseudoheader[12]; + int udplen; + uint16_t calccksum; + uint16_t origcksum; + uint8_t *udphdr; + uint16_t srcport; + uint16_t dstport; + uint16_t udplen2; + udp_port_t *udp; + udp_info_t *info = (udp_info_t *) ref; + + + + /* + * get a pointer to the UDP header + */ + + udplen = ebuf_length(buf); + udphdr = ebuf_ptr(buf); + + /* + * see if we are checking checksums (cksum field != 0) + */ + + if ((udphdr[6] | udphdr[7]) != 0) { + + /* + * construct the pseudoheader for the cksum calculation + */ + + memcpy(&pseudoheader[0],srcaddr,IP_ADDR_LEN); + memcpy(&pseudoheader[4],destaddr,IP_ADDR_LEN); + pseudoheader[8] = 0; + pseudoheader[9] = IPPROTO_UDP; + pseudoheader[10] = (udplen >> 8) & 0xFF; + pseudoheader[11] = (udplen & 0xFF); + + origcksum = ((uint16_t) udphdr[6] << 8) | (uint16_t) udphdr[7]; + udphdr[6] = udphdr[7] = 0; + + calccksum = ip_chksum(0,pseudoheader,sizeof(pseudoheader)); + calccksum = ip_chksum(calccksum,udphdr,udplen); + if (calccksum != 0xffff) { + calccksum = ~calccksum; + } + + if (calccksum != origcksum) { + return ETH_DROP; + } + } + + /* Read the other UDP header fields from the packet */ + + ebuf_get_u16_be(buf,srcport); + ebuf_get_u16_be(buf,dstport); + ebuf_get_u16_be(buf,udplen2); + ebuf_skip(buf,2); + + /* + * It's no good if the lengths don't match. The length + * reported by IP should be the length in the UDP header + 8 + */ + + if (udplen2 != (uint16_t) udplen) { + return ETH_DROP; + } + + /* + * Okay, start looking for a matching port + */ + + udp = _udp_find_port(info,dstport); + if (!udp) { + return ETH_DROP; /* drop packet if no matching port */ + /* XXX should send ICMP message here */ + } + + buf->eb_usrdata = (int) srcport; + buf->eb_usrptr = srcaddr; + + /* + * Drop packet if queue is full + */ + + if (q_count(&(udp->up_rxqueue)) >= udp->up_maxqueue) { + return ETH_DROP; + } + + /* + * Add to receive queue + */ + + ebuf_setlength(buf,udplen2-UDP_HDR_LENGTH); + q_enqueue(&(udp->up_rxqueue),(queue_t *) buf); + + return ETH_KEEP; +} + + +/* ********************************************************************* + * _udp_recv(info,s) + * + * Receive a packet from the specified UDP socket. + * + * Input parameters: + * info - UDP stack information + * s - an open UDP socket handle (from _udp_open) + * + * Return value: + * an ebuf, or NULL if no packets have been received. + ********************************************************************* */ + +ebuf_t *_udp_recv(udp_info_t *info,int s) +{ + ebuf_t *buf; + udp_port_t *udp = &(info->ui_ports[s]); + + buf = (ebuf_t *) q_deqnext(&(udp->up_rxqueue)); + + return buf; +} + + +/* ********************************************************************* + * _udp_init(ipi,ref) + * + * Initialize the UDP module. This routine registers our + * protocol with the IP layer. + * + * Input parameters: + * ipi - IP information (including our IP address, etc.) + * ref - reference data, stored in our UDP stack structure + * + * Return value: + * udp_info_t (allocated) or NULL if something went wrong. + ********************************************************************* */ + +udp_info_t *_udp_init(ip_info_t *ipi,void *ref) +{ + udp_info_t *info; + udp_port_t *udp; + int idx; + + /* + * Allocate some memory for our structure + */ + + info = KMALLOC(sizeof(udp_info_t),0); + + if (info == NULL) return NULL; + + memset(info,0,sizeof(udp_info_t)); + + /* + * Fill in the fields. + */ + + info->ui_ref = ref; + info->ui_ipinfo = ipi; + udp = info->ui_ports; + for (idx = 0; idx < UDP_MAX_PORTS; idx++) { + udp->up_inuse = FALSE; + q_init(&(udp->up_rxqueue)); + udp++; + } + + /* + * Register our protocol with IP + */ + + _ip_register(ipi,IPPROTO_UDP,_udp_rx_callback,info); + + return info; +} + + +/* ********************************************************************* + * _udp_uninit(info) + * + * Uninitialize the UDP module, deregistering ourselves from the + * IP layer. + * + * Input parameters: + * info - UDP stack information + * + * Return value: + * nothing + ********************************************************************* */ + +void _udp_uninit(udp_info_t *info) +{ + int idx; + udp_port_t *udp; + ebuf_t *buf; + + /* + * Unregister from IP + */ + + _ip_deregister(info->ui_ipinfo,IPPROTO_UDP); + + /* + * Free up any packets that were waiting + */ + + udp = info->ui_ports; + for (idx = 0; idx < UDP_MAX_PORTS; idx++) { + if (udp->up_inuse) { + while ((buf = (ebuf_t *) q_deqnext(&(udp->up_rxqueue)))) { + _ip_free(info->ui_ipinfo,buf); + } + } + udp++; + } + + /* + * Free the stack info + */ + + KFREE(info); +} + +/* ********************************************************************* + * _udp_alloc(info) + * + * Allocate a buffer for use with UDP. This routine obtains an + * ebuf and adjusts its header to include room for the UDP + * header. + * + * Input parameters: + * info - UDP stack information + * + * Return value: + * ebuf, or NULL if there are none left + ********************************************************************* */ + +ebuf_t *_udp_alloc(udp_info_t *info) +{ + ebuf_t *buf; + + /* + * Get an ebuf + */ + + buf = _ip_alloc(info->ui_ipinfo); + + if (!buf) return NULL; + + /* + * make room for the udp header + */ + + ebuf_seek(buf,UDP_HDR_LENGTH); + ebuf_setlength(buf,0); + + return buf; +} + +/* ********************************************************************* + * _udp_free(info,buf) + * + * Return an ebuf to the pool. + * + * Input parameters: + * info - UDP stack info + * buf - an ebuf + * + * Return value: + * nothing + ********************************************************************* */ + +void _udp_free(udp_info_t *info,ebuf_t *buf) +{ + _ip_free(info->ui_ipinfo,buf); +} diff --git a/cfe/cfe/pccons/Makefile b/cfe/cfe/pccons/Makefile new file mode 100644 index 0000000..09b8610 --- /dev/null +++ b/cfe/cfe/pccons/Makefile @@ -0,0 +1,3 @@ + +CFLAGS += -DCFG_VGACONSOLE=1 +ALLOBJS += vgainit.o vga_subr.o kbd_subr.o x86mem.o dev_pcconsole.o dev_pcconsole2.o diff --git a/cfe/cfe/pccons/README b/cfe/cfe/pccons/README new file mode 100644 index 0000000..0160ad5 --- /dev/null +++ b/cfe/cfe/pccons/README @@ -0,0 +1,19 @@ + +This directory contains "PC Console" routines, to enable the +SWARM board to use PC-style devices for its console. In +particular, it contains the code to use the X86 emulator +to initialize the VGA, and code to map scan codes to +ASCII characters for a PC keyboard. + +What is this good for, you ask? Just for fun, mostly. Many of +us have had this screwy notion that a SWARM could be used as +a Linux "workstation" if we could get VGA support and USB +keyboards implemented (oh, yeah, and there's this whole +matter of PC console support in Linux, and X, and ...). + +Like the USB host stack, this is among the least-supported +portions of CFE. If you find it useful, great! If it doesn't +work or build properly, let us know, but we may not get to fixing +it right away. + + diff --git a/cfe/cfe/pccons/dev_pcconsole.c b/cfe/cfe/pccons/dev_pcconsole.c new file mode 100644 index 0000000..fe85eca --- /dev/null +++ b/cfe/cfe/pccons/dev_pcconsole.c @@ -0,0 +1,339 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PC Console driver File: dev_pcconsole.c + * + * A console driver for a PC-style keyboard and mouse + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + + +#include "sbmips.h" +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" + +#include "lib_physio.h" + +#include "kbd_subr.h" +#include "vga_subr.h" + +#include "bsp_config.h" +#include "pcireg.h" +#include "pcivar.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define KBD_RXFULL 1 /* bit set if kb has data */ +#define KBD_TXFULL 2 /* bit set if we can send cmd */ +#define VGA_TEXTBUF_COLOR 0xB8000 /* VGA frame buffer */ + +#if defined(_P5064_) || defined(_P6064_) + #define PCI_MEM_SPACE 0x10000000 /* 128MB: s/w configurable */ + #define __ISAaddr(addr) ((physaddr_t)(PCI_MEM_SPACE+(addr))) +#else + #define __ISAaddr(addr) ((physaddr_t)0x40000000+(addr)) +#endif + +#define cpu_isamap(x,y) __ISAaddr(x) + +/* ********************************************************************* + * Forward references + ********************************************************************* */ + +static void pcconsole_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +static int pcconsole_open(cfe_devctx_t *ctx); +static int pcconsole_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int pcconsole_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int pcconsole_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int pcconsole_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int pcconsole_close(cfe_devctx_t *ctx); +static void pcconsole_poll(cfe_devctx_t *ctx,int64_t ticks); + +const static cfe_devdisp_t pcconsole_dispatch = { + pcconsole_open, + pcconsole_read, + pcconsole_inpstat, + pcconsole_write, + pcconsole_ioctl, + pcconsole_close, + pcconsole_poll, + NULL +}; + +const cfe_driver_t pcconsole = { + "PC Console", + "pcconsole", + CFE_DEV_SERIAL, + &pcconsole_dispatch, + pcconsole_probe +}; + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + + +typedef struct pcconsole_s { + vga_term_t vga; + keystate_t ks; + uint32_t kbd_status; + uint32_t kbd_data; +} pcconsole_t; + + +/* ********************************************************************* + * pcconsole_poll(ctx,ticks) + * + * Poll routine - check for new keyboard events + * + * Input parameters: + * ctx - device context + * ticks - current time + * + * Return value: + * nothing + ********************************************************************* */ + + +static void pcconsole_poll(cfe_devctx_t *ctx,int64_t ticks) +{ + pcconsole_t *softc = ctx->dev_softc; + uint8_t status; + uint8_t b; + + status = inb(softc->kbd_status); + + if (status & KBD_RXFULL) { + b = inb(softc->kbd_data); + kbd_doscan(&(softc->ks),b); + } +} + +/* ********************************************************************* + * pcconsole_waitcmdready(softc) + * + * Wait for the keyboard to be ready to accept a command + * + * Input parameters: + * softc - console structure + * + * Return value: + * nothing + ********************************************************************* */ + +static void pcconsole_waitcmdready(pcconsole_t *softc) +{ + uint8_t status; + uint8_t data; + + for (;;) { + status = inb(softc->kbd_status); /* read status */ + if (status & KBD_RXFULL) { + data = inb(softc->kbd_data); /* get data */ + kbd_doscan(&(softc->ks),data); /* process scan codes */ + } + if (!(status & KBD_TXFULL)) break; /* stop when kbd ready */ + } +} + + +/* ********************************************************************* + * pcconsole_setleds(ks,leds) + * + * Callback from the keyboard routines for setting the LEDS + * + * Input parameters: + * ks - keyboard state + * leds - new LED state + * + * Return value: + * 0 + ********************************************************************* */ + +static int pcconsole_setleds(keystate_t *ks,int leds) +{ + pcconsole_t *softc = kbd_getref(ks); + + pcconsole_waitcmdready(softc); + outb(softc->kbd_data,KBDCMD_SETLEDS); + pcconsole_waitcmdready(softc); + outb(softc->kbd_data,(leds & 7)); + + return 0; +} + + +/* ********************************************************************* + * pcconsole_probe(drv,probe_a,probe_b,probe_ptr) + * + * Probe routine. This routine sets up the pcconsole device + * + * Input parameters: + * drv - driver structure + * probe_a + * probe_b + * probe_ptr + * + * Return value: + * nothing + ********************************************************************* */ + +static void pcconsole_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + pcconsole_t *softc; + char descr[80]; + volatile uint8_t *isamem; + + /* + * probe_a is + * probe_b is + * probe_ptr is + */ + + softc = (pcconsole_t *) KMALLOC(sizeof(pcconsole_t),0); + if (softc) { + /* + * XXX This should not be hardwired. + */ + softc->kbd_status = 0x64; + softc->kbd_data = 0x60; + kbd_init(&(softc->ks),pcconsole_setleds,softc); + + /* + * XXX this should not be hardwired + */ + isamem = (volatile uint8_t *) ((uintptr_t)cpu_isamap(0,1024*1024)); + vga_init(&(softc->vga),__ISAaddr(VGA_TEXTBUF_COLOR),outb); + + xsprintf(descr,"%s",drv->drv_description,probe_a,probe_b); + cfe_attach(drv,softc,NULL,descr); + } + +} + + +static int pcconsole_open(cfe_devctx_t *ctx) +{ + pcconsole_t *softc = ctx->dev_softc; + + outb(softc->kbd_data,KBDCMD_RESET); /* reset keyboard */ + kbd_init(&(softc->ks),pcconsole_setleds,softc); + vga_clear(&(softc->vga)); + vga_setcursor(&(softc->vga),0,0); + + return 0; +} + +static int pcconsole_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + pcconsole_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + + pcconsole_poll(ctx,0); + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + while ((blen > 0) && (kbd_inpstat(&(softc->ks)))) { + *bptr++ = (kbd_read(&(softc->ks)) & 0xFF); + blen--; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + +static int pcconsole_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + pcconsole_t *softc = ctx->dev_softc; + + pcconsole_poll(ctx,0); + + inpstat->inp_status = kbd_inpstat(&(softc->ks)) ? 1 : 0; + + return 0; +} + +static int pcconsole_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + pcconsole_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + vga_writestr(&(softc->vga),bptr,7,blen); + + buffer->buf_retlen = buffer->buf_length; + return 0; +} + +static int pcconsole_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ +/* pcconsole_t *softc = ctx->dev_softc;*/ + + return -1; +} + +static int pcconsole_close(cfe_devctx_t *ctx) +{ +/* pcconsole_t *softc = ctx->dev_softc;*/ + + return 0; +} + + diff --git a/cfe/cfe/pccons/dev_pcconsole2.c b/cfe/cfe/pccons/dev_pcconsole2.c new file mode 100644 index 0000000..e078c13 --- /dev/null +++ b/cfe/cfe/pccons/dev_pcconsole2.c @@ -0,0 +1,298 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PC Console driver File: dev_pcconsole2.c + * + * A console driver for a PC-style keyboard and mouse + * + * This version is for USB keyboards. Someday we'll consolidate + * everything. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + + +#include "sbmips.h" +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_string.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_timer.h" + +#include "lib_physio.h" + +#include "vga_subr.h" + +#include "bsp_config.h" +#include "pcireg.h" +#include "pcivar.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define KBD_RXFULL 1 /* bit set if kb has data */ +#define KBD_TXFULL 2 /* bit set if we can send cmd */ +#define VGA_TEXTBUF_COLOR 0xB8000 /* VGA frame buffer */ + +/* XXX SB1250 specific */ +#define __ISAaddr(x)(0x40000000+(x)) + +/* ********************************************************************* + * Forward references + ********************************************************************* */ + +int pcconsole_enqueue(uint8_t ch); + +static void pcconsole_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + + +static int pcconsole_open(cfe_devctx_t *ctx); +static int pcconsole_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int pcconsole_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int pcconsole_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int pcconsole_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int pcconsole_close(cfe_devctx_t *ctx); +static void pcconsole_poll(cfe_devctx_t *ctx,int64_t ticks); + +const static cfe_devdisp_t pcconsole_dispatch = { + pcconsole_open, + pcconsole_read, + pcconsole_inpstat, + pcconsole_write, + pcconsole_ioctl, + pcconsole_close, + pcconsole_poll, + NULL +}; + +const cfe_driver_t pcconsole2 = { + "PC Console (USB)", + "pcconsole", + CFE_DEV_SERIAL, + &pcconsole_dispatch, + pcconsole_probe +}; + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +#define KBD_QUEUE_LEN 32 + +typedef struct pcconsole_s { + vga_term_t vga; + int kbd_in; + int kbd_out; + uint8_t kbd_data[KBD_QUEUE_LEN]; +} pcconsole_t; + +static pcconsole_t *pcconsole_current = NULL; + +/* ********************************************************************* + * pcconsole_poll(ctx,ticks) + * + * Poll routine - check for new keyboard events + * + * Input parameters: + * ctx - device context + * ticks - current time + * + * Return value: + * nothing + ********************************************************************* */ + + +static void pcconsole_poll(cfe_devctx_t *ctx,int64_t ticks) +{ + /* No polling needed, USB will do the work for us */ +} + + + +/* ********************************************************************* + * pcconsole_probe(drv,probe_a,probe_b,probe_ptr) + * + * Probe routine. This routine sets up the pcconsole device + * + * Input parameters: + * drv - driver structure + * probe_a + * probe_b + * probe_ptr + * + * Return value: + * nothing + ********************************************************************* */ + +static void pcconsole_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + pcconsole_t *softc; + char descr[80]; + + /* + * probe_a is + * probe_b is + * probe_ptr is + */ + + softc = (pcconsole_t *) KMALLOC(sizeof(pcconsole_t),0); + if (softc) { + + memset(softc,0,sizeof(pcconsole_t)); + + /* + * XXX this should not be hardwired + */ + vga_init(&(softc->vga),__ISAaddr(VGA_TEXTBUF_COLOR),outb); + + xsprintf(descr,"%s",drv->drv_description,probe_a,probe_b); + cfe_attach(drv,softc,NULL,descr); + } + +} + + +static int pcconsole_open(cfe_devctx_t *ctx) +{ + pcconsole_t *softc = ctx->dev_softc; + + pcconsole_current = softc; + + softc->kbd_in = 0; + softc->kbd_out = 0; + + vga_clear(&(softc->vga)); + vga_setcursor(&(softc->vga),0,0); + + return 0; +} + +static int pcconsole_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + pcconsole_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + while ((blen > 0) && (softc->kbd_in != softc->kbd_out)) { + *bptr++ = softc->kbd_data[softc->kbd_out]; + softc->kbd_out++; + if (softc->kbd_out >= KBD_QUEUE_LEN) { + softc->kbd_out = 0; + } + blen--; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + +static int pcconsole_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + pcconsole_t *softc = ctx->dev_softc; + + POLL(); + + inpstat->inp_status = (softc->kbd_in != softc->kbd_out); + + return 0; +} + +static int pcconsole_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + pcconsole_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + vga_writestr(&(softc->vga),bptr,7,blen); + + buffer->buf_retlen = buffer->buf_length; + return 0; +} + +static int pcconsole_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ +/* pcconsole_t *softc = ctx->dev_softc;*/ + + return -1; +} + +static int pcconsole_close(cfe_devctx_t *ctx) +{ +/* pcconsole_t *softc = ctx->dev_softc;*/ + pcconsole_current = NULL; + + return 0; +} + +/* + * Called by USB system to queue characters. + */ +int pcconsole_enqueue(uint8_t ch) +{ + int newidx; + + if (!pcconsole_current) return -1; + + newidx = pcconsole_current->kbd_in+1; + if (newidx >= KBD_QUEUE_LEN) newidx = 0; + + if (newidx == pcconsole_current->kbd_out) return -1; + + pcconsole_current->kbd_data[pcconsole_current->kbd_in] = ch; + pcconsole_current->kbd_in = newidx; + + return 0; +} diff --git a/cfe/cfe/pccons/kbd_subr.c b/cfe/cfe/pccons/kbd_subr.c new file mode 100644 index 0000000..860db94 --- /dev/null +++ b/cfe/cfe/pccons/kbd_subr.c @@ -0,0 +1,371 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PC-style keyboard interface File: KBD_SUBR.C + * + * This module converts a stream of scancodes into ASCII + * characters. The scan codes come from a PC-style + * keyboard. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" + +#include "kbd_subr.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define FLG_SCROLL 0x0001 /* Toggles: same as bit positions for LEDs! */ +#define FLG_NUM 0x0002 +#define FLG_CAPS 0x0004 +#define FLG_SHIFT 0x0008 /* Shifts */ +#define FLG_CTRL 0x0100 +#define FLG_ALT 0x0200 +#define FLG_FKEY 0x0400 /* function keys */ +#define FLG_NKPD 0x0800 /* numeric keypad */ +#define FLG_ASCII 0x1000 /* regular ASCII character */ +#define FLG_NONE 0x2000 +#define FLG_BREAKBIT 0x80 + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +#define KC_RESPLEN 4 +typedef struct keycode_s { + int kc_type; + char kc_normal[KC_RESPLEN]; + char kc_shifted[KC_RESPLEN]; + char kc_ctrl[KC_RESPLEN]; +} keycode_t; + + +/* ********************************************************************* + * Scan code conversion table + ********************************************************************* */ + +static keycode_t scantable[] = { + { FLG_NONE, "", "", "" }, /* 0 */ + { FLG_ASCII, "\033", "\033", "\033" }, /* 1 ESC */ + { FLG_ASCII, "1", "!", "!" }, /* 2 1 */ + { FLG_ASCII, "2", "@", "\000" }, /* 3 2 */ + { FLG_ASCII, "3", "#", "#" }, /* 4 3 */ + { FLG_ASCII, "4", "$", "$" }, /* 5 4 */ + { FLG_ASCII, "5", "%", "%" }, /* 6 5 */ + { FLG_ASCII, "6", "^", "\036" }, /* 7 6 */ + { FLG_ASCII, "7", "&", "&" }, /* 8 7 */ + { FLG_ASCII, "8", "*", "\010" }, /* 9 8 */ + { FLG_ASCII, "9", "(", "(" }, /* 10 9 */ + { FLG_ASCII, "0", ")", ")" }, /* 11 0 */ + { FLG_ASCII, "-", "_", "\037" }, /* 12 - */ + { FLG_ASCII, "=", "+", "+" }, /* 13 = */ + { FLG_ASCII, "\177", "\177", "\010" }, /* 14 <- */ + { FLG_ASCII, "\t", "\177\t", "\t" }, /* 15 ->| */ + { FLG_ASCII, "q", "Q", "\021" }, /* 16 q */ + { FLG_ASCII, "w", "W", "\027" }, /* 17 w */ + { FLG_ASCII, "e", "E", "\005" }, /* 18 e */ + { FLG_ASCII, "r", "R", "\022" }, /* 19 r */ + { FLG_ASCII, "t", "T", "\024" }, /* 20 t */ + { FLG_ASCII, "y", "Y", "\031" }, /* 21 y */ + { FLG_ASCII, "u", "U", "\025" }, /* 22 u */ + { FLG_ASCII, "i", "I", "\011" }, /* 23 i */ + { FLG_ASCII, "o", "O", "\017" }, /* 24 o */ + { FLG_ASCII, "p", "P", "\020" }, /* 25 p */ + { FLG_ASCII, "[", "{", "\033" }, /* 26 [ */ + { FLG_ASCII, "]", "}", "\035" }, /* 27 ] */ + { FLG_ASCII, "\r", "\r", "\n" }, /* 28 ENT */ + { FLG_CTRL, "", "", "" }, /* 29 CTRL */ + { FLG_ASCII, "a", "A", "\001" }, /* 30 a */ + { FLG_ASCII, "s", "S", "\023" }, /* 31 s */ + { FLG_ASCII, "d", "D", "\004" }, /* 32 d */ + { FLG_ASCII, "f", "F", "\006" }, /* 33 f */ + { FLG_ASCII, "g", "G", "\007" }, /* 34 g */ + { FLG_ASCII, "h", "H", "\010" }, /* 35 h */ + { FLG_ASCII, "j", "J", "\n" }, /* 36 j */ + { FLG_ASCII, "k", "K", "\013" }, /* 37 k */ + { FLG_ASCII, "l", "L", "\014" }, /* 38 l */ + { FLG_ASCII, ";", ":", ";" }, /* 39 ; */ + { FLG_ASCII, "'", "\"", "'" }, /* 40 ' */ + { FLG_ASCII, "`", "~", "`" }, /* 41 ` */ + { FLG_SHIFT, "", "", "" }, /* 42 SHIFT */ + { FLG_ASCII, "\\", "|", "\034" }, /* 43 \ */ + { FLG_ASCII, "z", "Z", "\032" }, /* 44 z */ + { FLG_ASCII, "x", "X", "\030" }, /* 45 x */ + { FLG_ASCII, "c", "C", "\003" }, /* 46 c */ + { FLG_ASCII, "v", "V", "\026" }, /* 47 v */ + { FLG_ASCII, "b", "B", "\002" }, /* 48 b */ + { FLG_ASCII, "n", "N", "\016" }, /* 49 n */ + { FLG_ASCII, "m", "M", "\r" }, /* 50 m */ + { FLG_ASCII, ",", "<", "<" }, /* 51 , */ + { FLG_ASCII, ".", ">", ">" }, /* 52 . */ + { FLG_ASCII, "/", "?", "\037" }, /* 53 / */ + { FLG_SHIFT, "", "", "" }, /* 54 SHIFT */ + { FLG_NKPD, "*", "*", "*" }, /* 55 KP* */ + { FLG_ALT, "", "", "" }, /* 56 ALT */ + { FLG_ASCII, " ", " ", "\000" }, /* 57 SPC */ + { FLG_CAPS, "", "", "" }, /* 58 CAPS */ + { FLG_FKEY, "\033[M", "\033[Y", "\033[k" }, /* 59 f1 */ + { FLG_FKEY, "\033[N", "\033[Z", "\033[l" }, /* 60 f2 */ + { FLG_FKEY, "\033[O", "\033[a", "\033[m" }, /* 61 f3 */ + { FLG_FKEY, "\033[P", "\033[b", "\033[n" }, /* 62 f4 */ + { FLG_FKEY, "\033[Q", "\033[c", "\033[o" }, /* 63 f5 */ + { FLG_FKEY, "\033[R", "\033[d", "\033[p" }, /* 64 f6 */ + { FLG_FKEY, "\033[S", "\033[e", "\033[q" }, /* 65 f7 */ + { FLG_FKEY, "\033[T", "\033[f", "\033[r" }, /* 66 f8 */ + { FLG_FKEY, "\033[U", "\033[g", "\033[s" }, /* 67 f9 */ + { FLG_FKEY, "\033[V", "\033[h", "\033[t" }, /* 68 f10 */ + { FLG_NUM, "", "", "" }, /* 69 NUMLK */ + { FLG_SCROLL, "", "", "" }, /* 70 SCRLK */ + { FLG_NKPD, "7", "\033[H", "7" }, /* 71 KP7 */ + { FLG_NKPD, "8", "\033[A", "8" }, /* 72 KP8 */ + { FLG_NKPD, "9", "\033[I", "9" }, /* 73 KP9 */ + { FLG_NKPD, "-", "-", "-" }, /* 74 KP- */ + { FLG_NKPD, "4", "\033[D", "4" }, /* 75 KP4 */ + { FLG_NKPD, "5", "\033[E", "5" }, /* 76 KP5 */ + { FLG_NKPD, "6", "\033[C", "6" }, /* 77 KP6 */ + { FLG_NKPD, "+", "+", "+" }, /* 78 KP+ */ + { FLG_NKPD, "1", "\033[F", "1" }, /* 79 KP1 */ + { FLG_NKPD, "2", "\033[B", "2" }, /* 80 KP2 */ + { FLG_NKPD, "3", "\033[G", "3" }, /* 81 KP3 */ + { FLG_NKPD, "0", "\033[L", "0" }, /* 82 KP0 */ + { FLG_NKPD, ".", "\177", "." }, /* 83 KP. */ + { FLG_NONE, "", "", "" }, /* 84 0 */ + { FLG_NONE, "100", "", "" }, /* 85 0 */ + { FLG_NONE, "101", "", "" }, /* 86 0 */ + { FLG_FKEY, "\033[W", "\033[i", "\033[u" }, /* 87 f11 */ + { FLG_FKEY, "\033[X", "\033[j", "\033[v" }, /* 88 f12 */ + { FLG_NONE, "102", "", "" }, /* 89 0 */ + { FLG_NONE, "103", "", "" }, /* 90 0 */ + { FLG_NONE, "", "", "" }, /* 91 0 */ + { FLG_NONE, "", "", "" }, /* 92 0 */ + { FLG_NONE, "", "", "" }, /* 93 0 */ + { FLG_NONE, "", "", "" }, /* 94 0 */ + { FLG_NONE, "", "", "" }, /* 95 0 */ + { FLG_NONE, "", "", "" }, /* 96 0 */ + { FLG_NONE, "", "", "" }, /* 97 0 */ + { FLG_NONE, "", "", "" }, /* 98 0 */ + { FLG_NONE, "", "", "" }, /* 99 0 */ + { FLG_NONE, "", "", "" }, /* 100 */ + { FLG_NONE, "", "", "" }, /* 101 */ + { FLG_NONE, "", "", "" }, /* 102 */ + { FLG_NONE, "", "", "" }, /* 103 */ + { FLG_NONE, "", "", "" }, /* 104 */ + { FLG_NONE, "", "", "" }, /* 105 */ + { FLG_NONE, "", "", "" }, /* 106 */ + { FLG_NONE, "", "", "" }, /* 107 */ + { FLG_NONE, "", "", "" }, /* 108 */ + { FLG_NONE, "", "", "" }, /* 109 */ + { FLG_NONE, "", "", "" }, /* 110 */ + { FLG_NONE, "", "", "" }, /* 111 */ + { FLG_NONE, "", "", "" }, /* 112 */ + { FLG_NONE, "", "", "" }, /* 113 */ + { FLG_NONE, "", "", "" }, /* 114 */ + { FLG_NONE, "", "", "" }, /* 115 */ + { FLG_NONE, "", "", "" }, /* 116 */ + { FLG_NONE, "", "", "" }, /* 117 */ + { FLG_NONE, "", "", "" }, /* 118 */ + { FLG_NONE, "", "", "" }, /* 119 */ + { FLG_NONE, "", "", "" }, /* 120 */ + { FLG_NONE, "", "", "" }, /* 121 */ + { FLG_NONE, "", "", "" }, /* 122 */ + { FLG_NONE, "", "", "" }, /* 123 */ + { FLG_NONE, "", "", "" }, /* 124 */ + { FLG_NONE, "", "", "" }, /* 125 */ + { FLG_NONE, "", "", "" }, /* 126 */ + { FLG_NONE, "", "", "" }, /* 127 */ +}; + + +/* ********************************************************************* + * KBD_ENQUEUECHAR(ks,ch) + * + * Put a character on the queue + * + * Input parameters: + * ks - keyboard state + * ch - character to enqueue + * + * Return value: + * nothing + ********************************************************************* */ + +static void kbd_enqueuechar(keystate_t *ks,char ch) +{ + if (((ks->ks_head+1) & (KEYQUEUELEN-1)) == ks->ks_tail) { + /* queue is full */ + return; + } + ks->ks_queue[ks->ks_head] = ch; + ks->ks_head = (ks->ks_head+1) & (KEYQUEUELEN-1); +} + + +/* ********************************************************************* + * KBD_DEQUEUECHAR(ks) + * + * Remove a character from the queue + * + * Input parameters: + * ks - keystate + * + * Return value: + * 0 if no characters in queue + * else character from queue + ********************************************************************* */ +static int kbd_dequeuechar(keystate_t *ks) +{ + char ch; + + if (ks->ks_head == ks->ks_tail) return 0; + + ch = ks->ks_queue[ks->ks_tail]; + ks->ks_tail = (ks->ks_tail+1) & (KEYQUEUELEN-1); + return ch; +} + +/* ********************************************************************* + * KBD_READ(ks) + * + * User call to kbd_dequeuechar - remove a character from + * the queue. + * + * Input parameters: + * ks - keyboard state + * + * Return value: + * character from queue or 0 if no chars + ********************************************************************* */ + +int kbd_read(keystate_t *ks) +{ + return kbd_dequeuechar(ks); +} + +/* ********************************************************************* + * KBD_INPSTAT(ks) + * + * Test input status (see if a character is waiting) + * + * Input parameters: + * ks - keyboard state + * + * Return value: + * 0 if no chars waiting, 1 if characters are waiting + ********************************************************************* */ + +int kbd_inpstat(keystate_t *ks) +{ + return (ks->ks_head != ks->ks_tail); +} + + +/* ********************************************************************* + * KBD_DOSCAN(ks,scan) + * + * Process a scan code from the keyboard. + * + * Input parameters: + * ks - keyboard state + * scan - scan code from the keyboard + * + * Return value: + * nothing + ********************************************************************* */ + +void kbd_doscan(keystate_t *ks,uint8_t scan) +{ + int breakflg; + keycode_t *code = 0; + char *str; + + breakflg = (scan & FLG_BREAKBIT); + scan &= ~FLG_BREAKBIT; + code = &scantable[scan]; + + if (code->kc_type & (FLG_SHIFT|FLG_CTRL|FLG_ALT)) { + if (breakflg) ks->ks_shiftflags &= ~code->kc_type; + else ks->ks_shiftflags |= code->kc_type; + } + if (code->kc_type & (FLG_CAPS|FLG_SCROLL|FLG_NUM)) { + if (!breakflg) ks->ks_shiftflags ^= code->kc_type; + if (ks->ks_setleds) { + (*(ks->ks_setleds))(ks,ks->ks_shiftflags & (FLG_CAPS|FLG_SCROLL|FLG_NUM)); + } + } + if (code->kc_type & (FLG_ASCII | FLG_FKEY | FLG_NKPD)) { + if (ks->ks_shiftflags & (FLG_SHIFT|FLG_CAPS)) str = code->kc_shifted; + else if (ks->ks_shiftflags & FLG_CTRL) str = code->kc_ctrl; + else str = code->kc_normal; + if (!breakflg) { + while (*str) { + kbd_enqueuechar(ks,*str++); + } + } + } +} + + +/* ********************************************************************* + * KBD_INIT(ks,setleds,ref) + * + * Initialize a keyboard state object. + * + * Input parameters: + * ks - keyboard state + * setleds - routine to call when we want to set the state + * of the keyboard's LEDs + * ref - data to store in the keyboard state object + * + * Return value: + * nothing + ********************************************************************* */ + +void kbd_init(keystate_t *ks,int (*setleds)(keystate_t *,int),void *ref) +{ + memset(ks,0,sizeof(keystate_t)); + ks->ks_setleds = setleds; + ks->ks_ref = ref; +} diff --git a/cfe/cfe/pccons/kbd_subr.h b/cfe/cfe/pccons/kbd_subr.h new file mode 100644 index 0000000..f18f8db --- /dev/null +++ b/cfe/cfe/pccons/kbd_subr.h @@ -0,0 +1,82 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PC-style keyboard interface File: KBD_SUBR.C + * + * This module converts a stream of scancodes into ASCII + * characters. The scan codes come from a PC-style + * keyboard. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define KEYQUEUELEN 16 + +#define KBDCMD_RESET 0xFF +#define KBDCMD_SETLEDS 0xED + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct keystate_s { + int ks_shiftflags; + char ks_queue[KEYQUEUELEN]; + int ks_head; + int ks_tail; + int (*ks_setleds)(struct keystate_s *ks,int leds); + void *ks_ref; +} keystate_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int kbd_read(keystate_t *ks); +int kbd_inpstat(keystate_t *ks); +void kbd_init(keystate_t *ks,int (*setleds)(keystate_t *,int),void *ref); +void kbd_doscan(keystate_t *ks,uint8_t scan); +#define kbd_getref(x) ((x)->ks_ref) + + diff --git a/cfe/cfe/pccons/pcibios.h b/cfe/cfe/pccons/pcibios.h new file mode 100644 index 0000000..8da8648 --- /dev/null +++ b/cfe/cfe/pccons/pcibios.h @@ -0,0 +1,72 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PCI BIOS constants File: PCIBIOS.H + * + * This module contains constants related to the X86's PCI + * BIOS, as described in the PCI BIOS specification. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#define PCIBIOS_FN_MAJOR 0xB1 +#define PCIBIOS_FN_INSTCHK 0x01 +#define PCIBIOS_FN_FINDDEV 0x02 +#define PCIBIOS_FN_FINDCLASS 0x03 +#define PCIBIOS_FN_RDCFGBYTE 0x08 +#define PCIBIOS_FN_RDCFGWORD 0x09 +#define PCIBIOS_FN_RDCFGDWORD 0x0A + +#define PCIBIOS_FN_WRCFGBYTE 0x0B +#define PCIBIOS_FN_WRCFGWORD 0x0C +#define PCIBIOS_FN_WRCFGDWORD 0x0D +#define PCIBIOS_SUCCESSFUL 0 +#define PCIBIOS_DEVICE_NOT_FOUND 0x86 + +#define PCIBIOS_VERSION 0x0210 +#define PCIBIOS_SIGNATURE 0x20494350 + +#define PCIBIOS_ROMSIG_OFFSET 0 +#define PCIBIOS_ROMSIG1 0x55 +#define PCIBIOS_ROMSIG2 0xAA +#define PCIBIOS_ROMSIZE(x) ((unsigned int)(x)*512) + +#define PCIBIOS_ROMSIZE_OFFSET 2 +#define PCIBIOS_ROMENTRY_OFFSET 3 diff --git a/cfe/cfe/pccons/vga.h b/cfe/cfe/pccons/vga.h new file mode 100644 index 0000000..5c43664 --- /dev/null +++ b/cfe/cfe/pccons/vga.h @@ -0,0 +1,76 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * VGA definitions File: VGA.H + * + * This module contains names of the registers and bits + * commonly used on VGA adapters. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#define VGA_GFXCTL_INDEX 0x3CE +#define VGA_GFXCTL_DATA 0x3CF +#define VGA_CRTC_INDEX 0x3D4 +#define VGA_CRTC_DATA 0x3D5 +#define VGA_SEQ_INDEX 0x3C4 +#define VGA_SEQ_DATA 0x3C5 +#define VGA_INPSTATUS_R 0x3C2 +#define VGA_MISCOUTPUT_W 0x3C2 +#define VGA_MISCOUTPUT_R 0x3CC +#define VGA_ATTRIB_INDEX 0x3C0 +#define VGA_ATTRIB_DATA 0x3C1 +#define VGA_FEATURES_W 0x3DA +#define VGA_EXT_INDEX 0x3D6 +#define VGA_EXT_DATA 0x3D7 + +#define CRTC_CURSOR_HIGH 0x0E +#define CRTC_CURSOR_LOW 0x0F + +#define VGA_TEXTBUF_COLOR 0xB8000 +#define VGA_TEXTBUF_MONO 0xB0000 +#define VGA_TEXTBUF_SIZE 0x8000 + +#define VGA_ATTRIB_MONO 7 + +#define VGA_TEXTMODE_COLS 80 +#define VGA_TEXTMODE_ROWS 25 + diff --git a/cfe/cfe/pccons/vga_subr.c b/cfe/cfe/pccons/vga_subr.c new file mode 100644 index 0000000..7704054 --- /dev/null +++ b/cfe/cfe/pccons/vga_subr.c @@ -0,0 +1,285 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * VGA "teletype" routines File: VGA_SUBR.C + * + * These routines implement a simple "glass tty" interface + * to a vga monitor. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "lib_malloc.h" + +#include "lib_physio.h" + +#include "vga_subr.h" +#include "vga.h" + + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define OUTB(vga,port,val) (*((vga)->vga_outb))(port,val) + +#ifdef __MIPSEB +#define VGA_SPACE_CHAR 0x2007 /* belongs somewhere else */ +#else +#define VGA_SPACE_CHAR 0x0720 +#endif + +/* ********************************************************************* + * Data + ********************************************************************* */ + + +/* ********************************************************************* + * VGA_CLEAR(vga) + * + * Clear the VGA screen + * + * Input parameters: + * vga - VGA object + * + * Return value: + * nothing + ********************************************************************* */ + +void vga_clear(vga_term_t *vga) +{ + int idx; + + /* Clear the frame buffer */ + + for (idx = 0; idx < VGA_TEXTBUF_SIZE; idx+=2) { + phys_write16(vga->vga_buffer+idx,VGA_SPACE_CHAR); + } +} + + +/* ********************************************************************* + * VGA_SETCURSOR(vga,x,y) + * + * Set the hardware cursor position + * + * Input parameters: + * vga - VGA object + * x,y - cursor location + * + * Return value: + * nothing + ********************************************************************* */ + +void vga_setcursor(vga_term_t *vga,int x,int y) +{ + unsigned int loc = y*vga->vga_ncols + x; + + OUTB(vga,VGA_CRTC_INDEX,CRTC_CURSOR_HIGH); + OUTB(vga,VGA_CRTC_DATA,(loc >> 8) & 0xFF); + OUTB(vga,VGA_CRTC_INDEX,CRTC_CURSOR_LOW); + OUTB(vga,VGA_CRTC_DATA,(loc >> 0) & 0xFF); + + vga->vga_cursorX = x; + vga->vga_cursorY = y; +} + +/* ********************************************************************* + * VGA_SCROLL(vga) + * + * Scroll the display up one line + * + * Input parameters: + * vga - VGA object + * + * Return value: + * nothing + ********************************************************************* */ + +static void vga_scroll(vga_term_t *vga) +{ + int idx; + int count; + int rowsize; + uint32_t t; + + rowsize = vga->vga_ncols * 2; + count = (vga->vga_nrows-1) * rowsize; + + for (idx = 0; idx < count; idx+=4) { + t = phys_read32(vga->vga_buffer+idx+rowsize); + phys_write32(vga->vga_buffer+idx,t); + } + + for (idx = 0; idx < rowsize; idx += 2) { + phys_write16(vga->vga_buffer+(vga->vga_nrows-1)*rowsize+idx,VGA_SPACE_CHAR); + } + + vga_setcursor(vga,0,vga->vga_nrows-1); +} + +/* ********************************************************************* + * VGA_WRITECHAR(vga,ch,attr) + * + * Write a character to the display. This routine also + * interprets some rudimentary control characters, such + * as tab, backspace, linefeed, and carriage return. + * + * Input parameters: + * vga - VGA object + * ch - character to write + * attr - attribute byte for new character + * + * Return value: + * nothing + ********************************************************************* */ + +void vga_writechar(vga_term_t *vga,uint8_t ch,uint8_t attr) +{ + physaddr_t addr; + + switch (ch) { + case 0x07: + break; + case 0x09: + vga_writechar(vga,' ',attr); + while (vga->vga_cursorX % 8) vga_writechar(vga,' ',attr); + break; + case 0x0A: + vga->vga_cursorY++; + if (vga->vga_cursorY > (vga->vga_nrows-1)) { + vga_scroll(vga); + } + break; + case 0x08: + if (vga->vga_cursorX) { + vga->vga_cursorX--; + addr = vga->vga_buffer + (vga->vga_cursorX*2+vga->vga_cursorY*vga->vga_ncols*2); + phys_write8(addr,' '); + } + break; + case 0x0D: + vga->vga_cursorX = 0; + break; + default: + addr = vga->vga_buffer + (vga->vga_cursorX*2+vga->vga_cursorY*vga->vga_ncols*2); + phys_write8(addr,ch); + phys_write8(addr+1,attr); + vga->vga_cursorX++; + if (vga->vga_cursorX > (vga->vga_ncols-1)) { + vga->vga_cursorX = 0; + vga->vga_cursorY++; + if (vga->vga_cursorY > (vga->vga_nrows-1)) { + vga_scroll(vga); + } + } + break; + } + + vga_setcursor(vga,vga->vga_cursorX,vga->vga_cursorY); +} + +/* ********************************************************************* + * VGA_WRITESTR(vga,str,attr,len) + * + * Write a string of characters to the VGA + * + * Input parameters: + * vga - VGA object + * str - pointer to buffer + * attr - attribute byte for characters we're writing + * len - number of characters to write + * + * Return value: + * nothing + ********************************************************************* */ + +void vga_writestr(vga_term_t *vga,uint8_t *str,uint8_t attr,int len) +{ + while (len) { + vga_writechar(vga,*str,attr); + str++; + len--; + } +} + +/* ********************************************************************* + * VGA_RESET(vga) + * + * (mostly unused) - reset the VGA + * + * Input parameters: + * vga - vga object + * + * Return value: + * nothing + ********************************************************************* */ + +void vga_reset(vga_term_t *vga) +{ + vga_clear(vga); +} + +/* ********************************************************************* + * VGA_INIT(vga,buffer,outfunc) + * + * Initialize a VGA object + * + * Input parameters: + * vga - VGA object + * buffer - pointer to VGA-style frame buffer (physical addr) + * outfunc - pointer to function to write ISA I/O ports + * + * Return value: + * nothing + ********************************************************************* */ + +void vga_init(vga_term_t *vga,physaddr_t buffer,void (*outfunc)(unsigned int port,uint8_t val)) +{ + vga->vga_buffer = buffer; + vga->vga_cursorX = 0; + vga->vga_cursorY = 0; + vga->vga_nrows = VGA_TEXTMODE_ROWS; + vga->vga_ncols = VGA_TEXTMODE_COLS; + vga->vga_outb = outfunc; +} diff --git a/cfe/cfe/pccons/vga_subr.h b/cfe/cfe/pccons/vga_subr.h new file mode 100644 index 0000000..eb0e0e0 --- /dev/null +++ b/cfe/cfe/pccons/vga_subr.h @@ -0,0 +1,82 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * VGA "teletype" routines File: VGA_SUBR.H + * + * These routines implement a simple "glass tty" interface + * to a vga monitor. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct vga_term_s { + physaddr_t vga_buffer; + int vga_nrows; + int vga_ncols; + int vga_cursorX; + int vga_cursorY; + void (*vga_outb)(unsigned int isaport,uint8_t val); +} vga_term_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + + +void vga_clear(vga_term_t *vga); +void vga_setcursor(vga_term_t *vga,int x,int y); +void vga_writechar(vga_term_t *vga,uint8_t ch,uint8_t attr); +void vga_writestr(vga_term_t *vga,uint8_t *str,uint8_t attr,int len); +void vga_reset(vga_term_t *vga); +void vga_init(vga_term_t *vga,physaddr_t buffer,void (*outfunc)(unsigned int port,uint8_t val)); + + + + + + + + + + + diff --git a/cfe/cfe/pccons/vgainit.c b/cfe/cfe/pccons/vgainit.c new file mode 100644 index 0000000..7c22af2 --- /dev/null +++ b/cfe/cfe/pccons/vgainit.c @@ -0,0 +1,1164 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * VGA BIOS initialization File: VGAINIT.C + * + * This module interfaces with the X86 emulator borrowed from + * XFree86 to do VGA initialization. + * + * WARNING: This code is SB1250-specific for now. It's not + * hard to change, but then again, aren't we interested in the 1250? + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "sbmips.h" +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "lib_malloc.h" +#include "pcireg.h" +#include "pcivar.h" +#include "cfe_console.h" +#include "vga.h" +#include "pcibios.h" +#include "lib_physio.h" +#include "vga_subr.h" +#include "x86mem.h" +#include "x86emu.h" +#include "env_subr.h" + + +/* ********************************************************************* + * Configuration + ********************************************************************* */ + +#define BYTESONLY 0 /* Always write registers as bytes */ +#define VGAINIT_NOISY 0 /* lots of debug output */ + +/* ********************************************************************* + * ISA port macros - currently SB1250-specific + ********************************************************************* */ + +#define INB(x) inb(x) +#define INW(x) inw(x) +#define INL(x) inl(x) +#define OUTB(x,y) outb(x,y) +#define OUTW(x,y) outw(x,y) +#define OUTL(x,y) outl(x,y) + +/* ********************************************************************* + * ISA memory macros - currently SB1250-specific + ********************************************************************* */ + +typedef uintptr_t vm_offset_t; + +#if defined(_P5064_) || defined(_P6064_) + #define PCI_MEM_SPACE 0x10000000 /* 128MB: s/w configurable */ + #define __ISAaddr(addr) ((physaddr_t)(PCI_MEM_SPACE+(addr))) +#else + #define __ISAaddr(addr) ((physaddr_t)0x40000000+(addr)) +#endif + +#define __ISAreadbyte(addr) phys_read8(__ISAaddr(addr)) +#define __ISAreadword(addr) phys_read16(__ISAaddr(addr)) +#define __ISAreaddword(addr) phys_read32(__ISAaddr(addr)) +#define __ISAwritebyte(addr,data) phys_write8(__ISAaddr(addr),(data)) +#define __ISAwriteword(addr,data) phys_write16(__ISAaddr(addr),(data)) +#define __ISAwritedword(addr,data) phys_write32(__ISAaddr(addr),(data)) + +/* ********************************************************************* + * Other macros + ********************************************************************* */ + +#define OFFSET(addr) (((addr) >> 0) & 0xffff) +#define SEGMENT(addr) (((addr) >> 4) & 0xf000) + +#define BSWAP_SHORT(s) ((((s) >> 8) & 0xFF) | (((s)&0xFF) << 8)) +#define BSWAP_LONG(s) ((((s) & 0xFF000000) >> 24) | \ + (((s) & 0x00FF0000) >> 8) | \ + (((s) & 0x0000FF00) << 8) | \ + (((s) & 0x000000FF) << 24)) + + +#ifdef __MIPSEB +#define CPU_TO_LE16(s) BSWAP_SHORT(s) +#define CPU_TO_LE32(s) BSWAP_LONG(s) +#define LE16_TO_CPU(s) BSWAP_SHORT(s) +#define LE32_TO_CPU(s) BSWAP_LONG(s) +#else +#define CPU_TO_LE16(s) (s) +#define CPU_TO_LE32(s) (s) +#define LE16_TO_CPU(s) (s) +#define LE32_TO_CPU(s) (s) +#endif + + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int vga_biosinit(void); +int vga_probe(void); +extern void ui_restart(int); +void vgaraw_dump(char *tail); +int x86emutest(void); + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +static vga_term_t vga; +static x86mem_t x86mem; + +#define BIOSRAMLOC (0xC0000) +#define STACKSIZE 4096 +#define IRETOFFSET 12 +static uint8_t x86initcode[] = { +#if (VGA_TEXTMODE_ROWS == 60) + 0xB8,0x02,0x4F, /* mov ax,042F */ + 0xBB,0x08,0x01, /* mov bx,0108 */ /* VESA 80x60 */ +#else + 0xB8,0x03,0x00, /* mov AX,0003 */ /* 80x25 mode */ +#endif + + 0xCD,0x10, /* int 10 */ + 0xB8,0x34,0x12, /* mov ax,1234 */ + 0xBB,0x78,0x56, /* mov bx,5678 */ + 0xCC, /* int 3 */ + 0xCF}; /* IRET */ + +static uint8_t x86testcode[] = { + 0x90,0x90,0x90,0x90,0x90, /* nop, nop, nop, nop, nop */ + 0xeb,0x09, /* jmp 10 */ + 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90, /* 9 nops */ + 0xb8,0x34,0x12, /* mov ax,1234 */ + 0xbb,0x78,0x56, /* mov bx,5678 */ + 0xcc, /* int 3 */ + 0xcf}; /* iret */ + +static uint32_t __ISAreadmem(x86mem_t *mem,uint32_t addr,int size) +{ + unsigned long val; + + switch (size) { + case M_BYTE: + val = __ISAreadbyte(addr); + break; + case M_WORD: + if (BYTESONLY || (addr & 0x1)) { + val = (__ISAreadbyte(addr) | (__ISAreadbyte(addr + 1) << 8)); + } + else { + val = __ISAreadword(addr); + val = LE16_TO_CPU(val); + } + break; + case M_DWORD: + if (BYTESONLY || (addr & 0x3)) { + val = (__ISAreadbyte(addr) | + (__ISAreadbyte(addr + 1) << 8) | + (__ISAreadbyte(addr + 2) << 16) | + (__ISAreadbyte(addr + 3) << 24)); + } + else { + val = __ISAreaddword(addr); + val = LE32_TO_CPU(val); + } + break; + default: + val = 0; + } + + return val; +} + + + +static void __ISAwritemem(x86mem_t *mem,uint32_t addr,uint32_t data,int size) +{ + switch (size) { + case M_BYTE: + __ISAwritebyte(addr, data); + break; + + case M_WORD: + if (BYTESONLY || (addr & 0x1)) { + __ISAwritebyte(addr, data >> 0); + __ISAwritebyte(addr + 1, data >> 8); + } + else { + data = CPU_TO_LE16(data); + __ISAwriteword(addr, data); + } + break; + + case M_DWORD: + if (BYTESONLY || (addr & 0x3)) { + __ISAwritebyte(addr, data >> 0); + __ISAwritebyte(addr + 1, data >> 8); + __ISAwritebyte(addr + 2, data >> 16); + __ISAwritebyte(addr + 3, data >> 24); + } + else { + data = CPU_TO_LE32(data); + __ISAwritedword(addr, data); + } + break; + } +} + + +static u8 __x86emu_rdb(u32 addr) +{ +#if VGAINIT_NOISY + if ((addr < 0x400) || (addr > 0x100000)) { + xprintf("Read %08X (int %02X) ",addr,addr/4); + printf("CS:IP = %04X:%04X\n",M.x86.R_CS,M.x86.R_IP); + } +#endif + return x86mem_readb(&x86mem,addr); +} + + +static u16 __x86emu_rdw(u32 addr) +{ +#if VGAINIT_NOISY + if ((addr < 0x400) || (addr > 0x100000)) { + xprintf("Read %08X (int %02X) ",addr,addr/4); + printf("CS:IP = %04X:%04X\n",M.x86.R_CS,M.x86.R_IP); + } +#endif + return x86mem_readw(&x86mem,addr); +} + + +static u32 __x86emu_rdl(u32 addr) +{ +#if VGAINIT_NOISY + if ((addr < 0x400) || (addr > 0x100000)) { + xprintf("Read %08X (int %02X) ",addr,addr/4); + printf("CS:IP = %04X:%04X\n",M.x86.R_CS,M.x86.R_IP); + } +#endif + return x86mem_readl(&x86mem,addr); +} + + +static void __x86emu_wrb(u32 addr, u8 val) +{ +#if VGAINIT_NOISY + if ((addr < 0x400) || (addr > 0x100000)) { + xprintf("Write %08X (int %02X) ",addr,addr/4); + printf("CS:IP = %04X:%04X\n",M.x86.R_CS,M.x86.R_IP); + } +#endif + x86mem_writeb(&x86mem,addr,val); +} + + +static void __x86emu_wrw(u32 addr, u16 val) +{ +#if VGAINIT_NOISY + if ((addr < 0x400) || (addr > 0x100000)) { + xprintf("Write %08X %04X (int %02X) ",addr,val,addr/4); + printf("CS:IP = %04X:%04X\n",M.x86.R_CS,M.x86.R_IP); + } +#endif + x86mem_writew(&x86mem,addr,val); +} + + +static void __x86emu_wrl(u32 addr, u32 val) +{ +#if VGAINIT_NOISY + if ((addr < 0x400) || (addr > 0x100000)) { + xprintf("Write %08X (int %02X) ",addr,addr/4); + printf("CS:IP = %04X:%04X\n",M.x86.R_CS,M.x86.R_IP); + } +#endif + x86mem_writel(&x86mem,addr,val); +} + + +#define TS_COMMAND 0 +#define TS_DATA1 1 +#define TS_DATA2 2 +static uint16_t timerCount = 0; +static int timerState = TS_COMMAND; +static u8 __x86emu_inb(X86EMU_pioAddr port) +{ + u8 val; + + /* + * Emulate just enough functionality of the + * timer chip to fool the Trident BIOS + */ + if (port == 0x40) { + timerCount++; + switch (timerState) { + case TS_COMMAND: + return 0; + case TS_DATA1: + timerState = TS_DATA1; + return timerCount & 0xFF; + case TS_DATA2: + timerState = TS_COMMAND; + return (timerCount >> 8) & 0xFF; + } + } + + val = INB(port); + +#if VGAINIT_NOISY + /*if (port < 0x100)*/ xprintf("INB %08X %02X\n",port,val); + if (console_status()) ui_restart(0); +#endif + + + return val; +} + + +static u16 __x86emu_inw(X86EMU_pioAddr port) +{ + u16 val; + + val = INW(port); + + val = LE16_TO_CPU(val); + +#if VGAINIT_NOISY + /*if (port < 0x100)*/ xprintf("INW %08X %04X\n",port,val); +#endif + + return val; +} + + +static u32 __x86emu_inl(X86EMU_pioAddr port) +{ + u32 val; + + val = INL(port); + + val = LE32_TO_CPU(val); + +#if VGAINIT_NOISY + /*if (port < 0x100)*/ xprintf("INL %08X %08X\n",port,val); +#endif + + + return val; +} + + +static void __x86emu_outb(X86EMU_pioAddr port, u8 val) +{ + /* + * Emulate just enough functionality of the timer + * chip to fool the Trident BIOS + */ + if (port == 0x43) { + timerCount++; + timerState = TS_DATA1; + return; + } + +#if VGAINIT_NOISY + /*if (port < 0x100)*/ xprintf("OUTB %08X %08X\n",port,val); +#endif + + OUTB(port,val); +} + + +static void __x86emu_outw(X86EMU_pioAddr port, u16 val) +{ + val = CPU_TO_LE16(val); + +#if VGAINIT_NOISY + /*if (port < 0x100)*/ xprintf("OUTW %08X %04X ",port,val); + printf("CS:IP = %04X:%04X\n",M.x86.R_CS,M.x86.R_IP); +#endif + + OUTW(port,val); +} + + +static void __x86emu_outl(X86EMU_pioAddr port, u32 val) +{ + if (port == 0x2D) return; + + val = CPU_TO_LE32(val); + +#if VGAINIT_NOISY + /*if (port < 0x100)*/ xprintf("OUTL %08X %08X ",port,val); + printf("CS:IP = %04X:%04X\n",M.x86.R_CS,M.x86.R_IP); +#endif + + + OUTL(port,val); +} + + +static void regs2tag(pcitag_t *tag) +{ + pcitag_t mytag; + int bus,device,function; + + bus = M.x86.R_BH; + device = M.x86.R_BL >> 3; + function = M.x86.R_BL & 0x07; + + mytag = pci_make_tag(bus,device,function); + + *tag = mytag; +} + +static void __SIMint10(int intno) +{ +#if VGAINIT_NOISY + xprintf("Int10: BIOS function AX=%04X\n",M.x86.R_AX); +#endif + + /* + * The only BIOS function that VGAs appear to + * depend on in the real BIOS is the one + * that enables/disables video memory. + */ + + if ((M.x86.R_AH == 0x12) && (M.x86.R_BL == 0x32)) { + if (M.x86.R_AL == 0) { + /* enable video memory */ + __x86emu_outb(VGA_MISCOUTPUT_W, __x86emu_inb(VGA_MISCOUTPUT_R) | 0x02); + return; + } + else if (M.x86.R_AL == 1) { + /* disable video memory */ + __x86emu_outb(VGA_MISCOUTPUT_W, __x86emu_inb(VGA_MISCOUTPUT_R) & ~0x02); + return; + } + else { + xprintf("Int10 unknown function AX=%04X\n", + M.x86.R_AX); + } + } + else { + + /* Otherwise, pass the int10 on to the ROM */ + + X86EMU_prepareForInt(0x10); + } +} + + +static void __SIMint3(int intno) +{ +#if VGAINIT_NOISY + xprintf("Int3: Breakpoint reached.\n"); +#endif + HALT_SYS(); +} + + +static void __SIMintunk(int intno) +{ +#if VGAINIT_NOISY + xprintf("Int%02X: Unhandled interrupt!\n",intno); +#endif + HALT_SYS(); +} + +static void __SIMint42(int intno) +{ +#if VGAINIT_NOISY + xprintf("Int42: Function AX=%04X\n",M.x86.R_AX); +#endif + switch (M.x86.R_AH) { + case 0: + vga_reset(&vga); + break; + default: +#if VGAINIT_NOISY + xprintf("Int42: Unknown INT42 command: %x\n",M.x86.R_AH); +#endif + break; + } +} + + +static void __SIMint6D(int intno) +{ + int reflect = 1; + +#if VGAINIT_NOISY + xprintf("Int6D: Function AX=%04X\n",M.x86.R_AX); +#endif + + switch (M.x86.R_AH) { + case 0: + break; + case 0x13: + if (M.x86.R_AL == 1) { + unsigned long addr; + unsigned long count; + uint8_t ch; + + addr = (M.x86.R_ES << 4) + M.x86.R_BP; + count = M.x86.R_CX; + + while (count) { + ch = __x86emu_rdb(addr); + vga_writechar(&vga,ch,M.x86.R_BL); + addr++; + count--; + } + reflect = 0; + } + break; + default: +#if VGAINIT_NOISY + xprintf("Unknown INT6D command: %x\n",M.x86.R_AH); +#endif + break; + } + + if (reflect) X86EMU_prepareForInt(0x6D); +} + + + +static void __SIMint1A(int intno) +{ + pcitag_t tag; + int bus,device,function; + int ret; + + if (M.x86.R_AH != PCIBIOS_FN_MAJOR) return; + + switch (M.x86.R_AL) { + case PCIBIOS_FN_INSTCHK: + M.x86.R_EAX = 0x00; + M.x86.R_AL = 0x01; + M.x86.R_EDX = PCIBIOS_SIGNATURE; + M.x86.R_EBX = PCIBIOS_VERSION; + M.x86.R_ECX &= 0xFF00; + M.x86.R_CL = 0; /* Highest bus number */ +#ifdef VGAINIT_NOISY + xprintf("Int1A: Installation check\n"); +#endif + CLEAR_FLAG(F_CF); + break; + + case PCIBIOS_FN_FINDDEV: + ret = pci_find_device(M.x86.R_DX,M.x86.R_CX,M.x86.R_SI,&tag); +#if VGAINIT_NOISY + xprintf("Int1A: Find device VID=%04X,DID=%04X,Idx=%d: ", + M.x86.R_DX,M.x86.R_CX,M.x86.R_SI); + if (ret == 0) { + pci_break_tag(tag,&bus,&device,&function); + xprintf("Found Bus%d, Dev%d, Func%d\n",bus,device,function); + } + else { + xprintf("not found.\n"); + } +#endif + if (ret == 0) { + pci_break_tag(tag,&bus,&device,&function); + M.x86.R_BH = bus; + M.x86.R_BL = (device << 3) | function; + M.x86.R_AH = PCIBIOS_SUCCESSFUL; + } + else { + M.x86.R_AH = PCIBIOS_DEVICE_NOT_FOUND; + } + + CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL),F_CF); + break; + + case PCIBIOS_FN_FINDCLASS: + ret = pci_find_class(M.x86.R_ECX,M.x86.R_SI,&tag); +#if VGAINIT_NOISY + xprintf("Int1A: Find Class %08X,Idx=%d: ", + M.x86.R_ECX,M.x86.R_SI); + if (ret == 0) { + pci_break_tag(tag,&bus,&device,&function); + xprintf("Found Bus%d, Dev%d, Func%d\n",bus,device,function); + } + else { + xprintf("not found.\n"); + } +#endif + + if (ret == 0) { + pci_break_tag(tag,&bus,&device,&function); + M.x86.R_BH = bus; + M.x86.R_BL = (device << 3) | function; + M.x86.R_AH = PCIBIOS_SUCCESSFUL; + } + else { + M.x86.R_AH =PCIBIOS_DEVICE_NOT_FOUND; + } + + CONDITIONAL_SET_FLAG((M.x86.R_AH != PCIBIOS_SUCCESSFUL),F_CF); + break; + + case PCIBIOS_FN_RDCFGBYTE: + regs2tag(&tag); + M.x86.R_CL = pci_conf_read8(tag,M.x86.R_DI); + M.x86.R_AH = PCIBIOS_SUCCESSFUL; +#if VGAINIT_NOISY + xprintf("Int1A: Read Cfg Byte %04X from ",M.x86.R_DI); + pci_break_tag(tag,&bus,&device,&function); + xprintf("Bus%d, Dev%d, Func%d",bus,device,function); + xprintf(": %02X\n",M.x86.R_CX); +#endif + + CLEAR_FLAG(F_CF); + break; + + case PCIBIOS_FN_RDCFGWORD: + regs2tag(&tag); + M.x86.R_CX = pci_conf_read16(tag,M.x86.R_DI); + M.x86.R_AH = PCIBIOS_SUCCESSFUL; +#if VGAINIT_NOISY + xprintf("Int1A: Read Cfg Word %04X from ",M.x86.R_DI); + pci_break_tag(tag,&bus,&device,&function); + xprintf("Bus%d, Dev%d, Func%d",bus,device,function); + xprintf(": %04X\n",M.x86.R_CX); +#endif + CLEAR_FLAG(F_CF); + break; + + case PCIBIOS_FN_RDCFGDWORD: + regs2tag(&tag); + M.x86.R_ECX = pci_conf_read(tag,M.x86.R_DI); +#if VGAINIT_NOISY + xprintf("Int1A: Read Cfg Dword %04X from ",M.x86.R_DI); + pci_break_tag(tag,&bus,&device,&function); + xprintf("Bus%d, Dev%d, Func%d",bus,device,function); + xprintf(": %08X\n",M.x86.R_ECX); +#endif + M.x86.R_AH = PCIBIOS_SUCCESSFUL; + CLEAR_FLAG(F_CF); + break; + + case PCIBIOS_FN_WRCFGBYTE: + regs2tag(&tag); + pci_conf_write8(tag,M.x86.R_DI,M.x86.R_CL); +#if VGAINIT_NOISY + xprintf("Int1A: Write Cfg byte %04X to ",M.x86.R_DI); + pci_break_tag(tag,&bus,&device,&function); + xprintf("Bus%d, Dev%d, Func%d",bus,device,function); + xprintf(": %02X\n",M.x86.R_CL); +#endif + + M.x86.R_AH = PCIBIOS_SUCCESSFUL; + CLEAR_FLAG(F_CF); + break; + + case PCIBIOS_FN_WRCFGWORD: + regs2tag(&tag); + pci_conf_write16(tag,M.x86.R_DI,M.x86.R_CX); +#if VGAINIT_NOISY + xprintf("Int1A: Write Cfg Word %04X to ",M.x86.R_DI); + pci_break_tag(tag,&bus,&device,&function); + xprintf("Bus%d, Dev%d, Func%d",bus,device,function); + xprintf(": %04X\n",M.x86.R_CX); +#endif + M.x86.R_AH = PCIBIOS_SUCCESSFUL; + CLEAR_FLAG(F_CF); + break; + + case PCIBIOS_FN_WRCFGDWORD: + regs2tag(&tag); + pci_conf_write(tag,M.x86.R_DI,M.x86.R_ECX); +#if VGAINIT_NOISY + xprintf("Int1A: Write Cfg Dword %04X to ",M.x86.R_DI); + pci_break_tag(tag,&bus,&device,&function); + xprintf("Bus%d, Dev%d, Func%d",bus,device,function); + xprintf(": %08X\n",M.x86.R_ECX); +#endif + M.x86.R_AH = PCIBIOS_SUCCESSFUL; + CLEAR_FLAG(F_CF); + break; + + default: +#if VGAINIT_NOISY + xprintf("Int1A: Unimplemented PCI BIOS function AX=%04x\n", M.x86.R_AX); +#endif + break; + } +} + + + +static int x86init(void) +{ + /* + * Access functions for I/O ports + */ + static X86EMU_pioFuncs piofuncs = { + __x86emu_inb, + __x86emu_inw, + __x86emu_inl, + __x86emu_outb, + __x86emu_outw, + __x86emu_outl + }; + + /* + * Access functions for memory + */ + static X86EMU_memFuncs memfuncs = { + __x86emu_rdb, + __x86emu_rdw, + __x86emu_rdl, + __x86emu_wrb, + __x86emu_wrw, + __x86emu_wrl + }; + + /* + * Interrupt table + */ + void (*funcs[256])(int num); /* XXX: can be 2 kilobytes! */ + int idx; + + /* + * Establish hooks in the simulator + */ + X86EMU_setupMemFuncs(&memfuncs); + X86EMU_setupPioFuncs(&piofuncs); + + /* + * Decode what X86 software interrupts we need to hook + */ + + for (idx = 0; idx < 256; idx++) { + funcs[idx] = __SIMintunk; /* assume all are bad */ + } + funcs[0x42] = __SIMint42; /* int42: video BIOS */ + funcs[0x1F] = NULL; /* reflect INT1F */ + funcs[0x43] = NULL; /* reflect INT43 */ + funcs[0x6D] = __SIMint6D; /* int6D: video BIOS */ + + funcs[0x03] = __SIMint3; /* int3: firmware exit */ + funcs[0x10] = __SIMint10; /* int10: video BIOS */ + funcs[0x1A] = __SIMint1A; /* int1A: PCI BIOS */ + + X86EMU_setupIntrFuncs(funcs); + + x86mem_init(&x86mem); + x86mem_hook(&x86mem,0xA0000,__ISAreadmem,__ISAwritemem); + x86mem_hook(&x86mem,0xA8000,__ISAreadmem,__ISAwritemem); + x86mem_hook(&x86mem,0xB0000,__ISAreadmem,__ISAwritemem); + x86mem_hook(&x86mem,0xB8000,__ISAreadmem,__ISAwritemem); + + return 0; + +} + + +static void x86uninit(void) +{ + x86mem_uninit(&x86mem); +} + + +int vga_probe(void) +{ + pcitag_t tag; + + if (pci_find_class(PCI_CLASS_DISPLAY,0,&tag) == 0) { + return 0; + } + + return -1; +} + +int vga_biosinit(void) +{ + physaddr_t biosaddr; + pcitag_t tag; + uint32_t addr; + uint32_t romaddr; + uint32_t destaddr; + uint32_t stackaddr; + uint32_t iretaddr; + unsigned int biossize; + int bus,device,function; + int idx; + int res; + + if (pci_find_class(PCI_CLASS_DISPLAY,0,&tag) == 0) { + romaddr = pci_conf_read(tag,PCI_MAPREG_ROM); + pci_conf_write(tag,PCI_MAPREG_ROM,romaddr | PCI_MAPREG_ROM_ENABLE); + } + else { + xprintf("No suitable VGA device found in the system.\n"); + return -1; + } + + addr = romaddr; + addr &= PCI_MAPREG_ROM_ADDR_MASK; +#if defined(_P5064_) || defined(_P6064_) + biosaddr = cpu_isamap((vm_offset_t) romaddr,0); +#else + biosaddr = (physaddr_t) romaddr; +#endif + + /* + * Check for the presence of a VGA BIOS on this adapter. + */ + + if (!((phys_read8(biosaddr+PCIBIOS_ROMSIG_OFFSET+0) == PCIBIOS_ROMSIG1) && + (phys_read8(biosaddr+PCIBIOS_ROMSIG_OFFSET+1) == PCIBIOS_ROMSIG2))) { + xprintf("No VGA BIOS on this adapter.\n"); + pci_conf_write(tag,PCI_MAPREG_ROM,romaddr); + return -1; + } + biossize = PCIBIOS_ROMSIZE(phys_read8(biosaddr+PCIBIOS_ROMSIZE_OFFSET)); + +#if VGAINIT_NOISY + xprintf("VGA BIOS size is %d bytes\n",biossize); +#endif + + /* + * Initialize the X86 emulator + */ + + if (x86init() != 0) { + xprintf("X86 emulator did not initialize.\n"); + pci_conf_write(tag,PCI_MAPREG_ROM,romaddr); + return -1; + } + + /* + * Allocate space for the ROM BIOS and the stack. + * The basic layout is: + * + * C000:0000 VGA BIOS + * C000:XXXX end of VGA BIOS, start of stack + * C000:YYYY end of stack, start of init code + * C000:ZZZZ end of allocated memory + * + * We put a little code stub after the stack to allow us to have + * a clean exit from the simulator. + */ + + + destaddr = BIOSRAMLOC; + stackaddr = destaddr + biossize + STACKSIZE; + + /* + * Copy the BIOS from the PCI rom into RAM + */ + +#if VGAINIT_NOISY + xprintf("Copying VGA BIOS to RAM.\n"); +#endif + + for (idx = 0; idx < biossize; idx+=4) { + uint32_t b; + + b = phys_read32(biosaddr+idx); + x86mem_memcpy(&x86mem,destaddr+idx,(uint8_t *) &b,sizeof(uint32_t)); + } + + /* + * Gross! The NVidia TNT2 BIOS expects to + * find a PC ROM BIOS date (just the slashes) + * at the right place in the ROMs. + */ + + x86mem_memcpy(&x86mem,0xFFFF5,"08/13/99",8); + + /* + * Turn off the BIOS ROM, we have our copy now. + */ + + pci_conf_write(tag,PCI_MAPREG_ROM,romaddr); + + /* + * Point certain vectors at a dummy IRET in our code space. + * Some ROMs don't take too kindly to null vectors, like + * the 3dfx Voodoo3 BIOS, which makes sure int1a is + * filled in before it attempts to call it. The + * code here is never really executed, since the emulator + * hooks it. + */ + + iretaddr = stackaddr + IRETOFFSET; + __x86emu_wrw(0x1A*4+0,OFFSET(iretaddr)); + __x86emu_wrw(0x1A*4+2,SEGMENT(iretaddr)); + + + /* + * The actual code begins 3 bytes after the beginning of the ROM. Set + * the start address to the first byte of executable code. + */ + + M.x86.R_CS = SEGMENT(destaddr + PCIBIOS_ROMENTRY_OFFSET); + M.x86.R_IP = OFFSET(destaddr + PCIBIOS_ROMENTRY_OFFSET); + + /* + * Set the stack to point after our copy of the ROM + */ + + M.x86.R_SS = SEGMENT(stackaddr - 8); + M.x86.R_SP = OFFSET(stackaddr - 8); + + /* + * GROSS! The Voodoo3 card expects BP to have + * the following value: + */ + + M.x86.R_BP = 0x197; + + /* + * The PCI BIOS spec says you pass the bus, device, and function + * numbers in the AX register when starting the ROM code. + */ + + pci_break_tag(tag,&bus,&device,&function); + M.x86.R_AH = bus; + M.x86.R_AL = (device << 3) | (function & 7); + + /* + * Arrange for the return address to point to a little piece + * of code that will do an int10 to set text mode, followed + * by storing a couple of simple signatures in the registers, + * and an int3 to stop the simulator. + * + * The location of this piece of code is just after our + * stack, and since the stack grows down, this is in 'stackaddr' + */ + + __x86emu_wrw(stackaddr-8,OFFSET(stackaddr)); + __x86emu_wrw(stackaddr-6,SEGMENT(stackaddr)); + + /* copy in the code. */ + + for (idx = 0; idx < sizeof(x86initcode); idx++) { + __x86emu_wrb(stackaddr+idx,x86initcode[idx]); + } + + /* + * Set up the VGA console descriptor. We need this to process the + * int10's that write firmware copyright notices and such. + */ + + vga_init(&vga,(__ISAaddr(VGA_TEXTBUF_COLOR)),outb); + + /* + * Launch the simulator. + */ + + xprintf("Initializing VGA.\n"); +#ifdef DEBUG + X86EMU_trace_on(); +#endif + X86EMU_exec(); + + /* + * Check for the magic exit values in the registers. These get set + * by the code in the array 'x86initcode' that was loaded above + */ + + if ((M.x86.R_AX == 0x1234) && (M.x86.R_BX == 0x5678)) res = 0; + else res = -1; + + /* + * Done! + */ + + x86uninit(); + + if (res < 0) { + xprintf("VGA initialization failed.\n"); + } + else { + char temp[32]; + char *str = "If you can see this message, the VGA has been successfully initialized!\r\n\r\n"; + + xprintf("VGA initialization successful.\n"); + vga_writestr(&vga,str,0x07,strlen(str)); + + sprintf(temp,"%d",VGA_TEXTMODE_ROWS); + env_setenv("VGA_ROWS",temp,ENV_FLG_BUILTIN | ENV_FLG_READONLY | ENV_FLG_ADMIN); + sprintf(temp,"%d",VGA_TEXTMODE_COLS); + env_setenv("VGA_COLS",temp,ENV_FLG_BUILTIN | ENV_FLG_READONLY | ENV_FLG_ADMIN); + + } + + return res; +} + +int x86emutest(void) +{ + uint32_t destaddr; + uint32_t stackaddr; + int res; + + /* + * Initialize the X86 emulator + */ + + if (x86init() != 0) { + xprintf("X86 emulator did not initialize.\n"); + return -1; + } + + destaddr = BIOSRAMLOC; + stackaddr = destaddr + 1024; + + /* + * Copy the BIOS from the PCI rom into RAM + */ + + xprintf("Copying test program to RAM.\n"); + x86mem_memcpy(&x86mem,destaddr,x86testcode,sizeof(x86testcode)); + + /* + * The actual code begins 3 bytes after the beginning of the ROM. Set + * the start address to the first byte of executable code. + */ + + M.x86.R_CS = SEGMENT(destaddr + PCIBIOS_ROMENTRY_OFFSET); + M.x86.R_IP = OFFSET(destaddr + PCIBIOS_ROMENTRY_OFFSET); + + /* + * Set the stack to point after our copy of the ROM + */ + + M.x86.R_SS = SEGMENT(stackaddr - 8); + M.x86.R_SP = OFFSET(stackaddr - 8); + + /* + * Launch the simulator. + */ + + xprintf("Running X86emu test.\n"); +#ifdef DEBUG + X86EMU_trace_on(); +#endif + X86EMU_exec(); + + /* + * Check for the magic exit values in the registers. These get set + * by the code in the array 'x86initcode' that was loaded above + */ + + if ((M.x86.R_AX == 0x1234) && (M.x86.R_BX == 0x5678)) res = 0; + else res = -1; + + /* + * Done! + */ + + x86uninit(); + + if (res < 0) xprintf("X86emu test failed.\n"); + else xprintf("X86emu test successful.\n"); + + return res; +} + + + +void vgaraw_dump(char *tail) +{ + physaddr_t biosaddr; + pcitag_t tag; + uint32_t addr; + uint32_t romaddr; + unsigned int biossize; + int idx; + int res; + + if (pci_find_class(PCI_CLASS_DISPLAY,0,&tag) == 0) { + romaddr = pci_conf_read(tag,PCI_MAPREG_ROM); + pci_conf_write(tag,PCI_MAPREG_ROM,romaddr | PCI_MAPREG_ROM_ENABLE); + } + else { + xprintf("No suitable VGA device found in the system.\n"); + return ; + } + + addr = romaddr; + addr &= PCI_MAPREG_ROM_ADDR_MASK; + + /* XXX This won't work if the PCI space is remapped somewhere else. */ +#if defined(_P5064_) || defined(_P6064_) + biosaddr = cpu_isamap((vm_offset_t) romaddr,0); +#else + biosaddr = romaddr; +#endif + + /* + * Check for the presence of a VGA BIOS on this adapter. + */ + + xprintf("VGA BIOS is mapped to %08X\n",(uint32_t) biosaddr); + + if (!((phys_read8(biosaddr+PCIBIOS_ROMSIG_OFFSET+0) == PCIBIOS_ROMSIG1) && + (phys_read8(biosaddr+PCIBIOS_ROMSIG_OFFSET+1) == PCIBIOS_ROMSIG2))) { + xprintf("No VGA BIOS on this adapter, assuming 32K ROM\n"); + biossize = 32768; + return; + } + else { + biossize = PCIBIOS_ROMSIZE(phys_read8(biosaddr+PCIBIOS_ROMSIZE_OFFSET)); + xprintf("VGA BIOS size is %d bytes\n",biossize); + } + + for (idx = 0; idx < biossize; idx+=16) { + xprintf("%04X: ",idx); + for (res = 0; res < 16; res++) { + xprintf("%02X ",phys_read8(biosaddr+idx+res)); + } + xprintf("\n"); + if (console_status()) break; + } + +// pci_conf_write(tag,PCI_MAPREG_ROM,romaddr); + +} diff --git a/cfe/cfe/pccons/x86mem.c b/cfe/cfe/pccons/x86mem.c new file mode 100644 index 0000000..2e9c49e --- /dev/null +++ b/cfe/cfe/pccons/x86mem.c @@ -0,0 +1,423 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * X86 simulator sparse memory File: X86MEM.C + * + * This module implements X86 memory for the X86 emulator + * used by the BIOS simulator. To avoid allocating the + * entire 1MB of PC's addressable memory, this is a "sparse" + * memory model, allocating chunks of storage as needed. + * VGA BIOSes seem to do all sorts of bizarre things to memory + * so this helps reduce the total amount we need to allocate + * significantly. + * + * In addition, this module lets the simulator "hook" + * ranges of memory to be handled by a callback + * routine. This is used so that we can redirect + * accesses to VGA memory space to the PCI bus handler. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "x86mem.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define BSWAP_SHORT(s) ((((s) >> 8) & 0xFF) | (((s)&0xFF) << 8)) +#define BSWAP_LONG(s) ((((s) & 0xFF000000) >> 24) | \ + (((s) & 0x00FF0000) >> 8) | \ + (((s) & 0x0000FF00) << 8) | \ + (((s) & 0x000000FF) << 24)) + + +/* ********************************************************************* + * X86MEM_INIT() + * + * Initialize an X86mem object + * + * Input parameters: + * mem - X86mem object + * + * Return value: + * nothing + ********************************************************************* */ + +void x86mem_init(x86mem_t *mem) +{ + memset(mem,0,sizeof(mem)); +} + +/* ********************************************************************* + * X86MEM_UNINIT(mem) + * + * Uninitialize an X86mem object, freeing any storage + * associated with it. + * + * Input parameters: + * mem - x86mem object + * + * Return value: + * nothing + ********************************************************************* */ + +void x86mem_uninit(x86mem_t *mem) +{ + int idx; + + for (idx = 0; idx < X86MEM_CHUNKS; idx++) { + if (mem->data[idx]) { + KFREE(mem->data[idx]); + mem->data[idx] = NULL; + } + } +} + +/* ********************************************************************* + * X86MEM_READB(mem,addr) + * + * Read a byte of memory from the X86mem object. + * + * Input parameters: + * mem - x86mem object + * addr - address of byte to read + * + * Return value: + * byte read + ********************************************************************* */ + +uint8_t x86mem_readb(x86mem_t *mem,uint32_t addr) +{ + uint8_t *p; + + if (mem->read[X86MEM_REGION(addr)]) { + return (uint8_t) (*(mem->read[X86MEM_REGION(addr)]))(mem,addr,1); + } + + p = (mem->data[X86MEM_REGION(addr)]); + + if (p) { + return *(p + X86MEM_OFFSET(addr)); + } + else { + return 0; + } +} + +/* ********************************************************************* + * X86MEM_READW(mem,addr) + * + * Read a 16-bit word of memory from the X86mem object. + * + * Input parameters: + * mem - x86mem object + * addr - address of word to read + * + * Return value: + * word read + ********************************************************************* */ + +uint16_t x86mem_readw(x86mem_t *mem,uint32_t addr) +{ + uint8_t *p; + uint16_t ret; + + if (mem->read[X86MEM_REGION(addr)]) { + return (uint8_t) (*(mem->read[X86MEM_REGION(addr)]))(mem,addr,2); + } + + p = (mem->data[X86MEM_REGION(addr)]); + if (!p) return 0; + + if ((addr & 1) || (X86MEM_OFFSET(addr) == X86MEM_CHUNKSIZE-1)) { + + ret = ((uint16_t) x86mem_readb(mem,addr+0)) | + (((uint16_t) x86mem_readb(mem,addr+1)) << 8); + return ret; + } + else { + ret = *((uint16_t *) (p+X86MEM_OFFSET(addr))); +#ifdef __MIPSEB + ret = BSWAP_SHORT(ret); +#endif + } + + return ret; +} + +/* ********************************************************************* + * X86MEM_READL(mem,addr) + * + * Read a 32-bit dword of memory from the X86mem object. + * + * Input parameters: + * mem - x86mem object + * addr - address of dword to read + * + * Return value: + * dword read + ********************************************************************* */ + +uint32_t x86mem_readl(x86mem_t *mem,uint32_t addr) +{ + uint8_t *p; + uint32_t ret; + + if (mem->read[X86MEM_REGION(addr)]) { + return (uint8_t) (*(mem->read[X86MEM_REGION(addr)]))(mem,addr,4); + } + + p = (mem->data[X86MEM_REGION(addr)]); + if (!p) return 0; + + if ((addr & 3) || (X86MEM_OFFSET(addr) >= X86MEM_CHUNKSIZE-3)) { + ret = ((uint32_t) x86mem_readb(mem,addr+0)) | + (((uint32_t) x86mem_readb(mem,addr+1)) << 8) | + (((uint32_t) x86mem_readb(mem,addr+2)) << 16) | + (((uint32_t) x86mem_readb(mem,addr+3)) << 24); + } + else { + ret = *((uint32_t *) (p+X86MEM_OFFSET(addr))); +#ifdef __MIPSEB + ret = BSWAP_LONG(ret); +#endif + } + + return ret; +} + +/* ********************************************************************* + * X86MEM_WRITEB(mem,addr,data) + * + * Write a byte to the X86mem object + * + * Input parameters: + * mem - x86mem object + * addr - address of byte to write + * data - data to write + * + * Return value: + * nothing + ********************************************************************* */ +void x86mem_writeb(x86mem_t *mem,uint32_t addr,uint8_t data) +{ + uint8_t *p; + + if (mem->write[X86MEM_REGION(addr)]) { + (*(mem->write[X86MEM_REGION(addr)]))(mem,addr,data,1); + return; + } + + p = (mem->data[X86MEM_REGION(addr)]); + + if (p) { + *(p + X86MEM_OFFSET(addr)) = data; + } + else { + p = mem->data[X86MEM_REGION(addr)] = KMALLOC(X86MEM_CHUNKSIZE,sizeof(uint32_t)); + if (p) { + memset(p,0,X86MEM_CHUNKSIZE); + *(p + X86MEM_OFFSET(addr)) = data; + } + } +} + +/* ********************************************************************* + * X86MEM_WRITEW(mem,addr,data) + * + * Write a 16-bit word to the X86mem object + * + * Input parameters: + * mem - x86mem object + * addr - address of word to write + * data - data to write + * + * Return value: + * nothing + ********************************************************************* */ +void x86mem_writew(x86mem_t *mem,uint32_t addr,uint16_t data) +{ + uint8_t *p; + + if (mem->write[X86MEM_REGION(addr)]) { + (*(mem->write[X86MEM_REGION(addr)]))(mem,addr,data,2); + return; + } + + p = (mem->data[X86MEM_REGION(addr)]); + + if (!p || (addr & 1) || (X86MEM_OFFSET(addr) == X86MEM_CHUNKSIZE-1)) { + x86mem_writeb(mem,addr+0,(data & 0xFF)); + x86mem_writeb(mem,addr+1,((data >> 8) & 0xFF)); + } + else { +#ifdef __MIPSEB + data = BSWAP_SHORT(data); +#endif + *((uint16_t *) (p+X86MEM_OFFSET(addr))) = data; + } +} + +/* ********************************************************************* + * X86MEM_WRITEL(mem,addr,data) + * + * Write a 32-bit dword to the X86mem object + * + * Input parameters: + * mem - x86mem object + * addr - address of dword to write + * data - data to write + * + * Return value: + * nothing + ********************************************************************* */ +void x86mem_writel(x86mem_t *mem,uint32_t addr,uint32_t data) +{ + uint8_t *p; + + if (mem->write[X86MEM_REGION(addr)]) { + (*(mem->write[X86MEM_REGION(addr)]))(mem,addr,data,4); + return; + } + + p = (mem->data[X86MEM_REGION(addr)]); + + if (!p || (addr & 3) || (X86MEM_OFFSET(addr) >= X86MEM_CHUNKSIZE-3)) { + x86mem_writeb(mem,addr+0,(data & 0xFF)); + x86mem_writeb(mem,addr+1,((data >> 8) & 0xFF)); + x86mem_writeb(mem,addr+2,((data >> 16) & 0xFF)); + x86mem_writeb(mem,addr+3,((data >> 24) & 0xFF)); + } + else { +#ifdef __MIPSEB + data = BSWAP_LONG(data); +#endif + *((uint32_t *) (p+X86MEM_OFFSET(addr))) = data; + } +} + +/* ********************************************************************* + * X86MEM_MEMCPY(mem,dest,src,cnt) + * + * memcpy data into the X86mem object + * + * Input parameters: + * mem - x86mem object + * destaddr - destination x86mem address + * src - source local address + * cnt - number of bytes to copy + * + * Return value: + * nothing + ********************************************************************* */ + +void x86mem_memcpy(x86mem_t *mem,uint32_t destaddr,uint8_t *src,int count) +{ + while (count) { + x86mem_writeb(mem,destaddr,*src); + destaddr++; + src++; + count--; + } +} + + +/* ********************************************************************* + * X86MEM_HOOK(mem,addr,readf,writef) + * + * Establish a hook for a block of simulated memory + * + * Input parameters: + * mem - x86mem object + * addr - address in memory, should be aligned on a "chunk" + * boundary. + * readf - function to call on READ accesses + * writef - function to call on WRITE accesses + * + * Return value: + * nothing + ********************************************************************* */ + +void x86mem_hook(x86mem_t *mem,uint32_t chunkaddr, + uint32_t (*readf)(x86mem_t *mem,uint32_t addr,int size), + void (*writef)(x86mem_t *mem,uint32_t addr,uint32_t val,int size)) +{ + if (mem->data[X86MEM_REGION(chunkaddr)]) { + KFREE(mem->data[X86MEM_REGION(chunkaddr)]); + mem->data[X86MEM_REGION(chunkaddr)] = NULL; + } + mem->read[X86MEM_REGION(chunkaddr)] = readf; + mem->write[X86MEM_REGION(chunkaddr)] = writef; +} + +/* ********************************************************************* + * X86MEM_HOOK_RANGE(mem,addr,size,readf,writef) + * + * Establish a hook for a block of simulated memory + * + * Input parameters: + * mem - x86mem object + * addr - address in memory, should be aligned on a "chunk" + * boundary. + * size - size of region to hook. Should be a multiple + * of the chunk size + * readf - function to call on READ accesses + * writef - function to call on WRITE accesses + * + * Return value: + * nothing + ********************************************************************* */ + +void x86mem_hook_range(x86mem_t *mem,uint32_t chunkaddr,int size, + uint32_t (*readf)(x86mem_t *mem,uint32_t addr,int size), + void (*writef)(x86mem_t *mem,uint32_t addr,uint32_t val,int size)) +{ + while (size > 0) { + x86mem_hook(mem,chunkaddr,readf,writef); + size -= X86MEM_CHUNKSIZE; + chunkaddr += X86MEM_CHUNKSIZE; + } +} + diff --git a/cfe/cfe/pccons/x86mem.h b/cfe/cfe/pccons/x86mem.h new file mode 100644 index 0000000..ed9132b --- /dev/null +++ b/cfe/cfe/pccons/x86mem.h @@ -0,0 +1,109 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * X86 simulator sparse memory File: X86MEM.H + * + * This module implements X86 memory for the X86 emulator + * used by the BIOS simulator. To avoid allocating the + * entire 1MB of PC's addressable memory, this is a "sparse" + * memory model, allocating chunks of storage as needed. + * VGA BIOSes seem to do all sorts of bizarre things to memory + * so this helps reduce the total amount we need to allocate + * significantly. + * + * In addition, this module lets the simulator "hook" + * ranges of memory to be handled by a callback + * routine. This is used so that we can redirect + * accesses to VGA memory space to the PCI bus handler. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define X86MEM_CHUNKBITS 15 +#define X86MEM_ADDRESSBITS 20 +#define X86MEM_CHUNKSIZE (1<> X86MEM_CHUNKBITS) & (X86MEM_CHUNKS-1)) +#define X86MEM_OFFSET(addr) ((addr) & (X86MEM_CHUNKSIZE-1)) + +#define M_BYTE 1 +#define M_WORD 2 +#define M_DWORD 4 + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct x86mem_s { + uint8_t *data[X86MEM_CHUNKS]; + uint32_t (*read[X86MEM_CHUNKS])(struct x86mem_s *x86mem, + uint32_t addr,int size); + void (*write[X86MEM_CHUNKS])(struct x86mem_s *x86mem, + uint32_t addr,uint32_t val,int size); +} x86mem_t; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +void x86mem_init(x86mem_t *mem); +void x86mem_uninit(x86mem_t *mem); + + +uint8_t x86mem_readb(x86mem_t *mem,uint32_t addr); +uint16_t x86mem_readw(x86mem_t *mem,uint32_t addr); +uint32_t x86mem_readl(x86mem_t *mem,uint32_t addr); + + +void x86mem_writeb(x86mem_t *mem,uint32_t addr,uint8_t data); +void x86mem_writew(x86mem_t *mem,uint32_t addr,uint16_t data); +void x86mem_writel(x86mem_t *mem,uint32_t addr,uint32_t data); +void x86mem_memcpy(x86mem_t *mem,uint32_t destaddr,uint8_t *src,int count); +void x86mem_hook(x86mem_t *mem,uint32_t chunkaddr, + uint32_t (*readf)(x86mem_t *mem,uint32_t addr,int size), + void (*writef)(x86mem_t *mem,uint32_t addr,uint32_t val,int size)); +void x86mem_hook_range(x86mem_t *mem,uint32_t chunkaddr,int size, + uint32_t (*readf)(x86mem_t *mem,uint32_t addr,int size), + void (*writef)(x86mem_t *mem,uint32_t addr,uint32_t val,int size)); + diff --git a/cfe/cfe/pci/cfe_pci.h b/cfe/cfe/pci/cfe_pci.h new file mode 100644 index 0000000..8780a6f --- /dev/null +++ b/cfe/cfe/pci/cfe_pci.h @@ -0,0 +1,52 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PCI definitions File: cfe_pci.h + * + * This file includes other files and defines macros to make + * our environment match that of the PCI configuration code + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" + +#define panic(x) printf(x) diff --git a/cfe/cfe/pci/devlist2h.awk b/cfe/cfe/pci/devlist2h.awk new file mode 100644 index 0000000..1f0b9b4 --- /dev/null +++ b/cfe/cfe/pci/devlist2h.awk @@ -0,0 +1,220 @@ +#! /usr/bin/awk -f +# $NetBSD: devlist2h.awk,v 1.2 1996/01/22 21:08:09 cgd Exp $ +# +# Copyright (c) 1995, 1996 Christopher G. Demetriou +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by Christopher G. Demetriou. +# 4. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +BEGIN { + nproducts = nvendors = 0 + dfile="pcidevs_data.h" + hfile="pcidevs.h" +} +NR == 1 { + VERSION = $0 + gsub("\\$", "", VERSION) + + printf("/*\n") > dfile + printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ + > dfile + printf(" *\n") > dfile + printf(" * generated from:\n") > dfile + printf(" *\t%s\n", VERSION) > dfile + printf(" */\n") > dfile + + printf("/*\n") > hfile + printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ + > hfile + printf(" *\n") > hfile + printf(" * generated from:\n") > hfile + printf(" *\t%s\n", VERSION) > hfile + printf(" */\n") > hfile + + next +} +$1 == "vendor" { + nvendors++ + + vendorindex[$2] = nvendors; # record index for this name, for later. + vendors[nvendors, 1] = $2; # name + vendors[nvendors, 2] = $3; # id + printf("#define\tPCI_VENDOR_%s\t%s\t", vendors[nvendors, 1], + vendors[nvendors, 2]) > hfile + + i = 3; f = 4; + + # comments + ocomment = oparen = 0 + if (f <= NF) { + printf("\t/* ") > hfile + ocomment = 1; + } + while (f <= NF) { + if ($f == "#") { + printf("(") > hfile + oparen = 1 + f++ + continue + } + if (oparen) { + printf("%s", $f) > hfile + if (f < NF) + printf(" ") > hfile + f++ + continue + } + vendors[nvendors, i] = $f + printf("%s", vendors[nvendors, i]) > hfile + if (f < NF) + printf(" ") > hfile + i++; f++; + } + if (oparen) + printf(")") > hfile + if (ocomment) + printf(" */") > hfile + printf("\n") > hfile + + next +} +$1 == "product" { + nproducts++ + + products[nproducts, 1] = $2; # vendor name + products[nproducts, 2] = $3; # product id + products[nproducts, 3] = $4; # id + printf("#define\tPCI_PRODUCT_%s_%s\t%s\t", products[nproducts, 1], + products[nproducts, 2], products[nproducts, 3]) > hfile + + i=4; f = 5; + + # comments + ocomment = oparen = 0 + if (f <= NF) { + printf("\t/* ") > hfile + ocomment = 1; + } + while (f <= NF) { + if ($f == "#") { + printf("(") > hfile + oparen = 1 + f++ + continue + } + if (oparen) { + printf("%s", $f) > hfile + if (f < NF) + printf(" ") > hfile + f++ + continue + } + products[nproducts, i] = $f + printf("%s", products[nproducts, i]) > hfile + if (f < NF) + printf(" ") > hfile + i++; f++; + } + if (oparen) + printf(")") > hfile + if (ocomment) + printf(" */") > hfile + printf("\n") > hfile + + next +} +{ + if ($0 == "") + blanklines++ + print $0 > hfile + if (blanklines < 2) + print $0 > dfile +} +END { + # print out the match tables + + printf("\n") > dfile + + + printf("static const struct pci_knowndev pci_knowndevs[] = {\n") > dfile + for (i = 1; i <= nproducts; i++) { + printf("\t{\n") > dfile + printf("\t PCI_VENDOR_%s, PCI_PRODUCT_%s_%s,\n", + products[i, 1], products[i, 1], products[i, 2]) \ + > dfile + printf("\t ") > dfile + printf("0") > dfile + printf(",\n") > dfile + + vendi = vendorindex[products[i, 1]]; + printf("\t \"") > dfile + j = 3; + needspace = 0; + while (vendors[vendi, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", vendors[vendi, j]) > dfile + needspace = 1 + j++ + } + printf("\",\n") > dfile + + printf("\t \"") > dfile + j = 4; + needspace = 0; + while (products[i, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", products[i, j]) > dfile + needspace = 1 + j++ + } + printf("\",\n") > dfile + printf("\t},\n") > dfile + } + for (i = 1; i <= nvendors; i++) { + printf("\t{\n") > dfile + printf("\t PCI_VENDOR_%s, 0,\n", vendors[i, 1]) \ + > dfile + printf("\t PCI_KNOWNDEV_NOPROD,\n") \ + > dfile + printf("\t \"") > dfile + j = 3; + needspace = 0; + while (vendors[i, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", vendors[i, j]) > dfile + needspace = 1 + j++ + } + printf("\",\n") > dfile + printf("\t NULL,\n") > dfile + printf("\t},\n") > dfile + } + printf("\t{ 0, 0, 0, NULL, NULL, }\n") > dfile + printf("};\n") > dfile +} diff --git a/cfe/cfe/pci/ldtinit.c b/cfe/cfe/pci/ldtinit.c new file mode 100644 index 0000000..26025af --- /dev/null +++ b/cfe/cfe/pci/ldtinit.c @@ -0,0 +1,641 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * LDT Fabric Initialization File: ldtinit.c + * + ********************************************************************* + * + * Copyright 2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ +/* + * Copyright 2001,2002 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions as + * they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. Neither the "Broadcom + * Corporation" name nor any trademark or logo of Broadcom + * Corporation may be used to endorse or promote products + * derived from this software without the prior written + * permission of Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * ldtinit.c: generic LDT fabric initialization and capability + * management. + */ + +#include "lib_types.h" +#include "lib_printf.h" +#include "cfe_timer.h" + +#include "pcivar.h" +#include "pcireg.h" +#include "ldtreg.h" + +/* Write-to-clear bit masks */ + +#if CFG_LDT_REV_017 /* XXX not really the right test */ +#define LDT_LINKCTRL_WC (LDT_LINKCTRL_CRCERROR_MASK) +#else +#define LDT_LINKCTRL_WC (LDT_LINKCTRL_LINKFAIL | LDT_LINKCTRL_CRCERROR_MASK) +#endif + + +/* LDT capability lookup. */ + +unsigned +pci_find_ldt_cap (pcitag_t tag, int secondary) +{ + pcireg_t cpr; + pcireg_t cr; + int offset, prev; + int type; + + cpr = pci_conf_read(tag, PCI_CAPLISTPTR_REG); + offset = PCI_CAPLIST_PTR(cpr) &~ 0x3; + prev = 0; + + while (offset != 0 && offset != prev) { +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "read cap offset %04x\n", offset); +#endif + cr = pci_conf_read(tag, offset); + if (PCI_CAPLIST_CAP(cr) == PCI_CAP_LDT) { + type = LDT_COMMAND_TYPE(cr); + if (secondary && type == LDT_COMMAND_TYPE_HOST) + return offset; + if (!secondary && type == LDT_COMMAND_TYPE_SLAVE) + return offset; + } + prev = offset; + offset = PCI_CAPLIST_NEXT(cr) &~ 0x3; + } + return 0; +} + + +/* LDT utility functions, mostly for capabilities. */ + +static pcireg_t +ldt_get_link(pcitag_t tag, int offset, int index) +{ + return pci_conf_read(tag, offset + LDT_LINK_OFF(index)); +} + +static void +ldt_set_link(pcitag_t tag, int offset, int index, pcireg_t lr) +{ + pci_conf_write(tag, offset + LDT_LINK_OFF(index), lr); +} + +#if (LDT_DEBUG != 0) +static void +ldt_show_cap(pcitag_t tag, int offset, int secondary) +{ + printf(" Cmd %08x", pci_conf_read(tag, offset)); + offset += 4; + printf(" Lnk0 %08x", pci_conf_read(tag, offset)); + offset += 4; + if (!secondary) { + printf(" Lnk1 %08x", pci_conf_read(tag, offset)); + offset += 4; + } + printf(" Freq0 %08x", pci_conf_read(tag, offset)); + offset += 4; + if (!secondary) { + printf(" Freq1 %08x", pci_conf_read(tag, offset)); + offset += 4; + } + printf("\n"); +} +#else +static void +ldt_show_cap(pcitag_t tag, int offset, int secondary) +{ +} +#endif + + +/* LDT bus initialization and sizing. */ + +/* We expect the entire chain to be ready at approximately the same + time, but we add some delay here for possible node-to-node + differences. + + Empirically, neither InitDone nor LinkFail is reported for an + unconnected link. Thus we do not expect the outgoing link of a + terminating tunnel node to become ready. + + Also, CRC errors are observed to occur with InitDone, so link + errors do not necessarily force LinkFail. +*/ + +static int +ldt_wait_ready (pcitag_t tag, int offset, int index) +{ + int count; + pcireg_t lr; + int linkerr; + + linkerr = 0; + count = 0x10000; /* empirical */ + do { + if (--count == 0) + return 1; + lr = ldt_get_link(tag, offset, index); + if ((lr & (LDT_LINKCTRL_LINKFAIL | LDT_LINKCTRL_CRCERROR_MASK)) != 0) + linkerr = 1; + } while ((lr & (LDT_LINKCTRL_INITDONE | LDT_LINKCTRL_LINKFAIL)) == 0); + + return linkerr; +} + +static void +ldt_end_chain (pcitag_t tag, int offset, int index) +{ + pcireg_t lr, t; + + lr = ldt_get_link(tag, offset, index); + lr |= LDT_LINKCTRL_EOC; + ldt_set_link(tag, offset, index, lr); + lr |= LDT_LINKCTRL_TXOFF; + ldt_set_link(tag, offset, index, lr); + t = ldt_get_link(tag, offset, index); /* push */ +} + + +static uint16_t +ldt_freq_cap (pcitag_t tag, int offset, int index) +{ + pcireg_t cmd, cr; + uint16_t freq_cap; + + cmd = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + if (LDT_COMMAND_TYPE(cmd) == LDT_COMMAND_TYPE_HOST) { + cr = pci_conf_read(tag, offset + LDT_FREQ_OFF); + if (LDT_REVISION_ID(cr) == LDT_REV_017) { + /* REV 0.17 has restricted support for setting + frequencies. We assume that this is the host bridge in + pseudo-1.0x mode, in which case the desired maximum + frequency was left in the LDT_FREQ register and all + lower frequencies are supported. */ + freq_cap = (1 << (LDT_LINKFREQ(cr) + 1)) - 1; + } else { + freq_cap = LDT_LINKFREQ_CAP(cr); + } + } else { + cr = pci_conf_read(tag, offset + LDT_FREQ0_OFF); + if (LDT_REVISION_ID(cr) == LDT_REV_017) { + /* REV 0.17 has restricted support for setting frequencies. + This is not the host bridge. What to do? XXX */ + freq_cap = (1 << LDT_FREQ_200); + } else { + cr = pci_conf_read(tag, offset + LDT_FREQn_OFF(index)); + freq_cap = LDT_LINKFREQ_CAP(cr); + } + } + return freq_cap; +} + +static uint8_t +ldt_max_freq (uint16_t freq_cap) +{ + unsigned ldt_freq; + + /* 200 MHz (encoded as 1 << 0) is required for all devices */ + freq_cap |= (1 << LDT_FREQ_200); + + ldt_freq = 0; + + while (freq_cap != 1) { + ldt_freq++; + freq_cap >>= 1; + } + + return (ldt_freq >= LDT_FREQ_200 && ldt_freq <= LDT_FREQ_1000) ? + ldt_freq : LDT_FREQ_200; +} + +static void +ldt_set_freq (pcitag_t tag, int offset, int index, uint8_t freq) +{ + pcireg_t cmd, cr; + + cmd = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + if (LDT_COMMAND_TYPE(cmd) == LDT_COMMAND_TYPE_HOST) { + cr = pci_conf_read(tag, offset + LDT_FREQ_OFF); + cr &=~ LDT_LINKFREQ_MASK; + cr |= (freq << LDT_LINKFREQ_SHIFT); + pci_conf_write(tag, offset + LDT_FREQ_OFF, cr); + } else { + cr = pci_conf_read(tag, offset + LDT_FREQn_OFF(index)); + cr &=~ LDT_LINKFREQ_MASK; + cr |= (freq << LDT_LINKFREQ_SHIFT); + pci_conf_write(tag, offset + LDT_FREQn_OFF(index), cr); + } +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "set link %d freq = %02x\n", index, freq); +#endif +} + + +/* LDT fabric initialization. See LDT Spec, Section 13.3. */ +static int +ldt_fabric_init (pcitag_t br_tag, int br_offset, int bus, pci_flags_t flags) +{ + int next_free_id; + pcitag_t prev_tag, tag; + int offset, prev_offset; + int link, prev_link; + uint16_t prev_cap; + pcireg_t cmd, lr, id, t; + int double_ended; + int linkerr; + + prev_tag = br_tag; prev_offset = br_offset; prev_link = 0; + /* Since there is no direct peer-to-peer traffic, there is no + point in configuring a downstream link with more capability + than the current one. */ + prev_cap = ldt_freq_cap(br_tag, br_offset, 0); + + next_free_id = 1; + double_ended = 0; + +#if (LDT_DEBUG != 0) + printf("Link sizing for bus %d, bridge freq cap %04x\n", + bus, ldt_freq_cap(br_tag, br_offset, 0)); +#endif + for (;;) { + + tag = pci_make_tag(bus, 0, 0); + + id = pci_conf_read(tag, PCI_ID_REG); +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "ldt_fabric_init: id register %08x\n", id); +#endif + if (PCI_VENDOR(id) == 0xffff) { + /* The incoming link had InitDone set, but we got an NXA + trying to read the vendor id. Either the reverse link + is broken or we have found an LDT-Lite node. For now, + assume the latter. Since an LDT-Lite device cannot be + a tunnel, assume the chain terminates here. */ + pci_tagprintf(tag, "assumed LDT-LITE device (virtual unit %d)\n", + next_free_id); + break; + } + + offset = pci_find_ldt_cap(tag, LDT_PRIMARY); +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "ldt_fabric_init: offset %08x\n", offset); +#endif + if (offset == 0) { + /* There is no primary interface; we must have found a host. */ + offset = pci_find_ldt_cap(tag, LDT_SECONDARY); + if (offset != 0) { + lr = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + lr |= LDT_COMMAND_DOUBLE_ENDED; + pci_conf_write(tag, offset + LDT_COMMAND_CAP_OFF, lr); + double_ended = 1; + } + break; + } + + /* Otherwise, we have the primary interface. */ + + /* Rewrite the old value to set master host bit. */ + cmd = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "ldt_fabric_init: set master host\n"); +#endif + pci_conf_write(tag, offset + LDT_COMMAND_CAP_OFF, cmd); + cmd = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); /* push */ + + id = pci_conf_read(tag, PCI_ID_REG); + + /* Update the unit id, gingerly. */ + cmd &= ~LDT_COMMAND_UNIT_ID_MASK; + cmd |= (next_free_id << LDT_COMMAND_UNIT_ID_SHIFT); +#if (LDT_DEBUG != 0) + pci_tagprintf(tag, "ldt_fabric_init: set unit id %d\n", next_free_id); +#endif + if (!pci_conf_write_acked(tag, offset + LDT_COMMAND_CAP_OFF, cmd)) { + pci_tagprintf(tag, "no ack of id update to %d\n", next_free_id); + } + + /* The unit id just changed. Update the tag */ + tag = pci_make_tag(bus, next_free_id, 0); +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "ldt_fabric_init: check unit id\n"); +#endif + t = pci_conf_read(tag, PCI_ID_REG); + if (t != id) { + pci_tagprintf(tag, "id mismatch: old %08x, new %08x\n", id, t); + } + + next_free_id += LDT_COMMAND_UNIT_COUNT(cmd); + + link = LDT_COMMAND_MASTER_HOST(cmd); /* Upstream link index */ + + /* LDT Rev 0.17 does not support frequency updates. */ + if ((flags & PCI_FLG_LDT_REV_017) == 0) { + /* Find common frequency for upstream link. */ + uint16_t link_cap, freq_cap_in, freq_cap_out; + uint8_t ldt_freq; + + freq_cap_out = ldt_freq_cap(prev_tag, prev_offset, prev_link); + freq_cap_in = ldt_freq_cap(tag, offset, link); + link_cap = freq_cap_in & freq_cap_out; + ldt_freq = ldt_max_freq(link_cap & prev_cap); + +#if (LDT_DEBUG != 0) + pci_tagprintf(tag, "set freq %d\n", ldt_freq); +#endif + /* Set up frequency registers, next warm reset installs. */ + ldt_set_freq(prev_tag, prev_offset, prev_link, ldt_freq); + ldt_set_freq(tag, offset, link, ldt_freq); + + prev_cap &= link_cap; + } + + link ^= 1; /* Downstream */ + linkerr = ldt_wait_ready(tag, offset, link); + lr = ldt_get_link(tag, offset, link); + ldt_set_link(tag, offset, link, lr | LDT_LINKCTRL_WC); + +#if (LDT_DEBUG != 0) + pci_tagprintf(tag, "node: up %d down %d:\n", link ^ 1, link); +#endif + ldt_show_cap(tag, offset, LDT_PRIMARY); + + if (linkerr || next_free_id > 0x1f) { + /* No downstream link or too many devices, set end of chain */ + ldt_end_chain(tag, offset, link); + break; + } + + prev_tag = tag; prev_offset = offset; prev_link = link; + } + + return double_ended; +} + + +static int +ldt_fabric_reinit (int bus) +{ + int next_free_id; + pcitag_t tag; + int offset; + int link; + pcireg_t cmd, lr, id, t; + int linkerr; + + next_free_id = 1; + +#if (LDT_DEBUG != 0) + printf("Link resizing for bus %d\n", bus); +#endif + for (;;) { + + tag = pci_make_tag(bus, 0, 0); + + id = pci_conf_read(tag, PCI_ID_REG); + if (PCI_VENDOR(id) == 0xffff) { + /* Per the init pass, assume this indicates a link to an + LDT-Lite node, and the chain terminates here. */ + break; + } + + offset = pci_find_ldt_cap(tag, LDT_PRIMARY); + if (offset == 0) { + /* There is no primary interface; we must have found a host. */ + offset = pci_find_ldt_cap(tag, LDT_SECONDARY); + if (offset != 0) { + lr = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + lr |= LDT_COMMAND_DOUBLE_ENDED; + pci_conf_write(tag, offset + LDT_COMMAND_CAP_OFF, lr); + } + break; + } + + /* Otherwise, we have the primary interface. */ + + /* Rewrite the old value to set master host bit. */ + cmd = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + pci_conf_write(tag, offset + LDT_COMMAND_CAP_OFF, cmd); + cmd = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + + id = pci_conf_read(tag, PCI_ID_REG); + + /* (Re)update the unit id. See above. */ + cmd &= ~LDT_COMMAND_UNIT_ID_MASK; + cmd |= (next_free_id << LDT_COMMAND_UNIT_ID_SHIFT); + if (!pci_conf_write_acked(tag, offset + LDT_COMMAND_CAP_OFF, cmd)) { + pci_tagprintf(tag, "no ack of id update to %d\n", next_free_id); + } + + /* The unit id just changed. Update the tag */ + tag = pci_make_tag(bus, next_free_id, 0); + t = pci_conf_read(tag, PCI_ID_REG); /* for good measure */ + if (t != id) { + pci_tagprintf(tag, "id mismatch: old %08x, new %08x\n", id, t); + } + + next_free_id += LDT_COMMAND_UNIT_COUNT(cmd); + + link = LDT_COMMAND_MASTER_HOST(cmd); /* Upstream link index */ + link ^= 1; /* Downstream */ + + linkerr = ldt_wait_ready(tag, offset, link); + + lr = ldt_get_link(tag, offset, link); + ldt_set_link(tag, offset, link, lr | LDT_LINKCTRL_WC); +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "node: up %d down %d:\n", link ^ 1, link); + ldt_show_cap(tag, offset, LDT_PRIMARY); +#endif + if (linkerr || next_free_id > 0x1f) { + /* No downstream link or too many devices, set end of chain */ + ldt_end_chain(tag, offset, link); + break; + } + } + return next_free_id - 1; +} + + +/* LDT link reset (warm or cold as set by caller) */ + +void +ldt_link_reset (pcitag_t tag, int delay) +{ + pcireg_t brctl; + + /* This code may be necessary for LDT buses behind bridges (none + of which yet exist) but seems to be a bad idea for the SB-1250 + LDT bus in pass 1 parts. Note that if we do reset, we must + delay to give any attached devices a chance to (re)initialize + per the PCI spec. */ + + /* Attempt a Secondary Bus Reset. */ + brctl = pci_conf_read(tag, PPB_BRCTL_INTERRUPT_REG); + brctl |= PPB_BRCTL_SECONDARY_RESET; + pci_conf_write(tag, PPB_BRCTL_INTERRUPT_REG, brctl); + + brctl = pci_conf_read(tag, PPB_BRCTL_INTERRUPT_REG); + if ((brctl & PPB_BRCTL_SECONDARY_RESET) != 0) { + int i; + /* Bit can be written, assume soft reset is implemented. */ + brctl &=~ PPB_BRCTL_SECONDARY_RESET; + pci_conf_write(tag, PPB_BRCTL_INTERRUPT_REG, brctl); + + /* Add some delay (duration is a guess) */ + for (i = 0; i < delay; i++) + (void)pci_conf_read(tag, PPB_BRCTL_INTERRUPT_REG); + /* Alternatively, wait for LinkFail or InitDone. */ + } +} + + +/* LDT bridge and fabric initialization for a secondary chain */ + +int +ldt_chain_init (pcitag_t tag, int bus, pci_flags_t flags) +{ + int offset; + int double_ended; + int linkerr; + pcireg_t cr, lr; + int ndev, no_probe; + +#if 0 + /* This code may be necessary for LDT buses behind bridges (none + of which yet exist) but seems to be a bad idea for the SB-1250 + LDT bus in pass 1 parts. Note that if we do reset, we must + delay to give any attached devices a chance to (re)initialize + per the PCI spec. */ + + /* Attempt a Secondary Bus Reset. */ + ldt_link_reset(tag, 100); +#endif /* 0 */ + + /* To avoid a chip erratum, we must prevent Type 0 configuration + probes that get NXAs on a double hosted chain. */ + no_probe = 0; + + offset = pci_find_ldt_cap(tag, LDT_SECONDARY); + if (offset != 0) { + linkerr = ldt_wait_ready(tag, offset, 0); + +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "bridge secondary:\n"); + ldt_show_cap(tag, offset, LDT_SECONDARY); +#endif + if (linkerr) { + pci_tagprintf(tag, "secondary bad or never ready\n"); + } else { + lr = ldt_get_link(tag, offset, 0); + if ((lr & LDT_LINKCTRL_INITDONE) != 0) + double_ended = ldt_fabric_init(tag, offset, bus, flags); + else { + ldt_end_chain(tag, offset, 0); + double_ended = 0; + } + cr = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + if (double_ended) + cr |= LDT_COMMAND_DOUBLE_ENDED; + else + cr &=~ LDT_COMMAND_DOUBLE_ENDED; + pci_conf_write(tag, offset + LDT_COMMAND_CAP_OFF, cr); + + /* Rev 0.17 does not support dynamic link resizing. */ + if ((flags & PCI_FLG_LDT_REV_017) == 0) { + /* Issue a warm reset to update link frequencies. */ + cr = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + cr |= LDT_COMMAND_WARM_RESET; + pci_conf_write(tag, offset + LDT_COMMAND_CAP_OFF, cr); + cr = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + ldt_link_reset(tag, 100); + ldt_wait_ready(tag, offset, 0); + +#if (LDT_DEBUG > 1) + pci_tagprintf(tag, "bridge secondary:\n"); + ldt_show_cap(tag, offset, LDT_SECONDARY); +#endif + /* After reset, let secondary devices reinitialize. */ + cfe_sleep(CFE_HZ/2); + + ndev = ldt_fabric_reinit(bus); + + if (double_ended) { + cr = pci_conf_read(tag, offset + LDT_COMMAND_CAP_OFF); + cr |= LDT_COMMAND_DOUBLE_ENDED; + pci_conf_write(tag, offset + LDT_COMMAND_CAP_OFF, cr); + + /* Bug workaround -- don't scan simple dual-hosted chain */ + if (ndev == 0) + no_probe = 1; + } + } + } + } + + return no_probe; +} diff --git a/cfe/cfe/pci/ldtreg.h b/cfe/cfe/pci/ldtreg.h new file mode 100644 index 0000000..140effe --- /dev/null +++ b/cfe/cfe/pci/ldtreg.h @@ -0,0 +1,184 @@ +/* + * Copyright 2000,2001 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions as + * they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. Neither the "Broadcom + * Corporation" name nor any trademark or logo of Broadcom + * Corporation may be used to endorse or promote products + * derived from this software without the prior written + * permission of Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LDTREG_H_ +#define _LDTREG_H_ + +/* + * LDT capability register definitions and macros. + * Derived from Revison 0.17 of the LDT (now HyperTransport) + * Specification with some 1.02/1.03 features. + * + * Note: Register and field definitions assume 32-bit register accesses. + */ + +/* + * LDT Capability registers (identified by offsets within the capability) + */ + +/* + * Command Register; contains command and capability fields. + */ +#define LDT_COMMAND_CAP_OFF 0x00 + +#define LDT_CAP_ID_MASK 0x000000ff +#define LDT_CAP_ID_SHIFT 0 +#define LDT_CAP_PTR_MASK 0x0000ff00 +#define LDT_CAP_PTR_SHIFT 8 + +#define LDT_COMMAND_MASK 0xffff0000 +#define LDT_COMMAND_SHIFT 16 +#define LDT_COMMAND(cmd) \ + (((cmd) & LDT_COMMAND_MASK) >> LDT_COMMAND_SHIFT) +#define LDT_COMMAND_TYPE_MASK 0xe0000000 +#define LDT_COMMAND_TYPE_SHIFT (16+13) +#define LDT_COMMAND_TYPE(cmd) \ + (((cmd) & LDT_COMMAND_TYPE_MASK) >> LDT_COMMAND_TYPE_SHIFT) +#define LDT_COMMAND_TYPE_SLAVE 0x0 +#define LDT_COMMAND_TYPE_HOST 0x1 +#define LDT_COMMAND_TYPE_IDC 0x4 +#define LDT_COMMAND_TYPE_AMAP 0x5 +/* Following for 1.0x only */ +#define LDT_COMMAND_DROP_ON_INIT 0x10000000 + +/* + * An LDT capability for type Slave (aka Primary, aka "tunnel") consists + * of a Command register, two Link registers, and two Freq/Rev registers. + */ +/* Slave/Primary commands */ +#define LDT_COMMAND_UNIT_ID_MASK 0x001f0000 +#define LDT_COMMAND_UNIT_ID_SHIFT (16+0) +#define LDT_COMMAND_UNIT_ID(cmd) \ + (((cmd) & LDT_COMMAND_UNIT_ID_MASK) >> LDT_COMMAND_UNIT_ID_SHIFT) +#define LDT_COMMAND_UNIT_COUNT_MASK 0x03e00000 +#define LDT_COMMAND_UNIT_COUNT_SHIFT (16+5) +#define LDT_COMMAND_UNIT_COUNT(cmd) \ + (((cmd) & LDT_COMMAND_UNIT_COUNT_MASK) >> LDT_COMMAND_UNIT_COUNT_SHIFT) +#define LDT_COMMAND_MASTER_HOST_MASK 0x04000000 +#define LDT_COMMAND_MASTER_HOST(cmd) \ + (((cmd) & LDT_COMMAND_MASTER_HOST_MASK) ? 1 : 0) +#define LDT_COMMAND_DEFAULT_DIRECTION_MASK 0x08000000 +#define LDT_COMMAND_DEFAULT_DIRECTION(cmd) \ + (((cmd) & LDT_COMMAND_DEFAULT_DIRECTION_MASK) ? 1 : 0) + +/* + * An LDT capability for type Host (aka Secondary) consists of a + * Command register, a single Link register, and a Freq/Rev register. + */ +/* Host/Secondary command fields */ +#define LDT_COMMAND_WARM_RESET 0x00010000 +#define LDT_COMMAND_DOUBLE_ENDED 0x00020000 +#define LDT_COMMAND_DEVICE_NUMBER_MASK 0x007c0000 +#define LDT_COMMAND_DEVICE_NUMBER_SHIFT (16+2) +/* Following for 1.0x only */ +#define LDT_COMMAND_CHAIN_SIDE 0x00800000 +#define LDT_COMMAND_HOST_HIDE 0x01000000 +#define LDT_COMMAND_ACT_AS_SLAVE 0x02000000 +#define LDT_COMMAND_INBOUND_EOC_ERROR 0x04000000 + + +/* + * Link Register; contains control and config fields. + */ +#define LDT_LINK_OFF(n) (0x04 + ((n)<<2)) + +#define LDT_LINKCTRL_MASK 0x0000ffff +#define LDT_LINKCTRL_SHIFT 0 +#define LDT_LINKCTRL(cr) \ + (((cr) & LDT_LINKCTRL_MASK) >> LDT_LINKCTRL_SHIFT) +#define LDT_LINKCTRL_CFLE 0x00000002 +#define LDT_LINKCTRL_CST 0x00000004 +#define LDT_LINKCTRL_CFE 0x00000008 +#define LDT_LINKCTRL_LINKFAIL 0x00000010 +#define LDT_LINKCTRL_INITDONE 0x00000020 +#define LDT_LINKCTRL_EOC 0x00000040 +#define LDT_LINKCTRL_TXOFF 0x00000080 +#define LDT_LINKCTRL_CRCERROR_MASK 0x00000f00 +#define LDT_LINKCTRL_CRCERROR_SHIFT 8 +#define LDT_LINKCTRL_ISOCEN 0x00001000 +#define LDT_LINKCTRL_LSEN 0x00002000 +/* Following for 1.0x only */ +#define LDT_LINKCTRL_EXTCTL 0x00004000 + +#define LDT_LINKCFG_MASK 0xffff0000 +#define LDT_LINKCFG_SHIFT 16 +#define LDT_LINKCFG(cr) \ + (((cr) & LDT_LINKCFG_MASK) >> LDT_LINKCFG_SHIFT) +#define LDT_LINKCFG_MAX_WIDTH_IN(cr) \ + (((cr) >> (16+0)) & 0xf) +#define LDT_LINKCFG_MAX_WIDTH_OUT(cr) \ + (((cr) >> (16+4)) & 0xf) +#define LDT_LINKCFG_WIDTH_IN(cr) \ + (((cr) >> (16+8)) & 0xf) +#define LDT_LINKCFG_WIDTH_OUT(cr) \ + (((cr) >> (16+12)) & 0xf) + + +/* + * Link Frequency Register; contains version and frequency fields. + */ +#define LDT_LINKFREQ_CAP(cr) \ + (((cr) >> 16) & 0xffff) + +#define LDT_LINKFREQ_MASK 0x00000f00 +#define LDT_LINKFREQ_SHIFT 8 +#define LDT_LINKFREQ(cr) \ + (((cr) >> 8) & 0x0f) + +#define LDT_REVISION_ID(cr) \ + (((cr) >> 0) & 0xff) + +#define LDT_REV_017 0x11 +#define LDT_REV_102 0x22 + +/* Slave/Primary offsets */ +#define LDT_FREQ0_OFF 0x0c +#define LDT_FREQ1_OFF 0x10 +#define LDT_FREQn_OFF(n) (0x0c + ((n)<<2)) + +/* Host/Secondary offsets */ +#define LDT_FREQ_OFF 0x08 + +#define LDT_FREQ_200 0x00 +#define LDT_FREQ_300 0x01 +#define LDT_FREQ_400 0x02 +#define LDT_FREQ_500 0x03 +#define LDT_FREQ_600 0x04 +#define LDT_FREQ_800 0x05 +#define LDT_FREQ_1000 0x06 + +#endif /* _LDTREG_H_ */ diff --git a/cfe/cfe/pci/pci_machdep.h b/cfe/cfe/pci/pci_machdep.h new file mode 100644 index 0000000..c8b57ec --- /dev/null +++ b/cfe/cfe/pci/pci_machdep.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2001,2002 SiByte, Inc. All rights reserved. + */ + +#ifndef _PCI_MACHDEP_H_ +#define _PCI_MACHDEP_H_ + +/* + * Machine-specific definitions for PCI autoconfiguration. + * + * See the comments in pci_machdep.c for more explanation. + */ + +#include "lib_types.h" + +/* + * Address types, as integers. + */ + +typedef uint32_t pci_addr_t; +typedef uint64_t phys_addr_t; /* ZBbus physical addresses. */ + +/* + * Configuration tag; created from a {bus,device,function} triplet by + * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write(). + */ +typedef uint32_t pcitag_t; + +/* + * Type of a value read from or written to a configuration register. + * Always 32 bits. + */ +typedef uint32_t pcireg_t; + +#endif /* _PCI_MACHDEP_H_ */ diff --git a/cfe/cfe/pci/pci_subr.c b/cfe/cfe/pci/pci_subr.c new file mode 100644 index 0000000..56c65b1 --- /dev/null +++ b/cfe/cfe/pci/pci_subr.c @@ -0,0 +1,710 @@ +/* + * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. + * Copyright (c) 1995, 1996, 1998 + * Christopher G. Demetriou. All rights reserved. + * Copyright (c) 1994 Charles M. Hannum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Charles M. Hannum. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * PCI autoconfiguration support functions. + */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#ifndef PCIVERBOSE +# if CFG_MINIMAL_SIZE +# define PCIVERBOSE 0 +# else +# define PCIVERBOSE 1 +# endif +#endif + +#include "pcireg.h" +#include "pcivar.h" + +const char *pci_findvendor(pcireg_t id_reg); + +static void pci_conf_print_ids(pcireg_t rval, const char *prefix); +static int pci_conf_print_bar (pcitag_t, + const pcireg_t *, int, const char *, int, int); + +/* + * Descriptions of known PCI classes and subclasses. + * + * Subclasses are described in the same way as classes, but have a + * NULL subclass pointer. + */ +struct pci_class { + char *name; + int val; /* as wide as pci_{,sub}class_t */ + struct pci_class *subclasses; +}; + +struct pci_class pci_subclass_prehistoric[] = { + { "miscellaneous", PCI_SUBCLASS_PREHISTORIC_MISC, }, + { "VGA", PCI_SUBCLASS_PREHISTORIC_VGA, }, + { 0 } +}; + +struct pci_class pci_subclass_mass_storage[] = { + { "SCSI", PCI_SUBCLASS_MASS_STORAGE_SCSI, }, + { "IDE", PCI_SUBCLASS_MASS_STORAGE_IDE, }, + { "floppy", PCI_SUBCLASS_MASS_STORAGE_FLOPPY, }, + { "IPI", PCI_SUBCLASS_MASS_STORAGE_IPI, }, + { "RAID", PCI_SUBCLASS_MASS_STORAGE_RAID, }, + { "miscellaneous", PCI_SUBCLASS_MASS_STORAGE_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_network[] = { + { "ethernet", PCI_SUBCLASS_NETWORK_ETHERNET, }, + { "token ring", PCI_SUBCLASS_NETWORK_TOKENRING, }, + { "FDDI", PCI_SUBCLASS_NETWORK_FDDI, }, + { "ATM", PCI_SUBCLASS_NETWORK_ATM, }, + { "ISDN", PCI_SUBCLASS_NETWORK_ISDN, }, + { "WorldFip", PCI_SUBCLASS_NETWORK_WORLDFIP, }, + { "PCMIG MultiComp", PCI_SUBCLASS_NETWORK_PCIMGMULTICOMP, }, + { "miscellaneous", PCI_SUBCLASS_NETWORK_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_display[] = { + { "VGA", PCI_SUBCLASS_DISPLAY_VGA, }, + { "XGA", PCI_SUBCLASS_DISPLAY_XGA, }, + { "3D", PCI_SUBCLASS_DISPLAY_3D, }, + { "miscellaneous", PCI_SUBCLASS_DISPLAY_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_multimedia[] = { + { "video", PCI_SUBCLASS_MULTIMEDIA_VIDEO, }, + { "audio", PCI_SUBCLASS_MULTIMEDIA_AUDIO, }, + { "telephony", PCI_SUBCLASS_MULTIMEDIA_TELEPHONY, }, + { "miscellaneous", PCI_SUBCLASS_MULTIMEDIA_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_memory[] = { + { "RAM", PCI_SUBCLASS_MEMORY_RAM, }, + { "flash", PCI_SUBCLASS_MEMORY_FLASH, }, + { "miscellaneous", PCI_SUBCLASS_MEMORY_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_bridge[] = { + { "host", PCI_SUBCLASS_BRIDGE_HOST, }, + { "ISA", PCI_SUBCLASS_BRIDGE_ISA, }, + { "EISA", PCI_SUBCLASS_BRIDGE_EISA, }, + { "MicroChannel", PCI_SUBCLASS_BRIDGE_MCA, }, + { "PCI", PCI_SUBCLASS_BRIDGE_PCI, }, + { "PCMCIA", PCI_SUBCLASS_BRIDGE_PCMCIA, }, + { "NuBus", PCI_SUBCLASS_BRIDGE_NUBUS, }, + { "CardBus", PCI_SUBCLASS_BRIDGE_CARDBUS, }, + { "RACEway", PCI_SUBCLASS_BRIDGE_RACEWAY, }, + { "Semi-transparent PCI", PCI_SUBCLASS_BRIDGE_STPCI, }, + { "InfiniBand", PCI_SUBCLASS_BRIDGE_INFINIBAND, }, + { "miscellaneous", PCI_SUBCLASS_BRIDGE_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_communications[] = { + { "serial", PCI_SUBCLASS_COMMUNICATIONS_SERIAL, }, + { "parallel", PCI_SUBCLASS_COMMUNICATIONS_PARALLEL, }, + { "multi-port serial", PCI_SUBCLASS_COMMUNICATIONS_MPSERIAL, }, + { "modem", PCI_SUBCLASS_COMMUNICATIONS_MODEM, }, + { "miscellaneous", PCI_SUBCLASS_COMMUNICATIONS_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_system[] = { + { "8259 PIC", PCI_SUBCLASS_SYSTEM_PIC, }, + { "8237 DMA", PCI_SUBCLASS_SYSTEM_DMA, }, + { "8254 timer", PCI_SUBCLASS_SYSTEM_TIMER, }, + { "RTC", PCI_SUBCLASS_SYSTEM_RTC, }, + { "PCI Hot-Plug", PCI_SUBCLASS_SYSTEM_PCIHOTPLUG, }, + { "miscellaneous", PCI_SUBCLASS_SYSTEM_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_input[] = { + { "keyboard", PCI_SUBCLASS_INPUT_KEYBOARD, }, + { "digitizer", PCI_SUBCLASS_INPUT_DIGITIZER, }, + { "mouse", PCI_SUBCLASS_INPUT_MOUSE, }, + { "scanner", PCI_SUBCLASS_INPUT_SCANNER, }, + { "game port", PCI_SUBCLASS_INPUT_GAMEPORT, }, + { "miscellaneous", PCI_SUBCLASS_INPUT_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_dock[] = { + { "generic", PCI_SUBCLASS_DOCK_GENERIC, }, + { "miscellaneous", PCI_SUBCLASS_DOCK_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_processor[] = { + { "386", PCI_SUBCLASS_PROCESSOR_386, }, + { "486", PCI_SUBCLASS_PROCESSOR_486, }, + { "Pentium", PCI_SUBCLASS_PROCESSOR_PENTIUM, }, + { "Alpha", PCI_SUBCLASS_PROCESSOR_ALPHA, }, + { "PowerPC", PCI_SUBCLASS_PROCESSOR_POWERPC, }, + { "MIPS", PCI_SUBCLASS_PROCESSOR_MIPS, }, + { "Co-processor", PCI_SUBCLASS_PROCESSOR_COPROC, }, + { 0 }, +}; + +struct pci_class pci_subclass_serialbus[] = { + { "Firewire", PCI_SUBCLASS_SERIALBUS_FIREWIRE, }, + { "ACCESS.bus", PCI_SUBCLASS_SERIALBUS_ACCESS, }, + { "SSA", PCI_SUBCLASS_SERIALBUS_SSA, }, + { "USB", PCI_SUBCLASS_SERIALBUS_USB, }, + /* XXX Fiber Channel/_FIBRECHANNEL */ + { "Fiber Channel", PCI_SUBCLASS_SERIALBUS_FIBER, }, + { "SMBus", PCI_SUBCLASS_SERIALBUS_SMBUS, }, + { "InfiniBand", PCI_SUBCLASS_SERIALBUS_INFINIBAND, }, + { "IPMI", PCI_SUBCLASS_SERIALBUS_IPMI, }, + { "SERCOS", PCI_SUBCLASS_SERIALBUS_SERCOS, }, + { "CANbus", PCI_SUBCLASS_SERIALBUS_CANBUS, }, + { 0 }, +}; + +struct pci_class pci_subclass_wireless[] = { + { "iRDA", PCI_SUBCLASS_WIRELESS_IRDA, }, + { "Consumer IR", PCI_SUBCLASS_WIRELESS_CONSUMERIR, }, + { "RF", PCI_SUBCLASS_WIRELESS_RF, }, + { "miscellaneous", PCI_SUBCLASS_WIRELESS_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_i2o[] = { + { "1.0", PCI_SUBCLASS_I2O_STANDARD, }, + { 0 }, +}; + +struct pci_class pci_subclass_satcom[] = { + { "TV", PCI_SUBCLASS_SATCOM_TV, }, + { "audio", PCI_SUBCLASS_SATCOM_AUDIO, }, + { "voice", PCI_SUBCLASS_SATCOM_VOICE, }, + { "data", PCI_SUBCLASS_SATCOM_DATA, }, + { 0 }, +}; + +struct pci_class pci_subclass_crypto[] = { + { "network/computing", PCI_SUBCLASS_CRYPTO_NETCOMP, }, + { "entertainment", PCI_SUBCLASS_CRYPTO_ENTERTAINMENT, }, + { "miscellaneous", PCI_SUBCLASS_CRYPTO_MISC, }, + { 0 }, +}; + +struct pci_class pci_subclass_dasp[] = { + { "DPIO", PCI_SUBCLASS_DASP_DPIO, }, + { "time and frequency", PCI_SUBCLASS_DASP_TIMERFREQ, }, + { "miscellaneous", PCI_SUBCLASS_DASP_MISC, }, + { 0 }, +}; + +struct pci_class pci_class[] = { + { "prehistoric", PCI_CLASS_PREHISTORIC, + pci_subclass_prehistoric, }, + { "mass storage", PCI_CLASS_MASS_STORAGE, + pci_subclass_mass_storage, }, + { "network", PCI_CLASS_NETWORK, + pci_subclass_network, }, + { "display", PCI_CLASS_DISPLAY, + pci_subclass_display, }, + { "multimedia", PCI_CLASS_MULTIMEDIA, + pci_subclass_multimedia, }, + { "memory", PCI_CLASS_MEMORY, + pci_subclass_memory, }, + { "bridge", PCI_CLASS_BRIDGE, + pci_subclass_bridge, }, + { "communications", PCI_CLASS_COMMUNICATIONS, + pci_subclass_communications, }, + { "system", PCI_CLASS_SYSTEM, + pci_subclass_system, }, + { "input", PCI_CLASS_INPUT, + pci_subclass_input, }, + { "dock", PCI_CLASS_DOCK, + pci_subclass_dock, }, + { "processor", PCI_CLASS_PROCESSOR, + pci_subclass_processor, }, + { "serial bus", PCI_CLASS_SERIALBUS, + pci_subclass_serialbus, }, + { "wireless", PCI_CLASS_WIRELESS, + pci_subclass_wireless, }, + { "I2O", PCI_CLASS_I2O, + pci_subclass_i2o, }, + { "satellite comm", PCI_CLASS_SATCOM, + pci_subclass_satcom, }, + { "crypto", PCI_CLASS_CRYPTO, + pci_subclass_crypto, }, + { "DASP", PCI_CLASS_DASP, + pci_subclass_dasp, }, + { "undefined", PCI_CLASS_UNDEFINED, + 0, }, + { 0 }, +}; + +#if PCIVERBOSE +/* + * Descriptions of of known vendors and devices ("products"). + */ +#include "pcidevs.h" + +struct pci_knowndev2 { + pci_vendor_id_t vendor; + pci_product_id_t product; + int flags; + int vendorname, productname; +}; +#define PCI_KNOWNDEV_NOPROD 0x01 /* match on vendor only */ +#include "pcidevs_data2.h" + +const char * +pci_findvendor(pcireg_t id_reg) +{ + pci_vendor_id_t vendor = PCI_VENDOR(id_reg); + const struct pci_knowndev2 *kdp; + + kdp = pci_knowndevs; + while (kdp->vendorname != PCI_STRING_NULL) { /* all have vendor name */ + if (kdp->vendor == vendor) + break; + kdp++; + } + if (kdp->vendorname == PCI_STRING_NULL) return NULL; + return PCI_STRING(kdp->vendorname); +} +#else +const char * +pci_findvendor(pcireg_t id_reg) +{ + return NULL; +} +#endif /* PCIVERBOSE */ + +void +pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, int showclass, char *cp) +{ + pci_vendor_id_t vendor; + pci_product_id_t product; + pci_class_t class; + pci_subclass_t subclass; + pci_interface_t interface; + pci_revision_t revision; + const char *vendor_namep, *product_namep; + struct pci_class *classp, *subclassp; +#if PCIVERBOSE + const struct pci_knowndev2 *kdp; + const char *unmatched = "unknown "; +#else + const char *unmatched = ""; +#endif + + vendor = PCI_VENDOR(id_reg); + product = PCI_PRODUCT(id_reg); + + class = PCI_CLASS(class_reg); + subclass = PCI_SUBCLASS(class_reg); + interface = PCI_INTERFACE(class_reg); + revision = PCI_REVISION(class_reg); + +#if PCIVERBOSE + kdp = pci_knowndevs; + while (kdp->vendorname != PCI_STRING_NULL) { /* all have vendor name */ + if (kdp->vendor == vendor && (kdp->product == product || + (kdp->flags & PCI_KNOWNDEV_NOPROD) != 0)) + break; + kdp++; + } + if (kdp->vendorname == PCI_STRING_NULL) + vendor_namep = product_namep = NULL; + else { + vendor_namep = PCI_STRING(kdp->vendorname); + product_namep = ((kdp->flags & PCI_KNOWNDEV_NOPROD) == 0 ? + PCI_STRING(kdp->productname) : NULL); + } +#else /* PCIVERBOSE */ + vendor_namep = product_namep = NULL; +#endif /* PCIVERBOSE */ + + classp = pci_class; + while (classp->name != NULL) { + if (class == classp->val) + break; + classp++; + } + + subclassp = (classp->name != NULL) ? classp->subclasses : NULL; + while (subclassp && subclassp->name != NULL) { + if (subclass == subclassp->val) + break; + subclassp++; + } + + if (vendor_namep == NULL) + cp += sprintf(cp, "%svendor 0x%04x product 0x%04x", + unmatched, vendor, product); + else if (product_namep != NULL) + cp += sprintf(cp, "%s %s", vendor_namep, product_namep); + else + cp += sprintf(cp, "%s product 0x%04x", vendor_namep, product); + if (showclass) { + cp += sprintf(cp, " ("); + if (classp->name == NULL) + cp += sprintf(cp, "class 0x%02x, subclass 0x%02x", + class, subclass); + else { + if (subclassp == NULL || subclassp->name == NULL) + cp += sprintf(cp, "%s subclass 0x%02x", + classp->name, subclass); + else + cp += sprintf(cp, "%s %s", subclassp->name, classp->name); + } + if (interface != 0) + cp += sprintf(cp, ", interface 0x%02x", interface); + if (revision != 0) + cp += sprintf(cp, ", revision 0x%02x", revision); + cp += sprintf(cp, ")"); + } +} + + +/* + * Support routines for printing out PCI configuration registers. + */ + +#define i2o(i) ((i) * 4) +#define o2i(o) ((o) / 4) +#define onoff(str, bit) \ + do { \ + printf(" %s: %s\n", (str), (rval & (bit)) ? "on" : "off"); \ + } while (0) + +#if PCIVERBOSE +static void +pci_conf_print_ids(pcireg_t rval, const char *prefix) +{ + const struct pci_knowndev2 *kdp; + + for (kdp = pci_knowndevs; kdp->vendorname != PCI_STRING_NULL; kdp++) { + if (kdp->vendor == PCI_VENDOR(rval) && + (kdp->product == PCI_PRODUCT(rval) || + (kdp->flags & PCI_KNOWNDEV_NOPROD) != 0)) { + break; + } + } + if (kdp->vendorname != PCI_STRING_NULL) + printf("%sVendor Name: %s (0x%04x)\n", prefix, + PCI_STRING(kdp->vendorname), PCI_VENDOR(rval)); + else + printf("%sVendor ID: 0x%04x\n", prefix, PCI_VENDOR(rval)); + if (kdp->productname != PCI_STRING_NULL + && (kdp->flags & PCI_KNOWNDEV_NOPROD) == 0) + printf("%sDevice Name: %s (0x%04x)\n", prefix, + PCI_STRING(kdp->productname), PCI_PRODUCT(rval)); + else + printf("%sDevice ID: 0x%04x\n", prefix, PCI_PRODUCT(rval)); +} +#else +static void +pci_conf_print_ids(pcireg_t rval, const char *prefix) +{ + printf("%sVendor ID: 0x%04x\n", prefix, PCI_VENDOR(rval)); + printf("%sDevice ID: 0x%04x\n", prefix, PCI_PRODUCT(rval)); +} +#endif /* PCIVERBOSE */ + +static int +pci_conf_print_bar( + pcitag_t tag, const pcireg_t *regs, + int reg, const char *name, + int sizebar, int onlyimpl) +{ + int width; + pcireg_t mask, rval; + pcireg_t mask64h, rval64h; + +#ifdef __GNUC__ /* XXX GCC -Wuninitialized inadequacies */ + mask64h = rval64h = 0; +#endif + + width = 4; + + /* + * Section 6.2.5.1, `Address Maps', tells us that: + * + * 1) The builtin software should have already mapped the + * device in a reasonable way. + * + * 2) A device which wants 2^n bytes of memory will hardwire + * the bottom n bits of the address to 0. As recommended, + * we write all 1s and see what we get back. + */ + rval = regs[o2i(reg)]; + /* XXX don't size unknown memory type? */ + if (rval != 0 && sizebar) { + uint32_t cmdreg; + + /* + * The following sequence seems to make some devices + * (e.g. host bus bridges, which don't normally + * have their space mapped) very unhappy, to + * the point of crashing the system. + * + * Therefore, if the mapping register is zero to + * start out with, don't bother trying. + */ + + cmdreg = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); + cmdreg &= (PCI_COMMAND_MASK << PCI_COMMAND_SHIFT); /* keep status */ + pci_conf_write(tag, PCI_COMMAND_STATUS_REG, + cmdreg & ~(PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE)); + + pci_conf_write(tag, reg, 0xffffffff); + mask = pci_conf_read(tag, reg); + pci_conf_write(tag, reg, rval); + if (PCI_MAPREG_TYPE(rval) == PCI_MAPREG_TYPE_MEM && + PCI_MAPREG_MEM_TYPE(rval) == PCI_MAPREG_MEM_TYPE_64BIT) { + rval64h = regs[o2i(reg + 4)]; + pci_conf_write(tag, reg + 4, 0xffffffff); + mask64h = pci_conf_read(tag, reg + 4); + pci_conf_write(tag, reg + 4, rval64h); + width = 8; + } + + pci_conf_write(tag, PCI_COMMAND_STATUS_REG, cmdreg); + } else + mask = 0; + + if (rval == 0 && onlyimpl) + return width; + + printf(" Base Address Register at 0x%02x", reg); + if (name) + printf(" (%s)", name); + printf("\n "); + if (rval == 0) { + printf("not implemented(?)\n"); + return width; + } + printf("type: "); + if (PCI_MAPREG_TYPE(rval) == PCI_MAPREG_TYPE_MEM) { + const char *type, *prefetch; + + switch (PCI_MAPREG_MEM_TYPE(rval)) { + case PCI_MAPREG_MEM_TYPE_32BIT: + type = "32-bit"; + break; + case PCI_MAPREG_MEM_TYPE_32BIT_1M: + type = "32-bit-1M"; + break; + case PCI_MAPREG_MEM_TYPE_64BIT: + type = "64-bit"; + break; + default: + type = "unknown (XXX)"; + break; + } + if (PCI_MAPREG_MEM_PREFETCHABLE(rval)) + prefetch = ""; + else + prefetch = "non"; + printf("%s %sprefetchable memory\n", type, prefetch); + switch (PCI_MAPREG_MEM_TYPE(rval)) { + case PCI_MAPREG_MEM_TYPE_64BIT: + printf(" base: 0x%016llx, ", + PCI_MAPREG_MEM64_ADDR( + ((((long long) rval64h) << 32) | rval))); + if (sizebar) + printf("size: 0x%016llx", + PCI_MAPREG_MEM64_SIZE( + ((((long long) mask64h) << 32) | mask))); + else + printf("not sized"); + printf("\n"); + break; + case PCI_MAPREG_MEM_TYPE_32BIT: + case PCI_MAPREG_MEM_TYPE_32BIT_1M: + default: + printf(" base: 0x%08x, ", PCI_MAPREG_MEM_ADDR(rval)); + if (sizebar) + printf("size: 0x%08x", PCI_MAPREG_MEM_SIZE(mask)); + else + printf("not sized"); + printf("\n"); + break; + } + } else { + if (sizebar) + printf("%d-bit ", mask & ~0x0000ffff ? 32 : 16); + printf("i/o\n"); + printf(" base: 0x%08x, ", PCI_MAPREG_IO_ADDR(rval)); + if (sizebar) + printf("size: 0x%08x", PCI_MAPREG_IO_SIZE(mask)); + else + printf("not sized"); + printf("\n"); + } + + return width; +} + + +/* Summary printing: Display device ID, status, memory map only. */ + +#define on(str, bit) \ + do { if (rval & (bit)) printf(" %s: on\n", (str)); } while (0) + +void +pci_conf_print(pcitag_t tag) +{ + pcireg_t regs[o2i(256)]; + int off, width; + pcireg_t rval; + uint32_t base, limit; + int sizebars; + + if (!pci_probe_tag(tag)) { + printf("no device\n"); + return; + } + + for (off = 0; off < 256; off += 4) + regs[o2i(off)] = pci_conf_read(tag, off); + + rval = regs[o2i(PCI_ID_REG)]; + pci_conf_print_ids(rval, " "); + + rval = regs[o2i(PCI_COMMAND_STATUS_REG)]; + + printf(" Command: 0x%04x\n", rval & 0xffff); + on("I/O space accesses", PCI_COMMAND_IO_ENABLE); + on("Memory space accesses", PCI_COMMAND_MEM_ENABLE); + on("Bus mastering", PCI_COMMAND_MASTER_ENABLE); + + printf(" Status: 0x%04x\n", PCI_STATUS(rval)); + on("Slave signaled Target Abort", PCI_STATUS_TARGET_TARGET_ABORT); + on("Master received Target Abort", PCI_STATUS_MASTER_TARGET_ABORT); + on("Master received Master Abort", PCI_STATUS_MASTER_ABORT); + on("Asserted System Error (SERR)", PCI_STATUS_SYSTEM_ERROR); + on("Parity error detected", PCI_STATUS_PARITY_DETECT); + + switch (PCI_HDRTYPE_TYPE(regs[o2i(PCI_BHLC_REG)])) { + case 0: + /* Standard device header */ + printf(" Type 0 (normal) header:\n"); + + /* sizing host BARs is often bad news */ + sizebars = 1; + if (PCI_CLASS(regs[o2i(PCI_CLASS_REG)]) == PCI_CLASS_BRIDGE && + PCI_SUBCLASS(regs[o2i(PCI_CLASS_REG)]) == PCI_SUBCLASS_BRIDGE_HOST) + sizebars = 0; + for (off = PCI_MAPREG_START; off < PCI_MAPREG_END; off += width) + width = pci_conf_print_bar(tag, regs, off, NULL, sizebars, 1); + + rval = regs[o2i(PCI_BPARAM_INTERRUPT_REG)]; + printf(" Interrupt Line: 0x%02x\n", PCI_INTERRUPT_LINE(rval)); + break; + + case 1: + /* PCI-PCI bridge header */ + printf(" Type 1 (PCI-PCI bridge) header:\n"); + + rval = regs[o2i(PPB_BUSINFO_REG)]; + printf(" Buses:\n"); + printf(" Primary: %d,", PPB_BUSINFO_PRIMARY(rval)); + printf(" Secondary: %d,", PPB_BUSINFO_SECONDARY(rval)); + printf(" Subordinate: %d\n", PPB_BUSINFO_SUBORD(rval)); + + rval = regs[o2i(PPB_IO_STATUS_REG)]; + printf(" Secondary Status: 0x%04x\n", PPB_SECSTATUS(rval)); + on(" Data parity error detected", PCI_STATUS_PARITY_ERROR); + on(" Signaled Target Abort", PCI_STATUS_TARGET_TARGET_ABORT); + on(" Received Target Abort", PCI_STATUS_MASTER_TARGET_ABORT); + on(" Received Master Abort", PCI_STATUS_MASTER_ABORT); + on(" System Error", PCI_STATUS_SYSTEM_ERROR); + on(" Parity Error", PCI_STATUS_PARITY_DETECT); + + rval = regs[o2i(PPB_IO_STATUS_REG)]; + base = PPB_IO_BASE(rval); + limit = PPB_IO_LIMIT(rval); + if (base != 0 || limit != 0) { + printf(" I/O Range:\n"); + + if ((base & 0xf) != 0 || (limit & 0xf) != 0) { + base = ((base & 0xf0) << 8) | 0x000; + limit = ((limit & 0xf0) << 8) | 0xfff; + rval = regs[o2i(PPB_IO_UPPER_REG)]; + base |= PPB_BASE(rval) << 16; + limit |= PPB_LIMIT(rval) << 16; + printf(" base: 0x%08x, limit: 0x%08x\n", base, limit); + } else { + base = (base << 8) | 0x000; + limit = (limit << 8) | 0xfff; + printf(" base: 0x%04x, limit: 0x%04x\n", base, limit); + } + } + + base = PPB_BASE(regs[o2i(PPB_MEM_REG)]) & 0xfff0; + limit = PPB_LIMIT(regs[o2i(PPB_MEM_REG)]) & 0xfff0; + printf(" Memory Range:\n"); + base = (base << 16) | 0x00000; + limit = (limit << 16) | 0xfffff; + printf(" base: 0x%08x, limit: 0x%08x\n", base, limit); + + base = PPB_BASE(regs[o2i(PPB_PREFMEM_REG)]) & 0xffff; + limit = PPB_LIMIT(regs[o2i(PPB_PREFMEM_REG)]) & 0xffff; + if (base != 0 || limit != 0 + || regs[o2i(PPB_PREFMEM_BASE_UPPER_REG)] != 0 + || regs[o2i(PPB_PREFMEM_LIMIT_UPPER_REG)] != 0) { + printf(" Prefetchable Memory Range:\n"); + if ((base & 0xf) != 0 || (limit & 0xf) != 0) { + base = ((base & 0xfff0) << 16) | 0x00000; + limit = ((limit & 0xfff0) << 16) | 0xfffff; + printf(" base: 0x%08x%08x, limit: 0x%08x%08x\n", + regs[o2i(PPB_PREFMEM_BASE_UPPER_REG)], base, + regs[o2i(PPB_PREFMEM_LIMIT_UPPER_REG)], limit); + } else { + base = (base << 16) | 0x00000; + limit = (limit << 16) | 0xfffff; + printf(" base: 0x%08x, limit: 0x%08x\n", base, limit); + } + } + + if (regs[o2i(PPB_MAPREG_ROM)] != 0) + printf(" Expansion ROM Base Address: 0x%08x\n", + regs[o2i(PPB_MAPREG_ROM)]); + break; + + default: + break; + } +} + diff --git a/cfe/cfe/pci/pciconf.c b/cfe/cfe/pci/pciconf.c new file mode 100644 index 0000000..9f23f7c --- /dev/null +++ b/cfe/cfe/pci/pciconf.c @@ -0,0 +1,1296 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PCI Configuration File: pciconf.c + * + ********************************************************************* + * + * Copyright 2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Based in part on the algor p5064 version of pciconf.c: + * generic PCI bus configuration + * Copyright (c) 1999 Algorithmics Ltd + * which in turn appears to be based on PMON code. + */ + +#include "cfe_pci.h" +#include "cfe_timer.h" +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "lib_malloc.h" + +#include "pcivar.h" +#include "pcireg.h" +#include "pcidevs.h" +#include "ldtreg.h" + +#ifndef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif + +#define PRINTF printf +#define VPRINTF vprintf + +extern void cfe_ledstr(const char *); +#define SBD_DISPLAY(msg) cfe_ledstr(msg) + +int _pciverbose; + +/* pci_devinfo uses sprintf(), and we don't necessarily want to drag + in all those tables for a minimal build, so set this function + pointer if it is required. */ +void (*_pci_devinfo_func) (pcireg_t, pcireg_t, int, char *); + +int _pci_nbus; /* start off with one bus */ +const int _pci_maxbus; /* maximum number of busses */ +int _pci_enumerated = 0; + +/* The "devices" here are actually PCI "functions" */ +#ifndef PCIMAX_DEV +#define PCIMAX_DEV 16 /* arbitrary */ +#endif +#ifndef PCIMAX_MEMWIN +#define PCIMAX_MEMWIN 3 /* arbitrary per device */ +#endif +#ifndef PCIMAX_IOWIN +#define PCIMAX_IOWIN 1 /* arbitrary per device */ +#endif + +struct pcidev { + struct pci_attach_args *pa; + int bus; + unsigned char min_gnt; + unsigned char max_lat; + short nmemwin; + short niowin; +}; + +struct pciwin { + struct pcidev *dev; + int reg; + size_t size; + pcireg_t address; +}; + +struct pcirange { + pcireg_t base; + pcireg_t next; + pcireg_t limit; +}; + +static struct pci_attach_args *pciarg; /* the array of devices (external) */ +static struct pcidev *pcidev; /* parallel attr array (internal) */ +static int pcindev; +static int pcimaxdev; + +static struct pciwin *pcimemwin; /* the array of memory windows */ +static int pcinmemwin; +static int pcimaxmemwin; +static struct pcirange pcimemaddr; + +static struct pciwin *pciiowin; /* the array of i/o windows */ +static int pciniowin; +static int pcimaxiowin; +static struct pcirange pciioaddr; + + +/* The pass 1 SB-1250 LDT host bridge (LHB) does not implement the base + and limit registers for its secondary bus correctly. To compensate, + the following code includes hardware-dependent extensions to: + - pad the assignment of addresses on the "first" bus behind that + bridge (its secondary) so that the 32 bytes starting at the base + address are unused. + - pad the assignment of addresses on the "first" bus not behind that + bridge (the successor to its subordinate bus) so that the 32 bytes + starting at the limit address + 1 are unused. + - derive values assigned to the mem and io limit registers from + the last allocated address + 1, not from the last allocated + address as specified for conforming PCI bridges. + For pass 1 parts, the revision of the LHB is 1. This problem is fixed + and the workaround is unnecessary for revision numbers greater than 1. +*/ + +static int lhb_secondary_bus; +static int lhb_subordinate_bus; + + +static void +print_bdf (int bus, int device, int function) +{ + PRINTF ("PCI"); + if (bus >= 0) + PRINTF (" bus %d", bus); + if (device >= 0) + PRINTF (" slot %d", device); + if (function >= 0) + PRINTF ("/%d", function); + PRINTF (": "); +} + +void +pci_bdfprintf (int bus, int device, int function, const char *fmt, ...) +{ + va_list arg; + + print_bdf (bus, device, function); +#ifdef __VARARGS_H + va_start(arg); +#else + va_start(arg, fmt); +#endif + VPRINTF (fmt, arg); + va_end(arg); +} + +void +pci_tagprintf (pcitag_t tag, const char *fmt, ...) +{ + va_list arg; + int bus, device, function; + + pci_break_tag (tag, &bus, &device, &function); + print_bdf (bus, device, function); + +#ifdef __VARARGS_H + va_start(arg); +#else + va_start(arg, fmt); +#endif + VPRINTF (fmt, arg); + va_end(arg); +} + + +/* Initialize the pci-pci bridges and bus hierarchy. */ + +/* let rec */ +static void pci_businit (int bus, pci_flags_t flags); + +static void +pci_businit_dev_func (pcitag_t tag, pci_flags_t flags) +{ + pcireg_t id, class, bhlc; + + class = pci_conf_read(tag, PCI_CLASS_REG); + id = pci_conf_read(tag, PCI_ID_REG); + bhlc = pci_conf_read(tag, PCI_BHLC_REG); + + pcindev++; + + if (PCI_CLASS(class) == PCI_CLASS_BRIDGE && PCI_HDRTYPE_TYPE(bhlc) == 1) { + enum {NONE, PCI, LDT} sec_type; + int offset; + int bus, device, function; + int bus2; + struct pci_bus *psec; + pcireg_t data; + + sec_type = NONE; + offset = 0; + switch (PCI_SUBCLASS(class)) { + case PCI_SUBCLASS_BRIDGE_PCI: + /* See if there is an LDT capability for the secondary. */ + offset = pci_find_ldt_cap(tag, LDT_SECONDARY); + sec_type = offset == 0 ? PCI : LDT; + break; + case PCI_SUBCLASS_BRIDGE_HOST: + case PCI_SUBCLASS_BRIDGE_MISC: + /* A Type 1 host bridge (e.g., SB-1250 LDT) or an + X-to-LDT bridge with unassigned subclass (LDT?). + Probe iff the secondary is LDT (best policy?) */ + offset = pci_find_ldt_cap(tag, LDT_SECONDARY); + if (offset != 0) sec_type = LDT; + break; + } + + if (sec_type == NONE || _pci_nbus == _pci_maxbus) + return; + + pci_break_tag(tag, &bus, &device, &function); + + if (sec_type == LDT && offset != 0) { + pcireg_t cr = pci_conf_read(tag, offset+LDT_COMMAND_CAP_OFF); + if ((cr & LDT_COMMAND_DOUBLE_ENDED) != 0) + return; + } + + bus2 = _pci_nbus; + psec = &_pci_bus[_pci_nbus]; + _pci_nbus++; + + psec->tag = tag; + psec->primary = bus; + + /* + * set primary to bus + * set secondary to _pci_nbus + * set subordinate to max possible bus number + */ + data = (PCI_BUSMAX << 16) | (bus2 << 8) | bus; + pci_conf_write(tag, PPB_BUSINFO_REG, data); + + /* + * set base interrupt mapping. + */ + if (bus == 0) { + /* We assume board-specific wiring for bus 0 devices. */ + psec->inta_shift = pci_int_shift_0(tag); + } else { + /* We assume expansion boards wired per PCI Bridge spec */ + psec->inta_shift = (_pci_bus[bus].inta_shift + device) % 4; + } + + /* if the new bus is LDT, do the fabric initialization */ + if (sec_type == LDT) + _pci_bus[bus2].no_probe = ldt_chain_init(tag, bus2, flags); + else + _pci_bus[bus2].no_probe = 0; + +#ifdef _CSWARM_ + /* We must avoid attempting to scan the secondary bus of the + diagnostic sturgeon on a cswarm (MasterAbortMode == 0 + appears not to suppress propagation of aborts). We know + its secondary bus number will be 2 on cswarm. */ + if (bus2 == 2) + _pci_bus[bus2].no_probe = 1; +#endif + + /* Scan the new bus for PCI-PCI bridges and initialize. To + avoid a chip erratum, we must skip this for double-hosted + chains with no secondary devices. The no_probe attribute + is a workaround (see ldt_chain_init above). */ + if (_pci_bus[bus2].no_probe) { + _pci_bus[bus2].min_io_addr = 0xffffffff; + _pci_bus[bus2].max_io_addr = 0; + _pci_bus[bus2].min_mem_addr = 0xffffffff; + _pci_bus[bus2].max_mem_addr = 0; + } else + pci_businit(bus2, flags); + + /* reset subordinate bus number */ + data = (data & 0xff00ffff) | ((_pci_nbus - 1) << 16); + pci_conf_write(tag, PPB_BUSINFO_REG, data); + + /* SB-1250 pass 1 work-around: remember the buses behind the + LDT host bridge. This is not the far end of a + double-hosted chain. */ + if (PCI_VENDOR(id) == PCI_VENDOR_SIBYTE && + PCI_PRODUCT(id) == PCI_PRODUCT_SIBYTE_SB1250_LDT && + PCI_REVISION(class) == 1) { + lhb_secondary_bus = bus2; + lhb_subordinate_bus = _pci_nbus - 1; + } + } +} + +static void +pci_businit_dev (int bus, int device, pci_flags_t flags) +{ + pcitag_t tag; + pcireg_t bhlc; + int function, maxfunc; + + tag = pci_make_tag(bus, device, 0); + if (!pci_canscan (tag)) + return; + + if (!pci_probe_tag(tag)) + return; + + bhlc = pci_conf_read(tag, PCI_BHLC_REG); + maxfunc = PCI_HDRTYPE_MULTIFN(bhlc) ? PCI_FUNCMAX : 0; + + for (function = 0; function <= maxfunc; function++) { + tag = pci_make_tag(bus, device, function); + if (pci_probe_tag(tag)) + pci_businit_dev_func(tag, flags); + } +} + + +static void +pci_businit (int bus, pci_flags_t flags) +{ + struct pci_bus *ppri; + int device; + + ppri = &_pci_bus[bus]; + ppri->min_io_addr = 0xffffffff; + ppri->max_io_addr = 0; + ppri->min_mem_addr = 0xffffffff; + ppri->max_mem_addr = 0; + + /* Pass 1 errata: we must number the buses in ascending order to + avoid problems with the LDT host bridge capturing all + configuration cycles. */ + + for (device = 0; device <= PCI_DEVMAX; device++) + pci_businit_dev (bus, device, flags); +} + + +/* Scan each PCI device on the system and record its configuration + requirements. */ + +static void +pci_query_dev_func (pcitag_t tag) +{ + pcireg_t id, class; + pcireg_t old, mask; + pcireg_t stat; + pcireg_t bparam; + pcireg_t icr; + pcireg_t bhlc; + pcireg_t t; /* used for pushing writes to cfg registers */ + unsigned int x; + int reg, mapreg_end, mapreg_rom; + struct pci_bus *pb; + struct pci_attach_args *pa; + struct pcidev *pd; + struct pciwin *pm, *pi; + int bus, device, function, incr; + uint16_t cmd; + uint8_t pin, pci_int; + + class = pci_conf_read(tag, PCI_CLASS_REG); + id = pci_conf_read(tag, PCI_ID_REG); + pci_break_tag(tag, &bus, &device, &function); + + if (_pciverbose && _pci_devinfo_func) { + char devinfo[256]; + (*_pci_devinfo_func)(id, class, 1, devinfo); + pci_tagprintf(tag, "%s\n", devinfo); + } + + if (pcindev >= pcimaxdev) { + panic ("pci: unexpected device number\n"); + return; + } + + pa = &pciarg[pcindev]; + pa->pa_tag = tag; + pa->pa_id = id; + pa->pa_class = class; + + pd = &pcidev[pcindev++]; + pd->pa = pa; + pd->bus = bus; + pd->nmemwin = 0; + pd->niowin = 0; + + pb = &_pci_bus[bus]; + pb->ndev++; + + stat = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); + + /* do all devices support fast back-to-back */ + if ((stat & PCI_STATUS_BACKTOBACK_SUPPORT) == 0) + pb->fast_b2b = 0; /* no, sorry */ + + /* do all devices run at 66 MHz */ + if ((stat & PCI_STATUS_66MHZ_SUPPORT) == 0) + pb->freq66 = 0; /* no, sorry */ + + /* find slowest devsel */ + x = PCI_STATUS_DEVSEL(stat); + if (x > pb->devsel) + pb->devsel = x; + + bparam = pci_conf_read(tag, PCI_BPARAM_INTERRUPT_REG); + + pd->min_gnt = PCI_BPARAM_GRANT (bparam); + pd->max_lat = PCI_BPARAM_LATENCY (bparam); + + if (pd->min_gnt != 0 || pd->max_lat != 0) { + /* find largest minimum grant time of all devices */ + if (pd->min_gnt != 0 && pd->min_gnt > pb->min_gnt) + pb->min_gnt = pd->min_gnt; + + /* find smallest maximum latency time of all devices */ + if (pd->max_lat != 0 && pd->max_lat < pb->max_lat) + pb->max_lat = pd->max_lat; + + if (pd->max_lat != 0) + /* subtract our minimum on-bus time per sec from bus bandwidth */ + pb->bandwidth -= pd->min_gnt * 4000000 / + (pd->min_gnt + pd->max_lat); + } + + /* Hook any special setup code and test for skipping resource + allocation, e.g., for our own host bridges. */ + if (pci_device_preset(tag) != 0) + return; + + /* Does the function need an interrupt mapping? */ + icr = pci_conf_read(tag, PCI_BPARAM_INTERRUPT_REG); + pin = PCI_INTERRUPT_PIN(icr); + icr &=~ (PCI_INTERRUPT_LINE_MASK << PCI_INTERRUPT_LINE_SHIFT); + if (pin == PCI_INTERRUPT_PIN_NONE) + pci_int = 0; + else if (bus == 0) + pci_int = pci_int_map_0(tag); + else + pci_int = (pb->inta_shift + device + (pin - 1)) % 4 + 1; + icr |= pci_int_line(pci_int) << PCI_INTERRUPT_LINE_SHIFT; + pci_conf_write(tag, PCI_BPARAM_INTERRUPT_REG, icr); + + /* Find and size the BARs */ + bhlc = pci_conf_read(tag, PCI_BHLC_REG); + switch (PCI_HDRTYPE_TYPE(bhlc)) { + case 0: /* Type 0 */ + mapreg_end = PCI_MAPREG_END; + mapreg_rom = PCI_MAPREG_ROM; + break; + case 1: /* Type 1 (bridge) */ + mapreg_end = PCI_MAPREG_PPB_END; + mapreg_rom = PCI_MAPREG_PPB_ROM; + break; + case 2: /* Type 2 (cardbus) */ + mapreg_end = PCI_MAPREG_PCB_END; + mapreg_rom = PCI_MAPREG_NONE; + break; + default: /* unknown */ + mapreg_end = PCI_MAPREG_START; /* assume none */ + mapreg_rom = PCI_MAPREG_NONE; + break; + } + + cmd = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); + cmd &= (PCI_COMMAND_MASK << PCI_COMMAND_SHIFT); /* don't clear status */ + pci_conf_write(tag, PCI_COMMAND_STATUS_REG, + cmd & ~(PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE)); + t = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); /* push the write */ + + for (reg = PCI_MAPREG_START; reg < mapreg_end; reg += incr) { + old = pci_conf_read(tag, reg); + pci_conf_write(tag, reg, 0xffffffff); + mask = pci_conf_read(tag, reg); + pci_conf_write(tag, reg, old); + + /* Assume 4 byte reg, unless we find out otherwise below. */ + incr = 4; + + /* 0 if not implemented, all-1s if (for some reason) 2nd half + of 64-bit BAR or if device broken and reg not implemented + (should return 0). */ + if (mask == 0 || mask == 0xffffffff) + continue; + + if (_pciverbose >= 3) + pci_tagprintf (tag, "reg 0x%x = 0x%x\n", reg, mask); + + if (PCI_MAPREG_TYPE(mask) == PCI_MAPREG_TYPE_IO) { + + mask |= 0xffff0000; /* must be ones */ + + if (pciniowin >= pcimaxiowin) { + PRINTF ("pci: too many i/o windows\n"); + continue; + } + pi = &pciiowin[pciniowin++]; + + pi->dev = pd; + pi->reg = reg; + pi->size = -(PCI_MAPREG_IO_ADDR(mask)); + pd->niowin++; + } else { + switch (PCI_MAPREG_MEM_TYPE(mask)) { + case PCI_MAPREG_MEM_TYPE_32BIT: + case PCI_MAPREG_MEM_TYPE_32BIT_1M: + break; + case PCI_MAPREG_MEM_TYPE_64BIT: + incr = 8; + { + pcireg_t oldhi, maskhi; + + if (reg + 4 >= PCI_MAPREG_END) { + pci_tagprintf (tag, + "misplaced 64-bit region ignored\n"); + continue; + } + + oldhi = pci_conf_read(tag, reg + 4); + pci_conf_write(tag, reg + 4, 0xffffffff); + maskhi = pci_conf_read(tag, reg + 4); + pci_conf_write(tag, reg + 4, oldhi); + + if (maskhi != 0xffffffff) { + pci_tagprintf (tag, + "true 64-bit region (%08x) ignored\n", + maskhi); + continue; + } + } + break; + default: + pci_tagprintf (tag, "reserved mapping type 0x%x\n", + PCI_MAPREG_MEM_TYPE(mask)); + continue; + } + + if (!PCI_MAPREG_MEM_PREFETCHABLE(mask)) + _pci_bus[bus].prefetch = 0; + + if (pcinmemwin >= pcimaxmemwin) { + PRINTF ("pci: too many memory windows\n"); + continue; + } + pm = &pcimemwin[pcinmemwin++]; + + pm->dev = pd; + pm->reg = reg; + pm->size = -(PCI_MAPREG_MEM_ADDR(mask)); + pd->nmemwin++; + } + } + + /* Finally check for Expansion ROM */ + if (mapreg_rom != PCI_MAPREG_NONE) { + reg = mapreg_rom; + old = pci_conf_read(tag, reg); + pci_conf_write(tag, reg, 0xfffffffe); + mask = pci_conf_read(tag, reg); + pci_conf_write(tag, reg, old); + + /* 0 if not implemented, 0xfffffffe or 0xffffffff if device + broken and/or register not implemented. */ + if (mask != 0 && mask != 0xfffffffe && mask != 0xffffffff) { + if (_pciverbose >= 3) + pci_tagprintf (tag, "reg 0x%x = 0x%x\n", reg, mask); + + if (pcinmemwin >= pcimaxmemwin) { + PRINTF ("pci: too many memory windows\n"); + goto done; + } + + pm = &pcimemwin[pcinmemwin++]; + pm->dev = pd; + pm->reg = reg; + pm->size = -(PCI_MAPREG_ROM_ADDR(mask)); + pd->nmemwin++; + } + } + +done: + cmd |= PCI_COMMAND_INVALIDATE_ENABLE; /* any reason not to? */ + pci_conf_write(tag, PCI_COMMAND_STATUS_REG, cmd); +} + +static void +pci_query_dev (int bus, int device) +{ + pcitag_t tag; + pcireg_t bhlc; + int probed, function, maxfunc; + + tag = pci_make_tag(bus, device, 0); + if (!pci_canscan (tag)) + return; + + if (_pciverbose >= 2) + pci_bdfprintf (bus, device, -1, "probe..."); + + probed = pci_probe_tag(tag); + + if (_pciverbose >= 2) + PRINTF ("completed\n"); + + if (!probed) + return; + + bhlc = pci_conf_read(tag, PCI_BHLC_REG); + maxfunc = PCI_HDRTYPE_MULTIFN(bhlc) ? PCI_FUNCMAX : 0; + + for (function = 0; function <= maxfunc; function++) { + tag = pci_make_tag(bus, device, function); + if (pci_probe_tag(tag)) + pci_query_dev_func(tag); + } + + if (_pciverbose >= 2) + pci_bdfprintf (bus, device, -1, "done\n"); +} + + +static void +pci_query (int bus) +{ + int device; + struct pci_bus *pb = &_pci_bus[bus]; + pcireg_t sec_status; + unsigned int def_ltim, max_ltim; + + if (bus != 0) { + sec_status = pci_conf_read(pb->tag, PPB_IO_STATUS_REG); + pb->fast_b2b = (sec_status & PCI_STATUS_BACKTOBACK_SUPPORT) ? 1 : 0; + pb->freq66 = (sec_status & PCI_STATUS_66MHZ_SUPPORT) ? 1 : 0; + } + + if (pb->no_probe) + pb->ndev = 0; + else { + for (device = 0; device <= PCI_DEVMAX; device++) + pci_query_dev (bus, device); + } + + if (pb->ndev != 0) { + /* convert largest minimum grant time to cycle count */ + max_ltim = pb->min_gnt * (pb->freq66 ? 66 : 33) / 4; + + /* now see how much bandwidth is left to distribute */ + if (pb->bandwidth <= 0) { + pci_bdfprintf (bus, -1, -1, "warning: total bandwidth exceeded\n"); + def_ltim = 1; + } else { + /* calculate a fair share for each device */ + def_ltim = pb->bandwidth / pb->ndev; + if (def_ltim > pb->max_lat) + /* that would exceed critical time for some device */ + def_ltim = pb->max_lat; + /* convert to cycle count */ + def_ltim = def_ltim * (pb->freq66 ? 66 : 33) / 4; + } + /* most devices don't implement bottom three bits, so round up */ + def_ltim = (def_ltim + 7) & ~7; + max_ltim = (max_ltim + 7) & ~7; + + pb->def_ltim = MIN (def_ltim, 255); + pb->max_ltim = MIN (MAX (max_ltim, def_ltim), 255); + } +} + + +static int +wincompare (const void *a, const void *b) +{ + const struct pciwin *wa = a, *wb = b; + if (wa->dev->bus != wb->dev->bus) + /* sort into ascending order of bus number */ + return (int)(wa->dev->bus - wb->dev->bus); + else + /* sort into descending order of size */ + return (int)(wb->size - wa->size); +} + + +static pcireg_t +pci_allocate_io(pcitag_t tag, size_t size) +{ + pcireg_t address; + + /* allocate upwards after rounding to size boundary */ + address = (pciioaddr.next + (size - 1)) & ~(size - 1); + if (address < pciioaddr.next || address + size > pciioaddr.limit) + return -1; + pciioaddr.next = address + size; + return address; +} + +static pcireg_t +pci_align_io_addr(pcireg_t addr) +{ + /* align to appropriate bridge boundaries (4K for Rev 1.1 Bridge Arch). + Over/underflow will show up in subsequent allocations. */ + return (addr + ((1 << 12)-1)) & ~((1 << 12)-1); +} + +static void +pci_assign_iowins(int bus, struct pciwin *pi_first, struct pciwin *pi_limit) +{ + struct pciwin *pi; + struct pci_bus *pb = &_pci_bus[bus]; + pcireg_t t; /* for pushing writes */ + + pciioaddr.next = pci_align_io_addr(pciioaddr.next); + + /* Pass 1 errata work around. Avoid assigning any real devices + at the base address of the LDT host bridge. */ + if (bus == lhb_secondary_bus) { + pb->min_io_addr = pciioaddr.next; + pciioaddr.next += (1 << 12); + pb->max_io_addr = pciioaddr.next - 1; + } + + for (pi = pi_first; pi < pi_limit; pi++) { + struct pcidev *pd = pi->dev; + pcitag_t tag = pd->pa->pa_tag; + pcireg_t base; + + if (pd->niowin < 0) + continue; + pi->address = pci_allocate_io (tag, pi->size); + if (pi->address == -1) { + pci_tagprintf (tag, + "not enough PCI i/o space (%ld requested)\n", + (long)pi->size); + pd->nmemwin = pd->niowin = -1; + continue; + } + + if (pi->address < pb->min_io_addr) + pb->min_io_addr = pi->address; + if (pi->address + pi->size - 1 > pb->max_io_addr) + pb->max_io_addr = pi->address + pi->size - 1; + + if (_pciverbose >= 2) + pci_tagprintf (tag, + "I/O BAR at 0x%x gets %ld bytes @ 0x%x\n", + pi->reg, (long)pi->size, pi->address); + base = pci_conf_read(tag, pi->reg); + base = (base & ~PCI_MAPREG_IO_ADDR_MASK) | pi->address; + pci_conf_write(tag, pi->reg, base); + t = pci_conf_read(tag, pi->reg); + } + + if (pb->min_io_addr < pb->max_io_addr) { + /* if any io on bus, expand to valid bridge limit */ + pb->max_io_addr |= ((1 << 12)-1); + pciioaddr.next = pb->max_io_addr + 1; + } + + /* More Pass 1 errata work around. Make sure the 32 bytes beyond + the LDT window are not allocated by reserving an entire quantum + of io space. */ + if (bus == lhb_subordinate_bus) { + pciioaddr.next = pci_align_io_addr(pciioaddr.next) + (1 << 12); + } +} + +static void +pci_setup_iowins (void) +{ + struct pciwin *pi, *pi_first, *pi_limit; + int bus; + + qsort(pciiowin, pciniowin, sizeof(struct pciwin), wincompare); + pi_first = pciiowin; + pi_limit = &pciiowin[pciniowin]; + + for (bus = 0; bus < _pci_nbus; bus++) { + pi = pi_first; + while (pi != pi_limit && pi->dev->bus == bus) + pi++; + pci_assign_iowins(bus, pi_first, pi); + pi_first = pi; + } +} + + +static pcireg_t +pci_allocate_mem(pcitag_t tag, size_t size) +{ + pcireg_t address; + + /* allocate upwards after rounding to size boundary */ + address = (pcimemaddr.next + (size - 1)) & ~(size - 1); + if (address < pcimemaddr.next || address + size > pcimemaddr.limit) + return -1; + pcimemaddr.next = address + size; + return address; +} + +static pcireg_t +pci_align_mem_addr(pcireg_t addr) +{ + /* align to appropriate bridge boundaries (1M for Rev 1.1 Bridge Arch). + Over/underflow will show up in subsequent allocations. */ + return (addr + ((1 << 20)-1)) & ~((1 << 20)-1); +} + +static void +pci_assign_memwins(int bus, struct pciwin *pm_first, struct pciwin *pm_limit) +{ + struct pciwin *pm; + struct pci_bus *pb = &_pci_bus[bus]; + pcireg_t t; /* for pushing writes */ + + pcimemaddr.next = pci_align_mem_addr(pcimemaddr.next); + + /* Pass 1 errata work around. Avoid assigning any real devices + at the base address of the LDT host bridge. */ + if (bus == lhb_secondary_bus) { + pb->min_mem_addr = pcimemaddr.next; + pcimemaddr.next += (1 << 20); + pb->max_mem_addr = pcimemaddr.next - 1; + } + + for (pm = pm_first; pm < pm_limit; ++pm) { + struct pcidev *pd = pm->dev; + pcitag_t tag = pd->pa->pa_tag; + + if (pd->nmemwin < 0) + continue; + pm->address = pci_allocate_mem (tag, pm->size); + if (pm->address == -1) { + pci_tagprintf (tag, + "not enough PCI mem space (%ld requested)\n", + (long)pm->size); + pd->nmemwin = pd->niowin = -1; + continue; + } + if (_pciverbose >= 2) + pci_tagprintf (tag, + "%s BAR at 0x%x gets %ld bytes @ 0x%x\n", + pm->reg != PCI_MAPREG_ROM ? "MEM" : "ROM", + pm->reg, (long)pm->size, pm->address); + + if (pm->address < pb->min_mem_addr) + pb->min_mem_addr = pm->address; + if (pm->address + pm->size - 1 > pb->max_mem_addr) + pb->max_mem_addr = pm->address + pm->size - 1; + + if (pm->reg != PCI_MAPREG_ROM) { + /* normal memory - expansion rom done below */ + pcireg_t base = pci_conf_read(tag, pm->reg); + base = pm->address | (base & ~PCI_MAPREG_MEM_ADDR_MASK); + pci_conf_write(tag, pm->reg, base); + t = pci_conf_read(tag, pm->reg); + if (PCI_MAPREG_MEM_TYPE(t) == PCI_MAPREG_MEM_TYPE_64BIT) { + pci_conf_write(tag, pm->reg + 4, 0); + t = pci_conf_read(tag, pm->reg + 4); + } + } + } + + /* align final bus window */ + if (pb->min_mem_addr < pb->max_mem_addr) { + pb->max_mem_addr |= ((1 << 20) - 1); + pcimemaddr.next = pb->max_mem_addr + 1; + } + + /* More pass 1 errata work around. Make sure the next 32 bytes + beyond the LDT window are not used by reserving an entire + quantum of PCI memory space. */ + if (bus == lhb_subordinate_bus) { + pcimemaddr.next = pci_align_mem_addr(pcimemaddr.next) + (1 << 20); + } +} + +static void +pci_setup_memwins (void) +{ + struct pciwin *pm, *pm_first, *pm_limit; + int bus; + + qsort(pcimemwin, pcinmemwin, sizeof(struct pciwin), wincompare); + pm_first = pcimemwin; + pm_limit = &pcimemwin[pcinmemwin]; + + for (bus = 0; bus < _pci_nbus; bus++) { + pm = pm_first; + while (pm != pm_limit && pm->dev->bus == bus) + pm++; + pci_assign_memwins(bus, pm_first, pm); + pm_first = pm; + } + + /* Program expansion rom address base after normal memory base, + to keep DEC ethernet chip happy */ + for (pm = pcimemwin; pm < pm_limit; pm++) { + if (pm->reg == PCI_MAPREG_ROM && pm->address != -1) { + struct pcidev *pd = pm->dev; /* expansion rom */ + pcitag_t tag = pd->pa->pa_tag; + pcireg_t base; + pcireg_t t; /* for pushing writes */ + + /* Do not enable ROM at this time -- PCI spec 2.2 s6.2.5.2 last + paragraph, says that if the expansion ROM is enabled, accesses + to other registers via the BARs may not be done by portable + software!!! */ + base = pci_conf_read(tag, pm->reg); + base = pm->address | (base & ~PCI_MAPREG_ROM_ADDR_MASK); + base &= ~PCI_MAPREG_ROM_ENABLE; + pci_conf_write(tag, pm->reg, base); + t = pci_conf_read(tag, pm->reg); + } + } +} + + +static void +pci_setup_ppb(pci_flags_t flags) +{ + int i; + + for (i = _pci_nbus - 1; i > 0; i--) { + struct pci_bus *psec = &_pci_bus[i]; + struct pci_bus *ppri = &_pci_bus[psec->primary]; + if (ppri->min_io_addr > psec->min_io_addr) + ppri->min_io_addr = psec->min_io_addr; + if (ppri->max_io_addr < psec->max_io_addr) + ppri->max_io_addr = psec->max_io_addr; + if (ppri->min_mem_addr > psec->min_mem_addr) + ppri->min_mem_addr = psec->min_mem_addr; + if (ppri->max_mem_addr < psec->max_mem_addr) + ppri->max_mem_addr = psec->max_mem_addr; + } + + if (_pciverbose >= 2) { + struct pci_bus *pb = &_pci_bus[0]; + if (pb->min_io_addr < pb->max_io_addr) + pci_bdfprintf (0, -1, -1, "io 0x%08x-0x%08x\n", + pb->min_io_addr, pb->max_io_addr); + if (pb->min_mem_addr < pb->max_mem_addr) + pci_bdfprintf (0, -1, -1, "mem 0x%08x-0x%08x\n", + pb->min_mem_addr, pb->max_mem_addr); + } + + for (i = 1; i < _pci_nbus; i++) { + struct pci_bus *pb = &_pci_bus[i]; + pcireg_t cmd; + pcireg_t iodata, memdata; + pcireg_t brctl; + pcireg_t t; /* for pushing writes */ + + cmd = pci_conf_read(pb->tag, PCI_COMMAND_STATUS_REG); + if (_pciverbose >= 2) + pci_bdfprintf (i, -1, -1, "subordinate to bus %d\n", pb->primary); + + cmd |= PCI_COMMAND_MASTER_ENABLE; + if (pb->min_io_addr < pb->max_io_addr) { + uint32_t io_limit; + + /* Pass 1 work-round: limits are next free, not last used. */ + io_limit = pb->max_io_addr; + if (i == lhb_secondary_bus) + io_limit++; + + cmd |= PCI_COMMAND_IO_ENABLE; + if (_pciverbose >= 2) + pci_bdfprintf (i, -1, -1, "io 0x%08x-0x%08x\n", + pb->min_io_addr, io_limit); + iodata = pci_conf_read(pb->tag, PPB_IO_STATUS_REG); + if ((iodata & PPB_IO_ADDR_CAP_MASK) == PPB_IO_ADDR_CAP_32) { + pcireg_t upperdata; + + upperdata = ((pb->min_io_addr) >> 16) & PPB_IO_UPPER_BASE_MASK; + upperdata |= (io_limit & PPB_IO_UPPER_LIMIT_MASK); + pci_conf_write(pb->tag, PPB_IO_UPPER_REG, upperdata); + } + iodata = (iodata & ~PPB_IO_BASE_MASK) + | ((pb->min_io_addr >> 8) & 0xf0); + iodata = (iodata & ~PPB_IO_LIMIT_MASK) + | ((io_limit & PPB_IO_LIMIT_MASK) & 0xf000); + } else { + /* Force an empty window */ + iodata = pci_conf_read(pb->tag, PPB_IO_STATUS_REG); + iodata &=~ (PPB_IO_BASE_MASK | PPB_IO_LIMIT_MASK); + iodata |= (1 << 4) | (0 << (8+4)); + } + pci_conf_write(pb->tag, PPB_IO_STATUS_REG, iodata); + /* Push the write (see SB-1250 Errata, Section 8.10) */ + t = pci_conf_read(pb->tag, PPB_IO_STATUS_REG); + + if (pb->min_mem_addr < pb->max_mem_addr) { + uint32_t mem_limit; + + /* SB-1250 pass 1 workaround: limit is next free, not last used */ + mem_limit = pb->max_mem_addr; + if (i == lhb_secondary_bus) + mem_limit++; + + cmd |= PCI_COMMAND_MEM_ENABLE; + if (_pciverbose >= 2) + pci_bdfprintf (i, -1, -1, "mem 0x%08x-0x%08x\n", + pb->min_mem_addr, mem_limit); + memdata = pci_conf_read(pb->tag, PPB_MEM_REG); + memdata = (memdata & ~PPB_MEM_BASE_MASK) + | ((pb->min_mem_addr >> 16) & 0xfff0); + memdata = (memdata & ~PPB_MEM_LIMIT_MASK) + | ((mem_limit & PPB_MEM_LIMIT_MASK) & 0xfff00000); + } else { + /* Force an empty window */ + memdata = pci_conf_read(pb->tag, PPB_MEM_REG); + memdata &=~ (PPB_MEM_BASE_MASK | PPB_MEM_LIMIT_MASK); + memdata |= (1 << 4) | (0 << (16+4)); + } + pci_conf_write(pb->tag, PPB_MEM_REG, memdata); + /* Push the write (see SB-1250 Errata, Section 8.10) */ + t = pci_conf_read(pb->tag, PPB_MEM_REG); + + /* Force an empty prefetchable memory window */ + memdata = pci_conf_read(pb->tag, PPB_PREFMEM_REG); + memdata &=~ (PPB_MEM_BASE_MASK | PPB_MEM_LIMIT_MASK); + memdata |= (1 << 4) | (0 << (16+4)); + pci_conf_write(pb->tag, PPB_PREFMEM_REG, memdata); + /* Push the write (see SB-1250 Errata, Section 8.10) */ + t = pci_conf_read(pb->tag, PPB_PREFMEM_REG); + + /* Do any final bridge dependent initialization */ + pci_bridge_setup(pb->tag, flags); + + brctl = pci_conf_read(pb->tag, PPB_BRCTL_INTERRUPT_REG); +#ifdef _SB1250_PASS2_ + /* LDT MasterAborts _will_ cause bus errors in pass 2 when + enabled. Pending negotiations with clients, leave + MasterAbortMode off to disable their propagation. */ +#else + brctl |= (PPB_BRCTL_SERR_ENABLE | PPB_BRCTL_MASTER_ABORT_MODE); +#endif + if (pb->fast_b2b) + brctl |= PPB_BRCTL_BACKTOBACK_ENABLE; + pci_conf_write(pb->tag, PPB_BRCTL_INTERRUPT_REG, brctl); + t = pci_conf_read(pb->tag, PPB_BRCTL_INTERRUPT_REG); /* push */ + + pci_conf_write(pb->tag, PCI_COMMAND_STATUS_REG, cmd); + } +} + + +int +pci_cacheline_log2 (void) +{ + /* default to 8 words == 2^3 */ + return 3; +} + + +int +pci_maxburst_log2 (void) +{ + return 32; /* no limit */ +} + +static void +pci_setup_devices (pci_flags_t flags) +{ + struct pcidev *pd; + + /* Enable each PCI interface */ + for (pd = pcidev; pd < &pcidev[pcindev]; pd++) { + struct pci_bus *pb = &_pci_bus[pd->bus]; + pcitag_t tag = pd->pa->pa_tag; + pcireg_t cmd, misc; + unsigned int ltim; + + /* Consider setting interrupt line here */ + + cmd = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); + cmd |= PCI_COMMAND_MASTER_ENABLE + | PCI_COMMAND_SERR_ENABLE + | PCI_COMMAND_PARITY_ENABLE; + /* Always enable i/o & memory space, in case this card is + just snarfing space from the fixed ISA block and doesn't + declare separate PCI space. */ + cmd |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE; + if (pb->fast_b2b) + cmd |= PCI_COMMAND_BACKTOBACK_ENABLE; + + /* Write status too, to clear any pending error bits. */ + pci_conf_write(tag, PCI_COMMAND_STATUS_REG, cmd); + + ltim = pd->min_gnt * (pb->freq66 ? 66 : 33) / 4; + ltim = MIN (MAX (pb->def_ltim, ltim), pb->max_ltim); + + misc = pci_conf_read (tag, PCI_BHLC_REG); + PCI_LATTIMER_SET (misc, ltim); + PCI_CACHELINE_SET (misc, 1 << pci_cacheline_log2()); + pci_conf_write (tag, PCI_BHLC_REG, misc); + + pci_device_setup (tag); /* hook for post setup */ + } +} + + +void +pci_configure (pci_flags_t flags) +{ + int bus; + +#if (PCI_DEBUG > 1) + _pciverbose = 3; +#else + _pciverbose = (flags & PCI_FLG_VERBOSE); +#endif + _pci_devinfo_func = (_pciverbose != 0) ? pci_devinfo : NULL; + pciarg = NULL; + + /* SB-1250 pass 1 workaround: discover LHB buses during traversal. */ + lhb_secondary_bus = lhb_subordinate_bus = -1; + + /* initialise the host bridge(s) */ + SBD_DISPLAY ("PCIH"); + if (pci_hwinit(flags) < 0) + return; + + /* initialise any PCI-PCI bridges, discover and number buses */ + SBD_DISPLAY ("PCIB"); + pcindev = 0; + pci_businit(0, flags); + + /* scan configuration space of all devices to collect attributes */ + SBD_DISPLAY ("PCIS"); + pcimaxdev = pcindev; + pciarg = (struct pci_attach_args *) KMALLOC (pcimaxdev * sizeof(struct pci_attach_args), 0); + if (pciarg == NULL) { + PRINTF ("pci: no memory for device table\n"); + pcimaxdev = 0; + } else { + pcidev = (struct pcidev *) KMALLOC (pcimaxdev * sizeof(struct pcidev), 0); + if (pcidev == NULL) { + KFREE (pciarg); pciarg = NULL; + PRINTF ("pci: no memory for device attribute table\n"); + pcimaxdev = 0; + } + } + pcindev = 0; + + pcimaxmemwin = PCIMAX_DEV * PCIMAX_MEMWIN; + pcimemwin = (struct pciwin *) KMALLOC (pcimaxmemwin * sizeof(struct pciwin), 0); + if (pcimemwin == NULL) { + PRINTF ("pci: no memory for window table\n"); + pcimaxmemwin = 0; + } + pcimaxiowin = PCIMAX_DEV * PCIMAX_IOWIN; + pciiowin = (struct pciwin *) KMALLOC (pcimaxiowin * sizeof(struct pciwin), 0); + if (pciiowin == NULL) { + PRINTF ("pci: no memory for window table\n"); + pcimaxiowin = 0; + } + + pcinmemwin = pciniowin = 0; + for (bus = 0; bus < _pci_nbus; bus++) { + pci_query (bus); + } + + if (pcindev != pcimaxdev) { + panic ("Inconsistent device count\n"); + return; + } + + /* alter PCI bridge parameters based on query data */ + pci_hwreinit (flags); + + /* setup the individual device windows */ + pcimemaddr.base = minpcimemaddr; + pcimemaddr.limit = maxpcimemaddr; + pciioaddr.base = minpciioaddr; + pciioaddr.limit = maxpciioaddr; + + pcimemaddr.next = pcimemaddr.base; + pciioaddr.next = pciioaddr.base; + pci_setup_iowins (); + pci_setup_memwins (); + + /* set up and enable each device */ + if (_pci_nbus > 1) + pci_setup_ppb (flags); + pci_setup_devices (flags); + + KFREE (pciiowin); pciiowin = NULL; + KFREE (pcimemwin); pcimemwin = NULL; + KFREE (pcidev); pcidev = NULL; + + _pci_enumerated = 1; +} + + +int +pci_foreachdev(int (*fn)(pcitag_t tag)) +{ + int i, rv; + + for (i = 0, rv = 0; i < pcindev && rv == 0; i++) + rv = (*fn)(pciarg[i].pa_tag); + + return rv; +} + + +static int +dump_configuration(pcitag_t tag) +{ + pci_tagprintf(tag, "dump of "); + pci_conf_print(tag); + return 0; +} + +void +pci_show_configuration(void) +{ + pci_foreachdev(dump_configuration); +} + +int +pci_find_class(uint32_t class, int enumidx, pcitag_t *tag) +{ + int i; + struct pci_attach_args *thisdev; + + thisdev = pciarg; + for (i = 0; i < pcindev && enumidx >= 0; i++) { + if (PCI_CLASS(thisdev->pa_class) == class) { + if (enumidx == 0) { + *tag = thisdev->pa_tag; + return 0; + } else { + enumidx--; + } + } + thisdev++; + } + + return -1; +} + +int +pci_find_device(uint32_t vid, uint32_t did, int enumidx, pcitag_t *tag) +{ + int i; + struct pci_attach_args *thisdev; + + thisdev = pciarg; + for (i = 0; i < pcindev && enumidx >= 0; i++) { + if ((PCI_VENDOR(thisdev->pa_id) == vid) && + (PCI_PRODUCT(thisdev->pa_id) == did)) { + if (enumidx == 0) { + *tag = thisdev->pa_tag; + return 0; + } else { + enumidx--; + } + } + thisdev++; + } + + return -1; +} diff --git a/cfe/cfe/pci/pcidevs b/cfe/cfe/pci/pcidevs new file mode 100644 index 0000000..65b03ab --- /dev/null +++ b/cfe/cfe/pci/pcidevs @@ -0,0 +1,1355 @@ +$pcidevs 2002/09/03 broadcom $ + +/* + * Copyright (c) 1995, 1996 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * NOTE: a fairly complete list of PCI codes can be found at: + * + * http://members.hyperlink.net.au/~chart/pci.htm + * + * which replaces the database found at + * + * http://www.yourvote.com/pci/ + * + * (but it doesn't always seem to match vendor documentation) + */ + +/* + * List of known PCI vendors. This list has been trimmed to include + * only vendors with products appearing in the lists below. + */ + +vendor COMPAQ 0x0e11 Compaq +vendor SYMBIOS 0x1000 Symbios Logic +vendor ATI 0x1002 ATI Technologies +vendor ULSI 0x1003 ULSI Systems +vendor VLSI 0x1004 VLSI Technology +vendor AVANCE 0x1005 Avance Logic +vendor NS 0x100b National Semiconductor +vendor TSENG 0x100c Tseng Labs +vendor WEITEK 0x100e Weitek +vendor DEC 0x1011 Digital Equipment +vendor CIRRUS 0x1013 Cirrus Logic +vendor IBM 0x1014 IBM +vendor WD 0x101c Western Digital +vendor AMD 0x1022 Advanced Micro Devices +vendor TRIDENT 0x1023 Trident Microsystems +vendor ACER 0x1025 Acer +vendor MATROX 0x102b Matrox +vendor CHIPS 0x102c Chips and Technologies +vendor TOSHIBA 0x102f Toshiba America +vendor NEC 0x1033 NEC +vendor FUTUREDOMAIN 0x1036 Future Domain +vendor SIS 0x1039 Silicon Integrated System +vendor HP 0x103c Hewlett-Packard +vendor PCTECH 0x1042 PC Technology +vendor DPT 0x1044 Distributed Processing Technology +vendor OPTI 0x1045 Opti +vendor ELSA 0x1048 Elsa +vendor SGSTHOMSON 0x104a SGS Thomson Microelectric +vendor BUSLOGIC 0x104b BusLogic +vendor TI 0x104c Texas Instruments +vendor SONY 0x104d Sony +vendor OAKTECH 0x104e Oak Technology +vendor WINBOND 0x1050 Winbond Electronics +vendor MOT 0x1057 Motorola +vendor PROMISE 0x105a Promise Technology +vendor NUMBER9 0x105d Number 9 Computer Company +vendor UMC 0x1060 United Microelectronics +vendor ITT 0x1061 I. T. T. +vendor MYLEX 0x1069 Mylex +vendor APPLE 0x106b Apple Computer +vendor YAMAHA 0x1073 Yamaha +vendor NEXGEN 0x1074 NexGen Microsystems +vendor QLOGIC 0x1077 Q Logic +vendor LEADTEK 0x107d LeadTek Research +vendor CONTAQ 0x1080 Contaq Microsystems +vendor BIT3 0x108a Bit3 Computer Corp. +vendor OLICOM 0x108d Olicom +vendor SUN 0x108e Sun Microsystems +vendor INTERGRAPH 0x1091 Intergraph +vendor DIAMOND 0x1092 Diamond Computer Systems +vendor CMDTECH 0x1095 CMD Technology +vendor QUANTUMDESIGNS 0x1098 Quantum Designs +vendor BROOKTREE 0x109e Brooktree +vendor SGI 0x10a9 Silicon Graphics +vendor ACC 0x10aa ACC Microelectronics +vendor SYMPHONY 0x10ad Symphony Labs +vendor PLX 0x10b5 PLX Technology +vendor MADGE 0x10b6 Madge Networks +vendor 3COM 0x10B7 3Com +vendor SMC 0x10b8 Standard Microsystems +vendor ALI 0x10b9 Acer Labs +vendor SURECOM 0x10bd Surecom Technology +vendor SAMSUNGSEMI 0x10c3 Samsung Semiconductors +vendor NEOMAGIC 0x10c8 Neomagic +vendor ADVSYS 0x10cd Advanced System Products +vendor MACRONIX 0x10d9 Macronix +vendor ES 0x10dd Evans & Sutherland +vendor NVIDIA 0x10de Nvidia Corporation +vendor EMULEX 0x10df Emulex +vendor IMS 0x10e0 Integrated Micro Solutions +vendor TEKRAM 0x10e1 Tekram Technology (1st PCI Vendor ID) +vendor NEWBRIDGE 0x10e3 Newbridge Microsystems / Tundra Semiconductor +vendor AMCIRCUITS 0x10e8 Applied Micro Circuits +vendor REALTEK 0x10ec Realtek Semiconductor +vendor NKK 0x10f5 NKK Corporation +vendor INITIO 0x1101 Initio +vendor CREATIVELABS 0x1102 Creative Labs +vendor TRIONES 0x1103 Triones Technologies +vendor SIGMA 0x1105 Sigma Designs +vendor VIATECH 0x1106 VIA Technologies +vendor COGENT 0x1109 Cogent Data Technologies +vendor RNS 0x1112 RNS +vendor ACCTON 0x1113 Accton Technology +vendor VORTEX 0x1119 Vortex Computer Systems +vendor EFFICIENTNETS 0x111a Efficent Networks +vendor IDT 0x111d IDT +vendor FORE 0x1127 FORE Systems +vendor ZIATECH 0x1138 Ziatech +vendor ALLIANCE 0x1142 Alliance Semiconductor +vendor SCHNEIDERKOCH 0x1148 Schneider & Koch +vendor MUTECH 0x1159 Mutech +vendor XIRCOM 0x115d Xircom +vendor ALTERA 0x1172 Altera Corporation +vendor TOSHIBA2 0x1179 Toshiba America Info Systems +vendor RICOH 0x1180 Ricoh +vendor DLINK 0x1186 D-Link Systems +vendor COROLLARY 0x118c Corrollary +vendor ACARD 0x1191 Acard +vendor ZEINET 0x1193 Zeinet +vendor GALILEO 0x11ab Galileo Technology +vendor LITEON 0x11ad Lite-On Communications +vendor V3 0x11b0 V3 Semiconductor +vendor LUCENT 0x11c1 AT&T Microelectronics +vendor DOLPHIN 0x11c8 Dolphin Interconnect Solutions +vendor AURAVISION 0x11d1 Auravision +vendor ZORAN 0x11de Zoran Corporation +vendor COMPEX 0x11f6 Compex +vendor PMCSIERRA 0x11f8 PMC-Sierra +vendor CYCLADES 0x120e Cyclades +vendor ESSENTIAL 0x120f Essential Communications +vendor O2MICRO 0x1217 O2 Micro Inc +vendor 3DFX 0x121a 3Dfx Interactive +vendor CCUBE 0x123f C-Cube Microsystems +vendor AVM 0x1244 AVM +vendor LINEARSYS 0x1254 Linear Systems +vendor ASIX 0x125b ASIX Electronics +vendor ESSTECH 0x125d ESS Technology Inc +vendor SILMOTION 0x126f Silicon Motion +vendor ENSONIQ 0x1274 Ensoniq +vendor DAVICOM 0x1282 Davicom Semiconductor +vendor ESSTECH2 0x1285 ESS Technology Inc +vendor TRITECH 0x1292 TriTech Microelectronics +vendor ALTEON 0x12ae Alteon +vendor RISCOM 0x12aa RISCom +vendor USR 0x12b9 US Robotics (3Com) +vendor NVIDIA_SGS 0x12d2 Nvidia Corporation & SGS Thomson Microelectric +vendor AUREAL 0x12eb Aureal Semiconductor +vendor ADMTEK 0x1317 ADMtek +vendor FORTEMEDIA 0x1319 Forte Media +vendor DOMEX 0x134a Domex +vendor LMC 0x1376 LAN Media Corporation +vendor API 0x14d9 API Networks +vendor CONEXANT 0x14f1 Conexant Systems +vendor NETGEAR 0x1385 Netgear +vendor 3WARE 0x13c1 3ware +vendor SUNDANCETI 0x13f0 Sundance Technology +vendor CMEDIA 0x13f6 C-Media Electronics Inc +vendor DELTA 0x1500 Delta Electronics +vendor SOLIDUM 0x1588 Solidum Systems Corp. +vendor SIBYTE 0x166d SiByte, Inc. +vendor SYMPHONY2 0x1c1c Symphony Labs (2nd PCI Vendor ID) +vendor TEKRAM2 0x1de1 Tekram Technology (2nd PCI Vendor ID) +vendor BROADCOM 0x14e4 Broadcom +vendor 3DLABS 0x3d3d 3D Labs +vendor AVANCE2 0x4005 Avance Logic (2nd PCI Vendor ID) +vendor ADDTRON 0x4033 Addtron Technology +vendor NETVIN 0x4a14 NetVin +vendor S3 0x5333 S3 +vendor C4T 0x6374 c't Magazin +vendor INTEL 0x8086 Intel +vendor PROLAN 0x8c4a ProLAN +vendor KTI 0x8e2e KTI +vendor ADP 0x9004 Adaptec +vendor ADP2 0x9005 Adaptec (2nd PCI Vendor ID) +vendor ATRONICS 0x907f Atronics +vendor ARC 0xedd8 ARC Logic +vendor EPIGRAM 0xfeda Epigram +vendor INVALID 0xffff INVALID VENDOR ID + +/* + * List of known products. Grouped by vendor. + */ + +/* 3COM Products */ +product 3COM 3C985 0x0001 3c985 Gigabit Ethernet +product 3COM 3C590 0x5900 3c590 Ethernet +product 3COM 3C595TX 0x5950 3c595-TX 10/100 Ethernet +product 3COM 3C595T4 0x5951 3c595-T4 10/100 Ethernet +product 3COM 3C595MII 0x5952 3c595-MII 10/100 Ethernet +product 3COM 3C900TPO 0x9000 3c900-TPO Ethernet +product 3COM 3C900COMBO 0x9001 3c900-COMBO Ethernet +product 3COM 3C905TX 0x9050 3c905-TX 10/100 Ethernet +product 3COM 3C905T4 0x9051 3c905-T4 10/100 Ethernet +product 3COM 3C900BTPO 0x9004 3c900B-TPO Ethernet +product 3COM 3C900BCOMBO 0x9005 3c900B-COMBO Ethernet +product 3COM 3C900BTPC 0x9006 3c900B-TPC Ethernet +product 3COM 3C905BTX 0x9055 3c905B-TX 10/100 Ethernet +product 3COM 3C905BT4 0x9056 3c905B-T4 10/100 Ethernet +product 3COM 3C905BCOMBO 0x9058 3c905B-COMBO 10/100 Ethernet +product 3COM 3C905BFX 0x905a 3c905B-FX 100 Ethernet +product 3COM 3C905CTX 0x9200 3c905C-TX 10/100 Ethernet with mngmt +product 3COM 3C980SRV 0x9800 3c980 Server Adapter 10/100 Ethernet +product 3COM 3C980CTXM 0x9805 3c980C-TXM 10/100 Ethernet +product 3COM 3CR990TX97 0x9903 3CR990-TX-97 10/100 Ethernet + +/* 3Dfx Interactive producs */ +product 3DFX VOODOO 0x0001 Voodoo +product 3DFX VOODOO2 0x0002 Voodoo2 +product 3DFX BANSHEE 0x0003 Banshee +product 3DFX VOODOO3 0x0005 Voodoo3 + +/* 3D Labs products */ +product 3DLABS 300SX 0x0001 GLINT 300SX +product 3DLABS 500TX 0x0002 GLINT 500TX +product 3DLABS DELTA 0x0003 GLINT DELTA +product 3DLABS PERMEDIA 0x0004 GLINT Permedia +product 3DLABS 500MX 0x0006 GLINT 500MX +product 3DLABS PERMEDI2 0x0007 GLINT Permedia 2 + +/* 3ware products */ +product 3WARE ESCALADE 0x1000 Escalade IDE RAID + +/* ACC Products */ +product ACC 2188 0x0000 ACCM 2188 VL-PCI Bridge +product ACC 2051_HB 0x2051 2051 PCI Single Chip Solution (host bridge) +product ACC 2051_ISA 0x5842 2051 PCI Single Chip Solution (ISA bridge) + +/* Acard products */ +product ACARD AEC6710 0x8002 AEC6710 SCSI +product ACARD AEC6712UW 0x8010 AEC6712UW SCSI +product ACARD AEC6712U 0x8020 AEC6712U SCSI +product ACARD AEC6712S 0x8030 AEC6712S SCSI +product ACARD AEC6710D 0x8040 AEC6710D SCSI +product ACARD AEC6715UW 0x8050 AEC6715UW SCSI + +/* Accton products */ +product ACCTON MPX5030 0x1211 MPX 5030/5038 Ethernet + +/* Acer products */ +product ACER M1435 0x1435 M1435 VL-PCI Bridge + +/* Acer Labs products */ +product ALI M1445 0x1445 M1445 VL-PCI Bridge +product ALI M1449 0x1449 M1449 PCI-ISA Bridge +product ALI M1451 0x1451 M1451 Host-PCI Bridge +product ALI M1461 0x1461 M1461 Host-PCI Bridge +product ALI M1531 0x1531 M1531 Host-PCI Bridge +product ALI M1541 0x1541 M1541 Host-PCI Bridge +product ALI M1543 0x1533 M1543 PCI-ISA Bridge +product ALI M3309 0x3309 M3309 MPEG Decoder +product ALI M4803 0x5215 M4803 +product ALI M5229 0x5229 M5229 UDMA IDE Controller +product ALI M5237 0x5237 M5237 USB Host Controller +product ALI M7101 0x7101 M7101 Power Management Controller + +/* Adaptec products */ +product ADP AIC7850 0x5078 AIC-7850 +product ADP AIC7855 0x5578 AIC-7855 +product ADP AIC5900 0x5900 AIC-5900 ATM +product ADP AIC5905 0x5905 AIC-5905 ATM +product ADP AIC6915 0x6915 AIC-6915 10/100 Ethernet +product ADP AIC7860 0x6078 AIC-7860 +product ADP APA1480 0x6075 APA-1480 Ultra +product ADP 2940AU 0x6178 AHA-2940A Ultra +product ADP AIC7870 0x7078 AIC-7870 +product ADP 2940 0x7178 AHA-2940 +product ADP 3940 0x7278 AHA-3940 +product ADP 3985 0x7378 AHA-3985 +product ADP 2944 0x7478 AHA-2944 +product ADP AIC7895 0x7895 AIC-7895 Ultra +product ADP AIC7880 0x8078 AIC-7880 Ultra +product ADP 2940U 0x8178 AHA-2940 Ultra +product ADP 3940U 0x8278 AHA-3940 Ultra +product ADP 389XU 0x8378 AHA-389X Ultra +product ADP 2944U 0x8478 AHA-2944 Ultra +product ADP 2940UP 0x8778 AHA-2940 Ultra Pro + +product ADP2 2940U2 0x0010 AHA-2940 Ultra2 +product ADP2 2930U2 0x0011 AHA-2930 Ultra2 +product ADP2 AIC7890 0x001f AIC-7890/1 +product ADP2 3950U2B 0x0050 AHA-3950 Ultra2 +product ADP2 3950U2D 0x0051 AHA-3950 Ultra2 +product ADP2 AIC7896 0x005f AIC-7896/7 + +/* Addtron Products */ +product ADDTRON 8139 0x1360 8139 Ethernet + +/* ADMtek products */ +product ADMTEK AL981 0x0981 ADMtek AL981 10/100 Ethernet + +/* Advanced System Products */ +product ADVSYS 1200A 0x1100 +product ADVSYS 1200B 0x1200 +product ADVSYS ULTRA 0x1300 ABP-930/40UA +product ADVSYS WIDE 0x2300 ABP-940UW +product ADVSYS U2W 0x2500 ASB-3940U2W +product ADVSYS U3W 0x2700 ASB-3940U3W + +/* Alliance products */ +product ALLIANCE AT24 0x6424 AT24 +product ALLIANCE AT25 0x643d AT25 + +/* Alteon products */ +product ALTEON ACENIC 0x0001 ACEnic Gigabit Ethernet + +/* AMD products */ +product AMD PCNET_PCI 0x2000 79c970 PCnet-PCI LANCE Ethernet +product AMD PCNET_HOME 0x2001 79c978 PCnet-PCI Home +product AMD PCSCSI_PCI 0x2020 53c974 PCscsi-PCI SCSI +product AMD PCNETS_PCI 0x2040 79C974 PCnet-PCI Ethernet & SCSI +product AMD SC751_SC 0x7006 AMD751 System Controller +product AMD SC751_PPB 0x7007 AMD751 PCI-to-PCI Bridge +product AMD PBC756_ISA 0x7408 AMD756 PCI-to-ISA Bridge +product AMD PBC756_IDE 0x7409 AMD756 IDE controller +product AMD PBC756_PMC 0x740B AMD756 Power Management Controller +product AMD PBC756_USB 0x740C AMD756 USB Host Controller +product AMD HT7520 0x7450 (PLX) HT7520 PCIX Tunnel +product AMD HT7520_PIC 0x7451 (PLX) HT7520 PCIX IOAPIC +product AMD AMD8151_AGP 0x7454 AMD8151 AGP Device +product AMD AMD8151 0x7455 AMD8151 HyperTransport-AGP Bridge + +/* API Networks products */ +product API STURGEON 0x0010 AP1011 HyperTransport-PCI Bridge + +/* Apple products */ +product APPLE BANDIT 0x0001 Bandit Host-PCI Bridge +product APPLE GC 0x0002 Grand Central I/O Controller +product APPLE CONTROL 0x0003 Control +product APPLE PLANB 0x0004 PlanB +product APPLE OHARE 0x0007 OHare I/O Controller +product APPLE BANDIT2 0x0008 Bandit Host-PCI Bridge +product APPLE HEATHROW 0x0010 MAC-IO I/O Controller (Heathrow) +product APPLE PADDINGTON 0x0017 MAC-IO I/O Controller (Paddington) +product APPLE KEYLARGO_USB 0x0019 KeyLargo USB Controller +product APPLE UNINORTH1 0x001e UniNorth Host-PCI Bridge +product APPLE UNINORTH2 0x001f UniNorth Host-PCI Bridge +product APPLE UNINORTH_AGP 0x0020 UniNorth AGP Interface +product APPLE GMAC 0x0021 GMAC Ethernet +product APPLE KEYLARGO 0x0022 MAC-IO I/O Controller (KeyLargo) + +/* ARC Logic products */ +product ARC 1000PV 0xa091 1000PV +product ARC 2000PV 0xa099 2000PV +product ARC 2000MT 0xa0a1 2000MT + +/* ASIX Electronics products */ +product ASIX AX88140A 0x1400 AX88140A 10/100 Ethernet + +/* ATI products */ +product ATI MACH32 0x4158 Mach32 +product ATI MACH64_CT 0x4354 Mach64 CT +product ATI MACH64_CX 0x4358 Mach64 CX +product ATI MACH64_ET 0x4554 Mach64 ET +product ATI MACH64_VT 0x4654 Mach64 VT +product ATI MACH64_B 0x4750 Mach64 B +product ATI MACH64_GB 0x4742 Mach64 GB +product ATI MACH64_GD 0x4744 Mach64 GD +product ATI MACH64_GI 0x4749 Mach64 GI +product ATI MACH64_GP 0x4750 Mach64 GP +product ATI MACH64_GQ 0x4751 Mach64 GQ +product ATI MACH64_GT 0x4754 Mach64 GT +product ATI MACH64_GU 0x4755 Mach64 GU +product ATI MACH64_GV 0x4756 Mach64 GV +product ATI MACH64_GW 0x4757 Mach64 GW +product ATI MACH64_GX 0x4758 Mach64 GX +product ATI MACH64_GZ 0x475a Mach64 GZ +product ATI MACH64_LB 0x4c42 Mach64 LB +product ATI MACH64_LD 0x4c44 Mach64 LD +product ATI MACH64_LG 0x4c47 Mach64 LG +product ATI MACH64_LI 0x4c49 Mach64 LI +product ATI MACH64_LM 0x4c4d Mach64 LM +product ATI MACH64_LP 0x4c50 Mach64 LP +product ATI MACH64_LR 0x4c52 Mach64 LR + +/* Auravision products */ +product AURAVISION VXP524 0x01f7 VxP524 PCI Video Processor + +/* Aureal Semiconductor */ +product AUREAL AU8820 0x0001 AU8820 Vortex Digital Audio Processor + +/* Applied Micro Circuts products */ +product AMCIRCUITS S5933 0x4750 S5933 PCI Matchmaker +product AMCIRCUITS LANAI 0x8043 Myrinet LANai Interface +product AMCIRCUITS S5920 0x5920 S5920 PCI Target + +/* Atronics products */ +product ATRONICS IDE_2015PL 0x2015 IDE-2015PL + +/* Avance Logic products */ +product AVANCE AVL2301 0x2301 AVL2301 +product AVANCE AVG2302 0x2302 AVG2302 +product AVANCE2 ALG2301 0x2301 ALG2301 +product AVANCE2 ALG2302 0x2302 ALG2302 + +/* CCUBE products */ +product CCUBE CINEMASTER 0x8888 Cinemaster C 3.0 DVD Decoder + +/* AVM products */ +product AVM FRITZ_CARD 0x0a00 Fritz! Card ISDN Interface + +/* Bit3 products */ +product BIT3 PCIVME617 0x0001 PCI-VME Interface Mod. 617 +product BIT3 PCIVME618 0x0010 PCI-VME Interface Mod. 618 +product BIT3 PCIVME2706 0x0300 PCI-VME Interface Mod. 2706 + +/* Broadcom products */ +product BROADCOM BCM4211 0x4211 BCM4211 iLine10 Controller +product BROADCOM BCM4212 0x4212 BCM4212 V.90 Modem +product BROADCOM BCM5700 0x1644 BCM5700 10/100/1000 Ethernet +product BROADCOM BCM5701 0x1645 BCM5701 10/100/1000 Ethernet +product BROADCOM BCM5702 0x16a6 BCM5702 10/100/1000 Ethernet +product BROADCOM BCM5703 0x16a7 BCM5703 10/100/1000 Ethernet +product BROADCOM BCM5705 0x1653 BCM5705 10/100/1000 Ethernet +product BROADCOM BCM5820 0x5820 BCM5820 eCommerce Processor +product BROADCOM BCM5821 0x5821 BCM5821 Super-eCommerce Processor +product BROADCOM BCM5850 0x5850 BCM5850 SSL/TLS Protocol Processor + +/* Brooktree products */ +product BROOKTREE BT848 0x0350 Bt848 Video Capture +product BROOKTREE BT849 0x0351 Bt849 Video Capture +product BROOKTREE BT878 0x036e Bt878 Video Capture +product BROOKTREE BT879 0x036f Bt879 Video Capture + +/* BusLogic products */ +product BUSLOGIC MULTIMASTER_NC 0x0140 MultiMaster NC +product BUSLOGIC MULTIMASTER 0x1040 MultiMaster +product BUSLOGIC FLASHPOINT 0x8130 FlashPoint + +/* c't Magazin products */ +product C4T GPPCI 0x6773 GPPCI + +/* Chips and Technologies products */ +product CHIPS 64310 0x00b8 64310 +product CHIPS 65545 0x00d8 65545 +product CHIPS 65548 0x00dc 65548 +product CHIPS 65550 0x00e0 65550 +product CHIPS 65554 0x00e4 65554 + +/* Cirrus Logic products */ +product CIRRUS CL_GD7548 0x0038 CL-GD7548 +product CIRRUS CL_GD5430 0x00a0 CL-GD5430 +product CIRRUS CL_GD5434_4 0x00a4 CL-GD5434-4 +product CIRRUS CL_GD5434_8 0x00a8 CL-GD5434-8 +product CIRRUS CL_GD5436 0x00ac CL-GD5436 +product CIRRUS CL_GD5446 0x00b8 CL-GD5446 +product CIRRUS CL_GD5480 0x00bc CL-GD5480 +product CIRRUS CL_PD6729 0x1100 CL-PD6729 +product CIRRUS CL_PD6832 0x1110 CL-PD6832 PCI-CardBus Bridge +product CIRRUS CL_PD6833 0x1113 CL-PD6833 PCI-CardBus Bridge +product CIRRUS CL_GD7542 0x1200 CL-GD7542 +product CIRRUS CL_GD7543 0x1202 CL-GD7543 +product CIRRUS CL_GD7541 0x1204 CL-GD7541 +product CIRRUS CL_CD4400 0x4400 CL-CD4400 Communications Controller +product CIRRUS CS4610 0x6001 CS4610 SoundFusion Audio Accelerator +product CIRRUS CS4280 0x6003 CS4280 CrystalClear Audio Interface + +/* CMD Technology products -- info gleaned from their web site */ +product CMDTECH 640 0x0640 PCI0640 +/* No data on the CMD Tech. web site for the following as of Mar. 3 '98 */ +product CMDTECH 642 0x0642 PCI0642 +/* datasheets available from www.cmd.com for the followings */ +product CMDTECH 643 0x0643 PCI0643 +product CMDTECH 646 0x0646 PCI0646 +product CMDTECH 647 0x0647 PCI0647 +product CMDTECH 648 0x0648 PCI0648 +product CMDTECH 649 0x0649 PCI0649 + +/* Inclusion of 'A' in the following entry is probably wrong. */ +/* No data on the CMD Tech. web site for the following as of Mar. 3 '98 */ +product CMDTECH 650A 0x0650 PCI0650A +product CMDTECH 670 0x0670 USB0670 +product CMDTECH 673 0x0673 USB0673 + +/* C-Media products */ +product CMEDIA CMI8338A 0x0100 CMI8338A PCI Audio Device +product CMEDIA CMI8338B 0x0101 CMI8338B PCI Audio Device +product CMEDIA CMI8738 0x0111 CMI8738/C3DX PCI Audio Device +product CMEDIA HSP56 0x0211 HSP56 Audiomodem Riser + +/* Cogent Data Technologies products */ +product COGENT EM110TX 0x1400 EX110TX PCI Fast Ethernet Adapter + +/* Compaq products */ +product COMPAQ PCI_EISA_BRIDGE 0x0001 PCI-EISA Bridge +product COMPAQ PCI_ISA_BRIDGE 0x0002 PCI-ISA Bridge +product COMPAQ TRIFLEX1 0x1000 Triflex Host-PCI Bridge +product COMPAQ TRIFLEX2 0x2000 Triflex Host-PCI Bridge +product COMPAQ QVISION_V0 0x3032 QVision +product COMPAQ QVISION_1280P 0x3033 QVision 1280/p +product COMPAQ QVISION_V2 0x3034 QVision +product COMPAQ TRIFLEX4 0x4000 Triflex Host-PCI Bridge +product COMPAQ USB 0x7020 USB Controller +product COMPAQ SMART2P 0xae10 SMART2P RAID +product COMPAQ N100TX 0xae32 Netelligent 10/100 TX +product COMPAQ N10T 0xae34 Netelligent 10 T +product COMPAQ IntNF3P 0xae35 Integrated NetFlex 3/P +product COMPAQ DPNet100TX 0xae40 Dual Port Netelligent 10/100 TX +product COMPAQ IntPL100TX 0xae43 ProLiant Integrated Netelligent 10/100 TX +product COMPAQ DP4000 0xb011 Deskpro 4000 5233MMX +product COMPAQ NF3P_BNC 0xf150 NetFlex 3/P w/ BNC +product COMPAQ NF3P 0xf130 NetFlex 3/P + +/* Compex products - XXX better descriptions */ +product COMPEX NE2KETHER 0x1401 Ethernet +product COMPEX RL100ATX 0x2011 RL100-ATX 10/100 Ethernet +product COMPEX RL100TX 0x9881 RL100-TX 10/100 Ethernet + +/* Conexant Systems products */ +product CONEXANT SOFTK56 0x2443 SoftK56 PCI Software Modem + +/* Contaq Microsystems products */ +product CONTAQ 82C599 0x0600 82C599 PCI-VLB Bridge +product CONTAQ 82C693 0xc693 82C693 PCI-ISA Bridge + +/* Corollary Products */ +product COROLLARY CBUSII_PCIB 0x0014 \"C-Bus II\"-PCI Bridge + +/* Creative Labs products */ +product CREATIVELABS SBLIVE 0x0002 SBLive! EMU 10000 +product CREATIVELABS SBJOY 0x7002 PCI Gameport Joystick +product CREATIVELABS EV1938 0x8938 Ectiva 1938 + +/* Cyclades products */ +product CYCLADES CYCLOMY_1 0x0100 Cyclom-Y below 1M +product CYCLADES CYCLOMY_2 0x0101 Cyclom-Y above 1M +product CYCLADES CYCLOM4Y_1 0x0102 Cyclom-4Y below 1M +product CYCLADES CYCLOM4Y_2 0x0103 Cyclom-4Y above 1M +product CYCLADES CYCLOM8Y_1 0x0104 Cyclom-8Y below 1M +product CYCLADES CYCLOM8Y_2 0x0105 Cyclom-8Y above 1M +product CYCLADES CYCLOMZ_1 0x0200 Cyclom-Z below 1M +product CYCLADES CYCLOMZ_2 0x0201 Cyclom-Z above 1M + +/* Davicom Semiconductor products */ +product DAVICOM DM9102 0x9102 Davicom DM9102 10/100 Ethernet + +/* DEC products */ +product DEC 21050 0x0001 DECchip 21050 PCI-PCI Bridge +product DEC 21040 0x0002 DECchip 21040 Ethernet +product DEC 21030 0x0004 DECchip 21030 (\"TGA\") +product DEC NVRAM 0x0007 Zephyr NV-RAM +product DEC KZPSA 0x0008 KZPSA +product DEC 21140 0x0009 DECchip 21140 10/100 Ethernet +product DEC PBXGB 0x000d TGA2 +product DEC DEFPA 0x000f DEFPA +/* product DEC ??? 0x0010 ??? VME Interface */ +product DEC 21041 0x0014 DECchip 21041 Ethernet +product DEC DGLPB 0x0016 DGLPB (\"OPPO\") +product DEC 21142 0x0019 DECchip 21142/21143 10/100 Ethernet +product DEC 21052 0x0021 DECchip 21052 PCI-PCI Bridge +product DEC 21150 0x0022 DECchip 21150 PCI-PCI Bridge +product DEC 21152 0x0024 DECchip 21152 PCI-PCI Bridge +product DEC 21153 0x0025 DECchip 21153 PCI-PCI Bridge +product DEC 21154 0x0026 DECchip 21154 PCI-PCI Bridge +product DEC CPQ42XX 0x0046 Compaq SMART RAID 42xx + +/* Delta products */ +product DELTA 8139 0x1360 8139 Ethernet + +/* Diamond products */ +product DIAMOND VIPER 0x9001 Viper/PCI + +/* D-Link Systems products */ +product DLINK DFE550TX 0x1002 DFE-550TX 10/100 Ethernet + +/* Distributed Processing Technology products */ +product DPT SC_RAID 0xa400 SmartCache/SmartRAID +product DPT RAID_I2O 0xa501 SmartRAID (I2O) +product DPT MEMCTLR 0x1012 Memory Controller + +/* Dolphin products */ +product DOLPHIN PCISCI 0x0658 PCI-SCI Bridge + +/* Domex products */ +product DOMEX PCISCSI 0x0001 DMX-3191D + +/* ELSA products */ +product ELSA QS1PCI 0x1000 QuickStep 1000 ISDN card + +/* Emulex products */ +product EMULEX LPPFC 0x10df \"Light Pulse\" FibreChannel adapter + +/* Ensoniq products */ +product ENSONIQ AUDIOPCI 0x5000 AudioPCI +product ENSONIQ AUDIOPCI97 0x1371 AudioPCI 97 +product ENSONIQ CT5880 0x5880 CT5880 + +/* Epigram (now Broadcom) products */ +product EPIGRAM BCM4210 0xa0fa BCM4210 iLine10 Controller + +/* Essential Communications products */ +product ESSENTIAL RR_HIPPI 0x0001 RoadRunner HIPPI Interface +product ESSENTIAL RR_GIGE 0x0005 RoadRunner Gig-E Interface + +/* ESS Technology Inc products */ +product ESSTECH MAESTRO1 0x0100 Maestro 1 PCI Audio Accelerator +product ESSTECH MAESTRO2 0x1968 Maestro 2 PCI Audio Accelerator +product ESSTECH SOLO1 0x1969 Solo-1 PCI AudioDrive +product ESSTECH MAESTRO2E 0x1978 Maestro 2E PCI Audio Accelerator +product ESSTECH MAESTRO3 0x1998 Maestro 3 PCI Audio Accelerator +product ESSTECH MAESTRO3MODEM 0x1999 Maestro 3 Modem + +/* ESS Technology Inc products */ +product ESSTECH2 MAESTRO1 0x0100 Maestro 1 PCI Audio Accelerator + +/* O2 Micro Inc */ +product O2MICRO OZ6832 0x6832 OZ6832 CardBus Controller + +/* Evans & Sutherland products */ +product ES FREEDOM 0x0001 Freedom PCI-GBus Interface + +/* FORE products */ +product FORE PCA200 0x0210 ATM PCA-200 +product FORE PCA200E 0x0300 ATM PCA-200e + +/* Forte Media products */ +product FORTEMEDIA FM801 0x0801 Forte Media 801 Sound + +/* Future Domain products */ +product FUTUREDOMAIN TMC_18C30 0x0000 TMC-18C30 (36C70) + +/* Efficient Networks products */ +product EFFICIENTNETS ENI155PF 0x0000 155P-MF1 ATM (FPGA) +product EFFICIENTNETS ENI155PA 0x0002 155P-MF1 ATM (ASIC) +product EFFICIENTNETS ENI25P 0x0003 SpeedStream ENI-25p +product EFFICIENTNETS SS3000 0x0005 SpeedStream 3000 + +/* Galileo Technology products */ +product GALILEO GT64010A 0x0146 GT-64010A System Controller +product GALILEO GT64115 0x4111 GT-64115 System Controller +product GALILEO GT64011 0x4146 GT-64011 System Controller +product GALILEO GT64120 0x4620 GT-64120 System Controller +product GALILEO GT64130 0x6320 GT-64130 System Controller + +/* Hewlett-Packard products */ +product HP J2585A 0x1030 J2585A + +/* IBM products */ +product IBM MCABRIDGE 0x0002 MCA Bridge +product IBM ALTALITE 0x0005 CPU Bridge - Alta Lite +product IBM ALTAMP 0x0007 CPU Bridge - Alta MP +product IBM ISABRIDGE 0x000a ISA Bridge w/PnP +product IBM CPUBRIDGE 0x0017 CPU Bridge +product IBM LANSTREAMER 0x0018 Auto LANStreamer +product IBM GXT150P 0x001b GXT-150P 2D Accelerator +product IBM MCABRIDGE2 0x0020 MCA Bridge +product IBM 82351 0x0022 82351 PCI-PCI Bridge +product IBM SERVERAID 0x002e ServeRAID +product IBM OLYMPIC 0x003e Token Ring +product IBM MIAMI 0x0036 Miami/PCI +product IBM TURBOWAYS25 0x0053 Turboways 25 ATM +product IBM MPIC2 0xffff MPIC-II + +/* IDT products */ +product IDT 77201 0x0001 77201/77211 ATM (\"NICStAR\") + +/* Initio products */ +product INITIO I920 0x0002 INIC-920 SCSI +product INITIO I940 0x9400 INIC-940 SCSI +product INITIO I935 0x9401 INIC-935 SCSI +product INITIO I950 0x9500 INIC-950 SCSI + +/* Integrated Micro Solutions products */ +product IMS 8849 0x8849 8849 +product IMS TT128M 0x9128 TwinTurbo 128M + +/* Intel products */ +product INTEL PCEB 0x0482 82375EB/SB PCI-EISA Bridge (PCEB) +product INTEL CDC 0x0483 82424ZX Cache and DRAM controller (CDC) +product INTEL SIO 0x0484 82378ZB System I/O (SIO) +product INTEL 82426EX 0x0486 82426EX PCI-to-ISA Bridge (PCIB) +product INTEL PCMC 0x04a3 82434LX/NX PCI, Cache and Memory Controller (PCMC) +product INTEL IN_BUSINESS 0x1030 InBusiness Fast Ethernet LAN Controller +product INTEL 82559ER 0x1209 82559ER Fast Ethernet LAN Controller +product INTEL 82092AA 0x1222 82092AA IDE controller +product INTEL SAA7116 0x1223 SAA7116 +product INTEL 82596 0x1226 82596 LAN Controller +product INTEL EEPRO100 0x1227 EE Pro 100 10/100 Fast Ethernet +product INTEL EEPRO100S 0x1228 EE Pro 100 Smart 10/100 Fast Ethernet +product INTEL 82557 0x1229 82557 Fast Ethernet LAN Controller +product INTEL 82437FX 0x122d 82437FX System Controller (TSC) +product INTEL 82371FB_ISA 0x122e 82371FB PCI-to-ISA Bridge (PIIX) +product INTEL 82371FB_IDE 0x1230 82371FB IDE controller (PIIX) +product INTEL 82371MX 0x1234 82371MX Mobile PCI I/O IDE Xcelerator (MPIIX) +product INTEL 82437MX 0x1235 82437MX Mobile System Controller (MTSC) +product INTEL 82441FX 0x1237 82441FX PCI and Memory Controller (PMC) +product INTEL 82380AB 0x123c 82380AB Mobile PCI-to-ISA Bridge (MISA) +product INTEL 82380FB 0x124b 82380FB Mobile PCI-to-PCI Bridge (MPCI2) +product INTEL 82439HX 0x1250 82439HX System Controller (TXC) +product INTEL 82801AA_LPC 0x2410 82801AA LPC Interface Bridge +product INTEL 82801AA_IDE 0x2411 82801AA IDE Controller +product INTEL 82801AA_USB 0x2412 82801AA USB Controller +product INTEL 82801AA_SMB 0x2413 82801AA SMBus Controller +product INTEL 82801AA_ACA 0x2415 82801AA AC-97 Audio Controller +product INTEL 82801AA_ACM 0x2416 82801AA AC-97 PCI Modem +product INTEL 82801AA_HPB 0x2418 82801AA Hub-to-PCI Bridge +product INTEL 82801AB_LPC 0x2420 82801AB LPC Interface Bridge +product INTEL 82801AB_IDE 0x2421 82801AB IDE Controller +product INTEL 82801AB_USB 0x2422 82801AB USB Controller +product INTEL 82801AB_SMB 0x2423 82801AB SMBus Controller +product INTEL 82801AB_ACA 0x2425 82801AB AC-97 Audio Controller +product INTEL 82801AB_ACM 0x2426 82801AB AC-97 PCI Modem +product INTEL 82801AB_HPB 0x2428 82801AB Hub-to-PCI Bridge +product INTEL 82801BA_LPC 0x2440 82801BA LPC Interface Bridge +product INTEL 82801BA_USB1 0x2442 82801BA USB Controller +product INTEL 82801BA_SMB 0x2443 82801BA SMBus Controller +product INTEL 82801BA_USB2 0x2444 82801BA USB Controller +product INTEL 82801BA_ACA 0x2445 82801BA AC-97 Audio Controller +product INTEL 82801BA_ACM 0x2446 82801BA AC-97 PCI Modem +product INTEL 82801BA_LAN 0x2449 82801BA LAN Controller +product INTEL 82801BA_IDE 0x244B 82801BA IDE Controller +product INTEL 82801BA_HPB 0x244E 82801BA Hub-to-PCI Bridge +product INTEL 82371SB_ISA 0x7000 82371SB PCI-to-ISA Bridge (PIIX3) +product INTEL 82371SB_IDE 0x7010 82371SB IDE Interface (PIIX3) +product INTEL 82371SB_USB 0x7020 82371SB USB Host Controller (PIIX3) +product INTEL 82437VX 0x7030 82437VX System Controller (TVX) +product INTEL 82439TX 0x7100 82439TX System Controller (MTXC) +product INTEL 82371AB_ISA 0x7110 82371AB PCI-to-ISA Bridge (PIIX4) +product INTEL 82371AB_IDE 0x7111 82371AB IDE controller (PIIX4) +product INTEL 82371AB_USB 0x7112 82371AB USB Host Controller (PIIX4) +product INTEL 82371AB_PMC 0x7113 82371AB Power Management Controller (PIIX4) +product INTEL 82810_MCH 0x7120 82810 Memory Controller Hub +product INTEL 82810_GC 0x7121 82810 Graphics Controller +product INTEL 82810_DC100_MCH 0x7122 82810-DC100 Memory Controller Hub +product INTEL 82810_DC100_GC 0x7123 82810-DC100 Graphics Controller +product INTEL 82810E_MCH 0x7124 82810E Memory Controller Hub +product INTEL 82810E_GC 0x7125 82810E Graphics Controller +product INTEL 82443LX 0x7180 82443LX PCI AGP Controller (PAC) +product INTEL 82443LX_AGP 0x7181 82443LX AGP Interface (PAC) +product INTEL 82443BX 0x7190 82443BX Host Bridge/Controller +product INTEL 82443BX_AGP 0x7191 82443BX AGP Interface +product INTEL 82443BX_NOAGP 0x7192 82443BX Host Bridge/Controller (AGP disabled) +product INTEL 82440MX 0x7194 82440MX Host Bridge/Controller +product INTEL 82440MX_ACA 0x7195 82440MX AC-97 Audio Controller +product INTEL 82440MX_ISA 0x7198 82440MX PCI-to-ISA Bridge +product INTEL 82440MX_IDE 0x7199 82440MX IDE Controller +product INTEL 82440MX_USB 0x719a 82440MX USB Host Controller +product INTEL 82440MX_PMC 0x719b 82440MX Power Management Controller +product INTEL I740 0x7800 i740 Graphics Accelerator +product INTEL PCI450_PB 0x84c4 82454KX/GX PCI Bridge (PB) +product INTEL PCI450_MC 0x84c5 82451KX/GX Memory Controller (MC) +product INTEL 82451NX_MIOC 0x84ca 82451NX Memory & I/O Controller (MIOC) +product INTEL 82451NX_PXB 0x84cb 82451NX PCI Expander Bridge (PXB) + +/* Intergraph products */ +product INTERGRAPH 4D50T 0x00e4 Powerstorm 4D50T + +/* I. T. T. products */ +product ITT AGX016 0x0001 AGX016 +product ITT ITT3204 0x0002 ITT3204 MPEG Decoder + +/* KTI products - XXX better descriptions */ +product KTI NE2KETHER 0x3000 Ethernet + +/* LAN Media Corporation */ +product LMC HSSI 0x0003 HSSI Interface +product LMC DS3 0x0004 DS3 Interface +product LMC SSI 0x0005 SSI + +/* LeadTek Research */ +product LEADTEK S3_805 0x0000 S3 805 + +/* Linear Systems / CompuModules */ +product LINEARSYS DVB_TX 0x7629 DVB Transmitter +product LINEARSYS DVB_RX 0x7630 DVB Receiver + +/* Lite-On products */ +product LITEON 82C168 0x0002 82C168/82C169 (PNIC) 10/100 Ethernet +product LITEON 82C115 0xc115 82C115 (PNIC II) 10/100 Ethernet + +/* Lucent products */ +product LUCENT LTMODEM_0440 0x0440 K56flex DSVD LTMODEM +product LUCENT LTMODEM_0441 0x0441 LTMODEM +product LUCENT LTMODEM_0442 0x0442 LTMODEM +product LUCENT LTMODEM_0443 0x0443 LTMODEM +product LUCENT LTMODEM_0444 0x0444 LTMODEM +product LUCENT LTMODEM_0445 0x0445 LTMODEM +product LUCENT LTMODEM_0446 0x0446 LTMODEM +product LUCENT LTMODEM_0447 0x0447 LTMODEM +product LUCENT LTMODEM_0448 0x0448 LTMODEM +product LUCENT LTMODEM_0449 0x0449 LTMODEM +product LUCENT LTMODEM_044A 0x044A LTMODEM +product LUCENT LTMODEM_044B 0x044B LTMODEM +product LUCENT LTMODEM_044C 0x044C LTMODEM +product LUCENT LTMODEM_044D 0x044D LTMODEM +product LUCENT LTMODEM_044E 0x044E LTMODEM +product LUCENT LTMODEM_0450 0x0450 LTMODEM +product LUCENT LTMODEM_0451 0x0451 LTMODEM +product LUCENT LTMODEM_0452 0x0452 LTMODEM +product LUCENT LTMODEM_0453 0x0453 LTMODEM +product LUCENT LTMODEM_0454 0x0454 LTMODEM +product LUCENT LTMODEM_0455 0x0455 LTMODEM +product LUCENT LTMODEM_0456 0x0456 LTMODEM +product LUCENT LTMODEM_0457 0x0457 LTMODEM +product LUCENT LTMODEM_0458 0x0458 LTMODEM +product LUCENT LTMODEM_0459 0x0459 LTMODEM +product LUCENT LTMODEM_045A 0x045A LTMODEM +product LUCENT USBHC 0x5801 USB Host Controller + +/* Macronix */ +product MACRONIX MX98713 0x0512 MX98713 (PMAC) 10/100 Ethernet +product MACRONIX MX987x5 0x0531 MX987x5 (PMAC) 10/100 Ethernet + +/* Madge Networks products */ +product MADGE COLLAGE25 0x1000 Collage 25 ATM adapter +product MADGE COLLAGE155 0x1001 Collage 155 ATM adapter + +/* Matrox products */ +product MATROX ATLAS 0x0518 MGA PX2085 (\"Atlas\") +product MATROX MILLENNIUM 0x0519 MGA Millennium 2064W +product MATROX MYSTIQUE 0x051a MGA Mystique 1064SG +product MATROX MILLENNIUM2 0x051b MGA Millennium II 2164W +product MATROX MILLENNIUM2_AGP 0x051f MGA Millennium II 2164WA-B AG +product MATROX G200_PCI 0x0520 MGA G200 PCI +product MATROX G200_AGP 0x0521 MGA G200 AGP +product MATROX G400_AGP 0x0525 MGA G400 AGP +product MATROX IMPRESSION 0x0d10 MGA Impression +product MATROX G100_PCI 0x1000 MGA G100 PCI +product MATROX G100_AGP 0x1001 MGA G100 AGP + +/* Motorola products */ +product MOT MPC105 0x0001 MPC105 \"Eagle\" Host Bridge +product MOT MPC106 0x0002 MPC106 \"Grackle\" Host Bridge + +/* Mylex products */ +product MYLEX 960P 0x0001 DAC960P RAID controller + +/* Mutech products */ +product MUTECH MV1000 0x0001 MV1000 + +/* NetVin products - XXX better descriptions */ +product NETVIN 5000 0x5000 5000 Ethernet + +/* Newbridge / Tundra products */ +product NEWBRIDGE CA91CX42 0x0000 Universe VME bridge + +/* National Semiconductor products */ +product NS DP83810 0x0001 DP83810 10/100 Ethernet +product NS DP83815 0x0020 DP83815 10/100 Ethernet +product NS NS87410 0xd001 NS87410 + +/* NCR/Symbios Logic products */ +product SYMBIOS 810 0x0001 53c810 +product SYMBIOS 820 0x0002 53c820 +product SYMBIOS 825 0x0003 53c825 +product SYMBIOS 815 0x0004 53c815 +product SYMBIOS 810AP 0x0005 53c810AP +product SYMBIOS 860 0x0006 53c860 +product SYMBIOS 896 0x000b 53c896 +product SYMBIOS 895 0x000c 53c895 +product SYMBIOS 885 0x000d 53c885 +product SYMBIOS 875 0x000f 53c875 +product SYMBIOS 1510 0x0010 53c1510 +product SYMBIOS 875J 0x008f 53c875J + +/* Packet Engines products */ +product SYMBIOS PE_GNIC 0x0702 Packet Engines G-NIC Ethernet + +/* NEC products */ +product NEC USB 0x0035 USB Host Controller +product NEC POWERVR2 0x0046 PowerVR PCX2 +product NEC PD72872 0x0063 uPD72872 IEEE 1394 OHCI Host Controller +product NEC PD72870 0x00cd uPD72870 IEEE 1394 OHCI Host Controller +product NEC PD72871 0x00ce uPD72871 IEEE 1394 OHCI Host Controller + +/* Neomagic products */ +product NEOMAGIC NMMG128ZV 0x0003 MagicGraph 128ZV +product NEOMAGIC NMMG2160 0x0004 MagicGraph 128XD +product NEOMAGIC NMMM256AV_VGA 0x0005 MagicMedia 256AV VGA +product NEOMAGIC NMMM256ZX_VGA 0x0006 MagicMedia 256ZX VGA +product NEOMAGIC NMMM256AV_AU 0x8005 MagicMedia 256AV Audio +product NEOMAGIC NMMM256ZX_AU 0x8006 MagicMedia 256ZX Audio + +/* Netgear products */ +product NETGEAR GA620 0x620a GA620 Gigabit Ethernet + +/* NexGen products */ +product NEXGEN NX82C501 0x4e78 NX82C501 Host-PCI Bridge + +/* NKK products */ +product NKK NDR4600 0xA001 NDR4600 Host-PCI Bridge + +/* Number Nine products */ +product NUMBER9 I128 0x2309 Imagine-128 +product NUMBER9 I128_2 0x2339 Imagine-128 II + +/* Nvidia Corporationn products */ +product NVIDIA RIVATNT 0x0020 RIVA TNT +product NVIDIA RIVATNT2 0x0028 RIVA TNT2 +product NVIDIA RIVATNT2U 0x0029 RIVA TNT2 Ultra +product NVIDIA VANTA 0x002C Vanta +product NVIDIA RIVATNT2M64 0x002D RIVA TNT2 Model 64 +product NVIDIA ALADDINTNT2 0x00A0 Aladdin TNT2 +product NVIDIA GEFORCE256 0x0100 GeForce 256 +product NVIDIA GEFORCEDDR 0x0101 GeForce DDR +product NVIDIA QUADRO 0x0103 Quadro +product NVIDIA GEFORCE2 0x0150 GeForce2 GTS +product NVIDIA GEFORCE2DDR 0x0151 GeForce2 GTS (DDR) +product NVIDIA GEFORCE2BR 0x0152 GeForce2 GTS +product NVIDIA QUADRO2 0x0153 Quadro2 + +/* Nvidia Corporation & SGS Thomson Microelectric */ +product NVIDIA_SGS RIVA128 0x0018 Riva 128 + +/* Oak Technologies products */ +product OAKTECH OTI1007 0x0107 OTI107 + +/* Olicom products */ +product OLICOM OC2183 0x0013 Olicom OC-2183/2185 Ethernet +product OLICOM OC2325 0x0012 Olicom OC-2325 Ethernet +product OLICOM OC2326 0x0014 Olicom OC-2326 10/100-TX Ethernet + +/* Opti products */ +product OPTI 82C557 0xc557 82C557 +product OPTI 82C558 0xc558 82C558 +product OPTI 82C568 0xc568 82C568 +product OPTI 82D568 0xd568 82D568 +product OPTI 82C621 0xc621 82C621 +product OPTI 82C822 0xc822 82C822 +product OPTI RM861HA 0xc861 RM861HA +product OPTI 82C700 0xc700 82C700 +product OPTI 82C701 0xc701 82C701 + +/* PC Tech products */ +product PCTECH RZ1000 0x1000 RZ1000 + +/* PLX Technology products */ +product PLX 9060ES 0x906e 9060ES PCI bus controller + +/* ProLAN products - XXX better descriptions */ +product PROLAN NE2KETHER 0x1980 Ethernet + +/* Promise products */ +product PROMISE DC5030 0x5300 DC5030 +product PROMISE ULTRA33 0x4d33 Ultra33/ATA Bus Master IDE Accelerator +product PROMISE ULTRA66 0x4d38 Ultra66/ATA Bus Master IDE Accelerator +product PROMISE ULTRA100 0x4d30 Ultra100/ATA Bus Master IDE Accelerator + +/* QLogic products */ +product QLOGIC ISP1020 0x1020 ISP1020 +product QLOGIC ISP1022 0x1022 ISP1022 +product QLOGIC ISP1080 0x1080 ISP1080 +product QLOGIC ISP1240 0x1240 ISP1240 +product QLOGIC ISP2100 0x2100 ISP2100 + +/* Quantum Designs products */ +product QUANTUMDESIGNS 8500 0x0001 8500 +product QUANTUMDESIGNS 8580 0x0002 8580 + +/* Realtek (Creative Labs?) products */ +product REALTEK RT8029 0x8029 8029 Ethernet +product REALTEK RT8129 0x8129 8129 10/100 Ethernet +product REALTEK RT8139 0x8139 8139 10/100 Ethernet + +/* RICOH products */ +product RICOH Rx5C465 0x0465 5C465 PCI-CardBus bridge +product RICOH Rx5C466 0x0466 5C466 PCI-CardBus bridge +product RICOH Rx5C475 0x0475 5C475 PCI-CardBus bridge +product RICOH RL5C476 0x0476 5C476 PCI-CardBus bridge +product RICOH Rx5C477 0x0477 5C477 PCI-CardBus bridge +product RICOH Rx5C478 0x0478 5C478 PCI-CardBus bridge + +/* RISCom (SDL Communications, Inc?) products */ +product RISCOM N2 0x5568 N2 + +/* RNS products */ +product RNS FDDI 0x2200 2200 FDDI + +/* S3 products */ +product S3 VIRGE 0x5631 ViRGE +product S3 TRIO32 0x8810 Trio32 +product S3 TRIO64 0x8811 Trio32/64 +product S3 AURORA64P 0x8812 Aurora64V+ +product S3 TRIO64UVP 0x8814 Trio64UV+ +product S3 VIRGE_VX 0x883d ViRGE/VX +product S3 868 0x8880 868 +product S3 928 0x88b0 86C928 +product S3 864_0 0x88c0 86C864-0 +product S3 864_1 0x88c1 86C864-1 +product S3 864_2 0x88c2 86C864-2 +product S3 864_3 0x88c3 86C864-3 +product S3 964_0 0x88d0 86C964-0 +product S3 964_1 0x88d1 86C964-1 +product S3 964_2 0x88d2 86C964-2 +product S3 964_3 0x88d3 86C964-3 +product S3 968_0 0x88f0 86C968-0 +product S3 968_1 0x88f1 86C968-1 +product S3 968_2 0x88f2 86C968-2 +product S3 968_3 0x88f3 86C968-3 +product S3 TRIO64V2_DX 0x8901 Trio64V2/DX +product S3 PLATO_PX 0x8901 Plato/PX +product S3 TRIO3D 0x8904 86C365 Trio3D +product S3 VIRGE_DX 0x8a01 ViRGE/DX +product S3 VIRGE_GX2 0x8a10 ViRGE/GX2 +product S3 TRIO3D2X 0x8a13 Trio3D/2X +product S3 SAVAGE3D 0x8a20 Savage3D +product S3 SAVAGE3D_MV 0x8a21 Savage3D+MV +product S3 SAVAGE4 0x8a22 Savage4 +product S3 VIRGE_MX 0x8c01 ViRGE/MX +product S3 VIRGE_MXP 0x8c03 ViRGE/MXP +product S3 SAVAGE_MX_MV 0x8c10 Savage/MX+MV +product S3 SAVAGE_MX 0x8c11 Savage/MX +product S3 SAVAGE_IX_MV 0x8c12 Savage/IX+MV +product S3 SAVAGE_IX 0x8c13 Savage/IX +product S3 SAVAGE2000 0x9102 Savage2000 +product S3 SONICVIBES 0xca00 SonicVibes + +/* Samsung Semiconductor products */ +product SAMSUNGSEMI KS8920 0x8920 KS8920 10/100 Ethernet + +/* SGI products */ +product SGI IOC3 0x0003 IOC3 +product SGI RAD1 0x0005 PsiTech RAD1 +product SGI TIGON 0x0009 Tigon Gigabit Ethernet + +/* SGS Thomson products */ +product SGSTHOMSON 2000 0x0008 STG 2000X +product SGSTHOMSON 1764 0x1746 STG 1764X + +/* SiByte, Inc. products */ +product SIBYTE SB1250_PCI 0x0001 BCM1250 PCI Host Bridge +product SIBYTE SB1250_LDT 0x0002 BCM1250 HyperTransport Host Bridge + +/* Sigma Designs products */ +product SIGMA HOLLYWOODPLUS 0x8300 REALmagic Hollywood-Plus MPEG-2 Decoder + +/* Silicon Integrated System products */ +product SIS 86C201 0x0001 86C201 +product SIS 86C202 0x0002 86C202 +product SIS 86C205 0x0005 86C205 +product SIS 85C503 0x0008 85C503 or 5597/5598 ISA bridge +product SIS 600PMC 0x0009 600 Power Mngmt Controller +product SIS 5597_VGA 0x0200 5597/5598 integrated VGA +product SIS 85C501 0x0406 85C501 +product SIS 85C496 0x0496 85C496 +product SIS 530HB 0x0530 530 Host to PCI Bridge +product SIS 85C601 0x0601 85C601 +product SIS 900 0x0900 SiS 900 10/100 Ethernet +product SIS 5597_IDE 0x5513 5597/5598 IDE controller +product SIS 5597_HB 0x5597 5597/5598 host bridge +product SIS 530VGA 0x6306 530 GUI Accelerator+3D +product SIS 6326 0x6326 6326 AGP VGA +product SIS 5597_USB 0x7001 5597/5598 USB host controller +product SIS 7016 0x7016 SiS 7016 10/100 Ethernet + +/* Silicon Motion products */ +product SILMOTION LYNX_E 0x0810 Lynx E + +/* SMC products */ +product SMC 37C665 0x1000 FDC 37C665 +product SMC 37C922 0x1001 FDC 37C922 +product SMC 83C170 0x0005 83C170 (\"EPIC/100\") Fast Ethernet +product SMC 83C175 0x0006 83C175 (\"EPIC/100\") Fast Ethernet + +/* Solidum Systems Corporation */ +product SOLIDUM AMD971 0x2000 SNP8023: AMD 971 +product SOLIDUM CLASS802 0x8023 SNP8023: Classifier Engine + +/* Sony products */ +product SONY CXD1947A 0x8009 CXD1947A IEEE 1394 Host Controller +product SONY CXD32222 0x8039 CXD3222 OHCI IEEE 1394 Host Controller +product SONY MEMSTICK 0x808a Memory Stick I/F Controller + +/* Sun Microsystems products */ +product SUN EBUS 0x1000 PCIO Ebus2 +product SUN HMENETWORK 0x1001 PCIO Happy Meal Ethernet +product SUN SIMBA 0x5000 Simba PCI bridge +product SUN MS_IIep 0x9000 microSPARC IIep PCI +product SUN US_IIi 0xa000 UltraSPARC IIi PCI + +/* Sundance Technology products */ +product SUNDANCETI ST201 0x0201 ST201 10/100 Ethernet + +/* Surecom Technology products */ +product SURECOM NE34 0x0e34 NE-34 Ethernet + +/* Symphony Labs products */ +product SYMPHONY 82C101 0x0001 82C101 +product SYMPHONY 82C103 0x0103 82C103 +product SYMPHONY 82C105 0x0105 82C105 +product SYMPHONY2 82C101 0x0001 82C101 +product SYMPHONY 83C553 0x0565 83C553 PCI-ISA Bridge + +/* Schneider & Koch (really SysKonnect) products */ +product SCHNEIDERKOCH SKNET_FDDI 0x4000 SK-NET FDDI-xP + +/* Tekram Technology products (1st PCI Vendor ID)*/ +product TEKRAM DC290 0xdc29 DC-290(M) + +/* Tekram Technology products (2nd PCI Vendor ID) */ +product TEKRAM2 DC690C 0x690c DC-690C + +/* Texas Instruments products */ +product TI TLAN 0x0500 TLAN +product TI TVP4020 0x3d07 TVP4020 Permedia 2 +product TI TSB12LV21 0x8000 TSB12LV21 IEEE 1394 Host Controller +product TI TSB12LV22 0x8009 TSB12LV22 OHCI IEEE 1394 Host Controller +product TI TSB12LV23 0x8019 TSB12LV23 OHCI IEEE 1394 Host Controller +product TI TSB12LV26 0x8020 TSB12LV26 OHCI IEEE 1394 Host Controller +product TI PCI1130 0xac12 PCI1130 PCI-CardBus Bridge +product TI PCI1031 0xac13 PCI1031 PCI-PCMCIA Bridge +product TI PCI1131 0xac15 PCI1131 PCI-CardBus Bridge +product TI PCI1250 0xac16 PCI1250 PCI-CardBus Bridge +product TI PCI1220 0xac17 PCI1220 PCI-CardBus Bridge +product TI PCI1221 0xac19 PCI1221 PCI-CardBus Bridge +product TI PCI1450 0xac1b PCI1450 PCI-CardBus Bridge +product TI PCI1225 0xac1c PCI1225 PCI-CardBus Bridge +product TI PCI1251 0xac1d PCI1251 PCI-CardBus Bridge +product TI PCI1211 0xac1e PCI1211 PCI-CardBus Bridge +product TI PCI1251B 0xac1f PCI1251B PCI-CardBus Bridge +product TI PCI2030 0xac20 PCI2030 PCI-PCI Bridge +product TI PCI1420 0xac51 PCI1420 PCI-CardBus Bridge +product TI PCI1451 0xac52 PCI1451 PCI-CardBus Bridge + +/* Toshiba America products */ +product TOSHIBA R4X00 0x0009 R4x00 Host-PCI Bridge +product TOSHIBA TC35856F 0x0020 TC35856F ATM (\"Meteor\") + +/* Toshiba America Info Systems products */ +product TOSHIBA2 HOST 0x0601 Host Bridge/Controller +product TOSHIBA2 ISA 0x0602 ISA Bridge +product TOSHIBA2 ToPIC95 0x0603 ToPIC95 CardBus-PCI Bridge +product TOSHIBA2 ToPIC95B 0x060a ToPIC95B CardBus-PCI Bridge +product TOSHIBA2 ToPIC97 0x060f ToPIC97 CardBus-PCI Bridge +product TOSHIBA2 ToPIC100 0x0617 ToPIC100 CardBus-PCI Bridge +product TOSHIBA2 FIRO 0x0701 Fast Infrared Type O + +/* Trident products */ +product TRIDENT CYBERBLADE_I7 0x8420 CyberBlade i7 +product TRIDENT TGUI_9320 0x9320 TGUI 9320 +product TRIDENT TGUI_9350 0x9350 TGUI 9350 +product TRIDENT TGUI_9360 0x9360 TGUI 9360 +product TRIDENT CYBER_9397 0x9397 CYBER 9397 +product TRIDENT CYBER_9397DVD 0x939a CYBER 9397DVD +product TRIDENT CYBER_9525 0x9525 CYBER 9525 +product TRIDENT TGUI_9420 0x9420 TGUI 9420 +product TRIDENT TGUI_9440 0x9440 TGUI 9440 +product TRIDENT TGUI_9660 0x9660 TGUI 9660 +product TRIDENT TGUI_9680 0x9680 TGUI 9680 +product TRIDENT TGUI_9682 0x9682 TGUI 9682 + +/* Triones Technologies products */ +/* The 366 and 370 controllers have the same product ID */ +product TRIONES HPT366 0x0004 HPT366/370 IDE Controller + +/* TriTech Microelectronics products*/ +product TRITECH TR25202 0xfc02 Pyramid3D TR25202 + +/* Tseng Labs products */ +product TSENG ET4000_W32P_A 0x3202 ET4000w32p rev A +product TSENG ET4000_W32P_B 0x3205 ET4000w32p rev B +product TSENG ET4000_W32P_C 0x3206 ET4000w32p rev C +product TSENG ET4000_W32P_D 0x3207 ET4000w32p rev D +product TSENG ET6000 0x3208 ET6000 + +/* UMC products */ +product UMC UM82C881 0x0001 UM82C881 486 Chipset +product UMC UM82C886 0x0002 UM82C886 ISA Bridge +product UMC UM8673F 0x0101 UM8673F EIDE Controller +product UMC UM8881 0x0881 UM8881 HB4 486 PCI Chipset +product UMC UM82C891 0x0891 UM82C891 +product UMC UM886A 0x1001 UM886A +product UMC UM8886BF 0x673a UM8886BF +product UMC UM8710 0x8710 UM8710 +product UMC UM8886 0x886a UM8886 +product UMC UM8881F 0x8881 UM8881F PCI-Host bridge +product UMC UM8886F 0x8886 UM8886F PCI-ISA bridge +product UMC UM8886A 0x888a UM8886A +product UMC UM8891A 0x8891 UM8891A +product UMC UM9017F 0x9017 UM9017F +product UMC UM8886N 0xe88a UM8886N +product UMC UM8891N 0xe891 UM8891N + +/* ULSI Systems products */ +product ULSI US201 0x0201 US201 + +/* US Robotics products */ +product USR 3CP5609 0x1008 3CP5609 PCI 16550 Modem + +/* V3 Semiconductor products */ +product V3 V292PBC 0x0292 V292PBC AMD290x0 Host-PCI Bridge +product V3 V960PBC 0x0960 V960PBC i960 Host-PCI Bridge +product V3 V96DPC 0xC960 V96DPC i960 (Dual) Host-PCI Bridge + +/* VIA Technologies products, from http://www.via.com.tw/ */ +product VIATECH VT8371_HB 0x0391 VT8371 (Apollo KX133) Host Bridge +product VIATECH VT8501_MVP4 0x0501 VT8501 MVP4 System Controller +product VIATECH VT82C505 0x0505 VT82C505 (Pluto) +product VIATECH VT82C561 0x0561 VT82C561 +product VIATECH VT82C586A_IDE 0x0571 VT82C586A IDE Controller +product VIATECH VT82C576 0x0576 VT82C576 3V +product VIATECH VT82C580VP 0x0585 VT82C580 (Apollo VP) Host-PCI Bridge +product VIATECH VT82C586_ISA 0x0586 VT82C586 (Apollo VP) PCI-ISA Bridge +product VIATECH VT82C595 0x0595 VT82C595 (Apollo VP2) Host-PCI Bridge +product VIATECH VT82C596A 0x0596 VT82C596A (Apollo Pro) PCI-ISA Bridge +product VIATECH VT82C597 0x0597 VT82C597 (Apollo VP3) Host-PCI Bridge +product VIATECH VT82C598PCI 0x0598 VT82C598 (Apollo MVP3) Host-PCI +product VIATECH VT82C686A_ISA 0x0686 VT82C686A (Apollo KX133) PCI-ISA Bridge +product VIATECH VT82C691 0x0691 VT82C691 (Apollo Pro) Host-PCI +product VIATECH VT82C693 0x0693 VT82C693 (Apollo Pro Plus) Host-PCI +product VIATECH VT86C926 0x0926 VT86C926 Amazon PCI-Ethernet Controller +product VIATECH VT82C570M 0x1000 VT82C570M (Apollo) Host-PCI Bridge +product VIATECH VT82C570MV 0x1006 VT82C570M (Apollo) PCI-ISA Bridge +product VIATECH VT82C586_IDE 0x1571 VT82C586 (Apollo VP) IDE Controller +product VIATECH VT82C595_2 0x1595 VT82C595 (Apollo VP2) Host-PCI Bridge +product VIATECH VT83C572 0x3038 VT83C572 USB Controller +product VIATECH VT82C586_PWR 0x3040 VT82C586 (Apollo VP) Power Management Controller +product VIATECH VT3043 0x3043 VT3043 (Rhine) 10/100 Ethernet +product VIATECH VT82C686A_SMB 0x3057 VT82C686A SMBus Controller +product VIATECH VT82C686A_AC97 0x3058 VT82C686A AC-97 Audio Controller +product VIATECH VT82C686A_MC97 0x3068 VT82C686A MC-97 Modem Controller +product VIATECH VT86C100A 0x6100 VT86C100A (Rhine-II) 10/100 Ethernet +product VIATECH VT8371_PPB 0x8391 VT8371 (Apollo KX133) PCI-PCI Bridge +product VIATECH VT8501AGP 0x8501 VT8501 PCI-AGP +product VIATECH VT82C597AGP 0x8597 VT82C597 (Apollo VP3) PCI-AGP +product VIATECH VT82C598AGP 0x8598 VT82C598 (Apollo MVP3) PCI-AGP + +/* Vortex Computer Systems products */ +/* GDT_PCI */ +product VORTEX GDT_60x0 0x0000 GDT6000/6020/6050 +product VORTEX GDT_6000B 0x0001 GDT6000B/6010 +/* GDT_PCINEW */ +product VORTEX GDT_6x10 0x0002 GDT6110/6510 +product VORTEX GDT_6x20 0x0003 GDT6120/6520 +product VORTEX GDT_6530 0x0004 GDT6530 +product VORTEX GDT_6550 0x0005 GDT6550 +/* GDT_PCINEW, wide/ultra SCSI controllers */ +product VORTEX GDT_6x17 0x0006 GDT6117/6517 +product VORTEX GDT_6x27 0x0007 GDT6127/6527 +product VORTEX GDT_6537 0x0008 GDT6537 +product VORTEX GDT_6557 0x0009 GDT6557/6557-ECC +/* GDT_PCINEW, wide SCSI controllers */ +product VORTEX GDT_6x15 0x0010 GDT6115/6515 +product VORTEX GDT_6x25 0x0011 GDT6125/6525 +product VORTEX GDT_6535 0x0012 GDT6535 +product VORTEX GDT_6555 0x0013 GDT6555/6555-ECC +/* GDT_MPR, RP series, wide/ultra SCSI */ +product VORTEX GDT_6x17RP 0x0100 GDT6117RP/GDT6517RP +product VORTEX GDT_6x27RP 0x0101 GDT6127RP/GDT6527RP +product VORTEX GDT_6537RP 0x0102 GDT6537RP +product VORTEX GDT_6557RP 0x0103 GDT6557RP +/* GDT_MPR, RP series, narrow/ultra SCSI */ +product VORTEX GDT_6x11RP 0x0104 GDT6111RP/GDT6511RP +product VORTEX GDT_6x21RP 0x0105 GDT6121RP/GDT6521RP +/* GDT_MPR, RD series, wide/ultra SCSI */ +product VORTEX GDT_6x17RD 0x0110 GDT6117RD/GDT6517RD +product VORTEX GDT_6x27RD 0x0111 GDT6127RD/GDT6527RD +product VORTEX GDT_6537RD 0x0112 GDT6537RD +product VORTEX GDT_6557RD 0x0113 GDT6557RD +/* GDT_MPR, RD series, narrow/ultra SCSI */ +product VORTEX GDT_6x11RD 0x0114 GDT6111RD/GDT6511RD +product VORTEX GDT_6x21RD 0x0115 GDT6121RD/GDT6521RD +/* GDT_MPR, RD series, wide/ultra2 SCSI */ +product VORTEX GDT_6x18RD 0x0118 GDT6118RD/GDT6518RD/GDT6618RD +product VORTEX GDT_6x28RD 0x0119 GDT6128RD/GDT6528RD/GDT6628RD +product VORTEX GDT_6x38RD 0x011A GDT6538RD/GDT6638RD +product VORTEX GDT_6x58RD 0x011B GDT6558RD/GDT6658RD +/* GDT_MPR, RN series (64-bit PCI), wide/ultra2 SCSI */ +product VORTEX GDT_7x18RN 0x0168 GDT7118RN/GDT7518RN/GDT7618RN +product VORTEX GDT_7x28RN 0x0169 GDT7128RN/GDT7528RN/GDT7628RN +product VORTEX GDT_7x38RN 0x016A GDT7538RN/GDT7638RN +product VORTEX GDT_7x58RN 0x016B GDT7558RN/GDT7658RN +/* GDT_MPR, RD series, Fibre Channel */ +product VORTEX GDT_6x19RD 0x0210 GDT6519RD/GDT6619RD +product VORTEX GDT_6x29RD 0x0211 GDT6529RD/GDT6629RD +/* GDT_MPR, RN series (64-bit PCI), Fibre Channel */ +product VORTEX GDT_7x19RN 0x0260 GDT7519RN/GDT7619RN +product VORTEX GDT_7x29RN 0x0261 GDT7529RN/GDT7629RN + +/* VLSI products */ +product VLSI 82C592 0x0005 82C592 CPU Bridge +product VLSI 82C593 0x0006 82C593 ISA Bridge +product VLSI 82C594 0x0007 82C594 Wildcat System Controller +product VLSI 82C596597 0x0008 82C596/597 Wildcat ISA Bridge +product VLSI 82C541 0x000c 82C541 +product VLSI 82C543 0x000d 82C543 +product VLSI 82C532 0x0101 82C532 +product VLSI 82C534 0x0102 82C534 +product VLSI 82C535 0x0104 82C535 +product VLSI 82C147 0x0105 82C147 +product VLSI 82C975 0x0200 82C975 +product VLSI 82C925 0x0280 82C925 + +/* Weitek products */ +product WEITEK P9000 0x9001 P9000 +product WEITEK P9100 0x9100 P9100 + +/* Western Digital products */ +product WD WD33C193A 0x0193 WD33C193A +product WD WD33C196A 0x0196 WD33C196A +product WD WD33C197A 0x0197 WD33C197A +product WD WD7193 0x3193 WD7193 +product WD WD7197 0x3197 WD7197 +product WD WD33C296A 0x3296 WD33C296A +product WD WD34C296 0x4296 WD34C296 +product WD 90C 0xC24A 90C + +/* Winbond Electronics products */ +product WINBOND W83769F 0x0001 W83769F +product WINBOND W89C840F 0x0840 W89C840F 10/100 Ethernet +product WINBOND W89C940F 0x0940 W89C940F Ethernet +product WINBOND W89C940F_1 0x5a5a W89C940F Ethernet + +/* Xircom products */ +/* is the `-3' here just indicating revision 3, or is it really part + of the device name? */ +product XIRCOM X3201_3 0x0002 X3201-3 Fast Ethernet Controller +/* this is the device id `indicating 21143 driver compatibility' */ +product XIRCOM X3201_3_21143 0x0003 X3201-3 Fast Ethernet Controller (21143) + +/* Yamaha products */ +product YAMAHA YMF724 0x0004 724 Audio +product YAMAHA YMF740 0x000A 740 Audio +product YAMAHA YMF740C 0x000C 740C (DS-1) Audio +product YAMAHA YMF724F 0x000D 724F (DS-1) Audio +product YAMAHA YMF744B 0x0010 744 (DS-1S) Audio +product YAMAHA YMF754 0x0012 754 (DS-1E) Audio + +/* Zeinet products */ +product ZEINET 1221 0x0001 1221 + +/* Ziatech products */ +product ZIATECH ZT8905 0x8905 PCI-ST32 Bridge + +/* Zoran products */ +product ZORAN ZR36120 0x6120 Video Controller diff --git a/cfe/cfe/pci/pcidevs.h b/cfe/cfe/pci/pcidevs.h new file mode 100644 index 0000000..214ef45 --- /dev/null +++ b/cfe/cfe/pci/pcidevs.h @@ -0,0 +1,1360 @@ +/* + * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. + * + * generated from: + * pcidevs 2002/09/03 broadcom + */ + +/* + * Copyright (c) 1995, 1996 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * NOTE: a fairly complete list of PCI codes can be found at: + * + * http://members.hyperlink.net.au/~chart/pci.htm + * + * which replaces the database found at + * + * http://www.yourvote.com/pci/ + * + * (but it doesn't always seem to match vendor documentation) + */ + +/* + * List of known PCI vendors. This list has been trimmed to include + * only vendors with products appearing in the lists below. + */ + +#define PCI_VENDOR_COMPAQ 0x0e11 /* Compaq */ +#define PCI_VENDOR_SYMBIOS 0x1000 /* Symbios Logic */ +#define PCI_VENDOR_ATI 0x1002 /* ATI Technologies */ +#define PCI_VENDOR_ULSI 0x1003 /* ULSI Systems */ +#define PCI_VENDOR_VLSI 0x1004 /* VLSI Technology */ +#define PCI_VENDOR_AVANCE 0x1005 /* Avance Logic */ +#define PCI_VENDOR_NS 0x100b /* National Semiconductor */ +#define PCI_VENDOR_TSENG 0x100c /* Tseng Labs */ +#define PCI_VENDOR_WEITEK 0x100e /* Weitek */ +#define PCI_VENDOR_DEC 0x1011 /* Digital Equipment */ +#define PCI_VENDOR_CIRRUS 0x1013 /* Cirrus Logic */ +#define PCI_VENDOR_IBM 0x1014 /* IBM */ +#define PCI_VENDOR_WD 0x101c /* Western Digital */ +#define PCI_VENDOR_AMD 0x1022 /* Advanced Micro Devices */ +#define PCI_VENDOR_TRIDENT 0x1023 /* Trident Microsystems */ +#define PCI_VENDOR_ACER 0x1025 /* Acer */ +#define PCI_VENDOR_MATROX 0x102b /* Matrox */ +#define PCI_VENDOR_CHIPS 0x102c /* Chips and Technologies */ +#define PCI_VENDOR_TOSHIBA 0x102f /* Toshiba America */ +#define PCI_VENDOR_NEC 0x1033 /* NEC */ +#define PCI_VENDOR_FUTUREDOMAIN 0x1036 /* Future Domain */ +#define PCI_VENDOR_SIS 0x1039 /* Silicon Integrated System */ +#define PCI_VENDOR_HP 0x103c /* Hewlett-Packard */ +#define PCI_VENDOR_PCTECH 0x1042 /* PC Technology */ +#define PCI_VENDOR_DPT 0x1044 /* Distributed Processing Technology */ +#define PCI_VENDOR_OPTI 0x1045 /* Opti */ +#define PCI_VENDOR_ELSA 0x1048 /* Elsa */ +#define PCI_VENDOR_SGSTHOMSON 0x104a /* SGS Thomson Microelectric */ +#define PCI_VENDOR_BUSLOGIC 0x104b /* BusLogic */ +#define PCI_VENDOR_TI 0x104c /* Texas Instruments */ +#define PCI_VENDOR_SONY 0x104d /* Sony */ +#define PCI_VENDOR_OAKTECH 0x104e /* Oak Technology */ +#define PCI_VENDOR_WINBOND 0x1050 /* Winbond Electronics */ +#define PCI_VENDOR_MOT 0x1057 /* Motorola */ +#define PCI_VENDOR_PROMISE 0x105a /* Promise Technology */ +#define PCI_VENDOR_NUMBER9 0x105d /* Number 9 Computer Company */ +#define PCI_VENDOR_UMC 0x1060 /* United Microelectronics */ +#define PCI_VENDOR_ITT 0x1061 /* I. T. T. */ +#define PCI_VENDOR_MYLEX 0x1069 /* Mylex */ +#define PCI_VENDOR_APPLE 0x106b /* Apple Computer */ +#define PCI_VENDOR_YAMAHA 0x1073 /* Yamaha */ +#define PCI_VENDOR_NEXGEN 0x1074 /* NexGen Microsystems */ +#define PCI_VENDOR_QLOGIC 0x1077 /* Q Logic */ +#define PCI_VENDOR_LEADTEK 0x107d /* LeadTek Research */ +#define PCI_VENDOR_CONTAQ 0x1080 /* Contaq Microsystems */ +#define PCI_VENDOR_BIT3 0x108a /* Bit3 Computer Corp. */ +#define PCI_VENDOR_OLICOM 0x108d /* Olicom */ +#define PCI_VENDOR_SUN 0x108e /* Sun Microsystems */ +#define PCI_VENDOR_INTERGRAPH 0x1091 /* Intergraph */ +#define PCI_VENDOR_DIAMOND 0x1092 /* Diamond Computer Systems */ +#define PCI_VENDOR_CMDTECH 0x1095 /* CMD Technology */ +#define PCI_VENDOR_QUANTUMDESIGNS 0x1098 /* Quantum Designs */ +#define PCI_VENDOR_BROOKTREE 0x109e /* Brooktree */ +#define PCI_VENDOR_SGI 0x10a9 /* Silicon Graphics */ +#define PCI_VENDOR_ACC 0x10aa /* ACC Microelectronics */ +#define PCI_VENDOR_SYMPHONY 0x10ad /* Symphony Labs */ +#define PCI_VENDOR_PLX 0x10b5 /* PLX Technology */ +#define PCI_VENDOR_MADGE 0x10b6 /* Madge Networks */ +#define PCI_VENDOR_3COM 0x10B7 /* 3Com */ +#define PCI_VENDOR_SMC 0x10b8 /* Standard Microsystems */ +#define PCI_VENDOR_ALI 0x10b9 /* Acer Labs */ +#define PCI_VENDOR_SURECOM 0x10bd /* Surecom Technology */ +#define PCI_VENDOR_SAMSUNGSEMI 0x10c3 /* Samsung Semiconductors */ +#define PCI_VENDOR_NEOMAGIC 0x10c8 /* Neomagic */ +#define PCI_VENDOR_ADVSYS 0x10cd /* Advanced System Products */ +#define PCI_VENDOR_MACRONIX 0x10d9 /* Macronix */ +#define PCI_VENDOR_ES 0x10dd /* Evans & Sutherland */ +#define PCI_VENDOR_NVIDIA 0x10de /* Nvidia Corporation */ +#define PCI_VENDOR_EMULEX 0x10df /* Emulex */ +#define PCI_VENDOR_IMS 0x10e0 /* Integrated Micro Solutions */ +#define PCI_VENDOR_TEKRAM 0x10e1 /* Tekram Technology (1st PCI Vendor ID) */ +#define PCI_VENDOR_NEWBRIDGE 0x10e3 /* Newbridge Microsystems / Tundra Semiconductor */ +#define PCI_VENDOR_AMCIRCUITS 0x10e8 /* Applied Micro Circuits */ +#define PCI_VENDOR_REALTEK 0x10ec /* Realtek Semiconductor */ +#define PCI_VENDOR_NKK 0x10f5 /* NKK Corporation */ +#define PCI_VENDOR_INITIO 0x1101 /* Initio */ +#define PCI_VENDOR_CREATIVELABS 0x1102 /* Creative Labs */ +#define PCI_VENDOR_TRIONES 0x1103 /* Triones Technologies */ +#define PCI_VENDOR_SIGMA 0x1105 /* Sigma Designs */ +#define PCI_VENDOR_VIATECH 0x1106 /* VIA Technologies */ +#define PCI_VENDOR_COGENT 0x1109 /* Cogent Data Technologies */ +#define PCI_VENDOR_RNS 0x1112 /* RNS */ +#define PCI_VENDOR_ACCTON 0x1113 /* Accton Technology */ +#define PCI_VENDOR_VORTEX 0x1119 /* Vortex Computer Systems */ +#define PCI_VENDOR_EFFICIENTNETS 0x111a /* Efficent Networks */ +#define PCI_VENDOR_IDT 0x111d /* IDT */ +#define PCI_VENDOR_FORE 0x1127 /* FORE Systems */ +#define PCI_VENDOR_ZIATECH 0x1138 /* Ziatech */ +#define PCI_VENDOR_ALLIANCE 0x1142 /* Alliance Semiconductor */ +#define PCI_VENDOR_SCHNEIDERKOCH 0x1148 /* Schneider & Koch */ +#define PCI_VENDOR_MUTECH 0x1159 /* Mutech */ +#define PCI_VENDOR_XIRCOM 0x115d /* Xircom */ +#define PCI_VENDOR_ALTERA 0x1172 /* Altera Corporation */ +#define PCI_VENDOR_TOSHIBA2 0x1179 /* Toshiba America Info Systems */ +#define PCI_VENDOR_RICOH 0x1180 /* Ricoh */ +#define PCI_VENDOR_DLINK 0x1186 /* D-Link Systems */ +#define PCI_VENDOR_COROLLARY 0x118c /* Corrollary */ +#define PCI_VENDOR_ACARD 0x1191 /* Acard */ +#define PCI_VENDOR_ZEINET 0x1193 /* Zeinet */ +#define PCI_VENDOR_GALILEO 0x11ab /* Galileo Technology */ +#define PCI_VENDOR_LITEON 0x11ad /* Lite-On Communications */ +#define PCI_VENDOR_V3 0x11b0 /* V3 Semiconductor */ +#define PCI_VENDOR_LUCENT 0x11c1 /* AT&T Microelectronics */ +#define PCI_VENDOR_DOLPHIN 0x11c8 /* Dolphin Interconnect Solutions */ +#define PCI_VENDOR_AURAVISION 0x11d1 /* Auravision */ +#define PCI_VENDOR_ZORAN 0x11de /* Zoran Corporation */ +#define PCI_VENDOR_COMPEX 0x11f6 /* Compex */ +#define PCI_VENDOR_PMCSIERRA 0x11f8 /* PMC-Sierra */ +#define PCI_VENDOR_CYCLADES 0x120e /* Cyclades */ +#define PCI_VENDOR_ESSENTIAL 0x120f /* Essential Communications */ +#define PCI_VENDOR_O2MICRO 0x1217 /* O2 Micro Inc */ +#define PCI_VENDOR_3DFX 0x121a /* 3Dfx Interactive */ +#define PCI_VENDOR_CCUBE 0x123f /* C-Cube Microsystems */ +#define PCI_VENDOR_AVM 0x1244 /* AVM */ +#define PCI_VENDOR_LINEARSYS 0x1254 /* Linear Systems */ +#define PCI_VENDOR_ASIX 0x125b /* ASIX Electronics */ +#define PCI_VENDOR_ESSTECH 0x125d /* ESS Technology Inc */ +#define PCI_VENDOR_SILMOTION 0x126f /* Silicon Motion */ +#define PCI_VENDOR_ENSONIQ 0x1274 /* Ensoniq */ +#define PCI_VENDOR_DAVICOM 0x1282 /* Davicom Semiconductor */ +#define PCI_VENDOR_ESSTECH2 0x1285 /* ESS Technology Inc */ +#define PCI_VENDOR_TRITECH 0x1292 /* TriTech Microelectronics */ +#define PCI_VENDOR_ALTEON 0x12ae /* Alteon */ +#define PCI_VENDOR_RISCOM 0x12aa /* RISCom */ +#define PCI_VENDOR_USR 0x12b9 /* US Robotics (3Com) */ +#define PCI_VENDOR_NVIDIA_SGS 0x12d2 /* Nvidia Corporation & SGS Thomson Microelectric */ +#define PCI_VENDOR_AUREAL 0x12eb /* Aureal Semiconductor */ +#define PCI_VENDOR_ADMTEK 0x1317 /* ADMtek */ +#define PCI_VENDOR_FORTEMEDIA 0x1319 /* Forte Media */ +#define PCI_VENDOR_DOMEX 0x134a /* Domex */ +#define PCI_VENDOR_LMC 0x1376 /* LAN Media Corporation */ +#define PCI_VENDOR_API 0x14d9 /* API Networks */ +#define PCI_VENDOR_CONEXANT 0x14f1 /* Conexant Systems */ +#define PCI_VENDOR_NETGEAR 0x1385 /* Netgear */ +#define PCI_VENDOR_3WARE 0x13c1 /* 3ware */ +#define PCI_VENDOR_SUNDANCETI 0x13f0 /* Sundance Technology */ +#define PCI_VENDOR_CMEDIA 0x13f6 /* C-Media Electronics Inc */ +#define PCI_VENDOR_DELTA 0x1500 /* Delta Electronics */ +#define PCI_VENDOR_SOLIDUM 0x1588 /* Solidum Systems Corp. */ +#define PCI_VENDOR_SIBYTE 0x166d /* SiByte, Inc. */ +#define PCI_VENDOR_SYMPHONY2 0x1c1c /* Symphony Labs (2nd PCI Vendor ID) */ +#define PCI_VENDOR_TEKRAM2 0x1de1 /* Tekram Technology (2nd PCI Vendor ID) */ +#define PCI_VENDOR_BROADCOM 0x14e4 /* Broadcom */ +#define PCI_VENDOR_3DLABS 0x3d3d /* 3D Labs */ +#define PCI_VENDOR_AVANCE2 0x4005 /* Avance Logic (2nd PCI Vendor ID) */ +#define PCI_VENDOR_ADDTRON 0x4033 /* Addtron Technology */ +#define PCI_VENDOR_NETVIN 0x4a14 /* NetVin */ +#define PCI_VENDOR_S3 0x5333 /* S3 */ +#define PCI_VENDOR_C4T 0x6374 /* c't Magazin */ +#define PCI_VENDOR_INTEL 0x8086 /* Intel */ +#define PCI_VENDOR_PROLAN 0x8c4a /* ProLAN */ +#define PCI_VENDOR_KTI 0x8e2e /* KTI */ +#define PCI_VENDOR_ADP 0x9004 /* Adaptec */ +#define PCI_VENDOR_ADP2 0x9005 /* Adaptec (2nd PCI Vendor ID) */ +#define PCI_VENDOR_ATRONICS 0x907f /* Atronics */ +#define PCI_VENDOR_ARC 0xedd8 /* ARC Logic */ +#define PCI_VENDOR_EPIGRAM 0xfeda /* Epigram */ +#define PCI_VENDOR_INVALID 0xffff /* INVALID VENDOR ID */ + +/* + * List of known products. Grouped by vendor. + */ + +/* 3COM Products */ +#define PCI_PRODUCT_3COM_3C985 0x0001 /* 3c985 Gigabit Ethernet */ +#define PCI_PRODUCT_3COM_3C590 0x5900 /* 3c590 Ethernet */ +#define PCI_PRODUCT_3COM_3C595TX 0x5950 /* 3c595-TX 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C595T4 0x5951 /* 3c595-T4 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C595MII 0x5952 /* 3c595-MII 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C900TPO 0x9000 /* 3c900-TPO Ethernet */ +#define PCI_PRODUCT_3COM_3C900COMBO 0x9001 /* 3c900-COMBO Ethernet */ +#define PCI_PRODUCT_3COM_3C905TX 0x9050 /* 3c905-TX 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C905T4 0x9051 /* 3c905-T4 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C900BTPO 0x9004 /* 3c900B-TPO Ethernet */ +#define PCI_PRODUCT_3COM_3C900BCOMBO 0x9005 /* 3c900B-COMBO Ethernet */ +#define PCI_PRODUCT_3COM_3C900BTPC 0x9006 /* 3c900B-TPC Ethernet */ +#define PCI_PRODUCT_3COM_3C905BTX 0x9055 /* 3c905B-TX 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C905BT4 0x9056 /* 3c905B-T4 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C905BCOMBO 0x9058 /* 3c905B-COMBO 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C905BFX 0x905a /* 3c905B-FX 100 Ethernet */ +#define PCI_PRODUCT_3COM_3C905CTX 0x9200 /* 3c905C-TX 10/100 Ethernet with mngmt */ +#define PCI_PRODUCT_3COM_3C980SRV 0x9800 /* 3c980 Server Adapter 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3C980CTXM 0x9805 /* 3c980C-TXM 10/100 Ethernet */ +#define PCI_PRODUCT_3COM_3CR990TX97 0x9903 /* 3CR990-TX-97 10/100 Ethernet */ + +/* 3Dfx Interactive producs */ +#define PCI_PRODUCT_3DFX_VOODOO 0x0001 /* Voodoo */ +#define PCI_PRODUCT_3DFX_VOODOO2 0x0002 /* Voodoo2 */ +#define PCI_PRODUCT_3DFX_BANSHEE 0x0003 /* Banshee */ +#define PCI_PRODUCT_3DFX_VOODOO3 0x0005 /* Voodoo3 */ + +/* 3D Labs products */ +#define PCI_PRODUCT_3DLABS_300SX 0x0001 /* GLINT 300SX */ +#define PCI_PRODUCT_3DLABS_500TX 0x0002 /* GLINT 500TX */ +#define PCI_PRODUCT_3DLABS_DELTA 0x0003 /* GLINT DELTA */ +#define PCI_PRODUCT_3DLABS_PERMEDIA 0x0004 /* GLINT Permedia */ +#define PCI_PRODUCT_3DLABS_500MX 0x0006 /* GLINT 500MX */ +#define PCI_PRODUCT_3DLABS_PERMEDI2 0x0007 /* GLINT Permedia 2 */ + +/* 3ware products */ +#define PCI_PRODUCT_3WARE_ESCALADE 0x1000 /* Escalade IDE RAID */ + +/* ACC Products */ +#define PCI_PRODUCT_ACC_2188 0x0000 /* ACCM 2188 VL-PCI Bridge */ +#define PCI_PRODUCT_ACC_2051_HB 0x2051 /* 2051 PCI Single Chip Solution (host bridge) */ +#define PCI_PRODUCT_ACC_2051_ISA 0x5842 /* 2051 PCI Single Chip Solution (ISA bridge) */ + +/* Acard products */ +#define PCI_PRODUCT_ACARD_AEC6710 0x8002 /* AEC6710 SCSI */ +#define PCI_PRODUCT_ACARD_AEC6712UW 0x8010 /* AEC6712UW SCSI */ +#define PCI_PRODUCT_ACARD_AEC6712U 0x8020 /* AEC6712U SCSI */ +#define PCI_PRODUCT_ACARD_AEC6712S 0x8030 /* AEC6712S SCSI */ +#define PCI_PRODUCT_ACARD_AEC6710D 0x8040 /* AEC6710D SCSI */ +#define PCI_PRODUCT_ACARD_AEC6715UW 0x8050 /* AEC6715UW SCSI */ + +/* Accton products */ +#define PCI_PRODUCT_ACCTON_MPX5030 0x1211 /* MPX 5030/5038 Ethernet */ + +/* Acer products */ +#define PCI_PRODUCT_ACER_M1435 0x1435 /* M1435 VL-PCI Bridge */ + +/* Acer Labs products */ +#define PCI_PRODUCT_ALI_M1445 0x1445 /* M1445 VL-PCI Bridge */ +#define PCI_PRODUCT_ALI_M1449 0x1449 /* M1449 PCI-ISA Bridge */ +#define PCI_PRODUCT_ALI_M1451 0x1451 /* M1451 Host-PCI Bridge */ +#define PCI_PRODUCT_ALI_M1461 0x1461 /* M1461 Host-PCI Bridge */ +#define PCI_PRODUCT_ALI_M1531 0x1531 /* M1531 Host-PCI Bridge */ +#define PCI_PRODUCT_ALI_M1541 0x1541 /* M1541 Host-PCI Bridge */ +#define PCI_PRODUCT_ALI_M1543 0x1533 /* M1543 PCI-ISA Bridge */ +#define PCI_PRODUCT_ALI_M3309 0x3309 /* M3309 MPEG Decoder */ +#define PCI_PRODUCT_ALI_M4803 0x5215 /* M4803 */ +#define PCI_PRODUCT_ALI_M5229 0x5229 /* M5229 UDMA IDE Controller */ +#define PCI_PRODUCT_ALI_M5237 0x5237 /* M5237 USB Host Controller */ +#define PCI_PRODUCT_ALI_M7101 0x7101 /* M7101 Power Management Controller */ + +/* Adaptec products */ +#define PCI_PRODUCT_ADP_AIC7850 0x5078 /* AIC-7850 */ +#define PCI_PRODUCT_ADP_AIC7855 0x5578 /* AIC-7855 */ +#define PCI_PRODUCT_ADP_AIC5900 0x5900 /* AIC-5900 ATM */ +#define PCI_PRODUCT_ADP_AIC5905 0x5905 /* AIC-5905 ATM */ +#define PCI_PRODUCT_ADP_AIC6915 0x6915 /* AIC-6915 10/100 Ethernet */ +#define PCI_PRODUCT_ADP_AIC7860 0x6078 /* AIC-7860 */ +#define PCI_PRODUCT_ADP_APA1480 0x6075 /* APA-1480 Ultra */ +#define PCI_PRODUCT_ADP_2940AU 0x6178 /* AHA-2940A Ultra */ +#define PCI_PRODUCT_ADP_AIC7870 0x7078 /* AIC-7870 */ +#define PCI_PRODUCT_ADP_2940 0x7178 /* AHA-2940 */ +#define PCI_PRODUCT_ADP_3940 0x7278 /* AHA-3940 */ +#define PCI_PRODUCT_ADP_3985 0x7378 /* AHA-3985 */ +#define PCI_PRODUCT_ADP_2944 0x7478 /* AHA-2944 */ +#define PCI_PRODUCT_ADP_AIC7895 0x7895 /* AIC-7895 Ultra */ +#define PCI_PRODUCT_ADP_AIC7880 0x8078 /* AIC-7880 Ultra */ +#define PCI_PRODUCT_ADP_2940U 0x8178 /* AHA-2940 Ultra */ +#define PCI_PRODUCT_ADP_3940U 0x8278 /* AHA-3940 Ultra */ +#define PCI_PRODUCT_ADP_389XU 0x8378 /* AHA-389X Ultra */ +#define PCI_PRODUCT_ADP_2944U 0x8478 /* AHA-2944 Ultra */ +#define PCI_PRODUCT_ADP_2940UP 0x8778 /* AHA-2940 Ultra Pro */ + +#define PCI_PRODUCT_ADP2_2940U2 0x0010 /* AHA-2940 Ultra2 */ +#define PCI_PRODUCT_ADP2_2930U2 0x0011 /* AHA-2930 Ultra2 */ +#define PCI_PRODUCT_ADP2_AIC7890 0x001f /* AIC-7890/1 */ +#define PCI_PRODUCT_ADP2_3950U2B 0x0050 /* AHA-3950 Ultra2 */ +#define PCI_PRODUCT_ADP2_3950U2D 0x0051 /* AHA-3950 Ultra2 */ +#define PCI_PRODUCT_ADP2_AIC7896 0x005f /* AIC-7896/7 */ + +/* Addtron Products */ +#define PCI_PRODUCT_ADDTRON_8139 0x1360 /* 8139 Ethernet */ + +/* ADMtek products */ +#define PCI_PRODUCT_ADMTEK_AL981 0x0981 /* ADMtek AL981 10/100 Ethernet */ + +/* Advanced System Products */ +#define PCI_PRODUCT_ADVSYS_1200A 0x1100 +#define PCI_PRODUCT_ADVSYS_1200B 0x1200 +#define PCI_PRODUCT_ADVSYS_ULTRA 0x1300 /* ABP-930/40UA */ +#define PCI_PRODUCT_ADVSYS_WIDE 0x2300 /* ABP-940UW */ +#define PCI_PRODUCT_ADVSYS_U2W 0x2500 /* ASB-3940U2W */ +#define PCI_PRODUCT_ADVSYS_U3W 0x2700 /* ASB-3940U3W */ + +/* Alliance products */ +#define PCI_PRODUCT_ALLIANCE_AT24 0x6424 /* AT24 */ +#define PCI_PRODUCT_ALLIANCE_AT25 0x643d /* AT25 */ + +/* Alteon products */ +#define PCI_PRODUCT_ALTEON_ACENIC 0x0001 /* ACEnic Gigabit Ethernet */ + +/* AMD products */ +#define PCI_PRODUCT_AMD_PCNET_PCI 0x2000 /* 79c970 PCnet-PCI LANCE Ethernet */ +#define PCI_PRODUCT_AMD_PCNET_HOME 0x2001 /* 79c978 PCnet-PCI Home */ +#define PCI_PRODUCT_AMD_PCSCSI_PCI 0x2020 /* 53c974 PCscsi-PCI SCSI */ +#define PCI_PRODUCT_AMD_PCNETS_PCI 0x2040 /* 79C974 PCnet-PCI Ethernet & SCSI */ +#define PCI_PRODUCT_AMD_SC751_SC 0x7006 /* AMD751 System Controller */ +#define PCI_PRODUCT_AMD_SC751_PPB 0x7007 /* AMD751 PCI-to-PCI Bridge */ +#define PCI_PRODUCT_AMD_PBC756_ISA 0x7408 /* AMD756 PCI-to-ISA Bridge */ +#define PCI_PRODUCT_AMD_PBC756_IDE 0x7409 /* AMD756 IDE controller */ +#define PCI_PRODUCT_AMD_PBC756_PMC 0x740B /* AMD756 Power Management Controller */ +#define PCI_PRODUCT_AMD_PBC756_USB 0x740C /* AMD756 USB Host Controller */ +#define PCI_PRODUCT_AMD_HT7520 0x7450 /* (PLX) HT7520 PCIX Tunnel */ +#define PCI_PRODUCT_AMD_HT7520_PIC 0x7451 /* (PLX) HT7520 PCIX IOAPIC */ +#define PCI_PRODUCT_AMD_AMD8151_AGP 0x7454 /* AMD8151 AGP Device */ +#define PCI_PRODUCT_AMD_AMD8151 0x7455 /* AMD8151 HyperTransport-AGP Bridge */ + +/* API Networks products */ +#define PCI_PRODUCT_API_STURGEON 0x0010 /* AP1011 HyperTransport-PCI Bridge */ + +/* Apple products */ +#define PCI_PRODUCT_APPLE_BANDIT 0x0001 /* Bandit Host-PCI Bridge */ +#define PCI_PRODUCT_APPLE_GC 0x0002 /* Grand Central I/O Controller */ +#define PCI_PRODUCT_APPLE_CONTROL 0x0003 /* Control */ +#define PCI_PRODUCT_APPLE_PLANB 0x0004 /* PlanB */ +#define PCI_PRODUCT_APPLE_OHARE 0x0007 /* OHare I/O Controller */ +#define PCI_PRODUCT_APPLE_BANDIT2 0x0008 /* Bandit Host-PCI Bridge */ +#define PCI_PRODUCT_APPLE_HEATHROW 0x0010 /* MAC-IO I/O Controller (Heathrow) */ +#define PCI_PRODUCT_APPLE_PADDINGTON 0x0017 /* MAC-IO I/O Controller (Paddington) */ +#define PCI_PRODUCT_APPLE_KEYLARGO_USB 0x0019 /* KeyLargo USB Controller */ +#define PCI_PRODUCT_APPLE_UNINORTH1 0x001e /* UniNorth Host-PCI Bridge */ +#define PCI_PRODUCT_APPLE_UNINORTH2 0x001f /* UniNorth Host-PCI Bridge */ +#define PCI_PRODUCT_APPLE_UNINORTH_AGP 0x0020 /* UniNorth AGP Interface */ +#define PCI_PRODUCT_APPLE_GMAC 0x0021 /* GMAC Ethernet */ +#define PCI_PRODUCT_APPLE_KEYLARGO 0x0022 /* MAC-IO I/O Controller (KeyLargo) */ + +/* ARC Logic products */ +#define PCI_PRODUCT_ARC_1000PV 0xa091 /* 1000PV */ +#define PCI_PRODUCT_ARC_2000PV 0xa099 /* 2000PV */ +#define PCI_PRODUCT_ARC_2000MT 0xa0a1 /* 2000MT */ + +/* ASIX Electronics products */ +#define PCI_PRODUCT_ASIX_AX88140A 0x1400 /* AX88140A 10/100 Ethernet */ + +/* ATI products */ +#define PCI_PRODUCT_ATI_MACH32 0x4158 /* Mach32 */ +#define PCI_PRODUCT_ATI_MACH64_CT 0x4354 /* Mach64 CT */ +#define PCI_PRODUCT_ATI_MACH64_CX 0x4358 /* Mach64 CX */ +#define PCI_PRODUCT_ATI_MACH64_ET 0x4554 /* Mach64 ET */ +#define PCI_PRODUCT_ATI_MACH64_VT 0x4654 /* Mach64 VT */ +#define PCI_PRODUCT_ATI_MACH64_B 0x4750 /* Mach64 B */ +#define PCI_PRODUCT_ATI_MACH64_GB 0x4742 /* Mach64 GB */ +#define PCI_PRODUCT_ATI_MACH64_GD 0x4744 /* Mach64 GD */ +#define PCI_PRODUCT_ATI_MACH64_GI 0x4749 /* Mach64 GI */ +#define PCI_PRODUCT_ATI_MACH64_GP 0x4750 /* Mach64 GP */ +#define PCI_PRODUCT_ATI_MACH64_GQ 0x4751 /* Mach64 GQ */ +#define PCI_PRODUCT_ATI_MACH64_GT 0x4754 /* Mach64 GT */ +#define PCI_PRODUCT_ATI_MACH64_GU 0x4755 /* Mach64 GU */ +#define PCI_PRODUCT_ATI_MACH64_GV 0x4756 /* Mach64 GV */ +#define PCI_PRODUCT_ATI_MACH64_GW 0x4757 /* Mach64 GW */ +#define PCI_PRODUCT_ATI_MACH64_GX 0x4758 /* Mach64 GX */ +#define PCI_PRODUCT_ATI_MACH64_GZ 0x475a /* Mach64 GZ */ +#define PCI_PRODUCT_ATI_MACH64_LB 0x4c42 /* Mach64 LB */ +#define PCI_PRODUCT_ATI_MACH64_LD 0x4c44 /* Mach64 LD */ +#define PCI_PRODUCT_ATI_MACH64_LG 0x4c47 /* Mach64 LG */ +#define PCI_PRODUCT_ATI_MACH64_LI 0x4c49 /* Mach64 LI */ +#define PCI_PRODUCT_ATI_MACH64_LM 0x4c4d /* Mach64 LM */ +#define PCI_PRODUCT_ATI_MACH64_LP 0x4c50 /* Mach64 LP */ +#define PCI_PRODUCT_ATI_MACH64_LR 0x4c52 /* Mach64 LR */ + +/* Auravision products */ +#define PCI_PRODUCT_AURAVISION_VXP524 0x01f7 /* VxP524 PCI Video Processor */ + +/* Aureal Semiconductor */ +#define PCI_PRODUCT_AUREAL_AU8820 0x0001 /* AU8820 Vortex Digital Audio Processor */ + +/* Applied Micro Circuts products */ +#define PCI_PRODUCT_AMCIRCUITS_S5933 0x4750 /* S5933 PCI Matchmaker */ +#define PCI_PRODUCT_AMCIRCUITS_LANAI 0x8043 /* Myrinet LANai Interface */ +#define PCI_PRODUCT_AMCIRCUITS_S5920 0x5920 /* S5920 PCI Target */ + +/* Atronics products */ +#define PCI_PRODUCT_ATRONICS_IDE_2015PL 0x2015 /* IDE-2015PL */ + +/* Avance Logic products */ +#define PCI_PRODUCT_AVANCE_AVL2301 0x2301 /* AVL2301 */ +#define PCI_PRODUCT_AVANCE_AVG2302 0x2302 /* AVG2302 */ +#define PCI_PRODUCT_AVANCE2_ALG2301 0x2301 /* ALG2301 */ +#define PCI_PRODUCT_AVANCE2_ALG2302 0x2302 /* ALG2302 */ + +/* CCUBE products */ +#define PCI_PRODUCT_CCUBE_CINEMASTER 0x8888 /* Cinemaster C 3.0 DVD Decoder */ + +/* AVM products */ +#define PCI_PRODUCT_AVM_FRITZ_CARD 0x0a00 /* Fritz! Card ISDN Interface */ + +/* Bit3 products */ +#define PCI_PRODUCT_BIT3_PCIVME617 0x0001 /* PCI-VME Interface Mod. 617 */ +#define PCI_PRODUCT_BIT3_PCIVME618 0x0010 /* PCI-VME Interface Mod. 618 */ +#define PCI_PRODUCT_BIT3_PCIVME2706 0x0300 /* PCI-VME Interface Mod. 2706 */ + +/* Broadcom products */ +#define PCI_PRODUCT_BROADCOM_BCM4211 0x4211 /* BCM4211 iLine10 Controller */ +#define PCI_PRODUCT_BROADCOM_BCM4212 0x4212 /* BCM4212 V.90 Modem */ +#define PCI_PRODUCT_BROADCOM_BCM5700 0x1644 /* BCM5700 10/100/1000 Ethernet */ +#define PCI_PRODUCT_BROADCOM_BCM5701 0x1645 /* BCM5701 10/100/1000 Ethernet */ +#define PCI_PRODUCT_BROADCOM_BCM5702 0x16a6 /* BCM5702 10/100/1000 Ethernet */ +#define PCI_PRODUCT_BROADCOM_BCM5703 0x16a7 /* BCM5703 10/100/1000 Ethernet */ +#define PCI_PRODUCT_BROADCOM_BCM5705 0x1653 /* BCM5705 10/100/1000 Ethernet */ +#define PCI_PRODUCT_BROADCOM_BCM5820 0x5820 /* BCM5820 eCommerce Processor */ +#define PCI_PRODUCT_BROADCOM_BCM5821 0x5821 /* BCM5821 Super-eCommerce Processor */ +#define PCI_PRODUCT_BROADCOM_BCM5850 0x5850 /* BCM5850 SSL/TLS Protocol Processor */ + +/* Brooktree products */ +#define PCI_PRODUCT_BROOKTREE_BT848 0x0350 /* Bt848 Video Capture */ +#define PCI_PRODUCT_BROOKTREE_BT849 0x0351 /* Bt849 Video Capture */ +#define PCI_PRODUCT_BROOKTREE_BT878 0x036e /* Bt878 Video Capture */ +#define PCI_PRODUCT_BROOKTREE_BT879 0x036f /* Bt879 Video Capture */ + +/* BusLogic products */ +#define PCI_PRODUCT_BUSLOGIC_MULTIMASTER_NC 0x0140 /* MultiMaster NC */ +#define PCI_PRODUCT_BUSLOGIC_MULTIMASTER 0x1040 /* MultiMaster */ +#define PCI_PRODUCT_BUSLOGIC_FLASHPOINT 0x8130 /* FlashPoint */ + +/* c't Magazin products */ +#define PCI_PRODUCT_C4T_GPPCI 0x6773 /* GPPCI */ + +/* Chips and Technologies products */ +#define PCI_PRODUCT_CHIPS_64310 0x00b8 /* 64310 */ +#define PCI_PRODUCT_CHIPS_65545 0x00d8 /* 65545 */ +#define PCI_PRODUCT_CHIPS_65548 0x00dc /* 65548 */ +#define PCI_PRODUCT_CHIPS_65550 0x00e0 /* 65550 */ +#define PCI_PRODUCT_CHIPS_65554 0x00e4 /* 65554 */ + +/* Cirrus Logic products */ +#define PCI_PRODUCT_CIRRUS_CL_GD7548 0x0038 /* CL-GD7548 */ +#define PCI_PRODUCT_CIRRUS_CL_GD5430 0x00a0 /* CL-GD5430 */ +#define PCI_PRODUCT_CIRRUS_CL_GD5434_4 0x00a4 /* CL-GD5434-4 */ +#define PCI_PRODUCT_CIRRUS_CL_GD5434_8 0x00a8 /* CL-GD5434-8 */ +#define PCI_PRODUCT_CIRRUS_CL_GD5436 0x00ac /* CL-GD5436 */ +#define PCI_PRODUCT_CIRRUS_CL_GD5446 0x00b8 /* CL-GD5446 */ +#define PCI_PRODUCT_CIRRUS_CL_GD5480 0x00bc /* CL-GD5480 */ +#define PCI_PRODUCT_CIRRUS_CL_PD6729 0x1100 /* CL-PD6729 */ +#define PCI_PRODUCT_CIRRUS_CL_PD6832 0x1110 /* CL-PD6832 PCI-CardBus Bridge */ +#define PCI_PRODUCT_CIRRUS_CL_PD6833 0x1113 /* CL-PD6833 PCI-CardBus Bridge */ +#define PCI_PRODUCT_CIRRUS_CL_GD7542 0x1200 /* CL-GD7542 */ +#define PCI_PRODUCT_CIRRUS_CL_GD7543 0x1202 /* CL-GD7543 */ +#define PCI_PRODUCT_CIRRUS_CL_GD7541 0x1204 /* CL-GD7541 */ +#define PCI_PRODUCT_CIRRUS_CL_CD4400 0x4400 /* CL-CD4400 Communications Controller */ +#define PCI_PRODUCT_CIRRUS_CS4610 0x6001 /* CS4610 SoundFusion Audio Accelerator */ +#define PCI_PRODUCT_CIRRUS_CS4280 0x6003 /* CS4280 CrystalClear Audio Interface */ + +/* CMD Technology products -- info gleaned from their web site */ +#define PCI_PRODUCT_CMDTECH_640 0x0640 /* PCI0640 */ +/* No data on the CMD Tech. web site for the following as of Mar. 3 '98 */ +#define PCI_PRODUCT_CMDTECH_642 0x0642 /* PCI0642 */ +/* datasheets available from www.cmd.com for the followings */ +#define PCI_PRODUCT_CMDTECH_643 0x0643 /* PCI0643 */ +#define PCI_PRODUCT_CMDTECH_646 0x0646 /* PCI0646 */ +#define PCI_PRODUCT_CMDTECH_647 0x0647 /* PCI0647 */ +#define PCI_PRODUCT_CMDTECH_648 0x0648 /* PCI0648 */ +#define PCI_PRODUCT_CMDTECH_649 0x0649 /* PCI0649 */ + +/* Inclusion of 'A' in the following entry is probably wrong. */ +/* No data on the CMD Tech. web site for the following as of Mar. 3 '98 */ +#define PCI_PRODUCT_CMDTECH_650A 0x0650 /* PCI0650A */ +#define PCI_PRODUCT_CMDTECH_670 0x0670 /* USB0670 */ +#define PCI_PRODUCT_CMDTECH_673 0x0673 /* USB0673 */ + +/* C-Media products */ +#define PCI_PRODUCT_CMEDIA_CMI8338A 0x0100 /* CMI8338A PCI Audio Device */ +#define PCI_PRODUCT_CMEDIA_CMI8338B 0x0101 /* CMI8338B PCI Audio Device */ +#define PCI_PRODUCT_CMEDIA_CMI8738 0x0111 /* CMI8738/C3DX PCI Audio Device */ +#define PCI_PRODUCT_CMEDIA_HSP56 0x0211 /* HSP56 Audiomodem Riser */ + +/* Cogent Data Technologies products */ +#define PCI_PRODUCT_COGENT_EM110TX 0x1400 /* EX110TX PCI Fast Ethernet Adapter */ + +/* Compaq products */ +#define PCI_PRODUCT_COMPAQ_PCI_EISA_BRIDGE 0x0001 /* PCI-EISA Bridge */ +#define PCI_PRODUCT_COMPAQ_PCI_ISA_BRIDGE 0x0002 /* PCI-ISA Bridge */ +#define PCI_PRODUCT_COMPAQ_TRIFLEX1 0x1000 /* Triflex Host-PCI Bridge */ +#define PCI_PRODUCT_COMPAQ_TRIFLEX2 0x2000 /* Triflex Host-PCI Bridge */ +#define PCI_PRODUCT_COMPAQ_QVISION_V0 0x3032 /* QVision */ +#define PCI_PRODUCT_COMPAQ_QVISION_1280P 0x3033 /* QVision 1280/p */ +#define PCI_PRODUCT_COMPAQ_QVISION_V2 0x3034 /* QVision */ +#define PCI_PRODUCT_COMPAQ_TRIFLEX4 0x4000 /* Triflex Host-PCI Bridge */ +#define PCI_PRODUCT_COMPAQ_USB 0x7020 /* USB Controller */ +#define PCI_PRODUCT_COMPAQ_SMART2P 0xae10 /* SMART2P RAID */ +#define PCI_PRODUCT_COMPAQ_N100TX 0xae32 /* Netelligent 10/100 TX */ +#define PCI_PRODUCT_COMPAQ_N10T 0xae34 /* Netelligent 10 T */ +#define PCI_PRODUCT_COMPAQ_IntNF3P 0xae35 /* Integrated NetFlex 3/P */ +#define PCI_PRODUCT_COMPAQ_DPNet100TX 0xae40 /* Dual Port Netelligent 10/100 TX */ +#define PCI_PRODUCT_COMPAQ_IntPL100TX 0xae43 /* ProLiant Integrated Netelligent 10/100 TX */ +#define PCI_PRODUCT_COMPAQ_DP4000 0xb011 /* Deskpro 4000 5233MMX */ +#define PCI_PRODUCT_COMPAQ_NF3P_BNC 0xf150 /* NetFlex 3/P w/ BNC */ +#define PCI_PRODUCT_COMPAQ_NF3P 0xf130 /* NetFlex 3/P */ + +/* Compex products - XXX better descriptions */ +#define PCI_PRODUCT_COMPEX_NE2KETHER 0x1401 /* Ethernet */ +#define PCI_PRODUCT_COMPEX_RL100ATX 0x2011 /* RL100-ATX 10/100 Ethernet */ +#define PCI_PRODUCT_COMPEX_RL100TX 0x9881 /* RL100-TX 10/100 Ethernet */ + +/* Conexant Systems products */ +#define PCI_PRODUCT_CONEXANT_SOFTK56 0x2443 /* SoftK56 PCI Software Modem */ + +/* Contaq Microsystems products */ +#define PCI_PRODUCT_CONTAQ_82C599 0x0600 /* 82C599 PCI-VLB Bridge */ +#define PCI_PRODUCT_CONTAQ_82C693 0xc693 /* 82C693 PCI-ISA Bridge */ + +/* Corollary Products */ +#define PCI_PRODUCT_COROLLARY_CBUSII_PCIB 0x0014 /* \"C-Bus II\"-PCI Bridge */ + +/* Creative Labs products */ +#define PCI_PRODUCT_CREATIVELABS_SBLIVE 0x0002 /* SBLive! EMU 10000 */ +#define PCI_PRODUCT_CREATIVELABS_SBJOY 0x7002 /* PCI Gameport Joystick */ +#define PCI_PRODUCT_CREATIVELABS_EV1938 0x8938 /* Ectiva 1938 */ + +/* Cyclades products */ +#define PCI_PRODUCT_CYCLADES_CYCLOMY_1 0x0100 /* Cyclom-Y below 1M */ +#define PCI_PRODUCT_CYCLADES_CYCLOMY_2 0x0101 /* Cyclom-Y above 1M */ +#define PCI_PRODUCT_CYCLADES_CYCLOM4Y_1 0x0102 /* Cyclom-4Y below 1M */ +#define PCI_PRODUCT_CYCLADES_CYCLOM4Y_2 0x0103 /* Cyclom-4Y above 1M */ +#define PCI_PRODUCT_CYCLADES_CYCLOM8Y_1 0x0104 /* Cyclom-8Y below 1M */ +#define PCI_PRODUCT_CYCLADES_CYCLOM8Y_2 0x0105 /* Cyclom-8Y above 1M */ +#define PCI_PRODUCT_CYCLADES_CYCLOMZ_1 0x0200 /* Cyclom-Z below 1M */ +#define PCI_PRODUCT_CYCLADES_CYCLOMZ_2 0x0201 /* Cyclom-Z above 1M */ + +/* Davicom Semiconductor products */ +#define PCI_PRODUCT_DAVICOM_DM9102 0x9102 /* Davicom DM9102 10/100 Ethernet */ + +/* DEC products */ +#define PCI_PRODUCT_DEC_21050 0x0001 /* DECchip 21050 PCI-PCI Bridge */ +#define PCI_PRODUCT_DEC_21040 0x0002 /* DECchip 21040 Ethernet */ +#define PCI_PRODUCT_DEC_21030 0x0004 /* DECchip 21030 (\"TGA\") */ +#define PCI_PRODUCT_DEC_NVRAM 0x0007 /* Zephyr NV-RAM */ +#define PCI_PRODUCT_DEC_KZPSA 0x0008 /* KZPSA */ +#define PCI_PRODUCT_DEC_21140 0x0009 /* DECchip 21140 10/100 Ethernet */ +#define PCI_PRODUCT_DEC_PBXGB 0x000d /* TGA2 */ +#define PCI_PRODUCT_DEC_DEFPA 0x000f /* DEFPA */ +/* product DEC ??? 0x0010 ??? VME Interface */ +#define PCI_PRODUCT_DEC_21041 0x0014 /* DECchip 21041 Ethernet */ +#define PCI_PRODUCT_DEC_DGLPB 0x0016 /* DGLPB (\"OPPO\") */ +#define PCI_PRODUCT_DEC_21142 0x0019 /* DECchip 21142/21143 10/100 Ethernet */ +#define PCI_PRODUCT_DEC_21052 0x0021 /* DECchip 21052 PCI-PCI Bridge */ +#define PCI_PRODUCT_DEC_21150 0x0022 /* DECchip 21150 PCI-PCI Bridge */ +#define PCI_PRODUCT_DEC_21152 0x0024 /* DECchip 21152 PCI-PCI Bridge */ +#define PCI_PRODUCT_DEC_21153 0x0025 /* DECchip 21153 PCI-PCI Bridge */ +#define PCI_PRODUCT_DEC_21154 0x0026 /* DECchip 21154 PCI-PCI Bridge */ +#define PCI_PRODUCT_DEC_CPQ42XX 0x0046 /* Compaq SMART RAID 42xx */ + +/* Delta products */ +#define PCI_PRODUCT_DELTA_8139 0x1360 /* 8139 Ethernet */ + +/* Diamond products */ +#define PCI_PRODUCT_DIAMOND_VIPER 0x9001 /* Viper/PCI */ + +/* D-Link Systems products */ +#define PCI_PRODUCT_DLINK_DFE550TX 0x1002 /* DFE-550TX 10/100 Ethernet */ + +/* Distributed Processing Technology products */ +#define PCI_PRODUCT_DPT_SC_RAID 0xa400 /* SmartCache/SmartRAID */ +#define PCI_PRODUCT_DPT_RAID_I2O 0xa501 /* SmartRAID (I2O) */ +#define PCI_PRODUCT_DPT_MEMCTLR 0x1012 /* Memory Controller */ + +/* Dolphin products */ +#define PCI_PRODUCT_DOLPHIN_PCISCI 0x0658 /* PCI-SCI Bridge */ + +/* Domex products */ +#define PCI_PRODUCT_DOMEX_PCISCSI 0x0001 /* DMX-3191D */ + +/* ELSA products */ +#define PCI_PRODUCT_ELSA_QS1PCI 0x1000 /* QuickStep 1000 ISDN card */ + +/* Emulex products */ +#define PCI_PRODUCT_EMULEX_LPPFC 0x10df /* \"Light Pulse\" FibreChannel adapter */ + +/* Ensoniq products */ +#define PCI_PRODUCT_ENSONIQ_AUDIOPCI 0x5000 /* AudioPCI */ +#define PCI_PRODUCT_ENSONIQ_AUDIOPCI97 0x1371 /* AudioPCI 97 */ +#define PCI_PRODUCT_ENSONIQ_CT5880 0x5880 /* CT5880 */ + +/* Epigram (now Broadcom) products */ +#define PCI_PRODUCT_EPIGRAM_BCM4210 0xa0fa /* BCM4210 iLine10 Controller */ + +/* Essential Communications products */ +#define PCI_PRODUCT_ESSENTIAL_RR_HIPPI 0x0001 /* RoadRunner HIPPI Interface */ +#define PCI_PRODUCT_ESSENTIAL_RR_GIGE 0x0005 /* RoadRunner Gig-E Interface */ + +/* ESS Technology Inc products */ +#define PCI_PRODUCT_ESSTECH_MAESTRO1 0x0100 /* Maestro 1 PCI Audio Accelerator */ +#define PCI_PRODUCT_ESSTECH_MAESTRO2 0x1968 /* Maestro 2 PCI Audio Accelerator */ +#define PCI_PRODUCT_ESSTECH_SOLO1 0x1969 /* Solo-1 PCI AudioDrive */ +#define PCI_PRODUCT_ESSTECH_MAESTRO2E 0x1978 /* Maestro 2E PCI Audio Accelerator */ +#define PCI_PRODUCT_ESSTECH_MAESTRO3 0x1998 /* Maestro 3 PCI Audio Accelerator */ +#define PCI_PRODUCT_ESSTECH_MAESTRO3MODEM 0x1999 /* Maestro 3 Modem */ + +/* ESS Technology Inc products */ +#define PCI_PRODUCT_ESSTECH2_MAESTRO1 0x0100 /* Maestro 1 PCI Audio Accelerator */ + +/* O2 Micro Inc */ +#define PCI_PRODUCT_O2MICRO_OZ6832 0x6832 /* OZ6832 CardBus Controller */ + +/* Evans & Sutherland products */ +#define PCI_PRODUCT_ES_FREEDOM 0x0001 /* Freedom PCI-GBus Interface */ + +/* FORE products */ +#define PCI_PRODUCT_FORE_PCA200 0x0210 /* ATM PCA-200 */ +#define PCI_PRODUCT_FORE_PCA200E 0x0300 /* ATM PCA-200e */ + +/* Forte Media products */ +#define PCI_PRODUCT_FORTEMEDIA_FM801 0x0801 /* Forte Media 801 Sound */ + +/* Future Domain products */ +#define PCI_PRODUCT_FUTUREDOMAIN_TMC_18C30 0x0000 /* TMC-18C30 (36C70) */ + +/* Efficient Networks products */ +#define PCI_PRODUCT_EFFICIENTNETS_ENI155PF 0x0000 /* 155P-MF1 ATM (FPGA) */ +#define PCI_PRODUCT_EFFICIENTNETS_ENI155PA 0x0002 /* 155P-MF1 ATM (ASIC) */ +#define PCI_PRODUCT_EFFICIENTNETS_ENI25P 0x0003 /* SpeedStream ENI-25p */ +#define PCI_PRODUCT_EFFICIENTNETS_SS3000 0x0005 /* SpeedStream 3000 */ + +/* Galileo Technology products */ +#define PCI_PRODUCT_GALILEO_GT64010A 0x0146 /* GT-64010A System Controller */ +#define PCI_PRODUCT_GALILEO_GT64115 0x4111 /* GT-64115 System Controller */ +#define PCI_PRODUCT_GALILEO_GT64011 0x4146 /* GT-64011 System Controller */ +#define PCI_PRODUCT_GALILEO_GT64120 0x4620 /* GT-64120 System Controller */ +#define PCI_PRODUCT_GALILEO_GT64130 0x6320 /* GT-64130 System Controller */ + +/* Hewlett-Packard products */ +#define PCI_PRODUCT_HP_J2585A 0x1030 /* J2585A */ + +/* IBM products */ +#define PCI_PRODUCT_IBM_MCABRIDGE 0x0002 /* MCA Bridge */ +#define PCI_PRODUCT_IBM_ALTALITE 0x0005 /* CPU Bridge - Alta Lite */ +#define PCI_PRODUCT_IBM_ALTAMP 0x0007 /* CPU Bridge - Alta MP */ +#define PCI_PRODUCT_IBM_ISABRIDGE 0x000a /* ISA Bridge w/PnP */ +#define PCI_PRODUCT_IBM_CPUBRIDGE 0x0017 /* CPU Bridge */ +#define PCI_PRODUCT_IBM_LANSTREAMER 0x0018 /* Auto LANStreamer */ +#define PCI_PRODUCT_IBM_GXT150P 0x001b /* GXT-150P 2D Accelerator */ +#define PCI_PRODUCT_IBM_MCABRIDGE2 0x0020 /* MCA Bridge */ +#define PCI_PRODUCT_IBM_82351 0x0022 /* 82351 PCI-PCI Bridge */ +#define PCI_PRODUCT_IBM_SERVERAID 0x002e /* ServeRAID */ +#define PCI_PRODUCT_IBM_OLYMPIC 0x003e /* Token Ring */ +#define PCI_PRODUCT_IBM_MIAMI 0x0036 /* Miami/PCI */ +#define PCI_PRODUCT_IBM_TURBOWAYS25 0x0053 /* Turboways 25 ATM */ +#define PCI_PRODUCT_IBM_MPIC2 0xffff /* MPIC-II */ + +/* IDT products */ +#define PCI_PRODUCT_IDT_77201 0x0001 /* 77201/77211 ATM (\"NICStAR\") */ + +/* Initio products */ +#define PCI_PRODUCT_INITIO_I920 0x0002 /* INIC-920 SCSI */ +#define PCI_PRODUCT_INITIO_I940 0x9400 /* INIC-940 SCSI */ +#define PCI_PRODUCT_INITIO_I935 0x9401 /* INIC-935 SCSI */ +#define PCI_PRODUCT_INITIO_I950 0x9500 /* INIC-950 SCSI */ + +/* Integrated Micro Solutions products */ +#define PCI_PRODUCT_IMS_8849 0x8849 /* 8849 */ +#define PCI_PRODUCT_IMS_TT128M 0x9128 /* TwinTurbo 128M */ + +/* Intel products */ +#define PCI_PRODUCT_INTEL_PCEB 0x0482 /* 82375EB/SB PCI-EISA Bridge (PCEB) */ +#define PCI_PRODUCT_INTEL_CDC 0x0483 /* 82424ZX Cache and DRAM controller (CDC) */ +#define PCI_PRODUCT_INTEL_SIO 0x0484 /* 82378ZB System I/O (SIO) */ +#define PCI_PRODUCT_INTEL_82426EX 0x0486 /* 82426EX PCI-to-ISA Bridge (PCIB) */ +#define PCI_PRODUCT_INTEL_PCMC 0x04a3 /* 82434LX/NX PCI, Cache and Memory Controller (PCMC) */ +#define PCI_PRODUCT_INTEL_IN_BUSINESS 0x1030 /* InBusiness Fast Ethernet LAN Controller */ +#define PCI_PRODUCT_INTEL_82559ER 0x1209 /* 82559ER Fast Ethernet LAN Controller */ +#define PCI_PRODUCT_INTEL_82092AA 0x1222 /* 82092AA IDE controller */ +#define PCI_PRODUCT_INTEL_SAA7116 0x1223 /* SAA7116 */ +#define PCI_PRODUCT_INTEL_82596 0x1226 /* 82596 LAN Controller */ +#define PCI_PRODUCT_INTEL_EEPRO100 0x1227 /* EE Pro 100 10/100 Fast Ethernet */ +#define PCI_PRODUCT_INTEL_EEPRO100S 0x1228 /* EE Pro 100 Smart 10/100 Fast Ethernet */ +#define PCI_PRODUCT_INTEL_82557 0x1229 /* 82557 Fast Ethernet LAN Controller */ +#define PCI_PRODUCT_INTEL_82437FX 0x122d /* 82437FX System Controller (TSC) */ +#define PCI_PRODUCT_INTEL_82371FB_ISA 0x122e /* 82371FB PCI-to-ISA Bridge (PIIX) */ +#define PCI_PRODUCT_INTEL_82371FB_IDE 0x1230 /* 82371FB IDE controller (PIIX) */ +#define PCI_PRODUCT_INTEL_82371MX 0x1234 /* 82371MX Mobile PCI I/O IDE Xcelerator (MPIIX) */ +#define PCI_PRODUCT_INTEL_82437MX 0x1235 /* 82437MX Mobile System Controller (MTSC) */ +#define PCI_PRODUCT_INTEL_82441FX 0x1237 /* 82441FX PCI and Memory Controller (PMC) */ +#define PCI_PRODUCT_INTEL_82380AB 0x123c /* 82380AB Mobile PCI-to-ISA Bridge (MISA) */ +#define PCI_PRODUCT_INTEL_82380FB 0x124b /* 82380FB Mobile PCI-to-PCI Bridge (MPCI2) */ +#define PCI_PRODUCT_INTEL_82439HX 0x1250 /* 82439HX System Controller (TXC) */ +#define PCI_PRODUCT_INTEL_82801AA_LPC 0x2410 /* 82801AA LPC Interface Bridge */ +#define PCI_PRODUCT_INTEL_82801AA_IDE 0x2411 /* 82801AA IDE Controller */ +#define PCI_PRODUCT_INTEL_82801AA_USB 0x2412 /* 82801AA USB Controller */ +#define PCI_PRODUCT_INTEL_82801AA_SMB 0x2413 /* 82801AA SMBus Controller */ +#define PCI_PRODUCT_INTEL_82801AA_ACA 0x2415 /* 82801AA AC-97 Audio Controller */ +#define PCI_PRODUCT_INTEL_82801AA_ACM 0x2416 /* 82801AA AC-97 PCI Modem */ +#define PCI_PRODUCT_INTEL_82801AA_HPB 0x2418 /* 82801AA Hub-to-PCI Bridge */ +#define PCI_PRODUCT_INTEL_82801AB_LPC 0x2420 /* 82801AB LPC Interface Bridge */ +#define PCI_PRODUCT_INTEL_82801AB_IDE 0x2421 /* 82801AB IDE Controller */ +#define PCI_PRODUCT_INTEL_82801AB_USB 0x2422 /* 82801AB USB Controller */ +#define PCI_PRODUCT_INTEL_82801AB_SMB 0x2423 /* 82801AB SMBus Controller */ +#define PCI_PRODUCT_INTEL_82801AB_ACA 0x2425 /* 82801AB AC-97 Audio Controller */ +#define PCI_PRODUCT_INTEL_82801AB_ACM 0x2426 /* 82801AB AC-97 PCI Modem */ +#define PCI_PRODUCT_INTEL_82801AB_HPB 0x2428 /* 82801AB Hub-to-PCI Bridge */ +#define PCI_PRODUCT_INTEL_82801BA_LPC 0x2440 /* 82801BA LPC Interface Bridge */ +#define PCI_PRODUCT_INTEL_82801BA_USB1 0x2442 /* 82801BA USB Controller */ +#define PCI_PRODUCT_INTEL_82801BA_SMB 0x2443 /* 82801BA SMBus Controller */ +#define PCI_PRODUCT_INTEL_82801BA_USB2 0x2444 /* 82801BA USB Controller */ +#define PCI_PRODUCT_INTEL_82801BA_ACA 0x2445 /* 82801BA AC-97 Audio Controller */ +#define PCI_PRODUCT_INTEL_82801BA_ACM 0x2446 /* 82801BA AC-97 PCI Modem */ +#define PCI_PRODUCT_INTEL_82801BA_LAN 0x2449 /* 82801BA LAN Controller */ +#define PCI_PRODUCT_INTEL_82801BA_IDE 0x244B /* 82801BA IDE Controller */ +#define PCI_PRODUCT_INTEL_82801BA_HPB 0x244E /* 82801BA Hub-to-PCI Bridge */ +#define PCI_PRODUCT_INTEL_82371SB_ISA 0x7000 /* 82371SB PCI-to-ISA Bridge (PIIX3) */ +#define PCI_PRODUCT_INTEL_82371SB_IDE 0x7010 /* 82371SB IDE Interface (PIIX3) */ +#define PCI_PRODUCT_INTEL_82371SB_USB 0x7020 /* 82371SB USB Host Controller (PIIX3) */ +#define PCI_PRODUCT_INTEL_82437VX 0x7030 /* 82437VX System Controller (TVX) */ +#define PCI_PRODUCT_INTEL_82439TX 0x7100 /* 82439TX System Controller (MTXC) */ +#define PCI_PRODUCT_INTEL_82371AB_ISA 0x7110 /* 82371AB PCI-to-ISA Bridge (PIIX4) */ +#define PCI_PRODUCT_INTEL_82371AB_IDE 0x7111 /* 82371AB IDE controller (PIIX4) */ +#define PCI_PRODUCT_INTEL_82371AB_USB 0x7112 /* 82371AB USB Host Controller (PIIX4) */ +#define PCI_PRODUCT_INTEL_82371AB_PMC 0x7113 /* 82371AB Power Management Controller (PIIX4) */ +#define PCI_PRODUCT_INTEL_82810_MCH 0x7120 /* 82810 Memory Controller Hub */ +#define PCI_PRODUCT_INTEL_82810_GC 0x7121 /* 82810 Graphics Controller */ +#define PCI_PRODUCT_INTEL_82810_DC100_MCH 0x7122 /* 82810-DC100 Memory Controller Hub */ +#define PCI_PRODUCT_INTEL_82810_DC100_GC 0x7123 /* 82810-DC100 Graphics Controller */ +#define PCI_PRODUCT_INTEL_82810E_MCH 0x7124 /* 82810E Memory Controller Hub */ +#define PCI_PRODUCT_INTEL_82810E_GC 0x7125 /* 82810E Graphics Controller */ +#define PCI_PRODUCT_INTEL_82443LX 0x7180 /* 82443LX PCI AGP Controller (PAC) */ +#define PCI_PRODUCT_INTEL_82443LX_AGP 0x7181 /* 82443LX AGP Interface (PAC) */ +#define PCI_PRODUCT_INTEL_82443BX 0x7190 /* 82443BX Host Bridge/Controller */ +#define PCI_PRODUCT_INTEL_82443BX_AGP 0x7191 /* 82443BX AGP Interface */ +#define PCI_PRODUCT_INTEL_82443BX_NOAGP 0x7192 /* 82443BX Host Bridge/Controller (AGP disabled) */ +#define PCI_PRODUCT_INTEL_82440MX 0x7194 /* 82440MX Host Bridge/Controller */ +#define PCI_PRODUCT_INTEL_82440MX_ACA 0x7195 /* 82440MX AC-97 Audio Controller */ +#define PCI_PRODUCT_INTEL_82440MX_ISA 0x7198 /* 82440MX PCI-to-ISA Bridge */ +#define PCI_PRODUCT_INTEL_82440MX_IDE 0x7199 /* 82440MX IDE Controller */ +#define PCI_PRODUCT_INTEL_82440MX_USB 0x719a /* 82440MX USB Host Controller */ +#define PCI_PRODUCT_INTEL_82440MX_PMC 0x719b /* 82440MX Power Management Controller */ +#define PCI_PRODUCT_INTEL_I740 0x7800 /* i740 Graphics Accelerator */ +#define PCI_PRODUCT_INTEL_PCI450_PB 0x84c4 /* 82454KX/GX PCI Bridge (PB) */ +#define PCI_PRODUCT_INTEL_PCI450_MC 0x84c5 /* 82451KX/GX Memory Controller (MC) */ +#define PCI_PRODUCT_INTEL_82451NX_MIOC 0x84ca /* 82451NX Memory & I/O Controller (MIOC) */ +#define PCI_PRODUCT_INTEL_82451NX_PXB 0x84cb /* 82451NX PCI Expander Bridge (PXB) */ + +/* Intergraph products */ +#define PCI_PRODUCT_INTERGRAPH_4D50T 0x00e4 /* Powerstorm 4D50T */ + +/* I. T. T. products */ +#define PCI_PRODUCT_ITT_AGX016 0x0001 /* AGX016 */ +#define PCI_PRODUCT_ITT_ITT3204 0x0002 /* ITT3204 MPEG Decoder */ + +/* KTI products - XXX better descriptions */ +#define PCI_PRODUCT_KTI_NE2KETHER 0x3000 /* Ethernet */ + +/* LAN Media Corporation */ +#define PCI_PRODUCT_LMC_HSSI 0x0003 /* HSSI Interface */ +#define PCI_PRODUCT_LMC_DS3 0x0004 /* DS3 Interface */ +#define PCI_PRODUCT_LMC_SSI 0x0005 /* SSI */ + +/* LeadTek Research */ +#define PCI_PRODUCT_LEADTEK_S3_805 0x0000 /* S3 805 */ + +/* Linear Systems / CompuModules */ +#define PCI_PRODUCT_LINEARSYS_DVB_TX 0x7629 /* DVB Transmitter */ +#define PCI_PRODUCT_LINEARSYS_DVB_RX 0x7630 /* DVB Receiver */ + +/* Lite-On products */ +#define PCI_PRODUCT_LITEON_82C168 0x0002 /* 82C168/82C169 (PNIC) 10/100 Ethernet */ +#define PCI_PRODUCT_LITEON_82C115 0xc115 /* 82C115 (PNIC II) 10/100 Ethernet */ + +/* Lucent products */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0440 0x0440 /* K56flex DSVD LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0441 0x0441 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0442 0x0442 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0443 0x0443 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0444 0x0444 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0445 0x0445 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0446 0x0446 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0447 0x0447 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0448 0x0448 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0449 0x0449 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_044A 0x044A /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_044B 0x044B /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_044C 0x044C /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_044D 0x044D /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_044E 0x044E /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0450 0x0450 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0451 0x0451 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0452 0x0452 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0453 0x0453 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0454 0x0454 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0455 0x0455 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0456 0x0456 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0457 0x0457 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0458 0x0458 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_0459 0x0459 /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_LTMODEM_045A 0x045A /* LTMODEM */ +#define PCI_PRODUCT_LUCENT_USBHC 0x5801 /* USB Host Controller */ + +/* Macronix */ +#define PCI_PRODUCT_MACRONIX_MX98713 0x0512 /* MX98713 (PMAC) 10/100 Ethernet */ +#define PCI_PRODUCT_MACRONIX_MX987x5 0x0531 /* MX987x5 (PMAC) 10/100 Ethernet */ + +/* Madge Networks products */ +#define PCI_PRODUCT_MADGE_COLLAGE25 0x1000 /* Collage 25 ATM adapter */ +#define PCI_PRODUCT_MADGE_COLLAGE155 0x1001 /* Collage 155 ATM adapter */ + +/* Matrox products */ +#define PCI_PRODUCT_MATROX_ATLAS 0x0518 /* MGA PX2085 (\"Atlas\") */ +#define PCI_PRODUCT_MATROX_MILLENNIUM 0x0519 /* MGA Millennium 2064W */ +#define PCI_PRODUCT_MATROX_MYSTIQUE 0x051a /* MGA Mystique 1064SG */ +#define PCI_PRODUCT_MATROX_MILLENNIUM2 0x051b /* MGA Millennium II 2164W */ +#define PCI_PRODUCT_MATROX_MILLENNIUM2_AGP 0x051f /* MGA Millennium II 2164WA-B AG */ +#define PCI_PRODUCT_MATROX_G200_PCI 0x0520 /* MGA G200 PCI */ +#define PCI_PRODUCT_MATROX_G200_AGP 0x0521 /* MGA G200 AGP */ +#define PCI_PRODUCT_MATROX_G400_AGP 0x0525 /* MGA G400 AGP */ +#define PCI_PRODUCT_MATROX_IMPRESSION 0x0d10 /* MGA Impression */ +#define PCI_PRODUCT_MATROX_G100_PCI 0x1000 /* MGA G100 PCI */ +#define PCI_PRODUCT_MATROX_G100_AGP 0x1001 /* MGA G100 AGP */ + +/* Motorola products */ +#define PCI_PRODUCT_MOT_MPC105 0x0001 /* MPC105 \"Eagle\" Host Bridge */ +#define PCI_PRODUCT_MOT_MPC106 0x0002 /* MPC106 \"Grackle\" Host Bridge */ + +/* Mylex products */ +#define PCI_PRODUCT_MYLEX_960P 0x0001 /* DAC960P RAID controller */ + +/* Mutech products */ +#define PCI_PRODUCT_MUTECH_MV1000 0x0001 /* MV1000 */ + +/* NetVin products - XXX better descriptions */ +#define PCI_PRODUCT_NETVIN_5000 0x5000 /* 5000 Ethernet */ + +/* Newbridge / Tundra products */ +#define PCI_PRODUCT_NEWBRIDGE_CA91CX42 0x0000 /* Universe VME bridge */ + +/* National Semiconductor products */ +#define PCI_PRODUCT_NS_DP83810 0x0001 /* DP83810 10/100 Ethernet */ +#define PCI_PRODUCT_NS_DP83815 0x0020 /* DP83815 10/100 Ethernet */ +#define PCI_PRODUCT_NS_NS87410 0xd001 /* NS87410 */ + +/* NCR/Symbios Logic products */ +#define PCI_PRODUCT_SYMBIOS_810 0x0001 /* 53c810 */ +#define PCI_PRODUCT_SYMBIOS_820 0x0002 /* 53c820 */ +#define PCI_PRODUCT_SYMBIOS_825 0x0003 /* 53c825 */ +#define PCI_PRODUCT_SYMBIOS_815 0x0004 /* 53c815 */ +#define PCI_PRODUCT_SYMBIOS_810AP 0x0005 /* 53c810AP */ +#define PCI_PRODUCT_SYMBIOS_860 0x0006 /* 53c860 */ +#define PCI_PRODUCT_SYMBIOS_896 0x000b /* 53c896 */ +#define PCI_PRODUCT_SYMBIOS_895 0x000c /* 53c895 */ +#define PCI_PRODUCT_SYMBIOS_885 0x000d /* 53c885 */ +#define PCI_PRODUCT_SYMBIOS_875 0x000f /* 53c875 */ +#define PCI_PRODUCT_SYMBIOS_1510 0x0010 /* 53c1510 */ +#define PCI_PRODUCT_SYMBIOS_875J 0x008f /* 53c875J */ + +/* Packet Engines products */ +#define PCI_PRODUCT_SYMBIOS_PE_GNIC 0x0702 /* Packet Engines G-NIC Ethernet */ + +/* NEC products */ +#define PCI_PRODUCT_NEC_USB 0x0035 /* USB Host Controller */ +#define PCI_PRODUCT_NEC_POWERVR2 0x0046 /* PowerVR PCX2 */ +#define PCI_PRODUCT_NEC_PD72872 0x0063 /* uPD72872 IEEE 1394 OHCI Host Controller */ +#define PCI_PRODUCT_NEC_PD72870 0x00cd /* uPD72870 IEEE 1394 OHCI Host Controller */ +#define PCI_PRODUCT_NEC_PD72871 0x00ce /* uPD72871 IEEE 1394 OHCI Host Controller */ + +/* Neomagic products */ +#define PCI_PRODUCT_NEOMAGIC_NMMG128ZV 0x0003 /* MagicGraph 128ZV */ +#define PCI_PRODUCT_NEOMAGIC_NMMG2160 0x0004 /* MagicGraph 128XD */ +#define PCI_PRODUCT_NEOMAGIC_NMMM256AV_VGA 0x0005 /* MagicMedia 256AV VGA */ +#define PCI_PRODUCT_NEOMAGIC_NMMM256ZX_VGA 0x0006 /* MagicMedia 256ZX VGA */ +#define PCI_PRODUCT_NEOMAGIC_NMMM256AV_AU 0x8005 /* MagicMedia 256AV Audio */ +#define PCI_PRODUCT_NEOMAGIC_NMMM256ZX_AU 0x8006 /* MagicMedia 256ZX Audio */ + +/* Netgear products */ +#define PCI_PRODUCT_NETGEAR_GA620 0x620a /* GA620 Gigabit Ethernet */ + +/* NexGen products */ +#define PCI_PRODUCT_NEXGEN_NX82C501 0x4e78 /* NX82C501 Host-PCI Bridge */ + +/* NKK products */ +#define PCI_PRODUCT_NKK_NDR4600 0xA001 /* NDR4600 Host-PCI Bridge */ + +/* Number Nine products */ +#define PCI_PRODUCT_NUMBER9_I128 0x2309 /* Imagine-128 */ +#define PCI_PRODUCT_NUMBER9_I128_2 0x2339 /* Imagine-128 II */ + +/* Nvidia Corporationn products */ +#define PCI_PRODUCT_NVIDIA_RIVATNT 0x0020 /* RIVA TNT */ +#define PCI_PRODUCT_NVIDIA_RIVATNT2 0x0028 /* RIVA TNT2 */ +#define PCI_PRODUCT_NVIDIA_RIVATNT2U 0x0029 /* RIVA TNT2 Ultra */ +#define PCI_PRODUCT_NVIDIA_VANTA 0x002C /* Vanta */ +#define PCI_PRODUCT_NVIDIA_RIVATNT2M64 0x002D /* RIVA TNT2 Model 64 */ +#define PCI_PRODUCT_NVIDIA_ALADDINTNT2 0x00A0 /* Aladdin TNT2 */ +#define PCI_PRODUCT_NVIDIA_GEFORCE256 0x0100 /* GeForce 256 */ +#define PCI_PRODUCT_NVIDIA_GEFORCEDDR 0x0101 /* GeForce DDR */ +#define PCI_PRODUCT_NVIDIA_QUADRO 0x0103 /* Quadro */ +#define PCI_PRODUCT_NVIDIA_GEFORCE2 0x0150 /* GeForce2 GTS */ +#define PCI_PRODUCT_NVIDIA_GEFORCE2DDR 0x0151 /* GeForce2 GTS (DDR) */ +#define PCI_PRODUCT_NVIDIA_GEFORCE2BR 0x0152 /* GeForce2 GTS */ +#define PCI_PRODUCT_NVIDIA_QUADRO2 0x0153 /* Quadro2 */ + +/* Nvidia Corporation & SGS Thomson Microelectric */ +#define PCI_PRODUCT_NVIDIA_SGS_RIVA128 0x0018 /* Riva 128 */ + +/* Oak Technologies products */ +#define PCI_PRODUCT_OAKTECH_OTI1007 0x0107 /* OTI107 */ + +/* Olicom products */ +#define PCI_PRODUCT_OLICOM_OC2183 0x0013 /* Olicom OC-2183/2185 Ethernet */ +#define PCI_PRODUCT_OLICOM_OC2325 0x0012 /* Olicom OC-2325 Ethernet */ +#define PCI_PRODUCT_OLICOM_OC2326 0x0014 /* Olicom OC-2326 10/100-TX Ethernet */ + +/* Opti products */ +#define PCI_PRODUCT_OPTI_82C557 0xc557 /* 82C557 */ +#define PCI_PRODUCT_OPTI_82C558 0xc558 /* 82C558 */ +#define PCI_PRODUCT_OPTI_82C568 0xc568 /* 82C568 */ +#define PCI_PRODUCT_OPTI_82D568 0xd568 /* 82D568 */ +#define PCI_PRODUCT_OPTI_82C621 0xc621 /* 82C621 */ +#define PCI_PRODUCT_OPTI_82C822 0xc822 /* 82C822 */ +#define PCI_PRODUCT_OPTI_RM861HA 0xc861 /* RM861HA */ +#define PCI_PRODUCT_OPTI_82C700 0xc700 /* 82C700 */ +#define PCI_PRODUCT_OPTI_82C701 0xc701 /* 82C701 */ + +/* PC Tech products */ +#define PCI_PRODUCT_PCTECH_RZ1000 0x1000 /* RZ1000 */ + +/* PLX Technology products */ +#define PCI_PRODUCT_PLX_9060ES 0x906e /* 9060ES PCI bus controller */ + +/* ProLAN products - XXX better descriptions */ +#define PCI_PRODUCT_PROLAN_NE2KETHER 0x1980 /* Ethernet */ + +/* Promise products */ +#define PCI_PRODUCT_PROMISE_DC5030 0x5300 /* DC5030 */ +#define PCI_PRODUCT_PROMISE_ULTRA33 0x4d33 /* Ultra33/ATA Bus Master IDE Accelerator */ +#define PCI_PRODUCT_PROMISE_ULTRA66 0x4d38 /* Ultra66/ATA Bus Master IDE Accelerator */ +#define PCI_PRODUCT_PROMISE_ULTRA100 0x4d30 /* Ultra100/ATA Bus Master IDE Accelerator */ + +/* QLogic products */ +#define PCI_PRODUCT_QLOGIC_ISP1020 0x1020 /* ISP1020 */ +#define PCI_PRODUCT_QLOGIC_ISP1022 0x1022 /* ISP1022 */ +#define PCI_PRODUCT_QLOGIC_ISP1080 0x1080 /* ISP1080 */ +#define PCI_PRODUCT_QLOGIC_ISP1240 0x1240 /* ISP1240 */ +#define PCI_PRODUCT_QLOGIC_ISP2100 0x2100 /* ISP2100 */ + +/* Quantum Designs products */ +#define PCI_PRODUCT_QUANTUMDESIGNS_8500 0x0001 /* 8500 */ +#define PCI_PRODUCT_QUANTUMDESIGNS_8580 0x0002 /* 8580 */ + +/* Realtek (Creative Labs?) products */ +#define PCI_PRODUCT_REALTEK_RT8029 0x8029 /* 8029 Ethernet */ +#define PCI_PRODUCT_REALTEK_RT8129 0x8129 /* 8129 10/100 Ethernet */ +#define PCI_PRODUCT_REALTEK_RT8139 0x8139 /* 8139 10/100 Ethernet */ + +/* RICOH products */ +#define PCI_PRODUCT_RICOH_Rx5C465 0x0465 /* 5C465 PCI-CardBus bridge */ +#define PCI_PRODUCT_RICOH_Rx5C466 0x0466 /* 5C466 PCI-CardBus bridge */ +#define PCI_PRODUCT_RICOH_Rx5C475 0x0475 /* 5C475 PCI-CardBus bridge */ +#define PCI_PRODUCT_RICOH_RL5C476 0x0476 /* 5C476 PCI-CardBus bridge */ +#define PCI_PRODUCT_RICOH_Rx5C477 0x0477 /* 5C477 PCI-CardBus bridge */ +#define PCI_PRODUCT_RICOH_Rx5C478 0x0478 /* 5C478 PCI-CardBus bridge */ + +/* RISCom (SDL Communications, Inc?) products */ +#define PCI_PRODUCT_RISCOM_N2 0x5568 /* N2 */ + +/* RNS products */ +#define PCI_PRODUCT_RNS_FDDI 0x2200 /* 2200 FDDI */ + +/* S3 products */ +#define PCI_PRODUCT_S3_VIRGE 0x5631 /* ViRGE */ +#define PCI_PRODUCT_S3_TRIO32 0x8810 /* Trio32 */ +#define PCI_PRODUCT_S3_TRIO64 0x8811 /* Trio32/64 */ +#define PCI_PRODUCT_S3_AURORA64P 0x8812 /* Aurora64V+ */ +#define PCI_PRODUCT_S3_TRIO64UVP 0x8814 /* Trio64UV+ */ +#define PCI_PRODUCT_S3_VIRGE_VX 0x883d /* ViRGE/VX */ +#define PCI_PRODUCT_S3_868 0x8880 /* 868 */ +#define PCI_PRODUCT_S3_928 0x88b0 /* 86C928 */ +#define PCI_PRODUCT_S3_864_0 0x88c0 /* 86C864-0 */ +#define PCI_PRODUCT_S3_864_1 0x88c1 /* 86C864-1 */ +#define PCI_PRODUCT_S3_864_2 0x88c2 /* 86C864-2 */ +#define PCI_PRODUCT_S3_864_3 0x88c3 /* 86C864-3 */ +#define PCI_PRODUCT_S3_964_0 0x88d0 /* 86C964-0 */ +#define PCI_PRODUCT_S3_964_1 0x88d1 /* 86C964-1 */ +#define PCI_PRODUCT_S3_964_2 0x88d2 /* 86C964-2 */ +#define PCI_PRODUCT_S3_964_3 0x88d3 /* 86C964-3 */ +#define PCI_PRODUCT_S3_968_0 0x88f0 /* 86C968-0 */ +#define PCI_PRODUCT_S3_968_1 0x88f1 /* 86C968-1 */ +#define PCI_PRODUCT_S3_968_2 0x88f2 /* 86C968-2 */ +#define PCI_PRODUCT_S3_968_3 0x88f3 /* 86C968-3 */ +#define PCI_PRODUCT_S3_TRIO64V2_DX 0x8901 /* Trio64V2/DX */ +#define PCI_PRODUCT_S3_PLATO_PX 0x8901 /* Plato/PX */ +#define PCI_PRODUCT_S3_TRIO3D 0x8904 /* 86C365 Trio3D */ +#define PCI_PRODUCT_S3_VIRGE_DX 0x8a01 /* ViRGE/DX */ +#define PCI_PRODUCT_S3_VIRGE_GX2 0x8a10 /* ViRGE/GX2 */ +#define PCI_PRODUCT_S3_TRIO3D2X 0x8a13 /* Trio3D/2X */ +#define PCI_PRODUCT_S3_SAVAGE3D 0x8a20 /* Savage3D */ +#define PCI_PRODUCT_S3_SAVAGE3D_MV 0x8a21 /* Savage3D+MV */ +#define PCI_PRODUCT_S3_SAVAGE4 0x8a22 /* Savage4 */ +#define PCI_PRODUCT_S3_VIRGE_MX 0x8c01 /* ViRGE/MX */ +#define PCI_PRODUCT_S3_VIRGE_MXP 0x8c03 /* ViRGE/MXP */ +#define PCI_PRODUCT_S3_SAVAGE_MX_MV 0x8c10 /* Savage/MX+MV */ +#define PCI_PRODUCT_S3_SAVAGE_MX 0x8c11 /* Savage/MX */ +#define PCI_PRODUCT_S3_SAVAGE_IX_MV 0x8c12 /* Savage/IX+MV */ +#define PCI_PRODUCT_S3_SAVAGE_IX 0x8c13 /* Savage/IX */ +#define PCI_PRODUCT_S3_SAVAGE2000 0x9102 /* Savage2000 */ +#define PCI_PRODUCT_S3_SONICVIBES 0xca00 /* SonicVibes */ + +/* Samsung Semiconductor products */ +#define PCI_PRODUCT_SAMSUNGSEMI_KS8920 0x8920 /* KS8920 10/100 Ethernet */ + +/* SGI products */ +#define PCI_PRODUCT_SGI_IOC3 0x0003 /* IOC3 */ +#define PCI_PRODUCT_SGI_RAD1 0x0005 /* PsiTech RAD1 */ +#define PCI_PRODUCT_SGI_TIGON 0x0009 /* Tigon Gigabit Ethernet */ + +/* SGS Thomson products */ +#define PCI_PRODUCT_SGSTHOMSON_2000 0x0008 /* STG 2000X */ +#define PCI_PRODUCT_SGSTHOMSON_1764 0x1746 /* STG 1764X */ + +/* SiByte, Inc. products */ +#define PCI_PRODUCT_SIBYTE_SB1250_PCI 0x0001 /* BCM1250 PCI Host Bridge */ +#define PCI_PRODUCT_SIBYTE_SB1250_LDT 0x0002 /* BCM1250 HyperTransport Host Bridge */ + +/* Sigma Designs products */ +#define PCI_PRODUCT_SIGMA_HOLLYWOODPLUS 0x8300 /* REALmagic Hollywood-Plus MPEG-2 Decoder */ + +/* Silicon Integrated System products */ +#define PCI_PRODUCT_SIS_86C201 0x0001 /* 86C201 */ +#define PCI_PRODUCT_SIS_86C202 0x0002 /* 86C202 */ +#define PCI_PRODUCT_SIS_86C205 0x0005 /* 86C205 */ +#define PCI_PRODUCT_SIS_85C503 0x0008 /* 85C503 or 5597/5598 ISA bridge */ +#define PCI_PRODUCT_SIS_600PMC 0x0009 /* 600 Power Mngmt Controller */ +#define PCI_PRODUCT_SIS_5597_VGA 0x0200 /* 5597/5598 integrated VGA */ +#define PCI_PRODUCT_SIS_85C501 0x0406 /* 85C501 */ +#define PCI_PRODUCT_SIS_85C496 0x0496 /* 85C496 */ +#define PCI_PRODUCT_SIS_530HB 0x0530 /* 530 Host to PCI Bridge */ +#define PCI_PRODUCT_SIS_85C601 0x0601 /* 85C601 */ +#define PCI_PRODUCT_SIS_900 0x0900 /* SiS 900 10/100 Ethernet */ +#define PCI_PRODUCT_SIS_5597_IDE 0x5513 /* 5597/5598 IDE controller */ +#define PCI_PRODUCT_SIS_5597_HB 0x5597 /* 5597/5598 host bridge */ +#define PCI_PRODUCT_SIS_530VGA 0x6306 /* 530 GUI Accelerator+3D */ +#define PCI_PRODUCT_SIS_6326 0x6326 /* 6326 AGP VGA */ +#define PCI_PRODUCT_SIS_5597_USB 0x7001 /* 5597/5598 USB host controller */ +#define PCI_PRODUCT_SIS_7016 0x7016 /* SiS 7016 10/100 Ethernet */ + +/* Silicon Motion products */ +#define PCI_PRODUCT_SILMOTION_LYNX_E 0x0810 /* Lynx E */ + +/* SMC products */ +#define PCI_PRODUCT_SMC_37C665 0x1000 /* FDC 37C665 */ +#define PCI_PRODUCT_SMC_37C922 0x1001 /* FDC 37C922 */ +#define PCI_PRODUCT_SMC_83C170 0x0005 /* 83C170 (\"EPIC/100\") Fast Ethernet */ +#define PCI_PRODUCT_SMC_83C175 0x0006 /* 83C175 (\"EPIC/100\") Fast Ethernet */ + +/* Solidum Systems Corporation */ +#define PCI_PRODUCT_SOLIDUM_AMD971 0x2000 /* SNP8023: AMD 971 */ +#define PCI_PRODUCT_SOLIDUM_CLASS802 0x8023 /* SNP8023: Classifier Engine */ + +/* Sony products */ +#define PCI_PRODUCT_SONY_CXD1947A 0x8009 /* CXD1947A IEEE 1394 Host Controller */ +#define PCI_PRODUCT_SONY_CXD32222 0x8039 /* CXD3222 OHCI IEEE 1394 Host Controller */ +#define PCI_PRODUCT_SONY_MEMSTICK 0x808a /* Memory Stick I/F Controller */ + +/* Sun Microsystems products */ +#define PCI_PRODUCT_SUN_EBUS 0x1000 /* PCIO Ebus2 */ +#define PCI_PRODUCT_SUN_HMENETWORK 0x1001 /* PCIO Happy Meal Ethernet */ +#define PCI_PRODUCT_SUN_SIMBA 0x5000 /* Simba PCI bridge */ +#define PCI_PRODUCT_SUN_MS_IIep 0x9000 /* microSPARC IIep PCI */ +#define PCI_PRODUCT_SUN_US_IIi 0xa000 /* UltraSPARC IIi PCI */ + +/* Sundance Technology products */ +#define PCI_PRODUCT_SUNDANCETI_ST201 0x0201 /* ST201 10/100 Ethernet */ + +/* Surecom Technology products */ +#define PCI_PRODUCT_SURECOM_NE34 0x0e34 /* NE-34 Ethernet */ + +/* Symphony Labs products */ +#define PCI_PRODUCT_SYMPHONY_82C101 0x0001 /* 82C101 */ +#define PCI_PRODUCT_SYMPHONY_82C103 0x0103 /* 82C103 */ +#define PCI_PRODUCT_SYMPHONY_82C105 0x0105 /* 82C105 */ +#define PCI_PRODUCT_SYMPHONY2_82C101 0x0001 /* 82C101 */ +#define PCI_PRODUCT_SYMPHONY_83C553 0x0565 /* 83C553 PCI-ISA Bridge */ + +/* Schneider & Koch (really SysKonnect) products */ +#define PCI_PRODUCT_SCHNEIDERKOCH_SKNET_FDDI 0x4000 /* SK-NET FDDI-xP */ + +/* Tekram Technology products (1st PCI Vendor ID)*/ +#define PCI_PRODUCT_TEKRAM_DC290 0xdc29 /* DC-290(M) */ + +/* Tekram Technology products (2nd PCI Vendor ID) */ +#define PCI_PRODUCT_TEKRAM2_DC690C 0x690c /* DC-690C */ + +/* Texas Instruments products */ +#define PCI_PRODUCT_TI_TLAN 0x0500 /* TLAN */ +#define PCI_PRODUCT_TI_TVP4020 0x3d07 /* TVP4020 Permedia 2 */ +#define PCI_PRODUCT_TI_TSB12LV21 0x8000 /* TSB12LV21 IEEE 1394 Host Controller */ +#define PCI_PRODUCT_TI_TSB12LV22 0x8009 /* TSB12LV22 OHCI IEEE 1394 Host Controller */ +#define PCI_PRODUCT_TI_TSB12LV23 0x8019 /* TSB12LV23 OHCI IEEE 1394 Host Controller */ +#define PCI_PRODUCT_TI_TSB12LV26 0x8020 /* TSB12LV26 OHCI IEEE 1394 Host Controller */ +#define PCI_PRODUCT_TI_PCI1130 0xac12 /* PCI1130 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1031 0xac13 /* PCI1031 PCI-PCMCIA Bridge */ +#define PCI_PRODUCT_TI_PCI1131 0xac15 /* PCI1131 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1250 0xac16 /* PCI1250 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1220 0xac17 /* PCI1220 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1221 0xac19 /* PCI1221 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1450 0xac1b /* PCI1450 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1225 0xac1c /* PCI1225 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1251 0xac1d /* PCI1251 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1211 0xac1e /* PCI1211 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1251B 0xac1f /* PCI1251B PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI2030 0xac20 /* PCI2030 PCI-PCI Bridge */ +#define PCI_PRODUCT_TI_PCI1420 0xac51 /* PCI1420 PCI-CardBus Bridge */ +#define PCI_PRODUCT_TI_PCI1451 0xac52 /* PCI1451 PCI-CardBus Bridge */ + +/* Toshiba America products */ +#define PCI_PRODUCT_TOSHIBA_R4X00 0x0009 /* R4x00 Host-PCI Bridge */ +#define PCI_PRODUCT_TOSHIBA_TC35856F 0x0020 /* TC35856F ATM (\"Meteor\") */ + +/* Toshiba America Info Systems products */ +#define PCI_PRODUCT_TOSHIBA2_HOST 0x0601 /* Host Bridge/Controller */ +#define PCI_PRODUCT_TOSHIBA2_ISA 0x0602 /* ISA Bridge */ +#define PCI_PRODUCT_TOSHIBA2_ToPIC95 0x0603 /* ToPIC95 CardBus-PCI Bridge */ +#define PCI_PRODUCT_TOSHIBA2_ToPIC95B 0x060a /* ToPIC95B CardBus-PCI Bridge */ +#define PCI_PRODUCT_TOSHIBA2_ToPIC97 0x060f /* ToPIC97 CardBus-PCI Bridge */ +#define PCI_PRODUCT_TOSHIBA2_ToPIC100 0x0617 /* ToPIC100 CardBus-PCI Bridge */ +#define PCI_PRODUCT_TOSHIBA2_FIRO 0x0701 /* Fast Infrared Type O */ + +/* Trident products */ +#define PCI_PRODUCT_TRIDENT_CYBERBLADE_I7 0x8420 /* CyberBlade i7 */ +#define PCI_PRODUCT_TRIDENT_TGUI_9320 0x9320 /* TGUI 9320 */ +#define PCI_PRODUCT_TRIDENT_TGUI_9350 0x9350 /* TGUI 9350 */ +#define PCI_PRODUCT_TRIDENT_TGUI_9360 0x9360 /* TGUI 9360 */ +#define PCI_PRODUCT_TRIDENT_CYBER_9397 0x9397 /* CYBER 9397 */ +#define PCI_PRODUCT_TRIDENT_CYBER_9397DVD 0x939a /* CYBER 9397DVD */ +#define PCI_PRODUCT_TRIDENT_CYBER_9525 0x9525 /* CYBER 9525 */ +#define PCI_PRODUCT_TRIDENT_TGUI_9420 0x9420 /* TGUI 9420 */ +#define PCI_PRODUCT_TRIDENT_TGUI_9440 0x9440 /* TGUI 9440 */ +#define PCI_PRODUCT_TRIDENT_TGUI_9660 0x9660 /* TGUI 9660 */ +#define PCI_PRODUCT_TRIDENT_TGUI_9680 0x9680 /* TGUI 9680 */ +#define PCI_PRODUCT_TRIDENT_TGUI_9682 0x9682 /* TGUI 9682 */ + +/* Triones Technologies products */ +/* The 366 and 370 controllers have the same product ID */ +#define PCI_PRODUCT_TRIONES_HPT366 0x0004 /* HPT366/370 IDE Controller */ + +/* TriTech Microelectronics products*/ +#define PCI_PRODUCT_TRITECH_TR25202 0xfc02 /* Pyramid3D TR25202 */ + +/* Tseng Labs products */ +#define PCI_PRODUCT_TSENG_ET4000_W32P_A 0x3202 /* ET4000w32p rev A */ +#define PCI_PRODUCT_TSENG_ET4000_W32P_B 0x3205 /* ET4000w32p rev B */ +#define PCI_PRODUCT_TSENG_ET4000_W32P_C 0x3206 /* ET4000w32p rev C */ +#define PCI_PRODUCT_TSENG_ET4000_W32P_D 0x3207 /* ET4000w32p rev D */ +#define PCI_PRODUCT_TSENG_ET6000 0x3208 /* ET6000 */ + +/* UMC products */ +#define PCI_PRODUCT_UMC_UM82C881 0x0001 /* UM82C881 486 Chipset */ +#define PCI_PRODUCT_UMC_UM82C886 0x0002 /* UM82C886 ISA Bridge */ +#define PCI_PRODUCT_UMC_UM8673F 0x0101 /* UM8673F EIDE Controller */ +#define PCI_PRODUCT_UMC_UM8881 0x0881 /* UM8881 HB4 486 PCI Chipset */ +#define PCI_PRODUCT_UMC_UM82C891 0x0891 /* UM82C891 */ +#define PCI_PRODUCT_UMC_UM886A 0x1001 /* UM886A */ +#define PCI_PRODUCT_UMC_UM8886BF 0x673a /* UM8886BF */ +#define PCI_PRODUCT_UMC_UM8710 0x8710 /* UM8710 */ +#define PCI_PRODUCT_UMC_UM8886 0x886a /* UM8886 */ +#define PCI_PRODUCT_UMC_UM8881F 0x8881 /* UM8881F PCI-Host bridge */ +#define PCI_PRODUCT_UMC_UM8886F 0x8886 /* UM8886F PCI-ISA bridge */ +#define PCI_PRODUCT_UMC_UM8886A 0x888a /* UM8886A */ +#define PCI_PRODUCT_UMC_UM8891A 0x8891 /* UM8891A */ +#define PCI_PRODUCT_UMC_UM9017F 0x9017 /* UM9017F */ +#define PCI_PRODUCT_UMC_UM8886N 0xe88a /* UM8886N */ +#define PCI_PRODUCT_UMC_UM8891N 0xe891 /* UM8891N */ + +/* ULSI Systems products */ +#define PCI_PRODUCT_ULSI_US201 0x0201 /* US201 */ + +/* US Robotics products */ +#define PCI_PRODUCT_USR_3CP5609 0x1008 /* 3CP5609 PCI 16550 Modem */ + +/* V3 Semiconductor products */ +#define PCI_PRODUCT_V3_V292PBC 0x0292 /* V292PBC AMD290x0 Host-PCI Bridge */ +#define PCI_PRODUCT_V3_V960PBC 0x0960 /* V960PBC i960 Host-PCI Bridge */ +#define PCI_PRODUCT_V3_V96DPC 0xC960 /* V96DPC i960 (Dual) Host-PCI Bridge */ + +/* VIA Technologies products, from http://www.via.com.tw/ */ +#define PCI_PRODUCT_VIATECH_VT8371_HB 0x0391 /* VT8371 (Apollo KX133) Host Bridge */ +#define PCI_PRODUCT_VIATECH_VT8501_MVP4 0x0501 /* VT8501 MVP4 System Controller */ +#define PCI_PRODUCT_VIATECH_VT82C505 0x0505 /* VT82C505 (Pluto) */ +#define PCI_PRODUCT_VIATECH_VT82C561 0x0561 /* VT82C561 */ +#define PCI_PRODUCT_VIATECH_VT82C586A_IDE 0x0571 /* VT82C586A IDE Controller */ +#define PCI_PRODUCT_VIATECH_VT82C576 0x0576 /* VT82C576 3V */ +#define PCI_PRODUCT_VIATECH_VT82C580VP 0x0585 /* VT82C580 (Apollo VP) Host-PCI Bridge */ +#define PCI_PRODUCT_VIATECH_VT82C586_ISA 0x0586 /* VT82C586 (Apollo VP) PCI-ISA Bridge */ +#define PCI_PRODUCT_VIATECH_VT82C595 0x0595 /* VT82C595 (Apollo VP2) Host-PCI Bridge */ +#define PCI_PRODUCT_VIATECH_VT82C596A 0x0596 /* VT82C596A (Apollo Pro) PCI-ISA Bridge */ +#define PCI_PRODUCT_VIATECH_VT82C597 0x0597 /* VT82C597 (Apollo VP3) Host-PCI Bridge */ +#define PCI_PRODUCT_VIATECH_VT82C598PCI 0x0598 /* VT82C598 (Apollo MVP3) Host-PCI */ +#define PCI_PRODUCT_VIATECH_VT82C686A_ISA 0x0686 /* VT82C686A (Apollo KX133) PCI-ISA Bridge */ +#define PCI_PRODUCT_VIATECH_VT82C691 0x0691 /* VT82C691 (Apollo Pro) Host-PCI */ +#define PCI_PRODUCT_VIATECH_VT82C693 0x0693 /* VT82C693 (Apollo Pro Plus) Host-PCI */ +#define PCI_PRODUCT_VIATECH_VT86C926 0x0926 /* VT86C926 Amazon PCI-Ethernet Controller */ +#define PCI_PRODUCT_VIATECH_VT82C570M 0x1000 /* VT82C570M (Apollo) Host-PCI Bridge */ +#define PCI_PRODUCT_VIATECH_VT82C570MV 0x1006 /* VT82C570M (Apollo) PCI-ISA Bridge */ +#define PCI_PRODUCT_VIATECH_VT82C586_IDE 0x1571 /* VT82C586 (Apollo VP) IDE Controller */ +#define PCI_PRODUCT_VIATECH_VT82C595_2 0x1595 /* VT82C595 (Apollo VP2) Host-PCI Bridge */ +#define PCI_PRODUCT_VIATECH_VT83C572 0x3038 /* VT83C572 USB Controller */ +#define PCI_PRODUCT_VIATECH_VT82C586_PWR 0x3040 /* VT82C586 (Apollo VP) Power Management Controller */ +#define PCI_PRODUCT_VIATECH_VT3043 0x3043 /* VT3043 (Rhine) 10/100 Ethernet */ +#define PCI_PRODUCT_VIATECH_VT82C686A_SMB 0x3057 /* VT82C686A SMBus Controller */ +#define PCI_PRODUCT_VIATECH_VT82C686A_AC97 0x3058 /* VT82C686A AC-97 Audio Controller */ +#define PCI_PRODUCT_VIATECH_VT82C686A_MC97 0x3068 /* VT82C686A MC-97 Modem Controller */ +#define PCI_PRODUCT_VIATECH_VT86C100A 0x6100 /* VT86C100A (Rhine-II) 10/100 Ethernet */ +#define PCI_PRODUCT_VIATECH_VT8371_PPB 0x8391 /* VT8371 (Apollo KX133) PCI-PCI Bridge */ +#define PCI_PRODUCT_VIATECH_VT8501AGP 0x8501 /* VT8501 PCI-AGP */ +#define PCI_PRODUCT_VIATECH_VT82C597AGP 0x8597 /* VT82C597 (Apollo VP3) PCI-AGP */ +#define PCI_PRODUCT_VIATECH_VT82C598AGP 0x8598 /* VT82C598 (Apollo MVP3) PCI-AGP */ + +/* Vortex Computer Systems products */ +/* GDT_PCI */ +#define PCI_PRODUCT_VORTEX_GDT_60x0 0x0000 /* GDT6000/6020/6050 */ +#define PCI_PRODUCT_VORTEX_GDT_6000B 0x0001 /* GDT6000B/6010 */ +/* GDT_PCINEW */ +#define PCI_PRODUCT_VORTEX_GDT_6x10 0x0002 /* GDT6110/6510 */ +#define PCI_PRODUCT_VORTEX_GDT_6x20 0x0003 /* GDT6120/6520 */ +#define PCI_PRODUCT_VORTEX_GDT_6530 0x0004 /* GDT6530 */ +#define PCI_PRODUCT_VORTEX_GDT_6550 0x0005 /* GDT6550 */ +/* GDT_PCINEW, wide/ultra SCSI controllers */ +#define PCI_PRODUCT_VORTEX_GDT_6x17 0x0006 /* GDT6117/6517 */ +#define PCI_PRODUCT_VORTEX_GDT_6x27 0x0007 /* GDT6127/6527 */ +#define PCI_PRODUCT_VORTEX_GDT_6537 0x0008 /* GDT6537 */ +#define PCI_PRODUCT_VORTEX_GDT_6557 0x0009 /* GDT6557/6557-ECC */ +/* GDT_PCINEW, wide SCSI controllers */ +#define PCI_PRODUCT_VORTEX_GDT_6x15 0x0010 /* GDT6115/6515 */ +#define PCI_PRODUCT_VORTEX_GDT_6x25 0x0011 /* GDT6125/6525 */ +#define PCI_PRODUCT_VORTEX_GDT_6535 0x0012 /* GDT6535 */ +#define PCI_PRODUCT_VORTEX_GDT_6555 0x0013 /* GDT6555/6555-ECC */ +/* GDT_MPR, RP series, wide/ultra SCSI */ +#define PCI_PRODUCT_VORTEX_GDT_6x17RP 0x0100 /* GDT6117RP/GDT6517RP */ +#define PCI_PRODUCT_VORTEX_GDT_6x27RP 0x0101 /* GDT6127RP/GDT6527RP */ +#define PCI_PRODUCT_VORTEX_GDT_6537RP 0x0102 /* GDT6537RP */ +#define PCI_PRODUCT_VORTEX_GDT_6557RP 0x0103 /* GDT6557RP */ +/* GDT_MPR, RP series, narrow/ultra SCSI */ +#define PCI_PRODUCT_VORTEX_GDT_6x11RP 0x0104 /* GDT6111RP/GDT6511RP */ +#define PCI_PRODUCT_VORTEX_GDT_6x21RP 0x0105 /* GDT6121RP/GDT6521RP */ +/* GDT_MPR, RD series, wide/ultra SCSI */ +#define PCI_PRODUCT_VORTEX_GDT_6x17RD 0x0110 /* GDT6117RD/GDT6517RD */ +#define PCI_PRODUCT_VORTEX_GDT_6x27RD 0x0111 /* GDT6127RD/GDT6527RD */ +#define PCI_PRODUCT_VORTEX_GDT_6537RD 0x0112 /* GDT6537RD */ +#define PCI_PRODUCT_VORTEX_GDT_6557RD 0x0113 /* GDT6557RD */ +/* GDT_MPR, RD series, narrow/ultra SCSI */ +#define PCI_PRODUCT_VORTEX_GDT_6x11RD 0x0114 /* GDT6111RD/GDT6511RD */ +#define PCI_PRODUCT_VORTEX_GDT_6x21RD 0x0115 /* GDT6121RD/GDT6521RD */ +/* GDT_MPR, RD series, wide/ultra2 SCSI */ +#define PCI_PRODUCT_VORTEX_GDT_6x18RD 0x0118 /* GDT6118RD/GDT6518RD/GDT6618RD */ +#define PCI_PRODUCT_VORTEX_GDT_6x28RD 0x0119 /* GDT6128RD/GDT6528RD/GDT6628RD */ +#define PCI_PRODUCT_VORTEX_GDT_6x38RD 0x011A /* GDT6538RD/GDT6638RD */ +#define PCI_PRODUCT_VORTEX_GDT_6x58RD 0x011B /* GDT6558RD/GDT6658RD */ +/* GDT_MPR, RN series (64-bit PCI), wide/ultra2 SCSI */ +#define PCI_PRODUCT_VORTEX_GDT_7x18RN 0x0168 /* GDT7118RN/GDT7518RN/GDT7618RN */ +#define PCI_PRODUCT_VORTEX_GDT_7x28RN 0x0169 /* GDT7128RN/GDT7528RN/GDT7628RN */ +#define PCI_PRODUCT_VORTEX_GDT_7x38RN 0x016A /* GDT7538RN/GDT7638RN */ +#define PCI_PRODUCT_VORTEX_GDT_7x58RN 0x016B /* GDT7558RN/GDT7658RN */ +/* GDT_MPR, RD series, Fibre Channel */ +#define PCI_PRODUCT_VORTEX_GDT_6x19RD 0x0210 /* GDT6519RD/GDT6619RD */ +#define PCI_PRODUCT_VORTEX_GDT_6x29RD 0x0211 /* GDT6529RD/GDT6629RD */ +/* GDT_MPR, RN series (64-bit PCI), Fibre Channel */ +#define PCI_PRODUCT_VORTEX_GDT_7x19RN 0x0260 /* GDT7519RN/GDT7619RN */ +#define PCI_PRODUCT_VORTEX_GDT_7x29RN 0x0261 /* GDT7529RN/GDT7629RN */ + +/* VLSI products */ +#define PCI_PRODUCT_VLSI_82C592 0x0005 /* 82C592 CPU Bridge */ +#define PCI_PRODUCT_VLSI_82C593 0x0006 /* 82C593 ISA Bridge */ +#define PCI_PRODUCT_VLSI_82C594 0x0007 /* 82C594 Wildcat System Controller */ +#define PCI_PRODUCT_VLSI_82C596597 0x0008 /* 82C596/597 Wildcat ISA Bridge */ +#define PCI_PRODUCT_VLSI_82C541 0x000c /* 82C541 */ +#define PCI_PRODUCT_VLSI_82C543 0x000d /* 82C543 */ +#define PCI_PRODUCT_VLSI_82C532 0x0101 /* 82C532 */ +#define PCI_PRODUCT_VLSI_82C534 0x0102 /* 82C534 */ +#define PCI_PRODUCT_VLSI_82C535 0x0104 /* 82C535 */ +#define PCI_PRODUCT_VLSI_82C147 0x0105 /* 82C147 */ +#define PCI_PRODUCT_VLSI_82C975 0x0200 /* 82C975 */ +#define PCI_PRODUCT_VLSI_82C925 0x0280 /* 82C925 */ + +/* Weitek products */ +#define PCI_PRODUCT_WEITEK_P9000 0x9001 /* P9000 */ +#define PCI_PRODUCT_WEITEK_P9100 0x9100 /* P9100 */ + +/* Western Digital products */ +#define PCI_PRODUCT_WD_WD33C193A 0x0193 /* WD33C193A */ +#define PCI_PRODUCT_WD_WD33C196A 0x0196 /* WD33C196A */ +#define PCI_PRODUCT_WD_WD33C197A 0x0197 /* WD33C197A */ +#define PCI_PRODUCT_WD_WD7193 0x3193 /* WD7193 */ +#define PCI_PRODUCT_WD_WD7197 0x3197 /* WD7197 */ +#define PCI_PRODUCT_WD_WD33C296A 0x3296 /* WD33C296A */ +#define PCI_PRODUCT_WD_WD34C296 0x4296 /* WD34C296 */ +#define PCI_PRODUCT_WD_90C 0xC24A /* 90C */ + +/* Winbond Electronics products */ +#define PCI_PRODUCT_WINBOND_W83769F 0x0001 /* W83769F */ +#define PCI_PRODUCT_WINBOND_W89C840F 0x0840 /* W89C840F 10/100 Ethernet */ +#define PCI_PRODUCT_WINBOND_W89C940F 0x0940 /* W89C940F Ethernet */ +#define PCI_PRODUCT_WINBOND_W89C940F_1 0x5a5a /* W89C940F Ethernet */ + +/* Xircom products */ +/* is the `-3' here just indicating revision 3, or is it really part + of the device name? */ +#define PCI_PRODUCT_XIRCOM_X3201_3 0x0002 /* X3201-3 Fast Ethernet Controller */ +/* this is the device id `indicating 21143 driver compatibility' */ +#define PCI_PRODUCT_XIRCOM_X3201_3_21143 0x0003 /* X3201-3 Fast Ethernet Controller (21143) */ + +/* Yamaha products */ +#define PCI_PRODUCT_YAMAHA_YMF724 0x0004 /* 724 Audio */ +#define PCI_PRODUCT_YAMAHA_YMF740 0x000A /* 740 Audio */ +#define PCI_PRODUCT_YAMAHA_YMF740C 0x000C /* 740C (DS-1) Audio */ +#define PCI_PRODUCT_YAMAHA_YMF724F 0x000D /* 724F (DS-1) Audio */ +#define PCI_PRODUCT_YAMAHA_YMF744B 0x0010 /* 744 (DS-1S) Audio */ +#define PCI_PRODUCT_YAMAHA_YMF754 0x0012 /* 754 (DS-1E) Audio */ + +/* Zeinet products */ +#define PCI_PRODUCT_ZEINET_1221 0x0001 /* 1221 */ + +/* Ziatech products */ +#define PCI_PRODUCT_ZIATECH_ZT8905 0x8905 /* PCI-ST32 Bridge */ + +/* Zoran products */ +#define PCI_PRODUCT_ZORAN_ZR36120 0x6120 /* Video Controller */ diff --git a/cfe/cfe/pci/pcidevs_data.h b/cfe/cfe/pci/pcidevs_data.h new file mode 100644 index 0000000..1bdc7f4 --- /dev/null +++ b/cfe/cfe/pci/pcidevs_data.h @@ -0,0 +1,5873 @@ +/* + * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. + * + * generated from: + * pcidevs 2002/09/03 broadcom + */ + +/* + * Copyright (c) 1995, 1996 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +static const struct pci_knowndev pci_knowndevs[] = { + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C985, + 0, + "3Com", + "3c985 Gigabit Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C590, + 0, + "3Com", + "3c590 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595TX, + 0, + "3Com", + "3c595-TX 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595T4, + 0, + "3Com", + "3c595-T4 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595MII, + 0, + "3Com", + "3c595-MII 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900TPO, + 0, + "3Com", + "3c900-TPO Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900COMBO, + 0, + "3Com", + "3c900-COMBO Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905TX, + 0, + "3Com", + "3c905-TX 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905T4, + 0, + "3Com", + "3c905-T4 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BTPO, + 0, + "3Com", + "3c900B-TPO Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BCOMBO, + 0, + "3Com", + "3c900B-COMBO Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BTPC, + 0, + "3Com", + "3c900B-TPC Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BTX, + 0, + "3Com", + "3c905B-TX 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BT4, + 0, + "3Com", + "3c905B-T4 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BCOMBO, + 0, + "3Com", + "3c905B-COMBO 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BFX, + 0, + "3Com", + "3c905B-FX 100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905CTX, + 0, + "3Com", + "3c905C-TX 10/100 Ethernet with mngmt", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C980SRV, + 0, + "3Com", + "3c980 Server Adapter 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C980CTXM, + 0, + "3Com", + "3c980C-TXM 10/100 Ethernet", + }, + { + PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990TX97, + 0, + "3Com", + "3CR990-TX-97 10/100 Ethernet", + }, + { + PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_VOODOO, + 0, + "3Dfx Interactive", + "Voodoo", + }, + { + PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_VOODOO2, + 0, + "3Dfx Interactive", + "Voodoo2", + }, + { + PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_BANSHEE, + 0, + "3Dfx Interactive", + "Banshee", + }, + { + PCI_VENDOR_3DFX, PCI_PRODUCT_3DFX_VOODOO3, + 0, + "3Dfx Interactive", + "Voodoo3", + }, + { + PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_300SX, + 0, + "3D Labs", + "GLINT 300SX", + }, + { + PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_500TX, + 0, + "3D Labs", + "GLINT 500TX", + }, + { + PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_DELTA, + 0, + "3D Labs", + "GLINT DELTA", + }, + { + PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_PERMEDIA, + 0, + "3D Labs", + "GLINT Permedia", + }, + { + PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_500MX, + 0, + "3D Labs", + "GLINT 500MX", + }, + { + PCI_VENDOR_3DLABS, PCI_PRODUCT_3DLABS_PERMEDI2, + 0, + "3D Labs", + "GLINT Permedia 2", + }, + { + PCI_VENDOR_3WARE, PCI_PRODUCT_3WARE_ESCALADE, + 0, + "3ware", + "Escalade IDE RAID", + }, + { + PCI_VENDOR_ACC, PCI_PRODUCT_ACC_2188, + 0, + "ACC Microelectronics", + "ACCM 2188 VL-PCI Bridge", + }, + { + PCI_VENDOR_ACC, PCI_PRODUCT_ACC_2051_HB, + 0, + "ACC Microelectronics", + "2051 PCI Single Chip Solution (host bridge)", + }, + { + PCI_VENDOR_ACC, PCI_PRODUCT_ACC_2051_ISA, + 0, + "ACC Microelectronics", + "2051 PCI Single Chip Solution (ISA bridge)", + }, + { + PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6710, + 0, + "Acard", + "AEC6710 SCSI", + }, + { + PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6712UW, + 0, + "Acard", + "AEC6712UW SCSI", + }, + { + PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6712U, + 0, + "Acard", + "AEC6712U SCSI", + }, + { + PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6712S, + 0, + "Acard", + "AEC6712S SCSI", + }, + { + PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6710D, + 0, + "Acard", + "AEC6710D SCSI", + }, + { + PCI_VENDOR_ACARD, PCI_PRODUCT_ACARD_AEC6715UW, + 0, + "Acard", + "AEC6715UW SCSI", + }, + { + PCI_VENDOR_ACCTON, PCI_PRODUCT_ACCTON_MPX5030, + 0, + "Accton Technology", + "MPX 5030/5038 Ethernet", + }, + { + PCI_VENDOR_ACER, PCI_PRODUCT_ACER_M1435, + 0, + "Acer", + "M1435 VL-PCI Bridge", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1445, + 0, + "Acer Labs", + "M1445 VL-PCI Bridge", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1449, + 0, + "Acer Labs", + "M1449 PCI-ISA Bridge", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1451, + 0, + "Acer Labs", + "M1451 Host-PCI Bridge", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1461, + 0, + "Acer Labs", + "M1461 Host-PCI Bridge", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1531, + 0, + "Acer Labs", + "M1531 Host-PCI Bridge", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1541, + 0, + "Acer Labs", + "M1541 Host-PCI Bridge", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M1543, + 0, + "Acer Labs", + "M1543 PCI-ISA Bridge", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M3309, + 0, + "Acer Labs", + "M3309 MPEG Decoder", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M4803, + 0, + "Acer Labs", + "M4803", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5229, + 0, + "Acer Labs", + "M5229 UDMA IDE Controller", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5237, + 0, + "Acer Labs", + "M5237 USB Host Controller", + }, + { + PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M7101, + 0, + "Acer Labs", + "M7101 Power Management Controller", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7850, + 0, + "Adaptec", + "AIC-7850", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7855, + 0, + "Adaptec", + "AIC-7855", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC5900, + 0, + "Adaptec", + "AIC-5900 ATM", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC5905, + 0, + "Adaptec", + "AIC-5905 ATM", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC6915, + 0, + "Adaptec", + "AIC-6915 10/100 Ethernet", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7860, + 0, + "Adaptec", + "AIC-7860", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_APA1480, + 0, + "Adaptec", + "APA-1480 Ultra", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940AU, + 0, + "Adaptec", + "AHA-2940A Ultra", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7870, + 0, + "Adaptec", + "AIC-7870", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940, + 0, + "Adaptec", + "AHA-2940", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3940, + 0, + "Adaptec", + "AHA-3940", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3985, + 0, + "Adaptec", + "AHA-3985", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2944, + 0, + "Adaptec", + "AHA-2944", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7895, + 0, + "Adaptec", + "AIC-7895 Ultra", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7880, + 0, + "Adaptec", + "AIC-7880 Ultra", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940U, + 0, + "Adaptec", + "AHA-2940 Ultra", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3940U, + 0, + "Adaptec", + "AHA-3940 Ultra", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_389XU, + 0, + "Adaptec", + "AHA-389X Ultra", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2944U, + 0, + "Adaptec", + "AHA-2944 Ultra", + }, + { + PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940UP, + 0, + "Adaptec", + "AHA-2940 Ultra Pro", + }, + { + PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_2940U2, + 0, + "Adaptec (2nd PCI Vendor ID)", + "AHA-2940 Ultra2", + }, + { + PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_2930U2, + 0, + "Adaptec (2nd PCI Vendor ID)", + "AHA-2930 Ultra2", + }, + { + PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7890, + 0, + "Adaptec (2nd PCI Vendor ID)", + "AIC-7890/1", + }, + { + PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3950U2B, + 0, + "Adaptec (2nd PCI Vendor ID)", + "AHA-3950 Ultra2", + }, + { + PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3950U2D, + 0, + "Adaptec (2nd PCI Vendor ID)", + "AHA-3950 Ultra2", + }, + { + PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7896, + 0, + "Adaptec (2nd PCI Vendor ID)", + "AIC-7896/7", + }, + { + PCI_VENDOR_ADDTRON, PCI_PRODUCT_ADDTRON_8139, + 0, + "Addtron Technology", + "8139 Ethernet", + }, + { + PCI_VENDOR_ADMTEK, PCI_PRODUCT_ADMTEK_AL981, + 0, + "ADMtek", + "ADMtek AL981 10/100 Ethernet", + }, + { + PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_1200A, + 0, + "Advanced System Products", + "", + }, + { + PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_1200B, + 0, + "Advanced System Products", + "", + }, + { + PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_ULTRA, + 0, + "Advanced System Products", + "ABP-930/40UA", + }, + { + PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_WIDE, + 0, + "Advanced System Products", + "ABP-940UW", + }, + { + PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_U2W, + 0, + "Advanced System Products", + "ASB-3940U2W", + }, + { + PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_U3W, + 0, + "Advanced System Products", + "ASB-3940U3W", + }, + { + PCI_VENDOR_ALLIANCE, PCI_PRODUCT_ALLIANCE_AT24, + 0, + "Alliance Semiconductor", + "AT24", + }, + { + PCI_VENDOR_ALLIANCE, PCI_PRODUCT_ALLIANCE_AT25, + 0, + "Alliance Semiconductor", + "AT25", + }, + { + PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENIC, + 0, + "Alteon", + "ACEnic Gigabit Ethernet", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCNET_PCI, + 0, + "Advanced Micro Devices", + "79c970 PCnet-PCI LANCE Ethernet", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCNET_HOME, + 0, + "Advanced Micro Devices", + "79c978 PCnet-PCI Home", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCSCSI_PCI, + 0, + "Advanced Micro Devices", + "53c974 PCscsi-PCI SCSI", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PCNETS_PCI, + 0, + "Advanced Micro Devices", + "79C974 PCnet-PCI Ethernet & SCSI", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC751_SC, + 0, + "Advanced Micro Devices", + "AMD751 System Controller", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_SC751_PPB, + 0, + "Advanced Micro Devices", + "AMD751 PCI-to-PCI Bridge", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC756_ISA, + 0, + "Advanced Micro Devices", + "AMD756 PCI-to-ISA Bridge", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC756_IDE, + 0, + "Advanced Micro Devices", + "AMD756 IDE controller", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC756_PMC, + 0, + "Advanced Micro Devices", + "AMD756 Power Management Controller", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC756_USB, + 0, + "Advanced Micro Devices", + "AMD756 USB Host Controller", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HT7520, + 0, + "Advanced Micro Devices", + "(PLX) HT7520 PCIX Tunnel", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HT7520_PIC, + 0, + "Advanced Micro Devices", + "(PLX) HT7520 PCIX IOAPIC", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD8151_AGP, + 0, + "Advanced Micro Devices", + "AMD8151 AGP Device", + }, + { + PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD8151, + 0, + "Advanced Micro Devices", + "AMD8151 HyperTransport-AGP Bridge", + }, + { + PCI_VENDOR_API, PCI_PRODUCT_API_STURGEON, + 0, + "API Networks", + "AP1011 HyperTransport-PCI Bridge", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_BANDIT, + 0, + "Apple Computer", + "Bandit Host-PCI Bridge", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GC, + 0, + "Apple Computer", + "Grand Central I/O Controller", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_CONTROL, + 0, + "Apple Computer", + "Control", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PLANB, + 0, + "Apple Computer", + "PlanB", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_OHARE, + 0, + "Apple Computer", + "OHare I/O Controller", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_BANDIT2, + 0, + "Apple Computer", + "Bandit Host-PCI Bridge", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_HEATHROW, + 0, + "Apple Computer", + "MAC-IO I/O Controller (Heathrow)", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_PADDINGTON, + 0, + "Apple Computer", + "MAC-IO I/O Controller (Paddington)", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_KEYLARGO_USB, + 0, + "Apple Computer", + "KeyLargo USB Controller", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH1, + 0, + "Apple Computer", + "UniNorth Host-PCI Bridge", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH2, + 0, + "Apple Computer", + "UniNorth Host-PCI Bridge", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_UNINORTH_AGP, + 0, + "Apple Computer", + "UniNorth AGP Interface", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GMAC, + 0, + "Apple Computer", + "GMAC Ethernet", + }, + { + PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_KEYLARGO, + 0, + "Apple Computer", + "MAC-IO I/O Controller (KeyLargo)", + }, + { + PCI_VENDOR_ARC, PCI_PRODUCT_ARC_1000PV, + 0, + "ARC Logic", + "1000PV", + }, + { + PCI_VENDOR_ARC, PCI_PRODUCT_ARC_2000PV, + 0, + "ARC Logic", + "2000PV", + }, + { + PCI_VENDOR_ARC, PCI_PRODUCT_ARC_2000MT, + 0, + "ARC Logic", + "2000MT", + }, + { + PCI_VENDOR_ASIX, PCI_PRODUCT_ASIX_AX88140A, + 0, + "ASIX Electronics", + "AX88140A 10/100 Ethernet", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH32, + 0, + "ATI Technologies", + "Mach32", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_CT, + 0, + "ATI Technologies", + "Mach64 CT", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_CX, + 0, + "ATI Technologies", + "Mach64 CX", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_ET, + 0, + "ATI Technologies", + "Mach64 ET", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_VT, + 0, + "ATI Technologies", + "Mach64 VT", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_B, + 0, + "ATI Technologies", + "Mach64 B", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GB, + 0, + "ATI Technologies", + "Mach64 GB", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GD, + 0, + "ATI Technologies", + "Mach64 GD", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GI, + 0, + "ATI Technologies", + "Mach64 GI", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GP, + 0, + "ATI Technologies", + "Mach64 GP", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GQ, + 0, + "ATI Technologies", + "Mach64 GQ", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GT, + 0, + "ATI Technologies", + "Mach64 GT", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GU, + 0, + "ATI Technologies", + "Mach64 GU", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GV, + 0, + "ATI Technologies", + "Mach64 GV", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GW, + 0, + "ATI Technologies", + "Mach64 GW", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GX, + 0, + "ATI Technologies", + "Mach64 GX", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_GZ, + 0, + "ATI Technologies", + "Mach64 GZ", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_LB, + 0, + "ATI Technologies", + "Mach64 LB", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_LD, + 0, + "ATI Technologies", + "Mach64 LD", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_LG, + 0, + "ATI Technologies", + "Mach64 LG", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_LI, + 0, + "ATI Technologies", + "Mach64 LI", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_LM, + 0, + "ATI Technologies", + "Mach64 LM", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_LP, + 0, + "ATI Technologies", + "Mach64 LP", + }, + { + PCI_VENDOR_ATI, PCI_PRODUCT_ATI_MACH64_LR, + 0, + "ATI Technologies", + "Mach64 LR", + }, + { + PCI_VENDOR_AURAVISION, PCI_PRODUCT_AURAVISION_VXP524, + 0, + "Auravision", + "VxP524 PCI Video Processor", + }, + { + PCI_VENDOR_AUREAL, PCI_PRODUCT_AUREAL_AU8820, + 0, + "Aureal Semiconductor", + "AU8820 Vortex Digital Audio Processor", + }, + { + PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_S5933, + 0, + "Applied Micro Circuits", + "S5933 PCI Matchmaker", + }, + { + PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_LANAI, + 0, + "Applied Micro Circuits", + "Myrinet LANai Interface", + }, + { + PCI_VENDOR_AMCIRCUITS, PCI_PRODUCT_AMCIRCUITS_S5920, + 0, + "Applied Micro Circuits", + "S5920 PCI Target", + }, + { + PCI_VENDOR_ATRONICS, PCI_PRODUCT_ATRONICS_IDE_2015PL, + 0, + "Atronics", + "IDE-2015PL", + }, + { + PCI_VENDOR_AVANCE, PCI_PRODUCT_AVANCE_AVL2301, + 0, + "Avance Logic", + "AVL2301", + }, + { + PCI_VENDOR_AVANCE, PCI_PRODUCT_AVANCE_AVG2302, + 0, + "Avance Logic", + "AVG2302", + }, + { + PCI_VENDOR_AVANCE2, PCI_PRODUCT_AVANCE2_ALG2301, + 0, + "Avance Logic (2nd PCI Vendor ID)", + "ALG2301", + }, + { + PCI_VENDOR_AVANCE2, PCI_PRODUCT_AVANCE2_ALG2302, + 0, + "Avance Logic (2nd PCI Vendor ID)", + "ALG2302", + }, + { + PCI_VENDOR_CCUBE, PCI_PRODUCT_CCUBE_CINEMASTER, + 0, + "C-Cube Microsystems", + "Cinemaster C 3.0 DVD Decoder", + }, + { + PCI_VENDOR_AVM, PCI_PRODUCT_AVM_FRITZ_CARD, + 0, + "AVM", + "Fritz! Card ISDN Interface", + }, + { + PCI_VENDOR_BIT3, PCI_PRODUCT_BIT3_PCIVME617, + 0, + "Bit3 Computer Corp.", + "PCI-VME Interface Mod. 617", + }, + { + PCI_VENDOR_BIT3, PCI_PRODUCT_BIT3_PCIVME618, + 0, + "Bit3 Computer Corp.", + "PCI-VME Interface Mod. 618", + }, + { + PCI_VENDOR_BIT3, PCI_PRODUCT_BIT3_PCIVME2706, + 0, + "Bit3 Computer Corp.", + "PCI-VME Interface Mod. 2706", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4211, + 0, + "Broadcom", + "BCM4211 iLine10 Controller", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4212, + 0, + "Broadcom", + "BCM4212 V.90 Modem", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5700, + 0, + "Broadcom", + "BCM5700 10/100/1000 Ethernet", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5701, + 0, + "Broadcom", + "BCM5701 10/100/1000 Ethernet", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5702, + 0, + "Broadcom", + "BCM5702 10/100/1000 Ethernet", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5703, + 0, + "Broadcom", + "BCM5703 10/100/1000 Ethernet", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5705, + 0, + "Broadcom", + "BCM5705 10/100/1000 Ethernet", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5820, + 0, + "Broadcom", + "BCM5820 eCommerce Processor", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5821, + 0, + "Broadcom", + "BCM5821 Super-eCommerce Processor", + }, + { + PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5850, + 0, + "Broadcom", + "BCM5850 SSL/TLS Protocol Processor", + }, + { + PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT848, + 0, + "Brooktree", + "Bt848 Video Capture", + }, + { + PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT849, + 0, + "Brooktree", + "Bt849 Video Capture", + }, + { + PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT878, + 0, + "Brooktree", + "Bt878 Video Capture", + }, + { + PCI_VENDOR_BROOKTREE, PCI_PRODUCT_BROOKTREE_BT879, + 0, + "Brooktree", + "Bt879 Video Capture", + }, + { + PCI_VENDOR_BUSLOGIC, PCI_PRODUCT_BUSLOGIC_MULTIMASTER_NC, + 0, + "BusLogic", + "MultiMaster NC", + }, + { + PCI_VENDOR_BUSLOGIC, PCI_PRODUCT_BUSLOGIC_MULTIMASTER, + 0, + "BusLogic", + "MultiMaster", + }, + { + PCI_VENDOR_BUSLOGIC, PCI_PRODUCT_BUSLOGIC_FLASHPOINT, + 0, + "BusLogic", + "FlashPoint", + }, + { + PCI_VENDOR_C4T, PCI_PRODUCT_C4T_GPPCI, + 0, + "c't Magazin", + "GPPCI", + }, + { + PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_64310, + 0, + "Chips and Technologies", + "64310", + }, + { + PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_65545, + 0, + "Chips and Technologies", + "65545", + }, + { + PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_65548, + 0, + "Chips and Technologies", + "65548", + }, + { + PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_65550, + 0, + "Chips and Technologies", + "65550", + }, + { + PCI_VENDOR_CHIPS, PCI_PRODUCT_CHIPS_65554, + 0, + "Chips and Technologies", + "65554", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD7548, + 0, + "Cirrus Logic", + "CL-GD7548", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5430, + 0, + "Cirrus Logic", + "CL-GD5430", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5434_4, + 0, + "Cirrus Logic", + "CL-GD5434-4", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5434_8, + 0, + "Cirrus Logic", + "CL-GD5434-8", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5436, + 0, + "Cirrus Logic", + "CL-GD5436", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5446, + 0, + "Cirrus Logic", + "CL-GD5446", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD5480, + 0, + "Cirrus Logic", + "CL-GD5480", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_PD6729, + 0, + "Cirrus Logic", + "CL-PD6729", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_PD6832, + 0, + "Cirrus Logic", + "CL-PD6832 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_PD6833, + 0, + "Cirrus Logic", + "CL-PD6833 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD7542, + 0, + "Cirrus Logic", + "CL-GD7542", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD7543, + 0, + "Cirrus Logic", + "CL-GD7543", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_GD7541, + 0, + "Cirrus Logic", + "CL-GD7541", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CL_CD4400, + 0, + "Cirrus Logic", + "CL-CD4400 Communications Controller", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4610, + 0, + "Cirrus Logic", + "CS4610 SoundFusion Audio Accelerator", + }, + { + PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4280, + 0, + "Cirrus Logic", + "CS4280 CrystalClear Audio Interface", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_640, + 0, + "CMD Technology", + "PCI0640", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_642, + 0, + "CMD Technology", + "PCI0642", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_643, + 0, + "CMD Technology", + "PCI0643", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_646, + 0, + "CMD Technology", + "PCI0646", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_647, + 0, + "CMD Technology", + "PCI0647", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_648, + 0, + "CMD Technology", + "PCI0648", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_649, + 0, + "CMD Technology", + "PCI0649", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_650A, + 0, + "CMD Technology", + "PCI0650A", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_670, + 0, + "CMD Technology", + "USB0670", + }, + { + PCI_VENDOR_CMDTECH, PCI_PRODUCT_CMDTECH_673, + 0, + "CMD Technology", + "USB0673", + }, + { + PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_CMI8338A, + 0, + "C-Media Electronics Inc", + "CMI8338A PCI Audio Device", + }, + { + PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_CMI8338B, + 0, + "C-Media Electronics Inc", + "CMI8338B PCI Audio Device", + }, + { + PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_CMI8738, + 0, + "C-Media Electronics Inc", + "CMI8738/C3DX PCI Audio Device", + }, + { + PCI_VENDOR_CMEDIA, PCI_PRODUCT_CMEDIA_HSP56, + 0, + "C-Media Electronics Inc", + "HSP56 Audiomodem Riser", + }, + { + PCI_VENDOR_COGENT, PCI_PRODUCT_COGENT_EM110TX, + 0, + "Cogent Data Technologies", + "EX110TX PCI Fast Ethernet Adapter", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_PCI_EISA_BRIDGE, + 0, + "Compaq", + "PCI-EISA Bridge", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_PCI_ISA_BRIDGE, + 0, + "Compaq", + "PCI-ISA Bridge", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_TRIFLEX1, + 0, + "Compaq", + "Triflex Host-PCI Bridge", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_TRIFLEX2, + 0, + "Compaq", + "Triflex Host-PCI Bridge", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_QVISION_V0, + 0, + "Compaq", + "QVision", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_QVISION_1280P, + 0, + "Compaq", + "QVision 1280/p", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_QVISION_V2, + 0, + "Compaq", + "QVision", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_TRIFLEX4, + 0, + "Compaq", + "Triflex Host-PCI Bridge", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_USB, + 0, + "Compaq", + "USB Controller", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_SMART2P, + 0, + "Compaq", + "SMART2P RAID", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_N100TX, + 0, + "Compaq", + "Netelligent 10/100 TX", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_N10T, + 0, + "Compaq", + "Netelligent 10 T", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_IntNF3P, + 0, + "Compaq", + "Integrated NetFlex 3/P", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_DPNet100TX, + 0, + "Compaq", + "Dual Port Netelligent 10/100 TX", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_IntPL100TX, + 0, + "Compaq", + "ProLiant Integrated Netelligent 10/100 TX", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_DP4000, + 0, + "Compaq", + "Deskpro 4000 5233MMX", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_NF3P_BNC, + 0, + "Compaq", + "NetFlex 3/P w/ BNC", + }, + { + PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_NF3P, + 0, + "Compaq", + "NetFlex 3/P", + }, + { + PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_NE2KETHER, + 0, + "Compex", + "Ethernet", + }, + { + PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_RL100ATX, + 0, + "Compex", + "RL100-ATX 10/100 Ethernet", + }, + { + PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_RL100TX, + 0, + "Compex", + "RL100-TX 10/100 Ethernet", + }, + { + PCI_VENDOR_CONEXANT, PCI_PRODUCT_CONEXANT_SOFTK56, + 0, + "Conexant Systems", + "SoftK56 PCI Software Modem", + }, + { + PCI_VENDOR_CONTAQ, PCI_PRODUCT_CONTAQ_82C599, + 0, + "Contaq Microsystems", + "82C599 PCI-VLB Bridge", + }, + { + PCI_VENDOR_CONTAQ, PCI_PRODUCT_CONTAQ_82C693, + 0, + "Contaq Microsystems", + "82C693 PCI-ISA Bridge", + }, + { + PCI_VENDOR_COROLLARY, PCI_PRODUCT_COROLLARY_CBUSII_PCIB, + 0, + "Corrollary", + "\"C-Bus II\"-PCI Bridge", + }, + { + PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBLIVE, + 0, + "Creative Labs", + "SBLive! EMU 10000", + }, + { + PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_SBJOY, + 0, + "Creative Labs", + "PCI Gameport Joystick", + }, + { + PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_EV1938, + 0, + "Creative Labs", + "Ectiva 1938", + }, + { + PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMY_1, + 0, + "Cyclades", + "Cyclom-Y below 1M", + }, + { + PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMY_2, + 0, + "Cyclades", + "Cyclom-Y above 1M", + }, + { + PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM4Y_1, + 0, + "Cyclades", + "Cyclom-4Y below 1M", + }, + { + PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM4Y_2, + 0, + "Cyclades", + "Cyclom-4Y above 1M", + }, + { + PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM8Y_1, + 0, + "Cyclades", + "Cyclom-8Y below 1M", + }, + { + PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM8Y_2, + 0, + "Cyclades", + "Cyclom-8Y above 1M", + }, + { + PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMZ_1, + 0, + "Cyclades", + "Cyclom-Z below 1M", + }, + { + PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMZ_2, + 0, + "Cyclades", + "Cyclom-Z above 1M", + }, + { + PCI_VENDOR_DAVICOM, PCI_PRODUCT_DAVICOM_DM9102, + 0, + "Davicom Semiconductor", + "Davicom DM9102 10/100 Ethernet", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21050, + 0, + "Digital Equipment", + "DECchip 21050 PCI-PCI Bridge", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21040, + 0, + "Digital Equipment", + "DECchip 21040 Ethernet", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21030, + 0, + "Digital Equipment", + "DECchip 21030 (\"TGA\")", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_NVRAM, + 0, + "Digital Equipment", + "Zephyr NV-RAM", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_KZPSA, + 0, + "Digital Equipment", + "KZPSA", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21140, + 0, + "Digital Equipment", + "DECchip 21140 10/100 Ethernet", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_PBXGB, + 0, + "Digital Equipment", + "TGA2", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_DEFPA, + 0, + "Digital Equipment", + "DEFPA", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21041, + 0, + "Digital Equipment", + "DECchip 21041 Ethernet", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_DGLPB, + 0, + "Digital Equipment", + "DGLPB (\"OPPO\")", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21142, + 0, + "Digital Equipment", + "DECchip 21142/21143 10/100 Ethernet", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21052, + 0, + "Digital Equipment", + "DECchip 21052 PCI-PCI Bridge", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21150, + 0, + "Digital Equipment", + "DECchip 21150 PCI-PCI Bridge", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21152, + 0, + "Digital Equipment", + "DECchip 21152 PCI-PCI Bridge", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21153, + 0, + "Digital Equipment", + "DECchip 21153 PCI-PCI Bridge", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_21154, + 0, + "Digital Equipment", + "DECchip 21154 PCI-PCI Bridge", + }, + { + PCI_VENDOR_DEC, PCI_PRODUCT_DEC_CPQ42XX, + 0, + "Digital Equipment", + "Compaq SMART RAID 42xx", + }, + { + PCI_VENDOR_DELTA, PCI_PRODUCT_DELTA_8139, + 0, + "Delta Electronics", + "8139 Ethernet", + }, + { + PCI_VENDOR_DIAMOND, PCI_PRODUCT_DIAMOND_VIPER, + 0, + "Diamond Computer Systems", + "Viper/PCI", + }, + { + PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DFE550TX, + 0, + "D-Link Systems", + "DFE-550TX 10/100 Ethernet", + }, + { + PCI_VENDOR_DPT, PCI_PRODUCT_DPT_SC_RAID, + 0, + "Distributed Processing Technology", + "SmartCache/SmartRAID", + }, + { + PCI_VENDOR_DPT, PCI_PRODUCT_DPT_RAID_I2O, + 0, + "Distributed Processing Technology", + "SmartRAID (I2O)", + }, + { + PCI_VENDOR_DPT, PCI_PRODUCT_DPT_MEMCTLR, + 0, + "Distributed Processing Technology", + "Memory Controller", + }, + { + PCI_VENDOR_DOLPHIN, PCI_PRODUCT_DOLPHIN_PCISCI, + 0, + "Dolphin Interconnect Solutions", + "PCI-SCI Bridge", + }, + { + PCI_VENDOR_DOMEX, PCI_PRODUCT_DOMEX_PCISCSI, + 0, + "Domex", + "DMX-3191D", + }, + { + PCI_VENDOR_ELSA, PCI_PRODUCT_ELSA_QS1PCI, + 0, + "Elsa", + "QuickStep 1000 ISDN card", + }, + { + PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LPPFC, + 0, + "Emulex", + "\"Light Pulse\" FibreChannel adapter", + }, + { + PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_AUDIOPCI, + 0, + "Ensoniq", + "AudioPCI", + }, + { + PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_AUDIOPCI97, + 0, + "Ensoniq", + "AudioPCI 97", + }, + { + PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_CT5880, + 0, + "Ensoniq", + "CT5880", + }, + { + PCI_VENDOR_EPIGRAM, PCI_PRODUCT_EPIGRAM_BCM4210, + 0, + "Epigram", + "BCM4210 iLine10 Controller", + }, + { + PCI_VENDOR_ESSENTIAL, PCI_PRODUCT_ESSENTIAL_RR_HIPPI, + 0, + "Essential Communications", + "RoadRunner HIPPI Interface", + }, + { + PCI_VENDOR_ESSENTIAL, PCI_PRODUCT_ESSENTIAL_RR_GIGE, + 0, + "Essential Communications", + "RoadRunner Gig-E Interface", + }, + { + PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO1, + 0, + "ESS Technology Inc", + "Maestro 1 PCI Audio Accelerator", + }, + { + PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO2, + 0, + "ESS Technology Inc", + "Maestro 2 PCI Audio Accelerator", + }, + { + PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_SOLO1, + 0, + "ESS Technology Inc", + "Solo-1 PCI AudioDrive", + }, + { + PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO2E, + 0, + "ESS Technology Inc", + "Maestro 2E PCI Audio Accelerator", + }, + { + PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO3, + 0, + "ESS Technology Inc", + "Maestro 3 PCI Audio Accelerator", + }, + { + PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO3MODEM, + 0, + "ESS Technology Inc", + "Maestro 3 Modem", + }, + { + PCI_VENDOR_ESSTECH2, PCI_PRODUCT_ESSTECH2_MAESTRO1, + 0, + "ESS Technology Inc", + "Maestro 1 PCI Audio Accelerator", + }, + { + PCI_VENDOR_O2MICRO, PCI_PRODUCT_O2MICRO_OZ6832, + 0, + "O2 Micro Inc", + "OZ6832 CardBus Controller", + }, + { + PCI_VENDOR_ES, PCI_PRODUCT_ES_FREEDOM, + 0, + "Evans & Sutherland", + "Freedom PCI-GBus Interface", + }, + { + PCI_VENDOR_FORE, PCI_PRODUCT_FORE_PCA200, + 0, + "FORE Systems", + "ATM PCA-200", + }, + { + PCI_VENDOR_FORE, PCI_PRODUCT_FORE_PCA200E, + 0, + "FORE Systems", + "ATM PCA-200e", + }, + { + PCI_VENDOR_FORTEMEDIA, PCI_PRODUCT_FORTEMEDIA_FM801, + 0, + "Forte Media", + "Forte Media 801 Sound", + }, + { + PCI_VENDOR_FUTUREDOMAIN, PCI_PRODUCT_FUTUREDOMAIN_TMC_18C30, + 0, + "Future Domain", + "TMC-18C30 (36C70)", + }, + { + PCI_VENDOR_EFFICIENTNETS, PCI_PRODUCT_EFFICIENTNETS_ENI155PF, + 0, + "Efficent Networks", + "155P-MF1 ATM (FPGA)", + }, + { + PCI_VENDOR_EFFICIENTNETS, PCI_PRODUCT_EFFICIENTNETS_ENI155PA, + 0, + "Efficent Networks", + "155P-MF1 ATM (ASIC)", + }, + { + PCI_VENDOR_EFFICIENTNETS, PCI_PRODUCT_EFFICIENTNETS_ENI25P, + 0, + "Efficent Networks", + "SpeedStream ENI-25p", + }, + { + PCI_VENDOR_EFFICIENTNETS, PCI_PRODUCT_EFFICIENTNETS_SS3000, + 0, + "Efficent Networks", + "SpeedStream 3000", + }, + { + PCI_VENDOR_GALILEO, PCI_PRODUCT_GALILEO_GT64010A, + 0, + "Galileo Technology", + "GT-64010A System Controller", + }, + { + PCI_VENDOR_GALILEO, PCI_PRODUCT_GALILEO_GT64115, + 0, + "Galileo Technology", + "GT-64115 System Controller", + }, + { + PCI_VENDOR_GALILEO, PCI_PRODUCT_GALILEO_GT64011, + 0, + "Galileo Technology", + "GT-64011 System Controller", + }, + { + PCI_VENDOR_GALILEO, PCI_PRODUCT_GALILEO_GT64120, + 0, + "Galileo Technology", + "GT-64120 System Controller", + }, + { + PCI_VENDOR_GALILEO, PCI_PRODUCT_GALILEO_GT64130, + 0, + "Galileo Technology", + "GT-64130 System Controller", + }, + { + PCI_VENDOR_HP, PCI_PRODUCT_HP_J2585A, + 0, + "Hewlett-Packard", + "J2585A", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MCABRIDGE, + 0, + "IBM", + "MCA Bridge", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_ALTALITE, + 0, + "IBM", + "CPU Bridge - Alta Lite", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_ALTAMP, + 0, + "IBM", + "CPU Bridge - Alta MP", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_ISABRIDGE, + 0, + "IBM", + "ISA Bridge w/PnP", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_CPUBRIDGE, + 0, + "IBM", + "CPU Bridge", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_LANSTREAMER, + 0, + "IBM", + "Auto LANStreamer", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_GXT150P, + 0, + "IBM", + "GXT-150P 2D Accelerator", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MCABRIDGE2, + 0, + "IBM", + "MCA Bridge", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_82351, + 0, + "IBM", + "82351 PCI-PCI Bridge", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_SERVERAID, + 0, + "IBM", + "ServeRAID", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_OLYMPIC, + 0, + "IBM", + "Token Ring", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MIAMI, + 0, + "IBM", + "Miami/PCI", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_TURBOWAYS25, + 0, + "IBM", + "Turboways 25 ATM", + }, + { + PCI_VENDOR_IBM, PCI_PRODUCT_IBM_MPIC2, + 0, + "IBM", + "MPIC-II", + }, + { + PCI_VENDOR_IDT, PCI_PRODUCT_IDT_77201, + 0, + "IDT", + "77201/77211 ATM (\"NICStAR\")", + }, + { + PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I920, + 0, + "Initio", + "INIC-920 SCSI", + }, + { + PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I940, + 0, + "Initio", + "INIC-940 SCSI", + }, + { + PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I935, + 0, + "Initio", + "INIC-935 SCSI", + }, + { + PCI_VENDOR_INITIO, PCI_PRODUCT_INITIO_I950, + 0, + "Initio", + "INIC-950 SCSI", + }, + { + PCI_VENDOR_IMS, PCI_PRODUCT_IMS_8849, + 0, + "Integrated Micro Solutions", + "8849", + }, + { + PCI_VENDOR_IMS, PCI_PRODUCT_IMS_TT128M, + 0, + "Integrated Micro Solutions", + "TwinTurbo 128M", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCEB, + 0, + "Intel", + "82375EB/SB PCI-EISA Bridge (PCEB)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CDC, + 0, + "Intel", + "82424ZX Cache and DRAM controller (CDC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SIO, + 0, + "Intel", + "82378ZB System I/O (SIO)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82426EX, + 0, + "Intel", + "82426EX PCI-to-ISA Bridge (PCIB)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCMC, + 0, + "Intel", + "82434LX/NX PCI, Cache and Memory Controller (PCMC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_IN_BUSINESS, + 0, + "Intel", + "InBusiness Fast Ethernet LAN Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82559ER, + 0, + "Intel", + "82559ER Fast Ethernet LAN Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82092AA, + 0, + "Intel", + "82092AA IDE controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_SAA7116, + 0, + "Intel", + "SAA7116", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82596, + 0, + "Intel", + "82596 LAN Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EEPRO100, + 0, + "Intel", + "EE Pro 100 10/100 Fast Ethernet", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EEPRO100S, + 0, + "Intel", + "EE Pro 100 Smart 10/100 Fast Ethernet", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82557, + 0, + "Intel", + "82557 Fast Ethernet LAN Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82437FX, + 0, + "Intel", + "82437FX System Controller (TSC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371FB_ISA, + 0, + "Intel", + "82371FB PCI-to-ISA Bridge (PIIX)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371FB_IDE, + 0, + "Intel", + "82371FB IDE controller (PIIX)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371MX, + 0, + "Intel", + "82371MX Mobile PCI I/O IDE Xcelerator (MPIIX)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82437MX, + 0, + "Intel", + "82437MX Mobile System Controller (MTSC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82441FX, + 0, + "Intel", + "82441FX PCI and Memory Controller (PMC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82380AB, + 0, + "Intel", + "82380AB Mobile PCI-to-ISA Bridge (MISA)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82380FB, + 0, + "Intel", + "82380FB Mobile PCI-to-PCI Bridge (MPCI2)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82439HX, + 0, + "Intel", + "82439HX System Controller (TXC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_LPC, + 0, + "Intel", + "82801AA LPC Interface Bridge", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_IDE, + 0, + "Intel", + "82801AA IDE Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_USB, + 0, + "Intel", + "82801AA USB Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_SMB, + 0, + "Intel", + "82801AA SMBus Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_ACA, + 0, + "Intel", + "82801AA AC-97 Audio Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_ACM, + 0, + "Intel", + "82801AA AC-97 PCI Modem", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_HPB, + 0, + "Intel", + "82801AA Hub-to-PCI Bridge", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_LPC, + 0, + "Intel", + "82801AB LPC Interface Bridge", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_IDE, + 0, + "Intel", + "82801AB IDE Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_USB, + 0, + "Intel", + "82801AB USB Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_SMB, + 0, + "Intel", + "82801AB SMBus Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_ACA, + 0, + "Intel", + "82801AB AC-97 Audio Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_ACM, + 0, + "Intel", + "82801AB AC-97 PCI Modem", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_HPB, + 0, + "Intel", + "82801AB Hub-to-PCI Bridge", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_LPC, + 0, + "Intel", + "82801BA LPC Interface Bridge", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_USB1, + 0, + "Intel", + "82801BA USB Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_SMB, + 0, + "Intel", + "82801BA SMBus Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_USB2, + 0, + "Intel", + "82801BA USB Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_ACA, + 0, + "Intel", + "82801BA AC-97 Audio Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_ACM, + 0, + "Intel", + "82801BA AC-97 PCI Modem", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_LAN, + 0, + "Intel", + "82801BA LAN Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_IDE, + 0, + "Intel", + "82801BA IDE Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_HPB, + 0, + "Intel", + "82801BA Hub-to-PCI Bridge", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371SB_ISA, + 0, + "Intel", + "82371SB PCI-to-ISA Bridge (PIIX3)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371SB_IDE, + 0, + "Intel", + "82371SB IDE Interface (PIIX3)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371SB_USB, + 0, + "Intel", + "82371SB USB Host Controller (PIIX3)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82437VX, + 0, + "Intel", + "82437VX System Controller (TVX)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82439TX, + 0, + "Intel", + "82439TX System Controller (MTXC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_ISA, + 0, + "Intel", + "82371AB PCI-to-ISA Bridge (PIIX4)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_IDE, + 0, + "Intel", + "82371AB IDE controller (PIIX4)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_USB, + 0, + "Intel", + "82371AB USB Host Controller (PIIX4)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82371AB_PMC, + 0, + "Intel", + "82371AB Power Management Controller (PIIX4)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_MCH, + 0, + "Intel", + "82810 Memory Controller Hub", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_GC, + 0, + "Intel", + "82810 Graphics Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_DC100_MCH, + 0, + "Intel", + "82810-DC100 Memory Controller Hub", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_DC100_GC, + 0, + "Intel", + "82810-DC100 Graphics Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810E_MCH, + 0, + "Intel", + "82810E Memory Controller Hub", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810E_GC, + 0, + "Intel", + "82810E Graphics Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443LX, + 0, + "Intel", + "82443LX PCI AGP Controller (PAC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443LX_AGP, + 0, + "Intel", + "82443LX AGP Interface (PAC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443BX, + 0, + "Intel", + "82443BX Host Bridge/Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443BX_AGP, + 0, + "Intel", + "82443BX AGP Interface", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82443BX_NOAGP, + 0, + "Intel", + "82443BX Host Bridge/Controller (AGP disabled)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX, + 0, + "Intel", + "82440MX Host Bridge/Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_ACA, + 0, + "Intel", + "82440MX AC-97 Audio Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_ISA, + 0, + "Intel", + "82440MX PCI-to-ISA Bridge", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_IDE, + 0, + "Intel", + "82440MX IDE Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_USB, + 0, + "Intel", + "82440MX USB Host Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_PMC, + 0, + "Intel", + "82440MX Power Management Controller", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I740, + 0, + "Intel", + "i740 Graphics Accelerator", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCI450_PB, + 0, + "Intel", + "82454KX/GX PCI Bridge (PB)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCI450_MC, + 0, + "Intel", + "82451KX/GX Memory Controller (MC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82451NX_MIOC, + 0, + "Intel", + "82451NX Memory & I/O Controller (MIOC)", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82451NX_PXB, + 0, + "Intel", + "82451NX PCI Expander Bridge (PXB)", + }, + { + PCI_VENDOR_INTERGRAPH, PCI_PRODUCT_INTERGRAPH_4D50T, + 0, + "Intergraph", + "Powerstorm 4D50T", + }, + { + PCI_VENDOR_ITT, PCI_PRODUCT_ITT_AGX016, + 0, + "I. T. T.", + "AGX016", + }, + { + PCI_VENDOR_ITT, PCI_PRODUCT_ITT_ITT3204, + 0, + "I. T. T.", + "ITT3204 MPEG Decoder", + }, + { + PCI_VENDOR_KTI, PCI_PRODUCT_KTI_NE2KETHER, + 0, + "KTI", + "Ethernet", + }, + { + PCI_VENDOR_LMC, PCI_PRODUCT_LMC_HSSI, + 0, + "LAN Media Corporation", + "HSSI Interface", + }, + { + PCI_VENDOR_LMC, PCI_PRODUCT_LMC_DS3, + 0, + "LAN Media Corporation", + "DS3 Interface", + }, + { + PCI_VENDOR_LMC, PCI_PRODUCT_LMC_SSI, + 0, + "LAN Media Corporation", + "SSI", + }, + { + PCI_VENDOR_LEADTEK, PCI_PRODUCT_LEADTEK_S3_805, + 0, + "LeadTek Research", + "S3 805", + }, + { + PCI_VENDOR_LINEARSYS, PCI_PRODUCT_LINEARSYS_DVB_TX, + 0, + "Linear Systems", + "DVB Transmitter", + }, + { + PCI_VENDOR_LINEARSYS, PCI_PRODUCT_LINEARSYS_DVB_RX, + 0, + "Linear Systems", + "DVB Receiver", + }, + { + PCI_VENDOR_LITEON, PCI_PRODUCT_LITEON_82C168, + 0, + "Lite-On Communications", + "82C168/82C169 (PNIC) 10/100 Ethernet", + }, + { + PCI_VENDOR_LITEON, PCI_PRODUCT_LITEON_82C115, + 0, + "Lite-On Communications", + "82C115 (PNIC II) 10/100 Ethernet", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0440, + 0, + "AT&T Microelectronics", + "K56flex DSVD LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0441, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0442, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0443, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0444, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0445, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0446, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0447, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0448, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0449, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044A, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044B, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044C, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044D, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_044E, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0450, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0451, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0452, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0453, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0454, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0455, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0456, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0457, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0458, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_0459, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_LTMODEM_045A, + 0, + "AT&T Microelectronics", + "LTMODEM", + }, + { + PCI_VENDOR_LUCENT, PCI_PRODUCT_LUCENT_USBHC, + 0, + "AT&T Microelectronics", + "USB Host Controller", + }, + { + PCI_VENDOR_MACRONIX, PCI_PRODUCT_MACRONIX_MX98713, + 0, + "Macronix", + "MX98713 (PMAC) 10/100 Ethernet", + }, + { + PCI_VENDOR_MACRONIX, PCI_PRODUCT_MACRONIX_MX987x5, + 0, + "Macronix", + "MX987x5 (PMAC) 10/100 Ethernet", + }, + { + PCI_VENDOR_MADGE, PCI_PRODUCT_MADGE_COLLAGE25, + 0, + "Madge Networks", + "Collage 25 ATM adapter", + }, + { + PCI_VENDOR_MADGE, PCI_PRODUCT_MADGE_COLLAGE155, + 0, + "Madge Networks", + "Collage 155 ATM adapter", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_ATLAS, + 0, + "Matrox", + "MGA PX2085 (\"Atlas\")", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_MILLENNIUM, + 0, + "Matrox", + "MGA Millennium 2064W", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_MYSTIQUE, + 0, + "Matrox", + "MGA Mystique 1064SG", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_MILLENNIUM2, + 0, + "Matrox", + "MGA Millennium II 2164W", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_MILLENNIUM2_AGP, + 0, + "Matrox", + "MGA Millennium II 2164WA-B AG", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200_PCI, + 0, + "Matrox", + "MGA G200 PCI", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200_AGP, + 0, + "Matrox", + "MGA G200 AGP", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G400_AGP, + 0, + "Matrox", + "MGA G400 AGP", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_IMPRESSION, + 0, + "Matrox", + "MGA Impression", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G100_PCI, + 0, + "Matrox", + "MGA G100 PCI", + }, + { + PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G100_AGP, + 0, + "Matrox", + "MGA G100 AGP", + }, + { + PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC105, + 0, + "Motorola", + "MPC105 \"Eagle\" Host Bridge", + }, + { + PCI_VENDOR_MOT, PCI_PRODUCT_MOT_MPC106, + 0, + "Motorola", + "MPC106 \"Grackle\" Host Bridge", + }, + { + PCI_VENDOR_MYLEX, PCI_PRODUCT_MYLEX_960P, + 0, + "Mylex", + "DAC960P RAID controller", + }, + { + PCI_VENDOR_MUTECH, PCI_PRODUCT_MUTECH_MV1000, + 0, + "Mutech", + "MV1000", + }, + { + PCI_VENDOR_NETVIN, PCI_PRODUCT_NETVIN_5000, + 0, + "NetVin", + "5000 Ethernet", + }, + { + PCI_VENDOR_NEWBRIDGE, PCI_PRODUCT_NEWBRIDGE_CA91CX42, + 0, + "Newbridge Microsystems / Tundra Semiconductor", + "Universe VME bridge", + }, + { + PCI_VENDOR_NS, PCI_PRODUCT_NS_DP83810, + 0, + "National Semiconductor", + "DP83810 10/100 Ethernet", + }, + { + PCI_VENDOR_NS, PCI_PRODUCT_NS_DP83815, + 0, + "National Semiconductor", + "DP83815 10/100 Ethernet", + }, + { + PCI_VENDOR_NS, PCI_PRODUCT_NS_NS87410, + 0, + "National Semiconductor", + "NS87410", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_810, + 0, + "Symbios Logic", + "53c810", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_820, + 0, + "Symbios Logic", + "53c820", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_825, + 0, + "Symbios Logic", + "53c825", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_815, + 0, + "Symbios Logic", + "53c815", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_810AP, + 0, + "Symbios Logic", + "53c810AP", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860, + 0, + "Symbios Logic", + "53c860", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_896, + 0, + "Symbios Logic", + "53c896", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_895, + 0, + "Symbios Logic", + "53c895", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_885, + 0, + "Symbios Logic", + "53c885", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_875, + 0, + "Symbios Logic", + "53c875", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_1510, + 0, + "Symbios Logic", + "53c1510", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_875J, + 0, + "Symbios Logic", + "53c875J", + }, + { + PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_PE_GNIC, + 0, + "Symbios Logic", + "Packet Engines G-NIC Ethernet", + }, + { + PCI_VENDOR_NEC, PCI_PRODUCT_NEC_USB, + 0, + "NEC", + "USB Host Controller", + }, + { + PCI_VENDOR_NEC, PCI_PRODUCT_NEC_POWERVR2, + 0, + "NEC", + "PowerVR PCX2", + }, + { + PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD72872, + 0, + "NEC", + "uPD72872 IEEE 1394 OHCI Host Controller", + }, + { + PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD72870, + 0, + "NEC", + "uPD72870 IEEE 1394 OHCI Host Controller", + }, + { + PCI_VENDOR_NEC, PCI_PRODUCT_NEC_PD72871, + 0, + "NEC", + "uPD72871 IEEE 1394 OHCI Host Controller", + }, + { + PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMG128ZV, + 0, + "Neomagic", + "MagicGraph 128ZV", + }, + { + PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMG2160, + 0, + "Neomagic", + "MagicGraph 128XD", + }, + { + PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256AV_VGA, + 0, + "Neomagic", + "MagicMedia 256AV VGA", + }, + { + PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256ZX_VGA, + 0, + "Neomagic", + "MagicMedia 256ZX VGA", + }, + { + PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256AV_AU, + 0, + "Neomagic", + "MagicMedia 256AV Audio", + }, + { + PCI_VENDOR_NEOMAGIC, PCI_PRODUCT_NEOMAGIC_NMMM256ZX_AU, + 0, + "Neomagic", + "MagicMedia 256ZX Audio", + }, + { + PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620, + 0, + "Netgear", + "GA620 Gigabit Ethernet", + }, + { + PCI_VENDOR_NEXGEN, PCI_PRODUCT_NEXGEN_NX82C501, + 0, + "NexGen Microsystems", + "NX82C501 Host-PCI Bridge", + }, + { + PCI_VENDOR_NKK, PCI_PRODUCT_NKK_NDR4600, + 0, + "NKK Corporation", + "NDR4600 Host-PCI Bridge", + }, + { + PCI_VENDOR_NUMBER9, PCI_PRODUCT_NUMBER9_I128, + 0, + "Number 9 Computer Company", + "Imagine-128", + }, + { + PCI_VENDOR_NUMBER9, PCI_PRODUCT_NUMBER9_I128_2, + 0, + "Number 9 Computer Company", + "Imagine-128 II", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_RIVATNT, + 0, + "Nvidia Corporation", + "RIVA TNT", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_RIVATNT2, + 0, + "Nvidia Corporation", + "RIVA TNT2", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_RIVATNT2U, + 0, + "Nvidia Corporation", + "RIVA TNT2 Ultra", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_VANTA, + 0, + "Nvidia Corporation", + "Vanta", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_RIVATNT2M64, + 0, + "Nvidia Corporation", + "RIVA TNT2 Model 64", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_ALADDINTNT2, + 0, + "Nvidia Corporation", + "Aladdin TNT2", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE256, + 0, + "Nvidia Corporation", + "GeForce 256", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCEDDR, + 0, + "Nvidia Corporation", + "GeForce DDR", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO, + 0, + "Nvidia Corporation", + "Quadro", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2, + 0, + "Nvidia Corporation", + "GeForce2 GTS", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2DDR, + 0, + "Nvidia Corporation", + "GeForce2 GTS (DDR)", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GEFORCE2BR, + 0, + "Nvidia Corporation", + "GeForce2 GTS", + }, + { + PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO2, + 0, + "Nvidia Corporation", + "Quadro2", + }, + { + PCI_VENDOR_NVIDIA_SGS, PCI_PRODUCT_NVIDIA_SGS_RIVA128, + 0, + "Nvidia Corporation & SGS Thomson Microelectric", + "Riva 128", + }, + { + PCI_VENDOR_OAKTECH, PCI_PRODUCT_OAKTECH_OTI1007, + 0, + "Oak Technology", + "OTI107", + }, + { + PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC2183, + 0, + "Olicom", + "Olicom OC-2183/2185 Ethernet", + }, + { + PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC2325, + 0, + "Olicom", + "Olicom OC-2325 Ethernet", + }, + { + PCI_VENDOR_OLICOM, PCI_PRODUCT_OLICOM_OC2326, + 0, + "Olicom", + "Olicom OC-2326 10/100-TX Ethernet", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C557, + 0, + "Opti", + "82C557", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C558, + 0, + "Opti", + "82C558", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C568, + 0, + "Opti", + "82C568", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82D568, + 0, + "Opti", + "82D568", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C621, + 0, + "Opti", + "82C621", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C822, + 0, + "Opti", + "82C822", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_RM861HA, + 0, + "Opti", + "RM861HA", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C700, + 0, + "Opti", + "82C700", + }, + { + PCI_VENDOR_OPTI, PCI_PRODUCT_OPTI_82C701, + 0, + "Opti", + "82C701", + }, + { + PCI_VENDOR_PCTECH, PCI_PRODUCT_PCTECH_RZ1000, + 0, + "PC Technology", + "RZ1000", + }, + { + PCI_VENDOR_PLX, PCI_PRODUCT_PLX_9060ES, + 0, + "PLX Technology", + "9060ES PCI bus controller", + }, + { + PCI_VENDOR_PROLAN, PCI_PRODUCT_PROLAN_NE2KETHER, + 0, + "ProLAN", + "Ethernet", + }, + { + PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_DC5030, + 0, + "Promise Technology", + "DC5030", + }, + { + PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_ULTRA33, + 0, + "Promise Technology", + "Ultra33/ATA Bus Master IDE Accelerator", + }, + { + PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_ULTRA66, + 0, + "Promise Technology", + "Ultra66/ATA Bus Master IDE Accelerator", + }, + { + PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_ULTRA100, + 0, + "Promise Technology", + "Ultra100/ATA Bus Master IDE Accelerator", + }, + { + PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1020, + 0, + "Q Logic", + "ISP1020", + }, + { + PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1022, + 0, + "Q Logic", + "ISP1022", + }, + { + PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1080, + 0, + "Q Logic", + "ISP1080", + }, + { + PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP1240, + 0, + "Q Logic", + "ISP1240", + }, + { + PCI_VENDOR_QLOGIC, PCI_PRODUCT_QLOGIC_ISP2100, + 0, + "Q Logic", + "ISP2100", + }, + { + PCI_VENDOR_QUANTUMDESIGNS, PCI_PRODUCT_QUANTUMDESIGNS_8500, + 0, + "Quantum Designs", + "8500", + }, + { + PCI_VENDOR_QUANTUMDESIGNS, PCI_PRODUCT_QUANTUMDESIGNS_8580, + 0, + "Quantum Designs", + "8580", + }, + { + PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8029, + 0, + "Realtek Semiconductor", + "8029 Ethernet", + }, + { + PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129, + 0, + "Realtek Semiconductor", + "8129 10/100 Ethernet", + }, + { + PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139, + 0, + "Realtek Semiconductor", + "8139 10/100 Ethernet", + }, + { + PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C465, + 0, + "Ricoh", + "5C465 PCI-CardBus bridge", + }, + { + PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C466, + 0, + "Ricoh", + "5C466 PCI-CardBus bridge", + }, + { + PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C475, + 0, + "Ricoh", + "5C475 PCI-CardBus bridge", + }, + { + PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_RL5C476, + 0, + "Ricoh", + "5C476 PCI-CardBus bridge", + }, + { + PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C477, + 0, + "Ricoh", + "5C477 PCI-CardBus bridge", + }, + { + PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C478, + 0, + "Ricoh", + "5C478 PCI-CardBus bridge", + }, + { + PCI_VENDOR_RISCOM, PCI_PRODUCT_RISCOM_N2, + 0, + "RISCom", + "N2", + }, + { + PCI_VENDOR_RNS, PCI_PRODUCT_RNS_FDDI, + 0, + "RNS", + "2200 FDDI", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE, + 0, + "S3", + "ViRGE", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO32, + 0, + "S3", + "Trio32", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO64, + 0, + "S3", + "Trio32/64", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_AURORA64P, + 0, + "S3", + "Aurora64V+", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO64UVP, + 0, + "S3", + "Trio64UV+", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_VX, + 0, + "S3", + "ViRGE/VX", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_868, + 0, + "S3", + "868", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_928, + 0, + "S3", + "86C928", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_864_0, + 0, + "S3", + "86C864-0", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_864_1, + 0, + "S3", + "86C864-1", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_864_2, + 0, + "S3", + "86C864-2", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_864_3, + 0, + "S3", + "86C864-3", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_964_0, + 0, + "S3", + "86C964-0", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_964_1, + 0, + "S3", + "86C964-1", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_964_2, + 0, + "S3", + "86C964-2", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_964_3, + 0, + "S3", + "86C964-3", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_968_0, + 0, + "S3", + "86C968-0", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_968_1, + 0, + "S3", + "86C968-1", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_968_2, + 0, + "S3", + "86C968-2", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_968_3, + 0, + "S3", + "86C968-3", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO64V2_DX, + 0, + "S3", + "Trio64V2/DX", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_PLATO_PX, + 0, + "S3", + "Plato/PX", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO3D, + 0, + "S3", + "86C365 Trio3D", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_DX, + 0, + "S3", + "ViRGE/DX", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_GX2, + 0, + "S3", + "ViRGE/GX2", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_TRIO3D2X, + 0, + "S3", + "Trio3D/2X", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE3D, + 0, + "S3", + "Savage3D", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE3D_MV, + 0, + "S3", + "Savage3D+MV", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE4, + 0, + "S3", + "Savage4", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_MX, + 0, + "S3", + "ViRGE/MX", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_VIRGE_MXP, + 0, + "S3", + "ViRGE/MXP", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_MX_MV, + 0, + "S3", + "Savage/MX+MV", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_MX, + 0, + "S3", + "Savage/MX", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_IX_MV, + 0, + "S3", + "Savage/IX+MV", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE_IX, + 0, + "S3", + "Savage/IX", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SAVAGE2000, + 0, + "S3", + "Savage2000", + }, + { + PCI_VENDOR_S3, PCI_PRODUCT_S3_SONICVIBES, + 0, + "S3", + "SonicVibes", + }, + { + PCI_VENDOR_SAMSUNGSEMI, PCI_PRODUCT_SAMSUNGSEMI_KS8920, + 0, + "Samsung Semiconductors", + "KS8920 10/100 Ethernet", + }, + { + PCI_VENDOR_SGI, PCI_PRODUCT_SGI_IOC3, + 0, + "Silicon Graphics", + "IOC3", + }, + { + PCI_VENDOR_SGI, PCI_PRODUCT_SGI_RAD1, + 0, + "Silicon Graphics", + "PsiTech RAD1", + }, + { + PCI_VENDOR_SGI, PCI_PRODUCT_SGI_TIGON, + 0, + "Silicon Graphics", + "Tigon Gigabit Ethernet", + }, + { + PCI_VENDOR_SGSTHOMSON, PCI_PRODUCT_SGSTHOMSON_2000, + 0, + "SGS Thomson Microelectric", + "STG 2000X", + }, + { + PCI_VENDOR_SGSTHOMSON, PCI_PRODUCT_SGSTHOMSON_1764, + 0, + "SGS Thomson Microelectric", + "STG 1764X", + }, + { + PCI_VENDOR_SIBYTE, PCI_PRODUCT_SIBYTE_SB1250_PCI, + 0, + "SiByte, Inc.", + "BCM1250 PCI Host Bridge", + }, + { + PCI_VENDOR_SIBYTE, PCI_PRODUCT_SIBYTE_SB1250_LDT, + 0, + "SiByte, Inc.", + "BCM1250 HyperTransport Host Bridge", + }, + { + PCI_VENDOR_SIGMA, PCI_PRODUCT_SIGMA_HOLLYWOODPLUS, + 0, + "Sigma Designs", + "REALmagic Hollywood-Plus MPEG-2 Decoder", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_86C201, + 0, + "Silicon Integrated System", + "86C201", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_86C202, + 0, + "Silicon Integrated System", + "86C202", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_86C205, + 0, + "Silicon Integrated System", + "86C205", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C503, + 0, + "Silicon Integrated System", + "85C503 or 5597/5598 ISA bridge", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_600PMC, + 0, + "Silicon Integrated System", + "600 Power Mngmt Controller", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_5597_VGA, + 0, + "Silicon Integrated System", + "5597/5598 integrated VGA", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C501, + 0, + "Silicon Integrated System", + "85C501", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C496, + 0, + "Silicon Integrated System", + "85C496", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_530HB, + 0, + "Silicon Integrated System", + "530 Host to PCI Bridge", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_85C601, + 0, + "Silicon Integrated System", + "85C601", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_900, + 0, + "Silicon Integrated System", + "SiS 900 10/100 Ethernet", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_5597_IDE, + 0, + "Silicon Integrated System", + "5597/5598 IDE controller", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_5597_HB, + 0, + "Silicon Integrated System", + "5597/5598 host bridge", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_530VGA, + 0, + "Silicon Integrated System", + "530 GUI Accelerator+3D", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_6326, + 0, + "Silicon Integrated System", + "6326 AGP VGA", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_5597_USB, + 0, + "Silicon Integrated System", + "5597/5598 USB host controller", + }, + { + PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7016, + 0, + "Silicon Integrated System", + "SiS 7016 10/100 Ethernet", + }, + { + PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_LYNX_E, + 0, + "Silicon Motion", + "Lynx E", + }, + { + PCI_VENDOR_SMC, PCI_PRODUCT_SMC_37C665, + 0, + "Standard Microsystems", + "FDC 37C665", + }, + { + PCI_VENDOR_SMC, PCI_PRODUCT_SMC_37C922, + 0, + "Standard Microsystems", + "FDC 37C922", + }, + { + PCI_VENDOR_SMC, PCI_PRODUCT_SMC_83C170, + 0, + "Standard Microsystems", + "83C170 (\"EPIC/100\") Fast Ethernet", + }, + { + PCI_VENDOR_SMC, PCI_PRODUCT_SMC_83C175, + 0, + "Standard Microsystems", + "83C175 (\"EPIC/100\") Fast Ethernet", + }, + { + PCI_VENDOR_SOLIDUM, PCI_PRODUCT_SOLIDUM_AMD971, + 0, + "Solidum Systems Corp.", + "SNP8023: AMD 971", + }, + { + PCI_VENDOR_SOLIDUM, PCI_PRODUCT_SOLIDUM_CLASS802, + 0, + "Solidum Systems Corp.", + "SNP8023: Classifier Engine", + }, + { + PCI_VENDOR_SONY, PCI_PRODUCT_SONY_CXD1947A, + 0, + "Sony", + "CXD1947A IEEE 1394 Host Controller", + }, + { + PCI_VENDOR_SONY, PCI_PRODUCT_SONY_CXD32222, + 0, + "Sony", + "CXD3222 OHCI IEEE 1394 Host Controller", + }, + { + PCI_VENDOR_SONY, PCI_PRODUCT_SONY_MEMSTICK, + 0, + "Sony", + "Memory Stick I/F Controller", + }, + { + PCI_VENDOR_SUN, PCI_PRODUCT_SUN_EBUS, + 0, + "Sun Microsystems", + "PCIO Ebus2", + }, + { + PCI_VENDOR_SUN, PCI_PRODUCT_SUN_HMENETWORK, + 0, + "Sun Microsystems", + "PCIO Happy Meal Ethernet", + }, + { + PCI_VENDOR_SUN, PCI_PRODUCT_SUN_SIMBA, + 0, + "Sun Microsystems", + "Simba PCI bridge", + }, + { + PCI_VENDOR_SUN, PCI_PRODUCT_SUN_MS_IIep, + 0, + "Sun Microsystems", + "microSPARC IIep PCI", + }, + { + PCI_VENDOR_SUN, PCI_PRODUCT_SUN_US_IIi, + 0, + "Sun Microsystems", + "UltraSPARC IIi PCI", + }, + { + PCI_VENDOR_SUNDANCETI, PCI_PRODUCT_SUNDANCETI_ST201, + 0, + "Sundance Technology", + "ST201 10/100 Ethernet", + }, + { + PCI_VENDOR_SURECOM, PCI_PRODUCT_SURECOM_NE34, + 0, + "Surecom Technology", + "NE-34 Ethernet", + }, + { + PCI_VENDOR_SYMPHONY, PCI_PRODUCT_SYMPHONY_82C101, + 0, + "Symphony Labs", + "82C101", + }, + { + PCI_VENDOR_SYMPHONY, PCI_PRODUCT_SYMPHONY_82C103, + 0, + "Symphony Labs", + "82C103", + }, + { + PCI_VENDOR_SYMPHONY, PCI_PRODUCT_SYMPHONY_82C105, + 0, + "Symphony Labs", + "82C105", + }, + { + PCI_VENDOR_SYMPHONY2, PCI_PRODUCT_SYMPHONY2_82C101, + 0, + "Symphony Labs (2nd PCI Vendor ID)", + "82C101", + }, + { + PCI_VENDOR_SYMPHONY, PCI_PRODUCT_SYMPHONY_83C553, + 0, + "Symphony Labs", + "83C553 PCI-ISA Bridge", + }, + { + PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SKNET_FDDI, + 0, + "Schneider & Koch", + "SK-NET FDDI-xP", + }, + { + PCI_VENDOR_TEKRAM, PCI_PRODUCT_TEKRAM_DC290, + 0, + "Tekram Technology (1st PCI Vendor ID)", + "DC-290(M)", + }, + { + PCI_VENDOR_TEKRAM2, PCI_PRODUCT_TEKRAM2_DC690C, + 0, + "Tekram Technology (2nd PCI Vendor ID)", + "DC-690C", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_TLAN, + 0, + "Texas Instruments", + "TLAN", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_TVP4020, + 0, + "Texas Instruments", + "TVP4020 Permedia 2", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB12LV21, + 0, + "Texas Instruments", + "TSB12LV21 IEEE 1394 Host Controller", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB12LV22, + 0, + "Texas Instruments", + "TSB12LV22 OHCI IEEE 1394 Host Controller", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB12LV23, + 0, + "Texas Instruments", + "TSB12LV23 OHCI IEEE 1394 Host Controller", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_TSB12LV26, + 0, + "Texas Instruments", + "TSB12LV26 OHCI IEEE 1394 Host Controller", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1130, + 0, + "Texas Instruments", + "PCI1130 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1031, + 0, + "Texas Instruments", + "PCI1031 PCI-PCMCIA Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1131, + 0, + "Texas Instruments", + "PCI1131 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1250, + 0, + "Texas Instruments", + "PCI1250 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1220, + 0, + "Texas Instruments", + "PCI1220 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1221, + 0, + "Texas Instruments", + "PCI1221 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1450, + 0, + "Texas Instruments", + "PCI1450 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1225, + 0, + "Texas Instruments", + "PCI1225 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1251, + 0, + "Texas Instruments", + "PCI1251 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1211, + 0, + "Texas Instruments", + "PCI1211 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1251B, + 0, + "Texas Instruments", + "PCI1251B PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI2030, + 0, + "Texas Instruments", + "PCI2030 PCI-PCI Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1420, + 0, + "Texas Instruments", + "PCI1420 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TI, PCI_PRODUCT_TI_PCI1451, + 0, + "Texas Instruments", + "PCI1451 PCI-CardBus Bridge", + }, + { + PCI_VENDOR_TOSHIBA, PCI_PRODUCT_TOSHIBA_R4X00, + 0, + "Toshiba America", + "R4x00 Host-PCI Bridge", + }, + { + PCI_VENDOR_TOSHIBA, PCI_PRODUCT_TOSHIBA_TC35856F, + 0, + "Toshiba America", + "TC35856F ATM (\"Meteor\")", + }, + { + PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_HOST, + 0, + "Toshiba America Info Systems", + "Host Bridge/Controller", + }, + { + PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ISA, + 0, + "Toshiba America Info Systems", + "ISA Bridge", + }, + { + PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ToPIC95, + 0, + "Toshiba America Info Systems", + "ToPIC95 CardBus-PCI Bridge", + }, + { + PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ToPIC95B, + 0, + "Toshiba America Info Systems", + "ToPIC95B CardBus-PCI Bridge", + }, + { + PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ToPIC97, + 0, + "Toshiba America Info Systems", + "ToPIC97 CardBus-PCI Bridge", + }, + { + PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_ToPIC100, + 0, + "Toshiba America Info Systems", + "ToPIC100 CardBus-PCI Bridge", + }, + { + PCI_VENDOR_TOSHIBA2, PCI_PRODUCT_TOSHIBA2_FIRO, + 0, + "Toshiba America Info Systems", + "Fast Infrared Type O", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBERBLADE_I7, + 0, + "Trident Microsystems", + "CyberBlade i7", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9320, + 0, + "Trident Microsystems", + "TGUI 9320", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9350, + 0, + "Trident Microsystems", + "TGUI 9350", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9360, + 0, + "Trident Microsystems", + "TGUI 9360", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBER_9397, + 0, + "Trident Microsystems", + "CYBER 9397", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBER_9397DVD, + 0, + "Trident Microsystems", + "CYBER 9397DVD", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_CYBER_9525, + 0, + "Trident Microsystems", + "CYBER 9525", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9420, + 0, + "Trident Microsystems", + "TGUI 9420", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9440, + 0, + "Trident Microsystems", + "TGUI 9440", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9660, + 0, + "Trident Microsystems", + "TGUI 9660", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9680, + 0, + "Trident Microsystems", + "TGUI 9680", + }, + { + PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_TGUI_9682, + 0, + "Trident Microsystems", + "TGUI 9682", + }, + { + PCI_VENDOR_TRIONES, PCI_PRODUCT_TRIONES_HPT366, + 0, + "Triones Technologies", + "HPT366/370 IDE Controller", + }, + { + PCI_VENDOR_TRITECH, PCI_PRODUCT_TRITECH_TR25202, + 0, + "TriTech Microelectronics", + "Pyramid3D TR25202", + }, + { + PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET4000_W32P_A, + 0, + "Tseng Labs", + "ET4000w32p rev A", + }, + { + PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET4000_W32P_B, + 0, + "Tseng Labs", + "ET4000w32p rev B", + }, + { + PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET4000_W32P_C, + 0, + "Tseng Labs", + "ET4000w32p rev C", + }, + { + PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET4000_W32P_D, + 0, + "Tseng Labs", + "ET4000w32p rev D", + }, + { + PCI_VENDOR_TSENG, PCI_PRODUCT_TSENG_ET6000, + 0, + "Tseng Labs", + "ET6000", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM82C881, + 0, + "United Microelectronics", + "UM82C881 486 Chipset", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM82C886, + 0, + "United Microelectronics", + "UM82C886 ISA Bridge", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8673F, + 0, + "United Microelectronics", + "UM8673F EIDE Controller", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8881, + 0, + "United Microelectronics", + "UM8881 HB4 486 PCI Chipset", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM82C891, + 0, + "United Microelectronics", + "UM82C891", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM886A, + 0, + "United Microelectronics", + "UM886A", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886BF, + 0, + "United Microelectronics", + "UM8886BF", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8710, + 0, + "United Microelectronics", + "UM8710", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886, + 0, + "United Microelectronics", + "UM8886", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8881F, + 0, + "United Microelectronics", + "UM8881F PCI-Host bridge", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886F, + 0, + "United Microelectronics", + "UM8886F PCI-ISA bridge", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886A, + 0, + "United Microelectronics", + "UM8886A", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8891A, + 0, + "United Microelectronics", + "UM8891A", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM9017F, + 0, + "United Microelectronics", + "UM9017F", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8886N, + 0, + "United Microelectronics", + "UM8886N", + }, + { + PCI_VENDOR_UMC, PCI_PRODUCT_UMC_UM8891N, + 0, + "United Microelectronics", + "UM8891N", + }, + { + PCI_VENDOR_ULSI, PCI_PRODUCT_ULSI_US201, + 0, + "ULSI Systems", + "US201", + }, + { + PCI_VENDOR_USR, PCI_PRODUCT_USR_3CP5609, + 0, + "US Robotics (3Com)", + "3CP5609 PCI 16550 Modem", + }, + { + PCI_VENDOR_V3, PCI_PRODUCT_V3_V292PBC, + 0, + "V3 Semiconductor", + "V292PBC AMD290x0 Host-PCI Bridge", + }, + { + PCI_VENDOR_V3, PCI_PRODUCT_V3_V960PBC, + 0, + "V3 Semiconductor", + "V960PBC i960 Host-PCI Bridge", + }, + { + PCI_VENDOR_V3, PCI_PRODUCT_V3_V96DPC, + 0, + "V3 Semiconductor", + "V96DPC i960 (Dual) Host-PCI Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8371_HB, + 0, + "VIA Technologies", + "VT8371 (Apollo KX133) Host Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8501_MVP4, + 0, + "VIA Technologies", + "VT8501 MVP4 System Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C505, + 0, + "VIA Technologies", + "VT82C505 (Pluto)", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C561, + 0, + "VIA Technologies", + "VT82C561", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586A_IDE, + 0, + "VIA Technologies", + "VT82C586A IDE Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C576, + 0, + "VIA Technologies", + "VT82C576 3V", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C580VP, + 0, + "VIA Technologies", + "VT82C580 (Apollo VP) Host-PCI Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586_ISA, + 0, + "VIA Technologies", + "VT82C586 (Apollo VP) PCI-ISA Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C595, + 0, + "VIA Technologies", + "VT82C595 (Apollo VP2) Host-PCI Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C596A, + 0, + "VIA Technologies", + "VT82C596A (Apollo Pro) PCI-ISA Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C597, + 0, + "VIA Technologies", + "VT82C597 (Apollo VP3) Host-PCI Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C598PCI, + 0, + "VIA Technologies", + "VT82C598 (Apollo MVP3) Host-PCI", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_ISA, + 0, + "VIA Technologies", + "VT82C686A (Apollo KX133) PCI-ISA Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C691, + 0, + "VIA Technologies", + "VT82C691 (Apollo Pro) Host-PCI", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C693, + 0, + "VIA Technologies", + "VT82C693 (Apollo Pro Plus) Host-PCI", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT86C926, + 0, + "VIA Technologies", + "VT86C926 Amazon PCI-Ethernet Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C570M, + 0, + "VIA Technologies", + "VT82C570M (Apollo) Host-PCI Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C570MV, + 0, + "VIA Technologies", + "VT82C570M (Apollo) PCI-ISA Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586_IDE, + 0, + "VIA Technologies", + "VT82C586 (Apollo VP) IDE Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C595_2, + 0, + "VIA Technologies", + "VT82C595 (Apollo VP2) Host-PCI Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT83C572, + 0, + "VIA Technologies", + "VT83C572 USB Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C586_PWR, + 0, + "VIA Technologies", + "VT82C586 (Apollo VP) Power Management Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3043, + 0, + "VIA Technologies", + "VT3043 (Rhine) 10/100 Ethernet", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_SMB, + 0, + "VIA Technologies", + "VT82C686A SMBus Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_AC97, + 0, + "VIA Technologies", + "VT82C686A AC-97 Audio Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_MC97, + 0, + "VIA Technologies", + "VT82C686A MC-97 Modem Controller", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT86C100A, + 0, + "VIA Technologies", + "VT86C100A (Rhine-II) 10/100 Ethernet", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8371_PPB, + 0, + "VIA Technologies", + "VT8371 (Apollo KX133) PCI-PCI Bridge", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8501AGP, + 0, + "VIA Technologies", + "VT8501 PCI-AGP", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C597AGP, + 0, + "VIA Technologies", + "VT82C597 (Apollo VP3) PCI-AGP", + }, + { + PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C598AGP, + 0, + "VIA Technologies", + "VT82C598 (Apollo MVP3) PCI-AGP", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_60x0, + 0, + "Vortex Computer Systems", + "GDT6000/6020/6050", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6000B, + 0, + "Vortex Computer Systems", + "GDT6000B/6010", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x10, + 0, + "Vortex Computer Systems", + "GDT6110/6510", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x20, + 0, + "Vortex Computer Systems", + "GDT6120/6520", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6530, + 0, + "Vortex Computer Systems", + "GDT6530", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6550, + 0, + "Vortex Computer Systems", + "GDT6550", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x17, + 0, + "Vortex Computer Systems", + "GDT6117/6517", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x27, + 0, + "Vortex Computer Systems", + "GDT6127/6527", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6537, + 0, + "Vortex Computer Systems", + "GDT6537", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6557, + 0, + "Vortex Computer Systems", + "GDT6557/6557-ECC", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x15, + 0, + "Vortex Computer Systems", + "GDT6115/6515", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x25, + 0, + "Vortex Computer Systems", + "GDT6125/6525", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6535, + 0, + "Vortex Computer Systems", + "GDT6535", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6555, + 0, + "Vortex Computer Systems", + "GDT6555/6555-ECC", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x17RP, + 0, + "Vortex Computer Systems", + "GDT6117RP/GDT6517RP", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x27RP, + 0, + "Vortex Computer Systems", + "GDT6127RP/GDT6527RP", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6537RP, + 0, + "Vortex Computer Systems", + "GDT6537RP", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6557RP, + 0, + "Vortex Computer Systems", + "GDT6557RP", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x11RP, + 0, + "Vortex Computer Systems", + "GDT6111RP/GDT6511RP", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x21RP, + 0, + "Vortex Computer Systems", + "GDT6121RP/GDT6521RP", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x17RD, + 0, + "Vortex Computer Systems", + "GDT6117RD/GDT6517RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x27RD, + 0, + "Vortex Computer Systems", + "GDT6127RD/GDT6527RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6537RD, + 0, + "Vortex Computer Systems", + "GDT6537RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6557RD, + 0, + "Vortex Computer Systems", + "GDT6557RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x11RD, + 0, + "Vortex Computer Systems", + "GDT6111RD/GDT6511RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x21RD, + 0, + "Vortex Computer Systems", + "GDT6121RD/GDT6521RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x18RD, + 0, + "Vortex Computer Systems", + "GDT6118RD/GDT6518RD/GDT6618RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x28RD, + 0, + "Vortex Computer Systems", + "GDT6128RD/GDT6528RD/GDT6628RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x38RD, + 0, + "Vortex Computer Systems", + "GDT6538RD/GDT6638RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x58RD, + 0, + "Vortex Computer Systems", + "GDT6558RD/GDT6658RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x18RN, + 0, + "Vortex Computer Systems", + "GDT7118RN/GDT7518RN/GDT7618RN", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x28RN, + 0, + "Vortex Computer Systems", + "GDT7128RN/GDT7528RN/GDT7628RN", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x38RN, + 0, + "Vortex Computer Systems", + "GDT7538RN/GDT7638RN", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x58RN, + 0, + "Vortex Computer Systems", + "GDT7558RN/GDT7658RN", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x19RD, + 0, + "Vortex Computer Systems", + "GDT6519RD/GDT6619RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_6x29RD, + 0, + "Vortex Computer Systems", + "GDT6529RD/GDT6629RD", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x19RN, + 0, + "Vortex Computer Systems", + "GDT7519RN/GDT7619RN", + }, + { + PCI_VENDOR_VORTEX, PCI_PRODUCT_VORTEX_GDT_7x29RN, + 0, + "Vortex Computer Systems", + "GDT7529RN/GDT7629RN", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C592, + 0, + "VLSI Technology", + "82C592 CPU Bridge", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C593, + 0, + "VLSI Technology", + "82C593 ISA Bridge", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C594, + 0, + "VLSI Technology", + "82C594 Wildcat System Controller", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C596597, + 0, + "VLSI Technology", + "82C596/597 Wildcat ISA Bridge", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C541, + 0, + "VLSI Technology", + "82C541", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C543, + 0, + "VLSI Technology", + "82C543", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C532, + 0, + "VLSI Technology", + "82C532", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C534, + 0, + "VLSI Technology", + "82C534", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C535, + 0, + "VLSI Technology", + "82C535", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C147, + 0, + "VLSI Technology", + "82C147", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C975, + 0, + "VLSI Technology", + "82C975", + }, + { + PCI_VENDOR_VLSI, PCI_PRODUCT_VLSI_82C925, + 0, + "VLSI Technology", + "82C925", + }, + { + PCI_VENDOR_WEITEK, PCI_PRODUCT_WEITEK_P9000, + 0, + "Weitek", + "P9000", + }, + { + PCI_VENDOR_WEITEK, PCI_PRODUCT_WEITEK_P9100, + 0, + "Weitek", + "P9100", + }, + { + PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C193A, + 0, + "Western Digital", + "WD33C193A", + }, + { + PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C196A, + 0, + "Western Digital", + "WD33C196A", + }, + { + PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C197A, + 0, + "Western Digital", + "WD33C197A", + }, + { + PCI_VENDOR_WD, PCI_PRODUCT_WD_WD7193, + 0, + "Western Digital", + "WD7193", + }, + { + PCI_VENDOR_WD, PCI_PRODUCT_WD_WD7197, + 0, + "Western Digital", + "WD7197", + }, + { + PCI_VENDOR_WD, PCI_PRODUCT_WD_WD33C296A, + 0, + "Western Digital", + "WD33C296A", + }, + { + PCI_VENDOR_WD, PCI_PRODUCT_WD_WD34C296, + 0, + "Western Digital", + "WD34C296", + }, + { + PCI_VENDOR_WD, PCI_PRODUCT_WD_90C, + 0, + "Western Digital", + "90C", + }, + { + PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W83769F, + 0, + "Winbond Electronics", + "W83769F", + }, + { + PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C840F, + 0, + "Winbond Electronics", + "W89C840F 10/100 Ethernet", + }, + { + PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C940F, + 0, + "Winbond Electronics", + "W89C940F Ethernet", + }, + { + PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C940F_1, + 0, + "Winbond Electronics", + "W89C940F Ethernet", + }, + { + PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_X3201_3, + 0, + "Xircom", + "X3201-3 Fast Ethernet Controller", + }, + { + PCI_VENDOR_XIRCOM, PCI_PRODUCT_XIRCOM_X3201_3_21143, + 0, + "Xircom", + "X3201-3 Fast Ethernet Controller (21143)", + }, + { + PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF724, + 0, + "Yamaha", + "724 Audio", + }, + { + PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF740, + 0, + "Yamaha", + "740 Audio", + }, + { + PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF740C, + 0, + "Yamaha", + "740C (DS-1) Audio", + }, + { + PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF724F, + 0, + "Yamaha", + "724F (DS-1) Audio", + }, + { + PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF744B, + 0, + "Yamaha", + "744 (DS-1S) Audio", + }, + { + PCI_VENDOR_YAMAHA, PCI_PRODUCT_YAMAHA_YMF754, + 0, + "Yamaha", + "754 (DS-1E) Audio", + }, + { + PCI_VENDOR_ZEINET, PCI_PRODUCT_ZEINET_1221, + 0, + "Zeinet", + "1221", + }, + { + PCI_VENDOR_ZIATECH, PCI_PRODUCT_ZIATECH_ZT8905, + 0, + "Ziatech", + "PCI-ST32 Bridge", + }, + { + PCI_VENDOR_ZORAN, PCI_PRODUCT_ZORAN_ZR36120, + 0, + "Zoran Corporation", + "Video Controller", + }, + { + PCI_VENDOR_COMPAQ, 0, + PCI_KNOWNDEV_NOPROD, + "Compaq", + NULL, + }, + { + PCI_VENDOR_SYMBIOS, 0, + PCI_KNOWNDEV_NOPROD, + "Symbios Logic", + NULL, + }, + { + PCI_VENDOR_ATI, 0, + PCI_KNOWNDEV_NOPROD, + "ATI Technologies", + NULL, + }, + { + PCI_VENDOR_ULSI, 0, + PCI_KNOWNDEV_NOPROD, + "ULSI Systems", + NULL, + }, + { + PCI_VENDOR_VLSI, 0, + PCI_KNOWNDEV_NOPROD, + "VLSI Technology", + NULL, + }, + { + PCI_VENDOR_AVANCE, 0, + PCI_KNOWNDEV_NOPROD, + "Avance Logic", + NULL, + }, + { + PCI_VENDOR_NS, 0, + PCI_KNOWNDEV_NOPROD, + "National Semiconductor", + NULL, + }, + { + PCI_VENDOR_TSENG, 0, + PCI_KNOWNDEV_NOPROD, + "Tseng Labs", + NULL, + }, + { + PCI_VENDOR_WEITEK, 0, + PCI_KNOWNDEV_NOPROD, + "Weitek", + NULL, + }, + { + PCI_VENDOR_DEC, 0, + PCI_KNOWNDEV_NOPROD, + "Digital Equipment", + NULL, + }, + { + PCI_VENDOR_CIRRUS, 0, + PCI_KNOWNDEV_NOPROD, + "Cirrus Logic", + NULL, + }, + { + PCI_VENDOR_IBM, 0, + PCI_KNOWNDEV_NOPROD, + "IBM", + NULL, + }, + { + PCI_VENDOR_WD, 0, + PCI_KNOWNDEV_NOPROD, + "Western Digital", + NULL, + }, + { + PCI_VENDOR_AMD, 0, + PCI_KNOWNDEV_NOPROD, + "Advanced Micro Devices", + NULL, + }, + { + PCI_VENDOR_TRIDENT, 0, + PCI_KNOWNDEV_NOPROD, + "Trident Microsystems", + NULL, + }, + { + PCI_VENDOR_ACER, 0, + PCI_KNOWNDEV_NOPROD, + "Acer", + NULL, + }, + { + PCI_VENDOR_MATROX, 0, + PCI_KNOWNDEV_NOPROD, + "Matrox", + NULL, + }, + { + PCI_VENDOR_CHIPS, 0, + PCI_KNOWNDEV_NOPROD, + "Chips and Technologies", + NULL, + }, + { + PCI_VENDOR_TOSHIBA, 0, + PCI_KNOWNDEV_NOPROD, + "Toshiba America", + NULL, + }, + { + PCI_VENDOR_NEC, 0, + PCI_KNOWNDEV_NOPROD, + "NEC", + NULL, + }, + { + PCI_VENDOR_FUTUREDOMAIN, 0, + PCI_KNOWNDEV_NOPROD, + "Future Domain", + NULL, + }, + { + PCI_VENDOR_SIS, 0, + PCI_KNOWNDEV_NOPROD, + "Silicon Integrated System", + NULL, + }, + { + PCI_VENDOR_HP, 0, + PCI_KNOWNDEV_NOPROD, + "Hewlett-Packard", + NULL, + }, + { + PCI_VENDOR_PCTECH, 0, + PCI_KNOWNDEV_NOPROD, + "PC Technology", + NULL, + }, + { + PCI_VENDOR_DPT, 0, + PCI_KNOWNDEV_NOPROD, + "Distributed Processing Technology", + NULL, + }, + { + PCI_VENDOR_OPTI, 0, + PCI_KNOWNDEV_NOPROD, + "Opti", + NULL, + }, + { + PCI_VENDOR_ELSA, 0, + PCI_KNOWNDEV_NOPROD, + "Elsa", + NULL, + }, + { + PCI_VENDOR_SGSTHOMSON, 0, + PCI_KNOWNDEV_NOPROD, + "SGS Thomson Microelectric", + NULL, + }, + { + PCI_VENDOR_BUSLOGIC, 0, + PCI_KNOWNDEV_NOPROD, + "BusLogic", + NULL, + }, + { + PCI_VENDOR_TI, 0, + PCI_KNOWNDEV_NOPROD, + "Texas Instruments", + NULL, + }, + { + PCI_VENDOR_SONY, 0, + PCI_KNOWNDEV_NOPROD, + "Sony", + NULL, + }, + { + PCI_VENDOR_OAKTECH, 0, + PCI_KNOWNDEV_NOPROD, + "Oak Technology", + NULL, + }, + { + PCI_VENDOR_WINBOND, 0, + PCI_KNOWNDEV_NOPROD, + "Winbond Electronics", + NULL, + }, + { + PCI_VENDOR_MOT, 0, + PCI_KNOWNDEV_NOPROD, + "Motorola", + NULL, + }, + { + PCI_VENDOR_PROMISE, 0, + PCI_KNOWNDEV_NOPROD, + "Promise Technology", + NULL, + }, + { + PCI_VENDOR_NUMBER9, 0, + PCI_KNOWNDEV_NOPROD, + "Number 9 Computer Company", + NULL, + }, + { + PCI_VENDOR_UMC, 0, + PCI_KNOWNDEV_NOPROD, + "United Microelectronics", + NULL, + }, + { + PCI_VENDOR_ITT, 0, + PCI_KNOWNDEV_NOPROD, + "I. T. T.", + NULL, + }, + { + PCI_VENDOR_MYLEX, 0, + PCI_KNOWNDEV_NOPROD, + "Mylex", + NULL, + }, + { + PCI_VENDOR_APPLE, 0, + PCI_KNOWNDEV_NOPROD, + "Apple Computer", + NULL, + }, + { + PCI_VENDOR_YAMAHA, 0, + PCI_KNOWNDEV_NOPROD, + "Yamaha", + NULL, + }, + { + PCI_VENDOR_NEXGEN, 0, + PCI_KNOWNDEV_NOPROD, + "NexGen Microsystems", + NULL, + }, + { + PCI_VENDOR_QLOGIC, 0, + PCI_KNOWNDEV_NOPROD, + "Q Logic", + NULL, + }, + { + PCI_VENDOR_LEADTEK, 0, + PCI_KNOWNDEV_NOPROD, + "LeadTek Research", + NULL, + }, + { + PCI_VENDOR_CONTAQ, 0, + PCI_KNOWNDEV_NOPROD, + "Contaq Microsystems", + NULL, + }, + { + PCI_VENDOR_BIT3, 0, + PCI_KNOWNDEV_NOPROD, + "Bit3 Computer Corp.", + NULL, + }, + { + PCI_VENDOR_OLICOM, 0, + PCI_KNOWNDEV_NOPROD, + "Olicom", + NULL, + }, + { + PCI_VENDOR_SUN, 0, + PCI_KNOWNDEV_NOPROD, + "Sun Microsystems", + NULL, + }, + { + PCI_VENDOR_INTERGRAPH, 0, + PCI_KNOWNDEV_NOPROD, + "Intergraph", + NULL, + }, + { + PCI_VENDOR_DIAMOND, 0, + PCI_KNOWNDEV_NOPROD, + "Diamond Computer Systems", + NULL, + }, + { + PCI_VENDOR_CMDTECH, 0, + PCI_KNOWNDEV_NOPROD, + "CMD Technology", + NULL, + }, + { + PCI_VENDOR_QUANTUMDESIGNS, 0, + PCI_KNOWNDEV_NOPROD, + "Quantum Designs", + NULL, + }, + { + PCI_VENDOR_BROOKTREE, 0, + PCI_KNOWNDEV_NOPROD, + "Brooktree", + NULL, + }, + { + PCI_VENDOR_SGI, 0, + PCI_KNOWNDEV_NOPROD, + "Silicon Graphics", + NULL, + }, + { + PCI_VENDOR_ACC, 0, + PCI_KNOWNDEV_NOPROD, + "ACC Microelectronics", + NULL, + }, + { + PCI_VENDOR_SYMPHONY, 0, + PCI_KNOWNDEV_NOPROD, + "Symphony Labs", + NULL, + }, + { + PCI_VENDOR_PLX, 0, + PCI_KNOWNDEV_NOPROD, + "PLX Technology", + NULL, + }, + { + PCI_VENDOR_MADGE, 0, + PCI_KNOWNDEV_NOPROD, + "Madge Networks", + NULL, + }, + { + PCI_VENDOR_3COM, 0, + PCI_KNOWNDEV_NOPROD, + "3Com", + NULL, + }, + { + PCI_VENDOR_SMC, 0, + PCI_KNOWNDEV_NOPROD, + "Standard Microsystems", + NULL, + }, + { + PCI_VENDOR_ALI, 0, + PCI_KNOWNDEV_NOPROD, + "Acer Labs", + NULL, + }, + { + PCI_VENDOR_SURECOM, 0, + PCI_KNOWNDEV_NOPROD, + "Surecom Technology", + NULL, + }, + { + PCI_VENDOR_SAMSUNGSEMI, 0, + PCI_KNOWNDEV_NOPROD, + "Samsung Semiconductors", + NULL, + }, + { + PCI_VENDOR_NEOMAGIC, 0, + PCI_KNOWNDEV_NOPROD, + "Neomagic", + NULL, + }, + { + PCI_VENDOR_ADVSYS, 0, + PCI_KNOWNDEV_NOPROD, + "Advanced System Products", + NULL, + }, + { + PCI_VENDOR_MACRONIX, 0, + PCI_KNOWNDEV_NOPROD, + "Macronix", + NULL, + }, + { + PCI_VENDOR_ES, 0, + PCI_KNOWNDEV_NOPROD, + "Evans & Sutherland", + NULL, + }, + { + PCI_VENDOR_NVIDIA, 0, + PCI_KNOWNDEV_NOPROD, + "Nvidia Corporation", + NULL, + }, + { + PCI_VENDOR_EMULEX, 0, + PCI_KNOWNDEV_NOPROD, + "Emulex", + NULL, + }, + { + PCI_VENDOR_IMS, 0, + PCI_KNOWNDEV_NOPROD, + "Integrated Micro Solutions", + NULL, + }, + { + PCI_VENDOR_TEKRAM, 0, + PCI_KNOWNDEV_NOPROD, + "Tekram Technology (1st PCI Vendor ID)", + NULL, + }, + { + PCI_VENDOR_NEWBRIDGE, 0, + PCI_KNOWNDEV_NOPROD, + "Newbridge Microsystems / Tundra Semiconductor", + NULL, + }, + { + PCI_VENDOR_AMCIRCUITS, 0, + PCI_KNOWNDEV_NOPROD, + "Applied Micro Circuits", + NULL, + }, + { + PCI_VENDOR_REALTEK, 0, + PCI_KNOWNDEV_NOPROD, + "Realtek Semiconductor", + NULL, + }, + { + PCI_VENDOR_NKK, 0, + PCI_KNOWNDEV_NOPROD, + "NKK Corporation", + NULL, + }, + { + PCI_VENDOR_INITIO, 0, + PCI_KNOWNDEV_NOPROD, + "Initio", + NULL, + }, + { + PCI_VENDOR_CREATIVELABS, 0, + PCI_KNOWNDEV_NOPROD, + "Creative Labs", + NULL, + }, + { + PCI_VENDOR_TRIONES, 0, + PCI_KNOWNDEV_NOPROD, + "Triones Technologies", + NULL, + }, + { + PCI_VENDOR_SIGMA, 0, + PCI_KNOWNDEV_NOPROD, + "Sigma Designs", + NULL, + }, + { + PCI_VENDOR_VIATECH, 0, + PCI_KNOWNDEV_NOPROD, + "VIA Technologies", + NULL, + }, + { + PCI_VENDOR_COGENT, 0, + PCI_KNOWNDEV_NOPROD, + "Cogent Data Technologies", + NULL, + }, + { + PCI_VENDOR_RNS, 0, + PCI_KNOWNDEV_NOPROD, + "RNS", + NULL, + }, + { + PCI_VENDOR_ACCTON, 0, + PCI_KNOWNDEV_NOPROD, + "Accton Technology", + NULL, + }, + { + PCI_VENDOR_VORTEX, 0, + PCI_KNOWNDEV_NOPROD, + "Vortex Computer Systems", + NULL, + }, + { + PCI_VENDOR_EFFICIENTNETS, 0, + PCI_KNOWNDEV_NOPROD, + "Efficent Networks", + NULL, + }, + { + PCI_VENDOR_IDT, 0, + PCI_KNOWNDEV_NOPROD, + "IDT", + NULL, + }, + { + PCI_VENDOR_FORE, 0, + PCI_KNOWNDEV_NOPROD, + "FORE Systems", + NULL, + }, + { + PCI_VENDOR_ZIATECH, 0, + PCI_KNOWNDEV_NOPROD, + "Ziatech", + NULL, + }, + { + PCI_VENDOR_ALLIANCE, 0, + PCI_KNOWNDEV_NOPROD, + "Alliance Semiconductor", + NULL, + }, + { + PCI_VENDOR_SCHNEIDERKOCH, 0, + PCI_KNOWNDEV_NOPROD, + "Schneider & Koch", + NULL, + }, + { + PCI_VENDOR_MUTECH, 0, + PCI_KNOWNDEV_NOPROD, + "Mutech", + NULL, + }, + { + PCI_VENDOR_XIRCOM, 0, + PCI_KNOWNDEV_NOPROD, + "Xircom", + NULL, + }, + { + PCI_VENDOR_ALTERA, 0, + PCI_KNOWNDEV_NOPROD, + "Altera Corporation", + NULL, + }, + { + PCI_VENDOR_TOSHIBA2, 0, + PCI_KNOWNDEV_NOPROD, + "Toshiba America Info Systems", + NULL, + }, + { + PCI_VENDOR_RICOH, 0, + PCI_KNOWNDEV_NOPROD, + "Ricoh", + NULL, + }, + { + PCI_VENDOR_DLINK, 0, + PCI_KNOWNDEV_NOPROD, + "D-Link Systems", + NULL, + }, + { + PCI_VENDOR_COROLLARY, 0, + PCI_KNOWNDEV_NOPROD, + "Corrollary", + NULL, + }, + { + PCI_VENDOR_ACARD, 0, + PCI_KNOWNDEV_NOPROD, + "Acard", + NULL, + }, + { + PCI_VENDOR_ZEINET, 0, + PCI_KNOWNDEV_NOPROD, + "Zeinet", + NULL, + }, + { + PCI_VENDOR_GALILEO, 0, + PCI_KNOWNDEV_NOPROD, + "Galileo Technology", + NULL, + }, + { + PCI_VENDOR_LITEON, 0, + PCI_KNOWNDEV_NOPROD, + "Lite-On Communications", + NULL, + }, + { + PCI_VENDOR_V3, 0, + PCI_KNOWNDEV_NOPROD, + "V3 Semiconductor", + NULL, + }, + { + PCI_VENDOR_LUCENT, 0, + PCI_KNOWNDEV_NOPROD, + "AT&T Microelectronics", + NULL, + }, + { + PCI_VENDOR_DOLPHIN, 0, + PCI_KNOWNDEV_NOPROD, + "Dolphin Interconnect Solutions", + NULL, + }, + { + PCI_VENDOR_AURAVISION, 0, + PCI_KNOWNDEV_NOPROD, + "Auravision", + NULL, + }, + { + PCI_VENDOR_ZORAN, 0, + PCI_KNOWNDEV_NOPROD, + "Zoran Corporation", + NULL, + }, + { + PCI_VENDOR_COMPEX, 0, + PCI_KNOWNDEV_NOPROD, + "Compex", + NULL, + }, + { + PCI_VENDOR_PMCSIERRA, 0, + PCI_KNOWNDEV_NOPROD, + "PMC-Sierra", + NULL, + }, + { + PCI_VENDOR_CYCLADES, 0, + PCI_KNOWNDEV_NOPROD, + "Cyclades", + NULL, + }, + { + PCI_VENDOR_ESSENTIAL, 0, + PCI_KNOWNDEV_NOPROD, + "Essential Communications", + NULL, + }, + { + PCI_VENDOR_O2MICRO, 0, + PCI_KNOWNDEV_NOPROD, + "O2 Micro Inc", + NULL, + }, + { + PCI_VENDOR_3DFX, 0, + PCI_KNOWNDEV_NOPROD, + "3Dfx Interactive", + NULL, + }, + { + PCI_VENDOR_CCUBE, 0, + PCI_KNOWNDEV_NOPROD, + "C-Cube Microsystems", + NULL, + }, + { + PCI_VENDOR_AVM, 0, + PCI_KNOWNDEV_NOPROD, + "AVM", + NULL, + }, + { + PCI_VENDOR_LINEARSYS, 0, + PCI_KNOWNDEV_NOPROD, + "Linear Systems", + NULL, + }, + { + PCI_VENDOR_ASIX, 0, + PCI_KNOWNDEV_NOPROD, + "ASIX Electronics", + NULL, + }, + { + PCI_VENDOR_ESSTECH, 0, + PCI_KNOWNDEV_NOPROD, + "ESS Technology Inc", + NULL, + }, + { + PCI_VENDOR_SILMOTION, 0, + PCI_KNOWNDEV_NOPROD, + "Silicon Motion", + NULL, + }, + { + PCI_VENDOR_ENSONIQ, 0, + PCI_KNOWNDEV_NOPROD, + "Ensoniq", + NULL, + }, + { + PCI_VENDOR_DAVICOM, 0, + PCI_KNOWNDEV_NOPROD, + "Davicom Semiconductor", + NULL, + }, + { + PCI_VENDOR_ESSTECH2, 0, + PCI_KNOWNDEV_NOPROD, + "ESS Technology Inc", + NULL, + }, + { + PCI_VENDOR_TRITECH, 0, + PCI_KNOWNDEV_NOPROD, + "TriTech Microelectronics", + NULL, + }, + { + PCI_VENDOR_ALTEON, 0, + PCI_KNOWNDEV_NOPROD, + "Alteon", + NULL, + }, + { + PCI_VENDOR_RISCOM, 0, + PCI_KNOWNDEV_NOPROD, + "RISCom", + NULL, + }, + { + PCI_VENDOR_USR, 0, + PCI_KNOWNDEV_NOPROD, + "US Robotics (3Com)", + NULL, + }, + { + PCI_VENDOR_NVIDIA_SGS, 0, + PCI_KNOWNDEV_NOPROD, + "Nvidia Corporation & SGS Thomson Microelectric", + NULL, + }, + { + PCI_VENDOR_AUREAL, 0, + PCI_KNOWNDEV_NOPROD, + "Aureal Semiconductor", + NULL, + }, + { + PCI_VENDOR_ADMTEK, 0, + PCI_KNOWNDEV_NOPROD, + "ADMtek", + NULL, + }, + { + PCI_VENDOR_FORTEMEDIA, 0, + PCI_KNOWNDEV_NOPROD, + "Forte Media", + NULL, + }, + { + PCI_VENDOR_DOMEX, 0, + PCI_KNOWNDEV_NOPROD, + "Domex", + NULL, + }, + { + PCI_VENDOR_LMC, 0, + PCI_KNOWNDEV_NOPROD, + "LAN Media Corporation", + NULL, + }, + { + PCI_VENDOR_API, 0, + PCI_KNOWNDEV_NOPROD, + "API Networks", + NULL, + }, + { + PCI_VENDOR_CONEXANT, 0, + PCI_KNOWNDEV_NOPROD, + "Conexant Systems", + NULL, + }, + { + PCI_VENDOR_NETGEAR, 0, + PCI_KNOWNDEV_NOPROD, + "Netgear", + NULL, + }, + { + PCI_VENDOR_3WARE, 0, + PCI_KNOWNDEV_NOPROD, + "3ware", + NULL, + }, + { + PCI_VENDOR_SUNDANCETI, 0, + PCI_KNOWNDEV_NOPROD, + "Sundance Technology", + NULL, + }, + { + PCI_VENDOR_CMEDIA, 0, + PCI_KNOWNDEV_NOPROD, + "C-Media Electronics Inc", + NULL, + }, + { + PCI_VENDOR_DELTA, 0, + PCI_KNOWNDEV_NOPROD, + "Delta Electronics", + NULL, + }, + { + PCI_VENDOR_SOLIDUM, 0, + PCI_KNOWNDEV_NOPROD, + "Solidum Systems Corp.", + NULL, + }, + { + PCI_VENDOR_SIBYTE, 0, + PCI_KNOWNDEV_NOPROD, + "SiByte, Inc.", + NULL, + }, + { + PCI_VENDOR_SYMPHONY2, 0, + PCI_KNOWNDEV_NOPROD, + "Symphony Labs (2nd PCI Vendor ID)", + NULL, + }, + { + PCI_VENDOR_TEKRAM2, 0, + PCI_KNOWNDEV_NOPROD, + "Tekram Technology (2nd PCI Vendor ID)", + NULL, + }, + { + PCI_VENDOR_BROADCOM, 0, + PCI_KNOWNDEV_NOPROD, + "Broadcom", + NULL, + }, + { + PCI_VENDOR_3DLABS, 0, + PCI_KNOWNDEV_NOPROD, + "3D Labs", + NULL, + }, + { + PCI_VENDOR_AVANCE2, 0, + PCI_KNOWNDEV_NOPROD, + "Avance Logic (2nd PCI Vendor ID)", + NULL, + }, + { + PCI_VENDOR_ADDTRON, 0, + PCI_KNOWNDEV_NOPROD, + "Addtron Technology", + NULL, + }, + { + PCI_VENDOR_NETVIN, 0, + PCI_KNOWNDEV_NOPROD, + "NetVin", + NULL, + }, + { + PCI_VENDOR_S3, 0, + PCI_KNOWNDEV_NOPROD, + "S3", + NULL, + }, + { + PCI_VENDOR_C4T, 0, + PCI_KNOWNDEV_NOPROD, + "c't Magazin", + NULL, + }, + { + PCI_VENDOR_INTEL, 0, + PCI_KNOWNDEV_NOPROD, + "Intel", + NULL, + }, + { + PCI_VENDOR_PROLAN, 0, + PCI_KNOWNDEV_NOPROD, + "ProLAN", + NULL, + }, + { + PCI_VENDOR_KTI, 0, + PCI_KNOWNDEV_NOPROD, + "KTI", + NULL, + }, + { + PCI_VENDOR_ADP, 0, + PCI_KNOWNDEV_NOPROD, + "Adaptec", + NULL, + }, + { + PCI_VENDOR_ADP2, 0, + PCI_KNOWNDEV_NOPROD, + "Adaptec (2nd PCI Vendor ID)", + NULL, + }, + { + PCI_VENDOR_ATRONICS, 0, + PCI_KNOWNDEV_NOPROD, + "Atronics", + NULL, + }, + { + PCI_VENDOR_ARC, 0, + PCI_KNOWNDEV_NOPROD, + "ARC Logic", + NULL, + }, + { + PCI_VENDOR_EPIGRAM, 0, + PCI_KNOWNDEV_NOPROD, + "Epigram", + NULL, + }, + { + PCI_VENDOR_INVALID, 0, + PCI_KNOWNDEV_NOPROD, + "INVALID VENDOR ID", + NULL, + }, + { 0, 0, 0, NULL, NULL, } +}; diff --git a/cfe/cfe/pci/pcireg.h b/cfe/cfe/pci/pcireg.h new file mode 100644 index 0000000..932fc7d --- /dev/null +++ b/cfe/cfe/pci/pcireg.h @@ -0,0 +1,615 @@ +/* + * Copyright (c) 1995, 1996, 1999 + * Christopher G. Demetriou. All rights reserved. + * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Charles M. Hannum. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _DEV_PCI_PCIREG_H_ +#define _DEV_PCI_PCIREG_H_ + +/* + * Standardized PCI configuration register definitions and macros. + * Derived from information found in the ``PCI Local Bus Specification, + * Revision 2.2, December 18, 1998.'' + * + * Note: Register and field definitions assume 32-bit register accesses. + */ + +#if !defined(__ASSEMBLER__) +typedef uint16_t pci_vendor_id_t; +typedef uint16_t pci_product_id_t; + +typedef uint8_t pci_class_t; +typedef uint8_t pci_subclass_t; +typedef uint8_t pci_interface_t; +typedef uint8_t pci_revision_t; + +typedef uint8_t pci_intr_latency_t; +typedef uint8_t pci_intr_grant_t; +typedef uint8_t pci_intr_pin_t; +typedef uint8_t pci_intr_line_t; +#endif + +/* some PCI bus constants */ + +#define PCI_BUSMAX 255 +#define PCI_DEVMAX 31 +#define PCI_FUNCMAX 7 +#define PCI_REGMAX 255 + +/* + * Common PCI header + */ + +/* + * Device identification register; contains a vendor ID and a device ID. + */ +#define PCI_ID_REG 0x00 + +#define PCI_VENDOR_SHIFT 0 +#define PCI_VENDOR_MASK 0xffff +#define PCI_VENDOR(id) \ + (((id) >> PCI_VENDOR_SHIFT) & PCI_VENDOR_MASK) + +#define PCI_PRODUCT_SHIFT 16 +#define PCI_PRODUCT_MASK 0xffff +#define PCI_PRODUCT(id) \ + (((id) >> PCI_PRODUCT_SHIFT) & PCI_PRODUCT_MASK) + +/* + * Command and status register. + */ +#define PCI_COMMAND_STATUS_REG 0x04 + +#define PCI_COMMAND_SHIFT 0 +#define PCI_COMMAND_MASK 0xffff +#define PCI_COMMAND(csr) \ + (((csr) >> PCI_COMMAND_SHIFT) & PCI_COMMAND_MASK) + +#define PCI_STATUS_SHIFT 16 +#define PCI_STATUS_MASK 0xffff +#define PCI_STATUS(csr) \ + (((csr) >> PCI_STATUS_SHIFT) & PCI_STATUS_MASK) + +#define PCI_COMMAND_IO_ENABLE 0x00000001 +#define PCI_COMMAND_MEM_ENABLE 0x00000002 +#define PCI_COMMAND_MASTER_ENABLE 0x00000004 +#define PCI_COMMAND_SPECIAL_ENABLE 0x00000008 +#define PCI_COMMAND_INVALIDATE_ENABLE 0x00000010 +#define PCI_COMMAND_PALETTE_ENABLE 0x00000020 +#define PCI_COMMAND_PARITY_ENABLE 0x00000040 +#define PCI_COMMAND_STEPPING_ENABLE 0x00000080 +#define PCI_COMMAND_SERR_ENABLE 0x00000100 +#define PCI_COMMAND_BACKTOBACK_ENABLE 0x00000200 + +#define PCI_STATUS_CAPLIST_SUPPORT 0x00100000 +#define PCI_STATUS_66MHZ_SUPPORT 0x00200000 +#define PCI_STATUS_UDF_SUPPORT 0x00400000 +#define PCI_STATUS_BACKTOBACK_SUPPORT 0x00800000 +#define PCI_STATUS_PARITY_ERROR 0x01000000 +#define PCI_STATUS_DEVSEL_FAST 0x00000000 +#define PCI_STATUS_DEVSEL_MEDIUM 0x02000000 +#define PCI_STATUS_DEVSEL_SLOW 0x04000000 +#define PCI_STATUS_DEVSEL_MASK 0x06000000 +#define PCI_STATUS_DEVSEL_SHIFT 25 +#define PCI_STATUS_DEVSEL(scr) \ + (((scr) & PCI_STATUS_DEVSEL_MASK) >> PCI_STATUS_DEVSEL_SHIFT) +#define PCI_STATUS_TARGET_TARGET_ABORT 0x08000000 +#define PCI_STATUS_MASTER_TARGET_ABORT 0x10000000 +#define PCI_STATUS_MASTER_ABORT 0x20000000 +#define PCI_STATUS_SYSTEM_ERROR 0x40000000 +#define PCI_STATUS_PARITY_DETECT 0x80000000 + +/* + * PCI Class and Revision Register; defines type and revision of device. + */ +#define PCI_CLASS_REG 0x08 + +#define PCI_CLASS_SHIFT 24 +#define PCI_CLASS_MASK 0xff +#define PCI_CLASS(cr) \ + (((cr) >> PCI_CLASS_SHIFT) & PCI_CLASS_MASK) + +#define PCI_SUBCLASS_SHIFT 16 +#define PCI_SUBCLASS_MASK 0xff +#define PCI_SUBCLASS(cr) \ + (((cr) >> PCI_SUBCLASS_SHIFT) & PCI_SUBCLASS_MASK) + +#define PCI_INTERFACE_SHIFT 8 +#define PCI_INTERFACE_MASK 0xff +#define PCI_INTERFACE(cr) \ + (((cr) >> PCI_INTERFACE_SHIFT) & PCI_INTERFACE_MASK) + +#define PCI_REVISION_SHIFT 0 +#define PCI_REVISION_MASK 0xff +#define PCI_REVISION(cr) \ + (((cr) >> PCI_REVISION_SHIFT) & PCI_REVISION_MASK) + +#define PCI_CLASS_CODE(class, subclass, interface) \ + ((((class) & PCI_CLASS_MASK) << PCI_CLASS_SHIFT) | \ + (((subclass) & PCI_SUBCLASS_MASK) << PCI_SUBCLASS_SHIFT) | \ + (((interface) & PCI_INTERFACE_MASK) << PCI_INTERFACE_SHIFT)) + +/* base classes */ +#define PCI_CLASS_PREHISTORIC 0x00 +#define PCI_CLASS_MASS_STORAGE 0x01 +#define PCI_CLASS_NETWORK 0x02 +#define PCI_CLASS_DISPLAY 0x03 +#define PCI_CLASS_MULTIMEDIA 0x04 +#define PCI_CLASS_MEMORY 0x05 +#define PCI_CLASS_BRIDGE 0x06 +#define PCI_CLASS_COMMUNICATIONS 0x07 +#define PCI_CLASS_SYSTEM 0x08 +#define PCI_CLASS_INPUT 0x09 +#define PCI_CLASS_DOCK 0x0a +#define PCI_CLASS_PROCESSOR 0x0b +#define PCI_CLASS_SERIALBUS 0x0c +#define PCI_CLASS_WIRELESS 0x0d +#define PCI_CLASS_I2O 0x0e +#define PCI_CLASS_SATCOM 0x0f +#define PCI_CLASS_CRYPTO 0x10 +#define PCI_CLASS_DASP 0x11 +#define PCI_CLASS_UNDEFINED 0xff + +/* 0x00 prehistoric subclasses */ +#define PCI_SUBCLASS_PREHISTORIC_MISC 0x00 +#define PCI_SUBCLASS_PREHISTORIC_VGA 0x01 + +/* 0x01 mass storage subclasses */ +#define PCI_SUBCLASS_MASS_STORAGE_SCSI 0x00 +#define PCI_SUBCLASS_MASS_STORAGE_IDE 0x01 +#define PCI_SUBCLASS_MASS_STORAGE_FLOPPY 0x02 +#define PCI_SUBCLASS_MASS_STORAGE_IPI 0x03 +#define PCI_SUBCLASS_MASS_STORAGE_RAID 0x04 +#define PCI_SUBCLASS_MASS_STORAGE_MISC 0x80 + +/* 0x02 network subclasses */ +#define PCI_SUBCLASS_NETWORK_ETHERNET 0x00 +#define PCI_SUBCLASS_NETWORK_TOKENRING 0x01 +#define PCI_SUBCLASS_NETWORK_FDDI 0x02 +#define PCI_SUBCLASS_NETWORK_ATM 0x03 +#define PCI_SUBCLASS_NETWORK_ISDN 0x04 +#define PCI_SUBCLASS_NETWORK_WORLDFIP 0x05 +#define PCI_SUBCLASS_NETWORK_PCIMGMULTICOMP 0x06 +#define PCI_SUBCLASS_NETWORK_MISC 0x80 + +/* 0x03 display subclasses */ +#define PCI_SUBCLASS_DISPLAY_VGA 0x00 +#define PCI_SUBCLASS_DISPLAY_XGA 0x01 +#define PCI_SUBCLASS_DISPLAY_3D 0x02 +#define PCI_SUBCLASS_DISPLAY_MISC 0x80 + +/* 0x04 multimedia subclasses */ +#define PCI_SUBCLASS_MULTIMEDIA_VIDEO 0x00 +#define PCI_SUBCLASS_MULTIMEDIA_AUDIO 0x01 +#define PCI_SUBCLASS_MULTIMEDIA_TELEPHONY 0x02 +#define PCI_SUBCLASS_MULTIMEDIA_MISC 0x80 + +/* 0x05 memory subclasses */ +#define PCI_SUBCLASS_MEMORY_RAM 0x00 +#define PCI_SUBCLASS_MEMORY_FLASH 0x01 +#define PCI_SUBCLASS_MEMORY_MISC 0x80 + +/* 0x06 bridge subclasses */ +#define PCI_SUBCLASS_BRIDGE_HOST 0x00 +#define PCI_SUBCLASS_BRIDGE_ISA 0x01 +#define PCI_SUBCLASS_BRIDGE_EISA 0x02 +#define PCI_SUBCLASS_BRIDGE_MCA 0x03 +#define PCI_SUBCLASS_BRIDGE_PCI 0x04 +#define PCI_SUBCLASS_BRIDGE_PCMCIA 0x05 +#define PCI_SUBCLASS_BRIDGE_NUBUS 0x06 +#define PCI_SUBCLASS_BRIDGE_CARDBUS 0x07 +#define PCI_SUBCLASS_BRIDGE_RACEWAY 0x08 +#define PCI_SUBCLASS_BRIDGE_STPCI 0x09 +#define PCI_SUBCLASS_BRIDGE_INFINIBAND 0x0a +#define PCI_SUBCLASS_BRIDGE_MISC 0x80 + +/* 0x07 communications subclasses */ +#define PCI_SUBCLASS_COMMUNICATIONS_SERIAL 0x00 +#define PCI_SUBCLASS_COMMUNICATIONS_PARALLEL 0x01 +#define PCI_SUBCLASS_COMMUNICATIONS_MPSERIAL 0x02 +#define PCI_SUBCLASS_COMMUNICATIONS_MODEM 0x03 +#define PCI_SUBCLASS_COMMUNICATIONS_MISC 0x80 + +/* 0x08 system subclasses */ +#define PCI_SUBCLASS_SYSTEM_PIC 0x00 +#define PCI_SUBCLASS_SYSTEM_DMA 0x01 +#define PCI_SUBCLASS_SYSTEM_TIMER 0x02 +#define PCI_SUBCLASS_SYSTEM_RTC 0x03 +#define PCI_SUBCLASS_SYSTEM_PCIHOTPLUG 0x04 +#define PCI_SUBCLASS_SYSTEM_MISC 0x80 + +/* 0x09 input subclasses */ +#define PCI_SUBCLASS_INPUT_KEYBOARD 0x00 +#define PCI_SUBCLASS_INPUT_DIGITIZER 0x01 +#define PCI_SUBCLASS_INPUT_MOUSE 0x02 +#define PCI_SUBCLASS_INPUT_SCANNER 0x03 +#define PCI_SUBCLASS_INPUT_GAMEPORT 0x04 +#define PCI_SUBCLASS_INPUT_MISC 0x80 + +/* 0x0a dock subclasses */ +#define PCI_SUBCLASS_DOCK_GENERIC 0x00 +#define PCI_SUBCLASS_DOCK_MISC 0x80 + +/* 0x0b processor subclasses */ +#define PCI_SUBCLASS_PROCESSOR_386 0x00 +#define PCI_SUBCLASS_PROCESSOR_486 0x01 +#define PCI_SUBCLASS_PROCESSOR_PENTIUM 0x02 +#define PCI_SUBCLASS_PROCESSOR_ALPHA 0x10 +#define PCI_SUBCLASS_PROCESSOR_POWERPC 0x20 +#define PCI_SUBCLASS_PROCESSOR_MIPS 0x30 +#define PCI_SUBCLASS_PROCESSOR_COPROC 0x40 + +/* 0x0c serial bus subclasses */ +#define PCI_SUBCLASS_SERIALBUS_FIREWIRE 0x00 +#define PCI_SUBCLASS_SERIALBUS_ACCESS 0x01 +#define PCI_SUBCLASS_SERIALBUS_SSA 0x02 +#define PCI_SUBCLASS_SERIALBUS_USB 0x03 +#define PCI_SUBCLASS_SERIALBUS_FIBER 0x04 /* XXX _FIBRECHANNEL */ +#define PCI_SUBCLASS_SERIALBUS_SMBUS 0x05 +#define PCI_SUBCLASS_SERIALBUS_INFINIBAND 0x06 +#define PCI_SUBCLASS_SERIALBUS_IPMI 0x07 +#define PCI_SUBCLASS_SERIALBUS_SERCOS 0x08 +#define PCI_SUBCLASS_SERIALBUS_CANBUS 0x09 + +/* 0x0d wireless subclasses */ +#define PCI_SUBCLASS_WIRELESS_IRDA 0x00 +#define PCI_SUBCLASS_WIRELESS_CONSUMERIR 0x01 +#define PCI_SUBCLASS_WIRELESS_RF 0x10 +#define PCI_SUBCLASS_WIRELESS_MISC 0x80 + +/* 0x0e I2O (Intelligent I/O) subclasses */ +#define PCI_SUBCLASS_I2O_STANDARD 0x00 + +/* 0x0f satellite communication subclasses */ +/* PCI_SUBCLASS_SATCOM_??? 0x00 / * XXX ??? */ +#define PCI_SUBCLASS_SATCOM_TV 0x01 +#define PCI_SUBCLASS_SATCOM_AUDIO 0x02 +#define PCI_SUBCLASS_SATCOM_VOICE 0x03 +#define PCI_SUBCLASS_SATCOM_DATA 0x04 + +/* 0x10 encryption/decryption subclasses */ +#define PCI_SUBCLASS_CRYPTO_NETCOMP 0x00 +#define PCI_SUBCLASS_CRYPTO_ENTERTAINMENT 0x10 +#define PCI_SUBCLASS_CRYPTO_MISC 0x80 + +/* 0x11 data acquisition and signal processing subclasses */ +#define PCI_SUBCLASS_DASP_DPIO 0x00 +#define PCI_SUBCLASS_DASP_TIMERFREQ 0x01 +#define PCI_SUBCLASS_DASP_MISC 0x80 + +/* + * PCI BIST/Header Type/Latency Timer/Cache Line Size Register. + */ +#define PCI_BHLC_REG 0x0c + +#define PCI_BIST_SHIFT 24 +#define PCI_BIST_MASK 0xff +#define PCI_BIST(bhlcr) \ + (((bhlcr) >> PCI_BIST_SHIFT) & PCI_BIST_MASK) + +#define PCI_HDRTYPE_SHIFT 16 +#define PCI_HDRTYPE_MASK 0xff +#define PCI_HDRTYPE(bhlcr) \ + (((bhlcr) >> PCI_HDRTYPE_SHIFT) & PCI_HDRTYPE_MASK) + +#define PCI_HDRTYPE_TYPE(bhlcr) \ + (PCI_HDRTYPE(bhlcr) & 0x7f) +#define PCI_HDRTYPE_MULTIFN(bhlcr) \ + ((PCI_HDRTYPE(bhlcr) & 0x80) != 0) + +#define PCI_LATTIMER_SHIFT 8 +#define PCI_LATTIMER_MASK 0xff +#define PCI_LATTIMER(bhlcr) \ + (((bhlcr) >> PCI_LATTIMER_SHIFT) & PCI_LATTIMER_MASK) +#define PCI_LATTIMER_SET(bhlcr,v) \ + (bhlcr) = ((bhlcr) & ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT)) | \ + ((v) << PCI_LATTIMER_SHIFT) + +#define PCI_CACHELINE_SHIFT 0 +#define PCI_CACHELINE_MASK 0xff +#define PCI_CACHELINE(bhlcr) \ + (((bhlcr) >> PCI_CACHELINE_SHIFT) & PCI_CACHELINE_MASK) +#define PCI_CACHELINE_SET(bhlcr,v) \ + (bhlcr) = ((bhlcr) & ~(PCI_CACHELINE_MASK << PCI_CACHELINE_SHIFT)) | \ + ((v) << PCI_CACHELINE_SHIFT) + +/* + * The currently defined header types are + * 00h prefix PCI_ below + * 01h prefix PPB_ below (PCI-to-PCI bridges) + * 02h prefix PCB_ below (Cardbus bridges) + */ + +/* + * Type 00h Configuration Space extensions. + */ + +/* + * Mapping registers + */ +#define PCI_MAPREG_START 0x10 +#define PCI_MAPREG_END 0x28 + +#define PCI_MAPREG_PPB_END 0x18 +#define PCI_MAPREG_PPB_ROM 0x38 +#define PCI_MAPREG_PCB_END 0x14 +#define PCI_MAPREG_NONE 0x00 + +#define PCI_MAPREG_TYPE(mr) \ + ((mr) & PCI_MAPREG_TYPE_MASK) +#define PCI_MAPREG_TYPE_MASK 0x00000001 + +#define PCI_MAPREG_TYPE_MEM 0x00000000 +#define PCI_MAPREG_TYPE_IO 0x00000001 + +#define PCI_MAPREG_MEM_TYPE(mr) \ + ((mr) & PCI_MAPREG_MEM_TYPE_MASK) +#define PCI_MAPREG_MEM_TYPE_MASK 0x00000006 + +#define PCI_MAPREG_MEM_TYPE_32BIT 0x00000000 +#define PCI_MAPREG_MEM_TYPE_32BIT_1M 0x00000002 +#define PCI_MAPREG_MEM_TYPE_64BIT 0x00000004 + +#define PCI_MAPREG_MEM_PREFETCHABLE(mr) \ + (((mr) & PCI_MAPREG_MEM_PREFETCHABLE_MASK) != 0) +#define PCI_MAPREG_MEM_PREFETCHABLE_MASK 0x00000008 + +#define PCI_MAPREG_MEM_ADDR(mr) \ + ((mr) & PCI_MAPREG_MEM_ADDR_MASK) +#define PCI_MAPREG_MEM_SIZE(mr) \ + (PCI_MAPREG_MEM_ADDR(mr) & -PCI_MAPREG_MEM_ADDR(mr)) +#define PCI_MAPREG_MEM_ADDR_MASK 0xfffffff0 + +#define PCI_MAPREG_MEM64_ADDR(mr) \ + ((mr) & PCI_MAPREG_MEM64_ADDR_MASK) +#define PCI_MAPREG_MEM64_SIZE(mr) \ + (PCI_MAPREG_MEM64_ADDR(mr) & -PCI_MAPREG_MEM64_ADDR(mr)) +#define PCI_MAPREG_MEM64_ADDR_MASK 0xfffffffffffffff0ULL + +#define PCI_MAPREG_IO_ADDR(mr) \ + ((mr) & PCI_MAPREG_IO_ADDR_MASK) +#define PCI_MAPREG_IO_SIZE(mr) \ + (PCI_MAPREG_IO_ADDR(mr) & -PCI_MAPREG_IO_ADDR(mr)) +#define PCI_MAPREG_IO_ADDR_MASK 0xfffffffc + +#define PCI_MAPREG_SIZE_TO_MASK(size) \ + (-(size)) + +#define PCI_MAPREG(num) (PCI_MAPREG_START + 4*(num)) +#define PCI_MAPREG_NUM(offset) \ + (((unsigned)(offset)-PCI_MAPREG_START)/4) + +/* + * Cardbus CIS pointer (PCI rev. 2.1) + */ +#define PCI_CARDBUS_CIS_REG 0x28 + +/* + * Subsystem identification register; contains a vendor ID and a device ID. + * Types/macros for PCI_ID_REG apply. + * (PCI rev. 2.1) + */ +#define PCI_SUBSYS_ID_REG 0x2c + +/* + * Expansion ROM base address register; contains an address and enable bit. + */ +#define PCI_MAPREG_ROM 0x30 +#define PCI_MAPREG_ROM_ADDR(mr) \ + ((mr) & PCI_MAPREG_ROM_ADDR_MASK) +#define PCI_MAPREG_ROM_ADDR_MASK 0xfffff800 +#define PCI_MAPREG_ROM_ENABLE 0x00000001 + +/* + * capabilities link list (PCI rev. 2.2) + */ +#define PCI_CAPLISTPTR_REG 0x34 /* header type 0 */ +#define PCI_CARDBUS_CAPLISTPTR_REG 0x14 /* header type 2 */ +#define PCI_CAPLIST_PTR(cpr) ((cpr) & 0xff) +#define PCI_CAPLIST_NEXT(cr) (((cr) >> 8) & 0xff) +#define PCI_CAPLIST_CAP(cr) ((cr) & 0xff) + +#define PCI_CAP_RESERVED0 0x00 +#define PCI_CAP_PWRMGMT 0x01 +#define PCI_CAP_AGP 0x02 +#define PCI_CAP_VPD 0x03 +#define PCI_CAP_SLOTID 0x04 +#define PCI_CAP_MBI 0x05 +#define PCI_CAP_CPCI_HOTSWAP 0x06 +#define PCI_CAP_PCIX 0x07 +#define PCI_CAP_LDT 0x08 +#define PCI_CAP_VENDSPEC 0x09 +#define PCI_CAP_DEBUGPORT 0x0a +#define PCI_CAP_CPCI_RSRCCTL 0x0b +#define PCI_CAP_HOTPLUG 0x0c + +/* + * Power Management Control Status Register; access via capability pointer. + */ +#define PCI_PMCSR_STATE_MASK 0x03 +#define PCI_PMCSR_STATE_D0 0x00 +#define PCI_PMCSR_STATE_D1 0x01 +#define PCI_PMCSR_STATE_D2 0x02 +#define PCI_PMCSR_STATE_D3 0x03 + +/* + * Bus Parameter and Interrupt Configuration Register; + * contains interrupt pin and line. + */ +#define PCI_BPARAM_INTERRUPT_REG 0x3c + +#define PCI_BPARAM_LATENCY_SHIFT 24 +#define PCI_BPARAM_LATENCY_MASK 0xff +#define PCI_BPARAM_LATENCY(bpir) \ + (((bpir) >> PCI_BPARAM_LATENCY_SHIFT) & PCI_BPARAM_LATENCY_MASK) + +#define PCI_BPARAM_GRANT_SHIFT 16 +#define PCI_BPARAM_GRANT_MASK 0xff +#define PCI_BPARAM_GRANT(bpir) \ + (((bpir) >> PCI_BPARAM_GRANT_SHIFT) & PCI_BPARAM_GRANT_MASK) + +#define PCI_INTERRUPT_PIN_SHIFT 8 +#define PCI_INTERRUPT_PIN_MASK 0xff +#define PCI_INTERRUPT_PIN(bpir) \ + (((bpir) >> PCI_INTERRUPT_PIN_SHIFT) & PCI_INTERRUPT_PIN_MASK) + +#define PCI_INTERRUPT_LINE_SHIFT 0 +#define PCI_INTERRUPT_LINE_MASK 0xff +#define PCI_INTERRUPT_LINE(bpir) \ + (((bpir) >> PCI_INTERRUPT_LINE_SHIFT) & PCI_INTERRUPT_LINE_MASK) + +#define PCI_INTERRUPT_PIN_NONE 0x00 +#define PCI_INTERRUPT_PIN_A 0x01 +#define PCI_INTERRUPT_PIN_B 0x02 +#define PCI_INTERRUPT_PIN_C 0x03 +#define PCI_INTERRUPT_PIN_D 0x04 +#define PCI_INTERRUPT_PIN_MAX 0x04 + + +/* + * Type 01h Configuration Space extension: + * PCI to PCI Bridge registers (cf ppbreg.h) + * Derived from information found in the ``PCI to PCI Bridge + * Architecture Specification, Revision 1.1, December 18, 1998.'' + */ + +#define PPB_MAPREG_START 0x10 +#define PPB_MAPREG_END 0x18 + +/* + * Bus Information Register; contains bus hierarchy and secondary latency. + */ +#define PPB_BUSINFO_REG 0x18 + +#define PPB_BUSINFO_LATENCY_SHIFT 24 +#define PPB_BUSINFO_LATENCY_MASK 0xff +#define PPB_BUSINFO_LATENCY(br) \ + (((br) >> PPB_BUSINFO_LATENCY_SHIFT) & PPB_BUSINFO_LATENCY_MASK) + +#define PPB_BUSINFO_SUBORD_SHIFT 16 +#define PPB_BUSINFO_SUBORD_MASK 0xff +#define PPB_BUSINFO_SUBORD(br) \ + (((br) >> PPB_BUSINFO_SUBORD_SHIFT) & PPB_BUSINFO_SUBORD_MASK) + +#define PPB_BUSINFO_SECONDARY_SHIFT 8 +#define PPB_BUSINFO_SECONDARY_MASK 0xff +#define PPB_BUSINFO_SECONDARY(br) \ + (((br) >> PPB_BUSINFO_SECONDARY_SHIFT) & PPB_BUSINFO_SECONDARY_MASK) + +#define PPB_BUSINFO_PRIMARY_SHIFT 0 +#define PPB_BUSINFO_PRIMARY_MASK 0xff +#define PPB_BUSINFO_PRIMARY(br) \ + (((br) >> PPB_BUSINFO_PRIMARY_SHIFT) & PPB_BUSINFO_PRIMARY_MASK) + +/* + * IO Status Register; contains I/O base + limit and secondary status. + * Masks/macros for PCI_STATUS apply to Secondary Status. + */ +#define PPB_IO_STATUS_REG 0x1C + +#define PPB_IO_BASE_MASK 0x000000ff +#define PPB_IO_LIMIT_MASK 0x0000ff00 +#define PPB_IO_ADDR_CAP_MASK 0x00000f0f +#define PPB_IO_ADDR_CAP_16 0x00000000 +#define PPB_IO_ADDR_CAP_32 0x00000101 +#define PPB_IO_BASE(iosr) \ + (((iosr) >> 0) & 0xff) +#define PPB_IO_LIMIT(iosr) \ + (((iosr) >> 8) & 0xff) + +#define PPB_SECSTATUS_SHIFT 16 +#define PPB_SECSTATUS_MASK 0xffff +#define PPB_SECSTATUS(iosr) \ + (((iosr) >> PPB_SECSTATUS_SHIFT) & PPB_SECSTATUS_MASK) + +/* + * Base and limit values for address ranges have common packing. + */ +#define PPB_BASE_SHIFT 0 +#define PPB_BASE_MASK 0xffff +#define PPB_BASE(blr) \ + (((blr) >> PPB_BASE_SHIFT) & PPB_BASE_MASK) + +#define PPB_LIMIT_SHIFT 16 +#define PPB_LIMIT_MASK 0xffff +#define PPB_LIMIT(blr) \ + (((blr) >> PPB_LIMIT_SHIFT) & PPB_LIMIT_MASK) + +/* + * Memory Registers; contains memory base + limit. + */ +#define PPB_MEM_REG 0x20 +#define PPB_PREFMEM_REG 0x24 + +#define PPB_MEM_BASE_MASK 0x0000ffff +#define PPB_MEM_LIMIT_MASK 0xffff0000 + +/* + * Prefetchable Memory Upper Registers; contain high bits + */ +#define PPB_PREFMEM_BASE_UPPER_REG 0x28 +#define PPB_PREFMEM_LIMIT_UPPER_REG 0x2c + +/* + * IO Upper Register; contains I/O base + limit high bits + */ +#define PPB_IO_UPPER_REG 0x30 + +#define PPB_IO_UPPER_BASE_MASK 0x0000ffff +#define PPB_IO_UPPER_LIMIT_MASK 0xffff0000 + +/* + * Expansion ROM Base Address Register. + */ +#define PPB_MAPREG_ROM 0x38 + +/* + * Bridge Control and Interrupt Register + * Masks/macros for PCI_INTERRUPT apply to Interrupt + */ +#define PPB_BRCTL_INTERRUPT_REG 0x3C + +#define PPB_BRCTL_SHIFT 16 +#define PPB_BRCTL_MASK 0xffff +#define PPB_BRCTL(bcir) \ + (((bcir) >> PPB_BRCTL_SHIFT) & PPB_BRCTL_MASK) + +#define PPB_BRCTL_PARITY_ENABLE 0x00010000 +#define PPB_BRCTL_SERR_ENABLE 0x00020000 +#define PPB_BRCTL_ISA_ENABLE 0x00040000 +#define PPB_BRCTL_VGA_ENABLE 0x00080000 +#define PPB_BRCTL_MASTER_ABORT_MODE 0x00200000 +#define PPB_BRCTL_SECONDARY_RESET 0x00400000 +#define PPB_BRCTL_BACKTOBACK_ENABLE 0x00800000 +#define PPB_BRCTL_PRIMARY_DISCARD_TIMER 0x01000000 +#define PPB_BRCTL_SECONDARY_DISCARD_TIMER 0x02000000 +#define PPB_BRCTL_DISCARD_TIMER_STATUS 0x04000000 +#define PPB_BRCTL_DISCARD_SERR_ENABLE 0x08000000 + +#endif /* _DEV_PCI_PCIREG_H_ */ diff --git a/cfe/cfe/pci/pcivar.h b/cfe/cfe/pci/pcivar.h new file mode 100644 index 0000000..51f0b40 --- /dev/null +++ b/cfe/cfe/pci/pcivar.h @@ -0,0 +1,216 @@ +/* + * Copyright (c) 1994 Charles Hannum. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Charles Hannum. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PCIVAR_H_ +#define _PCIVAR_H_ + +/* + * Definitions for PCI autoconfiguration. + * + * The initial segment of this file describes types and functions + * that are exported for PCI configuration and address mapping. */ + +#include "pci_machdep.h" + +/* From _pci_machdep.c */ + +pcitag_t pci_make_tag(int, int, int); +pcireg_t pci_conf_read(pcitag_t, int); +void pci_conf_write(pcitag_t, int, pcireg_t); + +typedef enum { + PCI_MATCH_BYTES = 0, + PCI_MATCH_BITS = 1 +} pci_endian_t; + +int pci_map_io(pcitag_t, int, pci_endian_t, phys_addr_t *); +int pci_map_mem(pcitag_t, int, pci_endian_t, phys_addr_t *); + +uint8_t inb(unsigned int port); +uint16_t inw(unsigned int port); +uint32_t inl(unsigned int port); +void outb(unsigned int port, uint8_t val); +void outw(unsigned int port, uint16_t val); +void outl(unsigned int port, uint32_t val); + +int pci_map_window(phys_addr_t pa, + unsigned int offset, unsigned int len, + int l2ca, int endian); +int pci_unmap_window(unsigned int offset, unsigned int len); + +/* From pciconf.c */ + +/* Flags controlling PCI/LDT configuration options */ + +typedef unsigned int pci_flags_t; + +#define PCI_FLG_NORMAL 0x00000001 +#define PCI_FLG_VERBOSE 0x00000003 +#define PCI_FLG_LDT_PREFETCH 0x00000004 +#define PCI_FLG_LDT_REV_017 0x00000008 + +void pci_configure(pci_flags_t flags); +void pci_show_configuration(void); +int pci_foreachdev(int (*fn)(pcitag_t tag)); +int pci_cacheline_log2 (void); +int pci_maxburst_log2 (void); + +int pci_find_device(uint32_t vid, uint32_t did, int enumidx, pcitag_t *tag); +int pci_find_class(uint32_t class, int enumidx, pcitag_t *tag); + +/* From pci_subr.c */ + +void pci_devinfo(pcireg_t, pcireg_t, int, char *); +void pci_conf_print(pcitag_t tag); + +void pci_tagprintf (pcitag_t tag, const char *fmt, ...) +#ifdef __long64 + __attribute__((__format__(__printf__,2,3))) +#endif + ; + + +/* + * Definitions for PCI autoconfiguration. + * + * The remainder of this file describes types and functions + * that are used only for communication among the PCI modules + * implementing autoconfiguration. + * XXX This should be split into a separate file. */ + +/* Build options. Debug levels >1 are for helping to bring up new + LDT hardware and will be annoyingly verbose otherwise. */ + +/* PCI_DEBUG enables general checking and tracing. */ +#ifndef PCI_DEBUG +#define PCI_DEBUG 0 +#endif + +/* LDT_DEBUG enables progress/error reports for LDT fabric initialization. */ +#ifndef LDT_DEBUG +#define LDT_DEBUG 0 +#endif + + +struct pci_attach_args { + pcitag_t pa_tag; + pcireg_t pa_id; + pcireg_t pa_class; +}; + +struct pci_match { + pcireg_t class, classmask; + pcireg_t id, idmask; +}; + +/* From _pci_machdep.c */ + +int pci_hwinit(pci_flags_t flags); +void pci_hwreinit(pci_flags_t flags); +int pci_device_preset (pcitag_t tag); +void pci_device_setup(pcitag_t tag); +void pci_bridge_setup(pcitag_t tag, pci_flags_t flags); +void pci_flush(void); + +void pci_break_tag(pcitag_t, int *, int *, int *); + +int pci_canscan(pcitag_t); +int pci_probe_tag(pcitag_t tag); + +pcireg_t pci_conf_read8(pcitag_t, int); +void pci_conf_write8(pcitag_t, int, pcireg_t); +pcireg_t pci_conf_read16(pcitag_t, int); +void pci_conf_write16(pcitag_t, int, pcireg_t); +pcireg_t pci_conf_read(pcitag_t, int); +void pci_conf_write(pcitag_t, int, pcireg_t); +#define pci_conf_read32 pci_conf_read +#define pci_conf_write32 pci_conf_write +int pci_conf_write_acked(pcitag_t, int, pcireg_t); + +uint8_t pci_int_line(uint8_t); + + +/* From _pci.c */ + +uint8_t pci_int_shift_0(pcitag_t); +uint8_t pci_int_map_0(pcitag_t); + + +/* From ldtinit.c */ + +#define LDT_PRIMARY 0 +#define LDT_SECONDARY 1 +unsigned pci_find_ldt_cap (pcitag_t tag, int secondary); + +void ldt_link_reset (pcitag_t tag, int delay); +int ldt_chain_init (pcitag_t tag, int bus, pci_flags_t flags); + + +/* From pci_subr.c */ + +void pci_bdfprintf(int bus, int device, int function, const char *fmt, ...) +#ifdef __long64 + __attribute__((__format__(__printf__,4,5))) +#endif + ; + + +/* PCI bus parameters */ +struct pci_bus { + unsigned char min_gnt; /* largest min grant */ + unsigned char max_lat; /* smallest max latency */ + unsigned char devsel; /* slowest devsel */ + char fast_b2b; /* support fast b2b */ + char prefetch; /* support prefetch */ + char freq66; /* support 66MHz */ + char width64; /* 64 bit bus */ + int bandwidth; /* # of .25us ticks/sec @ 33MHz */ + unsigned char ndev; /* # devices (functions) on bus */ + unsigned char def_ltim; /* default ltim counter */ + unsigned char max_ltim; /* maximum ltim counter */ + uint8_t primary; /* primary bus number */ + pcitag_t tag; /* tag for this bus */ + uint32_t min_io_addr; /* min I/O address allocated to bus */ + uint32_t max_io_addr; /* max I/O address allocated to bus */ + uint32_t min_mem_addr; /* min mem address allocated to bus */ + uint32_t max_mem_addr; /* max mem address allocated to bus */ + uint8_t inta_shift; /* base rotation of interrupt pins */ + char no_probe; /* skip businit and query probes */ +}; + +extern pcireg_t minpcimemaddr; +extern pcireg_t maxpcimemaddr; +extern pcireg_t minpciioaddr; +extern pcireg_t maxpciioaddr; + +extern struct pci_bus _pci_bus[]; +extern int _pci_nbus; +extern const int _pci_maxbus; + +#endif /* _PCIVAR_H_ */ diff --git a/cfe/cfe/ui/ui_cmddisp.c b/cfe/cfe/ui/ui_cmddisp.c new file mode 100644 index 0000000..8609f1c --- /dev/null +++ b/cfe/cfe/ui/ui_cmddisp.c @@ -0,0 +1,252 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * UI Command Dispatch File: ui_cmddisp.c + * + * This module contains routines to maintain the command table, + * parse and execute commands + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_setjmp.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_error.h" +#include "env_subr.h" +#include "cfe.h" +#include "ui_command.h" + +/* ********************************************************************* + * Types + ********************************************************************* */ + + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +static jmp_buf ui_jmpbuf; /* for getting control in exceptions */ + + + +void dumplist(queue_t *qb); +void dumplist(queue_t *qb) +{ + queue_t *q; + ui_token_t *t; + + for (q = qb->q_next; q != qb; q = q->q_next) { + + t = (ui_token_t *) q; + printf("[%s] ",&(t->token)); + } + printf("\n"); +} + + + +const char *ui_errstring(int errcode) +{ + return cfe_errortext(errcode); +} + + +int ui_showerror(int errcode,char *tmplt,...) +{ + va_list marker; + + va_start(marker,tmplt); + xvprintf(tmplt,marker); + va_end(marker); + xprintf(": %s\n",ui_errstring(errcode)); + + return errcode; +} + + + +static int ui_do_one_command(queue_t *head) +{ + int res; + ui_cmdline_t cmd; + + res = cmd_lookup(head, &cmd); + + if (res == 0) { + + res = cmd_sw_validate(&cmd,cmd.switches); + if (res != -1) { + xprintf("Invalid switch: %s\n", + cmd_sw_name(&cmd,res)); + return CFE_ERR_INV_PARAM; + } + + if (lib_setjmp(ui_jmpbuf) != 0) return -1; + res = (*cmd.func)(&cmd,cmd.argc-cmd.argidx, + &(cmd.argv[cmd.argidx])); + } + cmd_free(&cmd); + return res; +} + + +void ui_restart(int arg) +{ + if (arg == 0) arg = -1; + + lib_longjmp(ui_jmpbuf,arg); +} + +int ui_init_cmddisp(void) +{ + cmd_init(); + + return 0; +} + +int ui_showusage(ui_cmdline_t *cmd) +{ + cmd_showusage(cmd); + + return CFE_ERR_INV_COMMAND; +} + + +/* ********************************************************************* + * ui_docommands_internal(head) + * + * Process (possibly multiple) commands from a list of tokens + * + * Input parameters: + * buf - buffer + * + * Return value: + * exit status of first command that failed, or null + ********************************************************************* */ +static int ui_docommands_internal(queue_t *head) +{ + queue_t cmdqueue; + ui_command_t *cmd; + int status = CMD_ERR_BLANK; + int term; + + q_init(&cmdqueue); + + /* + * Find all the individual commands + */ + + while ((cmd = cmd_readcommand(head))) { + + if (cmd == NULL) { + return CMD_ERR_BLANK; + } + + q_enqueue(&cmdqueue,(queue_t *) cmd); + } + + /* + * Do each command + */ + + while ((cmd = (ui_command_t *) q_deqnext(&(cmdqueue)))) { + status = ui_do_one_command(&(cmd->head)); + term = cmd->term; + KFREE(cmd); + if (status == CMD_ERR_BLANK) continue; + + /* + * And causes us to stop at the first failure. + */ + if ((term == CMD_TERM_AND) && (status != 0)) break; + + /* + * OR causes us to stop at the first success. + */ + + if ((term == CMD_TERM_OR) && (status == 0)) break; + + /* + * Neither AND nor OR causes us to keep chugging away. + */ + } + + /* + * Free any remaining tokens and commands that we did not do + */ + + while ((cmd = (ui_command_t *) q_deqnext(&(cmdqueue)))) { + cmd_free_tokens(&(cmd->head)); + KFREE(cmd); + } + + return status; +} + + +int ui_docommands(char *str) +{ + queue_t cmd_list; + int res; + + /* Convert the command into a token list */ + cmd_build_list(&cmd_list,str); + + /* Walk the list and expand environment variables */ + cmd_walk_and_expand(&cmd_list); + + /* Process each command. This removes tokens from the list */ + res = ui_docommands_internal(&cmd_list); + + /* Free any leftover tokens. There should not be any. */ + cmd_free_tokens(&cmd_list); + + return res; +} diff --git a/cfe/cfe/ui/ui_command.c b/cfe/cfe/ui/ui_command.c new file mode 100644 index 0000000..79d770f --- /dev/null +++ b/cfe/cfe/ui/ui_command.c @@ -0,0 +1,990 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * UI Command Dispatch File: ui_command.c + * + * This module contains routines to maintain the command table, + * parse and execute commands + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include + +#include "lib_queue.h" + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_error.h" +#include "env_subr.h" +#include "cfe.h" + +#include "ui_command.h" + +#define MAX_EXPAND 16 + +typedef struct cmdtab_s { + struct cmdtab_s *sibling; + struct cmdtab_s *child; + char *cmdword; + int (*func)(ui_cmdline_t *,int argc,char *argv[]); + void *ref; + char *help; + char *usage; + char *switches; +} cmdtab_t; + +cmdtab_t *cmd_root; + +static void cmd_rejoin_quotes(queue_t *qb); + +#define myisalpha(x) (((x)>='A')&&((x)<='Z')&&((x)>='a')&&((x)<='z')) +#define myisdigit(x) (((x)>='0')&&((x)<='9')) + +char *varchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789_?"; + +static char *tokenbreaks = " =\t\n\'\"&|;"; +static char *spacechars = " \t"; + + + +static inline int is_white_space(ui_token_t *t) +{ + return (strchr(spacechars,t->token) != NULL); +} + +int cmd_sw_value(ui_cmdline_t *cmd,char *swname,char **swvalue) +{ + int idx; + + for (idx = 0; idx < cmd->swc; idx++) { + if (strcmp(swname,cmd->swv[idx].swname) == 0) { + *swvalue = cmd->swv[idx].swvalue; + return 1; + } + } + + return 0; +} + +int cmd_sw_posn(ui_cmdline_t *cmd,char *swname) +{ + int idx; + + for (idx = 0; idx < cmd->swc; idx++) { + if (strcmp(swname,cmd->swv[idx].swname) == 0) { + return cmd->swv[idx].swidx; + } + } + + return -1; +} + +char *cmd_sw_name(ui_cmdline_t *cmd,int swidx) +{ + if ((swidx < 0) || (swidx >= cmd->swc)) return NULL; + + return cmd->swv[swidx].swname; +} + + +int cmd_sw_isset(ui_cmdline_t *cmd,char *swname) +{ + int idx; + + for (idx = 0; idx < cmd->swc; idx++) { + if (strcmp(swname,cmd->swv[idx].swname) == 0) { + return 1; + } + } + + return 0; +} + +char *cmd_getarg(ui_cmdline_t *cmd,int argnum) +{ + argnum += cmd->argidx; + if ((argnum < 0) || (argnum >= cmd->argc)) return NULL; + return cmd->argv[argnum]; +} + +void cmd_free(ui_cmdline_t *cmd) +{ + int idx; + + for (idx = 0; idx < cmd->argc; idx++) { + KFREE(cmd->argv[idx]); + } + + for (idx = 0; idx < cmd->swc; idx++) { + KFREE(cmd->swv[idx].swname); + } + + cmd->argc = 0; + cmd->swc = 0; +} + +int cmd_sw_validate(ui_cmdline_t *cmd,char *validstr) +{ + char *vdup; + char *vptr; + char *vnext; + char atype; + char *x; + int idx; + int valid; + + if (cmd->swc == 0) return -1; + + vdup = strdup(validstr); + + for (idx = 0; idx < cmd->swc; idx++) { + vptr = vdup; + + vnext = vptr; + valid = 0; + + while (vnext) { + + /* + * Eat the next switch description from the valid string + */ + x = strchr(vptr,'|'); + if (x) { + *x = '\0'; + vnext = x+1; + } + else { + vnext = NULL; + } + + /* + * Get the expected arg type, if any + */ + x = strchr(vptr,'='); + if (x) { + atype = *(x+1); + *x = 0; + } + else { + if ((x = strchr(vptr,';'))) *x = 0; + atype = 0; + } + + /* + * See if this matches what the user typed + * XXX for now, ignore the arg type processing but + * complain if an arg is missing. + */ + + if (strcmp(vptr,cmd->swv[idx].swname) == 0) { + /* Value not needed and not supplied */ + if ((atype == 0) && (cmd->swv[idx].swvalue == NULL)) { + valid = 1; + } + /* value needed and supplied */ + if ((atype != 0) && (cmd->swv[idx].swvalue != NULL)) { + valid = 1; + } + strcpy(vdup,validstr); + break; + } + + /* + * Otherwise, next! + */ + + strcpy(vdup,validstr); + vptr = vnext; + } + + /* + * If not valid, return index of bad switch + */ + + if (valid == 0) { + KFREE(vdup); + return idx; + } + + } + + /* + * Return -1 if everything went well. A little strange, + * but it's easier this way. + */ + + KFREE(vdup); + return -1; +} + +static cmdtab_t *cmd_findword(cmdtab_t *list,char *cmdword) +{ + while (list) { + if (strcmp(cmdword,list->cmdword) == 0) return list; + list = list->sibling; + } + + return NULL; +} + + +void cmd_build_cmdline(queue_t *head, ui_cmdline_t *cmd) +{ + ui_token_t *t; + ui_token_t *next; + + memset(cmd, 0, sizeof(ui_cmdline_t)); + + t = (ui_token_t *) q_deqnext(head); + + while (t != NULL) { + if (is_white_space(t)) { + /* do nothing */ + } + else if (t->token != '-') { + if(cmd->argc < MAX_TOKENS){ + cmd->argv[cmd->argc] = lib_strdup(&(t->token)); + cmd->argc++; + } + /* Token is a switch */ + } + else { + if (cmd->swc < MAX_SWITCHES) { + cmd->swv[cmd->swc].swname = lib_strdup(&(t->token)); + + if (t->qb.q_next != head) { /* more tokens */ + next = (ui_token_t *) t->qb.q_next; + if (next->token == '=') { /* switch has value */ + KFREE(t); /* Free switch name */ + t = (ui_token_t *) q_deqnext(head); /* eat equal sign */ + KFREE(t); /* and free it */ + t = (ui_token_t *) q_deqnext(head); /* now have value */ + if (t != NULL) { + cmd->swv[cmd->swc].swvalue = lib_strdup(&(t->token)); + } + } + else { /* no value */ + cmd->swv[cmd->swc].swvalue = NULL; + } + } + /* + * swidx is the index of the argument that this + * switch precedes. So, if you have "foo -d bar", + * swidx for "-d" would be 1. + */ + cmd->swv[cmd->swc].swidx = cmd->argc; + cmd->swc++; + } + } + KFREE(t); + t = (ui_token_t *) q_deqnext(head); + } + +} + +int cmd_addcmd(char *command, + int (*func)(ui_cmdline_t *,int argc,char *argv[]), + void *ref, + char *help, + char *usage, + char *switches) +{ + cmdtab_t **list = &cmd_root; + cmdtab_t *cmd = NULL; + queue_t tokens; + queue_t *cur; + ui_token_t *t; + + cmd_build_list(&tokens,command); + cur = tokens.q_next; + + while (cur != &tokens) { + t = (ui_token_t *) cur; + if (!is_white_space(t)) { + cmd = cmd_findword(*list,&(t->token)); + if (!cmd) { + cmd = KMALLOC(sizeof(cmdtab_t)+strlen(&(t->token))+1,0); + memset(cmd,0,sizeof(cmdtab_t)); + cmd->cmdword = (char *) (cmd+1); + strcpy(cmd->cmdword,&(t->token)); + cmd->sibling = *list; + *list = cmd; + } + list = &(cmd->child); + } + cur = cur->q_next; + } + + cmd_free_tokens(&tokens); + + if (!cmd) return -1; + + cmd->func = func; + cmd->usage = usage; + cmd->ref = ref; + cmd->help = help; + cmd->switches = switches; + + return 0; +} + + + +static void _dumpindented(char *str,int amt) +{ + int idx; + char *dupstr; + char *end; + char *ptr; + + dupstr = strdup(str); + + ptr = dupstr; + + while (*ptr) { + for (idx = 0; idx < amt; idx++) printf(" "); + + end = strchr(ptr,'\n'); + + if (end) *end++ = '\0'; + else end = ptr + strlen(ptr); + + printf("%s\n",ptr); + ptr = end; + } + + KFREE(dupstr); +} + +static void _dumpswitches(char *str) +{ + char *switches; + char *end; + char *ptr; + char *semi; + char *newline; + + switches = strdup(str); + + ptr = switches; + + while (*ptr) { + end = strchr(ptr,'|'); + if (end) *end++ = '\0'; + else end = ptr + strlen(ptr); + + printf(" "); + if ((semi = strchr(ptr,';'))) { + *semi++ = '\0'; + newline = strchr(semi,'\n'); + if (newline) *newline++ = '\0'; + printf("%-12s %s\n",ptr,semi); + if (newline) _dumpindented(newline,5+12+1); + } + else { + printf("%-12s (no information)\n",ptr); + } + ptr = end; + } + + KFREE(switches); +} + +static void _dumpcmds(cmdtab_t *cmd,int level,char **words,int verbose) +{ + int idx; + int len; + + while (cmd) { + len = 0; + words[level] = cmd->cmdword; + if (cmd->func) { + for (idx = 0; idx < level; idx++) { + printf("%s ",words[idx]); + len += strlen(words[idx])+1; + } + printf("%s",cmd->cmdword); + len += strlen(cmd->cmdword); + for (idx = len; idx < 20; idx++) printf(" "); + printf("%s\n",cmd->help); + if (verbose) { + printf("\n"); + _dumpindented(cmd->usage,5); + printf("\n"); + _dumpswitches(cmd->switches); + printf("\n"); + } + } + _dumpcmds(cmd->child,level+1,words,verbose); + cmd = cmd->sibling; + } +} + +static void dumpcmds(int verbose) +{ + char *words[20]; + + _dumpcmds(cmd_root,0,words,verbose); +} + + +static void _showpossible(ui_cmdline_t *cline,cmdtab_t *cmd) +{ + int i; + + if (cline->argidx == 0) { + printf("Available commands: "); + } + else { + printf("Available \""); + for (i = 0; i < cline->argidx; i++) { + printf("%s%s",(i == 0) ? "" : " ",cline->argv[i]); + } + printf("\" commands: "); + } + + while (cmd) { + printf("%s",cmd->cmdword); + if (cmd->sibling) printf(", "); + cmd = cmd->sibling; + } + + printf("\n"); +} + +static int cmd_help(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + cmdtab_t **tab; + cmdtab_t *cword; + int idx; + + if (argc == 0) { + printf("Available commands:\n\n"); + dumpcmds(0); + printf("\n"); + printf("For more information about a command, enter 'help command-name'\n"); + } + else { + idx = 0; + tab = &cmd_root; + cword = NULL; + + for (;;) { + cword = cmd_findword(*tab,argv[idx]); + if (!cword) break; + if (cword->func != NULL) break; + idx++; + tab = &(cword->child); + if (idx >= argc) break; + } + + if (cword == NULL) { + printf("No help available for '%s'.\n\n",argv[idx]); + printf("Type 'help' for a list of commands.\n"); + return -1; + } + + if (!cword->func && (idx >= argc)) { + printf("No help available for '%s'.\n\n",cword->cmdword); + printf("Type 'help' for a list of commands.\n"); + return -1; + } + + printf("\n SUMMARY\n\n"); + _dumpindented(cword->help,5); + printf("\n USAGE\n\n"); + _dumpindented(cword->usage,5); + if (cword->switches && cword->switches[0]) { + printf("\n OPTIONS\n\n"); + _dumpswitches(cword->switches); + } + printf("\n"); + } + + return 0; +} + +void cmd_init(void) +{ + cmd_root = NULL; + + cmd_addcmd("help", + cmd_help, + NULL, + "Obtain help for CFE commands", + "help [command]\n\n" + "Without any parameters, the 'help' command will display a summary\n" + "of available commands. For more details on a command, type 'help'\n" + "and the command name.", + ""); +} + + +int cmd_lookup(queue_t *head,ui_cmdline_t *cmd) +{ + cmdtab_t **tab; + cmdtab_t *cword; + int idx; + + /* + * Reset the command line + */ + + memset(cmd,0,sizeof(ui_cmdline_t)); + + /* + * Break it up into tokens + */ + + cmd_build_cmdline(head, cmd); + + if (cmd->argc == 0) return CMD_ERR_BLANK; + + /* + * Start walking the tree looking for a function + * to execute. + */ + + idx = 0; + tab = &cmd_root; + cword = NULL; + + for (;;) { + cword = cmd_findword(*tab,cmd->argv[idx]); + if (!cword) break; + if (cword->func != NULL) break; + idx++; + tab = &(cword->child); + if (idx >= cmd->argc) break; + } + + cmd->argidx = idx; + +/* XXX - Must fix this... the error needs to walk the tree! */ + + if (cword == NULL) { + printf("Invalid command: \"%s\"\n", cmd->argv[idx]); + _showpossible(cmd,*tab); + printf("\n"); + return CMD_ERR_INVALID; + } + + if (!cword->func && (idx >= cmd->argc)) { + printf("Incomplete command: \"%s\"\n",cmd->argv[idx]); + _showpossible(cmd,*tab); + printf("\n"); + return CMD_ERR_AMBIGUOUS; + } + + cmd->argidx++; + cmd->ref = cword->ref; + cmd->usage = cword->usage; + cmd->switches = cword->switches; + cmd->func = cword->func; + + return 0; +} + + +void cmd_showusage(ui_cmdline_t *cmd) +{ + printf("\n"); + _dumpindented(cmd->usage,5); + printf("\n"); + if (cmd->switches[0]) { + _dumpswitches(cmd->switches); + printf("\n"); + } +} + + +static void cmd_eat_leading_white(queue_t *head) +{ + ui_token_t *t; + + while (!q_isempty(head)) { + t = (ui_token_t *) q_getfirst(head); + if (is_white_space(t)) { + q_dequeue(&(t->qb)); + KFREE(t); + } + else break; + } +} + +ui_command_t *cmd_readcommand(queue_t *head) +{ + char *ptr; + int insquote = FALSE; + int indquote = FALSE; + ui_command_t *cmd; + int term = CMD_TERM_EOL; + ui_token_t *t; + + cmd_eat_leading_white(head); + + if (q_isempty(head)) return NULL; + + cmd = (ui_command_t *) KMALLOC(sizeof(ui_command_t),0); + q_init(&(cmd->head)); + + while ((t = (ui_token_t *) q_deqnext(head))) { + + ptr = &(t->token); + + if (!insquote && !indquote) { + if ((*ptr == ';') || (*ptr == '\n')) { + term = CMD_TERM_SEMI; + break; + } + if ((*ptr == '&') && (*(ptr+1) == '&')) { + term = CMD_TERM_AND; + break; + } + if ((*ptr == '|') && (*(ptr+1) == '|')) { + term = CMD_TERM_OR; + break; + } + } + + if (*ptr == '\'') { + insquote = !insquote; + } + + if (!insquote) { + if (*ptr == '"') { + indquote = !indquote; + } + } + + q_enqueue(&(cmd->head),&(t->qb)); + + } + + cmd->term = term; + + /* If we got out by finding a command separator, eat the separator */ + if (term != CMD_TERM_EOL) { + KFREE(t); + } + + /* Turn quoted strings back into tokens */ + + cmd_rejoin_quotes(&(cmd->head)); + + return cmd; +} + + + +static ui_token_t *make_token(char *str,int len) +{ + ui_token_t *t = (ui_token_t *) KMALLOC(sizeof(ui_token_t) + len,0); + + memcpy(&(t->token),str,len); + (&(t->token))[len] = 0; + + return t; +} + +void cmd_build_list(queue_t *qb,char *buf) +{ + char *cur = buf, *start = NULL, *fin = NULL; + ui_token_t *t; + + q_init(qb); + + start = cur; + while(*cur != '\0'){ + if (*cur == '&' && *(cur + 1) != '&') { + /* Do nothing if we have only one & */ + } + else if (*cur == '|' && *(cur + 1) != '|') { + /* Do nothing if we have only one | */ + } + else if (((*cur == ' ')||(*cur == '\t')) && + ((*(cur - 1) == ' ')||(*(cur - 1) == '\t'))) { + /* Make one big token for white space */ + } + else { + + if (strchr(tokenbreaks,*cur)) { + if (cur != buf) { + fin = cur; + t = make_token(start,fin-start); + q_enqueue(qb,&(t->qb)); + start = cur; /* Start new token */ + } + } + else { + /* If we are on a normal character but the last character was */ + /* a special char we need to start a new token */ + + if ((cur > buf) && strchr(tokenbreaks,*(cur-1))) { + fin = cur; + t = make_token(start,fin-start); + q_enqueue(qb,&(t->qb)); + start = cur; /* Start new token */ + } + else { + /* If the last charecter wasn't special keep going with */ + /* current token */ + } + + + } + + } + cur++; + } + + fin = cur; + + if (fin-start > 0) { + t = make_token(start,fin-start); + q_enqueue(qb,&(t->qb)); + } + + return; +} + +static int is_command_separator(ui_token_t *t) +{ + char *string = &(t->token); + int sep = 0; + + switch(*string){ + case ';': + sep = 1; + break; + case '&': + if(*(string + 1) == '&') + sep = 1; + break; + case '|': + if(*(string + 1) == '|') + sep = 1; + default: + break; + } + + return(sep); +} + +static void cmd_append_tokens(queue_t *qb,char *str) +{ + queue_t *qq; + queue_t explist; + + cmd_build_list(&explist,str); + + while ((qq = q_deqnext(&explist))) { + q_enqueue(qb,qq); + } +} + +static void cmd_squash_and_append(queue_t *list,queue_t *quotelist) +{ + int maxlen = 0; + queue_t *q; + ui_token_t *t; + ui_token_t *newtok; + char *dest; + + for (q = quotelist->q_next; q != quotelist; q = q->q_next) { + maxlen += strlen(&(((ui_token_t *) q)->token)); + } + + newtok = KMALLOC(sizeof(ui_token_t) + maxlen,0); + + dest = &(newtok->token); + + while ((t = (ui_token_t *) q_deqnext(quotelist))) { + strcpy(dest,&(t->token)); + dest += strlen(dest); + KFREE(t); + } + + q_enqueue(list,&(newtok->qb)); +} + + +static void cmd_rejoin_quotes(queue_t *qb) +{ + queue_t newq; + queue_t quotedq; + queue_t *q; + ui_token_t *t; + int insquote = FALSE; + int indquote = FALSE; + + q_init(&newq); + q_init("edq); + + while ((t = (ui_token_t *) q_deqnext(qb))) { + + switch (t->token) { + case '\'': + KFREE(t); /* eat the quotes */ + + insquote = !insquote; + + if (!insquote) { + cmd_squash_and_append(&newq,"edq); + } + break; + + case '"': /* eat the quotes */ + KFREE(t); + + if (insquote == FALSE) { + indquote = !indquote; + if (!indquote) { + cmd_squash_and_append(&newq,"edq); + } + } + break; + + default: + if (insquote || indquote) { + q_enqueue("edq,&(t->qb)); + } + else { + q_enqueue(&newq,&(t->qb)); + } + + } + } + + /* + * If a dangling quoted string, just tack it on the list. + */ + + if (!q_isempty("edq)) { + cmd_squash_and_append(&newq,"edq); + } + + /* + * Put everything back on the original list. + */ + + while ((q = q_deqnext(&newq))) { + q_enqueue(qb,q); + } + + +} + +void cmd_walk_and_expand (queue_t *qb) +{ + queue_t *q; + queue_t newq; + ui_token_t *t; + int alias_check = TRUE; + int insquote = FALSE; + char *envstr; + + q_init(&newq); + + while ((t = (ui_token_t *) q_deqnext(qb))) { + if (t->token == '\'') { + alias_check = FALSE; + insquote = !insquote; + /* Check to see if we should try to expand this token */ + } + else if (!insquote) { + if (alias_check && !strchr(tokenbreaks,t->token) && + (envstr = env_getenv(&(t->token)))) { + /* Aliases: stick into token stream if no environment found */ + cmd_append_tokens(&newq,envstr); + KFREE(t); + t = NULL; + } + else if (t->token == '$') { + /* non-aliases: remove from token stream if no env found */ + envstr = env_getenv(&(t->token)+1); + if (envstr) cmd_append_tokens(&newq,envstr); + KFREE(t); + t = NULL; + } + else { + /* Drop down below, keep this token as-is and append */ + } + } + + /* + * If token was not removed, add it to the new queue + */ + + if (t) { + q_enqueue(&newq,&(t->qb)); + alias_check = is_command_separator(t); + } + + } + + /* + * Put everything back on the original list. + */ + + while ((q = q_deqnext(&newq))) { + q_enqueue(qb,q); + } + +} + +void cmd_free_tokens(queue_t *list) +{ + queue_t *q; + + while ((q = q_deqnext(list))) { + KFREE(q); + } +} + diff --git a/cfe/cfe/ui/ui_devcmds.c b/cfe/cfe/ui/ui_devcmds.c new file mode 100644 index 0000000..72ea7bb --- /dev/null +++ b/cfe/cfe/ui/ui_devcmds.c @@ -0,0 +1,101 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Device Commands File: ui_devcmds.c + * + * User interface for the device manager + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "env_subr.h" +#include "ui_command.h" +#include "cfe.h" + + +extern queue_t cfe_devices; + +int ui_init_devcmds(void); + +static int ui_cmd_devnames(ui_cmdline_t *cmd,int argc,char *argv[]); + + +int ui_cmd_devnames(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + queue_t *qb; + cfe_device_t *dev; + + xprintf("Device Name Description\n"); + xprintf("------------------- ---------------------------------------------------------\n"); + + for (qb = cfe_devices.q_next; qb != &cfe_devices; qb = qb->q_next) { + dev = (cfe_device_t *) qb; + + xprintf("%19s %s\n",dev->dev_fullname, + dev->dev_description); + + } + + return 0; +} + + +int ui_init_devcmds(void) +{ + cmd_addcmd("show devices", + ui_cmd_devnames, + NULL, + "Display information about the installed devices.", + "show devices\n\n" + "This command displays the names and descriptions of the devices\n" + "CFE is configured to support.", + ""); + + return 0; +} diff --git a/cfe/cfe/ui/ui_envcmds.c b/cfe/cfe/ui/ui_envcmds.c new file mode 100644 index 0000000..9d69f36 --- /dev/null +++ b/cfe/cfe/ui/ui_envcmds.c @@ -0,0 +1,190 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Environment commands File: ui_envcmds.c + * + * User interface for environment variables + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "env_subr.h" +#include "ui_command.h" +#include "cfe.h" + + +int ui_init_envcmds(void); +static int ui_cmd_setenv(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_printenv(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_unsetenv(ui_cmdline_t *cmd,int argc,char *argv[]); + + + +static int ui_cmd_printenv(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char varname[80]; + char value[256]; + int varlen,vallen; + int idx; + + xprintf("Variable Name Value\n"); + xprintf("-------------------- --------------------------------------------------\n"); + + idx = 0; + for (;;) { + varlen = sizeof(varname); + vallen = sizeof(value); + if (env_enum(idx,varname,&varlen,value,&vallen) < 0) break; + xprintf("%20s %s\n",varname,value); + idx++; + } + + return 0; + +} + +static int ui_cmd_setenv(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *varname; + char *value; + int roflag = ENV_FLG_NORMAL; + int res; + + varname = cmd_getarg(cmd,0); + + if (!varname) { + return ui_showusage(cmd); + } + + value = cmd_getarg(cmd,1); + if (!value) { + return ui_showusage(cmd); + } + + if (!cmd_sw_isset(cmd,"-p")) { + roflag = ENV_FLG_BUILTIN; /* just in memory, not NVRAM */ + } + + if (cmd_sw_isset(cmd,"-ro")) { + roflag = ENV_FLG_READONLY; + } + + if ((res = env_setenv(varname,value,roflag)) == 0) { + if (roflag != ENV_FLG_BUILTIN) env_save(); + } + else { + return ui_showerror(res,"Could not set environment variable '%s'", + varname); + } + + return 0; +} + + +static int ui_cmd_unsetenv(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *varname; + int res; + int type; + + varname = cmd_getarg(cmd,0); + + if (!varname) { + return ui_showusage(cmd); + } + + type = env_envtype(varname); + + if ((res = env_delenv(varname)) == 0) { + if ((type >= 0) && (type != ENV_FLG_BUILTIN)) env_save(); + } + else { + return ui_showerror(res,"Could not delete environment variable '%s'", + varname); + } + + return 0; +} + + + +int ui_init_envcmds(void) +{ + + cmd_addcmd("setenv", + ui_cmd_setenv, + NULL, + "Set an environment variable.", + "setenv [-ro] [-p] varname value\n\n" + "This command sets an environment variable. By default, an environment variable\n" + "is stored only in memory and will not be retained across system restart.", + "-p;Store environment variable permanently in the NVRAM device, if present|" + "-ro;Causes variable to be read-only\n" + "(cannot be changed in the future, implies -p)"); + + cmd_addcmd("printenv", + ui_cmd_printenv, + NULL, + "Display the environment variables", + "printenv\n\n" + "This command prints a table of the environment variables and their\n" + "current values.", + ""); + + cmd_addcmd("unsetenv", + ui_cmd_unsetenv, + NULL, + "Delete an environment variable.", + "unsetenv varname\n\n" + "This command deletes an environment variable from memory and also \n" + "removes it from the NVRAM device (if present).", + ""); + + return 0; +} diff --git a/cfe/cfe/ui/ui_examcmds.c b/cfe/cfe/ui/ui_examcmds.c new file mode 100644 index 0000000..91edeee --- /dev/null +++ b/cfe/cfe/ui/ui_examcmds.c @@ -0,0 +1,713 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Memory dump commands File: ui_examcmds.c + * + * UI functions for examining data in various ways + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_error.h" +#include "cfe_console.h" + +#include "ui_command.h" +#include "cfe.h" +#include "disasm.h" + +#include "addrspace.h" +#include "exchandler.h" + + +static int ui_cmd_memdump(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_memedit(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_memfill(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_disasm(ui_cmdline_t *cmd,int argc,char *argv[]); + +#ifdef __long64 +#define XTOI(x) xtoq(x) +#else +#define XTOI(x) xtoi(x) +#endif + +int ui_init_examcmds(void); + + +#define ATYPE_SIZE_NONE 0 +#define ATYPE_SIZE_BYTE 1 +#define ATYPE_SIZE_HALF 2 +#define ATYPE_SIZE_WORD 4 +#define ATYPE_SIZE_QUAD 8 +#define ATYPE_SIZE_MASK 0x0F + +#define ATYPE_TYPE_NONE 0 +#define ATYPE_TYPE_PHYS 0x10 +#define ATYPE_TYPE_KERN 0x20 +#define ATYPE_TYPE_MASK 0xF0 + +static long prev_addr = 0; /* initialized below in ui_init_examcmds */ +static int prev_length = 256; +static int prev_dlength = 16; +static int prev_wtype = ATYPE_SIZE_WORD | ATYPE_TYPE_KERN; + +static int getaddrargs(ui_cmdline_t *cmd,int *curtype,long *addr,int *length) +{ + int atype = *curtype; + long newaddr; + int newlen; + char *x; + long wlen; + + if (cmd_sw_isset(cmd,"-b")) { + atype &= ~ATYPE_SIZE_MASK; + atype |= ATYPE_SIZE_BYTE; + } + else if (cmd_sw_isset(cmd,"-h")) { + atype &= ~ATYPE_SIZE_MASK; + atype |= ATYPE_SIZE_HALF; + } + else if (cmd_sw_isset(cmd,"-w")) { + atype &= ~ATYPE_SIZE_MASK; + atype |= ATYPE_SIZE_WORD; + } + else if (cmd_sw_isset(cmd,"-q")) { + atype &= ~ATYPE_SIZE_MASK; + atype |= ATYPE_SIZE_QUAD; + } + + wlen = atype & ATYPE_SIZE_MASK; + if (wlen == 0) wlen = 1; /* bytes are the default */ + + if (cmd_sw_isset(cmd,"-p")) { + atype &= ~ATYPE_TYPE_MASK; + atype |= ATYPE_TYPE_PHYS; + } + else if (cmd_sw_isset(cmd,"-v")) { + atype &= ~ATYPE_TYPE_MASK; + atype |= ATYPE_TYPE_KERN; + } + + *curtype = atype; + + if (addr) { + x = cmd_getarg(cmd,0); + if (x) { + if (strcmp(x,".") == 0) newaddr = *addr; + else { + /* + * hold on to your lunch, this is really, really bad! + * Make 64-bit addresses expressed as 8-digit numbers + * sign extend automagically. Saves typing, but is very + * gross. + */ + int longaddr = 0; + longaddr = strlen(x); + if (memcmp(x,"0x",2) == 0) longaddr -= 2; + longaddr = (longaddr > 8) ? 1 : 0; + + if (longaddr) newaddr = (long) xtoq(x); + else newaddr = (long) xtoi(x); + } + *addr = newaddr & ~(wlen - 1); /* align to natural boundary */ + } + } + + if (length) { + x = cmd_getarg(cmd,1); + if (x) { + newlen = (long) xtoi(x); + *length = newlen; + } + } + + return 0; + +} + +static int stuffmem(long addr,int wlen,char *tail) +{ + char *tok; + int count = 0; + uint8_t b; + uint16_t h; + uint32_t w; + uint64_t q; + int res = 0; + + addr &= ~(wlen-1); + + while ((tok = gettoken(&tail))) { + switch (wlen) { + default: + case 1: + b = (uint8_t) xtoq(tok); + if ((res = mem_poke(addr, b, MEM_BYTE))) { + /*Did not edit*/ + return res; + } + break; + case 2: + h = (uint16_t) xtoq(tok); + if ((res = mem_poke(addr, h, MEM_HALFWORD))) { + /*Did not edit*/ + return res; + } + break; + case 4: + w = (uint32_t) xtoq(tok); + if ((res = mem_poke(addr, w, MEM_WORD))) { + /*Did not edit*/ + return res; + } + break; + case 8: + q = (uint64_t) xtoq(tok); + if ((res = mem_poke(addr, q, MEM_QUADWORD))) { + /*Did not edit*/ + return res; + } + break; + } + + addr += wlen; + count++; + } + + return count; +} + +static int dumpmem(long addr,long dispaddr,int length,int wlen) +{ + int idx,x; + uint8_t b; + uint16_t h; + uint32_t w; + uint64_t q; + int res = 0; + + /* + * The reason we save the line in this union is to provide the + * property that the dump command will only touch the + * memory once. This might be useful when looking at + * device registers. + */ + + union { + uint8_t bytes[16]; + uint16_t halves[8]; + uint32_t words[4]; + uint64_t quads[2]; + } line; + + addr &= ~(wlen-1); + + for (idx = 0; idx < length; idx += 16) { + xprintf("%P%c ",dispaddr+idx,(dispaddr != addr) ? '%' : ':'); + switch (wlen) { + default: + case 1: + for (x = 0; x < 16; x++) { + if (idx+x < length) { + if ((res = mem_peek(&b, (addr+idx+x), MEM_BYTE))) { + return res; + } + line.bytes[x] = b; + xprintf("%02X ",b); + } + else { + xprintf(" "); + } + } + break; + case 2: + for (x = 0; x < 16; x+=2) { + if (idx+x < length) { + if ((res = mem_peek(&h, (addr+idx+x), MEM_HALFWORD))) { + return res; + } + line.halves[x/2] = h; + xprintf("%04X ",h); + } + else { + xprintf(" "); + } + } + break; + case 4: + for (x = 0; x < 16; x+=4) { + if (idx+x < length) { + + if ((res = mem_peek(&w , (addr+idx+x), MEM_WORD))) { + return res; + } + line.words[x/4] = w; + xprintf("%08X ",w); + } + else { + xprintf(" "); + } + } + break; + case 8: + for (x = 0; x < 16; x+=8) { + if (idx+x < length) { + if ((res = mem_peek(&q, (addr+idx+x), MEM_QUADWORD))) { + return res; + } + line.quads[x/8] = q; + xprintf("%016llX ",q); + } + else { + xprintf(" "); + } + } + break; + } + + xprintf(" "); + for (x = 0; x < 16; x++) { + if (idx+x < length) { + b = line.bytes[x]; + if ((b < 32) || (b > 127)) xprintf("."); + else xprintf("%c",b); + } + else { + xprintf(" "); + } + } + xprintf("\n"); + } + + return 0; +} + +static int ui_cmd_memedit(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + uint8_t b; + uint16_t h; + uint32_t w; + uint64_t q; + + long addr; + char *vtext; + int wlen; + int count; + int idx = 1; + int stuffed = 0; + int res = 0; + + getaddrargs(cmd,&prev_wtype,&prev_addr,NULL); + + wlen = prev_wtype & ATYPE_SIZE_MASK; + + vtext = cmd_getarg(cmd,idx++); + + addr = prev_addr; + + while (vtext) { + count = stuffmem(addr,wlen,vtext); + if (count < 0) { + ui_showerror(count,"Could not modify memory"); + return count; /* error */ + } + addr += count*wlen; + prev_addr += count*wlen; + stuffed += count; + vtext = cmd_getarg(cmd,idx++); + } + + if (stuffed == 0) { + char line[256]; + char prompt[32]; + + xprintf("Type '.' to exit, '-' to back up, '=' to dump memory.\n"); + for (;;) { + + addr = prev_addr; + if ((prev_wtype & ATYPE_TYPE_MASK) == ATYPE_TYPE_PHYS) { + addr = UNCADDR(addr); + } + + xprintf("%P%c ",prev_addr,(addr != prev_addr) ? '%' : ':'); + + switch (wlen) { + default: + case 1: + if ((res = mem_peek(&b, addr, MEM_BYTE))) { + return res; + } + xsprintf(prompt,"[%02X]: ", b); + break; + case 2: + if ((res = mem_peek(&h, addr, MEM_HALFWORD))) { + return res; + } + xsprintf(prompt,"[%04X]: ",h); + break; + case 4: + if ((res = mem_peek(&w, addr, MEM_WORD))) { + return res; + } + xsprintf(prompt,"[%08X]: ",w); + break; + case 8: + if ((res = mem_peek(&q, addr, MEM_QUADWORD))) { + return res; + } + xsprintf(prompt,"[%016llX]: ",q); + break; + } + + console_readline(prompt,line,sizeof(line)); + if (line[0] == '-') { + prev_addr -= wlen; + continue; + } + if (line[0] == '=') { + dumpmem(prev_addr,prev_addr,16,wlen); + continue; + } + if (line[0] == '.') { + break; + } + if (line[0] == '\0') { + prev_addr += wlen; + continue; + } + count = stuffmem(addr,wlen,line); + if (count < 0) return count; + if (count == 0) break; + prev_addr += count*wlen; + } + } + + return 0; +} + +static int ui_cmd_memfill(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + long addr; + char *atext; + int wlen; + int idx = 2; + int len; + uint64_t pattern; + uint8_t *b_ptr; + uint16_t *h_ptr; + uint32_t *w_ptr; + uint64_t *q_ptr; + int res; + + getaddrargs(cmd,&prev_wtype,&prev_addr,&len); + + atext = cmd_getarg(cmd,idx++); + if (!atext) return ui_showusage(cmd); + pattern = xtoq(atext); + + addr = prev_addr; + + if ((prev_wtype & ATYPE_TYPE_MASK) == ATYPE_TYPE_PHYS) { + addr = UNCADDR(addr); + } + + wlen = prev_wtype & ATYPE_SIZE_MASK; + + switch (wlen) { + case 1: + b_ptr = (uint8_t *) addr; + while (len > 0) { + if ((res = mem_poke( ((long)(b_ptr)), pattern, MEM_BYTE))) { + /*Did not edit*/ + return 0; + } + b_ptr++; + len--; + } + break; + case 2: + h_ptr = (uint16_t *) addr; + while (len > 0) { + if ((res = mem_poke( ((long)(h_ptr)), pattern, MEM_HALFWORD))) { + return 0; + } + h_ptr++; + len--; + } + break; + case 4: + w_ptr = (uint32_t *) addr; + while (len > 0) { + if ((res = mem_poke( ((long)(w_ptr)), pattern, MEM_WORD))) { + return -1; + } + w_ptr++; + len--; + } + break; + case 8: + q_ptr = (uint64_t *) addr; + while (len > 0) { + if ((res = mem_poke( ((long)(q_ptr)), pattern, MEM_QUADWORD))) { + return 0; + } + q_ptr++; + len--; + } + break; + } + + return 0; +} + + +#define FILL(ptr,len,pattern) printf("Pattern: %016llX\n",pattern); \ + for (idx = 0; idx < len; idx++) ptr[idx] = pattern +#define CHECK(ptr,len,pattern) for (idx = 0; idx < len; idx++) { \ + if (ptr[idx]!=pattern) {printf("Mismatch at %016llX: Expected %016llX got %016llX", \ + (uint64_t) (uintptr_t) &(ptr[idx]),pattern,ptr[idx]); \ + error = 1; loopmode = 0;break;} \ + } + +#define MEMTEST(ptr,len,pattern) if (!error) { FILL(ptr,len,pattern) ; CHECK(ptr,len,pattern); } + +static int ui_cmd_memtest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + long addr = 0; + int len = 0; + int wtype = 0; + int wlen; + int idx = 0; + uint64_t *ptr; + int error = 0; + int loopmode = 0; + int pass =0; + + getaddrargs(cmd,&wtype,&addr,&len); + + wlen = 8; + addr &= ~(wlen-1); + + if ((prev_wtype & ATYPE_TYPE_MASK) == ATYPE_TYPE_PHYS) { + addr = UNCADDR(addr); + } + + if (cmd_sw_isset(cmd,"-loop")) { + loopmode = 1; + } + + len /= wlen; + + ptr = (uint64_t *) addr; + pass = 0; + for (;;) { + if (loopmode) { + printf("Pass %d\n",pass); + if (console_status()) break; + } + MEMTEST(ptr,len,(idx*8)); + MEMTEST(ptr,len, 0); + MEMTEST(ptr,len,0xFFFFFFFFFFFFFFFF); + MEMTEST(ptr,len,0x5555555555555555); + MEMTEST(ptr,len,0xAAAAAAAAAAAAAAAA); + MEMTEST(ptr,len,0xFF00FF00FF00FF00); + MEMTEST(ptr,len,0x00FF00FF00FF00FF); + if (!loopmode) break; + pass++; + } + + return 0; +} + +static int ui_cmd_memdump(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + long addr; + int res; + + getaddrargs(cmd,&prev_wtype,&prev_addr,&prev_length); + + addr = prev_addr; + if ((prev_wtype & ATYPE_TYPE_MASK) == ATYPE_TYPE_PHYS) { + addr = UNCADDR(addr); + } + + res = dumpmem(addr, + prev_addr, + prev_length, + prev_wtype & ATYPE_SIZE_MASK); + + if (res < 0) { + ui_showerror(res,"Could not display memory"); + } + else { + prev_addr += prev_length; + } + + return res; +} + +static int ui_cmd_disasm(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + long addr; + char buf[512]; + int idx; + uint32_t inst; + int res; + + getaddrargs(cmd,&prev_wtype,&prev_addr,&prev_dlength); + + prev_addr &= ~3; + + addr = prev_addr; + if ((prev_wtype & ATYPE_TYPE_MASK) == ATYPE_TYPE_PHYS) { + addr = UNCADDR(addr); + } + + for (idx = 0; idx < prev_dlength; idx++) { + if ((res = mem_peek(&inst, addr, MEM_WORD))) { + ui_showerror(res,"Could not disassemble memory"); + return res; + } + disasm_inst(buf,sizeof(buf),inst,(uint64_t) prev_addr); + xprintf("%P%c %08x %s\n",prev_addr,(addr != prev_addr) ? '%' : ':',inst,buf); + addr += 4; + prev_addr += 4; + } + + return 0; +} + +int ui_init_examcmds(void) +{ + cmd_addcmd("u", + ui_cmd_disasm, + NULL, + "Disassemble instructions.", + "u [addr [length]]\n\n" + "This command disassembles instructions at the specified address.\n" + "CFE will display standard register names and symbolic names for\n" + "certain CP0 registers. The 'u' command remembers the last address\n" + "that was disassembled so you can enter 'u' again with no parameters\n" + "to continue a previous request.\n", + "-p;Address is an uncached physical address|" + "-v;Address is a kernel virtual address"); + + + cmd_addcmd("d", + ui_cmd_memdump, + NULL, + "Dump memory.", + "d [-b|-h|-w|-q] [addr [length]]\n\n" + "This command displays data from memory as bytes, halfwords, words,\n" + "or quadwords. ASCII text, if present, will appear to the right of\n" + "the hex data. The dump command remembers the previous word size,\n" + "dump length and last displayed address, so you can enter 'd' again\n" + "to continue a previous dump request.", + "-b;Dump memory as bytes|" + "-h;Dump memory as halfwords (16-bits)|" + "-w;Dump memory as words (32-bits)|" + "-q;Dump memory as quadwords (64-bits)|" + "-p;Address is an uncached physical address|" + "-v;Address is a kernel virtual address"); + + + cmd_addcmd("e", + ui_cmd_memedit, + NULL, + "Modify contents of memory.", + "e [-b|-h|-w|-q] [addr [data...]]\n\n" + "This command modifies the contents of memory. If you do not specify\n" + "data on the command line, CFE will prompt for it. When prompting for\n" + "data you may enter '-' to back up, '=' to dump memory at the current\n" + "location, or '.' to exit edit mode.", + "-b;Edit memory as bytes|" + "-h;Edit memory as halfwords (16-bits)|" + "-w;Edit memory as words (32-bits)|" + "-q;Edit memory as quadwords (64-bits)|" + "-p;Address is an uncached physical address|" + "-v;Address is a kernel virtual address"); + + cmd_addcmd("f", + ui_cmd_memfill, + NULL, + "Fill contents of memory.", + "f [-b|-h|-w|-q] addr length pattern\n\n" + "This command modifies the contents of memory. You can specify the\n" + "starting address, length, and pattern of data to fill (in hex)\n", + "-b;Edit memory as bytes|" + "-h;Edit memory as halfwords (16-bits)|" + "-w;Edit memory as words (32-bits)|" + "-q;Edit memory as quadwords (64-bits)|" + "-p;Address is an uncached physical address|" + "-v;Address is a kernel virtual address"); + + cmd_addcmd("memtest", + ui_cmd_memtest, + NULL, + "Test memory.", + "memtest [options] addr length\n\n" + "This command tests memory. It is a very crude test, so don't\n" + "rely on it for anything really important. Addr and length are in hex\n", + "-p;Address is an uncached physical address|" + "-v;Address is a kernel virtual address|" + "-loop;Loop till keypress"); + + + prev_addr = KERNADDR(0); + + return 0; +} + + + + + + + + + + + diff --git a/cfe/cfe/ui/ui_flash.c b/cfe/cfe/ui/ui_flash.c new file mode 100644 index 0000000..d3ce7c1 --- /dev/null +++ b/cfe/cfe/ui/ui_flash.c @@ -0,0 +1,554 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash Update commands File: ui_flash.c + * + * The routines in this file are used for updating the + * flash with new firmware. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_error.h" + +#include "ui_command.h" +#include "cfe.h" + +#include "cfe_fileops.h" +#include "cfe_boot.h" +#include "bsp_config.h" + +#include "cfe_loader.h" + +#include "net_ebuf.h" +#include "net_ether.h" +#include "net_api.h" + +#include "cfe_flashimage.h" + +#include "addrspace.h" +#include "url.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +/* + * Of course, these things really belong somewhere else. + */ + +#define FLASH_STAGING_BUFFER CFG_FLASH_STAGING_BUFFER_ADDR +#ifdef _FLASHPROG_ +#define FLASH_STAGING_BUFFER_SIZE (1024*1024*16) +#else +#define FLASH_STAGING_BUFFER_SIZE CFG_FLASH_STAGING_BUFFER_SIZE +#endif + + +/* ********************************************************************* + * Exerns + ********************************************************************* */ + +extern int cfe_iocb_dispatch(cfe_iocb_t *iocb); + +int ui_init_flashcmds(void); +static int ui_cmd_flash(ui_cmdline_t *cmd,int argc,char *argv[]); + + + +/* ********************************************************************* + * ui_init_flashcmds() + * + * Initialize the flash commands, add them to the table. + * + * Input parameters: + * nothing + * + * Return value: + * 0 if ok, else error + ********************************************************************* */ + +int ui_init_flashcmds(void) +{ + cmd_addcmd("flash", + ui_cmd_flash, + NULL, + "Update a flash memory device", + "flash [options] filename [flashdevice]\n\n" + "Copies data from a source file name or device to a flash memory device.\n" + "The source device can be a disk file (FAT filesystem), a remote file\n" + "(TFTP) or a flash device. The destination device may be a flash or eeprom.\n" +#if !CFG_EMBEDDED_PIC + "If the destination device is your boot flash (usually flash0), the flash\n" + "command will restart the firmware after the flash update is complete\n" +#endif + "", + "-noerase;Don't erase flash before writing|" + "-offset=*;Begin programming at this offset in the flash device|" + "-size=*;Size of source device when programming from flash to flash|" + "-noheader;Override header verification, flash binary without checking"); + + + return 0; +} + +/* ********************************************************************* + * flash_crc32(buf,len) + * + * Yes, this is an Ethernet CRC. I'm lazy. + * + * Input parameters: + * buf - buffer to CRC + * len - length of data + * + * Return value: + * CRC-32 + ********************************************************************* */ + +#define CRC32_POLY 0xEDB88320UL /* CRC-32 Poly */ +static unsigned int +flash_crc32(const unsigned char *databuf, unsigned int datalen) +{ + unsigned int idx, bit, data, crc = 0xFFFFFFFFUL; + + for (idx = 0; idx < datalen; idx++) { + for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1) { + crc = (crc >> 1) ^ (((crc ^ data) & 1) ? CRC32_POLY : 0); + } + } + + return crc; +} + +/* ********************************************************************* + * flash_validate(ptr) + * + * Validate the flash header to make sure we can program it. + * + * Input parameters: + * ptr - pointer to flash header + * outptr - pointer to data that we should program + * outsize - size of data we should program + * + * Return value: + * 0 if ok + * else error occured + ********************************************************************* */ + +#define GET32(x) (((uint32_t) (x[0] << 24)) | \ + ((uint32_t) (x[1] << 16)) | \ + ((uint32_t) (x[2] << 8)) | \ + ((uint32_t) (x[3] << 0))) + +static int flash_validate(uint8_t *ptr,int insize,uint8_t **outptr,int *outsize) +{ + cfe_flashimage_t *hdr = (cfe_flashimage_t *) ptr; + uint32_t size; + uint32_t flags; + uint32_t hdrcrc; + uint32_t calccrc; + + if (memcmp(hdr->seal,CFE_IMAGE_SEAL,sizeof(hdr->seal)) != 0) { + printf("Invalid header seal. This is not a CFE flash image.\n"); + return -1; + } + + printf("Flash image contains CFE version %d.%d.%d for board '%s'\n", + hdr->majver,hdr->minver,hdr->ecover,hdr->boardname); + + size = GET32(hdr->size); + flags = GET32(hdr->flags); + hdrcrc = GET32(hdr->crc); + printf("Flash image is %d bytes, flags %08X, CRC %08X\n",size,flags,hdrcrc); + + if (strcmp(CFG_BOARDNAME,hdr->boardname) != 0) { + printf("This flash image is not appropriate for board type '%s'\n",CFG_BOARDNAME); + return -1; + } + + if ((size == 0) || (size > FLASH_STAGING_BUFFER_SIZE) || + ((size + sizeof(cfe_flashimage_t)) < insize)) { + printf("Flash image size is bogus!\n"); + return -1; + } + + calccrc = flash_crc32(ptr + sizeof(cfe_flashimage_t),size); + + if (calccrc != hdrcrc) { + printf("CRC is incorrect. Calculated CRC is %08X\n",calccrc); + return -1; + } + + *outptr = ptr + sizeof(cfe_flashimage_t); + *outsize = size; + return 0; +} + +/* ********************************************************************* + * ui_cmd_flash(cmd,argc,argv) + * + * The 'flash' command lives here. Program the boot flash, + * or if a device name is specified, program the alternate + * flash device. + * + * Input parameters: + * cmd - command table entry + * argc,argv - parameters + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + + +static int ui_cmd_flash(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + uint8_t *ptr; + int fh; + int res; +#if !CFG_EMBEDDED_PIC + int retlen; +#endif + char *fname; + char *flashdev; + cfe_loadargs_t la; + int amtcopy; + int devtype; + int srcdevtype; + int chkheader; + int sfd; + int copysize; + flash_info_t flashinfo; + int offset = 0; + int noerase = 0; + char *x; + int size = 0; + + /* + * Get the address of the staging buffer. We can't + * allocate the space from the heap to store the + * new flash image, because the heap may not be big + * enough. So, grab some unallocated memory + * at the 1MB line (we could also calculate + * something, but this will do for now). + * We assume the flash will be somewhere between + * 1KB (yeah, right) and 4MB. + */ + +#if CFG_RUNFROMKSEG0 + ptr = (uint8_t *) KERNADDR(FLASH_STAGING_BUFFER); +#else + ptr = (uint8_t *) UNCADDR(FLASH_STAGING_BUFFER); +#endif + + /* + * Parse command line parameters + */ + + fname = cmd_getarg(cmd,0); + + if (!fname) { + return ui_showusage(cmd); + } + + flashdev = cmd_getarg(cmd,1); + if (!flashdev) flashdev = "flash0.0"; + + /* + * Make sure it's a flash device. + */ + + res = cfe_getdevinfo(flashdev); + if (res < 0) { + return ui_showerror(CFE_ERR_DEVNOTFOUND,flashdev); + } + + devtype = res & CFE_DEV_MASK; + + if ((res != CFE_DEV_FLASH) && (res != CFE_DEV_NVRAM)) { + xprintf("Device '%s' is not a flash or eeprom device.\n",flashdev); + return CFE_ERR_INV_PARAM; + } + + /* + * We shouldn't really allow this, but there are some circumstances + * where you might want to bypass the header check and shoot + * yourself in the foot. + * Switch normally not supplied, so chkheader will be TRUE. + */ + + chkheader = !cmd_sw_isset(cmd,"-noheader"); + + /* + * Check for some obscure options here. + */ + + noerase = cmd_sw_isset(cmd,"-noerase"); + + if (cmd_sw_value(cmd,"-offset",&x)) { + offset = atoi(x); + } + + if (cmd_sw_value(cmd,"-size",&x)) { + size = atoi(x); + } + + /* + * Read the new flash image from the source device + */ + + srcdevtype = cfe_getdevinfo(fname) & CFE_DEV_MASK; + + xprintf("Reading %s: ",fname); + + switch (srcdevtype) { + case CFE_DEV_FLASH: + sfd = cfe_open(fname); + if (sfd < 0) { + return ui_showerror(sfd,"Could not open source device"); + } + memset(ptr,0xFF,FLASH_STAGING_BUFFER_SIZE); + + /* + * If the flash device can be used for NVRAM, + * then the max size of or flash is the + * offset of the flash info. Otherwise + * it is the full staging buffer size. + * XXX: if it's larger, we lose. + */ + + if (cfe_ioctl(sfd,IOCTL_FLASH_GETINFO, + (unsigned char *) &flashinfo, + sizeof(flash_info_t), + &res,0) != 0) { + flashinfo.flash_size = FLASH_STAGING_BUFFER_SIZE; + } + + if (size > 0) { + xprintf("(size=0x%X) ",size); + } + else { + size = flashinfo.flash_size; + } + + /* Make sure we don't overrun the staging buffer */ + + if (size > FLASH_STAGING_BUFFER_SIZE) { + size = FLASH_STAGING_BUFFER_SIZE; + } + + /* Read the flash device here. */ + + res = cfe_read(sfd,ptr,size); + + cfe_close(sfd); + if (res < 0) { + return ui_showerror(res,"Could not read from flash"); + } + chkheader = FALSE; /* no header to check */ + /* + * Search for non-0xFF byte at the end. This will work because + * flashes get erased to all FF's, we pre-fill our buffer to FF's, + */ + while (res > 0) { + if (ptr[res-1] != 0xFF) break; + res--; + } + break; + + case CFE_DEV_SERIAL: + la.la_filesys = "raw"; + la.la_filename = NULL; + la.la_device = fname; + la.la_address = (intptr_t) ptr; + la.la_options = 0; + la.la_maxsize = FLASH_STAGING_BUFFER_SIZE; + la.la_flags = LOADFLG_SPECADDR; + + res = cfe_load_program("srec",&la); + + if (res < 0) { + ui_showerror(res,"Failed."); + return res; + } + break; + + default: + + res = ui_process_url(fname, cmd, &la); + if (res < 0) { + ui_showerror(res,"Invalid file name %s",fname); + return res; + } + + la.la_address = (intptr_t) ptr; + la.la_options = 0; + la.la_maxsize = FLASH_STAGING_BUFFER_SIZE; + la.la_flags = LOADFLG_SPECADDR; + + res = cfe_load_program("raw",&la); + + if (res < 0) { + ui_showerror(res,"Failed."); + return res; + } + break; + + } + + xprintf("Done. %d bytes read\n",res); + + copysize = res; + + /* + * Verify the header and file's CRC. + */ + if (chkheader) { + if (flash_validate(ptr,res,&ptr,©size) < 0) return -1; + } + + if (copysize == 0) return 0; /* 0 bytes, don't flash */ + + /* + * Open the destination flash device. + */ + + fh = cfe_open(flashdev); + if (fh < 0) { + xprintf("Could not open device '%s'\n",flashdev); + return CFE_ERR_DEVNOTFOUND; + } + + if (cfe_ioctl(fh,IOCTL_FLASH_GETINFO, + (unsigned char *) &flashinfo, + sizeof(flash_info_t), + &res,0) == 0) { + /* Truncate write if source size is greater than flash size */ + if ((copysize + offset) > flashinfo.flash_size) { + copysize = flashinfo.flash_size; + } + } + + /* + * If overwriting the boot flash, we need to use the special IOCTL + * that will force a reboot after writing the flash. + */ + + if (flashinfo.flash_base == 0x1FC00000) { /* XXX MIPS-SPECIFIC */ +#if CFG_EMBEDDED_PIC + xprintf("\n\n** DO NOT TURN OFF YOUR MACHINE UNTIL THE FLASH UPDATE COMPLETES!! **\n\n"); +#else +#if CFG_NETWORK + if (net_getparam(NET_DEVNAME)) { + xprintf("Closing network.\n"); + net_uninit(); + } +#endif + xprintf("Rewriting boot flash device '%s'\n",flashdev); + xprintf("\n\n**DO NOT TURN OFF YOUR MACHINE UNTIL IT REBOOTS!**\n\n"); + cfe_ioctl(fh,IOCTL_FLASH_WRITE_ALL, ptr,copysize,&retlen,0); + /* should not return */ + return CFE_ERR; +#endif + } + + /* + * Otherwise: it's not the flash we're using right + * now, so we can be more verbose about things, and + * more importantly, we can return to the command + * prompt without rebooting! + */ + + /* + * Erase the flash, if the device requires it. Our new flash + * driver does the copy/merge/erase for us. + */ + + if (!noerase) { + if ((devtype == CFE_DEV_FLASH) && !(flashinfo.flash_flags & FLASH_FLAG_NOERASE)) { + flash_range_t range; + range.range_base = offset; + range.range_length = copysize; + xprintf("Erasing flash..."); + if (cfe_ioctl(fh,IOCTL_FLASH_ERASE_RANGE, + (uint8_t *) &range,sizeof(range),NULL,0) != 0) { + printf("Failed to erase the flash\n"); + cfe_close(fh); + return CFE_ERR_IOERR; + } + } + } + + /* + * Program the flash + */ + + xprintf("Programming..."); + + amtcopy = cfe_writeblk(fh,offset,ptr,copysize); + + if (copysize == amtcopy) { + xprintf("done. %d bytes written\n",amtcopy); + res = 0; + } + else { + ui_showerror(amtcopy,"Failed."); + res = CFE_ERR_IOERR; + } + + /* + * done! + */ + + cfe_close(fh); + + return res; +} + diff --git a/cfe/cfe/ui/ui_loadcmds.c b/cfe/cfe/ui/ui_loadcmds.c new file mode 100644 index 0000000..a1df159 --- /dev/null +++ b/cfe/cfe/ui/ui_loadcmds.c @@ -0,0 +1,366 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Program Loader commands File: ui_loadcmds.c + * + * User interface for program loader + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" + +#include "ui_command.h" +#include "cfe.h" + +#include "net_ebuf.h" +#include "net_ether.h" +#include "net_api.h" + +#include "cfe_fileops.h" +#include "cfe_boot.h" + +#include "bsp_config.h" +#include "cfe_loader.h" +#include "cfe_autoboot.h" + +#include "url.h" + + +int ui_init_loadcmds(void); +static int ui_cmd_load(ui_cmdline_t *cmd,int argc,char *argv[]); + +#if CFG_NETWORK +static int ui_cmd_save(ui_cmdline_t *cmd,int argc,char *argv[]); +#endif + +static int ui_cmd_autoboot(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_boot(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_batch(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_go(ui_cmdline_t *cmd,int argc,char *argv[]); + + +extern cfe_loadargs_t cfe_loadargs; + +static long getaddr(char *str) +{ + /* + * hold on to your lunch, this is really, really bad! + * Make 64-bit addresses expressed as 8-digit numbers + * sign extend automagically. Saves typing, but is very + * gross. Not very portable, either. + */ + int longaddr = 0; + long newaddr; + + longaddr = strlen(str); + if (memcmp(str,"0x",2) == 0) longaddr -= 2; + longaddr = (longaddr > 8) ? 1 : 0; + + if (longaddr) newaddr = (long) xtoq(str); + else newaddr = (long) xtoi(str); + + return newaddr; +} + + + +int ui_init_loadcmds(void) +{ + +#if CFG_NETWORK + cmd_addcmd("save", + ui_cmd_save, + NULL, + "Save a region of memory to a remote file via TFTP", + "save [-options] host:filename startaddr length\n\n", + ""); +#endif + + cmd_addcmd("load", + ui_cmd_load, + NULL, + "Load an executable file into memory without executing it", + "load [-options] host:filename|dev:filename\n\n" + "This command loads an executable file into memory, but does not\n" + "execute it. It can be used for loading data files, overlays or\n" + "other programs needed before the 'boot' command is used. By\n" + "default, 'load' will load a raw binary at virtual address 0x20000000.", + "-elf;Load the file as an ELF executable|" + "-srec;Load the file as ASCII S-records|" + "-raw;Load the file as a raw binary|" +#if CFG_ZLIB + "-z;Load compessed file|" +#endif + "-loader=*;Specify CFE loader name|" + "-tftp;Load the file using the TFTP protocol|" + "-fatfs;Load the file from a FAT file system|" + "-rawfs;Load the file from an unformatted file system|" +#if (CFG_TCP) && (CFG_HTTPFS) + "-http;Load the file using the HTTP protocol|" +#endif + "-fs=*;Specify CFE file system name|" + "-max=*;Specify the maximum number of bytes to load (raw only)|" + "-addr=*;Specify the load address (hex) (raw only)"); + + cmd_addcmd("boot", + ui_cmd_boot, + NULL, + "Load an executable file into memory and execute it", + "boot [-options] host:filename|dev:filename\n\n" + "This command loads and executes a program from a boot device\n" + "By default, 'boot' will load a raw binary at virtual \n" + "address 0x20000000 and then jump to that address", + "-elf;Load the file as an ELF executable|" + "-srec;Load the file as ASCII S-records|" + "-raw;Load the file as a raw binary|" +#if CFG_ZLIB + "-z;Load compessed file|" +#endif + "-loader=*;Specify CFE loader name|" + "-tftp;Load the file using the TFTP protocol|" + "-fatfs;Load the file from a FAT file system|" + "-rawfs;Load the file from an unformatted file system|" +#if (CFG_TCP) && (CFG_HTTPFS) + "-http;Load the file using the HTTP protocol|" +#endif + "-fs=*;Specify CFE file system name|" + "-max=*;Specify the maximum number of bytes to load (raw only)|" + "-addr=*;Specify the load address (hex) (raw only)|" + "-noclose;Don't close network link before executing program"); + + cmd_addcmd("go", + ui_cmd_go, + NULL, + "Start a previously loaded program.", + "go [address]\n\n" + "The 'go' command will start a program previously loaded with \n" + "the 'load' command. You can override the start address by" + "specifying it as a parameter to the 'go' command.", + "-noclose;Don't close network link before executing program"); + + cmd_addcmd("batch", + ui_cmd_batch, + NULL, + "Load a batch file into memory and execute it", + "batch [-options] host:filename|dev:filename\n\n" + "This command loads and executes a batch file from a boot device", +#if CFG_ZLIB + "-z;Load compessed file|" +#endif + "-tftp;Load the file using the TFTP protocol|" + "-fatfs;Load the file from a FAT file system|" + "-rawfs;Load the file from an unformatted file system|" + "-fs=*;Specify CFE file system name"); + + + cmd_addcmd("autoboot", + ui_cmd_autoboot, + NULL, + "Automatic system bootstrap.", + "autoboot [dev]\n\n" + "The 'autoboot' command causes an automatic system bootstrap from\n" + "a predefined list of devices and boot files. This list is \n" + "specific to the board and port of CFE. To try autobooting from\n" + "a specific device, you can specify the CFE device name on the command line.", + "-forever;Loop over devices until boot is successful|" + "-interruptible;Scan console between devices, drop to prompt if key pressed"); + + return 0; +} + + +static int ui_cmd_autoboot(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int res; + char *x; + int flags = 0; + + if (cmd_sw_isset(cmd,"-forever")) flags |= CFE_AUTOFLG_TRYFOREVER; + if (cmd_sw_isset(cmd,"-interruptible")) flags |= CFE_AUTOFLG_POLLCONSOLE; + + x = cmd_getarg(cmd,0); + res = cfe_autoboot(x,flags); + + return res; +} + +static int ui_cmd_go(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *arg; + + arg = cmd_getarg(cmd,0); + if (arg) { + cfe_loadargs.la_entrypt = getaddr(arg); + } + + if (cmd_sw_isset(cmd,"-noclose")) { + cfe_loadargs.la_flags |= LOADFLG_NOCLOSE; + } + + cfe_go(&cfe_loadargs); + + return 0; +} + + + +static int ui_cmd_bootcommon(ui_cmdline_t *cmd,int argc,char *argv[],int flags) +{ + int res; + char *arg; + cfe_loadargs_t *la = &cfe_loadargs; + char copy[200]; + + la->la_flags = flags; + + arg = cmd_getarg(cmd,0); + strncpy(copy,arg,sizeof(copy)); + + if (!arg) { + xprintf("No program name specified\n"); + return -1; + } + + res = ui_process_url(arg,cmd,la); + if (res < 0) return res; + + /* + * Pick up the remaining command line parameters for use as + * arguments to the loaded program. + */ + + la->la_options = cmd_getarg(cmd,1); + + /* + * Note: we might not come back here if we really launch the program. + */ + + xprintf("Loader:%s Filesys:%s Dev:%s File:%s Options:%s\n", + la->la_loader,la->la_filesys,la->la_device,la->la_filename,la->la_options); + + res = cfe_boot(la->la_loader,la); + + /* + * Give the bad news. + */ + + if (res < 0) xprintf("Could not load %s: %s\n",copy,cfe_errortext(res)); + + return res; +} + + +static int ui_cmd_load(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int flags = LOADFLG_NOISY; + + return ui_cmd_bootcommon(cmd,argc,argv,flags); +} + + + + +static int ui_cmd_boot(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int flags = LOADFLG_NOISY | LOADFLG_EXECUTE; + + return ui_cmd_bootcommon(cmd,argc,argv,flags); +} + +static int ui_cmd_batch(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int flags = LOADFLG_NOISY | LOADFLG_EXECUTE | LOADFLG_BATCH; + + return ui_cmd_bootcommon(cmd,argc,argv,flags); +} + +#if CFG_NETWORK +static int ui_cmd_save(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *x; + uint8_t *start,*end; + int len; + char *fname; + int res; + + fname = cmd_getarg(cmd,0); + + if ((x = cmd_getarg(cmd,1))) { + start = (uint8_t *) getaddr(x); + } + else { + return ui_showusage(cmd); + } + + if ((x = cmd_getarg(cmd,2))) { + len = xtoi(x); + } + else { + return ui_showusage(cmd); + } + + end = start+len; + + res = cfe_savedata("tftp","",fname,start,end); + + if (res < 0) { + return ui_showerror(res,"Could not dump data to network"); + } + else { + xprintf("%d bytes written to %s\n",res,fname); + } + + return 0; +} +#endif + + + + diff --git a/cfe/cfe/ui/ui_memcmds.c b/cfe/cfe/ui/ui_memcmds.c new file mode 100644 index 0000000..b48af34 --- /dev/null +++ b/cfe/cfe/ui/ui_memcmds.c @@ -0,0 +1,171 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Memory Map commands File: ui_memcmds.c + * + * Memory Manager user interface + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "lib_arena.h" + +#include "ui_command.h" + +#include "cfe_mem.h" + +#include "cfe.h" + + +const static char * const cfe_arenatypes[] = { + "Reserved", + "DRAM (available)", + "Memory Controller (unused)", + "DRAM (in use by firmware)", + "ROM", + "I/O Registers", + "Not available", + "L2 Cache", + "LDT/PCI", + NULL}; + +extern arena_t cfe_arena; + + + +int ui_init_memcmds(void); + +static int ui_cmd_physmap(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_heapstats(ui_cmdline_t *cmd,int argc,char *argv[]); + + +int ui_init_memcmds(void) +{ + cmd_addcmd("show memory", + ui_cmd_physmap, + NULL, + "Display the system physical memory map.", + "show memory [-a]\n\n" + "This command displays the arena, or system physical memory map\n" + "You can use this command to determine the areas of RAM that will\n" + "be made available to operating systems.\n", + "-a;Display all entries in the map, not just the blocks\n" + "of available memory."); + + cmd_addcmd("show heap", + ui_cmd_heapstats, + NULL, + "Display information about CFE's heap", + "show heap\n\n" + "This is a debugging command that can be used to determine the health\n" + "of CFE's internal memory manager.", + ""); + + return 0; +} + +static int ui_cmd_heapstats(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int res; + memstats_t stats; + + res = KMEMSTATS(&stats); + + xprintf("\n"); + xprintf("Total bytes: %d\n",stats.mem_totalbytes); + xprintf("Free bytes: %d\n",stats.mem_freebytes); + xprintf("Free nodes: %d\n",stats.mem_freenodes); + xprintf("Allocated bytes: %d\n",stats.mem_allocbytes); + xprintf("Allocated nodes: %d\n",stats.mem_allocnodes); + xprintf("Largest free node: %d\n",stats.mem_largest); + xprintf("Heap status: %s\n",(res == 0) ? "CONSISTENT" : "CORRUPT!"); + xprintf("\n"); + + return res; +} + + +#define PHYSMAP_FLG_ALL 1 +#define PHYSMAP_FLG_AVAIL 2 + +static int ui_cmd_physmap(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + arena_node_t *node; + queue_t *qb; + arena_t *arena = &cfe_arena; + int flags = 0; + + if (cmd_sw_isset(cmd,"-a")) { + flags |= PHYSMAP_FLG_ALL; + } + else { + flags = PHYSMAP_FLG_AVAIL; + } + + + xprintf("Range Start Range End Range Size Description\n"); + xprintf("------------ ------------ -------------- --------------------\n"); + + for (qb = (arena->arena_list.q_next); qb != &(arena->arena_list); + qb = qb->q_next) { + node = (arena_node_t *) qb; + + if ((flags & PHYSMAP_FLG_ALL) || + ((flags & PHYSMAP_FLG_AVAIL) && (node->an_type == MEMTYPE_DRAM_AVAILABLE))) { + + xprintf("%012llX-%012llX (%012llX) %s\n", + node->an_address, + node->an_address+node->an_length-1, + node->an_length, + cfe_arenatypes[node->an_type]); + } + + } + + return 0; +} + diff --git a/cfe/cfe/ui/ui_misccmds.c b/cfe/cfe/ui/ui_misccmds.c new file mode 100644 index 0000000..156da6a --- /dev/null +++ b/cfe/cfe/ui/ui_misccmds.c @@ -0,0 +1,178 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Miscellaneous commands File: ui_misccmds.c + * + * Some small but useful commands + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_error.h" +#include "cfe_ioctl.h" +#include "cfe_devfuncs.h" +#include "ui_command.h" +#include "cfe.h" + + +static int ui_cmd_loop(ui_cmdline_t *cmd,int argc,char *argv[]); +#ifdef _FUNCSIM_ +static int ui_cmd_exit(ui_cmdline_t *cmd,int argc,char *argv[]); +#endif +static int ui_cmd_console(ui_cmdline_t *cmd,int argc,char *argv[]); + +extern int cfe_docommands(char *buf); + +int ui_init_misccmds(void); + +int ui_init_misccmds(void) +{ + + cmd_addcmd("loop", + ui_cmd_loop, + NULL, + "Loop a command", + "loop \"command\" [-count=*]\n" + "The 'loop' command causes the specified command or list of commands\n" + "to be repeated 'count' times or forever, or until a character is typed", + "-count=*;Specifies number of iterations|" + "-forever;Loops forever"); + +#ifdef _FUNCSIM_ + cmd_addcmd("exit", + ui_cmd_exit, + NULL, + "exit from the functional simulator", + "exit [n]\n\n" + "This command is useful only when running under the functional\n" + "simulator. It causes the simulator to exit and return to the\n" + "operating system. If specified, 'n' will be placed in $4 as a\n" + "return code.", + ""); +#endif + + cmd_addcmd("set console", + ui_cmd_console, + NULL, + "Change the active console device", + "set console device-name\n\n" + "Changes the console device to the specified device name. The console\n" + "must be a serial-style device. Be careful not to change the console\n" + "to a device that is not connected!", + ""); + + return 0; +} + +static int ui_cmd_loop(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int count = 10; + char *x; + int res; + int forever; + + if (cmd_sw_value(cmd,"-count",&x)) count = atoi(x); + + forever = cmd_sw_isset(cmd,"-forever"); + + x = cmd_getarg(cmd,0); + if (!x) return ui_showusage(cmd); + + res = 0; + while (count || forever) { + if (console_status()) break; + res = ui_docommands(x); + if (res != 0) break; + count--; + } + + return res; +} + + +#ifdef _FUNCSIM_ +static int ui_cmd_exit(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int val = 0; + char *x; + + x = cmd_getarg(cmd,0); + if (x) val = atoi(x); + + __asm __volatile ("move $4,%0 ; li $2,1 ; syscall 0xca" : "=r"(val)); + + return -1; +} +#endif + + +static int ui_cmd_console(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int res; + char *dev; + + dev = cmd_getarg(cmd,0); + if (!dev) return -1; /* XXX usage */ + + res = cfe_getdevinfo(dev); + if (res < 0) { + xprintf("Device '%s' is not valid\n",dev); + return CFE_ERR_DEVNOTFOUND; + } + + if ((res & CFE_DEV_MASK) != CFE_DEV_SERIAL) { + xprintf("Device '%s' is not the appropriate type to be a console\n", + dev); + return CFE_ERR_WRONGDEVTYPE; + } + + cfe_set_console(dev); + + return 0; +} diff --git a/cfe/cfe/ui/ui_netcmds.c b/cfe/cfe/ui/ui_netcmds.c new file mode 100644 index 0000000..891e127 --- /dev/null +++ b/cfe/cfe/ui/ui_netcmds.c @@ -0,0 +1,710 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Network commands File: ui_netcmds.c + * + * Network user interface + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" +#include "cfe_ioctl.h" + +#include "cfe_error.h" + +#include "env_subr.h" +#include "ui_command.h" +#include "cfe.h" + +#include "net_ebuf.h" +#include "net_ether.h" + +#include "net_api.h" + +#include "cfe_fileops.h" + +#include "bsp_config.h" + +#define ip_addriszero(a) (((a)[0]|(a)[1]|(a)[2]|(a)[3]) == 0) +#define isdigit(d) (((d) >= '0') && ((d) <= '9')) + +int ui_init_netcmds(void); + +#if CFG_NETWORK +static int ui_cmd_ifconfig(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_arp(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_ping(ui_cmdline_t *cmd,int argc,char *argv[]); +#if CFG_TCP +extern int ui_init_tcpcmds(void); +#endif +#endif + +typedef struct netparam_s { + const char *str; + int num; +} netparam_t; + +const static netparam_t loopbacktypes[] = { + {"off",ETHER_LOOPBACK_OFF}, + {"internal",ETHER_LOOPBACK_INT}, + {"external",ETHER_LOOPBACK_EXT}, + {0,NULL}}; + +const static netparam_t speedtypes[] = { + {"auto",ETHER_SPEED_AUTO}, + {"10hdx",ETHER_SPEED_10HDX}, + {"10fdx",ETHER_SPEED_10FDX}, + {"100hdx",ETHER_SPEED_100HDX}, + {"100fdx",ETHER_SPEED_100FDX}, + {"1000hdx",ETHER_SPEED_1000HDX}, + {"1000fdx",ETHER_SPEED_1000FDX}, + {0,NULL}}; + + +int ui_init_netcmds(void) +{ +#if CFG_NETWORK + cmd_addcmd("ifconfig", + ui_cmd_ifconfig, + NULL, + "Configure the Ethernet interface", + "ifconfig device [options..]\n\n" + "Activates and configures the specified Ethernet interface and sets its\n" + "IP address, netmask, and other parameters. The -auto switch can be used\n" + "to set this information via DHCP.", + "-auto;Configure interface automatically via DHCP|" + "-off;Deactivate the specified interface|" + "-addr=*;Specifies the IP address of the interface|" + "-mask=*;Specifies the subnet mask for the interface|" + "-gw=*;Specifies the gateway address for the interface|" + "-dns=*;Specifies the name server address for the interface|" + "-domain=*;Specifies the default domain for name service queries|" + "-speed=*;Sets the interface speed (auto,10fdx,10hdx,\n100fdx,\n" + "100hdx,1000fdx,1000hdx)|" + "-loopback=*;Sets the loopback mode (off,internal,external) " + "External\nloopback causes the phy to be placed in loopback mode|" + "-hwaddr=*;Sets the hardware address (overrides environment)"); + + cmd_addcmd("arp", + ui_cmd_arp, + NULL, + "Display or modify the ARP Table", + "arp [-d] [ip-address] [dest-address]\n\n" + "Without any parameters, the arp command will display the contents of the\n" + "arp table. With two parameters, arp can be used to add permanent arp\n" + "entries to the table (permanent arp entries do not time out)", + "-d;Delete the specified ARP entry. If specified, ip-address\n" + "may be * to delete all entries."); + + cmd_addcmd("ping", + ui_cmd_ping, + NULL, + "Ping a remote IP host.", + "ping [-t] remote-host\n\n" + "This command sends an ICMP ECHO message to a remote host and waits for \n" + "a reply. The network interface must be configured and operational for\n" + "this command to work. If the interface is configured for loopback mode\n" + "the packet will be sent through the network interface, so this command\n" + "can be used for a simple network test.", + "-t;Ping forever, or until the ENTER key is struck|" + "-x;Exit immediately on first error (use with -f or -t)|" + "-f;Flood ping (use carefully!) - ping as fast as possible|" + "-s=*;Specify the number of ICMP data bytes|" + "-c=*;Specify number of packets to echo|" + "-A;don't abort even if key is pressed|" + "-E;Require all packets sent to be returned, for successful return status"); + +#if CFG_TCP + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + //ui_init_tcpcmds(); + /* Foxconn add end by Cliff Wang, 03/23/2010 */ +#endif + + +#endif + + return 0; +} + + +#if CFG_NETWORK +static int parsexdigit(char str) +{ + int digit; + + if ((str >= '0') && (str <= '9')) digit = str - '0'; + else if ((str >= 'a') && (str <= 'f')) digit = str - 'a' + 10; + else if ((str >= 'A') && (str <= 'F')) digit = str - 'A' + 10; + else return -1; + + return digit; +} + + +static int parsehwaddr(char *str,uint8_t *hwaddr) +{ + int digit1,digit2; + int idx = 6; + + while (*str && (idx > 0)) { + digit1 = parsexdigit(*str); + if (digit1 < 0) return -1; + str++; + if (!*str) return -1; + + if ((*str == ':') || (*str == '-')) { + digit2 = digit1; + digit1 = 0; + } + else { + digit2 = parsexdigit(*str); + if (digit2 < 0) return -1; + str++; + } + + *hwaddr++ = (digit1 << 4) | digit2; + idx--; + + if (*str == '-') str++; + if (*str == ':') str++; + } + return 0; +} + + + +static int ui_ifdown(void) +{ + char *devname; + + devname = (char *) net_getparam(NET_DEVNAME); + if (devname) { + xprintf("Device %s has been deactivated.\n",devname); + net_uninit(); + net_setnetvars(); + } + + return 0; +} + +static void ui_showifconfig(void) +{ + char *devname; + uint8_t *addr; + + devname = (char *) net_getparam(NET_DEVNAME); + if (devname == NULL) { + xprintf("Network interface has not been configured\n"); + return; + } + + xprintf("Device %s: ",devname); + + addr = net_getparam(NET_HWADDR); + if (addr) xprintf(" hwaddr %a",addr); + + addr = net_getparam(NET_IPADDR); + if (addr) { + if (ip_addriszero(addr)) xprintf(", ipaddr not set"); + else xprintf(", ipaddr %I",addr); + } + + addr = net_getparam(NET_NETMASK); + if (addr) { + if (ip_addriszero(addr)) xprintf(", mask not set"); + else xprintf(", mask %I",addr); + } + + xprintf("\n"); + xprintf(" "); + + addr = net_getparam(NET_GATEWAY); + if (addr) { + if (ip_addriszero(addr)) xprintf("gateway not set"); + else xprintf("gateway %I",addr); + } + + addr = net_getparam(NET_NAMESERVER); + if (addr) { + if (ip_addriszero(addr)) xprintf(", nameserver not set"); + else xprintf(", nameserver %I",addr); + } + + addr = net_getparam(NET_DOMAIN); + if (addr) { + xprintf(", domain %s",addr); + } + + xprintf("\n"); +} + +/* Foxconn add start by Cliff Wang, 03/23/2010 */ +#if 0 +static int ui_ifconfig_auto(ui_cmdline_t *cmd,char *devname) +{ + int err; + dhcpreply_t *reply = NULL; + char *x; + uint8_t hwaddr[6]; + + net_uninit(); + + err = net_init(devname); + if (err < 0) { + xprintf("Could not activate device %s: %s\n", + devname,cfe_errortext(err)); + return err; + } + + if (cmd_sw_value(cmd,"-hwaddr",&x)) { + if (parsehwaddr(x,hwaddr) != 0) { + xprintf("Invalid hardware address: %s\n",x); + net_uninit(); + return CFE_ERR_INV_PARAM; + } + else { + net_setparam(NET_HWADDR,hwaddr); + } + } + + err = dhcp_bootrequest(&reply); + + if (err < 0) { + xprintf("DHCP registration failed on device %s\n",devname); + net_uninit(); + return CFE_ERR_NETDOWN; + } + + net_setparam(NET_IPADDR,reply->dr_ipaddr); + net_setparam(NET_NETMASK,reply->dr_netmask); + net_setparam(NET_GATEWAY,reply->dr_gateway); + net_setparam(NET_NAMESERVER,reply->dr_nameserver); + net_setparam(NET_DOMAIN,reply->dr_domainname); + + dhcp_set_envvars(reply); + + if (reply) dhcp_free_reply(reply); + + ui_showifconfig(); + net_setnetvars(); + return 0; +} +#endif +/* Foxconn add end by Cliff Wang, 03/23/2010 */ + +static int ui_ifconfig_getsw(ui_cmdline_t *cmd,char *swname,char *descr,uint8_t *addr) +{ + char *x; + + x = NULL; + + if (cmd_sw_value(cmd,swname,&x) == 0) return 0; + + if ((x == NULL) || (parseipaddr(x,addr) < 0)) { + xprintf("Invalid %s: %s\n",descr,x ? x : "(none)"); + return -1; + } + + return 1; +} + +static int ui_ifconfig_lookup(char *name,char *val,const netparam_t *list) +{ + const netparam_t *p = list; + + while (p->str) { + if (strcmp(p->str,val) == 0) return p->num; + p++; + } + + xprintf("Invalid parameter for %s: Valid options are: "); + + p = list; + while (p->str) { + xprintf("%s ",p->str); + p++; + } + + xprintf("\n"); + return -1; +} + + +#define FLG_IPADDR 1 +#define FLG_NETMASK 2 +#define FLG_GATEWAY 4 +#define FLG_NAMESERVER 8 +#define FLG_DOMAIN 16 +#define FLG_LOOPBACK 32 +#define FLG_SPEED 64 +#define FLG_HWADDR 128 + +static int ui_cmd_ifconfig(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *devname; + int flags = 0; + uint8_t ipaddr[IP_ADDR_LEN]; + uint8_t netmask[IP_ADDR_LEN]; + uint8_t gateway[IP_ADDR_LEN]; + uint8_t nameserver[IP_ADDR_LEN]; + uint8_t hwaddr[6]; + int speed = ETHER_SPEED_AUTO; + int loopback = ETHER_LOOPBACK_OFF; + char *domain = NULL; + int res; + char *x; + + if (argc < 1) { + ui_showifconfig(); + return 0; + } + + devname = cmd_getarg(cmd,0); + + if (cmd_sw_isset(cmd,"-off")) { + return ui_ifdown(); + } + + /* Foxconn add start by Cliff Wang, 03/23/2010 */ +#if 0 + if (cmd_sw_isset(cmd,"-auto")) { + return ui_ifconfig_auto(cmd,devname); + } +#endif + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + + res = ui_ifconfig_getsw(cmd,"-addr","interface IP address",ipaddr); + if (res < 0) return CFE_ERR_INV_PARAM; + if (res > 0) { + flags |= FLG_IPADDR; + } + + res = ui_ifconfig_getsw(cmd,"-mask","netmask",netmask); + if (res < 0) return CFE_ERR_INV_PARAM; + if (res > 0) { + flags |= FLG_NETMASK; + } + + res = ui_ifconfig_getsw(cmd,"-gw","gateway IP address",gateway); + if (res < 0) return CFE_ERR_INV_PARAM; + if (res > 0) { + flags |= FLG_GATEWAY; + } + + res = ui_ifconfig_getsw(cmd,"-dns","name server IP address",nameserver); + if (res < 0) return CFE_ERR_INV_PARAM; + if (res > 0) { + flags |= FLG_NAMESERVER; + } + + if (cmd_sw_value(cmd,"-domain",&domain)) { + if (domain) flags |= FLG_DOMAIN; + } + + if (cmd_sw_value(cmd,"-speed",&x)) { + speed = ui_ifconfig_lookup("-speed",x,speedtypes); + if (speed >= 0) flags |= FLG_SPEED; + else return CFE_ERR_INV_PARAM; + } + + if (cmd_sw_value(cmd,"-loopback",&x)) { + loopback = ui_ifconfig_lookup("-loopback",x,loopbacktypes); + if (loopback >= 0) flags |= FLG_LOOPBACK; + else return CFE_ERR_INV_PARAM; + } + + if (cmd_sw_value(cmd,"-hwaddr",&x)) { + if (parsehwaddr(x,hwaddr) != 0) { + xprintf("Invalid hardware address: %s\n",x); + return CFE_ERR_INV_PARAM; + } + else { + flags |= FLG_HWADDR; + } + } + + /* + * If the network is running and the device name is + * different, uninit the net first. + */ + + x = (char *) net_getparam(NET_DEVNAME); + + if ((x != NULL) && (strcmp(x,devname) != 0)) { + net_uninit(); + } + + /* + * Okay, initialize the network if it is not already on. If it + * is OFF, the "net_devname" parameter will be NULL. + */ + + if (x == NULL) { + res = net_init(devname); /* turn interface on */ + if (res < 0) { + ui_showerror(res,"Could not activate network interface '%s'",devname); + return res; + } + } + + /* + * Set the parameters + */ + + if (flags & FLG_HWADDR) net_setparam(NET_HWADDR,hwaddr); + if (flags & FLG_IPADDR) net_setparam(NET_IPADDR,ipaddr); + if (flags & FLG_NETMASK) net_setparam(NET_NETMASK,netmask); + if (flags & FLG_GATEWAY) net_setparam(NET_GATEWAY,gateway); + if (flags & FLG_NAMESERVER) net_setparam(NET_NAMESERVER,nameserver); + /* Foxconn add start by Cliff Wang, 03/23/2010 */ + if (flags & FLG_DOMAIN) net_setparam(NET_DOMAIN,(uint8_t *) domain); + /* Foxconn add end by Cliff Wang, 03/23/2010 */ + if (flags & FLG_SPEED) net_setparam(NET_SPEED,(uint8_t *) &speed); + if (flags & FLG_LOOPBACK) net_setparam(NET_LOOPBACK,(uint8_t *) &loopback); + + ui_showifconfig(); + net_setnetvars(); + + return 0; +} + + +static int ui_cmd_arp(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int idx; + uint8_t ipaddr[IP_ADDR_LEN]; + uint8_t hwaddr[ENET_ADDR_LEN]; + char *x; + int once = 0; + + if (cmd_sw_isset(cmd,"-d")) { + if ((x = cmd_getarg(cmd,0)) == NULL) { + return ui_showusage(cmd); + } + + if (strcmp(x,"*") == 0) { + while (arp_enumerate(0,ipaddr,hwaddr) >= 0) { + arp_delete(ipaddr); + } + } + else { + if (parseipaddr(x,ipaddr) < 0) { + xprintf("Invalid IP address: %s\n",x); + return CFE_ERR_INV_PARAM; + } + arp_delete(ipaddr); + } + return 0; + } + + /* + * Get the IP address. If NULL, display the table. + */ + + x = cmd_getarg(cmd,0); + if (x == NULL) { + idx = 0; + while (arp_enumerate(idx,ipaddr,hwaddr) >= 0) { + if (once == 0) { + xprintf("Hardware Address IP Address\n"); + xprintf("----------------- ---------------\n"); + once = 1; + } + xprintf("%a %I\n",hwaddr,ipaddr); + idx++; + } + if (idx == 0) xprintf("No ARP entries.\n"); + return 0; + } + + if (parseipaddr(x,ipaddr) < 0) { + xprintf("Invalid IP address: %s\n",x); + return CFE_ERR_INV_PARAM; + } + + /* + * Get the hardware address. + */ + + x = cmd_getarg(cmd,1); + if (x == NULL) { + return ui_showusage(cmd); + } + + if (parsehwaddr(x,hwaddr) < 0) { + xprintf("Invalid hardware address: %s\n",x); + return CFE_ERR_INV_PARAM; + } + + arp_add(ipaddr,hwaddr); + + return 0; +} + +#define IP_HDR_LENGTH 20 +#define ICMP_HDR_LENGTH 8 +#define PING_HDR_LENGTH (IP_HDR_LENGTH+ICMP_HDR_LENGTH) +#define MAX_PKT_LENGTH 1500 + +static int ui_cmd_ping(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *host; + uint8_t hostaddr[IP_ADDR_LEN]; + int res; + int seq = 0; + int forever = 0; + int count = 1; + int ttlcount = 1; + int countreturned = 0; + int size = 56; + int flood = 0; + int retval = 0; + int exitonerror = 0; + int needexact = 0; + int noabort = 0; + char *x; + + host = cmd_getarg(cmd,0); + if (!host) return -1; + + if (cmd_sw_isset(cmd,"-t")) { + forever = 1; + } + + /* Per traditional Unix usage, the size argument to ping is + the number of ICMP data bytes. The frame on the wire will also + include the ethernet, IP and ICMP headers (14, 20, and + 8 bytes respectively) and ethernet trailer (CRC, 4 bytes). */ + if (cmd_sw_value(cmd,"-s",&x)) { + size = atoi(x); + if (size < 0) + size = 0; + if (size > MAX_PKT_LENGTH - PING_HDR_LENGTH) + size = MAX_PKT_LENGTH - PING_HDR_LENGTH; + } + + if (cmd_sw_isset(cmd,"-f")) { + flood = 1; + forever = 1; + } + + if (cmd_sw_isset(cmd,"-x")) { + exitonerror = 1; + } + + if (cmd_sw_value(cmd,"-c",&x)) { + count = atoi(x); + ttlcount = count; + forever = 0; + } + + if (cmd_sw_isset(cmd,"-A")) { + noabort = 1; + } + + if (cmd_sw_isset(cmd,"-E")) { + needexact = 1; + } + + if (isdigit(*host)) { + if (parseipaddr(host,hostaddr) < 0) { + xprintf("Invalid IP address: %s\n",host); + return -1; + } + } + else { + res = dns_lookup(host,hostaddr); + if (res < 0) { + return ui_showerror(res,"Could not resolve IP address of host %s",host); + } + } + + if (forever) xprintf("Press ENTER to stop pinging\n"); + + do { + res = icmp_ping(hostaddr,seq,size); + + if (res < 0) { + xprintf("Could not transmit echo request\n"); + retval = CFE_ERR_IOERR; + break; + } + else if (res == 0) { + xprintf("%s (%I) is not responding (seq=%d)\n",host,hostaddr,seq); + retval = CFE_ERR_TIMEOUT; + if (exitonerror) break; + } + else { + countreturned++; + if (!flood || ((seq % 10000) == 0)) { + if (forever || (ttlcount > 1)) { + xprintf("%s (%I) is alive (seq=%d)\n",host,hostaddr,seq); + } + else xprintf("%s (%I) is alive\n",host,hostaddr); + } + } + + if ((forever || (count > 1)) && !flood) { + if (res > 0) cfe_sleep(CFE_HZ); + } + + seq++; + count--; + + } while ((forever || (count > 0)) && (noabort || !console_status())); + + xprintf("%s (%I): %d packets sent, %d received\n",host,hostaddr, + ttlcount-count,countreturned); + return (needexact ? (countreturned != ttlcount) : (countreturned == 0)); +} + +#endif diff --git a/cfe/cfe/ui/ui_pcicmds.c b/cfe/cfe/ui/ui_pcicmds.c new file mode 100644 index 0000000..8875f8e --- /dev/null +++ b/cfe/cfe/ui/ui_pcicmds.c @@ -0,0 +1,282 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * PCI Commands File: ui_pcicmds.c + * + * PCI user interface routines + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "env_subr.h" +#include "ui_command.h" +#include "cfe.h" + +#include "pcivar.h" +#include "pcireg.h" + +#include "bsp_config.h" + +int ui_init_pcicmds(void); + +#if CFG_PCI +static int pci_print_summary(pcitag_t tag) +{ + pcireg_t id, class; + char devinfo[256]; + + class = pci_conf_read(tag, PCI_CLASS_REG); + id = pci_conf_read(tag, PCI_ID_REG); + + pci_devinfo(id, class, 1, devinfo); + pci_tagprintf (tag, "%s\n", devinfo); + + return 0; +} + +static int pci_print_concise(pcitag_t tag) +{ + pci_tagprintf (tag, "\n"); + pci_conf_print(tag); + + return 0; +} + +static int ui_cmd_pci(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *argp; + + if (cmd_sw_isset(cmd,"-init")) { + pci_configure(PCI_FLG_LDT_PREFETCH | PCI_FLG_NORMAL); + return 0; + } + + argp = cmd_getarg(cmd,0); + + if (argp == NULL) { + if (cmd_sw_isset(cmd,"-v")) { + pci_foreachdev(pci_print_concise); + } + else { + pci_foreachdev(pci_print_summary); + } + } + else { + /* parse the triplet */ + int bus, dev, func; + pcitag_t tag; + char *p; + + bus = dev = func = 0; + p = argp; + + while (*p >= '0' && *p <= '9') { + bus = bus*10 + (*p - '0'); + p++; + } + if (*p != '/') + goto fail; + p++; + while (*p >= '0' && *p <= '9') { + dev = dev*10 + (*p - '0'); + p++; + } + if (*p != '/') + goto fail; + p++; + while (*p >= '0' && *p <= '9') { + func = func*10 + (*p - '0'); + p++; + } + if (*p != '\000') + goto fail; + + tag = pci_make_tag(bus,dev,func); + + pci_print_concise(tag); + } + + return 0; + +fail: + printf("invalid PCI triplet %s\n", argp); + return -1; +} + + +static uint64_t parse_hex(const char *num) +{ + uint64_t x = 0; + unsigned int digit; + + if ((*num == '0') && (*(num+1) == 'x')) num += 2; + + while (*num) { + if ((*num >= '0') && (*num <= '9')) { + digit = *num - '0'; + } + else if ((*num >= 'A') && (*num <= 'F')) { + digit = 10 + *num - 'A'; + } + else if ((*num >= 'a') && (*num <= 'f')) { + digit = 10 + *num - 'a'; + } + else { + break; + } + x *= 16; + x += digit; + num++; + } + + return x; +} + +static int ui_cmd_map_pci(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + unsigned long offset, size; + uint64_t paddr; + int l2ca, endian; + int enable; + int result; + + enable = !cmd_sw_isset(cmd, "-off"); + if (enable) { + offset = parse_hex(cmd_getarg(cmd, 0)); + size = parse_hex(cmd_getarg(cmd, 1)); + paddr = parse_hex(cmd_getarg(cmd, 2)); + l2ca = cmd_sw_isset(cmd,"-l2ca"); + endian = cmd_sw_isset(cmd, "-matchbits"); + result = pci_map_window(paddr, offset, size, l2ca, endian); + } + else { + offset = parse_hex(cmd_getarg(cmd, 0)); + size = parse_hex(cmd_getarg(cmd, 1)); + result = pci_unmap_window(offset, size); + } + + return result; +} +#endif + +#ifdef CFG_VGACONSOLE + +extern int vga_biosinit(void); +extern int vga_probe(void); +extern void vgaraw_dump(char *tail); + +static int ui_cmd_vgainit(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int res; + + if (vga_probe() == 0) { + res = vga_biosinit(); + xprintf("vgabios_init returns %d\n",res); + } + else + xprintf("vga_probe found no suitable adapter\n"); + + return 0; +} + +static int ui_cmd_vgadump(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *x; + + x = cmd_getarg(cmd,0); + if (x == NULL) x = ""; + vgaraw_dump(x); + + return 0; +} +#endif /* CFG_VGACONSOLE */ + + +int ui_init_pcicmds(void) +{ + +#if CFG_PCI + cmd_addcmd("show pci", + ui_cmd_pci, + NULL, + "Display information about PCI buses and devices", + "show pci [-v] [bus/dev/func]\n\n" + "Displays information about PCI and LDT buses and devices in the\n" + "system. If you specify a bus/dev/func triplet, only that device\n" + " will be displayed.", + "-v;Display verbose information|" + "-init;Reinitialize and rescan the PCI bus"); + cmd_addcmd("map pci", + ui_cmd_map_pci, + NULL, + "Define a BAR0 window available to PCI devices", + "map pci offset size paddr [-off] [-l2ca] [-matchbits]\n\n" + "Map the region of size bytes starting at paddr to appear\n" + "at offset relative to BAR0\n", + "-off;Remove the region|" + "-l2ca;Make L2 cachable|" + "-matchbits;Use match bits policy"); + +#ifdef CFG_VGACONSOLE + cmd_addcmd("vga init", + ui_cmd_vgainit, + NULL, + "Initialize the VGA adapter.", + "vgainit", + ""); + cmd_addcmd("vga dumpbios", + ui_cmd_vgadump, + NULL, + "Dump the VGA BIOS to the console", + "vga dumpbios", + ""); +#endif /* CFG_VGACONSOLE */ +#endif + return 0; +} diff --git a/cfe/cfe/ui/ui_tcpcmds.c b/cfe/cfe/ui/ui_tcpcmds.c new file mode 100644 index 0000000..e092021 --- /dev/null +++ b/cfe/cfe/ui/ui_tcpcmds.c @@ -0,0 +1,828 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * TCP protocol commands File: ui_tcpcmds.c + * + * This file contains commands that make use of the TCP protocol + * in CFE, assuming it's configured. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_timer.h" + +#include "cfe_error.h" +#include "cfe_console.h" + +#include "ui_command.h" +#include "cfe.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" + +#include "bsp_config.h" + +#if CFG_TCP +#include "net_ebuf.h" +#include "net_api.h" +#endif + + +/* ********************************************************************* + * Configuration + ********************************************************************* */ + +/* ********************************************************************* + * prototypes + ********************************************************************* */ + +#if CFG_TCP + +int ui_init_tcpcmds(void); + +static int ui_cmd_rlogin(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_connect(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_listen(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_tcpconstest(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_ttcp(ui_cmdline_t *cmd,int argc,char *argv[]); +#define isdigit(d) (((d) >= '0') && ((d) <= '9')) + + +/* ********************************************************************* + * ui_init_tcpcmds() + * + * Add TCP-specific commands to the command table + * + * Input parameters: + * nothing + * + * Return value: + * 0 + ********************************************************************* */ + + +int ui_init_tcpcmds(void) +{ + + cmd_addcmd("rlogin", + ui_cmd_rlogin, + NULL, + "mini rlogin client.", + "rlogin hostname [username]\n\n" + "Connects to a remote system using the RLOGIN protocol. The remote" + "system must have appropriate permissions in place (usually via the" + "file '.rhosts') for CFE to connect. To terminate the session, type" + "a tilde (~) character followed by a period (.)", + ""); + + cmd_addcmd("tcp connect", + ui_cmd_connect, + NULL, + "TCP connection test.", + "tcp connect hostname [portnum]", + "-q;sink output, don't display on terminal|" + "-d;Send junk data to discard|" + "-nodelay;set nodelay option on socket|" + "-srcport=*;Specify the source port"); + + cmd_addcmd("tcp listen", + ui_cmd_listen, + NULL, + "port listener.", + "tcp listen portnum", + "-q;sink output, don't display on terminal|" + "-d;Send junk data to discard|" + "-nodelay;set nodelay option on socket"); + + + cmd_addcmd("tcp constest", + ui_cmd_tcpconstest, + NULL, + "tcp console test.", + "tcp constest device", + ""); + + cmd_addcmd("ttcp", + ui_cmd_ttcp, + NULL, + "TCP test command.", + "ttcp -t [-options] host\n" + "ttcp -r [-options]\n\n", + "-t;Source a pattern to the network|" + "-r;Sink (discard) data from the network|" + "-D;Don't buffer TCP writes (TCP_NODELAY)|" + "-n=*;Number of buffers to send (-t only) (default 2048)|" + "-l=*;Size of buffer to send/receive (default 2048)|" + "-p=*;Port number to use (default 5001)"); + + return 0; +} + + + + + +static unsigned long rand(void) +{ + static unsigned long seed = 1; + long x, hi, lo, t; + + x = seed; + hi = x / 127773; + lo = x % 127773; + t = 16807 * lo - 2836 * hi; + if (t <= 0) t += 0x7fffffff; + seed = t; + return t; +} + + +static int ui_cmd_rlogin(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int s; + uint8_t hostaddr[IP_ADDR_LEN]; + char *host; + int res; + int connflag; + int rxdata; + int sport; + uint8_t data[100]; + int tilde; + char *username; + uint8_t *p; + + /* + * Process args + */ + + host = cmd_getarg(cmd,0); + if (!host) return ui_showusage(cmd); + + username = cmd_getarg(cmd,1); + if (!username) username = ""; + + /* + * Look up remote host + */ + + if (isdigit(*host)) { + if (parseipaddr(host,hostaddr) < 0) { + xprintf("Invalid IP address: %s\n",host); + return -1; + } + } + else { + res = dns_lookup(host,hostaddr); + if (res < 0) { + return ui_showerror(res,"Could not resolve IP address of host %s",host); + } + } + + /* + * Create TCP socket and bind to a port number less than 1023 + * See RFC1282 for more info about this + */ + + s = tcp_socket(); + + if (s < 0) { + return ui_showerror(s,"Could not create TCP socket"); + } + + res = 0; + tilde = 0; + for (sport = 1023; sport > 513; sport--) { + res = tcp_bind(s,sport); + if (res == 0) break; + } + + if (sport == 513) { + ui_showerror(res,"No ports available for RLOGIN"); + return res; + } + + /* + * Establish a connection. Our sockets default to nonblocking + * so we want to switch to blocking temporarily to + * let the tcp_connect routine do this by itself. + */ + + tcp_setflags(s,0); + res = tcp_connect(s,hostaddr,513); + if (res < 0) { + ui_showerror(res,"Could not connect to host %I",hostaddr); + tcp_close(s); + return res; + } + + + /* + * Construct the initial RLOGIN sequence to include + * our user name and terminal type + */ + + p = data; + *p++ = '\0'; + p += sprintf(p,"%s",username) + 1; + p += sprintf(p,"%s",username) + 1; + p += sprintf(p,"vt100/38400") + 1; + + tcp_send(s,data,p-&data[0]); + + res = tcp_recv(s,data,1); /* receive result code */ + if (res <= 0) { + goto remdisc; + } + + /* + * Switch back to nonblocking I/O for the loop + */ + + tcp_setflags(s,TCPFLG_NBIO); + + /* + * Begin processing loop + */ + + connflag = TRUE; + for (;;) { + + /* + * Test connection status + */ + + tcp_status(s,&connflag,&rxdata,NULL); + if (connflag != TCPSTATUS_CONNECTED) { + goto remdisc; + } + + /* + * Process received data + */ + + if (rxdata != 0) { + res = tcp_recv(s,data,sizeof(data)); + if (res > 0) { + console_write(data,res); + } + if (res < 0) { + ui_showerror(res,"TCP read error"); + break; + } + } + + /* + * Process transmitted data + */ + + if (console_status()) { + console_read(data,1); + if (tilde == 1) { + if (data[0] == '.') break; + tcp_send(s,data,1); + } + else { + if (data[0] == '~') tilde = 1; + else tcp_send(s,data,1); + } + } + + /* + * Give the background a chance + */ + + POLL(); + } + + printf("Disconnecting..."); + tcp_close(s); + printf("done.\n"); + return 0; + +remdisc: + printf("Remote host is no longer connected.\n"); + tcp_close(s); + return 0; +} + + + +static int ui_cmd_connect(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int s; + uint8_t hostaddr[IP_ADDR_LEN]; + char *host; + char *port; + int res; + int connflag; + int rxdata; + uint8_t data[100]; + int quiet; + int discard; + int total = 0; + int total2 = 0; + char b = 0; + cfe_timer_t t; + char *bigbuf; + int nodelay; + char *sport = NULL; + + bigbuf = KMALLOC(4096,0); + for (res = 0; res < 4096; res++) bigbuf[res] = 'A'+(res%26); + + quiet = cmd_sw_isset(cmd,"-q"); + discard = cmd_sw_isset(cmd,"-d"); + nodelay = cmd_sw_isset(cmd,"-nodelay"); + + host = cmd_getarg(cmd,0); + if (!host) return -1; + + port = cmd_getarg(cmd,1); + if (!port) port = "23"; + + if (strcmp(port,"discard") == 0) port = "9"; + else if (strcmp(port,"chargen") == 0) port = "19"; + else if (strcmp(port,"echo") == 0) port = "7"; + + if (isdigit(*host)) { + if (parseipaddr(host,hostaddr) < 0) { + xprintf("Invalid IP address: %s\n",host); + return -1; + } + } + else { + res = dns_lookup(host,hostaddr); + if (res < 0) { + return ui_showerror(res,"Could not resolve IP address of host %s",host); + } + } + + + s = tcp_socket(); + + if (s < 0) { + return ui_showerror(s,"Could not create TCP socket"); + } + + if (cmd_sw_value(cmd,"-srcport",&sport)) { + res = tcp_bind(s,atoi(sport)); + if (res < 0) { + ui_showerror(res,"Could not bind to port %s",sport); + tcp_close(s); + return res; + } + } + + res = tcp_connect(s,hostaddr,atoi(port)); + if (res < 0) { + ui_showerror(res,"Could not connect to host %I",hostaddr); + tcp_close(s); + return res; + } + + TIMER_SET(t,CFE_HZ*30); + connflag = 0; + while (!TIMER_EXPIRED(t)) { + POLL(); + tcp_status(s,&connflag,NULL,NULL); + if (connflag == TCPSTATUS_CONNECTING) continue; + break; + } + + if (connflag != TCPSTATUS_CONNECTED) { + printf("Could not connect to remote host\n"); + tcp_close(s); + return -1; + } + else { + printf("Connected to remote host.\n"); + } + + + if (nodelay) tcp_setflags(s,TCPFLG_NODELAY); + + connflag = TRUE; + for (;;) { + tcp_status(s,&connflag,&rxdata,NULL); + if (connflag != TCPSTATUS_CONNECTED) { + printf("Remote host is no longer connected.\n"); + break; + } + if (rxdata != 0) { + res = tcp_recv(s,data,sizeof(data)); + if (res > 0) { + if (quiet) { + total += res; + if (total > 1000000) { + total -= 1000000; + printf("."); + } + } + else { + console_write(data,res); + } + } + if (res < 0) { + ui_showerror(res,"TCP read error"); + } + } + if (console_status()) { + console_read(data,1); + if (data[0] == 1) break; + else if (data[0] == 3) break; + else if (data[0] == 4) { + for (res = 0; res < 100; res++) data[res] = 'A'+(res%26); + tcp_send(s,data,100); + } + else if (data[0] == 5) tcp_send(s,bigbuf,2048); + else if (data[0] == 2) tcp_debug(s,0); + else tcp_send(s,data,1); + } + if (discard) { + res = rand() % sizeof(data); + memset(data,b,res); + b++; + res = tcp_send(s,data,res); + if (res > 0) { + total2 += res; + if (total2 > 1000000) { + total2 -= 1000000; + printf("+"); + } + } + + } + + POLL(); + } + + printf("Disconnecting..."); + tcp_close(s); + printf("done.\n"); + + KFREE(bigbuf); + + return 0; +} + + +static int ui_cmd_listen(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int s; + char *port; + int res; + int connflag; + int rxdata; + uint8_t data[100]; + int quiet; + int discard; + int total = 0; + int total2 = 0; + char b = 0; + char *bigbuf; + uint16_t p; + uint16_t remport; + uint8_t remaddr[IP_ADDR_LEN]; + int nodelay; + + bigbuf = KMALLOC(4096,0); + for (res = 0; res < 4096; res++) bigbuf[res] = 'A'+(res%26); + + quiet = cmd_sw_isset(cmd,"-q"); + discard = cmd_sw_isset(cmd,"-d"); + nodelay = cmd_sw_isset(cmd,"-nodelay"); + + port = cmd_getarg(cmd,0); + if (!port) port = "1234"; + p = atoi(port); + + s = tcp_socket(); + + if (s < 0) { + return ui_showerror(s,"Could not create TCP socket"); + } + + res = tcp_listen(s,p); + if (res < 0) { + ui_showerror(res,"Could not set socket to listen"); + tcp_close(s); + return res; + } + + printf("Listening..."); + connflag = FALSE; + for (;;) { + if (console_status()) break; + tcp_status(s,&connflag,NULL,NULL); + if (connflag == TCPSTATUS_CONNECTED) break; + POLL(); + } + + if (connflag != TCPSTATUS_CONNECTED) { + printf("No connection received from remote host\n"); + tcp_close(s); + return -1; + } + + tcp_peeraddr(s,remaddr,&remport); + printf("Connection from port %u on %I\n",remport,remaddr); + + if (nodelay) tcp_setflags(s,TCPFLG_NODELAY); + + connflag = TRUE; + for (;;) { + tcp_status(s,&connflag,&rxdata,NULL); + if (connflag != TCPSTATUS_CONNECTED) { + printf("Remote host is no longer connected.\n"); + break; + } + if (rxdata != 0) { + res = tcp_recv(s,data,sizeof(data)); + if (res > 0) { + if (quiet) { + total += res; + if (total > 1000000) { + total -= 1000000; + printf("."); + } + } + else { + console_write(data,res); + } + } + if (res < 0) { + ui_showerror(res,"TCP read error"); + } + } + if (console_status()) { + console_read(data,1); + if (data[0] == 1) break; + if (data[0] == 3) break; + if (data[0] == 4) { + for (res = 0; res < 100; res++) data[res] = 'A'+(res%26); + tcp_send(s,data,100); + } + if (data[0] == 5) tcp_send(s,bigbuf,2048); + if (data[0] == 2) tcp_debug(s,0); + else tcp_send(s,data,1); + } + if (discard) { + res = rand() % sizeof(data); + memset(data,b,res); + b++; + res = tcp_send(s,data,res); + if (res > 0) { + total2 += res; + if (total2 > 1000000) { + total2 -= 1000000; + printf("+"); + } + } + + } + + POLL(); + } + + + printf("Disconnecting..."); + tcp_close(s); + printf("done.\n"); + + KFREE(bigbuf); + + return 0; +} + + +static int ui_cmd_tcpconstest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *x; + int fh; + int res; + uint8_t data[100]; + + x = cmd_getarg(cmd,0); + if (!x) return ui_showusage(cmd); + + fh = cfe_open(x); + if (fh < 0) return ui_showerror(fh,"Could not open device %s",x); + + for (;;) { + if (console_status()) break; + res = cfe_read(fh,data,sizeof(data)); + if (res < 0) { + ui_showerror(res,"could not read data"); + break; + } + console_write(data,res); + } + + cfe_close(fh); + + return 0; +} + +static int ui_cmd_ttcp(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int s; + uint8_t hostaddr[IP_ADDR_LEN]; + char *host; + int res; + int totalbytes = 0; + int totalbufs = 0; + cfe_timer_t start_time; + cfe_timer_t stop_time; + cfe_timer_t t; + int connflag; + char *bigbuf; + int nodelay; + int numbuf; + int buflen; + int txmode,rxmode; + uint16_t port; + + char *x; + + if (cmd_sw_value(cmd,"-n",&x)) numbuf = atoi(x); + else numbuf = 2048; + + if (cmd_sw_value(cmd,"-l",&x)) buflen = atoi(x); + else buflen = 2048; + + if (cmd_sw_value(cmd,"-p",&x)) port = atoi(x); + else port = 5001; + + if ((numbuf == 0) || (buflen == 0)) return ui_showusage(cmd); + + + bigbuf = KMALLOC(buflen,0); + for (res = 0; res < buflen; res++) bigbuf[res] = 'A'+(res%26); + + txmode = cmd_sw_isset(cmd,"-t"); + rxmode = cmd_sw_isset(cmd,"-r"); + + if (!(txmode ^ rxmode)) { + return ui_showerror(-1,"You must specify one of -t or -r"); + } + + nodelay = cmd_sw_isset(cmd,"-D"); + + if (txmode) { + host = cmd_getarg(cmd,0); + if (!host) return ui_showusage(cmd); + + if (isdigit(*host)) { + if (parseipaddr(host,hostaddr) < 0) { + return ui_showerror(-1,"Invalid IP address: %s\n",host); + } + } + else { + res = dns_lookup(host,hostaddr); + if (res < 0) { + return ui_showerror(res,"Could not resolve IP address of host %s",host); + } + } + } + + + s = tcp_socket(); + + if (s < 0) { + return ui_showerror(s,"Could not create TCP socket"); + } + + + if (txmode) { + res = tcp_connect(s,hostaddr,port); + if (res < 0) { + ui_showerror(res,"Could not connect to host %I",hostaddr); + tcp_close(s); + return res; + } + + TIMER_SET(t,CFE_HZ*30); + connflag = 0; + while (!TIMER_EXPIRED(t)) { + POLL(); + tcp_status(s,&connflag,NULL,NULL); + if (connflag == TCPSTATUS_CONNECTING) continue; + break; + } + + if (connflag != TCPSTATUS_CONNECTED) { + printf("Could not connect to remote host\n"); + tcp_close(s); + return -1; + } + else { + printf("Connected to remote host.\n"); + } + } + + if (rxmode) { + printf("Waiting for connection on port %d: ",port); + tcp_listen(s,port); + for (;;) { + if (console_status()) break; + tcp_status(s,&connflag,NULL,NULL); + if (connflag == TCPSTATUS_CONNECTED) break; + POLL(); + } + if (connflag != TCPSTATUS_CONNECTED) { + printf("No connection received from remote host\n"); + tcp_close(s); + return -1; + } + printf("done.\n"); + } + + + if (nodelay) tcp_setflags(s,TCPFLG_NODELAY); /* also sets blocking */ + else tcp_setflags(s,0); + + start_time = cfe_ticks; + + if (rxmode) { + while (1) { + POLL(); + res = tcp_recv(s,bigbuf,buflen); + if (res != buflen) break; + totalbytes += res; + totalbufs++; + } + } + else { + while (numbuf > 0) { + POLL(); + res = tcp_send(s,bigbuf,buflen); + if (res != buflen) break; + numbuf--; + totalbytes += res; + totalbufs++; + } + } + + stop_time = cfe_ticks; + + tcp_close(s); + + if ((res < 0) && !rxmode) { + ui_showerror(res,"Network I/O error"); + } + else { + printf("%d bytes transferred via %d calls in %lld ticks\n", + totalbytes,totalbufs,stop_time-start_time); + } + + + KFREE(bigbuf); + + return 0; + +} + +#endif /* CFG_TCP */ diff --git a/cfe/cfe/ui/ui_test_disk.c b/cfe/cfe/ui/ui_test_disk.c new file mode 100644 index 0000000..9e3e5f9 --- /dev/null +++ b/cfe/cfe/ui/ui_test_disk.c @@ -0,0 +1,439 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Commands to test block devices File: ui_test_disk.c + * + * Commands to manipulate block devices live here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_error.h" +#include "cfe_ioctl.h" +#include "cfe_devfuncs.h" +#include "ui_command.h" +#include "cfe.h" + +#include "cfe_fileops.h" +#include "cfe_bootblock.h" +#include "cfe_boot.h" + +static int ui_cmd_disktest(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_fstest(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_copydisk(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_bootblock(ui_cmdline_t *cmd,int argc,char *argv[]); + +int ui_init_disktestcmds(void); + +int ui_init_disktestcmds(void) +{ + + cmd_addcmd("test disk", + ui_cmd_disktest, + NULL, + "Do a disk test, read/write sectors on the disk", + "test disk device-name [-random | sector# | {-w sector offset byte}]", + "-random;|" + "-w;Write a byte at offset in sector.**DANGER!! BE CAREFUL WHICH DEVICE YOU WRITE TO.**"); + + cmd_addcmd("test fatfs", + ui_cmd_fstest, + NULL, + "Do a FAT file system test", + "test fatfs device-name", + ""); + + cmd_addcmd("copydisk", + ui_cmd_copydisk, + NULL, + "Copy a remote disk image to a local disk device via TFTP", + "copydisk host:filename device-name [offset]", + ""); + + cmd_addcmd("show boot", + ui_cmd_bootblock, + NULL, + "Display boot block from device,", + "show boot device-name\n\n" + "This command displays the boot block on the specified device. The\n" + "device-name parameter identifies a block device (disk, tape, CD-ROM)\n" + "to be scanned for boot blocks. The first boot block found will be\n" + "displayed.", + ""); + return 0; +} + + +static unsigned long rand(void) +{ + static unsigned long seed = 1; + long x, hi, lo, t; + + x = seed; + hi = x / 127773; + lo = x % 127773; + t = 16807 * lo - 2836 * hi; + if (t <= 0) t += 0x7fffffff; + seed = t; + return t; +} + + +static int ui_cmd_bootblock(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int fh; + char *tok; + struct boot_block bootblock; + int res; + int idx; + int sec; + uint32_t checksum; + uint32_t checksumd; + uint32_t calcsum; + uint32_t secsize; + uint64_t secoffset; + uint8_t *code; + + tok = cmd_getarg(cmd,0); + if (!tok) return -1; + + fh = cfe_open(tok); + if (fh < 0) { + xprintf("Could not open device; %d\n",fh); + return -1; + } + for (sec = 0; sec < BOOT_BLOCK_MAXLOC; sec++) { + res = cfe_readblk(fh,sec * BOOT_BLOCK_BLOCKSIZE, + (unsigned char *) &bootblock,sizeof(bootblock)); + + if (bootblock.bb_magic != BOOT_MAGIC_NUMBER) { + continue; + } + xprintf("Found boot block in sector %d\n", sec); + if (res != sizeof(bootblock)) { + xprintf("Could not read boot block\n"); + cfe_close(fh); + return -1; + } + + xprintf("Boot block data:\n"); + for (idx = 59; idx < 64; idx++) { + xprintf(" %d: %016llX\n",idx,bootblock.bb_data[idx]); + } + xprintf("\n"); + + xprintf("Boot block version is %d\n", + (uint32_t) ((bootblock.bb_hdrinfo & BOOT_HDR_VER_MASK) >> BOOT_HDR_VER_SHIFT)); + xprintf("Boot block flags are %02X\n", + (uint32_t) ((bootblock.bb_hdrinfo & BOOT_HDR_FLAGS_MASK) >> 56)); + checksum = ((uint32_t) (bootblock.bb_hdrinfo & BOOT_HDR_CHECKSUM_MASK)); + checksumd = ((uint32_t) ((bootblock.bb_secsize & BOOT_DATA_CHECKSUM_MASK) >> BOOT_DATA_CHECKSUM_SHIFT)); + bootblock.bb_hdrinfo &= ~BOOT_HDR_CHECKSUM_MASK; + secsize = ((uint32_t) (bootblock.bb_secsize & BOOT_SECSIZE_MASK)); + secoffset = bootblock.bb_secstart; + + xprintf("Boot code is %d bytes at %016llX\n",secsize,secoffset); + + CHECKSUM_BOOT_DATA(&(bootblock.bb_magic),BOOT_BLOCK_SIZE,&calcsum); + + if (checksum != calcsum) { + xprintf("Header checksum does not match Blk=%08X Calc=%08X\n", + checksum,calcsum); + } + else { + xprintf("Header checksum is ok\n"); + } + + code = KMALLOC(secsize,0); + if (code) { + res = cfe_readblk(fh,secoffset,code,secsize); + if (res != secsize) { + xprintf("Could not read boot code\n"); + cfe_close(fh); + KFREE(code); + return -1; + } + CHECKSUM_BOOT_DATA(code,secsize,&calcsum); + if (calcsum == checksumd) xprintf("Boot code checksum is ok\n"); + else xprintf("Boot code checksum is incorrect (Calc=%08X, Blk=%08X)\n", + calcsum,checksumd); + KFREE(code); + } + break; + } + if (sec == BOOT_BLOCK_MAXLOC) { + xprintf("No valid boot blocks found in the first %d sectors\n", + BOOT_BLOCK_MAXLOC); + } + cfe_close(fh); + + return 0; +} + + + + + +extern int fatfs_fileop_dir(void *fsctx); + +static int ui_cmd_fstest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *tok; + char *fname; + fileio_ctx_t *fsctx; + void *filectx; + uint8_t buffer[1000]; + int res; + int total; + + tok = cmd_getarg(cmd,0); + if (!tok) return -1; + + fname = cmd_getarg(cmd,1); + + res = fs_init("fat",&fsctx,tok); + if (res < 0) { + xprintf("Could not init file system: %s\n",cfe_errortext(res)); + return res; + } + + if (!fname) { + fatfs_fileop_dir(fsctx->fsctx); + } + else { + res = fs_open(fsctx,&filectx,fname,FILE_MODE_READ); + if (res < 0) { + xprintf("Could not open %s: %s\n",fname,cfe_errortext(res)); + } + else { + + total = 0; + for (;;) { + res = fs_read(fsctx,filectx,buffer,sizeof(buffer)); + if (res < 0) break; + total += res; + if (res != sizeof(buffer)) break; + xprintf("."); + } + if (res < 0) xprintf("read error %s\n",cfe_errortext(res)); + else xprintf("Total bytes read: %d\n",total); + fs_close(fsctx,filectx); + } + } + + fs_uninit(fsctx); + return 0; +} + +static int ui_cmd_copydisk(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *fname; + fileio_ctx_t *fsctx; + void *filectx; + char *devname; + uint8_t buffer[1024]; + int fh; + int res; + int total; + int count; + int offset; + char *toffset; + + fname = cmd_getarg(cmd,0); + if (!fname) return ui_showusage(cmd); + + devname = cmd_getarg(cmd,1); + if (!devname) return ui_showusage(cmd); + + toffset = cmd_getarg(cmd,2); + if (!toffset) offset = 0; else offset = atoi(toffset); + + if ((cfe_getdevinfo(devname) & CFE_DEV_MASK) != CFE_DEV_DISK) { + xprintf("Device %s is not a disk.\n",devname); + return CFE_ERR_INV_PARAM; + } + + fh = cfe_open(devname); + if (fh < 0) { + return ui_showerror(fh,"Could not open device %s",devname); + } + + res = fs_init("tftp",&fsctx,""); + if (res < 0) { + return ui_showerror(res,"Could not init file system"); + } + + res = fs_open(fsctx,&filectx,fname,FILE_MODE_READ); + if (res < 0) { + return ui_showerror(res,"Could not open %s",fname); + } + else { + total = 0; + count = 0; + for (;;) { + res = fs_read(fsctx,filectx,buffer,sizeof(buffer)); + if (res < 0) break; + if (res > 0) cfe_writeblk(fh,total+offset*512,buffer,res); + total += res; + if (res != sizeof(buffer)) break; + count++; + if (count == 256) { + xprintf("."); + count = 0; + } + } + if (res < 0) xprintf("read error %s\n",cfe_errortext(res)); + else xprintf("Total bytes read: %d\n",total); + fs_close(fsctx,filectx); + } + + fs_uninit(fsctx); + cfe_close(fh); + return 0; +} + +static int ui_cmd_disktest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int fh; + char *tok; + char *tok2; + char *tok3; + char *tok4; + cfe_offset_t offset; + uint64_t sectors; + int secsize; + long secnum = 0; + unsigned char buffer[2048]; + int res; + int idx,idx2; + int count = 0; + uint8_t byte; + int secoffset = 0; + + tok = cmd_getarg(cmd,0); + if (!tok) return -1; + + tok2 = cmd_getarg(cmd,1); + tok3 = cmd_getarg(cmd,2); + tok4 = cmd_getarg(cmd,3); + + fh = cfe_open(tok); + if (fh <= 0) { + xprintf("Could not open device: %s\n",cfe_errortext(fh)); + return fh; + } + + xprintf("device opened ok\n"); + + sectors = 0; secsize = 0; + cfe_ioctl(fh,IOCTL_BLOCK_GETTOTALBLOCKS,(uint8_t *) §ors,sizeof(sectors),&res,0); + cfe_ioctl(fh,IOCTL_BLOCK_GETBLOCKSIZE,(uint8_t *) &secsize,sizeof(secsize),&res,0); + printf("Total sectors: %lld Sector size: %d\n",sectors,secsize); + if (secsize == 0) secsize = 512; + if (sectors == 0) sectors = 100000; + + if (tok2) { + secnum = atoi(tok2); + offset = (cfe_offset_t) secnum * (cfe_offset_t) secsize; + if (cmd_sw_isset(cmd,"-w")) { + secoffset = atoi(tok3); + byte = (uint8_t) xtoq(tok4); + res = cfe_writeblk(fh,offset+secoffset,&byte,1); + if (res != 1) { + xprintf("Write failed\n"); + return -1; + } + } + res = cfe_readblk(fh,offset,buffer,secsize); + if (res != secsize) { + xprintf("disk error: %d sector %d\n",res,secnum); + } + else { + for (idx = 0; idx < secsize; idx+=16) { + xprintf("%04X: ",idx); + for (idx2 = 0; idx2 < 16; idx2++) { + xprintf("%02X ",buffer[idx+idx2]); + } + for (idx2 = 0; idx2 < 16; idx2++) { + if ((buffer[idx+idx2] < 32) || + (buffer[idx+idx2] > 127)) { + xprintf("."); + } + else { + xprintf("%c",buffer[idx+idx2]); + } + } + xprintf("\n"); + } + } + } + else { + if (cmd_sw_isset(cmd,"-random")) { + while (!console_status()) { + secnum++; + secnum = rand() % sectors; + offset = (cfe_offset_t) secnum * (cfe_offset_t) secsize; + res = cfe_readblk(fh,offset,buffer,secsize); + if (res != secsize) { + xprintf("disk error: %d sector %d\n",res,secnum); + break; + } + count++; + if ((count % 1000) == 0) xprintf("%d ",count); + } + } + } + + cfe_close(fh); + + return 0; +} + + + diff --git a/cfe/cfe/ui/ui_test_ether.c b/cfe/cfe/ui/ui_test_ether.c new file mode 100644 index 0000000..9a0b328 --- /dev/null +++ b/cfe/cfe/ui/ui_test_ether.c @@ -0,0 +1,202 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Ethernet test commands File: ui_test_ether.c + * + * User interface commands to test Ethernet devices + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_error.h" +#include "cfe_ioctl.h" +#include "cfe_devfuncs.h" +#include "ui_command.h" +#include "cfe.h" + +typedef struct netparam_s { + const char *str; + int num; +} netparam_t; + +const static netparam_t speedtypes[] = { + {"auto",ETHER_SPEED_AUTO}, + {"10hdx",ETHER_SPEED_10HDX}, + {"10fdx",ETHER_SPEED_10FDX}, + {"100hdx",ETHER_SPEED_100HDX}, + {"100fdx",ETHER_SPEED_100FDX}, + {"1000hdx",ETHER_SPEED_1000HDX}, + {"1000fdx",ETHER_SPEED_1000FDX}, + {0,NULL}}; + + +int ui_init_ethertestcmds(void); + +static int ui_cmd_ethertest(ui_cmdline_t *cmd,int argc,char *argv[]); + +int ui_init_ethertestcmds(void) +{ + cmd_addcmd("test ether", + ui_cmd_ethertest, + NULL, + "Do an ethernet test, reading packets from the net", + "test ether device-name", + "-speed=*;Specify speed|" + "-q;Be quiet|" + "-send=*;Transmit packets" + ); + + return 0; +} + + +static int ui_ifconfig_lookup(char *name,char *val,const netparam_t *list) +{ + const netparam_t *p = list; + + while (p->str) { + if (strcmp(p->str,val) == 0) return p->num; + p++; + } + + xprintf("Invalid parameter for %s: Valid options are: "); + + p = list; + while (p->str) { + xprintf("%s ",p->str); + p++; + } + + xprintf("\n"); + return -1; +} + +static int ui_cmd_ethertest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *tok; + int fh; + uint8_t packet[2048]; + int res; + int idx; + int speed = ETHER_SPEED_AUTO; + char *x; + int count = 0; + int quiet; + + tok = cmd_getarg(cmd,0); + if (!tok) return -1; + + if (cmd_sw_value(cmd,"-speed",&x)) { + speed = ui_ifconfig_lookup("-speed",x,speedtypes); + if (speed < 0) return CFE_ERR_INV_PARAM; + } + + quiet = cmd_sw_isset(cmd,"-q"); + + + fh = cfe_open(tok); + if (fh < 0) { + xprintf("Could not open device: %s\n",cfe_errortext(fh)); + return fh; + } + + if (speed != ETHER_SPEED_AUTO) { + xprintf("Setting speed to %d...\n",speed); + cfe_ioctl(fh,IOCTL_ETHER_SETSPEED,(uint8_t *) &speed,sizeof(speed),&idx,0); + } + + + if (cmd_sw_value(cmd,"-send",&x)) { + count = atoi(x); + memset(packet,0xEE,sizeof(packet)); + memcpy(packet,"\xFF\xFF\xFF\xFF\xFF\xFF\x40\x00\x00\x10\x00\x00\x12\x34",16); + res = 0; + for (idx = 0; idx < count; idx++) { + res = cfe_write(fh,packet,128); + if (res < 0) break; + } + if (res) { + ui_showerror(res,"Could not transmit packet"); + } + cfe_close(fh); + return 0; + } + + xprintf("Receiving... press enter to stop\n"); + while (!console_status()) { + res = cfe_read(fh,packet,sizeof(packet)); + if (res == 0) continue; + if (res < 0) { + xprintf("Read error: %s\n",cfe_errortext(res)); + break; + } + + if (!quiet) { + xprintf("%4d ",res); + if (res > 32) res = 32; + + for (idx = 0; idx < res; idx++) { + xprintf("%02X",packet[idx]); + if ((idx == 5) || (idx == 11) || (idx == 13)) xprintf(" "); + } + + xprintf("\n"); + } + + count++; + if (quiet && !(count % 1000)) printf("."); + } + + printf("Total packets received: %d\n",count); + + cfe_close(fh); + + return 0; +} + diff --git a/cfe/cfe/ui/ui_test_flash.c b/cfe/cfe/ui/ui_test_flash.c new file mode 100644 index 0000000..841d3fa --- /dev/null +++ b/cfe/cfe/ui/ui_test_flash.c @@ -0,0 +1,260 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Flash Test commands File: ui_test_flash.c + * + * Some commands to test the flash device interface. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" +#include "cfe_ioctl.h" + +#include "cfe_error.h" + +#include "ui_command.h" + +int ui_init_flashtestcmds(void); + +static int ui_cmd_flashtest(ui_cmdline_t *cmd,int argc,char *argv[]); +//static int ui_cmd_readnvram(ui_cmdline_t *cmd,int argc,char *argv[]); +//static int ui_cmd_erasenvram(ui_cmdline_t *cmd,int argc,char *argv[]); + +int ui_init_flashtestcmds(void) +{ + cmd_addcmd("show flash", + ui_cmd_flashtest, + NULL, + "Display information about a flash device.", + "show flash [-sectors]", + "-sectors;Display sector information"); + +#if 0 + cmd_addcmd("nvram read", + ui_cmd_readnvram, + NULL, + "read the NVRAM", + "test nvram devname offset", + ""); + + cmd_addcmd("nvram erase", + ui_cmd_erasenvram, + NULL, + "erase the NVRAM", + "erasenvram devname", + "-pattern"); +#endif + + + return 0; +} + + +static char *flashtypes[] = { + "Unknown","SRAM","ROM","Flash" +}; + + +static int ui_cmd_flashtest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + flash_info_t info; + int fd; + int retlen; + int res = 0; + int idx; + flash_sector_t sector; + nvram_info_t nvraminfo; + char *devname; + int showsectors; + + devname = cmd_getarg(cmd,0); + if (!devname) return ui_showusage(cmd); + + showsectors = cmd_sw_isset(cmd,"-sectors"); + + fd = cfe_open(devname); + if (fd < 0) { + ui_showerror(fd,"Could not open flash device %s",devname); + return fd; + } + + res = cfe_ioctl(fd,IOCTL_FLASH_GETINFO,(uint8_t *) &info,sizeof(flash_info_t),&retlen,0); + if (res == 0) { + printf("FLASH: Base %016llX size %08X type %02X(%s) flags %08X\n", + info.flash_base,info.flash_size,info.flash_type,flashtypes[info.flash_type], + info.flash_flags); + } + else { + printf("FLASH: Could not determine flash information\n"); + } + + res = cfe_ioctl(fd,IOCTL_NVRAM_GETINFO,(uint8_t *) &nvraminfo,sizeof(nvram_info_t),&retlen,0); + if (res == 0) { + printf("NVRAM: Offset %08X Size %08X EraseFlg %d\n", + nvraminfo.nvram_offset,nvraminfo.nvram_size,nvraminfo.nvram_eraseflg); + } + else { + printf("NVRAM: Not supported by this flash\n"); + } + + if (showsectors && (info.flash_type == FLASH_TYPE_FLASH)) { + printf("Flash sector information:\n"); + + idx = 0; + for (;;) { + sector.flash_sector_idx = idx; + res = cfe_ioctl(fd,IOCTL_FLASH_GETSECTORS,(uint8_t *) §or,sizeof(flash_sector_t),&retlen,0); + if (res != 0) { + printf("ioctl error\n"); + break; + } + if (sector.flash_sector_status == FLASH_SECTOR_INVALID) break; + printf(" Sector %d offset %08X size %d\n", + sector.flash_sector_idx, + sector.flash_sector_offset, + sector.flash_sector_size); + idx++; + } + } + + cfe_close(fd); + return 0; + +} + + +#if 0 +static int ui_cmd_readnvram(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *dev; + char *tok; + int fd; + int offset = 0; + int res; + uint8_t buf[512]; + int idx; + + dev = cmd_getarg(cmd,0); + if (!dev) return ui_showusage(cmd); + + tok = cmd_getarg(cmd,1); + if (tok) offset = xtoi(tok); + else offset = 0; + + fd = cfe_open(dev); + if (fd < 0) { + ui_showerror(fd,"could not open NVRAM"); + return fd; + } + + res = cfe_readblk(fd,offset,buf,512); + printf("Offset %d Result %d\n",offset,res); + for (idx = 0; idx < 512; idx++) { + if ((idx % 16) == 0) printf("\n"); + printf("%02X ",buf[idx]); + } + printf("\n"); + + cfe_close(fd); + return 0; + +} + +static int ui_cmd_erasenvram(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *dev; + int fd; + uint8_t buffer[2048]; + int res; + char *tok; + int offset; + int length; + uint8_t data; + + dev = cmd_getarg(cmd,0); + if (!dev) return ui_showusage(cmd); + + offset = 0; + if ((tok = cmd_getarg(cmd,1))) offset = xtoi(tok); + length = 512; + + if ((tok = cmd_getarg(cmd,2))) length = xtoi(tok); + if (length > 2048) length = 2048; + + data = 0xFF; + if ((tok = cmd_getarg(cmd,3))) data = xtoi(tok); + + fd = cfe_open(dev); + if (fd < 0) { + ui_showerror(fd,"could not open NVRAM"); + return fd; + } + + if (cmd_sw_isset(cmd,"-pattern")) { + memset(buffer,0,sizeof(buffer)); + for (res = 0; res < 2048; res++) { + buffer[res] = res & 0xFF; + } + } + else memset(buffer,data,sizeof(buffer)); + + printf("Fill offset %04X length %04X\n",offset,length); + + res = cfe_writeblk(fd,offset,buffer,length); + + printf("write returned %d\n",res); + + cfe_close(fd); + return 0; + +} +#endif + diff --git a/cfe/cfe/ui/ui_test_uart.c b/cfe/cfe/ui/ui_test_uart.c new file mode 100644 index 0000000..3eeaef0 --- /dev/null +++ b/cfe/cfe/ui/ui_test_uart.c @@ -0,0 +1,117 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * UART Test commands File: ui_test_uart.c + * + * Some commands to test the uart device interface. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" +#include "cfe_ioctl.h" + +#include "cfe_error.h" + +#include "ui_command.h" + +int ui_init_uarttestcmds(void); + +static int ui_cmd_uarttest(ui_cmdline_t *cmd,int argc,char *argv[]); + +int ui_init_uarttestcmds(void) +{ + cmd_addcmd("test uart", + ui_cmd_uarttest, + NULL, + "Echo characters to a UART", + "test uart [devname]", + ""); + return 0; +} + + +static int ui_cmd_uarttest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int fd; + char *x; + char ch; + int res; + char buffer[64]; + + x = cmd_getarg(cmd,0); + if (!x) return ui_showusage(cmd); + + fd = cfe_open(x); + if (fd < 0) { + ui_showerror(fd,"could not open %s",x); + return fd; + } + + printf("Device open. Stuff you type here goes there. Type ~ to exit.\n"); + for (;;) { + if (console_status()) { + console_read(&ch,1); + res = cfe_write(fd,&ch,1); + if (res < 0) break; + if (ch == '~') break; + } + if (cfe_inpstat(fd)) { + res = cfe_read(fd,buffer,sizeof(buffer)); + if (res > 0) console_write(buffer,res); + if (res < 0) break; + } + POLL(); + } + + cfe_close(fd); + return 0; +} + diff --git a/cfe/cfe/ui/ui_tftpd.c b/cfe/cfe/ui/ui_tftpd.c new file mode 100755 index 0000000..6cd2e4e --- /dev/null +++ b/cfe/cfe/ui/ui_tftpd.c @@ -0,0 +1,119 @@ +/*************************************************************************** +*** +*** Copyright 2005 Hon Hai Precision Ind. Co. Ltd. +*** All Rights Reserved. +*** No portions of this material shall be reproduced in any form without the +*** written permission of Hon Hai Precision Ind. Co. Ltd. +*** +*** All information contained in this document is Hon Hai Precision Ind. +*** Co. Ltd. company private, proprietary, and trade secret property and +*** are protected by international intellectual property laws and treaties. +*** +****************************************************************************/ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_error.h" + +#include "ui_command.h" +#include "cfe.h" + +#include "cfe_fileops.h" +#include "cfe_boot.h" +#include "bsp_config.h" + +#include "cfe_loader.h" + +#include "net_ebuf.h" +#include "net_ether.h" +#include "net_api.h" + +#include "cfe_flashimage.h" + +#include "addrspace.h" +#include "initdata.h" +#include "url.h" + +#include "tftpd.h" + +int ui_init_tftpdcmds(void); + +static int tftpd_state = TFTPD_STATE_OFF; + +extern int tftp_recv_timeout; + +int get_tftpd_state(void) +{ + return tftpd_state; +} + +int set_tftpd_state(int state) +{ + tftpd_state = state; + return 0; +} + +static int ui_cmd_tftpd(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int ret; + + xprintf("enter ui_cmd_tftpd \n"); + + if( (argc==1) && strcmp(argv[0], "nmrp") == 0 ) + { + xprintf("Start TFTP server for nmrp \n"); + ret = ui_docommand("flashimage nmrp"); + if (ret == CFE_ERR_TIMEOUT || ret == CFE_ERR_BADIMAGE || ret == CFE_ERR_IOERR || (ret == -24)) + { + //printf("Upgrade image failed!\n"); + return -1; + } + else + { + //printf("Upgrade image success!\n"); + return 0; + } + + + } + else + { + xprintf("Start TFTP server\n"); + /* Extend the TFTP server timeout */ + tftp_recv_timeout = 99999; + + while (1) + { + /* Foxconn modified start pling 12/04/2008 */ + //ret = ui_docommand("flash -writechksum : flash1.trx"); + ret = ui_docommand("flashimage :"); + /* Foxconn modified end pling 12/04/2008 */ + if (ret == CFE_ERR_TIMEOUT || ret == CFE_ERR_BADIMAGE || ret == CFE_ERR_IOERR) + continue; + else + break; + } + ui_docommand("reset"); + return 0; + } + +} +int ui_init_tftpdcmds(void) +{ + cmd_addcmd("tftpd", + ui_cmd_tftpd, + NULL, + "Start TFTP server", + "tftpd", + ""); + + return 0; +} diff --git a/cfe/cfe/ui/ui_toyclock.c b/cfe/cfe/ui/ui_toyclock.c new file mode 100644 index 0000000..7fdcf49 --- /dev/null +++ b/cfe/cfe/ui/ui_toyclock.c @@ -0,0 +1,275 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * SWARM toy clock commands File: ui_toyclock.c + * + * time-of-year clock + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_error.h" + +#include "ui_command.h" +#include "cfe.h" + +#include "bsp_config.h" + +/* ********************************************************************* + * prototypes + ********************************************************************* */ + +int ui_init_toyclockcmds(void); + +static int ui_cmd_showtime(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_settime(ui_cmdline_t *cmd,int argc,char *argv[]); +static int ui_cmd_setdate(ui_cmdline_t *cmd,int argc,char *argv[]); + +/* ********************************************************************* + * ui_init_toyclockcmds() + * + * Add toy clock commands to the command table + * + * Input parameters: + * nothing + * + * Return value: + * 0 + ********************************************************************* */ +int ui_init_toyclockcmds(void) +{ + + cmd_addcmd("show time", + ui_cmd_showtime, + NULL, + "Display current time according to RTC", + "show time", + ""); + + cmd_addcmd("set time", + ui_cmd_settime, + NULL, + "Set current time", + "set time hh:mm:ss", + ""); + + cmd_addcmd("set date", + ui_cmd_setdate, + NULL, + "Set current date", + "set date mm/dd/yyyy", + ""); + + return 0; +} + +/* ********************************************************************* + * User interface commands + ********************************************************************* */ + +static int ui_cmd_settime(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *line; + char *p; + int hr,min,sec; + int fd; + uint8_t buf[12]; + int res=0; + + if ((line = cmd_getarg(cmd,0)) == NULL) { + return ui_showusage(cmd); + } + + /* convert colons to spaces for the gettoken routine */ + while ((p = strchr(line,':'))) *p = ' '; + + /* parse and check command-line args */ + hr = -1; min = -1; sec = -1; + + p = gettoken(&line); + if (p) hr = atoi(p); + p = gettoken(&line); + if (p) min = atoi(p); + p = gettoken(&line); + if (p) sec = atoi(p); + + if ((hr < 0) || (hr > 23) || + (min < 0) || (min >= 60) || + (sec < 0) || (sec >= 60)) { + return ui_showusage(cmd); + } + + /* + * hour-minute-second-month-day-year1-year2-(time/date flag) + * time/date flag (offset 7) is used to let device know what + * is being set. + */ + buf[0] = hr; + buf[1] = min; + buf[2] = sec; + buf[7] = 0x00; /*SET_TIME = 0x00, SET_DATE = 0x01*/ + + fd = cfe_open("clock0"); + if (fd < 0) { + ui_showerror(fd,"could not open clock device"); + return fd; + } + + res = cfe_write(fd,buf,8); + if (res < 0) { + ui_showerror(res,"could not set time"); + } + cfe_close(fd); + return 0; +} + +static int ui_cmd_setdate(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + char *line; + char *p; + int dt,mo,yr,y2k; + int fd; + uint8_t buf[12]; + int res=0; + + if ((line = cmd_getarg(cmd,0)) == NULL) { + return ui_showusage(cmd); + } + + /* convert colons to spaces for the gettoken routine */ + + while ((p = strchr(line,'/'))) *p = ' '; + + /* parse and check command-line args */ + + dt = -1; mo = -1; yr = -1; + + p = gettoken(&line); + if (p) mo = atoi(p); + p = gettoken(&line); + if (p) dt = atoi(p); + p = gettoken(&line); + if (p) yr = atoi(p); + + if ((mo <= 0) || (mo > 12) || + (dt <= 0) || (dt > 31) || + (yr < 1900) || (yr > 2099)) { + return ui_showusage(cmd); + } + + y2k = (yr >= 2000) ? 0x20 : 0x19; + yr %= 100; + + /* + * hour-minute-second-month-day-year1-year2-(time/date flag) + * time/date flag (offset 7) is used to let device know what + * is being set. + */ + buf[3] = mo; + buf[4] = dt; + buf[5] = yr; + buf[6] = y2k; + buf[7] = 0x01; /*SET_TIME = 0x00, SET_DATE = 0x01*/ + + fd = cfe_open("clock0"); + if (fd < 0) { + ui_showerror(fd,"could not open clock device"); + return fd; + } + + res = cfe_write(fd,buf,8); + if (res < 0) { + ui_showerror(res,"could not set date"); + } + + cfe_close(fd); + return 0; +} + + +static int ui_cmd_showtime(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + uint8_t hr,min,sec; + uint8_t mo,day,yr,y2k; + int res=0; + int fd; + uint8_t buf[12]; + + fd = cfe_open("clock0"); + if (fd < 0) { + ui_showerror(fd,"could not open clock device"); + return fd; + } + res = cfe_read(fd,buf,8); + if (res < 0) { + ui_showerror(res,"could not get time/date"); + } + cfe_close(fd); + + hr = buf[0]; + min = buf[1]; + sec = buf[2]; + mo = buf[3]; + day = buf[4]; + yr = buf[5]; + y2k = buf[6]; + + printf("Current date & time is: "); + printf("%02X/%02X/%02X%02X %02X:%02X:%02X\n",mo,day,y2k,yr,hr,min,sec); + + return 0; +} + + + + + + + diff --git a/cfe/cfe/ui/url.c b/cfe/cfe/ui/url.c new file mode 100644 index 0000000..80dc7b0 --- /dev/null +++ b/cfe/cfe/ui/url.c @@ -0,0 +1,357 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Program and file loading URLs File: url.c + * + * Functions to process URLs for loading software. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions as + * they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. Neither the "Broadcom + * Corporation" name nor any trademark or logo of Broadcom + * Corporation may be used to endorse or promote products + * derived from this software without the prior written + * permission of Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "bsp_config.h" +#include "cfe_loader.h" +#include "cfe_autoboot.h" +#include "cfe_iocb.h" +#include "cfe_devfuncs.h" +#include "cfe_fileops.h" +#include "cfe_error.h" + +#include "net_ebuf.h" +#include "net_ether.h" +#include "net_api.h" + +#include "ui_command.h" + +#include "url.h" + +static long getaddr(char *str) +{ + /* + * hold on to your lunch, this is really, really bad! + * Make 64-bit addresses expressed as 8-digit numbers + * sign extend automagically. Saves typing, but is very + * gross. Not very portable, either. + */ + int longaddr = 0; + long newaddr; + + longaddr = strlen(str); + if (memcmp(str,"0x",2) == 0) longaddr -= 2; + longaddr = (longaddr > 8) ? 1 : 0; + + if (longaddr) newaddr = (long) xtoq(str); + else newaddr = (long) xtoi(str); + + return newaddr; +} + +static int process_oldstyle(char *str, + ui_cmdline_t *cmd, + cfe_loadargs_t *la) +{ + char *file; + char *devname; + char *filesys = NULL; + char *loader = la->la_loader; + char *x; + int info; + char *colon; + + colon = strchr(str,':'); + + if (!colon) { + return CFE_ERR_DEVNOTFOUND; + } + + devname = str; /* will be used to check protocol later */ + *colon = '\0'; + file = colon + 1; /* Ugly, we might put the colon back! */ + + /* + * Try to determine the load protocol ("filesystem") + * first by using the command line, and + * if not that try to figure it out automagically + */ + + if (cmd_sw_isset(cmd,"-fatfs")) filesys = "fat"; + if (cmd_sw_isset(cmd,"-tftp")) filesys = "tftp"; + if (cmd_sw_isset(cmd,"-rawfs")) filesys = "raw"; +#if (CFG_TCP) && (CFG_HTTPFS) + if (cmd_sw_isset(cmd,"-http")) filesys = "http"; +#endif + if (cmd_sw_value(cmd,"-fs",&x)) filesys = x; + + /* + * Automagic configuration + */ + + /* + * Determine the device type from the "host" name. If we look + * up the host name and it appears to be an invalid CFE device + * name, then it's probably a TFTP host name. + * + * This is where we guess based on the device type what + * sort of load method we're going to use. + */ + + info = devname ? cfe_getdevinfo(devname) : -1; + if (info >= 0) { + switch (info & CFE_DEV_MASK) { + case CFE_DEV_NETWORK: + if (!filesys) filesys = "tftp"; + if (!loader) loader = "raw"; + break; + case CFE_DEV_DISK: + if (!filesys) filesys = "raw"; + if (!loader) loader = "raw"; + break; + case CFE_DEV_FLASH: + if (!filesys) filesys = "raw"; + if (!loader) loader = "raw"; + break; + case CFE_DEV_SERIAL: + if (!filesys) filesys = "raw"; + if (!loader) loader = "srec"; + break; + default: + break; + } + la->la_device = devname; + la->la_filename = file; + } + else { + /* + * It's probably a network boot. Default to TFTP + * if not overridden + */ +#if CFG_NETWORK + la->la_device = (char *) net_getparam(NET_DEVNAME); +#else + la->la_device = NULL; +#endif + *colon = ':'; /* put the colon back */ + la->la_filename = devname; + if (!filesys) filesys = "tftp"; + if (!loader) loader = "raw"; + } + + /* + * Remember our file system and loader. + */ + + la->la_filesys = filesys; + la->la_loader = loader; + + return 0; +} + + +#if CFG_URLS +static int process_url(char *str, + ui_cmdline_t *cmd, + cfe_loadargs_t *la) +{ + char *p; + char *protocol; + int idx,len; + int network = 0; + const fileio_dispatch_t *fdisp; + + /* + * All URLs have the string "://" in them somewhere + * If that's not there, try the old syntax. + */ + + len = strlen(str); + p = str; + + for (idx = 0; idx < len-3; idx++) { + if (memcmp(p,"://",3) == 0) break; + p++; + } + + if (idx == (len-3)) { + return process_oldstyle(str,cmd,la); + } + + /* + * Break the string apart into protocol, host, file + */ + + protocol = str; + *p = '\0'; + p += 3; + + /* + * Determine if this is a network loader. If that is true, + * the meaning of the "device" field is different. Ugh. + */ + + fdisp = cfe_findfilesys(protocol); + if (fdisp && (fdisp->loadflags & FSYS_TYPE_NETWORK)) network = 1; + + /* + * Depending on the protocol we parse the file name one of two ways: + * + * protocol://hostname/filename + * + * For network devices: + * + * the "device" is the current Ethernet device. + * The filename is the //hostname/filename from the URL. + * + * For non-network devices: + * + * The "device" is the CFE device name from the URL 'hostname' field + * The filename is from the URL filename field. + */ + + la->la_filesys = protocol; + + if (network) { +#if CFG_NETWORK + la->la_device = (char *) net_getparam(NET_DEVNAME); +#else + la->la_device = NULL; +#endif + la->la_filename = p; + } + else { + la->la_device = p; + p = strchr(p,'/'); + if (p) { + *p++ = '\0'; + la->la_filename = p; + } + else { + la->la_filename = NULL; + } + } + + if (!la->la_loader) la->la_loader = "raw"; + + return 0; +} +#endif + + + +int ui_process_url(char *url,ui_cmdline_t *cmd,cfe_loadargs_t *la) +{ + int res; + char *x; + + /* + * Skip leading whitespace + */ + + while (*url && ((*url == ' ') || (*url == '\t'))) url++; + + /* + * Process command-line switches to determine the loader stack + */ + + la->la_loader = NULL; + if (cmd_sw_isset(cmd,"-elf")) la->la_loader = "elf"; + if (cmd_sw_isset(cmd,"-srec")) la->la_loader = "srec"; + if (cmd_sw_isset(cmd,"-raw")) la->la_loader = "raw"; + if (cmd_sw_value(cmd,"-loader",&x)) la->la_loader = x; + +#if CFG_ZLIB + if (cmd_sw_isset(cmd,"-z")) { + la->la_flags |= LOADFLG_COMPRESSED; + } +#endif + + /* + * Parse the file name into its pieces. + */ + +#if CFG_URLS + res = process_url(url,cmd,la); + if (res < 0) return res; +#else + res = process_oldstyle(url,cmd,la); + if (res < 0) return res; +#endif + + + /* + * This is used only by "boot" and "load" - to avoid this code + * don't include these switches in the command table. + */ + + if (cmd_sw_value(cmd,"-max",&x)) { + la->la_maxsize = atoi(x); + } + + if (cmd_sw_value(cmd,"-addr",&x)) { + la->la_address = getaddr(x); + la->la_flags |= LOADFLG_SPECADDR; + } + + if (cmd_sw_isset(cmd,"-noclose")) { + la->la_flags |= LOADFLG_NOCLOSE; + } + +#if 0 + printf("--- Loader parameters:\n"); + printf(" Filename = %s\n",la->la_filename); + printf(" Filesys = %s\n",la->la_filesys); + printf(" Device = %s\n",la->la_device); + printf(" Options = %s\n",la->la_options); + printf(" Loader = %s\n",la->la_loader); + printf(" Flags = %08X\n",la->la_flags); + printf(" address = %08X\n",la->la_address); + printf(" maxsize = %08X\n",la->la_maxsize); + printf(" entrypt = %08X\n",la->la_entrypt); +#endif + + return 0; +} + + + diff --git a/cfe/cfe/ui/url.h b/cfe/cfe/ui/url.h new file mode 100644 index 0000000..268c7f8 --- /dev/null +++ b/cfe/cfe/ui/url.h @@ -0,0 +1,52 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Program and file loading URLs File: url.h + * + * Functions to process URLs for loading software. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions as + * they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. Neither the "Broadcom + * Corporation" name nor any trademark or logo of Broadcom + * Corporation may be used to endorse or promote products + * derived from this software without the prior written + * permission of Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ +#ifndef _URL_H_ +#define _URL_H_ 1 + +int ui_process_url(char *URL, ui_cmdline_t *cmd,cfe_loadargs_t *la); + +#endif /* _URL_H_ */ diff --git a/cfe/cfe/usb/Makefile b/cfe/cfe/usb/Makefile new file mode 100644 index 0000000..fa38870 --- /dev/null +++ b/cfe/cfe/usb/Makefile @@ -0,0 +1,8 @@ + +# +# Makefile for USB stuff +# + + +ALLOBJS += usbmain.o ohci.o usbd.o usbdevs.o usbhub.o usbdebug.o usbhid.o usbmass.o usbserial.o usbeth.o +CFLAGS += -DCFG_USB=1 diff --git a/cfe/cfe/usb/README b/cfe/cfe/usb/README new file mode 100644 index 0000000..28ac9bf --- /dev/null +++ b/cfe/cfe/usb/README @@ -0,0 +1,183 @@ + +------------------------------------------------------------------------ +This directory contains a basic description of the CFE USB stack, +its current status and features, and what might be done in the +future to improve it. +------------------------------------------------------------------------ + +Question: A USB stack in CFE? But why? + +Answer: Why not? It's not terribly useful on the BCM1250, since we + don't expect many of you to use USB in your boards, but there IS + a USB host controller on the SWARM (BCM1250 reference design). + Besides, CFE is actually being used for other non-SiByte + Broadcom chips, and some of those _do_ have USB on them. + +------------------------------------------------------------------------ + +Source Files +------------ + +ohci.c OHCI USB Host Controller Driver, tested on a BCM1250 + with an Opti FireLink PCI USB controller + +ohci.h Register definitions for ohci.c + +usbchap9.h USB "Chapter 9" definitions (Descriptors, etc.) + +usbd.c USB Basic Request and pipe management routines, to + manage usb devices, do simple requests on the + control pipe, open and manage pipes, etc. + +usbd.h Prototypes and data structures for usbd.c + +usbdevs.c USB Device Driver list - devices we recognize + are listed here - if you add a new USB device, + you can add its class or vendor ID entries + into the table here. + +usbdebug.c Some descriptor dump routines live here. + +usbhub.c Class driver for USB hubs. Because hubs are also + a major player in device discovery, much of the + USB device tree management also lives here. + +usbhid.c Class driver for keyboards and mice. Right now + not much is done with them except echo characters. + +usbmass.c Class driver for USB mass-storage devices. We only + support the "bulk-only-no-interrupt" protocol. + This driver also includes a top half so that + it can be accessed as a CFE mass-storage device. + +usbmain.c Top-level interface into CFE. The "usb start" + command is instantiated here, as well as a + "usb show" command to display attached USB devices. + +usbhack.c Main program for the test harness, which lets you + develop OHCI code under Linux without hacking on + either CFE or the kernel. See the comments in this + file for more information. + +usbhack.h A dumping ground for CFE definitions not otherwise + provided by the standard include files. + +usbhack.mk GNU makefile for the test harness + +------------------------------------------------------------------------ + +Overview +-------- + +The host controller driver is abstracted through a small set of +primitives defined in usbd.h - at present only the OHCI driver +is implemented, but there will eventually be support for the +ScanLogic SL11H part on the BCM1250CPCI board - this is a simple +"generic-bus" (non-pci) host controller. I doubt we'll ever +need EHCI/UHCI, since they are present mostly in Intel chipsets. + +All events are polled by this driver. There are two polling functions +that should be called periodically: + + usb_poll(usbbus_t *bus); + usb_daemon(usbbus_t *bus); + +The "poll" routine handles interrupts from the devices themselves. +The "daemon" routine monitors the bus for topology changes and +instantiates an exploration if something changes. Sometimes "daemon" +needs to do USB I/O, requiring calls to usb_poll() to get the data +to go in/out via the controller, hence the two routines. You should +be careful not to all usb_poll() during polling. + + +Device Drivers +-------------- + +USB Device drivers are currently extremely simple: There are +only two methods that need be exported to the device driver table: + +attach() Called when the device is "discovered" +detach() Called when the device is "removed" + +When a device is removed, pending transfer requests will be +canceled with a "canceled" status. + +There is no standard for the top side (user API side) of the +device driver, that is up to the device class. The bottom half +should make use of the calls in usbd.c + +When a device driver is attached via its attach() method, +it will be in the "addressed" state according to the USB spec. +The exploration code takes care of assigning the USB address +to the device. Devices not otherwise recognized by this code will +be left in the addressed state without any active configurations. + +The descriptors are read by the exploration code and are made +available to the usb_find_cfg_descr() call - you can use this +function to obtain the endpoint and interface descriptors for +your device and then call usb_set_configuration() to activate +the configuration. + +When your detach() method is called, the device should be considered +already gone, so do not attempt to do any I/O to it. Just clean +up the mess and return. + + +------------------------------------------------------------------------ + +What works? +----------- + +* OHCI on a BCM1250 via the Opti Firelink USB controller + +* The OHCI root hub emulation + +* External hubs, and hubs integrated into other devices like + keyboards. + +* Interrupt transfers + +* Transfers (basic requests) on endpoint 0 + +* Basic device discovery and removal + +* Bulk endpoints and transfers + +* Some endpoint stalls are handled. + + +------------------------------------------------------------------------ + +What doesn't work? What is not implemented? +-------------------------------------------- + +* The root hub implementation is really shaky, especially in + matters of plug-and-play (device insertion/removal events, + etc.) Don't be surprised if removing a device from the + root hub causes CFE to freeze. + +* There is no error recovery code whatsoever. This kind of goes + with the above root hub issue. + +* Noncoherent DMA is relatively untested. + +* Isochronous endpoints are completely unimplemented (and will probably + remain that way) + +* Power management (for example, power budget in hubs) is unimplemented. + (this should be easy) + +* Interrupt endpoints are all on the 10ms endpoint in the interrupt + tree (endpoints should be placed at the location to guarantee + bandwidth at 'bInterval' ms) - no bandwidth management is being + done at the moment, but this is pretty simple. + +* The OHCI driver cannot be stopped/unloaded. + + + + + + + + diff --git a/cfe/cfe/usb/ohci.c b/cfe/cfe/usb/ohci.c new file mode 100644 index 0000000..c002091 --- /dev/null +++ b/cfe/cfe/usb/ohci.c @@ -0,0 +1,2126 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * OHCI device driver File: ohci.c + * + * Open Host Controller Interface low-level routines + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _CFE_ +#include +#include +#include +#include +#include +#include "usbhack.h" +#define CPUCFG_COHERENT_DMA 1 /* hack runs on a PC, PCs are coherent */ +#else +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "lib_physio.h" +#include "addrspace.h" +#include "cpu_config.h" /* for CPUCFG_COHERENT_DMA */ +#endif + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" +#include "ohci.h" + + +/* ********************************************************************* + * Macros for dealing with hardware + * + * This is all yucky stuff that needs to be made more + * processor-independent. It's mostly here now to help us with + * our test harness. + ********************************************************************* */ + +#if defined(_CFE_) && defined(__MIPSEB) +#define BSWAP32(x) __swap32(x) +static inline uint32_t __swap32(uint32_t x) +{ + uint32_t y; + + y = ((x & 0xFF) << 24) | + ((x & 0xFF00) << 8) | + ((x & 0xFF0000) >> 8) | + ((x & 0xFF000000) >> 24); + + return y; +} +#else +#define BSWAP32(x) (x) +#endif + + +#ifndef _CFE_ +extern uint32_t vtop(void *ptr); +extern void *ptov(uint32_t x); +#define OHCI_VTOP(ptr) vtop(ptr) +#define OHCI_PTOV(ptr) ptov(ptr) +#define OHCI_WRITECSR(softc,x,y) \ + *((volatile uint32_t *) ((softc)->ohci_regs + ((x)/sizeof(uint32_t)))) = (y) +#define OHCI_READCSR(softc,x) \ + *((volatile uint32_t *) ((softc)->ohci_regs + ((x)/sizeof(uint32_t)))) +#else +#define OHCI_VTOP(ptr) ((uint32_t)PHYSADDR((long)(ptr))) + +#if CPUCFG_COHERENT_DMA +#define OHCI_PTOV(ptr) ((void *)(KERNADDR(ptr))) +#else +#define OHCI_PTOV(ptr) ((void *)(UNCADDR(ptr))) +#endif + +#define OHCI_WRITECSR(softc,x,y) \ + phys_write32(((softc)->ohci_regs + (x)),(y)) +#define OHCI_READCSR(softc,x) \ + phys_read32(((softc)->ohci_regs + (x))) +#endif + +#if CPUCFG_COHERENT_DMA +#define OHCI_INVAL_RANGE(s,l) +#define OHCI_FLUSH_RANGE(s,l) +#else /* not coherent */ +#define CFE_CACHE_INVAL_RANGE 32 /* XXX belongs in include file */ +#define CFE_CACHE_FLUSH_RANGE 64 +extern void _cfe_flushcache(int,uint8_t *,uint8_t *); +#define OHCI_INVAL_RANGE(s,l) _cfe_flushcache(CFE_CACHE_INVAL_RANGE,((uint8_t *) (s)),((uint8_t *) (s))+(l)) +#define OHCI_FLUSH_RANGE(s,l) _cfe_flushcache(CFE_CACHE_FLUSH_RANGE,((uint8_t *) (s)),((uint8_t *) (s))+(l)) +#endif + + +/* ********************************************************************* + * Bit-reverse table - this table consists of the numbers + * at its index, listed in reverse. So, the reverse of 0000 0010 + * is 0100 0000. + ********************************************************************* */ + +const static int ohci_revbits[OHCI_INTTABLE_SIZE] = { + 0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0c, 0x1c, + 0x02, 0x12, 0x0a, 0x1a, 0x06, 0x16, 0x0e, 0x1e, + 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0d, 0x1d, + 0x03, 0x13, 0x0b, 0x1b, 0x07, 0x17, 0x0f, 0x1f +}; + + +/* ********************************************************************* + * Macros to convert from "hardware" endpoint and transfer + * descriptors (ohci_ed_t, ohci_td_t) to "software" + * data structures (ohci_transfer_t, ohci_endpoint_t). + * + * Basically, there are two tables, indexed by the same value + * By subtracting the base of one pool from a pointer, we get + * the index into the other table. + * + * We *could* have included the ed and td in the software + * data structures, but placing all the hardware stuff in one + * pool will make it easier for hardware that does not handle + * coherent DMA, since we can be less careful about what we flush + * and what we invalidate. + ********************************************************************* */ + +#define ohci_td_from_transfer(softc,transfer) \ + ((softc)->ohci_hwtdpool + ((transfer) - (softc)->ohci_transfer_pool)) + +#define ohci_transfer_from_td(softc,td) \ + ((softc)->ohci_transfer_pool + ((td) - (softc)->ohci_hwtdpool)) + +#define ohci_ed_from_endpoint(softc,endpoint) \ + ((softc)->ohci_hwedpool + ((endpoint) - (softc)->ohci_endpoint_pool)) + +#define ohci_endpoint_from_ed(softc,ed) \ + ((softc)->ohci_endpoint_pool + ((ed) - (softc)->ohci_hwedpool)) + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + +static int ohci_roothub_xfer(usbbus_t *bus,usb_ept_t *uept,usbreq_t *ur); +static void ohci_roothub_statchg(ohci_softc_t *softc); +extern usb_hcdrv_t ohci_driver; + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +int ohcidebug = 0; +void ohci_dumprhstat(uint32_t reg); +void ohci_dumpportstat(int idx,uint32_t reg); +void ohci_dumptd(ohci_td_t *td); +void ohci_dumptdchain(ohci_td_t *td); +void ohci_dumped(ohci_ed_t *ed); +void ohci_dumpedchain(ohci_ed_t *ed); + + +/* ********************************************************************* + * Some debug routines + ********************************************************************* */ + +#if 1 +void ohci_dumprhstat(uint32_t reg) +{ + printf("HubStatus: %08X ",reg); + + if (reg & M_OHCI_RHSTATUS_LPS) printf("LocalPowerStatus "); + if (reg & M_OHCI_RHSTATUS_OCI) printf("OverCurrent "); + if (reg & M_OHCI_RHSTATUS_DRWE) printf("DeviceRemoteWakeupEnable "); + if (reg & M_OHCI_RHSTATUS_LPSC) printf("LocalPowerStatusChange "); + if (reg & M_OHCI_RHSTATUS_OCIC) printf("OverCurrentIndicatorChange "); + printf("\n"); + +} + +void ohci_dumpportstat(int idx,uint32_t reg) +{ + printf("Port %d: %08X ",idx,reg); + if (reg & M_OHCI_RHPORTSTAT_CCS) printf("Connected "); + if (reg & M_OHCI_RHPORTSTAT_PES) printf("PortEnabled "); + if (reg & M_OHCI_RHPORTSTAT_PSS) printf("PortSuspended "); + if (reg & M_OHCI_RHPORTSTAT_POCI) printf("PortOverCurrent "); + if (reg & M_OHCI_RHPORTSTAT_PRS) printf("PortReset "); + if (reg & M_OHCI_RHPORTSTAT_PPS) printf("PortPowered "); + if (reg & M_OHCI_RHPORTSTAT_LSDA) printf("LowSpeed "); + if (reg & M_OHCI_RHPORTSTAT_CSC) printf("ConnectStatusChange "); + if (reg & M_OHCI_RHPORTSTAT_PESC) printf("PortEnableStatusChange "); + if (reg & M_OHCI_RHPORTSTAT_PSSC) printf("PortSuspendStatusChange "); + if (reg & M_OHCI_RHPORTSTAT_OCIC) printf("OverCurrentIndicatorChange "); + if (reg & M_OHCI_RHPORTSTAT_PRSC) printf("PortResetStatusChange "); + printf("\n"); +} + +void ohci_dumptd(ohci_td_t *td) +{ + uint32_t ctl; + static char *pids[4] = {"SETUP","OUT","IN","RSVD"}; + + ctl = BSWAP32(td->td_control); + + printf("[%08X] ctl=%08X (DP=%s,DI=%d,T=%d,EC=%d,CC=%d%s) cbp=%08X be=%08X next=%08X\n", + OHCI_VTOP(td), + ctl, + pids[G_OHCI_TD_PID(ctl)], + G_OHCI_TD_DI(ctl), + G_OHCI_TD_DT(ctl), + G_OHCI_TD_EC(ctl), + G_OHCI_TD_CC(ctl), + (ctl & M_OHCI_TD_SHORTOK) ? ",R" : "", + BSWAP32(td->td_cbp), + BSWAP32(td->td_be), + BSWAP32(td->td_next_td)); +} + +void ohci_dumptdchain(ohci_td_t *td) +{ + int idx = 0; + for (;;) { + printf("%d:[%08X] ctl=%08X cbp=%08X be=%08X next=%08X\n", + idx, + OHCI_VTOP(td), + BSWAP32(td->td_control), + BSWAP32(td->td_cbp), + BSWAP32(td->td_be), + BSWAP32(td->td_next_td)); + if (!td->td_next_td) break; + td = (ohci_td_t *) OHCI_PTOV(BSWAP32(td->td_next_td)); + idx++; + } +} + +void ohci_dumped(ohci_ed_t *ed) +{ + uint32_t ctl; + static char *pids[4] = {"FTD","OUT","IN","FTD"}; + + ctl = BSWAP32(ed->ed_control), + + printf("[%08X] Ctl=%08X (MPS=%d%s%s%s,EN=%d,FA=%d,D=%s) Tailp=%08X headp=%08X next=%08X %s\n", + OHCI_VTOP(ed), + ctl, + G_OHCI_ED_MPS(ctl), + (ctl & M_OHCI_ED_LOWSPEED) ? ",LS" : "", + (ctl & M_OHCI_ED_SKIP) ? ",SKIP" : "", + (ctl & M_OHCI_ED_ISOCFMT) ? ",ISOC" : "", + G_OHCI_ED_EN(ctl), + G_OHCI_ED_FA(ctl), + pids[G_OHCI_ED_DIR(ctl)], + BSWAP32(ed->ed_tailp), + BSWAP32(ed->ed_headp), + BSWAP32(ed->ed_next_ed), + BSWAP32(ed->ed_headp) & M_OHCI_ED_HALT ? "HALT" : ""); + if ((ed->ed_headp & M_OHCI_ED_PTRMASK) == 0) return; + ohci_dumptdchain(OHCI_PTOV(BSWAP32(ed->ed_headp) & M_OHCI_ED_PTRMASK)); +} + +void ohci_dumpedchain(ohci_ed_t *ed) +{ + int idx = 0; + for (;;) { + printf("---\nED#%d -> ",idx); + ohci_dumped(ed); + if (!ed->ed_next_ed) break; + if (idx > 50) break; + ed = (ohci_ed_t *) OHCI_PTOV(BSWAP32(ed->ed_next_ed)); + idx++; + } +} + +#endif + + +static void eptstats(ohci_softc_t *softc) +{ + int cnt; + ohci_endpoint_t *e; + cnt = 0; + + e = softc->ohci_endpoint_freelist; + while (e) { e = e->ep_next; cnt++; } + printf("%d left, %d inuse\n",cnt,OHCI_EDPOOL_SIZE-cnt); +} + +/* ********************************************************************* + * _ohci_allocept(softc) + * + * Allocate an endpoint data structure from the pool, and + * make it ready for use. The endpoint is NOT attached to + * the hardware at this time. + * + * Input parameters: + * softc - our OHCI controller + * + * Return value: + * pointer to endpoint or NULL + ********************************************************************* */ + +static ohci_endpoint_t *_ohci_allocept(ohci_softc_t *softc) +{ + ohci_endpoint_t *e; + ohci_ed_t *ed; + + if (ohcidebug > 2) { + printf("AllocEpt: ");eptstats(softc); + } + + e = softc->ohci_endpoint_freelist; + + if (!e) { + printf("No endpoints left!\n"); + return NULL; + } + + softc->ohci_endpoint_freelist = e->ep_next; + + ed = ohci_ed_from_endpoint(softc,e); + + ed->ed_control = BSWAP32(M_OHCI_ED_SKIP); + ed->ed_tailp = BSWAP32(0); + ed->ed_headp = BSWAP32(0); + ed->ed_next_ed = BSWAP32(0); + + e->ep_phys = OHCI_VTOP(ed); + e->ep_next = NULL; + + return e; +} + +/* ********************************************************************* + * _ohci_allocxfer(softc) + * + * Allocate a transfer descriptor. It is prepared for use + * but not attached to the hardware. + * + * Input parameters: + * softc - our OHCI controller + * + * Return value: + * transfer descriptor, or NULL + ********************************************************************* */ + +static ohci_transfer_t *_ohci_allocxfer(ohci_softc_t *softc) +{ + ohci_transfer_t *t; + ohci_td_t *td; + + if (ohcidebug > 2) { + int cnt; + cnt = 0; + t = softc->ohci_transfer_freelist; + while (t) { t = t->t_next; cnt++; } + printf("AllocXfer: %d left, %d inuse\n",cnt,OHCI_TDPOOL_SIZE-cnt); + } + + t = softc->ohci_transfer_freelist; + + if (!t) { + printf("No more transfer descriptors!\n"); + return NULL; + } + + softc->ohci_transfer_freelist = t->t_next; + + td = ohci_td_from_transfer(softc,t); + + td->td_control = BSWAP32(0); + td->td_cbp = BSWAP32(0); + td->td_next_td = BSWAP32(0); + td->td_be = BSWAP32(0); + + t->t_ref = NULL; + t->t_next = NULL; + + return t; +} + +/* ********************************************************************* + * _ohci_freeept(softc,e) + * + * Free an endpoint, returning it to the pool. + * + * Input parameters: + * softc - our OHCI controller + * e - endpoint descriptor to return + * + * Return value: + * nothing + ********************************************************************* */ + +static void _ohci_freeept(ohci_softc_t *softc,ohci_endpoint_t *e) +{ + if (ohcidebug > 2) { + int cnt; + ohci_endpoint_t *ee; + cnt = 0; + ee = softc->ohci_endpoint_freelist; + while (ee) { ee = ee->ep_next; cnt++; } + printf("FreeEpt[%p]: %d left, %d inuse\n",e,cnt,OHCI_EDPOOL_SIZE-cnt); + } + + e->ep_next = softc->ohci_endpoint_freelist; + softc->ohci_endpoint_freelist = e; +} + +/* ********************************************************************* + * _ohci_freexfer(softc,t) + * + * Free a transfer descriptor, returning it to the pool. + * + * Input parameters: + * softc - our OHCI controller + * t - transfer descriptor to return + * + * Return value: + * nothing + ********************************************************************* */ + +static void _ohci_freexfer(ohci_softc_t *softc,ohci_transfer_t *t) +{ + t->t_next = softc->ohci_transfer_freelist; + softc->ohci_transfer_freelist = t; +} + +/* ********************************************************************* + * _ohci_initpools(softc) + * + * Allocate and initialize the various pools of things that + * we use in the OHCI driver. We do this by allocating some + * big chunks from the heap and carving them up. + * + * Input parameters: + * softc - our OHCI controller + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int _ohci_initpools(ohci_softc_t *softc) +{ + int idx; + + /* + * Do the transfer descriptor pool + */ + + softc->ohci_transfer_pool = KMALLOC(OHCI_TDPOOL_SIZE*sizeof(ohci_transfer_t),0); + softc->ohci_hwtdpool = KMALLOC(OHCI_TDPOOL_SIZE*sizeof(ohci_td_t),OHCI_TD_ALIGN); + + /* + * In the case of noncoherent DMA, make these uncached addresses. + * This way all our descriptors will be uncached. Makes life easier, as we + * do not need to worry about flushing descriptors, etc. + */ + +#if (!CPUCFG_COHERENT_DMA) + softc->ohci_hwtdpool = (void *) UNCADDR(PHYSADDR((uint32_t)(softc->ohci_hwtdpool))); +#endif + + if (!softc->ohci_transfer_pool || !softc->ohci_hwtdpool) { + printf("Could not allocate transfer descriptors\n"); + return -1; + } + + softc->ohci_transfer_freelist = NULL; + + for (idx = 0; idx < OHCI_TDPOOL_SIZE; idx++) { + _ohci_freexfer(softc,softc->ohci_transfer_pool+idx); + } + + /* + * Do the endpoint descriptor pool + */ + + softc->ohci_endpoint_pool = KMALLOC(OHCI_EDPOOL_SIZE*sizeof(ohci_endpoint_t),0); + + softc->ohci_hwedpool = KMALLOC(OHCI_EDPOOL_SIZE*sizeof(ohci_ed_t),OHCI_ED_ALIGN); + +#if (!CPUCFG_COHERENT_DMA) + softc->ohci_hwedpool = (void *) UNCADDR(PHYSADDR((uint32_t)(softc->ohci_hwedpool))); +#endif + + if (!softc->ohci_endpoint_pool || !softc->ohci_hwedpool) { + printf("Could not allocate transfer descriptors\n"); + return -1; + } + + softc->ohci_endpoint_freelist = NULL; + + for (idx = 0; idx < OHCI_EDPOOL_SIZE; idx++) { + _ohci_freeept(softc,softc->ohci_endpoint_pool+idx); + } + + /* + * Finally the host communications area + */ + + softc->ohci_hcca = KMALLOC(sizeof(ohci_hcca_t),sizeof(ohci_hcca_t)); + +#if (!CPUCFG_COHERENT_DMA) + softc->ohci_hcca = (void *) UNCADDR(PHYSADDR((uint32_t)(softc->ohci_hcca))); +#endif + + memset(softc->ohci_hcca,0,sizeof(ohci_hcca_t)); + + return 0; +} + + +/* ********************************************************************* + * ohci_start(bus) + * + * Start the OHCI controller. After this routine is called, + * the hardware will be operational and ready to accept + * descriptors and interrupt calls. + * + * Input parameters: + * bus - bus structure, from ohci_create + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int ohci_start(usbbus_t *bus) +{ + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + uint32_t frameint; + uint32_t reg; + int idx; + + /* + * Force a reset to the controller, followed by a short delay + */ + + OHCI_WRITECSR(softc,R_OHCI_CONTROL,V_OHCI_CONTROL_HCFS(K_OHCI_HCFS_RESET)); + usb_delay_ms(bus,OHCI_RESET_DELAY); + + /* Host controller state is now "RESET" */ + + /* + * We need the frame interval later, so get a copy of it now. + */ + frameint = G_OHCI_FMINTERVAL_FI(OHCI_READCSR(softc,R_OHCI_FMINTERVAL)); + + /* + * Reset the host controller. When you set the HCR bit + * if self-clears when the reset is complete. + */ + + OHCI_WRITECSR(softc,R_OHCI_CMDSTATUS,M_OHCI_CMDSTATUS_HCR); + for (idx = 0; idx < 10000; idx++) { + if (!(OHCI_READCSR(softc,R_OHCI_CMDSTATUS) & M_OHCI_CMDSTATUS_HCR)) break; + } + + if (OHCI_READCSR(softc,R_OHCI_CMDSTATUS) & M_OHCI_CMDSTATUS_HCR) { + /* controller never came out of reset */ + return -1; + } + + /* + * Host controller state is now "SUSPEND". We must exit + * from this state within 2ms. (5.1.1.4) + * + * Set up pointers to data structures. + */ + + OHCI_WRITECSR(softc,R_OHCI_HCCA,OHCI_VTOP(softc->ohci_hcca)); + OHCI_WRITECSR(softc,R_OHCI_CONTROLHEADED,softc->ohci_ctl_list->ep_phys); + OHCI_WRITECSR(softc,R_OHCI_BULKHEADED,softc->ohci_bulk_list->ep_phys); + + /* + * Our driver is polled, turn off interrupts + */ + + OHCI_WRITECSR(softc,R_OHCI_INTDISABLE,M_OHCI_INT_ALL); + + /* + * Set up the control register. + */ + + reg = OHCI_READCSR(softc,R_OHCI_CONTROL); + + reg = M_OHCI_CONTROL_PLE | M_OHCI_CONTROL_CLE | M_OHCI_CONTROL_BLE | + M_OHCI_CONTROL_IE | + V_OHCI_CONTROL_CBSR(K_OHCI_CBSR_41) | + V_OHCI_CONTROL_HCFS(K_OHCI_HCFS_OPERATIONAL); + + OHCI_WRITECSR(softc,R_OHCI_CONTROL,reg); + + + /* + * controller state is now OPERATIONAL + */ + + reg = OHCI_READCSR(softc,R_OHCI_FMINTERVAL); + reg &= M_OHCI_FMINTERVAL_FIT; + reg ^= M_OHCI_FMINTERVAL_FIT; + reg |= V_OHCI_FMINTERVAL_FSMPS(OHCI_CALC_FSMPS(frameint)) | + V_OHCI_FMINTERVAL_FI(frameint); + OHCI_WRITECSR(softc,R_OHCI_FMINTERVAL,reg); + + reg = frameint * 9 / 10; /* calculate 90% */ + OHCI_WRITECSR(softc,R_OHCI_PERIODICSTART,reg); + + usb_delay_ms(softc->ohci_bus,10); + + /* + * Remember how many ports we have + */ + + reg = OHCI_READCSR(softc,R_OHCI_RHDSCRA); + softc->ohci_ndp = G_OHCI_RHDSCRA_NDP(reg); + + + /* + * Enable port power + */ + + OHCI_WRITECSR(softc,R_OHCI_RHSTATUS,M_OHCI_RHSTATUS_LPSC); + usb_delay_ms(softc->ohci_bus,10); + + return 0; +} + + +/* ********************************************************************* + * _ohci_setupepts(softc) + * + * Set up the endpoint tree, as described in the OHCI manual. + * Basically the hardware knows how to scan lists of lists, + * so we build a tree where each level is pointed to by two + * parent nodes. We can choose our scanning rate by attaching + * endpoints anywhere within this tree. + * + * Input parameters: + * softc - our OHCI controller + * + * Return value: + * 0 if ok + * else error (out of descriptors) + ********************************************************************* */ + +static int _ohci_setupepts(ohci_softc_t *softc) +{ + int idx; + ohci_endpoint_t *e; + ohci_ed_t *ed; + ohci_endpoint_t *child; + + /* + * Set up the list heads for the isochronous, control, + * and bulk transfer lists. They don't get the same "tree" + * treatment that the interrupt devices get. + * + * For the purposes of CFE, it's probably not necessary + * to be this fancy. The only device we're planning to + * talk to is the keyboard and some hubs, which should + * have pretty minimal requirements. It's conceivable + * that this firmware may find a new home in other + * devices, so we'll meet halfway and do some things + * "fancy." + */ + + softc->ohci_isoc_list = _ohci_allocept(softc); + softc->ohci_ctl_list = _ohci_allocept(softc); + softc->ohci_bulk_list = _ohci_allocept(softc); + + /* + * Set up a tree of empty endpoint descriptors. This is + * tree is scanned by the hardware from the leaves up to + * the root. Once a millisecond, the hardware picks the + * next leaf and starts scanning descriptors looking + * for something to do. It traverses all of the endpoints + * along the way until it gets to the root. + * + * The idea here is if you put a transfer descriptor on the + * root node, the hardware will see it every millisecond, + * since the root will be examined each time. If you + * put the TD on the leaf, it will be 1/32 millisecond. + * The tree therefore is six levels deep. + */ + + for (idx = 0; idx < OHCI_INTTREE_SIZE; idx++) { + e = _ohci_allocept(softc); /* allocated with sKip bit set */ + softc->ohci_edtable[idx] = e; + child = (idx == 0) ? softc->ohci_isoc_list : softc->ohci_edtable[(idx-1)/2]; + ed = ohci_ed_from_endpoint(softc,e); + ed->ed_next_ed = BSWAP32(child->ep_phys); + e->ep_next = child; + } + + /* + * We maintain both physical and virtual copies of the interrupt + * table (leaves of the tree). + */ + + for (idx = 0; idx < OHCI_INTTABLE_SIZE; idx++) { + child = softc->ohci_edtable[OHCI_INTTREE_SIZE-OHCI_INTTABLE_SIZE+idx]; + softc->ohci_inttable[ohci_revbits[idx]] = child; + softc->ohci_hcca->hcca_inttable[ohci_revbits[idx]] = BSWAP32(child->ep_phys); + } + + /* + * Okay, at this point the tree is built. + */ + return 0; +} + +/* ********************************************************************* + * ohci_stop(bus) + * + * Stop the OHCI hardware. + * + * Input parameters: + * bus - our bus structure + * + * Return value: + * nothing + ********************************************************************* */ + +static void ohci_stop(usbbus_t *bus) +{ + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + + OHCI_WRITECSR(softc,R_OHCI_CONTROL,V_OHCI_CONTROL_HCFS(K_OHCI_HCFS_RESET)); +} + + +/* ********************************************************************* + * _ohci_queueept(softc,queue,e) + * + * Add an endpoint to a list of endpoints. This routine + * does things in a particular way according to the OHCI + * spec so we can add endpoints while the hardware is running. + * + * Input parameters: + * queue - endpoint descriptor for head of queue + * e - endpoint to add to queue + * + * Return value: + * nothing + ********************************************************************* */ + +static void _ohci_queueept(ohci_softc_t *softc,ohci_endpoint_t *queue,ohci_endpoint_t *newept) +{ + ohci_ed_t *qed; + ohci_ed_t *newed; + + qed = ohci_ed_from_endpoint(softc,queue); + newed = ohci_ed_from_endpoint(softc,newept); + + newept->ep_next = queue->ep_next; + newed->ed_next_ed = qed->ed_next_ed; + + queue->ep_next = newept; + qed->ed_next_ed = BSWAP32(newept->ep_phys); + + if (ohcidebug > 1) ohci_dumped(newed); + +} + +/* ********************************************************************* + * _ohci_deqept(queue,e) + * + * Remove and endpoint from the list of endpoints. This + * routine does things in a particular way according to + * the OHCI specification, since we are operating on + * a running list. + * + * Input parameters: + * queue - base of queue to look for endpoint on + * e - endpoint to remove + * + * Return value: + * nothing + ********************************************************************* */ + +static void _ohci_deqept(ohci_softc_t *softc,ohci_endpoint_t *queue,ohci_endpoint_t *e) +{ + ohci_endpoint_t *cur; + ohci_ed_t *cured; + ohci_ed_t *ed; + + cur = queue; + + while (cur && (cur->ep_next != e)) cur = cur->ep_next; + + if (cur == NULL) { + printf("Could not remove EP %08X: not on the list!\n",(uint32_t) (intptr_t)e); + return; + } + + /* + * Remove from our regular list + */ + + cur->ep_next = e->ep_next; + + /* + * now remove from the hardware's list + */ + + cured = ohci_ed_from_endpoint(softc,cur); + ed = ohci_ed_from_endpoint(softc,e); + + cured->ed_next_ed = ed->ed_next_ed; +} + + +/* ********************************************************************* + * ohci_intr_procdoneq(softc) + * + * Process the "done" queue for this ohci controller. As + * descriptors are retired, the hardware links them to the + * "done" queue so we can examine the results. + * + * Input parameters: + * softc - our OHCI controller + * + * Return value: + * nothing + ********************************************************************* */ + +static void ohci_intr_procdoneq(ohci_softc_t *softc) +{ + uint32_t doneq; + ohci_transfer_t *transfer; + ohci_td_t *td; + int val; + usbreq_t *ur; + + /* + * Get the head of the queue + */ + + doneq = softc->ohci_hcca->hcca_donehead; + doneq = BSWAP32(doneq); + + td = (ohci_td_t *) OHCI_PTOV(doneq); + transfer = ohci_transfer_from_td(softc,td); + + /* + * Process all elements from the queue + */ + + while (doneq) { + + ohci_ed_t *ed; + ohci_endpoint_t *ept; + usbreq_t *xur = transfer->t_ref; + + if (ohcidebug > 1) { + if (xur) { + ept = (ohci_endpoint_t *) xur->ur_pipe->up_hwendpoint; + ed = ohci_ed_from_endpoint(softc,ept); +// printf("ProcDoneQ:ED [%08X] -> ",ept->ep_phys); +// ohci_dumped(ed); + } + } + + /* + * Get the pointer to next one before freeing this one + */ + + if (ohcidebug > 1) { + ur = transfer->t_ref; + printf("Done(%d): ",ur ? ur->ur_tdcount : -1); + ohci_dumptd(td); + } + + doneq = BSWAP32(td->td_next_td); + + val = G_OHCI_TD_CC(BSWAP32(td->td_control)); + + if (val != 0) printf("[Transfer error: %d]\n",val); + + /* + * See if it's time to call the callback. + */ + ur = transfer->t_ref; + if (ur) { + ur->ur_status = val; + ur->ur_tdcount--; + if (BSWAP32(td->td_cbp) == 0) { + ur->ur_xferred += transfer->t_length; + } + else { + ur->ur_xferred += transfer->t_length - + (BSWAP32(td->td_be) - BSWAP32(td->td_cbp) + 1); + } + if (ur->ur_tdcount == 0) { + /* Noncoherent DMA: need to invalidate, since data is in phys mem */ + OHCI_INVAL_RANGE(ur->ur_buffer,ur->ur_xferred); + usb_complete_request(ur,val); + } + } + + + /* + * Free up the request + */ + _ohci_freexfer(softc,transfer); + + + /* + * Advance to the next request. + */ + + td = (ohci_td_t *) OHCI_PTOV(doneq); + transfer = ohci_transfer_from_td(softc,td); + } + +} + +/* ********************************************************************* + * ohci_intr(bus) + * + * Process pending interrupts for the OHCI controller. + * + * Input parameters: + * bus - our bus structure + * + * Return value: + * 0 if we did nothing + * nonzero if we did something. + ********************************************************************* */ + +static int ohci_intr(usbbus_t *bus) +{ + uint32_t reg; + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + + /* + * Read the interrupt status register. + */ + + reg = OHCI_READCSR(softc,R_OHCI_INTSTATUS); + + /* + * Don't bother doing anything if nothing happened. + */ + if (reg == 0) { + return 0; + } + + /* Scheduling Overruns */ + if (reg & M_OHCI_INT_SO) { + printf("SchedOverrun\n"); + } + + /* Done Queue */ + if (reg & M_OHCI_INT_WDH) { + /* printf("DoneQueue\n"); */ + ohci_intr_procdoneq(softc); + } + + /* Start of Frame */ + if (reg & M_OHCI_INT_SF) { + /* don't be noisy about this */ + } + + /* Resume Detect */ + if (reg & M_OHCI_INT_RD) { + printf("ResumeDetect\n"); + } + + /* Unrecoverable errors */ + if (reg & M_OHCI_INT_UE) { + printf("UnrecoverableError\n"); + } + + /* Frame number overflow */ + if (reg & M_OHCI_INT_FNO) { + /*printf("FrameNumberOverflow\n"); */ + } + + /* Root Hub Status Change */ + if ((reg & ~softc->ohci_intdisable) & M_OHCI_INT_RHSC) { + uint32_t reg; + if (ohcidebug > 0) { + printf("RootHubStatusChange: "); + reg = OHCI_READCSR(softc,R_OHCI_RHSTATUS); + ohci_dumprhstat(reg); + reg = OHCI_READCSR(softc,R_OHCI_RHPORTSTATUS(1)); + ohci_dumpportstat(1,reg); + reg = OHCI_READCSR(softc,R_OHCI_RHPORTSTATUS(2)); + ohci_dumpportstat(2,reg); + } + ohci_roothub_statchg(softc); + } + + /* Ownership Change */ + if (reg & M_OHCI_INT_OC) { + printf("OwnershipChange\n"); + } + + /* + * Write the value back to the interrupt + * register to clear the bits that were set. + */ + + OHCI_WRITECSR(softc,R_OHCI_INTSTATUS,reg); + + return 1; +} + + +/* ********************************************************************* + * ohci_delete(bus) + * + * Remove an OHCI bus structure and all resources allocated to + * it (used when shutting down USB) + * + * Input parameters: + * bus - our USB bus structure + * + * Return value: + * nothing + ********************************************************************* */ + +static void ohci_delete(usbbus_t *bus) +{ + // xxx fill in later. +} + + +/* ********************************************************************* + * ohci_create(addr) + * + * Create a USB bus structure and associate it with our OHCI + * controller device. + * + * Input parameters: + * addr - physical address of controller + * + * Return value: + * usbbus structure pointer + ********************************************************************* */ + +static usbbus_t *ohci_create(physaddr_t addr) +{ + int res; + ohci_softc_t *softc; + usbbus_t *bus; + + softc = KMALLOC(sizeof(ohci_softc_t),0); + if (!softc) return NULL; + + bus = KMALLOC(sizeof(usbbus_t),0); + if (!bus) return NULL; + + memset(softc,0,sizeof(ohci_softc_t)); + memset(bus,0,sizeof(usbbus_t)); + + bus->ub_hwsoftc = (usb_hc_t *) softc; + bus->ub_hwdisp = &ohci_driver; + + q_init(&(softc->ohci_rh_intrq)); + +#ifdef _CFE_ + softc->ohci_regs = addr; +#else + softc->ohci_regs = (volatile uint32_t *) addr; +#endif + + softc->ohci_rh_newaddr = -1; + softc->ohci_bus = bus; + + if ((res = _ohci_initpools(softc)) != 0) goto error; + if ((res = _ohci_setupepts(softc)) != 0) goto error; + + OHCI_WRITECSR(softc,R_OHCI_CONTROL,V_OHCI_CONTROL_HCFS(K_OHCI_HCFS_RESET)); + + return bus; + +error: + KFREE(softc); + return NULL; +} + + +/* ********************************************************************* + * ohci_ept_create(bus,usbaddr,eptnum,mps,flags) + * + * Create a hardware endpoint structure and attach it to + * the hardware's endpoint list. The hardware manages lists + * of queues, and this routine adds a new queue to the appropriate + * list of queues for the endpoint in question. It roughly + * corresponds to the information in the OHCI specification. + * + * Input parameters: + * bus - the USB bus we're dealing with + * usbaddr - USB address (0 means default address) + * eptnum - the endpoint number + * mps - the packet size for this endpoint + * flags - various flags to control endpoint creation + * + * Return value: + * endpoint structure poihter, or NULL + ********************************************************************* */ + +static usb_ept_t *ohci_ept_create(usbbus_t *bus, + int usbaddr, + int eptnum, + int mps, + int flags) +{ + uint32_t eptflags; + ohci_endpoint_t *ept; + ohci_ed_t *ed; + ohci_transfer_t *tailtransfer; + ohci_td_t *tailtd; + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + + ept = _ohci_allocept(softc); + ed = ohci_ed_from_endpoint(softc,ept); + + tailtransfer = _ohci_allocxfer(softc); + tailtd = ohci_td_from_transfer(softc,tailtransfer); + + /* + * Set up functional address, endpoint number, and packet size + */ + + eptflags = V_OHCI_ED_FA(usbaddr) | + V_OHCI_ED_EN(eptnum) | + V_OHCI_ED_MPS(mps) | + 0; + + /* + * Set up the endpoint type based on the flags + * passed to us + */ + + if (flags & UP_TYPE_IN) { + eptflags |= V_OHCI_ED_DIR(K_OHCI_ED_DIR_IN); + } + else if (flags & UP_TYPE_OUT) { + eptflags |= V_OHCI_ED_DIR(K_OHCI_ED_DIR_OUT); + } + else { + eptflags |= V_OHCI_ED_DIR(K_OHCI_ED_DIR_FROMTD); + } + + /* + * Don't forget about lowspeed devices. + */ + + if (flags & UP_TYPE_LOWSPEED) { + eptflags |= M_OHCI_ED_LOWSPEED; + } + + if (ohcidebug > 0) { + printf("Create endpoint %d addr %d flags %08X mps %d\n", + eptnum,usbaddr,eptflags,mps); + } + + /* + * Transfer this info into the endpoint descriptor. + * No need to flush the cache here, it'll get done when + * we add to the hardware list. + */ + + ed->ed_control = BSWAP32(eptflags); + ed->ed_tailp = BSWAP32(OHCI_VTOP(tailtd)); + ed->ed_headp = BSWAP32(OHCI_VTOP(tailtd)); + ept->ep_flags = flags; + ept->ep_mps = mps; + ept->ep_num = eptnum; + + /* + * Put it on the right queue + */ + + if (flags & UP_TYPE_CONTROL) { + _ohci_queueept(softc,softc->ohci_ctl_list,ept); + } + else if (flags & UP_TYPE_BULK) { + _ohci_queueept(softc,softc->ohci_bulk_list,ept); + } + else if (flags & UP_TYPE_INTR) { + /* XXX Choose place in inttable properly. */ + _ohci_queueept(softc,softc->ohci_inttable[0],ept); + } + + return (usb_ept_t *) ept; +} + +/* ********************************************************************* + * ohci_ept_setaddr(bus,ept,usbaddr) + * + * Change the functional address for a USB endpoint. We do this + * when we switch the device's state from DEFAULT to ADDRESSED + * and we've already got the default pipe open. This + * routine mucks with the descriptor and changes its address + * bits. + * + * Input parameters: + * bus - usb bus structure + * ept - an open endpoint descriptor + * usbaddr - new address for this endpoint + * + * Return value: + * nothing + ********************************************************************* */ + +static void ohci_ept_setaddr(usbbus_t *bus,usb_ept_t *uept,int usbaddr) +{ + uint32_t eptflags; + ohci_endpoint_t *ept = (ohci_endpoint_t *) uept; + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + ohci_ed_t *ed = ohci_ed_from_endpoint(softc,ept); + + eptflags = BSWAP32(ed->ed_control); + eptflags &= ~M_OHCI_ED_FA; + eptflags |= V_OHCI_ED_FA(usbaddr); + ed->ed_control = BSWAP32(eptflags); +} + + +/* ********************************************************************* + * ohci_ept_setmps(bus,ept,mps) + * + * Set the maximum packet size of this endpoint. This is + * normally used during the processing of endpoint 0 (default + * pipe) after we find out how big ep0's packets can be. + * + * Input parameters: + * bus - our USB bus structure + * ept - endpoint structure + * mps - new packet size + * + * Return value: + * nothing + ********************************************************************* */ + +static void ohci_ept_setmps(usbbus_t *bus,usb_ept_t *uept,int mps) +{ + uint32_t eptflags; + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + ohci_endpoint_t *ept = (ohci_endpoint_t *) uept; + ohci_ed_t *ed = ohci_ed_from_endpoint(softc,ept); + + eptflags = BSWAP32(ed->ed_control); + eptflags &= ~M_OHCI_ED_MPS; + eptflags |= V_OHCI_ED_MPS(mps); + ed->ed_control = BSWAP32(eptflags); + ept->ep_mps = mps; + +} + +/* ********************************************************************* + * ohci_ept_cleartoggle(bus,ept,mps) + * + * Clear the data toggle for the specified endpoint. + * + * Input parameters: + * bus - our USB bus structure + * ept - endpoint structure + * + * Return value: + * nothing + ********************************************************************* */ + +static void ohci_ept_cleartoggle(usbbus_t *bus,usb_ept_t *uept) +{ + uint32_t eptflags; + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + ohci_endpoint_t *ept = (ohci_endpoint_t *) uept; + ohci_ed_t *ed = ohci_ed_from_endpoint(softc,ept); + + eptflags = BSWAP32(ed->ed_headp); + eptflags &= ~(M_OHCI_ED_HALT | M_OHCI_ED_TOGGLECARRY); + ed->ed_headp = BSWAP32(eptflags); + + OHCI_WRITECSR(softc,R_OHCI_CMDSTATUS,M_OHCI_CMDSTATUS_CLF); +} + +/* ********************************************************************* + * ohci_ept_delete(bus,ept) + * + * Deletes an endpoint from the OHCI controller. This + * routine also completes pending transfers for the + * endpoint and gets rid of the hardware ept (queue base). + * + * Input parameters: + * bus - ohci bus structure + * ept - endpoint to remove + * + * Return value: + * nothing + ********************************************************************* */ + +static void ohci_ept_delete(usbbus_t *bus,usb_ept_t *uept) +{ + ohci_endpoint_t *queue; + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + ohci_endpoint_t *ept = (ohci_endpoint_t *) uept; + ohci_ed_t *ed = ohci_ed_from_endpoint(softc,ept); + uint32_t framenum; + uint32_t tdphys; + usbreq_t *ur; + ohci_td_t *td; + ohci_transfer_t *transfer; + + if (ept->ep_flags & UP_TYPE_CONTROL) { + queue = softc->ohci_ctl_list; + } + else if (ept->ep_flags & UP_TYPE_BULK) { + queue = softc->ohci_bulk_list; + } + else if (ept->ep_flags & UP_TYPE_INTR) { + queue = softc->ohci_inttable[0]; + } + else { + printf("Invalid endpoint\n"); + return; + } + + + /* + * Set the SKIP bit on the endpoint and + * wait for two SOFs to guarantee that we're + * not processing this ED anymore. + */ + + ((volatile uint32_t) ed->ed_control) |= BSWAP32(M_OHCI_ED_SKIP); + + framenum = OHCI_READCSR(softc,R_OHCI_FMNUMBER) & 0xFFFF; + while ((OHCI_READCSR(softc,R_OHCI_FMNUMBER) & 0xFFFF) == framenum) ; /* NULL LOOP */ + + framenum = OHCI_READCSR(softc,R_OHCI_FMNUMBER) & 0xFFFF; + while ((OHCI_READCSR(softc,R_OHCI_FMNUMBER) & 0xFFFF) == framenum) ; /* NULL LOOP */ + + /* + * Remove endpoint from queue + */ + + _ohci_deqept(softc,queue,ept); + + /* + * Free/complete the TDs on the queue + */ + + tdphys = BSWAP32(ed->ed_headp) & M_OHCI_ED_PTRMASK; + + while (tdphys != BSWAP32(ed->ed_tailp)) { + td = (ohci_td_t *) OHCI_PTOV(tdphys); + tdphys = BSWAP32(td->td_next_td); + transfer = ohci_transfer_from_td(softc,td); + + ur = transfer->t_ref; + if (ur) { + ur->ur_status = K_OHCI_CC_CANCELLED; + ur->ur_tdcount--; + if (ur->ur_tdcount == 0) { + if (ohcidebug > 0) printf("Completing request due to closed pipe: %p\n",ur); + usb_complete_request(ur,K_OHCI_CC_CANCELLED); + /* XXX it is expected that the callee will free the usbreq. */ + } + } + + _ohci_freexfer(softc,transfer); + } + + /* + * tdphys now points at the tail TD. Just free it. + */ + + td = (ohci_td_t *) OHCI_PTOV(tdphys); + _ohci_freexfer(softc,ohci_transfer_from_td(softc,td)); + + /* + * Return endpoint to free pool + */ + + _ohci_freeept(softc,ept); +} + + + +/* ********************************************************************* + * ohci_xfer(bus,ept,ur) + * + * Queue a transfer for the specified endpoint. Depending on + * the transfer type, the transfer may go on one of many queues. + * When the transfer completes, a callback will be called. + * + * Input parameters: + * bus - bus structure + * ept - endpoint descriptor + * ur - request (includes pointer to user buffer) + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +static int ohci_xfer(usbbus_t *bus,usb_ept_t *uept,usbreq_t *ur) +{ + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + ohci_endpoint_t *ept = (ohci_endpoint_t *) uept; + ohci_ed_t *ed = ohci_ed_from_endpoint(softc,ept); + ohci_transfer_t *newtailtransfer = 0; + ohci_td_t *newtailtd = NULL; + ohci_transfer_t *curtransfer; + ohci_td_t *curtd; + uint8_t *ptr; + int len; + int amtcopy; + int pktlen; + uint32_t tdcontrol = 0; + + /* + * If the destination USB address matches + * the address of the root hub, shunt the request + * over to our root hub emulation. + */ + + if (ur->ur_dev->ud_address == softc->ohci_rh_addr) { + return ohci_roothub_xfer(bus,uept,ur); + } + + /* + * Set up the TD flags based on the + * request type. + */ + +// pktlen = ept->ep_mps; + pktlen = OHCI_TD_MAX_DATA - 16; + + if (ur->ur_flags & UR_FLAG_SETUP) { + tdcontrol = V_OHCI_TD_PID(K_OHCI_TD_SETUP) | + V_OHCI_TD_DT(K_OHCI_TD_DT_DATA0) | + V_OHCI_TD_CC(K_OHCI_CC_NOTACCESSED) | + V_OHCI_TD_DI(1); + } + else if (ur->ur_flags & UR_FLAG_IN) { + tdcontrol = V_OHCI_TD_PID(K_OHCI_TD_IN) | + V_OHCI_TD_DT(K_OHCI_TD_DT_TCARRY) | + V_OHCI_TD_CC(K_OHCI_CC_NOTACCESSED) | + V_OHCI_TD_DI(1); + } + else if (ur->ur_flags & UR_FLAG_OUT) { + tdcontrol = V_OHCI_TD_PID(K_OHCI_TD_OUT) | + V_OHCI_TD_DT(K_OHCI_TD_DT_TCARRY) | + V_OHCI_TD_CC(K_OHCI_CC_NOTACCESSED) | + V_OHCI_TD_DI(1); + } + else if (ur->ur_flags & UR_FLAG_STATUS_OUT) { + tdcontrol = V_OHCI_TD_PID(K_OHCI_TD_OUT) | + V_OHCI_TD_DT(K_OHCI_TD_DT_DATA1) | + V_OHCI_TD_CC(K_OHCI_CC_NOTACCESSED) | + V_OHCI_TD_DI(1); + } + else if (ur->ur_flags & UR_FLAG_STATUS_IN) { + tdcontrol = V_OHCI_TD_PID(K_OHCI_TD_IN) | + V_OHCI_TD_DT(K_OHCI_TD_DT_DATA1) | + V_OHCI_TD_CC(K_OHCI_CC_NOTACCESSED) | + V_OHCI_TD_DI(1); + } + else { + printf("Shouldn't happen!\n"); + } + + if (ur->ur_flags & UR_FLAG_SHORTOK) { + tdcontrol |= M_OHCI_TD_SHORTOK; + } + + + ptr = ur->ur_buffer; + len = ur->ur_length; + ur->ur_tdcount = 0; + + if (ohcidebug > 1) { + printf(">> Queueing xfer addr %d pipe %d ED %08X ptr %016llX length %d\n", + ur->ur_dev->ud_address, + ur->ur_pipe->up_num, + ept->ep_phys, + (uint64_t) (uintptr_t) ptr, + len); +// ohci_dumped(ed); + } + + curtd = OHCI_PTOV(BSWAP32(ed->ed_tailp)); + curtransfer = ohci_transfer_from_td(softc,curtd); + + if (len == 0) { + newtailtransfer = _ohci_allocxfer(softc); + newtailtd = ohci_td_from_transfer(softc,newtailtransfer); + curtd->td_cbp = 0; + curtd->td_be = 0; + curtd->td_next_td = BSWAP32(OHCI_VTOP(newtailtd)); + curtd->td_control = BSWAP32(tdcontrol); + curtransfer->t_next = newtailtransfer; + curtransfer->t_ref = ur; + curtransfer->t_length = 0; + if (ohcidebug > 1) { printf("QueueTD: "); ohci_dumptd(curtd); } + ur->ur_tdcount++; + } + else { + /* Noncoherent DMA: need to flush user buffer to real memory first */ + OHCI_FLUSH_RANGE(ptr,len); + while (len > 0) { + amtcopy = len; + if (amtcopy > pktlen) amtcopy = pktlen; + newtailtransfer = _ohci_allocxfer(softc); + newtailtd = ohci_td_from_transfer(softc,newtailtransfer); + curtd->td_cbp = BSWAP32(OHCI_VTOP(ptr)); + curtd->td_be = BSWAP32(OHCI_VTOP(ptr+amtcopy)-1); + curtd->td_next_td = BSWAP32(OHCI_VTOP(newtailtd)); + curtd->td_control = BSWAP32(tdcontrol); + curtransfer->t_next = newtailtransfer; + curtransfer->t_ref = ur; + curtransfer->t_length = amtcopy; + if (ohcidebug > 1) { printf("QueueTD: "); ohci_dumptd(curtd); } + curtd = newtailtd; + curtransfer = ohci_transfer_from_td(softc,curtd); + ptr += amtcopy; + len -= amtcopy; + ur->ur_tdcount++; + } + } + + curtd = OHCI_PTOV(BSWAP32(ed->ed_headp & M_OHCI_ED_PTRMASK)); + ed->ed_tailp = BSWAP32(OHCI_VTOP(newtailtd)); + + /* + * Prod the controller depending on what type of list we put + * a TD on. + */ + + if (ept->ep_flags & UP_TYPE_BULK) { + OHCI_WRITECSR(softc,R_OHCI_CMDSTATUS,M_OHCI_CMDSTATUS_BLF); + } + else { + /* XXX should probably make sure we're UP_TYPE_CONTROL here */ + OHCI_WRITECSR(softc,R_OHCI_CMDSTATUS,M_OHCI_CMDSTATUS_CLF); + } + + return 0; +} + +/* ********************************************************************* + * Driver structure + ********************************************************************* */ + +usb_hcdrv_t ohci_driver = { + ohci_create, + ohci_delete, + ohci_start, + ohci_stop, + ohci_intr, + ohci_ept_create, + ohci_ept_delete, + ohci_ept_setmps, + ohci_ept_setaddr, + ohci_ept_cleartoggle, + ohci_xfer +}; + +/* ********************************************************************* + * Root Hub + * + * Data structures and functions + ********************************************************************* */ + +/* + * Data structures and routines to emulate the root hub. + */ +static usb_device_descr_t ohci_root_devdsc = { + sizeof(usb_device_descr_t), /* bLength */ + USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ + USBWORD(0x0100), /* bcdUSB */ + USB_DEVICE_CLASS_HUB, /* bDeviceClass */ + 0, /* bDeviceSubClass */ + 0, /* bDeviceProtocol */ + 64, /* bMaxPacketSize0 */ + USBWORD(0), /* idVendor */ + USBWORD(0), /* idProduct */ + USBWORD(0x0100), /* bcdDevice */ + 1, /* iManufacturer */ + 2, /* iProduct */ + 0, /* iSerialNumber */ + 1 /* bNumConfigurations */ +}; + +static usb_config_descr_t ohci_root_cfgdsc = { + sizeof(usb_config_descr_t), /* bLength */ + USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */ + USBWORD( + sizeof(usb_config_descr_t) + + sizeof(usb_interface_descr_t) + + sizeof(usb_endpoint_descr_t)), /* wTotalLength */ + 1, /* bNumInterfaces */ + 1, /* bConfigurationValue */ + 0, /* iConfiguration */ + USB_CONFIG_SELF_POWERED, /* bmAttributes */ + 0 /* MaxPower */ +}; + +static usb_interface_descr_t ohci_root_ifdsc = { + sizeof(usb_interface_descr_t), /* bLength */ + USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ + 0, /* bInterfaceNumber */ + 0, /* bAlternateSetting */ + 1, /* bNumEndpoints */ + USB_INTERFACE_CLASS_HUB, /* bInterfaceClass */ + 0, /* bInterfaceSubClass */ + 0, /* bInterfaceProtocol */ + 0 /* iInterface */ +}; + +static usb_endpoint_descr_t ohci_root_epdsc = { + sizeof(usb_endpoint_descr_t), /* bLength */ + USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ + (USB_ENDPOINT_DIRECTION_IN | 1), /* bEndpointAddress */ + USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ + USBWORD(8), /* wMaxPacketSize */ + 255 /* bInterval */ +}; + +static usb_hub_descr_t ohci_root_hubdsc = { + USB_HUB_DESCR_SIZE, /* bLength */ + USB_HUB_DESCRIPTOR_TYPE, /* bDescriptorType */ + 0, /* bNumberOfPorts */ + USBWORD(0), /* wHubCharacteristics */ + 0, /* bPowreOnToPowerGood */ + 0, /* bHubControl Current */ + {0} /* bRemoveAndPowerMask */ +}; + +/* ********************************************************************* + * ohci_roothb_strdscr(ptr,str) + * + * Construct a string descriptor for root hub requests + * + * Input parameters: + * ptr - pointer to where to put descriptor + * str - regular string to put into descriptor + * + * Return value: + * number of bytes written to descriptor + ********************************************************************* */ + +static int ohci_roothub_strdscr(uint8_t *ptr,char *str) +{ + uint8_t *p = ptr; + + *p++ = strlen(str)*2 + 2; /* Unicode strings */ + *p++ = USB_STRING_DESCRIPTOR_TYPE; + while (*str) { + *p++ = *str++; + *p++ = 0; + } + return (p - ptr); +} + +/* ********************************************************************* + * ohci_roothub_req(softc,req) + * + * Handle a descriptor request on the control pipe for the + * root hub. We pretend to be a real root hub here and + * return all the standard descriptors. + * + * Input parameters: + * softc - our OHCI controller + * req - a usb request (completed immediately) + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int ohci_roothub_req(ohci_softc_t *softc,usb_device_request_t *req) +{ + uint8_t *ptr; + uint16_t wLength; + uint16_t wValue; + uint16_t wIndex; + usb_port_status_t ups; + usb_hub_descr_t hdsc; + uint32_t status; + uint32_t statport; + uint32_t tmpval; + int res = 0; + + ptr = softc->ohci_rh_buf; + + wLength = GETUSBFIELD(req,wLength); + wValue = GETUSBFIELD(req,wValue); + wIndex = GETUSBFIELD(req,wIndex); + + switch (REQSW(req->bRequest,req->bmRequestType)) { + + case REQCODE(USB_REQUEST_GET_STATUS,USBREQ_DIR_IN,USBREQ_TYPE_STD,USBREQ_REC_DEVICE): + *ptr++ = (USB_GETSTATUS_SELF_POWERED & 0xFF); + *ptr++ = (USB_GETSTATUS_SELF_POWERED >> 8); + break; + + case REQCODE(USB_REQUEST_GET_STATUS,USBREQ_DIR_IN,USBREQ_TYPE_STD,USBREQ_REC_ENDPOINT): + case REQCODE(USB_REQUEST_GET_STATUS,USBREQ_DIR_IN,USBREQ_TYPE_STD,USBREQ_REC_INTERFACE): + *ptr++ = 0; + *ptr++ = 0; + break; + + case REQCODE(USB_REQUEST_GET_STATUS,USBREQ_DIR_IN,USBREQ_TYPE_CLASS,USBREQ_REC_OTHER): + status = OHCI_READCSR(softc,(R_OHCI_RHPORTSTATUS(wIndex))); + if (ohcidebug > 0) { printf("RHGetStatus: "); ohci_dumpportstat(wIndex,status);} + PUTUSBFIELD((&ups),wPortStatus,(status & 0xFFFF)); + PUTUSBFIELD((&ups),wPortChange,(status >> 16)); + memcpy(ptr,&ups,sizeof(ups)); + ptr += sizeof(ups); + break; + + case REQCODE(USB_REQUEST_GET_STATUS,USBREQ_DIR_IN,USBREQ_TYPE_CLASS,USBREQ_REC_DEVICE): + *ptr++ = 0; + *ptr++ = 0; + *ptr++ = 0; + *ptr++ = 0; + break; + + case REQCODE(USB_REQUEST_CLEAR_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_DEVICE): + case REQCODE(USB_REQUEST_CLEAR_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_INTERFACE): + case REQCODE(USB_REQUEST_CLEAR_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_ENDPOINT): + /* do nothing, not supported */ + break; + + case REQCODE(USB_REQUEST_CLEAR_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_CLASS,USBREQ_REC_OTHER): + statport = R_OHCI_RHPORTSTATUS(wIndex); + if (ohcidebug> 0) { + printf("RHClearFeature(%d): ",wValue); ohci_dumpportstat(wIndex,OHCI_READCSR(softc,statport)); + } + switch (wValue) { + case USB_PORT_FEATURE_CONNECTION: + break; + case USB_PORT_FEATURE_ENABLE: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_CCS); + break; + case USB_PORT_FEATURE_SUSPEND: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_POCI); + break; + case USB_PORT_FEATURE_OVER_CURRENT: + break; + case USB_PORT_FEATURE_RESET: + break; + case USB_PORT_FEATURE_POWER: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_LSDA); + break; + case USB_PORT_FEATURE_LOW_SPEED: + break; + case USB_PORT_FEATURE_C_PORT_CONNECTION: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_CSC); + break; + case USB_PORT_FEATURE_C_PORT_ENABLE: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_PESC); + break; + case USB_PORT_FEATURE_C_PORT_SUSPEND: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_PSSC); + break; + case USB_PORT_FEATURE_C_PORT_OVER_CURRENT: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_OCIC); + break; + case USB_PORT_FEATURE_C_PORT_RESET: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_PRSC); + break; + + } + + /* + * If we've cleared all of the conditions that + * want our attention on the port status, + * then we can accept port status interrupts again. + */ + + if ((wValue >= USB_PORT_FEATURE_C_PORT_CONNECTION) && + (wValue <= USB_PORT_FEATURE_C_PORT_RESET)) { + status = OHCI_READCSR(softc,statport); + if ((status & M_OHCI_RHPORTSTAT_ALLC) == 0) { + softc->ohci_intdisable &= ~M_OHCI_INT_RHSC; + } + } + break; + + case REQCODE(USB_REQUEST_SET_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_DEVICE): + case REQCODE(USB_REQUEST_SET_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_INTERFACE): + case REQCODE(USB_REQUEST_SET_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_ENDPOINT): + res = -1; + break; + + case REQCODE(USB_REQUEST_SET_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_CLASS,USBREQ_REC_DEVICE): + /* nothing */ + break; + + case REQCODE(USB_REQUEST_SET_FEATURE,USBREQ_DIR_OUT,USBREQ_TYPE_CLASS,USBREQ_REC_OTHER): + statport = R_OHCI_RHPORTSTATUS(wIndex); + switch (wValue) { + case USB_PORT_FEATURE_CONNECTION: + break; + case USB_PORT_FEATURE_ENABLE: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_PES); + break; + case USB_PORT_FEATURE_SUSPEND: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_PSS); + break; + case USB_PORT_FEATURE_OVER_CURRENT: + break; + case USB_PORT_FEATURE_RESET: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_PRS); + for (;;) { /* XXX timer */ + usb_delay_ms(softc->ohci_bus,100); + if (!(OHCI_READCSR(softc,statport) & M_OHCI_RHPORTSTAT_PRS)) break; + } + break; + case USB_PORT_FEATURE_POWER: + OHCI_WRITECSR(softc,statport,M_OHCI_RHPORTSTAT_PPS); + break; + case USB_PORT_FEATURE_LOW_SPEED: + break; + case USB_PORT_FEATURE_C_PORT_CONNECTION: + break; + case USB_PORT_FEATURE_C_PORT_ENABLE: + break; + case USB_PORT_FEATURE_C_PORT_SUSPEND: + break; + case USB_PORT_FEATURE_C_PORT_OVER_CURRENT: + break; + case USB_PORT_FEATURE_C_PORT_RESET: + break; + + } + + break; + + case REQCODE(USB_REQUEST_SET_ADDRESS,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_DEVICE): + softc->ohci_rh_newaddr = wValue; + break; + + case REQCODE(USB_REQUEST_GET_DESCRIPTOR,USBREQ_DIR_IN,USBREQ_TYPE_STD,USBREQ_REC_DEVICE): + switch (wValue >> 8) { + case USB_DEVICE_DESCRIPTOR_TYPE: + memcpy(ptr,&ohci_root_devdsc,sizeof(ohci_root_devdsc)); + ptr += sizeof(ohci_root_devdsc); + break; + case USB_CONFIGURATION_DESCRIPTOR_TYPE: + memcpy(ptr,&ohci_root_cfgdsc,sizeof(ohci_root_cfgdsc)); + ptr += sizeof(ohci_root_cfgdsc); + memcpy(ptr,&ohci_root_ifdsc,sizeof(ohci_root_ifdsc)); + ptr += sizeof(ohci_root_ifdsc); + memcpy(ptr,&ohci_root_epdsc,sizeof(ohci_root_epdsc)); + ptr += sizeof(ohci_root_epdsc); + break; + case USB_STRING_DESCRIPTOR_TYPE: + switch (wValue & 0xFF) { + case 1: + ptr += ohci_roothub_strdscr(ptr,"Generic"); + break; + case 2: + ptr += ohci_roothub_strdscr(ptr,"Root Hub"); + break; + default: + *ptr++ = 0; + break; + } + break; + default: + res = -1; + break; + } + break; + + case REQCODE(USB_REQUEST_GET_DESCRIPTOR,USBREQ_DIR_IN,USBREQ_TYPE_CLASS,USBREQ_REC_DEVICE): + memcpy(&hdsc,&ohci_root_hubdsc,sizeof(hdsc)); + hdsc.bNumberOfPorts = softc->ohci_ndp; + status = OHCI_READCSR(softc,R_OHCI_RHDSCRA); + tmpval = 0; + if (status & M_OHCI_RHDSCRA_NPS) tmpval |= USB_HUBCHAR_PWR_NONE; + if (status & M_OHCI_RHDSCRA_PSM) tmpval |= USB_HUBCHAR_PWR_GANGED; + else tmpval |= USB_HUBCHAR_PWR_IND; + PUTUSBFIELD((&hdsc),wHubCharacteristics,tmpval); + tmpval = G_OHCI_RHDSCRA_POTPGT(status); + hdsc.bPowerOnToPowerGood = tmpval; + hdsc.bDescriptorLength = USB_HUB_DESCR_SIZE + 1; + status = OHCI_READCSR(softc,R_OHCI_RHDSCRB); + hdsc.bRemoveAndPowerMask[0] = (uint8_t) status; + memcpy(ptr,&hdsc,sizeof(hdsc)); + ptr += sizeof(hdsc); + break; + + case REQCODE(USB_REQUEST_SET_DESCRIPTOR,USBREQ_DIR_OUT,USBREQ_TYPE_CLASS,USBREQ_REC_DEVICE): + /* nothing */ + break; + + case REQCODE(USB_REQUEST_GET_CONFIGURATION,USBREQ_DIR_IN,USBREQ_TYPE_STD,USBREQ_REC_DEVICE): + *ptr++ = softc->ohci_rh_conf; + break; + + case REQCODE(USB_REQUEST_SET_CONFIGURATION,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_DEVICE): + softc->ohci_rh_conf = wValue; + break; + + case REQCODE(USB_REQUEST_GET_INTERFACE,USBREQ_DIR_IN,USBREQ_TYPE_STD,USBREQ_REC_INTERFACE): + *ptr++ = 0; + break; + + case REQCODE(USB_REQUEST_SET_INTERFACE,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_INTERFACE): + /* nothing */ + break; + + case REQCODE(USB_REQUEST_SYNC_FRAME,USBREQ_DIR_OUT,USBREQ_TYPE_STD,USBREQ_REC_ENDPOINT): + /* nothing */ + break; + } + + softc->ohci_rh_ptr = softc->ohci_rh_buf; + softc->ohci_rh_len = ptr - softc->ohci_rh_buf; + + return res; +} + +/* ********************************************************************* + * ohci_roothub_statchg(softc) + * + * This routine is called from the interrupt service routine + * (well, polling routine) for the ohci controller. If the + * controller notices a root hub status change, it dequeues an + * interrupt transfer from the root hub's queue and completes + * it here. + * + * Input parameters: + * softc - our OHCI controller + * + * Return value: + * nothing + ********************************************************************* */ + +static void ohci_roothub_statchg(ohci_softc_t *softc) +{ + usbreq_t *ur; + uint32_t status; + uint8_t portstat = 0; + int idx; + + /* Note: this only works up to 8 ports */ + for (idx = 1; idx <= softc->ohci_ndp; idx++) { + status = OHCI_READCSR(softc,R_OHCI_RHPORTSTATUS(idx)); + if (status & M_OHCI_RHPORTSTAT_ALLC) { + portstat = (1<ohci_intdisable |= M_OHCI_INT_RHSC; + } + + ur = (usbreq_t *) q_deqnext(&(softc->ohci_rh_intrq)); + if (!ur) return; /* no requests pending, ignore it */ + + memset(ur->ur_buffer,0,ur->ur_length); + ur->ur_buffer[0] = portstat; + ur->ur_xferred = ur->ur_length; + + usb_complete_request(ur,0); +} + +/* ********************************************************************* + * ohci_roothub_xfer(softc,req) + * + * Handle a root hub xfer - ohci_xfer transfers control here + * if we detect the address of the root hub - no actual transfers + * go out on the wire, we just handle the requests directly to + * make it look like a hub is attached. + * + * This seems to be common practice in the USB world, so we do + * it here too. + * + * Input parameters: + * softc - our OHCI controller structure + * req - usb request destined for host controller + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +static int ohci_roothub_xfer(usbbus_t *bus,usb_ept_t *uept,usbreq_t *ur) +{ + ohci_softc_t *softc = (ohci_softc_t *) bus->ub_hwsoftc; + ohci_endpoint_t *ept = (ohci_endpoint_t *) uept; + int res; + + switch (ept->ep_num) { + + /* + * CONTROL ENDPOINT + */ + case 0: + + /* + * Three types of transfers: OUT (SETUP), IN (data), or STATUS. + * figure out which is which. + */ + + if (ur->ur_flags & UR_FLAG_SETUP) { + /* + * SETUP packet - this is an OUT request to the control + * pipe. We emulate the hub request here. + */ + usb_device_request_t *req; + + req = (usb_device_request_t *) ur->ur_buffer; + + res = ohci_roothub_req(softc,req); + if (res != 0) printf("Root hub request returned an error\n"); + + ur->ur_xferred = ur->ur_length; + ur->ur_status = 0; + usb_complete_request(ur,0); + } + + else if (ur->ur_flags & UR_FLAG_STATUS_IN) { + /* + * STATUS IN : it's sort of like a dummy IN request + * to acknowledge a SETUP packet that otherwise has no + * status. Just complete the usbreq. + */ + + if (softc->ohci_rh_newaddr != -1) { + softc->ohci_rh_addr = softc->ohci_rh_newaddr; + softc->ohci_rh_newaddr = -1; + } + + ur->ur_status = 0; + ur->ur_xferred = 0; + usb_complete_request(ur,0); + } + + else if (ur->ur_flags & UR_FLAG_STATUS_OUT) { + /* + * STATUS OUT : it's sort of like a dummy OUT request + */ + ur->ur_status = 0; + ur->ur_xferred = 0; + usb_complete_request(ur,0); + } + + else if (ur->ur_flags & UR_FLAG_IN) { + /* + * IN : return data from the root hub + */ + int amtcopy; + + amtcopy = softc->ohci_rh_len; + if (amtcopy > ur->ur_length) amtcopy = ur->ur_length; + + memcpy(ur->ur_buffer,softc->ohci_rh_ptr,amtcopy); + + softc->ohci_rh_ptr += amtcopy; + softc->ohci_rh_len -= amtcopy; + + ur->ur_status = 0; + ur->ur_xferred = amtcopy; + usb_complete_request(ur,0); + } + + else { + printf("Unknown root hub transfer type\n"); + return -1; + } + break; + + /* + * INTERRUPT ENDPOINT + */ + + case 1: /* interrupt pipe */ + if (ur->ur_flags & UR_FLAG_IN) { + q_enqueue(&(softc->ohci_rh_intrq),(queue_t *) ur); + } + break; + + } + + + return 0; +} diff --git a/cfe/cfe/usb/ohci.h b/cfe/cfe/usb/ohci.h new file mode 100644 index 0000000..06368e5 --- /dev/null +++ b/cfe/cfe/usb/ohci.h @@ -0,0 +1,490 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * OHCI defs File: ohci.h + * + * Open Host controller interface definitions + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +/* ********************************************************************* + * Macros to muck with bitfields + ********************************************************************* */ + +#define _OHCI_MAKE32(x) ((uint32_t)(x)) + +/* + * Make a mask for 1 bit at position 'n' + */ + +#define _OHCI_MAKEMASK1(n) (_OHCI_MAKE32(1) << _OHCI_MAKE32(n)) + +/* + * Make a mask for 'v' bits at position 'n' + */ + +#define _OHCI_MAKEMASK(v,n) (_OHCI_MAKE32((_OHCI_MAKE32(1)<<(v))-1) << _OHCI_MAKE32(n)) + +/* + * Make a value at 'v' at bit position 'n' + */ + +#define _OHCI_MAKEVALUE(v,n) (_OHCI_MAKE32(v) << _OHCI_MAKE32(n)) +#define _OHCI_GETVALUE(v,n,m) ((_OHCI_MAKE32(v) & _OHCI_MAKE32(m)) >> _OHCI_MAKE32(n)) + + + +/* ********************************************************************* + * Endpoint Descriptor (interrupt, bulk) + ********************************************************************* */ + +#define OHCI_ED_ALIGN 32 + +typedef struct ohci_ed_s { + uint32_t ed_control; + uint32_t ed_tailp; + uint32_t ed_headp; + uint32_t ed_next_ed; +} ohci_ed_t; + +#define S_OHCI_ED_FA 0 +#define M_OHCI_ED_FA _OHCI_MAKEMASK(7,S_OHCI_ED_FA) +#define V_OHCI_ED_FA(x) _OHCI_MAKEVALUE(x,S_OHCI_ED_FA) +#define G_OHCI_ED_FA(x) _OHCI_GETVALUE(x,S_OHCI_ED_FA,M_OHCI_ED_FA) + +#define S_OHCI_ED_EN 7 +#define M_OHCI_ED_EN _OHCI_MAKEMASK(4,S_OHCI_ED_EN) +#define V_OHCI_ED_EN(x) _OHCI_MAKEVALUE(x,S_OHCI_ED_EN) +#define G_OHCI_ED_EN(x) _OHCI_GETVALUE(x,S_OHCI_ED_EN,M_OHCI_ED_EN) + +#define S_OHCI_ED_DIR 11 +#define M_OHCI_ED_DIR _OHCI_MAKEMASK(2,S_OHCI_ED_DIR) +#define V_OHCI_ED_DIR(x) _OHCI_MAKEVALUE(x,S_OHCI_ED_DIR) +#define G_OHCI_ED_DIR(x) _OHCI_GETVALUE(x,S_OHCI_ED_DIR,M_OHCI_ED_DIR) + +#define K_OHCI_ED_DIR_FROMTD 0 +#define K_OHCI_ED_DIR_OUT 1 +#define K_OHCI_ED_DIR_IN 2 + +#define M_OHCI_ED_LOWSPEED _OHCI_MAKEMASK1(13) +#define M_OHCI_ED_SKIP _OHCI_MAKEMASK1(14) +#define M_OHCI_ED_ISOCFMT _OHCI_MAKEMASK1(15) + +#define S_OHCI_ED_MPS 16 +#define M_OHCI_ED_MPS _OHCI_MAKEMASK(11,S_OHCI_ED_MPS) +#define V_OHCI_ED_MPS(x) _OHCI_MAKEVALUE(x,S_OHCI_ED_MPS) +#define G_OHCI_ED_MPS(x) _OHCI_GETVALUE(x,S_OHCI_ED_MPS,M_OHCI_ED_MPS) + +#define M_OHCI_ED_PTRMASK 0xFFFFFFF0 +#define M_OHCI_ED_HALT _OHCI_MAKEMASK1(0) +#define M_OHCI_ED_TOGGLECARRY _OHCI_MAKEMASK1(1) + +/* ********************************************************************* + * Transfer Descriptor + ********************************************************************* */ + +#define OHCI_TD_ALIGN 32 + +typedef struct ohci_td_s { + uint32_t td_control; + uint32_t td_cbp; + uint32_t td_next_td; + uint32_t td_be; +} ohci_td_t; + +#define M_OHCI_TD_SHORTOK _OHCI_MAKEMASK1(18) + +#define S_OHCI_TD_PID 19 +#define M_OHCI_TD_PID _OHCI_MAKEMASK(2,S_OHCI_TD_PID) +#define V_OHCI_TD_PID(x) _OHCI_MAKEVALUE(x,S_OHCI_TD_PID) +#define G_OHCI_TD_PID(x) _OHCI_GETVALUE(x,S_OHCI_TD_PID,M_OHCI_TD_PID) + +#define K_OHCI_TD_SETUP 0 +#define K_OHCI_TD_OUT 1 +#define K_OHCI_TD_IN 2 +#define K_OHCI_TD_RESERVED 3 + +#define V_OHCI_TD_SETUP V_OHCI_TD_PID(K_OHCI_TD_SETUP) +#define V_OHCI_TD_OUT V_OHCI_TD_PID(K_OHCI_TD_OUT) +#define V_OHCI_TD_IN V_OHCI_TD_PID(K_OHCI_TD_IN) +#define V_OHCI_TD_RESERVED V_OHCI_TD_PID(K_OHCI_TD_RESERVED) + +#define S_OHCI_TD_DI 21 +#define M_OHCI_TD_DI _OHCI_MAKEMASK(3,S_OHCI_TD_DI) +#define V_OHCI_TD_DI(x) _OHCI_MAKEVALUE(x,S_OHCI_TD_DI) +#define G_OHCI_TD_DI(x) _OHCI_GETVALUE(x,S_OHCI_TD_DI,M_OHCI_TD_DI) + +#define K_OHCI_TD_NOINTR 7 +#define V_OHCI_TD_NOINTR V_OHCI_TD_DI(K_OHCI_TD_NOINTR) + +#define S_OHCI_TD_DT 24 +#define M_OHCI_TD_DT _OHCI_MAKEMASK(2,S_OHCI_TD_DT) +#define V_OHCI_TD_DT(x) _OHCI_MAKEVALUE(x,S_OHCI_TD_DT) +#define G_OHCI_TD_DT(x) _OHCI_GETVALUE(x,S_OHCI_TD_DT,M_OHCI_TD_DT) + +#define K_OHCI_TD_DT_DATA0 2 +#define K_OHCI_TD_DT_DATA1 3 +#define K_OHCI_TD_DT_TCARRY 0 + +#define S_OHCI_TD_EC 26 +#define M_OHCI_TD_EC _OHCI_MAKEMASK(2,S_OHCI_TD_EC) +#define V_OHCI_TD_EC(x) _OHCI_MAKEVALUE(x,S_OHCI_TD_EC) +#define G_OHCI_TD_EC(x) _OHCI_GETVALUE(x,S_OHCI_TD_EC,M_OHCI_TD_EC) + +#define S_OHCI_TD_CC 28 +#define M_OHCI_TD_CC _OHCI_MAKEMASK(4,S_OHCI_TD_CC) +#define V_OHCI_TD_CC(x) _OHCI_MAKEVALUE(x,S_OHCI_TD_CC) +#define G_OHCI_TD_CC(x) _OHCI_GETVALUE(x,S_OHCI_TD_CC,M_OHCI_TD_CC) + +#define K_OHCI_CC_NOERROR 0 +#define K_OHCI_CC_CRC 1 +#define K_OHCI_CC_BITSTUFFING 2 +#define K_OHCI_CC_DATATOGGLEMISMATCH 3 +#define K_OHCI_CC_STALL 4 +#define K_OHCI_CC_DEVICENOTRESPONDING 5 +#define K_OHCI_CC_PIDCHECKFAILURE 6 +#define K_OHCI_CC_UNEXPECTEDPID 7 +#define K_OHCI_CC_DATAOVERRUN 8 +#define K_OHCI_CC_DATAUNDERRUN 9 +#define K_OHCI_CC_BUFFEROVERRUN 12 +#define K_OHCI_CC_BUFFERUNDERRUN 13 +#define K_OHCI_CC_NOTACCESSED 15 + +#define K_OHCI_CC_CANCELLED 0xFF + +#define OHCI_TD_MAX_DATA 8192 + + +/* ********************************************************************* + * Endpoint descriptor (isochronous) + ********************************************************************* */ + +/* + * TBA + */ + +/* ********************************************************************* + * Host Controller Communications Area (HCCA) + ********************************************************************* */ + +#define OHCI_INTTABLE_SIZE 32 + +#define OHCI_HCCA_ALIGN 256 /* Align on 256-byte boundary */ + +typedef struct ohci_hcca_s { + uint32_t hcca_inttable[OHCI_INTTABLE_SIZE]; + uint32_t hcca_framenum; /* note: actually two 16-bit fields */ + uint32_t hcca_donehead; + uint32_t hcca_reserved[29]; /* round to 256 bytes */ + uint32_t hcca_pad; +} ohci_hcca_t; + +/* ********************************************************************* + * Registers + ********************************************************************* */ + +#define _OHCI_REGIDX(x) ((x)*4) + +#define R_OHCI_REVISION _OHCI_REGIDX(0) +#define R_OHCI_CONTROL _OHCI_REGIDX(1) +#define R_OHCI_CMDSTATUS _OHCI_REGIDX(2) +#define R_OHCI_INTSTATUS _OHCI_REGIDX(3) +#define R_OHCI_INTENABLE _OHCI_REGIDX(4) +#define R_OHCI_INTDISABLE _OHCI_REGIDX(5) +#define R_OHCI_HCCA _OHCI_REGIDX(6) +#define R_OHCI_PERIODCURRENTED _OHCI_REGIDX(7) +#define R_OHCI_CONTROLHEADED _OHCI_REGIDX(8) +#define R_OHCI_CONTROLCURRENTED _OHCI_REGIDX(9) +#define R_OHCI_BULKHEADED _OHCI_REGIDX(10) +#define R_OHCI_BULKCURRENTED _OHCI_REGIDX(11) +#define R_OHCI_DONEHEAD _OHCI_REGIDX(12) +#define R_OHCI_FMINTERVAL _OHCI_REGIDX(13) +#define R_OHCI_FMREMAINING _OHCI_REGIDX(14) +#define R_OHCI_FMNUMBER _OHCI_REGIDX(15) +#define R_OHCI_PERIODICSTART _OHCI_REGIDX(16) +#define R_OHCI_LSTHRESHOLD _OHCI_REGIDX(17) +#define R_OHCI_RHDSCRA _OHCI_REGIDX(18) +#define R_OHCI_RHDSCRB _OHCI_REGIDX(19) +#define R_OHCI_RHSTATUS _OHCI_REGIDX(20) +#define R_OHCI_RHPORTSTATUS(x) _OHCI_REGIDX(20+(x)) /* note: 1-based! */ + + +/* + * R_OHCI_REVISION + */ + +#define S_OHCI_REV_REV 0 +#define M_OHCI_REV_REV _OHCI_MAKEMASK(8,S_OHCI_REV_REV) +#define V_OHCI_REV_REV(x) _OHCI_MAKEVALUE(x,S_OHCI_REV_REV) +#define G_OHCI_REV_REV(x) _OHCI_GETVALUE(x,S_OHCI_REV_REV,M_OHCI_REV_REV) +#define K_OHCI_REV_11 0x10 + +/* + * R_OHCI_CONTROL + */ + +#define S_OHCI_CONTROL_CBSR 0 +#define M_OHCI_CONTROL_CBSR _OHCI_MAKEMASK(2,S_OHCI_CONTROL_CBSR) +#define V_OHCI_CONTROL_CBSR(x) _OHCI_MAKEVALUE(x,S_OHCI_CONTROL_CBSR) +#define G_OHCI_CONTROL_CBSR(x) _OHCI_GETVALUE(x,S_OHCI_CONTROL_CBSR,M_OHCI_CONTROL_CBSR) + +#define K_OHCI_CBSR_11 0 +#define K_OHCI_CBSR_21 1 +#define K_OHCI_CBSR_31 2 +#define K_OHCI_CBSR_41 3 + +#define M_OHCI_CONTROL_PLE _OHCI_MAKEMASK1(2) +#define M_OHCI_CONTROL_IE _OHCI_MAKEMASK1(3) +#define M_OHCI_CONTROL_CLE _OHCI_MAKEMASK1(4) +#define M_OHCI_CONTROL_BLE _OHCI_MAKEMASK1(5) + +#define S_OHCI_CONTROL_HCFS 6 +#define M_OHCI_CONTROL_HCFS _OHCI_MAKEMASK(2,S_OHCI_CONTROL_HCFS) +#define V_OHCI_CONTROL_HCFS(x) _OHCI_MAKEVALUE(x,S_OHCI_CONTROL_HCFS) +#define G_OHCI_CONTROL_HCFS(x) _OHCI_GETVALUE(x,S_OHCI_CONTROL_HCFS,M_OHCI_CONTROL_HCFS) + +#define K_OHCI_HCFS_RESET 0 +#define K_OHCI_HCFS_RESUME 1 +#define K_OHCI_HCFS_OPERATIONAL 2 +#define K_OHCI_HCFS_SUSPEND 3 + +#define M_OHCI_CONTROL_IR _OHCI_MAKEMASK1(8) +#define M_OHCI_CONTROL_RWC _OHCI_MAKEMASK1(9) +#define M_OHCI_CONTROL_RWE _OHCI_MAKEMASK1(10) + +/* + * R_OHCI_CMDSTATUS + */ + +#define M_OHCI_CMDSTATUS_HCR _OHCI_MAKEMASK1(0) +#define M_OHCI_CMDSTATUS_CLF _OHCI_MAKEMASK1(1) +#define M_OHCI_CMDSTATUS_BLF _OHCI_MAKEMASK1(2) +#define M_OHCI_CMDSTATUS_OCR _OHCI_MAKEMASK1(3) + +#define S_OHCI_CMDSTATUS_SOC 16 +#define M_OHCI_CMDSTATUS_SOC _OHCI_MAKEMASK(2,S_OHCI_CMDSTATUS_SOC) +#define V_OHCI_CMDSTATUS_SOC(x) _OHCI_MAKEVALUE(x,S_OHCI_CMDSTATUS_SOC) +#define G_OHCI_CMDSTATUS_SOC(x) _OHCI_GETVALUE(x,S_OHCI_CMDSTATUS_SOC,M_OHCI_CMDSTATUS_SOC) + +/* + * R_OHCI_INTSTATUS, R_OHCI_INTENABLE, R_OHCI_INTDISABLE + */ + + +#define M_OHCI_INT_SO _OHCI_MAKEMASK1(0) +#define M_OHCI_INT_WDH _OHCI_MAKEMASK1(1) +#define M_OHCI_INT_SF _OHCI_MAKEMASK1(2) +#define M_OHCI_INT_RD _OHCI_MAKEMASK1(3) +#define M_OHCI_INT_UE _OHCI_MAKEMASK1(4) +#define M_OHCI_INT_FNO _OHCI_MAKEMASK1(5) +#define M_OHCI_INT_RHSC _OHCI_MAKEMASK1(6) +#define M_OHCI_INT_OC _OHCI_MAKEMASK1(30) +#define M_OHCI_INT_MIE _OHCI_MAKEMASK1(31) + +#define M_OHCI_INT_ALL M_OHCI_INT_SO | M_OHCI_INT_WDH | M_OHCI_INT_SF | \ + M_OHCI_INT_RD | M_OHCI_INT_UE | M_OHCI_INT_FNO | \ + M_OHCI_INT_RHSC | M_OHCI_INT_OC | M_OHCI_INT_MIE + +/* + * R_OHCI_FMINTERVAL + */ + + +#define S_OHCI_FMINTERVAL_FI 0 +#define M_OHCI_FMINTERVAL_FI _OHCI_MAKEMASK(14,S_OHCI_FMINTERVAL_FI) +#define V_OHCI_FMINTERVAL_FI(x) _OHCI_MAKEVALUE(x,S_OHCI_FMINTERVAL_FI) +#define G_OHCI_FMINTERVAL_FI(x) _OHCI_GETVALUE(x,S_OHCI_FMINTERVAL_FI,M_OHCI_FMINTERVAL_FI) + +#define S_OHCI_FMINTERVAL_FSMPS 16 +#define M_OHCI_FMINTERVAL_FSMPS _OHCI_MAKEMASK(15,S_OHCI_FMINTERVAL_FSMPS) +#define V_OHCI_FMINTERVAL_FSMPS(x) _OHCI_MAKEVALUE(x,S_OHCI_FMINTERVAL_FSMPS) +#define G_OHCI_FMINTERVAL_FSMPS(x) _OHCI_GETVALUE(x,S_OHCI_FMINTERVAL_FSMPS,M_OHCI_FMINTERVAL_FSMPS) + +#define OHCI_CALC_FSMPS(x) ((((x)-210)*6/7)) + + +#define M_OHCI_FMINTERVAL_FIT _OHCI_MAKEMASK1(31) + +/* + * R_OHCI_FMREMAINING + */ + + +#define S_OHCI_FMREMAINING_FR 0 +#define M_OHCI_FMREMAINING_FR _OHCI_MAKEMASK(14,S_OHCI_FMREMAINING_FR) +#define V_OHCI_FMREMAINING_FR(x) _OHCI_MAKEVALUE(x,S_OHCI_FMREMAINING_FR) +#define G_OHCI_FMREMAINING_FR(x) _OHCI_GETVALUE(x,S_OHCI_FMREMAINING_FR,M_OHCI_FMREMAINING_FR) + +#define M_OHCI_FMREMAINING_FRT _OHCI_MAKEMASK1(31) + +/* + * R_OHCI_RHDSCRA + */ + + +#define S_OHCI_RHDSCRA_NDP 0 +#define M_OHCI_RHDSCRA_NDP _OHCI_MAKEMASK(8,S_OHCI_RHDSCRA_NDP) +#define V_OHCI_RHDSCRA_NDP(x) _OHCI_MAKEVALUE(x,S_OHCI_RHDSCRA_NDP) +#define G_OHCI_RHDSCRA_NDP(x) _OHCI_GETVALUE(x,S_OHCI_RHDSCRA_NDP,M_OHCI_RHDSCRA_NDP) + +#define M_OHCI_RHDSCRA_PSM _OHCI_MAKEMASK1(8) +#define M_OHCI_RHDSCRA_NPS _OHCI_MAKEMASK1(9) +#define M_OHCI_RHDSCRA_DT _OHCI_MAKEMASK1(10) +#define M_OHCI_RHDSCRA_OCPM _OHCI_MAKEMASK1(11) +#define M_OHCI_RHDSCRA_NOCP _OHCI_MAKEMASK1(12) + +#define S_OHCI_RHDSCRA_POTPGT 24 +#define M_OHCI_RHDSCRA_POTPGT _OHCI_MAKEMASK(8,S_OHCI_RHDSCRA_POTPGT) +#define V_OHCI_RHDSCRA_POTPGT(x) _OHCI_MAKEVALUE(x,S_OHCI_RHDSCRA_POTPGT) +#define G_OHCI_RHDSCRA_POTPGT(x) _OHCI_GETVALUE(x,S_OHCI_RHDSCRA_POTPGT,M_OHCI_RHDSCRA_POTPGT) + +/* + * R_OHCI_RHDSCRB + */ + +#define S_OHCI_RHDSCRB_DR 0 +#define M_OHCI_RHDSCRB_DR _OHCI_MAKEMASK(16,S_OHCI_RHDSCRB_DR) +#define V_OHCI_RHDSCRB_DR(x) _OHCI_MAKEVALUE(x,S_OHCI_RHDSCRB_DR) +#define G_OHCI_RHDSCRB_DR(x) _OHCI_GETVALUE(x,S_OHCI_RHDSCRB_DR,M_OHCI_RHDSCRB_DR) + +#define S_OHCI_RHDSCRB_PPCM 16 +#define M_OHCI_RHDSCRB_PPCM _OHCI_MAKEMASK(16,S_OHCI_RHDSCRB_PPCM) +#define V_OHCI_RHDSCRB_PPCM(x) _OHCI_MAKEVALUE(x,S_OHCI_RHDSCRB_PPCM) +#define G_OHCI_RHDSCRB_PPCM(x) _OHCI_GETVALUE(x,S_OHCI_RHDSCRB_PPCM,M_OHCI_RHDSCRB_PPCM) + +/* + * R_OHCI_RHSTATUS + */ + +#define M_OHCI_RHSTATUS_LPS _OHCI_MAKEMASK1(0) +#define M_OHCI_RHSTATUS_OCI _OHCI_MAKEMASK1(1) +#define M_OHCI_RHSTATUS_DRWE _OHCI_MAKEMASK1(15) +#define M_OHCI_RHSTATUS_LPSC _OHCI_MAKEMASK1(16) +#define M_OHCI_RHSTATUS_OCIC _OHCI_MAKEMASK1(17) +#define M_OHCI_RHSTATUS_CRWE _OHCI_MAKEMASK1(31) + +/* + * R_OHCI_RHPORTSTATUS + */ + +#define M_OHCI_RHPORTSTAT_CCS _OHCI_MAKEMASK1(0) +#define M_OHCI_RHPORTSTAT_PES _OHCI_MAKEMASK1(1) +#define M_OHCI_RHPORTSTAT_PSS _OHCI_MAKEMASK1(2) +#define M_OHCI_RHPORTSTAT_POCI _OHCI_MAKEMASK1(3) +#define M_OHCI_RHPORTSTAT_PRS _OHCI_MAKEMASK1(4) +#define M_OHCI_RHPORTSTAT_PPS _OHCI_MAKEMASK1(8) +#define M_OHCI_RHPORTSTAT_LSDA _OHCI_MAKEMASK1(9) +#define M_OHCI_RHPORTSTAT_CSC _OHCI_MAKEMASK1(16) +#define M_OHCI_RHPORTSTAT_PESC _OHCI_MAKEMASK1(17) +#define M_OHCI_RHPORTSTAT_PSSC _OHCI_MAKEMASK1(18) +#define M_OHCI_RHPORTSTAT_OCIC _OHCI_MAKEMASK1(19) +#define M_OHCI_RHPORTSTAT_PRSC _OHCI_MAKEMASK1(20) + +#define M_OHCI_RHPORTSTAT_ALLC (M_OHCI_RHPORTSTAT_CSC | \ + M_OHCI_RHPORTSTAT_PSSC | \ + M_OHCI_RHPORTSTAT_OCIC | \ + M_OHCI_RHPORTSTAT_PRSC) + +/* ********************************************************************* + * OHCI Structures + ********************************************************************* */ + +#define beginningof(ptr,type,field) ((type *) (((int) (ptr)) - ((int) ((type *) 0)->field))) + +#define OHCI_INTTREE_SIZE 63 + +#define OHCI_EDPOOL_SIZE 128 +#define OHCI_TDPOOL_SIZE 32 + +typedef struct ohci_endpoint_s { + struct ohci_endpoint_s *ep_next; + uint32_t ep_phys; + int ep_flags; + int ep_mps; + int ep_num; +} ohci_endpoint_t; + +typedef struct ohci_transfer_s { + void *t_ref; + int t_length; + struct ohci_transfer_s *t_next; +} ohci_transfer_t; + +typedef struct ohci_softc_s { + ohci_endpoint_t *ohci_edtable[OHCI_INTTREE_SIZE]; + ohci_endpoint_t *ohci_inttable[OHCI_INTTABLE_SIZE]; + ohci_endpoint_t *ohci_isoc_list; + ohci_endpoint_t *ohci_ctl_list; + ohci_endpoint_t *ohci_bulk_list; + ohci_hcca_t *ohci_hcca; + ohci_endpoint_t *ohci_endpoint_pool; + ohci_transfer_t *ohci_transfer_pool; + ohci_ed_t *ohci_hwedpool; + ohci_td_t *ohci_hwtdpool; + ohci_endpoint_t *ohci_endpoint_freelist; + ohci_transfer_t *ohci_transfer_freelist; +#ifdef _CFE_ + physaddr_t ohci_regs; +#else + volatile uint32_t *ohci_regs; +#endif + int ohci_ndp; + long ohci_addr; + uint32_t ohci_intdisable; + + int ohci_rh_newaddr; /* Address to be set on next status update */ + int ohci_rh_addr; /* address of root hub */ + int ohci_rh_conf; /* current configuration # */ + uint8_t ohci_rh_buf[128]; /* buffer to hold hub responses */ + uint8_t *ohci_rh_ptr; /* pointer into buffer */ + int ohci_rh_len; /* remaining bytes to transfer */ + queue_t ohci_rh_intrq; /* Interrupt request queue */ + usbbus_t *ohci_bus; /* owning usbbus structure */ + +} ohci_softc_t; + + +/* + * Misc stuff + */ +#define OHCI_RESET_DELAY 10 + + diff --git a/cfe/cfe/usb/usbchap9.h b/cfe/cfe/usb/usbchap9.h new file mode 100644 index 0000000..1afd0db --- /dev/null +++ b/cfe/cfe/usb/usbchap9.h @@ -0,0 +1,389 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Chapter 9 definitions File: usbchap9.h + * + * This module contains definitions from the USB specification, + * chapter 9. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + + +#ifndef _USBCHAP9_H_ +#define _USBCHAP9_H_ + +#define MAXIMUM_USB_STRING_LENGTH 255 + +/* + * values for the bits returned by the USB GET_STATUS command + */ +#define USB_GETSTATUS_SELF_POWERED 0x01 +#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 0x02 + + +#define USB_DEVICE_DESCRIPTOR_TYPE 0x01 +#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 +#define USB_STRING_DESCRIPTOR_TYPE 0x03 +#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 +#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 +#define USB_POWER_DESCRIPTOR_TYPE 0x06 +#define USB_HID_DESCRIPTOR_TYPE 0x21 +#define USB_HUB_DESCRIPTOR_TYPE 0x29 + +#define USB_DESCRIPTOR_TYPEINDEX(d, i) ((uint16_t)((uint16_t)(d)<<8 | (i))) + +/* + * Values for bmAttributes field of an + * endpoint descriptor + */ + +#define USB_ENDPOINT_TYPE_MASK 0x03 + +#define USB_ENDPOINT_TYPE_CONTROL 0x00 +#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 +#define USB_ENDPOINT_TYPE_BULK 0x02 +#define USB_ENDPOINT_TYPE_INTERRUPT 0x03 + + +/* + * definitions for bits in the bmAttributes field of a + * configuration descriptor. + */ +#define USB_CONFIG_POWERED_MASK 0xc0 + +#define USB_CONFIG_BUS_POWERED 0x80 +#define USB_CONFIG_SELF_POWERED 0x40 +#define USB_CONFIG_REMOTE_WAKEUP 0x20 + +/* + * Endpoint direction bit, stored in address + */ + +#define USB_ENDPOINT_DIRECTION_MASK 0x80 +#define USB_ENDPOINT_DIRECTION_IN 0x80 /* bit set means IN */ + +/* + * test direction bit in the bEndpointAddress field of + * an endpoint descriptor. + */ +#define USB_ENDPOINT_DIR_OUT(addr) (!((addr) & USB_ENDPOINT_DIRECTION_MASK)) +#define USB_ENDPOINT_DIR_IN(addr) ((addr) & USB_ENDPOINT_DIRECTION_MASK) + +#define USB_ENDPOINT_ADDRESS(addr) ((addr) & 0x0F) + +/* + * USB defined request codes + * see chapter 9 of the USB 1.0 specifcation for + * more information. + */ + +/* + * These are the correct values based on the USB 1.0 + * specification + */ + +#define USB_REQUEST_GET_STATUS 0x00 +#define USB_REQUEST_CLEAR_FEATURE 0x01 + +#define USB_REQUEST_SET_FEATURE 0x03 + +#define USB_REQUEST_SET_ADDRESS 0x05 +#define USB_REQUEST_GET_DESCRIPTOR 0x06 +#define USB_REQUEST_SET_DESCRIPTOR 0x07 +#define USB_REQUEST_GET_CONFIGURATION 0x08 +#define USB_REQUEST_SET_CONFIGURATION 0x09 +#define USB_REQUEST_GET_INTERFACE 0x0A +#define USB_REQUEST_SET_INTERFACE 0x0B +#define USB_REQUEST_SYNC_FRAME 0x0C + + +/* + * defined USB device classes + */ + + +#define USB_DEVICE_CLASS_RESERVED 0x00 +#define USB_DEVICE_CLASS_AUDIO 0x01 +#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 +#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 +#define USB_DEVICE_CLASS_MONITOR 0x04 +#define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05 +#define USB_DEVICE_CLASS_POWER 0x06 +#define USB_DEVICE_CLASS_PRINTER 0x07 +#define USB_DEVICE_CLASS_STORAGE 0x08 +#define USB_DEVICE_CLASS_HUB 0x09 +#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF + +/* + * USB defined Feature selectors + */ + +#define USB_FEATURE_ENDPOINT_STALL 0x0000 +#define USB_FEATURE_REMOTE_WAKEUP 0x0001 +#define USB_FEATURE_POWER_D0 0x0002 +#define USB_FEATURE_POWER_D1 0x0003 +#define USB_FEATURE_POWER_D2 0x0004 +#define USB_FEATURE_POWER_D3 0x0005 + +/* + * USB Device descriptor. + * To reduce problems with compilers trying to optimize + * this structure, all the fields are bytes. + */ + +#define USBWORD(x) ((x) & 0xFF),(((x) >> 8) & 0xFF) + +#define USB_CONTROL_ENDPOINT_MIN_SIZE 8 + +typedef struct usb_device_descr_s { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bcdUSBLow,bcdUSBHigh; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint8_t idVendorLow,idVendorHigh; + uint8_t idProductLow,idProductHigh; + uint8_t bcdDeviceLow,bcdDeviceHigh; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; +} usb_device_descr_t; + +typedef struct usb_endpoint_descr_s { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bEndpointAddress; + uint8_t bmAttributes; + uint8_t wMaxPacketSizeLow,wMaxPacketSizeHigh; + uint8_t bInterval; +} usb_endpoint_descr_t; + +/* + * values for bmAttributes Field in + * USB_CONFIGURATION_DESCRIPTOR + */ + +#define CONFIG_BUS_POWERED 0x80 +#define CONFIG_SELF_POWERED 0x40 +#define CONFIG_REMOTE_WAKEUP 0x20 + +typedef struct usb_config_descr_s { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t wTotalLengthLow,wTotalLengthHigh; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t MaxPower; +} usb_config_descr_t; + +#define USB_INTERFACE_CLASS_HUB 0x09 + +typedef struct usb_interface_descr_s { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; +} usb_interface_descr_t; + +typedef struct usb_string_descr_s { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bString[1]; +} usb_string_descr_t; + +/* + * USB power descriptor added to core specification + */ + +#define USB_SUPPORT_D0_COMMAND 0x01 +#define USB_SUPPORT_D1_COMMAND 0x02 +#define USB_SUPPORT_D2_COMMAND 0x04 +#define USB_SUPPORT_D3_COMMAND 0x08 + +#define USB_SUPPORT_D1_WAKEUP 0x10 +#define USB_SUPPORT_D2_WAKEUP 0x20 + + +typedef struct usb_power_descr_s { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bCapabilitiesFlags; + uint16_t EventNotification; + uint16_t D1LatencyTime; + uint16_t D2LatencyTime; + uint16_t D3LatencyTime; + uint8_t PowerUnit; + uint16_t D0PowerConsumption; + uint16_t D1PowerConsumption; + uint16_t D2PowerConsumption; +} usb_power_descr_t; + + +typedef struct usb_common_descr_s { + uint8_t bLength; + uint8_t bDescriptorType; +} usb_common_descr_t; + +typedef struct usb_device_status_s { + uint8_t wDeviceStatusLow,wDeviceStatusHigh; +} usb_device_status_t; + + +/* + * Standard USB HUB definitions + * + * See Chapter 11 + */ + +#define USB_HUB_DESCR_SIZE 8 +typedef struct usb_hub_descr_s { + uint8_t bDescriptorLength; /* Length of this descriptor */ + uint8_t bDescriptorType; /* Hub configuration type */ + uint8_t bNumberOfPorts; /* number of ports on this hub */ + uint8_t wHubCharacteristicsLow; /* Hub Charateristics */ + uint8_t wHubCharacteristicsHigh; + uint8_t bPowerOnToPowerGood; /* port power on till power good in 2ms */ + uint8_t bHubControlCurrent; /* max current in mA */ + /* room for 255 ports power control and removable bitmask */ + uint8_t bRemoveAndPowerMask[64]; +} usb_hub_descr_t; + +#define USB_HUBCHAR_PWR_GANGED 0 +#define USB_HUBCHAR_PWR_IND 1 +#define USB_HUBCHAR_PWR_NONE 2 + +typedef struct usb_hub_status_s { + uint8_t wHubStatusLow,wHubStatusHigh; + uint8_t wHubChangeLow,wHubChangeHigh; +} usb_hub_status_t; + +#define USB_PORT_STATUS_CONNECT 0x0001 +#define USB_PORT_STATUS_ENABLED 0x0002 +#define USB_PORT_STATUS_SUSPEND 0x0004 +#define USB_PORT_STATUS_OVERCUR 0x0008 +#define USB_PORT_STATUS_RESET 0x0010 +#define USB_PORT_STATUS_POWER 0x0100 +#define USB_PORT_STATUS_LOWSPD 0x0200 + +typedef struct usb_port_status_s { + uint8_t wPortStatusLow,wPortStatusHigh; + uint8_t wPortChangeLow,wPortChangeHigh; +} usb_port_status_t; + + +#define USB_HUBREQ_GET_STATUS 0 +#define USB_HUBREQ_CLEAR_FEATURE 1 +#define USB_HUBREQ_GET_STATE 2 +#define USB_HUBREQ_SET_FEATURE 3 +#define USB_HUBREQ_GET_DESCRIPTOR 6 +#define USB_HUBREQ_SET_DESCRIPTOR 7 + +#define USB_HUB_FEATURE_C_LOCAL_POWER 0 +#define USB_HUB_FEATURE_C_OVER_CURRENT 1 + +#define USB_PORT_FEATURE_CONNECTION 0 +#define USB_PORT_FEATURE_ENABLE 1 +#define USB_PORT_FEATURE_SUSPEND 2 +#define USB_PORT_FEATURE_OVER_CURRENT 3 +#define USB_PORT_FEATURE_RESET 4 +#define USB_PORT_FEATURE_POWER 8 +#define USB_PORT_FEATURE_LOW_SPEED 9 +#define USB_PORT_FEATURE_C_PORT_CONNECTION 16 +#define USB_PORT_FEATURE_C_PORT_ENABLE 17 +#define USB_PORT_FEATURE_C_PORT_SUSPEND 18 +#define USB_PORT_FEATURE_C_PORT_OVER_CURRENT 19 +#define USB_PORT_FEATURE_C_PORT_RESET 20 + + +#define GETUSBFIELD(s,f) (((s)->f##Low) | ((s)->f##High << 8)) +#define PUTUSBFIELD(s,f,v) (s)->f##Low = (v & 0xFF); \ + (s)->f##High = ((v)>>8 & 0xFF) + +typedef struct usb_device_request_s { + uint8_t bmRequestType; + uint8_t bRequest; + uint8_t wValueLow,wValueHigh; + uint8_t wIndexLow,wIndexHigh; + uint8_t wLengthLow,wLengthHigh; +} usb_device_request_t; + +/* + * Values for the bmAttributes field of a request + */ +#define USBREQ_DIR_IN 0x80 +#define USBREQ_DIR_OUT 0x00 +#define USBREQ_TYPE_STD 0x00 +#define USBREQ_TYPE_CLASS 0x20 +#define USBREQ_TYPE_VENDOR 0x40 +#define USBREQ_TYPE_RSVD 0x60 +#define USBREQ_REC_DEVICE 0x00 +#define USBREQ_REC_INTERFACE 0x01 +#define USBREQ_REC_ENDPOINT 0x02 +#define USBREQ_REC_OTHER 0x03 + +#define REQCODE(req,dir,type,rec) (((req) << 8) | (dir) | (type) | (rec)) +#define REQSW(req,attr) (((req) << 8) | (attr)) + +/* ********************************************************************* + * HID stuff + ********************************************************************* */ + +typedef struct usb_hid_descr_s { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bcdHIDLow,bcdHIDHigh; + uint8_t bCountryCode; + uint8_t bNumDescriptors; + uint8_t bClassDescrType; + uint8_t wClassDescrLengthLow,wClassDescrLengthHigh; +} usb_hid_descr_t; + +#endif /* _USBCHAP9_H_ */ diff --git a/cfe/cfe/usb/usbd.c b/cfe/cfe/usb/usbd.c new file mode 100644 index 0000000..3e77049 --- /dev/null +++ b/cfe/cfe/usb/usbd.c @@ -0,0 +1,1215 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB device layer File: usbd.c + * + * This module deals with devices (things connected to USB buses) + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _CFE_ +#include +#include +#include +#include +#include "usbhack.h" +#else +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "cfe_timer.h" +#endif + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +int usb_noisy = 0; + + +/* ********************************************************************* + * usb_create_pipe(dev,epaddr,mps,flags) + * + * Create a pipe, causing the corresponding endpoint to + * be created in the host controller driver. Pipes form the + * basic "handle" for unidirectional communications with a + * USB device. + * + * Input parameters: + * dev - device we're talking about + * epaddr - endpoint address open, usually from the endpoint + * descriptor + * mps - maximum packet size understood by the device + * flags - flags for this pipe (UP_xxx flags) + * + * Return value: + * <0 if error + * 0 if ok + ********************************************************************* */ + +int usb_create_pipe(usbdev_t *dev,int epaddr,int mps,int flags) +{ + usbpipe_t *pipe; + int pipeidx; + + pipeidx = USB_EPADDR_TO_IDX(epaddr); + + if (dev->ud_pipes[pipeidx] != NULL) { + printf("Trying to create a pipe that was already created!\n"); + return 0; + } + + pipe = KMALLOC(sizeof(usbpipe_t),0); + + if (!pipe) return -1; + + pipe->up_flags = flags; + pipe->up_num = pipeidx; + pipe->up_mps = mps; + pipe->up_dev = dev; + if (dev->ud_flags & UD_FLAG_LOWSPEED) flags |= UP_TYPE_LOWSPEED; + pipe->up_hwendpoint = UBEPTCREATE(dev->ud_bus, + dev->ud_address, + USB_ENDPOINT_ADDRESS(epaddr), + mps, + flags); + + dev->ud_pipes[pipeidx] = pipe; + + return 0; +} + +/* ********************************************************************* + * usb_open_pipe(dev,epdesc) + * + * Open a pipe given an endpoint descriptor - this is the + * normal way pipes get open, since you've just selected a + * configuration and have the descriptors handy with all + * the information you need. + * + * Input parameters: + * dev - device we're talking to + * epdesc - endpoint descriptor + * + * Return value: + * <0 if error + * else endpoint/pipe number (from descriptor) + ********************************************************************* */ + +int usb_open_pipe(usbdev_t *dev,usb_endpoint_descr_t *epdesc) +{ + int res; + int flags = 0; + + if (USB_ENDPOINT_DIR_IN(epdesc->bEndpointAddress)) flags |= UP_TYPE_IN; + else flags |= UP_TYPE_OUT; + + switch (epdesc->bmAttributes & USB_ENDPOINT_TYPE_MASK) { + case USB_ENDPOINT_TYPE_CONTROL: + flags |= UP_TYPE_CONTROL; + break; + case USB_ENDPOINT_TYPE_ISOCHRONOUS: + flags |= UP_TYPE_ISOC; + break; + case USB_ENDPOINT_TYPE_BULK: + flags |= UP_TYPE_BULK; + break; + case USB_ENDPOINT_TYPE_INTERRUPT: + flags |= UP_TYPE_INTR; + break; + } + + res = usb_create_pipe(dev, + epdesc->bEndpointAddress, + GETUSBFIELD(epdesc,wMaxPacketSize), + flags); + + if (res < 0) return res; + + return epdesc->bEndpointAddress; +} + + +/* ********************************************************************* + * usb_destroy_pipe(dev,epaddr) + * + * Close(destroy) an open pipe and remove endpoint descriptor + * + * Input parameters: + * dev - device we're talking to + * epaddr - pipe to close + * + * Return value: + * nothing + ********************************************************************* */ + +void usb_destroy_pipe(usbdev_t *dev,int epaddr) +{ + usbpipe_t *pipe; + int pipeidx; + + pipeidx = USB_EPADDR_TO_IDX(epaddr); + + pipe = dev->ud_pipes[pipeidx]; + if (!pipe) return; + + if (dev->ud_pipes[pipeidx]) { + UBEPTDELETE(dev->ud_bus, + dev->ud_pipes[pipeidx]->up_hwendpoint); + } + + KFREE(dev->ud_pipes[pipeidx]); + dev->ud_pipes[pipeidx] = NULL; +} + +/* ********************************************************************* + * usb_destroy_device(dev) + * + * Delete an entire USB device, closing its pipes and freeing + * the device data structure + * + * Input parameters: + * dev - device to destroy + * + * Return value: + * nothing + ********************************************************************* */ + +void usb_destroy_device(usbdev_t *dev) +{ + int idx; + + for (idx = 0; idx < UD_MAX_PIPES; idx++) { + if (dev->ud_pipes[idx]) { + UBEPTDELETE(dev->ud_bus, + dev->ud_pipes[idx]->up_hwendpoint); + KFREE(dev->ud_pipes[idx]); + } + } + + dev->ud_bus->ub_devices[dev->ud_address] = NULL; + + KFREE(dev); +} + + +/* ********************************************************************* + * usb_create_device(bus,lowspeed) + * + * Create a new USB device. This device will be set to + * communicate on address zero (default address) and will be + * ready for basic stuff so we can figure out what it is. + * The control pipe will be open, so you can start requesting + * descriptors right away. + * + * Input parameters: + * bus - bus to create device on + * lowspeed - true if it's a lowspeed device (the hubs tell + * us these things) + * + * Return value: + * usb device structure, or NULL + ********************************************************************* */ + +usbdev_t *usb_create_device(usbbus_t *bus,int lowspeed) +{ + usbdev_t *dev; + int pipeflags; + + /* + * Create the device structure. + */ + + dev = KMALLOC(sizeof(usbdev_t),0); + memset(dev,0,sizeof(usbdev_t)); + + dev->ud_bus = bus; + dev->ud_address = 0; /* default address */ + dev->ud_parent = NULL; + dev->ud_flags = 0; + + /* + * Adjust things based on the target device speed + */ + + pipeflags = UP_TYPE_CONTROL; + if (lowspeed) { + pipeflags |= UP_TYPE_LOWSPEED; + dev->ud_flags |= UD_FLAG_LOWSPEED; + } + + /* + * Create the control pipe. + */ + + usb_create_pipe(dev,0, + USB_CONTROL_ENDPOINT_MIN_SIZE, + pipeflags); + + return dev; +} + +/* ********************************************************************* + * usb_make_request(dev,epaddr,buf,len,flags) + * + * Create a template request structure with basic fields + * ready to go. A shorthand routine. + * + * Input parameters: + * dev- device we're talking to + * epaddr - endpoint address, from usb_open_pipe() + * buf,length - user buffer and buffer length + * flags - transfer direction, etc. (UR_xxx flags) + * + * Return value: + * usbreq_t pointer, or NULL + ********************************************************************* */ + +usbreq_t *usb_make_request(usbdev_t *dev,int epaddr,uint8_t *buf,int length,int flags) +{ + usbreq_t *ur; + usbpipe_t *pipe; + int pipeidx; + + pipeidx = USB_EPADDR_TO_IDX(epaddr); + + pipe = dev->ud_pipes[pipeidx]; + + if (pipe == NULL) return NULL; + + ur = KMALLOC(sizeof(usbreq_t),0); + memset(ur,0,sizeof(usbreq_t)); + + ur->ur_dev = dev; + ur->ur_pipe = pipe; + ur->ur_buffer = buf; + ur->ur_length = length; + ur->ur_flags = flags; + ur->ur_callback = NULL; + + return ur; + +} + +/* ********************************************************************* + * usb_poll(bus) + * + * Handle device-driver polling - simply vectors to host controller + * driver. + * + * Input parameters: + * bus - bus structure + * + * Return value: + * nothing + ********************************************************************* */ + +void usb_poll(usbbus_t *bus) +{ + UBINTR(bus); +} + +/* ********************************************************************* + * usb_daemon(bus) + * + * Polls for topology changes and initiates a bus scan if + * necessary. + * + * Input parameters: + * bus - bus to watch + * + * Return value: + * nothing + ********************************************************************* */ + +void usb_daemon(usbbus_t *bus) +{ + /* + * Just see if someone flagged a need for a scan here + * and start the bus scan if necessary. + * + * The actual scanning is a hub function, starting at the + * root hub, so the code for that is over there. + */ + + if (bus->ub_flags & UB_FLG_NEEDSCAN) { + bus->ub_flags &= ~UB_FLG_NEEDSCAN; + usb_scan(bus); + } +} + +/* ********************************************************************* + * usb_cancel_request(ur) + * + * Cancel a pending usb transfer request. + * + * Input parameters: + * ur - request to cancel + * + * Return value: + * 0 if ok + * else error (could not find request) + ********************************************************************* */ + +int usb_cancel_request(usbreq_t *ur) +{ + printf("usb_cancel_request is not implemented.\n"); + return 0; +} + +/* ********************************************************************* + * usb_free_request(ur) + * + * Return a transfer request to the free pool. + * + * Input parameters: + * ur - request to return + * + * Return value: + * nothing + ********************************************************************* */ + +void usb_free_request(usbreq_t *ur) +{ + if (ur->ur_inprogress) { + printf("Yow! Tried to free a request that was in progress!\n"); + return; + } + KFREE(ur); +} + +/* ********************************************************************* + * usb_delay_ms(bus,ms) + * + * Wait a while, calling the polling routine as we go. + * + * Input parameters: + * bus - bus we're talking to + * ms - how long to wait + * + * Return value: + * nothing + ********************************************************************* */ + + +void usb_delay_ms(usbbus_t *bus,int ms) +{ +#ifdef _CFE_ + cfe_sleep(1+((ms*CFE_HZ)/1000)); +#else + mydelay(ms); +#endif +} + +/* ********************************************************************* + * usb_queue_request(ur) + * + * Call the transfer handler in the host controller driver to + * set up a transfer descriptor + * + * Input parameters: + * ur - request to queue + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +int usb_queue_request(usbreq_t *ur) +{ + int res; + + ur->ur_inprogress = 1; + ur->ur_xferred = 0; + res = UBXFER(ur->ur_dev->ud_bus, + ur->ur_pipe->up_hwendpoint, + ur); + return res; +} + +/* ********************************************************************* + * usb_wait_request(ur) + * + * Wait until a request completes, calling the polling routine + * as we wait. + * + * Input parameters: + * ur - request to wait for + * + * Return value: + * request status + ********************************************************************* */ + +int usb_wait_request(usbreq_t *ur) +{ + while ((volatile int) (ur->ur_inprogress)) { + usb_poll(ur->ur_dev->ud_bus); + } + + return ur->ur_status; +} + +/* ********************************************************************* + * usb_sync_request(ur) + * + * Synchronous request - call usb_queue and then usb_wait + * + * Input parameters: + * ur - request to submit + * + * Return value: + * status of request + ********************************************************************* */ + +int usb_sync_request(usbreq_t *ur) +{ + usb_queue_request(ur); + return usb_wait_request(ur); +} + +/* ********************************************************************* + * usb_simple_request(dev,reqtype,bRequest,wValue,wIndex) + * + * Handle a simple USB control pipe request. These are OUT + * requests with no data phase. + * + * Input parameters: + * dev - device we're talking to + * reqtype - request type (bmRequestType) for descriptor + * wValue - wValue for descriptor + * wIndex - wIndex for descriptor + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ + +int usb_simple_request(usbdev_t *dev,uint8_t reqtype,int bRequest,int wValue,int wIndex) +{ +#if 0 + uint8_t *requestbuf; + usb_device_request_t *req; + usbreq_t *ur; + int res; + + requestbuf = KMALLOC(32,0); + + req = (usb_device_request_t *) requestbuf; + + req->bmRequestType = reqtype; + req->bRequest = bRequest; + PUTUSBFIELD(req,wValue,wValue); + PUTUSBFIELD(req,wIndex,wIndex); + PUTUSBFIELD(req,wLength,0); + + if (usb_noisy > 1) printf("Request: "); + ur = usb_make_request(dev,0,requestbuf,sizeof(usb_device_request_t),UR_FLAG_SETUP); + res = usb_sync_request(ur); + usb_free_request(ur); + + if (res == 4) { /* STALL on control pipe */ + if (usb_noisy > 1) printf("STALL\n"); + usb_clear_stall(dev,dev->ud_pipes[0]->up_num); + return -1; + } + + res = ur->ur_xferred; + if (usb_noisy > 1) printf("Result %d\n",res); + + if (usb_noisy > 1) printf("Status: "); + ur = usb_make_request(dev,0,requestbuf,0,UR_FLAG_STATUS_IN); + res = usb_sync_request(ur); + usb_free_request(ur); + if (usb_noisy > 1) printf("Result %d\n",res); + + if (res == 4) { /* STALL */ + if (usb_noisy > 1) printf("STALL\n"); + usb_clear_stall(dev,dev->ud_pipes[0]->up_num); + return -1; + } + + KFREE(requestbuf); + + return 0; +#else + return usb_std_request(dev,reqtype,bRequest,wValue,wIndex,NULL,0); +#endif + +} + + +/* ********************************************************************* + * usb_set_configuration(dev,config) + * + * Set the current configuration for a USB device. + * + * Input parameters: + * dev - device we're talking to + * config - bConfigValue for the device + * + * Return value: + * request status + ********************************************************************* */ + +int usb_set_configuration(usbdev_t *dev,int config) +{ + int res; + + res = usb_simple_request(dev,0x00,USB_REQUEST_SET_CONFIGURATION,config,0); + + return res; +} + + +/* ********************************************************************* + * usb_new_address(bus) + * + * Return the next available address for the specified bus + * + * Input parameters: + * bus - bus to assign an address for + * + * Return value: + * new address, <0 if error + ********************************************************************* */ + +int usb_new_address(usbbus_t *bus) +{ + int idx; + + for (idx = 1; idx < USB_MAX_DEVICES; idx++) { + if (bus->ub_devices[idx] == NULL) return idx; + } + + return -1; +} + +/* ********************************************************************* + * usb_set_address(dev,address) + * + * Set the address of a device. This also puts the device + * in the master device table for the bus and reconfigures the + * address of the control pipe. + * + * Input parameters: + * dev - device we're talking to + * address - new address (1..127) + * + * Return value: + * request status + ********************************************************************* */ + +int usb_set_address(usbdev_t *dev,int address) +{ + int res; + int idx; + usbpipe_t *pipe; + + res = usb_simple_request(dev,0x00,USB_REQUEST_SET_ADDRESS,address,0); + + if (res == 0) { + dev->ud_bus->ub_devices[address] = dev; + dev->ud_address = address; + for (idx = 0; idx < UD_MAX_PIPES; idx++) { + pipe = dev->ud_pipes[idx]; + if (pipe && pipe->up_hwendpoint) { + UBEPTSETADDR(dev->ud_bus,pipe->up_hwendpoint,address); + } + } + } + + return res; +} + +/* ********************************************************************* + * usb_set_ep0mps(dev,mps) + * + * Set the maximum packet size of endpoint zero (mucks with the + * endpoint in the host controller) + * + * Input parameters: + * dev - device we're talking to + * mps - max packet size for endpoint zero + * + * Return value: + * request status + ********************************************************************* */ + +int usb_set_ep0mps(usbdev_t *dev,int mps) +{ + usbpipe_t *pipe; + + pipe = dev->ud_pipes[0]; + if (pipe && pipe->up_hwendpoint) { + UBEPTSETMPS(dev->ud_bus,pipe->up_hwendpoint,mps); + } + if (pipe) { + pipe->up_mps = mps; + } + + return 0; +} + +/* ********************************************************************* + * usb_clear_stall(dev,epaddr) + * + * Clear a stall condition on the specified pipe + * + * Input parameters: + * dev - device we're talking to + * epaddr - endpoint address + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ +int usb_clear_stall(usbdev_t *dev,int epaddr) +{ + uint8_t *requestbuf; + usb_device_request_t *req; + usbreq_t *ur; + int res; + int pipeidx; + + /* + * Clear the stall in the hardware. + */ + + pipeidx = USB_EPADDR_TO_IDX(epaddr); + + UBEPTCLEARTOGGLE(dev->ud_bus,dev->ud_pipes[pipeidx]->up_hwendpoint); + + /* + * Do the "clear stall" request. Note that we should do this + * without calling usb_simple_request, since usb_simple_request + * may itself stall. + */ + + requestbuf = KMALLOC(32,0); + + req = (usb_device_request_t *) requestbuf; + + req->bmRequestType = 0x02; + req->bRequest = USB_REQUEST_CLEAR_FEATURE; + PUTUSBFIELD(req,wValue,0); /* ENDPOINT_HALT */ + PUTUSBFIELD(req,wIndex,epaddr); + PUTUSBFIELD(req,wLength,0); + + ur = usb_make_request(dev,0,requestbuf, + sizeof(usb_device_request_t), + UR_FLAG_SETUP); + res = usb_sync_request(ur); + usb_free_request(ur); + ur = usb_make_request(dev,0,requestbuf,0,UR_FLAG_STATUS_IN); + res = usb_sync_request(ur); + usb_free_request(ur); + + KFREE(requestbuf); + + return 0; +} + + + +/* ********************************************************************* + * usb_std_request(dev,bmRequestType,bRequest,wValue, + * wIndex,buffer,length) + * + * Do a standard control request on the control pipe, + * with the appropriate setup, data, and status phases. + * + * Input parameters: + * dev - dev we're talking to + * bmRequestType,bRequest,wValue,wIndex - fields for the + * USB request structure + * buffer - user buffer + * length - length of user buffer + * + * Return value: + * number of bytes transferred + ********************************************************************* */ + +int usb_std_request(usbdev_t *dev,uint8_t bmRequestType, + uint8_t bRequest,uint16_t wValue, + uint16_t wIndex,uint8_t *buffer,int length) +{ + usbpipe_t *pipe = dev->ud_pipes[0]; + usbreq_t *ur; + int res; + usb_device_request_t *req; + uint8_t *databuf = NULL; + + req = KMALLOC(32,0); + + if ((buffer != NULL) && (length !=0)) { + databuf = KMALLOC(length,0); + if (!(bmRequestType & USBREQ_DIR_IN)) { + memcpy(databuf,buffer,length); + } + else { + memset(databuf,0,length); + } + } + + req->bmRequestType = bmRequestType; + req->bRequest = bRequest; + PUTUSBFIELD(req,wValue,wValue); + PUTUSBFIELD(req,wIndex,wIndex); + PUTUSBFIELD(req,wLength,length); + + ur = usb_make_request(dev,0,(uint8_t *)req,sizeof(usb_device_request_t),UR_FLAG_SETUP); + res = usb_sync_request(ur); + usb_free_request(ur); + + if (length != 0) { + if (bmRequestType & USBREQ_DIR_IN) { + ur = usb_make_request(dev,0,databuf,length,UR_FLAG_IN); + } + else { + ur = usb_make_request(dev,0,databuf,length,UR_FLAG_OUT); + } + + res = usb_sync_request(ur); + + if (res == 4) { /* STALL */ + usb_clear_stall(dev,pipe->up_num); + usb_free_request(ur); + if (databuf) KFREE(databuf); + KFREE(req); + return 0; + } + + length = ur->ur_xferred; + usb_free_request(ur); + } + + if ((length != 0) && (databuf != NULL) && (bmRequestType & USBREQ_DIR_IN)) { + memcpy(buffer,databuf,length); + } + + if (bmRequestType & USBREQ_DIR_IN) { + ur = usb_make_request(dev,0,(uint8_t *)req,0,UR_FLAG_STATUS_OUT); + } + else { + ur = usb_make_request(dev,0,(uint8_t *)req,0,UR_FLAG_STATUS_IN); + } + + res = usb_sync_request(ur); + usb_free_request(ur); + + if (res == 4) { /* STALL */ + usb_clear_stall(dev,pipe->up_num); + if (databuf) KFREE(databuf); + KFREE(req); + return 0; + } + + if (databuf) KFREE(databuf); + KFREE(req); + + return length; +} + + + + +/* ********************************************************************* + * usb_get_descriptor(dev,reqtype,dsctype,dscidx,respbuf,buflen) + * + * Request a descriptor from the device. + * + * Input parameters: + * dev - device we're talking to + * reqtype - bmRequestType field for descriptor we want + * dsctype - descriptor type we want + * dscidx - index of descriptor we want (often zero) + * respbuf - response buffer + * buflen - length of response buffer + * + * Return value: + * number of bytes transferred + ********************************************************************* */ + +int usb_get_descriptor(usbdev_t *dev,uint8_t reqtype,int dsctype,int dscidx, + uint8_t *respbuf,int buflen) +{ + return usb_std_request(dev, + reqtype,USB_REQUEST_GET_DESCRIPTOR, + USB_DESCRIPTOR_TYPEINDEX(dsctype,dscidx), + 0, + respbuf,buflen); +} + +/* ********************************************************************* + * usb_get_string(dev,id,buf,maxlen) + * + * Request a string from the device, converting it from + * unicode to ascii (brutally). + * + * Input parameters: + * dev - device we're talking to + * id - string ID + * buf - buffer to receive string (null terminated) + * maxlen - length of buffer + * + * Return value: + * number of characters in returned string + ********************************************************************* */ + +int usb_get_string(usbdev_t *dev,int id,char *buf,int maxlen) +{ + int amtcopy; + uint8_t *respbuf; + int idx; + usb_string_descr_t *sdscr; + + respbuf = KMALLOC(maxlen*2+2,0); + sdscr = (usb_string_descr_t *) respbuf; + + /* + * First time just get the header of the descriptor so we can + * get the string length + */ + + amtcopy = usb_get_descriptor(dev,USBREQ_DIR_IN,USB_STRING_DESCRIPTOR_TYPE,id, + respbuf,2); + + /* + * now do it again to get the whole string. + */ + + if (maxlen > sdscr->bLength) maxlen = sdscr->bLength; + + amtcopy = usb_get_descriptor(dev,USBREQ_DIR_IN,USB_STRING_DESCRIPTOR_TYPE,id, + respbuf,maxlen); + + *buf = '\0'; + amtcopy = sdscr->bLength - 2; + if (amtcopy <= 0) return amtcopy; + + for (idx = 0; idx < amtcopy; idx+=2) { + *buf++ = sdscr->bString[idx]; + } + + *buf = '\0'; + + KFREE(respbuf); + + return amtcopy; +} + + + +/* ********************************************************************* + * usb_get_device_descriptor(dev,dscr,smallflg) + * + * Request the device descriptor for the device. This is often + * the first descriptor requested, so it needs to be done in + * stages so we can find out how big the control pipe is. + * + * Input parameters: + * dev - device we're talking to + * dscr - pointer to buffer to receive descriptor + * smallflg - TRUE to request just 8 bytes. + * + * Return value: + * number of bytes copied + ********************************************************************* */ + +int usb_get_device_descriptor(usbdev_t *dev,usb_device_descr_t *dscr,int smallflg) +{ + int res; + uint8_t *respbuf; + int amtcopy; + + /* + * Smallflg truncates the request 8 bytes. We need to do this for + * the very first transaction to a USB device in order to determine + * the size of its control pipe. Bad things will happen if you + * try to retrieve more data than the control pipe will hold. + * + * So, be conservative at first and get the first 8 bytes of the + * descriptor. Byte 7 is bMaxPacketSize0, the size of the control + * pipe. Then you can go back and submit a bigger request for + * everything else. + */ + + amtcopy = smallflg ? USB_CONTROL_ENDPOINT_MIN_SIZE : sizeof(usb_device_descr_t); + + respbuf = KMALLOC(64,0); + res = usb_get_descriptor(dev,USBREQ_DIR_IN,USB_DEVICE_DESCRIPTOR_TYPE,0,respbuf,amtcopy); + memcpy(dscr,respbuf,amtcopy); + KFREE(respbuf); + return res; + +} + +/* ********************************************************************* + * usb_get_config_descriptor(dev,dscr,idx,maxlen) + * + * Request the configuration descriptor from the device. + * + * Input parameters: + * dev - device we're talking to + * dscr - descriptor buffer (receives data from device) + * idx - index of config we want (usually zero) + * maxlen - total size of buffer to receive descriptor + * + * Return value: + * number of bytes copied + ********************************************************************* */ + +int usb_get_config_descriptor(usbdev_t *dev,usb_config_descr_t *dscr,int idx,int maxlen) +{ + int res; + uint8_t *respbuf; + + respbuf = KMALLOC(maxlen,0); + res = usb_get_descriptor(dev,USBREQ_DIR_IN, + USB_CONFIGURATION_DESCRIPTOR_TYPE,idx, + respbuf,maxlen); + memcpy(dscr,respbuf,maxlen); + KFREE(respbuf); + return res; + +} + + + +/* ********************************************************************* + * usb_get_device_status(dev,status) + * + * Request status from the device (status descriptor) + * + * Input parameters: + * dev - device we're talking to + * status - receives device_status structure + * + * Return value: + * number of bytes returned + ********************************************************************* */ + +int usb_get_device_status(usbdev_t *dev,usb_device_status_t *status) +{ + return usb_std_request(dev, + USBREQ_DIR_IN, + 0, + 0, + 0, + (uint8_t *) status, + sizeof(usb_device_status_t)); +} + + +/* ********************************************************************* + * usb_complete_request(ur,status) + * + * Called when a usb request completes - pass status to + * caller and call the callback if there is one. + * + * Input parameters: + * ur - usbreq_t to complete + * status - completion status + * + * Return value: + * nothing + ********************************************************************* */ + +void usb_complete_request(usbreq_t *ur,int status) +{ + ur->ur_status = status; + ur->ur_inprogress = 0; + if (ur->ur_callback) (*(ur->ur_callback))(ur); +} + + +/* ********************************************************************* + * usb_initroot(bus) + * + * Initialize the root hub for the bus - we need to do this + * each time a bus is configured. + * + * Input parameters: + * bus - bus to initialize + * + * Return value: + * nothing + ********************************************************************* */ + +void usb_initroot(usbbus_t *bus) +{ + usbdev_t *dev; + usb_driver_t *drv; + int addr; + int res; + uint8_t *buf; + int len; + usb_config_descr_t cfgdescr; + + /* + * Create a device for the root hub. + */ + + dev = usb_create_device(bus,0); + bus->ub_roothub = dev; + + /* + * Get the device descriptor. Make sure it's a hub. + */ + + res = usb_get_device_descriptor(dev,&(dev->ud_devdescr),TRUE); + + if (dev->ud_devdescr.bDeviceClass != USB_DEVICE_CLASS_HUB) { + printf("Error! Root device is not a hub!\n"); + return; + } + + /* + * Set up the max packet size for the control endpoint, + * then get the rest of the descriptor. + */ + + usb_set_ep0mps(dev,dev->ud_devdescr.bMaxPacketSize0); + res = usb_get_device_descriptor(dev,&(dev->ud_devdescr),FALSE); + + /* + * Obtain a new address and set the address of the + * root hub to this address. + */ + + addr = usb_new_address(dev->ud_bus); + res = usb_set_address(dev,addr); + + /* + * Get the configuration descriptor and all the + * associated interface and endpoint descriptors. + */ + + res = usb_get_config_descriptor(dev,&cfgdescr,0, + sizeof(usb_config_descr_t)); + if (res != sizeof(usb_config_descr_t)) { + printf("[a]usb_get_config_descriptor returns %d\n",res); + } + + len = GETUSBFIELD(&cfgdescr,wTotalLength); + buf = KMALLOC(len,0); + + res = usb_get_config_descriptor(dev,(usb_config_descr_t *)buf,0,len); + if (res != len) { + printf("[b]usb_get_config_descriptor returns %d\n",res); + } + + dev->ud_cfgdescr = (usb_config_descr_t *) buf; + + /* + * Select the configuration. Not really needed for our poor + * imitation root hub, but it's the right thing to do. + */ + + usb_set_configuration(dev,cfgdescr.bConfigurationValue); + + /* + * Find the driver for this. It had better be the hub + * driver. + */ + + drv = usb_find_driver(dev); + + /* + * Call the attach method. + */ + + (*(drv->udrv_attach))(dev,drv); + + /* + * Hub should now be operational. + */ + +} + + +/* ********************************************************************* + * usb_find_cfg_descr(dev,dtype,idx) + * + * Find a configuration descriptor - we retrieved all the config + * descriptors during discovery, this lets us dig out the one + * we want. + * + * Input parameters: + * dev - device we are talking to + * dtype - descriptor type to find + * idx - index of descriptor if there's more than one + * + * Return value: + * pointer to descriptor or NULL if not found + ********************************************************************* */ + +void *usb_find_cfg_descr(usbdev_t *dev,int dtype,int idx) +{ + uint8_t *endptr; + uint8_t *ptr; + usb_config_descr_t *cfgdscr; + + if (dev->ud_cfgdescr == NULL) return NULL; + + ptr = (uint8_t *) dev->ud_cfgdescr; + endptr = ptr + GETUSBFIELD((dev->ud_cfgdescr),wTotalLength); + + while (ptr < endptr) { + + cfgdscr = (usb_config_descr_t *) ptr; + + if (cfgdscr->bDescriptorType == dtype) { + if (idx == 0) return (void *) ptr; + else idx--; + } + + ptr += cfgdscr->bLength; + + } + + return NULL; +} diff --git a/cfe/cfe/usb/usbd.h b/cfe/cfe/usb/usbd.h new file mode 100644 index 0000000..73fde86 --- /dev/null +++ b/cfe/cfe/usb/usbd.h @@ -0,0 +1,308 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB Device Layer definitions File: usbd.h + * + * Definitions for the USB device layer. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _PHYSADDR_T_DEFINED_ +#include "lib_physio.h" +#endif + +#include "usbchap9.h" + + +/* ********************************************************************* + * Forward declarations and opaque types + ********************************************************************* */ + +typedef struct usb_hc_s usb_hc_t; +typedef struct usb_ept_s usb_ept_t; +typedef struct usb_hcdrv_s usb_hcdrv_t; +typedef struct usbdev_s usbdev_t; +typedef struct usb_driver_s usb_driver_t; + +/* ********************************************************************* + * USB Bus structure - one of these per host controller + ********************************************************************* */ + +#define USB_MAX_DEVICES 128 + +typedef struct usbbus_s { + struct usbbus_s *ub_next; /* link to other buses */ + usb_hc_t *ub_hwsoftc; /* bus driver softc */ + usb_hcdrv_t *ub_hwdisp; /* bus driver dispatch */ + usbdev_t *ub_roothub; /* root hub device */ + usbdev_t *ub_devices[USB_MAX_DEVICES]; /* pointers to each device, idx by address */ + unsigned int ub_flags; /* flag bits */ + int ub_num; /* bus number */ +} usbbus_t; + +#define UB_FLG_NEEDSCAN 1 /* some device on bus needs scanning */ + +/* ********************************************************************* + * USB Pipe structure - one of these per unidirectional channel + * to an endpoint on a USB device + ********************************************************************* */ + +#define UP_TYPE_CONTROL 1 +#define UP_TYPE_BULK 2 +#define UP_TYPE_INTR 4 +#define UP_TYPE_ISOC 8 + +#define UP_TYPE_IN 128 +#define UP_TYPE_OUT 256 + +#define UP_TYPE_LOWSPEED 16 + +typedef struct usbpipe_s { + usb_ept_t *up_hwendpoint; /* OHCI-specific endpoint pointer */ + usbdev_t *up_dev; /* our device info */ + int up_num; /* pipe number */ + int up_mps; /* max packet size */ + int up_flags; +} usbpipe_t; + +/* ********************************************************************* + * USB device structure - one per device attached to the USB + * This is the basic structure applications will use to + * refer to a device. + ********************************************************************* */ + +#define UD_FLAG_HUB 0x0001 /* this is a hub device */ +#define UD_FLAG_ROOTHUB 0x0002 /* this is a root hub device */ +#define UD_FLAG_LOWSPEED 0x0008 /* this is a lowspeed device */ + +#define UD_MAX_PIPES 32 +#define USB_EPADDR_TO_IDX(addr) ((((addr)&0x80) >> 3) | ((addr) & 0x0F)) +//#define USB_EPADDR_TO_IDX(addr) USB_ENDPOINT_ADDRESS(addr) +//#define UD_MAX_PIPES 16 + +struct usbdev_s { + usb_driver_t *ud_drv; /* Driver's methods */ + usbbus_t *ud_bus; /* owning bus */ + int ud_address; /* USB address */ + usbpipe_t *ud_pipes[UD_MAX_PIPES]; /* pipes, 0 is the control pipe */ + struct usbdev_s *ud_parent; /* used for hubs */ + int ud_flags; + void *ud_private; /* private data for device driver */ + usb_device_descr_t ud_devdescr; /* device descriptor */ + usb_config_descr_t *ud_cfgdescr; /* config, interface, and ep descrs */ +}; + + +/* ********************************************************************* + * USB Request - basic structure to describe an in-progress + * I/O request. It associates buses, pipes, and buffers + * together. + ********************************************************************* */ + + +#define UR_FLAG_SYNC 0x8000 + +#define UR_FLAG_SETUP 0x0001 +#define UR_FLAG_IN 0x0002 +#define UR_FLAG_OUT 0x0004 +#define UR_FLAG_STATUS_IN 0x0008 /* status phase of a control WRITE */ +#define UR_FLAG_STATUS_OUT 0x0010 /* status phase of a control READ */ +#define UR_FLAG_SHORTOK 0x0020 /* short transfers are ok */ + + +typedef struct usbreq_s { + queue_t ur_qblock; + + /* + * pointers to our device and pipe + */ + + usbdev_t *ur_dev; + usbpipe_t *ur_pipe; + + /* + * stuff to keep track of the data we transfer + */ + + uint8_t *ur_buffer; + int ur_length; + int ur_xferred; + int ur_status; + int ur_flags; + + /* + * Stuff needed for the callback + */ + void *ur_ref; + int ur_inprogress; + int (*ur_callback)(struct usbreq_s *req); + + /* + * For use inside the ohci driver + */ + void *ur_tdqueue; + int ur_tdcount; +} usbreq_t; + + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int usb_create_pipe(usbdev_t *dev,int pipenum,int mps,int flags); +void usb_destroy_pipe(usbdev_t *dev,int pipenum); +int usb_set_address(usbdev_t *dev,int addr); +usbdev_t *usb_create_device(usbbus_t *bus,int lowspeed); +void usb_destroy_device(usbdev_t *dev); +usbreq_t *usb_make_request(usbdev_t *dev,int pipenum,uint8_t *buf,int length,int flags); +void usb_poll(usbbus_t *bus); +void usb_daemon(usbbus_t *bus); +int usb_cancel_request(usbreq_t *ur); +void usb_free_request(usbreq_t *ur); +int usb_queue_request(usbreq_t *ur); +int usb_wait_request(usbreq_t *ur); +int usb_sync_request(usbreq_t *ur); +int usb_get_descriptor(usbdev_t *dev,uint8_t reqtype,int dsctype,int dscidx,uint8_t *buffer,int buflen); +int usb_get_config_descriptor(usbdev_t *dev,usb_config_descr_t *dscr,int idx,int maxlen); +int usb_get_device_status(usbdev_t *dev,usb_device_status_t *status); +int usb_set_configuration(usbdev_t *dev,int config); +int usb_open_pipe(usbdev_t *dev,usb_endpoint_descr_t *epdesc); +int usb_simple_request(usbdev_t *dev,uint8_t reqtype,int bRequest,int wValue,int wIndex); +void usb_complete_request(usbreq_t *ur,int status); +int usb_get_device_descriptor(usbdev_t *dev,usb_device_descr_t *dscr,int smallflg); +int usb_set_ep0mps(usbdev_t *dev,int mps); +int usb_new_address(usbbus_t *bus); +int usb_get_string(usbdev_t *dev,int id,char *buf,int maxlen); +int usb_std_request(usbdev_t *dev,uint8_t bmRequestType, + uint8_t bRequest,uint16_t wValue, + uint16_t wIndex,uint8_t *buffer,int length); +void *usb_find_cfg_descr(usbdev_t *dev,int dtype,int idx); +void usb_delay_ms(usbbus_t *bus,int ms); +int usb_clear_stall(usbdev_t *dev,int pipe); + +void usb_scan(usbbus_t *bus); +void usbhub_map_tree(usbbus_t *bus,int (*func)(usbdev_t *dev,void *arg),void *arg); +void usbhub_dumpbus(usbbus_t *bus,uint32_t verbose); + +void usb_initroot(usbbus_t *bus); + + +/* ********************************************************************* + * Host Controller Driver + * Methods for abstracting the USB host controller from the + * rest of the goop. + ********************************************************************* */ + +struct usb_hcdrv_s { + usbbus_t * (*hcdrv_create)(physaddr_t regaddr); + void (*hcdrv_delete)(usbbus_t *); + int (*hcdrv_start)(usbbus_t *); + void (*hcdrv_stop)(usbbus_t *); + int (*hcdrv_intr)(usbbus_t *); + usb_ept_t * (*hcdrv_ept_create)(usbbus_t *,int usbaddr,int eptnum,int mps,int flags); + void (*hcdrv_ept_delete)(usbbus_t *,usb_ept_t *); + void (*hcdrv_ept_setmps)(usbbus_t *,usb_ept_t *,int mps); + void (*hcdrv_ept_setaddr)(usbbus_t *,usb_ept_t *,int addr); + void (*hcdrv_ept_cleartoggle)(usbbus_t *,usb_ept_t *); + int (*hcdrv_xfer)(usbbus_t *,usb_ept_t *uept,usbreq_t *ur); +}; + +#define UBCREATE(driver,addr) (*((driver)->hcdrv_create))(addr) +#define UBDELETE(bus) (*((bus)->ub_hwdisp->hcdrv_delete))(bus) +#define UBSTART(bus) (*((bus)->ub_hwdisp->hcdrv_start))(bus) +#define UBSTOP(bus) (*((bus)->ub_hwdisp->hcdrv_stop))(bus) +#define UBINTR(bus) (*((bus)->ub_hwdisp->hcdrv_intr))(bus) +#define UBEPTCREATE(bus,addr,num,mps,flags) (*((bus)->ub_hwdisp->hcdrv_ept_create))(bus,addr,num,mps,flags) +#define UBEPTDELETE(bus,ept) (*((bus)->ub_hwdisp->hcdrv_ept_delete))(bus,ept) +#define UBEPTSETMPS(bus,ept,mps) (*((bus)->ub_hwdisp->hcdrv_ept_setmps))(bus,ept,mps) +#define UBEPTSETADDR(bus,ept,addr) (*((bus)->ub_hwdisp->hcdrv_ept_setaddr))(bus,ept,addr) +#define UBEPTCLEARTOGGLE(bus,ept) (*((bus)->ub_hwdisp->hcdrv_ept_cleartoggle))(bus,ept) +#define UBXFER(bus,ept,xfer) (*((bus)->ub_hwdisp->hcdrv_xfer))(bus,ept,xfer) + +/* ********************************************************************* + * Devices - methods for abstracting things that _use_ USB + * (devices you can plug into the USB) - the entry points + * here are basically just for device discovery, since the top half + * of the actual driver will be device-specific. + ********************************************************************* */ + +struct usb_driver_s { + char *udrv_name; + int (*udrv_attach)(usbdev_t *,usb_driver_t *); + int (*udrv_detach)(usbdev_t *); +}; + +typedef struct usb_drvlist_s { + int udl_class; + int udl_vendor; + int udl_product; + usb_driver_t *udl_disp; +} usb_drvlist_t; + +extern usb_driver_t *usb_find_driver(usbdev_t *dev); + +#define CLASS_ANY -1 +#define VENDOR_ANY -1 +#define PRODUCT_ANY -1 + +void mydelay(int x); + +#define IS_HUB(dev) ((dev)->ud_devdescr.bDeviceClass == USB_DEVICE_CLASS_HUB) + +/* ********************************************************************* + * Error codes + ********************************************************************* */ + +#define USBD_ERR_OK 0 /* Request ok */ +#define USBD_ERR_STALLED -1 /* Endpoint is stalled */ +#define USBD_ERR_IOERROR -2 /* I/O error */ +#define USBD_ERR_HWERROR -3 /* Hardware failure */ +#define USBD_ERR_CANCELED -4 /* Request canceled */ +#define USBD_ERR_NOMEM -5 /* Out of memory */ +#define USBD_ERR_TIMEOUT -6 /* Request timeout */ + +/* ********************************************************************* + * Debug routines + ********************************************************************* */ + +void usb_dbg_dumpportstatus(int port,usb_port_status_t *portstatus,int level); +void usb_dbg_dumpdescriptors(usbdev_t *dev,uint8_t *ptr,int len); +void usb_dbg_dumpcfgdescr(usbdev_t *dev); +void usb_dbg_dumpeptdescr(usb_endpoint_descr_t * epdscr); diff --git a/cfe/cfe/usb/usbdebug.c b/cfe/cfe/usb/usbdebug.c new file mode 100644 index 0000000..14ed866 --- /dev/null +++ b/cfe/cfe/usb/usbdebug.c @@ -0,0 +1,307 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB debugging code File: usbdebug.c + * + * This module contains debug code for USB. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _CFE_ +#include +#include +#include +#include +#include "usbhack.h" +#else +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#endif + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" + + +void usb_dbg_dumpportstatus(int port,usb_port_status_t *portstatus,int level) +{ + int idx; + uint16_t x; + + for (idx = 0; idx < level; idx++) printf(" "); + printf("PORT %d STATUS\n",port); + + for (idx = 0; idx < level; idx++) printf(" "); + x = GETUSBFIELD((portstatus),wPortStatus); + printf("wPortStatus = %04X ",x); + if (x & 1) printf("DevicePresent "); + if (x & 2) printf("Enabled "); + if (x & 4) printf("Suspend "); + if (x & 8) printf("OverCurrent "); + if (x & 16) printf("InReset "); + if (x & 256) printf("Powered "); + if (x & 512) printf("LowSpeed "); + printf("\n"); + for (idx = 0; idx < level; idx++) printf(" "); + x = GETUSBFIELD((portstatus),wPortChange); + printf("wPortChange = %04X ",x); + if (x & 1) printf("ConnectChange "); + if (x & 2) printf("EnableChange "); + if (x & 4) printf("SuspendChange "); + if (x & 8) printf("OverCurrentChange "); + if (x & 16) printf("ResetChange "); + printf("\n"); +} + +void usb_dbg_dumpeptdescr(usb_endpoint_descr_t * epdscr) +{ + printf("---------------------------------------------------\n"); + printf("ENDPOINT DESCRIPTOR\n"); + + printf("bLength = %d\n",epdscr->bLength); + printf("bDescriptorType = %d\n",epdscr->bDescriptorType); + printf("bEndpointAddr = %02X\n",epdscr->bEndpointAddress); + printf("bmAttrbutes = %02X\n",epdscr->bmAttributes); + printf("wMaxPacketSize = %d\n",GETUSBFIELD(epdscr,wMaxPacketSize)); + printf("bInterval = %d\n",epdscr->bInterval); +} + +static char *getstringmaybe(usbdev_t *dev,int string) +{ + static char buf[256]; + + return ""; + + if (string == 0) { + strcpy(buf,"none"); + return buf; + } + + memset(buf,0,sizeof(buf)); + + usb_get_string(dev,string,buf,sizeof(buf)); + + return buf; +} + +void usb_dbg_dumpdescriptors(usbdev_t *dev,uint8_t *ptr,int len) +{ + uint8_t *endptr; + usb_config_descr_t *cfgdscr; + usb_interface_descr_t *ifdscr; + usb_device_descr_t *devdscr; + usb_endpoint_descr_t *epdscr; + usb_hid_descr_t *hiddscr; + usb_hub_descr_t *hubdscr; + static char *eptattribs[4] = {"Control","Isoc","Bulk","Interrupt"}; + int idx; + + endptr = ptr + len; + + while (ptr < endptr) { + + cfgdscr = (usb_config_descr_t *) ptr; + + switch (cfgdscr->bDescriptorType) { + case USB_DEVICE_DESCRIPTOR_TYPE: + devdscr = (usb_device_descr_t *) ptr; + printf("---------------------------------------------------\n"); + printf("DEVICE DESCRIPTOR\n"); + printf("bLength = %d\n",devdscr->bLength); + printf("bDescriptorType = %d\n",devdscr->bDescriptorType); + printf("bcdUSB = %04X\n",GETUSBFIELD(devdscr,bcdUSB)); + printf("bDeviceClass = %d\n",devdscr->bDeviceClass); + printf("bDeviceSubClass = %d\n",devdscr->bDeviceSubClass); + printf("bDeviceProtocol = %d\n",devdscr->bDeviceProtocol); + printf("bMaxPktSize0 = %d\n",devdscr->bMaxPacketSize0); + if (endptr-ptr <= 8) break; + printf("idVendor = %04X (%d)\n", + GETUSBFIELD(devdscr,idVendor), + GETUSBFIELD(devdscr,idVendor)); + printf("idProduct = %04X (%d)\n", + GETUSBFIELD(devdscr,idProduct), + GETUSBFIELD(devdscr,idProduct)); + printf("bcdDevice = %04X\n",GETUSBFIELD(devdscr,bcdDevice)); + printf("iManufacturer = %d (%s)\n", + devdscr->iManufacturer, + getstringmaybe(dev,devdscr->iManufacturer)); + printf("iProduct = %d (%s)\n", + devdscr->iProduct, + getstringmaybe(dev,devdscr->iProduct)); + printf("iSerialNumber = %d (%s)\n", + devdscr->iSerialNumber, + getstringmaybe(dev,devdscr->iSerialNumber)); + printf("bNumConfigs = %d\n",devdscr->bNumConfigurations); + break; + case USB_CONFIGURATION_DESCRIPTOR_TYPE: + + cfgdscr = (usb_config_descr_t *) ptr; + printf("---------------------------------------------------\n"); + printf("CONFIG DESCRIPTOR\n"); + + printf("bLength = %d\n",cfgdscr->bLength); + printf("bDescriptorType = %d\n",cfgdscr->bDescriptorType); + printf("wTotalLength = %d\n",GETUSBFIELD(cfgdscr,wTotalLength)); + printf("bNumInterfaces = %d\n",cfgdscr->bNumInterfaces); + printf("bConfigValue = %d\n",cfgdscr->bConfigurationValue); + printf("iConfiguration = %d (%s)\n", + cfgdscr->iConfiguration, + getstringmaybe(dev,cfgdscr->iConfiguration)); + printf("bmAttributes = %02X\n",cfgdscr->bmAttributes); + printf("MaxPower = %d (%dma)\n",cfgdscr->MaxPower,cfgdscr->MaxPower*2); + break; + + case USB_INTERFACE_DESCRIPTOR_TYPE: + printf("---------------------------------------------------\n"); + printf("INTERFACE DESCRIPTOR\n"); + + ifdscr = (usb_interface_descr_t *) ptr; + + printf("bLength = %d\n",ifdscr->bLength); + printf("bDescriptorType = %d\n",ifdscr->bDescriptorType); + printf("bInterfaceNum = %d\n",ifdscr->bInterfaceNumber); + printf("bAlternateSet = %d\n",ifdscr->bAlternateSetting); + printf("bNumEndpoints = %d\n",ifdscr->bNumEndpoints); + printf("bInterfaceClass = %d\n",ifdscr->bInterfaceClass); + printf("bInterSubClass = %d\n",ifdscr->bInterfaceSubClass); + printf("bInterfaceProto = %d\n",ifdscr->bInterfaceProtocol); + printf("iInterface = %d (%s)\n", + ifdscr->iInterface, + getstringmaybe(dev,ifdscr->iInterface)); + break; + + case USB_ENDPOINT_DESCRIPTOR_TYPE: + printf("---------------------------------------------------\n"); + printf("ENDPOINT DESCRIPTOR\n"); + + epdscr = (usb_endpoint_descr_t *) ptr; + + printf("bLength = %d\n",epdscr->bLength); + printf("bDescriptorType = %d\n",epdscr->bDescriptorType); + printf("bEndpointAddr = %02X (%d,%s)\n", + epdscr->bEndpointAddress, + epdscr->bEndpointAddress & 0x0F, + (epdscr->bEndpointAddress & USB_ENDPOINT_DIRECTION_IN) ? "IN" : "OUT" + ); + printf("bmAttrbutes = %02X (%s)\n", + epdscr->bmAttributes, + eptattribs[epdscr->bmAttributes&3]); + printf("wMaxPacketSize = %d\n",GETUSBFIELD(epdscr,wMaxPacketSize)); + printf("bInterval = %d\n",epdscr->bInterval); + break; + + case USB_HID_DESCRIPTOR_TYPE: + printf("---------------------------------------------------\n"); + printf("HID DESCRIPTOR\n"); + + hiddscr = (usb_hid_descr_t *) ptr; + + printf("bLength = %d\n",hiddscr->bLength); + printf("bDescriptorType = %d\n",hiddscr->bDescriptorType); + printf("bcdHID = %04X\n",GETUSBFIELD(hiddscr,bcdHID)); + printf("bCountryCode = %d\n",hiddscr->bCountryCode); + printf("bNumDescriptors = %d\n",hiddscr->bNumDescriptors); + printf("bClassDescrType = %d\n",hiddscr->bClassDescrType); + printf("wClassDescrLen = %d\n",GETUSBFIELD(hiddscr,wClassDescrLength)); + break; + + case USB_HUB_DESCRIPTOR_TYPE: + printf("---------------------------------------------------\n"); + printf("HUB DESCRIPTOR\n"); + + hubdscr = (usb_hub_descr_t *) ptr; + + printf("bLength = %d\n",hubdscr->bDescriptorLength); + printf("bDescriptorType = %d\n",hubdscr->bDescriptorType); + printf("bNumberOfPorts = %d\n",hubdscr->bNumberOfPorts); + printf("wHubCharacters = %04X\n",GETUSBFIELD(hubdscr,wHubCharacteristics)); + printf("bPowerOnToPwrGd = %d\n",hubdscr->bPowerOnToPowerGood); + printf("bHubControlCurr = %d (ma)\n",hubdscr->bHubControlCurrent); + printf("bRemPwerMask[0] = %02X\n",hubdscr->bRemoveAndPowerMask[0]); + + break; + + default: + printf("---------------------------------------------------\n"); + printf("UNKNOWN DESCRIPTOR\n"); + printf("bLength = %d\n",cfgdscr->bLength); + printf("bDescriptorType = %d\n",cfgdscr->bDescriptorType); + printf("Data Bytes = "); + for (idx = 0; idx < cfgdscr->bLength; idx++) { + printf("%02X ",ptr[idx]); + } + printf("\n"); + + } + + ptr += cfgdscr->bLength; + + } +} + + +void usb_dbg_dumpcfgdescr(usbdev_t *dev) +{ + uint8_t buffer[512]; + int res; + int len; + usb_config_descr_t *cfgdscr; + + memset(buffer,0,sizeof(buffer)); + + cfgdscr = (usb_config_descr_t *) &buffer[0]; + + res = usb_get_config_descriptor(dev,cfgdscr,0,sizeof(usb_config_descr_t)); + if (res != sizeof(usb_config_descr_t)) { + printf("[a]usb_get_config_descriptor returns %d\n",res); + } + + len = GETUSBFIELD(cfgdscr,wTotalLength); + + res = usb_get_config_descriptor(dev,cfgdscr,0,len); + if (res != len) { + printf("[b]usb_get_config_descriptor returns %d\n",res); + } + + usb_dbg_dumpdescriptors(dev,&buffer[0],res); +} diff --git a/cfe/cfe/usb/usbdevs.c b/cfe/cfe/usb/usbdevs.c new file mode 100644 index 0000000..53a0754 --- /dev/null +++ b/cfe/cfe/usb/usbdevs.c @@ -0,0 +1,168 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB Driver List File: usbdevs.c + * + * This module contains a table of supported USB devices and + * the routines to look up appropriate drivers given + * USB product, device, and class codes. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _CFE_ +#include +#include +#include +#include "usbhack.h" +#else +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#endif + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" + +/* ********************************************************************* + * The list of drivers we support. If you add more drivers, + * list them here. + ********************************************************************* */ + +extern usb_driver_t usbhub_driver; +extern usb_driver_t usbhid_driver; +extern usb_driver_t usbmass_driver; +extern usb_driver_t usbserial_driver; +extern usb_driver_t usbeth_driver; + +usb_drvlist_t usb_drivers[] = { + + /* + * Hub driver + */ + + {USB_DEVICE_CLASS_HUB, VENDOR_ANY, PRODUCT_ANY, &usbhub_driver}, + + /* + * Keyboards and mice + */ + + {USB_DEVICE_CLASS_HUMAN_INTERFACE, VENDOR_ANY,PRODUCT_ANY, &usbhid_driver}, + + /* + * Mass storage devices + */ + + {USB_DEVICE_CLASS_STORAGE, VENDOR_ANY, PRODUCT_ANY, &usbmass_driver}, + + /* + * Serial ports + */ + + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x557,0x2008,&usbserial_driver}, + + /* + * Ethernet Adapters + */ + + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x506,0x4601,&usbeth_driver}, /* 3Com */ + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x66b,0x2202,&usbeth_driver}, /* Linksys */ + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x66b,0x2203,&usbeth_driver}, /* Linksys */ + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x66b,0x2204,&usbeth_driver}, /* Linksys */ + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x66b,0x2206,&usbeth_driver}, /* Linksys */ + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x66b,0x400b,&usbeth_driver}, /* Linksys */ + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x66b,0x200c,&usbeth_driver}, /* Linksys */ + {USB_DEVICE_CLASS_RESERVED,0xbda,0x8150,&usbeth_driver}, /* Realtek */ + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x423,0x000a,&usbeth_driver}, /* CATC */ + {USB_DEVICE_CLASS_VENDOR_SPECIFIC,0x423,0x000c,&usbeth_driver}, /* Belkin */ + + {0,0,0,NULL} +}; + + +/* ********************************************************************* + * usb_find_driver(class,vendor,product) + * + * Find a suitable device driver to handle the specified + * class, vendor, or product. + * + * Input parameters: + * devdescr - device descriptor + * + * Return value: + * pointer to device driver or NULL + ********************************************************************* */ + +usb_driver_t *usb_find_driver(usbdev_t *dev) +{ + usb_device_descr_t *devdescr; + usb_interface_descr_t *ifdescr; + usb_drvlist_t *list; + int dclass,vendor,product; + + devdescr = &(dev->ud_devdescr); + + dclass = devdescr->bDeviceClass; + if (dclass == 0) { + ifdescr = usb_find_cfg_descr(dev,USB_INTERFACE_DESCRIPTOR_TYPE,0); + if (ifdescr) dclass = ifdescr->bInterfaceClass; + } + + vendor = (int) GETUSBFIELD(devdescr,idVendor); + product = (int) GETUSBFIELD(devdescr,idProduct); + + printf("USB: Locating Class %02X Vendor %04X Product %04X: ",dclass,vendor,product); + + list = usb_drivers; + while (list->udl_disp) { + if (((list->udl_class == dclass) || (list->udl_class == CLASS_ANY)) && + ((list->udl_vendor == vendor) || (list->udl_vendor == VENDOR_ANY)) && + ((list->udl_product == product) || (list->udl_product == PRODUCT_ANY))) { + printf("%s\n",list->udl_disp->udrv_name); + return list->udl_disp; + } + list++; + } + + printf("Not found.\n"); + + return NULL; +} diff --git a/cfe/cfe/usb/usbeth.c b/cfe/cfe/usb/usbeth.c new file mode 100644 index 0000000..bc5aeb0 --- /dev/null +++ b/cfe/cfe/usb/usbeth.c @@ -0,0 +1,850 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB Ethernet File: usbeth.c + * + * Driver for USB Ethernet devices. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* ********************************************************************* + * USB-Ethernet driver - CFE Network Layer Interfaces + * NOTE: Some of the device setup for the Admtek & Realtek devices + * was derived from reverse engineering! So these interfaces + * assume proper device operation. + ********************************************************************* */ + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_string.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_ioctl.h" +#include "cfe_timer.h" +#include "cfe_device.h" +#include "cfe_devfuncs.h" +#include "cfe_error.h" + +#include "usbd.h" +#include "usbeth.h" + +#if 0 +#define USBETH_TRACE( x, y ... ) xprintf( x, ##y ) +#else +#define USBETH_TRACE( x, y ... ) +#endif + +#define FAIL -1 + +static int Dev_cnt = 0; + + +/****************************************************************************** + Debug functions +******************************************************************************/ + +//#define DATA_DUMP +#ifdef DATA_DUMP +static void hexdump( unsigned char * src, int srclen, int rowlen, int rows ) +{ + unsigned char * rowptr; + unsigned char * srcstp; + unsigned char * byteptr; + + srcstp = src + srclen; + + for( rowptr = src; rowptr < src + rowlen * rows; rowptr += rowlen ) { + for( byteptr = rowptr; byteptr < rowptr + rowlen && byteptr < srcstp; byteptr++ ) { + xprintf( "%2X ", *byteptr ); + } + xprintf( "\n" ); + } + xprintf( "\n" ); +} +#endif + + +/* ********************************************************************* + * Interface functions for USB-Ethernet adapters + ********************************************************************* */ + +enum { PEGASUS, PEGASUS_II, NETMATE, REALTEK }; +enum { VEN_NONE, _3_COM, LINKSYS, LINKSYS_10, LINKSYS_100, + CATC_NM, BELKIN_CATC, LINKSYS_100M }; +static char * VENDOR_NAMES[] = +{ + "?", "3-COM", "LinkSys", "LinkSys-10TX", "LinkSys-100TX", + "CATC-Netmate", "Belkin/CATC", "Linksys-100M", "Yikes!" +}; + +typedef struct usbeth_softc_s +{ + usbdev_t *dev; + int bulk_inpipe; + int bulk_outpipe; + int dev_id; + int ven_code; + int embed_tx_len; + uint8_t mac_addr[6]; + usbreq_t *rx_ur; + uint8_t rxbuf[1600]; //artbitrary but enough for ethernet packet +} usbeth_softc_t; + + +/* ************************************** + * CATC I/F Functions + ************************************** */ + +#if 0 +static int catc_get_reg( usbdev_t *dev, int16_t reg, uint8_t *val ) +{ + return usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_IN), + CATC_GET_REG, 0, reg, val, 1 ); +} +#endif + +static int catc_set_reg( usbdev_t *dev, int16_t reg, int16_t val ) +{ + return usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_OUT), + CATC_SET_REG, val, reg, NULL, 0 ); +} + +static int catc_set_mem( usbdev_t *dev, int16_t addr, + uint8_t *data, int16_t len ) +{ + return usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_OUT), + CATC_SET_MEM, 0, addr, data, len ); +} + +static int catc_get_mac_addr( usbdev_t *dev, uint8_t *mac_addr ) +{ + int status; + + status = usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_IN), + CATC_GET_MAC_ADDR, 0, 0, mac_addr, 6 ); + return( status ); +} + +static void catc_init_device( usbeth_softc_t * softc ) +{ + usbdev_t *dev = softc->dev; + unsigned char *mcast_tbl; + + usb_std_request( dev, (USBREQ_TYPE_STD | USBREQ_REC_INTERFACE), + USB_REQUEST_SET_INTERFACE, + 1, //alt setting 1 + 0, NULL, 0 ); + + catc_set_reg(dev, CATC_TX_BUF_CNT_REG, 0x04 ); + catc_set_reg(dev, CATC_RX_BUF_CNT_REG, 0x10 ); + catc_set_reg(dev, CATC_ADV_OP_MODES_REG, 0x01 ); + catc_set_reg(dev, CATC_LED_CTRL_REG, 0x08 ); + + /* Enable broadcast rx via bit in mutlicast table */ + mcast_tbl = KMALLOC(64, 0); + memset( mcast_tbl, 0, 64 ); + mcast_tbl[31] = 0x80; //i.e. broadcast bit + catc_set_mem( dev, CATC_MCAST_TBL_ADDR, mcast_tbl, 64 ); + KFREE(mcast_tbl); + + //Read the adapter's MAC addr + catc_get_mac_addr( dev, softc->mac_addr ); +} + +static void catc_close_device( usbdev_t *dev ) +{ + // Now disable adapter from receiving packets + catc_set_reg( dev, CATC_ETH_CTRL_REG, 0 ); +} + +static void catc_open_device( usbeth_softc_t * softc ) +{ + int i; + + for(i = 0; i < 6; ++i) + catc_set_reg( softc->dev, (CATC_ETH_ADDR_0_REG - i), softc->mac_addr[i] ); + + // Now enable adapter to receive packets + catc_set_reg( softc->dev, CATC_ETH_CTRL_REG, 0x09 ); +} + +/* ************************************** + * PEGASUS I/F Functions + ************************************** */ + +static int peg_get_reg( usbdev_t *dev, int16_t reg, uint8_t *val, int16_t len ) +{ + return usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_IN), + PEG_GET_REG, 0, reg, val, len ); +} + +static int peg_set_reg( usbdev_t *dev, int16_t reg, int16_t val ) +{ + unsigned char data = (uint8_t) val & 0xff; + + return usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_OUT), + PEG_SET_REG, val, reg, &data, 1 ); +} + +static int peg_set_regs( usbdev_t *dev, int16_t reg, int8_t *vals, int16_t len ) +{ + return usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_OUT), + PEG_SET_REG, 0, reg, vals, len ); +} + +static int peg_get_eep_word( usbdev_t *dev, int16_t ofs, uint8_t *val ) +{ + int status=0, tries=20; + uint8_t data[2]; + + if( peg_set_reg( dev, PEG_EEPROM_CTL_REG, 0 ) == FAIL ) + return FAIL; + if( peg_set_reg( dev, PEG_EEPROM_OFS_REG, ofs ) == FAIL ) + return FAIL; + if( peg_set_reg( dev, PEG_EEPROM_CTL_REG, 0x02 ) == FAIL ) //read + return FAIL; + while( --tries ) + { + if( peg_get_reg( dev, PEG_EEPROM_CTL_REG, data, 1 ) == FAIL ) + return FAIL; + if( data[0] & 0x04 ) + break; //eeprom data ready + } + if( !tries ) + { + xprintf( "Pegasus Eeprom read failed!\n" ); + return FAIL; + } + if( peg_get_reg( dev, PEG_EEPROM_DATA_REG, data, 2 ) == FAIL ) + return FAIL; + val[0] = data[0]; + val[1] = data[1]; + + return( status ); +} + +static int peg_get_mac_addr( usbdev_t *dev, uint8_t *mac_addr ) +{ + int i, status; + + for( i = 0; i < 3; ++i ) + { + status = peg_get_eep_word( dev, i, &mac_addr[i*2] ); + } + return( status ); +} + +static void peg_init_phy( usbdev_t *dev ) +{ //needed for earlier versions (before Rev B) of the USB-100TX adapters + static uint8_t phy_magic_wr[] = { 0, 4, 0, 0x1b }; + static uint8_t read_status[] = { 0, 0, 0, 1 }; + uint8_t data[4]; + + //reset the MAC ans set up GPIOs + peg_set_reg( dev, PEG_ETH_CTL1_REG, 0x08 ); + peg_get_reg( dev, PEG_ETH_CTL1_REG, data, 1 ); + + //do following steps to enable link activitiy LED + peg_set_reg( dev, PEG_GPIO1_REG, 0x26 ); + peg_set_reg( dev, PEG_GPIO0_REG, 0x24 ); + peg_set_reg( dev, PEG_GPIO0_REG, 0x26 ); + + //do following set of steps to enable LINK LED + memcpy( data, phy_magic_wr, 4 ); + peg_set_regs( dev, PEG_PHY_ADDR_REG, data, 4); //set up for magic word + peg_set_reg( dev, PEG_PHY_CTRL_REG, (0x1b|PHY_WRITE) ); + peg_get_reg( dev, PEG_PHY_CTRL_REG, data, 1 ); //read status of write + memcpy( data, read_status, 4 ); + peg_set_regs( dev, PEG_PHY_ADDR_REG, data, 4); //set up for phy status reg + peg_set_reg( dev, PEG_PHY_CTRL_REG, (1|PHY_READ) ); + peg_get_reg( dev, PEG_PHY_CTRL_REG, data, 1 ); //read status of read + peg_get_reg( dev, PEG_PHY_DATA_REG, data, 2 ); //read status regs +} + +static void peg_init_device( usbeth_softc_t * softc ) +{ + usbdev_t *dev = softc->dev; + + if( softc->dev_id == PEGASUS_II ) + peg_set_reg( dev, PEG_INT_PHY_REG, 0x02 ); //enable internal PHY + else + peg_init_phy( dev ); + + //Read the adapter's MAC addr + peg_get_mac_addr( dev, softc->mac_addr ); +} + +static void peg_close_device( usbdev_t *dev ) +{ + //Now disable adapter from receiving or transmitting packets + peg_set_reg( dev, PEG_ETH_CTL1_REG, 0 ); +} + +static void peg_open_device( usbeth_softc_t * softc ) +{ + usbdev_t *dev = softc->dev; + + //Now setup adapter's receiver with MAC address + peg_set_regs( dev, PEG_MAC_ADDR_0_REG, softc->mac_addr, 6 ); + + //Now enable adapter to receive and transmit packets + peg_set_reg( dev, PEG_ETH_CTL0_REG, 0xc1 ); + peg_set_reg( dev, PEG_ETH_CTL1_REG, 0x30 ); +} + +/* ************************************** + * REALTEK I/F Functions + ************************************** */ + +// +// ********** NOT FULLY WORKING YET!!!!!!!!!! *************** +// + +static int rtek_get_reg( usbdev_t *dev, int16_t reg, uint8_t *val, int16_t len ) +{ + return usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_IN), + RTEK_REG_ACCESS, reg, 0, val, len ); +} + +static int rtek_set_reg( usbdev_t *dev, int16_t reg, int16_t val ) +{ + unsigned char data = (uint8_t) val & 0xff; + + return usb_std_request( dev, (USBREQ_TYPE_VENDOR | USBREQ_DIR_OUT), + RTEK_REG_ACCESS, reg, 0, &data, 1 ); +} + +static int rtek_get_mac_addr( usbdev_t *dev, uint8_t *mac_addr ) +{ + int status; + + status = rtek_get_reg( dev, RTEK_MAC_REG, mac_addr, 6 ); + + return( status ); +} + +static void rtek_init_device( usbeth_softc_t * softc ) +{ + int i; + usbdev_t *dev = softc->dev; + uint8_t val; + + //Reset the adapter + rtek_set_reg( dev, RTEK_CMD_REG, RTEK_RESET ); + for( i = 0; i < 10; ++i ) + { + rtek_get_reg( dev, RTEK_CMD_REG, &val, 1 ); + if( !(val & RTEK_RESET) ) + break; + usb_delay_ms( NULL, 1 ); + } + + //autoload the internal registers + rtek_set_reg( dev, RTEK_CMD_REG, RTEK_AUTOLOAD ); + for( i = 0; i < 50; ++i ) + { + rtek_get_reg( dev, RTEK_CMD_REG, &val, 1 ); + if( !(val & RTEK_AUTOLOAD) ) + break; + usb_delay_ms( NULL, 1 ); + } + + //Read the adapter's MAC addr + rtek_get_mac_addr( dev, softc->mac_addr ); +} + +static void rtek_close_device( usbdev_t *dev ) +{ + //Now disable adapter from receiving or transmitting packets + rtek_set_reg( dev, RTEK_CMD_REG, 0 ); +} + +static void rtek_open_device( usbeth_softc_t * softc ) +{ + //accept broadcast & own packets + rtek_set_reg( softc->dev, RTEK_RXCFG_REG, 0x0c ); + + //Now enable adapter to receive and transmit packets + rtek_set_reg( softc->dev, RTEK_CMD_REG, 0x0c ); +} + +//*********************** USB-ETH I/F Functions **************************** + +static const int ID_TBL[] = +{ + 0x0506, 0x4601, PEGASUS_II, _3_COM, //3-Com + 0x066b, 0x2202, PEGASUS_II, LINKSYS_10, //LinkSys + 0x066b, 0x2203, PEGASUS, LINKSYS_100, + 0x066b, 0x2204, PEGASUS, LINKSYS_100, + 0x066b, 0x2206, PEGASUS, LINKSYS, + 0x066b, 0x400b, PEGASUS_II, LINKSYS_10, + 0x066b, 0x200c, PEGASUS_II, LINKSYS_10, + 0x0bda, 0x8150, REALTEK, LINKSYS_100M, + 0x0423, 0x000a, NETMATE, CATC_NM, //CATC (Netmate I) + 0x0423, 0x000c, NETMATE, BELKIN_CATC, //Belkin & CATC (Netmate II) + -1 +}; + +static int usbeth_init_device( usbeth_softc_t * softc ) +{ + int i; + usb_device_descr_t dev_desc; + uint16_t vendor_id, device_id; + const int *ptr=ID_TBL; + + //find out which device is connected + usb_get_device_descriptor( softc->dev, &dev_desc, 0 ); + vendor_id = (dev_desc.idVendorHigh << 8) + dev_desc.idVendorLow; + device_id = (dev_desc.idProductHigh << 8) + dev_desc.idProductLow; + xprintf( "USB device: vendor id %04x, device id %04x\n", + vendor_id, device_id ); + + while( *ptr != -1 ) + { + if( (vendor_id == ptr[0]) && (device_id == ptr[1]) ) + { + softc->dev_id = ptr[2]; + softc->ven_code = ptr[3]; + break; + } + ptr += 4; + } + if( *ptr == -1 ) + { + xprintf( "Unrecognized USB-Ethernet device\n" ); + return -1; + } + + //init the adapter + if( softc->dev_id == NETMATE ) + { + catc_init_device( softc ); + softc->embed_tx_len = 1; + } + else + { + if( softc->dev_id == REALTEK ) + { + rtek_init_device( softc ); + softc->embed_tx_len = 0; + } + else + { + peg_init_device( softc ); + softc->embed_tx_len = 1; + } + } + + //display adapter info + xprintf( "%s USB-Ethernet Adapter (", VENDOR_NAMES[softc->ven_code] ); + for( i = 0; i < 6; ++i ) + xprintf( "%02x%s", softc->mac_addr[i], (i == 5) ? ")\n" : ":" ); + + return 0; +} + +static int usbeth_get_dev_addr( usbeth_softc_t * softc, uint8_t *mac_addr ) +{ + memcpy( mac_addr, softc->mac_addr, 6 ); + return 0; +} + +static void usbeth_queue_rx( usbeth_softc_t * softc ) +{ + softc->rx_ur = usb_make_request(softc->dev, softc->bulk_inpipe, + softc->rxbuf, sizeof(softc->rxbuf), + (UR_FLAG_IN | UR_FLAG_SHORTOK)); + usb_queue_request(softc->rx_ur); +} + +static void usbeth_close_device( usbeth_softc_t * softc ) +{ + if( softc->dev_id == NETMATE ) + catc_close_device( softc->dev ); + else if( softc->dev_id == REALTEK ) + rtek_close_device( softc->dev ); + else + peg_close_device( softc->dev ); +} + +static void usbeth_open_device( usbeth_softc_t * softc ) +{ + if( softc->dev_id == NETMATE ) + catc_open_device( softc ); + else if( softc->dev_id == REALTEK ) + rtek_open_device( softc ); + else + peg_open_device( softc ); + + //kick start the receive + usbeth_queue_rx( softc ); +} + +static int usbeth_data_rx( usbeth_softc_t * softc ) +{ + usb_poll(softc->dev->ud_bus); + return( !softc->rx_ur->ur_inprogress ); +} + +static int usbeth_get_eth_frame( usbeth_softc_t * softc, unsigned char * buf ) +{ + int len = 0; + + if( !softc->rx_ur->ur_inprogress ) + { + len = softc->rx_ur->ur_xferred; + memcpy( buf, softc->rxbuf, len ); + usb_free_request(softc->rx_ur); + usbeth_queue_rx( softc ); + } + else + xprintf( "Bulk data is not available yet!\n" ); + + return( len ); +} + +static int usbeth_send_eth_frame( usbeth_softc_t * softc, unsigned char * buf, int len ) +{ + usbreq_t *ur; + int txlen = len; + unsigned char * txbuf; + + if(softc->embed_tx_len) + { + txbuf = KMALLOC((len+2), 0); + txbuf[0] = txlen & 0xff; + txbuf[1] = (txlen >> 8) & 0xff; //1st two bytes...little endian + memcpy( &txbuf[2], buf, txlen ); + txlen += 2; + } + else + { + if( softc->dev_id == REALTEK ) + { + //Now for some Realtek chip workarounds + if( txlen < 60 ) //some strange limitation + txlen = 60; + else if( !(txlen % 64) ) //to handle module 64 packets + ++txlen; + } + txbuf = KMALLOC(txlen, 0); + memcpy( txbuf, buf, txlen ); + } + ur = usb_make_request(softc->dev, softc->bulk_outpipe, + txbuf, txlen, UR_FLAG_OUT); + usb_sync_request(ur); + usb_free_request(ur); + KFREE(txbuf); + + return( len ); +} + + +/* ********************************************************************* + * CFE-USB interfaces + ********************************************************************* */ + +/* ********************************************************************* + * usbeth_attach(dev,drv) + * + * This routine is called when the bus scan stuff finds a usb-ethernet + * device. We finish up the initialization by configuring the + * device and allocating our softc here. + * + * Input parameters: + * dev - usb device, in the "addressed" state. + * drv - the driver table entry that matched + * + * Return value: + * 0 + ********************************************************************* */ + +const cfe_driver_t usbethdrv; //forward declaration + +static int usbeth_attach(usbdev_t *dev,usb_driver_t *drv) +{ + usb_config_descr_t *cfgdscr = dev->ud_cfgdescr; + usb_endpoint_descr_t *epdscr; + usb_endpoint_descr_t *indscr = NULL; + usb_endpoint_descr_t *outdscr = NULL; + usb_interface_descr_t *ifdscr; + usbeth_softc_t *softc; + int idx; + + dev->ud_drv = drv; + + softc = (usbeth_softc_t *) KMALLOC( sizeof(usbeth_softc_t), 0 ); + if( softc == NULL ) + { + xprintf( "Failed to allocate softc memory.\n" ); + return -1; + } + memset( softc, 0, sizeof(usbeth_softc_t) ); + dev->ud_private = softc; + softc->dev = dev; + + ifdscr = usb_find_cfg_descr(dev,USB_INTERFACE_DESCRIPTOR_TYPE,0); + if (ifdscr == NULL) + { + xprintf("USBETH: ERROR...no interace descriptor\n"); + return -1; + } + + + for (idx = 0; idx < 2; idx++) + { + epdscr = usb_find_cfg_descr(dev,USB_ENDPOINT_DESCRIPTOR_TYPE,idx); + if (USB_ENDPOINT_DIR_OUT(epdscr->bEndpointAddress)) + outdscr = epdscr; + else + indscr = epdscr; + } + + if (!indscr || !outdscr) + { + /* + * Could not get descriptors, something is very wrong. + * Leave device addressed but not configured. + */ + xprintf("USBETH: ERROR...no endpoint descriptors\n"); + return -1; + } + + /* + * Choose the standard configuration. + */ + + usb_set_configuration(dev,cfgdscr->bConfigurationValue); + + // Quit if not able to initialize the device + if (usbeth_init_device(softc) < 0) + return -1; + + /* + * Open the pipes. + */ + + softc->bulk_inpipe = usb_open_pipe(dev,indscr); + softc->bulk_outpipe = usb_open_pipe(dev,outdscr); + + //Now attach this device as a CFE Ethernet device + cfe_attach( (cfe_driver_t *) &usbethdrv, softc, NULL, + usbethdrv.drv_description ); + + ++Dev_cnt; + + return 0; +} + +/* ********************************************************************* + * usbeth_detach(dev) + * + * This routine is called when the bus scanner notices that + * this device has been removed from the system. We should + * do any cleanup that is required. The pending requests + * will be cancelled automagically. + * + * Input parameters: + * dev - usb device + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbeth_detach(usbdev_t *dev) +{ + usbeth_softc_t *softc = (usbeth_softc_t *) dev->ud_private; + + --Dev_cnt; + KFREE(softc); + + //*** SHOULD DETACH THE ETHERNET DEVICE TOO...LATER + + return 0; +} + +// CFE USB device interface structure +usb_driver_t usbeth_driver = +{ + "Ethernet Device", + usbeth_attach, + usbeth_detach +}; + + + +/* ********************************************************************* + * CFE-Ethernet device interfaces + ********************************************************************* */ + + +static int usbeth_ether_open(cfe_devctx_t *ctx) +{ + if( !Dev_cnt ) + return CFE_ERR_NOTREADY; + + USBETH_TRACE( "%s called.\n", __FUNCTION__ ); + usbeth_open_device( (usbeth_softc_t *) ctx->dev_softc ); + + return 0; +} + +static int usbeth_ether_read( cfe_devctx_t * ctx, iocb_buffer_t * buffer ) +{ + if( !Dev_cnt ) + return CFE_ERR_NOTREADY; + + buffer->buf_retlen = usbeth_get_eth_frame( (usbeth_softc_t *)ctx->dev_softc, + buffer->buf_ptr ); + +#ifdef DATA_DUMP + xprintf( "Incoming packet :\n" ); + hexdump( buffer->buf_ptr, buffer->buf_retlen, 16, + buffer->buf_retlen / 16 + 1 ); +#endif + + return 0; +} + + +static int usbeth_ether_inpstat( cfe_devctx_t * ctx, iocb_inpstat_t * inpstat ) +{ + if( !Dev_cnt ) + return CFE_ERR_NOTREADY; + + inpstat->inp_status = usbeth_data_rx( (usbeth_softc_t *) ctx->dev_softc ); + + return 0; +} + + +static int usbeth_ether_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + if( !Dev_cnt ) + return CFE_ERR_NOTREADY; + + // Block until hw notifies you data is sent. + usbeth_send_eth_frame( (usbeth_softc_t *) ctx->dev_softc, buffer->buf_ptr, + buffer->buf_length ); + + return 0; +} + + +static int usbeth_ether_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + int retval = 0; + + if( !Dev_cnt ) + return CFE_ERR_NOTREADY; + + switch( (int)buffer->buf_ioctlcmd ) { + case IOCTL_ETHER_GETHWADDR: + USBETH_TRACE( "IOCTL_ETHER_GETHWADDR called.\n" ); + usbeth_get_dev_addr( (usbeth_softc_t *) ctx->dev_softc, + buffer->buf_ptr ); + break; + case IOCTL_ETHER_SETHWADDR: + xprintf( "IOCTL_ETHER_SETHWADDR not implemented.\n" ); + break; +#if 0 + case IOCTL_ETHER_GETSPEED: + xprintf( "GETSPEED not implemented.\n" ); + retval = -1; + break; + case IOCTL_ETHER_SETSPEED: + xprintf( "SETSPEED not implemented.\n" ); + retval = -1; + break; + case IOCTL_ETHER_GETLINK: + xprintf( "GETLINK not implemented.\n" ); + retval = -1; + break; + case IOCTL_ETHER_GETLOOPBACK: + xprintf( "GETLOOPBACK not implemented.\n" ); + retval = -1; + break; + case IOCTL_ETHER_SETLOOPBACK: + xprintf( "SETLOOPBACK not implemented.\n" ); + retval = -1; + break; +#endif + default: + xprintf( "Invalid IOCTL to usbeth_ether_ioctl.\n" ); + retval = -1; + } + + return retval; +} + + +static int usbeth_ether_close(cfe_devctx_t *ctx) +{ + if( !Dev_cnt ) + return CFE_ERR_NOTREADY; + + USBETH_TRACE( "%s called.\n", __FUNCTION__ ); + usbeth_close_device( (usbeth_softc_t *) ctx->dev_softc ); + + return 0; +} + + +// CFE ethernet device interface structures +const static cfe_devdisp_t usbeth_ether_dispatch = +{ + usbeth_ether_open, + usbeth_ether_read, + usbeth_ether_inpstat, + usbeth_ether_write, + usbeth_ether_ioctl, + usbeth_ether_close, + NULL, + NULL +}; + +const cfe_driver_t usbethdrv = +{ + "USB-Ethernet Device", + "eth", + CFE_DEV_NETWORK, + &usbeth_ether_dispatch, + NULL, //probe...not needed +}; + diff --git a/cfe/cfe/usb/usbeth.h b/cfe/cfe/usb/usbeth.h new file mode 100644 index 0000000..54f32ae --- /dev/null +++ b/cfe/cfe/usb/usbeth.h @@ -0,0 +1,112 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB Ethernet File: usbeth.h + * + * Driver for USB Ethernet devices. + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* ********************************************************************* + * USB-Ethernet adapter driver includes + ********************************************************************* */ + +#ifndef __usbeth_h__ +#define __usbeth_h__ + +/* ************************************** + * CATC Netmate adapter + ************************************** */ + +#define CATC_MCAST_TBL_ADDR 0xFA80 //in Netmate's SRAM +#define CATC_GET_MAC_ADDR 0xF2 +#define CATC_SET_REG 0xFA +#define CATC_GET_REG 0xFB +#define CATC_SET_MEM 0xFC + +#define CATC_TX_BUF_CNT_REG 0x20 +#define CATC_RX_BUF_CNT_REG 0x21 +#define CATC_ADV_OP_MODES_REG 0x22 +#define CATC_RX_FRAME_CNT_REG 0x24 + +#define CATC_ETH_CTRL_REG 0x60 +#define CATC_ENET_STATUS_REG 0x61 +#define CATC_ETH_ADDR_0_REG 0x67 // Byte #0 (leftmost) +#define CATC_LED_CTRL_REG 0x81 + + +/* ************************************** + * Admtek (PEGASUS II) adapter + ************************************** */ + +#define PEG_SET_REG 0xF1 +#define PEG_GET_REG 0xF0 + +#define PEG_MCAST_TBL_REG 0x08 +#define PEG_MAC_ADDR_0_REG 0x10 +#define PEG_EEPROM_OFS_REG 0x20 +#define PEG_EEPROM_DATA_REG 0x21 +#define PEG_EEPROM_CTL_REG 0x23 +#define PEG_PHY_ADDR_REG 0x25 +#define PEG_PHY_DATA_REG 0x26 //& 27 for 2 bytes +#define PEG_PHY_CTRL_REG 0x28 +#define PEG_ETH_CTL0_REG 0x00 +#define PEG_ETH_CTL1_REG 0x01 +#define PEG_ETH_CTL2_REG 0x02 +#define PEG_GPIO0_REG 0x7e +#define PEG_GPIO1_REG 0x7f +#define PEG_INT_PHY_REG 0x7b + +#define PHY_WRITE 0x20 +#define PHY_READ 0x40 + + +/* ************************************** + * Realtek adapter + ************************************** */ + +#define RTEK_REG_ACCESS 0x05 +#define RTEK_MAC_REG 0x0120 +#define RTEK_CMD_REG 0x012E +#define RTEK_RXCFG_REG 0x0130 +#define RTEK_RESET 0x10 +#define RTEK_AUTOLOAD 0x01 + + + +#endif //__usbeth_h_ diff --git a/cfe/cfe/usb/usbhack.c b/cfe/cfe/usb/usbhack.c new file mode 100644 index 0000000..647f213 --- /dev/null +++ b/cfe/cfe/usb/usbhack.c @@ -0,0 +1,528 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Main Module File: usbhack.c + * + * A crude test program to let us tinker with a USB controller + * installed in an X86 Linux PC. Eventually we'll clean up + * this stuff and incorporate it into CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" +#include "ohci.h" + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define OHCI_WRITECSR(softc,x,y) \ + *((volatile uint32_t *) ((softc)->ohci_regs + ((x)/sizeof(uint32_t)))) = (y) +#define OHCI_READCSR(softc,x) \ + *((volatile uint32_t *) ((softc)->ohci_regs + ((x)/sizeof(uint32_t)))) + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern int usb_noisy; +extern int ohcidebug; + +extern usbdev_t *usbmass_dev; +extern int usbmass_read_sector(usbdev_t *dev,uint32_t sectornum,uint32_t seccnt, + uint8_t *buffer); + + +/* ********************************************************************* + * Play Area definitions + * + * We use /dev/mem to map two areas - the "play" area and the + * "device" area. + * + * The "play" area maps to the upper 1MB of physical memory. + * You need to calculate this address yourself based on your system + * setup. If you have 256MB of memory, in your lilo.conf file put + * the following line: + * + * append="mem=255M" + * + * where '255' is one less than your system memory size. this + * leaves 1MB out of Linux's physical memory map and therefore + * leaves it to you to play with. /dev/mem will map this + * uncached using the Pentium MTRR registers, but for playing + * around this will be fine. + * + * the second area is the "device area" - this is the address + * the PCI USB controller's BARs were mapped to. You can find + * this by looking through /proc/pci until you find: + * + * Bus 0, device 8, function 0: + * USB Controller: OPTi Unknown device (rev 16). + * Vendor id=1045. Device id=c861. + * Medium devsel. Fast back-to-back capable. IRQ 3. + * Master Capable. Latency=32. + * Non-prefetchable 32 bit memory at 0xd9100000 [0xd9100000]. + * + * The 0xd9100000 will probably be different on your system. + * + * Of course, to make this work you'll need to rebuild the kernel + * without USB support, if you're running a recent kernel. + * Fortunately(?), I've been using RH 6.2, no USB support there + * in the old 2.2 kernels. + * + * Finally, you'll need to run this program as root. Even if + * you mess with the permissions on /dev/mem, there are additional + * checks in the kernel, so you will lose. + * + * But, the good news is that it works well - I've never crashed + * my Linux box, and I can use gdb to debug programs. + * You will NOT be able to use GDB to display things in the + * play area - I believe GDB doesn't know how to deal with + * the uncached nature of the memory there. You can see stuff + * in the area by tracing through instructions that read the play + * area, and viewing the register contents. + ********************************************************************* */ + +#define PLAY_AREA_ADDR (255*1024*1024) /* EDIT ME */ +#define PLAY_AREA_SIZE (1024*1024) +int play_fd = -1; +uint8_t *play_area = MAP_FAILED; + +#define DEVICE_AREA_ADDR 0xd9100000 /* EDIT ME */ +#define DEVICE_AREA_SIZE 4096 +int dev_fd = -1; +uint8_t *device_area = MAP_FAILED; + +/* ********************************************************************* + * Globals + ********************************************************************* */ + + +usbbus_t *bus = NULL; +ohci_softc_t *ohci = NULL; +int running = 1; + +/* ********************************************************************* + * vtop(v) + * + * Given a virtual address in the play area, return its physical + * address. + * + * Input parameters: + * v - virtual address + * + * Return value: + * physical address + ********************************************************************* */ + + +uint32_t vtop(void *v) +{ + uint32_t p = (uint32_t) v; + + if (v == 0) return 0; + + p -= (uint32_t) play_area; + p += PLAY_AREA_ADDR; + + return p; +} + +/* ********************************************************************* + * ptov(v) + * + * Given a phyiscal address in the play area, return the virtual + * address. + * + * Input parameters: + * p - physical address + * + * + * Return value: + * virtual address (void pointer) + ********************************************************************* */ + +void *ptov(uint32_t p) +{ + if (p == 0) return 0; + + p -= PLAY_AREA_ADDR; + p += (uint32_t) play_area; + + return (void *) p; +} + +/* ********************************************************************* + * mydelay(x) + * + * delay for 'x' milliseconds. + * + * Input parameters: + * x - milliseconds + * + * Return value: + * nothing + ********************************************************************* */ + +void mydelay(int x) +{ + struct timespec ts; + + ts.tv_sec = 0; + ts.tv_nsec = x * 1000000; /* milliseconds */ + nanosleep(&ts,NULL); +} + +/* ********************************************************************* + * console_log(tmplt,...) + * + * Display a console log message - this is a CFE function + * transplanted here. + * + * Input parameters: + * tmplt - printf string args... + * + * Return value: + * nothing + ********************************************************************* */ + +void console_log(const char *tmplt,...) +{ + char buffer[256]; + va_list marker; + + va_start(marker,tmplt); + vsprintf(buffer,tmplt,marker); + va_end(marker); + printf("%s\n",buffer); +} + +/* ********************************************************************* + * init_devaccess() + * + * Open /dev/mem and create the play area + * + * Input parameters: + * nothing + * + * Return value: + * 0 if ok, else error + ********************************************************************* */ + +int init_devaccess(void) +{ + int idx; + + play_fd = open("/dev/mem",O_RDWR); + + if (play_fd < 0) { + perror("open"); + return -1; + } + + dev_fd = open("/dev/mem",O_RDWR | O_SYNC); + + if (dev_fd < 0) { + perror("open"); + close(play_fd); + play_fd = -1; + return -1; + } + + play_area = mmap(NULL, + PLAY_AREA_SIZE, + PROT_READ|PROT_WRITE,MAP_SHARED, + play_fd, + PLAY_AREA_ADDR); + + if (play_area != MAP_FAILED) { + printf("Play area mapped ok at address %p to %p\n",play_area,play_area+PLAY_AREA_SIZE-1); + for (idx = 0; idx < PLAY_AREA_SIZE; idx++) { + play_area[idx] = 0x55; + if (play_area[idx] != 0x55) printf("Offset %x doesn't work\n",idx); + play_area[idx] = 0xaa; + if (play_area[idx] != 0xaa) printf("Offset %x doesn't work\n",idx); + play_area[idx] = 0x0; + if (play_area[idx] != 0x0) printf("Offset %x doesn't work\n",idx); + } + } + else { + perror("mmap"); + close(play_fd); + close(dev_fd); + play_fd = -1; + dev_fd = -1; + return -1; + } + + device_area = mmap(NULL, + DEVICE_AREA_SIZE, + PROT_READ|PROT_WRITE,MAP_SHARED, + dev_fd, + DEVICE_AREA_ADDR); + + if (device_area != MAP_FAILED) { + printf("Device area mapped ok at address %p\n",device_area); + } + else { + perror("mmap"); + munmap(play_area,PLAY_AREA_SIZE); + play_area = MAP_FAILED; + close(play_fd); + close(dev_fd); + play_fd = -1; + dev_fd = -1; + return -1; + } + + return 0; +} + + +/* ********************************************************************* + * uninit_devaccess() + * + * Turn off access to the /dev/mem area. this will also + * set the OHCI controller's state to reset if we were playing + * with it. + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +void uninit_devaccess(void) +{ + if (ohci->ohci_regs) { + OHCI_WRITECSR(ohci,R_OHCI_CONTROL,V_OHCI_CONTROL_HCFS(K_OHCI_HCFS_RESET)); + } + + if (play_area != MAP_FAILED) munmap(play_area,PLAY_AREA_SIZE); + if (device_area != MAP_FAILED) munmap(device_area,DEVICE_AREA_SIZE); + + if (play_fd > 0) close(play_fd); + if (dev_fd > 0) close(dev_fd); + + device_area = MAP_FAILED; + play_area = MAP_FAILED; + + dev_fd = -1; + play_fd = -1; +} + +/* ********************************************************************* + * sighandler() + * + * ^C handler - switch off OHCI controller + * + * Input parameters: + * sig - signal + * + * Return value: + * nothing + ********************************************************************* */ + +void sighandler(int sig) +{ + signal(SIGINT,SIG_DFL); + printf("Interrupted, controller reset\n"); + if (ohci->ohci_regs) { + OHCI_WRITECSR(ohci,R_OHCI_CONTROL,V_OHCI_CONTROL_HCFS(K_OHCI_HCFS_RESET)); + } + running = 0; +} + + +extern usb_hcdrv_t ohci_driver; + +/* ********************************************************************* + * xprintf(str) + * + * Called by lib_malloc, we need to supply it. + * + * Input parameters: + * str - string + * + * Return value: + * 0 + ********************************************************************* */ + +int xprintf(char *str) +{ + printf("%s",str); + return 0; +} + +/* ********************************************************************* + * main(argc,argv) + * + * Main test program + * + * Input parameters: + * argc,argv - guess. + * + * Return value: + * nothing + ********************************************************************* */ + + +int main(int argc,char *argv[]) +{ + int res; + memstats_t stats; + uint8_t *buffer; + + /* + * Parse command line args + */ + + for (res = 1; res < argc; res++) { + if (strcmp(argv[res],"-o") == 0) ohcidebug++; + if (strcmp(argv[res],"-u") == 0) usb_noisy++; + } + + /* + * Open the play area. + */ + + if (init_devaccess() < 0) { + printf("Could not map USB controller\n"); + } + + /* + * Establish signal and exit handlers + */ + + signal(SIGINT,sighandler); + atexit(uninit_devaccess); + + /* + * Initialize a buffer pool to point at the play area. + * the 'malloc' calls inside our driver will therefore + * allocate memory suitable for DMA, just like on real + * hardware. + */ + + KMEMINIT(play_area,PLAY_AREA_SIZE); + + buffer = KMALLOC(512,32); + + printf("-------------------------------------------\n\n"); + + /* + * Create the OHCI driver instance. + */ + + + bus = UBCREATE(&ohci_driver,(void *) device_area); + + /* + * Hack: retrieve copy of softc for our exception handler + */ + + ohci = (ohci_softc_t *) bus->ub_hwsoftc; + + /* + * Start the controller. + */ + + res = UBSTART(bus); + + if (res != 0) { + printf("Could not init hardware\n"); + UBSTOP(bus); + exit(1); + } + + /* + * Init the root hub + */ + + usb_initroot(bus); + + /* + * Main loop - just call interrupt routine to poll + */ + + while (usbmass_dev== NULL) { + usb_poll(bus); + usb_daemon(bus); + } + + for (res = 0; res < 1000; res++) { + usbmass_read_sector(usbmass_dev,0,1,buffer); + } + + printf("----- finished reading all sectors ----\n"); + + while (running) { + usb_poll(bus); + usb_daemon(bus); + } + + /* + * Clean up - get heap statistics to see if we + * screwed up. + */ + + res = KMEMSTATS(&stats); + if (res < 0) printf("Warning: heap is not consistent\n"); + else printf("Heap is ok\n"); + + exit(0); + +} diff --git a/cfe/cfe/usb/usbhack.h b/cfe/cfe/usb/usbhack.h new file mode 100644 index 0000000..9f95840 --- /dev/null +++ b/cfe/cfe/usb/usbhack.h @@ -0,0 +1,66 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * usb test harness definitions File: usbhack.h + * + * Anything special required by the test harness is defined + * here. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +/* ********************************************************************* + * Constants + ********************************************************************* */ + + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +void console_log(const char *tmplt,...); + diff --git a/cfe/cfe/usb/usbhack.mk b/cfe/cfe/usb/usbhack.mk new file mode 100644 index 0000000..361973e --- /dev/null +++ b/cfe/cfe/usb/usbhack.mk @@ -0,0 +1,23 @@ + +OBJS = usbhack.o lib_malloc.o lib_queue.o ohci.o usbd.o \ + usbdevs.o usbhub.o usbdebug.o usbhid.o usbmass.o usbserial.o + +CFLAGS = -I../include -g -Wall +VPATH = ../lib + +%.o : %.c + gcc $(CFLAGS) -c -o $@ $< + +all : usbhack + echo done + +usbhack : $(OBJS) + gcc -o usbhack $(OBJS) + +lib_malloc.o : lib_malloc.c + +usbhack.o : usbhack.c + + +clean : + rm -f *.o usbhack diff --git a/cfe/cfe/usb/usbhid.c b/cfe/cfe/usb/usbhid.c new file mode 100644 index 0000000..df84f4e --- /dev/null +++ b/cfe/cfe/usb/usbhid.c @@ -0,0 +1,664 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB Human Interface Driver File: usbhid.c + * + * This module deals with keyboards, mice, etc. It's very simple, + * and only the "boot protocol" is supported. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _CFE_ +#include +#include +#include +#include +#include "usbhack.h" +#else +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "cfe_console.h" +#endif + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define HID_BOOT_PROTOCOL 0 +#define HID_REPORT_PROTOCOL 1 + +#define HID_DEVTYPE_UNKNOWN 0 +#define HID_DEVTYPE_KBD 1 +#define HID_DEVTYPE_MOUSE 2 +#define HID_DEVTYPE_MAX 2 + +#define UBR_KBD_MODS 0 +#define UBR_KBD_RSVD 1 +#define UBR_KBD_KEYS 2 +#define UBR_KBD_NUMKEYS 6 +#define UBR_KBD_MAX 8 + +#define KBD_MOD_LCTRL 0x01 +#define KBD_MOD_LSHIFT 0x02 +#define KBD_MOD_LALT 0x04 +#define KBD_MOD_LWIN 0x08 + +#define KBD_MOD_RCTRL 0x10 +#define KBD_MOD_RSHIFT 0x20 +#define KBD_MOD_RALT 0x40 +#define KBD_MOD_RWIN 0x80 + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define usbhid_set_protocol(dev,protocol,ifc) \ + usb_simple_request(dev,0x21,0x0B,0,ifc) + + +/* ********************************************************************* + * Forward Definitions + ********************************************************************* */ + +static int usbhid_attach(usbdev_t *dev,usb_driver_t *drv); +static int usbhid_detach(usbdev_t *dev); + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct usbhid_softc_s { + int uhid_ipipe; + int uhid_ipipemps; + int uhid_devtype; + uint8_t uhid_imsg[UBR_KBD_MAX]; + uint8_t uhid_lastmsg[UBR_KBD_MAX]; + uint32_t uhid_shiftflags; +} usbhid_softc_t; + +usb_driver_t usbhid_driver = { + "Human-Interface Device", + usbhid_attach, + usbhid_detach +}; + +static char *usbhid_devtypes[3] = { + "Unknown", + "Keyboard", + "Mouse"}; + +#ifdef CFG_VGACONSOLE +extern int pcconsole_enqueue(uint8_t ch); +#endif + + +/* ********************************************************************* + * Constants for keyboard table + ********************************************************************* */ + +#define FLG_NUM 0x0001 /* Toggles: same as bits for LEDs */ +#define FLG_CAPS 0x0002 +#define FLG_SCROLL 0x0004 +#define FLG_SHIFT 0x0008 /* Shifts */ +#define FLG_CTRL 0x0100 +#define FLG_ALT 0x0200 +#define FLG_FKEY 0x0400 /* function keys */ +#define FLG_NKPD 0x0800 /* numeric keypad */ +#define FLG_ASCII 0x1000 /* regular ASCII character */ +#define FLG_NONE 0x2000 + + +/* ********************************************************************* + * Structures for keyboard table + ********************************************************************* */ + +#define KC_RESPLEN 4 +typedef struct keycode_s { + int kc_type; + char kc_normal[KC_RESPLEN]; + char kc_shifted[KC_RESPLEN]; + char kc_ctrl[KC_RESPLEN]; +} keycode_t; + + +/* ********************************************************************* + * Scan code conversion table + ********************************************************************* */ + +static keycode_t usbhid_scantable[] = { + { FLG_NONE, "", "", "" }, /* 0 */ + { FLG_NONE, "", "", "" }, /* 1 */ + { FLG_NONE, "", "", "" }, /* 2 */ + { FLG_NONE, "", "", "" }, /* 3 */ + { FLG_ASCII, "a", "A", "\001" }, /* 4 a */ + { FLG_ASCII, "b", "B", "\002" }, /* 5 b */ + { FLG_ASCII, "c", "C", "\003" }, /* 6 c */ + { FLG_ASCII, "d", "D", "\004" }, /* 7 d */ + { FLG_ASCII, "e", "E", "\005" }, /* 8 e */ + { FLG_ASCII, "f", "F", "\006" }, /* 9 f */ + { FLG_ASCII, "g", "G", "\007" }, /* 10 g */ + { FLG_ASCII, "h", "H", "\010" }, /* 11 h */ + { FLG_ASCII, "i", "I", "\011" }, /* 12 i */ + { FLG_ASCII, "j", "J", "\n" }, /* 13 j */ + { FLG_ASCII, "k", "K", "\013" }, /* 14 k */ + { FLG_ASCII, "l", "L", "\014" }, /* 15 l */ + { FLG_ASCII, "m", "M", "\r" }, /* 16 m */ + { FLG_ASCII, "n", "N", "\016" }, /* 17 n */ + { FLG_ASCII, "o", "O", "\017" }, /* 18 o */ + { FLG_ASCII, "p", "P", "\020" }, /* 19 p */ + { FLG_ASCII, "q", "Q", "\021" }, /* 20 q */ + { FLG_ASCII, "r", "R", "\022" }, /* 21 r */ + { FLG_ASCII, "s", "S", "\023" }, /* 22 s */ + { FLG_ASCII, "t", "T", "\024" }, /* 23 t */ + { FLG_ASCII, "u", "U", "\025" }, /* 24 u */ + { FLG_ASCII, "v", "V", "\026" }, /* 25 v */ + { FLG_ASCII, "w", "W", "\027" }, /* 26 w */ + { FLG_ASCII, "x", "X", "\030" }, /* 27 x */ + { FLG_ASCII, "y", "Y", "\031" }, /* 28 y */ + { FLG_ASCII, "z", "Z", "\032" }, /* 29 z */ + + { FLG_ASCII, "1", "!", "!" }, /* 30 1 */ + { FLG_ASCII, "2", "@", "\000" }, /* 31 2 */ + { FLG_ASCII, "3", "#", "#" }, /* 32 3 */ + { FLG_ASCII, "4", "$", "$" }, /* 33 4 */ + { FLG_ASCII, "5", "%", "%" }, /* 34 5 */ + { FLG_ASCII, "6", "^", "\036" }, /* 35 6 */ + { FLG_ASCII, "7", "&", "&" }, /* 36 7 */ + { FLG_ASCII, "8", "*", "\010" }, /* 37 8 */ + { FLG_ASCII, "9", "(", "(" }, /* 38 9 */ + { FLG_ASCII, "0", ")", ")" }, /* 39 0 */ + + { FLG_ASCII, "\r", "\r", "\n" }, /* 40 ENT */ + { FLG_ASCII, "\033", "\033", "\033" }, /* 41 ESC */ + { FLG_ASCII, "\177", "\177", "\010" }, /* 42 <- */ + { FLG_ASCII, "\t", "\177\t", "\t" }, /* 43 ->| */ + { FLG_ASCII, " ", " ", "\000" }, /* 44 SPC */ + + { FLG_ASCII, "-", "_", "\037" }, /* 45 - */ + { FLG_ASCII, "=", "+", "+" }, /* 46 = */ + { FLG_ASCII, "[", "{", "\033" }, /* 47 [ */ + { FLG_ASCII, "]", "}", "\035" }, /* 48 ] */ + { FLG_ASCII, "\\", "|", "\034" }, /* 49 \ */ + + { FLG_NONE, "", "", "" }, /* 50 pound */ + + { FLG_ASCII, ";", ":", ";" }, /* 51 ; */ + { FLG_ASCII, "'", "\"", "'" }, /* 52 ' */ + { FLG_ASCII, "`", "~", "`" }, /* 53 ` */ + { FLG_ASCII, ",", "<", "<" }, /* 54 , */ + { FLG_ASCII, ".", ">", ">" }, /* 55 . */ + { FLG_ASCII, "/", "?", "\037" }, /* 56 / */ + { FLG_CAPS, "", "", "" }, /* 57 CAPS */ + + { FLG_FKEY, "\033[M", "\033[Y", "\033[k" }, /* 58 f1 */ + { FLG_FKEY, "\033[N", "\033[Z", "\033[l" }, /* 59 f2 */ + { FLG_FKEY, "\033[O", "\033[a", "\033[m" }, /* 60 f3 */ + { FLG_FKEY, "\033[P", "\033[b", "\033[n" }, /* 61 f4 */ + { FLG_FKEY, "\033[Q", "\033[c", "\033[o" }, /* 62 f5 */ + { FLG_FKEY, "\033[R", "\033[d", "\033[p" }, /* 63 f6 */ + { FLG_FKEY, "\033[S", "\033[e", "\033[q" }, /* 64 f7 */ + { FLG_FKEY, "\033[T", "\033[f", "\033[r" }, /* 65 f8 */ + { FLG_FKEY, "\033[U", "\033[g", "\033[s" }, /* 66 f9 */ + { FLG_FKEY, "\033[V", "\033[h", "\033[t" }, /* 67 f10 */ + { FLG_FKEY, "\033[W", "\033[i", "\033[u" }, /* 68 f11 */ + { FLG_FKEY, "\033[X", "\033[j", "\033[v" }, /* 69 f12 */ + + { FLG_NONE, "", "", "" }, /* 70 prtsc */ + { FLG_SCROLL, "", "", "" }, /* 71 SCRLK */ + { FLG_NONE, "", "", "" }, /* 72 pause */ + { FLG_NONE, "", "", "" }, /* 73 KPins */ + { FLG_NONE, "", "", "" }, /* 74 KPhome */ + { FLG_NONE, "", "", "" }, /* 75 KPpgup */ + { FLG_NONE, "", "", "" }, /* 76 KPdel */ + { FLG_NONE, "", "", "" }, /* 77 KPend */ + { FLG_NONE, "", "", "" }, /* 78 KPpgdn */ + + { FLG_FKEY, "\033[C", "", "" }, /* 79 KPright */ + { FLG_FKEY, "\033[D", "", "" }, /* 80 KPleft */ + { FLG_FKEY, "\033[B", "", "" }, /* 81 KPdown */ + { FLG_FKEY, "\033[A", "", "" }, /* 82 KPup */ + + { FLG_NUM, "", "", "" }, /* 83 NUMLK */ + { FLG_NKPD, "/", "/", "/" }, /* 84 KP/ */ + { FLG_NKPD, "*", "*", "*" }, /* 85 KP* */ + { FLG_NKPD, "-", "-", "-" }, /* 86 KP- */ + { FLG_NKPD, "+", "+", "+" }, /* 87 KP+ */ + { FLG_NKPD, "\r", "\r", "\n" }, /* 88 KPent */ + + { FLG_NKPD, "1", "\033[F", "1" }, /* 89 KP1 */ + { FLG_NKPD, "2", "\033[B", "2" }, /* 90 KP2 */ + { FLG_NKPD, "3", "\033[G", "3" }, /* 91 KP3 */ + { FLG_NKPD, "4", "\033[D", "4" }, /* 92 KP4 */ + { FLG_NKPD, "5", "\033[E", "5" }, /* 93 KP5 */ + { FLG_NKPD, "6", "\033[C", "6" }, /* 94 KP6 */ + { FLG_NKPD, "7", "\033[H", "7" }, /* 95 KP7 */ + { FLG_NKPD, "8", "\033[A", "8" }, /* 96 KP8 */ + { FLG_NKPD, "9", "\033[I", "9" }, /* 97 KP9 */ + { FLG_NKPD, "0", "\033[L", "0" }, /* 98 KP0 */ + + { FLG_NKPD, ".", "\177", "." }, /* 99 KP. */ + + { FLG_NONE, "", "", "" }, /* 100 non\ */ + +}; + +#define usbhid_scantablesize (sizeof(usbhid_scantable)/sizeof(keycode_t)) + + +/* ********************************************************************* + * usbhid_kbd_mod1(uhid) + * + * Process modifier key changes for the current USB event, + * which was stored in uhid_imsg. Basically all this does + * is update uhid_shiftflags, converting the bits into the ones + * we use in our keyboard table. + * + * Input parameters: + * uhid - the hid softc. + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbhid_kbd_mod1(usbhid_softc_t *uhid) +{ + uint8_t changed; + uint8_t mod; + + /* + * See if anything changed. + */ + + changed = (uhid->uhid_imsg[UBR_KBD_MODS] ^ uhid->uhid_lastmsg[UBR_KBD_MODS]); + if (changed == 0) return; + + /* + * Something changed. Reflect changes in our local copy of the + * shift state. + */ + + mod = uhid->uhid_imsg[UBR_KBD_MODS]; + + uhid->uhid_shiftflags &= ~(FLG_SHIFT|FLG_ALT|FLG_CTRL); + + if (mod & (KBD_MOD_LCTRL|KBD_MOD_RCTRL)) uhid->uhid_shiftflags |= FLG_CTRL; + if (mod & (KBD_MOD_LSHIFT|KBD_MOD_RSHIFT)) uhid->uhid_shiftflags |= FLG_SHIFT; + if (mod & (KBD_MOD_LALT|KBD_MOD_RALT)) uhid->uhid_shiftflags |= FLG_ALT; +} + +/* ********************************************************************* + * usbhid_kbd_scan1(uhid,scan,breakflg) + * + * Handle a single keyboard event. Using the scan code, look up + * the key in the table and convert it to one or more characters + * for the keyboard event queue. + * + * Input parameters: + * uhid - the hid softc + * scan - scan code from keyboard report + * breakflg - true if key is being released, false if pressed + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbhid_kbd_scan1(usbhid_softc_t *uhid,uint8_t scan,int breakflg) +{ + keycode_t *code = 0; + char *str; + + /* + * Check scan code for reality. + */ + + if (scan >= usbhid_scantablesize) return; + code = &usbhid_scantable[scan]; + + /* + * If the change is a toggle, handle the toggle. These + * keys also deal with the LEDs on the keyboard. + */ + + if (code->kc_type & (FLG_CAPS|FLG_SCROLL|FLG_NUM)) { + if (!breakflg) uhid->uhid_shiftflags ^= code->kc_type; +// if (ks->ks_setleds) { +// (*(ks->ks_setleds))(ks,ks->ks_shiftflags & (FLG_CAPS|FLG_SCROLL|FLG_NUM)); +// } + } + + /* + * Regular keys - just look up in table and + * queue the characters to the upper layers. + */ + + if (code->kc_type & (FLG_ASCII | FLG_FKEY | FLG_NKPD)) { + if (uhid->uhid_shiftflags & (FLG_SHIFT|FLG_CAPS)) str = code->kc_shifted; + else if (uhid->uhid_shiftflags & FLG_CTRL) str = code->kc_ctrl; + else str = code->kc_normal; + if (!breakflg) { +#if CFG_VGACONSOLE + while (*str) { + pcconsole_enqueue(*str++); + } +#else + printf("%s",str); +#endif +#ifndef _CFE_ + fflush(stdout); +#endif + } + } + +} + + +/* ********************************************************************* + * usbhid_kbd_scan(uhid) + * + * Main processing routine for keyboard report messages. Once + * we've determined that it is a keyboard mesage, we end up + * here. The work involves seeing what new keys have arrived + * in the list (presses), and which ones are no longer there + * (releases). To do this, we us the current and previous + * report structure. + * + * Input parameters: + * uhid - the hid softc + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbhid_kbd_scan(usbhid_softc_t *uhid) +{ + int n,o; + + /* + * Modifier keys (shift, alt, control) + */ + + if (uhid->uhid_imsg[UBR_KBD_MODS] ^ uhid->uhid_lastmsg[UBR_KBD_MODS]) { + usbhid_kbd_mod1(uhid); + } + + /* + * "Make" codes (keys pressed down) + * Look for keys in 'uhid_imsg' that are not in 'uhid_lastmsg' + */ + + for (n = UBR_KBD_KEYS; n < (UBR_KBD_KEYS + UBR_KBD_NUMKEYS); n++) { + if (uhid->uhid_imsg[n] == 0) break; /* no more keys */ + for (o = UBR_KBD_KEYS; o < (UBR_KBD_KEYS + UBR_KBD_NUMKEYS); o++) { + if (uhid->uhid_imsg[n] == uhid->uhid_lastmsg[o]) break; + } + if (o == (UBR_KBD_KEYS + UBR_KBD_NUMKEYS)) { /* key not found, must be pressed */ + usbhid_kbd_scan1(uhid,uhid->uhid_imsg[n],0); + } + } + + /* + * "Break" codes (keys released) + * Look for keys in 'uhid_lastmsg' that are not in 'uhid_imsg' + */ + + + for (n = UBR_KBD_KEYS; n < (UBR_KBD_KEYS + UBR_KBD_NUMKEYS); n++) { + if (uhid->uhid_lastmsg[n] == 0) break; /* no more keys */ + for (o = UBR_KBD_KEYS; o < (UBR_KBD_KEYS + UBR_KBD_NUMKEYS); o++) { + if (uhid->uhid_lastmsg[n] == uhid->uhid_imsg[o]) break; + } + if (o == (UBR_KBD_KEYS + UBR_KBD_NUMKEYS)) { /* key not found, must be released */ + usbhid_kbd_scan1(uhid,uhid->uhid_lastmsg[n],1); + } + } +} + + +/* ********************************************************************* + * usbhid_ireq_callback(ur) + * + * This routine is called when our interrupt transfer completes + * and there is report data to be processed. + * + * Input parameters: + * ur - usb request + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbhid_ireq_callback(usbreq_t *ur) +{ + usbhid_softc_t *uhid = (ur->ur_dev->ud_private); + + /* + * If the driver is unloaded, the request will be cancelled. + */ + + if (ur->ur_status == 0xFF) { + usb_free_request(ur); + return 0; + } + + /* + * What we do now depends on the type of device. + */ + + switch (uhid->uhid_devtype) { + case HID_DEVTYPE_KBD: + /* + * Handle keyboard event + */ + usbhid_kbd_scan(uhid); + + /* + * Save old event to compare for next time. + */ + memcpy(uhid->uhid_lastmsg,uhid->uhid_imsg,8); + break; + + case HID_DEVTYPE_MOUSE: +#if 0 + /* + * No need to handle mice, but here's the good stuff. + */ + printf("Mouse: [%s %s %s] X:%d Y:%d Wheel:%d\n", + (ur->ur_buffer[0] & 1) ? "left" : "", + (ur->ur_buffer[0] & 4) ? "middle" : "", + (ur->ur_buffer[0] & 2) ? "right" : "", + (int)(signed char)ur->ur_buffer[1], + (int)(signed char)ur->ur_buffer[2], + (int)(signed char)ur->ur_buffer[3]); +#endif + break; + } + + /* + * Re-queue request to get next keyboard event. + */ + + usb_queue_request(ur); + + return 0; +} + + +/* ********************************************************************* + * usbhid_queue_intreq(dev,softc) + * + * Queue an interrupt request for this usb device. The + * driver will place this request on the queue that corresponds + * to the endpoint, and will call the callback routine when + * something happens. + * + * Input parameters: + * dev - usb device + * softc - the usb hid softc + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbhid_queue_intreq(usbdev_t *dev,usbhid_softc_t *softc) +{ + usbreq_t *ur; + + ur = usb_make_request(dev, + softc->uhid_ipipe, + softc->uhid_imsg,softc->uhid_ipipemps, + UR_FLAG_IN); + + ur->ur_callback = usbhid_ireq_callback; + + usb_queue_request(ur); +} + + +/* ********************************************************************* + * usbhid_attach(dev,drv) + * + * This routine is called when the bus scan stuff finds a HID + * device. We finish up the initialization by configuring the + * device and allocating our softc here. + * + * Input parameters: + * dev - usb device, in the "addressed" state. + * drv - the driver table entry that matched + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbhid_attach(usbdev_t *dev,usb_driver_t *drv) +{ + usb_config_descr_t *cfgdscr = dev->ud_cfgdescr; + usb_endpoint_descr_t *epdscr; + usb_interface_descr_t *ifdscr; + usbhid_softc_t *softc; + + dev->ud_drv = drv; + + softc = KMALLOC(sizeof(usbhid_softc_t),0); + memset(softc,0,sizeof(usbhid_softc_t)); + dev->ud_private = softc; + + epdscr = usb_find_cfg_descr(dev,USB_ENDPOINT_DESCRIPTOR_TYPE,0); + ifdscr = usb_find_cfg_descr(dev,USB_INTERFACE_DESCRIPTOR_TYPE,0); + + if (!epdscr || !ifdscr) { + /* + * Could not get descriptors, something is very wrong. + * Leave device addressed but not configured. + */ + return 0; + } + + /* + * Choose the standard configuration. + */ + + usb_set_configuration(dev,cfgdscr->bConfigurationValue); + + /* + * Set the protocol to the "boot" protocol, so we don't + * have to deal with fancy HID stuff. + */ + + usbhid_set_protocol(dev,HID_BOOT_PROTOCOL,ifdscr->bInterfaceNumber); + + /* + * Open the interrupt pipe. + */ + + softc->uhid_ipipe = usb_open_pipe(dev,epdscr); + softc->uhid_ipipemps = GETUSBFIELD(epdscr,wMaxPacketSize); + + /* + * Figure out the device type from the protocol. Keyboards, + * mice use this field to distinguish themselves. + */ + + softc->uhid_devtype = ifdscr->bInterfaceProtocol; + if (softc->uhid_devtype > HID_DEVTYPE_MAX) { + softc->uhid_devtype = HID_DEVTYPE_UNKNOWN; + } + + console_log("USBHID: %s Configured.\n", + usbhid_devtypes[softc->uhid_devtype]); + + /* + * Queue a transfer on the interrupt endpoint to catch + * our first characters. + */ + + usbhid_queue_intreq(dev,softc); + + return 0; +} + +/* ********************************************************************* + * usbhid_detach(dev) + * + * This routine is called when the bus scanner notices that + * this device has been removed from the system. We should + * do any cleanup that is required. The pending requests + * will be cancelled automagically. + * + * Input parameters: + * dev - usb device + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbhid_detach(usbdev_t *dev) +{ + return 0; +} + + + diff --git a/cfe/cfe/usb/usbhub.c b/cfe/cfe/usb/usbhub.c new file mode 100644 index 0000000..1e571ed --- /dev/null +++ b/cfe/cfe/usb/usbhub.c @@ -0,0 +1,912 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB Hub and device discovery code File: usbhub.c + * + * This module deals with hubs and device discovery. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _CFE_ +#include +#include +#include +#include +#include "usbhack.h" +#else +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "cfe_console.h" +#endif + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" + +/* ********************************************************************* + * Macros for common hub requests + ********************************************************************* */ + +#define usbhub_set_port_feature(dev,port,feature) \ + usb_simple_request(dev,0x23,USB_HUBREQ_SET_FEATURE,feature,port) + +#define usbhub_set_hub_feature(dev,feature) \ + usb_simple_request(dev,0x20,USB_HUBREQ_SET_FEATURE,feature,0) + +#define usbhub_clear_port_feature(dev,port,feature) \ + usb_simple_request(dev,0x23,USB_HUBREQ_CLEAR_FEATURE,feature,port) + +#define usbhub_clear_hub_feature(dev,feature) \ + usb_simple_request(dev,0x20,USB_HUBREQ_CLEAR_FEATURE,feature,0) + + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern int usb_noisy; + +/* ********************************************************************* + * Forward declarations + ********************************************************************* */ + +static int usbhub_attach(usbdev_t *dev,usb_driver_t *drv); +static int usbhub_detach(usbdev_t *dev); + +/* ********************************************************************* + * Hub-specific data structures + ********************************************************************* */ + +#define UHUB_MAX_DEVICES 8 + +#define UHUB_FLG_NEEDSCAN 1 + +typedef struct usbhub_softc_s { + usb_hub_descr_t uhub_descr; + usb_hub_status_t uhub_status; + int uhub_ipipe; + int uhub_ipipemps; + int uhub_nports; + unsigned int uhub_flags; + uint8_t uhub_imsg[8]; + usbdev_t *uhub_devices[UHUB_MAX_DEVICES]; +} usbhub_softc_t; + +usb_driver_t usbhub_driver = { + "USB Hub", + usbhub_attach, + usbhub_detach +}; + + +/* ********************************************************************* + * usbhub_ireq_callback(ur) + * + * this routine is called when the transfer we queued to the + * interrupt endpoint on the hub completes. It means that + * *some* port on the hub needs attention. The data indicates + * which port, but for our purposes we don't really care - if + * we get this callback, we'll set a flag and re-probe the bus. + * + * Input parameters: + * ur - usbreq that completed + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbhub_ireq_callback(usbreq_t *ur) +{ + int idx; + usbhub_softc_t *uhub = (ur->ur_dev->ud_private); + + /* + * Check to see if the request was cancelled by someone + * deleting our endpoint. + */ + + if (ur->ur_status == 0xFF) { + usb_free_request(ur); + return 0; + } + + /* + * Check to see if any of our ports need attention + */ + + for (idx = 1; idx <= uhub->uhub_nports; idx++) { + if (ur->ur_buffer[0] & (1<uhub_flags |= UHUB_FLG_NEEDSCAN; + ur->ur_dev->ud_bus->ub_flags |= UB_FLG_NEEDSCAN; + } + } + + + /* + * Do NOT requeue the request here. We will do this + * during exploration. + */ + + usb_free_request(ur); + + return 0; +} + + +/* ********************************************************************* + * usbhub_get_hub_descriptor(dev,dscr,idx,maxlen) + * + * Obtain the hub descriptor (special for hubs) from the + * device. + * + * Input parameters: + * dev - usb device + * dscr - place to put hub descriptor + * idx - which hub descriptor to get (usually zero) + * maxlen - max # of bytes to return + * + * Return value: + * # of bytes returned + ********************************************************************* */ + +static int usbhub_get_hub_descriptor(usbdev_t *dev,usb_hub_descr_t *dscr,int idx,int maxlen) +{ + return usb_std_request(dev,0xA0, + USB_HUBREQ_GET_DESCRIPTOR, + 0,0, + (uint8_t *) dscr, + maxlen); +} + + +/* ********************************************************************* + * usbhub_get_hub_status(dev,status) + * + * Obtain the hub status (special for hubs) from the + * device. + * + * Input parameters: + * dev - usb device + * status - where to put hub status structure + * + * Return value: + * # of bytes returned + ********************************************************************* */ + +#if 0 +static int usbhub_get_hub_status(usbdev_t *dev,usb_hub_status_t *status) +{ + return usb_std_request(dev, + 0xA0, + 0x00, + 0, + 0, + (uint8_t *) status, + sizeof(usbhub_status_t)); +} +#endif + + +/* ********************************************************************* + * usbhub_get_port_status(dev,port,status) + * + * Obtain the port status for a particular port from + * device. + * + * Input parameters: + * dev - usb device + * port - 1-based port number + * status - where to put port status structure + * + * Return value: + * # of bytes returned + ********************************************************************* */ + +static int usbhub_get_port_status(usbdev_t *dev,int port,usb_port_status_t *status) +{ + return usb_std_request(dev, + 0xA3, + 0, + 0, + port, + (uint8_t *) status, + sizeof(usb_port_status_t)); +} + + +/* ********************************************************************* + * usbhub_queue_intreq(dev,softc) + * + * Queue the transfer to the interrupt pipe that will catch + * the hub's port status changes + * + * Input parameters: + * dev - usb device + * softc - hub-specific data + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbhub_queue_intreq(usbdev_t *dev,usbhub_softc_t *softc) +{ + usbreq_t *ur; + + ur = usb_make_request(dev, + softc->uhub_ipipe, + softc->uhub_imsg,softc->uhub_ipipemps, + UR_FLAG_IN | UR_FLAG_SHORTOK); + + ur->ur_callback = usbhub_ireq_callback; + + usb_queue_request(ur); +} + + +/* ********************************************************************* + * usbhub_attach(dev,drv) + * + * This routine is called when the hub attaches to the system. + * We complete initialization for the hub and set things up so + * that an explore will happen soon. + * + * Input parameters: + * dev - usb device + * drv - driver structure + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbhub_attach(usbdev_t *dev,usb_driver_t *drv) +{ + usb_device_status_t devstatus; + usb_config_descr_t *cfgdscr; + usb_interface_descr_t *ifdscr; + usb_endpoint_descr_t *epdscr; + usbhub_softc_t *softc; + + /* + * Remember the driver dispatch. + */ + + dev->ud_drv = drv; + + softc = KMALLOC(sizeof(usbhub_softc_t),0); + memset(softc,0,sizeof(usbhub_softc_t)); + dev->ud_private = softc; + + /* + * Dig out the data from the configuration descriptor + * (we got this from the device before attach time) + */ + + cfgdscr = dev->ud_cfgdescr; + epdscr = usb_find_cfg_descr(dev,USB_ENDPOINT_DESCRIPTOR_TYPE,0); + ifdscr = usb_find_cfg_descr(dev,USB_INTERFACE_DESCRIPTOR_TYPE,0); + + /* + * Get device status (is this really necessary?) + */ + + usb_get_device_status(dev,&devstatus); + + /* + * Set us to configuration index 0 + */ + + usb_set_configuration(dev,cfgdscr->bConfigurationValue); + + /* + * Get the hub descriptor. Get the first 8 bytes first, then get the rest + * if there is more. + */ + + if (usbhub_get_hub_descriptor(dev,&(softc->uhub_descr),0,USB_HUB_DESCR_SIZE) > USB_HUB_DESCR_SIZE) { + usbhub_get_hub_descriptor(dev,&(softc->uhub_descr),0,softc->uhub_descr.bDescriptorLength); + } + + /* + * remember stuff from the hub descriptor + */ + + softc->uhub_nports = softc->uhub_descr.bNumberOfPorts; + + /* + * Open the interrupt pipe + */ + + softc->uhub_ipipe = usb_open_pipe(dev,epdscr); + softc->uhub_ipipemps = GETUSBFIELD(epdscr,wMaxPacketSize); + + /* + * Mark the bus and the hub as needing service. + */ + + softc->uhub_flags |= UHUB_FLG_NEEDSCAN; + dev->ud_bus->ub_flags |= UB_FLG_NEEDSCAN; + + /* + * Okay, that's it. The top-level USB daemon will notice + * that the bus needs service and will invoke the exploration code. + * This may in turn require additional explores until + * everything settles down. + */ + + return 0; +} + + +/* ********************************************************************* + * usbhub_detach(dev) + * + * Called when a hub is removed from the system - we remove + * all subordinate devicees. + * + * Input parameters: + * dev - device (hub) that was removed + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbhub_detach(usbdev_t *dev) +{ + usbhub_softc_t *hub; + usbdev_t *deldev; + int idx; + + if (!IS_HUB(dev)) return 0; /* should not happen */ + + hub = dev->ud_private; + for (idx = 0; idx < UHUB_MAX_DEVICES; idx++) { + deldev = hub->uhub_devices[idx]; + if (deldev) { + console_log("USB: Removing device attached to bus %d hub %d port %d", + dev->ud_bus->ub_num, + dev->ud_address,idx+1); + if (deldev->ud_drv) { + (*(deldev->ud_drv->udrv_detach))(deldev); + } + else { + if (usb_noisy > 0) { + console_log("USB: Detached device on bus %d hub %d port %d " + "has no methods", + dev->ud_bus->ub_num, + dev->ud_address,idx+1); + } + } + if (deldev->ud_cfgdescr) KFREE(deldev->ud_cfgdescr); + usb_destroy_device(deldev); + } + } + + KFREE(hub); /* remove softc */ + + return 0; +} + + + +/* ********************************************************************* + * usbhub_map_tree1(dev,level,func,arg) + * + * This routine is used in recursive device tree exploration. + * We call 'func' for each device at this tree, and descend + * when we run into hubs + * + * Input parameters: + * dev - current device pointer + * level - current nesting level + * func - function to call + * arg - argument to pass to function + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbhub_map_tree1(usbdev_t *dev,int level, + int (*func)(usbdev_t *dev,void *arg),void *arg) +{ + usbhub_softc_t *hub; + int idx; + + (*func)(dev,arg); + + if (IS_HUB(dev)) { + hub = dev->ud_private; + for (idx = 0; idx < UHUB_MAX_DEVICES; idx++) { + if (hub->uhub_devices[idx]) { + usbhub_map_tree1(hub->uhub_devices[idx],level+1,func,arg); + } + } + } +} + +/* ********************************************************************* + * usbhub_map_tree(bus,func,arg) + * + * Call a function for each device in the tree + * + * Input parameters: + * bus - bus to scan + * func - function to call + * arg - argument to pass to function + * + * Return value: + * nothing + ********************************************************************* */ + +void usbhub_map_tree(usbbus_t *bus,int (*func)(usbdev_t *dev,void *arg),void *arg) +{ + usbhub_map_tree1(bus->ub_roothub,0,func,arg); +} + + +/* ********************************************************************* + * usbhub_dumpbus1(dev,arg) + * + * map function to dump devices in the device tree + * + * Input parameters: + * dev - device we're working on + * arg - argument from map_tree call + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbhub_dumpbus1(usbdev_t *dev,void *arg) +{ + uint32_t *verbose = (uint32_t *) arg; + + if ((*verbose & 0x00FF) && (dev->ud_address != (*verbose & 0x00FF))) return 0; + + if (*verbose & 0x100) { + printf("============================================================================\n"); + } + + printf("Bus %d Device %d Class %d Vendor %04X Product %04X ", + dev->ud_bus->ub_num, + dev->ud_address, + dev->ud_devdescr.bDeviceClass, + GETUSBFIELD(&(dev->ud_devdescr),idVendor), + GETUSBFIELD(&(dev->ud_devdescr),idProduct)); + + + if (IS_HUB(dev)) { + printf("[HUB]\n"); + } + else { + printf("[DEVICE]\n"); + } + + if (*verbose & 0x100) { + usb_dbg_dumpdescriptors(dev,(uint8_t *) &(dev->ud_devdescr),dev->ud_devdescr.bLength); + usb_dbg_dumpcfgdescr(dev); + } + + return 0; +} + + +/* ********************************************************************* + * usbhub_dumpbus(bus,verbose) + * + * Dump information about devices on the USB bus. + * + * Input parameters: + * bus - bus to dump + * verbose - nonzero to display more info, like descriptors + * + * Return value: + * nothing + ********************************************************************* */ + +void usbhub_dumpbus(usbbus_t *bus,uint32_t verbose) +{ + usbhub_map_tree(bus,usbhub_dumpbus1,&verbose); +} + + + +/* ********************************************************************* + * usbhub_reset_devicee(dev,port,status) + * + * Reset a device on a hub port. This routine does a + * USB_PORT_FEATURE_RESET on the specified port, waits for the + * bit to clear, and returns. It is used to get a device into the + * DEFAULT state according to the spec. + * + * Input parameters: + * dev - hub device + * port - port number(1-based) + * status - place to return port_status structure after + * reset completes + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbhub_reset_device(usbdev_t *dev,int port,usb_port_status_t *portstatus) +{ + console_log("USB: Resetting device on bus %d port %d",dev->ud_bus->ub_num,port); +#ifndef _CFE_ + fflush(stdout); +#endif + + usbhub_set_port_feature(dev,port,USB_PORT_FEATURE_RESET); + + usbhub_get_port_status(dev,port,portstatus); + + for (;;) { + usbhub_get_port_status(dev,port,portstatus); + if ((GETUSBFIELD((portstatus),wPortStatus) & USB_PORT_STATUS_RESET) == 0) break; + usb_delay_ms(dev->ud_bus,250); + } + usb_delay_ms(dev->ud_bus,250); + + usbhub_clear_port_feature(dev,port,USB_PORT_FEATURE_C_PORT_RESET); +} + + + +/* ********************************************************************* + * usbhub_scan_ports(dev,arg) + * + * Scan the ports on this hub for new or removed devices. + * + * Input parameters: + * dev - hub device + * arg - passed from bus scan main routines + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbhub_scan_ports(usbdev_t *dev,void *arg) +{ + uint16_t current; + uint16_t changed; + usbhub_softc_t *softc; + int idx; + int res; + int len; + uint8_t *buf; + usbdev_t *newdev; + usb_driver_t *newdrv; + int addr; + usb_port_status_t portstatus; + usb_config_descr_t cfgdescr; + unsigned int powerondelay; + + if (!IS_HUB(dev)) return; /* should not happen. */ + + /* + * We know this is a hub. Get the softc back. + */ + + softc = (usbhub_softc_t *) dev->ud_private; + + powerondelay = ((unsigned int) softc->uhub_descr.bPowerOnToPowerGood)*2 + 20; + + /* + * Turn on the power to the ports whose power is not yet on. + */ + + for (idx = 0; idx < softc->uhub_nports; idx++) { + + usbhub_get_port_status(dev,idx+1,&portstatus); + + current = GETUSBFIELD((&portstatus),wPortStatus); + changed = GETUSBFIELD((&portstatus),wPortChange); + if (usb_noisy > 1) { + printf("BeforePowerup: port %d status %04X changed %04X\n",idx+1,current,changed); + } + + if (!(current & USB_PORT_STATUS_POWER)) { + if (usb_noisy > 1) console_log("USB: Powering up bus %d port %d", + dev->ud_bus->ub_num,idx+1); + usbhub_set_port_feature(dev,idx+1,USB_PORT_FEATURE_POWER); + usb_delay_ms(dev->ud_bus,powerondelay); + } + } + + /* + * Begin exploration at this level. + */ + + for (idx = 0; idx < softc->uhub_nports; idx++) { + + usbhub_get_port_status(dev,idx+1,&portstatus); + + current = GETUSBFIELD((&portstatus),wPortStatus); + changed = GETUSBFIELD((&portstatus),wPortChange); + + if (usb_noisy > 0) { + printf("USB: Explore: Bus %d Hub %d port %d status %04X changed %04X\n", + dev->ud_bus->ub_num, + dev->ud_address,idx+1,current,changed); + usb_dbg_dumpportstatus(idx+1,&portstatus,1); + } + + +// if (changed & USB_PORT_STATUS_RESET) { +// usbhub_clear_port_feature(dev,idx+1,USB_PORT_FEATURE_C_PORT_RESET); +// } + + if (changed & USB_PORT_STATUS_ENABLED) { + usbhub_clear_port_feature(dev,idx+1,USB_PORT_FEATURE_C_PORT_ENABLE); + } + + if (changed & USB_PORT_STATUS_CONNECT) { + /* + * A device was either connected or disconnected. + * Clear the status change first. + */ + + usbhub_clear_port_feature(dev,idx+1,USB_PORT_FEATURE_C_PORT_CONNECTION); + + if (current & USB_PORT_STATUS_CONNECT) { + + /* + * The device has been CONNECTED. + */ + + console_log("USB: New device connected to bus %d hub %d port %d", + dev->ud_bus->ub_num, + dev->ud_address,idx+1); + + /* + * Reset the device. Reuse our old port status structure + * so we get the latest status. Some devices do not report + * lowspeed until they are reset. + */ + + usbhub_reset_device(dev,idx+1,&portstatus); + current = GETUSBFIELD((&portstatus),wPortStatus); + changed = GETUSBFIELD((&portstatus),wPortChange); + + /* + * Create a device for this port. + */ + + newdev = usb_create_device(dev->ud_bus,(current & USB_PORT_STATUS_LOWSPD) ? 1 : 0); + + /* + * Get the device descriptor. + */ + + res = usb_get_device_descriptor(newdev,&(newdev->ud_devdescr),TRUE); + + if (usb_noisy > 0) usb_dbg_dumpdescriptors(newdev,(uint8_t *) &(newdev->ud_devdescr),8); + + /* + * Set up the max packet size for the control endpoint, + * then get the rest of the descriptor. + */ + + usb_set_ep0mps(newdev,newdev->ud_devdescr.bMaxPacketSize0); + res = usb_get_device_descriptor(newdev,&(newdev->ud_devdescr),FALSE); + + /* + * Obtain a new address and set the address of the + * root hub to this address. + */ + + addr = usb_new_address(newdev->ud_bus); + res = usb_set_address(newdev,addr); + + /* + * Get the configuration descriptor and all the + * associated interface and endpoint descriptors. + */ + + res = usb_get_config_descriptor(newdev,&cfgdescr,0, + sizeof(usb_config_descr_t)); + if (res != sizeof(usb_config_descr_t)) { + printf("[a]usb_get_config_descriptor returns %d\n",res); + } + + len = GETUSBFIELD(&cfgdescr,wTotalLength); + buf = KMALLOC(len,0); + + res = usb_get_config_descriptor(newdev,(usb_config_descr_t *)buf,0,len); + if (res != len) { + printf("[b]usb_get_config_descriptor returns %d\n",res); + } + + newdev->ud_cfgdescr = (usb_config_descr_t *) buf; + + if (usb_noisy > 0) usb_dbg_dumpdescriptors(newdev,buf,len); + + /* + * Point the hub at the devices it owns + */ + + softc->uhub_devices[idx] = newdev; + + /* + * Find the driver for this. It had better be the hub + * driver. + */ + + newdrv = usb_find_driver(newdev); + + /* + * Call the attach method. + */ + + if (newdrv) { + dev->ud_drv = newdrv; /* remember driver dispatch in device */ + (*(newdrv->udrv_attach))(newdev,newdrv); + } + } + + else { + + /* + * The device has been DISCONNECTED. + */ + + console_log("USB: Device disconnected from bus %d hub %d port %d", + dev->ud_bus->ub_num, + dev->ud_address,idx+1); + + /* + * Recover pointer to device below hub and clear + * this pointer. + */ + + newdev = softc->uhub_devices[idx]; /* Get device pointer */ + softc->uhub_devices[idx] = NULL; /* remove device from hub */ + + /* + * Deassign the USB device's address and then + * call detach method to free resources. Devices that + * do not have drivers will not have any methods. + */ + + if (newdev) { + if (newdev->ud_drv) { + (*(newdev->ud_drv->udrv_detach))(newdev); + } + else { + if (usb_noisy > 0) { + console_log("USB: Detached device on bus %d hub %d port %d " + "has no methods", + dev->ud_bus->ub_num, + dev->ud_address,idx+1); + } + } + + if (newdev->ud_cfgdescr) KFREE(newdev->ud_cfgdescr); + + usb_destroy_device(newdev); + } + + } + } + + } + + + /* + * Queue up a request for the interrupt pipe. This will catch further + * changes at this port. + */ + + usbhub_queue_intreq(dev,softc); + +} + +/* ********************************************************************* + * usbhub_scan1(dev,arg) + * + * Scan one device at this level, or descend if we run into a hub + * This is part of the device discovery code. + * + * Input parameters: + * dev - current device, maybe a hub + * arg - passed from main scan routine + * + * Return value: + * 0 + ********************************************************************* */ + + +static int usbhub_scan1(usbdev_t *dev,void *arg) +{ + usbhub_softc_t *hub; + + /* + * If the device is not a hub, we've reached the leaves of the + * tree. + */ + + if (!IS_HUB(dev)) return 0; + + /* + * Otherwise, scan the ports on this hub. + */ + + hub = dev->ud_private; + + if (hub->uhub_flags & UHUB_FLG_NEEDSCAN) { + hub->uhub_flags &= ~UHUB_FLG_NEEDSCAN; + usbhub_scan_ports(dev,arg); + } + + return 0; +} + +/* ********************************************************************* + * usb_scan(bus) + * + * Scan the bus looking for new or removed devices + * + * Input parameters: + * bus - bus to scan + * + * Return value: + * nothing + ********************************************************************* */ + +void usb_scan(usbbus_t *bus) +{ + /* + * Call our tree walker with the scan function. + */ + + usbhub_map_tree(bus,usbhub_scan1,NULL); +} + + + + diff --git a/cfe/cfe/usb/usbmain.c b/cfe/cfe/usb/usbmain.c new file mode 100644 index 0000000..c39a7f6 --- /dev/null +++ b/cfe/cfe/usb/usbmain.c @@ -0,0 +1,367 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Main Module File: usbmain.c + * + * Main module that invokes the top of the USB stack from CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "lib_queue.h" +#include "lib_physio.h" + +#include "cfe_timer.h" +#include "ui_command.h" + +#if CFG_PCI +#include "pcireg.h" +#include "pcivar.h" +#endif + +#include "usbchap9.h" +#include "usbd.h" + +#include "bsp_config.h" + + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern usb_hcdrv_t ohci_driver; /* OHCI Driver dispatch */ + +extern int ohcidebug; /* OHCI debug control */ +extern int usb_noisy; /* USBD debug control */ + +int usb_init(void); /* forward */ +int ui_init_usbcmds(void); /* forward */ + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +/* + * We keep track of the pointers to USB buses in globals. + * One entry in this array per USB bus (the Opti controller + * on the SWARM has two functions, so it's two buses) + */ + +#define USB_MAX_BUS 4 +int usb_buscnt = 0; +usbbus_t *usb_buses[USB_MAX_BUS]; + + +/* ********************************************************************* + * usb_cfe_timer(arg) + * + * This routine is called periodically by CFE's timer routines + * to give the USB subsystem some time. Basically we scan + * for work to do to manage configuration updates, and handle + * interrupts from the USB controllers. + * + * Input parameters: + * arg - value we passed when the timer was initialized + * (not used) + * + * Return value: + * nothing + ********************************************************************* */ + +static void usb_cfe_timer(void *arg) +{ + int idx; + static int in_poll = 0; + + /* + * We sometimes call the timer routines in here, which calls + * the polling loop. This code is not reentrant, so + * prevent us from running the interrupt routine or + * bus daemon while we are already in there. + */ + + if (in_poll) return; + + /* + * Do not allow nested "interrupts." + */ + + in_poll = 1; + + for (idx = 0; idx < usb_buscnt; idx++) { + if (usb_buses[idx]) { + usb_poll(usb_buses[idx]); + usb_daemon(usb_buses[idx]); + } + } + + /* + * Okay to call polling again. + */ + + in_poll = 0; +} + + +/* ********************************************************************* + * usb_init_one_ohci(addr) + * + * Initialize one USB controller. + * + * Input parameters: + * addr - physical address of OHCI registers + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ +static int usb_init_one_ohci(uint32_t addr) +{ + usbbus_t *bus; + int res; + + bus = UBCREATE(&ohci_driver, addr); + + if (bus == NULL) { + printf("USB: Could not create OHCI driver structure for controller at 0x%08X\n",addr); + return -1; + } + + bus->ub_num = usb_buscnt; + + res = UBSTART(bus); + + if (res != 0) { + printf("USB: Could not init OHCI controller at 0x%08X\n",addr); + UBSTOP(bus); + return -1; + } + else { + usb_buses[usb_buscnt++] = bus; + usb_initroot(bus); + } + + return 0; +} + +#if CFG_PCI +/* ********************************************************************* + * usb_init_pci_ohci() + * + * Initialize all PCI-based OHCI controllers + * + * Input parameters: + * nothing + * + * Return value: + * 0 if ok + * else error + ********************************************************************* */ +static int usb_init_pci_ohci(void) +{ + int res; + pcitag_t tag; + uint32_t pciclass; + physaddr_t bar; + int idx; + + idx = 0; + + while (pci_find_class(PCI_CLASS_SERIALBUS,idx,&tag) == 0) { + pciclass = pci_conf_read(tag,PCI_CLASS_REG); + if ((PCI_SUBCLASS(pciclass) == PCI_SUBCLASS_SERIALBUS_USB) && + (PCI_INTERFACE(pciclass) == 0x10)) { + bar = (physaddr_t) pci_conf_read(tag,PCI_MAPREG_START); + pci_tagprintf(tag,"OHCI USB controller found at %08X\n",(uint32_t) bar); + + /* On the BCM1250, this sets the address to "match bits" mode, + which eliminates the need for byte swaps of data to/from the registers. */ + bar |= 0x20000000; + + res = usb_init_one_ohci(bar); + if (res < 0) break; + } + idx++; + } + + return 0; +} +#endif + + + +/* ********************************************************************* + * usb_init() + * + * Initialize the USB subsystem + * + * Input parameters: + * nothing + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +int usb_init(void) +{ + static int initdone = 0; + + if (initdone) { + printf("USB has already been initialized.\n"); + return -1; + } + + printf("Initializing USB.\n"); + + initdone = 1; + + usb_buscnt = 0; + +#if CFG_PCI + usb_init_pci_ohci(); +#endif + +#if CFG_USB_OHCI_BASE + usb_init_one_ohci(CFG_USB_OHCI_BASE); +#endif + + cfe_bg_add(usb_cfe_timer,NULL); + + return 0; +} + + + +static int ui_cmd_usb_start(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int res = 0; + + if (cmd_sw_isset(cmd,"-o")) ohcidebug++; + if (cmd_sw_isset(cmd,"-oo")) ohcidebug+=2; + if (cmd_sw_isset(cmd,"-u")) usb_noisy++; + if (cmd_sw_isset(cmd,"-uu")) usb_noisy+=2; + + if (usb_buscnt == 0) { + res = usb_init(); + } + + return res; +} + + +static int ui_cmd_usb_show(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int busnum; + int devnum; + char *x; + int idx; + uint32_t arg; + + x = cmd_getarg(cmd,1); + if (!x) devnum = 0; + else devnum = atoi(x); + + x = cmd_getarg(cmd,0); + if (!x) x = "*"; + busnum = atoi(x); + + if (busnum >= usb_buscnt) { + printf("Invalid bus number, %d USB Buses currently configured.\n",usb_buscnt); + return -1; + } + + arg = cmd_sw_isset(cmd,"-v") ? 0x100 : 0; + arg |= (devnum & 0xFF); + + if (x[0] == '*') { + for (idx = 0; idx < usb_buscnt; idx++) { + usbhub_dumpbus(usb_buses[idx],arg); + } + } + else { + usbhub_dumpbus(usb_buses[busnum],arg); + } + + return 0; + +} + +/* ********************************************************************* + * ui_init_usbcmds(void) + * + * Initialize the USB commands + * + * Input parameters: + * nothing + * + * Return value: + * 0 + ********************************************************************* */ + +int ui_init_usbcmds(void) +{ + cmd_addcmd("usb init", + ui_cmd_usb_start, + NULL, + "Initialize the USB controller.", + "usb init", + "-o;OHCI debug messages|" + "-oo;more OHCI debug messages|" + "-u;USBD debug messages|" + "-uu;more USBD debug messages"); + + + cmd_addcmd("show usb", + ui_cmd_usb_show, + NULL, + "Display devices connected to USB bus.", + "usb show [bus [device]]\n\n" + "Displays the configuration descriptors for devices connected to the USB\n" + "If you specify a bus, the entire bus is displayed. If you specify the\n" + "device number as well, only the specified device is displayed\n", + "-v;Display descriptors from the devices"); + + return 0; +} diff --git a/cfe/cfe/usb/usbmass.c b/cfe/cfe/usb/usbmass.c new file mode 100644 index 0000000..ae3856d --- /dev/null +++ b/cfe/cfe/usb/usbmass.c @@ -0,0 +1,1199 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB Mass-Storage driver File: usbmass.c + * + * This driver deals with mass-storage devices that support + * the SCSI Transparent command set and USB Bulk-Only protocol + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _CFE_ +#include +#include +#include +#include +#include "usbhack.h" +#else +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "cfe_timer.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_error.h" +#include "cfe_console.h" +#endif + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" + +/* ********************************************************************* + * USB Mass-Storage class Constants + ********************************************************************* */ + +#define USBMASS_CBI_PROTOCOL 0 +#define USBMASS_CBI_NOCOMPLETE_PROTOCOL 1 +#define USBMASS_BULKONLY_PROTOCOL 0x50 + +#define USBMASS_SUBCLASS_RBC 0x01 +#define USBMASS_SUBCLASS_SFF8020 0x02 +#define USBMASS_SUBCLASS_QIC157 0x03 +#define USBMASS_SUBCLASS_UFI 0x04 +#define USBMASS_SUBCLASS_SFF8070 0x05 +#define USBMASS_SUBCLASS_SCSI 0x06 + +#define USBMASS_CSW_PASS 0x00 +#define USBMASS_CSW_FAILED 0x01 +#define USBMASS_CSW_PHASEERR 0x02 + +#define USBMASS_CBW_SIGNATURE 0x43425355 +#define USBMASS_CSW_SIGNATURE 0x53425355 + +/* ********************************************************************* + * USB Mass-Storage class Structures + ********************************************************************* */ + +typedef struct usbmass_cbw_s { + uint8_t dCBWSignature0,dCBWSignature1,dCBWSignature2,dCBWSignature3; + uint8_t dCBWTag0,dCBWTag1,dCBWTag2,dCBWTag3; + uint8_t dCBWDataTransferLength0,dCBWDataTransferLength1, + dCBWDataTransferLength2,dCBWDataTransferLength3; + uint8_t bmCBWFlags; + uint8_t bCBWLUN; + uint8_t bCBWCBLength; + uint8_t CBWCB[16]; +} usbmass_cbw_t; + +typedef struct usbmass_csw_s { + uint8_t dCSWSignature0,dCSWSignature1,dCSWSignature2,dCSWSignature3; + uint8_t dCSWTag0,dCSWTag1,dCSWTag2,dCSWTag3; + uint8_t dCSWDataResidue0,dCSWDataResidue1,dCSWDataResidue2,dCSWDataResidue3; + uint8_t bCSWStatus; +} usbmass_csw_t; + +#define GETCBWFIELD(s,f) ((uint32_t)((s)->f##0) | ((uint32_t)((s)->f##1) << 8) | \ + ((uint32_t)((s)->f##2) << 16) | ((uint32_t)((s)->f##3) << 24)) +#define PUTCBWFIELD(s,f,v) (s)->f##0 = (v & 0xFF); \ + (s)->f##1 = ((v)>>8 & 0xFF); \ + (s)->f##2 = ((v)>>16 & 0xFF); \ + (s)->f##3 = ((v)>>24 & 0xFF); + + +int usbmass_request_sense(usbdev_t *dev); + +/* ********************************************************************* + * Linkage to CFE + ********************************************************************* */ + +#ifdef _CFE_ + +/* + * Softc for the CFE side of the disk driver. + */ +#define MAX_SECTORSIZE 2048 +typedef struct usbdisk_s { + uint32_t usbdisk_sectorsize; + uint32_t usbdisk_ttlsect; + uint32_t usbdisk_devtype; + int usbdisk_unit; +} usbdisk_t; + +/* + * This table points at the currently configured USB disk + * devices. This lets us leave the CFE half of the driver lying + * around while the USB devices come and go. We use the unit number + * from the original CFE attach to index this table, and devices + * that are not present are "not ready." + */ + +#define USBDISK_MAXUNITS 4 +static usbdev_t *usbdisk_units[USBDISK_MAXUNITS]; + +/* + * CFE device driver routine forwards + */ + +static void usbdisk_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +static int usbdisk_open(cfe_devctx_t *ctx); +static int usbdisk_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int usbdisk_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int usbdisk_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int usbdisk_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int usbdisk_close(cfe_devctx_t *ctx); + +/* + * CFE device driver descriptor + */ + +const static cfe_devdisp_t usbdisk_dispatch = { + usbdisk_open, + usbdisk_read, + usbdisk_inpstat, + usbdisk_write, + usbdisk_ioctl, + usbdisk_close, + NULL, + NULL +}; + +const cfe_driver_t usb_disk = { + "USB Disk", + "usbdisk", + CFE_DEV_DISK, + &usbdisk_dispatch, + usbdisk_probe +}; + + +#endif + + + +/* ********************************************************************* + * Forward Definitions + ********************************************************************* */ + +static int usbmass_attach(usbdev_t *dev,usb_driver_t *drv); +static int usbmass_detach(usbdev_t *dev); + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct usbmass_softc_s { + int umass_inpipe; + int umass_outpipe; + int umass_devtype; + uint32_t umass_curtag; + int umass_unit; +} usbmass_softc_t; + +usb_driver_t usbmass_driver = { + "Mass-Storage Device", + usbmass_attach, + usbmass_detach +}; + +usbdev_t *usbmass_dev = NULL; /* XX hack for testing only */ + +/* ********************************************************************* + * usbmass_mass_storage_reset(dev,ifc) + * + * Do a bulk-only mass-storage reset. + * + * Input parameters: + * dev - device to reset + * ifc - interface number to reset (bInterfaceNum) + * + * Return value: + * status + ********************************************************************* */ + +#define usbmass_mass_storage_reset(dev,ifc) \ + usb_simple_request(dev,0x21,0xFF,ifc,0) + +#if 0 +/* ********************************************************************* + * usbmass_get_max_lun(dev,lunp) + * + * Get maximum LUN from device + * + * Input parameters: + * dev - device to reset + * lunp - pointer to int to receive max lun + * + * Return value: + * status + ********************************************************************* */ + +static int usbmass_get_max_lun(usbdev_t *dev,int *lunp) +{ + uint8_t buf = 0; + int res; + + res = usb_std_request(dev,0xA1,0xFE,0,0,&buf,1); + + if (res < 0) return res; + + if (lunp) *lunp = (int) buf; + return 0; +} + +#endif + + +/* ********************************************************************* + * usbmass_stall_recovery(dev) + * + * Do whatever it takes to unstick a stalled mass-storage device. + * + * Input parameters: + * dev - usb device + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbmass_stall_recovery(usbdev_t *dev) +{ + usbmass_softc_t *softc; + + softc = (usbmass_softc_t *) dev->ud_private; + + usb_clear_stall(dev,softc->umass_inpipe); + + usbmass_request_sense(dev); +} + + +/* ********************************************************************* + * usbmass_read_capacity(dev,sectornum,buffer) + * + * Reads a sector from the device. + * + * Input parameters: + * dev - usb device + * sectornum - sector number to read + * buffer - place to put sector we read + * + * Return value: + * status + ********************************************************************* */ + +int usbmass_request_sense(usbdev_t *dev) +{ + uint8_t *cbwcsw; + uint8_t *sector; + usbmass_cbw_t *cbw; + usbmass_csw_t *csw; + usbreq_t *ur; + usbmass_softc_t *softc; + int res; + + softc = (usbmass_softc_t *) dev->ud_private; + + cbwcsw = KMALLOC(64,32); + sector = KMALLOC(64,32); + + memset(sector,0,64); + + cbw = (usbmass_cbw_t *) cbwcsw; + csw = (usbmass_csw_t *) cbwcsw; + + /* + * Fill in the fields of the CBW + */ + + PUTCBWFIELD(cbw,dCBWSignature,USBMASS_CBW_SIGNATURE); + PUTCBWFIELD(cbw,dCBWTag,softc->umass_curtag); + PUTCBWFIELD(cbw,dCBWDataTransferLength,18); + cbw->bmCBWFlags = 0x80; /* IN */ + cbw->bCBWLUN = 0; + cbw->bCBWCBLength = 12; + cbw->CBWCB[0] = 0x3; /* REQUEST SENSE */ + cbw->CBWCB[1] = 0; + cbw->CBWCB[2] = 0; + cbw->CBWCB[3] = 0; + cbw->CBWCB[4] = 18; /* allocation length */ + cbw->CBWCB[5] = 0; + cbw->CBWCB[6] = 0; + cbw->CBWCB[7] = 0; + cbw->CBWCB[8] = 0; + cbw->CBWCB[9] = 0; + + softc->umass_curtag++; + + /* + * Send the CBW + */ + + ur = usb_make_request(dev,softc->umass_outpipe,(uint8_t *) cbw, + sizeof(usbmass_cbw_t),UR_FLAG_OUT); + res = usb_sync_request(ur); + usb_free_request(ur); + + /* + * Get the data + */ + + memset(sector,0,18); + ur = usb_make_request(dev,softc->umass_inpipe,sector, + 18,UR_FLAG_IN | UR_FLAG_SHORTOK); + res = usb_sync_request(ur); + usb_free_request(ur); + + /* + * Get the Status + */ + + memset(csw,0,sizeof(usbmass_csw_t)); + ur = usb_make_request(dev,softc->umass_inpipe,(uint8_t *) csw, + sizeof(usbmass_csw_t),UR_FLAG_IN); + res = usb_sync_request(ur); + usb_free_request(ur); + + KFREE(cbwcsw); + + KFREE(sector); + + return 0; + +} + +/* ********************************************************************* + * usbmass_read_sector(dev,sectornum,seccnt,buffer) + * + * Reads a sector from the device. + * + * Input parameters: + * dev - usb device + * sectornum - sector number to read + * seccnt - count of sectors to read + * buffer - place to put sector we read + * + * Return value: + * status + ********************************************************************* */ + +int usbmass_read_sector(usbdev_t *dev,uint32_t sectornum,uint32_t seccnt, + uint8_t *buffer); +int usbmass_read_sector(usbdev_t *dev,uint32_t sectornum,uint32_t seccnt, + uint8_t *buffer) +{ + uint8_t *cbwcsw; + uint8_t *sector; + usbmass_cbw_t *cbw; + usbmass_csw_t *csw; + usbreq_t *ur; + usbmass_softc_t *softc; + int res; + + softc = (usbmass_softc_t *) dev->ud_private; + + cbwcsw = KMALLOC(64,32); + sector = buffer; + + cbw = (usbmass_cbw_t *) cbwcsw; + csw = (usbmass_csw_t *) cbwcsw; + + /* + * Fill in the fields of the CBW + */ + + PUTCBWFIELD(cbw,dCBWSignature,USBMASS_CBW_SIGNATURE); + PUTCBWFIELD(cbw,dCBWTag,softc->umass_curtag); + PUTCBWFIELD(cbw,dCBWDataTransferLength,(512*seccnt)); + cbw->bmCBWFlags = 0x80; /* IN */ + cbw->bCBWLUN = 0; + cbw->bCBWCBLength = 10; + cbw->CBWCB[0] = 0x28; /* READ */ + cbw->CBWCB[1] = 0; + cbw->CBWCB[2] = (sectornum >> 24) & 0xFF; /* LUN 0 & MSB's of sector */ + cbw->CBWCB[3] = (sectornum >> 16) & 0xFF; + cbw->CBWCB[4] = (sectornum >> 8) & 0xFF; + cbw->CBWCB[5] = (sectornum >> 0) & 0xFF; + cbw->CBWCB[6] = 0; + cbw->CBWCB[7] = 0; + cbw->CBWCB[8] = seccnt; + cbw->CBWCB[9] = 0; + + softc->umass_curtag++; + + /* + * Send the CBW + */ + + ur = usb_make_request(dev,softc->umass_outpipe,(uint8_t *) cbw, + sizeof(usbmass_cbw_t),UR_FLAG_OUT); + res = usb_sync_request(ur); + usb_free_request(ur); + if (res == 4) { + usbmass_stall_recovery(dev); + KFREE(cbwcsw); + return -1; + } + + + /* + * Get the data + */ + + ur = usb_make_request(dev,softc->umass_inpipe,sector, + 512*seccnt,UR_FLAG_IN | UR_FLAG_SHORTOK); + res = usb_sync_request(ur); + usb_free_request(ur); + if (res == 4) { + usbmass_stall_recovery(dev); + KFREE(cbwcsw); + return -1; + } + + + /* + * Get the Status + */ + + memset(csw,0,sizeof(usbmass_csw_t)); + ur = usb_make_request(dev,softc->umass_inpipe,(uint8_t *) csw, + sizeof(usbmass_csw_t),UR_FLAG_IN); + res = usb_sync_request(ur); + usb_free_request(ur); + if (res == 4) { + usbmass_stall_recovery(dev); + KFREE(cbwcsw); + return -1; + } + + +#if 0 + printf("CSW: Signature=%08X Tag=%08X Residue=%08X Status=%02X\n", + GETCBWFIELD(csw,dCSWSignature), + GETCBWFIELD(csw,dCSWTag), + GETCBWFIELD(csw,dCSWDataResidue), + csw->bCSWStatus); +#endif + + res = (csw->bCSWStatus == USBMASS_CSW_PASS) ? 0 : -1; + + KFREE(cbwcsw); + + return res; + +} + +/* ********************************************************************* + * usbmass_write_sector(dev,sectornum,seccnt,buffer) + * + * Writes a sector to the device + * + * Input parameters: + * dev - usb device + * sectornum - sector number to write + * seccnt - count of sectors to write + * buffer - place to get sector to write + * + * Return value: + * status + ********************************************************************* */ + +static int usbmass_write_sector(usbdev_t *dev,uint32_t sectornum,uint32_t seccnt, + uint8_t *buffer) +{ + uint8_t *cbwcsw; + uint8_t *sector; + usbmass_cbw_t *cbw; + usbmass_csw_t *csw; + usbreq_t *ur; + usbmass_softc_t *softc; + int res; + + softc = (usbmass_softc_t *) dev->ud_private; + + cbwcsw = KMALLOC(64,32); + sector = buffer; + + cbw = (usbmass_cbw_t *) cbwcsw; + csw = (usbmass_csw_t *) cbwcsw; + + /* + * Fill in the fields of the CBW + */ + + PUTCBWFIELD(cbw,dCBWSignature,USBMASS_CBW_SIGNATURE); + PUTCBWFIELD(cbw,dCBWTag,softc->umass_curtag); + PUTCBWFIELD(cbw,dCBWDataTransferLength,(512*seccnt)); + cbw->bmCBWFlags = 0x00; /* OUT */ + cbw->bCBWLUN = 0; + cbw->bCBWCBLength = 10; + cbw->CBWCB[0] = 0x2A; /* WRITE */ + cbw->CBWCB[1] = 0; + cbw->CBWCB[2] = (sectornum >> 24) & 0xFF; /* LUN 0 & MSB's of sector */ + cbw->CBWCB[3] = (sectornum >> 16) & 0xFF; + cbw->CBWCB[4] = (sectornum >> 8) & 0xFF; + cbw->CBWCB[5] = (sectornum >> 0) & 0xFF; + cbw->CBWCB[6] = 0; + cbw->CBWCB[7] = 0; + cbw->CBWCB[8] = seccnt; + cbw->CBWCB[9] = 0; + + softc->umass_curtag++; + + /* + * Send the CBW + */ + + ur = usb_make_request(dev,softc->umass_outpipe,(uint8_t *) cbw, + sizeof(usbmass_cbw_t),UR_FLAG_OUT); + res = usb_sync_request(ur); + usb_free_request(ur); + + /* + * Send the data + */ + + ur = usb_make_request(dev,softc->umass_outpipe,sector, + 512*seccnt,UR_FLAG_OUT); + res = usb_sync_request(ur); + usb_free_request(ur); + + /* + * Get the Status + */ + + memset(csw,0,sizeof(usbmass_csw_t)); + ur = usb_make_request(dev,softc->umass_inpipe,(uint8_t *) csw, + sizeof(usbmass_csw_t),UR_FLAG_IN); + res = usb_sync_request(ur); + usb_free_request(ur); + +#if 0 + printf("CSW: Signature=%08X Tag=%08X Residue=%08X Status=%02X\n", + GETCBWFIELD(csw,dCSWSignature), + GETCBWFIELD(csw,dCSWTag), + GETCBWFIELD(csw,dCSWDataResidue), + csw->bCSWStatus); +#endif + + res = (csw->bCSWStatus == USBMASS_CSW_PASS) ? 0 : -1; + + KFREE(cbwcsw); + + return res; +} + +/* ********************************************************************* + * usbmass_read_capacity(dev,sectornum,buffer) + * + * Reads a sector from the device. + * + * Input parameters: + * dev - usb device + * sectornum - sector number to read + * buffer - place to put sector we read + * + * Return value: + * status + ********************************************************************* */ + +int usbmass_read_capacity(usbdev_t *dev,uint32_t *size); +int usbmass_read_capacity(usbdev_t *dev,uint32_t *size) +{ + uint8_t *cbwcsw; + uint8_t *sector; + usbmass_cbw_t *cbw; + usbmass_csw_t *csw; + usbreq_t *ur; + usbmass_softc_t *softc; + int res; + + softc = (usbmass_softc_t *) dev->ud_private; + + cbwcsw = KMALLOC(64,32); + sector = KMALLOC(64,32); + + memset(sector,0,64); + + cbw = (usbmass_cbw_t *) cbwcsw; + csw = (usbmass_csw_t *) cbwcsw; + + *size = 0; + + /* + * Fill in the fields of the CBW + */ + + PUTCBWFIELD(cbw,dCBWSignature,USBMASS_CBW_SIGNATURE); + PUTCBWFIELD(cbw,dCBWTag,softc->umass_curtag); + PUTCBWFIELD(cbw,dCBWDataTransferLength,8); + cbw->bmCBWFlags = 0x80; /* IN */ + cbw->bCBWLUN = 0; + cbw->bCBWCBLength = 10; + cbw->CBWCB[0] = 0x25; /* READ CAPACITY */ + cbw->CBWCB[1] = 0; + cbw->CBWCB[2] = 0; + cbw->CBWCB[3] = 0; + cbw->CBWCB[4] = 0; + cbw->CBWCB[5] = 0; + cbw->CBWCB[6] = 0; + cbw->CBWCB[7] = 0; + cbw->CBWCB[8] = 0; + cbw->CBWCB[9] = 0; + + softc->umass_curtag++; + + /* + * Send the CBW + */ + + ur = usb_make_request(dev,softc->umass_outpipe,(uint8_t *) cbw, + sizeof(usbmass_cbw_t),UR_FLAG_OUT); + res = usb_sync_request(ur); + usb_free_request(ur); + + if (res == 4) { + usbmass_stall_recovery(dev); + KFREE(cbwcsw); + KFREE(sector); + return -1; + } + + /* + * Get the data + */ + + ur = usb_make_request(dev,softc->umass_inpipe,sector, + 8,UR_FLAG_IN | UR_FLAG_SHORTOK); + res = usb_sync_request(ur); + usb_free_request(ur); + + if (res == 4) { + usbmass_stall_recovery(dev); + KFREE(cbwcsw); + KFREE(sector); + return -1; + } + + /* + * Get the Status + */ + + memset(csw,0,sizeof(usbmass_csw_t)); + ur = usb_make_request(dev,softc->umass_inpipe,(uint8_t *) csw, + sizeof(usbmass_csw_t),UR_FLAG_IN); + res = usb_sync_request(ur); + usb_free_request(ur); + + KFREE(cbwcsw); + + *size = (((uint32_t) sector[0]) << 24) | + (((uint32_t) sector[1]) << 16) | + (((uint32_t) sector[2]) << 8) | + (((uint32_t) sector[3]) << 0); + + KFREE(sector); + + return 0; + +} + + + +/* ********************************************************************* + * usbmass_attach(dev,drv) + * + * This routine is called when the bus scan stuff finds a mass-storage + * device. We finish up the initialization by configuring the + * device and allocating our softc here. + * + * Input parameters: + * dev - usb device, in the "addressed" state. + * drv - the driver table entry that matched + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbmass_attach(usbdev_t *dev,usb_driver_t *drv) +{ + usb_config_descr_t *cfgdscr = dev->ud_cfgdescr; + usb_endpoint_descr_t *epdscr; + usb_endpoint_descr_t *indscr = NULL; + usb_endpoint_descr_t *outdscr = NULL; + usb_interface_descr_t *ifdscr; + usbmass_softc_t *softc; + int idx; + + dev->ud_drv = drv; + + softc = KMALLOC(sizeof(usbmass_softc_t),0); + memset(softc,0,sizeof(usbmass_softc_t)); + dev->ud_private = softc; + + ifdscr = usb_find_cfg_descr(dev,USB_INTERFACE_DESCRIPTOR_TYPE,0); + if (ifdscr == NULL) { + return -1; + } + + if ((ifdscr->bInterfaceSubClass != USBMASS_SUBCLASS_SCSI) || + (ifdscr->bInterfaceProtocol != USBMASS_BULKONLY_PROTOCOL)) { + console_log("USBMASS: Do not understand devices with SubClass 0x%02X, Protocol 0x%02X", + ifdscr->bInterfaceSubClass, + ifdscr->bInterfaceProtocol); + return -1; + } + + for (idx = 0; idx < 2; idx++) { + epdscr = usb_find_cfg_descr(dev,USB_ENDPOINT_DESCRIPTOR_TYPE,idx); + + if (USB_ENDPOINT_DIR_OUT(epdscr->bEndpointAddress)) { + outdscr = epdscr; + } + else { + indscr = epdscr; + } + } + + + if (!indscr || !outdscr) { + /* + * Could not get descriptors, something is very wrong. + * Leave device addressed but not configured. + */ + return -1; + } + + /* + * Choose the standard configuration. + */ + + usb_set_configuration(dev,cfgdscr->bConfigurationValue); + + /* + * Open the pipes. + */ + + softc->umass_inpipe = usb_open_pipe(dev,indscr); + softc->umass_outpipe = usb_open_pipe(dev,outdscr); + softc->umass_curtag = 0x12345678; + + /* + * Save pointer in global unit table so we can + * match CFE devices up with USB ones + */ + + +#ifdef _CFE_ + softc->umass_unit = -1; + for (idx = 0; idx < USBDISK_MAXUNITS; idx++) { + if (usbdisk_units[idx] == NULL) { + softc->umass_unit = idx; + usbdisk_units[idx] = dev; + break; + } + } + + console_log("USBMASS: Unit %d connected",softc->umass_unit); +#endif + + usbmass_dev = dev; + + return 0; +} + +/* ********************************************************************* + * usbmass_detach(dev) + * + * This routine is called when the bus scanner notices that + * this device has been removed from the system. We should + * do any cleanup that is required. The pending requests + * will be cancelled automagically. + * + * Input parameters: + * dev - usb device + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbmass_detach(usbdev_t *dev) +{ + usbmass_softc_t *softc; + softc = (usbmass_softc_t *) dev->ud_private; + +#ifdef _CFE_ + console_log("USBMASS: USB unit %d disconnected",softc->umass_unit); + if (softc->umass_unit >= 0) usbdisk_units[softc->umass_unit] = NULL; +#endif + + KFREE(softc); + return 0; +} + + + +#ifdef _CFE_ + + +/* ********************************************************************* + * usbdisk_sectorshift(size) + * + * Given a sector size, return log2(size). We cheat; this is + * only needed for 2048 and 512-byte sectors. + * Explicitly using shifts and masks in sector number calculations + * helps on 32-bit-only platforms, since we probably won't need + * a helper library. + * + * Input parameters: + * size - sector size + * + * Return value: + * # of bits to shift + ********************************************************************* */ + +#define usbdisk_sectorshift(size) (((size)==2048)?11:9) + + +/* ********************************************************************* + * usbdisk_probe(drv,probe_a,probe_b,probe_ptr) + * + * Our probe routine. Attach an empty USB disk device to the firmware. + * + * Input parameters: + * drv - driver structure + * probe_a - not used + * probe_b - not used + * probe_ptr - not used + * + * Return value: + * nothing + ********************************************************************* */ + +static void usbdisk_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + usbdisk_t *softc; + char descr[128]; + + softc = (usbdisk_t *) KMALLOC(sizeof(usbdisk_t),0); + + memset(softc,0,sizeof(usbdisk_t)); + + softc->usbdisk_sectorsize = 512; + softc->usbdisk_devtype = BLOCK_DEVTYPE_DISK; + softc->usbdisk_ttlsect = 0; /* not calculated yet */ + softc->usbdisk_unit = (int)probe_a; + + xsprintf(descr,"USB Disk unit %d",(int)probe_a); + + cfe_attach(drv,softc,NULL,descr); +} + + +/* ********************************************************************* + * usbdisk_open(ctx) + * + * Process the CFE OPEN call for this device. For IDE disks, + * the device is reset and identified, and the geometry is + * determined. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + + +static int usbdisk_open(cfe_devctx_t *ctx) +{ + usbdisk_t *softc = ctx->dev_softc; + usbdev_t *dev = usbdisk_units[softc->usbdisk_unit]; + uint32_t size; + int res; + + if (!dev) return CFE_ERR_NOTREADY; + + usbmass_request_sense(dev); + + res = usbmass_read_capacity(dev,&size); + if (res < 0) return res; + + softc->usbdisk_ttlsect = size; + + return 0; +} + +/* ********************************************************************* + * usbdisk_read(ctx,buffer) + * + * Process a CFE READ command for the IDE device. This is + * more complex than it looks, since CFE offsets are byte offsets + * and we may need to read partial sectors. + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * number of bytes read, or <0 if an error occured + ********************************************************************* */ + +static int usbdisk_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + usbdisk_t *softc = ctx->dev_softc; + usbdev_t *dev = usbdisk_units[softc->usbdisk_unit]; + unsigned char *bptr; + int blen; + int numsec; + int res = 0; + int amtcopy; + uint64_t lba; + uint64_t offset; + unsigned char sector[MAX_SECTORSIZE]; + int sectorshift; + + if (!dev) return CFE_ERR_NOTREADY; + + sectorshift = usbdisk_sectorshift(softc->usbdisk_sectorsize); + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + offset = buffer->buf_offset; + numsec = (blen + softc->usbdisk_sectorsize - 1) >> sectorshift; + + if (offset & (softc->usbdisk_sectorsize-1)) { + lba = (offset >> sectorshift); + res = usbmass_read_sector(dev,lba,1,sector); + if (res < 0) goto out; + amtcopy = softc->usbdisk_sectorsize - (offset & (softc->usbdisk_sectorsize-1)); + if (amtcopy > blen) amtcopy = blen; + memcpy(bptr,§or[offset & (softc->usbdisk_sectorsize-1)],amtcopy); + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + + if (blen >= softc->usbdisk_sectorsize) { + int seccnt; + + lba = (offset >> sectorshift); + seccnt = (blen >> sectorshift); + + res = usbmass_read_sector(dev,lba,seccnt,bptr); + if (res < 0) goto out; + + amtcopy = seccnt << sectorshift; + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + + if (blen) { + lba = (offset >> sectorshift); + res = usbmass_read_sector(dev,lba,1,sector); + if (res < 0) goto out; + amtcopy = blen; + memcpy(bptr,sector,amtcopy); + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + +out: + buffer->buf_retlen = bptr - buffer->buf_ptr; + + return res; +} + +/* ********************************************************************* + * usbdisk_inpstat(ctx,inpstat) + * + * Test input status for the IDE disk. Disks are always ready + * to read. + * + * Input parameters: + * ctx - device context + * inpstat - input status structure + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbdisk_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat) +{ + /* usbdisk_t *softc = ctx->dev_softc; */ + + inpstat->inp_status = 1; + return 0; +} + +/* ********************************************************************* + * usbdisk_write(ctx,buffer) + * + * Process a CFE WRITE command for the IDE device. If the write + * involves partial sectors, the affected sectors are read first + * and the changes are merged in. + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * number of bytes write, or <0 if an error occured + ********************************************************************* */ + +static int usbdisk_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + usbdisk_t *softc = ctx->dev_softc; + usbdev_t *dev = usbdisk_units[softc->usbdisk_unit]; + unsigned char *bptr; + int blen; + int numsec; + int res = 0; + int amtcopy; + uint64_t offset; + uint64_t lba; + unsigned char sector[MAX_SECTORSIZE]; + int sectorshift; + + if (!dev) return CFE_ERR_NOTREADY; + + sectorshift = usbdisk_sectorshift(softc->usbdisk_sectorsize); + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + offset = buffer->buf_offset; + numsec = (blen + softc->usbdisk_sectorsize - 1) >> sectorshift; + + if (offset & (softc->usbdisk_sectorsize-1)) { + lba = (offset >> sectorshift); + res = usbmass_read_sector(dev,lba,1,sector); + if (res < 0) goto out; + amtcopy = softc->usbdisk_sectorsize - (offset & (softc->usbdisk_sectorsize-1)); + if (amtcopy > blen) amtcopy = blen; + memcpy(§or[offset & (softc->usbdisk_sectorsize-1)],bptr,amtcopy); + res = usbmass_write_sector(dev,lba,1,sector); + if (res < 0) goto out; + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + + while (blen >= softc->usbdisk_sectorsize) { + amtcopy = softc->usbdisk_sectorsize; + lba = (offset >> sectorshift); + res = usbmass_write_sector(dev,lba,1,bptr); + if (res < 0) goto out; + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + + if (blen) { + lba = (offset >> sectorshift); + res = usbmass_read_sector(dev,lba,1,sector); + if (res < 0) goto out; + amtcopy = blen; + memcpy(sector,bptr,amtcopy); + res = usbmass_write_sector(dev,lba,1,sector); + if (res < 0) goto out; + bptr += amtcopy; + offset += amtcopy; + blen -= amtcopy; + } + +out: + buffer->buf_retlen = bptr - buffer->buf_ptr; + + return res; +} + + +/* ********************************************************************* + * usbdisk_ioctl(ctx,buffer) + * + * Process device I/O control requests for the IDE device. + * + * Input parameters: + * ctx - device context + * buffer - buffer descriptor + * + * Return value: + * 0 if ok + * else error code + ********************************************************************* */ + +static int usbdisk_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer) +{ + usbdisk_t *softc = ctx->dev_softc; + unsigned int *info = (unsigned int *) buffer->buf_ptr; + unsigned long long *linfo = (unsigned long long *) buffer->buf_ptr; + blockdev_info_t *devinfo; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_BLOCK_GETBLOCKSIZE: + *info = softc->usbdisk_sectorsize; + break; + case IOCTL_BLOCK_GETTOTALBLOCKS: + *linfo = softc->usbdisk_ttlsect; + break; + case IOCTL_BLOCK_GETDEVTYPE: + devinfo = (blockdev_info_t *) buffer->buf_ptr; + devinfo->blkdev_totalblocks = softc->usbdisk_ttlsect; + devinfo->blkdev_blocksize = softc->usbdisk_sectorsize; + devinfo->blkdev_devtype = softc->usbdisk_devtype; + break; + default: + return -1; + } + + return 0; +} + +/* ********************************************************************* + * usbdisk_close(ctx) + * + * Close the I/O device. + * + * Input parameters: + * ctx - device context + * + * Return value: + * 0 if ok, else error code + ********************************************************************* */ + +static int usbdisk_close(cfe_devctx_t *ctx) +{ + /* usbdisk_t *softc = ctx->dev_softc; */ + + return 0; +} + + +#endif diff --git a/cfe/cfe/usb/usbserial.c b/cfe/cfe/usb/usbserial.c new file mode 100644 index 0000000..737d8b4 --- /dev/null +++ b/cfe/cfe/usb/usbserial.c @@ -0,0 +1,713 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * USB Serial Port Driver File: usbserial.c + * + * This device can talk to a few of those usb->serial converters + * out there. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#ifndef _CFE_ +#include +#include +#include +#include +#include "usbhack.h" +#else +#include "lib_types.h" +#include "lib_string.h" +#include "lib_printf.h" +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_ioctl.h" +#include "cfe_console.h" +#include "bsp_config.h" +#endif + +#include "lib_malloc.h" +#include "lib_queue.h" +#include "usbchap9.h" +#include "usbd.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define USER_FIFOSIZE 256 + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct usbser_linedata_s { + uint8_t dLineDataBaud0,dLineDataBaud1,dLineDataBaud2,dLineDataBaud3; + uint8_t bLineDataStopBits; /* 0=1, 1=1.5, 2=2 */ + uint8_t bLineDataParity; /* 0=none, 1=odd, 2=even, 3=mark, 4=space */ + uint8_t bLineDataBits; /* 5,6,7,8 */ +} usbser_linedata_t; + + +/* ********************************************************************* + * Macros + ********************************************************************* */ + +#define GETDWFIELD(s,f) ((uint32_t)((s)->f##0) | ((uint32_t)((s)->f##1) << 8) | \ + ((uint32_t)((s)->f##2) << 16) | ((uint32_t)((s)->f##3) << 24)) +#define PUTDWFIELD(s,f,v) (s)->f##0 = (v & 0xFF); \ + (s)->f##1 = ((v)>>8 & 0xFF); \ + (s)->f##2 = ((v)>>16 & 0xFF); \ + (s)->f##3 = ((v)>>24 & 0xFF); + + + +/* ********************************************************************* + * Forward Definitions + ********************************************************************* */ + +static int usbserial_attach(usbdev_t *dev,usb_driver_t *drv); +static int usbserial_detach(usbdev_t *dev); + +#ifdef _CFE_ +static void usb_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr); + +static int usb_uart_open(cfe_devctx_t *ctx); +static int usb_uart_read(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int usb_uart_inpstat(cfe_devctx_t *ctx,iocb_inpstat_t *inpstat); +static int usb_uart_write(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int usb_uart_ioctl(cfe_devctx_t *ctx,iocb_buffer_t *buffer); +static int usb_uart_close(cfe_devctx_t *ctx); + +const static cfe_devdisp_t usb_uart_dispatch = { + usb_uart_open, + usb_uart_read, + usb_uart_inpstat, + usb_uart_write, + usb_uart_ioctl, + usb_uart_close, + NULL, + NULL +}; + +const cfe_driver_t usb_uart = { + "USB UART", + "uart", + CFE_DEV_SERIAL, + &usb_uart_dispatch, + usb_uart_probe +}; + +typedef struct usb_uart_s { + int uart_unit; + int uart_speed; + int uart_flowcontrol; +} usb_uart_t; + +#define USBUART_MAXUNITS 4 +static usbdev_t *usbuart_units[USBUART_MAXUNITS]; +#endif + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +typedef struct usbserial_softc_s { + int user_inpipe; + int user_outpipe; + int user_outmps; + int user_intpipe; + uint8_t user_inbuf[USER_FIFOSIZE]; + int user_inbuf_in; + int user_inbuf_out; + uint8_t *user_devinbuf; + int user_devinbufsize; + int user_unit; + uint8_t *user_intbuf; + usbser_linedata_t user_linedata; +} usbserial_softc_t; + +usb_driver_t usbserial_driver = { + "USB Serial Port", + usbserial_attach, + usbserial_detach +}; + +usbdev_t *usbserial_dev = NULL; + + +#if 0 +/* ********************************************************************* + * usbserial_get_linedata(dev,linedata) + * + * Request line data from the device. + * + * Input parameters: + * dev - USB device + * linedata - pointer to structure + * + * Return value: + * # of bytes returned + * <0 if error + ********************************************************************* */ + +static int usbserial_get_linedata(usbdev_t *dev,usbser_linedata_t *ldata) +{ + uint8_t *respbuf; + int res; + + respbuf = KMALLOC(32,0); + + res = usb_std_request(dev,0xA1,0x21,0,0,respbuf,sizeof(usbser_linedata_t)); + + KFREE(respbuf); + + if ((res >= 0) && ldata) memcpy(ldata,respbuf,sizeof(usbser_linedata_t)); + + return res; +} +#endif + +/* ********************************************************************* + * usbserial_set_linedata(dev,linedata) + * + * Set line data to the device. + * + * Input parameters: + * dev - USB device + * linedata - pointer to structure + * + * Return value: + * # of bytes returned + * <0 if error + ********************************************************************* */ + +static int usbserial_set_linedata(usbdev_t *dev,usbser_linedata_t *ldata) +{ + int res; + + /* + * Send request to device. + */ + + res = usb_std_request(dev,0x21,0x20,0,0,(uint8_t *) ldata,sizeof(usbser_linedata_t)); + + return res; +} + +#if 0 +/* ********************************************************************* + * usbserial_song_and_dance(usbdev_t *dev) + * + * Magic incantations from using the CATC on this device. + * + * Input parameters: + * dev + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbserial_song_and_dance(usbdev_t *dev) +{ + int res; + char databuf[1]; + + res = usb_std_request(dev,0xc0,0x01,0x8484,0,databuf,1); /* READ */ + + res = usb_std_request(dev,0x40,0x01,0x0404,0,NULL,0); /* WRITE */ + + res = usb_std_request(dev,0xc0,0x01,0x8484,0,databuf,1); /* READ */ + res = usb_std_request(dev,0xc0,0x01,0x8383,0,databuf,1); /* READ */ + res = usb_std_request(dev,0xc0,0x01,0x8484,0,databuf,1); /* READ */ + + res = usb_std_request(dev,0x40,0x01,0x0404,1,NULL,0); /* WRITE */ + + res = usb_std_request(dev,0xc0,0x01,0x8484,0,databuf,1); /* READ */ + res = usb_std_request(dev,0xc0,0x01,0x8383,0,databuf,1); /* READ */ + + res = usb_std_request(dev,0x40,0x01,0x0,1, NULL,0); /* WRITE */ + res = usb_std_request(dev,0x40,0x01,0x1,0xC0,NULL,0); /* WRITE */ + res = usb_std_request(dev,0x40,0x01,0x2,4, NULL,0); /* WRITE */ + + return 0; +} +#endif + +/* ********************************************************************* + * usbserial_tx_data(dev,buffer,len) + * + * Synchronously transmit data via the USB. + * + * Input parameters: + * dev - device pointer + * buffer,len - data we want to send + * + * Return value: + * number of bytes sent. + ********************************************************************* */ + +static int usbserial_tx_data(usbdev_t *dev,uint8_t *buffer,int len) +{ + uint8_t *bptr; + usbreq_t *ur; + usbserial_softc_t *softc = (dev->ud_private); + int res; + + bptr = KMALLOC(len,0); + + memcpy(bptr,buffer,len); + + ur = usb_make_request(dev,softc->user_outpipe,bptr,len,UR_FLAG_OUT); + res = usb_sync_request(ur); + +// printf("Data sent, status=%d, xferred=%d\n",res,ur->ur_xferred); + + res = ur->ur_xferred; + + usb_free_request(ur); + + KFREE(bptr); + + return res; +} + +/* ********************************************************************* + * usbserial_int_callback(ur) + * + * Callback routine for the interrupt request, for devices + * that have an interrupt pipe. We ignore this. + * + * Input parameters: + * ur - usb request + * + * Return value: + * nothing + ********************************************************************* */ + +static int usbserial_int_callback(usbreq_t *ur) +{ +// int idx; + + /* + * Check to see if the request was cancelled by someone + * deleting our endpoint. + */ + + if (ur->ur_status == 0xFF) { + usb_free_request(ur); + return 0; + } + +// printf("serial int msg: "); +// for (idx = 0; idx < ur->ur_xferred; idx++) printf("%02X ",ur->ur_buffer[idx]); +// printf("\n"); + + usb_queue_request(ur); + + return 0; + +} + + +/* ********************************************************************* + * usbserial_rx_callback(ur) + * + * Callback routine for the regular data pipe. + * + * Input parameters: + * ur - usb request + * + * Return value: + * nothing + ********************************************************************* */ + +static int usbserial_rx_callback(usbreq_t *ur) +{ + int idx; + int iptr; + usbserial_softc_t *user = (ur->ur_dev->ud_private); + + /* + * Check to see if the request was cancelled by someone + * deleting our endpoint. + */ + + if (ur->ur_status == 0xFF) { + usb_free_request(ur); + return 0; + } + + /* + * Add characters to the receive fifo + */ + + for (idx = 0; idx < ur->ur_xferred; idx++) { + iptr = (user->user_inbuf_in + 1) & (USER_FIFOSIZE-1); + if (iptr == user->user_inbuf_out) break; /* overflow */ + user->user_inbuf[user->user_inbuf_in] = ur->ur_buffer[idx]; + user->user_inbuf_in = iptr; + } + + /* + * Requeue the request + */ + + usb_queue_request(ur); + + return 0; + +} + + +/* ********************************************************************* + * usbserial_attach(dev,drv) + * + * This routine is called when the bus scan stuff finds a mass-storage + * device. We finish up the initialization by configuring the + * device and allocating our softc here. + * + * Input parameters: + * dev - usb device, in the "addressed" state. + * drv - the driver table entry that matched + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbserial_attach(usbdev_t *dev,usb_driver_t *drv) +{ + usb_config_descr_t *cfgdscr = dev->ud_cfgdescr; + usb_endpoint_descr_t *epdscr; + usb_endpoint_descr_t *indscr = NULL; + usb_endpoint_descr_t *outdscr = NULL; + usb_endpoint_descr_t *intdscr = NULL; + usb_interface_descr_t *ifdscr; + usbser_linedata_t *ldata; + usbserial_softc_t *softc; + usbreq_t *ur; + int idx; + + dev->ud_drv = drv; + + softc = KMALLOC(sizeof(usbserial_softc_t),0); + memset(softc,0,sizeof(usbserial_softc_t)); + dev->ud_private = softc; + + ifdscr = usb_find_cfg_descr(dev,USB_INTERFACE_DESCRIPTOR_TYPE,0); + if (ifdscr == NULL) { + printf("Could not get interface descriptor\n"); + return -1; + } + + for (idx = 0; idx < ifdscr->bNumEndpoints; idx++) { + epdscr = usb_find_cfg_descr(dev,USB_ENDPOINT_DESCRIPTOR_TYPE,idx); + + if ((epdscr->bmAttributes & USB_ENDPOINT_TYPE_MASK) == + USB_ENDPOINT_TYPE_INTERRUPT) { + intdscr = epdscr; + } + else if (USB_ENDPOINT_DIR_OUT(epdscr->bEndpointAddress)) { + outdscr = epdscr; + } + else { + indscr = epdscr; + } + } + + + if (!indscr || !outdscr) { + printf("IN or OUT endpoint descriptors are missing\n"); + /* + * Could not get descriptors, something is very wrong. + * Leave device addressed but not configured. + */ + return 0; + } + + /* + * Choose the standard configuration. + */ + + usb_set_configuration(dev,cfgdscr->bConfigurationValue); + + /* + * Open the pipes. + */ + + softc->user_inpipe = usb_open_pipe(dev,indscr); + softc->user_devinbufsize = GETUSBFIELD(indscr,wMaxPacketSize); + softc->user_devinbuf = KMALLOC(softc->user_devinbufsize,0); + softc->user_outpipe = usb_open_pipe(dev,outdscr); + softc->user_outmps = GETUSBFIELD(outdscr,wMaxPacketSize); + if (intdscr) { + softc->user_intpipe = usb_open_pipe(dev,intdscr); + } + else { + softc->user_intpipe = -1; + } + + ur = usb_make_request(dev,softc->user_inpipe,softc->user_devinbuf, + softc->user_devinbufsize, + UR_FLAG_IN | UR_FLAG_SHORTOK); + ur->ur_callback = usbserial_rx_callback; + usb_queue_request(ur); + + + if (softc->user_intpipe) { + softc->user_intbuf = KMALLOC(32,0); + ur = usb_make_request(dev,softc->user_intpipe,softc->user_intbuf, + GETUSBFIELD(intdscr,wMaxPacketSize), + UR_FLAG_IN | UR_FLAG_SHORTOK); + ur->ur_callback = usbserial_int_callback; + usb_queue_request(ur); + } + +#ifdef _CFE_ + softc->user_unit = -1; + for (idx = 0; idx < USBUART_MAXUNITS; idx++) { + if (usbuart_units[idx] == NULL) { + softc->user_unit = idx; + usbuart_units[idx] = dev; + break; + } + } + + console_log("USBSERIAL: Unit %d connected",softc->user_unit); +#endif + +// usbserial_song_and_dance(dev); + + ldata = &(softc->user_linedata); + PUTDWFIELD(ldata,dLineDataBaud,115200); + ldata->bLineDataStopBits = 0; + ldata->bLineDataParity = 2; + ldata->bLineDataBits = 8; + + usbserial_set_linedata(dev,ldata); +// usbserial_get_linedata(dev,NULL); + + usbserial_dev = dev; + + return 0; +} + +/* ********************************************************************* + * usbserial_detach(dev) + * + * This routine is called when the bus scanner notices that + * this device has been removed from the system. We should + * do any cleanup that is required. The pending requests + * will be cancelled automagically. + * + * Input parameters: + * dev - usb device + * + * Return value: + * 0 + ********************************************************************* */ + +static int usbserial_detach(usbdev_t *dev) +{ + usbserial_softc_t *softc; + + softc = dev->ud_private; + + +#ifdef _CFE_ + console_log("USBSERIAL: USB unit %d disconnected",softc->user_unit); + if (softc->user_unit >= 0) usbuart_units[softc->user_unit] = NULL; +#endif + + if (softc) { + if (softc->user_devinbuf) KFREE(softc->user_devinbuf); + if (softc->user_intbuf) KFREE(softc->user_intbuf); + KFREE(softc); + } + + return 0; +} + + + +#ifdef _CFE_ + + + +static void usb_uart_probe(cfe_driver_t *drv, + unsigned long probe_a, unsigned long probe_b, + void *probe_ptr) +{ + usb_uart_t *softc; + char descr[80]; + + softc = (usb_uart_t *) KMALLOC(sizeof(usb_uart_t),0); + + memset(softc,0,sizeof(usb_uart_t)); + + softc->uart_unit = (int)probe_a; + + xsprintf(descr,"USB UART unit %d",(int)probe_a); + + cfe_attach(drv,softc,NULL,descr); +} + + +static int usb_uart_open(cfe_devctx_t *ctx) +{ +// usb_uart_t *softc = ctx->dev_softc; +// int baudrate = CFG_SERIAL_BAUD_RATE; +// usbdev_t *dev = usbuart_units[softc->uart_unit]; + + /* + * XXX call the uart setup here + */ + + return 0; +} + +static int usb_uart_read(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + usb_uart_t *softc = ctx->dev_softc; + usbdev_t *dev = usbuart_units[softc->uart_unit]; + usbserial_softc_t *user = dev->ud_private; + unsigned char *bptr; + int blen; + + if (!dev) return 0; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + while ((blen > 0) && (user->user_inbuf_out != user->user_inbuf_in)) { + *bptr++ = user->user_inbuf[user->user_inbuf_out]; + user->user_inbuf_out = (user->user_inbuf_out + 1) & (USER_FIFOSIZE-1); + blen--; + } + + buffer->buf_retlen = buffer->buf_length - blen; + return 0; +} + +static int usb_uart_inpstat(cfe_devctx_t *ctx, iocb_inpstat_t *inpstat) +{ + usb_uart_t *softc = ctx->dev_softc; + usbdev_t *dev = usbuart_units[softc->uart_unit]; + usbserial_softc_t *user = dev->ud_private; + + inpstat->inp_status = 0; + + if (!dev) return 0; + + inpstat->inp_status = (user->user_inbuf_in != user->user_inbuf_out); + + return 0; +} + +static int usb_uart_write(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + usb_uart_t *softc = ctx->dev_softc; + unsigned char *bptr; + int blen; + usbdev_t *dev = usbuart_units[softc->uart_unit]; + usbserial_softc_t *user = dev->ud_private; + + bptr = buffer->buf_ptr; + blen = buffer->buf_length; + + if (!dev) { + buffer->buf_retlen = blen; + return 0; + } + + if (blen > user->user_outmps) blen = user->user_outmps; + + usbserial_tx_data(dev,bptr,blen); + + buffer->buf_retlen = blen; + return 0; +} + +static int usb_uart_ioctl(cfe_devctx_t *ctx, iocb_buffer_t *buffer) +{ + usb_uart_t *softc = ctx->dev_softc; + usbdev_t *dev = usbuart_units[softc->uart_unit]; +// usbserial_softc_t *user = dev->ud_private; + + if (!dev) return -1; + + unsigned int *info = (unsigned int *) buffer->buf_ptr; + + switch ((int)buffer->buf_ioctlcmd) { + case IOCTL_SERIAL_GETSPEED: + *info = softc->uart_speed; + break; + case IOCTL_SERIAL_SETSPEED: + softc->uart_speed = *info; + /* NYI */ + break; + case IOCTL_SERIAL_GETFLOW: + *info = softc->uart_flowcontrol; + break; + case IOCTL_SERIAL_SETFLOW: + softc->uart_flowcontrol = *info; + /* NYI */ + break; + default: + return -1; + } + + return 0; +} + +static int usb_uart_close(cfe_devctx_t *ctx) +{ +// usb_uart_t *softc = ctx->dev_softc; + + return 0; +} + + + +#endif + diff --git a/cfe/cfe/vendor/Makefile b/cfe/cfe/vendor/Makefile new file mode 100644 index 0000000..a9fb42c --- /dev/null +++ b/cfe/cfe/vendor/Makefile @@ -0,0 +1,2 @@ + +ALLOBJS += cfe_vendor_xreq.o cfe_vendor_iocb_dispatch.o cfe_vendor_cmds.o diff --git a/cfe/cfe/vendor/cfe_vendor_cmds.c b/cfe/cfe/vendor/cfe_vendor_cmds.c new file mode 100644 index 0000000..34a159d --- /dev/null +++ b/cfe/cfe/vendor/cfe_vendor_cmds.c @@ -0,0 +1,27 @@ + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "cfe_devfuncs.h" +#include "cfe_timer.h" + +#include "cfe_error.h" + +#include "ui_command.h" +#include "cfe.h" + +#include "bsp_config.h" + +int ui_init_vendorcmds(void); + + +int ui_init_vendorcmds(void) +{ + return 0; +} diff --git a/cfe/cfe/vendor/cfe_vendor_iocb.h b/cfe/cfe/vendor/cfe_vendor_iocb.h new file mode 100644 index 0000000..33581cb --- /dev/null +++ b/cfe/cfe/vendor/cfe_vendor_iocb.h @@ -0,0 +1,87 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCB definitions File: cfe_iocb.h + * + * This module describes CFE's IOCB structure, the main + * data structure used to communicate API requests with CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _CFE_VENDOR_IOCB_H +#define _CFE_VENDOR_IOCB_H + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define CFE_CMD_VENDOR_SAMPLE (CFE_CMD_VENDOR_USE+0) + +#define CFE_CMD_VENDOR_MAX (CFE_CMD_VENDOR_USE+1) + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +/* + * Vendor note: The fields in this structure leading up to the + * union *must* match the ones in cfe_iocb.h + * + * You can declare your own parameter list members here, since + * only your functions will be using them. + */ + + +typedef struct cfe_vendor_iocb_s { + cfe_uint_t iocb_fcode; /* IOCB function code */ + cfe_int_t iocb_status; /* return status */ + cfe_int_t iocb_handle; /* file/device handle */ + cfe_uint_t iocb_flags; /* flags for this IOCB */ + cfe_uint_t iocb_psize; /* size of parameter list */ + union { + /* add/replace parameter list here */ + iocb_buffer_t iocb_buffer; /* buffer parameters */ + } plist; +} cfe_vendor_iocb_t; + + +#endif + diff --git a/cfe/cfe/vendor/cfe_vendor_iocb_dispatch.c b/cfe/cfe/vendor/cfe_vendor_iocb_dispatch.c new file mode 100644 index 0000000..fb00c03 --- /dev/null +++ b/cfe/cfe/vendor/cfe_vendor_iocb_dispatch.c @@ -0,0 +1,179 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCB dispatcher File: cfe_vendor_iocb_dispatch.c + * + * This routine is the main API dispatch for CFE. User API + * calls, via the ROM entry point, get dispatched to routines + * in this module. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_queue.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_iocb.h" +#include "cfe_vendor_iocb.h" +#include "cfe_error.h" +#include "cfe_device.h" +#include "cfe_timer.h" +#include "cfe_mem.h" +#include "cfe_fileops.h" +#include "cfe_boot.h" +#include "env_subr.h" +#include "cfe.h" +#include "cfe_console.h" +#include "bsp_config.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define HV 1 /* handle valid */ + +/* ********************************************************************* + * Globals + ********************************************************************* */ + +extern cfe_devctx_t *cfe_handle_table[CFE_MAX_HANDLE]; + +/* ********************************************************************* + * Prototypes + ********************************************************************* */ + +int cfe_vendor_iocb_dispatch(cfe_iocb_t *iocb); + +/* ********************************************************************* + * Dispatch table + ********************************************************************* */ + +struct cfe_vendor_cmd_dispatch_s { + int plistsize; + int flags; + int (*func)(cfe_devctx_t *ctx,cfe_iocb_t *iocb); +}; + + +static int cfe_cmd_vendor_sample(cfe_devctx_t *ctx,cfe_iocb_t *iocb); + +const static struct cfe_vendor_cmd_dispatch_s + cfe_vendor_cmd_dispatch_table[CFE_CMD_VENDOR_MAX - CFE_CMD_VENDOR_USE] = { + {sizeof(iocb_buffer_t), 0, cfe_cmd_vendor_sample}, /* 0 : CFE_CMD_VENDOR_SAMPLE */ +}; + +/* ********************************************************************* + * IOCB dispatch routines + ********************************************************************* */ + + +int cfe_vendor_iocb_dispatch(cfe_iocb_t *iocb) +{ + const struct cfe_vendor_cmd_dispatch_s *disp; + int res; + cfe_devctx_t *ctx; + + /* + * Check for commands codes out of range + */ + + if ((iocb->iocb_fcode < CFE_CMD_VENDOR_USE) || + (iocb->iocb_fcode >= CFE_CMD_VENDOR_MAX)) { + iocb->iocb_status = CFE_ERR_INV_COMMAND; + return iocb->iocb_status; + } + + /* + * Check for command codes in range but invalid + */ + + disp = &cfe_vendor_cmd_dispatch_table[iocb->iocb_fcode - CFE_CMD_VENDOR_USE]; + + if (disp->plistsize < 0) { + iocb->iocb_status = CFE_ERR_INV_COMMAND; + return iocb->iocb_status; + } + + /* + * Check for invalid parameter list size + */ + + if (disp->plistsize != iocb->iocb_psize) { + iocb->iocb_status = CFE_ERR_INV_PARAM; + return iocb->iocb_status; + } + + /* + * Determine handle + */ + + ctx = NULL; + if (disp->flags & HV) { + if ((iocb->iocb_handle >= CFE_MAX_HANDLE) || + (iocb->iocb_handle < 0) || + (cfe_handle_table[iocb->iocb_handle] == NULL)){ + iocb->iocb_status = CFE_ERR_INV_PARAM; + return iocb->iocb_status; + } + ctx = cfe_handle_table[iocb->iocb_handle]; + } + + /* + * Dispatch to handler routine + */ + + res = (*disp->func)(ctx,iocb); + + iocb->iocb_status = res; + return res; +} + + + +/* ********************************************************************* + * Implementation routines for each IOCB function + ********************************************************************* */ + +static int cfe_cmd_vendor_sample(cfe_devctx_t *ctx,cfe_iocb_t *iocb) +{ + return CFE_OK; +} diff --git a/cfe/cfe/vendor/cfe_vendor_xiocb.h b/cfe/cfe/vendor/cfe_vendor_xiocb.h new file mode 100644 index 0000000..950ebcf --- /dev/null +++ b/cfe/cfe/vendor/cfe_vendor_xiocb.h @@ -0,0 +1,91 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCB definitions File: cfe_iocb.h + * + * This module describes CFE's IOCB structure, the main + * data structure used to communicate API requests with CFE. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + +#ifndef _CFE_VENDOR_XIOCB_H +#define _CFE_VENDOR_XIOCB_H + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define CFE_CMD_VENDOR_SAMPLE (CFE_CMD_VENDOR_USE+0) + +#define CFE_CMD_VENDOR_MAX (CFE_CMD_VENDOR_USE+1) + + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +/* + * Vendor note: The fields in this structure leading up to the + * union *must* match the ones in cfe_xiocb.h + * + * You can declare your own parameter list members here, since + * only your functions will be using them. + * + * You can also use some of the parameter list members in + * the regular xiocb.h if they are appropriate for your + * extended function calls. + */ + + +typedef struct cfe_vendor_xiocb_s { + cfe_xuint_t xiocb_fcode; /* IOCB function code */ + cfe_xint_t xiocb_status; /* return status */ + cfe_xint_t xiocb_handle; /* file/device handle */ + cfe_xuint_t xiocb_flags; /* flags for this IOCB */ + cfe_xuint_t xiocb_psize; /* size of parameter list */ + union { + /* add/replace parameter list here */ + xiocb_buffer_t xiocb_buffer; /* buffer parameters */ + } plist; +} cfe_vendor_xiocb_t; + + +#endif + diff --git a/cfe/cfe/vendor/cfe_vendor_xreq.c b/cfe/cfe/vendor/cfe_vendor_xreq.c new file mode 100644 index 0000000..f2ad541 --- /dev/null +++ b/cfe/cfe/vendor/cfe_vendor_xreq.c @@ -0,0 +1,222 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * IOCB dispatcher File: cfe_vendor_xreq.c + * + * This routine is the main API dispatch for CFE. User API + * calls, via the ROM entry point, get dispatched to routines + * in this module. + * + * This version of cfe_xreq is used for vendor extensions to + * CFE. + * + * This module looks similar to cfe_iocb_dispatch - it is different + * in that the data structure used, cfe_xiocb_t, uses fixed + * size field members (specifically, all 64-bits) no matter how + * the firmware is compiled. This ensures a consistent API + * interface on any implementation. When you call CFE + * from another program, the entry vector comes here first. + * + * Should the normal cfe_iocb interface change, this one should + * be kept the same for backward compatibility reasons. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_malloc.h" +#include "lib_queue.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_iocb.h" +#include "cfe_vendor_iocb.h" +#include "cfe_xiocb.h" +#include "cfe_vendor_xiocb.h" +#include "cfe_error.h" +#include "cfe_device.h" +#include "cfe_timer.h" +#include "cfe_mem.h" +#include "env_subr.h" +#include "cfe.h" + + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +/* enum values for various plist types */ + +#define PLBUF 1 /* iocb_buffer_t */ + +/* ********************************************************************* + * Structures + ********************************************************************* */ + +struct cfe_vendor_xcmd_dispatch_s { + int xplistsize; + int iplistsize; + int plisttype; +}; + + +/* ********************************************************************* + * Command conversion table + * This table contains useful information for converting + * iocbs to xiocbs. + ********************************************************************* */ + +const static struct cfe_vendor_xcmd_dispatch_s + cfe_vendor_xcmd_dispatch_table[CFE_CMD_VENDOR_MAX-CFE_CMD_VENDOR_USE] = { + {sizeof(xiocb_buffer_t), sizeof(iocb_buffer_t), PLBUF}, /* 0 : CFE_CMD_VENDOR_SAMPLE */ +}; + + +/* ********************************************************************* + * Externs + ********************************************************************* */ + +extern int cfe_vendor_iocb_dispatch(cfe_vendor_iocb_t *iocb); +extern cfe_int_t cfe_vendor_doxreq(cfe_vendor_xiocb_t *xiocb); + +/* ********************************************************************* + * cfe_vendor_doxreq(xiocb) + * + * Process an xiocb request. This routine converts an xiocb + * into an iocb, calls the IOCB dispatcher, converts the results + * back into the xiocb, and returns. + * + * Input parameters: + * xiocb - pointer to user xiocb + * + * Return value: + * command status, <0 if error occured + ********************************************************************* */ + +cfe_int_t cfe_vendor_doxreq(cfe_vendor_xiocb_t *xiocb) +{ + const struct cfe_vendor_xcmd_dispatch_s *disp; + cfe_vendor_iocb_t iiocb; + cfe_int_t res; + + /* + * Check for commands codes out of range + */ + + if ((xiocb->xiocb_fcode < CFE_CMD_VENDOR_USE) || + (xiocb->xiocb_fcode >= CFE_CMD_VENDOR_MAX)) { + xiocb->xiocb_status = CFE_ERR_INV_COMMAND; + return xiocb->xiocb_status; + } + + /* + * Check for command codes in range but invalid + */ + + disp = &cfe_vendor_xcmd_dispatch_table[xiocb->xiocb_fcode - CFE_CMD_VENDOR_USE]; + + if (disp->xplistsize < 0) { + xiocb->xiocb_status = CFE_ERR_INV_COMMAND; + return xiocb->xiocb_status; + } + + /* + * Check for invalid parameter list size + */ + + if (disp->xplistsize != xiocb->xiocb_psize) { + xiocb->xiocb_status = CFE_ERR_INV_PARAM; + return xiocb->xiocb_status; + } + + /* + * Okay, copy parameters into the internal IOCB. + * First, the fixed header. + */ + + iiocb.iocb_fcode = (unsigned int) xiocb->xiocb_fcode; + iiocb.iocb_status = (int) xiocb->xiocb_status; + iiocb.iocb_handle = (int) xiocb->xiocb_handle; + iiocb.iocb_flags = (unsigned int) xiocb->xiocb_flags; + iiocb.iocb_psize = (unsigned int) disp->iplistsize; + + /* + * Now the parameter list + */ + + switch (disp->plisttype) { + case PLBUF: + iiocb.plist.iocb_buffer.buf_offset = (cfe_offset_t) xiocb->plist.xiocb_buffer.buf_offset; + iiocb.plist.iocb_buffer.buf_ptr = (unsigned char *) (uintptr_t) xiocb->plist.xiocb_buffer.buf_ptr; + iiocb.plist.iocb_buffer.buf_length = (unsigned int) xiocb->plist.xiocb_buffer.buf_length; + iiocb.plist.iocb_buffer.buf_retlen = (unsigned int) xiocb->plist.xiocb_buffer.buf_retlen; + iiocb.plist.iocb_buffer.buf_ioctlcmd = (unsigned int) xiocb->plist.xiocb_buffer.buf_ioctlcmd; + break; + } + + /* + * Do the internal function dispatch + */ + + res = (cfe_int_t) cfe_vendor_iocb_dispatch(&iiocb); + + /* + * Now convert the parameter list members back + */ + + switch (disp->plisttype) { + case PLBUF: + xiocb->plist.xiocb_buffer.buf_offset = (cfe_uint_t) iiocb.plist.iocb_buffer.buf_offset; + xiocb->plist.xiocb_buffer.buf_ptr = (cfe_xptr_t) (uintptr_t) iiocb.plist.iocb_buffer.buf_ptr; + xiocb->plist.xiocb_buffer.buf_length = (cfe_uint_t) iiocb.plist.iocb_buffer.buf_length; + xiocb->plist.xiocb_buffer.buf_retlen = (cfe_uint_t) iiocb.plist.iocb_buffer.buf_retlen; + xiocb->plist.xiocb_buffer.buf_ioctlcmd = (cfe_uint_t) iiocb.plist.iocb_buffer.buf_ioctlcmd; + break; + } + + /* + * And the fixed header + */ + + xiocb->xiocb_status = (cfe_int_t) iiocb.iocb_status; + xiocb->xiocb_handle = (cfe_int_t) iiocb.iocb_handle; + xiocb->xiocb_flags = (cfe_uint_t) iiocb.iocb_flags; + + return xiocb->xiocb_status; +} diff --git a/cfe/cfe/verif/Makefile b/cfe/cfe/verif/Makefile new file mode 100644 index 0000000..939b494 --- /dev/null +++ b/cfe/cfe/verif/Makefile @@ -0,0 +1,7 @@ + +# +# Object files needed by VAPI +# + +CFLAGS += -DCFG_VAPI=1 +ALLOBJS += vapi.o vapisubr.o vapitest.o ui_vapi.o diff --git a/cfe/cfe/verif/readme.txt b/cfe/cfe/verif/readme.txt new file mode 100644 index 0000000..4a35dee --- /dev/null +++ b/cfe/cfe/verif/readme.txt @@ -0,0 +1,342 @@ +CFE Diagnostic Entry Points +--------------------------- + +--------------------------------------------------------------------------- + +The CFE diagnostic entry points are used when running verification +programs under the control of the firmware. They are fixed (constant) +addresses and have register-based calling sequences. These entry +points are designed to be as minimal as possible so that as much of the +verification code as possible can be reused. + +You can call the KSEG0 or KSEG1 version of the routine. It is +recommended that you call the cached version from cached code and +vice versa. + +The firmware will reserve the top megabyte of memory for itself. The +diagnostic must not touch this memory. + +The firmware will be compiled to *NOT* use relocatable data and +code segments. + +The firmware will need one general register that it is allowed to +trash without saving - I'll be using this to generate the pointer to +the save area. + +The diagnostics can generate records in a log buffer. This buffer +is allocated in the diagnostic's memory space but is filled in +by the firmware through the diagnostic entry points. At the end +of the diagnostic run, user commands in the firmware may be used +to look through accumulated log records. + +If you mess with the caches or with the console device, the +VAPI functions that print messages to the console may not work. + +Log records follow this format: + + +0 SIGNATURE, FORMAT, and ID-CODE + +8 Number of 64-bit words in 'Log Data' field. + Upper 32 bits are CP0 count register + +16 Return address of routine generating this record + +24 Log Data + +The "Log Record size" field is the number of bytes in the "log data" +field. No log data would use a value of zero. + +The bytes in the SIGNATURE word are broken down as follows: + + S1 S2 P1 F1 I1 I2 I3 I4 + CF E1 pp xx ii ii ii ii + +The "F1" byte is the format code; it describes the type +of log record being generated. + + 0x00 - General register and CP0 dump + 0x01 - SOC state dump + 0x02 - Generic log data (multiple of 8 bytes) + 0x03 - trace RAM + 0x04 - Diagnostic termination status (8 bytes) + 0x05 - Floating point registers + +The "P1" byte is the processor number, 0 or 1. + +The "I1" through "I4" bytes are supplied by the diagnostic +and can take on any value. You can use these bytes to identify +what part of the program generated this particular log record. + +For example, if the diagnostic logs a single value of +0x0123_4567_89ab_cdef the log entry might look like: + + 0xCCFF_EE02_0000_0001 + 0x0001_3F22_0000_0008 + 0xFFFF_FFFF_8000_0120 + 0x0123_4567_89AB_CDEF + + +RETURN TO FIRMWARE +------------------ + +Description: + + Returns control to the firmware and displays the test status. + The status result is in register A0. + + The firmware will store a "diagnostic termination status" + record in the log with the A0 register value. The ID code + will be zero for this record. + + CFE's log scanning commands can be used to display log + records accumulated by the test. + + +Routine address: 0xBFC00510 (KSEG1) + 0x9FC00510 (KSEG0) + +On entry: A0 ($4) Exit status (9=ok, nonzero=fail) +On return: Does not return +Registers used: All + + +DUMP GENERAL REGISTERS +---------------------- + +Description: + + This routine causes CFE to display a register dump on the console + port. It is assumed that the console hardware state has not been + altered by the diagnostic. + + The format of the register dump is: TBD [XXX should it look like the + one that the functional simulator uses?] + + The firmware needs one scratch register. + + +Routine address: 0xBFC00520 (KSEG1) + 0x9FC00520 (KSEG0) + +On Entry: RA ($31) Return Address +On Return: nothing +Registers used: K0 ($26) Scratch register for CFE + + +SET LOG BUFFER +-------------- + +Description: + + This routine sets the address of the log buffer. This + call must be made once at the beginning of the diagnostic + or else the "SAVE" functions will be considered as + NOPs. + + The buffer addresses must be 64-bit aligned. + +Routine address: 0xBFC00530 (KSEG1) + 0x9FC00530 (KSEG0) + +On Entry: RA ($31) Return Address + A0 ($4) Address of start of buffer + A1 ($5) Address of end of buffer +On Return: Nothing +Registers Used: K0 ($26) Scratch register for CFE + + + +LOG SINGLE VALUE +---------------- + +Description: + + This routine saves a single 64-bit value in the log. + + +Routine address: 0xBFC00540 (KSEG1) + 0x9FC00540 (KSEG0) + +On Entry: RA ($31) Return Address + A0 ($4) Low 32 bits are ID code for value + A1 ($5) Value to log +On Return: Nothing +Registers Used: K0 ($26) Scratch register for CFE + + + +LOG MEMORY DATA +--------------- + +Description: + + This routine saves a block of memory in the log. The source + buffer must be 64-bit aligned. + + +Routine address: 0xBFC00550 (KSEG1) + 0x9FC00550 (KSEG0) + +On Entry: RA ($31) Return Address + A0 ($4) Low 32 bits are ID code for values + A1 ($5) Address of buffer containing values + A2 ($6) Number of 64-bit words to store +On Return: Nothing +Registers Used: K0 ($26) Scratch register for CFE + + + + + +SAVE SOC STATE +-------------- + +Description: + + This routine saves the SOC state in a user-supplied buffer. + The buffer must be large enough to accomodate the SOC state. + The SOC state will be written as records with the following + format: + + uint64_t phys_address + uint64_t value + uint64_t phys_address + uint64_t value + ... + uint64_t phys_address + uint64_t value + + The table of SOC registers to dump will be maintained by + the firmware. + + The firmware needs one scratch register. + +Routine address: 0xBFC00570 (KSEG1) + 0x9FC00570 (KSEG0) + +On entry: A0 ($4) Low 32 bits are ID code for values + A1 ($5) Bitmask of agents to store in log +On return: nothing +Registers used: K0 ($26) Scratch register for CFE + + +SAVE CPU REGISTERS +------------------ + +Description: + + This routine saves the CPU general registers and certain CP0 + registers in a user-supplied buffer. + + This buffer must be large enough to accomodate the data + that will be saved. The registers will be written in + the following format: + + uint64_t general_registers[32] + uint64_t C0_INX + uint64_t C0_RAND + uint64_t C0_TLBLO0 + uint64_t C0_TLBLO1 + uint64_t C0_CTEXT + uint64_t C0_PGMASK + uint64_t C0_WIRED + uint64_t C0_BADVADDR + uint64_t C0_COUNT + uint64_t C0_TLBHI + uint64_t C0_COMPARE + uint64_t C0_SR + uint64_t C0_CAUSE + uint64_t C0_EPC + uint64_t C0_PRID + uint64_t C0_CONFIG + uint64_t C0_LLADDR + uint64_t C0_WATCHLO + uint64_t C0_WATCHHI + uint64_t C0_XCTEXT + uint64_t C0_ECC + uint64_t C0_CACHEERR + uint64_t C0_TAGLO + uint64_t C0_TAGHI + uint64_t C0_ERREPC + + The firmware needs one scratch register. + +Routine address: 0xBFC00580 (KSEG1) + 0x9FC00580 (KSEG0) + +On entry: RA ($31) Return address + A0 ($4) Low 32 bits are ID code for values +On return: nothing +Registers used: K0 ($26) Scratch register for CFE + + +SAVE FPU REGISTERS +------------------ + +Description: + + This routine saves the floating point and floating point + control registers. The registers will be written in + the following format: + + uint64_t fp_registers[32] + uint64_t fp_fir + uint64_t fp_status + uint64_t fp_condition_codes + uint64_t fp_exceptions + uint64_t fp_enables + + The firmware needs one scratch register. + +Routine address: 0xBFC005B0 (KSEG1) + 0x9FC005B0 (KSEG0) + +On entry: RA ($31) Return address + A0 ($4) Low 32 bits are ID code for values +On return: nothing +Registers used: K0 ($26) Scratch register for CFE + + +DUMP STRING +----------- + +Description: + + This routine displays a zero-terminated ASCII text string on the + console port. + + The firmware needs one scratch register. + + +Routine address: 0xBFC00590 (KSEG1) + 0x9FC00590 (KSEG0) + +On entry: RA ($31) Return address + A0 ($4) Pointer to null-terminated string +On return: nothing +Registers used: K0 ($26) Scratch register for CFE + + + +SHOW LED MESSAGE +---------------- + +Description: + + This routine writes four characters onto the SWARM board LEDs. + Writing to the LEDs is very fast compared to writing to the + console and can be useful for providing progress feedback + during a run. + + The characters are packed into the low 4 bytes of register A0. + The string ABCD would be hex 0x0000_0000_4142_4344 + + The firmware needs one scratch register + +Routine address: 0xBFC005A0 (KSEG1) + 0x9FC005A0 (KSEG0) + +On entry: RA ($31) Return Address + A0 ($4) Four characters +On return: nothing +Registers used: K0 ($26) Scratch register for CFE + +------------------------------------------------------------------------ + diff --git a/cfe/cfe/verif/ui_vapi.c b/cfe/cfe/verif/ui_vapi.c new file mode 100644 index 0000000..4575322 --- /dev/null +++ b/cfe/cfe/verif/ui_vapi.c @@ -0,0 +1,300 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * VAPI commands File: ui_vapi.c + * + * User interface for the verification API + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "lib_types.h" +#include "lib_string.h" +#include "lib_queue.h" +#include "lib_malloc.h" +#include "lib_printf.h" +#include "bsp_config.h" + +#include "cfe_iocb.h" +#include "cfe_device.h" +#include "cfe_console.h" +#include "env_subr.h" +#include "ui_command.h" +#include "cfe.h" + +#if CFG_VAPI + +#include "vapi.h" + +int ui_init_vapicmds(void); + +extern void vapitest(void); + +extern void vapi_run(int); + +extern uint64_t vapi_logstart; +extern uint64_t vapi_logend; +extern uint64_t vapi_logptr; +extern uint64_t vapi_status; + +int ui_cmd_vapirun(ui_cmdline_t *cmd,int argc,char *argv[]); +int ui_cmd_vapitest(ui_cmdline_t *cmd,int argc,char *argv[]); +int ui_cmd_vapishow(ui_cmdline_t *cmd,int argc,char *argv[]); +int ui_cmd_vapidump(ui_cmdline_t *cmd,int argc,char *argv[]); +int ui_cmd_vapistatus(ui_cmdline_t *cmd,int argc,char *argv[]); + +static char *rectypes[7] = { + "GPRS ", + "SOC ", + "DATA ", + "BUF ", + "TRC ", + "EXIT ", + "FPRS " +}; + +int ui_cmd_vapidump(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + uint64_t *ptr; + uint64_t *eptr; + int recnum = 0; + + if (vapi_logptr == 0) { + xprintf("Diagnostic did not record any log records\n"); + return -1; + } + + ptr = (uint64_t *) (intptr_t) vapi_logstart; + eptr = (uint64_t *) (intptr_t) vapi_logptr; + + xprintf("*** VAPI LOG START %s\n", +#ifdef __MIPSEB + "big-endian" +#else + "little-endian" +#endif + ); + + while (ptr < eptr) { + xprintf("%6d %016llX %016llX %016llX %016llX\n", + recnum, + ptr[0],ptr[1],ptr[2],ptr[3]); + ptr += 4; + recnum++; + } + + xprintf("*** VAPI LOG END\n"); + + return 0; + + +} + +int ui_cmd_vapishow(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + uint64_t *ptr; + uint64_t *eptr; + uint32_t a,b; + uint32_t ts,len,fmt; + unsigned int idx; + int recnum = 0; + + if (vapi_logptr == 0) { + xprintf("Diagnostic did not record any log records\n"); + return -1; + } + + ptr = (uint64_t *) (intptr_t) vapi_logstart; + eptr = (uint64_t *) (intptr_t) vapi_logptr; + + while (ptr < eptr) { + a = (ptr[VAPI_IDX_SIGNATURE]) >> 32; + b = (ptr[VAPI_IDX_SIGNATURE]) & 0xFFFFFFFF; + if ((a & VAPI_SEAL_MASK) != VAPI_CFESEAL) { + xprintf("Incorrect record seal at %08X\n",ptr); + break; + } + + fmt = (a & VAPI_FMT_MASK); + + xprintf("%5d ID=%08X CPU%d %s RA=%08X ", + recnum, + b, + (a & VAPI_PRID_MASK) >> VAPI_PRNUM_SHIFT, + rectypes[fmt], + ptr[VAPI_IDX_RA]); + + ts = (ptr[VAPI_IDX_SIZE]) >> 32; + len = ((ptr[VAPI_IDX_SIZE]) & 0xFFFFFFFF); + + xprintf("TS=%08X ",ts); + + switch (fmt) { + case VAPI_FMT_GPRS: + xprintf("Len=%d\n",len); + for (idx = 0; idx < len; idx += 2) { + xprintf(" %016llX %016llX\n", + ptr[VAPI_IDX_DATA+idx], + ptr[VAPI_IDX_DATA+idx+1]); + } + break; + case VAPI_FMT_SOC: + xprintf("Len=%d\n",len); + for (idx = 0; idx < len; idx += 2) { + xprintf(" Reg=%016llX Val=%016llX\n", + ptr[VAPI_IDX_DATA+idx], + ptr[VAPI_IDX_DATA+idx+1]); + } + break; + case VAPI_FMT_DATA: + xprintf("Data=%016llX\n",ptr[VAPI_IDX_DATA]); + break; + case VAPI_FMT_BUFFER: + xprintf("Addr=%08X\n",(intptr_t) ptr[VAPI_IDX_DATA]); + for (idx = 0; idx < len-1; idx += 2) { + xprintf(" %016llX %016llX\n", + ptr[VAPI_IDX_DATA+idx+1], + ptr[VAPI_IDX_DATA+idx+2]); + } + if (idx != (len-1)) { + xprintf(" %016llX\n", + ptr[VAPI_IDX_DATA+idx+1]); + } + break; + case VAPI_FMT_TRACE: + xprintf("\n"); + break; + case VAPI_FMT_EXIT: + xprintf("Stat=%016llX\n",ptr[VAPI_IDX_DATA]); + break; + default: + xprintf("\n"); + break; + } + + ptr += 3 + len; + recnum++; + } + + return 0; + +} + +int ui_cmd_vapitest(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + + vapitest(); + + xprintf("LogStart=%llX LogEnd=%llX LogPtr=%llX\n", + vapi_logstart,vapi_logend,vapi_logptr); + + return 0; +} + +int ui_cmd_vapistatus(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + + xprintf("VAPI Exit Status = <%016llX>\n", vapi_status); + return 0; +} + +int ui_cmd_vapirun(ui_cmdline_t *cmd,int argc,char *argv[]) +{ + int mode; /* 0 = cached, 1 = uncached, 2 = mc mode */ + + mode = 0; + if (cmd_sw_isset(cmd,"-uncached")) mode = 1; + if (cmd_sw_isset(cmd,"-mc")) mode = 2; + + vapi_run(mode); + return -1; +} + + +int ui_init_vapicmds(void) +{ + cmd_addcmd("vapi run", + ui_cmd_vapirun, + NULL, + "Run a program using the VAPI reset vector.", + "vapi run\n" + "Executes a previously loaded VAPI program by resetting the\n" + "CPUs and jumping directly to user code. The program\n" + "must be located at absolute address 0x8002_0000\n", + "-uncached;Start execution at 0xA002_0000 (KSEG1)|" + "-mc;Start execution at 0xBFD0_0000"); + + cmd_addcmd("vapi test", + ui_cmd_vapitest, + NULL, + "Test VAPI interface.", + "vapi test\n\n" + "Do some basic calls to the VAPI interface, then return to CFE\n\n", + ""); + + cmd_addcmd("vapi dump", + ui_cmd_vapidump, + NULL, + "Show VAPI log in an easily processed format.", + "vapi dump\n\n" + "Display the VAPI log in a format that is more easily postprocessed\n" + "by external programs.\n\n", + ""); + + cmd_addcmd("vapi show", + ui_cmd_vapishow, + NULL, + "Show VAPI log.\n", + "vapi show\n\n" + "Display the VAPI log in a human readable form (sort of)\n\n", + ""); + + cmd_addcmd("vapi status", + ui_cmd_vapistatus, + NULL, + "Print last VAPI exit status.\n", + "vapi status\n\n" + "Display the exit status of the last VAPI program that was run\n", + ""); + + return 0; +} + +#endif diff --git a/cfe/cfe/verif/vapi.S b/cfe/cfe/verif/vapi.S new file mode 100644 index 0000000..a65fb6d --- /dev/null +++ b/cfe/cfe/verif/vapi.S @@ -0,0 +1,1150 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Verification Test APIs File: vapi.S + * + * This module contains special low-level routines for use + * by verification programs. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "bsp_config.h" +#include "mipsmacros.h" + +#if CFG_VAPI + +#if (CFG_EMBEDDED_PIC) +#error "CFG_VAPI is not compatible with relocatable code" +#endif + +#include "cfe_devfuncs.h" + +#include "sb1250_defs.h" +#include "sb1250_regs.h" +#include "sb1250_scd.h" + +#include "vapi.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + +#define CALLKSEG1(x) \ + la t0,x ; \ + or t0,K1BASE ; \ + jal t0 + +#ifndef CFG_STACK_SIZE +#define STACK_SIZE 8192 +#else +#define STACK_SIZE ((CFG_STACK_SIZE+1023) & ~1023) +#endif + +#define REGIDX(x) ((x)*8) + +#define SAVE_RA REGIDX(0) +#define SAVE_GP REGIDX(1) +#define SAVE_AT REGIDX(2) +#define SAVE_T0 REGIDX(3) +#define SAVE_T1 REGIDX(4) +#define SAVE_T2 REGIDX(5) +#define SAVE_T3 REGIDX(6) +#define SAVE_A0 REGIDX(7) +#define SAVE_A1 REGIDX(8) +#define SAVE_A2 REGIDX(9) + +#define SAVE_SIZE REGIDX(10) + +#define SAVETEMPS(x) \ + .set noat ; \ + la k0,x ; \ + sd ra,SAVE_RA(k0) ; \ + sd gp,SAVE_GP(k0) ; \ + sd AT,SAVE_AT(k0) ; \ + sd t0,SAVE_T0(k0) ; \ + sd t1,SAVE_T1(k0) ; \ + sd t2,SAVE_T2(k0) ; \ + sd t3,SAVE_T3(k0) ; \ + sd a0,SAVE_A0(k0) ; \ + sd a1,SAVE_A1(k0) ; \ + sd a2,SAVE_A2(k0) ; \ + .set at ; \ + la gp,_gp + + +#define RESTORETEMPS(x) \ + .set noat ; \ + la k0,x ; \ + ld ra,SAVE_RA(k0) ; \ + ld gp,SAVE_GP(k0) ; \ + ld AT,SAVE_AT(k0) ; \ + ld t0,SAVE_T0(k0) ; \ + ld t1,SAVE_T1(k0) ; \ + ld t2,SAVE_T2(k0) ; \ + ld t3,SAVE_T3(k0) ; \ + ld a0,SAVE_A0(k0) ; \ + ld a1,SAVE_A1(k0) ; \ + ld a2,SAVE_A2(k0) ; \ + .set at + +#define RECPTR t3 + +#define CHECKPTR(label) \ + ld RECPTR,vapi_logptr ; \ + ld t0,vapi_logend ; \ + beq RECPTR,zero,label ; \ + bge RECPTR,t0,label + +#define SETRECTYPE(x,id) \ + ld RECPTR,vapi_logptr ; \ + li t2,(VAPI_CFESEAL | (x)) ; \ + mfc0 t0,C0_PRID ; \ + srl t0,t0,25 ; \ + and t0,t0,7 ; \ + sll t0,t0,VAPI_PRNUM_SHIFT ; \ + or t2,t2,t0 ; \ + dsll t2,t2,32 ; \ + or t2,id ; \ + sd t2,VAPI_REC_SIGNATURE(RECPTR) ; \ + mfc0 t2,C0_COUNT ; \ + dsll t2,t2,32 ; \ + sd t2,VAPI_REC_SIZE(RECPTR) ; \ + sd ra,VAPI_REC_RA(RECPTR) + + + +#define SETRECLEN_CONST(len) \ + ld t2,VAPI_REC_SIZE(RECPTR) ; \ + or t2,len ; \ + sd t2,VAPI_REC_SIZE(RECPTR) + +#define SETRECLEN_REG(r) \ + ld t2,VAPI_REC_SIZE(RECPTR) ; \ + or t2,r ; \ + sd t2,VAPI_REC_SIZE(RECPTR) + + +/* ********************************************************************* + * Data + ********************************************************************* */ + + .sdata + + .globl vapi_logstart + .globl vapi_logend + .globl vapi_logptr + .globl vapi_status + .globl vapi_logover + +vapi_logstart: .dword 0 +vapi_logend: .dword 0 +vapi_logptr: .dword 0 +vapi_status: .dword -1 +vapi_logover: .dword 0 + + .extern mem_heapstart + + .bss + + .comm vapi_regsave,REGIDX(64) + + .text + + .globl vapi_socregs +vapi_socregs: + +#ifdef _P5064_ + .word 0, 0 +#else +#include "sb1250_socregs.inc" +#endif + + .text + + .extern cfe_warmstart + + .set reorder + + +/* ********************************************************************* + * VAPI_KSEG0_SWITCH + * + * Hack the return address so we will come back in KSEG0 + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(vapi_kseg0_switch) + + and ra,(K0SIZE-1) + or ra,K0BASE + jr ra + +END(vapi_kseg0_switch) + +/* ********************************************************************* + * VAPI_EXIT(status) + * + * Return from diagnostic to firmware + * + * Input parameters: + * a0 - exit status (0=ok, else error) + * + * Return value: + * does not return + ********************************************************************* */ + + +LEAF(vapi_exit) + + move k1,a0 + + +/* + * Reinitialize the CPU and the caches + */ + + bal vapi_kseg1_switch + CALLKSEG1(sb1_cpu_init) +/* + * Don't initialize the caches again. Some diags + * leave data in the caches and if we invalidate it + * now we won't be able to see what happened. + */ +/* CALLKSEG1(sb1250_l1cache_init) */ +/* CALLKSEG1(sb1250_l2cache_init) */ + +#ifdef __long64 +/* + * Set back to 64-bit mode. Don't worry about the hazard + * here, it'll be eons before we need to use the KX space. + */ + mfc0 t0,C0_SR + or t0,t0,M_SR_KX + mtc0 t0,C0_SR +#endif + + bal vapi_kseg0_switch + + li a0,0x42424242 # 'BBBB' + jal board_setleds + + move a0,k1 + + la gp,_gp + sd a0,vapi_status + LR sp,mem_heapstart + ADD sp,((CFG_HEAP_SIZE*1024)+STACK_SIZE - 8) + +/* + * Create a log record for the EXIT status. + */ + ld t0,vapi_logptr + beq t0,zero,nolog + + SETRECTYPE(VAPI_FMT_EXIT,0) + SETRECLEN_CONST(1) + sd a0,VAPI_REC_DATA(RECPTR) + add RECPTR,32 + sd RECPTR,vapi_logptr +nolog: + li a0,0x45454545 # 'EEEE' + jal board_setleds + +#if CFG_MULTI_CPUS + + /* + * Restart the other CPU if it was left in RESET. + */ + + la t2,PHYS_TO_K1(A_SCD_SYSTEM_CFG) + ld t0,0(t2) + dli t1,M_SYS_CPU_RESET_1 # Reset mask + and t0,t1 # Test if CPU is in reset + beq t0,zero,1f # skip if not in reset + + li a0,1 # Whack the CPU + jal altcpu_cmd_stop # and put it back in idle +1: +#endif + + ld a0,vapi_status + j cfe_warmstart + +END(vapi_exit) + + + +/* ********************************************************************* + * VAPI_DUMPGPRS() + * + * Dump the GPRs to the console + * + * Input parameters: + * nothing + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + +LEAF(vapi_dumpgprs) + + .set noat + la k0,vapi_regsave + sd $0,REGIDX(0)(k0) + sd $1,REGIDX(1)(k0) + sd $2,REGIDX(2)(k0) + sd $3,REGIDX(3)(k0) + sd $4,REGIDX(4)(k0) + sd $5,REGIDX(5)(k0) + sd $6,REGIDX(6)(k0) + sd $7,REGIDX(7)(k0) + sd $8,REGIDX(8)(k0) + sd $9,REGIDX(9)(k0) + sd $10,REGIDX(10)(k0) + sd $11,REGIDX(11)(k0) + sd $12,REGIDX(12)(k0) + sd $13,REGIDX(13)(k0) + sd $14,REGIDX(14)(k0) + sd $15,REGIDX(15)(k0) + sd $16,REGIDX(16)(k0) + sd $17,REGIDX(17)(k0) + sd $18,REGIDX(18)(k0) + sd $19,REGIDX(19)(k0) + sd $20,REGIDX(20)(k0) + sd $21,REGIDX(21)(k0) + sd $22,REGIDX(22)(k0) + sd $23,REGIDX(23)(k0) + sd $24,REGIDX(24)(k0) + sd $25,REGIDX(25)(k0) + sd $26,REGIDX(26)(k0) /* k0 */ + sd $27,REGIDX(27)(k0) + sd $28,REGIDX(28)(k0) + sd $29,REGIDX(29)(k0) + sd $30,REGIDX(30)(k0) + sd $31,REGIDX(31)(k0) + .set at + +# Save some CP0 registers here. +#define LSAVECP0(cp0,idx) \ + dmfc0 t0,cp0 ; \ + sd t0,REGIDX(idx)(k0) + + LSAVECP0(C0_INX,32) + LSAVECP0(C0_RAND,33) + LSAVECP0(C0_TLBLO0,34) + LSAVECP0(C0_TLBLO1,35) + LSAVECP0(C0_CTEXT,36) + LSAVECP0(C0_PGMASK,37) + LSAVECP0(C0_WIRED,38) + LSAVECP0(C0_BADVADDR,39) + LSAVECP0(C0_COUNT,40) + LSAVECP0(C0_TLBHI,41) + LSAVECP0(C0_COMPARE,42) + LSAVECP0(C0_SR,43) + LSAVECP0(C0_CAUSE,44) + LSAVECP0(C0_EPC,45) + LSAVECP0(C0_PRID,46) + LSAVECP0(C0_CONFIG,47) + LSAVECP0(C0_LLADDR,48) + LSAVECP0(C0_WATCHLO,49) + LSAVECP0(C0_WATCHHI,50) + LSAVECP0(C0_XCTEXT,51) + LSAVECP0(C0_ECC,52) + LSAVECP0(C0_CACHEERR,53) + LSAVECP0(C0_TAGLO,54) + LSAVECP0(C0_TAGHI,55) + LSAVECP0(C0_ERREPC,56) + + + move a0,k0 /* pass addr of regs */ + la gp,_gp + LR sp,mem_heapstart + ADD sp,((CFG_HEAP_SIZE*1024)+STACK_SIZE - 8) + jal vapi_dodumpregs /* dump registers in 'C' */ + + .set noat + la k0,vapi_regsave + ld $1,REGIDX(1)(k0) + ld $2,REGIDX(2)(k0) + ld $3,REGIDX(3)(k0) + ld $4,REGIDX(4)(k0) + ld $5,REGIDX(5)(k0) + ld $6,REGIDX(6)(k0) + ld $7,REGIDX(7)(k0) + ld $8,REGIDX(8)(k0) + ld $9,REGIDX(9)(k0) + ld $10,REGIDX(10)(k0) + ld $11,REGIDX(11)(k0) + ld $12,REGIDX(12)(k0) + ld $13,REGIDX(13)(k0) + ld $14,REGIDX(14)(k0) + ld $15,REGIDX(15)(k0) + ld $16,REGIDX(16)(k0) + ld $17,REGIDX(17)(k0) + ld $18,REGIDX(18)(k0) + ld $19,REGIDX(19)(k0) + ld $20,REGIDX(20)(k0) + ld $21,REGIDX(21)(k0) + ld $22,REGIDX(22)(k0) + ld $23,REGIDX(23)(k0) + ld $24,REGIDX(24)(k0) + ld $25,REGIDX(25)(k0) + /*ld $26,REGIDX(26)(k0) don't restore k0 */ + ld $27,REGIDX(27)(k0) + ld $28,REGIDX(28)(k0) + ld $29,REGIDX(29)(k0) + ld $30,REGIDX(30)(k0) + ld $31,REGIDX(31)(k0) + .set at + + j ra + +END(vapi_dumpgprs) + + +/* ********************************************************************* + * VAPI_SETLOG(start,end) + * + * Set the address of the log buffer. This call is required + * before any data will be stored in the log. + * + * Input parameters: + * a0 - start of log buffer, 64-bit aligned + * a1 - end of log buffer, 64-bit aligned + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + +LEAF(vapi_setlog) + + SAVETEMPS(vapi_regsave) + + sd a0,vapi_logstart + sd a0,vapi_logptr + sd a1,vapi_logend + sd zero,vapi_logover + + RESTORETEMPS(vapi_regsave) + + j ra + +END(vapi_setlog) + +/* ********************************************************************* + * VAPI_LOGTRACE(id) + * + * Store a the contents of the trace buffer to the log + * + * Input parameters: + * a0 - low 32 bits are the ID code to store with the entry + * in the log. + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + +LEAF(vapi_logtrace) + + j ra + +END(vapi_logtrace) + + +/* ********************************************************************* + * VAPI_LOGSINGLE(id,value) + * + * Store a single value in the log. + * + * Input parameters: + * a0 - low 32 bits are the ID code to store with the entry + * in the log. + * a1 - value to store in the log + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + +LEAF(vapi_logsingle) + + + SAVETEMPS(vapi_regsave) + + CHECKPTR(99f) + + SETRECTYPE(VAPI_FMT_DATA,a0) + SETRECLEN_CONST(1) + + sd a1,VAPI_REC_DATA(RECPTR) + + add RECPTR,32 # one record + sd RECPTR,vapi_logptr + +99: RESTORETEMPS(vapi_regsave) + + j ra + +END(vapi_logsingle) + +/* ********************************************************************* + * VAPI_LOGDATA(id,addr,cnt) + * + * Store multiple values in the log + * + * Input parameters: + * a0 - low 32 bits are the ID code to store with the entry + * in the log. + * a1 - Address of values to store in the log + * a2 - number of 64-bit values to store in the log + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + +LEAF(vapi_logdata) + + SAVETEMPS(vapi_regsave) + + CHECKPTR(99f) + + SETRECTYPE(VAPI_FMT_BUFFER,a0) + + add t1,RECPTR,VAPI_REC_DATA # a1 = ptr to data ara + + sd a1,0(t1) + add t1,8 + + move k0,a2 # counter for words + +1: beq k0,zero,2f + ld t0,0(a1) + sd t0,0(t1) + add a1,8 + add t1,8 + sub k0,1 + b 1b + +2: add k0,a2,1 # total number of words + SETRECLEN_REG(k0) + sll k0,k0,3 # number of words we wrote + add k0,24 # size of header + add RECPTR,k0 + sd RECPTR,vapi_logptr + +99: RESTORETEMPS(vapi_regsave) + + j ra + +END(vapi_logdata) + + +/* ********************************************************************* + * VAPI_SAVESOC(id) + * + * Save the SOC registers in the log + * + * Input parameters: + * a0 - low 32 bits are the ID code to store with the entry + * in the log + * a1 - bitmask of SOC agents to save + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + +LEAF(vapi_savesoc) + + SAVETEMPS(vapi_regsave) + + CHECKPTR(99f) + + li t0,VAPI_CFESEAL | VAPI_FMT_SOC + dsll t0,t0,32 + or t0,a0 + mfc0 t1,C0_PRID + srl t1,t1,25 + and t1,t1,7 + sll t1,t1,VAPI_PRNUM_SHIFT + or t0,t0,t1 + ld t1,vapi_logptr + + sd t0,VAPI_REC_SIGNATURE(t1) + mfc0 t0,C0_COUNT + dsll t0,t0,32 + sd t0,VAPI_REC_SIZE(t1) + sd ra,VAPI_REC_RA(t1) + + move a2,zero # Counts how many we write + + la t2,vapi_socregs + +1: lw t0,0(t2) # get flags + beq t0,zero,2f + and t0,t0,a1 # test flags + beq t0,zero,3f # skip if no flags set + + lw t0,4(t2) # get address of register + + sd t0,VAPI_REC_DATA(t1) # store address of register + add t1,8 # next destination addr + add a2,1 # count the words written + + or t0,K1BASE # Make K1seg + ld t0,0(t0) # Read SOC register + + sd t0,VAPI_REC_DATA(t1) # Store in log + add t1,8 # next destination addr + add a2,1 # count the words written + +3: add t2,8 # next reg from table + + b 1b + +2: ld t0,vapi_logptr # get original pointer + ld a1,VAPI_REC_SIZE(t0) # Get C0_COUNT value + or a1,a2 # OR in the record size + sd a1,VAPI_REC_SIZE(t0) # put the record size back + + add t1,24 # Account for extra fields in record + sd t1,vapi_logptr # Update the pointer + +99: RESTORETEMPS(vapi_regsave) + + j ra + +END(vapi_savesoc) + +/* ********************************************************************* + * VAPI_LOGGPRS(id) + * + * Save the general purpose registers and certain CP0 values + * in the log. + * + * Input parameters: + * a0 - low 32 bits are the ID code to store with the entry + * in the log + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + +#define REGLOG(x) (VAPI_REC_DATA+REGIDX(x)) +#define MAXREGS 57 +#define REGLOGMAX REGLOG(MAXREGS) + +LEAF(vapi_loggprs) + + SAVETEMPS(vapi_regsave) + CHECKPTR(99f) + + .set noat + ld k0,vapi_logptr + sd $0,REGLOG(0)(k0) + sd $1,REGLOG(1)(k0) + sd $2,REGLOG(2)(k0) + sd $3,REGLOG(3)(k0) + sd $4,REGLOG(4)(k0) + sd $5,REGLOG(5)(k0) + sd $6,REGLOG(6)(k0) + sd $7,REGLOG(7)(k0) + sd $8,REGLOG(8)(k0) + sd $9,REGLOG(9)(k0) + sd $10,REGLOG(10)(k0) + sd $11,REGLOG(11)(k0) + sd $12,REGLOG(12)(k0) + sd $13,REGLOG(13)(k0) + sd $14,REGLOG(14)(k0) + sd $15,REGLOG(15)(k0) + sd $16,REGLOG(16)(k0) + sd $17,REGLOG(17)(k0) + sd $18,REGLOG(18)(k0) + sd $19,REGLOG(19)(k0) + sd $20,REGLOG(20)(k0) + sd $21,REGLOG(21)(k0) + sd $22,REGLOG(22)(k0) + sd $23,REGLOG(23)(k0) + sd $24,REGLOG(24)(k0) + sd $25,REGLOG(25)(k0) + sd $26,REGLOG(26)(k0) + sd $27,REGLOG(27)(k0) + sd $28,REGLOG(28)(k0) + sd $29,REGLOG(29)(k0) + sd $30,REGLOG(30)(k0) + sd $31,REGLOG(31)(k0) + .set at + + +# Save some CP0 registers here. +#define SAVECP0(cp0,idx) \ + dmfc0 t0,cp0 ; \ + sd t0,REGLOG(idx)(k0) + + SAVECP0(C0_INX,32) + SAVECP0(C0_RAND,33) + SAVECP0(C0_TLBLO0,34) + SAVECP0(C0_TLBLO1,35) + SAVECP0(C0_CTEXT,36) + SAVECP0(C0_PGMASK,37) + SAVECP0(C0_WIRED,38) + SAVECP0(C0_BADVADDR,39) + SAVECP0(C0_COUNT,40) + SAVECP0(C0_TLBHI,41) + SAVECP0(C0_COMPARE,42) + SAVECP0(C0_SR,43) + SAVECP0(C0_CAUSE,44) + SAVECP0(C0_EPC,45) + SAVECP0(C0_PRID,46) + SAVECP0(C0_CONFIG,47) + SAVECP0(C0_LLADDR,48) + SAVECP0(C0_WATCHLO,49) + SAVECP0(C0_WATCHHI,50) + SAVECP0(C0_XCTEXT,51) + SAVECP0(C0_ECC,52) + SAVECP0(C0_CACHEERR,53) + SAVECP0(C0_TAGLO,54) + SAVECP0(C0_TAGHI,55) + SAVECP0(C0_ERREPC,56) + + SETRECTYPE(VAPI_FMT_GPRS,a0) + SETRECLEN_CONST(MAXREGS) + add RECPTR,REGLOGMAX + sd RECPTR,vapi_logptr + +99: RESTORETEMPS(vapi_regsave) + + j ra # go home + +END(vapi_loggprs) + + +/* ********************************************************************* + * VAPI_LOGFPRS(id) + * + * Save the floating point unit's registers + * in the log. + * + * Input parameters: + * a0 - low 32 bits are the ID code to store with the entry + * in the log + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + + +#define SAVEFPR(cp1,idx) \ + dmfc1 t0,cp1 ; \ + sd t0,FPREGLOG(idx)(k0) +#define SAVECP1(cp1,idx) \ + cfc1 t0,cp1 ; \ + sd t0,FPREGLOG(idx)(k0) + +#define FPREGLOG(x) (VAPI_REC_DATA+REGIDX(x)) +#define FPMAXREGS 37 +#define FPREGLOGMAX FPREGLOG(FPMAXREGS) + +LEAF(vapi_logfprs) + + SAVETEMPS(vapi_regsave) + CHECKPTR(99f) + + ld k0,vapi_logptr + SAVEFPR($0,0) + SAVEFPR($1,1) + SAVEFPR($2,2) + SAVEFPR($3,3) + SAVEFPR($4,4) + SAVEFPR($5,5) + SAVEFPR($6,6) + SAVEFPR($7,7) + SAVEFPR($8,8) + SAVEFPR($9,9) + SAVEFPR($10,10) + SAVEFPR($11,11) + SAVEFPR($12,12) + SAVEFPR($13,13) + SAVEFPR($14,14) + SAVEFPR($15,15) + SAVEFPR($16,16) + SAVEFPR($17,17) + SAVEFPR($18,18) + SAVEFPR($19,19) + SAVEFPR($20,20) + SAVEFPR($21,21) + SAVEFPR($22,22) + SAVEFPR($23,23) + SAVEFPR($24,24) + SAVEFPR($25,25) + SAVEFPR($26,26) + SAVEFPR($27,27) + SAVEFPR($28,28) + SAVEFPR($29,29) + SAVEFPR($30,30) + SAVEFPR($31,31) + + SAVECP1($0,32) /* FIR */ + SAVECP1($31,33) /* Status */ + SAVECP1($25,34) /* condition codes */ + SAVECP1($26,35) /* Exceptions */ + SAVECP1($28,36) /* enables */ + + SETRECTYPE(VAPI_FMT_FPRS,a0) + SETRECLEN_CONST(FPMAXREGS) + add RECPTR,FPREGLOGMAX + sd RECPTR,vapi_logptr + +99: RESTORETEMPS(vapi_regsave) + + j ra # go home + +END(vapi_logfprs) + +/* ********************************************************************* + * VAPI_PUTS(string) + * + * Display a string on the console + * + * Input parameters: + * a0 - pointer to null-terminated string + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + +LEAF(vapi_puts) + + .set noat + la k0,vapi_regsave + sd $0,REGIDX(0)(k0) + sd $1,REGIDX(1)(k0) + sd $2,REGIDX(2)(k0) + sd $3,REGIDX(3)(k0) + sd $4,REGIDX(4)(k0) + sd $5,REGIDX(5)(k0) + sd $6,REGIDX(6)(k0) + sd $7,REGIDX(7)(k0) + sd $8,REGIDX(8)(k0) + sd $9,REGIDX(9)(k0) + sd $10,REGIDX(10)(k0) + sd $11,REGIDX(11)(k0) + sd $12,REGIDX(12)(k0) + sd $13,REGIDX(13)(k0) + sd $14,REGIDX(14)(k0) + sd $15,REGIDX(15)(k0) + sd $16,REGIDX(16)(k0) + sd $17,REGIDX(17)(k0) + sd $18,REGIDX(18)(k0) + sd $19,REGIDX(19)(k0) + sd $20,REGIDX(20)(k0) + sd $21,REGIDX(21)(k0) + sd $22,REGIDX(22)(k0) + sd $23,REGIDX(23)(k0) + sd $24,REGIDX(24)(k0) + sd $25,REGIDX(25)(k0) + sd $26,REGIDX(26)(k0) /* k0 */ + sd $27,REGIDX(27)(k0) + sd $28,REGIDX(28)(k0) + sd $29,REGIDX(29)(k0) + sd $30,REGIDX(30)(k0) + sd $31,REGIDX(31)(k0) + .set at + + la gp,_gp + LR sp,mem_heapstart + ADD sp,((CFG_HEAP_SIZE*1024)+STACK_SIZE - 8) + jal vapi_doputs /* dump registers in 'C' */ + + .set noat + la k0,vapi_regsave + ld $1,REGIDX(1)(k0) + ld $2,REGIDX(2)(k0) + ld $3,REGIDX(3)(k0) + ld $4,REGIDX(4)(k0) + ld $5,REGIDX(5)(k0) + ld $6,REGIDX(6)(k0) + ld $7,REGIDX(7)(k0) + ld $8,REGIDX(8)(k0) + ld $9,REGIDX(9)(k0) + ld $10,REGIDX(10)(k0) + ld $11,REGIDX(11)(k0) + ld $12,REGIDX(12)(k0) + ld $13,REGIDX(13)(k0) + ld $14,REGIDX(14)(k0) + ld $15,REGIDX(15)(k0) + ld $16,REGIDX(16)(k0) + ld $17,REGIDX(17)(k0) + ld $18,REGIDX(18)(k0) + ld $19,REGIDX(19)(k0) + ld $20,REGIDX(20)(k0) + ld $21,REGIDX(21)(k0) + ld $22,REGIDX(22)(k0) + ld $23,REGIDX(23)(k0) + ld $24,REGIDX(24)(k0) + ld $25,REGIDX(25)(k0) + /*ld $26,REGIDX(26)(k0) don't restore k0 */ + ld $27,REGIDX(27)(k0) + ld $28,REGIDX(28)(k0) + ld $29,REGIDX(29)(k0) + ld $30,REGIDX(30)(k0) + ld $31,REGIDX(31)(k0) + .set at + + j ra + +END(vapi_puts) + +/* ********************************************************************* + * VAPI_SETLEDS(leds) + * + * Set the onboard LEDS on the swarm board. + * + * Input parameters: + * a0 - LED value, "ABCD" is 0x41424344 + * + * Return value: + * nothing + * + * Registers used: + * k0 - scratch register for CFE + ********************************************************************* */ + + +LEAF(vapi_setleds) + + SAVETEMPS(vapi_regsave) + + jal board_setleds + + RESTORETEMPS(vapi_regsave) + + j ra + +END(vapi_setleds) + +/* ********************************************************************* + * VAPI_KSEG1_SWITCH + * + * Hack the return address so we will come back in KSEG1 (uncached) + * + * Input parameters: + * nothing + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(vapi_kseg1_switch) + + and ra,(K0SIZE-1) + or ra,K1BASE + jr ra + +END(vapi_kseg1_switch) + + +/* ********************************************************************* + * VAPI_RUN() + * + * Jump to the diagnostic program, which must be loaded at the + * special address (typically 8002_0000). First we flush the + * cache, then set magic #'s in the mailbox. Finally, the core + * is reset. On restart, we do minimal initialization and jump + * directly to the diagnostic. + * + * Input parameters: + * a0 - nonzero to restart uncached. + * + * Return value: + * nothing + ********************************************************************* */ + +LEAF(vapi_run) + + /* + * Run uncached + */ + + bal vapi_kseg1_switch # now running in KSEG1 + + /* + * Flush the caches + */ + + move s0,a0 # L2 flush trashes A0 + CALLKSEG1(sb1250_l1cache_flush_d) + CALLKSEG1(sb1250_l1cache_inval_i) + CALLKSEG1(sb1250_l2cache_flush) + move a0,s0 + +#ifdef _P5064_ + + /* In the case of the P5064, just jump directly to the entry point */ + + li t0,VAPI_DIAG_ENTRY + j t0 + +#else + + /* + * Set the magic code in the mailbox. + */ + + li t0,-1 + la t1,PHYS_TO_K1(A_IMR_REGISTER(0,R_IMR_MAILBOX_CLR_CPU)) + sd t0,0(t1) + + dli t0,VAPI_MAGIC_NUMBER + beq a0,0,1f + dli t0,VAPI_MAGIC_NUMBER_UNC + beq a0,1,1f + dli t0,VAPI_MAGIC_NUMBER_MC +1: la t1,PHYS_TO_K1(A_IMR_REGISTER(0,R_IMR_MAILBOX_SET_CPU)) + sd t0,0(t1) + + /* + * Whack the reset line. + */ +#if defined(_PTSWARM_) + li k0,PHYS_TO_K1(0x1B0A0000+32+8*3) +#else + li k0,PHYS_TO_K1(0x100A0000+32+8*3) +#endif + li k1,'!' + + li t1,PHYS_TO_K1(A_SCD_SYSTEM_CFG) + ld t2,0(t1) + dli t0,M_SYS_CPU_RESET_0 | M_SYS_CPU_RESET_1 + or t2,t2,t0 + bal vapi_kseg0_switch + .align 5 +#if defined(_CSWARM_) || defined(_SWARM_) || defined(_PTSWARM_) + sb k1,0(k0) +#else + nop +#endif + sync /* flush the write buffer */ + sd t2,0(t1) +1: b 1b + + /* + * And he never returned, no he never returned... and his fate + * is still unknown, he will ride forever 'neath the cycles of + * the SB1, he's the core that never returned! + */ +#endif + + + +END(vapi_run) + + +LEAF(vapi_flushtest) + + move s1,ra + + /* + * Run uncached + */ + + bal vapi_kseg1_switch # now running in KSEG1 + + /* + * Flush the caches + */ + + move s0,a0 # L2 flush trashes A0 + CALLKSEG1(sb1250_l1cache_flush_d) + CALLKSEG1(sb1250_l1cache_inval_i) + CALLKSEG1(sb1250_l2cache_flush) + move a0,s0 + + /* + * Back to cached + */ + + bal vapi_kseg0_switch # now running in KSEG1 + + move ra,s1 + j ra + +END(vapi_flushtest) + + +#endif /* CFG_VAPI */ + +/* ********************************************************************* + * End + ********************************************************************* */ + + diff --git a/cfe/cfe/verif/vapi.h b/cfe/cfe/verif/vapi.h new file mode 100644 index 0000000..1deb8a5 --- /dev/null +++ b/cfe/cfe/verif/vapi.h @@ -0,0 +1,242 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Verification Test APIs File: vapi.h + * + * This module contains special low-level routines for use + * by verification programs. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#define VAPI_EPTSEAL 0x56415049 +#define VAPI_CFESEAL 0xCFE10000 +#define VAPI_SEAL_MASK 0xFFFF0000 +#define VAPI_FMT_MASK 0x000000FF +#define VAPI_PRID_MASK 0x0000FF00 + +#define VAPI_DIAG_ENTRY 0x80020000 +#define VAPI_DIAG_ENTRY_UNC 0xA0020000 +#define VAPI_DIAG_ENTRY_MC 0xBFD00000 +#define VAPI_MAGIC_NUMBER 0x1CFE2CFE3CFE4CFE +#define VAPI_MAGIC_NUMBER_UNC 0x0CFE1CFE2CFE3CFE +#define VAPI_MAGIC_NUMBER_MC 0xACFEBCFECCFEDCFE + +#define VAPI_FMT_GPRS 0 +#define VAPI_FMT_SOC 1 +#define VAPI_FMT_DATA 2 +#define VAPI_FMT_BUFFER 3 +#define VAPI_FMT_TRACE 4 +#define VAPI_FMT_EXIT 5 +#define VAPI_FMT_FPRS 6 + +#define VAPI_PRNUM_SHIFT 8 + +#define VAPI_REC_SIGNATURE 0 +#define VAPI_REC_SIZE 8 +#define VAPI_REC_RA 16 +#define VAPI_REC_DATA 24 + +#define VAPI_IDX_SIGNATURE 0 +#define VAPI_IDX_SIZE 1 +#define VAPI_IDX_RA 2 +#define VAPI_IDX_DATA 3 + + +#define VAPI_FUNC_EXIT 0x9fc00510 +#define VAPI_FUNC_DUMPGPRS 0x9fc00520 +#define VAPI_FUNC_SETLOG 0x9fc00530 +#define VAPI_FUNC_LOGVALUE 0x9fc00540 +#define VAPI_FUNC_LOGDATA 0x9fc00550 +#define VAPI_FUNC_LOGTRACE 0x9fc00560 +#define VAPI_FUNC_LOGSOC 0x9fc00570 +#define VAPI_FUNC_LOGGPRS 0x9fc00580 +#define VAPI_FUNC_DUMPSTRING 0x9fc00590 +#define VAPI_FUNC_SETLEDS 0x9fc005a0 +#define VAPI_FUNC_LOGFPRS 0x9fc005b0 + + +#define VAPI_LOG_SETBUF(start,end) \ + .set push ; \ + .set reorder ; \ + la a0, start ; \ + la a1, end ; \ + li k0, VAPI_FUNC_SETLOG ; \ + jalr k0 ; \ + .set pop + +#define VAPI_EXIT_CONST(val) \ + .set push ; \ + .set reorder ; \ + li a0, val ; \ + li k0, VAPI_FUNC_EXIT ; \ + jr k0 ; \ + .set pop + +#define VAPI_EXIT_REG(val) \ + .set push ; \ + .set reorder ; \ + move a0, val ; \ + li k0, VAPI_FUNC_EXIT ; \ + jr k0 ; \ + .set pop + +#define VAPI_LOG_CONST(id,value) \ + .set push ; \ + .set reorder ; \ + li a0, id ; \ + li a1, value ; \ + li k0, VAPI_FUNC_LOGVALUE ; \ + jalr k0 ; \ + .set pop + +#define VAPI_LOG_REG(id,value) \ + .set push ; \ + .set reorder ; \ + li a0, id ; \ + move a1, value ; \ + li k0, VAPI_FUNC_LOGVALUE ; \ + jalr k0 ; \ + .set pop + +#define VAPI_LOG_BUFFER(id,addr,nwords) \ + .set push ; \ + .set reorder ; \ + li a0,id ; \ + la a1,addr ; \ + li a2,nwords ; \ + li k0, VAPI_FUNC_LOGDATA ; \ + jalr k0 ; \ + .set pop + +#define VAPI_PUTS(text) \ + .set push ; \ + .set reorder ; \ + b 1f ; \ +2: .asciz text ; \ + .align 4 ; \ +1: la a0, 2b ; \ + li k0, VAPI_FUNC_DUMPSTRING ; \ + jalr k0 ; \ + .set pop + +#define VAPI_PRINTGPRS() \ + .set push ; \ + .set reorder ; \ + li k0, VAPI_FUNC_DUMPGPRS ; \ + jalr k0 ; \ + .set pop + +#define VAPI_LOG_GPRS(id) \ + .set push ; \ + .set reorder ; \ + li a0, id ; \ + li k0, VAPI_FUNC_LOGGPRS ; \ + jalr k0 ; \ + .set pop + +#define VAPI_LOG_FPRS(id) \ + .set push ; \ + .set reorder ; \ + li a0, id ; \ + li k0, VAPI_FUNC_LOGFPRS ; \ + jalr k0 ; \ + .set pop + +#define VAPI_LOG_TRACE(id) \ + .set push ; \ + .set reorder ; \ + li a0, id ; \ + li k0, VAPI_FUNC_LOGTRACE ; \ + jalr k0 ; \ + .set pop + +#define VAPI_LOG_SOCSTATE(id,bits) \ + .set push ; \ + .set reorder ; \ + li a0, id ; \ + li a1, bits ; \ + li k0, VAPI_FUNC_LOGSOC ; \ + jalr k0 ; \ + .set pop + +#define VAPI_SETLEDS(a,b,c,d) \ + .set push ; \ + .set reorder ; \ + li a0, ((a) << 24) | ((b) << 16) | ((c) << 8) | (d) ; \ + li k0, VAPI_FUNC_SETLEDS ; \ + jalr k0 ; \ + .set pop + +#ifndef SOC_AGENT_MC0 +#define SOC_AGENT_MC0 0x00000001 +#define SOC_AGENT_MC1 0x00000002 +#define SOC_AGENT_MC 0x00000003 +#define SOC_AGENT_L2 0x00000004 +#define SOC_AGENT_MACDMA0 0x00000008 +#define SOC_AGENT_MACDMA1 0x00000010 +#define SOC_AGENT_MACDMA2 0x00000020 +#define SOC_AGENT_MACDMA 0x00000038 +#define SOC_AGENT_MACRMON0 0x00000040 +#define SOC_AGENT_MACRMON1 0x00000080 +#define SOC_AGENT_MACRMON2 0x00000100 +#define SOC_AGENT_MACRMON 0x000001C0 +#define SOC_AGENT_MAC0 0x00000200 +#define SOC_AGENT_MAC1 0x00000400 +#define SOC_AGENT_MAC2 0x00000800 +#define SOC_AGENT_MAC 0x00000E00 +#define SOC_AGENT_DUART 0x00001000 +#define SOC_AGENT_GENCS 0x00002000 +#define SOC_AGENT_GEN 0x00004000 +#define SOC_AGENT_GPIO 0x00008000 +#define SOC_AGENT_SMBUS0 0x00010000 +#define SOC_AGENT_SMBUS1 0x00020000 +#define SOC_AGENT_SMBUS 0x00030000 +#define SOC_AGENT_TIMER 0x00040000 +#define SOC_AGENT_SCD 0x00080000 +#define SOC_AGENT_BUSERR 0x00100000 +#define SOC_AGENT_DM 0x00200000 +#define SOC_AGENT_IMR0 0x00400000 +#define SOC_AGENT_IMR1 0x00800000 +#define SOC_AGENT_IMR 0x00C00000 +#endif + + + diff --git a/cfe/cfe/verif/vapisubr.c b/cfe/cfe/verif/vapisubr.c new file mode 100644 index 0000000..1ec130a --- /dev/null +++ b/cfe/cfe/verif/vapisubr.c @@ -0,0 +1,122 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Verification Test APIs File: vapisubr.c + * + * This module contains special low-level routines for use + * by verification programs. The routines here are the "C" + * routines for higher-level functions. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "bsp_config.h" +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_console.h" + +#if CFG_VAPI + +void vapi_doputs(char *str); +void vapi_dodumpregs(uint64_t *gprs); + +const static char * const gpregnames[] = { + "$0/zero","$1/AT","$2/v0","$3/v1","$4/a0","$5/a1","$6/a2","$7/a3", + "$8/t0","$9/t1","$10/t2","$11/t3","$12/t4","$13/t5","$14/t6","$15/t7", + "$16/s0","$17/s1","$18/s2","$19/s3","$20/s4","$21/s5","$22/s6","$23/s7", + "$24/t8","$25/t9","$26/k0","$27/k1","$28/gp","$29/sp","$30/fp","$31/ra", + "INX", + "RAND", + "TLBLO0", + "TLBLO1", + "CTEXT", + "PGMASK", + "WIRED", + "BADVADDR", + "COUNT", + "TLBHI", + "COMPARE", + "SR", + "CAUSE", + "EPC", + "PRID", + "CONFIG", + "LLADDR", + "WATCHLO", + "WATCHHI", + "XCTEXT", + "ECC", + "CACHEERR", + "TAGLO", + "TAGHI", + "ERREPC"}; + + + + +void vapi_doputs(char *str) +{ + xprintf("# %s\n",str); +} + +void vapi_dodumpregs(uint64_t *gprs) +{ + int cnt = sizeof(gpregnames)/sizeof(char *); + int idx; + + xprintf("# GPRS:\n"); + for (idx = 0; idx < cnt; idx++) { + if ((idx & 1) == 0) xprintf("# "); + xprintf(" %8s=%016llX ",gpregnames[idx],gprs[idx]); + if ((idx & 1) == 1) xprintf("\n"); + } + xprintf("\n"); + +} + +#endif /* CFG_VAPI */ + +/* ********************************************************************* + * End + ********************************************************************* */ + + diff --git a/cfe/cfe/verif/vapitest.S b/cfe/cfe/verif/vapitest.S new file mode 100644 index 0000000..4199f4e --- /dev/null +++ b/cfe/cfe/verif/vapitest.S @@ -0,0 +1,108 @@ +/* ********************************************************************* + * Broadcom Common Firmware Environment (CFE) + * + * Verification Test APIs File: vapitest.S + * + * This module contains special low-level routines for use + * by verification programs. + * + * Author: Mitch Lichtenberg (mpl@broadcom.com) + * + ********************************************************************* + * + * Copyright 2000,2001,2002,2003 + * Broadcom Corporation. All rights reserved. + * + * This software is furnished under license and may be used and + * copied only in accordance with the following terms and + * conditions. Subject to these conditions, you may download, + * copy, install, use, modify and distribute modified or unmodified + * copies of this software in source and/or binary form. No title + * or ownership is transferred hereby. + * + * 1) Any source code used, modified or distributed must reproduce + * and retain this copyright notice and list of conditions + * as they appear in the source file. + * + * 2) No right is granted to use any trade name, trademark, or + * logo of Broadcom Corporation. The "Broadcom Corporation" + * name may not be used to endorse or promote products derived + * from this software without the prior written permission of + * Broadcom Corporation. + * + * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT + * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN + * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************* */ + + +#include "sbmips.h" +#include "bsp_config.h" + +#if CFG_VAPI + +#if (CFG_EMBEDDED_PIC) +#error "CFG_VAPI is not compatible with relocatable code" +#endif + + +#include "vapi.h" + +/* ********************************************************************* + * Constants + ********************************************************************* */ + .text + +testbuf: .dword 0x123456789ABCDEF0 + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xAABBCCDD + .dword 0xFEDCBA9876543210 + +LEAF(vapitest) + + sub sp,8 + sd ra,0(sp) + + VAPI_LOG_SETBUF(0x80200000,0x80300000) + + + VAPI_LOG_CONST(0x100,0xABCDEF) + VAPI_LOG_REG(0x101,sp) + VAPI_LOG_BUFFER(0x102,testbuf,10) + VAPI_PUTS("Hello world.\n") + VAPI_LOG_SOCSTATE(0x103,SOC_AGENT_DUART) + VAPI_PRINTGPRS(); + VAPI_LOG_CONST(0x1EE,0xEEEEEEEE) + VAPI_LOG_GPRS(0x199) + VAPI_SETLEDS('V','A','P','I') + + ld ra,0(sp) + add sp,8 + j ra + +END(vapitest) + + +#endif /* CFG_VAPI */ + +/* ********************************************************************* + * End + ********************************************************************* */ + + diff --git a/cfe/cfe/x86emu/LICENSE b/cfe/cfe/x86emu/LICENSE new file mode 100644 index 0000000..a3ede4a --- /dev/null +++ b/cfe/cfe/x86emu/LICENSE @@ -0,0 +1,17 @@ + License information + ------------------- + +The x86emu library is under a BSD style license, comaptible +with the XFree86 and X licenses used by XFree86. The +original x86emu libraries were under the GNU General Public +License. Due to license incompatibilities between the GPL +and the XFree86 license, the original authors of the code +decided to allow a license change. If you have submitted +code to the original x86emu project, and you don't agree +with the license change, please contact us and let you +know. Your code will be removed to comply with your wishes. + +If you have any questions about this, please send email to +x86emu@linuxlabs.com or KendallB@scitechsoft.com for +clarification. + diff --git a/cfe/cfe/x86emu/Makefile b/cfe/cfe/x86emu/Makefile new file mode 100644 index 0000000..6b02c1a --- /dev/null +++ b/cfe/cfe/x86emu/Makefile @@ -0,0 +1,2 @@ + +ALLOBJS += debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o diff --git a/cfe/cfe/x86emu/README b/cfe/cfe/x86emu/README new file mode 100644 index 0000000..c7351ba --- /dev/null +++ b/cfe/cfe/x86emu/README @@ -0,0 +1,12 @@ + +This is a simple X86 emulator. The original source for this +was taken from the XFree86 project. This code is used to +interpret the X86 instructions in the ROM on the VGA +adapter to initialize the card to text mode. Once initialized, +this emulator is no longer needed. + +** Read the 'LICENSE' file before using this in production code ** + +The XFree86 license is similar to the BSD license. + + diff --git a/cfe/cfe/x86emu/debug.c b/cfe/cfe/x86emu/debug.c new file mode 100644 index 0000000..3e26a50 --- /dev/null +++ b/cfe/cfe/x86emu/debug.c @@ -0,0 +1,462 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: This file contains the code to handle debugging of the +* emulator. +* +****************************************************************************/ +/* $XFree86: xc/extras/x86emu/src/x86emu/debug.c,v 1.4 2000/04/17 16:29:45 eich Exp $ */ + +#include "x86emu/x86emui.h" +#ifdef IN_MODULE +#include "xf86_ansic.h" +#else +#include +#ifndef _CFE_ +#include +#endif +#endif + +#ifdef _CFE_ +#include "cfe_console.h" +#endif + + +/*----------------------------- Implementation ----------------------------*/ + +#ifdef DEBUG + +static void print_encoded_bytes (u16 s, u16 o); +static void print_decoded_instruction (void); +static int parse_line (char *s, int *ps, int *n); + +/* should look something like debug's output. */ +void X86EMU_trace_regs (void) +{ + if (DEBUG_TRACE()) { + x86emu_dump_regs(); + } + if (DEBUG_DECODE() && ! DEBUG_DECODE_NOPRINT()) { + printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip); + print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip); + print_decoded_instruction(); + } +} + +void X86EMU_trace_xregs (void) +{ + if (DEBUG_TRACE()) { + x86emu_dump_xregs(); + } +} + +void x86emu_just_disassemble (void) +{ + /* + * This routine called if the flag DEBUG_DISASSEMBLE is set kind + * of a hack! + */ + printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip); + print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip); + print_decoded_instruction(); +} + +static u16 disassemble_forward (u16 seg, u16 off, int n) +{ + X86EMU_sysEnv tregs; + int i; + u8 op1; + u16 finaloffset; + /* + * hack, hack, hack. What we do is use the exact machinery set up + * for execution, except that now there is an additional state + * flag associated with the "execution", and we are using a copy + * of the register struct. All the major opcodes, once fully + * decoded, have the following two steps: TRACE_REGS(r,m); + * SINGLE_STEP(r,m); which disappear if DEBUG is not defined to + * the preprocessor. The TRACE_REGS macro expands to: + * + * if (debug&DEBUG_DISASSEMBLE) + * {just_disassemble(); goto EndOfInstruction;} + * if (debug&DEBUG_TRACE) trace_regs(r,m); + * + * ...... and at the last line of the routine. + * + * EndOfInstruction: end_instr(); + * + * Up to the point where TRACE_REG is expanded, NO modifications + * are done to any register EXCEPT the IP register, for fetch and + * decoding purposes. + * + * This was done for an entirely different reason, but makes a + * nice way to get the system to help debug codes. + */ + tregs = M; + M.x86.R_IP = off; + M.x86.R_CS = seg; + M.x86.saved_ip = off; + M.x86.saved_cs = seg; + + /* reset the decoding buffers */ + M.x86.enc_str_pos = 0; + M.x86.enc_pos = 0; + + /* turn on the "disassemble only, no execute" flag */ + M.x86.debug |= DEBUG_DISASSEMBLE_F; + + /* DUMP NEXT n instructions to screen in straight_line fashion */ + /* + * This looks like the regular instruction fetch stream, except + * that when this occurs, each fetched opcode, upon seeing the + * DEBUG_DISASSEMBLE flag set, exits immediately after decoding + * the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!! + * Note the use of a copy of the register structure... + */ + for (i=0; i 256) return; + seg = fetch_data_word_abs(0,iv*4); + off = fetch_data_word_abs(0,iv*4+2); + printk("%04x:%04x ", seg, off); +} + +void X86EMU_dump_memory (u16 seg, u16 off, u32 amt) +{ + u32 start = off & 0xfffffff0; + u32 end = (off+16) & 0xfffffff0; + u32 i; + u32 current; + + current = start; + while (end <= off + amt) { + printk("%04x:%04x ", seg, start); + for (i=start; i< off; i++) + printk(" "); + for ( ; i< end; i++) + printk("%02x ", fetch_data_byte_abs(seg,i)); + printk("\n"); + start = end; + end = start + 16; + } +} + +void x86emu_single_step (void) +{ + char s[1024]; + int ps[10]; + int ntok; + int cmd; + int done; + int segment; + int offset; + static int breakpoint; + static int noDecode = 1; + + char *p; + + if (DEBUG_BREAK()) { + if (M.x86.saved_ip != breakpoint) { + return; + } + else { + M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F; + M.x86.debug |= DEBUG_TRACE_F; + M.x86.debug &= ~DEBUG_BREAK_F; + print_decoded_instruction (); + X86EMU_trace_regs(); + } + } + done=0; + offset = M.x86.saved_ip; + while (!done) { +#ifdef _CFE_ + cmd = console_readline("-",s,1023); + if (cmd) { s[cmd] = '\n'; s[cmd+1] = 0;} + p = s; +#else + printk("-"); + p = fgets(s, 1023, stdin); +#endif + cmd = parse_line(s, ps, &ntok); + switch(cmd) { + case 'u': + if (ntok == 2) { offset = ps[1]; } + offset = disassemble_forward(M.x86.saved_cs,(u16)offset,10); + break; + case 'd': + if (ntok == 2) { + segment = M.x86.saved_cs; + offset = ps[1]; + X86EMU_dump_memory(segment,(u16)offset,16); + offset += 16; + } else if (ntok == 3) { + segment = ps[1]; + offset = ps[2]; + X86EMU_dump_memory(segment,(u16)offset,16); + offset += 16; + } else { + segment = M.x86.saved_cs; + X86EMU_dump_memory(segment,(u16)offset,16); + offset += 16; + } + break; + case 'c': + M.x86.debug ^= DEBUG_TRACECALL_F; + break; + case 's': + M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F; + break; + case 'r': + X86EMU_trace_regs(); + break; + case 'x': + X86EMU_trace_xregs(); + break; + case 'g': + if (ntok == 2) { + breakpoint = ps[1]; + if (noDecode) { + M.x86.debug |= DEBUG_DECODE_NOPRINT_F; + } else { + M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F; + } + M.x86.debug &= ~DEBUG_TRACE_F; + M.x86.debug |= DEBUG_BREAK_F; + done = 1; + } + break; + case 'q': + M.x86.debug &= ~DEBUG_TRACE_F; + M.x86.debug &= ~DEBUG_BREAK_F; + M.x86.debug &= ~DEBUG_STEP_F; + M.x86.debug &= ~DEBUG_DECODE_F; + done = 1; + break; + case 'P': + noDecode = (noDecode)?0:1; + printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE"); + break; + case 't': + case 0: + done = 1; + break; + } + } +} + +int X86EMU_trace_on(void) +{ + return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F; +} + +int X86EMU_trace_off(void) +{ + return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F); +} + +static int parse_line (char *s, int *ps, int *n) +{ + int cmd; + + *n = 0; + while(*s == ' ' || *s == '\t') s++; + ps[*n] = *s; + switch (*s) { + case '\n': + *n += 1; + return 0; + default: + cmd = *s; + *n += 1; + } + + while (1) { + while (*s != ' ' && *s != '\t' && *s != '\n') s++; + + if (*s == '\n') + return cmd; + + while(*s == ' ' || *s == '\t') s++; +#ifdef _CFE_ + ps[*n] = xtoi(s); +#else + sscanf(s,"%x",&ps[*n]); +#endif + *n += 1; + } +} + +#endif /* DEBUG */ + +void x86emu_dump_regs (void) +{ + printk("\tAX=%04x ", M.x86.R_AX ); + printk("BX=%04x ", M.x86.R_BX ); + printk("CX=%04x ", M.x86.R_CX ); + printk("DX=%04x ", M.x86.R_DX ); + printk("SP=%04x ", M.x86.R_SP ); + printk("BP=%04x ", M.x86.R_BP ); + printk("SI=%04x ", M.x86.R_SI ); + printk("DI=%04x\n", M.x86.R_DI ); + printk("\tDS=%04x ", M.x86.R_DS ); + printk("ES=%04x ", M.x86.R_ES ); + printk("SS=%04x ", M.x86.R_SS ); + printk("CS=%04x ", M.x86.R_CS ); + printk("IP=%04x ", M.x86.R_IP ); + if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */ + else printk("NV "); + if (ACCESS_FLAG(F_DF)) printk("DN "); + else printk("UP "); + if (ACCESS_FLAG(F_IF)) printk("EI "); + else printk("DI "); + if (ACCESS_FLAG(F_SF)) printk("NG "); + else printk("PL "); + if (ACCESS_FLAG(F_ZF)) printk("ZR "); + else printk("NZ "); + if (ACCESS_FLAG(F_AF)) printk("AC "); + else printk("NA "); + if (ACCESS_FLAG(F_PF)) printk("PE "); + else printk("PO "); + if (ACCESS_FLAG(F_CF)) printk("CY "); + else printk("NC "); + printk("\n"); +} + +void x86emu_dump_xregs (void) +{ + printk("\tEAX=%08x ", M.x86.R_EAX ); + printk("EBX=%08x ", M.x86.R_EBX ); + printk("ECX=%08x ", M.x86.R_ECX ); + printk("EDX=%08x \n", M.x86.R_EDX ); + printk("\tESP=%08x ", M.x86.R_ESP ); + printk("EBP=%08x ", M.x86.R_EBP ); + printk("ESI=%08x ", M.x86.R_ESI ); + printk("EDI=%08x\n", M.x86.R_EDI ); + printk("\tDS=%04x ", M.x86.R_DS ); + printk("ES=%04x ", M.x86.R_ES ); + printk("SS=%04x ", M.x86.R_SS ); + printk("CS=%04x ", M.x86.R_CS ); + printk("EIP=%08x\n\t", M.x86.R_EIP ); + if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */ + else printk("NV "); + if (ACCESS_FLAG(F_DF)) printk("DN "); + else printk("UP "); + if (ACCESS_FLAG(F_IF)) printk("EI "); + else printk("DI "); + if (ACCESS_FLAG(F_SF)) printk("NG "); + else printk("PL "); + if (ACCESS_FLAG(F_ZF)) printk("ZR "); + else printk("NZ "); + if (ACCESS_FLAG(F_AF)) printk("AC "); + else printk("NA "); + if (ACCESS_FLAG(F_PF)) printk("PE "); + else printk("PO "); + if (ACCESS_FLAG(F_CF)) printk("CY "); + else printk("NC "); + printk("\n"); +} diff --git a/cfe/cfe/x86emu/decode.c b/cfe/cfe/x86emu/decode.c new file mode 100644 index 0000000..10082eb --- /dev/null +++ b/cfe/cfe/x86emu/decode.c @@ -0,0 +1,1000 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: This file includes subroutines which are related to +* instruction decoding and accessess of immediate data via IP. etc. +* +****************************************************************************/ + +/* $XFree86: xc/extras/x86emu/src/x86emu/decode.c,v 1.8 2000/12/13 03:19:34 tsi Exp $ */ + +#include "x86emu/x86emui.h" +#include "cfe_console.h" + +/*----------------------------- Implementation ----------------------------*/ + +/**************************************************************************** +REMARKS: +Handles any pending asychronous interrupts. +****************************************************************************/ +static void x86emu_intr_handle(void) +{ + u8 intno; + + if (M.x86.intr & INTR_SYNCH) { + intno = M.x86.intno; + if (_X86EMU_intrTab[intno]) { + (*_X86EMU_intrTab[intno])(intno); + } else { + push_word((u16)M.x86.R_FLG); + CLEAR_FLAG(F_IF); + CLEAR_FLAG(F_TF); + push_word(M.x86.R_CS); + M.x86.R_CS = mem_access_word(intno * 4 + 2); + push_word(M.x86.R_IP); + M.x86.R_IP = mem_access_word(intno * 4); + M.x86.intr = 0; + } + } +} + +/**************************************************************************** +PARAMETERS: +intrnum - Interrupt number to raise + +REMARKS: +Raise the specified interrupt to be handled before the execution of the +next instruction. +****************************************************************************/ +void x86emu_intr_raise( + u8 intrnum) +{ + M.x86.intno = intrnum; + M.x86.intr |= INTR_SYNCH; +} + +#ifdef DEBUG +extern u8 inb(u32); +#endif + +/**************************************************************************** +REMARKS: +Main execution loop for the emulator. We return from here when the system +halts, which is normally caused by a stack fault when we return from the +original real mode call. +****************************************************************************/ +void X86EMU_exec(void) +{ + u8 op1; + + M.x86.intr = 0; + DB(x86emu_end_instr();) + + for (;;) { +DB( if (CHECK_IP_FETCH()) + x86emu_check_ip_access();) + /* If debugging, save the IP and CS values. */ + SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP); + INC_DECODED_INST_LEN(1); + if (M.x86.intr) { + if (M.x86.intr & INTR_HALTED) { +DB( printk("halted\n"); + X86EMU_trace_regs();) + return; + } + if (((M.x86.intr & INTR_SYNCH) && (M.x86.intno == 0 || M.x86.intno == 2)) || + !ACCESS_FLAG(F_IF)) { + x86emu_intr_handle(); + } + } +#ifdef DEBUG + if (inb(0x3f8 + 5) & 1) { + M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F; + } +#endif + op1 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++)); + (*x86emu_optab[op1])(op1); + } +} + +/**************************************************************************** +REMARKS: +Halts the system by setting the halted system flag. +****************************************************************************/ +void X86EMU_halt_sys(void) +{ + M.x86.intr |= INTR_HALTED; +} + +/**************************************************************************** +PARAMETERS: +mod - Mod value from decoded byte +regh - Reg h value from decoded byte +regl - Reg l value from decoded byte + +REMARKS: +Raise the specified interrupt to be handled before the execution of the +next instruction. + +NOTE: Do not inline this function, as (*sys_rdb) is already inline! +****************************************************************************/ +void fetch_decode_modrm( + int *mod, + int *regh, + int *regl) +{ + int fetched; + +DB( if (CHECK_IP_FETCH()) + x86emu_check_ip_access();) + fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++)); + INC_DECODED_INST_LEN(1); + *mod = (fetched >> 6) & 0x03; + *regh = (fetched >> 3) & 0x07; + *regl = (fetched >> 0) & 0x07; +} + +/**************************************************************************** +RETURNS: +Immediate byte value read from instruction queue + +REMARKS: +This function returns the immediate byte from the instruction queue, and +moves the instruction pointer to the next value. + +NOTE: Do not inline this function, as (*sys_rdb) is already inline! +****************************************************************************/ +u8 fetch_byte_imm(void) +{ + u8 fetched; + +DB( if (CHECK_IP_FETCH()) + x86emu_check_ip_access();) + fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++)); + INC_DECODED_INST_LEN(1); + return fetched; +} + +/**************************************************************************** +RETURNS: +Immediate word value read from instruction queue + +REMARKS: +This function returns the immediate byte from the instruction queue, and +moves the instruction pointer to the next value. + +NOTE: Do not inline this function, as (*sys_rdw) is already inline! +****************************************************************************/ +u16 fetch_word_imm(void) +{ + u16 fetched; + +DB( if (CHECK_IP_FETCH()) + x86emu_check_ip_access();) + fetched = (*sys_rdw)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP)); + M.x86.R_IP += 2; + INC_DECODED_INST_LEN(2); + return fetched; +} + +/**************************************************************************** +RETURNS: +Immediate lone value read from instruction queue + +REMARKS: +This function returns the immediate byte from the instruction queue, and +moves the instruction pointer to the next value. + +NOTE: Do not inline this function, as (*sys_rdw) is already inline! +****************************************************************************/ +u32 fetch_long_imm(void) +{ + u32 fetched; + +DB( if (CHECK_IP_FETCH()) + x86emu_check_ip_access();) + fetched = (*sys_rdl)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP)); + M.x86.R_IP += 4; + INC_DECODED_INST_LEN(4); + return fetched; +} + +/**************************************************************************** +RETURNS: +Value of the default data segment + +REMARKS: +Inline function that returns the default data segment for the current +instruction. + +On the x86 processor, the default segment is not always DS if there is +no segment override. Address modes such as -3[BP] or 10[BP+SI] all refer to +addresses relative to SS (ie: on the stack). So, at the minimum, all +decodings of addressing modes would have to set/clear a bit describing +whether the access is relative to DS or SS. That is the function of the +cpu-state-varible M.x86.mode. There are several potential states: + + repe prefix seen (handled elsewhere) + repne prefix seen (ditto) + + cs segment override + ds segment override + es segment override + fs segment override + gs segment override + ss segment override + + ds/ss select (in absense of override) + +Each of the above 7 items are handled with a bit in the mode field. +****************************************************************************/ +_INLINE u32 get_data_segment(void) +{ +#define GET_SEGMENT(segment) + switch (M.x86.mode & SYSMODE_SEGMASK) { + case 0: /* default case: use ds register */ + case SYSMODE_SEGOVR_DS: + case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS: + return M.x86.R_DS; + case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */ + return M.x86.R_SS; + case SYSMODE_SEGOVR_CS: + case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS: + return M.x86.R_CS; + case SYSMODE_SEGOVR_ES: + case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS: + return M.x86.R_ES; + case SYSMODE_SEGOVR_FS: + case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS: + return M.x86.R_FS; + case SYSMODE_SEGOVR_GS: + case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS: + return M.x86.R_GS; + case SYSMODE_SEGOVR_SS: + case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS: + return M.x86.R_SS; + default: +#ifdef DEBUG + printk("error: should not happen: multiple overrides.\n"); +#endif + HALT_SYS(); + return 0; + } +} + +/**************************************************************************** +PARAMETERS: +offset - Offset to load data from + +RETURNS: +Byte value read from the absolute memory location. + +NOTE: Do not inline this function as (*sys_rdX) is already inline! +****************************************************************************/ +u8 fetch_data_byte( + uint offset) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access((u16)get_data_segment(), offset); +#endif + return (*sys_rdb)((get_data_segment() << 4) + offset); +} + +/**************************************************************************** +PARAMETERS: +offset - Offset to load data from + +RETURNS: +Word value read from the absolute memory location. + +NOTE: Do not inline this function as (*sys_rdX) is already inline! +****************************************************************************/ +u16 fetch_data_word( + uint offset) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access((u16)get_data_segment(), offset); +#endif + return (*sys_rdw)((get_data_segment() << 4) + offset); +} + +/**************************************************************************** +PARAMETERS: +offset - Offset to load data from + +RETURNS: +Long value read from the absolute memory location. + +NOTE: Do not inline this function as (*sys_rdX) is already inline! +****************************************************************************/ +u32 fetch_data_long( + uint offset) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access((u16)get_data_segment(), offset); +#endif + return (*sys_rdl)((get_data_segment() << 4) + offset); +} + +/**************************************************************************** +PARAMETERS: +segment - Segment to load data from +offset - Offset to load data from + +RETURNS: +Byte value read from the absolute memory location. + +NOTE: Do not inline this function as (*sys_rdX) is already inline! +****************************************************************************/ +u8 fetch_data_byte_abs( + uint segment, + uint offset) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access(segment, offset); +#endif + return (*sys_rdb)(((u32)segment << 4) + offset); +} + +/**************************************************************************** +PARAMETERS: +segment - Segment to load data from +offset - Offset to load data from + +RETURNS: +Word value read from the absolute memory location. + +NOTE: Do not inline this function as (*sys_rdX) is already inline! +****************************************************************************/ +u16 fetch_data_word_abs( + uint segment, + uint offset) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access(segment, offset); +#endif + return (*sys_rdw)(((u32)segment << 4) + offset); +} + +/**************************************************************************** +PARAMETERS: +segment - Segment to load data from +offset - Offset to load data from + +RETURNS: +Long value read from the absolute memory location. + +NOTE: Do not inline this function as (*sys_rdX) is already inline! +****************************************************************************/ +u32 fetch_data_long_abs( + uint segment, + uint offset) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access(segment, offset); +#endif + return (*sys_rdl)(((u32)segment << 4) + offset); +} + +/**************************************************************************** +PARAMETERS: +offset - Offset to store data at +val - Value to store + +REMARKS: +Writes a word value to an segmented memory location. The segment used is +the current 'default' segment, which may have been overridden. + +NOTE: Do not inline this function as (*sys_wrX) is already inline! +****************************************************************************/ +void store_data_byte( + uint offset, + u8 val) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access((u16)get_data_segment(), offset); +#endif + (*sys_wrb)((get_data_segment() << 4) + offset, val); +} + +/**************************************************************************** +PARAMETERS: +offset - Offset to store data at +val - Value to store + +REMARKS: +Writes a word value to an segmented memory location. The segment used is +the current 'default' segment, which may have been overridden. + +NOTE: Do not inline this function as (*sys_wrX) is already inline! +****************************************************************************/ +void store_data_word( + uint offset, + u16 val) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access((u16)get_data_segment(), offset); +#endif + (*sys_wrw)((get_data_segment() << 4) + offset, val); +} + +/**************************************************************************** +PARAMETERS: +offset - Offset to store data at +val - Value to store + +REMARKS: +Writes a long value to an segmented memory location. The segment used is +the current 'default' segment, which may have been overridden. + +NOTE: Do not inline this function as (*sys_wrX) is already inline! +****************************************************************************/ +void store_data_long( + uint offset, + u32 val) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access((u16)get_data_segment(), offset); +#endif + (*sys_wrl)((get_data_segment() << 4) + offset, val); +} + +/**************************************************************************** +PARAMETERS: +segment - Segment to store data at +offset - Offset to store data at +val - Value to store + +REMARKS: +Writes a byte value to an absolute memory location. + +NOTE: Do not inline this function as (*sys_wrX) is already inline! +****************************************************************************/ +void store_data_byte_abs( + uint segment, + uint offset, + u8 val) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access(segment, offset); +#endif + (*sys_wrb)(((u32)segment << 4) + offset, val); +} + +/**************************************************************************** +PARAMETERS: +segment - Segment to store data at +offset - Offset to store data at +val - Value to store + +REMARKS: +Writes a word value to an absolute memory location. + +NOTE: Do not inline this function as (*sys_wrX) is already inline! +****************************************************************************/ +void store_data_word_abs( + uint segment, + uint offset, + u16 val) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access(segment, offset); +#endif + (*sys_wrw)(((u32)segment << 4) + offset, val); +} + +/**************************************************************************** +PARAMETERS: +segment - Segment to store data at +offset - Offset to store data at +val - Value to store + +REMARKS: +Writes a long value to an absolute memory location. + +NOTE: Do not inline this function as (*sys_wrX) is already inline! +****************************************************************************/ +void store_data_long_abs( + uint segment, + uint offset, + u32 val) +{ +#ifdef DEBUG + if (CHECK_DATA_ACCESS()) + x86emu_check_data_access(segment, offset); +#endif + (*sys_wrl)(((u32)segment << 4) + offset, val); +} + +/**************************************************************************** +PARAMETERS: +reg - Register to decode + +RETURNS: +Pointer to the appropriate register + +REMARKS: +Return a pointer to the register given by the R/RM field of the +modrm byte, for byte operands. Also enables the decoding of instructions. +****************************************************************************/ +u8* decode_rm_byte_register( + int reg) +{ + switch (reg) { + case 0: + DECODE_PRINTF("AL"); + return &M.x86.R_AL; + case 1: + DECODE_PRINTF("CL"); + return &M.x86.R_CL; + case 2: + DECODE_PRINTF("DL"); + return &M.x86.R_DL; + case 3: + DECODE_PRINTF("BL"); + return &M.x86.R_BL; + case 4: + DECODE_PRINTF("AH"); + return &M.x86.R_AH; + case 5: + DECODE_PRINTF("CH"); + return &M.x86.R_CH; + case 6: + DECODE_PRINTF("DH"); + return &M.x86.R_DH; + case 7: + DECODE_PRINTF("BH"); + return &M.x86.R_BH; + } + HALT_SYS(); + return NULL; /* NOT REACHED OR REACHED ON ERROR */ +} + +/**************************************************************************** +PARAMETERS: +reg - Register to decode + +RETURNS: +Pointer to the appropriate register + +REMARKS: +Return a pointer to the register given by the R/RM field of the +modrm byte, for word operands. Also enables the decoding of instructions. +****************************************************************************/ +u16* decode_rm_word_register( + int reg) +{ + switch (reg) { + case 0: + DECODE_PRINTF("AX"); + return &M.x86.R_AX; + case 1: + DECODE_PRINTF("CX"); + return &M.x86.R_CX; + case 2: + DECODE_PRINTF("DX"); + return &M.x86.R_DX; + case 3: + DECODE_PRINTF("BX"); + return &M.x86.R_BX; + case 4: + DECODE_PRINTF("SP"); + return &M.x86.R_SP; + case 5: + DECODE_PRINTF("BP"); + return &M.x86.R_BP; + case 6: + DECODE_PRINTF("SI"); + return &M.x86.R_SI; + case 7: + DECODE_PRINTF("DI"); + return &M.x86.R_DI; + } + HALT_SYS(); + return NULL; /* NOTREACHED OR REACHED ON ERROR */ +} + +/**************************************************************************** +PARAMETERS: +reg - Register to decode + +RETURNS: +Pointer to the appropriate register + +REMARKS: +Return a pointer to the register given by the R/RM field of the +modrm byte, for dword operands. Also enables the decoding of instructions. +****************************************************************************/ +u32* decode_rm_long_register( + int reg) +{ + switch (reg) { + case 0: + DECODE_PRINTF("EAX"); + return &M.x86.R_EAX; + case 1: + DECODE_PRINTF("ECX"); + return &M.x86.R_ECX; + case 2: + DECODE_PRINTF("EDX"); + return &M.x86.R_EDX; + case 3: + DECODE_PRINTF("EBX"); + return &M.x86.R_EBX; + case 4: + DECODE_PRINTF("ESP"); + return &M.x86.R_ESP; + case 5: + DECODE_PRINTF("EBP"); + return &M.x86.R_EBP; + case 6: + DECODE_PRINTF("ESI"); + return &M.x86.R_ESI; + case 7: + DECODE_PRINTF("EDI"); + return &M.x86.R_EDI; + } + HALT_SYS(); + return NULL; /* NOTREACHED OR REACHED ON ERROR */ +} + +/**************************************************************************** +PARAMETERS: +reg - Register to decode + +RETURNS: +Pointer to the appropriate register + +REMARKS: +Return a pointer to the register given by the R/RM field of the +modrm byte, for word operands, modified from above for the weirdo +special case of segreg operands. Also enables the decoding of instructions. +****************************************************************************/ +u16* decode_rm_seg_register( + int reg) +{ + switch (reg) { + case 0: + DECODE_PRINTF("ES"); + return &M.x86.R_ES; + case 1: + DECODE_PRINTF("CS"); + return &M.x86.R_CS; + case 2: + DECODE_PRINTF("SS"); + return &M.x86.R_SS; + case 3: + DECODE_PRINTF("DS"); + return &M.x86.R_DS; + case 4: + case 5: + case 6: + case 7: + DECODE_PRINTF("ILLEGAL SEGREG"); + break; + } + HALT_SYS(); + return NULL; /* NOT REACHED OR REACHED ON ERROR */ +} + + +/**************************************************************************** +PARAMETERS: +sib - SIB value to decode + +RETURNS: +Offset in memory for the address decoding + +REMARKS: +Return the offset given by the specified SIB byte. + +NOTE: The code which specifies the corresponding segment (ds vs ss) + below in the case of [BP+..]. The assumption here is that at the + point that this subroutine is called, the bit corresponding to + SYSMODE_SEG_DS_SS will be zero. After every instruction + except the segment override instructions, this bit (as well + as any bits indicating segment overrides) will be clear. So + if a SS access is needed, set this bit. Otherwise, DS access + occurs (unless any of the segment override bits are set). +****************************************************************************/ +static unsigned decode_sib_address( + int sib) +{ + unsigned ss,index,base; + unsigned addr = 0; + + ss = (sib >> 6) & 3; + index = (sib >> 3) & 7; + base = (sib & 7); + + switch (base) { + case 0: + DECODE_PRINTF("[EAX"); + addr = M.x86.R_EAX; + break; + case 1: + DECODE_PRINTF("[ECX"); + addr = M.x86.R_ECX; + break; + case 2: + DECODE_PRINTF("[EDX"); + addr = M.x86.R_EDX; + break; + case 3: + DECODE_PRINTF("[EBX"); + addr = M.x86.R_EBX; + break; + case 4: + DECODE_PRINTF("[ESP"); + addr = M.x86.R_ESP; + break; + case 5: + DECODE_PRINTF("[invalid"); + addr = M.x86.R_ESP;/* incorrect */ + break; + case 6: + DECODE_PRINTF("[invalid"); + addr = M.x86.R_ESP;/* incorrect */ + break; + case 7: + DECODE_PRINTF("[invalid"); + addr = M.x86.R_ESP; /* incorrect */ + break; + } + + switch (index) { + case 0: + DECODE_PRINTF("+EAX"); + addr += M.x86.R_EAX*(1< 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + u32 res_lo,res_hi; + s32 imm; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_long(srcoffset); + imm = fetch_long_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg; + u16 srcval; + u32 res; + s16 imm; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_word(srcoffset); + imm = fetch_word_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + res = (s16)srcval * (s16)imm; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + u32 res_lo,res_hi; + s32 imm; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_long(srcoffset); + imm = fetch_long_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg; + u16 srcval; + u32 res; + s16 imm; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_word(srcoffset); + imm = fetch_word_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + res = (s16)srcval * (s16)imm; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*srcreg; + u32 res_lo,res_hi; + s32 imm; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rl); + imm = fetch_long_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg,*srcreg; + u32 res; + s16 imm; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rl); + imm = fetch_word_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + res = (s16)*srcreg * (s16)imm; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x6a +****************************************************************************/ +void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1)) +{ + s16 imm; + + START_OF_INSTR(); + imm = (s8)fetch_byte_imm(); + DECODE_PRINTF2("PUSH\t%d\n", imm); + TRACE_AND_STEP(); + push_word(imm); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x6b +****************************************************************************/ +void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint srcoffset; + s8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("IMUL\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + u32 res_lo,res_hi; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_long(srcoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg; + u16 srcval; + u32 res; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_word(srcoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + res = (s16)srcval * (s16)imm; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + u32 res_lo,res_hi; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_long(srcoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg; + u16 srcval; + u32 res; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_word(srcoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + res = (s16)srcval * (s16)imm; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + u32 res_lo,res_hi; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_long(srcoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg; + u16 srcval; + u32 res; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_word(srcoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + res = (s16)srcval * (s16)imm; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*srcreg; + u32 res_lo,res_hi; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rl); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg,*srcreg; + u32 res; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rl); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%d\n", (s32)imm); + res = (s16)*srcreg * (s16)imm; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x6c +****************************************************************************/ +void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("INSB\n"); + ins(1); + TRACE_AND_STEP(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x6d +****************************************************************************/ +void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("INSD\n"); + ins(4); + } else { + DECODE_PRINTF("INSW\n"); + ins(2); + } + TRACE_AND_STEP(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x6e +****************************************************************************/ +void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("OUTSB\n"); + outs(1); + TRACE_AND_STEP(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x6f +****************************************************************************/ +void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("OUTSD\n"); + outs(4); + } else { + DECODE_PRINTF("OUTSW\n"); + outs(2); + } + TRACE_AND_STEP(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x70 +****************************************************************************/ +void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if overflow flag is set */ + START_OF_INSTR(); + DECODE_PRINTF("JO\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_OF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x71 +****************************************************************************/ +void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if overflow is not set */ + START_OF_INSTR(); + DECODE_PRINTF("JNO\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (!ACCESS_FLAG(F_OF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x72 +****************************************************************************/ +void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if carry flag is set. */ + START_OF_INSTR(); + DECODE_PRINTF("JB\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_CF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x73 +****************************************************************************/ +void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if carry flag is clear. */ + START_OF_INSTR(); + DECODE_PRINTF("JNB\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (!ACCESS_FLAG(F_CF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x74 +****************************************************************************/ +void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if zero flag is set. */ + START_OF_INSTR(); + DECODE_PRINTF("JZ\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_ZF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x75 +****************************************************************************/ +void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if zero flag is clear. */ + START_OF_INSTR(); + DECODE_PRINTF("JNZ\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (!ACCESS_FLAG(F_ZF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x76 +****************************************************************************/ +void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if carry flag is set or if the zero + flag is set. */ + START_OF_INSTR(); + DECODE_PRINTF("JBE\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x77 +****************************************************************************/ +void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if carry flag is clear and if the zero + flag is clear */ + START_OF_INSTR(); + DECODE_PRINTF("JNBE\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x78 +****************************************************************************/ +void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if sign flag is set */ + START_OF_INSTR(); + DECODE_PRINTF("JS\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_SF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x79 +****************************************************************************/ +void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if sign flag is clear */ + START_OF_INSTR(); + DECODE_PRINTF("JNS\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (!ACCESS_FLAG(F_SF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x7a +****************************************************************************/ +void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if parity flag is set (even parity) */ + START_OF_INSTR(); + DECODE_PRINTF("JP\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_PF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x7b +****************************************************************************/ +void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + + /* jump to byte offset if parity flag is clear (odd parity) */ + START_OF_INSTR(); + DECODE_PRINTF("JNP\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (!ACCESS_FLAG(F_PF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x7c +****************************************************************************/ +void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + int sf, of; + + /* jump to byte offset if sign flag not equal to overflow flag. */ + START_OF_INSTR(); + DECODE_PRINTF("JL\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + sf = ACCESS_FLAG(F_SF) != 0; + of = ACCESS_FLAG(F_OF) != 0; + if (sf ^ of) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x7d +****************************************************************************/ +void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + int sf, of; + + /* jump to byte offset if sign flag not equal to overflow flag. */ + START_OF_INSTR(); + DECODE_PRINTF("JNL\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + sf = ACCESS_FLAG(F_SF) != 0; + of = ACCESS_FLAG(F_OF) != 0; + /* note: inverse of above, but using == instead of xor. */ + if (sf == of) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x7e +****************************************************************************/ +void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + int sf, of; + + /* jump to byte offset if sign flag not equal to overflow flag + or the zero flag is set */ + START_OF_INSTR(); + DECODE_PRINTF("JLE\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + sf = ACCESS_FLAG(F_SF) != 0; + of = ACCESS_FLAG(F_OF) != 0; + if ((sf ^ of) || ACCESS_FLAG(F_ZF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x7f +****************************************************************************/ +void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1)) +{ + s8 offset; + u16 target; + int sf, of; + + /* jump to byte offset if sign flag equal to overflow flag. + and the zero flag is clear */ + START_OF_INSTR(); + DECODE_PRINTF("JNLE\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + (s16)offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + sf = ACCESS_FLAG(F_SF) != 0; + of = ACCESS_FLAG(F_OF) != 0; + if ((sf == of) && !ACCESS_FLAG(F_ZF)) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +static u8 (*opc80_byte_operation[])(u8 d, u8 s) = +{ + add_byte, /* 00 */ + or_byte, /* 01 */ + adc_byte, /* 02 */ + sbb_byte, /* 03 */ + and_byte, /* 04 */ + sub_byte, /* 05 */ + xor_byte, /* 06 */ + cmp_byte, /* 07 */ +}; + +/**************************************************************************** +REMARKS: +Handles opcode 0x80 +****************************************************************************/ +void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg; + uint destoffset; + u8 imm; + u8 destval; + + /* + * Weirdo special case instruction format. Part of the opcode + * held below in "RH". Doubly nested case would result, except + * that the decoded instruction + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + + switch (rh) { + case 0: + DECODE_PRINTF("ADD\t"); + break; + case 1: + DECODE_PRINTF("OR\t"); + break; + case 2: + DECODE_PRINTF("ADC\t"); + break; + case 3: + DECODE_PRINTF("SBB\t"); + break; + case 4: + DECODE_PRINTF("AND\t"); + break; + case 5: + DECODE_PRINTF("SUB\t"); + break; + case 6: + DECODE_PRINTF("XOR\t"); + break; + case 7: + DECODE_PRINTF("CMP\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + switch (mod) { + case 0: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc80_byte_operation[rh]) (destval, imm); + if (rh != 7) + store_data_byte(destoffset, destval); + break; + case 1: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc80_byte_operation[rh]) (destval, imm); + if (rh != 7) + store_data_byte(destoffset, destval); + break; + case 2: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc80_byte_operation[rh]) (destval, imm); + if (rh != 7) + store_data_byte(destoffset, destval); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF(","); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc80_byte_operation[rh]) (*destreg, imm); + if (rh != 7) + *destreg = destval; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +static u16 (*opc81_word_operation[])(u16 d, u16 s) = +{ + add_word, /*00 */ + or_word, /*01 */ + adc_word, /*02 */ + sbb_word, /*03 */ + and_word, /*04 */ + sub_word, /*05 */ + xor_word, /*06 */ + cmp_word, /*07 */ +}; + +static u32 (*opc81_long_operation[])(u32 d, u32 s) = +{ + add_long, /*00 */ + or_long, /*01 */ + adc_long, /*02 */ + sbb_long, /*03 */ + and_long, /*04 */ + sub_long, /*05 */ + xor_long, /*06 */ + cmp_long, /*07 */ +}; + +/**************************************************************************** +REMARKS: +Handles opcode 0x81 +****************************************************************************/ +void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + /* + * Weirdo special case instruction format. Part of the opcode + * held below in "RH". Doubly nested case would result, except + * that the decoded instruction + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + + switch (rh) { + case 0: + DECODE_PRINTF("ADD\t"); + break; + case 1: + DECODE_PRINTF("OR\t"); + break; + case 2: + DECODE_PRINTF("ADC\t"); + break; + case 3: + DECODE_PRINTF("SBB\t"); + break; + case 4: + DECODE_PRINTF("AND\t"); + break; + case 5: + DECODE_PRINTF("SUB\t"); + break; + case 6: + DECODE_PRINTF("XOR\t"); + break; + case 7: + DECODE_PRINTF("CMP\t"); + break; + } + } +#endif + /* + * Know operation, decode the mod byte to find the addressing + * mode. + */ + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + imm = fetch_long_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc81_long_operation[rh]) (destval, imm); + if (rh != 7) + store_data_long(destoffset, destval); + } else { + u16 destval,imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + imm = fetch_word_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc81_word_operation[rh]) (destval, imm); + if (rh != 7) + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + imm = fetch_long_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc81_long_operation[rh]) (destval, imm); + if (rh != 7) + store_data_long(destoffset, destval); + } else { + u16 destval,imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + imm = fetch_word_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc81_word_operation[rh]) (destval, imm); + if (rh != 7) + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + imm = fetch_long_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc81_long_operation[rh]) (destval, imm); + if (rh != 7) + store_data_long(destoffset, destval); + } else { + u16 destval,imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + imm = fetch_word_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc81_word_operation[rh]) (destval, imm); + if (rh != 7) + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 destval,imm; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + imm = fetch_long_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc81_long_operation[rh]) (*destreg, imm); + if (rh != 7) + *destreg = destval; + } else { + u16 *destreg; + u16 destval,imm; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + imm = fetch_word_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc81_word_operation[rh]) (*destreg, imm); + if (rh != 7) + *destreg = destval; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +static u8 (*opc82_byte_operation[])(u8 s, u8 d) = +{ + add_byte, /*00 */ + or_byte, /*01 *//*YYY UNUSED ???? */ + adc_byte, /*02 */ + sbb_byte, /*03 */ + and_byte, /*04 *//*YYY UNUSED ???? */ + sub_byte, /*05 */ + xor_byte, /*06 *//*YYY UNUSED ???? */ + cmp_byte, /*07 */ +}; + +/**************************************************************************** +REMARKS: +Handles opcode 0x82 +****************************************************************************/ +void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg; + uint destoffset; + u8 imm; + u8 destval; + + /* + * Weirdo special case instruction format. Part of the opcode + * held below in "RH". Doubly nested case would result, except + * that the decoded instruction Similar to opcode 81, except that + * the immediate byte is sign extended to a word length. + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + switch (rh) { + case 0: + DECODE_PRINTF("ADD\t"); + break; + case 1: + DECODE_PRINTF("OR\t"); + break; + case 2: + DECODE_PRINTF("ADC\t"); + break; + case 3: + DECODE_PRINTF("SBB\t"); + break; + case 4: + DECODE_PRINTF("AND\t"); + break; + case 5: + DECODE_PRINTF("SUB\t"); + break; + case 6: + DECODE_PRINTF("XOR\t"); + break; + case 7: + DECODE_PRINTF("CMP\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + switch (mod) { + case 0: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm00_address(rl); + destval = fetch_data_byte(destoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc82_byte_operation[rh]) (destval, imm); + if (rh != 7) + store_data_byte(destoffset, destval); + break; + case 1: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm01_address(rl); + destval = fetch_data_byte(destoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc82_byte_operation[rh]) (destval, imm); + if (rh != 7) + store_data_byte(destoffset, destval); + break; + case 2: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm10_address(rl); + destval = fetch_data_byte(destoffset); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc82_byte_operation[rh]) (destval, imm); + if (rh != 7) + store_data_byte(destoffset, destval); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc82_byte_operation[rh]) (*destreg, imm); + if (rh != 7) + *destreg = destval; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +static u16 (*opc83_word_operation[])(u16 s, u16 d) = +{ + add_word, /*00 */ + or_word, /*01 *//*YYY UNUSED ???? */ + adc_word, /*02 */ + sbb_word, /*03 */ + and_word, /*04 *//*YYY UNUSED ???? */ + sub_word, /*05 */ + xor_word, /*06 *//*YYY UNUSED ???? */ + cmp_word, /*07 */ +}; + +static u32 (*opc83_long_operation[])(u32 s, u32 d) = +{ + add_long, /*00 */ + or_long, /*01 *//*YYY UNUSED ???? */ + adc_long, /*02 */ + sbb_long, /*03 */ + and_long, /*04 *//*YYY UNUSED ???? */ + sub_long, /*05 */ + xor_long, /*06 *//*YYY UNUSED ???? */ + cmp_long, /*07 */ +}; + +/**************************************************************************** +REMARKS: +Handles opcode 0x83 +****************************************************************************/ +void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + /* + * Weirdo special case instruction format. Part of the opcode + * held below in "RH". Doubly nested case would result, except + * that the decoded instruction Similar to opcode 81, except that + * the immediate byte is sign extended to a word length. + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + switch (rh) { + case 0: + DECODE_PRINTF("ADD\t"); + break; + case 1: + DECODE_PRINTF("OR\t"); + break; + case 2: + DECODE_PRINTF("ADC\t"); + break; + case 3: + DECODE_PRINTF("SBB\t"); + break; + case 4: + DECODE_PRINTF("AND\t"); + break; + case 5: + DECODE_PRINTF("SUB\t"); + break; + case 6: + DECODE_PRINTF("XOR\t"); + break; + case 7: + DECODE_PRINTF("CMP\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm00_address(rl); + destval = fetch_data_long(destoffset); + imm = (s8) fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc83_long_operation[rh]) (destval, imm); + if (rh != 7) + store_data_long(destoffset, destval); + } else { + u16 destval,imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm00_address(rl); + destval = fetch_data_word(destoffset); + imm = (s8) fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc83_word_operation[rh]) (destval, imm); + if (rh != 7) + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm01_address(rl); + destval = fetch_data_long(destoffset); + imm = (s8) fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc83_long_operation[rh]) (destval, imm); + if (rh != 7) + store_data_long(destoffset, destval); + } else { + u16 destval,imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm01_address(rl); + destval = fetch_data_word(destoffset); + imm = (s8) fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc83_word_operation[rh]) (destval, imm); + if (rh != 7) + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm10_address(rl); + destval = fetch_data_long(destoffset); + imm = (s8) fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc83_long_operation[rh]) (destval, imm); + if (rh != 7) + store_data_long(destoffset, destval); + } else { + u16 destval,imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm10_address(rl); + destval = fetch_data_word(destoffset); + imm = (s8) fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc83_word_operation[rh]) (destval, imm); + if (rh != 7) + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 destval,imm; + + destreg = DECODE_RM_LONG_REGISTER(rl); + imm = (s8) fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc83_long_operation[rh]) (*destreg, imm); + if (rh != 7) + *destreg = destval; + } else { + u16 *destreg; + u16 destval,imm; + + destreg = DECODE_RM_WORD_REGISTER(rl); + imm = (s8) fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + destval = (*opc83_word_operation[rh]) (*destreg, imm); + if (rh != 7) + *destreg = destval; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x84 +****************************************************************************/ +void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg, *srcreg; + uint destoffset; + u8 destval; + + START_OF_INSTR(); + DECODE_PRINTF("TEST\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_byte(destval, *srcreg); + break; + case 1: + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_byte(destval, *srcreg); + break; + case 2: + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_byte(destval, *srcreg); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_byte(*destreg, *srcreg); + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x85 +****************************************************************************/ +void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + START_OF_INSTR(); + DECODE_PRINTF("TEST\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *srcreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_long(destval, *srcreg); + } else { + u16 destval; + u16 *srcreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_word(destval, *srcreg); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *srcreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_long(destval, *srcreg); + } else { + u16 destval; + u16 *srcreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_word(destval, *srcreg); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *srcreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_long(destval, *srcreg); + } else { + u16 destval; + u16 *srcreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_word(destval, *srcreg); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*srcreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_long(*destreg, *srcreg); + } else { + u16 *destreg,*srcreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + test_word(*destreg, *srcreg); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x86 +****************************************************************************/ +void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg, *srcreg; + uint destoffset; + u8 destval; + u8 tmp; + + START_OF_INSTR(); + DECODE_PRINTF("XCHG\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_byte(destoffset, destval); + break; + case 1: + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_byte(destoffset, destval); + break; + case 2: + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_byte(destoffset); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_byte(destoffset, destval); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = *destreg; + *destreg = tmp; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x87 +****************************************************************************/ +void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + START_OF_INSTR(); + DECODE_PRINTF("XCHG\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg; + u32 destval,tmp; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_long(destoffset, destval); + } else { + u16 *srcreg; + u16 destval,tmp; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg; + u32 destval,tmp; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_long(destoffset, destval); + } else { + u16 *srcreg; + u16 destval,tmp; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg; + u32 destval,tmp; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_long(destoffset); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_long(destoffset, destval); + } else { + u16 *srcreg; + u16 destval,tmp; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + destval = fetch_data_word(destoffset); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = destval; + destval = tmp; + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*srcreg; + u32 tmp; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = *destreg; + *destreg = tmp; + } else { + u16 *destreg,*srcreg; + u16 tmp; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + tmp = *srcreg; + *srcreg = *destreg; + *destreg = tmp; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x88 +****************************************************************************/ +void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg, *srcreg; + uint destoffset; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_byte(destoffset, *srcreg); + break; + case 1: + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_byte(destoffset, *srcreg); + break; + case 2: + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_byte(destoffset, *srcreg); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x89 +****************************************************************************/ +void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_long(destoffset, *srcreg); + } else { + u16 *srcreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_word(destoffset, *srcreg); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_long(destoffset, *srcreg); + } else { + u16 *srcreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_word(destoffset, *srcreg); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_long(destoffset, *srcreg); + } else { + u16 *srcreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + store_data_word(destoffset, *srcreg); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*srcreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + } else { + u16 *destreg,*srcreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x8a +****************************************************************************/ +void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg, *srcreg; + uint srcoffset; + u8 srcval; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 1: + destreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 2: + destreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x8b +****************************************************************************/ +void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_long(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_long(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_long(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg, *srcreg; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + } else { + u16 *destreg, *srcreg; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x8c +****************************************************************************/ +void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u16 *destreg, *srcreg; + uint destoffset; + u16 destval; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + srcreg = decode_rm_seg_register(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = *srcreg; + store_data_word(destoffset, destval); + break; + case 1: + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + srcreg = decode_rm_seg_register(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = *srcreg; + store_data_word(destoffset, destval); + break; + case 2: + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + srcreg = decode_rm_seg_register(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = *srcreg; + store_data_word(destoffset, destval); + break; + case 3: /* register to register */ + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + srcreg = decode_rm_seg_register(rh); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x8d +****************************************************************************/ +void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u16 *srcreg; + uint destoffset; + +/* + * TODO: Need to handle address size prefix! + * + * lea eax,[eax+ebx*2] ?? + */ + + START_OF_INSTR(); + DECODE_PRINTF("LEA\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *srcreg = (u16)destoffset; + break; + case 1: + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *srcreg = (u16)destoffset; + break; + case 2: + srcreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *srcreg = (u16)destoffset; + break; + case 3: /* register to register */ + /* undefined. Do nothing. */ + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x8e +****************************************************************************/ +void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u16 *destreg, *srcreg; + uint srcoffset; + u16 srcval; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destreg = decode_rm_seg_register(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 1: + destreg = decode_rm_seg_register(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 2: + destreg = decode_rm_seg_register(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 3: /* register to register */ + destreg = decode_rm_seg_register(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + break; + } + /* + * Clean up, and reset all the R_xSP pointers to the correct + * locations. This is about 3x too much overhead (doing all the + * segreg ptrs when only one is needed, but this instruction + * *cannot* be that common, and this isn't too much work anyway. + */ + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x8f +****************************************************************************/ +void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + START_OF_INSTR(); + DECODE_PRINTF("POP\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + if (rh != 0) { + DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n"); + HALT_SYS(); + } + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = pop_long(); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = pop_word(); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = pop_long(); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = pop_word(); + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = pop_long(); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + destval = pop_word(); + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = pop_long(); + } else { + u16 *destreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = pop_word(); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x90 +****************************************************************************/ +void x86emuOp_nop(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("NOP\n"); + TRACE_AND_STEP(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x91 +****************************************************************************/ +void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1)) +{ + u32 tmp; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("XCHG\tEAX,ECX\n"); + } else { + DECODE_PRINTF("XCHG\tAX,CX\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + tmp = M.x86.R_EAX; + M.x86.R_EAX = M.x86.R_ECX; + M.x86.R_ECX = tmp; + } else { + tmp = M.x86.R_AX; + M.x86.R_AX = M.x86.R_CX; + M.x86.R_CX = (u16)tmp; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x92 +****************************************************************************/ +void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1)) +{ + u32 tmp; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("XCHG\tEAX,EDX\n"); + } else { + DECODE_PRINTF("XCHG\tAX,DX\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + tmp = M.x86.R_EAX; + M.x86.R_EAX = M.x86.R_EDX; + M.x86.R_EDX = tmp; + } else { + tmp = M.x86.R_AX; + M.x86.R_AX = M.x86.R_DX; + M.x86.R_DX = (u16)tmp; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x93 +****************************************************************************/ +void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1)) +{ + u32 tmp; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("XCHG\tEAX,EBX\n"); + } else { + DECODE_PRINTF("XCHG\tAX,BX\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + tmp = M.x86.R_EAX; + M.x86.R_EAX = M.x86.R_EBX; + M.x86.R_EBX = tmp; + } else { + tmp = M.x86.R_AX; + M.x86.R_AX = M.x86.R_BX; + M.x86.R_BX = (u16)tmp; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x94 +****************************************************************************/ +void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1)) +{ + u32 tmp; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("XCHG\tEAX,ESP\n"); + } else { + DECODE_PRINTF("XCHG\tAX,SP\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + tmp = M.x86.R_EAX; + M.x86.R_EAX = M.x86.R_ESP; + M.x86.R_ESP = tmp; + } else { + tmp = M.x86.R_AX; + M.x86.R_AX = M.x86.R_SP; + M.x86.R_SP = (u16)tmp; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x95 +****************************************************************************/ +void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1)) +{ + u32 tmp; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("XCHG\tEAX,EBP\n"); + } else { + DECODE_PRINTF("XCHG\tAX,BP\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + tmp = M.x86.R_EAX; + M.x86.R_EAX = M.x86.R_EBP; + M.x86.R_EBP = tmp; + } else { + tmp = M.x86.R_AX; + M.x86.R_AX = M.x86.R_BP; + M.x86.R_BP = (u16)tmp; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x96 +****************************************************************************/ +void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1)) +{ + u32 tmp; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("XCHG\tEAX,ESI\n"); + } else { + DECODE_PRINTF("XCHG\tAX,SI\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + tmp = M.x86.R_EAX; + M.x86.R_EAX = M.x86.R_ESI; + M.x86.R_ESI = tmp; + } else { + tmp = M.x86.R_AX; + M.x86.R_AX = M.x86.R_SI; + M.x86.R_SI = (u16)tmp; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x97 +****************************************************************************/ +void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1)) +{ + u32 tmp; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("XCHG\tEAX,EDI\n"); + } else { + DECODE_PRINTF("XCHG\tAX,DI\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + tmp = M.x86.R_EAX; + M.x86.R_EAX = M.x86.R_EDI; + M.x86.R_EDI = tmp; + } else { + tmp = M.x86.R_AX; + M.x86.R_AX = M.x86.R_DI; + M.x86.R_DI = (u16)tmp; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x98 +****************************************************************************/ +void x86emuOp_cbw(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("CWDE\n"); + } else { + DECODE_PRINTF("CBW\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + if (M.x86.R_AX & 0x8000) { + M.x86.R_EAX |= 0xffff0000; + } else { + M.x86.R_EAX &= 0x0000ffff; + } + } else { + if (M.x86.R_AL & 0x80) { + M.x86.R_AH = 0xff; + } else { + M.x86.R_AH = 0x0; + } + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x99 +****************************************************************************/ +void x86emuOp_cwd(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("CDQ\n"); + } else { + DECODE_PRINTF("CWD\n"); + } + DECODE_PRINTF("CWD\n"); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + if (M.x86.R_EAX & 0x80000000) { + M.x86.R_EDX = 0xffffffff; + } else { + M.x86.R_EDX = 0x0; + } + } else { + if (M.x86.R_AX & 0x8000) { + M.x86.R_DX = 0xffff; + } else { + M.x86.R_DX = 0x0; + } + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x9a +****************************************************************************/ +void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 farseg, faroff; + + START_OF_INSTR(); + DECODE_PRINTF("CALL\t"); + faroff = fetch_word_imm(); + farseg = fetch_word_imm(); + DECODE_PRINTF2("%04x:", farseg); + DECODE_PRINTF2("%04x\n", faroff); + CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR "); + + /* XXX + * + * Hooked interrupt vectors calling into our "BIOS" will cause + * problems unless all intersegment stuff is checked for BIOS + * access. Check needed here. For moment, let it alone. + */ + TRACE_AND_STEP(); + push_word(M.x86.R_CS); + M.x86.R_CS = farseg; + push_word(M.x86.R_IP); + M.x86.R_IP = faroff; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x9b +****************************************************************************/ +void x86emuOp_wait(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("WAIT"); + TRACE_AND_STEP(); + /* NADA. */ + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x9c +****************************************************************************/ +void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1)) +{ + u32 flags; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("PUSHFD\n"); + } else { + DECODE_PRINTF("PUSHF\n"); + } + TRACE_AND_STEP(); + + /* clear out *all* bits not representing flags, and turn on real bits */ + flags = (M.x86.R_EFLG & F_MSK) | F_ALWAYS_ON; + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + push_long(flags); + } else { + push_word((u16)flags); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x9d +****************************************************************************/ +void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("POPFD\n"); + } else { + DECODE_PRINTF("POPF\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EFLG = pop_long(); + } else { + M.x86.R_FLG = pop_word(); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x9e +****************************************************************************/ +void x86emuOp_sahf(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("SAHF\n"); + TRACE_AND_STEP(); + /* clear the lower bits of the flag register */ + M.x86.R_FLG &= 0xffffff00; + /* or in the AH register into the flags register */ + M.x86.R_FLG |= M.x86.R_AH; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x9f +****************************************************************************/ +void x86emuOp_lahf(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("LAHF\n"); + TRACE_AND_STEP(); + M.x86.R_AH = (u8)(M.x86.R_FLG & 0xff); + /*undocumented TC++ behavior??? Nope. It's documented, but + you have too look real hard to notice it. */ + M.x86.R_AH |= 0x2; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa0 +****************************************************************************/ +void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 offset; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tAL,"); + offset = fetch_word_imm(); + DECODE_PRINTF2("[%04x]\n", offset); + TRACE_AND_STEP(); + M.x86.R_AL = fetch_data_byte(offset); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa1 +****************************************************************************/ +void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 offset; + + START_OF_INSTR(); + offset = fetch_word_imm(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset); + } else { + DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EAX = fetch_data_long(offset); + } else { + M.x86.R_AX = fetch_data_word(offset); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa2 +****************************************************************************/ +void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 offset; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + offset = fetch_word_imm(); + DECODE_PRINTF2("[%04x],AL\n", offset); + TRACE_AND_STEP(); + store_data_byte(offset, M.x86.R_AL); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa3 +****************************************************************************/ +void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 offset; + + START_OF_INSTR(); + offset = fetch_word_imm(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset); + } else { + DECODE_PRINTF2("MOV\t[%04x],AX\n", offset); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + store_data_long(offset, M.x86.R_EAX); + } else { + store_data_word(offset, M.x86.R_AX); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa4 +****************************************************************************/ +void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1)) +{ + u8 val; + u32 count; + int inc; + + START_OF_INSTR(); + DECODE_PRINTF("MOVS\tBYTE\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -1; + else + inc = 1; + TRACE_AND_STEP(); + count = 1; + if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { + /* dont care whether REPE or REPNE */ + /* move them until CX is ZERO. */ + count = M.x86.R_CX; + M.x86.R_CX = 0; + M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); + } + while (count--) { + val = fetch_data_byte(M.x86.R_SI); + store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, val); + M.x86.R_SI += inc; + M.x86.R_DI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa5 +****************************************************************************/ +void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1)) +{ + u32 val; + int inc; + u32 count; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOVS\tDWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -4; + else + inc = 4; + } else { + DECODE_PRINTF("MOVS\tWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -2; + else + inc = 2; + } + TRACE_AND_STEP(); + count = 1; + if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { + /* dont care whether REPE or REPNE */ + /* move them until CX is ZERO. */ + count = M.x86.R_CX; + M.x86.R_CX = 0; + M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); + } + while (count--) { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + val = fetch_data_long(M.x86.R_SI); + store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val); + } else { + val = fetch_data_word(M.x86.R_SI); + store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16)val); + } + M.x86.R_SI += inc; + M.x86.R_DI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa6 +****************************************************************************/ +void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1)) +{ + s8 val1, val2; + int inc; + + START_OF_INSTR(); + DECODE_PRINTF("CMPS\tBYTE\n"); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -1; + else + inc = 1; + + if (M.x86.mode & SYSMODE_PREFIX_REPE) { + /* REPE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + val1 = fetch_data_byte(M.x86.R_SI); + val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); + cmp_byte(val1, val2); + M.x86.R_CX -= 1; + M.x86.R_SI += inc; + M.x86.R_DI += inc; + if (ACCESS_FLAG(F_ZF) == 0) + break; + } + M.x86.mode &= ~SYSMODE_PREFIX_REPE; + } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) { + /* REPNE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + val1 = fetch_data_byte(M.x86.R_SI); + val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); + cmp_byte(val1, val2); + M.x86.R_CX -= 1; + M.x86.R_SI += inc; + M.x86.R_DI += inc; + if (ACCESS_FLAG(F_ZF)) + break; /* zero flag set means equal */ + } + M.x86.mode &= ~SYSMODE_PREFIX_REPNE; + } else { + val1 = fetch_data_byte(M.x86.R_SI); + val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); + cmp_byte(val1, val2); + M.x86.R_SI += inc; + M.x86.R_DI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa7 +****************************************************************************/ +void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1)) +{ + u32 val1,val2; + int inc; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("CMPS\tDWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -4; + else + inc = 4; + } else { + DECODE_PRINTF("CMPS\tWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -2; + else + inc = 2; + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_REPE) { + /* REPE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + val1 = fetch_data_long(M.x86.R_SI); + val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); + cmp_long(val1, val2); + } else { + val1 = fetch_data_word(M.x86.R_SI); + val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); + cmp_word((u16)val1, (u16)val2); + } + M.x86.R_CX -= 1; + M.x86.R_SI += inc; + M.x86.R_DI += inc; + if (ACCESS_FLAG(F_ZF) == 0) + break; + } + M.x86.mode &= ~SYSMODE_PREFIX_REPE; + } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) { + /* REPNE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + val1 = fetch_data_long(M.x86.R_SI); + val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); + cmp_long(val1, val2); + } else { + val1 = fetch_data_word(M.x86.R_SI); + val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); + cmp_word((u16)val1, (u16)val2); + } + M.x86.R_CX -= 1; + M.x86.R_SI += inc; + M.x86.R_DI += inc; + if (ACCESS_FLAG(F_ZF)) + break; /* zero flag set means equal */ + } + M.x86.mode &= ~SYSMODE_PREFIX_REPNE; + } else { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + val1 = fetch_data_long(M.x86.R_SI); + val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); + cmp_long(val1, val2); + } else { + val1 = fetch_data_word(M.x86.R_SI); + val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); + cmp_word((u16)val1, (u16)val2); + } + M.x86.R_SI += inc; + M.x86.R_DI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa8 +****************************************************************************/ +void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1)) +{ + int imm; + + START_OF_INSTR(); + DECODE_PRINTF("TEST\tAL,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%04x\n", imm); + TRACE_AND_STEP(); + test_byte(M.x86.R_AL, (u8)imm); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xa9 +****************************************************************************/ +void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("TEST\tEAX,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("TEST\tAX,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + test_long(M.x86.R_EAX, srcval); + } else { + test_word(M.x86.R_AX, (u16)srcval); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xaa +****************************************************************************/ +void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1)) +{ + int inc; + + START_OF_INSTR(); + DECODE_PRINTF("STOS\tBYTE\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -1; + else + inc = 1; + TRACE_AND_STEP(); + if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { + /* dont care whether REPE or REPNE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL); + M.x86.R_CX -= 1; + M.x86.R_DI += inc; + } + M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); + } else { + store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL); + M.x86.R_DI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xab +****************************************************************************/ +void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1)) +{ + int inc; + u32 count; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("STOS\tDWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -4; + else + inc = 4; + } else { + DECODE_PRINTF("STOS\tWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -2; + else + inc = 2; + } + TRACE_AND_STEP(); + count = 1; + if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { + /* dont care whether REPE or REPNE */ + /* move them until CX is ZERO. */ + count = M.x86.R_CX; + M.x86.R_CX = 0; + M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); + } + while (count--) { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX); + } else { + store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX); + } + M.x86.R_DI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xac +****************************************************************************/ +void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1)) +{ + int inc; + + START_OF_INSTR(); + DECODE_PRINTF("LODS\tBYTE\n"); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -1; + else + inc = 1; + if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { + /* dont care whether REPE or REPNE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + M.x86.R_AL = fetch_data_byte(M.x86.R_SI); + M.x86.R_CX -= 1; + M.x86.R_SI += inc; + } + M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); + } else { + M.x86.R_AL = fetch_data_byte(M.x86.R_SI); + M.x86.R_SI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xad +****************************************************************************/ +void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1)) +{ + int inc; + u32 count; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("LODS\tDWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -4; + else + inc = 4; + } else { + DECODE_PRINTF("LODS\tWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -2; + else + inc = 2; + } + TRACE_AND_STEP(); + count = 1; + if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { + /* dont care whether REPE or REPNE */ + /* move them until CX is ZERO. */ + count = M.x86.R_CX; + M.x86.R_CX = 0; + M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); + } + while (count--) { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EAX = fetch_data_long(M.x86.R_SI); + } else { + M.x86.R_AX = fetch_data_word(M.x86.R_SI); + } + M.x86.R_SI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xae +****************************************************************************/ +void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1)) +{ + s8 val2; + int inc; + + START_OF_INSTR(); + DECODE_PRINTF("SCAS\tBYTE\n"); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -1; + else + inc = 1; + if (M.x86.mode & SYSMODE_PREFIX_REPE) { + /* REPE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); + cmp_byte(M.x86.R_AL, val2); + M.x86.R_CX -= 1; + M.x86.R_DI += inc; + if (ACCESS_FLAG(F_ZF) == 0) + break; + } + M.x86.mode &= ~SYSMODE_PREFIX_REPE; + } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) { + /* REPNE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); + cmp_byte(M.x86.R_AL, val2); + M.x86.R_CX -= 1; + M.x86.R_DI += inc; + if (ACCESS_FLAG(F_ZF)) + break; /* zero flag set means equal */ + } + M.x86.mode &= ~SYSMODE_PREFIX_REPNE; + } else { + val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI); + cmp_byte(M.x86.R_AL, val2); + M.x86.R_DI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xaf +****************************************************************************/ +void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1)) +{ + int inc; + u32 val; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("SCAS\tDWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -4; + else + inc = 4; + } else { + DECODE_PRINTF("SCAS\tWORD\n"); + if (ACCESS_FLAG(F_DF)) /* down */ + inc = -2; + else + inc = 2; + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_REPE) { + /* REPE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); + cmp_long(M.x86.R_EAX, val); + } else { + val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); + cmp_word(M.x86.R_AX, (u16)val); + } + M.x86.R_CX -= 1; + M.x86.R_DI += inc; + if (ACCESS_FLAG(F_ZF) == 0) + break; + } + M.x86.mode &= ~SYSMODE_PREFIX_REPE; + } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) { + /* REPNE */ + /* move them until CX is ZERO. */ + while (M.x86.R_CX != 0) { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); + cmp_long(M.x86.R_EAX, val); + } else { + val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); + cmp_word(M.x86.R_AX, (u16)val); + } + M.x86.R_CX -= 1; + M.x86.R_DI += inc; + if (ACCESS_FLAG(F_ZF)) + break; /* zero flag set means equal */ + } + M.x86.mode &= ~SYSMODE_PREFIX_REPNE; + } else { + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI); + cmp_long(M.x86.R_EAX, val); + } else { + val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI); + cmp_word(M.x86.R_AX, (u16)val); + } + M.x86.R_DI += inc; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb0 +****************************************************************************/ +void x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tAL,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + M.x86.R_AL = imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb1 +****************************************************************************/ +void x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tCL,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + M.x86.R_CL = imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb2 +****************************************************************************/ +void x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tDL,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + M.x86.R_DL = imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb3 +****************************************************************************/ +void x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tBL,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + M.x86.R_BL = imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb4 +****************************************************************************/ +void x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tAH,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + M.x86.R_AH = imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb5 +****************************************************************************/ +void x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tCH,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + M.x86.R_CH = imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb6 +****************************************************************************/ +void x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tDH,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + M.x86.R_DH = imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb7 +****************************************************************************/ +void x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\tBH,"); + imm = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", imm); + TRACE_AND_STEP(); + M.x86.R_BH = imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb8 +****************************************************************************/ +void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOV\tEAX,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("MOV\tAX,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EAX = srcval; + } else { + M.x86.R_AX = (u16)srcval; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xb9 +****************************************************************************/ +void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOV\tECX,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("MOV\tCX,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_ECX = srcval; + } else { + M.x86.R_CX = (u16)srcval; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xba +****************************************************************************/ +void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOV\tEDX,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("MOV\tDX,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EDX = srcval; + } else { + M.x86.R_DX = (u16)srcval; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xbb +****************************************************************************/ +void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOV\tEBX,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("MOV\tBX,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EBX = srcval; + } else { + M.x86.R_BX = (u16)srcval; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xbc +****************************************************************************/ +void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOV\tESP,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("MOV\tSP,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_ESP = srcval; + } else { + M.x86.R_SP = (u16)srcval; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xbd +****************************************************************************/ +void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOV\tEBP,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("MOV\tBP,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EBP = srcval; + } else { + M.x86.R_BP = (u16)srcval; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xbe +****************************************************************************/ +void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOV\tESI,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("MOV\tSI,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_ESI = srcval; + } else { + M.x86.R_SI = (u16)srcval; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xbf +****************************************************************************/ +void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1)) +{ + u32 srcval; + + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("MOV\tEDI,"); + srcval = fetch_long_imm(); + } else { + DECODE_PRINTF("MOV\tDI,"); + srcval = fetch_word_imm(); + } + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EDI = srcval; + } else { + M.x86.R_DI = (u16)srcval; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/* used by opcodes c0, d0, and d2. */ +static u8(*opcD0_byte_operation[])(u8 d, u8 s) = +{ + rol_byte, + ror_byte, + rcl_byte, + rcr_byte, + shl_byte, + shr_byte, + shl_byte, /* sal_byte === shl_byte by definition */ + sar_byte, +}; + +/**************************************************************************** +REMARKS: +Handles opcode 0xc0 +****************************************************************************/ +void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg; + uint destoffset; + u8 destval; + u8 amt; + + /* + * Yet another weirdo special case instruction format. Part of + * the opcode held below in "RH". Doubly nested case would + * result, except that the decoded instruction + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + + switch (rh) { + case 0: + DECODE_PRINTF("ROL\t"); + break; + case 1: + DECODE_PRINTF("ROR\t"); + break; + case 2: + DECODE_PRINTF("RCL\t"); + break; + case 3: + DECODE_PRINTF("RCR\t"); + break; + case 4: + DECODE_PRINTF("SHL\t"); + break; + case 5: + DECODE_PRINTF("SHR\t"); + break; + case 6: + DECODE_PRINTF("SAL\t"); + break; + case 7: + DECODE_PRINTF("SAR\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + switch (mod) { + case 0: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm00_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, amt); + store_data_byte(destoffset, destval); + break; + case 1: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm01_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, amt); + store_data_byte(destoffset, destval); + break; + case 2: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm10_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, amt); + store_data_byte(destoffset, destval); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (*destreg, amt); + *destreg = destval; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/* used by opcodes c1, d1, and d3. */ +static u16(*opcD1_word_operation[])(u16 s, u8 d) = +{ + rol_word, + ror_word, + rcl_word, + rcr_word, + shl_word, + shr_word, + shl_word, /* sal_byte === shl_byte by definition */ + sar_word, +}; + +/* used by opcodes c1, d1, and d3. */ +static u32 (*opcD1_long_operation[])(u32 s, u8 d) = +{ + rol_long, + ror_long, + rcl_long, + rcr_long, + shl_long, + shr_long, + shl_long, /* sal_byte === shl_byte by definition */ + sar_long, +}; + +/**************************************************************************** +REMARKS: +Handles opcode 0xc1 +****************************************************************************/ +void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + u8 amt; + + /* + * Yet another weirdo special case instruction format. Part of + * the opcode held below in "RH". Doubly nested case would + * result, except that the decoded instruction + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + + switch (rh) { + case 0: + DECODE_PRINTF("ROL\t"); + break; + case 1: + DECODE_PRINTF("ROR\t"); + break; + case 2: + DECODE_PRINTF("RCL\t"); + break; + case 3: + DECODE_PRINTF("RCR\t"); + break; + case 4: + DECODE_PRINTF("SHL\t"); + break; + case 5: + DECODE_PRINTF("SHR\t"); + break; + case 6: + DECODE_PRINTF("SAL\t"); + break; + case 7: + DECODE_PRINTF("SAR\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm00_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, amt); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm00_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, amt); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm01_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, amt); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm01_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, amt); + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm10_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, amt); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm10_address(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, amt); + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + TRACE_AND_STEP(); + *destreg = (*opcD1_long_operation[rh]) (*destreg, amt); + } else { + u16 *destreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + amt = fetch_byte_imm(); + DECODE_PRINTF2(",%x\n", amt); + TRACE_AND_STEP(); + *destreg = (*opcD1_word_operation[rh]) (*destreg, amt); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xc2 +****************************************************************************/ +void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 imm; + + START_OF_INSTR(); + DECODE_PRINTF("RET\t"); + imm = fetch_word_imm(); + DECODE_PRINTF2("%x\n", imm); + RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip); + TRACE_AND_STEP(); + M.x86.R_IP = pop_word(); + M.x86.R_SP += imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xc3 +****************************************************************************/ +void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("RET\n"); + RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip); + TRACE_AND_STEP(); + M.x86.R_IP = pop_word(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xc4 +****************************************************************************/ +void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rh, rl; + u16 *dstreg; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("LES\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_ES = fetch_data_word(srcoffset + 2); + break; + case 1: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_ES = fetch_data_word(srcoffset + 2); + break; + case 2: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_ES = fetch_data_word(srcoffset + 2); + break; + case 3: /* register to register */ + /* UNDEFINED! */ + TRACE_AND_STEP(); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xc5 +****************************************************************************/ +void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rh, rl; + u16 *dstreg; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("LDS\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_DS = fetch_data_word(srcoffset + 2); + break; + case 1: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_DS = fetch_data_word(srcoffset + 2); + break; + case 2: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_DS = fetch_data_word(srcoffset + 2); + break; + case 3: /* register to register */ + /* UNDEFINED! */ + TRACE_AND_STEP(); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xc6 +****************************************************************************/ +void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg; + uint destoffset; + u8 imm; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + if (rh != 0) { + DECODE_PRINTF("ILLEGAL DECODE OF OPCODE c6\n"); + HALT_SYS(); + } + switch (mod) { + case 0: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm00_address(rl); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%2x\n", imm); + TRACE_AND_STEP(); + store_data_byte(destoffset, imm); + break; + case 1: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm01_address(rl); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%2x\n", imm); + TRACE_AND_STEP(); + store_data_byte(destoffset, imm); + break; + case 2: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm10_address(rl); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%2x\n", imm); + TRACE_AND_STEP(); + store_data_byte(destoffset, imm); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + imm = fetch_byte_imm(); + DECODE_PRINTF2(",%2x\n", imm); + TRACE_AND_STEP(); + *destreg = imm; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xc7 +****************************************************************************/ +void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + START_OF_INSTR(); + DECODE_PRINTF("MOV\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + if (rh != 0) { + DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n"); + HALT_SYS(); + } + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm00_address(rl); + imm = fetch_long_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + store_data_long(destoffset, imm); + } else { + u16 imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm00_address(rl); + imm = fetch_word_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + store_data_word(destoffset, imm); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm01_address(rl); + imm = fetch_long_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + store_data_long(destoffset, imm); + } else { + u16 imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm01_address(rl); + imm = fetch_word_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + store_data_word(destoffset, imm); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 imm; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm10_address(rl); + imm = fetch_long_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + store_data_long(destoffset, imm); + } else { + u16 imm; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm10_address(rl); + imm = fetch_word_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + store_data_word(destoffset, imm); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 imm; + + destreg = DECODE_RM_LONG_REGISTER(rl); + imm = fetch_long_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + *destreg = imm; + } else { + u16 *destreg; + u16 imm; + + destreg = DECODE_RM_WORD_REGISTER(rl); + imm = fetch_word_imm(); + DECODE_PRINTF2(",%x\n", imm); + TRACE_AND_STEP(); + *destreg = imm; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xc8 +****************************************************************************/ +void x86emuOp_enter(u8 X86EMU_UNUSED(op1)) +{ + u16 local,frame_pointer; + u8 nesting; + int i; + + START_OF_INSTR(); + local = fetch_word_imm(); + nesting = fetch_byte_imm(); + DECODE_PRINTF2("ENTER %x\n", local); + DECODE_PRINTF2(",%x\n", nesting); + TRACE_AND_STEP(); + push_word(M.x86.R_BP); + frame_pointer = M.x86.R_SP; + if (nesting > 0) { + for (i = 1; i < nesting; i++) { + M.x86.R_BP -= 2; + push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP)); + } + push_word(frame_pointer); + } + M.x86.R_BP = frame_pointer; + M.x86.R_SP = (u16)(M.x86.R_SP - local); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xc9 +****************************************************************************/ +void x86emuOp_leave(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("LEAVE\n"); + TRACE_AND_STEP(); + M.x86.R_SP = M.x86.R_BP; + M.x86.R_BP = pop_word(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xca +****************************************************************************/ +void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 imm; + + START_OF_INSTR(); + DECODE_PRINTF("RETF\t"); + imm = fetch_word_imm(); + DECODE_PRINTF2("%x\n", imm); + RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip); + TRACE_AND_STEP(); + M.x86.R_IP = pop_word(); + M.x86.R_CS = pop_word(); + M.x86.R_SP += imm; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xcb +****************************************************************************/ +void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("RETF\n"); + RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip); + TRACE_AND_STEP(); + M.x86.R_IP = pop_word(); + M.x86.R_CS = pop_word(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xcc +****************************************************************************/ +void x86emuOp_int3(u8 X86EMU_UNUSED(op1)) +{ + u16 tmp; + + START_OF_INSTR(); + DECODE_PRINTF("INT 3\n"); + tmp = (u16) mem_access_word(3 * 4 + 2); + /* access the segment register */ + TRACE_AND_STEP(); + if (_X86EMU_intrTab[3]) { + (*_X86EMU_intrTab[3])(3); + } else { + push_word((u16)M.x86.R_FLG); + CLEAR_FLAG(F_IF); + CLEAR_FLAG(F_TF); + push_word(M.x86.R_CS); + M.x86.R_CS = mem_access_word(3 * 4 + 2); + push_word(M.x86.R_IP); + M.x86.R_IP = mem_access_word(3 * 4); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xcd +****************************************************************************/ +void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 tmp; + u8 intnum; + + START_OF_INSTR(); + DECODE_PRINTF("INT\t"); + intnum = fetch_byte_imm(); + DECODE_PRINTF2("%x\n", intnum); + tmp = mem_access_word(intnum * 4 + 2); + TRACE_AND_STEP(); + if (_X86EMU_intrTab[intnum]) { + (*_X86EMU_intrTab[intnum])(intnum); + } else { + push_word((u16)M.x86.R_FLG); + CLEAR_FLAG(F_IF); + CLEAR_FLAG(F_TF); + push_word(M.x86.R_CS); + M.x86.R_CS = mem_access_word(intnum * 4 + 2); + push_word(M.x86.R_IP); + M.x86.R_IP = mem_access_word(intnum * 4); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xce +****************************************************************************/ +void x86emuOp_into(u8 X86EMU_UNUSED(op1)) +{ + u16 tmp; + + START_OF_INSTR(); + DECODE_PRINTF("INTO\n"); + TRACE_AND_STEP(); + if (ACCESS_FLAG(F_OF)) { + tmp = mem_access_word(4 * 4 + 2); + if (_X86EMU_intrTab[4]) { + (*_X86EMU_intrTab[4])(4); + } else { + push_word((u16)M.x86.R_FLG); + CLEAR_FLAG(F_IF); + CLEAR_FLAG(F_TF); + push_word(M.x86.R_CS); + M.x86.R_CS = mem_access_word(4 * 4 + 2); + push_word(M.x86.R_IP); + M.x86.R_IP = mem_access_word(4 * 4); + } + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xcf +****************************************************************************/ +void x86emuOp_iret(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("IRET\n"); + + TRACE_AND_STEP(); + + M.x86.R_IP = pop_word(); + M.x86.R_CS = pop_word(); + M.x86.R_FLG = pop_word(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xd0 +****************************************************************************/ +void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg; + uint destoffset; + u8 destval; + + /* + * Yet another weirdo special case instruction format. Part of + * the opcode held below in "RH". Doubly nested case would + * result, except that the decoded instruction + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + switch (rh) { + case 0: + DECODE_PRINTF("ROL\t"); + break; + case 1: + DECODE_PRINTF("ROR\t"); + break; + case 2: + DECODE_PRINTF("RCL\t"); + break; + case 3: + DECODE_PRINTF("RCR\t"); + break; + case 4: + DECODE_PRINTF("SHL\t"); + break; + case 5: + DECODE_PRINTF("SHR\t"); + break; + case 6: + DECODE_PRINTF("SAL\t"); + break; + case 7: + DECODE_PRINTF("SAR\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + switch (mod) { + case 0: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, 1); + store_data_byte(destoffset, destval); + break; + case 1: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, 1); + store_data_byte(destoffset, destval); + break; + case 2: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, 1); + store_data_byte(destoffset, destval); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF(",1\n"); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (*destreg, 1); + *destreg = destval; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xd1 +****************************************************************************/ +void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + /* + * Yet another weirdo special case instruction format. Part of + * the opcode held below in "RH". Doubly nested case would + * result, except that the decoded instruction + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + switch (rh) { + case 0: + DECODE_PRINTF("ROL\t"); + break; + case 1: + DECODE_PRINTF("ROR\t"); + break; + case 2: + DECODE_PRINTF("RCL\t"); + break; + case 3: + DECODE_PRINTF("RCR\t"); + break; + case 4: + DECODE_PRINTF("SHL\t"); + break; + case 5: + DECODE_PRINTF("SHR\t"); + break; + case 6: + DECODE_PRINTF("SAL\t"); + break; + case 7: + DECODE_PRINTF("SAR\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, 1); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, 1); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, 1); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, 1); + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, 1); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(",1\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, 1); + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *destreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(",1\n"); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (*destreg, 1); + *destreg = destval; + } else { + u16 destval; + u16 *destreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(",1\n"); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (*destreg, 1); + *destreg = destval; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xd2 +****************************************************************************/ +void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg; + uint destoffset; + u8 destval; + u8 amt; + + /* + * Yet another weirdo special case instruction format. Part of + * the opcode held below in "RH". Doubly nested case would + * result, except that the decoded instruction + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + switch (rh) { + case 0: + DECODE_PRINTF("ROL\t"); + break; + case 1: + DECODE_PRINTF("ROR\t"); + break; + case 2: + DECODE_PRINTF("RCL\t"); + break; + case 3: + DECODE_PRINTF("RCR\t"); + break; + case 4: + DECODE_PRINTF("SHL\t"); + break; + case 5: + DECODE_PRINTF("SHR\t"); + break; + case 6: + DECODE_PRINTF("SAL\t"); + break; + case 7: + DECODE_PRINTF("SAR\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + amt = M.x86.R_CL; + switch (mod) { + case 0: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, amt); + store_data_byte(destoffset, destval); + break; + case 1: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, amt); + store_data_byte(destoffset, destval); + break; + case 2: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (destval, amt); + store_data_byte(destoffset, destval); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = (*opcD0_byte_operation[rh]) (*destreg, amt); + *destreg = destval; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xd3 +****************************************************************************/ +void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + u8 amt; + + /* + * Yet another weirdo special case instruction format. Part of + * the opcode held below in "RH". Doubly nested case would + * result, except that the decoded instruction + */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + switch (rh) { + case 0: + DECODE_PRINTF("ROL\t"); + break; + case 1: + DECODE_PRINTF("ROR\t"); + break; + case 2: + DECODE_PRINTF("RCL\t"); + break; + case 3: + DECODE_PRINTF("RCR\t"); + break; + case 4: + DECODE_PRINTF("SHL\t"); + break; + case 5: + DECODE_PRINTF("SHR\t"); + break; + case 6: + DECODE_PRINTF("SAL\t"); + break; + case 7: + DECODE_PRINTF("SAR\t"); + break; + } + } +#endif + /* know operation, decode the mod byte to find the addressing + mode. */ + amt = M.x86.R_CL; + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, amt); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, amt); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, amt); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, amt); + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_long_operation[rh]) (destval, amt); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("WORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(",CL\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = (*opcD1_word_operation[rh]) (destval, amt); + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + *destreg = (*opcD1_long_operation[rh]) (*destreg, amt); + } else { + u16 *destreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + *destreg = (*opcD1_word_operation[rh]) (*destreg, amt); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xd4 +****************************************************************************/ +void x86emuOp_aam(u8 X86EMU_UNUSED(op1)) +{ + u8 a; + + START_OF_INSTR(); + DECODE_PRINTF("AAM\n"); + a = fetch_byte_imm(); /* this is a stupid encoding. */ + if (a != 10) { + DECODE_PRINTF("ERROR DECODING AAM\n"); + TRACE_REGS(); + HALT_SYS(); + } + TRACE_AND_STEP(); + /* note the type change here --- returning AL and AH in AX. */ + M.x86.R_AX = aam_word(M.x86.R_AL); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xd5 +****************************************************************************/ +void x86emuOp_aad(u8 X86EMU_UNUSED(op1)) +{ + u8 a; + + START_OF_INSTR(); + DECODE_PRINTF("AAD\n"); + a = fetch_byte_imm(); + TRACE_AND_STEP(); + M.x86.R_AX = aad_word(M.x86.R_AX); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/* opcode 0xd6 ILLEGAL OPCODE */ + +/**************************************************************************** +REMARKS: +Handles opcode 0xd7 +****************************************************************************/ +void x86emuOp_xlat(u8 X86EMU_UNUSED(op1)) +{ + u16 addr; + + START_OF_INSTR(); + DECODE_PRINTF("XLAT\n"); + TRACE_AND_STEP(); + addr = (u16)(M.x86.R_BX + (u8)M.x86.R_AL); + M.x86.R_AL = fetch_data_byte(addr); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/* instuctions D8 .. DF are in i87_ops.c */ + +/**************************************************************************** +REMARKS: +Handles opcode 0xe0 +****************************************************************************/ +void x86emuOp_loopne(u8 X86EMU_UNUSED(op1)) +{ + s16 ip; + + START_OF_INSTR(); + DECODE_PRINTF("LOOPNE\t"); + ip = (s8) fetch_byte_imm(); + ip += (s16) M.x86.R_IP; + DECODE_PRINTF2("%04x\n", ip); + TRACE_AND_STEP(); + M.x86.R_CX -= 1; + if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */ + M.x86.R_IP = ip; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe1 +****************************************************************************/ +void x86emuOp_loope(u8 X86EMU_UNUSED(op1)) +{ + s16 ip; + + START_OF_INSTR(); + DECODE_PRINTF("LOOPE\t"); + ip = (s8) fetch_byte_imm(); + ip += (s16) M.x86.R_IP; + DECODE_PRINTF2("%04x\n", ip); + TRACE_AND_STEP(); + M.x86.R_CX -= 1; + if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */ + M.x86.R_IP = ip; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe2 +****************************************************************************/ +void x86emuOp_loop(u8 X86EMU_UNUSED(op1)) +{ + s16 ip; + + START_OF_INSTR(); + DECODE_PRINTF("LOOP\t"); + ip = (s8) fetch_byte_imm(); + ip += (s16) M.x86.R_IP; + DECODE_PRINTF2("%04x\n", ip); + TRACE_AND_STEP(); + M.x86.R_CX -= 1; + if (M.x86.R_CX != 0) + M.x86.R_IP = ip; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe3 +****************************************************************************/ +void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1)) +{ + u16 target; + s8 offset; + + /* jump to byte offset if overflow flag is set */ + START_OF_INSTR(); + DECODE_PRINTF("JCXZ\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + if (M.x86.R_CX == 0) + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe4 +****************************************************************************/ +void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 port; + + START_OF_INSTR(); + DECODE_PRINTF("IN\t"); + port = (u8) fetch_byte_imm(); + DECODE_PRINTF2("%x,AL\n", port); + TRACE_AND_STEP(); + M.x86.R_AL = (*sys_inb)(port); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe5 +****************************************************************************/ +void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1)) +{ + u8 port; + + START_OF_INSTR(); + DECODE_PRINTF("IN\t"); + port = (u8) fetch_byte_imm(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF2("EAX,%x\n", port); + } else { + DECODE_PRINTF2("AX,%x\n", port); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EAX = (*sys_inl)(port); + } else { + M.x86.R_AX = (*sys_inw)(port); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe6 +****************************************************************************/ +void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1)) +{ + u8 port; + + START_OF_INSTR(); + DECODE_PRINTF("OUT\t"); + port = (u8) fetch_byte_imm(); + DECODE_PRINTF2("%x,AL\n", port); + TRACE_AND_STEP(); + (*sys_outb)(port, M.x86.R_AL); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe7 +****************************************************************************/ +void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1)) +{ + u8 port; + + START_OF_INSTR(); + DECODE_PRINTF("OUT\t"); + port = (u8) fetch_byte_imm(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF2("%x,EAX\n", port); + } else { + DECODE_PRINTF2("%x,AX\n", port); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + (*sys_outl)(port, M.x86.R_EAX); + } else { + (*sys_outw)(port, M.x86.R_AX); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe8 +****************************************************************************/ +void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1)) +{ + s16 ip; + + START_OF_INSTR(); + DECODE_PRINTF("CALL\t"); + ip = (s16) fetch_word_imm(); + ip += (s16) M.x86.R_IP; /* CHECK SIGN */ + DECODE_PRINTF2("%04x\n", ip); + CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip, ""); + TRACE_AND_STEP(); + push_word(M.x86.R_IP); + M.x86.R_IP = ip; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xe9 +****************************************************************************/ +void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1)) +{ + int ip; + + START_OF_INSTR(); + DECODE_PRINTF("JMP\t"); + ip = (s16)fetch_word_imm(); + ip += (s16)M.x86.R_IP; + DECODE_PRINTF2("%04x\n", ip); + TRACE_AND_STEP(); + M.x86.R_IP = (u16)ip; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xea +****************************************************************************/ +void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 cs, ip; + + START_OF_INSTR(); + DECODE_PRINTF("JMP\tFAR "); + ip = fetch_word_imm(); + cs = fetch_word_imm(); + DECODE_PRINTF2("%04x:", cs); + DECODE_PRINTF2("%04x\n", ip); + TRACE_AND_STEP(); + M.x86.R_IP = ip; + M.x86.R_CS = cs; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xeb +****************************************************************************/ +void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1)) +{ + u16 target; + s8 offset; + + START_OF_INSTR(); + DECODE_PRINTF("JMP\t"); + offset = (s8)fetch_byte_imm(); + target = (u16)(M.x86.R_IP + offset); + DECODE_PRINTF2("%x\n", target); + TRACE_AND_STEP(); + M.x86.R_IP = target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xec +****************************************************************************/ +void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("IN\tAL,DX\n"); + TRACE_AND_STEP(); + M.x86.R_AL = (*sys_inb)(M.x86.R_DX); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xed +****************************************************************************/ +void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("IN\tEAX,DX\n"); + } else { + DECODE_PRINTF("IN\tAX,DX\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_EAX = (*sys_inl)(M.x86.R_DX); + } else { + M.x86.R_AX = (*sys_inw)(M.x86.R_DX); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xee +****************************************************************************/ +void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("OUT\tDX,AL\n"); + TRACE_AND_STEP(); + (*sys_outb)(M.x86.R_DX, M.x86.R_AL); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xef +****************************************************************************/ +void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("OUT\tDX,EAX\n"); + } else { + DECODE_PRINTF("OUT\tDX,AX\n"); + } + TRACE_AND_STEP(); + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + (*sys_outl)(M.x86.R_DX, M.x86.R_EAX); + } else { + (*sys_outw)(M.x86.R_DX, M.x86.R_AX); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xf0 +****************************************************************************/ +void x86emuOp_lock(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("LOCK:\n"); + TRACE_AND_STEP(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/*opcode 0xf1 ILLEGAL OPERATION */ + +/**************************************************************************** +REMARKS: +Handles opcode 0xf2 +****************************************************************************/ +void x86emuOp_repne(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("REPNE\n"); + TRACE_AND_STEP(); + M.x86.mode |= SYSMODE_PREFIX_REPNE; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xf3 +****************************************************************************/ +void x86emuOp_repe(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("REPE\n"); + TRACE_AND_STEP(); + M.x86.mode |= SYSMODE_PREFIX_REPE; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xf4 +****************************************************************************/ +void x86emuOp_halt(u8 X86EMU_UNUSED(op1)) +{ + START_OF_INSTR(); + DECODE_PRINTF("HALT\n"); + TRACE_AND_STEP(); + HALT_SYS(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xf5 +****************************************************************************/ +void x86emuOp_cmc(u8 X86EMU_UNUSED(op1)) +{ + /* complement the carry flag. */ + START_OF_INSTR(); + DECODE_PRINTF("CMC\n"); + TRACE_AND_STEP(); + TOGGLE_FLAG(F_CF); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xf6 +****************************************************************************/ +void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + u8 *destreg; + uint destoffset; + u8 destval, srcval; + + /* long, drawn out code follows. Double switch for a total + of 32 cases. */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: /* mod=00 */ + switch (rh) { + case 0: /* test byte imm */ + DECODE_PRINTF("TEST\tBYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + srcval = fetch_byte_imm(); + DECODE_PRINTF2("%02x\n", srcval); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + test_byte(destval, srcval); + break; + case 1: + DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n"); + HALT_SYS(); + break; + case 2: + DECODE_PRINTF("NOT\tBYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = not_byte(destval); + store_data_byte(destoffset, destval); + break; + case 3: + DECODE_PRINTF("NEG\tBYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = neg_byte(destval); + store_data_byte(destoffset, destval); + break; + case 4: + DECODE_PRINTF("MUL\tBYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + mul_byte(destval); + break; + case 5: + DECODE_PRINTF("IMUL\tBYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + imul_byte(destval); + break; + case 6: + DECODE_PRINTF("DIV\tBYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + div_byte(destval); + break; + case 7: + DECODE_PRINTF("IDIV\tBYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + idiv_byte(destval); + break; + } + break; /* end mod==00 */ + case 1: /* mod=01 */ + switch (rh) { + case 0: /* test byte imm */ + DECODE_PRINTF("TEST\tBYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + srcval = fetch_byte_imm(); + DECODE_PRINTF2("%02x\n", srcval); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + test_byte(destval, srcval); + break; + case 1: + DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n"); + HALT_SYS(); + break; + case 2: + DECODE_PRINTF("NOT\tBYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = not_byte(destval); + store_data_byte(destoffset, destval); + break; + case 3: + DECODE_PRINTF("NEG\tBYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = neg_byte(destval); + store_data_byte(destoffset, destval); + break; + case 4: + DECODE_PRINTF("MUL\tBYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + mul_byte(destval); + break; + case 5: + DECODE_PRINTF("IMUL\tBYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + imul_byte(destval); + break; + case 6: + DECODE_PRINTF("DIV\tBYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + div_byte(destval); + break; + case 7: + DECODE_PRINTF("IDIV\tBYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + idiv_byte(destval); + break; + } + break; /* end mod==01 */ + case 2: /* mod=10 */ + switch (rh) { + case 0: /* test byte imm */ + DECODE_PRINTF("TEST\tBYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + srcval = fetch_byte_imm(); + DECODE_PRINTF2("%02x\n", srcval); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + test_byte(destval, srcval); + break; + case 1: + DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n"); + HALT_SYS(); + break; + case 2: + DECODE_PRINTF("NOT\tBYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = not_byte(destval); + store_data_byte(destoffset, destval); + break; + case 3: + DECODE_PRINTF("NEG\tBYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = neg_byte(destval); + store_data_byte(destoffset, destval); + break; + case 4: + DECODE_PRINTF("MUL\tBYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + mul_byte(destval); + break; + case 5: + DECODE_PRINTF("IMUL\tBYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + imul_byte(destval); + break; + case 6: + DECODE_PRINTF("DIV\tBYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + div_byte(destval); + break; + case 7: + DECODE_PRINTF("IDIV\tBYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + idiv_byte(destval); + break; + } + break; /* end mod==10 */ + case 3: /* mod=11 */ + switch (rh) { + case 0: /* test byte imm */ + DECODE_PRINTF("TEST\t"); + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF(","); + srcval = fetch_byte_imm(); + DECODE_PRINTF2("%02x\n", srcval); + TRACE_AND_STEP(); + test_byte(*destreg, srcval); + break; + case 1: + DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n"); + HALT_SYS(); + break; + case 2: + DECODE_PRINTF("NOT\t"); + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = not_byte(*destreg); + break; + case 3: + DECODE_PRINTF("NEG\t"); + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = neg_byte(*destreg); + break; + case 4: + DECODE_PRINTF("MUL\t"); + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + mul_byte(*destreg); /*!!! */ + break; + case 5: + DECODE_PRINTF("IMUL\t"); + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + imul_byte(*destreg); + break; + case 6: + DECODE_PRINTF("DIV\t"); + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + div_byte(*destreg); + break; + case 7: + DECODE_PRINTF("IDIV\t"); + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + idiv_byte(*destreg); + break; + } + break; /* end mod==11 */ + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xf7 +****************************************************************************/ +void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rl, rh; + uint destoffset; + + /* long, drawn out code follows. Double switch for a total + of 32 cases. */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: /* mod=00 */ + switch (rh) { + case 0: /* test word imm */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,srcval; + + DECODE_PRINTF("TEST\tDWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + srcval = fetch_long_imm(); + DECODE_PRINTF2("%x\n", srcval); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + test_long(destval, srcval); + } else { + u16 destval,srcval; + + DECODE_PRINTF("TEST\tWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + srcval = fetch_word_imm(); + DECODE_PRINTF2("%x\n", srcval); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + test_word(destval, srcval); + } + break; + case 1: + DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F7\n"); + HALT_SYS(); + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("NOT\tDWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = not_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("NOT\tWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = not_word(destval); + store_data_word(destoffset, destval); + } + break; + case 3: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("NEG\tDWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = neg_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("NEG\tWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = neg_word(destval); + store_data_word(destoffset, destval); + } + break; + case 4: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("MUL\tDWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + mul_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("MUL\tWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + mul_word(destval); + } + break; + case 5: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("IMUL\tDWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + imul_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("IMUL\tWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + imul_word(destval); + } + break; + case 6: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DIV\tDWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + div_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("DIV\tWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + div_word(destval); + } + break; + case 7: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("IDIV\tDWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + idiv_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("IDIV\tWORD PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + idiv_word(destval); + } + break; + } + break; /* end mod==00 */ + case 1: /* mod=01 */ + switch (rh) { + case 0: /* test word imm */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,srcval; + + DECODE_PRINTF("TEST\tDWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + srcval = fetch_long_imm(); + DECODE_PRINTF2("%x\n", srcval); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + test_long(destval, srcval); + } else { + u16 destval,srcval; + + DECODE_PRINTF("TEST\tWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + srcval = fetch_word_imm(); + DECODE_PRINTF2("%x\n", srcval); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + test_word(destval, srcval); + } + break; + case 1: + DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n"); + HALT_SYS(); + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("NOT\tDWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = not_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("NOT\tWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = not_word(destval); + store_data_word(destoffset, destval); + } + break; + case 3: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("NEG\tDWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = neg_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("NEG\tWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = neg_word(destval); + store_data_word(destoffset, destval); + } + break; + case 4: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("MUL\tDWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + mul_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("MUL\tWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + mul_word(destval); + } + break; + case 5: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("IMUL\tDWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + imul_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("IMUL\tWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + imul_word(destval); + } + break; + case 6: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DIV\tDWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + div_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("DIV\tWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + div_word(destval); + } + break; + case 7: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("IDIV\tDWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + idiv_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("IDIV\tWORD PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + idiv_word(destval); + } + break; + } + break; /* end mod==01 */ + case 2: /* mod=10 */ + switch (rh) { + case 0: /* test word imm */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval,srcval; + + DECODE_PRINTF("TEST\tDWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + srcval = fetch_long_imm(); + DECODE_PRINTF2("%x\n", srcval); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + test_long(destval, srcval); + } else { + u16 destval,srcval; + + DECODE_PRINTF("TEST\tWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + srcval = fetch_word_imm(); + DECODE_PRINTF2("%x\n", srcval); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + test_word(destval, srcval); + } + break; + case 1: + DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n"); + HALT_SYS(); + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("NOT\tDWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = not_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("NOT\tWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = not_word(destval); + store_data_word(destoffset, destval); + } + break; + case 3: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("NEG\tDWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = neg_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + DECODE_PRINTF("NEG\tWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = neg_word(destval); + store_data_word(destoffset, destval); + } + break; + case 4: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("MUL\tDWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + mul_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("MUL\tWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + mul_word(destval); + } + break; + case 5: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("IMUL\tDWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + imul_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("IMUL\tWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + imul_word(destval); + } + break; + case 6: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("DIV\tDWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + div_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("DIV\tWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + div_word(destval); + } + break; + case 7: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + DECODE_PRINTF("IDIV\tDWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + idiv_long(destval); + } else { + u16 destval; + + DECODE_PRINTF("IDIV\tWORD PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + idiv_word(destval); + } + break; + } + break; /* end mod==10 */ + case 3: /* mod=11 */ + switch (rh) { + case 0: /* test word imm */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + DECODE_PRINTF("TEST\t"); + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + srcval = fetch_long_imm(); + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + test_long(*destreg, srcval); + } else { + u16 *destreg; + u16 srcval; + + DECODE_PRINTF("TEST\t"); + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + srcval = fetch_word_imm(); + DECODE_PRINTF2("%x\n", srcval); + TRACE_AND_STEP(); + test_word(*destreg, srcval); + } + break; + case 1: + DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n"); + HALT_SYS(); + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + DECODE_PRINTF("NOT\t"); + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = not_long(*destreg); + } else { + u16 *destreg; + + DECODE_PRINTF("NOT\t"); + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = not_word(*destreg); + } + break; + case 3: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + DECODE_PRINTF("NEG\t"); + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = neg_long(*destreg); + } else { + u16 *destreg; + + DECODE_PRINTF("NEG\t"); + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = neg_word(*destreg); + } + break; + case 4: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + DECODE_PRINTF("MUL\t"); + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + mul_long(*destreg); /*!!! */ + } else { + u16 *destreg; + + DECODE_PRINTF("MUL\t"); + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + mul_word(*destreg); /*!!! */ + } + break; + case 5: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + DECODE_PRINTF("IMUL\t"); + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + imul_long(*destreg); + } else { + u16 *destreg; + + DECODE_PRINTF("IMUL\t"); + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + imul_word(*destreg); + } + break; + case 6: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + DECODE_PRINTF("DIV\t"); + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + div_long(*destreg); + } else { + u16 *destreg; + + DECODE_PRINTF("DIV\t"); + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + div_word(*destreg); + } + break; + case 7: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + DECODE_PRINTF("IDIV\t"); + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + idiv_long(*destreg); + } else { + u16 *destreg; + + DECODE_PRINTF("IDIV\t"); + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + idiv_word(*destreg); + } + break; + } + break; /* end mod==11 */ + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xf8 +****************************************************************************/ +void x86emuOp_clc(u8 X86EMU_UNUSED(op1)) +{ + /* clear the carry flag. */ + START_OF_INSTR(); + DECODE_PRINTF("CLC\n"); + TRACE_AND_STEP(); + CLEAR_FLAG(F_CF); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xf9 +****************************************************************************/ +void x86emuOp_stc(u8 X86EMU_UNUSED(op1)) +{ + /* set the carry flag. */ + START_OF_INSTR(); + DECODE_PRINTF("STC\n"); + TRACE_AND_STEP(); + SET_FLAG(F_CF); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xfa +****************************************************************************/ +void x86emuOp_cli(u8 X86EMU_UNUSED(op1)) +{ + /* clear interrupts. */ + START_OF_INSTR(); + DECODE_PRINTF("CLI\n"); + TRACE_AND_STEP(); + CLEAR_FLAG(F_IF); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xfb +****************************************************************************/ +void x86emuOp_sti(u8 X86EMU_UNUSED(op1)) +{ + /* enable interrupts. */ + START_OF_INSTR(); + DECODE_PRINTF("STI\n"); + TRACE_AND_STEP(); + SET_FLAG(F_IF); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xfc +****************************************************************************/ +void x86emuOp_cld(u8 X86EMU_UNUSED(op1)) +{ + /* clear interrupts. */ + START_OF_INSTR(); + DECODE_PRINTF("CLD\n"); + TRACE_AND_STEP(); + CLEAR_FLAG(F_DF); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xfd +****************************************************************************/ +void x86emuOp_std(u8 X86EMU_UNUSED(op1)) +{ + /* clear interrupts. */ + START_OF_INSTR(); + DECODE_PRINTF("STD\n"); + TRACE_AND_STEP(); + SET_FLAG(F_DF); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xfe +****************************************************************************/ +void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rh, rl; + u8 destval; + uint destoffset; + u8 *destreg; + + /* Yet another special case instruction. */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + + switch (rh) { + case 0: + DECODE_PRINTF("INC\t"); + break; + case 1: + DECODE_PRINTF("DEC\t"); + break; + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + DECODE_PRINTF2("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x \n", mod); + HALT_SYS(); + break; + } + } +#endif + switch (mod) { + case 0: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + switch (rh) { + case 0: /* inc word ptr ... */ + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = inc_byte(destval); + store_data_byte(destoffset, destval); + break; + case 1: /* dec word ptr ... */ + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = dec_byte(destval); + store_data_byte(destoffset, destval); + break; + } + break; + case 1: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + switch (rh) { + case 0: + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = inc_byte(destval); + store_data_byte(destoffset, destval); + break; + case 1: + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = dec_byte(destval); + store_data_byte(destoffset, destval); + break; + } + break; + case 2: + DECODE_PRINTF("BYTE PTR "); + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + switch (rh) { + case 0: + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = inc_byte(destval); + store_data_byte(destoffset, destval); + break; + case 1: + destval = fetch_data_byte(destoffset); + TRACE_AND_STEP(); + destval = dec_byte(destval); + store_data_byte(destoffset, destval); + break; + } + break; + case 3: + destreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + switch (rh) { + case 0: + TRACE_AND_STEP(); + *destreg = inc_byte(*destreg); + break; + case 1: + TRACE_AND_STEP(); + *destreg = dec_byte(*destreg); + break; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0xff +****************************************************************************/ +void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1)) +{ + int mod, rh, rl; + uint destoffset = 0; + u16 *destreg; + u16 destval,destval2; + + /* Yet another special case instruction. */ + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); +#ifdef DEBUG + if (DEBUG_DECODE()) { + /* XXX DECODE_PRINTF may be changed to something more + general, so that it is important to leave the strings + in the same format, even though the result is that the + above test is done twice. */ + + switch (rh) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("INC\tDWORD PTR "); + } else { + DECODE_PRINTF("INC\tWORD PTR "); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + DECODE_PRINTF("DEC\tDWORD PTR "); + } else { + DECODE_PRINTF("DEC\tWORD PTR "); + } + break; + case 2: + DECODE_PRINTF("CALL\t "); + break; + case 3: + DECODE_PRINTF("CALL\tFAR "); + break; + case 4: + DECODE_PRINTF("JMP\t"); + break; + case 5: + DECODE_PRINTF("JMP\tFAR "); + break; + case 6: + DECODE_PRINTF("PUSH\t"); + break; + case 7: + DECODE_PRINTF("ILLEGAL DECODING OF OPCODE FF\t"); + HALT_SYS(); + break; + } + } +#endif + switch (mod) { + case 0: + destoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + switch (rh) { + case 0: /* inc word ptr ... */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = inc_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = inc_word(destval); + store_data_word(destoffset, destval); + } + break; + case 1: /* dec word ptr ... */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = dec_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = dec_word(destval); + store_data_word(destoffset, destval); + } + break; + case 2: /* call word ptr ... */ + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + push_word(M.x86.R_IP); + M.x86.R_IP = destval; + break; + case 3: /* call far ptr ... */ + destval = fetch_data_word(destoffset); + destval2 = fetch_data_word(destoffset + 2); + TRACE_AND_STEP(); + push_word(M.x86.R_CS); + M.x86.R_CS = destval2; + push_word(M.x86.R_IP); + M.x86.R_IP = destval; + break; + case 4: /* jmp word ptr ... */ + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + M.x86.R_IP = destval; + break; + case 5: /* jmp far ptr ... */ + destval = fetch_data_word(destoffset); + destval2 = fetch_data_word(destoffset + 2); + TRACE_AND_STEP(); + M.x86.R_IP = destval; + M.x86.R_CS = destval2; + break; + case 6: /* push word ptr ... */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + push_long(destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + push_word(destval); + } + break; + } + break; + case 1: + destoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + switch (rh) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = inc_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = inc_word(destval); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = dec_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = dec_word(destval); + store_data_word(destoffset, destval); + } + break; + case 2: /* call word ptr ... */ + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + push_word(M.x86.R_IP); + M.x86.R_IP = destval; + break; + case 3: /* call far ptr ... */ + destval = fetch_data_word(destoffset); + destval2 = fetch_data_word(destoffset + 2); + TRACE_AND_STEP(); + push_word(M.x86.R_CS); + M.x86.R_CS = destval2; + push_word(M.x86.R_IP); + M.x86.R_IP = destval; + break; + case 4: /* jmp word ptr ... */ + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + M.x86.R_IP = destval; + break; + case 5: /* jmp far ptr ... */ + destval = fetch_data_word(destoffset); + destval2 = fetch_data_word(destoffset + 2); + TRACE_AND_STEP(); + M.x86.R_IP = destval; + M.x86.R_CS = destval2; + break; + case 6: /* push word ptr ... */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + push_long(destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + push_word(destval); + } + break; + } + break; + case 2: + destoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + switch (rh) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = inc_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = inc_word(destval); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + destval = dec_long(destval); + store_data_long(destoffset, destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + destval = dec_word(destval); + store_data_word(destoffset, destval); + } + break; + case 2: /* call word ptr ... */ + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + push_word(M.x86.R_IP); + M.x86.R_IP = destval; + break; + case 3: /* call far ptr ... */ + destval = fetch_data_word(destoffset); + destval2 = fetch_data_word(destoffset + 2); + TRACE_AND_STEP(); + push_word(M.x86.R_CS); + M.x86.R_CS = destval2; + push_word(M.x86.R_IP); + M.x86.R_IP = destval; + break; + case 4: /* jmp word ptr ... */ + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + M.x86.R_IP = destval; + break; + case 5: /* jmp far ptr ... */ + destval = fetch_data_word(destoffset); + destval2 = fetch_data_word(destoffset + 2); + TRACE_AND_STEP(); + M.x86.R_IP = destval; + M.x86.R_CS = destval2; + break; + case 6: /* push word ptr ... */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + + destval = fetch_data_long(destoffset); + TRACE_AND_STEP(); + push_long(destval); + } else { + u16 destval; + + destval = fetch_data_word(destoffset); + TRACE_AND_STEP(); + push_word(destval); + } + break; + } + break; + case 3: + switch (rh) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = inc_long(*destreg); + } else { + u16 *destreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = inc_word(*destreg); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = dec_long(*destreg); + } else { + u16 *destreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = dec_word(*destreg); + } + break; + case 2: /* call word ptr ... */ + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + push_word(M.x86.R_IP); + M.x86.R_IP = *destreg; + break; + case 3: /* jmp far ptr ... */ + DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n"); + TRACE_AND_STEP(); + HALT_SYS(); + break; + + case 4: /* jmp ... */ + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + M.x86.R_IP = (u16) (*destreg); + break; + case 5: /* jmp far ptr ... */ + DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n"); + TRACE_AND_STEP(); + HALT_SYS(); + break; + case 6: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + push_long(*destreg); + } else { + u16 *destreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + push_word(*destreg); + } + break; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/*************************************************************************** + * Single byte operation code table: + **************************************************************************/ +void (*x86emu_optab[256])(u8) = +{ +/* 0x00 */ x86emuOp_add_byte_RM_R, +/* 0x01 */ x86emuOp_add_word_RM_R, +/* 0x02 */ x86emuOp_add_byte_R_RM, +/* 0x03 */ x86emuOp_add_word_R_RM, +/* 0x04 */ x86emuOp_add_byte_AL_IMM, +/* 0x05 */ x86emuOp_add_word_AX_IMM, +/* 0x06 */ x86emuOp_push_ES, +/* 0x07 */ x86emuOp_pop_ES, + +/* 0x08 */ x86emuOp_or_byte_RM_R, +/* 0x09 */ x86emuOp_or_word_RM_R, +/* 0x0a */ x86emuOp_or_byte_R_RM, +/* 0x0b */ x86emuOp_or_word_R_RM, +/* 0x0c */ x86emuOp_or_byte_AL_IMM, +/* 0x0d */ x86emuOp_or_word_AX_IMM, +/* 0x0e */ x86emuOp_push_CS, +/* 0x0f */ x86emuOp_two_byte, + +/* 0x10 */ x86emuOp_adc_byte_RM_R, +/* 0x11 */ x86emuOp_adc_word_RM_R, +/* 0x12 */ x86emuOp_adc_byte_R_RM, +/* 0x13 */ x86emuOp_adc_word_R_RM, +/* 0x14 */ x86emuOp_adc_byte_AL_IMM, +/* 0x15 */ x86emuOp_adc_word_AX_IMM, +/* 0x16 */ x86emuOp_push_SS, +/* 0x17 */ x86emuOp_pop_SS, + +/* 0x18 */ x86emuOp_sbb_byte_RM_R, +/* 0x19 */ x86emuOp_sbb_word_RM_R, +/* 0x1a */ x86emuOp_sbb_byte_R_RM, +/* 0x1b */ x86emuOp_sbb_word_R_RM, +/* 0x1c */ x86emuOp_sbb_byte_AL_IMM, +/* 0x1d */ x86emuOp_sbb_word_AX_IMM, +/* 0x1e */ x86emuOp_push_DS, +/* 0x1f */ x86emuOp_pop_DS, + +/* 0x20 */ x86emuOp_and_byte_RM_R, +/* 0x21 */ x86emuOp_and_word_RM_R, +/* 0x22 */ x86emuOp_and_byte_R_RM, +/* 0x23 */ x86emuOp_and_word_R_RM, +/* 0x24 */ x86emuOp_and_byte_AL_IMM, +/* 0x25 */ x86emuOp_and_word_AX_IMM, +/* 0x26 */ x86emuOp_segovr_ES, +/* 0x27 */ x86emuOp_daa, + +/* 0x28 */ x86emuOp_sub_byte_RM_R, +/* 0x29 */ x86emuOp_sub_word_RM_R, +/* 0x2a */ x86emuOp_sub_byte_R_RM, +/* 0x2b */ x86emuOp_sub_word_R_RM, +/* 0x2c */ x86emuOp_sub_byte_AL_IMM, +/* 0x2d */ x86emuOp_sub_word_AX_IMM, +/* 0x2e */ x86emuOp_segovr_CS, +/* 0x2f */ x86emuOp_das, + +/* 0x30 */ x86emuOp_xor_byte_RM_R, +/* 0x31 */ x86emuOp_xor_word_RM_R, +/* 0x32 */ x86emuOp_xor_byte_R_RM, +/* 0x33 */ x86emuOp_xor_word_R_RM, +/* 0x34 */ x86emuOp_xor_byte_AL_IMM, +/* 0x35 */ x86emuOp_xor_word_AX_IMM, +/* 0x36 */ x86emuOp_segovr_SS, +/* 0x37 */ x86emuOp_aaa, + +/* 0x38 */ x86emuOp_cmp_byte_RM_R, +/* 0x39 */ x86emuOp_cmp_word_RM_R, +/* 0x3a */ x86emuOp_cmp_byte_R_RM, +/* 0x3b */ x86emuOp_cmp_word_R_RM, +/* 0x3c */ x86emuOp_cmp_byte_AL_IMM, +/* 0x3d */ x86emuOp_cmp_word_AX_IMM, +/* 0x3e */ x86emuOp_segovr_DS, +/* 0x3f */ x86emuOp_aas, + +/* 0x40 */ x86emuOp_inc_AX, +/* 0x41 */ x86emuOp_inc_CX, +/* 0x42 */ x86emuOp_inc_DX, +/* 0x43 */ x86emuOp_inc_BX, +/* 0x44 */ x86emuOp_inc_SP, +/* 0x45 */ x86emuOp_inc_BP, +/* 0x46 */ x86emuOp_inc_SI, +/* 0x47 */ x86emuOp_inc_DI, + +/* 0x48 */ x86emuOp_dec_AX, +/* 0x49 */ x86emuOp_dec_CX, +/* 0x4a */ x86emuOp_dec_DX, +/* 0x4b */ x86emuOp_dec_BX, +/* 0x4c */ x86emuOp_dec_SP, +/* 0x4d */ x86emuOp_dec_BP, +/* 0x4e */ x86emuOp_dec_SI, +/* 0x4f */ x86emuOp_dec_DI, + +/* 0x50 */ x86emuOp_push_AX, +/* 0x51 */ x86emuOp_push_CX, +/* 0x52 */ x86emuOp_push_DX, +/* 0x53 */ x86emuOp_push_BX, +/* 0x54 */ x86emuOp_push_SP, +/* 0x55 */ x86emuOp_push_BP, +/* 0x56 */ x86emuOp_push_SI, +/* 0x57 */ x86emuOp_push_DI, + +/* 0x58 */ x86emuOp_pop_AX, +/* 0x59 */ x86emuOp_pop_CX, +/* 0x5a */ x86emuOp_pop_DX, +/* 0x5b */ x86emuOp_pop_BX, +/* 0x5c */ x86emuOp_pop_SP, +/* 0x5d */ x86emuOp_pop_BP, +/* 0x5e */ x86emuOp_pop_SI, +/* 0x5f */ x86emuOp_pop_DI, + +/* 0x60 */ x86emuOp_push_all, +/* 0x61 */ x86emuOp_pop_all, +/* 0x62 */ x86emuOp_illegal_op, /* bound */ +/* 0x63 */ x86emuOp_illegal_op, /* arpl */ +/* 0x64 */ x86emuOp_segovr_FS, +/* 0x65 */ x86emuOp_segovr_GS, +/* 0x66 */ x86emuOp_prefix_data, +/* 0x67 */ x86emuOp_prefix_addr, + +/* 0x68 */ x86emuOp_push_word_IMM, +/* 0x69 */ x86emuOp_imul_word_IMM, +/* 0x6a */ x86emuOp_push_byte_IMM, +/* 0x6b */ x86emuOp_imul_byte_IMM, +/* 0x6c */ x86emuOp_ins_byte, +/* 0x6d */ x86emuOp_ins_word, +/* 0x6e */ x86emuOp_outs_byte, +/* 0x6f */ x86emuOp_outs_word, + +/* 0x70 */ x86emuOp_jump_near_O, +/* 0x71 */ x86emuOp_jump_near_NO, +/* 0x72 */ x86emuOp_jump_near_B, +/* 0x73 */ x86emuOp_jump_near_NB, +/* 0x74 */ x86emuOp_jump_near_Z, +/* 0x75 */ x86emuOp_jump_near_NZ, +/* 0x76 */ x86emuOp_jump_near_BE, +/* 0x77 */ x86emuOp_jump_near_NBE, + +/* 0x78 */ x86emuOp_jump_near_S, +/* 0x79 */ x86emuOp_jump_near_NS, +/* 0x7a */ x86emuOp_jump_near_P, +/* 0x7b */ x86emuOp_jump_near_NP, +/* 0x7c */ x86emuOp_jump_near_L, +/* 0x7d */ x86emuOp_jump_near_NL, +/* 0x7e */ x86emuOp_jump_near_LE, +/* 0x7f */ x86emuOp_jump_near_NLE, + +/* 0x80 */ x86emuOp_opc80_byte_RM_IMM, +/* 0x81 */ x86emuOp_opc81_word_RM_IMM, +/* 0x82 */ x86emuOp_opc82_byte_RM_IMM, +/* 0x83 */ x86emuOp_opc83_word_RM_IMM, +/* 0x84 */ x86emuOp_test_byte_RM_R, +/* 0x85 */ x86emuOp_test_word_RM_R, +/* 0x86 */ x86emuOp_xchg_byte_RM_R, +/* 0x87 */ x86emuOp_xchg_word_RM_R, + +/* 0x88 */ x86emuOp_mov_byte_RM_R, +/* 0x89 */ x86emuOp_mov_word_RM_R, +/* 0x8a */ x86emuOp_mov_byte_R_RM, +/* 0x8b */ x86emuOp_mov_word_R_RM, +/* 0x8c */ x86emuOp_mov_word_RM_SR, +/* 0x8d */ x86emuOp_lea_word_R_M, +/* 0x8e */ x86emuOp_mov_word_SR_RM, +/* 0x8f */ x86emuOp_pop_RM, + +/* 0x90 */ x86emuOp_nop, +/* 0x91 */ x86emuOp_xchg_word_AX_CX, +/* 0x92 */ x86emuOp_xchg_word_AX_DX, +/* 0x93 */ x86emuOp_xchg_word_AX_BX, +/* 0x94 */ x86emuOp_xchg_word_AX_SP, +/* 0x95 */ x86emuOp_xchg_word_AX_BP, +/* 0x96 */ x86emuOp_xchg_word_AX_SI, +/* 0x97 */ x86emuOp_xchg_word_AX_DI, + +/* 0x98 */ x86emuOp_cbw, +/* 0x99 */ x86emuOp_cwd, +/* 0x9a */ x86emuOp_call_far_IMM, +/* 0x9b */ x86emuOp_wait, +/* 0x9c */ x86emuOp_pushf_word, +/* 0x9d */ x86emuOp_popf_word, +/* 0x9e */ x86emuOp_sahf, +/* 0x9f */ x86emuOp_lahf, + +/* 0xa0 */ x86emuOp_mov_AL_M_IMM, +/* 0xa1 */ x86emuOp_mov_AX_M_IMM, +/* 0xa2 */ x86emuOp_mov_M_AL_IMM, +/* 0xa3 */ x86emuOp_mov_M_AX_IMM, +/* 0xa4 */ x86emuOp_movs_byte, +/* 0xa5 */ x86emuOp_movs_word, +/* 0xa6 */ x86emuOp_cmps_byte, +/* 0xa7 */ x86emuOp_cmps_word, +/* 0xa8 */ x86emuOp_test_AL_IMM, +/* 0xa9 */ x86emuOp_test_AX_IMM, +/* 0xaa */ x86emuOp_stos_byte, +/* 0xab */ x86emuOp_stos_word, +/* 0xac */ x86emuOp_lods_byte, +/* 0xad */ x86emuOp_lods_word, +/* 0xac */ x86emuOp_scas_byte, +/* 0xad */ x86emuOp_scas_word, + + +/* 0xb0 */ x86emuOp_mov_byte_AL_IMM, +/* 0xb1 */ x86emuOp_mov_byte_CL_IMM, +/* 0xb2 */ x86emuOp_mov_byte_DL_IMM, +/* 0xb3 */ x86emuOp_mov_byte_BL_IMM, +/* 0xb4 */ x86emuOp_mov_byte_AH_IMM, +/* 0xb5 */ x86emuOp_mov_byte_CH_IMM, +/* 0xb6 */ x86emuOp_mov_byte_DH_IMM, +/* 0xb7 */ x86emuOp_mov_byte_BH_IMM, + +/* 0xb8 */ x86emuOp_mov_word_AX_IMM, +/* 0xb9 */ x86emuOp_mov_word_CX_IMM, +/* 0xba */ x86emuOp_mov_word_DX_IMM, +/* 0xbb */ x86emuOp_mov_word_BX_IMM, +/* 0xbc */ x86emuOp_mov_word_SP_IMM, +/* 0xbd */ x86emuOp_mov_word_BP_IMM, +/* 0xbe */ x86emuOp_mov_word_SI_IMM, +/* 0xbf */ x86emuOp_mov_word_DI_IMM, + +/* 0xc0 */ x86emuOp_opcC0_byte_RM_MEM, +/* 0xc1 */ x86emuOp_opcC1_word_RM_MEM, +/* 0xc2 */ x86emuOp_ret_near_IMM, +/* 0xc3 */ x86emuOp_ret_near, +/* 0xc4 */ x86emuOp_les_R_IMM, +/* 0xc5 */ x86emuOp_lds_R_IMM, +/* 0xc6 */ x86emuOp_mov_byte_RM_IMM, +/* 0xc7 */ x86emuOp_mov_word_RM_IMM, +/* 0xc8 */ x86emuOp_enter, +/* 0xc9 */ x86emuOp_leave, +/* 0xca */ x86emuOp_ret_far_IMM, +/* 0xcb */ x86emuOp_ret_far, +/* 0xcc */ x86emuOp_int3, +/* 0xcd */ x86emuOp_int_IMM, +/* 0xce */ x86emuOp_into, +/* 0xcf */ x86emuOp_iret, + +/* 0xd0 */ x86emuOp_opcD0_byte_RM_1, +/* 0xd1 */ x86emuOp_opcD1_word_RM_1, +/* 0xd2 */ x86emuOp_opcD2_byte_RM_CL, +/* 0xd3 */ x86emuOp_opcD3_word_RM_CL, +/* 0xd4 */ x86emuOp_aam, +/* 0xd5 */ x86emuOp_aad, +/* 0xd6 */ x86emuOp_illegal_op, /* Undocumented SETALC instruction */ +/* 0xd7 */ x86emuOp_xlat, +/* 0xd8 */ x86emuOp_esc_coprocess_d8, +/* 0xd9 */ x86emuOp_esc_coprocess_d9, +/* 0xda */ x86emuOp_esc_coprocess_da, +/* 0xdb */ x86emuOp_esc_coprocess_db, +/* 0xdc */ x86emuOp_esc_coprocess_dc, +/* 0xdd */ x86emuOp_esc_coprocess_dd, +/* 0xde */ x86emuOp_esc_coprocess_de, +/* 0xdf */ x86emuOp_esc_coprocess_df, + +/* 0xe0 */ x86emuOp_loopne, +/* 0xe1 */ x86emuOp_loope, +/* 0xe2 */ x86emuOp_loop, +/* 0xe3 */ x86emuOp_jcxz, +/* 0xe4 */ x86emuOp_in_byte_AL_IMM, +/* 0xe5 */ x86emuOp_in_word_AX_IMM, +/* 0xe6 */ x86emuOp_out_byte_IMM_AL, +/* 0xe7 */ x86emuOp_out_word_IMM_AX, + +/* 0xe8 */ x86emuOp_call_near_IMM, +/* 0xe9 */ x86emuOp_jump_near_IMM, +/* 0xea */ x86emuOp_jump_far_IMM, +/* 0xeb */ x86emuOp_jump_byte_IMM, +/* 0xec */ x86emuOp_in_byte_AL_DX, +/* 0xed */ x86emuOp_in_word_AX_DX, +/* 0xee */ x86emuOp_out_byte_DX_AL, +/* 0xef */ x86emuOp_out_word_DX_AX, + +/* 0xf0 */ x86emuOp_lock, +/* 0xf1 */ x86emuOp_illegal_op, +/* 0xf2 */ x86emuOp_repne, +/* 0xf3 */ x86emuOp_repe, +/* 0xf4 */ x86emuOp_halt, +/* 0xf5 */ x86emuOp_cmc, +/* 0xf6 */ x86emuOp_opcF6_byte_RM, +/* 0xf7 */ x86emuOp_opcF7_word_RM, + +/* 0xf8 */ x86emuOp_clc, +/* 0xf9 */ x86emuOp_stc, +/* 0xfa */ x86emuOp_cli, +/* 0xfb */ x86emuOp_sti, +/* 0xfc */ x86emuOp_cld, +/* 0xfd */ x86emuOp_std, +/* 0xfe */ x86emuOp_opcFE_byte_RM, +/* 0xff */ x86emuOp_opcFF_word_RM, +}; diff --git a/cfe/cfe/x86emu/ops2.c b/cfe/cfe/x86emu/ops2.c new file mode 100644 index 0000000..c59c813 --- /dev/null +++ b/cfe/cfe/x86emu/ops2.c @@ -0,0 +1,2802 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: This file includes subroutines to implement the decoding +* and emulation of all the x86 extended two-byte processor +* instructions. +* +****************************************************************************/ +/* $XFree86: xc/extras/x86emu/src/x86emu/ops2.c,v 1.4 2000/11/16 19:44:50 eich Exp $ */ + +#include "x86emu/x86emui.h" +#include "x86emu/ops_protos.h" + +/*----------------------------- Implementation ----------------------------*/ + +/**************************************************************************** +PARAMETERS: +op1 - Instruction op code + +REMARKS: +Handles illegal opcodes. +****************************************************************************/ +void x86emuOp2_illegal_op( + u8 op2) +{ + START_OF_INSTR(); + DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n"); + TRACE_REGS(); + printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n", + M.x86.R_CS, M.x86.R_IP-2,op2); + HALT_SYS(); + END_OF_INSTR(); +} + +#define xorl(a,b) ((a) && !(b)) || (!(a) && (b)) + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0x80-0x8F +****************************************************************************/ +void x86emuOp2_long_jump(u8 op2) +{ + s32 target; + char *name = 0; + int cond = 0; + + /* conditional jump to word offset. */ + START_OF_INSTR(); + switch (op2) { + case 0x80: + name = "JO\t"; + cond = ACCESS_FLAG(F_OF); + break; + case 0x81: + name = "JNO\t"; + cond = !ACCESS_FLAG(F_OF); + break; + case 0x82: + name = "JB\t"; + cond = ACCESS_FLAG(F_CF); + break; + case 0x83: + name = "JNB\t"; + cond = !ACCESS_FLAG(F_CF); + break; + case 0x84: + name = "JZ\t"; + cond = ACCESS_FLAG(F_ZF); + break; + case 0x85: + name = "JNZ\t"; + cond = !ACCESS_FLAG(F_ZF); + break; + case 0x86: + name = "JBE\t"; + cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF); + break; + case 0x87: + name = "JNBE\t"; + cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)); + break; + case 0x88: + name = "JS\t"; + cond = ACCESS_FLAG(F_SF); + break; + case 0x89: + name = "JNS\t"; + cond = !ACCESS_FLAG(F_SF); + break; + case 0x8a: + name = "JP\t"; + cond = ACCESS_FLAG(F_PF); + break; + case 0x8b: + name = "JNP\t"; + cond = !ACCESS_FLAG(F_PF); + break; + case 0x8c: + name = "JL\t"; + cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)); + break; + case 0x8d: + name = "JNL\t"; + cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)); + break; + case 0x8e: + name = "JLE\t"; + cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) || + ACCESS_FLAG(F_ZF)); + break; + case 0x8f: + name = "JNLE\t"; + cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) || + ACCESS_FLAG(F_ZF)); + break; + } + DECODE_PRINTF(name); + target = (s16) fetch_word_imm(); + target += (s16) M.x86.R_IP; + DECODE_PRINTF2("%04x\n", target); + TRACE_AND_STEP(); + if (cond) + M.x86.R_IP = (u16)target; + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0x90-0x9F +****************************************************************************/ +void x86emuOp2_set_byte(u8 op2) +{ + int mod, rl, rh; + uint destoffset; + u8 *destreg; + char *name = 0; + int cond = 0; + + START_OF_INSTR(); + switch (op2) { + case 0x90: + name = "SETO\t"; + cond = ACCESS_FLAG(F_OF); + break; + case 0x91: + name = "SETNO\t"; + cond = !ACCESS_FLAG(F_OF); + break; + case 0x92: + name = "SETB\t"; + cond = ACCESS_FLAG(F_CF); + break; + case 0x93: + name = "SETNB\t"; + cond = !ACCESS_FLAG(F_CF); + break; + case 0x94: + name = "SETZ\t"; + cond = ACCESS_FLAG(F_ZF); + break; + case 0x95: + name = "SETNZ\t"; + cond = !ACCESS_FLAG(F_ZF); + break; + case 0x96: + name = "SETBE\t"; + cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF); + break; + case 0x97: + name = "SETNBE\t"; + cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)); + break; + case 0x98: + name = "SETS\t"; + cond = ACCESS_FLAG(F_SF); + break; + case 0x99: + name = "SETNS\t"; + cond = !ACCESS_FLAG(F_SF); + break; + case 0x9a: + name = "SETP\t"; + cond = ACCESS_FLAG(F_PF); + break; + case 0x9b: + name = "SETNP\t"; + cond = !ACCESS_FLAG(F_PF); + break; + case 0x9c: + name = "SETL\t"; + cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)); + break; + case 0x9d: + name = "SETNL\t"; + cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)); + break; + case 0x9e: + name = "SETLE\t"; + cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) || + ACCESS_FLAG(F_ZF)); + break; + case 0x9f: + name = "SETNLE\t"; + cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) || + ACCESS_FLAG(F_ZF)); + break; + } + DECODE_PRINTF(name); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destoffset = decode_rm00_address(rl); + TRACE_AND_STEP(); + store_data_byte(destoffset, cond ? 0x01 : 0x00); + break; + case 1: + destoffset = decode_rm01_address(rl); + TRACE_AND_STEP(); + store_data_byte(destoffset, cond ? 0x01 : 0x00); + break; + case 2: + destoffset = decode_rm10_address(rl); + TRACE_AND_STEP(); + store_data_byte(destoffset, cond ? 0x01 : 0x00); + break; + case 3: /* register to register */ + destreg = DECODE_RM_BYTE_REGISTER(rl); + TRACE_AND_STEP(); + *destreg = cond ? 0x01 : 0x00; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xa0 +****************************************************************************/ +void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2)) +{ + START_OF_INSTR(); + DECODE_PRINTF("PUSH\tFS\n"); + TRACE_AND_STEP(); + push_word(M.x86.R_FS); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xa1 +****************************************************************************/ +void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2)) +{ + START_OF_INSTR(); + DECODE_PRINTF("POP\tFS\n"); + TRACE_AND_STEP(); + M.x86.R_FS = pop_word(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xa3 +****************************************************************************/ +void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + int bit,disp; + + START_OF_INSTR(); + DECODE_PRINTF("BT\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval; + u32 *shiftreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF); + } else { + u16 srcval; + u16 *shiftreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval; + u32 *shiftreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF); + } else { + u16 srcval; + u16 *shiftreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval; + u32 *shiftreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF); + } else { + u16 srcval; + u16 *shiftreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg,*shiftreg; + + srcreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF); + } else { + u16 *srcreg,*shiftreg; + + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xa4 +****************************************************************************/ +void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint destoffset; + u8 shift; + + START_OF_INSTR(); + DECODE_PRINTF("SHLD\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shld_long(destval,*shiftreg,shift); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shld_word(destval,*shiftreg,shift); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shld_long(destval,*shiftreg,shift); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shld_word(destval,*shiftreg,shift); + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shld_long(destval,*shiftreg,shift); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shld_word(destval,*shiftreg,shift); + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*shiftreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + *destreg = shld_long(*destreg,*shiftreg,shift); + } else { + u16 *destreg,*shiftreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + *destreg = shld_word(*destreg,*shiftreg,shift); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xa5 +****************************************************************************/ +void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint destoffset; + + START_OF_INSTR(); + DECODE_PRINTF("SHLD\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shld_long(destval,*shiftreg,M.x86.R_CL); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shld_word(destval,*shiftreg,M.x86.R_CL); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shld_long(destval,*shiftreg,M.x86.R_CL); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shld_word(destval,*shiftreg,M.x86.R_CL); + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shld_long(destval,*shiftreg,M.x86.R_CL); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shld_word(destval,*shiftreg,M.x86.R_CL); + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*shiftreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL); + } else { + u16 *destreg,*shiftreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xa8 +****************************************************************************/ +void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2)) +{ + START_OF_INSTR(); + DECODE_PRINTF("PUSH\tGS\n"); + TRACE_AND_STEP(); + push_word(M.x86.R_GS); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xa9 +****************************************************************************/ +void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2)) +{ + START_OF_INSTR(); + DECODE_PRINTF("POP\tGS\n"); + TRACE_AND_STEP(); + M.x86.R_GS = pop_word(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xaa +****************************************************************************/ +void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + int bit,disp; + + START_OF_INSTR(); + DECODE_PRINTF("BTS\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval | mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, srcval | mask); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval | mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, srcval | mask); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval | mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, srcval | mask); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg,*shiftreg; + u32 mask; + + srcreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF); + *srcreg |= mask; + } else { + u16 *srcreg,*shiftreg; + u16 mask; + + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF); + *srcreg |= mask; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xac +****************************************************************************/ +void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint destoffset; + u8 shift; + + START_OF_INSTR(); + DECODE_PRINTF("SHLD\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shrd_long(destval,*shiftreg,shift); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shrd_word(destval,*shiftreg,shift); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shrd_long(destval,*shiftreg,shift); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shrd_word(destval,*shiftreg,shift); + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shrd_long(destval,*shiftreg,shift); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shrd_word(destval,*shiftreg,shift); + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*shiftreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + *destreg = shrd_long(*destreg,*shiftreg,shift); + } else { + u16 *destreg,*shiftreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + DECODE_PRINTF2("%d\n", shift); + TRACE_AND_STEP(); + *destreg = shrd_word(*destreg,*shiftreg,shift); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xad +****************************************************************************/ +void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint destoffset; + + START_OF_INSTR(); + DECODE_PRINTF("SHLD\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shrd_long(destval,*shiftreg,M.x86.R_CL); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shrd_word(destval,*shiftreg,M.x86.R_CL); + store_data_word(destoffset, destval); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shrd_long(destval,*shiftreg,M.x86.R_CL); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shrd_word(destval,*shiftreg,M.x86.R_CL); + store_data_word(destoffset, destval); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 destval; + u32 *shiftreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_long(destoffset); + destval = shrd_long(destval,*shiftreg,M.x86.R_CL); + store_data_long(destoffset, destval); + } else { + u16 destval; + u16 *shiftreg; + + destoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + destval = fetch_data_word(destoffset); + destval = shrd_word(destval,*shiftreg,M.x86.R_CL); + store_data_word(destoffset, destval); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*shiftreg; + + destreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL); + } else { + u16 *destreg,*shiftreg; + + destreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(",CL\n"); + TRACE_AND_STEP(); + *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xaf +****************************************************************************/ +void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("IMUL\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + u32 res_lo,res_hi; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_long(srcoffset); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg; + u16 srcval; + u32 res; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_word(srcoffset); + TRACE_AND_STEP(); + res = (s16)*destreg * (s16)srcval; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + u32 res_lo,res_hi; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_long(srcoffset); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg; + u16 srcval; + u32 res; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_word(srcoffset); + TRACE_AND_STEP(); + res = (s16)*destreg * (s16)srcval; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + u32 res_lo,res_hi; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_long(srcoffset); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg; + u16 srcval; + u32 res; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_word(srcoffset); + TRACE_AND_STEP(); + res = (s16)*destreg * (s16)srcval; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg,*srcreg; + u32 res_lo,res_hi; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_LONG_REGISTER(rl); + TRACE_AND_STEP(); + imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg); + if (res_hi != 0) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u32)res_lo; + } else { + u16 *destreg,*srcreg; + u32 res; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rl); + res = (s16)*destreg * (s16)*srcreg; + if (res > 0xFFFF) { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } + *destreg = (u16)res; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xb2 +****************************************************************************/ +void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rh, rl; + u16 *dstreg; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("LSS\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_SS = fetch_data_word(srcoffset + 2); + break; + case 1: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_SS = fetch_data_word(srcoffset + 2); + break; + case 2: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_SS = fetch_data_word(srcoffset + 2); + break; + case 3: /* register to register */ + /* UNDEFINED! */ + TRACE_AND_STEP(); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xb3 +****************************************************************************/ +void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + int bit,disp; + + START_OF_INSTR(); + DECODE_PRINTF("BTR\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval & ~mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, (u16)(srcval & ~mask)); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval & ~mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, (u16)(srcval & ~mask)); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval & ~mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, (u16)(srcval & ~mask)); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg,*shiftreg; + u32 mask; + + srcreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF); + *srcreg &= ~mask; + } else { + u16 *srcreg,*shiftreg; + u16 mask; + + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF); + *srcreg &= ~mask; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xb4 +****************************************************************************/ +void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rh, rl; + u16 *dstreg; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("LFS\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_FS = fetch_data_word(srcoffset + 2); + break; + case 1: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_FS = fetch_data_word(srcoffset + 2); + break; + case 2: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_FS = fetch_data_word(srcoffset + 2); + break; + case 3: /* register to register */ + /* UNDEFINED! */ + TRACE_AND_STEP(); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xb5 +****************************************************************************/ +void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rh, rl; + u16 *dstreg; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("LGS\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_GS = fetch_data_word(srcoffset + 2); + break; + case 1: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_GS = fetch_data_word(srcoffset + 2); + break; + case 2: + dstreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *dstreg = fetch_data_word(srcoffset); + M.x86.R_GS = fetch_data_word(srcoffset + 2); + break; + case 3: /* register to register */ + /* UNDEFINED! */ + TRACE_AND_STEP(); + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xb6 +****************************************************************************/ +void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("MOVZX\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_byte(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u8 *srcreg; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + } else { + u16 *destreg; + u8 *srcreg; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xb7 +****************************************************************************/ +void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + u32 *destreg; + u32 srcval; + u16 *srcreg; + + START_OF_INSTR(); + DECODE_PRINTF("MOVZX\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 1: + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 2: + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = fetch_data_word(srcoffset); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 3: /* register to register */ + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = *srcreg; + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xba +****************************************************************************/ +void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + int bit; + + START_OF_INSTR(); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (rh) { + case 3: + DECODE_PRINTF("BT\t"); + break; + case 4: + DECODE_PRINTF("BTS\t"); + break; + case 5: + DECODE_PRINTF("BTR\t"); + break; + case 6: + DECODE_PRINTF("BTC\t"); + break; + default: + DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n"); + TRACE_REGS(); + printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n", + M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl); + HALT_SYS(); + } + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, mask; + u8 shift; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + TRACE_AND_STEP(); + bit = shift & 0x1F; + srcval = fetch_data_long(srcoffset); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + switch (rh) { + case 4: + store_data_long(srcoffset, srcval | mask); + break; + case 5: + store_data_long(srcoffset, srcval & ~mask); + break; + case 6: + store_data_long(srcoffset, srcval ^ mask); + break; + default: + break; + } + } else { + u16 srcval, mask; + u8 shift; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + TRACE_AND_STEP(); + bit = shift & 0xF; + srcval = fetch_data_word(srcoffset); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + switch (rh) { + case 4: + store_data_word(srcoffset, srcval | mask); + break; + case 5: + store_data_word(srcoffset, srcval & ~mask); + break; + case 6: + store_data_word(srcoffset, srcval ^ mask); + break; + default: + break; + } + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, mask; + u8 shift; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + TRACE_AND_STEP(); + bit = shift & 0x1F; + srcval = fetch_data_long(srcoffset); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + switch (rh) { + case 4: + store_data_long(srcoffset, srcval | mask); + break; + case 5: + store_data_long(srcoffset, srcval & ~mask); + break; + case 6: + store_data_long(srcoffset, srcval ^ mask); + break; + default: + break; + } + } else { + u16 srcval, mask; + u8 shift; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + TRACE_AND_STEP(); + bit = shift & 0xF; + srcval = fetch_data_word(srcoffset); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + switch (rh) { + case 4: + store_data_word(srcoffset, srcval | mask); + break; + case 5: + store_data_word(srcoffset, srcval & ~mask); + break; + case 6: + store_data_word(srcoffset, srcval ^ mask); + break; + default: + break; + } + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, mask; + u8 shift; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + TRACE_AND_STEP(); + bit = shift & 0x1F; + srcval = fetch_data_long(srcoffset); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + switch (rh) { + case 4: + store_data_long(srcoffset, srcval | mask); + break; + case 5: + store_data_long(srcoffset, srcval & ~mask); + break; + case 6: + store_data_long(srcoffset, srcval ^ mask); + break; + default: + break; + } + } else { + u16 srcval, mask; + u8 shift; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + TRACE_AND_STEP(); + bit = shift & 0xF; + srcval = fetch_data_word(srcoffset); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + switch (rh) { + case 4: + store_data_word(srcoffset, srcval | mask); + break; + case 5: + store_data_word(srcoffset, srcval & ~mask); + break; + case 6: + store_data_word(srcoffset, srcval ^ mask); + break; + default: + break; + } + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg; + u32 mask; + u8 shift; + + srcreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + TRACE_AND_STEP(); + bit = shift & 0x1F; + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF); + switch (rh) { + case 4: + *srcreg |= mask; + break; + case 5: + *srcreg &= ~mask; + break; + case 6: + *srcreg ^= mask; + break; + default: + break; + } + } else { + u16 *srcreg; + u16 mask; + u8 shift; + + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shift = fetch_byte_imm(); + TRACE_AND_STEP(); + bit = shift & 0xF; + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF); + switch (rh) { + case 4: + *srcreg |= mask; + break; + case 5: + *srcreg &= ~mask; + break; + case 6: + *srcreg ^= mask; + break; + default: + break; + } + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xbb +****************************************************************************/ +void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + int bit,disp; + + START_OF_INSTR(); + DECODE_PRINTF("BTC\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval ^ mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, (u16)(srcval ^ mask)); + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval ^ mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, (u16)(srcval ^ mask)); + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval,mask; + u32 *shiftreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + disp = (s16)*shiftreg >> 5; + srcval = fetch_data_long(srcoffset+disp); + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_long(srcoffset+disp, srcval ^ mask); + } else { + u16 srcval,mask; + u16 *shiftreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + disp = (s16)*shiftreg >> 4; + srcval = fetch_data_word(srcoffset+disp); + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(srcval & mask,F_CF); + store_data_word(srcoffset+disp, (u16)(srcval ^ mask)); + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg,*shiftreg; + u32 mask; + + srcreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0x1F; + mask = (0x1 << bit); + CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF); + *srcreg ^= mask; + } else { + u16 *srcreg,*shiftreg; + u16 mask; + + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + shiftreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + bit = *shiftreg & 0xF; + mask = (u16)(0x1 << bit); + CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF); + *srcreg ^= mask; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xbc +****************************************************************************/ +void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("BSF\n"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch(mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, *dstreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_long(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 0; *dstreg < 32; (*dstreg)++) + if ((srcval >> *dstreg) & 1) break; + } else { + u16 srcval, *dstreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_word(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 0; *dstreg < 16; (*dstreg)++) + if ((srcval >> *dstreg) & 1) break; + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, *dstreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_long(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 0; *dstreg < 32; (*dstreg)++) + if ((srcval >> *dstreg) & 1) break; + } else { + u16 srcval, *dstreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_word(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 0; *dstreg < 16; (*dstreg)++) + if ((srcval >> *dstreg) & 1) break; + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, *dstreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_long(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 0; *dstreg < 32; (*dstreg)++) + if ((srcval >> *dstreg) & 1) break; + } else { + u16 srcval, *dstreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_word(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 0; *dstreg < 16; (*dstreg)++) + if ((srcval >> *dstreg) & 1) break; + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg, *dstreg; + + srcreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); + for(*dstreg = 0; *dstreg < 32; (*dstreg)++) + if ((*srcreg >> *dstreg) & 1) break; + } else { + u16 *srcreg, *dstreg; + + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); + for(*dstreg = 0; *dstreg < 16; (*dstreg)++) + if ((*srcreg >> *dstreg) & 1) break; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xbd +****************************************************************************/ +void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("BSF\n"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch(mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, *dstreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_long(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 31; *dstreg > 0; (*dstreg)--) + if ((srcval >> *dstreg) & 1) break; + } else { + u16 srcval, *dstreg; + + srcoffset = decode_rm00_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_word(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 15; *dstreg > 0; (*dstreg)--) + if ((srcval >> *dstreg) & 1) break; + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, *dstreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_long(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 31; *dstreg > 0; (*dstreg)--) + if ((srcval >> *dstreg) & 1) break; + } else { + u16 srcval, *dstreg; + + srcoffset = decode_rm01_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_word(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 15; *dstreg > 0; (*dstreg)--) + if ((srcval >> *dstreg) & 1) break; + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 srcval, *dstreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_long(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 31; *dstreg > 0; (*dstreg)--) + if ((srcval >> *dstreg) & 1) break; + } else { + u16 srcval, *dstreg; + + srcoffset = decode_rm10_address(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + srcval = fetch_data_word(srcoffset); + CONDITIONAL_SET_FLAG(srcval == 0, F_ZF); + for(*dstreg = 15; *dstreg > 0; (*dstreg)--) + if ((srcval >> *dstreg) & 1) break; + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *srcreg, *dstreg; + + srcreg = DECODE_RM_LONG_REGISTER(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_LONG_REGISTER(rh); + TRACE_AND_STEP(); + CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); + for(*dstreg = 31; *dstreg > 0; (*dstreg)--) + if ((*srcreg >> *dstreg) & 1) break; + } else { + u16 *srcreg, *dstreg; + + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF(","); + dstreg = DECODE_RM_WORD_REGISTER(rh); + TRACE_AND_STEP(); + CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF); + for(*dstreg = 15; *dstreg > 0; (*dstreg)--) + if ((*srcreg >> *dstreg) & 1) break; + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xbe +****************************************************************************/ +void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + + START_OF_INSTR(); + DECODE_PRINTF("MOVSX\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = (s32)((s8)fetch_data_byte(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = (s16)((s8)fetch_data_byte(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 1: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = (s32)((s8)fetch_data_byte(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = (s16)((s8)fetch_data_byte(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 2: + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u32 srcval; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = (s32)((s8)fetch_data_byte(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } else { + u16 *destreg; + u16 srcval; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = (s16)((s8)fetch_data_byte(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + } + break; + case 3: /* register to register */ + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + u32 *destreg; + u8 *srcreg; + + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = (s32)((s8)*srcreg); + } else { + u16 *destreg; + u8 *srcreg; + + destreg = DECODE_RM_WORD_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_BYTE_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = (s16)((s8)*srcreg); + } + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0xbf +****************************************************************************/ +void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2)) +{ + int mod, rl, rh; + uint srcoffset; + u32 *destreg; + u32 srcval; + u16 *srcreg; + + START_OF_INSTR(); + DECODE_PRINTF("MOVSX\t"); + FETCH_DECODE_MODRM(mod, rh, rl); + switch (mod) { + case 0: + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm00_address(rl); + srcval = (s32)((s16)fetch_data_word(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 1: + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm01_address(rl); + srcval = (s32)((s16)fetch_data_word(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 2: + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcoffset = decode_rm10_address(rl); + srcval = (s32)((s16)fetch_data_word(srcoffset)); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = srcval; + break; + case 3: /* register to register */ + destreg = DECODE_RM_LONG_REGISTER(rh); + DECODE_PRINTF(","); + srcreg = DECODE_RM_WORD_REGISTER(rl); + DECODE_PRINTF("\n"); + TRACE_AND_STEP(); + *destreg = (s32)((s16)*srcreg); + break; + } + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/*************************************************************************** + * Double byte operation code table: + **************************************************************************/ +void (*x86emu_optab2[256])(u8) = +{ +/* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */ +/* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */ +/* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */ +/* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */ +/* 0x04 */ x86emuOp2_illegal_op, +/* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */ +/* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */ +/* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */ +/* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */ +/* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */ +/* 0x0a */ x86emuOp2_illegal_op, +/* 0x0b */ x86emuOp2_illegal_op, +/* 0x0c */ x86emuOp2_illegal_op, +/* 0x0d */ x86emuOp2_illegal_op, +/* 0x0e */ x86emuOp2_illegal_op, +/* 0x0f */ x86emuOp2_illegal_op, + +/* 0x10 */ x86emuOp2_illegal_op, +/* 0x11 */ x86emuOp2_illegal_op, +/* 0x12 */ x86emuOp2_illegal_op, +/* 0x13 */ x86emuOp2_illegal_op, +/* 0x14 */ x86emuOp2_illegal_op, +/* 0x15 */ x86emuOp2_illegal_op, +/* 0x16 */ x86emuOp2_illegal_op, +/* 0x17 */ x86emuOp2_illegal_op, +/* 0x18 */ x86emuOp2_illegal_op, +/* 0x19 */ x86emuOp2_illegal_op, +/* 0x1a */ x86emuOp2_illegal_op, +/* 0x1b */ x86emuOp2_illegal_op, +/* 0x1c */ x86emuOp2_illegal_op, +/* 0x1d */ x86emuOp2_illegal_op, +/* 0x1e */ x86emuOp2_illegal_op, +/* 0x1f */ x86emuOp2_illegal_op, + +/* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */ +/* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */ +/* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */ +/* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */ +/* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */ +/* 0x25 */ x86emuOp2_illegal_op, +/* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */ +/* 0x27 */ x86emuOp2_illegal_op, +/* 0x28 */ x86emuOp2_illegal_op, +/* 0x29 */ x86emuOp2_illegal_op, +/* 0x2a */ x86emuOp2_illegal_op, +/* 0x2b */ x86emuOp2_illegal_op, +/* 0x2c */ x86emuOp2_illegal_op, +/* 0x2d */ x86emuOp2_illegal_op, +/* 0x2e */ x86emuOp2_illegal_op, +/* 0x2f */ x86emuOp2_illegal_op, + +/* 0x30 */ x86emuOp2_illegal_op, +/* 0x31 */ x86emuOp2_illegal_op, +/* 0x32 */ x86emuOp2_illegal_op, +/* 0x33 */ x86emuOp2_illegal_op, +/* 0x34 */ x86emuOp2_illegal_op, +/* 0x35 */ x86emuOp2_illegal_op, +/* 0x36 */ x86emuOp2_illegal_op, +/* 0x37 */ x86emuOp2_illegal_op, +/* 0x38 */ x86emuOp2_illegal_op, +/* 0x39 */ x86emuOp2_illegal_op, +/* 0x3a */ x86emuOp2_illegal_op, +/* 0x3b */ x86emuOp2_illegal_op, +/* 0x3c */ x86emuOp2_illegal_op, +/* 0x3d */ x86emuOp2_illegal_op, +/* 0x3e */ x86emuOp2_illegal_op, +/* 0x3f */ x86emuOp2_illegal_op, + +/* 0x40 */ x86emuOp2_illegal_op, +/* 0x41 */ x86emuOp2_illegal_op, +/* 0x42 */ x86emuOp2_illegal_op, +/* 0x43 */ x86emuOp2_illegal_op, +/* 0x44 */ x86emuOp2_illegal_op, +/* 0x45 */ x86emuOp2_illegal_op, +/* 0x46 */ x86emuOp2_illegal_op, +/* 0x47 */ x86emuOp2_illegal_op, +/* 0x48 */ x86emuOp2_illegal_op, +/* 0x49 */ x86emuOp2_illegal_op, +/* 0x4a */ x86emuOp2_illegal_op, +/* 0x4b */ x86emuOp2_illegal_op, +/* 0x4c */ x86emuOp2_illegal_op, +/* 0x4d */ x86emuOp2_illegal_op, +/* 0x4e */ x86emuOp2_illegal_op, +/* 0x4f */ x86emuOp2_illegal_op, + +/* 0x50 */ x86emuOp2_illegal_op, +/* 0x51 */ x86emuOp2_illegal_op, +/* 0x52 */ x86emuOp2_illegal_op, +/* 0x53 */ x86emuOp2_illegal_op, +/* 0x54 */ x86emuOp2_illegal_op, +/* 0x55 */ x86emuOp2_illegal_op, +/* 0x56 */ x86emuOp2_illegal_op, +/* 0x57 */ x86emuOp2_illegal_op, +/* 0x58 */ x86emuOp2_illegal_op, +/* 0x59 */ x86emuOp2_illegal_op, +/* 0x5a */ x86emuOp2_illegal_op, +/* 0x5b */ x86emuOp2_illegal_op, +/* 0x5c */ x86emuOp2_illegal_op, +/* 0x5d */ x86emuOp2_illegal_op, +/* 0x5e */ x86emuOp2_illegal_op, +/* 0x5f */ x86emuOp2_illegal_op, + +/* 0x60 */ x86emuOp2_illegal_op, +/* 0x61 */ x86emuOp2_illegal_op, +/* 0x62 */ x86emuOp2_illegal_op, +/* 0x63 */ x86emuOp2_illegal_op, +/* 0x64 */ x86emuOp2_illegal_op, +/* 0x65 */ x86emuOp2_illegal_op, +/* 0x66 */ x86emuOp2_illegal_op, +/* 0x67 */ x86emuOp2_illegal_op, +/* 0x68 */ x86emuOp2_illegal_op, +/* 0x69 */ x86emuOp2_illegal_op, +/* 0x6a */ x86emuOp2_illegal_op, +/* 0x6b */ x86emuOp2_illegal_op, +/* 0x6c */ x86emuOp2_illegal_op, +/* 0x6d */ x86emuOp2_illegal_op, +/* 0x6e */ x86emuOp2_illegal_op, +/* 0x6f */ x86emuOp2_illegal_op, + +/* 0x70 */ x86emuOp2_illegal_op, +/* 0x71 */ x86emuOp2_illegal_op, +/* 0x72 */ x86emuOp2_illegal_op, +/* 0x73 */ x86emuOp2_illegal_op, +/* 0x74 */ x86emuOp2_illegal_op, +/* 0x75 */ x86emuOp2_illegal_op, +/* 0x76 */ x86emuOp2_illegal_op, +/* 0x77 */ x86emuOp2_illegal_op, +/* 0x78 */ x86emuOp2_illegal_op, +/* 0x79 */ x86emuOp2_illegal_op, +/* 0x7a */ x86emuOp2_illegal_op, +/* 0x7b */ x86emuOp2_illegal_op, +/* 0x7c */ x86emuOp2_illegal_op, +/* 0x7d */ x86emuOp2_illegal_op, +/* 0x7e */ x86emuOp2_illegal_op, +/* 0x7f */ x86emuOp2_illegal_op, + +/* 0x80 */ x86emuOp2_long_jump, +/* 0x81 */ x86emuOp2_long_jump, +/* 0x82 */ x86emuOp2_long_jump, +/* 0x83 */ x86emuOp2_long_jump, +/* 0x84 */ x86emuOp2_long_jump, +/* 0x85 */ x86emuOp2_long_jump, +/* 0x86 */ x86emuOp2_long_jump, +/* 0x87 */ x86emuOp2_long_jump, +/* 0x88 */ x86emuOp2_long_jump, +/* 0x89 */ x86emuOp2_long_jump, +/* 0x8a */ x86emuOp2_long_jump, +/* 0x8b */ x86emuOp2_long_jump, +/* 0x8c */ x86emuOp2_long_jump, +/* 0x8d */ x86emuOp2_long_jump, +/* 0x8e */ x86emuOp2_long_jump, +/* 0x8f */ x86emuOp2_long_jump, + +/* 0x90 */ x86emuOp2_set_byte, +/* 0x91 */ x86emuOp2_set_byte, +/* 0x92 */ x86emuOp2_set_byte, +/* 0x93 */ x86emuOp2_set_byte, +/* 0x94 */ x86emuOp2_set_byte, +/* 0x95 */ x86emuOp2_set_byte, +/* 0x96 */ x86emuOp2_set_byte, +/* 0x97 */ x86emuOp2_set_byte, +/* 0x98 */ x86emuOp2_set_byte, +/* 0x99 */ x86emuOp2_set_byte, +/* 0x9a */ x86emuOp2_set_byte, +/* 0x9b */ x86emuOp2_set_byte, +/* 0x9c */ x86emuOp2_set_byte, +/* 0x9d */ x86emuOp2_set_byte, +/* 0x9e */ x86emuOp2_set_byte, +/* 0x9f */ x86emuOp2_set_byte, + +/* 0xa0 */ x86emuOp2_push_FS, +/* 0xa1 */ x86emuOp2_pop_FS, +/* 0xa2 */ x86emuOp2_illegal_op, +/* 0xa3 */ x86emuOp2_bt_R, +/* 0xa4 */ x86emuOp2_shld_IMM, +/* 0xa5 */ x86emuOp2_shld_CL, +/* 0xa6 */ x86emuOp2_illegal_op, +/* 0xa7 */ x86emuOp2_illegal_op, +/* 0xa8 */ x86emuOp2_push_GS, +/* 0xa9 */ x86emuOp2_pop_GS, +/* 0xaa */ x86emuOp2_illegal_op, +/* 0xab */ x86emuOp2_bt_R, +/* 0xac */ x86emuOp2_shrd_IMM, +/* 0xad */ x86emuOp2_shrd_CL, +/* 0xae */ x86emuOp2_illegal_op, +/* 0xaf */ x86emuOp2_imul_R_RM, + +/* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */ +/* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */ +/* 0xb2 */ x86emuOp2_lss_R_IMM, +/* 0xb3 */ x86emuOp2_btr_R, +/* 0xb4 */ x86emuOp2_lfs_R_IMM, +/* 0xb5 */ x86emuOp2_lgs_R_IMM, +/* 0xb6 */ x86emuOp2_movzx_byte_R_RM, +/* 0xb7 */ x86emuOp2_movzx_word_R_RM, +/* 0xb8 */ x86emuOp2_illegal_op, +/* 0xb9 */ x86emuOp2_illegal_op, +/* 0xba */ x86emuOp2_btX_I, +/* 0xbb */ x86emuOp2_btc_R, +/* 0xbc */ x86emuOp2_bsf, +/* 0xbd */ x86emuOp2_bsr, +/* 0xbe */ x86emuOp2_movsx_byte_R_RM, +/* 0xbf */ x86emuOp2_movsx_word_R_RM, + +/* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */ +/* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */ +/* 0xc2 */ x86emuOp2_illegal_op, +/* 0xc3 */ x86emuOp2_illegal_op, +/* 0xc4 */ x86emuOp2_illegal_op, +/* 0xc5 */ x86emuOp2_illegal_op, +/* 0xc6 */ x86emuOp2_illegal_op, +/* 0xc7 */ x86emuOp2_illegal_op, +/* 0xc8 */ x86emuOp2_illegal_op, /* TODO: bswap */ +/* 0xc9 */ x86emuOp2_illegal_op, /* TODO: bswap */ +/* 0xca */ x86emuOp2_illegal_op, /* TODO: bswap */ +/* 0xcb */ x86emuOp2_illegal_op, /* TODO: bswap */ +/* 0xcc */ x86emuOp2_illegal_op, /* TODO: bswap */ +/* 0xcd */ x86emuOp2_illegal_op, /* TODO: bswap */ +/* 0xce */ x86emuOp2_illegal_op, /* TODO: bswap */ +/* 0xcf */ x86emuOp2_illegal_op, /* TODO: bswap */ + +/* 0xd0 */ x86emuOp2_illegal_op, +/* 0xd1 */ x86emuOp2_illegal_op, +/* 0xd2 */ x86emuOp2_illegal_op, +/* 0xd3 */ x86emuOp2_illegal_op, +/* 0xd4 */ x86emuOp2_illegal_op, +/* 0xd5 */ x86emuOp2_illegal_op, +/* 0xd6 */ x86emuOp2_illegal_op, +/* 0xd7 */ x86emuOp2_illegal_op, +/* 0xd8 */ x86emuOp2_illegal_op, +/* 0xd9 */ x86emuOp2_illegal_op, +/* 0xda */ x86emuOp2_illegal_op, +/* 0xdb */ x86emuOp2_illegal_op, +/* 0xdc */ x86emuOp2_illegal_op, +/* 0xdd */ x86emuOp2_illegal_op, +/* 0xde */ x86emuOp2_illegal_op, +/* 0xdf */ x86emuOp2_illegal_op, + +/* 0xe0 */ x86emuOp2_illegal_op, +/* 0xe1 */ x86emuOp2_illegal_op, +/* 0xe2 */ x86emuOp2_illegal_op, +/* 0xe3 */ x86emuOp2_illegal_op, +/* 0xe4 */ x86emuOp2_illegal_op, +/* 0xe5 */ x86emuOp2_illegal_op, +/* 0xe6 */ x86emuOp2_illegal_op, +/* 0xe7 */ x86emuOp2_illegal_op, +/* 0xe8 */ x86emuOp2_illegal_op, +/* 0xe9 */ x86emuOp2_illegal_op, +/* 0xea */ x86emuOp2_illegal_op, +/* 0xeb */ x86emuOp2_illegal_op, +/* 0xec */ x86emuOp2_illegal_op, +/* 0xed */ x86emuOp2_illegal_op, +/* 0xee */ x86emuOp2_illegal_op, +/* 0xef */ x86emuOp2_illegal_op, + +/* 0xf0 */ x86emuOp2_illegal_op, +/* 0xf1 */ x86emuOp2_illegal_op, +/* 0xf2 */ x86emuOp2_illegal_op, +/* 0xf3 */ x86emuOp2_illegal_op, +/* 0xf4 */ x86emuOp2_illegal_op, +/* 0xf5 */ x86emuOp2_illegal_op, +/* 0xf6 */ x86emuOp2_illegal_op, +/* 0xf7 */ x86emuOp2_illegal_op, +/* 0xf8 */ x86emuOp2_illegal_op, +/* 0xf9 */ x86emuOp2_illegal_op, +/* 0xfa */ x86emuOp2_illegal_op, +/* 0xfb */ x86emuOp2_illegal_op, +/* 0xfc */ x86emuOp2_illegal_op, +/* 0xfd */ x86emuOp2_illegal_op, +/* 0xfe */ x86emuOp2_illegal_op, +/* 0xff */ x86emuOp2_illegal_op, +}; diff --git a/cfe/cfe/x86emu/prim_ops.c b/cfe/cfe/x86emu/prim_ops.c new file mode 100644 index 0000000..dca16cd --- /dev/null +++ b/cfe/cfe/x86emu/prim_ops.c @@ -0,0 +1,2915 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: This file contains the code to implement the primitive +* machine operations used by the emulation code in ops.c +* +* Carry Chain Calculation +* +* This represents a somewhat expensive calculation which is +* apparently required to emulate the setting of the OF and AF flag. +* The latter is not so important, but the former is. The overflow +* flag is the XOR of the top two bits of the carry chain for an +* addition (similar for subtraction). Since we do not want to +* simulate the addition in a bitwise manner, we try to calculate the +* carry chain given the two operands and the result. +* +* So, given the following table, which represents the addition of two +* bits, we can derive a formula for the carry chain. +* +* a b cin r cout +* 0 0 0 0 0 +* 0 0 1 1 0 +* 0 1 0 1 0 +* 0 1 1 0 1 +* 1 0 0 1 0 +* 1 0 1 0 1 +* 1 1 0 0 1 +* 1 1 1 1 1 +* +* Construction of table for cout: +* +* ab +* r \ 00 01 11 10 +* |------------------ +* 0 | 0 1 1 1 +* 1 | 0 0 1 0 +* +* By inspection, one gets: cc = ab + r'(a + b) +* +* That represents alot of operations, but NO CHOICE.... +* +* Borrow Chain Calculation. +* +* The following table represents the subtraction of two bits, from +* which we can derive a formula for the borrow chain. +* +* a b bin r bout +* 0 0 0 0 0 +* 0 0 1 1 1 +* 0 1 0 1 1 +* 0 1 1 0 1 +* 1 0 0 1 0 +* 1 0 1 0 0 +* 1 1 0 0 0 +* 1 1 1 1 1 +* +* Construction of table for cout: +* +* ab +* r \ 00 01 11 10 +* |------------------ +* 0 | 0 1 0 0 +* 1 | 1 1 1 0 +* +* By inspection, one gets: bc = a'b + r(a' + b) +* +****************************************************************************/ + +#define PRIM_OPS_NO_REDEFINE_ASM +#include "x86emu/x86emui.h" + +/*------------------------- Global Variables ------------------------------*/ + +#ifndef __HAVE_INLINE_ASSEMBLER__ + +static u32 x86emu_parity_tab[8] = +{ + 0x96696996, + 0x69969669, + 0x69969669, + 0x96696996, + 0x69969669, + 0x96696996, + 0x96696996, + 0x69969669, +}; + +#endif + +#define PARITY(x) (((x86emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0) +#define XOR2(x) (((x) ^ ((x)>>1)) & 0x1) + +/*----------------------------- Implementation ----------------------------*/ + +#ifndef __HAVE_INLINE_ASSEMBLER__ + +/**************************************************************************** +REMARKS: +Implements the AAA instruction and side effects. +****************************************************************************/ +u16 aaa_word(u16 d) +{ + u16 res; + if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) { + d += 0x6; + d += 0x100; + SET_FLAG(F_AF); + SET_FLAG(F_CF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + } + res = (u16)(d & 0xFF0F); + CLEAR_FLAG(F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the AAA instruction and side effects. +****************************************************************************/ +u16 aas_word(u16 d) +{ + u16 res; + if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) { + d -= 0x6; + d -= 0x100; + SET_FLAG(F_AF); + SET_FLAG(F_CF); + } else { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + } + res = (u16)(d & 0xFF0F); + CLEAR_FLAG(F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the AAD instruction and side effects. +****************************************************************************/ +u16 aad_word(u16 d) +{ + u16 l; + u8 hb, lb; + + hb = (u8)((d >> 8) & 0xff); + lb = (u8)((d & 0xff)); + l = (u16)((lb + 10 * hb) & 0xFF); + + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CLEAR_FLAG(F_OF); + CONDITIONAL_SET_FLAG(l & 0x80, F_SF); + CONDITIONAL_SET_FLAG(l == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF); + return l; +} + +/**************************************************************************** +REMARKS: +Implements the AAM instruction and side effects. +****************************************************************************/ +u16 aam_word(u8 d) +{ + u16 h, l; + + h = (u16)(d / 10); + l = (u16)(d % 10); + l |= (u16)(h << 8); + + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CLEAR_FLAG(F_OF); + CONDITIONAL_SET_FLAG(l & 0x80, F_SF); + CONDITIONAL_SET_FLAG(l == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF); + return l; +} + +/**************************************************************************** +REMARKS: +Implements the ADC instruction and side effects. +****************************************************************************/ +u8 adc_byte(u8 d, u8 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 cc; + + if (ACCESS_FLAG(F_CF)) + res = 1 + d + s; + else + res = d + s; + + CONDITIONAL_SET_FLAG(res & 0x100, F_CF); + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = (s & d) | ((~res) & (s | d)); + CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the ADC instruction and side effects. +****************************************************************************/ +u16 adc_word(u16 d, u16 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 cc; + + if (ACCESS_FLAG(F_CF)) + res = 1 + d + s; + else + res = d + s; + + CONDITIONAL_SET_FLAG(res & 0x10000, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = (s & d) | ((~res) & (s | d)); + CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the ADC instruction and side effects. +****************************************************************************/ +u32 adc_long(u32 d, u32 s) +{ + register u32 lo; /* all operands in native machine order */ + register u32 hi; + register u32 res; + register u32 cc; + + if (ACCESS_FLAG(F_CF)) { + lo = 1 + (d & 0xFFFF) + (s & 0xFFFF); + res = 1 + d + s; + } + else { + lo = (d & 0xFFFF) + (s & 0xFFFF); + res = d + s; + } + hi = (lo >> 16) + (d >> 16) + (s >> 16); + + CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = (s & d) | ((~res) & (s | d)); + CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the ADD instruction and side effects. +****************************************************************************/ +u8 add_byte(u8 d, u8 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 cc; + + res = d + s; + CONDITIONAL_SET_FLAG(res & 0x100, F_CF); + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = (s & d) | ((~res) & (s | d)); + CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the ADD instruction and side effects. +****************************************************************************/ +u16 add_word(u16 d, u16 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 cc; + + res = d + s; + CONDITIONAL_SET_FLAG(res & 0x10000, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = (s & d) | ((~res) & (s | d)); + CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the ADD instruction and side effects. +****************************************************************************/ +u32 add_long(u32 d, u32 s) +{ + register u32 lo; /* all operands in native machine order */ + register u32 hi; + register u32 res; + register u32 cc; + + lo = (d & 0xFFFF) + (s & 0xFFFF); + res = d + s; + hi = (lo >> 16) + (d >> 16) + (s >> 16); + + CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = (s & d) | ((~res) & (s | d)); + CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + + return res; +} + +/**************************************************************************** +REMARKS: +Implements the AND instruction and side effects. +****************************************************************************/ +u8 and_byte(u8 d, u8 s) +{ + register u8 res; /* all operands in native machine order */ + + res = d & s; + + /* set the flags */ + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res), F_PF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the AND instruction and side effects. +****************************************************************************/ +u16 and_word(u16 d, u16 s) +{ + register u16 res; /* all operands in native machine order */ + + res = d & s; + + /* set the flags */ + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the AND instruction and side effects. +****************************************************************************/ +u32 and_long(u32 d, u32 s) +{ + register u32 res; /* all operands in native machine order */ + + res = d & s; + + /* set the flags */ + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the CMP instruction and side effects. +****************************************************************************/ +u8 cmp_byte(u8 d, u8 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - s; + CLEAR_FLAG(F_CF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x80, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return d; +} + +/**************************************************************************** +REMARKS: +Implements the CMP instruction and side effects. +****************************************************************************/ +u16 cmp_word(u16 d, u16 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - s; + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return d; +} + +/**************************************************************************** +REMARKS: +Implements the CMP instruction and side effects. +****************************************************************************/ +u32 cmp_long(u32 d, u32 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - s; + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return d; +} + +/**************************************************************************** +REMARKS: +Implements the DAA instruction and side effects. +****************************************************************************/ +u8 daa_byte(u8 d) +{ + u32 res = d; + if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) { + res += 6; + SET_FLAG(F_AF); + } + if (res > 0x9F || ACCESS_FLAG(F_CF)) { + res += 0x60; + SET_FLAG(F_CF); + } + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the DAS instruction and side effects. +****************************************************************************/ +u8 das_byte(u8 d) +{ + if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) { + d -= 6; + SET_FLAG(F_AF); + } + if (d > 0x9F || ACCESS_FLAG(F_CF)) { + d -= 0x60; + SET_FLAG(F_CF); + } + CONDITIONAL_SET_FLAG(d & 0x80, F_SF); + CONDITIONAL_SET_FLAG(d == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF); + return d; +} + +/**************************************************************************** +REMARKS: +Implements the DEC instruction and side effects. +****************************************************************************/ +u8 dec_byte(u8 d) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - 1; + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + /* based on sub_byte, uses s==1. */ + bc = (res & (~d | 1)) | (~d & 1); + /* carry flag unchanged */ + CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the DEC instruction and side effects. +****************************************************************************/ +u16 dec_word(u16 d) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - 1; + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + /* based on the sub_byte routine, with s==1 */ + bc = (res & (~d | 1)) | (~d & 1); + /* carry flag unchanged */ + CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the DEC instruction and side effects. +****************************************************************************/ +u32 dec_long(u32 d) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - 1; + + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | 1)) | (~d & 1); + /* carry flag unchanged */ + CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the INC instruction and side effects. +****************************************************************************/ +u8 inc_byte(u8 d) +{ + register u32 res; /* all operands in native machine order */ + register u32 cc; + + res = d + 1; + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = ((1 & d) | (~res)) & (1 | d); + CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the INC instruction and side effects. +****************************************************************************/ +u16 inc_word(u16 d) +{ + register u32 res; /* all operands in native machine order */ + register u32 cc; + + res = d + 1; + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = (1 & d) | ((~res) & (1 | d)); + CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the INC instruction and side effects. +****************************************************************************/ +u32 inc_long(u32 d) +{ + register u32 res; /* all operands in native machine order */ + register u32 cc; + + res = d + 1; + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the carry chain SEE NOTE AT TOP. */ + cc = (1 & d) | ((~res) & (1 | d)); + CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF); + CONDITIONAL_SET_FLAG(cc & 0x8, F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the OR instruction and side effects. +****************************************************************************/ +u8 or_byte(u8 d, u8 s) +{ + register u8 res; /* all operands in native machine order */ + + res = d | s; + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res), F_PF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the OR instruction and side effects. +****************************************************************************/ +u16 or_word(u16 d, u16 s) +{ + register u16 res; /* all operands in native machine order */ + + res = d | s; + /* set the carry flag to be bit 8 */ + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the OR instruction and side effects. +****************************************************************************/ +u32 or_long(u32 d, u32 s) +{ + register u32 res; /* all operands in native machine order */ + + res = d | s; + + /* set the carry flag to be bit 8 */ + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the OR instruction and side effects. +****************************************************************************/ +u8 neg_byte(u8 s) +{ + register u8 res; + register u8 bc; + + CONDITIONAL_SET_FLAG(s != 0, F_CF); + res = (u8)-s; + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res), F_PF); + /* calculate the borrow chain --- modified such that d=0. + substitutiing d=0 into bc= res&(~d|s)|(~d&s); + (the one used for sub) and simplifying, since ~d=0xff..., + ~d|s == 0xffff..., and res&0xfff... == res. Similarly + ~d&s == s. So the simplified result is: */ + bc = res | s; + CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the OR instruction and side effects. +****************************************************************************/ +u16 neg_word(u16 s) +{ + register u16 res; + register u16 bc; + + CONDITIONAL_SET_FLAG(s != 0, F_CF); + res = (u16)-s; + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain --- modified such that d=0. + substitutiing d=0 into bc= res&(~d|s)|(~d&s); + (the one used for sub) and simplifying, since ~d=0xff..., + ~d|s == 0xffff..., and res&0xfff... == res. Similarly + ~d&s == s. So the simplified result is: */ + bc = res | s; + CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the OR instruction and side effects. +****************************************************************************/ +u32 neg_long(u32 s) +{ + register u32 res; + register u32 bc; + + CONDITIONAL_SET_FLAG(s != 0, F_CF); + res = (u32)-s; + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain --- modified such that d=0. + substitutiing d=0 into bc= res&(~d|s)|(~d&s); + (the one used for sub) and simplifying, since ~d=0xff..., + ~d|s == 0xffff..., and res&0xfff... == res. Similarly + ~d&s == s. So the simplified result is: */ + bc = res | s; + CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the NOT instruction and side effects. +****************************************************************************/ +u8 not_byte(u8 s) +{ + return ~s; +} + +/**************************************************************************** +REMARKS: +Implements the NOT instruction and side effects. +****************************************************************************/ +u16 not_word(u16 s) +{ + return ~s; +} + +/**************************************************************************** +REMARKS: +Implements the NOT instruction and side effects. +****************************************************************************/ +u32 not_long(u32 s) +{ + return ~s; +} + +/**************************************************************************** +REMARKS: +Implements the RCL instruction and side effects. +****************************************************************************/ +u8 rcl_byte(u8 d, u8 s) +{ + register unsigned int res, cnt, mask, cf; + + /* s is the rotate distance. It varies from 0 - 8. */ + /* have + + CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0 + + want to rotate through the carry by "s" bits. We could + loop, but that's inefficient. So the width is 9, + and we split into three parts: + + The new carry flag (was B_n) + the stuff in B_n-1 .. B_0 + the stuff in B_7 .. B_n+1 + + The new rotate is done mod 9, and given this, + for a rotation of n bits (mod 9) the new carry flag is + then located n bits from the MSB. The low part is + then shifted up cnt bits, and the high part is or'd + in. Using CAPS for new values, and lowercase for the + original values, this can be expressed as: + + IF n > 0 + 1) CF <- b_(8-n) + 2) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 + 3) B_(n-1) <- cf + 4) B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1)) + */ + res = d; + if ((cnt = s % 9) != 0) { + /* extract the new CARRY FLAG. */ + /* CF <- b_(8-n) */ + cf = (d >> (8 - cnt)) & 0x1; + + /* get the low stuff which rotated + into the range B_7 .. B_cnt */ + /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 */ + /* note that the right hand side done by the mask */ + res = (d << cnt) & 0xff; + + /* now the high stuff which rotated around + into the positions B_cnt-2 .. B_0 */ + /* B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1)) */ + /* shift it downward, 7-(n-2) = 9-n positions. + and mask off the result before or'ing in. + */ + mask = (1 << (cnt - 1)) - 1; + res |= (d >> (9 - cnt)) & mask; + + /* if the carry flag was set, or it in. */ + if (ACCESS_FLAG(F_CF)) { /* carry flag is set */ + /* B_(n-1) <- cf */ + res |= 1 << (cnt - 1); + } + /* set the new carry flag, based on the variable "cf" */ + CONDITIONAL_SET_FLAG(cf, F_CF); + /* OVERFLOW is set *IFF* cnt==1, then it is the + xor of CF and the most significant bit. Blecck. */ + /* parenthesized this expression since it appears to + be causing OF to be misset */ + CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)), + F_OF); + + } + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the RCL instruction and side effects. +****************************************************************************/ +u16 rcl_word(u16 d, u8 s) +{ + register unsigned int res, cnt, mask, cf; + + res = d; + if ((cnt = s % 17) != 0) { + cf = (d >> (16 - cnt)) & 0x1; + res = (d << cnt) & 0xffff; + mask = (1 << (cnt - 1)) - 1; + res |= (d >> (17 - cnt)) & mask; + if (ACCESS_FLAG(F_CF)) { + res |= 1 << (cnt - 1); + } + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)), + F_OF); + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the RCL instruction and side effects. +****************************************************************************/ +u32 rcl_long(u32 d, u8 s) +{ + register u32 res, cnt, mask, cf; + + res = d; + if ((cnt = s % 33) != 0) { + cf = (d >> (32 - cnt)) & 0x1; + res = (d << cnt) & 0xffffffff; + mask = (1 << (cnt - 1)) - 1; + res |= (d >> (33 - cnt)) & mask; + if (ACCESS_FLAG(F_CF)) { /* carry flag is set */ + res |= 1 << (cnt - 1); + } + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)), + F_OF); + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the RCR instruction and side effects. +****************************************************************************/ +u8 rcr_byte(u8 d, u8 s) +{ + u32 res, cnt; + u32 mask, cf, ocf = 0; + + /* rotate right through carry */ + /* + s is the rotate distance. It varies from 0 - 8. + d is the byte object rotated. + + have + + CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0 + + The new rotate is done mod 9, and given this, + for a rotation of n bits (mod 9) the new carry flag is + then located n bits from the LSB. The low part is + then shifted up cnt bits, and the high part is or'd + in. Using CAPS for new values, and lowercase for the + original values, this can be expressed as: + + IF n > 0 + 1) CF <- b_(n-1) + 2) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) + 3) B_(8-n) <- cf + 4) B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0) + */ + res = d; + if ((cnt = s % 9) != 0) { + /* extract the new CARRY FLAG. */ + /* CF <- b_(n-1) */ + if (cnt == 1) { + cf = d & 0x1; + /* note hackery here. Access_flag(..) evaluates to either + 0 if flag not set + non-zero if flag is set. + doing access_flag(..) != 0 casts that into either + 0..1 in any representation of the flags register + (i.e. packed bit array or unpacked.) + */ + ocf = ACCESS_FLAG(F_CF) != 0; + } else + cf = (d >> (cnt - 1)) & 0x1; + + /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_n */ + /* note that the right hand side done by the mask + This is effectively done by shifting the + object to the right. The result must be masked, + in case the object came in and was treated + as a negative number. Needed??? */ + + mask = (1 << (8 - cnt)) - 1; + res = (d >> cnt) & mask; + + /* now the high stuff which rotated around + into the positions B_cnt-2 .. B_0 */ + /* B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0) */ + /* shift it downward, 7-(n-2) = 9-n positions. + and mask off the result before or'ing in. + */ + res |= (d << (9 - cnt)); + + /* if the carry flag was set, or it in. */ + if (ACCESS_FLAG(F_CF)) { /* carry flag is set */ + /* B_(8-n) <- cf */ + res |= 1 << (8 - cnt); + } + /* set the new carry flag, based on the variable "cf" */ + CONDITIONAL_SET_FLAG(cf, F_CF); + /* OVERFLOW is set *IFF* cnt==1, then it is the + xor of CF and the most significant bit. Blecck. */ + /* parenthesized... */ + if (cnt == 1) { + CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)), + F_OF); + } + } + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the RCR instruction and side effects. +****************************************************************************/ +u16 rcr_word(u16 d, u8 s) +{ + u32 res, cnt; + u32 mask, cf, ocf = 0; + + /* rotate right through carry */ + res = d; + if ((cnt = s % 17) != 0) { + if (cnt == 1) { + cf = d & 0x1; + ocf = ACCESS_FLAG(F_CF) != 0; + } else + cf = (d >> (cnt - 1)) & 0x1; + mask = (1 << (16 - cnt)) - 1; + res = (d >> cnt) & mask; + res |= (d << (17 - cnt)); + if (ACCESS_FLAG(F_CF)) { + res |= 1 << (16 - cnt); + } + CONDITIONAL_SET_FLAG(cf, F_CF); + if (cnt == 1) { + CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)), + F_OF); + } + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the RCR instruction and side effects. +****************************************************************************/ +u32 rcr_long(u32 d, u8 s) +{ + u32 res, cnt; + u32 mask, cf, ocf = 0; + + /* rotate right through carry */ + res = d; + if ((cnt = s % 33) != 0) { + if (cnt == 1) { + cf = d & 0x1; + ocf = ACCESS_FLAG(F_CF) != 0; + } else + cf = (d >> (cnt - 1)) & 0x1; + mask = (1 << (32 - cnt)) - 1; + res = (d >> cnt) & mask; + if (cnt != 1) + res |= (d << (33 - cnt)); + if (ACCESS_FLAG(F_CF)) { /* carry flag is set */ + res |= 1 << (32 - cnt); + } + CONDITIONAL_SET_FLAG(cf, F_CF); + if (cnt == 1) { + CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)), + F_OF); + } + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the ROL instruction and side effects. +****************************************************************************/ +u8 rol_byte(u8 d, u8 s) +{ + register unsigned int res, cnt, mask; + + /* rotate left */ + /* + s is the rotate distance. It varies from 0 - 8. + d is the byte object rotated. + + have + + CF B_7 ... B_0 + + The new rotate is done mod 8. + Much simpler than the "rcl" or "rcr" operations. + + IF n > 0 + 1) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) + 2) B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) + */ + res = d; + if ((cnt = s % 8) != 0) { + /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */ + res = (d << cnt); + + /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */ + mask = (1 << cnt) - 1; + res |= (d >> (8 - cnt)) & mask; + + /* set the new carry flag, Note that it is the low order + bit of the result!!! */ + CONDITIONAL_SET_FLAG(res & 0x1, F_CF); + /* OVERFLOW is set *IFF* s==1, then it is the + xor of CF and the most significant bit. Blecck. */ + CONDITIONAL_SET_FLAG(s == 1 && + XOR2((res & 0x1) + ((res >> 6) & 0x2)), + F_OF); + } if (s != 0) { + /* set the new carry flag, Note that it is the low order + bit of the result!!! */ + CONDITIONAL_SET_FLAG(res & 0x1, F_CF); + } + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the ROL instruction and side effects. +****************************************************************************/ +u16 rol_word(u16 d, u8 s) +{ + register unsigned int res, cnt, mask; + + res = d; + if ((cnt = s % 16) != 0) { + res = (d << cnt); + mask = (1 << cnt) - 1; + res |= (d >> (16 - cnt)) & mask; + CONDITIONAL_SET_FLAG(res & 0x1, F_CF); + CONDITIONAL_SET_FLAG(s == 1 && + XOR2((res & 0x1) + ((res >> 14) & 0x2)), + F_OF); + } if (s != 0) { + /* set the new carry flag, Note that it is the low order + bit of the result!!! */ + CONDITIONAL_SET_FLAG(res & 0x1, F_CF); + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the ROL instruction and side effects. +****************************************************************************/ +u32 rol_long(u32 d, u8 s) +{ + register u32 res, cnt, mask; + + res = d; + if ((cnt = s % 32) != 0) { + res = (d << cnt); + mask = (1 << cnt) - 1; + res |= (d >> (32 - cnt)) & mask; + CONDITIONAL_SET_FLAG(res & 0x1, F_CF); + CONDITIONAL_SET_FLAG(s == 1 && + XOR2((res & 0x1) + ((res >> 30) & 0x2)), + F_OF); + } if (s != 0) { + /* set the new carry flag, Note that it is the low order + bit of the result!!! */ + CONDITIONAL_SET_FLAG(res & 0x1, F_CF); + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the ROR instruction and side effects. +****************************************************************************/ +u8 ror_byte(u8 d, u8 s) +{ + register unsigned int res, cnt, mask; + + /* rotate right */ + /* + s is the rotate distance. It varies from 0 - 8. + d is the byte object rotated. + + have + + B_7 ... B_0 + + The rotate is done mod 8. + + IF n > 0 + 1) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) + 2) B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) + */ + res = d; + if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */ + /* B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */ + res = (d << (8 - cnt)); + + /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) */ + mask = (1 << (8 - cnt)) - 1; + res |= (d >> (cnt)) & mask; + + /* set the new carry flag, Note that it is the low order + bit of the result!!! */ + CONDITIONAL_SET_FLAG(res & 0x80, F_CF); + /* OVERFLOW is set *IFF* s==1, then it is the + xor of the two most significant bits. Blecck. */ + CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF); + } else if (s != 0) { + /* set the new carry flag, Note that it is the low order + bit of the result!!! */ + CONDITIONAL_SET_FLAG(res & 0x80, F_CF); + } + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the ROR instruction and side effects. +****************************************************************************/ +u16 ror_word(u16 d, u8 s) +{ + register unsigned int res, cnt, mask; + + res = d; + if ((cnt = s % 16) != 0) { + res = (d << (16 - cnt)); + mask = (1 << (16 - cnt)) - 1; + res |= (d >> (cnt)) & mask; + CONDITIONAL_SET_FLAG(res & 0x8000, F_CF); + CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF); + } else if (s != 0) { + /* set the new carry flag, Note that it is the low order + bit of the result!!! */ + CONDITIONAL_SET_FLAG(res & 0x8000, F_CF); + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the ROR instruction and side effects. +****************************************************************************/ +u32 ror_long(u32 d, u8 s) +{ + register u32 res, cnt, mask; + + res = d; + if ((cnt = s % 32) != 0) { + res = (d << (32 - cnt)); + mask = (1 << (32 - cnt)) - 1; + res |= (d >> (cnt)) & mask; + CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF); + CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF); + } else if (s != 0) { + /* set the new carry flag, Note that it is the low order + bit of the result!!! */ + CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF); + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the SHL instruction and side effects. +****************************************************************************/ +u8 shl_byte(u8 d, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 8) { + cnt = s % 8; + + /* last bit shifted out goes into carry flag */ + if (cnt > 0) { + res = d << cnt; + cf = d & (1 << (8 - cnt)); + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = (u8) d; + } + + if (cnt == 1) { + /* Needs simplification. */ + CONDITIONAL_SET_FLAG( + (((res & 0x80) == 0x80) ^ + (ACCESS_FLAG(F_CF) != 0)), + /* was (M.x86.R_FLG&F_CF)==F_CF)), */ + F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80, F_CF); + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_SF); + SET_FLAG(F_PF); + SET_FLAG(F_ZF); + } + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the SHL instruction and side effects. +****************************************************************************/ +u16 shl_word(u16 d, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 16) { + cnt = s % 16; + if (cnt > 0) { + res = d << cnt; + cf = d & (1 << (16 - cnt)); + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = (u16) d; + } + + if (cnt == 1) { + CONDITIONAL_SET_FLAG( + (((res & 0x8000) == 0x8000) ^ + (ACCESS_FLAG(F_CF) != 0)), + F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF); + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_SF); + SET_FLAG(F_PF); + SET_FLAG(F_ZF); + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the SHL instruction and side effects. +****************************************************************************/ +u32 shl_long(u32 d, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 32) { + cnt = s % 32; + if (cnt > 0) { + res = d << cnt; + cf = d & (1 << (32 - cnt)); + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = d; + } + if (cnt == 1) { + CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^ + (ACCESS_FLAG(F_CF) != 0)), F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF); + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_SF); + SET_FLAG(F_PF); + SET_FLAG(F_ZF); + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the SHR instruction and side effects. +****************************************************************************/ +u8 shr_byte(u8 d, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 8) { + cnt = s % 8; + if (cnt > 0) { + cf = d & (1 << (cnt - 1)); + res = d >> cnt; + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = (u8) d; + } + + if (cnt == 1) { + CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CONDITIONAL_SET_FLAG((d >> (s-1)) & 0x1, F_CF); + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_SF); + SET_FLAG(F_PF); + SET_FLAG(F_ZF); + } + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the SHR instruction and side effects. +****************************************************************************/ +u16 shr_word(u16 d, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 16) { + cnt = s % 16; + if (cnt > 0) { + cf = d & (1 << (cnt - 1)); + res = d >> cnt; + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = d; + } + + if (cnt == 1) { + CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + SET_FLAG(F_ZF); + CLEAR_FLAG(F_SF); + CLEAR_FLAG(F_PF); + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the SHR instruction and side effects. +****************************************************************************/ +u32 shr_long(u32 d, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 32) { + cnt = s % 32; + if (cnt > 0) { + cf = d & (1 << (cnt - 1)); + res = d >> cnt; + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = d; + } + if (cnt == 1) { + CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + SET_FLAG(F_ZF); + CLEAR_FLAG(F_SF); + CLEAR_FLAG(F_PF); + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the SAR instruction and side effects. +****************************************************************************/ +u8 sar_byte(u8 d, u8 s) +{ + unsigned int cnt, res, cf, mask, sf; + + res = d; + sf = d & 0x80; + cnt = s % 8; + if (cnt > 0 && cnt < 8) { + mask = (1 << (8 - cnt)) - 1; + cf = d & (1 << (cnt - 1)); + res = (d >> cnt) & mask; + CONDITIONAL_SET_FLAG(cf, F_CF); + if (sf) { + res |= ~mask; + } + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + } else if (cnt >= 8) { + if (sf) { + res = 0xff; + SET_FLAG(F_CF); + CLEAR_FLAG(F_ZF); + SET_FLAG(F_SF); + SET_FLAG(F_PF); + } else { + res = 0; + CLEAR_FLAG(F_CF); + SET_FLAG(F_ZF); + CLEAR_FLAG(F_SF); + CLEAR_FLAG(F_PF); + } + } + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the SAR instruction and side effects. +****************************************************************************/ +u16 sar_word(u16 d, u8 s) +{ + unsigned int cnt, res, cf, mask, sf; + + sf = d & 0x8000; + cnt = s % 16; + res = d; + if (cnt > 0 && cnt < 16) { + mask = (1 << (16 - cnt)) - 1; + cf = d & (1 << (cnt - 1)); + res = (d >> cnt) & mask; + CONDITIONAL_SET_FLAG(cf, F_CF); + if (sf) { + res |= ~mask; + } + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else if (cnt >= 16) { + if (sf) { + res = 0xffff; + SET_FLAG(F_CF); + CLEAR_FLAG(F_ZF); + SET_FLAG(F_SF); + SET_FLAG(F_PF); + } else { + res = 0; + CLEAR_FLAG(F_CF); + SET_FLAG(F_ZF); + CLEAR_FLAG(F_SF); + CLEAR_FLAG(F_PF); + } + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the SAR instruction and side effects. +****************************************************************************/ +u32 sar_long(u32 d, u8 s) +{ + u32 cnt, res, cf, mask, sf; + + sf = d & 0x80000000; + cnt = s % 32; + res = d; + if (cnt > 0 && cnt < 32) { + mask = (1 << (32 - cnt)) - 1; + cf = d & (1 << (cnt - 1)); + res = (d >> cnt) & mask; + CONDITIONAL_SET_FLAG(cf, F_CF); + if (sf) { + res |= ~mask; + } + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else if (cnt >= 32) { + if (sf) { + res = 0xffffffff; + SET_FLAG(F_CF); + CLEAR_FLAG(F_ZF); + SET_FLAG(F_SF); + SET_FLAG(F_PF); + } else { + res = 0; + CLEAR_FLAG(F_CF); + SET_FLAG(F_ZF); + CLEAR_FLAG(F_SF); + CLEAR_FLAG(F_PF); + } + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the SHLD instruction and side effects. +****************************************************************************/ +u16 shld_word (u16 d, u16 fill, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 16) { + cnt = s % 16; + if (cnt > 0) { + res = (d << cnt) | (fill >> (16-cnt)); + cf = d & (1 << (16 - cnt)); + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = d; + } + if (cnt == 1) { + CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^ + (ACCESS_FLAG(F_CF) != 0)), F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF); + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_SF); + SET_FLAG(F_PF); + SET_FLAG(F_ZF); + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the SHLD instruction and side effects. +****************************************************************************/ +u32 shld_long (u32 d, u32 fill, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 32) { + cnt = s % 32; + if (cnt > 0) { + res = (d << cnt) | (fill >> (32-cnt)); + cf = d & (1 << (32 - cnt)); + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = d; + } + if (cnt == 1) { + CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^ + (ACCESS_FLAG(F_CF) != 0)), F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF); + CLEAR_FLAG(F_OF); + CLEAR_FLAG(F_SF); + SET_FLAG(F_PF); + SET_FLAG(F_ZF); + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the SHRD instruction and side effects. +****************************************************************************/ +u16 shrd_word (u16 d, u16 fill, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 16) { + cnt = s % 16; + if (cnt > 0) { + cf = d & (1 << (cnt - 1)); + res = (d >> cnt) | (fill << (16 - cnt)); + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = d; + } + + if (cnt == 1) { + CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + SET_FLAG(F_ZF); + CLEAR_FLAG(F_SF); + CLEAR_FLAG(F_PF); + } + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the SHRD instruction and side effects. +****************************************************************************/ +u32 shrd_long (u32 d, u32 fill, u8 s) +{ + unsigned int cnt, res, cf; + + if (s < 32) { + cnt = s % 32; + if (cnt > 0) { + cf = d & (1 << (cnt - 1)); + res = (d >> cnt) | (fill << (32 - cnt)); + CONDITIONAL_SET_FLAG(cf, F_CF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + } else { + res = d; + } + if (cnt == 1) { + CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF); + } else { + CLEAR_FLAG(F_OF); + } + } else { + res = 0; + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + SET_FLAG(F_ZF); + CLEAR_FLAG(F_SF); + CLEAR_FLAG(F_PF); + } + return res; +} + +/**************************************************************************** +REMARKS: +Implements the SBB instruction and side effects. +****************************************************************************/ +u8 sbb_byte(u8 d, u8 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + if (ACCESS_FLAG(F_CF)) + res = d - s - 1; + else + res = d - s; + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x80, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the SBB instruction and side effects. +****************************************************************************/ +u16 sbb_word(u16 d, u16 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + if (ACCESS_FLAG(F_CF)) + res = d - s - 1; + else + res = d - s; + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the SBB instruction and side effects. +****************************************************************************/ +u32 sbb_long(u32 d, u32 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + if (ACCESS_FLAG(F_CF)) + res = d - s - 1; + else + res = d - s; + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the SUB instruction and side effects. +****************************************************************************/ +u8 sub_byte(u8 d, u8 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - s; + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x80, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return (u8)res; +} + +/**************************************************************************** +REMARKS: +Implements the SUB instruction and side effects. +****************************************************************************/ +u16 sub_word(u16 d, u16 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - s; + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return (u16)res; +} + +/**************************************************************************** +REMARKS: +Implements the SUB instruction and side effects. +****************************************************************************/ +u32 sub_long(u32 d, u32 s) +{ + register u32 res; /* all operands in native machine order */ + register u32 bc; + + res = d - s; + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + + /* calculate the borrow chain. See note at top */ + bc = (res & (~d | s)) | (~d & s); + CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF); + CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF); + CONDITIONAL_SET_FLAG(bc & 0x8, F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the TEST instruction and side effects. +****************************************************************************/ +void test_byte(u8 d, u8 s) +{ + register u32 res; /* all operands in native machine order */ + + res = d & s; + + CLEAR_FLAG(F_OF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + /* AF == dont care */ + CLEAR_FLAG(F_CF); +} + +/**************************************************************************** +REMARKS: +Implements the TEST instruction and side effects. +****************************************************************************/ +void test_word(u16 d, u16 s) +{ + register u32 res; /* all operands in native machine order */ + + res = d & s; + + CLEAR_FLAG(F_OF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + /* AF == dont care */ + CLEAR_FLAG(F_CF); +} + +/**************************************************************************** +REMARKS: +Implements the TEST instruction and side effects. +****************************************************************************/ +void test_long(u32 d, u32 s) +{ + register u32 res; /* all operands in native machine order */ + + res = d & s; + + CLEAR_FLAG(F_OF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + /* AF == dont care */ + CLEAR_FLAG(F_CF); +} + +/**************************************************************************** +REMARKS: +Implements the XOR instruction and side effects. +****************************************************************************/ +u8 xor_byte(u8 d, u8 s) +{ + register u8 res; /* all operands in native machine order */ + + res = d ^ s; + CLEAR_FLAG(F_OF); + CONDITIONAL_SET_FLAG(res & 0x80, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res), F_PF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the XOR instruction and side effects. +****************************************************************************/ +u16 xor_word(u16 d, u16 s) +{ + register u16 res; /* all operands in native machine order */ + + res = d ^ s; + CLEAR_FLAG(F_OF); + CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the XOR instruction and side effects. +****************************************************************************/ +u32 xor_long(u32 d, u32 s) +{ + register u32 res; /* all operands in native machine order */ + + res = d ^ s; + CLEAR_FLAG(F_OF); + CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); + CONDITIONAL_SET_FLAG(res == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF); + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + return res; +} + +/**************************************************************************** +REMARKS: +Implements the IMUL instruction and side effects. +****************************************************************************/ +void imul_byte(u8 s) +{ + s16 res = (s16)((s8)M.x86.R_AL * (s8)s); + + M.x86.R_AX = res; + if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) || + ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } else { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } +} + +/**************************************************************************** +REMARKS: +Implements the IMUL instruction and side effects. +****************************************************************************/ +void imul_word(u16 s) +{ + s32 res = (s16)M.x86.R_AX * (s16)s; + + M.x86.R_AX = (u16)res; + M.x86.R_DX = (u16)(res >> 16); + if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) || + ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } else { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } +} + +/**************************************************************************** +REMARKS: +Implements the IMUL instruction and side effects. +****************************************************************************/ +void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s) +{ +#ifdef __HAS_LONG_LONG__ + s64 res = (s32)d * (s32)s; + + *res_lo = (u32)res; + *res_hi = (u32)(res >> 32); +#else + u32 d_lo,d_hi,d_sign; + u32 s_lo,s_hi,s_sign; + u32 rlo_lo,rlo_hi,rhi_lo; + + if ((d_sign = d & 0x80000000) != 0) + d = -d; + d_lo = d & 0xFFFF; + d_hi = d >> 16; + if ((s_sign = s & 0x80000000) != 0) + s = -s; + s_lo = s & 0xFFFF; + s_hi = s >> 16; + rlo_lo = d_lo * s_lo; + rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16); + rhi_lo = d_hi * s_hi + (rlo_hi >> 16); + *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF); + *res_hi = rhi_lo; + if (d_sign != s_sign) { + d = ~*res_lo; + s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16); + *res_lo = ~*res_lo+1; + *res_hi = ~*res_hi+(s >> 16); + } +#endif +} + +/**************************************************************************** +REMARKS: +Implements the IMUL instruction and side effects. +****************************************************************************/ +void imul_long(u32 s) +{ + imul_long_direct(&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s); + if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) || + ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } else { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } +} + +/**************************************************************************** +REMARKS: +Implements the MUL instruction and side effects. +****************************************************************************/ +void mul_byte(u8 s) +{ + u16 res = (u16)(M.x86.R_AL * s); + + M.x86.R_AX = res; + if (M.x86.R_AH == 0) { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } else { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } +} + +/**************************************************************************** +REMARKS: +Implements the MUL instruction and side effects. +****************************************************************************/ +void mul_word(u16 s) +{ + u32 res = M.x86.R_AX * s; + + M.x86.R_AX = (u16)res; + M.x86.R_DX = (u16)(res >> 16); + if (M.x86.R_DX == 0) { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } else { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } +} + +/**************************************************************************** +REMARKS: +Implements the MUL instruction and side effects. +****************************************************************************/ +void mul_long(u32 s) +{ +#ifdef __HAS_LONG_LONG__ + u64 res = (u32)M.x86.R_EAX * (u32)s; + + M.x86.R_EAX = (u32)res; + M.x86.R_EDX = (u32)(res >> 32); +#else + u32 a,a_lo,a_hi; + u32 s_lo,s_hi; + u32 rlo_lo,rlo_hi,rhi_lo; + + a = M.x86.R_EAX; + a_lo = a & 0xFFFF; + a_hi = a >> 16; + s_lo = s & 0xFFFF; + s_hi = s >> 16; + rlo_lo = a_lo * s_lo; + rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16); + rhi_lo = a_hi * s_hi + (rlo_hi >> 16); + M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF); + M.x86.R_EDX = rhi_lo; +#endif + + if (M.x86.R_EDX == 0) { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_OF); + } else { + SET_FLAG(F_CF); + SET_FLAG(F_OF); + } +} + +/**************************************************************************** +REMARKS: +Implements the IDIV instruction and side effects. +****************************************************************************/ +#define abs(a) (((a) < 0) ? -(a) : (a)) +void idiv_byte(u8 s) +{ + s32 dvd, div, mod; + + dvd = (s16)M.x86.R_AX; + if (s == 0) { + x86emu_intr_raise(0); + return; + } + div = dvd / (s8)s; + mod = dvd % (s8)s; + if (abs(div) > 0x7f) { + x86emu_intr_raise(0); + return; + } + M.x86.R_AL = (s8) div; + M.x86.R_AH = (s8) mod; +} + +/**************************************************************************** +REMARKS: +Implements the IDIV instruction and side effects. +****************************************************************************/ +void idiv_word(u16 s) +{ + s32 dvd, div, mod; + + dvd = (((s32)M.x86.R_DX) << 16) | M.x86.R_AX; + if (s == 0) { + x86emu_intr_raise(0); + return; + } + div = dvd / (s16)s; + mod = dvd % (s16)s; + if (abs(div) > 0x7fff) { + x86emu_intr_raise(0); + return; + } + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_SF); + CONDITIONAL_SET_FLAG(div == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF); + + M.x86.R_AX = (u16)div; + M.x86.R_DX = (u16)mod; +} + +/**************************************************************************** +REMARKS: +Implements the IDIV instruction and side effects. +****************************************************************************/ +void idiv_long(u32 s) +{ +#ifdef __HAS_LONG_LONG__ + s64 dvd, div, mod; + + dvd = (((s64)M.x86.R_EDX) << 32) | M.x86.R_EAX; + if (s == 0) { + x86emu_intr_raise(0); + return; + } + div = dvd / (s32)s; + mod = dvd % (s32)s; + if (abs(div) > 0x7fffffff) { + x86emu_intr_raise(0); + return; + } +#else + s32 div = 0, mod; + s32 h_dvd = M.x86.R_EDX; + u32 l_dvd = M.x86.R_EAX; + u32 abs_s = s & 0x7FFFFFFF; + u32 abs_h_dvd = h_dvd & 0x7FFFFFFF; + u32 h_s = abs_s >> 1; + u32 l_s = abs_s << 31; + int counter = 31; + int carry; + + if (s == 0) { + x86emu_intr_raise(0); + return; + } + do { + div <<= 1; + carry = (l_dvd >= l_s) ? 0 : 1; + + if (abs_h_dvd < (h_s + carry)) { + h_s >>= 1; + l_s = abs_s << (--counter); + continue; + } else { + abs_h_dvd -= (h_s + carry); + l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1) + : (l_dvd - l_s); + h_s >>= 1; + l_s = abs_s << (--counter); + div |= 1; + continue; + } + + } while (counter > -1); + /* overflow */ + if (abs_h_dvd || (l_dvd > abs_s)) { + x86emu_intr_raise(0); + return; + } + /* sign */ + div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000)); + mod = l_dvd; + +#endif + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CLEAR_FLAG(F_SF); + SET_FLAG(F_ZF); + CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF); + + M.x86.R_EAX = (u32)div; + M.x86.R_EDX = (u32)mod; +} + +/**************************************************************************** +REMARKS: +Implements the DIV instruction and side effects. +****************************************************************************/ +void div_byte(u8 s) +{ + u32 dvd, div, mod; + + dvd = M.x86.R_AX; + if (s == 0) { + x86emu_intr_raise(0); + return; + } + div = dvd / (u8)s; + mod = dvd % (u8)s; + if (abs(div) > 0xff) { + x86emu_intr_raise(0); + return; + } + M.x86.R_AL = (u8)div; + M.x86.R_AH = (u8)mod; +} + +/**************************************************************************** +REMARKS: +Implements the DIV instruction and side effects. +****************************************************************************/ +void div_word(u16 s) +{ + u32 dvd, div, mod; + + dvd = (((u32)M.x86.R_DX) << 16) | M.x86.R_AX; + if (s == 0) { + x86emu_intr_raise(0); + return; + } + div = dvd / (u16)s; + mod = dvd % (u16)s; + if (abs(div) > 0xffff) { + x86emu_intr_raise(0); + return; + } + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_SF); + CONDITIONAL_SET_FLAG(div == 0, F_ZF); + CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF); + + M.x86.R_AX = (u16)div; + M.x86.R_DX = (u16)mod; +} + +/**************************************************************************** +REMARKS: +Implements the DIV instruction and side effects. +****************************************************************************/ +void div_long(u32 s) +{ +#ifdef __HAS_LONG_LONG__ + u64 dvd, div, mod; + + dvd = (((u64)M.x86.R_EDX) << 32) | M.x86.R_EAX; + if (s == 0) { + x86emu_intr_raise(0); + return; + } + div = dvd / (u32)s; + mod = dvd % (u32)s; + if (abs(div) > 0xffffffff) { + x86emu_intr_raise(0); + return; + } +#else + s32 div = 0, mod; + s32 h_dvd = M.x86.R_EDX; + u32 l_dvd = M.x86.R_EAX; + + u32 h_s = s; + u32 l_s = 0; + int counter = 32; + int carry; + + if (s == 0) { + x86emu_intr_raise(0); + return; + } + do { + div <<= 1; + carry = (l_dvd >= l_s) ? 0 : 1; + + if (h_dvd < (h_s + carry)) { + h_s >>= 1; + l_s = s << (--counter); + continue; + } else { + h_dvd -= (h_s + carry); + l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1) + : (l_dvd - l_s); + h_s >>= 1; + l_s = s << (--counter); + div |= 1; + continue; + } + + } while (counter > -1); + /* overflow */ + if (h_dvd || (l_dvd > s)) { + x86emu_intr_raise(0); + return; + } + mod = l_dvd; +#endif + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_AF); + CLEAR_FLAG(F_SF); + SET_FLAG(F_ZF); + CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF); + + M.x86.R_EAX = (u32)div; + M.x86.R_EDX = (u32)mod; +} + +#endif /* __HAVE_INLINE_ASSEMBLER__ */ + +/**************************************************************************** +REMARKS: +Implements the IN string instruction and side effects. +****************************************************************************/ +void ins(int size) +{ + int inc = size; + + if (ACCESS_FLAG(F_DF)) { + inc = -size; + } + if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { + /* dont care whether REPE or REPNE */ + /* in until CX is ZERO. */ + u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ? + M.x86.R_ECX : M.x86.R_CX); + switch (size) { + case 1: + while (count--) { + store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, + (*sys_inb)(M.x86.R_DX)); + M.x86.R_DI += inc; + } + break; + + case 2: + while (count--) { + store_data_word_abs(M.x86.R_ES, M.x86.R_DI, + (*sys_inw)(M.x86.R_DX)); + M.x86.R_DI += inc; + } + break; + case 4: + while (count--) { + store_data_long_abs(M.x86.R_ES, M.x86.R_DI, + (*sys_inl)(M.x86.R_DX)); + M.x86.R_DI += inc; + break; + } + } + M.x86.R_CX = 0; + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_ECX = 0; + } + M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); + } else { + switch (size) { + case 1: + store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, + (*sys_inb)(M.x86.R_DX)); + break; + case 2: + store_data_word_abs(M.x86.R_ES, M.x86.R_DI, + (*sys_inw)(M.x86.R_DX)); + break; + case 4: + store_data_long_abs(M.x86.R_ES, M.x86.R_DI, + (*sys_inl)(M.x86.R_DX)); + break; + } + M.x86.R_DI += inc; + } +} + +/**************************************************************************** +REMARKS: +Implements the OUT string instruction and side effects. +****************************************************************************/ +void outs(int size) +{ + int inc = size; + + if (ACCESS_FLAG(F_DF)) { + inc = -size; + } + if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) { + /* dont care whether REPE or REPNE */ + /* out until CX is ZERO. */ + u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ? + M.x86.R_ECX : M.x86.R_CX); + switch (size) { + case 1: + while (count--) { + (*sys_outb)(M.x86.R_DX, + fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI)); + M.x86.R_SI += inc; + } + break; + + case 2: + while (count--) { + (*sys_outw)(M.x86.R_DX, + fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI)); + M.x86.R_SI += inc; + } + break; + case 4: + while (count--) { + (*sys_outl)(M.x86.R_DX, + fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI)); + M.x86.R_SI += inc; + break; + } + } + M.x86.R_CX = 0; + if (M.x86.mode & SYSMODE_PREFIX_DATA) { + M.x86.R_ECX = 0; + } + M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE); + } else { + switch (size) { + case 1: + (*sys_outb)(M.x86.R_DX, + fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI)); + break; + case 2: + (*sys_outw)(M.x86.R_DX, + fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI)); + break; + case 4: + (*sys_outl)(M.x86.R_DX, + fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI)); + break; + } + M.x86.R_SI += inc; + } +} + +/**************************************************************************** +PARAMETERS: +addr - Address to fetch word from + +REMARKS: +Fetches a word from emulator memory using an absolute address. +****************************************************************************/ +u16 mem_access_word(int addr) +{ +DB( if (CHECK_MEM_ACCESS()) + x86emu_check_mem_access(addr);) + return (*sys_rdw)(addr); +} + +/**************************************************************************** +REMARKS: +Pushes a word onto the stack. + +NOTE: Do not inline this, as (*sys_wrX) is already inline! +****************************************************************************/ +void push_word(u16 w) +{ +DB( if (CHECK_SP_ACCESS()) + x86emu_check_sp_access();) + M.x86.R_SP -= 2; + (*sys_wrw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w); +} + +/**************************************************************************** +REMARKS: +Pushes a long onto the stack. + +NOTE: Do not inline this, as (*sys_wrX) is already inline! +****************************************************************************/ +void push_long(u32 w) +{ +DB( if (CHECK_SP_ACCESS()) + x86emu_check_sp_access();) + M.x86.R_SP -= 4; + (*sys_wrl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w); +} + +/**************************************************************************** +REMARKS: +Pops a word from the stack. + +NOTE: Do not inline this, as (*sys_rdX) is already inline! +****************************************************************************/ +u16 pop_word(void) +{ + register u16 res; + +DB( if (CHECK_SP_ACCESS()) + x86emu_check_sp_access();) + res = (*sys_rdw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP); + M.x86.R_SP += 2; + return res; +} + +/**************************************************************************** +REMARKS: +Pops a long from the stack. + +NOTE: Do not inline this, as (*sys_rdX) is already inline! +****************************************************************************/ +u32 pop_long(void) +{ + register u32 res; + +DB( if (CHECK_SP_ACCESS()) + x86emu_check_sp_access();) + res = (*sys_rdl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP); + M.x86.R_SP += 4; + return res; +} + +#ifdef __HAVE_INLINE_ASSEMBLER__ + +u16 aaa_word (u16 d) +{ return aaa_word_asm(&M.x86.R_EFLG,d); } + +u16 aas_word (u16 d) +{ return aas_word_asm(&M.x86.R_EFLG,d); } + +u16 aad_word (u16 d) +{ return aad_word_asm(&M.x86.R_EFLG,d); } + +u16 aam_word (u8 d) +{ return aam_word_asm(&M.x86.R_EFLG,d); } + +u8 adc_byte (u8 d, u8 s) +{ return adc_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 adc_word (u16 d, u16 s) +{ return adc_word_asm(&M.x86.R_EFLG,d,s); } + +u32 adc_long (u32 d, u32 s) +{ return adc_long_asm(&M.x86.R_EFLG,d,s); } + +u8 add_byte (u8 d, u8 s) +{ return add_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 add_word (u16 d, u16 s) +{ return add_word_asm(&M.x86.R_EFLG,d,s); } + +u32 add_long (u32 d, u32 s) +{ return add_long_asm(&M.x86.R_EFLG,d,s); } + +u8 and_byte (u8 d, u8 s) +{ return and_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 and_word (u16 d, u16 s) +{ return and_word_asm(&M.x86.R_EFLG,d,s); } + +u32 and_long (u32 d, u32 s) +{ return and_long_asm(&M.x86.R_EFLG,d,s); } + +u8 cmp_byte (u8 d, u8 s) +{ return cmp_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 cmp_word (u16 d, u16 s) +{ return cmp_word_asm(&M.x86.R_EFLG,d,s); } + +u32 cmp_long (u32 d, u32 s) +{ return cmp_long_asm(&M.x86.R_EFLG,d,s); } + +u8 daa_byte (u8 d) +{ return daa_byte_asm(&M.x86.R_EFLG,d); } + +u8 das_byte (u8 d) +{ return das_byte_asm(&M.x86.R_EFLG,d); } + +u8 dec_byte (u8 d) +{ return dec_byte_asm(&M.x86.R_EFLG,d); } + +u16 dec_word (u16 d) +{ return dec_word_asm(&M.x86.R_EFLG,d); } + +u32 dec_long (u32 d) +{ return dec_long_asm(&M.x86.R_EFLG,d); } + +u8 inc_byte (u8 d) +{ return inc_byte_asm(&M.x86.R_EFLG,d); } + +u16 inc_word (u16 d) +{ return inc_word_asm(&M.x86.R_EFLG,d); } + +u32 inc_long (u32 d) +{ return inc_long_asm(&M.x86.R_EFLG,d); } + +u8 or_byte (u8 d, u8 s) +{ return or_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 or_word (u16 d, u16 s) +{ return or_word_asm(&M.x86.R_EFLG,d,s); } + +u32 or_long (u32 d, u32 s) +{ return or_long_asm(&M.x86.R_EFLG,d,s); } + +u8 neg_byte (u8 s) +{ return neg_byte_asm(&M.x86.R_EFLG,s); } + +u16 neg_word (u16 s) +{ return neg_word_asm(&M.x86.R_EFLG,s); } + +u32 neg_long (u32 s) +{ return neg_long_asm(&M.x86.R_EFLG,s); } + +u8 not_byte (u8 s) +{ return not_byte_asm(&M.x86.R_EFLG,s); } + +u16 not_word (u16 s) +{ return not_word_asm(&M.x86.R_EFLG,s); } + +u32 not_long (u32 s) +{ return not_long_asm(&M.x86.R_EFLG,s); } + +u8 rcl_byte (u8 d, u8 s) +{ return rcl_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 rcl_word (u16 d, u8 s) +{ return rcl_word_asm(&M.x86.R_EFLG,d,s); } + +u32 rcl_long (u32 d, u8 s) +{ return rcl_long_asm(&M.x86.R_EFLG,d,s); } + +u8 rcr_byte (u8 d, u8 s) +{ return rcr_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 rcr_word (u16 d, u8 s) +{ return rcr_word_asm(&M.x86.R_EFLG,d,s); } + +u32 rcr_long (u32 d, u8 s) +{ return rcr_long_asm(&M.x86.R_EFLG,d,s); } + +u8 rol_byte (u8 d, u8 s) +{ return rol_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 rol_word (u16 d, u8 s) +{ return rol_word_asm(&M.x86.R_EFLG,d,s); } + +u32 rol_long (u32 d, u8 s) +{ return rol_long_asm(&M.x86.R_EFLG,d,s); } + +u8 ror_byte (u8 d, u8 s) +{ return ror_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 ror_word (u16 d, u8 s) +{ return ror_word_asm(&M.x86.R_EFLG,d,s); } + +u32 ror_long (u32 d, u8 s) +{ return ror_long_asm(&M.x86.R_EFLG,d,s); } + +u8 shl_byte (u8 d, u8 s) +{ return shl_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 shl_word (u16 d, u8 s) +{ return shl_word_asm(&M.x86.R_EFLG,d,s); } + +u32 shl_long (u32 d, u8 s) +{ return shl_long_asm(&M.x86.R_EFLG,d,s); } + +u8 shr_byte (u8 d, u8 s) +{ return shr_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 shr_word (u16 d, u8 s) +{ return shr_word_asm(&M.x86.R_EFLG,d,s); } + +u32 shr_long (u32 d, u8 s) +{ return shr_long_asm(&M.x86.R_EFLG,d,s); } + +u8 sar_byte (u8 d, u8 s) +{ return sar_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 sar_word (u16 d, u8 s) +{ return sar_word_asm(&M.x86.R_EFLG,d,s); } + +u32 sar_long (u32 d, u8 s) +{ return sar_long_asm(&M.x86.R_EFLG,d,s); } + +u16 shld_word (u16 d, u16 fill, u8 s) +{ return shld_word_asm(&M.x86.R_EFLG,d,fill,s); } + +u32 shld_long (u32 d, u32 fill, u8 s) +{ return shld_long_asm(&M.x86.R_EFLG,d,fill,s); } + +u16 shrd_word (u16 d, u16 fill, u8 s) +{ return shrd_word_asm(&M.x86.R_EFLG,d,fill,s); } + +u32 shrd_long (u32 d, u32 fill, u8 s) +{ return shrd_long_asm(&M.x86.R_EFLG,d,fill,s); } + +u8 sbb_byte (u8 d, u8 s) +{ return sbb_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 sbb_word (u16 d, u16 s) +{ return sbb_word_asm(&M.x86.R_EFLG,d,s); } + +u32 sbb_long (u32 d, u32 s) +{ return sbb_long_asm(&M.x86.R_EFLG,d,s); } + +u8 sub_byte (u8 d, u8 s) +{ return sub_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 sub_word (u16 d, u16 s) +{ return sub_word_asm(&M.x86.R_EFLG,d,s); } + +u32 sub_long (u32 d, u32 s) +{ return sub_long_asm(&M.x86.R_EFLG,d,s); } + +void test_byte (u8 d, u8 s) +{ test_byte_asm(&M.x86.R_EFLG,d,s); } + +void test_word (u16 d, u16 s) +{ test_word_asm(&M.x86.R_EFLG,d,s); } + +void test_long (u32 d, u32 s) +{ test_long_asm(&M.x86.R_EFLG,d,s); } + +u8 xor_byte (u8 d, u8 s) +{ return xor_byte_asm(&M.x86.R_EFLG,d,s); } + +u16 xor_word (u16 d, u16 s) +{ return xor_word_asm(&M.x86.R_EFLG,d,s); } + +u32 xor_long (u32 d, u32 s) +{ return xor_long_asm(&M.x86.R_EFLG,d,s); } + +void imul_byte (u8 s) +{ imul_byte_asm(&M.x86.R_EFLG,&M.x86.R_AX,M.x86.R_AL,s); } + +void imul_word (u16 s) +{ imul_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,s); } + +void imul_long (u32 s) +{ imul_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s); } + +void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s) +{ imul_long_asm(&M.x86.R_EFLG,res_lo,res_hi,d,s); } + +void mul_byte (u8 s) +{ mul_byte_asm(&M.x86.R_EFLG,&M.x86.R_AX,M.x86.R_AL,s); } + +void mul_word (u16 s) +{ mul_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,s); } + +void mul_long (u32 s) +{ mul_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s); } + +void idiv_byte (u8 s) +{ idiv_byte_asm(&M.x86.R_EFLG,&M.x86.R_AL,&M.x86.R_AH,M.x86.R_AX,s); } + +void idiv_word (u16 s) +{ idiv_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,M.x86.R_DX,s); } + +void idiv_long (u32 s) +{ idiv_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,M.x86.R_EDX,s); } + +void div_byte (u8 s) +{ div_byte_asm(&M.x86.R_EFLG,&M.x86.R_AL,&M.x86.R_AH,M.x86.R_AX,s); } + +void div_word (u16 s) +{ div_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,M.x86.R_DX,s); } + +void div_long (u32 s) +{ div_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,M.x86.R_EDX,s); } + +#endif diff --git a/cfe/cfe/x86emu/sys.c b/cfe/cfe/x86emu/sys.c new file mode 100644 index 0000000..f80d755 --- /dev/null +++ b/cfe/cfe/x86emu/sys.c @@ -0,0 +1,603 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: This file includes subroutines which are related to +* programmed I/O and memory access. Included in this module +* are default functions with limited usefulness. For real +* uses these functions will most likely be overriden by the +* user library. +* +****************************************************************************/ +/* $XFree86: xc/extras/x86emu/src/x86emu/sys.c,v 1.5 2000/08/23 22:10:01 tsi Exp $ */ + +#include "x86emu.h" +#include "x86emu/regs.h" +#include "x86emu/debug.h" +#include "x86emu/prim_ops.h" +#ifdef IN_MODULE +#include "xf86_ansic.h" +#else +/*#include */ +#define NULL 0 +#endif +/*------------------------- Global Variables ------------------------------*/ + +X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */ +X86EMU_intrFuncs _X86EMU_intrTab[256]; + +/*----------------------------- Implementation ----------------------------*/ +#if defined(__alpha__) || defined(__alpha) +/* to cope with broken egcs-1.1.2 :-(((( */ + +/* + * inline functions to do unaligned accesses + * from linux/include/asm-alpha/unaligned.h + */ + +/* + * EGCS 1.1 knows about arbitrary unaligned loads. Define some + * packed structures to talk about such things with. + */ + +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 +struct __una_u64 { unsigned long x __attribute__((packed)); }; +struct __una_u32 { unsigned int x __attribute__((packed)); }; +struct __una_u16 { unsigned short x __attribute__((packed)); }; +#endif + +static __inline__ unsigned long ldq_u(unsigned long * r11) +{ +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 + const struct __una_u64 *ptr = (const struct __una_u64 *) r11; + return ptr->x; +#else + unsigned long r1,r2; + __asm__("ldq_u %0,%3\n\t" + "ldq_u %1,%4\n\t" + "extql %0,%2,%0\n\t" + "extqh %1,%2,%1" + :"=&r" (r1), "=&r" (r2) + :"r" (r11), + "m" (*r11), + "m" (*(const unsigned long *)(7+(char *) r11))); + return r1 | r2; +#endif +} + +static __inline__ unsigned long ldl_u(unsigned int * r11) +{ +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 + const struct __una_u32 *ptr = (const struct __una_u32 *) r11; + return ptr->x; +#else + unsigned long r1,r2; + __asm__("ldq_u %0,%3\n\t" + "ldq_u %1,%4\n\t" + "extll %0,%2,%0\n\t" + "extlh %1,%2,%1" + :"=&r" (r1), "=&r" (r2) + :"r" (r11), + "m" (*r11), + "m" (*(const unsigned long *)(3+(char *) r11))); + return r1 | r2; +#endif +} + +static __inline__ unsigned long ldw_u(unsigned short * r11) +{ +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 + const struct __una_u16 *ptr = (const struct __una_u16 *) r11; + return ptr->x; +#else + unsigned long r1,r2; + __asm__("ldq_u %0,%3\n\t" + "ldq_u %1,%4\n\t" + "extwl %0,%2,%0\n\t" + "extwh %1,%2,%1" + :"=&r" (r1), "=&r" (r2) + :"r" (r11), + "m" (*r11), + "m" (*(const unsigned long *)(1+(char *) r11))); + return r1 | r2; +#endif +} + +/* + * Elemental unaligned stores + */ + +static __inline__ void stq_u(unsigned long r5, unsigned long * r11) +{ +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 + struct __una_u64 *ptr = (struct __una_u64 *) r11; + ptr->x = r5; +#else + unsigned long r1,r2,r3,r4; + + __asm__("ldq_u %3,%1\n\t" + "ldq_u %2,%0\n\t" + "insqh %6,%7,%5\n\t" + "insql %6,%7,%4\n\t" + "mskqh %3,%7,%3\n\t" + "mskql %2,%7,%2\n\t" + "bis %3,%5,%3\n\t" + "bis %2,%4,%2\n\t" + "stq_u %3,%1\n\t" + "stq_u %2,%0" + :"=m" (*r11), + "=m" (*(unsigned long *)(7+(char *) r11)), + "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) + :"r" (r5), "r" (r11)); +#endif +} + +static __inline__ void stl_u(unsigned long r5, unsigned int * r11) +{ +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 + struct __una_u32 *ptr = (struct __una_u32 *) r11; + ptr->x = r5; +#else + unsigned long r1,r2,r3,r4; + + __asm__("ldq_u %3,%1\n\t" + "ldq_u %2,%0\n\t" + "inslh %6,%7,%5\n\t" + "insll %6,%7,%4\n\t" + "msklh %3,%7,%3\n\t" + "mskll %2,%7,%2\n\t" + "bis %3,%5,%3\n\t" + "bis %2,%4,%2\n\t" + "stq_u %3,%1\n\t" + "stq_u %2,%0" + :"=m" (*r11), + "=m" (*(unsigned long *)(3+(char *) r11)), + "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) + :"r" (r5), "r" (r11)); +#endif +} + +static __inline__ void stw_u(unsigned long r5, unsigned short * r11) +{ +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91 + struct __una_u16 *ptr = (struct __una_u16 *) r11; + ptr->x = r5; +#else + unsigned long r1,r2,r3,r4; + + __asm__("ldq_u %3,%1\n\t" + "ldq_u %2,%0\n\t" + "inswh %6,%7,%5\n\t" + "inswl %6,%7,%4\n\t" + "mskwh %3,%7,%3\n\t" + "mskwl %2,%7,%2\n\t" + "bis %3,%5,%3\n\t" + "bis %2,%4,%2\n\t" + "stq_u %3,%1\n\t" + "stq_u %2,%0" + :"=m" (*r11), + "=m" (*(unsigned long *)(1+(char *) r11)), + "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) + :"r" (r5), "r" (r11)); +#endif +} +#endif + +/**************************************************************************** +PARAMETERS: +addr - Emulator memory address to read + +RETURNS: +Byte value read from emulator memory. + +REMARKS: +Reads a byte value from the emulator memory. +****************************************************************************/ +u8 X86API rdb( + u32 addr) +{ + u8 val; + + if (addr > M.mem_size - 1) { + DB(printk("mem_read: address %#lx out of range!\n", addr);) + HALT_SYS(); + } + val = *(u8*)(M.mem_base + addr); +DB( if (DEBUG_MEM_TRACE()) + printk("%#08x 1 -> %#x\n", addr, val);) + return val; +} + +/**************************************************************************** +PARAMETERS: +addr - Emulator memory address to read + +RETURNS: +Word value read from emulator memory. + +REMARKS: +Reads a word value from the emulator memory. +****************************************************************************/ +u16 X86API rdw( + u32 addr) +{ + u16 val = 0; + + if (addr > M.mem_size - 2) { + DB(printk("mem_read: address %#lx out of range!\n", addr);) + HALT_SYS(); + } +#ifdef __BIG_ENDIAN__ + if (addr & 0x1) { + val = (*(u8*)(M.mem_base + addr) | + (*(u8*)(M.mem_base + addr + 1) << 8)); + } + else +#endif +#if defined(__alpha__) || defined(__alpha) + val = ldw_u((u16*)(M.mem_base + addr)); +#else + val = *(u16*)(M.mem_base + addr); +#endif + DB( if (DEBUG_MEM_TRACE()) + printk("%#08x 2 -> %#x\n", addr, val);) + return val; +} + +/**************************************************************************** +PARAMETERS: +addr - Emulator memory address to read + +RETURNS: +Long value read from emulator memory. +REMARKS: +Reads a long value from the emulator memory. +****************************************************************************/ +u32 X86API rdl( + u32 addr) +{ + u32 val = 0; + + if (addr > M.mem_size - 4) { + DB(printk("mem_read: address %#lx out of range!\n", addr);) + HALT_SYS(); + } +#ifdef __BIG_ENDIAN__ + if (addr & 0x3) { + val = (*(u8*)(M.mem_base + addr + 0) | + (*(u8*)(M.mem_base + addr + 1) << 8) | + (*(u8*)(M.mem_base + addr + 2) << 16) | + (*(u8*)(M.mem_base + addr + 3) << 24)); + } + else +#endif +#if defined(__alpha__) || defined(__alpha) + val = ldl_u((u32*)(M.mem_base + addr)); +#else + val = *(u32*)(M.mem_base + addr); +#endif +DB( if (DEBUG_MEM_TRACE()) + printk("%#08x 4 -> %#x\n", addr, val);) + return val; +} + +/**************************************************************************** +PARAMETERS: +addr - Emulator memory address to read +val - Value to store + +REMARKS: +Writes a byte value to emulator memory. +****************************************************************************/ +void X86API wrb( + u32 addr, + u8 val) +{ +DB( if (DEBUG_MEM_TRACE()) + printk("%#08x 1 <- %#x\n", addr, val);) + if (addr > M.mem_size - 1) { + DB(printk("mem_write: address %#lx out of range!\n", addr);) + HALT_SYS(); + } + *(u8*)(M.mem_base + addr) = val; +} + +/**************************************************************************** +PARAMETERS: +addr - Emulator memory address to read +val - Value to store + +REMARKS: +Writes a word value to emulator memory. +****************************************************************************/ +void X86API wrw( + u32 addr, + u16 val) +{ +DB( if (DEBUG_MEM_TRACE()) + printk("%#08x 2 <- %#x\n", addr, val);) + if (addr > M.mem_size - 2) { + DB(printk("mem_write: address %#lx out of range!\n", addr);) + HALT_SYS(); + } +#ifdef __BIG_ENDIAN__ + if (addr & 0x1) { + *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff; + *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff; + } + else +#endif +#if defined(__alpha__) || defined(__alpha) + stw_u(val,(u16*)(M.mem_base + addr)); +#else + *(u16*)(M.mem_base + addr) = val; +#endif +} + +/**************************************************************************** +PARAMETERS: +addr - Emulator memory address to read +val - Value to store + +REMARKS: +Writes a long value to emulator memory. +****************************************************************************/ +void X86API wrl( + u32 addr, + u32 val) +{ +DB( if (DEBUG_MEM_TRACE()) + printk("%#08x 4 <- %#x\n", addr, val);) + if (addr > M.mem_size - 4) { + DB(printk("mem_write: address %#lx out of range!\n", addr);) + HALT_SYS(); + } +#ifdef __BIG_ENDIAN__ + if (addr & 0x1) { + *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff; + *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff; + *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff; + *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff; + } + else +#endif +#if defined(__alpha__) || defined(__alpha) + stl_u(val,(u32*)(M.mem_base + addr)); +#else + *(u32*)(M.mem_base + addr) = val; +#endif +} + +/**************************************************************************** +PARAMETERS: +addr - PIO address to read +RETURN: +0 +REMARKS: +Default PIO byte read function. Doesn't perform real inb. +****************************************************************************/ +static u8 X86API p_inb( + X86EMU_pioAddr addr) +{ +DB( if (DEBUG_IO_TRACE()) + printk("inb %#04x \n", addr);) + return 0; +} + +/**************************************************************************** +PARAMETERS: +addr - PIO address to read +RETURN: +0 +REMARKS: +Default PIO word read function. Doesn't perform real inw. +****************************************************************************/ +static u16 X86API p_inw( + X86EMU_pioAddr addr) +{ +DB( if (DEBUG_IO_TRACE()) + printk("inw %#04x \n", addr);) + return 0; +} + +/**************************************************************************** +PARAMETERS: +addr - PIO address to read +RETURN: +0 +REMARKS: +Default PIO long read function. Doesn't perform real inl. +****************************************************************************/ +static u32 X86API p_inl( + X86EMU_pioAddr addr) +{ +DB( if (DEBUG_IO_TRACE()) + printk("inl %#04x \n", addr);) + return 0; +} + +/**************************************************************************** +PARAMETERS: +addr - PIO address to write +val - Value to store +REMARKS: +Default PIO byte write function. Doesn't perform real outb. +****************************************************************************/ +static void X86API p_outb( + X86EMU_pioAddr addr, + u8 val) +{ +DB( if (DEBUG_IO_TRACE()) + printk("outb %#02x -> %#04x \n", val, addr);) + return; +} + +/**************************************************************************** +PARAMETERS: +addr - PIO address to write +val - Value to store +REMARKS: +Default PIO word write function. Doesn't perform real outw. +****************************************************************************/ +static void X86API p_outw( + X86EMU_pioAddr addr, + u16 val) +{ +DB( if (DEBUG_IO_TRACE()) + printk("outw %#04x -> %#04x \n", val, addr);) + return; +} + +/**************************************************************************** +PARAMETERS: +addr - PIO address to write +val - Value to store +REMARKS: +Default PIO ;ong write function. Doesn't perform real outl. +****************************************************************************/ +static void X86API p_outl( + X86EMU_pioAddr addr, + u32 val) +{ +DB( if (DEBUG_IO_TRACE()) + printk("outl %#08x -> %#04x \n", val, addr);) + return; +} + +/*------------------------- Global Variables ------------------------------*/ + +u8 (X86APIP sys_rdb)(u32 addr) = rdb; +u16 (X86APIP sys_rdw)(u32 addr) = rdw; +u32 (X86APIP sys_rdl)(u32 addr) = rdl; +void (X86APIP sys_wrb)(u32 addr,u8 val) = wrb; +void (X86APIP sys_wrw)(u32 addr,u16 val) = wrw; +void (X86APIP sys_wrl)(u32 addr,u32 val) = wrl; +u8 (X86APIP sys_inb)(X86EMU_pioAddr addr) = p_inb; +u16 (X86APIP sys_inw)(X86EMU_pioAddr addr) = p_inw; +u32 (X86APIP sys_inl)(X86EMU_pioAddr addr) = p_inl; +void (X86APIP sys_outb)(X86EMU_pioAddr addr, u8 val) = p_outb; +void (X86APIP sys_outw)(X86EMU_pioAddr addr, u16 val) = p_outw; +void (X86APIP sys_outl)(X86EMU_pioAddr addr, u32 val) = p_outl; + +/*----------------------------- Setup -------------------------------------*/ + +/**************************************************************************** +PARAMETERS: +funcs - New memory function pointers to make active + +REMARKS: +This function is used to set the pointers to functions which access +memory space, allowing the user application to override these functions +and hook them out as necessary for their application. +****************************************************************************/ +void X86EMU_setupMemFuncs( + X86EMU_memFuncs *funcs) +{ + sys_rdb = funcs->rdb; + sys_rdw = funcs->rdw; + sys_rdl = funcs->rdl; + sys_wrb = funcs->wrb; + sys_wrw = funcs->wrw; + sys_wrl = funcs->wrl; +} + +/**************************************************************************** +PARAMETERS: +funcs - New programmed I/O function pointers to make active + +REMARKS: +This function is used to set the pointers to functions which access +I/O space, allowing the user application to override these functions +and hook them out as necessary for their application. +****************************************************************************/ +void X86EMU_setupPioFuncs( + X86EMU_pioFuncs *funcs) +{ + sys_inb = funcs->inb; + sys_inw = funcs->inw; + sys_inl = funcs->inl; + sys_outb = funcs->outb; + sys_outw = funcs->outw; + sys_outl = funcs->outl; +} + +/**************************************************************************** +PARAMETERS: +funcs - New interrupt vector table to make active + +REMARKS: +This function is used to set the pointers to functions which handle +interrupt processing in the emulator, allowing the user application to +hook interrupts as necessary for their application. Any interrupts that +are not hooked by the user application, and reflected and handled internally +in the emulator via the interrupt vector table. This allows the application +to get control when the code being emulated executes specific software +interrupts. +****************************************************************************/ +void X86EMU_setupIntrFuncs( + X86EMU_intrFuncs funcs[]) +{ + int i; + + for (i=0; i < 256; i++) + _X86EMU_intrTab[i] = NULL; + if (funcs) { + for (i = 0; i < 256; i++) + _X86EMU_intrTab[i] = funcs[i]; + } +} + +/**************************************************************************** +PARAMETERS: +int - New software interrupt to prepare for + +REMARKS: +This function is used to set up the emulator state to exceute a software +interrupt. This can be used by the user application code to allow an +interrupt to be hooked, examined and then reflected back to the emulator +so that the code in the emulator will continue processing the software +interrupt as per normal. This essentially allows system code to actively +hook and handle certain software interrupts as necessary. +****************************************************************************/ +void X86EMU_prepareForInt( + int num) +{ + push_word((u16)M.x86.R_FLG); + CLEAR_FLAG(F_IF); + CLEAR_FLAG(F_TF); + push_word(M.x86.R_CS); + M.x86.R_CS = mem_access_word(num * 4 + 2); + push_word(M.x86.R_IP); + M.x86.R_IP = mem_access_word(num * 4); + M.x86.intr = 0; +} diff --git a/cfe/cfe/x86emu/validate.c b/cfe/cfe/x86emu/validate.c new file mode 100644 index 0000000..239f6c1 --- /dev/null +++ b/cfe/cfe/x86emu/validate.c @@ -0,0 +1,765 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: Watcom C 10.6 or later +* Environment: 32-bit DOS +* Developer: Kendall Bennett +* +* Description: Program to validate the x86 emulator library for +* correctness. We run the emulator primitive operations +* functions against the real x86 CPU, and compare the result +* and flags to ensure correctness. +* +* We use inline assembler to compile and build this program. +* +****************************************************************************/ + +#include +#include +#include +#include +#include "x86emu.h" +#include "x86emu/prim_asm.h" + +/*-------------------------- Implementation -------------------------------*/ + +#define true 1 +#define false 0 + +#define ALL_FLAGS (F_CF | F_PF | F_AF | F_ZF | F_SF | F_OF) + +#define VAL_START_BINARY(parm_type,res_type,dmax,smax,dincr,sincr) \ +{ \ + parm_type d,s; \ + res_type r,r_asm; \ + ulong flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < dmax; d += dincr) { \ + for (s = 0; s < smax; s += sincr) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { + +#define VAL_TEST_BINARY(name) \ + r_asm = name##_asm(&flags,d,s); \ + r = name(d,s); \ + if (r != r_asm || M.x86.R_EFLG != flags) \ + failed = true; \ + if (failed || trace) { + +#define VAL_TEST_BINARY_VOID(name) \ + name##_asm(&flags,d,s); \ + name(d,s); \ + r = r_asm = 0; \ + if (M.x86.R_EFLG != flags) \ + failed = true; \ + if (failed || trace) { + +#define VAL_FAIL_BYTE_BYTE_BINARY(name) \ + if (failed) \ + printk("fail\n"); \ + printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ + r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); + +#define VAL_FAIL_WORD_WORD_BINARY(name) \ + if (failed) \ + printk("fail\n"); \ + printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ + r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); + +#define VAL_FAIL_LONG_LONG_BINARY(name) \ + if (failed) \ + printk("fail\n"); \ + printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ + r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); + +#define VAL_END_BINARY() \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +#define VAL_BYTE_BYTE_BINARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u8,u8,0xFF,0xFF,1,1) \ + VAL_TEST_BINARY(name) \ + VAL_FAIL_BYTE_BYTE_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_WORD_WORD_BINARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u16,u16,0xFF00,0xFF00,0x100,0x100) \ + VAL_TEST_BINARY(name) \ + VAL_FAIL_WORD_WORD_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_LONG_LONG_BINARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000) \ + VAL_TEST_BINARY(name) \ + VAL_FAIL_LONG_LONG_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_VOID_BYTE_BINARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u8,u8,0xFF,0xFF,1,1) \ + VAL_TEST_BINARY_VOID(name) \ + VAL_FAIL_BYTE_BYTE_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_VOID_WORD_BINARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u16,u16,0xFF00,0xFF00,0x100,0x100) \ + VAL_TEST_BINARY_VOID(name) \ + VAL_FAIL_WORD_WORD_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_VOID_LONG_BINARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000) \ + VAL_TEST_BINARY_VOID(name) \ + VAL_FAIL_LONG_LONG_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_BYTE_ROTATE(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u8,u8,0xFF,8,1,1) \ + VAL_TEST_BINARY(name) \ + VAL_FAIL_BYTE_BYTE_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_WORD_ROTATE(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u16,u16,0xFF00,16,0x100,1) \ + VAL_TEST_BINARY(name) \ + VAL_FAIL_WORD_WORD_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_LONG_ROTATE(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_BINARY(u32,u32,0xFF000000,32,0x1000000,1) \ + VAL_TEST_BINARY(name) \ + VAL_FAIL_LONG_LONG_BINARY(name) \ + VAL_END_BINARY() + +#define VAL_START_TERNARY(parm_type,res_type,dmax,smax,dincr,sincr,maxshift)\ +{ \ + parm_type d,s; \ + res_type r,r_asm; \ + u8 shift; \ + u32 flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < dmax; d += dincr) { \ + for (s = 0; s < smax; s += sincr) { \ + for (shift = 0; shift < maxshift; shift += 1) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { + +#define VAL_TEST_TERNARY(name) \ + r_asm = name##_asm(&flags,d,s,shift); \ + r = name(d,s,shift); \ + if (r != r_asm || M.x86.R_EFLG != flags) \ + failed = true; \ + if (failed || trace) { + +#define VAL_FAIL_WORD_WORD_TERNARY(name) \ + if (failed) \ + printk("fail\n"); \ + printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \ + r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags)); + +#define VAL_FAIL_LONG_LONG_TERNARY(name) \ + if (failed) \ + printk("fail\n"); \ + printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \ + r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags)); + +#define VAL_END_TERNARY() \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +#define VAL_WORD_ROTATE_DBL(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_TERNARY(u16,u16,0xFF00,0xFF00,0x100,0x100,16) \ + VAL_TEST_TERNARY(name) \ + VAL_FAIL_WORD_WORD_TERNARY(name) \ + VAL_END_TERNARY() + +#define VAL_LONG_ROTATE_DBL(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_TERNARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000,32) \ + VAL_TEST_TERNARY(name) \ + VAL_FAIL_LONG_LONG_TERNARY(name) \ + VAL_END_TERNARY() + +#define VAL_START_UNARY(parm_type,max,incr) \ +{ \ + parm_type d,r,r_asm; \ + u32 flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < max; d += incr) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { + +#define VAL_TEST_UNARY(name) \ + r_asm = name##_asm(&flags,d); \ + r = name(d); \ + if (r != r_asm || M.x86.R_EFLG != flags) { \ + failed = true; + +#define VAL_FAIL_BYTE_UNARY(name) \ + printk("fail\n"); \ + printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \ + r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); + +#define VAL_FAIL_WORD_UNARY(name) \ + printk("fail\n"); \ + printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \ + r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); + +#define VAL_FAIL_LONG_UNARY(name) \ + printk("fail\n"); \ + printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \ + r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); + +#define VAL_END_UNARY() \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | ALL_FLAGS; \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +#define VAL_BYTE_UNARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_UNARY(u8,0xFF,0x1) \ + VAL_TEST_UNARY(name) \ + VAL_FAIL_BYTE_UNARY(name) \ + VAL_END_UNARY() + +#define VAL_WORD_UNARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_UNARY(u16,0xFF00,0x100) \ + VAL_TEST_UNARY(name) \ + VAL_FAIL_WORD_UNARY(name) \ + VAL_END_UNARY() + +#define VAL_WORD_BYTE_UNARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_UNARY(u16,0xFF,0x1) \ + VAL_TEST_UNARY(name) \ + VAL_FAIL_WORD_UNARY(name) \ + VAL_END_UNARY() + +#define VAL_LONG_UNARY(name) \ + printk("Validating %s ... ", #name); \ + VAL_START_UNARY(u32,0xFF000000,0x1000000) \ + VAL_TEST_UNARY(name) \ + VAL_FAIL_LONG_UNARY(name) \ + VAL_END_UNARY() + +#define VAL_BYTE_MUL(name) \ + printk("Validating %s ... ", #name); \ +{ \ + u8 d,s; \ + u16 r,r_asm; \ + u32 flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < 0xFF; d += 1) { \ + for (s = 0; s < 0xFF; s += 1) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { \ + name##_asm(&flags,&r_asm,d,s); \ + M.x86.R_AL = d; \ + name(s); \ + r = M.x86.R_AX; \ + if (r != r_asm || M.x86.R_EFLG != flags) \ + failed = true; \ + if (failed || trace) { \ + if (failed) \ + printk("fail\n"); \ + printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ + r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ + r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +#define VAL_WORD_MUL(name) \ + printk("Validating %s ... ", #name); \ +{ \ + u16 d,s; \ + u16 r_lo,r_asm_lo; \ + u16 r_hi,r_asm_hi; \ + u32 flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < 0xFF00; d += 0x100) { \ + for (s = 0; s < 0xFF00; s += 0x100) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { \ + name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \ + M.x86.R_AX = d; \ + name(s); \ + r_lo = M.x86.R_AX; \ + r_hi = M.x86.R_DX; \ + if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\ + failed = true; \ + if (failed || trace) { \ + if (failed) \ + printk("fail\n"); \ + printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ + r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ + r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +#define VAL_LONG_MUL(name) \ + printk("Validating %s ... ", #name); \ +{ \ + u32 d,s; \ + u32 r_lo,r_asm_lo; \ + u32 r_hi,r_asm_hi; \ + u32 flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < 0xFF000000; d += 0x1000000) { \ + for (s = 0; s < 0xFF000000; s += 0x1000000) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { \ + name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \ + M.x86.R_EAX = d; \ + name(s); \ + r_lo = M.x86.R_EAX; \ + r_hi = M.x86.R_EDX; \ + if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\ + failed = true; \ + if (failed || trace) { \ + if (failed) \ + printk("fail\n"); \ + printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ + r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ + r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +#define VAL_BYTE_DIV(name) \ + printk("Validating %s ... ", #name); \ +{ \ + u16 d,s; \ + u8 r_quot,r_rem,r_asm_quot,r_asm_rem; \ + u32 flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < 0xFF00; d += 0x100) { \ + for (s = 1; s < 0xFF; s += 1) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { \ + M.x86.intr = 0; \ + M.x86.R_AX = d; \ + name(s); \ + r_quot = M.x86.R_AL; \ + r_rem = M.x86.R_AH; \ + if (M.x86.intr & INTR_SYNCH) \ + continue; \ + name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,s); \ + if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ + failed = true; \ + if (failed || trace) { \ + if (failed) \ + printk("fail\n"); \ + printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \ + r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \ + r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +#define VAL_WORD_DIV(name) \ + printk("Validating %s ... ", #name); \ +{ \ + u32 d,s; \ + u16 r_quot,r_rem,r_asm_quot,r_asm_rem; \ + u32 flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < 0xFF000000; d += 0x1000000) { \ + for (s = 0x100; s < 0xFF00; s += 0x100) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { \ + M.x86.intr = 0; \ + M.x86.R_AX = d & 0xFFFF; \ + M.x86.R_DX = d >> 16; \ + name(s); \ + r_quot = M.x86.R_AX; \ + r_rem = M.x86.R_DX; \ + if (M.x86.intr & INTR_SYNCH) \ + continue; \ + name##_asm(&flags,&r_asm_quot,&r_asm_rem,d & 0xFFFF,d >> 16,s);\ + if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ + failed = true; \ + if (failed || trace) { \ + if (failed) \ + printk("fail\n"); \ + printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \ + r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \ + r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +#define VAL_LONG_DIV(name) \ + printk("Validating %s ... ", #name); \ +{ \ + u32 d,s; \ + u32 r_quot,r_rem,r_asm_quot,r_asm_rem; \ + u32 flags,inflags; \ + int f,failed = false; \ + char buf1[80],buf2[80]; \ + for (d = 0; d < 0xFF000000; d += 0x1000000) { \ + for (s = 0x100; s < 0xFF00; s += 0x100) { \ + M.x86.R_EFLG = inflags = flags = def_flags; \ + for (f = 0; f < 2; f++) { \ + M.x86.intr = 0; \ + M.x86.R_EAX = d; \ + M.x86.R_EDX = 0; \ + name(s); \ + r_quot = M.x86.R_EAX; \ + r_rem = M.x86.R_EDX; \ + if (M.x86.intr & INTR_SYNCH) \ + continue; \ + name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,0,s); \ + if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ + failed = true; \ + if (failed || trace) { \ + if (failed) \ + printk("fail\n"); \ + printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \ + r_quot, r_rem, #name, 0, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ + printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \ + r_asm_quot, r_asm_rem, #name"_asm", 0, d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ + } \ + M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (failed) \ + break; \ + } \ + if (!failed) \ + printk("passed\n"); \ +} + +void printk(const char *fmt, ...) +{ + va_list argptr; + va_start(argptr, fmt); + vfprintf(stdout, fmt, argptr); + fflush(stdout); + va_end(argptr); +} + +char * print_flags(char *buf,ulong flags) +{ + char *separator = ""; + + buf[0] = 0; + if (flags & F_CF) { + strcat(buf,separator); + strcat(buf,"CF"); + separator = ","; + } + if (flags & F_PF) { + strcat(buf,separator); + strcat(buf,"PF"); + separator = ","; + } + if (flags & F_AF) { + strcat(buf,separator); + strcat(buf,"AF"); + separator = ","; + } + if (flags & F_ZF) { + strcat(buf,separator); + strcat(buf,"ZF"); + separator = ","; + } + if (flags & F_SF) { + strcat(buf,separator); + strcat(buf,"SF"); + separator = ","; + } + if (flags & F_OF) { + strcat(buf,separator); + strcat(buf,"OF"); + separator = ","; + } + if (separator[0] == 0) + strcpy(buf,"None"); + return buf; +} + +int main(int argc) +{ + ulong def_flags; + int trace = false; + + if (argc > 1) + trace = true; + memset(&M, 0, sizeof(M)); + def_flags = get_flags_asm() & ~ALL_FLAGS; + + VAL_WORD_UNARY(aaa_word); + VAL_WORD_UNARY(aas_word); + + VAL_WORD_UNARY(aad_word); + VAL_WORD_UNARY(aam_word); + + VAL_BYTE_BYTE_BINARY(adc_byte); + VAL_WORD_WORD_BINARY(adc_word); + VAL_LONG_LONG_BINARY(adc_long); + + VAL_BYTE_BYTE_BINARY(add_byte); + VAL_WORD_WORD_BINARY(add_word); + VAL_LONG_LONG_BINARY(add_long); + + VAL_BYTE_BYTE_BINARY(and_byte); + VAL_WORD_WORD_BINARY(and_word); + VAL_LONG_LONG_BINARY(and_long); + + VAL_BYTE_BYTE_BINARY(cmp_byte); + VAL_WORD_WORD_BINARY(cmp_word); + VAL_LONG_LONG_BINARY(cmp_long); + + VAL_BYTE_UNARY(daa_byte); + VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway) + + VAL_BYTE_UNARY(dec_byte); + VAL_WORD_UNARY(dec_word); + VAL_LONG_UNARY(dec_long); + + VAL_BYTE_UNARY(inc_byte); + VAL_WORD_UNARY(inc_word); + VAL_LONG_UNARY(inc_long); + + VAL_BYTE_BYTE_BINARY(or_byte); + VAL_WORD_WORD_BINARY(or_word); + VAL_LONG_LONG_BINARY(or_long); + + VAL_BYTE_UNARY(neg_byte); + VAL_WORD_UNARY(neg_word); + VAL_LONG_UNARY(neg_long); + + VAL_BYTE_UNARY(not_byte); + VAL_WORD_UNARY(not_word); + VAL_LONG_UNARY(not_long); + + VAL_BYTE_ROTATE(rcl_byte); + VAL_WORD_ROTATE(rcl_word); + VAL_LONG_ROTATE(rcl_long); + + VAL_BYTE_ROTATE(rcr_byte); + VAL_WORD_ROTATE(rcr_word); + VAL_LONG_ROTATE(rcr_long); + + VAL_BYTE_ROTATE(rol_byte); + VAL_WORD_ROTATE(rol_word); + VAL_LONG_ROTATE(rol_long); + + VAL_BYTE_ROTATE(ror_byte); + VAL_WORD_ROTATE(ror_word); + VAL_LONG_ROTATE(ror_long); + + VAL_BYTE_ROTATE(shl_byte); + VAL_WORD_ROTATE(shl_word); + VAL_LONG_ROTATE(shl_long); + + VAL_BYTE_ROTATE(shr_byte); + VAL_WORD_ROTATE(shr_word); + VAL_LONG_ROTATE(shr_long); + + VAL_BYTE_ROTATE(sar_byte); + VAL_WORD_ROTATE(sar_word); + VAL_LONG_ROTATE(sar_long); + + VAL_WORD_ROTATE_DBL(shld_word); + VAL_LONG_ROTATE_DBL(shld_long); + + VAL_WORD_ROTATE_DBL(shrd_word); + VAL_LONG_ROTATE_DBL(shrd_long); + + VAL_BYTE_BYTE_BINARY(sbb_byte); + VAL_WORD_WORD_BINARY(sbb_word); + VAL_LONG_LONG_BINARY(sbb_long); + + VAL_BYTE_BYTE_BINARY(sub_byte); + VAL_WORD_WORD_BINARY(sub_word); + VAL_LONG_LONG_BINARY(sub_long); + + VAL_BYTE_BYTE_BINARY(xor_byte); + VAL_WORD_WORD_BINARY(xor_word); + VAL_LONG_LONG_BINARY(xor_long); + + VAL_VOID_BYTE_BINARY(test_byte); + VAL_VOID_WORD_BINARY(test_word); + VAL_VOID_LONG_BINARY(test_long); + + VAL_BYTE_MUL(imul_byte); + VAL_WORD_MUL(imul_word); + VAL_LONG_MUL(imul_long); + + VAL_BYTE_MUL(mul_byte); + VAL_WORD_MUL(mul_word); + VAL_LONG_MUL(mul_long); + + VAL_BYTE_DIV(idiv_byte); + VAL_WORD_DIV(idiv_word); + VAL_LONG_DIV(idiv_long); + + VAL_BYTE_DIV(div_byte); + VAL_WORD_DIV(div_word); + VAL_LONG_DIV(div_long); + + return 0; +} diff --git a/cfe/cfe/x86emu/x86emu.h b/cfe/cfe/x86emu/x86emu.h new file mode 100644 index 0000000..7c7d367 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu.h @@ -0,0 +1,198 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for public specific functions. +* Any application linking against us should only +* include this header +* +****************************************************************************/ +/* $XFree86: xc/extras/x86emu/include/x86emu.h,v 1.2 2000/11/21 23:10:25 tsi Exp $ */ + +#ifndef __X86EMU_X86EMU_H +#define __X86EMU_X86EMU_H + +#ifdef SCITECH +#include "scitech.h" +#define X86API _ASMAPI +#define X86APIP _ASMAPIP +typedef int X86EMU_pioAddr; +#else +#include "x86emu/types.h" +#define X86API +#define X86APIP * +#endif +#include "x86emu/regs.h" + +/*---------------------- Macros and type definitions ----------------------*/ + +#ifndef __mips +#pragma pack(1) +#endif + +/**************************************************************************** +REMARKS: +Data structure containing ponters to programmed I/O functions used by the +emulator. This is used so that the user program can hook all programmed +I/O for the emulator to handled as necessary by the user program. By +default the emulator contains simple functions that do not do access the +hardware in any way. To allow the emualtor access the hardware, you will +need to override the programmed I/O functions using the X86EMU_setupPioFuncs +function. + +HEADER: +x86emu.h + +MEMBERS: +inb - Function to read a byte from an I/O port +inw - Function to read a word from an I/O port +inl - Function to read a dword from an I/O port +outb - Function to write a byte to an I/O port +outw - Function to write a word to an I/O port +outl - Function to write a dword to an I/O port +****************************************************************************/ +typedef struct { + u8 (X86APIP inb)(X86EMU_pioAddr addr); + u16 (X86APIP inw)(X86EMU_pioAddr addr); + u32 (X86APIP inl)(X86EMU_pioAddr addr); + void (X86APIP outb)(X86EMU_pioAddr addr, u8 val); + void (X86APIP outw)(X86EMU_pioAddr addr, u16 val); + void (X86APIP outl)(X86EMU_pioAddr addr, u32 val); + } X86EMU_pioFuncs; + +/**************************************************************************** +REMARKS: +Data structure containing ponters to memory access functions used by the +emulator. This is used so that the user program can hook all memory +access functions as necessary for the emulator. By default the emulator +contains simple functions that only access the internal memory of the +emulator. If you need specialised functions to handle access to different +types of memory (ie: hardware framebuffer accesses and BIOS memory access +etc), you will need to override this using the X86EMU_setupMemFuncs +function. + +HEADER: +x86emu.h + +MEMBERS: +rdb - Function to read a byte from an address +rdw - Function to read a word from an address +rdl - Function to read a dword from an address +wrb - Function to write a byte to an address +wrw - Function to write a word to an address +wrl - Function to write a dword to an address +****************************************************************************/ +typedef struct { + u8 (X86APIP rdb)(u32 addr); + u16 (X86APIP rdw)(u32 addr); + u32 (X86APIP rdl)(u32 addr); + void (X86APIP wrb)(u32 addr, u8 val); + void (X86APIP wrw)(u32 addr, u16 val); + void (X86APIP wrl)(u32 addr, u32 val); + } X86EMU_memFuncs; + +/**************************************************************************** + Here are the default memory read and write + function in case they are needed as fallbacks. +***************************************************************************/ +extern u8 X86API rdb(u32 addr); +extern u16 X86API rdw(u32 addr); +extern u32 X86API rdl(u32 addr); +extern void X86API wrb(u32 addr, u8 val); +extern void X86API wrw(u32 addr, u16 val); +extern void X86API wrl(u32 addr, u32 val); + +#ifndef __mips +#pragma pack() +#endif + +/*--------------------- type definitions -----------------------------------*/ + +typedef void (X86APIP X86EMU_intrFuncs)(int num); +extern X86EMU_intrFuncs _X86EMU_intrTab[256]; + +/*-------------------------- Function Prototypes --------------------------*/ + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +void X86EMU_setupMemFuncs(X86EMU_memFuncs *funcs); +void X86EMU_setupPioFuncs(X86EMU_pioFuncs *funcs); +void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]); +void X86EMU_prepareForInt(int num); + +/* decode.c */ + +void X86EMU_exec(void); +void X86EMU_halt_sys(void); + +#ifdef DEBUG +#define HALT_SYS() \ + printk("halt_sys: file %s, line %d\n", __FILE__, __LINE__), \ + X86EMU_halt_sys() +#else +#define HALT_SYS() X86EMU_halt_sys() +#endif + +/* Debug options */ + +#define DEBUG_DECODE_F 0x000001 /* print decoded instruction */ +#define DEBUG_TRACE_F 0x000002 /* dump regs before/after execution */ +#define DEBUG_STEP_F 0x000004 +#define DEBUG_DISASSEMBLE_F 0x000008 +#define DEBUG_BREAK_F 0x000010 +#define DEBUG_SVC_F 0x000020 +#define DEBUG_FS_F 0x000080 +#define DEBUG_PROC_F 0x000100 +#define DEBUG_SYSINT_F 0x000200 /* bios system interrupts. */ +#define DEBUG_TRACECALL_F 0x000400 +#define DEBUG_INSTRUMENT_F 0x000800 +#define DEBUG_MEM_TRACE_F 0x001000 +#define DEBUG_IO_TRACE_F 0x002000 +#define DEBUG_TRACECALL_REGS_F 0x004000 +#define DEBUG_DECODE_NOPRINT_F 0x008000 +#define DEBUG_SAVE_IP_CS_F 0x010000 +#define DEBUG_SYS_F (DEBUG_SVC_F|DEBUG_FS_F|DEBUG_PROC_F) + +void X86EMU_trace_regs(void); +void X86EMU_trace_xregs(void); +void X86EMU_dump_memory(u16 seg, u16 off, u32 amt); +int X86EMU_trace_on(void); +int X86EMU_trace_off(void); + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif + +#endif /* __X86EMU_X86EMU_H */ diff --git a/cfe/cfe/x86emu/x86emu/debug.h b/cfe/cfe/x86emu/x86emu/debug.h new file mode 100644 index 0000000..45271c9 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/debug.h @@ -0,0 +1,212 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for debug definitions. +* +****************************************************************************/ +/* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/debug.h,v 1.4 2000/11/21 23:10:27 tsi Exp $ */ + +#ifndef __X86EMU_DEBUG_H +#define __X86EMU_DEBUG_H + +/*---------------------- Macros and type definitions ----------------------*/ + +/* checks to be enabled for "runtime" */ + +#define CHECK_IP_FETCH_F 0x1 +#define CHECK_SP_ACCESS_F 0x2 +#define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */ +#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset*/ + +#ifdef DEBUG +# define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F) +# define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F) +# define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F) +# define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F) +#else +# define CHECK_IP_FETCH() +# define CHECK_SP_ACCESS() +# define CHECK_MEM_ACCESS() +# define CHECK_DATA_ACCESS() +#endif + +#ifdef DEBUG +# define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F) +# define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F) +# define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F) +# define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F) +# define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F) +# define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F) +# define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F) +# define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F) + +# define DEBUG_FS() (M.x86.debug & DEBUG_FS_F) +# define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F) +# define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F) +# define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F) +# define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F) +# define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F) +# define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F) +# define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F) +# define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F) +#else +# define DEBUG_INSTRUMENT() 0 +# define DEBUG_DECODE() 0 +# define DEBUG_TRACE() 0 +# define DEBUG_STEP() 0 +# define DEBUG_DISASSEMBLE() 0 +# define DEBUG_BREAK() 0 +# define DEBUG_SVC() 0 +# define DEBUG_SAVE_IP_CS() 0 +# define DEBUG_FS() 0 +# define DEBUG_PROC() 0 +# define DEBUG_SYSINT() 0 +# define DEBUG_TRACECALL() 0 +# define DEBUG_TRACECALLREGS() 0 +# define DEBUG_SYS() 0 +# define DEBUG_MEM_TRACE() 0 +# define DEBUG_IO_TRACE() 0 +# define DEBUG_DECODE_NOPRINT() 0 +#endif + +#ifdef DEBUG + +# define DECODE_PRINTF(x) if (DEBUG_DECODE()) \ + x86emu_decode_printf(x) +# define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \ + x86emu_decode_printf2(x,y) + +/* + * The following allow us to look at the bytes of an instruction. The + * first INCR_INSTRN_LEN, is called everytime bytes are consumed in + * the decoding process. The SAVE_IP_CS is called initially when the + * major opcode of the instruction is accessed. + */ +#define INC_DECODED_INST_LEN(x) \ + if (DEBUG_DECODE()) \ + x86emu_inc_decoded_inst_len(x) + +#define SAVE_IP_CS(x,y) \ + if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \ + | DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \ + M.x86.saved_cs = x; \ + M.x86.saved_ip = y; \ + } +#else +# define INC_DECODED_INST_LEN(x) +# define DECODE_PRINTF(x) +# define DECODE_PRINTF2(x,y) +# define SAVE_IP_CS(x,y) +#endif + +#ifdef DEBUG +#define TRACE_REGS() \ + if (DEBUG_DISASSEMBLE()) { \ + x86emu_just_disassemble(); \ + goto EndOfTheInstructionProcedure; \ + } \ + if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs() +#else +# define TRACE_REGS() +#endif + +#ifdef DEBUG +# define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step() +#else +# define SINGLE_STEP() +#endif + +#define TRACE_AND_STEP() \ + TRACE_REGS(); \ + SINGLE_STEP() + +#ifdef DEBUG +# define START_OF_INSTR() +# define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr(); +# define END_OF_INSTR_NO_TRACE() x86emu_end_instr(); +#else +# define START_OF_INSTR() +# define END_OF_INSTR() +# define END_OF_INSTR_NO_TRACE() +#endif + +#ifdef DEBUG +# define CALL_TRACE(u,v,w,x,s) \ + if (DEBUG_TRACECALLREGS()) \ + x86emu_dump_regs(); \ + if (DEBUG_TRACECALL()) \ + printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x); +# define RETURN_TRACE(n,u,v) \ + if (DEBUG_TRACECALLREGS()) \ + x86emu_dump_regs(); \ + if (DEBUG_TRACECALL()) \ + printk("%04x:%04x: %s\n",u,v,n); +#else +# define CALL_TRACE(u,v,w,x,s) +# define RETURN_TRACE(n,u,v) +#endif + +#ifdef DEBUG +#define DB(x) x +#else +#define DB(x) +#endif + +/*-------------------------- Function Prototypes --------------------------*/ + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +extern void x86emu_inc_decoded_inst_len (int x); +extern void x86emu_decode_printf (char *x); +extern void x86emu_decode_printf2 (char *x, int y); +extern void x86emu_just_disassemble (void); +extern void x86emu_single_step (void); +extern void x86emu_end_instr (void); +extern void x86emu_dump_regs (void); +extern void x86emu_dump_xregs (void); +extern void x86emu_print_int_vect (u16 iv); +extern void x86emu_instrument_instruction (void); +extern void x86emu_check_ip_access (void); +extern void x86emu_check_sp_access (void); +extern void x86emu_check_mem_access (u32 p); +extern void x86emu_check_data_access (uint s, uint o); + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif + + +#endif /* __X86EMU_DEBUG_H */ diff --git a/cfe/cfe/x86emu/x86emu/decode.h b/cfe/cfe/x86emu/x86emu/decode.h new file mode 100644 index 0000000..321a345 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/decode.h @@ -0,0 +1,87 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for instruction decoding logic. +* +****************************************************************************/ + +#ifndef __X86EMU_DECODE_H +#define __X86EMU_DECODE_H + +/*---------------------- Macros and type definitions ----------------------*/ + +/* Instruction Decoding Stuff */ + +#define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl) +#define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r) +#define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r) +#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r) +#define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK + +/*-------------------------- Function Prototypes --------------------------*/ + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +void x86emu_intr_raise (u8 type); +void fetch_decode_modrm (int *mod,int *regh,int *regl); +u8 fetch_byte_imm (void); +u16 fetch_word_imm (void); +u32 fetch_long_imm (void); +u8 fetch_data_byte (uint offset); +u8 fetch_data_byte_abs (uint segment, uint offset); +u16 fetch_data_word (uint offset); +u16 fetch_data_word_abs (uint segment, uint offset); +u32 fetch_data_long (uint offset); +u32 fetch_data_long_abs (uint segment, uint offset); +void store_data_byte (uint offset, u8 val); +void store_data_byte_abs (uint segment, uint offset, u8 val); +void store_data_word (uint offset, u16 val); +void store_data_word_abs (uint segment, uint offset, u16 val); +void store_data_long (uint offset, u32 val); +void store_data_long_abs (uint segment, uint offset, u32 val); +u8* decode_rm_byte_register(int reg); +u16* decode_rm_word_register(int reg); +u32* decode_rm_long_register(int reg); +u16* decode_rm_seg_register(int reg); +unsigned decode_rm00_address(int rm); +unsigned decode_rm01_address(int rm); +unsigned decode_rm10_address(int rm); + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif + +#endif /* __X86EMU_DECODE_H */ diff --git a/cfe/cfe/x86emu/x86emu/fpu.h b/cfe/cfe/x86emu/x86emu/fpu.h new file mode 100644 index 0000000..5fb2714 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/fpu.h @@ -0,0 +1,61 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for FPU instruction decoding. +* +****************************************************************************/ + +#ifndef __X86EMU_FPU_H +#define __X86EMU_FPU_H + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +/* these have to be defined, whether 8087 support compiled in or not. */ + +extern void x86emuOp_esc_coprocess_d8 (u8 op1); +extern void x86emuOp_esc_coprocess_d9 (u8 op1); +extern void x86emuOp_esc_coprocess_da (u8 op1); +extern void x86emuOp_esc_coprocess_db (u8 op1); +extern void x86emuOp_esc_coprocess_dc (u8 op1); +extern void x86emuOp_esc_coprocess_dd (u8 op1); +extern void x86emuOp_esc_coprocess_de (u8 op1); +extern void x86emuOp_esc_coprocess_df (u8 op1); + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif + +#endif /* __X86EMU_FPU_H */ diff --git a/cfe/cfe/x86emu/x86emu/fpu_regs.h b/cfe/cfe/x86emu/x86emu/fpu_regs.h new file mode 100644 index 0000000..56e9a04 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/fpu_regs.h @@ -0,0 +1,115 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for FPU register definitions. +* +****************************************************************************/ + +#ifndef __X86EMU_FPU_REGS_H +#define __X86EMU_FPU_REGS_H + +#ifdef X86_FPU_SUPPORT + +#pragma pack(1) + +/* Basic 8087 register can hold any of the following values: */ + +union x86_fpu_reg_u { + s8 tenbytes[10]; + double dval; + float fval; + s16 sval; + s32 lval; + }; + +struct x86_fpu_reg { + union x86_fpu_reg_u reg; + char tag; + }; + +/* + * Since we are not going to worry about the problems of aliasing + * registers, every time a register is modified, its result type is + * set in the tag fields for that register. If some operation + * attempts to access the type in a way inconsistent with its current + * storage format, then we flag the operation. If common, we'll + * attempt the conversion. + */ + +#define X86_FPU_VALID 0x80 +#define X86_FPU_REGTYP(r) ((r) & 0x7F) + +#define X86_FPU_WORD 0x0 +#define X86_FPU_SHORT 0x1 +#define X86_FPU_LONG 0x2 +#define X86_FPU_FLOAT 0x3 +#define X86_FPU_DOUBLE 0x4 +#define X86_FPU_LDBL 0x5 +#define X86_FPU_BSD 0x6 + +#define X86_FPU_STKTOP 0 + +struct x86_fpu_registers { + struct x86_fpu_reg x86_fpu_stack[8]; + int x86_fpu_flags; + int x86_fpu_config; /* rounding modes, etc. */ + short x86_fpu_tos, x86_fpu_bos; + }; + +#pragma pack() + +/* + * There are two versions of the following macro. + * + * One version is for opcode D9, for which there are more than 32 + * instructions encoded in the second byte of the opcode. + * + * The other version, deals with all the other 7 i87 opcodes, for + * which there are only 32 strings needed to describe the + * instructions. + */ + +#endif /* X86_FPU_SUPPORT */ + +#ifdef DEBUG +# define DECODE_PRINTINSTR32(t,mod,rh,rl) \ + DECODE_PRINTF(t[(mod<<3)+(rh)]); +# define DECODE_PRINTINSTR256(t,mod,rh,rl) \ + DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]); +#else +# define DECODE_PRINTINSTR32(t,mod,rh,rl) +# define DECODE_PRINTINSTR256(t,mod,rh,rl) +#endif + +#endif /* __X86EMU_FPU_REGS_H */ diff --git a/cfe/cfe/x86emu/x86emu/ops.h b/cfe/cfe/x86emu/x86emu/ops.h new file mode 100644 index 0000000..65ea676 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/ops.h @@ -0,0 +1,45 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for operand decoding functions. +* +****************************************************************************/ + +#ifndef __X86EMU_OPS_H +#define __X86EMU_OPS_H + +extern void (*x86emu_optab[0x100])(u8 op1); +extern void (*x86emu_optab2[0x100])(u8 op2); + +#endif /* __X86EMU_OPS_H */ diff --git a/cfe/cfe/x86emu/x86emu/ops_protos.h b/cfe/cfe/x86emu/x86emu/ops_protos.h new file mode 100644 index 0000000..8787c5a --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/ops_protos.h @@ -0,0 +1,277 @@ + +#define OPPROTO(x) void x(u8) + +OPPROTO(x86emuOp_illegal_op); +OPPROTO(x86emuOp_add_byte_RM_R); +OPPROTO(x86emuOp_add_word_RM_R); +OPPROTO(x86emuOp_add_byte_R_RM); +OPPROTO(x86emuOp_add_word_R_RM); +OPPROTO(x86emuOp_add_byte_AL_IMM); +OPPROTO(x86emuOp_add_word_AX_IMM); +OPPROTO(x86emuOp_push_ES); +OPPROTO(x86emuOp_pop_ES); +OPPROTO(x86emuOp_or_byte_RM_R); +OPPROTO(x86emuOp_or_word_RM_R); +OPPROTO(x86emuOp_or_byte_R_RM); +OPPROTO(x86emuOp_or_word_R_RM); +OPPROTO(x86emuOp_or_byte_AL_IMM); +OPPROTO(x86emuOp_or_word_AX_IMM); +OPPROTO(x86emuOp_push_CS); +OPPROTO(x86emuOp_two_byte); +OPPROTO(x86emuOp_adc_byte_RM_R); +OPPROTO(x86emuOp_adc_word_RM_R); +OPPROTO(x86emuOp_adc_byte_R_RM); +OPPROTO(x86emuOp_adc_word_R_RM); +OPPROTO(x86emuOp_adc_byte_AL_IMM); +OPPROTO(x86emuOp_adc_word_AX_IMM); +OPPROTO(x86emuOp_push_SS); +OPPROTO(x86emuOp_pop_SS); +OPPROTO(x86emuOp_sbb_byte_RM_R); +OPPROTO(x86emuOp_sbb_word_RM_R); +OPPROTO(x86emuOp_sbb_byte_R_RM); +OPPROTO(x86emuOp_sbb_word_R_RM); +OPPROTO(x86emuOp_sbb_byte_AL_IMM); +OPPROTO(x86emuOp_sbb_word_AX_IMM); +OPPROTO(x86emuOp_push_DS); +OPPROTO(x86emuOp_pop_DS); +OPPROTO(x86emuOp_and_byte_RM_R); +OPPROTO(x86emuOp_and_word_RM_R); +OPPROTO(x86emuOp_and_byte_R_RM); +OPPROTO(x86emuOp_and_word_R_RM); +OPPROTO(x86emuOp_and_byte_AL_IMM); +OPPROTO(x86emuOp_and_word_AX_IMM); +OPPROTO(x86emuOp_segovr_ES); +OPPROTO(x86emuOp_daa); +OPPROTO(x86emuOp_sub_byte_RM_R); +OPPROTO(x86emuOp_sub_word_RM_R); +OPPROTO(x86emuOp_sub_byte_R_RM); +OPPROTO(x86emuOp_sub_word_R_RM); +OPPROTO(x86emuOp_sub_byte_AL_IMM); +OPPROTO(x86emuOp_sub_word_AX_IMM); +OPPROTO(x86emuOp_segovr_CS); +OPPROTO(x86emuOp_das); +OPPROTO(x86emuOp_xor_byte_RM_R); +OPPROTO(x86emuOp_xor_word_RM_R); +OPPROTO(x86emuOp_xor_byte_R_RM); +OPPROTO(x86emuOp_xor_word_R_RM); +OPPROTO(x86emuOp_xor_byte_AL_IMM); +OPPROTO(x86emuOp_xor_word_AX_IMM); +OPPROTO(x86emuOp_segovr_SS); +OPPROTO(x86emuOp_aaa); +OPPROTO(x86emuOp_cmp_byte_RM_R); +OPPROTO(x86emuOp_cmp_word_RM_R); +OPPROTO(x86emuOp_cmp_byte_R_RM); +OPPROTO(x86emuOp_cmp_word_R_RM); +OPPROTO(x86emuOp_cmp_byte_AL_IMM); +OPPROTO(x86emuOp_cmp_word_AX_IMM); +OPPROTO(x86emuOp_segovr_DS); +OPPROTO(x86emuOp_aas); +OPPROTO(x86emuOp_inc_AX); +OPPROTO(x86emuOp_inc_CX); +OPPROTO(x86emuOp_inc_DX); +OPPROTO(x86emuOp_inc_BX); +OPPROTO(x86emuOp_inc_SP); +OPPROTO(x86emuOp_inc_BP); +OPPROTO(x86emuOp_inc_SI); +OPPROTO(x86emuOp_inc_DI); +OPPROTO(x86emuOp_dec_AX); +OPPROTO(x86emuOp_dec_CX); +OPPROTO(x86emuOp_dec_DX); +OPPROTO(x86emuOp_dec_BX); +OPPROTO(x86emuOp_dec_SP); +OPPROTO(x86emuOp_dec_BP); +OPPROTO(x86emuOp_dec_SI); +OPPROTO(x86emuOp_dec_DI); +OPPROTO(x86emuOp_push_AX); +OPPROTO(x86emuOp_push_CX); +OPPROTO(x86emuOp_push_DX); +OPPROTO(x86emuOp_push_BX); +OPPROTO(x86emuOp_push_SP); +OPPROTO(x86emuOp_push_BP); +OPPROTO(x86emuOp_push_SI); +OPPROTO(x86emuOp_push_DI); +OPPROTO(x86emuOp_pop_AX); +OPPROTO(x86emuOp_pop_CX); +OPPROTO(x86emuOp_pop_DX); +OPPROTO(x86emuOp_pop_BX); +OPPROTO(x86emuOp_pop_SP); +OPPROTO(x86emuOp_pop_BP); +OPPROTO(x86emuOp_pop_SI); +OPPROTO(x86emuOp_pop_DI); +OPPROTO(x86emuOp_push_all); +OPPROTO(x86emuOp_pop_all); +OPPROTO(x86emuOp_segovr_FS); +OPPROTO(x86emuOp_segovr_GS); +OPPROTO(x86emuOp_prefix_data); +OPPROTO(x86emuOp_prefix_addr); +OPPROTO(x86emuOp_push_word_IMM); +OPPROTO(x86emuOp_imul_word_IMM); +OPPROTO(x86emuOp_push_byte_IMM); +OPPROTO(x86emuOp_imul_byte_IMM); +OPPROTO(x86emuOp_ins_byte); +OPPROTO(x86emuOp_ins_word); +OPPROTO(x86emuOp_outs_byte); +OPPROTO(x86emuOp_outs_word); +OPPROTO(x86emuOp_jump_near_O); +OPPROTO(x86emuOp_jump_near_NO); +OPPROTO(x86emuOp_jump_near_B); +OPPROTO(x86emuOp_jump_near_NB); +OPPROTO(x86emuOp_jump_near_Z); +OPPROTO(x86emuOp_jump_near_NZ); +OPPROTO(x86emuOp_jump_near_BE); +OPPROTO(x86emuOp_jump_near_NBE); +OPPROTO(x86emuOp_jump_near_S); +OPPROTO(x86emuOp_jump_near_NS); +OPPROTO(x86emuOp_jump_near_P); +OPPROTO(x86emuOp_jump_near_NP); +OPPROTO(x86emuOp_jump_near_L); +OPPROTO(x86emuOp_jump_near_NL); +OPPROTO(x86emuOp_jump_near_LE); +OPPROTO(x86emuOp_jump_near_NLE); +OPPROTO(x86emuOp_opc80_byte_RM_IMM); +OPPROTO(x86emuOp_opc81_word_RM_IMM); +OPPROTO(x86emuOp_opc82_byte_RM_IMM); +OPPROTO(x86emuOp_opc83_word_RM_IMM); +OPPROTO(x86emuOp_test_byte_RM_R); +OPPROTO(x86emuOp_test_word_RM_R); +OPPROTO(x86emuOp_xchg_byte_RM_R); +OPPROTO(x86emuOp_xchg_word_RM_R); +OPPROTO(x86emuOp_mov_byte_RM_R); +OPPROTO(x86emuOp_mov_word_RM_R); +OPPROTO(x86emuOp_mov_byte_R_RM); +OPPROTO(x86emuOp_mov_word_R_RM); +OPPROTO(x86emuOp_mov_word_RM_SR); +OPPROTO(x86emuOp_lea_word_R_M); +OPPROTO(x86emuOp_mov_word_SR_RM); +OPPROTO(x86emuOp_pop_RM); +OPPROTO(x86emuOp_nop); +OPPROTO(x86emuOp_xchg_word_AX_CX); +OPPROTO(x86emuOp_xchg_word_AX_DX); +OPPROTO(x86emuOp_xchg_word_AX_BX); +OPPROTO(x86emuOp_xchg_word_AX_SP); +OPPROTO(x86emuOp_xchg_word_AX_BP); +OPPROTO(x86emuOp_xchg_word_AX_SI); +OPPROTO(x86emuOp_xchg_word_AX_DI); +OPPROTO(x86emuOp_cbw); +OPPROTO(x86emuOp_cwd); +OPPROTO(x86emuOp_call_far_IMM); +OPPROTO(x86emuOp_wait); +OPPROTO(x86emuOp_pushf_word); +OPPROTO(x86emuOp_popf_word); +OPPROTO(x86emuOp_sahf); +OPPROTO(x86emuOp_lahf); +OPPROTO(x86emuOp_mov_AL_M_IMM); +OPPROTO(x86emuOp_mov_AX_M_IMM); +OPPROTO(x86emuOp_mov_M_AL_IMM); +OPPROTO(x86emuOp_mov_M_AX_IMM); +OPPROTO(x86emuOp_movs_byte); +OPPROTO(x86emuOp_movs_word); +OPPROTO(x86emuOp_cmps_byte); +OPPROTO(x86emuOp_cmps_word); +OPPROTO(x86emuOp_test_AL_IMM); +OPPROTO(x86emuOp_test_AX_IMM); +OPPROTO(x86emuOp_stos_byte); +OPPROTO(x86emuOp_stos_word); +OPPROTO(x86emuOp_lods_byte); +OPPROTO(x86emuOp_lods_word); +OPPROTO(x86emuOp_scas_byte); +OPPROTO(x86emuOp_scas_word); +OPPROTO(x86emuOp_mov_byte_AL_IMM); +OPPROTO(x86emuOp_mov_byte_CL_IMM); +OPPROTO(x86emuOp_mov_byte_DL_IMM); +OPPROTO(x86emuOp_mov_byte_BL_IMM); +OPPROTO(x86emuOp_mov_byte_AH_IMM); +OPPROTO(x86emuOp_mov_byte_CH_IMM); +OPPROTO(x86emuOp_mov_byte_DH_IMM); +OPPROTO(x86emuOp_mov_byte_BH_IMM); +OPPROTO(x86emuOp_mov_word_AX_IMM); +OPPROTO(x86emuOp_mov_word_CX_IMM); +OPPROTO(x86emuOp_mov_word_DX_IMM); +OPPROTO(x86emuOp_mov_word_BX_IMM); +OPPROTO(x86emuOp_mov_word_SP_IMM); +OPPROTO(x86emuOp_mov_word_BP_IMM); +OPPROTO(x86emuOp_mov_word_SI_IMM); +OPPROTO(x86emuOp_mov_word_DI_IMM); +OPPROTO(x86emuOp_opcC0_byte_RM_MEM); +OPPROTO(x86emuOp_opcC1_word_RM_MEM); +OPPROTO(x86emuOp_ret_near_IMM); +OPPROTO(x86emuOp_ret_near); +OPPROTO(x86emuOp_les_R_IMM); +OPPROTO(x86emuOp_lds_R_IMM); +OPPROTO(x86emuOp_mov_byte_RM_IMM); +OPPROTO(x86emuOp_mov_word_RM_IMM); +OPPROTO(x86emuOp_enter); +OPPROTO(x86emuOp_leave); +OPPROTO(x86emuOp_ret_far_IMM); +OPPROTO(x86emuOp_ret_far); +OPPROTO(x86emuOp_int3); +OPPROTO(x86emuOp_int_IMM); +OPPROTO(x86emuOp_into); +OPPROTO(x86emuOp_iret); +OPPROTO(x86emuOp_opcD0_byte_RM_1); +OPPROTO(x86emuOp_opcD1_word_RM_1); +OPPROTO(x86emuOp_opcD2_byte_RM_CL); +OPPROTO(x86emuOp_opcD3_word_RM_CL); +OPPROTO(x86emuOp_aam); +OPPROTO(x86emuOp_aad); +OPPROTO(x86emuOp_xlat); +OPPROTO(x86emuOp_loopne); +OPPROTO(x86emuOp_loope); +OPPROTO(x86emuOp_loop); +OPPROTO(x86emuOp_jcxz); +OPPROTO(x86emuOp_in_byte_AL_IMM); +OPPROTO(x86emuOp_in_word_AX_IMM); +OPPROTO(x86emuOp_out_byte_IMM_AL); +OPPROTO(x86emuOp_out_word_IMM_AX); +OPPROTO(x86emuOp_call_near_IMM); +OPPROTO(x86emuOp_jump_near_IMM); +OPPROTO(x86emuOp_jump_far_IMM); +OPPROTO(x86emuOp_jump_byte_IMM); +OPPROTO(x86emuOp_in_byte_AL_DX); +OPPROTO(x86emuOp_in_word_AX_DX); +OPPROTO(x86emuOp_out_byte_DX_AL); +OPPROTO(x86emuOp_out_word_DX_AX); +OPPROTO(x86emuOp_lock); +OPPROTO(x86emuOp_repne); +OPPROTO(x86emuOp_repe); +OPPROTO(x86emuOp_halt); +OPPROTO(x86emuOp_cmc); +OPPROTO(x86emuOp_opcF6_byte_RM); +OPPROTO(x86emuOp_opcF7_word_RM); +OPPROTO(x86emuOp_clc); +OPPROTO(x86emuOp_stc); +OPPROTO(x86emuOp_cli); +OPPROTO(x86emuOp_sti); +OPPROTO(x86emuOp_cld); +OPPROTO(x86emuOp_std); +OPPROTO(x86emuOp_opcFE_byte_RM); +OPPROTO(x86emuOp_opcFF_word_RM); + + +OPPROTO(x86emuOp2_illegal_op); +OPPROTO(x86emuOp2_long_jump); +OPPROTO(x86emuOp2_set_byte); +OPPROTO(x86emuOp2_push_FS); +OPPROTO(x86emuOp2_pop_FS); +OPPROTO(x86emuOp2_bt_R); +OPPROTO(x86emuOp2_shld_IMM); +OPPROTO(x86emuOp2_shld_CL); +OPPROTO(x86emuOp2_push_GS); +OPPROTO(x86emuOp2_pop_GS); +OPPROTO(x86emuOp2_bts_R); +OPPROTO(x86emuOp2_shrd_IMM); +OPPROTO(x86emuOp2_shrd_CL); +OPPROTO(x86emuOp2_imul_R_RM); +OPPROTO(x86emuOp2_lss_R_IMM); +OPPROTO(x86emuOp2_btr_R); +OPPROTO(x86emuOp2_lfs_R_IMM); +OPPROTO(x86emuOp2_lgs_R_IMM); +OPPROTO(x86emuOp2_movzx_byte_R_RM); +OPPROTO(x86emuOp2_movzx_word_R_RM); +OPPROTO(x86emuOp2_btX_I); +OPPROTO(x86emuOp2_btc_R); +OPPROTO(x86emuOp2_bsf); +OPPROTO(x86emuOp2_bsr); +OPPROTO(x86emuOp2_movsx_byte_R_RM); +OPPROTO(x86emuOp2_movsx_word_R_R); +OPPROTO(x86emuOp2_movsx_word_R_RM); diff --git a/cfe/cfe/x86emu/x86emu/prim_asm.h b/cfe/cfe/x86emu/x86emu/prim_asm.h new file mode 100644 index 0000000..4fa8d55 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/prim_asm.h @@ -0,0 +1,971 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: Watcom C++ 10.6 or later +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Inline assembler versions of the primitive operand +* functions for faster performance. At the moment this is +* x86 inline assembler, but these functions could be replaced +* with native inline assembler for each supported processor +* platform. +* +****************************************************************************/ +/* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/prim_asm.h,v 1.3 2000/04/19 15:48:15 tsi Exp $ */ + +#ifndef __X86EMU_PRIM_ASM_H +#define __X86EMU_PRIM_ASM_H + +#ifdef __WATCOMC__ + +#ifndef VALIDATE +#define __HAVE_INLINE_ASSEMBLER__ +#endif + +u32 get_flags_asm(void); +#pragma aux get_flags_asm = \ + "pushf" \ + "pop eax" \ + value [eax] \ + modify exact [eax]; + +u16 aaa_word_asm(u32 *flags,u16 d); +#pragma aux aaa_word_asm = \ + "push [edi]" \ + "popf" \ + "aaa" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] \ + value [ax] \ + modify exact [ax]; + +u16 aas_word_asm(u32 *flags,u16 d); +#pragma aux aas_word_asm = \ + "push [edi]" \ + "popf" \ + "aas" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] \ + value [ax] \ + modify exact [ax]; + +u16 aad_word_asm(u32 *flags,u16 d); +#pragma aux aad_word_asm = \ + "push [edi]" \ + "popf" \ + "aad" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] \ + value [ax] \ + modify exact [ax]; + +u16 aam_word_asm(u32 *flags,u8 d); +#pragma aux aam_word_asm = \ + "push [edi]" \ + "popf" \ + "aam" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] \ + value [ax] \ + modify exact [ax]; + +u8 adc_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux adc_byte_asm = \ + "push [edi]" \ + "popf" \ + "adc al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + value [al] \ + modify exact [al bl]; + +u16 adc_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux adc_word_asm = \ + "push [edi]" \ + "popf" \ + "adc ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + value [ax] \ + modify exact [ax bx]; + +u32 adc_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux adc_long_asm = \ + "push [edi]" \ + "popf" \ + "adc eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + value [eax] \ + modify exact [eax ebx]; + +u8 add_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux add_byte_asm = \ + "push [edi]" \ + "popf" \ + "add al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + value [al] \ + modify exact [al bl]; + +u16 add_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux add_word_asm = \ + "push [edi]" \ + "popf" \ + "add ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + value [ax] \ + modify exact [ax bx]; + +u32 add_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux add_long_asm = \ + "push [edi]" \ + "popf" \ + "add eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + value [eax] \ + modify exact [eax ebx]; + +u8 and_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux and_byte_asm = \ + "push [edi]" \ + "popf" \ + "and al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + value [al] \ + modify exact [al bl]; + +u16 and_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux and_word_asm = \ + "push [edi]" \ + "popf" \ + "and ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + value [ax] \ + modify exact [ax bx]; + +u32 and_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux and_long_asm = \ + "push [edi]" \ + "popf" \ + "and eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + value [eax] \ + modify exact [eax ebx]; + +u8 cmp_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux cmp_byte_asm = \ + "push [edi]" \ + "popf" \ + "cmp al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + value [al] \ + modify exact [al bl]; + +u16 cmp_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux cmp_word_asm = \ + "push [edi]" \ + "popf" \ + "cmp ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + value [ax] \ + modify exact [ax bx]; + +u32 cmp_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux cmp_long_asm = \ + "push [edi]" \ + "popf" \ + "cmp eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + value [eax] \ + modify exact [eax ebx]; + +u8 daa_byte_asm(u32 *flags,u8 d); +#pragma aux daa_byte_asm = \ + "push [edi]" \ + "popf" \ + "daa" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] \ + value [al] \ + modify exact [al]; + +u8 das_byte_asm(u32 *flags,u8 d); +#pragma aux das_byte_asm = \ + "push [edi]" \ + "popf" \ + "das" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] \ + value [al] \ + modify exact [al]; + +u8 dec_byte_asm(u32 *flags,u8 d); +#pragma aux dec_byte_asm = \ + "push [edi]" \ + "popf" \ + "dec al" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] \ + value [al] \ + modify exact [al]; + +u16 dec_word_asm(u32 *flags,u16 d); +#pragma aux dec_word_asm = \ + "push [edi]" \ + "popf" \ + "dec ax" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] \ + value [ax] \ + modify exact [ax]; + +u32 dec_long_asm(u32 *flags,u32 d); +#pragma aux dec_long_asm = \ + "push [edi]" \ + "popf" \ + "dec eax" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] \ + value [eax] \ + modify exact [eax]; + +u8 inc_byte_asm(u32 *flags,u8 d); +#pragma aux inc_byte_asm = \ + "push [edi]" \ + "popf" \ + "inc al" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] \ + value [al] \ + modify exact [al]; + +u16 inc_word_asm(u32 *flags,u16 d); +#pragma aux inc_word_asm = \ + "push [edi]" \ + "popf" \ + "inc ax" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] \ + value [ax] \ + modify exact [ax]; + +u32 inc_long_asm(u32 *flags,u32 d); +#pragma aux inc_long_asm = \ + "push [edi]" \ + "popf" \ + "inc eax" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] \ + value [eax] \ + modify exact [eax]; + +u8 or_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux or_byte_asm = \ + "push [edi]" \ + "popf" \ + "or al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + value [al] \ + modify exact [al bl]; + +u16 or_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux or_word_asm = \ + "push [edi]" \ + "popf" \ + "or ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + value [ax] \ + modify exact [ax bx]; + +u32 or_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux or_long_asm = \ + "push [edi]" \ + "popf" \ + "or eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + value [eax] \ + modify exact [eax ebx]; + +u8 neg_byte_asm(u32 *flags,u8 d); +#pragma aux neg_byte_asm = \ + "push [edi]" \ + "popf" \ + "neg al" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] \ + value [al] \ + modify exact [al]; + +u16 neg_word_asm(u32 *flags,u16 d); +#pragma aux neg_word_asm = \ + "push [edi]" \ + "popf" \ + "neg ax" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] \ + value [ax] \ + modify exact [ax]; + +u32 neg_long_asm(u32 *flags,u32 d); +#pragma aux neg_long_asm = \ + "push [edi]" \ + "popf" \ + "neg eax" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] \ + value [eax] \ + modify exact [eax]; + +u8 not_byte_asm(u32 *flags,u8 d); +#pragma aux not_byte_asm = \ + "push [edi]" \ + "popf" \ + "not al" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] \ + value [al] \ + modify exact [al]; + +u16 not_word_asm(u32 *flags,u16 d); +#pragma aux not_word_asm = \ + "push [edi]" \ + "popf" \ + "not ax" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] \ + value [ax] \ + modify exact [ax]; + +u32 not_long_asm(u32 *flags,u32 d); +#pragma aux not_long_asm = \ + "push [edi]" \ + "popf" \ + "not eax" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] \ + value [eax] \ + modify exact [eax]; + +u8 rcl_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux rcl_byte_asm = \ + "push [edi]" \ + "popf" \ + "rcl al,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [cl] \ + value [al] \ + modify exact [al cl]; + +u16 rcl_word_asm(u32 *flags,u16 d, u8 s); +#pragma aux rcl_word_asm = \ + "push [edi]" \ + "popf" \ + "rcl ax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [cl] \ + value [ax] \ + modify exact [ax cl]; + +u32 rcl_long_asm(u32 *flags,u32 d, u8 s); +#pragma aux rcl_long_asm = \ + "push [edi]" \ + "popf" \ + "rcl eax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [cl] \ + value [eax] \ + modify exact [eax cl]; + +u8 rcr_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux rcr_byte_asm = \ + "push [edi]" \ + "popf" \ + "rcr al,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [cl] \ + value [al] \ + modify exact [al cl]; + +u16 rcr_word_asm(u32 *flags,u16 d, u8 s); +#pragma aux rcr_word_asm = \ + "push [edi]" \ + "popf" \ + "rcr ax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [cl] \ + value [ax] \ + modify exact [ax cl]; + +u32 rcr_long_asm(u32 *flags,u32 d, u8 s); +#pragma aux rcr_long_asm = \ + "push [edi]" \ + "popf" \ + "rcr eax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [cl] \ + value [eax] \ + modify exact [eax cl]; + +u8 rol_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux rol_byte_asm = \ + "push [edi]" \ + "popf" \ + "rol al,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [cl] \ + value [al] \ + modify exact [al cl]; + +u16 rol_word_asm(u32 *flags,u16 d, u8 s); +#pragma aux rol_word_asm = \ + "push [edi]" \ + "popf" \ + "rol ax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [cl] \ + value [ax] \ + modify exact [ax cl]; + +u32 rol_long_asm(u32 *flags,u32 d, u8 s); +#pragma aux rol_long_asm = \ + "push [edi]" \ + "popf" \ + "rol eax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [cl] \ + value [eax] \ + modify exact [eax cl]; + +u8 ror_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux ror_byte_asm = \ + "push [edi]" \ + "popf" \ + "ror al,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [cl] \ + value [al] \ + modify exact [al cl]; + +u16 ror_word_asm(u32 *flags,u16 d, u8 s); +#pragma aux ror_word_asm = \ + "push [edi]" \ + "popf" \ + "ror ax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [cl] \ + value [ax] \ + modify exact [ax cl]; + +u32 ror_long_asm(u32 *flags,u32 d, u8 s); +#pragma aux ror_long_asm = \ + "push [edi]" \ + "popf" \ + "ror eax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [cl] \ + value [eax] \ + modify exact [eax cl]; + +u8 shl_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux shl_byte_asm = \ + "push [edi]" \ + "popf" \ + "shl al,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [cl] \ + value [al] \ + modify exact [al cl]; + +u16 shl_word_asm(u32 *flags,u16 d, u8 s); +#pragma aux shl_word_asm = \ + "push [edi]" \ + "popf" \ + "shl ax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [cl] \ + value [ax] \ + modify exact [ax cl]; + +u32 shl_long_asm(u32 *flags,u32 d, u8 s); +#pragma aux shl_long_asm = \ + "push [edi]" \ + "popf" \ + "shl eax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [cl] \ + value [eax] \ + modify exact [eax cl]; + +u8 shr_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux shr_byte_asm = \ + "push [edi]" \ + "popf" \ + "shr al,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [cl] \ + value [al] \ + modify exact [al cl]; + +u16 shr_word_asm(u32 *flags,u16 d, u8 s); +#pragma aux shr_word_asm = \ + "push [edi]" \ + "popf" \ + "shr ax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [cl] \ + value [ax] \ + modify exact [ax cl]; + +u32 shr_long_asm(u32 *flags,u32 d, u8 s); +#pragma aux shr_long_asm = \ + "push [edi]" \ + "popf" \ + "shr eax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [cl] \ + value [eax] \ + modify exact [eax cl]; + +u8 sar_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux sar_byte_asm = \ + "push [edi]" \ + "popf" \ + "sar al,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [cl] \ + value [al] \ + modify exact [al cl]; + +u16 sar_word_asm(u32 *flags,u16 d, u8 s); +#pragma aux sar_word_asm = \ + "push [edi]" \ + "popf" \ + "sar ax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [cl] \ + value [ax] \ + modify exact [ax cl]; + +u32 sar_long_asm(u32 *flags,u32 d, u8 s); +#pragma aux sar_long_asm = \ + "push [edi]" \ + "popf" \ + "sar eax,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [cl] \ + value [eax] \ + modify exact [eax cl]; + +u16 shld_word_asm(u32 *flags,u16 d, u16 fill, u8 s); +#pragma aux shld_word_asm = \ + "push [edi]" \ + "popf" \ + "shld ax,dx,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [dx] [cl] \ + value [ax] \ + modify exact [ax dx cl]; + +u32 shld_long_asm(u32 *flags,u32 d, u32 fill, u8 s); +#pragma aux shld_long_asm = \ + "push [edi]" \ + "popf" \ + "shld eax,edx,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [edx] [cl] \ + value [eax] \ + modify exact [eax edx cl]; + +u16 shrd_word_asm(u32 *flags,u16 d, u16 fill, u8 s); +#pragma aux shrd_word_asm = \ + "push [edi]" \ + "popf" \ + "shrd ax,dx,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [dx] [cl] \ + value [ax] \ + modify exact [ax dx cl]; + +u32 shrd_long_asm(u32 *flags,u32 d, u32 fill, u8 s); +#pragma aux shrd_long_asm = \ + "push [edi]" \ + "popf" \ + "shrd eax,edx,cl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [edx] [cl] \ + value [eax] \ + modify exact [eax edx cl]; + +u8 sbb_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux sbb_byte_asm = \ + "push [edi]" \ + "popf" \ + "sbb al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + value [al] \ + modify exact [al bl]; + +u16 sbb_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux sbb_word_asm = \ + "push [edi]" \ + "popf" \ + "sbb ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + value [ax] \ + modify exact [ax bx]; + +u32 sbb_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux sbb_long_asm = \ + "push [edi]" \ + "popf" \ + "sbb eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + value [eax] \ + modify exact [eax ebx]; + +u8 sub_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux sub_byte_asm = \ + "push [edi]" \ + "popf" \ + "sub al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + value [al] \ + modify exact [al bl]; + +u16 sub_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux sub_word_asm = \ + "push [edi]" \ + "popf" \ + "sub ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + value [ax] \ + modify exact [ax bx]; + +u32 sub_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux sub_long_asm = \ + "push [edi]" \ + "popf" \ + "sub eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + value [eax] \ + modify exact [eax ebx]; + +void test_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux test_byte_asm = \ + "push [edi]" \ + "popf" \ + "test al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + modify exact [al bl]; + +void test_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux test_word_asm = \ + "push [edi]" \ + "popf" \ + "test ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + modify exact [ax bx]; + +void test_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux test_long_asm = \ + "push [edi]" \ + "popf" \ + "test eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + modify exact [eax ebx]; + +u8 xor_byte_asm(u32 *flags,u8 d, u8 s); +#pragma aux xor_byte_asm = \ + "push [edi]" \ + "popf" \ + "xor al,bl" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [al] [bl] \ + value [al] \ + modify exact [al bl]; + +u16 xor_word_asm(u32 *flags,u16 d, u16 s); +#pragma aux xor_word_asm = \ + "push [edi]" \ + "popf" \ + "xor ax,bx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [ax] [bx] \ + value [ax] \ + modify exact [ax bx]; + +u32 xor_long_asm(u32 *flags,u32 d, u32 s); +#pragma aux xor_long_asm = \ + "push [edi]" \ + "popf" \ + "xor eax,ebx" \ + "pushf" \ + "pop [edi]" \ + parm [edi] [eax] [ebx] \ + value [eax] \ + modify exact [eax ebx]; + +void imul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s); +#pragma aux imul_byte_asm = \ + "push [edi]" \ + "popf" \ + "imul bl" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],ax" \ + parm [edi] [esi] [al] [bl] \ + modify exact [esi ax bl]; + +void imul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s); +#pragma aux imul_word_asm = \ + "push [edi]" \ + "popf" \ + "imul bx" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],ax" \ + "mov [ecx],dx" \ + parm [edi] [esi] [ecx] [ax] [bx]\ + modify exact [esi edi ax bx dx]; + +void imul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s); +#pragma aux imul_long_asm = \ + "push [edi]" \ + "popf" \ + "imul ebx" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],eax" \ + "mov [ecx],edx" \ + parm [edi] [esi] [ecx] [eax] [ebx] \ + modify exact [esi edi eax ebx edx]; + +void mul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s); +#pragma aux mul_byte_asm = \ + "push [edi]" \ + "popf" \ + "mul bl" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],ax" \ + parm [edi] [esi] [al] [bl] \ + modify exact [esi ax bl]; + +void mul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s); +#pragma aux mul_word_asm = \ + "push [edi]" \ + "popf" \ + "mul bx" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],ax" \ + "mov [ecx],dx" \ + parm [edi] [esi] [ecx] [ax] [bx]\ + modify exact [esi edi ax bx dx]; + +void mul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s); +#pragma aux mul_long_asm = \ + "push [edi]" \ + "popf" \ + "mul ebx" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],eax" \ + "mov [ecx],edx" \ + parm [edi] [esi] [ecx] [eax] [ebx] \ + modify exact [esi edi eax ebx edx]; + +void idiv_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s); +#pragma aux idiv_byte_asm = \ + "push [edi]" \ + "popf" \ + "idiv bl" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],al" \ + "mov [ecx],ah" \ + parm [edi] [esi] [ecx] [ax] [bl]\ + modify exact [esi edi ax bl]; + +void idiv_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s); +#pragma aux idiv_word_asm = \ + "push [edi]" \ + "popf" \ + "idiv bx" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],ax" \ + "mov [ecx],dx" \ + parm [edi] [esi] [ecx] [ax] [dx] [bx]\ + modify exact [esi edi ax dx bx]; + +void idiv_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s); +#pragma aux idiv_long_asm = \ + "push [edi]" \ + "popf" \ + "idiv ebx" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],eax" \ + "mov [ecx],edx" \ + parm [edi] [esi] [ecx] [eax] [edx] [ebx]\ + modify exact [esi edi eax edx ebx]; + +void div_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s); +#pragma aux div_byte_asm = \ + "push [edi]" \ + "popf" \ + "div bl" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],al" \ + "mov [ecx],ah" \ + parm [edi] [esi] [ecx] [ax] [bl]\ + modify exact [esi edi ax bl]; + +void div_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s); +#pragma aux div_word_asm = \ + "push [edi]" \ + "popf" \ + "div bx" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],ax" \ + "mov [ecx],dx" \ + parm [edi] [esi] [ecx] [ax] [dx] [bx]\ + modify exact [esi edi ax dx bx]; + +void div_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s); +#pragma aux div_long_asm = \ + "push [edi]" \ + "popf" \ + "div ebx" \ + "pushf" \ + "pop [edi]" \ + "mov [esi],eax" \ + "mov [ecx],edx" \ + parm [edi] [esi] [ecx] [eax] [edx] [ebx]\ + modify exact [esi edi eax edx ebx]; + +#endif + +#endif /* __X86EMU_PRIM_ASM_H */ diff --git a/cfe/cfe/x86emu/x86emu/prim_ops.h b/cfe/cfe/x86emu/x86emu/prim_ops.h new file mode 100644 index 0000000..1633fe1 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/prim_ops.h @@ -0,0 +1,231 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for primitive operation functions. +* +****************************************************************************/ + +#ifndef __X86EMU_PRIM_OPS_H +#define __X86EMU_PRIM_OPS_H + +#include "x86emu/prim_asm.h" + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +u16 aaa_word (u16 d); +u16 aas_word (u16 d); +u16 aad_word (u16 d); +u16 aam_word (u8 d); +u8 adc_byte (u8 d, u8 s); +u16 adc_word (u16 d, u16 s); +u32 adc_long (u32 d, u32 s); +u8 add_byte (u8 d, u8 s); +u16 add_word (u16 d, u16 s); +u32 add_long (u32 d, u32 s); +u8 and_byte (u8 d, u8 s); +u16 and_word (u16 d, u16 s); +u32 and_long (u32 d, u32 s); +u8 cmp_byte (u8 d, u8 s); +u16 cmp_word (u16 d, u16 s); +u32 cmp_long (u32 d, u32 s); +u8 daa_byte (u8 d); +u8 das_byte (u8 d); +u8 dec_byte (u8 d); +u16 dec_word (u16 d); +u32 dec_long (u32 d); +u8 inc_byte (u8 d); +u16 inc_word (u16 d); +u32 inc_long (u32 d); +u8 or_byte (u8 d, u8 s); +u16 or_word (u16 d, u16 s); +u32 or_long (u32 d, u32 s); +u8 neg_byte (u8 s); +u16 neg_word (u16 s); +u32 neg_long (u32 s); +u8 not_byte (u8 s); +u16 not_word (u16 s); +u32 not_long (u32 s); +u8 rcl_byte (u8 d, u8 s); +u16 rcl_word (u16 d, u8 s); +u32 rcl_long (u32 d, u8 s); +u8 rcr_byte (u8 d, u8 s); +u16 rcr_word (u16 d, u8 s); +u32 rcr_long (u32 d, u8 s); +u8 rol_byte (u8 d, u8 s); +u16 rol_word (u16 d, u8 s); +u32 rol_long (u32 d, u8 s); +u8 ror_byte (u8 d, u8 s); +u16 ror_word (u16 d, u8 s); +u32 ror_long (u32 d, u8 s); +u8 shl_byte (u8 d, u8 s); +u16 shl_word (u16 d, u8 s); +u32 shl_long (u32 d, u8 s); +u8 shr_byte (u8 d, u8 s); +u16 shr_word (u16 d, u8 s); +u32 shr_long (u32 d, u8 s); +u8 sar_byte (u8 d, u8 s); +u16 sar_word (u16 d, u8 s); +u32 sar_long (u32 d, u8 s); +u16 shld_word (u16 d, u16 fill, u8 s); +u32 shld_long (u32 d, u32 fill, u8 s); +u16 shrd_word (u16 d, u16 fill, u8 s); +u32 shrd_long (u32 d, u32 fill, u8 s); +u8 sbb_byte (u8 d, u8 s); +u16 sbb_word (u16 d, u16 s); +u32 sbb_long (u32 d, u32 s); +u8 sub_byte (u8 d, u8 s); +u16 sub_word (u16 d, u16 s); +u32 sub_long (u32 d, u32 s); +void test_byte (u8 d, u8 s); +void test_word (u16 d, u16 s); +void test_long (u32 d, u32 s); +u8 xor_byte (u8 d, u8 s); +u16 xor_word (u16 d, u16 s); +u32 xor_long (u32 d, u32 s); +void imul_byte (u8 s); +void imul_word (u16 s); +void imul_long (u32 s); +void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s); +void mul_byte (u8 s); +void mul_word (u16 s); +void mul_long (u32 s); +void idiv_byte (u8 s); +void idiv_word (u16 s); +void idiv_long (u32 s); +void div_byte (u8 s); +void div_word (u16 s); +void div_long (u32 s); +void ins (int size); +void outs (int size); +u16 mem_access_word (int addr); +void push_word (u16 w); +void push_long (u32 w); +u16 pop_word (void); +u32 pop_long (void); + +#if defined(__HAVE_INLINE_ASSEMBLER__) && !defined(PRIM_OPS_NO_REDEFINE_ASM) + +#define aaa_word(d) aaa_word_asm(&M.x86.R_EFLG,d) +#define aas_word(d) aas_word_asm(&M.x86.R_EFLG,d) +#define aad_word(d) aad_word_asm(&M.x86.R_EFLG,d) +#define aam_word(d) aam_word_asm(&M.x86.R_EFLG,d) +#define adc_byte(d,s) adc_byte_asm(&M.x86.R_EFLG,d,s) +#define adc_word(d,s) adc_word_asm(&M.x86.R_EFLG,d,s) +#define adc_long(d,s) adc_long_asm(&M.x86.R_EFLG,d,s) +#define add_byte(d,s) add_byte_asm(&M.x86.R_EFLG,d,s) +#define add_word(d,s) add_word_asm(&M.x86.R_EFLG,d,s) +#define add_long(d,s) add_long_asm(&M.x86.R_EFLG,d,s) +#define and_byte(d,s) and_byte_asm(&M.x86.R_EFLG,d,s) +#define and_word(d,s) and_word_asm(&M.x86.R_EFLG,d,s) +#define and_long(d,s) and_long_asm(&M.x86.R_EFLG,d,s) +#define cmp_byte(d,s) cmp_byte_asm(&M.x86.R_EFLG,d,s) +#define cmp_word(d,s) cmp_word_asm(&M.x86.R_EFLG,d,s) +#define cmp_long(d,s) cmp_long_asm(&M.x86.R_EFLG,d,s) +#define daa_byte(d) daa_byte_asm(&M.x86.R_EFLG,d) +#define das_byte(d) das_byte_asm(&M.x86.R_EFLG,d) +#define dec_byte(d) dec_byte_asm(&M.x86.R_EFLG,d) +#define dec_word(d) dec_word_asm(&M.x86.R_EFLG,d) +#define dec_long(d) dec_long_asm(&M.x86.R_EFLG,d) +#define inc_byte(d) inc_byte_asm(&M.x86.R_EFLG,d) +#define inc_word(d) inc_word_asm(&M.x86.R_EFLG,d) +#define inc_long(d) inc_long_asm(&M.x86.R_EFLG,d) +#define or_byte(d,s) or_byte_asm(&M.x86.R_EFLG,d,s) +#define or_word(d,s) or_word_asm(&M.x86.R_EFLG,d,s) +#define or_long(d,s) or_long_asm(&M.x86.R_EFLG,d,s) +#define neg_byte(s) neg_byte_asm(&M.x86.R_EFLG,s) +#define neg_word(s) neg_word_asm(&M.x86.R_EFLG,s) +#define neg_long(s) neg_long_asm(&M.x86.R_EFLG,s) +#define not_byte(s) not_byte_asm(&M.x86.R_EFLG,s) +#define not_word(s) not_word_asm(&M.x86.R_EFLG,s) +#define not_long(s) not_long_asm(&M.x86.R_EFLG,s) +#define rcl_byte(d,s) rcl_byte_asm(&M.x86.R_EFLG,d,s) +#define rcl_word(d,s) rcl_word_asm(&M.x86.R_EFLG,d,s) +#define rcl_long(d,s) rcl_long_asm(&M.x86.R_EFLG,d,s) +#define rcr_byte(d,s) rcr_byte_asm(&M.x86.R_EFLG,d,s) +#define rcr_word(d,s) rcr_word_asm(&M.x86.R_EFLG,d,s) +#define rcr_long(d,s) rcr_long_asm(&M.x86.R_EFLG,d,s) +#define rol_byte(d,s) rol_byte_asm(&M.x86.R_EFLG,d,s) +#define rol_word(d,s) rol_word_asm(&M.x86.R_EFLG,d,s) +#define rol_long(d,s) rol_long_asm(&M.x86.R_EFLG,d,s) +#define ror_byte(d,s) ror_byte_asm(&M.x86.R_EFLG,d,s) +#define ror_word(d,s) ror_word_asm(&M.x86.R_EFLG,d,s) +#define ror_long(d,s) ror_long_asm(&M.x86.R_EFLG,d,s) +#define shl_byte(d,s) shl_byte_asm(&M.x86.R_EFLG,d,s) +#define shl_word(d,s) shl_word_asm(&M.x86.R_EFLG,d,s) +#define shl_long(d,s) shl_long_asm(&M.x86.R_EFLG,d,s) +#define shr_byte(d,s) shr_byte_asm(&M.x86.R_EFLG,d,s) +#define shr_word(d,s) shr_word_asm(&M.x86.R_EFLG,d,s) +#define shr_long(d,s) shr_long_asm(&M.x86.R_EFLG,d,s) +#define sar_byte(d,s) sar_byte_asm(&M.x86.R_EFLG,d,s) +#define sar_word(d,s) sar_word_asm(&M.x86.R_EFLG,d,s) +#define sar_long(d,s) sar_long_asm(&M.x86.R_EFLG,d,s) +#define shld_word(d,fill,s) shld_word_asm(&M.x86.R_EFLG,d,fill,s) +#define shld_long(d,fill,s) shld_long_asm(&M.x86.R_EFLG,d,fill,s) +#define shrd_word(d,fill,s) shrd_word_asm(&M.x86.R_EFLG,d,fill,s) +#define shrd_long(d,fill,s) shrd_long_asm(&M.x86.R_EFLG,d,fill,s) +#define sbb_byte(d,s) sbb_byte_asm(&M.x86.R_EFLG,d,s) +#define sbb_word(d,s) sbb_word_asm(&M.x86.R_EFLG,d,s) +#define sbb_long(d,s) sbb_long_asm(&M.x86.R_EFLG,d,s) +#define sub_byte(d,s) sub_byte_asm(&M.x86.R_EFLG,d,s) +#define sub_word(d,s) sub_word_asm(&M.x86.R_EFLG,d,s) +#define sub_long(d,s) sub_long_asm(&M.x86.R_EFLG,d,s) +#define test_byte(d,s) test_byte_asm(&M.x86.R_EFLG,d,s) +#define test_word(d,s) test_word_asm(&M.x86.R_EFLG,d,s) +#define test_long(d,s) test_long_asm(&M.x86.R_EFLG,d,s) +#define xor_byte(d,s) xor_byte_asm(&M.x86.R_EFLG,d,s) +#define xor_word(d,s) xor_word_asm(&M.x86.R_EFLG,d,s) +#define xor_long(d,s) xor_long_asm(&M.x86.R_EFLG,d,s) +#define imul_byte(s) imul_byte_asm(&M.x86.R_EFLG,&M.x86.R_AX,M.x86.R_AL,s) +#define imul_word(s) imul_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,s) +#define imul_long(s) imul_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s) +#define imul_long_direct(res_lo,res_hi,d,s) imul_long_asm(&M.x86.R_EFLG,res_lo,res_hi,d,s) +#define mul_byte(s) mul_byte_asm(&M.x86.R_EFLG,&M.x86.R_AX,M.x86.R_AL,s) +#define mul_word(s) mul_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,s) +#define mul_long(s) mul_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s) +#define idiv_byte(s) idiv_byte_asm(&M.x86.R_EFLG,&M.x86.R_AL,&M.x86.R_AH,M.x86.R_AX,s) +#define idiv_word(s) idiv_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,M.x86.R_DX,s) +#define idiv_long(s) idiv_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,M.x86.R_EDX,s) +#define div_byte(s) div_byte_asm(&M.x86.R_EFLG,&M.x86.R_AL,&M.x86.R_AH,M.x86.R_AX,s) +#define div_word(s) div_word_asm(&M.x86.R_EFLG,&M.x86.R_AX,&M.x86.R_DX,M.x86.R_AX,M.x86.R_DX,s) +#define div_long(s) div_long_asm(&M.x86.R_EFLG,&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,M.x86.R_EDX,s) + +#endif + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif + +#endif /* __X86EMU_PRIM_OPS_H */ diff --git a/cfe/cfe/x86emu/x86emu/regs.h b/cfe/cfe/x86emu/x86emu/regs.h new file mode 100644 index 0000000..b0a6231 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/regs.h @@ -0,0 +1,351 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for x86 register definitions. +* +****************************************************************************/ + +#ifndef __X86EMU_REGS_H +#define __X86EMU_REGS_H + +#ifdef __mips +#if defined(__MIPSEB) +#define __BIG_ENDIAN__ +#elif defined(__MIPSEL) +#define __LITTLE_ENDIAN__ +#else +#error "You must define either __MIPSEB or __MIPSEL" +#endif +#endif + +/*---------------------- Macros and type definitions ----------------------*/ + +#ifndef __mips +#pragma pack(1) +#endif + +/* + * General EAX, EBX, ECX, EDX type registers. Note that for + * portability, and speed, the issue of byte swapping is not addressed + * in the registers. All registers are stored in the default format + * available on the host machine. The only critical issue is that the + * registers should line up EXACTLY in the same manner as they do in + * the 386. That is: + * + * EAX & 0xff === AL + * EAX & 0xffff == AX + * + * etc. The result is that alot of the calculations can then be + * done using the native instruction set fully. + */ + +#ifdef __BIG_ENDIAN__ + +typedef struct { + u32 e_reg; + } I32_reg_t; + +typedef struct { + u16 filler0, x_reg; + } I16_reg_t; + +typedef struct { + u8 filler0, filler1, h_reg, l_reg; + } I8_reg_t; + +#else /* !__BIG_ENDIAN__ */ + +typedef struct { + u32 e_reg; + } I32_reg_t; + +typedef struct { + u16 x_reg; + } I16_reg_t; + +typedef struct { + u8 l_reg, h_reg; + } I8_reg_t; + +#endif /* BIG_ENDIAN */ + +typedef union { + I32_reg_t I32_reg; + I16_reg_t I16_reg; + I8_reg_t I8_reg; + } i386_general_register; + +struct i386_general_regs { + i386_general_register A, B, C, D; + }; + +typedef struct i386_general_regs Gen_reg_t; + +struct i386_special_regs { + i386_general_register SP, BP, SI, DI, IP; + u32 FLAGS; + }; + +/* + * Segment registers here represent the 16 bit quantities + * CS, DS, ES, SS. + */ + +struct i386_segment_regs { + u16 CS, DS, SS, ES, FS, GS; + }; + +/* 8 bit registers */ +#define R_AH gen.A.I8_reg.h_reg +#define R_AL gen.A.I8_reg.l_reg +#define R_BH gen.B.I8_reg.h_reg +#define R_BL gen.B.I8_reg.l_reg +#define R_CH gen.C.I8_reg.h_reg +#define R_CL gen.C.I8_reg.l_reg +#define R_DH gen.D.I8_reg.h_reg +#define R_DL gen.D.I8_reg.l_reg + +/* 16 bit registers */ +#define R_AX gen.A.I16_reg.x_reg +#define R_BX gen.B.I16_reg.x_reg +#define R_CX gen.C.I16_reg.x_reg +#define R_DX gen.D.I16_reg.x_reg + +/* 32 bit extended registers */ +#define R_EAX gen.A.I32_reg.e_reg +#define R_EBX gen.B.I32_reg.e_reg +#define R_ECX gen.C.I32_reg.e_reg +#define R_EDX gen.D.I32_reg.e_reg + +/* special registers */ +#define R_SP spc.SP.I16_reg.x_reg +#define R_BP spc.BP.I16_reg.x_reg +#define R_SI spc.SI.I16_reg.x_reg +#define R_DI spc.DI.I16_reg.x_reg +#define R_IP spc.IP.I16_reg.x_reg +#define R_FLG spc.FLAGS + +/* special registers */ +#define R_SP spc.SP.I16_reg.x_reg +#define R_BP spc.BP.I16_reg.x_reg +#define R_SI spc.SI.I16_reg.x_reg +#define R_DI spc.DI.I16_reg.x_reg +#define R_IP spc.IP.I16_reg.x_reg +#define R_FLG spc.FLAGS + +/* special registers */ +#define R_ESP spc.SP.I32_reg.e_reg +#define R_EBP spc.BP.I32_reg.e_reg +#define R_ESI spc.SI.I32_reg.e_reg +#define R_EDI spc.DI.I32_reg.e_reg +#define R_EIP spc.IP.I32_reg.e_reg +#define R_EFLG spc.FLAGS + +/* segment registers */ +#define R_CS seg.CS +#define R_DS seg.DS +#define R_SS seg.SS +#define R_ES seg.ES +#define R_FS seg.FS +#define R_GS seg.GS + +/* flag conditions */ +#define FB_CF 0x0001 /* CARRY flag */ +#define FB_PF 0x0004 /* PARITY flag */ +#define FB_AF 0x0010 /* AUX flag */ +#define FB_ZF 0x0040 /* ZERO flag */ +#define FB_SF 0x0080 /* SIGN flag */ +#define FB_TF 0x0100 /* TRAP flag */ +#define FB_IF 0x0200 /* INTERRUPT ENABLE flag */ +#define FB_DF 0x0400 /* DIR flag */ +#define FB_OF 0x0800 /* OVERFLOW flag */ + +/* 80286 and above always have bit#1 set */ +#define F_ALWAYS_ON (0x0002) /* flag bits always on */ + +/* + * Define a mask for only those flag bits we will ever pass back + * (via PUSHF) + */ +#define F_MSK (FB_CF|FB_PF|FB_AF|FB_ZF|FB_SF|FB_TF|FB_IF|FB_DF|FB_OF) + +/* following bits masked in to a 16bit quantity */ + +#define F_CF 0x0001 /* CARRY flag */ +#define F_PF 0x0004 /* PARITY flag */ +#define F_AF 0x0010 /* AUX flag */ +#define F_ZF 0x0040 /* ZERO flag */ +#define F_SF 0x0080 /* SIGN flag */ +#define F_TF 0x0100 /* TRAP flag */ +#define F_IF 0x0200 /* INTERRUPT ENABLE flag */ +#define F_DF 0x0400 /* DIR flag */ +#define F_OF 0x0800 /* OVERFLOW flag */ + +#define TOGGLE_FLAG(flag) (M.x86.R_FLG ^= (flag)) +#define SET_FLAG(flag) (M.x86.R_FLG |= (flag)) +#define CLEAR_FLAG(flag) (M.x86.R_FLG &= ~(flag)) +#define ACCESS_FLAG(flag) (M.x86.R_FLG & (flag)) +#define CLEARALL_FLAG(m) (M.x86.R_FLG = 0) + +#define CONDITIONAL_SET_FLAG(COND,FLAG) \ + if (COND) SET_FLAG(FLAG); else CLEAR_FLAG(FLAG) + +#define F_PF_CALC 0x010000 /* PARITY flag has been calced */ +#define F_ZF_CALC 0x020000 /* ZERO flag has been calced */ +#define F_SF_CALC 0x040000 /* SIGN flag has been calced */ + +#define F_ALL_CALC 0xff0000 /* All have been calced */ + +/* + * Emulator machine state. + * Segment usage control. + */ +#define SYSMODE_SEG_DS_SS 0x00000001 +#define SYSMODE_SEGOVR_CS 0x00000002 +#define SYSMODE_SEGOVR_DS 0x00000004 +#define SYSMODE_SEGOVR_ES 0x00000008 +#define SYSMODE_SEGOVR_FS 0x00000010 +#define SYSMODE_SEGOVR_GS 0x00000020 +#define SYSMODE_SEGOVR_SS 0x00000040 +#define SYSMODE_PREFIX_REPE 0x00000080 +#define SYSMODE_PREFIX_REPNE 0x00000100 +#define SYSMODE_PREFIX_DATA 0x00000200 +#define SYSMODE_PREFIX_ADDR 0x00000400 +#define SYSMODE_INTR_PENDING 0x10000000 +#define SYSMODE_EXTRN_INTR 0x20000000 +#define SYSMODE_HALTED 0x40000000 + +#define SYSMODE_SEGMASK (SYSMODE_SEG_DS_SS | \ + SYSMODE_SEGOVR_CS | \ + SYSMODE_SEGOVR_DS | \ + SYSMODE_SEGOVR_ES | \ + SYSMODE_SEGOVR_FS | \ + SYSMODE_SEGOVR_GS | \ + SYSMODE_SEGOVR_SS) +#define SYSMODE_CLRMASK (SYSMODE_SEG_DS_SS | \ + SYSMODE_SEGOVR_CS | \ + SYSMODE_SEGOVR_DS | \ + SYSMODE_SEGOVR_ES | \ + SYSMODE_SEGOVR_FS | \ + SYSMODE_SEGOVR_GS | \ + SYSMODE_SEGOVR_SS | \ + SYSMODE_PREFIX_DATA | \ + SYSMODE_PREFIX_ADDR) + +#define INTR_SYNCH 0x1 +#define INTR_ASYNCH 0x2 +#define INTR_HALTED 0x4 + +typedef struct { + struct i386_general_regs gen; + struct i386_special_regs spc; + struct i386_segment_regs seg; + /* + * MODE contains information on: + * REPE prefix 2 bits repe,repne + * SEGMENT overrides 5 bits normal,DS,SS,CS,ES + * Delayed flag set 3 bits (zero, signed, parity) + * reserved 6 bits + * interrupt # 8 bits instruction raised interrupt + * BIOS video segregs 4 bits + * Interrupt Pending 1 bits + * Extern interrupt 1 bits + * Halted 1 bits + */ + long mode; + u8 intno; + volatile int intr; /* mask of pending interrupts */ + int debug; +#ifdef DEBUG + int check; + u16 saved_ip; + u16 saved_cs; + int enc_pos; + int enc_str_pos; + char decode_buf[32]; /* encoded byte stream */ + char decoded_buf[256]; /* disassembled strings */ +#endif + } X86EMU_regs; + +/**************************************************************************** +REMARKS: +Structure maintaining the emulator machine state. + +MEMBERS: +x86 - X86 registers +mem_base - Base real mode memory for the emulator +mem_size - Size of the real mode memory block for the emulator +****************************************************************************/ +typedef struct { + X86EMU_regs x86; + unsigned long mem_base; + unsigned long mem_size; + void* private; + } X86EMU_sysEnv; + +#ifndef __mips +#pragma pack() +#endif + +/*----------------------------- Global Variables --------------------------*/ + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +/* Global emulator machine state. + * + * We keep it global to avoid pointer dereferences in the code for speed. + */ + +extern X86EMU_sysEnv _X86EMU_env; +#define M _X86EMU_env + +/*-------------------------- Function Prototypes --------------------------*/ + +/* Function to log information at runtime */ + +#ifdef _CFE_ +#include "lib_printf.h" +#define printk xprintf +#define sprintf xsprintf +#else +void printk(const char *fmt, ...); +#endif + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif + +#endif /* __X86EMU_REGS_H */ diff --git a/cfe/cfe/x86emu/x86emu/types.h b/cfe/cfe/x86emu/x86emu/types.h new file mode 100644 index 0000000..f3d3783 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/types.h @@ -0,0 +1,89 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for x86 emulator type definitions. +* +****************************************************************************/ + +/* $XFree86: xc/extras/x86emu/include/x86emu/types.h,v 1.4 2000/09/26 15:56:44 tsi Exp $ */ + +#ifndef __X86EMU_TYPES_H +#define __X86EMU_TYPES_H + +#ifndef IN_MODULE +//#include +#endif + +/* + * The following kludge is an attempt to work around typedef conflicts with + * . + */ +#define u8 x86emuu8 +#define u16 x86emuu16 +#define u32 x86emuu32 +#define u64 x86emuu64 +#define s8 x86emus8 +#define s16 x86emus16 +#define s32 x86emus32 +#define s64 x86emus64 +#define uint x86emuuint +#define sint x86emusint + +/*---------------------- Macros and type definitions ----------------------*/ + +/* Currently only for Linux/32bit */ +#if defined(__GNUC__) && !defined(NO_LONG_LONG) +#define __HAS_LONG_LONG__ +#endif + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +#ifdef __HAS_LONG_LONG__ +typedef unsigned long long u64; +#endif + +typedef char s8; +typedef short s16; +typedef int s32; +#ifdef __HAS_LONG_LONG__ +typedef long long s64; +#endif + +typedef unsigned int uint; +typedef int sint; + +typedef u16 X86EMU_pioAddr; + +#endif /* __X86EMU_TYPES_H */ diff --git a/cfe/cfe/x86emu/x86emu/x86emui.h b/cfe/cfe/x86emu/x86emu/x86emui.h new file mode 100644 index 0000000..594b344 --- /dev/null +++ b/cfe/cfe/x86emu/x86emu/x86emui.h @@ -0,0 +1,109 @@ +/**************************************************************************** +* +* Realmode X86 Emulator Library +* +* Copyright (C) 1996-1999 SciTech Software, Inc. +* Copyright (C) David Mosberger-Tang +* Copyright (C) 1999 Egbert Eich +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: ANSI C +* Environment: Any +* Developer: Kendall Bennett +* +* Description: Header file for system specific functions. These functions +* are always compiled and linked in the OS depedent libraries, +* and never in a binary portable driver. +* +****************************************************************************/ + +/* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/x86emui.h,v 1.3 2000/04/17 16:29:47 eich Exp $ */ + +#ifndef __X86EMU_X86EMUI_H +#define __X86EMU_X86EMUI_H + +/* If we are compiling in C++ mode, we can compile some functions as + * inline to increase performance (however the code size increases quite + * dramatically in this case). + */ + +#if defined(__cplusplus) && !defined(_NO_INLINE) +#define _INLINE inline +#else +#define _INLINE static +#endif + +/* Get rid of unused parameters in C++ compilation mode */ + +#ifdef __cplusplus +#define X86EMU_UNUSED(v) +#else +#define X86EMU_UNUSED(v) v +#endif + +#include "x86emu.h" +#include "x86emu/regs.h" +#include "x86emu/debug.h" +#include "x86emu/decode.h" +#include "x86emu/ops.h" +#include "x86emu/prim_ops.h" +#include "x86emu/fpu.h" +#include "x86emu/fpu_regs.h" + +#ifdef IN_MODULE +#include +#else +#ifdef _CFE_ +#include "lib_types.h" +#include "lib_string.h" +#else +#include +#include +#endif +#endif +/*--------------------------- Inline Functions ----------------------------*/ + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +extern u8 (X86APIP sys_rdb)(u32 addr); +extern u16 (X86APIP sys_rdw)(u32 addr); +extern u32 (X86APIP sys_rdl)(u32 addr); +extern void (X86APIP sys_wrb)(u32 addr,u8 val); +extern void (X86APIP sys_wrw)(u32 addr,u16 val); +extern void (X86APIP sys_wrl)(u32 addr,u32 val); + +extern u8 (X86APIP sys_inb)(X86EMU_pioAddr addr); +extern u16 (X86APIP sys_inw)(X86EMU_pioAddr addr); +extern u32 (X86APIP sys_inl)(X86EMU_pioAddr addr); +extern void (X86APIP sys_outb)(X86EMU_pioAddr addr,u8 val); +extern void (X86APIP sys_outw)(X86EMU_pioAddr addr,u16 val); +extern void (X86APIP sys_outl)(X86EMU_pioAddr addr,u32 val); + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif + +#endif /* __X86EMU_X86EMUI_H */ diff --git a/cfe/cfe/zlib/ChangeLog b/cfe/cfe/zlib/ChangeLog new file mode 100644 index 0000000..567a500 --- /dev/null +++ b/cfe/cfe/zlib/ChangeLog @@ -0,0 +1,471 @@ + + ChangeLog file for zlib + +Changes in 1.1.3 (9 July 1998) +- fix "an inflate input buffer bug that shows up on rare but persistent + occasions" (Mark) +- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) +- fix gzseek(..., SEEK_SET) in write mode +- fix crc check after a gzeek (Frank Faubert) +- fix miniunzip when the last entry in a zip file is itself a zip file + (J Lillge) +- add contrib/asm586 and contrib/asm686 (Brian Raiter) + See http://www.muppetlabs.com/~breadbox/software/assembly.html +- add support for Delphi 3 in contrib/delphi (Bob Dellaca) +- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) +- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) +- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) +- added a FAQ file + +- Support gzdopen on Mac with Metrowerks (Jason Linhart) +- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) +- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) +- avoid some warnings with Borland C (Tom Tanner) +- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) +- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) +- allow several arguments to configure (Tim Mooney, Frodo Looijaard) +- use libdir and includedir in Makefile.in (Tim Mooney) +- support shared libraries on OSF1 V4 (Tim Mooney) +- remove so_locations in "make clean" (Tim Mooney) +- fix maketree.c compilation error (Glenn, Mark) +- Python interface to zlib now in Python 1.5 (Jeremy Hylton) +- new Makefile.riscos (Rich Walker) +- initialize static descriptors in trees.c for embedded targets (Nick Smith) +- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) +- add the OS/2 files in Makefile.in too (Andrew Zabolotny) +- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) +- fix maketree.c to allow clean compilation of inffixed.h (Mark) +- fix parameter check in deflateCopy (Gunther Nikl) +- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) +- Many portability patches by Christian Spieler: + . zutil.c, zutil.h: added "const" for zmem* + . Make_vms.com: fixed some typos + . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists + . msdos/Makefile.msc: remove "default rtl link library" info from obj files + . msdos/Makefile.*: use model-dependent name for the built zlib library + . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: + new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) +- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) +- replace __far with _far for better portability (Christian Spieler, Tom Lane) +- fix test for errno.h in configure (Tim Newsham) + +Changes in 1.1.2 (19 March 98) +- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) + See http://www.winimage.com/zLibDll/unzip.html +- preinitialize the inflate tables for fixed codes, to make the code + completely thread safe (Mark) +- some simplifications and slight speed-up to the inflate code (Mark) +- fix gzeof on non-compressed files (Allan Schrum) +- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) +- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) +- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) +- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) +- do not wrap extern "C" around system includes (Tom Lane) +- mention zlib binding for TCL in README (Andreas Kupries) +- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) +- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) +- allow "configure --prefix $HOME" (Tim Mooney) +- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) +- move Makefile.sas to amiga/Makefile.sas + +Changes in 1.1.1 (27 Feb 98) +- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) +- remove block truncation heuristic which had very marginal effect for zlib + (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the + compression ratio on some files. This also allows inlining _tr_tally for + matches in deflate_slow. +- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) + +Changes in 1.1.0 (24 Feb 98) +- do not return STREAM_END prematurely in inflate (John Bowler) +- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) +- compile with -DFASTEST to get compression code optimized for speed only +- in minigzip, try mmap'ing the input file first (Miguel Albrecht) +- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain + on Sun but significant on HP) + +- add a pointer to experimental unzip library in README (Gilles Vollant) +- initialize variable gcc in configure (Chris Herborth) + +Changes in 1.0.9 (17 Feb 1998) +- added gzputs and gzgets functions +- do not clear eof flag in gzseek (Mark Diekhans) +- fix gzseek for files in transparent mode (Mark Diekhans) +- do not assume that vsprintf returns the number of bytes written (Jens Krinke) +- replace EXPORT with ZEXPORT to avoid conflict with other programs +- added compress2 in zconf.h, zlib.def, zlib.dnt +- new asm code from Gilles Vollant in contrib/asm386 +- simplify the inflate code (Mark): + . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() + . ZALLOC the length list in inflate_trees_fixed() instead of using stack + . ZALLOC the value area for huft_build() instead of using stack + . Simplify Z_FINISH check in inflate() + +- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 +- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) +- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with + the declaration of FAR (Gilles VOllant) +- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) +- read_buf buf parameter of type Bytef* instead of charf* +- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) +- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) +- fix check for presence of directories in "make install" (Ian Willis) + +Changes in 1.0.8 (27 Jan 1998) +- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) +- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) +- added compress2() to allow setting the compression level +- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) +- use constant arrays for the static trees in trees.c instead of computing + them at run time (thanks to Ken Raeburn for this suggestion). To create + trees.h, compile with GEN_TREES_H and run "make test". +- check return code of example in "make test" and display result +- pass minigzip command line options to file_compress +- simplifying code of inflateSync to avoid gcc 2.8 bug + +- support CC="gcc -Wall" in configure -s (QingLong) +- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) +- fix test for shared library support to avoid compiler warnings +- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) +- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) +- do not use fdopen for Metrowerks on Mac (Brad Pettit)) +- add checks for gzputc and gzputc in example.c +- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) +- use const for the CRC table (Ken Raeburn) +- fixed "make uninstall" for shared libraries +- use Tracev instead of Trace in infblock.c +- in example.c use correct compressed length for test_sync +- suppress +vnocompatwarnings in configure for HPUX (not always supported) + +Changes in 1.0.7 (20 Jan 1998) +- fix gzseek which was broken in write mode +- return error for gzseek to negative absolute position +- fix configure for Linux (Chun-Chung Chen) +- increase stack space for MSC (Tim Wegner) +- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) +- define EXPORTVA for gzprintf (Gilles Vollant) +- added man page zlib.3 (Rick Rodgers) +- for contrib/untgz, fix makedir() and improve Makefile + +- check gzseek in write mode in example.c +- allocate extra buffer for seeks only if gzseek is actually called +- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) +- add inflateSyncPoint in zconf.h +- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def + +Changes in 1.0.6 (19 Jan 1998) +- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and + gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) +- Fix a deflate bug occuring only with compression level 0 (thanks to + Andy Buckler for finding this one). +- In minigzip, pass transparently also the first byte for .Z files. +- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() +- check Z_FINISH in inflate (thanks to Marc Schluper) +- Implement deflateCopy (thanks to Adam Costello) +- make static libraries by default in configure, add --shared option. +- move MSDOS or Windows specific files to directory msdos +- suppress the notion of partial flush to simplify the interface + (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) +- suppress history buffer provided by application to simplify the interface + (this feature was not implemented anyway in 1.0.4) +- next_in and avail_in must be initialized before calling inflateInit or + inflateInit2 +- add EXPORT in all exported functions (for Windows DLL) +- added Makefile.nt (thanks to Stephen Williams) +- added the unsupported "contrib" directory: + contrib/asm386/ by Gilles Vollant + 386 asm code replacing longest_match(). + contrib/iostream/ by Kevin Ruland + A C++ I/O streams interface to the zlib gz* functions + contrib/iostream2/ by Tyge Løvset + Another C++ I/O streams interface + contrib/untgz/ by "Pedro A. Aranda Guti\irrez" + A very simple tar.gz file extractor using zlib + contrib/visual-basic.txt by Carlos Rios + How to use compress(), uncompress() and the gz* functions from VB. +- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression + level) in minigzip (thanks to Tom Lane) + +- use const for rommable constants in deflate +- added test for gzseek and gztell in example.c +- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) +- add undocumented function zError to convert error code to string + (for Tim Smithers) +- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. +- Use default memcpy for Symantec MSDOS compiler. +- Add EXPORT keyword for check_func (needed for Windows DLL) +- add current directory to LD_LIBRARY_PATH for "make test" +- create also a link for libz.so.1 +- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) +- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) +- added -soname for Linux in configure (Chun-Chung Chen, +- assign numbers to the exported functions in zlib.def (for Windows DLL) +- add advice in zlib.h for best usage of deflateSetDictionary +- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) +- allow compilation with ANSI keywords only enabled for TurboC in large model +- avoid "versionString"[0] (Borland bug) +- add NEED_DUMMY_RETURN for Borland +- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). +- allow compilation with CC +- defined STDC for OS/2 (David Charlap) +- limit external names to 8 chars for MVS (Thomas Lund) +- in minigzip.c, use static buffers only for 16-bit systems +- fix suffix check for "minigzip -d foo.gz" +- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) +- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) +- added makelcc.bat for lcc-win32 (Tom St Denis) +- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) +- Avoid expanded $Id: ChangeLog,v 1.1 2001/11/09 01:48:01 mpl Exp $. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. +- check for unistd.h in configure (for off_t) +- remove useless check parameter in inflate_blocks_free +- avoid useless assignment of s->check to itself in inflate_blocks_new +- do not flush twice in gzclose (thanks to Ken Raeburn) +- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h +- use NO_ERRNO_H instead of enumeration of operating systems with errno.h +- work around buggy fclose on pipes for HP/UX +- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) +- fix configure if CC is already equal to gcc + +Changes in 1.0.5 (3 Jan 98) +- Fix inflate to terminate gracefully when fed corrupted or invalid data +- Use const for rommable constants in inflate +- Eliminate memory leaks on error conditions in inflate +- Removed some vestigial code in inflate +- Update web address in README + +Changes in 1.0.4 (24 Jul 96) +- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF + bit, so the decompressor could decompress all the correct data but went + on to attempt decompressing extra garbage data. This affected minigzip too. +- zlibVersion and gzerror return const char* (needed for DLL) +- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) +- use z_error only for DEBUG (avoid problem with DLLs) + +Changes in 1.0.3 (2 Jul 96) +- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS + small and medium models; this makes the library incompatible with previous + versions for these models. (No effect in large model or on other systems.) +- return OK instead of BUF_ERROR if previous deflate call returned with + avail_out as zero but there is nothing to do +- added memcmp for non STDC compilers +- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) +- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) +- better check for 16-bit mode MSC (avoids problem with Symantec) + +Changes in 1.0.2 (23 May 96) +- added Windows DLL support +- added a function zlibVersion (for the DLL support) +- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) +- Bytef is define's instead of typedef'd only for Borland C +- avoid reading uninitialized memory in example.c +- mention in README that the zlib format is now RFC1950 +- updated Makefile.dj2 +- added algorithm.doc + +Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] +- fix array overlay in deflate.c which sometimes caused bad compressed data +- fix inflate bug with empty stored block +- fix MSDOS medium model which was broken in 0.99 +- fix deflateParams() which could generated bad compressed data. +- Bytef is define'd instead of typedef'ed (work around Borland bug) +- added an INDEX file +- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), + Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) +- speed up adler32 for modern machines without auto-increment +- added -ansi for IRIX in configure +- static_init_done in trees.c is an int +- define unlink as delete for VMS +- fix configure for QNX +- add configure branch for SCO and HPUX +- avoid many warnings (unused variables, dead assignments, etc...) +- no fdopen for BeOS +- fix the Watcom fix for 32 bit mode (define FAR as empty) +- removed redefinition of Byte for MKWERKS +- work around an MWKERKS bug (incorrect merge of all .h files) + +Changes in 0.99 (27 Jan 96) +- allow preset dictionary shared between compressor and decompressor +- allow compression level 0 (no compression) +- add deflateParams in zlib.h: allow dynamic change of compression level + and compression strategy. +- test large buffers and deflateParams in example.c +- add optional "configure" to build zlib as a shared library +- suppress Makefile.qnx, use configure instead +- fixed deflate for 64-bit systems (detected on Cray) +- fixed inflate_blocks for 64-bit systems (detected on Alpha) +- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) +- always return Z_BUF_ERROR when deflate() has nothing to do +- deflateInit and inflateInit are now macros to allow version checking +- prefix all global functions and types with z_ with -DZ_PREFIX +- make falloc completely reentrant (inftrees.c) +- fixed very unlikely race condition in ct_static_init +- free in reverse order of allocation to help memory manager +- use zlib-1.0/* instead of zlib/* inside the tar.gz +- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith + -Wconversion -Wstrict-prototypes -Wmissing-prototypes" +- allow gzread on concatenated .gz files +- deflateEnd now returns Z_DATA_ERROR if it was premature +- deflate is finally (?) fully deterministic (no matches beyond end of input) +- Document Z_SYNC_FLUSH +- add uninstall in Makefile +- Check for __cpluplus in zlib.h +- Better test in ct_align for partial flush +- avoid harmless warnings for Borland C++ +- initialize hash_head in deflate.c +- avoid warning on fdopen (gzio.c) for HP cc -Aa +- include stdlib.h for STDC compilers +- include errno.h for Cray +- ignore error if ranlib doesn't exist +- call ranlib twice for NeXTSTEP +- use exec_prefix instead of prefix for libz.a +- renamed ct_* as _tr_* to avoid conflict with applications +- clear z->msg in inflateInit2 before any error return +- initialize opaque in example.c, gzio.c, deflate.c and inflate.c +- fixed typo in zconf.h (_GNUC__ => __GNUC__) +- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) +- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) +- in fcalloc, normalize pointer if size > 65520 bytes +- don't use special fcalloc for 32 bit Borland C++ +- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... +- use Z_BINARY instead of BINARY +- document that gzclose after gzdopen will close the file +- allow "a" as mode in gzopen. +- fix error checking in gzread +- allow skipping .gz extra-field on pipes +- added reference to Perl interface in README +- put the crc table in FAR data (I dislike more and more the medium model :) +- added get_crc_table +- added a dimension to all arrays (Borland C can't count). +- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast +- guard against multiple inclusion of *.h (for precompiled header on Mac) +- Watcom C pretends to be Microsoft C small model even in 32 bit mode. +- don't use unsized arrays to avoid silly warnings by Visual C++: + warning C4746: 'inflate_mask' : unsized array treated as '__far' + (what's wrong with far data in far model?). +- define enum out of inflate_blocks_state to allow compilation with C++ + +Changes in 0.95 (16 Aug 95) +- fix MSDOS small and medium model (now easier to adapt to any compiler) +- inlined send_bits +- fix the final (:-) bug for deflate with flush (output was correct but + not completely flushed in rare occasions). +- default window size is same for compression and decompression + (it's now sufficient to set MAX_WBITS in zconf.h). +- voidp -> voidpf and voidnp -> voidp (for consistency with other + typedefs and because voidnp was not near in large model). + +Changes in 0.94 (13 Aug 95) +- support MSDOS medium model +- fix deflate with flush (could sometimes generate bad output) +- fix deflateReset (zlib header was incorrectly suppressed) +- added support for VMS +- allow a compression level in gzopen() +- gzflush now calls fflush +- For deflate with flush, flush even if no more input is provided. +- rename libgz.a as libz.a +- avoid complex expression in infcodes.c triggering Turbo C bug +- work around a problem with gcc on Alpha (in INSERT_STRING) +- don't use inline functions (problem with some gcc versions) +- allow renaming of Byte, uInt, etc... with #define. +- avoid warning about (unused) pointer before start of array in deflate.c +- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c +- avoid reserved word 'new' in trees.c + +Changes in 0.93 (25 June 95) +- temporarily disable inline functions +- make deflate deterministic +- give enough lookahead for PARTIAL_FLUSH +- Set binary mode for stdin/stdout in minigzip.c for OS/2 +- don't even use signed char in inflate (not portable enough) +- fix inflate memory leak for segmented architectures + +Changes in 0.92 (3 May 95) +- don't assume that char is signed (problem on SGI) +- Clear bit buffer when starting a stored block +- no memcpy on Pyramid +- suppressed inftest.c +- optimized fill_window, put longest_match inline for gcc +- optimized inflate on stored blocks. +- untabify all sources to simplify patches + +Changes in 0.91 (2 May 95) +- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h +- Document the memory requirements in zconf.h +- added "make install" +- fix sync search logic in inflateSync +- deflate(Z_FULL_FLUSH) now works even if output buffer too short +- after inflateSync, don't scare people with just "lo world" +- added support for DJGPP + +Changes in 0.9 (1 May 95) +- don't assume that zalloc clears the allocated memory (the TurboC bug + was Mark's bug after all :) +- let again gzread copy uncompressed data unchanged (was working in 0.71) +- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented +- added a test of inflateSync in example.c +- moved MAX_WBITS to zconf.h because users might want to change that. +- document explicitly that zalloc(64K) on MSDOS must return a normalized + pointer (zero offset) +- added Makefiles for Microsoft C, Turbo C, Borland C++ +- faster crc32() + +Changes in 0.8 (29 April 95) +- added fast inflate (inffast.c) +- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this + is incompatible with previous versions of zlib which returned Z_OK. +- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) + (actually that was not a compiler bug, see 0.81 above) +- gzread no longer reads one extra byte in certain cases +- In gzio destroy(), don't reference a freed structure +- avoid many warnings for MSDOS +- avoid the ERROR symbol which is used by MS Windows + +Changes in 0.71 (14 April 95) +- Fixed more MSDOS compilation problems :( There is still a bug with + TurboC large model. + +Changes in 0.7 (14 April 95) +- Added full inflate support. +- Simplified the crc32() interface. The pre- and post-conditioning + (one's complement) is now done inside crc32(). WARNING: this is + incompatible with previous versions; see zlib.h for the new usage. + +Changes in 0.61 (12 April 95) +- workaround for a bug in TurboC. example and minigzip now work on MSDOS. + +Changes in 0.6 (11 April 95) +- added minigzip.c +- added gzdopen to reopen a file descriptor as gzFile +- added transparent reading of non-gziped files in gzread. +- fixed bug in gzread (don't read crc as data) +- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). +- don't allocate big arrays in the stack (for MSDOS) +- fix some MSDOS compilation problems + +Changes in 0.5: +- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but + not yet Z_FULL_FLUSH. +- support decompression but only in a single step (forced Z_FINISH) +- added opaque object for zalloc and zfree. +- added deflateReset and inflateReset +- added a variable zlib_version for consistency checking. +- renamed the 'filter' parameter of deflateInit2 as 'strategy'. + Added Z_FILTERED and Z_HUFFMAN_ONLY constants. + +Changes in 0.4: +- avoid "zip" everywhere, use zlib instead of ziplib. +- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush + if compression method == 8. +- added adler32 and crc32 +- renamed deflateOptions as deflateInit2, call one or the other but not both +- added the method parameter for deflateInit2. +- added inflateInit2 +- simplied considerably deflateInit and inflateInit by not supporting + user-provided history buffer. This is supported only in deflateInit2 + and inflateInit2. + +Changes in 0.3: +- prefix all macro names with Z_ +- use Z_FINISH instead of deflateEnd to finish compression. +- added Z_HUFFMAN_ONLY +- added gzerror() diff --git a/cfe/cfe/zlib/FAQ b/cfe/cfe/zlib/FAQ new file mode 100644 index 0000000..0feb6d3 --- /dev/null +++ b/cfe/cfe/zlib/FAQ @@ -0,0 +1,72 @@ + + Frequently Asked Questions about zlib + + +If your question is not there, please check the zlib home page +http://www.cdrom.com/pub/infozip/zlib/ which may have more recent information. + + +1) I need a Windows DLL +2) I need a Visual Basic interface to zlib +3) compress() returns Z_BUF_ERROR +4) deflate or inflate returns Z_BUF_ERROR +5) Where is the zlib documentation (man pages, etc...)? +6) Why don't you use GNU autoconf, libtool, etc...? +7) There is a bug in zlib. +8) I get "undefined reference to gzputc" + + + +1) I need a Windows DLL + + The zlib sources can be compiled without change to produce a DLL. + If you want a precompiled DLL, see http://www.winimage.com/zLibDll + + +2) I need a Visual Basic interface to zlib + + See http://www.tcfb.com/dowseware/cmp-z-it.zip + http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm + and contrib/visual-basic.txt + +3) compress() returns Z_BUF_ERROR + + Make sure that before the call of compress, the length of the + compressed buffer is equal to the total size of the compressed buffer + and not zero. For Visual Basic, check that this parameter is passed + by reference ("as any"), not by value ("as long"). + + +4) deflate or inflate returns Z_BUF_ERROR + + Make sure that before the call avail_in and avail_out are not zero. + + +5) Where is the zlib documentation (man pages, etc...)? + + It's in zlib.h for the moment. Volunteers to transform this + to man pages, please contact jloup@gzip.org. Examples of zlib usage + are in the files example.c and minigzip.c. + + +6) Why don't you use GNU autoconf, libtool, etc...? + + Because we would like to keep zlib as a very small and simple package. + zlib is rather portable and doesn't need much configuration. + + +7) There is a bug in zlib. + + Most of the time, such problems are due to an incorrect usage + of zlib. Please try to reproduce the problem with a small + program and send us the corresponding source at zlib@quest.jpl.nasa.gov + Do not send multi-megabyte data files without prior agreement. + + +8) I get "undefined reference to gzputc" + + If "make test" produces something like + example.o(.text+0x174): + check that you don't have old files libz.* in /usr/lib, /usr/local/lib + or /usr/X11R6/lib. Remove old versions then do "make install". + diff --git a/cfe/cfe/zlib/INDEX b/cfe/cfe/zlib/INDEX new file mode 100644 index 0000000..8a24576 --- /dev/null +++ b/cfe/cfe/zlib/INDEX @@ -0,0 +1,86 @@ +ChangeLog history of changes +INDEX this file +FAQ Frequently Asked Questions about zlib +Make_vms.com script for Vax/VMS +Makefile makefile for Unix (generated by configure) +Makefile.in makefile for Unix (template for configure) +Makefile.riscos makefile for RISCOS +README guess what +algorithm.txt description of the (de)compression algorithm +configure configure script for Unix +descrip.mms makefile for Vax/VMS +zlib.3 mini man page for zlib (volunteers to write full + man pages from zlib.h welcome. write to jloup@gzip.org) + +amiga/Makefile.sas makefile for Amiga SAS/C +amiga/Makefile.pup makefile for Amiga powerUP SAS/C PPC + +msdos/Makefile.w32 makefile for Microsoft Visual C++ 32-bit +msdos/Makefile.b32 makefile for Borland C++ 32-bit +msdos/Makefile.bor makefile for Borland C/C++ 16-bit +msdos/Makefile.dj2 makefile for DJGPP 2.x +msdos/Makefile.emx makefile for EMX 0.9c (32-bit DOS/OS2) +msdos/Makefile.msc makefile for Microsoft C 16-bit +msdos/Makefile.tc makefile for Turbo C +msdos/Makefile.wat makefile for Watcom C +msdos/zlib.def definition file for Windows DLL +msdos/zlib.rc definition file for Windows DLL + +nt/Makefile.nt makefile for Windows NT +nt/zlib.dnt definition file for Windows NT DLL +nt/Makefile.emx makefile for EMX 0.9c/RSXNT 1.41 (Win32 Intel) +nt/Makefile.gcc makefile for Windows NT using GCC (mingw32) + + + zlib public header files (must be kept): +zconf.h +zlib.h + + private source files used to build the zlib library: +adler32.c +compress.c +crc32.c +deflate.c +deflate.h +gzio.c +infblock.c +infblock.h +infcodes.c +infcodes.h +inffast.c +inffast.h +inflate.c +inftrees.c +inftrees.h +infutil.c +infutil.h +maketree.c +trees.c +uncompr.c +zutil.c +zutil.h + + source files for sample programs: +example.c +minigzip.c + + unsupported contribution by third parties + +contrib/asm386/ by Gilles Vollant + 386 asm code replacing longest_match(). + +contrib/minizip/ by Gilles Vollant + Mini zip and unzip based on zlib + See http://www.winimage.com/zLibDll/unzip.html + +contrib/iostream/ by Kevin Ruland + A C++ I/O streams interface to the zlib gz* functions + +contrib/iostream2/ by Tyge Løvset + Another C++ I/O streams interface + +contrib/untgz/ by "Pedro A. Aranda Guti\irrez" + A very simple tar.gz extractor using zlib + +contrib/visual-basic.txt by Carlos Rios + How to use compress(), uncompress() and the gz* functions from VB. diff --git a/cfe/cfe/zlib/Make_vms.com b/cfe/cfe/zlib/Make_vms.com new file mode 100644 index 0000000..1c57e8f --- /dev/null +++ b/cfe/cfe/zlib/Make_vms.com @@ -0,0 +1,115 @@ +$! make libz under VMS +$! written by Martin P.J. Zinser +$! +$! Look for the compiler used +$! +$ ccopt = "" +$ if f$getsyi("HW_MODEL").ge.1024 +$ then +$ ccopt = "/prefix=all"+ccopt +$ comp = "__decc__=1" +$ if f$trnlnm("SYS").eqs."" then define sys sys$library: +$ else +$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs."" +$ then +$ comp = "__vaxc__=1" +$ if f$trnlnm("SYS").eqs."" then define sys sys$library: +$ else +$ if f$trnlnm("SYS").eqs."" then define sys decc$library_include: +$ ccopt = "/decc/prefix=all"+ccopt +$ comp = "__decc__=1" +$ endif +$ endif +$! +$! Build the thing plain or with mms +$! +$ write sys$output "Compiling Zlib sources ..." +$ if f$search("SYS$SYSTEM:MMS.EXE").eqs."" +$ then +$ dele example.obj;*,minigzip.obj;* +$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - + adler32.c zlib.h zconf.h +$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - + compress.c zlib.h zconf.h +$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - + crc32.c zlib.h zconf.h +$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - + deflate.c deflate.h zutil.h zlib.h zconf.h +$ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" - + gzio.c zutil.h zlib.h zconf.h +$ CALL MAKE infblock.OBJ "CC ''CCOPT' infblock" - + infblock.c zutil.h zlib.h zconf.h infblock.h +$ CALL MAKE infcodes.OBJ "CC ''CCOPT' infcodes" - + infcodes.c zutil.h zlib.h zconf.h inftrees.h +$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" - + inffast.c zutil.h zlib.h zconf.h inffast.h +$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" - + inflate.c zutil.h zlib.h zconf.h infblock.h +$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" - + inftrees.c zutil.h zlib.h zconf.h inftrees.h +$ CALL MAKE infutil.OBJ "CC ''CCOPT' infutil" - + infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h +$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" - + trees.c deflate.h zutil.h zlib.h zconf.h +$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" - + uncompr.c zlib.h zconf.h +$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" - + zutil.c zutil.h zlib.h zconf.h +$ write sys$output "Building Zlib ..." +$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ +$ write sys$output "Building example..." +$ CALL MAKE example.OBJ "CC ''CCOPT' example" - + example.c zlib.h zconf.h +$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb +$ write sys$output "Building minigzip..." +$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" - + minigzip.c zlib.h zconf.h +$ call make minigzip.exe - + "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" - + minigzip.obj libz.olb +$ else +$ mms/macro=('comp') +$ endif +$ write sys$output "Zlib build completed" +$ exit +$! +$! +$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES +$ V = 'F$Verify(0) +$! P1 = What we are trying to make +$! P2 = Command to make it +$! P3 - P8 What it depends on +$ +$ If F$Search(P1) .Eqs. "" Then Goto Makeit +$ Time = F$CvTime(F$File(P1,"RDT")) +$arg=3 +$Loop: +$ Argument = P'arg +$ If Argument .Eqs. "" Then Goto Exit +$ El=0 +$Loop2: +$ File = F$Element(El," ",Argument) +$ If File .Eqs. " " Then Goto Endl +$ AFile = "" +$Loop3: +$ OFile = AFile +$ AFile = F$Search(File) +$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl +$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit +$ Goto Loop3 +$NextEL: +$ El = El + 1 +$ Goto Loop2 +$EndL: +$ arg=arg+1 +$ If arg .Le. 8 Then Goto Loop +$ Goto Exit +$ +$Makeit: +$ VV=F$VERIFY(0) +$ write sys$output P2 +$ 'P2 +$ VV='F$Verify(VV) +$Exit: +$ If V Then Set Verify +$ENDSUBROUTINE diff --git a/cfe/cfe/zlib/Makefile b/cfe/cfe/zlib/Makefile new file mode 100644 index 0000000..e9224bb --- /dev/null +++ b/cfe/cfe/zlib/Makefile @@ -0,0 +1,28 @@ + +#ALLOBJS += adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ +# zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o + +#ALLOBJS += adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ +# zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o + +ALLOBJS += adler32.o uncompr.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o zutil.o +CFLAGS += -DCFG_ZLIB=1 -DMY_ZCALLOC -DNO_MEMCPY + +adler32.o: zlib.h zconf.h +compress.o: zlib.h zconf.h +crc32.o: zlib.h zconf.h +deflate.o: deflate.h zutil.h zlib.h zconf.h +example.o: zlib.h zconf.h +gzio.o: zutil.h zlib.h zconf.h +infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h +infcodes.o: zutil.h zlib.h zconf.h +infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h +inffast.o: zutil.h zlib.h zconf.h inftrees.h +inffast.o: infblock.h infcodes.h infutil.h inffast.h +inflate.o: zutil.h zlib.h zconf.h infblock.h +inftrees.o: zutil.h zlib.h zconf.h inftrees.h +infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h +minigzip.o: zlib.h zconf.h +trees.o: deflate.h zutil.h zlib.h zconf.h trees.h +uncompr.o: zlib.h zconf.h +zutil.o: zutil.h zlib.h zconf.h diff --git a/cfe/cfe/zlib/Makefile.in b/cfe/cfe/zlib/Makefile.in new file mode 100644 index 0000000..3a3b116 --- /dev/null +++ b/cfe/cfe/zlib/Makefile.in @@ -0,0 +1,174 @@ +# Makefile for zlib +# Copyright (C) 1995-1998 Jean-loup Gailly. +# For conditions of distribution and use, see copyright notice in zlib.h + +# To compile and test, type: +# ./configure; make test +# The call of configure is optional if you don't have special requirements +# If you wish to build zlib as a shared library, use: ./configure -s + +# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: +# make install +# To install in $HOME instead of /usr/local, use: +# make install prefix=$HOME + +CC=cc + +CFLAGS=-O +#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 +#CFLAGS=-g -DDEBUG +#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ +# -Wstrict-prototypes -Wmissing-prototypes + +LDFLAGS=-L. -lz +LDSHARED=$(CC) +CPP=$(CC) -E + +VER=1.1.3 +LIBS=libz.a +SHAREDLIB=libz.so + +AR=ar rc +RANLIB=ranlib +TAR=tar +SHELL=/bin/sh + +prefix = /usr/local +exec_prefix = ${prefix} +libdir = ${exec_prefix}/lib +includedir = ${prefix}/include + +OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ + zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o + +OBJA = +# to use the asm code: make OBJA=match.o + +TEST_OBJS = example.o minigzip.o + +DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \ + algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ + nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \ + contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \ + contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \ + contrib/asm[56]86/*.S contrib/iostream/*.cpp \ + contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ + contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \ + contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \ + contrib/delphi*/*.??? + +all: example minigzip + +test: all + @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ + echo hello world | ./minigzip | ./minigzip -d || \ + echo ' *** minigzip test FAILED ***' ; \ + if ./example; then \ + echo ' *** zlib test OK ***'; \ + else \ + echo ' *** zlib test FAILED ***'; \ + fi + +libz.a: $(OBJS) $(OBJA) + $(AR) $@ $(OBJS) $(OBJA) + -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 + +match.o: match.S + $(CPP) match.S > _match.s + $(CC) -c _match.s + mv _match.o match.o + rm -f _match.s + +$(SHAREDLIB).$(VER): $(OBJS) + $(LDSHARED) -o $@ $(OBJS) + rm -f $(SHAREDLIB) $(SHAREDLIB).1 + ln -s $@ $(SHAREDLIB) + ln -s $@ $(SHAREDLIB).1 + +example: example.o $(LIBS) + $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) + +minigzip: minigzip.o $(LIBS) + $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) + +install: $(LIBS) + -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi + -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi + cp zlib.h zconf.h $(includedir) + chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h + cp $(LIBS) $(libdir) + cd $(libdir); chmod 755 $(LIBS) + -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 + cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \ + rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ + ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \ + ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \ + (ldconfig || true) >/dev/null 2>&1; \ + fi +# The ranlib in install is needed on NeXTSTEP which checks file times +# ldconfig is for Linux + +uninstall: + cd $(includedir); \ + v=$(VER); \ + if test -f zlib.h; then \ + v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \ + rm -f zlib.h zconf.h; \ + fi; \ + cd $(libdir); rm -f libz.a; \ + if test -f $(SHAREDLIB).$$v; then \ + rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ + fi + +clean: + rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \ + _match.s maketree + +distclean: clean + +zip: + mv Makefile Makefile~; cp -p Makefile.in Makefile + rm -f test.c ztest*.c contrib/minizip/test.zip + v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ + zip -ul9 zlib$$v $(DISTFILES) + mv Makefile~ Makefile + +dist: + mv Makefile Makefile~; cp -p Makefile.in Makefile + rm -f test.c ztest*.c contrib/minizip/test.zip + d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ + rm -f $$d.tar.gz; \ + if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ + files=""; \ + for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \ + cd ..; \ + GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \ + if test ! -d $$d; then rm -f $$d; fi + mv Makefile~ Makefile + +tags: + etags *.[ch] + +depend: + makedepend -- $(CFLAGS) -- *.[ch] + +# DO NOT DELETE THIS LINE -- make depend depends on it. + +adler32.o: zlib.h zconf.h +compress.o: zlib.h zconf.h +crc32.o: zlib.h zconf.h +deflate.o: deflate.h zutil.h zlib.h zconf.h +example.o: zlib.h zconf.h +gzio.o: zutil.h zlib.h zconf.h +infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h +infcodes.o: zutil.h zlib.h zconf.h +infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h +inffast.o: zutil.h zlib.h zconf.h inftrees.h +inffast.o: infblock.h infcodes.h infutil.h inffast.h +inflate.o: zutil.h zlib.h zconf.h infblock.h +inftrees.o: zutil.h zlib.h zconf.h inftrees.h +infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h +minigzip.o: zlib.h zconf.h +trees.o: deflate.h zutil.h zlib.h zconf.h trees.h +uncompr.o: zlib.h zconf.h +zutil.o: zutil.h zlib.h zconf.h diff --git a/cfe/cfe/zlib/Makefile.orig b/cfe/cfe/zlib/Makefile.orig new file mode 100644 index 0000000..3a3b116 --- /dev/null +++ b/cfe/cfe/zlib/Makefile.orig @@ -0,0 +1,174 @@ +# Makefile for zlib +# Copyright (C) 1995-1998 Jean-loup Gailly. +# For conditions of distribution and use, see copyright notice in zlib.h + +# To compile and test, type: +# ./configure; make test +# The call of configure is optional if you don't have special requirements +# If you wish to build zlib as a shared library, use: ./configure -s + +# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: +# make install +# To install in $HOME instead of /usr/local, use: +# make install prefix=$HOME + +CC=cc + +CFLAGS=-O +#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 +#CFLAGS=-g -DDEBUG +#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ +# -Wstrict-prototypes -Wmissing-prototypes + +LDFLAGS=-L. -lz +LDSHARED=$(CC) +CPP=$(CC) -E + +VER=1.1.3 +LIBS=libz.a +SHAREDLIB=libz.so + +AR=ar rc +RANLIB=ranlib +TAR=tar +SHELL=/bin/sh + +prefix = /usr/local +exec_prefix = ${prefix} +libdir = ${exec_prefix}/lib +includedir = ${prefix}/include + +OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ + zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o + +OBJA = +# to use the asm code: make OBJA=match.o + +TEST_OBJS = example.o minigzip.o + +DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \ + algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ + nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \ + contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \ + contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \ + contrib/asm[56]86/*.S contrib/iostream/*.cpp \ + contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ + contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \ + contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \ + contrib/delphi*/*.??? + +all: example minigzip + +test: all + @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ + echo hello world | ./minigzip | ./minigzip -d || \ + echo ' *** minigzip test FAILED ***' ; \ + if ./example; then \ + echo ' *** zlib test OK ***'; \ + else \ + echo ' *** zlib test FAILED ***'; \ + fi + +libz.a: $(OBJS) $(OBJA) + $(AR) $@ $(OBJS) $(OBJA) + -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 + +match.o: match.S + $(CPP) match.S > _match.s + $(CC) -c _match.s + mv _match.o match.o + rm -f _match.s + +$(SHAREDLIB).$(VER): $(OBJS) + $(LDSHARED) -o $@ $(OBJS) + rm -f $(SHAREDLIB) $(SHAREDLIB).1 + ln -s $@ $(SHAREDLIB) + ln -s $@ $(SHAREDLIB).1 + +example: example.o $(LIBS) + $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) + +minigzip: minigzip.o $(LIBS) + $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) + +install: $(LIBS) + -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi + -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi + cp zlib.h zconf.h $(includedir) + chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h + cp $(LIBS) $(libdir) + cd $(libdir); chmod 755 $(LIBS) + -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 + cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \ + rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ + ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \ + ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \ + (ldconfig || true) >/dev/null 2>&1; \ + fi +# The ranlib in install is needed on NeXTSTEP which checks file times +# ldconfig is for Linux + +uninstall: + cd $(includedir); \ + v=$(VER); \ + if test -f zlib.h; then \ + v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \ + rm -f zlib.h zconf.h; \ + fi; \ + cd $(libdir); rm -f libz.a; \ + if test -f $(SHAREDLIB).$$v; then \ + rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ + fi + +clean: + rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \ + _match.s maketree + +distclean: clean + +zip: + mv Makefile Makefile~; cp -p Makefile.in Makefile + rm -f test.c ztest*.c contrib/minizip/test.zip + v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ + zip -ul9 zlib$$v $(DISTFILES) + mv Makefile~ Makefile + +dist: + mv Makefile Makefile~; cp -p Makefile.in Makefile + rm -f test.c ztest*.c contrib/minizip/test.zip + d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ + rm -f $$d.tar.gz; \ + if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ + files=""; \ + for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \ + cd ..; \ + GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \ + if test ! -d $$d; then rm -f $$d; fi + mv Makefile~ Makefile + +tags: + etags *.[ch] + +depend: + makedepend -- $(CFLAGS) -- *.[ch] + +# DO NOT DELETE THIS LINE -- make depend depends on it. + +adler32.o: zlib.h zconf.h +compress.o: zlib.h zconf.h +crc32.o: zlib.h zconf.h +deflate.o: deflate.h zutil.h zlib.h zconf.h +example.o: zlib.h zconf.h +gzio.o: zutil.h zlib.h zconf.h +infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h +infcodes.o: zutil.h zlib.h zconf.h +infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h +inffast.o: zutil.h zlib.h zconf.h inftrees.h +inffast.o: infblock.h infcodes.h infutil.h inffast.h +inflate.o: zutil.h zlib.h zconf.h infblock.h +inftrees.o: zutil.h zlib.h zconf.h inftrees.h +infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h +minigzip.o: zlib.h zconf.h +trees.o: deflate.h zutil.h zlib.h zconf.h trees.h +uncompr.o: zlib.h zconf.h +zutil.o: zutil.h zlib.h zconf.h diff --git a/cfe/cfe/zlib/Makefile.riscos b/cfe/cfe/zlib/Makefile.riscos new file mode 100644 index 0000000..d97f449 --- /dev/null +++ b/cfe/cfe/zlib/Makefile.riscos @@ -0,0 +1,151 @@ +# Project: zlib_1_03 +# Patched for zlib 1.1.2 rw@shadow.org.uk 19980430 +# test works out-of-the-box, installs `somewhere' on demand + +# Toolflags: +CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah +C++flags = -c -depend !Depend -IC: -throwback +Linkflags = -aif -c++ -o $@ +ObjAsmflags = -throwback -NoCache -depend !Depend +CMHGflags = +LibFileflags = -c -l -o $@ +Squeezeflags = -o $@ + +# change the line below to where _you_ want the library installed. +libdest = lib:zlib + +# Final targets: +@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \ + @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \ + @.o.uncompr @.o.zutil + LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \ + @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \ + @.o.trees @.o.uncompr @.o.zutil +test: @.minigzip @.example @.lib + @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV + @echo running tests: hang on. + @/@.minigzip -f -9 libc + @/@.minigzip -d libc-gz + @/@.minigzip -f -1 libc + @/@.minigzip -d libc-gz + @/@.minigzip -h -9 libc + @/@.minigzip -d libc-gz + @/@.minigzip -h -1 libc + @/@.minigzip -d libc-gz + @/@.minigzip -9 libc + @/@.minigzip -d libc-gz + @/@.minigzip -1 libc + @/@.minigzip -d libc-gz + @diff @.lib @.libc + @echo that should have reported '@.lib and @.libc identical' if you have diff. + @/@.example @.fred @.fred + @echo that will have given lots of hello!'s. + +@.minigzip: @.o.minigzip @.lib C:o.Stubs + Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs +@.example: @.o.example @.lib C:o.Stubs + Link $(Linkflags) @.o.example @.lib C:o.Stubs + +install: @.lib + cdir $(libdest) + cdir $(libdest).h + @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV + @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV + @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV + @echo okay, installed zlib in $(libdest) + +clean:; remove @.minigzip + remove @.example + remove @.libc + -wipe @.o.* F~r~cV + remove @.fred + +# User-editable dependencies: +.c.o: + cc $(ccflags) -o $@ $< + +# Static dependencies: + +# Dynamic dependencies: +o.example: c.example +o.example: h.zlib +o.example: h.zconf +o.minigzip: c.minigzip +o.minigzip: h.zlib +o.minigzip: h.zconf +o.adler32: c.adler32 +o.adler32: h.zlib +o.adler32: h.zconf +o.compress: c.compress +o.compress: h.zlib +o.compress: h.zconf +o.crc32: c.crc32 +o.crc32: h.zlib +o.crc32: h.zconf +o.deflate: c.deflate +o.deflate: h.deflate +o.deflate: h.zutil +o.deflate: h.zlib +o.deflate: h.zconf +o.gzio: c.gzio +o.gzio: h.zutil +o.gzio: h.zlib +o.gzio: h.zconf +o.infblock: c.infblock +o.infblock: h.zutil +o.infblock: h.zlib +o.infblock: h.zconf +o.infblock: h.infblock +o.infblock: h.inftrees +o.infblock: h.infcodes +o.infblock: h.infutil +o.infcodes: c.infcodes +o.infcodes: h.zutil +o.infcodes: h.zlib +o.infcodes: h.zconf +o.infcodes: h.inftrees +o.infcodes: h.infblock +o.infcodes: h.infcodes +o.infcodes: h.infutil +o.infcodes: h.inffast +o.inffast: c.inffast +o.inffast: h.zutil +o.inffast: h.zlib +o.inffast: h.zconf +o.inffast: h.inftrees +o.inffast: h.infblock +o.inffast: h.infcodes +o.inffast: h.infutil +o.inffast: h.inffast +o.inflate: c.inflate +o.inflate: h.zutil +o.inflate: h.zlib +o.inflate: h.zconf +o.inflate: h.infblock +o.inftrees: c.inftrees +o.inftrees: h.zutil +o.inftrees: h.zlib +o.inftrees: h.zconf +o.inftrees: h.inftrees +o.inftrees: h.inffixed +o.infutil: c.infutil +o.infutil: h.zutil +o.infutil: h.zlib +o.infutil: h.zconf +o.infutil: h.infblock +o.infutil: h.inftrees +o.infutil: h.infcodes +o.infutil: h.infutil +o.trees: c.trees +o.trees: h.deflate +o.trees: h.zutil +o.trees: h.zlib +o.trees: h.zconf +o.trees: h.trees +o.uncompr: c.uncompr +o.uncompr: h.zlib +o.uncompr: h.zconf +o.zutil: c.zutil +o.zutil: h.zutil +o.zutil: h.zlib +o.zutil: h.zconf diff --git a/cfe/cfe/zlib/README b/cfe/cfe/zlib/README new file mode 100644 index 0000000..8ff4587 --- /dev/null +++ b/cfe/cfe/zlib/README @@ -0,0 +1,148 @@ +zlib 1.1.3 is a general purpose data compression library. All the code +is thread safe. The data format used by the zlib library +is described by RFCs (Request for Comments) 1950 to 1952 in the files +ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate +format) and rfc1952.txt (gzip format). These documents are also available in +other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html + +All functions of the compression library are documented in the file zlib.h +(volunteer to write man pages welcome, contact jloup@gzip.org). A usage +example of the library is given in the file example.c which also tests that +the library is working correctly. Another example is given in the file +minigzip.c. The compression library itself is composed of all source files +except example.c and minigzip.c. + +To compile all files and run the test program, follow the instructions +given at the top of Makefile. In short "make test; make install" +should work for most machines. For Unix: "configure; make test; make install" +For MSDOS, use one of the special makefiles such as Makefile.msc. +For VMS, use Make_vms.com or descrip.mms. + +Questions about zlib should be sent to , or to +Gilles Vollant for the Windows DLL version. +The zlib home page is http://www.cdrom.com/pub/infozip/zlib/ +The official zlib ftp site is ftp://ftp.cdrom.com/pub/infozip/zlib/ +Before reporting a problem, please check those sites to verify that +you have the latest version of zlib; otherwise get the latest version and +check whether the problem still exists or not. + +Mark Nelson wrote an article about zlib for the Jan. 1997 +issue of Dr. Dobb's Journal; a copy of the article is available in +http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm + +The changes made in version 1.1.3 are documented in the file ChangeLog. +The main changes since 1.1.2 are: + +- fix "an inflate input buffer bug that shows up on rare but persistent + occasions" (Mark) +- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) +- fix gzseek(..., SEEK_SET) in write mode +- fix crc check after a gzeek (Frank Faubert) +- fix miniunzip when the last entry in a zip file is itself a zip file + (J Lillge) +- add contrib/asm586 and contrib/asm686 (Brian Raiter) + See http://www.muppetlabs.com/~breadbox/software/assembly.html +- add support for Delphi 3 in contrib/delphi (Bob Dellaca) +- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) +- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) +- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) +- added a FAQ file + +plus many changes for portability. + +Unsupported third party contributions are provided in directory "contrib". + +A Java implementation of zlib is available in the Java Development Kit 1.1 +http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html +See the zlib home page http://www.cdrom.com/pub/infozip/zlib/ for details. + +A Perl interface to zlib written by Paul Marquess +is in the CPAN (Comprehensive Perl Archive Network) sites, such as: +ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib* + +A Python interface to zlib written by A.M. Kuchling +is available in Python 1.5 and later versions, see +http://www.python.org/doc/lib/module-zlib.html + +A zlib binding for TCL written by Andreas Kupries +is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html + +An experimental package to read and write files in .zip format, +written on top of zlib by Gilles Vollant , is +available at http://www.winimage.com/zLibDll/unzip.html +and also in the contrib/minizip directory of zlib. + + +Notes for some targets: + +- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc + and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL + The zlib DLL support was initially done by Alessandro Iacopetti and is + now maintained by Gilles Vollant . Check the zlib DLL + home page at http://www.winimage.com/zLibDll + + From Visual Basic, you can call the DLL functions which do not take + a structure as argument: compress, uncompress and all gz* functions. + See contrib/visual-basic.txt for more information, or get + http://www.tcfb.com/dowseware/cmp-z-it.zip + +- For 64-bit Irix, deflate.c must be compiled without any optimization. + With -O, one libpng test fails. The test works in 32 bit mode (with + the -n32 compiler flag). The compiler bug has been reported to SGI. + +- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 + it works when compiled with cc. + +- on Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 + is necessary to get gzprintf working correctly. This is done by configure. + +- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works + with other compilers. Use "make test" to check your compiler. + +- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. + +- For Turbo C the small model is supported only with reduced performance to + avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 + +- For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html + Per Harald Myrvang + + +Acknowledgments: + + The deflate format used by zlib was defined by Phil Katz. The deflate + and zlib specifications were written by L. Peter Deutsch. Thanks to all the + people who reported problems and suggested various improvements in zlib; + they are too numerous to cite here. + +Copyright notice: + + (C) 1995-1998 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* +receiving lengthy legal documents to sign. The sources are provided +for free but without warranty of any kind. The library has been +entirely written by Jean-loup Gailly and Mark Adler; it does not +include third-party code. + +If you redistribute modified sources, we would appreciate that you include +in the file ChangeLog history information documenting your changes. diff --git a/cfe/cfe/zlib/adler32.c b/cfe/cfe/zlib/adler32.c new file mode 100644 index 0000000..70d368e --- /dev/null +++ b/cfe/cfe/zlib/adler32.c @@ -0,0 +1,48 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: adler32.c,v 1.1 2001/11/09 01:48:01 mpl Exp $ */ + +#include "zlib.h" + +#define BASE 65521L /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {s1 += buf[i]; s2 += s1;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long s1 = adler & 0xffff; + unsigned long s2 = (adler >> 16) & 0xffff; + int k; + + if (buf == Z_NULL) return 1L; + + while (len > 0) { + k = len < NMAX ? len : NMAX; + len -= k; + while (k >= 16) { + DO16(buf); + buf += 16; + k -= 16; + } + if (k != 0) do { + s1 += *buf++; + s2 += s1; + } while (--k); + s1 %= BASE; + s2 %= BASE; + } + return (s2 << 16) | s1; +} diff --git a/cfe/cfe/zlib/algorithm.txt b/cfe/cfe/zlib/algorithm.txt new file mode 100644 index 0000000..cdc830b --- /dev/null +++ b/cfe/cfe/zlib/algorithm.txt @@ -0,0 +1,213 @@ +1. Compression algorithm (deflate) + +The deflation algorithm used by gzip (also zip and zlib) is a variation of +LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in +the input data. The second occurrence of a string is replaced by a +pointer to the previous string, in the form of a pair (distance, +length). Distances are limited to 32K bytes, and lengths are limited +to 258 bytes. When a string does not occur anywhere in the previous +32K bytes, it is emitted as a sequence of literal bytes. (In this +description, `string' must be taken as an arbitrary sequence of bytes, +and is not restricted to printable characters.) + +Literals or match lengths are compressed with one Huffman tree, and +match distances are compressed with another tree. The trees are stored +in a compact form at the start of each block. The blocks can have any +size (except that the compressed data for one block must fit in +available memory). A block is terminated when deflate() determines that +it would be useful to start another block with fresh trees. (This is +somewhat similar to the behavior of LZW-based _compress_.) + +Duplicated strings are found using a hash table. All input strings of +length 3 are inserted in the hash table. A hash index is computed for +the next 3 bytes. If the hash chain for this index is not empty, all +strings in the chain are compared with the current input string, and +the longest match is selected. + +The hash chains are searched starting with the most recent strings, to +favor small distances and thus take advantage of the Huffman encoding. +The hash chains are singly linked. There are no deletions from the +hash chains, the algorithm simply discards matches that are too old. + +To avoid a worst-case situation, very long hash chains are arbitrarily +truncated at a certain length, determined by a runtime option (level +parameter of deflateInit). So deflate() does not always find the longest +possible match but generally finds a match which is long enough. + +deflate() also defers the selection of matches with a lazy evaluation +mechanism. After a match of length N has been found, deflate() searches for +a longer match at the next input byte. If a longer match is found, the +previous match is truncated to a length of one (thus producing a single +literal byte) and the process of lazy evaluation begins again. Otherwise, +the original match is kept, and the next match search is attempted only N +steps later. + +The lazy match evaluation is also subject to a runtime parameter. If +the current match is long enough, deflate() reduces the search for a longer +match, thus speeding up the whole process. If compression ratio is more +important than speed, deflate() attempts a complete second search even if +the first match is already long enough. + +The lazy match evaluation is not performed for the fastest compression +modes (level parameter 1 to 3). For these fast modes, new strings +are inserted in the hash table only when no match was found, or +when the match is not too long. This degrades the compression ratio +but saves time since there are both fewer insertions and fewer searches. + + +2. Decompression algorithm (inflate) + +2.1 Introduction + +The real question is, given a Huffman tree, how to decode fast. The most +important realization is that shorter codes are much more common than +longer codes, so pay attention to decoding the short codes fast, and let +the long codes take longer to decode. + +inflate() sets up a first level table that covers some number of bits of +input less than the length of longest code. It gets that many bits from the +stream, and looks it up in the table. The table will tell if the next +code is that many bits or less and how many, and if it is, it will tell +the value, else it will point to the next level table for which inflate() +grabs more bits and tries to decode a longer code. + +How many bits to make the first lookup is a tradeoff between the time it +takes to decode and the time it takes to build the table. If building the +table took no time (and if you had infinite memory), then there would only +be a first level table to cover all the way to the longest code. However, +building the table ends up taking a lot longer for more bits since short +codes are replicated many times in such a table. What inflate() does is +simply to make the number of bits in the first table a variable, and set it +for the maximum speed. + +inflate() sends new trees relatively often, so it is possibly set for a +smaller first level table than an application that has only one tree for +all the data. For inflate, which has 286 possible codes for the +literal/length tree, the size of the first table is nine bits. Also the +distance trees have 30 possible values, and the size of the first table is +six bits. Note that for each of those cases, the table ended up one bit +longer than the ``average'' code length, i.e. the code length of an +approximately flat code which would be a little more than eight bits for +286 symbols and a little less than five bits for 30 symbols. It would be +interesting to see if optimizing the first level table for other +applications gave values within a bit or two of the flat code size. + + +2.2 More details on the inflate table lookup + +Ok, you want to know what this cleverly obfuscated inflate tree actually +looks like. You are correct that it's not a Huffman tree. It is simply a +lookup table for the first, let's say, nine bits of a Huffman symbol. The +symbol could be as short as one bit or as long as 15 bits. If a particular +symbol is shorter than nine bits, then that symbol's translation is duplicated +in all those entries that start with that symbol's bits. For example, if the +symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a +symbol is nine bits long, it appears in the table once. + +If the symbol is longer than nine bits, then that entry in the table points +to another similar table for the remaining bits. Again, there are duplicated +entries as needed. The idea is that most of the time the symbol will be short +and there will only be one table look up. (That's whole idea behind data +compression in the first place.) For the less frequent long symbols, there +will be two lookups. If you had a compression method with really long +symbols, you could have as many levels of lookups as is efficient. For +inflate, two is enough. + +So a table entry either points to another table (in which case nine bits in +the above example are gobbled), or it contains the translation for the symbol +and the number of bits to gobble. Then you start again with the next +ungobbled bit. + +You may wonder: why not just have one lookup table for how ever many bits the +longest symbol is? The reason is that if you do that, you end up spending +more time filling in duplicate symbol entries than you do actually decoding. +At least for deflate's output that generates new trees every several 10's of +kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code +would take too long if you're only decoding several thousand symbols. At the +other extreme, you could make a new table for every bit in the code. In fact, +that's essentially a Huffman tree. But then you spend two much time +traversing the tree while decoding, even for short symbols. + +So the number of bits for the first lookup table is a trade of the time to +fill out the table vs. the time spent looking at the second level and above of +the table. + +Here is an example, scaled down: + +The code being decoded, with 10 symbols, from 1 to 6 bits long: + +A: 0 +B: 10 +C: 1100 +D: 11010 +E: 11011 +F: 11100 +G: 11101 +H: 11110 +I: 111110 +J: 111111 + +Let's make the first table three bits long (eight entries): + +000: A,1 +001: A,1 +010: A,1 +011: A,1 +100: B,2 +101: B,2 +110: -> table X (gobble 3 bits) +111: -> table Y (gobble 3 bits) + +Each entry is what the bits decode to and how many bits that is, i.e. how +many bits to gobble. Or the entry points to another table, with the number of +bits to gobble implicit in the size of the table. + +Table X is two bits long since the longest code starting with 110 is five bits +long: + +00: C,1 +01: C,1 +10: D,2 +11: E,2 + +Table Y is three bits long since the longest code starting with 111 is six +bits long: + +000: F,2 +001: F,2 +010: G,2 +011: G,2 +100: H,2 +101: H,2 +110: I,3 +111: J,3 + +So what we have here are three tables with a total of 20 entries that had to +be constructed. That's compared to 64 entries for a single table. Or +compared to 16 entries for a Huffman tree (six two entry tables and one four +entry table). Assuming that the code ideally represents the probability of +the symbols, it takes on the average 1.25 lookups per symbol. That's compared +to one lookup for the single table, or 1.66 lookups per symbol for the +Huffman tree. + +There, I think that gives you a picture of what's going on. For inflate, the +meaning of a particular symbol is often more than just a letter. It can be a +byte (a "literal"), or it can be either a length or a distance which +indicates a base value and a number of bits to fetch after the code that is +added to the base value. Or it might be the special end-of-block code. The +data structures created in inftrees.c try to encode all that information +compactly in the tables. + + +Jean-loup Gailly Mark Adler +jloup@gzip.org madler@alumni.caltech.edu + + +References: + +[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data +Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, +pp. 337-343. + +``DEFLATE Compressed Data Format Specification'' available in +ftp://ds.internic.net/rfc/rfc1951.txt diff --git a/cfe/cfe/zlib/compress.c b/cfe/cfe/zlib/compress.c new file mode 100644 index 0000000..4000959 --- /dev/null +++ b/cfe/cfe/zlib/compress.c @@ -0,0 +1,68 @@ +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-1998 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: compress.c,v 1.1 2001/11/09 01:48:01 mpl Exp $ */ + +#include "zlib.h" + +/* =========================================================================== + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; + int level; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; +#ifdef MAXSEG_64K + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; +#endif + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; + + err = deflateInit(&stream, level); + if (err != Z_OK) return err; + + err = deflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + deflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = deflateEnd(&stream); + return err; +} + +/* =========================================================================== + */ +int ZEXPORT compress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); +} diff --git a/cfe/cfe/zlib/configure b/cfe/cfe/zlib/configure new file mode 100755 index 0000000..e894235 --- /dev/null +++ b/cfe/cfe/zlib/configure @@ -0,0 +1,212 @@ +#!/bin/sh +# configure script for zlib. This script is needed only if +# you wish to build a shared library and your system supports them, +# of if you need special compiler, flags or install directory. +# Otherwise, you can just use directly "make test; make install" +# +# To create a shared library, use "configure --shared"; by default a static +# library is created. If the primitive shared library support provided here +# does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz +# +# To impose specific compiler or flags or install directory, use for example: +# prefix=$HOME CC=cc CFLAGS="-O4" ./configure +# or for csh/tcsh users: +# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) +# LDSHARED is the command to be used to create a shared library + +# Incorrect settings of CC or CFLAGS may prevent creating a shared library. +# If you have problems, try without defining CC and CFLAGS before reporting +# an error. + +LIBS=libz.a +SHAREDLIB=libz.so +VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` +AR=${AR-"ar rc"} +RANLIB=${RANLIB-"ranlib"} +prefix=${prefix-/usr/local} +exec_prefix=${exec_prefix-'${prefix}'} +libdir=${libdir-'${exec_prefix}/lib'} +includedir=${includedir-'${prefix}/include'} +shared_ext='.so' +shared=0 +gcc=0 +old_cc="$CC" +old_cflags="$CFLAGS" + +while test $# -ge 1 +do +case "$1" in + -h* | --h*) + echo 'usage:' + echo ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]' + echo ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]' + exit 0;; + -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; + -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; + -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; + -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;; + -p* | --p*) prefix="$2"; shift; shift;; + -e* | --e*) exec_prefix="$2"; shift; shift;; + -l* | --l*) libdir="$2"; shift; shift;; + -i* | --i*) includedir="$2"; shift; shift;; + -s* | --s*) shared=1; shift;; + esac +done + +test=ztest$$ +cat > $test.c </dev/null; then + CC="$cc" + SFLAGS=${CFLAGS-"-fPIC -O3"} + CFLAGS="$cflags" + case `(uname -s || echo unknown) 2>/dev/null` in + Linux | linux) LDSHARED=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};; + *) LDSHARED=${LDSHARED-"gcc -shared"};; + esac +else + # find system name and corresponding cc options + CC=${CC-cc} + case `(uname -sr || echo unknown) 2>/dev/null` in + HP-UX*) SFLAGS=${CFLAGS-"-O +z"} + CFLAGS=${CFLAGS-"-O"} +# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} + LDSHARED=${LDSHARED-"ld -b"} + shared_ext='.sl' + SHAREDLIB='libz.sl';; + IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} + CFLAGS=${CFLAGS-"-ansi -O2"} + LDSHARED=${LDSHARED-"cc -shared"};; + OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} + CFLAGS=${CFLAGS-"-O -std1"} + LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};; + OSF1*) SFLAGS=${CFLAGS-"-O -std1"} + CFLAGS=${CFLAGS-"-O -std1"} + LDSHARED=${LDSHARED-"cc -shared"};; + QNX*) SFLAGS=${CFLAGS-"-4 -O"} + CFLAGS=${CFLAGS-"-4 -O"} + LDSHARED=${LDSHARED-"cc"} + RANLIB=${RANLIB-"true"} + AR="cc -A";; + SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} + CFLAGS=${CFLAGS-"-O3"} + LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};; + SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."} + CFLAGS=${CFLAGS-"-fast -xcg89"} + LDSHARED=${LDSHARED-"cc -G"};; + SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} + CFLAGS=${CFLAGS-"-O2"} + LDSHARED=${LDSHARED-"ld"};; + UNIX_System_V\ 4.2.0) + SFLAGS=${CFLAGS-"-KPIC -O"} + CFLAGS=${CFLAGS-"-O"} + LDSHARED=${LDSHARED-"cc -G"};; + UNIX_SV\ 4.2MP) + SFLAGS=${CFLAGS-"-Kconform_pic -O"} + CFLAGS=${CFLAGS-"-O"} + LDSHARED=${LDSHARED-"cc -G"};; + # send working options for other systems to support@gzip.org + *) SFLAGS=${CFLAGS-"-O"} + CFLAGS=${CFLAGS-"-O"} + LDSHARED=${LDSHARED-"cc -shared"};; + esac +fi + +if test $shared -eq 1; then + echo Checking for shared library support... + # we must test in two steps (cc then ld), required at least on SunOS 4.x + if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && + test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then + CFLAGS="$SFLAGS" + LIBS="$SHAREDLIB.$VER" + echo Building shared library $SHAREDLIB.$VER with $CC. + elif test -z "$old_cc" -a -z "$old_cflags"; then + echo No shared library suppport. + shared=0; + else + echo 'No shared library suppport; try without defining CC and CFLAGS' + shared=0; + fi +fi +if test $shared -eq 0; then + LDSHARED="$CC" + echo Building static library $LIBS version $VER with $CC. +fi + +cat > $test.c < +int main() { return 0; } +EOF +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + CFLAGS="$CFLAGS -DHAVE_UNISTD_H" + echo "Checking for unistd.h... Yes." +else + echo "Checking for unistd.h... No." +fi + +cat > $test.c < +int main() { return 0; } +EOF +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + echo "Checking for errno.h... Yes." +else + echo "Checking for errno.h... No." + CFLAGS="$CFLAGS -DNO_ERRNO_H" +fi + +cat > $test.c < +#include +#include +caddr_t hello() { + return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0); +} +EOF +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + CFLAGS="$CFLAGS -DUSE_MMAP" + echo Checking for mmap support... Yes. +else + echo Checking for mmap support... No. +fi + +CPP=${CPP-"$CC -E"} +case $CFLAGS in + *ASMV*) + if test "`nm $test.o | grep _hello`" = ""; then + CPP="$CPP -DNO_UNDERLINE" + echo Checking for underline in external names... No. + else + echo Checking for underline in external names... Yes. + fi;; +esac + +rm -f $test.[co] $test$shared_ext + +# udpate Makefile +sed < Makefile.in " +/^CC *=/s%=.*%=$CC% +/^CFLAGS *=/s%=.*%=$CFLAGS% +/^CPP *=/s%=.*%=$CPP% +/^LDSHARED *=/s%=.*%=$LDSHARED% +/^LIBS *=/s%=.*%=$LIBS% +/^SHAREDLIB *=/s%=.*%=$SHAREDLIB% +/^AR *=/s%=.*%=$AR% +/^RANLIB *=/s%=.*%=$RANLIB% +/^VER *=/s%=.*%=$VER% +/^prefix *=/s%=.*%=$prefix% +/^exec_prefix *=/s%=.*%=$exec_prefix% +/^libdir *=/s%=.*%=$libdir% +/^includedir *=/s%=.*%=$includedir% +" > Makefile diff --git a/cfe/cfe/zlib/crc32.c b/cfe/cfe/zlib/crc32.c new file mode 100644 index 0000000..0402f67 --- /dev/null +++ b/cfe/cfe/zlib/crc32.c @@ -0,0 +1,162 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: crc32.c,v 1.1 2001/11/09 01:48:01 mpl Exp $ */ + +#include "zlib.h" + +#define local static + +#ifdef DYNAMIC_CRC_TABLE + +local int crc_table_empty = 1; +local uLongf crc_table[256]; +local void make_crc_table OF((void)); + +/* + Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The table is simply the CRC of all possible eight bit values. This is all + the information needed to generate CRC's on data a byte at a time for all + combinations of CRC register values and incoming bytes. +*/ +local void make_crc_table() +{ + uLong c; + int n, k; + uLong poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* make exclusive-or pattern from polynomial (0xedb88320L) */ + poly = 0L; + for (n = 0; n < sizeof(p)/sizeof(Byte); n++) + poly |= 1L << (31 - p[n]); + + for (n = 0; n < 256; n++) + { + c = (uLong)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[n] = c; + } + crc_table_empty = 0; +} +#else +/* ======================================================================== + * Table of CRC-32's of all single-byte values (made by make_crc_table) + */ +local const uLongf crc_table[256] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +}; +#endif + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const uLongf * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) make_crc_table(); +#endif + return (const uLongf *)crc_table; +} + +/* ========================================================================= */ +#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); +#define DO2(buf) DO1(buf); DO1(buf); +#define DO4(buf) DO2(buf); DO2(buf); +#define DO8(buf) DO4(buf); DO4(buf); + +/* ========================================================================= */ +uLong ZEXPORT crc32(crc, buf, len) + uLong crc; + const Bytef *buf; + uInt len; +{ + if (buf == Z_NULL) return 0L; +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif + crc = crc ^ 0xffffffffL; + while (len >= 8) + { + DO8(buf); + len -= 8; + } + if (len) do { + DO1(buf); + } while (--len); + return crc ^ 0xffffffffL; +} diff --git a/cfe/cfe/zlib/deflate.c b/cfe/cfe/zlib/deflate.c new file mode 100644 index 0000000..be87d40 --- /dev/null +++ b/cfe/cfe/zlib/deflate.c @@ -0,0 +1,1350 @@ +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-1998 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process depends on being able to identify portions + * of the input text which are identical to earlier input (within a + * sliding window trailing behind the input currently being processed). + * + * The most straightforward technique turns out to be the fastest for + * most input files: try all possible matches and select the longest. + * The key feature of this algorithm is that insertions into the string + * dictionary are very simple and thus fast, and deletions are avoided + * completely. Insertions are performed at each input character, whereas + * string matches are performed only when the previous match ends. So it + * is preferable to spend more time in matches to allow very fast string + * insertions and avoid deletions. The matching algorithm for small + * strings is inspired from that of Rabin & Karp. A brute force approach + * is used to find longer strings when a small match has been found. + * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze + * (by Leonid Broukhis). + * A previous version of this file used a more sophisticated algorithm + * (by Fiala and Greene) which is guaranteed to run in linear amortized + * time, but has a larger average cost, uses more memory and is patented. + * However the F&G algorithm may be faster for some highly redundant + * files if the parameter max_chain_length (described below) is too large. + * + * ACKNOWLEDGEMENTS + * + * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and + * I found it in 'freeze' written by Leonid Broukhis. + * Thanks to many people for bug reports and testing. + * + * REFERENCES + * + * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". + * Available in ftp://ds.internic.net/rfc/rfc1951.txt + * + * A description of the Rabin and Karp algorithm is given in the book + * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. + * + * Fiala,E.R., and Greene,D.H. + * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 + * + */ + +/* @(#) $Id: deflate.c,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +#include "deflate.h" + +const char deflate_copyright[] = + " deflate 1.1.3 Copyright 1995-1998 Jean-loup Gailly "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* =========================================================================== + * Function prototypes. + */ +typedef enum { + need_more, /* block not completed, need more input or more output */ + block_done, /* block flush performed */ + finish_started, /* finish started, need only more output at next deflate */ + finish_done /* finish done, accept no more input or output */ +} block_state; + +typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +/* Compression function. Returns the block state after the call. */ + +local void fill_window OF((deflate_state *s)); +local block_state deflate_stored OF((deflate_state *s, int flush)); +local block_state deflate_fast OF((deflate_state *s, int flush)); +local block_state deflate_slow OF((deflate_state *s, int flush)); +local void lm_init OF((deflate_state *s)); +local void putShortMSB OF((deflate_state *s, uInt b)); +local void flush_pending OF((z_streamp strm)); +local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifdef ASMV + void match_init OF((void)); /* asm code initialization */ + uInt longest_match OF((deflate_state *s, IPos cur_match)); +#else +local uInt longest_match OF((deflate_state *s, IPos cur_match)); +#endif + +#ifdef DEBUG +local void check_match OF((deflate_state *s, IPos start, IPos match, + int length)); +#endif + +/* =========================================================================== + * Local data + */ + +#define NIL 0 +/* Tail of hash chains */ + +#ifndef TOO_FAR +# define TOO_FAR 4096 +#endif +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +typedef struct config_s { + ush good_length; /* reduce lazy search above this match length */ + ush max_lazy; /* do not perform lazy search above this match length */ + ush nice_length; /* quit search above this match length */ + ush max_chain; + compress_func func; +} config; + +local const config configuration_table[10] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* maximum speed, no lazy matches */ +/* 2 */ {4, 5, 16, 8, deflate_fast}, +/* 3 */ {4, 6, 32, 32, deflate_fast}, + +/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ +/* 5 */ {8, 16, 32, 32, deflate_slow}, +/* 6 */ {8, 16, 128, 128, deflate_slow}, +/* 7 */ {8, 32, 128, 256, deflate_slow}, +/* 8 */ {32, 128, 258, 1024, deflate_slow}, +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */ + +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different + * meaning. + */ + +#define EQUAL 0 +/* result of memcmp for equal strings */ + +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ + +/* =========================================================================== + * Update a hash value with the given input byte + * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * input characters, so that a running hash key can be computed from the + * previous key instead of complete recalculation each time. + */ +#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) + + +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of str are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif + +/* =========================================================================== + * Initialize the hash table (avoiding 64K overflow for 16 bit systems). + * prev[] will be initialized on the fly. + */ +#define CLEAR_HASH(s) \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + +/* ========================================================================= */ +int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; + int level; + const char *version; + int stream_size; +{ + return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, version, stream_size); + /* To do: ignore strm->next_in if we use it as window */ +} + +/* ========================================================================= */ +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + version, stream_size) + z_streamp strm; + int level; + int method; + int windowBits; + int memLevel; + int strategy; + const char *version; + int stream_size; +{ + deflate_state *s; + int noheader = 0; + static const char* my_version = ZLIB_VERSION; + + ushf *overlay; + /* We overlay pending_buf and d_buf+l_buf. This works since the average + * output size for (length,distance) codes is <= 24 bits. + */ + + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; + } + if (strm == Z_NULL) return Z_STREAM_ERROR; + + strm->msg = Z_NULL; + if (strm->zalloc == Z_NULL) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == Z_NULL) strm->zfree = zcfree; + + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#ifdef FASTEST + level = 1; +#endif + + if (windowBits < 0) { /* undocumented feature: suppress zlib header */ + noheader = 1; + windowBits = -windowBits; + } + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_HUFFMAN_ONLY) { + return Z_STREAM_ERROR; + } + s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); + if (s == Z_NULL) return Z_MEM_ERROR; + strm->state = (struct internal_state FAR *)s; + s->strm = strm; + + s->noheader = noheader; + s->w_bits = windowBits; + s->w_size = 1 << s->w_bits; + s->w_mask = s->w_size - 1; + + s->hash_bits = memLevel + 7; + s->hash_size = 1 << s->hash_bits; + s->hash_mask = s->hash_size - 1; + s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + s->pending_buf = (uchf *) overlay; + s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { + strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + deflateEnd (strm); + return Z_MEM_ERROR; + } + s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + + s->level = level; + s->strategy = strategy; + s->method = (Byte)method; + + return deflateReset(strm); +} + +/* ========================================================================= */ +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) + z_streamp strm; + const Bytef *dictionary; + uInt dictLength; +{ + deflate_state *s; + uInt length = dictLength; + uInt n; + IPos hash_head = 0; + + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || + strm->state->status != INIT_STATE) return Z_STREAM_ERROR; + + s = strm->state; + strm->adler = adler32(strm->adler, dictionary, dictLength); + + if (length < MIN_MATCH) return Z_OK; + if (length > MAX_DIST(s)) { + length = MAX_DIST(s); +#ifndef USE_DICT_HEAD + dictionary += dictLength - length; /* use the tail of the dictionary */ +#endif + } + zmemcpy(s->window, dictionary, length); + s->strstart = length; + s->block_start = (long)length; + + /* Insert all strings in the hash table (except for the last two bytes). + * s->lookahead stays null, so s->ins_h will be recomputed at the next + * call of fill_window. + */ + s->ins_h = s->window[0]; + UPDATE_HASH(s, s->ins_h, s->window[1]); + for (n = 0; n <= length - MIN_MATCH; n++) { + INSERT_STRING(s, n, hash_head); + } + if (hash_head) hash_head = 0; /* to make compiler happy */ + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; + + strm->total_in = strm->total_out = 0; + strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ + strm->data_type = Z_UNKNOWN; + + s = (deflate_state *)strm->state; + s->pending = 0; + s->pending_out = s->pending_buf; + + if (s->noheader < 0) { + s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */ + } + s->status = s->noheader ? BUSY_STATE : INIT_STATE; + strm->adler = 1; + s->last_flush = Z_NO_FLUSH; + + _tr_init(s); + lm_init(s); + + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateParams(strm, level, strategy) + z_streamp strm; + int level; + int strategy; +{ + deflate_state *s; + compress_func func; + int err = Z_OK; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + + if (level == Z_DEFAULT_COMPRESSION) { + level = 6; + } + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) { + return Z_STREAM_ERROR; + } + func = configuration_table[s->level].func; + + if (func != configuration_table[level].func && strm->total_in != 0) { + /* Flush the last buffer: */ + err = deflate(strm, Z_PARTIAL_FLUSH); + } + if (s->level != level) { + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; + } + s->strategy = strategy; + return err; +} + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +local void putShortMSB (s, b) + deflate_state *s; + uInt b; +{ + put_byte(s, (Byte)(b >> 8)); + put_byte(s, (Byte)(b & 0xff)); +} + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->next_out buffer and copying into it. + * (See also read_buf()). + */ +local void flush_pending(strm) + z_streamp strm; +{ + unsigned len = strm->state->pending; + + if (len > strm->avail_out) len = strm->avail_out; + if (len == 0) return; + + zmemcpy(strm->next_out, strm->state->pending_out, len); + strm->next_out += len; + strm->state->pending_out += len; + strm->total_out += len; + strm->avail_out -= len; + strm->state->pending -= len; + if (strm->state->pending == 0) { + strm->state->pending_out = strm->state->pending_buf; + } +} + +/* ========================================================================= */ +int ZEXPORT deflate (strm, flush) + z_streamp strm; + int flush; +{ + int old_flush; /* value of flush param for previous deflate call */ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + flush > Z_FINISH || flush < 0) { + return Z_STREAM_ERROR; + } + s = strm->state; + + if (strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0) || + (s->status == FINISH_STATE && flush != Z_FINISH)) { + ERR_RETURN(strm, Z_STREAM_ERROR); + } + if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); + + s->strm = strm; /* just in case */ + old_flush = s->last_flush; + s->last_flush = flush; + + /* Write the zlib header */ + if (s->status == INIT_STATE) { + + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags = (s->level-1) >> 1; + + if (level_flags > 3) level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = 1L; + } + + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUFF_ERROR. + */ + } else if (strm->avail_in == 0 && flush <= old_flush && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm->avail_in != 0 || s->lookahead != 0 || + (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { + block_state bstate; + + bstate = (*(configuration_table[s->level].func))(s, flush); + + if (bstate == finish_started || bstate == finish_done) { + s->status = FINISH_STATE; + } + if (bstate == need_more || bstate == finish_started) { + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate == block_done) { + if (flush == Z_PARTIAL_FLUSH) { + _tr_align(s); + } else { /* FULL_FLUSH or SYNC_FLUSH */ + _tr_stored_block(s, (char*)0, 0L, 0); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush == Z_FULL_FLUSH) { + CLEAR_HASH(s); /* forget history */ + } + } + flush_pending(strm); + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + Assert(strm->avail_out > 0, "bug2"); + + if (flush != Z_FINISH) return Z_OK; + if (s->noheader) return Z_STREAM_END; + + /* Write the zlib trailer (adler32) */ + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + s->noheader = -1; /* write the trailer only once! */ + return s->pending != 0 ? Z_OK : Z_STREAM_END; +} + +/* ========================================================================= */ +int ZEXPORT deflateEnd (strm) + z_streamp strm; +{ + int status; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + + status = strm->state->status; + if (status != INIT_STATE && status != BUSY_STATE && + status != FINISH_STATE) { + return Z_STREAM_ERROR; + } + + /* Deallocate in reverse order of allocations: */ + TRY_FREE(strm, strm->state->pending_buf); + TRY_FREE(strm, strm->state->head); + TRY_FREE(strm, strm->state->prev); + TRY_FREE(strm, strm->state->window); + + ZFREE(strm, strm->state); + strm->state = Z_NULL; + + return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state. + * To simplify the source, this is not supported for 16-bit MSDOS (which + * doesn't have enough memory anyway to duplicate compression states). + */ +int ZEXPORT deflateCopy (dest, source) + z_streamp dest; + z_streamp source; +{ +#ifdef MAXSEG_64K + return Z_STREAM_ERROR; +#else + deflate_state *ds; + deflate_state *ss; + ushf *overlay; + + + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + return Z_STREAM_ERROR; + } + + ss = source->state; + + *dest = *source; + + ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); + if (ds == Z_NULL) return Z_MEM_ERROR; + dest->state = (struct internal_state FAR *) ds; + *ds = *ss; + ds->strm = dest; + + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); + overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); + ds->pending_buf = (uchf *) overlay; + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { + deflateEnd (dest); + return Z_MEM_ERROR; + } + /* following zmemcpy do not work for 16-bit MSDOS */ + zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); + zmemcpy((Bytef *) ds->prev, (const Bytef *) ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy((Bytef *) ds->head, (const Bytef *) ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); + ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); + ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; + ds->bl_desc.dyn_tree = ds->bl_tree; + + return Z_OK; +#endif +} + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local int read_buf(strm, buf, size) + z_streamp strm; + Bytef *buf; + unsigned size; +{ + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + if (!strm->state->noheader) { + strm->adler = adler32(strm->adler, strm->next_in, len); + } + zmemcpy(buf, strm->next_in, len); + strm->next_in += len; + strm->total_in += len; + + return (int)len; +} + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init (s) + deflate_state *s; +{ + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +#ifdef ASMV + match_init(); /* initialize the asm code */ +#endif +} + +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +#ifndef ASMV +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or + * match.S. The code will be functionally equivalent. + */ +#ifndef FASTEST +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + int best_len = s->prev_length; /* best match length so far */ + int nice_match = s->nice_match; /* stop if match long enough */ + IPos limit = s->strstart > (IPos)MAX_DIST(s) ? + s->strstart - (IPos)MAX_DIST(s) : NIL; + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + Posf *prev = s->prev; + uInt wmask = s->w_mask; + +#ifdef UNALIGNED_OK + /* Compare two bytes at a time. Note: this is not always beneficial. + * Try with and without -DUNALIGNED_OK to check. + */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; + register ush scan_start = *(ushf*)scan; + register ush scan_end = *(ushf*)(scan+best_len-1); +#else + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end = scan[best_len]; +#endif + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s->prev_length >= s->good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + Assert(cur_match < s->strstart, "no future"); + match = s->window + cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2: + */ +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) + /* This code assumes sizeof(unsigned short) == 2. Do not use + * UNALIGNED_OK if your compiler uses a different size. + */ + if (*(ushf*)(match+best_len-1) != scan_end || + *(ushf*)match != scan_start) continue; + + /* It is not necessary to compare scan[2] and match[2] since they are + * always equal when the other bytes match, given that the hash keys + * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at + * strstart+3, +5, ... up to strstart+257. We check for insufficient + * lookahead only every 4th comparison; the 128th check will be made + * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * necessary to put more guard bytes at the end of the window, or + * to check more often for insufficient lookahead. + */ + Assert(scan[2] == match[2], "scan[2]?"); + scan++, match++; + do { + } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + scan < strend); + /* The funny "do {}" generates better code on most compilers */ + + /* Here, scan <= window+strstart+257 */ + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + if (*scan == *match) scan++; + + len = (MAX_MATCH - 1) - (int)(strend-scan); + scan = strend - (MAX_MATCH-1); + +#else /* UNALIGNED_OK */ + + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match++; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + scan = strend - MAX_MATCH; + +#endif /* UNALIGNED_OK */ + + if (len > best_len) { + s->match_start = cur_match; + best_len = len; + if (len >= nice_match) break; +#ifdef UNALIGNED_OK + scan_end = *(ushf*)(scan+best_len-1); +#else + scan_end1 = scan[best_len-1]; + scan_end = scan[best_len]; +#endif + } + } while ((cur_match = prev[cur_match & wmask]) > limit + && --chain_length != 0); + + if ((uInt)best_len <= s->lookahead) return (uInt)best_len; + return s->lookahead; +} + +#else /* FASTEST */ +/* --------------------------------------------------------------------------- + * Optimized version for level == 1 only + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + Assert(cur_match < s->strstart, "no future"); + + match = s->window + cur_match; + + /* Return failure if the match length is less than 2: + */ + if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match += 2; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + + if (len < MIN_MATCH) return MIN_MATCH - 1; + + s->match_start = cur_match; + return len <= s->lookahead ? len : s->lookahead; +} +#endif /* FASTEST */ +#endif /* ASMV */ + +#ifdef DEBUG +/* =========================================================================== + * Check that the match at match_start is indeed a match. + */ +local void check_match(s, start, match, length) + deflate_state *s; + IPos start, match; + int length; +{ + /* check that the match is indeed a match */ + if (zmemcmp(s->window + match, + s->window + start, length) != EQUAL) { + fprintf(stderr, " start %u, match %u, length %d\n", + start, match, length); + do { + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); + z_error("invalid match"); + } + if (z_verbose > 1) { + fprintf(stderr,"\\[%d,%d]", start-match, length); + do { putc(s->window[start++], stderr); } while (--length != 0); + } +} +#else +# define check_match(s, start, match, length) +#endif + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(s) + deflate_state *s; +{ + register unsigned n, m; + register Posf *p; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if strstart == 0 + * and lookahead == 1 (input done one byte at time) + */ + more--; + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + } else if (s->strstart >= wsize+MAX_DIST(s)) { + + zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); + + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif + more += wsize; + } + if (s->strm->avail_in == 0) return; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead >= MIN_MATCH) { + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); +} + +/* =========================================================================== + * Flush the current block, with given end-of-file flag. + * IN assertion: strstart is set to the end of the current match. + */ +#define FLUSH_BLOCK_ONLY(s, eof) { \ + _tr_flush_block(s, (s->block_start >= 0L ? \ + (charf *)&s->window[(unsigned)s->block_start] : \ + (charf *)Z_NULL), \ + (ulg)((long)s->strstart - s->block_start), \ + (eof)); \ + s->block_start = s->strstart; \ + flush_pending(s->strm); \ + Tracev((stderr,"[FLUSH]")); \ +} + +/* Same but force premature exit if necessary. */ +#define FLUSH_BLOCK(s, eof) { \ + FLUSH_BLOCK_ONLY(s, eof); \ + if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +local block_state deflate_stored(s, flush) + deflate_state *s; + int flush; +{ + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + ulg max_block_size = 0xffff; + ulg max_start; + + if (max_block_size > s->pending_buf_size - 5) { + max_block_size = s->pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s->lookahead <= 1) { + + Assert(s->strstart < s->w_size+MAX_DIST(s) || + s->block_start >= (long)s->w_size, "slide too late"); + + fill_window(s); + if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + + if (s->lookahead == 0) break; /* flush the current block */ + } + Assert(s->block_start >= 0L, "block gone"); + + s->strstart += s->lookahead; + s->lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; + if (s->strstart == 0 || (ulg)s->strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; + FLUSH_BLOCK(s, 0); + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { + FLUSH_BLOCK(s, 0); + } + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +local block_state deflate_fast(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head = NIL; /* head of the hash chain */ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + if (s->strategy != Z_HUFFMAN_ONLY) { + s->match_length = longest_match (s, hash_head); + } + /* longest_match() sets match_start */ + } + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->match_start, s->match_length); + + _tr_tally_dist(s, s->strstart - s->match_start, + s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ +#ifndef FASTEST + if (s->match_length <= s->max_insert_length && + s->lookahead >= MIN_MATCH) { + s->match_length--; /* string at strstart already in hash table */ + do { + s->strstart++; + INSERT_STRING(s, s->strstart, hash_head); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s->match_length != 0); + s->strstart++; + } else +#endif + { + s->strstart += s->match_length; + s->match_length = 0; + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +local block_state deflate_slow(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head = NIL; /* head of hash chain */ + int bflush; /* set if current block must be flushed */ + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + */ + s->prev_length = s->match_length, s->prev_match = s->match_start; + s->match_length = MIN_MATCH-1; + + if (hash_head != NIL && s->prev_length < s->max_lazy_match && + s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + if (s->strategy != Z_HUFFMAN_ONLY) { + s->match_length = longest_match (s, hash_head); + } + /* longest_match() sets match_start */ + + if (s->match_length <= 5 && (s->strategy == Z_FILTERED || + (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR))) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s->match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { + uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + check_match(s, s->strstart-1, s->prev_match, s->prev_length); + + _tr_tally_dist(s, s->strstart -1 - s->prev_match, + s->prev_length - MIN_MATCH, bflush); + + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s->lookahead -= s->prev_length-1; + s->prev_length -= 2; + do { + if (++s->strstart <= max_insert) { + INSERT_STRING(s, s->strstart, hash_head); + } + } while (--s->prev_length != 0); + s->match_available = 0; + s->match_length = MIN_MATCH-1; + s->strstart++; + + if (bflush) FLUSH_BLOCK(s, 0); + + } else if (s->match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { + FLUSH_BLOCK_ONLY(s, 0); + } + s->strstart++; + s->lookahead--; + if (s->strm->avail_out == 0) return need_more; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s->match_available = 1; + s->strstart++; + s->lookahead--; + } + } + Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s->match_available) { + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + s->match_available = 0; + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} diff --git a/cfe/cfe/zlib/deflate.h b/cfe/cfe/zlib/deflate.h new file mode 100644 index 0000000..e91a4f2 --- /dev/null +++ b/cfe/cfe/zlib/deflate.h @@ -0,0 +1,318 @@ +/* deflate.h -- internal compression state + * Copyright (C) 1995-1998 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id: deflate.h,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +#ifndef _DEFLATE_H +#define _DEFLATE_H + +#include "zutil.h" + +/* =========================================================================== + * Internal compression state. + */ + +#define LENGTH_CODES 29 +/* number of length codes, not counting the special END_BLOCK code */ + +#define LITERALS 256 +/* number of literal bytes 0..255 */ + +#define L_CODES (LITERALS+1+LENGTH_CODES) +/* number of Literal or Length codes, including the END_BLOCK code */ + +#define D_CODES 30 +/* number of distance codes */ + +#define BL_CODES 19 +/* number of codes used to transfer the bit lengths */ + +#define HEAP_SIZE (2*L_CODES+1) +/* maximum heap size */ + +#define MAX_BITS 15 +/* All codes must not exceed MAX_BITS bits */ + +#define INIT_STATE 42 +#define BUSY_STATE 113 +#define FINISH_STATE 666 +/* Stream status */ + + +/* Data structure describing a single value and its code string. */ +typedef struct ct_data_s { + union { + ush freq; /* frequency count */ + ush code; /* bit string */ + } fc; + union { + ush dad; /* father node in Huffman tree */ + ush len; /* length of bit string */ + } dl; +} FAR ct_data; + +#define Freq fc.freq +#define Code fc.code +#define Dad dl.dad +#define Len dl.len + +typedef struct static_tree_desc_s static_tree_desc; + +typedef struct tree_desc_s { + ct_data *dyn_tree; /* the dynamic tree */ + int max_code; /* largest code with non zero frequency */ + static_tree_desc *stat_desc; /* the corresponding static tree */ +} FAR tree_desc; + +typedef ush Pos; +typedef Pos FAR Posf; +typedef unsigned IPos; + +/* A Pos is an index in the character window. We use short instead of int to + * save space in the various tables. IPos is used only for parameter passing. + */ + +typedef struct internal_state { + z_streamp strm; /* pointer back to this zlib stream */ + int status; /* as the name implies */ + Bytef *pending_buf; /* output still pending */ + ulg pending_buf_size; /* size of pending_buf */ + Bytef *pending_out; /* next pending byte to output to the stream */ + int pending; /* nb of bytes in the pending buffer */ + int noheader; /* suppress zlib header and adler32 */ + Byte data_type; /* UNKNOWN, BINARY or ASCII */ + Byte method; /* STORED (for zip only) or DEFLATED */ + int last_flush; /* value of flush param for previous deflate call */ + + /* used by deflate.c: */ + + uInt w_size; /* LZ77 window size (32K by default) */ + uInt w_bits; /* log2(w_size) (8..16) */ + uInt w_mask; /* w_size - 1 */ + + Bytef *window; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. Also, it limits + * the window size to 64K, which is quite useful on MSDOS. + * To do: use the user input buffer as sliding window. + */ + + ulg window_size; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + Posf *prev; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + Posf *head; /* Heads of the hash chains or NIL. */ + + uInt ins_h; /* hash index of string to be inserted */ + uInt hash_size; /* number of elements in hash table */ + uInt hash_bits; /* log2(hash_size) */ + uInt hash_mask; /* hash_size-1 */ + + uInt hash_shift; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + long block_start; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + uInt match_length; /* length of best match */ + IPos prev_match; /* previous match */ + int match_available; /* set if previous match exists */ + uInt strstart; /* start of string to insert */ + uInt match_start; /* start of matching string */ + uInt lookahead; /* number of valid bytes ahead in window */ + + uInt prev_length; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + uInt max_chain_length; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + uInt max_lazy_match; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ +# define max_insert_length max_lazy_match + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + int level; /* compression level (1..9) */ + int strategy; /* favor or force Huffman coding*/ + + uInt good_match; + /* Use a faster search when the previous match is longer than this */ + + int nice_match; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + /* Didn't use ct_data typedef below to supress compiler warning */ + struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + struct tree_desc_s l_desc; /* desc. for literal tree */ + struct tree_desc_s d_desc; /* desc. for distance tree */ + struct tree_desc_s bl_desc; /* desc. for bit length tree */ + + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + int heap_len; /* number of elements in the heap */ + int heap_max; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + uch depth[2*L_CODES+1]; + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + uchf *l_buf; /* buffer for literals or lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + uInt last_lit; /* running index in l_buf */ + + ushf *d_buf; + /* Buffer for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ + uInt matches; /* number of string matches in current block */ + int last_eob_len; /* bit length of EOB code for last block */ + +#ifdef DEBUG + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ +#endif + + ush bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + +} FAR deflate_state; + +/* Output a byte on the stream. + * IN assertion: there is enough room in pending_buf. + */ +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} + + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) +/* In order to simplify the code, particularly on 16 bit machines, match + * distances are limited to MAX_DIST instead of WSIZE. + */ + + /* in trees.c */ +void _tr_init OF((deflate_state *s)); +int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); +void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, + int eof)); +void _tr_align OF((deflate_state *s)); +void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, + int eof)); + +#define d_code(dist) \ + ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) +/* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. _dist_code[256] and _dist_code[257] are never + * used. + */ + +#ifndef DEBUG +/* Inline versions of _tr_tally for speed: */ + +#if defined(GEN_TREES_H) || !defined(STDC) + extern uch _length_code[]; + extern uch _dist_code[]; +#else + extern const uch _length_code[]; + extern const uch _dist_code[]; +#endif + +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->last_lit] = 0; \ + s->l_buf[s->last_lit++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (length); \ + ush dist = (distance); \ + s->d_buf[s->last_lit] = dist; \ + s->l_buf[s->last_lit++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +#else +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +# define _tr_tally_dist(s, distance, length, flush) \ + flush = _tr_tally(s, distance, length) +#endif + +#endif diff --git a/cfe/cfe/zlib/descrip.mms b/cfe/cfe/zlib/descrip.mms new file mode 100644 index 0000000..9d36459 --- /dev/null +++ b/cfe/cfe/zlib/descrip.mms @@ -0,0 +1,48 @@ +# descrip.mms: MMS description file for building zlib on VMS +# written by Martin P.J. Zinser + +cc_defs = +c_deb = + +.ifdef __DECC__ +pref = /prefix=all +.endif + +OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\ + deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\ + inftrees.obj, infcodes.obj, infutil.obj, inffast.obj + +CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF) + +all : example.exe minigzip.exe + @ write sys$output " Example applications available" +libz.olb : libz.olb($(OBJS)) + @ write sys$output " libz available" + +example.exe : example.obj libz.olb + link example,libz.olb/lib + +minigzip.exe : minigzip.obj libz.olb + link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib + +clean : + delete *.obj;*,libz.olb;* + + +# Other dependencies. +adler32.obj : zutil.h zlib.h zconf.h +compress.obj : zlib.h zconf.h +crc32.obj : zutil.h zlib.h zconf.h +deflate.obj : deflate.h zutil.h zlib.h zconf.h +example.obj : zlib.h zconf.h +gzio.obj : zutil.h zlib.h zconf.h +infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h +infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h +inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h +inflate.obj : zutil.h zlib.h zconf.h infblock.h +inftrees.obj : zutil.h zlib.h zconf.h inftrees.h +infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h +minigzip.obj : zlib.h zconf.h +trees.obj : deflate.h zutil.h zlib.h zconf.h +uncompr.obj : zlib.h zconf.h +zutil.obj : zutil.h zlib.h zconf.h diff --git a/cfe/cfe/zlib/example.c b/cfe/cfe/zlib/example.c new file mode 100644 index 0000000..63a1b1e --- /dev/null +++ b/cfe/cfe/zlib/example.c @@ -0,0 +1,556 @@ +/* example.c -- usage example of the zlib compression library + * Copyright (C) 1995-1998 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: example.c,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +#include +#include "zlib.h" + +#ifdef STDC +# include +# include +#else + extern void exit OF((int)); +#endif + +#if defined(VMS) || defined(RISCOS) +# define TESTFILE "foo-gz" +#else +# define TESTFILE "foo.gz" +#endif + +#define CHECK_ERR(err, msg) { \ + if (err != Z_OK) { \ + fprintf(stderr, "%s error: %d\n", msg, err); \ + exit(1); \ + } \ +} + +const char hello[] = "hello, hello!"; +/* "hello world" would be more standard, but the repeated "hello" + * stresses the compression code better, sorry... + */ + +const char dictionary[] = "hello"; +uLong dictId; /* Adler32 value of the dictionary */ + +void test_compress OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_gzio OF((const char *out, const char *in, + Byte *uncompr, int uncomprLen)); +void test_deflate OF((Byte *compr, uLong comprLen)); +void test_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_deflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_flush OF((Byte *compr, uLong *comprLen)); +void test_sync OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_dict_deflate OF((Byte *compr, uLong comprLen)); +void test_dict_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +int main OF((int argc, char *argv[])); + +/* =========================================================================== + * Test compress() and uncompress() + */ +void test_compress(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + uLong len = strlen(hello)+1; + + err = compress(compr, &comprLen, (const Bytef*)hello, len); + CHECK_ERR(err, "compress"); + + strcpy((char*)uncompr, "garbage"); + + err = uncompress(uncompr, &uncomprLen, compr, comprLen); + CHECK_ERR(err, "uncompress"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad uncompress\n"); + exit(1); + } else { + printf("uncompress(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test read/write of .gz files + */ +void test_gzio(out, in, uncompr, uncomprLen) + const char *out; /* compressed output file */ + const char *in; /* compressed input file */ + Byte *uncompr; + int uncomprLen; +{ + int err; + int len = strlen(hello)+1; + gzFile file; + z_off_t pos; + + file = gzopen(out, "wb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + gzputc(file, 'h'); + if (gzputs(file, "ello") != 4) { + fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); + exit(1); + } + if (gzprintf(file, ", %s!", "hello") != 8) { + fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); + exit(1); + } + gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ + gzclose(file); + + file = gzopen(in, "rb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + } + strcpy((char*)uncompr, "garbage"); + + uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen); + if (uncomprLen != len) { + fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); + exit(1); + } else { + printf("gzread(): %s\n", (char *)uncompr); + } + + pos = gzseek(file, -8L, SEEK_CUR); + if (pos != 6 || gztell(file) != pos) { + fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", + (long)pos, (long)gztell(file)); + exit(1); + } + + if (gzgetc(file) != ' ') { + fprintf(stderr, "gzgetc error\n"); + exit(1); + } + + gzgets(file, (char*)uncompr, uncomprLen); + uncomprLen = strlen((char*)uncompr); + if (uncomprLen != 6) { /* "hello!" */ + fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello+7)) { + fprintf(stderr, "bad gzgets after gzseek\n"); + exit(1); + } else { + printf("gzgets() after gzseek: %s\n", (char *)uncompr); + } + + gzclose(file); +} + +/* =========================================================================== + * Test deflate() with small buffers + */ +void test_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + int len = strlen(hello)+1; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + + while (c_stream.total_in != (uLong)len && c_stream.total_out < comprLen) { + c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + } + /* Finish the stream, still forcing small buffers: */ + for (;;) { + c_stream.avail_out = 1; + err = deflate(&c_stream, Z_FINISH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "deflate"); + } + + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with small buffers + */ +void test_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 0; + d_stream.next_out = uncompr; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { + d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate\n"); + exit(1); + } else { + printf("inflate(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test deflate() with large buffers and dynamic change of compression level + */ +void test_large_deflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_SPEED); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + /* At this point, uncompr is still mostly zeroes, so it should compress + * very well: + */ + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + if (c_stream.avail_in != 0) { + fprintf(stderr, "deflate not greedy\n"); + exit(1); + } + + /* Feed in already compressed data and switch to no compression: */ + deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); + c_stream.next_in = compr; + c_stream.avail_in = (uInt)comprLen/2; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + /* Switch back to compressing mode: */ + deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with large buffers + */ +void test_large_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + for (;;) { + d_stream.next_out = uncompr; /* discard the output */ + d_stream.avail_out = (uInt)uncomprLen; + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "large inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (d_stream.total_out != 2*uncomprLen + comprLen/2) { + fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); + exit(1); + } else { + printf("large_inflate(): OK\n"); + } +} + +/* =========================================================================== + * Test deflate() with full flush + */ +void test_flush(compr, comprLen) + Byte *compr; + uLong *comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + int len = strlen(hello)+1; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + c_stream.avail_in = 3; + c_stream.avail_out = (uInt)*comprLen; + err = deflate(&c_stream, Z_FULL_FLUSH); + CHECK_ERR(err, "deflate"); + + compr[3]++; /* force an error in first compressed block */ + c_stream.avail_in = len - 3; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + CHECK_ERR(err, "deflate"); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); + + *comprLen = c_stream.total_out; +} + +/* =========================================================================== + * Test inflateSync() + */ +void test_sync(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 2; /* just read the zlib header */ + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + inflate(&d_stream, Z_NO_FLUSH); + CHECK_ERR(err, "inflate"); + + d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ + err = inflateSync(&d_stream); /* but skip the damaged part */ + CHECK_ERR(err, "inflateSync"); + + err = inflate(&d_stream, Z_FINISH); + if (err != Z_DATA_ERROR) { + fprintf(stderr, "inflate should report DATA_ERROR\n"); + /* Because of incorrect adler32 */ + exit(1); + } + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + printf("after inflateSync(): hel%s\n", (char *)uncompr); +} + +/* =========================================================================== + * Test deflate() with preset dictionary + */ +void test_dict_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + err = deflateSetDictionary(&c_stream, + (const Bytef*)dictionary, sizeof(dictionary)); + CHECK_ERR(err, "deflateSetDictionary"); + + dictId = c_stream.adler; + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + c_stream.next_in = (Bytef*)hello; + c_stream.avail_in = (uInt)strlen(hello)+1; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with a preset dictionary + */ +void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + for (;;) { + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + if (err == Z_NEED_DICT) { + if (d_stream.adler != dictId) { + fprintf(stderr, "unexpected dictionary"); + exit(1); + } + err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, + sizeof(dictionary)); + } + CHECK_ERR(err, "inflate with dict"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate with dict\n"); + exit(1); + } else { + printf("inflate with dictionary: %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Usage: example [output.gz [input.gz]] + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + Byte *compr, *uncompr; + uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ + uLong uncomprLen = comprLen; + static const char* myVersion = ZLIB_VERSION; + + if (zlibVersion()[0] != myVersion[0]) { + fprintf(stderr, "incompatible zlib version\n"); + exit(1); + + } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { + fprintf(stderr, "warning: different zlib version\n"); + } + + compr = (Byte*)calloc((uInt)comprLen, 1); + uncompr = (Byte*)calloc((uInt)uncomprLen, 1); + /* compr and uncompr are cleared to avoid reading uninitialized + * data and to ensure that uncompr compresses well. + */ + if (compr == Z_NULL || uncompr == Z_NULL) { + printf("out of memory\n"); + exit(1); + } + test_compress(compr, comprLen, uncompr, uncomprLen); + + test_gzio((argc > 1 ? argv[1] : TESTFILE), + (argc > 2 ? argv[2] : TESTFILE), + uncompr, (int)uncomprLen); + + test_deflate(compr, comprLen); + test_inflate(compr, comprLen, uncompr, uncomprLen); + + test_large_deflate(compr, comprLen, uncompr, uncomprLen); + test_large_inflate(compr, comprLen, uncompr, uncomprLen); + + test_flush(compr, &comprLen); + test_sync(compr, comprLen, uncompr, uncomprLen); + comprLen = uncomprLen; + + test_dict_deflate(compr, comprLen); + test_dict_inflate(compr, comprLen, uncompr, uncomprLen); + + exit(0); + return 0; /* to avoid warning */ +} diff --git a/cfe/cfe/zlib/gzio.c b/cfe/cfe/zlib/gzio.c new file mode 100644 index 0000000..6dfd489 --- /dev/null +++ b/cfe/cfe/zlib/gzio.c @@ -0,0 +1,875 @@ +/* gzio.c -- IO on .gz files + * Copyright (C) 1995-1998 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Compile this file with -DNO_DEFLATE to avoid the compression code. + */ + +/* @(#) $Id: gzio.c,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +#include + +#include "zutil.h" + +struct internal_state {int dummy;}; /* for buggy compilers */ + +#ifndef Z_BUFSIZE +# ifdef MAXSEG_64K +# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ +# else +# define Z_BUFSIZE 16384 +# endif +#endif +#ifndef Z_PRINTF_BUFSIZE +# define Z_PRINTF_BUFSIZE 4096 +#endif + +#define ALLOC(size) malloc(size) +#define TRYFREE(p) {if (p) free(p);} + +static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +typedef struct gz_stream { + z_stream stream; + int z_err; /* error code for last stream operation */ + int z_eof; /* set if end of input file */ + FILE *file; /* .gz file */ + Byte *inbuf; /* input buffer */ + Byte *outbuf; /* output buffer */ + uLong crc; /* crc32 of uncompressed data */ + char *msg; /* error message */ + char *path; /* path name for debugging only */ + int transparent; /* 1 if input file is not a .gz file */ + char mode; /* 'w' or 'r' */ + long startpos; /* start of compressed data in file (header skipped) */ +} gz_stream; + + +local gzFile gz_open OF((const char *path, const char *mode, int fd)); +local int do_flush OF((gzFile file, int flush)); +local int get_byte OF((gz_stream *s)); +local void check_header OF((gz_stream *s)); +local int destroy OF((gz_stream *s)); +local void putLong OF((FILE *file, uLong x)); +local uLong getLong OF((gz_stream *s)); + +/* =========================================================================== + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb"). The file is given either by file descriptor + or path name (if fd == -1). + gz_open return NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). +*/ +local gzFile gz_open (path, mode, fd) + const char *path; + const char *mode; + int fd; +{ + int err; + int level = Z_DEFAULT_COMPRESSION; /* compression level */ + int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ + char *p = (char*)mode; + gz_stream *s; + char fmode[80]; /* copy of mode, without the compression level */ + char *m = fmode; + + if (!path || !mode) return Z_NULL; + + s = (gz_stream *)ALLOC(sizeof(gz_stream)); + if (!s) return Z_NULL; + + s->stream.zalloc = (alloc_func)0; + s->stream.zfree = (free_func)0; + s->stream.opaque = (voidpf)0; + s->stream.next_in = s->inbuf = Z_NULL; + s->stream.next_out = s->outbuf = Z_NULL; + s->stream.avail_in = s->stream.avail_out = 0; + s->file = NULL; + s->z_err = Z_OK; + s->z_eof = 0; + s->crc = crc32(0L, Z_NULL, 0); + s->msg = NULL; + s->transparent = 0; + + s->path = (char*)ALLOC(strlen(path)+1); + if (s->path == NULL) { + return destroy(s), (gzFile)Z_NULL; + } + strcpy(s->path, path); /* do this early for debugging */ + + s->mode = '\0'; + do { + if (*p == 'r') s->mode = 'r'; + if (*p == 'w' || *p == 'a') s->mode = 'w'; + if (*p >= '0' && *p <= '9') { + level = *p - '0'; + } else if (*p == 'f') { + strategy = Z_FILTERED; + } else if (*p == 'h') { + strategy = Z_HUFFMAN_ONLY; + } else { + *m++ = *p; /* copy the mode */ + } + } while (*p++ && m != fmode + sizeof(fmode)); + if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; + + if (s->mode == 'w') { +#ifdef NO_DEFLATE + err = Z_STREAM_ERROR; +#else + err = deflateInit2(&(s->stream), level, + Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); + /* windowBits is passed < 0 to suppress zlib header */ + + s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); +#endif + if (err != Z_OK || s->outbuf == Z_NULL) { + return destroy(s), (gzFile)Z_NULL; + } + } else { + s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); + + err = inflateInit2(&(s->stream), -MAX_WBITS); + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are + * present after the compressed stream. + */ + if (err != Z_OK || s->inbuf == Z_NULL) { + return destroy(s), (gzFile)Z_NULL; + } + } + s->stream.avail_out = Z_BUFSIZE; + + errno = 0; + s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); + + if (s->file == NULL) { + return destroy(s), (gzFile)Z_NULL; + } + if (s->mode == 'w') { + /* Write a very simple .gz header: + */ + fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], + Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); + s->startpos = 10L; + /* We use 10L instead of ftell(s->file) to because ftell causes an + * fflush on some systems. This version of the library doesn't use + * startpos anyway in write mode, so this initialization is not + * necessary. + */ + } else { + check_header(s); /* skip the .gz header */ + s->startpos = (ftell(s->file) - s->stream.avail_in); + } + + return (gzFile)s; +} + +/* =========================================================================== + Opens a gzip (.gz) file for reading or writing. +*/ +gzFile ZEXPORT gzopen (path, mode) + const char *path; + const char *mode; +{ + return gz_open (path, mode, -1); +} + +/* =========================================================================== + Associate a gzFile with the file descriptor fd. fd is not dup'ed here + to mimic the behavio(u)r of fdopen. +*/ +gzFile ZEXPORT gzdopen (fd, mode) + int fd; + const char *mode; +{ + char name[20]; + + if (fd < 0) return (gzFile)Z_NULL; + sprintf(name, "", fd); /* for debugging */ + + return gz_open (name, mode, fd); +} + +/* =========================================================================== + * Update the compression level and strategy + */ +int ZEXPORT gzsetparams (file, level, strategy) + gzFile file; + int level; + int strategy; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + /* Make room to allow flushing */ + if (s->stream.avail_out == 0) { + + s->stream.next_out = s->outbuf; + if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { + s->z_err = Z_ERRNO; + } + s->stream.avail_out = Z_BUFSIZE; + } + + return deflateParams (&(s->stream), level, strategy); +} + +/* =========================================================================== + Read a byte from a gz_stream; update next_in and avail_in. Return EOF + for end of file. + IN assertion: the stream s has been sucessfully opened for reading. +*/ +local int get_byte(s) + gz_stream *s; +{ + if (s->z_eof) return EOF; + if (s->stream.avail_in == 0) { + errno = 0; + s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + if (ferror(s->file)) s->z_err = Z_ERRNO; + return EOF; + } + s->stream.next_in = s->inbuf; + } + s->stream.avail_in--; + return *(s->stream.next_in)++; +} + +/* =========================================================================== + Check the gzip header of a gz_stream opened for reading. Set the stream + mode to transparent if the gzip magic header is not present; set s->err + to Z_DATA_ERROR if the magic header is present but the rest of the header + is incorrect. + IN assertion: the stream s has already been created sucessfully; + s->stream.avail_in is zero for the first time, but may be non-zero + for concatenated .gz files. +*/ +local void check_header(s) + gz_stream *s; +{ + int method; /* method byte */ + int flags; /* flags byte */ + uInt len; + int c; + + /* Check the gzip magic header */ + for (len = 0; len < 2; len++) { + c = get_byte(s); + if (c != gz_magic[len]) { + if (len != 0) s->stream.avail_in++, s->stream.next_in--; + if (c != EOF) { + s->stream.avail_in++, s->stream.next_in--; + s->transparent = 1; + } + s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END; + return; + } + } + method = get_byte(s); + flags = get_byte(s); + if (method != Z_DEFLATED || (flags & RESERVED) != 0) { + s->z_err = Z_DATA_ERROR; + return; + } + + /* Discard time, xflags and OS code: */ + for (len = 0; len < 6; len++) (void)get_byte(s); + + if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ + len = (uInt)get_byte(s); + len += ((uInt)get_byte(s))<<8; + /* len is garbage if EOF but the loop below will quit anyway */ + while (len-- != 0 && get_byte(s) != EOF) ; + } + if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ + while ((c = get_byte(s)) != 0 && c != EOF) ; + } + if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ + while ((c = get_byte(s)) != 0 && c != EOF) ; + } + if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ + for (len = 0; len < 2; len++) (void)get_byte(s); + } + s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; +} + + /* =========================================================================== + * Cleanup then free the given gz_stream. Return a zlib error code. + Try freeing in the reverse order of allocations. + */ +local int destroy (s) + gz_stream *s; +{ + int err = Z_OK; + + if (!s) return Z_STREAM_ERROR; + + TRYFREE(s->msg); + + if (s->stream.state != NULL) { + if (s->mode == 'w') { +#ifdef NO_DEFLATE + err = Z_STREAM_ERROR; +#else + err = deflateEnd(&(s->stream)); +#endif + } else if (s->mode == 'r') { + err = inflateEnd(&(s->stream)); + } + } + if (s->file != NULL && fclose(s->file)) { +#ifdef ESPIPE + if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ +#endif + err = Z_ERRNO; + } + if (s->z_err < 0) err = s->z_err; + + TRYFREE(s->inbuf); + TRYFREE(s->outbuf); + TRYFREE(s->path); + TRYFREE(s); + return err; +} + +/* =========================================================================== + Reads the given number of uncompressed bytes from the compressed file. + gzread returns the number of bytes actually read (0 for end of file). +*/ +int ZEXPORT gzread (file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + gz_stream *s = (gz_stream*)file; + Bytef *start = (Bytef*)buf; /* starting point for crc computation */ + Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ + + if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; + + if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; + if (s->z_err == Z_STREAM_END) return 0; /* EOF */ + + next_out = (Byte*)buf; + s->stream.next_out = (Bytef*)buf; + s->stream.avail_out = len; + + while (s->stream.avail_out != 0) { + + if (s->transparent) { + /* Copy first the lookahead bytes: */ + uInt n = s->stream.avail_in; + if (n > s->stream.avail_out) n = s->stream.avail_out; + if (n > 0) { + zmemcpy(s->stream.next_out, s->stream.next_in, n); + next_out += n; + s->stream.next_out = next_out; + s->stream.next_in += n; + s->stream.avail_out -= n; + s->stream.avail_in -= n; + } + if (s->stream.avail_out > 0) { + s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, + s->file); + } + len -= s->stream.avail_out; + s->stream.total_in += (uLong)len; + s->stream.total_out += (uLong)len; + if (len == 0) s->z_eof = 1; + return (int)len; + } + if (s->stream.avail_in == 0 && !s->z_eof) { + + errno = 0; + s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + if (ferror(s->file)) { + s->z_err = Z_ERRNO; + break; + } + } + s->stream.next_in = s->inbuf; + } + s->z_err = inflate(&(s->stream), Z_NO_FLUSH); + + if (s->z_err == Z_STREAM_END) { + /* Check CRC and original size */ + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + start = s->stream.next_out; + + if (getLong(s) != s->crc) { + s->z_err = Z_DATA_ERROR; + } else { + (void)getLong(s); + /* The uncompressed length returned by above getlong() may + * be different from s->stream.total_out) in case of + * concatenated .gz files. Check for such files: + */ + check_header(s); + if (s->z_err == Z_OK) { + uLong total_in = s->stream.total_in; + uLong total_out = s->stream.total_out; + + inflateReset(&(s->stream)); + s->stream.total_in = total_in; + s->stream.total_out = total_out; + s->crc = crc32(0L, Z_NULL, 0); + } + } + } + if (s->z_err != Z_OK || s->z_eof) break; + } + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + + return (int)(len - s->stream.avail_out); +} + + +/* =========================================================================== + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ +int ZEXPORT gzgetc(file) + gzFile file; +{ + unsigned char c; + + return gzread(file, &c, 1) == 1 ? c : -1; +} + + +/* =========================================================================== + Reads bytes from the compressed file until len-1 characters are + read, or a newline character is read and transferred to buf, or an + end-of-file condition is encountered. The string is then terminated + with a null character. + gzgets returns buf, or Z_NULL in case of error. + + The current implementation is not optimized at all. +*/ +char * ZEXPORT gzgets(file, buf, len) + gzFile file; + char *buf; + int len; +{ + char *b = buf; + if (buf == Z_NULL || len <= 0) return Z_NULL; + + while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; + *buf = '\0'; + return b == buf && len > 0 ? Z_NULL : b; +} + + +#ifndef NO_DEFLATE +/* =========================================================================== + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of bytes actually written (0 in case of error). +*/ +int ZEXPORT gzwrite (file, buf, len) + gzFile file; + const voidp buf; + unsigned len; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + s->stream.next_in = (Bytef*)buf; + s->stream.avail_in = len; + + while (s->stream.avail_in != 0) { + + if (s->stream.avail_out == 0) { + + s->stream.next_out = s->outbuf; + if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { + s->z_err = Z_ERRNO; + break; + } + s->stream.avail_out = Z_BUFSIZE; + } + s->z_err = deflate(&(s->stream), Z_NO_FLUSH); + if (s->z_err != Z_OK) break; + } + s->crc = crc32(s->crc, (const Bytef *)buf, len); + + return (int)(len - s->stream.avail_in); +} + +/* =========================================================================== + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). +*/ +#ifdef STDC +#include + +int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) +{ + char buf[Z_PRINTF_BUFSIZE]; + va_list va; + int len; + + va_start(va, format); +#ifdef HAS_vsnprintf + (void)vsnprintf(buf, sizeof(buf), format, va); +#else + (void)vsprintf(buf, format, va); +#endif + va_end(va); + len = strlen(buf); /* some *sprintf don't return the nb of bytes written */ + if (len <= 0) return 0; + + return gzwrite(file, buf, (unsigned)len); +} +#else /* not ANSI C */ + +int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) + gzFile file; + const char *format; + int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +{ + char buf[Z_PRINTF_BUFSIZE]; + int len; + +#ifdef HAS_snprintf + snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +#else + sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +#endif + len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */ + if (len <= 0) return 0; + + return gzwrite(file, buf, len); +} +#endif + +/* =========================================================================== + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ +int ZEXPORT gzputc(file, c) + gzFile file; + int c; +{ + unsigned char cc = (unsigned char) c; /* required for big endian systems */ + + return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; +} + + +/* =========================================================================== + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ +int ZEXPORT gzputs(file, s) + gzFile file; + const char *s; +{ + return gzwrite(file, (char*)s, (unsigned)strlen(s)); +} + + +/* =========================================================================== + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. +*/ +local int do_flush (file, flush) + gzFile file; + int flush; +{ + uInt len; + int done = 0; + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + s->stream.avail_in = 0; /* should be zero already anyway */ + + for (;;) { + len = Z_BUFSIZE - s->stream.avail_out; + + if (len != 0) { + if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { + s->z_err = Z_ERRNO; + return Z_ERRNO; + } + s->stream.next_out = s->outbuf; + s->stream.avail_out = Z_BUFSIZE; + } + if (done) break; + s->z_err = deflate(&(s->stream), flush); + + /* Ignore the second of two consecutive flushes: */ + if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; + + /* deflate has finished flushing only when it hasn't used up + * all the available space in the output buffer: + */ + done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); + + if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; + } + return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; +} + +int ZEXPORT gzflush (file, flush) + gzFile file; + int flush; +{ + gz_stream *s = (gz_stream*)file; + int err = do_flush (file, flush); + + if (err) return err; + fflush(s->file); + return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; +} +#endif /* NO_DEFLATE */ + +/* =========================================================================== + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error. + SEEK_END is not implemented, returns error. + In this version of the library, gzseek can be extremely slow. +*/ +z_off_t ZEXPORT gzseek (file, offset, whence) + gzFile file; + z_off_t offset; + int whence; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || whence == SEEK_END || + s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { + return -1L; + } + + if (s->mode == 'w') { +#ifdef NO_DEFLATE + return -1L; +#else + if (whence == SEEK_SET) { + offset -= s->stream.total_in; + } + if (offset < 0) return -1L; + + /* At this point, offset is the number of zero bytes to write. */ + if (s->inbuf == Z_NULL) { + s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ + zmemzero(s->inbuf, Z_BUFSIZE); + } + while (offset > 0) { + uInt size = Z_BUFSIZE; + if (offset < Z_BUFSIZE) size = (uInt)offset; + + size = gzwrite(file, s->inbuf, size); + if (size == 0) return -1L; + + offset -= size; + } + return (z_off_t)s->stream.total_in; +#endif + } + /* Rest of function is for reading only */ + + /* compute absolute position */ + if (whence == SEEK_CUR) { + offset += s->stream.total_out; + } + if (offset < 0) return -1L; + + if (s->transparent) { + /* map to fseek */ + s->stream.avail_in = 0; + s->stream.next_in = s->inbuf; + if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; + + s->stream.total_in = s->stream.total_out = (uLong)offset; + return offset; + } + + /* For a negative seek, rewind and use positive seek */ + if ((uLong)offset >= s->stream.total_out) { + offset -= s->stream.total_out; + } else if (gzrewind(file) < 0) { + return -1L; + } + /* offset is now the number of bytes to skip. */ + + if (offset != 0 && s->outbuf == Z_NULL) { + s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); + } + while (offset > 0) { + int size = Z_BUFSIZE; + if (offset < Z_BUFSIZE) size = (int)offset; + + size = gzread(file, s->outbuf, (uInt)size); + if (size <= 0) return -1L; + offset -= size; + } + return (z_off_t)s->stream.total_out; +} + +/* =========================================================================== + Rewinds input file. +*/ +int ZEXPORT gzrewind (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'r') return -1; + + s->z_err = Z_OK; + s->z_eof = 0; + s->stream.avail_in = 0; + s->stream.next_in = s->inbuf; + s->crc = crc32(0L, Z_NULL, 0); + + if (s->startpos == 0) { /* not a compressed file */ + rewind(s->file); + return 0; + } + + (void) inflateReset(&s->stream); + return fseek(s->file, s->startpos, SEEK_SET); +} + +/* =========================================================================== + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. +*/ +z_off_t ZEXPORT gztell (file) + gzFile file; +{ + return gzseek(file, 0L, SEEK_CUR); +} + +/* =========================================================================== + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ +int ZEXPORT gzeof (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + return (s == NULL || s->mode != 'r') ? 0 : s->z_eof; +} + +/* =========================================================================== + Outputs a long in LSB order to the given file +*/ +local void putLong (file, x) + FILE *file; + uLong x; +{ + int n; + for (n = 0; n < 4; n++) { + fputc((int)(x & 0xff), file); + x >>= 8; + } +} + +/* =========================================================================== + Reads a long in LSB order from the given gz_stream. Sets z_err in case + of error. +*/ +local uLong getLong (s) + gz_stream *s; +{ + uLong x = (uLong)get_byte(s); + int c; + + x += ((uLong)get_byte(s))<<8; + x += ((uLong)get_byte(s))<<16; + c = get_byte(s); + if (c == EOF) s->z_err = Z_DATA_ERROR; + x += ((uLong)c)<<24; + return x; +} + +/* =========================================================================== + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. +*/ +int ZEXPORT gzclose (file) + gzFile file; +{ + int err; + gz_stream *s = (gz_stream*)file; + + if (s == NULL) return Z_STREAM_ERROR; + + if (s->mode == 'w') { +#ifdef NO_DEFLATE + return Z_STREAM_ERROR; +#else + err = do_flush (file, Z_FINISH); + if (err != Z_OK) return destroy((gz_stream*)file); + + putLong (s->file, s->crc); + putLong (s->file, s->stream.total_in); +#endif + } + return destroy((gz_stream*)file); +} + +/* =========================================================================== + Returns the error message for the last error which occured on the + given compressed file. errnum is set to zlib error number. If an + error occured in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ +const char* ZEXPORT gzerror (file, errnum) + gzFile file; + int *errnum; +{ + char *m; + gz_stream *s = (gz_stream*)file; + + if (s == NULL) { + *errnum = Z_STREAM_ERROR; + return (const char*)ERR_MSG(Z_STREAM_ERROR); + } + *errnum = s->z_err; + if (*errnum == Z_OK) return (const char*)""; + + m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); + + if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); + + TRYFREE(s->msg); + s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); + strcpy(s->msg, s->path); + strcat(s->msg, ": "); + strcat(s->msg, m); + return (const char*)s->msg; +} diff --git a/cfe/cfe/zlib/infblock.c b/cfe/cfe/zlib/infblock.c new file mode 100644 index 0000000..f4920fa --- /dev/null +++ b/cfe/cfe/zlib/infblock.c @@ -0,0 +1,398 @@ +/* infblock.c -- interpret and process block types to last block + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "infblock.h" +#include "inftrees.h" +#include "infcodes.h" +#include "infutil.h" + +struct inflate_codes_state {int dummy;}; /* for buggy compilers */ + +/* simplify the use of the inflate_huft type with some defines */ +#define exop word.what.Exop +#define bits word.what.Bits + +/* Table for deflate from PKZIP's appnote.txt. */ +local const uInt border[] = { /* Order of the bit length code lengths */ + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + +/* + Notes beyond the 1.93a appnote.txt: + + 1. Distance pointers never point before the beginning of the output + stream. + 2. Distance pointers can point back across blocks, up to 32k away. + 3. There is an implied maximum of 7 bits for the bit length table and + 15 bits for the actual data. + 4. If only one code exists, then it is encoded using one bit. (Zero + would be more efficient, but perhaps a little confusing.) If two + codes exist, they are coded using one bit each (0 and 1). + 5. There is no way of sending zero distance codes--a dummy must be + sent if there are none. (History: a pre 2.0 version of PKZIP would + store blocks with no distance codes, but this was discovered to be + too harsh a criterion.) Valid only for 1.93a. 2.04c does allow + zero distance codes, which is sent as one code of zero bits in + length. + 6. There are up to 286 literal/length codes. Code 256 represents the + end-of-block. Note however that the static length tree defines + 288 codes just to fill out the Huffman codes. Codes 286 and 287 + cannot be used though, since there is no length base or extra bits + defined for them. Similarily, there are up to 30 distance codes. + However, static trees define 32 codes (all 5 bits) to fill out the + Huffman codes, but the last two had better not show up in the data. + 7. Unzip can check dynamic Huffman blocks for complete code sets. + The exception is that a single code would not be complete (see #4). + 8. The five bits following the block type is really the number of + literal codes sent minus 257. + 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits + (1+6+6). Therefore, to output three times the length, you output + three codes (1+1+1), whereas to output four times the same length, + you only need two codes (1+3). Hmm. + 10. In the tree reconstruction algorithm, Code = Code + Increment + only if BitLength(i) is not zero. (Pretty obvious.) + 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) + 12. Note: length code 284 can represent 227-258, but length code 285 + really is 258. The last length deserves its own, short code + since it gets used a lot in very redundant files. The length + 258 is special since 258 - 3 (the min match length) is 255. + 13. The literal/length and distance code bit lengths are read as a + single stream of lengths. It is possible (and advantageous) for + a repeat code (16, 17, or 18) to go across the boundary between + the two sets of lengths. + */ + + +void inflate_blocks_reset(s, z, c) +inflate_blocks_statef *s; +z_streamp z; +uLongf *c; +{ + if (c != Z_NULL) + *c = s->check; + if (s->mode == BTREE || s->mode == DTREE) + ZFREE(z, s->sub.trees.blens); + if (s->mode == CODES) + inflate_codes_free(s->sub.decode.codes, z); + s->mode = TYPE; + s->bitk = 0; + s->bitb = 0; + s->read = s->write = s->window; + if (s->checkfn != Z_NULL) + z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0); + Tracev((stderr, "inflate: blocks reset\n")); +} + + +inflate_blocks_statef *inflate_blocks_new(z, c, w) +z_streamp z; +check_func c; +uInt w; +{ + inflate_blocks_statef *s; + + if ((s = (inflate_blocks_statef *)ZALLOC + (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) + return s; + if ((s->hufts = + (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL) + { + ZFREE(z, s); + return Z_NULL; + } + if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL) + { + ZFREE(z, s->hufts); + ZFREE(z, s); + return Z_NULL; + } + s->end = s->window + w; + s->checkfn = c; + s->mode = TYPE; + Tracev((stderr, "inflate: blocks allocated\n")); + inflate_blocks_reset(s, z, Z_NULL); + return s; +} + + +int inflate_blocks(s, z, r) +inflate_blocks_statef *s; +z_streamp z; +int r; +{ + uInt t; /* temporary storage */ + uLong b; /* bit buffer */ + uInt k; /* bits in bit buffer */ + Bytef *p; /* input data pointer */ + uInt n; /* bytes available there */ + Bytef *q; /* output window write pointer */ + uInt m; /* bytes to end of window or read pointer */ + + /* copy input/output information to locals (UPDATE macro restores) */ + LOAD + + /* process input based on current state */ + while (1) switch (s->mode) + { + case TYPE: + NEEDBITS(3) + t = (uInt)b & 7; + s->last = t & 1; + switch (t >> 1) + { + case 0: /* stored */ + Tracev((stderr, "inflate: stored block%s\n", + s->last ? " (last)" : "")); + DUMPBITS(3) + t = k & 7; /* go to byte boundary */ + DUMPBITS(t) + s->mode = LENS; /* get length of stored block */ + break; + case 1: /* fixed */ + Tracev((stderr, "inflate: fixed codes block%s\n", + s->last ? " (last)" : "")); + { + uInt bl, bd; + inflate_huft *tl, *td; + + inflate_trees_fixed(&bl, &bd, &tl, &td, z); + s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); + if (s->sub.decode.codes == Z_NULL) + { + r = Z_MEM_ERROR; + LEAVE + } + } + DUMPBITS(3) + s->mode = CODES; + break; + case 2: /* dynamic */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + s->last ? " (last)" : "")); + DUMPBITS(3) + s->mode = TABLE; + break; + case 3: /* illegal */ + DUMPBITS(3) + s->mode = BAD; + z->msg = (char*)"invalid block type"; + r = Z_DATA_ERROR; + LEAVE + } + break; + case LENS: + NEEDBITS(32) + if ((((~b) >> 16) & 0xffff) != (b & 0xffff)) + { + s->mode = BAD; + z->msg = (char*)"invalid stored block lengths"; + r = Z_DATA_ERROR; + LEAVE + } + s->sub.left = (uInt)b & 0xffff; + b = k = 0; /* dump bits */ + Tracev((stderr, "inflate: stored length %u\n", s->sub.left)); + s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE); + break; + case STORED: + if (n == 0) + LEAVE + NEEDOUT + t = s->sub.left; + if (t > n) t = n; + if (t > m) t = m; + zmemcpy(q, p, t); + p += t; n -= t; + q += t; m -= t; + if ((s->sub.left -= t) != 0) + break; + Tracev((stderr, "inflate: stored end, %lu total out\n", + z->total_out + (q >= s->read ? q - s->read : + (s->end - s->read) + (q - s->window)))); + s->mode = s->last ? DRY : TYPE; + break; + case TABLE: + NEEDBITS(14) + s->sub.trees.table = t = (uInt)b & 0x3fff; +#ifndef PKZIP_BUG_WORKAROUND + if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) + { + s->mode = BAD; + z->msg = (char*)"too many length or distance symbols"; + r = Z_DATA_ERROR; + LEAVE + } +#endif + t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); + if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL) + { + r = Z_MEM_ERROR; + LEAVE + } + DUMPBITS(14) + s->sub.trees.index = 0; + Tracev((stderr, "inflate: table sizes ok\n")); + s->mode = BTREE; + case BTREE: + while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10)) + { + NEEDBITS(3) + s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7; + DUMPBITS(3) + } + while (s->sub.trees.index < 19) + s->sub.trees.blens[border[s->sub.trees.index++]] = 0; + s->sub.trees.bb = 7; + t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb, + &s->sub.trees.tb, s->hufts, z); + if (t != Z_OK) + { + ZFREE(z, s->sub.trees.blens); + r = t; + if (r == Z_DATA_ERROR) + s->mode = BAD; + LEAVE + } + s->sub.trees.index = 0; + Tracev((stderr, "inflate: bits tree ok\n")); + s->mode = DTREE; + case DTREE: + while (t = s->sub.trees.table, + s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) + { + inflate_huft *h; + uInt i, j, c; + + t = s->sub.trees.bb; + NEEDBITS(t) + h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]); + t = h->bits; + c = h->base; + if (c < 16) + { + DUMPBITS(t) + s->sub.trees.blens[s->sub.trees.index++] = c; + } + else /* c == 16..18 */ + { + i = c == 18 ? 7 : c - 14; + j = c == 18 ? 11 : 3; + NEEDBITS(t + i) + DUMPBITS(t) + j += (uInt)b & inflate_mask[i]; + DUMPBITS(i) + i = s->sub.trees.index; + t = s->sub.trees.table; + if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || + (c == 16 && i < 1)) + { + ZFREE(z, s->sub.trees.blens); + s->mode = BAD; + z->msg = (char*)"invalid bit length repeat"; + r = Z_DATA_ERROR; + LEAVE + } + c = c == 16 ? s->sub.trees.blens[i - 1] : 0; + do { + s->sub.trees.blens[i++] = c; + } while (--j); + s->sub.trees.index = i; + } + } + s->sub.trees.tb = Z_NULL; + { + uInt bl, bd; + inflate_huft *tl, *td; + inflate_codes_statef *c; + + bl = 9; /* must be <= 9 for lookahead assumptions */ + bd = 6; /* must be <= 9 for lookahead assumptions */ + t = s->sub.trees.table; + t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), + s->sub.trees.blens, &bl, &bd, &tl, &td, + s->hufts, z); + ZFREE(z, s->sub.trees.blens); + if (t != Z_OK) + { + if (t == (uInt)Z_DATA_ERROR) + s->mode = BAD; + r = t; + LEAVE + } + Tracev((stderr, "inflate: trees ok\n")); + if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) + { + r = Z_MEM_ERROR; + LEAVE + } + s->sub.decode.codes = c; + } + s->mode = CODES; + case CODES: + UPDATE + if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) + return inflate_flush(s, z, r); + r = Z_OK; + inflate_codes_free(s->sub.decode.codes, z); + LOAD + Tracev((stderr, "inflate: codes end, %lu total out\n", + z->total_out + (q >= s->read ? q - s->read : + (s->end - s->read) + (q - s->window)))); + if (!s->last) + { + s->mode = TYPE; + break; + } + s->mode = DRY; + case DRY: + FLUSH + if (s->read != s->write) + LEAVE + s->mode = DONE; + case DONE: + r = Z_STREAM_END; + LEAVE + case BAD: + r = Z_DATA_ERROR; + LEAVE + default: + r = Z_STREAM_ERROR; + LEAVE + } +} + + +int inflate_blocks_free(s, z) +inflate_blocks_statef *s; +z_streamp z; +{ + inflate_blocks_reset(s, z, Z_NULL); + ZFREE(z, s->window); + ZFREE(z, s->hufts); + ZFREE(z, s); + Tracev((stderr, "inflate: blocks freed\n")); + return Z_OK; +} + + +void inflate_set_dictionary(s, d, n) +inflate_blocks_statef *s; +const Bytef *d; +uInt n; +{ + zmemcpy(s->window, d, n); + s->read = s->write = s->window + n; +} + + +/* Returns true if inflate is currently at the end of a block generated + * by Z_SYNC_FLUSH or Z_FULL_FLUSH. + * IN assertion: s != Z_NULL + */ +int inflate_blocks_sync_point(s) +inflate_blocks_statef *s; +{ + return s->mode == LENS; +} diff --git a/cfe/cfe/zlib/infblock.h b/cfe/cfe/zlib/infblock.h new file mode 100644 index 0000000..bd25c80 --- /dev/null +++ b/cfe/cfe/zlib/infblock.h @@ -0,0 +1,39 @@ +/* infblock.h -- header to use infblock.c + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +struct inflate_blocks_state; +typedef struct inflate_blocks_state FAR inflate_blocks_statef; + +extern inflate_blocks_statef * inflate_blocks_new OF(( + z_streamp z, + check_func c, /* check function */ + uInt w)); /* window size */ + +extern int inflate_blocks OF(( + inflate_blocks_statef *, + z_streamp , + int)); /* initial return code */ + +extern void inflate_blocks_reset OF(( + inflate_blocks_statef *, + z_streamp , + uLongf *)); /* check value on output */ + +extern int inflate_blocks_free OF(( + inflate_blocks_statef *, + z_streamp)); + +extern void inflate_set_dictionary OF(( + inflate_blocks_statef *s, + const Bytef *d, /* dictionary */ + uInt n)); /* dictionary length */ + +extern int inflate_blocks_sync_point OF(( + inflate_blocks_statef *s)); diff --git a/cfe/cfe/zlib/infcodes.c b/cfe/cfe/zlib/infcodes.c new file mode 100644 index 0000000..d4e5ee9 --- /dev/null +++ b/cfe/cfe/zlib/infcodes.c @@ -0,0 +1,257 @@ +/* infcodes.c -- process literals and length/distance pairs + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "infblock.h" +#include "infcodes.h" +#include "infutil.h" +#include "inffast.h" + +/* simplify the use of the inflate_huft type with some defines */ +#define exop word.what.Exop +#define bits word.what.Bits + +typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ + START, /* x: set up for LEN */ + LEN, /* i: get length/literal/eob next */ + LENEXT, /* i: getting length extra (have base) */ + DIST, /* i: get distance next */ + DISTEXT, /* i: getting distance extra */ + COPY, /* o: copying bytes in window, waiting for space */ + LIT, /* o: got literal, waiting for output space */ + WASH, /* o: got eob, possibly still output waiting */ + END, /* x: got eob and all data flushed */ + BADCODE} /* x: got error */ +inflate_codes_mode; + +/* inflate codes private state */ +struct inflate_codes_state { + + /* mode */ + inflate_codes_mode mode; /* current inflate_codes mode */ + + /* mode dependent information */ + uInt len; + union { + struct { + inflate_huft *tree; /* pointer into tree */ + uInt need; /* bits needed */ + } code; /* if LEN or DIST, where in tree */ + uInt lit; /* if LIT, literal */ + struct { + uInt get; /* bits to get for extra */ + uInt dist; /* distance back to copy from */ + } copy; /* if EXT or COPY, where and how much */ + } sub; /* submode */ + + /* mode independent information */ + Byte lbits; /* ltree bits decoded per branch */ + Byte dbits; /* dtree bits decoder per branch */ + inflate_huft *ltree; /* literal/length/eob tree */ + inflate_huft *dtree; /* distance tree */ + +}; + + +inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z) +uInt bl, bd; +inflate_huft *tl; +inflate_huft *td; /* need separate declaration for Borland C++ */ +z_streamp z; +{ + inflate_codes_statef *c; + + if ((c = (inflate_codes_statef *) + ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL) + { + c->mode = START; + c->lbits = (Byte)bl; + c->dbits = (Byte)bd; + c->ltree = tl; + c->dtree = td; + Tracev((stderr, "inflate: codes new\n")); + } + return c; +} + + +int inflate_codes(s, z, r) +inflate_blocks_statef *s; +z_streamp z; +int r; +{ + uInt j; /* temporary storage */ + inflate_huft *t; /* temporary pointer */ + uInt e; /* extra bits or operation */ + uLong b; /* bit buffer */ + uInt k; /* bits in bit buffer */ + Bytef *p; /* input data pointer */ + uInt n; /* bytes available there */ + Bytef *q; /* output window write pointer */ + uInt m; /* bytes to end of window or read pointer */ + Bytef *f; /* pointer to copy strings from */ + inflate_codes_statef *c = s->sub.decode.codes; /* codes state */ + + /* copy input/output information to locals (UPDATE macro restores) */ + LOAD + + /* process input and output based on current state */ + while (1) switch (c->mode) + { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ + case START: /* x: set up for LEN */ +#ifndef SLOW + if (m >= 258 && n >= 10) + { + UPDATE + r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z); + LOAD + if (r != Z_OK) + { + c->mode = r == Z_STREAM_END ? WASH : BADCODE; + break; + } + } +#endif /* !SLOW */ + c->sub.code.need = c->lbits; + c->sub.code.tree = c->ltree; + c->mode = LEN; + case LEN: /* i: get length/literal/eob next */ + j = c->sub.code.need; + NEEDBITS(j) + t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); + DUMPBITS(t->bits) + e = (uInt)(t->exop); + if (e == 0) /* literal */ + { + c->sub.lit = t->base; + Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", t->base)); + c->mode = LIT; + break; + } + if (e & 16) /* length */ + { + c->sub.copy.get = e & 15; + c->len = t->base; + c->mode = LENEXT; + break; + } + if ((e & 64) == 0) /* next table */ + { + c->sub.code.need = e; + c->sub.code.tree = t + t->base; + break; + } + if (e & 32) /* end of block */ + { + Tracevv((stderr, "inflate: end of block\n")); + c->mode = WASH; + break; + } + c->mode = BADCODE; /* invalid code */ + z->msg = (char*)"invalid literal/length code"; + r = Z_DATA_ERROR; + LEAVE + case LENEXT: /* i: getting length extra (have base) */ + j = c->sub.copy.get; + NEEDBITS(j) + c->len += (uInt)b & inflate_mask[j]; + DUMPBITS(j) + c->sub.code.need = c->dbits; + c->sub.code.tree = c->dtree; + Tracevv((stderr, "inflate: length %u\n", c->len)); + c->mode = DIST; + case DIST: /* i: get distance next */ + j = c->sub.code.need; + NEEDBITS(j) + t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); + DUMPBITS(t->bits) + e = (uInt)(t->exop); + if (e & 16) /* distance */ + { + c->sub.copy.get = e & 15; + c->sub.copy.dist = t->base; + c->mode = DISTEXT; + break; + } + if ((e & 64) == 0) /* next table */ + { + c->sub.code.need = e; + c->sub.code.tree = t + t->base; + break; + } + c->mode = BADCODE; /* invalid code */ + z->msg = (char*)"invalid distance code"; + r = Z_DATA_ERROR; + LEAVE + case DISTEXT: /* i: getting distance extra */ + j = c->sub.copy.get; + NEEDBITS(j) + c->sub.copy.dist += (uInt)b & inflate_mask[j]; + DUMPBITS(j) + Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); + c->mode = COPY; + case COPY: /* o: copying bytes in window, waiting for space */ +#ifndef __TURBOC__ /* Turbo C bug for following expression */ + f = (uInt)(q - s->window) < c->sub.copy.dist ? + s->end - (c->sub.copy.dist - (q - s->window)) : + q - c->sub.copy.dist; +#else + f = q - c->sub.copy.dist; + if ((uInt)(q - s->window) < c->sub.copy.dist) + f = s->end - (c->sub.copy.dist - (uInt)(q - s->window)); +#endif + while (c->len) + { + NEEDOUT + OUTBYTE(*f++) + if (f == s->end) + f = s->window; + c->len--; + } + c->mode = START; + break; + case LIT: /* o: got literal, waiting for output space */ + NEEDOUT + OUTBYTE(c->sub.lit) + c->mode = START; + break; + case WASH: /* o: got eob, possibly more output */ + if (k > 7) /* return unused byte, if any */ + { + Assert(k < 16, "inflate_codes grabbed too many bytes") + k -= 8; + n++; + p--; /* can always return one */ + } + FLUSH + if (s->read != s->write) + LEAVE + c->mode = END; + case END: + r = Z_STREAM_END; + LEAVE + case BADCODE: /* x: got error */ + r = Z_DATA_ERROR; + LEAVE + default: + r = Z_STREAM_ERROR; + LEAVE + } +#ifdef NEED_DUMMY_RETURN + return Z_STREAM_ERROR; /* Some dumb compilers complain without this */ +#endif +} + + +void inflate_codes_free(c, z) +inflate_codes_statef *c; +z_streamp z; +{ + ZFREE(z, c); + Tracev((stderr, "inflate: codes free\n")); +} diff --git a/cfe/cfe/zlib/infcodes.h b/cfe/cfe/zlib/infcodes.h new file mode 100644 index 0000000..6c750d8 --- /dev/null +++ b/cfe/cfe/zlib/infcodes.h @@ -0,0 +1,27 @@ +/* infcodes.h -- header to use infcodes.c + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +struct inflate_codes_state; +typedef struct inflate_codes_state FAR inflate_codes_statef; + +extern inflate_codes_statef *inflate_codes_new OF(( + uInt, uInt, + inflate_huft *, inflate_huft *, + z_streamp )); + +extern int inflate_codes OF(( + inflate_blocks_statef *, + z_streamp , + int)); + +extern void inflate_codes_free OF(( + inflate_codes_statef *, + z_streamp )); + diff --git a/cfe/cfe/zlib/inffast.c b/cfe/cfe/zlib/inffast.c new file mode 100644 index 0000000..61a78ee --- /dev/null +++ b/cfe/cfe/zlib/inffast.c @@ -0,0 +1,170 @@ +/* inffast.c -- process literals and length/distance pairs fast + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "infblock.h" +#include "infcodes.h" +#include "infutil.h" +#include "inffast.h" + +struct inflate_codes_state {int dummy;}; /* for buggy compilers */ + +/* simplify the use of the inflate_huft type with some defines */ +#define exop word.what.Exop +#define bits word.what.Bits + +/* macros for bit input with no checking and for returning unused bytes */ +#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3;} + +/* Called with number of bytes left to write in window at least 258 + (the maximum string length) and number of input bytes available + at least ten. The ten bytes are six bytes for the longest length/ + distance pair plus four bytes for overloading the bit buffer. */ + +int inflate_fast(bl, bd, tl, td, s, z) +uInt bl, bd; +inflate_huft *tl; +inflate_huft *td; /* need separate declaration for Borland C++ */ +inflate_blocks_statef *s; +z_streamp z; +{ + inflate_huft *t; /* temporary pointer */ + uInt e; /* extra bits or operation */ + uLong b; /* bit buffer */ + uInt k; /* bits in bit buffer */ + Bytef *p; /* input data pointer */ + uInt n; /* bytes available there */ + Bytef *q; /* output window write pointer */ + uInt m; /* bytes to end of window or read pointer */ + uInt ml; /* mask for literal/length tree */ + uInt md; /* mask for distance tree */ + uInt c; /* bytes to copy */ + uInt d; /* distance back to copy from */ + Bytef *r; /* copy source pointer */ + + /* load input, output, bit values */ + LOAD + + /* initialize masks */ + ml = inflate_mask[bl]; + md = inflate_mask[bd]; + + /* do until not enough input or output space for fast loop */ + do { /* assume called with m >= 258 && n >= 10 */ + /* get literal/length code */ + GRABBITS(20) /* max bits for literal/length code */ + if ((e = (t = tl + ((uInt)b & ml))->exop) == 0) + { + DUMPBITS(t->bits) + Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? + "inflate: * literal '%c'\n" : + "inflate: * literal 0x%02x\n", t->base)); + *q++ = (Byte)t->base; + m--; + continue; + } + do { + DUMPBITS(t->bits) + if (e & 16) + { + /* get extra bits for length */ + e &= 15; + c = t->base + ((uInt)b & inflate_mask[e]); + DUMPBITS(e) + Tracevv((stderr, "inflate: * length %u\n", c)); + + /* decode distance base of block to copy */ + GRABBITS(15); /* max bits for distance code */ + e = (t = td + ((uInt)b & md))->exop; + do { + DUMPBITS(t->bits) + if (e & 16) + { + /* get extra bits to add to distance base */ + e &= 15; + GRABBITS(e) /* get extra bits (up to 13) */ + d = t->base + ((uInt)b & inflate_mask[e]); + DUMPBITS(e) + Tracevv((stderr, "inflate: * distance %u\n", d)); + + /* do the copy */ + m -= c; + if ((uInt)(q - s->window) >= d) /* offset before dest */ + { /* just copy */ + r = q - d; + *q++ = *r++; c--; /* minimum count is three, */ + *q++ = *r++; c--; /* so unroll loop a little */ + } + else /* else offset after destination */ + { + e = d - (uInt)(q - s->window); /* bytes from offset to end */ + r = s->end - e; /* pointer to offset */ + if (c > e) /* if source crosses, */ + { + c -= e; /* copy to end of window */ + do { + *q++ = *r++; + } while (--e); + r = s->window; /* copy rest from start of window */ + } + } + do { /* copy all or what's left */ + *q++ = *r++; + } while (--c); + break; + } + else if ((e & 64) == 0) + { + t += t->base; + e = (t += ((uInt)b & inflate_mask[e]))->exop; + } + else + { + z->msg = (char*)"invalid distance code"; + UNGRAB + UPDATE + return Z_DATA_ERROR; + } + } while (1); + break; + } + if ((e & 64) == 0) + { + t += t->base; + if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0) + { + DUMPBITS(t->bits) + Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? + "inflate: * literal '%c'\n" : + "inflate: * literal 0x%02x\n", t->base)); + *q++ = (Byte)t->base; + m--; + break; + } + } + else if (e & 32) + { + Tracevv((stderr, "inflate: * end of block\n")); + UNGRAB + UPDATE + return Z_STREAM_END; + } + else + { + z->msg = (char*)"invalid literal/length code"; + UNGRAB + UPDATE + return Z_DATA_ERROR; + } + } while (1); + } while (m >= 258 && n >= 10); + + /* not enough input or output--restore pointers and return */ + UNGRAB + UPDATE + return Z_OK; +} diff --git a/cfe/cfe/zlib/inffast.h b/cfe/cfe/zlib/inffast.h new file mode 100644 index 0000000..8facec5 --- /dev/null +++ b/cfe/cfe/zlib/inffast.h @@ -0,0 +1,17 @@ +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +extern int inflate_fast OF(( + uInt, + uInt, + inflate_huft *, + inflate_huft *, + inflate_blocks_statef *, + z_streamp )); diff --git a/cfe/cfe/zlib/inffixed.h b/cfe/cfe/zlib/inffixed.h new file mode 100644 index 0000000..77f7e76 --- /dev/null +++ b/cfe/cfe/zlib/inffixed.h @@ -0,0 +1,151 @@ +/* inffixed.h -- table for decoding fixed codes + * Generated automatically by the maketree.c program + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +local uInt fixed_bl = 9; +local uInt fixed_bd = 5; +local inflate_huft fixed_tl[] = { + {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, + {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192}, + {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160}, + {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224}, + {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144}, + {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208}, + {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176}, + {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240}, + {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, + {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200}, + {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168}, + {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232}, + {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152}, + {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216}, + {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184}, + {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248}, + {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, + {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196}, + {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164}, + {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228}, + {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148}, + {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212}, + {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180}, + {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244}, + {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, + {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204}, + {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172}, + {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236}, + {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156}, + {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220}, + {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188}, + {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252}, + {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, + {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194}, + {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162}, + {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226}, + {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146}, + {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210}, + {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178}, + {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242}, + {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, + {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202}, + {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170}, + {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234}, + {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154}, + {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218}, + {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186}, + {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250}, + {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, + {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198}, + {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166}, + {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230}, + {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150}, + {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214}, + {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182}, + {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246}, + {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, + {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206}, + {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174}, + {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238}, + {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158}, + {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222}, + {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190}, + {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254}, + {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, + {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193}, + {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161}, + {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225}, + {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145}, + {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209}, + {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177}, + {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241}, + {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, + {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201}, + {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169}, + {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233}, + {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153}, + {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217}, + {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185}, + {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249}, + {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, + {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197}, + {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165}, + {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229}, + {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149}, + {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213}, + {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181}, + {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245}, + {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, + {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205}, + {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173}, + {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237}, + {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157}, + {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221}, + {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189}, + {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253}, + {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, + {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195}, + {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163}, + {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227}, + {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147}, + {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211}, + {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179}, + {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243}, + {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, + {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203}, + {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171}, + {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235}, + {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155}, + {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219}, + {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187}, + {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251}, + {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, + {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199}, + {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167}, + {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231}, + {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151}, + {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215}, + {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183}, + {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247}, + {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, + {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207}, + {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175}, + {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239}, + {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159}, + {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223}, + {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191}, + {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255} + }; +local inflate_huft fixed_td[] = { + {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097}, + {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385}, + {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193}, + {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577}, + {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145}, + {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577}, + {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289}, + {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577} + }; diff --git a/cfe/cfe/zlib/inflate.c b/cfe/cfe/zlib/inflate.c new file mode 100644 index 0000000..32e9b8d --- /dev/null +++ b/cfe/cfe/zlib/inflate.c @@ -0,0 +1,366 @@ +/* inflate.c -- zlib interface to inflate modules + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "infblock.h" + +struct inflate_blocks_state {int dummy;}; /* for buggy compilers */ + +typedef enum { + METHOD, /* waiting for method byte */ + FLAG, /* waiting for flag byte */ + DICT4, /* four dictionary check bytes to go */ + DICT3, /* three dictionary check bytes to go */ + DICT2, /* two dictionary check bytes to go */ + DICT1, /* one dictionary check byte to go */ + DICT0, /* waiting for inflateSetDictionary */ + BLOCKS, /* decompressing blocks */ + CHECK4, /* four check bytes to go */ + CHECK3, /* three check bytes to go */ + CHECK2, /* two check bytes to go */ + CHECK1, /* one check byte to go */ + DONE, /* finished check, done */ + BAD} /* got an error--stay here */ +inflate_mode; + +/* inflate private state */ +struct internal_state { + + /* mode */ + inflate_mode mode; /* current inflate mode */ + + /* mode dependent information */ + union { + uInt method; /* if FLAGS, method byte */ + struct { + uLong was; /* computed check value */ + uLong need; /* stream check value */ + } check; /* if CHECK, check values to compare */ + uInt marker; /* if BAD, inflateSync's marker bytes count */ + } sub; /* submode */ + + /* mode independent information */ + int nowrap; /* flag for no wrapper */ + uInt wbits; /* log2(window size) (8..15, defaults to 15) */ + inflate_blocks_statef + *blocks; /* current inflate_blocks state */ + +}; + + +int ZEXPORT inflateReset(z) +z_streamp z; +{ + if (z == Z_NULL || z->state == Z_NULL) + return Z_STREAM_ERROR; + z->total_in = z->total_out = 0; + z->msg = Z_NULL; + z->state->mode = z->state->nowrap ? BLOCKS : METHOD; + inflate_blocks_reset(z->state->blocks, z, Z_NULL); + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + + +int ZEXPORT inflateEnd(z) +z_streamp z; +{ + if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL) + return Z_STREAM_ERROR; + if (z->state->blocks != Z_NULL) + inflate_blocks_free(z->state->blocks, z); + ZFREE(z, z->state); + z->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + + +int ZEXPORT inflateInit2_(z, w, version, stream_size) +z_streamp z; +int w; +const char *version; +int stream_size; +{ + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != sizeof(z_stream)) + return Z_VERSION_ERROR; + + /* initialize state */ + if (z == Z_NULL) + return Z_STREAM_ERROR; + z->msg = Z_NULL; + if (z->zalloc == Z_NULL) + { + z->zalloc = zcalloc; + z->opaque = (voidpf)0; + } + if (z->zfree == Z_NULL) z->zfree = zcfree; + if ((z->state = (struct internal_state FAR *) + ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) + return Z_MEM_ERROR; + z->state->blocks = Z_NULL; + + /* handle undocumented nowrap option (no zlib header or check) */ + z->state->nowrap = 0; + if (w < 0) + { + w = - w; + z->state->nowrap = 1; + } + + /* set window size */ + if (w < 8 || w > 15) + { + inflateEnd(z); + return Z_STREAM_ERROR; + } + z->state->wbits = (uInt)w; + + /* create inflate_blocks state */ + if ((z->state->blocks = + inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w)) + == Z_NULL) + { + inflateEnd(z); + return Z_MEM_ERROR; + } + Tracev((stderr, "inflate: allocated\n")); + + /* reset state */ + inflateReset(z); + return Z_OK; +} + + +int ZEXPORT inflateInit_(z, version, stream_size) +z_streamp z; +const char *version; +int stream_size; +{ + return inflateInit2_(z, DEF_WBITS, version, stream_size); +} + + +#define NEEDBYTE {if(z->avail_in==0)return r;r=f;} +#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++) + +int ZEXPORT inflate(z, f) +z_streamp z; +int f; +{ + int r; + uInt b; + + if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL) + return Z_STREAM_ERROR; + f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK; + r = Z_BUF_ERROR; + while (1) switch (z->state->mode) + { + case METHOD: + NEEDBYTE + if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED) + { + z->state->mode = BAD; + z->msg = (char*)"unknown compression method"; + z->state->sub.marker = 5; /* can't try inflateSync */ + break; + } + if ((z->state->sub.method >> 4) + 8 > z->state->wbits) + { + z->state->mode = BAD; + z->msg = (char*)"invalid window size"; + z->state->sub.marker = 5; /* can't try inflateSync */ + break; + } + z->state->mode = FLAG; + case FLAG: + NEEDBYTE + b = NEXTBYTE; + if (((z->state->sub.method << 8) + b) % 31) + { + z->state->mode = BAD; + z->msg = (char*)"incorrect header check"; + z->state->sub.marker = 5; /* can't try inflateSync */ + break; + } + Tracev((stderr, "inflate: zlib header ok\n")); + if (!(b & PRESET_DICT)) + { + z->state->mode = BLOCKS; + break; + } + z->state->mode = DICT4; + case DICT4: + NEEDBYTE + z->state->sub.check.need = (uLong)NEXTBYTE << 24; + z->state->mode = DICT3; + case DICT3: + NEEDBYTE + z->state->sub.check.need += (uLong)NEXTBYTE << 16; + z->state->mode = DICT2; + case DICT2: + NEEDBYTE + z->state->sub.check.need += (uLong)NEXTBYTE << 8; + z->state->mode = DICT1; + case DICT1: + NEEDBYTE + z->state->sub.check.need += (uLong)NEXTBYTE; + z->adler = z->state->sub.check.need; + z->state->mode = DICT0; + return Z_NEED_DICT; + case DICT0: + z->state->mode = BAD; + z->msg = (char*)"need dictionary"; + z->state->sub.marker = 0; /* can try inflateSync */ + return Z_STREAM_ERROR; + case BLOCKS: + r = inflate_blocks(z->state->blocks, z, r); + if (r == Z_DATA_ERROR) + { + z->state->mode = BAD; + z->state->sub.marker = 0; /* can try inflateSync */ + break; + } + if (r == Z_OK) + r = f; + if (r != Z_STREAM_END) + return r; + r = f; + inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was); + if (z->state->nowrap) + { + z->state->mode = DONE; + break; + } + z->state->mode = CHECK4; + case CHECK4: + NEEDBYTE + z->state->sub.check.need = (uLong)NEXTBYTE << 24; + z->state->mode = CHECK3; + case CHECK3: + NEEDBYTE + z->state->sub.check.need += (uLong)NEXTBYTE << 16; + z->state->mode = CHECK2; + case CHECK2: + NEEDBYTE + z->state->sub.check.need += (uLong)NEXTBYTE << 8; + z->state->mode = CHECK1; + case CHECK1: + NEEDBYTE + z->state->sub.check.need += (uLong)NEXTBYTE; + + if (z->state->sub.check.was != z->state->sub.check.need) + { + z->state->mode = BAD; + z->msg = (char*)"incorrect data check"; + z->state->sub.marker = 5; /* can't try inflateSync */ + break; + } + Tracev((stderr, "inflate: zlib check ok\n")); + z->state->mode = DONE; + case DONE: + return Z_STREAM_END; + case BAD: + return Z_DATA_ERROR; + default: + return Z_STREAM_ERROR; + } +#ifdef NEED_DUMMY_RETURN + return Z_STREAM_ERROR; /* Some dumb compilers complain without this */ +#endif +} + + +int ZEXPORT inflateSetDictionary(z, dictionary, dictLength) +z_streamp z; +const Bytef *dictionary; +uInt dictLength; +{ + uInt length = dictLength; + + if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0) + return Z_STREAM_ERROR; + + if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR; + z->adler = 1L; + + if (length >= ((uInt)1<state->wbits)) + { + length = (1<state->wbits)-1; + dictionary += dictLength - length; + } + inflate_set_dictionary(z->state->blocks, dictionary, length); + z->state->mode = BLOCKS; + return Z_OK; +} + + +int ZEXPORT inflateSync(z) +z_streamp z; +{ + uInt n; /* number of bytes to look at */ + Bytef *p; /* pointer to bytes */ + uInt m; /* number of marker bytes found in a row */ + uLong r, w; /* temporaries to save total_in and total_out */ + + /* set up */ + if (z == Z_NULL || z->state == Z_NULL) + return Z_STREAM_ERROR; + if (z->state->mode != BAD) + { + z->state->mode = BAD; + z->state->sub.marker = 0; + } + if ((n = z->avail_in) == 0) + return Z_BUF_ERROR; + p = z->next_in; + m = z->state->sub.marker; + + /* search */ + while (n && m < 4) + { + static const Byte mark[4] = {0, 0, 0xff, 0xff}; + if (*p == mark[m]) + m++; + else if (*p) + m = 0; + else + m = 4 - m; + p++, n--; + } + + /* restore */ + z->total_in += p - z->next_in; + z->next_in = p; + z->avail_in = n; + z->state->sub.marker = m; + + /* return no joy or set up to restart on a new block */ + if (m != 4) + return Z_DATA_ERROR; + r = z->total_in; w = z->total_out; + inflateReset(z); + z->total_in = r; z->total_out = w; + z->state->mode = BLOCKS; + return Z_OK; +} + + +/* Returns true if inflate is currently at the end of a block generated + * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH + * but removes the length bytes of the resulting empty stored block. When + * decompressing, PPP checks that at the end of input packet, inflate is + * waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(z) +z_streamp z; +{ + if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL) + return Z_STREAM_ERROR; + return inflate_blocks_sync_point(z->state->blocks); +} diff --git a/cfe/cfe/zlib/inftrees.c b/cfe/cfe/zlib/inftrees.c new file mode 100644 index 0000000..ef1e0b6 --- /dev/null +++ b/cfe/cfe/zlib/inftrees.c @@ -0,0 +1,455 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#if !defined(BUILDFIXED) && !defined(STDC) +# define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */ +#endif + +const char inflate_copyright[] = + " inflate 1.1.3 Copyright 1995-1998 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ +struct internal_state {int dummy;}; /* for buggy compilers */ + +/* simplify the use of the inflate_huft type with some defines */ +#define exop word.what.Exop +#define bits word.what.Bits + + +local int huft_build OF(( + uIntf *, /* code lengths in bits */ + uInt, /* number of codes */ + uInt, /* number of "simple" codes */ + const uIntf *, /* list of base values for non-simple codes */ + const uIntf *, /* list of extra bits for non-simple codes */ + inflate_huft * FAR*,/* result: starting table */ + uIntf *, /* maximum lookup bits (returns actual) */ + inflate_huft *, /* space for trees */ + uInt *, /* hufts used in space */ + uIntf * )); /* space for values */ + +/* Tables for deflate from PKZIP's appnote.txt. */ +local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + /* see note #13 above about 258 */ +local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */ +local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577}; +local const uInt cpdext[30] = { /* Extra bits for distance codes */ + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13}; + +/* + Huffman code decoding is performed using a multi-level table lookup. + The fastest way to decode is to simply build a lookup table whose + size is determined by the longest code. However, the time it takes + to build this table can also be a factor if the data being decoded + is not very long. The most common codes are necessarily the + shortest codes, so those codes dominate the decoding time, and hence + the speed. The idea is you can have a shorter table that decodes the + shorter, more probable codes, and then point to subsidiary tables for + the longer codes. The time it costs to decode the longer codes is + then traded against the time it takes to make longer tables. + + This results of this trade are in the variables lbits and dbits + below. lbits is the number of bits the first level table for literal/ + length codes can decode in one step, and dbits is the same thing for + the distance codes. Subsequent tables are also less than or equal to + those sizes. These values may be adjusted either when all of the + codes are shorter than that, in which case the longest code length in + bits is used, or when the shortest code is *longer* than the requested + table size, in which case the length of the shortest code in bits is + used. + + There are two different values for the two tables, since they code a + different number of possibilities each. The literal/length table + codes 286 possible values, or in a flat code, a little over eight + bits. The distance table codes 30 possible values, or a little less + than five bits, flat. The optimum values for speed end up being + about one bit more than those, so lbits is 8+1 and dbits is 5+1. + The optimum values may differ though from machine to machine, and + possibly even between compilers. Your mileage may vary. + */ + + +/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */ +#define BMAX 15 /* maximum bit length of any code */ + +local int huft_build(b, n, s, d, e, t, m, hp, hn, v) +uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ +uInt n; /* number of codes (assumed <= 288) */ +uInt s; /* number of simple-valued codes (0..s-1) */ +const uIntf *d; /* list of base values for non-simple codes */ +const uIntf *e; /* list of extra bits for non-simple codes */ +inflate_huft * FAR *t; /* result: starting table */ +uIntf *m; /* maximum lookup bits, returns actual */ +inflate_huft *hp; /* space for trees */ +uInt *hn; /* hufts used in space */ +uIntf *v; /* working area: values in order of bit length */ +/* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR + if the given code set is incomplete (the tables are still built in this + case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of + lengths), or Z_MEM_ERROR if not enough memory. */ +{ + + uInt a; /* counter for codes of length k */ + uInt c[BMAX+1]; /* bit length count table */ + uInt f; /* i repeats in table every f entries */ + int g; /* maximum code length */ + int h; /* table level */ + register uInt i; /* counter, current code */ + register uInt j; /* counter */ + register int k; /* number of bits in current code */ + int l; /* bits per table (returned in m) */ + uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */ + register uIntf *p; /* pointer into c[], b[], or v[] */ + inflate_huft *q; /* points to current table */ + struct inflate_huft_s r; /* table entry for structure assignment */ + inflate_huft *u[BMAX]; /* table stack */ + register int w; /* bits before this table == (l * h) */ + uInt x[BMAX+1]; /* bit offsets, then code stack */ + uIntf *xp; /* pointer into x */ + int y; /* number of dummy codes added */ + uInt z; /* number of entries in current table */ + + + /* Generate counts for each bit length */ + p = c; +#define C0 *p++ = 0; +#define C2 C0 C0 C0 C0 +#define C4 C2 C2 C2 C2 + C4 /* clear c[]--assume BMAX+1 is 16 */ + p = b; i = n; + do { + c[*p++]++; /* assume all entries <= BMAX */ + } while (--i); + if (c[0] == n) /* null input--all zero length codes */ + { + *t = (inflate_huft *)Z_NULL; + *m = 0; + return Z_OK; + } + + + /* Find minimum and maximum length, bound *m by those */ + l = *m; + for (j = 1; j <= BMAX; j++) + if (c[j]) + break; + k = j; /* minimum code length */ + if ((uInt)l < j) + l = j; + for (i = BMAX; i; i--) + if (c[i]) + break; + g = i; /* maximum code length */ + if ((uInt)l > i) + l = i; + *m = l; + + + /* Adjust last length count to fill out codes, if needed */ + for (y = 1 << j; j < i; j++, y <<= 1) + if ((y -= c[j]) < 0) + return Z_DATA_ERROR; + if ((y -= c[i]) < 0) + return Z_DATA_ERROR; + c[i] += y; + + + /* Generate starting offsets into the value table for each length */ + x[1] = j = 0; + p = c + 1; xp = x + 2; + while (--i) { /* note that i == g from above */ + *xp++ = (j += *p++); + } + + + /* Make a table of values in order of bit lengths */ + p = b; i = 0; + do { + if ((j = *p++) != 0) + v[x[j]++] = i; + } while (++i < n); + n = x[g]; /* set n to length of v */ + + + /* Generate the Huffman codes and for each, make the table entries */ + x[0] = i = 0; /* first Huffman code is zero */ + p = v; /* grab values in bit order */ + h = -1; /* no tables yet--level -1 */ + w = -l; /* bits decoded == (l * h) */ + u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */ + q = (inflate_huft *)Z_NULL; /* ditto */ + z = 0; /* ditto */ + + /* go through the bit lengths (k already is bits in shortest code) */ + for (; k <= g; k++) + { + a = c[k]; + while (a--) + { + /* here i is the Huffman code of length k bits for value *p */ + /* make tables up to required level */ + while (k > w + l) + { + h++; + w += l; /* previous table always l bits */ + + /* compute minimum size table less than or equal to l bits */ + z = g - w; + z = z > (uInt)l ? l : z; /* table size upper limit */ + if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ + { /* too few codes for k-w bit table */ + f -= a + 1; /* deduct codes from patterns left */ + xp = c + k; + if (j < z) + while (++j < z) /* try smaller tables up to z bits */ + { + if ((f <<= 1) <= *++xp) + break; /* enough codes to use up j bits */ + f -= *xp; /* else deduct codes from patterns */ + } + } + z = 1 << j; /* table entries for j-bit table */ + + /* allocate new table */ + if (*hn + z > MANY) /* (note: doesn't matter for fixed) */ + return Z_MEM_ERROR; /* not enough memory */ + u[h] = q = hp + *hn; + *hn += z; + + /* connect to last table, if there is one */ + if (h) + { + x[h] = i; /* save pattern for backing up */ + r.bits = (Byte)l; /* bits to dump before this table */ + r.exop = (Byte)j; /* bits in this table */ + j = i >> (w - l); + r.base = (uInt)(q - u[h-1] - j); /* offset to this table */ + u[h-1][j] = r; /* connect to last table */ + } + else + *t = q; /* first table is returned result */ + } + + /* set up table entry in r */ + r.bits = (Byte)(k - w); + if (p >= v + n) + r.exop = 128 + 64; /* out of values--invalid code */ + else if (*p < s) + { + r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */ + r.base = *p++; /* simple code is just the value */ + } + else + { + r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */ + r.base = d[*p++ - s]; + } + + /* fill code-like entries with r */ + f = 1 << (k - w); + for (j = i >> w; j < z; j += f) + q[j] = r; + + /* backwards increment the k-bit code i */ + for (j = 1 << (k - 1); i & j; j >>= 1) + i ^= j; + i ^= j; + + /* backup over finished tables */ + mask = (1 << w) - 1; /* needed on HP, cc -O bug */ + while ((i & mask) != x[h]) + { + h--; /* don't need to update q */ + w -= l; + mask = (1 << w) - 1; + } + } + } + + + /* Return Z_BUF_ERROR if we were given an incomplete table */ + return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK; +} + + +int inflate_trees_bits(c, bb, tb, hp, z) +uIntf *c; /* 19 code lengths */ +uIntf *bb; /* bits tree desired/actual depth */ +inflate_huft * FAR *tb; /* bits tree result */ +inflate_huft *hp; /* space for trees */ +z_streamp z; /* for messages */ +{ + int r; + uInt hn = 0; /* hufts used in space */ + uIntf *v; /* work area for huft_build */ + + if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL) + return Z_MEM_ERROR; + r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, + tb, bb, hp, &hn, v); + if (r == Z_DATA_ERROR) + z->msg = (char*)"oversubscribed dynamic bit lengths tree"; + else if (r == Z_BUF_ERROR || *bb == 0) + { + z->msg = (char*)"incomplete dynamic bit lengths tree"; + r = Z_DATA_ERROR; + } + ZFREE(z, v); + return r; +} + + +int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z) +uInt nl; /* number of literal/length codes */ +uInt nd; /* number of distance codes */ +uIntf *c; /* that many (total) code lengths */ +uIntf *bl; /* literal desired/actual bit depth */ +uIntf *bd; /* distance desired/actual bit depth */ +inflate_huft * FAR *tl; /* literal/length tree result */ +inflate_huft * FAR *td; /* distance tree result */ +inflate_huft *hp; /* space for trees */ +z_streamp z; /* for messages */ +{ + int r; + uInt hn = 0; /* hufts used in space */ + uIntf *v; /* work area for huft_build */ + + /* allocate work area */ + if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) + return Z_MEM_ERROR; + + /* build literal/length tree */ + r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v); + if (r != Z_OK || *bl == 0) + { + if (r == Z_DATA_ERROR) + z->msg = (char*)"oversubscribed literal/length tree"; + else if (r != Z_MEM_ERROR) + { + z->msg = (char*)"incomplete literal/length tree"; + r = Z_DATA_ERROR; + } + ZFREE(z, v); + return r; + } + + /* build distance tree */ + r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v); + if (r != Z_OK || (*bd == 0 && nl > 257)) + { + if (r == Z_DATA_ERROR) + z->msg = (char*)"oversubscribed distance tree"; + else if (r == Z_BUF_ERROR) { +#ifdef PKZIP_BUG_WORKAROUND + r = Z_OK; + } +#else + z->msg = (char*)"incomplete distance tree"; + r = Z_DATA_ERROR; + } + else if (r != Z_MEM_ERROR) + { + z->msg = (char*)"empty distance tree with lengths"; + r = Z_DATA_ERROR; + } + ZFREE(z, v); + return r; +#endif + } + + /* done */ + ZFREE(z, v); + return Z_OK; +} + + +/* build fixed tables only once--keep them here */ +#ifdef BUILDFIXED +local int fixed_built = 0; +#define FIXEDH 544 /* number of hufts used by fixed tables */ +local inflate_huft fixed_mem[FIXEDH]; +local uInt fixed_bl; +local uInt fixed_bd; +local inflate_huft *fixed_tl; +local inflate_huft *fixed_td; +#else +#include "inffixed.h" +#endif + + +int inflate_trees_fixed(bl, bd, tl, td, z) +uIntf *bl; /* literal desired/actual bit depth */ +uIntf *bd; /* distance desired/actual bit depth */ +inflate_huft * FAR *tl; /* literal/length tree result */ +inflate_huft * FAR *td; /* distance tree result */ +z_streamp z; /* for memory allocation */ +{ +#ifdef BUILDFIXED + /* build fixed tables if not already */ + if (!fixed_built) + { + int k; /* temporary variable */ + uInt f = 0; /* number of hufts used in fixed_mem */ + uIntf *c; /* length list for huft_build */ + uIntf *v; /* work area for huft_build */ + + /* allocate memory */ + if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) + return Z_MEM_ERROR; + if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) + { + ZFREE(z, c); + return Z_MEM_ERROR; + } + + /* literal table */ + for (k = 0; k < 144; k++) + c[k] = 8; + for (; k < 256; k++) + c[k] = 9; + for (; k < 280; k++) + c[k] = 7; + for (; k < 288; k++) + c[k] = 8; + fixed_bl = 9; + huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl, + fixed_mem, &f, v); + + /* distance table */ + for (k = 0; k < 30; k++) + c[k] = 5; + fixed_bd = 5; + huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd, + fixed_mem, &f, v); + + /* done */ + ZFREE(z, v); + ZFREE(z, c); + fixed_built = 1; + } +#endif + *bl = fixed_bl; + *bd = fixed_bd; + *tl = fixed_tl; + *td = fixed_td; + return Z_OK; +} diff --git a/cfe/cfe/zlib/inftrees.h b/cfe/cfe/zlib/inftrees.h new file mode 100644 index 0000000..85853e0 --- /dev/null +++ b/cfe/cfe/zlib/inftrees.h @@ -0,0 +1,58 @@ +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Huffman code lookup table entry--this entry is four bytes for machines + that have 16-bit pointers (e.g. PC's in the small or medium model). */ + +typedef struct inflate_huft_s FAR inflate_huft; + +struct inflate_huft_s { + union { + struct { + Byte Exop; /* number of extra bits or operation */ + Byte Bits; /* number of bits in this code or subcode */ + } what; + uInt pad; /* pad structure to a power of 2 (4 bytes for */ + } word; /* 16-bit, 8 bytes for 32-bit int's) */ + uInt base; /* literal, length base, distance base, + or table offset */ +}; + +/* Maximum size of dynamic tree. The maximum found in a long but non- + exhaustive search was 1004 huft structures (850 for length/literals + and 154 for distances, the latter actually the result of an + exhaustive search). The actual maximum is not known, but the + value below is more than safe. */ +#define MANY 1440 + +extern int inflate_trees_bits OF(( + uIntf *, /* 19 code lengths */ + uIntf *, /* bits tree desired/actual depth */ + inflate_huft * FAR *, /* bits tree result */ + inflate_huft *, /* space for trees */ + z_streamp)); /* for messages */ + +extern int inflate_trees_dynamic OF(( + uInt, /* number of literal/length codes */ + uInt, /* number of distance codes */ + uIntf *, /* that many (total) code lengths */ + uIntf *, /* literal desired/actual bit depth */ + uIntf *, /* distance desired/actual bit depth */ + inflate_huft * FAR *, /* literal/length tree result */ + inflate_huft * FAR *, /* distance tree result */ + inflate_huft *, /* space for trees */ + z_streamp)); /* for messages */ + +extern int inflate_trees_fixed OF(( + uIntf *, /* literal desired/actual bit depth */ + uIntf *, /* distance desired/actual bit depth */ + inflate_huft * FAR *, /* literal/length tree result */ + inflate_huft * FAR *, /* distance tree result */ + z_streamp)); /* for memory allocation */ diff --git a/cfe/cfe/zlib/infutil.c b/cfe/cfe/zlib/infutil.c new file mode 100644 index 0000000..824dab5 --- /dev/null +++ b/cfe/cfe/zlib/infutil.c @@ -0,0 +1,87 @@ +/* inflate_util.c -- data and routines common to blocks and codes + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "infblock.h" +#include "inftrees.h" +#include "infcodes.h" +#include "infutil.h" + +struct inflate_codes_state {int dummy;}; /* for buggy compilers */ + +/* And'ing with mask[n] masks the lower n bits */ +uInt inflate_mask[17] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + + +/* copy as much as possible from the sliding window to the output area */ +int inflate_flush(s, z, r) +inflate_blocks_statef *s; +z_streamp z; +int r; +{ + uInt n; + Bytef *p; + Bytef *q; + + /* local copies of source and destination pointers */ + p = z->next_out; + q = s->read; + + /* compute number of bytes to copy as far as end of window */ + n = (uInt)((q <= s->write ? s->write : s->end) - q); + if (n > z->avail_out) n = z->avail_out; + if (n && r == Z_BUF_ERROR) r = Z_OK; + + /* update counters */ + z->avail_out -= n; + z->total_out += n; + + /* update check information */ + if (s->checkfn != Z_NULL) + z->adler = s->check = (*s->checkfn)(s->check, q, n); + + /* copy as far as end of window */ + zmemcpy(p, q, n); + p += n; + q += n; + + /* see if more to copy at beginning of window */ + if (q == s->end) + { + /* wrap pointers */ + q = s->window; + if (s->write == s->end) + s->write = s->window; + + /* compute bytes to copy */ + n = (uInt)(s->write - q); + if (n > z->avail_out) n = z->avail_out; + if (n && r == Z_BUF_ERROR) r = Z_OK; + + /* update counters */ + z->avail_out -= n; + z->total_out += n; + + /* update check information */ + if (s->checkfn != Z_NULL) + z->adler = s->check = (*s->checkfn)(s->check, q, n); + + /* copy */ + zmemcpy(p, q, n); + p += n; + q += n; + } + + /* update pointers */ + z->next_out = p; + s->read = q; + + /* done */ + return r; +} diff --git a/cfe/cfe/zlib/infutil.h b/cfe/cfe/zlib/infutil.h new file mode 100644 index 0000000..99d1135 --- /dev/null +++ b/cfe/cfe/zlib/infutil.h @@ -0,0 +1,98 @@ +/* infutil.h -- types and macros common to blocks and codes + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +#ifndef _INFUTIL_H +#define _INFUTIL_H + +typedef enum { + TYPE, /* get type bits (3, including end bit) */ + LENS, /* get lengths for stored */ + STORED, /* processing stored block */ + TABLE, /* get table lengths */ + BTREE, /* get bit lengths tree for a dynamic block */ + DTREE, /* get length, distance trees for a dynamic block */ + CODES, /* processing fixed or dynamic block */ + DRY, /* output remaining window bytes */ + DONE, /* finished last block, done */ + BAD} /* got a data error--stuck here */ +inflate_block_mode; + +/* inflate blocks semi-private state */ +struct inflate_blocks_state { + + /* mode */ + inflate_block_mode mode; /* current inflate_block mode */ + + /* mode dependent information */ + union { + uInt left; /* if STORED, bytes left to copy */ + struct { + uInt table; /* table lengths (14 bits) */ + uInt index; /* index into blens (or border) */ + uIntf *blens; /* bit lengths of codes */ + uInt bb; /* bit length tree depth */ + inflate_huft *tb; /* bit length decoding tree */ + } trees; /* if DTREE, decoding info for trees */ + struct { + inflate_codes_statef + *codes; + } decode; /* if CODES, current state */ + } sub; /* submode */ + uInt last; /* true if this block is the last block */ + + /* mode independent information */ + uInt bitk; /* bits in bit buffer */ + uLong bitb; /* bit buffer */ + inflate_huft *hufts; /* single malloc for tree space */ + Bytef *window; /* sliding window */ + Bytef *end; /* one byte after sliding window */ + Bytef *read; /* window read pointer */ + Bytef *write; /* window write pointer */ + check_func checkfn; /* check function */ + uLong check; /* check on output */ + +}; + + +/* defines for inflate input/output */ +/* update pointers and return */ +#define UPDBITS {s->bitb=b;s->bitk=k;} +#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;} +#define UPDOUT {s->write=q;} +#define UPDATE {UPDBITS UPDIN UPDOUT} +#define LEAVE {UPDATE return inflate_flush(s,z,r);} +/* get bytes and bits */ +#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;} +#define NEEDBYTE {if(n)r=Z_OK;else LEAVE} +#define NEXTBYTE (n--,*p++) +#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<>=(j);k-=(j);} +/* output bytes */ +#define WAVAIL (uInt)(qread?s->read-q-1:s->end-q) +#define LOADOUT {q=s->write;m=(uInt)WAVAIL;} +#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}} +#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} +#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} +#define OUTBYTE(a) {*q++=(Byte)(a);m--;} +/* load local pointers */ +#define LOAD {LOADIN LOADOUT} + +/* masks for lower bits (size given to avoid silly warnings with Visual C++) */ +extern uInt inflate_mask[17]; + +/* copy as much as possible from the sliding window to the output area */ +extern int inflate_flush OF(( + inflate_blocks_statef *, + z_streamp , + int)); + +struct internal_state {int dummy;}; /* for buggy compilers */ + +#endif diff --git a/cfe/cfe/zlib/maketree.c b/cfe/cfe/zlib/maketree.c new file mode 100644 index 0000000..949d786 --- /dev/null +++ b/cfe/cfe/zlib/maketree.c @@ -0,0 +1,85 @@ +/* maketree.c -- make inffixed.h table for decoding fixed codes + * Copyright (C) 1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* This program is included in the distribution for completeness. + You do not need to compile or run this program since inffixed.h + is already included in the distribution. To use this program + you need to compile zlib with BUILDFIXED defined and then compile + and link this program with the zlib library. Then the output of + this program can be piped to inffixed.h. */ + +#include +#include +#include "zutil.h" +#include "inftrees.h" + +/* simplify the use of the inflate_huft type with some defines */ +#define exop word.what.Exop +#define bits word.what.Bits + +/* generate initialization table for an inflate_huft structure array */ +void maketree(uInt b, inflate_huft *t) +{ + int i, e; + + i = 0; + while (1) + { + e = t[i].exop; + if (e && (e & (16+64)) == 0) /* table pointer */ + { + fprintf(stderr, "maketree: cannot initialize sub-tables!\n"); + exit(1); + } + if (i % 4 == 0) + printf("\n "); + printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base); + if (++i == (1< +#include "zlib.h" + +#ifdef STDC +# include +# include +#else + extern void exit OF((int)); +#endif + +#ifdef USE_MMAP +# include +# include +# include +#endif + +#if defined(MSDOS) || defined(OS2) || defined(WIN32) +# include +# include +# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) +#else +# define SET_BINARY_MODE(file) +#endif + +#ifdef VMS +# define unlink delete +# define GZ_SUFFIX "-gz" +#endif +#ifdef RISCOS +# define unlink remove +# define GZ_SUFFIX "-gz" +# define fileno(file) file->__file +#endif +#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fileno */ +#endif + +#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ + extern int unlink OF((const char *)); +#endif + +#ifndef GZ_SUFFIX +# define GZ_SUFFIX ".gz" +#endif +#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) + +#define BUFLEN 16384 +#define MAX_NAME_LEN 1024 + +#ifdef MAXSEG_64K +# define local static + /* Needed for systems with limitation on stack size. */ +#else +# define local +#endif + +char *prog; + +void error OF((const char *msg)); +void gz_compress OF((FILE *in, gzFile out)); +#ifdef USE_MMAP +int gz_compress_mmap OF((FILE *in, gzFile out)); +#endif +void gz_uncompress OF((gzFile in, FILE *out)); +void file_compress OF((char *file, char *mode)); +void file_uncompress OF((char *file)); +int main OF((int argc, char *argv[])); + +/* =========================================================================== + * Display error message and exit + */ +void error(msg) + const char *msg; +{ + fprintf(stderr, "%s: %s\n", prog, msg); + exit(1); +} + +/* =========================================================================== + * Compress input to output then close both files. + */ + +void gz_compress(in, out) + FILE *in; + gzFile out; +{ + local char buf[BUFLEN]; + int len; + int err; + +#ifdef USE_MMAP + /* Try first compressing with mmap. If mmap fails (minigzip used in a + * pipe), use the normal fread loop. + */ + if (gz_compress_mmap(in, out) == Z_OK) return; +#endif + for (;;) { + len = fread(buf, 1, sizeof(buf), in); + if (ferror(in)) { + perror("fread"); + exit(1); + } + if (len == 0) break; + + if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); + } + fclose(in); + if (gzclose(out) != Z_OK) error("failed gzclose"); +} + +#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ + +/* Try compressing the input file at once using mmap. Return Z_OK if + * if success, Z_ERRNO otherwise. + */ +int gz_compress_mmap(in, out) + FILE *in; + gzFile out; +{ + int len; + int err; + int ifd = fileno(in); + caddr_t buf; /* mmap'ed buffer for the entire input file */ + off_t buf_len; /* length of the input file */ + struct stat sb; + + /* Determine the size of the file, needed for mmap: */ + if (fstat(ifd, &sb) < 0) return Z_ERRNO; + buf_len = sb.st_size; + if (buf_len <= 0) return Z_ERRNO; + + /* Now do the actual mmap: */ + buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); + if (buf == (caddr_t)(-1)) return Z_ERRNO; + + /* Compress the whole file at once: */ + len = gzwrite(out, (char *)buf, (unsigned)buf_len); + + if (len != (int)buf_len) error(gzerror(out, &err)); + + munmap(buf, buf_len); + fclose(in); + if (gzclose(out) != Z_OK) error("failed gzclose"); + return Z_OK; +} +#endif /* USE_MMAP */ + +/* =========================================================================== + * Uncompress input to output then close both files. + */ +void gz_uncompress(in, out) + gzFile in; + FILE *out; +{ + local char buf[BUFLEN]; + int len; + int err; + + for (;;) { + len = gzread(in, buf, sizeof(buf)); + if (len < 0) error (gzerror(in, &err)); + if (len == 0) break; + + if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { + error("failed fwrite"); + } + } + if (fclose(out)) error("failed fclose"); + + if (gzclose(in) != Z_OK) error("failed gzclose"); +} + + +/* =========================================================================== + * Compress the given file: create a corresponding .gz file and remove the + * original. + */ +void file_compress(file, mode) + char *file; + char *mode; +{ + local char outfile[MAX_NAME_LEN]; + FILE *in; + gzFile out; + + strcpy(outfile, file); + strcat(outfile, GZ_SUFFIX); + + in = fopen(file, "rb"); + if (in == NULL) { + perror(file); + exit(1); + } + out = gzopen(outfile, mode); + if (out == NULL) { + fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); + exit(1); + } + gz_compress(in, out); + + unlink(file); +} + + +/* =========================================================================== + * Uncompress the given file and remove the original. + */ +void file_uncompress(file) + char *file; +{ + local char buf[MAX_NAME_LEN]; + char *infile, *outfile; + FILE *out; + gzFile in; + int len = strlen(file); + + strcpy(buf, file); + + if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { + infile = file; + outfile = buf; + outfile[len-3] = '\0'; + } else { + outfile = file; + infile = buf; + strcat(infile, GZ_SUFFIX); + } + in = gzopen(infile, "rb"); + if (in == NULL) { + fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); + exit(1); + } + out = fopen(outfile, "wb"); + if (out == NULL) { + perror(file); + exit(1); + } + + gz_uncompress(in, out); + + unlink(infile); +} + + +/* =========================================================================== + * Usage: minigzip [-d] [-f] [-h] [-1 to -9] [files...] + * -d : decompress + * -f : compress with Z_FILTERED + * -h : compress with Z_HUFFMAN_ONLY + * -1 to -9 : compression level + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + int uncompr = 0; + gzFile file; + char outmode[20]; + + strcpy(outmode, "wb6 "); + + prog = argv[0]; + argc--, argv++; + + while (argc > 0) { + if (strcmp(*argv, "-d") == 0) + uncompr = 1; + else if (strcmp(*argv, "-f") == 0) + outmode[3] = 'f'; + else if (strcmp(*argv, "-h") == 0) + outmode[3] = 'h'; + else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && + (*argv)[2] == 0) + outmode[2] = (*argv)[1]; + else + break; + argc--, argv++; + } + if (argc == 0) { + SET_BINARY_MODE(stdin); + SET_BINARY_MODE(stdout); + if (uncompr) { + file = gzdopen(fileno(stdin), "rb"); + if (file == NULL) error("can't gzdopen stdin"); + gz_uncompress(file, stdout); + } else { + file = gzdopen(fileno(stdout), outmode); + if (file == NULL) error("can't gzdopen stdout"); + gz_compress(stdin, file); + } + } else { + do { + if (uncompr) { + file_uncompress(*argv); + } else { + file_compress(*argv, outmode); + } + } while (argv++, --argc); + } + exit(0); + return 0; /* to avoid warning */ +} diff --git a/cfe/cfe/zlib/trees.c b/cfe/cfe/zlib/trees.c new file mode 100644 index 0000000..b37335b --- /dev/null +++ b/cfe/cfe/zlib/trees.c @@ -0,0 +1,1214 @@ +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-1998 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id: trees.c,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef DEBUG +# include +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +#define Buf_size (8 * 2*sizeof(char)) +/* Number of bits used within bi_buf. (bi_buf might be implemented on + * more than 16 bits on some systems.) + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* GEN_TREES_H */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +local static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Local (static) routines in this file. + */ + +local void tr_static_init OF((void)); +local void init_block OF((deflate_state *s)); +local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); +local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); +local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); +local void build_tree OF((deflate_state *s, tree_desc *desc)); +local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local int build_bl_tree OF((deflate_state *s)); +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, + int blcodes)); +local void compress_block OF((deflate_state *s, ct_data *ltree, + ct_data *dtree)); +local void set_data_type OF((deflate_state *s)); +local unsigned bi_reverse OF((unsigned value, int length)); +local void bi_windup OF((deflate_state *s)); +local void bi_flush OF((deflate_state *s)); +local void copy_block OF((deflate_state *s, charf *buf, unsigned len, + int header)); + +#ifdef GEN_TREES_H +local void gen_trees_header OF((void)); +#endif + +#ifndef DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (value << s->bi_valid); + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = value;\ + s->bi_buf |= (val << s->bi_valid);\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* DEBUG */ + + +#define MAX(a,b) (a >= b ? a : b) +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init() +{ +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Genererate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef DEBUG +# include +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width)-1 ? ",\n" : ", ")) + +void gen_trees_header() +{ + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void _tr_init(s) + deflate_state *s; +{ + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; + s->last_eob_len = 8; /* enough lookahead for inflate */ +#ifdef DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(s) + deflate_state *s; +{ + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->last_lit = s->matches = 0; +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(s, tree, k) + deflate_state *s; + ct_data *tree; /* the tree to restore */ + int k; /* node to move down */ +{ + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n-base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (bits + xbits); + if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + } + if (overflow == 0) return; + + Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if (tree[m].Len != (unsigned) bits) { + Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((long)bits - (long)tree[m].Len) + *(long)tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes (tree, max_code, bl_count) + ct_data *tree; /* the tree to decorate */ + int max_code; /* largest code with non zero frequency */ + ushf *bl_count; /* number of codes at each bit length */ +{ + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + ush code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code+1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(s) + deflate_state *s; +{ + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*(max_blindex+1) + 5+5+4; + Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(s, lcodes, dcodes, blcodes) + deflate_state *s; + int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void _tr_stored_block(s, buf, stored_len, eof) + deflate_state *s; + charf *buf; /* input block */ + ulg stored_len; /* length of input block */ + int eof; /* true if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ +#ifdef DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; +#endif + copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + * The current inflate code requires 9 bits of lookahead. If the + * last two codes for the previous block (real code plus EOB) were coded + * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode + * the last real code. In this case we send two empty static blocks instead + * of one. (There are no problems if the previous block is stored or fixed.) + * To simplify the code, we assume the worst case of last real code encoded + * on one bit only. + */ +void _tr_align(s) + deflate_state *s; +{ + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); + /* Of the 10 bits for the empty block, we have already sent + * (10 - bi_valid) bits. The lookahead for the last real code (before + * the EOB of the previous block) was thus at least one plus the length + * of the EOB plus what we have just sent of the empty static block. + */ + if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; +#endif + bi_flush(s); + } + s->last_eob_len = 7; +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +void _tr_flush_block(s, buf, stored_len, eof) + deflate_state *s; + charf *buf; /* input block, or NULL if too old */ + ulg stored_len; /* length of input block */ + int eof; /* true if this is the last block for a file */ +{ + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is ascii or binary */ + if (s->data_type == Z_UNKNOWN) set_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute first the block length in bytes*/ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len+4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, eof); + +#ifdef FORCE_STATIC + } else if (static_lenb >= 0) { /* force static trees */ +#else + } else if (static_lenb == opt_lenb) { +#endif + send_bits(s, (STATIC_TREES<<1)+eof, 3); + compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1)+eof, 3); + send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, + max_blindex+1); + compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (eof) { + bi_windup(s); +#ifdef DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + s->compressed_len-7*eof)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int _tr_tally (s, dist, lc) + deflate_state *s; + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + s->d_buf[s->last_lit] = (ush)dist; + s->l_buf[s->last_lit++] = (uch)lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + +#ifdef TRUNCATE_BLOCK + /* Try to guess if it is profitable to stop the current block here */ + if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { + /* Compute an upper bound for the compressed length */ + ulg out_length = (ulg)s->last_lit*8L; + ulg in_length = (ulg)((long)s->strstart - s->block_start); + int dcode; + for (dcode = 0; dcode < D_CODES; dcode++) { + out_length += (ulg)s->dyn_dtree[dcode].Freq * + (5L+extra_dbits[dcode]); + } + out_length >>= 3; + Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", + s->last_lit, in_length, out_length, + 100L - out_length*100L/in_length)); + if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; + } +#endif + return (s->last_lit == s->lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(s, ltree, dtree) + deflate_state *s; + ct_data *ltree; /* literal tree */ + ct_data *dtree; /* distance tree */ +{ + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned lx = 0; /* running index in l_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->last_lit != 0) do { + dist = s->d_buf[lx]; + lc = s->l_buf[lx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow"); + + } while (lx < s->last_lit); + + send_code(s, END_BLOCK, ltree); + s->last_eob_len = ltree[END_BLOCK].Len; +} + +/* =========================================================================== + * Set the data type to ASCII or BINARY, using a crude approximation: + * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise. + * IN assertion: the fields freq of dyn_ltree are set and the total of all + * frequencies does not exceed 64K (to fit in an int on 16 bit machines). + */ +local void set_data_type(s) + deflate_state *s; +{ + int n = 0; + unsigned ascii_freq = 0; + unsigned bin_freq = 0; + while (n < 7) bin_freq += s->dyn_ltree[n++].Freq; + while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq; + while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq; + s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII); +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(code, len) + unsigned code; /* the value to invert */ + int len; /* its bit length */ +{ + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(s) + deflate_state *s; +{ + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(s) + deflate_state *s; +{ + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->bits_sent = (s->bits_sent+7) & ~7; +#endif +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +local void copy_block(s, buf, len, header) + deflate_state *s; + charf *buf; /* the input data */ + unsigned len; /* its length */ + int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + s->last_eob_len = 8; /* enough lookahead for inflate */ + + if (header) { + put_short(s, (ush)len); + put_short(s, (ush)~len); +#ifdef DEBUG + s->bits_sent += 2*16; +#endif + } +#ifdef DEBUG + s->bits_sent += (ulg)len<<3; +#endif + while (len--) { + put_byte(s, *buf++); + } +} diff --git a/cfe/cfe/zlib/trees.h b/cfe/cfe/zlib/trees.h new file mode 100644 index 0000000..72facf9 --- /dev/null +++ b/cfe/cfe/zlib/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/cfe/cfe/zlib/uncompr.c b/cfe/cfe/zlib/uncompr.c new file mode 100644 index 0000000..eab3f5b --- /dev/null +++ b/cfe/cfe/zlib/uncompr.c @@ -0,0 +1,58 @@ +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-1998 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: uncompr.c,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +#include "zlib.h" + +/* =========================================================================== + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; + + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + + err = inflateInit(&stream); + if (err != Z_OK) return err; + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + inflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = inflateEnd(&stream); + return err; +} diff --git a/cfe/cfe/zlib/zconf.h b/cfe/cfe/zlib/zconf.h new file mode 100644 index 0000000..23a52b3 --- /dev/null +++ b/cfe/cfe/zlib/zconf.h @@ -0,0 +1,279 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-1998 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: zconf.h,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +#ifndef _ZCONF_H +#define _ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateReset z_inflateReset +# define compress z_compress +# define compress2 z_compress2 +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table + +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +# define WIN32 +#endif +#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) +# ifndef __32BIT__ +# define __32BIT__ +# endif +#endif +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#if defined(MSDOS) && !defined(__32BIT__) +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) +# define STDC +#endif +#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) +# ifndef STDC +# define STDC +# endif +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Old Borland C incorrectly complains about missing returns: */ +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) +# define NEED_DUMMY_RETURN +#endif + + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# if defined(STDC) || defined(_CFE_) +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +#endif +#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) +# ifndef __32BIT__ +# define SMALL_MEDIUM +# define FAR _far +# endif +#endif + +/* Compile with -DZLIB_DLL for Windows DLL support */ +#if defined(ZLIB_DLL) +# if defined(_WINDOWS) || defined(WINDOWS) +# ifdef FAR +# undef FAR +# endif +# include +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR _cdecl _export +# endif +# endif +# if defined (__BORLANDC__) +# if (__BORLANDC__ >= 0x0500) && defined (WIN32) +# include +# define ZEXPORT __declspec(dllexport) WINAPI +# define ZEXPORTRVA __declspec(dllexport) WINAPIV +# else +# if defined (_Windows) && defined (__DLL__) +# define ZEXPORT _export +# define ZEXPORTVA _export +# endif +# endif +# endif +#endif + +#if defined (__BEOS__) +# if defined (ZLIB_DLL) +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +#endif + +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif +#ifndef ZEXTERN +# define ZEXTERN extern +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(MACOS) && !defined(TARGET_OS_MAC) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(inflate_blocks,"INBL") +# pragma map(inflate_blocks_new,"INBLNE") +# pragma map(inflate_blocks_free,"INBLFR") +# pragma map(inflate_blocks_reset,"INBLRE") +# pragma map(inflate_codes_free,"INCOFR") +# pragma map(inflate_codes,"INCO") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_flush,"INFLU") +# pragma map(inflate_mask,"INMA") +# pragma map(inflate_set_dictionary,"INSEDI2") +# pragma map(inflate_copyright,"INCOPY") +# pragma map(inflate_trees_bits,"INTRBI") +# pragma map(inflate_trees_dynamic,"INTRDY") +# pragma map(inflate_trees_fixed,"INTRFI") +# pragma map(inflate_trees_free,"INTRFR") +#endif + +#endif /* _ZCONF_H */ diff --git a/cfe/cfe/zlib/zlib.3 b/cfe/cfe/zlib/zlib.3 new file mode 100644 index 0000000..25c8495 --- /dev/null +++ b/cfe/cfe/zlib/zlib.3 @@ -0,0 +1,107 @@ +.TH ZLIB 3 "9 July 1998" +.SH NAME +zlib \- compression/decompression library +.SH SYNOPSIS +[see +.I zlib.h +for full description] +.SH DESCRIPTION +The +.I zlib +library is a general purpose data compression library. +The code is thread safe. +It provides in-memory compression and decompression functions, +including integrity checks of the uncompressed data. +This version of the library supports only one compression method (deflation) +but other algorithms will be added later and will have the same stream interface. +.LP +Compression can be done in a single step if the buffers are large enough +(for example if an input file is mmap'ed), +or can be done by repeated calls of the compression function. +In the latter case, +the application must provide more input and/or consume the output +(providing more output space) before each call. +.LP +The library also supports reading and writing files in +.I gzip +(.gz) format +with an interface similar to that of stdio. +.LP +The library does not install any signal handler. The decoder checks +the consistency of the compressed data, so the library should never +crash even in case of corrupted input. +.LP +All functions of the compression library are documented in the file +.IR zlib.h. +The distribution source includes examples of use of the library +the files +.I example.c +and +.IR minigzip.c . +.LP +A Java implementation of +.IR zlib +is available in the Java Development Kit 1.1 +.IP +http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html +.LP +A Perl interface to +.IR zlib , +written by Paul Marquess (pmarquess@bfsec.bt.co.uk) +is available at CPAN (Comprehensive Perl Archive Network) sites, +such as: +.IP +ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib* +.LP +A Python interface to +.IR zlib +written by A.M. Kuchling +is available from the Python Software Association sites, such as: +.IP +ftp://ftp.python.org/pub/python/contrib/Encoding/zlib*.tar.gz +.SH "SEE ALSO" +Questions about zlib should be sent to: +.IP +zlib@quest.jpl.nasa.gov +or, if this fails, to the author addresses given below. +The zlib home page is: +.IP +http://www.cdrom.com/pub/infozip/zlib/ +.LP +The data format used by the zlib library is described by RFC +(Request for Comments) 1950 to 1952 in the files: +.IP +ftp://ds.internic.net/rfc/rfc1950.txt (zlib format) +.br +rfc1951.txt (deflate format) +.br +rfc1952.txt (gzip format) +.LP +These documents are also available in other formats from: +.IP +ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html +.SH AUTHORS +Version 1.1.3 +Copyright (C) 1995-1998 Jean-loup Gailly (jloup@gzip.org) +and Mark Adler (madler@alumni.caltech.edu). +.LP +This software is provided "as-is," +without any express or implied warranty. +In no event will the authors be held liable for any damages +arising from the use of this software. +See the distribution directory with respect to requirements +governing redistribution. +The deflate format used by +.I zlib +was defined by Phil Katz. +The deflate and +.I zlib +specifications were written by L. Peter Deutsch. +Thanks to all the people who reported problems and suggested various +improvements in +.IR zlib ; +who are too numerous to cite here. +.LP +UNIX manual page by R. P. C. Rodgers, +U.S. National Library of Medicine (rodgers@nlm.nih.gov). +.\" end of man page diff --git a/cfe/cfe/zlib/zlib.h b/cfe/cfe/zlib/zlib.h new file mode 100644 index 0000000..49f56b4 --- /dev/null +++ b/cfe/cfe/zlib/zlib.h @@ -0,0 +1,893 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.1.3, July 9th, 1998 + + Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef _ZLIB_H +#define _ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.1.3" + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: ascii or binary */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +/* Allowed flush values; see deflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_ASCII 1 +#define Z_UNKNOWN 2 +/* Possible values of the data_type field */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + the compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + 0.1% larger than avail_in plus 12 bytes. If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update data_type if it can make a good guess about + the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may some + introduce some output latency (reading input without producing any output) + except when forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much + output as possible to the output buffer. The flushing behavior of inflate is + not specified for values of the flush parameter other than Z_SYNC_FLUSH + and Z_FINISH, but the current implementation actually flushes as much output + as possible anyway. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster routine + may be used for the single inflate() call. + + If a preset dictionary is needed at this point (see inflateSetDictionary + below), inflate sets strm-adler to the adler32 checksum of the + dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise + it sets strm->adler to the adler32 checksum of all output produced + so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or + an error code as described below. At the end of the stream, inflate() + checks that its computed adler32 checksum is equal to that saved by the + compressor and returns Z_STREAM_END only if the checksum is correct. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect + adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent + (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if no progress is possible or if there was not + enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR + case, the application may then call inflateSync to look for a good + compression block. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match). Filtered data consists mostly of small values with a + somewhat random distribution. In this case, the compression algorithm is + tuned to compress them better. The effect of Z_FILTERED is to force more + Huffman coding and less string matching; it is somewhat intermediate + between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects + the compression ratio but not the correctness of the compressed output even + if it is not set appropriately. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. + + Upon return of this function, strm->adler is set to the Adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. If a compressed stream with a larger window size is given as + input, inflate() will return with the error code Z_DATA_ERROR instead of + trying to allocate a larger window. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative + memLevel). msg is set to null if there is no error message. inflateInit2 + does not perform any decompression apart from reading the zlib header if + present: this will be done by inflate(). (So next_in and avail_in may be + modified, but next_out and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate + if this call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler32 value returned by this call of + inflate. The compressor and decompressor must use exactly the same + dictionary (see deflateSetDictionary). + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be at least 0.1% larger than + sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h". (See the description + of deflateInit2 for more information about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + const voidp buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); + +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running crc with the bytes buf[0..len-1] and return the updated + crc. If buf is NULL, this function returns the required initial value + for the crc. Pre- and post-conditioning (one's complement) is performed + within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int err)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* _ZLIB_H */ diff --git a/cfe/cfe/zlib/zutil.c b/cfe/cfe/zlib/zutil.c new file mode 100644 index 0000000..52a8197 --- /dev/null +++ b/cfe/cfe/zlib/zutil.c @@ -0,0 +1,225 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-1998 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: zutil.c,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +#include "zutil.h" + +struct internal_state {int dummy;}; /* for buggy compilers */ + +#ifndef STDC +extern void exit OF((int)); +#endif + +const char *z_errmsg[10] = { +"need dictionary", /* Z_NEED_DICT 2 */ +"stream end", /* Z_STREAM_END 1 */ +"", /* Z_OK 0 */ +"file error", /* Z_ERRNO (-1) */ +"stream error", /* Z_STREAM_ERROR (-2) */ +"data error", /* Z_DATA_ERROR (-3) */ +"insufficient memory", /* Z_MEM_ERROR (-4) */ +"buffer error", /* Z_BUF_ERROR (-5) */ +"incompatible version",/* Z_VERSION_ERROR (-6) */ +""}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +#ifdef DEBUG + +# ifndef verbose +# define verbose 0 +# endif +int z_verbose = verbose; + +void z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + + +#ifndef HAVE_MEMCPY + +void zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + +#ifdef __TURBOC__ +#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__) +/* Small and medium model in Turbo C are for now limited to near allocation + * with reduced MAX_WBITS and MAX_MEM_LEVEL + */ +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf = opaque; /* just to make some compilers happy */ + ulg bsize = (ulg)items*size; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void zcfree (voidpf opaque, voidpf ptr) +{ + int n; + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + ptr = opaque; /* just to make some compilers happy */ + Assert(0, "zcfree: ptr not found"); +} +#endif +#endif /* __TURBOC__ */ + + +#if defined(M_I86) && !defined(__32BIT__) +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + return _halloc((long)items, size); +} + +void zcfree (voidpf opaque, voidpf ptr) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + _hfree(ptr); +} + +#endif /* MSC */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + if (opaque) items += size - size; /* make compiler happy */ + return (voidpf)calloc(items, size); +} + +void zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + free(ptr); + if (opaque) return; /* make compiler happy */ +} + +#endif /* MY_ZCALLOC */ diff --git a/cfe/cfe/zlib/zutil.h b/cfe/cfe/zlib/zutil.h new file mode 100644 index 0000000..6dc18e1 --- /dev/null +++ b/cfe/cfe/zlib/zutil.h @@ -0,0 +1,220 @@ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-1998 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id: zutil.h,v 1.1 2001/11/09 01:48:02 mpl Exp $ */ + +#ifndef _Z_UTIL_H +#define _Z_UTIL_H + +#include "zlib.h" + +#ifdef STDC +# include +# include +# include +#endif +#ifdef NO_ERRNO_H + extern int errno; +#else +# include +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#ifdef MSDOS +# define OS_CODE 0x00 +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +#endif + +#ifdef WIN32 /* Window 95 & Windows NT */ +# define OS_CODE 0x0b +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0F +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) +# define fdopen(fd,type) _fdopen(fd,type) +#endif + + + /* Common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#ifdef HAVE_STRERROR + extern char *strerror OF((int)); +# define zstrerror(errnum) strerror(errnum) +#else +# define zstrerror(errnum) "" +#endif + +#if defined(pyr) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + extern void zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int z_verbose; + extern void z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + + +typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf, + uInt len)); +voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); +void zcfree OF((voidpf opaque, voidpf ptr)); + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +#endif /* _Z_UTIL_H */ diff --git a/cfe/docs/cfe.pdf b/cfe/docs/cfe.pdf new file mode 100755 index 0000000..ae668a1 Binary files /dev/null and b/cfe/docs/cfe.pdf differ diff --git a/shared/broadcom/include/bcm963xx/6328_common.h b/shared/broadcom/include/bcm963xx/6328_common.h new file mode 100755 index 0000000..4d36942 --- /dev/null +++ b/shared/broadcom/include/bcm963xx/6328_common.h @@ -0,0 +1,299 @@ +/* +<:copyright-broadcom + + Copyright (c) 2007 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +/***********************************************************************/ +/* */ +/* MODULE: 6328_common.h */ +/* DATE: 02/01/08 */ +/* PURPOSE: Define addresses of major hardware components of */ +/* BCM6328 */ +/* */ +/***********************************************************************/ +#ifndef __BCM6328_MAP_COMMON_H +#define __BCM6328_MAP_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define PERF_BASE 0xb0000000 /* chip control registers */ +#define TIMR_BASE 0xb0000040 /* timer registers */ +#define NAND_INTR_BASE 0xb0000070 /* nand interrupt control registers */ +#define GPIO_BASE 0xb0000080 /* gpio registers */ +#define UART_BASE 0xb0000100 /* uart registers */ +#define UART1_BASE 0xb0000120 /* uart registers */ +#define NAND_REG_BASE 0xb0000200 +#define NAND_CACHE_BASE 0xb0000400 +#define OTP_BASE 0xb0000600 +#define LED_BASE 0xb0000800 /* LED control registers */ +#define HSSPIM_BASE 0xb0001000 /* High-Speed SPI registers */ +#define MISC_BASE 0xb0001800 /* Miscellaneous Registers */ +#define ADSL_CTRL_BASE 0xb0001900 +#define USB_CTL_BASE 0xb0002400 /* USB 2.0 device control registers */ +#define USB_EHCI_BASE 0x10002500 /* USB host registers */ +#define USB_OHCI_BASE 0x10002600 /* USB host registers */ +#define USBH_CFG_BASE 0xb0002700 +#define DDR_BASE 0xb0003000 /* Memory control registers */ +#define PCM_BASE 0xb000a000 +#define PCM_DMA_BASE 0xb000a800 /* PCM UIDMA register base */ +#define SAR_DMA_BASE 0xb000b800 /* ATM SAR DMA control registers */ +#define USB_DMA_BASE 0xb000c000 /* USB 2.0 device DMA regiseters */ +#define SWITCH_DMA_BASE 0xb000d800 +#define SWITCH_BASE 0xb0e00000 +#define PCIE_BASE 0xb0e40000 + + +/* +##################################################################### +# System PLL Control Register +##################################################################### +*/ + +/* +##################################################################### +# GPIO Control Registers +##################################################################### +*/ + +/* +##################################################################### +# Miscellaneous Registers +##################################################################### +*/ +#define MISC_MEMC_CONTROL 0x0c +#define MISC_STRAP_BUS 0x240 +#define MISC_STRAP_BUS_MIPS_PLL_FVCO_SHIFT 7 + +/* +##################################################################### +# OTP Registers +##################################################################### +*/ +#define OTP_USER_BITS 0x20 +#define OTP_TP1_DISABLE_BIT 9 + +/* +##################################################################### +# Memory Control Registers +##################################################################### +*/ +#define DDR_CTL_CNFG 0x000 +#define DDR_CTL_CSST 0x004 +#define DDR_CTL_CSEND 0x008 +#define DDR_CTL_ROW00_0 0x010 +#define DDR_CTL_ROW00_1 0x014 +#define DDR_CTL_ROW01_0 0x018 +#define DDR_CTL_ROW01_1 0x01c +#define DDR_CTL_ROW20_0 0x030 +#define DDR_CTL_ROW20_1 0x034 +#define DDR_CTL_ROW21_0 0x038 +#define DDR_CTL_ROW21_1 0x03c +#define DDR_CTL_COL00_0 0x050 +#define DDR_CTL_COL00_1 0x054 +#define DDR_CTL_COL01_0 0x058 +#define DDR_CTL_COL01_1 0x05c +#define DDR_CTL_COL20_0 0x070 +#define DDR_CTL_COL20_1 0x074 +#define DDR_CTL_COL21_0 0x078 +#define DDR_CTL_COL21_1 0x07c +#define DDR_CTL_BNK10 0x090 +#define DDR_CTL_BNK32 0x094 +#define DDR_CTL_DCMD 0x100 +#define DDR_CTL_DMODE_0 0x104 +#define DDR_CTL_DMODE_1 0x108 +#define DDR_CTL_CLKS 0x10c +#define DDR_CTL_ODT 0x110 +#define DDR_CTL_TIM1_0 0x114 +#define DDR_CTL_TIM1_1 0x118 +#define DDR_CTL_TIM2 0x11c +#define DDR_CTL_CTL_CRC 0x120 +#define DDR_CTL_DOUT_CRC 0x124 +#define DDR_CTL_DIN_CRC 0x128 +#define PHY_CONTROL_REGS_REVISION 0x200 +#define PHY_CONTROL_REGS_CLK_PM_CTRL 0x204 +#define PHY_CONTROL_REGS_PLL_STATUS 0x210 +#define PHY_CONTROL_REGS_PLL_CONFIG 0x214 +#define PHY_CONTROL_REGS_PLL_PRE_DIVIDER 0x218 +#define PHY_CONTROL_REGS_PLL_DIVIDER 0x21c +#define PHY_CONTROL_REGS_PLL_CONTROL1 0x220 +#define PHY_CONTROL_REGS_PLL_CONTROL2 0x224 +#define PHY_CONTROL_REGS_PLL_SS_EN 0x228 +#define PHY_CONTROL_REGS_PLL_SS_CFG 0x22c +#define PHY_CONTROL_REGS_STATIC_VDL_OVERRIDE 0x230 +#define PHY_CONTROL_REGS_DYNAMIC_VDL_OVERRIDE 0x234 +#define PHY_CONTROL_REGS_IDLE_PAD_CONTROL 0x238 +#define PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL 0x23c +#define PHY_CONTROL_REGS_DRIVE_PAD_CTL 0x240 +#define PHY_CONTROL_REGS_CLOCK_REG_CONTROL 0x244 + +#define PHY_BYTE_LANE_0_REVISION 0x300 +#define PHY_BYTE_LANE_0_VDL_CALIBRATE 0x304 +#define PHY_BYTE_LANE_0_VDL_STATUS 0x308 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_0 0x310 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_1 0x314 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_2 0x318 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_3 0x31c +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_4 0x320 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_5 0x324 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_6 0x328 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_7 0x32c +#define PHY_BYTE_LANE_0_READ_CONTROL 0x330 +#define PHY_BYTE_LANE_0_READ_FIFO_STATUS 0x334 +#define PHY_BYTE_LANE_0_READ_FIFO_CLEAR 0x338 +#define PHY_BYTE_LANE_0_IDLE_PAD_CONTROL 0x33c +#define PHY_BYTE_LANE_0_DRIVE_PAD_CTL 0x340 +#define PHY_BYTE_LANE_0_CLOCK_PAD_DISABLE 0x344 +#define PHY_BYTE_LANE_0_WR_PREAMBLE_MODE 0x348 +#define PHY_BYTE_LANE_0_CLOCK_REG_CONTROL 0x34c + +#define PHY_BYTE_LANE_1_REVISION 0x400 +#define PHY_BYTE_LANE_1_VDL_CALIBRATE 0x404 +#define PHY_BYTE_LANE_1_VDL_STATUS 0x408 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_0 0x410 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_1 0x414 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_2 0x418 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_3 0x41c +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_4 0x420 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_5 0x424 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_6 0x428 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_7 0x42c +#define PHY_BYTE_LANE_1_READ_CONTROL 0x430 +#define PHY_BYTE_LANE_1_READ_FIFO_STATUS 0x434 +#define PHY_BYTE_LANE_1_READ_FIFO_CLEAR 0x438 +#define PHY_BYTE_LANE_1_IDLE_PAD_CONTROL 0x43c +#define PHY_BYTE_LANE_1_DRIVE_PAD_CTL 0x440 +#define PHY_BYTE_LANE_1_CLOCK_PAD_DISABLE 0x444 +#define PHY_BYTE_LANE_1_WR_PREAMBLE_MODE 0x448 +#define PHY_BYTE_LANE_1_CLOCK_REG_CONTROL 0x44c + +#define PHY_BYTE_LANE_2_REVISION 0x500 +#define PHY_BYTE_LANE_2_VDL_CALIBRATE 0x504 +#define PHY_BYTE_LANE_2_VDL_STATUS 0x508 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_0 0x510 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_1 0x514 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_2 0x518 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_3 0x51c +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_4 0x520 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_5 0x524 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_6 0x528 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_7 0x52c +#define PHY_BYTE_LANE_2_READ_CONTROL 0x530 +#define PHY_BYTE_LANE_2_READ_FIFO_STATUS 0x534 +#define PHY_BYTE_LANE_2_READ_FIFO_CLEAR 0x538 +#define PHY_BYTE_LANE_2_IDLE_PAD_CONTROL 0x53c +#define PHY_BYTE_LANE_2_DRIVE_PAD_CTL 0x540 +#define PHY_BYTE_LANE_2_CLOCK_PAD_DISABLE 0x544 +#define PHY_BYTE_LANE_2_WR_PREAMBLE_MODE 0x548 +#define PHY_BYTE_LANE_2_CLOCK_REG_CONTROL 0x54c + +#define PHY_BYTE_LANE_3_REVISION 0x600 +#define PHY_BYTE_LANE_3_VDL_CALIBRATE 0x604 +#define PHY_BYTE_LANE_3_VDL_STATUS 0x608 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_0 0x610 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_1 0x614 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_2 0x618 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_3 0x61c +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_4 0x620 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_5 0x624 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_6 0x628 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_7 0x62c +#define PHY_BYTE_LANE_3_READ_CONTROL 0x630 +#define PHY_BYTE_LANE_3_READ_FIFO_STATUS 0x634 +#define PHY_BYTE_LANE_3_READ_FIFO_CLEAR 0x638 +#define PHY_BYTE_LANE_3_IDLE_PAD_CONTROL 0x63c +#define PHY_BYTE_LANE_3_DRIVE_PAD_CTL 0x640 +#define PHY_BYTE_LANE_3_CLOCK_PAD_DISABLE 0x644 +#define PHY_BYTE_LANE_3_WR_PREAMBLE_MODE 0x648 +#define PHY_BYTE_LANE_3_CLOCK_REG_CONTROL 0x64c + +#define DDR_CTL_GCFG 0x800 +#define DDR_CTL_LBIST_CFG 0x804 +#define DDR_CTL_LBIST_SEED 0x808 +#define DDR_CTL_ARB 0x80c +#define DDR_CTL_PI_GCF 0x810 +#define DDR_CTL_PI_UBUS_CTL 0x814 +#define DDR_CTL_PI_MIPS_CTL 0x818 +#define DDR_CTL_PI_DSL_MIPS_CTL 0x81c +#define DDR_CTL_PI_DSL_PHY_CTL 0x820 +#define DDR_CTL_PI_UBUS_ST 0x824 +#define DDR_CTL_PI_MIPS_ST 0x828 +#define DDR_CTL_PI_DSL_MIPS_ST 0x82c +#define DDR_CTL_PI_DSL_PHY_ST 0x830 +#define DDR_CTL_PI_UBUS_SMPL 0x834 +#define DDR_CTL_TESTMODE 0x838 +#define DDR_CTL_TEST_CFG1 0x83c +#define DDR_CTL_TEST_PAT 0x840 +#define DDR_CTL_TEST_COUNT 0x844 +#define DDR_CTL_TEST_CURR_COUNT 0x848 +#define DDR_CTL_TEST_ADDR_UPDT 0x84c +#define DDR_CTL_TEST_ADDR 0x850 +#define DDR_CTL_TEST_DATA0 0x854 +#define DDR_CTL_TEST_DATA1 0x858 +#define DDR_CTL_TEST_DATA2 0x85c +#define DDR_CTL_TEST_DATA3 0x860 + + +/* +##################################################################### +# UART Control Registers +##################################################################### +*/ +#define UART0CONTROL 0x01 +#define UART0CONFIG 0x02 +#define UART0RXTIMEOUT 0x03 +#define UART0BAUD 0x04 +#define UART0FIFOCFG 0x0a +#define UART0INTMASK 0x10 +#define UART0INTSTAT 0x12 +#define UART0DATA 0x17 + +#define BRGEN 0x80 /* Control register bit defs */ +#define TXEN 0x40 +#define RXEN 0x20 +#define LOOPBK 0x10 +#define TXPARITYEN 0x08 +#define TXPARITYEVEN 0x04 +#define RXPARITYEN 0x02 +#define RXPARITYEVEN 0x01 + +#define XMITBREAK 0x40 /* Config register */ +#define BITS5SYM 0x00 +#define BITS6SYM 0x10 +#define BITS7SYM 0x20 +#define BITS8SYM 0x30 +#define ONESTOP 0x07 +#define TWOSTOP 0x0f + +#define DELTAIP 0x0001 +#define TXUNDERR 0x0002 +#define TXOVFERR 0x0004 +#define TXFIFOTHOLD 0x0008 +#define TXREADLATCH 0x0010 +#define TXFIFOEMT 0x0020 +#define RXUNDERR 0x0040 +#define RXOVFERR 0x0080 +#define RXTIMEOUT 0x0100 +#define RXFIFOFULL 0x0200 +#define RXFIFOTHOLD 0x0400 +#define RXFIFONE 0x0800 +#define RXFRAMERR 0x1000 +#define RXPARERR 0x2000 +#define RXBRK 0x4000 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/shared/broadcom/include/bcm963xx/6328_map.h b/shared/broadcom/include/bcm963xx/6328_map.h new file mode 100755 index 0000000..246d211 --- /dev/null +++ b/shared/broadcom/include/bcm963xx/6328_map.h @@ -0,0 +1,1886 @@ +/* +<:copyright-broadcom + + Copyright (c) 2007 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +/***********************************************************************/ +/* */ +/* MODULE: 6328_map.h */ +/* DATE: 05/30/08 */ +/* PURPOSE: Define addresses of major hardware components of */ +/* BCM6328 */ +/* */ +/***********************************************************************/ +#ifndef __BCM6328_MAP_H +#define __BCM6328_MAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bcmtypes.h" +#include "6328_common.h" +#include "6328_intr.h" + +/* macro to convert logical data addresses to physical */ +/* DMA hardware must see physical address */ +#define LtoP( x ) ( (uint32)x & 0x1fffffff ) +#define PtoL( x ) ( LtoP(x) | 0xa0000000 ) + +typedef struct DDRPhyControl { + uint32 REVISION; /* 0x00 */ + uint32 CLK_PM_CTRL; /* 0x04 */ + uint32 unused0[2]; /* 0x08-0x10 */ + uint32 PLL_STATUS; /* 0x10 */ + uint32 PLL_CONFIG; /* 0x14 */ + uint32 PLL_PRE_DIVIDER; /* 0x18 */ + uint32 PLL_DIVIDER; /* 0x1c */ + uint32 PLL_CONTROL1; /* 0x20 */ + uint32 PLL_CONTROL2; /* 0x24 */ + uint32 PLL_SS_EN; /* 0x28 */ + uint32 PLL_SS_CFG; /* 0x2c */ + uint32 STATIC_VDL_OVERRIDE; /* 0x30 */ + uint32 DYNAMIC_VDL_OVERRIDE; /* 0x34 */ + uint32 IDLE_PAD_CONTROL; /* 0x38 */ + uint32 ZQ_PVT_COMP_CTL; /* 0x3c */ + uint32 DRIVE_PAD_CTL; /* 0x40 */ + uint32 CLOCK_REG_CONTROL; /* 0x44 */ + uint32 unused1[46]; +} DDRPhyControl; + +typedef struct DDRPhyByteLaneControl { + uint32 REVISION; /* 0x00 */ + uint32 VDL_CALIBRATE; /* 0x04 */ + uint32 VDL_STATUS; /* 0x08 */ + uint32 unused; /* 0x0c */ + uint32 VDL_OVERRIDE_0; /* 0x10 */ + uint32 VDL_OVERRIDE_1; /* 0x14 */ + uint32 VDL_OVERRIDE_2; /* 0x18 */ + uint32 VDL_OVERRIDE_3; /* 0x1c */ + uint32 VDL_OVERRIDE_4; /* 0x20 */ + uint32 VDL_OVERRIDE_5; /* 0x24 */ + uint32 VDL_OVERRIDE_6; /* 0x28 */ + uint32 VDL_OVERRIDE_7; /* 0x2c */ + uint32 READ_CONTROL; /* 0x30 */ + uint32 READ_FIFO_STATUS; /* 0x34 */ + uint32 READ_FIFO_CLEAR; /* 0x38 */ + uint32 IDLE_PAD_CONTROL; /* 0x3c */ + uint32 DRIVE_PAD_CTL; /* 0x40 */ + uint32 CLOCK_PAD_DISABLE; /* 0x44 */ + uint32 WR_PREAMBLE_MODE; /* 0x48 */ + uint32 CLOCK_REG_CONTROL; /* 0x4C */ + uint32 unused0[44]; +} DDRPhyByteLaneControl; + +typedef struct DDRControl { + uint32 CNFG; /* 0x000 */ + uint32 CSST; /* 0x004 */ + uint32 CSEND; /* 0x008 */ + uint32 unused; /* 0x00c */ + uint32 ROW00_0; /* 0x010 */ + uint32 ROW00_1; /* 0x014 */ + uint32 ROW01_0; /* 0x018 */ + uint32 ROW01_1; /* 0x01c */ + uint32 unused0[4]; + uint32 ROW20_0; /* 0x030 */ + uint32 ROW20_1; /* 0x034 */ + uint32 ROW21_0; /* 0x038 */ + uint32 ROW21_1; /* 0x03c */ + uint32 unused1[4]; + uint32 COL00_0; /* 0x050 */ + uint32 COL00_1; /* 0x054 */ + uint32 COL01_0; /* 0x058 */ + uint32 COL01_1; /* 0x05c */ + uint32 unused2[4]; + uint32 COL20_0; /* 0x070 */ + uint32 COL20_1; /* 0x074 */ + uint32 COL21_0; /* 0x078 */ + uint32 COL21_1; /* 0x07c */ + uint32 unused3[4]; + uint32 BNK10; /* 0x090 */ + uint32 BNK32; /* 0x094 */ + uint32 unused4[26]; + uint32 DCMD; /* 0x100 */ +#define DCMD_CS1 (1 << 5) +#define DCMD_CS0 (1 << 4) +#define DCMD_SET_SREF 4 + uint32 DMODE_0; /* 0x104 */ + uint32 DMODE_1; /* 0x108 */ +#define DMODE_1_DRAMSLEEP (1 << 11) + uint32 CLKS; /* 0x10c */ + uint32 ODT; /* 0x110 */ + uint32 TIM1_0; /* 0x114 */ + uint32 TIM1_1; /* 0x118 */ + uint32 TIM2; /* 0x11c */ + uint32 CTL_CRC; /* 0x120 */ + uint32 DOUT_CRC; /* 0x124 */ + uint32 DIN_CRC; /* 0x128 */ + uint32 unused5[53]; + + DDRPhyControl PhyControl; /* 0x200 */ + DDRPhyByteLaneControl PhyByteLane0Control; /* 0x300 */ + DDRPhyByteLaneControl PhyByteLane1Control; /* 0x400 */ + DDRPhyByteLaneControl PhyByteLane2Control; /* 0x500 */ + DDRPhyByteLaneControl PhyByteLane3Control; /* 0x600 */ + uint32 unused6[64]; + + uint32 GCFG; /* 0x800 */ + uint32 LBIST_CFG; /* 0x804 */ + uint32 LBIST_SEED; /* 0x808 */ + uint32 ARB; /* 0x80c */ + uint32 PI_GCF; /* 0x810 */ + uint32 PI_UBUS_CTL; /* 0x814 */ + uint32 PI_MIPS_CTL; /* 0x818 */ + uint32 PI_DSL_MIPS_CTL; /* 0x81c */ + uint32 PI_DSL_PHY_CTL; /* 0x820 */ + uint32 PI_UBUS_ST; /* 0x824 */ + uint32 PI_MIPS_ST; /* 0x828 */ + uint32 PI_DSL_MIPS_ST; /* 0x82c */ + uint32 PI_DSL_PHY_ST; /* 0x830 */ + uint32 PI_UBUS_SMPL; /* 0x834 */ + uint32 TESTMODE; /* 0x838 */ + uint32 TEST_CFG1; /* 0x83c */ + uint32 TEST_PAT; /* 0x840 */ + uint32 TEST_COUNT; /* 0x844 */ + uint32 TEST_CURR_COUNT; /* 0x848 */ + uint32 TEST_ADDR_UPDT; /* 0x84c */ + uint32 TEST_ADDR; /* 0x850 */ + uint32 TEST_DATA0; /* 0x854 */ + uint32 TEST_DATA1; /* 0x858 */ + uint32 TEST_DATA2; /* 0x85c */ + uint32 TEST_DATA3; /* 0x860 */ +} DDRControl; + +#define DDR ((volatile DDRControl * const) DDR_BASE) + +/* +** Peripheral Controller +*/ + +#define IRQ_BITS 64 +typedef struct { + uint64 IrqMask; + uint64 IrqStatus; +} IrqControl_t; + +typedef struct PerfControl { + uint32 RevID; /* (00) word 0 */ + uint32 blkEnables; /* (04) word 1 */ +#define ROBOSW_CLK_EN (1 << 11) +#define PCIE_CLK_EN (1 << 10) +#define HS_SPI_CLK_EN (1 << 9) +#define USBH_CLK_EN (1 << 8) +#define USBD_CLK_EN (1 << 7) +#define PCM_CLK_EN (1 << 6) +#define SAR_CLK_EN (1 << 5) +#define MIPS_CLK_EN (1 << 4) +#define ADSL_CLK_EN (1 << 3) +#define ADSL_AFE_EN (1 << 2) +#define ADSL_QPROC_EN (1 << 1) +#define PHYMIPS_CLK_EN (1 << 0) + + uint32 unused0; /* (08) word 2 */ + uint32 deviceTimeoutEn; /* (0c) word 3 */ + uint32 softResetB; /* (10) word 4 */ +#define SOFT_RST_PCIE_HARD (1 << 10) +#define SOFT_RST_PCIE_EXT (1 << 9) +#define SOFT_RST_PCIE (1 << 8) +#define SOFT_RST_PCIE_CORE (1 << 7) +#define SOFT_RST_PCM (1 << 6) +#define SOFT_RST_USBH (1 << 5) +#define SOFT_RST_USBD (1 << 4) +#define SOFT_RST_SWITCH (1 << 3) +#define SOFT_RST_SAR (1 << 2) +#define SOFT_RST_EPHY (1 << 1) +#define SOFT_RST_SPI (1 << 0) + + uint32 diagControl; /* (14) word 5 */ + uint32 ExtIrqCfg; /* (18) word 6*/ + uint32 unused1; /* (1c) word 7 */ +#define EI_SENSE_SHFT 0 +#define EI_STATUS_SHFT 4 +#define EI_CLEAR_SHFT 8 +#define EI_MASK_SHFT 12 +#define EI_INSENS_SHFT 16 +#define EI_LEVEL_SHFT 20 + + IrqControl_t IrqControl[2]; +} PerfControl; + +#define PERF ((volatile PerfControl * const) PERF_BASE) + +/* +** Timer +*/ +typedef struct Timer { + uint16 unused0; + byte TimerMask; +#define TIMER0EN 0x01 +#define TIMER1EN 0x02 +#define TIMER2EN 0x04 + byte TimerInts; +#define TIMER0 0x01 +#define TIMER1 0x02 +#define TIMER2 0x04 +#define WATCHDOG 0x08 + uint32 TimerCtl0; + uint32 TimerCtl1; + uint32 TimerCtl2; +#define TIMERENABLE 0x80000000 +#define RSTCNTCLR 0x40000000 + uint32 TimerCnt0; + uint32 TimerCnt1; + uint32 TimerCnt2; + uint32 WatchDogDefCount; + + /* Write 0xff00 0x00ff to Start timer + * Write 0xee00 0x00ee to Stop and re-load default count + * Read from this register returns current watch dog count + */ + uint32 WatchDogCtl; + + /* Number of 50-MHz ticks for WD Reset pulse to last */ + uint32 WDResetCount; + + uint32 SoftRst; +#define SOFT_RESET 0x00000001 // 0 +} Timer; + +#define TIMER ((volatile Timer * const) TIMR_BASE) + +/* +** UART +*/ +typedef struct UartChannel { + byte unused0; + byte control; +#define BRGEN 0x80 /* Control register bit defs */ +#define TXEN 0x40 +#define RXEN 0x20 +#define LOOPBK 0x10 +#define TXPARITYEN 0x08 +#define TXPARITYEVEN 0x04 +#define RXPARITYEN 0x02 +#define RXPARITYEVEN 0x01 + + byte config; +#define XMITBREAK 0x40 +#define BITS5SYM 0x00 +#define BITS6SYM 0x10 +#define BITS7SYM 0x20 +#define BITS8SYM 0x30 +#define ONESTOP 0x07 +#define TWOSTOP 0x0f + /* 4-LSBS represent STOP bits/char + * in 1/8 bit-time intervals. Zero + * represents 1/8 stop bit interval. + * Fifteen represents 2 stop bits. + */ + byte fifoctl; +#define RSTTXFIFOS 0x80 +#define RSTRXFIFOS 0x40 + /* 5-bit TimeoutCnt is in low bits of this register. + * This count represents the number of characters + * idle times before setting receive Irq when below threshold + */ + uint32 baudword; + /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate + */ + + byte txf_levl; /* Read-only fifo depth */ + byte rxf_levl; /* Read-only fifo depth */ + byte fifocfg; /* Upper 4-bits are TxThresh, Lower are + * RxThreshold. Irq can be asserted + * when rx fifo> thresh, txfifo>8)&0xf) +#define UDC20_INTF(x) ((x>>4)&0xf) +#define UDC20_CFG(x) ((x>>0)&0xf) + uint32 usbd_status; +#define USBD_LINK (0x1<<10) +#define USBD_SET_CSRS 0x40 +#define USBD_SUSPEND 0x20 +#define USBD_EARLY_SUSPEND 0x10 +#define USBD_SOF 0x08 +#define USBD_ENUMON 0x04 +#define USBD_SETUP 0x02 +#define USBD_USBRESET 0x01 + uint32 usbd_events; + uint32 usbd_events_irq; +#define UPPER(x) (16+x) +#define ENABLE(x) (1< +*/ +/***********************************************************************/ +/* */ +/* MODULE: 6362_common.h */ +/* DATE: 02/01/08 */ +/* PURPOSE: Define addresses of major hardware components of */ +/* BCM6362 */ +/* */ +/***********************************************************************/ +#ifndef __BCM6362_MAP_COMMON_H +#define __BCM6362_MAP_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define PERF_BASE 0xb0000000 /* chip control registers */ +#define TIMR_BASE 0xb0000040 /* timer registers */ +#define NAND_INTR_BASE 0xb0000070 /* nand interrupt control registers */ +#define GPIO_BASE 0xb0000080 /* gpio registers */ +#define UART_BASE 0xb0000100 /* uart registers */ +#define UART1_BASE 0xb0000120 /* uart registers */ +#define NAND_REG_BASE 0xb0000200 +#define OTP_BASE 0xb0000400 +#define UBUS_STAT_BASE 0xb0000500 +#define NAND_CACHE_BASE 0xb0000600 +#define SPI_BASE 0xb0000800 /* SPI master controller registers */ +#define HSSPIM_BASE 0xb0001000 /* High-Speed SPI registers */ +#define ADSL_CTRL_BASE 0xb0001800 +#define MISC_BASE 0xb0001800 /* Miscellaneous Registers */ +#define LED_BASE 0xb0001900 /* LED control registers */ +#define USB_CTL_BASE 0xb0002400 /* USB 2.0 device control registers */ +#define USB_EHCI_BASE 0x10002500 /* USB host registers */ +#define USB_OHCI_BASE 0x10002600 /* USB host registers */ +#define USBH_CFG_BASE 0xb0002700 +#define IPSEC_BASE 0xb0002800 +#define DDR_BASE 0xb0003000 /* Memory control registers */ +#define WLAN_CHIPC_BASE 0x10004000 /* WLAN ChipCommon registers, use 1xxx for ioremap */ +#define WLAN_MAC_BASE 0x10005000 /* WLAN d11mac registers */ +#define WLAN_SHIM_BASE 0xb0007000 /* shim interface to WLAN */ +#define PCM_BASE 0xb000a000 +#define PCM_DMA_BASE 0xb000a800 /* PCM UIDMA register base */ +#define SAR_DMA_BASE 0xb000b800 /* ATM SAR DMA control registers */ +#define USB_DMA_BASE 0xb000c000 /* USB 2.0 device DMA regiseters */ +#define IPSEC_DMA_BASE 0xb000d000 +#define SWITCH_DMA_BASE 0xb000d800 +#define SWITCH_BASE 0xb0e00000 +#define PCIE_BASE 0xb0e40000 +#define DECT_SHIM_CTRL_BASE 0xb000b000 +#define DECT_SHIM_DMA_CTRL_BASE 0xb000b050 +#define DECT_SHIM_TEST_BASE 0xb000b0f0 +#define DECT_APB_REG_BASE 0xb000e000 +#define DECT_AHB_SHARED_RAM_BASE 0xb0e50000 +#define DECT_AHB_REG_BASE 0xb0e57f80 + + +/* +##################################################################### +# System PLL Control Register +##################################################################### +*/ + +/* +##################################################################### +# GPIO Control Registers +##################################################################### +*/ +/* +##################################################################### +# Miscellaneous Registers +##################################################################### +*/ +#define MISC_MEMC_CONTROL 0x10 +#define MISC_STRAP_BUS 0x14 +#define MISC_STRAP_BUS_MIPS_PLL_FVCO_SHIFT 1 + +#define MISC_VREG_CONTROL0 0x1C +#define MISC_VREG_CONTROL0_VREG_ADJ_SHIFT 8 +#define MISC_VREG_CONTROL0_VREG_OSC1P2_SHIFT 20 +#define MISC_VREG_CONTROL0_VREG_OSC1P8_SHIFT 22 +#define MISC_VREG_CONTROL0_VREG_RAMP1P2_SHIFT 26 +#define MISC_VREG_CONTROL0_VREG_RAMP1P8_SHIFT 29 + +#define MISC_VREG_CONTROL1 0x20 +#define MISC_VREG_CONTROL1_VREG_ISEL2P5_SHIFT 13 +#define MISC_VREG_CONTROL1_VREG_ISEL2P5_MASK 0x0001e000 +#define MISC_VREG_LDO_2P61 1 + +#define MISC_VREG_CONTROL2 0x24 + +/* +##################################################################### +# Memory Control Registers +##################################################################### +*/ +#define DDR_CTL_CNFG 0x000 +#define DDR_CTL_CSST 0x004 +#define DDR_CTL_CSEND 0x008 +#define DDR_CTL_ROW00_0 0x010 +#define DDR_CTL_ROW00_1 0x014 +#define DDR_CTL_ROW01_0 0x018 +#define DDR_CTL_ROW01_1 0x01c +#define DDR_CTL_ROW20_0 0x030 +#define DDR_CTL_ROW20_1 0x034 +#define DDR_CTL_ROW21_0 0x038 +#define DDR_CTL_ROW21_1 0x03c +#define DDR_CTL_COL00_0 0x050 +#define DDR_CTL_COL00_1 0x054 +#define DDR_CTL_COL01_0 0x058 +#define DDR_CTL_COL01_1 0x05c +#define DDR_CTL_COL20_0 0x070 +#define DDR_CTL_COL20_1 0x074 +#define DDR_CTL_COL21_0 0x078 +#define DDR_CTL_COL21_1 0x07c +#define DDR_CTL_BNK10 0x090 +#define DDR_CTL_BNK32 0x094 +#define DDR_CTL_DCMD 0x100 +#define DDR_CTL_DMODE_0 0x104 +#define DDR_CTL_DMODE_1 0x108 +#define DDR_CTL_CLKS 0x10c +#define DDR_CTL_ODT 0x110 +#define DDR_CTL_TIM1_0 0x114 +#define DDR_CTL_TIM1_1 0x118 +#define DDR_CTL_TIM2 0x11c +#define DDR_CTL_CTL_CRC 0x120 +#define DDR_CTL_DOUT_CRC 0x124 +#define DDR_CTL_DIN_CRC 0x128 +#define PHY_CONTROL_REGS_REVISION 0x200 +#define PHY_CONTROL_REGS_CLK_PM_CTRL 0x204 +#define PHY_CONTROL_REGS_PLL_STATUS 0x210 +#define PHY_CONTROL_REGS_PLL_CONFIG 0x214 +#define PHY_CONTROL_REGS_PLL_PRE_DIVIDER 0x218 +#define PHY_CONTROL_REGS_PLL_DIVIDER 0x21c +#define PHY_CONTROL_REGS_PLL_CONTROL1 0x220 +#define PHY_CONTROL_REGS_PLL_CONTROL2 0x224 +#define PHY_CONTROL_REGS_PLL_SS_EN 0x228 +#define PHY_CONTROL_REGS_PLL_SS_CFG 0x22c +#define PHY_CONTROL_REGS_STATIC_VDL_OVERRIDE 0x230 +#define PHY_CONTROL_REGS_DYNAMIC_VDL_OVERRIDE 0x234 +#define PHY_CONTROL_REGS_IDLE_PAD_CONTROL 0x238 +#define PHY_CONTROL_REGS_ZQ_PVT_COMP_CTL 0x23c +#define PHY_CONTROL_REGS_DRIVE_PAD_CTL 0x240 +#define PHY_BYTE_LANE_0_REVISION 0x300 +#define PHY_BYTE_LANE_0_VDL_CALIBRATE 0x304 +#define PHY_BYTE_LANE_0_VDL_STATUS 0x308 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_0 0x310 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_1 0x314 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_2 0x318 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_3 0x31c +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_4 0x320 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_5 0x324 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_6 0x328 +#define PHY_BYTE_LANE_0_VDL_OVERRIDE_7 0x32c +#define PHY_BYTE_LANE_0_READ_CONTROL 0x330 +#define PHY_BYTE_LANE_0_READ_FIFO_STATUS 0x334 +#define PHY_BYTE_LANE_0_READ_FIFO_CLEAR 0x338 +#define PHY_BYTE_LANE_0_IDLE_PAD_CONTROL 0x33c +#define PHY_BYTE_LANE_0_DRIVE_PAD_CTL 0x340 +#define PHY_BYTE_LANE_0_CLOCK_PAD_DISABLE 0x344 +#define PHY_BYTE_LANE_0_WR_PREAMBLE_MODE 0x348 +#define PHY_BYTE_LANE_1_REVISION 0x400 +#define PHY_BYTE_LANE_1_VDL_CALIBRATE 0x404 +#define PHY_BYTE_LANE_1_VDL_STATUS 0x408 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_0 0x410 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_1 0x414 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_2 0x418 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_3 0x41c +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_4 0x420 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_5 0x424 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_6 0x428 +#define PHY_BYTE_LANE_1_VDL_OVERRIDE_7 0x42c +#define PHY_BYTE_LANE_1_READ_CONTROL 0x430 +#define PHY_BYTE_LANE_1_READ_FIFO_STATUS 0x434 +#define PHY_BYTE_LANE_1_READ_FIFO_CLEAR 0x438 +#define PHY_BYTE_LANE_1_IDLE_PAD_CONTROL 0x43c +#define PHY_BYTE_LANE_1_DRIVE_PAD_CTL 0x440 +#define PHY_BYTE_LANE_1_CLOCK_PAD_DISABLE 0x444 +#define PHY_BYTE_LANE_1_WR_PREAMBLE_MODE 0x448 +#define PHY_BYTE_LANE_2_REVISION 0x500 +#define PHY_BYTE_LANE_2_VDL_CALIBRATE 0x504 +#define PHY_BYTE_LANE_2_VDL_STATUS 0x508 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_0 0x510 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_1 0x514 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_2 0x518 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_3 0x51c +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_4 0x520 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_5 0x524 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_6 0x528 +#define PHY_BYTE_LANE_2_VDL_OVERRIDE_7 0x52c +#define PHY_BYTE_LANE_2_READ_CONTROL 0x530 +#define PHY_BYTE_LANE_2_READ_FIFO_STATUS 0x534 +#define PHY_BYTE_LANE_2_READ_FIFO_CLEAR 0x538 +#define PHY_BYTE_LANE_2_IDLE_PAD_CONTROL 0x53c +#define PHY_BYTE_LANE_2_DRIVE_PAD_CTL 0x540 +#define PHY_BYTE_LANE_2_CLOCK_PAD_DISABLE 0x544 +#define PHY_BYTE_LANE_2_WR_PREAMBLE_MODE 0x548 +#define PHY_BYTE_LANE_3_REVISION 0x600 +#define PHY_BYTE_LANE_3_VDL_CALIBRATE 0x604 +#define PHY_BYTE_LANE_3_VDL_STATUS 0x608 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_0 0x610 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_1 0x614 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_2 0x618 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_3 0x61c +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_4 0x620 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_5 0x624 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_6 0x628 +#define PHY_BYTE_LANE_3_VDL_OVERRIDE_7 0x62c +#define PHY_BYTE_LANE_3_READ_CONTROL 0x630 +#define PHY_BYTE_LANE_3_READ_FIFO_STATUS 0x634 +#define PHY_BYTE_LANE_3_READ_FIFO_CLEAR 0x638 +#define PHY_BYTE_LANE_3_IDLE_PAD_CONTROL 0x63c +#define PHY_BYTE_LANE_3_DRIVE_PAD_CTL 0x640 +#define PHY_BYTE_LANE_3_CLOCK_PAD_DISABLE 0x644 +#define PHY_BYTE_LANE_3_WR_PREAMBLE_MODE 0x648 +#define DDR_CTL_GCFG 0x800 +#define DDR_CTL_LBIST_CFG 0x804 +#define DDR_CTL_LBIST_SEED 0x808 +#define DDR_CTL_ARB 0x80c +#define DDR_CTL_PI_GCF 0x810 +#define DDR_CTL_PI_UBUS_CTL 0x814 +#define DDR_CTL_PI_MIPS_CTL 0x818 +#define DDR_CTL_PI_DSL_MIPS_CTL 0x81c +#define DDR_CTL_PI_DSL_PHY_CTL 0x820 +#define DDR_CTL_PI_UBUS_ST 0x824 +#define DDR_CTL_PI_MIPS_ST 0x828 +#define DDR_CTL_PI_DSL_MIPS_ST 0x82c +#define DDR_CTL_PI_DSL_PHY_ST 0x830 +#define DDR_CTL_PI_UBUS_SMPL 0x834 +#define DDR_CTL_TESTMODE 0x838 +#define DDR_CTL_TEST_CFG1 0x83c +#define DDR_CTL_TEST_PAT 0x840 +#define DDR_CTL_TEST_COUNT 0x844 +#define DDR_CTL_TEST_CURR_COUNT 0x848 +#define DDR_CTL_TEST_ADDR_UPDT 0x84c +#define DDR_CTL_TEST_ADDR 0x850 +#define DDR_CTL_TEST_DATA0 0x854 +#define DDR_CTL_TEST_DATA1 0x858 +#define DDR_CTL_TEST_DATA2 0x85c +#define DDR_CTL_TEST_DATA3 0x860 + + +/* +##################################################################### +# UART Control Registers +##################################################################### +*/ +#define UART0CONTROL 0x01 +#define UART0CONFIG 0x02 +#define UART0RXTIMEOUT 0x03 +#define UART0BAUD 0x04 +#define UART0FIFOCFG 0x0a +#define UART0INTMASK 0x10 +#define UART0INTSTAT 0x12 +#define UART0DATA 0x17 + +#define BRGEN 0x80 /* Control register bit defs */ +#define TXEN 0x40 +#define RXEN 0x20 +#define LOOPBK 0x10 +#define TXPARITYEN 0x08 +#define TXPARITYEVEN 0x04 +#define RXPARITYEN 0x02 +#define RXPARITYEVEN 0x01 + +#define XMITBREAK 0x40 /* Config register */ +#define BITS5SYM 0x00 +#define BITS6SYM 0x10 +#define BITS7SYM 0x20 +#define BITS8SYM 0x30 +#define ONESTOP 0x07 +#define TWOSTOP 0x0f + +#define DELTAIP 0x0001 +#define TXUNDERR 0x0002 +#define TXOVFERR 0x0004 +#define TXFIFOTHOLD 0x0008 +#define TXREADLATCH 0x0010 +#define TXFIFOEMT 0x0020 +#define RXUNDERR 0x0040 +#define RXOVFERR 0x0080 +#define RXTIMEOUT 0x0100 +#define RXFIFOFULL 0x0200 +#define RXFIFOTHOLD 0x0400 +#define RXFIFONE 0x0800 +#define RXFRAMERR 0x1000 +#define RXPARERR 0x2000 +#define RXBRK 0x4000 + + +/* +##################################################################### +# DECT IP Control Registers +##################################################################### +*/ +#define DECT_STARTCTL 0xb0e50818 +#define PCM_BUFF_CTL3 0xb0e5082c +#define PCM_BUFF_CTL7 0xb0e5083c +#define DECT_AHB_CHAN0_RX 0xb0e50a20 +#define DECT_AHB_CHAN1_RX 0xb0e50de0 +#define DECT_AHB_CHAN2_RX 0xb0e511a0 +#define DECT_AHB_CHAN3_RX 0xb0e51560 +#define DECT_AHB_CHAN0_TX 0xb0e50840 +#define DECT_AHB_CHAN1_TX 0xb0e50c00 +#define DECT_AHB_CHAN2_TX 0xb0e50fc0 +#define DECT_AHB_CHAN3_TX 0xb0e51380 +#define DECT_CLKEN 0x00000040 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/shared/broadcom/include/bcm963xx/6362_map.h b/shared/broadcom/include/bcm963xx/6362_map.h new file mode 100755 index 0000000..d0fa38f --- /dev/null +++ b/shared/broadcom/include/bcm963xx/6362_map.h @@ -0,0 +1,2251 @@ +/* +<:copyright-broadcom + + Copyright (c) 2007 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +/***********************************************************************/ +/* */ +/* MODULE: 6362_map.h */ +/* DATE: 05/30/08 */ +/* PURPOSE: Define addresses of major hardware components of */ +/* BCM6362 */ +/* */ +/***********************************************************************/ +#ifndef __BCM6362_MAP_H +#define __BCM6362_MAP_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "bcmtypes.h" +#include "6362_common.h" +#include "6362_intr.h" + +/* macro to convert logical data addresses to physical */ +/* DMA hardware must see physical address */ +#define LtoP( x ) ( (uint32)x & 0x1fffffff ) +#define PtoL( x ) ( LtoP(x) | 0xa0000000 ) + +typedef struct DDRPhyControl { + uint32 REVISION; /* 0x00 */ + uint32 CLK_PM_CTRL; /* 0x04 */ + uint32 unused0[2]; /* 0x08-0x10 */ + uint32 PLL_STATUS; /* 0x10 */ + uint32 PLL_CONFIG; /* 0x14 */ + uint32 PLL_PRE_DIVIDER; /* 0x18 */ + uint32 PLL_DIVIDER; /* 0x1c */ + uint32 PLL_CONTROL1; /* 0x20 */ + uint32 PLL_CONTROL2; /* 0x24 */ + uint32 PLL_SS_EN; /* 0x28 */ + uint32 PLL_SS_CFG; /* 0x2c */ + uint32 STATIC_VDL_OVERRIDE; /* 0x30 */ + uint32 DYNAMIC_VDL_OVERRIDE; /* 0x34 */ + uint32 IDLE_PAD_CONTROL; /* 0x38 */ + uint32 ZQ_PVT_COMP_CTL; /* 0x3c */ + uint32 DRIVE_PAD_CTL; /* 0x40 */ + uint32 CLOCK_REG_CONTROL; /* 0x44 */ + uint32 unused1[46]; +} DDRPhyControl; + +typedef struct DDRPhyByteLaneControl { + uint32 REVISION; /* 0x00 */ + uint32 VDL_CALIBRATE; /* 0x04 */ + uint32 VDL_STATUS; /* 0x08 */ + uint32 unused; /* 0x0c */ + uint32 VDL_OVERRIDE_0; /* 0x10 */ + uint32 VDL_OVERRIDE_1; /* 0x14 */ + uint32 VDL_OVERRIDE_2; /* 0x18 */ + uint32 VDL_OVERRIDE_3; /* 0x1c */ + uint32 VDL_OVERRIDE_4; /* 0x20 */ + uint32 VDL_OVERRIDE_5; /* 0x24 */ + uint32 VDL_OVERRIDE_6; /* 0x28 */ + uint32 VDL_OVERRIDE_7; /* 0x2c */ + uint32 READ_CONTROL; /* 0x30 */ + uint32 READ_FIFO_STATUS; /* 0x34 */ + uint32 READ_FIFO_CLEAR; /* 0x38 */ + uint32 IDLE_PAD_CONTROL; /* 0x3c */ + uint32 DRIVE_PAD_CTL; /* 0x40 */ + uint32 CLOCK_PAD_DISABLE; /* 0x44 */ + uint32 WR_PREAMBLE_MODE; /* 0x48 */ + uint32 CLOCK_REG_CONTROL; /* 0x4C */ + uint32 unused0[44]; +} DDRPhyByteLaneControl; + +typedef struct DDRControl { + uint32 CNFG; /* 0x000 */ + uint32 CSST; /* 0x004 */ + uint32 CSEND; /* 0x008 */ + uint32 unused; /* 0x00c */ + uint32 ROW00_0; /* 0x010 */ + uint32 ROW00_1; /* 0x014 */ + uint32 ROW01_0; /* 0x018 */ + uint32 ROW01_1; /* 0x01c */ + uint32 unused0[4]; + uint32 ROW20_0; /* 0x030 */ + uint32 ROW20_1; /* 0x034 */ + uint32 ROW21_0; /* 0x038 */ + uint32 ROW21_1; /* 0x03c */ + uint32 unused1[4]; + uint32 COL00_0; /* 0x050 */ + uint32 COL00_1; /* 0x054 */ + uint32 COL01_0; /* 0x058 */ + uint32 COL01_1; /* 0x05c */ + uint32 unused2[4]; + uint32 COL20_0; /* 0x070 */ + uint32 COL20_1; /* 0x074 */ + uint32 COL21_0; /* 0x078 */ + uint32 COL21_1; /* 0x07c */ + uint32 unused3[4]; + uint32 BNK10; /* 0x090 */ + uint32 BNK32; /* 0x094 */ + uint32 unused4[26]; + uint32 DCMD; /* 0x100 */ +#define DCMD_CS1 (1 << 5) +#define DCMD_CS0 (1 << 4) +#define DCMD_SET_SREF 4 + uint32 DMODE_0; /* 0x104 */ + uint32 DMODE_1; /* 0x108 */ +#define DMODE_1_DRAMSLEEP (1 << 11) + uint32 CLKS; /* 0x10c */ + uint32 ODT; /* 0x110 */ + uint32 TIM1_0; /* 0x114 */ + uint32 TIM1_1; /* 0x118 */ + uint32 TIM2; /* 0x11c */ + uint32 CTL_CRC; /* 0x120 */ + uint32 DOUT_CRC; /* 0x124 */ + uint32 DIN_CRC; /* 0x128 */ + uint32 unused5[53]; + + DDRPhyControl PhyControl; /* 0x200 */ + DDRPhyByteLaneControl PhyByteLane0Control; /* 0x300 */ + DDRPhyByteLaneControl PhyByteLane1Control; /* 0x400 */ + DDRPhyByteLaneControl PhyByteLane2Control; /* 0x500 */ + DDRPhyByteLaneControl PhyByteLane3Control; /* 0x600 */ + uint32 unused6[64]; + + uint32 GCFG; /* 0x800 */ + uint32 LBIST_CFG; /* 0x804 */ + uint32 LBIST_SEED; /* 0x808 */ + uint32 ARB; /* 0x80c */ + uint32 PI_GCF; /* 0x810 */ + uint32 PI_UBUS_CTL; /* 0x814 */ + uint32 PI_MIPS_CTL; /* 0x818 */ + uint32 PI_DSL_MIPS_CTL; /* 0x81c */ + uint32 PI_DSL_PHY_CTL; /* 0x820 */ + uint32 PI_UBUS_ST; /* 0x824 */ + uint32 PI_MIPS_ST; /* 0x828 */ + uint32 PI_DSL_MIPS_ST; /* 0x82c */ + uint32 PI_DSL_PHY_ST; /* 0x830 */ + uint32 PI_UBUS_SMPL; /* 0x834 */ + uint32 TESTMODE; /* 0x838 */ + uint32 TEST_CFG1; /* 0x83c */ + uint32 TEST_PAT; /* 0x840 */ + uint32 TEST_COUNT; /* 0x844 */ + uint32 TEST_CURR_COUNT; /* 0x848 */ + uint32 TEST_ADDR_UPDT; /* 0x84c */ + uint32 TEST_ADDR; /* 0x850 */ + uint32 TEST_DATA0; /* 0x854 */ + uint32 TEST_DATA1; /* 0x858 */ + uint32 TEST_DATA2; /* 0x85c */ + uint32 TEST_DATA3; /* 0x860 */ +} DDRControl; + +#define DDR ((volatile DDRControl * const) DDR_BASE) + +/* +** Peripheral Controller +*/ + +#define IRQ_BITS 64 +typedef struct { + uint64 IrqMask; + uint64 IrqStatus; +} IrqControl_t; + +typedef struct PerfControl { + uint32 RevID; /* (00) word 0 */ + uint32 blkEnables; /* (04) word 1 */ +#define NAND_CLK_EN (1 << 20) +#define PHYMIPS_CLK_EN (1 << 19) +#define FAP_CLK_EN (1 << 18) +#define PCIE_CLK_EN (1 << 17) +#define HS_SPI_CLK_EN (1 << 16) +#define SPI_CLK_EN (1 << 15) +#define IPSEC_CLK_EN (1 << 14) +#define USBH_CLK_EN (1 << 13) +#define USBD_CLK_EN (1 << 12) +#define PCM_CLK_EN (1 << 11) +#define ROBOSW_CLK_EN (1 << 10) +#define SAR_CLK_EN (1 << 9) +#define SWPKT_SAR_CLK_EN (1 << 8) +#define SWPKT_USB_CLK_EN (1 << 7) +#define WLAN_OCP_CLK_EN (1 << 5) +#define MIPS_CLK_EN (1 << 4) +#define ADSL_CLK_EN (1 << 3) +#define ADSL_AFE_EN (1 << 2) +#define ADSL_QPROC_EN (1 << 1) +#define DISABLE_GLESS (1 << 0) + + uint32 pll_control; /* (08) word 2 */ +#define SOFT_RESET 0x00000001 // 0 + + uint32 deviceTimeoutEn; /* (0c) word 3 */ + uint32 softResetB; /* (10) word 4 */ +#define SOFT_RST_WLAN_SHIM_UBUS (1 << 14) +#define SOFT_RST_FAP (1 << 13) +#define SOFT_RST_DDR_PHY (1 << 12) +#define SOFT_RST_WLAN_SHIM (1 << 11) +#define SOFT_RST_PCIE_EXT (1 << 10) +#define SOFT_RST_PCIE (1 << 9) +#define SOFT_RST_PCIE_CORE (1 << 8) +#define SOFT_RST_PCM (1 << 7) +#define SOFT_RST_USBH (1 << 6) +#define SOFT_RST_USBD (1 << 5) +#define SOFT_RST_SWITCH (1 << 4) +#define SOFT_RST_SAR (1 << 3) +#define SOFT_RST_EPHY (1 << 2) +#define SOFT_RST_IPSEC (1 << 1) +#define SOFT_RST_SPI (1 << 0) + + uint32 diagControl; /* (14) word 5 */ + uint32 ExtIrqCfg; /* (18) word 6*/ + uint32 unused1; /* (1c) word 7 */ +#define EI_SENSE_SHFT 0 +#define EI_STATUS_SHFT 4 +#define EI_CLEAR_SHFT 8 +#define EI_MASK_SHFT 12 +#define EI_INSENS_SHFT 16 +#define EI_LEVEL_SHFT 20 + + IrqControl_t IrqControl[2]; +} PerfControl; + +#define PERF ((volatile PerfControl * const) PERF_BASE) + +/* +** Timer +*/ +typedef struct Timer { + uint16 unused0; + byte TimerMask; +#define TIMER0EN 0x01 +#define TIMER1EN 0x02 +#define TIMER2EN 0x04 + byte TimerInts; +#define TIMER0 0x01 +#define TIMER1 0x02 +#define TIMER2 0x04 +#define WATCHDOG 0x08 + uint32 TimerCtl0; + uint32 TimerCtl1; + uint32 TimerCtl2; +#define TIMERENABLE 0x80000000 +#define RSTCNTCLR 0x40000000 + uint32 TimerCnt0; + uint32 TimerCnt1; + uint32 TimerCnt2; + uint32 WatchDogDefCount; + + /* Write 0xff00 0x00ff to Start timer + * Write 0xee00 0x00ee to Stop and re-load default count + * Read from this register returns current watch dog count + */ + uint32 WatchDogCtl; + + /* Number of 50-MHz ticks for WD Reset pulse to last */ + uint32 WDResetCount; +} Timer; + +#define TIMER ((volatile Timer * const) TIMR_BASE) + +/* +** UART +*/ +typedef struct UartChannel { + byte unused0; + byte control; +#define BRGEN 0x80 /* Control register bit defs */ +#define TXEN 0x40 +#define RXEN 0x20 +#define LOOPBK 0x10 +#define TXPARITYEN 0x08 +#define TXPARITYEVEN 0x04 +#define RXPARITYEN 0x02 +#define RXPARITYEVEN 0x01 + + byte config; +#define XMITBREAK 0x40 +#define BITS5SYM 0x00 +#define BITS6SYM 0x10 +#define BITS7SYM 0x20 +#define BITS8SYM 0x30 +#define ONESTOP 0x07 +#define TWOSTOP 0x0f + /* 4-LSBS represent STOP bits/char + * in 1/8 bit-time intervals. Zero + * represents 1/8 stop bit interval. + * Fifteen represents 2 stop bits. + */ + byte fifoctl; +#define RSTTXFIFOS 0x80 +#define RSTRXFIFOS 0x40 + /* 5-bit TimeoutCnt is in low bits of this register. + * This count represents the number of characters + * idle times before setting receive Irq when below threshold + */ + uint32 baudword; + /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate + */ + + byte txf_levl; /* Read-only fifo depth */ + byte rxf_levl; /* Read-only fifo depth */ + byte fifocfg; /* Upper 4-bits are TxThresh, Lower are + * RxThreshold. Irq can be asserted + * when rx fifo> thresh, txfifoUserBits[((sizeof(OTP->UserBits)/4) - (x)/32 - 1)] >> ((x) % 32)) & 1) + +/* +** Spi Controller +*/ + +typedef struct SpiControl { + uint16 spiMsgCtl; /* (0x0) control byte */ +#define FULL_DUPLEX_RW 0 +#define HALF_DUPLEX_W 1 +#define HALF_DUPLEX_R 2 +#define SPI_MSG_TYPE_SHIFT 14 +#define SPI_BYTE_CNT_SHIFT 0 + byte spiMsgData[0x21e]; /* (0x02 - 0x21f) msg data */ + byte unused0[0x1e0]; + byte spiRxDataFifo[0x220]; /* (0x400 - 0x61f) rx data */ + byte unused1[0xe0]; + + uint16 spiCmd; /* (0x700): SPI command */ +#define SPI_CMD_NOOP 0 +#define SPI_CMD_SOFT_RESET 1 +#define SPI_CMD_HARD_RESET 2 +#define SPI_CMD_START_IMMEDIATE 3 + +#define SPI_CMD_COMMAND_SHIFT 0 +#define SPI_CMD_COMMAND_MASK 0x000f + +#define SPI_CMD_DEVICE_ID_SHIFT 4 +#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT 8 +#define SPI_CMD_ONE_BYTE_SHIFT 11 +#define SPI_CMD_ONE_WIRE_SHIFT 12 +#define SPI_DEV_ID_0 0 +#define SPI_DEV_ID_1 1 +#define SPI_DEV_ID_2 2 +#define SPI_DEV_ID_3 3 + + byte spiIntStatus; /* (0x702): SPI interrupt status */ + byte spiMaskIntStatus; /* (0x703): SPI masked interrupt status */ + + byte spiIntMask; /* (0x704): SPI interrupt mask */ +#define SPI_INTR_CMD_DONE 0x01 +#define SPI_INTR_RX_OVERFLOW 0x02 +#define SPI_INTR_INTR_TX_UNDERFLOW 0x04 +#define SPI_INTR_TX_OVERFLOW 0x08 +#define SPI_INTR_RX_UNDERFLOW 0x10 +#define SPI_INTR_CLEAR_ALL 0x1f + + byte spiStatus; /* (0x705): SPI status */ +#define SPI_RX_EMPTY 0x02 +#define SPI_CMD_BUSY 0x04 +#define SPI_SERIAL_BUSY 0x08 + + byte spiClkCfg; /* (0x706): SPI clock configuration */ +#define SPI_CLK_0_391MHZ 1 +#define SPI_CLK_0_781MHZ 2 /* default */ +#define SPI_CLK_1_563MHZ 3 +#define SPI_CLK_3_125MHZ 4 +#define SPI_CLK_6_250MHZ 5 +#define SPI_CLK_12_50MHZ 6 +#define SPI_CLK_MASK 0x07 +#define SPI_SSOFFTIME_MASK 0x38 +#define SPI_SSOFFTIME_SHIFT 3 +#define SPI_BYTE_SWAP 0x80 + + byte spiFillByte; /* (0x707): SPI fill byte */ + byte unused2; + byte spiMsgTail; /* (0x709): msgtail */ + byte unused3; + byte spiRxTail; /* (0x70B): rxtail */ +} SpiControl; + +#define SPI ((volatile SpiControl * const) SPI_BASE) + + +/* +** High-Speed SPI Controller +*/ + +#define __mask(end, start) (((1 << ((end - start) + 1)) - 1) << start) +typedef struct HsSpiControl { + + uint32 hs_spiGlobalCtrl; // 0x0000 +#define HS_SPI_MOSI_IDLE (1 << 18) +#define HS_SPI_CLK_POLARITY (1 << 17) +#define HS_SPI_CLK_GATE_SSOFF (1 << 16) +#define HS_SPI_PLL_CLK_CTRL (8) +#define HS_SPI_PLL_CLK_CTRL_MASK __mask(15, HS_SPI_PLL_CLK_CTRL) +#define HS_SPI_SS_POLARITY (0) +#define HS_SPI_SS_POLARITY_MASK __mask(7, HS_SPI_SS_POLARITY) + + uint32 hs_spiExtTrigCtrl; // 0x0004 +#define HS_SPI_TRIG_RAW_STATE (24) +#define HS_SPI_TRIG_RAW_STATE_MASK __mask(31, HS_SPI_TRIG_RAW_STATE) +#define HS_SPI_TRIG_LATCHED (16) +#define HS_SPI_TRIG_LATCHED_MASK __mask(23, HS_SPI_TRIG_LATCHED) +#define HS_SPI_TRIG_SENSE (8) +#define HS_SPI_TRIG_SENSE_MASK __mask(15, HS_SPI_TRIG_SENSE) +#define HS_SPI_TRIG_TYPE (0) +#define HS_SPI_TRIG_TYPE_MASK __mask(7, HS_SPI_TRIG_TYPE) +#define HS_SPI_TRIG_TYPE_EDGE (0) +#define HS_SPI_TRIG_TYPE_LEVEL (1) + + uint32 hs_spiIntStatus; // 0x0008 +#define HS_SPI_IRQ_PING1_USER (28) +#define HS_SPI_IRQ_PING1_USER_MASK __mask(31, HS_SPI_IRQ_PING1_USER) +#define HS_SPI_IRQ_PING0_USER (24) +#define HS_SPI_IRQ_PING0_USER_MASK __mask(27, HS_SPI_IRQ_PING0_USER) + +#define HS_SPI_IRQ_PING1_CTRL_INV (1 << 12) +#define HS_SPI_IRQ_PING1_POLL_TOUT (1 << 11) +#define HS_SPI_IRQ_PING1_TX_UNDER (1 << 10) +#define HS_SPI_IRQ_PING1_RX_OVER (1 << 9) +#define HS_SPI_IRQ_PING1_CMD_DONE (1 << 8) + +#define HS_SPI_IRQ_PING0_CTRL_INV (1 << 4) +#define HS_SPI_IRQ_PING0_POLL_TOUT (1 << 3) +#define HS_SPI_IRQ_PING0_TX_UNDER (1 << 2) +#define HS_SPI_IRQ_PING0_RX_OVER (1 << 1) +#define HS_SPI_IRQ_PING0_CMD_DONE (1 << 0) + + uint32 hs_spiIntStatusMasked; // 0x000C +#define HS_SPI_IRQSM__PING1_USER (28) +#define HS_SPI_IRQSM__PING1_USER_MASK __mask(31, HS_SPI_IRQSM__PING1_USER) +#define HS_SPI_IRQSM__PING0_USER (24) +#define HS_SPI_IRQSM__PING0_USER_MASK __mask(27, HS_SPI_IRQSM__PING0_USER) + +#define HS_SPI_IRQSM__PING1_CTRL_INV (1 << 12) +#define HS_SPI_IRQSM__PING1_POLL_TOUT (1 << 11) +#define HS_SPI_IRQSM__PING1_TX_UNDER (1 << 10) +#define HS_SPI_IRQSM__PING1_RX_OVER (1 << 9) +#define HS_SPI_IRQSM__PING1_CMD_DONE (1 << 8) + +#define HS_SPI_IRQSM__PING0_CTRL_INV (1 << 4) +#define HS_SPI_IRQSM__PING0_POLL_TOUT (1 << 3) +#define HS_SPI_IRQSM__PING0_TX_UNDER (1 << 2) +#define HS_SPI_IRQSM__PING0_RX_OVER (1 << 1) +#define HS_SPI_IRQSM__PING0_CMD_DONE (1 << 0) + + uint32 hs_spiIntMask; // 0x0010 +#define HS_SPI_IRQM_PING1_USER (28) +#define HS_SPI_IRQM_PING1_USER_MASK __mask(31, HS_SPI_IRQM_PING1_USER) +#define HS_SPI_IRQM_PING0_USER (24) +#define HS_SPI_IRQM_PING0_USER_MASK __mask(27, HS_SPI_IRQM_PING0_USER) + +#define HS_SPI_IRQM_PING1_CTRL_INV (1 << 12) +#define HS_SPI_IRQM_PING1_POLL_TOUT (1 << 11) +#define HS_SPI_IRQM_PING1_TX_UNDER (1 << 10) +#define HS_SPI_IRQM_PING1_RX_OVER (1 << 9) +#define HS_SPI_IRQM_PING1_CMD_DONE (1 << 8) + +#define HS_SPI_IRQM_PING0_CTRL_INV (1 << 4) +#define HS_SPI_IRQM_PING0_POLL_TOUT (1 << 3) +#define HS_SPI_IRQM_PING0_TX_UNDER (1 << 2) +#define HS_SPI_IRQM_PING0_RX_OVER (1 << 1) +#define HS_SPI_IRQM_PING0_CMD_DONE (1 << 0) + +#define HS_SPI_INTR_CLEAR_ALL (0xFF001F1F) + + uint32 hs_spiFlashCtrl; // 0x0014 +#define HS_SPI_FCTRL_MB_ENABLE (1 << 23) +#define HS_SPI_FCTRL_SS_NUM (20) +#define HS_SPI_FCTRL_SS_NUM_MASK __mask(22, HS_SPI_FCTRL_SS_NUM) +#define HS_SPI_FCTRL_PROFILE_NUM (16) +#define HS_SPI_FCTRL_PROFILE_NUM_MASK __mask(18, HS_SPI_FCTRL_PROFILE_NUM) +#define HS_SPI_FCTRL_DUMMY_BYTES (10) +#define HS_SPI_FCTRL_DUMMY_BYTES_MASK __mask(11, HS_SPI_FCTRL_DUMMY_BYTES) +#define HS_SPI_FCTRL_ADDR_BYTES (8) +#define HS_SPI_FCTRL_ADDR_BYTES_MASK __mask(9, HS_SPI_FCTRL_ADDR_BYTES) +#define HS_SPI_FCTRL_ADDR_BYTES_2 (0) +#define HS_SPI_FCTRL_ADDR_BYTES_3 (1) +#define HS_SPI_FCTRL_ADDR_BYTES_4 (2) +#define HS_SPI_FCTRL_READ_OPCODE (0) +#define HS_SPI_FCTRL_READ_OPCODE_MASK __mask(7, HS_SPI_FCTRL_READ_OPCODE) + + uint32 hs_spiFlashAddrBase; // 0x0018 + + char fill0[0x80 - 0x18]; + + uint32 hs_spiPP_0_Cmd; // 0x0080 +#define HS_SPI_PP_SS_NUM (12) +#define HS_SPI_PP_SS_NUM_MASK __mask(14, HS_SPI_PP_SS_NUM) +#define HS_SPI_PP_PROFILE_NUM (8) +#define HS_SPI_PP_PROFILE_NUM_MASK __mask(10, HS_SPI_PP_PROFILE_NUM) + +} HsSpiControl; + +typedef struct HsSpiPingPong { + + uint32 command; +#define HS_SPI_SS_NUM (12) +#define HS_SPI_PROFILE_NUM (8) +#define HS_SPI_TRIGGER_NUM (4) +#define HS_SPI_COMMAND_VALUE (0) + #define HS_SPI_COMMAND_NOOP (0) + #define HS_SPI_COMMAND_START_NOW (1) + #define HS_SPI_COMMAND_START_TRIGGER (2) + #define HS_SPI_COMMAND_HALT (3) + #define HS_SPI_COMMAND_FLUSH (4) + + uint32 status; +#define HS_SPI_ERROR_BYTE_OFFSET (16) +#define HS_SPI_WAIT_FOR_TRIGGER (2) +#define HS_SPI_SOURCE_BUSY (1) +#define HS_SPI_SOURCE_GNT (0) + + uint32 fifo_status; + uint32 control; + +} HsSpiPingPong; + +typedef struct HsSpiProfile { + + uint32 clk_ctrl; +#define HS_SPI_ACCUM_RST_ON_LOOP (15) +#define HS_SPI_SPI_CLK_2X_SEL (14) +#define HS_SPI_FREQ_CTRL_WORD (0) + + uint32 signal_ctrl; +#define HS_SPI_ASYNC_INPUT_PATH (1 << 16) +#define HS_SPI_LAUNCH_RISING (1 << 13) +#define HS_SPI_LATCH_RISING (1 << 12) + + uint32 mode_ctrl; +#define HS_SPI_PREPENDBYTE_CNT (24) +#define HS_SPI_MODE_ONE_WIRE (20) +#define HS_SPI_MULTIDATA_WR_SIZE (18) +#define HS_SPI_MULTIDATA_RD_SIZE (16) +#define HS_SPI_MULTIDATA_WR_STRT (12) +#define HS_SPI_MULTIDATA_RD_STRT (8) +#define HS_SPI_FILLBYTE (0) + + uint32 polling_config; + uint32 polling_and_mask; + uint32 polling_compare; + uint32 polling_timeout; + uint32 reserved; + +} HsSpiProfile; + +#define HS_SPI_OP_CODE 13 + #define HS_SPI_OP_SLEEP (0) + #define HS_SPI_OP_READ_WRITE (1) + #define HS_SPI_OP_WRITE (2) + #define HS_SPI_OP_READ (3) + #define HS_SPI_OP_SETIRQ (4) + +#define HS_SPI ((volatile HsSpiControl * const) HSSPIM_BASE) +#define HS_SPI_PINGPONG0 ((volatile HsSpiPingPong * const) (HSSPIM_BASE+0x80)) +#define HS_SPI_PINGPONG1 ((volatile HsSpiPingPong * const) (HSSPIM_BASE+0xc0)) +#define HS_SPI_PROFILES ((volatile HsSpiProfile * const) (HSSPIM_BASE+0x100)) +#define HS_SPI_FIFO0 ((volatile uint8 * const) (HSSPIM_BASE+0x200)) +#define HS_SPI_FIFO1 ((volatile uint8 * const) (HSSPIM_BASE+0x400)) + + +/* +** Misc Register Set Definitions. +*/ + +typedef struct Misc { + uint32 unused1; /* 0x00 */ + uint32 miscSerdesCtrl; /* 0x04 */ +#define SERDES_PCIE_ENABLE 0x00000001 +#define SERDES_PCIE_EXD_ENABLE (1<<15) + + uint32 miscSerdesSts; /* 0x08 */ + uint32 miscIrqOutMask; /* 0x0C */ +#define MISC_PCIE_EP_IRQ_MASK0 (1<<0) +#define MISC_PCIE_EP_IRQ_MASK1 (1<<1) + + uint32 miscMemcControl; /* 0x10 */ +#define MISC_MEMC_CONTROL_MC_UBUS_ASYNC_MODE (1<<3) +#define MISC_MEMC_CONTROL_MC_LMB_ASYNC_MODE (1<<2) +#define MISC_MEMC_CONTROL_DDR_TEST_DONE (1<<1) +#define MISC_MEMC_CONTROL_DDR_TEST_DISABLE (1<<0) + + uint32 miscStrapBus; /* 0x14 */ +#define MISC_STRAP_BUS_RESET_CFG_DELAY (1<<18) +#define MISC_STRAP_BUS_RESET_OUT_SHIFT 16 +#define MISC_STRAP_BUS_RESET_OUT_MASK (3<>8)&0xf) +#define UDC20_INTF(x) ((x>>4)&0xf) +#define UDC20_CFG(x) ((x>>0)&0xf) + uint32 usbd_status; +#define USBD_LINK (0x1<<10) +#define USBD_SET_CSRS 0x40 +#define USBD_SUSPEND 0x20 +#define USBD_EARLY_SUSPEND 0x10 +#define USBD_SOF 0x08 +#define USBD_ENUMON 0x04 +#define USBD_SETUP 0x02 +#define USBD_USBRESET 0x01 + uint32 usbd_events; + uint32 usbd_events_irq; +#define UPPER(x) (16+x) +#define ENABLE(x) (1< +*/ +/***********************************************************************/ +/* */ +/* MODULE: 6368_common.h */ +/* DATE: 02/06/07 */ +/* PURPOSE: Define addresses of major hardware components of */ +/* BCM6368 */ +/* */ +/***********************************************************************/ +#ifndef __BCM6368_MAP_COMMON_H +#define __BCM6368_MAP_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define PERF_BASE 0xb0000000 /* chip control registers */ +#define TIMR_BASE 0xb0000040 /* timer registers */ +#define NAND_INTR_BASE 0xb0000070 /* nand interrupt control registers */ +#define GPIO_BASE 0xb0000080 /* gpio registers */ +#define UART_BASE 0xb0000100 /* uart registers */ +#define UART1_BASE 0xb0000120 /* uart registers */ +#define NAND_REG_BASE 0xb0000200 +#define NAND_SEC_BASE 0xb0000300 +#define OTP_BASE 0xb0000400 +#define UBUS_STAT_BASE 0xb0000500 +#define NAND_CACHE_BASE 0xb0000600 +#define SPI_BASE 0xb0000800 /* SPI master controller registers */ +#define MPI_BASE 0xb0001000 /* MPI control registers */ +#define MEMC_BASE 0xb0001200 /* Memory control registers */ +#define DDR_BASE 0xb0001280 /* DDR IO Buf Control registers */ +#define USB_CTL_BASE 0xb0001400 /* USB 2.0 device control registers */ +#define USB_EHCI_BASE 0x10001500 /* USB host registers */ +#define USB_OHCI_BASE 0x10001600 /* USB host registers */ +#define USBH_CFG_BASE 0xb0001700 +#define SAR_BASE 0xb0001800 /* ATM SAR control registers */ +#define SAR_CMF_BASE 0xb0002000 /* ATM SAR CMF control registers */ +#define PCM_BASE 0xb0004000 /* PCM control registers */ +#define IPSEC_BASE 0xb0004100 +#define USB_DMA_BASE 0xb0004800 /* USB 2.0 device DMA regiseters */ +#define SAR_DMA_BASE 0xb0005000 /* ATM SAR DMA control registers */ +#define PCM_DMA_BASE 0xb0005800 /* PCM UIDMA register base */ +#define IPSEC_DMA_BASE 0xb0006000 +#define SWITCH_DMA_BASE 0xb0006800 +#define SWITCH_BASE 0xb0f00000 +#define SWITCH_CMF_BASE 0xb0f0a000 /* Switch CMF register base */ + +#define ADSL_PHY_BASE 0xb0f40000 +#define ADSL_ENUM_BASE 0xb0f56000 +#define ADSL_LMEM_BASE 0xb0f80000 + +/* +##################################################################### +# System PLL Control Register +##################################################################### +*/ + + +/* +##################################################################### +# GPIO Control Registers +##################################################################### +*/ + + +/* +##################################################################### +# Memory Control Registers +##################################################################### +*/ +#define MEMC_CONTROL 0x0 +#define MEMC_CONFIG 0x4 +#define MEMC_REF_PD_CONTROL 0x8 +#define MEMC_BIST_STATUS 0xc +#define MEMC_M_EM_BUF 0x10 +#define MEMC_BANK_CLS_TIM 0x14 +#define MEMC_PRIOR_INV_TIM 0x18 +#define MEMC_DRAM_TIM 0x1c +#define MEMC_INT_STATUS 0x20 +#define MEMC_INT_MASK 0x24 +#define MEMC_INT_INFO 0x28 +#define MEMC_BARRIER 0x50 +#define MEMC_CORE_ID 0x54 + +#define DDR_REV_ID 0x0 +#define DDR_PAD_SSTL_MODE 0x4 +#define DDR_CMD_PAD_CNTL 0x8 +#define DDR_DQ_PAD_CNTL 0xc +#define DDR_DQS_PAD_CNTL 0x10 +#define DDR_CLK_PAD_CNTL 0x14 +#define DDR_PLL_CNTL0 0x18 +#define DDR_PLL_CNTL1 0x1c +#define DDR_MIPSDDR_PLL_CONFIG 0x20 +#define DDR_MIPSDDR_PLL_MDIV 0x24 +#define DDR_DSL_PHY_PHASE_CNTL 0x28 +#define DDR_DSL_CPU_PHASE_CNTL 0x2c +#define DDR_MIPS_PHASE_CNTL 0x30 +#define DDR_DDR1_2_PHASE_CNTL 0x34 +#define DDR_DDR3_4_PHASE_CNTL 0x38 +#define DDR_VCDL_PHASE_CNTL0 0x3c +#define DDR_VCDL_PHASE_CNTL1 0x40 +#define DDR_BSLICE_CNTL 0x44 +#define DDR_DESKEW_DLL_CNTL 0x48 +#define DDR_DESKEW_DLL_RESET 0x4c +#define DDR_DESKEW_DLL_PHASE 0x50 +#define DDR_ANALOG_TEST_CNTL 0x54 +#define DDR_RD_DQS_GATE_CNTL 0x58 +#define DDR_MISC 0x5c +#define DDR_SPARE0 0x60 +#define DDR_SPARE1 0x64 +#define DDR_SPARE2 0x68 +#define DDR_CLBIST 0x6c +#define DDR_LBIST_CRC 0x70 +#define DDR_UBUS_PHASE_CNTR 0x74 +#define DDR_UBUS_PI_DSK0 0x78 +#define DDR_UBUS_PI_DSK1 0x7c + +// Some bit/field definitions for the MEMC_CONFIG register. +#define MEMC_EARLY_HDR_CNT_SHFT 25 +#define MEMC_EARLY_HDR_CNT_MASK (0x7< +*/ +/***********************************************************************/ +/* */ +/* MODULE: 6368_map.h */ +/* DATE: 02/06/07 */ +/* PURPOSE: Define addresses of major hardware components of */ +/* BCM6368 */ +/* */ +/***********************************************************************/ +#ifndef __BCM6368_MAP_H +#define __BCM6368_MAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bcmtypes.h" +#include "6368_common.h" +#include "6368_intr.h" + +/* macro to convert logical data addresses to physical */ +/* DMA hardware must see physical address */ +#define LtoP( x ) ( (uint32)x & 0x1fffffff ) +#define PtoL( x ) ( LtoP(x) | 0xa0000000 ) + +typedef struct MemoryControl +{ + uint32 Control; /* (00) */ +#define MEMC_SELF_REFRESH (1<<6) // enable self refresh mode +#define MEMC_MRS (1<<4) // generate a mode register select cycle +#define MEMC_PRECHARGE (1<<3) // generate a precharge cycle +#define MEMC_REFRESH (1<<2) // generate an auto refresh cycle +#define MEMC_SEQUENCE_ENABLE (1<<1) // enable memory controller sequencer +#define MEMC_MASTER_ENABLE (1<<0) // enable accesses to external sdram + + uint32 Config; /* (04) */ +#define MEMC_EARLY_HDR_CNT_SHFT 25 +#define MEMC_EARLY_HDR_CNT_MASK (0x7< thresh, txfifo>8)&0xf) +#define UDC20_INTF(x) ((x>>4)&0xf) +#define UDC20_CFG(x) ((x>>0)&0xf) + uint32 usbd_status; +#define USBD_LINK (0x1<<10) +#define USBD_SET_CSRS 0x40 +#define USBD_SUSPEND 0x20 +#define USBD_EARLY_SUSPEND 0x10 +#define USBD_SOF 0x08 +#define USBD_ENUMON 0x04 +#define USBD_SETUP 0x02 +#define USBD_USBRESET 0x01 + uint32 usbd_events; + uint32 usbd_events_irq; +#define UPPER(x) (16+x) +#define ENABLE(x) (1< +*/ +/***********************************************************************/ +/* */ +/* MODULE: 6816_common.h */ +/* DATE: 02/01/08 */ +/* PURPOSE: Define addresses of major hardware components of */ +/* BCM6816 */ +/* */ +/***********************************************************************/ +#ifndef __BCM6816_MAP_COMMON_H +#define __BCM6816_MAP_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define PERF_BASE 0xb0000000 /* chip control registers */ +#define TIMR_BASE 0xb0000040 /* timer registers */ +#define NAND_INTR_BASE 0xb0000070 +#define GPIO_BASE 0xb0000080 /* gpio registers */ +#define UART_BASE 0xb0000100 /* uart registers */ +#define UART1_BASE 0xb0000120 /* uart registers */ +#define I2C_BASE 0xb0000180 +#define OTP_BASE 0xb0000400 +#define UBUS_STAT_BASE 0xb0000500 +#define SPI_BASE 0xb0000800 /* SPI master controller registers */ +#define HSSPIM_BASE 0xb0001000 +#define MISC_BASE 0xb0001800 +#define NAND_REG_BASE 0xb0002000 /* NAND control registers */ +#define MPI_BASE 0xb00020A0 /* MPI control registers */ +#define PCI_BASE 0xb0002100 /* PCI control registers */ +#define NAND_CACHE_BASE 0xb0002200 +#define USB_CTL_BASE 0xb0002400 /* USB 2.0 device control registers */ +#define USB_EHCI_BASE 0x10002500 /* USB host registers */ +#define USB_OHCI_BASE 0x10002600 /* USB host registers */ +#define USBH_CFG_BASE 0xb0002700 +#define IPSEC_BASE 0xb0002800 +#define DDR_BASE 0xb0003000 /* Memory control registers */ +#define GPON_BASE 0xb0004000 +#define APM_BASE 0xb0008000 +#define PCM_BASE 0xb0008200 +#define APM_HVG_BASE 0xb0008300 +#define APM_IUDMA_BASE 0xb0008800 +#define BMU_BASE 0xb0009000 /* fff9D000-fff9Dfff */ +#define USB_DMA_BASE 0xb000c000 /* USB 2.0 device DMA regiseters */ +#define GPON_DMA_BASE 0xb000c800 +#define IPSEC_DMA_BASE 0xb000d000 +#define SWITCH_DMA_BASE 0xb000d800 +#define SWITCH_DMA_CONFIG 0xb000da00 +#define SWITCH_DMA_STATE 0xb000dc00 +#define APM_MEM_BASE 0xb0010000 +#define MOCA_MEM_BASE 0xb0d00000 +#define MOCA_IO_BASE 0xb0d80000 +#define SWITCH_BASE 0xb0e00000 +#define PCIE_MEM65K_BASE 0xb0e40000 +#define PCIE_MEM1M_BASE 0xb0f00000 + +/* +##################################################################### +# System PLL Control Register +##################################################################### +*/ + +/* +##################################################################### +# GPIO Control Registers +##################################################################### +*/ +#define GPIO_SWREG_CONFIG 0x1c +#define GPIO_LIN_VREG_ADJ_SHIFT 0x0 +#define GPIO_LIN_VREG_ADJ_MASK (0xf< +*/ +/***********************************************************************/ +/* */ +/* MODULE: 6816_map.h */ +/* DATE: 05/30/08 */ +/* PURPOSE: Define addresses of major hardware components of */ +/* BCM6816 */ +/* */ +/***********************************************************************/ +#ifndef __BCM6816_MAP_H +#define __BCM6816_MAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bcmtypes.h" +#include "6816_common.h" +#include "6816_intr.h" + +/* macro to convert logical data addresses to physical */ +/* DMA hardware must see physical address */ +#define LtoP( x ) ( (uint32)x & 0x1fffffff ) +#define PtoL( x ) ( LtoP(x) | 0xa0000000 ) + +typedef struct DDRPhyControl { + uint32 REVISION; /* 0x00 */ + uint32 CLK_PM_CTRL; /* 0x04 */ + uint32 unused0[2]; /* 0x08-0x10 */ + uint32 PLL_STATUS; /* 0x10 */ + uint32 PLL_CONFIG; /* 0x14 */ + uint32 PLL_PRE_DIVIDER; /* 0x18 */ + uint32 PLL_DIVIDER; /* 0x1c */ + uint32 PLL_CONTROL1; /* 0x20 */ + uint32 PLL_CONTROL2; /* 0x24 */ + uint32 PLL_SS_EN; /* 0x28 */ + uint32 PLL_SS_CFG; /* 0x2c */ + uint32 STATIC_VDL_OVERRIDE; /* 0x30 */ + uint32 DYNAMIC_VDL_OVERRIDE; /* 0x34 */ + uint32 IDLE_PAD_CONTROL; /* 0x38 */ + uint32 ZQ_PVT_COMP_CTL; /* 0x3c */ + uint32 DRIVE_PAD_CTL; /* 0x40 */ + uint32 CLOCK_REG_CONTROL; /* 0x44 */ + uint32 unused1[46]; +} DDRPhyControl; + +typedef struct DDRPhyByteLaneControl { + uint32 REVISION; /* 0x00 */ + uint32 VDL_CALIBRATE; /* 0x04 */ + uint32 VDL_STATUS; /* 0x08 */ + uint32 unused; /* 0x0c */ + uint32 VDL_OVERRIDE_0; /* 0x10 */ + uint32 VDL_OVERRIDE_1; /* 0x14 */ + uint32 VDL_OVERRIDE_2; /* 0x18 */ + uint32 VDL_OVERRIDE_3; /* 0x1c */ + uint32 VDL_OVERRIDE_4; /* 0x20 */ + uint32 VDL_OVERRIDE_5; /* 0x24 */ + uint32 VDL_OVERRIDE_6; /* 0x28 */ + uint32 VDL_OVERRIDE_7; /* 0x2c */ + uint32 READ_CONTROL; /* 0x30 */ + uint32 READ_FIFO_STATUS; /* 0x34 */ + uint32 READ_FIFO_CLEAR; /* 0x38 */ + uint32 IDLE_PAD_CONTROL; /* 0x3c */ + uint32 DRIVE_PAD_CTL; /* 0x40 */ + uint32 CLOCK_PAD_DISABLE; /* 0x44 */ + uint32 WR_PREAMBLE_MODE; /* 0x48 */ + uint32 CLOCK_REG_CONTROL; /* 0x4C */ + uint32 unused0[44]; +} DDRPhyByteLaneControl; + +typedef struct DDRControl { + uint32 CNFG; /* 0x000 */ + uint32 CSST; /* 0x004 */ + uint32 CSEND; /* 0x008 */ + uint32 unused; /* 0x00c */ + uint32 ROW00_0; /* 0x010 */ + uint32 ROW00_1; /* 0x014 */ + uint32 ROW01_0; /* 0x018 */ + uint32 ROW01_1; /* 0x01c */ + uint32 unused0[4]; + uint32 ROW20_0; /* 0x030 */ + uint32 ROW20_1; /* 0x034 */ + uint32 ROW21_0; /* 0x038 */ + uint32 ROW21_1; /* 0x03c */ + uint32 unused1[4]; + uint32 COL00_0; /* 0x050 */ + uint32 COL00_1; /* 0x054 */ + uint32 COL01_0; /* 0x058 */ + uint32 COL01_1; /* 0x05c */ + uint32 unused2[4]; + uint32 COL20_0; /* 0x070 */ + uint32 COL20_1; /* 0x074 */ + uint32 COL21_0; /* 0x078 */ + uint32 COL21_1; /* 0x07c */ + uint32 unused3[4]; + uint32 BNK10; /* 0x090 */ + uint32 BNK32; /* 0x094 */ + uint32 unused4[26]; + uint32 DCMD; /* 0x100 */ +#define DCMD_CS1 (1 << 5) +#define DCMD_CS0 (1 << 4) +#define DCMD_SET_SREF 4 + uint32 DMODE_0; /* 0x104 */ + uint32 DMODE_1; /* 0x108 */ +#define DMODE_1_DRAMSLEEP (1 << 11) + uint32 CLKS; /* 0x10c */ + uint32 ODT; /* 0x110 */ + uint32 TIM1_0; /* 0x114 */ + uint32 TIM1_1; /* 0x118 */ + uint32 TIM2; /* 0x11c */ + uint32 CTL_CRC; /* 0x120 */ + uint32 DOUT_CRC; /* 0x124 */ + uint32 DIN_CRC; /* 0x128 */ + uint32 unused5[53]; + + DDRPhyControl PhyControl; /* 0x200 */ + DDRPhyByteLaneControl PhyByteLane0Control; /* 0x300 */ + DDRPhyByteLaneControl PhyByteLane1Control; /* 0x400 */ + DDRPhyByteLaneControl PhyByteLane2Control; /* 0x500 */ + DDRPhyByteLaneControl PhyByteLane3Control; /* 0x600 */ + uint32 unused6[64]; + + uint32 GCFG; /* 0x800 */ + uint32 LBIST_CFG; /* 0x804 */ + uint32 LBIST_SEED; /* 0x808 */ + uint32 ARB; /* 0x80c */ + uint32 PI_GCF; /* 0x810 */ + uint32 PI_UBUS_CTL; /* 0x814 */ + uint32 PI_MIPS_CTL; /* 0x818 */ + uint32 PI_DSL_MIPS_CTL; /* 0x81c */ + uint32 PI_DSL_PHY_CTL; /* 0x820 */ + uint32 PI_UBUS_ST; /* 0x824 */ + uint32 PI_MIPS_ST; /* 0x828 */ + uint32 PI_DSL_MIPS_ST; /* 0x82c */ + uint32 PI_DSL_PHY_ST; /* 0x830 */ + uint32 PI_UBUS_SMPL; /* 0x834 */ + uint32 TESTMODE; /* 0x838 */ + uint32 TEST_CFG1; /* 0x83c */ + uint32 TEST_PAT; /* 0x840 */ + uint32 TEST_COUNT; /* 0x844 */ + uint32 TEST_CURR_COUNT; /* 0x848 */ + uint32 TEST_ADDR_UPDT; /* 0x84c */ + uint32 TEST_ADDR; /* 0x850 */ + uint32 TEST_DATA0; /* 0x854 */ + uint32 TEST_DATA1; /* 0x858 */ + uint32 TEST_DATA2; /* 0x85c */ + uint32 TEST_DATA3; /* 0x860 */ +} DDRControl; + +#define DDR ((volatile DDRControl * const) DDR_BASE) + +/* +** Peripheral Controller +*/ + +#define IRQ_BITS 64 +typedef struct { + uint64 IrqMask; + uint64 IrqStatus; +} IrqControl_t; + +typedef struct PerfControl { + uint32 RevID; /* (00) word 0 */ + uint32 blkEnables; /* (04) word 1 */ +#define ACP_A_CLK_EN (1 << 25) +#define ACP_B_CLK_EN (1 << 24) +#define NTP_CLK_EN (1 << 23) +#define PCM_CLK_EN (1 << 22) +#define BMU_CLK_EN (1 << 21) +#define PCIE_CLK_EN (1 << 20) +#define GPON_SER_CLK_EN (1 << 19) +#define IPSEC_CLK_EN (1 << 18) +#define NAND_CLK_EN (1 << 17) +#define DISABLE_GLESS (1 << 16) +#define USBH_CLK_EN (1 << 15) +#define APM_CLK_EN (1 << 14) +#define ROBOSW_CLK_EN (1 << 12) +#define USBD_CLK_EN (1 << 10) +#define SPI_CLK_EN (1 << 9) +#define SWPKT_GPON_CLK_EN (1 << 8) +#define SWPKT_USB_CLK_EN (1 << 7) +#define GPON_CLK_EN (1 << 6) + + uint32 pll_control; /* (08) word 2 */ +#define SOFT_RESET 0x00000001 // 0 + + uint32 deviceTimeoutEn; /* (0c) word 3 */ + uint32 softResetB; /* (10) word 4 */ +#define SOFT_RST_SERDES_DIG (1 << 23) +#define SOFT_RST_SERDES (1 << 22) +#define SOFT_RST_SERDES_MDIO (1 << 21) +#define SOFT_RST_SERDES_PLL (1 << 20) +#define SOFT_RST_SERDES_HW (1 << 19) +#define SOFT_RST_GPON (1 << 18) +#define SOFT_RST_BMU (1 << 17) +#define SOFT_RST_HVG (1 << 16) +#define SOFT_RST_APM (1 << 15) +#define SOFT_RST_ACP (1 << 14) +#define SOFT_RST_PCM (1 << 13) +#define SOFT_RST_USBH (1 << 12) +#define SOFT_RST_USBD (1 << 11) +#define SOFT_RST_SWITCH (1 << 10) +#define SOFT_RST_MOCA_CPU (1 << 9) +#define SOFT_RST_MOCA_SYS (1 << 8) +#define SOFT_RST_MOCA (1 << 7) +#define SOFT_RST_EPHY (1 << 6) +#define SOFT_RST_PCIE (1 << 5) +#define SOFT_RST_IPSEC (1 << 4) +#define SOFT_RST_MPI (1 << 3) +#define SOFT_RST_PCIE_EXT (1 << 2) +#define SOFT_RST_PCIE_CORE (1 << 1) +#define SOFT_RST_SPI (1 << 0) + + uint32 diagControl; /* (14) word 5 */ + uint32 ExtIrqCfg; /* (18) word 6*/ + uint32 ExtIrqCfg1; /* (1c) word 7 */ +#define EI_SENSE_SHFT 0 +#define EI_STATUS_SHFT 4 +#define EI_CLEAR_SHFT 8 +#define EI_MASK_SHFT 12 +#define EI_INSENS_SHFT 16 +#define EI_LEVEL_SHFT 20 + + IrqControl_t IrqControl[2]; +} PerfControl; + +#define PERF ((volatile PerfControl * const) PERF_BASE) + +/* +** Timer +*/ +typedef struct Timer { + uint16 unused0; + byte TimerMask; +#define TIMER0EN 0x01 +#define TIMER1EN 0x02 +#define TIMER2EN 0x04 + byte TimerInts; +#define TIMER0 0x01 +#define TIMER1 0x02 +#define TIMER2 0x04 +#define WATCHDOG 0x08 + uint32 TimerCtl0; + uint32 TimerCtl1; + uint32 TimerCtl2; +#define TIMERENABLE 0x80000000 +#define RSTCNTCLR 0x40000000 + uint32 TimerCnt0; + uint32 TimerCnt1; + uint32 TimerCnt2; + uint32 WatchDogDefCount; + + /* Write 0xff00 0x00ff to Start timer + * Write 0xee00 0x00ee to Stop and re-load default count + * Read from this register returns current watch dog count + */ + uint32 WatchDogCtl; + + /* Number of 50-MHz ticks for WD Reset pulse to last */ + uint32 WDResetCount; +} Timer; + +#define TIMER ((volatile Timer * const) TIMR_BASE) + +/* +** UART +*/ +typedef struct UartChannel { + byte unused0; + byte control; +#define BRGEN 0x80 /* Control register bit defs */ +#define TXEN 0x40 +#define RXEN 0x20 +#define LOOPBK 0x10 +#define TXPARITYEN 0x08 +#define TXPARITYEVEN 0x04 +#define RXPARITYEN 0x02 +#define RXPARITYEVEN 0x01 + + byte config; +#define XMITBREAK 0x40 +#define BITS5SYM 0x00 +#define BITS6SYM 0x10 +#define BITS7SYM 0x20 +#define BITS8SYM 0x30 +#define ONESTOP 0x07 +#define TWOSTOP 0x0f + /* 4-LSBS represent STOP bits/char + * in 1/8 bit-time intervals. Zero + * represents 1/8 stop bit interval. + * Fifteen represents 2 stop bits. + */ + byte fifoctl; +#define RSTTXFIFOS 0x80 +#define RSTRXFIFOS 0x40 + /* 5-bit TimeoutCnt is in low bits of this register. + * This count represents the number of characters + * idle times before setting receive Irq when below threshold + */ + uint32 baudword; + /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate + */ + + byte txf_levl; /* Read-only fifo depth */ + byte rxf_levl; /* Read-only fifo depth */ + byte fifocfg; /* Upper 4-bits are TxThresh, Lower are + * RxThreshold. Irq can be asserted + * when rx fifo> thresh, txfifo>8)&0xf) +#define UDC20_INTF(x) ((x>>4)&0xf) +#define UDC20_CFG(x) ((x>>0)&0xf) + uint32 usbd_status; +#define USBD_LINK (0x1<<10) +#define USBD_SET_CSRS 0x40 +#define USBD_SUSPEND 0x20 +#define USBD_EARLY_SUSPEND 0x10 +#define USBD_SOF 0x08 +#define USBD_ENUMON 0x04 +#define USBD_SETUP 0x02 +#define USBD_USBRESET 0x01 + uint32 usbd_events; + uint32 usbd_events_irq; +#define UPPER(x) (16+x) +#define ENABLE(x) (1< +*/ +/*************************************************************************** + * File Name : MoCABlock.h + * + * Description: This file contains definitions for the MoCA Block for the + * BCM6816 and the BCM3450 chipset(s). + ***************************************************************************/ + +#if !defined(_MoCABLOCK_H_) +#define _MoCABLOCK_H_ + +/* BCM 96816 related definitions . */ +#define MoCA_INTERRUPT_DISABLE 0x0 +#define MoCA_INTERRUPT_ENABLE 0x1 + +/* Definitions for coreInterrupts from host */ +#define MoCA_HOST_RESP_TO_CORE 0x1 +#define MoCA_HOST_REQ_TO_CORE 0x2 + +/* Definitions for hostInterrupts from core */ +#define MoCA_CORE_RESP_TO_HOST 0x1 +#define MoCA_CORE_REQ_TO_HOST 0x2 +#define MoCA_CORE_ASSERT_TO_HOST 0x4 +#define MoCA_CORE_UNUSED 0xFC +#define MoCA_CORE_DDR_START 0x100 +#define MoCA_CORE_DDR_END 0x200 + +#define MoCA_LED_LINK_ON_ACTIVE_OFF 0x0 +#define MoCA_LED_LINK_OFF_ACTIVE_OFF 0x1 +#define MoCA_LED_LINK_ON_ACTIVE_ON 0x2 +#define MoCA_LED_LINK_OFF_ACTIVE_ON 0x3 /* NW Search and New Node Admission */ +typedef struct _MoCAExtras { + UINT32 host2MoCAIntEn ; + UINT32 host2MoCAIntTrig ; + UINT32 host2MoCAIntStatus ; + UINT32 MoCA2HostIntEn ; + UINT32 MoCA2HostIntTrig ; + UINT32 MoCA2HostIntStatus ; + UINT32 genPurpose0 ; + UINT32 genPurpose1 ; + UINT32 sideBandGmiiFC ; + UINT32 leds ; + UINT32 MoCAStatus ; + UINT32 testMuxSel ; + UINT32 mdCtrl ; + UINT32 mdcDivider ; + UINT32 outRefIntR01 ; + UINT32 outRefIntR02 ; + UINT32 outRefIntR03 ; + UINT32 outRefIntR04 ; + UINT32 outRefIntR05 ; + UINT32 outRefIntSel ; +} MoCAExtras ; + + +typedef struct _MoCAMACRegs { + UINT32 macCtrl ; // 0x00 +#define MoCA_MAC_REGS_MAC_CTRL_MAC_ENABLE 0x00000001 + UINT32 resv1 [7] ; + UINT32 frmHdr ; // 0x20 + UINT32 msduHdr ; // 0x24 + UINT32 resv2 [2] ; + UINT32 macStatus ; // 0x30 + UINT32 macStatusEn ; // 0x34 + UINT32 resv3 [2] ; + UINT32 netTimer ; // 0x40 + UINT32 maxNetTimerCorr ; // 0x44 + UINT32 timerCorrCtrl ; // 0x48 + UINT32 bitParams ; // 0x4c + UINT32 fineCorr ; // 0x50 + UINT32 coarseCorr ; // 0x54 + UINT32 loadTimer1 ; // 0x58 + UINT32 loadTimer2 ; // 0x5c + UINT32 mpiConfigCtrl ; // 0x60 +#define MoCA_MAC_REGS_MPI_CONFIG_CTRL_READ 0x00000001 +#define MoCA_MAC_REGS_MPI_CONFIG_CTRL_WRITE 0x00000002 + UINT32 mpiConfigAddr ; // 0x64 + UINT32 mpiConfigDataW ; // 0x68 + UINT32 mpiConfigDataR ; // 0x6c +} MoCA_MAC_REGST, *PMoCA_MAC_REGST ; + +#define MoCA_BLOCK_BASE MOCA_MEM_BASE +typedef struct MoCABlockT { + + UINT8 dataMem [0x3FFFC] ; + UINT8 resvd [0x61403] ; + MoCAExtras extras ; // 0xb0da1400. + //MoCAHostM2M follows. + //MoCAMoCAM2M follows. +} MoCA_BLOCKT, *PMoCA_BLOCKT ; + +#define MoCA_PHYS_IO_BASE NONCACHE_TO_PHYS(MOCA_IO_BASE) +#define MoCA_BLOCK_MAC_REGS_START (MOCA_IO_BASE+0x400) +#define MoCA_BLOCK_PHY_START MoCA_PHYS_IO_BASE+0x8000 +#define MoCA_BLOCK_PHY_END MoCA_PHYS_IO_BASE+0xA3FF +#define MoCA_BLOCK ((volatile PMoCA_BLOCKT const) MoCA_BLOCK_BASE) +#define MoCA_MAC_REGS ((volatile PMoCA_MAC_REGST const) MoCA_BLOCK_MAC_REGS_START) +#define MoCA_CORE_MEM_BASE MoCA_BLOCK->dataMem +#define MoCA_MAIL_BOX_ADDR_REG MoCA_BLOCK->extras.genPurpose0 +#define MoCA_IQ_SNR_ADDR_REG MoCA_BLOCK->extras.genPurpose1 + +/* BCM 93450 related definitions . */ + +#define BCM3450_I2C_CHIP_ADDRESS 0x70 +typedef struct _Bcm3450Reg { + UINT32 ChipId; /* 0x0 */ + UINT32 ChipRev; /* 0x4 */ + UINT32 Test; /* 0x8 */ + UINT32 SerialCtl; /* 0xc */ + UINT32 StatusRead; /* 0x10 */ + UINT32 LnaCntl; /* 0x14 */ + UINT32 PaCntl; /* 0x18 */ +#define BCM3450_PACNTL_PA_RDEG_SHIFT 11 +#define BCM3450_PACNTL_PA_RDEG_MASK 0x00007800 +#define BCM3450_PACNTL_PA_CURR_CONT_SHIFT 5 +#define BCM3450_PACNTL_PA_CURR_CONT_MASK 0x000007E0 +#define BCM3450_PACNTL_PA_CURR_FOLLOWER_SHIFT 2 +#define BCM3450_PACNTL_PA_CURR_FOLLOWER_MASK 0x0000001C +#define BCM3450_PACNTL_PA_PWRDWN_SHIFT 0 +#define BCM3450_PACNTL_PA_PWRDWN_MASK 0x00000001 +#define BCM3450_PACNTL_OFFSET 0x18 + UINT32 Misc; /* 0x1c */ +#define BCM3452_MISC_BG_PWRDWN_SHIFT 15 +#define BCM3452_MISC_BG_PWRDWN_MASK 0x00008000 +#define BCM3450_MISC_IIC_RESET 0x1 +#define BCM3450_MISC_SERIAL_RESET 0x2 +#define BCM3450_MISC_OFFSET 0x1c +} Bcm3450Reg ; + +#endif /* _MoCABLOCK_H_ */ diff --git a/shared/broadcom/include/bcm963xx/robosw_reg.h b/shared/broadcom/include/bcm963xx/robosw_reg.h new file mode 100755 index 0000000..4fcc0ac --- /dev/null +++ b/shared/broadcom/include/bcm963xx/robosw_reg.h @@ -0,0 +1,169 @@ +/* +<:copyright-broadcom + + Copyright (c) 2007 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 16215 Alton Parkway + Irvine, California 92619 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ + +#ifndef __ROBOSW_REG_H +#define __ROBOSW_REG_H + +void robosw_init(void); +void robosw_configure_ports(void); +void robosw_check_ports(void); + +// These macros make offset validation vs. data sheet easier. + +#define group(type, name, start_offset, next) type name[(next - start_offset) / sizeof(type)] +#define entry(type, name, start_offset, next) type name + +typedef struct RoboSwitch { + group(byte, PortCtrl, 0x0000, 0x0009); + group(byte, Reserved0009, 0x0009, 0x000b); + entry(byte, SwitchMode, 0x000b, 0x000c); + entry(uint16, PauseQuanta, 0x000c, 0x000e); + entry(byte, ImpOverride, 0x000e, 0x000f); + entry(byte, LedRefresh, 0x000f, 0x0010); + entry(uint16, LedFunc0, 0x0010, 0x0012); + entry(uint16, LedFunc1, 0x0012, 0x0014); + entry(uint16, LedFuncMap, 0x0014, 0x0016); + entry(uint16, LedEnableMap, 0x0016, 0x0018); + entry(uint16, LedMap0, 0x0018, 0x001a); + entry(uint16, LedMap1, 0x001a, 0x001c); + group(byte, Reserved001c, 0x001c, 0x0020); + group(byte, Reserved0020, 0x0020, 0x0021); + entry(byte, ForwardCtrl, 0x0021, 0x0022); + group(byte, Reserved0022, 0x0022, 0x0024); + entry(uint16, ProtSelect, 0x0024, 0x0026); + entry(uint16, WanSelect, 0x0026, 0x0028); + entry(uint32, PauseCap, 0x0028, 0x002c); + group(byte, Reserved002c, 0x002c, 0x002f); + entry(byte, MultiCtrl, 0x002f, 0x0030); + group(byte, Reserved0030, 0x0030, 0x0031); + entry(byte, TxqFlush, 0x0031, 0x0032); + entry(uint16, UniFail, 0x0032, 0x0034); + entry(uint16, MultiFail, 0x0034, 0x0036); + entry(uint16, MlfIpmc, 0x0036, 0x0038); + entry(uint16, PausePassRx, 0x0038, 0x003a); + entry(uint16, PausePassTx, 0x003a, 0x003c); + entry(uint16, DisableLearn, 0x003c, 0x003e); + group(byte, Reserved003e, 0x003e, 0x004a); + entry(uint16, PllTest, 0x004a, 0x004c); + group(byte, Reserved004c, 0x004c, 0x0058); + group(byte, PortOverride, 0x0058, 0x0060); + group(byte, Reserved0061, 0x0060, 0x0064); + entry(byte, ImpRgmiiCtrlP4, 0x0064, 0x0065); + entry(byte, ImpRgmiiCtrlP5, 0x0065, 0x0066); + group(byte, Reserved0066, 0x0066, 0x006c); + entry(byte, ImpRgmiiTimingDelayP4, 0x006c, 0x006d); + entry(byte, ImpRgmiiTimingDelayP5, 0x006d, 0x006e); + group(byte, Reserved006e, 0x006e, 0x0079); + entry(byte, SWResetCtrl, 0x0079, 0x007a); + group(byte, Reserved007a, 0x007a, 0x0090); + entry(uint32, Rxfilt_Ctl, 0x0090, 0x0094); + entry(uint32, Cmf_En_Ctl, 0x0094, 0x0098); + group(byte, Reserved0098, 0x0098, 0x00a0); + entry(uint32, SwpktCtrl0, 0x00a0, 0x00a4); + entry(uint32, SwpktCtrl1, 0x00a4, 0x00a8); + group(byte, Reserved00a8, 0x00a8, 0x00b0); + entry(uint32, MdioCtrl, 0x00b0, 0x00b4); + entry(uint16, MdioData, 0x00b4, 0x00b6); + group(byte, Reserved00b4, 0x00b6, 0x0200); + entry(byte, GlbMgmt, 0x0200, 0x0201); + entry(byte, ChpBoxID, 0x0201, 0x0202); + entry(byte, MngPID, 0x0202, 0x0203); + group(byte, Reserved0203, 0x0203, 0x1100); + entry(uint16, MIICtrl0, 0x1100, 0x1101); + +} RoboSwitch; + +#define SWITCH ((volatile RoboSwitch * const)SWITCH_BASE) +#define PBVLAN_OFFSET 0x3100 +#define PBMAP_MIPS 0x100 +#define SWITCH_PBVLAN ((volatile uint16 * const)(SWITCH_BASE + PBVLAN_OFFSET)) + +#define PortCtrl_Forwarding 0xa0 +#define PortCtrl_Learning 0x80 +#define PortCtrl_Listening 0x60 +#define PortCtrl_Blocking 0x40 +#define PortCtrl_Disable 0x20 +#define PortCtrl_RxUcstEn 0x10 +#define PortCtrl_RxMcstEn 0x08 +#define PortCtrl_RxBcstEn 0x04 +#define PortCtrl_DisableTx 0x02 +#define PortCtrl_DisableRx 0x01 + +#define SwitchMode_FwdgEn 0x02 +#define SwitchMode_ManageMode 0x01 + +#define ImpOverride_Force 0x80 +#define ImpOverride_TxFlow 0x20 +#define ImpOverrode_RxFlow 0x10 +#define ImpOverride_1000Mbs 0x08 +#define ImpOverride_100Mbs 0x04 +#define ImpOverride_10Mbs 0x00 +#define ImpOverride_Fdx 0x02 +#define ImpOverride_Linkup 0x01 + +#define PortOverride_Enable 0x40 +#define PortOverride_TxFlow 0x20 +#define PortOverride_RxFlow 0x10 +#define PortOverride_1000Mbs 0x08 +#define PortOverride_100Mbs 0x04 +#define PortOverride_10Mbs 0x00 +#define PortOverride_Fdx 0x02 +#define PortOverride_Linkup 0x01 + +#define GlbMgmt_EnableImp 0x80 +#define GlbMgmt_IgmpSnooping 0x08 +#define GlbMgmt_ReceiveBpdu 0x02 +#define GlbMgmt_ResetMib 0x01 + +#define MdioCtrl_Write (1 << 31) +#define MdioCtrl_Read (1 << 30) +#define MdioCtrl_Ext (1 << 16) +#define MdioCtrl_ID_Shift 25 +#define MdioCtrl_ID_Mask (0x1f << MdioCtrl_ID_Shift) +#define MdioCtrl_Addr_Shift 20 +#define MdioCtrl_Addr_Mask (0x1f << MdioCtrl_Addr_Shift) + +#define ImpRgmiiCtrl_GMII_En 0x80 +#define ImpRgmiiCtrl_DLL_IQQD 0x04 +#define ImpRgmiiCtrl_DLL_RXC_Bypass 0x02 +#define ImpRgmiiCtrl_Timing_Sel 0x01 + +#define ImpRgmiiTimingDelayDefault 0xF9 + +#if defined (_BCM96328_) +#define EPHY_PORTS 5 +#define PORT_6_PORT_ID 6 +#define PORT_7_PORT_ID 7 +#endif +#if defined (_BCM96362_) +#define EPHY_PORTS 6 +#define PORT_6_PORT_ID 6 +#define PORT_7_PORT_ID 7 +#endif +#if defined (_BCM96368_) +#define EPHY_PORTS 6 +#define USB_PORT_ID 6 +#define SAR_PORT_ID 7 +#endif +#if defined (_BCM96816_) +#define EPHY_PORTS 4 +#define SERDES_PORT_ID 4 +#define MOCA_PORT_ID 5 +#define USB_PORT_ID 6 +#define GPON_PORT_ID 7 +#endif + +#endif diff --git a/shared/broadcom/include/bcm963xx/xtmprocregs.h b/shared/broadcom/include/bcm963xx/xtmprocregs.h new file mode 100755 index 0000000..307ed79 --- /dev/null +++ b/shared/broadcom/include/bcm963xx/xtmprocregs.h @@ -0,0 +1,602 @@ +/* +<:copyright-broadcom + + Copyright (c) 2007 Broadcom Corporation + All Rights Reserved + No portions of this material may be reproduced in any form without the + written permission of: + Broadcom Corporation + 5300 California Avenue + Irvine, California 92617 + All information contained in this document is Broadcom Corporation + company private, proprietary, and trade secret. + +:> +*/ +/*************************************************************************** + * File Name : XtmProcRegs.h + * + * Description: This file contains definitions for the ATM/PTM processor + * registers. + ***************************************************************************/ + +#if !defined(_XTMPROCREGS_H_) +#define _XTMPROCREGS_H_ + +/* Miscellaneous values. */ +#define XP_MAX_PORTS 4 +#define XP_MAX_CONNS 16 +#define XP_MAX_RX_QUEUES 4 +#define XP_MAX_TX_HDRS 8 +#define XP_TX_HDR_WORDS (16 / sizeof(UINT32)) +#define XP_RX_MIB_MATCH_ENTRIES 128 + +/* Circuit types. */ +#define XCT_TRANSPARENT 0x00000001 +#define XCT_AAL0_PKT 0x00000002 +#define XCT_AAL0_CELL 0x00000003 +#define XCT_OAM_F5_SEG 0x00000004 +#define XCT_OAM_F5_E2E 0x00000005 +#define XCT_RM 0x00000006 +#define XCT_AAL5 0x00000007 +#define XCT_ASM_P0 0x00000008 +#define XCT_ASM_P1 0x00000009 +#define XCT_ASM_P2 0x0000000a +#define XCT_ASM_P3 0x0000000b +#define XCT_OAM_F4_SEG 0x0000000c +#define XCT_OAM_F4_E2E 0x0000000d +#define XCT_TEQ 0x0000000e +#define XCT_PTM 0x0000000f + +/* Definitions for ATM ulTxChannelCfg. */ +#define TXCHA_VCID_MASK 0x0000000f +#define TXCHA_VCID_SHIFT 0 +#define TXCHA_CT_MASK 0x000000f0 +#define TXCHA_CT_SHIFT 4 +#define TXCHA_CT_TRANSPARENT (XCT_TRANSPARENT << TXCHA_CT_SHIFT) +#define TXCHA_CT_AAL0_PKT (XCT_AAL0_PKT << TXCHA_CT_SHIFT) +#define TXCHA_CT_AAL0_CELL (XCT_AAL0_CELL << TXCHA_CT_SHIFT) +#define TXCHA_CT_OAM_F5_SEG (XCT_OAM_F5_SEG << TXCHA_CT_SHIFT) +#define TXCHA_CT_OAM_F5_E2E (XCT_OAM_F5_E2E << TXCHA_CT_SHIFT) +#define TXCHA_CT_RM (XCT_RM << TXCHA_CT_SHIFT) +#define TXCHA_CT_AAL5 (XCT_AAL5 << TXCHA_CT_SHIFT) +#define TXCHA_CT_ASM_P0 (XCT_ASM_P0 << TXCHA_CT_SHIFT) +#define TXCHA_CT_ASM_P1 (XCT_ASM_P1 << TXCHA_CT_SHIFT) +#define TXCHA_CT_ASM_P2 (XCT_ASM_P2 << TXCHA_CT_SHIFT) +#define TXCHA_CT_ASM_P3 (XCT_ASM_P3 << TXCHA_CT_SHIFT) +#define TXCHA_CT_OAM_F4_SEG (XCT_OAM_F4_SEG << TXCHA_CT_SHIFT) +#define TXCHA_CT_OAM_F4_E2E (XCT_OAM_F4_E2E << TXCHA_CT_SHIFT) +#define TXCHA_CT_TEQ (XCT_TEQ << TXCHA_CT_SHIFT) +#define TXCHA_CT_PTM (XCT_PTM << TXCHA_CT_SHIFT) +#define TXCHA_CI 0x00000100 +#define TXCHA_CLP 0x00000200 +#define TXCHA_USE_ALT_GFC 0x00000400 +#define TXCHA_ALT_GFC_MASK 0x00007800 +#define TXCHA_ALT_GFC_SHIFT 11 +#define TXCHA_HDR_EN 0x00008000 +#define TXCHA_HDR_IDX_MASK 0x00070000 +#define TXCHA_HDR_IDX_SHIFT 16 +#define TXCHA_FCS_STRIP 0x00080000 + +/* Definitions for PTM ulTxChannelCfg. */ +#define TXCHP_FCS_EN 0x00000001 +#define TXCHP_CRC_EN 0x00000002 +#define TXCHP_HDR_EN 0x00008000 +#define TXCHP_HDR_IDX_MASK 0x00070000 +#define TXCHP_HDR_IDX_SHIFT 16 + +/* Definitions for ulSwitchPktCfg. */ +#define SWP_MAX_PKT_COUNT_MASK 0x00000003 +#define SWP_MAX_PKT_COUNT_SHIFT 0 +#define SWP_MAX_PKT_SIZE_MASK 0x0000007c +#define SWP_MAX_PKT_SIZE_SHIFT 2 +#define SWP_SRC_ID_MASK 0x00000380 +#define SWP_SRC_ID_SHIFT 7 +#define SWP_RX_CHAN_MASK 0x00000c00 +#define SWP_RX_CHAN_SHIFT 10 +#define SWP_TX_CHAN_MASK 0x0000f000 +#define SWP_TX_CHAN_SHIFT 12 +#define SWP_TX_EN 0x00010000 +#define SWP_RX_EN 0x00020000 + +/* Definitions for ulSwitchPktTxCtrl. */ +#define SWP_VCID_VALUE_MASK 0x0000000f +#define SWP_VCID_VALUE_SHIFT 0 +#define SWP_CT_VALUE_MASK 0x000000f0 +#define SWP_CT_VALUE_SHIFT 4 +#define SWP_FSTAT_CFG_VALUE_MASK 0x00000700 +#define SWP_FSTAT_CFG_VALUE_SHIFT 8 +#define SWP_MUX_MODE_VALUE 0x00000800 +#define SWP_VCID_MASK_MASK 0x000f0000 +#define SWP_VCID_MASK_SHIFT 16 +#define SWP_CT_MASK_MASK 0x00f00000 +#define SWP_CT_MASK_SHIFT 20 +#define SWP_FSTAT_CFG_MASK_MASK 0x07000000 +#define SWP_FSTAT_CFG_MASK_SHIFT 24 +#define SWP_MUX_MODE_MASK 0x08000000 + +/* Definitions for ulSwitchPktRxCtrl. */ +#define SWP_MATCH_MASK 0x0000007f +#define SWP_MASK_SHIFT 0 +#define SWP_CRC32 0x00000080 +#define SWP_DEST_PORT_MASK 0x0000ff00 +#define SWP_DEST_PORT_SHIFT 8 +#define SWP_MUX_MATCH_MASK 0x007f0000 +#define SWP_MUX_MATCH_SHIFT 16 +#define SWP_MUX_CRC32 0x00800000 +#define SWP_MUX_DESTPORT_MASK 0xff000000 +#define SWP_MUX_DESTPORT_SHIFT 24 + +/* Definitions for ulPktModCtrl. */ +#define PKTM_RXQ_EN_MASK 0x0000000f +#define PKTM_RXQ_EN_SHIFT 0 +#define PKTM_EN 0x80000000 + +/* Definitions for ulIrqStatus and ulIrqMask. */ +#define INTR_RX_BUF_EMPTY 0x00000001 +#define INTR_TX_BUF_EMPTY 0x00000002 +#define INTR_RX_DMA_NO_DESC_MASK 0x0000003c +#define INTR_RX_DMA_NO_DESC_SHIFT 2 +#define INTR_PTM_FRAG_ERROR 0x00000040 +#define INTR_PKT_BUF_UNDERFLOW 0x00000080 +#define INTR_TX_DMA_UNDERFLOW 0x00000100 +#define INTR_TX_ATM_DC 0x00000200 +#define INTR_BOND_BUF_FULL 0x00000400 +#define INTR_RX_ATM_DC 0x00000800 +#define INTR_MULT_MATCH_ERROR 0x00001000 +#define INTR_PKT_BUF_IRQ_MASK 0x0000e000 +#define INTR_PKT_BUF_IRQ_SHIFT 13 + +/* Definitions for ulTxSarCfg. */ +#define TXSAR_MODE_ATM 0x00000000 +#define TXSAR_MODE_PTM 0x00000001 +#define TXSARA_BOND_EN 0x00000002 +#define TXSARA_SID12_EN 0x00000004 +#define TXSARA_CRC10_INIT 0x00000008 +#define TXSARA_CRC10_EN_MASK 0x000000f0 +#define TXSARA_CRC10_EN_SHIFT 4 +#define TXSARA_BOND_DUAL_LATENCY 0x00000100 +#define TXSAR_USE_ALT_FSTAT 0x00000200 +#define TXSARP_ENET_FCS_INSERT 0x00000400 +#define TXSARP_CRC16_EN 0x00000800 +#define TXSARP_SOF_WHILE_TX 0x00001000 +#define TXSARP_PREEMPT 0x00002000 +#define TXSAR_HDR_INS_OFFSET_MASK 0x0007c000 +#define TXSAR_HDR_INS_OFFSET_SHIFT 14 +#define TXSARP_NUM_Z_BYTES_MASK 0x00780000 +#define TXSARP_NUM_Z_BYTES_SHIFT 19 +#define TXSAR_SW_EN 0x00800000 +#define TXSAR_USE_THRESH 0x01000000 +#define TXSAR_PKT_THRESH_MASK 0x06000000 +#define TXSAR_PKT_THRESH_SHIFT 25 +#define TXSARA_BOND_PORT_DIS_MASK 0x78000000 +#define TXSARA_BOND_PORT_DIS_SHIFT 27 +#define TXSARA_ASM_CRC_DIS 0x80000000 + +/* Definitions for ulTxSchedCfg. */ +#define TXSCH_PORT_EN_MASK 0x0000000f +#define TXSCH_PORT_EN_SHIFT 0 +#define TXSCHA_ALT_SHAPER_MODE 0x00000010 +#define TXSCHP_FAST_SCHED 0x00000020 +#define TXSCH_SHAPER_RESET 0x00000040 +#define TXSCH_SIT_COUNT_EN 0x00000080 +#define TXSCH_SIT_COUNT_VALUE_MASK 0x00ffff00 +#define TXSCH_SIT_COUNT_VALUE_SHIFT 8 +#define TXSCH_SIT_MAX_VALUE (TXSCH_SIT_COUNT_VALUE_MASK >> \ + TXSCH_SIT_COUNT_VALUE_SHIFT) +#define TXSCH_SOFWT_PRIORITY_EN 0x01000000 +#define TXSCH_BASE_COUNT_EN 0x02000000 +#define TXSCH_BASE_COUNT_VALUE_MASK 0x3c000000 +#define TXSCH_BASE_COUNT_VALUE_SHIFT 26 +#define TXSCHP_USE_BIT4_SOF 0x40000000 +#define TXSCH_ALT_MCR_MODE 0x80000000 + +/* Definitions for ulTxOamCfg. */ +#define TXOAM_F4_SEG_VPI_MASK 0x000000ff +#define TXOAM_F4_SEG_VPI_SHIFT 0 +#define TXOAM_F4_E2E_VPI_MASK 0x0000ff00 +#define TXOAM_F4_E2E_VPI_SHIFT 8 +#define TXASM_VCI_MASK 0xffff0000 +#define TXASM_VCI_SHIFT 16 + +/* Definitions for ulTxMpAalCfg. */ +#define TXMP_NUM_GROUPS 4 +#define TXMP_GROUP_SIZE 5 +#define TXMP_GROUP_EN 0x00000001 +#define TXMP_GROUP_SHAPER_MASK 0x0000001e +#define TXMP_GROUP_SHAPER_SHIFT 1 +#define TXSOPWT_COUNT_EN 0x00100000 +#define TXSOPWT_COUNT_VALUE_MASK 0x07e00000 +#define TXSOPWT_COUNT_VALUE_SHIFT 21 + +/* Definitions for ulTxUtopiaCfg. */ +#define TXUTO_PORT_EN_MASK 0x0000000f +#define TXUTO_PORT_EN_SHIFT 0 +#define TXUTO_MODE_INT_EXT_MASK 0x00000030 +#define TXUTO_MODE_ALL_INT 0x00000000 +#define TXUTO_MODE_ALL_EXT 0x00000010 +#define TXUTO_MODE_INT_EXT 0x00000020 +#define TXUTO_CELL_FIFO_DEPTH_2 0x00000000 +#define TXUTO_CELL_FIFO_DEPTH_1 0x00000040 +#define TXUTO_NEG_EDGE 0x00000080 +#define TXUTO_LEVEL_1 0x00000100 + +/* Definitions for ulTxLineRateTimer. */ +#define TXLRT_EN 0x00000001 +#define TXLRT_COUNT_VALUE_MASK 0x0001fffe +#define TXLRT_COUNT_VALUE_SHIFT 1 +#define TXLRT_MAX_VALUE (TXLRT_COUNT_VALUE_MASK >> \ + TXLRT_COUNT_VALUE_SHIFT) +#define TXLRT_IDLE_CELL_INS_MASK 0xf0000000 +#define TXLRT_IDLE_CELL_INS_SHIFT 28 + +/* Definitions for ulRxAtmCfg. */ +#define RX_PORT_EN 0x00000001 +#define RX_DOE_MASK 0x000001fe +#define RX_DOE_SHIFT 1 +#define RX_DOE_GFC_ERROR 0x00000002 +#define RX_DOE_CRC_ERROR 0x00000004 +#define RX_DOE_CT_ERROR 0x00000008 +#define RX_DOE_CAM_LOOKUP_ERROR 0x00000010 +#define RX_DOE_IDLE_CELL 0x00000020 +#define RX_DOE_PTI_ERROR 0x00000040 +#define RX_DOE_HEC_ERROR 0x00000080 +#define RX_DOE_PORT_NOT_ENABLED_ERROR 0x00000100 +#define RXA_HEC_CRC_IGNORE 0x00000200 +#define RXA_GFC_ERROR_IGNORE 0x00000400 +#define RX_PORT_MASK 0x00001800 +#define RX_PORT_MASK_SHIFT 11 +#define RXP_RX_FLOW_DISABLED 0x00004000 +#define RXA_VCI_MASK 0x00008000 +#define RXA_VC_BIT_MASK 0xffff0000 +#define RXA_BONDING_VP_MASK 0x00ff0000 + +/* Definitions for ulRxSarCfg. */ +#define RXSAR_MODE_ATM 0x00000000 +#define RXSAR_MODE_PTM 0x00000001 +#define RXSAR_MODE_MASK 0x00000001 +#define RXSARA_BOND_EN 0x00000002 +#define RXSARA_SID12_EN 0x00000004 +#define RXSARA_CRC10_INIT 0x00000008 +#define RXSARA_CRC10_EN_MASK 0x000000f0 +#define RXSARA_CRC10_EN_SHIFT 4 +#define RXSARA_BOND_DUAL_LATENCY 0x00000100 +#define RXSARA_BOND_CELL_COUNT_MASK 0x07ff0000 +#define RXSARA_BOND_CELL_COUNT_SHIFT 16 +#define RXSARA_BOND_TIMER_MODE 0x08000000 +#define RXSARA_BOND_BUF_MODE_MASK 0x70000000 +#define RXSARA_BOND_BUF_MODE_SHIFT 29 +#define RXSARA_BOND_BUF_MODE_MASK 0x70000000 +#define RXSARA_ASM_CRC_DIS 0x80000000 + +/* Definitions for ulRxOamCfg. */ +#define RXOAM_F4_SEG_VPI_MASK 0x000000ff +#define RXOAM_F4_SEG_VPI_SHIFT 0 +#define RXOAM_F4_E2E_VPI_MASK 0x0000ff00 +#define RXOAM_F4_E2E_VPI_SHIFT 8 +#define RXASM_VCI_MASK 0xffff0000 +#define RXASM_VCI_SHIFT 16 + +/* Definitions for ulRxUtopiaCfg. */ +#define RXUTO_PORT_EN_MASK 0x0000000f +#define RXUTO_PORT_EN_SHIFT 0 +#define RXUTO_TEQ_PORT_MASK 0x00000070 +#define RXUTO_TEQ_PORT_SHIFT 4 +#define RXUTO_NEG_EDGE 0x00000080 +#define RXUTO_LEVEL_1 0x00000100 +#define RXUTO_INTERNAL_BUF0_EN 0x00000200 +#define RXUTO_EXTERNAL_BUF1_EN 0x00000400 + +/* Definitions for ulRxAalCfg. */ +#define RXAALA_AAL5_SW_TRAILER_EN 0x00000001 +#define RXAALA_AAL0_CRC_CHECK 0x00000002 +#define RXAALP_CRC32_EN 0x00000004 +#define RXAALP_CELL_LENGTH_MASK 0x000000f0 +#define RXAALP_CELL_LENGTH_SHIFT 4 + +/* Definitions for ulLedCtrl. */ +#define SAR_LED_EN 0x00000001 +#define SAR_LED_MODE_MASK 0x00000006 +#define SAR_LED_MODE_SHIFT 1 +#define SAR_LED_MODE_LINK_ONLY 0x00000000 +#define SAR_LED_MODE_CELL_ACTIVITY 0x00000002 +#define SAR_LED_MODE_MELODY_LINK 0x00000004 +#define SAR_LED_MODE_LINK_CELL_ACTIVITY 0x00000006 +#define SAR_LED_LINK 0x00000010 +#define SAR_LED_SPEED_MASK 0x00000060 +#define SAR_LED_SPEED_SHIFT 5 +#define SAR_LED_SPEED_30MS 0x00000000 +#define SAR_LED_SPEED_50MS 0x00000020 +#define SAR_LED_SPEED_125MS 0x00000040 +#define SAR_LED_SPEED_250MS 0x00000060 +#define SAR_LED_INTERNAL 0x00000080 + +/* Definitions for ulTxVpiVciTable. */ +#define TXTBL_VCI_MASK 0x0000ffff +#define TXTBL_VCI_SHIFT 0 +#define TXTBL_VPI_MASK 0x00ff0000 +#define TXTBL_VPI_SHIFT 16 + +/* Definitions for ulRxVpiVciCam - CAM side. */ +#define RXCAM_PORT_MASK 0x00000003 +#define RXCAM_PORT_SHIFT 0 +#define RXCAMP_PTM_PRI_LOW 0x00000000 +#define RXCAMP_PTM_PRI_HIGH 0x00000004 +#define RXCAM_TEQ_CELL 0x00000008 +#define RXCAMA_VCI_MASK 0x000ffff0 +#define RXCAMA_VCI_SHIFT 4 +#define RXCAMA_VPI_MASK 0x0ff00000 +#define RXCAMA_VPI_SHIFT 20 +#define RXCAM_VALID 0x10000000 + +/* Definitions for ulRxVpiVciCam - RAM side. */ +#define RXCAM_CT_MASK 0x0000000f +#define RXCAM_CT_SHIFT 0 +#define RXCAM_CT_TRANSPARENT (XCT_TRANSPARENT << RXCAM_CT_SHIFT) +#define RXCAM_CT_AAL0_PKT (XCT_AAL0_PKT << RXCAM_CT_SHIFT) +#define RXCAM_CT_AAL0_CELL (XCT_AAL0_CELL << RXCAM_CT_SHIFT) +#define RXCAM_CT_AAL5 (XCT_AAL5 << RXCAM_CT_SHIFT) +#define RXCAM_CT_TEQ (XCT_TEQ << RXCAM_CT_SHIFT) +#define RXCAM_CT_PTM (XCT_PTM << RXCAM_CT_SHIFT) +#define RXCAM_VCID_MASK 0x000001f0 +#define RXCAM_VCID_SHIFT 4 +#define RXCAM_STRIP_BYTE_MASK 0x00003e00 +#define RXCAM_STRIP_BYTE_SHIFT 9 +#define RXCAM_STRIP_EN 0x00004000 +#define RXCAMA_ASM_CELL 0x00080000 +#define RXCAMA_CRC10_EN 0x00100000 + +/* Definitions for ulSstCtrl. */ +#define SST_EN 0x00000001 +#define SST_MP_GROUP_MASK 0x00000006 +#define SST_MP_GROUP_SHIFT 1 +#define SST_PTM_PREEMPT 0x00000010 +#define SST_PORT_MASK 0x00000060 +#define SST_PORT_SHIFT 5 +#define SST_ALG_MASK 0x00000380 +#define SST_ALG_SHIFT 7 +#define SST_ALG_UBR_NO_PCR 0x00000000 +#define SST_ALG_UBR_PCR 0x00000080 +#define SST_ALG_MBR 0x00000100 +#define SST_ALG_VBR_1 0x00000180 +#define SST_ALG_CBR 0x00000200 +#define SST_SUB_PRIORITY_MASK 0x00001c00 +#define SST_SUB_PRIORITY_SHIFT 10 +#define SST_SUPER_PRIORITY 0x00002000 +#define SST_MP_EN 0x00004000 +#define SST_MCR_EN 0x00008000 +#define SST_RATE_MCR_MASK 0xffff0000 +#define SST_RATE_MCR_SHIFT 16 + +/* Definitions for ulSstPcrScr. */ +#define SST_RATE_PCR_MASK 0x0000ffff +#define SST_RATE_PCR_SHIFT 0 +#define SST_RATE_SCR_MASK 0xffff0000 +#define SST_RATE_SCR_SHIFT 16 + +/* Definitions for ulSstBt. */ +#define SST_RATE_BT_MASK 0x00ffffff +#define SST_RATE_BT_SHIFT 0 +#define SST_ALG_WEIGHT_MASK 0x03000000 +#define SST_ALG_WEIGHT_SHIFT 24 +#define SST_ALG_DISABLED 0x00000000 +#define SST_ALG_CWRR 0x01000000 +#define SST_ALG_PWRR 0x02000000 +#define SST_ALG_WFQ 0x03000000 +#define SST_WEIGHT_VALUE_MASK 0xfc000000 +#define SST_WEIGHT_VALUE_SHIFT 26 + +/* Definitions for ulSstBucketCnt. */ +#define SST_BP_PCR_MASK 0x0000ffff +#define SST_BP_PCR_SHIFT 0 +#define SST_BM_MCR_MASK 0xffff0000 +#define SST_BM_MCR_SHIFT 16 + +/* Definitions for ulRxPktBufCfg. */ +#define PBCFG_LENGTH_MASK 0x0000ffff +#define PBCFG_LENGTH_SHIFT 0 +#define PBCFG_FPM_EMPTY 0x02000000 +#define PBCFG_LD_PTRS 0x04000000 +#define PBCFG_ALLOCATE_LAST 0x08000000 +#define PBCFG_KEEP_ERROR_PKTS 0x10000000 +#define PBCFG_FPM_ENABLE 0x20000000 +#define PBCFG_INIT_REQ 0x40000000 +#define PBCFG_S_RESET 0x80000000 + +/* Definitions for ulRxPktBufThreshold. */ +#define PBTHRESH_MAX_COUNT_MASK 0x000000ff +#define PBTHRESH_MAX_COUNT_SHIFT 0 +#define PBTHRESH_NO_BUF_DELAY_MASK 0xffff0000 +#define PBTHRESH_NO_BUF_DELAY_SHIFT 16 + +/* Definitions for ulRxPktBufVcid. */ +#define PBVCID_WAIT_EN_MASK 0x0000ffff +#define PBVCID_WAIT_EN_SHIFT 0 + +/* Definitions for ulRxPktBufMem. */ +#define PBMEM_ADDR_MASK 0x0000ffff +#define PBMEM_ADDR_SHIFT 0 +#define PBMEM_BS_B_MASK 0x00ff0000 +#define PBMEM_BS_B_SHIFT 16 +#define PBMEM_READ_WRITE_B 0x40000000 +#define PBMEM_GO_BUSY 0x80000000 + +/* Definitions for ulRxPktBufPtr. */ +#define PBPTR_BUF_STOP_MASK 0x0000ffff +#define PBPTR_BUF_STOP_SHIFT 0 +#define PBPTR_BUF_START_MASK 0xffff0000 +#define PBPTR_BUF_START_SHIFT 16 + +/* Definitions for ulRxPktBufSize. */ +#define PBSIZE_THRESHOLD_MASK 0x0000ffff +#define PBSIZE_THRESHOLD_SHIFT 0 +#define PBSIZE_MASK 0xffff0000 +#define PBSIZE_SHIFT 16 + +/* Definitions for ulRxPktBufFifoStart[2]. */ +#define PBSTART_0_MASK 0x0000ffff +#define PBSTART_0_SHIFT 0 +#define PBSTART_1_MASK 0xffff0000 +#define PBSTART_1_SHIFT 16 + +/* Definitions for ulRxPktBufFifoStop[2]. */ +#define PBSTOP_0_MASK 0x0000ffff +#define PBSTOP_0_SHIFT 0 +#define PBSTOP_1_MASK 0xffff0000 +#define PBSTOP_1_SHIFT 16 + +/* Definitions for ulRxPktBufFifoDelay[2]. */ +#define PBDELAY_0_MASK 0x0000ffff +#define PBDELAY_0_SHIFT 0 +#define PBDELAY_1_MASK 0xffff0000 +#define PBDELAY_1_SHIFT 16 + +/* Definitions for ulRxPktBufQueueStatus. */ +#define PBQS_NUM_NO_BUFS_MASK 0x0000ffff +#define PBQS_NUM_NO_BUFS_SHIFT 0 +#define PBQS_NUM_QUEUE_FULL_MASK 0xffff0000 +#define PBQS_NUM_QUEUE_FULL_SHIFT 16 + +/* Definitions for ulRxPktBufErrorStatus. */ +#define PBERR_NUM_ERROR_FRAGS_MASK 0x0000ffff +#define PBERR_NUM_ERROR_FRAGS_SHIFT 0 +#define PBERR_NUM_ERROR_PKTS_MASK 0xffff0000 +#define PBERR_NUM_ERROR_PKTS_SHIFT 16 + +/* Definitions for ulRxPktBufTR. */ +#define PBTR_LD_T_PTR_MASK 0x0000ffff +#define PBTR_LD_T_PTR_SHIFT 0 +#define PBTR_LD_H_PTR_MASK 0xffff0000 +#define PBTR_LD_H_PTR_SHIFT 16 + +/* Definitions for ulRxPktBufFPM. */ +#define PBFPM_FRAME_BUF_MASK 0x0000ffff +#define PBFPM_FRAME_BUF_SHIFT 0 +#define PBFPM_LOAD_COUNT_MASK 0xffff0000 +#define PBFPM_LOAD_COUNT_SHIFT 16 + +/* Definitions for ulRxPktBufMibCtrl. */ +#define PBMIB_TOGGLE 0x40000000 +#define PBMIB_CLEAR 0x80000000 + +/* Definitions for ulRxPktBufMibMatch. */ +#define PBMIB_MATCH_MASK 0x0000007f + +/* Definitions for ulTxHdrInsert. */ +#define TXHDR_COUNT_MASK 0x0000001f +#define TXHDR_COUNT_SHIFT 0 +#define TXHDR_OFFSET_MASK 0x00ff0000 +#define TXHDR_OFFSET_SHIFT 16 + +/* Definitions for ulTxRxPortOamCellCnt. */ +#define OAM_TX_CELL_COUNT_MASK 0x0000ffff +#define OAM_TX_CELL_COUNT_SHIFT 0 +#define OAM_RX_CELL_COUNT_MASK 0xffff0000 +#define OAM_RX_CELL_COUNT_SHIFT 16 + +/* Definitions for ulTxRxPortAsmCellCnt. */ +#define ASM_TX_CELL_COUNT_MASK 0x0000ffff +#define ASM_TX_CELL_COUNT_SHIFT 0 +#define ASM_RX_CELL_COUNT_MASK 0xffff0000 +#define ASM_RX_CELL_COUNT_SHIFT 16 + +/* Definitions for ulRxPortErrorPktCellCnt. */ +#define ERROR_RX_CELL_COUNT_MASK 0x0000ffff +#define ERROR_RX_CELL_COUNT_SHIFT 0 +#define ERROR_RX_PKT_COUNT_MASK 0xffff0000 +#define ERROR_RX_PKT_COUNT_SHIFT 16 + + +#if defined(CONFIG_BCM96368) +#define XTM_PROCESSOR_BASE 0xb0001800 +#elif defined(CONFIG_BCM96328) || defined(CONFIG_BCM96362) +#define XTM_PROCESSOR_BASE 0xb0007800 +#endif +typedef struct XtmProcessorRegisters +{ + UINT32 ulTxChannelCfg[XP_MAX_CONNS]; /* 0000 */ + UINT32 ulSwitchPktCfg; /* 0040 */ + UINT32 ulSwitchPktTxCtrl; /* 0044 */ + UINT32 ulSwitchPktRxCtrl; /* 0048 */ + UINT32 ulPktModCtrl; /* 004c */ + UINT32 ulIrqStatus; /* 0050 */ + UINT32 ulIrqMask; /* 0054 */ + UINT32 ulReserved1[2]; /* 0058 */ + UINT32 ulTxSarCfg; /* 0060 */ + UINT32 ulTxSchedCfg; /* 0064 */ + UINT32 ulTxOamCfg; /* 0068 */ + UINT32 ulTxAtmStatus; /* 006c */ + UINT32 ulTxAalStatus; /* 0070 */ + UINT32 ulTxMpAalCfg; /* 0074 */ + UINT32 ulTxUtopiaCfg; /* 0078 */ + UINT32 ulTxLineRateTimer; /* 007c */ + UINT32 ulRxAtmCfg[XP_MAX_PORTS]; /* 0080 */ + UINT32 ulRxSarCfg; /* 0090 */ + UINT32 ulRxOamCfg; /* 0094 */ + UINT32 ulRxAtmStatus; /* 0098 */ + UINT32 ulRxUtopiaCfg; /* 009c */ + UINT32 ulRxAalCfg; /* 00a0 */ + UINT32 ulRxAalMaxSdu; /* 00a4 */ + UINT32 ulRxAalStatus; /* 00a8 */ + UINT32 ulLedCtrl; /* 00ac */ + UINT32 ulReserved2[20]; /* 00b0 */ + UINT32 ulTxVpiVciTable[XP_MAX_CONNS]; /* 0100 */ + UINT32 ulRxVpiVciCam[XP_MAX_CONNS * 2]; /* 0140 */ + UINT32 ulReserved3[16]; /* 01c0 */ + UINT32 ulSstCtrl[XP_MAX_CONNS]; /* 0200 */ + UINT32 ulSstPcrScr[XP_MAX_CONNS]; /* 0240 */ + UINT32 ulSstBt[XP_MAX_CONNS]; /* 0280 */ + UINT32 ulSstBucketCnt[XP_MAX_CONNS]; /* 02c0 */ + UINT32 ulRxPktBufCfg; /* 0300 */ + UINT32 ulRxPktBufThreshold; /* 0304 */ + UINT32 ulRxPktBufVcid; /* 0308 */ + UINT32 ulRxPktBufMem; /* 030c */ + UINT32 ulRxPktBufData[2]; /* 0310 */ + UINT32 ulRxPktBufPtr; /* 0318 */ + UINT32 ulRxPktBufSize; /* 031c */ + UINT32 ulRxPktBufFifoStart[2]; /* 0320 */ + UINT32 ulRxPktBufFifoStop[2]; /* 0328 */ + UINT32 ulRxPktBufFifoDelay[2]; /* 0330 */ + UINT32 ulRxPktBufQueueStatus; /* 0338 */ + UINT32 ulRxPktBufErrorStatus; /* 033c */ + UINT32 ulRxPktBufTR; /* 0340 */ + UINT32 ulRxPktBufFPM; /* 0344 */ + UINT32 ulRxPktBufMibCtrl; /* 0348 */ + UINT32 ulRxPktBufMibMatch; /* 034c */ + UINT32 ulRxPktBufMibRxOctet; /* 0350 */ + UINT32 ulRxPktBufMibRxPkt; /* 0354 */ + UINT32 ulReserved4[106]; /* 0358 */ + UINT32 ulTxHdrInsert[XP_MAX_TX_HDRS]; /* 0500 */ + UINT32 ulReserved5[24]; /* 0520 */ + UINT32 ulTxHdrValues[XP_MAX_TX_HDRS][XP_TX_HDR_WORDS]; /* 0580 */ + UINT32 ulTxPortPktOctCnt[XP_MAX_PORTS]; /* 0600 */ + UINT32 ulRxPortPktOctCnt[XP_MAX_PORTS]; /* 0610 */ + UINT32 ulTxPortPktCnt[XP_MAX_PORTS]; /* 0620 */ + UINT32 ulRxPortPktCnt[XP_MAX_PORTS]; /* 0630 */ + UINT32 ulTxRxPortOamCellCnt[XP_MAX_PORTS]; /* 0640 */ + UINT32 ulTxRxPortAsmCellCnt[XP_MAX_PORTS]; /* 0650 */ + UINT32 ulRxPortErrorPktCellCnt[XP_MAX_PORTS]; /* 0660 */ + UINT32 ulBondInputCellCnt; /* 0670 */ + UINT32 ulBondOutputCellCnt; /* 0674 */ + UINT32 ulReserved6[1]; /* 0678 */ + UINT32 ulMibCtrl; /* 067c */ + UINT32 ulTxVcPktOctCnt[XP_MAX_CONNS]; /* 0680 */ +} XTM_PROCESSOR_REGISTERS, *PXTM_PROCESSOR_REGISTERS; + +#define XP_REGS ((volatile PXTM_PROCESSOR_REGISTERS const) XTM_PROCESSOR_BASE) + +/* Definitions from pktCmfHw.h. TBD. Use commoon header file. */ +#ifndef PKTCMF_OFFSET_ENGINE_SAR +#define PKTCMF_OFFSET_ENGINE_SAR 0xB0002000 +#endif +#define PKTCMF_OFFSET_RXFILT 0x00001B00 +#define RXFILT_REG_MATCH0_DEF_ID 0x0000000C /* 7b/VCID 03..00 */ +#define RXFILT_REG_MATCH1_DEF_ID 0x00000010 /* 7b/VCID 07..04 */ +#define RXFILT_REG_MATCH2_DEF_ID 0x00000014 /* 7b/VCID 11..08 */ +#define RXFILT_REG_MATCH3_DEF_ID 0x00000018 /* 7b/VCID 15..12 */ + +#define RXFILT_REG_VCID0_QID 0x00000004 /* 2b/VCID 15..00 */ +#define RXFILT_REG_VCID1_QID 0x00000008 /* 2b VCID= 16 */ + +#endif /* _XTMPROCREGS_H_ */ + diff --git a/shared/opensource/boardparms/bcm963xx/Makefile b/shared/opensource/boardparms/bcm963xx/Makefile new file mode 100755 index 0000000..8d2573c --- /dev/null +++ b/shared/opensource/boardparms/bcm963xx/Makefile @@ -0,0 +1,16 @@ + +ifeq ($(CONFIG_MIPS_BRCM),y) + +# Linux +obj-y += boardparms.o + +ifneq ($(strip $(VOXXXLOAD)),) +obj-y += boardparms_voice.o +endif + +EXTRA_CFLAGS += -DCONFIG_BCM9$(BRCM_CHIP) -I$(INC_BRCMSHARED_PUB_PATH)/$(BRCM_BOARD) +-include $(TOPDIR)/Rules.make + +endif + + diff --git a/shared/opensource/boardparms/bcm963xx/boardparms.c b/shared/opensource/boardparms/bcm963xx/boardparms.c new file mode 100755 index 0000000..23ab3ef --- /dev/null +++ b/shared/opensource/boardparms/bcm963xx/boardparms.c @@ -0,0 +1,3712 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/************************************************************************** +* File Name : boardparms.c +* +* Description: This file contains the implementation for the BCM63xx board +* parameter access functions. +* +* Updates : 07/14/2003 Created. +***************************************************************************/ + +/* Includes. */ +#include "boardparms.h" +#include "boardparms_voice.h" + +/* Typedefs */ +typedef struct boardparameters +{ + char szBoardId[BP_BOARD_ID_LEN]; /* board id string */ + unsigned short usGPIOOverlay; /* enabled interfaces */ + + unsigned short usGpioRj11InnerPair; /* GPIO pin or not defined */ + unsigned short usGpioRj11OuterPair; /* GPIO pin or not defined */ + unsigned short usGpioUartRts; /* GPIO pin or not defined */ + unsigned short usGpioUartCts; /* GPIO pin or not defined */ + + unsigned short usGpioLedAdsl; /* GPIO pin or not defined */ + unsigned short usGpioLedAdslFail; /* GPIO pin or not defined */ + unsigned short usGpioSecLedAdsl; /* GPIO pin or not defined */ + unsigned short usGpioSecLedAdslFail; /* GPIO pin or not defined */ + unsigned short usGpioLedSesWireless; /* GPIO pin or not defined */ + unsigned short usGpioLedHpna; /* GPIO pin or not defined */ + unsigned short usGpioLedWanData; /* GPIO pin or not defined */ + unsigned short usGpioLedWanError; /* GPIO pin or not defined */ + unsigned short usGpioLedBlPowerOn; /* GPIO pin or not defined */ + unsigned short usGpioLedBlStop; /* GPIO pin or not defined */ + unsigned short usGpioFpgaReset; /* GPIO pin or not defined */ + unsigned short usGpioLedGpon; /* GPIO pin or not defined */ + unsigned short usGpioLedGponFail; /* GPIO pin or not defined */ + + unsigned short usGpioLedMoCA; /* GPIO pin or not defined */ + unsigned short usGpioLedMoCAFail; /* GPIO pin or not defined */ + + unsigned short usExtIntrResetToDefault; /* ext intr or not defined */ + unsigned short usExtIntrSesBtnWireless; /* ext intr or not defined */ + unsigned short usExtIntrHpna; /* ext intr or not defined */ + + unsigned short usCsHpna; /* HPNA chip select or not defined */ + + unsigned short usAntInUseWireless; /* antenna in use or not defined */ + unsigned short usWirelessFlags; /* WLAN flags */ + + ETHERNET_MAC_INFO EnetMacInfos[BP_MAX_ENET_MACS]; + VOIP_DSP_INFO VoIPDspInfo[BP_MAX_VOIP_DSP]; + unsigned short usGpioWirelessPowerDown; /* WLAN_PD control or not defined */ + unsigned long ulAfeIds[2]; /* DSL AFE Ids */ + unsigned short usGpioExtAFEReset; /* GPIO pin or not defined */ + unsigned short usGpioExtAFELDPwr; /* GPIO pin or not defined */ + unsigned short usGpioExtAFELDMode; /* GPIO pin or not defined */ +} BOARD_PARAMETERS, *PBOARD_PARAMETERS; + +#define SW_INFO_DEFAULT(n) { \ + (0x00000001 << (n)) - 1, /* port_map */ \ +{0, 0, 0, 0, 0, 0, 0, 0} /* phy_id */ \ +} + +/* Variables */ +#if defined(_BCM96362_) || defined(CONFIG_BCM96362) + +static BOARD_PARAMETERS g_bcm96362advnx = +{ + "96362ADVNX", /* szBoardId */ + (BP_OVERLAY_USB_LED | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_SERIAL_LEDS | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_SERIAL_GPIO_14_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_SERIAL_GPIO_15_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_1_AL, /* usGpioLedWanData */ + BP_SERIAL_GPIO_10_AL, /* usGpioLedWanError */ + BP_SERIAL_GPIO_12_AL, /* usGpioLedBlPowerOn */ + BP_SERIAL_GPIO_13_AL, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + BP_WLAN_EXCLUDE_ONBOARD, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x1f, {0x01, 0x02, 0x03, 0x04, 0x18, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_SERIAL_GPIO_8_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_SERIAL_GPIO_9_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6301 | BP_AFE_FE_ANNEXA | BP_AFE_FE_AVMODE_ADSL | BP_AFE_FE_REV_6301_REV_5_1_1, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96362advngr = +{ + "96362ADVNgr", /* szBoardId */ + (BP_OVERLAY_USB_LED | + BP_OVERLAY_SPI_EXT_CS | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_SERIAL_LEDS | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_SERIAL_GPIO_14_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_SERIAL_GPIO_15_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_1_AL, /* usGpioLedWanData */ + BP_SERIAL_GPIO_10_AL, /* usGpioLedWanError */ + BP_SERIAL_GPIO_12_AL, /* usGpioLedBlPowerOn */ + BP_SERIAL_GPIO_13_AL, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + BP_WLAN_EXCLUDE_ONBOARD, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x3f, {0x01, 0x02, 0x03, 0x04, 0x18, 0x19, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_SERIAL_GPIO_8_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_SERIAL_GPIO_9_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6301 | BP_AFE_FE_ANNEXA | BP_AFE_FE_AVMODE_ADSL | BP_AFE_FE_REV_6301_REV_5_1_1, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96362advngr2 = +{ + "96362ADVNgr2", /* szBoardId */ + (BP_OVERLAY_USB_LED | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_SERIAL_LEDS | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_SERIAL_GPIO_14_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_SERIAL_GPIO_15_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_1_AL, /* usGpioLedWanData */ + BP_SERIAL_GPIO_10_AL, /* usGpioLedWanError */ + BP_SERIAL_GPIO_12_AL, /* usGpioLedBlPowerOn */ + BP_SERIAL_GPIO_13_AL, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + BP_WLAN_EXCLUDE_ONBOARD, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x1f, {0x01, 0x02, 0x03, 0x04, 0x18, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_SERIAL_GPIO_8_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_SERIAL_GPIO_9_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_SERIAL_GPIO_11_AL, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXA | BP_AFE_FE_AVMODE_ADSL | BP_AFE_FE_REV_6302_REV_5_2_2, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static PBOARD_PARAMETERS g_BoardParms[] = {&g_bcm96362advnx, &g_bcm96362advngr, &g_bcm96362advngr2, 0}; +#endif + +#if defined(_BCM96368_) || defined(CONFIG_BCM96368) + +static BOARD_PARAMETERS g_bcm96368vvw = +{ + "96368VVW", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_24_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_33_AH, /* usGpioLedWanError */ + BP_GPIO_0_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_1_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_GPIO_25_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_GPIO_26_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_GPIO_27_AL, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_ISIL1556 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_ISIL_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368vvwb = +{ + "96368VVWB", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_24_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_33_AH, /* usGpioLedWanError */ + BP_GPIO_0_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_1_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_GPIO_25_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_GPIO_26_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_GPIO_27_AL, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_ISIL1556 | BP_AFE_FE_ANNEXB| BP_AFE_FE_REV_ISIL_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368ntr = +{ + "96368NTR", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_33_AH, /* usGpioLedWanError */ + BP_GPIO_0_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_1_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + BP_NOT_DEFINED, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_GPIO_25_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_GPIO_26_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_GPIO_27_AL, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_DEFAULT, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368sv2 = +{ + "96368SV2", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_33_AH, /* usGpioLedWanError */ + BP_GPIO_30_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_31_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x3f, {0x01, 0x02, 0x03, 0x04, 0x12, 0x11, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_GPIO_25_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_GPIO_26_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_GPIO_27_AL, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_ISIL1556 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_ISIL_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mvwg = +{ + "96368MVWG", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_22_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_31_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x36, {0x00, 0x02, 0x03, 0x00, 0x12, 0x11, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_6302_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mvwgb = +{ + "96368MVWGB", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_22_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_31_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x36, {0x00, 0x02, 0x03, 0x00, 0x12, 0x11, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXB| BP_AFE_FE_REV_6302_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mvwgj = +{ + "96368MVWGJ", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_22_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_31_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x36, {0x00, 0x02, 0x03, 0x00, 0x12, 0x11, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXJ | BP_AFE_FE_REV_6302_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mbg = +{ + "96368MBG", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_31_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + BP_NOT_DEFINED, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_6302_REV1, + BP_AFE_CHIP_6306 | BP_AFE_LD_ISIL1556 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_ISIL_REV1}, /* ulAfeIds */ + BP_GPIO_35_AL, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mbg6b = +{ + "96368MBG6b", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_31_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + BP_NOT_DEFINED, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_6306 | BP_AFE_LD_ISIL1556 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_ISIL_REV1, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_GPIO_35_AL, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mbg6302 = +{ + "96368MBG6302", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_31_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + BP_NOT_DEFINED, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_6302_REV1, + BP_AFE_CHIP_6306 | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_6302_REV1}, /* ulAfeIds */ + BP_GPIO_35_AL, /* usGpioExtAFEReset */ + BP_GPIO_37_AH, /* usGpioExtAFELDPwr */ + BP_GPIO_36_AH /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mng = +{ + "96368MNG", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_31_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + BP_NOT_DEFINED, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x20, {0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00}}}, /* sw */ + {BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_SPI_SSB_1, /* usConfigType */ + {0x0f, {0x00, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00}}}}, /* sw */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_6306 | BP_AFE_LD_ISIL1556 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_ISIL_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_GPIO_37_AL, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96367avng = +{ + "96367AVNG", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_23_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_NOT_DEFINED, /* usGpioLedWanData */ + BP_GPIO_31_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x2f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x11, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_6302_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mvngr = +{ + "96368MVNgr", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_SPI_EXT_CS | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_23_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AH, /* usGpioLedWanData */ + BP_GPIO_3_AH, /* usGpioLedWanError */ + BP_GPIO_22_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_6302_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96368mvngrP2 = +{ + "96368MVNgrP2", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_PHY | + BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_INET_LED | + BP_OVERLAY_USB_DEVICE), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_2_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_23_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_5_AL, /* usGpioLedWanData */ + BP_GPIO_3_AL, /* usGpioLedWanError */ + BP_GPIO_22_AL, /* usGpioLedBlPowerOn */ + BP_GPIO_24_AL, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_0, /* usExtIntrResetToDefault */ + BP_EXT_INTR_1, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6302 | BP_AFE_FE_ANNEXA | BP_AFE_FE_REV_6302_REV1, + BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static PBOARD_PARAMETERS g_BoardParms[] = +{&g_bcm96368vvw, &g_bcm96368mvwg, &g_bcm96368sv2, &g_bcm96368mbg, +&g_bcm96368ntr, &g_bcm96368mbg6b, &g_bcm96368vvwb, &g_bcm96368mvwgb, +&g_bcm96368mng, &g_bcm96368mbg6302, &g_bcm96368mvwgj, &g_bcm96367avng, +&g_bcm96368mvngr, &g_bcm96368mvngrP2, 0}; +#endif + +#if defined(_BCM96816_) || defined(CONFIG_BCM96816) + +static BOARD_PARAMETERS g_bcm96816sv = +{ + "96816SV", /* szBoardId */ + (BP_OVERLAY_PCI | + BP_OVERLAY_GPHY_LED_0 | + BP_OVERLAY_GPHY_LED_1 | + BP_OVERLAY_MOCA_LED ), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_NOT_DEFINED, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_NOT_DEFINED, /* usGpioLedWanData */ + BP_NOT_DEFINED, /* usGpioLedWanError */ + BP_GPIO_3_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_4_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_GPIO_8_AH, /* usGpioLedGpon */ + BP_GPIO_16_AH, /* usGpioLedGponFail */ + BP_GPIO_5_AH, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0xbf, {0x00, 0x01, 0x14, 0x12, 0x18, 0xff, 0x00, 0xff}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_NO_DSP}, /* ucDspType */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_DEFAULT, BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96816pvwm = +{ + "96816PVWM", /* szBoardId */ + (BP_OVERLAY_GPHY_LED_0 | + BP_OVERLAY_GPHY_LED_1 | + BP_OVERLAY_MOCA_LED), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_NOT_DEFINED, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_NOT_DEFINED, /* usGpioLedWanData */ + BP_NOT_DEFINED, /* usGpioLedWanError */ + BP_GPIO_3_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_4_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_GPIO_8_AH, /* usGpioLedGpon */ + BP_GPIO_2_AH, /* usGpioLedGponFail */ + BP_GPIO_5_AH, /* usGpioLedMoCA */ + BP_GPIO_37_AH, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0xaf, {0x00, 0x01, 0x11, 0x12, 0x00, 0xff, 0x00, 0xff}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_NOT_DEFINED, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_NOT_DEFINED, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_DEFAULT, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96829rg = +{ + "96829RG", /* szBoardId */ + (BP_OVERLAY_GPHY_LED_0 | + BP_OVERLAY_GPHY_LED_1 | + BP_OVERLAY_MOCA_LED), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_NOT_DEFINED, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_NOT_DEFINED, /* usGpioLedWanData */ + BP_NOT_DEFINED, /* usGpioLedWanError */ + BP_GPIO_3_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_4_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_GPIO_5_AL, /* usGpioLedMoCA */ + BP_GPIO_37_AH, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0xaf, {0x00, 0x01, 0x11, 0x12, 0x00, 0xff, 0x00, 0xff}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_NO_DSP}, /* ucDspType */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_DEFAULT, BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96816p2og = +{ + "96816P2OG", /* szBoardId */ + (BP_OVERLAY_GPHY_LED_0 | + BP_OVERLAY_GPHY_LED_1 | + BP_OVERLAY_PCI | + BP_OVERLAY_MOCA_LED), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_NOT_DEFINED, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_NOT_DEFINED, /* usGpioLedWanData */ + BP_NOT_DEFINED, /* usGpioLedWanError */ + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */ + BP_NOT_DEFINED, /* usGpioLedBlStop */ + BP_GPIO_2_AH, /* usGpioFpgaReset */ + BP_GPIO_8_AH, /* usGpioLedGpon */ + BP_GPIO_16_AH, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0xaf, {0x00, 0x01, 0x11, 0xff, 0x00, 0xff, 0x00, 0xff}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_NO_DSP}, /* ucDspType */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_DEFAULT, BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96812pg = +{ + "96812PG" , /* szBoardId */ + (BP_OVERLAY_GPHY_LED_0 | + BP_OVERLAY_GPHY_LED_1), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_NOT_DEFINED, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_NOT_DEFINED, /* usGpioLedWanData */ + BP_NOT_DEFINED, /* usGpioLedWanError */ + BP_GPIO_3_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_4_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_GPIO_8_AH, /* usGpioLedGpon */ + BP_GPIO_2_AH, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0xaf, {0x00, 0x01, 0x11, 0x12, 0x00, 0xff, 0x00, 0xff}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_NO_DSP}, /* ucDspType */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_DEFAULT, BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96819bhr = +{ + "96819BHR", /* szBoardId */ + (BP_OVERLAY_GPHY_LED_0 | + BP_OVERLAY_GPHY_LED_1 | + BP_OVERLAY_MOCA_LED), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_NOT_DEFINED, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_NOT_DEFINED, /* usGpioLedWanData */ + BP_NOT_DEFINED, /* usGpioLedWanError */ + BP_GPIO_3_AH, /* usGpioLedBlPowerOn */ + BP_GPIO_4_AH, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_GPIO_5_AL, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_EXT_INTR_3, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_NOT_DEFINED, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x3f, {0x00, 0x01, 0x14, 0x12, 0xA1, 0xff, 0x00, 0xff}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_NO_DSP}, /* ucDspType */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_DEFAULT, BP_AFE_DEFAULT}, /* ulAfeIds */ + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED, /* usGpioExtAFELDMode */ +}; + +static PBOARD_PARAMETERS g_BoardParms[] = {&g_bcm96816sv, &g_bcm96816pvwm, &g_bcm96829rg, &g_bcm96816p2og, &g_bcm96812pg, &g_bcm96819bhr, 0}; +#endif + +#if defined(_BCM96328_) || defined(CONFIG_BCM96328) +static BOARD_PARAMETERS g_bcm96328avng = +{ + "96328avng", /* szBoardId */ + (BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_3_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_GPIO_9_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + // **** Set to BP_GPIO_0_AL when WanData LED is connected to GPIO11 + BP_GPIO_0_AL, /* usGpioLedWanData */ + BP_GPIO_2_AL, /* usGpioLedWanError */ + BP_GPIO_4_AL, /* usGpioLedBlPowerOn */ + BP_GPIO_8_AL, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x1f, {0x01, 0x02, 0x03, 0x04, 0x18, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_GPIO_6_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_GPIO_7_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_GPIO_5_AL, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6301 | BP_AFE_FE_ANNEXA | BP_AFE_FE_AVMODE_ADSL | BP_AFE_FE_REV_6301_REV_5_1_1, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96328avngrP1 = +{ + "96328avngrP1", /* szBoardId */ + (BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_SERIAL_LEDS), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_SERIAL_GPIO_10_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_SERIAL_GPIO_11_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_SERIAL_GPIO_1_AL, /* usGpioLedWanData */ + BP_SERIAL_GPIO_13_AL, /* usGpioLedWanError */ + BP_SERIAL_GPIO_8_AL, /* usGpioLedBlPowerOn */ + BP_SERIAL_GPIO_15_AL, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x1f, {0x01, 0x02, 0x03, 0x04, 0x18, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_SERIAL_GPIO_12_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_SERIAL_GPIO_14_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6301 | BP_AFE_FE_ANNEXA | BP_AFE_FE_AVMODE_ADSL | BP_AFE_FE_REV_6301_REV_5_1_1, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm96328avngr = +{ + "96328avngr", /* szBoardId */ + (BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 | + BP_OVERLAY_SERIAL_LEDS), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_SERIAL_GPIO_10_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_SERIAL_GPIO_11_AL, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_GPIO_1_AL, /* usGpioLedWanData */ + BP_SERIAL_GPIO_13_AL, /* usGpioLedWanError */ + BP_SERIAL_GPIO_8_AL, /* usGpioLedBlPowerOn */ + BP_SERIAL_GPIO_15_AL, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x1f, {0x01, 0x02, 0x03, 0x04, 0x18, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_MIPS, /* ucDspType */ + 0, /* ucDspAddress */ + BP_NOT_DEFINED, /* usGpioLedVoip */ + BP_SERIAL_GPIO_12_AL, /* usGpioVoip1Led */ + BP_NOT_DEFINED, /* usGpioVoip1LedFail */ + BP_SERIAL_GPIO_14_AL, /* usGpioVoip2Led */ + BP_NOT_DEFINED, /* usGpioVoip2LedFail */ + BP_NOT_DEFINED, /* usGpioPotsLed */ + BP_NOT_DEFINED}, /* usGpioDectLed */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6301 | BP_AFE_FE_ANNEXA | BP_AFE_FE_AVMODE_ADSL | BP_AFE_FE_REV_6301_REV_5_1_1, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static BOARD_PARAMETERS g_bcm963281TAN = +{ + "963281TAN", /* szBoardId */ + + (BP_OVERLAY_EPHY_LED_0 | + BP_OVERLAY_EPHY_LED_1 | + BP_OVERLAY_EPHY_LED_2 | + BP_OVERLAY_EPHY_LED_3 ), /* usGPIOOverlay */ + + BP_NOT_DEFINED, /* usGpioRj11InnerPair */ + BP_NOT_DEFINED, /* usGpioRj11OuterPair */ + BP_NOT_DEFINED, /* usGpioUartRts */ + BP_NOT_DEFINED, /* usGpioUartCts */ + + BP_GPIO_20_AL, /* usGpioLedAdsl */ + BP_NOT_DEFINED, /* usGpioLedAdslFail */ + BP_NOT_DEFINED, /* usGpioSecLedAdsl */ + BP_NOT_DEFINED, /* usGpioSecLedAdslFail */ + BP_NOT_DEFINED, /* usGpioLedSesWireless */ + BP_NOT_DEFINED, /* usGpioLedHpna */ + BP_NOT_DEFINED, /* usGpioLedWanData */ + BP_NOT_DEFINED, /* usGpioLedWanError */ + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */ + BP_NOT_DEFINED, /* usGpioLedBlStop */ + BP_NOT_DEFINED, /* usGpioFpgaReset */ + BP_NOT_DEFINED, /* usGpioLedGpon */ + BP_NOT_DEFINED, /* usGpioLedGponFail */ + BP_NOT_DEFINED, /* usGpioLedMoCA */ + BP_NOT_DEFINED, /* usGpioLedMoCAFail */ + + BP_NOT_DEFINED, /* usExtIntrResetToDefault */ + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */ + BP_NOT_DEFINED, /* usExtIntrHpna */ + + BP_NOT_DEFINED, /* usCsHpna */ + + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */ + 0, /* WLAN flags */ + + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */ + 0x0, /* ucPhyAddress */ + BP_NOT_DEFINED, /* usGpioLedPhyLinkSpeed */ + BP_ENET_CONFIG_MMAP, /* usConfigType */ + {0x0f, {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}}}, /* sw */ + {BP_ENET_NO_PHY}}, /* ucPhyType */ + {{BP_VOIP_NO_DSP}, /* ucDspType */ + {BP_VOIP_NO_DSP}}, /* ucDspType */ + BP_NOT_DEFINED, /* usGpioWirelessPowerDown */ + {BP_AFE_CHIP_INT | BP_AFE_LD_6301 | BP_AFE_FE_ANNEXA | BP_AFE_FE_AVMODE_ADSL | BP_AFE_FE_REV_6301_REV_5_1_1, /* ulAfeIds */ + BP_AFE_DEFAULT}, + BP_NOT_DEFINED, /* usGpioExtAFEReset */ + BP_NOT_DEFINED, /* usGpioExtAFELDPwr */ + BP_NOT_DEFINED /* usGpioExtAFELDMode */ +}; + +static PBOARD_PARAMETERS g_BoardParms[] = {&g_bcm96328avng, &g_bcm96328avngrP1, &g_bcm96328avngr, &g_bcm963281TAN, 0}; +#endif + +static PBOARD_PARAMETERS g_pCurrentBp = 0; + +/************************************************************************** +* Name : bpstrcmp +* +* Description: String compare for this file so it does not depend on an OS. +* (Linux kernel and CFE share this source file.) +* +* Parameters : [IN] dest - destination string +* [IN] src - source string +* +* Returns : -1 - dest < src, 1 - dest > src, 0 dest == src +***************************************************************************/ +int bpstrcmp(const char *dest,const char *src) +{ + while (*src && *dest) + { + if (*dest < *src) return -1; + if (*dest > *src) return 1; + dest++; + src++; + } + + if (*dest && !*src) return 1; + if (!*dest && *src) return -1; + return 0; +} /* bpstrcmp */ + +/************************************************************************** +* Name : BpGetVoipDspConfig +* +* Description: Gets the DSP configuration from the board parameter +* structure for a given DSP index. +* +* Parameters : [IN] dspNum - DSP index (number) +* +* Returns : Pointer to DSP configuration block if found/valid, NULL +* otherwise. +***************************************************************************/ +VOIP_DSP_INFO *BpGetVoipDspConfig( unsigned char dspNum ) +{ + VOIP_DSP_INFO *pDspConfig = 0; + int i; + + if( g_pCurrentBp ) + { + for( i = 0 ; i < BP_MAX_VOIP_DSP ; i++ ) + { + if( g_pCurrentBp->VoIPDspInfo[i].ucDspType != BP_VOIP_NO_DSP && + g_pCurrentBp->VoIPDspInfo[i].ucDspAddress == dspNum ) + { + pDspConfig = &g_pCurrentBp->VoIPDspInfo[i]; + break; + } + } + } + + return pDspConfig; +} + + +/************************************************************************** +* Name : BpSetBoardId +* +* Description: This function find the BOARD_PARAMETERS structure for the +* specified board id string and assigns it to a global, static +* variable. +* +* Parameters : [IN] pszBoardId - Board id string that is saved into NVRAM. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_FOUND - Error, board id input string does not +* have a board parameters configuration record. +***************************************************************************/ +int BpSetBoardId( char *pszBoardId ) +{ + int nRet = BP_BOARD_ID_NOT_FOUND; + PBOARD_PARAMETERS *ppBp; + + for( ppBp = g_BoardParms; *ppBp; ppBp++ ) + { + if( !bpstrcmp((*ppBp)->szBoardId, pszBoardId) ) + { + g_pCurrentBp = *ppBp; + nRet = BP_SUCCESS; + break; + } + } + + return( nRet ); +} /* BpSetBoardId */ + +/************************************************************************** +* Name : BpGetBoardId +* +* Description: This function returns the current board id strings. +* +* Parameters : [OUT] pszBoardIds - Address of a buffer that the board id +* string is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +***************************************************************************/ + +int BpGetBoardId( char *pszBoardId ) +{ + int i; + + if (g_pCurrentBp == 0) + return -1; + + for (i = 0; i < BP_BOARD_ID_LEN; i++) + pszBoardId[i] = g_pCurrentBp->szBoardId[i]; + + return 0; +} + +/************************************************************************** +* Name : BpGetBoardIds +* +* Description: This function returns all of the supported board id strings. +* +* Parameters : [OUT] pszBoardIds - Address of a buffer that the board id +* strings are returned in. Each id starts at BP_BOARD_ID_LEN +* boundary. +* [IN] nBoardIdsSize - Number of BP_BOARD_ID_LEN elements that +* were allocated in pszBoardIds. +* +* Returns : Number of board id strings returned. +***************************************************************************/ +int BpGetBoardIds( char *pszBoardIds, int nBoardIdsSize ) +{ + PBOARD_PARAMETERS *ppBp; + int i; + char *src; + char *dest; + + for( i = 0, ppBp = g_BoardParms; *ppBp && nBoardIdsSize; + i++, ppBp++, nBoardIdsSize--, pszBoardIds += BP_BOARD_ID_LEN ) + { + dest = pszBoardIds; + src = (*ppBp)->szBoardId; + while( *src ) + *dest++ = *src++; + *dest = '\0'; + } + + return( i ); +} /* BpGetBoardIds */ + +/************************************************************************** +* Name : BpGetGPIOverlays +* +* Description: This function GPIO overlay configuration +* +* Parameters : [OUT] pusValue - Address of short word that interfaces in use. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetGPIOverlays( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGPIOOverlay; + + if( g_pCurrentBp->usGPIOOverlay != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetGPIOverlays */ + +/************************************************************************** +* Name : BpGetEthernetMacInfo +* +* Description: This function returns all of the supported board id strings. +* +* Parameters : [OUT] pEnetInfos - Address of an array of ETHERNET_MAC_INFO +* buffers. +* [IN] nNumEnetInfos - Number of ETHERNET_MAC_INFO elements that +* are pointed to by pEnetInfos. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +***************************************************************************/ +int BpGetEthernetMacInfo( PETHERNET_MAC_INFO pEnetInfos, int nNumEnetInfos ) +{ + int i, nRet; + + if( g_pCurrentBp ) + { + for( i = 0; i < nNumEnetInfos; i++, pEnetInfos++ ) + { + if( i < BP_MAX_ENET_MACS ) + { + unsigned char *src = (unsigned char *) + &g_pCurrentBp->EnetMacInfos[i]; + unsigned char *dest = (unsigned char *) pEnetInfos; + int len = sizeof(ETHERNET_MAC_INFO); + while( len-- ) + *dest++ = *src++; + } + else + pEnetInfos->ucPhyType = BP_ENET_NO_PHY; + } + + nRet = BP_SUCCESS; + } + else + { + for( i = 0; i < nNumEnetInfos; i++, pEnetInfos++ ) + pEnetInfos->ucPhyType = BP_ENET_NO_PHY; + + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetEthernetMacInfo */ + +/************************************************************************** +* Name : BpGetRj11InnerOuterPairGpios +* +* Description: This function returns the GPIO pin assignments for changing +* between the RJ11 inner pair and RJ11 outer pair. +* +* Parameters : [OUT] pusInner - Address of short word that the RJ11 inner pair +* GPIO pin is returned in. +* [OUT] pusOuter - Address of short word that the RJ11 outer pair +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, values are returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetRj11InnerOuterPairGpios( unsigned short *pusInner, + unsigned short *pusOuter ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusInner = g_pCurrentBp->usGpioRj11InnerPair; + *pusOuter = g_pCurrentBp->usGpioRj11OuterPair; + + if( g_pCurrentBp->usGpioRj11InnerPair != BP_NOT_DEFINED && + g_pCurrentBp->usGpioRj11OuterPair != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusInner = *pusOuter = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetRj11InnerOuterPairGpios */ + +/************************************************************************** +* Name : BpGetUartRtsCtsGpios +* +* Description: This function returns the GPIO pin assignments for RTS and CTS +* UART signals. +* +* Parameters : [OUT] pusRts - Address of short word that the UART RTS GPIO +* pin is returned in. +* [OUT] pusCts - Address of short word that the UART CTS GPIO +* pin is returned in. +* +* Returns : BP_SUCCESS - Success, values are returned. +* BP_BOARD_ID_NOT_SET - Error, board id input string does not +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetRtsCtsUartGpios( unsigned short *pusRts, unsigned short *pusCts ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusRts = g_pCurrentBp->usGpioUartRts; + *pusCts = g_pCurrentBp->usGpioUartCts; + + if( g_pCurrentBp->usGpioUartRts != BP_NOT_DEFINED && + g_pCurrentBp->usGpioUartCts != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusRts = *pusCts = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetUartRtsCtsGpios */ + +/************************************************************************** +* Name : BpGetAdslLedGpio +* +* Description: This function returns the GPIO pin assignment for the ADSL +* LED. +* +* Parameters : [OUT] pusValue - Address of short word that the ADSL LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetAdslLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedAdsl; + + if( g_pCurrentBp->usGpioLedAdsl != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetAdslLedGpio */ + +/************************************************************************** +* Name : BpGetAdslFailLedGpio +* +* Description: This function returns the GPIO pin assignment for the ADSL +* LED that is used when there is a DSL connection failure. +* +* Parameters : [OUT] pusValue - Address of short word that the ADSL LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetAdslFailLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedAdslFail; + + if( g_pCurrentBp->usGpioLedAdslFail != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetAdslFailLedGpio */ + +/************************************************************************** +* Name : BpGetSecAdslLedGpio +* +* Description: This function returns the GPIO pin assignment for the ADSL +* LED of the Secondary line, applicable more for bonding. +* +* Parameters : [OUT] pusValue - Address of short word that the ADSL LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetSecAdslLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioSecLedAdsl; + + if( g_pCurrentBp->usGpioSecLedAdsl != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetSecAdslLedGpio */ + +/************************************************************************** +* Name : BpGetSecAdslFailLedGpio +* +* Description: This function returns the GPIO pin assignment for the ADSL +* LED of the Secondary ADSL line, that is used when there is +* a DSL connection failure. +* +* Parameters : [OUT] pusValue - Address of short word that the ADSL LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetSecAdslFailLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioSecLedAdslFail; + + if( g_pCurrentBp->usGpioSecLedAdslFail != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetSecAdslFailLedGpio */ + +/************************************************************************** +* Name : BpGetWirelessAntInUse +* +* Description: This function returns the antennas in use for wireless +* +* Parameters : [OUT] pusValue - Address of short word that the Wireless Antenna +* is in use. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetWirelessAntInUse( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usAntInUseWireless; + + if( g_pCurrentBp->usAntInUseWireless != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetWirelessAntInUse */ + +/************************************************************************** +* Name : BpGetWirelessFlags +* +* Description: This function returns optional control flags for wireless +* +* Parameters : [OUT] pusValue - Address of short word control flags +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetWirelessFlags( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usWirelessFlags; + + if( g_pCurrentBp->usWirelessFlags != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetWirelessAntInUse */ + +/************************************************************************** +* Name : BpGetWirelessSesExtIntr +* +* Description: This function returns the external interrupt number for the +* Wireless Ses Button. +* +* Parameters : [OUT] pusValue - Address of short word that the Wireless Ses +* external interrup is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetWirelessSesExtIntr( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usExtIntrSesBtnWireless; + + if( g_pCurrentBp->usExtIntrSesBtnWireless != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); + +} /* BpGetWirelessSesExtIntr */ + +/************************************************************************** +* Name : BpGetWirelessSesLedGpio +* +* Description: This function returns the GPIO pin assignment for the Wireless +* Ses Led. +* +* Parameters : [OUT] pusValue - Address of short word that the Wireless Ses +* Led GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetWirelessSesLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedSesWireless; + + if( g_pCurrentBp->usGpioLedSesWireless != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); + +} /* BpGetWirelessSesLedGpio */ + +/* this data structure could be moved to boardparams structure in the future */ +/* does not require to rebuild cfe here if more srom entries are needed */ +static WLAN_SROM_PATCH_INFO wlanPaInfo[]={ +#if defined(_BCM96362_) || defined(CONFIG_BCM96362) + /* this is the patch to srom map for 96362ADVNX */ + {"96362ADVNX", 0x6362, 220, + {{"boardrev", 65, 0x1100}, + {"fem2g", 87, 0x0319}, + {"ittmaxp2ga0", 96, 0x2058}, + {"pa2gw0a0", 97, 0xfe6f}, + {"pa2gw1a0", 98, 0x1785}, + {"pa2gw2a0", 99, 0xfa21}, + {"ittmaxp2ga1", 112, 0x2058}, + {"pa2gw0a0", 113, 0xfe77}, + {"pa2gw1a0", 114, 0x17e0}, + {"pa2gw2a0", 115, 0xfa16}, + {"ofdm2gpo0", 161, 0x5555}, + {"ofdm2gpo1", 162, 0x5555}, + {"mcs2gpo0", 169, 0x5555}, + {"mcs2gpo1", 170, 0x5555}, + {"mcs2gpo2", 171, 0x5555}, + {"mcs2gpo3", 172, 0x5555}, + {"mcs2gpo4", 173, 0x3333}, + {"mcs2gpo5", 174, 0x3333}, + {"mcs2gpo6", 175, 0x3333}, + {"mcs2gpo7", 176, 0x3333}, + {"", 0, 0}}}, + /* this is the patch to srom map for 6362SDVNgr2 */ + {"96362ADVNgr2", 0x6362, 220, + {{"ittmaxp2ga0", 96, 0x2048}, + {"pa2gw0a0", 97, 0xfeff}, + {"pa2gw1a0", 98, 0x160e}, + {"pa2gw2a0", 99, 0xfabf}, + {"ittmaxp2ga1", 112, 0x2048}, + {"pa2gw0a0", 113, 0xff13}, + {"pa2gw1a0", 114, 0x161e}, + {"pa2gw2a0", 115, 0xfacc}, + {"mcs2gpo0", 169, 0x2222}, + {"mcs2gpo1", 170, 0x2222}, + {"mcs2gpo2", 171, 0x2222}, + {"mcs2gpo3", 172, 0x2222}, + {"mcs2gpo4", 173, 0x4444}, + {"mcs2gpo5", 174, 0x4444}, + {"mcs2gpo6", 175, 0x4444}, + {"mcs2gpo7", 176, 0x4444}, + {"", 0, 0}}}, +#endif +#if 0 //defined(_BCM96328_) || defined(CONFIG_BCM96328) + {"963281TAN", 0xa8d9, 220, + {{"pa2gw0a0", 97, 0xfed9}, + {"pa2gw1a0", 98, 0x15c7}, + {"pa2gw2a0", 99, 0xfaee}, + {"pa2gw0a0", 113, 0xfed7}, + {"pa2gw1a0", 114, 0x1540}, + {"pa2gw2a0", 115, 0xfafc}, + {"", 0, 0}}}, +#endif + {"", 0, 0, {{"", 0, 0}}}, /* last entry*/ +}; + +/************************************************************************** +* Name : BpUpdateWirelessSromMap +* +* Description: This function patch wireless PA values +* +* Parameters : [IN] unsigned short chipID +* [IN/OUT] unsigned short* pBase - base of srom map +* [IN/OUT] int size - size of srom map +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpUpdateWirelessSromMap(unsigned short chipID, unsigned short* pBase, int sizeInWords) +{ + int nRet = BP_BOARD_ID_NOT_FOUND; + int i = 0; + int j = 0; + + if(chipID == 0 || pBase == 0 || sizeInWords <= 0 ) + return nRet; + + i = 0; + while ( wlanPaInfo[i].szboardId[0] != 0 ) { + /* check boardId */ + if ( !bpstrcmp(g_pCurrentBp->szBoardId, wlanPaInfo[i].szboardId) ) { + /* check chipId */ + if ( (wlanPaInfo[i].usWirelessChipId == chipID) && (wlanPaInfo[i].usNeededSize <= sizeInWords) ){ + /* valid , patch entry */ + while ( wlanPaInfo[i].entries[j].name[0] ) { + pBase[wlanPaInfo[i].entries[j].wordOffset] = wlanPaInfo[i].entries[j].value; + j++; + } + nRet = BP_SUCCESS; + goto srom_update_done; + } + } + i++; + } + +srom_update_done: + + return( nRet ); + +} /* BpUpdateWirelessSromMap */ + + +static WLAN_PCI_PATCH_INFO wlanPciInfo[]={ +#if defined(_BCM96362_) || defined(CONFIG_BCM96362) + /* this is the patch to boardtype(boardid) for internal PA */ + {"96362ADVNX", 0x435f14e4, 64, + {{"subpciids", 11, 0x53614e4}, + {"", 0, 0}}}, +#endif + {"", 0, 0, {{"", 0, 0}}}, /* last entry*/ +}; + +/************************************************************************** +* Name : BpUpdateWirelessPciConfig +* +* Description: This function patch wireless PCI Config Header +* This is not functional critial/necessary but for dvt database maintenance +* +* Parameters : [IN] unsigned int pciID +* [IN/OUT] unsigned int* pBase - base of pci config header +* [IN/OUT] int sizeInDWords - size of pci config header +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpUpdateWirelessPciConfig (unsigned long pciID, unsigned long* pBase, int sizeInDWords) +{ + int nRet = BP_BOARD_ID_NOT_FOUND; + int i = 0; + int j = 0; + + if(pciID == 0 || pBase == 0 || sizeInDWords <= 0 ) + return nRet; + + i = 0; + while ( wlanPciInfo[i].szboardId[0] != 0 ) { + /* check boardId */ + if ( !bpstrcmp(g_pCurrentBp->szBoardId, wlanPciInfo[i].szboardId) ) { + /* check pciId */ + if ( (wlanPciInfo[i].usWirelessPciId == pciID) && (wlanPciInfo[i].usNeededSize <= sizeInDWords) ){ + /* valid , patch entry */ + while ( wlanPciInfo[i].entries[j].name[0] ) { + pBase[wlanPciInfo[i].entries[j].dwordOffset] = wlanPciInfo[i].entries[j].value; + j++; + } + nRet = BP_SUCCESS; + goto pciconfig_update_done; + } + } + i++; + } + +pciconfig_update_done: + + return( nRet ); + +} + +/************************************************************************** +* Name : BpGetHpnaLedGpio +* +* Description: This function returns the GPIO pin assignment for the HPNA +* LED. +* +* Parameters : [OUT] pusValue - Address of short word that the HPNA LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetHpnaLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedHpna; + + if( g_pCurrentBp->usGpioLedHpna != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetHpnaLedGpio */ + +/************************************************************************** +* Name : BpGetWanDataLedGpio +* +* Description: This function returns the GPIO pin assignment for the WAN Data +* LED. +* +* Parameters : [OUT] pusValue - Address of short word that the WAN Data LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetWanDataLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedWanData; + + if( g_pCurrentBp->usGpioLedWanData != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetWanDataLedGpio */ + +/************************************************************************** +* Name : BpGetWanErrorLedGpio +* +* Description: This function returns the GPIO pin assignment for the WAN +* LED that is used when there is a WAN connection failure. +* +* Parameters : [OUT] pusValue - Address of short word that the WAN LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetWanErrorLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedWanError; + + if( g_pCurrentBp->usGpioLedWanError != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetWanErrorLedGpio */ + +/************************************************************************** +* Name : BpGetBootloaderPowerOnLedGpio +* +* Description: This function returns the GPIO pin assignment for the power +* on LED that is set by the bootloader. +* +* Parameters : [OUT] pusValue - Address of short word that the alarm LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetBootloaderPowerOnLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedBlPowerOn; + + if( g_pCurrentBp->usGpioLedBlPowerOn != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetBootloaderPowerOn */ + +/************************************************************************** +* Name : BpGetBootloaderStopLedGpio +* +* Description: This function returns the GPIO pin assignment for the break +* into bootloader LED that is set by the bootloader. +* +* Parameters : [OUT] pusValue - Address of short word that the break into +* bootloader LED GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetBootloaderStopLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedBlStop; + + if( g_pCurrentBp->usGpioLedBlStop != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetBootloaderStopLedGpio */ + +/************************************************************************** +* Name : BpGetVoipLedGpio +* +* Description: This function returns the GPIO pin assignment for the VOIP +* LED. +* +* Parameters : [OUT] pusValue - Address of short word that the VOIP LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +* +* Note : The VoIP structure would allow for having one LED per DSP +* however, the board initialization function assumes only one +* LED per functionality (ie one LED for VoIP). Therefore in +* order to keep this tidy and simple we do not make usage of the +* one-LED-per-DSP function. Instead, we assume that the LED for +* VoIP is unique and associated with DSP 0 (always present on +* any VoIP platform). If changing this to a LED-per-DSP function +* then one need to update the board initialization driver in +* bcmdrivers\opensource\char\board\bcm963xx\impl1 +***************************************************************************/ +int BpGetVoipLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( 0 ); + + if( pDspInfo ) + { + *pusValue = pDspInfo->usGpioLedVoip; + + if( *pusValue != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_FOUND; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetVoipLedGpio */ + +/************************************************************************** +* Name : BpGetVoip1LedGpio +* +* Description: This function returns the GPIO pin assignment for the VoIP1. +* LED which is used when FXS0 is active +* Parameters : [OUT] pusValue - Address of short word that the VoIP1 +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetVoip1LedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + VOIP_DSP_INFO *pDspInfo = &g_pCurrentBp->VoIPDspInfo[0]; + + if( pDspInfo->ucDspType != BP_VOIP_NO_DSP) + { + *pusValue = pDspInfo->usGpioVoip1Led; + + if( pDspInfo->usGpioVoip1Led != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetVoip1LedGpio */ + +/************************************************************************** +* Name : BpGetVoip1FailLedGpio +* +* Description: This function returns the GPIO pin assignment for the VoIP1 +* Fail LED which is used when there's an error with FXS0 +* Parameters : [OUT] pusValue - Address of short word that the VoIP1 +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetVoip1FailLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + VOIP_DSP_INFO *pDspInfo = &g_pCurrentBp->VoIPDspInfo[0]; + + if( pDspInfo->ucDspType != BP_VOIP_NO_DSP) + { + *pusValue = pDspInfo->usGpioVoip1LedFail; + + if( pDspInfo->usGpioVoip1LedFail != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetVoip1FailLedGpio */ + +/************************************************************************** +* Name : BpGetVoip2LedGpio +* +* Description: This function returns the GPIO pin assignment for the VoIP2. +* LED which is used when FXS1 is active +* Parameters : [OUT] pusValue - Address of short word that the VoIP2 +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetVoip2LedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + VOIP_DSP_INFO *pDspInfo = &g_pCurrentBp->VoIPDspInfo[0]; + + if( pDspInfo->ucDspType != BP_VOIP_NO_DSP) + { + *pusValue = pDspInfo->usGpioVoip2Led; + + if( pDspInfo->usGpioVoip2Led != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetVoip2LedGpio */ + +/************************************************************************** +* Name : BpGetVoip2FailLedGpio +* +* Description: This function returns the GPIO pin assignment for the VoIP2 +* Fail LED which is used when there's an error with FXS1 +* Parameters : [OUT] pusValue - Address of short word that the VoIP2 +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetVoip2FailLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + VOIP_DSP_INFO *pDspInfo = &g_pCurrentBp->VoIPDspInfo[0]; + + if( pDspInfo->ucDspType != BP_VOIP_NO_DSP) + { + *pusValue = pDspInfo->usGpioVoip2LedFail; + + if( pDspInfo->usGpioVoip2LedFail != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetVoip2FailLedGpio */ + +/************************************************************************** +* Name : BpGetPotsLedGpio +* +* Description: This function returns the GPIO pin assignment for the POTS1. +* LED which is used when DAA is active +* Parameters : [OUT] pusValue - Address of short word that the POTS11 +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetPotsLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + VOIP_DSP_INFO *pDspInfo = &g_pCurrentBp->VoIPDspInfo[0]; + + if( pDspInfo->ucDspType != BP_VOIP_NO_DSP) + { + *pusValue = pDspInfo->usGpioPotsLed; + + if( pDspInfo->usGpioPotsLed != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetPotsLedGpio */ + +/************************************************************************** +* Name : BpGetDectLedGpio +* +* Description: This function returns the GPIO pin assignment for the DECT. +* LED which is used when DECT is active +* Parameters : [OUT] pusValue - Address of short word that the DECT +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetDectLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + VOIP_DSP_INFO *pDspInfo = &g_pCurrentBp->VoIPDspInfo[0]; + + if( pDspInfo->ucDspType != BP_VOIP_NO_DSP) + { + *pusValue = pDspInfo->usGpioDectLed; + + if( pDspInfo->usGpioDectLed != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetDectLedGpio */ + +/************************************************************************** +* Name : BpGetFpgaResetGpio +* +* Description: This function returns the GPIO pin assignment for the FPGA +* Reset signal. +* +* Parameters : [OUT] pusValue - Address of short word that the FPGA Reset +* signal GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetFpgaResetGpio( unsigned short *pusValue ) { + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioFpgaReset; + + if( g_pCurrentBp->usGpioFpgaReset != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); + +} /*BpGetFpgaResetGpio*/ + +/************************************************************************** +* Name : BpGetGponLedGpio +* +* Description: This function returns the GPIO pin assignment for the GPON +* LED. +* +* Parameters : [OUT] pusValue - Address of short word that the GPON LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetGponLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedGpon; + + if( g_pCurrentBp->usGpioLedGpon != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetGponLedGpio */ + +/************************************************************************** +* Name : BpGetGponFailLedGpio +* +* Description: This function returns the GPIO pin assignment for the GPON +* LED that is used when there is a GPON connection failure. +* +* Parameters : [OUT] pusValue - Address of short word that the GPON LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetGponFailLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedGponFail; + + if( g_pCurrentBp->usGpioLedGponFail != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetGponFailLedGpio */ + + +/************************************************************************** +* Name : BpGetMoCALedGpio +* +* Description: This function returns the GPIO pin assignment for the MoCA +* LED. +* +* Parameters : [OUT] pusValue - Address of short word that the MoCA LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetMoCALedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedMoCA; + + if( g_pCurrentBp->usGpioLedMoCA != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetMoCALedGpio */ + +/************************************************************************** +* Name : BpGetMoCAFailLedGpio +* +* Description: This function returns the GPIO pin assignment for the MoCA +* LED that is used when there is a MoCA connection failure. +* +* Parameters : [OUT] pusValue - Address of short word that the MoCA LED +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetMoCAFailLedGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioLedMoCAFail; + + if( g_pCurrentBp->usGpioLedMoCAFail != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetMoCAFailLedGpio */ + +/************************************************************************** +* Name : BpGetHpnaExtIntr +* +* Description: This function returns the HPNA external interrupt number. +* +* Parameters : [OUT] pulValue - Address of short word that the HPNA +* external interrupt number is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetHpnaExtIntr( unsigned long *pulValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pulValue = g_pCurrentBp->usExtIntrHpna; + + if( g_pCurrentBp->usExtIntrHpna != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pulValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetHpnaExtIntr */ + +/************************************************************************** +* Name : BpGetHpnaChipSelect +* +* Description: This function returns the HPNA chip select number. +* +* Parameters : [OUT] pulValue - Address of short word that the HPNA +* chip select number is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetHpnaChipSelect( unsigned long *pulValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pulValue = g_pCurrentBp->usCsHpna; + + if( g_pCurrentBp->usCsHpna != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pulValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetHpnaChipSelect */ + +/************************************************************************** +* Name : BpGetResetToDefaultExtIntr +* +* Description: This function returns the external interrupt number for the +* reset to default button. +* +* Parameters : [OUT] pusValue - Address of short word that reset to default +* external interrupt is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetResetToDefaultExtIntr( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usExtIntrResetToDefault; + + if( g_pCurrentBp->usExtIntrResetToDefault != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); + +} /* BpGetResetToDefaultExtIntr */ + +/************************************************************************** +* Name : BpGetWirelessPowerDownGpio +* +* Description: This function returns the GPIO pin assignment for WLAN_PD +* +* +* Parameters : [OUT] pusValue - Address of short word that the WLAN_PD +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - At least one return value is not defined +* for the board. +***************************************************************************/ +int BpGetWirelessPowerDownGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioWirelessPowerDown; + + if( g_pCurrentBp->usGpioWirelessPowerDown != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* usGpioWirelessPowerDown */ + +/************************************************************************** +* Name : BpGetDslPhyAfeIds +* +* Description: This function returns the DSL PHY AFE ids for primary and +* secondary PHYs. +* +* Parameters : [OUT] pulValues-Address of an array of two long words where +* AFE Id for the primary and secondary PHYs are returned. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET-Error, BpSetBoardId hasn't been called. +* BP_VALUE_NOT_DEFINED - No defined AFE Ids. +**************************************************************************/ +int BpGetDslPhyAfeIds( unsigned long *pulValues ) +{ + int nRet; + + if( g_pCurrentBp ) + { + pulValues[0] = g_pCurrentBp->ulAfeIds[0]; + pulValues[1] = g_pCurrentBp->ulAfeIds[1]; + nRet = BP_SUCCESS; + } + else + { + pulValues[0] = BP_AFE_DEFAULT; + pulValues[1] = BP_AFE_DEFAULT; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetDslPhyAfeIds */ + +/************************************************************************** +* Name : BpGetExtAFEResetGpio +* +* Description: This function returns the GPIO pin assignment for resetting the external AFE chip +* +* +* Parameters : [OUT] pusValue - Address of short word that the ExtAFEReset +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - Not defined +***************************************************************************/ +int BpGetExtAFEResetGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioExtAFEReset; + + if( g_pCurrentBp->usGpioExtAFEReset != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetExtAFEResetGpio */ + +/************************************************************************** +* Name : BpGetExtAFELDModeGpio +* +* Description: This function returns the GPIO pin assignment for setting LD Mode to ADSL/VDSL +* +* +* Parameters : [OUT] pusValue - Address of short word that the usGpioExtAFELDMode +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - Not defined +***************************************************************************/ +int BpGetExtAFELDModeGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioExtAFELDMode; + + if( g_pCurrentBp->usGpioExtAFELDMode != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetExtAFELDModeGpio */ + +/************************************************************************** +* Name : BpGetExtAFELDPwrGpio +* +* Description: This function returns the GPIO pin assignment for turning on/off the external AFE LD +* +* +* Parameters : [OUT] pusValue - Address of short word that the usGpioExtAFELDPwr +* GPIO pin is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - Not defined +***************************************************************************/ +int BpGetExtAFELDPwrGpio( unsigned short *pusValue ) +{ + int nRet; + + if( g_pCurrentBp ) + { + *pusValue = g_pCurrentBp->usGpioExtAFELDPwr; + + if( g_pCurrentBp->usGpioExtAFELDPwr != BP_NOT_DEFINED ) + { + nRet = BP_SUCCESS; + } + else + { + nRet = BP_VALUE_NOT_DEFINED; + } + } + else + { + *pusValue = BP_NOT_DEFINED; + nRet = BP_BOARD_ID_NOT_SET; + } + + return( nRet ); +} /* BpGetExtAFELDPwrGpio */ + + +/************************************************************************** +* Name : BpGet6829PortInfo +* +* Description: This function checks the ENET MAC info to see if a 6829 +* is connected +* +* Parameters : [OUT] portInfo6829 - 0 if 6829 is not present +* - 6829 port information otherwise +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called. +* BP_VALUE_NOT_DEFINED - Not defined +***************************************************************************/ +int BpGet6829PortInfo( unsigned char *portInfo6829 ) +{ + ETHERNET_MAC_INFO enetMacInfo; + ETHERNET_SW_INFO *pSwInfo; + int retVal; + int i; + + *portInfo6829 = 0; + retVal = BpGetEthernetMacInfo( &enetMacInfo, 1 ); + if ( BP_SUCCESS == retVal ) + { + pSwInfo = &enetMacInfo.sw; + for (i = 0; i < BP_MAX_SWITCH_PORTS; i++) + { + if ( (pSwInfo->phy_id[i] != 0xFF) && + (pSwInfo->phy_id[i] & 0x80) ) + { + *portInfo6829 = pSwInfo->phy_id[i]; + retVal = BP_SUCCESS; + break; + } + } + } + + return retVal; + +} + diff --git a/shared/opensource/boardparms/bcm963xx/boardparms_voice.c b/shared/opensource/boardparms/bcm963xx/boardparms_voice.c new file mode 100755 index 0000000..72161cd --- /dev/null +++ b/shared/opensource/boardparms/bcm963xx/boardparms_voice.c @@ -0,0 +1,8804 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/************************************************************************** +* File Name : boardparms_voice.c +* +* Description: This file contains the implementation for the BCM63xx board +* parameter voice access functions. +* +***************************************************************************/ + +/* ---- Include Files ---------------------------------------------------- */ + +#include "boardparms_voice.h" + +/* ---- Public Variables ------------------------------------------------- */ + +/* ---- Private Constants and Types -------------------------------------- */ + +/* Always end the device list in VOICE_BOARD_PARMS with this macro */ +#define BP_NULL_DEVICE_MACRO \ +{ \ + BP_VD_NONE, \ + { 0, BP_NOT_DEFINED }, \ + 0, \ + BP_NOT_DEFINED, \ + { \ + { BP_VOICE_CHANNEL_INACTIVE, BP_VCTYPE_NONE, BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, BP_VOICE_CHANNEL_NARROWBAND, BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, BP_VOICE_CHANNEL_ENDIAN_BIG, BP_TIMESLOT_INVALID, BP_TIMESLOT_INVALID }, \ + { BP_VOICE_CHANNEL_INACTIVE, BP_VCTYPE_NONE, BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, BP_VOICE_CHANNEL_NARROWBAND, BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, BP_VOICE_CHANNEL_ENDIAN_BIG, BP_TIMESLOT_INVALID, BP_TIMESLOT_INVALID }, \ + } \ +} + +#define BP_NULL_CHANNEL_MACRO \ +{ BP_VOICE_CHANNEL_INACTIVE, \ + BP_VCTYPE_NONE, \ + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, \ + BP_VOICE_CHANNEL_NARROWBAND, \ + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, \ + BP_VOICE_CHANNEL_ENDIAN_BIG, \ + BP_TIMESLOT_INVALID, \ + BP_TIMESLOT_INVALID \ +}, + + +#if defined(_BCM96328_) || defined(CONFIG_BCM96328) + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_LE88276 = +{ + VOICECFG_LE88276_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88276, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_31_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_SI3226 = +{ + VOICECFG_SI3226_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_3226, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_31_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_VE890 = +{ + VOICECFG_VE890_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_30_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_31_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_SI3217X = +{ + VOICECFG_SI3217X_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_30_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_31_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_LE88506 = +{ + VOICECFG_LE88506_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88506, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_31_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_SI32267 = +{ + VOICECFG_6328AVNG_SI32267_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_32267, + + /* SPI control */ + { + /* SPI dev id */ + 6, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_31_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( BP_FLAG_ISI_SUPPORT ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_LE88276_NTR = +{ + VOICECFG_6328AVNG_LE88276_NTR_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88276, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_VE890HV_Partial = +{ + VOICECFG_6328AVNG_VE890HV_PARTIAL_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89336, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 0, /* This setting is specific to Zarlink reference card Le71HR8923G for shared 1 reset line. */ + + /* Reset pin */ + BP_GPIO_30_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_31_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96328AVNG_VE890HV = +{ + VOICECFG_6328AVNG_VE890HV_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89136, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89336, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 0, /* This setting is specific to Zarlink reference card Le71HR8923G for shared 1 reset line. */ + + /* Reset pin */ + BP_GPIO_30_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_31_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96328AVNGR_SI32176 = +{ + VOICECFG_6328AVNGR_SI32176_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96328AVNGR_LE89116 = +{ + VOICECFG_6328AVNGR_LE89116_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96328AVNGR_SI3217X = +{ + VOICECFG_6328AVNGR_SI3217X_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 0, /* Reset line shared to one line only for AVNGR board */ + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +static PVOICE_BOARD_PARMS g_VoiceBoardParms[] = +{ + &voiceBoard_96328AVNG_LE88276, + &voiceBoard_96328AVNG_SI3226, + &voiceBoard_96328AVNG_VE890, + &voiceBoard_96328AVNG_SI3217X, + &voiceBoard_96328AVNG_LE88506, +#ifdef SI32267ENABLE + &voiceBoard_96328AVNG_SI32267, +#endif + &voiceBoard_96328AVNG_LE88276_NTR, + &voiceBoard_96328AVNG_VE890HV_Partial, + &voiceBoard_96328AVNG_VE890HV, + + &voiceBoard_96328AVNGR_SI32176, + &voiceBoard_96328AVNGR_LE89116, + &voiceBoard_96328AVNGR_SI3217X, + 0 +}; + + +#endif + +#if defined(_BCM96362_) || defined(CONFIG_BCM96362) + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_NOSLIC = +{ + VOICECFG_6362ADVNGP5_NOSLIC_STR, /* szBoardId */ + 0, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_VE890 = +{ + VOICECFG_6362ADVNGP5_VE890_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_0_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_LE89116 = +{ + VOICECFG_6362ADVNGP5_LE89116_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_0_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_LE89316 = +{ + VOICECFG_6362ADVNGP5_LE89316_STR, /* szBoardId */ + 1, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_SI3217X = +{ + VOICECFG_6362ADVNGP5_SI3217X_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_0_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 32176 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_SI32176 = +{ + VOICECFG_6362ADVNGP5_SI32176_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_0_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_SI32178 = +{ + VOICECFG_6362ADVNGP5_SI32178_STR, /* szBoardId */ + 1, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_LE88276 = +{ + VOICECFG_6362ADVNGP5_LE88276_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88276, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_0_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_SI3226 = +{ + VOICECFG_6362ADVNGP5_SI3226_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_3226, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_0_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_LE88506 = +{ + VOICECFG_6362ADVNGP5_LE88506_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_6_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88506, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_0_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_10_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI3217X = +{ + VOICECFG_6362ADVNGR_SI3217X_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI32176 = +{ + VOICECFG_6362ADVNGR_SI32176_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI32178 = +{ + VOICECFG_6362ADVNGR_SI32178_STR, /* szBoardId */ + 1, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI3217X_NOFXO = +{ + VOICECFG_6362ADVNGR_SI3217X_NOFXO_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 32176 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_VE890 = +{ + VOICECFG_6362ADVNGR_VE890_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 4, + 4 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 5, + 5 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 6, + 6 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_LE89116 = +{ + VOICECFG_6362ADVNGR_LE89116_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 4, + 4 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_LE89316 = +{ + VOICECFG_6362ADVNGR_LE89316_STR, /* szBoardId */ + 1, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 4, + 4 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 5, + 5 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_LE88506 = +{ + VOICECFG_6362ADVNGR_LE88506_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88506, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_LE88276 = +{ + VOICECFG_6362ADVNGR_LE88276_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88276, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI3226 = +{ + VOICECFG_6362ADVNGR_SI3226_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_3226, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI32261 = +{ + VOICECFG_6362ADVNGR_SI32261_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32261, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI32267 = +{ + VOICECFG_6362ADVNGR_SI32267_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32267, + + /* SPI control */ + { + /* SPI dev id */ + 3, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( BP_FLAG_ISI_SUPPORT ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_VE890HVP = +{ + VOICECFG_6362ADVNGR_VE890HV_PARTIAL_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 4, + 4 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89336, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 0, /* This setting is specific to Zarlink reference card Le71HR8923G for shared 1 reset line. */ + + /* Reset pin */ + BP_GPIO_28_AL, /* This setting is specific to Zarlink reference card Le71HR8923G for shared 1 reset line. */ + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 5, + 5 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 6, + 6 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_VE890HV = +{ + VOICECFG_6362ADVNGR_VE890HV_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89136, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 4, + 4 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89336, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 5, + 5 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 6, + 6 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_SI3217X = +{ + VOICECFG_6362ADVNGR2_SI3217X_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_44_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_VE890 = +{ + VOICECFG_6362ADVNGR2_VE890_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 4, + 4 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice3 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_31_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 5, + 5 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 6, + 6 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_44_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_LE88506 = +{ + VOICECFG_6362ADVNGR2_LE88506_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88506, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_44_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_LE88276 = +{ + VOICECFG_6362ADVNGR2_LE88276_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88276, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_44_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_SI3226 = +{ + VOICECFG_6362ADVNGR2_SI3226_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 4, /* numDectLines */ + 1, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_29_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_3226, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_28_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_44_AH, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +static PVOICE_BOARD_PARMS g_VoiceBoardParms[] = +{ + &voiceBoard_96362ADVNGP5_NOSLIC, +// &voiceBoard_96362ADVNGP5_VE890, +// &voiceBoard_96362ADVNGP5_LE89116, +// &voiceBoard_96362ADVNGP5_LE89316, +// &voiceBoard_96362ADVNGP5_SI3217X, +// &voiceBoard_96362ADVNGP5_SI32176, +// &voiceBoard_96362ADVNGP5_SI32178, +// &voiceBoard_96362ADVNGP5_LE88276, +// &voiceBoard_96362ADVNGP5_SI3226, +// &voiceBoard_96362ADVNGP5_LE88506, + &voiceBoard_96362ADVNgr_SI3217X, + &voiceBoard_96362ADVNgr_SI32176, + &voiceBoard_96362ADVNgr_SI32178, + &voiceBoard_96362ADVNgr_SI3217X_NOFXO, + &voiceBoard_96362ADVNgr_VE890, + &voiceBoard_96362ADVNgr_LE89116, + &voiceBoard_96362ADVNgr_LE89316, + &voiceBoard_96362ADVNgr_LE88506, + &voiceBoard_96362ADVNgr_LE88276, + &voiceBoard_96362ADVNgr_SI3226, +#ifdef SI32261ENABLE + &voiceBoard_96362ADVNgr_SI32261, +#endif +#ifdef SI32267ENABLE + &voiceBoard_96362ADVNgr_SI32267, +#endif + &voiceBoard_96362ADVNgr_VE890HVP, + &voiceBoard_96362ADVNgr_VE890HV, + &voiceBoard_96362ADVNGR2_SI3217X, + &voiceBoard_96362ADVNGR2_VE890, + &voiceBoard_96362ADVNGR2_LE88506, + &voiceBoard_96362ADVNGR2_LE88276, + &voiceBoard_96362ADVNGR2_SI3226, + 0 +}; + +#endif + +#if defined(_BCM96368_) || defined(CONFIG_BCM96368) + +VOICE_BOARD_PARMS voiceBoard_96368MVWG = +{ + VOICECFG_6368MVWG_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 2, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_10_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 4, + 4 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 3, + /* SPI GPIO */ + BP_GPIO_29_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 0, + + /* Reset pin */ + BP_GPIO_10_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 5, + 5 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 6, + 6 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_GPIO_3_AH, BP_GPIO_13_AH } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_VE890 = +{ + VOICECFG_6368MBG_VE890_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + +{ + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_3_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_LE89116 = +{ + VOICECFG_6368MBG_LE89116_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_3_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_LE89316 = +{ + VOICECFG_6368MBG_LE89316_STR, /* szBoardId */ + 1, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_SI3217X = +{ + VOICECFG_6368MBG_SI3217X_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_3_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_SI32176 = +{ + VOICECFG_6368MBG_SI32176_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_3_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_SI32178 = +{ + VOICECFG_6368MBG_SI32178_STR, /* szBoardId */ + 1, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1}, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_LE88276 = +{ + VOICECFG_6368MBG_LE88276_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88276, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_3_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_LE88506 = +{ + VOICECFG_6368MBG_LE88506_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88506, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_3_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MBG_SI3226 = +{ + VOICECFG_6368MBG_SI3226_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_3226, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_3_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI3217X = +{ + VOICECFG_6368MVNGR_SI3217X_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_17_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI32176 = +{ + VOICECFG_6368MVNGR_SI32176_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI32178 = +{ + VOICECFG_6368MVNGR_SI32178_STR, /* szBoardId */ + 1, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_17_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI3217X_NOFXO = +{ + VOICECFG_6368MVNGR_SI3217X_NOFXO_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_SILABS_32176, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_SILABS_32178, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_17_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_VE890 = +{ + VOICECFG_6368MVNGR_VE890_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_17_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_LE89116 = +{ + VOICECFG_6368MVNGR_LE89116_STR, /* szBoardId */ + 1, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_LE89316 = +{ + VOICECFG_6368MVNGR_LE89316_STR, /* szBoardId */ + 1, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89316, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_17_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_LE88506 = +{ + VOICECFG_6368MVNGR_LE88506_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88506, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_LE88276 = +{ + VOICECFG_6368MVNGR_LE88276_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88276, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI3226 = +{ + VOICECFG_6368MVNGR_SI3226_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_SILABS_3226, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_VE890HV_Partial = +{ + VOICECFG_6368MVNGR_VE890HV_PARTIAL_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89116, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89336, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 0, /* This setting is specific to Zarlink reference card Le71HR8923G for shared 1 reset line. */ + + /* Reset pin */ + BP_GPIO_16_AL, /* This setting is specific to Zarlink reference card Le71HR8923G for shared 1 reset line. */ + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +VOICE_BOARD_PARMS voiceBoard_96368MVNgr_VE890HV = +{ + VOICECFG_6368MVNGR_VE890HV_STR, /* szBoardId */ + 2, /* numFxsLines */ + 1, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_IDECT1, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID + }, + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_DECT, + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_WIDEBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice1 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89136, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_16_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* There is no second channel on 89116 so mark it as inactive */ + { BP_VOICE_CHANNEL_INACTIVE, + BP_VCTYPE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_TIMESLOT_INVALID, + BP_TIMESLOT_INVALID}, + } + }, + + /* voiceDevice2 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_89336, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_17_AL, + + /* Channel description */ + { + /* Channel 0 on device 0 */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_DAA, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 2, + 2 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + +static PVOICE_BOARD_PARMS g_VoiceBoardParms[] = +{ + &voiceBoard_96368MVWG, + &voiceBoard_96368MBG_LE88276, + &voiceBoard_96368MBG_LE88506, + &voiceBoard_96368MBG_VE890, + &voiceBoard_96368MBG_LE89116, + &voiceBoard_96368MBG_LE89316, + &voiceBoard_96368MBG_SI3217X, + &voiceBoard_96368MBG_SI32176, + &voiceBoard_96368MBG_SI32178, + &voiceBoard_96368MBG_SI3226, + &voiceBoard_96368MVNgr_SI3217X, + &voiceBoard_96368MVNgr_SI32176, + &voiceBoard_96368MVNgr_SI32178, + &voiceBoard_96368MVNgr_SI3217X_NOFXO, + &voiceBoard_96368MVNgr_VE890, +// &voiceBoard_96368MVNgr_LE89116, /* Temporarily remove */ +// &voiceBoard_96368MVNgr_LE89316, /* Temporarily remove */ + &voiceBoard_96368MVNgr_VE890HV_Partial, + &voiceBoard_96368MVNgr_VE890HV, + &voiceBoard_96368MVNgr_LE88506, + &voiceBoard_96368MVNgr_LE88276, + &voiceBoard_96368MVNgr_SI3226, + 0 +}; + +#endif + +#if defined(_BCM96816_) || defined(CONFIG_BCM96816) + +VOICE_BOARD_PARMS voiceBoard_96816PVWM_LE9530 = +{ + VOICECFG_LE9530_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_9530, + + /* SPI control */ + { + /* SPI dev id */ + 0, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 0, + + /* Reset pin */ + BP_NOT_DEFINED, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( BP_FLAG_DSP_APMHAL_ENABLE ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96816PVWM_LE88276 = +{ + VOICECFG_LE88276_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88276, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96816PVWM_SI3226 = +{ + VOICECFG_SI3226_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_SILABS_3226, + + /* SPI control */ + { + /* SPI dev id */ + 2, + /* SPI GPIO */ + BP_GPIO_28_AL, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + +VOICE_BOARD_PARMS voiceBoard_96816PVWM_LE88506 = +{ + VOICECFG_LE88506_STR, /* szBoardId */ + 2, /* numFxsLines */ + 0, /* numFxoLines */ + 0, /* numDectLines */ + 0, /* numFailoverRelayPins */ + + { + /* voiceDevice0 parameters */ + { + /* Device type */ + BP_VD_ZARLINK_88506, + + /* SPI control */ + { + /* SPI dev id */ + 1, + /* SPI GPIO */ + BP_NOT_DEFINED, + }, + + /* Reset required (1 for yes, 0 for no) */ + 1, + + /* Reset pin */ + BP_GPIO_14_AL, + + /* Channel description */ + { + /* Channel 0 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 0, + 0 + }, + /* Channel 1 on device */ + { BP_VOICE_CHANNEL_ACTIVE, + BP_VCTYPE_SLIC, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_ENDIAN_BIG, + 1, + 1 + }, + } + }, + + /* Always end the device list with BP_NULL_DEVICE_MACRO */ + BP_NULL_DEVICE_MACRO, + }, + + /* Relay control pins */ + { { BP_NOT_DEFINED, BP_NOT_DEFINED } }, + + /* DECT UART control pins */ + { BP_NOT_DEFINED, BP_NOT_DEFINED }, + + /* General-purpose flags */ + ( 0 ) + +}; + + + +static PVOICE_BOARD_PARMS g_VoiceBoardParms[] = +{ &voiceBoard_96816PVWM_LE88276, + &voiceBoard_96816PVWM_SI3226, + &voiceBoard_96816PVWM_LE88506, + &voiceBoard_96816PVWM_LE9530, + 0 +}; + +#endif + + +static PVOICE_BOARD_PARMS g_pCurrentVoiceBp = 0; + +static void bpmemcpy( void* dstptr, const void* srcptr, int size ); +static void bpmemcpy( void* dstptr, const void* srcptr, int size ) +{ + char* dstp = dstptr; + const char* srcp = srcptr; + int i; + for( i=0; i < size; i++ ) + { + *dstp++ = *srcp++; + } +} + +int BpGetVoiceParms( char* pszBoardId, VOICE_BOARD_PARMS* voiceParms ) +{ + int nRet = BP_BOARD_ID_NOT_FOUND; + PVOICE_BOARD_PARMS *ppBp; + + for( ppBp = g_VoiceBoardParms; *ppBp; ppBp++ ) + { + if( !bpstrcmp((*ppBp)->szBoardId, pszBoardId) ) + { + g_pCurrentVoiceBp = *ppBp; + bpmemcpy( voiceParms, g_pCurrentVoiceBp, sizeof(VOICE_BOARD_PARMS) ); + nRet = BP_SUCCESS; + break; + } + } + + return( nRet ); +} + + +/************************************************************************** +* Name : BpSetVoiceBoardId +* +* Description: This function find the BOARD_PARAMETERS structure for the +* specified board id string and assigns it to a global, static +* variable. +* +* Parameters : [IN] pszBoardId - Board id string that is saved into NVRAM. +* +* Returns : BP_SUCCESS - Success, value is returned. +* BP_BOARD_ID_NOT_FOUND - Error, board id input string does not +* have a board parameters configuration record. +***************************************************************************/ +int BpSetVoiceBoardId( char *pszBoardId ) +{ + int nRet = BP_BOARD_ID_NOT_FOUND; + PVOICE_BOARD_PARMS *ppBp; + + for( ppBp = g_VoiceBoardParms; *ppBp; ppBp++ ) + { + if( !bpstrcmp((*ppBp)->szBoardId, pszBoardId) ) + { + g_pCurrentVoiceBp = *ppBp; + nRet = BP_SUCCESS; + break; + } + } + + return( nRet ); +} /* BpSetVoiceBoardId */ + + +/************************************************************************** +* Name : BpGetVoiceBoardId +* +* Description: This function returns the current board id strings. +* +* Parameters : [OUT] pszBoardIds - Address of a buffer that the board id +* string is returned in. +* +* Returns : BP_SUCCESS - Success, value is returned. +***************************************************************************/ + +int BpGetVoiceBoardId( char *pszBoardId ) +{ + int i; + + if (g_pCurrentVoiceBp == 0) + return -1; + + for (i = 0; i < BP_BOARD_ID_LEN; i++) + pszBoardId[i] = g_pCurrentVoiceBp->szBoardId[i]; + + return 0; +} + + +/************************************************************************** +* Name : BpGetVoiceBoardIds +* +* Description: This function returns all of the supported voice board id strings. +* +* Parameters : [OUT] pszBoardIds - Address of a buffer that the board id +* strings are returned in. Each id starts at BP_BOARD_ID_LEN +* boundary. +* [IN] nBoardIdsSize - Number of BP_BOARD_ID_LEN elements that +* were allocated in pszBoardIds. +* +* Returns : Number of board id strings returned. +***************************************************************************/ +int BpGetVoiceBoardIds( char *pszBoardIds, int nBoardIdsSize ) +{ + PVOICE_BOARD_PARMS *ppBp; + int i; + char *src; + char *dest; + + for( i = 0, ppBp = g_VoiceBoardParms; *ppBp && nBoardIdsSize; + i++, ppBp++, nBoardIdsSize--, pszBoardIds += BP_BOARD_ID_LEN ) + { + dest = pszBoardIds; + src = (*ppBp)->szBoardId; + while( *src ) + *dest++ = *src++; + *dest = '\0'; + } + + return( i ); +} /* BpGetVoiceBoardIds */ diff --git a/shared/opensource/flash/Makefile b/shared/opensource/flash/Makefile new file mode 100755 index 0000000..b7a9812 --- /dev/null +++ b/shared/opensource/flash/Makefile @@ -0,0 +1,41 @@ + +ifeq ($(CONFIG_MIPS_BRCM),y) + +# Linux + +obj-y += flash_api.o flash_common.o + +ifeq ($(strip $(BRCM_CHIP)),6368) +INC_CFI_FLASH_DRIVER=1 +INC_SPI_FLASH_DRIVER=1 +endif +ifeq ($(strip $(BRCM_CHIP)),6816) +INC_CFI_FLASH_DRIVER=1 +INC_SPI_FLASH_DRIVER=1 +endif +ifeq ($(strip $(BRCM_CHIP)),6362) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=1 +endif +ifeq ($(strip $(BRCM_CHIP)),6328) +INC_CFI_FLASH_DRIVER=0 +INC_SPI_FLASH_DRIVER=1 +endif + +ifeq ($(strip $(INC_CFI_FLASH_DRIVER)),1) +obj-y += cfiflash.o +endif +ifeq ($(strip $(INC_SPI_FLASH_DRIVER)),1) +obj-y += spiflash.o +endif + +EXTRA_CFLAGS += -DCONFIG_BCM9$(BRCM_CHIP) -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD) -I$(INC_BRCMSHARED_PUB_PATH)/$(BRCM_BOARD) -DINC_CFI_FLASH_DRIVER=$(INC_CFI_FLASH_DRIVER) -DINC_SPI_FLASH_DRIVER=$(INC_SPI_FLASH_DRIVER) + +endif + + + + + + + diff --git a/shared/opensource/flash/cfiflash.c b/shared/opensource/flash/cfiflash.c new file mode 100755 index 0000000..efd08de --- /dev/null +++ b/shared/opensource/flash/cfiflash.c @@ -0,0 +1,1112 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL?, available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/** Includes. */ +#ifdef _CFE_ +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "cfe_timer.h" +#include "bcm_map.h" +#define CFI_USLEEP(x) cfe_usleep(x) +#define printk printf +#else // linux +#include +#include +#include +#include +#include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) +#include +#else +#include +#endif +#include +#include +#define CFI_USLEEP(x) udelay(x) +#endif + +#include "bcmtypes.h" +#include "bcm_hwdefs.h" +#include "flash_api.h" + +/** Defines. **/ +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _CFE_ +static DECLARE_MUTEX(cfi_flash_lock); +#define CF_FLASH_SCHED_BYTES 512 +static int cfi_flash_sched = 0; /* voluntary schedule() disabled by default */ +#endif + +#define MAXSECTORS 1024 /* maximum number of sectors supported */ + +/* Standard Boolean declarations */ +#define TRUE 1 +#define FALSE 0 + +/* Define different type of flash */ +#define FLASH_UNDEFINED 0 +#define FLASH_AMD 1 +#define FLASH_INTEL 2 +#define FLASH_SST 3 + +/* Command codes for the flash_command routine */ +#define FLASH_RESET 0 /* reset to read mode */ +#define FLASH_READ_ID 1 /* read device ID */ +#define FLASH_CFIQUERY 2 /* CFI query */ +#define FLASH_UB 3 /* go into unlock bypass mode */ +#define FLASH_PROG 4 /* program a unsigned short */ +#define FLASH_UBRESET 5 /* reset to read mode from unlock bypass mode */ +#define FLASH_SERASE 6 /* sector erase */ +#define FLASH_WRITE_BUF 7 /* write to buffer */ + +/* Return codes from flash_status */ +#define STATUS_READY 0 /* ready for action */ +#define STATUS_TIMEOUT 1 /* operation timed out */ + +/* A list of AMD compatible device ID's - add others as needed */ +#define ID_AM29DL800T 0x224A +#define ID_AM29DL800B 0x22CB +#define ID_AM29LV800T 0x22DA +#define ID_AM29LV800B 0x225B +#define ID_AM29LV400B 0x22BA +#define ID_AM29LV200BT 0x223B + +#define ID_AM29LV160B 0x2249 +#define ID_AM29LV160T 0x22C4 + +#define ID_AM29LV320T 0x22F6 +#define ID_MX29LV320AT 0x22A7 +#define ID_AM29LV320B 0x22F9 +#define ID_MX29LV320AB 0x22A8 +#define ID_MX29LV640BT 0x22C9 + +#define ID_AM29LV320M 0x227E +#define ID_AM29LV320MB 0x2200 +#define ID_AM29LV320MT 0x2201 + +#define ID_SST39VF200A 0x2789 +#define ID_SST39VF400A 0x2780 +#define ID_SST39VF800A 0x2781 +#define ID_SST39VF1601 0x234B +#define ID_SST39VF3201 0x235B +#define ID_SST39VF6401 0x236B + +/* A list of Intel compatible device ID's - add others as needed */ +#define ID_I28F160C3T 0x88C2 +#define ID_I28F160C3B 0x88C3 +#define ID_I28F320C3T 0x88C4 +#define ID_I28F320C3B 0x88C5 +#define ID_I28F640J3 0x8916 + +#define ID_M29W640FB 0x22FD + +#define CFI_FLASH_DEVICES \ + {{ID_AM29DL800T, "AM29DL800T"}, \ + {ID_AM29DL800B, "AM29DL800B"}, \ + {ID_AM29LV800T, "AM29LV800T"}, \ + {ID_AM29LV800B, "AM29LV800B"}, \ + {ID_AM29LV400B, "AM29LV400B"}, \ + {ID_AM29LV200BT, "AM29LV200BT"}, \ + {ID_AM29LV160B, "AM29LV160B"}, \ + {ID_AM29LV160T, "AM29LV160T"}, \ + {ID_AM29LV320T, "AM29LV320T"}, \ + {ID_MX29LV320AT, "MX29LV320AT"}, \ + {ID_AM29LV320B, "AM29LV320B"}, \ + {ID_MX29LV320AB, "MX29LV320AB"}, \ + {ID_AM29LV320M, "AM29LV320M"}, \ + {ID_AM29LV320MB, "AM29LV320MB"}, \ + {ID_AM29LV320MT, "AM29LV320MT"}, \ + {ID_MX29LV640BT, "MX29LV640BT"}, \ + {ID_SST39VF200A, "SST39VF200A"}, \ + {ID_SST39VF400A, "SST39VF400A"}, \ + {ID_SST39VF800A, "SST39VF800A"}, \ + {ID_SST39VF1601, "SST39VF1601"}, \ + {ID_SST39VF3201, "SST39VF3201"}, \ + {ID_SST39VF6401, "SST39VF6401"}, \ + {ID_I28F160C3T, "I28F160C3T"}, \ + {ID_I28F160C3B, "I28F160C3B"}, \ + {ID_I28F320C3T, "I28F320C3T"}, \ + {ID_I28F320C3B, "I28F320C3B"}, \ + {ID_I28F640J3, "I28F640J3"}, \ + {ID_M29W640FB, "STM29W640FB"}, \ + {0, ""} \ + } + +/** Structs. **/ +/* A structure for identifying a flash part. There is one for each + * of the flash part definitions. We need to keep track of the + * sector organization, the address register used, and the size + * of the sectors. + */ +struct flashinfo { + char *name; /* "Am29DL800T", etc. */ + unsigned long addr; /* physical address, once translated */ + int areg; /* Can be set to zero for all parts */ + int nsect; /* # of sectors -- 19 in LV, 22 in DL */ + int bank1start; /* first sector # in bank 1 */ + int bank2start; /* first sector # in bank 2, if DL part */ + struct { + long size; /* # of bytes in this sector */ + long base; /* offset from beginning of device */ + int bank; /* 1 or 2 for DL; 1 for LV */ + } sec[MAXSECTORS]; /* per-sector info */ + int write_buffer_size; /* max size of multi byte write */ +}; + +/* + * This structure holds all CFI query information as defined + * in the JEDEC standard. All information up to + * primary_extended_query is standard among all manufactures + * with CFI enabled devices. + */ + +struct cfi_query { + int num_erase_blocks; /* Number of sector defs. */ + long device_size; /* Device size in bytes */ + struct { + unsigned long sector_size; /* byte size of sector */ + int num_sectors; /* Num sectors of this size */ + } erase_block[8]; /* Max of 256, but 8 is good */ + int write_buffer_size; /* max size of multi byte write */ +}; + +struct flash_name_from_id { + unsigned short fnfi_id; + char fnfi_name[30]; +}; + + +/** Prototypes. **/ +int cfi_flash_init(flash_device_info_t **flash_info); +static int cfi_flash_sector_erase_int(unsigned short sector); +static int cfi_flash_read_buf(unsigned short sector, int offset, + unsigned char *buffer, int numbytes); +static int cfi_flash_write_buf(unsigned short sector, int offset, + unsigned char *buffer, int numbytes); +static int cfi_flash_get_numsectors(void); +static int cfi_flash_get_sector_size(unsigned short sector); +static unsigned char *cfi_flash_get_memptr(unsigned short sector); +static int cfi_flash_get_blk(int addr); +static int cfi_flash_get_total_size(void); +static void cfi_flash_command(int command, unsigned short sector, int offset, + unsigned short data, unsigned short *); +static int cfi_flash_write(unsigned short sector, int offset, unsigned char *buf, + int nbytes); +static int cfi_flash_write_to_buffer(unsigned short sector, unsigned char *buf); +static int cfi_flash_wait(unsigned short sector, int offset,unsigned short data); +static unsigned short cfi_flash_get_device_id(void); +static int cfi_flash_get_cfi(struct cfi_query *query, unsigned short *cfi_struct, + int flashFamily); +static int cfi_memcmp_sched(unsigned char *s1, unsigned char *s2, int nbytes); + +/** Variables. **/ +static flash_device_info_t flash_cfi_dev = + { + 0xffff, + FLASH_IFC_PARALLEL, + "", + cfi_flash_sector_erase_int, + cfi_flash_read_buf, + cfi_flash_write_buf, + cfi_flash_get_numsectors, + cfi_flash_get_sector_size, + cfi_flash_get_memptr, + cfi_flash_get_blk, + cfi_flash_get_total_size + }; + +/*********************************************************************/ +/* 'meminfo' should be a pointer, but most C compilers will not */ +/* allocate static storage for a pointer without calling */ +/* non-portable functions such as 'new'. We also want to avoid */ +/* the overhead of passing this pointer for every driver call. */ +/* Systems with limited heap space will need to do this. */ +/*********************************************************************/ +static struct flashinfo meminfo; /* Flash information structure */ +static int flashFamily = FLASH_UNDEFINED; +static int totalSize = 0; +static struct cfi_query query; + +static unsigned short cfi_data_struct_29W160[] = { + 0x0020, 0x0049, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x0051, 0x0052, 0x0059, 0x0002, 0x0000, 0x0040, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0027, 0x0036, 0x0000, 0x0000, 0x0004, + 0x0000, 0x000a, 0x0000, 0x0004, 0x0000, 0x0003, 0x0000, 0x0015, + 0x0002, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0040, + 0x0000, 0x0001, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0080, + 0x0000, 0x001e, 0x0000, 0x0000, 0x0001, 0xffff, 0xffff, 0xffff, + 0x0050, 0x0052, 0x0049, 0x0031, 0x0030, 0x0000, 0x0002, 0x0001, + 0x0001, 0x0004, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0002, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x0888, 0x252b, 0x8c84, 0x7dbc, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff +}; + +static UINT16 cfi_data_struct_29W200[] = { + 0x0020, 0x0049, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x0051, 0x0052, 0x0059, 0x0002, 0x0000, 0x0040, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0027, 0x0036, 0x0000, 0x0000, 0x0004, + 0x0000, 0x000a, 0x0000, 0x0004, 0x0000, 0x0003, 0x0000, 0x0015, + 0x0002, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0040, + 0x0000, 0x0001, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0080, + 0x0000, 0x0002, 0x0000, 0x0000, 0x0001, 0xffff, 0xffff, 0xffff, + 0x0050, 0x0052, 0x0049, 0x0031, 0x0030, 0x0000, 0x0002, 0x0001, + 0x0001, 0x0004, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0002, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x0888, 0x252b, 0x8c84, 0x7dbc, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff +}; + +static UINT16 cfi_data_struct_26LV800B[] = { + 0x0020, 0x0049, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x0051, 0x0052, 0x0059, 0x0002, 0x0000, 0x0040, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0027, 0x0036, 0x0000, 0x0000, 0x0004, + 0x0000, 0x000a, 0x0000, 0x0004, 0x0000, 0x0003, 0x0000, 0x0015, + 0x0002, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0040, + 0x0000, 0x0001, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0080, + 0x0000, 0x000e, 0x0000, 0x0000, 0x0001, 0xffff, 0xffff, 0xffff, + 0x0050, 0x0052, 0x0049, 0x0031, 0x0030, 0x0000, 0x0002, 0x0001, + 0x0001, 0x0004, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0002, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x0888, 0x252b, 0x8c84, 0x7dbc, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff +}; + +static struct flash_name_from_id fnfi[] = CFI_FLASH_DEVICES; + +/*********************************************************************/ +/* Init_flash is used to build a sector table from the information */ +/* provided through the CFI query. This information is translated */ +/* from erase_block information to base:offset information for each */ +/* individual sector. This information is then stored in the meminfo */ +/* structure, and used throughout the driver to access sector */ +/* information. */ +/* */ +/* This is more efficient than deriving the sector base:offset */ +/* information every time the memory map switches (since on the */ +/* development platform can only map 64k at a time). If the entire */ +/* flash memory array can be mapped in, then the addition static */ +/* allocation for the meminfo structure can be eliminated, but the */ +/* drivers will have to be re-written. */ +/* */ +/* The meminfo struct occupies 653 bytes of heap space, depending */ +/* on the value of the define MAXSECTORS. Adjust to suit */ +/* application */ +/*********************************************************************/ +int cfi_flash_init(flash_device_info_t **flash_info) +{ + struct flash_name_from_id *fnfi_ptr; + int i=0, j=0, count=0; + int basecount=0L; + unsigned short device_id; + int flipCFIGeometry = FALSE; + + *flash_info = &flash_cfi_dev; + + /* First, assume + * a single 8k sector for sector 0. This is to allow + * the system to perform memory mapping to the device, + * even though the actual physical layout is unknown. + * Once mapped in, the CFI query will produce all + * relevant information. + */ + meminfo.addr = 0L; + meminfo.areg = 0; + meminfo.nsect = 1; + meminfo.bank1start = 0; + meminfo.bank2start = 0; + + meminfo.sec[0].size = 8192; + meminfo.sec[0].base = 0x00000; + meminfo.sec[0].bank = 1; + + cfi_flash_command(FLASH_RESET, 0, 0, 0, NULL); + + flash_cfi_dev.flash_device_id = device_id = cfi_flash_get_device_id(); + flash_cfi_dev.flash_device_name[0] = '\0'; + switch (device_id) { + case ID_I28F160C3B: + case ID_I28F320C3B: + case ID_I28F160C3T: + case ID_I28F320C3T: + case ID_I28F640J3: + flashFamily = FLASH_INTEL; + break; + case ID_AM29DL800B: + case ID_AM29LV800B: + case ID_AM29LV400B: + case ID_AM29LV160B: + case ID_AM29LV320B: + case ID_MX29LV320AB: + case ID_AM29LV320MB: + case ID_AM29DL800T: + case ID_AM29LV800T: + case ID_AM29LV160T: + case ID_AM29LV320T: + case ID_MX29LV320AT: + case ID_AM29LV320MT: + case ID_AM29LV200BT: + case ID_MX29LV640BT: + case ID_M29W640FB: + flashFamily = FLASH_AMD; + break; + case ID_SST39VF200A: + case ID_SST39VF400A: + case ID_SST39VF800A: + case ID_SST39VF1601: + case ID_SST39VF3201: + case ID_SST39VF6401: + flashFamily = FLASH_SST; + break; + default: + return FLASH_API_ERROR; + } + + if (cfi_flash_get_cfi(&query, 0, flashFamily) == -1) { + switch(device_id) { + case ID_AM29LV160T: + case ID_AM29LV160B: + cfi_flash_get_cfi(&query, cfi_data_struct_29W160, flashFamily); + break; + case ID_AM29LV200BT: + cfi_flash_get_cfi(&query, cfi_data_struct_29W200, flashFamily); + break; + case ID_AM29LV800B: + cfi_flash_get_cfi(&query, cfi_data_struct_26LV800B, flashFamily); + strcpy( flash_cfi_dev.flash_device_name, "MX26LV800B" ); + break; + default: + return FLASH_API_ERROR; + } + } + + // need to determine if it top or bottom boot here + switch (device_id) + { + case ID_AM29DL800B: + case ID_AM29LV800B: + case ID_AM29LV400B: + case ID_AM29LV160B: + case ID_AM29LV320B: + case ID_MX29LV320AB: + case ID_AM29LV320MB: + case ID_I28F160C3B: + case ID_I28F320C3B: + case ID_I28F640J3: + case ID_I28F160C3T: + case ID_I28F320C3T: + case ID_SST39VF3201: + case ID_SST39VF6401: + case ID_SST39VF200A: + case ID_SST39VF400A: + case ID_SST39VF800A: + case ID_M29W640FB: + flipCFIGeometry = FALSE; + break; + case ID_AM29DL800T: + case ID_AM29LV800T: + case ID_AM29LV160T: + case ID_AM29LV320T: + case ID_MX29LV320AT: + case ID_AM29LV320MT: + case ID_AM29LV200BT: + case ID_SST39VF1601: + case ID_MX29LV640BT: + flipCFIGeometry = TRUE; + break; + default: + return FLASH_API_ERROR; + } + + count=0;basecount=0L; + + if (!flipCFIGeometry) + { + + for (i=0; i= 0 && basecount < query.device_size; i--) { + for(j=0; jfnfi_id != 0; fnfi_ptr++ ) { + if( fnfi_ptr->fnfi_id == device_id ) { + strcpy( flash_cfi_dev.flash_device_name, fnfi_ptr->fnfi_name ); + break; + } + } + } + + meminfo.write_buffer_size = query.write_buffer_size; + + return (FLASH_API_OK); +} + +/*********************************************************************/ +/* Flash_sector_erase_int() is identical to flash_sector_erase(), */ +/* except it will wait until the erase is completed before returning */ +/* control to the calling function. This can be used in cases which */ +/* require the program to hold until a sector is erased, without */ +/* adding the wait check external to this function. */ +/*********************************************************************/ +static int cfi_flash_sector_erase_int(unsigned short sector) +{ + int i; + +#ifndef _CFE_ + down(&cfi_flash_lock); +#endif + + for( i = 0; i < 3; i++ ) { + cfi_flash_command(FLASH_SERASE, sector, 0, 0, NULL); + if (cfi_flash_wait(sector, 0, 0xffff) == STATUS_READY) + break; + } + +#ifndef _CFE_ + up(&cfi_flash_lock); +#endif + + return(FLASH_API_OK); +} + +/*********************************************************************/ +/* flash_read_buf() reads buffer of data from the specified */ +/* offset from the sector parameter. */ +/*********************************************************************/ +static int cfi_flash_read_buf(unsigned short sector, int offset, + unsigned char *buffer, int numbytes) +{ + unsigned char *fwp; +#ifndef _CFE_ + unsigned int bytes_read = CF_FLASH_SCHED_BYTES; + + down(&cfi_flash_lock); +#endif + + fwp = (unsigned char *) cfi_flash_get_memptr(sector); + + while (numbytes) { + *buffer++ = *(fwp + offset); + numbytes--; + fwp++; +#ifndef _CFE_ + if (!in_interrupt()) { + /* Voluntary schedule() if task tagged as need_sched or 512 bytes read */ + /* Must force need_resched or else schedule() is in-effective */ + if ( cfi_flash_sched ) { + if ( (need_resched()) || (bytes_read >= CF_FLASH_SCHED_BYTES) ) { + bytes_read=0; + set_tsk_need_resched(current); /* fake need_resched() to force schedule() */ + schedule(); + } + else + bytes_read++; + } + } +#endif + } + +#ifndef _CFE_ + up(&cfi_flash_lock); +#endif + + return (FLASH_API_OK); +} + +/*********************************************************************/ +/* cfi_memcmp_sched: invokes memcmp with schedule() invocations */ +/*********************************************************************/ +static int cfi_memcmp_sched(unsigned char *s1, unsigned char *s2, int nb) +{ +#ifndef _CFE_ + const unsigned int sched_chunk = 4 * 1024; + size_t nbytes; + int ret = 0; + + while ( nb > 0 ) + { + if (!in_interrupt()) { + set_tsk_need_resched(current); + schedule(); + } + + nbytes = (nb > sched_chunk) ? sched_chunk : nb; + + if ( (ret = memcmp( s1, s2, nbytes )) != 0 ) + break; + + s1 += sched_chunk; + s2 += sched_chunk; + nb -= sched_chunk; + } + + return ret; +#else + return memcmp( s1, s2, nb ); +#endif +} + +/*********************************************************************/ +/* flash_write_buf() utilizes */ +/* the unlock bypass mode of the flash device. This can remove */ +/* significant overhead from the bulk programming operation, and */ +/* when programming bulk data a sizeable performance increase can be */ +/* observed. */ +/*********************************************************************/ +static int cfi_flash_write_buf(unsigned short sector, int offset, + unsigned char *buffer, int numbytes) +{ + int ret = FLASH_API_ERROR; + int i; + unsigned char *p = cfi_flash_get_memptr(sector) + offset; + int write_buf_method = 0; + + if( meminfo.write_buffer_size != 0 && offset == 0 && + (ID_M29W640FB != cfi_flash_get_device_id()) && + numbytes == cfi_flash_get_sector_size(sector) ) + { + write_buf_method = 1; + } + + /* After writing the flash block, compare the contents to the source + * buffer. Try to write the sector successfully up to three times. + */ + for( i = 0; i < 3; i++ ) { + if( write_buf_method ) + ret = cfi_flash_write_to_buffer(sector, buffer); + else + ret = cfi_flash_write(sector, offset, buffer, numbytes); + if( !cfi_memcmp_sched( p, buffer, numbytes ) ) + break; + /* Erase and try again */ + cfi_flash_sector_erase_int(sector); + ret = FLASH_API_ERROR; + } + + if( ret == FLASH_API_ERROR ) + printk( "Flash write error. Verify failed\n" ); + + return( ret ); +} + +/*********************************************************************/ +/* Usefull funtion to return the number of sectors in the device. */ +/* Can be used for functions which need to loop among all the */ +/* sectors, or wish to know the number of the last sector. */ +/*********************************************************************/ +static int cfi_flash_get_numsectors(void) +{ + return meminfo.nsect; +} + +/*********************************************************************/ +/* flash_get_sector_size() is provided for cases in which the size */ +/* of a sector is required by a host application. The sector size */ +/* (in bytes) is returned in the data location pointed to by the */ +/* 'size' parameter. */ +/*********************************************************************/ +static int cfi_flash_get_sector_size(unsigned short sector) +{ + return meminfo.sec[sector].size; +} + +/*********************************************************************/ +/* The purpose of flash_get_memptr() is to return a memory pointer */ +/* which points to the beginning of memory space allocated for the */ +/* flash. All function pointers are then referenced from this */ +/* pointer. */ +/* */ +/* Different systems will implement this in different ways: */ +/* possibilities include: */ +/* - A direct memory pointer */ +/* - A pointer to a memory map */ +/* - A pointer to a hardware port from which the linear */ +/* address is translated */ +/* - Output of an MMU function / service */ +/* */ +/* Also note that this function expects the pointer to a specific */ +/* sector of the device. This can be provided by dereferencing */ +/* the pointer from a translated offset of the sector from a */ +/* global base pointer (e.g. flashptr = base_pointer + sector_offset)*/ +/* */ +/* Important: Many AMD flash devices need both bank and or sector */ +/* address bits to be correctly set (bank address bits are A18-A16, */ +/* and sector address bits are A18-A12, or A12-A15). Flash parts */ +/* which do not need these bits will ignore them, so it is safe to */ +/* assume that every part will require these bits to be set. */ +/*********************************************************************/ +static unsigned char *cfi_flash_get_memptr(unsigned short sector) +{ + unsigned char *memptr = (unsigned char*) + (FLASH_BASE + meminfo.sec[sector].base); + + return (memptr); +} + +/*********************************************************************/ +/* The purpose of flash_get_blk() is to return a the block number */ +/* for a given memory address. */ +/*********************************************************************/ +static int cfi_flash_get_blk(int addr) +{ + int blk_start, i; + int last_blk = cfi_flash_get_numsectors(); + int relative_addr = addr - (int) FLASH_BASE; + + for(blk_start=0, i=0; i < relative_addr && blk_start < last_blk; blk_start++) + i += cfi_flash_get_sector_size(blk_start); + + if( i > relative_addr ) + { + blk_start--; // last blk, dec by 1 + } + else + if( blk_start == last_blk ) + { + printk("Address is too big.\n"); + blk_start = -1; + } + + return( blk_start ); +} + +/************************************************************************/ +/* The purpose of flash_get_total_size() is to return the total size of */ +/* the flash */ +/************************************************************************/ +static int cfi_flash_get_total_size(void) +{ + return totalSize; +} + +/*********************************************************************/ +/* Flash_command() is the main driver function. It performs */ +/* every possible command available to AMD B revision */ +/* flash parts. Note that this command is not used directly, but */ +/* rather called through the API wrapper functions provided below. */ +/*********************************************************************/ +static void cfi_flash_command(int command, unsigned short sector, int offset, + unsigned short data, unsigned short *dataptr) +{ + volatile unsigned short *flashptr; + volatile unsigned short *flashbase; + unsigned short i, len; + + flashptr = (unsigned short *) cfi_flash_get_memptr(sector); + flashbase = (unsigned short *) cfi_flash_get_memptr(0); + + switch (flashFamily) { + case FLASH_UNDEFINED: + /* These commands should work for AMD, Intel and SST flashes */ + switch (command) { + case FLASH_RESET: + flashptr[0] = 0xF0; + flashptr[0] = 0xFF; + break; + case FLASH_READ_ID: + flashptr[0x5555] = 0xAA; /* unlock 1 */ + flashptr[0x2AAA] = 0x55; /* unlock 2 */ + flashptr[0x5555] = 0x90; + break; + case FLASH_CFIQUERY: + flashbase[0x5555] = 0xAA; /* unlock 1 */ + flashbase[0x2AAA] = 0x55; /* unlock 2 */ + flashbase[0x5555] = 0x90; + break; + default: + break; + } + break; + case FLASH_AMD: + switch (command) { + case FLASH_RESET: + flashptr[0] = 0xF0; + break; + case FLASH_READ_ID: + flashptr[0x555] = 0xAA; /* unlock 1 */ + flashptr[0x2AA] = 0x55; /* unlock 2 */ + flashptr[0x555] = 0x90; + break; + case FLASH_CFIQUERY: + flashptr[0x55] = 0x98; + break; + case FLASH_UB: + flashptr[0x555] = 0xAA; /* unlock 1 */ + flashptr[0x2AA] = 0x55; /* unlock 2 */ + flashptr[0x555] = 0x20; + break; + case FLASH_PROG: + flashptr[0] = 0xA0; + flashptr[offset/2] = data; + break; + case FLASH_UBRESET: + flashptr[0] = 0x90; + flashptr[0] = 0x00; + break; + case FLASH_SERASE: + flashptr[0x555] = 0xAA; /* unlock 1 */ + flashptr[0x2AA] = 0x55; /* unlock 2 */ + flashptr[0x555] = 0x80; + flashptr[0x555] = 0xAA; + flashptr[0x2AA] = 0x55; + flashptr[0] = 0x30; + break; + case FLASH_WRITE_BUF: + flashptr[0x555] = 0xAA; /* unlock 1 */ + flashptr[0x2AA] = 0x55; /* unlock 2 */ + flashptr[0] = 0x25; + offset /= 2; + len = data / 2; /* data is bytes to program */ + flashptr[0] = len - 1; + for( i = 0; i < len; i++ ) + flashptr[offset + i] = *dataptr++; + flashptr[0] = 0x29; + break; + default: + break; + } + break; + case FLASH_INTEL: + switch (command) { + case FLASH_RESET: + flashptr[0] = 0xFF; + break; + case FLASH_READ_ID: + flashptr[0] = 0x90; + break; + case FLASH_CFIQUERY: + flashptr[0] = 0x98; + break; + case FLASH_PROG: + flashptr[0] = 0x40; + flashptr[offset/2] = data; + break; + case FLASH_SERASE: + flashptr[0] = 0x60; + flashptr[0] = 0xD0; + flashptr[0] = 0x20; + flashptr[0] = 0xD0; + break; + default: + break; + } + break; + case FLASH_SST: + switch (command) { + case FLASH_RESET: + flashbase[0x5555] = 0xAA; /* unlock 1 */ + flashbase[0x2AAA] = 0x55; /* unlock 2 */ + flashbase[0x5555] = 0xf0; + break; + case FLASH_READ_ID: + flashbase[0x5555] = 0xAA; /* unlock 1 */ + flashbase[0x2AAA] = 0x55; /* unlock 2 */ + flashbase[0x5555] = 0x90; + break; + case FLASH_CFIQUERY: + flashbase[0x5555] = 0xAA; /* unlock 1 */ + flashbase[0x2AAA] = 0x55; /* unlock 2 */ + flashbase[0x5555] = 0x98; + break; + case FLASH_UB: + break; + case FLASH_PROG: + flashbase[0x5555] = 0xAA; /* unlock 1 */ + flashbase[0x2AAA] = 0x55; /* unlock 2 */ + flashbase[0x5555] = 0xa0; + flashptr[offset/2] = data; + break; + case FLASH_UBRESET: + break; + case FLASH_SERASE: + flashbase[0x5555] = 0xAA; /* unlock 1 */ + flashbase[0x2AAA] = 0x55; /* unlock 2 */ + flashbase[0x5555] = 0x80; + flashbase[0x5555] = 0xAA; + flashbase[0x2AAA] = 0x55; + flashptr[0] = 0x30; + break; + default: + break; + } + break; + default: + break; + } +} + +/*********************************************************************/ +/* flash_write extends the functionality of flash_program() by */ +/* providing an faster way to program multiple data words, without */ +/* needing the function overhead of looping algorithms which */ +/* program word by word. This function utilizes fast pointers */ +/* to quickly loop through bulk data. */ +/*********************************************************************/ +static int cfi_flash_write(unsigned short sector, int offset, unsigned char *buf, + int nbytes) +{ + unsigned short *src; + src = (unsigned short *)buf; + +#ifndef _CFE_ + down(&cfi_flash_lock); +#endif + + if ((nbytes | offset) & 1) { +#ifndef _CFE_ + up(&cfi_flash_lock); +#endif + return FLASH_API_ERROR; + } + + cfi_flash_command(FLASH_UB, 0, 0, 0, NULL); + while (nbytes > 0) { + cfi_flash_command(FLASH_PROG, sector, offset, *src, NULL); + if (cfi_flash_wait(sector, offset, *src) != STATUS_READY) + break; + offset +=2; + nbytes -=2; + src++; + } + cfi_flash_command(FLASH_UBRESET, 0, 0, 0, NULL); + +#ifndef _CFE_ + up(&cfi_flash_lock); +#endif + + return (unsigned char*)src - buf; +} + +/*********************************************************************/ +/* flash_write_to_buffer */ +/*********************************************************************/ +static int cfi_flash_write_to_buffer(unsigned short sector, unsigned char *buf) +{ + int nbytes = cfi_flash_get_sector_size(sector); + int offset; + +#ifndef _CFE_ + down(&cfi_flash_lock); +#endif + + for( offset = 0; offset < nbytes; offset += meminfo.write_buffer_size ) { + cfi_flash_command(FLASH_WRITE_BUF, sector, offset, (unsigned short) + meminfo.write_buffer_size, (unsigned short *) &buf[offset]); + if (cfi_flash_wait(sector, 0, 0) != STATUS_READY) + break; + } + +#ifndef _CFE_ + up(&cfi_flash_lock); +#endif + + return offset; +} + +/*********************************************************************/ +/* flash_wait utilizes the DQ6, DQ5, and DQ2 polling algorithms */ +/* described in the flash data book. It can quickly ascertain the */ +/* operational status of the flash device, and return an */ +/* appropriate status code (defined in flash.h) */ +/*********************************************************************/ +static int cfi_flash_wait(unsigned short sector, int offset, unsigned short data) +{ + volatile unsigned short *flashptr; /* flash window */ + unsigned short d1; + + flashptr = (unsigned short *) cfi_flash_get_memptr(sector); + + if (flashFamily == FLASH_AMD || flashFamily == FLASH_SST) { + do { +#ifndef _CFE_ + if (!in_interrupt()) { + set_tsk_need_resched(current); /* fake need_resched() to force schedule() */ + schedule(); + } +#endif + d1 = *flashptr; /* read data */ + d1 ^= *flashptr; /* read it again and see what toggled */ + if (d1 == 0) /* no toggles, nothing's happening */ + return STATUS_READY; + } while (!(d1 & 0x20)); + + d1 = *flashptr; /* read data */ + d1 ^= *flashptr; /* read it again and see what toggled */ + + if (d1 != 0) { + cfi_flash_command(FLASH_RESET, 0, 0, 0, NULL); + return STATUS_TIMEOUT; + } + } else if (flashFamily == FLASH_INTEL) { + flashptr[0] = 0x70; + /* Wait for completion */ + + do { +#ifndef _CFE_ + if (!in_interrupt()) { + set_tsk_need_resched(current); /* fake need_resched() to force schedule() */ + schedule(); + } +#endif + } while (!(*flashptr & 0x80)); + if (*flashptr & 0x30) { + flashptr[0] = 0x50; + cfi_flash_command(FLASH_RESET, 0, 0, 0, NULL); + return STATUS_TIMEOUT; + } + flashptr[0] = 0x50; + cfi_flash_command(FLASH_RESET, 0, 0, 0, NULL); + } + + return STATUS_READY; +} + +/*********************************************************************/ +/* flash_get_device_id() will perform an autoselect sequence on the */ +/* flash device, and return the device id of the component. */ +/* This function automatically resets to read mode. */ +/*********************************************************************/ +static unsigned short cfi_flash_get_device_id(void) +{ + volatile unsigned short *fwp; /* flash window */ + unsigned short answer; + + fwp = (unsigned short *) cfi_flash_get_memptr(0); + + cfi_flash_command(FLASH_READ_ID, 0, 0, 0, NULL); + answer = *(fwp + 1); + if (answer == ID_AM29LV320M) { + answer = *(fwp + 0xe); + answer = *(fwp + 0xf); + } + + cfi_flash_command(FLASH_RESET, 0, 0, 0, NULL); + return( (unsigned short) answer ); +} + +/*********************************************************************/ +/* flash_get_cfi() is the main CFI workhorse function. Due to it's */ +/* complexity and size it need only be called once upon */ +/* initializing the flash system. Once it is called, all operations */ +/* are performed by looking at the meminfo structure. */ +/* All possible care was made to make this algorithm as efficient as */ +/* possible. 90% of all operations are memory reads, and all */ +/* calculations are done using bit-shifts when possible */ +/*********************************************************************/ +static int cfi_flash_get_cfi(struct cfi_query *query, unsigned short *cfi_struct, + int flashFamily) +{ + volatile unsigned short *fwp; /* flash window */ + int i=0, temp=0; + + cfi_flash_command(FLASH_CFIQUERY, 0, 0, 0, NULL); + + if (cfi_struct == 0) + fwp = (unsigned short *) cfi_flash_get_memptr(0); + else + fwp = cfi_struct; + + /* Initial house-cleaning */ + for(i=0; i < 8; i++) { + query->erase_block[i].sector_size = 0; + query->erase_block[i].num_sectors = 0; + } + + /* If not 'QRY', then we dont have a CFI enabled device in the socket */ + if( fwp[0x10] != 'Q' && + fwp[0x11] != 'R' && + fwp[0x12] != 'Y') { + cfi_flash_command(FLASH_RESET, 0, 0, 0, NULL); + return(FLASH_API_ERROR); + } + + temp = fwp[0x27]; + query->device_size = (int) (((int)1) << temp); + + query->num_erase_blocks = fwp[0x2C]; + if(flashFamily == FLASH_SST) + query->num_erase_blocks = 1; + + for(i=0; i < query->num_erase_blocks; i++) { + query->erase_block[i].num_sectors = + fwp[(0x2D+(4*i))] + (fwp[0x2E + (4*i)] << 8); + query->erase_block[i].num_sectors++; + query->erase_block[i].sector_size = + 256 * (256 * fwp[(0x30+(4*i))] + fwp[(0x2F+(4*i))]); + } + + /* TBD. Add support for other flash families. */ + if(flashFamily == FLASH_AMD) + query->write_buffer_size = (1 << fwp[0x2a]); + else + query->write_buffer_size = 0; + + cfi_flash_command(FLASH_RESET, 0, 0, 0, NULL); + return(FLASH_API_OK); +} + +#ifndef _CFE_ +static int __init cfi_flash_sched_init(void) { + cfi_flash_sched = 1; /* voluntary schedule() enabled */ + return 0; +} +late_initcall(cfi_flash_sched_init); +#endif diff --git a/shared/opensource/flash/flash_api.c b/shared/opensource/flash/flash_api.c new file mode 100755 index 0000000..5b0ca76 --- /dev/null +++ b/shared/opensource/flash/flash_api.c @@ -0,0 +1,350 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL?, available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/*************************************************************************** + * File Name : flash_api.c + * + * Description: This file contains the implementation of the wrapper functions + * for the flash device interface. + ***************************************************************************/ + +/** Includes. */ +#ifdef _CFE_ +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "bcm_map.h" +#define printk printf +#else // Linux +#include +#include "bcm_map_part.h" +#endif + +#include "bcmtypes.h" +#include "bcm_hwdefs.h" +#include "flash_api.h" + +/** Externs. **/ +#if !defined(INC_CFI_FLASH_DRIVER) +#define INC_CFI_FLASH_DRIVER 0 +#endif + +#if !defined(INC_SPI_FLASH_DRIVER) +#define INC_SPI_FLASH_DRIVER 0 +#endif + +#if !defined(INC_NAND_FLASH_DRIVER) +#define INC_NAND_FLASH_DRIVER 0 +#endif + +#if !defined(INC_SPI_PROG_NAND) +#define INC_SPI_PROG_NAND 0 +#endif + +#if (INC_CFI_FLASH_DRIVER==1) +extern int cfi_flash_init(flash_device_info_t **flash_info); +#else +#define cfi_flash_init(x) FLASH_API_ERROR +#endif + +#if (INC_SPI_FLASH_DRIVER==1) +extern int spi_flash_init(flash_device_info_t **flash_info); +#else +#define spi_flash_init(x) FLASH_API_ERROR +#endif + +#if (INC_NAND_FLASH_DRIVER==1) || (INC_SPI_PROG_NAND==1) +extern int nand_flash_init(flash_device_info_t **flash_info); +#else +#define nand_flash_init(x) FLASH_API_ERROR +#endif + +/** Variables. **/ +static flash_device_info_t *g_flash_info = NULL; +#if (INC_SPI_PROG_NAND==1) +static flash_device_info_t *g_nand_flash_info = NULL; +static flash_device_info_t *g_spi_flash_info = NULL; +#endif + +/*************************************************************************** + * Function Name: display_flash_info + * Description : Displays information about the flash part. + * Returns : None. + ***************************************************************************/ +static void display_flash_info(int ret, flash_device_info_t *flash_info) +{ + switch (flash_info->flash_type) { + case FLASH_IFC_PARALLEL: + printk( "Parallel flash device"); + break; + + case FLASH_IFC_SPI: + printk( "Serial flash device"); + break; + + case FLASH_IFC_HS_SPI: + printk( "HS Serial flash device"); + break; + + case FLASH_IFC_NAND: + printk( "NAND flash device"); + break; + } + + if( ret == FLASH_API_OK ) { + printk(": name %s, id 0x%4.4x", + flash_info->flash_device_name, flash_info->flash_device_id); +#if (INC_SPI_PROG_NAND==1) + printk(" block %dKB", flash_info->fn_flash_get_sector_size(0) / 1024); + printk(" size %dKB", (*flash_info->fn_flash_get_total_size) () / 1024); +#else + if (flash_info->flash_type == FLASH_IFC_NAND) + printk(" block %dKB", flash_get_sector_size(0) / 1024); + printk(" size %dKB", flash_get_total_size() / 1024); +#endif + printk("\n"); + } + else { + printk( " id %4.4x is not supported.\n", flash_info->flash_device_id ); + } +} /* display_flash_info */ + +/*************************************************************************** + * Function Name: flash_init + * Description : Initialize flash part. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +int flash_init(void) +{ + int type = FLASH_IFC_UNKNOWN; + int ret = FLASH_API_ERROR; +#if (INC_SPI_PROG_NAND==1) + int ret_nand = FLASH_API_ERROR; +#endif + + /* If available, use bootstrap to decide which flash to use */ +#if defined(_BCM96816_) || defined(CONFIG_BCM96816) || defined(_BCM96368_) || defined(CONFIG_BCM96368) + unsigned int bootsel; +#if defined(_BCM96816_) || defined(CONFIG_BCM96816) + bootsel = MISC->miscStrapBus; +#elif defined(_BCM96368_) || defined(CONFIG_BCM96368) + bootsel = GPIO->StrapBus; +#endif + switch ((bootsel & MISC_STRAP_BUS_BOOT_SEL_MASK)>>MISC_STRAP_BUS_BOOT_SEL_SHIFT) { + case MISC_STRAP_BUS_BOOT_PARALLEL: + type = FLASH_IFC_PARALLEL; + break; + + case MISC_STRAP_BUS_BOOT_SERIAL: + type = FLASH_IFC_SPI; + break; + + case MISC_STRAP_BUS_BOOT_NAND: + type = FLASH_IFC_NAND; + break; + + } +#elif defined(_BCM96362_) || defined(CONFIG_BCM96362) || defined(_BCM96328_) || defined(CONFIG_BCM96328) + if( ((MISC->miscStrapBus & MISC_STRAP_BUS_BOOT_SEL_MASK) >> + MISC_STRAP_BUS_BOOT_SEL_SHIFT) == MISC_STRAP_BUS_BOOT_SERIAL ) + type = FLASH_IFC_SPI; + else + type = FLASH_IFC_NAND; +#endif + + switch (type) { + case FLASH_IFC_PARALLEL: + ret = cfi_flash_init( &g_flash_info ); + break; + + case FLASH_IFC_SPI: + ret = spi_flash_init( &g_flash_info ); +#if (INC_SPI_PROG_NAND==1) + ret_nand = nand_flash_init( &g_nand_flash_info ); +#endif + + break; + + case FLASH_IFC_NAND: + ret = nand_flash_init( &g_flash_info ); + break; + + case FLASH_IFC_UNKNOWN: + /* Try to detect flash chips, give priority to parallel flash */ + /* Our reference design has both, and we usually use parallel. */ + ret = cfi_flash_init( &g_flash_info ); + if (ret != FLASH_API_OK) { + ret = spi_flash_init( &g_flash_info ); + } + break; + } + + if (g_flash_info != NULL) { + display_flash_info(ret, g_flash_info); +#if (INC_SPI_PROG_NAND==1) + display_flash_info(ret_nand, g_nand_flash_info ); +#endif + } + else { + printk( "BCM Flash API. Flash device is not found.\n" ); + } + + return( ret ); +} /* flash_init */ + +/*************************************************************************** + * Function Name: flash_sector_erase_int + * Description : Erase the specfied flash sector. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +int flash_sector_erase_int(unsigned short sector) +{ + return( (g_flash_info) + ? (*g_flash_info->fn_flash_sector_erase_int) (sector) + : FLASH_API_ERROR ); +} /* flash_sector_erase_int */ + +/*************************************************************************** + * Function Name: flash_read_buf + * Description : Reads from flash memory. + * Returns : number of bytes read or FLASH_API_ERROR + ***************************************************************************/ +int flash_read_buf(unsigned short sector, int offset, unsigned char *buffer, + int numbytes) +{ + return( (g_flash_info) + ? (*g_flash_info->fn_flash_read_buf) (sector, offset, buffer, numbytes) + : FLASH_API_ERROR ); +} /* flash_read_buf */ + +/*************************************************************************** + * Function Name: flash_write_buf + * Description : Writes to flash memory. + * Returns : number of bytes written or FLASH_API_ERROR + ***************************************************************************/ +int flash_write_buf(unsigned short sector, int offset, unsigned char *buffer, + int numbytes) +{ + return( (g_flash_info) + ? (*g_flash_info->fn_flash_write_buf) (sector, offset, buffer, numbytes) + : FLASH_API_ERROR ); +} /* flash_write_buf */ + +/*************************************************************************** + * Function Name: flash_get_numsectors + * Description : Returns the number of sectors in the flash device. + * Returns : Number of sectors in the flash device. + ***************************************************************************/ +int flash_get_numsectors(void) +{ + return( (g_flash_info) + ? (*g_flash_info->fn_flash_get_numsectors) () + : FLASH_API_ERROR ); +} /* flash_get_numsectors */ + +/*************************************************************************** + * Function Name: flash_get_sector_size + * Description : Returns the number of bytes in the specfied flash sector. + * Returns : Number of bytes in the specfied flash sector. + ***************************************************************************/ +int flash_get_sector_size(unsigned short sector) +{ + return( (g_flash_info) + ? (*g_flash_info->fn_flash_get_sector_size) (sector) + : FLASH_API_ERROR ); +} /* flash_get_sector_size */ + +/*************************************************************************** + * Function Name: flash_get_memptr + * Description : Returns the base MIPS memory address for the specfied flash + * sector. + * Returns : Base MIPS memory address for the specfied flash sector. + ***************************************************************************/ +unsigned char *flash_get_memptr(unsigned short sector) +{ + return( (g_flash_info) + ? (*g_flash_info->fn_flash_get_memptr) (sector) + : NULL ); +} /* flash_get_memptr */ + +/*************************************************************************** + * Function Name: flash_get_blk + * Description : Returns the flash sector for the specfied MIPS address. + * Returns : Flash sector for the specfied MIPS address. + ***************************************************************************/ +int flash_get_blk(int addr) +{ + return( (g_flash_info) + ? (*g_flash_info->fn_flash_get_blk) (addr) + : FLASH_API_ERROR ); +} /* flash_get_blk */ + +/*************************************************************************** + * Function Name: flash_get_total_size + * Description : Returns the number of bytes in the flash device. + * Returns : Number of bytes in the flash device. + ***************************************************************************/ +int flash_get_total_size(void) +{ + return( (g_flash_info) + ? (*g_flash_info->fn_flash_get_total_size) () + : FLASH_API_ERROR ); +} /* flash_get_total_size */ + +/*************************************************************************** + * Function Name: flash_get_flash_type + * Description : Returns type of the flash memory. + * Returns : Type of the flash memory. + ***************************************************************************/ +int flash_get_flash_type(void) +{ + return( (g_flash_info) + ? (g_flash_info->flash_type) + : FLASH_API_ERROR ); +} /* flash_get_flash_type */ + +#if (INC_SPI_PROG_NAND==1) +/*************************************************************************** + * Function Name: flash_change_flash_type + * Description : change type of the flash memory. + * Returns : none + ***************************************************************************/ +void flash_change_flash_type(int type) +{ + + if (type == FLASH_IFC_NAND) + { + if (g_spi_flash_info == NULL) + g_spi_flash_info = g_flash_info; + g_flash_info = g_nand_flash_info; + } + else + { + if (g_spi_flash_info != NULL) + g_flash_info = g_spi_flash_info; + } +} /* flash_change_flash_type */ + +#endif + diff --git a/shared/opensource/flash/flash_common.c b/shared/opensource/flash/flash_common.c new file mode 100755 index 0000000..0d4a75d --- /dev/null +++ b/shared/opensource/flash/flash_common.c @@ -0,0 +1,280 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/*!\file flash_common.c + * \brief This file contains NOR flash related functions used by both + * CFE and kernel. + * + */ + +/** Includes. */ +#ifdef _CFE_ +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "bcm_map.h" +#define printk printf +#else // Linux +#include +#include "bcm_map_part.h" +#endif + +#include "bcmtypes.h" +#include "bcm_hwdefs.h" +#include "flash_api.h" +#include "flash_common.h" + +// #define DEBUG_FLASH + +void flash_init_info(const NVRAM_DATA *nvRam, FLASH_ADDR_INFO *fInfo) +{ + int i = 0; + int totalBlks = 0; + int totalSize = 0; + int psiStartAddr = 0; + int spStartAddr = 0; + int usedBlkSize = 0; + int needBytes = 0; + + if (flash_get_flash_type() == FLASH_IFC_NAND) + { + /* When using NAND flash disable Bcm_flash */ + totalSize = 0; + } + else { + totalBlks = flash_get_numsectors(); + totalSize = flash_get_total_size(); + printk("Total Flash size: %dK with %d sectors\n", totalSize/1024, totalBlks); + } + + if (totalSize <= FLASH_LENGTH_BOOT_ROM) { + /* NAND flash settings. NAND flash does not use raw flash partitioins + * to store psi, backup psi, scratch pad and syslog. These data items + * are stored as files on a JFFS2 file system. + */ + if ((nvRam->ulPsiSize != -1) && (nvRam->ulPsiSize != 0)) + fInfo->flash_persistent_length = nvRam->ulPsiSize * ONEK; + else + fInfo->flash_persistent_length = DEFAULT_PSI_SIZE * ONEK; + + fInfo->flash_persistent_start_blk = 0; + fInfo->flash_rootfs_start_offset = 0; + fInfo->flash_scratch_pad_length = SP_MAX_LEN; + fInfo->flash_syslog_length = nvRam->ulSyslogSize * 1024; + + /* This is a boolean field for NAND flash. */ + fInfo->flash_backup_psi_number_blk = nvRam->backupPsi; + return; + } + + /* + * calculate mandatory primary PSI size and set its fInfo parameters. + */ + if ((nvRam->ulPsiSize != -1) && (nvRam->ulPsiSize != 0)) + fInfo->flash_persistent_length = nvRam->ulPsiSize * ONEK; + else + fInfo->flash_persistent_length = DEFAULT_PSI_SIZE * ONEK; + + psiStartAddr = totalSize - fInfo->flash_persistent_length; + fInfo->flash_persistent_start_blk = flash_get_blk(FLASH_BASE+psiStartAddr); + fInfo->flash_persistent_number_blk = totalBlks - fInfo->flash_persistent_start_blk; + + usedBlkSize = 0; + for (i = fInfo->flash_persistent_start_blk; + i < (fInfo->flash_persistent_start_blk + fInfo->flash_persistent_number_blk); i++) + { + usedBlkSize += flash_get_sector_size((unsigned short) i); + } + fInfo->flash_persistent_blk_offset = usedBlkSize - fInfo->flash_persistent_length; + fInfo->flash_meta_start_blk = fInfo->flash_persistent_start_blk; + + /* + * Next is the optional scratch pad, which is on top of the primary PSI. + * Old code allowed scratch pad to share a sector with primary PSI. + * That is retained for backward compatibility. (Although depending on your + * NOR flash sector sizes, they may still be in different sectors.) + * If you have a new deployment, consider forcing separate sectors. + */ + if ((fInfo->flash_persistent_blk_offset > 0) && + (fInfo->flash_persistent_blk_offset < SP_MAX_LEN)) + { + /* + * there is some room left in the first persistent sector, but it is + * not big enough for the scratch pad. (Use this line unconditionally + * if you want to guarentee scratch pad and primary PSI are on different + * sectors.) + */ + spStartAddr = psiStartAddr - fInfo->flash_persistent_blk_offset - SP_MAX_LEN; + } + else + { + /* either the primary PSI starts on a sector boundary, or there is + * enough room at the top of the first sector for the scratch pad. */ + spStartAddr = psiStartAddr - SP_MAX_LEN ; + } + + fInfo->flash_scratch_pad_start_blk = flash_get_blk(FLASH_BASE+spStartAddr); + fInfo->flash_scratch_pad_length = SP_MAX_LEN; + + if (fInfo->flash_persistent_start_blk == fInfo->flash_scratch_pad_start_blk) // share blk + { +#if 0 /* do not used scratch pad unless it's in its own sector */ + printk("Scratch pad is not used for this flash part.\n"); + fInfo->flash_scratch_pad_length = 0; // no sp +#else /* allow scratch pad to share a sector with another section such as PSI */ + fInfo->flash_scratch_pad_number_blk = 1; + fInfo->flash_scratch_pad_blk_offset = fInfo->flash_persistent_blk_offset - fInfo->flash_scratch_pad_length; +#endif + } + else // on different blk + { + fInfo->flash_scratch_pad_number_blk = fInfo->flash_persistent_start_blk - fInfo->flash_scratch_pad_start_blk; + // find out the offset in the start_blk + usedBlkSize = 0; + for (i = fInfo->flash_scratch_pad_start_blk; + i < (fInfo->flash_scratch_pad_start_blk + fInfo->flash_scratch_pad_number_blk); i++) + usedBlkSize += flash_get_sector_size((unsigned short) i); + fInfo->flash_scratch_pad_blk_offset = usedBlkSize - fInfo->flash_scratch_pad_length; + } + + if (fInfo->flash_scratch_pad_length > 0) { + + fInfo->flash_meta_start_blk = fInfo->flash_scratch_pad_start_blk; + } + + /* + * Next is the optional backup PSI. + */ + if (nvRam->backupPsi == 0x01) + { + needBytes = fInfo->flash_persistent_length; + i = fInfo->flash_meta_start_blk; + while (needBytes > 0) + { + i--; + needBytes -= flash_get_sector_size((unsigned short) i); + } + fInfo->flash_backup_psi_start_blk = i; + /* calclate how many blocks we actually consumed */ + needBytes = fInfo->flash_persistent_length; + fInfo->flash_backup_psi_number_blk = 0; + while (needBytes > 0) + { + needBytes -= flash_get_sector_size((unsigned short) i); + i++; + fInfo->flash_backup_psi_number_blk++; + } + + fInfo->flash_meta_start_blk = fInfo->flash_backup_psi_start_blk; + } + else + { + fInfo->flash_backup_psi_number_blk = 0; + } + + /* + * Next is the optional persistent syslog. + */ + if (nvRam->ulSyslogSize != 0 && nvRam->ulSyslogSize != -1) + { + fInfo->flash_syslog_length = nvRam->ulSyslogSize * 1024; + needBytes = fInfo->flash_syslog_length; + i = fInfo->flash_meta_start_blk; + while (needBytes > 0) + { + i--; + needBytes -= flash_get_sector_size((unsigned short) i); + } + fInfo->flash_syslog_start_blk = i; + /* calclate how many blocks we actually consumed */ + needBytes = fInfo->flash_syslog_length; + fInfo->flash_syslog_number_blk = 0; + while (needBytes > 0) + { + needBytes -= flash_get_sector_size((unsigned short) i); + i++; + fInfo->flash_syslog_number_blk++; + } + + fInfo->flash_meta_start_blk = fInfo->flash_syslog_start_blk; + } + else + { + fInfo->flash_syslog_length = 0; + fInfo->flash_syslog_number_blk = 0; + } + +#ifdef DEBUG_FLASH_TOO_MUCH + /* dump sizes of all sectors in flash */ + for (i=0; iflash_rootfs_start_offset =0x%08x\n\n", (unsigned int)fInfo->flash_rootfs_start_offset); + + printk("fInfo->flash_meta_start_blk = %d\n\n", fInfo->flash_meta_start_blk); + + printk("fInfo->flash_syslog_start_blk = %d\n", fInfo->flash_syslog_start_blk); + printk("fInfo->flash_syslog_number_blk = %d\n", fInfo->flash_syslog_number_blk); + printk("fInfo->flash_syslog_length=0x%x\n\n", (unsigned int)fInfo->flash_syslog_length); + + printk("fInfo->flash_backup_psi_start_blk = %d\n", fInfo->flash_backup_psi_start_blk); + printk("fInfo->flash_backup_psi_number_blk = %d\n\n", fInfo->flash_backup_psi_number_blk); + + printk("sp startAddr = %x\n", (unsigned int) (FLASH_BASE+spStartAddr)); + printk("fInfo->flash_scratch_pad_start_blk = %d\n", fInfo->flash_scratch_pad_start_blk); + printk("fInfo->flash_scratch_pad_number_blk = %d\n", fInfo->flash_scratch_pad_number_blk); + printk("fInfo->flash_scratch_pad_length = 0x%x\n", fInfo->flash_scratch_pad_length); + printk("fInfo->flash_scratch_pad_blk_offset = 0x%x\n\n", (unsigned int)fInfo->flash_scratch_pad_blk_offset); + + printk("psi startAddr = %x\n", (unsigned int) (FLASH_BASE+psiStartAddr)); + printk("fInfo->flash_persistent_start_blk = %d\n", fInfo->flash_persistent_start_blk); + printk("fInfo->flash_persistent_number_blk = %d\n", fInfo->flash_persistent_number_blk); + printk("fInfo->flash_persistent_length=0x%x\n", (unsigned int)fInfo->flash_persistent_length); + printk("fInfo->flash_persistent_blk_offset = 0x%x\n\n", (unsigned int)fInfo->flash_persistent_blk_offset); +#endif +} + +unsigned int flash_get_reserved_bytes_at_end(const FLASH_ADDR_INFO *fInfo) +{ + unsigned int reserved=0; + int i = fInfo->flash_meta_start_blk; + int totalBlks = flash_get_numsectors(); + + while (i < totalBlks) + { + reserved += flash_get_sector_size((unsigned short) i); + i++; + } + +#if defined(DEBUG_FLASH) + printk("reserved at bottom=%dKB\n", reserved/1024); +#endif + + return reserved; +} + diff --git a/shared/opensource/flash/nandflash.c b/shared/opensource/flash/nandflash.c new file mode 100755 index 0000000..b90ad7b --- /dev/null +++ b/shared/opensource/flash/nandflash.c @@ -0,0 +1,1260 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL?, available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/*************************************************************************** + * File Name : nandflash.c + * + * Description: This file implements the Broadcom DSL defined flash api for + * for NAND flash parts. + ***************************************************************************/ + +/** Includes. **/ + +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "lib_malloc.h" +#include "bcm_map.h" +#include "bcmtypes.h" +#include "bcm_hwdefs.h" +#include "flash_api.h" +#include "jffs2.h" +#if defined(CFG_RAMAPP) && (INC_SPI_FLASH_DRIVER==1) +#include "cfe_timer.h" +#endif + +/* for debugging in jtag */ +#if !defined(CFG_RAMAPP) +#define static +#endif + + +/** Defines. **/ + +#define NR_OOB_SCAN_PAGES 4 +#define SPARE_MAX_SIZE 64 +#define PAGE_MAX_SIZE 2048 +#define CTRLR_SPARE_SIZE 16 +#define CTRLR_CACHE_SIZE 512 + +/* Flash manufacturers. */ +#define FLASHTYPE_SAMSUNG 0xec +#define FLASHTYPE_ST 0x20 +#define FLASHTYPE_MICRON 0x2c + +/* Samsung flash parts. */ +#define SAMSUNG_K9F5608U0A 0x55 + +/* ST flash parts. */ +#define ST_NAND512W3A2CN6 0x76 +#define ST_NAND01GW3B2CN6 0xf1 + +/* Micron flash parts. */ +#define MICRON_MT29F1G08AAC 0xf1 + +/* Flash id to name mapping. */ +#define NAND_MAKE_ID(A,B) \ + (((unsigned short) (A) << 8) | ((unsigned short) B & 0xff)) + +#define NAND_FLASH_DEVICES \ + {{NAND_MAKE_ID(FLASHTYPE_SAMSUNG,SAMSUNG_K9F5608U0A),"Samsung K9F5608U0"}, \ + {NAND_MAKE_ID(FLASHTYPE_ST,ST_NAND512W3A2CN6),"ST NAND512W3A2CN6"}, \ + {NAND_MAKE_ID(FLASHTYPE_ST,ST_NAND01GW3B2CN6),"ST NAND01GW3B2CN6"}, \ + {NAND_MAKE_ID(FLASHTYPE_MICRON,MICRON_MT29F1G08AAC),"Micron MT29F1G08AAC"},\ + {0,""} \ + } + +/* One byte for small page NAND flash parts. */ +#define SPARE_SP_BI_INDEX_1 5 +#define SPARE_SP_BI_INDEX_2 5 + +/* Two bytes for small page NAND flash parts. */ +#define SPARE_LP_BI_INDEX_1 0 +#define SPARE_LP_BI_INDEX_2 1 + +#define SPARE_BI_MARKER 0 +#define SPARE_BI_ECC_MASK \ + {0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0} + +#define JFFS2_CLEANMARKER {JFFS2_MAGIC_BITMASK, \ + JFFS2_NODETYPE_CLEANMARKER, 0x0000, 0x0008} + +#undef DEBUG_NAND +#if defined(DEBUG_NAND) && defined(CFG_RAMAPP) +#define DBG_PRINTF printf +#else +#define DBG_PRINTF(...) +#endif + + +/** Externs. **/ + +extern void board_setleds(unsigned long); + + +/** Structs. **/ + +typedef struct CfeNandChip +{ + char *chip_name; + unsigned long chip_device_id; + unsigned long chip_base; + unsigned long chip_total_size; + unsigned long chip_block_size; + unsigned long chip_page_size; + unsigned long chip_spare_size; + unsigned char *chip_spare_mask; + unsigned long chip_bi_index_1; + unsigned long chip_bi_index_2; +} CFE_NAND_CHIP, *PCFE_NAND_CHIP; + +struct flash_name_from_id +{ + unsigned short fnfi_id; + char fnfi_name[30]; +}; + + +#if defined(CFG_RAMAPP) +/** Prototypes for CFE RAM. **/ +int nand_flash_init(flash_device_info_t **flash_info); +int mpinand_flash_init(flash_device_info_t **flash_info); +static void nand_init_cleanmarker(PCFE_NAND_CHIP pchip); +static void nand_read_cfg(PCFE_NAND_CHIP pchip); +static int nand_is_blk_cleanmarker(PCFE_NAND_CHIP pchip, + unsigned long start_addr, int write_if_not); +static int nand_initialize_spare_area(PCFE_NAND_CHIP pchip); +static void nand_mark_bad_blk(PCFE_NAND_CHIP pchip, unsigned long page_addr); +static int nand_flash_sector_erase_int(unsigned short blk); +static int nand_flash_read_buf(unsigned short blk, int offset, + unsigned char *buffer, int len); +static int nand_flash_write_buf(unsigned short blk, int offset, + unsigned char *buffer, int numbytes); +static int nand_flash_get_numsectors(void); +static int nand_flash_get_sector_size(unsigned short sector); +static unsigned char *nand_flash_get_memptr(unsigned short sector); +static int nand_flash_get_blk(int addr); +static int nand_flash_get_total_size(void); +static int nandflash_wait_status(unsigned long status_mask); +static int nandflash_read_spare_area(PCFE_NAND_CHIP pchip, + unsigned long page_addr, unsigned char *buffer, int len); +static int nandflash_write_spare_area(PCFE_NAND_CHIP pchip, + unsigned long page_addr, unsigned char *buffer, int len); +static int nandflash_read_page(PCFE_NAND_CHIP pchip, + unsigned long start_addr, unsigned char *buffer, int len); +static int nandflash_write_page(PCFE_NAND_CHIP pchip, unsigned long start_addr, + unsigned char *buffer, int len); +static int nandflash_block_erase(PCFE_NAND_CHIP pchip, unsigned long blk_addr); +#else +/** Prototypes for CFE ROM. **/ +void rom_nand_flash_init(void); +static int nand_is_blk_cleanmarker(PCFE_NAND_CHIP pchip, + unsigned long start_addr, int write_if_not); +static void nand_read_cfg(PCFE_NAND_CHIP pchip); +int nand_flash_get_sector_size(unsigned short sector); +int nand_flash_get_numsectors(void); +static int nandflash_wait_status(unsigned long status_mask); +static int nandflash_read_spare_area(PCFE_NAND_CHIP pchip, + unsigned long page_addr, unsigned char *buffer, int len); +static int nandflash_read_page(PCFE_NAND_CHIP pchip, unsigned long start_addr, + unsigned char *buffer, int len); +int nand_flash_read_buf(unsigned short blk, int offset, + unsigned char *buffer, int len); +static inline void nandflash_copy_from_cache(unsigned char *buffer, + int offset, int numbytes); +static inline void nandflash_copy_from_spare(unsigned char *buffer, + int numbytes); +static int nandflash_wait_status(unsigned long status_mask); +static inline int nandflash_wait_cmd(void); +static inline int nandflash_wait_device(void); +static inline int nandflash_wait_cache(void); +static inline int nandflash_wait_spare(void); +static int nandflash_check_ecc(void); +#endif + + +#if defined(CFG_RAMAPP) +/** Variables for CFE RAM. **/ +CFE_NAND_CHIP g_chip = {NULL,0,0,0,0,0,0}; +static unsigned char g_spare_mask[] = SPARE_BI_ECC_MASK; +static unsigned char g_spare_cleanmarker[SPARE_MAX_SIZE]; + +static flash_device_info_t flash_nand_dev = + { + 0xffff, + FLASH_IFC_NAND, + "", + nand_flash_sector_erase_int, + nand_flash_read_buf, + nand_flash_write_buf, + nand_flash_get_numsectors, + nand_flash_get_sector_size, + nand_flash_get_memptr, + nand_flash_get_blk, + nand_flash_get_total_size + }; + +#else +/** Variables for CFE ROM. **/ +CFE_NAND_CHIP g_chip; +static unsigned char g_spare_mask[] = SPARE_BI_ECC_MASK; +#endif + + +#if defined(CFG_RAMAPP) +/*************************************************************************** + * Function Name: nand_flash_init + * Description : Initialize flash part. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +int nand_flash_init(flash_device_info_t **flash_info) +{ + static int initialized = 0; + int ret = FLASH_API_OK; + + if( initialized == 0 ) + { + PCFE_NAND_CHIP pchip = &g_chip; + static struct flash_name_from_id fnfi[] = NAND_FLASH_DEVICES; + struct flash_name_from_id *fnfi_ptr; + + DBG_PRINTF(">> nand_flash_init - entry\n"); + + /* Enable NAND data on MII ports. */ +#if !defined(_BCM96328_) + PERF->blkEnables |= NAND_CLK_EN; +#endif +#if defined(_BCM96362_) && (INC_SPI_FLASH_DRIVER==1) + GPIO->GPIOBaseMode |= NAND_GPIO_OVERRIDE; +#endif + NAND->NandNandBootConfig = NBC_AUTO_DEV_ID_CFG | 2; +#if (INC_SPI_FLASH_DRIVER==1) + cfe_usleep(1000); +#endif + /* Read the NAND flash chip id. Only use the most signficant 16 bits.*/ + pchip->chip_device_id = NAND->NandFlashDeviceId >> 16; + flash_nand_dev.flash_device_id = pchip->chip_device_id; + + for( fnfi_ptr = fnfi; fnfi_ptr->fnfi_id != 0; fnfi_ptr++ ) + { + if( fnfi_ptr->fnfi_id == pchip->chip_device_id ) + { + strcpy(flash_nand_dev.flash_device_name, fnfi_ptr->fnfi_name); + break; + } + } + + /* If NAND chip is not in the list of NAND chips, the correct + * configuration maybe still have been set by the NAND controller. + */ + if( flash_nand_dev.flash_device_name[0] == '\0' ) + strcpy(flash_nand_dev.flash_device_name, ""); + + *flash_info = &flash_nand_dev; + + NAND->NandCsNandXor = 0; + pchip->chip_base = 0; + nand_read_cfg(pchip); + nand_init_cleanmarker(pchip); + + /* If the first block's spare area is not a JFFS2 cleanmarker, + * initialize all block's spare area to a cleanmarker. + */ + if( !nand_is_blk_cleanmarker(pchip, 0, 0) ) + ret = nand_initialize_spare_area(pchip); + + DBG_PRINTF(">> nand_flash_init - return %d\n", ret); + + initialized = 1; + } + else + *flash_info = &flash_nand_dev; + + return( ret ); +} /* nand_flash_init */ + +/*************************************************************************** + * Function Name: nand_init_cleanmarker + * Description : Initializes the JFFS2 clean marker buffer. + * Returns : None. + ***************************************************************************/ +static void nand_init_cleanmarker(PCFE_NAND_CHIP pchip) +{ + unsigned short cleanmarker[] = JFFS2_CLEANMARKER; + unsigned char *pcm = (unsigned char *) cleanmarker; + int i, j; + + /* Skip spare area offsets reserved for ECC bytes. */ + for( i = 0, j = 0; i < pchip->chip_spare_size; i++ ) + { + if( pchip->chip_spare_mask[i] == 0 && j < sizeof(cleanmarker)) + g_spare_cleanmarker[i] = pcm[j++]; + else + g_spare_cleanmarker[i] = 0xff; + } +} /* nand_init_cleanmarker */ + +#else +/*************************************************************************** + * Function Name: rom_nand_flash_init + * Description : Initialize flash part just enough to read blocks. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +void rom_nand_flash_init(void) +{ + PCFE_NAND_CHIP pchip = &g_chip; + + /* Enable NAND data on MII ports. */ +#if !defined(_BCM96328_) + PERF->blkEnables |= NAND_CLK_EN; +#endif + NAND->NandNandBootConfig = NBC_AUTO_DEV_ID_CFG | 2; + + pchip->chip_base = 0; + + /* Read the chip id. Only use the most signficant 16 bits. */ + pchip->chip_device_id = NAND->NandFlashDeviceId >> 16; + + if( pchip->chip_device_id > 0 && pchip->chip_device_id < 0xffff ) + nand_read_cfg(pchip); + else + board_setleds(0x4d494532); +} /* nand_flash_init */ +#endif + +/*************************************************************************** + * Function Name: nand_read_cfg + * Description : Reads and stores the chip configuration. + * Returns : None. + ***************************************************************************/ +static void nand_read_cfg(PCFE_NAND_CHIP pchip) +{ + /* Read chip configuration. */ + unsigned long cfg = NAND->NandConfig; + + pchip->chip_total_size = + (4 * (1 << ((cfg & NC_DEV_SIZE_MASK) >> NC_DEV_SIZE_SHIFT))) << 20; + + switch( (cfg & NC_BLK_SIZE_MASK) ) + { + case NC_BLK_SIZE_512K: + pchip->chip_block_size = 512 * 1024; + break; + + case NC_BLK_SIZE_128K: + pchip->chip_block_size = 128 * 1024; + break; + + case NC_BLK_SIZE_16K: + pchip->chip_block_size = 16 * 1024; + break; + + case NC_BLK_SIZE_8K: + pchip->chip_block_size = 8 * 1024; + break; + } + + if( (cfg & NC_PG_SIZE_MASK) == NC_PG_SIZE_512B ) + { + pchip->chip_page_size = 512; + pchip->chip_bi_index_1 = SPARE_SP_BI_INDEX_1; + pchip->chip_bi_index_2 = SPARE_SP_BI_INDEX_2; + } + else + { + pchip->chip_page_size = 2048; + pchip->chip_bi_index_1 = SPARE_LP_BI_INDEX_1; + pchip->chip_bi_index_2 = SPARE_LP_BI_INDEX_2; + } + + pchip->chip_spare_mask = g_spare_mask; + pchip->chip_spare_mask[pchip->chip_bi_index_1] = 1; + pchip->chip_spare_mask[pchip->chip_bi_index_2] = 1; + + pchip->chip_spare_size = pchip->chip_page_size >> 5; + + DBG_PRINTF(">> nand_read_cfg - size=%luMB, block=%luKB, page=%luB, " + "spare=%lu\n", pchip->chip_total_size / (1024 * 1024), + pchip->chip_block_size / 1024, pchip->chip_page_size, + pchip->chip_spare_size); +} /* nand_read_cfg */ + +/*************************************************************************** + * Function Name: nand_is_blk_cleanmarker + * Description : Compares a buffer to see if it a JFFS2 cleanmarker. + * Returns : 1 - is cleanmarker, 0 - is not cleanmarker + ***************************************************************************/ +static int nand_is_blk_cleanmarker(PCFE_NAND_CHIP pchip, + unsigned long start_addr, int write_if_not) +{ + unsigned short cleanmarker[] = JFFS2_CLEANMARKER; + unsigned char *pcm = (unsigned char *) cleanmarker; + unsigned char spare[SPARE_MAX_SIZE], comparebuf[SPARE_MAX_SIZE]; + unsigned long i, j; + int ret = 0; + + if( nandflash_read_spare_area( pchip, start_addr, spare, + pchip->chip_spare_size) == FLASH_API_OK ) + { + /* Skip spare offsets that are reserved for the ECC. Make spare data + * bytes contiguous in the spare buffer. + */ + for( i = 0, j = 0; i < pchip->chip_spare_size; i++ ) + if( pchip->chip_spare_mask[i] == 0 ) + comparebuf[j++] = spare[i]; + + /* Compare spare area data to the JFFS2 cleanmarker. */ + for( i = 0, ret = 1; i < sizeof(cleanmarker) && ret == 1; i++ ) + if( comparebuf[i] != pcm[i]) + ret = 0; + } + +#if defined(CFG_RAMAPP) + if( ret == 0 && spare[pchip->chip_bi_index_1] != SPARE_BI_MARKER && + spare[pchip->chip_bi_index_2] != SPARE_BI_MARKER && write_if_not ) + { + /* The spare area is not a clean marker but the block is not bad. + * Write a clean marker to this block. (Assumes the block is erased.) + */ + if( nandflash_write_spare_area(pchip, start_addr, (unsigned char *) + g_spare_cleanmarker, pchip->chip_spare_size) == FLASH_API_OK ) + { + ret = nand_is_blk_cleanmarker(pchip, start_addr, 0); + } + } +#endif + + return( ret ); +} /* nand_is_blk_cleanmarker */ + +#if defined(CFG_RAMAPP) +/*************************************************************************** + * Function Name: nand_initialize_spare_area + * Description : Initializes the spare area of the first page of each block + * to a cleanmarker. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nand_initialize_spare_area(PCFE_NAND_CHIP pchip) +{ + unsigned char spare[SPARE_MAX_SIZE]; + unsigned long i; + int ret; + + DBG_PRINTF(">> nand_initialize_spare_area - entry\n"); + + for( i = 0; i < pchip->chip_total_size; i += pchip->chip_block_size ) + { + /* Read the current spare area. */ + ret = nandflash_read_spare_area(pchip,0,spare,pchip->chip_spare_size); + if(ret == FLASH_API_OK + /*&& spare[pchip->chip_bi_index_1] != SPARE_BI_MARKER*/ + /*&& spare[pchip->chip_bi_index_2] != SPARE_BI_MARKER*/) + { + if( nandflash_block_erase(pchip, i) == FLASH_API_OK ) + { + nandflash_write_spare_area(pchip, i, (unsigned char *) + g_spare_cleanmarker, pchip->chip_spare_size); + } + } + } + + return( FLASH_API_OK ); +} /* nand_initialize_spare_area */ + + +/*************************************************************************** + * Function Name: nand_mark_bad_blk + * Description : Marks the specified block as bad by writing 0xFFs to the + * spare area and updating the in memory bad block table. + * Returns : None. + ***************************************************************************/ +static void nand_mark_bad_blk(PCFE_NAND_CHIP pchip, unsigned long page_addr) +{ + static int marking_bad_blk = 0; + + unsigned char spare[SPARE_MAX_SIZE]; + + if( marking_bad_blk == 0 ) + { + marking_bad_blk = 1; + DBG_PRINTF(">> nand_mark_bad_blk - addr=0x%8.8lx, block=0x%8.8lx\n", + page_addr, page_addr / pchip->chip_block_size); + + nandflash_block_erase(pchip, page_addr); + memset(spare, 0xff, pchip->chip_spare_size); + spare[pchip->chip_bi_index_1] = SPARE_BI_MARKER; + spare[pchip->chip_bi_index_2] = SPARE_BI_MARKER; + nandflash_write_spare_area(pchip,page_addr,spare,pchip->chip_spare_size); + marking_bad_blk = 0; + } +} /* nand_mark_bad_blk */ + + +/*************************************************************************** + * Function Name: nand_flash_sector_erase_int + * Description : Erase the specfied flash sector. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nand_flash_sector_erase_int(unsigned short blk) +{ + int ret = FLASH_API_OK; + PCFE_NAND_CHIP pchip = &g_chip; + + if( blk == NAND_REINIT_FLASH ) + nand_initialize_spare_area(pchip); + else + { + unsigned long page_addr = blk * pchip->chip_block_size; + + /* Only erase the block if the spare area is a JFFS2 cleanmarker. + * Assume that the only the CFE boot loader only touches JFFS2 blocks. + * This check prevents the Linux NAND MTD driver bad block block table + * from being erased. The NAND_REINIT_FLASH option unconditionally + * erases all NAND flash blocks. + */ + if( nand_is_blk_cleanmarker(pchip, page_addr, 0) ) + { + ret = nandflash_block_erase(pchip, page_addr); + nandflash_write_spare_area(pchip, page_addr, g_spare_cleanmarker, + pchip->chip_spare_size); + } + + DBG_PRINTF(">> nand_flash_sector_erase_int - blk=0x%8.8lx, ret=%d\n", + blk, ret); + } + + return( ret ); +} /* nand_flash_sector_erase_int */ +#endif + +/*************************************************************************** + * Function Name: nand_flash_read_buf + * Description : Reads from flash memory. + * Returns : number of bytes read or FLASH_API_ERROR + ***************************************************************************/ +#if defined(CFG_RAMAPP) +static +#endif +int nand_flash_read_buf(unsigned short blk, int offset, unsigned char *buffer, + int len) +{ + int ret = len; + PCFE_NAND_CHIP pchip = &g_chip; + UINT32 start_addr; + UINT32 blk_addr; + UINT32 blk_offset; + UINT32 size; + + DBG_PRINTF(">> nand_flash_read_buf - 1 blk=0x%8.8lx, offset=%d, len=%lu\n", + blk, offset, len); + + start_addr = (blk * pchip->chip_block_size) + offset; + blk_addr = start_addr & ~(pchip->chip_block_size - 1); + blk_offset = start_addr - blk_addr; + size = pchip->chip_block_size - blk_offset; + + if(size > len) + size = len; + + do + { + if(nandflash_read_page(pchip,start_addr,buffer,size) != FLASH_API_OK) + { + ret = FLASH_API_ERROR; + break; + } + + len -= size; + if( len ) + { + blk++; + + DBG_PRINTF(">> nand_flash_read_buf - 2 blk=0x%8.8lx, len=%lu\n", + blk, len); + + start_addr = blk * pchip->chip_block_size; + buffer += size; + if(len > pchip->chip_block_size) + size = pchip->chip_block_size; + else + size = len; + } + } while(len); + + DBG_PRINTF(">> nand_flash_read_buf - ret=%d\n", ret); + + return( ret ) ; +} /* nand_flash_read_buf */ + +#if defined(CFG_RAMAPP) +/*************************************************************************** + * Function Name: nand_flash_write_buf + * Description : Writes to flash memory. + * Returns : number of bytes written or FLASH_API_ERROR + ***************************************************************************/ +static int nand_flash_write_buf(unsigned short blk, int offset, + unsigned char *buffer, int len) +{ + int ret = len; + PCFE_NAND_CHIP pchip = &g_chip; + UINT32 start_addr; + UINT32 blk_addr; + UINT32 blk_offset; + UINT32 size; + + DBG_PRINTF(">> nand_flash_write_buf - 1 blk=0x%8.8lx, offset=%d, len=%d\n", + blk, offset, len); + + start_addr = (blk * pchip->chip_block_size) + offset; + blk_addr = start_addr & ~(pchip->chip_block_size - 1); + blk_offset = start_addr - blk_addr; + size = pchip->chip_block_size - blk_offset; + + if(size > len) + size = len; + + do + { + if(nandflash_write_page(pchip,start_addr,buffer,size) != FLASH_API_OK) + { + ret = ret - len; + break; + } + else + { + len -= size; + if( len ) + { + blk++; + + DBG_PRINTF(">> nand_flash_write_buf- 2 blk=0x%8.8lx, len=%d\n", + blk, len); + + offset = 0; + start_addr = blk * pchip->chip_block_size; + buffer += size; + if(len > pchip->chip_block_size) + size = pchip->chip_block_size; + else + size = len; + } + } + } while(len); + + DBG_PRINTF(">> nand_flash_write_buf - ret=%d\n", ret); + + return( ret ) ; +} /* nand_flash_write_buf */ + +/*************************************************************************** + * Function Name: nand_flash_get_memptr + * Description : Returns the base MIPS memory address for the specfied flash + * sector. + * Returns : Base MIPS memory address for the specfied flash sector. + ***************************************************************************/ +static unsigned char *nand_flash_get_memptr(unsigned short sector) +{ + /* Bad things will happen if this pointer is referenced. But it can + * be used for pointer arithmetic to deterine sizes. + */ + return((unsigned char *) (FLASH_BASE + (sector * g_chip.chip_block_size))); +} /* nand_flash_get_memptr */ + +/*************************************************************************** + * Function Name: nand_flash_get_blk + * Description : Returns the flash sector for the specfied MIPS address. + * Returns : Flash sector for the specfied MIPS address. + ***************************************************************************/ +static int nand_flash_get_blk(int addr) +{ + return( (addr - FLASH_BASE) / g_chip.chip_block_size ); +} /* nand_flash_get_blk */ + +/*************************************************************************** + * Function Name: nand_flash_get_total_size + * Description : Returns the number of bytes in the "CFE Linux code" + * partition. + * Returns : Number of bytes + ***************************************************************************/ +static int nand_flash_get_total_size(void) +{ + return(g_chip.chip_total_size); +} /* nand_flash_get_total_size */ +#endif + +/*************************************************************************** + * Function Name: nand_flash_get_sector_size + * Description : Returns the number of bytes in the specfied flash sector. + * Returns : Number of bytes in the specfied flash sector. + ***************************************************************************/ +#if defined(CFG_RAMAPP) +static +#endif +int nand_flash_get_sector_size(unsigned short sector) +{ + return(g_chip.chip_block_size); +} /* nand_flash_get_sector_size */ + +/*************************************************************************** + * Function Name: nand_flash_get_numsectors + * Description : Returns the number of blocks in the "CFE Linux code" + * partition. + * Returns : Number of blocks + ***************************************************************************/ +#if defined(CFG_RAMAPP) +static +#endif +int nand_flash_get_numsectors(void) +{ + return(g_chip.chip_total_size / g_chip.chip_block_size); +} /* nand_flash_get_numsectors */ + + +/*************************************************************************** + * NAND Flash Implementation Functions + ***************************************************************************/ + +/*************************************************************************** + * Function Name: nandflash_copy_from_cache + * Description : Copies data from the chip NAND cache to a local memory + * buffer. + * Returns : None. + ***************************************************************************/ +static inline void nandflash_copy_from_cache(unsigned char *buffer, + int offset, int numbytes) +{ + unsigned char *cache = (unsigned char *) NAND_CACHE; + + /* XXX memcpy will only work for 32-bit aligned data */ + memcpy(buffer, &cache[offset], numbytes); +} /* nandflash_copy_from_cache */ + +/*************************************************************************** + * Function Name: nandflash_copy_from_spare + * Description : Copies data from the chip NAND spare registers to a local + * memory buffer. + * Returns : None. + ***************************************************************************/ +static inline void nandflash_copy_from_spare(unsigned char *buffer, + int numbytes) +{ + unsigned long *spare_area = (unsigned long *) &NAND->NandSpareAreaReadOfs0; + + /* XXX memcpy will only work for 32-bit aligned data */ + memcpy(buffer, spare_area, numbytes); +} /* nandflash_copy_from_spare */ + +#if defined(CFG_RAMAPP) +/*************************************************************************** + * Function Name: nandflash_copy_to_cache + * Description : Copies data from a local memory buffer to the the chip NAND + * cache. + * Returns : None. + ***************************************************************************/ +static inline void nandflash_copy_to_cache(unsigned char *buffer, int offset, + int numbytes) +{ + unsigned char *cache = (unsigned char *) NAND_CACHE; + unsigned long i; + + for( i = 0; i < numbytes; i += sizeof(long) ) + *(unsigned long *) &cache[i] = + ((unsigned long) buffer[i + 0] << 24) | + ((unsigned long) buffer[i + 1] << 16) | + ((unsigned long) buffer[i + 2] << 8) | + ((unsigned long) buffer[i + 3] << 0); +} /* nandflash_copy_to_cache */ + +/*************************************************************************** + * Function Name: nandflash_copy_to_spare + * Description : Copies data from a local memory buffer to the the chip NAND + * spare registers. + * Returns : None. + ***************************************************************************/ +static inline void nandflash_copy_to_spare(unsigned char *buffer,int numbytes) +{ + unsigned long *spare_area = (unsigned long *) &NAND->NandSpareAreaWriteOfs0; + unsigned long *pbuff = (unsigned long *)buffer; + int i; + + for(i=0; i< numbytes / sizeof(unsigned long); ++i) + spare_area[i] = pbuff[i]; +} /* nandflash_copy_to_spare */ +#endif + +/*************************************************************************** + * Function Name: nandflash_wait_status + * Description : Polls the NAND status register waiting for a condition. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nandflash_wait_status(unsigned long status_mask) +{ + + const unsigned long nand_poll_max = 1000000; + unsigned long data; + unsigned long poll_count = 0; + int ret = FLASH_API_OK; + + do + { + data = NAND->NandIntfcStatus; + } while(!(status_mask & data) && (++poll_count < nand_poll_max)); + + if(poll_count >= nand_poll_max) + { + printf("Status wait timeout: nandsts=0x%8.8lx mask=0x%8.8lx, count=" + "%lu\n", NAND->NandIntfcStatus, status_mask, poll_count); + ret = FLASH_API_ERROR; + } + + return( ret ); +} /* nandflash_wait_status */ + +static inline int nandflash_wait_cmd(void) +{ + return nandflash_wait_status(NIS_CTLR_READY); +} /* nandflash_wait_cmd */ + +static inline int nandflash_wait_device(void) +{ + return nandflash_wait_status(NIS_FLASH_READY); +} /* nandflash_wait_device */ + +static inline int nandflash_wait_cache(void) +{ + return nandflash_wait_status(NIS_CACHE_VALID); +} /* nandflash_wait_cache */ + +static inline int nandflash_wait_spare(void) +{ + return nandflash_wait_status(NIS_SPARE_VALID); +} /* nandflash_wait_spare */ + +#if defined(CFG_RAMAPP) +/*************************************************************************** + * Function Name: nandflash_check_ecc + * Description : Reads ECC status. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nandflash_check_ecc(void) +{ + int ret = FLASH_API_OK; + UINT32 intrCtrl; + UINT32 accessCtrl; + + /* read interrupt status */ + intrCtrl = NAND_INTR->NandInterrupt; + accessCtrl = NAND->NandAccControl; + + + if( (intrCtrl & NINT_ECC_ERROR_UNC) != 0 ) + { + printf("Uncorrectable ECC Error detected: addr=0x%8.8lx, intrCtrl=0x" + "%08X, accessCtrl=0x%08X\n", NAND->NandEccUncAddr, (UINT)intrCtrl, + (UINT)accessCtrl); + ret = FLASH_API_ERROR; + } + + if( (intrCtrl & NINT_ECC_ERROR_CORR) != 0 ) + { + printf("Correctable ECC Error detected: addr=0x%8.8lx, intrCtrl=0x" + "%08X, accessCtrl=0x%08X\n", NAND->NandEccCorrAddr, (UINT)intrCtrl, + (UINT)accessCtrl); + } + + return( ret ); +} +#else +static int nandflash_check_ecc(void) +{ + return( FLASH_API_OK ); +} +#endif + +/*************************************************************************** + * Function Name: nandflash_read_spare_area + * Description : Reads the spare area for the specified page. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nandflash_read_spare_area(PCFE_NAND_CHIP pchip, + unsigned long page_addr, unsigned char *buffer, int len) +{ + int ret = FLASH_API_ERROR; + + if( len >= pchip->chip_spare_size ) + { + UINT32 steps = pchip->chip_spare_size / CTRLR_SPARE_SIZE; + UINT32 i; + + for( i = 0; i < steps; i++ ) + { + NAND->NandCmdAddr = pchip->chip_base + page_addr + + (i * CTRLR_CACHE_SIZE); + NAND->NandCmdExtAddr = 0; + NAND->NandCmdStart = NCMD_SPARE_READ; + + if( (ret = nandflash_wait_cmd()) == FLASH_API_OK ) + { + /* wait until data is available in the spare area registers */ + if( (ret = nandflash_wait_spare()) == FLASH_API_OK ) + nandflash_copy_from_spare(buffer + (i * CTRLR_SPARE_SIZE), + CTRLR_SPARE_SIZE); + else + break; + } + else + break; + } + } + + return ret; +} /* nandflash_read_spare_area */ + +#if defined(CFG_RAMAPP) +/*************************************************************************** + * Function Name: nandflash_write_spare_area + * Description : Reads the spare area for the specified page. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nandflash_write_spare_area(PCFE_NAND_CHIP pchip, + unsigned long page_addr, unsigned char *buffer, int len) +{ + int ret = FLASH_API_OK; + unsigned char spare[SPARE_MAX_SIZE]; + + if( len <= pchip->chip_spare_size ) + { + UINT32 steps = pchip->chip_spare_size / CTRLR_SPARE_SIZE; + UINT32 i; + + memset(spare, 0xff, pchip->chip_spare_size); + memcpy(spare, buffer, len); + + for( i = 0; i < steps; i++ ) + { + NAND->NandCmdAddr = pchip->chip_base + page_addr + + (i * CTRLR_CACHE_SIZE); + NAND->NandCmdExtAddr = 0; + + nandflash_copy_to_spare(spare + (i * CTRLR_SPARE_SIZE), + CTRLR_SPARE_SIZE); + + NAND->NandCmdStart = NCMD_PROGRAM_SPARE; + if( (ret = nandflash_wait_cmd()) == FLASH_API_OK ) + { + unsigned long sts = NAND->NandIntfcStatus; + + if( (sts & NIS_PGM_ERASE_ERROR) != 0 ) + { + printf("Error writing to spare area, sts=0x%8.8lx\n", sts); + nand_mark_bad_blk(pchip, page_addr); + ret = FLASH_API_ERROR; + } + } + } + } + else + ret = FLASH_API_ERROR; + + /* Reset spare area to default value. */ + memset(spare, 0xff, CTRLR_SPARE_SIZE); + nandflash_copy_to_spare(spare, CTRLR_SPARE_SIZE); + + return( ret ); +} /* nandflash_write_spare_area */ +#endif + +/*************************************************************************** + * Function Name: nandflash_read_page + * Description : Reads up to a NAND block of pages into the specified buffer. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nandflash_read_page(PCFE_NAND_CHIP pchip, unsigned long start_addr, + unsigned char *buffer, int len) +{ + int ret = FLASH_API_ERROR; + + if( len <= pchip->chip_block_size ) + { + UINT32 page_addr = start_addr & ~(pchip->chip_page_size - 1); + UINT32 page_offset = start_addr - page_addr; + UINT32 size = pchip->chip_page_size - page_offset; + UINT32 index = 0; + + /* Verify that the spare area contains a JFFS2 cleanmarker. */ + if( nand_is_blk_cleanmarker(pchip, page_addr, 0) ) + { + UINT32 i; + + if(size > len) + size = len; + + do + { + for( i = 0, ret = FLASH_API_OK; i < pchip->chip_page_size && + ret == FLASH_API_OK; i += CTRLR_CACHE_SIZE) + { + /* clear interrupts, so we can check later for ECC errors */ + NAND_INTR->NandInterrupt = NINT_STS_MASK; + + /* send command */ + NAND->NandCmdAddr = pchip->chip_base + page_addr + i; + NAND->NandCmdExtAddr = 0; + NAND->NandCmdStart = NCMD_PAGE_READ; + + if( (ret = nandflash_wait_cmd()) == FLASH_API_OK ) + { + /* wait until data is available in the cache */ + if( (ret = nandflash_wait_cache()) == FLASH_API_OK ) + { + /* TBD. get return status for ECC errors and + * process them. + */ + nandflash_check_ecc(); /* check for ECC errors */ + } + + if( ret == FLASH_API_OK ) + { + if( i < size ) + { + UINT32 copy_size = + (i + CTRLR_CACHE_SIZE <= size) + ? CTRLR_CACHE_SIZE : size - i; + + nandflash_copy_from_cache(&buffer[index + i], + page_offset, copy_size); + } + } + else + { + /* TBD. Do something. */ + } + } + } + + if(ret != FLASH_API_OK) + break; + + page_offset = 0; + page_addr += pchip->chip_page_size; + index += size; + len -= size; + if(len > pchip->chip_page_size) + size = pchip->chip_page_size; + else + size = len; + } while(len); + } + else + { + DBG_PRINTF("nandflash_read_page: cleanmarker not found at 0x%8.8lx\n", + page_addr); + } + } + + return( ret ) ; +} /* nandflash_read_page */ + +#if defined(CFG_RAMAPP) +/*************************************************************************** + * Function Name: nandflash_write_page + * Description : Writes up to a NAND block of pages from the specified buffer. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nandflash_write_page(PCFE_NAND_CHIP pchip, unsigned long start_addr, + unsigned char *buffer, int len) +{ + int ret = FLASH_API_ERROR; + + if( len <= pchip->chip_block_size ) + { + unsigned char xfer_buf[CTRLR_CACHE_SIZE]; + UINT32 page_addr = start_addr & ~(pchip->chip_page_size - 1); + UINT32 page_offset = start_addr - page_addr; + UINT32 size = pchip->chip_page_size - page_offset; + UINT32 index = 0; + + /* Verify that the spare area contains a JFFS2 cleanmarker. */ + if( nand_is_blk_cleanmarker(pchip, page_addr, 1) ) + { + UINT32 steps = pchip->chip_page_size / CTRLR_CACHE_SIZE; + UINT32 i, xfer_ofs, xfer_size; + + if(size > len) + size = len; + + do + { + for( i = 0, xfer_ofs = 0, xfer_size = 0, ret = FLASH_API_OK; + i < steps && ret==FLASH_API_OK; i++) + { + memset(xfer_buf, 0xff, sizeof(xfer_buf)); + + if(size - xfer_ofs > CTRLR_CACHE_SIZE) + xfer_size = CTRLR_CACHE_SIZE; + else + xfer_size = size - xfer_ofs; + + if( xfer_size ) + memcpy(xfer_buf + page_offset, buffer + index + + xfer_ofs, xfer_size); + + xfer_ofs += xfer_size; + + NAND->NandCmdAddr = pchip->chip_base + page_addr + + (i * CTRLR_CACHE_SIZE); + NAND->NandCmdExtAddr = 0; + + nandflash_copy_to_cache(xfer_buf, 0, CTRLR_CACHE_SIZE); + + NAND->NandCmdStart = NCMD_PROGRAM_PAGE; + if( (ret = nandflash_wait_cmd()) == FLASH_API_OK ) + { + unsigned long sts = NAND->NandIntfcStatus; + + if( (sts & NIS_PGM_ERASE_ERROR) != 0 ) + { + printf("Error writing to block, sts=0x%8.8lx\n", sts); + nand_mark_bad_blk(pchip, + start_addr & ~(pchip->chip_page_size - 1)); + ret = FLASH_API_ERROR; + } + } + } + + if(ret != FLASH_API_OK) + break; + + page_offset = 0; + page_addr += pchip->chip_page_size; + index += size; + len -= size; + if(len > pchip->chip_page_size) + size = pchip->chip_page_size; + else + size = len; + } while(len); + } + else + DBG_PRINTF("nandflash_write_page: cleanmarker not found at 0x%8.8lx\n", + page_addr); + } + + return( ret ); +} /* nandflash_write_page */ + +/*************************************************************************** + * Function Name: nandflash_block_erase + * Description : Erases a block. + * Returns : FLASH_API_OK or FLASH_API_ERROR + ***************************************************************************/ +static int nandflash_block_erase(PCFE_NAND_CHIP pchip, unsigned long blk_addr ) +{ + + int ret = FLASH_API_OK; + + /* send command */ + NAND->NandCmdAddr = pchip->chip_base + blk_addr; + NAND->NandCmdExtAddr = 0; + NAND->NandCmdStart = NCMD_BLOCK_ERASE; + if( (ret = nandflash_wait_cmd()) == FLASH_API_OK ) + { + unsigned long sts = NAND->NandIntfcStatus; + + if( (sts & NIS_PGM_ERASE_ERROR) != 0 ) + { + printf("Error erasing block 0x%8.8lx, sts=0x%8.8lx\n", + blk_addr, sts); + nand_mark_bad_blk(pchip, blk_addr); + ret = FLASH_API_ERROR; + } + } + + DBG_PRINTF(">> nandflash_block_erase - addr=0x%8.8lx, ret=%d\n", blk_addr, + ret); + + return( ret ); +} /* nandflash_block_erase */ + +void dump_spare(void); +void dump_spare(void) +{ + PCFE_NAND_CHIP pchip = &g_chip; + unsigned char spare[SPARE_MAX_SIZE]; + unsigned long i; + + for( i = 0; i < pchip->chip_total_size; i += pchip->chip_block_size ) + { + if( nandflash_read_spare_area(pchip, i, spare, + pchip->chip_spare_size) == FLASH_API_OK ) + { + printf("%8.8lx: %8.8lx %8.8lx %8.8lx %8.8lx\n", i, + *(unsigned long *) &spare[0], *(unsigned long *) &spare[4], + *(unsigned long *) &spare[8], *(unsigned long *) &spare[12]); + if( pchip->chip_spare_size == SPARE_MAX_SIZE ) + { + printf("%8.8lx: %8.8lx %8.8lx %8.8lx %8.8lx\n", i, + *(unsigned long *)&spare[16],*(unsigned long *)&spare[20], + *(unsigned long *)&spare[24],*(unsigned long *)&spare[28]); + printf("%8.8lx: %8.8lx %8.8lx %8.8lx %8.8lx\n", i, + *(unsigned long *)&spare[32],*(unsigned long *)&spare[36], + *(unsigned long *)&spare[40],*(unsigned long *)&spare[44]); + printf("%8.8lx: %8.8lx %8.8lx %8.8lx %8.8lx\n", i, + *(unsigned long *)&spare[48],*(unsigned long *)&spare[52], + *(unsigned long *)&spare[56],*(unsigned long *)&spare[60]); + } + } + else + printf("Error reading spare 0x%8.8lx\n", i); + } +} + +int read_spare_data(int blk, unsigned char *buf, int bufsize); +int read_spare_data(int blk, unsigned char *buf, int bufsize) +{ + PCFE_NAND_CHIP pchip = &g_chip; + unsigned char spare[SPARE_MAX_SIZE]; + unsigned long page_addr = blk * pchip->chip_block_size; + unsigned long i, j; + int ret; + + if( (ret = nandflash_read_spare_area( pchip, page_addr, spare, + pchip->chip_spare_size)) == FLASH_API_OK ) + { + /* Skip spare offsets that are reserved for the ECC. Make spare data + * bytes contiguous in the spare buffer. + */ + for( i = 0, j = 0; i < pchip->chip_spare_size; i++ ) + if( pchip->chip_spare_mask[i] == 0 && j < bufsize ) + buf[j++] = spare[i]; + } + + return(ret); +} + +#endif + diff --git a/shared/opensource/flash/spiflash.c b/shared/opensource/flash/spiflash.c new file mode 100755 index 0000000..38f4648 --- /dev/null +++ b/shared/opensource/flash/spiflash.c @@ -0,0 +1,969 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL?, available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/** Includes. **/ +#ifdef _CFE_ +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "bcm_map.h" +#define printk printf +#else // linux +#include +#include +#include +#include +#include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) +#include +#endif +#include + +#include +#endif + +#include "bcmtypes.h" +#include "bcm_hwdefs.h" +#include "flash_api.h" +#include "bcmSpiRes.h" + + +/** Defines. **/ +#define OSL_DELAY(X) \ + do { { int i; for( i = 0; i < (X) * 500; i++ ) ; } } while(0) + +#define MAX_RETRY 3 + +#ifndef NULL +#define NULL 0 +#endif + +#define MAXSECTORS 8192 /* maximum number of sectors supported */ + +#define FLASH_PAGE_256 256 +#define SECTOR_SIZE_4K (4 * 1024) +#define SECTOR_SIZE_64K (64 * 1024) + +/* Standard Boolean declarations */ +#define TRUE 1 +#define FALSE 0 + +/* Command codes for the flash_command routine */ +#define FLASH_WRST 0x01 /* write status register */ +#define FLASH_PROG 0x02 /* program data into memory array */ +#define FLASH_READ 0x03 /* read data from memory array */ +#define FLASH_WRDI 0x04 /* reset write enable latch */ +#define FLASH_RDSR 0x05 /* read status register */ +#define FLASH_WREN 0x06 /* set write enable latch */ +#define FLASH_READ_FAST 0x0B /* read data from memory array */ +#define FLASH_SERASE 0x20 /* erase one sector in memory array */ +#define FLASH_BERASE 0xD8 /* erase one block in memory array */ +#define FLASH_RDID 0x9F /* read manufacturer and product id */ +#define FLASH_EN4B 0xB7 /* Enable 4 byte address mode */ + +/* RDSR return status bit definition */ +#define SR_WPEN 0x80 +#define SR_BP3 0x20 +#define SR_BP2 0x10 +#define SR_BP1 0x08 +#define SR_BP0 0x04 +#define SR_WEN 0x02 +#define SR_RDY 0x01 + +/* Return codes from flash_status */ +#define STATUS_READY 0 /* ready for action */ +#define STATUS_BUSY 1 /* operation in progress */ +#define STATUS_TIMEOUT 2 /* operation timed out */ +#define STATUS_ERROR 3 /* unclassified but unhappy status */ + +/* Define different type of flash */ +#define FLASH_UNDEFINED 0 +#define FLASH_SPAN 2 + +/* SST's manufacturer ID */ +#define SSTPART 0xBF +/* A list of SST device IDs */ +#define ID_SST25VF016 0x41 +#define ID_SST25VF032 0x4A +#define ID_SST25VF064 0x4B + +/* SPANSION manufacturer IDs */ +#define SPANPART 0x01 +/* SPANSION device ID's */ +#define ID_SPAN25FL016 0x14 +#define ID_SPAN25FL032 0x15 +#define ID_SPAN25FL064 0x16 +#define ID_SPAN25FL128 0x18 + +/* EON manufacturer ID */ +#define EONPART 0x1C +/* NUMONYX manufacturer ID */ +#define NUMONYXPART 0x20 +/* AMIC manufacturer ID */ +#define AMICPART 0x37 +/* Macronix manufacturer ID */ +#define MACRONIXPART 0xC2 +/* Winbond's manufacturer ID */ +#define WBPART 0xEF + +/* JEDEC device IDs */ +#define ID_M25P16 0x15 +#define ID_M25P32 0x16 +#define ID_M25P64 0x17 +#define ID_M25P128 0x18 +#define ID_M25P256 0x19 + +#define SPI_MAKE_ID(A,B) \ + (((unsigned short) (A) << 8) | ((unsigned short) B & 0xff)) + +#define SPI_FLASH_DEVICES \ + {{SPI_MAKE_ID(SSTPART, ID_SST25VF016), "SST25VF016"}, \ + {SPI_MAKE_ID(SSTPART, ID_SST25VF032), "SST25VF032"}, \ + {SPI_MAKE_ID(SSTPART, ID_SST25VF064), "SST25VF064"}, \ + {SPI_MAKE_ID(SPANPART, ID_SPAN25FL016), "S25FL016"}, \ + {SPI_MAKE_ID(SPANPART, ID_SPAN25FL032), "S25FL032"}, \ + {SPI_MAKE_ID(SPANPART, ID_SPAN25FL064), "S25FL064"}, \ + {SPI_MAKE_ID(SPANPART, ID_SPAN25FL128), "S25FL128"}, \ + {SPI_MAKE_ID(WBPART, ID_M25P16), "ID_W25X16"}, \ + {SPI_MAKE_ID(WBPART, ID_M25P32), "ID_W25X32"}, \ + {SPI_MAKE_ID(WBPART, ID_M25P64), "ID_W25X64"}, \ + {SPI_MAKE_ID(WBPART, ID_M25P128), "ID_W25X128"}, \ + {SPI_MAKE_ID(EONPART, ID_M25P16), "EN25P16"}, \ + {SPI_MAKE_ID(EONPART, ID_M25P32), "EN25P32"}, \ + {SPI_MAKE_ID(EONPART, ID_M25P64), "EN25P64"}, \ + {SPI_MAKE_ID(EONPART, ID_M25P128), "EN25P128"}, \ + {SPI_MAKE_ID(AMICPART, ID_M25P16), "A25L016"}, \ + {SPI_MAKE_ID(AMICPART, ID_M25P32), "A25L032"}, \ + {SPI_MAKE_ID(NUMONYXPART, ID_M25P16), "NMNXM25P16"}, \ + {SPI_MAKE_ID(NUMONYXPART, ID_M25P32), "NMNXM25P32"}, \ + {SPI_MAKE_ID(NUMONYXPART, ID_M25P64), "NMNXM25P64"}, \ + {SPI_MAKE_ID(NUMONYXPART, ID_M25P128), "NMNXM25P128"}, \ + {SPI_MAKE_ID(MACRONIXPART, ID_M25P16), "MX25L16"}, \ + {SPI_MAKE_ID(MACRONIXPART, ID_M25P32), "MX25L32"}, \ + {SPI_MAKE_ID(MACRONIXPART, ID_M25P64), "MX25L64"}, \ + {SPI_MAKE_ID(MACRONIXPART, ID_M25P128), "MX25L128"}, \ + {SPI_MAKE_ID(MACRONIXPART, ID_M25P256), "MX25L256"}, \ + {0,""} \ + } + +/** Structs. **/ +/* A structure for identifying a flash part. There is one for each + * of the flash part definitions. We need to keep track of the + * sector organization, the address register used, and the size + * of the sectors. + */ +struct flashinfo { + char *name; /* "AT25F512", etc. */ + unsigned long addr; /* physical address, once translated */ + int nsect; /* # of sectors */ + struct { + long size; /* # of bytes in this sector */ + long base; /* offset from beginning of device */ + } sec[MAXSECTORS]; /* per-sector info */ +}; + +struct flash_name_from_id { + unsigned short fnfi_id; + char fnfi_name[30]; +}; + + +/** Prototypes. **/ +static int my_spi_read( unsigned char *msg_buf, int prependcnt, int nbytes ); +static int my_spi_write( unsigned char *msg_buf, int nbytes ); + +int spi_flash_init(flash_device_info_t **flash_info); +static int spi_flash_sector_erase_int(unsigned short sector); +static int spi_flash_reset(void); +static int spi_flash_read_buf(unsigned short sector, int offset, + unsigned char *buffer, int nbytes); +static int spi_flash_ub(unsigned short sector); +static int spi_flash_write(unsigned short sector, int offset, + unsigned char *buffer, int nbytes); +static int spi_flash_write_buf(unsigned short sector, int offset, + unsigned char *buffer, int nbytes); +static int spi_flash_get_numsectors(void); +static int spi_flash_get_sector_size(unsigned short sector); +static unsigned char *spi_get_flash_memptr(unsigned short sector); +static unsigned char *spi_flash_get_memptr(unsigned short sector); +static int spi_flash_status(void); +static unsigned short spi_flash_get_device_id(unsigned short sector); +static int spi_flash_get_blk(int addr); +static int spi_flash_get_total_size(void); +static int spi_flash_en4b(void); + +/** Variables. **/ +static flash_device_info_t flash_spi_dev = + { + 0xffff, + FLASH_IFC_SPI, + "", + spi_flash_sector_erase_int, + spi_flash_read_buf, + spi_flash_write_buf, + spi_flash_get_numsectors, + spi_flash_get_sector_size, + spi_flash_get_memptr, + spi_flash_get_blk, + spi_flash_get_total_size + }; + +static struct flash_name_from_id fnfi[] = SPI_FLASH_DEVICES; + +/* the controller will handle operati0ns that are greater than the FIFO size + code that relies on READ_BUF_LEN_MAX, READ_BUF_LEN_MIN or spi_max_op_len + could be changed */ +#define READ_BUF_LEN_MAX 544 /* largest of the maximum transaction sizes for SPI */ +#define READ_BUF_LEN_MIN 60 /* smallest of the maximum transaction sizes for SPI */ +/* this is the slave ID of the SPI flash for use with the SPI controller */ +#define SPI_FLASH_SLAVE_DEV_ID 0 +/* clock defines for the flash */ +#define SPI_FLASH_DEF_CLOCK 781000 + +/* default to smallest transaction size - updated later */ +static int spi_max_op_len = READ_BUF_LEN_MIN; +static int fastRead = TRUE; +static int flash_page_size = FLASH_PAGE_256; + +/* default to legacy controller - updated later */ +static int spi_flash_clock = SPI_FLASH_DEF_CLOCK; +static int spi_flash_busnum = LEG_SPI_BUS_NUM; + +#ifndef _CFE_ +static DECLARE_MUTEX(spi_flash_lock); +static bool bSpiFlashSlaveRes = FALSE; +#endif + +static struct flashinfo meminfo; /* Flash information structure */ +static int totalSize = 0; +static int addr32 = FALSE; + +static int my_spi_read(unsigned char *msg_buf, int prependcnt, int nbytes) +{ + int status; + +#ifndef _CFE_ + if ( FALSE == bSpiFlashSlaveRes ) +#endif + { + status = BcmSpi_Read(msg_buf, prependcnt, nbytes, spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID, spi_flash_clock); + } +#ifndef _CFE_ + else + { + /* the Linux SPI framework provides a non blocking mechanism for SPI transfers. While waiting for a spi + transaction to complete the kernel will look to see if another process can run. This scheduling + can only occur if kernel preemption is active. The SPI flash interfaces can be run when kernel + preemption is enabled or disabled. When kernel preemption is disabled we cannot use the framework */ + if ( in_atomic() ) + status = BcmSpi_Read(msg_buf, prependcnt, nbytes, spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID, spi_flash_clock); + else + status = BcmSpiSyncTrans(NULL, msg_buf, prependcnt, nbytes, spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID); + } +#endif + + return status; +} + +static int my_spi_write(unsigned char *msg_buf, int nbytes) +{ + int status; + +#ifndef _CFE_ + if ( FALSE == bSpiFlashSlaveRes ) +#endif + { + status = BcmSpi_Write(msg_buf, nbytes, spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID, spi_flash_clock); + } +#ifndef _CFE_ + else + { + /* the Linux SPI framework provides a non blocking mechanism for SPI transfers. While waiting for a spi + transaction to complete the kernel will look to see if another process can run. This scheduling + can only occur if kernel preemtion is active. The SPI flash interfaces can be run when kernel + preemption is enabled or disabled. When kernel preemption is disabled we cannot use the framework */ + if ( in_atomic() ) + status = BcmSpi_Write(msg_buf, nbytes, spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID, spi_flash_clock); + else + status = BcmSpiSyncTrans(msg_buf, NULL, 0, nbytes, spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID); + } +#endif + return status; +} + + +/*********************************************************************/ +/* Init_flash is used to build a sector table. This information is */ +/* translated from erase_block information to base:offset information*/ +/* for each individual sector. This information is then stored */ +/* in the meminfo structure, and used throughout the driver to access*/ +/* sector information. */ +/* */ +/* This is more efficient than deriving the sector base:offset */ +/* information every time the memory map switches (since on the */ +/* development platform can only map 64k at a time). If the entire */ +/* flash memory array can be mapped in, then the addition static */ +/* allocation for the meminfo structure can be eliminated, but the */ +/* drivers will have to be re-written. */ +/* */ +/* The meminfo struct occupies 44 bytes of heap space, depending */ +/* on the value of the define MAXSECTORS. Adjust to suit */ +/* application */ +/*********************************************************************/ + +int spi_flash_init(flash_device_info_t **flash_info) +{ + struct flash_name_from_id *fnfi_ptr; + int i=0, count=0; + int basecount=0L; + unsigned short device_id; + int sectorsize = 0; + int numsector = 0; + +#if defined(_BCM96816_) || defined(CONFIG_BCM96816) + uint32 miscStrapBus = MISC->miscStrapBus; + + if ( miscStrapBus & MISC_STRAP_BUS_LS_SPIM_ENABLED ) + { + spi_flash_busnum = LEG_SPI_BUS_NUM; + if ( miscStrapBus & MISC_STRAP_BUS_SPI_CLK_FAST ) + { + spi_flash_clock = 20000000; + } + else + { + spi_flash_clock = 781000; + } + } + else + { + spi_flash_busnum = HS_SPI_BUS_NUM; + if ( miscStrapBus & MISC_STRAP_BUS_SPI_CLK_FAST ) + { + spi_flash_clock = 40000000; + } + else + { + spi_flash_clock = 20000000; + } + } +#endif +#if defined(_BCM96328_) || defined(CONFIG_BCM96328) || defined(_BCM96362_) || defined(CONFIG_BCM96362) + spi_flash_busnum = HS_SPI_BUS_NUM; + spi_flash_clock = 40000000; +#endif +#if defined(_BCM96368_) || defined(CONFIG_BCM96368) + uint32 miscStrapBus = GPIO->StrapBus; + + if ( miscStrapBus & (1 << 6) ) + spi_flash_clock = 20000000; + else + spi_flash_clock = 781000; +#endif + + /* retrieve the maximum read/write transaction length from the SPI controller */ + spi_max_op_len = BcmSpi_GetMaxRWSize( spi_flash_busnum ); + + if (HS_SPI_BUS_NUM == spi_flash_busnum) + flash_spi_dev.flash_type = FLASH_IFC_HS_SPI; + + *flash_info = &flash_spi_dev; + +#if 0 + /* + * in case of flash corrupt, the following steps can erase the flash + * 1. jumper USE_SPI_SLAVE to make SPI in slave mode + * 2. start up JTAG debuger and remove the USE_SPI_SLAVE jumper + * 3. run the following code to erase the flash + */ + flash_sector_erase_int(0); + flash_sector_erase_int(1); + printk("flash_init: erase all sectors\n"); + return FLASH_API_OK; +#endif + + flash_spi_dev.flash_device_id = device_id = spi_flash_get_device_id(0); + + switch( device_id >> 8 ) { + case SSTPART: + sectorsize = SECTOR_SIZE_4K; + switch ((unsigned char)(device_id & 0x00ff)) { + case ID_SST25VF016: + numsector = 512; + break; + case ID_SST25VF032: + numsector = 1024; + break; + case ID_SST25VF064: + numsector = 2048; + break; + } + break; + + case SPANPART: + sectorsize = SECTOR_SIZE_64K; + switch ((unsigned short)(device_id & 0x00ff)) { + case ID_SPAN25FL016: + numsector = 32; + break; + case ID_SPAN25FL032: + numsector = 64; + break; + case ID_SPAN25FL064: + numsector = 128; + break; + case ID_SPAN25FL128: + numsector = 256; + break; + } + break; + + case EONPART: + sectorsize = SECTOR_SIZE_64K; + switch ((unsigned short)(device_id & 0x00ff)) { + case ID_M25P16: + numsector = 32; + break; + case ID_M25P32: + numsector = 64; + break; + case ID_M25P64: + numsector = 128; + break; + case ID_M25P128: + numsector = 256; + break; + } + break; + + case NUMONYXPART: + case MACRONIXPART: + case WBPART: + case AMICPART: + sectorsize = SECTOR_SIZE_4K; + switch ((unsigned short)(device_id & 0x00ff)) { + case ID_M25P16: + numsector = 512; + break; + case ID_M25P32: + numsector = 1024; + break; + case ID_M25P64: + numsector = 2048; + break; + case ID_M25P128: + numsector = 4096; + break; + case ID_M25P256: + addr32 = TRUE; + numsector = 8192; + break; + } + break; + + default: + meminfo.addr = 0L; + meminfo.nsect = 1; + meminfo.sec[0].size = SECTOR_SIZE_4K; + meminfo.sec[0].base = 0x00000; + return FLASH_API_ERROR; + } + + if ( addr32 ) { + /* Enable 4 byte mode */ + spi_flash_en4b(); + } + + meminfo.addr = 0L; + meminfo.nsect = numsector; + for (i = 0; i < numsector; i++) { + meminfo.sec[i].size = sectorsize; + meminfo.sec[i].base = basecount; + basecount += meminfo.sec[i].size; + count++; + } + totalSize = meminfo.sec[count-1].base + meminfo.sec[count-1].size; + + for( fnfi_ptr = fnfi; fnfi_ptr->fnfi_id != 0; fnfi_ptr++ ) { + if( fnfi_ptr->fnfi_id == device_id ) { + strcpy( flash_spi_dev.flash_device_name, fnfi_ptr->fnfi_name ); + break; + } + } + + if ( fastRead ) + BcmSpi_SetFlashCtrl(FLASH_READ_FAST, 1, 1, spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID); + else + BcmSpi_SetFlashCtrl(FLASH_READ, 1, 0, spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID); + + return (FLASH_API_OK); +} + +/*********************************************************************/ +/* Flash_sector_erase_int() wait until the erase is completed before */ +/* returning control to the calling function. This can be used in */ +/* cases which require the program to hold until a sector is erased, */ +/* without adding the wait check external to this function. */ +/*********************************************************************/ + +static int spi_flash_sector_erase_int(unsigned short sector) +{ + unsigned char buf[6]; + unsigned int cmd_length; + unsigned int addr; + +#ifndef _CFE_ + down(&spi_flash_lock); +#endif + + /* set device to write enabled */ + spi_flash_ub(sector); + + /* erase the sector */ + addr = (unsigned int) spi_get_flash_memptr(sector); + + cmd_length = 0; + if (meminfo.sec[sector].size == SECTOR_SIZE_4K) + buf[cmd_length++] = FLASH_SERASE; + else + buf[cmd_length++] = FLASH_BERASE; + + if ( addr32 ) + buf[cmd_length++] = (unsigned char)((addr & 0xff000000) >> 24); + buf[cmd_length++] = (unsigned char)((addr & 0x00ff0000) >> 16); + buf[cmd_length++] = (unsigned char)((addr & 0x0000ff00) >> 8); + buf[cmd_length++] = (unsigned char)(addr & 0x000000ff); + + /* check device is ready */ + if (my_spi_write(buf, cmd_length) == SPI_STATUS_OK) { + while (spi_flash_status() != STATUS_READY); + } + + spi_flash_reset(); + +#ifndef _CFE_ + up(&spi_flash_lock); +#endif + + return(FLASH_API_OK); +} + +/*********************************************************************/ +/* flash_reset() will reset the flash device to reading array data. */ +/* It is good practice to call this function after autoselect */ +/* sequences had been performed. */ +/*********************************************************************/ + +static int spi_flash_en4b(void) +{ + unsigned char buf[4]; + + /* set device to write disabled */ + buf[0] = FLASH_EN4B; + my_spi_write(buf, 1); + while (spi_flash_status() != STATUS_READY); + + return(FLASH_API_OK); +} + +/*********************************************************************/ +/* flash_reset() will reset the flash device to reading array data. */ +/* It is good practice to call this function after autoselect */ +/* sequences had been performed. */ +/*********************************************************************/ + +static int spi_flash_reset(void) +{ + unsigned char buf[4]; + + /* set device to write disabled */ + buf[0] = FLASH_WRDI; + my_spi_write(buf, 1); + while (spi_flash_status() != STATUS_READY); + + return(FLASH_API_OK); +} + +/*********************************************************************/ +/* flash_read_buf() reads buffer of data from the specified */ +/* offset from the sector parameter. */ +/*********************************************************************/ + +static int spi_flash_read_buf(unsigned short sector, int offset, + unsigned char *buffer, int nbytes) +{ + unsigned char buf[READ_BUF_LEN_MAX]; + unsigned int cmd_length; + unsigned int addr; + int maxread; + +#ifndef _CFE_ + down(&spi_flash_lock); +#endif + + addr = (unsigned int) spi_get_flash_memptr(sector); + addr += offset; + + while (nbytes > 0) { + maxread = (nbytes < spi_max_op_len) ? nbytes : spi_max_op_len; + + cmd_length = 0; + if ( fastRead ) + buf[cmd_length++] = FLASH_READ_FAST; + else + buf[cmd_length++] = FLASH_READ; + if ( addr32 ) + buf[cmd_length++] = (unsigned char)((addr & 0xff000000) >> 24); + buf[cmd_length++] = (unsigned char)((addr & 0x00ff0000) >> 16); + buf[cmd_length++] = (unsigned char)((addr & 0x0000ff00) >> 8); + buf[cmd_length++] = (unsigned char)(addr & 0x000000ff); + + /* Send dummy byte for Fast Read */ + if ( fastRead ) + buf[cmd_length++] = (unsigned char)0xff; + + my_spi_read(buf, cmd_length, maxread); + + while (spi_flash_status() != STATUS_READY); + + memcpy(buffer, buf, maxread); + buffer += maxread; + nbytes -= maxread; + addr += maxread; + } + +#ifndef _CFE_ + up(&spi_flash_lock); +#endif + + return (FLASH_API_OK); +} + +/*********************************************************************/ +/* flash_ub() places the flash into unlock bypass mode. This */ +/* is REQUIRED to be called before any of the other unlock bypass */ +/* commands will become valid (most will be ignored without first */ +/* calling this function. */ +/*********************************************************************/ + +static int spi_flash_ub(unsigned short sector) +{ + unsigned char buf[4]; + + do { + buf[0] = FLASH_RDSR; + if (my_spi_read(buf, 1, 1) == SPI_STATUS_OK) { + while (spi_flash_status() != STATUS_READY); + if (buf[0] & (SR_BP3|SR_BP2|SR_BP1|SR_BP0)) { + /* Sector is write protected. Unprotect it */ + buf[0] = FLASH_WREN; + if (my_spi_write(buf, 1) == SPI_STATUS_OK) { + buf[0] = FLASH_WRST; + buf[1] = 0; + if (my_spi_write(buf, 2) == SPI_STATUS_OK) + while (spi_flash_status() != STATUS_READY); + } + } + else { + break; + } + } + else { + break; + } + } while (1); + + /* set device to write enabled */ + buf[0] = FLASH_WREN; + + /* check device is ready */ + if (my_spi_write(buf, 1) == SPI_STATUS_OK) { + while (spi_flash_status() != STATUS_READY); + do { + buf[0] = FLASH_RDSR; + if (my_spi_read(buf, 1, 1) == SPI_STATUS_OK) { + while (spi_flash_status() != STATUS_READY); + if (buf[0] & SR_WEN) { + break; + } + } + else { + break; + } + } while (1); + } + + return(FLASH_API_OK); +} + +/*********************************************************************/ +/* flash_write_buf() utilizes */ +/* the unlock bypass mode of the flash device. This can remove */ +/* significant overhead from the bulk programming operation, and */ +/* when programming bulk data a sizeable performance increase can be */ +/* observed. */ +/*********************************************************************/ + +static int spi_flash_write(unsigned short sector, int offset, + unsigned char *buffer, int nbytes) +{ + unsigned char buf[FLASH_PAGE_256 + 6]; + unsigned int cmd_length; + unsigned int addr; + int maxwrite; + int pagelimit; + int bytes_written = 0; + +#ifndef _CFE_ + down(&spi_flash_lock); +#endif + + addr = (unsigned int) spi_get_flash_memptr(sector); + addr += offset; + + while (nbytes > 0) { + spi_flash_ub(sector); /* enable write */ + + cmd_length = 0; + buf[cmd_length++] = FLASH_PROG; + if ( addr32 ) + buf[cmd_length++] = (unsigned char)((addr & 0xff000000) >> 24); + buf[cmd_length++] = (unsigned char)((addr & 0x00ff0000) >> 16); + buf[cmd_length++] = (unsigned char)((addr & 0x0000ff00) >> 8); + buf[cmd_length++] = (unsigned char)(addr & 0x000000ff); + + /* set length to the smaller of controller limit (spi_max_op_len) or nbytes + spi_max_op_len considers both controllers */ + maxwrite = (nbytes < (spi_max_op_len - cmd_length)) ? nbytes : (spi_max_op_len - cmd_length); + /* maxwrite is limit to page boundary */ + pagelimit = flash_page_size - (addr & (flash_page_size - 1)); + maxwrite = (maxwrite < pagelimit) ? maxwrite : pagelimit; + + memcpy(&buf[cmd_length], buffer, maxwrite); + my_spi_write(buf, maxwrite + cmd_length); + + while (spi_flash_status() != STATUS_READY); + + buffer += maxwrite; + nbytes -= maxwrite; + addr += maxwrite; + bytes_written += maxwrite; + } + + spi_flash_reset(); + +#ifndef _CFE_ + up(&spi_flash_lock); +#endif + + return( bytes_written ); +} + +/*********************************************************************/ +/* flash_write_buf() utilizes */ +/* the unlock bypass mode of the flash device. This can remove */ +/* significant overhead from the bulk programming operation, and */ +/* when programming bulk data a sizeable performance increase can be */ +/* observed. */ +/*********************************************************************/ +static int spi_flash_write_buf(unsigned short sector, int offset, + unsigned char *buffer, int nbytes) +{ + int ret; + + ret = spi_flash_write(sector, offset, buffer, nbytes); + + if( ret == FLASH_API_ERROR ) + printk( "Flash write error. Verify failed\n" ); + + return( ret ); +} + +/*********************************************************************/ +/* Usefull funtion to return the number of sectors in the device. */ +/* Can be used for functions which need to loop among all the */ +/* sectors, or wish to know the number of the last sector. */ +/*********************************************************************/ + +static int spi_flash_get_numsectors(void) +{ + return meminfo.nsect; +} + +/*********************************************************************/ +/* flash_get_sector_size() is provided for cases in which the size */ +/* of a sector is required by a host application. The sector size */ +/* (in bytes) is returned in the data location pointed to by the */ +/* 'size' parameter. */ +/*********************************************************************/ + +static int spi_flash_get_sector_size(unsigned short sector) +{ + return meminfo.sec[sector].size; +} + +/*********************************************************************/ +/* The purpose of get_flash_memptr() is to return a memory pointer */ +/* which points to the beginning of memory space allocated for the */ +/* flash. All function pointers are then referenced from this */ +/* pointer. */ +/* */ +/* Different systems will implement this in different ways: */ +/* possibilities include: */ +/* - A direct memory pointer */ +/* - A pointer to a memory map */ +/* - A pointer to a hardware port from which the linear */ +/* address is translated */ +/* - Output of an MMU function / service */ +/* */ +/* Also note that this function expects the pointer to a specific */ +/* sector of the device. This can be provided by dereferencing */ +/* the pointer from a translated offset of the sector from a */ +/* global base pointer (e.g. flashptr = base_pointer + sector_offset)*/ +/* */ +/* Important: Many AMD flash devices need both bank and or sector */ +/* address bits to be correctly set (bank address bits are A18-A16, */ +/* and sector address bits are A18-A12, or A12-A15). Flash parts */ +/* which do not need these bits will ignore them, so it is safe to */ +/* assume that every part will require these bits to be set. */ +/*********************************************************************/ + +static unsigned char *spi_get_flash_memptr(unsigned short sector) +{ + unsigned char *memptr = (unsigned char*) + (FLASH_BASE + meminfo.sec[sector].base); + + return (memptr); +} + +static unsigned char *spi_flash_get_memptr(unsigned short sector) +{ + return( spi_get_flash_memptr(sector) ); +} + +/*********************************************************************/ +/* Flash_status return an appropriate status code */ +/*********************************************************************/ + +static int spi_flash_status(void) +{ + unsigned char buf[4]; + int retry = 10; + + /* check device is ready */ + do { + buf[0] = FLASH_RDSR; + if (my_spi_read(buf, 1, 1) == SPI_STATUS_OK) { + if (!(buf[0] & SR_RDY)) { + return STATUS_READY; + } + } else { + return STATUS_ERROR; + } + OSL_DELAY(10); + } while (retry--); + + return STATUS_TIMEOUT; +} + +/*********************************************************************/ +/* flash_get_device_id() return the device id of the component. */ +/*********************************************************************/ + +static unsigned short spi_flash_get_device_id(unsigned short sector) +{ + unsigned char buf[4]; + + buf[0] = FLASH_RDID; + my_spi_read(buf, 1, 3); + while (spi_flash_status() != STATUS_READY); + buf[1] = buf[2]; + + /* return manufacturer code and device code */ + return( *(unsigned short *)&buf[0] ); +} + +/*********************************************************************/ +/* The purpose of flash_get_blk() is to return a the block number */ +/* for a given memory address. */ +/*********************************************************************/ + +static int spi_flash_get_blk(int addr) +{ + int blk_start, i; + int last_blk = spi_flash_get_numsectors(); + int relative_addr = addr - (int) FLASH_BASE; + + for(blk_start=0, i=0; i < relative_addr && blk_start < last_blk; blk_start++) + i += spi_flash_get_sector_size(blk_start); + + if( (unsigned int)i > (unsigned int)relative_addr ) { + blk_start--; // last blk, dec by 1 + } else { + if( blk_start == last_blk ) + { + printk("Address is too big.\n"); + blk_start = -1; + } + } + + return( blk_start ); +} + +/************************************************************************/ +/* The purpose of flash_get_total_size() is to return the total size of */ +/* the flash */ +/************************************************************************/ +static int spi_flash_get_total_size(void) +{ + return totalSize; +} + + +#ifndef _CFE_ +static int __init BcmSpiflash_init(void) +{ + int flashType; + + /* If serial flash is present then register the device. Otherwise do nothing */ + flashType = flash_get_flash_type(); + if ((FLASH_IFC_SPI == flashType) || (FLASH_IFC_HS_SPI == flashType)) + { + /* register the device */ + BcmSpiReserveSlave(spi_flash_busnum, SPI_FLASH_SLAVE_DEV_ID, spi_flash_clock); + bSpiFlashSlaveRes = TRUE; + } + + return 0; +} +module_init(BcmSpiflash_init); + +static void __exit BcmSpiflash_exit(void) +{ + bSpiFlashSlaveRes = FALSE; +} +module_exit(BcmSpiflash_exit); +#endif + diff --git a/shared/opensource/include/bcm963xx/6328_cpu.h b/shared/opensource/include/bcm963xx/6328_cpu.h new file mode 100755 index 0000000..8dfef4c --- /dev/null +++ b/shared/opensource/include/bcm963xx/6328_cpu.h @@ -0,0 +1,150 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +#ifndef __BCM6328_CPU_H +#define __BCM6328_CPU_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* +#************************************************************************ +#* Coprocessor 0 Register Names +#************************************************************************ +*/ +#define C0_BCM_CONFIG $22 + +/* +# Select 1 +# Bit 31: unused +# Bits 30:25 MMU Size (Num TLB entries-1) +# Bits 24:22 ICache sets/way (2^n * 64) +# Bits 21:19 ICache Line size (2^(n+1) bytes) 0=No Icache +# Bits 18:16 ICache Associativity (n+1) way +# Bits 15:13 DCache sets/way (2^n * 64) +# Bits 12:10 DCache Line size (2^(n+1) bytes) 0=No Dcache +# Bits 9:7 DCache Associativity (n+1) way +# Bits 6:4 unused +# Bit 3: 1=At least 1 watch register +# Bit 2: 1=MIPS16 code compression implemented +# Bit 1: 1=EJTAG implemented +# Bit 0: 1=FPU implemented +*/ +#define CP0_CFG_ISMSK (0x7 << 22) +#define CP0_CFG_ISSHF 22 +#define CP0_CFG_ILMSK (0x7 << 19) +#define CP0_CFG_ILSHF 19 +#define CP0_CFG_IAMSK (0x7 << 16) +#define CP0_CFG_IASHF 16 +#define CP0_CFG_DSMSK (0x7 << 13) +#define CP0_CFG_DSSHF 13 +#define CP0_CFG_DLMSK (0x7 << 10) +#define CP0_CFG_DLSHF 10 +#define CP0_CFG_DAMSK (0x7 << 7) +#define CP0_CFG_DASHF 7 + +/* +#************************************************************************ +#* Coprocessor 0 Broadcom Config Register Bits +#************************************************************************ +*/ +#define CP0_BCM_CFG_ICSHEN (0x1 << 31) +#define CP0_BCM_CFG_DCSHEN (0x1 << 30) +#define CP0_BCM_CFG_BTHD (0x1 << 21) +#define CP0_BCM_CFG_CLF (0x1 << 20) +#define CP0_BCM_CFG_NBK (0x1 << 17) + +/* +#************************************************************************ +#* Coprocessor 0 CMT Interrupt Register +#************************************************************************ +*/ +#define CP0_CMT_XIR_4 (0x1 << 31) +#define CP0_CMT_XIR_3 (0x1 << 30) +#define CP0_CMT_XIR_2 (0x1 << 29) +#define CP0_CMT_XIR_1 (0x1 << 28) +#define CP0_CMT_XIR_0 (0x1 << 27) +#define CP0_CMT_SIR_1 (0x1 << 16) +#define CP0_CMT_SIR_0 (0x1 << 15) +#define CP0_CMT_NMIR_TP1 (0x1 << 1) +#define CP0_CMT_NMIR_TP0 (0x1 << 0) + +/* +#************************************************************************ +#* Coprocessor 0 CMT Control Register +#************************************************************************ +*/ +#define CP0_CMT_DSU_TP1 (0x1 << 30) +#define CP0_CMT_TPS_SHFT 16 +#define CP0_CMT_TPS_MASK (0xF << CP0_CMT_TPS_SHFT) +#define CP0_CMT_PRIO_TP1 (0x1 << 5) +#define CP0_CMT_PRIO_TP0 (0x1 << 4) +#define CP0_CMT_RSTSE (0x1 << 0) + +/* +#************************************************************************ +#* Coprocessor 0 CMT Local Register +#************************************************************************ +*/ +#define CP0_CMT_TPID (0x1 << 31) + +/* +#************************************************************************ +#* MIPS Registers +#************************************************************************ +*/ + +#define MIPS_BASE_BOOT 0xbfa00000 +#define MIPS_BASE 0xff400000 + +#define MIPS_RAC_CR0 0x00 // RAC Configuration Register +#define MIPS_RAC_CR1 0x08 // RAC Configuration Register 1 +#define RAC_FLH (1 << 8) +#define RAC_DPF (1 << 6) +#define RAC_NCH (1 << 5) +#define RAC_C_INV (1 << 4) +#define RAC_PF_D (1 << 3) +#define RAC_PF_I (1 << 2) +#define RAC_D (1 << 1) +#define RAC_I (1 << 0) + +#define MIPS_RAC_ARR 0x04 // RAC Address Range Register +#define RAC_UPB_SHFT 16 +#define RAC_LWB_SHFT 0 + +#define MIPS_LMB_CR 0x1C // LMB Control Register +#define LMB_EN (1 << 0) + +#define MIPS_SBR 0x20 // System Base Register + +#define MIPS_TP0_ALT_BV 0x30000 +#define MIPS_TP1_ALT_BV 0x38000 +#define ENABLE_ALT_BV (1 << 19) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/shared/opensource/include/bcm963xx/6328_intr.h b/shared/opensource/include/bcm963xx/6328_intr.h new file mode 100755 index 0000000..e4197d1 --- /dev/null +++ b/shared/opensource/include/bcm963xx/6328_intr.h @@ -0,0 +1,120 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +#ifndef __6328_INTR_H +#define __6328_INTR_H + +#ifdef __cplusplus + extern "C" { +#endif + +#define INTERRUPT_ID_SOFTWARE_0 0 +#define INTERRUPT_ID_SOFTWARE_1 1 + +/*=====================================================================*/ +/* BCM6328 Timer Interrupt Level Assignments */ +/*=====================================================================*/ +#define MIPS_TIMER_INT 7 + +/*=====================================================================*/ +/* Peripheral ISR Table Offset */ +/*=====================================================================*/ +#define INTERNAL_ISR_TABLE_OFFSET 8 +#define INTERNAL_HIGH_ISR_TABLE_OFFSET (INTERNAL_ISR_TABLE_OFFSET + 32) + +/*=====================================================================*/ +/* Logical Peripheral Interrupt IDs */ +/*=====================================================================*/ + +#define INTERRUPT_ID_NAND (INTERNAL_ISR_TABLE_OFFSET + 0) +#define INTERRUPT_ID_PCM (INTERNAL_ISR_TABLE_OFFSET + 1) +#define INTERRUPT_ID_PCM_DMA_0 (INTERNAL_ISR_TABLE_OFFSET + 2) +#define INTERRUPT_ID_PCM_DMA_1 (INTERNAL_ISR_TABLE_OFFSET + 3) +#define INTERRUPT_ID_USBS (INTERNAL_ISR_TABLE_OFFSET + 4) +#define INTERRUPT_ID_USB_CNTL_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 5) +#define INTERRUPT_ID_USB_CNTL_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 6) +#define INTERRUPT_ID_USB_BULK_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 7) +#define INTERRUPT_ID_USB_BULK_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 8) +#define INTERRUPT_ID_USB_ISO_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 9) +#define INTERRUPT_ID_USB_ISO_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 10) +#define INTERRUPT_ID_DG (INTERNAL_ISR_TABLE_OFFSET + 11) +#define INTERRUPT_ID_EPHY (INTERNAL_ISR_TABLE_OFFSET + 12) +#define INTERRUPT_ID_EPHY_ENERGY_0_N (INTERNAL_ISR_TABLE_OFFSET + 13) +#define INTERRUPT_ID_EPHY_ENERGY_1_N (INTERNAL_ISR_TABLE_OFFSET + 14) +#define INTERRUPT_ID_EPHY_ENERGY_2_N (INTERNAL_ISR_TABLE_OFFSET + 15) +#define INTERRUPT_ID_EPHY_ENERGY_3_N (INTERNAL_ISR_TABLE_OFFSET + 16) +#define INTERRUPT_ID_EPHY_ENERGY_0 (INTERNAL_ISR_TABLE_OFFSET + 17) +#define INTERRUPT_ID_EPHY_ENERGY_1 (INTERNAL_ISR_TABLE_OFFSET + 18) +#define INTERRUPT_ID_EPHY_ENERGY_2 (INTERNAL_ISR_TABLE_OFFSET + 19) +#define INTERRUPT_ID_EPHY_ENERGY_3 (INTERNAL_ISR_TABLE_OFFSET + 20) +#define INTERRUPT_ID_XDSL (INTERNAL_ISR_TABLE_OFFSET + 21) +#define INTERRUPT_ID_PCIE_EP (INTERNAL_ISR_TABLE_OFFSET + 22) +#define INTERRUPT_ID_PCIE_RC (INTERNAL_ISR_TABLE_OFFSET + 23) +#define INTERRUPT_ID_EXTERNAL_0 (INTERNAL_ISR_TABLE_OFFSET + 24) +#define INTERRUPT_ID_EXTERNAL_1 (INTERNAL_ISR_TABLE_OFFSET + 25) +#define INTERRUPT_ID_EXTERNAL_2 (INTERNAL_ISR_TABLE_OFFSET + 26) +#define INTERRUPT_ID_EXTERNAL_3 (INTERNAL_ISR_TABLE_OFFSET + 27) +#define INTERRUPT_ID_UART (INTERNAL_ISR_TABLE_OFFSET + 28) +#define INTERRUPT_ID_HS_SPIM (INTERNAL_ISR_TABLE_OFFSET + 29) +#define INTERRUPT_ID_WAKE_ON_IRQ (INTERNAL_ISR_TABLE_OFFSET + 30) +#define INTERRUPT_ID_TIMER (INTERNAL_ISR_TABLE_OFFSET + 31) +#define INTERRUPT_ID_ENETSW_RX_DMA_0 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 0) +#define INTERRUPT_ID_ENETSW_RX_DMA_1 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 1) +#define INTERRUPT_ID_ENETSW_RX_DMA_2 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 2) +#define INTERRUPT_ID_ENETSW_RX_DMA_3 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 3) +#define INTERRUPT_ID_UART1 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 7) +#define INTERRUPT_ID_ENETSW_SYS (INTERNAL_HIGH_ISR_TABLE_OFFSET + 8) +#define INTERRUPT_ID_USBH (INTERNAL_HIGH_ISR_TABLE_OFFSET + 9) +#define INTERRUPT_ID_USBH20 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 10) +#define INTERRUPT_ID_ATM_DMA_0 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 11) +#define INTERRUPT_ID_ATM_DMA_1 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 12) +#define INTERRUPT_ID_ATM_DMA_2 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 13) +#define INTERRUPT_ID_ATM_DMA_3 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 14) +#define INTERRUPT_ID_ATM_DMA_4 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 15) +#define INTERRUPT_ID_ATM_DMA_5 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 16) +#define INTERRUPT_ID_ATM_DMA_6 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 17) +#define INTERRUPT_ID_ATM_DMA_7 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 18) +#define INTERRUPT_ID_ATM_DMA_8 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 19) +#define INTERRUPT_ID_ATM_DMA_9 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 20) +#define INTERRUPT_ID_ATM_DMA_10 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 21) +#define INTERRUPT_ID_ATM_DMA_11 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 22) +#define INTERRUPT_ID_ATM_DMA_12 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 23) +#define INTERRUPT_ID_ATM_DMA_13 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 24) +#define INTERRUPT_ID_ATM_DMA_14 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 25) +#define INTERRUPT_ID_ATM_DMA_15 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 26) +#define INTERRUPT_ID_ATM_DMA_16 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 27) +#define INTERRUPT_ID_ATM_DMA_17 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 28) +#define INTERRUPT_ID_ATM_DMA_18 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 29) +#define INTERRUPT_ID_ATM_DMA_19 (INTERNAL_HIGH_ISR_TABLE_OFFSET + 30) +#define INTERRUPT_ID_SAR (INTERNAL_HIGH_ISR_TABLE_OFFSET + 31) + +#define INTERRUPT_ID_LAST INTERRUPT_ID_SAR + +#ifdef __cplusplus + } +#endif + +#endif /* __BCM6328_H */ + + diff --git a/shared/opensource/include/bcm963xx/6328_map_part.h b/shared/opensource/include/bcm963xx/6328_map_part.h new file mode 100755 index 0000000..be199a5 --- /dev/null +++ b/shared/opensource/include/bcm963xx/6328_map_part.h @@ -0,0 +1,1325 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +#ifndef __BCM6328_MAP_H +#define __BCM6328_MAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bcmtypes.h" + +#define PERF_BASE 0xb0000000 /* chip control registers */ +#define TIMR_BASE 0xb0000040 /* timer registers */ +#define GPIO_BASE 0xb0000080 /* gpio registers */ +#define UART_BASE 0xb0000100 /* uart registers */ +#define UART1_BASE 0xb0000120 /* uart registers */ +#define NAND_REG_BASE 0xb0000200 /* NAND registers */ +#define NAND_CACHE_BASE 0xb0000400 +#define LED_BASE 0xb0000800 /* LED control registers */ +#define HSSPIM_BASE 0xb0001000 /* High-Speed SPI registers */ +#define MISC_BASE 0xb0001800 /* Miscellaneous Registers */ +#define USB_CTL_BASE 0xb0002400 /* USB 2.0 device control registers */ +#define USB_EHCI_BASE 0x10002500 /* USB host registers */ +#define USB_OHCI_BASE 0x10002600 /* USB host registers */ +#define USBH_CFG_BASE 0xb0002700 +#define DDR_BASE 0xb0003000 /* Memory control registers */ +#define SAR_DMA_BASE 0xb000b800 /* ATM SAR DMA control registers */ +#define PCIE_BASE 0xb0e40000 + +typedef struct DDRPhyControl { + uint32 REVISION; /* 0x00 */ + uint32 CLK_PM_CTRL; /* 0x04 */ + uint32 unused0[2]; /* 0x08-0x10 */ + uint32 PLL_STATUS; /* 0x10 */ + uint32 PLL_CONFIG; /* 0x14 */ + uint32 PLL_PRE_DIVIDER; /* 0x18 */ + uint32 PLL_DIVIDER; /* 0x1c */ + uint32 PLL_CONTROL1; /* 0x20 */ + uint32 PLL_CONTROL2; /* 0x24 */ + uint32 PLL_SS_EN; /* 0x28 */ + uint32 PLL_SS_CFG; /* 0x2c */ + uint32 STATIC_VDL_OVERRIDE; /* 0x30 */ + uint32 DYNAMIC_VDL_OVERRIDE; /* 0x34 */ + uint32 IDLE_PAD_CONTROL; /* 0x38 */ + uint32 ZQ_PVT_COMP_CTL; /* 0x3c */ + uint32 DRIVE_PAD_CTL; /* 0x40 */ + uint32 CLOCK_REG_CONTROL; /* 0x44 */ + uint32 unused1[46]; +} DDRPhyControl; + +typedef struct DDRPhyByteLaneControl { + uint32 REVISION; /* 0x00 */ + uint32 VDL_CALIBRATE; /* 0x04 */ + uint32 VDL_STATUS; /* 0x08 */ + uint32 unused; /* 0x0c */ + uint32 VDL_OVERRIDE_0; /* 0x10 */ + uint32 VDL_OVERRIDE_1; /* 0x14 */ + uint32 VDL_OVERRIDE_2; /* 0x18 */ + uint32 VDL_OVERRIDE_3; /* 0x1c */ + uint32 VDL_OVERRIDE_4; /* 0x20 */ + uint32 VDL_OVERRIDE_5; /* 0x24 */ + uint32 VDL_OVERRIDE_6; /* 0x28 */ + uint32 VDL_OVERRIDE_7; /* 0x2c */ + uint32 READ_CONTROL; /* 0x30 */ + uint32 READ_FIFO_STATUS; /* 0x34 */ + uint32 READ_FIFO_CLEAR; /* 0x38 */ + uint32 IDLE_PAD_CONTROL; /* 0x3c */ + uint32 DRIVE_PAD_CTL; /* 0x40 */ + uint32 CLOCK_PAD_DISABLE; /* 0x44 */ + uint32 WR_PREAMBLE_MODE; /* 0x48 */ + uint32 CLOCK_REG_CONTROL; /* 0x4C */ + uint32 unused0[44]; +} DDRPhyByteLaneControl; + +typedef struct DDRControl { + uint32 CNFG; /* 0x000 */ + uint32 CSST; /* 0x004 */ + uint32 CSEND; /* 0x008 */ + uint32 unused; /* 0x00c */ + uint32 ROW00_0; /* 0x010 */ + uint32 ROW00_1; /* 0x014 */ + uint32 ROW01_0; /* 0x018 */ + uint32 ROW01_1; /* 0x01c */ + uint32 unused0[4]; + uint32 ROW20_0; /* 0x030 */ + uint32 ROW20_1; /* 0x034 */ + uint32 ROW21_0; /* 0x038 */ + uint32 ROW21_1; /* 0x03c */ + uint32 unused1[4]; + uint32 COL00_0; /* 0x050 */ + uint32 COL00_1; /* 0x054 */ + uint32 COL01_0; /* 0x058 */ + uint32 COL01_1; /* 0x05c */ + uint32 unused2[4]; + uint32 COL20_0; /* 0x070 */ + uint32 COL20_1; /* 0x074 */ + uint32 COL21_0; /* 0x078 */ + uint32 COL21_1; /* 0x07c */ + uint32 unused3[4]; + uint32 BNK10; /* 0x090 */ + uint32 BNK32; /* 0x094 */ + uint32 unused4[26]; + uint32 DCMD; /* 0x100 */ +#define DCMD_CS1 (1 << 5) +#define DCMD_CS0 (1 << 4) +#define DCMD_SET_SREF 4 + uint32 DMODE_0; /* 0x104 */ + uint32 DMODE_1; /* 0x108 */ +#define DMODE_1_DRAMSLEEP (1 << 11) + uint32 CLKS; /* 0x10c */ + uint32 ODT; /* 0x110 */ + uint32 TIM1_0; /* 0x114 */ + uint32 TIM1_1; /* 0x118 */ + uint32 TIM2; /* 0x11c */ + uint32 CTL_CRC; /* 0x120 */ + uint32 DOUT_CRC; /* 0x124 */ + uint32 DIN_CRC; /* 0x128 */ + uint32 unused5[53]; + + DDRPhyControl PhyControl; /* 0x200 */ + DDRPhyByteLaneControl PhyByteLane0Control; /* 0x300 */ + DDRPhyByteLaneControl PhyByteLane1Control; /* 0x400 */ + DDRPhyByteLaneControl PhyByteLane2Control; /* 0x500 */ + DDRPhyByteLaneControl PhyByteLane3Control; /* 0x600 */ + uint32 unused6[64]; + + uint32 GCFG; /* 0x800 */ + uint32 LBIST_CFG; /* 0x804 */ + uint32 LBIST_SEED; /* 0x808 */ + uint32 ARB; /* 0x80c */ + uint32 PI_GCF; /* 0x810 */ + uint32 PI_UBUS_CTL; /* 0x814 */ + uint32 PI_MIPS_CTL; /* 0x818 */ + uint32 PI_DSL_MIPS_CTL; /* 0x81c */ + uint32 PI_DSL_PHY_CTL; /* 0x820 */ + uint32 PI_UBUS_ST; /* 0x824 */ + uint32 PI_MIPS_ST; /* 0x828 */ + uint32 PI_DSL_MIPS_ST; /* 0x82c */ + uint32 PI_DSL_PHY_ST; /* 0x830 */ + uint32 PI_UBUS_SMPL; /* 0x834 */ + uint32 TESTMODE; /* 0x838 */ + uint32 TEST_CFG1; /* 0x83c */ + uint32 TEST_PAT; /* 0x840 */ + uint32 TEST_COUNT; /* 0x844 */ + uint32 TEST_CURR_COUNT; /* 0x848 */ + uint32 TEST_ADDR_UPDT; /* 0x84c */ + uint32 TEST_ADDR; /* 0x850 */ + uint32 TEST_DATA0; /* 0x854 */ + uint32 TEST_DATA1; /* 0x858 */ + uint32 TEST_DATA2; /* 0x85c */ + uint32 TEST_DATA3; /* 0x860 */ +} DDRControl; + +#define DDR ((volatile DDRControl * const) DDR_BASE) + +/* +** Peripheral Controller +*/ + +#define IRQ_BITS 64 +typedef struct { + uint64 IrqMask; + uint64 IrqStatus; +} IrqControl_t; + +typedef struct PerfControl { + uint32 RevID; /* (00) word 0 */ + uint32 blkEnables; /* (04) word 1 */ +#define ROBOSW_CLK_EN (1 << 11) +#define PCIE_CLK_EN (1 << 10) +#define HS_SPI_CLK_EN (1 << 9) +#define USBH_CLK_EN (1 << 8) +#define USBD_CLK_EN (1 << 7) +#define PCM_CLK_EN (1 << 6) +#define SAR_CLK_EN (1 << 5) +#define MIPS_CLK_EN (1 << 4) +#define ADSL_CLK_EN (1 << 3) +#define ADSL_AFE_EN (1 << 2) +#define ADSL_QPROC_EN (1 << 1) +#define PHYMIPS_CLK_EN (1 << 0) + + uint32 unused0; /* (08) word 2 */ + uint32 deviceTimeoutEn; /* (0c) word 3 */ + uint32 softResetB; /* (10) word 4 */ +#define SOFT_RST_PCIE_HARD (1 << 10) +#define SOFT_RST_PCIE_EXT (1 << 9) +#define SOFT_RST_PCIE (1 << 8) +#define SOFT_RST_PCIE_CORE (1 << 7) +#define SOFT_RST_PCM (1 << 6) +#define SOFT_RST_USBH (1 << 5) +#define SOFT_RST_USBD (1 << 4) +#define SOFT_RST_SWITCH (1 << 3) +#define SOFT_RST_SAR (1 << 2) +#define SOFT_RST_EPHY (1 << 1) +#define SOFT_RST_SPI (1 << 0) + + uint32 diagControl; /* (14) word 5 */ + uint32 ExtIrqCfg; /* (18) word 6*/ + uint32 unused1; /* (1c) word 7 */ +#define EI_SENSE_SHFT 0 +#define EI_STATUS_SHFT 4 +#define EI_CLEAR_SHFT 8 +#define EI_MASK_SHFT 12 +#define EI_INSENS_SHFT 16 +#define EI_LEVEL_SHFT 20 + + IrqControl_t IrqControl[2]; +} PerfControl; + +#define PERF ((volatile PerfControl * const) PERF_BASE) + +/* +** Timer +*/ +typedef struct Timer { + uint16 unused0; + byte TimerMask; +#define TIMER0EN 0x01 +#define TIMER1EN 0x02 +#define TIMER2EN 0x04 + byte TimerInts; +#define TIMER0 0x01 +#define TIMER1 0x02 +#define TIMER2 0x04 +#define WATCHDOG 0x08 + uint32 TimerCtl0; + uint32 TimerCtl1; + uint32 TimerCtl2; +#define TIMERENABLE 0x80000000 +#define RSTCNTCLR 0x40000000 + uint32 TimerCnt0; + uint32 TimerCnt1; + uint32 TimerCnt2; + uint32 WatchDogDefCount; + + /* Write 0xff00 0x00ff to Start timer + * Write 0xee00 0x00ee to Stop and re-load default count + * Read from this register returns current watch dog count + */ + uint32 WatchDogCtl; + + /* Number of 50-MHz ticks for WD Reset pulse to last */ + uint32 WDResetCount; + + uint32 SoftRst; +#define SOFT_RESET 0x00000001 // 0 +} Timer; + +#define TIMER ((volatile Timer * const) TIMR_BASE) + +/* +** UART +*/ +typedef struct UartChannel { + byte unused0; + byte control; +#define BRGEN 0x80 /* Control register bit defs */ +#define TXEN 0x40 +#define RXEN 0x20 +#define LOOPBK 0x10 +#define TXPARITYEN 0x08 +#define TXPARITYEVEN 0x04 +#define RXPARITYEN 0x02 +#define RXPARITYEVEN 0x01 + + byte config; +#define XMITBREAK 0x40 +#define BITS5SYM 0x00 +#define BITS6SYM 0x10 +#define BITS7SYM 0x20 +#define BITS8SYM 0x30 +#define ONESTOP 0x07 +#define TWOSTOP 0x0f + /* 4-LSBS represent STOP bits/char + * in 1/8 bit-time intervals. Zero + * represents 1/8 stop bit interval. + * Fifteen represents 2 stop bits. + */ + byte fifoctl; +#define RSTTXFIFOS 0x80 +#define RSTRXFIFOS 0x40 + /* 5-bit TimeoutCnt is in low bits of this register. + * This count represents the number of characters + * idle times before setting receive Irq when below threshold + */ + uint32 baudword; + /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate + */ + + byte txf_levl; /* Read-only fifo depth */ + byte rxf_levl; /* Read-only fifo depth */ + byte fifocfg; /* Upper 4-bits are TxThresh, Lower are + * RxThreshold. Irq can be asserted + * when rx fifo> thresh, txfifo thresh, txfifo thresh, txfifo thresh, txfifo +#include +#include +#include +#include +#include + +struct bcmspi +{ + spinlock_t lock; + char * devName; + int irq; + unsigned bus_num; + unsigned num_chipselect; + u8 stopping; + struct list_head queue; + struct platform_device *pdev; + struct spi_transfer *curTrans; +}; +#endif + +#define BCM_SPI_READ 0 +#define BCM_SPI_WRITE 1 +#define BCM_SPI_FULL 2 + +#endif /* __BCM_SPI_H__ */ + diff --git a/shared/opensource/include/bcm963xx/bcmSpiRes.h b/shared/opensource/include/bcm963xx/bcmSpiRes.h new file mode 100755 index 0000000..cb39756 --- /dev/null +++ b/shared/opensource/include/bcm963xx/bcmSpiRes.h @@ -0,0 +1,101 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +#ifndef __BCMSPIRES_H__ +#define __BCMSPIRES_H__ + +#ifndef _CFE_ +#include +#endif + +#define SPI_STATUS_OK (0) +#define SPI_STATUS_INVALID_LEN (-1) +#define SPI_STATUS_ERR (-2) + +/* legacy and HS controllers can coexist - use bus num to differentiate */ +#define LEG_SPI_BUS_NUM 0 +#define HS_SPI_BUS_NUM 1 + +#define LEG_SPI_CLOCK_DEF 2 + +#if defined(_BCM96816_) || defined(CONFIG_BCM96816) || defined(_BCM96362_) || defined(CONFIG_BCM96362) +#define HS_SPI_PLL_FREQ 400000000 +#else +#define HS_SPI_PLL_FREQ 133333333 +#endif +#define HS_SPI_CLOCK_DEF 40000000 +#define HS_SPI_BUFFER_LEN 512 + +/* used to specify ctrlState for the interface BcmSpiReserveSlave2 + SPI_CONTROLLER_STATE_SET is used to differentiate a value of 0 which results in + the controller using default values and the case where CPHA_EXT, GATE_CLK_SSOFF, + CLK_POLARITY, and ASYNC_CLOCK all need to be 0 + + SPI MODE sets the values for CPOL and CPHA + SPI_CONTROLLER_STATE_CPHA_EXT will extend these modes +CPOL = 0 -> base value of clock is 0 +CPHA = 0, CPHA_EXT = 0 -> latch data on rising edge, launch data on falling edge +CPHA = 1, CPHA_EXT = 0 -> latch data on falling edge, launch data on rising edge +CPHA = 0, CPHA_EXT = 1 -> latch data on rising edge, launch data on rising edge +CPHA = 1, CPHA_EXT = 1 -> latch data on falling edge, launch data on falling edge + +CPOL = 1 -> base value of clock is 1 +CPHA = 0, CPHA_EXT = 0 -> latch data on falling edge, launch data on rising edge +CPHA = 1, CPHA_EXT = 0 -> latch data on rising edge, launch data on falling edge +CPHA = 0, CPHA_EXT = 1 -> latch data on falling edge, launch data on falling edge +CPHA = 1, CPHA_EXT = 1 -> latch data on rising edge, launch data on rising edge +*/ +#define SPI_CONTROLLER_STATE_SET (1 << 31) +#define SPI_CONTROLLER_STATE_CPHA_EXT (1 << 30) +#define SPI_CONTROLLER_STATE_GATE_CLK_SSOFF (1 << 29) +#define SPI_CONTROLLER_STATE_CLK_POLARITY (1 << 28) +#define SPI_CONTROLLER_STATE_ASYNC_CLOCK (1 << 27) + +/* set mode and controller state based on CHIP defaults + these values do not matter for the legacy controller */ +#if defined(CONFIG_BCM96816) +#define SPI_MODE_DEFAULT SPI_MODE_1 +#define SPI_CONTROLLER_STATE_DEFAULT (SPI_CONTROLLER_STATE_GATE_CLK_SSOFF | SPI_CONTROLLER_STATE_CPHA_EXT) +#elif (defined(CONFIG_BCM96362) || defined(CONFIG_BCM96328)) +#define SPI_MODE_DEFAULT SPI_MODE_0 +#define SPI_CONTROLLER_STATE_DEFAULT (SPI_CONTROLLER_STATE_GATE_CLK_SSOFF) +#else +#define SPI_MODE_DEFAULT SPI_MODE_3 +#define SPI_CONTROLLER_STATE_DEFAULT (0) +#endif + +#ifndef _CFE_ +int BcmSpiReserveSlave(int busNum, int slaveId, int maxFreq); +int BcmSpiReserveSlave2(int busNum, int slaveId, int maxFreq, int mode, int ctrlState); +int BcmSpiReleaseSlave(int busNum, int slaveId); +int BcmSpiSyncTrans(unsigned char *txBuf, unsigned char *rxBuf, int prependcnt, int nbytes, int busNum, int slaveId); +#endif + +int BcmSpi_SetFlashCtrl( int, int, int, int, int ); +int BcmSpi_GetMaxRWSize( int ); +int BcmSpi_Read(unsigned char *, int, int, int, int, int); +int BcmSpi_Write(unsigned char *, int, int, int, int); + +#endif /* __BCMSPIRES_H__ */ + diff --git a/shared/opensource/include/bcm963xx/bcmTag.h b/shared/opensource/include/bcm963xx/bcmTag.h new file mode 100755 index 0000000..8a1ca24 --- /dev/null +++ b/shared/opensource/include/bcm963xx/bcmTag.h @@ -0,0 +1,175 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +//************************************************************************************** +// File Name : bcmTag.h +// +// Description: add tag with validation system to the firmware image file to be uploaded +// via http +// +// Created : 02/28/2002 seanl +//************************************************************************************** + +#ifndef _BCMTAG_H_ +#define _BCMTAG_H_ + + +#define BCM_SIG_1 "Broadcom Corporation" +#define BCM_SIG_2 "ver. 2.0" // was "firmware version 2.0" now it is split 6 char out for chip id. + +#define BCM_TAG_VER "6" + +// file tag (head) structure all is in clear text except validationTokens (crc, md5, sha1, etc). Total: 128 unsigned chars +#define TAG_LEN 256 +#define TAG_VER_LEN 4 +#define SIG_LEN 20 +#define SIG_LEN_2 14 // Original second SIG = 20 is now devided into 14 for SIG_LEN_2 and 6 for CHIP_ID +#define CHIP_ID_LEN 6 +#define IMAGE_LEN 10 +#define ADDRESS_LEN 12 +#define FLAG_LEN 2 +#define TOKEN_LEN 20 +#define BOARD_ID_LEN 16 +#define RESERVED_LEN (TAG_LEN - TAG_VER_LEN - SIG_LEN - SIG_LEN_2 - CHIP_ID_LEN - BOARD_ID_LEN - \ + (4*IMAGE_LEN) - (3*ADDRESS_LEN) - (3*FLAG_LEN) - (2*TOKEN_LEN)) + + +// TAG for downloadable image (kernel plus file system) +typedef struct _FILE_TAG +{ + char tagVersion[TAG_VER_LEN]; // tag version. Will be 2 here. + char signiture_1[SIG_LEN]; // text line for company info + char signiture_2[SIG_LEN_2]; // additional info (can be version number) + char chipId[CHIP_ID_LEN]; // chip id + char boardId[BOARD_ID_LEN]; // board id + char bigEndian[FLAG_LEN]; // if = 1 - big, = 0 - little endia of the host + char totalImageLen[IMAGE_LEN]; // the sum of all the following length + char cfeAddress[ADDRESS_LEN]; // if non zero, cfe starting address + char cfeLen[IMAGE_LEN]; // if non zero, cfe size in clear ASCII text. + char rootfsAddress[ADDRESS_LEN]; // if non zero, filesystem starting address + char rootfsLen[IMAGE_LEN]; // if non zero, filesystem size in clear ASCII text. + char kernelAddress[ADDRESS_LEN]; // if non zero, kernel starting address + char kernelLen[IMAGE_LEN]; // if non zero, kernel size in clear ASCII text. + char imageSequence[FLAG_LEN * 2]; // incrments everytime an image is flashed + char reserved[RESERVED_LEN]; // reserved for later use + char imageValidationToken[TOKEN_LEN];// image validation token - can be crc, md5, sha; for + // now will be 4 unsigned char crc + char tagValidationToken[TOKEN_LEN]; // validation token for tag(from signiture_1 to end of // mageValidationToken) +} FILE_TAG, *PFILE_TAG; + +/* Whole flash image TAG definitions. */ +#define WFI_VERSION 0x00005731 +#define WFI_ANY_VERS_MASK 0x0000ff00 +#define WFI_ANY_VERS 0x00005700 +#define WFI_NOR_FLASH 1 +#define WFI_NAND16_FLASH 2 +#define WFI_NAND128_FLASH 3 + +/* TAG at end of whole flash ".w" image. Size must be TOKEN_LEN. */ +typedef struct _WFI_TAG +{ + unsigned long wfiCrc; + unsigned long wfiVersion; + unsigned long wfiChipId; + unsigned long wfiFlashType; + unsigned long wfiReserved; +} WFI_TAG, *PWFI_TAG; + +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */ +#define CRC_LEN 4 + +// only included if for bcmTag.exe program +#ifdef BCMTAG_EXE_USE + +static unsigned long Crc32_table[256] = { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +}; +#endif // BCMTAG_USE + + +#endif // _BCMTAG_H_ + diff --git a/shared/opensource/include/bcm963xx/bcm_hwdefs.h b/shared/opensource/include/bcm963xx/bcm_hwdefs.h new file mode 100755 index 0000000..07ecc29 --- /dev/null +++ b/shared/opensource/include/bcm963xx/bcm_hwdefs.h @@ -0,0 +1,193 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL?, available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/***********************************************************************/ +/* */ +/* MODULE: bcm_hwdefs.h */ +/* PURPOSE: Define all base device addresses and HW specific macros. */ +/* */ +/***********************************************************************/ +#ifndef _BCM_HWDEFS_H +#define _BCM_HWDEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define DYING_GASP_API + +/*****************************************************************************/ +/* Physical Memory Map */ +/*****************************************************************************/ + +#define PHYS_DRAM_BASE 0x00000000 /* Dynamic RAM Base */ +#if defined(CONFIG_BRCM_IKOS) +#define PHYS_FLASH_BASE 0x18000000 /* Flash Memory */ +#else +#define PHYS_FLASH_BASE 0x1FC00000 /* Flash Memory */ +#endif + +/*****************************************************************************/ +/* Note that the addresses above are physical addresses and that programs */ +/* have to use converted addresses defined below: */ +/*****************************************************************************/ +#define DRAM_BASE (0x80000000 | PHYS_DRAM_BASE) /* cached DRAM */ +#define DRAM_BASE_NOCACHE (0xA0000000 | PHYS_DRAM_BASE) /* uncached DRAM */ + +/* Binary images are always built for a standard MIPS boot address */ +#define IMAGE_BASE (0xA0000000 | PHYS_FLASH_BASE) + +/* Some chips don't support alternative boot vector */ +#if defined(CONFIG_BRCM_IKOS) +#define FLASH_BASE (0xA0000000 | PHYS_FLASH_BASE) /* uncached Flash */ +#define BOOT_OFFSET 0 +#else +#if defined(_BCM96328_) || defined(CONFIG_BCM96328) || defined(_BCM96362_) || defined(CONFIG_BCM96362) +#define FLASH_BASE 0xB8000000 +#else +#define FLASH_BASE (0xA0000000 | (MPI->cs[0].base & 0xFFFFFF00)) +#endif +#define BOOT_OFFSET (FLASH_BASE - IMAGE_BASE) +#endif + +/*****************************************************************************/ +/* Select the PLL value to get the desired CPU clock frequency. */ +/*****************************************************************************/ +#define FPERIPH 50000000 + +/*****************************************************************************/ +/* Board memory type offset */ +/*****************************************************************************/ +#define ONEK 1024 +#define FLASH_LENGTH_BOOT_ROM (64*ONEK) + +#define PROJECT_ID_LEN 7 /* Foxconn added by zacker, 02/29/2008, strlen("U12H094") */ +#ifdef _CFE_ +#define FLASH_SIZE 32 * 1024 * 1024 +#endif +#define BOARD_DATA_ADDR (FLASH_BASE + FLASH_SIZE - 0x20000) +#define BOARD_FOXNVRAM_ADDR (FLASH_BASE + FLASH_SIZE - 0x10000) +#define FOX_BOARD_ID_MAX_LEN 64 +#define BOARD_ID "U12L161" +/*****************************************************************************/ +/* NVRAM Offset and definition */ +/*****************************************************************************/ +#define NVRAM_SECTOR 0 +#define NVRAM_DATA_OFFSET 0x0580 +#define NVRAM_DATA_ID 0x0f1e2d3c // This is only for backwards compatability + +#define NVRAM_LENGTH ONEK // 1k nvram +#define NVRAM_VERSION_NUMBER 6 +#define NVRAM_FULL_LEN_VERSION_NUMBER 5 /* version in which the checksum was + placed at the end of the NVRAM + structure */ + +#define NVRAM_BOOTLINE_LEN 256 +#define NVRAM_BOARD_ID_STRING_LEN 16 +#define NVRAM_MAC_ADDRESS_LEN 6 + +#define NVRAM_GPON_SERIAL_NUMBER_LEN 13 +#define NVRAM_GPON_PASSWORD_LEN 11 + +#define NVRAM_WLAN_PARAMS_LEN 256 +#define NVRAM_WPS_DEVICE_PIN_LEN 8 + +#define THREAD_NUM_ADDRESS_OFFSET (NVRAM_DATA_OFFSET + 4 + NVRAM_BOOTLINE_LEN + NVRAM_BOARD_ID_STRING_LEN) +#define THREAD_NUM_ADDRESS (0x80000000 + THREAD_NUM_ADDRESS_OFFSET) + +#define DEFAULT_BOOTLINE "e=192.168.1.1:ffffff00 h=192.168.1.100 g= r=f f=vmlinux i=bcm963xx_fs_kernel d=1 p=0 " +#define DEFAULT_BOARD_IP "192.168.1.1" +#define DEFAULT_MAC_NUM 10 +#define DEFAULT_BOARD_MAC "00:10:18:00:00:00" +#define DEFAULT_TP_NUM 0 +#define DEFAULT_PSI_SIZE 24 +#define DEFAULT_GPON_SN "BRCM12345678" +#define DEFAULT_GPON_PW " " + +#define DEFAULT_WPS_DEVICE_PIN "12345670" + +#define DEFAULT_VOICE_BOARD_ID "NONE" + +#define NVRAM_MAC_COUNT_MAX 32 +#define NVRAM_MAX_PSI_SIZE 64 +#define NVRAM_MAX_SYSLOG_SIZE 256 + +#define NP_BOOT 0 +#define NP_ROOTFS_1 1 +#define NP_ROOTFS_2 2 +#define NP_DATA 3 +#define NP_BBT 4 +#define NP_TOTAL 5 + +#define NAND_DATA_SIZE_KB 1024 +#define NAND_BBT_THRESHOLD_KB (512 * 1024) +#define NAND_BBT_SMALL_SIZE_KB 1024 +#define NAND_BBT_BIG_SIZE_KB 4096 + +#define NAND_CFE_RAM_NAME "cferam.000" + +#ifndef _LANGUAGE_ASSEMBLY +typedef struct +{ + unsigned long ulVersion; + char szBootline[NVRAM_BOOTLINE_LEN]; + char szBoardId[NVRAM_BOARD_ID_STRING_LEN]; + unsigned long ulMainTpNum; + unsigned long ulPsiSize; + unsigned long ulNumMacAddrs; + unsigned char ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN]; + char pad; + char backupPsi; /**< if 0x01, allocate space for a backup PSI */ + unsigned long ulCheckSumV4; + char gponSerialNumber[NVRAM_GPON_SERIAL_NUMBER_LEN]; + char gponPassword[NVRAM_GPON_PASSWORD_LEN]; + char wpsDevicePin[NVRAM_WPS_DEVICE_PIN_LEN]; + char wlanParams[NVRAM_WLAN_PARAMS_LEN]; + unsigned long ulSyslogSize; /**< number of KB to allocate for persistent syslog */ + unsigned long ulNandPartOfsKb[NP_TOTAL]; + unsigned long ulNandPartSizeKb[NP_TOTAL]; + char szVoiceBoardId[NVRAM_BOARD_ID_STRING_LEN]; + unsigned long afeId[2]; + char szFirmwareUpgradeBoardId[32]; /* foxconn added Bob, 07/12/2010, for TFTP firmware upgrade */ + char chUnused[332]; /* reduce array size from 364 to 332, total size of NVRAM_DATA is unchanged, Bob, 07/12/2010 */ + unsigned long ulCheckSum; +} NVRAM_DATA, *PNVRAM_DATA; +#endif + +#define BOOT_LATEST_IMAGE '0' +#define BOOT_PREVIOUS_IMAGE '1' + +/*****************************************************************************/ +/* Misc Offsets */ +/*****************************************************************************/ +#define CFE_VERSION_OFFSET 0x0570 +#define CFE_VERSION_MARK_SIZE 5 +#define CFE_VERSION_SIZE 5 + +#ifdef __cplusplus +} +#endif + +#endif /* _BCM_HWDEFS_H */ + diff --git a/shared/opensource/include/bcm963xx/bcmnetlink.h b/shared/opensource/include/bcm963xx/bcmnetlink.h new file mode 100755 index 0000000..e5fc77f --- /dev/null +++ b/shared/opensource/include/bcm963xx/bcmnetlink.h @@ -0,0 +1,47 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/************************************************************************** + * File Name : bcmnetlink.h + * + * Description: This file defines broadcom specific netlink message types + ***************************************************************************/ +#ifndef _BCMNETLINK_H +#define _BCMNETLINK_H + +#include + +#ifndef NETLINK_BRCM_MONITOR +#define NETLINK_BRCM_MONITOR 25 +#endif + +/* message types exchanged using NETLINK_BRCM_MONITOR */ +#define MSG_NETLINK_BRCM_WAKEUP_MONITOR_TASK 0X1000 + +#define MSG_NETLINK_BRCM_LINK_STATUS_CHANGED 0X2000 + + +extern void kerSysSendtoMonitorTask(int msgType, char *msgData, int msgDataLen); + +#endif /*_BCMNETLINK_H */ diff --git a/shared/opensource/include/bcm963xx/boardparms.h b/shared/opensource/include/bcm963xx/boardparms.h new file mode 100755 index 0000000..7fec91c --- /dev/null +++ b/shared/opensource/include/bcm963xx/boardparms.h @@ -0,0 +1,453 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/************************************************************************** + * File Name : boardparms.h + * + * Description: This file contains definitions and function prototypes for + * the BCM63xx board parameter access functions. + * + * Updates : 07/14/2003 Created. + ***************************************************************************/ + +#if !defined(_BOARDPARMS_H) +#define _BOARDPARMS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Return codes. */ +#define BP_SUCCESS 0 +#define BP_BOARD_ID_NOT_FOUND 1 +#define BP_VALUE_NOT_DEFINED 2 +#define BP_BOARD_ID_NOT_SET 3 + +/* Values for EthernetMacInfo PhyType. */ +#define BP_ENET_NO_PHY 0 +#define BP_ENET_INTERNAL_PHY 1 +#define BP_ENET_EXTERNAL_SWITCH 2 +#define BP_ENET_SWITCH_VIA_INTERNAL_PHY 3 /* it is for cpu internal phy connects to port 4 of 5325e */ + +/* Values for EthernetMacInfo Configuration type. */ +#define BP_ENET_CONFIG_MDIO 0 /* Internal PHY, External PHY, Switch+(no GPIO, no SPI, no MDIO Pseudo phy */ +#define BP_ENET_CONFIG_MDIO_PSEUDO_PHY 1 +#define BP_ENET_CONFIG_SPI_SSB_0 2 +#define BP_ENET_CONFIG_SPI_SSB_1 3 +#define BP_ENET_CONFIG_SPI_SSB_2 4 +#define BP_ENET_CONFIG_SPI_SSB_3 5 +#define BP_ENET_CONFIG_MMAP 6 +#define BP_ENET_CONFIG_GPIO_MDIO 7 /* use GPIO to simulate MDC/MDIO */ + +/* Values for VoIPDSPInfo DSPType. */ +#define BP_VOIP_NO_DSP 0 +#define BP_VOIP_DSP 1 +#define BP_VOIP_MIPS 2 + +/* Values for GPIO pin assignments (AH = Active High, AL = Active Low). */ +#define BP_GPIO_NUM_MASK 0x00FF +#define BP_ACTIVE_MASK 0x8000 +#define BP_ACTIVE_HIGH 0x0000 +#define BP_ACTIVE_LOW 0x8000 +#define BP_GPIO_SERIAL 0x4000 + +#define BP_GPIO_0_AH (0) +#define BP_GPIO_0_AL (0 | BP_ACTIVE_LOW) +#define BP_GPIO_1_AH (1) +#define BP_GPIO_1_AL (1 | BP_ACTIVE_LOW) +#define BP_GPIO_2_AH (2) +#define BP_GPIO_2_AL (2 | BP_ACTIVE_LOW) +#define BP_GPIO_3_AH (3) +#define BP_GPIO_3_AL (3 | BP_ACTIVE_LOW) +#define BP_GPIO_4_AH (4) +#define BP_GPIO_4_AL (4 | BP_ACTIVE_LOW) +#define BP_GPIO_5_AH (5) +#define BP_GPIO_5_AL (5 | BP_ACTIVE_LOW) +#define BP_GPIO_6_AH (6) +#define BP_GPIO_6_AL (6 | BP_ACTIVE_LOW) +#define BP_GPIO_7_AH (7) +#define BP_GPIO_7_AL (7 | BP_ACTIVE_LOW) +#define BP_GPIO_8_AH (8) +#define BP_GPIO_8_AL (8 | BP_ACTIVE_LOW) +#define BP_GPIO_9_AH (9) +#define BP_GPIO_9_AL (9 | BP_ACTIVE_LOW) +#define BP_GPIO_10_AH (10) +#define BP_GPIO_10_AL (10 | BP_ACTIVE_LOW) +#define BP_GPIO_11_AH (11) +#define BP_GPIO_11_AL (11 | BP_ACTIVE_LOW) +#define BP_GPIO_12_AH (12) +#define BP_GPIO_12_AL (12 | BP_ACTIVE_LOW) +#define BP_GPIO_13_AH (13) +#define BP_GPIO_13_AL (13 | BP_ACTIVE_LOW) +#define BP_GPIO_14_AH (14) +#define BP_GPIO_14_AL (14 | BP_ACTIVE_LOW) +#define BP_GPIO_15_AH (15) +#define BP_GPIO_15_AL (15 | BP_ACTIVE_LOW) +#define BP_GPIO_16_AH (16) +#define BP_GPIO_16_AL (16 | BP_ACTIVE_LOW) +#define BP_GPIO_17_AH (17) +#define BP_GPIO_17_AL (17 | BP_ACTIVE_LOW) +#define BP_GPIO_18_AH (18) +#define BP_GPIO_18_AL (18 | BP_ACTIVE_LOW) +#define BP_GPIO_19_AH (19) +#define BP_GPIO_19_AL (19 | BP_ACTIVE_LOW) +#define BP_GPIO_20_AH (20) +#define BP_GPIO_20_AL (20 | BP_ACTIVE_LOW) +#define BP_GPIO_21_AH (21) +#define BP_GPIO_21_AL (21 | BP_ACTIVE_LOW) +#define BP_GPIO_22_AH (22) +#define BP_GPIO_22_AL (22 | BP_ACTIVE_LOW) +#define BP_GPIO_23_AH (23) +#define BP_GPIO_23_AL (23 | BP_ACTIVE_LOW) +#define BP_GPIO_24_AH (24) +#define BP_GPIO_24_AL (24 | BP_ACTIVE_LOW) +#define BP_GPIO_25_AH (25) +#define BP_GPIO_25_AL (25 | BP_ACTIVE_LOW) +#define BP_GPIO_26_AH (26) +#define BP_GPIO_26_AL (26 | BP_ACTIVE_LOW) +#define BP_GPIO_27_AH (27) +#define BP_GPIO_27_AL (27 | BP_ACTIVE_LOW) +#define BP_GPIO_28_AH (28) +#define BP_GPIO_28_AL (28 | BP_ACTIVE_LOW) +#define BP_GPIO_29_AH (29) +#define BP_GPIO_29_AL (29 | BP_ACTIVE_LOW) +#define BP_GPIO_30_AH (30) +#define BP_GPIO_30_AL (30 | BP_ACTIVE_LOW) +#define BP_GPIO_31_AH (31) +#define BP_GPIO_31_AL (31 | BP_ACTIVE_LOW) +#define BP_GPIO_32_AH (32) +#define BP_GPIO_32_AL (32 | BP_ACTIVE_LOW) +#define BP_GPIO_33_AH (33) +#define BP_GPIO_33_AL (33 | BP_ACTIVE_LOW) +#define BP_GPIO_34_AH (34) +#define BP_GPIO_34_AL (34 | BP_ACTIVE_LOW) +#define BP_GPIO_35_AH (35) +#define BP_GPIO_35_AL (35 | BP_ACTIVE_LOW) +#define BP_GPIO_36_AH (36) +#define BP_GPIO_36_AL (36 | BP_ACTIVE_LOW) +#define BP_GPIO_37_AH (37) +#define BP_GPIO_37_AL (37 | BP_ACTIVE_LOW) +#define BP_GPIO_38_AH (38) +#define BP_GPIO_38_AL (38 | BP_ACTIVE_LOW) +#define BP_GPIO_39_AH (39) +#define BP_GPIO_39_AL (39 | BP_ACTIVE_LOW) +#define BP_GPIO_40_AH (40) +#define BP_GPIO_40_AL (40 | BP_ACTIVE_LOW) +#define BP_GPIO_41_AH (41) +#define BP_GPIO_41_AL (41 | BP_ACTIVE_LOW) +#define BP_GPIO_42_AH (42) +#define BP_GPIO_42_AL (42 | BP_ACTIVE_LOW) +#define BP_GPIO_43_AH (43) +#define BP_GPIO_43_AL (43 | BP_ACTIVE_LOW) +#define BP_GPIO_44_AH (44) +#define BP_GPIO_44_AL (44 | BP_ACTIVE_LOW) +#define BP_GPIO_45_AH (45) +#define BP_GPIO_45_AL (45 | BP_ACTIVE_LOW) +#define BP_GPIO_46_AH (46) +#define BP_GPIO_46_AL (46 | BP_ACTIVE_LOW) +#define BP_GPIO_47_AH (47) +#define BP_GPIO_47_AL (47 | BP_ACTIVE_LOW) + +#define BP_SERIAL_GPIO_0_AH (0 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_0_AL (0 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_1_AH (1 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_1_AL (1 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_2_AH (2 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_2_AL (2 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_3_AH (3 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_3_AL (3 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_4_AH (4 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_4_AL (4 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_5_AH (5 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_5_AL (5 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_6_AH (6 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_6_AL (6 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_7_AH (7 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_7_AL (7 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_8_AH (8 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_8_AL (8 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_9_AH (9 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_9_AL (9 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_10_AH (10 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_10_AL (10 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_11_AH (11 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_11_AL (11 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_12_AH (12 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_12_AL (12 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_13_AH (13 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_13_AL (13 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_14_AH (14 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_14_AL (14 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_15_AH (15 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_15_AL (15 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_16_AH (16 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_16_AL (16 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_17_AH (17 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_17_AL (17 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_18_AH (18 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_18_AL (18 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_19_AH (19 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_19_AL (19 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_20_AH (20 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_20_AL (20 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_21_AH (21 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_21_AL (21 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_22_AH (22 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_22_AL (22 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) +#define BP_SERIAL_GPIO_23_AH (23 | BP_GPIO_SERIAL) +#define BP_SERIAL_GPIO_23_AL (23 | BP_GPIO_SERIAL | BP_ACTIVE_LOW) + +/* Values for external interrupt assignments. */ +#define BP_EXT_INTR_0 0 +#define BP_EXT_INTR_1 1 +#define BP_EXT_INTR_2 2 +#define BP_EXT_INTR_3 3 +#define BP_EXT_INTR_4 4 +#define BP_EXT_INTR_5 5 + +/* Values for chip select assignments. */ +#define BP_CS_0 0 +#define BP_CS_1 1 +#define BP_CS_2 2 +#define BP_CS_3 3 + +#define BP_OVERLAY_GPON_TX_EN_L (1<<0) +#define BP_OVERLAY_PCI (1<<0) +#define BP_OVERLAY_CB (1<<1) +#define BP_OVERLAY_SPI_EXT_CS (1<<2) +#define BP_OVERLAY_UART1 (1<<3) +#define BP_OVERLAY_PHY (1<<4) +#define BP_OVERLAY_SERIAL_LEDS (1<<5) +#define BP_OVERLAY_EPHY_LED_0 (1<<6) +#define BP_OVERLAY_EPHY_LED_1 (1<<7) +#define BP_OVERLAY_GPHY_LED_0 (1<<6) +#define BP_OVERLAY_GPHY_LED_1 (1<<7) +#define BP_OVERLAY_EPHY_LED_2 (1<<8) +#define BP_OVERLAY_EPHY_LED_3 (1<<9) +#define BP_OVERLAY_INET_LED (1<<10) +#define BP_OVERLAY_MOCA_LED (1<<11) +#define BP_OVERLAY_USB_LED (1<<12) +#define BP_OVERLAY_USB_DEVICE (1<<13) + +/* Value for GPIO and external interrupt fields that are not used. */ +#define BP_NOT_DEFINED 0xffff + +/* Maximum size of the board id string. */ +#define BP_BOARD_ID_LEN 16 + +/* Maximum number of Ethernet MACs. */ +#define BP_MAX_ENET_MACS 2 +#define BP_MAX_SWITCH_PORTS 8 +/* Maximum number of VoIP DSPs. */ +#define BP_MAX_VOIP_DSP 2 + +/* Wireless Antenna Settings. */ +#define BP_WLAN_ANT_MAIN 0 +#define BP_WLAN_ANT_AUX 1 +#define BP_WLAN_ANT_BOTH 3 + +/* Wireless FLAGS */ +#define BP_WLAN_MAC_ADDR_OVERRIDE 0x0001 /* use kerSysGetMacAddress for mac address */ +#define BP_WLAN_EXCLUDE_ONBOARD 0x0002 /* exclude onboard wireless */ +#define BP_WLAN_EXCLUDE_ONBOARD_FORCE 0x0004 /* force exclude onboard wireless even without addon card*/ +#define BP_WLAN_USE_OTP 0x0008 /* don't use sw srom map, may fall to OTP or uninitialzed */ + +#define BP_WLAN_NVRAM_NAME_LEN 16 +#define BP_WLAN_MAX_PATCH_ENTRY 32 + +/* AFE IDs */ +#define BP_AFE_DEFAULT 0 + +#define BP_AFE_CHIP_INT (1 << 28) +#define BP_AFE_CHIP_6505 (2 << 28) +#define BP_AFE_CHIP_6306 (3 << 28) + +#define BP_AFE_LD_ISIL1556 (1 << 21) +#define BP_AFE_LD_6301 (2 << 21) +#define BP_AFE_LD_6302 (3 << 21) + +#define BP_AFE_FE_ANNEXA (1 << 15) +#define BP_AFE_FE_ANNEXB (2 << 15) +#define BP_AFE_FE_ANNEXJ (3 << 15) + +#define BP_AFE_FE_AVMODE_COMBO (0 << 13) +#define BP_AFE_FE_AVMODE_ADSL (1 << 13) +#define BP_AFE_FE_AVMODE_VDSL (2 << 13) + +/* VDSL only */ +#define BP_AFE_FE_REV_ISIL_REV1 (1 << 8) +/* Combo */ +#define BP_AFE_FE_REV_6302_REV1 (1 << 8) +#define BP_AFE_FE_REV_6302_REV_7_12 (1 << 8) +#define BP_AFE_FE_REV_6302_REV_7_4 (2 << 8) + +#define BP_AFE_FE_REV_6302_REV_7_2_1 (3 << 8) +#define BP_AFE_FE_REV_6302_REV_7_2 (4 << 8) +#define BP_AFE_FE_REV_6302_REV_7_2_UR2 (5 << 8) +#define BP_AFE_FE_REV_6302_REV_7_2_2 (6 << 8) +/* ADSL only*/ +#define BP_AFE_FE_REV_6302_REV_5_2_1 (1 << 8) +#define BP_AFE_FE_REV_6302_REV_5_2_2 (2 << 8) +#define BP_AFE_FE_REV_6301_REV_5_1_1 (1 << 8) + +#define BP_GET_EXT_AFE_DEFINED + +#if !defined(__ASSEMBLER__) + +/* Information about Ethernet switch */ +typedef struct { + int port_map; + int phy_id[BP_MAX_SWITCH_PORTS]; +} ETHERNET_SW_INFO; + +/* WAN port flag in the phy_id of ETHERNET_SW_INFO */ +#define BCM_WAN_PORT 0x40 +#define IsWanPort(id) (((id) & BCM_WAN_PORT) && ((id) != 0xFF)) + +#define c0(n) (((n) & 0x55555555) + (((n) >> 1) & 0x55555555)) +#define c1(n) (((n) & 0x33333333) + (((n) >> 2) & 0x33333333)) +#define c2(n) (((n) & 0x0f0f0f0f) + (((n) >> 4) & 0x0f0f0f0f)) +#define bitcount(r, n) {r = n; r = c0(r); r = c1(r); r = c2(r); r %= 255;} + +/* Information about an Ethernet MAC. If ucPhyType is BP_ENET_NO_PHY, + * then the other fields are not valid. + */ +typedef struct EthernetMacInfo +{ + unsigned char ucPhyType; /* BP_ENET_xxx */ + unsigned char ucPhyAddress; /* 0 to 31 */ + unsigned short usGpioLedPhyLinkSpeed; /* GPIO pin or not defined */ + unsigned short usConfigType; /* Configuration type */ + ETHERNET_SW_INFO sw; /* switch information */ + unsigned short usGpioMDC; /* GPIO pin to simulate MDC */ + unsigned short usGpioMDIO; /* GPIO pin to simulate MDIO */ +} ETHERNET_MAC_INFO, *PETHERNET_MAC_INFO; + +typedef struct WlanSromEntry { + char name[BP_WLAN_NVRAM_NAME_LEN]; + unsigned short wordOffset; + unsigned short value; +} WLAN_SROM_ENTRY; + +typedef struct WlanSromPatchInfo { + char szboardId[BP_BOARD_ID_LEN]; + unsigned short usWirelessChipId; + unsigned short usNeededSize; + WLAN_SROM_ENTRY entries[BP_WLAN_MAX_PATCH_ENTRY]; +} WLAN_SROM_PATCH_INFO, *PWLAN_SROM_PATCH_INFO; + +typedef struct WlanPciEntry { + char name[BP_WLAN_NVRAM_NAME_LEN]; + unsigned int dwordOffset; + unsigned int value; +} WLAN_PCI_ENTRY; + +typedef struct WlanPciPatchInfo { + char szboardId[BP_BOARD_ID_LEN]; + unsigned int usWirelessPciId; + int usNeededSize; + WLAN_PCI_ENTRY entries[BP_WLAN_MAX_PATCH_ENTRY]; +} WLAN_PCI_PATCH_INFO, *PWLAN_PCI_PATCH_INFO; + +/* Information about VoIP DSPs. If ucDspType is BP_VOIP_NO_DSP, + * then the other fields are not valid. + */ +typedef struct VoIPDspInfo +{ + unsigned char ucDspType; + unsigned char ucDspAddress; + unsigned short usGpioLedVoip; + unsigned short usGpioVoip1Led; + unsigned short usGpioVoip1LedFail; + unsigned short usGpioVoip2Led; + unsigned short usGpioVoip2LedFail; + unsigned short usGpioPotsLed; + unsigned short usGpioDectLed; + +} VOIP_DSP_INFO; + +int BpSetBoardId( char *pszBoardId ); +int BpGetBoardId( char *pszBoardId); +int BpGetBoardIds( char *pszBoardIds, int nBoardIdsSize ); + +int BpGetGPIOverlays( unsigned short *pusValue ); + +int BpGetRj11InnerOuterPairGpios( unsigned short *pusInner, unsigned short *pusOuter ); +int BpGetRtsCtsUartGpios( unsigned short *pusRts, unsigned short *pusCts ); + +int BpGetAdslLedGpio( unsigned short *pusValue ); +int BpGetAdslFailLedGpio( unsigned short *pusValue ); +int BpGetSecAdslLedGpio( unsigned short *pusValue ); +int BpGetSecAdslFailLedGpio( unsigned short *pusValue ); +int BpGetWirelessSesLedGpio( unsigned short *pusValue ); +int BpGetHpnaLedGpio( unsigned short *pusValue ); +int BpGetWanDataLedGpio( unsigned short *pusValue ); +int BpGetWanErrorLedGpio( unsigned short *pusValue ); +int BpGetBootloaderPowerOnLedGpio( unsigned short *pusValue ); +int BpGetBootloaderStopLedGpio( unsigned short *pusValue ); +int BpGetFpgaResetGpio( unsigned short *pusValue ); +int BpGetGponLedGpio( unsigned short *pusValue ); +int BpGetGponFailLedGpio( unsigned short *pusValue ); +int BpGetMoCALedGpio( unsigned short *pusValue ); +int BpGetMoCAFailLedGpio( unsigned short *pusValue ); + +int BpGetResetToDefaultExtIntr( unsigned short *pusValue ); +int BpGetWirelessSesExtIntr( unsigned short *pusValue ); +int BpGetHpnaExtIntr( unsigned long *pulValue ); + +int BpGetHpnaChipSelect( unsigned long *pulValue ); + +int BpGetWirelessAntInUse( unsigned short *pusValue ); +int BpGetWirelessFlags( unsigned short *pusValue ); +int BpGetWirelessPowerDownGpio( unsigned short *pusValue ); +int BpUpdateWirelessSromMap(unsigned short chipID, unsigned short* pBase, int sizeInWords); +int BpUpdateWirelessPciConfig (unsigned long pciID, unsigned long* pBase, int sizeInDWords); + +int BpGetEthernetMacInfo( PETHERNET_MAC_INFO pEnetInfos, int nNumEnetInfos ); +int BpGet6829PortInfo( unsigned char *portInfo6829 ); +int BpGetDslPhyAfeIds( unsigned long *pulValues ); +int BpGetExtAFEResetGpio( unsigned short *pulValues ); +int BpGetExtAFELDPwrGpio( unsigned short *pulValues ); +int BpGetExtAFELDModeGpio( unsigned short *pulValues ); + +VOIP_DSP_INFO *BpGetVoipDspConfig( unsigned char dspNum ); +int BpGetVoipLedGpio( unsigned short *pusValue ); +int BpGetVoip1LedGpio( unsigned short *pusValue ); +int BpGetVoip1FailLedGpio( unsigned short *pusValue ); +int BpGetVoip2LedGpio( unsigned short *pusValue ); +int BpGetVoip2FailLedGpio( unsigned short *pusValue ); +int BpGetPotsLedGpio( unsigned short *pusValue ); +int BpGetDectLedGpio( unsigned short *pusValue ); + +int bpstrcmp(const char *dest,const char *src); + + +#endif /* __ASSEMBLER__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _BOARDPARMS_H */ + diff --git a/shared/opensource/include/bcm963xx/boardparms_voice.h b/shared/opensource/include/bcm963xx/boardparms_voice.h new file mode 100755 index 0000000..5d3c7e5 --- /dev/null +++ b/shared/opensource/include/bcm963xx/boardparms_voice.h @@ -0,0 +1,392 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/************************************************************************** + * File Name : boardparms_voice.h + * + * Description: This file contains definitions and function prototypes for + * the BCM63xx voice board parameter access functions. + * + ***************************************************************************/ + +#if !defined(_BOARDPARMS_VOICE_H) +#define _BOARDPARMS_VOICE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define SI32261ENABLE /* Temporary #def until fully supported */ +#define SI32267ENABLE /* Temporary #def until fully supported */ + +/* Board string defines */ + +#define VOICECFG_NOSLIC_STR "NOSLIC" +#define VOICECFG_LE88276_STR "LE88276" +#define VOICECFG_LE88506_STR "LE88506" +#define VOICECFG_LE9530_STR "LE9530" +#define VOICECFG_VE890_STR "VE890" +#define VOICECFG_SI32178_STR "SI32178" +#define VOICECFG_SI3217X_STR "SI3217X" +#define VOICECFG_SI3226_STR "SI3226" +#define VOICECFG_6328AVNG_LE88276_NTR_STR "LE88276-NTR" +#define VOICECFG_6328AVNG_SI32267_STR "AVNG_SI32267" +#define VOICECFG_6328AVNG_VE890HV_PARTIAL_STR "AVNG_VE890HVP" +#define VOICECFG_6328AVNG_VE890HV_STR "AVNG_VE890HV" + +#define VOICECFG_6328AVNGR_SI32176_STR "AVNGR_SI32176" +#define VOICECFG_6328AVNGR_LE89116_STR "AVNGR_LE89116" +#define VOICECFG_6328AVNGR_SI3217X_STR "AVNGR_SI3217X" + +#define VOICECFG_6368MVWG_STR "MVWG" +#define VOICECFG_6368MBG_LE88276_STR "MBG_LE88276" +#define VOICECFG_6368MBG_LE88506_STR "MBG_LE88506" +#define VOICECFG_6368MBG_VE890_STR "MBG_VE890" +#define VOICECFG_6368MBG_LE89116_STR "MBG_LE89116" +#define VOICECFG_6368MBG_LE89316_STR "MBG_LE89316" +#define VOICECFG_6368MBG_SI3217X_STR "MBG_SI3217X" +#define VOICECFG_6368MBG_SI32176_STR "MBG_SI32176" +#define VOICECFG_6368MBG_SI32178_STR "MBG_SI32178" +#define VOICECFG_6368MBG_SI3226_STR "MBG_SI3226" + +#define VOICECFG_6362ADVNGP5_NOSLIC_STR "ADVNGP5_NOSLIC" +#define VOICECFG_6362ADVNGP5_SI3217X_STR "ADVNGP5_SI3217X" +#define VOICECFG_6362ADVNGP5_SI32176_STR "ADVNGP5_SI32176" +#define VOICECFG_6362ADVNGP5_SI32178_STR "ADVNGP5_SI32178" +#define VOICECFG_6362ADVNGP5_VE890_STR "ADVNGP5_VE890" +#define VOICECFG_6362ADVNGP5_LE89116_STR "ADVNGP5_LE89116" +#define VOICECFG_6362ADVNGP5_LE89316_STR "ADVNGP5_LE89316" +#define VOICECFG_6362ADVNGP5_LE88506_STR "ADVNGP5_LE88506" +#define VOICECFG_6362ADVNGP5_LE88276_STR "ADVNGP5_LE88276" +#define VOICECFG_6362ADVNGP5_SI3226_STR "ADVNGP5_SI3226" + +#define VOICECFG_6362ADVNGR_SI3217X_STR "ADVNGR_SI3217X" +#define VOICECFG_6362ADVNGR_SI32176_STR "ADVNGR_SI32176" +#define VOICECFG_6362ADVNGR_SI32178_STR "ADVNGR_SI32178" +#define VOICECFG_6362ADVNGR_SI3217X_NOFXO_STR "ADVNGR_SI3217XN" +#define VOICECFG_6362ADVNGR_VE890_STR "ADVNGR_VE890" +#define VOICECFG_6362ADVNGR_LE89116_STR "ADVNGR_LE89116" +#define VOICECFG_6362ADVNGR_LE89316_STR "ADVNGR_LE89316" +#define VOICECFG_6362ADVNGR_LE88506_STR "ADVNGR_LE88506" +#define VOICECFG_6362ADVNGR_LE88276_STR "ADVNGR_LE88276" +#define VOICECFG_6362ADVNGR_SI3226_STR "ADVNGR_SI3226" +#define VOICECFG_6362ADVNGR_SI32261_STR "ADVNGR_SI32261" +#define VOICECFG_6362ADVNGR_SI32267_STR "ADVNGR_SI32267" +#define VOICECFG_6362ADVNGR_VE890HV_PARTIAL_STR "ADVNGR_VE890HVP" +#define VOICECFG_6362ADVNGR_VE890HV_STR "ADVNGR_VE890HV" + +#define VOICECFG_6362ADVNGR2_SI3217X_STR "ADVNGR2_SI3217X" +#define VOICECFG_6362ADVNGR2_VE890_STR "ADVNGR2_VE890" +#define VOICECFG_6362ADVNGR2_LE88506_STR "ADVNGR2_LE88506" +#define VOICECFG_6362ADVNGR2_LE88276_STR "ADVNGR2_LE88276" +#define VOICECFG_6362ADVNGR2_SI3226_STR "ADVNGR2_SI3226" + +#define VOICECFG_6368MVNGR_SI3217X_STR "MVNGR_SI3217X" +#define VOICECFG_6368MVNGR_SI32176_STR "MVNGR_SI32176" +#define VOICECFG_6368MVNGR_SI32178_STR "MVNGR_SI32178" +#define VOICECFG_6368MVNGR_SI3217X_NOFXO_STR "MVNGR_SI3217XN" +#define VOICECFG_6368MVNGR_VE890_STR "MVNGR_VE890" +#define VOICECFG_6368MVNGR_LE89116_STR "MVNGR_LE89116" +#define VOICECFG_6368MVNGR_LE89316_STR "MVNGR_LE89316" +#define VOICECFG_6368MVNGR_LE88506_STR "MVNGR_LE88506" +#define VOICECFG_6368MVNGR_LE88276_STR "MVNGR_LE88276" +#define VOICECFG_6368MVNGR_SI3226_STR "MVNGR_SI3226" +#define VOICECFG_6368MVNGR_VE890HV_PARTIAL_STR "MVNGR_VE890HVP" +#define VOICECFG_6368MVNGR_VE890HV_STR "MVNGR_VE890HV" + + +/* Maximum number of devices in the system (on the board). +** Devices can refer to DECT, SLAC/SLIC, or SLAC/DAA combo. */ +#define BP_MAX_VOICE_DEVICES 5 + +/* Maximum numbers of channels per SLAC. */ +#define BP_MAX_CHANNELS_PER_DEVICE 2 + +/* Maximum number of voice channels in the system. +** This represents the sum of all channels available on the devices in the system */ +#define BP_MAX_VOICE_CHAN (BP_MAX_VOICE_DEVICES * BP_MAX_CHANNELS_PER_DEVICE) + +/* Max number of GPIO pins used for controling PSTN failover relays +** Note: the number of PSTN failover relays can be larger if multiple +** relays are controlled by single GPIO */ +#define BP_MAX_RELAY_PINS 2 + +#define BP_TIMESLOT_INVALID 0xFF + +/* General-purpose flag definitions (rename as appropriate) */ +#define BP_FLAG_DSP_APMHAL_ENABLE (1 << 0) +#define BP_FLAG_ISI_SUPPORT (1 << 1) +#define BP_FLAG_MODNAME_TESTNAME2 (1 << 2) +#define BP_FLAG_MODNAME_TESTNAME3 (1 << 3) +#define BP_FLAG_MODNAME_TESTNAME4 (1 << 4) +#define BP_FLAG_MODNAME_TESTNAME5 (1 << 5) +#define BP_FLAG_MODNAME_TESTNAME6 (1 << 6) +#define BP_FLAG_MODNAME_TESTNAME7 (1 << 7) +#define BP_FLAG_MODNAME_TESTNAME8 (1 << 8) + +/* +** Device-specific definitions +*/ +typedef enum +{ + BP_VD_NONE = -1, + BP_VD_IDECT1, /* Do not move this around, otherwise rebuild dect_driver.bin */ + BP_VD_EDECT1, + BP_VD_SILABS_3050, + BP_VD_SILABS_3215, + BP_VD_SILABS_3216, + BP_VD_SILABS_3217, + BP_VD_SILABS_32176, + BP_VD_SILABS_32178, + BP_VD_SILABS_3226, + BP_VD_SILABS_32261, + BP_VD_SILABS_32267, + BP_VD_ZARLINK_88010, + BP_VD_ZARLINK_88221, + BP_VD_ZARLINK_88276, + BP_VD_ZARLINK_88506, + BP_VD_ZARLINK_89010, + BP_VD_ZARLINK_89116, + BP_VD_ZARLINK_89316, + BP_VD_ZARLINK_9530, + BP_VD_ZARLINK_89136, + BP_VD_ZARLINK_89336, + BP_VD_MAX, +} BP_VOICE_DEVICE_TYPE; + + +/* +** Channel-specific definitions +*/ + +typedef enum +{ + BP_VOICE_CHANNEL_ACTIVE, + BP_VOICE_CHANNEL_INACTIVE, +} BP_VOICE_CHANNEL_STATUS; + +typedef enum +{ + BP_VCTYPE_NONE = -1, + BP_VCTYPE_SLIC, + BP_VCTYPE_DAA, + BP_VCTYPE_DECT +} BP_VOICE_CHANNEL_TYPE; + +typedef enum +{ + BP_VOICE_CHANNEL_SAMPLE_SIZE_16BITS, + BP_VOICE_CHANNEL_SAMPLE_SIZE_8BITS, +} BP_VOICE_CHANNEL_SAMPLE_SIZE; + +typedef enum +{ + BP_VOICE_CHANNEL_NARROWBAND, + BP_VOICE_CHANNEL_WIDEBAND, +} BP_VOICE_CHANNEL_FREQRANGE; + + +typedef enum +{ + BP_VOICE_CHANNEL_ENDIAN_BIG, + BP_VOICE_CHANNEL_ENDIAN_LITTLE, +} BP_VOICE_CHANNEL_ENDIAN_MODE; + +typedef enum +{ + BP_VOICE_CHANNEL_PCMCOMP_MODE_NONE, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ALAW, + BP_VOICE_CHANNEL_PCMCOMP_MODE_ULAW, +} BP_VOICE_CHANNEL_PCMCOMP_MODE; + + +typedef struct +{ + unsigned int status; /* active/inactive */ + unsigned int type; /* SLIC/DAA/DECT */ + unsigned int pcmCompMode; /* u-law/a-law (applicable for 8-bit samples) */ + unsigned int freqRange; /* narrowband/wideband */ + unsigned int sampleSize; /* 8-bit / 16-bit */ + unsigned int endianMode; /* big/little */ + unsigned int rxTimeslot; /* Receive timeslot for the channel */ + unsigned int txTimeslot; /* Sending timeslot for the channel */ + +} BP_VOICE_CHANNEL; + +/* TODO: This structure could possibly be turned into union if needed */ +typedef struct +{ + int spiDevId; /* SPI device id */ + unsigned short spiGpio; /* SPI GPIO (if used for SPI control) */ +} BP_VOICE_SPI_CONTROL; + +typedef struct +{ + unsigned short relayGpio[BP_MAX_RELAY_PINS]; +} BP_PSTN_RELAY_CONTROL; + +typedef struct +{ + unsigned short dectUartGpioTx; + unsigned short dectUartGpioRx; +} BP_DECT_UART_CONTROL; + +typedef struct +{ + unsigned int voiceDeviceType; /* Specific type of device (Le88276, Si32176, etc.) */ + BP_VOICE_SPI_CONTROL spiCtrl; /* SPI control through dedicated SPI pin or GPIO */ + int requiresReset; /* Does the device requires reset (through GPIO) */ + unsigned short resetGpio; /* Reset GPIO */ + BP_VOICE_CHANNEL channel[BP_MAX_CHANNELS_PER_DEVICE]; /* Device channels */ + +} BP_VOICE_DEVICE; + + +/* +** Main structure for defining the board parameters and used by boardHal +** for proper initialization of the DSP and devices (SLACs, DECT, etc.) +*/ +typedef struct VOICE_BOARD_PARMS +{ + char szBoardId[BP_BOARD_ID_LEN]; /* board id string */ + unsigned int numFxsLines; /* Number of FXS lines in the system */ + unsigned int numFxoLines; /* Number of FXO lines in the system */ + unsigned int numDectLines; /* Number of DECT lines in the system */ + unsigned int numFailoverRelayPins; /* Number of GPIO pins controling PSTN failover relays */ + BP_VOICE_DEVICE voiceDevice[BP_MAX_VOICE_DEVICES]; /* Voice devices in the system */ + BP_PSTN_RELAY_CONTROL pstnRelayCtrl; /* Control for PSTN failover relays */ + BP_DECT_UART_CONTROL dectUartControl; /* Control for external DECT UART */ + unsigned int flags; /* General-purpose flags */ +} VOICE_BOARD_PARMS, *PVOICE_BOARD_PARMS; + +/* --- End of voice-specific structures and enums --- */ + +int BpGetVoiceParms( char* pszBoardId, VOICE_BOARD_PARMS* voiceParms ); +int BpSetVoiceBoardId( char *pszBoardId ); +int BpGetVoiceBoardId( char *pszBoardId ); +int BpGetVoiceBoardIds( char *pszBoardIds, int nBoardIdsSize ); + +/* Variable externs */ + +#if defined(_BCM96328_) || defined(CONFIG_BCM96328) + +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_LE88276; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_SI3226; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_VE890; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_SI3217X; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_LE88506; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_SI32267; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_LE88276_NTR; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_VE890HV_Partial; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNG_VE890HV; + +extern VOICE_BOARD_PARMS voiceBoard_96328AVNGR_SI32176; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNGR_LE89116; +extern VOICE_BOARD_PARMS voiceBoard_96328AVNGR_SI3217X; + +#endif + +#if defined(_BCM96362_) || defined(CONFIG_BCM96362) + +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_NOSLIC; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_VE890; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_LE89116; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_LE89316; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_SI3217X; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_SI32176; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_SI32178; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_LE88276; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_SI3226; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGP5_LE88506; + +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI3217X; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI32176; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI32178; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI3217X_NOFXO; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_VE890; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_LE89116; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_LE89316; + +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_LE88506; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_LE88276; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI3226; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI32261; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_SI32267; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_VE890HVP; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNgr_VE890HV; + +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_SI3217X; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_VE890; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_LE88506; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_LE88276; +extern VOICE_BOARD_PARMS voiceBoard_96362ADVNGR2_SI3226; + +#endif + +#if defined(_BCM96368_) || defined(CONFIG_BCM96368) + +extern VOICE_BOARD_PARMS voiceBoard_96368MVWG; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_LE88276; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_LE88506; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_VE890; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_LE89116; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_LE89316; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_SI3217X; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_SI32176; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_SI32178; +extern VOICE_BOARD_PARMS voiceBoard_96368MBG_SI3226; + +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI3217X; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI32176; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI32178; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI3217X_NOFXO; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_VE890; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_LE89116; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_LE89316; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_LE88506; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_LE88276; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_SI3226; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_VE890HV_Partial; +extern VOICE_BOARD_PARMS voiceBoard_96368MVNgr_VE890HV; + +#endif + + +#if defined(_BCM96816_) || defined(CONFIG_BCM96816) + +extern VOICE_BOARD_PARMS voiceBoard_96816PVWM_LE88276; +extern VOICE_BOARD_PARMS voiceBoard_96816PVWM_SI3226; +extern VOICE_BOARD_PARMS voiceBoard_96816PVWM_LE88506; +extern VOICE_BOARD_PARMS voiceBoard_96816PVWM_LE9530; + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _BOARDPARMS_VOICE_H */ + diff --git a/shared/opensource/include/bcm963xx/fap_mod_size.h b/shared/opensource/include/bcm963xx/fap_mod_size.h new file mode 100644 index 0000000..03bb799 --- /dev/null +++ b/shared/opensource/include/bcm963xx/fap_mod_size.h @@ -0,0 +1,2 @@ +#define FAP_CORE_SIZE 0 +#define FAP_INIT_SIZE 0 diff --git a/shared/opensource/include/bcm963xx/flash_api.h b/shared/opensource/include/bcm963xx/flash_api.h new file mode 100755 index 0000000..7ac8022 --- /dev/null +++ b/shared/opensource/include/bcm963xx/flash_api.h @@ -0,0 +1,90 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL?, available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/*************************************************************************** + * File Name : flash_api.h + * + * Description: This file contains definitions and prototypes for a public + * flash device interface and an internal flash device interface. + ***************************************************************************/ + +#if !defined(_FLASH_API_H) +#define _FLASH_API_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Flash definitions. */ +#define FLASH_API_OK 1 +#define FLASH_API_ERROR -1 + +#define FLASH_IFC_UNKNOWN 0 +#define FLASH_IFC_PARALLEL 1 +#define FLASH_IFC_SPI 2 +#define FLASH_IFC_HS_SPI 3 +#define FLASH_IFC_NAND 4 + +#define NAND_REINIT_FLASH 0xffff + +/* Public Interface Prototypes. */ +int flash_init(void); +int flash_sector_erase_int(unsigned short sector); +int flash_read_buf(unsigned short sector, int offset, unsigned char *buffer, + int numbytes); +int flash_write_buf(unsigned short sector, int offset, unsigned char *buffer, + int numbytes); +int flash_get_numsectors(void); +int flash_get_sector_size(unsigned short sector); +unsigned char *flash_get_memptr(unsigned short sector); +int flash_get_blk(int addr); +int flash_get_total_size(void); +int flash_get_flash_type(void); +void flash_change_flash_type(int type); + +/* Internal Flash Device Driver Information. */ +typedef struct flash_device_info_s +{ + unsigned short flash_device_id; + unsigned short flash_type; + char flash_device_name[30]; + + int (*fn_flash_sector_erase_int) (unsigned short sector); + int (*fn_flash_read_buf) (unsigned short sector, int offset, + unsigned char *buffer, int numbytes); + int (*fn_flash_write_buf) (unsigned short sector, int offset, + unsigned char *buffer, int numbytes); + int (*fn_flash_get_numsectors) (void); + int (*fn_flash_get_sector_size) (unsigned short sector); + unsigned char * (*fn_flash_get_memptr) (unsigned short sector); + int (*fn_flash_get_blk) (int addr); + int (*fn_flash_get_total_size) (void); +} flash_device_info_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _FLASH_API_H */ + diff --git a/shared/opensource/include/bcm963xx/flash_common.h b/shared/opensource/include/bcm963xx/flash_common.h new file mode 100755 index 0000000..4fcceca --- /dev/null +++ b/shared/opensource/include/bcm963xx/flash_common.h @@ -0,0 +1,103 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the “GPL”), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +/*!\file flash_common.h + * \brief This file contains definitions and prototypes used by both + * CFE and kernel. + * + */ + +#if !defined(_FLASH_COMMON_H) +#define _FLASH_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/** default scratch pad length */ +#define SP_MAX_LEN (8 * 1024) + + +/** Flash storage address information that is determined by the flash driver. + * + * This structure is used by CFE and kernel. + */ +typedef struct flashaddrinfo +{ + int flash_persistent_start_blk; /**< primary psi, for config file */ + int flash_persistent_number_blk; + int flash_persistent_length; /**< in bytes */ + unsigned long flash_persistent_blk_offset; + int flash_scratch_pad_start_blk; /**< start of scratch pad */ + int flash_scratch_pad_number_blk; + int flash_scratch_pad_length; /**< in bytes */ + unsigned long flash_scratch_pad_blk_offset; + unsigned long flash_rootfs_start_offset; /**< offset from start of flash to fs+kernel image */ + int flash_backup_psi_start_blk; /**< starting block of backup psi. Length is + the same as primary psi. + Start at begining of sector, so offset is always 0. + No sharing sectors with anybody else. */ + int flash_backup_psi_number_blk; /**< The number of sectors for primary and backup + * psi may be different due to the irregular + * sector sizes at the end of the flash. */ + int flash_syslog_start_blk; /**< starting block of persistent syslog. */ + int flash_syslog_number_blk; /**< number of blocks */ + int flash_syslog_length; /**< in bytes, set from CFE, note busybox syslogd uses 16KB buffer. + Like backup_psi, always start at beginning of sector, + so offset is 0, and no sharing of sectors. */ + int flash_meta_start_blk; /**< The first block which is used for meta info such + as the psi, scratch pad, syslog, backup psi. + The kernel can use everything above this sector. */ +} FLASH_ADDR_INFO, *PFLASH_ADDR_INFO; + + +/** Fill in the fInfo structure with primary PSI, scratch pad, syslog, secondary PSI info. + * + * @param nvRam (IN) nvram info. + * @param fInfo (OUT) flash addr info that will be filled out by this function. + */ +void flash_init_info(const NVRAM_DATA *nvRam, FLASH_ADDR_INFO *fInfo); + + +/** Get the total number of bytes at the bottom of the flash used for PSI, scratch pad, etc. + * + * Even though this function is returning the number of bytes, it it guaranteed to + * return the number of bytes of whole sectors at the end which are in use. + * If customer enables backup PSI and persistent syslog, the number of bytes + * may go above 64KB. This function replaces the old FLASH_RESERVED_AT_END define. + * + * @param fInfo (IN) Pointer to flash_addr_info struct. + * + * @return number of bytes reserved at the end. + */ +unsigned int flash_get_reserved_bytes_at_end(const FLASH_ADDR_INFO *fInfo); + + +#ifdef __cplusplus +} +#endif + +#endif /* _FLASH_COMMON_H */ + diff --git a/shared/opensource/include/bcm963xx/gpio_drv.h b/shared/opensource/include/bcm963xx/gpio_drv.h new file mode 100755 index 0000000..8131153 --- /dev/null +++ b/shared/opensource/include/bcm963xx/gpio_drv.h @@ -0,0 +1,40 @@ +/*************************************************************************** +*** +*** Copyright 2008 Hon Hai Precision Ind. Co. Ltd. +*** All Rights Reserved. +*** No portions of this material shall be reproduced in any form without the +*** written permission of Hon Hai Precision Ind. Co. Ltd. +*** +*** All information contained in this document is Hon Hai Precision Ind. +*** Co. Ltd. company private, proprietary, and trade secret property and +*** are protected by international intellectual property laws and treaties. +*** +****************************************************************************/ + +#ifndef __GPIO_DRV_H__ +#define __GPIO_DRV_H__ + +#define DEV_GPIO_DRV "gpio_drv" + +#define GPIO_IOCTL_NUM 'W' + +#define IOCTL_LAN_LED_STATE _IOWR(GPIO_IOCTL_NUM, 0, int *) +#define IOCTL_USB_LED_STATE _IOWR(GPIO_IOCTL_NUM, 1, int *) +#define IOCTL_WPS_LED_STATE _IOWR(GPIO_IOCTL_NUM, 2, int *) +#define IOCTL_VOIP_LED_OFF _IOWR(GPIO_IOCTL_NUM, 3, int *) +#define IOCTL_VOIP_LED_ON _IOWR(GPIO_IOCTL_NUM, 4, int *) +#define IOCTL_VOIP_LED_BS _IOWR(GPIO_IOCTL_NUM, 5, int *) +#define IOCTL_VOIP_LED_BF _IOWR(GPIO_IOCTL_NUM, 6, int *) +#define IOCTL_VOIP_LED_BN _IOWR(GPIO_IOCTL_NUM, 7, int *) +#define IOCTL_WAN_LED_STATE _IOWR(GPIO_IOCTL_NUM, 8, int *) +#define IOCTL_LAN_VLAN_ID _IOWR(GPIO_IOCTL_NUM, 9, int *) +#define IOCTL_WAN_VLAN_ID _IOWR(GPIO_IOCTL_NUM, 10, int *) +#define IOCTL_3G_LED_STATE _IOWR(GPIO_IOCTL_NUM, 11, int *) //Foxconn added, Neil Chen, 2009/11/2 +/* Foxconn added start Bob, 01/28/2010, for wan detection */ +#define IOCTL_PVC_DET_START _IOWR(GPIO_IOCTL_NUM, 12, int *) +#define IOCTL_PVC_DET_STOP _IOWR(GPIO_IOCTL_NUM, 13, int *) +#define IOCTL_PVC_DET_RESULT _IOWR(GPIO_IOCTL_NUM, 14, int *) +/* Foxconn added end Bob, 01/28/2010, for wan detection */ +#define IOCTL_LAN_UNTAGGED_VLAN_ID _IOWR(GPIO_IOCTL_NUM, 15, int *) /* Foxconn added Bob, 10/25/2010, for tag based vlan */ + +#endif /* __GPIO_DRV_H__ */ diff --git a/shared/opensource/include/bcm963xx/wan_det.h b/shared/opensource/include/bcm963xx/wan_det.h new file mode 100755 index 0000000..d8a5645 --- /dev/null +++ b/shared/opensource/include/bcm963xx/wan_det.h @@ -0,0 +1,245 @@ +/*************************************************************************** +*** +*** Copyright 2008 Hon Hai Precision Ind. Co. Ltd. +*** All Rights Reserved. +*** No portions of this material shall be reproduced in any form without the +*** written permission of Hon Hai Precision Ind. Co. Ltd. +*** +*** All information contained in this document is Hon Hai Precision Ind. +*** Co. Ltd. company private, proprietary, and trade secret property and +*** are protected by international intellectual property laws and treaties. +*** +****************************************************************************/ + +#ifndef __WAN_DET_H__ +#define __WAN_DET_H__ + +/* Foxconn added start Bob, 01/22/2010 */ + +#define MAX_SCAN_SERVICE 8 + +typedef struct _vpivcitable +{ + int portId; + int vpi; + int vci; +}_VpiVciTable; + + +typedef struct scanResult +{ + _VpiVciTable service[MAX_SCAN_SERVICE]; + _VpiVciTable oam; + _VpiVciTable BPDU; +}SCAN_RESULT; +/* Foxconn added end Bob, 01/22/2010 */ + +typedef unsigned short U16; +typedef unsigned int U32; +typedef unsigned char U8; + +#define PATTERN_ROUTED 0 +#define PATTERN_BRIDGED 1 + +#define ETHER_TYPE_OFFSET 12 +#define ETHERTYPE_IP 0x0800 +#define ETHERTYPE_ARP 0x0806 +#define ETHERTYPE_PPPOE_DISCOVERY 0x8863 +#define ETHERHEADER_LEN 14 + +typedef struct _PacketContent +{ + U32 length; + U8 *data; +}PacketContent; + +typedef struct _Pattern +{ + const char *name; + const PacketContent *payload; + int protoType; + U16 ethertype; + const PacketContent *header; + const PacketContent *expected_payload; + +}Pattern; + + +static U8 dhcp_request_bytes[] = { + + // IP header + 0x45, 0x00, 0x01, 0x48, // version, IHL, TOS, Total Length + 0x00, 0x04, 0x00, 0x00, // ident, flags, frag off + 0x9b, 0x11, 0x1e, 0xa2, // TTL, proto, hdr checksum + 0x00, 0x00, 0x00, 0x00, // source addr + 0xff, 0xff, 0xff, 0xff, // destination addr + + // UDP header + 0x00, 0x44, 0x00, 0x43, 0x01, 0x34, 0xe6, 0x9a, 0x01, 0x01, 0x06, 0x00, + 0xb3, 0x05, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x2b, 0x00, 0x74, 0xb1, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x82, 0x53, 0x63, 0x35, 0x01, 0x01, 0x33, + 0x04, 0x00, 0x00, 0x1c, 0x20, 0x37, 0x07, 0x01, 0x1c, 0x02, 0x03, 0x0f, 0x06, 0x0c, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + +}; + +static PacketContent dhcp_request = { sizeof(dhcp_request_bytes), dhcp_request_bytes +}; + +static U8 pppoe_padi_bytes[] = { + 0x11, 0x09, 0x00, 0x00, 0x00, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +static PacketContent pppoe_padi = { sizeof(pppoe_padi_bytes), pppoe_padi_bytes }; + +/** Sequence of bytes for a PPP LCP Configure-Request (RFC1661). */ +static U8 ppp_lcp_confreq_bytes[] = { + 0xc0, 0x21, // LCP + 0x01, // Configure Request + 0x99, // randomish identifier + 0x00, 0x04, // length +}; +static PacketContent ppp_lcp_confreq = { sizeof(ppp_lcp_confreq_bytes), ppp_lcp_confreq_bytes }; + +/** Expected response from NULL (aka VcMux) encapsulated PPP/LCP */ +static U8 ppp_lcp_response_bytes[] = { 0xc0, 0x21 }; +static PacketContent ppp_lcp_response = { sizeof(ppp_lcp_response_bytes), ppp_lcp_response_bytes }; + +/** SNAP/LLC routed */ +static U8 snap_llc_routed_bytes[] = { 0xaa, 0xaa, 3, 0, 0, 0, 8, 0 }; +static PacketContent snap_llc_routed = { sizeof(snap_llc_routed_bytes), snap_llc_routed_bytes }; + +/** SNAP/LLC bridged, no fcs */ +static U8 snap_llc_bridged_bytes[] = { + 0xaa, 0xaa, 0x3, // LLC + 0x0, 0x80, 0xc2, // OUI + 0x00, 0x07, // PID + 0x00, 0x00 // PAD + }; +static PacketContent snap_llc_bridged = { sizeof(snap_llc_bridged_bytes), snap_llc_bridged_bytes }; + +/* foxconn added start Bob, 12/07/2009, ignore BPDU frame */ +/** SNAP/LLC bridged BPDU */ +static U8 snap_llc_bridged_BPDU_bytes[] = { + 0xaa, 0xaa, 0x3, // LLC + 0x0, 0x80, 0xc2, // OUI + 0x00, 0x0e, // PID + }; + /* foxconn added end Bob, 12/07/2009, ignore BPDU frame */ + +/** LLC for PPPoA. See RFC2364 section 6. */ +static U8 llc_pppoa_bytes[] = { 0xfe, 0xfe, 0x03, 0xcf }; +static PacketContent llc_pppoa = { + sizeof(llc_pppoa_bytes), llc_pppoa_bytes +}; + +static U8 vcmux_bridged_bytes[] = { 0, 0 }; +static PacketContent vcmux_bridged = { sizeof(vcmux_bridged_bytes), vcmux_bridged_bytes }; + +/** +Patterns to be sent to CO side +1. PPPoE LLC Bridged +2. VcMux encapsulated PPPoA +3. LLC encapsulated PPPoA +4. RFC1483 SNAP/LLC Routed +5. RFC1483 VcMux Bridged +6. PPPoE VCMux Bridged +7. RFC1483 SNAP/LLC Bridged +8. RFC1483 VcMux Routed +*/ +static Pattern patterns[] = +{ + { + "PPPoE LLC Bridged", + &pppoe_padi, + PATTERN_BRIDGED, + ETHERTYPE_PPPOE_DISCOVERY, + &snap_llc_bridged, + NULL + }, + { + "VcMux encapsulated PPPoA", + &ppp_lcp_confreq, + PATTERN_ROUTED, + 0, // no need for etherheader! + NULL, + &ppp_lcp_response + }, + + { + "LLC encapsulated PPPoA", + &ppp_lcp_confreq, + PATTERN_ROUTED, + 0, // no need for etherheader! + &llc_pppoa, // encapsulated with PPPoA LLC header + NULL + }, + + /* RFC1483 SNAP/LLC routed */ + { + "RFC1483 SNAP/LLC Routed", + &dhcp_request, + PATTERN_ROUTED, + 0, + &snap_llc_routed, + NULL + }, + + /* RFC1483 VC mux bridged */ + { + "RFC1483 VcMux Bridged", + &dhcp_request, + PATTERN_BRIDGED, + ETHERTYPE_IP, + &vcmux_bridged, + NULL + }, + + /* PPPOE VCMux Bridged*/ + { + "PPPoE VCMux Bridged", + &pppoe_padi, + PATTERN_BRIDGED, + ETHERTYPE_PPPOE_DISCOVERY, + &vcmux_bridged, + NULL + }, + + /* RFC1483 SNAP/LLC bridged */ + { + "RFC1483 SNAP/LLC Bridged", + &dhcp_request, + PATTERN_BRIDGED, + ETHERTYPE_IP, + &snap_llc_bridged, + NULL + }, + + /* RFC1483 VC mux routed */ + { + "RFC1483 VcMux Routed", + &dhcp_request, + PATTERN_ROUTED, + 0, + NULL, + NULL + }, +}; + +#endif /* __WAN_DET_H__ */ diff --git a/shared/opensource/include/bcm963xx/wps_led.h b/shared/opensource/include/bcm963xx/wps_led.h new file mode 100755 index 0000000..69f8682 --- /dev/null +++ b/shared/opensource/include/bcm963xx/wps_led.h @@ -0,0 +1,28 @@ +/*************************************************************************** +*** +*** Copyright 2007 Hon Hai Precision Ind. Co. Ltd. +*** All Rights Reserved. +*** No portions of this material shall be reproduced in any form without the +*** written permission of Hon Hai Precision Ind. Co. Ltd. +*** +*** All information contained in this document is Hon Hai Precision Ind. +*** Co. Ltd. company private, proprietary, and trade secret property and +*** are protected by international intellectual property laws and treaties. +*** +****************************************************************************/ + +#ifndef __WPS_LED_H__ +#define __WPS_LED_H__ + +#define DEV_GPIO_DRV "wps_led" + +#define WPS_LED_IOCTL_NUM 'W' + +#define WPS_LED_BLINK_NORMAL _IOWR(WPS_LED_IOCTL_NUM, 0, int *) +#define WPS_LED_BLINK_QUICK _IOWR(WPS_LED_IOCTL_NUM, 1, int *) +#define WPS_LED_BLINK_OFF _IOWR(WPS_LED_IOCTL_NUM, 2, int *) +#define WPS_LED_CHANGE_GREEN _IOWR(WPS_LED_IOCTL_NUM, 3, int *) +#define WPS_LED_CHANGE_AMBER _IOWR(WPS_LED_IOCTL_NUM, 4, int *) +#define WPS_LED_BLINK_QUICK2 _IOWR(WPS_LED_IOCTL_NUM, 5, int *) + +#endif diff --git a/shared/opensource/spi/Makefile b/shared/opensource/spi/Makefile new file mode 100755 index 0000000..b3eb2b1 --- /dev/null +++ b/shared/opensource/spi/Makefile @@ -0,0 +1,30 @@ + +ifeq ($(CONFIG_MIPS_BRCM),y) + +ifeq ($(strip $(BRCM_CHIP)),6362) +obj-y += \ + bcmHsSpi.o +else +ifeq ($(strip $(BRCM_CHIP)),6816) +obj-y += \ + bcmHsSpi.o +else +ifeq ($(strip $(BRCM_CHIP)),6328) +obj-y += \ + bcmHsSpi.o +endif +endif +endif + +ifneq ($(strip $(BRCM_CHIP)),6328) +obj-y += \ + bcmLegSpi.o +endif + +obj-y += \ + bcmSpiRes.o + +EXTRA_CFLAGS += -DCONFIG_BCM9$(BRCM_CHIP) -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD) -I$(INC_BRCMSHARED_PUB_PATH)/$(BRCM_BOARD) + +endif + diff --git a/shared/opensource/spi/bcmHsSpi.c b/shared/opensource/spi/bcmHsSpi.c new file mode 100755 index 0000000..b32e9fc --- /dev/null +++ b/shared/opensource/spi/bcmHsSpi.c @@ -0,0 +1,898 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +#ifdef _CFE_ +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "bcm_map.h" +#define printk printf +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#endif + +/* if HS_SPI is defined then the HS SPI controller is available, otherwise do not compile this code */ + +#ifdef HS_SPI + +#include "bcmSpiRes.h" +#include "bcmSpi.h" + +int BcmHsSpiRead(unsigned char * msg_buf, int prependcnt, int nbytes, int devId, int freqHz); +int BcmHsSpiWrite(unsigned char * msg_buf, int nbytes, int devId, int freqHz); + +#define HS_SPI_STATE_CLOCK_POLARITY (1 << 31) +#define HS_SPI_STATE_GATE_CLOCK_SSOFF (1 << 30) +#define HS_SPI_STATE_LAUNCH_RISING (1 << 29) +#define HS_SPI_STATE_LATCH_RISING (1 << 28) +#define HS_SPI_STATE_ASYNC_CLOCK (1 << 27) +#if defined(_BCM96816_) || defined(CONFIG_BCM96816) +#define HS_SPI_CONTROLLER_STATE_DEF (HS_SPI_STATE_GATE_CLOCK_SSOFF) +#endif +#if defined(_BCM96328_) || defined(CONFIG_BCM96328) +#define HS_SPI_CONTROLLER_STATE_DEF (HS_SPI_STATE_GATE_CLOCK_SSOFF | HS_SPI_STATE_LATCH_RISING) +#endif +#if defined(_BCM96362_) || defined(CONFIG_BCM96362) +#define HS_SPI_CONTROLLER_STATE_DEF (HS_SPI_STATE_GATE_CLOCK_SSOFF | HS_SPI_STATE_LATCH_RISING | HS_SPI_STATE_ASYNC_CLOCK) +#endif + + +#ifndef _CFE_ +//#define HS_SPI_USE_INTERRUPTS /* define this to use interrupts instead of polling */ +static struct bcmspi BcmHsSpi = { SPIN_LOCK_UNLOCKED, + "bcmHsSpiDev", + }; +#else +#define udelay(X) \ + do { { int i; for( i = 0; i < (X) * 500; i++ ) ; } } while(0) +#endif + +static int hsSpiRead( unsigned char *pRxBuf, int prependcnt, int nbytes, int devId ) +{ + uint16 msgCtrl; + + HS_SPI_PROFILES[devId].mode_ctrl = prependcnt<command = devId<command = devId<0; wait--) + { + if (!(HS_SPI_PINGPONG0->status & 1<hs_spiIntStatus = HS_SPI_INTR_CLEAR_ALL; +} + +#ifdef HS_SPI_USE_INTERRUPTS +static void hsSpiEnableInt(bool bEnable) +{ + if ( bEnable ) + { + HS_SPI->hs_spiIntMask = HS_SPI_IRQ_PING0_CMD_DONE; + } + else + { + HS_SPI->hs_spiIntMask = 0; + } +} +#endif + +#ifndef _CFE_ +static int hsSpiSetClock( int clockHz, int profile ) +{ + int clock; + + clock = HS_SPI_PLL_FREQ/clockHz; + if (HS_SPI_PLL_FREQ%HS_SPI_CLOCK_DEF) + clock++; + + clock = 2048/clock; + if (2048%(clock)) + clock++; + + HS_SPI_PROFILES[profile].clk_ctrl = 1<hs_spiGlobalCtrl; + if ( 0 == (ctrlState & HS_SPI_STATE_GATE_CLOCK_SSOFF) ) + { + temp32 &= ~HS_SPI_CLK_GATE_SSOFF; + } + else + { + temp32 |= HS_SPI_CLK_GATE_SSOFF; + } +#if defined(_BCM96328_) || defined(CONFIG_BCM96328) || defined(_BCM96362_) || defined(CONFIG_BCM96362) + if ( 0 == (ctrlState & HS_SPI_STATE_CLOCK_POLARITY) ) + { + temp32 &= ~HS_SPI_CLK_POLARITY; + } + else + { + temp32 |= HS_SPI_CLK_POLARITY; + } +#endif + /* write value if required */ + if ( temp32 != HS_SPI->hs_spiGlobalCtrl ) + { + HS_SPI->hs_spiGlobalCtrl = temp32; + } + + temp32 = HS_SPI_PROFILES[devId].signal_ctrl; + if ( 0 == (ctrlState & HS_SPI_STATE_LATCH_RISING) ) + { + temp32 &= ~HS_SPI_LATCH_RISING; + } + else + { + temp32 |= HS_SPI_LATCH_RISING; + } + if ( 0 == (ctrlState & HS_SPI_STATE_LAUNCH_RISING) ) + { + temp32 &= ~HS_SPI_LAUNCH_RISING; + } + else + { + temp32 |= HS_SPI_LAUNCH_RISING; + } + +#if defined(_BCM96328_) || defined(CONFIG_BCM96328) || defined(_BCM96362_) || defined(CONFIG_BCM96362) + if ( 0 == (ctrlState & HS_SPI_STATE_ASYNC_CLOCK) ) + { + temp32 &= ~HS_SPI_ASYNC_INPUT_PATH; + } + else + { + temp32 |= HS_SPI_ASYNC_INPUT_PATH; + } +#endif + + /* write value if required */ + if ( temp32 != HS_SPI_PROFILES[devId].signal_ctrl ) + { + HS_SPI_PROFILES[devId].signal_ctrl = temp32; + } + +} +#endif + +/* these interfaces are availble for the CFE and spi flash driver only + all modules must use the linux kernel framework + if this is called by a module and interrupts are being used there will + be a problem */ +int BcmHsSpiRead( unsigned char *msg_buf, int prependcnt, int nbytes, int devId, int freqHz ) +{ +#ifndef _CFE_ + struct bcmspi *pBcmSpi = &BcmHsSpi; + + if ( pBcmSpi->irq ) + { + printk("BcmHsSpiRead error - Interrupts are enabled\n"); + return( SPI_STATUS_ERR ); + } + + spin_lock(&pBcmSpi->lock); + hsSpiSetControllerState(HS_SPI_CONTROLLER_STATE_DEF, devId); + hsSpiSetClock(freqHz, devId); +#endif + hsSpiClearIntStatus(); + hsSpiRead(msg_buf, prependcnt, nbytes, devId); + hsSpiTransPoll(); + hsSpiTransEnd(msg_buf, nbytes); + hsSpiClearIntStatus(); +#ifndef _CFE_ + spin_unlock(&pBcmSpi->lock); +#endif + + return( SPI_STATUS_OK ); +} + +int BcmHsSpiWrite( unsigned char *msg_buf, int nbytes, int devId, int freqHz ) +{ +#ifndef _CFE_ + struct bcmspi *pBcmSpi = &BcmHsSpi; + + if ( pBcmSpi->irq ) + { + printk("BcmHsSpiWrite error - Interrupts are enabled\n"); + return( SPI_STATUS_ERR ); + } + + spin_lock(&pBcmSpi->lock); + hsSpiSetControllerState(HS_SPI_CONTROLLER_STATE_DEF, devId); + hsSpiSetClock(freqHz, devId); +#endif + hsSpiClearIntStatus(); + hsSpiWriteFull(msg_buf, nbytes, devId, BCM_SPI_WRITE); + hsSpiTransPoll(); + hsSpiTransEnd(msg_buf, nbytes); + hsSpiClearIntStatus(); +#ifndef _CFE_ + spin_unlock(&pBcmSpi->lock); +#endif + + return( SPI_STATUS_OK ); +} + + +#ifndef _CFE_ +static void hsSpiNextMessage(struct bcmspi *pBcmSpi); + +static void hsSpiMsgDone(struct bcmspi *pBcmSpi, struct spi_message *msg, int status) +{ + list_del(&msg->queue); + msg->status = status; + + spin_unlock(&pBcmSpi->lock); + msg->complete(msg->context); + spin_lock(&pBcmSpi->lock); + + pBcmSpi->curTrans = NULL; + + /* continue if needed */ + if (list_empty(&pBcmSpi->queue) || pBcmSpi->stopping) + { + // disable controler ... + } + else + { + hsSpiNextMessage(pBcmSpi); + } +} + +#ifdef HS_SPI_USE_INTERRUPTS +static void hsSpiIntXfer(struct bcmspi *pBcmSpi, struct spi_message *msg) +{ + struct spi_transfer *xfer; + struct spi_transfer *nextXfer; + int length; + int prependCnt; + char *pTxBuf; + char *pRxBuf; + int opCode; + + xfer = pBcmSpi->curTrans; + if ( NULL == xfer) + { + xfer = list_entry(msg->transfers.next, struct spi_transfer, transfer_list); + } + else + { + xfer = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list); + } + pBcmSpi->curTrans = xfer; + + length = xfer->len; + prependCnt = 0; + pRxBuf = xfer->rx_buf; + pTxBuf = (unsigned char *)xfer->tx_buf; + + if ( (NULL != pRxBuf) && (NULL != pTxBuf) ) + { + opCode = BCM_SPI_FULL; + } + else if ( NULL != pRxBuf ) + { + opCode = BCM_SPI_READ; + } + else + { + opCode = BCM_SPI_WRITE; + } + + if ( msg->state ) + { + /* this controller does not support keeping the chip select active for all transfers + non NULL state indicates that we need to combine the transfers */ + nextXfer = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list); + prependCnt = length; + length = nextXfer->len; + pRxBuf = nextXfer->rx_buf; + opCode = BCM_SPI_READ; + pBcmSpi->curTrans = nextXfer; + } + + hsSpiSetClock(xfer->speed_hz, msg->spi->chip_select); + + hsSpiClearIntStatus(); + hsSpiEnableInt(TRUE); + if ( BCM_SPI_READ == opCode ) + { + hsSpiRead(pTxBuf, prependCnt, length, msg->spi->chip_select); + } + else + { + hsSpiWriteFull(pTxBuf, length, msg->spi->chip_select, opCode); + } + + return; + +} +#endif + +static void hsSpiPollXfer(struct bcmspi *pBcmSpi, struct spi_message *msg) +{ + struct spi_transfer *xfer; + struct spi_transfer *nextXfer; + int length; + int prependCnt; + char *pTxBuf; + char *pRxBuf; + int opCode; + + list_for_each_entry(xfer, &msg->transfers, transfer_list) + { + pBcmSpi->curTrans = xfer; + length = xfer->len; + prependCnt = 0; + pRxBuf = xfer->rx_buf; + pTxBuf = (unsigned char *)xfer->tx_buf; + + if ( (NULL != pRxBuf) && (NULL != pTxBuf) ) + { + opCode = BCM_SPI_FULL; + } + else if ( NULL != pRxBuf ) + { + opCode = BCM_SPI_READ; + } + else + { + opCode = BCM_SPI_WRITE; + } + + if ( msg->state ) + { + /* this controller does not support keeping the chip select active for all transfers + non NULL state indicates that we need to combine the transfers */ + nextXfer = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list); + prependCnt = length; + length = nextXfer->len; + pRxBuf = nextXfer->rx_buf; + opCode = BCM_SPI_READ; + xfer = nextXfer; + } + + hsSpiSetClock(xfer->speed_hz, msg->spi->chip_select); + + hsSpiClearIntStatus(); + if ( BCM_SPI_READ == opCode ) + { + hsSpiRead(pTxBuf, prependCnt, length, msg->spi->chip_select); + } + else + { + hsSpiWriteFull(pTxBuf, length, msg->spi->chip_select, opCode); + } + + hsSpiTransPoll(); + hsSpiTransEnd(pRxBuf, length); + hsSpiClearIntStatus(); + + if (xfer->delay_usecs) + { + udelay(xfer->delay_usecs); + } + + msg->actual_length += length; + } + + hsSpiMsgDone(pBcmSpi, msg, SPI_STATUS_OK); + +} + + +static void hsSpiNextXfer(struct bcmspi *pBcmSpi, struct spi_message *msg) +{ +#ifdef HS_SPI_USE_INTERRUPTS + if (pBcmSpi->irq) + hsSpiIntXfer(pBcmSpi, msg); + else +#endif + hsSpiPollXfer(pBcmSpi, msg); +} + +static void hsSpiNextMessage(struct bcmspi *pBcmSpi) +{ + struct spi_message *msg; + unsigned int ctrlState; + + BUG_ON(pBcmSpi->curTrans); + + msg = list_entry(pBcmSpi->queue.next, struct spi_message, queue); + + /* set the controller state for this message */ + ctrlState = (unsigned int)spi_get_ctldata(msg->spi); + hsSpiSetControllerState(ctrlState, msg->spi->chip_select); + + /* there will always be one transfer in a given message */ + hsSpiNextXfer(pBcmSpi, msg); + +} + + +static int hsSpiSetup(struct spi_device *spi) +{ + struct bcmspi *pBcmSpi; + unsigned int spiCtrlData; + unsigned int spiCtrlState = 0; + + pBcmSpi = spi_master_get_devdata(spi->master); + + if (pBcmSpi->stopping) + return -ESHUTDOWN; + + spiCtrlData = (unsigned int)spi->controller_data; + if ( 0 == spiCtrlData ) + { + spiCtrlState = HS_SPI_CONTROLLER_STATE_DEF; + } + else + { + spiCtrlState = 0; + /* note that in HW, the meaning of latch and launch bits changes when CPOl = 1 */ + if ( (0 == (spi->mode & SPI_CPHA)) && + (0 == (spiCtrlData & SPI_CONTROLLER_STATE_CPHA_EXT)) ) + { + /* latch rising, launch falling */ + spiCtrlState = HS_SPI_STATE_LATCH_RISING; + } + else if ( (0 == (spi->mode & SPI_CPHA)) && + (0 != (spiCtrlData & SPI_CONTROLLER_STATE_CPHA_EXT)) ) + { + /* latch rising, launch rising */ + spiCtrlState = HS_SPI_STATE_LATCH_RISING | HS_SPI_STATE_LAUNCH_RISING; + } + else if ( (0 != (spi->mode & SPI_CPHA)) && + (0 == (spiCtrlData & SPI_CONTROLLER_STATE_CPHA_EXT)) ) + { + /* latch falling, launch rising */ + spiCtrlState = HS_SPI_STATE_LAUNCH_RISING; + } + // else - both set to 0, latch falling, launch falling + + if ( 0 != (spi->mode & SPI_CPOL) ) + { + spiCtrlState |= HS_SPI_STATE_CLOCK_POLARITY; + } + + if ( spiCtrlData & SPI_CONTROLLER_STATE_GATE_CLK_SSOFF ) + { + spiCtrlState |= HS_SPI_STATE_GATE_CLOCK_SSOFF; + } + + if ( spiCtrlData & SPI_CONTROLLER_STATE_ASYNC_CLOCK ) + { + spiCtrlState |= HS_SPI_STATE_ASYNC_CLOCK; + } + } + + spi_set_ctldata(spi, (void *)spiCtrlState); + + return 0; +} + + +static int hsSpiTransfer(struct spi_device *spi, struct spi_message *msg) +{ + struct bcmspi *pBcmSpi = &BcmHsSpi; + struct spi_transfer *xfer; + struct spi_transfer *nextXfer; + int xferCnt; + int bCsChange; + int xferLen; + + if (unlikely(list_empty(&msg->transfers))) + return -EINVAL; + + if (pBcmSpi->stopping) + return -ESHUTDOWN; + + /* make sure a completion callback is set */ + if ( NULL == msg->complete ) + { + return -EINVAL; + } + + xferCnt = 0; + bCsChange = 0; + xferLen = 0; + list_for_each_entry(xfer, &msg->transfers, transfer_list) + { + /* check transfer parameters */ + if (!(xfer->tx_buf || xfer->rx_buf)) + { + return -EINVAL; + } + + /* check the clock setting - if it is 0 then set to max clock of the device */ + if ( 0 == xfer->speed_hz ) + { + if ( 0 == spi->max_speed_hz ) + { + return -EINVAL; + } + xfer->speed_hz = spi->max_speed_hz; + } + + xferCnt++; + xferLen += xfer->len; + bCsChange |= xfer->cs_change; + + if ( xfer->len > HS_SPI_BUFFER_LEN ) + { + return -EINVAL; + } + } + + /* this controller does not support keeping the chip select active between + transfers. If a message is detected with a write transfer followed by a + read transfer and cs_change is set to 0 then the two transfers need to be + combined. The message state is used to indicate that the transfers + need to be combined */ + msg->state = NULL; + if ( (2 == xferCnt) && (0 == bCsChange) ) + { + xfer = list_entry(msg->transfers.next, struct spi_transfer, transfer_list); + if ( (NULL != xfer->tx_buf) && (NULL == xfer->rx_buf)) + { + nextXfer = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list);; + if ( (NULL == nextXfer->tx_buf) && (NULL != nextXfer->rx_buf)) + { + msg->state = (void *)1; + } + } + } + + msg->status = -EINPROGRESS; + msg->actual_length = 0; + +#ifdef HS_SPI_USE_INTERRUPTS + /* disable interrupts for the SPI controller + using spin_lock_irqsave would disable all interrupts */ + if ( pBcmSpi->irq ) + hsSpiEnableInt(FALSE); +#endif + spin_lock(&pBcmSpi->lock); + + list_add_tail(&msg->queue, &pBcmSpi->queue); + if (NULL == pBcmSpi->curTrans) + { + hsSpiNextMessage(pBcmSpi); + } + + spin_unlock(&pBcmSpi->lock); +#ifdef HS_SPI_USE_INTERRUPTS + if ( pBcmSpi->irq ) + hsSpiEnableInt(TRUE); +#endif + + return 0; +} + + +#ifdef HS_SPI_USE_INTERRUPTS +static irqreturn_t hsSpiIntHandler(int irq, void *dev_id) +{ + struct bcmspi *pBcmSpi = dev_id; + struct spi_message *msg; + struct spi_transfer *xfer; + + if ( 0 == HS_SPI->hs_spiIntStatusMasked ) + { + return ( IRQ_NONE ); + } + + hsSpiClearIntStatus(); + hsSpiEnableInt(FALSE); + + spin_lock(&pBcmSpi->lock); + if ( NULL == pBcmSpi->curTrans ) + { + spin_unlock(&pBcmSpi->lock); + return IRQ_HANDLED; + } + + xfer = pBcmSpi->curTrans; + msg = list_entry(pBcmSpi->queue.next, struct spi_message, queue); + + hsSpiTransEnd(xfer->rx_buf, xfer->len); + + /* xfer can specify a delay before the next transfer is started + this delay would be processed here normally. However, delay in the + interrupt handler is bad so it is ignored. It is used for polling + mode */ + + /* check to see if this is the last transfer in the message */ + if (msg->transfers.prev == &xfer->transfer_list) + { + /* report completed message */ + hsSpiMsgDone(pBcmSpi, msg, SPI_STATUS_OK); + } + else + { + /* Submit the next transfer */ + hsSpiNextXfer(pBcmSpi, msg); + } + + spin_unlock(&pBcmSpi->lock); + + return IRQ_HANDLED; + +} + +int __init hsSpiIntrInit( void ) +{ + int ret = 0; + struct bcmspi *pBcmSpi = &BcmHsSpi; + + hsSpiEnableInt(FALSE); + ret = request_irq(INTERRUPT_ID_SPI, hsSpiIntHandler, (IRQF_DISABLED | IRQF_SAMPLE_RANDOM | IRQF_SHARED), pBcmSpi->devName, pBcmSpi); + + spin_lock(&pBcmSpi->lock); + pBcmSpi->irq = INTERRUPT_ID_SPI; + spin_unlock(&pBcmSpi->lock); + + BcmHalInterruptEnable(pBcmSpi->irq); + + return( 0 ); + +} +/* we cannot initialize interrupts early + The flash module is intialized before an interrupt handler can be installed + and before the Linux framework can be used. This means it needs direct access + to the controller initially. This conflicts with the interrupt handling so we + need to wait for all modules to intialize */ +late_initcall(hsSpiIntrInit); +#endif + +static void hsSpiCleanup(struct spi_device *spi) +{ + /* would free spi_controller memory here if any was allocated */ + +} + +static int __init hsSpiProbe(struct platform_device *pdev) +{ + int ret; + struct spi_master *master; + struct bcmspi *pBcmSpi; + + ret = -ENOMEM; + master = spi_alloc_master(&pdev->dev, 0); + if (!master) + goto out_free; + + master->bus_num = pdev->id; + master->num_chipselect = 8; + master->setup = hsSpiSetup; + master->transfer = hsSpiTransfer; + master->cleanup = hsSpiCleanup; + platform_set_drvdata(pdev, master); + + spi_master_set_devdata(master, (void *)&BcmHsSpi); + pBcmSpi = spi_master_get_devdata(master); + + INIT_LIST_HEAD(&pBcmSpi->queue); + + pBcmSpi->pdev = pdev; + pBcmSpi->bus_num = HS_SPI_BUS_NUM; + pBcmSpi->num_chipselect = 8; + pBcmSpi->curTrans = NULL; + + /* make sure irq is 0 here + since this is used to identify when interrupts are enabled + the IRQ is initialized in hsSpiIntrInit */ + pBcmSpi->irq = 0; + + /* Initialize the hardware */ + + /* register and we are done */ + ret = spi_register_master(master); + if (ret) + goto out_free; + + return 0; + +out_free: + spi_master_put(master); + + return ret; +} + + +static int __exit hsSpiRemove(struct platform_device *pdev) +{ + struct spi_master *master = platform_get_drvdata(pdev); + struct bcmspi *pBcmSpi = spi_master_get_devdata(master); + struct spi_message *msg; + + /* reset the hardware and block queue progress */ +#ifdef HS_SPI_USE_INTERRUPTS + hsSpiEnableInt(FALSE); +#endif + spin_lock(&pBcmSpi->lock); + pBcmSpi->stopping = 1; + + /* HW shutdown */ + + spin_unlock(&pBcmSpi->lock); + + /* Terminate remaining queued transfers */ + list_for_each_entry(msg, &pBcmSpi->queue, queue) + { + msg->status = -ESHUTDOWN; + msg->complete(msg->context); + } + +#ifdef HS_SPI_USE_INTERRUPTS + if ( pBcmSpi->irq ) + { + free_irq(pBcmSpi->irq, master); + } +#endif + spi_unregister_master(master); + + return 0; +} + +//#ifdef CONFIG_PM +#if 0 +static int hsSpiSuspend(struct platform_device *pdev, pm_message_t mesg) +{ + struct spi_master *master = platform_get_drvdata(pdev); + struct bcmspi *pBcmSpi = spi_master_get_devdata(master); + + return 0; +} + +static int hsSpiResume(struct platform_device *pdev) +{ + struct spi_master *master = platform_get_drvdata(pdev); + struct bcmspi *pBcmSpi = spi_master_get_devdata(master); + + return 0; +} +#else +#define hsSpiSuspend NULL +#define hsSpiResume NULL +#endif + +static struct platform_device bcm_hsspi_device = { + .name = "bcmhs_spi", + .id = HS_SPI_BUS_NUM, +}; + +static struct platform_driver bcm_hsspi_driver = { + .driver = + { + .name = "bcmhs_spi", + .owner = THIS_MODULE, + }, + .suspend = hsSpiSuspend, + .resume = hsSpiResume, + .remove = __exit_p(hsSpiRemove), +}; + +int __init hsSpiModInit( void ) +{ + platform_device_register(&bcm_hsspi_device); + return platform_driver_probe(&bcm_hsspi_driver, hsSpiProbe); + +} +subsys_initcall(hsSpiModInit); +#endif + +#endif /* HS_SPI */ + diff --git a/shared/opensource/spi/bcmLegSpi.c b/shared/opensource/spi/bcmLegSpi.c new file mode 100755 index 0000000..6d1a391 --- /dev/null +++ b/shared/opensource/spi/bcmLegSpi.c @@ -0,0 +1,774 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +#ifdef _CFE_ +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "bcm_map.h" +#define printk printf +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#endif + +/* if SPI is defined then the legacy SPI controller is available, otherwise do not compile this code */ +#ifdef SPI + +#include "bcmSpiRes.h" +#include "bcmSpi.h" + +int BcmLegSpiRead(unsigned char * msg_buf, int prependcnt, int nbytes, int devId, int freqHz); +int BcmLegSpiWrite(unsigned char * msg_buf, int nbytes, int devId, int freqHz); + +#ifndef _CFE_ +//#define LEG_SPI_USE_INTERRUPTS /* define this to use interrupts instead of polling */ +static struct bcmspi BcmLegSpi = { SPIN_LOCK_UNLOCKED, + "bcmLegSpiDev", + }; +#endif + +/* following are the frequency tables for the SPI controllers + they are ordered by frequency in descending order with column + 2 represetning the register value */ +#define LEG_SPI_FREQ_TABLE_SIZE 7 +int legSpiClockFreq[LEG_SPI_FREQ_TABLE_SIZE][2] = { + { 20000000, 0}, + { 12500000, 6}, + { 6250000, 5}, + { 3125000, 4}, + { 1563000, 3}, + { 781000, 2}, + { 391000, 1} }; + +static int legSpiRead( unsigned char *pRxBuf, int prependcnt, int nbytes, int devId ) +{ + int i; + + SPI->spiMsgCtl = (HALF_DUPLEX_R << SPI_MSG_TYPE_SHIFT) | (nbytes << SPI_BYTE_CNT_SHIFT); + + for (i = 0; i < prependcnt; i++) + { + SPI->spiMsgData[i] = pRxBuf[i]; + } + + SPI->spiCmd = (SPI_CMD_START_IMMEDIATE << SPI_CMD_COMMAND_SHIFT | + devId << SPI_CMD_DEVICE_ID_SHIFT | + prependcnt << SPI_CMD_PREPEND_BYTE_CNT_SHIFT | + 0 << SPI_CMD_ONE_BYTE_SHIFT); + + return SPI_STATUS_OK; + +} + +static int legSpiWriteFull( unsigned char *pTxBuf, int nbytes, int devId, int opcode ) +{ + int i; + + if ( opcode == BCM_SPI_FULL ) + { + SPI->spiMsgCtl = (FULL_DUPLEX_RW << SPI_MSG_TYPE_SHIFT) | (nbytes << SPI_BYTE_CNT_SHIFT); + } + else + { + SPI->spiMsgCtl = (HALF_DUPLEX_W << SPI_MSG_TYPE_SHIFT) | (nbytes << SPI_BYTE_CNT_SHIFT); + } + + for (i = 0; i < nbytes; i++) + { + SPI->spiMsgData[i] = pTxBuf[i]; + } + + SPI->spiCmd = (SPI_CMD_START_IMMEDIATE << SPI_CMD_COMMAND_SHIFT | + devId << SPI_CMD_DEVICE_ID_SHIFT | + 0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT | + 0 << SPI_CMD_ONE_BYTE_SHIFT); + + return SPI_STATUS_OK; + +} + + +static int legSpiTransEnd( unsigned char *rxBuf, int nbytes ) +{ + int i; + if ( NULL != rxBuf ) + { + for (i = 0; i < nbytes; i++) + { + rxBuf[i] = SPI->spiRxDataFifo[i]; + } + } + + return SPI_STATUS_OK; + +} + +static int legSpiTransPoll(void) +{ + while ( 1 ) + { + if ( SPI->spiIntStatus & SPI_INTR_CMD_DONE ) + { + break; + } + } + + return SPI_STATUS_OK; +} + +static void legSpiClearIntStatus(void) +{ + SPI->spiIntStatus = SPI_INTR_CLEAR_ALL; +} + +#ifdef LEG_SPI_USE_INTERRUPTS +static void legSpiEnableInt(bool bEnable) +{ + if ( bEnable ) + { + SPI->spiIntMask = SPI_INTR_CMD_DONE; + } + else + { + SPI->spiIntMask = 0; + } +} +#endif + +#ifndef _CFE_ +static int legSpiSetClock( int clockHz ) +{ + int i; + int clock = -1; + + for( i = 0; i < LEG_SPI_FREQ_TABLE_SIZE; i++ ) + { + /* look for the closest frequency that is less than the frequency passed in */ + if ( legSpiClockFreq[i][0] <= clockHz ) + { + clock = legSpiClockFreq[i][1]; + break; + } + } + /* if no clock was found set to default */ + if ( -1 == clock ) + { + clock = LEG_SPI_CLOCK_DEF; + } + SPI->spiClkCfg = (SPI->spiClkCfg & ~SPI_CLK_MASK) | clock; + + return SPI_STATUS_OK; +} +#endif + +/* these interfaces are availble for the CFE and spi flash driver only + all modules must use the linux kernel framework + if this is called by a module and interrupts are being used there will + be a problem */ +int BcmLegSpiRead( unsigned char *msg_buf, int prependcnt, int nbytes, int devId, int freqHz ) +{ +#ifndef _CFE_ + struct bcmspi *pBcmSpi = &BcmLegSpi; + + if ( pBcmSpi->irq ) + { + printk("BcmLegSpiRead error - SPI Interrupts are enabled\n"); + return( SPI_STATUS_ERR ); + } + + spin_lock(&pBcmSpi->lock); + legSpiSetClock(freqHz); +#endif + legSpiClearIntStatus(); + legSpiRead(msg_buf, prependcnt, nbytes, devId); + legSpiTransPoll(); + legSpiTransEnd(msg_buf, nbytes); + legSpiClearIntStatus(); +#ifndef _CFE_ + spin_unlock(&pBcmSpi->lock); +#endif + + return( SPI_STATUS_OK ); +} + +int BcmLegSpiWrite( unsigned char *msg_buf, int nbytes, int devId, int freqHz ) +{ +#ifndef _CFE_ + struct bcmspi *pBcmSpi = &BcmLegSpi; + + if ( pBcmSpi->irq ) + { + printk("BcmLegSpiWrite error - SPI Interrupts are enabled\n"); + return( SPI_STATUS_ERR ); + } + + spin_lock(&pBcmSpi->lock); + legSpiSetClock(freqHz); +#endif + legSpiClearIntStatus(); + legSpiWriteFull(msg_buf, nbytes, devId, BCM_SPI_WRITE); + legSpiTransPoll(); + legSpiTransEnd(msg_buf, nbytes); + legSpiClearIntStatus(); +#ifndef _CFE_ + spin_unlock(&pBcmSpi->lock); +#endif + + return( SPI_STATUS_OK ); +} + + +#ifndef _CFE_ +static void legSpiNextMessage(struct bcmspi *pBcmSpi); + +static void legSpiMsgDone(struct bcmspi *pBcmSpi, struct spi_message *msg, int status) +{ + list_del(&msg->queue); + msg->status = status; + + spin_unlock(&pBcmSpi->lock); + msg->complete(msg->context); + spin_lock(&pBcmSpi->lock); + + pBcmSpi->curTrans = NULL; + + /* continue if needed */ + if (list_empty(&pBcmSpi->queue) || pBcmSpi->stopping) + { + // disable controler ... + } + else + { + legSpiNextMessage(pBcmSpi); + } +} + +#ifdef LEG_SPI_USE_INTERRUPTS +static void legSpiIntXfer(struct bcmspi *pBcmSpi, struct spi_message *msg) +{ + struct spi_transfer *xfer; + struct spi_transfer *nextXfer; + int length; + int prependCnt; + char *pTxBuf; + char *pRxBuf; + int opCode; + + xfer = pBcmSpi->curTrans; + if ( NULL == xfer) + { + xfer = list_entry(msg->transfers.next, struct spi_transfer, transfer_list); + } + else + { + xfer = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list); + } + pBcmSpi->curTrans = xfer; + + length = xfer->len; + prependCnt = 0; + pRxBuf = xfer->rx_buf; + pTxBuf = (unsigned char *)xfer->tx_buf; + + if ( (NULL != pRxBuf) && (NULL != pTxBuf) ) + { + opCode = BCM_SPI_FULL; + } + else if ( NULL != pRxBuf ) + { + opCode = BCM_SPI_READ; + } + else + { + opCode = BCM_SPI_WRITE; + } + + if ( msg->state ) + { + /* this controller does not support keeping the chip select active for all transfers + non NULL state indicates that we need to combine the transfers */ + nextXfer = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list); + prependCnt = length; + length = nextXfer->len; + pRxBuf = nextXfer->rx_buf; + opCode = BCM_SPI_READ; + pBcmSpi->curTrans = nextXfer; + } + + legSpiSetClock(xfer->speed_hz); + + legSpiClearIntStatus(); + legSpiEnableInt(TRUE); + if ( BCM_SPI_READ == opCode ) + { + legSpiRead(pTxBuf, prependCnt, length, msg->spi->chip_select); + } + else + { + legSpiWriteFull(pTxBuf, length, msg->spi->chip_select, opCode); + } + + return; + +} +#endif + +static void legSpiPollXfer(struct bcmspi *pBcmSpi, struct spi_message *msg) +{ + struct spi_transfer *xfer; + struct spi_transfer *nextXfer; + int length; + int prependCnt; + char *pTxBuf; + char *pRxBuf; + int opCode; + + list_for_each_entry(xfer, &msg->transfers, transfer_list) + { + pBcmSpi->curTrans = xfer; + length = xfer->len; + prependCnt = 0; + pRxBuf = xfer->rx_buf; + pTxBuf = (unsigned char *)xfer->tx_buf; + + if ( (NULL != pRxBuf) && (NULL != pTxBuf) ) + { + opCode = BCM_SPI_FULL; + } + else if ( NULL != pRxBuf ) + { + opCode = BCM_SPI_READ; + } + else + { + opCode = BCM_SPI_WRITE; + } + + if ( msg->state ) + { + /* this controller does not support keeping the chip select active for all transfers + non NULL state indicates that we need to combine the transfers */ + nextXfer = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list); + prependCnt = length; + length = nextXfer->len; + pRxBuf = nextXfer->rx_buf; + opCode = BCM_SPI_READ; + xfer = nextXfer; + } + + legSpiSetClock(xfer->speed_hz); + + legSpiClearIntStatus(); + if ( BCM_SPI_READ == opCode ) + { + legSpiRead(pTxBuf, prependCnt, length, msg->spi->chip_select); + } + else + { + legSpiWriteFull(pTxBuf, length, msg->spi->chip_select, opCode); + } + + legSpiTransPoll(); + legSpiTransEnd(pRxBuf, length); + legSpiClearIntStatus(); + + if (xfer->delay_usecs) + { + udelay(xfer->delay_usecs); + } + + msg->actual_length += length; + } + + legSpiMsgDone(pBcmSpi, msg, SPI_STATUS_OK); + +} + + +static void legSpiNextXfer(struct bcmspi *pBcmSpi, struct spi_message *msg) +{ +#ifdef LEG_SPI_USE_INTERRUPTS + if (pBcmSpi->irq) + legSpiIntXfer(pBcmSpi, msg); + else +#endif + legSpiPollXfer(pBcmSpi, msg); + +} + + +static void legSpiNextMessage(struct bcmspi *pBcmSpi) +{ + struct spi_message *msg; + + BUG_ON(pBcmSpi->curTrans); + + msg = list_entry(pBcmSpi->queue.next, struct spi_message, queue); + + /* there will always be one transfer in a given message */ + legSpiNextXfer(pBcmSpi, msg); + +} + + +static int legSpiSetup(struct spi_device *spi) +{ + struct bcmspi *pBcmSpi; + + pBcmSpi = spi_master_get_devdata(spi->master); + + if (pBcmSpi->stopping) + return -ESHUTDOWN; + + /* there is nothing to setup */ + + return 0; +} + + +int legSpiTransfer(struct spi_device *spi, struct spi_message *msg) +{ + struct bcmspi *pBcmSpi = &BcmLegSpi; + struct spi_transfer *xfer; + struct spi_transfer *nextXfer; + int xferCnt; + int bCsChange; + int xferLen; + + if (unlikely(list_empty(&msg->transfers))) + return -EINVAL; + + if (pBcmSpi->stopping) + return -ESHUTDOWN; + + /* make sure a completion callback is set */ + if ( NULL == msg->complete ) + { + return -EINVAL; + } + + xferCnt = 0; + bCsChange = 0; + xferLen = 0; + list_for_each_entry(xfer, &msg->transfers, transfer_list) + { + /* check transfer parameters */ + if (!(xfer->tx_buf || xfer->rx_buf)) + { + return -EINVAL; + } + + /* check the clock setting - if it is 0 then set to max clock of the device */ + if ( 0 == xfer->speed_hz ) + { + if ( 0 == spi->max_speed_hz ) + { + return -EINVAL; + } + xfer->speed_hz = spi->max_speed_hz; + } + + xferCnt++; + xferLen += xfer->len; + bCsChange |= xfer->cs_change; + + if ( xfer->len > (sizeof(SPI->spiMsgData) & ~0x3) ) + { + return -EINVAL; + } + } + + /* this controller does not support keeping the chip select active between + transfers. If a message is detected with a write transfer followed by a + read transfer and cs_change is set to 0 then the two transfers need to be + combined. The message state is used to indicate that the transfers + need to be combined */ + msg->state = NULL; + if ( (2 == xferCnt) && (0 == bCsChange) ) + { + xfer = list_entry(msg->transfers.next, struct spi_transfer, transfer_list); + if ( (NULL != xfer->tx_buf) && (NULL == xfer->rx_buf)) + { + nextXfer = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list);; + if ( (NULL == nextXfer->tx_buf) && (NULL != nextXfer->rx_buf)) + { + msg->state = (void *)1; + } + } + } + + msg->status = -EINPROGRESS; + msg->actual_length = 0; + +#ifdef LEG_SPI_USE_INTERRUPTS + /* disable interrupts for the SPI controller + using spin_lock_irqsave would disable all interrupts */ + if ( pBcmSpi->irq ) + legSpiEnableInt(FALSE); +#endif + spin_lock(&pBcmSpi->lock); + + list_add_tail(&msg->queue, &pBcmSpi->queue); + if (NULL == pBcmSpi->curTrans) + { + legSpiNextMessage(pBcmSpi); + } + + spin_unlock(&pBcmSpi->lock); +#ifdef LEG_SPI_USE_INTERRUPTS + if ( pBcmSpi->irq ) + legSpiEnableInt(TRUE); +#endif + + return 0; +} + + +#ifdef LEG_SPI_USE_INTERRUPTS +static irqreturn_t legSpiIntHandler(int irq, void *dev_id) +{ + struct bcmspi *pBcmSpi = dev_id; + struct spi_message *msg; + struct spi_transfer *xfer; + + if ( 0 == SPI->spiMaskIntStatus ) + { + return ( IRQ_NONE ); + } + + legSpiClearIntStatus(); + legSpiEnableInt(FALSE); + + spin_lock(&pBcmSpi->lock); + if ( NULL == pBcmSpi->curTrans ) + { + spin_unlock(&pBcmSpi->lock); + return IRQ_HANDLED; + } + + xfer = pBcmSpi->curTrans; + msg = list_entry(pBcmSpi->queue.next, struct spi_message, queue); + + legSpiTransEnd(xfer->rx_buf, xfer->len); + + /* xfer can specify a delay before the next transfer is started + this is only used for polling mode */ + + /* check to see if this is the last transfer in the message */ + if (msg->transfers.prev == &xfer->transfer_list) + { + /* report completed message */ + legSpiMsgDone(pBcmSpi, msg, SPI_STATUS_OK); + } + else + { + /* Submit the next transfer */ + legSpiNextXfer(pBcmSpi, msg); + } + + spin_unlock(&pBcmSpi->lock); + + return IRQ_HANDLED; + +} + +int __init legSpiIntrInit( void ) +{ + int ret = 0; + struct bcmspi *pBcmSpi = &BcmLegSpi; + + legSpiEnableInt(FALSE); + ret = request_irq(INTERRUPT_ID_SPI, legSpiIntHandler, (IRQF_DISABLED | IRQF_SAMPLE_RANDOM | IRQF_SHARED), pBcmSpi->devName, pBcmSpi); + + spin_lock(&pBcmSpi->lock); + pBcmSpi->irq = INTERRUPT_ID_SPI; + spin_unlock(&pBcmSpi->lock); + + BcmHalInterruptEnable(pBcmSpi->irq); + + return( 0 ); + +} +/* we cannot initialize interrupts early + The flash module is intialized before an interrupt handler can be installed + and before the Linux framework can be used. This means it needs direct access + to the controller initially. This conflicts with the interrupt handling so we + need to wait for all modules to intialize */ +late_initcall(legSpiIntrInit); +#endif + +static void legSpiCleanup(struct spi_device *spi) +{ + /* would free spi_controller memory here if any was allocated */ + +} + +static int __init legSpiProbe(struct platform_device *pdev) +{ + int ret; + struct spi_master *master; + struct bcmspi *pBcmSpi; + + ret = -ENOMEM; + master = spi_alloc_master(&pdev->dev, 0); + if (!master) + goto out_free; + + master->bus_num = pdev->id; + master->num_chipselect = 8; + master->setup = legSpiSetup; + master->transfer = legSpiTransfer; + master->cleanup = legSpiCleanup; + platform_set_drvdata(pdev, master); + + spi_master_set_devdata(master, (void *)&BcmLegSpi); + pBcmSpi = spi_master_get_devdata(master); + + INIT_LIST_HEAD(&pBcmSpi->queue); + + pBcmSpi->pdev = pdev; + pBcmSpi->bus_num = LEG_SPI_BUS_NUM; + pBcmSpi->num_chipselect = 8; + pBcmSpi->curTrans = NULL; + + /* make sure irq is 0 here + since this is used to identify when interrupts are enabled + the IRQ is initialized in legSpiIntrInit */ + pBcmSpi->irq = 0; + + /* Initialize the hardware */ + + /* register and we are done */ + ret = spi_register_master(master); + if (ret) + goto out_free; + + return 0; + +out_free: + spi_master_put(master); + + return ret; +} + + +static int __exit legSpiRemove(struct platform_device *pdev) +{ + struct spi_master *master = platform_get_drvdata(pdev); + struct bcmspi *pBcmSpi = spi_master_get_devdata(master); + struct spi_message *msg; + + /* reset the hardware and block queue progress */ +#ifdef LEG_SPI_USE_INTERRUPTS + legSpiEnableInt(FALSE); +#endif + spin_lock(&pBcmSpi->lock); + pBcmSpi->stopping = 1; + + /* HW shutdown */ + + spin_unlock(&pBcmSpi->lock); + + /* Terminate remaining queued transfers */ + list_for_each_entry(msg, &pBcmSpi->queue, queue) + { + msg->status = -ESHUTDOWN; + msg->complete(msg->context); + } + +#ifdef LEG_SPI_USE_INTERRUPTS + if ( pBcmSpi->irq ) + { + free_irq(pBcmSpi->irq, master); + } +#endif + spi_unregister_master(master); + + return 0; +} + +//#ifdef CONFIG_PM +#if 0 +static int legSpiSuspend(struct platform_device *pdev, pm_message_t mesg) +{ + struct spi_master *master = platform_get_drvdata(pdev); + struct bcmspi *pBcmSpi = spi_master_get_devdata(master); + + return 0; +} + +static int legSpiResume(struct platform_device *pdev) +{ + struct spi_master *master = platform_get_drvdata(pdev); + struct bcmspi *pBcmSpi = spi_master_get_devdata(master); + + return 0; +} +#else +#define legSpiSuspend NULL +#define legSpiResume NULL +#endif + + +static struct platform_device bcm_legacyspi_device = { + .name = "bcmleg_spi", + .id = LEG_SPI_BUS_NUM, +}; + +static struct platform_driver bcm_legspi_driver = { + .driver = + { + .name = "bcmleg_spi", + .owner = THIS_MODULE, + }, + .suspend = legSpiSuspend, + .resume = legSpiResume, + .remove = __exit_p(legSpiRemove), +}; + + +int __init legSpiModInit( void ) +{ + platform_device_register(&bcm_legacyspi_device); + return platform_driver_probe(&bcm_legspi_driver, legSpiProbe); + +} +subsys_initcall(legSpiModInit); +#endif + +#endif /* SPI */ + diff --git a/shared/opensource/spi/bcmSpiRes.c b/shared/opensource/spi/bcmSpiRes.c new file mode 100755 index 0000000..ed16575 --- /dev/null +++ b/shared/opensource/spi/bcmSpiRes.c @@ -0,0 +1,660 @@ +/* + Copyright 2000-2010 Broadcom Corporation + + Unless you and Broadcom execute a separate written software license + agreement governing use of this software, this software is licensed + to you under the terms of the GNU General Public License version 2 + (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + with the following added to such license: + + As a special exception, the copyright holders of this software give + you permission to link this software with independent modules, and to + copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent + module, the terms and conditions of the license of that module. + An independent module is a module which is not derived from this + software. The special exception does not apply to any modifications + of the software. + + Notwithstanding the above, under no circumstances may you combine this + software in any way with any other Broadcom software provided under a + license other than the GPL, without Broadcom's express prior written + consent. +*/ + +#ifdef _CFE_ +#include "lib_types.h" +#include "lib_printf.h" +#include "lib_string.h" +#include "bcm_map.h" +#define printk printf +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) +#include +#endif +#include +#include + +#include +#endif +#include "bcmSpiRes.h" + +extern int BcmLegSpiRead(unsigned char * msg_buf, int prependcnt, int nbytes, int devId, int freqHz); +extern int BcmLegSpiWrite(unsigned char * msg_buf, int nbytes, int devId, int freqHz); +extern int BcmHsSpiRead(unsigned char * msg_buf, int prependcnt, int nbytes, int devId, int freqHz); +extern int BcmHsSpiWrite(unsigned char * msg_buf, int nbytes, int devId, int freqHz); + +#ifndef _CFE_ +#ifdef SPI +/* the BCM legacy controller supports up to 8 devices */ +static struct spi_board_info bcmLegSpiDevInfo[8] = +{ + { + .modalias = "bcm_LegSpiDev0", + .chip_select = 0, + .max_speed_hz = 781000, + .bus_num = LEG_SPI_BUS_NUM, + .mode = SPI_MODE_3, + }, + { + .modalias = "bcm_LegSpiDev1", + .chip_select = 1, + .max_speed_hz = 781000, + .bus_num = LEG_SPI_BUS_NUM, + .mode = SPI_MODE_3, + }, + { + .modalias = "bcm_LegSpiDev2", + .chip_select = 2, + .max_speed_hz = 781000, + .bus_num = LEG_SPI_BUS_NUM, + .mode = SPI_MODE_3, + }, + { + .modalias = "bcm_LegSpiDev3", + .chip_select = 3, + .max_speed_hz = 781000, + .bus_num = LEG_SPI_BUS_NUM, + .mode = SPI_MODE_3, + }, + { + .modalias = "bcm_LegSpiDev4", + .chip_select = 4, + .max_speed_hz = 781000, + .bus_num = LEG_SPI_BUS_NUM, + .mode = SPI_MODE_3, + }, + { + .modalias = "bcm_LegSpiDev5", + .chip_select = 5, + .max_speed_hz = 781000, + .bus_num = LEG_SPI_BUS_NUM, + .mode = SPI_MODE_3, + }, + { + .modalias = "bcm_LegSpiDev6", + .chip_select = 6, + .max_speed_hz = 781000, + .bus_num = LEG_SPI_BUS_NUM, + .mode = SPI_MODE_3, + }, + { + .modalias = "bcm_LegSpiDev7", + .chip_select = 7, + .max_speed_hz = 781000, + .bus_num = LEG_SPI_BUS_NUM, + .mode = SPI_MODE_3, + }, +}; + +static struct spi_driver bcmLegSpiDevDrv[8] = +{ + { + .driver = + { + .name = "bcm_LegSpiDev0", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_LegSpiDev1", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_LegSpiDev2", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_LegSpiDev3", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_LegSpiDev4", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_LegSpiDev5", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_LegSpiDev6", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_LegSpiDev7", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, +}; + +static struct spi_device * bcmLegSpiDevices[8]; +#endif + +#ifdef HS_SPI +/* the BCM HS controller supports up to 8 devices */ +static struct spi_board_info bcmHSSpiDevInfo[8] = +{ + { + .modalias = "bcm_HSSpiDev0", + .controller_data = (void *)SPI_CONTROLLER_STATE_DEFAULT, + .chip_select = 0, + .max_speed_hz = 781000, + .bus_num = HS_SPI_BUS_NUM, + .mode = SPI_MODE_DEFAULT, + }, + { + .modalias = "bcm_HSSpiDev1", + .controller_data = (void *)SPI_CONTROLLER_STATE_DEFAULT, + .chip_select = 1, + .max_speed_hz = 781000, + .bus_num = HS_SPI_BUS_NUM, + .mode = SPI_MODE_DEFAULT, + }, + { + .modalias = "bcm_HSSpiDev2", + .controller_data = (void *)SPI_CONTROLLER_STATE_DEFAULT, + .chip_select = 2, + .max_speed_hz = 781000, + .bus_num = HS_SPI_BUS_NUM, + .mode = SPI_MODE_DEFAULT, + }, + { + .modalias = "bcm_HSSpiDev3", + .controller_data = (void *)SPI_CONTROLLER_STATE_DEFAULT, + .chip_select = 3, + .max_speed_hz = 781000, + .bus_num = HS_SPI_BUS_NUM, + .mode = SPI_MODE_DEFAULT, + }, + { + .modalias = "bcm_HSSpiDev4", + .controller_data = (void *)SPI_CONTROLLER_STATE_DEFAULT, + .chip_select = 4, + .max_speed_hz = 781000, + .bus_num = HS_SPI_BUS_NUM, + .mode = SPI_MODE_DEFAULT, + }, + { + .modalias = "bcm_HSSpiDev5", + .controller_data = (void *)SPI_CONTROLLER_STATE_DEFAULT, + .chip_select = 5, + .max_speed_hz = 781000, + .bus_num = HS_SPI_BUS_NUM, + .mode = SPI_MODE_DEFAULT, + }, + { + .modalias = "bcm_HSSpiDev6", + .controller_data = (void *)SPI_CONTROLLER_STATE_DEFAULT, + .chip_select = 6, + .max_speed_hz = 781000, + .bus_num = HS_SPI_BUS_NUM, + .mode = SPI_MODE_DEFAULT, + }, + { + .modalias = "bcm_HSSpiDev7", + .controller_data = (void *)SPI_CONTROLLER_STATE_DEFAULT, + .chip_select = 7, + .max_speed_hz = 781000, + .bus_num = HS_SPI_BUS_NUM, + .mode = SPI_MODE_DEFAULT, + }, +}; + +static struct spi_driver bcmHSSpiDevDrv[8] = +{ + { + .driver = + { + .name = "bcm_HSSpiDev0", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_HSSpiDev1", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_HSSpiDev2", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_HSSpiDev3", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_HSSpiDev4", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_HSSpiDev5", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_HSSpiDev6", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, + { + .driver = + { + .name = "bcm_HSSpiDev7", + .bus = &spi_bus_type, + .owner = THIS_MODULE, + }, + }, +}; + +static struct spi_device * bcmHSSpiDevices[8]; +#endif + + +int BcmSpiReserveSlave2(int busNum, int slaveId, int maxFreq, int spiMode, int ctrlState) +{ + struct spi_master * pSpiMaster; + struct spi_driver * pSpiDriver; + + if ( slaveId > 7 ) + { + return SPI_STATUS_ERR; + } + + if ( LEG_SPI_BUS_NUM == busNum ) + { +#ifndef SPI + return( SPI_STATUS_ERR ); +#else + if ( NULL != bcmLegSpiDevices[slaveId] ) + { + printk(KERN_ERR "BcmSpiReserveSlave - slaveId %d, already registerd\n", slaveId); + return( SPI_STATUS_ERR ); + } + + bcmLegSpiDevInfo[slaveId].max_speed_hz = maxFreq; + bcmLegSpiDevInfo[slaveId].controller_data = (void *)ctrlState; + bcmLegSpiDevInfo[slaveId].mode = spiMode; + + pSpiMaster = spi_busnum_to_master( busNum ); + bcmLegSpiDevices[slaveId] = spi_new_device(pSpiMaster, &bcmLegSpiDevInfo[slaveId]); + pSpiDriver = &bcmLegSpiDevDrv[slaveId]; +#endif + } + else if ( HS_SPI_BUS_NUM == busNum ) + { +#ifndef HS_SPI + return( SPI_STATUS_ERR ); +#else + if ( NULL != bcmHSSpiDevices[slaveId] ) + { + printk(KERN_ERR "BcmSpiReserveSlave - slaveId %d, already registerd\n", slaveId); + return( SPI_STATUS_ERR ); + } + + bcmHSSpiDevInfo[slaveId].max_speed_hz = maxFreq; + bcmHSSpiDevInfo[slaveId].controller_data = (void *)ctrlState; + bcmHSSpiDevInfo[slaveId].mode = spiMode; + + pSpiMaster = spi_busnum_to_master( busNum ); + bcmHSSpiDevices[slaveId] = spi_new_device(pSpiMaster, &bcmHSSpiDevInfo[slaveId]); + pSpiDriver = &bcmHSSpiDevDrv[slaveId]; +#endif + } + else + return( SPI_STATUS_ERR ); + + /* register the SPI driver */ + spi_register_driver(pSpiDriver); + + return 0; + +} +EXPORT_SYMBOL(BcmSpiReserveSlave2); + +int BcmSpiReserveSlave(int busNum, int slaveId, int maxFreq) +{ + return( BcmSpiReserveSlave2(busNum, slaveId, maxFreq, SPI_MODE_DEFAULT, SPI_CONTROLLER_STATE_DEFAULT) ); +} +EXPORT_SYMBOL(BcmSpiReserveSlave); + +int BcmSpiReleaseSlave(int busNum, int slaveId) +{ + if ( slaveId > 7 ) + { + return SPI_STATUS_ERR; + } + + if ( LEG_SPI_BUS_NUM == busNum ) + { +#ifndef SPI + return( SPI_STATUS_ERR ); +#else + if ( NULL == bcmLegSpiDevices[slaveId] ) + { + printk(KERN_ERR "BcmSpiReleaseSlave - slaveId %d, already released\n", slaveId); + return( SPI_STATUS_ERR ); + } + + bcmLegSpiDevInfo[slaveId].max_speed_hz = 781000; + spi_unregister_driver(&bcmLegSpiDevDrv[slaveId]); + spi_unregister_device(bcmLegSpiDevices[slaveId]); + bcmLegSpiDevices[slaveId] = 0; +#endif + } + else if ( HS_SPI_BUS_NUM == busNum ) + { +#ifndef HS_SPI + return( SPI_STATUS_ERR ); +#else + if ( NULL == bcmHSSpiDevices[slaveId] ) + { + printk(KERN_ERR "BcmSpiReleaseSlave - slaveId %d, already released\n", slaveId); + return( SPI_STATUS_ERR ); + } + + bcmHSSpiDevInfo[slaveId].max_speed_hz = 781000; + spi_unregister_driver(&bcmHSSpiDevDrv[slaveId]); + spi_unregister_device(bcmHSSpiDevices[slaveId]); + bcmHSSpiDevices[slaveId] = 0; +#endif + } + else + return( SPI_STATUS_ERR ); + + return 0; + +} +EXPORT_SYMBOL(BcmSpiReleaseSlave); + + +int BcmSpiSyncTrans(unsigned char *txBuf, unsigned char *rxBuf, int prependcnt, int nbytes, int busNum, int slaveId) +{ + struct spi_message msg; + struct spi_transfer xfer[2]; + int status; + int maxLength; + struct spi_device *pSpiDevice; + + maxLength = BcmSpi_GetMaxRWSize(busNum); + if ( (nbytes > maxLength) || (prependcnt > maxLength) ) + { + printk(KERN_ERR "ERROR BcmSpiSyncTrans: invalid length len %d, pre %d, max %d\n", nbytes, prependcnt, maxLength); + return SPI_STATUS_ERR; + } + + if ( slaveId > 7 ) + { + printk(KERN_ERR "ERROR BcmSpiSyncTrans: invalid slave id %d\n", slaveId); + return SPI_STATUS_ERR; + } + + if ( LEG_SPI_BUS_NUM == busNum ) + { +#ifndef SPI + return( SPI_STATUS_ERR ); +#else + if ( NULL == bcmLegSpiDevices[slaveId] ) + { + printk(KERN_ERR "ERROR BcmSpiSyncTrans: device not registered\n"); + return SPI_STATUS_ERR; + } + pSpiDevice = bcmLegSpiDevices[slaveId]; +#endif + } + else if ( HS_SPI_BUS_NUM == busNum ) + { +#ifndef HS_SPI + return( SPI_STATUS_ERR ); +#else + if ( NULL == bcmHSSpiDevices[slaveId] ) + { + printk(KERN_ERR "ERROR BcmSpiSyncTrans: device not registered\n"); + return SPI_STATUS_ERR; + } + pSpiDevice = bcmHSSpiDevices[slaveId]; +#endif + } + else + return( SPI_STATUS_ERR ); + + spi_message_init(&msg); + memset(xfer, 0, (sizeof xfer)); + + if ( prependcnt ) + { + xfer[0].len = prependcnt; + xfer[0].speed_hz = pSpiDevice->max_speed_hz; + if ( txBuf ) + { + xfer[0].tx_buf = txBuf; + } + else + { + xfer[0].tx_buf = rxBuf; + } + spi_message_add_tail(&xfer[0], &msg); + } + + xfer[1].len = nbytes; + xfer[1].speed_hz = pSpiDevice->max_speed_hz; + xfer[1].rx_buf = rxBuf; + + /* for the controller to use the prepend count correctly the first operation must be a read and the second a write + make sure tx is NULL for second transaction */ + if ( 0 == prependcnt ) + { + xfer[1].tx_buf = txBuf; + } + spi_message_add_tail(&xfer[1], &msg); + + status = spi_sync(pSpiDevice, &msg); + if (status >= 0) + { + status = SPI_STATUS_OK; + } + else + { + status = SPI_STATUS_ERR; + } + + return( status ); + +} +EXPORT_SYMBOL(BcmSpiSyncTrans); +#endif + +int BcmSpi_SetFlashCtrl( int opCode, int addrBytes, int dummyBytes, int busNum, int devId ) +{ + if ( HS_SPI_BUS_NUM == busNum ) + { +#ifndef HS_SPI + return SPI_STATUS_ERR; +#else + int clock; + + clock = HS_SPI_PLL_FREQ/HS_SPI_CLOCK_DEF; + if (HS_SPI_PLL_FREQ%HS_SPI_CLOCK_DEF) + clock++; + + clock = 2048/clock; + if (2048%(clock)) + clock++; + + HS_SPI_PROFILES[0].clk_ctrl = 1<hs_spiFlashCtrl = devId<spiMsgData); +#endif + } + + maxRWSize &= ~0x3; + + return(maxRWSize); + +} + + +/* The interface bcmSpi_Read and bcmSpi_Write provide direct access to the SPI controller. + these interfaces should only be called by CFE and early spi flash code */ +int BcmSpi_Read( unsigned char *msg_buf, int prependcnt, int nbytes, int busNum, int devId, int freqHz ) +{ + if ( LEG_SPI_BUS_NUM == busNum ) + { +#ifndef SPI + return SPI_STATUS_ERR; +#else + return BcmLegSpiRead( msg_buf, prependcnt, nbytes, devId, freqHz ); +#endif + } + else if ( HS_SPI_BUS_NUM == busNum ) + { +#ifndef HS_SPI + return SPI_STATUS_ERR; +#else + return BcmHsSpiRead( msg_buf, prependcnt, nbytes, devId, freqHz ); +#endif + } + else + { + return SPI_STATUS_ERR; + } + +} + +int BcmSpi_Write( unsigned char *msg_buf, int nbytes, int busNum, int devId, int freqHz ) +{ + if ( LEG_SPI_BUS_NUM == busNum ) + { +#ifndef SPI + return SPI_STATUS_ERR; +#else + return BcmLegSpiWrite( msg_buf, nbytes, devId, freqHz ); +#endif + } + else if ( HS_SPI_BUS_NUM == busNum ) + { +#ifndef HS_SPI + return SPI_STATUS_ERR; +#else + return BcmHsSpiWrite( msg_buf, nbytes, devId, freqHz ); +#endif + } + else + { + return SPI_STATUS_ERR; + } +} + +#ifndef _CFE_ +EXPORT_SYMBOL(BcmSpi_SetFlashCtrl); +EXPORT_SYMBOL(BcmSpi_GetMaxRWSize); +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/.fakeroot.00000 b/uclibc-crosstools-gcc-4.4.2-1/.fakeroot.00000 new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc-0.9.29.so new file mode 100755 index 0000000..f154f97 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc.so.0 new file mode 120000 index 0000000..7105e39 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/ld-uClibc.so.0 @@ -0,0 +1 @@ +ld-uClibc-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libc.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/libc.so.0 new file mode 120000 index 0000000..274f668 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libc.so.0 @@ -0,0 +1 @@ +libuClibc-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt-0.9.29.so new file mode 100644 index 0000000..70d2354 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt.so.0 new file mode 120000 index 0000000..774ba43 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libcrypt.so.0 @@ -0,0 +1 @@ +libcrypt-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libdl-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libdl-0.9.29.so new file mode 100644 index 0000000..f23cf44 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libdl-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libdl.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/libdl.so.0 new file mode 120000 index 0000000..0c55086 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libdl.so.0 @@ -0,0 +1 @@ +libdl-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libm-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libm-0.9.29.so new file mode 100644 index 0000000..3a8d58e Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libm-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libm.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/libm.so.0 new file mode 120000 index 0000000..2f114fd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libm.so.0 @@ -0,0 +1 @@ +libm-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libnsl-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libnsl-0.9.29.so new file mode 100644 index 0000000..928ec8b Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libnsl-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libnsl.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/libnsl.so.0 new file mode 120000 index 0000000..47d519f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libnsl.so.0 @@ -0,0 +1 @@ +libnsl-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libpthread-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libpthread-0.9.29.so new file mode 100644 index 0000000..ba9ff40 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libpthread-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libpthread.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/libpthread.so.0 new file mode 120000 index 0000000..1f4d525 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libpthread.so.0 @@ -0,0 +1 @@ +libpthread-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libresolv-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libresolv-0.9.29.so new file mode 100644 index 0000000..386ac9c Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libresolv-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libresolv.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/libresolv.so.0 new file mode 120000 index 0000000..99ed44f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libresolv.so.0 @@ -0,0 +1 @@ +libresolv-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/librt-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/librt-0.9.29.so new file mode 100644 index 0000000..8725647 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/librt-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/librt.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/librt.so.0 new file mode 120000 index 0000000..00aeee7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/librt.so.0 @@ -0,0 +1 @@ +librt-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libthread_db-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libthread_db-0.9.29.so new file mode 100644 index 0000000..34a2951 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libthread_db-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libthread_db.so.1 b/uclibc-crosstools-gcc-4.4.2-1/lib/libthread_db.so.1 new file mode 120000 index 0000000..afe8c3e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libthread_db.so.1 @@ -0,0 +1 @@ +libthread_db-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libuClibc-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libuClibc-0.9.29.so new file mode 100644 index 0000000..71c153a Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libuClibc-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libutil-0.9.29.so b/uclibc-crosstools-gcc-4.4.2-1/lib/libutil-0.9.29.so new file mode 100644 index 0000000..c4c2e7e Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/lib/libutil-0.9.29.so differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/lib/libutil.so.0 b/uclibc-crosstools-gcc-4.4.2-1/lib/libutil.so.0 new file mode 120000 index 0000000..421f18e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/lib/libutil.so.0 @@ -0,0 +1 @@ +libutil-0.9.29.so \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldconfig b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldconfig new file mode 100755 index 0000000..4b7e177 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldconfig differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldd b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldd new file mode 100755 index 0000000..f52633c Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/ldd differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-addr2line b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-addr2line new file mode 120000 index 0000000..f54ce47 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-addr2line @@ -0,0 +1 @@ +mips-linux-uclibc-addr2line \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ar b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ar new file mode 120000 index 0000000..d2f2ef0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ar @@ -0,0 +1 @@ +mips-linux-uclibc-ar \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-as b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-as new file mode 120000 index 0000000..0f34e85 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-as @@ -0,0 +1 @@ +mips-linux-uclibc-as \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-c++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-c++ new file mode 120000 index 0000000..133d9b5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-c++ @@ -0,0 +1 @@ +mips-linux-uclibc-c++ \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-c++filt b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-c++filt new file mode 120000 index 0000000..bdbc87a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-c++filt @@ -0,0 +1 @@ +mips-linux-uclibc-c++filt \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-cc b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-cc new file mode 120000 index 0000000..de030d6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-cc @@ -0,0 +1 @@ +mips-linux-uclibc-cc \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-cpp b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-cpp new file mode 120000 index 0000000..c56f03e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-cpp @@ -0,0 +1 @@ +mips-linux-uclibc-cpp \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-g++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-g++ new file mode 120000 index 0000000..c574e81 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-g++ @@ -0,0 +1 @@ +mips-linux-uclibc-g++ \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcc b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcc new file mode 120000 index 0000000..5245279 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcc @@ -0,0 +1 @@ +mips-linux-uclibc-gcc \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcc-4.4.2 b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcc-4.4.2 new file mode 120000 index 0000000..cb6ee1c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcc-4.4.2 @@ -0,0 +1 @@ +mips-linux-uclibc-gcc-4.4.2 \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gccbug b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gccbug new file mode 120000 index 0000000..0164c17 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gccbug @@ -0,0 +1 @@ +mips-linux-uclibc-gccbug \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcov b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcov new file mode 120000 index 0000000..43a68a1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gcov @@ -0,0 +1 @@ +mips-linux-uclibc-gcov \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gdb b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gdb new file mode 120000 index 0000000..9b53072 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gdb @@ -0,0 +1 @@ +mips-linux-uclibc-gdb \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gprof b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gprof new file mode 120000 index 0000000..460338e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-gprof @@ -0,0 +1 @@ +mips-linux-uclibc-gprof \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ld b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ld new file mode 120000 index 0000000..0882ad2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ld @@ -0,0 +1 @@ +mips-linux-uclibc-ld \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ldconfig b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ldconfig new file mode 120000 index 0000000..bb24844 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ldconfig @@ -0,0 +1 @@ +mips-linux-uclibc-ldconfig \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ldd b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ldd new file mode 120000 index 0000000..e823f3e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ldd @@ -0,0 +1 @@ +mips-linux-uclibc-ldd \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-nm b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-nm new file mode 120000 index 0000000..fe1bd0a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-nm @@ -0,0 +1 @@ +mips-linux-uclibc-nm \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-objcopy b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-objcopy new file mode 120000 index 0000000..5481d5e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-objcopy @@ -0,0 +1 @@ +mips-linux-uclibc-objcopy \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-objdump b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-objdump new file mode 120000 index 0000000..cb32686 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-objdump @@ -0,0 +1 @@ +mips-linux-uclibc-objdump \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ranlib b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ranlib new file mode 120000 index 0000000..703fee7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-ranlib @@ -0,0 +1 @@ +mips-linux-uclibc-ranlib \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-readelf b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-readelf new file mode 120000 index 0000000..4cab6c2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-readelf @@ -0,0 +1 @@ +mips-linux-uclibc-readelf \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-size b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-size new file mode 120000 index 0000000..0558ed1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-size @@ -0,0 +1 @@ +mips-linux-uclibc-size \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-sstrip b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-sstrip new file mode 120000 index 0000000..1331008 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-sstrip @@ -0,0 +1 @@ +mips-linux-uclibc-sstrip \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-strings b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-strings new file mode 120000 index 0000000..694acb5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-strings @@ -0,0 +1 @@ +mips-linux-uclibc-strings \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-strip b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-strip new file mode 120000 index 0000000..9bda32a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-strip @@ -0,0 +1 @@ +mips-linux-uclibc-strip \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-addr2line b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-addr2line new file mode 100755 index 0000000..d945aae Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-addr2line differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ar b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ar new file mode 100755 index 0000000..928c841 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ar differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-as b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-as new file mode 100755 index 0000000..79591da Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-as differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-c++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-c++ new file mode 100755 index 0000000..1c9e54e Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-c++ differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-c++filt b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-c++filt new file mode 100755 index 0000000..5248cee Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-c++filt differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-cc b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-cc new file mode 120000 index 0000000..5245279 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-cc @@ -0,0 +1 @@ +mips-linux-uclibc-gcc \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-cpp b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-cpp new file mode 100755 index 0000000..814acf7 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-cpp differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-g++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-g++ new file mode 100755 index 0000000..1c9e54e Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-g++ differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcc b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcc new file mode 100755 index 0000000..c8a2dd3 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcc differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcc-4.4.2 b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcc-4.4.2 new file mode 100755 index 0000000..c8a2dd3 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcc-4.4.2 differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gccbug b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gccbug new file mode 100755 index 0000000..f9276ee --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gccbug @@ -0,0 +1,558 @@ +#!/bin/sh +# Submit a problem report to a GNATS site. +# Copyright (C) 1993, 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc. +# Contributed by Brendan Kehoe (brendan@cygnus.com), based on a +# version written by Heinz G. Seidl (hgs@cygnus.com). +# +# This file is part of GNU GNATS. +# +# GNU GNATS is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU GNATS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU GNATS; see the file COPYING3. If not see +# . + +# The version of this send-pr. +VERSION=3.113 + +# The submitter-id for your site. +SUBMITTER=net + +# The default mail address for PR submissions. +GNATS_ADDR=gcc-gnats@gcc.gnu.org + +# The default release for this host. +# We have to guess at what program_transform_name might have done. +# "sed 1q" because neither "head -1" nor "head -n 1" is universal, argh. + +DEFAULT_GCC="`echo $0 | sed -e 's/bug//'`" +DEFAULT_RELEASE="`$DEFAULT_GCC --version | sed 1q`" + +# The default organization. +DEFAULT_ORGANIZATION= + +# What mailer to use. This must come after the config file, since it is +# host-dependent. +# Copied from cvsbug +if [ -f /usr/sbin/sendmail ]; then + MAIL_AGENT="/usr/sbin/sendmail -oi -t" +else + MAIL_AGENT="/usr/lib/sendmail -oi -t" +fi +MAILER=`echo $MAIL_AGENT | sed -e 's, .*,,'` +if [ ! -f "$MAILER" ] ; then + echo "$COMMAND: Cannot file mail program \"$MAILER\"." + echo "$COMMAND: Please fix the MAIL_AGENT entry in the $COMMAND file." + exit 1 +fi + + +# How to read the passwd database. +PASSWD="cat /etc/passwd" + +ECHON=bsd + +if [ $ECHON = bsd ] ; then + ECHON1="echo -n" + ECHON2= +elif [ $ECHON = sysv ] ; then + ECHON1=echo + ECHON2='\c' +else + ECHON1=echo + ECHON2= +fi + +# + +if [ -z "$TMPDIR" ]; then + TMPDIR=/tmp +else + if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then + TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`" + fi +fi + +if [ yes = yes ]; then + TEMP0=`mktemp $TMPDIR/poXXXXXX` || exit 1 + TEMP=`mktemp $TMPDIR/pXXXXXX` || exit 1 + BAD=`mktemp $TMPDIR/pbadXXXXXX` || exit 1 + REF=`mktemp $TMPDIR/pfXXXXXX` || exit 1 + REMOVE_TEMP="rm -f $TEMP0 $TEMP $BAD $REF" +else + TEMPD=$TMPDIR/pd$$ + TEMP0=$TEMPD/po$$ + TEMP=$TEMPD/p$$ + BAD=$TEMPD/pbad$$ + REF=$TEMPD/pf$$ + mkdir $TEMPD || exit 1 + REMOVE_TEMP="rm -rf $TEMPD" +fi + +# find a user name +if [ "$LOGNAME" = "" ]; then + if [ "$USER" != "" ]; then + LOGNAME="$USER" + else + LOGNAME="UNKNOWN" + fi +fi + +FROM="$LOGNAME" +REPLY_TO="${REPLY_TO:-${REPLYTO:-$LOGNAME}}" + +# Find out the name of the originator of this PR. +if [ -n "$NAME" ]; then + ORIGINATOR="$NAME" +elif [ -f $HOME/.fullname ]; then + ORIGINATOR="`sed -e '1q' $HOME/.fullname`" +else + # Must use temp file due to incompatibilities in quoting behavior + # and to protect shell metacharacters in the expansion of $LOGNAME + $PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP0 + ORIGINATOR="`cat $TEMP0`" + rm -f $TEMP0 +fi + +if [ -n "$ORGANIZATION" ]; then + if [ -f "$ORGANIZATION" ]; then + ORGANIZATION="`cat $ORGANIZATION`" + fi +else + if [ -n "$DEFAULT_ORGANIZATION" ]; then + ORGANIZATION="$DEFAULT_ORGANIZATION" + elif [ -f $HOME/.organization ]; then + ORGANIZATION="`cat $HOME/.organization`" + fi +fi + +# If they don't have a preferred editor set, then use +if [ -z "$VISUAL" ]; then + if [ -z "$EDITOR" ]; then + EDIT=vi + else + EDIT="$EDITOR" + fi +else + EDIT="$VISUAL" +fi + +# Find out some information. +SYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \ + ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""` +ARCH=`[ -f /bin/arch ] && /bin/arch` +MACHINE=`[ -f /bin/machine ] && /bin/machine` + +COMMAND=`echo $0 | sed -e 's,.*/,,'` +USAGE="Usage: $COMMAND [-PVL] [-t address] [-f filename] [-s severity] + [-c address] [--request-id] [--version]" +REMOVE= +BATCH= +CC= +SEVERITY_C= + +while [ $# -gt 0 ]; do + case "$1" in + -r) ;; # Ignore for backward compat. + -t | --to) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi + shift ; GNATS_ADDR="$1" + EXPLICIT_GNATS_ADDR=true + ;; + -f | --file) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi + shift ; IN_FILE="$1" + if [ "$IN_FILE" != "-" -a ! -r "$IN_FILE" ]; then + echo "$COMMAND: cannot read $IN_FILE" + $REMOVE_TEMP + exit 1 + fi + ;; + -b | --batch) BATCH=true ;; + -c | --cc) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi + shift ; CC="$1" + ;; + -s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi + shift ; SEVERITY_C="$1" + ;; + -p | -P | --print) PRINT=true ;; + -L | --list) FORMAT=norm ;; + -l | -CL | --lisp) FORMAT=lisp ;; + --request-id) REQUEST_ID=true ;; + -h | --help) echo "$USAGE"; $REMOVE_TEMP; exit 0 ;; + -V | --version) cat < max) { max = length($0); } } + END {print max + 1;}'` + c=`expr 70 / $l` + if [ $c -eq 0 ]; then c=1; fi + echo "$CATEGORIES" | \ + awk 'BEGIN {print "Known categories:"; i = 0 } + { printf ("%-'$l'.'$l's", $0); if ((++i % '$c') == 0) { print "" } } + END { print ""; }' + $REMOVE_TEMP + exit 0 + ;; +esac + +ORIGINATOR_C='' +ORGANIZATION_C='' +SYNOPSIS_C='' +if [ -z "$SEVERITY_C" ]; then + SEVERITY_C='<[ non-critical | serious | critical ] (one line)>' +fi +PRIORITY_C='<[ low | medium ] (one line)>' +CATEGORY_C='' +RELEASE_C='' +ENVIRONMENT_C='' +DESCRIPTION_C='' +HOW_TO_REPEAT_C='' +FIX_C='' + +# Catch some signals. ($xs kludge needed by Sun /bin/sh) +xs=0 +trap '$REMOVE_TEMP; exit $xs' 0 +trap 'echo "$COMMAND: Aborting ..."; $REMOVE_TEMP; xs=1; exit' 1 3 13 15 + +# If they told us to use a specific file, then do so. +if [ -n "$IN_FILE" ]; then + if [ "$IN_FILE" = "-" ]; then + # The PR is coming from the standard input. + if [ -n "$EXPLICIT_GNATS_ADDR" ]; then + sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" > $TEMP + else + cat > $TEMP + fi + else + # Use the file they named. + if [ -n "$EXPLICIT_GNATS_ADDR" ]; then + sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" $IN_FILE > $TEMP + else + cat $IN_FILE > $TEMP + fi + fi +else + + if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then + # If their PR_FORM points to a bogus entry, then bail. + if [ ! -f "$PR_FORM" -o ! -r "$PR_FORM" -o ! -s "$PR_FORM" ]; then + echo "$COMMAND: can't seem to read your template file (\`$PR_FORM'), ignoring PR_FORM" + sleep 1 + PRINT_INTERN=bad_prform + fi + fi + + if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then + cp $PR_FORM $TEMP || + ( echo "$COMMAND: could not copy $PR_FORM" ; xs=1; exit ) + else + for file in $TEMP $REF ; do + cat > $file << '__EOF__' +SEND-PR: -*- send-pr -*- +SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as +SEND-PR: will all comments (text enclosed in `<' and `>'). +SEND-PR: +SEND-PR: Please consult the GCC manual if you are not sure how to +SEND-PR: fill out a problem report. +SEND-PR: Note that the Synopsis field is mandatory. The Subject (for +SEND-PR: the mail) will be made the same as Synopsis unless explicitly +SEND-PR: changed. +SEND-PR: +SEND-PR: Choose from the following categories: +SEND-PR: +__EOF__ + + # Format the categories so they fit onto lines. + l=`echo "$CATEGORIES" | \ + awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } } + END {print max + 1;}'` + c=`expr 61 / $l` + if [ $c -eq 0 ]; then c=1; fi + echo "$CATEGORIES" | \ + awk 'BEGIN {printf "SEND-PR: "; i = 0 } + { printf ("%-'$l'.'$l's", $0); + if ((++i % '$c') == 0) { printf "\nSEND-PR: " } } + END { printf "\nSEND-PR:\n"; }' >> $file + + cat >> $file << __EOF__ +To: $GNATS_ADDR +Subject: +From: $FROM +Reply-To: $REPLYTO +Cc: $CC +X-send-pr-version: $VERSION +X-GNATS-Notify: + + +>Submitter-Id: $SUBMITTER +>Originator: $ORIGINATOR +>Organization: ${ORGANIZATION-$ORGANIZATION_C} +>Confidential: no +SEND-PR: Leave "Confidential" as "no"; all GCC PRs are public. +>Synopsis: $SYNOPSIS_C +>Severity: $SEVERITY_C +SEND-PR: critical GCC is completely not operational; no work-around known. +SEND-PR: serious GCC is not working properly; a work-around is possible. +SEND-PR: non-critical Report indicates minor problem. +>Priority: $PRIORITY_C +SEND-PR: medium The problem should be solved in the next release. +SEND-PR: low The problem should be solve in a future release. +>Category: $CATEGORY_C +>Class: <[ doc-bug | accepts-illegal | rejects-legal | wrong-code | ice-on-legal-code| ice-on-illegal-code | pessimizes-code | sw-bug | change-request | support ] (one line)> +SEND-PR: doc-bug The documentation is incorrect. +SEND-PR: accepts-illegal GCC fails to reject erroneous code. +SEND-PR: rejects-legal GCC gives an error message for correct code. +SEND-PR: wrong-code The machine code generated by gcc is incorrect. +SEND-PR: ice-on-legal-code GCC gives an Internal Compiler Error (ICE) +SEND-PR: for correct code +SEND-PR: ice-on-illegal-code GCC gives an ICE instead of reporting an error +SEND-PR: pessimizes-code GCC misses an important optimization opportunity +SEND-PR: sw-bug Software bug of some other class than above +SEND-PR: change-request A feature in GCC is missing. +SEND-PR: support I need help with gcc. +>Release: ${DEFAULT_RELEASE-$RELEASE_C} +>Environment: +`[ -n "$SYSTEM" ] && echo System: $SYSTEM` +`[ -n "$ARCH" ] && echo Architecture: $ARCH` +`[ -n "$MACHINE" ] && echo Machine: $MACHINE` + $ENVIRONMENT_C +host: i386-pc-linux-gnu +build: i386-pc-linux-gnu +target: mips-unknown-linux-uclibc +__EOF__ + cat >> $file << \__EOF__ +configured with: /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/gcc-4.4.2/configure --prefix=/usr --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=mips-linux-uclibc --enable-languages=c,c++ --with-sysroot=/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1 --with-build-time-tools=/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-libssp --disable-tls --enable-shared --with-gmp=/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/gmp --with-mpfr=/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/mpfr --disable-nls --enable-threads --disable-multilib --disable-decimal-float --with-float=soft --with-abi=32 --with-tune=mips32 --with-arch=mips32 --with-pkgversion='Buildroot 2010.02-git' --with-bugurl=http://bugs.buildroot.net/ +__EOF__ + cat >> $file << __EOF__ +>Description: + $DESCRIPTION_C +>How-To-Repeat: + $HOW_TO_REPEAT_C +>Fix: + $FIX_C +__EOF__ + done + fi + + if [ "$PRINT" = true -o "$PRINT_INTERN" = true ]; then + cat $TEMP + xs=0; exit + fi + + chmod u+w $TEMP + if [ -z "$REQUEST_ID" ]; then + eval $EDIT $TEMP + else + ed -s $TEMP << '__EOF__' +/^Subject/s/^Subject:.*/Subject: request for a customer id/ +/^>Category/s/^>Category:.*/>Category: send-pr/ +w +q +__EOF__ + fi + + if cmp -s $REF $TEMP ; then + echo "$COMMAND: problem report not filled out, therefore not sent" + xs=1; exit + fi +fi + +# +# Check the enumeration fields + +# This is a "sed-subroutine" with one keyword parameter +# (with workaround for Sun sed bug) +# +SED_CMD=' +/$PATTERN/{ +s||| +s|<.*>|| +s|^[ ]*|| +s|[ ]*$|| +p +q +}' + + +while [ -z "$REQUEST_ID" ]; do + CNT=0 + + # 1) Confidential + # + PATTERN=">Confidential:" + CONFIDENTIAL=`eval sed -n -e "\"$SED_CMD\"" $TEMP` + case "$CONFIDENTIAL" in + no) CNT=`expr $CNT + 1` ;; + *) echo "$COMMAND: \`$CONFIDENTIAL' is not a valid value for \`Confidential'." ;; + esac + # + # 2) Severity + # + PATTERN=">Severity:" + SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP` + case "$SEVERITY" in + ""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;; + *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'." + esac + # + # 3) Priority + # + PATTERN=">Priority:" + PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP` + case "$PRIORITY" in + ""|low|medium) CNT=`expr $CNT + 1` ;; + high) echo "$COMMAND: \`Priority: high' is reserved for GCC maintainers." ;; + *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'." + esac + # + # 4) Category + # + PATTERN=">Category:" + CATEGORY=`eval sed -n -e "\"$SED_CMD\"" $TEMP` + FOUND= + for C in $CATEGORIES + do + if [ "$C" = "$CATEGORY" ]; then FOUND=true ; break ; fi + done + if [ -n "$FOUND" ]; then + CNT=`expr $CNT + 1` + else + if [ -z "$CATEGORY" ]; then + echo "$COMMAND: you must include a Category: field in your report." + else + echo "$COMMAND: \`$CATEGORY' is not a known category." + fi + fi + # + # 5) Class + # + PATTERN=">Class:" + CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP` + case "$CLASS" in + ""|doc-bug|accepts-illegal|rejects-legal|wrong-code|ice-on-legal-code|ice-on-illegal-code|pessimizes-code|sw-bug|change-request|support) CNT=`expr $CNT + 1` ;; + *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'." + esac + # + # 6) Check that synopsis is not empty + # + if grep "^>Synopsis:[ ]*${SYNOPSIS_C}\$" $TEMP > /dev/null + then + echo "$COMMAND: Synopsis must not be empty." + else + CNT=`expr $CNT + 1` + fi + + [ $CNT -lt 6 -a -z "$BATCH" ] && + echo "Errors were found with the problem report." + + while true; do + if [ -z "$BATCH" ]; then + $ECHON1 "a)bort, e)dit or s)end? $ECHON2" + read input + else + if [ $CNT -eq 6 ]; then + input=s + else + input=a + fi + fi + case "$input" in + a*) + if [ -z "$BATCH" ]; then + echo "$COMMAND: the problem report remains in $BAD and is not sent." + REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF" + mv $TEMP $BAD + else + echo "$COMMAND: the problem report is not sent." + fi + xs=1; exit + ;; + e*) + eval $EDIT $TEMP + continue 2 + ;; + s*) + break 2 + ;; + esac + done +done + +# +# Make sure the mail has got a Subject. If not, use the same as +# in Synopsis. +# + +if grep '^Subject:[ ]*$' $TEMP > /dev/null +then + SYNOPSIS=`grep '^>Synopsis:' $TEMP | sed -e 's/^>Synopsis:[ ]*//'` + ed -s $TEMP << __EOF__ +/^Subject:/s/:.*\$/: $SYNOPSIS/ +w +q +__EOF__ +fi + +# +# Remove comments and send the problem report +# (we have to use patterns, where the comment contains regex chars) +# +# /^>Originator:/s;$ORIGINATOR;; +sed -e " +/^SEND-PR:/d +/^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;; +/^>Confidential:/s;<.*>;; +/^>Synopsis:/s;$SYNOPSIS_C;; +/^>Severity:/s;<.*>;; +/^>Priority:/s;<.*>;; +/^>Category:/s;$CATEGORY_C;; +/^>Class:/s;<.*>;; +/^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;; +/^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;; +/^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;; +/^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;; +/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;; +" $TEMP > $REF + +if $MAIL_AGENT < $REF; then + echo "$COMMAND: problem report sent" + xs=0; exit +else + echo "$COMMAND: mysterious mail failure." + if [ -z "$BATCH" ]; then + echo "$COMMAND: the problem report remains in $BAD and is not sent." + REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF" + mv $REF $BAD + else + echo "$COMMAND: the problem report is not sent." + fi + xs=1; exit +fi diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcov b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcov new file mode 100755 index 0000000..6c0bb37 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gcov differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gdb b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gdb new file mode 100755 index 0000000..4f4c9c8 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gdb differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gprof b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gprof new file mode 100755 index 0000000..13140ad Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gprof differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ld b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ld new file mode 100755 index 0000000..268e1f0 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ld differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ldconfig b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ldconfig new file mode 120000 index 0000000..aea3041 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ldconfig @@ -0,0 +1 @@ +ldconfig \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ldd b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ldd new file mode 120000 index 0000000..033f9e7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ldd @@ -0,0 +1 @@ +ldd \ No newline at end of file diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-nm b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-nm new file mode 100755 index 0000000..d08ce3e Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-nm differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-objcopy b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-objcopy new file mode 100755 index 0000000..72a06f0 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-objcopy differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-objdump b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-objdump new file mode 100755 index 0000000..40fe1e7 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-objdump differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ranlib b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ranlib new file mode 100755 index 0000000..a4cf0e4 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-ranlib differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-readelf b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-readelf new file mode 100755 index 0000000..6859bf3 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-readelf differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-size b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-size new file mode 100755 index 0000000..2318b46 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-size differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-sstrip b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-sstrip new file mode 100755 index 0000000..bd5ab1c Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-sstrip differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-strings b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-strings new file mode 100755 index 0000000..6d93416 Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-strings differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-strip b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-strip new file mode 100755 index 0000000..72fb4aa Binary files /dev/null and b/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-strip differ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/a.out.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/a.out.h new file mode 100644 index 0000000..d963de7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/a.out.h @@ -0,0 +1,5 @@ +#ifdef _LIBC +# include_next +#else +# include +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/alloca.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/alloca.h new file mode 100644 index 0000000..b4fc317 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/alloca.h @@ -0,0 +1,43 @@ +/* Copyright (C) 1992, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ALLOCA_H +#define _ALLOCA_H 1 + +#include + +#define __need_size_t +#include + +__BEGIN_DECLS + +/* Remove any previous definitions. */ +#undef alloca + +/* Allocate a block that will be freed when the calling function exits. */ +extern void *alloca (size_t __size) __THROW; + +#ifdef __GNUC__ +# define alloca(size) __builtin_alloca (size) +#endif /* GCC. */ + +#define __MAX_ALLOCA_CUTOFF 65536 + +__END_DECLS + +#endif /* alloca.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/ar.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ar.h new file mode 100644 index 0000000..5d157ec --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ar.h @@ -0,0 +1,48 @@ +/* Header describing `ar' archive file format. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _AR_H +#define _AR_H 1 + +#include + +/* Archive files start with the ARMAG identifying string. Then follows a + `struct ar_hdr', and as many bytes of member file data as its `ar_size' + member indicates, for each member file. */ + +#define ARMAG "!\n" /* String that begins an archive file. */ +#define SARMAG 8 /* Size of that string. */ + +#define ARFMAG "`\n" /* String in ar_fmag at end of each header. */ + +__BEGIN_DECLS + +struct ar_hdr + { + char ar_name[16]; /* Member file name, sometimes / terminated. */ + char ar_date[12]; /* File date, decimal seconds since Epoch. */ + char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */ + char ar_mode[8]; /* File mode, in ASCII octal. */ + char ar_size[10]; /* File size, in ASCII decimal. */ + char ar_fmag[2]; /* Always contains ARFMAG. */ + }; + +__END_DECLS + +#endif /* ar.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/ftp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/ftp.h new file mode 100644 index 0000000..e5b340d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/ftp.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ftp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_FTP_H +#define _ARPA_FTP_H 1 + +/* Definitions for FTP; see RFC-765. */ + +/* + * Reply codes. + */ +#define PRELIM 1 /* positive preliminary */ +#define COMPLETE 2 /* positive completion */ +#define CONTINUE 3 /* positive intermediate */ +#define TRANSIENT 4 /* transient negative completion */ +#define ERROR 5 /* permanent negative completion */ + +/* + * Type codes + */ +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +#ifdef FTP_NAMES +char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; +#endif + +/* + * Form codes + */ +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ +#ifdef FTP_NAMES +char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; +#endif + +/* + * Structure codes + */ +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ +#ifdef FTP_NAMES +char *strunames[] = {"0", "File", "Record", "Page" }; +#endif + +/* + * Mode types + */ +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ +#ifdef FTP_NAMES +char *modenames[] = {"0", "Stream", "Block", "Compressed" }; +#endif + +/* + * Record Tokens + */ +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +#endif /* arpa/ftp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/inet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/inet.h new file mode 100644 index 0000000..fe3373b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/inet.h @@ -0,0 +1,106 @@ +/* Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ARPA_INET_H +#define _ARPA_INET_H 1 + +#include +#include /* To define `struct in_addr'. */ + +/* Type for length arguments in socket calls. */ +#ifndef __socklen_t_defined +typedef __socklen_t socklen_t; +# define __socklen_t_defined +#endif + +__BEGIN_DECLS + +/* Convert Internet host address from numbers-and-dots notation in CP + into binary data in network byte order. */ +extern in_addr_t inet_addr (__const char *__cp) __THROW; + +/* Return the local host address part of the Internet address in IN. */ +extern in_addr_t inet_lnaof (struct in_addr __in) __THROW; + +/* Make Internet host address in network byte order by combining the + network number NET with the local address HOST. */ +extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host) + __THROW; + +/* Return network number part of the Internet address IN. */ +extern in_addr_t inet_netof (struct in_addr __in) __THROW; + +/* Extract the network number in network byte order from the address + in numbers-and-dots natation starting at CP. */ +extern in_addr_t inet_network (__const char *__cp) __THROW; + +/* Convert Internet number in IN to ASCII representation. The return value + is a pointer to an internal array containing the string. */ +extern char *inet_ntoa (struct in_addr __in) __THROW; + +/* Convert from presentation format of an Internet number in buffer + starting at CP to the binary network format and store result for + interface type AF in buffer starting at BUF. */ +extern int inet_pton (int __af, __const char *__restrict __cp, + void *__restrict __buf) __THROW; + +/* Convert a Internet address in binary network format for interface + type AF in buffer starting at CP to presentation form and place + result in buffer of length LEN astarting at BUF. */ +extern __const char *inet_ntop (int __af, __const void *__restrict __cp, + char *__restrict __buf, socklen_t __len) + __THROW; + + +/* The following functions are not part of XNS 5.2. */ +#ifdef __USE_MISC +/* Convert Internet host address from numbers-and-dots notation in CP + into binary data and store the result in the structure INP. */ +extern int inet_aton (__const char *__cp, struct in_addr *__inp) __THROW; + +/* Format a network number NET into presentation format and place result + in buffer starting at BUF with length of LEN bytes. */ +extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW; + +/* Convert network number for interface type AF in buffer starting at + CP to presentation format. The result will specifiy BITS bits of + the number. */ +extern char *inet_net_ntop (int __af, __const void *__cp, int __bits, + char *__buf, size_t __len) __THROW; + +/* Convert network number for interface type AF from presentation in + buffer starting at CP to network format and store result int + buffer starting at BUF of size LEN. */ +extern int inet_net_pton (int __af, __const char *__cp, + void *__buf, size_t __len) __THROW; + +/* Convert ASCII representation in hexadecimal form of the Internet + address to binary form and place result in buffer of length LEN + starting at BUF. */ +extern unsigned int inet_nsap_addr (__const char *__cp, + unsigned char *__buf, int __len) __THROW; + +/* Convert internet address in binary form in LEN bytes starting at CP + a presentation form and place result in BUF. */ +extern char *inet_nsap_ntoa (int __len, __const unsigned char *__cp, + char *__buf) __THROW; +#endif + +__END_DECLS + +#endif /* arpa/inet.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/nameser.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/nameser.h new file mode 100644 index 0000000..496c8db --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/nameser.h @@ -0,0 +1,557 @@ +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * $BINDId: nameser.h,v 8.37 2000/03/30 21:16:49 vixie Exp $ + */ + +#ifndef _ARPA_NAMESER_H_ +#define _ARPA_NAMESER_H_ + +#define BIND_4_COMPAT + +#include +#if (!defined(BSD)) || (BSD < 199306) +# include +#else +# include +#endif +#include + +/* + * Revision information. This is the release date in YYYYMMDD format. + * It can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__NAMESER > 19931104)". Do not + * compare for equality; rather, use it to determine whether your libbind.a + * contains a new enough lib/nameser/ to support the feature you need. + */ + +#define __NAMESER 19991006 /* New interface version stamp. */ + +/* + * Define constants based on RFC 883, RFC 1034, RFC 1035 + */ +#define NS_PACKETSZ 512 /* maximum packet size */ +#define NS_MAXDNAME 1025 /* maximum domain name */ +#define NS_MAXCDNAME 255 /* maximum compressed domain name */ +#define NS_MAXLABEL 63 /* maximum length of domain label */ +#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */ +#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */ +#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */ +#define NS_INADDRSZ 4 /* IPv4 T_A */ +#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ +#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ +#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ + +/* + * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord() + * in synch with it. + */ +typedef enum __ns_sect { + ns_s_qd = 0, /* Query: Question. */ + ns_s_zn = 0, /* Update: Zone. */ + ns_s_an = 1, /* Query: Answer. */ + ns_s_pr = 1, /* Update: Prerequisites. */ + ns_s_ns = 2, /* Query: Name servers. */ + ns_s_ud = 2, /* Update: Update. */ + ns_s_ar = 3, /* Query|Update: Additional records. */ + ns_s_max = 4 +} ns_sect; + +/* + * This is a message handle. It is caller allocated and has no dynamic data. + * This structure is intended to be opaque to all but ns_parse.c, thus the + * leading _'s on the member names. Use the accessor functions, not the _'s. + */ +typedef struct __ns_msg { + const u_char *_msg, *_eom; + u_int16_t _id, _flags, _counts[ns_s_max]; + const u_char *_sections[ns_s_max]; + ns_sect _sect; + int _rrnum; + const u_char *_ptr; +} ns_msg; + +/* Private data structure - do not use from outside library. */ +struct _ns_flagdata { int mask, shift; }; +extern struct _ns_flagdata _ns_flagdata[]; + +/* Accessor macros - this is part of the public interface. */ +#define ns_msg_getflag(handle, flag) ( \ + ((handle)._flags & _ns_flagdata[flag].mask) \ + >> _ns_flagdata[flag].shift \ + ) +#define ns_msg_id(handle) ((handle)._id + 0) +#define ns_msg_base(handle) ((handle)._msg + 0) +#define ns_msg_end(handle) ((handle)._eom + 0) +#define ns_msg_size(handle) ((handle)._eom - (handle)._msg) +#define ns_msg_count(handle, section) ((handle)._counts[section] + 0) + +/* + * This is a parsed record. It is caller allocated and has no dynamic data. + */ +typedef struct __ns_rr { + char name[NS_MAXDNAME]; + u_int16_t type; + u_int16_t rr_class; + u_int32_t ttl; + u_int16_t rdlength; + const u_char * rdata; +} ns_rr; + +/* Accessor macros - this is part of the public interface. */ +#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") +#define ns_rr_type(rr) ((ns_type)((rr).type + 0)) +#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) +#define ns_rr_ttl(rr) ((rr).ttl + 0) +#define ns_rr_rdlen(rr) ((rr).rdlength + 0) +#define ns_rr_rdata(rr) ((rr).rdata + 0) + +/* + * These don't have to be in the same order as in the packet flags word, + * and they can even overlap in some cases, but they will need to be kept + * in synch with ns_parse.c:ns_flagdata[]. + */ +typedef enum __ns_flag { + ns_f_qr, /* Question/Response. */ + ns_f_opcode, /* Operation code. */ + ns_f_aa, /* Authoritative Answer. */ + ns_f_tc, /* Truncation occurred. */ + ns_f_rd, /* Recursion Desired. */ + ns_f_ra, /* Recursion Available. */ + ns_f_z, /* MBZ. */ + ns_f_ad, /* Authentic Data (DNSSEC). */ + ns_f_cd, /* Checking Disabled (DNSSEC). */ + ns_f_rcode, /* Response code. */ + ns_f_max +} ns_flag; + +/* + * Currently defined opcodes. + */ +typedef enum __ns_opcode { + ns_o_query = 0, /* Standard query. */ + ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ + ns_o_status = 2, /* Name server status query (unsupported). */ + /* Opcode 3 is undefined/reserved. */ + ns_o_notify = 4, /* Zone change notification. */ + ns_o_update = 5, /* Zone update message. */ + ns_o_max = 6 +} ns_opcode; + +/* + * Currently defined response codes. + */ +typedef enum __ns_rcode { + ns_r_noerror = 0, /* No error occurred. */ + ns_r_formerr = 1, /* Format error. */ + ns_r_servfail = 2, /* Server failure. */ + ns_r_nxdomain = 3, /* Name error. */ + ns_r_notimpl = 4, /* Unimplemented. */ + ns_r_refused = 5, /* Operation refused. */ + /* these are for BIND_UPDATE */ + ns_r_yxdomain = 6, /* Name exists */ + ns_r_yxrrset = 7, /* RRset exists */ + ns_r_nxrrset = 8, /* RRset does not exist */ + ns_r_notauth = 9, /* Not authoritative for zone */ + ns_r_notzone = 10, /* Zone of record different from zone section */ + ns_r_max = 11, + /* The following are TSIG extended errors */ + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +/* BIND_UPDATE */ +typedef enum __ns_update_operation { + ns_uop_delete = 0, + ns_uop_add = 1, + ns_uop_max = 2 +} ns_update_operation; + +/* + * This structure is used for TSIG authenticated messages + */ +struct ns_tsig_key { + char name[NS_MAXDNAME], alg[NS_MAXDNAME]; + unsigned char *data; + int len; +}; +typedef struct ns_tsig_key ns_tsig_key; + +/* + * This structure is used for TSIG authenticated TCP messages + */ +struct ns_tcp_tsig_state { + int counter; + struct dst_key *key; + void *ctx; + unsigned char sig[NS_PACKETSZ]; + int siglen; +}; +typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; + +#define NS_TSIG_FUDGE 300 +#define NS_TSIG_TCP_COUNT 100 +#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" + +#define NS_TSIG_ERROR_NO_TSIG -10 +#define NS_TSIG_ERROR_NO_SPACE -11 +#define NS_TSIG_ERROR_FORMERR -12 + +/* + * Currently defined type values for resources and queries. + */ +typedef enum __ns_type { + ns_t_invalid = 0, /* Cookie. */ + ns_t_a = 1, /* Host address. */ + ns_t_ns = 2, /* Authoritative server. */ + ns_t_md = 3, /* Mail destination. */ + ns_t_mf = 4, /* Mail forwarder. */ + ns_t_cname = 5, /* Canonical name. */ + ns_t_soa = 6, /* Start of authority zone. */ + ns_t_mb = 7, /* Mailbox domain name. */ + ns_t_mg = 8, /* Mail group member. */ + ns_t_mr = 9, /* Mail rename name. */ + ns_t_null = 10, /* Null resource record. */ + ns_t_wks = 11, /* Well known service. */ + ns_t_ptr = 12, /* Domain name pointer. */ + ns_t_hinfo = 13, /* Host information. */ + ns_t_minfo = 14, /* Mailbox information. */ + ns_t_mx = 15, /* Mail routing information. */ + ns_t_txt = 16, /* Text strings. */ + ns_t_rp = 17, /* Responsible person. */ + ns_t_afsdb = 18, /* AFS cell database. */ + ns_t_x25 = 19, /* X_25 calling address. */ + ns_t_isdn = 20, /* ISDN calling address. */ + ns_t_rt = 21, /* Router. */ + ns_t_nsap = 22, /* NSAP address. */ + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ + ns_t_sig = 24, /* Security signature. */ + ns_t_key = 25, /* Security key. */ + ns_t_px = 26, /* X.400 mail mapping. */ + ns_t_gpos = 27, /* Geographical position (withdrawn). */ + ns_t_aaaa = 28, /* Ip6 Address. */ + ns_t_loc = 29, /* Location Information. */ + ns_t_nxt = 30, /* Next domain (security). */ + ns_t_eid = 31, /* Endpoint identifier. */ + ns_t_nimloc = 32, /* Nimrod Locator. */ + ns_t_srv = 33, /* Server Selection. */ + ns_t_atma = 34, /* ATM Address */ + ns_t_naptr = 35, /* Naming Authority PoinTeR */ + ns_t_kx = 36, /* Key Exchange */ + ns_t_cert = 37, /* Certification record */ + ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ + ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ + ns_t_sink = 40, /* Kitchen sink (experimentatl) */ + ns_t_opt = 41, /* EDNS0 option (meta-RR) */ + ns_t_tsig = 250, /* Transaction signature. */ + ns_t_ixfr = 251, /* Incremental zone transfer. */ + ns_t_axfr = 252, /* Transfer zone of authority. */ + ns_t_mailb = 253, /* Transfer mailbox records. */ + ns_t_maila = 254, /* Transfer mail agent records. */ + ns_t_any = 255, /* Wildcard match. */ + ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ + ns_t_max = 65536 +} ns_type; + +/* Exclusively a QTYPE? (not also an RTYPE) */ +#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \ + (t) == ns_t_mailb || (t) == ns_t_maila) +/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */ +#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt) +/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */ +#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t)) +#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr) +#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \ + (t) == ns_t_zxfr) + +/* + * Values for class field + */ +typedef enum __ns_class { + ns_c_invalid = 0, /* Cookie. */ + ns_c_in = 1, /* Internet. */ + ns_c_2 = 2, /* unallocated/unsupported. */ + ns_c_chaos = 3, /* MIT Chaos-net. */ + ns_c_hs = 4, /* MIT Hesiod. */ + /* Query class values which do not appear in resource records */ + ns_c_none = 254, /* for prereq. sections in update requests */ + ns_c_any = 255, /* Wildcard match. */ + ns_c_max = 65536 +} ns_class; + +/* DNSSEC constants. */ + +typedef enum __ns_key_types { + ns_kt_rsa = 1, /* key type RSA/MD5 */ + ns_kt_dh = 2, /* Diffie Hellman */ + ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */ + ns_kt_private = 254 /* Private key type starts with OID */ +} ns_key_types; + +typedef enum __ns_cert_types { + cert_t_pkix = 1, /* PKIX (X.509v3) */ + cert_t_spki = 2, /* SPKI */ + cert_t_pgp = 3, /* PGP */ + cert_t_url = 253, /* URL private type */ + cert_t_oid = 254 /* OID private type */ +} ns_cert_types; + +/* Flags field of the KEY RR rdata. */ +#define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */ +#define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */ +#define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */ +#define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */ +#define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */ +/* The type bits can also be interpreted independently, as single bits: */ +#define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */ +#define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */ +#define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */ +#define NS_KEY_EXTENDED_FLAGS 0x1000 /* reserved - must be zero */ +#define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */ +#define NS_KEY_RESERVED5 0x0400 /* reserved - must be zero */ +#define NS_KEY_NAME_TYPE 0x0300 /* these bits determine the type */ +#define NS_KEY_NAME_USER 0x0000 /* key is assoc. with user */ +#define NS_KEY_NAME_ENTITY 0x0200 /* key is assoc. with entity eg host */ +#define NS_KEY_NAME_ZONE 0x0100 /* key is zone key */ +#define NS_KEY_NAME_RESERVED 0x0300 /* reserved meaning */ +#define NS_KEY_RESERVED8 0x0080 /* reserved - must be zero */ +#define NS_KEY_RESERVED9 0x0040 /* reserved - must be zero */ +#define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */ +#define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */ +#define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */ +#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \ + NS_KEY_RESERVED4 | \ + NS_KEY_RESERVED5 | \ + NS_KEY_RESERVED8 | \ + NS_KEY_RESERVED9 | \ + NS_KEY_RESERVED10 | \ + NS_KEY_RESERVED11 ) +#define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */ + +/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ +#define NS_ALG_MD5RSA 1 /* MD5 with RSA */ +#define NS_ALG_DH 2 /* Diffie Hellman KEY */ +#define NS_ALG_DSA 3 /* DSA KEY */ +#define NS_ALG_DSS NS_ALG_DSA +#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */ +#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */ + +/* Protocol values */ +/* value 0 is reserved */ +#define NS_KEY_PROT_TLS 1 +#define NS_KEY_PROT_EMAIL 2 +#define NS_KEY_PROT_DNSSEC 3 +#define NS_KEY_PROT_IPSEC 4 +#define NS_KEY_PROT_ANY 255 + +/* Signatures */ +#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */ +#define NS_MD5RSA_MAX_BITS 2552 + /* Total of binary mod and exp */ +#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3) + /* Max length of text sig block */ +#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4) +#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8) +#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8) + +#define NS_DSA_SIG_SIZE 41 +#define NS_DSA_MIN_SIZE 213 +#define NS_DSA_MAX_BYTES 405 + +/* Offsets into SIG record rdata to find various values */ +#define NS_SIG_TYPE 0 /* Type flags */ +#define NS_SIG_ALG 2 /* Algorithm */ +#define NS_SIG_LABELS 3 /* How many labels in name */ +#define NS_SIG_OTTL 4 /* Original TTL */ +#define NS_SIG_EXPIR 8 /* Expiration time */ +#define NS_SIG_SIGNED 12 /* Signature time */ +#define NS_SIG_FOOT 16 /* Key footprint */ +#define NS_SIG_SIGNER 18 /* Domain name of who signed it */ + +/* How RR types are represented as bit-flags in NXT records */ +#define NS_NXT_BITS 8 +#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS))) +#define NS_NXT_MAX 127 + +/* + * Inline versions of get/put short/long. Pointer is advanced. + */ +#define NS_GET16(s, cp) do { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((u_int16_t)t_cp[0] << 8) \ + | ((u_int16_t)t_cp[1]) \ + ; \ + (cp) += NS_INT16SZ; \ +} while (0) + +#define NS_GET32(l, cp) do { \ + register u_char *t_cp = (u_char *)(cp); \ + (l) = ((u_int32_t)t_cp[0] << 24) \ + | ((u_int32_t)t_cp[1] << 16) \ + | ((u_int32_t)t_cp[2] << 8) \ + | ((u_int32_t)t_cp[3]) \ + ; \ + (cp) += NS_INT32SZ; \ +} while (0) + +#define NS_PUT16(s, cp) do { \ + register u_int16_t t_s = (u_int16_t)(s); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += NS_INT16SZ; \ +} while (0) + +#define NS_PUT32(l, cp) do { \ + register u_int32_t t_l = (u_int32_t)(l); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += NS_INT32SZ; \ +} while (0) + +/* + * ANSI C identifier hiding for bind's lib/nameser. + */ +#define ns_get16 __ns_get16 +#define ns_get32 __ns_get32 +#define ns_put16 __ns_put16 +#define ns_put32 __ns_put32 +#define ns_initparse __ns_initparse +#define ns_skiprr __ns_skiprr +#define ns_parserr __ns_parserr +#define ns_sprintrr __ns_sprintrr +#define ns_sprintrrf __ns_sprintrrf +#define ns_format_ttl __ns_format_ttl +#define ns_parse_ttl __ns_parse_ttl +#define ns_datetosecs __ns_datetosecs +#define ns_name_ntol __ns_name_ntol +#define ns_name_ntop __ns_name_ntop +#define ns_name_pton __ns_name_pton +#define ns_name_unpack __ns_name_unpack +#define ns_name_pack __ns_name_pack +#define ns_name_compress __ns_name_compress +#define ns_name_uncompress __ns_name_uncompress +#define ns_name_skip __ns_name_skip +#define ns_name_rollback __ns_name_rollback +#define ns_sign __ns_sign +#define ns_sign_tcp __ns_sign_tcp +#define ns_sign_tcp_init __ns_sign_tcp_init +#define ns_find_tsig __ns_find_tsig +#define ns_verify __ns_verify +#define ns_verify_tcp __ns_verify_tcp +#define ns_verify_tcp_init __ns_verify_tcp_init +#define ns_samedomain __ns_samedomain +#define ns_subdomain __ns_subdomain +#define ns_makecanon __ns_makecanon +#define ns_samename __ns_samename + +__BEGIN_DECLS +u_int ns_get16 (const u_char *) __THROW; +u_long ns_get32 (const u_char *) __THROW; +void ns_put16 (u_int, u_char *) __THROW; +void ns_put32 (u_long, u_char *) __THROW; +int ns_initparse (const u_char *, int, ns_msg *) __THROW; +int ns_skiprr (const u_char *, const u_char *, ns_sect, int) + __THROW; +int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW; +int ns_sprintrr (const ns_msg *, const ns_rr *, + const char *, const char *, char *, size_t) + __THROW; +int ns_sprintrrf (const u_char *, size_t, const char *, + ns_class, ns_type, u_long, const u_char *, + size_t, const char *, const char *, + char *, size_t) __THROW; +int ns_format_ttl (u_long, char *, size_t) __THROW; +int ns_parse_ttl (const char *, u_long *) __THROW; +u_int32_t ns_datetosecs (const char *cp, int *errp) __THROW; +int ns_name_ntol (const u_char *, u_char *, size_t) __THROW; +int ns_name_ntop (const u_char *, char *, size_t) __THROW; +int ns_name_pton (const char *, u_char *, size_t) __THROW; +int ns_name_unpack (const u_char *, const u_char *, + const u_char *, u_char *, size_t) __THROW; +int ns_name_pack (const u_char *, u_char *, int, + const u_char **, const u_char **) __THROW; +int ns_name_uncompress (const u_char *, const u_char *, + const u_char *, char *, size_t) __THROW; +int ns_name_compress (const char *, u_char *, size_t, + const u_char **, const u_char **) __THROW; +int ns_name_skip (const u_char **, const u_char *) __THROW; +void ns_name_rollback (const u_char *, const u_char **, + const u_char **) __THROW; +int ns_sign (u_char *, int *, int, int, void *, + const u_char *, int, u_char *, int *, time_t) __THROW; +int ns_sign_tcp (u_char *, int *, int, int, + ns_tcp_tsig_state *, int) __THROW; +int ns_sign_tcp_init (void *, const u_char *, int, + ns_tcp_tsig_state *) __THROW; +u_char *ns_find_tsig (u_char *, u_char *) __THROW; +int ns_verify (u_char *, int *, void *, const u_char *, int, + u_char *, int *, time_t *, int) __THROW; +int ns_verify_tcp (u_char *, int *, ns_tcp_tsig_state *, int) + __THROW; +int ns_verify_tcp_init (void *, const u_char *, int, + ns_tcp_tsig_state *) __THROW; +int ns_samedomain (const char *, const char *) __THROW; +int ns_subdomain (const char *, const char *) __THROW; +int ns_makecanon (const char *, char *, size_t) __THROW; +int ns_samename (const char *, const char *) __THROW; +__END_DECLS + +#ifdef BIND_4_COMPAT +#include +#endif + +#endif /* !_ARPA_NAMESER_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/nameser_compat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/nameser_compat.h new file mode 100644 index 0000000..43bcd3a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/nameser_compat.h @@ -0,0 +1,183 @@ +/* Copyright (c) 1983, 1989 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * from nameser.h 8.1 (Berkeley) 6/2/93 + * $BINDId: nameser_compat.h,v 8.11 1999/01/02 08:00:58 vixie Exp $ + */ + +#ifndef _ARPA_NAMESER_COMPAT_ +#define _ARPA_NAMESER_COMPAT_ + +#define __BIND 19950621 /* (DEAD) interface version stamp. */ + +#include + +/* + * Structure for query header. The order of the fields is machine- and + * compiler-dependent, depending on the byte/bit order and the layout + * of bit fields. We use bit fields only in int variables, as this + * is all ANSI requires. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + unsigned id :16; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + unsigned qr: 1; /* response flag */ + unsigned opcode: 4; /* purpose of message */ + unsigned aa: 1; /* authoritive answer */ + unsigned tc: 1; /* truncated message */ + unsigned rd: 1; /* recursion desired */ + /* fields in fourth byte */ + unsigned ra: 1; /* recursion available */ + unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned ad: 1; /* authentic data from named */ + unsigned cd: 1; /* checking disabled by resolver */ + unsigned rcode :4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + unsigned rd :1; /* recursion desired */ + unsigned tc :1; /* truncated message */ + unsigned aa :1; /* authoritive answer */ + unsigned opcode :4; /* purpose of message */ + unsigned qr :1; /* response flag */ + /* fields in fourth byte */ + unsigned rcode :4; /* response code */ + unsigned cd: 1; /* checking disabled by resolver */ + unsigned ad: 1; /* authentic data from named */ + unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned ra :1; /* recursion available */ +#endif + /* remaining bytes */ + unsigned qdcount :16; /* number of question entries */ + unsigned ancount :16; /* number of answer entries */ + unsigned nscount :16; /* number of authority entries */ + unsigned arcount :16; /* number of resource entries */ +} HEADER; + +#define PACKETSZ NS_PACKETSZ +#define MAXDNAME NS_MAXDNAME +#define MAXCDNAME NS_MAXCDNAME +#define MAXLABEL NS_MAXLABEL +#define HFIXEDSZ NS_HFIXEDSZ +#define QFIXEDSZ NS_QFIXEDSZ +#define RRFIXEDSZ NS_RRFIXEDSZ +#define INT32SZ NS_INT32SZ +#define INT16SZ NS_INT16SZ +#define INADDRSZ NS_INADDRSZ +#define IN6ADDRSZ NS_IN6ADDRSZ +#define INDIR_MASK NS_CMPRSFLGS +#define NAMESERVER_PORT NS_DEFAULTPORT + +#define S_ZONE ns_s_zn +#define S_PREREQ ns_s_pr +#define S_UPDATE ns_s_ud +#define S_ADDT ns_s_ar + +#define QUERY ns_o_query +#define IQUERY ns_o_iquery +#define STATUS ns_o_status +#define NS_NOTIFY_OP ns_o_notify +#define NS_UPDATE_OP ns_o_update + +#define NOERROR ns_r_noerror +#define FORMERR ns_r_formerr +#define SERVFAIL ns_r_servfail +#define NXDOMAIN ns_r_nxdomain +#define NOTIMP ns_r_notimpl +#define REFUSED ns_r_refused +#define YXDOMAIN ns_r_yxdomain +#define YXRRSET ns_r_yxrrset +#define NXRRSET ns_r_nxrrset +#define NOTAUTH ns_r_notauth +#define NOTZONE ns_r_notzone +/*#define BADSIG ns_r_badsig*/ +/*#define BADKEY ns_r_badkey*/ +/*#define BADTIME ns_r_badtime*/ + + +#define DELETE ns_uop_delete +#define ADD ns_uop_add + +#define T_A ns_t_a +#define T_NS ns_t_ns +#define T_MD ns_t_md +#define T_MF ns_t_mf +#define T_CNAME ns_t_cname +#define T_SOA ns_t_soa +#define T_MB ns_t_mb +#define T_MG ns_t_mg +#define T_MR ns_t_mr +#define T_NULL ns_t_null +#define T_WKS ns_t_wks +#define T_PTR ns_t_ptr +#define T_HINFO ns_t_hinfo +#define T_MINFO ns_t_minfo +#define T_MX ns_t_mx +#define T_TXT ns_t_txt +#define T_RP ns_t_rp +#define T_AFSDB ns_t_afsdb +#define T_X25 ns_t_x25 +#define T_ISDN ns_t_isdn +#define T_RT ns_t_rt +#define T_NSAP ns_t_nsap +#define T_NSAP_PTR ns_t_nsap_ptr +#define T_SIG ns_t_sig +#define T_KEY ns_t_key +#define T_PX ns_t_px +#define T_GPOS ns_t_gpos +#define T_AAAA ns_t_aaaa +#define T_LOC ns_t_loc +#define T_NXT ns_t_nxt +#define T_EID ns_t_eid +#define T_NIMLOC ns_t_nimloc +#define T_SRV ns_t_srv +#define T_ATMA ns_t_atma +#define T_NAPTR ns_t_naptr +#define T_TSIG ns_t_tsig +#define T_IXFR ns_t_ixfr +#define T_AXFR ns_t_axfr +#define T_MAILB ns_t_mailb +#define T_MAILA ns_t_maila +#define T_ANY ns_t_any + +#define C_IN ns_c_in +#define C_CHAOS ns_c_chaos +#define C_HS ns_c_hs +/* BIND_UPDATE */ +#define C_NONE ns_c_none +#define C_ANY ns_c_any + +#define GETSHORT NS_GET16 +#define GETLONG NS_GET32 +#define PUTSHORT NS_PUT16 +#define PUTLONG NS_PUT32 + +#endif /* _ARPA_NAMESER_COMPAT_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/telnet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/telnet.h new file mode 100644 index 0000000..3774c89 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/telnet.h @@ -0,0 +1,316 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)telnet.h 8.2 (Berkeley) 12/15/93 + */ + +#ifndef _ARPA_TELNET_H +#define _ARPA_TELNET_H 1 + +/* + * Definitions for the TELNET protocol. + */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ +#define ABORT 238 /* Abort process */ +#define SUSP 237 /* Suspend process */ +#define xEOF 236 /* End of file: EOF is already used... */ + +#define SYNCH 242 /* for telfunc calls */ + +#ifdef TELCMDS +char *telcmds[] = { + "EOF", "SUSP", "ABORT", "EOR", + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, +}; +#else +extern char *telcmds[]; +#endif + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ + (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +/* telnet options */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascii character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TUID 26 /* TACACS user identification */ +#define TELOPT_OUTMRK 27 /* output marking */ +#define TELOPT_TTYLOC 28 /* terminal location number */ +#define TELOPT_3270REGIME 29 /* 3270 regime */ +#define TELOPT_X3PAD 30 /* X.3 PAD */ +#define TELOPT_NAWS 31 /* window size */ +#define TELOPT_TSPEED 32 /* terminal speed */ +#define TELOPT_LFLOW 33 /* remote flow control */ +#define TELOPT_LINEMODE 34 /* Linemode option */ +#define TELOPT_XDISPLOC 35 /* X Display Location */ +#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ +#define TELOPT_AUTHENTICATION 37/* Authenticate */ +#define TELOPT_ENCRYPT 38 /* Encryption option */ +#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + + +#define NTELOPTS (1+TELOPT_NEW_ENVIRON) +#ifdef TELOPTS +char *telopts[NTELOPTS+1] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", + "ENCRYPT", "NEW-ENVIRON", + 0, +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +/* sub-option qualifiers */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ + +#define LFLOW_OFF 0 /* Disable remote flow control */ +#define LFLOW_ON 1 /* Enable remote flow control */ +#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ +#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ + +/* + * LINEMODE suboptions + */ + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +/* Not part of protocol, but needed to simplify things... */ +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +/* + * For backwards compatibility, we define SLC_NAMES to be the + * list of names if SLC_NAMES is not defined. + */ +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES +char *slc_names[] = { + SLC_NAMELIST +}; +#else +extern char *slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +/* + * AUTHENTICATION suboptions + */ + +/* + * Who is authenticating who ... + */ +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ +#define AUTH_WHO_SERVER 1 /* Server authenticating client */ +#define AUTH_WHO_MASK 1 + +/* + * amount of authentication done + */ +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_CNT 5 + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +char *authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, +}; +#else +extern char *authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +/* + * ENCRYPTion suboptions + */ +#define ENCRYPT_IS 0 /* I pick encryption type ... */ +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ +#define ENCRYPT_REPLY 2 /* Initial setup response */ +#define ENCRYPT_START 3 /* Am starting to send encrypted */ +#define ENCRYPT_END 4 /* Am ending encrypted */ +#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ +#define ENCRYPT_REQEND 6 /* Request you send encrypting */ +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +char *encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0, +}; +char *enctype_names[] = { + "ANY", "DES_CFB64", "DES_OFB64", 0, +}; +#else +extern char *encrypt_names[]; +extern char *enctype_names[]; +#endif + + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +#endif /* arpa/telnet.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/tftp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/tftp.h new file mode 100644 index 0000000..21b0559 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/arpa/tftp.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tftp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_TFTP_H +#define _ARPA_TFTP_H 1 + +/* + * Trivial File Transfer Protocol (IEN-133) + */ +#define SEGSIZE 512 /* data segment size */ + +/* + * Packet types. + */ +#define RRQ 01 /* read request */ +#define WRQ 02 /* write request */ +#define DATA 03 /* data packet */ +#define ACK 04 /* acknowledgement */ +#define ERROR 05 /* error code */ + +struct tftphdr { + short th_opcode; /* packet type */ + union { + unsigned short tu_block; /* block # */ + short tu_code; /* error code */ + char tu_stuff[1]; /* request packet stuff */ + } __attribute__ ((__packed__)) th_u; + char th_data[1]; /* data or error string */ +} __attribute__ ((__packed__)); + +#define th_block th_u.tu_block +#define th_code th_u.tu_code +#define th_stuff th_u.tu_stuff +#define th_msg th_data + +/* + * Error codes. + */ +#define EUNDEF 0 /* not defined */ +#define ENOTFOUND 1 /* file not found */ +#define EACCESS 2 /* access violation */ +#define ENOSPACE 3 /* disk full or allocation exceeded */ +#define EBADOP 4 /* illegal TFTP operation */ +#define EBADID 5 /* unknown transfer ID */ +#define EEXISTS 6 /* file already exists */ +#define ENOUSER 7 /* no such user */ + +#endif /* arpa/tftp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/..install.cmd new file mode 100644 index 0000000..3cc39f6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/asm-generic/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/asm-generic /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/asm-generic mips errno-base.h errno.h fcntl.h int-l64.h int-ll64.h ioctl.h mman.h poll.h resource.h siginfo.h signal.h statfs.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/asm-generic /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/asm-generic mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/asm-generic/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/errno-base.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/errno-base.h new file mode 100644 index 0000000..6511597 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/errno-base.h @@ -0,0 +1,39 @@ +#ifndef _ASM_GENERIC_ERRNO_BASE_H +#define _ASM_GENERIC_ERRNO_BASE_H + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/errno.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/errno.h new file mode 100644 index 0000000..e8852c0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/errno.h @@ -0,0 +1,109 @@ +#ifndef _ASM_GENERIC_ERRNO_H +#define _ASM_GENERIC_ERRNO_H + +#include + +#define EDEADLK 35 /* Resource deadlock would occur */ +#define ENAMETOOLONG 36 /* File name too long */ +#define ENOLCK 37 /* No record locks available */ +#define ENOSYS 38 /* Function not implemented */ +#define ENOTEMPTY 39 /* Directory not empty */ +#define ELOOP 40 /* Too many symbolic links encountered */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define ENOMSG 42 /* No message of desired type */ +#define EIDRM 43 /* Identifier removed */ +#define ECHRNG 44 /* Channel number out of range */ +#define EL2NSYNC 45 /* Level 2 not synchronized */ +#define EL3HLT 46 /* Level 3 halted */ +#define EL3RST 47 /* Level 3 reset */ +#define ELNRNG 48 /* Link number out of range */ +#define EUNATCH 49 /* Protocol driver not attached */ +#define ENOCSI 50 /* No CSI structure available */ +#define EL2HLT 51 /* Level 2 halted */ +#define EBADE 52 /* Invalid exchange */ +#define EBADR 53 /* Invalid request descriptor */ +#define EXFULL 54 /* Exchange full */ +#define ENOANO 55 /* No anode */ +#define EBADRQC 56 /* Invalid request code */ +#define EBADSLT 57 /* Invalid slot */ + +#define EDEADLOCK EDEADLK + +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 72 /* Multihop attempted */ +#define EDOTDOT 73 /* RFS specific error */ +#define EBADMSG 74 /* Not a data message */ +#define EOVERFLOW 75 /* Value too large for defined data type */ +#define ENOTUNIQ 76 /* Name not unique on network */ +#define EBADFD 77 /* File descriptor in bad state */ +#define EREMCHG 78 /* Remote address changed */ +#define ELIBACC 79 /* Can not access a needed shared library */ +#define ELIBBAD 80 /* Accessing a corrupted shared library */ +#define ELIBSCN 81 /* .lib section in a.out corrupted */ +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define EILSEQ 84 /* Illegal byte sequence */ +#define ERESTART 85 /* Interrupted system call should be restarted */ +#define ESTRPIPE 86 /* Streams pipe error */ +#define EUSERS 87 /* Too many users */ +#define ENOTSOCK 88 /* Socket operation on non-socket */ +#define EDESTADDRREQ 89 /* Destination address required */ +#define EMSGSIZE 90 /* Message too long */ +#define EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 92 /* Protocol not available */ +#define EPROTONOSUPPORT 93 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define EADDRINUSE 98 /* Address already in use */ +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define ENETDOWN 100 /* Network is down */ +#define ENETUNREACH 101 /* Network is unreachable */ +#define ENETRESET 102 /* Network dropped connection because of reset */ +#define ECONNABORTED 103 /* Software caused connection abort */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EISCONN 106 /* Transport endpoint is already connected */ +#define ENOTCONN 107 /* Transport endpoint is not connected */ +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define ETIMEDOUT 110 /* Connection timed out */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EHOSTDOWN 112 /* Host is down */ +#define EHOSTUNREACH 113 /* No route to host */ +#define EALREADY 114 /* Operation already in progress */ +#define EINPROGRESS 115 /* Operation now in progress */ +#define ESTALE 116 /* Stale NFS file handle */ +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ +#define EDQUOT 122 /* Quota exceeded */ + +#define ENOMEDIUM 123 /* No medium found */ +#define EMEDIUMTYPE 124 /* Wrong medium type */ +#define ECANCELED 125 /* Operation Canceled */ +#define ENOKEY 126 /* Required key not available */ +#define EKEYEXPIRED 127 /* Key has expired */ +#define EKEYREVOKED 128 /* Key has been revoked */ +#define EKEYREJECTED 129 /* Key was rejected by service */ + +/* for robust mutexes */ +#define EOWNERDEAD 130 /* Owner died */ +#define ENOTRECOVERABLE 131 /* State not recoverable */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/fcntl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/fcntl.h new file mode 100644 index 0000000..4d3e483 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/fcntl.h @@ -0,0 +1,151 @@ +#ifndef _ASM_GENERIC_FCNTL_H +#define _ASM_GENERIC_FCNTL_H + +#include + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 00000003 +#define O_RDONLY 00000000 +#define O_WRONLY 00000001 +#define O_RDWR 00000002 +#ifndef O_CREAT +#define O_CREAT 00000100 /* not fcntl */ +#endif +#ifndef O_EXCL +#define O_EXCL 00000200 /* not fcntl */ +#endif +#ifndef O_NOCTTY +#define O_NOCTTY 00000400 /* not fcntl */ +#endif +#ifndef O_TRUNC +#define O_TRUNC 00001000 /* not fcntl */ +#endif +#ifndef O_APPEND +#define O_APPEND 00002000 +#endif +#ifndef O_NONBLOCK +#define O_NONBLOCK 00004000 +#endif +#ifndef O_SYNC +#define O_SYNC 00010000 +#endif +#ifndef FASYNC +#define FASYNC 00020000 /* fcntl, for BSD compatibility */ +#endif +#ifndef O_DIRECT +#define O_DIRECT 00040000 /* direct disk access hint */ +#endif +#ifndef O_LARGEFILE +#define O_LARGEFILE 00100000 +#endif +#ifndef O_DIRECTORY +#define O_DIRECTORY 00200000 /* must be a directory */ +#endif +#ifndef O_NOFOLLOW +#define O_NOFOLLOW 00400000 /* don't follow links */ +#endif +#ifndef O_NOATIME +#define O_NOATIME 01000000 +#endif +#ifndef O_CLOEXEC +#define O_CLOEXEC 02000000 /* set close_on_exec */ +#endif +#ifndef O_NDELAY +#define O_NDELAY O_NONBLOCK +#endif + +#define F_DUPFD 0 /* dup */ +#define F_GETFD 1 /* get close_on_exec */ +#define F_SETFD 2 /* set/clear close_on_exec */ +#define F_GETFL 3 /* get file->f_flags */ +#define F_SETFL 4 /* set file->f_flags */ +#ifndef F_GETLK +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 +#endif +#ifndef F_SETOWN +#define F_SETOWN 8 /* for sockets. */ +#define F_GETOWN 9 /* for sockets. */ +#endif +#ifndef F_SETSIG +#define F_SETSIG 10 /* for sockets. */ +#define F_GETSIG 11 /* for sockets. */ +#endif + +/* for F_[GET|SET]FL */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* for posix fcntl() and lockf() */ +#ifndef F_RDLCK +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 +#endif + +/* for old implementation of bsd flock () */ +#ifndef F_EXLCK +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ +#endif + +/* for leases */ +#ifndef F_INPROGRESS +#define F_INPROGRESS 16 +#endif + +/* operations for bsd flock(), also used by the kernel implementation */ +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +#define LOCK_UN 8 /* remove lock */ + +#define LOCK_MAND 32 /* This is a mandatory flock ... */ +#define LOCK_READ 64 /* which allows concurrent read operations */ +#define LOCK_WRITE 128 /* which allows concurrent write operations */ +#define LOCK_RW 192 /* which allows concurrent read & write ops */ + +#define F_LINUX_SPECIFIC_BASE 1024 + +#ifndef HAVE_ARCH_STRUCT_FLOCK +#ifndef __ARCH_FLOCK_PAD +#define __ARCH_FLOCK_PAD +#endif + +struct flock { + short l_type; + short l_whence; + __kernel_off_t l_start; + __kernel_off_t l_len; + __kernel_pid_t l_pid; + __ARCH_FLOCK_PAD +}; +#endif + +#ifndef CONFIG_64BIT + +#ifndef F_GETLK64 +#define F_GETLK64 12 /* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 +#endif + +#ifndef HAVE_ARCH_STRUCT_FLOCK64 +#ifndef __ARCH_FLOCK64_PAD +#define __ARCH_FLOCK64_PAD +#endif + +struct flock64 { + short l_type; + short l_whence; + __kernel_loff_t l_start; + __kernel_loff_t l_len; + __kernel_pid_t l_pid; + __ARCH_FLOCK64_PAD +}; +#endif +#endif /* !CONFIG_64BIT */ + +#endif /* _ASM_GENERIC_FCNTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/int-l64.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/int-l64.h new file mode 100644 index 0000000..2a3239e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/int-l64.h @@ -0,0 +1,32 @@ +/* + * asm-generic/int-l64.h + * + * Integer declarations for architectures which use "long" + * for 64-bit types. + */ + +#ifndef _ASM_GENERIC_INT_L64_H +#define _ASM_GENERIC_INT_L64_H + +#ifndef __ASSEMBLY__ +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +typedef __signed__ long __s64; +typedef unsigned long __u64; + +#endif /* __ASSEMBLY__ */ + + +#endif /* _ASM_GENERIC_INT_L64_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/int-ll64.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/int-ll64.h new file mode 100644 index 0000000..d797333 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/int-ll64.h @@ -0,0 +1,37 @@ +/* + * asm-generic/int-ll64.h + * + * Integer declarations for architectures which use "long long" + * for 64-bit types. + */ + +#ifndef _ASM_GENERIC_INT_LL64_H +#define _ASM_GENERIC_INT_LL64_H + +#ifndef __ASSEMBLY__ +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#ifdef __GNUC__ +__extension__ typedef __signed__ long long __s64; +__extension__ typedef unsigned long long __u64; +#else +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +#endif /* __ASSEMBLY__ */ + + +#endif /* _ASM_GENERIC_INT_LL64_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/ioctl.h new file mode 100644 index 0000000..0da2c7d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/ioctl.h @@ -0,0 +1,96 @@ +#ifndef _ASM_GENERIC_IOCTL_H +#define _ASM_GENERIC_IOCTL_H + +/* ioctl command encoding: 32 bits total, command in lower 16 bits, + * size of the parameter structure in the lower 14 bits of the + * upper 16 bits. + * Encoding the size of the parameter structure in the ioctl request + * is useful for catching programs compiled with old versions + * and to avoid overwriting user space outside the user buffer area. + * The highest 2 bits are reserved for indicating the ``access mode''. + * NOTE: This limits the max parameter size to 16kB -1 ! + */ + +/* + * The following is for compatibility across the various Linux + * platforms. The generic ioctl numbering scheme doesn't really enforce + * a type field. De facto, however, the top 8 bits of the lower 16 + * bits are indeed used as a type field, so we might just as well make + * this explicit here. Please be sure to use the decoding macros + * below from now on. + */ +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 + +/* + * Let any architecture override either of the following before + * including this file. + */ + +#ifndef _IOC_SIZEBITS +# define _IOC_SIZEBITS 14 +#endif + +#ifndef _IOC_DIRBITS +# define _IOC_DIRBITS 2 +#endif + +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) + +/* + * Direction bits, which any architecture can choose to override + * before including this file. + */ + +#ifndef _IOC_NONE +# define _IOC_NONE 0U +#endif + +#ifndef _IOC_WRITE +# define _IOC_WRITE 1U +#endif + +#ifndef _IOC_READ +# define _IOC_READ 2U +#endif + +#define _IOC(dir,type,nr,size) \ + (((dir) << _IOC_DIRSHIFT) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +#define _IOC_TYPECHECK(t) (sizeof(t)) + +/* used to create numbers */ +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) +#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) +#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) + +/* used to decode ioctl numbers.. */ +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) + +/* ...and for the drivers/sound files... */ + +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) + +#endif /* _ASM_GENERIC_IOCTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/mman.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/mman.h new file mode 100644 index 0000000..5e3dde2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/mman.h @@ -0,0 +1,41 @@ +#ifndef _ASM_GENERIC_MMAN_H +#define _ASM_GENERIC_MMAN_H + +/* + Author: Michael S. Tsirkin , Mellanox Technologies Ltd. + Based on: asm-xxx/mman.h +*/ + +#define PROT_READ 0x1 /* page can be read */ +#define PROT_WRITE 0x2 /* page can be written */ +#define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_SEM 0x8 /* page may be used for atomic ops */ +#define PROT_NONE 0x0 /* page can not be accessed */ +#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ +#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ + +#define MAP_SHARED 0x01 /* Share changes */ +#define MAP_PRIVATE 0x02 /* Changes are private */ +#define MAP_TYPE 0x0f /* Mask for type of mapping */ +#define MAP_FIXED 0x10 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x20 /* don't use a file */ + +#define MS_ASYNC 1 /* sync memory asynchronously */ +#define MS_INVALIDATE 2 /* invalidate the caches */ +#define MS_SYNC 4 /* synchronous memory sync */ + +#define MADV_NORMAL 0 /* no further special treatment */ +#define MADV_RANDOM 1 /* expect random page references */ +#define MADV_SEQUENTIAL 2 /* expect sequential page references */ +#define MADV_WILLNEED 3 /* will need these pages */ +#define MADV_DONTNEED 4 /* don't need these pages */ + +/* common parameters: try to keep these consistent across architectures */ +#define MADV_REMOVE 9 /* remove these pages & resources */ +#define MADV_DONTFORK 10 /* don't inherit across fork */ +#define MADV_DOFORK 11 /* do inherit across fork */ + +/* compatibility flags */ +#define MAP_FILE 0 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/poll.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/poll.h new file mode 100644 index 0000000..44bce83 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/poll.h @@ -0,0 +1,37 @@ +#ifndef __ASM_GENERIC_POLL_H +#define __ASM_GENERIC_POLL_H + +/* These are specified by iBCS2 */ +#define POLLIN 0x0001 +#define POLLPRI 0x0002 +#define POLLOUT 0x0004 +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLNVAL 0x0020 + +/* The rest seem to be more-or-less nonstandard. Check them! */ +#define POLLRDNORM 0x0040 +#define POLLRDBAND 0x0080 +#ifndef POLLWRNORM +#define POLLWRNORM 0x0100 +#endif +#ifndef POLLWRBAND +#define POLLWRBAND 0x0200 +#endif +#ifndef POLLMSG +#define POLLMSG 0x0400 +#endif +#ifndef POLLREMOVE +#define POLLREMOVE 0x1000 +#endif +#ifndef POLLRDHUP +#define POLLRDHUP 0x2000 +#endif + +struct pollfd { + int fd; + short events; + short revents; +}; + +#endif /* __ASM_GENERIC_POLL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/resource.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/resource.h new file mode 100644 index 0000000..a36da84 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/resource.h @@ -0,0 +1,68 @@ +#ifndef _ASM_GENERIC_RESOURCE_H +#define _ASM_GENERIC_RESOURCE_H + +/* + * Resource limit IDs + * + * ( Compatibility detail: there are architectures that have + * a different rlimit ID order in the 5-9 range and want + * to keep that order for binary compatibility. The reasons + * are historic and all new rlimits are identical across all + * arches. If an arch has such special order for some rlimits + * then it defines them prior including asm-generic/resource.h. ) + */ + +#define RLIMIT_CPU 0 /* CPU time in sec */ +#define RLIMIT_FSIZE 1 /* Maximum filesize */ +#define RLIMIT_DATA 2 /* max data size */ +#define RLIMIT_STACK 3 /* max stack size */ +#define RLIMIT_CORE 4 /* max core file size */ + +#ifndef RLIMIT_RSS +# define RLIMIT_RSS 5 /* max resident set size */ +#endif + +#ifndef RLIMIT_NPROC +# define RLIMIT_NPROC 6 /* max number of processes */ +#endif + +#ifndef RLIMIT_NOFILE +# define RLIMIT_NOFILE 7 /* max number of open files */ +#endif + +#ifndef RLIMIT_MEMLOCK +# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ +#endif + +#ifndef RLIMIT_AS +# define RLIMIT_AS 9 /* address space limit */ +#endif + +#define RLIMIT_LOCKS 10 /* maximum file locks held */ +#define RLIMIT_SIGPENDING 11 /* max number of pending signals */ +#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */ +#define RLIMIT_NICE 13 /* max nice prio allowed to raise to + 0-39 for nice level 19 .. -20 */ +#define RLIMIT_RTPRIO 14 /* maximum realtime priority */ +#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */ +#define RLIM_NLIMITS 16 + +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + * + * Some architectures override this (for compatibility reasons): + */ +#ifndef RLIM_INFINITY +# define RLIM_INFINITY (~0UL) +#endif + +/* + * RLIMIT_STACK default maximum - some architectures override it: + */ +#ifndef _STK_LIM_MAX +# define _STK_LIM_MAX RLIM_INFINITY +#endif + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/siginfo.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/siginfo.h new file mode 100644 index 0000000..f6d812f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/siginfo.h @@ -0,0 +1,261 @@ +#ifndef _ASM_GENERIC_SIGINFO_H +#define _ASM_GENERIC_SIGINFO_H + + +#include + +typedef union sigval { + int sival_int; + void *sival_ptr; +} sigval_t; + +/* + * This is the size (including padding) of the part of the + * struct siginfo that is before the union. + */ +#ifndef __ARCH_SI_PREAMBLE_SIZE +#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) +#endif + +#define SI_MAX_SIZE 128 +#ifndef SI_PAD_SIZE +#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int)) +#endif + +#ifndef __ARCH_SI_UID_T +#define __ARCH_SI_UID_T __kernel_uid32_t +#endif + +/* + * The default "si_band" type is "long", as specified by POSIX. + * However, some architectures want to override this to "int" + * for historical compatibility reasons, so we allow that. + */ +#ifndef __ARCH_SI_BAND_T +#define __ARCH_SI_BAND_T long +#endif + +#ifndef HAVE_ARCH_SIGINFO_T + +typedef struct siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[SI_PAD_SIZE]; + + /* kill() */ + struct { + __kernel_pid_t _pid; /* sender's pid */ + __ARCH_SI_UID_T _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + __kernel_timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; + sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + __kernel_pid_t _pid; /* sender's pid */ + __ARCH_SI_UID_T _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + __kernel_pid_t _pid; /* which child */ + __ARCH_SI_UID_T _uid; /* sender's uid */ + int _status; /* exit code */ + __kernel_clock_t _utime; + __kernel_clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + void *_addr; /* faulting insn/memory ref. */ +#ifdef __ARCH_SI_TRAPNO + int _trapno; /* TRAP # which caused the signal */ +#endif + } _sigfault; + + /* SIGPOLL */ + struct { + __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} siginfo_t; + +#endif + +/* + * How these fields are to be accessed. + */ +#define si_pid _sifields._kill._pid +#define si_uid _sifields._kill._uid +#define si_tid _sifields._timer._tid +#define si_overrun _sifields._timer._overrun +#define si_sys_private _sifields._timer._sys_private +#define si_status _sifields._sigchld._status +#define si_utime _sifields._sigchld._utime +#define si_stime _sifields._sigchld._stime +#define si_value _sifields._rt._sigval +#define si_int _sifields._rt._sigval.sival_int +#define si_ptr _sifields._rt._sigval.sival_ptr +#define si_addr _sifields._sigfault._addr +#ifdef __ARCH_SI_TRAPNO +#define si_trapno _sifields._sigfault._trapno +#endif +#define si_band _sifields._sigpoll._band +#define si_fd _sifields._sigpoll._fd + +#define __SI_KILL 0 +#define __SI_TIMER 0 +#define __SI_POLL 0 +#define __SI_FAULT 0 +#define __SI_CHLD 0 +#define __SI_RT 0 +#define __SI_MESGQ 0 +#define __SI_CODE(T,N) (N) + +/* + * si_code values + * Digital reserves positive values for kernel-generated signals. + */ +#define SI_USER 0 /* sent by kill, sigsend, raise */ +#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ +#define SI_QUEUE -1 /* sent by sigqueue */ +#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */ +#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */ +#define SI_ASYNCIO -4 /* sent by AIO completion */ +#define SI_SIGIO -5 /* sent by queued SIGIO */ +#define SI_TKILL -6 /* sent by tkill system call */ +#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */ + +#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) +#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) + +/* + * SIGILL si_codes + */ +#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */ +#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */ +#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */ +#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */ +#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */ +#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */ +#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */ +#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */ +#define NSIGILL 8 + +/* + * SIGFPE si_codes + */ +#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */ +#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */ +#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */ +#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */ +#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */ +#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */ +#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */ +#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */ +#define NSIGFPE 8 + +/* + * SIGSEGV si_codes + */ +#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */ +#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */ +#define NSIGSEGV 2 + +/* + * SIGBUS si_codes + */ +#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */ +#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */ +#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */ +#define NSIGBUS 3 + +/* + * SIGTRAP si_codes + */ +#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */ +#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */ +#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */ +#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */ +#define NSIGTRAP 4 + +/* + * SIGCHLD si_codes + */ +#define CLD_EXITED (__SI_CHLD|1) /* child has exited */ +#define CLD_KILLED (__SI_CHLD|2) /* child was killed */ +#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */ +#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */ +#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */ +#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */ +#define NSIGCHLD 6 + +/* + * SIGPOLL si_codes + */ +#define POLL_IN (__SI_POLL|1) /* data input available */ +#define POLL_OUT (__SI_POLL|2) /* output buffers available */ +#define POLL_MSG (__SI_POLL|3) /* input message available */ +#define POLL_ERR (__SI_POLL|4) /* i/o error */ +#define POLL_PRI (__SI_POLL|5) /* high priority input available */ +#define POLL_HUP (__SI_POLL|6) /* device disconnected */ +#define NSIGPOLL 6 + +/* + * sigevent definitions + * + * It seems likely that SIGEV_THREAD will have to be handled from + * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the + * thread manager then catches and does the appropriate nonsense. + * However, everything is written out here so as to not get lost. + */ +#define SIGEV_SIGNAL 0 /* notify via signal */ +#define SIGEV_NONE 1 /* other notification: meaningless */ +#define SIGEV_THREAD 2 /* deliver via thread creation */ +#define SIGEV_THREAD_ID 4 /* deliver to thread */ + +/* + * This works because the alignment is ok on all current architectures + * but we leave open this being overridden in the future + */ +#ifndef __ARCH_SIGEV_PREAMBLE_SIZE +#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t)) +#endif + +#define SIGEV_MAX_SIZE 64 +#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \ + / sizeof(int)) + +typedef struct sigevent { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + union { + int _pad[SIGEV_PAD_SIZE]; + int _tid; + + struct { + void (*_function)(sigval_t); + void *_attribute; /* really pthread_attr_t */ + } _sigev_thread; + } _sigev_un; +} sigevent_t; + +#define sigev_notify_function _sigev_un._sigev_thread._function +#define sigev_notify_attributes _sigev_un._sigev_thread._attribute +#define sigev_notify_thread_id _sigev_un._tid + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/signal.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/signal.h new file mode 100644 index 0000000..91adad3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/signal.h @@ -0,0 +1,28 @@ +#ifndef __ASM_GENERIC_SIGNAL_H +#define __ASM_GENERIC_SIGNAL_H + + + +#ifndef SIG_BLOCK +#define SIG_BLOCK 0 /* for blocking signals */ +#endif +#ifndef SIG_UNBLOCK +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#endif +#ifndef SIG_SETMASK +#define SIG_SETMASK 2 /* for setting the signal mask */ +#endif + +#ifndef __ASSEMBLY__ +typedef void __signalfn_t(int); +typedef __signalfn_t *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ +#endif + +#endif /* __ASM_GENERIC_SIGNAL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/statfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/statfs.h new file mode 100644 index 0000000..86798cc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm-generic/statfs.h @@ -0,0 +1,80 @@ +#ifndef _GENERIC_STATFS_H +#define _GENERIC_STATFS_H + +#include + + +/* + * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'. + * Yes, they differ in signedness as well as size. + * Special cases can override it for themselves -- except for S390x, which + * is just a little too special for us. And MIPS, which I'm not touching + * with a 10' pole. + */ +#ifndef __statfs_word +#if BITS_PER_LONG == 64 +#define __statfs_word long +#else +#define __statfs_word __u32 +#endif +#endif + +struct statfs { + __statfs_word f_type; + __statfs_word f_bsize; + __statfs_word f_blocks; + __statfs_word f_bfree; + __statfs_word f_bavail; + __statfs_word f_files; + __statfs_word f_ffree; + __kernel_fsid_t f_fsid; + __statfs_word f_namelen; + __statfs_word f_frsize; + __statfs_word f_spare[5]; +}; + +/* + * ARM needs to avoid the 32-bit padding at the end, for consistency + * between EABI and OABI + */ +#ifndef ARCH_PACK_STATFS64 +#define ARCH_PACK_STATFS64 +#endif + +struct statfs64 { + __statfs_word f_type; + __statfs_word f_bsize; + __u64 f_blocks; + __u64 f_bfree; + __u64 f_bavail; + __u64 f_files; + __u64 f_ffree; + __kernel_fsid_t f_fsid; + __statfs_word f_namelen; + __statfs_word f_frsize; + __statfs_word f_spare[5]; +} ARCH_PACK_STATFS64; + +/* + * IA64 and x86_64 need to avoid the 32-bit padding at the end, + * to be compatible with the i386 ABI + */ +#ifndef ARCH_PACK_COMPAT_STATFS64 +#define ARCH_PACK_COMPAT_STATFS64 +#endif + +struct compat_statfs64 { + __u32 f_type; + __u32 f_bsize; + __u64 f_blocks; + __u64 f_bfree; + __u64 f_bavail; + __u64 f_files; + __u64 f_ffree; + __kernel_fsid_t f_fsid; + __u32 f_namelen; + __u32 f_frsize; + __u32 f_spare[5]; +} ARCH_PACK_COMPAT_STATFS64; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/..install.cmd new file mode 100644 index 0000000..030c1df --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/asm/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/arch/mips/include/asm /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/asm mips auxvec.h byteorder.h cachectl.h errno.h fcntl.h ioctl.h ioctls.h ipcbuf.h mman.h msgbuf.h param.h poll.h posix_types.h ptrace.h resource.h sembuf.h setup.h sgidefs.h shmbuf.h sigcontext.h siginfo.h signal.h socket.h sockios.h stat.h statfs.h swab.h sysmips.h termbits.h termios.h types.h unistd.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/arch/mips/include/asm /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/asm mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/asm/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/auxvec.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/auxvec.h new file mode 100644 index 0000000..7cf7f2d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/auxvec.h @@ -0,0 +1,4 @@ +#ifndef _ASM_AUXVEC_H +#define _ASM_AUXVEC_H + +#endif /* _ASM_AUXVEC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/byteorder.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/byteorder.h new file mode 100644 index 0000000..9579051 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/byteorder.h @@ -0,0 +1,19 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1996, 99, 2003 by Ralf Baechle + */ +#ifndef _ASM_BYTEORDER_H +#define _ASM_BYTEORDER_H + +#if defined(__MIPSEB__) +#include +#elif defined(__MIPSEL__) +#include +#else +# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" +#endif + +#endif /* _ASM_BYTEORDER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/cachectl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/cachectl.h new file mode 100644 index 0000000..f3ce721 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/cachectl.h @@ -0,0 +1,26 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1994, 1995, 1996 by Ralf Baechle + */ +#ifndef _ASM_CACHECTL +#define _ASM_CACHECTL + +/* + * Options for cacheflush system call + */ +#define ICACHE (1<<0) /* flush instruction cache */ +#define DCACHE (1<<1) /* writeback and flush data cache */ +#define BCACHE (ICACHE|DCACHE) /* flush both caches */ + +/* + * Caching modes for the cachectl(2) call + * + * cachectl(2) is currently not supported and returns ENOSYS. + */ +#define CACHEABLE 0 /* make pages cacheable */ +#define UNCACHEABLE 1 /* make pages uncacheable */ + +#endif /* _ASM_CACHECTL */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/errno.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/errno.h new file mode 100644 index 0000000..3d4ff02 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/errno.h @@ -0,0 +1,125 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle + */ +#ifndef _ASM_ERRNO_H +#define _ASM_ERRNO_H + +/* + * These error numbers are intended to be MIPS ABI compatible + */ + +#include + +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Resource deadlock would occur */ +#define ENOLCK 46 /* No record locks available */ +#define EBADE 50 /* Invalid exchange */ +#define EBADR 51 /* Invalid request descriptor */ +#define EXFULL 52 /* Exchange full */ +#define ENOANO 53 /* No anode */ +#define EBADRQC 54 /* Invalid request code */ +#define EBADSLT 55 /* Invalid slot */ +#define EDEADLOCK 56 /* File locking deadlock error */ +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EDOTDOT 73 /* RFS specific error */ +#define EMULTIHOP 74 /* Multihop attempted */ +#define EBADMSG 77 /* Not a data message */ +#define ENAMETOOLONG 78 /* File name too long */ +#define EOVERFLOW 79 /* Value too large for defined data type */ +#define ENOTUNIQ 80 /* Name not unique on network */ +#define EBADFD 81 /* File descriptor in bad state */ +#define EREMCHG 82 /* Remote address changed */ +#define ELIBACC 83 /* Can not access a needed shared library */ +#define ELIBBAD 84 /* Accessing a corrupted shared library */ +#define ELIBSCN 85 /* .lib section in a.out corrupted */ +#define ELIBMAX 86 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 87 /* Cannot exec a shared library directly */ +#define EILSEQ 88 /* Illegal byte sequence */ +#define ENOSYS 89 /* Function not implemented */ +#define ELOOP 90 /* Too many symbolic links encountered */ +#define ERESTART 91 /* Interrupted system call should be restarted */ +#define ESTRPIPE 92 /* Streams pipe error */ +#define ENOTEMPTY 93 /* Directory not empty */ +#define EUSERS 94 /* Too many users */ +#define ENOTSOCK 95 /* Socket operation on non-socket */ +#define EDESTADDRREQ 96 /* Destination address required */ +#define EMSGSIZE 97 /* Message too long */ +#define EPROTOTYPE 98 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 99 /* Protocol not available */ +#define EPROTONOSUPPORT 120 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 121 /* Socket type not supported */ +#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 123 /* Protocol family not supported */ +#define EAFNOSUPPORT 124 /* Address family not supported by protocol */ +#define EADDRINUSE 125 /* Address already in use */ +#define EADDRNOTAVAIL 126 /* Cannot assign requested address */ +#define ENETDOWN 127 /* Network is down */ +#define ENETUNREACH 128 /* Network is unreachable */ +#define ENETRESET 129 /* Network dropped connection because of reset */ +#define ECONNABORTED 130 /* Software caused connection abort */ +#define ECONNRESET 131 /* Connection reset by peer */ +#define ENOBUFS 132 /* No buffer space available */ +#define EISCONN 133 /* Transport endpoint is already connected */ +#define ENOTCONN 134 /* Transport endpoint is not connected */ +#define EUCLEAN 135 /* Structure needs cleaning */ +#define ENOTNAM 137 /* Not a XENIX named type file */ +#define ENAVAIL 138 /* No XENIX semaphores available */ +#define EISNAM 139 /* Is a named type file */ +#define EREMOTEIO 140 /* Remote I/O error */ +#define EINIT 141 /* Reserved */ +#define EREMDEV 142 /* Error 142 */ +#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 144 /* Too many references: cannot splice */ +#define ETIMEDOUT 145 /* Connection timed out */ +#define ECONNREFUSED 146 /* Connection refused */ +#define EHOSTDOWN 147 /* Host is down */ +#define EHOSTUNREACH 148 /* No route to host */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EALREADY 149 /* Operation already in progress */ +#define EINPROGRESS 150 /* Operation now in progress */ +#define ESTALE 151 /* Stale NFS file handle */ +#define ECANCELED 158 /* AIO operation canceled */ + +/* + * These error are Linux extensions. + */ +#define ENOMEDIUM 159 /* No medium found */ +#define EMEDIUMTYPE 160 /* Wrong medium type */ +#define ENOKEY 161 /* Required key not available */ +#define EKEYEXPIRED 162 /* Key has expired */ +#define EKEYREVOKED 163 /* Key has been revoked */ +#define EKEYREJECTED 164 /* Key was rejected by service */ + +/* for robust mutexes */ +#define EOWNERDEAD 165 /* Owner died */ +#define ENOTRECOVERABLE 166 /* State not recoverable */ + +#define EDQUOT 1133 /* Quota exceeded */ + + +#endif /* _ASM_ERRNO_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/fcntl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/fcntl.h new file mode 100644 index 0000000..2a52333 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/fcntl.h @@ -0,0 +1,61 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 96, 97, 98, 99, 2003, 05 Ralf Baechle + */ +#ifndef _ASM_FCNTL_H +#define _ASM_FCNTL_H + + +#define O_APPEND 0x0008 +#define O_SYNC 0x0010 +#define O_NONBLOCK 0x0080 +#define O_CREAT 0x0100 /* not fcntl */ +#define O_TRUNC 0x0200 /* not fcntl */ +#define O_EXCL 0x0400 /* not fcntl */ +#define O_NOCTTY 0x0800 /* not fcntl */ +#define FASYNC 0x1000 /* fcntl, for BSD compatibility */ +#define O_LARGEFILE 0x2000 /* allow large file opens */ +#define O_DIRECT 0x8000 /* direct disk access hint */ + +#define F_GETLK 14 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN 24 /* for sockets. */ +#define F_GETOWN 23 /* for sockets. */ + +#ifndef __mips64 +#define F_GETLK64 33 /* using 'struct flock64' */ +#define F_SETLK64 34 +#define F_SETLKW64 35 +#endif + +/* + * The flavours of struct flock. "struct flock" is the ABI compliant + * variant. Finally struct flock64 is the LFS variant of struct flock. As + * a historic accident and inconsistence with the ABI definition it doesn't + * contain all the same fields as struct flock. + */ + +#ifdef CONFIG_32BIT + +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + long l_sysid; + __kernel_pid_t l_pid; + long pad[4]; +}; + +#define HAVE_ARCH_STRUCT_FLOCK + +#endif /* CONFIG_32BIT */ + +#include + +#endif /* _ASM_FCNTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ioctl.h new file mode 100644 index 0000000..94ca66c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ioctl.h @@ -0,0 +1,89 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 96, 99, 2001 Ralf Baechle + */ +#ifndef _ASM_IOCTL_H +#define _ASM_IOCTL_H + +/* + * The original linux ioctl numbering scheme was just a general + * "anything goes" setup, where more or less random numbers were + * assigned. Sorry, I was clueless when I started out on this. + * + * On the alpha, we'll try to clean it up a bit, using a more sane + * ioctl numbering, and also trying to be compatible with OSF/1 in + * the process. I'd like to clean it up for the i386 as well, but + * it's so painful recognizing both the new and the old numbers.. + * + * The same applies for for the MIPS ABI; in fact even the macros + * from Linux/Alpha fit almost perfectly. + */ + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 13 +#define _IOC_DIRBITS 3 + +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) + +/* + * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. + * And this turns out useful to catch old ioctl numbers in header + * files for us. + */ +#define _IOC_NONE 1U +#define _IOC_READ 2U +#define _IOC_WRITE 4U + +/* + * The following are included for compatibility + */ +#define _IOC_VOID 0x20000000 +#define _IOC_OUT 0x40000000 +#define _IOC_IN 0x80000000 +#define _IOC_INOUT (IOC_IN|IOC_OUT) + +#define _IOC(dir, type, nr, size) \ + (((dir) << _IOC_DIRSHIFT) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +#define _IOC_TYPECHECK(t) (sizeof(t)) + +/* used to create numbers */ +#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0) +#define _IOR(type, nr, size) _IOC(_IOC_READ, (type), (nr), (_IOC_TYPECHECK(size))) +#define _IOW(type, nr, size) _IOC(_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size))) +#define _IOWR(type, nr, size) _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size))) +#define _IOR_BAD(type, nr, size) _IOC(_IOC_READ, (type), (nr), sizeof(size)) +#define _IOW_BAD(type, nr, size) _IOC(_IOC_WRITE, (type), (nr), sizeof(size)) +#define _IOWR_BAD(type, nr, size) _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), sizeof(size)) + + +/* used to decode them.. */ +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) + +/* ...and for the drivers/sound files... */ + +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) + +#endif /* _ASM_IOCTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ioctls.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ioctls.h new file mode 100644 index 0000000..a8fed70 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ioctls.h @@ -0,0 +1,109 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1996, 2001 Ralf Baechle + * Copyright (C) 2001 MIPS Technologies, Inc. + */ +#ifndef __ASM_IOCTLS_H +#define __ASM_IOCTLS_H + +#include + +#define TCGETA 0x5401 +#define TCSETA 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */ +#define TCSETAW 0x5403 +#define TCSETAF 0x5404 + +#define TCSBRK 0x5405 +#define TCXONC 0x5406 +#define TCFLSH 0x5407 + +#define TCGETS 0x540d +#define TCSETS 0x540e +#define TCSETSW 0x540f +#define TCSETSF 0x5410 + +#define TIOCEXCL 0x740d /* set exclusive use of tty */ +#define TIOCNXCL 0x740e /* reset exclusive use of tty */ +#define TIOCOUTQ 0x7472 /* output queue size */ +#define TIOCSTI 0x5472 /* simulate terminal input */ +#define TIOCMGET 0x741d /* get all modem bits */ +#define TIOCMBIS 0x741b /* bis modem bits */ +#define TIOCMBIC 0x741c /* bic modem bits */ +#define TIOCMSET 0x741a /* set all modem bits */ +#define TIOCPKT 0x5470 /* pty: set/clear packet mode */ +#define TIOCPKT_DATA 0x00 /* data packet */ +#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ +#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ +#define TIOCPKT_STOP 0x04 /* stop output */ +#define TIOCPKT_START 0x08 /* start output */ +#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ +#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ +/* #define TIOCPKT_IOCTL 0x40 state change of pty driver */ +#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ +#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ +#define TIOCNOTTY 0x5471 /* void tty association */ +#define TIOCSETD 0x7401 +#define TIOCGETD 0x7400 + +#define FIOCLEX 0x6601 +#define FIONCLEX 0x6602 +#define FIOASYNC 0x667d +#define FIONBIO 0x667e +#define FIOQSIZE 0x667f + +#define TIOCGLTC 0x7474 /* get special local chars */ +#define TIOCSLTC 0x7475 /* set special local chars */ +#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ +#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ +#define TIOCCONS _IOW('t', 120, int) /* become virtual console */ + +#define FIONREAD 0x467f +#define TIOCINQ FIONREAD + +#define TIOCGETP 0x7408 +#define TIOCSETP 0x7409 +#define TIOCSETN 0x740a /* TIOCSETP wo flush */ + +/* #define TIOCSETA _IOW('t', 20, struct termios) set termios struct */ +/* #define TIOCSETAW _IOW('t', 21, struct termios) drain output, set */ +/* #define TIOCSETAF _IOW('t', 22, struct termios) drn out, fls in, set */ +/* #define TIOCGETD _IOR('t', 26, int) get line discipline */ +/* #define TIOCSETD _IOW('t', 27, int) set line discipline */ + /* 127-124 compat */ + +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x7416 /* Return the session ID of FD */ +#define TCGETS2 _IOR('T', 0x2A, struct termios2) +#define TCSETS2 _IOW('T', 0x2B, struct termios2) +#define TCSETSW2 _IOW('T', 0x2C, struct termios2) +#define TCSETSF2 _IOW('T', 0x2D, struct termios2) +#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ + +/* I hope the range from 0x5480 on is free ... */ +#define TIOCSCTTY 0x5480 /* become controlling tty */ +#define TIOCGSOFTCAR 0x5481 +#define TIOCSSOFTCAR 0x5482 +#define TIOCLINUX 0x5483 +#define TIOCGSERIAL 0x5484 +#define TIOCSSERIAL 0x5485 +#define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */ +#define TIOCSERCONFIG 0x5488 +#define TIOCSERGWILD 0x5489 +#define TIOCSERSWILD 0x548a +#define TIOCGLCKTRMIOS 0x548b +#define TIOCSLCKTRMIOS 0x548c +#define TIOCSERGSTRUCT 0x548d /* For debugging only */ +#define TIOCSERGETLSR 0x548e /* Get line status register */ +#define TIOCSERGETMULTI 0x548f /* Get multiport config */ +#define TIOCSERSETMULTI 0x5490 /* Set multiport config */ +#define TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x5492 /* read serial port __inline__ interrupt counts */ +#define TIOCGHAYESESP 0x5493 /* Get Hayes ESP configuration */ +#define TIOCSHAYESESP 0x5494 /* Set Hayes ESP configuration */ + +#endif /* __ASM_IOCTLS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ipcbuf.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ipcbuf.h new file mode 100644 index 0000000..d47d08f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ipcbuf.h @@ -0,0 +1,28 @@ +#ifndef _ASM_IPCBUF_H +#define _ASM_IPCBUF_H + +/* + * The ipc64_perm structure for alpha architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 32-bit seq + * - 2 miscellaneous 64-bit values + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_uid_t cuid; + __kernel_gid_t cgid; + __kernel_mode_t mode; + unsigned short seq; + unsigned short __pad1; + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* _ASM_IPCBUF_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/mman.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/mman.h new file mode 100644 index 0000000..e4d6f1f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/mman.h @@ -0,0 +1,77 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1999, 2002 by Ralf Baechle + */ +#ifndef _ASM_MMAN_H +#define _ASM_MMAN_H + +/* + * Protections are chosen from these bits, OR'd together. The + * implementation does not necessarily support PROT_EXEC or PROT_WRITE + * without PROT_READ. The only guarantees are that no writing will be + * allowed without PROT_WRITE and no access will be allowed for PROT_NONE. + */ +#define PROT_NONE 0x00 /* page can not be accessed */ +#define PROT_READ 0x01 /* page can be read */ +#define PROT_WRITE 0x02 /* page can be written */ +#define PROT_EXEC 0x04 /* page can be executed */ +/* 0x08 reserved for PROT_EXEC_NOFLUSH */ +#define PROT_SEM 0x10 /* page may be used for atomic ops */ +#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ +#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ + +/* + * Flags for mmap + */ +#define MAP_SHARED 0x001 /* Share changes */ +#define MAP_PRIVATE 0x002 /* Changes are private */ +#define MAP_TYPE 0x00f /* Mask for type of mapping */ +#define MAP_FIXED 0x010 /* Interpret addr exactly */ + +/* not used by linux, but here to make sure we don't clash with ABI defines */ +#define MAP_RENAME 0x020 /* Assign page to file */ +#define MAP_AUTOGROW 0x040 /* File may grow by writing */ +#define MAP_LOCAL 0x080 /* Copy on fork/sproc */ +#define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */ + +/* These are linux-specific */ +#define MAP_NORESERVE 0x0400 /* don't check for reservations */ +#define MAP_ANONYMOUS 0x0800 /* don't use a file */ +#define MAP_GROWSDOWN 0x1000 /* stack-like segment */ +#define MAP_DENYWRITE 0x2000 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ +#define MAP_LOCKED 0x8000 /* pages are locked */ +#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x20000 /* do not block on IO */ + +/* + * Flags for msync + */ +#define MS_ASYNC 0x0001 /* sync memory asynchronously */ +#define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */ +#define MS_SYNC 0x0004 /* synchronous memory sync */ + +/* + * Flags for mlockall + */ +#define MCL_CURRENT 1 /* lock all current mappings */ +#define MCL_FUTURE 2 /* lock all future mappings */ + +#define MADV_NORMAL 0 /* no further special treatment */ +#define MADV_RANDOM 1 /* expect random page references */ +#define MADV_SEQUENTIAL 2 /* expect sequential page references */ +#define MADV_WILLNEED 3 /* will need these pages */ +#define MADV_DONTNEED 4 /* don't need these pages */ + +/* common parameters: try to keep these consistent across architectures */ +#define MADV_REMOVE 9 /* remove these pages & resources */ +#define MADV_DONTFORK 10 /* don't inherit across fork */ +#define MADV_DOFORK 11 /* do inherit across fork */ + +/* compatibility flags */ +#define MAP_FILE 0 + +#endif /* _ASM_MMAN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/msgbuf.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/msgbuf.h new file mode 100644 index 0000000..0d6c7f1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/msgbuf.h @@ -0,0 +1,47 @@ +#ifndef _ASM_MSGBUF_H +#define _ASM_MSGBUF_H + + +/* + * The msqid64_ds structure for the MIPS architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - extension of time_t to 64-bit on 32-bitsystem to solve the y2038 problem + * - 2 miscellaneous unsigned long values + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; +#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) + unsigned long __unused1; +#endif + __kernel_time_t msg_stime; /* last msgsnd time */ +#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) + unsigned long __unused1; +#endif +#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) + unsigned long __unused2; +#endif + __kernel_time_t msg_rtime; /* last msgrcv time */ +#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) + unsigned long __unused2; +#endif +#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) + unsigned long __unused3; +#endif + __kernel_time_t msg_ctime; /* last change time */ +#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) + unsigned long __unused3; +#endif + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; + +#endif /* _ASM_MSGBUF_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/param.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/param.h new file mode 100644 index 0000000..b5b7262 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/param.h @@ -0,0 +1,25 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright 1994 - 2000, 2002 Ralf Baechle (ralf@gnu.org) + * Copyright 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_PARAM_H +#define _ASM_PARAM_H + + +#ifndef HZ +#define HZ 100 +#endif + +#define EXEC_PAGESIZE 65536 + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64 /* max length of hostname */ + +#endif /* _ASM_PARAM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/poll.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/poll.h new file mode 100644 index 0000000..47b9520 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/poll.h @@ -0,0 +1,9 @@ +#ifndef __ASM_POLL_H +#define __ASM_POLL_H + +#define POLLWRNORM POLLOUT +#define POLLWRBAND 0x0100 + +#include + +#endif /* __ASM_POLL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/posix_types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/posix_types.h new file mode 100644 index 0000000..9a35f18 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/posix_types.h @@ -0,0 +1,73 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1996, 97, 98, 99, 2000 by Ralf Baechle + * Copyright (C) 1999, 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_POSIX_TYPES_H +#define _ASM_POSIX_TYPES_H + +#include + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. Also, we cannot + * assume GCC is being used. + */ + +typedef unsigned long __kernel_ino_t; +typedef unsigned int __kernel_mode_t; +#if (_MIPS_SZLONG == 32) +typedef unsigned long __kernel_nlink_t; +#endif +#if (_MIPS_SZLONG == 64) +typedef unsigned int __kernel_nlink_t; +#endif +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef int __kernel_ipc_pid_t; +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +#if (_MIPS_SZLONG == 32) +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +#endif +#if (_MIPS_SZLONG == 64) +typedef unsigned long __kernel_size_t; +typedef long __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; +#endif +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; +typedef long __kernel_daddr_t; +typedef char * __kernel_caddr_t; + +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; +typedef __kernel_uid_t __kernel_old_uid_t; +typedef __kernel_gid_t __kernel_old_gid_t; +typedef unsigned int __kernel_old_dev_t; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t; +#endif + +typedef struct { +#if (_MIPS_SZLONG == 32) + long val[2]; +#endif +#if (_MIPS_SZLONG == 64) + int val[2]; +#endif +} __kernel_fsid_t; + + +#endif /* _ASM_POSIX_TYPES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ptrace.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ptrace.h new file mode 100644 index 0000000..257dbfe --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/ptrace.h @@ -0,0 +1,116 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 by Ralf Baechle + * Copyright (C) 1999, 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_PTRACE_H +#define _ASM_PTRACE_H + +/* 0 - 31 are integer registers, 32 - 63 are fp registers. */ +#define FPR_BASE 32 +#define PC 64 +#define CAUSE 65 +#define BADVADDR 66 +#define MMHI 67 +#define MMLO 68 +#define FPC_CSR 69 +#define FPC_EIR 70 +#define DSP_BASE 71 /* 3 more hi / lo register pairs */ +#define DSP_CONTROL 77 +#define ACX 78 + +/* + * This struct defines the way the registers are stored on the stack during a + * system call/exception. As usual the registers k0/k1 aren't being saved. + */ +struct pt_regs { +#ifdef CONFIG_32BIT + /* Pad bytes for argument save space on the stack. */ + unsigned long pad0[6]; +#endif + + /* Saved main processor registers. */ + unsigned long regs[32]; + + /* Saved special registers. */ + unsigned long cp0_status; + unsigned long hi; + unsigned long lo; +#ifdef CONFIG_CPU_HAS_SMARTMIPS + unsigned long acx; +#endif + unsigned long cp0_badvaddr; + unsigned long cp0_cause; + unsigned long cp0_epc; +#ifdef CONFIG_MIPS_MT_SMTC + unsigned long cp0_tcstatus; +#endif /* CONFIG_MIPS_MT_SMTC */ +#ifdef CONFIG_CPU_CAVIUM_OCTEON + unsigned long long mpl[3]; /* MTM{0,1,2} */ + unsigned long long mtp[3]; /* MTP{0,1,2} */ +#endif +} __attribute__ ((aligned (8))); + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +/* #define PTRACE_GETFPXREGS 18 */ +/* #define PTRACE_SETFPXREGS 19 */ + +#define PTRACE_OLDSETOPTIONS 21 + +#define PTRACE_GET_THREAD_AREA 25 +#define PTRACE_SET_THREAD_AREA 26 + +/* Calls to trace a 64bit program from a 32bit program. */ +#define PTRACE_PEEKTEXT_3264 0xc0 +#define PTRACE_PEEKDATA_3264 0xc1 +#define PTRACE_POKETEXT_3264 0xc2 +#define PTRACE_POKEDATA_3264 0xc3 +#define PTRACE_GET_THREAD_AREA_3264 0xc4 + +/* Read and write watchpoint registers. */ +enum pt_watch_style { + pt_watch_style_mips32, + pt_watch_style_mips64 +}; +struct mips32_watch_regs { + unsigned int watchlo[8]; + /* Lower 16 bits of watchhi. */ + unsigned short watchhi[8]; + /* Valid mask and I R W bits. + * bit 0 -- 1 if W bit is usable. + * bit 1 -- 1 if R bit is usable. + * bit 2 -- 1 if I bit is usable. + * bits 3 - 11 -- Valid watchhi mask bits. + */ + unsigned short watch_masks[8]; + /* The number of valid watch register pairs. */ + unsigned int num_valid; +} __attribute__((aligned(8))); + +struct mips64_watch_regs { + unsigned long long watchlo[8]; + unsigned short watchhi[8]; + unsigned short watch_masks[8]; + unsigned int num_valid; +} __attribute__((aligned(8))); + +struct pt_watch_regs { + enum pt_watch_style style; + union { + struct mips32_watch_regs mips32; + struct mips64_watch_regs mips64; + }; +}; + +#define PTRACE_GET_WATCH_REGS 0xd0 +#define PTRACE_SET_WATCH_REGS 0xd1 + + +#endif /* _ASM_PTRACE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/resource.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/resource.h new file mode 100644 index 0000000..87cb308 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/resource.h @@ -0,0 +1,35 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 96, 98, 99, 2000 by Ralf Baechle + * Copyright (C) 1999 Silicon Graphics, Inc. + */ +#ifndef _ASM_RESOURCE_H +#define _ASM_RESOURCE_H + + +/* + * These five resource limit IDs have a MIPS/Linux-specific ordering, + * the rest comes from the generic header: + */ +#define RLIMIT_NOFILE 5 /* max number of open files */ +#define RLIMIT_AS 6 /* address space limit */ +#define RLIMIT_RSS 7 /* max resident set size */ +#define RLIMIT_NPROC 8 /* max number of processes */ +#define RLIMIT_MEMLOCK 9 /* max locked-in-memory address space */ + +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway, + * but we keep the old value on MIPS32, + * for compatibility: + */ +#ifdef CONFIG_32BIT +# define RLIM_INFINITY 0x7fffffffUL +#endif + +#include + +#endif /* _ASM_RESOURCE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sembuf.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sembuf.h new file mode 100644 index 0000000..7281a4d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sembuf.h @@ -0,0 +1,22 @@ +#ifndef _ASM_SEMBUF_H +#define _ASM_SEMBUF_H + +/* + * The semid64_ds structure for the MIPS architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 64-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + __kernel_time_t sem_otime; /* last semop time */ + __kernel_time_t sem_ctime; /* last change time */ + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* _ASM_SEMBUF_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/setup.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/setup.h new file mode 100644 index 0000000..7c12a41 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/setup.h @@ -0,0 +1,7 @@ +#ifndef _MIPS_SETUP_H +#define _MIPS_SETUP_H + +#define COMMAND_LINE_SIZE 256 + + +#endif /* __SETUP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sgidefs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sgidefs.h new file mode 100644 index 0000000..876442f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sgidefs.h @@ -0,0 +1,44 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1996, 1999, 2001 Ralf Baechle + * Copyright (C) 1999 Silicon Graphics, Inc. + * Copyright (C) 2001 MIPS Technologies, Inc. + */ +#ifndef __ASM_SGIDEFS_H +#define __ASM_SGIDEFS_H + +/* + * Using a Linux compiler for building Linux seems logic but not to + * everybody. + */ +#ifndef __linux__ +#error Use a Linux compiler or give up. +#endif + +/* + * Definitions for the ISA levels + * + * With the introduction of MIPS32 / MIPS64 instruction sets definitions + * MIPS ISAs are no longer subsets of each other. Therefore comparisons + * on these symbols except with == may result in unexpected results and + * are forbidden! + */ +#define _MIPS_ISA_MIPS1 1 +#define _MIPS_ISA_MIPS2 2 +#define _MIPS_ISA_MIPS3 3 +#define _MIPS_ISA_MIPS4 4 +#define _MIPS_ISA_MIPS5 5 +#define _MIPS_ISA_MIPS32 6 +#define _MIPS_ISA_MIPS64 7 + +/* + * Subprogram calling convention + */ +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 + +#endif /* __ASM_SGIDEFS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/shmbuf.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/shmbuf.h new file mode 100644 index 0000000..f994438 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/shmbuf.h @@ -0,0 +1,38 @@ +#ifndef _ASM_SHMBUF_H +#define _ASM_SHMBUF_H + +/* + * The shmid64_ds structure for the MIPS architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit rsp. 64-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + size_t shm_segsz; /* size of segment (bytes) */ + __kernel_time_t shm_atime; /* last attach time */ + __kernel_time_t shm_dtime; /* last detach time */ + __kernel_time_t shm_ctime; /* last change time */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused1; + unsigned long __unused2; +}; + +struct shminfo64 { + unsigned long shmmax; + unsigned long shmmin; + unsigned long shmmni; + unsigned long shmseg; + unsigned long shmall; + unsigned long __unused1; + unsigned long __unused2; + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _ASM_SHMBUF_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sigcontext.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sigcontext.h new file mode 100644 index 0000000..0f64a70 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sigcontext.h @@ -0,0 +1,78 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1996, 1997, 1999 by Ralf Baechle + * Copyright (C) 1999 Silicon Graphics, Inc. + */ +#ifndef _ASM_SIGCONTEXT_H +#define _ASM_SIGCONTEXT_H + +#include +#include + +#if _MIPS_SIM == _MIPS_SIM_ABI32 + +/* + * Keep this struct definition in sync with the sigcontext fragment + * in arch/mips/tools/offset.c + */ +struct sigcontext { + unsigned int sc_regmask; /* Unused */ + unsigned int sc_status; /* Unused */ + unsigned long long sc_pc; + unsigned long long sc_regs[32]; + unsigned long long sc_fpregs[32]; + unsigned int sc_acx; /* Was sc_ownedfp */ + unsigned int sc_fpc_csr; + unsigned int sc_fpc_eir; /* Unused */ + unsigned int sc_used_math; + unsigned int sc_dsp; /* dsp status, was sc_ssflags */ + unsigned long long sc_mdhi; + unsigned long long sc_mdlo; + unsigned long sc_hi1; /* Was sc_cause */ + unsigned long sc_lo1; /* Was sc_badvaddr */ + unsigned long sc_hi2; /* Was sc_sigset[4] */ + unsigned long sc_lo2; + unsigned long sc_hi3; + unsigned long sc_lo3; +}; + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ + +#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 + +#include +/* + * Keep this struct definition in sync with the sigcontext fragment + * in arch/mips/tools/offset.c + * + * Warning: this structure illdefined with sc_badvaddr being just an unsigned + * int so it was changed to unsigned long in 2.6.0-test1. This may break + * binary compatibility - no prisoners. + * DSP ASE in 2.6.12-rc4. Turn sc_mdhi and sc_mdlo into an array of four + * entries, add sc_dsp and sc_reserved for padding. No prisoners. + */ +struct sigcontext { + __u64 sc_regs[32]; + __u64 sc_fpregs[32]; + __u64 sc_mdhi; + __u64 sc_hi1; + __u64 sc_hi2; + __u64 sc_hi3; + __u64 sc_mdlo; + __u64 sc_lo1; + __u64 sc_lo2; + __u64 sc_lo3; + __u64 sc_pc; + __u32 sc_fpc_csr; + __u32 sc_used_math; + __u32 sc_dsp; + __u32 sc_reserved; +}; + + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */ + +#endif /* _ASM_SIGCONTEXT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/siginfo.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/siginfo.h new file mode 100644 index 0000000..f6828f2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/siginfo.h @@ -0,0 +1,113 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1998, 1999, 2001, 2003 Ralf Baechle + * Copyright (C) 2000, 2001 Silicon Graphics, Inc. + */ +#ifndef _ASM_SIGINFO_H +#define _ASM_SIGINFO_H + + +#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int)) +#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */ + +#define HAVE_ARCH_SIGINFO_T + +/* + * We duplicate the generic versions - is just borked + * by design ... + */ +#define HAVE_ARCH_COPY_SIGINFO +struct siginfo; + +/* + * Careful to keep union _sifields from shifting ... + */ +#ifdef CONFIG_32BIT +#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) +#endif +#ifdef CONFIG_64BIT +#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) +#endif + +#include + +typedef struct siginfo { + int si_signo; + int si_code; + int si_errno; + int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3]; + + union { + int _pad[SI_PAD_SIZE]; + + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + __ARCH_SI_UID_T _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; + sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + __ARCH_SI_UID_T _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + __ARCH_SI_UID_T _uid; /* sender's uid */ + int _status; /* exit code */ + clock_t _utime; + clock_t _stime; + } _sigchld; + + /* IRIX SIGCHLD */ + struct { + pid_t _pid; /* which child */ + clock_t _utime; + int _status; /* exit code */ + clock_t _stime; + } _irix_sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + void *_addr; /* faulting insn/memory ref. */ +#ifdef __ARCH_SI_TRAPNO + int _trapno; /* TRAP # which caused the signal */ +#endif + } _sigfault; + + /* SIGPOLL, SIGXFSZ (To do ...) */ + struct { + __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} siginfo_t; + +/* + * si_code values + * Again these have been choosen to be IRIX compatible. + */ +#undef SI_ASYNCIO +#undef SI_TIMER +#undef SI_MESGQ +#define SI_ASYNCIO -2 /* sent by AIO completion */ +#define SI_TIMER __SI_CODE(__SI_TIMER, -3) /* sent by timer expiration */ +#define SI_MESGQ __SI_CODE(__SI_MESGQ, -4) /* sent by real time mesq state change */ + + +#endif /* _ASM_SIGINFO_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/signal.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/signal.h new file mode 100644 index 0000000..ca628e1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/signal.h @@ -0,0 +1,123 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 96, 97, 98, 99, 2003 by Ralf Baechle + * Copyright (C) 1999 Silicon Graphics, Inc. + */ +#ifndef _ASM_SIGNAL_H +#define _ASM_SIGNAL_H + +#include + +#define _NSIG 128 +#define _NSIG_BPW (sizeof(unsigned long) * 8) +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +typedef unsigned long old_sigset_t; /* at least 32 bits */ + +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGEMT 7 +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* BUS error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ +#define SIGCHLD 18 /* Child status has changed (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGPWR 19 /* Power failure restart (System V). */ +#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ +#define SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ +#define SIGIO 22 /* I/O now possible (4.2 BSD). */ +#define SIGPOLL SIGIO /* Pollable event occurred (System V). */ +#define SIGSTOP 23 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 24 /* Keyboard stop (POSIX). */ +#define SIGCONT 25 /* Continue (POSIX). */ +#define SIGTTIN 26 /* Background read from tty (POSIX). */ +#define SIGTTOU 27 /* Background write to tty (POSIX). */ +#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ +#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX _NSIG + +/* + * SA_FLAGS values: + * + * SA_ONSTACK indicates that a registered stack_t will be used. + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. + */ +#define SA_ONSTACK 0x08000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTART 0x10000000 +#define SA_SIGINFO 0x00000008 +#define SA_NODEFER 0x40000000 +#define SA_NOCLDWAIT 0x00010000 +#define SA_NOCLDSTOP 0x00000001 + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND + +#define SA_RESTORER 0x04000000 /* Only for o32 */ + +/* + * sigaltstack controls + */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + + +#define SIG_BLOCK 1 /* for blocking signals */ +#define SIG_UNBLOCK 2 /* for unblocking signals */ +#define SIG_SETMASK 3 /* for setting the signal mask */ + +#include + +struct sigaction { + unsigned int sa_flags; + __sighandler_t sa_handler; + sigset_t sa_mask; +}; + +struct k_sigaction { + struct sigaction sa; +}; + +/* IRIX compatible stack_t */ +typedef struct sigaltstack { + void *ss_sp; + size_t ss_size; + int ss_flags; +} stack_t; + + +#endif /* _ASM_SIGNAL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/socket.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/socket.h new file mode 100644 index 0000000..73a5b70 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/socket.h @@ -0,0 +1,82 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1997, 1999, 2000, 2001 Ralf Baechle + * Copyright (C) 2000, 2001 Silicon Graphics, Inc. + */ +#ifndef _ASM_SOCKET_H +#define _ASM_SOCKET_H + +#include + +/* + * For setsockopt(2) + * + * This defines are ABI conformant as far as Linux supports these ... + */ +#define SOL_SOCKET 0xffff + +#define SO_DEBUG 0x0001 /* Record debugging information. */ +#define SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */ +#define SO_KEEPALIVE 0x0008 /* Keep connections alive and send + SIGPIPE when they die. */ +#define SO_DONTROUTE 0x0010 /* Don't do local routing. */ +#define SO_BROADCAST 0x0020 /* Allow transmission of + broadcast messages. */ +#define SO_LINGER 0x0080 /* Block on close of a reliable + socket to transmit pending data. */ +#define SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band. */ +#if 0 +To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */ +#endif + +#define SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */ +#define SO_STYLE SO_TYPE /* Synonym */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_SNDBUF 0x1001 /* Send buffer size. */ +#define SO_RCVBUF 0x1002 /* Receive buffer. */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ACCEPTCONN 0x1009 + +/* linux-specific, might as well be the same as on i386 */ +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_BSDCOMPAT 14 + +#define SO_PASSCRED 17 +#define SO_PEERCRED 18 + +/* Security levels - as per NRL IPv6 - don't actually do anything */ +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 + +#define SO_BINDTODEVICE 25 + +/* Socket filtering */ +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27 + +#define SO_PEERNAME 28 +#define SO_TIMESTAMP 29 +#define SCM_TIMESTAMP SO_TIMESTAMP + +#define SO_PEERSEC 30 +#define SO_SNDBUFFORCE 31 +#define SO_RCVBUFFORCE 33 +#define SO_PASSSEC 34 +#define SO_TIMESTAMPNS 35 +#define SCM_TIMESTAMPNS SO_TIMESTAMPNS + +#define SO_MARK 36 + +#define SO_TIMESTAMPING 37 +#define SCM_TIMESTAMPING SO_TIMESTAMPING + + +#endif /* _ASM_SOCKET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sockios.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sockios.h new file mode 100644 index 0000000..ed1a5f7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sockios.h @@ -0,0 +1,26 @@ +/* + * Socket-level I/O control calls. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995 by Ralf Baechle + */ +#ifndef _ASM_SOCKIOS_H +#define _ASM_SOCKIOS_H + +#include + +/* Socket-level I/O control calls. */ +#define FIOGETOWN _IOR('f', 123, int) +#define FIOSETOWN _IOW('f', 124, int) + +#define SIOCATMARK _IOR('s', 7, int) +#define SIOCSPGRP _IOW('s', 8, pid_t) +#define SIOCGPGRP _IOR('s', 9, pid_t) + +#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ +#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ + +#endif /* _ASM_SOCKIOS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/stat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/stat.h new file mode 100644 index 0000000..6e00f75 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/stat.h @@ -0,0 +1,132 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1999, 2000 Ralf Baechle + * Copyright (C) 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_STAT_H +#define _ASM_STAT_H + +#include + +#include + +#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32) + +struct stat { + unsigned st_dev; + long st_pad1[3]; /* Reserved for network id */ + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + unsigned st_rdev; + long st_pad2[2]; + off_t st_size; + long st_pad3; + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + time_t st_atime; + long st_atime_nsec; + time_t st_mtime; + long st_mtime_nsec; + time_t st_ctime; + long st_ctime_nsec; + long st_blksize; + long st_blocks; + long st_pad4[14]; +}; + +/* + * This matches struct stat64 in glibc2.1, hence the absolutely insane + * amounts of padding around dev_t's. The memory layout is the same as of + * struct stat of the 64-bit kernel. + */ + +struct stat64 { + unsigned long st_dev; + unsigned long st_pad0[3]; /* Reserved for st_dev expansion */ + + unsigned long long st_ino; + + mode_t st_mode; + nlink_t st_nlink; + + uid_t st_uid; + gid_t st_gid; + + unsigned long st_rdev; + unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */ + + long long st_size; + + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + time_t st_atime; + unsigned long st_atime_nsec; /* Reserved for st_atime expansion */ + + time_t st_mtime; + unsigned long st_mtime_nsec; /* Reserved for st_mtime expansion */ + + time_t st_ctime; + unsigned long st_ctime_nsec; /* Reserved for st_ctime expansion */ + + unsigned long st_blksize; + unsigned long st_pad2; + + long long st_blocks; +}; + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ + +#if _MIPS_SIM == _MIPS_SIM_ABI64 + +/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ +struct stat { + unsigned int st_dev; + unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ + + unsigned long st_ino; + + mode_t st_mode; + nlink_t st_nlink; + + uid_t st_uid; + gid_t st_gid; + + unsigned int st_rdev; + unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ + + off_t st_size; + + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + unsigned int st_atime; + unsigned int st_atime_nsec; + + unsigned int st_mtime; + unsigned int st_mtime_nsec; + + unsigned int st_ctime; + unsigned int st_ctime_nsec; + + unsigned int st_blksize; + unsigned int st_pad2; + + unsigned long st_blocks; +}; + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ + +#define STAT_HAVE_NSEC 1 + +#endif /* _ASM_STAT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/statfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/statfs.h new file mode 100644 index 0000000..c3ddf97 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/statfs.h @@ -0,0 +1,96 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1999 by Ralf Baechle + */ +#ifndef _ASM_STATFS_H +#define _ASM_STATFS_H + +#include +#include + +#ifndef __KERNEL_STRICT_NAMES + +#include + +typedef __kernel_fsid_t fsid_t; + +#endif + +struct statfs { + long f_type; +#define f_fstyp f_type + long f_bsize; + long f_frsize; /* Fragment size - unsupported */ + long f_blocks; + long f_bfree; + long f_files; + long f_ffree; + long f_bavail; + + /* Linux specials */ + __kernel_fsid_t f_fsid; + long f_namelen; + long f_spare[6]; +}; + +#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32) + +/* + * Unlike the traditional version the LFAPI version has none of the ABI junk + */ +struct statfs64 { + __u32 f_type; + __u32 f_bsize; + __u32 f_frsize; /* Fragment size - unsupported */ + __u32 __pad; + __u64 f_blocks; + __u64 f_bfree; + __u64 f_files; + __u64 f_ffree; + __u64 f_bavail; + __kernel_fsid_t f_fsid; + __u32 f_namelen; + __u32 f_spare[6]; +}; + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ + +#if _MIPS_SIM == _MIPS_SIM_ABI64 + +struct statfs64 { /* Same as struct statfs */ + long f_type; + long f_bsize; + long f_frsize; /* Fragment size - unsupported */ + long f_blocks; + long f_bfree; + long f_files; + long f_ffree; + long f_bavail; + + /* Linux specials */ + __kernel_fsid_t f_fsid; + long f_namelen; + long f_spare[6]; +}; + +struct compat_statfs64 { + __u32 f_type; + __u32 f_bsize; + __u32 f_frsize; /* Fragment size - unsupported */ + __u32 __pad; + __u64 f_blocks; + __u64 f_bfree; + __u64 f_files; + __u64 f_ffree; + __u64 f_bavail; + __kernel_fsid_t f_fsid; + __u32 f_namelen; + __u32 f_spare[6]; +}; + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ + +#endif /* _ASM_STATFS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/swab.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/swab.h new file mode 100644 index 0000000..44db6ae --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/swab.h @@ -0,0 +1,55 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1996, 99, 2003 by Ralf Baechle + */ +#ifndef _ASM_SWAB_H +#define _ASM_SWAB_H + + +#include + +#define __SWAB_64_THRU_32__ + +#ifdef CONFIG_CPU_MIPSR2 + +static __inline__ __u16 __arch_swab16(__u16 x) +{ + __asm__( + " wsbh %0, %1 \n" + : "=r" (x) + : "r" (x)); + + return x; +} +#define __arch_swab16 __arch_swab16 + +static __inline__ __u32 __arch_swab32(__u32 x) +{ + __asm__( + " wsbh %0, %1 \n" + " rotr %0, %0, 16 \n" + : "=r" (x) + : "r" (x)); + + return x; +} +#define __arch_swab32 __arch_swab32 + +#ifdef CONFIG_CPU_MIPS64_R2 +static __inline__ __u64 __arch_swab64(__u64 x) +{ + __asm__( + " dsbh %0, %1\n" + " dshd %0, %0" + : "=r" (x) + : "r" (x)); + + return x; +} +#define __arch_swab64 __arch_swab64 +#endif /* CONFIG_CPU_MIPS64_R2 */ +#endif /* CONFIG_CPU_MIPSR2 */ +#endif /* _ASM_SWAB_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sysmips.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sysmips.h new file mode 100644 index 0000000..4f47b7d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/sysmips.h @@ -0,0 +1,25 @@ +/* + * Definitions for the MIPS sysmips(2) call + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995 by Ralf Baechle + */ +#ifndef _ASM_SYSMIPS_H +#define _ASM_SYSMIPS_H + +/* + * Commands for the sysmips(2) call + * + * sysmips(2) is deprecated - though some existing software uses it. + * We only support the following commands. + */ +#define SETNAME 1 /* set hostname */ +#define FLUSH_CACHE 3 /* writeback and invalidate caches */ +#define MIPS_FIXADE 7 /* control address error fixing */ +#define MIPS_RDNVRAM 10 /* read NVRAM */ +#define MIPS_ATOMIC_SET 2001 /* atomically set variable */ + +#endif /* _ASM_SYSMIPS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/termbits.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/termbits.h new file mode 100644 index 0000000..c83c684 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/termbits.h @@ -0,0 +1,226 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 96, 99, 2001, 06 Ralf Baechle + * Copyright (C) 1999 Silicon Graphics, Inc. + * Copyright (C) 2001 MIPS Technologies, Inc. + */ +#ifndef _ASM_TERMBITS_H +#define _ASM_TERMBITS_H + +#include + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +/* + * The ABI says nothing about NCC but seems to use NCCS as + * replacement for it in struct termio + */ +#define NCCS 23 +struct termios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +}; + +struct termios2 { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +struct ktermios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +/* c_cc characters */ +#define VINTR 0 /* Interrupt character [ISIG]. */ +#define VQUIT 1 /* Quit character [ISIG]. */ +#define VERASE 2 /* Erase character [ICANON]. */ +#define VKILL 3 /* Kill-line character [ICANON]. */ +#define VMIN 4 /* Minimum number of bytes read at once [!ICANON]. */ +#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON]. */ +#define VEOL2 6 /* Second EOL character [ICANON]. */ +#define VSWTC 7 /* ??? */ +#define VSWTCH VSWTC +#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */ +#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */ +#define VSUSP 10 /* Suspend character [ISIG]. */ +#if 0 +/* + * VDSUSP is not supported + */ +#define VDSUSP 11 /* Delayed suspend character [ISIG]. */ +#endif +#define VREPRINT 12 /* Reprint-line character [ICANON]. */ +#define VDISCARD 13 /* Discard character [IEXTEN]. */ +#define VWERASE 14 /* Word-erase character [ICANON]. */ +#define VLNEXT 15 /* Literal-next character [IEXTEN]. */ +#define VEOF 16 /* End-of-file character [ICANON]. */ +#define VEOL 17 /* End-of-line character [ICANON]. */ + +/* c_iflag bits */ +#define IGNBRK 0000001 /* Ignore break condition. */ +#define BRKINT 0000002 /* Signal interrupt on break. */ +#define IGNPAR 0000004 /* Ignore characters with parity errors. */ +#define PARMRK 0000010 /* Mark parity and framing errors. */ +#define INPCK 0000020 /* Enable input parity check. */ +#define ISTRIP 0000040 /* Strip 8th bit off characters. */ +#define INLCR 0000100 /* Map NL to CR on input. */ +#define IGNCR 0000200 /* Ignore CR. */ +#define ICRNL 0000400 /* Map CR to NL on input. */ +#define IUCLC 0001000 /* Map upper case to lower case on input. */ +#define IXON 0002000 /* Enable start/stop output control. */ +#define IXANY 0004000 /* Any character will restart after stop. */ +#define IXOFF 0010000 /* Enable start/stop input control. */ +#define IMAXBEL 0020000 /* Ring bell when input queue is full. */ +#define IUTF8 0040000 /* Input is UTF-8 */ + +/* c_oflag bits */ +#define OPOST 0000001 /* Perform output processing. */ +#define OLCUC 0000002 /* Map lower case to upper case on output. */ +#define ONLCR 0000004 /* Map NL to CR-NL on output. */ +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define XTABS 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 +/* +#define PAGEOUT ??? +#define WRAP ??? + */ + +/* c_cflag bit meaning */ +#define CBAUD 0010017 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CSIZE 0000060 /* Number of bits per byte (mask). */ +#define CS5 0000000 /* 5 bits per byte. */ +#define CS6 0000020 /* 6 bits per byte. */ +#define CS7 0000040 /* 7 bits per byte. */ +#define CS8 0000060 /* 8 bits per byte. */ +#define CSTOPB 0000100 /* Two stop bits instead of one. */ +#define CREAD 0000200 /* Enable receiver. */ +#define PARENB 0000400 /* Parity enable. */ +#define PARODD 0001000 /* Odd parity instead of even. */ +#define HUPCL 0002000 /* Hang up on last close. */ +#define CLOCAL 0004000 /* Ignore modem status lines. */ +#define CBAUDEX 0010000 +#define BOTHER 0010000 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#define CIBAUD 002003600000 /* input baud rate */ +#define CMSPAR 010000000000 /* mark or space (stick) parity */ +#define CRTSCTS 020000000000 /* flow control */ + +#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ + +/* c_lflag bits */ +#define ISIG 0000001 /* Enable signals. */ +#define ICANON 0000002 /* Do erase and kill processing. */ +#define XCASE 0000004 +#define ECHO 0000010 /* Enable echo. */ +#define ECHOE 0000020 /* Visual erase for ERASE. */ +#define ECHOK 0000040 /* Echo NL after KILL. */ +#define ECHONL 0000100 /* Echo NL even if ECHO is off. */ +#define NOFLSH 0000200 /* Disable flush after interrupt. */ +#define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */ +#define ECHOCTL 0001000 /* Echo control characters as ^X. */ +#define ECHOPRT 0002000 /* Hardcopy visual erase. */ +#define ECHOKE 0004000 /* Visual erase for KILL. */ +#define FLUSHO 0020000 +#define PENDIN 0040000 /* Retype pending input (state). */ +#define TOSTOP 0100000 /* Send SIGTTOU for background output. */ +#define ITOSTOP TOSTOP + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 /* Suspend output. */ +#define TCOON 1 /* Restart suspended output. */ +#define TCIOFF 2 /* Send a STOP character. */ +#define TCION 3 /* Send a START character. */ + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 /* Discard data received but not yet read. */ +#define TCOFLUSH 1 /* Discard data written but not yet sent. */ +#define TCIOFLUSH 2 /* Discard all pending data. */ + +/* tcsetattr uses these */ +#define TCSANOW TCSETS /* Change immediately. */ +#define TCSADRAIN TCSETSW /* Change when pending output is written. */ +#define TCSAFLUSH TCSETSF /* Flush pending input before changing. */ + +#endif /* _ASM_TERMBITS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/termios.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/termios.h new file mode 100644 index 0000000..70416cc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/termios.h @@ -0,0 +1,80 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1996, 2000, 2001 by Ralf Baechle + * Copyright (C) 2000, 2001 Silicon Graphics, Inc. + */ +#ifndef _ASM_TERMIOS_H +#define _ASM_TERMIOS_H + +#include +#include +#include + +struct sgttyb { + char sg_ispeed; + char sg_ospeed; + char sg_erase; + char sg_kill; + int sg_flags; /* SGI special - int, not short */ +}; + +struct tchars { + char t_intrc; + char t_quitc; + char t_startc; + char t_stopc; + char t_eofc; + char t_brkc; +}; + +struct ltchars { + char t_suspc; /* stop process signal */ + char t_dsuspc; /* delayed stop process signal */ + char t_rprntc; /* reprint line */ + char t_flushc; /* flush output (toggles) */ + char t_werasc; /* word erase */ + char t_lnextc; /* literal next character */ +}; + +/* TIOCGSIZE, TIOCSSIZE not defined yet. Only needed for SunOS source + compatibility anyway ... */ + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + char c_line; /* line discipline */ + unsigned char c_cc[NCCS]; /* control characters */ +}; + + +/* modem lines */ +#define TIOCM_LE 0x001 /* line enable */ +#define TIOCM_DTR 0x002 /* data terminal ready */ +#define TIOCM_RTS 0x004 /* request to send */ +#define TIOCM_ST 0x010 /* secondary transmit */ +#define TIOCM_SR 0x020 /* secondary receive */ +#define TIOCM_CTS 0x040 /* clear to send */ +#define TIOCM_CAR 0x100 /* carrier detect */ +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RNG 0x200 /* ring */ +#define TIOCM_RI TIOCM_RNG +#define TIOCM_DSR 0x400 /* data set ready */ +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + + +#endif /* _ASM_TERMIOS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/types.h new file mode 100644 index 0000000..6e0e3e7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/types.h @@ -0,0 +1,34 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1994, 1995, 1996, 1999 by Ralf Baechle + * Copyright (C) 2008 Wind River Systems, + * written by Ralf Baechle + * Copyright (C) 1999 Silicon Graphics, Inc. + */ +#ifndef _ASM_TYPES_H +#define _ASM_TYPES_H + +/* + * We don't use int-l64.h for the kernel anymore but still use it for + * userspace to avoid code changes. + */ +#if (_MIPS_SZLONG == 64) && !defined(__KERNEL__) +# include +#else +# include +#endif + +#ifndef __ASSEMBLY__ + +typedef unsigned short umode_t; + +#endif /* __ASSEMBLY__ */ + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ + +#endif /* _ASM_TYPES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/unistd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/unistd.h new file mode 100644 index 0000000..b8f906f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/asm/unistd.h @@ -0,0 +1,986 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle + * Copyright (C) 1999, 2000 Silicon Graphics, Inc. + * + * Changed system calls macros _syscall5 - _syscall7 to push args 5 to 7 onto + * the stack. Robin Farine for ACN S.A, Copyright (C) 1996 by ACN S.A + */ +#ifndef _ASM_UNISTD_H +#define _ASM_UNISTD_H + +#include + +#if _MIPS_SIM == _MIPS_SIM_ABI32 + +/* + * Linux o32 style syscalls are in the range from 4000 to 4999. + */ +#define __NR_Linux 4000 +#define __NR_syscall (__NR_Linux + 0) +#define __NR_exit (__NR_Linux + 1) +#define __NR_fork (__NR_Linux + 2) +#define __NR_read (__NR_Linux + 3) +#define __NR_write (__NR_Linux + 4) +#define __NR_open (__NR_Linux + 5) +#define __NR_close (__NR_Linux + 6) +#define __NR_waitpid (__NR_Linux + 7) +#define __NR_creat (__NR_Linux + 8) +#define __NR_link (__NR_Linux + 9) +#define __NR_unlink (__NR_Linux + 10) +#define __NR_execve (__NR_Linux + 11) +#define __NR_chdir (__NR_Linux + 12) +#define __NR_time (__NR_Linux + 13) +#define __NR_mknod (__NR_Linux + 14) +#define __NR_chmod (__NR_Linux + 15) +#define __NR_lchown (__NR_Linux + 16) +#define __NR_break (__NR_Linux + 17) +#define __NR_unused18 (__NR_Linux + 18) +#define __NR_lseek (__NR_Linux + 19) +#define __NR_getpid (__NR_Linux + 20) +#define __NR_mount (__NR_Linux + 21) +#define __NR_umount (__NR_Linux + 22) +#define __NR_setuid (__NR_Linux + 23) +#define __NR_getuid (__NR_Linux + 24) +#define __NR_stime (__NR_Linux + 25) +#define __NR_ptrace (__NR_Linux + 26) +#define __NR_alarm (__NR_Linux + 27) +#define __NR_unused28 (__NR_Linux + 28) +#define __NR_pause (__NR_Linux + 29) +#define __NR_utime (__NR_Linux + 30) +#define __NR_stty (__NR_Linux + 31) +#define __NR_gtty (__NR_Linux + 32) +#define __NR_access (__NR_Linux + 33) +#define __NR_nice (__NR_Linux + 34) +#define __NR_ftime (__NR_Linux + 35) +#define __NR_sync (__NR_Linux + 36) +#define __NR_kill (__NR_Linux + 37) +#define __NR_rename (__NR_Linux + 38) +#define __NR_mkdir (__NR_Linux + 39) +#define __NR_rmdir (__NR_Linux + 40) +#define __NR_dup (__NR_Linux + 41) +#define __NR_pipe (__NR_Linux + 42) +#define __NR_times (__NR_Linux + 43) +#define __NR_prof (__NR_Linux + 44) +#define __NR_brk (__NR_Linux + 45) +#define __NR_setgid (__NR_Linux + 46) +#define __NR_getgid (__NR_Linux + 47) +#define __NR_signal (__NR_Linux + 48) +#define __NR_geteuid (__NR_Linux + 49) +#define __NR_getegid (__NR_Linux + 50) +#define __NR_acct (__NR_Linux + 51) +#define __NR_umount2 (__NR_Linux + 52) +#define __NR_lock (__NR_Linux + 53) +#define __NR_ioctl (__NR_Linux + 54) +#define __NR_fcntl (__NR_Linux + 55) +#define __NR_mpx (__NR_Linux + 56) +#define __NR_setpgid (__NR_Linux + 57) +#define __NR_ulimit (__NR_Linux + 58) +#define __NR_unused59 (__NR_Linux + 59) +#define __NR_umask (__NR_Linux + 60) +#define __NR_chroot (__NR_Linux + 61) +#define __NR_ustat (__NR_Linux + 62) +#define __NR_dup2 (__NR_Linux + 63) +#define __NR_getppid (__NR_Linux + 64) +#define __NR_getpgrp (__NR_Linux + 65) +#define __NR_setsid (__NR_Linux + 66) +#define __NR_sigaction (__NR_Linux + 67) +#define __NR_sgetmask (__NR_Linux + 68) +#define __NR_ssetmask (__NR_Linux + 69) +#define __NR_setreuid (__NR_Linux + 70) +#define __NR_setregid (__NR_Linux + 71) +#define __NR_sigsuspend (__NR_Linux + 72) +#define __NR_sigpending (__NR_Linux + 73) +#define __NR_sethostname (__NR_Linux + 74) +#define __NR_setrlimit (__NR_Linux + 75) +#define __NR_getrlimit (__NR_Linux + 76) +#define __NR_getrusage (__NR_Linux + 77) +#define __NR_gettimeofday (__NR_Linux + 78) +#define __NR_settimeofday (__NR_Linux + 79) +#define __NR_getgroups (__NR_Linux + 80) +#define __NR_setgroups (__NR_Linux + 81) +#define __NR_reserved82 (__NR_Linux + 82) +#define __NR_symlink (__NR_Linux + 83) +#define __NR_unused84 (__NR_Linux + 84) +#define __NR_readlink (__NR_Linux + 85) +#define __NR_uselib (__NR_Linux + 86) +#define __NR_swapon (__NR_Linux + 87) +#define __NR_reboot (__NR_Linux + 88) +#define __NR_readdir (__NR_Linux + 89) +#define __NR_mmap (__NR_Linux + 90) +#define __NR_munmap (__NR_Linux + 91) +#define __NR_truncate (__NR_Linux + 92) +#define __NR_ftruncate (__NR_Linux + 93) +#define __NR_fchmod (__NR_Linux + 94) +#define __NR_fchown (__NR_Linux + 95) +#define __NR_getpriority (__NR_Linux + 96) +#define __NR_setpriority (__NR_Linux + 97) +#define __NR_profil (__NR_Linux + 98) +#define __NR_statfs (__NR_Linux + 99) +#define __NR_fstatfs (__NR_Linux + 100) +#define __NR_ioperm (__NR_Linux + 101) +#define __NR_socketcall (__NR_Linux + 102) +#define __NR_syslog (__NR_Linux + 103) +#define __NR_setitimer (__NR_Linux + 104) +#define __NR_getitimer (__NR_Linux + 105) +#define __NR_stat (__NR_Linux + 106) +#define __NR_lstat (__NR_Linux + 107) +#define __NR_fstat (__NR_Linux + 108) +#define __NR_unused109 (__NR_Linux + 109) +#define __NR_iopl (__NR_Linux + 110) +#define __NR_vhangup (__NR_Linux + 111) +#define __NR_idle (__NR_Linux + 112) +#define __NR_vm86 (__NR_Linux + 113) +#define __NR_wait4 (__NR_Linux + 114) +#define __NR_swapoff (__NR_Linux + 115) +#define __NR_sysinfo (__NR_Linux + 116) +#define __NR_ipc (__NR_Linux + 117) +#define __NR_fsync (__NR_Linux + 118) +#define __NR_sigreturn (__NR_Linux + 119) +#define __NR_clone (__NR_Linux + 120) +#define __NR_setdomainname (__NR_Linux + 121) +#define __NR_uname (__NR_Linux + 122) +#define __NR_modify_ldt (__NR_Linux + 123) +#define __NR_adjtimex (__NR_Linux + 124) +#define __NR_mprotect (__NR_Linux + 125) +#define __NR_sigprocmask (__NR_Linux + 126) +#define __NR_create_module (__NR_Linux + 127) +#define __NR_init_module (__NR_Linux + 128) +#define __NR_delete_module (__NR_Linux + 129) +#define __NR_get_kernel_syms (__NR_Linux + 130) +#define __NR_quotactl (__NR_Linux + 131) +#define __NR_getpgid (__NR_Linux + 132) +#define __NR_fchdir (__NR_Linux + 133) +#define __NR_bdflush (__NR_Linux + 134) +#define __NR_sysfs (__NR_Linux + 135) +#define __NR_personality (__NR_Linux + 136) +#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */ +#define __NR_setfsuid (__NR_Linux + 138) +#define __NR_setfsgid (__NR_Linux + 139) +#define __NR__llseek (__NR_Linux + 140) +#define __NR_getdents (__NR_Linux + 141) +#define __NR__newselect (__NR_Linux + 142) +#define __NR_flock (__NR_Linux + 143) +#define __NR_msync (__NR_Linux + 144) +#define __NR_readv (__NR_Linux + 145) +#define __NR_writev (__NR_Linux + 146) +#define __NR_cacheflush (__NR_Linux + 147) +#define __NR_cachectl (__NR_Linux + 148) +#define __NR_sysmips (__NR_Linux + 149) +#define __NR_unused150 (__NR_Linux + 150) +#define __NR_getsid (__NR_Linux + 151) +#define __NR_fdatasync (__NR_Linux + 152) +#define __NR__sysctl (__NR_Linux + 153) +#define __NR_mlock (__NR_Linux + 154) +#define __NR_munlock (__NR_Linux + 155) +#define __NR_mlockall (__NR_Linux + 156) +#define __NR_munlockall (__NR_Linux + 157) +#define __NR_sched_setparam (__NR_Linux + 158) +#define __NR_sched_getparam (__NR_Linux + 159) +#define __NR_sched_setscheduler (__NR_Linux + 160) +#define __NR_sched_getscheduler (__NR_Linux + 161) +#define __NR_sched_yield (__NR_Linux + 162) +#define __NR_sched_get_priority_max (__NR_Linux + 163) +#define __NR_sched_get_priority_min (__NR_Linux + 164) +#define __NR_sched_rr_get_interval (__NR_Linux + 165) +#define __NR_nanosleep (__NR_Linux + 166) +#define __NR_mremap (__NR_Linux + 167) +#define __NR_accept (__NR_Linux + 168) +#define __NR_bind (__NR_Linux + 169) +#define __NR_connect (__NR_Linux + 170) +#define __NR_getpeername (__NR_Linux + 171) +#define __NR_getsockname (__NR_Linux + 172) +#define __NR_getsockopt (__NR_Linux + 173) +#define __NR_listen (__NR_Linux + 174) +#define __NR_recv (__NR_Linux + 175) +#define __NR_recvfrom (__NR_Linux + 176) +#define __NR_recvmsg (__NR_Linux + 177) +#define __NR_send (__NR_Linux + 178) +#define __NR_sendmsg (__NR_Linux + 179) +#define __NR_sendto (__NR_Linux + 180) +#define __NR_setsockopt (__NR_Linux + 181) +#define __NR_shutdown (__NR_Linux + 182) +#define __NR_socket (__NR_Linux + 183) +#define __NR_socketpair (__NR_Linux + 184) +#define __NR_setresuid (__NR_Linux + 185) +#define __NR_getresuid (__NR_Linux + 186) +#define __NR_query_module (__NR_Linux + 187) +#define __NR_poll (__NR_Linux + 188) +#define __NR_nfsservctl (__NR_Linux + 189) +#define __NR_setresgid (__NR_Linux + 190) +#define __NR_getresgid (__NR_Linux + 191) +#define __NR_prctl (__NR_Linux + 192) +#define __NR_rt_sigreturn (__NR_Linux + 193) +#define __NR_rt_sigaction (__NR_Linux + 194) +#define __NR_rt_sigprocmask (__NR_Linux + 195) +#define __NR_rt_sigpending (__NR_Linux + 196) +#define __NR_rt_sigtimedwait (__NR_Linux + 197) +#define __NR_rt_sigqueueinfo (__NR_Linux + 198) +#define __NR_rt_sigsuspend (__NR_Linux + 199) +#define __NR_pread64 (__NR_Linux + 200) +#define __NR_pwrite64 (__NR_Linux + 201) +#define __NR_chown (__NR_Linux + 202) +#define __NR_getcwd (__NR_Linux + 203) +#define __NR_capget (__NR_Linux + 204) +#define __NR_capset (__NR_Linux + 205) +#define __NR_sigaltstack (__NR_Linux + 206) +#define __NR_sendfile (__NR_Linux + 207) +#define __NR_getpmsg (__NR_Linux + 208) +#define __NR_putpmsg (__NR_Linux + 209) +#define __NR_mmap2 (__NR_Linux + 210) +#define __NR_truncate64 (__NR_Linux + 211) +#define __NR_ftruncate64 (__NR_Linux + 212) +#define __NR_stat64 (__NR_Linux + 213) +#define __NR_lstat64 (__NR_Linux + 214) +#define __NR_fstat64 (__NR_Linux + 215) +#define __NR_pivot_root (__NR_Linux + 216) +#define __NR_mincore (__NR_Linux + 217) +#define __NR_madvise (__NR_Linux + 218) +#define __NR_getdents64 (__NR_Linux + 219) +#define __NR_fcntl64 (__NR_Linux + 220) +#define __NR_reserved221 (__NR_Linux + 221) +#define __NR_gettid (__NR_Linux + 222) +#define __NR_readahead (__NR_Linux + 223) +#define __NR_setxattr (__NR_Linux + 224) +#define __NR_lsetxattr (__NR_Linux + 225) +#define __NR_fsetxattr (__NR_Linux + 226) +#define __NR_getxattr (__NR_Linux + 227) +#define __NR_lgetxattr (__NR_Linux + 228) +#define __NR_fgetxattr (__NR_Linux + 229) +#define __NR_listxattr (__NR_Linux + 230) +#define __NR_llistxattr (__NR_Linux + 231) +#define __NR_flistxattr (__NR_Linux + 232) +#define __NR_removexattr (__NR_Linux + 233) +#define __NR_lremovexattr (__NR_Linux + 234) +#define __NR_fremovexattr (__NR_Linux + 235) +#define __NR_tkill (__NR_Linux + 236) +#define __NR_sendfile64 (__NR_Linux + 237) +#define __NR_futex (__NR_Linux + 238) +#define __NR_sched_setaffinity (__NR_Linux + 239) +#define __NR_sched_getaffinity (__NR_Linux + 240) +#define __NR_io_setup (__NR_Linux + 241) +#define __NR_io_destroy (__NR_Linux + 242) +#define __NR_io_getevents (__NR_Linux + 243) +#define __NR_io_submit (__NR_Linux + 244) +#define __NR_io_cancel (__NR_Linux + 245) +#define __NR_exit_group (__NR_Linux + 246) +#define __NR_lookup_dcookie (__NR_Linux + 247) +#define __NR_epoll_create (__NR_Linux + 248) +#define __NR_epoll_ctl (__NR_Linux + 249) +#define __NR_epoll_wait (__NR_Linux + 250) +#define __NR_remap_file_pages (__NR_Linux + 251) +#define __NR_set_tid_address (__NR_Linux + 252) +#define __NR_restart_syscall (__NR_Linux + 253) +#define __NR_fadvise64 (__NR_Linux + 254) +#define __NR_statfs64 (__NR_Linux + 255) +#define __NR_fstatfs64 (__NR_Linux + 256) +#define __NR_timer_create (__NR_Linux + 257) +#define __NR_timer_settime (__NR_Linux + 258) +#define __NR_timer_gettime (__NR_Linux + 259) +#define __NR_timer_getoverrun (__NR_Linux + 260) +#define __NR_timer_delete (__NR_Linux + 261) +#define __NR_clock_settime (__NR_Linux + 262) +#define __NR_clock_gettime (__NR_Linux + 263) +#define __NR_clock_getres (__NR_Linux + 264) +#define __NR_clock_nanosleep (__NR_Linux + 265) +#define __NR_tgkill (__NR_Linux + 266) +#define __NR_utimes (__NR_Linux + 267) +#define __NR_mbind (__NR_Linux + 268) +#define __NR_get_mempolicy (__NR_Linux + 269) +#define __NR_set_mempolicy (__NR_Linux + 270) +#define __NR_mq_open (__NR_Linux + 271) +#define __NR_mq_unlink (__NR_Linux + 272) +#define __NR_mq_timedsend (__NR_Linux + 273) +#define __NR_mq_timedreceive (__NR_Linux + 274) +#define __NR_mq_notify (__NR_Linux + 275) +#define __NR_mq_getsetattr (__NR_Linux + 276) +#define __NR_vserver (__NR_Linux + 277) +#define __NR_waitid (__NR_Linux + 278) +/* #define __NR_sys_setaltroot (__NR_Linux + 279) */ +#define __NR_add_key (__NR_Linux + 280) +#define __NR_request_key (__NR_Linux + 281) +#define __NR_keyctl (__NR_Linux + 282) +#define __NR_set_thread_area (__NR_Linux + 283) +#define __NR_inotify_init (__NR_Linux + 284) +#define __NR_inotify_add_watch (__NR_Linux + 285) +#define __NR_inotify_rm_watch (__NR_Linux + 286) +#define __NR_migrate_pages (__NR_Linux + 287) +#define __NR_openat (__NR_Linux + 288) +#define __NR_mkdirat (__NR_Linux + 289) +#define __NR_mknodat (__NR_Linux + 290) +#define __NR_fchownat (__NR_Linux + 291) +#define __NR_futimesat (__NR_Linux + 292) +#define __NR_fstatat64 (__NR_Linux + 293) +#define __NR_unlinkat (__NR_Linux + 294) +#define __NR_renameat (__NR_Linux + 295) +#define __NR_linkat (__NR_Linux + 296) +#define __NR_symlinkat (__NR_Linux + 297) +#define __NR_readlinkat (__NR_Linux + 298) +#define __NR_fchmodat (__NR_Linux + 299) +#define __NR_faccessat (__NR_Linux + 300) +#define __NR_pselect6 (__NR_Linux + 301) +#define __NR_ppoll (__NR_Linux + 302) +#define __NR_unshare (__NR_Linux + 303) +#define __NR_splice (__NR_Linux + 304) +#define __NR_sync_file_range (__NR_Linux + 305) +#define __NR_tee (__NR_Linux + 306) +#define __NR_vmsplice (__NR_Linux + 307) +#define __NR_move_pages (__NR_Linux + 308) +#define __NR_set_robust_list (__NR_Linux + 309) +#define __NR_get_robust_list (__NR_Linux + 310) +#define __NR_kexec_load (__NR_Linux + 311) +#define __NR_getcpu (__NR_Linux + 312) +#define __NR_epoll_pwait (__NR_Linux + 313) +#define __NR_ioprio_set (__NR_Linux + 314) +#define __NR_ioprio_get (__NR_Linux + 315) +#define __NR_utimensat (__NR_Linux + 316) +#define __NR_signalfd (__NR_Linux + 317) +#define __NR_timerfd (__NR_Linux + 318) +#define __NR_eventfd (__NR_Linux + 319) +#define __NR_fallocate (__NR_Linux + 320) +#define __NR_timerfd_create (__NR_Linux + 321) +#define __NR_timerfd_gettime (__NR_Linux + 322) +#define __NR_timerfd_settime (__NR_Linux + 323) +#define __NR_signalfd4 (__NR_Linux + 324) +#define __NR_eventfd2 (__NR_Linux + 325) +#define __NR_epoll_create1 (__NR_Linux + 326) +#define __NR_dup3 (__NR_Linux + 327) +#define __NR_pipe2 (__NR_Linux + 328) +#define __NR_inotify_init1 (__NR_Linux + 329) +#define __NR_preadv (__NR_Linux + 330) +#define __NR_pwritev (__NR_Linux + 331) + +/* + * Offset of the last Linux o32 flavoured syscall + */ +#define __NR_Linux_syscalls 331 + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ + +#define __NR_O32_Linux 4000 +#define __NR_O32_Linux_syscalls 331 + +#if _MIPS_SIM == _MIPS_SIM_ABI64 + +/* + * Linux 64-bit syscalls are in the range from 5000 to 5999. + */ +#define __NR_Linux 5000 +#define __NR_read (__NR_Linux + 0) +#define __NR_write (__NR_Linux + 1) +#define __NR_open (__NR_Linux + 2) +#define __NR_close (__NR_Linux + 3) +#define __NR_stat (__NR_Linux + 4) +#define __NR_fstat (__NR_Linux + 5) +#define __NR_lstat (__NR_Linux + 6) +#define __NR_poll (__NR_Linux + 7) +#define __NR_lseek (__NR_Linux + 8) +#define __NR_mmap (__NR_Linux + 9) +#define __NR_mprotect (__NR_Linux + 10) +#define __NR_munmap (__NR_Linux + 11) +#define __NR_brk (__NR_Linux + 12) +#define __NR_rt_sigaction (__NR_Linux + 13) +#define __NR_rt_sigprocmask (__NR_Linux + 14) +#define __NR_ioctl (__NR_Linux + 15) +#define __NR_pread64 (__NR_Linux + 16) +#define __NR_pwrite64 (__NR_Linux + 17) +#define __NR_readv (__NR_Linux + 18) +#define __NR_writev (__NR_Linux + 19) +#define __NR_access (__NR_Linux + 20) +#define __NR_pipe (__NR_Linux + 21) +#define __NR__newselect (__NR_Linux + 22) +#define __NR_sched_yield (__NR_Linux + 23) +#define __NR_mremap (__NR_Linux + 24) +#define __NR_msync (__NR_Linux + 25) +#define __NR_mincore (__NR_Linux + 26) +#define __NR_madvise (__NR_Linux + 27) +#define __NR_shmget (__NR_Linux + 28) +#define __NR_shmat (__NR_Linux + 29) +#define __NR_shmctl (__NR_Linux + 30) +#define __NR_dup (__NR_Linux + 31) +#define __NR_dup2 (__NR_Linux + 32) +#define __NR_pause (__NR_Linux + 33) +#define __NR_nanosleep (__NR_Linux + 34) +#define __NR_getitimer (__NR_Linux + 35) +#define __NR_setitimer (__NR_Linux + 36) +#define __NR_alarm (__NR_Linux + 37) +#define __NR_getpid (__NR_Linux + 38) +#define __NR_sendfile (__NR_Linux + 39) +#define __NR_socket (__NR_Linux + 40) +#define __NR_connect (__NR_Linux + 41) +#define __NR_accept (__NR_Linux + 42) +#define __NR_sendto (__NR_Linux + 43) +#define __NR_recvfrom (__NR_Linux + 44) +#define __NR_sendmsg (__NR_Linux + 45) +#define __NR_recvmsg (__NR_Linux + 46) +#define __NR_shutdown (__NR_Linux + 47) +#define __NR_bind (__NR_Linux + 48) +#define __NR_listen (__NR_Linux + 49) +#define __NR_getsockname (__NR_Linux + 50) +#define __NR_getpeername (__NR_Linux + 51) +#define __NR_socketpair (__NR_Linux + 52) +#define __NR_setsockopt (__NR_Linux + 53) +#define __NR_getsockopt (__NR_Linux + 54) +#define __NR_clone (__NR_Linux + 55) +#define __NR_fork (__NR_Linux + 56) +#define __NR_execve (__NR_Linux + 57) +#define __NR_exit (__NR_Linux + 58) +#define __NR_wait4 (__NR_Linux + 59) +#define __NR_kill (__NR_Linux + 60) +#define __NR_uname (__NR_Linux + 61) +#define __NR_semget (__NR_Linux + 62) +#define __NR_semop (__NR_Linux + 63) +#define __NR_semctl (__NR_Linux + 64) +#define __NR_shmdt (__NR_Linux + 65) +#define __NR_msgget (__NR_Linux + 66) +#define __NR_msgsnd (__NR_Linux + 67) +#define __NR_msgrcv (__NR_Linux + 68) +#define __NR_msgctl (__NR_Linux + 69) +#define __NR_fcntl (__NR_Linux + 70) +#define __NR_flock (__NR_Linux + 71) +#define __NR_fsync (__NR_Linux + 72) +#define __NR_fdatasync (__NR_Linux + 73) +#define __NR_truncate (__NR_Linux + 74) +#define __NR_ftruncate (__NR_Linux + 75) +#define __NR_getdents (__NR_Linux + 76) +#define __NR_getcwd (__NR_Linux + 77) +#define __NR_chdir (__NR_Linux + 78) +#define __NR_fchdir (__NR_Linux + 79) +#define __NR_rename (__NR_Linux + 80) +#define __NR_mkdir (__NR_Linux + 81) +#define __NR_rmdir (__NR_Linux + 82) +#define __NR_creat (__NR_Linux + 83) +#define __NR_link (__NR_Linux + 84) +#define __NR_unlink (__NR_Linux + 85) +#define __NR_symlink (__NR_Linux + 86) +#define __NR_readlink (__NR_Linux + 87) +#define __NR_chmod (__NR_Linux + 88) +#define __NR_fchmod (__NR_Linux + 89) +#define __NR_chown (__NR_Linux + 90) +#define __NR_fchown (__NR_Linux + 91) +#define __NR_lchown (__NR_Linux + 92) +#define __NR_umask (__NR_Linux + 93) +#define __NR_gettimeofday (__NR_Linux + 94) +#define __NR_getrlimit (__NR_Linux + 95) +#define __NR_getrusage (__NR_Linux + 96) +#define __NR_sysinfo (__NR_Linux + 97) +#define __NR_times (__NR_Linux + 98) +#define __NR_ptrace (__NR_Linux + 99) +#define __NR_getuid (__NR_Linux + 100) +#define __NR_syslog (__NR_Linux + 101) +#define __NR_getgid (__NR_Linux + 102) +#define __NR_setuid (__NR_Linux + 103) +#define __NR_setgid (__NR_Linux + 104) +#define __NR_geteuid (__NR_Linux + 105) +#define __NR_getegid (__NR_Linux + 106) +#define __NR_setpgid (__NR_Linux + 107) +#define __NR_getppid (__NR_Linux + 108) +#define __NR_getpgrp (__NR_Linux + 109) +#define __NR_setsid (__NR_Linux + 110) +#define __NR_setreuid (__NR_Linux + 111) +#define __NR_setregid (__NR_Linux + 112) +#define __NR_getgroups (__NR_Linux + 113) +#define __NR_setgroups (__NR_Linux + 114) +#define __NR_setresuid (__NR_Linux + 115) +#define __NR_getresuid (__NR_Linux + 116) +#define __NR_setresgid (__NR_Linux + 117) +#define __NR_getresgid (__NR_Linux + 118) +#define __NR_getpgid (__NR_Linux + 119) +#define __NR_setfsuid (__NR_Linux + 120) +#define __NR_setfsgid (__NR_Linux + 121) +#define __NR_getsid (__NR_Linux + 122) +#define __NR_capget (__NR_Linux + 123) +#define __NR_capset (__NR_Linux + 124) +#define __NR_rt_sigpending (__NR_Linux + 125) +#define __NR_rt_sigtimedwait (__NR_Linux + 126) +#define __NR_rt_sigqueueinfo (__NR_Linux + 127) +#define __NR_rt_sigsuspend (__NR_Linux + 128) +#define __NR_sigaltstack (__NR_Linux + 129) +#define __NR_utime (__NR_Linux + 130) +#define __NR_mknod (__NR_Linux + 131) +#define __NR_personality (__NR_Linux + 132) +#define __NR_ustat (__NR_Linux + 133) +#define __NR_statfs (__NR_Linux + 134) +#define __NR_fstatfs (__NR_Linux + 135) +#define __NR_sysfs (__NR_Linux + 136) +#define __NR_getpriority (__NR_Linux + 137) +#define __NR_setpriority (__NR_Linux + 138) +#define __NR_sched_setparam (__NR_Linux + 139) +#define __NR_sched_getparam (__NR_Linux + 140) +#define __NR_sched_setscheduler (__NR_Linux + 141) +#define __NR_sched_getscheduler (__NR_Linux + 142) +#define __NR_sched_get_priority_max (__NR_Linux + 143) +#define __NR_sched_get_priority_min (__NR_Linux + 144) +#define __NR_sched_rr_get_interval (__NR_Linux + 145) +#define __NR_mlock (__NR_Linux + 146) +#define __NR_munlock (__NR_Linux + 147) +#define __NR_mlockall (__NR_Linux + 148) +#define __NR_munlockall (__NR_Linux + 149) +#define __NR_vhangup (__NR_Linux + 150) +#define __NR_pivot_root (__NR_Linux + 151) +#define __NR__sysctl (__NR_Linux + 152) +#define __NR_prctl (__NR_Linux + 153) +#define __NR_adjtimex (__NR_Linux + 154) +#define __NR_setrlimit (__NR_Linux + 155) +#define __NR_chroot (__NR_Linux + 156) +#define __NR_sync (__NR_Linux + 157) +#define __NR_acct (__NR_Linux + 158) +#define __NR_settimeofday (__NR_Linux + 159) +#define __NR_mount (__NR_Linux + 160) +#define __NR_umount2 (__NR_Linux + 161) +#define __NR_swapon (__NR_Linux + 162) +#define __NR_swapoff (__NR_Linux + 163) +#define __NR_reboot (__NR_Linux + 164) +#define __NR_sethostname (__NR_Linux + 165) +#define __NR_setdomainname (__NR_Linux + 166) +#define __NR_create_module (__NR_Linux + 167) +#define __NR_init_module (__NR_Linux + 168) +#define __NR_delete_module (__NR_Linux + 169) +#define __NR_get_kernel_syms (__NR_Linux + 170) +#define __NR_query_module (__NR_Linux + 171) +#define __NR_quotactl (__NR_Linux + 172) +#define __NR_nfsservctl (__NR_Linux + 173) +#define __NR_getpmsg (__NR_Linux + 174) +#define __NR_putpmsg (__NR_Linux + 175) +#define __NR_afs_syscall (__NR_Linux + 176) +#define __NR_reserved177 (__NR_Linux + 177) +#define __NR_gettid (__NR_Linux + 178) +#define __NR_readahead (__NR_Linux + 179) +#define __NR_setxattr (__NR_Linux + 180) +#define __NR_lsetxattr (__NR_Linux + 181) +#define __NR_fsetxattr (__NR_Linux + 182) +#define __NR_getxattr (__NR_Linux + 183) +#define __NR_lgetxattr (__NR_Linux + 184) +#define __NR_fgetxattr (__NR_Linux + 185) +#define __NR_listxattr (__NR_Linux + 186) +#define __NR_llistxattr (__NR_Linux + 187) +#define __NR_flistxattr (__NR_Linux + 188) +#define __NR_removexattr (__NR_Linux + 189) +#define __NR_lremovexattr (__NR_Linux + 190) +#define __NR_fremovexattr (__NR_Linux + 191) +#define __NR_tkill (__NR_Linux + 192) +#define __NR_reserved193 (__NR_Linux + 193) +#define __NR_futex (__NR_Linux + 194) +#define __NR_sched_setaffinity (__NR_Linux + 195) +#define __NR_sched_getaffinity (__NR_Linux + 196) +#define __NR_cacheflush (__NR_Linux + 197) +#define __NR_cachectl (__NR_Linux + 198) +#define __NR_sysmips (__NR_Linux + 199) +#define __NR_io_setup (__NR_Linux + 200) +#define __NR_io_destroy (__NR_Linux + 201) +#define __NR_io_getevents (__NR_Linux + 202) +#define __NR_io_submit (__NR_Linux + 203) +#define __NR_io_cancel (__NR_Linux + 204) +#define __NR_exit_group (__NR_Linux + 205) +#define __NR_lookup_dcookie (__NR_Linux + 206) +#define __NR_epoll_create (__NR_Linux + 207) +#define __NR_epoll_ctl (__NR_Linux + 208) +#define __NR_epoll_wait (__NR_Linux + 209) +#define __NR_remap_file_pages (__NR_Linux + 210) +#define __NR_rt_sigreturn (__NR_Linux + 211) +#define __NR_set_tid_address (__NR_Linux + 212) +#define __NR_restart_syscall (__NR_Linux + 213) +#define __NR_semtimedop (__NR_Linux + 214) +#define __NR_fadvise64 (__NR_Linux + 215) +#define __NR_timer_create (__NR_Linux + 216) +#define __NR_timer_settime (__NR_Linux + 217) +#define __NR_timer_gettime (__NR_Linux + 218) +#define __NR_timer_getoverrun (__NR_Linux + 219) +#define __NR_timer_delete (__NR_Linux + 220) +#define __NR_clock_settime (__NR_Linux + 221) +#define __NR_clock_gettime (__NR_Linux + 222) +#define __NR_clock_getres (__NR_Linux + 223) +#define __NR_clock_nanosleep (__NR_Linux + 224) +#define __NR_tgkill (__NR_Linux + 225) +#define __NR_utimes (__NR_Linux + 226) +#define __NR_mbind (__NR_Linux + 227) +#define __NR_get_mempolicy (__NR_Linux + 228) +#define __NR_set_mempolicy (__NR_Linux + 229) +#define __NR_mq_open (__NR_Linux + 230) +#define __NR_mq_unlink (__NR_Linux + 231) +#define __NR_mq_timedsend (__NR_Linux + 232) +#define __NR_mq_timedreceive (__NR_Linux + 233) +#define __NR_mq_notify (__NR_Linux + 234) +#define __NR_mq_getsetattr (__NR_Linux + 235) +#define __NR_vserver (__NR_Linux + 236) +#define __NR_waitid (__NR_Linux + 237) +/* #define __NR_sys_setaltroot (__NR_Linux + 238) */ +#define __NR_add_key (__NR_Linux + 239) +#define __NR_request_key (__NR_Linux + 240) +#define __NR_keyctl (__NR_Linux + 241) +#define __NR_set_thread_area (__NR_Linux + 242) +#define __NR_inotify_init (__NR_Linux + 243) +#define __NR_inotify_add_watch (__NR_Linux + 244) +#define __NR_inotify_rm_watch (__NR_Linux + 245) +#define __NR_migrate_pages (__NR_Linux + 246) +#define __NR_openat (__NR_Linux + 247) +#define __NR_mkdirat (__NR_Linux + 248) +#define __NR_mknodat (__NR_Linux + 249) +#define __NR_fchownat (__NR_Linux + 250) +#define __NR_futimesat (__NR_Linux + 251) +#define __NR_newfstatat (__NR_Linux + 252) +#define __NR_unlinkat (__NR_Linux + 253) +#define __NR_renameat (__NR_Linux + 254) +#define __NR_linkat (__NR_Linux + 255) +#define __NR_symlinkat (__NR_Linux + 256) +#define __NR_readlinkat (__NR_Linux + 257) +#define __NR_fchmodat (__NR_Linux + 258) +#define __NR_faccessat (__NR_Linux + 259) +#define __NR_pselect6 (__NR_Linux + 260) +#define __NR_ppoll (__NR_Linux + 261) +#define __NR_unshare (__NR_Linux + 262) +#define __NR_splice (__NR_Linux + 263) +#define __NR_sync_file_range (__NR_Linux + 264) +#define __NR_tee (__NR_Linux + 265) +#define __NR_vmsplice (__NR_Linux + 266) +#define __NR_move_pages (__NR_Linux + 267) +#define __NR_set_robust_list (__NR_Linux + 268) +#define __NR_get_robust_list (__NR_Linux + 269) +#define __NR_kexec_load (__NR_Linux + 270) +#define __NR_getcpu (__NR_Linux + 271) +#define __NR_epoll_pwait (__NR_Linux + 272) +#define __NR_ioprio_set (__NR_Linux + 273) +#define __NR_ioprio_get (__NR_Linux + 274) +#define __NR_utimensat (__NR_Linux + 275) +#define __NR_signalfd (__NR_Linux + 276) +#define __NR_timerfd (__NR_Linux + 277) +#define __NR_eventfd (__NR_Linux + 278) +#define __NR_fallocate (__NR_Linux + 279) +#define __NR_timerfd_create (__NR_Linux + 280) +#define __NR_timerfd_gettime (__NR_Linux + 281) +#define __NR_timerfd_settime (__NR_Linux + 282) +#define __NR_signalfd4 (__NR_Linux + 283) +#define __NR_eventfd2 (__NR_Linux + 284) +#define __NR_epoll_create1 (__NR_Linux + 285) +#define __NR_dup3 (__NR_Linux + 286) +#define __NR_pipe2 (__NR_Linux + 287) +#define __NR_inotify_init1 (__NR_Linux + 288) +#define __NR_preadv (__NR_Linux + 289) +#define __NR_pwritev (__NR_Linux + 290) + +/* + * Offset of the last Linux 64-bit flavoured syscall + */ +#define __NR_Linux_syscalls 290 + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ + +#define __NR_64_Linux 5000 +#define __NR_64_Linux_syscalls 290 + +#if _MIPS_SIM == _MIPS_SIM_NABI32 + +/* + * Linux N32 syscalls are in the range from 6000 to 6999. + */ +#define __NR_Linux 6000 +#define __NR_read (__NR_Linux + 0) +#define __NR_write (__NR_Linux + 1) +#define __NR_open (__NR_Linux + 2) +#define __NR_close (__NR_Linux + 3) +#define __NR_stat (__NR_Linux + 4) +#define __NR_fstat (__NR_Linux + 5) +#define __NR_lstat (__NR_Linux + 6) +#define __NR_poll (__NR_Linux + 7) +#define __NR_lseek (__NR_Linux + 8) +#define __NR_mmap (__NR_Linux + 9) +#define __NR_mprotect (__NR_Linux + 10) +#define __NR_munmap (__NR_Linux + 11) +#define __NR_brk (__NR_Linux + 12) +#define __NR_rt_sigaction (__NR_Linux + 13) +#define __NR_rt_sigprocmask (__NR_Linux + 14) +#define __NR_ioctl (__NR_Linux + 15) +#define __NR_pread64 (__NR_Linux + 16) +#define __NR_pwrite64 (__NR_Linux + 17) +#define __NR_readv (__NR_Linux + 18) +#define __NR_writev (__NR_Linux + 19) +#define __NR_access (__NR_Linux + 20) +#define __NR_pipe (__NR_Linux + 21) +#define __NR__newselect (__NR_Linux + 22) +#define __NR_sched_yield (__NR_Linux + 23) +#define __NR_mremap (__NR_Linux + 24) +#define __NR_msync (__NR_Linux + 25) +#define __NR_mincore (__NR_Linux + 26) +#define __NR_madvise (__NR_Linux + 27) +#define __NR_shmget (__NR_Linux + 28) +#define __NR_shmat (__NR_Linux + 29) +#define __NR_shmctl (__NR_Linux + 30) +#define __NR_dup (__NR_Linux + 31) +#define __NR_dup2 (__NR_Linux + 32) +#define __NR_pause (__NR_Linux + 33) +#define __NR_nanosleep (__NR_Linux + 34) +#define __NR_getitimer (__NR_Linux + 35) +#define __NR_setitimer (__NR_Linux + 36) +#define __NR_alarm (__NR_Linux + 37) +#define __NR_getpid (__NR_Linux + 38) +#define __NR_sendfile (__NR_Linux + 39) +#define __NR_socket (__NR_Linux + 40) +#define __NR_connect (__NR_Linux + 41) +#define __NR_accept (__NR_Linux + 42) +#define __NR_sendto (__NR_Linux + 43) +#define __NR_recvfrom (__NR_Linux + 44) +#define __NR_sendmsg (__NR_Linux + 45) +#define __NR_recvmsg (__NR_Linux + 46) +#define __NR_shutdown (__NR_Linux + 47) +#define __NR_bind (__NR_Linux + 48) +#define __NR_listen (__NR_Linux + 49) +#define __NR_getsockname (__NR_Linux + 50) +#define __NR_getpeername (__NR_Linux + 51) +#define __NR_socketpair (__NR_Linux + 52) +#define __NR_setsockopt (__NR_Linux + 53) +#define __NR_getsockopt (__NR_Linux + 54) +#define __NR_clone (__NR_Linux + 55) +#define __NR_fork (__NR_Linux + 56) +#define __NR_execve (__NR_Linux + 57) +#define __NR_exit (__NR_Linux + 58) +#define __NR_wait4 (__NR_Linux + 59) +#define __NR_kill (__NR_Linux + 60) +#define __NR_uname (__NR_Linux + 61) +#define __NR_semget (__NR_Linux + 62) +#define __NR_semop (__NR_Linux + 63) +#define __NR_semctl (__NR_Linux + 64) +#define __NR_shmdt (__NR_Linux + 65) +#define __NR_msgget (__NR_Linux + 66) +#define __NR_msgsnd (__NR_Linux + 67) +#define __NR_msgrcv (__NR_Linux + 68) +#define __NR_msgctl (__NR_Linux + 69) +#define __NR_fcntl (__NR_Linux + 70) +#define __NR_flock (__NR_Linux + 71) +#define __NR_fsync (__NR_Linux + 72) +#define __NR_fdatasync (__NR_Linux + 73) +#define __NR_truncate (__NR_Linux + 74) +#define __NR_ftruncate (__NR_Linux + 75) +#define __NR_getdents (__NR_Linux + 76) +#define __NR_getcwd (__NR_Linux + 77) +#define __NR_chdir (__NR_Linux + 78) +#define __NR_fchdir (__NR_Linux + 79) +#define __NR_rename (__NR_Linux + 80) +#define __NR_mkdir (__NR_Linux + 81) +#define __NR_rmdir (__NR_Linux + 82) +#define __NR_creat (__NR_Linux + 83) +#define __NR_link (__NR_Linux + 84) +#define __NR_unlink (__NR_Linux + 85) +#define __NR_symlink (__NR_Linux + 86) +#define __NR_readlink (__NR_Linux + 87) +#define __NR_chmod (__NR_Linux + 88) +#define __NR_fchmod (__NR_Linux + 89) +#define __NR_chown (__NR_Linux + 90) +#define __NR_fchown (__NR_Linux + 91) +#define __NR_lchown (__NR_Linux + 92) +#define __NR_umask (__NR_Linux + 93) +#define __NR_gettimeofday (__NR_Linux + 94) +#define __NR_getrlimit (__NR_Linux + 95) +#define __NR_getrusage (__NR_Linux + 96) +#define __NR_sysinfo (__NR_Linux + 97) +#define __NR_times (__NR_Linux + 98) +#define __NR_ptrace (__NR_Linux + 99) +#define __NR_getuid (__NR_Linux + 100) +#define __NR_syslog (__NR_Linux + 101) +#define __NR_getgid (__NR_Linux + 102) +#define __NR_setuid (__NR_Linux + 103) +#define __NR_setgid (__NR_Linux + 104) +#define __NR_geteuid (__NR_Linux + 105) +#define __NR_getegid (__NR_Linux + 106) +#define __NR_setpgid (__NR_Linux + 107) +#define __NR_getppid (__NR_Linux + 108) +#define __NR_getpgrp (__NR_Linux + 109) +#define __NR_setsid (__NR_Linux + 110) +#define __NR_setreuid (__NR_Linux + 111) +#define __NR_setregid (__NR_Linux + 112) +#define __NR_getgroups (__NR_Linux + 113) +#define __NR_setgroups (__NR_Linux + 114) +#define __NR_setresuid (__NR_Linux + 115) +#define __NR_getresuid (__NR_Linux + 116) +#define __NR_setresgid (__NR_Linux + 117) +#define __NR_getresgid (__NR_Linux + 118) +#define __NR_getpgid (__NR_Linux + 119) +#define __NR_setfsuid (__NR_Linux + 120) +#define __NR_setfsgid (__NR_Linux + 121) +#define __NR_getsid (__NR_Linux + 122) +#define __NR_capget (__NR_Linux + 123) +#define __NR_capset (__NR_Linux + 124) +#define __NR_rt_sigpending (__NR_Linux + 125) +#define __NR_rt_sigtimedwait (__NR_Linux + 126) +#define __NR_rt_sigqueueinfo (__NR_Linux + 127) +#define __NR_rt_sigsuspend (__NR_Linux + 128) +#define __NR_sigaltstack (__NR_Linux + 129) +#define __NR_utime (__NR_Linux + 130) +#define __NR_mknod (__NR_Linux + 131) +#define __NR_personality (__NR_Linux + 132) +#define __NR_ustat (__NR_Linux + 133) +#define __NR_statfs (__NR_Linux + 134) +#define __NR_fstatfs (__NR_Linux + 135) +#define __NR_sysfs (__NR_Linux + 136) +#define __NR_getpriority (__NR_Linux + 137) +#define __NR_setpriority (__NR_Linux + 138) +#define __NR_sched_setparam (__NR_Linux + 139) +#define __NR_sched_getparam (__NR_Linux + 140) +#define __NR_sched_setscheduler (__NR_Linux + 141) +#define __NR_sched_getscheduler (__NR_Linux + 142) +#define __NR_sched_get_priority_max (__NR_Linux + 143) +#define __NR_sched_get_priority_min (__NR_Linux + 144) +#define __NR_sched_rr_get_interval (__NR_Linux + 145) +#define __NR_mlock (__NR_Linux + 146) +#define __NR_munlock (__NR_Linux + 147) +#define __NR_mlockall (__NR_Linux + 148) +#define __NR_munlockall (__NR_Linux + 149) +#define __NR_vhangup (__NR_Linux + 150) +#define __NR_pivot_root (__NR_Linux + 151) +#define __NR__sysctl (__NR_Linux + 152) +#define __NR_prctl (__NR_Linux + 153) +#define __NR_adjtimex (__NR_Linux + 154) +#define __NR_setrlimit (__NR_Linux + 155) +#define __NR_chroot (__NR_Linux + 156) +#define __NR_sync (__NR_Linux + 157) +#define __NR_acct (__NR_Linux + 158) +#define __NR_settimeofday (__NR_Linux + 159) +#define __NR_mount (__NR_Linux + 160) +#define __NR_umount2 (__NR_Linux + 161) +#define __NR_swapon (__NR_Linux + 162) +#define __NR_swapoff (__NR_Linux + 163) +#define __NR_reboot (__NR_Linux + 164) +#define __NR_sethostname (__NR_Linux + 165) +#define __NR_setdomainname (__NR_Linux + 166) +#define __NR_create_module (__NR_Linux + 167) +#define __NR_init_module (__NR_Linux + 168) +#define __NR_delete_module (__NR_Linux + 169) +#define __NR_get_kernel_syms (__NR_Linux + 170) +#define __NR_query_module (__NR_Linux + 171) +#define __NR_quotactl (__NR_Linux + 172) +#define __NR_nfsservctl (__NR_Linux + 173) +#define __NR_getpmsg (__NR_Linux + 174) +#define __NR_putpmsg (__NR_Linux + 175) +#define __NR_afs_syscall (__NR_Linux + 176) +#define __NR_reserved177 (__NR_Linux + 177) +#define __NR_gettid (__NR_Linux + 178) +#define __NR_readahead (__NR_Linux + 179) +#define __NR_setxattr (__NR_Linux + 180) +#define __NR_lsetxattr (__NR_Linux + 181) +#define __NR_fsetxattr (__NR_Linux + 182) +#define __NR_getxattr (__NR_Linux + 183) +#define __NR_lgetxattr (__NR_Linux + 184) +#define __NR_fgetxattr (__NR_Linux + 185) +#define __NR_listxattr (__NR_Linux + 186) +#define __NR_llistxattr (__NR_Linux + 187) +#define __NR_flistxattr (__NR_Linux + 188) +#define __NR_removexattr (__NR_Linux + 189) +#define __NR_lremovexattr (__NR_Linux + 190) +#define __NR_fremovexattr (__NR_Linux + 191) +#define __NR_tkill (__NR_Linux + 192) +#define __NR_reserved193 (__NR_Linux + 193) +#define __NR_futex (__NR_Linux + 194) +#define __NR_sched_setaffinity (__NR_Linux + 195) +#define __NR_sched_getaffinity (__NR_Linux + 196) +#define __NR_cacheflush (__NR_Linux + 197) +#define __NR_cachectl (__NR_Linux + 198) +#define __NR_sysmips (__NR_Linux + 199) +#define __NR_io_setup (__NR_Linux + 200) +#define __NR_io_destroy (__NR_Linux + 201) +#define __NR_io_getevents (__NR_Linux + 202) +#define __NR_io_submit (__NR_Linux + 203) +#define __NR_io_cancel (__NR_Linux + 204) +#define __NR_exit_group (__NR_Linux + 205) +#define __NR_lookup_dcookie (__NR_Linux + 206) +#define __NR_epoll_create (__NR_Linux + 207) +#define __NR_epoll_ctl (__NR_Linux + 208) +#define __NR_epoll_wait (__NR_Linux + 209) +#define __NR_remap_file_pages (__NR_Linux + 210) +#define __NR_rt_sigreturn (__NR_Linux + 211) +#define __NR_fcntl64 (__NR_Linux + 212) +#define __NR_set_tid_address (__NR_Linux + 213) +#define __NR_restart_syscall (__NR_Linux + 214) +#define __NR_semtimedop (__NR_Linux + 215) +#define __NR_fadvise64 (__NR_Linux + 216) +#define __NR_statfs64 (__NR_Linux + 217) +#define __NR_fstatfs64 (__NR_Linux + 218) +#define __NR_sendfile64 (__NR_Linux + 219) +#define __NR_timer_create (__NR_Linux + 220) +#define __NR_timer_settime (__NR_Linux + 221) +#define __NR_timer_gettime (__NR_Linux + 222) +#define __NR_timer_getoverrun (__NR_Linux + 223) +#define __NR_timer_delete (__NR_Linux + 224) +#define __NR_clock_settime (__NR_Linux + 225) +#define __NR_clock_gettime (__NR_Linux + 226) +#define __NR_clock_getres (__NR_Linux + 227) +#define __NR_clock_nanosleep (__NR_Linux + 228) +#define __NR_tgkill (__NR_Linux + 229) +#define __NR_utimes (__NR_Linux + 230) +#define __NR_mbind (__NR_Linux + 231) +#define __NR_get_mempolicy (__NR_Linux + 232) +#define __NR_set_mempolicy (__NR_Linux + 233) +#define __NR_mq_open (__NR_Linux + 234) +#define __NR_mq_unlink (__NR_Linux + 235) +#define __NR_mq_timedsend (__NR_Linux + 236) +#define __NR_mq_timedreceive (__NR_Linux + 237) +#define __NR_mq_notify (__NR_Linux + 238) +#define __NR_mq_getsetattr (__NR_Linux + 239) +#define __NR_vserver (__NR_Linux + 240) +#define __NR_waitid (__NR_Linux + 241) +/* #define __NR_sys_setaltroot (__NR_Linux + 242) */ +#define __NR_add_key (__NR_Linux + 243) +#define __NR_request_key (__NR_Linux + 244) +#define __NR_keyctl (__NR_Linux + 245) +#define __NR_set_thread_area (__NR_Linux + 246) +#define __NR_inotify_init (__NR_Linux + 247) +#define __NR_inotify_add_watch (__NR_Linux + 248) +#define __NR_inotify_rm_watch (__NR_Linux + 249) +#define __NR_migrate_pages (__NR_Linux + 250) +#define __NR_openat (__NR_Linux + 251) +#define __NR_mkdirat (__NR_Linux + 252) +#define __NR_mknodat (__NR_Linux + 253) +#define __NR_fchownat (__NR_Linux + 254) +#define __NR_futimesat (__NR_Linux + 255) +#define __NR_newfstatat (__NR_Linux + 256) +#define __NR_unlinkat (__NR_Linux + 257) +#define __NR_renameat (__NR_Linux + 258) +#define __NR_linkat (__NR_Linux + 259) +#define __NR_symlinkat (__NR_Linux + 260) +#define __NR_readlinkat (__NR_Linux + 261) +#define __NR_fchmodat (__NR_Linux + 262) +#define __NR_faccessat (__NR_Linux + 263) +#define __NR_pselect6 (__NR_Linux + 264) +#define __NR_ppoll (__NR_Linux + 265) +#define __NR_unshare (__NR_Linux + 266) +#define __NR_splice (__NR_Linux + 267) +#define __NR_sync_file_range (__NR_Linux + 268) +#define __NR_tee (__NR_Linux + 269) +#define __NR_vmsplice (__NR_Linux + 270) +#define __NR_move_pages (__NR_Linux + 271) +#define __NR_set_robust_list (__NR_Linux + 272) +#define __NR_get_robust_list (__NR_Linux + 273) +#define __NR_kexec_load (__NR_Linux + 274) +#define __NR_getcpu (__NR_Linux + 275) +#define __NR_epoll_pwait (__NR_Linux + 276) +#define __NR_ioprio_set (__NR_Linux + 277) +#define __NR_ioprio_get (__NR_Linux + 278) +#define __NR_utimensat (__NR_Linux + 279) +#define __NR_signalfd (__NR_Linux + 280) +#define __NR_timerfd (__NR_Linux + 281) +#define __NR_eventfd (__NR_Linux + 282) +#define __NR_fallocate (__NR_Linux + 283) +#define __NR_timerfd_create (__NR_Linux + 284) +#define __NR_timerfd_gettime (__NR_Linux + 285) +#define __NR_timerfd_settime (__NR_Linux + 286) +#define __NR_signalfd4 (__NR_Linux + 287) +#define __NR_eventfd2 (__NR_Linux + 288) +#define __NR_epoll_create1 (__NR_Linux + 289) +#define __NR_dup3 (__NR_Linux + 290) +#define __NR_pipe2 (__NR_Linux + 291) +#define __NR_inotify_init1 (__NR_Linux + 292) +#define __NR_preadv (__NR_Linux + 293) +#define __NR_pwritev (__NR_Linux + 294) + +/* + * Offset of the last N32 flavoured syscall + */ +#define __NR_Linux_syscalls 294 + +#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ + +#define __NR_N32_Linux 6000 +#define __NR_N32_Linux_syscalls 294 + +#endif /* _ASM_UNISTD_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/assert.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/assert.h new file mode 100644 index 0000000..a67dd43 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/assert.h @@ -0,0 +1,82 @@ +/* Copyright (C) 1991,1992,1994-2001,2003,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.2 Diagnostics + */ + +#ifdef _ASSERT_H + +# undef _ASSERT_H +# undef assert +# undef __ASSERT_VOID_CAST + +#endif /* assert.h */ + +#define _ASSERT_H 1 +#include + +#if defined __cplusplus && __GNUC_PREREQ(2,95) +# define __ASSERT_VOID_CAST static_cast +#else +# define __ASSERT_VOID_CAST (void) +#endif + +/* void assert (int expression); + + If NDEBUG is defined, do nothing. + If not, and EXPRESSION is zero, print an error message and abort. */ + +#ifdef NDEBUG + +# define assert(expr) (__ASSERT_VOID_CAST (0)) + +#else /* Not NDEBUG. */ + +__BEGIN_DECLS + +/* This prints an "Assertion failed" message and aborts. */ +extern void __assert __P((const char *, const char *, int, const char *)); + +__END_DECLS + +# define assert(expr) \ + (__ASSERT_VOID_CAST ((expr) ? 0 : \ + (__assert (__STRING(expr), __FILE__, __LINE__, \ + __ASSERT_FUNCTION), 0))) + +/* Define some temporaries to workaround tinyx makedepend bug */ +#define __GNUC_PREREQ_2_6 __GNUC_PREREQ(2, 6) +#define __GNUC_PREREQ_2_4 __GNUC_PREREQ(2, 4) +/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' + which contains the name of the function currently being defined. + This is broken in G++ before version 2.6. + C9x has a similar variable called __func__, but prefer the GCC one since + it demangles C++ function names. */ + +# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4 +# define __ASSERT_FUNCTION __PRETTY_FUNCTION__ +# else +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __ASSERT_FUNCTION __func__ +# else +# define __ASSERT_FUNCTION ((__const char *) 0) +# endif +# endif + +#endif /* NDEBUG. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/atomic.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/atomic.h new file mode 100644 index 0000000..8a23f6e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/atomic.h @@ -0,0 +1,261 @@ +/* Internal macros for atomic operations for GNU C Library. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ATOMIC_H +#define _ATOMIC_H 1 + +#include + +#include + +/* Wrapper macros to call pre_NN_post (mem, ...) where NN is the + bit width of *MEM. The calling macro puts parens around MEM + and following args. */ +#define __atomic_val_bysize(pre, post, mem, ...) \ + ({ \ + __typeof (*mem) __result; \ + if (sizeof (*mem) == 1) \ + __result = pre##_8_##post (mem, __VA_ARGS__); \ + else if (sizeof (*mem) == 2) \ + __result = pre##_16_##post (mem, __VA_ARGS__); \ + else if (sizeof (*mem) == 4) \ + __result = pre##_32_##post (mem, __VA_ARGS__); \ + else if (sizeof (*mem) == 8) \ + __result = pre##_64_##post (mem, __VA_ARGS__); \ + else \ + abort (); \ + __result; \ + }) +#define __atomic_bool_bysize(pre, post, mem, ...) \ + ({ \ + int __result; \ + if (sizeof (*mem) == 1) \ + __result = pre##_8_##post (mem, __VA_ARGS__); \ + else if (sizeof (*mem) == 2) \ + __result = pre##_16_##post (mem, __VA_ARGS__); \ + else if (sizeof (*mem) == 4) \ + __result = pre##_32_##post (mem, __VA_ARGS__); \ + else if (sizeof (*mem) == 8) \ + __result = pre##_64_##post (mem, __VA_ARGS__); \ + else \ + abort (); \ + __result; \ + }) + + +/* Atomically store NEWVAL in *MEM if *MEM is equal to OLDVAL. + Return the old *MEM value. */ +#if !defined atomic_compare_and_exchange_val_acq \ + && defined __arch_compare_and_exchange_val_32_acq +# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ + __atomic_val_bysize (__arch_compare_and_exchange_val,acq, \ + mem, newval, oldval) +#endif + + +#ifndef atomic_compare_and_exchange_val_rel +# define atomic_compare_and_exchange_val_rel(mem, newval, oldval) \ + atomic_compare_and_exchange_val_acq (mem, newval, oldval) +#endif + + +/* Atomically store NEWVAL in *MEM if *MEM is equal to OLDVAL. + Return zero if *MEM was changed or non-zero if no exchange happened. */ +#ifndef atomic_compare_and_exchange_bool_acq +# ifdef __arch_compare_and_exchange_bool_32_acq +# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ + __atomic_bool_bysize (__arch_compare_and_exchange_bool,acq, \ + mem, newval, oldval) +# else +# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ + ({ /* Cannot use __oldval here, because macros later in this file might \ + call this macro with __oldval argument. */ \ + __typeof (oldval) __old = (oldval); \ + atomic_compare_and_exchange_val_acq (mem, newval, __old) != __old; \ + }) +# endif +#endif + + +#ifndef atomic_compare_and_exchange_bool_rel +# define atomic_compare_and_exchange_bool_rel(mem, newval, oldval) \ + atomic_compare_and_exchange_bool_acq (mem, newval, oldval) +#endif + + +/* Store NEWVALUE in *MEM and return the old value. */ +#ifndef atomic_exchange_acq +# define atomic_exchange_acq(mem, newvalue) \ + ({ __typeof (*(mem)) __oldval; \ + __typeof (mem) __memp = (mem); \ + __typeof (*(mem)) __value = (newvalue); \ + \ + do \ + __oldval = (*__memp); \ + while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \ + __value, \ + __oldval),\ + 0)); \ + \ + __oldval; }) +#endif + +#ifndef atomic_exchange_rel +# define atomic_exchange_rel(mem, newvalue) atomic_exchange_acq (mem, newvalue) +#endif + + +/* Add VALUE to *MEM and return the old value of *MEM. */ +#ifndef atomic_exchange_and_add +# define atomic_exchange_and_add(mem, value) \ + ({ __typeof (*(mem)) __oldval; \ + __typeof (mem) __memp = (mem); \ + __typeof (*(mem)) __value = (value); \ + \ + do \ + __oldval = (*__memp); \ + while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \ + __oldval \ + + __value,\ + __oldval),\ + 0)); \ + \ + __oldval; }) +#endif + + +#ifndef atomic_add +# define atomic_add(mem, value) (void) atomic_exchange_and_add ((mem), (value)) +#endif + + +#ifndef atomic_increment +# define atomic_increment(mem) atomic_add ((mem), 1) +#endif + + +#ifndef atomic_increment_val +# define atomic_increment_val(mem) (atomic_exchange_and_add ((mem), 1) + 1) +#endif + + +/* Add one to *MEM and return true iff it's now zero. */ +#ifndef atomic_increment_and_test +# define atomic_increment_and_test(mem) \ + (atomic_exchange_and_add ((mem), 1) + 1 == 0) +#endif + + +#ifndef atomic_decrement +# define atomic_decrement(mem) atomic_add ((mem), -1) +#endif + + +#ifndef atomic_decrement_val +# define atomic_decrement_val(mem) (atomic_exchange_and_add ((mem), -1) - 1) +#endif + + +/* Subtract 1 from *MEM and return true iff it's now zero. */ +#ifndef atomic_decrement_and_test +# define atomic_decrement_and_test(mem) \ + (atomic_exchange_and_add ((mem), -1) == 1) +#endif + + +/* Decrement *MEM if it is > 0, and return the old value. */ +#ifndef atomic_decrement_if_positive +# define atomic_decrement_if_positive(mem) \ + ({ __typeof (*(mem)) __oldval; \ + __typeof (mem) __memp = (mem); \ + \ + do \ + { \ + __oldval = *__memp; \ + if (__builtin_expect (__oldval <= 0, 0)) \ + break; \ + } \ + while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \ + __oldval \ + - 1, \ + __oldval),\ + 0));\ + __oldval; }) +#endif + + +#ifndef atomic_add_negative +# define atomic_add_negative(mem, value) \ + ({ __typeof (value) __aan_value = (value); \ + atomic_exchange_and_add (mem, __aan_value) < -__aan_value; }) +#endif + + +#ifndef atomic_add_zero +# define atomic_add_zero(mem, value) \ + ({ __typeof (value) __aaz_value = (value); \ + atomic_exchange_and_add (mem, __aaz_value) == -__aaz_value; }) +#endif + + +#ifndef atomic_bit_set +# define atomic_bit_set(mem, bit) \ + (void) atomic_bit_test_set(mem, bit) +#endif + + +#ifndef atomic_bit_test_set +# define atomic_bit_test_set(mem, bit) \ + ({ __typeof (*(mem)) __oldval; \ + __typeof (mem) __memp = (mem); \ + __typeof (*(mem)) __mask = ((__typeof (*(mem))) 1 << (bit)); \ + \ + do \ + __oldval = (*__memp); \ + while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \ + __oldval \ + | __mask, \ + __oldval),\ + 0)); \ + \ + __oldval & __mask; }) +#endif + + +#ifndef atomic_full_barrier +# define atomic_full_barrier() __asm ("" ::: "memory") +#endif + + +#ifndef atomic_read_barrier +# define atomic_read_barrier() atomic_full_barrier () +#endif + + +#ifndef atomic_write_barrier +# define atomic_write_barrier() atomic_full_barrier () +#endif + + +#ifndef atomic_delay +# define atomic_delay() do { /* nothing */ } while (0) +#endif + +#endif /* atomic.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/atomic.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/atomic.h new file mode 100644 index 0000000..167d9a5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/atomic.h @@ -0,0 +1,303 @@ +/* Low-level functions for atomic operations. Mips version. + Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MIPS_BITS_ATOMIC_H +#define _MIPS_BITS_ATOMIC_H 1 + +#include +#include + +typedef int32_t atomic32_t; +typedef uint32_t uatomic32_t; +typedef int_fast32_t atomic_fast32_t; +typedef uint_fast32_t uatomic_fast32_t; + +typedef int64_t atomic64_t; +typedef uint64_t uatomic64_t; +typedef int_fast64_t atomic_fast64_t; +typedef uint_fast64_t uatomic_fast64_t; + +typedef intptr_t atomicptr_t; +typedef uintptr_t uatomicptr_t; +typedef intmax_t atomic_max_t; +typedef uintmax_t uatomic_max_t; + +#if _MIPS_SIM == _ABIO32 +#define MIPS_PUSH_MIPS2 ".set mips2\n\t" +#else +#define MIPS_PUSH_MIPS2 +#endif + +/* See the comments in about the use of the sync instruction. */ +#ifndef MIPS_SYNC +# define MIPS_SYNC sync +#endif + +#define MIPS_SYNC_STR_2(X) #X +#define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X) +#define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC) + +/* Compare and exchange. For all of the "xxx" routines, we expect a + "__prev" and a "__cmp" variable to be provided by the enclosing scope, + in which values are returned. */ + +#define __arch_compare_and_exchange_xxx_8_int(mem, newval, oldval, rel, acq) \ + (abort (), __prev = __cmp = 0) + +#define __arch_compare_and_exchange_xxx_16_int(mem, newval, oldval, rel, acq) \ + (abort (), __prev = __cmp = 0) + +#define __arch_compare_and_exchange_xxx_32_int(mem, newval, oldval, rel, acq) \ + __asm__ __volatile__ ( \ + ".set push\n\t" \ + MIPS_PUSH_MIPS2 \ + rel "\n" \ + "1:\t" \ + "ll %0,%4\n\t" \ + "move %1,$0\n\t" \ + "bne %0,%2,2f\n\t" \ + "move %1,%3\n\t" \ + "sc %1,%4\n\t" \ + "beqz %1,1b\n" \ + acq "\n\t" \ + ".set pop\n" \ + "2:\n\t" \ + : "=&r" (__prev), "=&r" (__cmp) \ + : "r" (oldval), "r" (newval), "m" (*mem) \ + : "memory") + +#if _MIPS_SIM == _ABIO32 +/* We can't do an atomic 64-bit operation in O32. */ +#define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \ + (abort (), __prev = __cmp = 0) +#else +#define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \ + __asm__ __volatile__ ("\n" \ + ".set push\n\t" \ + MIPS_PUSH_MIPS2 \ + rel "\n" \ + "1:\t" \ + "lld %0,%4\n\t" \ + "move %1,$0\n\t" \ + "bne %0,%2,2f\n\t" \ + "move %1,%3\n\t" \ + "scd %1,%4\n\t" \ + "beqz %1,1b\n" \ + acq "\n\t" \ + ".set pop\n" \ + "2:\n\t" \ + : "=&r" (__prev), "=&r" (__cmp) \ + : "r" (oldval), "r" (newval), "m" (*mem) \ + : "memory") +#endif + +/* For all "bool" routines, we return FALSE if exchange succesful. */ + +#define __arch_compare_and_exchange_bool_8_int(mem, new, old, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq); \ + !__cmp; }) + +#define __arch_compare_and_exchange_bool_16_int(mem, new, old, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq); \ + !__cmp; }) + +#define __arch_compare_and_exchange_bool_32_int(mem, new, old, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq); \ + !__cmp; }) + +#define __arch_compare_and_exchange_bool_64_int(mem, new, old, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq); \ + !__cmp; }) + +/* For all "val" routines, return the old value whether exchange + successful or not. */ + +#define __arch_compare_and_exchange_val_8_int(mem, new, old, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq); \ + (typeof (*mem))__prev; }) + +#define __arch_compare_and_exchange_val_16_int(mem, new, old, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq); \ + (typeof (*mem))__prev; }) + +#define __arch_compare_and_exchange_val_32_int(mem, new, old, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq); \ + (typeof (*mem))__prev; }) + +#define __arch_compare_and_exchange_val_64_int(mem, new, old, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq); \ + (typeof (*mem))__prev; }) + +/* Compare and exchange with "acquire" semantics, ie barrier after. */ + +#define atomic_compare_and_exchange_bool_acq(mem, new, old) \ + __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \ + mem, new, old, "", MIPS_SYNC_STR) + +#define atomic_compare_and_exchange_val_acq(mem, new, old) \ + __atomic_val_bysize (__arch_compare_and_exchange_val, int, \ + mem, new, old, "", MIPS_SYNC_STR) + +/* Compare and exchange with "release" semantics, ie barrier before. */ + +#define atomic_compare_and_exchange_bool_rel(mem, new, old) \ + __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \ + mem, new, old, MIPS_SYNC_STR, "") + +#define atomic_compare_and_exchange_val_rel(mem, new, old) \ + __atomic_val_bysize (__arch_compare_and_exchange_val, int, \ + mem, new, old, MIPS_SYNC_STR, "") + + + +/* Atomic exchange (without compare). */ + +#define __arch_exchange_xxx_8_int(mem, newval, rel, acq) \ + (abort (), 0) + +#define __arch_exchange_xxx_16_int(mem, newval, rel, acq) \ + (abort (), 0) + +#define __arch_exchange_xxx_32_int(mem, newval, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __asm__ __volatile__ ("\n" \ + ".set push\n\t" \ + MIPS_PUSH_MIPS2 \ + rel "\n" \ + "1:\t" \ + "ll %0,%3\n\t" \ + "move %1,%2\n\t" \ + "sc %1,%3\n\t" \ + "beqz %1,1b\n" \ + acq "\n\t" \ + ".set pop\n" \ + "2:\n\t" \ + : "=&r" (__prev), "=&r" (__cmp) \ + : "r" (newval), "m" (*mem) \ + : "memory"); \ + __prev; }) + +#if _MIPS_SIM == _ABIO32 +/* We can't do an atomic 64-bit operation in O32. */ +#define __arch_exchange_xxx_64_int(mem, newval, rel, acq) \ + (abort (), 0) +#else +#define __arch_exchange_xxx_64_int(mem, newval, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __asm__ __volatile__ ("\n" \ + ".set push\n\t" \ + MIPS_PUSH_MIPS2 \ + rel "\n" \ + "1:\n" \ + "lld %0,%3\n\t" \ + "move %1,%2\n\t" \ + "scd %1,%3\n\t" \ + "beqz %1,1b\n" \ + acq "\n\t" \ + ".set pop\n" \ + "2:\n\t" \ + : "=&r" (__prev), "=&r" (__cmp) \ + : "r" (newval), "m" (*mem) \ + : "memory"); \ + __prev; }) +#endif + +#define atomic_exchange_acq(mem, value) \ + __atomic_val_bysize (__arch_exchange_xxx, int, mem, value, "", MIPS_SYNC_STR) + +#define atomic_exchange_rel(mem, value) \ + __atomic_val_bysize (__arch_exchange_xxx, int, mem, value, MIPS_SYNC_STR, "") + + +/* Atomically add value and return the previous (unincremented) value. */ + +#define __arch_exchange_and_add_8_int(mem, newval, rel, acq) \ + (abort (), (typeof(*mem)) 0) + +#define __arch_exchange_and_add_16_int(mem, newval, rel, acq) \ + (abort (), (typeof(*mem)) 0) + +#define __arch_exchange_and_add_32_int(mem, value, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __asm__ __volatile__ ("\n" \ + ".set push\n\t" \ + MIPS_PUSH_MIPS2 \ + rel "\n" \ + "1:\t" \ + "ll %0,%3\n\t" \ + "addu %1,%0,%2\n\t" \ + "sc %1,%3\n\t" \ + "beqz %1,1b\n" \ + acq "\n\t" \ + ".set pop\n" \ + "2:\n\t" \ + : "=&r" (__prev), "=&r" (__cmp) \ + : "r" (value), "m" (*mem) \ + : "memory"); \ + __prev; }) + +#if _MIPS_SIM == _ABIO32 +/* We can't do an atomic 64-bit operation in O32. */ +#define __arch_exchange_and_add_64_int(mem, value, rel, acq) \ + (abort (), (typeof(*mem)) 0) +#else +#define __arch_exchange_and_add_64_int(mem, value, rel, acq) \ +({ typeof (*mem) __prev; int __cmp; \ + __asm__ __volatile__ ( \ + ".set push\n\t" \ + MIPS_PUSH_MIPS2 \ + rel "\n" \ + "1:\t" \ + "lld %0,%3\n\t" \ + "daddu %1,%0,%2\n\t" \ + "scd %1,%3\n\t" \ + "beqz %1,1b\n" \ + acq "\n\t" \ + ".set pop\n" \ + "2:\n\t" \ + : "=&r" (__prev), "=&r" (__cmp) \ + : "r" (value), "m" (*mem) \ + : "memory"); \ + __prev; }) +#endif + +/* ??? Barrier semantics for atomic_exchange_and_add appear to be + undefined. Use full barrier for now, as that's safe. */ +#define atomic_exchange_and_add(mem, value) \ + __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \ + MIPS_SYNC_STR, MIPS_SYNC_STR) + +/* TODO: More atomic operations could be implemented efficiently; only the + basic requirements are done. */ + +#define atomic_full_barrier() \ + __asm__ __volatile__ (".set push\n\t" \ + MIPS_PUSH_MIPS2 \ + MIPS_SYNC_STR "\n\t" \ + ".set pop" : : : "memory") + +#endif /* bits/atomic.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/byteswap.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/byteswap.h new file mode 100644 index 0000000..949ed0b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/byteswap.h @@ -0,0 +1,87 @@ +/* Macros to swap the order of bytes in integer values. + Copyright (C) 1997,1998,2000,2001,2002,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H +# error "Never use directly; include instead." +#endif + +#ifndef _BITS_BYTESWAP_H +#define _BITS_BYTESWAP_H 1 + +/* Swap bytes in 16 bit value. */ +#define __bswap_constant_16(x) \ + ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) + +#ifdef __GNUC__ +# define __bswap_16(x) \ + (__extension__ \ + ({ unsigned short int __bsx = (x); __bswap_constant_16 (__bsx); })) +#else +static __inline unsigned short int +__bswap_16 (unsigned short int __bsx) +{ + return __bswap_constant_16 (__bsx); +} +#endif + +/* Swap bytes in 32 bit value. */ +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ + (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) + +#ifdef __GNUC__ +# define __bswap_32(x) \ + (__extension__ \ + ({ register unsigned int __bsx = (x); __bswap_constant_32 (__bsx); })) +#else +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __bswap_constant_32 (__bsx); +} +#endif + +#if defined __GNUC__ && __GNUC__ >= 2 +/* Swap bytes in 64 bit value. */ +# define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56)) + +# define __bswap_64(x) \ + (__extension__ \ + ({ union { __extension__ unsigned long long int __ll; \ + unsigned int __l[2]; } __w, __r; \ + if (__builtin_constant_p (x)) \ + __r.__ll = __bswap_constant_64 (x); \ + else \ + { \ + __w.__ll = (x); \ + __r.__l[0] = __bswap_32 (__w.__l[1]); \ + __r.__l[1] = __bswap_32 (__w.__l[0]); \ + } \ + __r.__ll; })) +#endif + +#endif /* _BITS_BYTESWAP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/cmathcalls.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/cmathcalls.h new file mode 100644 index 0000000..c680c6d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/cmathcalls.h @@ -0,0 +1,158 @@ +/* Prototype declarations for complex math functions; + helper file for . + Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* NOTE: Because of the special way this file is used by , this + file must NOT be protected from multiple inclusion as header files + usually are. + + This file provides prototype declarations for the math functions. + Most functions are declared using the macro: + + __MATHCALL (NAME, (ARGS...)); + + This means there is a function `NAME' returning `double' and a function + `NAMEf' returning `float'. Each place `_Mdouble_' appears in the + prototype, that is actually `double' in the prototype for `NAME' and + `float' in the prototype for `NAMEf'. Reentrant variant functions are + called `NAME_r' and `NAMEf_r'. + + Functions returning other types like `int' are declared using the macro: + + __MATHDECL (TYPE, NAME, (ARGS...)); + + This is just like __MATHCALL but for a function returning `TYPE' + instead of `_Mdouble_'. In all of these cases, there is still + both a `NAME' and a `NAMEf' that takes `float' arguments. */ + +#ifndef _COMPLEX_H +#error "Never use directly; include instead." +#endif + +#define _Mdouble_complex_ _Mdouble_ _Complex + + +/* Trigonometric functions. */ + +/* Arc cosine of Z. */ +__MATHCALL (cacos, (_Mdouble_complex_ __z)); +/* Arc sine of Z. */ +__MATHCALL (casin, (_Mdouble_complex_ __z)); +/* Arc tangent of Z. */ +__MATHCALL (catan, (_Mdouble_complex_ __z)); + +/* Cosine of Z. */ +__MATHCALL (ccos, (_Mdouble_complex_ __z)); +/* Sine of Z. */ +__MATHCALL (csin, (_Mdouble_complex_ __z)); +/* Tangent of Z. */ +__MATHCALL (ctan, (_Mdouble_complex_ __z)); + + +/* Hyperbolic functions. */ + +/* Hyperbolic arc cosine of Z. */ +__MATHCALL (cacosh, (_Mdouble_complex_ __z)); +/* Hyperbolic arc sine of Z. */ +__MATHCALL (casinh, (_Mdouble_complex_ __z)); +/* Hyperbolic arc tangent of Z. */ +__MATHCALL (catanh, (_Mdouble_complex_ __z)); + +/* Hyperbolic cosine of Z. */ +__MATHCALL (ccosh, (_Mdouble_complex_ __z)); +/* Hyperbolic sine of Z. */ +__MATHCALL (csinh, (_Mdouble_complex_ __z)); +/* Hyperbolic tangent of Z. */ +__MATHCALL (ctanh, (_Mdouble_complex_ __z)); + + +/* Exponential and logarithmic functions. */ + +/* Exponential function of Z. */ +__MATHCALL (cexp, (_Mdouble_complex_ __z)); + +/* Natural logarithm of Z. */ +__MATHCALL (clog, (_Mdouble_complex_ __z)); + +#ifdef __USE_GNU +/* The base 10 logarithm is not defined by the standard but to implement + the standard C++ library it is handy. */ +__MATHCALL (clog10, (_Mdouble_complex_ __z)); +#endif + +/* Power functions. */ + +/* Return X to the Y power. */ +__MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); + +/* Return the square root of Z. */ +__MATHCALL (csqrt, (_Mdouble_complex_ __z)); + + +/* Absolute value, conjugates, and projection. */ + +/* Absolute value of Z. */ +__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); + +/* Argument value of Z. */ +__MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); + +/* Complex conjugate of Z. */ +__MATHCALL (conj, (_Mdouble_complex_ __z)); + +/* Projection of Z onto the Riemann sphere. */ +__MATHCALL (cproj, (_Mdouble_complex_ __z)); + + +/* Decomposing complex values. */ + +/* Imaginary part of Z. */ +__MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); + +/* Real part of Z. */ +__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); + + +/* Now some optimized versions. GCC has handy notations for these + functions. Recent GCC handles these as builtin functions so does + not need inlines. */ +#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ + +/* Imaginary part of Z. */ +extern __inline _Mdouble_ +__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW +{ + return __imag__ __z; +} + +/* Real part of Z. */ +extern __inline _Mdouble_ +__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW +{ + return __real__ __z; +} + +/* Complex conjugate of Z. */ +extern __inline _Mdouble_complex_ +__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW +{ + return __extension__ ~__z; +} + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/confname.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/confname.h new file mode 100644 index 0000000..ab7fdee --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/confname.h @@ -0,0 +1,606 @@ +/* `sysconf', `pathconf', and `confstr' NAME values. Generic version. + Copyright (C) 1993,1995-1998,2000,2001,2003,2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UNISTD_H +# error "Never use directly; include instead." +#endif + +/* Values for the NAME argument to `pathconf' and `fpathconf'. */ +enum + { + _PC_LINK_MAX, +#define _PC_LINK_MAX _PC_LINK_MAX + _PC_MAX_CANON, +#define _PC_MAX_CANON _PC_MAX_CANON + _PC_MAX_INPUT, +#define _PC_MAX_INPUT _PC_MAX_INPUT + _PC_NAME_MAX, +#define _PC_NAME_MAX _PC_NAME_MAX + _PC_PATH_MAX, +#define _PC_PATH_MAX _PC_PATH_MAX + _PC_PIPE_BUF, +#define _PC_PIPE_BUF _PC_PIPE_BUF + _PC_CHOWN_RESTRICTED, +#define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED + _PC_NO_TRUNC, +#define _PC_NO_TRUNC _PC_NO_TRUNC + _PC_VDISABLE, +#define _PC_VDISABLE _PC_VDISABLE + _PC_SYNC_IO, +#define _PC_SYNC_IO _PC_SYNC_IO + _PC_ASYNC_IO, +#define _PC_ASYNC_IO _PC_ASYNC_IO + _PC_PRIO_IO, +#define _PC_PRIO_IO _PC_PRIO_IO + _PC_SOCK_MAXBUF, +#define _PC_SOCK_MAXBUF _PC_SOCK_MAXBUF + _PC_FILESIZEBITS, +#define _PC_FILESIZEBITS _PC_FILESIZEBITS + _PC_REC_INCR_XFER_SIZE, +#define _PC_REC_INCR_XFER_SIZE _PC_REC_INCR_XFER_SIZE + _PC_REC_MAX_XFER_SIZE, +#define _PC_REC_MAX_XFER_SIZE _PC_REC_MAX_XFER_SIZE + _PC_REC_MIN_XFER_SIZE, +#define _PC_REC_MIN_XFER_SIZE _PC_REC_MIN_XFER_SIZE + _PC_REC_XFER_ALIGN, +#define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN + _PC_ALLOC_SIZE_MIN, +#define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN + _PC_SYMLINK_MAX, +#define _PC_SYMLINK_MAX _PC_SYMLINK_MAX + _PC_2_SYMLINKS +#define _PC_2_SYMLINKS _PC_2_SYMLINKS + }; + +/* Values for the argument to `sysconf'. */ +enum + { + _SC_ARG_MAX, +#define _SC_ARG_MAX _SC_ARG_MAX + _SC_CHILD_MAX, +#define _SC_CHILD_MAX _SC_CHILD_MAX + _SC_CLK_TCK, +#define _SC_CLK_TCK _SC_CLK_TCK + _SC_NGROUPS_MAX, +#define _SC_NGROUPS_MAX _SC_NGROUPS_MAX + _SC_OPEN_MAX, +#define _SC_OPEN_MAX _SC_OPEN_MAX + _SC_STREAM_MAX, +#define _SC_STREAM_MAX _SC_STREAM_MAX + _SC_TZNAME_MAX, +#define _SC_TZNAME_MAX _SC_TZNAME_MAX + _SC_JOB_CONTROL, +#define _SC_JOB_CONTROL _SC_JOB_CONTROL + _SC_SAVED_IDS, +#define _SC_SAVED_IDS _SC_SAVED_IDS + _SC_REALTIME_SIGNALS, +#define _SC_REALTIME_SIGNALS _SC_REALTIME_SIGNALS + _SC_PRIORITY_SCHEDULING, +#define _SC_PRIORITY_SCHEDULING _SC_PRIORITY_SCHEDULING + _SC_TIMERS, +#define _SC_TIMERS _SC_TIMERS + _SC_ASYNCHRONOUS_IO, +#define _SC_ASYNCHRONOUS_IO _SC_ASYNCHRONOUS_IO + _SC_PRIORITIZED_IO, +#define _SC_PRIORITIZED_IO _SC_PRIORITIZED_IO + _SC_SYNCHRONIZED_IO, +#define _SC_SYNCHRONIZED_IO _SC_SYNCHRONIZED_IO + _SC_FSYNC, +#define _SC_FSYNC _SC_FSYNC + _SC_MAPPED_FILES, +#define _SC_MAPPED_FILES _SC_MAPPED_FILES + _SC_MEMLOCK, +#define _SC_MEMLOCK _SC_MEMLOCK + _SC_MEMLOCK_RANGE, +#define _SC_MEMLOCK_RANGE _SC_MEMLOCK_RANGE + _SC_MEMORY_PROTECTION, +#define _SC_MEMORY_PROTECTION _SC_MEMORY_PROTECTION + _SC_MESSAGE_PASSING, +#define _SC_MESSAGE_PASSING _SC_MESSAGE_PASSING + _SC_SEMAPHORES, +#define _SC_SEMAPHORES _SC_SEMAPHORES + _SC_SHARED_MEMORY_OBJECTS, +#define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS + _SC_AIO_LISTIO_MAX, +#define _SC_AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX + _SC_AIO_MAX, +#define _SC_AIO_MAX _SC_AIO_MAX + _SC_AIO_PRIO_DELTA_MAX, +#define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX + _SC_DELAYTIMER_MAX, +#define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX + _SC_MQ_OPEN_MAX, +#define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX + _SC_MQ_PRIO_MAX, +#define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX + _SC_VERSION, +#define _SC_VERSION _SC_VERSION + _SC_PAGESIZE, +#define _SC_PAGESIZE _SC_PAGESIZE +#define _SC_PAGE_SIZE _SC_PAGESIZE + _SC_RTSIG_MAX, +#define _SC_RTSIG_MAX _SC_RTSIG_MAX + _SC_SEM_NSEMS_MAX, +#define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX + _SC_SEM_VALUE_MAX, +#define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX + _SC_SIGQUEUE_MAX, +#define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX + _SC_TIMER_MAX, +#define _SC_TIMER_MAX _SC_TIMER_MAX + + /* Values for the argument to `sysconf' + corresponding to _POSIX2_* symbols. */ + _SC_BC_BASE_MAX, +#define _SC_BC_BASE_MAX _SC_BC_BASE_MAX + _SC_BC_DIM_MAX, +#define _SC_BC_DIM_MAX _SC_BC_DIM_MAX + _SC_BC_SCALE_MAX, +#define _SC_BC_SCALE_MAX _SC_BC_SCALE_MAX + _SC_BC_STRING_MAX, +#define _SC_BC_STRING_MAX _SC_BC_STRING_MAX + _SC_COLL_WEIGHTS_MAX, +#define _SC_COLL_WEIGHTS_MAX _SC_COLL_WEIGHTS_MAX + _SC_EQUIV_CLASS_MAX, +#define _SC_EQUIV_CLASS_MAX _SC_EQUIV_CLASS_MAX + _SC_EXPR_NEST_MAX, +#define _SC_EXPR_NEST_MAX _SC_EXPR_NEST_MAX + _SC_LINE_MAX, +#define _SC_LINE_MAX _SC_LINE_MAX + _SC_RE_DUP_MAX, +#define _SC_RE_DUP_MAX _SC_RE_DUP_MAX + _SC_CHARCLASS_NAME_MAX, +#define _SC_CHARCLASS_NAME_MAX _SC_CHARCLASS_NAME_MAX + + _SC_2_VERSION, +#define _SC_2_VERSION _SC_2_VERSION + _SC_2_C_BIND, +#define _SC_2_C_BIND _SC_2_C_BIND + _SC_2_C_DEV, +#define _SC_2_C_DEV _SC_2_C_DEV + _SC_2_FORT_DEV, +#define _SC_2_FORT_DEV _SC_2_FORT_DEV + _SC_2_FORT_RUN, +#define _SC_2_FORT_RUN _SC_2_FORT_RUN + _SC_2_SW_DEV, +#define _SC_2_SW_DEV _SC_2_SW_DEV + _SC_2_LOCALEDEF, +#define _SC_2_LOCALEDEF _SC_2_LOCALEDEF + + _SC_PII, +#define _SC_PII _SC_PII + _SC_PII_XTI, +#define _SC_PII_XTI _SC_PII_XTI + _SC_PII_SOCKET, +#define _SC_PII_SOCKET _SC_PII_SOCKET + _SC_PII_INTERNET, +#define _SC_PII_INTERNET _SC_PII_INTERNET + _SC_PII_OSI, +#define _SC_PII_OSI _SC_PII_OSI + _SC_POLL, +#define _SC_POLL _SC_POLL + _SC_SELECT, +#define _SC_SELECT _SC_SELECT + _SC_UIO_MAXIOV, +#define _SC_UIO_MAXIOV _SC_UIO_MAXIOV + _SC_IOV_MAX = _SC_UIO_MAXIOV, +#define _SC_IOV_MAX _SC_IOV_MAX + _SC_PII_INTERNET_STREAM, +#define _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_STREAM + _SC_PII_INTERNET_DGRAM, +#define _SC_PII_INTERNET_DGRAM _SC_PII_INTERNET_DGRAM + _SC_PII_OSI_COTS, +#define _SC_PII_OSI_COTS _SC_PII_OSI_COTS + _SC_PII_OSI_CLTS, +#define _SC_PII_OSI_CLTS _SC_PII_OSI_CLTS + _SC_PII_OSI_M, +#define _SC_PII_OSI_M _SC_PII_OSI_M + _SC_T_IOV_MAX, +#define _SC_T_IOV_MAX _SC_T_IOV_MAX + + /* Values according to POSIX 1003.1c (POSIX threads). */ + _SC_THREADS, +#define _SC_THREADS _SC_THREADS + _SC_THREAD_SAFE_FUNCTIONS, +#define _SC_THREAD_SAFE_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS + _SC_GETGR_R_SIZE_MAX, +#define _SC_GETGR_R_SIZE_MAX _SC_GETGR_R_SIZE_MAX + _SC_GETPW_R_SIZE_MAX, +#define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX + _SC_LOGIN_NAME_MAX, +#define _SC_LOGIN_NAME_MAX _SC_LOGIN_NAME_MAX + _SC_TTY_NAME_MAX, +#define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX + _SC_THREAD_DESTRUCTOR_ITERATIONS, +#define _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS + _SC_THREAD_KEYS_MAX, +#define _SC_THREAD_KEYS_MAX _SC_THREAD_KEYS_MAX + _SC_THREAD_STACK_MIN, +#define _SC_THREAD_STACK_MIN _SC_THREAD_STACK_MIN + _SC_THREAD_THREADS_MAX, +#define _SC_THREAD_THREADS_MAX _SC_THREAD_THREADS_MAX + _SC_THREAD_ATTR_STACKADDR, +#define _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKADDR + _SC_THREAD_ATTR_STACKSIZE, +#define _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_ATTR_STACKSIZE + _SC_THREAD_PRIORITY_SCHEDULING, +#define _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIORITY_SCHEDULING + _SC_THREAD_PRIO_INHERIT, +#define _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_INHERIT + _SC_THREAD_PRIO_PROTECT, +#define _SC_THREAD_PRIO_PROTECT _SC_THREAD_PRIO_PROTECT + _SC_THREAD_PROCESS_SHARED, +#define _SC_THREAD_PROCESS_SHARED _SC_THREAD_PROCESS_SHARED + + _SC_NPROCESSORS_CONF, +#define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF + _SC_NPROCESSORS_ONLN, +#define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN + _SC_PHYS_PAGES, +#define _SC_PHYS_PAGES _SC_PHYS_PAGES + _SC_AVPHYS_PAGES, +#define _SC_AVPHYS_PAGES _SC_AVPHYS_PAGES + _SC_ATEXIT_MAX, +#define _SC_ATEXIT_MAX _SC_ATEXIT_MAX + _SC_PASS_MAX, +#define _SC_PASS_MAX _SC_PASS_MAX + + _SC_XOPEN_VERSION, +#define _SC_XOPEN_VERSION _SC_XOPEN_VERSION + _SC_XOPEN_XCU_VERSION, +#define _SC_XOPEN_XCU_VERSION _SC_XOPEN_XCU_VERSION + _SC_XOPEN_UNIX, +#define _SC_XOPEN_UNIX _SC_XOPEN_UNIX + _SC_XOPEN_CRYPT, +#define _SC_XOPEN_CRYPT _SC_XOPEN_CRYPT + _SC_XOPEN_ENH_I18N, +#define _SC_XOPEN_ENH_I18N _SC_XOPEN_ENH_I18N + _SC_XOPEN_SHM, +#define _SC_XOPEN_SHM _SC_XOPEN_SHM + + _SC_2_CHAR_TERM, +#define _SC_2_CHAR_TERM _SC_2_CHAR_TERM + _SC_2_C_VERSION, +#define _SC_2_C_VERSION _SC_2_C_VERSION + _SC_2_UPE, +#define _SC_2_UPE _SC_2_UPE + + _SC_XOPEN_XPG2, +#define _SC_XOPEN_XPG2 _SC_XOPEN_XPG2 + _SC_XOPEN_XPG3, +#define _SC_XOPEN_XPG3 _SC_XOPEN_XPG3 + _SC_XOPEN_XPG4, +#define _SC_XOPEN_XPG4 _SC_XOPEN_XPG4 + + _SC_CHAR_BIT, +#define _SC_CHAR_BIT _SC_CHAR_BIT + _SC_CHAR_MAX, +#define _SC_CHAR_MAX _SC_CHAR_MAX + _SC_CHAR_MIN, +#define _SC_CHAR_MIN _SC_CHAR_MIN + _SC_INT_MAX, +#define _SC_INT_MAX _SC_INT_MAX + _SC_INT_MIN, +#define _SC_INT_MIN _SC_INT_MIN + _SC_LONG_BIT, +#define _SC_LONG_BIT _SC_LONG_BIT + _SC_WORD_BIT, +#define _SC_WORD_BIT _SC_WORD_BIT + _SC_MB_LEN_MAX, +#define _SC_MB_LEN_MAX _SC_MB_LEN_MAX + _SC_NZERO, +#define _SC_NZERO _SC_NZERO + _SC_SSIZE_MAX, +#define _SC_SSIZE_MAX _SC_SSIZE_MAX + _SC_SCHAR_MAX, +#define _SC_SCHAR_MAX _SC_SCHAR_MAX + _SC_SCHAR_MIN, +#define _SC_SCHAR_MIN _SC_SCHAR_MIN + _SC_SHRT_MAX, +#define _SC_SHRT_MAX _SC_SHRT_MAX + _SC_SHRT_MIN, +#define _SC_SHRT_MIN _SC_SHRT_MIN + _SC_UCHAR_MAX, +#define _SC_UCHAR_MAX _SC_UCHAR_MAX + _SC_UINT_MAX, +#define _SC_UINT_MAX _SC_UINT_MAX + _SC_ULONG_MAX, +#define _SC_ULONG_MAX _SC_ULONG_MAX + _SC_USHRT_MAX, +#define _SC_USHRT_MAX _SC_USHRT_MAX + + _SC_NL_ARGMAX, +#define _SC_NL_ARGMAX _SC_NL_ARGMAX + _SC_NL_LANGMAX, +#define _SC_NL_LANGMAX _SC_NL_LANGMAX + _SC_NL_MSGMAX, +#define _SC_NL_MSGMAX _SC_NL_MSGMAX + _SC_NL_NMAX, +#define _SC_NL_NMAX _SC_NL_NMAX + _SC_NL_SETMAX, +#define _SC_NL_SETMAX _SC_NL_SETMAX + _SC_NL_TEXTMAX, +#define _SC_NL_TEXTMAX _SC_NL_TEXTMAX + + _SC_XBS5_ILP32_OFF32, +#define _SC_XBS5_ILP32_OFF32 _SC_XBS5_ILP32_OFF32 + _SC_XBS5_ILP32_OFFBIG, +#define _SC_XBS5_ILP32_OFFBIG _SC_XBS5_ILP32_OFFBIG + _SC_XBS5_LP64_OFF64, +#define _SC_XBS5_LP64_OFF64 _SC_XBS5_LP64_OFF64 + _SC_XBS5_LPBIG_OFFBIG, +#define _SC_XBS5_LPBIG_OFFBIG _SC_XBS5_LPBIG_OFFBIG + + _SC_XOPEN_LEGACY, +#define _SC_XOPEN_LEGACY _SC_XOPEN_LEGACY + _SC_XOPEN_REALTIME, +#define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME + _SC_XOPEN_REALTIME_THREADS, +#define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS + + _SC_ADVISORY_INFO, +#define _SC_ADVISORY_INFO _SC_ADVISORY_INFO + _SC_BARRIERS, +#define _SC_BARRIERS _SC_BARRIERS + _SC_BASE, +#define _SC_BASE _SC_BASE + _SC_C_LANG_SUPPORT, +#define _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT + _SC_C_LANG_SUPPORT_R, +#define _SC_C_LANG_SUPPORT_R _SC_C_LANG_SUPPORT_R + _SC_CLOCK_SELECTION, +#define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION + _SC_CPUTIME, +#define _SC_CPUTIME _SC_CPUTIME + _SC_THREAD_CPUTIME, +#define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME + _SC_DEVICE_IO, +#define _SC_DEVICE_IO _SC_DEVICE_IO + _SC_DEVICE_SPECIFIC, +#define _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC + _SC_DEVICE_SPECIFIC_R, +#define _SC_DEVICE_SPECIFIC_R _SC_DEVICE_SPECIFIC_R + _SC_FD_MGMT, +#define _SC_FD_MGMT _SC_FD_MGMT + _SC_FIFO, +#define _SC_FIFO _SC_FIFO + _SC_PIPE, +#define _SC_PIPE _SC_PIPE + _SC_FILE_ATTRIBUTES, +#define _SC_FILE_ATTRIBUTES _SC_FILE_ATTRIBUTES + _SC_FILE_LOCKING, +#define _SC_FILE_LOCKING _SC_FILE_LOCKING + _SC_FILE_SYSTEM, +#define _SC_FILE_SYSTEM _SC_FILE_SYSTEM + _SC_MONOTONIC_CLOCK, +#define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK + _SC_MULTI_PROCESS, +#define _SC_MULTI_PROCESS _SC_MULTI_PROCESS + _SC_SINGLE_PROCESS, +#define _SC_SINGLE_PROCESS _SC_SINGLE_PROCESS + _SC_NETWORKING, +#define _SC_NETWORKING _SC_NETWORKING + _SC_READER_WRITER_LOCKS, +#define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS + _SC_SPIN_LOCKS, +#define _SC_SPIN_LOCKS _SC_SPIN_LOCKS + _SC_REGEXP, +#define _SC_REGEXP _SC_REGEXP + _SC_REGEX_VERSION, +#define _SC_REGEX_VERSION _SC_REGEX_VERSION + _SC_SHELL, +#define _SC_SHELL _SC_SHELL + _SC_SIGNALS, +#define _SC_SIGNALS _SC_SIGNALS + _SC_SPAWN, +#define _SC_SPAWN _SC_SPAWN + _SC_SPORADIC_SERVER, +#define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER + _SC_THREAD_SPORADIC_SERVER, +#define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER + _SC_SYSTEM_DATABASE, +#define _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE + _SC_SYSTEM_DATABASE_R, +#define _SC_SYSTEM_DATABASE_R _SC_SYSTEM_DATABASE_R + _SC_TIMEOUTS, +#define _SC_TIMEOUTS _SC_TIMEOUTS + _SC_TYPED_MEMORY_OBJECTS, +#define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS + _SC_USER_GROUPS, +#define _SC_USER_GROUPS _SC_USER_GROUPS + _SC_USER_GROUPS_R, +#define _SC_USER_GROUPS_R _SC_USER_GROUPS_R + _SC_2_PBS, +#define _SC_2_PBS _SC_2_PBS + _SC_2_PBS_ACCOUNTING, +#define _SC_2_PBS_ACCOUNTING _SC_2_PBS_ACCOUNTING + _SC_2_PBS_LOCATE, +#define _SC_2_PBS_LOCATE _SC_2_PBS_LOCATE + _SC_2_PBS_MESSAGE, +#define _SC_2_PBS_MESSAGE _SC_2_PBS_MESSAGE + _SC_2_PBS_TRACK, +#define _SC_2_PBS_TRACK _SC_2_PBS_TRACK + _SC_SYMLOOP_MAX, +#define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX + _SC_STREAMS, +#define _SC_STREAMS _SC_STREAMS + _SC_2_PBS_CHECKPOINT, +#define _SC_2_PBS_CHECKPOINT _SC_2_PBS_CHECKPOINT + + _SC_V6_ILP32_OFF32, +#define _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFF32 + _SC_V6_ILP32_OFFBIG, +#define _SC_V6_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG + _SC_V6_LP64_OFF64, +#define _SC_V6_LP64_OFF64 _SC_V6_LP64_OFF64 + _SC_V6_LPBIG_OFFBIG, +#define _SC_V6_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG + + _SC_HOST_NAME_MAX, +#define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX + _SC_TRACE, +#define _SC_TRACE _SC_TRACE + _SC_TRACE_EVENT_FILTER, +#define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER + _SC_TRACE_INHERIT, +#define _SC_TRACE_INHERIT _SC_TRACE_INHERIT + _SC_TRACE_LOG, +#define _SC_TRACE_LOG _SC_TRACE_LOG + + _SC_LEVEL1_ICACHE_SIZE, +#define _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_SIZE + _SC_LEVEL1_ICACHE_ASSOC, +#define _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_ASSOC + _SC_LEVEL1_ICACHE_LINESIZE, +#define _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_ICACHE_LINESIZE + _SC_LEVEL1_DCACHE_SIZE, +#define _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_SIZE + _SC_LEVEL1_DCACHE_ASSOC, +#define _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_ASSOC + _SC_LEVEL1_DCACHE_LINESIZE, +#define _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL1_DCACHE_LINESIZE + _SC_LEVEL2_CACHE_SIZE, +#define _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_SIZE + _SC_LEVEL2_CACHE_ASSOC, +#define _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_ASSOC + _SC_LEVEL2_CACHE_LINESIZE, +#define _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL2_CACHE_LINESIZE + _SC_LEVEL3_CACHE_SIZE, +#define _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_SIZE + _SC_LEVEL3_CACHE_ASSOC, +#define _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_ASSOC + _SC_LEVEL3_CACHE_LINESIZE, +#define _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL3_CACHE_LINESIZE + _SC_LEVEL4_CACHE_SIZE, +#define _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_SIZE + _SC_LEVEL4_CACHE_ASSOC, +#define _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_ASSOC + _SC_LEVEL4_CACHE_LINESIZE, +#define _SC_LEVEL4_CACHE_LINESIZE _SC_LEVEL4_CACHE_LINESIZE + /* Leave room here, maybe we need a few more cache levels some day. */ + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, +#define _SC_IPV6 _SC_IPV6 + _SC_RAW_SOCKETS +#define _SC_RAW_SOCKETS _SC_RAW_SOCKETS + }; + +#if (defined __USE_POSIX2 || defined __USE_UNIX98 \ + || defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \ + || defined __USE_LARGEFILE) +/* Values for the NAME argument to `confstr'. */ +enum + { + _CS_PATH, /* The default search path. */ +#define _CS_PATH _CS_PATH + + _CS_V6_WIDTH_RESTRICTED_ENVS, +# define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS + +# if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \ + || defined __USE_LARGEFILE) + _CS_LFS_CFLAGS = 1000, +#define _CS_LFS_CFLAGS _CS_LFS_CFLAGS + _CS_LFS_LDFLAGS, +#define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS + _CS_LFS_LIBS, +#define _CS_LFS_LIBS _CS_LFS_LIBS + _CS_LFS_LINTFLAGS, +#define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS + _CS_LFS64_CFLAGS, +#define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS + _CS_LFS64_LDFLAGS, +#define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS + _CS_LFS64_LIBS, +#define _CS_LFS64_LIBS _CS_LFS64_LIBS + _CS_LFS64_LINTFLAGS, +#define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS +# endif + +# ifdef __USE_UNIX98 + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, +#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS + _CS_XBS5_ILP32_OFF32_LDFLAGS, +#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS + _CS_XBS5_ILP32_OFF32_LIBS, +#define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS + _CS_XBS5_ILP32_OFF32_LINTFLAGS, +#define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS + _CS_XBS5_ILP32_OFFBIG_CFLAGS, +#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, +#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS + _CS_XBS5_ILP32_OFFBIG_LIBS, +#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, +#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS + _CS_XBS5_LP64_OFF64_CFLAGS, +#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS + _CS_XBS5_LP64_OFF64_LDFLAGS, +#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS + _CS_XBS5_LP64_OFF64_LIBS, +#define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS + _CS_XBS5_LP64_OFF64_LINTFLAGS, +#define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, +#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, +#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS + _CS_XBS5_LPBIG_OFFBIG_LIBS, +#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, +#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS +# endif +# ifdef __USE_XOPEN2K + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, +#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, +#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS + _CS_POSIX_V6_ILP32_OFF32_LIBS, +#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, +#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, +#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, +#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, +#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, +#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS + _CS_POSIX_V6_LP64_OFF64_CFLAGS, +#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, +#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS + _CS_POSIX_V6_LP64_OFF64_LIBS, +#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, +#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, +#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, +#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, +#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS +#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS +# endif + }; +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/dirent.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/dirent.h new file mode 100644 index 0000000..014e011 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/dirent.h @@ -0,0 +1,61 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DIRENT_H +# error "Never use directly; include instead." +#endif +#include +#include + +struct dirent + { +#if defined(__USE_FILE_OFFSET64) && defined(__NR_getdents64) + __ino64_t d_ino; + __off64_t d_off; +#else + __ino_t d_ino; + __off_t d_off; +#endif + unsigned short int d_reclen; + unsigned char d_type; + char d_name[256]; /* We must not include limits.h! */ + }; + +#ifdef __USE_LARGEFILE64 +struct dirent64 + { +#ifdef __NR_getdents64 + __ino64_t d_ino; + __off64_t d_off; +#else + /* dirent64 is the same as dirent. */ + __ino_t d_ino; + __off_t d_off; +#endif + unsigned short int d_reclen; + unsigned char d_type; + char d_name[256]; /* We must not include limits.h! */ + }; +#endif + +#define d_fileno d_ino /* Backwards compatibility. */ + +#undef _DIRENT_HAVE_D_NAMLEN +#define _DIRENT_HAVE_D_RECLEN +#define _DIRENT_HAVE_D_OFF +#define _DIRENT_HAVE_D_TYPE diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/dlfcn.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/dlfcn.h new file mode 100644 index 0000000..1f054f9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/dlfcn.h @@ -0,0 +1,66 @@ +/* System dependent definitions for run-time dynamic loading. + Copyright (C) 1996, 1997, 1999, 2000, 2001, 2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DLFCN_H +# error "Never use directly; include instead." +#endif + +/* The MODE argument to `dlopen' contains one of the following: */ +#define RTLD_LAZY 0x0001 /* Lazy function call binding. */ +#define RTLD_NOW 0x0002 /* Immediate function call binding. */ +#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ +#define RTLD_NOLOAD 0x00008 /* Do not load the object. */ +#define RTLD_DEEPBIND 0x00010 /* Use deep binding. */ + +/* If the following bit is set in the MODE argument to `dlopen', + the symbols of the loaded object and its dependencies are made + visible as if the object were linked directly into the program. */ +#define RTLD_GLOBAL 0x0004 + +/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. + The implementation does this by default and so we can define the + value to zero. */ +#define RTLD_LOCAL 0 + +/* Do not delete object when closed. */ +#define RTLD_NODELETE 0x01000 + +#if 0 /*def __USE_GNU*/ +/* To support profiling of shared objects it is a good idea to call + the function found using `dlsym' using the following macro since + these calls do not use the PLT. But this would mean the dynamic + loader has no chance to find out when the function is called. The + macro applies the necessary magic so that profiling is possible. + Rewrite + foo = (*fctp) (arg1, arg2); + into + foo = DL_CALL_FCT (fctp, (arg1, arg2)); +*/ +# define DL_CALL_FCT(fctp, args) \ + (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args) + +__BEGIN_DECLS + +/* This function calls the profiling functions. */ +extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW; + +__END_DECLS + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/elfclass.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/elfclass.h new file mode 100644 index 0000000..180227d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/elfclass.h @@ -0,0 +1,14 @@ +/* This file specifies the native word size of the machine, which indicates + the ELF file class used for executables and shared objects on this + machine. */ + +#ifndef _LINK_H +# error "Never use directly; include instead." +#endif + +#include + +#define __ELF_NATIVE_CLASS __WORDSIZE + +/* The entries in the .hash table always have a size of 32 bits. */ +typedef uint32_t Elf_Symndx; diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/endian.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/endian.h new file mode 100644 index 0000000..0a3d2fa --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/endian.h @@ -0,0 +1,16 @@ +/* The MIPS architecture has selectable endianness. + Linux/MIPS exists in two both little and big endian flavours and we + want to be able to share the installed headerfiles between both, + so we define __BYTE_ORDER based on GCC's predefines. */ + +#ifndef _ENDIAN_H +# error "Never use directly; include instead." +#endif + +#ifdef __MIPSEB__ +# define __BYTE_ORDER __BIG_ENDIAN +#else +# ifdef __MIPSEL__ +# define __BYTE_ORDER __LITTLE_ENDIAN +# endif +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/environments.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/environments.h new file mode 100644 index 0000000..4617dc4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/environments.h @@ -0,0 +1,78 @@ +/* Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UNISTD_H +# error "Never include this file directly. Use instead" +#endif + +#include + +/* This header should define the following symbols under the described + situations. A value `1' means that the model is always supported, + `-1' means it is never supported. Undefined means it cannot be + statically decided. + + _POSIX_V6_ILP32_OFF32 32bit int, long, pointers, and off_t type + _POSIX_V6_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type + + _POSIX_V6_LP64_OFF32 64bit long and pointers and 32bit off_t type + _POSIX_V6_LPBIG_OFFBIG 64bit long and pointers and large off_t type + + The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and + _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard + and are available only for compatibility. +*/ + +#if __WORDSIZE == 64 + +/* We can never provide environments with 32-bit wide pointers. */ +# define _POSIX_V6_ILP32_OFF32 -1 +# define _POSIX_V6_ILP32_OFFBIG -1 +# define _XBS5_ILP32_OFF32 -1 +# define _XBS5_ILP32_OFFBIG -1 +/* We also have no use (for now) for an environment with bigger pointers + and offsets. */ +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* By default we have 64-bit wide `long int', pointers and `off_t'. */ +# define _POSIX_V6_LP64_OFF64 1 +# define _XBS5_LP64_OFF64 1 + +#else /* __WORDSIZE == 32 */ + +/* By default we have 32-bit wide `int', `long int', pointers and `off_t' + and all platforms support LFS. */ +# define _POSIX_V6_ILP32_OFF32 1 +# define _POSIX_V6_ILP32_OFFBIG 1 +# define _XBS5_ILP32_OFF32 1 +# define _XBS5_ILP32_OFFBIG 1 + +/* We optionally provide an environment with the above size but an 64-bit + side `off_t'. Therefore we don't define _XBS5_ILP32_OFFBIG. */ + +/* We can never provide environments with 64-bit wide pointers. */ +# define _POSIX_V6_LP64_OFF64 -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LP64_OFF64 -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* CFLAGS. */ +#define __ILP32_OFFBIG_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + +#endif /* __WORDSIZE == 32 */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/errno.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/errno.h new file mode 100644 index 0000000..78e8c69 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/errno.h @@ -0,0 +1,59 @@ +/* Error constants. Linux specific version. + Copyright (C) 1996, 1997, 1998, 1999, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef _ERRNO_H + +# undef EDOM +# undef EILSEQ +# undef ERANGE +# include + +/* Linux has no ENOTSUP error code. */ +# define ENOTSUP EOPNOTSUPP + +/* Older Linux versions also had no ECANCELED error code. */ +# ifndef ECANCELED +# define ECANCELED 125 +# endif + +/* Support for error codes to support robust mutexes was added later, too. */ +# ifndef EOWNERDEAD +# define EOWNERDEAD 130 +# define ENOTRECOVERABLE 131 +# endif + +# ifndef __ASSEMBLER__ +/* Function to get address of global `errno' variable. */ +extern int *__errno_location (void) __THROW __attribute__ ((__const__)); + +# ifdef __UCLIBC_HAS_THREADS__ +/* When using threads, errno is a per-thread value. */ +# define errno (*__errno_location ()) +# endif +# endif /* !__ASSEMBLER__ */ +#endif /* _ERRNO_H */ + +#if !defined _ERRNO_H && defined __need_Emath +/* This is ugly but the kernel header is not clean enough. We must + define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is + defined. */ +# define EDOM 33 /* Math argument out of domain of function. */ +# define EILSEQ 84 /* Illegal byte sequence. */ +# define ERANGE 34 /* Math result not representable. */ +#endif /* !_ERRNO_H && __need_Emath */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/errno_values.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/errno_values.h new file mode 100644 index 0000000..4d6efdf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/errno_values.h @@ -0,0 +1,135 @@ +#ifndef _BITS_ERRNO_VALUES_H +#define _BITS_ERRNO_VALUES_H + +/* These error numbers are intended to be MIPS ABI compatible */ + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Resource deadlock would occur */ +#define ENOLCK 46 /* No record locks available */ +#define EBADE 50 /* Invalid exchange */ +#define EBADR 51 /* Invalid request descriptor */ +#define EXFULL 52 /* Exchange full */ +#define ENOANO 53 /* No anode */ +#define EBADRQC 54 /* Invalid request code */ +#define EBADSLT 55 /* Invalid slot */ +#define EDEADLOCK 56 /* File locking deadlock error */ +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EDOTDOT 73 /* RFS specific error */ +#define EMULTIHOP 74 /* Multihop attempted */ +#define EBADMSG 77 /* Not a data message */ +#define ENAMETOOLONG 78 /* File name too long */ +#define EOVERFLOW 79 /* Value too large for defined data type */ +#define ENOTUNIQ 80 /* Name not unique on network */ +#define EBADFD 81 /* File descriptor in bad state */ +#define EREMCHG 82 /* Remote address changed */ +#define ELIBACC 83 /* Can not access a needed shared library */ +#define ELIBBAD 84 /* Accessing a corrupted shared library */ +#define ELIBSCN 85 /* .lib section in a.out corrupted */ +#define ELIBMAX 86 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 87 /* Cannot exec a shared library directly */ +#define EILSEQ 88 /* Illegal byte sequence */ +#define ENOSYS 89 /* Function not implemented */ +#define ELOOP 90 /* Too many symbolic links encountered */ +#define ERESTART 91 /* Interrupted system call should be restarted */ +#define ESTRPIPE 92 /* Streams pipe error */ +#define ENOTEMPTY 93 /* Directory not empty */ +#define EUSERS 94 /* Too many users */ +#define ENOTSOCK 95 /* Socket operation on non-socket */ +#define EDESTADDRREQ 96 /* Destination address required */ +#define EMSGSIZE 97 /* Message too long */ +#define EPROTOTYPE 98 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 99 /* Protocol not available */ +#define EPROTONOSUPPORT 120 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 121 /* Socket type not supported */ +#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 123 /* Protocol family not supported */ +#define EAFNOSUPPORT 124 /* Address family not supported by protocol */ +#define EADDRINUSE 125 /* Address already in use */ +#define EADDRNOTAVAIL 126 /* Cannot assign requested address */ +#define ENETDOWN 127 /* Network is down */ +#define ENETUNREACH 128 /* Network is unreachable */ +#define ENETRESET 129 /* Network dropped connection because of reset */ +#define ECONNABORTED 130 /* Software caused connection abort */ +#define ECONNRESET 131 /* Connection reset by peer */ +#define ENOBUFS 132 /* No buffer space available */ +#define EISCONN 133 /* Transport endpoint is already connected */ +#define ENOTCONN 134 /* Transport endpoint is not connected */ +#define EUCLEAN 135 /* Structure needs cleaning */ +#define ENOTNAM 137 /* Not a XENIX named type file */ +#define ENAVAIL 138 /* No XENIX semaphores available */ +#define EISNAM 139 /* Is a named type file */ +#define EREMOTEIO 140 /* Remote I/O error */ +#define EINIT 141 /* Reserved */ +#define EREMDEV 142 /* Error 142 */ +#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 144 /* Too many references: cannot splice */ +#define ETIMEDOUT 145 /* Connection timed out */ +#define ECONNREFUSED 146 /* Connection refused */ +#define EHOSTDOWN 147 /* Host is down */ +#define EHOSTUNREACH 148 /* No route to host */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EALREADY 149 /* Operation already in progress */ +#define EINPROGRESS 150 /* Operation now in progress */ +#define ESTALE 151 /* Stale NFS file handle */ +#define ECANCELED 158 /* AIO operation canceled */ +/* These errors are Linux extensions. */ +#define ENOMEDIUM 159 /* No medium found */ +#define EMEDIUMTYPE 160 /* Wrong medium type */ +#define EDQUOT 1133 /* Quota exceeded */ + +#endif /* _BITS_ERRNO_VALUES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fcntl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fcntl.h new file mode 100644 index 0000000..08c8686 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fcntl.h @@ -0,0 +1,261 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + +#include +#include +#ifdef __USE_GNU +# include +#endif + + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_APPEND 0x0008 +#define O_SYNC 0x0010 +#define O_NONBLOCK 0x0080 +#define O_NDELAY O_NONBLOCK +#define O_CREAT 0x0100 /* not fcntl */ +#define O_TRUNC 0x0200 /* not fcntl */ +#define O_EXCL 0x0400 /* not fcntl */ +#define O_NOCTTY 0x0800 /* not fcntl */ +#define O_FSYNC O_SYNC +#define O_ASYNC 0x1000 + +#ifdef __USE_GNU +# define O_NOFOLLOW 0x20000 /* Do not follow links. */ +# define O_DIRECT 0x8000 /* Direct disk access hint. */ +# define O_DIRECTORY 0x10000 /* Must be a directory. */ +# define O_NOATIME 0x40000 /* Do not set atime. */ +#endif + +/* For now Linux has no synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +#ifdef __USE_LARGEFILE64 +# if __WORDSIZE == 64 +# define O_LARGEFILE 0 +# else +# define O_LARGEFILE 0x2000 /* Allow large file opens. */ +# endif +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifndef __USE_FILE_OFFSET64 +# define F_GETLK 14 /* Get record locking info. */ +# define F_SETLK 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK F_GETLK64 /* Get record locking info. */ +# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ +# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ +#endif + +#if __WORDSIZE == 64 +# define F_GETLK64 14 /* Get record locking info. */ +# define F_SETLK64 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW64 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK64 33 /* Get record locking info. */ +# define F_SETLK64 34 /* Set record locking info (non-blocking). */ +# define F_SETLKW64 35 /* Set record locking info (blocking). */ +#endif + +#if defined __USE_BSD || defined __USE_UNIX98 +# define F_SETOWN 24 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 23 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# define F_SETLEASE 1024 /* Set a lease. */ +# define F_GETLEASE 1025 /* Enquire what lease is active. */ +# define F_NOTIFY 1026 /* Request notfications on a directory. */ +#endif + +/* For F_[GET|SET]FL. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 0 /* Read lock. */ +#define F_WRLCK 1 /* Write lock. */ +#define F_UNLCK 2 /* Remove lock. */ + +/* For old implementation of bsd flock(). */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* Operations for bsd flock(), also used by the kernel implementation. */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#if _MIPS_SIM != _ABI64 + /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit + fcntls in o32 and n32, never has this field. */ + long int l_sysid; +#endif +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ +#if ! defined __USE_FILE_OFFSET64 && _MIPS_SIM != _ABI64 + /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit + flock in o32 and n32, never has this field. */ + long int pad[4]; +#endif + }; +typedef struct flock flock_t; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif + + +#ifdef __USE_GNU +/* Flags for SYNC_FILE_RANGE. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ + +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ +#endif + +__BEGIN_DECLS + +#ifdef __USE_GNU + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +#if 0 +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, + unsigned int __flags); + +/* Splice two files together. */ +extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; + +/* In-kernel implementation of tee for pipe buffers. */ +extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) + __THROW; +#endif + +#endif + +__END_DECLS diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fenv.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fenv.h new file mode 100644 index 0000000..24e0694 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fenv.h @@ -0,0 +1,77 @@ +/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FENV_H +# error "Never use directly; include instead." +#endif + + +/* Define bits representing the exception. We use the bit positions + of the appropriate bits in the FPU control word. */ +enum + { + FE_INEXACT = 0x04, +#define FE_INEXACT FE_INEXACT + FE_UNDERFLOW = 0x08, +#define FE_UNDERFLOW FE_UNDERFLOW + FE_OVERFLOW = 0x10, +#define FE_OVERFLOW FE_OVERFLOW + FE_DIVBYZERO = 0x20, +#define FE_DIVBYZERO FE_DIVBYZERO + FE_INVALID = 0x40, +#define FE_INVALID FE_INVALID + }; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* The MIPS FPU supports all of the four defined rounding modes. We + use again the bit positions in the FPU control word as the values + for the appropriate macros. */ +enum + { + FE_TONEAREST = 0x0, +#define FE_TONEAREST FE_TONEAREST + FE_TOWARDZERO = 0x1, +#define FE_TOWARDZERO FE_TOWARDZERO + FE_UPWARD = 0x2, +#define FE_UPWARD FE_UPWARD + FE_DOWNWARD = 0x3 +#define FE_DOWNWARD FE_DOWNWARD + }; + + +/* Type representing exception flags. */ +typedef unsigned short int fexcept_t; + + +/* Type representing floating-point environment. This function corresponds + to the layout of the block written by the `fstenv'. */ +typedef struct + { + unsigned int __fp_control_register; + } +fenv_t; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((__const fenv_t *) -1) + +#ifdef __USE_GNU +/* Floating-point environment where none of the exception is masked. */ +# define FE_NOMASK_ENV ((__const fenv_t *) -2) +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fenvinline.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fenvinline.h new file mode 100644 index 0000000..42f77b5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/fenvinline.h @@ -0,0 +1,8 @@ +/* This file provides inline versions of floating-pint environment + handling functions. If there were any. */ + +#ifndef __NO_MATH_INLINES + +/* Here is where the code would go. */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/getopt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/getopt.h new file mode 100644 index 0000000..a28d0a4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/getopt.h @@ -0,0 +1,181 @@ +/* Declarations for getopt. + Copyright (C) 1989-1994,1996-1999,2001,2003,2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _GETOPT_H + +#include + +#ifndef __need_getopt +# define _GETOPT_H 1 +#endif + +/* If __GNU_LIBRARY__ is not already defined, either we are being used + standalone, or this is the first header included in the source file. + If we are being used with glibc, we need to include , but + that does not exist if we are standalone. So: if __GNU_LIBRARY__ is + not defined, include , which will pull in for us + if it's from glibc. (Why ctype.h? It's guaranteed to exist and it + doesn't flood the namespace with stuff the way some other headers do.) */ +#if !defined __GNU_LIBRARY__ +# include +#endif + +#ifndef __THROW +# ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) (0) +# endif +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +#ifndef __need_getopt +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ + const char *name; + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +# define no_argument 0 +# define required_argument 1 +# define optional_argument 2 +#endif /* need getopt */ + + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, `optopt' is set to the option letter, and '?' is + returned. + + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in `optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU `getopt'. + + The argument `--' causes premature termination of argument + scanning, explicitly telling `getopt' that there are no more + options. + + If OPTS begins with `--', then non-option arguments are treated as + arguments to the option '\0'. This behavior is specific to the GNU + `getopt'. */ + +#if defined __GNU_LIBRARY__ || defined __UCLIBC__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __THROW; +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ + +#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__ +#ifndef __need_getopt +extern int getopt_long (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW; +extern int getopt_long_only (int ___argc, char *const *___argv, + const char *__shortopts, + const struct option *__longopts, int *__longind) + __THROW; + +#endif +#endif + +#ifdef __cplusplus +} +#endif + +/* Make sure we later can get all the definitions and declarations. */ +#undef __need_getopt + +#endif /* getopt.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_val.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_val.h new file mode 100644 index 0000000..11ca11f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_val.h @@ -0,0 +1,55 @@ +/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity). + Used by and functions for overflow. + Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ + +#if __GNUC_PREREQ(3,3) +# define HUGE_VAL (__builtin_huge_val()) +#elif __GNUC_PREREQ(2,96) +# define HUGE_VAL (__extension__ 0x1.0p2047) +#elif defined __GNUC__ + +# define HUGE_VAL \ + (__extension__ \ + ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ + { __l: 0x7ff0000000000000ULL }).__d) + +#else /* not GCC */ + +# include + +typedef union { unsigned char __c[8]; double __d; } __huge_val_t; + +# if __BYTE_ORDER == __BIG_ENDIAN +# define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } +# endif +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } +# endif + +static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; +# define HUGE_VAL (__huge_val.__d) + +#endif /* GCC. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_valf.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_valf.h new file mode 100644 index 0000000..1785342 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_valf.h @@ -0,0 +1,53 @@ +/* `HUGE_VALF' constant for IEEE 754 machines (where it is infinity). + Used by and functions for overflow. + Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ + +#if __GNUC_PREREQ(3,3) +# define HUGE_VALF (__builtin_huge_valf()) +#elif __GNUC_PREREQ(2,96) +# define HUGE_VALF (__extension__ 0x1.0p255f) +#elif defined __GNUC__ + +# define HUGE_VALF \ + (__extension__ \ + ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ + { __l: 0x7f800000UL }).__d) + +#else /* not GCC */ + +typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; + +# if __BYTE_ORDER == __BIG_ENDIAN +# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } +# endif +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } +# endif + +static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; +# define HUGE_VALF (__huge_valf.__f) + +#endif /* GCC. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_vall.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_vall.h new file mode 100644 index 0000000..d5e8e22 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/huge_vall.h @@ -0,0 +1,29 @@ +/* Default `HUGE_VALL' constant. + Used by and functions for overflow. + Copyright (C) 1992, 1996, 1997, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#if __GNUC_PREREQ(3,3) +# define HUGE_VALL (__builtin_huge_vall()) +#else +# define HUGE_VALL ((long double) HUGE_VAL) +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/in.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/in.h new file mode 100644 index 0000000..6880a2e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/in.h @@ -0,0 +1,170 @@ +/* Copyright (C) 1991-1999, 2000, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Linux version. */ + +#ifndef _NETINET_IN_H +# error "Never use directly; include instead." +#endif + +/* Options for use with `getsockopt' and `setsockopt' at the IP level. + The first word in the comment at the right is the data type used; + "bool" means a boolean value stored in an `int'. */ +#define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */ +#define IP_HDRINCL 3 /* int; Header is included with data. */ +#define IP_TOS 1 /* int; IP type of service and precedence. */ +#define IP_TTL 2 /* int; IP time to live. */ +#define IP_RECVOPTS 6 /* bool; Receive all IP options w/datagram. */ +/* For BSD compatibility. */ +#define IP_RECVRETOPTS IP_RETOPTS /* bool; Receive IP options for response. */ +#define IP_RETOPTS 7 /* ip_opts; Set/get IP per-packet options. */ +#define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */ +#define IP_UNBLOCK_SOURCE 37 /* ip_mreq_source: unblock data from source */ +#define IP_BLOCK_SOURCE 38 /* ip_mreq_source: block data from source */ +#define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */ +#define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */ +#define IP_MSFILTER 41 +#define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */ +#define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */ +#define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/ +#define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */ +#define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */ +#define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/ +#define MCAST_MSFILTER 48 + +#define MCAST_EXCLUDE 0 +#define MCAST_INCLUDE 1 + +#define IP_ROUTER_ALERT 5 /* bool */ +#define IP_PKTINFO 8 /* bool */ +#define IP_PKTOPTIONS 9 +#define IP_PMTUDISC 10 /* obsolete name? */ +#define IP_MTU_DISCOVER 10 /* int; see below */ +#define IP_RECVERR 11 /* bool */ +#define IP_RECVTTL 12 /* bool */ +#define IP_RECVTOS 13 /* bool */ + + +/* IP_MTU_DISCOVER arguments. */ +#define IP_PMTUDISC_DONT 0 /* Never send DF frames. */ +#define IP_PMTUDISC_WANT 1 /* Use per route hints. */ +#define IP_PMTUDISC_DO 2 /* Always DF. */ + +/* To select the IP level. */ +#define SOL_IP 0 + +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +/* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. + The `ip_dst' field is used for the first-hop gateway when using a + source route (this gets put into the header proper). */ +struct ip_opts + { + struct in_addr ip_dst; /* First hop; zero without source route. */ + char ip_opts[40]; /* Actually variable in size. */ + }; + +/* Like `struct ip_mreq' but including interface specification by index. */ +struct ip_mreqn + { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_address; /* local IP address of interface */ + int imr_ifindex; /* Interface index */ + }; + +/* Structure used for IP_PKTINFO. */ +struct in_pktinfo + { + int ipi_ifindex; /* Interface index */ + struct in_addr ipi_spec_dst; /* Routing destination address */ + struct in_addr ipi_addr; /* Header destination address */ + }; + +/* Options for use with `getsockopt' and `setsockopt' at the IPv6 level. + The first word in the comment at the right is the data type used; + "bool" means a boolean value stored in an `int'. */ +#define IPV6_ADDRFORM 1 +#define IPV6_2292PKTINFO 2 +#define IPV6_2292HOPOPTS 3 +#define IPV6_2292DSTOPTS 4 +#define IPV6_2292RTHDR 5 +#define IPV6_2292PKTOPTIONS 6 +#define IPV6_CHECKSUM 7 +#define IPV6_2292HOPLIMIT 8 + +#define SCM_SRCRT IPV6_RXSRCRT + +#define IPV6_NEXTHOP 9 +#define IPV6_AUTHHDR 10 +#define IPV6_UNICAST_HOPS 16 +#define IPV6_MULTICAST_IF 17 +#define IPV6_MULTICAST_HOPS 18 +#define IPV6_MULTICAST_LOOP 19 +#define IPV6_JOIN_GROUP 20 +#define IPV6_LEAVE_GROUP 21 +#define IPV6_ROUTER_ALERT 22 +#define IPV6_MTU_DISCOVER 23 +#define IPV6_MTU 24 +#define IPV6_RECVERR 25 +#define IPV6_V6ONLY 26 +#define IPV6_JOIN_ANYCAST 27 +#define IPV6_LEAVE_ANYCAST 28 +#define IPV6_IPSEC_POLICY 34 +#define IPV6_XFRM_POLICY 35 + +#define IPV6_RECVPKTINFO 49 +#define IPV6_PKTINFO 50 +#define IPV6_RECVHOPLIMIT 51 +#define IPV6_HOPLIMIT 52 +#define IPV6_RECVHOPOPTS 53 +#define IPV6_HOPOPTS 54 +#define IPV6_RTHDRDSTOPTS 55 +#define IPV6_RECVRTHDR 56 +#define IPV6_RTHDR 57 +#define IPV6_RECVDSTOPTS 58 +#define IPV6_DSTOPTS 59 + +#define IPV6_RECVTCLASS 66 +#define IPV6_TCLASS 67 + +/* Obsolete synonyms for the above. */ +#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP +#define IPV6_RXHOPOPTS IPV6_HOPOPTS +#define IPV6_RXDSTOPTS IPV6_DSTOPTS + +/* IPV6_MTU_DISCOVER values. */ +#define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */ +#define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */ +#define IPV6_PMTUDISC_DO 2 /* Always DF. */ + +/* Socket level values for IPv6. */ +#define SOL_IPV6 41 +#define SOL_ICMPV6 58 + +/* Routing header options for IPv6. */ +#define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */ +#define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ + +#define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/inf.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/inf.h new file mode 100644 index 0000000..1619f75 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/inf.h @@ -0,0 +1,30 @@ +/* `INFINITY' constant for IEEE 754 machines. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +/* IEEE positive infinity. */ + +#if __GNUC_PREREQ(3,3) +# define INFINITY (__builtin_inff()) +#else +# define INFINITY HUGE_VALF +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/initspin.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/initspin.h new file mode 100644 index 0000000..a19ec07 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/initspin.h @@ -0,0 +1,28 @@ +/* Generic definitions for spinlock initializers. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Initial value of a spinlock. Most platforms should use zero, + unless they only implement a "test and clear" operation instead of + the usual "test and set". */ +#define __LT_SPINLOCK_INIT 0 + +/* Macros for lock initializers, using the above definition. */ +#define __LOCK_INITIALIZER { 0, __LT_SPINLOCK_INIT } +#define __ALT_LOCK_INITIALIZER { 0, __LT_SPINLOCK_INIT } +#define __ATOMIC_INITIALIZER { 0, __LT_SPINLOCK_INIT } diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ioctl-types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ioctl-types.h new file mode 100644 index 0000000..a8dcf24 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ioctl-types.h @@ -0,0 +1,76 @@ +/* Structure types for pre-termios terminal ioctls. Linux/MIPS version. + Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IOCTL_H +# error "Never use directly; include instead." +#endif + +/* Get definition of constants for use with `ioctl'. */ +#include + +struct winsize + { + unsigned short int ws_row; + unsigned short int ws_col; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; + }; + +#define NCC 8 +struct termio + { + unsigned short int c_iflag; /* input mode flags */ + unsigned short int c_oflag; /* output mode flags */ + unsigned short int c_cflag; /* control mode flags */ + unsigned short int c_lflag; /* local mode flags */ + char c_line; /* line discipline */ + /* Yes, this is really NCCS. */ + unsigned char c_cc[32 /* NCCS */]; /* control characters */ + }; + +/* modem lines */ +#define TIOCM_LE 0x001 /* line enable */ +#define TIOCM_DTR 0x002 /* data terminal ready */ +#define TIOCM_RTS 0x004 /* request to send */ +#define TIOCM_ST 0x010 /* secondary transmit */ +#define TIOCM_SR 0x020 /* secondary receive */ +#define TIOCM_CTS 0x040 /* clear to send */ +#define TIOCM_CAR 0x100 /* carrier detect */ +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RNG 0x200 /* ring */ +#define TIOCM_RI TIOCM_RNG +#define TIOCM_DSR 0x400 /* data set ready */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Mobitex module */ +#define N_R3964 9 /* Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Profibus */ +#define N_IRDA 11 /* Linux IR */ +#define N_SMSBLOCK 12 /* SMS block mode */ +#define N_HDLC 13 /* synchronous HDLC */ +#define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ioctls.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ioctls.h new file mode 100644 index 0000000..11bb4c4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ioctls.h @@ -0,0 +1,109 @@ +/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IOCTL_H +# error "Never use directly; include instead." +#endif + +/* Use the definitions from the kernel header files. */ +#include + +/* Routing table calls. */ +#define SIOCADDRT 0x890B /* add routing table entry */ +#define SIOCDELRT 0x890C /* delete routing table entry */ +#define SIOCRTMSG 0x890D /* call to routing system */ + +/* Socket configuration controls. */ +#define SIOCGIFNAME 0x8910 /* get iface name */ +#define SIOCSIFLINK 0x8911 /* set iface channel */ +#define SIOCGIFCONF 0x8912 /* get iface list */ +#define SIOCGIFFLAGS 0x8913 /* get flags */ +#define SIOCSIFFLAGS 0x8914 /* set flags */ +#define SIOCGIFADDR 0x8915 /* get PA address */ +#define SIOCSIFADDR 0x8916 /* set PA address */ +#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ +#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ +#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ +#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ +#define SIOCGIFNETMASK 0x891b /* get network PA mask */ +#define SIOCSIFNETMASK 0x891c /* set network PA mask */ +#define SIOCGIFMETRIC 0x891d /* get metric */ +#define SIOCSIFMETRIC 0x891e /* set metric */ +#define SIOCGIFMEM 0x891f /* get memory address (BSD) */ +#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ +#define SIOCGIFMTU 0x8921 /* get MTU size */ +#define SIOCSIFMTU 0x8922 /* set MTU size */ +#define SIOCSIFNAME 0x8923 /* set interface name */ +#define SIOCSIFHWADDR 0x8924 /* set hardware address */ +#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 /* Get hardware address */ +#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 /* Multicast address lists */ +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ +#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ +#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 /* delete PA address */ +#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ +#define SIOCGIFCOUNT 0x8938 /* get number of devices */ + +#define SIOCGIFBR 0x8940 /* Bridging support */ +#define SIOCSIFBR 0x8941 /* Set bridging options */ + +#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ +#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ + + +/* ARP cache control calls. */ + /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ +#define SIOCDARP 0x8953 /* delete ARP table entry */ +#define SIOCGARP 0x8954 /* get ARP table entry */ +#define SIOCSARP 0x8955 /* set ARP table entry */ + +/* RARP cache control calls. */ +#define SIOCDRARP 0x8960 /* delete RARP table entry */ +#define SIOCGRARP 0x8961 /* get RARP table entry */ +#define SIOCSRARP 0x8962 /* set RARP table entry */ + +/* Driver configuration calls */ + +#define SIOCGIFMAP 0x8970 /* Get device parameters */ +#define SIOCSIFMAP 0x8971 /* Set device parameters */ + +/* DLCI configuration calls */ + +#define SIOCADDDLCI 0x8980 /* Create new DLCI device */ +#define SIOCDELDLCI 0x8981 /* Delete DLCI device */ + +/* Device private ioctl calls. */ + +/* These 16 ioctls are available to devices via the do_ioctl() device + vector. Each device should include this file and redefine these + names as their own. Because these are device dependent it is a good + idea _NOT_ to issue them to random objects and hope. */ + +#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ + +/* + * These 16 ioctl calls are protocol private + */ + +#define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ipc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ipc.h new file mode 100644 index 0000000..1f629ce --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ipc.h @@ -0,0 +1,55 @@ +/* Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IPC_H +# error "Never use directly; include instead." +#endif + +#include + +/* Mode bits for `msgget', `semget', and `shmget'. */ +#define IPC_CREAT 01000 /* Create key if key does not exist. */ +#define IPC_EXCL 02000 /* Fail if key exists. */ +#define IPC_NOWAIT 04000 /* Return error on wait. */ + +/* Control commands for `msgctl', `semctl', and `shmctl'. */ +#define IPC_RMID 0 /* Remove identifier. */ +#define IPC_SET 1 /* Set `ipc_perm' options. */ +#define IPC_STAT 2 /* Get `ipc_perm' options. */ +#ifdef __USE_GNU +# define IPC_INFO 3 /* See ipcs. */ +#endif + +/* Special key values. */ +#define IPC_PRIVATE ((__key_t) 0) /* Private key. */ + + +/* Data structure used to pass permission information to IPC operations. */ +struct ipc_perm + { + __key_t __key; /* Key. */ + unsigned int uid; /* Owner's user ID. */ + unsigned int gid; /* Owner's group ID. */ + unsigned int cuid; /* Creator's user ID. */ + unsigned int cgid; /* Creator's group ID. */ + unsigned int mode; /* Read/write permission. */ + unsigned short int __seq; /* Sequence number. */ + unsigned short int __pad1; + unsigned long int __unused1; + unsigned long int __unused2; +}; diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/kernel_types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/kernel_types.h new file mode 100644 index 0000000..b7e61bd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/kernel_types.h @@ -0,0 +1,79 @@ +/* Note that we use the exact same include guard #define names + * as asm/posix_types.h. This will avoid gratuitous conflicts + * with the posix_types.h kernel header, and will ensure that + * our private content, and not the kernel header, will win. + * -Erik + */ +#ifndef _ASM_POSIX_TYPES_H +#define _ASM_POSIX_TYPES_H + +# if __WORDSIZE == 64 +typedef unsigned int __kernel_dev_t; +typedef unsigned long __kernel_ino_t; +typedef unsigned int __kernel_mode_t; +typedef unsigned int __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef long int __kernel_ipc_pid_t; +typedef int __kernel_uid_t; +typedef int __kernel_gid_t; +typedef unsigned long __kernel_size_t; +typedef long __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef long __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef int __kernel_uid32_t; +typedef int __kernel_gid32_t; +typedef __kernel_uid_t __kernel_old_uid_t; +typedef __kernel_gid_t __kernel_old_gid_t; +typedef __kernel_dev_t __kernel_old_dev_t; +typedef long long __kernel_loff_t; +#else +typedef unsigned int __kernel_dev_t; +typedef unsigned long __kernel_ino_t; +typedef unsigned int __kernel_mode_t; + +/* Linux 2.4.20 include/asm-mips/posix_types.h has this: +but apparently that is an error?!?!? +*/ +#if 0 +typedef int __kernel_nlink_t; +#else +/* So use this instead */ +typedef unsigned long __kernel_nlink_t; +#endif + +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef long int __kernel_ipc_pid_t; +typedef int __kernel_uid_t; +typedef int __kernel_gid_t; +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef long __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef int __kernel_uid32_t; +typedef int __kernel_gid32_t; +typedef __kernel_uid_t __kernel_old_uid_t; +typedef __kernel_gid_t __kernel_old_gid_t; +typedef __kernel_dev_t __kernel_old_dev_t; +typedef long long __kernel_loff_t; +#endif + + +typedef struct { + long val[2]; +} __kernel_fsid_t; + +#endif /* _ASM_POSIX_TYPES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/local_lim.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/local_lim.h new file mode 100644 index 0000000..023ebf3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/local_lim.h @@ -0,0 +1,87 @@ +/* Minimum guaranteed maximum values for system limits. Linux version. + Copyright (C) 1993-1998,2000,2002,2003,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* The kernel header pollutes the namespace with the NR_OPEN symbol + and defines LINK_MAX although filesystems have different maxima. A + similar thing is true for OPEN_MAX: the limit can be changed at + runtime and therefore the macro must not be defined. Remove this + after including the header if necessary. */ +#ifndef NR_OPEN +# define __undef_NR_OPEN +#endif +#ifndef LINK_MAX +# define __undef_LINK_MAX +#endif +#ifndef OPEN_MAX +# define __undef_OPEN_MAX +#endif + +/* The kernel sources contain a file with all the needed information. */ +#include + +/* Have to remove NR_OPEN? */ +#ifdef __undef_NR_OPEN +# undef NR_OPEN +# undef __undef_NR_OPEN +#endif +/* Have to remove LINK_MAX? */ +#ifdef __undef_LINK_MAX +# undef LINK_MAX +# undef __undef_LINK_MAX +#endif +/* Have to remove OPEN_MAX? */ +#ifdef __undef_OPEN_MAX +# undef OPEN_MAX +# undef __undef_OPEN_MAX +#endif + +/* The number of data keys per process. */ +#define _POSIX_THREAD_KEYS_MAX 128 +/* This is the value this implementation supports. */ +#define PTHREAD_KEYS_MAX 1024 + +/* Controlling the iterations of destructors for thread-specific data. */ +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +/* Number of iterations this implementation does. */ +#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS + +/* The number of threads per process. */ +#define _POSIX_THREAD_THREADS_MAX 64 + +/* Maximum amount by which a process can descrease its asynchronous I/O + priority level. */ +#define AIO_PRIO_DELTA_MAX 20 + +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 16384 + +/* Maximum number of timer expiration overruns. */ +#define DELAYTIMER_MAX 2147483647 + +/* Maximum tty name length. */ +#define TTY_NAME_MAX 32 + +/* Maximum login name length. This is arbitrary. */ +#define LOGIN_NAME_MAX 256 + +/* Maximum host name length. */ +#define HOST_NAME_MAX 64 + +/* Maximum message queue priority level. */ +#define MQ_PRIO_MAX 32768 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/locale.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/locale.h new file mode 100644 index 0000000..5d51783 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/locale.h @@ -0,0 +1,46 @@ +/* Definition of locale category symbol values. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _LOCALE_H && !defined _LANGINFO_H +# error "Never use directly; include instead." +#endif + +#ifndef _BITS_LOCALE_H +#define _BITS_LOCALE_H 1 + +enum +{ + __LC_CTYPE = 0, + __LC_NUMERIC = 1, + __LC_TIME = 2, + __LC_COLLATE = 3, + __LC_MONETARY = 4, + __LC_MESSAGES = 5, + __LC_ALL = 6, +#if 0 + __LC_PAPER = 7, + __LC_NAME = 8, + __LC_ADDRESS = 9, + __LC_TELEPHONE = 10, + __LC_MEASUREMENT = 11, + __LC_IDENTIFICATION = 12 +#endif +}; + +#endif /* bits/locale.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathcalls.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathcalls.h new file mode 100644 index 0000000..c020072 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathcalls.h @@ -0,0 +1,365 @@ +/* Prototype declarations for math functions; helper file for . + Copyright (C) 1996-2002, 2003, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* NOTE: Because of the special way this file is used by , this + file must NOT be protected from multiple inclusion as header files + usually are. + + This file provides prototype declarations for the math functions. + Most functions are declared using the macro: + + __MATHCALL (NAME,[_r], (ARGS...)); + + This means there is a function `NAME' returning `double' and a function + `NAMEf' returning `float'. Each place `_Mdouble_' appears in the + prototype, that is actually `double' in the prototype for `NAME' and + `float' in the prototype for `NAMEf'. Reentrant variant functions are + called `NAME_r' and `NAMEf_r'. + + Functions returning other types like `int' are declared using the macro: + + __MATHDECL (TYPE, NAME,[_r], (ARGS...)); + + This is just like __MATHCALL but for a function returning `TYPE' + instead of `_Mdouble_'. In all of these cases, there is still + both a `NAME' and a `NAMEf' that takes `float' arguments. + + Note that there must be no whitespace before the argument passed for + NAME, to make token pasting work with -traditional. */ + +#ifndef _MATH_H +# error "Never include directly; include instead." +#endif + + +/* Trigonometric functions. */ + +_Mdouble_BEGIN_NAMESPACE +/* Arc cosine of X. */ +__MATHCALL (acos,, (_Mdouble_ __x)); +/* Arc sine of X. */ +__MATHCALL (asin,, (_Mdouble_ __x)); +/* Arc tangent of X. */ +__MATHCALL (atan,, (_Mdouble_ __x)); +/* Arc tangent of Y/X. */ +__MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); + +/* Cosine of X. */ +__MATHCALL (cos,, (_Mdouble_ __x)); +/* Sine of X. */ +__MATHCALL (sin,, (_Mdouble_ __x)); +/* Tangent of X. */ +__MATHCALL (tan,, (_Mdouble_ __x)); + +/* Hyperbolic functions. */ + +/* Hyperbolic cosine of X. */ +__MATHCALL (cosh,, (_Mdouble_ __x)); +/* Hyperbolic sine of X. */ +__MATHCALL (sinh,, (_Mdouble_ __x)); +/* Hyperbolic tangent of X. */ +__MATHCALL (tanh,, (_Mdouble_ __x)); +_Mdouble_END_NAMESPACE + +#if 0 /*def __USE_GNU*/ +/* Cosine and sine of X. */ +__MATHDECL (void,sincos,, + (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); +#endif + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Hyperbolic arc cosine of X. */ +__MATHCALL (acosh,, (_Mdouble_ __x)); +/* Hyperbolic arc sine of X. */ +__MATHCALL (asinh,, (_Mdouble_ __x)); +/* Hyperbolic arc tangent of X. */ +__MATHCALL (atanh,, (_Mdouble_ __x)); +__END_NAMESPACE_C99 +#endif + +/* Exponential and logarithmic functions. */ + +_Mdouble_BEGIN_NAMESPACE +/* Exponential function of X. */ +__MATHCALL (exp,, (_Mdouble_ __x)); + +/* Break VALUE into a normalized fraction and an integral power of 2. */ +__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent)); + +/* X times (two to the EXP power). */ +__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent)); + +/* Natural logarithm of X. */ +__MATHCALL (log,, (_Mdouble_ __x)); + +/* Base-ten logarithm of X. */ +__MATHCALL (log10,, (_Mdouble_ __x)); + +/* Break VALUE into integral and fractional parts. */ +__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)); +_Mdouble_END_NAMESPACE + +#if 0 /*def __USE_GNU*/ +/* A function missing in all standards: compute exponent to base ten. */ +__MATHCALL (exp10,, (_Mdouble_ __x)); +/* Another name occasionally used. */ +__MATHCALL (pow10,, (_Mdouble_ __x)); +#endif + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Return exp(X) - 1. */ +__MATHCALL (expm1,, (_Mdouble_ __x)); + +/* Return log(1 + X). */ +__MATHCALL (log1p,, (_Mdouble_ __x)); + +/* Return the base 2 signed integral exponent of X. */ +__MATHCALL (logb,, (_Mdouble_ __x)); +__END_NAMESPACE_C99 +#endif + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Compute base-2 exponential of X. */ +__MATHCALL (exp2,, (_Mdouble_ __x)); + +/* Compute base-2 logarithm of X. */ +__MATHCALL (log2,, (_Mdouble_ __x)); +__END_NAMESPACE_C99 +#endif + + +/* Power functions. */ + +_Mdouble_BEGIN_NAMESPACE +/* Return X to the Y power. */ +__MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return the square root of X. */ +__MATHCALL (sqrt,, (_Mdouble_ __x)); +_Mdouble_END_NAMESPACE + +#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Return `sqrt(X*X + Y*Y)'. */ +__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); +__END_NAMESPACE_C99 +#endif + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Return the cube root of X. */ +__MATHCALL (cbrt,, (_Mdouble_ __x)); +__END_NAMESPACE_C99 +#endif + + +/* Nearest integer, absolute value, and remainder functions. */ + +_Mdouble_BEGIN_NAMESPACE +/* Smallest integral value not less than X. */ +__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); + +/* Absolute value of X. */ +__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); + +/* Largest integer not greater than X. */ +__MATHCALLX (floor,, (_Mdouble_ __x), (__const__)); + +/* Floating-point modulo remainder of X/Y. */ +__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); + + +/* Return 0 if VALUE is finite or NaN, +1 if it + is +Infinity, -1 if it is -Infinity. */ +__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); + +/* Return nonzero if VALUE is finite and not NaN. */ +__MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); +_Mdouble_END_NAMESPACE + +#ifdef __USE_MISC +/* Return 0 if VALUE is finite or NaN, +1 if it + is +Infinity, -1 if it is -Infinity. */ +__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); + +/* Return nonzero if VALUE is finite and not NaN. */ +__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); + +/* Return the remainder of X/Y. */ +__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)); + + +/* Return the fractional part of X after dividing out `ilogb (X)'. */ +__MATHCALL (significand,, (_Mdouble_ __x)); +#endif /* Use misc. */ + +#if defined __USE_MISC || defined __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Return X with its signed changed to Y's. */ +__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); +__END_NAMESPACE_C99 +#endif + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Return representation of NaN for double type. */ +__MATHCALLX (nan,, (__const char *__tagb), (__const__)); +__END_NAMESPACE_C99 +#endif + + +/* Return nonzero if VALUE is not a number. */ +__MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); + +#if defined __USE_MISC || defined __USE_XOPEN +/* Return nonzero if VALUE is not a number. */ +__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); + +/* Bessel functions. */ +__MATHCALL (j0,, (_Mdouble_)); +__MATHCALL (j1,, (_Mdouble_)); +__MATHCALL (jn,, (int, _Mdouble_)); +__MATHCALL (y0,, (_Mdouble_)); +__MATHCALL (y1,, (_Mdouble_)); +__MATHCALL (yn,, (int, _Mdouble_)); +#endif + + +#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Error and gamma functions. */ +__MATHCALL (erf,, (_Mdouble_)); +__MATHCALL (erfc,, (_Mdouble_)); +__MATHCALL (lgamma,, (_Mdouble_)); +__END_NAMESPACE_C99 +#endif + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* True gamma function. */ +__MATHCALL (tgamma,, (_Mdouble_)); +__END_NAMESPACE_C99 +#endif + +#if defined __USE_MISC || defined __USE_XOPEN +/* Obsolete alias for `lgamma'. */ +__MATHCALL (gamma,, (_Mdouble_)); +#endif + +#ifdef __USE_MISC +/* Reentrant version of lgamma. This function uses the global variable + `signgam'. The reentrant version instead takes a pointer and stores + the value through it. */ +__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); +#endif + + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Return the integer nearest X in the direction of the + prevailing rounding mode. */ +__MATHCALL (rint,, (_Mdouble_ __x)); + +/* Return X + epsilon if X < Y, X - epsilon if X > Y. */ +__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); +# if defined __USE_ISOC99 && !defined __LDBL_COMPAT +__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__)); +# endif + +/* Return the remainder of integer divison X / Y with infinite precision. */ +__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); + +# if defined __USE_MISC || defined __USE_ISOC99 +/* Return X times (2 to the Nth power). */ +__MATHCALL (scalbn,, (_Mdouble_ __x, int __n)); +# endif + +/* Return the binary exponent of X, which must be nonzero. */ +__MATHDECL (int,ilogb,, (_Mdouble_ __x)); +#endif + +#ifdef __USE_ISOC99 +/* Return X times (2 to the Nth power). */ +__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n)); + +/* Round X to integral value in floating-point format using current + rounding direction, but do not raise inexact exception. */ +__MATHCALL (nearbyint,, (_Mdouble_ __x)); + +/* Round X to nearest integral value, rounding halfway cases away from + zero. */ +__MATHCALLX (round,, (_Mdouble_ __x), (__const__)); + +/* Round X to the integral value in floating-point format nearest but + not larger in magnitude. */ +__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)); + +/* Compute remainder of X and Y and put in *QUO a value with sign of x/y + and magnitude congruent `mod 2^n' to the magnitude of the integral + quotient x/y, with n >= 3. */ +__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); + + +/* Conversion functions. */ + +/* Round X to nearest integral value according to current rounding + direction. */ +__MATHDECL (long int,lrint,, (_Mdouble_ __x)); +__MATHDECL (long long int,llrint,, (_Mdouble_ __x)); + +/* Round X to nearest integral value, rounding halfway cases away from + zero. */ +__MATHDECL (long int,lround,, (_Mdouble_ __x)); +__MATHDECL (long long int,llround,, (_Mdouble_ __x)); + + +/* Return positive difference between X and Y. */ +__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return maximum numeric value from X and Y. */ +__MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return minimum numeric value from X and Y. */ +__MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y)); + + +/* Classify given number. */ +__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value)) + __attribute__ ((__const__)); + +/* Test for negative number. */ +__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) + __attribute__ ((__const__)); + + +/* Multiply-add function computed as a ternary operation. */ +__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); +#endif /* Use ISO C99. */ + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +__END_NAMESPACE_C99 +#endif + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +/* Return X times (2 to the Nth power). */ +__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathdef.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathdef.h new file mode 100644 index 0000000..331da13 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathdef.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _MATH_H && !defined _COMPLEX_H +# error "Never use directly; include instead" +#endif + +#include + +#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF +# define _MATH_H_MATHDEF 1 + +/* Normally, there is no long double type and the `float' and `double' + expressions are evaluated as `double'. */ +typedef double float_t; /* `float' expressions are evaluated as + `double'. */ +typedef double double_t; /* `double' expressions are evaluated as + `double'. */ + +/* The values returned by `ilogb' for 0 and NaN respectively. */ +# define FP_ILOGB0 (-2147483647) +# define FP_ILOGBNAN 2147483647 + +#endif /* ISO C99 */ + +#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32 +/* Signal that we do not really have a `long double'. This disables the + declaration of all the `long double' function variants. */ +# define __NO_LONG_DOUBLE_MATH 1 +#elif !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ +# define __NO_LONG_DOUBLE_MATH 1 +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathinline.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathinline.h new file mode 100644 index 0000000..5498af6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mathinline.h @@ -0,0 +1,12 @@ +/* This file should provide inline versions of math functions. + + Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'. + + This file should define __MATH_INLINES if functions are actually defined as + inlines. */ + +#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ + +/* Here goes the real code. */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mman.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mman.h new file mode 100644 index 0000000..47d3393 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mman.h @@ -0,0 +1,106 @@ +/* Definitions for POSIX memory map interface. Linux/MIPS version. + Copyright (C) 1997, 2000, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_READ 0x1 /* Page can be read. */ +#define PROT_WRITE 0x2 /* Page can be written. */ +#define PROT_EXEC 0x4 /* Page can be executed. */ +#define PROT_NONE 0x0 /* Page can not be accessed. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x10 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0 +# define MAP_ANONYMOUS 0x0800 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +# define MAP_RENAME MAP_ANONYMOUS +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_NORESERVE 0x0400 /* don't check for reservations */ +# define MAP_ANONYMOUS 0x0800 /* don't use a file */ +# define MAP_GROWSDOWN 0x1000 /* stack-like segment */ +# define MAP_DENYWRITE 0x2000 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ +# define MAP_LOCKED 0x8000 /* pages are locked */ +# define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ +# define MAP_NONBLOCK 0x20000 /* do not block on IO */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 1 /* Sync memory asynchronously. */ +#define MS_SYNC 4 /* Synchronous memory sync. */ +#define MS_INVALIDATE 2 /* Invalidate the caches. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 2 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 4 /* Don't need these pages. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ +# define MADV_DOFORK 11 /* Do inherit across fork. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mqueue.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mqueue.h new file mode 100644 index 0000000..df528f8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/mqueue.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MQUEUE_H +# error "Never use directly; include instead." +#endif + +typedef int mqd_t; + +struct mq_attr +{ + long int mq_flags; /* Message queue flags. */ + long int mq_maxmsg; /* Maximum number of messages. */ + long int mq_msgsize; /* Maximum message size. */ + long int mq_curmsgs; /* Number of messages currently queued. */ + long int __pad[4]; +}; diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/msq.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/msq.h new file mode 100644 index 0000000..2b0d38e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/msq.h @@ -0,0 +1,93 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#include +#include + +/* Define options for message queue functions. */ +#define MSG_NOERROR 010000 /* no error if message is too big */ +#ifdef __USE_GNU +# define MSG_EXCEPT 020000 /* recv any msg except of specified type */ +#endif + +/* Types used in the structure definition. */ +typedef unsigned long int msgqnum_t; +typedef unsigned long int msglen_t; + + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ + struct ipc_perm msg_perm; /* structure describing operation permission */ +#if (__WORDSIZE == 32) && !defined(__MIPSEL__) + unsigned long __unused1; +#endif + __time_t msg_stime; /* time of last msgsnd command */ +#if (__WORDSIZE == 32) && defined(__MIPSEL__) + unsigned long __unused1; +#endif +#if (__WORDSIZE == 32) && !defined(__MIPSEL__) + unsigned long __unused2; +#endif + __time_t msg_rtime; /* time of last msgrcv command */ +#if (__WORDSIZE == 32) && defined(__MIPSEL__) + unsigned long __unused2; +#endif +#if (__WORDSIZE == 32) && !defined(__MIPSEL__) + unsigned long __unused3; +#endif + __time_t msg_ctime; /* time of last change */ +#if (__WORDSIZE == 32) && defined(__MIPSEL__) + unsigned long __unused3; +#endif + unsigned long int __msg_cbytes; /* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ + unsigned long int __unused4; + unsigned long int __unused5; +}; + +#ifdef __USE_MISC + +# define msg_cbytes __msg_cbytes + +/* ipcs ctl commands */ +# define MSG_STAT 11 +# define MSG_INFO 12 + +/* buffer for msgctl calls IPC_INFO, MSG_INFO */ +struct msginfo + { + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + unsigned short int msgseg; + }; + +#endif /* __USE_MISC */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/nan.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/nan.h new file mode 100644 index 0000000..bae97f2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/nan.h @@ -0,0 +1,53 @@ +/* `NAN' constant for IEEE 754 machines. + Copyright (C) 1992,1996,1997,1999,2004,2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + + +/* IEEE Not A Number. */ + +#if __GNUC_PREREQ(3,3) + +# define NAN (__builtin_nanf ("")) + +#elif defined __GNUC__ + +# define NAN \ + (__extension__ \ + ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \ + { __l: 0x7fc00000UL }).__d) + +#else + +# include + +# if __BYTE_ORDER == __BIG_ENDIAN +# define __nan_bytes { 0x7f, 0xc0, 0, 0 } +# endif +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define __nan_bytes { 0, 0, 0xc0, 0x7f } +# endif + +static union { unsigned char __c[4]; float __d; } __nan_union + __attribute_used__ = { __nan_bytes }; +# define NAN (__nan_union.__d) + +#endif /* GCC. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/netdb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/netdb.h new file mode 100644 index 0000000..41dc731 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/netdb.h @@ -0,0 +1,33 @@ +/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETDB_H +# error "Never include directly; use instead." +#endif + + +/* Description of data base entry for a single network. NOTE: here a + poor assumption is made. The network number is expected to fit + into an unsigned long int variable. */ +struct netent +{ + char *n_name; /* Official name of network. */ + char **n_aliases; /* Alias list. */ + int n_addrtype; /* Net address type. */ + uint32_t n_net; /* Network number. */ +}; diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/poll.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/poll.h new file mode 100644 index 0000000..eee4ea2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/poll.h @@ -0,0 +1,50 @@ +/* Copyright (C) 1997, 2001, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_POLL_H +# error "Never use directly; include instead." +#endif + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +#ifdef __USE_GNU +/* These are extensions for Linux. */ +# define POLLMSG 0x400 +# define POLLREMOVE 0x1000 +# define POLLRDHUP 0x2000 +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix1_lim.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix1_lim.h new file mode 100644 index 0000000..3c86dce --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix1_lim.h @@ -0,0 +1,169 @@ +/* Copyright (C) 1991-1993,96,98,2000-2003,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 2.9.2 Minimum Values Added to + * + * Never include this file directly; use instead. + */ + +#ifndef _BITS_POSIX1_LIM_H +#define _BITS_POSIX1_LIM_H 1 + + +/* These are the standard-mandated minimum values. */ + +/* Minimum number of operations in one list I/O call. */ +#define _POSIX_AIO_LISTIO_MAX 2 + +/* Minimal number of outstanding asynchronous I/O operations. */ +#define _POSIX_AIO_MAX 1 + +/* Maximum length of arguments to `execve', including environment. */ +#define _POSIX_ARG_MAX 4096 + +/* Maximum simultaneous processes per real user ID. */ +#ifdef __USE_XOPEN2K +# define _POSIX_CHILD_MAX 25 +#else +# define _POSIX_CHILD_MAX 6 +#endif + +/* Minimal number of timer expiration overruns. */ +#define _POSIX_DELAYTIMER_MAX 32 + +/* Maximum length of a host name (not including the terminating null) + as returned from the GETHOSTNAME function. */ +#define _POSIX_HOST_NAME_MAX 255 + +/* Maximum link count of a file. */ +#define _POSIX_LINK_MAX 8 + +/* Maximum length of login name. */ +#define _POSIX_LOGIN_NAME_MAX 9 + +/* Number of bytes in a terminal canonical input queue. */ +#define _POSIX_MAX_CANON 255 + +/* Number of bytes for which space will be + available in a terminal input queue. */ +#define _POSIX_MAX_INPUT 255 + +/* Maximum number of message queues open for a process. */ +#define _POSIX_MQ_OPEN_MAX 8 + +/* Maximum number of supported message priorities. */ +#define _POSIX_MQ_PRIO_MAX 32 + +/* Number of bytes in a filename. */ +#define _POSIX_NAME_MAX 14 + +/* Number of simultaneous supplementary group IDs per process. */ +#ifdef __USE_XOPEN2K +# define _POSIX_NGROUPS_MAX 8 +#else +# define _POSIX_NGROUPS_MAX 0 +#endif + +/* Number of files one process can have open at once. */ +#ifdef __USE_XOPEN2K +# define _POSIX_OPEN_MAX 20 +#else +# define _POSIX_OPEN_MAX 16 +#endif + +/* Number of descriptors that a process may examine with `pselect' or + `select'. */ +#define _POSIX_FD_SETSIZE _POSIX_OPEN_MAX + +/* Number of bytes in a pathname. */ +#define _POSIX_PATH_MAX 256 + +/* Number of bytes than can be written atomically to a pipe. */ +#define _POSIX_PIPE_BUF 512 + +/* The number of repeated occurrences of a BRE permitted by the + REGEXEC and REGCOMP functions when using the interval notation. */ +#define _POSIX_RE_DUP_MAX 255 + +/* Minimal number of realtime signals reserved for the application. */ +#define _POSIX_RTSIG_MAX 8 + +/* Number of semaphores a process can have. */ +#define _POSIX_SEM_NSEMS_MAX 256 + +/* Maximal value of a semaphore. */ +#define _POSIX_SEM_VALUE_MAX 32767 + +/* Number of pending realtime signals. */ +#define _POSIX_SIGQUEUE_MAX 32 + +/* Largest value of a `ssize_t'. */ +#define _POSIX_SSIZE_MAX 32767 + +/* Number of streams a process can have open at once. */ +#define _POSIX_STREAM_MAX 8 + +/* The number of bytes in a symbolic link. */ +#define _POSIX_SYMLINK_MAX 255 + +/* The number of symbolic links that can be traversed in the + resolution of a pathname in the absence of a loop. */ +#define _POSIX_SYMLOOP_MAX 8 + +/* Number of timer for a process. */ +#define _POSIX_TIMER_MAX 32 + +/* Maximum number of characters in a tty name. */ +#define _POSIX_TTY_NAME_MAX 9 + +/* Maximum length of a timezone name (element of `tzname'). */ +#define _POSIX_TZNAME_MAX 6 + +/* Maximum number of connections that can be queued on a socket. */ +#define _POSIX_QLIMIT 1 + +/* Maximum number of bytes that can be buffered on a socket for send + or receive. */ +#define _POSIX_HIWAT _POSIX_PIPE_BUF + +/* Maximum number of elements in an `iovec' array. */ +#define _POSIX_UIO_MAXIOV 16 + +/* Maximum clock resolution in nanoseconds. */ +#define _POSIX_CLOCKRES_MIN 20000000 + + +/* Get the implementation-specific values for the above. */ +#include +#include + + +#ifndef SSIZE_MAX +# define SSIZE_MAX LONG_MAX +#endif + + +/* This value is a guaranteed minimum maximum. + The current maximum can be got from `sysconf'. */ + +#ifndef NGROUPS_MAX +# define NGROUPS_MAX 8 +#endif + +#endif /* bits/posix1_lim.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix2_lim.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix2_lim.h new file mode 100644 index 0000000..24483a0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix2_lim.h @@ -0,0 +1,91 @@ +/* Copyright (C) 1991, 1996, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; include instead. + */ + +#ifndef _BITS_POSIX2_LIM_H +#define _BITS_POSIX2_LIM_H 1 + + +/* The maximum `ibase' and `obase' values allowed by the `bc' utility. */ +#define _POSIX2_BC_BASE_MAX 99 + +/* The maximum number of elements allowed in an array by the `bc' utility. */ +#define _POSIX2_BC_DIM_MAX 2048 + +/* The maximum `scale' value allowed by the `bc' utility. */ +#define _POSIX2_BC_SCALE_MAX 99 + +/* The maximum length of a string constant accepted by the `bc' utility. */ +#define _POSIX2_BC_STRING_MAX 1000 + +/* The maximum number of weights that can be assigned to an entry of + the LC_COLLATE `order' keyword in the locale definition file. */ +#define _POSIX2_COLL_WEIGHTS_MAX 2 + +/* The maximum number of expressions that can be nested + within parentheses by the `expr' utility. */ +#define _POSIX2_EXPR_NEST_MAX 32 + +/* The maximum length, in bytes, of an input line. */ +#define _POSIX2_LINE_MAX 2048 + +/* The maximum number of repeated occurrences of a regular expression + permitted when using the interval notation `\{M,N\}'. */ +#define _POSIX2_RE_DUP_MAX 255 + +/* The maximum number of bytes in a character class name. We have no + fixed limit, 2048 is a high number. */ +#define _POSIX2_CHARCLASS_NAME_MAX 14 + + +/* These values are implementation-specific, + and may vary within the implementation. + Their precise values can be obtained from sysconf. */ + +#ifndef BC_BASE_MAX +#define BC_BASE_MAX _POSIX2_BC_BASE_MAX +#endif +#ifndef BC_DIM_MAX +#define BC_DIM_MAX _POSIX2_BC_DIM_MAX +#endif +#ifndef BC_SCALE_MAX +#define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX +#endif +#ifndef BC_STRING_MAX +#define BC_STRING_MAX _POSIX2_BC_STRING_MAX +#endif +#ifndef COLL_WEIGHTS_MAX +#define COLL_WEIGHTS_MAX 255 +#endif +#ifndef EXPR_NEST_MAX +#define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX +#endif +#ifndef LINE_MAX +#define LINE_MAX _POSIX2_LINE_MAX +#endif +#ifndef CHARCLASS_NAME_MAX +#define CHARCLASS_NAME_MAX 2048 +#endif + +/* This value is defined like this in regex.h. */ +#define RE_DUP_MAX (0x7fff) + +#endif /* bits/posix2_lim.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix_opt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix_opt.h new file mode 100644 index 0000000..dfe259b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/posix_opt.h @@ -0,0 +1,180 @@ +/* Define POSIX options for Linux. + Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _POSIX_OPT_H +#define _POSIX_OPT_H 1 + +/* Job control is supported. */ +#define _POSIX_JOB_CONTROL 1 + +/* Processes have a saved set-user-ID and a saved set-group-ID. */ +#define _POSIX_SAVED_IDS 1 + +/* Priority scheduling is supported. */ +#define _POSIX_PRIORITY_SCHEDULING 200112L + +/* Synchronizing file data is supported. */ +#define _POSIX_SYNCHRONIZED_IO 200112L + +/* The fsync function is present. */ +#define _POSIX_FSYNC 200112L + +/* Mapping of files to memory is supported. */ +#define _POSIX_MAPPED_FILES 200112L + +/* Locking of all memory is supported. */ +#define _POSIX_MEMLOCK 200112L + +/* Locking of ranges of memory is supported. */ +#define _POSIX_MEMLOCK_RANGE 200112L + +/* Setting of memory protections is supported. */ +#define _POSIX_MEMORY_PROTECTION 200112L + +/* Only root can change owner of file. */ +#define _POSIX_CHOWN_RESTRICTED 1 + +/* `c_cc' member of 'struct termios' structure can be disabled by + using the value _POSIX_VDISABLE. */ +#define _POSIX_VDISABLE '\0' + +/* Filenames are not silently truncated. */ +#define _POSIX_NO_TRUNC 1 + +/* X/Open realtime support is available. */ +#define _XOPEN_REALTIME 1 + +/* XPG4.2 shared memory is supported. */ +#define _XOPEN_SHM 1 + +/* Tell we have POSIX threads. */ +#define _POSIX_THREADS 200112L + +/* We have the reentrant functions described in POSIX. */ +#define _POSIX_REENTRANT_FUNCTIONS 1 +#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L + +/* We provide priority scheduling for threads. */ +#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L + +/* We support user-defined stack sizes. */ +#define _POSIX_THREAD_ATTR_STACKSIZE 200112L + +/* We support user-defined stacks. */ +#define _POSIX_THREAD_ATTR_STACKADDR 200112L + +/* We support POSIX.1b semaphores. */ +#define _POSIX_SEMAPHORES 200112L + +/* Real-time signals are supported. */ +#define _POSIX_REALTIME_SIGNALS 200112L + +/* We support asynchronous I/O. */ +#define _POSIX_ASYNCHRONOUS_IO 200112L +#define _POSIX_ASYNC_IO 1 +/* Alternative name for Unix98. */ +#define _LFS_ASYNCHRONOUS_IO 1 +/* Support for prioritization is also available. */ +#define _POSIX_PRIORITIZED_IO 200112L + +/* The LFS support in asynchronous I/O is also available. */ +#define _LFS64_ASYNCHRONOUS_IO 1 + +#ifdef __UCLIBC_HAS_LFS__ +/* The rest of the LFS is also available. */ +#define _LFS_LARGEFILE 1 +#define _LFS64_LARGEFILE 1 +#define _LFS64_STDIO 1 +#endif + +/* POSIX shared memory objects are implemented. */ +#define _POSIX_SHARED_MEMORY_OBJECTS 200112L + +/* CPU-time clocks support needs to be checked at runtime. */ +#define _POSIX_CPUTIME 0 + +/* Clock support in threads must be also checked at runtime. */ +#define _POSIX_THREAD_CPUTIME 0 + +/* GNU libc provides regular expression handling. */ +#define _POSIX_REGEXP 1 + +/* Reader/Writer locks are available. */ +#define _POSIX_READER_WRITER_LOCKS 200112L + +/* We have a POSIX shell. */ +#define _POSIX_SHELL 1 + +/* We support the Timeouts option. */ +#define _POSIX_TIMEOUTS 200112L + +/* We support spinlocks. */ +#define _POSIX_SPIN_LOCKS 200112L + +/* The `spawn' function family is supported. */ +#define _POSIX_SPAWN 200112L + +/* We have POSIX timers. */ +#define _POSIX_TIMERS 200112L + +/* The barrier functions are available. */ +#define _POSIX_BARRIERS 200112L + +/* POSIX message queues are available. */ +#define _POSIX_MESSAGE_PASSING 200112L + +/* Thread process-shared synchronization is supported. */ +#define _POSIX_THREAD_PROCESS_SHARED 200112L + +/* The monotonic clock might be available. */ +#define _POSIX_MONOTONIC_CLOCK 0 + +/* The clock selection interfaces are available. */ +#define _POSIX_CLOCK_SELECTION 200112L + +/* Advisory information interfaces are available. */ +#define _POSIX_ADVISORY_INFO 200112L + +/* IPv6 support is available. */ +#define _POSIX_IPV6 200112L + +/* Raw socket support is available. */ +#define _POSIX_RAW_SOCKETS 200112L + +/* We have at least one terminal. */ +#define _POSIX2_CHAR_TERM 200112L + +/* Neither process nor thread sporadic server interfaces is available. */ +#define _POSIX_SPORADIC_SERVER -1 +#define _POSIX_THREAD_SPORADIC_SERVER -1 + +/* trace.h is not available. */ +#define _POSIX_TRACE -1 +#define _POSIX_TRACE_EVENT_FILTER -1 +#define _POSIX_TRACE_INHERIT -1 +#define _POSIX_TRACE_LOG -1 + +/* Typed memory objects are not available. */ +#define _POSIX_TYPED_MEMORY_OBJECTS -1 + +/* No support for priority inheritance or protection so far. */ +#define _POSIX_THREAD_PRIO_INHERIT -1 +#define _POSIX_THREAD_PRIO_PROTECT -1 + +#endif /* posix_opt.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/pthreadtypes.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/pthreadtypes.h new file mode 100644 index 0000000..faec63b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/pthreadtypes.h @@ -0,0 +1,142 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +#if !defined _BITS_TYPES_H && !defined _PTHREAD_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_PTHREADTYPES_H +#define _BITS_PTHREADTYPES_H 1 + +#define __need_schedparam +#include + +/* Fast locks (not abstract because mutexes and conditions aren't abstract). */ +struct _pthread_fastlock +{ + long int __status; /* "Free" or "taken" or head of waiting list */ + int __spinlock; /* Used by compare_and_swap emulation. Also, + adaptive SMP lock stores spin count here. */ +}; + +#ifndef _PTHREAD_DESCR_DEFINED +/* Thread descriptors */ +typedef struct _pthread_descr_struct *_pthread_descr; +# define _PTHREAD_DESCR_DEFINED +#endif + + +/* Attributes for threads. */ +typedef struct __pthread_attr_s +{ + int __detachstate; + int __schedpolicy; + struct __sched_param __schedparam; + int __inheritsched; + int __scope; + size_t __guardsize; + int __stackaddr_set; + void *__stackaddr; + size_t __stacksize; +} pthread_attr_t; + + +/* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */ +typedef struct +{ + struct _pthread_fastlock __c_lock; /* Protect against concurrent access */ + _pthread_descr __c_waiting; /* Threads waiting on this condition */ +} pthread_cond_t; + + +/* Attribute for conditionally variables. */ +typedef struct +{ + int __dummy; +} pthread_condattr_t; + +/* Keys for thread-specific data */ +typedef unsigned int pthread_key_t; + + +/* Mutexes (not abstract because of PTHREAD_MUTEX_INITIALIZER). */ +/* (The layout is unnatural to maintain binary compatibility + with earlier releases of LinuxThreads.) */ +typedef struct +{ + int __m_reserved; /* Reserved for future use */ + int __m_count; /* Depth of recursive locking */ + _pthread_descr __m_owner; /* Owner thread (if recursive or errcheck) */ + int __m_kind; /* Mutex kind: fast, recursive or errcheck */ + struct _pthread_fastlock __m_lock; /* Underlying fast lock */ +} pthread_mutex_t; + + +/* Attribute for mutex. */ +typedef struct +{ + int __mutexkind; +} pthread_mutexattr_t; + + +/* Once-only execution */ +typedef int pthread_once_t; + + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +/* Read-write locks. */ +typedef struct _pthread_rwlock_t +{ + struct _pthread_fastlock __rw_lock; /* Lock to guarantee mutual exclusion */ + int __rw_readers; /* Number of readers */ + _pthread_descr __rw_writer; /* Identity of writer, or NULL if none */ + _pthread_descr __rw_read_waiting; /* Threads waiting for reading */ + _pthread_descr __rw_write_waiting; /* Threads waiting for writing */ + int __rw_kind; /* Reader/Writer preference selection */ + int __rw_pshared; /* Shared between processes or not */ +} pthread_rwlock_t; + + +/* Attribute for read-write locks. */ +typedef struct +{ + int __lockkind; + int __pshared; +} pthread_rwlockattr_t; +#endif + +#ifdef __USE_XOPEN2K +/* POSIX spinlock data type. */ +typedef volatile int pthread_spinlock_t; + +/* POSIX barrier. */ +typedef struct { + struct _pthread_fastlock __ba_lock; /* Lock to guarantee mutual exclusion */ + int __ba_required; /* Threads needed for completion */ + int __ba_present; /* Threads waiting */ + _pthread_descr __ba_waiting; /* Queue of waiting threads */ +} pthread_barrier_t; + +/* barrier attribute */ +typedef struct { + int __pshared; +} pthread_barrierattr_t; + +#endif + + +/* Thread identifiers */ +typedef unsigned long int pthread_t; + +#endif /* bits/pthreadtypes.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/resource.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/resource.h new file mode 100644 index 0000000..1c8b99a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/resource.h @@ -0,0 +1,233 @@ +/* Bit values & structures for resource limits. Linux/MIPS version. + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005, 2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_RESOURCE_H +# error "Never use directly; include instead." +#endif + +#include + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + __RLIMIT_RSS = 7, +#define RLIMIT_RSS __RLIMIT_RSS + + /* Number of open files. */ + RLIMIT_NOFILE = 5, + __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE __RLIMIT_OFILE + + /* Address space limit (?) */ + RLIMIT_AS = 6, +#define RLIMIT_AS RLIMIT_AS + + /* Number of processes. */ + __RLIMIT_NPROC = 8, +#define RLIMIT_NPROC __RLIMIT_NPROC + + /* Locked-in-memory address space. */ + __RLIMIT_MEMLOCK = 9, +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK + + /* Maximum number of file locks. */ + __RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS __RLIMIT_LOCKS + + /* Maximum number of pending signals. */ + __RLIMIT_SIGPENDING = 11, +#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING + + /* Maximum bytes in POSIX message queues. */ + __RLIMIT_MSGQUEUE = 12, +#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE + + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO + + __RLIMIT_NLIMITS = 15, + __RLIM_NLIMITS = __RLIMIT_NLIMITS +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS +#define RLIM_NLIMITS __RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#if _MIPS_SIM == _ABI64 +/* The N64 syscall uses this value. */ +# define RLIM_INFINITY 0xffffffffffffffffUL +# ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffUL +# endif +#else +/* The O32 and N32 syscalls use 0x7fffffff. */ +# ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((long int)(~0UL >> 1)) +# else +# define RLIM_INFINITY 0x7fffffffffffffffULL +# endif +# ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0x7fffffffffffffffULL +# endif +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1 +#define RUSAGE_CHILDREN RUSAGE_CHILDREN +}; + +#define __need_timeval +#include /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long int ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long int ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long int ru_idrss; + /* Amount of stack memory used (kilobyte-seconds). */ + long int ru_isrss; + /* Number of soft page faults (i.e. those serviced by reclaiming + a page from the list of pages awaiting reallocation. */ + long int ru_minflt; + /* Number of hard page faults (i.e. those that required I/O). */ + long int ru_majflt; + /* Number of times a process was swapped out of physical memory. */ + long int ru_nswap; + /* Number of input operations via the file system. Note: This + and `ru_oublock' do not include operations with the cache. */ + long int ru_inblock; + /* Number of output operations via the file system. */ + long int ru_oublock; + /* Number of IPC messages sent. */ + long int ru_msgsnd; + /* Number of IPC messages received. */ + long int ru_msgrcv; + /* Number of signals delivered. */ + long int ru_nsignals; + /* Number of voluntary context switches, i.e. because the process + gave up the process before it had to (usually to wait for some + resource to be available). */ + long int ru_nvcsw; + /* Number of involuntary context switches, i.e. a higher priority process + became runnable or the current process used up its time slice. */ + long int ru_nivcsw; + }; + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sched.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sched.h new file mode 100644 index 0000000..b48a0c8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sched.h @@ -0,0 +1,132 @@ +/* Definitions of constants and data structure for POSIX 1003.1b-1993 + scheduling interface. + Copyright (C) 1996-1999,2001-2003,2005,2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __need_schedparam + +#ifndef _SCHED_H +# error "Never include directly; use instead." +#endif + + +/* Scheduling algorithms. */ +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 +#ifdef __USE_GNU +# define SCHED_BATCH 3 +#endif + +#ifdef __USE_MISC +/* Cloning flags. */ +# define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */ +# define CLONE_VM 0x00000100 /* Set if VM shared between processes. */ +# define CLONE_FS 0x00000200 /* Set if fs info shared between processes. */ +# define CLONE_FILES 0x00000400 /* Set if open files shared between processes. */ +# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */ +# define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */ +# define CLONE_VFORK 0x00004000 /* Set if the parent wants the child to + wake it up on mm_release. */ +# define CLONE_PARENT 0x00008000 /* Set if we want to have the same + parent as the cloner. */ +# define CLONE_THREAD 0x00010000 /* Set to add to same thread group. */ +# define CLONE_NEWNS 0x00020000 /* Set to create new namespace. */ +# define CLONE_SYSVSEM 0x00040000 /* Set to shared SVID SEM_UNDO semantics. */ +# define CLONE_SETTLS 0x00080000 /* Set TLS info. */ +# define CLONE_PARENT_SETTID 0x00100000 /* Store TID in userlevel buffer + before MM copy. */ +# define CLONE_CHILD_CLEARTID 0x00200000 /* Register exit futex and memory + location to clear. */ +# define CLONE_DETACHED 0x00400000 /* Create clone detached. */ +# define CLONE_UNTRACED 0x00800000 /* Set if the tracing process can't + force CLONE_PTRACE on this clone. */ +# define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in + the child. */ +# define CLONE_STOPPED 0x02000000 /* Start in stopped state. */ +#endif + +/* The official definition. */ +struct sched_param + { + int __sched_priority; + }; + +__BEGIN_DECLS + +#ifdef __USE_MISC +/* Clone current process. */ +extern int clone (int (*__fn) (void *__arg), void *__child_stack, + int __flags, void *__arg, ...) __THROW; + +#if 0 +/* Unshare the specified resources. */ +extern int unshare (int __flags) __THROW; +#endif +#endif + +__END_DECLS + +#endif /* need schedparam */ + +#if !defined __defined_schedparam \ + && (defined __need_schedparam || defined _SCHED_H) +# define __defined_schedparam 1 +/* Data structure to describe a process' schedulability. */ +struct __sched_param + { + int __sched_priority; + }; +# undef __need_schedparam +#endif + + +#if defined _SCHED_H && !defined __cpu_set_t_defined +# define __cpu_set_t_defined +/* Size definition for CPU sets. */ +# define __CPU_SETSIZE 1024 +# define __NCPUBITS (8 * sizeof (__cpu_mask)) + +/* Type for array elements in 'cpu_set'. */ +typedef unsigned long int __cpu_mask; + +/* Basic access functions. */ +# define __CPUELT(cpu) ((cpu) / __NCPUBITS) +# define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS)) + +/* Data structure to describe CPU mask. */ +typedef struct +{ + __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS]; +} cpu_set_t; + +/* Access functions for CPU masks. */ +# define __CPU_ZERO(cpusetp) \ + do { \ + unsigned int __i; \ + cpu_set_t *__arr = (cpusetp); \ + for (__i = 0; __i < sizeof (cpu_set_t) / sizeof (__cpu_mask); ++__i) \ + __arr->__bits[__i] = 0; \ + } while (0) +# define __CPU_SET(cpu, cpusetp) \ + ((cpusetp)->__bits[__CPUELT (cpu)] |= __CPUMASK (cpu)) +# define __CPU_CLR(cpu, cpusetp) \ + ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu)) +# define __CPU_ISSET(cpu, cpusetp) \ + (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0) +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/select.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/select.h new file mode 100644 index 0000000..47e7ded --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/select.h @@ -0,0 +1,35 @@ +/* Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SELECT_H +# error "Never use directly; include instead." +#endif + + +/* We don't use `memset' because this would require a prototype and + the array isn't too big. */ +#define __FD_ZERO(s) \ + do { \ + unsigned int __i; \ + fd_set *__arr = (s); \ + for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ + __FDS_BITS (__arr)[__i] = 0; \ + } while (0) +#define __FD_SET(d, s) (__FDS_BITS (s)[__FDELT(d)] |= __FDMASK(d)) +#define __FD_CLR(d, s) (__FDS_BITS (s)[__FDELT(d)] &= ~__FDMASK(d)) +#define __FD_ISSET(d, s) ((__FDS_BITS (s)[__FDELT(d)] & __FDMASK(d)) != 0) diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sem.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sem.h new file mode 100644 index 0000000..6282de9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sem.h @@ -0,0 +1,85 @@ +/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Flags for `semop'. */ +#define SEM_UNDO 0x1000 /* undo the operation on exit */ + +/* Commands for `semctl'. */ +#define GETPID 11 /* get sempid */ +#define GETVAL 12 /* get semval */ +#define GETALL 13 /* get all semval's */ +#define GETNCNT 14 /* get semncnt */ +#define GETZCNT 15 /* get semzcnt */ +#define SETVAL 16 /* set semval */ +#define SETALL 17 /* set all semval's */ + + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ + struct ipc_perm sem_perm; /* operation permission struct */ + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ + unsigned long int sem_nsems; /* number of semaphores in set */ + unsigned long int __unused1; + unsigned long int __unused2; +}; + +/* The user should define a union like the following to use it for arguments + for `semctl'. + + union semun + { + int val; <= value for SETVAL + struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET + unsigned short int *array; <= array for GETALL & SETALL + struct seminfo *__buf; <= buffer for IPC_INFO + }; + + Previous versions of this file used to define this union but this is + incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether + one must define the union or not. */ +#define _SEM_SEMUN_UNDEFINED 1 + +#ifdef __USE_MISC + +/* ipcs ctl cmds */ +# define SEM_STAT 18 +# define SEM_INFO 19 + +struct seminfo +{ + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; +}; + +#endif /* __USE_MISC */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/setjmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/setjmp.h new file mode 100644 index 0000000..08e74fe --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/setjmp.h @@ -0,0 +1,72 @@ +/* Define the machine-dependent type `jmp_buf'. MIPS version. + Copyright (C) 1992,93,95,97,2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H +# error "Never include directly; use instead." +#endif + +#include + +typedef struct + { + /* Program counter. */ + void * __pc; + + /* Stack pointer. */ + void * __sp; + + /* Callee-saved registers s0 through s7. */ +#if _MIPS_SIM == _MIPS_SIM_ABI32 + int __regs[8]; +#else + long long __regs[8]; +#endif + + /* The frame pointer. */ + void * __fp; + + /* The global pointer. */ + void * __gp; + + /* Floating point status register. */ + int __fpc_csr; + + /* Callee-saved floating point registers. */ +#if _MIPS_SIM == _MIPS_SIM_ABI64 + double __fpregs[8]; +#else /* N32 || O32 */ + double __fpregs[6]; +#endif /* N32 || O32 */ + } __jmp_buf[1]; + +#ifdef __USE_MISC +/* Offset to the program counter in `jmp_buf'. */ +# define JB_PC 0 +#endif + + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((void *) (address) < (void *) (jmpbuf)[0].__sp) + +#endif /* bits/setjmp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/shm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/shm.h new file mode 100644 index 0000000..b308334 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/shm.h @@ -0,0 +1,94 @@ +/* Copyright (C) 1995,1996,1997,2000,2001,2002,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Permission flag for shmget. */ +#define SHM_R 0400 /* or S_IRUGO from */ +#define SHM_W 0200 /* or S_IWUGO from */ + +/* Flags for `shmat'. */ +#define SHM_RDONLY 010000 /* attach read-only else read-write */ +#define SHM_RND 020000 /* round attach address to SHMLBA */ +#define SHM_REMAP 040000 /* take-over region on attach */ + +/* Commands for `shmctl'. */ +#define SHM_LOCK 11 /* lock segment (root only) */ +#define SHM_UNLOCK 12 /* unlock segment (root only) */ + +/* Segment low boundary address multiple. */ +#define SHMLBA 0x40000 + + +/* Type to count number of attaches. */ +typedef unsigned long int shmatt_t; + +/* Data structure describing a set of semaphores. */ +struct shmid_ds + { + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + unsigned long int __unused1; + unsigned long int __unused2; + }; + +#ifdef __USE_MISC + +/* ipcs ctl commands */ +# define SHM_STAT 13 +# define SHM_INFO 14 + +/* shm_mode upper byte flags */ +# define SHM_DEST 01000 /* segment will be destroyed on last detach */ +# define SHM_LOCKED 02000 /* segment will not be swapped */ +# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ + +struct shminfo + { + unsigned long int shmmax; + unsigned long int shmmin; + unsigned long int shmmni; + unsigned long int shmseg; + unsigned long int shmall; + unsigned long int __unused1; + unsigned long int __unused2; + unsigned long int __unused3; + unsigned long int __unused4; + }; + +struct shm_info + { + int used_ids; + unsigned long int shm_tot; /* total allocated shm */ + unsigned long int shm_rss; /* total resident shm */ + unsigned long int shm_swp; /* total swapped shm */ + unsigned long int swap_attempts; + unsigned long int swap_successes; + }; + +#endif /* __USE_MISC */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigaction.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigaction.h new file mode 100644 index 0000000..d04e25f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigaction.h @@ -0,0 +1,89 @@ +/* The proper definitions for Linux/MIPS's sigaction. + Copyright (C) 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2003 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include directly; use instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Special flags. */ + unsigned int sa_flags; + + /* Signal handler. */ +#ifdef __USE_POSIX199309 + union + { + /* Used if SA_SIGINFO is not set. */ + __sighandler_t sa_handler; + /* Used if SA_SIGINFO is set. */ + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; +# define sa_handler __sigaction_handler.sa_handler +# define sa_sigaction __sigaction_handler.sa_sigaction +#else + __sighandler_t sa_handler; +#endif + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* The ABI says here are two unused ints following. */ + /* Restore handler. */ + void (*sa_restorer) (void); + +#if _MIPS_SZPTR < 64 + int sa_resv[1]; +#endif + }; + +/* Bits in `sa_flags'. */ +/* Please note that some Linux kernels versions use different values for these + flags which is a bug in those kernel versions. */ +#define SA_NOCLDSTOP 0x00000001 /* Don't send SIGCHLD when children stop. */ +#define SA_NOCLDWAIT 0x00010000 /* Don't create zombie on child death. */ +#define SA_SIGINFO 0x00000008 /* Invoke signal-catching function with + three arguments instead of one. */ +#if defined __USE_UNIX98 || defined __USE_MISC +# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */ +# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */ +# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */ +# define SA_NODEFER 0x40000000 /* Don't automatically block the signal when + its handler is being executed. */ +#endif +#ifdef __USE_MISC +# define SA_INTERRUPT 0x20000000 /* Historical no-op. */ + +/* Some aliases for the SA_ constants. */ +# define SA_NOMASK SA_NODEFER +# define SA_ONESHOT SA_RESETHAND +# define SA_STACK SA_ONSTACK +#endif + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_NOP 0 /* 0 is unused to catch errors */ +#define SIG_BLOCK 1 /* Block signals. */ +#define SIG_UNBLOCK 2 /* Unblock signals. */ +#define SIG_SETMASK 3 /* Set the set of blocked signals. */ +#ifdef __USE_MISC +# define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: + set only the low 32 bit of the sigset. */ +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigcontext.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigcontext.h new file mode 100644 index 0000000..99faeed --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigcontext.h @@ -0,0 +1,84 @@ +/* Copyright (C) 1996, 1997, 1998, 2003, 2004, 2006 Free Software + Foundation, Inc. This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_SIGCONTEXT_H +#define _BITS_SIGCONTEXT_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never use directly; include instead." +#endif + +#include + +#if _MIPS_SIM == _ABIO32 + +/* Certain unused fields were replaced with new ones in 2.6.12-rc4. + The changes were as follows: + + sc_cause -> sc_hi1 + sc_badvaddr -> sc_lo1 + sc_sigset[0] -> sc_hi2 + sc_sigset[1] -> sc_lo2 + sc_sigset[2] -> sc_hi3 + sc_sigset[3] -> sc_lo3 + + sc_regmask, sc_ownedfp and sc_fpc_eir are not used. */ +struct sigcontext { + unsigned int sc_regmask; + unsigned int sc_status; + unsigned long long sc_pc; + unsigned long long sc_regs[32]; + unsigned long long sc_fpregs[32]; + unsigned int sc_ownedfp; + unsigned int sc_fpc_csr; + unsigned int sc_fpc_eir; + unsigned int sc_used_math; + unsigned int sc_dsp; + unsigned long long sc_mdhi; + unsigned long long sc_mdlo; + unsigned long sc_hi1; + unsigned long sc_lo1; + unsigned long sc_hi2; + unsigned long sc_lo2; + unsigned long sc_hi3; + unsigned long sc_lo3; +}; + +#else + +/* This structure changed in 2.6.12-rc4 when DSP support was added. */ +struct sigcontext { + unsigned long long sc_regs[32]; + unsigned long long sc_fpregs[32]; + unsigned long long sc_mdhi; + unsigned long long sc_hi1; + unsigned long long sc_hi2; + unsigned long long sc_hi3; + unsigned long long sc_mdlo; + unsigned long long sc_lo1; + unsigned long long sc_lo2; + unsigned long long sc_lo3; + unsigned long long sc_pc; + unsigned int sc_fpc_csr; + unsigned int sc_used_math; + unsigned int sc_dsp; + unsigned int sc_reserved; +}; + +#endif /* _MIPS_SIM != _ABIO32 */ +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigcontextinfo.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigcontextinfo.h new file mode 100644 index 0000000..f453c8d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigcontextinfo.h @@ -0,0 +1,43 @@ +/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + +#include + +#if _MIPS_SIM == _ABIO32 + +#define SIGCONTEXT unsigned long _code, struct sigcontext * +#define SIGCONTEXT_EXTRA_ARGS _code, +#define GET_PC(ctx) ((void *) ctx->sc_pc) +#define GET_FRAME(ctx) ((void *) ctx->sc_regs[30]) +#define GET_STACK(ctx) ((void *) ctx->sc_regs[29]) +#define CALL_SIGHANDLER(handler, signo, ctx) \ + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) + +#else + +#define SIGCONTEXT unsigned long _code, ucontext_t * +#define SIGCONTEXT_EXTRA_ARGS _code, +#define GET_PC(ctx) ((void *) ctx->uc_mcontext.pc) +#define GET_FRAME(ctx) ((void *) ctx->uc_mcontext.gregs[30]) +#define GET_STACK(ctx) ((void *) ctx->uc_mcontext.gregs[29]) +#define CALL_SIGHANDLER(handler, signo, ctx) \ + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/siginfo.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/siginfo.h new file mode 100644 index 0000000..ba3e1f6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/siginfo.h @@ -0,0 +1,311 @@ +/* siginfo_t, sigevent and constants. Linux/MIPS version. + Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _SIGNAL_H && !defined __need_siginfo_t \ + && !defined __need_sigevent_t +# error "Never include this file directly. Use instead" +#endif + +#include + +#if (!defined __have_sigval_t \ + && (defined _SIGNAL_H || defined __need_siginfo_t \ + || defined __need_sigevent_t)) +# define __have_sigval_t 1 + +/* Type for data associated with a signal. */ +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +#endif + +#if (!defined __have_siginfo_t \ + && (defined _SIGNAL_H || defined __need_siginfo_t)) +# define __have_siginfo_t 1 + +# define __SI_MAX_SIZE 128 +# if __WORDSIZE == 64 +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) +# else +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) +# endif + + +typedef struct siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Signal code. */ + int si_errno; /* If non-zero, an errno value associated with + this signal, as defined in . */ + int __pad0[__SI_MAX_SIZE / sizeof (int) - __SI_PAD_SIZE - 3]; + /* Explicit padding. */ + + union + { + int _pad[__SI_PAD_SIZE]; + + /* kill(). */ + struct + { + __pid_t si_pid; /* Sending process ID. */ + __uid_t si_uid; /* Real user ID of sending process. */ + } _kill; + + /* SIGCHLD. */ + struct + { + __pid_t si_pid; /* Which child. */ + __uid_t si_uid; /* Real user ID of sending process. */ + int si_status; /* Exit value or signal. */ + __clock_t si_utime; + __clock_t si_stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ + struct + { + void *si_addr; /* Faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL. */ + struct + { + int si_band; /* Band event for SIGPOLL. */ + int si_fd; + } _sigpoll; + + /* POSIX.1b timers. */ + struct + { + unsigned int _timer1; + unsigned int _timer2; + } _timer; + + /* POSIX.1b signals. */ + struct + { + __pid_t si_pid; /* Sending process ID. */ + __uid_t si_uid; /* Real user ID of sending process. */ + sigval_t si_sigval; /* Signal value. */ + } _rt; + } _sifields; + } siginfo_t; + + +/* X/Open requires some more fields with fixed names. */ +# define si_pid _sifields._kill.si_pid +# define si_uid _sifields._kill.si_uid +# define si_status _sifields._sigchld.si_status +# define si_utime _sifields._sigchld.si_utime +# define si_stime _sifields._sigchld.si_stime +# define si_value _sifields._rt.si_sigval +# define si_int _sifields._rt.si_sigval.sival_int +# define si_ptr _sifields._rt.si_sigval.sival_ptr +# define si_addr _sifields._sigfault.si_addr +# define si_band _sifields._sigpoll.si_band +# define si_fd _sifields._sigpoll.si_fd + + +/* Values for `si_code'. Positive values are reserved for kernel-generated + signals. */ +enum +{ + SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */ +# define SI_ASYNCNL SI_ASYNCNL + SI_TKILL = -6, /* Sent by tkill. */ +# define SI_TKILL SI_TKILL + SI_SIGIO, /* Sent by queued SIGIO. */ +# define SI_SIGIO SI_SIGIO + SI_MESGQ, /* Sent by real time mesq state change. */ +# define SI_MESGQ SI_MESGQ + SI_TIMER, /* Sent by real time mesq state change. */ +# define SI_TIMER SI_TIMER + SI_ASYNCIO, /* Sent by AIO completion. */ +# define SI_ASYNCIO SI_ASYNCIO + SI_QUEUE, /* Sent by sigqueue. */ +# define SI_QUEUE SI_QUEUE + SI_USER, /* Sent by kill, sigsend, raise. */ +# define SI_USER SI_USER + SI_KERNEL = 0x80 /* Send by kernel. */ +#define SI_KERNEL SI_KERNEL +}; + + +/* `si_code' values for SIGILL signal. */ +enum +{ + ILL_ILLOPC = 1, /* Illegal opcode. */ +# define ILL_ILLOPC ILL_ILLOPC + ILL_ILLOPN, /* Illegal operand. */ +# define ILL_ILLOPN ILL_ILLOPN + ILL_ILLADR, /* Illegal addressing mode. */ +# define ILL_ILLADR ILL_ILLADR + ILL_ILLTRP, /* Illegal trap. */ +# define ILL_ILLTRP ILL_ILLTRP + ILL_PRVOPC, /* Privileged opcode. */ +# define ILL_PRVOPC ILL_PRVOPC + ILL_PRVREG, /* Privileged register. */ +# define ILL_PRVREG ILL_PRVREG + ILL_COPROC, /* Coprocessor error. */ +# define ILL_COPROC ILL_COPROC + ILL_BADSTK /* Internal stack error. */ +# define ILL_BADSTK ILL_BADSTK +}; + +/* `si_code' values for SIGFPE signal. */ +enum +{ + FPE_INTDIV = 1, /* Integer divide by zero. */ +# define FPE_INTDIV FPE_INTDIV + FPE_INTOVF, /* Integer overflow. */ +# define FPE_INTOVF FPE_INTOVF + FPE_FLTDIV, /* Floating point divide by zero. */ +# define FPE_FLTDIV FPE_FLTDIV + FPE_FLTOVF, /* Floating point overflow. */ +# define FPE_FLTOVF FPE_FLTOVF + FPE_FLTUND, /* Floating point underflow. */ +# define FPE_FLTUND FPE_FLTUND + FPE_FLTRES, /* Floating point inexact result. */ +# define FPE_FLTRES FPE_FLTRES + FPE_FLTINV, /* Floating point invalid operation. */ +# define FPE_FLTINV FPE_FLTINV + FPE_FLTSUB /* Subscript out of range. */ +# define FPE_FLTSUB FPE_FLTSUB +}; + +/* `si_code' values for SIGSEGV signal. */ +enum +{ + SEGV_MAPERR = 1, /* Address not mapped to object. */ +# define SEGV_MAPERR SEGV_MAPERR + SEGV_ACCERR /* Invalid permissions for mapped object. */ +# define SEGV_ACCERR SEGV_ACCERR +}; + +/* `si_code' values for SIGBUS signal. */ +enum +{ + BUS_ADRALN = 1, /* Invalid address alignment. */ +# define BUS_ADRALN BUS_ADRALN + BUS_ADRERR, /* Non-existant physical address. */ +# define BUS_ADRERR BUS_ADRERR + BUS_OBJERR /* Object specific hardware error. */ +# define BUS_OBJERR BUS_OBJERR +}; + +/* `si_code' values for SIGTRAP signal. */ +enum +{ + TRAP_BRKPT = 1, /* Process breakpoint. */ +# define TRAP_BRKPT TRAP_BRKPT + TRAP_TRACE /* Process trace trap. */ +# define TRAP_TRACE TRAP_TRACE +}; + +/* `si_code' values for SIGCHLD signal. */ +enum +{ + CLD_EXITED = 1, /* Child has exited. */ +# define CLD_EXITED CLD_EXITED + CLD_KILLED, /* Child was killed. */ +# define CLD_KILLED CLD_KILLED + CLD_DUMPED, /* Child terminated abnormally. */ +# define CLD_DUMPED CLD_DUMPED + CLD_TRAPPED, /* Traced child has trapped. */ +# define CLD_TRAPPED CLD_TRAPPED + CLD_STOPPED, /* Child has stopped. */ +# define CLD_STOPPED CLD_STOPPED + CLD_CONTINUED /* Stopped child has continued. */ +# define CLD_CONTINUED CLD_CONTINUED +}; + +/* `si_code' values for SIGPOLL signal. */ +enum +{ + POLL_IN = 1, /* Data input available. */ +# define POLL_IN POLL_IN + POLL_OUT, /* Output buffers available. */ +# define POLL_OUT POLL_OUT + POLL_MSG, /* Input message available. */ +# define POLL_MSG POLL_MSG + POLL_ERR, /* I/O error. */ +# define POLL_ERR POLL_ERR + POLL_PRI, /* High priority input available. */ +# define POLL_PRI POLL_PRI + POLL_HUP /* Device disconnected. */ +# define POLL_HUP POLL_HUP +}; + +# undef __need_siginfo_t +#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ + + +#if (defined _SIGNAL_H || defined __need_sigevent_t) \ + && !defined __have_sigevent_t +# define __have_sigevent_t 1 + +/* Structure to transport application-defined values with signals. */ +# define __SIGEV_MAX_SIZE 64 +# define __SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int)) +# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE - __SIGEV_HEAD_SIZE) / sizeof (int)) + +/* Forward declaration of the `pthread_attr_t' type. */ +struct __pthread_attr_s; + +/* XXX This one might need to change!!! */ +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[__SIGEV_PAD_SIZE]; + + struct + { + void (*_function) (sigval_t); /* Function to start. */ + void *_attribute; /* Really pthread_attr_t. */ + } _sigev_thread; + } _sigev_un; + } sigevent_t; + +/* POSIX names to access some of the members. */ +# define sigev_notify_function _sigev_un._sigev_thread._function +# define sigev_notify_attributes _sigev_un._sigev_thread._attribute + +/* `sigev_notify' values. */ +enum +{ + SIGEV_SIGNAL = 0, /* Notify via signal. */ +# define SIGEV_SIGNAL SIGEV_SIGNAL + SIGEV_NONE, /* Other notification: meaningless. */ +# define SIGEV_NONE SIGEV_NONE + SIGEV_THREAD, /* Deliver via thread creation. */ +# define SIGEV_THREAD SIGEV_THREAD + + SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ +#define SIGEV_THREAD_ID SIGEV_THREAD_ID +}; + +#endif /* have _SIGNAL_H. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/signum.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/signum.h new file mode 100644 index 0000000..a9b6848 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/signum.h @@ -0,0 +1,79 @@ +/* Signal number definitions. Linux version. + Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef _SIGNAL_H + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ + +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +#endif + + +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGEMT 7 +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* BUS error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ +#define SIGCHLD 18 /* Child status has changed (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGPWR 19 /* Power failure restart (System V). */ +#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ +#define SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ +#define SIGIO 22 /* I/O now possible (4.2 BSD). */ +#define SIGPOLL SIGIO /* Pollable event occurred (System V). */ +#define SIGSTOP 23 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 24 /* Keyboard stop (POSIX). */ +#define SIGCONT 25 /* Continue (POSIX). */ +#define SIGTTIN 26 /* Background read from tty (POSIX). */ +#define SIGTTOU 27 /* Background write to tty (POSIX). */ +#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ +#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ + + +#define _NSIG 128 /* Biggest signal number + 1 + (including real-time signals). */ + +#define SIGRTMIN (__libc_current_sigrtmin ()) +#define SIGRTMAX (__libc_current_sigrtmax ()) + +/* These are the hard limits of the kernel. These values should not be + used directly at user level. */ +#define __SIGRTMIN 32 +#define __SIGRTMAX (_NSIG - 1) + +#endif /* included. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigset.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigset.h new file mode 100644 index 0000000..7ccadda --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigset.h @@ -0,0 +1,125 @@ +/* __sig_atomic_t, __sigset_t, and related definitions. Linux version. + Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGSET_H_types +# define _SIGSET_H_types 1 + +typedef int __sig_atomic_t; + +/* A `sigset_t' has a bit for each signal. */ + +# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) +typedef struct + { + unsigned long int __val[_SIGSET_NWORDS]; + } __sigset_t; + +#endif + + +/* We only want to define these functions if was actually + included; otherwise we were included just to define the types. Since we + are namespace-clean, it wouldn't hurt to define extra macros. But + trouble can be caused by functions being defined (e.g., any global + register vars declared later will cause compilation errors). */ + +#if !defined _SIGSET_H_fns && defined _SIGNAL_H +# define _SIGSET_H_fns 1 + +# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE extern __inline +# endif + +/* Return a mask that includes the bit for SIG only. */ +# define __sigmask(sig) \ + (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int)))) + +/* Return the word index for SIG. */ +# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int))) + +# if defined __GNUC__ && __GNUC__ >= 2 +# define __sigemptyset(set) \ + (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ + sigset_t *__set = (set); \ + while (--__cnt >= 0) __set->__val[__cnt] = 0; \ + 0; })) +# define __sigfillset(set) \ + (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ + sigset_t *__set = (set); \ + while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \ + 0; })) + +# ifdef __USE_GNU +/* The POSIX does not specify for handling the whole signal set in one + command. This is often wanted and so we define three more functions + here. */ +# define __sigisemptyset(set) \ + (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ + const sigset_t *__set = (set); \ + int __ret = __set->__val[--__cnt]; \ + while (!__ret && --__cnt >= 0) \ + __ret = __set->__val[__cnt]; \ + __ret == 0; })) +# define __sigandset(dest, left, right) \ + (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ + sigset_t *__dest = (dest); \ + const sigset_t *__left = (left); \ + const sigset_t *__right = (right); \ + while (--__cnt >= 0) \ + __dest->__val[__cnt] = (__left->__val[__cnt] \ + & __right->__val[__cnt]); \ + 0; })) +# define __sigorset(dest, left, right) \ + (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ + sigset_t *__dest = (dest); \ + const sigset_t *__left = (left); \ + const sigset_t *__right = (right); \ + while (--__cnt >= 0) \ + __dest->__val[__cnt] = (__left->__val[__cnt] \ + | __right->__val[__cnt]); \ + 0; })) +# endif +# endif + +/* These functions needn't check for a bogus signal number -- error + checking is done in the non __ versions. */ + +extern int __sigismember (__const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); + +# ifdef __USE_EXTERN_INLINES +# define __SIGSETFN(NAME, BODY, CONST) \ + _EXTERN_INLINE int \ + NAME (CONST __sigset_t *__set, int __sig) \ + { \ + unsigned long int __mask = __sigmask (__sig); \ + unsigned long int __word = __sigword (__sig); \ + return BODY; \ + } + +__SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const) +__SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), ) +__SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) + +# undef __SIGSETFN +# endif + + +#endif /* ! _SIGSET_H_fns. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigstack.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigstack.h new file mode 100644 index 0000000..d2c8552 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigstack.h @@ -0,0 +1,55 @@ +/* sigstack, sigaltstack definitions. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include this file directly. Use instead" +#endif + + +/* Structure describing a signal stack (obsolete). */ +struct sigstack + { + void *ss_sp; /* Signal stack pointer. */ + int ss_onstack; /* Nonzero if executing on this stack. */ + }; + + +/* Possible values for `ss_flags.'. */ +enum +{ + SS_ONSTACK = 1, +#define SS_ONSTACK SS_ONSTACK + SS_DISABLE +#define SS_DISABLE SS_DISABLE +}; + +/* Minimum stack size for a signal handler. */ +#define MINSIGSTKSZ 2048 + +/* System default stack size. */ +#define SIGSTKSZ 8192 + + +/* Alternate, preferred interface. */ +typedef struct sigaltstack + { + void *ss_sp; + size_t ss_size; + int ss_flags; + } stack_t; diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigthread.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigthread.h new file mode 100644 index 0000000..960bde1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sigthread.h @@ -0,0 +1,38 @@ +/* Signal handling function for threaded programs. + Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _BITS_SIGTHREAD_H +#define _BITS_SIGTHREAD_H 1 + +#if !defined _SIGNAL_H && !defined _PTHREAD_H +# error "Never include this file directly. Use instead" +#endif + +/* Functions for handling signals. */ + +/* Modify the signal mask for the calling thread. The arguments have + the same meaning as for sigprocmask(2). */ +extern int pthread_sigmask (int __how, + __const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__THROW; + +/* Send signal SIGNO to the given thread. */ +extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; + +#endif /* bits/sigthread.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sockaddr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sockaddr.h new file mode 100644 index 0000000..3e1d131 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sockaddr.h @@ -0,0 +1,40 @@ +/* Definition of `struct sockaddr_*' common members. Generic/4.2 BSD version. + Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; use instead. + */ + +#ifndef _BITS_SOCKADDR_H +#define _BITS_SOCKADDR_H 1 + + +/* POSIX.1g specifies this type name for the `sa_family' member. */ +typedef unsigned short int sa_family_t; + +/* This macro is used to declare the initial common members + of the data types used for socket addresses, `struct sockaddr', + `struct sockaddr_in', `struct sockaddr_un', etc. */ + +#define __SOCKADDR_COMMON(sa_prefix) \ + sa_family_t sa_prefix##family + +#define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int)) + +#endif /* bits/sockaddr.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/socket.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/socket.h new file mode 100644 index 0000000..414d0e8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/socket.h @@ -0,0 +1,328 @@ +/* System-specific socket constants and types. Linux/MIPS version. + Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004, 2005, 2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __BITS_SOCKET_H +#define __BITS_SOCKET_H + +#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H +# error "Never include directly; use instead." +#endif + +#define __need_size_t +#define __need_NULL +#include + +#include +#include + +/* Type for length arguments in socket calls. */ +#ifndef __socklen_t_defined +typedef __socklen_t socklen_t; +# define __socklen_t_defined +#endif + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_DGRAM = 1, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_STREAM = 2, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET + SOCK_PACKET = 10 /* Linux specific way of getting packets + at the dev level. For writing rarp and + other similar things on the user level. */ +#define SOCK_PACKET SOCK_PACKET +}; + +/* Protocol families. */ +#define PF_UNSPEC 0 /* Unspecified. */ +#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ +#define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ +#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ +#define PF_INET 2 /* IP protocol family. */ +#define PF_AX25 3 /* Amateur Radio AX.25. */ +#define PF_IPX 4 /* Novell Internet Protocol. */ +#define PF_APPLETALK 5 /* Appletalk DDP. */ +#define PF_NETROM 6 /* Amateur radio NetROM. */ +#define PF_BRIDGE 7 /* Multiprotocol bridge. */ +#define PF_ATMPVC 8 /* ATM PVCs. */ +#define PF_X25 9 /* Reserved for X.25 project. */ +#define PF_INET6 10 /* IP version 6. */ +#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */ +#define PF_DECnet 12 /* Reserved for DECnet project. */ +#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */ +#define PF_SECURITY 14 /* Security callback pseudo AF. */ +#define PF_KEY 15 /* PF_KEY key management API. */ +#define PF_NETLINK 16 +#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ +#define PF_PACKET 17 /* Packet family. */ +#define PF_ASH 18 /* Ash. */ +#define PF_ECONET 19 /* Acorn Econet. */ +#define PF_ATMSVC 20 /* ATM SVCs. */ +#define PF_SNA 22 /* Linux SNA Project */ +#define PF_IRDA 23 /* IRDA sockets. */ +#define PF_PPPOX 24 /* PPPoX sockets. */ +#define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ +#define PF_MAX 32 /* For now.. */ + +/* Address families. */ +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE +#define AF_INET PF_INET +#define AF_AX25 PF_AX25 +#define AF_IPX PF_IPX +#define AF_APPLETALK PF_APPLETALK +#define AF_NETROM PF_NETROM +#define AF_BRIDGE PF_BRIDGE +#define AF_ATMPVC PF_ATMPVC +#define AF_X25 PF_X25 +#define AF_INET6 PF_INET6 +#define AF_ROSE PF_ROSE +#define AF_DECnet PF_DECnet +#define AF_NETBEUI PF_NETBEUI +#define AF_SECURITY PF_SECURITY +#define AF_KEY PF_KEY +#define AF_NETLINK PF_NETLINK +#define AF_ROUTE PF_ROUTE +#define AF_PACKET PF_PACKET +#define AF_ASH PF_ASH +#define AF_ECONET PF_ECONET +#define AF_ATMSVC PF_ATMSVC +#define AF_SNA PF_SNA +#define AF_IRDA PF_IRDA +#define AF_PPPOX PF_PPPOX +#define AF_WANPIPE PF_WANPIPE +#define AF_BLUETOOTH PF_BLUETOOTH +#define AF_MAX PF_MAX + +/* Socket level values. Others are defined in the appropriate headers. + + XXX These definitions also should go into the appropriate headers as + far as they are available. */ +#define SOL_RAW 255 +#define SOL_DECNET 261 +#define SOL_X25 262 +#define SOL_PACKET 263 +#define SOL_ATM 264 /* ATM layer (cell level). */ +#define SOL_AAL 265 /* ATM Adaption Layer (packet level). */ +#define SOL_IRDA 266 + +/* Maximum queue length specifiable by listen. */ +#define SOMAXCONN 128 + +/* Get the definition of the macro to define the common sockaddr members. */ +#include + +/* Structure describing a generic socket address. */ +struct sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ + char sa_data[14]; /* Address data. */ + }; + + +/* Structure large enough to hold any socket address (with the historical + exception of AF_UNIX). We reserve 128 bytes. */ +#if ULONG_MAX > 0xffffffff +# define __ss_aligntype __uint64_t +#else +# define __ss_aligntype __uint32_t +#endif +#define _SS_SIZE 128 +#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype))) + +struct sockaddr_storage + { + __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + __ss_aligntype __ss_align; /* Force desired alignment. */ + char __ss_padding[_SS_PADSIZE]; + }; + + +/* Bits in the FLAGS argument to `send', `recv', et al. */ +enum + { + MSG_OOB = 0x01, /* Process out-of-band data. */ +#define MSG_OOB MSG_OOB + MSG_PEEK = 0x02, /* Peek at incoming messages. */ +#define MSG_PEEK MSG_PEEK + MSG_DONTROUTE = 0x04, /* Don't use local routing. */ +#define MSG_DONTROUTE MSG_DONTROUTE +#ifdef __USE_GNU + /* DECnet uses a different name. */ + MSG_TRYHARD = MSG_DONTROUTE, +# define MSG_TRYHARD MSG_DONTROUTE +#endif + MSG_CTRUNC = 0x08, /* Control data lost before delivery. */ +#define MSG_CTRUNC MSG_CTRUNC + MSG_PROXY = 0x10, /* Supply or ask second address. */ +#define MSG_PROXY MSG_PROXY + MSG_TRUNC = 0x20, +#define MSG_TRUNC MSG_TRUNC + MSG_DONTWAIT = 0x40, /* Nonblocking IO. */ +#define MSG_DONTWAIT MSG_DONTWAIT + MSG_EOR = 0x80, /* End of record. */ +#define MSG_EOR MSG_EOR + MSG_WAITALL = 0x100, /* Wait for a full request. */ +#define MSG_WAITALL MSG_WAITALL + MSG_FIN = 0x200, +#define MSG_FIN MSG_FIN + MSG_SYN = 0x400, +#define MSG_SYN MSG_SYN + MSG_CONFIRM = 0x800, /* Confirm path validity. */ +#define MSG_CONFIRM MSG_CONFIRM + MSG_RST = 0x1000, +#define MSG_RST MSG_RST + MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */ +#define MSG_ERRQUEUE MSG_ERRQUEUE + MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */ +#define MSG_NOSIGNAL MSG_NOSIGNAL + MSG_MORE = 0x8000 /* Sender will send more. */ +#define MSG_MORE MSG_MORE + }; + + +/* Structure describing messages sent by + `sendmsg' and received by `recvmsg'. */ +/* Note: do not change these members to match glibc; these match the + SuSv3 spec already (e.g. msg_iovlen/msg_controllen). + http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */ +/* Note: linux kernel uses __kernel_size_t (which is 8bytes on 64bit + platforms, and 4bytes on 32bit platforms) for msg_iovlen/msg_controllen */ +struct msghdr + { + void *msg_name; /* Address to send to/receive from. */ + socklen_t msg_namelen; /* Length of address data. */ + + struct iovec *msg_iov; /* Vector of data to send/receive into. */ +#if __WORDSIZE == 32 + int msg_iovlen; /* Number of elements in the vector. */ +#else + size_t msg_iovlen; /* Number of elements in the vector. */ +#endif + + void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ +#if __WORDSIZE == 32 + socklen_t msg_controllen; /* Ancillary data buffer length. */ +#else + size_t msg_controllen; /* Ancillary data buffer length. */ +#endif + + int msg_flags; /* Flags on received message. */ + }; + +/* Structure used for storage of ancillary data object information. */ +struct cmsghdr + { + size_t cmsg_len; /* Length of data in cmsg_data plus length + of cmsghdr structure. */ + int cmsg_level; /* Originating protocol. */ + int cmsg_type; /* Protocol specific type. */ +#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L + __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ +#endif + }; + +/* Ancillary data object manipulation macros. */ +#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L +# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) +#else +# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) +#endif +#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) +#define CMSG_FIRSTHDR(mhdr) \ + ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ + ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL) +#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ + & (size_t) ~(sizeof (size_t) - 1)) +#define CMSG_SPACE(len) (CMSG_ALIGN (len) \ + + CMSG_ALIGN (sizeof (struct cmsghdr))) +#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) + +extern struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, + struct cmsghdr *__cmsg)); +#ifdef __USE_EXTERN_INLINES +# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE extern __inline +# endif +_EXTERN_INLINE struct cmsghdr * +__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) +{ + if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) + /* The kernel header does this so there may be a reason. */ + return 0; + + __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + + CMSG_ALIGN (__cmsg->cmsg_len)); + if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control + + __mhdr->msg_controllen) + || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) + > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) + /* No more entries. */ + return 0; + return __cmsg; +} +#endif /* Use `extern inline'. */ + +/* Socket level message types. This must match the definitions in + . */ +enum + { + SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ +#define SCM_RIGHTS SCM_RIGHTS +#ifdef __USE_BSD + , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ +# define SCM_CREDENTIALS SCM_CREDENTIALS +#endif + }; + +/* User visible structure for SCM_CREDENTIALS message */ + +struct ucred +{ + pid_t pid; /* PID of sending process. */ + uid_t uid; /* UID of sending process. */ + gid_t gid; /* GID of sending process. */ +}; + +/* Get socket manipulation related informations from kernel headers. */ +#include + + +/* Structure used to manipulate the SO_LINGER option. */ +struct linger + { + int l_onoff; /* Nonzero to linger on close. */ + int l_linger; /* Time to linger. */ + }; + +#endif /* bits/socket.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stackinfo.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stackinfo.h new file mode 100644 index 0000000..86e3d62 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stackinfo.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file contains a bit of information about the stack allocation + of the processor. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +/* On MIPS the stack grows down. */ +#define _STACK_GROWS_DOWN 1 + +#endif /* stackinfo.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stat.h new file mode 100644 index 0000000..e35d649 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stat.h @@ -0,0 +1,203 @@ +/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STAT_H +# error "Never include directly; use instead." +#endif + +#include + +/* Versions of the `struct stat' data structure. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ + +/* Versions of the `xmknod' interface. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ + + +#if _MIPS_SIM == _ABIO32 +/* Structure describing file characteristics. */ +struct stat + { + __dev_t st_dev; + long int st_pad1[2]; +#ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; /* File serial number. */ +#else + __ino64_t st_ino; /* File serial number. */ +#endif + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ +#ifndef __USE_FILE_OFFSET64 + long int st_pad2[1]; + __off_t st_size; /* Size of file, in bytes. */ + /* SVR4 added this extra long to allow for expansion of off_t. */ + long int st_pad3; +#else + long int st_pad2[2]; + __off64_t st_size; /* Size of file, in bytes. */ +#endif + /* + * Actually this should be timestruc_t st_atime, st_mtime and + * st_ctime but we don't have it under Linux. + */ + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ +#ifndef __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ +#else + long int st_pad4; + __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ +#endif + long int st_pad5[14]; + }; +#else /* N32 || N64 */ +/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ +struct stat { + unsigned int st_dev; + int st_pad1[3]; + __ino_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + unsigned int st_rdev; /* Device number, if device. */ + int st_pad2[3]; + __off_t st_size; /* Size of file, in bytes. */ + /* + * Actually this should be timestruc_t st_atime, st_mtime and + * st_ctime but we don't have it under Linux. + */ + int st_atime; + int st_atimensec; + int st_mtime; + int st_mtimensec; + int st_ctime; + int st_ctimensec; + int st_blksize; /* Optimal block size for I/O. */ + int st_pad3; + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ + int st_pad4[14]; +}; +#endif /* N32 || N64 */ + +#ifdef __USE_LARGEFILE64 +#if _MIPS_SIM == _ABIO32 +struct stat64 + { + __dev_t st_dev; + long int st_pad1[2]; + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + long int st_pad2[2]; + __off64_t st_size; /* Size of file, in bytes. */ + /* + * Actually this should be timestruc_t st_atime, st_mtime and + * st_ctime but we don't have it under Linux. + */ + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + long int st_pad3; + __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ + long int st_pad4[14]; + }; +#else /* N32 || N64 */ +/* stat64 of N32/N64 is just an alias of stat syscall. */ +struct stat64 { + unsigned int st_dev; + int st_pad1[3]; + __ino_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + unsigned int st_rdev; /* Device number, if device. */ + int st_pad2[3]; + __off_t st_size; /* Size of file, in bytes. */ + /* + * Actually this should be timestruc_t st_atime, st_mtime and + * st_ctime but we don't have it under Linux. + */ + int st_atime; + int st_atimensec; + int st_mtime; + int st_mtimensec; + int st_ctime; + int st_ctimensec; + int st_blksize; /* Optimal block size for I/O. */ + int st_pad3; + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ + int st_pad4[14]; +}; +#endif /* N32 || N64 */ +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV + +/* Encoding of the file mode. */ + +#define __S_IFMT 0170000 /* These bits determine file type. */ + +/* File types. */ +#define __S_IFDIR 0040000 /* Directory. */ +#define __S_IFCHR 0020000 /* Character device. */ +#define __S_IFBLK 0060000 /* Block device. */ +#define __S_IFREG 0100000 /* Regular file. */ +#define __S_IFIFO 0010000 /* FIFO. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* POSIX.1b objects. Note that these macros always evaluate to zero. But + they do it by enforcing the correct use of the macros. */ +#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) + +/* Protection bits. */ + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/statfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/statfs.h new file mode 100644 index 0000000..2f9bd54 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/statfs.h @@ -0,0 +1,72 @@ +/* Copyright (C) 1997, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STATFS_H +# error "Never include directly; use instead." +#endif + +#include /* for __fsid_t and __fsblkcnt_t*/ + +struct statfs + { + long int f_type; +#define f_fstyp f_type + long int f_bsize; + long int f_frsize; /* Fragment size - unsupported */ +#ifndef __USE_FILE_OFFSET64 + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_files; + __fsblkcnt_t f_ffree; + __fsblkcnt_t f_bavail; +#else + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_files; + __fsblkcnt64_t f_ffree; + __fsblkcnt64_t f_bavail; +#endif + + /* Linux specials */ + __fsid_t f_fsid; + long int f_namelen; + long int f_spare[6]; + }; + +#ifdef __USE_LARGEFILE64 +struct statfs64 + { + long int f_type; +#define f_fstyp f_type + long int f_bsize; + long int f_frsize; /* Fragment size - unsupported */ + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_files; + __fsblkcnt64_t f_ffree; + __fsblkcnt64_t f_bavail; + + /* Linux specials */ + __fsid_t f_fsid; + long int f_namelen; + long int f_spare[6]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATFS_F_NAMELEN diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/statvfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/statvfs.h new file mode 100644 index 0000000..cca0871 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/statvfs.h @@ -0,0 +1,107 @@ +/* Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STATVFS_H +# error "Never include directly; use instead." +#endif + +#include /* For __fsblkcnt_t and __fsfilcnt_t. */ + +#if __WORDSIZE == 32 +#define _STATVFSBUF_F_UNUSED +#endif + +struct statvfs + { + unsigned long int f_bsize; + unsigned long int f_frsize; +#ifndef __USE_FILE_OFFSET64 + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_bavail; + __fsfilcnt_t f_files; + __fsfilcnt_t f_ffree; + __fsfilcnt_t f_favail; +#else + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; + __fsfilcnt64_t f_favail; +#endif + unsigned long int f_fsid; +#ifdef _STATVFSBUF_F_UNUSED + int __f_unused; +#endif + unsigned long int f_flag; + unsigned long int f_namemax; + int __f_spare[6]; + }; + +#ifdef __USE_LARGEFILE64 +struct statvfs64 + { + unsigned long int f_bsize; + unsigned long int f_frsize; + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; + __fsfilcnt64_t f_favail; + unsigned long int f_fsid; +#ifdef _STATVFSBUF_F_UNUSED + int __f_unused; +#endif + unsigned long int f_flag; + unsigned long int f_namemax; + int __f_spare[6]; + }; +#endif + +/* Definitions for the flag in `f_flag'. These definitions should be + kept in sync with the definitions in . */ +enum +{ + ST_RDONLY = 1, /* Mount read-only. */ +#define ST_RDONLY ST_RDONLY + ST_NOSUID = 2 /* Ignore suid and sgid bits. */ +#define ST_NOSUID ST_NOSUID +#ifdef __USE_GNU + , + ST_NODEV = 4, /* Disallow access to device special files. */ +# define ST_NODEV ST_NODEV + ST_NOEXEC = 8, /* Disallow program execution. */ +# define ST_NOEXEC ST_NOEXEC + ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ +# define ST_SYNCHRONOUS ST_SYNCHRONOUS + ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ +# define ST_MANDLOCK ST_MANDLOCK + ST_WRITE = 128, /* Write on file/directory/symlink. */ +# define ST_WRITE ST_WRITE + ST_APPEND = 256, /* Append-only file. */ +# define ST_APPEND ST_APPEND + ST_IMMUTABLE = 512, /* Immutable file. */ +# define ST_IMMUTABLE ST_IMMUTABLE + ST_NOATIME = 1024, /* Do not update access times. */ +# define ST_NOATIME ST_NOATIME + ST_NODIRATIME = 2048 /* Do not update directory access times. */ +# define ST_NODIRATIME ST_NODIRATIME +#endif /* Use GNU. */ +}; diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stdio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stdio.h new file mode 100644 index 0000000..d0ba463 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stdio.h @@ -0,0 +1,23 @@ +/* Optimizing macros and inline functions for stdio functions. + Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _STDIO_H +# error "Never include directly; use instead." +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stdio_lim.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stdio_lim.h new file mode 100644 index 0000000..ea6d693 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/stdio_lim.h @@ -0,0 +1,41 @@ +/* Copyright (C) 1994, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX +# error "Never include directly; use instead." +#endif + +#ifdef _STDIO_H +# define L_tmpnam 20 +# define TMP_MAX 238328 +# define FILENAME_MAX 4095 + +# ifdef __USE_POSIX +# define L_ctermid 9 +# define L_cuserid 9 +# endif +#endif + +#if defined __need_FOPEN_MAX || defined _STDIO_H +# undef FOPEN_MAX +# define FOPEN_MAX 16 +#endif + +#if defined __need_IOV_MAX && !defined IOV_MAX +# define IOV_MAX 1024 +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/syscalls.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/syscalls.h new file mode 100644 index 0000000..8c87d6d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/syscalls.h @@ -0,0 +1 @@ +/* Dont use _syscall#() macros; use the syscall() function */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sysnum.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sysnum.h new file mode 100644 index 0000000..bccf8b8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/sysnum.h @@ -0,0 +1,1028 @@ +/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */ + +#ifndef _BITS_SYSNUM_H +#define _BITS_SYSNUM_H + +#ifndef _SYSCALL_H +# error "Never use directly; include instead." +#endif + +#undef __NR_Linux +#define __NR_Linux 4000 +#define SYS_Linux __NR_Linux +#undef __NR_syscall +#define __NR_syscall (4000 + 0) +#define SYS_syscall __NR_syscall +#undef __NR_exit +#define __NR_exit (4000 + 1) +#define SYS_exit __NR_exit +#undef __NR_fork +#define __NR_fork (4000 + 2) +#define SYS_fork __NR_fork +#undef __NR_read +#define __NR_read (4000 + 3) +#define SYS_read __NR_read +#undef __NR_write +#define __NR_write (4000 + 4) +#define SYS_write __NR_write +#undef __NR_open +#define __NR_open (4000 + 5) +#define SYS_open __NR_open +#undef __NR_close +#define __NR_close (4000 + 6) +#define SYS_close __NR_close +#undef __NR_waitpid +#define __NR_waitpid (4000 + 7) +#define SYS_waitpid __NR_waitpid +#undef __NR_creat +#define __NR_creat (4000 + 8) +#define SYS_creat __NR_creat +#undef __NR_link +#define __NR_link (4000 + 9) +#define SYS_link __NR_link +#undef __NR_unlink +#define __NR_unlink (4000 + 10) +#define SYS_unlink __NR_unlink +#undef __NR_execve +#define __NR_execve (4000 + 11) +#define SYS_execve __NR_execve +#undef __NR_chdir +#define __NR_chdir (4000 + 12) +#define SYS_chdir __NR_chdir +#undef __NR_time +#define __NR_time (4000 + 13) +#define SYS_time __NR_time +#undef __NR_mknod +#define __NR_mknod (4000 + 14) +#define SYS_mknod __NR_mknod +#undef __NR_chmod +#define __NR_chmod (4000 + 15) +#define SYS_chmod __NR_chmod +#undef __NR_lchown +#define __NR_lchown (4000 + 16) +#define SYS_lchown __NR_lchown +#undef __NR_break +#define __NR_break (4000 + 17) +#define SYS_break __NR_break +#undef __NR_unused18 +#define __NR_unused18 (4000 + 18) +#define SYS_unused18 __NR_unused18 +#undef __NR_lseek +#define __NR_lseek (4000 + 19) +#define SYS_lseek __NR_lseek +#undef __NR_getpid +#define __NR_getpid (4000 + 20) +#define SYS_getpid __NR_getpid +#undef __NR_mount +#define __NR_mount (4000 + 21) +#define SYS_mount __NR_mount +#undef __NR_umount +#define __NR_umount (4000 + 22) +#define SYS_umount __NR_umount +#undef __NR_setuid +#define __NR_setuid (4000 + 23) +#define SYS_setuid __NR_setuid +#undef __NR_getuid +#define __NR_getuid (4000 + 24) +#define SYS_getuid __NR_getuid +#undef __NR_stime +#define __NR_stime (4000 + 25) +#define SYS_stime __NR_stime +#undef __NR_ptrace +#define __NR_ptrace (4000 + 26) +#define SYS_ptrace __NR_ptrace +#undef __NR_alarm +#define __NR_alarm (4000 + 27) +#define SYS_alarm __NR_alarm +#undef __NR_unused28 +#define __NR_unused28 (4000 + 28) +#define SYS_unused28 __NR_unused28 +#undef __NR_pause +#define __NR_pause (4000 + 29) +#define SYS_pause __NR_pause +#undef __NR_utime +#define __NR_utime (4000 + 30) +#define SYS_utime __NR_utime +#undef __NR_stty +#define __NR_stty (4000 + 31) +#define SYS_stty __NR_stty +#undef __NR_gtty +#define __NR_gtty (4000 + 32) +#define SYS_gtty __NR_gtty +#undef __NR_access +#define __NR_access (4000 + 33) +#define SYS_access __NR_access +#undef __NR_nice +#define __NR_nice (4000 + 34) +#define SYS_nice __NR_nice +#undef __NR_ftime +#define __NR_ftime (4000 + 35) +#define SYS_ftime __NR_ftime +#undef __NR_sync +#define __NR_sync (4000 + 36) +#define SYS_sync __NR_sync +#undef __NR_kill +#define __NR_kill (4000 + 37) +#define SYS_kill __NR_kill +#undef __NR_rename +#define __NR_rename (4000 + 38) +#define SYS_rename __NR_rename +#undef __NR_mkdir +#define __NR_mkdir (4000 + 39) +#define SYS_mkdir __NR_mkdir +#undef __NR_rmdir +#define __NR_rmdir (4000 + 40) +#define SYS_rmdir __NR_rmdir +#undef __NR_dup +#define __NR_dup (4000 + 41) +#define SYS_dup __NR_dup +#undef __NR_pipe +#define __NR_pipe (4000 + 42) +#define SYS_pipe __NR_pipe +#undef __NR_times +#define __NR_times (4000 + 43) +#define SYS_times __NR_times +#undef __NR_prof +#define __NR_prof (4000 + 44) +#define SYS_prof __NR_prof +#undef __NR_brk +#define __NR_brk (4000 + 45) +#define SYS_brk __NR_brk +#undef __NR_setgid +#define __NR_setgid (4000 + 46) +#define SYS_setgid __NR_setgid +#undef __NR_getgid +#define __NR_getgid (4000 + 47) +#define SYS_getgid __NR_getgid +#undef __NR_signal +#define __NR_signal (4000 + 48) +#define SYS_signal __NR_signal +#undef __NR_geteuid +#define __NR_geteuid (4000 + 49) +#define SYS_geteuid __NR_geteuid +#undef __NR_getegid +#define __NR_getegid (4000 + 50) +#define SYS_getegid __NR_getegid +#undef __NR_acct +#define __NR_acct (4000 + 51) +#define SYS_acct __NR_acct +#undef __NR_umount2 +#define __NR_umount2 (4000 + 52) +#define SYS_umount2 __NR_umount2 +#undef __NR_lock +#define __NR_lock (4000 + 53) +#define SYS_lock __NR_lock +#undef __NR_ioctl +#define __NR_ioctl (4000 + 54) +#define SYS_ioctl __NR_ioctl +#undef __NR_fcntl +#define __NR_fcntl (4000 + 55) +#define SYS_fcntl __NR_fcntl +#undef __NR_mpx +#define __NR_mpx (4000 + 56) +#define SYS_mpx __NR_mpx +#undef __NR_setpgid +#define __NR_setpgid (4000 + 57) +#define SYS_setpgid __NR_setpgid +#undef __NR_ulimit +#define __NR_ulimit (4000 + 58) +#define SYS_ulimit __NR_ulimit +#undef __NR_unused59 +#define __NR_unused59 (4000 + 59) +#define SYS_unused59 __NR_unused59 +#undef __NR_umask +#define __NR_umask (4000 + 60) +#define SYS_umask __NR_umask +#undef __NR_chroot +#define __NR_chroot (4000 + 61) +#define SYS_chroot __NR_chroot +#undef __NR_ustat +#define __NR_ustat (4000 + 62) +#define SYS_ustat __NR_ustat +#undef __NR_dup2 +#define __NR_dup2 (4000 + 63) +#define SYS_dup2 __NR_dup2 +#undef __NR_getppid +#define __NR_getppid (4000 + 64) +#define SYS_getppid __NR_getppid +#undef __NR_getpgrp +#define __NR_getpgrp (4000 + 65) +#define SYS_getpgrp __NR_getpgrp +#undef __NR_setsid +#define __NR_setsid (4000 + 66) +#define SYS_setsid __NR_setsid +#undef __NR_sigaction +#define __NR_sigaction (4000 + 67) +#define SYS_sigaction __NR_sigaction +#undef __NR_sgetmask +#define __NR_sgetmask (4000 + 68) +#define SYS_sgetmask __NR_sgetmask +#undef __NR_ssetmask +#define __NR_ssetmask (4000 + 69) +#define SYS_ssetmask __NR_ssetmask +#undef __NR_setreuid +#define __NR_setreuid (4000 + 70) +#define SYS_setreuid __NR_setreuid +#undef __NR_setregid +#define __NR_setregid (4000 + 71) +#define SYS_setregid __NR_setregid +#undef __NR_sigsuspend +#define __NR_sigsuspend (4000 + 72) +#define SYS_sigsuspend __NR_sigsuspend +#undef __NR_sigpending +#define __NR_sigpending (4000 + 73) +#define SYS_sigpending __NR_sigpending +#undef __NR_sethostname +#define __NR_sethostname (4000 + 74) +#define SYS_sethostname __NR_sethostname +#undef __NR_setrlimit +#define __NR_setrlimit (4000 + 75) +#define SYS_setrlimit __NR_setrlimit +#undef __NR_getrlimit +#define __NR_getrlimit (4000 + 76) +#define SYS_getrlimit __NR_getrlimit +#undef __NR_getrusage +#define __NR_getrusage (4000 + 77) +#define SYS_getrusage __NR_getrusage +#undef __NR_gettimeofday +#define __NR_gettimeofday (4000 + 78) +#define SYS_gettimeofday __NR_gettimeofday +#undef __NR_settimeofday +#define __NR_settimeofday (4000 + 79) +#define SYS_settimeofday __NR_settimeofday +#undef __NR_getgroups +#define __NR_getgroups (4000 + 80) +#define SYS_getgroups __NR_getgroups +#undef __NR_setgroups +#define __NR_setgroups (4000 + 81) +#define SYS_setgroups __NR_setgroups +#undef __NR_reserved82 +#define __NR_reserved82 (4000 + 82) +#define SYS_reserved82 __NR_reserved82 +#undef __NR_symlink +#define __NR_symlink (4000 + 83) +#define SYS_symlink __NR_symlink +#undef __NR_unused84 +#define __NR_unused84 (4000 + 84) +#define SYS_unused84 __NR_unused84 +#undef __NR_readlink +#define __NR_readlink (4000 + 85) +#define SYS_readlink __NR_readlink +#undef __NR_uselib +#define __NR_uselib (4000 + 86) +#define SYS_uselib __NR_uselib +#undef __NR_swapon +#define __NR_swapon (4000 + 87) +#define SYS_swapon __NR_swapon +#undef __NR_reboot +#define __NR_reboot (4000 + 88) +#define SYS_reboot __NR_reboot +#undef __NR_readdir +#define __NR_readdir (4000 + 89) +#define SYS_readdir __NR_readdir +#undef __NR_mmap +#define __NR_mmap (4000 + 90) +#define SYS_mmap __NR_mmap +#undef __NR_munmap +#define __NR_munmap (4000 + 91) +#define SYS_munmap __NR_munmap +#undef __NR_truncate +#define __NR_truncate (4000 + 92) +#define SYS_truncate __NR_truncate +#undef __NR_ftruncate +#define __NR_ftruncate (4000 + 93) +#define SYS_ftruncate __NR_ftruncate +#undef __NR_fchmod +#define __NR_fchmod (4000 + 94) +#define SYS_fchmod __NR_fchmod +#undef __NR_fchown +#define __NR_fchown (4000 + 95) +#define SYS_fchown __NR_fchown +#undef __NR_getpriority +#define __NR_getpriority (4000 + 96) +#define SYS_getpriority __NR_getpriority +#undef __NR_setpriority +#define __NR_setpriority (4000 + 97) +#define SYS_setpriority __NR_setpriority +#undef __NR_profil +#define __NR_profil (4000 + 98) +#define SYS_profil __NR_profil +#undef __NR_statfs +#define __NR_statfs (4000 + 99) +#define SYS_statfs __NR_statfs +#undef __NR_fstatfs +#define __NR_fstatfs (4000 + 100) +#define SYS_fstatfs __NR_fstatfs +#undef __NR_ioperm +#define __NR_ioperm (4000 + 101) +#define SYS_ioperm __NR_ioperm +#undef __NR_socketcall +#define __NR_socketcall (4000 + 102) +#define SYS_socketcall __NR_socketcall +#undef __NR_syslog +#define __NR_syslog (4000 + 103) +#define SYS_syslog __NR_syslog +#undef __NR_setitimer +#define __NR_setitimer (4000 + 104) +#define SYS_setitimer __NR_setitimer +#undef __NR_getitimer +#define __NR_getitimer (4000 + 105) +#define SYS_getitimer __NR_getitimer +#undef __NR_stat +#define __NR_stat (4000 + 106) +#define SYS_stat __NR_stat +#undef __NR_lstat +#define __NR_lstat (4000 + 107) +#define SYS_lstat __NR_lstat +#undef __NR_fstat +#define __NR_fstat (4000 + 108) +#define SYS_fstat __NR_fstat +#undef __NR_unused109 +#define __NR_unused109 (4000 + 109) +#define SYS_unused109 __NR_unused109 +#undef __NR_iopl +#define __NR_iopl (4000 + 110) +#define SYS_iopl __NR_iopl +#undef __NR_vhangup +#define __NR_vhangup (4000 + 111) +#define SYS_vhangup __NR_vhangup +#undef __NR_idle +#define __NR_idle (4000 + 112) +#define SYS_idle __NR_idle +#undef __NR_vm86 +#define __NR_vm86 (4000 + 113) +#define SYS_vm86 __NR_vm86 +#undef __NR_wait4 +#define __NR_wait4 (4000 + 114) +#define SYS_wait4 __NR_wait4 +#undef __NR_swapoff +#define __NR_swapoff (4000 + 115) +#define SYS_swapoff __NR_swapoff +#undef __NR_sysinfo +#define __NR_sysinfo (4000 + 116) +#define SYS_sysinfo __NR_sysinfo +#undef __NR_ipc +#define __NR_ipc (4000 + 117) +#define SYS_ipc __NR_ipc +#undef __NR_fsync +#define __NR_fsync (4000 + 118) +#define SYS_fsync __NR_fsync +#undef __NR_sigreturn +#define __NR_sigreturn (4000 + 119) +#define SYS_sigreturn __NR_sigreturn +#undef __NR_clone +#define __NR_clone (4000 + 120) +#define SYS_clone __NR_clone +#undef __NR_setdomainname +#define __NR_setdomainname (4000 + 121) +#define SYS_setdomainname __NR_setdomainname +#undef __NR_uname +#define __NR_uname (4000 + 122) +#define SYS_uname __NR_uname +#undef __NR_modify_ldt +#define __NR_modify_ldt (4000 + 123) +#define SYS_modify_ldt __NR_modify_ldt +#undef __NR_adjtimex +#define __NR_adjtimex (4000 + 124) +#define SYS_adjtimex __NR_adjtimex +#undef __NR_mprotect +#define __NR_mprotect (4000 + 125) +#define SYS_mprotect __NR_mprotect +#undef __NR_sigprocmask +#define __NR_sigprocmask (4000 + 126) +#define SYS_sigprocmask __NR_sigprocmask +#undef __NR_create_module +#define __NR_create_module (4000 + 127) +#define SYS_create_module __NR_create_module +#undef __NR_init_module +#define __NR_init_module (4000 + 128) +#define SYS_init_module __NR_init_module +#undef __NR_delete_module +#define __NR_delete_module (4000 + 129) +#define SYS_delete_module __NR_delete_module +#undef __NR_get_kernel_syms +#define __NR_get_kernel_syms (4000 + 130) +#define SYS_get_kernel_syms __NR_get_kernel_syms +#undef __NR_quotactl +#define __NR_quotactl (4000 + 131) +#define SYS_quotactl __NR_quotactl +#undef __NR_getpgid +#define __NR_getpgid (4000 + 132) +#define SYS_getpgid __NR_getpgid +#undef __NR_fchdir +#define __NR_fchdir (4000 + 133) +#define SYS_fchdir __NR_fchdir +#undef __NR_bdflush +#define __NR_bdflush (4000 + 134) +#define SYS_bdflush __NR_bdflush +#undef __NR_sysfs +#define __NR_sysfs (4000 + 135) +#define SYS_sysfs __NR_sysfs +#undef __NR_personality +#define __NR_personality (4000 + 136) +#define SYS_personality __NR_personality +#undef __NR_afs_syscall +#define __NR_afs_syscall (4000 + 137) +#define SYS_afs_syscall __NR_afs_syscall +#undef __NR_setfsuid +#define __NR_setfsuid (4000 + 138) +#define SYS_setfsuid __NR_setfsuid +#undef __NR_setfsgid +#define __NR_setfsgid (4000 + 139) +#define SYS_setfsgid __NR_setfsgid +#undef __NR__llseek +#define __NR__llseek (4000 + 140) +#define SYS__llseek __NR__llseek +#undef __NR_getdents +#define __NR_getdents (4000 + 141) +#define SYS_getdents __NR_getdents +#undef __NR__newselect +#define __NR__newselect (4000 + 142) +#define SYS__newselect __NR__newselect +#undef __NR_flock +#define __NR_flock (4000 + 143) +#define SYS_flock __NR_flock +#undef __NR_msync +#define __NR_msync (4000 + 144) +#define SYS_msync __NR_msync +#undef __NR_readv +#define __NR_readv (4000 + 145) +#define SYS_readv __NR_readv +#undef __NR_writev +#define __NR_writev (4000 + 146) +#define SYS_writev __NR_writev +#undef __NR_cacheflush +#define __NR_cacheflush (4000 + 147) +#define SYS_cacheflush __NR_cacheflush +#undef __NR_cachectl +#define __NR_cachectl (4000 + 148) +#define SYS_cachectl __NR_cachectl +#undef __NR_sysmips +#define __NR_sysmips (4000 + 149) +#define SYS_sysmips __NR_sysmips +#undef __NR_unused150 +#define __NR_unused150 (4000 + 150) +#define SYS_unused150 __NR_unused150 +#undef __NR_getsid +#define __NR_getsid (4000 + 151) +#define SYS_getsid __NR_getsid +#undef __NR_fdatasync +#define __NR_fdatasync (4000 + 152) +#define SYS_fdatasync __NR_fdatasync +#undef __NR__sysctl +#define __NR__sysctl (4000 + 153) +#define SYS__sysctl __NR__sysctl +#undef __NR_mlock +#define __NR_mlock (4000 + 154) +#define SYS_mlock __NR_mlock +#undef __NR_munlock +#define __NR_munlock (4000 + 155) +#define SYS_munlock __NR_munlock +#undef __NR_mlockall +#define __NR_mlockall (4000 + 156) +#define SYS_mlockall __NR_mlockall +#undef __NR_munlockall +#define __NR_munlockall (4000 + 157) +#define SYS_munlockall __NR_munlockall +#undef __NR_sched_setparam +#define __NR_sched_setparam (4000 + 158) +#define SYS_sched_setparam __NR_sched_setparam +#undef __NR_sched_getparam +#define __NR_sched_getparam (4000 + 159) +#define SYS_sched_getparam __NR_sched_getparam +#undef __NR_sched_setscheduler +#define __NR_sched_setscheduler (4000 + 160) +#define SYS_sched_setscheduler __NR_sched_setscheduler +#undef __NR_sched_getscheduler +#define __NR_sched_getscheduler (4000 + 161) +#define SYS_sched_getscheduler __NR_sched_getscheduler +#undef __NR_sched_yield +#define __NR_sched_yield (4000 + 162) +#define SYS_sched_yield __NR_sched_yield +#undef __NR_sched_get_priority_max +#define __NR_sched_get_priority_max (4000 + 163) +#define SYS_sched_get_priority_max __NR_sched_get_priority_max +#undef __NR_sched_get_priority_min +#define __NR_sched_get_priority_min (4000 + 164) +#define SYS_sched_get_priority_min __NR_sched_get_priority_min +#undef __NR_sched_rr_get_interval +#define __NR_sched_rr_get_interval (4000 + 165) +#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval +#undef __NR_nanosleep +#define __NR_nanosleep (4000 + 166) +#define SYS_nanosleep __NR_nanosleep +#undef __NR_mremap +#define __NR_mremap (4000 + 167) +#define SYS_mremap __NR_mremap +#undef __NR_accept +#define __NR_accept (4000 + 168) +#define SYS_accept __NR_accept +#undef __NR_bind +#define __NR_bind (4000 + 169) +#define SYS_bind __NR_bind +#undef __NR_connect +#define __NR_connect (4000 + 170) +#define SYS_connect __NR_connect +#undef __NR_getpeername +#define __NR_getpeername (4000 + 171) +#define SYS_getpeername __NR_getpeername +#undef __NR_getsockname +#define __NR_getsockname (4000 + 172) +#define SYS_getsockname __NR_getsockname +#undef __NR_getsockopt +#define __NR_getsockopt (4000 + 173) +#define SYS_getsockopt __NR_getsockopt +#undef __NR_listen +#define __NR_listen (4000 + 174) +#define SYS_listen __NR_listen +#undef __NR_recv +#define __NR_recv (4000 + 175) +#define SYS_recv __NR_recv +#undef __NR_recvfrom +#define __NR_recvfrom (4000 + 176) +#define SYS_recvfrom __NR_recvfrom +#undef __NR_recvmsg +#define __NR_recvmsg (4000 + 177) +#define SYS_recvmsg __NR_recvmsg +#undef __NR_send +#define __NR_send (4000 + 178) +#define SYS_send __NR_send +#undef __NR_sendmsg +#define __NR_sendmsg (4000 + 179) +#define SYS_sendmsg __NR_sendmsg +#undef __NR_sendto +#define __NR_sendto (4000 + 180) +#define SYS_sendto __NR_sendto +#undef __NR_setsockopt +#define __NR_setsockopt (4000 + 181) +#define SYS_setsockopt __NR_setsockopt +#undef __NR_shutdown +#define __NR_shutdown (4000 + 182) +#define SYS_shutdown __NR_shutdown +#undef __NR_socket +#define __NR_socket (4000 + 183) +#define SYS_socket __NR_socket +#undef __NR_socketpair +#define __NR_socketpair (4000 + 184) +#define SYS_socketpair __NR_socketpair +#undef __NR_setresuid +#define __NR_setresuid (4000 + 185) +#define SYS_setresuid __NR_setresuid +#undef __NR_getresuid +#define __NR_getresuid (4000 + 186) +#define SYS_getresuid __NR_getresuid +#undef __NR_query_module +#define __NR_query_module (4000 + 187) +#define SYS_query_module __NR_query_module +#undef __NR_poll +#define __NR_poll (4000 + 188) +#define SYS_poll __NR_poll +#undef __NR_nfsservctl +#define __NR_nfsservctl (4000 + 189) +#define SYS_nfsservctl __NR_nfsservctl +#undef __NR_setresgid +#define __NR_setresgid (4000 + 190) +#define SYS_setresgid __NR_setresgid +#undef __NR_getresgid +#define __NR_getresgid (4000 + 191) +#define SYS_getresgid __NR_getresgid +#undef __NR_prctl +#define __NR_prctl (4000 + 192) +#define SYS_prctl __NR_prctl +#undef __NR_rt_sigreturn +#define __NR_rt_sigreturn (4000 + 193) +#define SYS_rt_sigreturn __NR_rt_sigreturn +#undef __NR_rt_sigaction +#define __NR_rt_sigaction (4000 + 194) +#define SYS_rt_sigaction __NR_rt_sigaction +#undef __NR_rt_sigprocmask +#define __NR_rt_sigprocmask (4000 + 195) +#define SYS_rt_sigprocmask __NR_rt_sigprocmask +#undef __NR_rt_sigpending +#define __NR_rt_sigpending (4000 + 196) +#define SYS_rt_sigpending __NR_rt_sigpending +#undef __NR_rt_sigtimedwait +#define __NR_rt_sigtimedwait (4000 + 197) +#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait +#undef __NR_rt_sigqueueinfo +#define __NR_rt_sigqueueinfo (4000 + 198) +#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo +#undef __NR_rt_sigsuspend +#define __NR_rt_sigsuspend (4000 + 199) +#define SYS_rt_sigsuspend __NR_rt_sigsuspend +#undef __NR_pread64 +#define __NR_pread64 (4000 + 200) +#define SYS_pread64 __NR_pread64 +#undef __NR_pwrite64 +#define __NR_pwrite64 (4000 + 201) +#define SYS_pwrite64 __NR_pwrite64 +#undef __NR_chown +#define __NR_chown (4000 + 202) +#define SYS_chown __NR_chown +#undef __NR_getcwd +#define __NR_getcwd (4000 + 203) +#define SYS_getcwd __NR_getcwd +#undef __NR_capget +#define __NR_capget (4000 + 204) +#define SYS_capget __NR_capget +#undef __NR_capset +#define __NR_capset (4000 + 205) +#define SYS_capset __NR_capset +#undef __NR_sigaltstack +#define __NR_sigaltstack (4000 + 206) +#define SYS_sigaltstack __NR_sigaltstack +#undef __NR_sendfile +#define __NR_sendfile (4000 + 207) +#define SYS_sendfile __NR_sendfile +#undef __NR_getpmsg +#define __NR_getpmsg (4000 + 208) +#define SYS_getpmsg __NR_getpmsg +#undef __NR_putpmsg +#define __NR_putpmsg (4000 + 209) +#define SYS_putpmsg __NR_putpmsg +#undef __NR_mmap2 +#define __NR_mmap2 (4000 + 210) +#define SYS_mmap2 __NR_mmap2 +#undef __NR_truncate64 +#define __NR_truncate64 (4000 + 211) +#define SYS_truncate64 __NR_truncate64 +#undef __NR_ftruncate64 +#define __NR_ftruncate64 (4000 + 212) +#define SYS_ftruncate64 __NR_ftruncate64 +#undef __NR_stat64 +#define __NR_stat64 (4000 + 213) +#define SYS_stat64 __NR_stat64 +#undef __NR_lstat64 +#define __NR_lstat64 (4000 + 214) +#define SYS_lstat64 __NR_lstat64 +#undef __NR_fstat64 +#define __NR_fstat64 (4000 + 215) +#define SYS_fstat64 __NR_fstat64 +#undef __NR_pivot_root +#define __NR_pivot_root (4000 + 216) +#define SYS_pivot_root __NR_pivot_root +#undef __NR_mincore +#define __NR_mincore (4000 + 217) +#define SYS_mincore __NR_mincore +#undef __NR_madvise +#define __NR_madvise (4000 + 218) +#define SYS_madvise __NR_madvise +#undef __NR_getdents64 +#define __NR_getdents64 (4000 + 219) +#define SYS_getdents64 __NR_getdents64 +#undef __NR_fcntl64 +#define __NR_fcntl64 (4000 + 220) +#define SYS_fcntl64 __NR_fcntl64 +#undef __NR_reserved221 +#define __NR_reserved221 (4000 + 221) +#define SYS_reserved221 __NR_reserved221 +#undef __NR_gettid +#define __NR_gettid (4000 + 222) +#define SYS_gettid __NR_gettid +#undef __NR_readahead +#define __NR_readahead (4000 + 223) +#define SYS_readahead __NR_readahead +#undef __NR_setxattr +#define __NR_setxattr (4000 + 224) +#define SYS_setxattr __NR_setxattr +#undef __NR_lsetxattr +#define __NR_lsetxattr (4000 + 225) +#define SYS_lsetxattr __NR_lsetxattr +#undef __NR_fsetxattr +#define __NR_fsetxattr (4000 + 226) +#define SYS_fsetxattr __NR_fsetxattr +#undef __NR_getxattr +#define __NR_getxattr (4000 + 227) +#define SYS_getxattr __NR_getxattr +#undef __NR_lgetxattr +#define __NR_lgetxattr (4000 + 228) +#define SYS_lgetxattr __NR_lgetxattr +#undef __NR_fgetxattr +#define __NR_fgetxattr (4000 + 229) +#define SYS_fgetxattr __NR_fgetxattr +#undef __NR_listxattr +#define __NR_listxattr (4000 + 230) +#define SYS_listxattr __NR_listxattr +#undef __NR_llistxattr +#define __NR_llistxattr (4000 + 231) +#define SYS_llistxattr __NR_llistxattr +#undef __NR_flistxattr +#define __NR_flistxattr (4000 + 232) +#define SYS_flistxattr __NR_flistxattr +#undef __NR_removexattr +#define __NR_removexattr (4000 + 233) +#define SYS_removexattr __NR_removexattr +#undef __NR_lremovexattr +#define __NR_lremovexattr (4000 + 234) +#define SYS_lremovexattr __NR_lremovexattr +#undef __NR_fremovexattr +#define __NR_fremovexattr (4000 + 235) +#define SYS_fremovexattr __NR_fremovexattr +#undef __NR_tkill +#define __NR_tkill (4000 + 236) +#define SYS_tkill __NR_tkill +#undef __NR_sendfile64 +#define __NR_sendfile64 (4000 + 237) +#define SYS_sendfile64 __NR_sendfile64 +#undef __NR_futex +#define __NR_futex (4000 + 238) +#define SYS_futex __NR_futex +#undef __NR_sched_setaffinity +#define __NR_sched_setaffinity (4000 + 239) +#define SYS_sched_setaffinity __NR_sched_setaffinity +#undef __NR_sched_getaffinity +#define __NR_sched_getaffinity (4000 + 240) +#define SYS_sched_getaffinity __NR_sched_getaffinity +#undef __NR_io_setup +#define __NR_io_setup (4000 + 241) +#define SYS_io_setup __NR_io_setup +#undef __NR_io_destroy +#define __NR_io_destroy (4000 + 242) +#define SYS_io_destroy __NR_io_destroy +#undef __NR_io_getevents +#define __NR_io_getevents (4000 + 243) +#define SYS_io_getevents __NR_io_getevents +#undef __NR_io_submit +#define __NR_io_submit (4000 + 244) +#define SYS_io_submit __NR_io_submit +#undef __NR_io_cancel +#define __NR_io_cancel (4000 + 245) +#define SYS_io_cancel __NR_io_cancel +#undef __NR_exit_group +#define __NR_exit_group (4000 + 246) +#define SYS_exit_group __NR_exit_group +#undef __NR_lookup_dcookie +#define __NR_lookup_dcookie (4000 + 247) +#define SYS_lookup_dcookie __NR_lookup_dcookie +#undef __NR_epoll_create +#define __NR_epoll_create (4000 + 248) +#define SYS_epoll_create __NR_epoll_create +#undef __NR_epoll_ctl +#define __NR_epoll_ctl (4000 + 249) +#define SYS_epoll_ctl __NR_epoll_ctl +#undef __NR_epoll_wait +#define __NR_epoll_wait (4000 + 250) +#define SYS_epoll_wait __NR_epoll_wait +#undef __NR_remap_file_pages +#define __NR_remap_file_pages (4000 + 251) +#define SYS_remap_file_pages __NR_remap_file_pages +#undef __NR_set_tid_address +#define __NR_set_tid_address (4000 + 252) +#define SYS_set_tid_address __NR_set_tid_address +#undef __NR_restart_syscall +#define __NR_restart_syscall (4000 + 253) +#define SYS_restart_syscall __NR_restart_syscall +#undef __NR_fadvise64 +#define __NR_fadvise64 (4000 + 254) +#define SYS_fadvise64 __NR_fadvise64 +#undef __NR_statfs64 +#define __NR_statfs64 (4000 + 255) +#define SYS_statfs64 __NR_statfs64 +#undef __NR_fstatfs64 +#define __NR_fstatfs64 (4000 + 256) +#define SYS_fstatfs64 __NR_fstatfs64 +#undef __NR_timer_create +#define __NR_timer_create (4000 + 257) +#define SYS_timer_create __NR_timer_create +#undef __NR_timer_settime +#define __NR_timer_settime (4000 + 258) +#define SYS_timer_settime __NR_timer_settime +#undef __NR_timer_gettime +#define __NR_timer_gettime (4000 + 259) +#define SYS_timer_gettime __NR_timer_gettime +#undef __NR_timer_getoverrun +#define __NR_timer_getoverrun (4000 + 260) +#define SYS_timer_getoverrun __NR_timer_getoverrun +#undef __NR_timer_delete +#define __NR_timer_delete (4000 + 261) +#define SYS_timer_delete __NR_timer_delete +#undef __NR_clock_settime +#define __NR_clock_settime (4000 + 262) +#define SYS_clock_settime __NR_clock_settime +#undef __NR_clock_gettime +#define __NR_clock_gettime (4000 + 263) +#define SYS_clock_gettime __NR_clock_gettime +#undef __NR_clock_getres +#define __NR_clock_getres (4000 + 264) +#define SYS_clock_getres __NR_clock_getres +#undef __NR_clock_nanosleep +#define __NR_clock_nanosleep (4000 + 265) +#define SYS_clock_nanosleep __NR_clock_nanosleep +#undef __NR_tgkill +#define __NR_tgkill (4000 + 266) +#define SYS_tgkill __NR_tgkill +#undef __NR_utimes +#define __NR_utimes (4000 + 267) +#define SYS_utimes __NR_utimes +#undef __NR_mbind +#define __NR_mbind (4000 + 268) +#define SYS_mbind __NR_mbind +#undef __NR_get_mempolicy +#define __NR_get_mempolicy (4000 + 269) +#define SYS_get_mempolicy __NR_get_mempolicy +#undef __NR_set_mempolicy +#define __NR_set_mempolicy (4000 + 270) +#define SYS_set_mempolicy __NR_set_mempolicy +#undef __NR_mq_open +#define __NR_mq_open (4000 + 271) +#define SYS_mq_open __NR_mq_open +#undef __NR_mq_unlink +#define __NR_mq_unlink (4000 + 272) +#define SYS_mq_unlink __NR_mq_unlink +#undef __NR_mq_timedsend +#define __NR_mq_timedsend (4000 + 273) +#define SYS_mq_timedsend __NR_mq_timedsend +#undef __NR_mq_timedreceive +#define __NR_mq_timedreceive (4000 + 274) +#define SYS_mq_timedreceive __NR_mq_timedreceive +#undef __NR_mq_notify +#define __NR_mq_notify (4000 + 275) +#define SYS_mq_notify __NR_mq_notify +#undef __NR_mq_getsetattr +#define __NR_mq_getsetattr (4000 + 276) +#define SYS_mq_getsetattr __NR_mq_getsetattr +#undef __NR_vserver +#define __NR_vserver (4000 + 277) +#define SYS_vserver __NR_vserver +#undef __NR_waitid +#define __NR_waitid (4000 + 278) +#define SYS_waitid __NR_waitid +#undef __NR_add_key +#define __NR_add_key (4000 + 280) +#define SYS_add_key __NR_add_key +#undef __NR_request_key +#define __NR_request_key (4000 + 281) +#define SYS_request_key __NR_request_key +#undef __NR_keyctl +#define __NR_keyctl (4000 + 282) +#define SYS_keyctl __NR_keyctl +#undef __NR_set_thread_area +#define __NR_set_thread_area (4000 + 283) +#define SYS_set_thread_area __NR_set_thread_area +#undef __NR_inotify_init +#define __NR_inotify_init (4000 + 284) +#define SYS_inotify_init __NR_inotify_init +#undef __NR_inotify_add_watch +#define __NR_inotify_add_watch (4000 + 285) +#define SYS_inotify_add_watch __NR_inotify_add_watch +#undef __NR_inotify_rm_watch +#define __NR_inotify_rm_watch (4000 + 286) +#define SYS_inotify_rm_watch __NR_inotify_rm_watch +#undef __NR_migrate_pages +#define __NR_migrate_pages (4000 + 287) +#define SYS_migrate_pages __NR_migrate_pages +#undef __NR_openat +#define __NR_openat (4000 + 288) +#define SYS_openat __NR_openat +#undef __NR_mkdirat +#define __NR_mkdirat (4000 + 289) +#define SYS_mkdirat __NR_mkdirat +#undef __NR_mknodat +#define __NR_mknodat (4000 + 290) +#define SYS_mknodat __NR_mknodat +#undef __NR_fchownat +#define __NR_fchownat (4000 + 291) +#define SYS_fchownat __NR_fchownat +#undef __NR_futimesat +#define __NR_futimesat (4000 + 292) +#define SYS_futimesat __NR_futimesat +#undef __NR_fstatat64 +#define __NR_fstatat64 (4000 + 293) +#define SYS_fstatat64 __NR_fstatat64 +#undef __NR_unlinkat +#define __NR_unlinkat (4000 + 294) +#define SYS_unlinkat __NR_unlinkat +#undef __NR_renameat +#define __NR_renameat (4000 + 295) +#define SYS_renameat __NR_renameat +#undef __NR_linkat +#define __NR_linkat (4000 + 296) +#define SYS_linkat __NR_linkat +#undef __NR_symlinkat +#define __NR_symlinkat (4000 + 297) +#define SYS_symlinkat __NR_symlinkat +#undef __NR_readlinkat +#define __NR_readlinkat (4000 + 298) +#define SYS_readlinkat __NR_readlinkat +#undef __NR_fchmodat +#define __NR_fchmodat (4000 + 299) +#define SYS_fchmodat __NR_fchmodat +#undef __NR_faccessat +#define __NR_faccessat (4000 + 300) +#define SYS_faccessat __NR_faccessat +#undef __NR_pselect6 +#define __NR_pselect6 (4000 + 301) +#define SYS_pselect6 __NR_pselect6 +#undef __NR_ppoll +#define __NR_ppoll (4000 + 302) +#define SYS_ppoll __NR_ppoll +#undef __NR_unshare +#define __NR_unshare (4000 + 303) +#define SYS_unshare __NR_unshare +#undef __NR_splice +#define __NR_splice (4000 + 304) +#define SYS_splice __NR_splice +#undef __NR_sync_file_range +#define __NR_sync_file_range (4000 + 305) +#define SYS_sync_file_range __NR_sync_file_range +#undef __NR_tee +#define __NR_tee (4000 + 306) +#define SYS_tee __NR_tee +#undef __NR_vmsplice +#define __NR_vmsplice (4000 + 307) +#define SYS_vmsplice __NR_vmsplice +#undef __NR_move_pages +#define __NR_move_pages (4000 + 308) +#define SYS_move_pages __NR_move_pages +#undef __NR_set_robust_list +#define __NR_set_robust_list (4000 + 309) +#define SYS_set_robust_list __NR_set_robust_list +#undef __NR_get_robust_list +#define __NR_get_robust_list (4000 + 310) +#define SYS_get_robust_list __NR_get_robust_list +#undef __NR_kexec_load +#define __NR_kexec_load (4000 + 311) +#define SYS_kexec_load __NR_kexec_load +#undef __NR_getcpu +#define __NR_getcpu (4000 + 312) +#define SYS_getcpu __NR_getcpu +#undef __NR_epoll_pwait +#define __NR_epoll_pwait (4000 + 313) +#define SYS_epoll_pwait __NR_epoll_pwait +#undef __NR_ioprio_set +#define __NR_ioprio_set (4000 + 314) +#define SYS_ioprio_set __NR_ioprio_set +#undef __NR_ioprio_get +#define __NR_ioprio_get (4000 + 315) +#define SYS_ioprio_get __NR_ioprio_get +#undef __NR_utimensat +#define __NR_utimensat (4000 + 316) +#define SYS_utimensat __NR_utimensat +#undef __NR_signalfd +#define __NR_signalfd (4000 + 317) +#define SYS_signalfd __NR_signalfd +#undef __NR_timerfd +#define __NR_timerfd (4000 + 318) +#define SYS_timerfd __NR_timerfd +#undef __NR_eventfd +#define __NR_eventfd (4000 + 319) +#define SYS_eventfd __NR_eventfd +#undef __NR_fallocate +#define __NR_fallocate (4000 + 320) +#define SYS_fallocate __NR_fallocate +#undef __NR_timerfd_create +#define __NR_timerfd_create (4000 + 321) +#define SYS_timerfd_create __NR_timerfd_create +#undef __NR_timerfd_gettime +#define __NR_timerfd_gettime (4000 + 322) +#define SYS_timerfd_gettime __NR_timerfd_gettime +#undef __NR_timerfd_settime +#define __NR_timerfd_settime (4000 + 323) +#define SYS_timerfd_settime __NR_timerfd_settime +#undef __NR_signalfd4 +#define __NR_signalfd4 (4000 + 324) +#define SYS_signalfd4 __NR_signalfd4 +#undef __NR_eventfd2 +#define __NR_eventfd2 (4000 + 325) +#define SYS_eventfd2 __NR_eventfd2 +#undef __NR_epoll_create1 +#define __NR_epoll_create1 (4000 + 326) +#define SYS_epoll_create1 __NR_epoll_create1 +#undef __NR_dup3 +#define __NR_dup3 (4000 + 327) +#define SYS_dup3 __NR_dup3 +#undef __NR_pipe2 +#define __NR_pipe2 (4000 + 328) +#define SYS_pipe2 __NR_pipe2 +#undef __NR_inotify_init1 +#define __NR_inotify_init1 (4000 + 329) +#define SYS_inotify_init1 __NR_inotify_init1 +#undef __NR_preadv +#define __NR_preadv (4000 + 330) +#define SYS_preadv __NR_preadv +#undef __NR_pwritev +#define __NR_pwritev (4000 + 331) +#define SYS_pwritev __NR_pwritev +#undef __NR_Linux_syscalls +#define __NR_Linux_syscalls 331 +#define SYS_Linux_syscalls __NR_Linux_syscalls +#undef __NR_O32_Linux +#define __NR_O32_Linux 4000 +#define SYS_O32_Linux __NR_O32_Linux +#undef __NR_O32_Linux_syscalls +#define __NR_O32_Linux_syscalls 331 +#define SYS_O32_Linux_syscalls __NR_O32_Linux_syscalls +#undef __NR_64_Linux +#define __NR_64_Linux 5000 +#define SYS_64_Linux __NR_64_Linux +#undef __NR_64_Linux_syscalls +#define __NR_64_Linux_syscalls 290 +#define SYS_64_Linux_syscalls __NR_64_Linux_syscalls +#undef __NR_N32_Linux +#define __NR_N32_Linux 6000 +#define SYS_N32_Linux __NR_N32_Linux +#undef __NR_N32_Linux_syscalls +#define __NR_N32_Linux_syscalls 294 +#define SYS_N32_Linux_syscalls __NR_N32_Linux_syscalls + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/termios.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/termios.h new file mode 100644 index 0000000..546faa0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/termios.h @@ -0,0 +1,217 @@ +/* termios type and macro definitions. Linux/MIPS version. + Copyright (C) 1993, 94, 95, 96, 97, 99 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + }; + +/* c_cc characters */ +#define VINTR 0 /* Interrupt character [ISIG]. */ +#define VQUIT 1 /* Quit character [ISIG]. */ +#define VERASE 2 /* Erase character [ICANON]. */ +#define VKILL 3 /* Kill-line character [ICANON]. */ +#define VMIN 4 /* Minimum number of bytes read at once [!ICANON]. */ +#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON]. */ +#define VEOL2 6 /* Second EOL character [ICANON]. */ +#define VSWTC 7 +#define VSWTCH VSWTC +#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */ +#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */ +#define VSUSP 10 /* Suspend character [ISIG]. */ + /* VDSUSP is not supported on Linux. */ +/* #define VDSUSP 11 / * Delayed suspend character [ISIG]. */ +#define VREPRINT 12 /* Reprint-line character [ICANON]. */ +#define VDISCARD 13 /* Discard character [IEXTEN]. */ +#define VWERASE 14 /* Word-erase character [ICANON]. */ +#define VLNEXT 15 /* Literal-next character [IEXTEN]. */ +#define VEOF 16 /* End-of-file character [ICANON]. */ +#define VEOL 17 /* End-of-line character [ICANON]. */ + +/* c_iflag bits */ +#define IGNBRK 0000001 /* Ignore break condition. */ +#define BRKINT 0000002 /* Signal interrupt on break. */ +#define IGNPAR 0000004 /* Ignore characters with parity errors. */ +#define PARMRK 0000010 /* Mark parity and framing errors. */ +#define INPCK 0000020 /* Enable input parity check. */ +#define ISTRIP 0000040 /* Strip 8th bit off characters. */ +#define INLCR 0000100 /* Map NL to CR on input. */ +#define IGNCR 0000200 /* Ignore CR. */ +#define ICRNL 0000400 /* Map CR to NL on input. */ +#define IUCLC 0001000 /* Map upper case to lower case on input. */ +#define IXON 0002000 /* Enable start/stop output control. */ +#define IXANY 0004000 /* Any character will restart after stop. */ +#define IXOFF 0010000 /* Enable start/stop input control. */ +#define IMAXBEL 0020000 /* Ring bell when input queue is full. */ + +/* c_oflag bits */ +#define OPOST 0000001 /* Perform output processing. */ +#define OLCUC 0000002 /* Map lower case to upper case on output. */ +#define ONLCR 0000004 /* Map NL to CR-NL on output. */ +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#if defined __USE_MISC || defined __USE_XOPEN +# define NLDLY 0000400 +# define NL0 0000000 +# define NL1 0000400 +# define CRDLY 0003000 +# define CR0 0000000 +# define CR1 0001000 +# define CR2 0002000 +# define CR3 0003000 +# define TABDLY 0014000 +# define TAB0 0000000 +# define TAB1 0004000 +# define TAB2 0010000 +# define TAB3 0014000 +# define BSDLY 0020000 +# define BS0 0000000 +# define BS1 0020000 +# define FFDLY 0100000 +# define FF0 0000000 +# define FF1 0100000 +#endif + +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 + +#ifdef __USE_MISC +# define XTABS 0014000 +#endif + +/* c_cflag bit meaning */ +#ifdef __USE_MISC +# define CBAUD 0010017 +#endif +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 +#endif +#define CSIZE 0000060 /* Number of bits per byte (mask). */ +#define CS5 0000000 /* 5 bits per byte. */ +#define CS6 0000020 /* 6 bits per byte. */ +#define CS7 0000040 /* 7 bits per byte. */ +#define CS8 0000060 /* 8 bits per byte. */ +#define CSTOPB 0000100 /* Two stop bits instead of one. */ +#define CREAD 0000200 /* Enable receiver. */ +#define PARENB 0000400 /* Parity enable. */ +#define PARODD 0001000 /* Odd parity instead of even. */ +#define HUPCL 0002000 /* Hang up on last close. */ +#define CLOCAL 0004000 /* Ignore modem status lines. */ +#ifdef __USE_MISC +# define CBAUDEX 0010000 +#endif +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#define __MAX_BAUD B4000000 +#ifdef __USE_MISC +# define CIBAUD 002003600000 /* input baud rate (not used) */ +# define CRTSCTS 020000000000 /* flow control */ +#endif + +/* c_lflag bits */ +#define ISIG 0000001 /* Enable signals. */ +#define ICANON 0000002 /* Do erase and kill processing. */ +#if defined __USE_MISC || defined __USE_XOPEN +# define XCASE 0000004 +#endif +#define ECHO 0000010 /* Enable echo. */ +#define ECHOE 0000020 /* Visual erase for ERASE. */ +#define ECHOK 0000040 /* Echo NL after KILL. */ +#define ECHONL 0000100 /* Echo NL even if ECHO is off. */ +#define NOFLSH 0000200 /* Disable flush after interrupt. */ +#define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */ +#ifdef __USE_MISC +# define ECHOCTL 0001000 /* Echo control characters as ^X. */ +# define ECHOPRT 0002000 /* Hardcopy visual erase. */ +# define ECHOKE 0004000 /* Visual erase for KILL. */ +# define FLUSHO 0020000 +# define PENDIN 0040000 /* Retype pending input (state). */ +#endif +#define TOSTOP 0100000 /* Send SIGTTOU for background output. */ +#define ITOSTOP TOSTOP + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 /* Suspend output. */ +#define TCOON 1 /* Restart suspended output. */ +#define TCIOFF 2 /* Send a STOP character. */ +#define TCION 3 /* Send a START character. */ + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 /* Discard data received but not yet read. */ +#define TCOFLUSH 1 /* Discard data written but not yet sent. */ +#define TCIOFLUSH 2 /* Discard all pending data. */ + +/* tcsetattr uses these */ +#define TCSANOW 0x540e /* Same as TCSETS; change immediately. */ +#define TCSADRAIN 0x540f /* Same as TCSETSW; change when pending output is written. */ +#define TCSAFLUSH 0x5410 /* Same as TCSETSF; flush pending input before changing. */ + +#define _IOT_termios /* Hurd ioctl type field. */ \ + _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/time.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/time.h new file mode 100644 index 0000000..7ed54bf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/time.h @@ -0,0 +1,79 @@ +/* System-dependent timing definitions. Generic version. + Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; use instead. + */ + +#ifndef __need_timeval +# ifndef _BITS_TIME_H +# define _BITS_TIME_H 1 + +/* ISO/IEC 9899:1990 7.12.1: + The macro `CLOCKS_PER_SEC' is the number per second of the value + returned by the `clock' function. */ +/* CAE XSH, Issue 4, Version 2: + The value of CLOCKS_PER_SEC is required to be 1 million on all + XSI-conformant systems. */ +# define CLOCKS_PER_SEC 1000000l + +/* Get the arch-specific value of __UCLIBC_CLK_TCK_CONST used for CLK_TCK + * in sysconf() and clock(). */ +#include + +# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K +/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK + presents the real value for clock ticks per second for the system. */ +# include +/* Note (uClibc): glibc #defines CLK_TCK as a sysconf() call. */ +# define CLK_TCK ((__clock_t) __UCLIBC_CLK_TCK_CONST) +# endif + +# ifdef __USE_POSIX199309 +/* Identifier for system-wide realtime clock. */ +# define CLOCK_REALTIME 0 +/* Monotonic system-wide clock. */ +# define CLOCK_MONOTONIC 1 +/* High-resolution timer from the CPU. */ +# define CLOCK_PROCESS_CPUTIME_ID 2 +/* Thread-specific CPU-time clock. */ +# define CLOCK_THREAD_CPUTIME_ID 3 + +/* Flag to indicate time is absolute. */ +# define TIMER_ABSTIME 1 +# endif + +# endif /* bits/time.h */ +#endif + +#ifdef __need_timeval +# undef __need_timeval +# ifndef _STRUCT_TIMEVAL +# define _STRUCT_TIMEVAL 1 +# include + +/* A time value that is accurate to the nearest + microsecond but also has a range of years. */ +struct timeval + { + __time_t tv_sec; /* Seconds. */ + __suseconds_t tv_usec; /* Microseconds. */ + }; +# endif /* struct timeval */ +#endif /* need timeval */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/types.h new file mode 100644 index 0000000..755af2e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/types.h @@ -0,0 +1,209 @@ +/* bits/types.h -- definitions of __*_t types underlying *_t types. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; use instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + +#include +#include + +#define __need_size_t +#include +#include + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + +/* Fixed-size types, underlying types depend on word size and compiler. */ +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +#if __WORDSIZE == 64 +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; +#elif defined(__GNUC__) +__extension__ typedef signed long long int __int64_t; +__extension__ typedef unsigned long long int __uint64_t; +#endif + +/* quad_t is also 64 bits. */ +#if __WORDSIZE == 64 +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +#elif defined(__GNUC__) +__extension__ typedef long long int __quad_t; +__extension__ typedef unsigned long long int __u_quad_t; +#else +typedef struct +{ + long __val[2]; +} __quad_t; +typedef struct +{ + __u_long __val[2]; +} __u_quad_t; +#endif + + +/* The machine-dependent file defines __*_T_TYPE + macros for each of the OS types we define below. The definitions + of those macros must use the following macros for underlying types. + We define __S_TYPE and __U_TYPE for the signed and unsigned + variants of each of the following integer types on this machine. + + 16 -- "natural" 16-bit type (always short) + 32 -- "natural" 32-bit type (always int) + 64 -- "natural" 64-bit type (long or long long) + LONG32 -- 32-bit type, traditionally long + QUAD -- 64-bit type, always long long + WORD -- natural type of __WORDSIZE bits (int or long) + LONGWORD -- type of __WORDSIZE bits, traditionally long + + We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the + conventional uses of `long' or `long long' type modifiers match the + types we define, even when a less-adorned type would be the same size. + This matters for (somewhat) portably writing printf/scanf formats for + these types, where using the appropriate l or ll format modifiers can + make the typedefs and the formats match up across all GNU platforms. If + we used `long' when it's 64 bits where `long long' is expected, then the + compiler would warn about the formats not matching the argument types, + and the programmer changing them to shut up the compiler would break the + program's portability. + + Here we assume what is presently the case in all the GCC configurations + we support: long long is always 64 bits, long is always word/address size, + and int is always 32 bits. */ + +#define __S16_TYPE short int +#define __U16_TYPE unsigned short int +#define __S32_TYPE int +#define __U32_TYPE unsigned int +#define __SLONGWORD_TYPE long int +#define __ULONGWORD_TYPE unsigned long int +#if __WORDSIZE == 32 +# define __SQUAD_TYPE __quad_t +# define __UQUAD_TYPE __u_quad_t +# define __SWORD_TYPE int +# define __UWORD_TYPE unsigned int +# define __SLONG32_TYPE long int +# define __ULONG32_TYPE unsigned long int +# define __S64_TYPE __quad_t +# define __U64_TYPE __u_quad_t +/* We want __extension__ before typedef's that use nonstandard base types + such as `long long' in C89 mode. */ +# define __STD_TYPE __extension__ typedef +#elif __WORDSIZE == 64 +# define __SQUAD_TYPE long int +# define __UQUAD_TYPE unsigned long int +# define __SWORD_TYPE long int +# define __UWORD_TYPE unsigned long int +# define __SLONG32_TYPE int +# define __ULONG32_TYPE unsigned int +# define __S64_TYPE long int +# define __U64_TYPE unsigned long int +/* No need to mark the typedef with __extension__. */ +# define __STD_TYPE typedef +#else +# error +#endif +#include /* Defines __*_T_TYPE macros. */ + + +__STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */ +__STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */ +__STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */ +__STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */ +__STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/ +__STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */ +__STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */ +__STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */ +__STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */ +__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */ +__STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */ +__STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */ +__STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ +__STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ +__STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ +__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ +__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ +__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ + +__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ +__STD_TYPE __SWBLK_T_TYPE __swblk_t; /* Type of a swap block maybe? */ +__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ + +/* Clock ID used in clock and timer functions. */ +__STD_TYPE __CLOCKID_T_TYPE __clockid_t; + +/* Timer ID returned by `timer_create'. */ +__STD_TYPE __TIMER_T_TYPE __timer_t; + +/* Type to represent block size. */ +__STD_TYPE __BLKSIZE_T_TYPE __blksize_t; + +/* Types from the Large File Support interface. */ + +/* Type to count number of disk blocks. */ +__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t; +__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t; + +/* Type to count file system blocks. */ +__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t; +__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t; + +/* Type to count file system nodes. */ +__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t; +__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t; + +__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */ + +/* These few don't really vary by system, they always correspond + to one of the other defined types. */ +typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + +/* Duplicates info from stdint.h but this is used in unistd.h. */ +__STD_TYPE __SWORD_TYPE __intptr_t; + +/* Duplicate info from sys/socket.h. */ +__STD_TYPE __U32_TYPE __socklen_t; + + +#undef __STD_TYPE + +/* Used in `struct shmid_ds'. */ +typedef __kernel_ipc_pid_t __ipc_pid_t; + +/* Now add the thread types. */ +#if defined __UCLIBC_HAS_THREADS__ && (defined __USE_POSIX199506 || defined __USE_UNIX98) +# include +#endif + +#endif /* bits/types.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/typesizes.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/typesizes.h new file mode 100644 index 0000000..e9226c4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/typesizes.h @@ -0,0 +1,66 @@ +/* bits/typesizes.h -- underlying types for *_t. Generic version. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TYPESIZES_H +#define _BITS_TYPESIZES_H 1 + +/* See for the meaning of these macros. This file exists so + that need not vary across different GNU platforms. */ + +#define __DEV_T_TYPE __UQUAD_TYPE +#define __UID_T_TYPE __U32_TYPE +#define __GID_T_TYPE __U32_TYPE +#define __INO_T_TYPE __ULONGWORD_TYPE +#define __INO64_T_TYPE __UQUAD_TYPE +#define __MODE_T_TYPE __U32_TYPE +#define __NLINK_T_TYPE __UWORD_TYPE +#define __OFF_T_TYPE __SLONGWORD_TYPE +#define __OFF64_T_TYPE __SQUAD_TYPE +#define __PID_T_TYPE __S32_TYPE +#define __RLIM_T_TYPE __ULONGWORD_TYPE +#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __BLKCNT_T_TYPE __SLONGWORD_TYPE +#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __ID_T_TYPE __U32_TYPE +#define __CLOCK_T_TYPE __SLONGWORD_TYPE +#define __TIME_T_TYPE __SLONGWORD_TYPE +#define __USECONDS_T_TYPE __U32_TYPE +#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#define __DADDR_T_TYPE __S32_TYPE +#define __SWBLK_T_TYPE __SLONGWORD_TYPE +#define __KEY_T_TYPE __S32_TYPE +#define __CLOCKID_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * +#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE +#define __FSID_T_TYPE struct { int __val[2]; } +#define __SSIZE_T_TYPE __SWORD_TYPE + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +#endif /* bits/typesizes.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_arch_features.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_arch_features.h new file mode 100644 index 0000000..f8d954e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_arch_features.h @@ -0,0 +1,41 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +#define __UCLIBC_ABORT_INSTRUCTION__ "break 255" + +/* can your target use syscall6() for mmap ? */ +#define __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#define __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target prefix all symbols with an _ ? */ +#define __UCLIBC_NO_UNDERSCORES__ + +/* does your target have an asm .set ? */ +#undef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_clk_tck.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_clk_tck.h new file mode 100644 index 0000000..00b77bf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_clk_tck.h @@ -0,0 +1,8 @@ +/* Use a default of 100 for CLK_TCK to implement sysconf() and clock(). + * Override this by supplying an arch-specific version of this header file. + * + * WARNING: It is assumed that this is a constant integer value usable in + * preprocessor conditionals!!! + */ + +#define __UCLIBC_CLK_TCK_CONST 100 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_config.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_config.h new file mode 100644 index 0000000..05c39d7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_config.h @@ -0,0 +1,189 @@ +#if !defined __FEATURES_H && !defined __need_uClibc_config_h +# error Never include directly; use instead +#endif + +#define __UCLIBC_MAJOR__ 0 +#define __UCLIBC_MINOR__ 9 +#define __UCLIBC_SUBLEVEL__ 29 +/* Automatically generated make config: don't edit */ +/* Fri Jan 29 15:20:51 2010 */ +#undef __TARGET_alpha__ +#undef __TARGET_arm__ +#undef __TARGET_bfin__ +#undef __TARGET_cris__ +#undef __TARGET_e1__ +#undef __TARGET_frv__ +#undef __TARGET_h8300__ +#undef __TARGET_hppa__ +#undef __TARGET_i386__ +#undef __TARGET_i960__ +#undef __TARGET_ia64__ +#undef __TARGET_m68k__ +#undef __TARGET_microblaze__ +#define __TARGET_mips__ 1 +#undef __TARGET_nios__ +#undef __TARGET_nios2__ +#undef __TARGET_powerpc__ +#undef __TARGET_sh__ +#undef __TARGET_sh64__ +#undef __TARGET_sparc__ +#undef __TARGET_v850__ +#undef __TARGET_vax__ +#undef __TARGET_x86_64__ + +/* Target Architecture Features and Options */ +#define __TARGET_ARCH__ "mips" +#define __FORCE_OPTIONS_FOR_ARCH__ 1 +#define __ARCH_CFLAGS__ "-mno-split-addresses" +#define __CONFIG_MIPS_O32_ABI__ 1 +#undef __CONFIG_MIPS_N32_ABI__ +#undef __CONFIG_MIPS_N64_ABI__ +#undef __CONFIG_MIPS_ISA_1__ +#undef __CONFIG_MIPS_ISA_2__ +#undef __CONFIG_MIPS_ISA_3__ +#undef __CONFIG_MIPS_ISA_4__ +#define __CONFIG_MIPS_ISA_MIPS32__ 1 +#undef __CONFIG_MIPS_ISA_MIPS64__ +#define __TARGET_SUBARCH__ "" + +/* Using ELF file format */ +#define __ARCH_ANY_ENDIAN__ 1 +#define __ARCH_BIG_ENDIAN__ 1 +#define __ARCH_WANTS_BIG_ENDIAN__ 1 +#undef __ARCH_WANTS_LITTLE_ENDIAN__ +#define __ARCH_HAS_MMU__ 1 +#define __ARCH_USE_MMU__ 1 +#define __UCLIBC_HAS_FLOATS__ 1 +#undef __UCLIBC_HAS_FPU__ +#define __UCLIBC_HAS_SOFT_FLOAT__ 1 +#define __DO_C99_MATH__ 1 +#define __KERNEL_HEADERS__ "/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include" +#define __HAVE_DOT_CONFIG__ 1 + +/* General Library Settings */ +#undef __HAVE_NO_PIC__ +#define __DOPIC__ 1 +#undef __HAVE_NO_SHARED__ +#undef __ARCH_HAS_NO_LDSO__ +#define __HAVE_SHARED__ 1 +#define __FORCE_SHAREABLE_TEXT_SEGMENTS__ 1 +#define __LDSO_LDD_SUPPORT__ 1 +#define __LDSO_CACHE_SUPPORT__ 1 +#undef __LDSO_PRELOAD_FILE_SUPPORT__ +#define __LDSO_BASE_FILENAME__ "ld.so" +#undef __UCLIBC_STATIC_LDCONFIG__ +#undef __LDSO_RUNPATH__ +#define __UCLIBC_CTOR_DTOR__ 1 +#undef __HAS_NO_THREADS__ +#define __UCLIBC_HAS_THREADS__ 1 +#define __PTHREADS_DEBUG_SUPPORT__ 1 +#define __LINUXTHREADS_OLD__ 1 +#define __UCLIBC_HAS_LFS__ 1 +#undef __MALLOC__ +#undef __MALLOC_SIMPLE__ +#define __MALLOC_STANDARD__ 1 +#define __MALLOC_GLIBC_COMPAT__ 1 +#define __UCLIBC_DYNAMIC_ATEXIT__ 1 +#undef __COMPAT_ATEXIT__ +#define __UCLIBC_SUSV3_LEGACY__ 1 +#define __UCLIBC_SUSV3_LEGACY_MACROS__ 1 +#define __UCLIBC_HAS_SHADOW__ 1 +#undef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +#define __UCLIBC_HAS___PROGNAME__ 1 +#undef __UNIX98PTY_ONLY__ +#define __ASSUME_DEVPTS__ 1 +#define __UCLIBC_HAS_TM_EXTENSIONS__ 1 +#define __UCLIBC_HAS_TZ_CACHING__ 1 +#define __UCLIBC_HAS_TZ_FILE__ 1 +#define __UCLIBC_HAS_TZ_FILE_READ_MANY__ 1 +#define __UCLIBC_TZ_FILE_PATH__ "/etc/TZ" + +/* Advanced Library Settings */ +#define __UCLIBC_PWD_BUFFER_SIZE__ 256 +#define __UCLIBC_GRP_BUFFER_SIZE__ 256 + +/* Networking Support */ +#define __UCLIBC_HAS_IPV6__ 1 +#define __UCLIBC_HAS_RPC__ 1 +#define __UCLIBC_HAS_FULL_RPC__ 1 +#define __UCLIBC_HAS_REENTRANT_RPC__ 1 +#define __UCLIBC_USE_NETLINK__ 1 +#undef __UCLIBC_HAS_BSD_RES_CLOSE__ + +/* String and Stdio Support */ +#define __UCLIBC_HAS_STRING_GENERIC_OPT__ 1 +#define __UCLIBC_HAS_STRING_ARCH_OPT__ 1 +#define __UCLIBC_HAS_CTYPE_TABLES__ 1 +#define __UCLIBC_HAS_CTYPE_SIGNED__ 1 +#undef __UCLIBC_HAS_CTYPE_UNSAFE__ +#define __UCLIBC_HAS_CTYPE_CHECKED__ 1 +#undef __UCLIBC_HAS_CTYPE_ENFORCED__ +#define __UCLIBC_HAS_WCHAR__ 1 +#undef __UCLIBC_HAS_LOCALE__ +#undef __UCLIBC_HAS_HEXADECIMAL_FLOATS__ +#undef __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ +#define __UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS__ 9 +#undef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__ +#undef __UCLIBC_HAS_STDIO_BUFSIZ_NONE__ +#undef __UCLIBC_HAS_STDIO_BUFSIZ_256__ +#undef __UCLIBC_HAS_STDIO_BUFSIZ_512__ +#undef __UCLIBC_HAS_STDIO_BUFSIZ_1024__ +#undef __UCLIBC_HAS_STDIO_BUFSIZ_2048__ +#define __UCLIBC_HAS_STDIO_BUFSIZ_4096__ 1 +#undef __UCLIBC_HAS_STDIO_BUFSIZ_8192__ +#define __UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE__ 1 +#undef __UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4__ +#undef __UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8__ +#undef __UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT__ +#define __UCLIBC_HAS_STDIO_GETC_MACRO__ 1 +#define __UCLIBC_HAS_STDIO_PUTC_MACRO__ 1 +#define __UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION__ 1 +#define __UCLIBC_HAS_FOPEN_LARGEFILE_MODE__ 1 +#define __UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE__ 1 +#define __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ 1 +#define __UCLIBC_HAS_PRINTF_M_SPEC__ 1 +#define __UCLIBC_HAS_ERRNO_MESSAGES__ 1 +#undef __UCLIBC_HAS_SYS_ERRLIST__ +#define __UCLIBC_HAS_SIGNUM_MESSAGES__ 1 +#undef __UCLIBC_HAS_SYS_SIGLIST__ +#define __UCLIBC_HAS_GNU_GETOPT__ 1 +#define __UCLIBC_HAS_GNU_GETSUBOPT__ 1 + +/* Big and Tall */ +#define __UCLIBC_HAS_REGEX__ 1 +#define __UCLIBC_HAS_REGEX_OLD__ 1 +#define __UCLIBC_HAS_FNMATCH__ 1 +#define __UCLIBC_HAS_FNMATCH_OLD__ 1 +#undef __UCLIBC_HAS_WORDEXP__ +#undef __UCLIBC_HAS_FTW__ +#define __UCLIBC_HAS_GLOB__ 1 +#undef __UCLIBC_HAS_GNU_GLOB__ + +/* Library Installation Options */ +#define __SHARED_LIB_LOADER_PREFIX__ "/lib" +#define __RUNTIME_PREFIX__ "/" +#define __DEVEL_PREFIX__ "/usr/" + +/* Security options */ +#undef __UCLIBC_BUILD_PIE__ +#undef __UCLIBC_HAS_ARC4RANDOM__ +#undef __HAVE_NO_SSP__ +#undef __UCLIBC_HAS_SSP__ +#define __UCLIBC_BUILD_RELRO__ 1 +#define __UCLIBC_BUILD_NOW__ 1 +#undef __UCLIBC_BUILD_NOEXECSTACK__ + +/* uClibc development/debugging options */ +#define __CROSS_COMPILER_PREFIX__ "/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-" +#define __UCLIBC_EXTRA_CFLAGS__ "" +#undef __DODEBUG__ +#undef __DODEBUG_PT__ +#define __DOSTRIP__ 1 +#undef __DOASSERTS__ +#undef __SUPPORT_LD_DEBUG__ +#undef __SUPPORT_LD_DEBUG_EARLY__ +#undef __UCLIBC_MALLOC_DEBUGGING__ +#define __WARNINGS__ "-Wall" +#undef __EXTRA_WARNINGS__ +#undef __DOMULTI__ +#undef __UCLIBC_MJN3_ONLY__ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_ctype.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_ctype.h new file mode 100644 index 0000000..dd723c7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_ctype.h @@ -0,0 +1,279 @@ +/* Copyright (C) 2002 Manuel Novoa III + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + */ + +/* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! + * + * Besides uClibc, I'm using this code in my libc for elks, which is + * a 16-bit environment with a fairly limited compiler. It would make + * things much easier for me if this file isn't modified unnecessarily. + * In particular, please put any new or replacement functions somewhere + * else, and modify the makefile to use your version instead. + * Thanks. Manuel + * + * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */ + +#if !defined(_CTYPE_H) && !defined(_WCTYPE_H) +#error Always include <{w}ctype.h> rather than +#endif + +#ifndef _BITS_CTYPE_H +#define _BITS_CTYPE_H + +#ifdef __UCLIBC_GEN_LOCALE + +/* Taking advantage of the C99 mutual-exclusion guarantees for the various + * (w)ctype classes, including the descriptions of printing and control + * (w)chars, we can place each in one of the following mutually-exlusive + * subsets. Since there are less than 16, we can store the data for + * each (w)chars in a nibble. In contrast, glibc uses an unsigned int + * per (w)char, with one bit flag for each is* type. While this allows + * a simple '&' operation to determine the type vs. a range test and a + * little special handling for the "blank" and "xdigit" types in my + * approach, it also uses 8 times the space for the tables on the typical + * 32-bit archs we supported.*/ +enum { + __CTYPE_unclassified = 0, + __CTYPE_alpha_nonupper_nonlower, + __CTYPE_alpha_lower, + __CTYPE_alpha_upper_lower, + __CTYPE_alpha_upper, + __CTYPE_digit, + __CTYPE_punct, + __CTYPE_graph, + __CTYPE_print_space_nonblank, + __CTYPE_print_space_blank, + __CTYPE_space_nonblank_noncntrl, + __CTYPE_space_blank_noncntrl, + __CTYPE_cntrl_space_nonblank, + __CTYPE_cntrl_space_blank, + __CTYPE_cntrl_nonspace +}; + +/* Some macros that test for various (w)ctype classes when passed one of the + * designator values enumerated above. */ +#define __CTYPE_isalnum(D) ((unsigned int)(D-1) <= (__CTYPE_digit-1)) +#define __CTYPE_isalpha(D) ((unsigned int)(D-1) <= (__CTYPE_alpha_upper-1)) +#define __CTYPE_isblank(D) \ + ((((unsigned int)(D - __CTYPE_print_space_nonblank)) <= 5) && (D & 1)) +#define __CTYPE_iscntrl(D) (((unsigned int)(D - __CTYPE_cntrl_space_nonblank)) <= 2) +#define __CTYPE_isdigit(D) (D == __CTYPE_digit) +#define __CTYPE_isgraph(D) ((unsigned int)(D-1) <= (__CTYPE_graph-1)) +#define __CTYPE_islower(D) (((unsigned int)(D - __CTYPE_alpha_lower)) <= 1) +#define __CTYPE_isprint(D) ((unsigned int)(D-1) <= (__CTYPE_print_space_blank-1)) +#define __CTYPE_ispunct(D) (D == __CTYPE_punct) +#define __CTYPE_isspace(D) (((unsigned int)(D - __CTYPE_print_space_nonblank)) <= 5) +#define __CTYPE_isupper(D) (((unsigned int)(D - __CTYPE_alpha_upper_lower)) <= 1) +/* #define __CTYPE_isxdigit(D) -- isxdigit is untestable this way. + * But that's ok as isxdigit() (and isdigit() too) are locale-invariant. */ + +#else /* __UCLIBC_GEN_LOCALE *****************************************/ + +/* Define some ctype macros valid for the C/POSIX locale. */ + +/* ASCII ords of \t, \f, \n, \r, and \v are 9, 12, 10, 13, 11 respectively. */ +#define __C_isspace(c) \ + ((sizeof(c) == sizeof(char)) \ + ? ((((c) == ' ') || (((unsigned char)((c) - 9)) <= (13 - 9)))) \ + : ((((c) == ' ') || (((unsigned int)((c) - 9)) <= (13 - 9))))) +#define __C_isblank(c) (((c) == ' ') || ((c) == '\t')) +#define __C_isdigit(c) \ + ((sizeof(c) == sizeof(char)) \ + ? (((unsigned char)((c) - '0')) < 10) \ + : (((unsigned int)((c) - '0')) < 10)) +#define __C_isxdigit(c) \ + (__C_isdigit(c) \ + || ((sizeof(c) == sizeof(char)) \ + ? (((unsigned char)((((c)) | 0x20) - 'a')) < 6) \ + : (((unsigned int)((((c)) | 0x20) - 'a')) < 6))) +#define __C_iscntrl(c) \ + ((sizeof(c) == sizeof(char)) \ + ? ((((unsigned char)(c)) < 0x20) || ((c) == 0x7f)) \ + : ((((unsigned int)(c)) < 0x20) || ((c) == 0x7f))) +#define __C_isalpha(c) \ + ((sizeof(c) == sizeof(char)) \ + ? (((unsigned char)(((c) | 0x20) - 'a')) < 26) \ + : (((unsigned int)(((c) | 0x20) - 'a')) < 26)) +#define __C_isalnum(c) (__C_isalpha(c) || __C_isdigit(c)) +#define __C_isprint(c) \ + ((sizeof(c) == sizeof(char)) \ + ? (((unsigned char)((c) - 0x20)) <= (0x7e - 0x20)) \ + : (((unsigned int)((c) - 0x20)) <= (0x7e - 0x20))) +#define __C_islower(c) \ + ((sizeof(c) == sizeof(char)) \ + ? (((unsigned char)((c) - 'a')) < 26) \ + : (((unsigned int)((c) - 'a')) < 26)) +#define __C_isupper(c) \ + ((sizeof(c) == sizeof(char)) \ + ? (((unsigned char)((c) - 'A')) < 26) \ + : (((unsigned int)((c) - 'A')) < 26)) +#define __C_ispunct(c) \ + ((!__C_isalnum(c)) \ + && ((sizeof(c) == sizeof(char)) \ + ? (((unsigned char)((c) - 0x21)) <= (0x7e - 0x21)) \ + : (((unsigned int)((c) - 0x21)) <= (0x7e - 0x21)))) +#define __C_isgraph(c) \ + ((sizeof(c) == sizeof(char)) \ + ? (((unsigned int)((c) - 0x21)) <= (0x7e - 0x21)) \ + : (((unsigned int)((c) - 0x21)) <= (0x7e - 0x21))) + +#define __C_tolower(c) (__C_isupper(c) ? ((c) | 0x20) : (c)) +#define __C_toupper(c) (__C_islower(c) ? ((c) ^ 0x20) : (c)) + +/**********************************************************************/ +__BEGIN_DECLS + +extern int isalnum(int c) __THROW; +extern int isalpha(int c) __THROW; +#ifdef __USE_ISOC99 +extern int isblank(int c) __THROW; +#endif +extern int iscntrl(int c) __THROW; +extern int isdigit(int c) __THROW; +extern int isgraph(int c) __THROW; +extern int islower(int c) __THROW; +extern int isprint(int c) __THROW; +extern int ispunct(int c) __THROW; +extern int isspace(int c) __THROW; +extern int isupper(int c) __THROW; +extern int isxdigit(int c) __THROW; + +extern int tolower(int c) __THROW; +extern int toupper(int c) __THROW; + +#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +extern int isascii(int c) __THROW; +extern int toascii(int c) __THROW; +#endif + +#if defined _LIBC && (defined NOT_IN_libc || defined IS_IN_libc) +/* isdigit() is really locale-invariant, so provide some small fast macros. + * These are uClibc-specific. */ +#define __isdigit_char(C) (((unsigned char)((C) - '0')) <= 9) +#define __isdigit_int(C) (((unsigned int)((C) - '0')) <= 9) +#endif + +/* Next, some ctype macros which are valid for all supported locales. */ +/* WARNING: isspace and isblank need to be reverified if more 8-bit codesets + * are added!!! But isdigit and isxdigit are always valid. */ + +/* #define __isspace(c) __C_isspace(c) */ +/* #define __isblank(c) __C_isblank(c) */ + +/* #define __isdigit(c) __C_isdigit(c) */ +/* #define __isxdigit(c) __C_isxdigit(c) */ + +/* Now some non-ansi/iso c99 macros. */ + +#define __isascii(c) (((c) & ~0x7f) == 0) +#define __toascii(c) ((c) & 0x7f) +#define _toupper(c) ((c) ^ 0x20) +#define _tolower(c) ((c) | 0x20) + +__END_DECLS + +/**********************************************************************/ +#ifdef __GNUC__ + +#define __isbody_C_macro(f,args) __C_ ## f args + +#define __isbody(f,c) \ + (__extension__ ({ \ + int __res; \ + if (sizeof(c) > sizeof(char)) { \ + int __c = (c); \ + __res = __isbody_C_macro(f,(__c)); \ + } else { \ + unsigned char __c = (c); \ + __res = __isbody_C_macro(f,(__c)); \ + } \ + __res; \ + })) + +#define __body_C_macro(f,args) __C_ ## f args + +#define __body(f,c) \ + (__extension__ ({ \ + int __res; \ + if (sizeof(c) > sizeof(char)) { \ + int __c = (c); \ + __res = __body_C_macro(f,(__c)); \ + } else { \ + unsigned char __c = (c); \ + __res = __body_C_macro(f,(__c)); \ + } \ + __res; \ + })) + +#define __isspace(c) __body(isspace,c) +#define __isblank(c) __body(isblank,c) +#define __isdigit(c) __body(isdigit,c) +#define __isxdigit(c) __body(isxdigit,c) +#define __iscntrl(c) __body(iscntrl,c) +#define __isalpha(c) __body(isalpha,c) +#define __isalnum(c) __body(isalnum,c) +#define __isprint(c) __body(isprint,c) +#define __islower(c) __body(islower,c) +#define __isupper(c) __body(isupper,c) +#define __ispunct(c) __body(ispunct,c) +#define __isgraph(c) __body(isgraph,c) + +#define __tolower(c) __body(tolower,c) +#define __toupper(c) __body(toupper,c) + +#if !defined __NO_CTYPE && !defined __cplusplus + +#define isspace(c) __isspace(c) +#define isblank(c) __isblank(c) +#define isdigit(c) __isdigit(c) +#define isxdigit(c) __isxdigit(c) +#define iscntrl(c) __iscntrl(c) +#define isalpha(c) __isalpha(c) +#define isalnum(c) __isalnum(c) +#define isprint(c) __isprint(c) +#define islower(c) __islower(c) +#define isupper(c) __isupper(c) +#define ispunct(c) __ispunct(c) +#define isgraph(c) __isgraph(c) + +#define tolower(c) __tolower(c) +#define toupper(c) __toupper(c) + + +#endif + +#else /* _GNUC__ ***************************************************/ + +#if !defined __NO_CTYPE && !defined __cplusplus + +/* These macros should be safe from side effects. */ + +#define isdigit(c) __C_isdigit(c) +#define isalpha(c) __C_isalpha(c) +#define isprint(c) __C_isprint(c) +#define islower(c) __C_islower(c) +#define isupper(c) __C_isupper(c) +#define isgraph(c) __C_isgraph(c) + +#endif + +#endif /* __GNUC__ */ +/**********************************************************************/ + +#endif /* __UCLIBC_GEN_LOCALE */ + +#endif /* _BITS_CTYPE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_errno.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_errno.h new file mode 100644 index 0000000..b16de32 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_errno.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +#ifndef _BITS_UCLIBC_ERRNO_H +#define _BITS_UCLIBC_ERRNO_H 1 + +#ifdef IS_IN_rtld +# undef errno +# define errno _dl_errno +extern int _dl_errno; // attribute_hidden; +#elif defined __UCLIBC_HAS_THREADS__ +# include +# if defined USE___THREAD && USE___THREAD +# undef errno +# ifndef NOT_IN_libc +# define errno __libc_errno +# else +# define errno errno +# endif +extern __thread int errno __attribute_tls_model_ie; +# endif /* USE___THREAD */ +#endif /* IS_IN_rtld */ + +#define __set_errno(val) (errno = (val)) + +#ifndef __ASSEMBLER__ +extern int *__errno_location (void) __THROW __attribute__ ((__const__)) +# ifdef IS_IN_rtld + attribute_hidden +# endif +; +# if defined __UCLIBC_HAS_THREADS__ +# include +# if defined USE___THREAD && USE___THREAD +libc_hidden_proto(__errno_location) +# endif +# endif + +#endif /* !__ASSEMBLER__ */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_fpmax.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_fpmax.h new file mode 100644 index 0000000..e1721bf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_fpmax.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2003-2006 Manuel Novoa III + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* Define a maximal floating point type, and the associated constants + * that are defined for the floating point types in float.h. + * + * This is to support archs that are missing long double, or even double. + */ + +#ifndef _UCLIBC_FPMAX_H +#define _UCLIBC_FPMAX_H + +#ifndef _ISOC99_SOURCE +#define _ISOC99_SOURCE 1 +#endif + +#include +#include + +#ifdef __UCLIBC_HAS_FLOATS__ + +#if defined(LDBL_MANT_DIG) + +typedef long double __fpmax_t; +#define FPMAX_TYPE 3 + +#define FPMAX_MANT_DIG LDBL_MANT_DIG +#define FPMAX_DIG LDBL_DIG +#define FPMAX_EPSILON LDBL_EPSILON +#define FPMAX_MIN_EXP LDBL_MIN_EXP +#define FPMAX_MIN LDBL_MIN +#define FPMAX_MIN_10_EXP LDBL_MIN_10_EXP +#define FPMAX_MAX_EXP LDBL_MAX_EXP +#define FPMAX_MAX LDBL_MAX +#define FPMAX_MAX_10_EXP LDBL_MAX_10_EXP + +#elif defined(DBL_MANT_DIG) + +typedef double __fpmax_t; +#define FPMAX_TYPE 2 + +#define FPMAX_MANT_DIG DBL_MANT_DIG +#define FPMAX_DIG DBL_DIG +#define FPMAX_EPSILON DBL_EPSILON +#define FPMAX_MIN_EXP DBL_MIN_EXP +#define FPMAX_MIN DBL_MIN +#define FPMAX_MIN_10_EXP DBL_MIN_10_EXP +#define FPMAX_MAX_EXP DBL_MAX_EXP +#define FPMAX_MAX DBL_MAX +#define FPMAX_MAX_10_EXP DBL_MAX_10_EXP + +#elif defined(FLT_MANT_DIG) + +typedef float __fpmax_t; +#define FPMAX_TYPE 1 + +#define FPMAX_MANT_DIG FLT_MANT_DIG +#define FPMAX_DIG FLT_DIG +#define FPMAX_EPSILON FLT_EPSILON +#define FPMAX_MIN_EXP FLT_MIN_EXP +#define FPMAX_MIN FLT_MIN +#define FPMAX_MIN_10_EXP FLT_MIN_10_EXP +#define FPMAX_MAX_EXP FLT_MAX_EXP +#define FPMAX_MAX FLT_MAX +#define FPMAX_MAX_10_EXP FLT_MAX_10_EXP + +#else +#error unable to determine appropriate type for __fpmax_t! +#endif + +#ifndef DECIMAL_DIG + +#ifdef L___strtofpmax +/* Emit warning only once. */ +#warning DECIMAL_DIG is not defined! If you are using gcc, it may not be defining __STDC_VERSION__ as it should. +#endif +#if !defined(FLT_RADIX) || (FLT_RADIX != 2) +#error unable to compensate for missing DECIMAL_DIG! +#endif + +/* ceil (1 + #mantissa * log10 (FLT_RADIX)) */ +#define DECIMAL_DIG (1 + (((FPMAX_MANT_DIG * 100) + 331) / 332)) + +#endif /* DECIMAL_DIG */ + +#if defined _LIBC && defined IS_IN_libc +extern __fpmax_t __strtofpmax(const char *str, char **endptr, int exp_adjust) attribute_hidden; + +#ifdef __UCLIBC_HAS_XLOCALE__ +extern __fpmax_t __strtofpmax_l(const char *str, char **endptr, int exp_adjust, + __locale_t locale_arg) attribute_hidden; +#endif + +#ifdef __UCLIBC_HAS_WCHAR__ +extern __fpmax_t __wcstofpmax(const wchar_t *wcs, wchar_t **endptr, + int exp_adjust) attribute_hidden; + +#ifdef __UCLIBC_HAS_XLOCALE__ +extern __fpmax_t __wcstofpmax_l(const wchar_t *wcs, wchar_t **endptr, + int exp_adjust, __locale_t locale_arg) attribute_hidden; +#endif +#endif /* __UCLIBC_HAS_WCHAR__ */ +#endif /* _LIBC */ + +/* The following checks in an __fpmax_t is either 0 or +/- infinity. + * + * WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! + * + * This only works if __fpmax_t is the actual maximal floating point type used + * in intermediate calculations. Otherwise, excess precision in the + * intermediate values can cause the test to fail. + * + * WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! + */ + +#define __FPMAX_ZERO_OR_INF_CHECK(x) ((x) == ((x)/4) ) + +#endif /* __UCLIBC_HAS_FLOATS__ */ + +#endif /* _UCLIBC_FPMAX_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_local_lim.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_local_lim.h new file mode 100644 index 0000000..6c23f39 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_local_lim.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* + * Never include this file directly; use instead. + */ + +#ifndef _BITS_UCLIBC_LOCAL_LIM_H +#define _BITS_UCLIBC_LOCAL_LIM_H 1 + +/* This file works correctly only if local_lim.h is the NPTL version */ +#if !defined PTHREAD_KEYS_MAX || defined TIMER_MAX +# error local_lim.h was incorrectly updated, use the NPTL version from glibc +#endif + +/* This should really be moved to thread specific directories */ +#if defined __UCLIBC_HAS_THREADS__ +# define PTHREAD_THREADS_MAX 1024 +# define TIMER_MAX 256 +#endif + +#ifndef __UCLIBC_HAS_THREADS__ +# undef _POSIX_THREAD_KEYS_MAX +# undef PTHREAD_KEYS_MAX +# undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# undef PTHREAD_STACK_MIN +# undef DELAYTIMER_MAX +#endif + +#endif /* bits/uClibc_local_lim.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_locale.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_locale.h new file mode 100644 index 0000000..1de735a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_locale.h @@ -0,0 +1,380 @@ +/* Copyright (C) 2002, 2003 Manuel Novoa III + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + */ + +/* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! + * + * Besides uClibc, I'm using this code in my libc for elks, which is + * a 16-bit environment with a fairly limited compiler. It would make + * things much easier for me if this file isn't modified unnecessarily. + * In particular, please put any new or replacement functions somewhere + * else, and modify the makefile to use your version instead. + * Thanks. Manuel + * + * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */ + +#ifndef _UCLIBC_LOCALE_H +#define _UCLIBC_LOCALE_H + +/**********************************************************************/ +/* uClibc compatibilty stuff */ + +#ifdef __UCLIBC_HAS_LOCALE__ + +#undef __LOCALE_C_ONLY + +#else /* __UCLIBC_HAS_LOCALE__ */ + +#define __LOCALE_C_ONLY + +#define __XL_NPP(N) N +#define __LOCALE_PARAM +#define __LOCALE_ARG + +#endif /* __UCLIBC_HAS_LOCALE__ */ + +/**********************************************************************/ + +#define __NL_ITEM_CATEGORY_SHIFT (8) +#define __NL_ITEM_INDEX_MASK (0xff) + +/* TODO: Make sure these agree with the locale mmap file gererator! */ + +#define __LC_CTYPE 0 +#define __LC_NUMERIC 1 +#define __LC_MONETARY 2 +#define __LC_TIME 3 +#define __LC_COLLATE 4 +#define __LC_MESSAGES 5 +#define __LC_ALL 6 + +/**********************************************************************/ +#ifndef __LOCALE_C_ONLY + +#if defined _LIBC /* && (defined IS_IN_libc || defined NOT_IN_libc) */ +#include +#include +#include + +#ifndef __UCLIBC_GEN_LOCALE +#include +#endif +#endif + +/* extern void _locale_set(const unsigned char *p); */ +/* extern void _locale_init(void); */ + +enum { + __ctype_encoding_7_bit, /* C/POSIX */ + __ctype_encoding_utf8, /* UTF-8 */ + __ctype_encoding_8_bit /* for 8-bit codeset locales */ +}; + +#define LOCALE_STRING_SIZE (2 * __LC_ALL + 2) + + /* + * '#' + 2_per_category + '\0' + * {locale row # : 0 = C|POSIX} + 0x8001 + * encoded in two chars as (((N+1) >> 8) | 0x80) and ((N+1) & 0xff) + * so decode is ((((uint16_t)(*s & 0x7f)) << 8) + s[1]) - 1 + * + * Note: 0s are not used as they are nul-terminators for strings. + * Note: 0xff, 0xff is the encoding for a non-selected locale. + * (see setlocale() below). + * In particular, C/POSIX locale is '#' + "\x80\x01"}*LC_ALL + nul. + */ + +#if defined _LIBC && !defined __UCLIBC_GEN_LOCALE /* && (defined IS_IN_libc || defined NOT_IN_libc) */ +typedef struct { + uint16_t num_weights; + uint16_t num_starters; + uint16_t ii_shift; + uint16_t ti_shift; + uint16_t ii_len; + uint16_t ti_len; + uint16_t max_weight; + uint16_t num_col_base; + uint16_t max_col_index; + uint16_t undefined_idx; + uint16_t range_low; + uint16_t range_count; + uint16_t range_base_weight; + uint16_t range_rule_offset; /* change name to index? */ + + uint16_t ii_mask; + uint16_t ti_mask; + + const uint16_t *index2weight_tbl; + const uint16_t *index2ruleidx_tbl; + const uint16_t *multistart_tbl; + /* uint16_t wcs2colidt_offset_low; */ + /* uint16_t wcs2colidt_offset_hi; */ + const uint16_t *wcs2colidt_tbl; + + /* uint16_t undefined_idx; */ + const uint16_t *overrides_tbl; + /* uint16_t *multistart_tbl; */ + + const uint16_t *weightstr; + const uint16_t *ruletable; + + + uint16_t *index2weight; + uint16_t *index2ruleidx; + + uint16_t MAX_WEIGHTS; +} __collate_t; + + +/* static unsigned char cur_locale[LOCALE_STRING_SIZE]; */ + +typedef struct __uclibc_locale_struct { +#ifdef __UCLIBC_HAS_XLOCALE__ + const __ctype_mask_t *__ctype_b; + const __ctype_touplow_t *__ctype_tolower; + const __ctype_touplow_t *__ctype_toupper; +#endif + + /* For now, just embed this in the structure. */ + __ctype_mask_t __ctype_b_data[256 + __UCLIBC_CTYPE_B_TBL_OFFSET]; + __ctype_touplow_t __ctype_tolower_data[256 + __UCLIBC_CTYPE_TO_TBL_OFFSET]; + __ctype_touplow_t __ctype_toupper_data[256 + __UCLIBC_CTYPE_TO_TBL_OFFSET]; + +/* int tables_loaded; */ +/* unsigned char lctypes[LOCALE_STRING_SIZE]; */ + unsigned char cur_locale[LOCALE_STRING_SIZE]; + + /* NL_LANGINFO stuff. BEWARE ORDERING!!! must agree with NL_* constants! */ + /* Also, numeric must be followed by monetary and the items must be in + * the "struct lconv" order. */ + + uint16_t category_offsets[__LC_ALL]; /* TODO -- fix? */ + unsigned char category_item_count[__LC_ALL]; /* TODO - fix */ + + /* ctype */ + unsigned char encoding; /* C/POSIX, 8-bit, UTF-8 */ + unsigned char mb_cur_max; /* determined by encoding _AND_ translit!!! */ + const unsigned char outdigit_length[10]; + +#ifdef __CTYPE_HAS_8_BIT_LOCALES + const unsigned char *idx8ctype; + const unsigned char *tbl8ctype; + const unsigned char *idx8uplow; + const unsigned char *tbl8uplow; +#ifdef __UCLIBC_HAS_WCHAR__ + const unsigned char *idx8c2wc; + const uint16_t *tbl8c2wc; /* char > 0x7f to wide char */ + const unsigned char *idx8wc2c; + const unsigned char *tbl8wc2c; + /* translit */ +#endif /* __UCLIBC_HAS_WCHAR__ */ +#endif /* __CTYPE_HAS_8_BIT_LOCALES */ +#ifdef __UCLIBC_HAS_WCHAR__ + + const uint16_t *code2flag; + + const unsigned char *tblwctype; + const unsigned char *tblwuplow; +/* const unsigned char *tblwcomb; */ + const int16_t *tblwuplow_diff; /* yes... signed */ + /* width?? */ + + wchar_t decimal_point_wc; + wchar_t thousands_sep_wc; + int decimal_point_len; + int thousands_sep_len; + +#endif /* __UCLIBC_HAS_WCHAR__ */ + + /* ctype */ + const char *outdigit0_mb; + const char *outdigit1_mb; + const char *outdigit2_mb; + const char *outdigit3_mb; + const char *outdigit4_mb; + const char *outdigit5_mb; + const char *outdigit6_mb; + const char *outdigit7_mb; + const char *outdigit8_mb; + const char *outdigit9_mb; + const char *codeset; /* MUST BE LAST!!! */ + + /* numeric */ + const char *decimal_point; + const char *thousands_sep; + const char *grouping; + + /* monetary */ + const char *int_curr_symbol; + const char *currency_symbol; + const char *mon_decimal_point; + const char *mon_thousands_sep; + const char *mon_grouping; + const char *positive_sign; + const char *negative_sign; + const char *int_frac_digits; + const char *frac_digits; + const char *p_cs_precedes; + const char *p_sep_by_space; + const char *n_cs_precedes; + const char *n_sep_by_space; + const char *p_sign_posn; + const char *n_sign_posn; + const char *int_p_cs_precedes; + const char *int_p_sep_by_space; + const char *int_n_cs_precedes; + const char *int_n_sep_by_space; + const char *int_p_sign_posn; + const char *int_n_sign_posn; + + const char *crncystr; /* not returned by localeconv */ + + /* time */ + const char *abday_1; + const char *abday_2; + const char *abday_3; + const char *abday_4; + const char *abday_5; + const char *abday_6; + const char *abday_7; + + const char *day_1; + const char *day_2; + const char *day_3; + const char *day_4; + const char *day_5; + const char *day_6; + const char *day_7; + + const char *abmon_1; + const char *abmon_2; + const char *abmon_3; + const char *abmon_4; + const char *abmon_5; + const char *abmon_6; + const char *abmon_7; + const char *abmon_8; + const char *abmon_9; + const char *abmon_10; + const char *abmon_11; + const char *abmon_12; + + const char *mon_1; + const char *mon_2; + const char *mon_3; + const char *mon_4; + const char *mon_5; + const char *mon_6; + const char *mon_7; + const char *mon_8; + const char *mon_9; + const char *mon_10; + const char *mon_11; + const char *mon_12; + + const char *am_str; + const char *pm_str; + + const char *d_t_fmt; + const char *d_fmt; + const char *t_fmt; + const char *t_fmt_ampm; + const char *era; + + const char *era_year; /* non SUSv3 */ + const char *era_d_fmt; + const char *alt_digits; + const char *era_d_t_fmt; + const char *era_t_fmt; + + /* collate is at the end */ + + /* messages */ + const char *yesexpr; + const char *noexpr; + const char *yesstr; + const char *nostr; + + /* collate is at the end */ + __collate_t collate; + +} __uclibc_locale_t; + +extern __uclibc_locale_t __global_locale_data; +extern struct __uclibc_locale_struct * __global_locale; +#endif /* _LIBC */ + +typedef struct __uclibc_locale_struct *__locale_t; + +/* if we need to leave only _LIBC, then attribute_hidden is not usable */ +#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) +extern int __locale_mbrtowc_l(wchar_t *__restrict dst, + const char *__restrict src, + __locale_t loc ) attribute_hidden; +#endif + +#ifdef L_setlocale +/* so we only get the warning once... */ +#warning need thread version of CUR_LOCALE! +#endif +/**********************************************************************/ +#ifdef __UCLIBC_HAS_XLOCALE__ + +extern __locale_t __curlocale_var; + +#ifdef __UCLIBC_HAS_THREADS__ + +extern __locale_t __curlocale(void) __THROW __attribute__ ((__const__)); +extern __locale_t __curlocale_set(__locale_t newloc); +#define __UCLIBC_CURLOCALE (__curlocale()) +#define __UCLIBC_CURLOCALE_DATA (*__curlocale()) + +#else /* __UCLIBC_HAS_THREADS__ */ + +#define __UCLIBC_CURLOCALE (__curlocale_var) +#define __UCLIBC_CURLOCALE_DATA (*__curlocale_var) + +#endif /* __UCLIBC_HAS_THREADS__ */ + +#elif defined(__UCLIBC_HAS_LOCALE__) + +#define __UCLIBC_CURLOCALE (__global_locale) +#define __UCLIBC_CURLOCALE_DATA (*__global_locale) + +#endif +/**********************************************************************/ +#if defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) + +#define __XL_NPP(N) N ## _l +#define __LOCALE_PARAM , __locale_t locale_arg +#define __LOCALE_ARG , locale_arg +#define __LOCALE_PTR locale_arg + +#else /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) */ + +#define __XL_NPP(N) N +#define __LOCALE_PARAM +#define __LOCALE_ARG +#define __LOCALE_PTR __UCLIBC_CURLOCALE + +#endif /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) */ +/**********************************************************************/ + +#endif /* !defined(__LOCALE_C_ONLY) */ +/**********************************************************************/ + +#endif /* _UCLIBC_LOCALE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_mutex.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_mutex.h new file mode 100644 index 0000000..14aeb9c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_mutex.h @@ -0,0 +1,88 @@ +/* Copyright (C) 2006 Manuel Novoa III + * + * GNU Library General Public License (LGPL) version 2 or later. + * + * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. + */ + +#ifndef _UCLIBC_MUTEX_H +#define _UCLIBC_MUTEX_H + +#include + +#ifdef __UCLIBC_HAS_THREADS__ + +#include +#include + +#define __UCLIBC_MUTEX_TYPE pthread_mutex_t + +#define __UCLIBC_MUTEX(M) pthread_mutex_t M +#define __UCLIBC_MUTEX_INIT(M,I) pthread_mutex_t M = I +#define __UCLIBC_MUTEX_STATIC(M,I) static pthread_mutex_t M = I +#define __UCLIBC_MUTEX_EXTERN(M) extern pthread_mutex_t M + +#define __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(M) \ + __pthread_mutex_lock(&(M)) + +#define __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE(M) \ + __pthread_mutex_unlock(&(M)) + +#define __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE(M) \ + __pthread_mutex_trylock(&(M)) + +#define __UCLIBC_MUTEX_CONDITIONAL_LOCK(M,C) \ + do { \ + struct _pthread_cleanup_buffer __infunc_pthread_cleanup_buffer; \ + if (C) { \ + _pthread_cleanup_push_defer(&__infunc_pthread_cleanup_buffer, \ + (void (*) (void *))__pthread_mutex_unlock, \ + &(M)); \ + __pthread_mutex_lock(&(M)); \ + } \ + ((void)0) + +#define __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M,C) \ + if (C) { \ + _pthread_cleanup_pop_restore(&__infunc_pthread_cleanup_buffer,1); \ + } \ + } while (0) + +#define __UCLIBC_MUTEX_AUTO_LOCK_VAR(A) int A + +#define __UCLIBC_MUTEX_AUTO_LOCK(M,A,V) \ + __UCLIBC_MUTEX_CONDITIONAL_LOCK(M,((A=(V)) == 0)) + +#define __UCLIBC_MUTEX_AUTO_UNLOCK(M,A) \ + __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M,(A == 0)) + +#define __UCLIBC_MUTEX_LOCK(M) \ + __UCLIBC_MUTEX_CONDITIONAL_LOCK(M, 1) + +#define __UCLIBC_MUTEX_UNLOCK(M) \ + __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M, 1) + +#else + +#define __UCLIBC_MUTEX(M) void *__UCLIBC_MUTEX_DUMMY_ ## M +#define __UCLIBC_MUTEX_INIT(M,I) extern void *__UCLIBC_MUTEX_DUMMY_ ## M +#define __UCLIBC_MUTEX_STATIC(M,I) extern void *__UCLIBC_MUTEX_DUMMY_ ## M +#define __UCLIBC_MUTEX_EXTERN(M) extern void *__UCLIBC_MUTEX_DUMMY_ ## M + +#define __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(M) ((void)0) +#define __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE(M) ((void)0) +#define __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE(M) (0) /* Always succeed? */ + +#define __UCLIBC_MUTEX_CONDITIONAL_LOCK(M,C) ((void)0) +#define __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M,C) ((void)0) + +#define __UCLIBC_MUTEX_AUTO_LOCK_VAR(A) ((void)0) +#define __UCLIBC_MUTEX_AUTO_LOCK(M,A,V) ((void)0) +#define __UCLIBC_MUTEX_AUTO_UNLOCK(M,A) ((void)0) + +#define __UCLIBC_MUTEX_LOCK(M) ((void)0) +#define __UCLIBC_MUTEX_UNLOCK(M) ((void)0) + +#endif + +#endif /* _UCLIBC_MUTEX_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_page.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_page.h new file mode 100644 index 0000000..915918c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_page.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2004 Erik Andersen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Supply an architecture specific value for PAGE_SIZE and friends. */ + +#ifndef _UCLIBC_PAGE_H +#define _UCLIBC_PAGE_H + +/* PAGE_SIZE of mips is sortof wierd, and depends on how the kernel + * happens to have been configured. It might use 4KB, 16K or 64K + * pages. To avoid using the current kernel configuration settings, + * uClibc will simply use 4KB on mips and call it good. */ +#if 0 +#define PAGE_SHIFT 16 +#define PAGE_SHIFT 14 +#endif +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#endif /* _UCLIBC_PAGE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_pthread.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_pthread.h new file mode 100644 index 0000000..1d6209f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_pthread.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2003 Manuel Novoa III + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + */ + +/* Supply prototypes for the internal thread functions used by the + * uClibc library code. + */ + +#ifndef _UCLIBC_PTHREAD_H +#define _UCLIBC_PTHREAD_H + +#ifndef _PTHREAD_H +# error "Always include rather than " +#endif + +#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) +/* Threading functions internal to uClibc. Make these thread functions + * weak so that we can elide them from single-threaded processes. */ +extern int weak_function __pthread_mutex_init (pthread_mutex_t *__mutex, + __const pthread_mutexattr_t *__mutex_attr); +extern int weak_function __pthread_mutex_destroy (pthread_mutex_t *__mutex); +extern int weak_function __pthread_mutex_lock (pthread_mutex_t *__mutex); +extern int weak_function __pthread_mutex_unlock (pthread_mutex_t *__mutex); +extern void __uclibc_mutex_unlock (void *) attribute_hidden; +extern int weak_function __pthread_mutex_trylock (pthread_mutex_t *__mutex); +# ifndef __UCLIBC_HAS_THREADS_NATIVE__ +extern void weak_function _pthread_cleanup_push_defer ( + struct _pthread_cleanup_buffer *__buffer, + void (*__routine) (void *), void *__arg); +extern void weak_function _pthread_cleanup_pop_restore ( + struct _pthread_cleanup_buffer *__buffer, + int __execute); +# endif +#endif + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_stdio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_stdio.h new file mode 100644 index 0000000..843a2f2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_stdio.h @@ -0,0 +1,517 @@ +/* Copyright (C) 2002-2004 Manuel Novoa III + * + * GNU Library General Public License (LGPL) version 2 or later. + * + * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. + */ + +#ifndef _STDIO_H +#error Always include rather than +#endif + +/**********************************************************************/ + +#define __STDIO_BUFFERS +/* ANSI/ISO mandate at least 256. */ +#if defined(__UCLIBC_HAS_STDIO_BUFSIZ_NONE__) +/* Fake this because some apps use stdio.h BUFSIZ. */ +#define __STDIO_BUFSIZ 256 +#undef __STDIO_BUFFERS +#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_256__) +#define __STDIO_BUFSIZ 256 +#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_512__) +#define __STDIO_BUFSIZ 512 +#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_1024__) +#define __STDIO_BUFSIZ 1024 +#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_2048__) +#define __STDIO_BUFSIZ 2048 +#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_4096__) +#define __STDIO_BUFSIZ 4096 +#elif defined(__UCLIBC_HAS_STDIO_BUFSIZ_8192__) +#define __STDIO_BUFSIZ 8192 +#else +#error config seems to be out of sync regarding bufsiz options +#endif + +#ifdef __UCLIBC_HAS_STDIO_BUFSIZ_NONE__ +#define __STDIO_BUILTIN_BUF_SIZE 0 +#else /* __UCLIBC_HAS_STDIO_BUFSIZ_NONE__ */ +#if defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE__) +#define __STDIO_BUILTIN_BUF_SIZE 0 +#elif defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4__) +#define __STDIO_BUILTIN_BUF_SIZE 4 +#elif defined(__UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8__) +#define __STDIO_BUILTIN_BUF_SIZE 8 +#else +#error config seems to be out of sync regarding builtin buffer size +#endif +#endif + +#if defined(__STDIO_BUFFERS) || defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__) || defined(__UCLIBC_HAS_THREADS__) +#define __STDIO_HAS_OPENLIST 1 +#else +#undef __STDIO_HAS_OPENLIST +#endif + +/**********************************************************************/ +/* Make sure defines related to large files are consistent. */ +#ifdef _LIBC + +#ifdef __UCLIBC_HAS_LFS__ +#undef __USE_LARGEFILE +#undef __USE_LARGEFILE64 +#undef __USE_FILE_OFFSET64 +/* If we're actually building uClibc with large file support, only define... */ +#define __USE_LARGEFILE64 1 +#endif /* __UCLIBC_HAS_LFS__ */ + +#else /* not _LIBC */ + +#ifndef __UCLIBC_HAS_LFS__ +#if defined(__LARGEFILE64_SOURCE) || defined(__USE_LARGEFILE64) || defined(__USE_FILE_OFFSET64) +#error Sorry... uClibc was built without large file support! +#endif +#endif /* __UCLIBC_HAS_LFS__ */ + +#endif /* _LIBC */ +/**********************************************************************/ +#ifdef __UCLIBC_HAS_WCHAR__ + +#define __need_wchar_t +#include + +/* Note: we don't really need mbstate for 8-bit locales. We do for UTF-8. + * For now, always use it. */ +#define __STDIO_MBSTATE +#define __need_mbstate_t +#include + +#endif +/**********************************************************************/ +/* Currently unimplemented/untested */ +/* #define __STDIO_FLEXIBLE_SETVBUF */ + +#ifdef __UCLIBC_HAS_STDIO_GETC_MACRO__ +#define __STDIO_GETC_MACRO +#endif + +#ifdef __UCLIBC_HAS_STDIO_PUTC_MACRO__ +#define __STDIO_PUTC_MACRO +#endif + + +/* These are consistency checks on the different options */ + +#ifndef __STDIO_BUFFERS +#undef __STDIO_GETC_MACRO +#undef __STDIO_PUTC_MACRO +#endif + +#ifdef __BCC__ +#undef __UCLIBC_HAS_LFS__ +#endif + +#ifndef __UCLIBC_HAS_LFS__ +#undef __UCLIBC_HAS_FOPEN_LARGEFILE_MODE__ +#endif + +/**********************************************************************/ +#include + +/* user_locking + * 0 : do auto locking/unlocking + * 1 : user does locking/unlocking + * 2 : initial state prior to thread initialization + * with no auto locking/unlocking + * + * When threading is initialized, walk the stdio open stream list + * and do "if (user_locking == 2) user_locking = 0;". + * + * This way, we avoid calling the weak lock/unlock functions. + */ + +#define __STDIO_AUTO_THREADLOCK_VAR \ + __UCLIBC_MUTEX_AUTO_LOCK_VAR(__infunc_user_locking) + +#define __STDIO_AUTO_THREADLOCK(__stream) \ + __UCLIBC_MUTEX_AUTO_LOCK((__stream)->__lock, __infunc_user_locking, \ + (__stream)->__user_locking) + +#define __STDIO_AUTO_THREADUNLOCK(__stream) \ + __UCLIBC_MUTEX_AUTO_UNLOCK((__stream)->__lock, __infunc_user_locking) + +#define __STDIO_ALWAYS_THREADLOCK(__stream) \ + __UCLIBC_MUTEX_LOCK((__stream)->__lock) + +#define __STDIO_ALWAYS_THREADUNLOCK(__stream) \ + __UCLIBC_MUTEX_UNLOCK((__stream)->__lock) + +#define __STDIO_ALWAYS_THREADLOCK_CANCEL_UNSAFE(__stream) \ + __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE((__stream)->__lock) + +#define __STDIO_ALWAYS_THREADTRYLOCK_CANCEL_UNSAFE(__stream) \ + __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE((__stream)->__lock) + +#define __STDIO_ALWAYS_THREADUNLOCK_CANCEL_UNSAFE(__stream) \ + __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE((__stream)->__lock) + +#ifdef __UCLIBC_HAS_THREADS__ +#define __STDIO_SET_USER_LOCKING(__stream) ((__stream)->__user_locking = 1) +#else +#define __STDIO_SET_USER_LOCKING(__stream) ((void)0) +#endif + +/**********************************************************************/ + +#define __STDIO_IOFBF 0 /* Fully buffered. */ +#define __STDIO_IOLBF 1 /* Line buffered. */ +#define __STDIO_IONBF 2 /* No buffering. */ + +typedef struct { + __off_t __pos; +#ifdef __STDIO_MBSTATE + __mbstate_t __mbstate; +#endif +#ifdef __UCLIBC_HAS_WCHAR__ + int __mblen_pending; +#endif +} __STDIO_fpos_t; + +#ifdef __UCLIBC_HAS_LFS__ +typedef struct { + __off64_t __pos; +#ifdef __STDIO_MBSTATE + __mbstate_t __mbstate; +#endif +#ifdef __UCLIBC_HAS_WCHAR__ + int __mblen_pending; +#endif +} __STDIO_fpos64_t; +#endif + +/**********************************************************************/ +#ifdef __UCLIBC_HAS_LFS__ +typedef __off64_t __offmax_t; /* TODO -- rename this? */ +#else +typedef __off_t __offmax_t; /* TODO -- rename this? */ +#endif + +/**********************************************************************/ +#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ + +typedef __ssize_t __io_read_fn(void *__cookie, char *__buf, size_t __bufsize); +typedef __ssize_t __io_write_fn(void *__cookie, + __const char *__buf, size_t __bufsize); +/* NOTE: GLIBC difference!!! -- fopencookie seek function + * For glibc, the type of pos is always (__off64_t *) but in our case + * it is type (__off_t *) when the lib is built without large file support. + */ +typedef int __io_seek_fn(void *__cookie, __offmax_t *__pos, int __whence); +typedef int __io_close_fn(void *__cookie); + +typedef struct { + __io_read_fn *read; + __io_write_fn *write; + __io_seek_fn *seek; + __io_close_fn *close; +} _IO_cookie_io_functions_t; + +#if defined(_LIBC) || defined(_GNU_SOURCE) + +typedef __io_read_fn cookie_read_function_t; +typedef __io_write_fn cookie_write_function_t; +typedef __io_seek_fn cookie_seek_function_t; +typedef __io_close_fn cookie_close_function_t; + +typedef _IO_cookie_io_functions_t cookie_io_functions_t; + +#endif + +#endif +/**********************************************************************/ + +struct __STDIO_FILE_STRUCT { + unsigned short __modeflags; + /* There could be a hole here, but modeflags is used most.*/ +#ifdef __UCLIBC_HAS_WCHAR__ + unsigned char __ungot_width[2]; /* 0: current (building) char; 1: scanf */ + /* Move the following futher down to avoid problems with getc/putc + * macros breaking shared apps when wchar config support is changed. */ + /* wchar_t ungot[2]; */ +#else /* __UCLIBC_HAS_WCHAR__ */ + unsigned char __ungot[2]; +#endif /* __UCLIBC_HAS_WCHAR__ */ + int __filedes; +#ifdef __STDIO_BUFFERS + unsigned char *__bufstart; /* pointer to buffer */ + unsigned char *__bufend; /* pointer to 1 past end of buffer */ + unsigned char *__bufpos; + unsigned char *__bufread; /* pointer to 1 past last buffered read char */ + +#ifdef __STDIO_GETC_MACRO + unsigned char *__bufgetc_u; /* 1 past last readable by getc_unlocked */ +#endif /* __STDIO_GETC_MACRO */ +#ifdef __STDIO_PUTC_MACRO + unsigned char *__bufputc_u; /* 1 past last writeable by putc_unlocked */ +#endif /* __STDIO_PUTC_MACRO */ + +#endif /* __STDIO_BUFFERS */ + +#ifdef __STDIO_HAS_OPENLIST + struct __STDIO_FILE_STRUCT *__nextopen; +#endif +#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ + void *__cookie; + _IO_cookie_io_functions_t __gcs; +#endif +#ifdef __UCLIBC_HAS_WCHAR__ + wchar_t __ungot[2]; +#endif +#ifdef __STDIO_MBSTATE + __mbstate_t __state; +#endif +#ifdef __UCLIBC_HAS_XLOCALE__ + void *__unused; /* Placeholder for codeset binding. */ +#endif +#ifdef __UCLIBC_HAS_THREADS__ + int __user_locking; + __UCLIBC_MUTEX(__lock); +#endif +/* Everything after this is unimplemented... and may be trashed. */ +#if __STDIO_BUILTIN_BUF_SIZE > 0 + unsigned char __builtinbuf[__STDIO_BUILTIN_BUF_SIZE]; +#endif /* __STDIO_BUILTIN_BUF_SIZE > 0 */ +}; + + +/***********************************************************************/ +/* Having ungotten characters implies the stream is reading. + * The scheme used here treats the least significant 2 bits of + * the stream's modeflags member as follows: + * 0 0 Not currently reading. + * 0 1 Reading, but no ungetc() or scanf() push back chars. + * 1 0 Reading with one ungetc() char (ungot[1] is 1) + * or one scanf() pushed back char (ungot[1] is 0). + * 1 1 Reading with both an ungetc() char and a scanf() + * pushed back char. Note that this must be the result + * of a scanf() push back (in ungot[0]) _followed_ by + * an ungetc() call (in ungot[1]). + * + * Notes: + * scanf() can NOT use ungetc() to push back characters. + * (See section 7.19.6.2 of the C9X rationale -- WG14/N897.) + */ + +#define __MASK_READING 0x0003U /* (0x0001 | 0x0002) */ +#define __FLAG_READING 0x0001U +#define __FLAG_UNGOT 0x0002U +#define __FLAG_EOF 0x0004U +#define __FLAG_ERROR 0x0008U +#define __FLAG_WRITEONLY 0x0010U +#define __FLAG_READONLY 0x0020U /* (__FLAG_WRITEONLY << 1) */ +#define __FLAG_WRITING 0x0040U +#define __FLAG_NARROW 0x0080U + +#define __FLAG_FBF 0x0000U /* must be 0 */ +#define __FLAG_LBF 0x0100U +#define __FLAG_NBF 0x0200U /* (__FLAG_LBF << 1) */ +#define __MASK_BUFMODE 0x0300U /* (__FLAG_LBF|__FLAG_NBF) */ +#define __FLAG_APPEND 0x0400U /* fixed! == O_APPEND for linux */ +#define __FLAG_WIDE 0x0800U +/* available slot 0x1000U */ +#define __FLAG_FREEFILE 0x2000U +#define __FLAG_FREEBUF 0x4000U +#define __FLAG_LARGEFILE 0x8000U /* fixed! == 0_LARGEFILE for linux */ +#define __FLAG_FAILED_FREOPEN __FLAG_LARGEFILE + +/* Note: In no-buffer mode, it would be possible to pack the necessary + * flags into one byte. Since we wouldn't be buffering and there would + * be no support for wchar, the only flags we would need would be: + * 2 bits : ungot count + * 2 bits : eof + error + * 2 bits : readonly + writeonly + * 1 bit : freefile + * 1 bit : appending + * So, for a very small system (< 128 files) we might have a + * 4-byte FILE struct of: + * unsigned char flags; + * signed char filedes; + * unsigned char ungot[2]; + */ +/********************************************************************** + * PROTOTYPES OF INTERNAL FUNCTIONS + **********************************************************************/ +#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) + +extern void _stdio_init(void) attribute_hidden; +extern void _stdio_term(void) attribute_hidden; + +#ifdef __STDIO_HAS_OPENLIST + +extern struct __STDIO_FILE_STRUCT *_stdio_openlist; + +#ifdef __UCLIBC_HAS_THREADS__ +__UCLIBC_MUTEX_EXTERN(_stdio_openlist_add_lock); +#ifdef __STDIO_BUFFERS +__UCLIBC_MUTEX_EXTERN(_stdio_openlist_del_lock); +extern volatile int _stdio_openlist_use_count; /* _stdio_openlist_del_lock */ +extern int _stdio_openlist_del_count; /* _stdio_openlist_del_lock */ +#endif +extern int _stdio_user_locking; +extern void __stdio_init_mutex(__UCLIBC_MUTEX_TYPE *m) attribute_hidden; +#endif + +#endif + +#endif +/**********************************************************************/ + +#define __CLEARERR_UNLOCKED(__stream) \ + ((void)((__stream)->__modeflags &= ~(__FLAG_EOF|__FLAG_ERROR))) +#define __FEOF_UNLOCKED(__stream) ((__stream)->__modeflags & __FLAG_EOF) +#define __FERROR_UNLOCKED(__stream) ((__stream)->__modeflags & __FLAG_ERROR) + +#ifdef __UCLIBC_HAS_THREADS__ +# define __CLEARERR(__stream) (clearerr)(__stream) +# define __FERROR(__stream) (ferror)(__stream) +# define __FEOF(__stream) (feof)(__stream) +#else +# define __CLEARERR(__stream) __CLEARERR_UNLOCKED(__stream) +# define __FERROR(__stream) __FERROR_UNLOCKED(__stream) +# define __FEOF(__stream) __FEOF_UNLOCKED(__stream) +#endif + +extern int __fgetc_unlocked(FILE *__stream); +extern int __fputc_unlocked(int __c, FILE *__stream); + +/* First define the default definitions. + They are overridden below as necessary. */ +#define __FGETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream)) +#define __FGETC(__stream) (fgetc)((__stream)) +#define __GETC_UNLOCKED_MACRO(__stream) (__fgetc_unlocked)((__stream)) +#define __GETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream)) +#define __GETC(__stream) (fgetc)((__stream)) + +#define __FPUTC_UNLOCKED(__c, __stream) (__fputc_unlocked)((__c),(__stream)) +#define __FPUTC(__c, __stream) (fputc)((__c),(__stream)) +#define __PUTC_UNLOCKED_MACRO(__c, __stream) (__fputc_unlocked)((__c),(__stream)) +#define __PUTC_UNLOCKED(__c, __stream) (__fputc_unlocked)((__c),(__stream)) +#define __PUTC(__c, __stream) (fputc)((__c),(__stream)) + + +#ifdef __STDIO_GETC_MACRO + +extern FILE *__stdin; /* For getchar() macro. */ + +# undef __GETC_UNLOCKED_MACRO +# define __GETC_UNLOCKED_MACRO(__stream) \ + ( ((__stream)->__bufpos < (__stream)->__bufgetc_u) \ + ? (*(__stream)->__bufpos++) \ + : __fgetc_unlocked(__stream) ) + +# if 0 + /* Classic macro approach. getc{_unlocked} can have side effects. */ +# undef __GETC_UNLOCKED +# define __GETC_UNLOCKED(__stream) __GETC_UNLOCKED_MACRO((__stream)) +# ifndef __UCLIBC_HAS_THREADS__ +# undef __GETC +# define __GETC(__stream) __GETC_UNLOCKED_MACRO((__stream)) +# endif + +# else + /* Using gcc extension for safety and additional inlining. */ +# undef __FGETC_UNLOCKED +# define __FGETC_UNLOCKED(__stream) \ + (__extension__ ({ \ + FILE *__S = (__stream); \ + __GETC_UNLOCKED_MACRO(__S); \ + }) ) + +# undef __GETC_UNLOCKED +# define __GETC_UNLOCKED(__stream) __FGETC_UNLOCKED((__stream)) + +# ifdef __UCLIBC_HAS_THREADS__ +# undef __FGETC +# define __FGETC(__stream) \ + (__extension__ ({ \ + FILE *__S = (__stream); \ + ((__S->__user_locking ) \ + ? __GETC_UNLOCKED_MACRO(__S) \ + : (fgetc)(__S)); \ + }) ) + +# undef __GETC +# define __GETC(__stream) __FGETC((__stream)) + +# else + +# undef __FGETC +# define __FGETC(__stream) __FGETC_UNLOCKED((__stream)) +# undef __GETC +# define __GETC(__stream) __FGETC_UNLOCKED((__stream)) + +# endif +# endif + +#else + +#endif /* __STDIO_GETC_MACRO */ + + +#ifdef __STDIO_PUTC_MACRO + +extern FILE *__stdout; /* For putchar() macro. */ + +# undef __PUTC_UNLOCKED_MACRO +# define __PUTC_UNLOCKED_MACRO(__c, __stream) \ + ( ((__stream)->__bufpos < (__stream)->__bufputc_u) \ + ? (*(__stream)->__bufpos++) = (__c) \ + : __fputc_unlocked((__c),(__stream)) ) + +# if 0 + /* Classic macro approach. putc{_unlocked} can have side effects.*/ +# undef __PUTC_UNLOCKED +# define __PUTC_UNLOCKED(__c, __stream) \ + __PUTC_UNLOCKED_MACRO((__c), (__stream)) +# ifndef __UCLIBC_HAS_THREADS__ +# undef __PUTC +# define __PUTC(__c, __stream) __PUTC_UNLOCKED_MACRO((__c), (__stream)) +# endif + +# else + /* Using gcc extension for safety and additional inlining. */ + +# undef __FPUTC_UNLOCKED +# define __FPUTC_UNLOCKED(__c, __stream) \ + (__extension__ ({ \ + FILE *__S = (__stream); \ + __PUTC_UNLOCKED_MACRO((__c),__S); \ + }) ) + +# undef __PUTC_UNLOCKED +# define __PUTC_UNLOCKED(__c, __stream) __FPUTC_UNLOCKED((__c), (__stream)) + +# ifdef __UCLIBC_HAS_THREADS__ +# undef __FPUTC +# define __FPUTC(__c, __stream) \ + (__extension__ ({ \ + FILE *__S = (__stream); \ + ((__S->__user_locking) \ + ? __PUTC_UNLOCKED_MACRO((__c),__S) \ + : (fputc)((__c),__S)); \ + }) ) + +# undef __PUTC +# define __PUTC(__c, __stream) __FPUTC((__c), (__stream)) + +# else + +# undef __FPUTC +# define __FPUTC(__c, __stream) __FPUTC_UNLOCKED((__c),(__stream)) +# undef __PUTC +# define __PUTC(__c, __stream) __FPUTC_UNLOCKED((__c),(__stream)) + +# endif +# endif + +#endif /* __STDIO_PUTC_MACRO */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_touplow.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_touplow.h new file mode 100644 index 0000000..28d4e2f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_touplow.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2003 Manuel Novoa III + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + */ + +/* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! + * + * Besides uClibc, I'm using this code in my libc for elks, which is + * a 16-bit environment with a fairly limited compiler. It would make + * things much easier for me if this file isn't modified unnecessarily. + * In particular, please put any new or replacement functions somewhere + * else, and modify the makefile to use your version instead. + * Thanks. Manuel + * + * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */ + +#ifndef _UCLIBC_TOUPLOW_H +#define _UCLIBC_TOUPLOW_H + +#include +#include + +/* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ + +typedef __uint16_t __ctype_mask_t; + +#ifdef __UCLIBC_HAS_CTYPE_SIGNED__ + +typedef __int16_t __ctype_touplow_t; +#define __UCLIBC_CTYPE_B_TBL_OFFSET 128 +#define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 + +#else /* __UCLIBC_HAS_CTYPE_SIGNED__ */ + +typedef unsigned char __ctype_touplow_t; +#define __UCLIBC_CTYPE_B_TBL_OFFSET 1 +#define __UCLIBC_CTYPE_TO_TBL_OFFSET 0 + +#endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */ + +#endif /* _UCLIBC_TOUPLOW_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_uwchar.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_uwchar.h new file mode 100644 index 0000000..ba2c42d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_uwchar.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2003 Manuel Novoa III + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + */ + +/* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! + * + * Besides uClibc, I'm using this code in my libc for elks, which is + * a 16-bit environment with a fairly limited compiler. It would make + * things much easier for me if this file isn't modified unnecessarily. + * In particular, please put any new or replacement functions somewhere + * else, and modify the makefile to use your version instead. + * Thanks. Manuel + * + * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */ + + +/* Define an internal unsigned int type __uwchar_t just large enough + * to hold a wchar_t. + */ + +#ifndef _UCLIBC_UWCHAR_H +#define _UCLIBC_UWCHAR_H + +#include +#include + +#if WCHAR_MIN == 0 +typedef wchar_t __uwchar_t; +#elif WCHAR_MAX <= USHRT_MAX +typedef unsigned short __uwchar_t; +#elif WCHAR_MAX <= UINT_MAX +typedef unsigned int __uwchar_t; +#elif WCHAR_MAX <= ULONG_MAX +typedef unsigned long __uwchar_t; +#elif defined(ULLONG_MAX) && (WCHAR_MAX <= ULLONG_MAX) +typedef unsigned long long __uwchar_t; +#elif WCHAR_MAX <= UINTMAX_MAX +typedef uintmax_t __uwchar_t; +#else +#error Can not determine an appropriate type for __uwchar_t! +#endif + +#endif /* _UCLIBC_UWCHAR_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_va_copy.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_va_copy.h new file mode 100644 index 0000000..98663fc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uClibc_va_copy.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2005 Manuel Novoa III + * + * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + */ + +#ifndef _UCLIBC_VA_COPY_H +#define _UCLIBC_VA_COPY_H 1 + +#include + +/* Deal with pre-C99 compilers. */ +#ifndef va_copy + +#ifdef __va_copy +#define va_copy(A,B) __va_copy(A,B) +#else +#warning Neither va_copy (C99/SUSv3) or __va_copy is defined. Using a simple copy instead. But you should really check that this is appropriate and supply an arch-specific override if necessary. + /* the glibc manual suggests that this will usually suffice when + __va_copy doesn't exist. */ +#define va_copy(A,B) A = B +#endif + +#endif /* va_copy */ + +#endif /* _UCLIBC_VA_COPY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uio.h new file mode 100644 index 0000000..6a283ed --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/uio.h @@ -0,0 +1,50 @@ +/* Copyright (C) 1996, 1997, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _SYS_UIO_H && !defined _FCNTL_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_UIO_H +#define _BITS_UIO_H 1 + +#include + + +/* We should normally use the Linux kernel header file to define this + type and macros but this calls for trouble because of the header + includes other kernel headers. */ + +/* Size of object which can be written atomically. + + This macro has different values in different kernel versions. The + latest versions of the kernel use 1024 and this is good choice. Since + the C library implementation of readv/writev is able to emulate the + functionality even if the currently running kernel does not support + this large value the readv/writev call will not fail because of this. */ +#define UIO_MAXIOV 1024 + + +/* Structure for scatter/gather I/O. */ +struct iovec + { + void *iov_base; /* Pointer to data. */ + size_t iov_len; /* Length of data. */ + }; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ustat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ustat.h new file mode 100644 index 0000000..69c6b72 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/ustat.h @@ -0,0 +1,31 @@ +/* Copyright (C) 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_USTAT_H +# error "Never include directly; use instead." +#endif + +#include + +struct ustat + { + __daddr_t f_tfree; /* Number of free blocks. */ + __ino_t f_tinode; /* Number of free inodes. */ + char f_fname[6]; + char f_fpack[6]; + }; diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utmp.h new file mode 100644 index 0000000..e855ad7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utmp.h @@ -0,0 +1,125 @@ +/* The `struct utmp' type, describing entries in the utmp file. GNU version. + Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UTMP_H +# error "Never include directly; use instead." +#endif + +#include +#include +#include +#include + + +#define UT_LINESIZE 32 +#define UT_NAMESIZE 32 +#define UT_HOSTSIZE 256 + + +/* The structure describing an entry in the database of + previous logins. */ +struct lastlog + { +#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 + int32_t ll_time; +#else + __time_t ll_time; +#endif + char ll_line[UT_LINESIZE]; + char ll_host[UT_HOSTSIZE]; + }; + + +/* The structure describing the status of a terminated process. This + type is used in `struct utmp' below. */ +struct exit_status + { + short int e_termination; /* Process termination status. */ + short int e_exit; /* Process exit status. */ + }; + + +/* The structure describing an entry in the user accounting database. */ +struct utmp +{ + short int ut_type; /* Type of login. */ + pid_t ut_pid; /* Process ID of login process. */ + char ut_line[UT_LINESIZE]; /* Devicename. */ + char ut_id[4]; /* Inittab ID. */ + char ut_user[UT_NAMESIZE]; /* Username. */ + char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */ + struct exit_status ut_exit; /* Exit status of a process marked + as DEAD_PROCESS. */ +/* The ut_session and ut_tv fields must be the same size when compiled + 32- and 64-bit. This allows data files and shared memory to be + shared between 32- and 64-bit applications. */ +#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 + int32_t ut_session; /* Session ID, used for windowing. */ + struct + { + int32_t tv_sec; /* Seconds. */ + int32_t tv_usec; /* Microseconds. */ + } ut_tv; /* Time entry was made. */ +#else + long int ut_session; /* Session ID, used for windowing. */ + struct timeval ut_tv; /* Time entry was made. */ +#endif + + int32_t ut_addr_v6[4]; /* Internet address of remote host. */ + char __unused[20]; /* Reserved for future use. */ +}; + +/* Backwards compatibility hacks. */ +#define ut_name ut_user +#ifndef _NO_UT_TIME +/* We have a problem here: `ut_time' is also used otherwise. Define + _NO_UT_TIME if the compiler complains. */ +# define ut_time ut_tv.tv_sec +#endif +#define ut_xtime ut_tv.tv_sec +#define ut_addr ut_addr_v6[0] + + +/* Values for the `ut_type' field of a `struct utmp'. */ +#define EMPTY 0 /* No valid user accounting information. */ + +#define RUN_LVL 1 /* The system's runlevel. */ +#define BOOT_TIME 2 /* Time of system boot. */ +#define NEW_TIME 3 /* Time after system clock changed. */ +#define OLD_TIME 4 /* Time when system clock changed. */ + +#define INIT_PROCESS 5 /* Process spawned by the init process. */ +#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ +#define USER_PROCESS 7 /* Normal process. */ +#define DEAD_PROCESS 8 /* Terminated process. */ + +#define ACCOUNTING 9 + +/* Old Linux name for the EMPTY type. */ +#define UT_UNKNOWN EMPTY + + +/* Tell the user that we have a modern system with UT_HOST, UT_PID, + UT_TYPE, UT_ID and UT_TV fields. */ +#define _HAVE_UT_TYPE 1 +#define _HAVE_UT_PID 1 +#define _HAVE_UT_ID 1 +#define _HAVE_UT_TV 1 +#define _HAVE_UT_HOST 1 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utmpx.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utmpx.h new file mode 100644 index 0000000..c84cda6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utmpx.h @@ -0,0 +1,103 @@ +/* Structures and definitions for the user accounting database. GNU version. + Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UTMPX_H +# error "Never include directly; use instead." +#endif + +#include +#include +#include + + +#ifdef __USE_GNU +# include +# define _PATH_UTMPX _PATH_UTMP +# define _PATH_WTMPX _PATH_WTMP +#endif + + +#define __UT_LINESIZE 32 +#define __UT_NAMESIZE 32 +#define __UT_HOSTSIZE 256 + + +/* The structure describing the status of a terminated process. This + type is used in `struct utmpx' below. */ +struct __exit_status + { +#ifdef __USE_GNU + short int e_termination; /* Process termination status. */ + short int e_exit; /* Process exit status. */ +#else + short int __e_termination; /* Process termination status. */ + short int __e_exit; /* Process exit status. */ +#endif + }; + + +/* The structure describing an entry in the user accounting database. */ +struct utmpx +{ + short int ut_type; /* Type of login. */ + __pid_t ut_pid; /* Process ID of login process. */ + char ut_line[__UT_LINESIZE]; /* Devicename. */ + char ut_id[4]; /* Inittab ID. */ + char ut_user[__UT_NAMESIZE]; /* Username. */ + char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */ + struct __exit_status ut_exit; /* Exit status of a process marked + as DEAD_PROCESS. */ + +/* The fields ut_session and ut_tv must be the same size when compiled + 32- and 64-bit. This allows files and shared memory to be shared + between 32- and 64-bit applications. */ +#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 + __int32_t ut_session; /* Session ID, used for windowing. */ + struct + { + __int32_t tv_sec; /* Seconds. */ + __int32_t tv_usec; /* Microseconds. */ + } ut_tv; /* Time entry was made. */ +#else + long int ut_session; /* Session ID, used for windowing. */ + struct timeval ut_tv; /* Time entry was made. */ +#endif + __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ + char __unused[20]; /* Reserved for future use. */ +}; + + +/* Values for the `ut_type' field of a `struct utmpx'. */ +#define EMPTY 0 /* No valid user accounting information. */ + +#ifdef __USE_GNU +# define RUN_LVL 1 /* The system's runlevel. */ +#endif +#define BOOT_TIME 2 /* Time of system boot. */ +#define NEW_TIME 3 /* Time after system clock changed. */ +#define OLD_TIME 4 /* Time when system clock changed. */ + +#define INIT_PROCESS 5 /* Process spawned by the init process. */ +#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ +#define USER_PROCESS 7 /* Normal process. */ +#define DEAD_PROCESS 8 /* Terminated process. */ + +#ifdef __USE_GNU +# define ACCOUNTING 9 /* System accounting. */ +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utsname.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utsname.h new file mode 100644 index 0000000..35e71e3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/utsname.h @@ -0,0 +1,29 @@ +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UTSNAME_H +# error "Never include directly; use instead." +#endif + +/* Length of the entries in `struct utsname' is 65. */ +#define _UTSNAME_LENGTH 65 + +/* Linux provides as additional information in the `struct utsname' + the name of the current domain. Define _UTSNAME_DOMAIN_LENGTH + to a value != 0 to activate this entry. */ +#define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/waitflags.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/waitflags.h new file mode 100644 index 0000000..464cedb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/waitflags.h @@ -0,0 +1,38 @@ +/* Definitions of flag bits for `waitpid' et al. + Copyright (C) 1992,1996,1997,2000,2004,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _SYS_WAIT_H && !defined _STDLIB_H +# error "Never include directly; use instead." +#endif + + +/* Bits in the third argument to `waitpid'. */ +#define WNOHANG 1 /* Don't block waiting. */ +#define WUNTRACED 2 /* Report status of stopped children. */ + +/* Bits in the fourth argument to `waitid'. */ +#define WSTOPPED 2 /* Report stopped child (same as WUNTRACED). */ +#define WEXITED 4 /* Report dead child. */ +#define WCONTINUED 8 /* Report continued child. */ +#define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ + +#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads + in this group */ +#define __WALL 0x40000000 /* Wait for any child. */ +#define __WCLONE 0x80000000 /* Wait for cloned process. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/waitstatus.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/waitstatus.h new file mode 100644 index 0000000..699c224 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/waitstatus.h @@ -0,0 +1,106 @@ +/* Definitions of status bits for `wait' et al. + Copyright (C) 1992,1994,1996,1997,2000,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _SYS_WAIT_H && !defined _STDLIB_H +# error "Never include directly; use instead." +#endif + + +/* Everything extant so far uses these same bits. */ + + +/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ +#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) + +/* If WIFSIGNALED(STATUS), the terminating signal. */ +#define __WTERMSIG(status) ((status) & 0x7f) + +/* If WIFSTOPPED(STATUS), the signal that stopped the child. */ +#define __WSTOPSIG(status) __WEXITSTATUS(status) + +/* Nonzero if STATUS indicates normal termination. */ +#define __WIFEXITED(status) (__WTERMSIG(status) == 0) + +/* Nonzero if STATUS indicates termination by a signal. */ +#define __WIFSIGNALED(status) \ + (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) + +/* Nonzero if STATUS indicates the child is stopped. */ +#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f) + +/* Nonzero if STATUS indicates the child continued after a stop. We only + define this if provides the WCONTINUED flag bit. */ +#ifdef WCONTINUED +# define __WIFCONTINUED(status) ((status) == __W_CONTINUED) +#endif + +/* Nonzero if STATUS indicates the child dumped core. */ +#define __WCOREDUMP(status) ((status) & __WCOREFLAG) + +/* Macros for constructing status values. */ +#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) +#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) +#define __W_CONTINUED 0xffff +#define __WCOREFLAG 0x80 + + +#ifdef __USE_BSD + +# include + +union wait + { + int w_status; + struct + { +# if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int __w_termsig:7; /* Terminating signal. */ + unsigned int __w_coredump:1; /* Set if dumped core. */ + unsigned int __w_retcode:8; /* Return code if exited normally. */ + unsigned int:16; +# endif /* Little endian. */ +# if __BYTE_ORDER == __BIG_ENDIAN + unsigned int:16; + unsigned int __w_retcode:8; + unsigned int __w_coredump:1; + unsigned int __w_termsig:7; +# endif /* Big endian. */ + } __wait_terminated; + struct + { +# if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ + unsigned int __w_stopsig:8; /* Stopping signal. */ + unsigned int:16; +# endif /* Little endian. */ +# if __BYTE_ORDER == __BIG_ENDIAN + unsigned int:16; + unsigned int __w_stopsig:8; /* Stopping signal. */ + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ +# endif /* Big endian. */ + } __wait_stopped; + }; + +# define w_termsig __wait_terminated.__w_termsig +# define w_coredump __wait_terminated.__w_coredump +# define w_retcode __wait_terminated.__w_retcode +# define w_stopsig __wait_stopped.__w_stopsig +# define w_stopval __wait_stopped.__w_stopval + +#endif /* Use BSD. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/wchar.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/wchar.h new file mode 100644 index 0000000..ef1f563 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/wchar.h @@ -0,0 +1,26 @@ +/* wchar_t type related definitions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_WCHAR_H +#define _BITS_WCHAR_H 1 + +#define __WCHAR_MIN (-2147483647 - 1) +#define __WCHAR_MAX (2147483647) + +#endif /* bits/wchar.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/wordsize.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/wordsize.h new file mode 100644 index 0000000..666c7ad --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/wordsize.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define __WORDSIZE _MIPS_SZPTR diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/xopen_lim.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/xopen_lim.h new file mode 100644 index 0000000..c2363ab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/bits/xopen_lim.h @@ -0,0 +1,150 @@ +/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Never include this file directly; use instead. + */ + +/* Additional definitions from X/Open Portability Guide, Issue 4, Version 2 + System Interfaces and Headers, 4.16 + + Please note only the values which are not greater than the minimum + stated in the standard document are listed. The `sysconf' functions + should be used to obtain the actual value. */ + +#ifndef _XOPEN_LIM_H +#define _XOPEN_LIM_H 1 + +#define __need_IOV_MAX +#include + +/* We do not provide fixed values for + + ARG_MAX Maximum length of argument to the `exec' function + including environment data. + + ATEXIT_MAX Maximum number of functions that may be registered + with `atexit'. + + CHILD_MAX Maximum number of simultaneous processes per real + user ID. + + OPEN_MAX Maximum number of files that one process can have open + at anyone time. + + PAGESIZE + PAGE_SIZE Size of bytes of a page. + + PASS_MAX Maximum number of significant bytes in a password. + + We only provide a fixed limit for + + IOV_MAX Maximum number of `iovec' structures that one process has + available for use with `readv' or writev'. + + if this is indeed fixed by the underlying system. +*/ + + +/* Maximum number of `iovec' structures that one process has available + for use with `readv' or writev'. */ +#define _XOPEN_IOV_MAX _POSIX_UIO_MAXIOV + + +/* Maximum value of `digit' in calls to the `printf' and `scanf' + functions. Posix dictates this should be a minimum of 9 */ +#if !defined(__UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS__) || (__UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS__ <= 1) +#undef NL_ARGMAX +#elif __UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS__ < 9 +#define NL_ARGMAX 9 +#else +#define NL_ARGMAX __UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS__ +#endif + +/* Maximum number of bytes in a `LANG' name. We have no limit. */ +#define NL_LANGMAX _POSIX2_LINE_MAX + +/* Maximum message number. We have no limit. */ +#define NL_MSGMAX INT_MAX + +/* Maximum number of bytes in N-to-1 collation mapping. We have no + limit. */ +#define NL_NMAX INT_MAX + +/* Maximum set number. We have no limit. */ +#define NL_SETMAX INT_MAX + +/* Maximum number of bytes in a message. We have no limit. */ +#define NL_TEXTMAX INT_MAX + +/* Default process priority. */ +#define NZERO 20 + + +/* Number of bits in a word of type `int'. */ +#ifdef INT_MAX +# if INT_MAX == 32767 +# define WORD_BIT 16 +# else +# if INT_MAX == 2147483647 +# define WORD_BIT 32 +# else +/* Safe assumption. */ +# define WORD_BIT 64 +# endif +# endif +#elif defined __INT_MAX__ +# if __INT_MAX__ == 32767 +# define WORD_BIT 16 +# else +# if __INT_MAX__ == 2147483647 +# define WORD_BIT 32 +# else +/* Safe assumption. */ +# define WORD_BIT 64 +# endif +# endif +#else +# define WORD_BIT 32 +#endif + +/* Number of bits in a word of type `long int'. */ +#ifdef LONG_MAX +# if LONG_MAX == 2147483647 +# define LONG_BIT 32 +# else +/* Safe assumption. */ +# define LONG_BIT 64 +# endif +#elif defined __LONG_MAX__ +# if __LONG_MAX__ == 2147483647 +# define LONG_BIT 32 +# else +/* Safe assumption. */ +# define LONG_BIT 64 +# endif +#else +# include +# if __WORDSIZE == 64 +# define LONG_BIT 64 +# else +# define LONG_BIT 32 +# endif +#endif + +#endif /* bits/xopen_lim.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/byteswap.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/byteswap.h new file mode 100644 index 0000000..b61d4dd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/byteswap.h @@ -0,0 +1,40 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BYTESWAP_H +#define _BYTESWAP_H 1 + +/* Get the machine specific, optimized definitions. */ +#include + + +/* The following definitions must all be macros since otherwise some + of the possible optimizations are not possible. */ + +/* Return a value with all bytes in the 16 bit argument swapped. */ +#define bswap_16(x) __bswap_16 (x) + +/* Return a value with all bytes in the 32 bit argument swapped. */ +#define bswap_32(x) __bswap_32 (x) + +#if defined __GNUC__ && __GNUC__ >= 2 +/* Return a value with all bytes in the 64 bit argument swapped. */ +# define bswap_64(x) __bswap_64 (x) +#endif + +#endif /* byteswap.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/complex.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/complex.h new file mode 100644 index 0000000..c16fcfa --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/complex.h @@ -0,0 +1,107 @@ +/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99: 7.3 Complex arithmetic + */ + +#ifndef _COMPLEX_H +#define _COMPLEX_H 1 + +#include + +/* Get general and ISO C99 specific information. */ +#include + +__BEGIN_DECLS + +/* We might need to add support for more compilers here. But since ISO + C99 is out hopefully all maintained compilers will soon provide the data + types `float complex' and `double complex'. */ +#if __GNUC_PREREQ(2, 7) && !__GNUC_PREREQ(2, 97) +# define _Complex __complex__ +#endif + +#define complex _Complex + +/* Narrowest imaginary unit. This depends on the floating-point + evaluation method. + XXX This probably has to go into a gcc related file. */ +#define _Complex_I (__extension__ 1.0iF) + +/* Another more descriptive name is `I'. + XXX Once we have the imaginary support switch this to _Imaginary_I. */ +#undef I +#define I _Complex_I + +/* The file contains the prototypes for all the + actual math functions. These macros are used for those prototypes, + so we can easily declare each function as both `name' and `__name', + and can declare the float versions `namef' and `__namef'. */ + +#define __MATHCALL(function, args) \ + __MATHDECL (_Mdouble_complex_,function, args) +#define __MATHDECL(type, function, args) \ + __MATHDECL_1(type, function, args); \ + __MATHDECL_1(type, __CONCAT(__,function), args) +#define __MATHDECL_1(type, function, args) \ + extern type __MATH_PRECNAME(function) args __THROW + +#define _Mdouble_ double +#define __MATH_PRECNAME(name) name +#include +#undef _Mdouble_ +#undef __MATH_PRECNAME + +/* Now the float versions. */ +#ifndef _Mfloat_ +# define _Mfloat_ float +#endif +#define _Mdouble_ _Mfloat_ +#ifdef __STDC__ +# define __MATH_PRECNAME(name) name##f +#else +# define __MATH_PRECNAME(name) name/**/f +#endif +#include +#undef _Mdouble_ +#undef __MATH_PRECNAME + +/* And the long double versions. It is non-critical to define them + here unconditionally since `long double' is required in ISO C99. */ +#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH +# ifndef _Mlong_double_ +# define _Mlong_double_ long double +# endif +# define _Mdouble_ _Mlong_double_ +# ifdef __STDC__ +# define __MATH_PRECNAME(name) name##l +# else +# define __MATH_PRECNAME(name) name/**/l +# endif +# include +#endif +#undef _Mdouble_ +#undef __MATH_PRECNAME +#undef __MATHDECL_1 +#undef __MATHDECL +#undef __MATHCALL + +__END_DECLS + +#endif /* complex.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/cpio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/cpio.h new file mode 100644 index 0000000..fae3275 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/cpio.h @@ -0,0 +1,74 @@ +/* Extended cpio format from POSIX.1. + This file is part of the GNU C Library. + Copyright (C) 1992, 1998 Free Software Foundation, Inc. + NOTE: The canonical source of this file is maintained with the GNU cpio. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _CPIO_H +#define _CPIO_H 1 + +/* A cpio archive consists of a sequence of files. + Each file has a 76 byte header, + a variable length, NUL terminated filename, + and variable length file data. + A header for a filename "TRAILER!!!" indicates the end of the archive. */ + +/* All the fields in the header are ISO 646 (approximately ASCII) strings + of octal numbers, left padded, not NUL terminated. + + Field Name Length in Bytes Notes + c_magic 6 must be "070707" + c_dev 6 + c_ino 6 + c_mode 6 see below for value + c_uid 6 + c_gid 6 + c_nlink 6 + c_rdev 6 only valid for chr and blk special files + c_mtime 11 + c_namesize 6 count includes terminating NUL in pathname + c_filesize 11 must be 0 for FIFOs and directories */ + +/* Value for the field `c_magic'. */ +#define MAGIC "070707" + +/* Values for c_mode, OR'd together: */ + +#define C_IRUSR 000400 +#define C_IWUSR 000200 +#define C_IXUSR 000100 +#define C_IRGRP 000040 +#define C_IWGRP 000020 +#define C_IXGRP 000010 +#define C_IROTH 000004 +#define C_IWOTH 000002 +#define C_IXOTH 000001 + +#define C_ISUID 004000 +#define C_ISGID 002000 +#define C_ISVTX 001000 + +#define C_ISBLK 060000 +#define C_ISCHR 020000 +#define C_ISDIR 040000 +#define C_ISFIFO 010000 +#define C_ISSOCK 0140000 +#define C_ISLNK 0120000 +#define C_ISCTG 0110000 +#define C_ISREG 0100000 + +#endif /* cpio.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/crypt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/crypt.h new file mode 100644 index 0000000..f3fed7c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/crypt.h @@ -0,0 +1,41 @@ +/* + * crypt(3) implementation for uClibc + * + * The uClibc Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + * + */ + +#ifndef _CRYPT_H +#define _CRYPT_H 1 + +#include + +__BEGIN_DECLS + +/* Encrypt characters from KEY using salt to perturb the encryption method. + * If salt begins with "$1$", MD5 hashing is used instead of DES. */ +extern char *crypt (const char *__key, const char *__salt); + +/* Setup DES tables according KEY. */ +extern void setkey (const char *__key); + +/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt + block in place. */ +extern void encrypt (char *__block, int __edflag); + +__END_DECLS + +#endif /* crypt.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/ctype.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ctype.h new file mode 100644 index 0000000..78cff7d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ctype.h @@ -0,0 +1,383 @@ +/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,02 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard 7.4: Character handling + */ + +#ifndef _CTYPE_H +#define _CTYPE_H 1 + +#include +#include + +#ifdef __UCLIBC_HAS_CTYPE_TABLES__ + +__BEGIN_DECLS + +#ifndef _ISbit +/* These are all the characteristics of characters. + If there get to be more than 16 distinct characteristics, + __ctype_mask_t will need to be adjusted. */ + +# define _ISbit(bit) (1 << (bit)) + +enum +{ + _ISupper = _ISbit (0), /* UPPERCASE. */ + _ISlower = _ISbit (1), /* lowercase. */ + _ISalpha = _ISbit (2), /* Alphabetic. */ + _ISdigit = _ISbit (3), /* Numeric. */ + _ISxdigit = _ISbit (4), /* Hexadecimal numeric. */ + _ISspace = _ISbit (5), /* Whitespace. */ + _ISprint = _ISbit (6), /* Printing. */ + _ISgraph = _ISbit (7), /* Graphical. */ + _ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */ + _IScntrl = _ISbit (9), /* Control character. */ + _ISpunct = _ISbit (10), /* Punctuation. */ + _ISalnum = _ISbit (11) /* Alphanumeric. */ +}; +#else +#error _ISbit already defined! +#endif /* ! _ISbit */ + +#include + +#ifdef __UCLIBC_HAS_CTYPE_SIGNED__ +# define __UCLIBC_CTYPE_IN_TO_DOMAIN(c) (((unsigned int)((c) + 128)) < 384) + +#else /* __UCLIBC_HAS_CTYPE_SIGNED__ */ +# define __UCLIBC_CTYPE_IN_TO_DOMAIN(c) (((unsigned int)(c)) < 256) + +#endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */ + +/* In the thread-specific locale model (see `uselocale' in ) + we cannot use global variables for these as was done in the past. + Instead, the following accessor functions return the address of + each variable, which is local to the current thread if multithreaded. + + These point into arrays of 384, so they can be indexed by any `unsigned + char' value [0,255]; by EOF (-1); or by any `signed char' value + [-128,-1). ISO C requires that the ctype functions work for `unsigned + char' values and for EOF; we also support negative `signed char' values + for broken old programs. The case conversion arrays are of `int's + rather than `unsigned char's because tolower (EOF) must be EOF, which + doesn't fit into an `unsigned char'. But today more important is that + the arrays are also used for multi-byte character sets. */ + +/* uClibc differences: + * + * When __UCLIBC_HAS_CTYPE_SIGNED is defined, + * + * The upper and lower mapping arrays are type int16_t, so that + * they may store all char values plus EOF. The glibc reasoning + * given above for these being type int is questionable, as the + * ctype mapping functions map from the set of (unsigned) char + * and EOF back into the set. They have no awareness of multi-byte + * or wide characters. + * + * Otherwise, + * + * The ctype array is defined for -1..255. + * The upper and lower mapping arrays are defined for 0..255. + * The upper and lower mapping arrays are type unsigned char. + */ + +/* Pointers to the default C-locale data. */ +extern const __ctype_mask_t *__C_ctype_b; +extern const __ctype_touplow_t *__C_ctype_toupper; +extern const __ctype_touplow_t *__C_ctype_tolower; + +#ifdef __UCLIBC_HAS_XLOCALE__ + +extern __const __ctype_mask_t **__ctype_b_loc (void) + __attribute__ ((__const)); +extern __const __ctype_touplow_t **__ctype_tolower_loc (void) + __attribute__ ((__const)); +extern __const __ctype_touplow_t **__ctype_toupper_loc (void) + __attribute__ ((__const)); + +#define __UCLIBC_CTYPE_B (*__ctype_b_loc()) +#define __UCLIBC_CTYPE_TOLOWER (*__ctype_tolower_loc()) +#define __UCLIBC_CTYPE_TOUPPER (*__ctype_toupper_loc()) + +#else /* __UCLIBC_HAS_XLOCALE__ */ + +/* Pointers to the current global locale data in use. */ +extern const __ctype_mask_t *__ctype_b; +extern const __ctype_touplow_t *__ctype_toupper; +extern const __ctype_touplow_t *__ctype_tolower; + +#define __UCLIBC_CTYPE_B (__ctype_b) +#define __UCLIBC_CTYPE_TOLOWER (__ctype_tolower) +#define __UCLIBC_CTYPE_TOUPPER (__ctype_toupper) + +#endif /* __UCLIBC_HAS_XLOCALE__ */ + +#define __isctype(c, type) \ + ((__UCLIBC_CTYPE_B)[(int) (c)] & (__ctype_mask_t) type) + +#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */ +#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */ + +#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) +/* isdigit() is really locale-invariant, so provide some small fast macros. + * These are uClibc-specific. */ +#define __isdigit_char(C) (((unsigned char)((C) - '0')) <= 9) +#define __isdigit_int(C) (((unsigned int)((C) - '0')) <= 9) +#endif + +#define __exctype(name) extern int name (int) __THROW + +__BEGIN_NAMESPACE_STD + +/* The following names are all functions: + int isCHARACTERISTIC(int c); + which return nonzero iff C has CHARACTERISTIC. + For the meaning of the characteristic names, see the `enum' above. */ +__exctype (isalnum); +__exctype (isalpha); +__exctype (iscntrl); +__exctype (isdigit); +__exctype (islower); +__exctype (isgraph); +__exctype (isprint); +__exctype (ispunct); +__exctype (isspace); +__exctype (isupper); +__exctype (isxdigit); + + +/* Return the lowercase version of C. */ +extern int tolower (int __c) __THROW; + +/* Return the uppercase version of C. */ +extern int toupper (int __c) __THROW; + +__END_NAMESPACE_STD + + +/* ISO C99 introduced one new function. */ +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 + +__exctype (isblank); + +__END_NAMESPACE_C99 +#endif + +#ifdef __USE_GNU +/* Test C for a set of character classes according to MASK. */ +extern int isctype (int __c, int __mask) __THROW; +#endif + +#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN + +/* Return nonzero iff C is in the ASCII set + (i.e., is no more than 7 bits wide). */ +extern int isascii (int __c) __THROW; + +/* Return the part of C that is in the ASCII set + (i.e., the low-order 7 bits of C). */ +extern int toascii (int __c) __THROW; + +/* These are the same as `toupper' and `tolower' except that they do not + check the argument for being in the range of a `char'. */ +__exctype (_toupper); +__exctype (_tolower); +#endif /* Use SVID or use misc. */ + +/* This code is needed for the optimized mapping functions. */ +#define __tobody(c, f, a, args) \ + (__extension__ \ + ({ int __res; \ + if (sizeof (c) > 1) \ + { \ + if (__builtin_constant_p (c)) \ + { \ + int __c = (c); \ + __res = __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (a)[__c] : __c; \ + } \ + else \ + __res = f args; \ + } \ + else \ + __res = (a)[(int) (c)]; \ + __res; })) + +#if !defined __NO_CTYPE && !defined __cplusplus +# define isalnum(c) __isctype((c), _ISalnum) +# define isalpha(c) __isctype((c), _ISalpha) +# define iscntrl(c) __isctype((c), _IScntrl) +# define isdigit(c) __isctype((c), _ISdigit) +# define islower(c) __isctype((c), _ISlower) +# define isgraph(c) __isctype((c), _ISgraph) +# define isprint(c) __isctype((c), _ISprint) +# define ispunct(c) __isctype((c), _ISpunct) +# define isspace(c) __isctype((c), _ISspace) +# define isupper(c) __isctype((c), _ISupper) +# define isxdigit(c) __isctype((c), _ISxdigit) + +# ifdef __USE_ISOC99 +# define isblank(c) __isctype((c), _ISblank) +# endif + +# ifdef __USE_EXTERN_INLINES +extern __inline int +__NTH (tolower (int __c)) +{ + return __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (__UCLIBC_CTYPE_TOLOWER)[__c] : __c; +} + +extern __inline int +__NTH (toupper (int __c)) +{ + return __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (__UCLIBC_CTYPE_TOUPPER)[__c] : __c; +} +# endif + +# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus +# define tolower(c) __tobody (c, tolower, __UCLIBC_CTYPE_TOLOWER, (c)) +# define toupper(c) __tobody (c, toupper, __UCLIBC_CTYPE_TOUPPER, (c)) +# endif /* Optimizing gcc */ + +# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +# define isascii(c) __isascii (c) +# define toascii(c) __toascii (c) + +# define _tolower(c) ((int) (__UCLIBC_CTYPE_TOLOWER)[(int) (c)]) +# define _toupper(c) ((int) (__UCLIBC_CTYPE_TOUPPER)[(int) (c)]) +# endif + +#endif /* Not __NO_CTYPE. */ + + +#if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__) +/* The concept of one static locale per category is not very well + thought out. Many applications will need to process its data using + information from several different locales. Another application is + the implementation of the internationalization handling in the + upcoming ISO C++ standard library. To support this another set of + the functions using locale data exist which have an additional + argument. + + Attention: all these functions are *not* standardized in any form. + This is a proof-of-concept implementation. */ + +/* Structure for reentrant locale using functions. This is an + (almost) opaque type for the user level programs. */ +# include + +/* These definitions are similar to the ones above but all functions + take as an argument a handle for the locale which shall be used. */ +# define __isctype_l(c, type, locale) \ + ((locale)->__ctype_b[(int) (c)] & (__ctype_mask_t) type) + +# define __exctype_l(name) \ + extern int name (int, __locale_t) __THROW + +/* The following names are all functions: + int isCHARACTERISTIC(int c, locale_t *locale); + which return nonzero iff C has CHARACTERISTIC. + For the meaning of the characteristic names, see the `enum' above. */ +__exctype_l (isalnum_l); +__exctype_l (isalpha_l); +__exctype_l (iscntrl_l); +__exctype_l (isdigit_l); +__exctype_l (islower_l); +__exctype_l (isgraph_l); +__exctype_l (isprint_l); +__exctype_l (ispunct_l); +__exctype_l (isspace_l); +__exctype_l (isupper_l); +__exctype_l (isxdigit_l); + +__exctype_l (isblank_l); + + +/* Return the lowercase version of C in locale L. */ +extern int __tolower_l (int __c, __locale_t __l) __THROW; +extern int tolower_l (int __c, __locale_t __l) __THROW; + +/* Return the uppercase version of C. */ +extern int __toupper_l (int __c, __locale_t __l) __THROW; +extern int toupper_l (int __c, __locale_t __l) __THROW; + +# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus +# define __tolower_l(c, locale) \ + __tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale)) +# define __toupper_l(c, locale) \ + __tobody (c, __toupper_l, (locale)->__ctype_toupper, (c, locale)) +# define tolower_l(c, locale) __tolower_l ((c), (locale)) +# define toupper_l(c, locale) __toupper_l ((c), (locale)) +# endif /* Optimizing gcc */ + + +# ifndef __NO_CTYPE +# define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l)) +# define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l)) +# define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l)) +# define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l)) +# define __islower_l(c,l) __isctype_l((c), _ISlower, (l)) +# define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l)) +# define __isprint_l(c,l) __isctype_l((c), _ISprint, (l)) +# define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l)) +# define __isspace_l(c,l) __isctype_l((c), _ISspace, (l)) +# define __isupper_l(c,l) __isctype_l((c), _ISupper, (l)) +# define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l)) + +# define __isblank_l(c,l) __isctype_l((c), _ISblank, (l)) + +# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +# define __isascii_l(c,l) ((l), __isascii (c)) +# define __toascii_l(c,l) ((l), __toascii (c)) +# endif + +# define isalnum_l(c,l) __isalnum_l ((c), (l)) +# define isalpha_l(c,l) __isalpha_l ((c), (l)) +# define iscntrl_l(c,l) __iscntrl_l ((c), (l)) +# define isdigit_l(c,l) __isdigit_l ((c), (l)) +# define islower_l(c,l) __islower_l ((c), (l)) +# define isgraph_l(c,l) __isgraph_l ((c), (l)) +# define isprint_l(c,l) __isprint_l ((c), (l)) +# define ispunct_l(c,l) __ispunct_l ((c), (l)) +# define isspace_l(c,l) __isspace_l ((c), (l)) +# define isupper_l(c,l) __isupper_l ((c), (l)) +# define isxdigit_l(c,l) __isxdigit_l ((c), (l)) + +# define isblank_l(c,l) __isblank_l ((c), (l)) + +# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN +# define isascii_l(c,l) __isascii_l ((c), (l)) +# define toascii_l(c,l) __toascii_l ((c), (l)) +# endif + +# endif /* Not __NO_CTYPE. */ + +#endif /* Use GNU. */ + +__END_DECLS + +#else /* __UCLIBC_HAS_CTYPE_TABLES__ */ + +#include + +#endif + +#endif /* ctype.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/dirent.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/dirent.h new file mode 100644 index 0000000..565a94d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/dirent.h @@ -0,0 +1,293 @@ +/* Copyright (C) 1991-2000, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 5.1.2 Directory Operations + */ + +#ifndef _DIRENT_H +#define _DIRENT_H 1 + +#include + +__BEGIN_DECLS + +#include + +#ifdef __USE_XOPEN +# ifndef __ino_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __ino_t ino_t; +# else +typedef __ino64_t ino_t; +# endif +# define __ino_t_defined +# endif +# if defined __USE_LARGEFILE64 && !defined __ino64_t_defined +typedef __ino64_t ino64_t; +# define __ino64_t_defined +# endif +#endif + +/* This file defines `struct dirent'. + + It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen' + member that gives the length of `d_name'. + + It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen' + member that gives the size of the entire directory entry. + + It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off' + member that gives the file offset of the next directory entry. + + It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type' + member that gives the type of the file. + */ + +#include + +#if (defined __USE_BSD || defined __USE_MISC) && !defined d_fileno +# define d_ino d_fileno /* Backward compatibility. */ +#endif + +/* These macros extract size information from a `struct dirent *'. + They may evaluate their argument multiple times, so it must not + have side effects. Each of these may involve a relatively costly + call to `strlen' on some systems, so these values should be cached. + + _D_EXACT_NAMLEN (DP) returns the length of DP->d_name, not including + its terminating null character. + + _D_ALLOC_NAMLEN (DP) returns a size at least (_D_EXACT_NAMLEN (DP) + 1); + that is, the allocation size needed to hold the DP->d_name string. + Use this macro when you don't need the exact length, just an upper bound. + This macro is less likely to require calling `strlen' than _D_EXACT_NAMLEN. + */ + +#ifdef _DIRENT_HAVE_D_NAMLEN +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen) +# define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) +#else +# define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name)) +# ifdef _DIRENT_HAVE_D_RECLEN +# define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0]) +# else +# define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \ + _D_EXACT_NAMLEN (d) + 1) +# endif +#endif + + +#ifdef __USE_BSD +/* File types for `d_type'. */ +enum + { + DT_UNKNOWN = 0, +# define DT_UNKNOWN DT_UNKNOWN + DT_FIFO = 1, +# define DT_FIFO DT_FIFO + DT_CHR = 2, +# define DT_CHR DT_CHR + DT_DIR = 4, +# define DT_DIR DT_DIR + DT_BLK = 6, +# define DT_BLK DT_BLK + DT_REG = 8, +# define DT_REG DT_REG + DT_LNK = 10, +# define DT_LNK DT_LNK + DT_SOCK = 12, +# define DT_SOCK DT_SOCK + DT_WHT = 14 +# define DT_WHT DT_WHT + }; + +/* Convert between stat structure types and directory types. */ +# define IFTODT(mode) (((mode) & 0170000) >> 12) +# define DTTOIF(dirtype) ((dirtype) << 12) +#endif + + +/* This is the data type of directory stream objects. + The actual structure is opaque to users. */ +typedef struct __dirstream DIR; + +/* Open a directory stream on NAME. + Return a DIR stream on the directory, or NULL if it could not be opened. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern DIR *opendir (__const char *__name) __nonnull ((1)); + +/* Close the directory stream DIRP. + Return 0 if successful, -1 if not. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int closedir (DIR *__dirp) __nonnull ((1)); + +/* Read a directory entry from DIRP. Return a pointer to a `struct + dirent' describing the entry, or NULL for EOF or error. The + storage returned may be overwritten by a later readdir call on the + same DIR stream. + + If the Large File Support API is selected we have to use the + appropriate interface. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +#ifndef __USE_FILE_OFFSET64 +extern struct dirent *readdir (DIR *__dirp) __nonnull ((1)); +#else +# ifdef __REDIRECT +extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64) + __nonnull ((1)); +# else +# define readdir readdir64 +# endif +#endif + +#ifdef __USE_LARGEFILE64 +extern struct dirent64 *readdir64 (DIR *__dirp) __nonnull ((1)); +#endif + +#if defined __USE_POSIX || defined __USE_MISC +/* Reentrant version of `readdir'. Return in RESULT a pointer to the + next entry. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int readdir_r (DIR *__restrict __dirp, + struct dirent *__restrict __entry, + struct dirent **__restrict __result) + __nonnull ((1, 2, 3)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (readdir_r, + (DIR *__restrict __dirp, + struct dirent *__restrict __entry, + struct dirent **__restrict __result), + readdir64_r) __nonnull ((1, 2, 3)); +# else +# define readdir_r readdir64_r +# endif +# endif + +# ifdef __USE_LARGEFILE64 +extern int readdir64_r (DIR *__restrict __dirp, + struct dirent64 *__restrict __entry, + struct dirent64 **__restrict __result) + __nonnull ((1, 2, 3)); +# endif +#endif /* POSIX or misc */ + +/* Rewind DIRP to the beginning of the directory. */ +extern void rewinddir (DIR *__dirp) __THROW __nonnull ((1)); + +#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN +# include + +/* Seek to position POS on DIRP. */ +extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1)); + +/* Return the current position of DIRP. */ +extern long int telldir (DIR *__dirp) __THROW __nonnull ((1)); +#endif + +#if defined __USE_BSD || defined __USE_MISC + +/* Return the file descriptor used by DIRP. */ +extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); + +# if 0 /* defined __OPTIMIZE__ && defined _DIR_dirfd */ +# define dirfd(dirp) _DIR_dirfd (dirp) +# endif + +# ifndef MAXNAMLEN +/* Get the definitions of the POSIX.1 limits. */ +# include + +/* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */ +# ifdef NAME_MAX +# define MAXNAMLEN NAME_MAX +# else +# define MAXNAMLEN 255 +# endif +# endif + +# define __need_size_t +# include + +/* Scan the directory DIR, calling SELECTOR on each directory entry. + Entries for which SELECT returns nonzero are individually malloc'd, + sorted using qsort with CMP, and collected in a malloc'd array in + *NAMELIST. Returns the number of entries selected, or -1 on error. */ +# ifndef __USE_FILE_OFFSET64 +extern int scandir (__const char *__restrict __dir, + struct dirent ***__restrict __namelist, + int (*__selector) (__const struct dirent *), + int (*__cmp) (__const void *, __const void *)) + __nonnull ((1, 2)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (scandir, + (__const char *__restrict __dir, + struct dirent ***__restrict __namelist, + int (*__selector) (__const struct dirent *), + int (*__cmp) (__const void *, __const void *)), + scandir64) __nonnull ((1, 2)); +# else +# define scandir scandir64 +# endif +# endif + +# if defined __USE_GNU && defined __USE_LARGEFILE64 +/* This function is like `scandir' but it uses the 64bit dirent structure. + Please note that the CMP function must now work with struct dirent64 **. */ +extern int scandir64 (__const char *__restrict __dir, + struct dirent64 ***__restrict __namelist, + int (*__selector) (__const struct dirent64 *), + int (*__cmp) (__const void *, __const void *)) + __nonnull ((1, 2)); +# endif + +/* Function to compare two `struct dirent's alphabetically. */ +# ifndef __USE_FILE_OFFSET64 +extern int alphasort (__const void *__e1, __const void *__e2) + __THROW __attribute_pure__ __nonnull ((1, 2)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (alphasort, + (__const void *__e1, __const void *__e2), + alphasort64) __attribute_pure__ __nonnull ((1, 2)); +# else +# define alphasort alphasort64 +# endif +# endif + +# if defined __USE_GNU && defined __USE_LARGEFILE64 +extern int alphasort64 (__const void *__e1, __const void *__e2) + __THROW __attribute_pure__ __nonnull ((1, 2)); +# endif + +#endif /* Use BSD or misc. */ + +__END_DECLS + +#endif /* dirent.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/dlfcn.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/dlfcn.h new file mode 100644 index 0000000..2348e43 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/dlfcn.h @@ -0,0 +1,201 @@ +/* User functions for run-time dynamic loading. + Copyright (C) 1995-1999,2000,2001,2003,2004,2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _DLFCN_H +#define _DLFCN_H 1 + +#include +#define __need_size_t +#include + +/* Collect various system dependent definitions and declarations. */ +#include + + +#ifdef __USE_GNU +/* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT + the run-time address of the symbol called NAME in the next shared + object is returned. The "next" relation is defined by the order + the shared objects were loaded. */ +# define RTLD_NEXT ((void *) -1l) + +/* If the first argument to `dlsym' or `dlvsym' is set to RTLD_DEFAULT + the run-time address of the symbol called NAME in the global scope + is returned. */ +# define RTLD_DEFAULT ((void *) 0) + + +# if 0 /* uClibc doesnt support this */ +/* Type for namespace indeces. */ +typedef long int Lmid_t; + +/* Special namespace ID values. */ +# define LM_ID_BASE 0 /* Initial namespace. */ +# define LM_ID_NEWLM -1 /* For dlmopen: request new namespace. */ +# endif +#endif + +__BEGIN_DECLS + +/* Open the shared object FILE and map it in; return a handle that can be + passed to `dlsym' to get symbol values from it. */ +extern void *dlopen (__const char *__file, int __mode) __THROW; + +/* Unmap and close a shared object opened by `dlopen'. + The handle cannot be used again after calling `dlclose'. */ +extern int dlclose (void *__handle) __THROW __nonnull ((1)); + +/* Find the run-time address in the shared object HANDLE refers to + of the symbol called NAME. */ +extern void *dlsym (void *__restrict __handle, + __const char *__restrict __name) __THROW __nonnull ((2)); + +#if 0 /*def __USE_GNU*/ +/* Like `dlopen', but request object to be allocated in a new namespace. */ +extern void *dlmopen (Lmid_t __nsid, __const char *__file, int __mode) __THROW; + +/* Find the run-time address in the shared object HANDLE refers to + of the symbol called NAME with VERSION. */ +extern void *dlvsym (void *__restrict __handle, + __const char *__restrict __name, + __const char *__restrict __version) + __THROW __nonnull ((2, 3)); +#endif + +/* When any of the above functions fails, call this function + to return a string describing the error. Each call resets + the error string so that a following call returns null. */ +extern char *dlerror (void) __THROW; + + +#ifdef __USE_GNU +/* Structure containing information about object searched using + `dladdr'. */ +typedef struct +{ + __const char *dli_fname; /* File name of defining object. */ + void *dli_fbase; /* Load address of that object. */ + __const char *dli_sname; /* Name of nearest symbol. */ + void *dli_saddr; /* Exact value of nearest symbol. */ +} Dl_info; + +/* Fill in *INFO with the following information about ADDRESS. + Returns 0 iff no shared object's segments contain that address. */ +extern int dladdr (__const void *__address, Dl_info *__info) + __THROW __nonnull ((2)); + +#if 0 /* not supported by uClibc */ +/* Same as `dladdr', but additionally sets *EXTRA_INFO according to FLAGS. */ +extern int dladdr1 (__const void *__address, Dl_info *__info, + void **__extra_info, int __flags) __THROW __nonnull ((2)); + +/* These are the possible values for the FLAGS argument to `dladdr1'. + This indicates what extra information is stored at *EXTRA_INFO. + It may also be zero, in which case the EXTRA_INFO argument is not used. */ +enum + { + /* Matching symbol table entry (const ElfNN_Sym *). */ + RTLD_DL_SYMENT = 1, + + /* The object containing the address (struct link_map *). */ + RTLD_DL_LINKMAP = 2 + }; + + +/* Get information about the shared object HANDLE refers to. + REQUEST is from among the values below, and determines the use of ARG. + + On success, returns zero. On failure, returns -1 and records an error + message to be fetched with `dlerror'. */ +extern int dlinfo (void *__restrict __handle, + int __request, void *__restrict __arg) + __THROW __nonnull ((1, 3)); + +/* These are the possible values for the REQUEST argument to `dlinfo'. */ +enum + { + /* Treat ARG as `lmid_t *'; store namespace ID for HANDLE there. */ + RTLD_DI_LMID = 1, + + /* Treat ARG as `struct link_map **'; + store the `struct link_map *' for HANDLE there. */ + RTLD_DI_LINKMAP = 2, + + RTLD_DI_CONFIGADDR = 3, /* Unsupported, defined by Solaris. */ + + /* Treat ARG as `Dl_serinfo *' (see below), and fill in to describe the + directories that will be searched for dependencies of this object. + RTLD_DI_SERINFOSIZE fills in just the `dls_cnt' and `dls_size' + entries to indicate the size of the buffer that must be passed to + RTLD_DI_SERINFO to fill in the full information. */ + RTLD_DI_SERINFO = 4, + RTLD_DI_SERINFOSIZE = 5, + + /* Treat ARG as `char *', and store there the directory name used to + expand $ORIGIN in this shared object's dependency file names. */ + RTLD_DI_ORIGIN = 6, + + RTLD_DI_PROFILENAME = 7, /* Unsupported, defined by Solaris. */ + RTLD_DI_PROFILEOUT = 8, /* Unsupported, defined by Solaris. */ + + /* Treat ARG as `size_t *', and store there the TLS module ID + of this object's PT_TLS segment, as used in TLS relocations; + store zero if this object does not define a PT_TLS segment. */ + RTLD_DI_TLS_MODID = 9, + + /* Treat ARG as `void **', and store there a pointer to the calling + thread's TLS block corresponding to this object's PT_TLS segment. + Store a null pointer if this object does not define a PT_TLS + segment, or if the calling thread has not allocated a block for it. */ + RTLD_DI_TLS_DATA = 10, + + RTLD_DI_MAX = 10, + }; + + +/* This is the type of elements in `Dl_serinfo', below. + The `dls_name' member points to space in the buffer passed to `dlinfo'. */ +typedef struct +{ + char *dls_name; /* Name of library search path directory. */ + unsigned int dls_flags; /* Indicates where this directory came from. */ +} Dl_serpath; + +/* This is the structure that must be passed (by reference) to `dlinfo' for + the RTLD_DI_SERINFO and RTLD_DI_SERINFOSIZE requests. */ +typedef struct +{ + size_t dls_size; /* Size in bytes of the whole buffer. */ + unsigned int dls_cnt; /* Number of elements in `dls_serpath'. */ + Dl_serpath dls_serpath[1]; /* Actually longer, dls_cnt elements. */ +} Dl_serinfo; + +#else + +/* Get information about the shared objects currently loaded */ +extern int dlinfo (void); + +#endif +#endif /* __USE_GNU */ + + +__END_DECLS + +#endif /* dlfcn.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/..install.cmd new file mode 100644 index 0000000..e88e1f9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/drm/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/drm /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/drm mips drm.h drm_mode.h drm_sarea.h i810_drm.h i830_drm.h i915_drm.h mga_drm.h r128_drm.h radeon_drm.h savage_drm.h sis_drm.h via_drm.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/drm /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/drm mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/drm/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm.h new file mode 100644 index 0000000..cb1ec51 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm.h @@ -0,0 +1,744 @@ +/** + * \file drm.h + * Header for the Direct Rendering Manager + * + * \author Rickard E. (Rik) Faith + * + * \par Acknowledgments: + * Dec 1999, Richard Henderson , move to generic \c cmpxchg. + */ + +/* + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DRM_H_ +#define _DRM_H_ + +#include +#include /* For _IO* macros */ +#define DRM_IOCTL_NR(n) _IOC_NR(n) +#define DRM_IOC_VOID _IOC_NONE +#define DRM_IOC_READ _IOC_READ +#define DRM_IOC_WRITE _IOC_WRITE +#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE +#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) + +#define DRM_MAJOR 226 +#define DRM_MAX_MINOR 15 + +#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ +#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ +#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ +#define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ + +#define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ +#define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ +#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) +#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) +#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) + +typedef unsigned int drm_handle_t; +typedef unsigned int drm_context_t; +typedef unsigned int drm_drawable_t; +typedef unsigned int drm_magic_t; + +/** + * Cliprect. + * + * \warning: If you change this structure, make sure you change + * XF86DRIClipRectRec in the server as well + * + * \note KW: Actually it's illegal to change either for + * backwards-compatibility reasons. + */ +struct drm_clip_rect { + unsigned short x1; + unsigned short y1; + unsigned short x2; + unsigned short y2; +}; + +/** + * Drawable information. + */ +struct drm_drawable_info { + unsigned int num_rects; + struct drm_clip_rect *rects; +}; + +/** + * Texture region, + */ +struct drm_tex_region { + unsigned char next; + unsigned char prev; + unsigned char in_use; + unsigned char padding; + unsigned int age; +}; + +/** + * Hardware lock. + * + * The lock structure is a simple cache-line aligned integer. To avoid + * processor bus contention on a multiprocessor system, there should not be any + * other data stored in the same cache line. + */ +struct drm_hw_lock { + __volatile__ unsigned int lock; /**< lock variable */ + char padding[60]; /**< Pad to cache line */ +}; + +/** + * DRM_IOCTL_VERSION ioctl argument type. + * + * \sa drmGetVersion(). + */ +struct drm_version { + int version_major; /**< Major version */ + int version_minor; /**< Minor version */ + int version_patchlevel; /**< Patch level */ + size_t name_len; /**< Length of name buffer */ + char *name; /**< Name of driver */ + size_t date_len; /**< Length of date buffer */ + char *date; /**< User-space buffer to hold date */ + size_t desc_len; /**< Length of desc buffer */ + char *desc; /**< User-space buffer to hold desc */ +}; + +/** + * DRM_IOCTL_GET_UNIQUE ioctl argument type. + * + * \sa drmGetBusid() and drmSetBusId(). + */ +struct drm_unique { + size_t unique_len; /**< Length of unique */ + char *unique; /**< Unique name for driver instantiation */ +}; + +struct drm_list { + int count; /**< Length of user-space structures */ + struct drm_version *version; +}; + +struct drm_block { + int unused; +}; + +/** + * DRM_IOCTL_CONTROL ioctl argument type. + * + * \sa drmCtlInstHandler() and drmCtlUninstHandler(). + */ +struct drm_control { + enum { + DRM_ADD_COMMAND, + DRM_RM_COMMAND, + DRM_INST_HANDLER, + DRM_UNINST_HANDLER + } func; + int irq; +}; + +/** + * Type of memory to map. + */ +enum drm_map_type { + _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ + _DRM_REGISTERS = 1, /**< no caching, no core dump */ + _DRM_SHM = 2, /**< shared, cached */ + _DRM_AGP = 3, /**< AGP/GART */ + _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ + _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ + _DRM_GEM = 6, /**< GEM object */ +}; + +/** + * Memory mapping flags. + */ +enum drm_map_flags { + _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ + _DRM_READ_ONLY = 0x02, + _DRM_LOCKED = 0x04, /**< shared, cached, locked */ + _DRM_KERNEL = 0x08, /**< kernel requires access */ + _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ + _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ + _DRM_REMOVABLE = 0x40, /**< Removable mapping */ + _DRM_DRIVER = 0x80 /**< Managed by driver */ +}; + +struct drm_ctx_priv_map { + unsigned int ctx_id; /**< Context requesting private mapping */ + void *handle; /**< Handle of map */ +}; + +/** + * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls + * argument type. + * + * \sa drmAddMap(). + */ +struct drm_map { + unsigned long offset; /**< Requested physical address (0 for SAREA)*/ + unsigned long size; /**< Requested physical size (bytes) */ + enum drm_map_type type; /**< Type of memory to map */ + enum drm_map_flags flags; /**< Flags */ + void *handle; /**< User-space: "Handle" to pass to mmap() */ + /**< Kernel-space: kernel-virtual address */ + int mtrr; /**< MTRR slot used */ + /* Private data */ +}; + +/** + * DRM_IOCTL_GET_CLIENT ioctl argument type. + */ +struct drm_client { + int idx; /**< Which client desired? */ + int auth; /**< Is client authenticated? */ + unsigned long pid; /**< Process ID */ + unsigned long uid; /**< User ID */ + unsigned long magic; /**< Magic */ + unsigned long iocs; /**< Ioctl count */ +}; + +enum drm_stat_type { + _DRM_STAT_LOCK, + _DRM_STAT_OPENS, + _DRM_STAT_CLOSES, + _DRM_STAT_IOCTLS, + _DRM_STAT_LOCKS, + _DRM_STAT_UNLOCKS, + _DRM_STAT_VALUE, /**< Generic value */ + _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ + _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ + + _DRM_STAT_IRQ, /**< IRQ */ + _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ + _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ + _DRM_STAT_DMA, /**< DMA */ + _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ + _DRM_STAT_MISSED /**< Missed DMA opportunity */ + /* Add to the *END* of the list */ +}; + +/** + * DRM_IOCTL_GET_STATS ioctl argument type. + */ +struct drm_stats { + unsigned long count; + struct { + unsigned long value; + enum drm_stat_type type; + } data[15]; +}; + +/** + * Hardware locking flags. + */ +enum drm_lock_flags { + _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ + _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ + _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ + _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ + /* These *HALT* flags aren't supported yet + -- they will be used to support the + full-screen DGA-like mode. */ + _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ + _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ +}; + +/** + * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. + * + * \sa drmGetLock() and drmUnlock(). + */ +struct drm_lock { + int context; + enum drm_lock_flags flags; +}; + +/** + * DMA flags + * + * \warning + * These values \e must match xf86drm.h. + * + * \sa drm_dma. + */ +enum drm_dma_flags { + /* Flags for DMA buffer dispatch */ + _DRM_DMA_BLOCK = 0x01, /**< + * Block until buffer dispatched. + * + * \note The buffer may not yet have + * been processed by the hardware -- + * getting a hardware lock with the + * hardware quiescent will ensure + * that the buffer has been + * processed. + */ + _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ + _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ + + /* Flags for DMA buffer request */ + _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ + _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ + _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ +}; + +/** + * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. + * + * \sa drmAddBufs(). + */ +struct drm_buf_desc { + int count; /**< Number of buffers of this size */ + int size; /**< Size in bytes */ + int low_mark; /**< Low water mark */ + int high_mark; /**< High water mark */ + enum { + _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ + _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ + _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ + _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ + _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ + } flags; + unsigned long agp_start; /**< + * Start address of where the AGP buffers are + * in the AGP aperture + */ +}; + +/** + * DRM_IOCTL_INFO_BUFS ioctl argument type. + */ +struct drm_buf_info { + int count; /**< Entries in list */ + struct drm_buf_desc *list; +}; + +/** + * DRM_IOCTL_FREE_BUFS ioctl argument type. + */ +struct drm_buf_free { + int count; + int *list; +}; + +/** + * Buffer information + * + * \sa drm_buf_map. + */ +struct drm_buf_pub { + int idx; /**< Index into the master buffer list */ + int total; /**< Buffer size */ + int used; /**< Amount of buffer in use (for DMA) */ + void *address; /**< Address of buffer */ +}; + +/** + * DRM_IOCTL_MAP_BUFS ioctl argument type. + */ +struct drm_buf_map { + int count; /**< Length of the buffer list */ + void *virtual; /**< Mmap'd area in user-virtual */ + struct drm_buf_pub *list; /**< Buffer information */ +}; + +/** + * DRM_IOCTL_DMA ioctl argument type. + * + * Indices here refer to the offset into the buffer list in drm_buf_get. + * + * \sa drmDMA(). + */ +struct drm_dma { + int context; /**< Context handle */ + int send_count; /**< Number of buffers to send */ + int *send_indices; /**< List of handles to buffers */ + int *send_sizes; /**< Lengths of data to send */ + enum drm_dma_flags flags; /**< Flags */ + int request_count; /**< Number of buffers requested */ + int request_size; /**< Desired size for buffers */ + int *request_indices; /**< Buffer information */ + int *request_sizes; + int granted_count; /**< Number of buffers granted */ +}; + +enum drm_ctx_flags { + _DRM_CONTEXT_PRESERVED = 0x01, + _DRM_CONTEXT_2DONLY = 0x02 +}; + +/** + * DRM_IOCTL_ADD_CTX ioctl argument type. + * + * \sa drmCreateContext() and drmDestroyContext(). + */ +struct drm_ctx { + drm_context_t handle; + enum drm_ctx_flags flags; +}; + +/** + * DRM_IOCTL_RES_CTX ioctl argument type. + */ +struct drm_ctx_res { + int count; + struct drm_ctx *contexts; +}; + +/** + * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. + */ +struct drm_draw { + drm_drawable_t handle; +}; + +/** + * DRM_IOCTL_UPDATE_DRAW ioctl argument type. + */ +typedef enum { + DRM_DRAWABLE_CLIPRECTS, +} drm_drawable_info_type_t; + +struct drm_update_draw { + drm_drawable_t handle; + unsigned int type; + unsigned int num; + unsigned long long data; +}; + +/** + * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. + */ +struct drm_auth { + drm_magic_t magic; +}; + +/** + * DRM_IOCTL_IRQ_BUSID ioctl argument type. + * + * \sa drmGetInterruptFromBusID(). + */ +struct drm_irq_busid { + int irq; /**< IRQ number */ + int busnum; /**< bus number */ + int devnum; /**< device number */ + int funcnum; /**< function number */ +}; + +enum drm_vblank_seq_type { + _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ + _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ + _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ + _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ + _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ + _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ +}; + +#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) +#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \ + _DRM_VBLANK_NEXTONMISS) + +struct drm_wait_vblank_request { + enum drm_vblank_seq_type type; + unsigned int sequence; + unsigned long signal; +}; + +struct drm_wait_vblank_reply { + enum drm_vblank_seq_type type; + unsigned int sequence; + long tval_sec; + long tval_usec; +}; + +/** + * DRM_IOCTL_WAIT_VBLANK ioctl argument type. + * + * \sa drmWaitVBlank(). + */ +union drm_wait_vblank { + struct drm_wait_vblank_request request; + struct drm_wait_vblank_reply reply; +}; + +#define _DRM_PRE_MODESET 1 +#define _DRM_POST_MODESET 2 + +/** + * DRM_IOCTL_MODESET_CTL ioctl argument type + * + * \sa drmModesetCtl(). + */ +struct drm_modeset_ctl { + __u32 crtc; + __u32 cmd; +}; + +/** + * DRM_IOCTL_AGP_ENABLE ioctl argument type. + * + * \sa drmAgpEnable(). + */ +struct drm_agp_mode { + unsigned long mode; /**< AGP mode */ +}; + +/** + * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. + * + * \sa drmAgpAlloc() and drmAgpFree(). + */ +struct drm_agp_buffer { + unsigned long size; /**< In bytes -- will round to page boundary */ + unsigned long handle; /**< Used for binding / unbinding */ + unsigned long type; /**< Type of memory to allocate */ + unsigned long physical; /**< Physical used by i810 */ +}; + +/** + * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. + * + * \sa drmAgpBind() and drmAgpUnbind(). + */ +struct drm_agp_binding { + unsigned long handle; /**< From drm_agp_buffer */ + unsigned long offset; /**< In bytes -- will round to page boundary */ +}; + +/** + * DRM_IOCTL_AGP_INFO ioctl argument type. + * + * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), + * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), + * drmAgpVendorId() and drmAgpDeviceId(). + */ +struct drm_agp_info { + int agp_version_major; + int agp_version_minor; + unsigned long mode; + unsigned long aperture_base; /* physical address */ + unsigned long aperture_size; /* bytes */ + unsigned long memory_allowed; /* bytes */ + unsigned long memory_used; + + /* PCI information */ + unsigned short id_vendor; + unsigned short id_device; +}; + +/** + * DRM_IOCTL_SG_ALLOC ioctl argument type. + */ +struct drm_scatter_gather { + unsigned long size; /**< In bytes -- will round to page boundary */ + unsigned long handle; /**< Used for mapping / unmapping */ +}; + +/** + * DRM_IOCTL_SET_VERSION ioctl argument type. + */ +struct drm_set_version { + int drm_di_major; + int drm_di_minor; + int drm_dd_major; + int drm_dd_minor; +}; + +/** DRM_IOCTL_GEM_CLOSE ioctl argument type */ +struct drm_gem_close { + /** Handle of the object to be closed. */ + __u32 handle; + __u32 pad; +}; + +/** DRM_IOCTL_GEM_FLINK ioctl argument type */ +struct drm_gem_flink { + /** Handle for the object being named */ + __u32 handle; + + /** Returned global name */ + __u32 name; +}; + +/** DRM_IOCTL_GEM_OPEN ioctl argument type */ +struct drm_gem_open { + /** Name of object being opened */ + __u32 name; + + /** Returned handle for the object */ + __u32 handle; + + /** Returned size of the object */ + __u64 size; +}; + +#include "drm_mode.h" + +#define DRM_IOCTL_BASE 'd' +#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) +#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) +#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) +#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) + +#define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) +#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) +#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) +#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) +#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) +#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) +#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) +#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) +#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) +#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) +#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) +#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) + +#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) +#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) +#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) +#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) +#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) +#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) +#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) +#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) +#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) +#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) +#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) + +#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) + +#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) +#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) + +#define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) +#define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) + +#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) +#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) +#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) +#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) +#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) +#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) +#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) +#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) +#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) +#define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) +#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) +#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) +#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) + +#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) +#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) +#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) +#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) +#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) +#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) +#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) +#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) + +#define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) +#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) + +#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) + +#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) + +#define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) +#define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) +#define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) +#define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) +#define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) +#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) +#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) +#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) +#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) +#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) + +#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) +#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) +#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) +#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) +#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) +#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) + +/** + * Device specific ioctls should only be in their respective headers + * The device specific ioctl range is from 0x40 to 0x99. + * Generic IOCTLS restart at 0xA0. + * + * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and + * drmCommandReadWrite(). + */ +#define DRM_COMMAND_BASE 0x40 +#define DRM_COMMAND_END 0xA0 + +/* typedef area */ +typedef struct drm_clip_rect drm_clip_rect_t; +typedef struct drm_drawable_info drm_drawable_info_t; +typedef struct drm_tex_region drm_tex_region_t; +typedef struct drm_hw_lock drm_hw_lock_t; +typedef struct drm_version drm_version_t; +typedef struct drm_unique drm_unique_t; +typedef struct drm_list drm_list_t; +typedef struct drm_block drm_block_t; +typedef struct drm_control drm_control_t; +typedef enum drm_map_type drm_map_type_t; +typedef enum drm_map_flags drm_map_flags_t; +typedef struct drm_ctx_priv_map drm_ctx_priv_map_t; +typedef struct drm_map drm_map_t; +typedef struct drm_client drm_client_t; +typedef enum drm_stat_type drm_stat_type_t; +typedef struct drm_stats drm_stats_t; +typedef enum drm_lock_flags drm_lock_flags_t; +typedef struct drm_lock drm_lock_t; +typedef enum drm_dma_flags drm_dma_flags_t; +typedef struct drm_buf_desc drm_buf_desc_t; +typedef struct drm_buf_info drm_buf_info_t; +typedef struct drm_buf_free drm_buf_free_t; +typedef struct drm_buf_pub drm_buf_pub_t; +typedef struct drm_buf_map drm_buf_map_t; +typedef struct drm_dma drm_dma_t; +typedef union drm_wait_vblank drm_wait_vblank_t; +typedef struct drm_agp_mode drm_agp_mode_t; +typedef enum drm_ctx_flags drm_ctx_flags_t; +typedef struct drm_ctx drm_ctx_t; +typedef struct drm_ctx_res drm_ctx_res_t; +typedef struct drm_draw drm_draw_t; +typedef struct drm_update_draw drm_update_draw_t; +typedef struct drm_auth drm_auth_t; +typedef struct drm_irq_busid drm_irq_busid_t; +typedef enum drm_vblank_seq_type drm_vblank_seq_type_t; + +typedef struct drm_agp_buffer drm_agp_buffer_t; +typedef struct drm_agp_binding drm_agp_binding_t; +typedef struct drm_agp_info drm_agp_info_t; +typedef struct drm_scatter_gather drm_scatter_gather_t; +typedef struct drm_set_version drm_set_version_t; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm_mode.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm_mode.h new file mode 100644 index 0000000..ae304cc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm_mode.h @@ -0,0 +1,268 @@ +/* + * Copyright (c) 2007 Dave Airlie + * Copyright (c) 2007 Jakob Bornecrantz + * Copyright (c) 2008 Red Hat Inc. + * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA + * Copyright (c) 2007-2008 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _DRM_MODE_H +#define _DRM_MODE_H + +#include +#include + +#define DRM_DISPLAY_INFO_LEN 32 +#define DRM_CONNECTOR_NAME_LEN 32 +#define DRM_DISPLAY_MODE_LEN 32 +#define DRM_PROP_NAME_LEN 32 + +#define DRM_MODE_TYPE_BUILTIN (1<<0) +#define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) +#define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) +#define DRM_MODE_TYPE_PREFERRED (1<<3) +#define DRM_MODE_TYPE_DEFAULT (1<<4) +#define DRM_MODE_TYPE_USERDEF (1<<5) +#define DRM_MODE_TYPE_DRIVER (1<<6) + +/* Video mode flags */ +/* bit compatible with the xorg definitions. */ +#define DRM_MODE_FLAG_PHSYNC (1<<0) +#define DRM_MODE_FLAG_NHSYNC (1<<1) +#define DRM_MODE_FLAG_PVSYNC (1<<2) +#define DRM_MODE_FLAG_NVSYNC (1<<3) +#define DRM_MODE_FLAG_INTERLACE (1<<4) +#define DRM_MODE_FLAG_DBLSCAN (1<<5) +#define DRM_MODE_FLAG_CSYNC (1<<6) +#define DRM_MODE_FLAG_PCSYNC (1<<7) +#define DRM_MODE_FLAG_NCSYNC (1<<8) +#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ +#define DRM_MODE_FLAG_BCAST (1<<10) +#define DRM_MODE_FLAG_PIXMUX (1<<11) +#define DRM_MODE_FLAG_DBLCLK (1<<12) +#define DRM_MODE_FLAG_CLKDIV2 (1<<13) + +/* DPMS flags */ +/* bit compatible with the xorg definitions. */ +#define DRM_MODE_DPMS_ON 0 +#define DRM_MODE_DPMS_STANDBY 1 +#define DRM_MODE_DPMS_SUSPEND 2 +#define DRM_MODE_DPMS_OFF 3 + +/* Scaling mode options */ +#define DRM_MODE_SCALE_NON_GPU 0 +#define DRM_MODE_SCALE_FULLSCREEN 1 +#define DRM_MODE_SCALE_NO_SCALE 2 +#define DRM_MODE_SCALE_ASPECT 3 + +/* Dithering mode options */ +#define DRM_MODE_DITHERING_OFF 0 +#define DRM_MODE_DITHERING_ON 1 + +struct drm_mode_modeinfo { + __u32 clock; + __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; + __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; + + __u32 vrefresh; /* vertical refresh * 1000 */ + + __u32 flags; + __u32 type; + char name[DRM_DISPLAY_MODE_LEN]; +}; + +struct drm_mode_card_res { + __u64 fb_id_ptr; + __u64 crtc_id_ptr; + __u64 connector_id_ptr; + __u64 encoder_id_ptr; + __u32 count_fbs; + __u32 count_crtcs; + __u32 count_connectors; + __u32 count_encoders; + __u32 min_width, max_width; + __u32 min_height, max_height; +}; + +struct drm_mode_crtc { + __u64 set_connectors_ptr; + __u32 count_connectors; + + __u32 crtc_id; /**< Id */ + __u32 fb_id; /**< Id of framebuffer */ + + __u32 x, y; /**< Position on the frameuffer */ + + __u32 gamma_size; + __u32 mode_valid; + struct drm_mode_modeinfo mode; +}; + +#define DRM_MODE_ENCODER_NONE 0 +#define DRM_MODE_ENCODER_DAC 1 +#define DRM_MODE_ENCODER_TMDS 2 +#define DRM_MODE_ENCODER_LVDS 3 +#define DRM_MODE_ENCODER_TVDAC 4 + +struct drm_mode_get_encoder { + __u32 encoder_id; + __u32 encoder_type; + + __u32 crtc_id; /**< Id of crtc */ + + __u32 possible_crtcs; + __u32 possible_clones; +}; + +/* This is for connectors with multiple signal types. */ +/* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */ +#define DRM_MODE_SUBCONNECTOR_Automatic 0 +#define DRM_MODE_SUBCONNECTOR_Unknown 0 +#define DRM_MODE_SUBCONNECTOR_DVID 3 +#define DRM_MODE_SUBCONNECTOR_DVIA 4 +#define DRM_MODE_SUBCONNECTOR_Composite 5 +#define DRM_MODE_SUBCONNECTOR_SVIDEO 6 +#define DRM_MODE_SUBCONNECTOR_Component 8 + +#define DRM_MODE_CONNECTOR_Unknown 0 +#define DRM_MODE_CONNECTOR_VGA 1 +#define DRM_MODE_CONNECTOR_DVII 2 +#define DRM_MODE_CONNECTOR_DVID 3 +#define DRM_MODE_CONNECTOR_DVIA 4 +#define DRM_MODE_CONNECTOR_Composite 5 +#define DRM_MODE_CONNECTOR_SVIDEO 6 +#define DRM_MODE_CONNECTOR_LVDS 7 +#define DRM_MODE_CONNECTOR_Component 8 +#define DRM_MODE_CONNECTOR_9PinDIN 9 +#define DRM_MODE_CONNECTOR_DisplayPort 10 +#define DRM_MODE_CONNECTOR_HDMIA 11 +#define DRM_MODE_CONNECTOR_HDMIB 12 + +struct drm_mode_get_connector { + + __u64 encoders_ptr; + __u64 modes_ptr; + __u64 props_ptr; + __u64 prop_values_ptr; + + __u32 count_modes; + __u32 count_props; + __u32 count_encoders; + + __u32 encoder_id; /**< Current Encoder */ + __u32 connector_id; /**< Id */ + __u32 connector_type; + __u32 connector_type_id; + + __u32 connection; + __u32 mm_width, mm_height; /**< HxW in millimeters */ + __u32 subpixel; +}; + +#define DRM_MODE_PROP_PENDING (1<<0) +#define DRM_MODE_PROP_RANGE (1<<1) +#define DRM_MODE_PROP_IMMUTABLE (1<<2) +#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ +#define DRM_MODE_PROP_BLOB (1<<4) + +struct drm_mode_property_enum { + __u64 value; + char name[DRM_PROP_NAME_LEN]; +}; + +struct drm_mode_get_property { + __u64 values_ptr; /* values and blob lengths */ + __u64 enum_blob_ptr; /* enum and blob id ptrs */ + + __u32 prop_id; + __u32 flags; + char name[DRM_PROP_NAME_LEN]; + + __u32 count_values; + __u32 count_enum_blobs; +}; + +struct drm_mode_connector_set_property { + __u64 value; + __u32 prop_id; + __u32 connector_id; +}; + +struct drm_mode_get_blob { + __u32 blob_id; + __u32 length; + __u64 data; +}; + +struct drm_mode_fb_cmd { + __u32 fb_id; + __u32 width, height; + __u32 pitch; + __u32 bpp; + __u32 depth; + /* driver specific handle */ + __u32 handle; +}; + +struct drm_mode_mode_cmd { + __u32 connector_id; + struct drm_mode_modeinfo mode; +}; + +#define DRM_MODE_CURSOR_BO (1<<0) +#define DRM_MODE_CURSOR_MOVE (1<<1) + +/* + * depending on the value in flags diffrent members are used. + * + * CURSOR_BO uses + * crtc + * width + * height + * handle - if 0 turns the cursor of + * + * CURSOR_MOVE uses + * crtc + * x + * y + */ +struct drm_mode_cursor { + __u32 flags; + __u32 crtc_id; + __s32 x; + __s32 y; + __u32 width; + __u32 height; + /* driver specific handle */ + __u32 handle; +}; + +struct drm_mode_crtc_lut { + __u32 crtc_id; + __u32 gamma_size; + + /* pointers to arrays */ + __u64 red; + __u64 green; + __u64 blue; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm_sarea.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm_sarea.h new file mode 100644 index 0000000..7325558 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/drm_sarea.h @@ -0,0 +1,82 @@ +/** + * \file drm_sarea.h + * \brief SAREA definitions + * + * \author Michel Dänzer + */ + +/* + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DRM_SAREA_H_ +#define _DRM_SAREA_H_ + +#include "drm.h" + +/* SAREA area needs to be at least a page */ +#if defined(__alpha__) +#define SAREA_MAX 0x2000U +#elif defined(__ia64__) +#define SAREA_MAX 0x10000U /* 64kB */ +#else +/* Intel 830M driver needs at least 8k SAREA */ +#define SAREA_MAX 0x2000U +#endif + +/** Maximum number of drawables in the SAREA */ +#define SAREA_MAX_DRAWABLES 256 + +#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 + +/** SAREA drawable */ +struct drm_sarea_drawable { + unsigned int stamp; + unsigned int flags; +}; + +/** SAREA frame */ +struct drm_sarea_frame { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + unsigned int fullscreen; +}; + +/** SAREA */ +struct drm_sarea { + /** first thing is always the DRM locking structure */ + struct drm_hw_lock lock; + /** \todo Use readers/writer lock for drm_sarea::drawable_lock */ + struct drm_hw_lock drawable_lock; + struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */ + struct drm_sarea_frame frame; /**< frame */ + drm_context_t dummy_context; +}; + +typedef struct drm_sarea_drawable drm_sarea_drawable_t; +typedef struct drm_sarea_frame drm_sarea_frame_t; +typedef struct drm_sarea drm_sarea_t; + +#endif /* _DRM_SAREA_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/i810_drm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/i810_drm.h new file mode 100644 index 0000000..7a10bb6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/i810_drm.h @@ -0,0 +1,281 @@ +#ifndef _I810_DRM_H_ +#define _I810_DRM_H_ + +/* WARNING: These defines must be the same as what the Xserver uses. + * if you change them, you must change the defines in the Xserver. + */ + +#ifndef _I810_DEFINES_ +#define _I810_DEFINES_ + +#define I810_DMA_BUF_ORDER 12 +#define I810_DMA_BUF_SZ (1< +#include "drm.h" + +/* Each region is a minimum of 16k, and there are at most 255 of them. + */ +#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use + * of chars for next/prev indices */ +#define I915_LOG_MIN_TEX_REGION_SIZE 14 + +typedef struct _drm_i915_init { + enum { + I915_INIT_DMA = 0x01, + I915_CLEANUP_DMA = 0x02, + I915_RESUME_DMA = 0x03 + } func; + unsigned int mmio_offset; + int sarea_priv_offset; + unsigned int ring_start; + unsigned int ring_end; + unsigned int ring_size; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; + unsigned int back_pitch; + unsigned int depth_pitch; + unsigned int cpp; + unsigned int chipset; +} drm_i915_init_t; + +typedef struct _drm_i915_sarea { + struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1]; + int last_upload; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int ctxOwner; /* last context to upload state */ + int texAge; + int pf_enabled; /* is pageflipping allowed? */ + int pf_active; + int pf_current_page; /* which buffer is being displayed? */ + int perf_boxes; /* performance boxes to be displayed */ + int width, height; /* screen size in pixels */ + + drm_handle_t front_handle; + int front_offset; + int front_size; + + drm_handle_t back_handle; + int back_offset; + int back_size; + + drm_handle_t depth_handle; + int depth_offset; + int depth_size; + + drm_handle_t tex_handle; + int tex_offset; + int tex_size; + int log_tex_granularity; + int pitch; + int rotation; /* 0, 90, 180 or 270 */ + int rotated_offset; + int rotated_size; + int rotated_pitch; + int virtualX, virtualY; + + unsigned int front_tiled; + unsigned int back_tiled; + unsigned int depth_tiled; + unsigned int rotated_tiled; + unsigned int rotated2_tiled; + + int pipeA_x; + int pipeA_y; + int pipeA_w; + int pipeA_h; + int pipeB_x; + int pipeB_y; + int pipeB_w; + int pipeB_h; + + /* fill out some space for old userspace triple buffer */ + drm_handle_t unused_handle; + __u32 unused1, unused2, unused3; + + /* buffer object handles for static buffers. May change + * over the lifetime of the client. + */ + __u32 front_bo_handle; + __u32 back_bo_handle; + __u32 unused_bo_handle; + __u32 depth_bo_handle; + +} drm_i915_sarea_t; + +/* due to userspace building against these headers we need some compat here */ +#define planeA_x pipeA_x +#define planeA_y pipeA_y +#define planeA_w pipeA_w +#define planeA_h pipeA_h +#define planeB_x pipeB_x +#define planeB_y pipeB_y +#define planeB_w pipeB_w +#define planeB_h pipeB_h + +/* Flags for perf_boxes + */ +#define I915_BOX_RING_EMPTY 0x1 +#define I915_BOX_FLIP 0x2 +#define I915_BOX_WAIT 0x4 +#define I915_BOX_TEXTURE_LOAD 0x8 +#define I915_BOX_LOST_CONTEXT 0x10 + +/* I915 specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_I915_INIT 0x00 +#define DRM_I915_FLUSH 0x01 +#define DRM_I915_FLIP 0x02 +#define DRM_I915_BATCHBUFFER 0x03 +#define DRM_I915_IRQ_EMIT 0x04 +#define DRM_I915_IRQ_WAIT 0x05 +#define DRM_I915_GETPARAM 0x06 +#define DRM_I915_SETPARAM 0x07 +#define DRM_I915_ALLOC 0x08 +#define DRM_I915_FREE 0x09 +#define DRM_I915_INIT_HEAP 0x0a +#define DRM_I915_CMDBUFFER 0x0b +#define DRM_I915_DESTROY_HEAP 0x0c +#define DRM_I915_SET_VBLANK_PIPE 0x0d +#define DRM_I915_GET_VBLANK_PIPE 0x0e +#define DRM_I915_VBLANK_SWAP 0x0f +#define DRM_I915_HWS_ADDR 0x11 +#define DRM_I915_GEM_INIT 0x13 +#define DRM_I915_GEM_EXECBUFFER 0x14 +#define DRM_I915_GEM_PIN 0x15 +#define DRM_I915_GEM_UNPIN 0x16 +#define DRM_I915_GEM_BUSY 0x17 +#define DRM_I915_GEM_THROTTLE 0x18 +#define DRM_I915_GEM_ENTERVT 0x19 +#define DRM_I915_GEM_LEAVEVT 0x1a +#define DRM_I915_GEM_CREATE 0x1b +#define DRM_I915_GEM_PREAD 0x1c +#define DRM_I915_GEM_PWRITE 0x1d +#define DRM_I915_GEM_MMAP 0x1e +#define DRM_I915_GEM_SET_DOMAIN 0x1f +#define DRM_I915_GEM_SW_FINISH 0x20 +#define DRM_I915_GEM_SET_TILING 0x21 +#define DRM_I915_GEM_GET_TILING 0x22 +#define DRM_I915_GEM_GET_APERTURE 0x23 +#define DRM_I915_GEM_MMAP_GTT 0x24 +#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 + +#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) +#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) +#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) +#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) +#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) +#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) +#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) +#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) +#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) +#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) +#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) +#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) +#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) +#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) +#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) +#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) +#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) +#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) +#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) +#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) +#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) +#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) +#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) +#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) +#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) +#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) +#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) +#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) +#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) +#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) +#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) +#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) +#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) +#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) +#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_intel_get_pipe_from_crtc_id) + +/* Allow drivers to submit batchbuffers directly to hardware, relying + * on the security mechanisms provided by hardware. + */ +typedef struct drm_i915_batchbuffer { + int start; /* agp offset */ + int used; /* nr bytes in use */ + int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ + int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ + int num_cliprects; /* mulitpass with multiple cliprects? */ + struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ +} drm_i915_batchbuffer_t; + +/* As above, but pass a pointer to userspace buffer which can be + * validated by the kernel prior to sending to hardware. + */ +typedef struct _drm_i915_cmdbuffer { + char *buf; /* pointer to userspace command buffer */ + int sz; /* nr bytes in buf */ + int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ + int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ + int num_cliprects; /* mulitpass with multiple cliprects? */ + struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ +} drm_i915_cmdbuffer_t; + +/* Userspace can request & wait on irq's: + */ +typedef struct drm_i915_irq_emit { + int *irq_seq; +} drm_i915_irq_emit_t; + +typedef struct drm_i915_irq_wait { + int irq_seq; +} drm_i915_irq_wait_t; + +/* Ioctl to query kernel params: + */ +#define I915_PARAM_IRQ_ACTIVE 1 +#define I915_PARAM_ALLOW_BATCHBUFFER 2 +#define I915_PARAM_LAST_DISPATCH 3 +#define I915_PARAM_CHIPSET_ID 4 +#define I915_PARAM_HAS_GEM 5 +#define I915_PARAM_NUM_FENCES_AVAIL 6 + +typedef struct drm_i915_getparam { + int param; + int *value; +} drm_i915_getparam_t; + +/* Ioctl to set kernel params: + */ +#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 +#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 +#define I915_SETPARAM_ALLOW_BATCHBUFFER 3 +#define I915_SETPARAM_NUM_USED_FENCES 4 + +typedef struct drm_i915_setparam { + int param; + int value; +} drm_i915_setparam_t; + +/* A memory manager for regions of shared memory: + */ +#define I915_MEM_REGION_AGP 1 + +typedef struct drm_i915_mem_alloc { + int region; + int alignment; + int size; + int *region_offset; /* offset from start of fb or agp */ +} drm_i915_mem_alloc_t; + +typedef struct drm_i915_mem_free { + int region; + int region_offset; +} drm_i915_mem_free_t; + +typedef struct drm_i915_mem_init_heap { + int region; + int size; + int start; +} drm_i915_mem_init_heap_t; + +/* Allow memory manager to be torn down and re-initialized (eg on + * rotate): + */ +typedef struct drm_i915_mem_destroy_heap { + int region; +} drm_i915_mem_destroy_heap_t; + +/* Allow X server to configure which pipes to monitor for vblank signals + */ +#define DRM_I915_VBLANK_PIPE_A 1 +#define DRM_I915_VBLANK_PIPE_B 2 + +typedef struct drm_i915_vblank_pipe { + int pipe; +} drm_i915_vblank_pipe_t; + +/* Schedule buffer swap at given vertical blank: + */ +typedef struct drm_i915_vblank_swap { + drm_drawable_t drawable; + enum drm_vblank_seq_type seqtype; + unsigned int sequence; +} drm_i915_vblank_swap_t; + +typedef struct drm_i915_hws_addr { + __u64 addr; +} drm_i915_hws_addr_t; + +struct drm_i915_gem_init { + /** + * Beginning offset in the GTT to be managed by the DRM memory + * manager. + */ + __u64 gtt_start; + /** + * Ending offset in the GTT to be managed by the DRM memory + * manager. + */ + __u64 gtt_end; +}; + +struct drm_i915_gem_create { + /** + * Requested size for the object. + * + * The (page-aligned) allocated size for the object will be returned. + */ + __u64 size; + /** + * Returned handle for the object. + * + * Object handles are nonzero. + */ + __u32 handle; + __u32 pad; +}; + +struct drm_i915_gem_pread { + /** Handle for the object being read. */ + __u32 handle; + __u32 pad; + /** Offset into the object to read from */ + __u64 offset; + /** Length of data to read */ + __u64 size; + /** + * Pointer to write the data into. + * + * This is a fixed-size type for 32/64 compatibility. + */ + __u64 data_ptr; +}; + +struct drm_i915_gem_pwrite { + /** Handle for the object being written to. */ + __u32 handle; + __u32 pad; + /** Offset into the object to write to */ + __u64 offset; + /** Length of data to write */ + __u64 size; + /** + * Pointer to read the data from. + * + * This is a fixed-size type for 32/64 compatibility. + */ + __u64 data_ptr; +}; + +struct drm_i915_gem_mmap { + /** Handle for the object being mapped. */ + __u32 handle; + __u32 pad; + /** Offset in the object to map. */ + __u64 offset; + /** + * Length of data to map. + * + * The value will be page-aligned. + */ + __u64 size; + /** + * Returned pointer the data was mapped at. + * + * This is a fixed-size type for 32/64 compatibility. + */ + __u64 addr_ptr; +}; + +struct drm_i915_gem_mmap_gtt { + /** Handle for the object being mapped. */ + __u32 handle; + __u32 pad; + /** + * Fake offset to use for subsequent mmap call + * + * This is a fixed-size type for 32/64 compatibility. + */ + __u64 offset; +}; + +struct drm_i915_gem_set_domain { + /** Handle for the object */ + __u32 handle; + + /** New read domains */ + __u32 read_domains; + + /** New write domain */ + __u32 write_domain; +}; + +struct drm_i915_gem_sw_finish { + /** Handle for the object */ + __u32 handle; +}; + +struct drm_i915_gem_relocation_entry { + /** + * Handle of the buffer being pointed to by this relocation entry. + * + * It's appealing to make this be an index into the mm_validate_entry + * list to refer to the buffer, but this allows the driver to create + * a relocation list for state buffers and not re-write it per + * exec using the buffer. + */ + __u32 target_handle; + + /** + * Value to be added to the offset of the target buffer to make up + * the relocation entry. + */ + __u32 delta; + + /** Offset in the buffer the relocation entry will be written into */ + __u64 offset; + + /** + * Offset value of the target buffer that the relocation entry was last + * written as. + * + * If the buffer has the same offset as last time, we can skip syncing + * and writing the relocation. This value is written back out by + * the execbuffer ioctl when the relocation is written. + */ + __u64 presumed_offset; + + /** + * Target memory domains read by this operation. + */ + __u32 read_domains; + + /** + * Target memory domains written by this operation. + * + * Note that only one domain may be written by the whole + * execbuffer operation, so that where there are conflicts, + * the application will get -EINVAL back. + */ + __u32 write_domain; +}; + +/** @{ + * Intel memory domains + * + * Most of these just align with the various caches in + * the system and are used to flush and invalidate as + * objects end up cached in different domains. + */ +/** CPU cache */ +#define I915_GEM_DOMAIN_CPU 0x00000001 +/** Render cache, used by 2D and 3D drawing */ +#define I915_GEM_DOMAIN_RENDER 0x00000002 +/** Sampler cache, used by texture engine */ +#define I915_GEM_DOMAIN_SAMPLER 0x00000004 +/** Command queue, used to load batch buffers */ +#define I915_GEM_DOMAIN_COMMAND 0x00000008 +/** Instruction cache, used by shader programs */ +#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 +/** Vertex address cache */ +#define I915_GEM_DOMAIN_VERTEX 0x00000020 +/** GTT domain - aperture and scanout */ +#define I915_GEM_DOMAIN_GTT 0x00000040 +/** @} */ + +struct drm_i915_gem_exec_object { + /** + * User's handle for a buffer to be bound into the GTT for this + * operation. + */ + __u32 handle; + + /** Number of relocations to be performed on this buffer */ + __u32 relocation_count; + /** + * Pointer to array of struct drm_i915_gem_relocation_entry containing + * the relocations to be performed in this buffer. + */ + __u64 relocs_ptr; + + /** Required alignment in graphics aperture */ + __u64 alignment; + + /** + * Returned value of the updated offset of the object, for future + * presumed_offset writes. + */ + __u64 offset; +}; + +struct drm_i915_gem_execbuffer { + /** + * List of buffers to be validated with their relocations to be + * performend on them. + * + * This is a pointer to an array of struct drm_i915_gem_validate_entry. + * + * These buffers must be listed in an order such that all relocations + * a buffer is performing refer to buffers that have already appeared + * in the validate list. + */ + __u64 buffers_ptr; + __u32 buffer_count; + + /** Offset in the batchbuffer to start execution from. */ + __u32 batch_start_offset; + /** Bytes used in batchbuffer from batch_start_offset */ + __u32 batch_len; + __u32 DR1; + __u32 DR4; + __u32 num_cliprects; + /** This is a struct drm_clip_rect *cliprects */ + __u64 cliprects_ptr; +}; + +struct drm_i915_gem_pin { + /** Handle of the buffer to be pinned. */ + __u32 handle; + __u32 pad; + + /** alignment required within the aperture */ + __u64 alignment; + + /** Returned GTT offset of the buffer. */ + __u64 offset; +}; + +struct drm_i915_gem_unpin { + /** Handle of the buffer to be unpinned. */ + __u32 handle; + __u32 pad; +}; + +struct drm_i915_gem_busy { + /** Handle of the buffer to check for busy */ + __u32 handle; + + /** Return busy status (1 if busy, 0 if idle) */ + __u32 busy; +}; + +#define I915_TILING_NONE 0 +#define I915_TILING_X 1 +#define I915_TILING_Y 2 + +#define I915_BIT_6_SWIZZLE_NONE 0 +#define I915_BIT_6_SWIZZLE_9 1 +#define I915_BIT_6_SWIZZLE_9_10 2 +#define I915_BIT_6_SWIZZLE_9_11 3 +#define I915_BIT_6_SWIZZLE_9_10_11 4 +/* Not seen by userland */ +#define I915_BIT_6_SWIZZLE_UNKNOWN 5 +/* Seen by userland. */ +#define I915_BIT_6_SWIZZLE_9_17 6 +#define I915_BIT_6_SWIZZLE_9_10_17 7 + +struct drm_i915_gem_set_tiling { + /** Handle of the buffer to have its tiling state updated */ + __u32 handle; + + /** + * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, + * I915_TILING_Y). + * + * This value is to be set on request, and will be updated by the + * kernel on successful return with the actual chosen tiling layout. + * + * The tiling mode may be demoted to I915_TILING_NONE when the system + * has bit 6 swizzling that can't be managed correctly by GEM. + * + * Buffer contents become undefined when changing tiling_mode. + */ + __u32 tiling_mode; + + /** + * Stride in bytes for the object when in I915_TILING_X or + * I915_TILING_Y. + */ + __u32 stride; + + /** + * Returned address bit 6 swizzling required for CPU access through + * mmap mapping. + */ + __u32 swizzle_mode; +}; + +struct drm_i915_gem_get_tiling { + /** Handle of the buffer to get tiling state for. */ + __u32 handle; + + /** + * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, + * I915_TILING_Y). + */ + __u32 tiling_mode; + + /** + * Returned address bit 6 swizzling required for CPU access through + * mmap mapping. + */ + __u32 swizzle_mode; +}; + +struct drm_i915_gem_get_aperture { + /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ + __u64 aper_size; + + /** + * Available space in the aperture used by i915_gem_execbuffer, in + * bytes + */ + __u64 aper_available_size; +}; + +struct drm_i915_get_pipe_from_crtc_id { + /** ID of CRTC being requested **/ + __u32 crtc_id; + + /** pipe of requested CRTC **/ + __u32 pipe; +}; + +#endif /* _I915_DRM_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/mga_drm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/mga_drm.h new file mode 100644 index 0000000..52632bb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/mga_drm.h @@ -0,0 +1,419 @@ +/* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- + * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Jeff Hartmann + * Keith Whitwell + * + * Rewritten by: + * Gareth Hughes + */ + +#ifndef __MGA_DRM_H__ +#define __MGA_DRM_H__ + +#include + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (mga_sarea.h) + */ + +#ifndef __MGA_SAREA_DEFINES__ +#define __MGA_SAREA_DEFINES__ + +/* WARP pipe flags + */ +#define MGA_F 0x1 /* fog */ +#define MGA_A 0x2 /* alpha */ +#define MGA_S 0x4 /* specular */ +#define MGA_T2 0x8 /* multitexture */ + +#define MGA_WARP_TGZ 0 +#define MGA_WARP_TGZF (MGA_F) +#define MGA_WARP_TGZA (MGA_A) +#define MGA_WARP_TGZAF (MGA_F|MGA_A) +#define MGA_WARP_TGZS (MGA_S) +#define MGA_WARP_TGZSF (MGA_S|MGA_F) +#define MGA_WARP_TGZSA (MGA_S|MGA_A) +#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) +#define MGA_WARP_T2GZ (MGA_T2) +#define MGA_WARP_T2GZF (MGA_T2|MGA_F) +#define MGA_WARP_T2GZA (MGA_T2|MGA_A) +#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) +#define MGA_WARP_T2GZS (MGA_T2|MGA_S) +#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) +#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) +#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) + +#define MGA_MAX_G200_PIPES 8 /* no multitex */ +#define MGA_MAX_G400_PIPES 16 +#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES +#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ + +#define MGA_CARD_TYPE_G200 1 +#define MGA_CARD_TYPE_G400 2 +#define MGA_CARD_TYPE_G450 3 /* not currently used */ +#define MGA_CARD_TYPE_G550 4 + +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 + +/* What needs to be changed for the current vertex dma buffer? + */ +#define MGA_UPLOAD_CONTEXT 0x1 +#define MGA_UPLOAD_TEX0 0x2 +#define MGA_UPLOAD_TEX1 0x4 +#define MGA_UPLOAD_PIPE 0x8 +#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ +#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ +#define MGA_UPLOAD_2D 0x40 +#define MGA_WAIT_AGE 0x80 /* handled client-side */ +#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ +#if 0 +#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock + quiescent */ +#endif + +/* 32 buffers of 64k each, total 2 meg. + */ +#define MGA_BUFFER_SIZE (1 << 16) +#define MGA_NUM_BUFFERS 128 + +/* Keep these small for testing. + */ +#define MGA_NR_SAREA_CLIPRECTS 8 + +/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 + * regions, subject to a minimum region size of (1<<16) == 64k. + * + * Clients may subdivide regions internally, but when sharing between + * clients, the region size is the minimum granularity. + */ + +#define MGA_CARD_HEAP 0 +#define MGA_AGP_HEAP 1 +#define MGA_NR_TEX_HEAPS 2 +#define MGA_NR_TEX_REGIONS 16 +#define MGA_LOG_MIN_TEX_REGION_SIZE 16 + +#define DRM_MGA_IDLE_RETRY 2048 + +#endif /* __MGA_SAREA_DEFINES__ */ + +/* Setup registers for 3D context + */ +typedef struct { + unsigned int dstorg; + unsigned int maccess; + unsigned int plnwt; + unsigned int dwgctl; + unsigned int alphactrl; + unsigned int fogcolor; + unsigned int wflag; + unsigned int tdualstage0; + unsigned int tdualstage1; + unsigned int fcol; + unsigned int stencil; + unsigned int stencilctl; +} drm_mga_context_regs_t; + +/* Setup registers for 2D, X server + */ +typedef struct { + unsigned int pitch; +} drm_mga_server_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int texctl; + unsigned int texctl2; + unsigned int texfilter; + unsigned int texbordercol; + unsigned int texorg; + unsigned int texwidth; + unsigned int texheight; + unsigned int texorg1; + unsigned int texorg2; + unsigned int texorg3; + unsigned int texorg4; +} drm_mga_texture_regs_t; + +/* General aging mechanism + */ +typedef struct { + unsigned int head; /* Position of head pointer */ + unsigned int wrap; /* Primary DMA wrap count */ +} drm_mga_age_t; + +typedef struct _drm_mga_sarea { + /* The channel for communication of state information to the kernel + * on firing a vertex dma buffer. + */ + drm_mga_context_regs_t context_state; + drm_mga_server_regs_t server_state; + drm_mga_texture_regs_t tex_state[2]; + unsigned int warp_pipe; + unsigned int dirty; + unsigned int vertsize; + + /* The current cliprects, or a subset thereof. + */ + struct drm_clip_rect boxes[MGA_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Information about the most recently used 3d drawable. The + * client fills in the req_* fields, the server fills in the + * exported_ fields and puts the cliprects into boxes, above. + * + * The client clears the exported_drawable field before + * clobbering the boxes data. + */ + unsigned int req_drawable; /* the X drawable id */ + unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ + + unsigned int exported_drawable; + unsigned int exported_index; + unsigned int exported_stamp; + unsigned int exported_buffers; + unsigned int exported_nfront; + unsigned int exported_nback; + int exported_back_x, exported_front_x, exported_w; + int exported_back_y, exported_front_y, exported_h; + struct drm_clip_rect exported_boxes[MGA_NR_SAREA_CLIPRECTS]; + + /* Counters for aging textures and for client-side throttling. + */ + unsigned int status[4]; + unsigned int last_wrap; + + drm_mga_age_t last_frame; + unsigned int last_enqueue; /* last time a buffer was enqueued */ + unsigned int last_dispatch; /* age of the most recently dispatched buffer */ + unsigned int last_quiescent; /* */ + + /* LRU lists for texture memory in agp space and on the card. + */ + struct drm_tex_region texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1]; + unsigned int texAge[MGA_NR_TEX_HEAPS]; + + /* Mechanism to validate card state. + */ + int ctxOwner; +} drm_mga_sarea_t; + +/* MGA specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_MGA_INIT 0x00 +#define DRM_MGA_FLUSH 0x01 +#define DRM_MGA_RESET 0x02 +#define DRM_MGA_SWAP 0x03 +#define DRM_MGA_CLEAR 0x04 +#define DRM_MGA_VERTEX 0x05 +#define DRM_MGA_INDICES 0x06 +#define DRM_MGA_ILOAD 0x07 +#define DRM_MGA_BLIT 0x08 +#define DRM_MGA_GETPARAM 0x09 + +/* 3.2: + * ioctls for operating on fences. + */ +#define DRM_MGA_SET_FENCE 0x0a +#define DRM_MGA_WAIT_FENCE 0x0b +#define DRM_MGA_DMA_BOOTSTRAP 0x0c + +#define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t) +#define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, drm_lock_t) +#define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET) +#define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP) +#define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t) +#define DRM_IOCTL_MGA_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_VERTEX, drm_mga_vertex_t) +#define DRM_IOCTL_MGA_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INDICES, drm_mga_indices_t) +#define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) +#define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) +#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) +#define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, __u32) +#define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, __u32) +#define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) + +typedef struct _drm_mga_warp_index { + int installed; + unsigned long phys_addr; + int size; +} drm_mga_warp_index_t; + +typedef struct drm_mga_init { + enum { + MGA_INIT_DMA = 0x01, + MGA_CLEANUP_DMA = 0x02 + } func; + + unsigned long sarea_priv_offset; + + int chipset; + int sgram; + + unsigned int maccess; + + unsigned int fb_cpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset, depth_pitch; + + unsigned int texture_offset[MGA_NR_TEX_HEAPS]; + unsigned int texture_size[MGA_NR_TEX_HEAPS]; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long status_offset; + unsigned long warp_offset; + unsigned long primary_offset; + unsigned long buffers_offset; +} drm_mga_init_t; + +typedef struct drm_mga_dma_bootstrap { + /** + * \name AGP texture region + * + * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, these fields will + * be filled in with the actual AGP texture settings. + * + * \warning + * If these fields are non-zero, but dma_mga_dma_bootstrap::agp_mode + * is zero, it means that PCI memory (most likely through the use of + * an IOMMU) is being used for "AGP" textures. + */ + /*@{ */ + unsigned long texture_handle; /**< Handle used to map AGP textures. */ + __u32 texture_size; /**< Size of the AGP texture region. */ + /*@} */ + + /** + * Requested size of the primary DMA region. + * + * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be + * filled in with the actual AGP mode. If AGP was not available + */ + __u32 primary_size; + + /** + * Requested number of secondary DMA buffers. + * + * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be + * filled in with the actual number of secondary DMA buffers + * allocated. Particularly when PCI DMA is used, this may be + * (subtantially) less than the number requested. + */ + __u32 secondary_bin_count; + + /** + * Requested size of each secondary DMA buffer. + * + * While the kernel \b is free to reduce + * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed + * to reduce dma_mga_dma_bootstrap::secondary_bin_size. + */ + __u32 secondary_bin_size; + + /** + * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, + * \c AGPSTAT2_2X, and \c AGPSTAT2_4X are supported. If this value is + * zero, it means that PCI DMA should be used, even if AGP is + * possible. + * + * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be + * filled in with the actual AGP mode. If AGP was not available + * (i.e., PCI DMA was used), this value will be zero. + */ + __u32 agp_mode; + + /** + * Desired AGP GART size, measured in megabytes. + */ + __u8 agp_size; +} drm_mga_dma_bootstrap_t; + +typedef struct drm_mga_clear { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; +} drm_mga_clear_t; + +typedef struct drm_mga_vertex { + int idx; /* buffer to queue */ + int used; /* bytes in use */ + int discard; /* client finished with buffer? */ +} drm_mga_vertex_t; + +typedef struct drm_mga_indices { + int idx; /* buffer to queue */ + unsigned int start; + unsigned int end; + int discard; /* client finished with buffer? */ +} drm_mga_indices_t; + +typedef struct drm_mga_iload { + int idx; + unsigned int dstorg; + unsigned int length; +} drm_mga_iload_t; + +typedef struct _drm_mga_blit { + unsigned int planemask; + unsigned int srcorg; + unsigned int dstorg; + int src_pitch, dst_pitch; + int delta_sx, delta_sy; + int delta_dx, delta_dy; + int height, ydir; /* flip image vertically */ + int source_pitch, dest_pitch; +} drm_mga_blit_t; + +/* 3.1: An ioctl to get parameters that aren't available to the 3d + * client any other way. + */ +#define MGA_PARAM_IRQ_NR 1 + +/* 3.2: Query the actual card type. The DDX only distinguishes between + * G200 chips and non-G200 chips, which it calls G400. It turns out that + * there are some very sublte differences between the G4x0 chips and the G550 + * chips. Using this parameter query, a client-side driver can detect the + * difference between a G4x0 and a G550. + */ +#define MGA_PARAM_CARD_TYPE 2 + +typedef struct drm_mga_getparam { + int param; + void *value; +} drm_mga_getparam_t; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/r128_drm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/r128_drm.h new file mode 100644 index 0000000..ede78ff --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/r128_drm.h @@ -0,0 +1,326 @@ +/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- + * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com + */ +/* + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes + * Kevin E. Martin + */ + +#ifndef __R128_DRM_H__ +#define __R128_DRM_H__ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the X server file (r128_sarea.h) + */ +#ifndef __R128_SAREA_DEFINES__ +#define __R128_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? + */ +#define R128_UPLOAD_CONTEXT 0x001 +#define R128_UPLOAD_SETUP 0x002 +#define R128_UPLOAD_TEX0 0x004 +#define R128_UPLOAD_TEX1 0x008 +#define R128_UPLOAD_TEX0IMAGES 0x010 +#define R128_UPLOAD_TEX1IMAGES 0x020 +#define R128_UPLOAD_CORE 0x040 +#define R128_UPLOAD_MASKS 0x080 +#define R128_UPLOAD_WINDOW 0x100 +#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ +#define R128_REQUIRE_QUIESCENCE 0x400 +#define R128_UPLOAD_ALL 0x7ff + +#define R128_FRONT 0x1 +#define R128_BACK 0x2 +#define R128_DEPTH 0x4 + +/* Primitive types + */ +#define R128_POINTS 0x1 +#define R128_LINES 0x2 +#define R128_LINE_STRIP 0x3 +#define R128_TRIANGLES 0x4 +#define R128_TRIANGLE_FAN 0x5 +#define R128_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#define R128_BUFFER_SIZE 16384 + +/* Byte offsets for indirect buffer data + */ +#define R128_INDEX_PRIM_OFFSET 20 +#define R128_HOSTDATA_BLIT_OFFSET 32 + +/* Keep these small for testing. + */ +#define R128_NR_SAREA_CLIPRECTS 12 + +/* There are 2 heaps (local/AGP). Each region within a heap is a + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define R128_LOCAL_TEX_HEAP 0 +#define R128_AGP_TEX_HEAP 1 +#define R128_NR_TEX_HEAPS 2 +#define R128_NR_TEX_REGIONS 64 +#define R128_LOG_TEX_GRANULARITY 16 + +#define R128_NR_CONTEXT_REGS 12 + +#define R128_MAX_TEXTURE_LEVELS 11 +#define R128_MAX_TEXTURE_UNITS 2 + +#endif /* __R128_SAREA_DEFINES__ */ + +typedef struct { + /* Context state - can be written in one large chunk */ + unsigned int dst_pitch_offset_c; + unsigned int dp_gui_master_cntl_c; + unsigned int sc_top_left_c; + unsigned int sc_bottom_right_c; + unsigned int z_offset_c; + unsigned int z_pitch_c; + unsigned int z_sten_cntl_c; + unsigned int tex_cntl_c; + unsigned int misc_3d_state_cntl_reg; + unsigned int texture_clr_cmp_clr_c; + unsigned int texture_clr_cmp_msk_c; + unsigned int fog_color_c; + + /* Texture state */ + unsigned int tex_size_pitch_c; + unsigned int constant_color_c; + + /* Setup state */ + unsigned int pm4_vc_fpu_setup; + unsigned int setup_cntl; + + /* Mask state */ + unsigned int dp_write_mask; + unsigned int sten_ref_mask_c; + unsigned int plane_3d_mask_c; + + /* Window state */ + unsigned int window_xy_offset; + + /* Core state */ + unsigned int scale_3d_cntl; +} drm_r128_context_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int tex_cntl; + unsigned int tex_combine_cntl; + unsigned int tex_size_pitch; + unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; + unsigned int tex_border_color; +} drm_r128_texture_regs_t; + +typedef struct drm_r128_sarea { + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + drm_r128_context_regs_t context_state; + drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof. + */ + struct drm_clip_rect boxes[R128_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for client-side throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + + struct drm_tex_region tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS + 1]; + unsigned int tex_age[R128_NR_TEX_HEAPS]; + int ctx_owner; + int pfAllowPageFlip; /* number of 3d windows (0,1,2 or more) */ + int pfCurrentPage; /* which buffer is being displayed? */ +} drm_r128_sarea_t; + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmR128.h) + */ + +/* Rage 128 specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_R128_INIT 0x00 +#define DRM_R128_CCE_START 0x01 +#define DRM_R128_CCE_STOP 0x02 +#define DRM_R128_CCE_RESET 0x03 +#define DRM_R128_CCE_IDLE 0x04 +/* 0x05 not used */ +#define DRM_R128_RESET 0x06 +#define DRM_R128_SWAP 0x07 +#define DRM_R128_CLEAR 0x08 +#define DRM_R128_VERTEX 0x09 +#define DRM_R128_INDICES 0x0a +#define DRM_R128_BLIT 0x0b +#define DRM_R128_DEPTH 0x0c +#define DRM_R128_STIPPLE 0x0d +/* 0x0e not used */ +#define DRM_R128_INDIRECT 0x0f +#define DRM_R128_FULLSCREEN 0x10 +#define DRM_R128_CLEAR2 0x11 +#define DRM_R128_GETPARAM 0x12 +#define DRM_R128_FLIP 0x13 + +#define DRM_IOCTL_R128_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INIT, drm_r128_init_t) +#define DRM_IOCTL_R128_CCE_START DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_START) +#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CCE_STOP, drm_r128_cce_stop_t) +#define DRM_IOCTL_R128_CCE_RESET DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_RESET) +#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_R128_CCE_IDLE) +/* 0x05 not used */ +#define DRM_IOCTL_R128_RESET DRM_IO( DRM_COMMAND_BASE + DRM_R128_RESET) +#define DRM_IOCTL_R128_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_R128_SWAP) +#define DRM_IOCTL_R128_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR, drm_r128_clear_t) +#define DRM_IOCTL_R128_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_R128_VERTEX, drm_r128_vertex_t) +#define DRM_IOCTL_R128_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INDICES, drm_r128_indices_t) +#define DRM_IOCTL_R128_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_R128_BLIT, drm_r128_blit_t) +#define DRM_IOCTL_R128_DEPTH DRM_IOW( DRM_COMMAND_BASE + DRM_R128_DEPTH, drm_r128_depth_t) +#define DRM_IOCTL_R128_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_R128_STIPPLE, drm_r128_stipple_t) +/* 0x0e not used */ +#define DRM_IOCTL_R128_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_R128_INDIRECT, drm_r128_indirect_t) +#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_R128_FULLSCREEN, drm_r128_fullscreen_t) +#define DRM_IOCTL_R128_CLEAR2 DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR2, drm_r128_clear2_t) +#define DRM_IOCTL_R128_GETPARAM DRM_IOWR( DRM_COMMAND_BASE + DRM_R128_GETPARAM, drm_r128_getparam_t) +#define DRM_IOCTL_R128_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_R128_FLIP) + +typedef struct drm_r128_init { + enum { + R128_INIT_CCE = 0x01, + R128_CLEANUP_CCE = 0x02 + } func; + unsigned long sarea_priv_offset; + int is_pci; + int cce_mode; + int cce_secure; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + unsigned int span_offset; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; +} drm_r128_init_t; + +typedef struct drm_r128_cce_stop { + int flush; + int idle; +} drm_r128_cce_stop_t; + +typedef struct drm_r128_clear { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; +} drm_r128_clear_t; + +typedef struct drm_r128_vertex { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drm_r128_vertex_t; + +typedef struct drm_r128_indices { + int prim; + int idx; + int start; + int end; + int discard; /* Client finished with buffer? */ +} drm_r128_indices_t; + +typedef struct drm_r128_blit { + int idx; + int pitch; + int offset; + int format; + unsigned short x, y; + unsigned short width, height; +} drm_r128_blit_t; + +typedef struct drm_r128_depth { + enum { + R128_WRITE_SPAN = 0x01, + R128_WRITE_PIXELS = 0x02, + R128_READ_SPAN = 0x03, + R128_READ_PIXELS = 0x04 + } func; + int n; + int *x; + int *y; + unsigned int *buffer; + unsigned char *mask; +} drm_r128_depth_t; + +typedef struct drm_r128_stipple { + unsigned int *mask; +} drm_r128_stipple_t; + +typedef struct drm_r128_indirect { + int idx; + int start; + int end; + int discard; +} drm_r128_indirect_t; + +typedef struct drm_r128_fullscreen { + enum { + R128_INIT_FULLSCREEN = 0x01, + R128_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_r128_fullscreen_t; + +/* 2.3: An ioctl to get parameters that aren't available to the 3d + * client any other way. + */ +#define R128_PARAM_IRQ_NR 1 + +typedef struct drm_r128_getparam { + int param; + void *value; +} drm_r128_getparam_t; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/radeon_drm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/radeon_drm.h new file mode 100644 index 0000000..15aed8e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/radeon_drm.h @@ -0,0 +1,754 @@ +/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Kevin E. Martin + * Gareth Hughes + * Keith Whitwell + */ + +#ifndef __RADEON_DRM_H__ +#define __RADEON_DRM_H__ + +#include + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the X server file (radeon_sarea.h) + */ +#ifndef __RADEON_SAREA_DEFINES__ +#define __RADEON_SAREA_DEFINES__ + +/* Old style state flags, required for sarea interface (1.1 and 1.2 + * clears) and 1.2 drm_vertex2 ioctl. + */ +#define RADEON_UPLOAD_CONTEXT 0x00000001 +#define RADEON_UPLOAD_VERTFMT 0x00000002 +#define RADEON_UPLOAD_LINE 0x00000004 +#define RADEON_UPLOAD_BUMPMAP 0x00000008 +#define RADEON_UPLOAD_MASKS 0x00000010 +#define RADEON_UPLOAD_VIEWPORT 0x00000020 +#define RADEON_UPLOAD_SETUP 0x00000040 +#define RADEON_UPLOAD_TCL 0x00000080 +#define RADEON_UPLOAD_MISC 0x00000100 +#define RADEON_UPLOAD_TEX0 0x00000200 +#define RADEON_UPLOAD_TEX1 0x00000400 +#define RADEON_UPLOAD_TEX2 0x00000800 +#define RADEON_UPLOAD_TEX0IMAGES 0x00001000 +#define RADEON_UPLOAD_TEX1IMAGES 0x00002000 +#define RADEON_UPLOAD_TEX2IMAGES 0x00004000 +#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ +#define RADEON_REQUIRE_QUIESCENCE 0x00010000 +#define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */ +#define RADEON_UPLOAD_ALL 0x003effff +#define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff + +/* New style per-packet identifiers for use in cmd_buffer ioctl with + * the RADEON_EMIT_PACKET command. Comments relate new packets to old + * state bits and the packet size: + */ +#define RADEON_EMIT_PP_MISC 0 /* context/7 */ +#define RADEON_EMIT_PP_CNTL 1 /* context/3 */ +#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ +#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ +#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ +#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ +#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ +#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ +#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ +#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ +#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ +#define RADEON_EMIT_RE_MISC 11 /* misc/1 */ +#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ +#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ +#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ +#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ +#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ +#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ +#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ +#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ +#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ +#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ +#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ +#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ +#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ +#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ +#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */ +#define R200_EMIT_TFACTOR_0 30 /* tf/7 */ +#define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */ +#define R200_EMIT_VAP_CTL 32 /* vap/1 */ +#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ +#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ +#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ +#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ +#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ +#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ +#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ +#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ +#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ +#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ +#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ +#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ +#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ +#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ +#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ +#define R200_EMIT_VTE_CNTL 48 /* vte/1 */ +#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ +#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ +#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ +#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ +#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ +#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ +#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ +#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ +#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ +#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ +#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ +#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ +#define R200_EMIT_PP_CUBIC_FACES_0 61 +#define R200_EMIT_PP_CUBIC_OFFSETS_0 62 +#define R200_EMIT_PP_CUBIC_FACES_1 63 +#define R200_EMIT_PP_CUBIC_OFFSETS_1 64 +#define R200_EMIT_PP_CUBIC_FACES_2 65 +#define R200_EMIT_PP_CUBIC_OFFSETS_2 66 +#define R200_EMIT_PP_CUBIC_FACES_3 67 +#define R200_EMIT_PP_CUBIC_OFFSETS_3 68 +#define R200_EMIT_PP_CUBIC_FACES_4 69 +#define R200_EMIT_PP_CUBIC_OFFSETS_4 70 +#define R200_EMIT_PP_CUBIC_FACES_5 71 +#define R200_EMIT_PP_CUBIC_OFFSETS_5 72 +#define RADEON_EMIT_PP_TEX_SIZE_0 73 +#define RADEON_EMIT_PP_TEX_SIZE_1 74 +#define RADEON_EMIT_PP_TEX_SIZE_2 75 +#define R200_EMIT_RB3D_BLENDCOLOR 76 +#define R200_EMIT_TCL_POINT_SPRITE_CNTL 77 +#define RADEON_EMIT_PP_CUBIC_FACES_0 78 +#define RADEON_EMIT_PP_CUBIC_OFFSETS_T0 79 +#define RADEON_EMIT_PP_CUBIC_FACES_1 80 +#define RADEON_EMIT_PP_CUBIC_OFFSETS_T1 81 +#define RADEON_EMIT_PP_CUBIC_FACES_2 82 +#define RADEON_EMIT_PP_CUBIC_OFFSETS_T2 83 +#define R200_EMIT_PP_TRI_PERF_CNTL 84 +#define R200_EMIT_PP_AFS_0 85 +#define R200_EMIT_PP_AFS_1 86 +#define R200_EMIT_ATF_TFACTOR 87 +#define R200_EMIT_PP_TXCTLALL_0 88 +#define R200_EMIT_PP_TXCTLALL_1 89 +#define R200_EMIT_PP_TXCTLALL_2 90 +#define R200_EMIT_PP_TXCTLALL_3 91 +#define R200_EMIT_PP_TXCTLALL_4 92 +#define R200_EMIT_PP_TXCTLALL_5 93 +#define R200_EMIT_VAP_PVS_CNTL 94 +#define RADEON_MAX_STATE_PACKETS 95 + +/* Commands understood by cmd_buffer ioctl. More can be added but + * obviously these can't be removed or changed: + */ +#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ +#define RADEON_CMD_SCALARS 2 /* emit scalar data */ +#define RADEON_CMD_VECTORS 3 /* emit vector data */ +#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ +#define RADEON_CMD_PACKET3 5 /* emit hw packet */ +#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ +#define RADEON_CMD_SCALARS2 7 /* r200 stopgap */ +#define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note: + * doesn't make the cpu wait, just + * the graphics hardware */ +#define RADEON_CMD_VECLINEAR 9 /* another r200 stopgap */ + +typedef union { + int i; + struct { + unsigned char cmd_type, pad0, pad1, pad2; + } header; + struct { + unsigned char cmd_type, packet_id, pad0, pad1; + } packet; + struct { + unsigned char cmd_type, offset, stride, count; + } scalars; + struct { + unsigned char cmd_type, offset, stride, count; + } vectors; + struct { + unsigned char cmd_type, addr_lo, addr_hi, count; + } veclinear; + struct { + unsigned char cmd_type, buf_idx, pad0, pad1; + } dma; + struct { + unsigned char cmd_type, flags, pad0, pad1; + } wait; +} drm_radeon_cmd_header_t; + +#define RADEON_WAIT_2D 0x1 +#define RADEON_WAIT_3D 0x2 + +/* Allowed parameters for R300_CMD_PACKET3 + */ +#define R300_CMD_PACKET3_CLEAR 0 +#define R300_CMD_PACKET3_RAW 1 + +/* Commands understood by cmd_buffer ioctl for R300. + * The interface has not been stabilized, so some of these may be removed + * and eventually reordered before stabilization. + */ +#define R300_CMD_PACKET0 1 +#define R300_CMD_VPU 2 /* emit vertex program upload */ +#define R300_CMD_PACKET3 3 /* emit a packet3 */ +#define R300_CMD_END3D 4 /* emit sequence ending 3d rendering */ +#define R300_CMD_CP_DELAY 5 +#define R300_CMD_DMA_DISCARD 6 +#define R300_CMD_WAIT 7 +# define R300_WAIT_2D 0x1 +# define R300_WAIT_3D 0x2 +/* these two defines are DOING IT WRONG - however + * we have userspace which relies on using these. + * The wait interface is backwards compat new + * code should use the NEW_WAIT defines below + * THESE ARE NOT BIT FIELDS + */ +# define R300_WAIT_2D_CLEAN 0x3 +# define R300_WAIT_3D_CLEAN 0x4 + +# define R300_NEW_WAIT_2D_3D 0x3 +# define R300_NEW_WAIT_2D_2D_CLEAN 0x4 +# define R300_NEW_WAIT_3D_3D_CLEAN 0x6 +# define R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN 0x8 + +#define R300_CMD_SCRATCH 8 +#define R300_CMD_R500FP 9 + +typedef union { + unsigned int u; + struct { + unsigned char cmd_type, pad0, pad1, pad2; + } header; + struct { + unsigned char cmd_type, count, reglo, reghi; + } packet0; + struct { + unsigned char cmd_type, count, adrlo, adrhi; + } vpu; + struct { + unsigned char cmd_type, packet, pad0, pad1; + } packet3; + struct { + unsigned char cmd_type, packet; + unsigned short count; /* amount of packet2 to emit */ + } delay; + struct { + unsigned char cmd_type, buf_idx, pad0, pad1; + } dma; + struct { + unsigned char cmd_type, flags, pad0, pad1; + } wait; + struct { + unsigned char cmd_type, reg, n_bufs, flags; + } scratch; + struct { + unsigned char cmd_type, count, adrlo, adrhi_flags; + } r500fp; +} drm_r300_cmd_header_t; + +#define RADEON_FRONT 0x1 +#define RADEON_BACK 0x2 +#define RADEON_DEPTH 0x4 +#define RADEON_STENCIL 0x8 +#define RADEON_CLEAR_FASTZ 0x80000000 +#define RADEON_USE_HIERZ 0x40000000 +#define RADEON_USE_COMP_ZBUF 0x20000000 + +#define R500FP_CONSTANT_TYPE (1 << 1) +#define R500FP_CONSTANT_CLAMP (1 << 2) + +/* Primitive types + */ +#define RADEON_POINTS 0x1 +#define RADEON_LINES 0x2 +#define RADEON_LINE_STRIP 0x3 +#define RADEON_TRIANGLES 0x4 +#define RADEON_TRIANGLE_FAN 0x5 +#define RADEON_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#define RADEON_BUFFER_SIZE 65536 + +/* Byte offsets for indirect buffer data + */ +#define RADEON_INDEX_PRIM_OFFSET 20 + +#define RADEON_SCRATCH_REG_OFFSET 32 + +#define R600_SCRATCH_REG_OFFSET 256 + +#define RADEON_NR_SAREA_CLIPRECTS 12 + +/* There are 2 heaps (local/GART). Each region within a heap is a + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define RADEON_LOCAL_TEX_HEAP 0 +#define RADEON_GART_TEX_HEAP 1 +#define RADEON_NR_TEX_HEAPS 2 +#define RADEON_NR_TEX_REGIONS 64 +#define RADEON_LOG_TEX_GRANULARITY 16 + +#define RADEON_MAX_TEXTURE_LEVELS 12 +#define RADEON_MAX_TEXTURE_UNITS 3 + +#define RADEON_MAX_SURFACES 8 + +/* Blits have strict offset rules. All blit offset must be aligned on + * a 1K-byte boundary. + */ +#define RADEON_OFFSET_SHIFT 10 +#define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT) +#define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1) + +#endif /* __RADEON_SAREA_DEFINES__ */ + +typedef struct { + unsigned int red; + unsigned int green; + unsigned int blue; + unsigned int alpha; +} radeon_color_regs_t; + +typedef struct { + /* Context state */ + unsigned int pp_misc; /* 0x1c14 */ + unsigned int pp_fog_color; + unsigned int re_solid_color; + unsigned int rb3d_blendcntl; + unsigned int rb3d_depthoffset; + unsigned int rb3d_depthpitch; + unsigned int rb3d_zstencilcntl; + + unsigned int pp_cntl; /* 0x1c38 */ + unsigned int rb3d_cntl; + unsigned int rb3d_coloroffset; + unsigned int re_width_height; + unsigned int rb3d_colorpitch; + unsigned int se_cntl; + + /* Vertex format state */ + unsigned int se_coord_fmt; /* 0x1c50 */ + + /* Line state */ + unsigned int re_line_pattern; /* 0x1cd0 */ + unsigned int re_line_state; + + unsigned int se_line_width; /* 0x1db8 */ + + /* Bumpmap state */ + unsigned int pp_lum_matrix; /* 0x1d00 */ + + unsigned int pp_rot_matrix_0; /* 0x1d58 */ + unsigned int pp_rot_matrix_1; + + /* Mask state */ + unsigned int rb3d_stencilrefmask; /* 0x1d7c */ + unsigned int rb3d_ropcntl; + unsigned int rb3d_planemask; + + /* Viewport state */ + unsigned int se_vport_xscale; /* 0x1d98 */ + unsigned int se_vport_xoffset; + unsigned int se_vport_yscale; + unsigned int se_vport_yoffset; + unsigned int se_vport_zscale; + unsigned int se_vport_zoffset; + + /* Setup state */ + unsigned int se_cntl_status; /* 0x2140 */ + + /* Misc state */ + unsigned int re_top_left; /* 0x26c0 */ + unsigned int re_misc; +} drm_radeon_context_regs_t; + +typedef struct { + /* Zbias state */ + unsigned int se_zbias_factor; /* 0x1dac */ + unsigned int se_zbias_constant; +} drm_radeon_context2_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int pp_txfilter; + unsigned int pp_txformat; + unsigned int pp_txoffset; + unsigned int pp_txcblend; + unsigned int pp_txablend; + unsigned int pp_tfactor; + unsigned int pp_border_color; +} drm_radeon_texture_regs_t; + +typedef struct { + unsigned int start; + unsigned int finish; + unsigned int prim:8; + unsigned int stateidx:8; + unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ + unsigned int vc_format; /* vertex format */ +} drm_radeon_prim_t; + +typedef struct { + drm_radeon_context_regs_t context; + drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS]; + drm_radeon_context2_regs_t context2; + unsigned int dirty; +} drm_radeon_state_t; + +typedef struct { + /* The channel for communication of state information to the + * kernel on firing a vertex buffer with either of the + * obsoleted vertex/index ioctls. + */ + drm_radeon_context_regs_t context_state; + drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof. + */ + struct drm_clip_rect boxes[RADEON_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for client-side throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + unsigned int last_clear; + + struct drm_tex_region tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS + + 1]; + unsigned int tex_age[RADEON_NR_TEX_HEAPS]; + int ctx_owner; + int pfState; /* number of 3d windows (0,1,2ormore) */ + int pfCurrentPage; /* which buffer is being displayed? */ + int crtc2_base; /* CRTC2 frame offset */ + int tiling_enabled; /* set by drm, read by 2d + 3d clients */ +} drm_radeon_sarea_t; + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmRadeon.h) + * + * KW: actually it's illegal to change any of this (backwards compatibility). + */ + +/* Radeon specific ioctls + * The device specific ioctl range is 0x40 to 0x79. + */ +#define DRM_RADEON_CP_INIT 0x00 +#define DRM_RADEON_CP_START 0x01 +#define DRM_RADEON_CP_STOP 0x02 +#define DRM_RADEON_CP_RESET 0x03 +#define DRM_RADEON_CP_IDLE 0x04 +#define DRM_RADEON_RESET 0x05 +#define DRM_RADEON_FULLSCREEN 0x06 +#define DRM_RADEON_SWAP 0x07 +#define DRM_RADEON_CLEAR 0x08 +#define DRM_RADEON_VERTEX 0x09 +#define DRM_RADEON_INDICES 0x0A +#define DRM_RADEON_NOT_USED +#define DRM_RADEON_STIPPLE 0x0C +#define DRM_RADEON_INDIRECT 0x0D +#define DRM_RADEON_TEXTURE 0x0E +#define DRM_RADEON_VERTEX2 0x0F +#define DRM_RADEON_CMDBUF 0x10 +#define DRM_RADEON_GETPARAM 0x11 +#define DRM_RADEON_FLIP 0x12 +#define DRM_RADEON_ALLOC 0x13 +#define DRM_RADEON_FREE 0x14 +#define DRM_RADEON_INIT_HEAP 0x15 +#define DRM_RADEON_IRQ_EMIT 0x16 +#define DRM_RADEON_IRQ_WAIT 0x17 +#define DRM_RADEON_CP_RESUME 0x18 +#define DRM_RADEON_SETPARAM 0x19 +#define DRM_RADEON_SURF_ALLOC 0x1a +#define DRM_RADEON_SURF_FREE 0x1b + +#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) +#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) +#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t) +#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET) +#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE) +#define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET) +#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t) +#define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP) +#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t) +#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t) +#define DRM_IOCTL_RADEON_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t) +#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t) +#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t) +#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t) +#define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t) +#define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t) +#define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t) +#define DRM_IOCTL_RADEON_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_FLIP) +#define DRM_IOCTL_RADEON_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t) +#define DRM_IOCTL_RADEON_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t) +#define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t) +#define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t) +#define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t) +#define DRM_IOCTL_RADEON_CP_RESUME DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME) +#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) +#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) +#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) + +typedef struct drm_radeon_init { + enum { + RADEON_INIT_CP = 0x01, + RADEON_CLEANUP_CP = 0x02, + RADEON_INIT_R200_CP = 0x03, + RADEON_INIT_R300_CP = 0x04, + RADEON_INIT_R600_CP = 0x05 + } func; + unsigned long sarea_priv_offset; + int is_pci; + int cp_mode; + int gart_size; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long gart_textures_offset; +} drm_radeon_init_t; + +typedef struct drm_radeon_cp_stop { + int flush; + int idle; +} drm_radeon_cp_stop_t; + +typedef struct drm_radeon_fullscreen { + enum { + RADEON_INIT_FULLSCREEN = 0x01, + RADEON_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_radeon_fullscreen_t; + +#define CLEAR_X1 0 +#define CLEAR_Y1 1 +#define CLEAR_X2 2 +#define CLEAR_Y2 3 +#define CLEAR_DEPTH 4 + +typedef union drm_radeon_clear_rect { + float f[5]; + unsigned int ui[5]; +} drm_radeon_clear_rect_t; + +typedef struct drm_radeon_clear { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; /* misnamed field: should be stencil */ + drm_radeon_clear_rect_t *depth_boxes; +} drm_radeon_clear_t; + +typedef struct drm_radeon_vertex { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drm_radeon_vertex_t; + +typedef struct drm_radeon_indices { + int prim; + int idx; + int start; + int end; + int discard; /* Client finished with buffer? */ +} drm_radeon_indices_t; + +/* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices + * - allows multiple primitives and state changes in a single ioctl + * - supports driver change to emit native primitives + */ +typedef struct drm_radeon_vertex2 { + int idx; /* Index of vertex buffer */ + int discard; /* Client finished with buffer? */ + int nr_states; + drm_radeon_state_t *state; + int nr_prims; + drm_radeon_prim_t *prim; +} drm_radeon_vertex2_t; + +/* v1.3 - obsoletes drm_radeon_vertex2 + * - allows arbitarily large cliprect list + * - allows updating of tcl packet, vector and scalar state + * - allows memory-efficient description of state updates + * - allows state to be emitted without a primitive + * (for clears, ctx switches) + * - allows more than one dma buffer to be referenced per ioctl + * - supports tcl driver + * - may be extended in future versions with new cmd types, packets + */ +typedef struct drm_radeon_cmd_buffer { + int bufsz; + char *buf; + int nbox; + struct drm_clip_rect *boxes; +} drm_radeon_cmd_buffer_t; + +typedef struct drm_radeon_tex_image { + unsigned int x, y; /* Blit coordinates */ + unsigned int width, height; + const void *data; +} drm_radeon_tex_image_t; + +typedef struct drm_radeon_texture { + unsigned int offset; + int pitch; + int format; + int width; /* Texture image coordinates */ + int height; + drm_radeon_tex_image_t *image; +} drm_radeon_texture_t; + +typedef struct drm_radeon_stipple { + unsigned int *mask; +} drm_radeon_stipple_t; + +typedef struct drm_radeon_indirect { + int idx; + int start; + int end; + int discard; +} drm_radeon_indirect_t; + +/* enum for card type parameters */ +#define RADEON_CARD_PCI 0 +#define RADEON_CARD_AGP 1 +#define RADEON_CARD_PCIE 2 + +/* 1.3: An ioctl to get parameters that aren't available to the 3d + * client any other way. + */ +#define RADEON_PARAM_GART_BUFFER_OFFSET 1 /* card offset of 1st GART buffer */ +#define RADEON_PARAM_LAST_FRAME 2 +#define RADEON_PARAM_LAST_DISPATCH 3 +#define RADEON_PARAM_LAST_CLEAR 4 +/* Added with DRM version 1.6. */ +#define RADEON_PARAM_IRQ_NR 5 +#define RADEON_PARAM_GART_BASE 6 /* card offset of GART base */ +/* Added with DRM version 1.8. */ +#define RADEON_PARAM_REGISTER_HANDLE 7 /* for drmMap() */ +#define RADEON_PARAM_STATUS_HANDLE 8 +#define RADEON_PARAM_SAREA_HANDLE 9 +#define RADEON_PARAM_GART_TEX_HANDLE 10 +#define RADEON_PARAM_SCRATCH_OFFSET 11 +#define RADEON_PARAM_CARD_TYPE 12 +#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ +#define RADEON_PARAM_FB_LOCATION 14 /* FB location */ +#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ + +typedef struct drm_radeon_getparam { + int param; + void *value; +} drm_radeon_getparam_t; + +/* 1.6: Set up a memory manager for regions of shared memory: + */ +#define RADEON_MEM_REGION_GART 1 +#define RADEON_MEM_REGION_FB 2 + +typedef struct drm_radeon_mem_alloc { + int region; + int alignment; + int size; + int *region_offset; /* offset from start of fb or GART */ +} drm_radeon_mem_alloc_t; + +typedef struct drm_radeon_mem_free { + int region; + int region_offset; +} drm_radeon_mem_free_t; + +typedef struct drm_radeon_mem_init_heap { + int region; + int size; + int start; +} drm_radeon_mem_init_heap_t; + +/* 1.6: Userspace can request & wait on irq's: + */ +typedef struct drm_radeon_irq_emit { + int *irq_seq; +} drm_radeon_irq_emit_t; + +typedef struct drm_radeon_irq_wait { + int irq_seq; +} drm_radeon_irq_wait_t; + +/* 1.10: Clients tell the DRM where they think the framebuffer is located in + * the card's address space, via a new generic ioctl to set parameters + */ + +typedef struct drm_radeon_setparam { + unsigned int param; + __s64 value; +} drm_radeon_setparam_t; + +#define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */ +#define RADEON_SETPARAM_SWITCH_TILING 2 /* enable/disable color tiling */ +#define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */ +#define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */ +#define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */ +#define RADEON_SETPARAM_VBLANK_CRTC 6 /* VBLANK CRTC */ +/* 1.14: Clients can allocate/free a surface + */ +typedef struct drm_radeon_surface_alloc { + unsigned int address; + unsigned int size; + unsigned int flags; +} drm_radeon_surface_alloc_t; + +typedef struct drm_radeon_surface_free { + unsigned int address; +} drm_radeon_surface_free_t; + +#define DRM_RADEON_VBLANK_CRTC1 1 +#define DRM_RADEON_VBLANK_CRTC2 2 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/savage_drm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/savage_drm.h new file mode 100644 index 0000000..f7a75ef --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/savage_drm.h @@ -0,0 +1,210 @@ +/* savage_drm.h -- Public header for the savage driver + * + * Copyright 2004 Felix Kuehling + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL FELIX KUEHLING BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __SAVAGE_DRM_H__ +#define __SAVAGE_DRM_H__ + +#ifndef __SAVAGE_SAREA_DEFINES__ +#define __SAVAGE_SAREA_DEFINES__ + +/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 + * regions, subject to a minimum region size of (1<<16) == 64k. + * + * Clients may subdivide regions internally, but when sharing between + * clients, the region size is the minimum granularity. + */ + +#define SAVAGE_CARD_HEAP 0 +#define SAVAGE_AGP_HEAP 1 +#define SAVAGE_NR_TEX_HEAPS 2 +#define SAVAGE_NR_TEX_REGIONS 16 +#define SAVAGE_LOG_MIN_TEX_REGION_SIZE 16 + +#endif /* __SAVAGE_SAREA_DEFINES__ */ + +typedef struct _drm_savage_sarea { + /* LRU lists for texture memory in agp space and on the card. + */ + struct drm_tex_region texList[SAVAGE_NR_TEX_HEAPS][SAVAGE_NR_TEX_REGIONS + + 1]; + unsigned int texAge[SAVAGE_NR_TEX_HEAPS]; + + /* Mechanism to validate card state. + */ + int ctxOwner; +} drm_savage_sarea_t, *drm_savage_sarea_ptr; + +/* Savage-specific ioctls + */ +#define DRM_SAVAGE_BCI_INIT 0x00 +#define DRM_SAVAGE_BCI_CMDBUF 0x01 +#define DRM_SAVAGE_BCI_EVENT_EMIT 0x02 +#define DRM_SAVAGE_BCI_EVENT_WAIT 0x03 + +#define DRM_IOCTL_SAVAGE_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_INIT, drm_savage_init_t) +#define DRM_IOCTL_SAVAGE_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_CMDBUF, drm_savage_cmdbuf_t) +#define DRM_IOCTL_SAVAGE_EVENT_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_EMIT, drm_savage_event_emit_t) +#define DRM_IOCTL_SAVAGE_EVENT_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_WAIT, drm_savage_event_wait_t) + +#define SAVAGE_DMA_PCI 1 +#define SAVAGE_DMA_AGP 3 +typedef struct drm_savage_init { + enum { + SAVAGE_INIT_BCI = 1, + SAVAGE_CLEANUP_BCI = 2 + } func; + unsigned int sarea_priv_offset; + + /* some parameters */ + unsigned int cob_size; + unsigned int bci_threshold_lo, bci_threshold_hi; + unsigned int dma_type; + + /* frame buffer layout */ + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + /* local textures */ + unsigned int texture_offset; + unsigned int texture_size; + + /* physical locations of non-permanent maps */ + unsigned long status_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; + unsigned long cmd_dma_offset; +} drm_savage_init_t; + +typedef union drm_savage_cmd_header drm_savage_cmd_header_t; +typedef struct drm_savage_cmdbuf { + /* command buffer in client's address space */ + drm_savage_cmd_header_t *cmd_addr; + unsigned int size; /* size of the command buffer in 64bit units */ + + unsigned int dma_idx; /* DMA buffer index to use */ + int discard; /* discard DMA buffer when done */ + /* vertex buffer in client's address space */ + unsigned int *vb_addr; + unsigned int vb_size; /* size of client vertex buffer in bytes */ + unsigned int vb_stride; /* stride of vertices in 32bit words */ + /* boxes in client's address space */ + struct drm_clip_rect *box_addr; + unsigned int nbox; /* number of clipping boxes */ +} drm_savage_cmdbuf_t; + +#define SAVAGE_WAIT_2D 0x1 /* wait for 2D idle before updating event tag */ +#define SAVAGE_WAIT_3D 0x2 /* wait for 3D idle before updating event tag */ +#define SAVAGE_WAIT_IRQ 0x4 /* emit or wait for IRQ, not implemented yet */ +typedef struct drm_savage_event { + unsigned int count; + unsigned int flags; +} drm_savage_event_emit_t, drm_savage_event_wait_t; + +/* Commands for the cmdbuf ioctl + */ +#define SAVAGE_CMD_STATE 0 /* a range of state registers */ +#define SAVAGE_CMD_DMA_PRIM 1 /* vertices from DMA buffer */ +#define SAVAGE_CMD_VB_PRIM 2 /* vertices from client vertex buffer */ +#define SAVAGE_CMD_DMA_IDX 3 /* indexed vertices from DMA buffer */ +#define SAVAGE_CMD_VB_IDX 4 /* indexed vertices client vertex buffer */ +#define SAVAGE_CMD_CLEAR 5 /* clear buffers */ +#define SAVAGE_CMD_SWAP 6 /* swap buffers */ + +/* Primitive types +*/ +#define SAVAGE_PRIM_TRILIST 0 /* triangle list */ +#define SAVAGE_PRIM_TRISTRIP 1 /* triangle strip */ +#define SAVAGE_PRIM_TRIFAN 2 /* triangle fan */ +#define SAVAGE_PRIM_TRILIST_201 3 /* reorder verts for correct flat + * shading on s3d */ + +/* Skip flags (vertex format) + */ +#define SAVAGE_SKIP_Z 0x01 +#define SAVAGE_SKIP_W 0x02 +#define SAVAGE_SKIP_C0 0x04 +#define SAVAGE_SKIP_C1 0x08 +#define SAVAGE_SKIP_S0 0x10 +#define SAVAGE_SKIP_T0 0x20 +#define SAVAGE_SKIP_ST0 0x30 +#define SAVAGE_SKIP_S1 0x40 +#define SAVAGE_SKIP_T1 0x80 +#define SAVAGE_SKIP_ST1 0xc0 +#define SAVAGE_SKIP_ALL_S3D 0x3f +#define SAVAGE_SKIP_ALL_S4 0xff + +/* Buffer names for clear command + */ +#define SAVAGE_FRONT 0x1 +#define SAVAGE_BACK 0x2 +#define SAVAGE_DEPTH 0x4 + +/* 64-bit command header + */ +union drm_savage_cmd_header { + struct { + unsigned char cmd; /* command */ + unsigned char pad0; + unsigned short pad1; + unsigned short pad2; + unsigned short pad3; + } cmd; /* generic */ + struct { + unsigned char cmd; + unsigned char global; /* need idle engine? */ + unsigned short count; /* number of consecutive registers */ + unsigned short start; /* first register */ + unsigned short pad3; + } state; /* SAVAGE_CMD_STATE */ + struct { + unsigned char cmd; + unsigned char prim; /* primitive type */ + unsigned short skip; /* vertex format (skip flags) */ + unsigned short count; /* number of vertices */ + unsigned short start; /* first vertex in DMA/vertex buffer */ + } prim; /* SAVAGE_CMD_DMA_PRIM, SAVAGE_CMD_VB_PRIM */ + struct { + unsigned char cmd; + unsigned char prim; + unsigned short skip; + unsigned short count; /* number of indices that follow */ + unsigned short pad3; + } idx; /* SAVAGE_CMD_DMA_IDX, SAVAGE_CMD_VB_IDX */ + struct { + unsigned char cmd; + unsigned char pad0; + unsigned short pad1; + unsigned int flags; + } clear0; /* SAVAGE_CMD_CLEAR */ + struct { + unsigned int mask; + unsigned int value; + } clear1; /* SAVAGE_CMD_CLEAR data */ +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/sis_drm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/sis_drm.h new file mode 100644 index 0000000..30f7b38 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/sis_drm.h @@ -0,0 +1,67 @@ +/* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ +/* + * Copyright 2005 Eric Anholt + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __SIS_DRM_H__ +#define __SIS_DRM_H__ + +/* SiS specific ioctls */ +#define NOT_USED_0_3 +#define DRM_SIS_FB_ALLOC 0x04 +#define DRM_SIS_FB_FREE 0x05 +#define NOT_USED_6_12 +#define DRM_SIS_AGP_INIT 0x13 +#define DRM_SIS_AGP_ALLOC 0x14 +#define DRM_SIS_AGP_FREE 0x15 +#define DRM_SIS_FB_INIT 0x16 + +#define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_FB_ALLOC, drm_sis_mem_t) +#define DRM_IOCTL_SIS_FB_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_FREE, drm_sis_mem_t) +#define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_INIT, drm_sis_agp_t) +#define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_ALLOC, drm_sis_mem_t) +#define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_AGP_FREE, drm_sis_mem_t) +#define DRM_IOCTL_SIS_FB_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_INIT, drm_sis_fb_t) +/* +#define DRM_IOCTL_SIS_FLIP DRM_IOW( 0x48, drm_sis_flip_t) +#define DRM_IOCTL_SIS_FLIP_INIT DRM_IO( 0x49) +#define DRM_IOCTL_SIS_FLIP_FINAL DRM_IO( 0x50) +*/ + +typedef struct { + int context; + unsigned int offset; + unsigned int size; + unsigned long free; +} drm_sis_mem_t; + +typedef struct { + unsigned int offset, size; +} drm_sis_agp_t; + +typedef struct { + unsigned int offset, size; +} drm_sis_fb_t; + +#endif /* __SIS_DRM_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/via_drm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/via_drm.h new file mode 100644 index 0000000..535b558 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/drm/via_drm.h @@ -0,0 +1,275 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#ifndef _VIA_DRM_H_ +#define _VIA_DRM_H_ + +#include + +/* WARNING: These defines must be the same as what the Xserver uses. + * if you change them, you must change the defines in the Xserver. + */ + +#ifndef _VIA_DEFINES_ +#define _VIA_DEFINES_ + +#include "via_drmclient.h" + +#define VIA_NR_SAREA_CLIPRECTS 8 +#define VIA_NR_XVMC_PORTS 10 +#define VIA_NR_XVMC_LOCKS 5 +#define VIA_MAX_CACHELINE_SIZE 64 +#define XVMCLOCKPTR(saPriv,lockNo) \ + ((__volatile__ struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \ + (VIA_MAX_CACHELINE_SIZE - 1)) & \ + ~(VIA_MAX_CACHELINE_SIZE - 1)) + \ + VIA_MAX_CACHELINE_SIZE*(lockNo))) + +/* Each region is a minimum of 64k, and there are at most 64 of them. + */ +#define VIA_NR_TEX_REGIONS 64 +#define VIA_LOG_MIN_TEX_REGION_SIZE 16 +#endif + +#define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ +#define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ +#define VIA_UPLOAD_CTX 0x4 +#define VIA_UPLOAD_BUFFERS 0x8 +#define VIA_UPLOAD_TEX0 0x10 +#define VIA_UPLOAD_TEX1 0x20 +#define VIA_UPLOAD_CLIPRECTS 0x40 +#define VIA_UPLOAD_ALL 0xff + +/* VIA specific ioctls */ +#define DRM_VIA_ALLOCMEM 0x00 +#define DRM_VIA_FREEMEM 0x01 +#define DRM_VIA_AGP_INIT 0x02 +#define DRM_VIA_FB_INIT 0x03 +#define DRM_VIA_MAP_INIT 0x04 +#define DRM_VIA_DEC_FUTEX 0x05 +#define NOT_USED +#define DRM_VIA_DMA_INIT 0x07 +#define DRM_VIA_CMDBUFFER 0x08 +#define DRM_VIA_FLUSH 0x09 +#define DRM_VIA_PCICMD 0x0a +#define DRM_VIA_CMDBUF_SIZE 0x0b +#define NOT_USED +#define DRM_VIA_WAIT_IRQ 0x0d +#define DRM_VIA_DMA_BLIT 0x0e +#define DRM_VIA_BLIT_SYNC 0x0f + +#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t) +#define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t) +#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t) +#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t) +#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t) +#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t) +#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t) +#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t) +#define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH) +#define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t) +#define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \ + drm_via_cmdbuf_size_t) +#define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t) +#define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t) +#define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t) + +/* Indices into buf.Setup where various bits of state are mirrored per + * context and per buffer. These can be fired at the card as a unit, + * or in a piecewise fashion as required. + */ + +#define VIA_TEX_SETUP_SIZE 8 + +/* Flags for clear ioctl + */ +#define VIA_FRONT 0x1 +#define VIA_BACK 0x2 +#define VIA_DEPTH 0x4 +#define VIA_STENCIL 0x8 +#define VIA_MEM_VIDEO 0 /* matches drm constant */ +#define VIA_MEM_AGP 1 /* matches drm constant */ +#define VIA_MEM_SYSTEM 2 +#define VIA_MEM_MIXED 3 +#define VIA_MEM_UNKNOWN 4 + +typedef struct { + __u32 offset; + __u32 size; +} drm_via_agp_t; + +typedef struct { + __u32 offset; + __u32 size; +} drm_via_fb_t; + +typedef struct { + __u32 context; + __u32 type; + __u32 size; + unsigned long index; + unsigned long offset; +} drm_via_mem_t; + +typedef struct _drm_via_init { + enum { + VIA_INIT_MAP = 0x01, + VIA_CLEANUP_MAP = 0x02 + } func; + + unsigned long sarea_priv_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long agpAddr; +} drm_via_init_t; + +typedef struct _drm_via_futex { + enum { + VIA_FUTEX_WAIT = 0x00, + VIA_FUTEX_WAKE = 0X01 + } func; + __u32 ms; + __u32 lock; + __u32 val; +} drm_via_futex_t; + +typedef struct _drm_via_dma_init { + enum { + VIA_INIT_DMA = 0x01, + VIA_CLEANUP_DMA = 0x02, + VIA_DMA_INITIALIZED = 0x03 + } func; + + unsigned long offset; + unsigned long size; + unsigned long reg_pause_addr; +} drm_via_dma_init_t; + +typedef struct _drm_via_cmdbuffer { + char *buf; + unsigned long size; +} drm_via_cmdbuffer_t; + +/* Warning: If you change the SAREA structure you must change the Xserver + * structure as well */ + +typedef struct _drm_via_tex_region { + unsigned char next, prev; /* indices to form a circular LRU */ + unsigned char inUse; /* owned by a client, or free? */ + int age; /* tracked by clients to update local LRU's */ +} drm_via_tex_region_t; + +typedef struct _drm_via_sarea { + unsigned int dirty; + unsigned int nbox; + struct drm_clip_rect boxes[VIA_NR_SAREA_CLIPRECTS]; + drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1]; + int texAge; /* last time texture was uploaded */ + int ctxOwner; /* last context to upload state */ + int vertexPrim; + + /* + * Below is for XvMC. + * We want the lock integers alone on, and aligned to, a cache line. + * Therefore this somewhat strange construct. + */ + + char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)]; + + unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS]; + unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS]; + unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */ + + /* Used by the 3d driver only at this point, for pageflipping: + */ + unsigned int pfCurrentOffset; +} drm_via_sarea_t; + +typedef struct _drm_via_cmdbuf_size { + enum { + VIA_CMDBUF_SPACE = 0x01, + VIA_CMDBUF_LAG = 0x02 + } func; + int wait; + __u32 size; +} drm_via_cmdbuf_size_t; + +typedef enum { + VIA_IRQ_ABSOLUTE = 0x0, + VIA_IRQ_RELATIVE = 0x1, + VIA_IRQ_SIGNAL = 0x10000000, + VIA_IRQ_FORCE_SEQUENCE = 0x20000000 +} via_irq_seq_type_t; + +#define VIA_IRQ_FLAGS_MASK 0xF0000000 + +enum drm_via_irqs { + drm_via_irq_hqv0 = 0, + drm_via_irq_hqv1, + drm_via_irq_dma0_dd, + drm_via_irq_dma0_td, + drm_via_irq_dma1_dd, + drm_via_irq_dma1_td, + drm_via_irq_num +}; + +struct drm_via_wait_irq_request { + unsigned irq; + via_irq_seq_type_t type; + __u32 sequence; + __u32 signal; +}; + +typedef union drm_via_irqwait { + struct drm_via_wait_irq_request request; + struct drm_wait_vblank_reply reply; +} drm_via_irqwait_t; + +typedef struct drm_via_blitsync { + __u32 sync_handle; + unsigned engine; +} drm_via_blitsync_t; + +/* - * Below,"flags" is currently unused but will be used for possible future + * extensions like kernel space bounce buffers for bad alignments and + * blit engine busy-wait polling for better latency in the absence of + * interrupts. + */ + +typedef struct drm_via_dmablit { + __u32 num_lines; + __u32 line_length; + + __u32 fb_addr; + __u32 fb_stride; + + unsigned char *mem_addr; + __u32 mem_stride; + + __u32 flags; + int to_fb; + + drm_via_blitsync_t sync; +} drm_via_dmablit_t; + +#endif /* _VIA_DRM_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/elf.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/elf.h new file mode 100644 index 0000000..19805d7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/elf.h @@ -0,0 +1,2928 @@ +/* This file defines standard ELF types, structures, and macros. + Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ELF_H +#define _ELF_H 1 + +#include + +__BEGIN_DECLS + +/* Standard ELF types. */ + +#include + +/* Type for a 16-bit quantity. */ +typedef uint16_t Elf32_Half; +typedef uint16_t Elf64_Half; + +/* Types for signed and unsigned 32-bit quantities. */ +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; + +/* Types for signed and unsigned 64-bit quantities. */ +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +/* Type of addresses. */ +typedef uint32_t Elf32_Addr; +typedef uint64_t Elf64_Addr; + +/* Type of file offsets. */ +typedef uint32_t Elf32_Off; +typedef uint64_t Elf64_Off; + +/* Type for section indices, which are 16-bit quantities. */ +typedef uint16_t Elf32_Section; +typedef uint16_t Elf64_Section; + +/* Type for version symbol information. */ +typedef Elf32_Half Elf32_Versym; +typedef Elf64_Half Elf64_Versym; + + +/* The ELF file header. This appears at the start of every ELF file. */ + +#define EI_NIDENT (16) + +typedef struct +{ + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + Elf32_Half e_type; /* Object file type */ + Elf32_Half e_machine; /* Architecture */ + Elf32_Word e_version; /* Object file version */ + Elf32_Addr e_entry; /* Entry point virtual address */ + Elf32_Off e_phoff; /* Program header table file offset */ + Elf32_Off e_shoff; /* Section header table file offset */ + Elf32_Word e_flags; /* Processor-specific flags */ + Elf32_Half e_ehsize; /* ELF header size in bytes */ + Elf32_Half e_phentsize; /* Program header table entry size */ + Elf32_Half e_phnum; /* Program header table entry count */ + Elf32_Half e_shentsize; /* Section header table entry size */ + Elf32_Half e_shnum; /* Section header table entry count */ + Elf32_Half e_shstrndx; /* Section header string table index */ +} Elf32_Ehdr; + +typedef struct +{ + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + Elf64_Half e_type; /* Object file type */ + Elf64_Half e_machine; /* Architecture */ + Elf64_Word e_version; /* Object file version */ + Elf64_Addr e_entry; /* Entry point virtual address */ + Elf64_Off e_phoff; /* Program header table file offset */ + Elf64_Off e_shoff; /* Section header table file offset */ + Elf64_Word e_flags; /* Processor-specific flags */ + Elf64_Half e_ehsize; /* ELF header size in bytes */ + Elf64_Half e_phentsize; /* Program header table entry size */ + Elf64_Half e_phnum; /* Program header table entry count */ + Elf64_Half e_shentsize; /* Section header table entry size */ + Elf64_Half e_shnum; /* Section header table entry count */ + Elf64_Half e_shstrndx; /* Section header string table index */ +} Elf64_Ehdr; + +/* Fields in the e_ident array. The EI_* macros are indices into the + array. The macros under each EI_* macro are the values the byte + may have. */ + +#define EI_MAG0 0 /* File identification byte 0 index */ +#define ELFMAG0 0x7f /* Magic number byte 0 */ + +#define EI_MAG1 1 /* File identification byte 1 index */ +#define ELFMAG1 'E' /* Magic number byte 1 */ + +#define EI_MAG2 2 /* File identification byte 2 index */ +#define ELFMAG2 'L' /* Magic number byte 2 */ + +#define EI_MAG3 3 /* File identification byte 3 index */ +#define ELFMAG3 'F' /* Magic number byte 3 */ + +/* Conglomeration of the identification bytes, for easy testing as a word. */ +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define EI_CLASS 4 /* File class byte index */ +#define ELFCLASSNONE 0 /* Invalid class */ +#define ELFCLASS32 1 /* 32-bit objects */ +#define ELFCLASS64 2 /* 64-bit objects */ +#define ELFCLASSNUM 3 + +#define EI_DATA 5 /* Data encoding byte index */ +#define ELFDATANONE 0 /* Invalid data encoding */ +#define ELFDATA2LSB 1 /* 2's complement, little endian */ +#define ELFDATA2MSB 2 /* 2's complement, big endian */ +#define ELFDATANUM 3 + +#define EI_VERSION 6 /* File version byte index */ + /* Value must be EV_CURRENT */ + +#define EI_OSABI 7 /* OS ABI identification */ +#define ELFOSABI_NONE 0 /* UNIX System V ABI */ +#define ELFOSABI_SYSV 0 /* Alias. */ +#define ELFOSABI_HPUX 1 /* HP-UX */ +#define ELFOSABI_NETBSD 2 /* NetBSD. */ +#define ELFOSABI_LINUX 3 /* Linux. */ +#define ELFOSABI_HURD 4 /* GNU/Hurd */ +#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ +#define ELFOSABI_AIX 7 /* IBM AIX. */ +#define ELFOSABI_IRIX 8 /* SGI Irix. */ +#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ +#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ +#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ +#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ +#define ELFOSABI_OPENVMS 13 /* OpenVMS */ +#define ELFOSABI_NSK 14 /* Hewlett-Packard Non-Stop Kernel */ +#define ELFOSABI_AROS 15 /* Amiga Research OS */ +#define ELFOSABI_ARM 97 /* ARM */ +#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ + +#define EI_ABIVERSION 8 /* ABI version */ + +#define EI_PAD 9 /* Byte index of padding bytes */ + +/* Legal values for e_type (object file type). */ + +#define ET_NONE 0 /* No file type */ +#define ET_REL 1 /* Relocatable file */ +#define ET_EXEC 2 /* Executable file */ +#define ET_DYN 3 /* Shared object file */ +#define ET_CORE 4 /* Core file */ +#define ET_NUM 5 /* Number of defined types */ +#define ET_LOOS 0xfe00 /* OS-specific range start */ +#define ET_HIOS 0xfeff /* OS-specific range end */ +#define ET_LOPROC 0xff00 /* Processor-specific range start */ +#define ET_HIPROC 0xffff /* Processor-specific range end */ + +/* Legal values for e_machine (architecture). */ + +#define EM_NONE 0 /* No machine */ +#define EM_M32 1 /* AT&T WE 32100 */ +#define EM_SPARC 2 /* SUN SPARC */ +#define EM_386 3 /* Intel 80386 */ +#define EM_68K 4 /* Motorola m68k family */ +#define EM_88K 5 /* Motorola m88k family */ +#define EM_486 6 /* Intel 80486 *//* Reserved for future use */ +#define EM_860 7 /* Intel 80860 */ +#define EM_MIPS 8 /* MIPS R3000 big-endian */ +#define EM_S370 9 /* IBM System/370 */ +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ + +#define EM_PARISC 15 /* HPPA */ +#define EM_VPP500 17 /* Fujitsu VPP500 */ +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ +#define EM_960 19 /* Intel 80960 */ +#define EM_PPC 20 /* PowerPC */ +#define EM_PPC64 21 /* PowerPC 64-bit */ +#define EM_S390 22 /* IBM S390 */ + +#define EM_V800 36 /* NEC V800 series */ +#define EM_FR20 37 /* Fujitsu FR20 */ +#define EM_RH32 38 /* TRW RH-32 */ +#define EM_MCORE 39 /* Motorola M*Core */ /* May also be taken by Fujitsu MMA */ +#define EM_RCE 39 /* Old name for MCore */ +#define EM_ARM 40 /* ARM */ +#define EM_FAKE_ALPHA 41 /* Digital Alpha */ +#define EM_SH 42 /* Renesas SH */ +#define EM_SPARCV9 43 /* SPARC v9 64-bit */ +#define EM_TRICORE 44 /* Siemens Tricore */ +#define EM_ARC 45 /* Argonaut RISC Core */ +#define EM_H8_300 46 /* Renesas H8/300 */ +#define EM_H8_300H 47 /* Renesas H8/300H */ +#define EM_H8S 48 /* Renesas H8S */ +#define EM_H8_500 49 /* Renesas H8/500 */ +#define EM_IA_64 50 /* Intel Merced */ +#define EM_MIPS_X 51 /* Stanford MIPS-X */ +#define EM_COLDFIRE 52 /* Motorola Coldfire */ +#define EM_68HC12 53 /* Motorola M68HC12 */ +#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ +#define EM_PCP 55 /* Siemens PCP */ +#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ +#define EM_NDR1 57 /* Denso NDR1 microprocessor */ +#define EM_STARCORE 58 /* Motorola Start*Core processor */ +#define EM_ME16 59 /* Toyota ME16 processor */ +#define EM_ST100 60 /* STMicroelectronic ST100 processor */ +#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ +#define EM_X86_64 62 /* AMD x86-64 architecture */ +#define EM_PDSP 63 /* Sony DSP Processor */ + +#define EM_FX66 66 /* Siemens FX66 microcontroller */ +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ +#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ +#define EM_SVX 73 /* Silicon Graphics SVx */ +#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ +#define EM_VAX 75 /* Digital VAX */ +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ +#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ +#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ +#define EM_HUANY 81 /* Harvard University machine-independent object files */ +#define EM_PRISM 82 /* SiTera Prism */ +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ +#define EM_FR30 84 /* Fujitsu FR30 */ +#define EM_D10V 85 /* Mitsubishi D10V */ +#define EM_D30V 86 /* Mitsubishi D30V */ +#define EM_V850 87 /* NEC v850 */ +#define EM_M32R 88 /* Renesas M32R */ +#define EM_MN10300 89 /* Matsushita MN10300 */ +#define EM_MN10200 90 /* Matsushita MN10200 */ +#define EM_PJ 91 /* picoJava */ +#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ +#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ +#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ +#define EM_IP2K 101 /* Ubicom IP2022 micro controller */ +#define EM_CR 103 /* National Semiconductor CompactRISC */ +#define EM_MSP430 105 /* TI msp430 micro controller */ +#define EM_BLACKFIN 106 /* Analog Devices Blackfin */ +#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ +#define EM_CRX 114 /* National Semiconductor CRX */ +#define EM_NUM 95 + +/* If it is necessary to assign new unofficial EM_* values, please pick large + random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision + with official or non-GNU unofficial values. + + NOTE: Do not just increment the most recent number by one. + Somebody else somewhere will do exactly the same thing, and you + will have a collision. Instead, pick a random number. + + Normally, each entity or maintainer responsible for a machine with an + unofficial e_machine number should eventually ask registry@caldera.com for + an officially blessed number to be added to the list above. */ + +/* picoJava */ +#define EM_PJ_OLD 99 + +/* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */ +#define EM_CYGNUS_POWERPC 0x9025 + +/* Old version of Sparc v9, from before the ABI; this should be + removed shortly. */ +#define EM_OLD_SPARCV9 11 + +/* Old version of PowerPC, this should be removed shortly. */ +#define EM_PPC_OLD 17 + +/* (Deprecated) Temporary number for the OpenRISC processor. */ +#define EM_OR32 0x8472 + +/* Renesas M32C and M16C. */ +#define EM_M32C 0xFEB0 + +/* Cygnus M32R ELF backend. Written in the absence of an ABI. */ +#define EM_CYGNUS_M32R 0x9041 + +/* old S/390 backend magic number. Written in the absence of an ABI. */ +#define EM_S390_OLD 0xa390 + +/* D10V backend magic number. Written in the absence of an ABI. */ +#define EM_CYGNUS_D10V 0x7650 + +/* D30V backend magic number. Written in the absence of an ABI. */ +#define EM_CYGNUS_D30V 0x7676 + +/* V850 backend magic number. Written in the absense of an ABI. */ +#define EM_CYGNUS_V850 0x9080 + +/* mn10200 and mn10300 backend magic numbers. + Written in the absense of an ABI. */ +#define EM_CYGNUS_MN10200 0xdead +#define EM_CYGNUS_MN10300 0xbeef + +/* FR30 magic number - no EABI available. */ +#define EM_CYGNUS_FR30 0x3330 + +/* AVR magic number + Written in the absense of an ABI. */ +#define EM_AVR_OLD 0x1057 + +/* OpenRISC magic number + Written in the absense of an ABI. */ +#define EM_OPENRISC_OLD 0x3426 + +/* DLX magic number + Written in the absense of an ABI. */ +#define EM_DLX 0x5aa5 + +#define EM_XSTORMY16 0xad45 + +/* FRV magic number - no EABI available??. */ +#define EM_CYGNUS_FRV 0x5441 + +/* Ubicom IP2xxx; no ABI */ +#define EM_IP2K_OLD 0x8217 + +#define EM_MT 0x2530 /* Morpho MT; no ABI */ + +/* MSP430 magic number + Written in the absense everything. */ +#define EM_MSP430_OLD 0x1059 + +/* Vitesse IQ2000. */ +#define EM_IQ2000 0xFEBA + +/* Old, unofficial value for Xtensa. */ +#define EM_XTENSA_OLD 0xabc7 + +/* Alpha backend magic number. Written in the absence of an ABI. */ +#define EM_ALPHA 0x9026 + +/* NIOS magic number - no EABI available. */ +#define EM_NIOS32 0xFEBB + +/* V850 backend magic number. Written in the absense of an ABI. */ +#define EM_CYGNUS_V850 0x9080 + +/* Legal values for e_version (version). */ + +#define EV_NONE 0 /* Invalid ELF version */ +#define EV_CURRENT 1 /* Current version */ +#define EV_NUM 2 + +/* Section header. */ + +typedef struct +{ + Elf32_Word sh_name; /* Section name (string tbl index) */ + Elf32_Word sh_type; /* Section type */ + Elf32_Word sh_flags; /* Section flags */ + Elf32_Addr sh_addr; /* Section virtual addr at execution */ + Elf32_Off sh_offset; /* Section file offset */ + Elf32_Word sh_size; /* Section size in bytes */ + Elf32_Word sh_link; /* Link to another section */ + Elf32_Word sh_info; /* Additional section information */ + Elf32_Word sh_addralign; /* Section alignment */ + Elf32_Word sh_entsize; /* Entry size if section holds table */ +} Elf32_Shdr; + +typedef struct +{ + Elf64_Word sh_name; /* Section name (string tbl index) */ + Elf64_Word sh_type; /* Section type */ + Elf64_Xword sh_flags; /* Section flags */ + Elf64_Addr sh_addr; /* Section virtual addr at execution */ + Elf64_Off sh_offset; /* Section file offset */ + Elf64_Xword sh_size; /* Section size in bytes */ + Elf64_Word sh_link; /* Link to another section */ + Elf64_Word sh_info; /* Additional section information */ + Elf64_Xword sh_addralign; /* Section alignment */ + Elf64_Xword sh_entsize; /* Entry size if section holds table */ +} Elf64_Shdr; + +/* Special section indices. */ + +#define SHN_UNDEF 0 /* Undefined section */ +#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ +#define SHN_LOPROC 0xff00 /* Start of processor-specific */ +#define SHN_BEFORE 0xff00 /* Order section before all others + (Solaris). */ +#define SHN_AFTER 0xff01 /* Order section after all others + (Solaris). */ +#define SHN_HIPROC 0xff1f /* End of processor-specific */ +#define SHN_LOOS 0xff20 /* Start of OS-specific */ +#define SHN_HIOS 0xff3f /* End of OS-specific */ +#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ +#define SHN_COMMON 0xfff2 /* Associated symbol is common */ +#define SHN_XINDEX 0xffff /* Index is in extra table. */ +#define SHN_HIRESERVE 0xffff /* End of reserved indices */ + +/* Legal values for sh_type (section type). */ + +#define SHT_NULL 0 /* Section header table entry unused */ +#define SHT_PROGBITS 1 /* Program data */ +#define SHT_SYMTAB 2 /* Symbol table */ +#define SHT_STRTAB 3 /* String table */ +#define SHT_RELA 4 /* Relocation entries with addends */ +#define SHT_HASH 5 /* Symbol hash table */ +#define SHT_DYNAMIC 6 /* Dynamic linking information */ +#define SHT_NOTE 7 /* Notes */ +#define SHT_NOBITS 8 /* Program space with no data (bss) */ +#define SHT_REL 9 /* Relocation entries, no addends */ +#define SHT_SHLIB 10 /* Reserved */ +#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ +#define SHT_INIT_ARRAY 14 /* Array of constructors */ +#define SHT_FINI_ARRAY 15 /* Array of destructors */ +#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ +#define SHT_GROUP 17 /* Section group */ +#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ +#define SHT_NUM 19 /* Number of defined types. */ +#define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ +#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ +#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ +#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ +#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ +#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ +#define SHT_HIOS 0x6fffffff /* End OS-specific type */ +#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ +#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ +#define SHT_LOUSER 0x80000000 /* Start of application-specific */ +#define SHT_HIUSER 0x8fffffff /* End of application-specific */ + +/* Legal values for sh_flags (section flags). */ + +#define SHF_WRITE (1 << 0) /* Writable */ +#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ +#define SHF_EXECINSTR (1 << 2) /* Executable */ +#define SHF_MERGE (1 << 4) /* Might be merged */ +#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ +#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ +#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ +#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling + required */ +#define SHF_GROUP (1 << 9) /* Section is member of a group. */ +#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ +#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ +#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ +#define SHF_ORDERED (1 << 30) /* Special ordering requirement + (Solaris). */ +#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless + referenced or allocated (Solaris).*/ + +/* Section group handling. */ +#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ + +/* Symbol table entry. */ + +typedef struct +{ + Elf32_Word st_name; /* Symbol name (string tbl index) */ + Elf32_Addr st_value; /* Symbol value */ + Elf32_Word st_size; /* Symbol size */ + unsigned char st_info; /* Symbol type and binding */ + unsigned char st_other; /* Symbol visibility */ + Elf32_Section st_shndx; /* Section index */ +} Elf32_Sym; + +typedef struct +{ + Elf64_Word st_name; /* Symbol name (string tbl index) */ + unsigned char st_info; /* Symbol type and binding */ + unsigned char st_other; /* Symbol visibility */ + Elf64_Section st_shndx; /* Section index */ + Elf64_Addr st_value; /* Symbol value */ + Elf64_Xword st_size; /* Symbol size */ +} Elf64_Sym; + +/* The syminfo section if available contains additional information about + every dynamic symbol. */ + +typedef struct +{ + Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ + Elf32_Half si_flags; /* Per symbol flags */ +} Elf32_Syminfo; + +typedef struct +{ + Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ + Elf64_Half si_flags; /* Per symbol flags */ +} Elf64_Syminfo; + +/* Possible values for si_boundto. */ +#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ +#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ +#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ + +/* Possible bitmasks for si_flags. */ +#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ +#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ +#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ +#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy + loaded */ +/* Syminfo version values. */ +#define SYMINFO_NONE 0 +#define SYMINFO_CURRENT 1 +#define SYMINFO_NUM 2 + + +/* How to extract and insert information held in the st_info field. */ + +#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) +#define ELF32_ST_TYPE(val) ((val) & 0xf) +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) + +/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ +#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) + +/* Legal values for ST_BIND subfield of st_info (symbol binding). */ + +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* Weak symbol */ +#define STB_NUM 3 /* Number of defined types. */ +#define STB_LOOS 10 /* Start of OS-specific */ +#define STB_HIOS 12 /* End of OS-specific */ +#define STB_LOPROC 13 /* Start of processor-specific */ +#define STB_HIPROC 15 /* End of processor-specific */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type). */ + +#define STT_NOTYPE 0 /* Symbol type is unspecified */ +#define STT_OBJECT 1 /* Symbol is a data object */ +#define STT_FUNC 2 /* Symbol is a code object */ +#define STT_SECTION 3 /* Symbol associated with a section */ +#define STT_FILE 4 /* Symbol's name is file name */ +#define STT_COMMON 5 /* Symbol is a common data object */ +#define STT_TLS 6 /* Symbol is thread-local data object*/ +#define STT_NUM 7 /* Number of defined types. */ +#define STT_LOOS 10 /* Start of OS-specific */ +#define STT_HIOS 12 /* End of OS-specific */ +#define STT_LOPROC 13 /* Start of processor-specific */ +#define STT_HIPROC 15 /* End of processor-specific */ + + +/* Symbol table indices are found in the hash buckets and chain table + of a symbol hash table section. This special index value indicates + the end of a chain, meaning no further symbols are found in that bucket. */ + +#define STN_UNDEF 0 /* End of a chain. */ + + +/* How to extract and insert information held in the st_other field. */ + +#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) + +/* For ELF64 the definitions are the same. */ +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) + +/* Symbol visibility specification encoded in the st_other field. */ +#define STV_DEFAULT 0 /* Default symbol visibility rules */ +#define STV_INTERNAL 1 /* Processor specific hidden class */ +#define STV_HIDDEN 2 /* Sym unavailable in other modules */ +#define STV_PROTECTED 3 /* Not preemptible, not exported */ + + +/* Relocation table entry without addend (in section of type SHT_REL). */ + +typedef struct +{ + Elf32_Addr r_offset; /* Address */ + Elf32_Word r_info; /* Relocation type and symbol index */ +} Elf32_Rel; + +/* I have seen two different definitions of the Elf64_Rel and + Elf64_Rela structures, so we'll leave them out until Novell (or + whoever) gets their act together. */ +/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ + +typedef struct +{ + Elf64_Addr r_offset; /* Address */ + Elf64_Xword r_info; /* Relocation type and symbol index */ +} Elf64_Rel; + +/* Relocation table entry with addend (in section of type SHT_RELA). */ + +typedef struct +{ + Elf32_Addr r_offset; /* Address */ + Elf32_Word r_info; /* Relocation type and symbol index */ + Elf32_Sword r_addend; /* Addend */ +} Elf32_Rela; + +typedef struct +{ + Elf64_Addr r_offset; /* Address */ + Elf64_Xword r_info; /* Relocation type and symbol index */ + Elf64_Sxword r_addend; /* Addend */ +} Elf64_Rela; + +/* How to extract and insert information held in the r_info field. */ + +#define ELF32_R_SYM(val) ((val) >> 8) +#define ELF32_R_TYPE(val) ((val) & 0xff) +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) + +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) +#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) + +/* Program segment header. */ + +typedef struct +{ + Elf32_Word p_type; /* Segment type */ + Elf32_Off p_offset; /* Segment file offset */ + Elf32_Addr p_vaddr; /* Segment virtual address */ + Elf32_Addr p_paddr; /* Segment physical address */ + Elf32_Word p_filesz; /* Segment size in file */ + Elf32_Word p_memsz; /* Segment size in memory */ + Elf32_Word p_flags; /* Segment flags */ + Elf32_Word p_align; /* Segment alignment */ +} Elf32_Phdr; + +typedef struct +{ + Elf64_Word p_type; /* Segment type */ + Elf64_Word p_flags; /* Segment flags */ + Elf64_Off p_offset; /* Segment file offset */ + Elf64_Addr p_vaddr; /* Segment virtual address */ + Elf64_Addr p_paddr; /* Segment physical address */ + Elf64_Xword p_filesz; /* Segment size in file */ + Elf64_Xword p_memsz; /* Segment size in memory */ + Elf64_Xword p_align; /* Segment alignment */ +} Elf64_Phdr; + +/* Legal values for p_type (segment type). */ + +#define PT_NULL 0 /* Program header table entry unused */ +#define PT_LOAD 1 /* Loadable program segment */ +#define PT_DYNAMIC 2 /* Dynamic linking information */ +#define PT_INTERP 3 /* Program interpreter */ +#define PT_NOTE 4 /* Auxiliary information */ +#define PT_SHLIB 5 /* Reserved */ +#define PT_PHDR 6 /* Entry for header table itself */ +#define PT_TLS 7 /* Thread-local storage segment */ +#define PT_NUM 8 /* Number of defined types */ +#define PT_LOOS 0x60000000 /* Start of OS-specific */ +#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ +#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ +#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ +#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */ +#define PT_LOSUNW 0x6ffffffa +#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ +#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ +#define PT_HISUNW 0x6fffffff +#define PT_HIOS 0x6fffffff /* End of OS-specific */ +#define PT_LOPROC 0x70000000 /* Start of processor-specific */ +#define PT_HIPROC 0x7fffffff /* End of processor-specific */ + +/* Legal values for p_flags (segment flags). */ + +#define PF_X (1 << 0) /* Segment is executable */ +#define PF_W (1 << 1) /* Segment is writable */ +#define PF_R (1 << 2) /* Segment is readable */ +#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */ +#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */ +#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */ +#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */ +#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */ +#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */ +#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */ +#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */ +#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */ +#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */ +#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */ +#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */ +#define PF_MASKOS 0x0ff00000 /* OS-specific */ +#define PF_MASKPROC 0xf0000000 /* Processor-specific */ + +/* Legal values for note segment descriptor types for core files. */ + +#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ +#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ +#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ +#define NT_PRXREG 4 /* Contains copy of prxregset struct */ +#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ +#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ +#define NT_AUXV 6 /* Contains copy of auxv array */ +#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ +#define NT_ASRS 8 /* Contains copy of asrset struct */ +#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ +#define NT_PSINFO 13 /* Contains copy of psinfo struct */ +#define NT_PRCRED 14 /* Contains copy of prcred struct */ +#define NT_UTSNAME 15 /* Contains copy of utsname struct */ +#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ +#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ +#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct*/ + +/* Legal values for the note segment descriptor types for object files. */ + +#define NT_VERSION 1 /* Contains a version string. */ + + +/* Dynamic section entry. */ + +typedef struct +{ + Elf32_Sword d_tag; /* Dynamic entry type */ + union + { + Elf32_Word d_val; /* Integer value */ + Elf32_Addr d_ptr; /* Address value */ + } d_un; +} Elf32_Dyn; + +typedef struct +{ + Elf64_Sxword d_tag; /* Dynamic entry type */ + union + { + Elf64_Xword d_val; /* Integer value */ + Elf64_Addr d_ptr; /* Address value */ + } d_un; +} Elf64_Dyn; + +/* Legal values for d_tag (dynamic entry type). */ + +#define DT_NULL 0 /* Marks end of dynamic section */ +#define DT_NEEDED 1 /* Name of needed library */ +#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ +#define DT_PLTGOT 3 /* Processor defined value */ +#define DT_HASH 4 /* Address of symbol hash table */ +#define DT_STRTAB 5 /* Address of string table */ +#define DT_SYMTAB 6 /* Address of symbol table */ +#define DT_RELA 7 /* Address of Rela relocs */ +#define DT_RELASZ 8 /* Total size of Rela relocs */ +#define DT_RELAENT 9 /* Size of one Rela reloc */ +#define DT_STRSZ 10 /* Size of string table */ +#define DT_SYMENT 11 /* Size of one symbol table entry */ +#define DT_INIT 12 /* Address of init function */ +#define DT_FINI 13 /* Address of termination function */ +#define DT_SONAME 14 /* Name of shared object */ +#define DT_RPATH 15 /* Library search path (deprecated) */ +#define DT_SYMBOLIC 16 /* Start symbol search here */ +#define DT_REL 17 /* Address of Rel relocs */ +#define DT_RELSZ 18 /* Total size of Rel relocs */ +#define DT_RELENT 19 /* Size of one Rel reloc */ +#define DT_PLTREL 20 /* Type of reloc in PLT */ +#define DT_DEBUG 21 /* For debugging; unspecified */ +#define DT_TEXTREL 22 /* Reloc might modify .text */ +#define DT_JMPREL 23 /* Address of PLT relocs */ +#define DT_BIND_NOW 24 /* Process relocations of object */ +#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ +#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ +#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ +#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ +#define DT_RUNPATH 29 /* Library search path */ +#define DT_FLAGS 30 /* Flags for the object being loaded */ +#define DT_ENCODING 32 /* Start of encoded range */ +#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ +#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ +#define DT_NUM 34 /* Number used */ +#define DT_LOOS 0x6000000d /* Start of OS-specific */ +#define DT_HIOS 0x6ffff000 /* End of OS-specific */ +#define DT_LOPROC 0x70000000 /* Start of processor-specific */ +#define DT_HIPROC 0x7fffffff /* End of processor-specific */ +#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ + +/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the + Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's + approach. */ +#define DT_VALRNGLO 0x6ffffd00 +#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ +#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ +#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ +#define DT_CHECKSUM 0x6ffffdf8 +#define DT_PLTPADSZ 0x6ffffdf9 +#define DT_MOVEENT 0x6ffffdfa +#define DT_MOVESZ 0x6ffffdfb +#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ +#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting + the following DT_* entry. */ +#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ +#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ +#define DT_VALRNGHI 0x6ffffdff +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ +#define DT_VALNUM 12 + +/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the + Dyn.d_un.d_ptr field of the Elf*_Dyn structure. + + If any adjustment is made to the ELF object after it has been + built these entries will need to be adjusted. */ +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ +#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ +#define DT_CONFIG 0x6ffffefa /* Configuration information. */ +#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ +#define DT_AUDIT 0x6ffffefc /* Object auditing. */ +#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ +#define DT_MOVETAB 0x6ffffefe /* Move table. */ +#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ +#define DT_ADDRNUM 10 + +/* The versioning entry types. The next are defined as part of the + GNU extension. */ +#define DT_VERSYM 0x6ffffff0 + +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa + +/* These were chosen by Sun. */ +#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ +#define DT_VERDEF 0x6ffffffc /* Address of version definition + table */ +#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ +#define DT_VERNEED 0x6ffffffe /* Address of table with needed + versions */ +#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ +#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ +#define DT_VERSIONTAGNUM 16 + +/* Sun added these machine-independent extensions in the "processor-specific" + range. Be compatible. */ +#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ +#define DT_FILTER 0x7fffffff /* Shared object to get values from */ +#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) +#define DT_EXTRANUM 3 + +/* Values of `d_un.d_val' in the DT_FLAGS entry. */ +#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ +#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ +#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ +#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ +#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ + +/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 + entry in the dynamic section. */ +#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ +#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ +#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ +#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ +#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ +#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ +#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ +#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ +#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ +#define DF_1_TRANS 0x00000200 +#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ +#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ +#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ +#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ +#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ +#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ +#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ + +/* Flags for the feature selection in DT_FEATURE_1. */ +#define DTF_1_PARINIT 0x00000001 +#define DTF_1_CONFEXP 0x00000002 + +/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ +#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ +#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not + generally available. */ + +/* Version definition sections. */ + +typedef struct +{ + Elf32_Half vd_version; /* Version revision */ + Elf32_Half vd_flags; /* Version information */ + Elf32_Half vd_ndx; /* Version Index */ + Elf32_Half vd_cnt; /* Number of associated aux entries */ + Elf32_Word vd_hash; /* Version name hash value */ + Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ + Elf32_Word vd_next; /* Offset in bytes to next verdef + entry */ +} Elf32_Verdef; + +typedef struct +{ + Elf64_Half vd_version; /* Version revision */ + Elf64_Half vd_flags; /* Version information */ + Elf64_Half vd_ndx; /* Version Index */ + Elf64_Half vd_cnt; /* Number of associated aux entries */ + Elf64_Word vd_hash; /* Version name hash value */ + Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ + Elf64_Word vd_next; /* Offset in bytes to next verdef + entry */ +} Elf64_Verdef; + + +/* Legal values for vd_version (version revision). */ +#define VER_DEF_NONE 0 /* No version */ +#define VER_DEF_CURRENT 1 /* Current version */ +#define VER_DEF_NUM 2 /* Given version number */ + +/* Legal values for vd_flags (version information flags). */ +#define VER_FLG_BASE 0x1 /* Version definition of file itself */ +#define VER_FLG_WEAK 0x2 /* Weak version identifier */ + +/* Versym symbol index values. */ +#define VER_NDX_LOCAL 0 /* Symbol is local. */ +#define VER_NDX_GLOBAL 1 /* Symbol is global. */ +#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ +#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ + +/* Auxialiary version information. */ + +typedef struct +{ + Elf32_Word vda_name; /* Version or dependency names */ + Elf32_Word vda_next; /* Offset in bytes to next verdaux + entry */ +} Elf32_Verdaux; + +typedef struct +{ + Elf64_Word vda_name; /* Version or dependency names */ + Elf64_Word vda_next; /* Offset in bytes to next verdaux + entry */ +} Elf64_Verdaux; + + +/* Version dependency section. */ + +typedef struct +{ + Elf32_Half vn_version; /* Version of structure */ + Elf32_Half vn_cnt; /* Number of associated aux entries */ + Elf32_Word vn_file; /* Offset of filename for this + dependency */ + Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ + Elf32_Word vn_next; /* Offset in bytes to next verneed + entry */ +} Elf32_Verneed; + +typedef struct +{ + Elf64_Half vn_version; /* Version of structure */ + Elf64_Half vn_cnt; /* Number of associated aux entries */ + Elf64_Word vn_file; /* Offset of filename for this + dependency */ + Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ + Elf64_Word vn_next; /* Offset in bytes to next verneed + entry */ +} Elf64_Verneed; + + +/* Legal values for vn_version (version revision). */ +#define VER_NEED_NONE 0 /* No version */ +#define VER_NEED_CURRENT 1 /* Current version */ +#define VER_NEED_NUM 2 /* Given version number */ + +/* Auxiliary needed version information. */ + +typedef struct +{ + Elf32_Word vna_hash; /* Hash value of dependency name */ + Elf32_Half vna_flags; /* Dependency specific information */ + Elf32_Half vna_other; /* Unused */ + Elf32_Word vna_name; /* Dependency name string offset */ + Elf32_Word vna_next; /* Offset in bytes to next vernaux + entry */ +} Elf32_Vernaux; + +typedef struct +{ + Elf64_Word vna_hash; /* Hash value of dependency name */ + Elf64_Half vna_flags; /* Dependency specific information */ + Elf64_Half vna_other; /* Unused */ + Elf64_Word vna_name; /* Dependency name string offset */ + Elf64_Word vna_next; /* Offset in bytes to next vernaux + entry */ +} Elf64_Vernaux; + + +/* Legal values for vna_flags. */ +#define VER_FLG_WEAK 0x2 /* Weak version identifier */ + + +/* Auxiliary vector. */ + +/* This vector is normally only used by the program interpreter. The + usual definition in an ABI supplement uses the name auxv_t. The + vector is not usually defined in a standard file, but it + can't hurt. We rename it to avoid conflicts. The sizes of these + types are an arrangement between the exec server and the program + interpreter, so we don't fully specify them here. */ + +typedef struct +{ + uint32_t a_type; /* Entry type */ + union + { + uint32_t a_val; /* Integer value */ + /* We use to have pointer elements added here. We cannot do that, + though, since it does not work when using 32-bit definitions + on 64-bit platforms and vice versa. */ + } a_un; +} Elf32_auxv_t; + +typedef struct +{ + uint64_t a_type; /* Entry type */ + union + { + uint64_t a_val; /* Integer value */ + /* We use to have pointer elements added here. We cannot do that, + though, since it does not work when using 32-bit definitions + on 64-bit platforms and vice versa. */ + } a_un; +} Elf64_auxv_t; + +/* Legal values for a_type (entry type). */ + +#define AT_NULL 0 /* End of vector */ +#define AT_IGNORE 1 /* Entry should be ignored */ +#define AT_EXECFD 2 /* File descriptor of program */ +#define AT_PHDR 3 /* Program headers for program */ +#define AT_PHENT 4 /* Size of program header entry */ +#define AT_PHNUM 5 /* Number of program headers */ +#define AT_PAGESZ 6 /* System page size */ +#define AT_BASE 7 /* Base address of interpreter */ +#define AT_FLAGS 8 /* Flags */ +#define AT_ENTRY 9 /* Entry point of program */ +#define AT_NOTELF 10 /* Program is not ELF */ +#define AT_UID 11 /* Real uid */ +#define AT_EUID 12 /* Effective uid */ +#define AT_GID 13 /* Real gid */ +#define AT_EGID 14 /* Effective gid */ +#define AT_CLKTCK 17 /* Frequency of times() */ + +/* Some more special a_type values describing the hardware. */ +#define AT_PLATFORM 15 /* String identifying platform. */ +#define AT_HWCAP 16 /* Machine dependent hints about + processor capabilities. */ + +/* This entry gives some information about the FPU initialization + performed by the kernel. */ +#define AT_FPUCW 18 /* Used FPU control word. */ + +/* Cache block sizes. */ +#define AT_DCACHEBSIZE 19 /* Data cache block size. */ +#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ +#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ + +/* A special ignored value for PPC, used by the kernel to control the + interpretation of the AUXV. Must be > 16. */ +#define AT_IGNOREPPC 22 /* Entry should be ignored. */ + +#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ + +/* Pointer to the global system page used for system calls and other + nice things. */ +#define AT_SYSINFO 32 +#define AT_SYSINFO_EHDR 33 + +/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains + log2 of line size; mask those to get cache size. */ +#define AT_L1I_CACHESHAPE 34 +#define AT_L1D_CACHESHAPE 35 +#define AT_L2_CACHESHAPE 36 +#define AT_L3_CACHESHAPE 37 + +/* Note section contents. Each entry in the note section begins with + a header of a fixed form. */ + +typedef struct +{ + Elf32_Word n_namesz; /* Length of the note's name. */ + Elf32_Word n_descsz; /* Length of the note's descriptor. */ + Elf32_Word n_type; /* Type of the note. */ +} Elf32_Nhdr; + +typedef struct +{ + Elf64_Word n_namesz; /* Length of the note's name. */ + Elf64_Word n_descsz; /* Length of the note's descriptor. */ + Elf64_Word n_type; /* Type of the note. */ +} Elf64_Nhdr; + +/* Known names of notes. */ + +/* Solaris entries in the note section have this name. */ +#define ELF_NOTE_SOLARIS "SUNW Solaris" + +/* Note entries for GNU systems have this name. */ +#define ELF_NOTE_GNU "GNU" + + +/* Defined types of notes for Solaris. */ + +/* Value of descriptor (one word) is desired pagesize for the binary. */ +#define ELF_NOTE_PAGESIZE_HINT 1 + + +/* Defined note types for GNU systems. */ + +/* ABI information. The descriptor consists of words: + word 0: OS descriptor + word 1: major version of the ABI + word 2: minor version of the ABI + word 3: subminor version of the ABI +*/ +#define ELF_NOTE_ABI 1 + +/* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI + note section entry. */ +#define ELF_NOTE_OS_LINUX 0 +#define ELF_NOTE_OS_GNU 1 +#define ELF_NOTE_OS_SOLARIS2 2 +#define ELF_NOTE_OS_FREEBSD 3 + + +/* Move records. */ +typedef struct +{ + Elf32_Xword m_value; /* Symbol value. */ + Elf32_Word m_info; /* Size and index. */ + Elf32_Word m_poffset; /* Symbol offset. */ + Elf32_Half m_repeat; /* Repeat count. */ + Elf32_Half m_stride; /* Stride info. */ +} Elf32_Move; + +typedef struct +{ + Elf64_Xword m_value; /* Symbol value. */ + Elf64_Xword m_info; /* Size and index. */ + Elf64_Xword m_poffset; /* Symbol offset. */ + Elf64_Half m_repeat; /* Repeat count. */ + Elf64_Half m_stride; /* Stride info. */ +} Elf64_Move; + +/* Macro to construct move records. */ +#define ELF32_M_SYM(info) ((info) >> 8) +#define ELF32_M_SIZE(info) ((unsigned char) (info)) +#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) + +#define ELF64_M_SYM(info) ELF32_M_SYM (info) +#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) +#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) + + +/* Motorola 68k specific definitions. */ + +/* Values for Elf32_Ehdr.e_flags. */ +#define EF_CPU32 0x00810000 + +/* m68k relocs. */ + +#define R_68K_NONE 0 /* No reloc */ +#define R_68K_32 1 /* Direct 32 bit */ +#define R_68K_16 2 /* Direct 16 bit */ +#define R_68K_8 3 /* Direct 8 bit */ +#define R_68K_PC32 4 /* PC relative 32 bit */ +#define R_68K_PC16 5 /* PC relative 16 bit */ +#define R_68K_PC8 6 /* PC relative 8 bit */ +#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ +#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ +#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ +#define R_68K_GOT32O 10 /* 32 bit GOT offset */ +#define R_68K_GOT16O 11 /* 16 bit GOT offset */ +#define R_68K_GOT8O 12 /* 8 bit GOT offset */ +#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ +#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ +#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ +#define R_68K_PLT32O 16 /* 32 bit PLT offset */ +#define R_68K_PLT16O 17 /* 16 bit PLT offset */ +#define R_68K_PLT8O 18 /* 8 bit PLT offset */ +#define R_68K_COPY 19 /* Copy symbol at runtime */ +#define R_68K_GLOB_DAT 20 /* Create GOT entry */ +#define R_68K_JMP_SLOT 21 /* Create PLT entry */ +#define R_68K_RELATIVE 22 /* Adjust by program base */ +/* Keep this the last entry. */ +#define R_68K_NUM 23 + +/* Intel 80386 specific definitions. */ + +/* i386 relocs. */ + +#define R_386_NONE 0 /* No reloc */ +#define R_386_32 1 /* Direct 32 bit */ +#define R_386_PC32 2 /* PC relative 32 bit */ +#define R_386_GOT32 3 /* 32 bit GOT entry */ +#define R_386_PLT32 4 /* 32 bit PLT address */ +#define R_386_COPY 5 /* Copy symbol at runtime */ +#define R_386_GLOB_DAT 6 /* Create GOT entry */ +#define R_386_JMP_SLOT 7 /* Create PLT entry */ +#define R_386_RELATIVE 8 /* Adjust by program base */ +#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ +#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ +#define R_386_32PLT 11 +#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ +#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS + block offset */ +#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block + offset */ +#define R_386_TLS_LE 17 /* Offset relative to static TLS + block */ +#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of + general dynamic thread local data */ +#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of + local dynamic thread local data + in LE code */ +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic + thread local data */ +#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ +#define R_386_TLS_GD_CALL 26 /* Relocation for call to + __tls_get_addr() */ +#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ +#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic + thread local data in LE code */ +#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ +#define R_386_TLS_LDM_CALL 30 /* Relocation for call to + __tls_get_addr() in LDM code */ +#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ +#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ +#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS + block offset */ +#define R_386_TLS_LE_32 34 /* Negated offset relative to static + TLS block */ +#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ +#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ +#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ +/* Keep this the last entry. */ +#define R_386_NUM 38 + +/* Blackfin specific definitions. */ +#define R_BFIN_unused0 0x00 +#define R_BFIN_pcrel5m2 0x01 +#define R_BFIN_unused1 0x02 +#define R_BFIN_pcrel10 0x03 +#define R_BFIN_pcrel12_jump 0x04 +#define R_BFIN_rimm16 0x05 +#define R_BFIN_luimm16 0x06 +#define R_BFIN_huimm16 0x07 +#define R_BFIN_pcrel12_jump_s 0x08 +#define R_BFIN_pcrel24_jump_x 0x09 +#define R_BFIN_pcrel24 0x0a +#define R_BFIN_unusedb 0x0b +#define R_BFIN_unusedc 0x0c +#define R_BFIN_pcrel24_jump_l 0x0d +#define R_BFIN_pcrel24_call_x 0x0e +#define R_BFIN_var_eq_symb 0x0f +#define R_BFIN_byte_data 0x10 +#define R_BFIN_byte2_data 0x11 +#define R_BFIN_byte4_data 0x12 +#define R_BFIN_pcrel11 0x13 + +#define R_BFIN_GOT17M4 0x14 +#define R_BFIN_GOTHI 0x15 +#define R_BFIN_GOTLO 0x16 +#define R_BFIN_FUNCDESC 0x17 +#define R_BFIN_FUNCDESC_GOT17M4 0x18 +#define R_BFIN_FUNCDESC_GOTHI 0x19 +#define R_BFIN_FUNCDESC_GOTLO 0x1a +#define R_BFIN_FUNCDESC_VALUE 0x1b +#define R_BFIN_FUNCDESC_GOTOFF17M4 0x1c +#define R_BFIN_FUNCDESC_GOTOFFHI 0x1d +#define R_BFIN_FUNCDESC_GOTOFFLO 0x1e +#define R_BFIN_GOTOFF17M4 0x1f +#define R_BFIN_GOTOFFHI 0x20 +#define R_BFIN_GOTOFFLO 0x21 + +#define EF_BFIN_PIC 0x00000001 /* -fpic */ +#define EF_BFIN_FDPIC 0x00000002 /* -mfdpic */ +#define EF_BFIN_CODE_IN_L1 0x00000010 /* --code-in-l1 */ +#define EF_BFIN_DATA_IN_L1 0x00000020 /* --data-in-l1 */ + +/* FR-V specific definitions. */ +#define R_FRV_NONE 0 /* No reloc. */ +#define R_FRV_32 1 /* Direct 32 bit. */ +/* Canonical function descriptor address. */ +#define R_FRV_FUNCDESC 14 +/* Private function descriptor initialization. */ +#define R_FRV_FUNCDESC_VALUE 18 + + /* gpr support */ +#define EF_FRV_GPR_MASK 0x00000003 /* mask for # of gprs */ +#define EF_FRV_GPR_32 0x00000001 /* -mgpr-32 */ +#define EF_FRV_GPR_64 0x00000002 /* -mgpr-64 */ + + /* fpr support */ +#define EF_FRV_FPR_MASK 0x0000000c /* mask for # of fprs */ +#define EF_FRV_FPR_32 0x00000004 /* -mfpr-32 */ +#define EF_FRV_FPR_64 0x00000008 /* -mfpr-64 */ +#define EF_FRV_FPR_NONE 0x0000000c /* -msoft-float */ + +#define EF_FRV_PIC 0x00000100 +#define EF_FRV_FDPIC 0x00008000 + +/* SUN SPARC specific definitions. */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type). */ + +#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ + +/* Values for Elf64_Ehdr.e_flags. */ + +#define EF_SPARCV9_MM 3 +#define EF_SPARCV9_TSO 0 +#define EF_SPARCV9_PSO 1 +#define EF_SPARCV9_RMO 2 +#define EF_SPARC_LEDATA 0x800000 /* little endian data */ +#define EF_SPARC_EXT_MASK 0xFFFF00 +#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ +#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ +#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ +#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ + +/* SPARC relocs. */ + +#define R_SPARC_NONE 0 /* No reloc */ +#define R_SPARC_8 1 /* Direct 8 bit */ +#define R_SPARC_16 2 /* Direct 16 bit */ +#define R_SPARC_32 3 /* Direct 32 bit */ +#define R_SPARC_DISP8 4 /* PC relative 8 bit */ +#define R_SPARC_DISP16 5 /* PC relative 16 bit */ +#define R_SPARC_DISP32 6 /* PC relative 32 bit */ +#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ +#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ +#define R_SPARC_HI22 9 /* High 22 bit */ +#define R_SPARC_22 10 /* Direct 22 bit */ +#define R_SPARC_13 11 /* Direct 13 bit */ +#define R_SPARC_LO10 12 /* Truncated 10 bit */ +#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ +#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ +#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ +#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ +#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ +#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ +#define R_SPARC_COPY 19 /* Copy symbol at runtime */ +#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ +#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ +#define R_SPARC_RELATIVE 22 /* Adjust by program base */ +#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ + +/* Additional Sparc64 relocs. */ + +#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ +#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ +#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ +#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ +#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ +#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ +#define R_SPARC_10 30 /* Direct 10 bit */ +#define R_SPARC_11 31 /* Direct 11 bit */ +#define R_SPARC_64 32 /* Direct 64 bit */ +#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ +#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ +#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ +#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ +#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ +#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ +#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ +#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ +#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ +#define R_SPARC_7 43 /* Direct 7 bit */ +#define R_SPARC_5 44 /* Direct 5 bit */ +#define R_SPARC_6 45 /* Direct 6 bit */ +#define R_SPARC_DISP64 46 /* PC relative 64 bit */ +#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ +#define R_SPARC_HIX22 48 /* High 22 bit complemented */ +#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ +#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ +#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ +#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ +#define R_SPARC_REGISTER 53 /* Global register usage */ +#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ +#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ +#define R_SPARC_TLS_GD_HI22 56 +#define R_SPARC_TLS_GD_LO10 57 +#define R_SPARC_TLS_GD_ADD 58 +#define R_SPARC_TLS_GD_CALL 59 +#define R_SPARC_TLS_LDM_HI22 60 +#define R_SPARC_TLS_LDM_LO10 61 +#define R_SPARC_TLS_LDM_ADD 62 +#define R_SPARC_TLS_LDM_CALL 63 +#define R_SPARC_TLS_LDO_HIX22 64 +#define R_SPARC_TLS_LDO_LOX10 65 +#define R_SPARC_TLS_LDO_ADD 66 +#define R_SPARC_TLS_IE_HI22 67 +#define R_SPARC_TLS_IE_LO10 68 +#define R_SPARC_TLS_IE_LD 69 +#define R_SPARC_TLS_IE_LDX 70 +#define R_SPARC_TLS_IE_ADD 71 +#define R_SPARC_TLS_LE_HIX22 72 +#define R_SPARC_TLS_LE_LOX10 73 +#define R_SPARC_TLS_DTPMOD32 74 +#define R_SPARC_TLS_DTPMOD64 75 +#define R_SPARC_TLS_DTPOFF32 76 +#define R_SPARC_TLS_DTPOFF64 77 +#define R_SPARC_TLS_TPOFF32 78 +#define R_SPARC_TLS_TPOFF64 79 +/* Keep this the last entry. */ +#define R_SPARC_NUM 80 + +/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ + +#define DT_SPARC_REGISTER 0x70000001 +#define DT_SPARC_NUM 2 + +/* Bits present in AT_HWCAP, primarily for Sparc32. */ + +#define HWCAP_SPARC_FLUSH 1 /* The cpu supports flush insn. */ +#define HWCAP_SPARC_STBAR 2 +#define HWCAP_SPARC_SWAP 4 +#define HWCAP_SPARC_MULDIV 8 +#define HWCAP_SPARC_V9 16 /* The cpu is v9, so v8plus is ok. */ +#define HWCAP_SPARC_ULTRA3 32 + +/* MIPS R3000 specific definitions. */ + +/* Legal values for e_flags field of Elf32_Ehdr. */ + +#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ +#define EF_MIPS_PIC 2 /* Contains PIC code */ +#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ +#define EF_MIPS_XGOT 8 +#define EF_MIPS_64BIT_WHIRL 16 +#define EF_MIPS_ABI2 32 +#define EF_MIPS_ABI_ON32 64 +#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ + +/* Legal values for MIPS architecture level. */ + +#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ +#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ +#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ +#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ +#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ +#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ +#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ + +/* The following are non-official names and should not be used. */ + +#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ +#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ +#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ +#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ +#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ +#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ +#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ + +/* Special section indices. */ + +#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ +#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ +#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ +#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ +#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ + +/* Legal values for sh_type field of Elf32_Shdr. */ + +#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ +#define SHT_MIPS_MSYM 0x70000001 +#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ +#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ +#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ +#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ +#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ +#define SHT_MIPS_PACKAGE 0x70000007 +#define SHT_MIPS_PACKSYM 0x70000008 +#define SHT_MIPS_RELD 0x70000009 +#define SHT_MIPS_IFACE 0x7000000b +#define SHT_MIPS_CONTENT 0x7000000c +#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ +#define SHT_MIPS_SHDR 0x70000010 +#define SHT_MIPS_FDESC 0x70000011 +#define SHT_MIPS_EXTSYM 0x70000012 +#define SHT_MIPS_DENSE 0x70000013 +#define SHT_MIPS_PDESC 0x70000014 +#define SHT_MIPS_LOCSYM 0x70000015 +#define SHT_MIPS_AUXSYM 0x70000016 +#define SHT_MIPS_OPTSYM 0x70000017 +#define SHT_MIPS_LOCSTR 0x70000018 +#define SHT_MIPS_LINE 0x70000019 +#define SHT_MIPS_RFDESC 0x7000001a +#define SHT_MIPS_DELTASYM 0x7000001b +#define SHT_MIPS_DELTAINST 0x7000001c +#define SHT_MIPS_DELTACLASS 0x7000001d +#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ +#define SHT_MIPS_DELTADECL 0x7000001f +#define SHT_MIPS_SYMBOL_LIB 0x70000020 +#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ +#define SHT_MIPS_TRANSLATE 0x70000022 +#define SHT_MIPS_PIXIE 0x70000023 +#define SHT_MIPS_XLATE 0x70000024 +#define SHT_MIPS_XLATE_DEBUG 0x70000025 +#define SHT_MIPS_WHIRL 0x70000026 +#define SHT_MIPS_EH_REGION 0x70000027 +#define SHT_MIPS_XLATE_OLD 0x70000028 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029 + +/* Legal values for sh_flags field of Elf32_Shdr. */ + +#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ +#define SHF_MIPS_MERGE 0x20000000 +#define SHF_MIPS_ADDR 0x40000000 +#define SHF_MIPS_STRINGS 0x80000000 +#define SHF_MIPS_NOSTRIP 0x08000000 +#define SHF_MIPS_LOCAL 0x04000000 +#define SHF_MIPS_NAMES 0x02000000 +#define SHF_MIPS_NODUPE 0x01000000 + + +/* Symbol tables. */ + +/* MIPS specific values for `st_other'. */ +#define STO_MIPS_DEFAULT 0x0 +#define STO_MIPS_INTERNAL 0x1 +#define STO_MIPS_HIDDEN 0x2 +#define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff + +/* MIPS specific values for `st_info'. */ +#define STB_MIPS_SPLIT_COMMON 13 + +/* Entries found in sections of type SHT_MIPS_GPTAB. */ + +typedef union +{ + struct + { + Elf32_Word gt_current_g_value; /* -G value used for compilation */ + Elf32_Word gt_unused; /* Not used */ + } gt_header; /* First entry in section */ + struct + { + Elf32_Word gt_g_value; /* If this value were used for -G */ + Elf32_Word gt_bytes; /* This many bytes would be used */ + } gt_entry; /* Subsequent entries in section */ +} Elf32_gptab; + +/* Entry found in sections of type SHT_MIPS_REGINFO. */ + +typedef struct +{ + Elf32_Word ri_gprmask; /* General registers used */ + Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ + Elf32_Sword ri_gp_value; /* $gp register value */ +} Elf32_RegInfo; + +/* Entries found in sections of type SHT_MIPS_OPTIONS. */ + +typedef struct +{ + unsigned char kind; /* Determines interpretation of the + variable part of descriptor. */ + unsigned char size; /* Size of descriptor, including header. */ + Elf32_Section section; /* Section header index of section affected, + 0 for global options. */ + Elf32_Word info; /* Kind-specific information. */ +} Elf_Options; + +/* Values for `kind' field in Elf_Options. */ + +#define ODK_NULL 0 /* Undefined. */ +#define ODK_REGINFO 1 /* Register usage information. */ +#define ODK_EXCEPTIONS 2 /* Exception processing options. */ +#define ODK_PAD 3 /* Section padding options. */ +#define ODK_HWPATCH 4 /* Hardware workarounds performed */ +#define ODK_FILL 5 /* record the fill value used by the linker. */ +#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ +#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ +#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ + +/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ + +#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ +#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ +#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ +#define OEX_SMM 0x20000 /* Force sequential memory mode? */ +#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ +#define OEX_PRECISEFP OEX_FPDBUG +#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ + +#define OEX_FPU_INVAL 0x10 +#define OEX_FPU_DIV0 0x08 +#define OEX_FPU_OFLO 0x04 +#define OEX_FPU_UFLO 0x02 +#define OEX_FPU_INEX 0x01 + +/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ + +#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ +#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ +#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ +#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ + +#define OPAD_PREFIX 0x1 +#define OPAD_POSTFIX 0x2 +#define OPAD_SYMBOL 0x4 + +/* Entry found in `.options' section. */ + +typedef struct +{ + Elf32_Word hwp_flags1; /* Extra flags. */ + Elf32_Word hwp_flags2; /* Extra flags. */ +} Elf_Options_Hw; + +/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ + +#define OHWA0_R4KEOP_CHECKED 0x00000001 +#define OHWA1_R4KEOP_CLEAN 0x00000002 + +/* MIPS relocs. */ + +#define R_MIPS_NONE 0 /* No reloc */ +#define R_MIPS_16 1 /* Direct 16 bit */ +#define R_MIPS_32 2 /* Direct 32 bit */ +#define R_MIPS_REL32 3 /* PC relative 32 bit */ +#define R_MIPS_26 4 /* Direct 26 bit shifted */ +#define R_MIPS_HI16 5 /* High 16 bit */ +#define R_MIPS_LO16 6 /* Low 16 bit */ +#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ +#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ +#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ +#define R_MIPS_PC16 10 /* PC relative 16 bit */ +#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ +#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ + +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +#define R_MIPS_GOT_HI16 22 +#define R_MIPS_GOT_LO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +#define R_MIPS_CALL_HI16 30 +#define R_MIPS_CALL_LO16 31 +#define R_MIPS_SCN_DISP 32 +#define R_MIPS_REL16 33 +#define R_MIPS_ADD_IMMEDIATE 34 +#define R_MIPS_PJUMP 35 +#define R_MIPS_RELGOT 36 +#define R_MIPS_JALR 37 +#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ +#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ +#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ +#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ +#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ +#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ +#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ +#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ +#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ +#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ +#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ +#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ +#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ +/* Keep this the last entry. */ +#define R_MIPS_NUM 51 + +/* Legal values for p_type field of Elf32_Phdr. */ + +#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ +#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ +#define PT_MIPS_OPTIONS 0x70000002 + +/* Special program header types. */ + +#define PF_MIPS_LOCAL 0x10000000 + +/* Legal values for d_tag field of Elf32_Dyn. */ + +#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ +#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ +#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ +#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ +#define DT_MIPS_FLAGS 0x70000005 /* Flags */ +#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ +#define DT_MIPS_MSYM 0x70000007 +#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ +#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ +#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ +#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ +#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ +#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ +#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ +#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ +#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ +#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ +#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ +#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in + DT_MIPS_DELTA_CLASS. */ +#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in + DT_MIPS_DELTA_INSTANCE. */ +#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in + DT_MIPS_DELTA_RELOC. */ +#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta + relocations refer to. */ +#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in + DT_MIPS_DELTA_SYM. */ +#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the + class declaration. */ +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in + DT_MIPS_DELTA_CLASSSYM. */ +#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ +#define DT_MIPS_PIXIE_INIT 0x70000023 +#define DT_MIPS_SYMBOL_LIB 0x70000024 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 +#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ +#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b +#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve + function stored in GOT. */ +#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added + by rld on dlopen() calls. */ +#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ +#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ +#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ +#define DT_MIPS_NUM 0x32 + +/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ + +#define RHF_NONE 0 /* No flags */ +#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ +#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ +#define RHF_NO_MOVE (1 << 3) +#define RHF_SGI_ONLY (1 << 4) +#define RHF_GUARANTEE_INIT (1 << 5) +#define RHF_DELTA_C_PLUS_PLUS (1 << 6) +#define RHF_GUARANTEE_START_INIT (1 << 7) +#define RHF_PIXIE (1 << 8) +#define RHF_DEFAULT_DELAY_LOAD (1 << 9) +#define RHF_REQUICKSTART (1 << 10) +#define RHF_REQUICKSTARTED (1 << 11) +#define RHF_CORD (1 << 12) +#define RHF_NO_UNRES_UNDEF (1 << 13) +#define RHF_RLD_ORDER_SAFE (1 << 14) + +/* Entries found in sections of type SHT_MIPS_LIBLIST. */ + +typedef struct +{ + Elf32_Word l_name; /* Name (string table index) */ + Elf32_Word l_time_stamp; /* Timestamp */ + Elf32_Word l_checksum; /* Checksum */ + Elf32_Word l_version; /* Interface version */ + Elf32_Word l_flags; /* Flags */ +} Elf32_Lib; + +typedef struct +{ + Elf64_Word l_name; /* Name (string table index) */ + Elf64_Word l_time_stamp; /* Timestamp */ + Elf64_Word l_checksum; /* Checksum */ + Elf64_Word l_version; /* Interface version */ + Elf64_Word l_flags; /* Flags */ +} Elf64_Lib; + + +/* Legal values for l_flags. */ + +#define LL_NONE 0 +#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ +#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ +#define LL_REQUIRE_MINOR (1 << 2) +#define LL_EXPORTS (1 << 3) +#define LL_DELAY_LOAD (1 << 4) +#define LL_DELTA (1 << 5) + +/* Entries found in sections of type SHT_MIPS_CONFLICT. */ + +typedef Elf32_Addr Elf32_Conflict; + + +/* HPPA specific definitions. */ + +/* Legal values for e_flags field of Elf32_Ehdr. */ + +#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ +#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ +#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ +#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ +#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch + prediction. */ +#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ +#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ + +/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ + +#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ +#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ +#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ + +/* Additional section indeces. */ + +#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared + symbols in ANSI C. */ +#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ + +/* Legal values for sh_type field of Elf32_Shdr. */ + +#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ +#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ +#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ + +/* Legal values for sh_flags field of Elf32_Shdr. */ + +#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ +#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ +#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type). */ + +#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ + +#define STT_HP_OPAQUE (STT_LOOS + 0x1) +#define STT_HP_STUB (STT_LOOS + 0x2) + +/* HPPA relocs. */ + +#define R_PARISC_NONE 0 /* No reloc. */ +#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ +#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ +#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ +#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ +#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ +#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ +#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ +#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ +#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ +#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ +#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ +#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ +#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ +#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ +#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ +#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ +#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ +#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ +#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ +#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ +#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ +#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ +#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ +#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ +#define R_PARISC_FPTR64 64 /* 64 bits function address. */ +#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ +#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ +#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ +#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ +#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ +#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ +#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ +#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ +#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ +#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ +#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ +#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ +#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ +#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ +#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ +#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ +#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ +#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ +#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ +#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ +#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ +#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ +#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ +#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ +#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ +#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ +#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ +#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ +#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ +#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ +#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ +#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ +#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ +#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ +#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ +#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ +#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ +#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ +#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ +#define R_PARISC_LORESERVE 128 +#define R_PARISC_COPY 128 /* Copy relocation. */ +#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ +#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ +#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ +#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ +#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ +#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ +#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ +#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ +#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ +#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ +#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ +#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ +#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ +#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ +#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ +#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ +#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ +#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ +#define R_PARISC_HIRESERVE 255 + +/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ + +#define PT_HP_TLS (PT_LOOS + 0x0) +#define PT_HP_CORE_NONE (PT_LOOS + 0x1) +#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) +#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) +#define PT_HP_CORE_COMM (PT_LOOS + 0x4) +#define PT_HP_CORE_PROC (PT_LOOS + 0x5) +#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) +#define PT_HP_CORE_STACK (PT_LOOS + 0x7) +#define PT_HP_CORE_SHM (PT_LOOS + 0x8) +#define PT_HP_CORE_MMF (PT_LOOS + 0x9) +#define PT_HP_PARALLEL (PT_LOOS + 0x10) +#define PT_HP_FASTBIND (PT_LOOS + 0x11) +#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) +#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) +#define PT_HP_STACK (PT_LOOS + 0x14) + +#define PT_PARISC_ARCHEXT 0x70000000 +#define PT_PARISC_UNWIND 0x70000001 + +/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ + +#define PF_PARISC_SBP 0x08000000 + +#define PF_HP_PAGE_SIZE 0x00100000 +#define PF_HP_FAR_SHARED 0x00200000 +#define PF_HP_NEAR_SHARED 0x00400000 +#define PF_HP_CODE 0x01000000 +#define PF_HP_MODIFY 0x02000000 +#define PF_HP_LAZYSWAP 0x04000000 +#define PF_HP_SBP 0x08000000 + + +/* Alpha specific definitions. */ + +/* Legal values for e_flags field of Elf64_Ehdr. */ + +#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ +#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ + +/* Legal values for sh_type field of Elf64_Shdr. */ + +/* These two are primerily concerned with ECOFF debugging info. */ +#define SHT_ALPHA_DEBUG 0x70000001 +#define SHT_ALPHA_REGINFO 0x70000002 + +/* Legal values for sh_flags field of Elf64_Shdr. */ + +#define SHF_ALPHA_GPREL 0x10000000 + +/* Legal values for st_other field of Elf64_Sym. */ +#define STO_ALPHA_NOPV 0x80 /* No PV required. */ +#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ + +/* Alpha relocs. */ + +#define R_ALPHA_NONE 0 /* No reloc */ +#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ +#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ +#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ +#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ +#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ +#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ +#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ +#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ +#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ +#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ +#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ +#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ +#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ +#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ +#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ +#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ +#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ +#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ +#define R_ALPHA_TLS_GD_HI 28 +#define R_ALPHA_TLSGD 29 +#define R_ALPHA_TLS_LDM 30 +#define R_ALPHA_DTPMOD64 31 +#define R_ALPHA_GOTDTPREL 32 +#define R_ALPHA_DTPREL64 33 +#define R_ALPHA_DTPRELHI 34 +#define R_ALPHA_DTPRELLO 35 +#define R_ALPHA_DTPREL16 36 +#define R_ALPHA_GOTTPREL 37 +#define R_ALPHA_TPREL64 38 +#define R_ALPHA_TPRELHI 39 +#define R_ALPHA_TPRELLO 40 +#define R_ALPHA_TPREL16 41 +/* Keep this the last entry. */ +#define R_ALPHA_NUM 46 + +/* Magic values of the LITUSE relocation addend. */ +#define LITUSE_ALPHA_ADDR 0 +#define LITUSE_ALPHA_BASE 1 +#define LITUSE_ALPHA_BYTOFF 2 +#define LITUSE_ALPHA_JSR 3 +#define LITUSE_ALPHA_TLS_GD 4 +#define LITUSE_ALPHA_TLS_LDM 5 + +/* Legal values for d_tag of Elf64_Dyn. */ +#define DT_ALPHA_PLTRO (DT_LOPROC + 0) +#define DT_ALPHA_NUM 1 + +/* PowerPC specific declarations */ + +/* Values for Elf32/64_Ehdr.e_flags. */ +#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ + +/* Cygnus local bits below */ +#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ +#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib + flag */ + +/* PowerPC relocations defined by the ABIs */ +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 /* 32bit absolute address */ +#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ +#define R_PPC_ADDR16 3 /* 16bit absolute address */ +#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ +#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ +#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ +#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 /* PC relative 26 bit */ +#define R_PPC_REL14 11 /* PC relative 16 bit */ +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + +/* PowerPC relocations defined for the TLS access ABI. */ +#define R_PPC_TLS 67 /* none (sym+add)@tls */ +#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ +#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ +#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ +#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ +#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ +#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ +#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ +#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ +#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ +#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ +#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ +#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ +#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ +#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ +#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ +#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ +#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ +#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ +#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ +#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ +#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ +#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ +#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ +#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ +#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ +#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ +#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ + +/* Keep this the last entry. */ +#define R_PPC_NUM 95 + +/* The remaining relocs are from the Embedded ELF ABI, and are not + in the SVR4 ELF ABI. */ +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ + +/* Diab tool relocations. */ +#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ +#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ +#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ +#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ +#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ +#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ + +/* GNU relocs used in PIC code sequences. */ +#define R_PPC_REL16 249 /* word32 (sym-.) */ +#define R_PPC_REL16_LO 250 /* half16 (sym-.)@l */ +#define R_PPC_REL16_HI 251 /* half16 (sym-.)@h */ +#define R_PPC_REL16_HA 252 /* half16 (sym-.)@ha */ + +/* This is a phony reloc to handle any old fashioned TOC16 references + that may still be in object files. */ +#define R_PPC_TOC16 255 + +/* PowerPC specific values for the Dyn d_tag field. */ +#define DT_PPC_GOT (DT_LOPROC + 0) +#define DT_PPC_NUM 1 + +/* PowerPC64 relocations defined by the ABIs */ +#define R_PPC64_NONE R_PPC_NONE +#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ +#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ +#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ +#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN +#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ +#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN +#define R_PPC64_GOT16 R_PPC_GOT16 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA + +#define R_PPC64_COPY R_PPC_COPY +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT +#define R_PPC64_RELATIVE R_PPC_RELATIVE + +#define R_PPC64_UADDR32 R_PPC_UADDR32 +#define R_PPC64_UADDR16 R_PPC_UADDR16 +#define R_PPC64_REL32 R_PPC_REL32 +#define R_PPC64_PLT32 R_PPC_PLT32 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA + +#define R_PPC64_SECTOFF R_PPC_SECTOFF +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA +#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ +#define R_PPC64_ADDR64 38 /* doubleword64 S + A */ +#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ +#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ +#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ +#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ +#define R_PPC64_UADDR64 43 /* doubleword64 S + A */ +#define R_PPC64_REL64 44 /* doubleword64 S + A - P */ +#define R_PPC64_PLT64 45 /* doubleword64 L + A */ +#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ +#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ +#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ +#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ +#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ +#define R_PPC64_TOC 51 /* doubleword64 .TOC */ +#define R_PPC64_PLTGOT16 52 /* half16* M + A */ +#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ +#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ +#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ + +#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ +#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ +#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ +#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ +#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ +#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ +#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ +#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ +#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ +#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ +#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ + +/* PowerPC64 relocations defined for the TLS access ABI. */ +#define R_PPC64_TLS 67 /* none (sym+add)@tls */ +#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ +#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ +#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ +#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ +#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ +#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ +#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ +#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ +#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ +#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ +#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ +#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ +#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ +#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ +#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ +#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ +#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ +#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ +#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ +#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ +#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ +#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ +#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ +#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ +#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ +#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ +#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ +#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ +#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ +#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ +#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ +#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ +#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ +#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ +#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ +#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ +#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ +#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ +#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ + +/* Keep this the last entry. */ +#define R_PPC64_NUM 107 + +/* PowerPC64 specific values for the Dyn d_tag field. */ +#define DT_PPC64_GLINK (DT_LOPROC + 0) +#define DT_PPC64_OPD (DT_LOPROC + 1) +#define DT_PPC64_OPDSZ (DT_LOPROC + 2) +#define DT_PPC64_NUM 3 + + +/* ARM specific declarations */ + +/* Processor specific flags for the ELF header e_flags field. */ +#define EF_ARM_RELEXEC 0x01 +#define EF_ARM_HASENTRY 0x02 +#define EF_ARM_INTERWORK 0x04 +#define EF_ARM_APCS_26 0x08 +#define EF_ARM_APCS_FLOAT 0x10 +#define EF_ARM_PIC 0x20 +#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ +#define EF_ARM_NEW_ABI 0x80 +#define EF_ARM_OLD_ABI 0x100 + +/* Other constants defined in the ARM ELF spec. version B-01. */ +/* NB. These conflict with values defined above. */ +#define EF_ARM_SYMSARESORTED 0x04 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08 +#define EF_ARM_MAPSYMSFIRST 0x10 +#define EF_ARM_EABIMASK 0XFF000000 + +#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) +#define EF_ARM_EABI_UNKNOWN 0x00000000 +#define EF_ARM_EABI_VER1 0x01000000 +#define EF_ARM_EABI_VER2 0x02000000 + +/* Additional symbol types for Thumb */ +#define STT_ARM_TFUNC 0xd + +/* ARM-specific values for sh_flags */ +#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ +#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined + in the input to a link step */ + +/* ARM-specific program header flags */ +#define PF_ARM_SB 0x10000000 /* Segment contains the location + addressed by the static base */ + +/* Processor specific values for the Phdr p_type field. */ +#define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */ + +/* ARM relocs. */ + +#define R_ARM_NONE 0 /* No reloc */ +#define R_ARM_PC24 1 /* PC relative 26 bit branch */ +#define R_ARM_ABS32 2 /* Direct 32 bit */ +#define R_ARM_REL32 3 /* PC relative 32 bit */ +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 /* Direct 16 bit */ +#define R_ARM_ABS12 6 /* Direct 12 bit */ +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 /* Direct 8 bit */ +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_SWI24 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_COPY 20 /* Copy symbol at runtime */ +#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ +#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ +#define R_ARM_RELATIVE 23 /* Adjust by program base */ +#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ +#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ +#define R_ARM_GOT32 26 /* 32 bit GOT entry */ +#define R_ARM_PLT32 27 /* 32 bit PLT address */ +#define R_ARM_ALU_PCREL_7_0 32 +#define R_ARM_ALU_PCREL_15_8 33 +#define R_ARM_ALU_PCREL_23_15 34 +#define R_ARM_LDR_SBREL_11_0 35 +#define R_ARM_ALU_SBREL_19_12 36 +#define R_ARM_ALU_SBREL_27_20 37 +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ +#define R_ARM_THM_PC9 103 /* thumb conditional branch */ +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS22 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 +/* Keep this the last entry. */ +#define R_ARM_NUM 256 + +/* IA-64 specific declarations. */ + +/* Processor specific flags for the Ehdr e_flags field. */ +#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ +#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ +#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ + +/* Processor specific values for the Phdr p_type field. */ +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ +#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ +#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) +#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) +#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) + +/* Processor specific flags for the Phdr p_flags field. */ +#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ + +/* Processor specific values for the Shdr sh_type field. */ +#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ + +/* Processor specific flags for the Shdr sh_flags field. */ +#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ +#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ + +/* Processor specific values for the Dyn d_tag field. */ +#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) +#define DT_IA_64_NUM 1 + +/* IA-64 relocations. */ +#define R_IA64_NONE 0x00 /* none */ +#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ +#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ +#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ +#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ +#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ +#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ +#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ +#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ +#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ +#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ +#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ +#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ +#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ +#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ +#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ +#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ +#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ +#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ +#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ +#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ +#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ +#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ +#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ +#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ +#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ +#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ +#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ +#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ +#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ +#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ +#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ +#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ +#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ +#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ +#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ +#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ +#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ +#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ +#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ +#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ +#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ +#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ +#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ +#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ +#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ +#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ +#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ +#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ +#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ +#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ +#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ +#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ +#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ +#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ +#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ +#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ +#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ +#define R_IA64_COPY 0x84 /* copy relocation */ +#define R_IA64_SUB 0x85 /* Addend and symbol difference */ +#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ +#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ +#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ +#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ +#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ +#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ +#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ +#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ +#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ +#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ +#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ +#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ +#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ +#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ +#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ +#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ +#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ +#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ + +/* SH specific declarations */ + +/* SH specific values for `st_other'. */ + +/* If set, this is a symbol pointing to SHmedia code, which will be branched + to, so need to add 1 to the symbol value. */ +#define STO_SH5_ISA32 (1 << 2) + +/* SH relocs. */ +#define R_SH_NONE 0 +#define R_SH_DIR32 1 +#define R_SH_REL32 2 +#define R_SH_DIR8WPN 3 +#define R_SH_IND12W 4 +#define R_SH_DIR8WPL 5 +#define R_SH_DIR8WPZ 6 +#define R_SH_DIR8BP 7 +#define R_SH_DIR8W 8 +#define R_SH_DIR8L 9 +#define R_SH_SWITCH16 25 +#define R_SH_SWITCH32 26 +#define R_SH_USES 27 +#define R_SH_COUNT 28 +#define R_SH_ALIGN 29 +#define R_SH_CODE 30 +#define R_SH_DATA 31 +#define R_SH_LABEL 32 +#define R_SH_SWITCH8 33 +#define R_SH_GNU_VTINHERIT 34 +#define R_SH_GNU_VTENTRY 35 +#define R_SH_TLS_GD_32 144 +#define R_SH_TLS_LD_32 145 +#define R_SH_TLS_LDO_32 146 +#define R_SH_TLS_IE_32 147 +#define R_SH_TLS_LE_32 148 +#define R_SH_TLS_DTPMOD32 149 +#define R_SH_TLS_DTPOFF32 150 +#define R_SH_TLS_TPOFF32 151 +#define R_SH_GOT32 160 +#define R_SH_PLT32 161 +#define R_SH_COPY 162 +#define R_SH_GLOB_DAT 163 +#define R_SH_JMP_SLOT 164 +#define R_SH_RELATIVE 165 +#define R_SH_GOTOFF 166 +#define R_SH_GOTPC 167 +#define R_SH_RELATIVE_LOW16 197 +#define R_SH_RELATIVE_MEDLOW16 198 +#define R_SH_IMM_LOW16 246 +#define R_SH_IMM_LOW16_PCREL 247 +#define R_SH_IMM_MEDLOW16 248 +#define R_SH_IMM_MEDLOW16_PCREL 249 + +/* Keep this the last entry. */ +#define R_SH_NUM 256 + +/* Additional s390 relocs */ + +#define R_390_NONE 0 /* No reloc. */ +#define R_390_8 1 /* Direct 8 bit. */ +#define R_390_12 2 /* Direct 12 bit. */ +#define R_390_16 3 /* Direct 16 bit. */ +#define R_390_32 4 /* Direct 32 bit. */ +#define R_390_PC32 5 /* PC relative 32 bit. */ +#define R_390_GOT12 6 /* 12 bit GOT offset. */ +#define R_390_GOT32 7 /* 32 bit GOT offset. */ +#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ +#define R_390_COPY 9 /* Copy symbol at runtime. */ +#define R_390_GLOB_DAT 10 /* Create GOT entry. */ +#define R_390_JMP_SLOT 11 /* Create PLT entry. */ +#define R_390_RELATIVE 12 /* Adjust by program base. */ +#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ +#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ +#define R_390_GOT16 15 /* 16 bit GOT offset. */ +#define R_390_PC16 16 /* PC relative 16 bit. */ +#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ +#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ +#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ +#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ +#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ +#define R_390_64 22 /* Direct 64 bit. */ +#define R_390_PC64 23 /* PC relative 64 bit. */ +#define R_390_GOT64 24 /* 64 bit GOT offset. */ +#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ +#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ +#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ +#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ +#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ +#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ +#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ +#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ +#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ +#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ +#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ +#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ +#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ +#define R_390_TLS_GDCALL 38 /* Tag for function call in general + dynamic TLS code. */ +#define R_390_TLS_LDCALL 39 /* Tag for function call in local + dynamic TLS code. */ +#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic + thread local data. */ +#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic + thread local data. */ +#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS + block offset. */ +#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS + block offset. */ +#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS + block offset. */ +#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic + thread local data in LE code. */ +#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic + thread local data in LE code. */ +#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for + negated static TLS block offset. */ +#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for + negated static TLS block offset. */ +#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for + negated static TLS block offset. */ +#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to + static TLS block. */ +#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to + static TLS block. */ +#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS + block. */ +#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS + block. */ +#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ +#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ +#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS + block. */ +#define R_390_20 57 /* Direct 20 bit. */ +#define R_390_GOT20 58 /* 20 bit GOT offset. */ +#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ +#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS + block offset. */ +/* Keep this the last entry. */ +#define R_390_NUM 61 + + +/* CRIS flags. */ +#define EF_CRIS_VARIANT_MASK 0x0000000e +#define EF_CRIS_VARIANT_ANY_V0_V10 0x00000000 +#define EF_CRIS_VARIANT_V32 0x00000002 +#define EF_CRIS_VARIANT_COMMON_V10_V32 0x00000004 + +/* CRIS relocations. */ +#define R_CRIS_NONE 0 +#define R_CRIS_8 1 +#define R_CRIS_16 2 +#define R_CRIS_32 3 +#define R_CRIS_8_PCREL 4 +#define R_CRIS_16_PCREL 5 +#define R_CRIS_32_PCREL 6 +#define R_CRIS_GNU_VTINHERIT 7 +#define R_CRIS_GNU_VTENTRY 8 +#define R_CRIS_COPY 9 +#define R_CRIS_GLOB_DAT 10 +#define R_CRIS_JUMP_SLOT 11 +#define R_CRIS_RELATIVE 12 +#define R_CRIS_16_GOT 13 +#define R_CRIS_32_GOT 14 +#define R_CRIS_16_GOTPLT 15 +#define R_CRIS_32_GOTPLT 16 +#define R_CRIS_32_GOTREL 17 +#define R_CRIS_32_PLT_GOTREL 18 +#define R_CRIS_32_PLT_PCREL 19 + +/* Keep this the last entry. */ +#define R_CRIS_NUM 20 + + +/* AMD x86-64 relocations. */ +#define R_X86_64_NONE 0 /* No reloc */ +#define R_X86_64_64 1 /* Direct 64 bit */ +#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ +#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ +#define R_X86_64_PLT32 4 /* 32 bit PLT address */ +#define R_X86_64_COPY 5 /* Copy symbol at runtime */ +#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ +#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ +#define R_X86_64_RELATIVE 8 /* Adjust by program base */ +#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative + offset to GOT */ +#define R_X86_64_32 10 /* Direct 32 bit zero extended */ +#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ +#define R_X86_64_16 12 /* Direct 16 bit zero extended */ +#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ +#define R_X86_64_8 14 /* Direct 8 bit sign extended */ +#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ +#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ +#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ +#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ +#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset + to two GOT entries for GD symbol */ +#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset + to two GOT entries for LD symbol */ +#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ +#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset + to GOT entry for IE symbol */ +#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ + +#define R_X86_64_NUM 24 + + +/* AM33 relocations. */ +#define R_MN10300_NONE 0 /* No reloc. */ +#define R_MN10300_32 1 /* Direct 32 bit. */ +#define R_MN10300_16 2 /* Direct 16 bit. */ +#define R_MN10300_8 3 /* Direct 8 bit. */ +#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ +#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ +#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ +#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ +#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ +#define R_MN10300_24 9 /* Direct 24 bit. */ +#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ +#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ +#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ +#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ +#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ +#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ +#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ +#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ +#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ +#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ +#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ +#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ +#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ +#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ + +#define R_MN10300_NUM 24 + + +/* M32R relocs. */ +#define R_M32R_NONE 0 /* No reloc. */ +#define R_M32R_16 1 /* Direct 16 bit. */ +#define R_M32R_32 2 /* Direct 32 bit. */ +#define R_M32R_24 3 /* Direct 24 bit. */ +#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ +#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ +#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ +#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ +#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ +#define R_M32R_LO16 9 /* Low 16 bit. */ +#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 +/* M32R relocs use SHT_RELA. */ +#define R_M32R_16_RELA 33 /* Direct 16 bit. */ +#define R_M32R_32_RELA 34 /* Direct 32 bit. */ +#define R_M32R_24_RELA 35 /* Direct 24 bit. */ +#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ +#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ +#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ +#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ +#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ +#define R_M32R_LO16_RELA 41 /* Low 16 bit */ +#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 + +#define R_M32R_GOT24 48 /* 24 bit GOT entry */ +#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ +#define R_M32R_COPY 50 /* Copy symbol at runtime */ +#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ +#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ +#define R_M32R_RELATIVE 53 /* Adjust by program base */ +#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ +#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ +#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned + low */ +#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed + low */ +#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ +#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to + GOT with unsigned low */ +#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to + GOT with signed low */ +#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to + GOT */ +#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT + with unsigned low */ +#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT + with signed low */ +#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ +#define R_M32R_NUM 256 /* Keep this the last entry. */ + +/* i960 Relocations */ +#define R_960_NONE 0 +#define R_960_12 1 +#define R_960_32 2 +#define R_960_IP24 3 +#define R_960_SUB 4 +#define R_960_OPTCALL 5 +#define R_960_OPTCALLX 6 +#define R_960_OPTCALLXA 7 +/* Keep this the last entry. */ +#define R_960_NUM 8 + + +/* v850 relocations. */ +#define R_V850_NONE 0 +#define R_V850_9_PCREL 1 +#define R_V850_22_PCREL 2 +#define R_V850_HI16_S 3 +#define R_V850_HI16 4 +#define R_V850_LO16 5 +#define R_V850_32 6 +#define R_V850_16 7 +#define R_V850_8 8 +#define R_V850_SDA_16_16_OFFSET 9 /* For ld.b, st.b, set1, clr1, + not1, tst1, movea, movhi */ +#define R_V850_SDA_15_16_OFFSET 10 /* For ld.w, ld.h, ld.hu, st.w, st.h */ +#define R_V850_ZDA_16_16_OFFSET 11 /* For ld.b, st.b, set1, clr1, + not1, tst1, movea, movhi */ +#define R_V850_ZDA_15_16_OFFSET 12 /* For ld.w, ld.h, ld.hu, st.w, st.h */ +#define R_V850_TDA_6_8_OFFSET 13 /* For sst.w, sld.w */ +#define R_V850_TDA_7_8_OFFSET 14 /* For sst.h, sld.h */ +#define R_V850_TDA_7_7_OFFSET 15 /* For sst.b, sld.b */ +#define R_V850_TDA_16_16_OFFSET 16 /* For set1, clr1, not1, tst1, + movea, movhi */ +/* CYGNUS LOCAL v850e */ +#define R_V850_TDA_4_5_OFFSET 17 /* For sld.hu */ +#define R_V850_TDA_4_4_OFFSET 18 /* For sld.bu */ +#define R_V850_SDA_16_16_SPLIT_OFFSET 19 /* For ld.bu */ +#define R_V850_ZDA_16_16_SPLIT_OFFSET 20 /* For ld.bu */ +#define R_V850_CALLT_6_7_OFFSET 21 /* For callt */ +#define R_V850_CALLT_16_16_OFFSET 22 /* For callt */ +/* END CYGNUS LOCAL */ +#define R_V850_GNU_VTINHERIT 23 +#define R_V850_GNU_VTENTRY 24 +/* Keep this the last entry. */ +#define R_V850_NUM 25 + + +/* Renesas H8/300 Relocations */ +#define R_H8_NONE 0 +#define R_H8_DIR32 1 +#define R_H8_DIR32_28 2 +#define R_H8_DIR32_24 3 +#define R_H8_DIR32_16 4 +#define R_H8_DIR32U 6 +#define R_H8_DIR32U_28 7 +#define R_H8_DIR32U_24 8 +#define R_H8_DIR32U_20 9 +#define R_H8_DIR32U_16 10 +#define R_H8_DIR24 11 +#define R_H8_DIR24_20 12 +#define R_H8_DIR24_16 13 +#define R_H8_DIR24U 14 +#define R_H8_DIR24U_20 15 +#define R_H8_DIR24U_16 16 +#define R_H8_DIR16 17 +#define R_H8_DIR16U 18 +#define R_H8_DIR16S_32 19 +#define R_H8_DIR16S_28 20 +#define R_H8_DIR16S_24 21 +#define R_H8_DIR16S_20 22 +#define R_H8_DIR16S 23 +#define R_H8_DIR8 24 +#define R_H8_DIR8U 25 +#define R_H8_DIR8Z_32 26 +#define R_H8_DIR8Z_28 27 +#define R_H8_DIR8Z_24 28 +#define R_H8_DIR8Z_20 29 +#define R_H8_DIR8Z_16 30 +#define R_H8_PCREL16 31 +#define R_H8_PCREL8 32 +#define R_H8_BPOS 33 +#define R_H8_PCREL32 34 +#define R_H8_GOT32O 35 +#define R_H8_GOT16O 36 +#define R_H8_DIR16A8 59 +#define R_H8_DIR16R8 60 +#define R_H8_DIR24A8 61 +#define R_H8_DIR24R8 62 +#define R_H8_DIR32A16 63 +#define R_H8_ABS32 65 +#define R_H8_ABS32A16 127 +#define R_H8_NUM 128 + +/* NIOS relocations. */ +#define R_NIOS_NONE 0 +#define R_NIOS_32 1 /* A 32 bit absolute relocation.*/ +#define R_NIOS_LO16_LO5 2 /* A LO-16 5 bit absolute relocation. */ +#define R_NIOS_LO16_HI11 3 /* A LO-16 top 11 bit absolute relocation. */ +#define R_NIOS_HI16_LO5 4 /* A HI-16 5 bit absolute relocation. */ +#define R_NIOS_HI16_HI11 5 /* A HI-16 top 11 bit absolute relocation. */ +#define R_NIOS_PCREL6 6 /* A 6 bit relative relocation. */ +#define R_NIOS_PCREL8 7 /* An 8 bit relative relocation. */ +#define R_NIOS_PCREL11 8 /* An 11 bit relative relocation. */ +#define R_NIOS_16 9 /* A 16 bit absolute relocation. */ +#define R_NIOS_H_LO5 10 /* Low 5-bits of absolute relocation in halfwords. */ +#define R_NIOS_H_HI11 11 /* Top 11 bits of 16-bit absolute relocation in halfwords. */ +#define R_NIOS_H_XLO5 12 /* Low 5 bits of top 16-bits of 32-bit absolute relocation in halfwords. */ +#define R_NIOS_H_XHI11 13 /* Top 11 bits of top 16-bits of 32-bit absolute relocation in halfwords. */ +#define R_NIOS_H_16 14 /* Half-word @h value */ +#define R_NIOS_H_32 15 /* Word @h value */ +#define R_NIOS_GNU_VTINHERIT 200 /* GNU extension to record C++ vtable hierarchy */ +#define R_NIOS_GNU_VTENTRY 201 /* GNU extension to record C++ vtable member usage */ +/* Keep this the last entry. */ +#define R_NIOS_NUM 202 + +/* NIOS II relocations */ +#define R_NIOS2_NONE 0 +#define R_NIOS2_S16 1 +#define R_NIOS2_U16 2 +#define R_NIOS2_PCREL16 3 +#define R_NIOS2_CALL26 4 +#define R_NIOS2_IMM5 5 +#define R_NIOS2_CACHE_OPX 6 +#define R_NIOS2_IMM6 7 +#define R_NIOS2_IMM8 8 +#define R_NIOS2_HI16 9 +#define R_NIOS2_LO16 10 +#define R_NIOS2_HIADJ16 11 +#define R_NIOS2_BFD_RELOC_32 12 +#define R_NIOS2_BFD_RELOC_16 13 +#define R_NIOS2_BFD_RELOC_8 14 +#define R_NIOS2_GPREL 15 +#define R_NIOS2_GNU_VTINHERIT 16 +#define R_NIOS2_GNU_VTENTRY 17 +#define R_NIOS2_UJMP 18 +#define R_NIOS2_CJMP 19 +#define R_NIOS2_CALLR 20 +#define R_NIOS2_ALIGN 21 +/* Keep this the last entry. */ +#define R_NIOS2_NUM 22 + +__END_DECLS + +#endif /* elf.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/endian.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/endian.h new file mode 100644 index 0000000..2f7bce1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/endian.h @@ -0,0 +1,58 @@ +/* Copyright (C) 1992, 1996, 1997, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ENDIAN_H +#define _ENDIAN_H 1 + +#include + +/* Definitions for byte order, according to significance of bytes, + from low addresses to high addresses. The value is what you get by + putting '4' in the most significant byte, '3' in the second most + significant byte, '2' in the second least significant byte, and '1' + in the least significant byte, and then writing down one digit for + each byte, starting with the byte at the lowest address at the left, + and proceeding to the byte with the highest address at the right. */ + +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __PDP_ENDIAN 3412 + +/* This file defines `__BYTE_ORDER' for the particular machine. */ +#include + +/* Some machines may need to use a different endianness for floating point + values. */ +#ifndef __FLOAT_WORD_ORDER +# define __FLOAT_WORD_ORDER __BYTE_ORDER +#endif + +#ifdef __USE_BSD +# define LITTLE_ENDIAN __LITTLE_ENDIAN +# define BIG_ENDIAN __BIG_ENDIAN +# define PDP_ENDIAN __PDP_ENDIAN +# define BYTE_ORDER __BYTE_ORDER +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) LO, HI +#elif __BYTE_ORDER == __BIG_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) HI, LO +#endif + +#endif /* endian.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/err.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/err.h new file mode 100644 index 0000000..7ff3553 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/err.h @@ -0,0 +1,58 @@ +/* 4.4BSD utility functions for error messages. + Copyright (C) 1995,1996,1997,1998,1999,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ERR_H +#define _ERR_H 1 + +#include + +#define __need___va_list +#include +#ifndef __GNUC_VA_LIST +# define __gnuc_va_list __ptr_t +#endif + +__BEGIN_DECLS + +/* Print "program: ", FORMAT, ": ", the standard error string for errno, + and a newline, on stderr. */ +extern void warn (__const char *__format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); +extern void vwarn (__const char *__format, __gnuc_va_list) + __attribute__ ((__format__ (__printf__, 1, 0))); + +/* Likewise, but without ": " and the standard error string. */ +extern void warnx (__const char *__format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); +extern void vwarnx (__const char *__format, __gnuc_va_list) + __attribute__ ((__format__ (__printf__, 1, 0))); + +/* Likewise, and then exit with STATUS. */ +extern void err (int __status, __const char *__format, ...) + __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); +extern void verr (int __status, __const char *__format, __gnuc_va_list) + __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); +extern void errx (int __status, __const char *__format, ...) + __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); +extern void verrx (int __status, __const char *, __gnuc_va_list) + __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); + +__END_DECLS + +#endif /* err.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/errno.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/errno.h new file mode 100644 index 0000000..aef117e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/errno.h @@ -0,0 +1,77 @@ +/* Copyright (C) 1991,92,93,94,95,96,97,2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.5 Errors + */ + +#ifndef _ERRNO_H + +/* The includer defined __need_Emath if he wants only the definitions + of EDOM and ERANGE, and not everything else. */ +#ifndef __need_Emath +# define _ERRNO_H 1 +# include +#endif + +__BEGIN_DECLS + +/* Get the error number constants from the system-specific file. + This file will test __need_Emath and _ERRNO_H. */ +#include +#undef __need_Emath + +#ifdef _ERRNO_H + +/* Declare the `errno' variable, unless it's defined as a macro by + bits/errno.h. This is the case in GNU, where it is a per-thread + variable. This redeclaration using the macro still works, but it + will be a function declaration without a prototype and may trigger + a -Wstrict-prototypes warning. */ +#ifndef errno +extern int errno; +#endif + +#if defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ + +/* The full and simple forms of the name with which the program was + invoked. These variables are set up automatically at startup based on + the value of ARGV[0] (this works only if you use GNU ld). */ +extern char *program_invocation_name, *program_invocation_short_name; +#endif /* __USE_GNU */ +#endif /* _ERRNO_H */ + +__END_DECLS + +#if defined _LIBC && ( defined IS_IN_libc || defined NOT_IN_libc ) +#include +#endif + +#endif /* _ERRNO_H */ + +/* The Hurd defines `error_t' as an enumerated type so + that printing `error_t' values in the debugger shows the names. We + might need this definition sometimes even if this file was included + before. */ +#if defined __USE_GNU || defined __need_error_t +# ifndef __error_t_defined +typedef int error_t; +# define __error_t_defined 1 +# endif +# undef __need_error_t +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/error.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/error.h new file mode 100644 index 0000000..b553cae --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/error.h @@ -0,0 +1,52 @@ +/* Declaration for error-reporting function + Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ERROR_H +#define _ERROR_H 1 + +#include + +__BEGIN_DECLS + +/* Print a message with `fprintf (stderr, FORMAT, ...)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ + +extern void error (int __status, int __errnum, const char *__format, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); + +extern void error_at_line (int __status, int __errnum, const char *__fname, + unsigned int __lineno, const char *__format, ...) + __attribute__ ((__format__ (__printf__, 5, 6))); + +/* If NULL, error will flush stdout, then print on stderr the program + name, a colon and a space. Otherwise, error will call this + function without parameters instead. */ +extern void (*error_print_progname) (void); + +/* This variable is incremented each time `error' is called. */ +extern unsigned int error_message_count; + +/* Sometimes we want to have at most one error per line. This + variable controls whether this mode is selected or not. */ +extern int error_one_per_line; + +__END_DECLS + +#endif /* error.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/fcntl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/fcntl.h new file mode 100644 index 0000000..a438902 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/fcntl.h @@ -0,0 +1,228 @@ +/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 6.5 File Control Operations + */ + +#ifndef _FCNTL_H +#define _FCNTL_H 1 + +#include + +/* This must be early so can define types winningly. */ +__BEGIN_DECLS + +/* Get the definitions of O_*, F_*, FD_*: all the + numbers and flag bits for `open', `fcntl', et al. */ +#include + +/* For XPG all symbols from should also be available. */ +#ifdef __USE_XOPEN +# include +#endif + +#ifdef __USE_MISC +# ifndef R_OK /* Verbatim from . Ugh. */ +/* Values for the second argument to access. + These may be OR'd together. */ +# define R_OK 4 /* Test for read permission. */ +# define W_OK 2 /* Test for write permission. */ +# define X_OK 1 /* Test for execute permission. */ +# define F_OK 0 /* Test for existence. */ +# endif +#endif /* Use misc. */ + +/* XPG wants the following symbols. */ +#ifdef __USE_XOPEN /* has the same definitions. */ +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Seek from end of file. */ +#endif /* XPG */ + +#if 0 /*def __USE_GNU*/ +# define AT_FDCWD -100 /* Special value used to indicate + openat should use the current + working directory. */ +# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ +# define AT_REMOVEDIR 0x200 /* Remove directory instead of + unlinking file. */ +#endif + +/* Do the file control operation described by CMD on FD. + The remaining arguments are interpreted depending on CMD. + + This function is a cancellation point and therefore not marked with + __THROW. */ +#ifndef __USE_FILE_OFFSET64 +extern int fcntl (int __fd, int __cmd, ...); +#else +# ifdef __REDIRECT +extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); +# else +# define fcntl fcntl64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int fcntl64 (int __fd, int __cmd, ...); +#endif + +/* Open FILE and return a new file descriptor for it, or -1 on error. + OFLAG determines the type of access used. If O_CREAT is on OFLAG, + the third argument is taken as a `mode_t', the mode of the created file. + + This function is a cancellation point and therefore not marked with + __THROW. */ +#ifndef __USE_FILE_OFFSET64 +extern int open (__const char *__file, int __oflag, ...) __nonnull ((1)); +#else +# ifdef __REDIRECT +extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64) + __nonnull ((1)); +# else +# define open open64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1)); +#endif + +#if 0 /*def __USE_GNU*/ +/* Similar to OPEN but a relative path name is interpreted relative to + the directory for which FD is a descriptor. + + NOTE: some other OPENAT implementation support additional functionality + through this interface, especially using the O_XATTR flag. This is not + yet supported here. + + This function is a cancellation point and therefore not marked with + __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int openat (int __fd, __const char *__file, int __oflag, ...) + __nonnull ((2)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag, + ...), openat64) __nonnull ((2)); +# else +# define openat openat64 +# endif +# endif + +extern int openat64 (int __fd, __const char *__file, int __oflag, ...) + __nonnull ((2)); +#endif + +/* Create and open FILE, with mode MODE. This takes an `int' MODE + argument because that is what `mode_t' will be widened to. + + This function is a cancellation point and therefore not marked with + __THROW. */ +#ifndef __USE_FILE_OFFSET64 +extern int creat (__const char *__file, __mode_t __mode) __nonnull ((1)); +#else +# ifdef __REDIRECT +extern int __REDIRECT (creat, (__const char *__file, __mode_t __mode), + creat64) __nonnull ((1)); +# else +# define creat creat64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int creat64 (__const char *__file, __mode_t __mode) __nonnull ((1)); +#endif + +#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ + && !defined __USE_POSIX)) +/* NOTE: These declarations also appear in ; be sure to keep both + files consistent. Some systems have them there and some here, and some + software depends on the macros being defined without including both. */ + +/* `lockf' is a simpler interface to the locking facilities of `fcntl'. + LEN is always relative to the current file position. + The CMD argument is one of the following. */ + +# define F_ULOCK 0 /* Unlock a previously locked region. */ +# define F_LOCK 1 /* Lock a region for exclusive use. */ +# define F_TLOCK 2 /* Test and lock a region for exclusive use. */ +# define F_TEST 3 /* Test a region for other processes locks. */ + +# ifndef __USE_FILE_OFFSET64 +extern int lockf (int __fd, int __cmd, __off_t __len); +# else +# ifdef __REDIRECT +extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64); +# else +# define lockf lockf64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int lockf64 (int __fd, int __cmd, __off64_t __len); +# endif +#endif + +#ifdef __USE_XOPEN2K +/* Advice the system about the expected behaviour of the application with + respect to the file associated with FD. */ +# ifndef __USE_FILE_OFFSET64 +extern int posix_fadvise (int __fd, __off_t __offset, __off_t __len, + int __advise) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset, + __off64_t __len, int __advise), + posix_fadvise64); +# else +# define posix_fadvise posix_fadvise64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len, + int __advise) __THROW; +# endif + +#endif + +#if 0 + +/* FIXME -- uClibc should probably implement these... */ + +/* Reserve storage for the data of the file associated with FD. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len); +# else +# ifdef __REDIRECT +extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset, + __off64_t __len), + posix_fallocate64); +# else +# define posix_fallocate posix_fallocate64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len); +# endif +#endif + +__END_DECLS + +#endif /* fcntl.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/features.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/features.h new file mode 100644 index 0000000..aab3b7c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/features.h @@ -0,0 +1,424 @@ +/* Copyright (C) 1991-1993,1995-2003,2004,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FEATURES_H +#define _FEATURES_H 1 + +/* This macro indicates that the installed library is uClibc. Use + * __UCLIBC_MAJOR__ and __UCLIBC_MINOR__ to test for the features in + * specific releases. */ +#define __UCLIBC__ 1 + +/* Load up the current set of uClibc supported features along + * with the current uClibc major and minor version numbers. + * For uClibc release 0.9.26, these numbers would be: + * #define __UCLIBC_MAJOR__ 0 + * #define __UCLIBC_MINOR__ 9 + * #define __UCLIBC_SUBLEVEL__ 26 + */ +#define __need_uClibc_config_h +#include +#undef __need_uClibc_config_h +#include + +/* For uClibc, always optimize for size -- this should disable + * a lot of expensive inlining... */ +#define __OPTIMIZE_SIZE__ 1 + +/* These are defined by the user (or the compiler) + to specify the desired environment: + + __STRICT_ANSI__ ISO Standard C. + _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. + _POSIX_SOURCE IEEE Std 1003.1. + _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; + if >=199309L, add IEEE Std 1003.1b-1993; + if >=199506L, add IEEE Std 1003.1c-1995; + if >=200112L, all of IEEE 1003.1-2004 + _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if + Single Unix conformance is wanted, to 600 for the + upcoming sixth revision. + _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. + _LARGEFILE_SOURCE Some more functions for correct standard I/O. + _LARGEFILE64_SOURCE Additional functionality from LFS for large files. + _FILE_OFFSET_BITS=N Select default filesystem interface. + _BSD_SOURCE ISO C, POSIX, and 4.3BSD things. + _SVID_SOURCE ISO C, POSIX, and SVID things. + _ATFILE_SOURCE Additional *at interfaces. + _GNU_SOURCE All of the above, plus GNU extensions. + _REENTRANT Select additionally reentrant object. + _THREAD_SAFE Same as _REENTRANT, often used by other systems. + _FORTIFY_SOURCE If set to numeric value > 0 additional security + measures are defined, according to level. + + The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__. + If none of these are defined, the default is to have _SVID_SOURCE, + _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to + 199506L. If more than one of these are defined, they accumulate. + For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE + together give you ISO C, 1003.1, and 1003.2, but nothing else. + + These are defined by this file and are used by the + header files to decide what to declare or define: + + __USE_ISOC99 Define ISO C99 things. + __USE_POSIX Define IEEE Std 1003.1 things. + __USE_POSIX2 Define IEEE Std 1003.2 things. + __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. + __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things. + __USE_XOPEN Define XPG things. + __USE_XOPEN_EXTENDED Define X/Open Unix things. + __USE_UNIX98 Define Single Unix V2 things. + __USE_XOPEN2K Define XPG6 things. + __USE_LARGEFILE Define correct standard I/O things. + __USE_LARGEFILE64 Define LFS things with separate names. + __USE_FILE_OFFSET64 Define 64bit interface as default. + __USE_BSD Define 4.3BSD things. + __USE_SVID Define SVID things. + __USE_MISC Define things common to BSD and System V Unix. + __USE_ATFILE Define *at interfaces and AT_* constants for them. + __USE_GNU Define GNU extensions. + __USE_REENTRANT Define reentrant/thread-safe *_r functions. + __USE_FORTIFY_LEVEL Additional security measures used, according to level. + __FAVOR_BSD Favor 4.3BSD things in cases of conflict. + + The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are + defined by this file unconditionally. `__GNU_LIBRARY__' is provided + only for compatibility. All new code should use the other symbols + to test for features. + + All macros listed above as possibly being defined by this file are + explicitly undefined if they are not explicitly defined. + Feature-test macros that are not defined by the user or compiler + but are implied by the other feature-test macros defined (or by the + lack of any definitions) are defined by the file. */ + + +/* Undefine everything, so we get a clean slate. */ +#undef __USE_ISOC99 +#undef __USE_POSIX +#undef __USE_POSIX2 +#undef __USE_POSIX199309 +#undef __USE_POSIX199506 +#undef __USE_XOPEN +#undef __USE_XOPEN_EXTENDED +#undef __USE_UNIX98 +#undef __USE_XOPEN2K +#undef __USE_LARGEFILE +#undef __USE_LARGEFILE64 +#undef __USE_FILE_OFFSET64 +#undef __USE_BSD +#undef __USE_SVID +#undef __USE_MISC +#undef __USE_ATFILE +#undef __USE_GNU +#undef __USE_REENTRANT +#undef __USE_FORTIFY_LEVEL +#undef __FAVOR_BSD +#undef __KERNEL_STRICT_NAMES + +/* Suppress kernel-name space pollution unless user expressedly asks + for it. */ +#ifndef _LOOSE_KERNEL_NAMES +# define __KERNEL_STRICT_NAMES +#endif + +/* Always use ISO C things. */ +#define __USE_ANSI 1 + +/* Convenience macros to test the versions of glibc and gcc. + Use them like this: + #if __GNUC_PREREQ(2,8) + ... code requiring gcc 2.8 or later ... + #endif + Note - they won't work for gcc1 or glibc1, since the _MINOR macros + were not defined then. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +# define __GNUC_PREREQ(maj, min) 0 +#endif + + +/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ +#if defined _BSD_SOURCE && \ + !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \ + defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \ + defined _GNU_SOURCE || defined _SVID_SOURCE) +# define __FAVOR_BSD 1 +#endif + +/* If _GNU_SOURCE was defined by the user, turn on all the other features. */ +#ifdef _GNU_SOURCE +# undef _ISOC99_SOURCE +# define _ISOC99_SOURCE 1 +# undef _POSIX_SOURCE +# define _POSIX_SOURCE 1 +# undef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 199506L +# undef _XOPEN_SOURCE +# define _XOPEN_SOURCE 600 +# undef _XOPEN_SOURCE_EXTENDED +# define _XOPEN_SOURCE_EXTENDED 1 +# ifdef __UCLIBC_HAS_LFS__ +# undef _LARGEFILE64_SOURCE +# define _LARGEFILE64_SOURCE 1 +# endif /* __UCLIBC_HAS_LFS__ */ +# undef _BSD_SOURCE +# define _BSD_SOURCE 1 +# undef _SVID_SOURCE +# define _SVID_SOURCE 1 +# undef _ATFILE_SOURCE +# define _ATFILE_SOURCE 1 +#endif + +/* If nothing (other than _GNU_SOURCE) is defined, + define _BSD_SOURCE and _SVID_SOURCE. */ +#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \ + !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \ + !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \ + !defined _BSD_SOURCE && !defined _SVID_SOURCE) +# define _BSD_SOURCE 1 +# define _SVID_SOURCE 1 +#endif + +/* This is to enable the ISO C99 extension. Also recognize the old macro + which was used prior to the standard acceptance. This macro will + eventually go away and the features enabled by default once the ISO C99 + standard is widely adopted. */ +#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) +# define __USE_ISOC99 1 +#endif + +/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2 + (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */ +#if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \ + !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE) +# define _POSIX_SOURCE 1 +# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500 +# define _POSIX_C_SOURCE 2 +# else +# define _POSIX_C_SOURCE 199506L +# endif +#endif + +#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE +# define __USE_POSIX 1 +#endif + +#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE +# define __USE_POSIX2 1 +#endif + +#if (_POSIX_C_SOURCE - 0) >= 199309L +# define __USE_POSIX199309 1 +#endif + +#if (_POSIX_C_SOURCE - 0) >= 199506L +# define __USE_POSIX199506 1 +#endif + +#if (_POSIX_C_SOURCE - 0) >= 200112L +# define __USE_XOPEN2K 1 +#endif + +#ifdef _XOPEN_SOURCE +# define __USE_XOPEN 1 +# if (_XOPEN_SOURCE - 0) >= 500 +# define __USE_XOPEN_EXTENDED 1 +# define __USE_UNIX98 1 +# undef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# if (_XOPEN_SOURCE - 0) >= 600 +# define __USE_XOPEN2K 1 +# undef __USE_ISOC99 +# define __USE_ISOC99 1 +# endif +# else +# ifdef _XOPEN_SOURCE_EXTENDED +# define __USE_XOPEN_EXTENDED 1 +# endif +# endif +#endif + +#ifdef _LARGEFILE_SOURCE +# define __USE_LARGEFILE 1 +#endif + +#ifdef _LARGEFILE64_SOURCE +# define __USE_LARGEFILE64 1 +#endif + +#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 +# define __USE_FILE_OFFSET64 1 +#endif + +#if defined _BSD_SOURCE || defined _SVID_SOURCE +# define __USE_MISC 1 +#endif + +#ifdef _BSD_SOURCE +# define __USE_BSD 1 +#endif + +#ifdef _SVID_SOURCE +# define __USE_SVID 1 +#endif + +#ifdef _ATFILE_SOURCE +# define __USE_ATFILE 1 +#endif + +#ifdef _GNU_SOURCE +# define __USE_GNU 1 +#endif + +#if defined _REENTRANT || defined _THREAD_SAFE +# define __USE_REENTRANT 1 +#endif + +/* uClibc does not support _FORTIFY_SOURCE */ +#undef _FORTIFY_SOURCE +#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \ + && __GNUC_PREREQ(4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 +# if _FORTIFY_SOURCE > 1 +# define __USE_FORTIFY_LEVEL 2 +# else +# define __USE_FORTIFY_LEVEL 1 +# endif +#else +# define __USE_FORTIFY_LEVEL 0 +#endif + +/* We do support the IEC 559 math functionality, real and complex. */ +#define __STDC_IEC_559__ 1 +#define __STDC_IEC_559_COMPLEX__ 1 + +#ifdef __UCLIBC_HAS_WCHAR__ +/* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */ +# define __STDC_ISO_10646__ 200009L +#endif + +/* There is an unwholesomely huge amount of code out there that depends on the + * presence of GNU libc header files. We have GNU libc header files. So here + * we commit a horrible sin. At this point, we _lie_ and claim to be GNU libc + * to make things like /usr/include/linux/socket.h and lots of apps work as + * their developers intended. This is IMHO, pardonable, since these defines + * are not really intended to check for the presence of a particular library, + * but rather are used to define an _interface_. */ +#if !defined __FORCE_NOGLIBC && (!defined _LIBC || defined __FORCE_GLIBC) +/* This macro indicates that the installed library is the GNU C Library. + For historic reasons the value now is 6 and this will stay from now + on. The use of this variable is deprecated. */ +# undef __GNU_LIBRARY__ +# define __GNU_LIBRARY__ 6 + +/* Major and minor version number of the GNU C library package. Use + these macros to test for features in specific releases. */ +/* Don't do it, if you want to keep uClibc happy. */ +# define __GLIBC__ 2 +# define __GLIBC_MINOR__ 2 +#endif + +#define __GLIBC_PREREQ(maj, min) \ + ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) + +#ifndef __UCLIBC__ +/* Decide whether a compiler supports the long long datatypes. */ +#if defined __GNUC__ \ + || (defined __PGI && defined __i386__ ) \ + || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) +# define __GLIBC_HAVE_LONG_LONG 1 +#endif +#endif + +/* This is here only because every header file already includes this one. */ +#ifndef __ASSEMBLER__ +# ifndef _SYS_CDEFS_H +# include +# endif + +/* If we don't have __REDIRECT, prototypes will be missing if + __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ +# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT +# define __USE_LARGEFILE 1 +# define __USE_LARGEFILE64 1 +# endif + +#endif /* !ASSEMBLER */ + +/* Decide whether we can define 'extern inline' functions in headers. */ +#if __GNUC_PREREQ(2, 7) && defined __OPTIMIZE__ \ + && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ +# define __USE_EXTERN_INLINES 1 +#endif + + +/* Make sure users large file options agree with uClibc's configuration. */ +#ifndef __UCLIBC_HAS_LFS__ + +/* If uClibc was built without large file support, output an error if + * 64-bit file offsets were requested. + * NOTE: This is probably incorrect on a 64-bit arch... */ +# ifdef __USE_FILE_OFFSET64 +# error It appears you have defined _FILE_OFFSET_BITS=64. Unfortunately, \ +uClibc was built without large file support enabled. +# endif + +/* If uClibc was built without large file support and _LARGEFILE64_SOURCE + * is defined, undefine it. */ +# ifdef _LARGEFILE64_SOURCE +# undef _LARGEFILE64_SOURCE +# undef __USE_LARGEFILE64 +# endif + +/* If we're actually building uClibc with large file support, + * define __USE_LARGEFILE64 and __USE_LARGEFILE. */ +#elif defined _LIBC +# undef _LARGEFILE_SOURCE +# undef _LARGEFILE64_SOURCE +# undef _FILE_OFFSET_BITS +# undef __USE_LARGEFILE +# undef __USE_LARGEFILE64 +# undef __USE_FILE_OFFSET64 +# define _LARGEFILE_SOURCE 1 +# define _LARGEFILE64_SOURCE 1 +# define __USE_LARGEFILE 1 +# define __USE_LARGEFILE64 1 +#endif + +/* uClibc does not support *at interfaces. */ +#undef _ATFILE_SOURCE +#undef __USE_ATFILE + +#ifdef _LIBC +# include +#endif + +#ifndef __linux__ +# define __linux__ 1 +#endif + +/* Disable __user, which shows up in 2.6.x include asm headers + * that get pulled in by signal.h */ +#define __user + +#endif /* features.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/fnmatch.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/fnmatch.h new file mode 100644 index 0000000..aefb007 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/fnmatch.h @@ -0,0 +1,72 @@ +/* Copyright (C) 1991-93,96,97,98,99,2001,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FNMATCH_H +#define _FNMATCH_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef const +# if (defined __STDC__ && __STDC__) || defined __cplusplus +# define __const const +# else +# define __const +# endif +#endif + +/* We #undef these before defining them because some losing systems + (HP-UX A.08.07 for example) define these in . */ +#undef FNM_PATHNAME +#undef FNM_NOESCAPE +#undef FNM_PERIOD + +/* Bits set in the FLAGS argument to `fnmatch'. */ +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ +#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ + +#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE +# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ +# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ +# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ +# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */ +#endif + +/* Value returned by `fnmatch' if STRING does not match PATTERN. */ +#define FNM_NOMATCH 1 + +/* This value is returned if the implementation does not support + `fnmatch'. Since this is not the case here it will never be + returned but the conformance test suites still require the symbol + to be defined. */ +#ifdef _XOPEN_SOURCE +# define FNM_NOSYS (-1) +#endif + +/* Match NAME against the filename pattern PATTERN, + returning zero if it matches, FNM_NOMATCH if not. */ +extern int fnmatch (__const char *__pattern, __const char *__name, + int __flags); + +#ifdef __cplusplus +} +#endif + +#endif /* fnmatch.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/fpu_control.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/fpu_control.h new file mode 100644 index 0000000..c58b235 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/fpu_control.h @@ -0,0 +1,100 @@ +/* FPU control word bits. Mips version. + Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Olaf Flebbe and Ralf Baechle. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FPU_CONTROL_H +#define _FPU_CONTROL_H + +/* MIPS FPU floating point control register bits. + * + * 31-25 -> floating point conditions code bits 7-1. These bits are only + * available in MIPS IV. + * 24 -> flush denormalized results to zero instead of + * causing unimplemented operation exception. This bit is only + * available for MIPS III and newer. + * 23 -> Condition bit + * 22-18 -> reserved (read as 0, write with 0) + * 17 -> cause bit for unimplemented operation + * 16 -> cause bit for invalid exception + * 15 -> cause bit for division by zero exception + * 14 -> cause bit for overflow exception + * 13 -> cause bit for underflow exception + * 12 -> cause bit for inexact exception + * 11 -> enable exception for invalid exception + * 10 -> enable exception for division by zero exception + * 9 -> enable exception for overflow exception + * 8 -> enable exception for underflow exception + * 7 -> enable exception for inexact exception + * 6 -> flag invalid exception + * 5 -> flag division by zero exception + * 4 -> flag overflow exception + * 3 -> flag underflow exception + * 2 -> flag inexact exception + * 1-0 -> rounding control + * + * + * Rounding Control: + * 00 - rounding to nearest (RN) + * 01 - rounding toward zero (RZ) + * 10 - rounding (up) toward plus infinity (RP) + * 11 - rounding (down)toward minus infinity (RM) + */ + +#include + +/* masking of interrupts */ +#define _FPU_MASK_V 0x0800 /* Invalid operation */ +#define _FPU_MASK_Z 0x0400 /* Division by zero */ +#define _FPU_MASK_O 0x0200 /* Overflow */ +#define _FPU_MASK_U 0x0100 /* Underflow */ +#define _FPU_MASK_I 0x0080 /* Inexact operation */ + +/* flush denormalized numbers to zero */ +#define _FPU_FLUSH_TZ 0x1000000 + +/* rounding control */ +#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */ +#define _FPU_RC_ZERO 0x1 +#define _FPU_RC_UP 0x2 +#define _FPU_RC_DOWN 0x3 + +#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */ + + +/* The fdlibm code requires strict IEEE double precision arithmetic, + and no interrupts for exceptions, rounding to nearest. */ + +#define _FPU_DEFAULT 0x00000000 + +/* IEEE: same as above, but exceptions */ +#define _FPU_IEEE 0x00000F80 + +/* Type of the control word. */ +typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); + +/* Macros for accessing the hardware control word. */ +#define _FPU_GETCW(cw) __asm__ ("cfc1 %0,$31" : "=r" (cw)) +#define _FPU_SETCW(cw) __asm__ ("ctc1 %0,$31" : : "r" (cw)) + +#if 0 +/* Default control word set at startup. */ +extern fpu_control_t __fpu_control; +#endif + +#endif /* fpu_control.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/getopt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/getopt.h new file mode 100644 index 0000000..a682f9c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/getopt.h @@ -0,0 +1,4 @@ +/* This file will not be installed if not using gnu getopt. */ + +#include + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/glob.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/glob.h new file mode 100644 index 0000000..68ea2cb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/glob.h @@ -0,0 +1,208 @@ +/* Copyright (C) 1991,92,95-98,2000,2001,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _GLOB_H +#define _GLOB_H 1 + +#include + +__BEGIN_DECLS + +/* We need `size_t' for the following definitions. */ +#ifndef __size_t +# if defined __GNUC__ && __GNUC__ >= 2 +typedef __SIZE_TYPE__ __size_t; +# ifdef __USE_XOPEN +typedef __SIZE_TYPE__ size_t; +# endif +# else +# include +# ifndef __size_t +# define __size_t size_t +# endif +# endif +#else +/* The GNU CC stddef.h version defines __size_t as empty. We need a real + definition. */ +# undef __size_t +# define __size_t size_t +#endif + +/* Bits set in the FLAGS argument to `glob'. */ +#define GLOB_ERR (1 << 0)/* Return on read errors. */ +#define GLOB_MARK (1 << 1)/* Append a slash to each name. */ +#define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ +#define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ +#define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ +#define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ +#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ +#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ + +#if ( !defined __USE_POSIX2 || defined __USE_BSD || defined __USE_GNU ) && defined __UCLIBC_HAS_GNU_GLOB__ +# define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ +#if 1 /* uClibc gnu glob does not support these */ +# define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ +# define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ +# define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ +# define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ +# define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ +# define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error + if the user name is not available. */ +# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ + GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ + GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ + GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) +#else +# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ + GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ + GLOB_PERIOD) +#endif +#else +# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ + GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ + GLOB_PERIOD) +#endif + +/* Error returns from `glob'. */ +#define GLOB_NOSPACE 1 /* Ran out of memory. */ +#define GLOB_ABORTED 2 /* Read error. */ +#define GLOB_NOMATCH 3 /* No matches found. */ +#define GLOB_NOSYS 4 /* Not implemented. */ +#if defined __USE_GNU && defined __UCLIBC_HAS_GNU_GLOB__ +/* Previous versions of this file defined GLOB_ABEND instead of + GLOB_ABORTED. Provide a compatibility definition here. */ +# define GLOB_ABEND GLOB_ABORTED +#endif + +/* Structure describing a globbing run. */ +#if defined __USE_GNU && defined __UCLIBC_HAS_GNU_GLOB__ +struct stat; +#endif +typedef struct + { + __size_t gl_pathc; /* Count of paths matched by the pattern. */ + char **gl_pathv; /* List of matched pathnames. */ + __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ +#ifdef __UCLIBC_HAS_GNU_GLOB__ + int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ + +#if 1 /* uClibc gnu glob does not support these */ + /* If the GLOB_ALTDIRFUNC flag is set, the following functions + are used instead of the normal file access functions. */ + void (*gl_closedir) (void *); +#ifdef __USE_GNU + struct dirent *(*gl_readdir) (void *); +#else + void *(*gl_readdir) (void *); +#endif + void *(*gl_opendir) (__const char *); +#ifdef __USE_GNU + int (*gl_lstat) (__const char *__restrict, struct stat *__restrict); + int (*gl_stat) (__const char *__restrict, struct stat *__restrict); +#else + int (*gl_lstat) (__const char *__restrict, void *__restrict); + int (*gl_stat) (__const char *__restrict, void *__restrict); +#endif +#endif +#endif /* __UCLIBC_HAS_GNU_GLOB__ */ + } glob_t; + +#ifdef __USE_LARGEFILE64 +# if defined __USE_GNU && defined __UCLIBC_HAS_GNU_GLOB__ +struct stat64; +# endif +typedef struct + { + __size_t gl_pathc; + char **gl_pathv; + __size_t gl_offs; +#ifdef __UCLIBC_HAS_GNU_GLOB__ + int gl_flags; + +#if 1 /* uClibc gnu glob does not support these */ + /* If the GLOB_ALTDIRFUNC flag is set, the following functions + are used instead of the normal file access functions. */ + void (*gl_closedir) (void *); +# ifdef __USE_GNU + struct dirent64 *(*gl_readdir) (void *); +# else + void *(*gl_readdir) (void *); +# endif + void *(*gl_opendir) (__const char *); +# ifdef __USE_GNU + int (*gl_lstat) (__const char *__restrict, struct stat64 *__restrict); + int (*gl_stat) (__const char *__restrict, struct stat64 *__restrict); +# else + int (*gl_lstat) (__const char *__restrict, void *__restrict); + int (*gl_stat) (__const char *__restrict, void *__restrict); +# endif +#endif +#endif /* __UCLIBC_HAS_GNU_GLOB__ */ + } glob64_t; +#endif + +#if defined(__USE_FILE_OFFSET64) && __GNUC__ < 2 +# define glob glob64 +# define globfree globfree64 +#endif + +/* Do glob searching for PATTERN, placing results in PGLOB. + The bits defined above may be set in FLAGS. + If a directory cannot be opened or read and ERRFUNC is not nil, + it is called with the pathname that caused the error, and the + `errno' value from the failing call; if it returns non-zero + `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. + If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. + Otherwise, `glob' returns zero. */ +#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 +extern int glob (__const char *__restrict __pattern, int __flags, + int (*__errfunc) (__const char *, int), + glob_t *__restrict __pglob) __THROW; + +/* Free storage allocated in PGLOB by a previous `glob' call. */ +extern void globfree (glob_t *__pglob) __THROW; +#else +extern int __REDIRECT_NTH (glob, (__const char *__restrict __pattern, + int __flags, + int (*__errfunc) (__const char *, int), + glob_t *__restrict __pglob), glob64); + +extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64); +#endif + +#ifdef __USE_LARGEFILE64 +extern int glob64 (__const char *__restrict __pattern, int __flags, + int (*__errfunc) (__const char *, int), + glob64_t *__restrict __pglob) __THROW; + +extern void globfree64 (glob64_t *__pglob) __THROW; +#endif + + +#if defined __USE_GNU && defined __UCLIBC_HAS_GNU_GLOB__ +/* Return nonzero if PATTERN contains any metacharacters. + Metacharacters can be quoted with backslashes if QUOTE is nonzero. + + This function is not part of the interface specified by POSIX.2 + but several programs want to use it. */ +extern int glob_pattern_p (__const char *__pattern, int __quote) __THROW; +#endif + +__END_DECLS + +#endif /* glob.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/gnu-versions.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/gnu-versions.h new file mode 100644 index 0000000..59e617c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/gnu-versions.h @@ -0,0 +1,53 @@ +/* Header with interface version macros for library pieces copied elsewhere. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _GNU_VERSIONS_H +#define _GNU_VERSIONS_H 1 + +/* This file exists to define these few macros. Each specifies a version + number associated with the library interface of a piece of the C library + which is also distributed with other GNU packages. These pieces are + both part of the GNU C library and also distributed with other GNU + packages so those packages may use their facilities on systems lacking + the GNU C library. The source files for each piece surround all their + code with `#ifndef ELIDE_CODE' after defining it with this: + + #define OBSTACK_INTERFACE_VERSION 1 + #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 + #include + #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION + #define ELIDE_CODE + #endif + #endif + + This allows those one to avoid compiling those files when part of a GNU + package not libc, on a system using a GNU C library that supports the + same interface. + + Please preserve the format of the comments after each macro. And + remember, if any of these versions change, the libc.so major version + number must change too (so avoid it)! */ + +#define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */ +#define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */ +#define _GNU_GLOB_INTERFACE_VERSION 1 /* vs posix/glob.c */ +#define _GNU_GETOPT_INTERFACE_VERSION 2 /* vs posix/getopt.c and + posix/getopt1.c */ + +#endif /* gnu-versions.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/grp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/grp.h new file mode 100644 index 0000000..6ad8be1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/grp.h @@ -0,0 +1,207 @@ +/* Copyright (C) 1991,1992,1995-2001,2003,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 9.2.1 Group Database Access + */ + +#ifndef _GRP_H +#define _GRP_H 1 + +#include + +__BEGIN_DECLS + +#include + +#define __need_size_t +#include + + +/* For the Single Unix specification we must define this type here. */ +#if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined +typedef __gid_t gid_t; +# define __gid_t_defined +#endif + +/* The group structure. */ +struct group + { + char *gr_name; /* Group name. */ + char *gr_passwd; /* Password. */ + __gid_t gr_gid; /* Group ID. */ + char **gr_mem; /* Member list. */ + }; + + +#if defined __USE_SVID || defined __USE_GNU +# define __need_FILE +# include +#endif + + +#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Rewind the group-file stream. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setgrent (void); + +/* Close the group-file stream. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endgrent (void); + +/* Read an entry from the group-file stream, opening it if necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct group *getgrent (void); +#endif + +#ifdef __USE_SVID +/* Read a group entry from STREAM. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct group *fgetgrent (FILE *__stream); +#endif + +#ifdef __USE_GNU +/* Write the given entry onto the given stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int putgrent (__const struct group *__restrict __p, + FILE *__restrict __f); +#endif + +/* Search for an entry with a matching group ID. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct group *getgrgid (__gid_t __gid); + +/* Search for an entry with a matching group name. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct group *getgrnam (__const char *__name); + +#if defined __USE_POSIX || defined __USE_MISC + +# ifdef __USE_MISC +/* Reasonable value for the buffer sized used in the reentrant + functions below. But better use `sysconf'. */ +# define NSS_BUFLEN_GROUP 1024 +# endif + +/* Reentrant versions of some of the functions above. + + PLEASE NOTE: the `getgrent_r' function is not (yet) standardized. + The interface may change in later versions of this library. But + the interface is designed following the principals used for the + other reentrant functions so the chances are good this is what the + POSIX people would choose. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ + +# ifdef __USE_GNU +extern int getgrent_r (struct group *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct group **__restrict __result); +# endif + +/* Search for an entry with a matching group ID. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct group **__restrict __result); + +/* Search for an entry with a matching group name. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int getgrnam_r (__const char *__restrict __name, + struct group *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct group **__restrict __result); + +# ifdef __USE_SVID +/* Read a group entry from STREAM. This function is not standardized + an probably never will. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fgetgrent_r (FILE *__restrict __stream, + struct group *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct group **__restrict __result); +# endif + +#endif /* POSIX or reentrant */ + + +#ifdef __USE_BSD + +# define __need_size_t +# include + +/* Set the group set for the current user to GROUPS (N of them). */ +extern int setgroups (size_t __n, __const __gid_t *__groups) __THROW; + +#if 0 +/* Store at most *NGROUPS members of the group set for USER into + *GROUPS. Also include GROUP. The actual number of groups found is + returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int getgrouplist (__const char *__user, __gid_t __group, + __gid_t *__groups, int *__ngroups); +#endif + +/* Initialize the group set for the current user + by reading the group database and using all groups + of which USER is a member. Also include GROUP. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int initgroups (__const char *__user, __gid_t __group); + +#endif /* Use BSD. */ + +__END_DECLS + +#endif /* grp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/hp-timing.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/hp-timing.h new file mode 100644 index 0000000..099342d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/hp-timing.h @@ -0,0 +1,83 @@ +/* High precision, low overhead timing functions. Generic version. + Copyright (C) 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _HP_TIMING_H +#define _HP_TIMING_H 1 + + +/* There are no generic definitions for the times. We could write something + using the `gettimeofday' system call where available but the overhead of + the system call might be too high. + + In case a platform supports timers in the hardware the following macros + and types must be defined: + + - HP_TIMING_AVAIL: test for availability. + + - HP_TIMING_INLINE: this macro is non-zero if the functionality is not + implemented using function calls but instead uses some inlined code + which might simply consist of a few assembler instructions. We have to + know this since we might want to use the macros here in places where we + cannot make function calls. + + - hp_timing_t: This is the type for variables used to store the time + values. + + - HP_TIMING_ZERO: clear `hp_timing_t' object. + + - HP_TIMING_NOW: place timestamp for current time in variable given as + parameter. + + - HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the + HP_TIMING_DIFF macro. + + - HP_TIMING_DIFF: compute difference between two times and store it + in a third. Source and destination might overlap. + + - HP_TIMING_ACCUM: add time difference to another variable. This might + be a bit more complicated to implement for some platforms as the + operation should be thread-safe and 64bit arithmetic on 32bit platforms + is not. + + - HP_TIMING_ACCUM_NT: this is the variant for situations where we know + there are no threads involved. + + - HP_TIMING_PRINT: write decimal representation of the timing value into + the given string. This operation need not be inline even though + HP_TIMING_INLINE is specified. + +*/ + +/* Provide dummy definitions. */ +#define HP_TIMING_AVAIL (0) +#define HP_TIMING_INLINE (0) +typedef int hp_timing_t; +#define HP_TIMING_ZERO(Var) +#define HP_TIMING_NOW(var) +#define HP_TIMING_DIFF_INIT() +#define HP_TIMING_DIFF(Diff, Start, End) +#define HP_TIMING_ACCUM(Sum, Diff) +#define HP_TIMING_ACCUM_NT(Sum, Diff) +#define HP_TIMING_PRINT(Buf, Len, Val) + +/* Since this implementation is not available we tell the user about it. */ +#define HP_TIMING_NONAVAIL 1 + +#endif /* hp-timing.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/ieee754.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ieee754.h new file mode 100644 index 0000000..7131e5d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ieee754.h @@ -0,0 +1,199 @@ +/* Copyright (C) 1992, 1995, 1996, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _IEEE754_H + +#define _IEEE754_H 1 +#include + +#include + +__BEGIN_DECLS + +union ieee754_float + { + float f; + + /* This is the IEEE 754 single-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int mantissa:23; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:23; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int quiet_nan:1; + unsigned int mantissa:22; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:22; + unsigned int quiet_nan:1; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ + + +union ieee754_double + { + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == BIG_ENDIAN + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else +# if __FLOAT_WORD_ORDER == BIG_ENDIAN + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif + } ieee_nan; + }; + +#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 double-extended-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int empty:16; + unsigned int mantissa0:32; + unsigned int mantissa1:32; +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == BIG_ENDIAN + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; + unsigned int mantissa0:32; + unsigned int mantissa1:32; +# else + unsigned int mantissa1:32; + unsigned int mantissa0:32; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; +# endif +#endif + } ieee; + + /* This is for NaNs in the IEEE 854 double-extended-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int empty:16; + unsigned int one:1; + unsigned int quiet_nan:1; + unsigned int mantissa0:30; + unsigned int mantissa1:32; +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == BIG_ENDIAN + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; + unsigned int mantissa0:30; + unsigned int quiet_nan:1; + unsigned int one:1; + unsigned int mantissa1:32; +# else + unsigned int mantissa1:32; + unsigned int mantissa0:30; + unsigned int quiet_nan:1; + unsigned int one:1; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; +# endif +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff + +__END_DECLS + +#endif /* ieee754.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/inttypes.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/inttypes.h new file mode 100644 index 0000000..b1d4302 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/inttypes.h @@ -0,0 +1,328 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99: 7.8 Format conversion of integer types + */ + +#ifndef _INTTYPES_H +#define _INTTYPES_H 1 + +#include +/* Get the type definitions. */ +#include + +#ifdef __UCLIBC_HAS_WCHAR__ +/* Get a definition for wchar_t. But we must not define wchar_t itself. */ +#ifndef ____gwchar_t_defined +# ifdef __cplusplus +# define __gwchar_t wchar_t +# elif defined __WCHAR_TYPE__ +typedef __WCHAR_TYPE__ __gwchar_t; +# else +# define __need_wchar_t +# include +typedef wchar_t __gwchar_t; +# endif +# define ____gwchar_t_defined 1 +#endif +#endif + + +/* The ISO C99 standard specifies that these macros must only be + defined if explicitly requested. */ +#if !defined __cplusplus || defined __STDC_FORMAT_MACROS + +# if __WORDSIZE == 64 +# define __PRI64_PREFIX "l" +# define __PRIPTR_PREFIX "l" +# else +# define __PRI64_PREFIX "ll" +# define __PRIPTR_PREFIX +# endif + +/* Macros for printing format specifiers. */ + +/* Decimal notation. */ +# define PRId8 "d" +# define PRId16 "d" +# define PRId32 "d" +# define PRId64 __PRI64_PREFIX "d" + +# define PRIdLEAST8 "d" +# define PRIdLEAST16 "d" +# define PRIdLEAST32 "d" +# define PRIdLEAST64 __PRI64_PREFIX "d" + +# define PRIdFAST8 "d" +# define PRIdFAST16 "d" +# define PRIdFAST32 "d" +# define PRIdFAST64 __PRI64_PREFIX "d" + + +# define PRIi8 "i" +# define PRIi16 "i" +# define PRIi32 "i" +# define PRIi64 __PRI64_PREFIX "i" + +# define PRIiLEAST8 "i" +# define PRIiLEAST16 "i" +# define PRIiLEAST32 "i" +# define PRIiLEAST64 __PRI64_PREFIX "i" + +# define PRIiFAST8 "i" +# define PRIiFAST16 "i" +# define PRIiFAST32 "i" +# define PRIiFAST64 __PRI64_PREFIX "i" + +/* Octal notation. */ +# define PRIo8 "o" +# define PRIo16 "o" +# define PRIo32 "o" +# define PRIo64 __PRI64_PREFIX "o" + +# define PRIoLEAST8 "o" +# define PRIoLEAST16 "o" +# define PRIoLEAST32 "o" +# define PRIoLEAST64 __PRI64_PREFIX "o" + +# define PRIoFAST8 "o" +# define PRIoFAST16 "o" +# define PRIoFAST32 "o" +# define PRIoFAST64 __PRI64_PREFIX "o" + +/* Unsigned integers. */ +# define PRIu8 "u" +# define PRIu16 "u" +# define PRIu32 "u" +# define PRIu64 __PRI64_PREFIX "u" + +# define PRIuLEAST8 "u" +# define PRIuLEAST16 "u" +# define PRIuLEAST32 "u" +# define PRIuLEAST64 __PRI64_PREFIX "u" + +# define PRIuFAST8 "u" +# define PRIuFAST16 "u" +# define PRIuFAST32 "u" +# define PRIuFAST64 __PRI64_PREFIX "u" + +/* lowercase hexadecimal notation. */ +# define PRIx8 "x" +# define PRIx16 "x" +# define PRIx32 "x" +# define PRIx64 __PRI64_PREFIX "x" + +# define PRIxLEAST8 "x" +# define PRIxLEAST16 "x" +# define PRIxLEAST32 "x" +# define PRIxLEAST64 __PRI64_PREFIX "x" + +# define PRIxFAST8 "x" +# define PRIxFAST16 "x" +# define PRIxFAST32 "x" +# define PRIxFAST64 __PRI64_PREFIX "x" + +/* UPPERCASE hexadecimal notation. */ +# define PRIX8 "X" +# define PRIX16 "X" +# define PRIX32 "X" +# define PRIX64 __PRI64_PREFIX "X" + +# define PRIXLEAST8 "X" +# define PRIXLEAST16 "X" +# define PRIXLEAST32 "X" +# define PRIXLEAST64 __PRI64_PREFIX "X" + +# define PRIXFAST8 "X" +# define PRIXFAST16 "X" +# define PRIXFAST32 "X" +# define PRIXFAST64 __PRI64_PREFIX "X" + + +/* Macros for printing `intmax_t' and `uintmax_t'. */ +# define PRIdMAX __PRI64_PREFIX "d" +# define PRIiMAX __PRI64_PREFIX "i" +# define PRIoMAX __PRI64_PREFIX "o" +# define PRIuMAX __PRI64_PREFIX "u" +# define PRIxMAX __PRI64_PREFIX "x" +# define PRIXMAX __PRI64_PREFIX "X" + + +/* Macros for printing `intptr_t' and `uintptr_t'. */ +# define PRIdPTR __PRIPTR_PREFIX "d" +# define PRIiPTR __PRIPTR_PREFIX "i" +# define PRIoPTR __PRIPTR_PREFIX "o" +# define PRIuPTR __PRIPTR_PREFIX "u" +# define PRIxPTR __PRIPTR_PREFIX "x" +# define PRIXPTR __PRIPTR_PREFIX "X" + + +/* Macros for scanning format specifiers. */ + +/* Signed decimal notation. */ +# define SCNd8 "hhd" +# define SCNd16 "hd" +# define SCNd32 "d" +# define SCNd64 __PRI64_PREFIX "d" + +# define SCNdLEAST8 "hhd" +# define SCNdLEAST16 "hd" +# define SCNdLEAST32 "d" +# define SCNdLEAST64 __PRI64_PREFIX "d" + +# define SCNdFAST8 "hhd" +# define SCNdFAST16 __PRIPTR_PREFIX "d" +# define SCNdFAST32 __PRIPTR_PREFIX "d" +# define SCNdFAST64 __PRI64_PREFIX "d" + +/* Signed decimal notation. */ +# define SCNi8 "hhi" +# define SCNi16 "hi" +# define SCNi32 "i" +# define SCNi64 __PRI64_PREFIX "i" + +# define SCNiLEAST8 "hhi" +# define SCNiLEAST16 "hi" +# define SCNiLEAST32 "i" +# define SCNiLEAST64 __PRI64_PREFIX "i" + +# define SCNiFAST8 "hhi" +# define SCNiFAST16 __PRIPTR_PREFIX "i" +# define SCNiFAST32 __PRIPTR_PREFIX "i" +# define SCNiFAST64 __PRI64_PREFIX "i" + +/* Unsigned decimal notation. */ +# define SCNu8 "hhu" +# define SCNu16 "hu" +# define SCNu32 "u" +# define SCNu64 __PRI64_PREFIX "u" + +# define SCNuLEAST8 "hhu" +# define SCNuLEAST16 "hu" +# define SCNuLEAST32 "u" +# define SCNuLEAST64 __PRI64_PREFIX "u" + +# define SCNuFAST8 "hhu" +# define SCNuFAST16 __PRIPTR_PREFIX "u" +# define SCNuFAST32 __PRIPTR_PREFIX "u" +# define SCNuFAST64 __PRI64_PREFIX "u" + +/* Octal notation. */ +# define SCNo8 "hho" +# define SCNo16 "ho" +# define SCNo32 "o" +# define SCNo64 __PRI64_PREFIX "o" + +# define SCNoLEAST8 "hho" +# define SCNoLEAST16 "ho" +# define SCNoLEAST32 "o" +# define SCNoLEAST64 __PRI64_PREFIX "o" + +# define SCNoFAST8 "hho" +# define SCNoFAST16 __PRIPTR_PREFIX "o" +# define SCNoFAST32 __PRIPTR_PREFIX "o" +# define SCNoFAST64 __PRI64_PREFIX "o" + +/* Hexadecimal notation. */ +# define SCNx8 "hhx" +# define SCNx16 "hx" +# define SCNx32 "x" +# define SCNx64 __PRI64_PREFIX "x" + +# define SCNxLEAST8 "hhx" +# define SCNxLEAST16 "hx" +# define SCNxLEAST32 "x" +# define SCNxLEAST64 __PRI64_PREFIX "x" + +# define SCNxFAST8 "hhx" +# define SCNxFAST16 __PRIPTR_PREFIX "x" +# define SCNxFAST32 __PRIPTR_PREFIX "x" +# define SCNxFAST64 __PRI64_PREFIX "x" + + +/* Macros for scanning `intmax_t' and `uintmax_t'. */ +# define SCNdMAX __PRI64_PREFIX "d" +# define SCNiMAX __PRI64_PREFIX "i" +# define SCNoMAX __PRI64_PREFIX "o" +# define SCNuMAX __PRI64_PREFIX "u" +# define SCNxMAX __PRI64_PREFIX "x" + +/* Macros for scaning `intptr_t' and `uintptr_t'. */ +# define SCNdPTR __PRIPTR_PREFIX "d" +# define SCNiPTR __PRIPTR_PREFIX "i" +# define SCNoPTR __PRIPTR_PREFIX "o" +# define SCNuPTR __PRIPTR_PREFIX "u" +# define SCNxPTR __PRIPTR_PREFIX "x" + +#endif /* C++ && format macros */ + + +__BEGIN_DECLS + +#if __WORDSIZE == 64 + +/* We have to define the `uintmax_t' type using `ldiv_t'. */ +typedef struct + { + long int quot; /* Quotient. */ + long int rem; /* Remainder. */ + } imaxdiv_t; + +#else + +/* We have to define the `uintmax_t' type using `lldiv_t'. */ +typedef struct + { + long long int quot; /* Quotient. */ + long long int rem; /* Remainder. */ + } imaxdiv_t; + +#endif + + +/* Compute absolute value of N. */ +extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__)); + +/* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __THROW __attribute__ ((__const__)); + +/* Like `strtol' but convert to `intmax_t'. */ +extern intmax_t strtoimax (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) __THROW; + +/* Like `strtoul' but convert to `uintmax_t'. */ +extern uintmax_t strtoumax (__const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __THROW; + +#if defined __UCLIBC_HAS_WCHAR__ && __UCLIBC_HAS_WCHAR__ +/* Like `wcstol' but convert to `intmax_t'. */ +extern intmax_t wcstoimax (__const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __THROW; + +/* Like `wcstoul' but convert to `uintmax_t'. */ +extern uintmax_t wcstoumax (__const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __THROW; +#endif + +__END_DECLS + +#endif /* inttypes.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/langinfo.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/langinfo.h new file mode 100644 index 0000000..837a87b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/langinfo.h @@ -0,0 +1,623 @@ +/* Access to locale-dependent parameters. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LANGINFO_H +#define _LANGINFO_H 1 + +/* Get the type definition. */ +#include + +#include /* Define the __LC_* category names. */ + + +__BEGIN_DECLS + +/* Construct an `nl_item' value for `nl_langinfo' from a locale category + (LC_*) and an item index within the category. Some code may depend on + the item values within a category increasing monotonically with the + indices. */ +#define _NL_ITEM(category, index) \ + (((category) << __NL_ITEM_CATEGORY_SHIFT) | (index)) + +/* Extract the category and item index from a constructed `nl_item' value. */ +#define _NL_ITEM_CATEGORY(item) ((int) (item) >> __NL_ITEM_CATEGORY_SHIFT) +#define _NL_ITEM_INDEX(item) ((int) (item) & __NL_ITEM_INDEX_MASK) + + +/* Enumeration of locale items that can be queried with `nl_langinfo'. */ +enum +{ + /* LC_TIME category: date and time formatting. */ + + /* Abbreviated days of the week. */ + ABDAY_1 = _NL_ITEM (__LC_TIME, 0), /* Sun */ +#define ABDAY_1 ABDAY_1 + ABDAY_2, +#define ABDAY_2 ABDAY_2 + ABDAY_3, +#define ABDAY_3 ABDAY_3 + ABDAY_4, +#define ABDAY_4 ABDAY_4 + ABDAY_5, +#define ABDAY_5 ABDAY_5 + ABDAY_6, +#define ABDAY_6 ABDAY_6 + ABDAY_7, +#define ABDAY_7 ABDAY_7 + + /* Long-named days of the week. */ + DAY_1, /* Sunday */ +#define DAY_1 DAY_1 + DAY_2, /* Monday */ +#define DAY_2 DAY_2 + DAY_3, /* Tuesday */ +#define DAY_3 DAY_3 + DAY_4, /* Wednesday */ +#define DAY_4 DAY_4 + DAY_5, /* Thursday */ +#define DAY_5 DAY_5 + DAY_6, /* Friday */ +#define DAY_6 DAY_6 + DAY_7, /* Saturday */ +#define DAY_7 DAY_7 + + /* Abbreviated month names. */ + ABMON_1, /* Jan */ +#define ABMON_1 ABMON_1 + ABMON_2, +#define ABMON_2 ABMON_2 + ABMON_3, +#define ABMON_3 ABMON_3 + ABMON_4, +#define ABMON_4 ABMON_4 + ABMON_5, +#define ABMON_5 ABMON_5 + ABMON_6, +#define ABMON_6 ABMON_6 + ABMON_7, +#define ABMON_7 ABMON_7 + ABMON_8, +#define ABMON_8 ABMON_8 + ABMON_9, +#define ABMON_9 ABMON_9 + ABMON_10, +#define ABMON_10 ABMON_10 + ABMON_11, +#define ABMON_11 ABMON_11 + ABMON_12, +#define ABMON_12 ABMON_12 + + /* Long month names. */ + MON_1, /* January */ +#define MON_1 MON_1 + MON_2, +#define MON_2 MON_2 + MON_3, +#define MON_3 MON_3 + MON_4, +#define MON_4 MON_4 + MON_5, +#define MON_5 MON_5 + MON_6, +#define MON_6 MON_6 + MON_7, +#define MON_7 MON_7 + MON_8, +#define MON_8 MON_8 + MON_9, +#define MON_9 MON_9 + MON_10, +#define MON_10 MON_10 + MON_11, +#define MON_11 MON_11 + MON_12, +#define MON_12 MON_12 + + AM_STR, /* Ante meridian string. */ +#define AM_STR AM_STR + PM_STR, /* Post meridian string. */ +#define PM_STR PM_STR + + D_T_FMT, /* Date and time format for strftime. */ +#define D_T_FMT D_T_FMT + D_FMT, /* Date format for strftime. */ +#define D_FMT D_FMT + T_FMT, /* Time format for strftime. */ +#define T_FMT T_FMT + T_FMT_AMPM, /* 12-hour time format for strftime. */ +#define T_FMT_AMPM T_FMT_AMPM + + ERA, /* Alternate era. */ +#define ERA ERA + __ERA_YEAR, /* Year in alternate era format. */ +#ifdef __USE_GNU +# define ERA_YEAR __ERA_YEAR +#endif + ERA_D_FMT, /* Date in alternate era format. */ +#define ERA_D_FMT ERA_D_FMT + ALT_DIGITS, /* Alternate symbols for digits. */ +#define ALT_DIGITS ALT_DIGITS + ERA_D_T_FMT, /* Date and time in alternate era format. */ +#define ERA_D_T_FMT ERA_D_T_FMT + ERA_T_FMT, /* Time in alternate era format. */ +#define ERA_T_FMT ERA_T_FMT + +#if 0 + _NL_TIME_ERA_NUM_ENTRIES, /* Number entries in the era arrays. */ + _NL_TIME_ERA_ENTRIES, /* Structure with era entries in usable form.*/ + + _NL_WABDAY_1, /* Sun */ + _NL_WABDAY_2, + _NL_WABDAY_3, + _NL_WABDAY_4, + _NL_WABDAY_5, + _NL_WABDAY_6, + _NL_WABDAY_7, + + /* Long-named days of the week. */ + _NL_WDAY_1, /* Sunday */ + _NL_WDAY_2, /* Monday */ + _NL_WDAY_3, /* Tuesday */ + _NL_WDAY_4, /* Wednesday */ + _NL_WDAY_5, /* Thursday */ + _NL_WDAY_6, /* Friday */ + _NL_WDAY_7, /* Saturday */ + + /* Abbreviated month names. */ + _NL_WABMON_1, /* Jan */ + _NL_WABMON_2, + _NL_WABMON_3, + _NL_WABMON_4, + _NL_WABMON_5, + _NL_WABMON_6, + _NL_WABMON_7, + _NL_WABMON_8, + _NL_WABMON_9, + _NL_WABMON_10, + _NL_WABMON_11, + _NL_WABMON_12, + + /* Long month names. */ + _NL_WMON_1, /* January */ + _NL_WMON_2, + _NL_WMON_3, + _NL_WMON_4, + _NL_WMON_5, + _NL_WMON_6, + _NL_WMON_7, + _NL_WMON_8, + _NL_WMON_9, + _NL_WMON_10, + _NL_WMON_11, + _NL_WMON_12, + + _NL_WAM_STR, /* Ante meridian string. */ + _NL_WPM_STR, /* Post meridian string. */ + + _NL_WD_T_FMT, /* Date and time format for strftime. */ + _NL_WD_FMT, /* Date format for strftime. */ + _NL_WT_FMT, /* Time format for strftime. */ + _NL_WT_FMT_AMPM, /* 12-hour time format for strftime. */ + + _NL_WERA_YEAR, /* Year in alternate era format. */ + _NL_WERA_D_FMT, /* Date in alternate era format. */ + _NL_WALT_DIGITS, /* Alternate symbols for digits. */ + _NL_WERA_D_T_FMT, /* Date and time in alternate era format. */ + _NL_WERA_T_FMT, /* Time in alternate era format. */ + + _NL_TIME_WEEK_NDAYS, + _NL_TIME_WEEK_1STDAY, + _NL_TIME_WEEK_1STWEEK, + _NL_TIME_FIRST_WEEKDAY, + _NL_TIME_FIRST_WORKDAY, + _NL_TIME_CAL_DIRECTION, + _NL_TIME_TIMEZONE, + + _DATE_FMT, /* strftime format for date. */ +#define _DATE_FMT _DATE_FMT + _NL_W_DATE_FMT, + + _NL_TIME_CODESET, +#endif /* 0 */ + + _NL_NUM_LC_TIME, /* Number of indices in LC_TIME category. */ + + /* LC_COLLATE category: text sorting. + This information is accessed by the strcoll and strxfrm functions. + These `nl_langinfo' names are used only internally. */ +#if 0 + _NL_COLLATE_NRULES = _NL_ITEM (__LC_COLLATE, 0), + _NL_COLLATE_RULESETS, + _NL_COLLATE_TABLEMB, + _NL_COLLATE_WEIGHTMB, + _NL_COLLATE_EXTRAMB, + _NL_COLLATE_INDIRECTMB, + _NL_COLLATE_GAP1, + _NL_COLLATE_GAP2, + _NL_COLLATE_GAP3, + _NL_COLLATE_TABLEWC, + _NL_COLLATE_WEIGHTWC, + _NL_COLLATE_EXTRAWC, + _NL_COLLATE_INDIRECTWC, + _NL_COLLATE_SYMB_HASH_SIZEMB, + _NL_COLLATE_SYMB_TABLEMB, + _NL_COLLATE_SYMB_EXTRAMB, + _NL_COLLATE_COLLSEQMB, + _NL_COLLATE_COLLSEQWC, + _NL_COLLATE_CODESET, + _NL_NUM_LC_COLLATE, +#endif + + /* LC_CTYPE category: character classification. + This information is accessed by the functions in . + These `nl_langinfo' names are used only internally. */ +#if 0 + _NL_CTYPE_CLASS = _NL_ITEM (__LC_CTYPE, 0), + _NL_CTYPE_TOUPPER, + _NL_CTYPE_GAP1, + _NL_CTYPE_TOLOWER, + _NL_CTYPE_GAP2, + _NL_CTYPE_CLASS32, + _NL_CTYPE_GAP3, + _NL_CTYPE_GAP4, + _NL_CTYPE_GAP5, + _NL_CTYPE_GAP6, + _NL_CTYPE_CLASS_NAMES, + _NL_CTYPE_MAP_NAMES, + _NL_CTYPE_WIDTH, + _NL_CTYPE_MB_CUR_MAX, + _NL_CTYPE_CODESET_NAME, + CODESET = _NL_CTYPE_CODESET_NAME, +#define CODESET CODESET + _NL_CTYPE_TOUPPER32, + _NL_CTYPE_TOLOWER32, + _NL_CTYPE_CLASS_OFFSET, + _NL_CTYPE_MAP_OFFSET, + _NL_CTYPE_INDIGITS_MB_LEN, + _NL_CTYPE_INDIGITS0_MB, + _NL_CTYPE_INDIGITS1_MB, + _NL_CTYPE_INDIGITS2_MB, + _NL_CTYPE_INDIGITS3_MB, + _NL_CTYPE_INDIGITS4_MB, + _NL_CTYPE_INDIGITS5_MB, + _NL_CTYPE_INDIGITS6_MB, + _NL_CTYPE_INDIGITS7_MB, + _NL_CTYPE_INDIGITS8_MB, + _NL_CTYPE_INDIGITS9_MB, + _NL_CTYPE_INDIGITS_WC_LEN, + _NL_CTYPE_INDIGITS0_WC, + _NL_CTYPE_INDIGITS1_WC, + _NL_CTYPE_INDIGITS2_WC, + _NL_CTYPE_INDIGITS3_WC, + _NL_CTYPE_INDIGITS4_WC, + _NL_CTYPE_INDIGITS5_WC, + _NL_CTYPE_INDIGITS6_WC, + _NL_CTYPE_INDIGITS7_WC, + _NL_CTYPE_INDIGITS8_WC, + _NL_CTYPE_INDIGITS9_WC, + _NL_CTYPE_OUTDIGIT0_MB, + _NL_CTYPE_OUTDIGIT1_MB, + _NL_CTYPE_OUTDIGIT2_MB, + _NL_CTYPE_OUTDIGIT3_MB, + _NL_CTYPE_OUTDIGIT4_MB, + _NL_CTYPE_OUTDIGIT5_MB, + _NL_CTYPE_OUTDIGIT6_MB, + _NL_CTYPE_OUTDIGIT7_MB, + _NL_CTYPE_OUTDIGIT8_MB, + _NL_CTYPE_OUTDIGIT9_MB, + _NL_CTYPE_OUTDIGIT0_WC, + _NL_CTYPE_OUTDIGIT1_WC, + _NL_CTYPE_OUTDIGIT2_WC, + _NL_CTYPE_OUTDIGIT3_WC, + _NL_CTYPE_OUTDIGIT4_WC, + _NL_CTYPE_OUTDIGIT5_WC, + _NL_CTYPE_OUTDIGIT6_WC, + _NL_CTYPE_OUTDIGIT7_WC, + _NL_CTYPE_OUTDIGIT8_WC, + _NL_CTYPE_OUTDIGIT9_WC, + _NL_CTYPE_TRANSLIT_TAB_SIZE, + _NL_CTYPE_TRANSLIT_FROM_IDX, + _NL_CTYPE_TRANSLIT_FROM_TBL, + _NL_CTYPE_TRANSLIT_TO_IDX, + _NL_CTYPE_TRANSLIT_TO_TBL, + _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN, + _NL_CTYPE_TRANSLIT_DEFAULT_MISSING, + _NL_CTYPE_TRANSLIT_IGNORE_LEN, + _NL_CTYPE_TRANSLIT_IGNORE, + _NL_CTYPE_EXTRA_MAP_1, + _NL_CTYPE_EXTRA_MAP_2, + _NL_CTYPE_EXTRA_MAP_3, + _NL_CTYPE_EXTRA_MAP_4, + _NL_CTYPE_EXTRA_MAP_5, + _NL_CTYPE_EXTRA_MAP_6, + _NL_CTYPE_EXTRA_MAP_7, + _NL_CTYPE_EXTRA_MAP_8, + _NL_CTYPE_EXTRA_MAP_9, + _NL_CTYPE_EXTRA_MAP_10, + _NL_CTYPE_EXTRA_MAP_11, + _NL_CTYPE_EXTRA_MAP_12, + _NL_CTYPE_EXTRA_MAP_13, + _NL_CTYPE_EXTRA_MAP_14, + _NL_NUM_LC_CTYPE, +#else /* 0 */ + _NL_CTYPE_OUTDIGIT0_MB = _NL_ITEM (__LC_CTYPE, 0), + _NL_CTYPE_OUTDIGIT1_MB, + _NL_CTYPE_OUTDIGIT2_MB, + _NL_CTYPE_OUTDIGIT3_MB, + _NL_CTYPE_OUTDIGIT4_MB, + _NL_CTYPE_OUTDIGIT5_MB, + _NL_CTYPE_OUTDIGIT6_MB, + _NL_CTYPE_OUTDIGIT7_MB, + _NL_CTYPE_OUTDIGIT8_MB, + _NL_CTYPE_OUTDIGIT9_MB, + _NL_CTYPE_CODESET_NAME, /* uClibc note: MUST BE LAST ENTRY!!! */ + CODESET = _NL_CTYPE_CODESET_NAME, +#define CODESET CODESET +#endif /* 0 */ + + /* LC_MONETARY category: formatting of monetary quantities. + These items each correspond to a member of `struct lconv', + defined in . */ + __INT_CURR_SYMBOL = _NL_ITEM (__LC_MONETARY, 0), +#ifdef __USE_GNU +# define INT_CURR_SYMBOL __INT_CURR_SYMBOL +#endif + __CURRENCY_SYMBOL, +#ifdef __USE_GNU +# define CURRENCY_SYMBOL __CURRENCY_SYMBOL +#endif + __MON_DECIMAL_POINT, +#ifdef __USE_GNU +# define MON_DECIMAL_POINT __MON_DECIMAL_POINT +#endif + __MON_THOUSANDS_SEP, +#ifdef __USE_GNU +# define MON_THOUSANDS_SEP __MON_THOUSANDS_SEP +#endif + __MON_GROUPING, +#ifdef __USE_GNU +# define MON_GROUPING __MON_GROUPING +#endif + __POSITIVE_SIGN, +#ifdef __USE_GNU +# define POSITIVE_SIGN __POSITIVE_SIGN +#endif + __NEGATIVE_SIGN, +#ifdef __USE_GNU +# define NEGATIVE_SIGN __NEGATIVE_SIGN +#endif + __INT_FRAC_DIGITS, +#ifdef __USE_GNU +# define INT_FRAC_DIGITS __INT_FRAC_DIGITS +#endif + __FRAC_DIGITS, +#ifdef __USE_GNU +# define FRAC_DIGITS __FRAC_DIGITS +#endif + __P_CS_PRECEDES, +#ifdef __USE_GNU +# define P_CS_PRECEDES __P_CS_PRECEDES +#endif + __P_SEP_BY_SPACE, +#ifdef __USE_GNU +# define P_SEP_BY_SPACE __P_SEP_BY_SPACE +#endif + __N_CS_PRECEDES, +#ifdef __USE_GNU +# define N_CS_PRECEDES __N_CS_PRECEDES +#endif + __N_SEP_BY_SPACE, +#ifdef __USE_GNU +# define N_SEP_BY_SPACE __N_SEP_BY_SPACE +#endif + __P_SIGN_POSN, +#ifdef __USE_GNU +# define P_SIGN_POSN __P_SIGN_POSN +#endif + __N_SIGN_POSN, +#ifdef __USE_GNU +# define N_SIGN_POSN __N_SIGN_POSN +#endif + __INT_P_CS_PRECEDES, +#ifdef __USE_GNU +# define INT_P_CS_PRECEDES __INT_P_CS_PRECEDES +#endif + __INT_P_SEP_BY_SPACE, +#ifdef __USE_GNU +# define INT_P_SEP_BY_SPACE __INT_P_SEP_BY_SPACE +#endif + __INT_N_CS_PRECEDES, +#ifdef __USE_GNU +# define INT_N_CS_PRECEDES __INT_N_CS_PRECEDES +#endif + __INT_N_SEP_BY_SPACE, +#ifdef __USE_GNU +# define INT_N_SEP_BY_SPACE __INT_N_SEP_BY_SPACE +#endif + __INT_P_SIGN_POSN, +#ifdef __USE_GNU +# define INT_P_SIGN_POSN __INT_P_SIGN_POSN +#endif + __INT_N_SIGN_POSN, +#ifdef __USE_GNU +# define INT_N_SIGN_POSN __INT_N_SIGN_POSN +#endif + + _NL_MONETARY_CRNCYSTR, +#define CRNCYSTR _NL_MONETARY_CRNCYSTR + +#if 0 + _NL_MONETARY_DUO_INT_CURR_SYMBOL, + _NL_MONETARY_DUO_CURRENCY_SYMBOL, + _NL_MONETARY_DUO_INT_FRAC_DIGITS, + _NL_MONETARY_DUO_FRAC_DIGITS, + _NL_MONETARY_DUO_P_CS_PRECEDES, + _NL_MONETARY_DUO_P_SEP_BY_SPACE, + _NL_MONETARY_DUO_N_CS_PRECEDES, + _NL_MONETARY_DUO_N_SEP_BY_SPACE, + _NL_MONETARY_DUO_INT_P_CS_PRECEDES, + _NL_MONETARY_DUO_INT_P_SEP_BY_SPACE, + _NL_MONETARY_DUO_INT_N_CS_PRECEDES, + _NL_MONETARY_DUO_INT_N_SEP_BY_SPACE, + _NL_MONETARY_DUO_P_SIGN_POSN, + _NL_MONETARY_DUO_N_SIGN_POSN, + _NL_MONETARY_DUO_INT_P_SIGN_POSN, + _NL_MONETARY_DUO_INT_N_SIGN_POSN, + _NL_MONETARY_UNO_VALID_FROM, + _NL_MONETARY_UNO_VALID_TO, + _NL_MONETARY_DUO_VALID_FROM, + _NL_MONETARY_DUO_VALID_TO, + _NL_MONETARY_CONVERSION_RATE, + _NL_MONETARY_DECIMAL_POINT_WC, + _NL_MONETARY_THOUSANDS_SEP_WC, + _NL_MONETARY_CODESET, +#endif /* 0 */ + _NL_NUM_LC_MONETARY, + + /* LC_NUMERIC category: formatting of numbers. + These also correspond to members of `struct lconv'; see . */ + __DECIMAL_POINT = _NL_ITEM (__LC_NUMERIC, 0), +#ifdef __USE_GNU +# define DECIMAL_POINT __DECIMAL_POINT +#endif + RADIXCHAR = __DECIMAL_POINT, +#define RADIXCHAR RADIXCHAR + __THOUSANDS_SEP, +#ifdef __USE_GNU +# define THOUSANDS_SEP __THOUSANDS_SEP +#endif + THOUSEP = __THOUSANDS_SEP, +#define THOUSEP THOUSEP + __GROUPING, +#ifdef __USE_GNU +# define GROUPING __GROUPING +#endif +#if 0 + _NL_NUMERIC_DECIMAL_POINT_WC, + _NL_NUMERIC_THOUSANDS_SEP_WC, + _NL_NUMERIC_CODESET, +#endif + _NL_NUM_LC_NUMERIC, + + __YESEXPR = _NL_ITEM (__LC_MESSAGES, 0), /* Regex matching ``yes'' input. */ +#define YESEXPR __YESEXPR + __NOEXPR, /* Regex matching ``no'' input. */ +#define NOEXPR __NOEXPR + __YESSTR, /* Output string for ``yes''. */ +#if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +# define YESSTR __YESSTR +#endif + __NOSTR, /* Output string for ``no''. */ +#if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +# define NOSTR __NOSTR +#endif +#if 0 + _NL_MESSAGES_CODESET, +#endif + _NL_NUM_LC_MESSAGES, + +#if 0 + _NL_PAPER_HEIGHT = _NL_ITEM (__LC_PAPER, 0), + _NL_PAPER_WIDTH, + _NL_PAPER_CODESET, + _NL_NUM_LC_PAPER, + + _NL_NAME_NAME_FMT = _NL_ITEM (__LC_NAME, 0), + _NL_NAME_NAME_GEN, + _NL_NAME_NAME_MR, + _NL_NAME_NAME_MRS, + _NL_NAME_NAME_MISS, + _NL_NAME_NAME_MS, + _NL_NAME_CODESET, + _NL_NUM_LC_NAME, + + _NL_ADDRESS_POSTAL_FMT = _NL_ITEM (__LC_ADDRESS, 0), + _NL_ADDRESS_COUNTRY_NAME, + _NL_ADDRESS_COUNTRY_POST, + _NL_ADDRESS_COUNTRY_AB2, + _NL_ADDRESS_COUNTRY_AB3, + _NL_ADDRESS_COUNTRY_CAR, + _NL_ADDRESS_COUNTRY_NUM, + _NL_ADDRESS_COUNTRY_ISBN, + _NL_ADDRESS_LANG_NAME, + _NL_ADDRESS_LANG_AB, + _NL_ADDRESS_LANG_TERM, + _NL_ADDRESS_LANG_LIB, + _NL_ADDRESS_CODESET, + _NL_NUM_LC_ADDRESS, + + _NL_TELEPHONE_TEL_INT_FMT = _NL_ITEM (__LC_TELEPHONE, 0), + _NL_TELEPHONE_TEL_DOM_FMT, + _NL_TELEPHONE_INT_SELECT, + _NL_TELEPHONE_INT_PREFIX, + _NL_TELEPHONE_CODESET, + _NL_NUM_LC_TELEPHONE, + + _NL_MEASUREMENT_MEASUREMENT = _NL_ITEM (__LC_MEASUREMENT, 0), + _NL_MEASUREMENT_CODESET, + _NL_NUM_LC_MEASUREMENT, + + _NL_IDENTIFICATION_TITLE = _NL_ITEM (__LC_IDENTIFICATION, 0), + _NL_IDENTIFICATION_SOURCE, + _NL_IDENTIFICATION_ADDRESS, + _NL_IDENTIFICATION_CONTACT, + _NL_IDENTIFICATION_EMAIL, + _NL_IDENTIFICATION_TEL, + _NL_IDENTIFICATION_FAX, + _NL_IDENTIFICATION_LANGUAGE, + _NL_IDENTIFICATION_TERRITORY, + _NL_IDENTIFICATION_AUDIENCE, + _NL_IDENTIFICATION_APPLICATION, + _NL_IDENTIFICATION_ABBREVIATION, + _NL_IDENTIFICATION_REVISION, + _NL_IDENTIFICATION_DATE, + _NL_IDENTIFICATION_CATEGORY, + _NL_IDENTIFICATION_CODESET, + _NL_NUM_LC_IDENTIFICATION, +#endif + /* This marks the highest value used. */ + _NL_NUM +}; + + +/* Return the current locale's value for ITEM. + If ITEM is invalid, an empty string is returned. + + The string returned will not change until `setlocale' is called; + it is usually in read-only memory and cannot be modified. */ + +extern char *nl_langinfo (nl_item __item) __THROW; + + +#ifdef __UCLIBC_HAS_XLOCALE__ +#ifdef __USE_GNU +/* This interface is for the extended locale model. See for + more information. */ + +/* Get locale datatype definition. */ +# include + +/* Just like nl_langinfo but get the information from the locale object L. */ +extern char *nl_langinfo_l (nl_item __item, __locale_t l); +#endif +#endif + +__END_DECLS + +#endif /* langinfo.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/lastlog.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/lastlog.h new file mode 100644 index 0000000..8cc4254 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/lastlog.h @@ -0,0 +1,4 @@ +/* This header file is used in 4.3BSD to define `struct lastlog', + which we define in . */ + +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/libc-internal.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/libc-internal.h new file mode 100644 index 0000000..f9c162f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/libc-internal.h @@ -0,0 +1,3 @@ +#ifndef _LIBC_INTERNAL_H +#define _LIBC_INTERNAL_H 1 +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/libc-symbols.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/libc-symbols.h new file mode 100644 index 0000000..2933431 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/libc-symbols.h @@ -0,0 +1,726 @@ +/* Support macros for making weak and strong aliases for symbols, + and for using symbol sets and linker warnings with GNU ld. + Copyright (C) 1995-1998,2000-2003,2004,2005,2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LIBC_SYMBOLS_H +#define _LIBC_SYMBOLS_H 1 + +/* This is defined for the compilation of all C library code. features.h + tests this to avoid inclusion of stubs.h while compiling the library, + before stubs.h has been generated. Some library code that is shared + with other packages also tests this symbol to see if it is being + compiled as part of the C library. We must define this before including + config.h, because it makes some definitions conditional on whether libc + itself is being compiled, or just some generator program. */ +#define _LIBC 1 + + +/* This file's macros are included implicitly in the compilation of every + file in the C library by -imacros. + + We include uClibc_arch_features.h which is defined by arch devs. + It should define for us the following symbols: + + * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. + * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. + * ASM_TYPE_DIRECTIVE_PREFIX with `@' or `#' or whatever for .type, + or leave it undefined if there is no .type directive. + * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. + * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. + * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. + + */ + +#include + +/* Enable declarations of GNU extensions, since we are compiling them. */ +#define _GNU_SOURCE 1 + +/* Prepare for the case that `__builtin_expect' is not available. */ +#if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ < 96 +# define __builtin_expect(x, expected_value) (x) +#endif +#ifndef likely +# define likely(x) __builtin_expect((!!(x)),1) +#endif +#ifndef unlikely +# define unlikely(x) __builtin_expect((!!(x)),0) +#endif +#ifndef __LINUX_COMPILER_H +# define __LINUX_COMPILER_H +#endif +#ifndef __cast__ +# define __cast__(_to) +#endif + +#define attribute_unused __attribute__ ((unused)) + +#if defined __GNUC__ || defined __ICC +# define attribute_noreturn __attribute__ ((__noreturn__)) +#else +# define attribute_noreturn +#endif + +#ifndef NOT_IN_libc +# define IS_IN_libc 1 +#endif + +#ifdef __UCLIBC_NO_UNDERSCORES__ +# define NO_UNDERSCORES +#else +# undef NO_UNDERSCORES +#endif + +#ifdef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ +# define HAVE_ASM_SET_DIRECTIVE +#else +# undef HAVE_ASM_SET_DIRECTIVE +#endif + +#ifdef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ +# define ASM_GLOBAL_DIRECTIVE __UCLIBC_ASM_GLOBAL_DIRECTIVE__ +#else +# define ASM_GLOBAL_DIRECTIVE .global +#endif + +#ifdef __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ +# define HAVE_ASM_WEAK_DIRECTIVE +#else +# undef HAVE_ASM_WEAK_DIRECTIVE +#endif + +#ifdef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ +# define HAVE_ASM_WEAKEXT_DIRECTIVE +#else +# undef HAVE_ASM_WEAKEXT_DIRECTIVE +#endif + +#ifdef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ +# define HAVE_ASM_GLOBAL_DOT_NAME +#else +# undef HAVE_ASM_GLOBAL_DOT_NAME +#endif + +#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE +# define HAVE_WEAK_SYMBOLS +#endif + +#undef C_SYMBOL_NAME +#ifndef C_SYMBOL_NAME +# ifdef NO_UNDERSCORES +# define C_SYMBOL_NAME(name) name +# else +# define C_SYMBOL_NAME(name) _##name +# endif +#endif + +#ifdef __UCLIBC_ASM_LINE_SEP__ +# define ASM_LINE_SEP __UCLIBC_ASM_LINE_SEP__ +#else +# define ASM_LINE_SEP ; +#endif + +#ifdef HAVE_ASM_GLOBAL_DOT_NAME +# ifndef C_SYMBOL_DOT_NAME +# if defined __GNUC__ && defined __GNUC_MINOR__ \ + && (__GNUC__ << 16) + __GNUC_MINOR__ >= (3 << 16) + 1 +# define C_SYMBOL_DOT_NAME(name) .name +# else +# define C_SYMBOL_DOT_NAME(name) .##name +# endif +# endif +#endif + +#ifndef __ASSEMBLER__ +/* GCC understands weak symbols and aliases; use its interface where + possible, instead of embedded assembly language. */ + +/* Define ALIASNAME as a strong alias for NAME. */ +# define strong_alias(name, aliasname) _strong_alias(name, aliasname) +# define _strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); + +/* This comes between the return type and function name in + a function definition to make that definition weak. */ +# define weak_function __attribute__ ((weak)) +# define weak_const_function __attribute__ ((weak, __const__)) + +# ifdef HAVE_WEAK_SYMBOLS + +/* Define ALIASNAME as a weak alias for NAME. + If weak aliases are not available, this defines a strong alias. */ +# define weak_alias(name, aliasname) _weak_alias (name, aliasname) +# define _weak_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); + +/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ +# define weak_extern(symbol) _weak_extern (weak symbol) +# define _weak_extern(expr) _Pragma (#expr) + +# else + +# define weak_alias(name, aliasname) strong_alias(name, aliasname) +# define weak_extern(symbol) /* Nothing. */ + +# endif + +#else /* __ASSEMBLER__ */ + +# ifdef HAVE_ASM_SET_DIRECTIVE +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) ASM_LINE_SEP \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_DOT_NAME (alias),C_SYMBOL_DOT_NAME (original) +# define strong_data_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) +# else +# define strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) +# define strong_data_alias(original, alias) strong_alias(original, alias) +# endif +# else +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +# define strong_data_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +# else +# define strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +# define strong_data_alias(original, alias) strong_alias(original, alias) +# endif +# endif + +# ifdef HAVE_WEAK_SYMBOLS +# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define weak_alias(original, alias) \ + .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) ASM_LINE_SEP \ + .weakext C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original) +# else +# define weak_alias(original, alias) \ + .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) +# endif +# define weak_extern(symbol) \ + .weakext C_SYMBOL_NAME (symbol) + +# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ + +# ifdef HAVE_ASM_SET_DIRECTIVE +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define weak_alias(original, alias) \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) ASM_LINE_SEP \ + .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original) +# else +# define weak_alias(original, alias) \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) +# endif +# else /* ! HAVE_ASM_SET_DIRECTIVE */ +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define weak_alias(original, alias) \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ + .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +# else +# define weak_alias(original, alias) \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +# endif +# endif +# define weak_extern(symbol) \ + .weak C_SYMBOL_NAME (symbol) + +# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ + +# else /* ! HAVE_WEAK_SYMBOLS */ + +# define weak_alias(original, alias) strong_alias(original, alias) +# define weak_extern(symbol) /* Nothing */ +# endif /* ! HAVE_WEAK_SYMBOLS */ + +#endif /* __ASSEMBLER__ */ + +/* On some platforms we can make internal function calls (i.e., calls of + functions not exported) a bit faster by using a different calling + convention. */ +#ifndef internal_function +# define internal_function /* empty */ +#endif + +/* We want the .gnu.warning.SYMBOL section to be unallocated. */ +#define __make_section_unallocated(section_string) \ + __asm__ (".section " section_string "\n\t.previous"); + +/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus + section attributes on what looks like a comment to the assembler. */ +#ifdef __sparc__ //HAVE_SECTION_QUOTES +# define __sec_comment "\"\n#APP\n\t#\"" +#else +# define __sec_comment "\n#APP\n\t#" +#endif + +/* When a reference to SYMBOL is encountered, the linker will emit a + warning message MSG. */ +#define link_warning(symbol, msg) \ + __make_section_unallocated (".gnu.warning." #symbol) \ + static const char __evoke_link_warning_##symbol[] \ + __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \ + = msg; + +/* Handling on non-exported internal names. We have to do this only + for shared code. */ +#ifdef SHARED +# define INTUSE(name) name##_internal +# define INTDEF(name) strong_alias (name, name##_internal) +# define INTVARDEF(name) \ + _INTVARDEF (name, name##_internal) +# if defined HAVE_VISIBILITY_ATTRIBUTE +# define _INTVARDEF(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name), \ + visibility ("hidden"))); +# else +# define _INTVARDEF(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); +# endif +# define INTDEF2(name, newname) strong_alias (name, newname##_internal) +# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal) +#else +# define INTUSE(name) name +# define INTDEF(name) +# define INTVARDEF(name) +# define INTDEF2(name, newname) +# define INTVARDEF2(name, newname) +#endif + +/* The following macros are used for PLT bypassing within libc.so + (and if needed other libraries similarly). + First of all, you need to have the function prototyped somewhere, + say in foo/foo.h: + + int foo (int __bar); + + If calls to foo within libc.so should always go to foo defined in libc.so, + then in include/foo.h you add: + + libc_hidden_proto (foo) + + line and after the foo function definition: + + int foo (int __bar) + { + return __bar; + } + libc_hidden_def (foo) + + or + + int foo (int __bar) + { + return __bar; + } + libc_hidden_weak (foo) + + Similarly for global data. If references to foo within libc.so should + always go to foo defined in libc.so, then in include/foo.h you add: + + libc_hidden_proto (foo) + + line and after foo's definition: + + int foo = INITIAL_FOO_VALUE; + libc_hidden_data_def (foo) + + or + + int foo = INITIAL_FOO_VALUE; + libc_hidden_data_weak (foo) + + If foo is normally just an alias (strong or weak) to some other function, + you should use the normal strong_alias first, then add libc_hidden_def + or libc_hidden_weak: + + int baz (int __bar) + { + return __bar; + } + strong_alias (baz, foo) + libc_hidden_weak (foo) + + If the function should be internal to multiple objects, say ld.so and + libc.so, the best way is to use: + + #if !defined NOT_IN_libc || defined IS_IN_rtld + hidden_proto (foo) + #endif + + in include/foo.h and the normal macros at all function definitions + depending on what DSO they belong to. + + If versioned_symbol macro is used to define foo, + libc_hidden_ver macro should be used, as in: + + int __real_foo (int __bar) + { + return __bar; + } + versioned_symbol (libc, __real_foo, foo, GLIBC_2_1); + libc_hidden_ver (__real_foo, foo) */ + +/* uClibc specific (the above comment was copied from glibc): + * a. when ppc64 will be supported, we need changes to support: + * strong_data_alias (used by asm hidden_data_def) + * b. libc_hidden_proto(foo) should be added after the header having foo's prototype + * or after extern foo... to all source files that should use the internal version + * of foo within libc, even to the file defining foo itself, libc_hidden_def does + * not hide __GI_foo itself, although the name suggests it (hiding is done exclusively + * by libc_hidden_proto). The reasoning to have it after the header w/ foo's prototype is + * to get first the __REDIRECT from original header and then create the __GI_foo alias + * c. no versioning support, hidden[_data]_ver are noop + * d. hidden_def() in asm is _hidden_strong_alias (not strong_alias) */ + +/* Arrange to hide uClibc internals */ +#if (defined __GNUC__ && \ + (defined __GNUC_MINOR__ && ( __GNUC__ >= 3 && __GNUC_MINOR__ >= 3 ) \ + || __GNUC__ >= 4)) || defined __ICC +# define attribute_hidden __attribute__ ((visibility ("hidden"))) +# define __hidden_proto_hiddenattr(attrs...) __attribute__ ((visibility ("hidden"), ##attrs)) +#else +# define attribute_hidden +# define __hidden_proto_hiddenattr(attrs...) +#endif + +#if /*!defined STATIC &&*/ !defined __BCC__ +# ifndef __ASSEMBLER__ +# define hidden_proto(name, attrs...) __hidden_proto (name, __GI_##name, ##attrs) +# define __hidden_proto(name, internal, attrs...) \ + extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \ + __hidden_proto_hiddenattr (attrs); +# define __hidden_asmname(name) __hidden_asmname1 (__USER_LABEL_PREFIX__, name) +# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name) +# define __hidden_asmname2(prefix, name) #prefix name +# define __hidden_ver1(local, internal, name) \ + extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \ + extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) +# define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name); +# define hidden_data_ver(local, name) hidden_ver(local, name) +# define hidden_def(name) __hidden_ver1(__GI_##name, name, name); +# define hidden_data_def(name) hidden_def(name) +# define hidden_weak(name) \ + __hidden_ver1(__GI_##name, name, name) __attribute__((weak)); +# define hidden_data_weak(name) hidden_weak(name) + +# else /* __ASSEMBLER__ */ +# ifdef HAVE_ASM_SET_DIRECTIVE +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define _hidden_strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) ASM_LINE_SEP \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_DOT_NAME (alias),C_SYMBOL_DOT_NAME (original) +# else +# define _hidden_strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) +# endif +# else +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define _hidden_strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +# else +# define _hidden_strong_alias(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +# endif +# endif + +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define _hidden_weak_alias(original, alias) \ + .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + weak_alias(original, alias) +# else +# define _hidden_weak_alias(original, alias) \ + .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + weak_alias(original, alias) +# endif + +/* For assembly, we need to do the opposite of what we do in C: + in assembly gcc __REDIRECT stuff is not in place, so functions + are defined by its normal name and we need to create the + __GI_* alias to it, in C __REDIRECT causes the function definition + to use __GI_* name and we need to add alias to the real name. + There is no reason to use hidden_weak over hidden_def in assembly, + but we provide it for consistency with the C usage. + hidden_proto doesn't make sense for assembly but the equivalent + is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */ +# define hidden_def(name) _hidden_strong_alias (name, __GI_##name) +# define hidden_weak(name) _hidden_weak_alias (name, __GI_##name) +# define hidden_ver(local, name) strong_alias (local, __GI_##name) +# define hidden_data_def(name) _hidden_strong_alias (name, __GI_##name) +# define hidden_data_weak(name) _hidden_weak_alias (name, __GI_##name) +# define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name) +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define HIDDEN_JUMPTARGET(name) .__GI_##name +# else +# define HIDDEN_JUMPTARGET(name) __GI_##name +# endif +# endif /* __ASSEMBLER__ */ +#else /* SHARED */ +# ifndef __ASSEMBLER__ +# define hidden_proto(name, attrs...) +# else +# define HIDDEN_JUMPTARGET(name) name +# endif /* Not __ASSEMBLER__ */ +# define hidden_weak(name) +# define hidden_def(name) +# define hidden_ver(local, name) +# define hidden_data_weak(name) +# define hidden_data_def(name) +# define hidden_data_ver(local, name) +#endif /* SHARED */ + +/* uClibc does not support versioning yet. */ +#define versioned_symbol(lib, local, symbol, version) /* weak_alias(local, symbol) */ +#undef hidden_ver +#define hidden_ver(local, name) /* strong_alias(local, __GI_##name) */ +#undef hidden_data_ver +#define hidden_data_ver(local, name) /* strong_alias(local,__GI_##name) */ + +#if !defined NOT_IN_libc +# define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libc_hidden_def(name) hidden_def (name) +# define libc_hidden_weak(name) hidden_weak (name) +# define libc_hidden_ver(local, name) hidden_ver (local, name) +# define libc_hidden_data_def(name) hidden_data_def (name) +# define libc_hidden_data_weak(name) hidden_data_weak (name) +# define libc_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libc_hidden_proto(name, attrs...) +# define libc_hidden_def(name) +# define libc_hidden_weak(name) +# define libc_hidden_ver(local, name) +# define libc_hidden_data_def(name) +# define libc_hidden_data_weak(name) +# define libc_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_rtld +# define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define rtld_hidden_def(name) hidden_def (name) +# define rtld_hidden_weak(name) hidden_weak (name) +# define rtld_hidden_ver(local, name) hidden_ver (local, name) +# define rtld_hidden_data_def(name) hidden_data_def (name) +# define rtld_hidden_data_weak(name) hidden_data_weak (name) +# define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define rtld_hidden_proto(name, attrs...) +# define rtld_hidden_def(name) +# define rtld_hidden_weak(name) +# define rtld_hidden_ver(local, name) +# define rtld_hidden_data_def(name) +# define rtld_hidden_data_weak(name) +# define rtld_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_libm +# define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libm_hidden_def(name) hidden_def (name) +# define libm_hidden_weak(name) hidden_weak (name) +# define libm_hidden_ver(local, name) hidden_ver (local, name) +# define libm_hidden_data_def(name) hidden_data_def (name) +# define libm_hidden_data_weak(name) hidden_data_weak (name) +# define libm_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libm_hidden_proto(name, attrs...) +# define libm_hidden_def(name) +# define libm_hidden_weak(name) +# define libm_hidden_ver(local, name) +# define libm_hidden_data_def(name) +# define libm_hidden_data_weak(name) +# define libm_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_libresolv +# define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libresolv_hidden_def(name) hidden_def (name) +# define libresolv_hidden_weak(name) hidden_weak (name) +# define libresolv_hidden_ver(local, name) hidden_ver (local, name) +# define libresolv_hidden_data_def(name) hidden_data_def (name) +# define libresolv_hidden_data_weak(name) hidden_data_weak (name) +# define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libresolv_hidden_proto(name, attrs...) +# define libresolv_hidden_def(name) +# define libresolv_hidden_weak(name) +# define libresolv_hidden_ver(local, name) +# define libresolv_hidden_data_def(name) +# define libresolv_hidden_data_weak(name) +# define libresolv_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_librt +# define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define librt_hidden_def(name) hidden_def (name) +# define librt_hidden_weak(name) hidden_weak (name) +# define librt_hidden_ver(local, name) hidden_ver (local, name) +# define librt_hidden_data_def(name) hidden_data_def (name) +# define librt_hidden_data_weak(name) hidden_data_weak (name) +# define librt_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define librt_hidden_proto(name, attrs...) +# define librt_hidden_def(name) +# define librt_hidden_weak(name) +# define librt_hidden_ver(local, name) +# define librt_hidden_data_def(name) +# define librt_hidden_data_weak(name) +# define librt_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_libdl +# define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libdl_hidden_def(name) hidden_def (name) +# define libdl_hidden_weak(name) hidden_weak (name) +# define libdl_hidden_ver(local, name) hidden_ver (local, name) +# define libdl_hidden_data_def(name) hidden_data_def (name) +# define libdl_hidden_data_weak(name) hidden_data_weak (name) +# define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libdl_hidden_proto(name, attrs...) +# define libdl_hidden_def(name) +# define libdl_hidden_weak(name) +# define libdl_hidden_ver(local, name) +# define libdl_hidden_data_def(name) +# define libdl_hidden_data_weak(name) +# define libdl_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_libintl +# define libintl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libintl_hidden_def(name) hidden_def (name) +# define libintl_hidden_weak(name) hidden_weak (name) +# define libintl_hidden_ver(local, name) hidden_ver (local, name) +# define libintl_hidden_data_def(name) hidden_data_def (name) +# define libintl_hidden_data_weak(name) hidden_data_weak (name) +# define libintl_hidden_data_ver(local, name) hidden_data_ver(local, name) +#else +# define libintl_hidden_proto(name, attrs...) +# define libintl_hidden_def(name) +# define libintl_hidden_weak(name) +# define libintl_hidden_ver(local, name) +# define libintl_hidden_data_def(name) +# define libintl_hidden_data_weak(name) +# define libintl_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_libnsl +# define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libnsl_hidden_def(name) hidden_def (name) +# define libnsl_hidden_weak(name) hidden_weak (name) +# define libnsl_hidden_ver(local, name) hidden_ver (local, name) +# define libnsl_hidden_data_def(name) hidden_data_def (name) +# define libnsl_hidden_data_weak(name) hidden_data_weak (name) +# define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libnsl_hidden_proto(name, attrs...) +# define libnsl_hidden_def(name) +# define libnsl_hidden_weak(name) +# define libnsl_hidden_ver(local, name) +# define libnsl_hidden_data_def(name) +# define libnsl_hidden_data_weak(name) +# define libnsl_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_libutil +# define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libutil_hidden_def(name) hidden_def (name) +# define libutil_hidden_weak(name) hidden_weak (name) +# define libutil_hidden_ver(local, name) hidden_ver (local, name) +# define libutil_hidden_data_def(name) hidden_data_def (name) +# define libutil_hidden_data_weak(name) hidden_data_weak (name) +# define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libutil_hidden_proto(name, attrs...) +# define libutil_hidden_def(name) +# define libutil_hidden_weak(name) +# define libutil_hidden_ver(local, name) +# define libutil_hidden_data_def(name) +# define libutil_hidden_data_weak(name) +# define libutil_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_libcrypt +# define libcrypt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libcrypt_hidden_def(name) hidden_def (name) +# define libcrypt_hidden_weak(name) hidden_weak (name) +# define libcrypt_hidden_ver(local, name) hidden_ver (local, name) +# define libcrypt_hidden_data_def(name) hidden_data_def (name) +# define libcrypt_hidden_data_weak(name) hidden_data_weak (name) +# define libcrypt_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libcrypt_hidden_proto(name, attrs...) +# define libcrypt_hidden_def(name) +# define libcrypt_hidden_weak(name) +# define libcrypt_hidden_ver(local, name) +# define libcrypt_hidden_data_def(name) +# define libcrypt_hidden_data_weak(name) +# define libcrypt_hidden_data_ver(local, name) +#endif + +#if defined NOT_IN_libc && defined IS_IN_libpthread +# define libpthread_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libpthread_hidden_def(name) hidden_def (name) +# define libpthread_hidden_weak(name) hidden_weak (name) +# define libpthread_hidden_ver(local, name) hidden_ver (local, name) +# define libpthread_hidden_data_def(name) hidden_data_def (name) +# define libpthread_hidden_data_weak(name) hidden_data_weak (name) +# define libpthread_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libpthread_hidden_proto(name, attrs...) +# define libpthread_hidden_def(name) +# define libpthread_hidden_weak(name) +# define libpthread_hidden_ver(local, name) +# define libpthread_hidden_data_def(name) +# define libpthread_hidden_data_weak(name) +# define libpthread_hidden_data_ver(local, name) +#endif + +#endif /* libc-symbols.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/libgen.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/libgen.h new file mode 100644 index 0000000..b252543 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/libgen.h @@ -0,0 +1,40 @@ +/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LIBGEN_H +#define _LIBGEN_H 1 + +#include + +__BEGIN_DECLS + +/* Return directory part of PATH or "." if none is available. */ +extern char *dirname (char *__path) __THROW; + +/* Return final component of PATH. + + This is the weird XPG version of this function. It sometimes will + modify its argument. Therefore we normally use the GNU version (in + ) and only if this header is included make the XPG + version available under the real name. */ +extern char *__xpg_basename (char *__path) __THROW; +#define basename __xpg_basename + +__END_DECLS + +#endif /* libgen.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/limits.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/limits.h new file mode 100644 index 0000000..45cd6f2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/limits.h @@ -0,0 +1,153 @@ +/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types + */ + +#ifndef _LIBC_LIMITS_H_ +#define _LIBC_LIMITS_H_ 1 + +#include + + +/* Maximum length of any multibyte character in any locale. + We define this value here since the gcc header does not define + the correct value. */ +#define MB_LEN_MAX 16 + + +/* If we are not using GNU CC we have to define all the symbols ourself. + Otherwise use gcc's definitions (see below). */ +#if !defined __GNUC__ || __GNUC__ < 2 + +/* We only protect from multiple inclusion here, because all the other + #include's protect themselves, and in GCC 2 we may #include_next through + multiple copies of this file before we get to GCC's. */ +# ifndef _LIMITS_H +# define _LIMITS_H 1 + +#include + +/* We don't have #include_next. + Define ANSI for standard 32-bit words. */ + +/* These assume 8-bit `char's, 16-bit `short int's, + and 32-bit `int's and `long int's. */ + +/* Number of bits in a `char'. */ +# define CHAR_BIT 8 + +/* Minimum and maximum values a `signed char' can hold. */ +# define SCHAR_MIN (-128) +# define SCHAR_MAX 127 + +/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ +# define UCHAR_MAX 255 + +/* Minimum and maximum values a `char' can hold. */ +# ifdef __CHAR_UNSIGNED__ +# define CHAR_MIN 0 +# define CHAR_MAX UCHAR_MAX +# else +# define CHAR_MIN SCHAR_MIN +# define CHAR_MAX SCHAR_MAX +# endif + +/* Minimum and maximum values a `signed short int' can hold. */ +# define SHRT_MIN (-32768) +# define SHRT_MAX 32767 + +/* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */ +# define USHRT_MAX 65535 + +/* Minimum and maximum values a `signed int' can hold. */ +# define INT_MIN (-INT_MAX - 1) +# define INT_MAX 2147483647 + +/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ +# define UINT_MAX 4294967295U + +/* Minimum and maximum values a `signed long int' can hold. */ +# if __WORDSIZE == 64 +# define LONG_MAX 9223372036854775807L +# else +# define LONG_MAX 2147483647L +# endif +# define LONG_MIN (-LONG_MAX - 1L) + +/* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */ +# if __WORDSIZE == 64 +# define ULONG_MAX 18446744073709551615UL +# else +# define ULONG_MAX 4294967295UL +# endif + +# ifdef __USE_ISOC99 + +/* Minimum and maximum values a `signed long long int' can hold. */ +# define LLONG_MAX 9223372036854775807LL +# define LLONG_MIN (-LLONG_MAX - 1LL) + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ +# define ULLONG_MAX 18446744073709551615ULL + +# endif /* ISO C99 */ + +# endif /* limits.h */ +#endif /* GCC 2. */ + +#endif /* !_LIBC_LIMITS_H_ */ + + /* Get the compiler's limits.h, which defines almost all the ISO constants. + + We put this #include_next outside the double inclusion check because + it should be possible to include this file more than once and still get + the definitions from gcc's header. */ +#if defined __GNUC__ && !defined _GCC_LIMITS_H_ +/* `_GCC_LIMITS_H_' is what GCC's file defines. */ +# include_next + +/* The files in some gcc versions don't define LLONG_MIN, + LLONG_MAX, and ULLONG_MAX. Instead only the values gcc defined for + ages are available. */ +# ifdef __USE_ISOC99 +# ifndef LLONG_MIN +# define LLONG_MIN LONG_LONG_MIN +# endif +# ifndef LLONG_MAX +# define LLONG_MAX LONG_LONG_MAX +# endif +# ifndef ULLONG_MAX +# define ULLONG_MAX ULONG_LONG_MAX +# endif +# endif +#endif + +#ifdef __USE_POSIX +/* POSIX adds things to . */ +# include +#endif + +#ifdef __USE_POSIX2 +# include +#endif + +#ifdef __USE_XOPEN +# include +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/link.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/link.h new file mode 100644 index 0000000..b69dcda --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/link.h @@ -0,0 +1,238 @@ +/* Data structure for communication from the run-time dynamic linker for + loaded ELF shared objects. + Copyright (C) 1995-2001, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LINK_H +#define _LINK_H 1 + +#include +#include +#include +#include +#if defined _LIBC && defined __UCLIBC_HAS_THREADS_NATIVE__ +#include +#endif + +/* We use this macro to refer to ELF types independent of the native wordsize. + `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ +#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type) +#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) +#define _ElfW_1(e,w,t) e##w##t + +#include /* Defines __ELF_NATIVE_CLASS. */ + +/* Rendezvous structure used by the run-time dynamic linker to communicate + details of shared object loading to the debugger. If the executable's + dynamic section has a DT_DEBUG element, the run-time linker sets that + element's value to the address where this structure can be found. */ + +struct r_debug + { + int r_version; /* Version number for this protocol. */ + + struct link_map *r_map; /* Head of the chain of loaded objects. */ + + /* This is the address of a function internal to the run-time linker, + that will always be called when the linker begins to map in a + library or unmap it, and again when the mapping change is complete. + The debugger can set a breakpoint at this address if it wants to + notice shared object mapping changes. */ + ElfW(Addr) r_brk; + enum + { + /* This state value describes the mapping change taking place when + the `r_brk' address is called. */ + RT_CONSISTENT, /* Mapping change is complete. */ + RT_ADD, /* Beginning to add a new object. */ + RT_DELETE /* Beginning to remove an object mapping. */ + } r_state; + + ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */ + }; + +/* This is the instance of that structure used by the dynamic linker. */ +extern struct r_debug _r_debug; + +/* This symbol refers to the "dynamic structure" in the `.dynamic' section + of whatever module refers to `_DYNAMIC'. So, to find its own + `struct r_debug', a program could do: + for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) + if (dyn->d_tag == DT_DEBUG) + r_debug = (struct r_debug *) dyn->d_un.d_ptr; + */ +extern ElfW(Dyn) _DYNAMIC[]; + +#ifdef __FDPIC__ +# include +#endif + +/* Structure describing a loaded shared object. The `l_next' and `l_prev' + members form a chain of all the shared objects loaded at startup. + + These data structures exist in space used by the run-time dynamic linker; + modifying them may have disastrous results. */ + +struct link_map + { + /* These first few members are part of the protocol with the debugger. + This is the same format used in SVR4. */ + +#ifdef __FDPIC__ + struct elf32_fdpic_loadaddr l_addr; +#else + ElfW(Addr) l_addr; /* Base address shared object is loaded at. */ +#endif + char *l_name; /* Absolute file name object was found in. */ + ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ + struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ + +#ifdef USE_TLS + /* Thread-local storage related info. */ + + /* Start of the initialization image. */ + void *l_tls_initimage; + /* Size of the initialization image. */ + size_t l_tls_initimage_size; + /* Size of the TLS block. */ + size_t l_tls_blocksize; + /* Alignment requirement of the TLS block. */ + size_t l_tls_align; + /* Offset of first byte module alignment. */ + size_t l_tls_firstbyte_offset; +# ifndef NO_TLS_OFFSET +# define NO_TLS_OFFSET 0 +# endif + /* For objects present at startup time: offset in the static TLS block. */ + ptrdiff_t l_tls_offset; + /* Index of the module in the dtv array. */ + size_t l_tls_modid; + /* Nonzero if _dl_init_static_tls should be called for this module */ + unsigned int l_need_tls_init:1; +#endif + }; + +#ifdef __USE_GNU + +#if 0 +/* Version numbers for la_version handshake interface. */ +#define LAV_CURRENT 1 + +/* Activity types signaled through la_activity. */ +enum + { + LA_ACT_CONSISTENT, /* Link map consistent again. */ + LA_ACT_ADD, /* New object will be added. */ + LA_ACT_DELETE /* Objects will be removed. */ + }; + +/* Values representing origin of name for dynamic loading. */ +enum + { + LA_SER_ORIG = 0x01, /* Original name. */ + LA_SER_LIBPATH = 0x02, /* Directory from LD_LIBRARY_PATH. */ + LA_SER_RUNPATH = 0x04, /* Directory from RPATH/RUNPATH. */ + LA_SER_CONFIG = 0x08, /* Found through ldconfig. */ + LA_SER_DEFAULT = 0x40, /* Default directory. */ + LA_SER_SECURE = 0x80 /* Unused. */ + }; + +/* Values for la_objopen return value. */ +enum + { + LA_FLG_BINDTO = 0x01, /* Audit symbols bound to this object. */ + LA_FLG_BINDFROM = 0x02 /* Audit symbols bound from this object. */ + }; + +/* Values for la_symbind flags parameter. */ +enum + { + LA_SYMB_NOPLTENTER = 0x01, /* la_pltenter will not be called. */ + LA_SYMB_NOPLTEXIT = 0x02, /* la_pltexit will not be called. */ + LA_SYMB_STRUCTCALL = 0x04, /* Return value is a structure. */ + LA_SYMB_DLSYM = 0x08, /* Binding due to dlsym call. */ + LA_SYMB_ALTVALUE = 0x10 /* Value has been changed by a previous + la_symbind call. */ + }; +#endif + +struct dl_phdr_info + { +#ifdef __FDPIC__ + struct elf32_fdpic_loadaddr dlpi_addr; +#else + ElfW(Addr) dlpi_addr; +#endif + const char *dlpi_name; + const ElfW(Phdr) *dlpi_phdr; + ElfW(Half) dlpi_phnum; + +#if 0 + /* Note: Following members were introduced after the first + version of this structure was available. Check the SIZE + argument passed to the dl_iterate_phdr callback to determine + whether or not each later member is available. */ + + /* Incremented when a new object may have been added. */ + unsigned long long int dlpi_adds; + /* Incremented when an object may have been removed. */ + unsigned long long int dlpi_subs; + + /* If there is a PT_TLS segment, its module ID as used in + TLS relocations, else zero. */ + size_t dlpi_tls_modid; + + /* The address of the calling thread's instance of this module's + PT_TLS segment, if it has one and it has been allocated + in the calling thread, otherwise a null pointer. */ + void *dlpi_tls_data; +#endif + }; + +__BEGIN_DECLS + +extern int dl_iterate_phdr (int (*__callback) (struct dl_phdr_info *, + size_t, void *), + void *__data); + + +#if 0 +/* Prototypes for the ld.so auditing interfaces. These are not + defined anywhere in ld.so but instead have to be provided by the + auditing DSO. */ +extern unsigned int la_version (unsigned int __version); +extern void la_activity (uintptr_t *__cookie, unsigned int __flag); +extern char *la_objsearch (const char *__name, uintptr_t *__cookie, + unsigned int __flag); +extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid, + uintptr_t *__cookie); +extern void la_preinit (uintptr_t *__cookie); +extern uintptr_t la_symbind32 (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, uintptr_t *__defcook, + unsigned int *__flags, const char *__symname); +extern uintptr_t la_symbind64 (Elf64_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, uintptr_t *__defcook, + unsigned int *__flags, const char *__symname); +extern unsigned int la_objclose (uintptr_t *__cookie); +#endif + +__END_DECLS + +#endif + +#endif /* link.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/..install.cmd new file mode 100644 index 0000000..0bc52bb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux mips acct.h adb.h adfs_fs.h affs_hardblocks.h agpgart.h aio_abi.h apm_bios.h arcfb.h atalk.h atm.h atm_eni.h atm_he.h atm_idt77105.h atm_nicstar.h atm_tcp.h atm_zatm.h atmapi.h atmarp.h atmbr2684.h atmclip.h atmdev.h atmioc.h atmlec.h atmmpc.h atmppp.h atmsap.h atmsvc.h audit.h auto_fs.h auto_fs4.h auxvec.h ax25.h b1lli.h baycom.h bfs_fs.h binfmts.h blkpg.h blktrace_api.h bpqether.h bsg.h can.h capability.h capi.h cciss_ioctl.h cdk.h cdrom.h cgroupstats.h chio.h cm4000_cs.h cn_proc.h coda.h coda_psdev.h coff.h comstats.h connector.h const.h cramfs_fs.h cuda.h cyclades.h cycx_cfm.h dcbnl.h dccp.h dlm.h dlm_device.h dlm_netlink.h dlm_plock.h dlmconstants.h dm-ioctl.h dn.h dqblk_xfs.h edd.h efs_fs_sb.h elf-em.h elf-fdpic.h elf.h elfcore.h errno.h errqueue.h ethtool.h eventpoll.h ext2_fs.h fadvise.h falloc.h fb.h fcntl.h fd.h fdreg.h fib_rules.h fiemap.h filter.h firewire-cdev.h firewire-constants.h flat.h fs.h fuse.h futex.h gameport.h gen_stats.h generic_serial.h genetlink.h gfs2_ondisk.h gigaset_dev.h hayesesp.h hdlc.h hdlcdrv.h hdreg.h hid.h hiddev.h hidraw.h hpet.h hysdn_if.h i2c-dev.h i2c.h i2o-dev.h i8k.h icmp.h icmpv6.h if.h if_addr.h if_addrlabel.h if_arcnet.h if_arp.h if_bonding.h if_bridge.h if_cablemodem.h if_ec.h if_eql.h if_ether.h if_fc.h if_fddi.h if_frad.h if_hippi.h if_infiniband.h if_link.h if_ltalk.h if_packet.h if_phonet.h if_plip.h if_ppp.h if_pppol2tp.h if_pppox.h if_slip.h if_strip.h if_tr.h if_tun.h if_tunnel.h if_vlan.h igmp.h in.h in6.h in_route.h inet_diag.h inotify.h input.h ioctl.h ip.h ip6_tunnel.h ip_vs.h ipc.h ipmi.h ipmi_msgdefs.h ipsec.h ipv6.h ipv6_route.h ipx.h irda.h irqnr.h isdn.h isdn_divertif.h isdn_ppp.h isdnif.h iso_fs.h ivtv.h ivtvfb.h ixjuser.h jffs2.h joystick.h kd.h kdev_t.h kernel.h kernelcapi.h keyboard.h keyctl.h limits.h llc.h loop.h lp.h magic.h major.h map_to_7segment.h matroxfb.h mempolicy.h meye.h mii.h minix_fs.h mman.h mmtimer.h mqueue.h mroute.h mroute6.h msdos_fs.h msg.h mtio.h n_r3964.h nbd.h ncp.h ncp_fs.h ncp_mount.h ncp_no.h neighbour.h net.h net_dropmon.h netdevice.h netfilter.h netfilter_arp.h netfilter_bridge.h netfilter_decnet.h netfilter_ipv4.h netfilter_ipv6.h netlink.h netrom.h nfs.h nfs2.h nfs3.h nfs4.h nfs4_mount.h nfs_fs.h nfs_idmap.h nfs_mount.h nfsacl.h nl80211.h nubus.h nvram.h oom.h param.h parport.h patchkey.h pci.h pci_regs.h personality.h pfkeyv2.h pg.h phantom.h phonet.h pkt_cls.h pkt_sched.h pktcdvd.h pmu.h poll.h posix_types.h ppdev.h ppp-comp.h ppp_defs.h prctl.h ptrace.h qnx4_fs.h qnxtypes.h quota.h radeonfb.h random.h raw.h reboot.h reiserfs_fs.h reiserfs_xattr.h resource.h romfs_fs.h rose.h route.h rtc.h rtnetlink.h scc.h sched.h screen_info.h sdla.h selinux_netlink.h sem.h serial.h serial_core.h serial_reg.h serio.h shm.h signal.h signalfd.h smb.h smb_fs.h smb_mount.h smbno.h snmp.h socket.h sockios.h som.h sonet.h sonypi.h sound.h soundcard.h stat.h stddef.h string.h suspend_ioctls.h swab.h synclink.h sysctl.h taskstats.h tcp.h telephony.h termios.h time.h times.h timex.h tiocl.h tipc.h tipc_config.h toshiba.h tty.h types.h udf_fs_i.h udp.h uinput.h uio.h ultrasound.h un.h unistd.h usbdevice_fs.h utime.h utsname.h veth.h videodev.h videodev2.h videotext.h virtio_9p.h virtio_balloon.h virtio_blk.h virtio_config.h virtio_console.h virtio_net.h virtio_pci.h virtio_ring.h virtio_rng.h vt.h wait.h wanrouter.h watchdog.h wimax.h wireless.h x25.h xattr.h xfrm.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux mips version.h; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/acct.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/acct.h new file mode 100644 index 0000000..caea59d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/acct.h @@ -0,0 +1,116 @@ +/* + * BSD Process Accounting for Linux - Definitions + * + * Author: Marco van Wieringen (mvw@planets.elm.net) + * + * This header file contains the definitions needed to implement + * BSD-style process accounting. The kernel accounting code and all + * user-level programs that try to do something useful with the + * process accounting log must include this file. + * + * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V. + * + */ + +#ifndef _LINUX_ACCT_H +#define _LINUX_ACCT_H + +#include + +#include +#include + +/* + * comp_t is a 16-bit "floating" point number with a 3-bit base 8 + * exponent and a 13-bit fraction. + * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction + * (leading 1 not stored). + * See linux/kernel/acct.c for the specific encoding systems used. + */ + +typedef __u16 comp_t; +typedef __u32 comp2_t; + +/* + * accounting file record + * + * This structure contains all of the information written out to the + * process accounting file whenever a process exits. + */ + +#define ACCT_COMM 16 + +struct acct +{ + char ac_flag; /* Flags */ + char ac_version; /* Always set to ACCT_VERSION */ + /* for binary compatibility back until 2.0 */ + __u16 ac_uid16; /* LSB of Real User ID */ + __u16 ac_gid16; /* LSB of Real Group ID */ + __u16 ac_tty; /* Control Terminal */ + __u32 ac_btime; /* Process Creation Time */ + comp_t ac_utime; /* User Time */ + comp_t ac_stime; /* System Time */ + comp_t ac_etime; /* Elapsed Time */ + comp_t ac_mem; /* Average Memory Usage */ + comp_t ac_io; /* Chars Transferred */ + comp_t ac_rw; /* Blocks Read or Written */ + comp_t ac_minflt; /* Minor Pagefaults */ + comp_t ac_majflt; /* Major Pagefaults */ + comp_t ac_swaps; /* Number of Swaps */ +/* m68k had no padding here. */ +#if !defined(CONFIG_M68K) || !defined(__KERNEL__) + __u16 ac_ahz; /* AHZ */ +#endif + __u32 ac_exitcode; /* Exitcode */ + char ac_comm[ACCT_COMM + 1]; /* Command Name */ + __u8 ac_etime_hi; /* Elapsed Time MSB */ + __u16 ac_etime_lo; /* Elapsed Time LSB */ + __u32 ac_uid; /* Real User ID */ + __u32 ac_gid; /* Real Group ID */ +}; + +struct acct_v3 +{ + char ac_flag; /* Flags */ + char ac_version; /* Always set to ACCT_VERSION */ + __u16 ac_tty; /* Control Terminal */ + __u32 ac_exitcode; /* Exitcode */ + __u32 ac_uid; /* Real User ID */ + __u32 ac_gid; /* Real Group ID */ + __u32 ac_pid; /* Process ID */ + __u32 ac_ppid; /* Parent Process ID */ + __u32 ac_btime; /* Process Creation Time */ + float ac_etime; /* Elapsed Time */ + comp_t ac_utime; /* User Time */ + comp_t ac_stime; /* System Time */ + comp_t ac_mem; /* Average Memory Usage */ + comp_t ac_io; /* Chars Transferred */ + comp_t ac_rw; /* Blocks Read or Written */ + comp_t ac_minflt; /* Minor Pagefaults */ + comp_t ac_majflt; /* Major Pagefaults */ + comp_t ac_swaps; /* Number of Swaps */ + char ac_comm[ACCT_COMM]; /* Command Name */ +}; + +/* + * accounting flags + */ + /* bit set when the process ... */ +#define AFORK 0x01 /* ... executed fork, but did not exec */ +#define ASU 0x02 /* ... used super-user privileges */ +#define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */ +#define ACORE 0x08 /* ... dumped core */ +#define AXSIG 0x10 /* ... was killed by a signal */ + +#ifdef __BIG_ENDIAN +#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ +#else +#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ +#endif + +#define ACCT_VERSION 2 +#define AHZ (HZ) + + +#endif /* _LINUX_ACCT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/adb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/adb.h new file mode 100644 index 0000000..0815025 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/adb.h @@ -0,0 +1,44 @@ +/* + * Definitions for ADB (Apple Desktop Bus) support. + */ +#ifndef __ADB_H +#define __ADB_H + +/* ADB commands */ +#define ADB_BUSRESET 0 +#define ADB_FLUSH(id) (0x01 | ((id) << 4)) +#define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4)) +#define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4)) + +/* ADB default device IDs (upper 4 bits of ADB command byte) */ +#define ADB_DONGLE 1 /* "software execution control" devices */ +#define ADB_KEYBOARD 2 +#define ADB_MOUSE 3 +#define ADB_TABLET 4 +#define ADB_MODEM 5 +#define ADB_MISC 7 /* maybe a monitor */ + +#define ADB_RET_OK 0 +#define ADB_RET_TIMEOUT 3 + +/* The kind of ADB request. The controller may emulate some + or all of those CUDA/PMU packet kinds */ +#define ADB_PACKET 0 +#define CUDA_PACKET 1 +#define ERROR_PACKET 2 +#define TIMER_PACKET 3 +#define POWER_PACKET 4 +#define MACIIC_PACKET 5 +#define PMU_PACKET 6 +#define ADB_QUERY 7 + +/* ADB queries */ + +/* ADB_QUERY_GETDEVINFO + * Query ADB slot for device presence + * data[2] = id, rep[0] = orig addr, rep[1] = handler_id + */ +#define ADB_QUERY_GETDEVINFO 1 + + +#endif /* __ADB_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/adfs_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/adfs_fs.h new file mode 100644 index 0000000..fc9a5a1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/adfs_fs.h @@ -0,0 +1,44 @@ +#ifndef _ADFS_FS_H +#define _ADFS_FS_H + +#include +#include + +/* + * Disc Record at disc address 0xc00 + */ +struct adfs_discrecord { + __u8 log2secsize; + __u8 secspertrack; + __u8 heads; + __u8 density; + __u8 idlen; + __u8 log2bpmb; + __u8 skew; + __u8 bootoption; + __u8 lowsector; + __u8 nzones; + __le16 zone_spare; + __le32 root; + __le32 disc_size; + __le16 disc_id; + __u8 disc_name[10]; + __le32 disc_type; + __le32 disc_size_high; + __u8 log2sharesize:4; + __u8 unused40:4; + __u8 big_flag:1; + __u8 unused41:1; + __u8 nzones_high; + __le32 format_version; + __le32 root_size; + __u8 unused52[60 - 52]; +}; + +#define ADFS_DISCRECORD (0xc00) +#define ADFS_DR_OFFSET (0x1c0) +#define ADFS_DR_SIZE 60 +#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/affs_hardblocks.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/affs_hardblocks.h new file mode 100644 index 0000000..f1b948c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/affs_hardblocks.h @@ -0,0 +1,68 @@ +#ifndef AFFS_HARDBLOCKS_H +#define AFFS_HARDBLOCKS_H + +#include + +/* Just the needed definitions for the RDB of an Amiga HD. */ + +struct RigidDiskBlock { + __u32 rdb_ID; + __be32 rdb_SummedLongs; + __s32 rdb_ChkSum; + __u32 rdb_HostID; + __be32 rdb_BlockBytes; + __u32 rdb_Flags; + __u32 rdb_BadBlockList; + __be32 rdb_PartitionList; + __u32 rdb_FileSysHeaderList; + __u32 rdb_DriveInit; + __u32 rdb_Reserved1[6]; + __u32 rdb_Cylinders; + __u32 rdb_Sectors; + __u32 rdb_Heads; + __u32 rdb_Interleave; + __u32 rdb_Park; + __u32 rdb_Reserved2[3]; + __u32 rdb_WritePreComp; + __u32 rdb_ReducedWrite; + __u32 rdb_StepRate; + __u32 rdb_Reserved3[5]; + __u32 rdb_RDBBlocksLo; + __u32 rdb_RDBBlocksHi; + __u32 rdb_LoCylinder; + __u32 rdb_HiCylinder; + __u32 rdb_CylBlocks; + __u32 rdb_AutoParkSeconds; + __u32 rdb_HighRDSKBlock; + __u32 rdb_Reserved4; + char rdb_DiskVendor[8]; + char rdb_DiskProduct[16]; + char rdb_DiskRevision[4]; + char rdb_ControllerVendor[8]; + char rdb_ControllerProduct[16]; + char rdb_ControllerRevision[4]; + __u32 rdb_Reserved5[10]; +}; + +#define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */ + +struct PartitionBlock { + __be32 pb_ID; + __be32 pb_SummedLongs; + __s32 pb_ChkSum; + __u32 pb_HostID; + __be32 pb_Next; + __u32 pb_Flags; + __u32 pb_Reserved1[2]; + __u32 pb_DevFlags; + __u8 pb_DriveName[32]; + __u32 pb_Reserved2[15]; + __be32 pb_Environment[17]; + __u32 pb_EReserved[15]; +}; + +#define IDNAME_PARTITION 0x50415254 /* "PART" */ + +#define RDB_ALLOCATION_LIMIT 16 + +#endif /* AFFS_HARDBLOCKS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/agpgart.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/agpgart.h new file mode 100644 index 0000000..c3f95de --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/agpgart.h @@ -0,0 +1,111 @@ +/* + * AGPGART module version 0.99 + * Copyright (C) 1999 Jeff Hartmann + * Copyright (C) 1999 Precision Insight, Inc. + * Copyright (C) 1999 Xi Graphics, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _AGP_H +#define _AGP_H 1 + +#define AGPIOC_BASE 'A' +#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*) +#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1) +#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2) +#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*) +#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*) +#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*) +#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*) +#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) +#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*) +#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*) +#define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10) + +#define AGP_DEVICE "/dev/agpgart" + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#include + +struct agp_version { + __u16 major; + __u16 minor; +}; + +typedef struct _agp_info { + struct agp_version version; /* version of the driver */ + __u32 bridge_id; /* bridge vendor/device */ + __u32 agp_mode; /* mode info of bridge */ + unsigned long aper_base;/* base of aperture */ + size_t aper_size; /* size of aperture */ + size_t pg_total; /* max pages (swap + system) */ + size_t pg_system; /* max pages (system) */ + size_t pg_used; /* current pages used */ +} agp_info; + +typedef struct _agp_setup { + __u32 agp_mode; /* mode info of bridge */ +} agp_setup; + +/* + * The "prot" down below needs still a "sleep" flag somehow ... + */ +typedef struct _agp_segment { + __kernel_off_t pg_start; /* starting page to populate */ + __kernel_size_t pg_count; /* number of pages */ + int prot; /* prot flags for mmap */ +} agp_segment; + +typedef struct _agp_region { + __kernel_pid_t pid; /* pid of process */ + __kernel_size_t seg_count; /* number of segments */ + struct _agp_segment *seg_list; +} agp_region; + +typedef struct _agp_allocate { + int key; /* tag of allocation */ + __kernel_size_t pg_count;/* number of pages */ + __u32 type; /* 0 == normal, other devspec */ + __u32 physical; /* device specific (some devices + * need a phys address of the + * actual page behind the gatt + * table) */ +} agp_allocate; + +typedef struct _agp_bind { + int key; /* tag of allocation */ + __kernel_off_t pg_start;/* starting page to populate */ +} agp_bind; + +typedef struct _agp_unbind { + int key; /* tag of allocation */ + __u32 priority; /* priority for paging out */ +} agp_unbind; + + +#endif /* _AGP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/aio_abi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/aio_abi.h new file mode 100644 index 0000000..2c87316 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/aio_abi.h @@ -0,0 +1,111 @@ +/* include/linux/aio_abi.h + * + * Copyright 2000,2001,2002 Red Hat. + * + * Written by Benjamin LaHaise + * + * Distribute under the terms of the GPLv2 (see ../../COPYING) or under + * the following terms. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. Red Hat makes no representations about + * the suitability of this software for any purpose. + * + * IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, + * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF + * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND + * RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, + * ENHANCEMENTS, OR MODIFICATIONS. + */ +#ifndef __LINUX__AIO_ABI_H +#define __LINUX__AIO_ABI_H + +#include +#include + +typedef unsigned long aio_context_t; + +enum { + IOCB_CMD_PREAD = 0, + IOCB_CMD_PWRITE = 1, + IOCB_CMD_FSYNC = 2, + IOCB_CMD_FDSYNC = 3, + /* These two are experimental. + * IOCB_CMD_PREADX = 4, + * IOCB_CMD_POLL = 5, + */ + IOCB_CMD_NOOP = 6, + IOCB_CMD_PREADV = 7, + IOCB_CMD_PWRITEV = 8, +}; + +/* + * Valid flags for the "aio_flags" member of the "struct iocb". + * + * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb" + * is valid. + */ +#define IOCB_FLAG_RESFD (1 << 0) + +/* read() from /dev/aio returns these structures. */ +struct io_event { + __u64 data; /* the data field from the iocb */ + __u64 obj; /* what iocb this event came from */ + __s64 res; /* result code for this event */ + __s64 res2; /* secondary result */ +}; + +#if defined(__LITTLE_ENDIAN) +#define PADDED(x,y) x, y +#elif defined(__BIG_ENDIAN) +#define PADDED(x,y) y, x +#else +#error edit for your odd byteorder. +#endif + +/* + * we always use a 64bit off_t when communicating + * with userland. its up to libraries to do the + * proper padding and aio_error abstraction + */ + +struct iocb { + /* these are internal to the kernel/libc. */ + __u64 aio_data; /* data to be returned in event's data */ + __u32 PADDED(aio_key, aio_reserved1); + /* the kernel sets aio_key to the req # */ + + /* common fields */ + __u16 aio_lio_opcode; /* see IOCB_CMD_ above */ + __s16 aio_reqprio; + __u32 aio_fildes; + + __u64 aio_buf; + __u64 aio_nbytes; + __s64 aio_offset; + + /* extra parameters */ + __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */ + + /* flags for the "struct iocb" */ + __u32 aio_flags; + + /* + * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an + * eventfd to signal AIO readiness to + */ + __u32 aio_resfd; +}; /* 64 bytes */ + +#undef IFBIG +#undef IFLITTLE + +#endif /* __LINUX__AIO_ABI_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/apm_bios.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/apm_bios.h new file mode 100644 index 0000000..dee19a2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/apm_bios.h @@ -0,0 +1,135 @@ +#ifndef _LINUX_APM_H +#define _LINUX_APM_H + +/* + * Include file for the interface to an APM BIOS + * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ + +#include + +typedef unsigned short apm_event_t; +typedef unsigned short apm_eventinfo_t; + +struct apm_bios_info { + __u16 version; + __u16 cseg; + __u32 offset; + __u16 cseg_16; + __u16 dseg; + __u16 flags; + __u16 cseg_len; + __u16 cseg_16_len; + __u16 dseg_len; +}; + + +/* + * Power states + */ +#define APM_STATE_READY 0x0000 +#define APM_STATE_STANDBY 0x0001 +#define APM_STATE_SUSPEND 0x0002 +#define APM_STATE_OFF 0x0003 +#define APM_STATE_BUSY 0x0004 +#define APM_STATE_REJECT 0x0005 +#define APM_STATE_OEM_SYS 0x0020 +#define APM_STATE_OEM_DEV 0x0040 + +#define APM_STATE_DISABLE 0x0000 +#define APM_STATE_ENABLE 0x0001 + +#define APM_STATE_DISENGAGE 0x0000 +#define APM_STATE_ENGAGE 0x0001 + +/* + * Events (results of Get PM Event) + */ +#define APM_SYS_STANDBY 0x0001 +#define APM_SYS_SUSPEND 0x0002 +#define APM_NORMAL_RESUME 0x0003 +#define APM_CRITICAL_RESUME 0x0004 +#define APM_LOW_BATTERY 0x0005 +#define APM_POWER_STATUS_CHANGE 0x0006 +#define APM_UPDATE_TIME 0x0007 +#define APM_CRITICAL_SUSPEND 0x0008 +#define APM_USER_STANDBY 0x0009 +#define APM_USER_SUSPEND 0x000a +#define APM_STANDBY_RESUME 0x000b +#define APM_CAPABILITY_CHANGE 0x000c + +/* + * Error codes + */ +#define APM_SUCCESS 0x00 +#define APM_DISABLED 0x01 +#define APM_CONNECTED 0x02 +#define APM_NOT_CONNECTED 0x03 +#define APM_16_CONNECTED 0x05 +#define APM_16_UNSUPPORTED 0x06 +#define APM_32_CONNECTED 0x07 +#define APM_32_UNSUPPORTED 0x08 +#define APM_BAD_DEVICE 0x09 +#define APM_BAD_PARAM 0x0a +#define APM_NOT_ENGAGED 0x0b +#define APM_BAD_FUNCTION 0x0c +#define APM_RESUME_DISABLED 0x0d +#define APM_NO_ERROR 0x53 +#define APM_BAD_STATE 0x60 +#define APM_NO_EVENTS 0x80 +#define APM_NOT_PRESENT 0x86 + +/* + * APM Device IDs + */ +#define APM_DEVICE_BIOS 0x0000 +#define APM_DEVICE_ALL 0x0001 +#define APM_DEVICE_DISPLAY 0x0100 +#define APM_DEVICE_STORAGE 0x0200 +#define APM_DEVICE_PARALLEL 0x0300 +#define APM_DEVICE_SERIAL 0x0400 +#define APM_DEVICE_NETWORK 0x0500 +#define APM_DEVICE_PCMCIA 0x0600 +#define APM_DEVICE_BATTERY 0x8000 +#define APM_DEVICE_OEM 0xe000 +#define APM_DEVICE_OLD_ALL 0xffff +#define APM_DEVICE_CLASS 0x00ff +#define APM_DEVICE_MASK 0xff00 + + +/* + * Battery status + */ +#define APM_MAX_BATTERIES 2 + +/* + * APM defined capability bit flags + */ +#define APM_CAP_GLOBAL_STANDBY 0x0001 +#define APM_CAP_GLOBAL_SUSPEND 0x0002 +#define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */ +#define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */ +#define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */ +#define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */ +#define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */ +#define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */ + +/* + * ioctl operations + */ +#include + +#define APM_IOC_STANDBY _IO('A', 1) +#define APM_IOC_SUSPEND _IO('A', 2) + +#endif /* LINUX_APM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/arcfb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/arcfb.h new file mode 100644 index 0000000..721e765 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/arcfb.h @@ -0,0 +1,8 @@ +#ifndef __LINUX_ARCFB_H__ +#define __LINUX_ARCFB_H__ + +#define FBIO_WAITEVENT _IO('F', 0x88) +#define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t) + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atalk.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atalk.h new file mode 100644 index 0000000..801c3e3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atalk.h @@ -0,0 +1,43 @@ +#ifndef __LINUX_ATALK_H__ +#define __LINUX_ATALK_H__ + +#include +#include + +/* + * AppleTalk networking structures + * + * The following are directly referenced from the University Of Michigan + * netatalk for compatibility reasons. + */ +#define ATPORT_FIRST 1 +#define ATPORT_RESERVED 128 +#define ATPORT_LAST 254 /* 254 is only legal on localtalk */ +#define ATADDR_ANYNET (__u16)0 +#define ATADDR_ANYNODE (__u8)0 +#define ATADDR_ANYPORT (__u8)0 +#define ATADDR_BCAST (__u8)255 +#define DDP_MAXSZ 587 +#define DDP_MAXHOPS 15 /* 4 bits of hop counter */ + +#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) + +struct atalk_addr { + __be16 s_net; + __u8 s_node; +}; + +struct sockaddr_at { + sa_family_t sat_family; + __u8 sat_port; + struct atalk_addr sat_addr; + char sat_zero[8]; +}; + +struct atalk_netrange { + __u8 nr_phase; + __be16 nr_firstnet; + __be16 nr_lastnet; +}; + +#endif /* __LINUX_ATALK_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm.h new file mode 100644 index 0000000..5e1c36d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm.h @@ -0,0 +1,241 @@ +/* atm.h - general ATM declarations */ + +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ + + +/* + * WARNING: User-space programs should not #include directly. + * Instead, #include + */ + +#ifndef _LINUX_ATM_H +#define _LINUX_ATM_H + +/* + * BEGIN_xx and END_xx markers are used for automatic generation of + * documentation. Do not change them. + */ + + +#include +#include +#include +#include + + +/* general ATM constants */ +#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */ +#define ATM_CELL_PAYLOAD 48 /* ATM payload size */ +#define ATM_AAL0_SDU 52 /* AAL0 SDU size */ +#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */ +#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */ +#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */ +#define ATM_MAX_CDV 9999 /* maximum (default) CDV */ +#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */ + +#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */ +#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */ +#define ATM_MAX_VCI 65535 /* maximum VCI */ + + +/* "protcol" values for the socket system call */ +#define ATM_NO_AAL 0 /* AAL not specified */ +#define ATM_AAL0 13 /* "raw" ATM cells */ +#define ATM_AAL1 1 /* AAL1 (CBR) */ +#define ATM_AAL2 2 /* AAL2 (VBR) */ +#define ATM_AAL34 3 /* AAL3/4 (data) */ +#define ATM_AAL5 5 /* AAL5 (data) */ + +/* + * socket option name coding functions + * + * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the + * << 22 only reserves 9 bits for the level. On some architectures + * SOL_SOCKET is 0xFFFF, so that's a bit of a problem + */ + +#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \ + sizeof(t)) +#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF)) +#define __SO_NUMBER(c) (((c) >> 16) & 0x3f) +#define __SO_SIZE(c) ((c) & 0x3fff) + +/* + * ATM layer + */ + +#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int) + /* set CLP bit value - TODO */ +#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange) + /* connection identifier range; socket must be + bound or connected */ +#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos) + /* Quality of Service setting */ +#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap) + /* Service Access Point */ +#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc) + /* "PVC" address (also for SVCs); get only */ +#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int) + /* make this vc a p2mp */ + + +/* + * Note @@@: since the socket layers don't really distinguish the control and + * the data plane but generally seems to be data plane-centric, any layer is + * about equally wrong for the SAP. If you have a better idea about this, + * please speak up ... + */ + + +/* ATM cell header (for AAL0) */ + +/* BEGIN_CH */ +#define ATM_HDR_GFC_MASK 0xf0000000 +#define ATM_HDR_GFC_SHIFT 28 +#define ATM_HDR_VPI_MASK 0x0ff00000 +#define ATM_HDR_VPI_SHIFT 20 +#define ATM_HDR_VCI_MASK 0x000ffff0 +#define ATM_HDR_VCI_SHIFT 4 +#define ATM_HDR_PTI_MASK 0x0000000e +#define ATM_HDR_PTI_SHIFT 1 +#define ATM_HDR_CLP 0x00000001 +/* END_CH */ + + +/* PTI codings */ + +/* BEGIN_PTI */ +#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */ +#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */ +#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */ +#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */ +#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */ +#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */ +#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */ +#define ATM_PTI_RSV 7 /* reserved */ +/* END_PTI */ + + +/* + * The following items should stay in linux/atm.h, which should be linked to + * netatm/atm.h + */ + +/* Traffic description */ + +#define ATM_NONE 0 /* no traffic */ +#define ATM_UBR 1 +#define ATM_CBR 2 +#define ATM_VBR 3 +#define ATM_ABR 4 +#define ATM_ANYCLASS 5 /* compatible with everything */ + +#define ATM_MAX_PCR -1 /* maximum available PCR */ + +struct atm_trafprm { + unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ + int max_pcr; /* maximum PCR in cells per second */ + int pcr; /* desired PCR in cells per second */ + int min_pcr; /* minimum PCR in cells per second */ + int max_cdv; /* maximum CDV in microseconds */ + int max_sdu; /* maximum SDU in bytes */ + /* extra params for ABR */ + unsigned int icr; /* Initial Cell Rate (24-bit) */ + unsigned int tbe; /* Transient Buffer Exposure (24-bit) */ + unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */ + unsigned int rif : 4; /* Rate Increment Factor (4-bit) */ + unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */ + unsigned int nrm_pres :1; /* nrm present bit */ + unsigned int trm_pres :1; /* rm present bit */ + unsigned int adtf_pres :1; /* adtf present bit */ + unsigned int cdf_pres :1; /* cdf present bit*/ + unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */ + unsigned int trm :3; /* Time between forward RM cells (3-bit) */ + unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ + unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ + unsigned int spare :9; /* spare bits */ +}; + +struct atm_qos { + struct atm_trafprm txtp; /* parameters in TX direction */ + struct atm_trafprm rxtp __ATM_API_ALIGN; + /* parameters in RX direction */ + unsigned char aal __ATM_API_ALIGN; +}; + +/* PVC addressing */ + +#define ATM_ITF_ANY -1 /* "magic" PVC address values */ +#define ATM_VPI_ANY -1 +#define ATM_VCI_ANY -1 +#define ATM_VPI_UNSPEC -2 +#define ATM_VCI_UNSPEC -2 + + +struct sockaddr_atmpvc { + unsigned short sap_family; /* address family, AF_ATMPVC */ + struct { /* PVC address */ + short itf; /* ATM interface */ + short vpi; /* VPI (only 8 bits at UNI) */ + int vci; /* VCI (only 16 bits at UNI) */ + } sap_addr __ATM_API_ALIGN; /* PVC address */ +}; + +/* SVC addressing */ + +#define ATM_ESA_LEN 20 /* ATM End System Address length */ +#define ATM_E164_LEN 12 /* maximum E.164 number length */ + +#define ATM_AFI_DCC 0x39 /* DCC ATM Format */ +#define ATM_AFI_ICD 0x47 /* ICD ATM Format */ +#define ATM_AFI_E164 0x45 /* E.164 ATM Format */ +#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */ + +#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */ +#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */ +#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */ +#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */ + +#define ATM_LIJ_NONE 0 /* no leaf-initiated join */ +#define ATM_LIJ 1 /* request joining */ +#define ATM_LIJ_RPJ 2 /* set to root-prompted join */ +#define ATM_LIJ_NJ 3 /* set to network join */ + + +struct sockaddr_atmsvc { + unsigned short sas_family; /* address family, AF_ATMSVC */ + struct { /* SVC address */ + unsigned char prv[ATM_ESA_LEN];/* private ATM address */ + char pub[ATM_E164_LEN+1]; /* public address (E.164) */ + /* unused addresses must be bzero'ed */ + char lij_type; /* role in LIJ call; one of ATM_LIJ* */ + __u32 lij_id; /* LIJ call identifier */ + } sas_addr __ATM_API_ALIGN; /* SVC address */ +}; + + +static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr) +{ + return *addr.sas_addr.prv || *addr.sas_addr.pub; +} + + +static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr) +{ + return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci; +} + + +/* + * Some stuff for linux/sockios.h + */ + +struct atmif_sioc { + int number; + int length; + void *arg; +}; + + +typedef unsigned short atm_backend_t; +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_eni.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_eni.h new file mode 100644 index 0000000..34f3179 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_eni.h @@ -0,0 +1,23 @@ +/* atm_eni.h - Driver-specific declarations of the ENI driver (for use by + driver-specific utilities) */ + +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef LINUX_ATM_ENI_H +#define LINUX_ATM_ENI_H + +#include + + +struct eni_multipliers { + int tx,rx; /* values are in percent and must be > 100 */ +}; + + +#define ENI_MEMDUMP _IOW('a',ATMIOC_SARPRV,struct atmif_sioc) + /* printk memory map */ +#define ENI_SETMULT _IOW('a',ATMIOC_SARPRV+7,struct atmif_sioc) + /* set buffer multipliers */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_he.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_he.h new file mode 100644 index 0000000..2a7713b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_he.h @@ -0,0 +1,20 @@ +/* atm_he.h */ + +#ifndef LINUX_ATM_HE_H +#define LINUX_ATM_HE_H + +#include + +#define HE_GET_REG _IOW('a', ATMIOC_SARPRV, struct atmif_sioc) + +#define HE_REGTYPE_PCI 1 +#define HE_REGTYPE_RCM 2 +#define HE_REGTYPE_TCM 3 +#define HE_REGTYPE_MBOX 4 + +struct he_ioctl_reg { + unsigned addr, val; + char type; +}; + +#endif /* LINUX_ATM_HE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_idt77105.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_idt77105.h new file mode 100644 index 0000000..8b72400 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_idt77105.h @@ -0,0 +1,28 @@ +/* atm_idt77105.h - Driver-specific declarations of the IDT77105 driver (for + * use by driver-specific utilities) */ + +/* Written 1999 by Greg Banks . Copied from atm_suni.h. */ + + +#ifndef LINUX_ATM_IDT77105_H +#define LINUX_ATM_IDT77105_H + +#include +#include +#include + +/* + * Structure for IDT77105_GETSTAT and IDT77105_GETSTATZ ioctls. + * Pointed to by `arg' in atmif_sioc. + */ +struct idt77105_stats { + __u32 symbol_errors; /* wire symbol errors */ + __u32 tx_cells; /* cells transmitted */ + __u32 rx_cells; /* cells received */ + __u32 rx_hec_errors; /* Header Error Check errors on receive */ +}; + +#define IDT77105_GETSTAT _IOW('a',ATMIOC_PHYPRV+2,struct atmif_sioc) /* get stats */ +#define IDT77105_GETSTATZ _IOW('a',ATMIOC_PHYPRV+3,struct atmif_sioc) /* get stats and zero */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_nicstar.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_nicstar.h new file mode 100644 index 0000000..577b79f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_nicstar.h @@ -0,0 +1,53 @@ +/****************************************************************************** + * + * atm_nicstar.h + * + * Driver-specific declarations for use by NICSTAR driver specific utils. + * + * Author: Rui Prior + * + * (C) INESC 1998 + * + ******************************************************************************/ + + +#ifndef LINUX_ATM_NICSTAR_H +#define LINUX_ATM_NICSTAR_H + +/* Note: non-kernel programs including this file must also include + * sys/types.h for struct timeval + */ + +#include +#include + +#define NS_GETPSTAT _IOWR('a',ATMIOC_SARPRV+1,struct atmif_sioc) + /* get pool statistics */ +#define NS_SETBUFLEV _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) + /* set buffer level markers */ +#define NS_ADJBUFLEV _IO('a',ATMIOC_SARPRV+3) + /* adjust buffer level */ + +typedef struct buf_nr +{ + unsigned min; + unsigned init; + unsigned max; +}buf_nr; + + +typedef struct pool_levels +{ + int buftype; + int count; /* (At least for now) only used in NS_GETPSTAT */ + buf_nr level; +} pool_levels; + +/* type must be one of the following: */ +#define NS_BUFTYPE_SMALL 1 +#define NS_BUFTYPE_LARGE 2 +#define NS_BUFTYPE_HUGE 3 +#define NS_BUFTYPE_IOVEC 4 + + +#endif /* LINUX_ATM_NICSTAR_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_tcp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_tcp.h new file mode 100644 index 0000000..952e6ab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_tcp.h @@ -0,0 +1,61 @@ +/* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by + driver-specific utilities) */ + +/* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef LINUX_ATM_TCP_H +#define LINUX_ATM_TCP_H + +#include +#include +#include +#include + + +/* + * All values in struct atmtcp_hdr are in network byte order + */ + +struct atmtcp_hdr { + __u16 vpi; + __u16 vci; + __u32 length; /* ... of data part */ +}; + +/* + * All values in struct atmtcp_command are in host byte order + */ + +#define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */ +#define ATMTCP_CTRL_OPEN 1 /* request/reply */ +#define ATMTCP_CTRL_CLOSE 2 /* request/reply */ + +struct atmtcp_control { + struct atmtcp_hdr hdr; /* must be first */ + int type; /* message type; both directions */ + atm_kptr_t vcc; /* both directions */ + struct sockaddr_atmpvc addr; /* suggested value from kernel */ + struct atm_qos qos; /* both directions */ + int result; /* to kernel only */ +} __ATM_API_ALIGN; + +/* + * Field usage: + * Messge type dir. hdr.v?i type addr qos vcc result + * ----------- ---- ------- ---- ---- --- --- ------ + * OPEN K->D Y Y Y Y Y 0 + * OPEN D->K - Y Y Y Y Y + * CLOSE K->D - - Y - Y 0 + * CLOSE D->K - - - - Y Y + */ + +#define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */ +#define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP + interface */ +#define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP + interface */ + + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_zatm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_zatm.h new file mode 100644 index 0000000..10f0fa2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atm_zatm.h @@ -0,0 +1,52 @@ +/* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by + driver-specific utilities) */ + +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef LINUX_ATM_ZATM_H +#define LINUX_ATM_ZATM_H + +/* + * Note: non-kernel programs including this file must also include + * sys/types.h for struct timeval + */ + +#include +#include + +#define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc) + /* get pool statistics */ +#define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) + /* get statistics and zero */ +#define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc) + /* set pool parameters */ + +struct zatm_pool_info { + int ref_count; /* free buffer pool usage counters */ + int low_water,high_water; /* refill parameters */ + int rqa_count,rqu_count; /* queue condition counters */ + int offset,next_off; /* alignment optimizations: offset */ + int next_cnt,next_thres; /* repetition counter and threshold */ +}; + +struct zatm_pool_req { + int pool_num; /* pool number */ + struct zatm_pool_info info; /* actual information */ +}; + +struct zatm_t_hist { + struct timeval real; /* real (wall-clock) time */ + struct timeval expected; /* expected real time */ +}; + + +#define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */ +#define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */ +#define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */ +#define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */ + +#define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to + record; must be 2^n */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmapi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmapi.h new file mode 100644 index 0000000..8fe54d9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmapi.h @@ -0,0 +1,29 @@ +/* atmapi.h - ATM API user space/kernel compatibility */ + +/* Written 1999,2000 by Werner Almesberger, EPFL ICA */ + + +#ifndef _LINUX_ATMAPI_H +#define _LINUX_ATMAPI_H + +#if defined(__sparc__) || defined(__ia64__) +/* such alignment is not required on 32 bit sparcs, but we can't + figure that we are on a sparc64 while compiling user-space programs. */ +#define __ATM_API_ALIGN __attribute__((aligned(8))) +#else +#define __ATM_API_ALIGN +#endif + + +/* + * Opaque type for kernel pointers. Note that _ is never accessed. We need + * the struct in order hide the array, so that we can make simple assignments + * instead of being forced to use memcpy. It also improves error reporting for + * code that still assumes that we're passing unsigned longs. + * + * Convention: NULL pointers are passed as a field of all zeroes. + */ + +typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmarp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmarp.h new file mode 100644 index 0000000..231f4bd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmarp.h @@ -0,0 +1,41 @@ +/* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */ + +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef _LINUX_ATMARP_H +#define _LINUX_ATMARP_H + +#include +#include +#include + + +#define ATMARP_RETRY_DELAY 30 /* request next resolution or forget + NAK after 30 sec - should go into + atmclip.h */ +#define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while + waiting for the resolver */ + + +#define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */ +#define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */ +#define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */ +#define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */ + + +enum atmarp_ctrl_type { + act_invalid, /* catch uninitialized structures */ + act_need, /* need address resolution */ + act_up, /* interface is coming up */ + act_down, /* interface is going down */ + act_change /* interface configuration has changed */ +}; + +struct atmarp_ctrl { + enum atmarp_ctrl_type type; /* message type */ + int itf_num;/* interface number (if present) */ + __be32 ip; /* IP address (act_need only) */ +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmbr2684.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmbr2684.h new file mode 100644 index 0000000..fdb2629 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmbr2684.h @@ -0,0 +1,117 @@ +#ifndef _LINUX_ATMBR2684_H +#define _LINUX_ATMBR2684_H + +#include +#include +#include /* For IFNAMSIZ */ + +/* + * Type of media we're bridging (ethernet, token ring, etc) Currently only + * ethernet is supported + */ +#define BR2684_MEDIA_ETHERNET (0) /* 802.3 */ +#define BR2684_MEDIA_802_4 (1) /* 802.4 */ +#define BR2684_MEDIA_TR (2) /* 802.5 - token ring */ +#define BR2684_MEDIA_FDDI (3) +#define BR2684_MEDIA_802_6 (4) /* 802.6 */ + + /* used only at device creation: */ +#define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */ + +/* + * Is there FCS inbound on this VC? This currently isn't supported. + */ +#define BR2684_FCSIN_NO (0) +#define BR2684_FCSIN_IGNORE (1) +#define BR2684_FCSIN_VERIFY (2) + +/* + * Is there FCS outbound on this VC? This currently isn't supported. + */ +#define BR2684_FCSOUT_NO (0) +#define BR2684_FCSOUT_SENDZERO (1) +#define BR2684_FCSOUT_GENERATE (2) + +/* + * Does this VC include LLC encapsulation? + */ +#define BR2684_ENCAPS_VC (0) /* VC-mux */ +#define BR2684_ENCAPS_LLC (1) +#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ + +/* + * Is this VC bridged or routed? + */ + +#define BR2684_PAYLOAD_ROUTED (0) +#define BR2684_PAYLOAD_BRIDGED (1) + +/* + * This is for the ATM_NEWBACKENDIF call - these are like socket families: + * the first element of the structure is the backend number and the rest + * is per-backend specific + */ +struct atm_newif_br2684 { + atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ + int media; /* BR2684_MEDIA_*, flags in upper bits */ + char ifname[IFNAMSIZ]; + int mtu; +}; + +/* + * This structure is used to specify a br2684 interface - either by a + * positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name + */ +#define BR2684_FIND_BYNOTHING (0) +#define BR2684_FIND_BYNUM (1) +#define BR2684_FIND_BYIFNAME (2) +struct br2684_if_spec { + int method; /* BR2684_FIND_* */ + union { + char ifname[IFNAMSIZ]; + int devnum; + } spec; +}; + +/* + * This is for the ATM_SETBACKEND call - these are like socket families: + * the first element of the structure is the backend number and the rest + * is per-backend specific + */ +struct atm_backend_br2684 { + atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ + struct br2684_if_spec ifspec; + int fcs_in; /* BR2684_FCSIN_* */ + int fcs_out; /* BR2684_FCSOUT_* */ + int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ + int encaps; /* BR2684_ENCAPS_* */ + int has_vpiid; /* 1: use vpn_id - Unsupported */ + __u8 vpn_id[7]; + int send_padding; /* unsupported */ + int min_size; /* we will pad smaller packets than this */ +}; + +/* + * The BR2684_SETFILT ioctl is an experimental mechanism for folks + * terminating a large number of IP-only vcc's. When netfilter allows + * efficient per-if in/out filters, this support will be removed + */ +struct br2684_filter { + __be32 prefix; /* network byte order */ + __be32 netmask; /* 0 = disable filter */ +}; + +struct br2684_filter_set { + struct br2684_if_spec ifspec; + struct br2684_filter filter; +}; + +enum br2684_payload { + p_routed = BR2684_PAYLOAD_ROUTED, + p_bridged = BR2684_PAYLOAD_BRIDGED, +}; + +#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ + struct br2684_filter_set) + +#endif /* _LINUX_ATMBR2684_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmclip.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmclip.h new file mode 100644 index 0000000..02c94c4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmclip.h @@ -0,0 +1,21 @@ +/* atmclip.h - Classical IP over ATM */ + +/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef LINUX_ATMCLIP_H +#define LINUX_ATMCLIP_H + +#include +#include + + +#define RFC1483LLC_LEN 8 /* LLC+OUI+PID = 8 */ +#define RFC1626_MTU 9180 /* RFC1626 default MTU */ + +#define CLIP_DEFAULT_IDLETIMER 1200 /* 20 minutes, see RFC1755 */ +#define CLIP_CHECK_INTERVAL 10 /* check every ten seconds */ + +#define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmdev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmdev.h new file mode 100644 index 0000000..3351a4b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmdev.h @@ -0,0 +1,215 @@ +/* atmdev.h - ATM device driver declarations and various related items */ + +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef LINUX_ATMDEV_H +#define LINUX_ATMDEV_H + + +#include +#include +#include + + +#define ESI_LEN 6 + +#define ATM_OC3_PCR (155520000/270*260/8/53) + /* OC3 link rate: 155520000 bps + SONET overhead: /270*260 (9 section, 1 path) + bits per cell: /8/53 + max cell rate: 353207.547 cells/sec */ +#define ATM_25_PCR ((25600000/8-8000)/54) + /* 25 Mbps ATM cell rate (59111) */ +#define ATM_OC12_PCR (622080000/1080*1040/8/53) + /* OC12 link rate: 622080000 bps + SONET overhead: /1080*1040 + bits per cell: /8/53 + max cell rate: 1412830.188 cells/sec */ +#define ATM_DS3_PCR (8000*12) + /* DS3: 12 cells in a 125 usec time slot */ + + +#define __AAL_STAT_ITEMS \ + __HANDLE_ITEM(tx); /* TX okay */ \ + __HANDLE_ITEM(tx_err); /* TX errors */ \ + __HANDLE_ITEM(rx); /* RX okay */ \ + __HANDLE_ITEM(rx_err); /* RX errors */ \ + __HANDLE_ITEM(rx_drop); /* RX out of memory */ + +struct atm_aal_stats { +#define __HANDLE_ITEM(i) int i + __AAL_STAT_ITEMS +#undef __HANDLE_ITEM +}; + + +struct atm_dev_stats { + struct atm_aal_stats aal0; + struct atm_aal_stats aal34; + struct atm_aal_stats aal5; +} __ATM_API_ALIGN; + + +#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) + /* get link rate */ +#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) + /* get interface names (numbers) */ +#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) + /* get interface type name */ +#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) + /* get interface ESI */ +#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) + /* get itf's local ATM addr. list */ +#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) + /* reset itf's ATM address list */ +#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) + /* add a local ATM address */ +#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) + /* remove a local ATM address */ +#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) + /* get connection identifier range */ +#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) + /* set connection identifier range */ +#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) + /* set interface ESI */ +#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) + /* force interface ESI */ +#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) + /* register a LECS address */ +#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) + /* unregister a LECS address */ +#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) + /* retrieve LECS address(es) */ + +#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) + /* get AAL layer statistics */ +#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) + /* get AAL layer statistics and zero */ +#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) + /* get loopback mode */ +#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) + /* set loopback mode */ +#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) + /* query supported loopback modes */ +#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) + /* enable or disable single-copy */ +#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) + /* set backend handler */ +#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) + /* use backend to make new if */ +#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) + /* add party to p2mp call */ +#ifdef CONFIG_COMPAT +/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */ +#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf) +#endif +#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) + /* drop party from p2mp call */ + +/* + * These are backend handkers that can be set via the ATM_SETBACKEND call + * above. In the future we may support dynamic loading of these - for now, + * they're just being used to share the ATMIOC_BACKEND ioctls + */ +#define ATM_BACKEND_RAW 0 +#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ +#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ + +/* for ATM_GETTYPE */ +#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ + +/* + * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP + */ + +/* Point of loopback CPU-->SAR-->PHY-->line--> ... */ +#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ +#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ +#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ +/* RESERVED 4 loop back on PHY side ---' */ +#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ +#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ + +/* Direction of loopback */ +#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ +#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ + +#define __ATM_LM_XTLOC(n) ((n) & 0xff) +#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) + +#define ATM_LM_NONE 0 /* no loopback */ + +#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) +#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) +#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) +#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) + +#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) +#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) +#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) +#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) + +/* + * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that + * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) + */ + + +struct atm_iobuf { + int length; + void *buffer; +}; + +/* for ATM_GETCIRANGE / ATM_SETCIRANGE */ + +#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ + +struct atm_cirange { + signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ + signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ +}; + +/* for ATM_SETSC; actually taken from the ATM_VF number space */ + +#define ATM_SC_RX 1024 /* enable RX single-copy */ +#define ATM_SC_TX 2048 /* enable TX single-copy */ + +#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out + anyway */ + +/* MF: change_qos (Modify) flags */ + +#define ATM_MF_IMMED 1 /* Block until change is effective */ +#define ATM_MF_INC_RSV 2 /* Change reservation on increase */ +#define ATM_MF_INC_SHP 4 /* Change shaping on increase */ +#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ +#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ +#define ATM_MF_BWD 32 /* Set the backward direction parameters */ + +#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ + ATM_MF_DEC_SHP | ATM_MF_BWD) + +/* + * ATM_VS_* are used to express VC state in a human-friendly way. + */ + +#define ATM_VS_IDLE 0 /* VC is not used */ +#define ATM_VS_CONNECTED 1 /* VC is connected */ +#define ATM_VS_CLOSING 2 /* VC is closing */ +#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ +#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ +#define ATM_VS_BOUND 5 /* VC is bound */ + +#define ATM_VS2TXT_MAP \ + "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" + +#define ATM_VF2TXT_MAP \ + "ADDR", "READY", "PARTIAL", "REGIS", \ + "RELEASED", "HASQOS", "LISTEN", "META", \ + "256", "512", "1024", "2048", \ + "SESSION", "HASSAP", "BOUND", "CLOSE" + + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmioc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmioc.h new file mode 100644 index 0000000..37f67aa --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmioc.h @@ -0,0 +1,41 @@ +/* atmioc.h - ranges for ATM-related ioctl numbers */ + +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ + + +/* + * See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of + * "magic" ioctl numbers. + */ + + +#ifndef _LINUX_ATMIOC_H +#define _LINUX_ATMIOC_H + +#include + /* everybody including atmioc.h will also need _IO{,R,W,WR} */ + +#define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */ +#define ATMIOC_PHYCOM_END 0x0f +#define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */ +#define ATMIOC_PHYTYP_END 0x2f +#define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */ +#define ATMIOC_PHYPRV_END 0x4f +#define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */ +#define ATMIOC_SARCOM_END 0x50 +#define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */ +#define ATMIOC_SARPRV_END 0x7f +#define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */ +#define ATMIOC_ITF_END 0x8f +#define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */ +#define ATMIOC_BACKEND_END 0xaf +/* 0xb0-0xbf: Reserved for future use */ +#define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */ +#define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */ +#define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */ +#define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */ +#define ATMIOC_CLIP_END 0xef +#define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */ +#define ATMIOC_SPECIAL_END 0xff + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmlec.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmlec.h new file mode 100644 index 0000000..39c917f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmlec.h @@ -0,0 +1,98 @@ +/* + * ATM Lan Emulation Daemon driver interface + * + * Marko Kiiskila + */ + +#ifndef _ATMLEC_H_ +#define _ATMLEC_H_ + +#include +#include +#include +#include +#include + +/* ATM lec daemon control socket */ +#define ATMLEC_CTRL _IO('a', ATMIOC_LANE) +#define ATMLEC_DATA _IO('a', ATMIOC_LANE+1) +#define ATMLEC_MCAST _IO('a', ATMIOC_LANE+2) + +/* Maximum number of LEC interfaces (tweakable) */ +#define MAX_LEC_ITF 48 + +/* + * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring. + * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for + * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS. + */ +#define NUM_TR_DEVS 8 + +typedef enum { + l_set_mac_addr, + l_del_mac_addr, + l_svc_setup, + l_addr_delete, + l_topology_change, + l_flush_complete, + l_arp_update, + l_narp_req, /* LANE2 mandates the use of this */ + l_config, + l_flush_tran_id, + l_set_lecid, + l_arp_xmt, + l_rdesc_arp_xmt, + l_associate_req, + l_should_bridge /* should we bridge this MAC? */ +} atmlec_msg_type; + +#define ATMLEC_MSG_TYPE_MAX l_should_bridge + +struct atmlec_config_msg { + unsigned int maximum_unknown_frame_count; + unsigned int max_unknown_frame_time; + unsigned short max_retry_count; + unsigned int aging_time; + unsigned int forward_delay_time; + unsigned int arp_response_time; + unsigned int flush_timeout; + unsigned int path_switching_delay; + unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */ + int mtu; + int is_proxy; +}; + +struct atmlec_msg { + atmlec_msg_type type; + int sizeoftlvs; /* LANE2: if != 0, tlvs follow */ + union { + struct { + unsigned char mac_addr[ETH_ALEN]; + unsigned char atm_addr[ATM_ESA_LEN]; + unsigned int flag; /* + * Topology_change flag, + * remoteflag, permanent flag, + * lecid, transaction id + */ + unsigned int targetless_le_arp; /* LANE2 */ + unsigned int no_source_le_narp; /* LANE2 */ + } normal; + struct atmlec_config_msg config; + struct { + __u16 lec_id; /* requestor lec_id */ + __u32 tran_id; /* transaction id */ + unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ + unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ + } proxy; /* + * For mapping LE_ARP requests to responses. Filled by + * zeppelin, returned by kernel. Used only when proxying + */ + } content; +} __ATM_API_ALIGN; + +struct atmlec_ioc { + int dev_num; + unsigned char atm_addr[ATM_ESA_LEN]; + unsigned char receive; /* 1= receive vcc, 0 = send vcc */ +}; +#endif /* _ATMLEC_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmmpc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmmpc.h new file mode 100644 index 0000000..2aba578 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmmpc.h @@ -0,0 +1,126 @@ +#ifndef _ATMMPC_H_ +#define _ATMMPC_H_ + +#include +#include +#include +#include + +#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA) +#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1) + +#define MPC_SOCKET_INGRESS 1 +#define MPC_SOCKET_EGRESS 2 + +struct atmmpc_ioc { + int dev_num; + __be32 ipaddr; /* the IP address of the shortcut */ + int type; /* ingress or egress */ +}; + +typedef struct in_ctrl_info { + __u8 Last_NHRP_CIE_code; + __u8 Last_Q2931_cause_value; + __u8 eg_MPC_ATM_addr[ATM_ESA_LEN]; + __be32 tag; + __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */ + __u16 holding_time; + __u32 request_id; +} in_ctrl_info; + +typedef struct eg_ctrl_info { + __u8 DLL_header[256]; + __u8 DH_length; + __be32 cache_id; + __be32 tag; + __be32 mps_ip; + __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */ + __u8 in_MPC_data_ATM_addr[ATM_ESA_LEN]; + __u16 holding_time; +} eg_ctrl_info; + +struct mpc_parameters { + __u16 mpc_p1; /* Shortcut-Setup Frame Count */ + __u16 mpc_p2; /* Shortcut-Setup Frame Time */ + __u8 mpc_p3[8]; /* Flow-detection Protocols */ + __u16 mpc_p4; /* MPC Initial Retry Time */ + __u16 mpc_p5; /* MPC Retry Time Maximum */ + __u16 mpc_p6; /* Hold Down Time */ +} ; + +struct k_message { + __u16 type; + __be32 ip_mask; + __u8 MPS_ctrl[ATM_ESA_LEN]; + union { + in_ctrl_info in_info; + eg_ctrl_info eg_info; + struct mpc_parameters params; + } content; + struct atm_qos qos; +} __ATM_API_ALIGN; + +struct llc_snap_hdr { + /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */ + __u8 dsap; /* Destination Service Access Point (0xAA) */ + __u8 ssap; /* Source Service Access Point (0xAA) */ + __u8 ui; /* Unnumbered Information (0x03) */ + __u8 org[3]; /* Organizational identification (0x000000) */ + __u8 type[2]; /* Ether type (for IP) (0x0800) */ +}; + +/* TLVs this MPC recognizes */ +#define TLV_MPOA_DEVICE_TYPE 0x00a03e2a + +/* MPOA device types in MPOA Device Type TLV */ +#define NON_MPOA 0 +#define MPS 1 +#define MPC 2 +#define MPS_AND_MPC 3 + + +/* MPC parameter defaults */ + +#define MPC_P1 10 /* Shortcut-Setup Frame Count */ +#define MPC_P2 1 /* Shortcut-Setup Frame Time */ +#define MPC_P3 0 /* Flow-detection Protocols */ +#define MPC_P4 5 /* MPC Initial Retry Time */ +#define MPC_P5 40 /* MPC Retry Time Maximum */ +#define MPC_P6 160 /* Hold Down Time */ +#define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */ + +/* MPC constants */ + +#define MPC_C1 2 /* Retry Time Multiplier */ +#define MPC_C2 60 /* Initial Keep-Alive Lifetime */ + +/* Message types - to MPOA daemon */ + +#define SND_MPOA_RES_RQST 201 +#define SET_MPS_CTRL_ADDR 202 +#define SND_MPOA_RES_RTRY 203 /* Different type in a retry due to req id */ +#define STOP_KEEP_ALIVE_SM 204 +#define EGRESS_ENTRY_REMOVED 205 +#define SND_EGRESS_PURGE 206 +#define DIE 207 /* tell the daemon to exit() */ +#define DATA_PLANE_PURGE 208 /* Data plane purge because of egress cache hit miss or dead MPS */ +#define OPEN_INGRESS_SVC 209 + +/* Message types - from MPOA daemon */ + +#define MPOA_TRIGGER_RCVD 101 +#define MPOA_RES_REPLY_RCVD 102 +#define INGRESS_PURGE_RCVD 103 +#define EGRESS_PURGE_RCVD 104 +#define MPS_DEATH 105 +#define CACHE_IMPOS_RCVD 106 +#define SET_MPC_CTRL_ADDR 107 /* Our MPC's control ATM address */ +#define SET_MPS_MAC_ADDR 108 +#define CLEAN_UP_AND_EXIT 109 +#define SET_MPC_PARAMS 110 /* MPC configuration parameters */ + +/* Message types - bidirectional */ + +#define RELOAD 301 /* kill -HUP the daemon for reload */ + +#endif /* _ATMMPC_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmppp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmppp.h new file mode 100644 index 0000000..300dcce --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmppp.h @@ -0,0 +1,24 @@ +/* atmppp.h - RFC2364 PPPoATM */ + +/* Written 2000 by Mitchell Blank Jr */ + +#ifndef _LINUX_ATMPPP_H +#define _LINUX_ATMPPP_H + +#include + +#define PPPOATM_ENCAPS_AUTODETECT (0) +#define PPPOATM_ENCAPS_VC (1) +#define PPPOATM_ENCAPS_LLC (2) + +/* + * This is for the ATM_SETBACKEND call - these are like socket families: + * the first element of the structure is the backend number and the rest + * is per-backend specific + */ +struct atm_backend_ppp { + atm_backend_t backend_num; /* ATM_BACKEND_PPP */ + int encaps; /* PPPOATM_ENCAPS_* */ +}; + +#endif /* _LINUX_ATMPPP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmsap.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmsap.h new file mode 100644 index 0000000..799b104 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmsap.h @@ -0,0 +1,162 @@ +/* atmsap.h - ATM Service Access Point addressing definitions */ + +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef _LINUX_ATMSAP_H +#define _LINUX_ATMSAP_H + +#include + +/* + * BEGIN_xx and END_xx markers are used for automatic generation of + * documentation. Do not change them. + */ + + +/* + * Layer 2 protocol identifiers + */ + +/* BEGIN_L2 */ +#define ATM_L2_NONE 0 /* L2 not specified */ +#define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */ +#define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */ +#define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */ +#define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */ +#define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */ +#define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */ +#define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */ +#define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */ +#define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */ +#define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */ +#define ATM_L2_Q922 0x0e /* ITU-T Q.922 */ +#define ATM_L2_USER 0x10 /* user-specified */ +#define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */ +/* END_L2 */ + + +/* + * Layer 3 protocol identifiers + */ + +/* BEGIN_L3 */ +#define ATM_L3_NONE 0 /* L3 not specified */ +#define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */ +#define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */ +#define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */ +#define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */ +#define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */ +#define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */ +#define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */ +#define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */ +#define ATM_L3_USER 0x10 /* user-specified */ +/* END_L3 */ + + +/* + * High layer identifiers + */ + +/* BEGIN_HL */ +#define ATM_HL_NONE 0 /* HL not specified */ +#define ATM_HL_ISO 0x01 /* ISO */ +#define ATM_HL_USER 0x02 /* user-specific */ +#define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */ +#define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */ +/* END_HL */ + + +/* + * ITU-T coded mode of operation + */ + +/* BEGIN_IMD */ +#define ATM_IMD_NONE 0 /* mode not specified */ +#define ATM_IMD_NORMAL 1 /* normal mode of operation */ +#define ATM_IMD_EXTENDED 2 /* extended mode of operation */ +/* END_IMD */ + +/* + * H.310 code points + */ + +#define ATM_TT_NONE 0 /* terminal type not specified */ +#define ATM_TT_RX 1 /* receive only */ +#define ATM_TT_TX 2 /* send only */ +#define ATM_TT_RXTX 3 /* receive and send */ + +#define ATM_MC_NONE 0 /* no multiplexing */ +#define ATM_MC_TS 1 /* transport stream (TS) */ +#define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */ +#define ATM_MC_PS 3 /* program stream (PS) */ +#define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */ +#define ATM_MC_H221 5 /* ITU-T Rec. H.221 */ + +/* + * SAP structures + */ + +#define ATM_MAX_HLI 8 /* maximum high-layer information length */ + + +struct atm_blli { + unsigned char l2_proto; /* layer 2 protocol */ + union { + struct { + unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ + /* absent */ + unsigned char window; /* window size (k), 1-127 (0 to omit) */ + } itu; /* ITU-T encoding */ + unsigned char user; /* user-specified l2 information */ + } l2; + unsigned char l3_proto; /* layer 3 protocol */ + union { + struct { + unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ + /* absent */ + unsigned char def_size; /* default packet size (log2), 4-12 (0 to */ + /* omit) */ + unsigned char window;/* packet window size, 1-127 (0 to omit) */ + } itu; /* ITU-T encoding */ + unsigned char user; /* user specified l3 information */ + struct { /* if l3_proto = ATM_L3_H310 */ + unsigned char term_type; /* terminal type */ + unsigned char fw_mpx_cap; /* forward multiplexing capability */ + /* only if term_type != ATM_TT_NONE */ + unsigned char bw_mpx_cap; /* backward multiplexing capability */ + /* only if term_type != ATM_TT_NONE */ + } h310; + struct { /* if l3_proto = ATM_L3_TR9577 */ + unsigned char ipi; /* initial protocol id */ + unsigned char snap[5];/* IEEE 802.1 SNAP identifier */ + /* (only if ipi == NLPID_IEEE802_1_SNAP) */ + } tr9577; + } l3; +} __ATM_API_ALIGN; + + +struct atm_bhli { + unsigned char hl_type; /* high layer information type */ + unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */ + /* hl_type == ATM_HL_ISO) */ + unsigned char hl_info[ATM_MAX_HLI];/* high layer information */ +}; + + +#define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */ + + +struct atm_sap { + struct atm_bhli bhli; /* local SAP, high-layer information */ + struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN; + /* local SAP, low-layer info */ +}; + + +static __inline__ int blli_in_use(struct atm_blli blli) +{ + return blli.l2_proto || blli.l3_proto; +} + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmsvc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmsvc.h new file mode 100644 index 0000000..aa71583 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/atmsvc.h @@ -0,0 +1,55 @@ +/* atmsvc.h - ATM signaling kernel-demon interface definitions */ + +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef _LINUX_ATMSVC_H +#define _LINUX_ATMSVC_H + +#include +#include +#include + + +#define ATMSIGD_CTRL _IO('a',ATMIOC_SPECIAL) + /* become ATM signaling demon control socket */ + +enum atmsvc_msg_type { as_catch_null, as_bind, as_connect, as_accept, as_reject, + as_listen, as_okay, as_error, as_indicate, as_close, + as_itf_notify, as_modify, as_identify, as_terminate, + as_addparty, as_dropparty }; + +struct atmsvc_msg { + enum atmsvc_msg_type type; + atm_kptr_t vcc; + atm_kptr_t listen_vcc; /* indicate */ + int reply; /* for okay and close: */ + /* < 0: error before active */ + /* (sigd has discarded ctx) */ + /* ==0: success */ + /* > 0: error when active (still */ + /* need to close) */ + struct sockaddr_atmpvc pvc; /* indicate, okay (connect) */ + struct sockaddr_atmsvc local; /* local SVC address */ + struct atm_qos qos; /* QOS parameters */ + struct atm_sap sap; /* SAP */ + unsigned int session; /* for p2pm */ + struct sockaddr_atmsvc svc; /* SVC address */ +} __ATM_API_ALIGN; + +/* + * Message contents: see ftp://icaftp.epfl.ch/pub/linux/atm/docs/isp-*.tar.gz + */ + +/* + * Some policy stuff for atmsigd and for net/atm/svc.c. Both have to agree on + * what PCR is used to request bandwidth from the device driver. net/atm/svc.c + * tries to do better than that, but only if there's no routing decision (i.e. + * if signaling only uses one ATM interface). + */ + +#define SELECT_TOP_PCR(tp) ((tp).pcr ? (tp).pcr : \ + (tp).max_pcr && (tp).max_pcr != ATM_MAX_PCR ? (tp).max_pcr : \ + (tp).min_pcr ? (tp).min_pcr : ATM_MAX_PCR) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/audit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/audit.h new file mode 100644 index 0000000..b66d45f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/audit.h @@ -0,0 +1,361 @@ +/* audit.h -- Auditing support + * + * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Written by Rickard E. (Rik) Faith + * + */ + +#ifndef _LINUX_AUDIT_H_ +#define _LINUX_AUDIT_H_ + +#include +#include + +/* The netlink messages for the audit system is divided into blocks: + * 1000 - 1099 are for commanding the audit system + * 1100 - 1199 user space trusted application messages + * 1200 - 1299 messages internal to the audit daemon + * 1300 - 1399 audit event messages + * 1400 - 1499 SE Linux use + * 1500 - 1599 kernel LSPP events + * 1600 - 1699 kernel crypto events + * 1700 - 1799 kernel anomaly records + * 1800 - 1899 kernel integrity events + * 1900 - 1999 future kernel use + * 2000 is for otherwise unclassified kernel audit messages (legacy) + * 2001 - 2099 unused (kernel) + * 2100 - 2199 user space anomaly records + * 2200 - 2299 user space actions taken in response to anomalies + * 2300 - 2399 user space generated LSPP events + * 2400 - 2499 user space crypto events + * 2500 - 2999 future user space (maybe integrity labels and related events) + * + * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are + * exclusively user space. 1300-2099 is kernel --> user space + * communication. + */ +#define AUDIT_GET 1000 /* Get status */ +#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ +#define AUDIT_LIST 1002 /* List syscall rules -- deprecated */ +#define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */ +#define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */ +#define AUDIT_USER 1005 /* Message from userspace -- deprecated */ +#define AUDIT_LOGIN 1006 /* Define the login id and information */ +#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */ +#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */ +#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */ +#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */ +#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */ +#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */ +#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */ +#define AUDIT_TRIM 1014 /* Trim junk from watched tree */ +#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */ +#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */ +#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */ + +#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ +#define AUDIT_USER_AVC 1107 /* We filter this differently */ +#define AUDIT_USER_TTY 1124 /* Non-ICANON TTY input meaning */ +#define AUDIT_LAST_USER_MSG 1199 +#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */ +#define AUDIT_LAST_USER_MSG2 2999 + +#define AUDIT_DAEMON_START 1200 /* Daemon startup record */ +#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */ +#define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */ +#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */ + +#define AUDIT_SYSCALL 1300 /* Syscall event */ +/* #define AUDIT_FS_WATCH 1301 * Deprecated */ +#define AUDIT_PATH 1302 /* Filename path information */ +#define AUDIT_IPC 1303 /* IPC record */ +#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */ +#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */ +#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */ +#define AUDIT_CWD 1307 /* Current working directory */ +#define AUDIT_EXECVE 1309 /* execve arguments */ +#define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */ +#define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */ +#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */ +#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */ +#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */ +#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */ +#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */ +#define AUDIT_OBJ_PID 1318 /* ptrace target */ +#define AUDIT_TTY 1319 /* Input on an administrative TTY */ +#define AUDIT_EOE 1320 /* End of multi-record event */ +#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ +#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ + +#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ +#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ +#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */ +#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ +#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ +#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ +#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */ +#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */ +#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */ +#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */ +#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */ +#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */ +#define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */ +#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */ +#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */ +#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */ +#define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */ +#define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */ + +#define AUDIT_FIRST_KERN_ANOM_MSG 1700 +#define AUDIT_LAST_KERN_ANOM_MSG 1799 +#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */ +#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */ +#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */ +#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */ +#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */ +#define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */ +#define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */ +#define AUDIT_INTEGRITY_RULE 1805 /* policy rule */ + +#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ + +/* Rule flags */ +#define AUDIT_FILTER_USER 0x00 /* Apply rule to user-generated messages */ +#define AUDIT_FILTER_TASK 0x01 /* Apply rule at task creation (not syscall) */ +#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */ +#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */ +#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */ +#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */ + +#define AUDIT_NR_FILTERS 6 + +#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */ + +/* Rule actions */ +#define AUDIT_NEVER 0 /* Do not build context if rule matches */ +#define AUDIT_POSSIBLE 1 /* Build context if rule matches */ +#define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */ + +/* Rule structure sizes -- if these change, different AUDIT_ADD and + * AUDIT_LIST commands must be implemented. */ +#define AUDIT_MAX_FIELDS 64 +#define AUDIT_MAX_KEY_LEN 256 +#define AUDIT_BITMASK_SIZE 64 +#define AUDIT_WORD(nr) ((__u32)((nr)/32)) +#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) + +#define AUDIT_SYSCALL_CLASSES 16 +#define AUDIT_CLASS_DIR_WRITE 0 +#define AUDIT_CLASS_DIR_WRITE_32 1 +#define AUDIT_CLASS_CHATTR 2 +#define AUDIT_CLASS_CHATTR_32 3 +#define AUDIT_CLASS_READ 4 +#define AUDIT_CLASS_READ_32 5 +#define AUDIT_CLASS_WRITE 6 +#define AUDIT_CLASS_WRITE_32 7 +#define AUDIT_CLASS_SIGNAL 8 +#define AUDIT_CLASS_SIGNAL_32 9 + +/* This bitmask is used to validate user input. It represents all bits that + * are currently used in an audit field constant understood by the kernel. + * If you are adding a new #define AUDIT_, please ensure that + * AUDIT_UNUSED_BITS is updated if need be. */ +#define AUDIT_UNUSED_BITS 0x07FFFC00 + + +/* Rule fields */ + /* These are useful when checking the + * task structure at task creation time + * (AUDIT_PER_TASK). */ +#define AUDIT_PID 0 +#define AUDIT_UID 1 +#define AUDIT_EUID 2 +#define AUDIT_SUID 3 +#define AUDIT_FSUID 4 +#define AUDIT_GID 5 +#define AUDIT_EGID 6 +#define AUDIT_SGID 7 +#define AUDIT_FSGID 8 +#define AUDIT_LOGINUID 9 +#define AUDIT_PERS 10 +#define AUDIT_ARCH 11 +#define AUDIT_MSGTYPE 12 +#define AUDIT_SUBJ_USER 13 /* security label user */ +#define AUDIT_SUBJ_ROLE 14 /* security label role */ +#define AUDIT_SUBJ_TYPE 15 /* security label type */ +#define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */ +#define AUDIT_SUBJ_CLR 17 /* security label clearance label */ +#define AUDIT_PPID 18 +#define AUDIT_OBJ_USER 19 +#define AUDIT_OBJ_ROLE 20 +#define AUDIT_OBJ_TYPE 21 +#define AUDIT_OBJ_LEV_LOW 22 +#define AUDIT_OBJ_LEV_HIGH 23 + + /* These are ONLY useful when checking + * at syscall exit time (AUDIT_AT_EXIT). */ +#define AUDIT_DEVMAJOR 100 +#define AUDIT_DEVMINOR 101 +#define AUDIT_INODE 102 +#define AUDIT_EXIT 103 +#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */ +#define AUDIT_WATCH 105 +#define AUDIT_PERM 106 +#define AUDIT_DIR 107 +#define AUDIT_FILETYPE 108 + +#define AUDIT_ARG0 200 +#define AUDIT_ARG1 (AUDIT_ARG0+1) +#define AUDIT_ARG2 (AUDIT_ARG0+2) +#define AUDIT_ARG3 (AUDIT_ARG0+3) + +#define AUDIT_FILTERKEY 210 + +#define AUDIT_NEGATE 0x80000000 + +/* These are the supported operators. + * 4 2 1 8 + * = > < ? + * ---------- + * 0 0 0 0 00 nonsense + * 0 0 0 1 08 & bit mask + * 0 0 1 0 10 < + * 0 1 0 0 20 > + * 0 1 1 0 30 != + * 1 0 0 0 40 = + * 1 0 0 1 48 &= bit test + * 1 0 1 0 50 <= + * 1 1 0 0 60 >= + * 1 1 1 1 78 all operators + */ +#define AUDIT_BIT_MASK 0x08000000 +#define AUDIT_LESS_THAN 0x10000000 +#define AUDIT_GREATER_THAN 0x20000000 +#define AUDIT_NOT_EQUAL 0x30000000 +#define AUDIT_EQUAL 0x40000000 +#define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL) +#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL) +#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) +#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK) + +enum { + Audit_equal, + Audit_not_equal, + Audit_bitmask, + Audit_bittest, + Audit_lt, + Audit_gt, + Audit_le, + Audit_ge, + Audit_bad +}; + +/* Status symbols */ + /* Mask values */ +#define AUDIT_STATUS_ENABLED 0x0001 +#define AUDIT_STATUS_FAILURE 0x0002 +#define AUDIT_STATUS_PID 0x0004 +#define AUDIT_STATUS_RATE_LIMIT 0x0008 +#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010 + /* Failure-to-log actions */ +#define AUDIT_FAIL_SILENT 0 +#define AUDIT_FAIL_PRINTK 1 +#define AUDIT_FAIL_PANIC 2 + +/* distinguish syscall tables */ +#define __AUDIT_ARCH_64BIT 0x80000000 +#define __AUDIT_ARCH_LE 0x40000000 +#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_ARMEB (EM_ARM) +#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_FRV (EM_FRV) +#define AUDIT_ARCH_H8300 (EM_H8_300) +#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_M32R (EM_M32R) +#define AUDIT_ARCH_M68K (EM_68K) +#define AUDIT_ARCH_MIPS (EM_MIPS) +#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT) +#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_PARISC (EM_PARISC) +#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT) +#define AUDIT_ARCH_PPC (EM_PPC) +#define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT) +#define AUDIT_ARCH_S390 (EM_S390) +#define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT) +#define AUDIT_ARCH_SH (EM_SH) +#define AUDIT_ARCH_SHEL (EM_SH|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT) +#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_SPARC (EM_SPARC) +#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT) +#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) + +#define AUDIT_PERM_EXEC 1 +#define AUDIT_PERM_WRITE 2 +#define AUDIT_PERM_READ 4 +#define AUDIT_PERM_ATTR 8 + +struct audit_status { + __u32 mask; /* Bit mask for valid entries */ + __u32 enabled; /* 1 = enabled, 0 = disabled */ + __u32 failure; /* Failure-to-log action */ + __u32 pid; /* pid of auditd process */ + __u32 rate_limit; /* messages rate limit (per second) */ + __u32 backlog_limit; /* waiting messages limit */ + __u32 lost; /* messages lost */ + __u32 backlog; /* messages waiting in queue */ +}; + +struct audit_tty_status { + __u32 enabled; /* 1 = enabled, 0 = disabled */ +}; + +/* audit_rule_data supports filter rules with both integer and string + * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and + * AUDIT_LIST_RULES requests. + */ +struct audit_rule_data { + __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ + __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ + __u32 field_count; + __u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */ + __u32 fields[AUDIT_MAX_FIELDS]; + __u32 values[AUDIT_MAX_FIELDS]; + __u32 fieldflags[AUDIT_MAX_FIELDS]; + __u32 buflen; /* total length of string fields */ + char buf[0]; /* string fields buffer */ +}; + +/* audit_rule is supported to maintain backward compatibility with + * userspace. It supports integer fields only and corresponds to + * AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests. + */ +struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */ + __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ + __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ + __u32 field_count; + __u32 mask[AUDIT_BITMASK_SIZE]; + __u32 fields[AUDIT_MAX_FIELDS]; + __u32 values[AUDIT_MAX_FIELDS]; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auto_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auto_fs.h new file mode 100644 index 0000000..2726346 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auto_fs.h @@ -0,0 +1,79 @@ +/* -*- linux-c -*- ------------------------------------------------------- * + * + * linux/include/linux/auto_fs.h + * + * Copyright 1997 Transmeta Corporation - All Rights Reserved + * + * This file is part of the Linux kernel and is made available under + * the terms of the GNU General Public License, version 2, or at your + * option, any later version, incorporated herein by reference. + * + * ----------------------------------------------------------------------- */ + + +#ifndef _LINUX_AUTO_FS_H +#define _LINUX_AUTO_FS_H + +#include +#include + +/* This file describes autofs v3 */ +#define AUTOFS_PROTO_VERSION 3 + +/* Range of protocol versions defined */ +#define AUTOFS_MAX_PROTO_VERSION AUTOFS_PROTO_VERSION +#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION + +/* + * Architectures where both 32- and 64-bit binaries can be executed + * on 64-bit kernels need this. This keeps the structure format + * uniform, and makes sure the wait_queue_token isn't too big to be + * passed back down to the kernel. + * + * This assumes that on these architectures: + * mode 32 bit 64 bit + * ------------------------- + * int 32 bit 32 bit + * long 32 bit 64 bit + * + * If so, 32-bit user-space code should be backwards compatible. + */ + +#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \ + || defined(__powerpc__) || defined(__s390__) +typedef unsigned int autofs_wqt_t; +#else +typedef unsigned long autofs_wqt_t; +#endif + +/* Packet types */ +#define autofs_ptype_missing 0 /* Missing entry (mount request) */ +#define autofs_ptype_expire 1 /* Expire entry (umount request) */ + +struct autofs_packet_hdr { + int proto_version; /* Protocol version */ + int type; /* Type of packet */ +}; + +struct autofs_packet_missing { + struct autofs_packet_hdr hdr; + autofs_wqt_t wait_queue_token; + int len; + char name[NAME_MAX+1]; +}; + +/* v3 expire (via ioctl) */ +struct autofs_packet_expire { + struct autofs_packet_hdr hdr; + int len; + char name[NAME_MAX+1]; +}; + +#define AUTOFS_IOC_READY _IO(0x93,0x60) +#define AUTOFS_IOC_FAIL _IO(0x93,0x61) +#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) +#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) +#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) +#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) + +#endif /* _LINUX_AUTO_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auto_fs4.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auto_fs4.h new file mode 100644 index 0000000..cf1db36 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auto_fs4.h @@ -0,0 +1,164 @@ +/* -*- c -*- + * linux/include/linux/auto_fs4.h + * + * Copyright 1999-2000 Jeremy Fitzhardinge + * + * This file is part of the Linux kernel and is made available under + * the terms of the GNU General Public License, version 2, or at your + * option, any later version, incorporated herein by reference. + */ + +#ifndef _LINUX_AUTO_FS4_H +#define _LINUX_AUTO_FS4_H + +/* Include common v3 definitions */ +#include +#include + +/* autofs v4 definitions */ +#undef AUTOFS_PROTO_VERSION +#undef AUTOFS_MIN_PROTO_VERSION +#undef AUTOFS_MAX_PROTO_VERSION + +#define AUTOFS_PROTO_VERSION 5 +#define AUTOFS_MIN_PROTO_VERSION 3 +#define AUTOFS_MAX_PROTO_VERSION 5 + +#define AUTOFS_PROTO_SUBVERSION 1 + +/* Mask for expire behaviour */ +#define AUTOFS_EXP_IMMEDIATE 1 +#define AUTOFS_EXP_LEAVES 2 + +#define AUTOFS_TYPE_ANY 0U +#define AUTOFS_TYPE_INDIRECT 1U +#define AUTOFS_TYPE_DIRECT 2U +#define AUTOFS_TYPE_OFFSET 4U + +static __inline__ void set_autofs_type_indirect(unsigned int *type) +{ + *type = AUTOFS_TYPE_INDIRECT; + return; +} + +static __inline__ unsigned int autofs_type_indirect(unsigned int type) +{ + return (type == AUTOFS_TYPE_INDIRECT); +} + +static __inline__ void set_autofs_type_direct(unsigned int *type) +{ + *type = AUTOFS_TYPE_DIRECT; + return; +} + +static __inline__ unsigned int autofs_type_direct(unsigned int type) +{ + return (type == AUTOFS_TYPE_DIRECT); +} + +static __inline__ void set_autofs_type_offset(unsigned int *type) +{ + *type = AUTOFS_TYPE_OFFSET; + return; +} + +static __inline__ unsigned int autofs_type_offset(unsigned int type) +{ + return (type == AUTOFS_TYPE_OFFSET); +} + +static __inline__ unsigned int autofs_type_trigger(unsigned int type) +{ + return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET); +} + +/* + * This isn't really a type as we use it to say "no type set" to + * indicate we want to search for "any" mount in the + * autofs_dev_ioctl_ismountpoint() device ioctl function. + */ +static __inline__ void set_autofs_type_any(unsigned int *type) +{ + *type = AUTOFS_TYPE_ANY; + return; +} + +static __inline__ unsigned int autofs_type_any(unsigned int type) +{ + return (type == AUTOFS_TYPE_ANY); +} + +/* Daemon notification packet types */ +enum autofs_notify { + NFY_NONE, + NFY_MOUNT, + NFY_EXPIRE +}; + +/* Kernel protocol version 4 packet types */ + +/* Expire entry (umount request) */ +#define autofs_ptype_expire_multi 2 + +/* Kernel protocol version 5 packet types */ + +/* Indirect mount missing and expire requests. */ +#define autofs_ptype_missing_indirect 3 +#define autofs_ptype_expire_indirect 4 + +/* Direct mount missing and expire requests */ +#define autofs_ptype_missing_direct 5 +#define autofs_ptype_expire_direct 6 + +/* v4 multi expire (via pipe) */ +struct autofs_packet_expire_multi { + struct autofs_packet_hdr hdr; + autofs_wqt_t wait_queue_token; + int len; + char name[NAME_MAX+1]; +}; + +union autofs_packet_union { + struct autofs_packet_hdr hdr; + struct autofs_packet_missing missing; + struct autofs_packet_expire expire; + struct autofs_packet_expire_multi expire_multi; +}; + +/* autofs v5 common packet struct */ +struct autofs_v5_packet { + struct autofs_packet_hdr hdr; + autofs_wqt_t wait_queue_token; + __u32 dev; + __u64 ino; + __u32 uid; + __u32 gid; + __u32 pid; + __u32 tgid; + __u32 len; + char name[NAME_MAX+1]; +}; + +typedef struct autofs_v5_packet autofs_packet_missing_indirect_t; +typedef struct autofs_v5_packet autofs_packet_expire_indirect_t; +typedef struct autofs_v5_packet autofs_packet_missing_direct_t; +typedef struct autofs_v5_packet autofs_packet_expire_direct_t; + +union autofs_v5_packet_union { + struct autofs_packet_hdr hdr; + struct autofs_v5_packet v5_packet; + autofs_packet_missing_indirect_t missing_indirect; + autofs_packet_expire_indirect_t expire_indirect; + autofs_packet_missing_direct_t missing_direct; + autofs_packet_expire_direct_t expire_direct; +}; + +#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) +#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI +#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI +#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) +#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int) + + +#endif /* _LINUX_AUTO_FS4_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auxvec.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auxvec.h new file mode 100644 index 0000000..b6d13cf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/auxvec.h @@ -0,0 +1,35 @@ +#ifndef _LINUX_AUXVEC_H +#define _LINUX_AUXVEC_H + +#include + +/* Symbolic values for the entries in the auxiliary table + put on the initial stack */ +#define AT_NULL 0 /* end of vector */ +#define AT_IGNORE 1 /* entry should be ignored */ +#define AT_EXECFD 2 /* file descriptor of program */ +#define AT_PHDR 3 /* program headers for program */ +#define AT_PHENT 4 /* size of program header entry */ +#define AT_PHNUM 5 /* number of program headers */ +#define AT_PAGESZ 6 /* system page size */ +#define AT_BASE 7 /* base address of interpreter */ +#define AT_FLAGS 8 /* flags */ +#define AT_ENTRY 9 /* entry point of program */ +#define AT_NOTELF 10 /* program is not ELF */ +#define AT_UID 11 /* real uid */ +#define AT_EUID 12 /* effective uid */ +#define AT_GID 13 /* real gid */ +#define AT_EGID 14 /* effective gid */ +#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ +#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ +#define AT_CLKTCK 17 /* frequency at which times() increments */ +/* AT_* values 18 through 22 are reserved */ +#define AT_SECURE 23 /* secure mode boolean */ +#define AT_BASE_PLATFORM 24 /* string identifying real platform, may + * differ from AT_PLATFORM. */ +#define AT_RANDOM 25 /* address of 16 random bytes */ + +#define AT_EXECFN 31 /* filename of program */ + + +#endif /* _LINUX_AUXVEC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ax25.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ax25.h new file mode 100644 index 0000000..56c11f0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ax25.h @@ -0,0 +1,116 @@ +/* + * These are the public elements of the Linux kernel AX.25 code. A similar + * file netrom.h exists for the NET/ROM protocol. + */ + +#ifndef AX25_KERNEL_H +#define AX25_KERNEL_H + +#include + +#define AX25_MTU 256 +#define AX25_MAX_DIGIS 8 + +#define AX25_WINDOW 1 +#define AX25_T1 2 +#define AX25_N2 3 +#define AX25_T3 4 +#define AX25_T2 5 +#define AX25_BACKOFF 6 +#define AX25_EXTSEQ 7 +#define AX25_PIDINCL 8 +#define AX25_IDLE 9 +#define AX25_PACLEN 10 +#define AX25_IAMDIGI 12 + +#define AX25_KILL 99 + +#define SIOCAX25GETUID (SIOCPROTOPRIVATE+0) +#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) +#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) +#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) +#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) +#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) +#define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9) +#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) +#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) +#define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12) +#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13) + +#define AX25_SET_RT_IPMODE 2 + +#define AX25_NOUID_DEFAULT 0 +#define AX25_NOUID_BLOCK 1 + +typedef struct { + char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */ +} ax25_address; + +struct sockaddr_ax25 { + sa_family_t sax25_family; + ax25_address sax25_call; + int sax25_ndigis; + /* Digipeater ax25_address sets follow */ +}; + +#define sax25_uid sax25_ndigis + +struct full_sockaddr_ax25 { + struct sockaddr_ax25 fsa_ax25; + ax25_address fsa_digipeater[AX25_MAX_DIGIS]; +}; + +struct ax25_routes_struct { + ax25_address port_addr; + ax25_address dest_addr; + unsigned char digi_count; + ax25_address digi_addr[AX25_MAX_DIGIS]; +}; + +struct ax25_route_opt_struct { + ax25_address port_addr; + ax25_address dest_addr; + int cmd; + int arg; +}; + +struct ax25_ctl_struct { + ax25_address port_addr; + ax25_address source_addr; + ax25_address dest_addr; + unsigned int cmd; + unsigned long arg; + unsigned char digi_count; + ax25_address digi_addr[AX25_MAX_DIGIS]; +}; + +/* this will go away. Please do not export to user land */ +struct ax25_info_struct_deprecated { + unsigned int n2, n2count; + unsigned int t1, t1timer; + unsigned int t2, t2timer; + unsigned int t3, t3timer; + unsigned int idle, idletimer; + unsigned int state; + unsigned int rcv_q, snd_q; +}; + +struct ax25_info_struct { + unsigned int n2, n2count; + unsigned int t1, t1timer; + unsigned int t2, t2timer; + unsigned int t3, t3timer; + unsigned int idle, idletimer; + unsigned int state; + unsigned int rcv_q, snd_q; + unsigned int vs, vr, va, vs_max; + unsigned int paclen; + unsigned int window; +}; + +struct ax25_fwd_struct { + ax25_address port_from; + ax25_address port_to; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/b1lli.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/b1lli.h new file mode 100644 index 0000000..713f712 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/b1lli.h @@ -0,0 +1,73 @@ +/* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $ + * + * ISDN lowlevel-module for AVM B1-card. + * + * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#ifndef _B1LLI_H_ +#define _B1LLI_H_ +/* + * struct for loading t4 file + */ +typedef struct avmb1_t4file { + int len; + unsigned char *data; +} avmb1_t4file; + +typedef struct avmb1_loaddef { + int contr; + avmb1_t4file t4file; +} avmb1_loaddef; + +typedef struct avmb1_loadandconfigdef { + int contr; + avmb1_t4file t4file; + avmb1_t4file t4config; +} avmb1_loadandconfigdef; + +typedef struct avmb1_resetdef { + int contr; +} avmb1_resetdef; + +typedef struct avmb1_getdef { + int contr; + int cardtype; + int cardstate; +} avmb1_getdef; + +/* + * struct for adding new cards + */ +typedef struct avmb1_carddef { + int port; + int irq; +} avmb1_carddef; + +#define AVM_CARDTYPE_B1 0 +#define AVM_CARDTYPE_T1 1 +#define AVM_CARDTYPE_M1 2 +#define AVM_CARDTYPE_M2 3 + +typedef struct avmb1_extcarddef { + int port; + int irq; + int cardtype; + int cardnr; /* for HEMA/T1 */ +} avmb1_extcarddef; + +#define AVMB1_LOAD 0 /* load image to card */ +#define AVMB1_ADDCARD 1 /* add a new card - OBSOLETE */ +#define AVMB1_RESETCARD 2 /* reset a card */ +#define AVMB1_LOAD_AND_CONFIG 3 /* load image and config to card */ +#define AVMB1_ADDCARD_WITH_TYPE 4 /* add a new card, with cardtype */ +#define AVMB1_GET_CARDINFO 5 /* get cardtype */ +#define AVMB1_REMOVECARD 6 /* remove a card - OBSOLETE */ + +#define AVMB1_REGISTERCARD_IS_OBSOLETE + +#endif /* _B1LLI_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/baycom.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/baycom.h new file mode 100644 index 0000000..81249e0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/baycom.h @@ -0,0 +1,39 @@ +/* + * The Linux BAYCOM driver for the Baycom serial 1200 baud modem + * and the parallel 9600 baud modem + * (C) 1997-1998 by Thomas Sailer, HB9JNX/AE4WA + */ + +#ifndef _BAYCOM_H +#define _BAYCOM_H + +/* -------------------------------------------------------------------- */ +/* + * structs for the IOCTL commands + */ + +struct baycom_debug_data { + unsigned long debug1; + unsigned long debug2; + long debug3; +}; + +struct baycom_ioctl { + int cmd; + union { + struct baycom_debug_data dbg; + } data; +}; + +/* -------------------------------------------------------------------- */ + +/* + * ioctl values change for baycom + */ +#define BAYCOMCTL_GETDEBUG 0x92 + +/* -------------------------------------------------------------------- */ + +#endif /* _BAYCOM_H */ + +/* --------------------------------------------------------------------- */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bfs_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bfs_fs.h new file mode 100644 index 0000000..1c0b355 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bfs_fs.h @@ -0,0 +1,81 @@ +/* + * include/linux/bfs_fs.h - BFS data structures on disk. + * Copyright (C) 1999 Tigran Aivazian + */ + +#ifndef _LINUX_BFS_FS_H +#define _LINUX_BFS_FS_H + +#include + +#define BFS_BSIZE_BITS 9 +#define BFS_BSIZE (1<i_vtype) */ +#define BFS_VDIR 2L +#define BFS_VREG 1L + +/* BFS inode layout on disk */ +struct bfs_inode { + __le16 i_ino; + __u16 i_unused; + __le32 i_sblock; + __le32 i_eblock; + __le32 i_eoffset; + __le32 i_vtype; + __le32 i_mode; + __le32 i_uid; + __le32 i_gid; + __le32 i_nlink; + __le32 i_atime; + __le32 i_mtime; + __le32 i_ctime; + __u32 i_padding[4]; +}; + +#define BFS_NAMELEN 14 +#define BFS_DIRENT_SIZE 16 +#define BFS_DIRS_PER_BLOCK 32 + +struct bfs_dirent { + __le16 ino; + char name[BFS_NAMELEN]; +}; + +/* BFS superblock layout on disk */ +struct bfs_super_block { + __le32 s_magic; + __le32 s_start; + __le32 s_end; + __le32 s_from; + __le32 s_to; + __s32 s_bfrom; + __s32 s_bto; + char s_fsname[6]; + char s_volume[6]; + __u32 s_padding[118]; +}; + + +#define BFS_OFF2INO(offset) \ + ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) + +#define BFS_INO2OFF(ino) \ + ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) +#define BFS_NZFILESIZE(ip) \ + ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) + +#define BFS_FILESIZE(ip) \ + ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) + +#define BFS_FILEBLOCKS(ip) \ + ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) +#define BFS_UNCLEAN(bfs_sb, sb) \ + ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) + + +#endif /* _LINUX_BFS_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/binfmts.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/binfmts.h new file mode 100644 index 0000000..6416794 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/binfmts.h @@ -0,0 +1,20 @@ +#ifndef _LINUX_BINFMTS_H +#define _LINUX_BINFMTS_H + +#include + +struct pt_regs; + +/* + * These are the maximum length and maximum number of strings passed to the + * execve() system call. MAX_ARG_STRLEN is essentially random but serves to + * prevent the kernel from being unduly impacted by misaddressed pointers. + * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer. + */ +#define MAX_ARG_STRLEN (PAGE_SIZE * 32) +#define MAX_ARG_STRINGS 0x7FFFFFFF + +/* sizeof(linux_binprm->buf) */ +#define BINPRM_BUF_SIZE 128 + +#endif /* _LINUX_BINFMTS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/blkpg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/blkpg.h new file mode 100644 index 0000000..c52dd4b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/blkpg.h @@ -0,0 +1,58 @@ +#ifndef _LINUX_BLKPG_H +#define _LINUX_BLKPG_H + +/* + * Partition table and disk geometry handling + * + * A single ioctl with lots of subfunctions: + * + * Device number stuff: + * get_whole_disk() (given the device number of a partition, + * find the device number of the encompassing disk) + * get_all_partitions() (given the device number of a disk, return the + * device numbers of all its known partitions) + * + * Partition stuff: + * add_partition() + * delete_partition() + * test_partition_in_use() (also for test_disk_in_use) + * + * Geometry stuff: + * get_geometry() + * set_geometry() + * get_bios_drivedata() + * + * For today, only the partition stuff - aeb, 990515 + */ + +#include + +#define BLKPG _IO(0x12,105) + +/* The argument structure */ +struct blkpg_ioctl_arg { + int op; + int flags; + int datalen; + void *data; +}; + +/* The subfunctions (for the op field) */ +#define BLKPG_ADD_PARTITION 1 +#define BLKPG_DEL_PARTITION 2 + +/* Sizes of name fields. Unused at present. */ +#define BLKPG_DEVNAMELTH 64 +#define BLKPG_VOLNAMELTH 64 + +/* The data structure for ADD_PARTITION and DEL_PARTITION */ +struct blkpg_partition { + long long start; /* starting offset in bytes */ + long long length; /* length in bytes */ + int pno; /* partition number */ + char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2, + to be used in kernel messages */ + char volname[BLKPG_VOLNAMELTH]; /* volume label */ +}; + +#endif /* _LINUX_BLKPG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/blktrace_api.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/blktrace_api.h new file mode 100644 index 0000000..b9901f6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/blktrace_api.h @@ -0,0 +1,141 @@ +#ifndef BLKTRACE_H +#define BLKTRACE_H + +#include + +/* + * Trace categories + */ +enum blktrace_cat { + BLK_TC_READ = 1 << 0, /* reads */ + BLK_TC_WRITE = 1 << 1, /* writes */ + BLK_TC_BARRIER = 1 << 2, /* barrier */ + BLK_TC_SYNC = 1 << 3, /* sync IO */ + BLK_TC_SYNCIO = BLK_TC_SYNC, + BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ + BLK_TC_REQUEUE = 1 << 5, /* requeueing */ + BLK_TC_ISSUE = 1 << 6, /* issue */ + BLK_TC_COMPLETE = 1 << 7, /* completions */ + BLK_TC_FS = 1 << 8, /* fs requests */ + BLK_TC_PC = 1 << 9, /* pc requests */ + BLK_TC_NOTIFY = 1 << 10, /* special message */ + BLK_TC_AHEAD = 1 << 11, /* readahead */ + BLK_TC_META = 1 << 12, /* metadata */ + BLK_TC_DISCARD = 1 << 13, /* discard requests */ + BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ + + BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ +}; + +#define BLK_TC_SHIFT (16) +#define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) + +/* + * Basic trace actions + */ +enum blktrace_act { + __BLK_TA_QUEUE = 1, /* queued */ + __BLK_TA_BACKMERGE, /* back merged to existing rq */ + __BLK_TA_FRONTMERGE, /* front merge to existing rq */ + __BLK_TA_GETRQ, /* allocated new request */ + __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */ + __BLK_TA_REQUEUE, /* request requeued */ + __BLK_TA_ISSUE, /* sent to driver */ + __BLK_TA_COMPLETE, /* completed by driver */ + __BLK_TA_PLUG, /* queue was plugged */ + __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */ + __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */ + __BLK_TA_INSERT, /* insert request */ + __BLK_TA_SPLIT, /* bio was split */ + __BLK_TA_BOUNCE, /* bio was bounced */ + __BLK_TA_REMAP, /* bio was remapped */ + __BLK_TA_ABORT, /* request aborted */ + __BLK_TA_DRV_DATA, /* driver-specific binary data */ +}; + +/* + * Notify events. + */ +enum blktrace_notify { + __BLK_TN_PROCESS = 0, /* establish pid/name mapping */ + __BLK_TN_TIMESTAMP, /* include system clock */ + __BLK_TN_MESSAGE, /* Character string message */ +}; + + +/* + * Trace actions in full. Additionally, read or write is masked + */ +#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE)) +#define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE)) +#define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE)) +#define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_SPLIT (__BLK_TA_SPLIT) +#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) +#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) +#define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA)) + +#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) +#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) +#define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY)) + +#define BLK_IO_TRACE_MAGIC 0x65617400 +#define BLK_IO_TRACE_VERSION 0x07 + +/* + * The trace itself + */ +struct blk_io_trace { + __u32 magic; /* MAGIC << 8 | version */ + __u32 sequence; /* event number */ + __u64 time; /* in microseconds */ + __u64 sector; /* disk offset */ + __u32 bytes; /* transfer length */ + __u32 action; /* what happened */ + __u32 pid; /* who did it */ + __u32 device; /* device number */ + __u32 cpu; /* on what cpu did it happen */ + __u16 error; /* completion error */ + __u16 pdu_len; /* length of data after this trace */ +}; + +/* + * The remap event + */ +struct blk_io_trace_remap { + __be32 device; + __be32 device_from; + __be64 sector; +}; + +enum { + Blktrace_setup = 1, + Blktrace_running, + Blktrace_stopped, +}; + +#define BLKTRACE_BDEV_SIZE 32 + +/* + * User setup structure passed with BLKTRACESTART + */ +struct blk_user_trace_setup { + char name[BLKTRACE_BDEV_SIZE]; /* output */ + __u16 act_mask; /* input */ + __u32 buf_size; /* input */ + __u32 buf_nr; /* input */ + __u64 start_lba; + __u64 end_lba; + __u32 pid; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bpqether.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bpqether.h new file mode 100644 index 0000000..a6c35e1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bpqether.h @@ -0,0 +1,41 @@ +#ifndef __BPQETHER_H +#define __BPQETHER_H + +/* + * Defines for the BPQETHER pseudo device driver + */ + +#ifndef __LINUX_IF_ETHER_H +#include +#endif + +#define SIOCSBPQETHOPT (SIOCDEVPRIVATE+0) /* reserved */ +#define SIOCSBPQETHADDR (SIOCDEVPRIVATE+1) + +struct bpq_ethaddr { + unsigned char destination[ETH_ALEN]; + unsigned char accept[ETH_ALEN]; +}; + +/* + * For SIOCSBPQETHOPT - this is compatible with PI2/PacketTwin card drivers, + * currently not implemented, though. If someone wants to hook a radio + * to his Ethernet card he may find this useful. ;-) + */ + +#define SIOCGBPQETHPARAM 0x5000 /* get Level 1 parameters */ +#define SIOCSBPQETHPARAM 0x5001 /* set */ + +struct bpq_req { + int cmd; + int speed; /* unused */ + int clockmode; /* unused */ + int txdelay; + unsigned char persist; /* unused */ + int slotime; /* unused */ + int squeldelay; + int dmachan; /* unused */ + int irq; /* unused */ +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bsg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bsg.h new file mode 100644 index 0000000..7612d5c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/bsg.h @@ -0,0 +1,65 @@ +#ifndef BSG_H +#define BSG_H + +#include + +#define BSG_PROTOCOL_SCSI 0 + +#define BSG_SUB_PROTOCOL_SCSI_CMD 0 +#define BSG_SUB_PROTOCOL_SCSI_TMF 1 +#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 + +/* + * For flags member below + * sg.h sg_io_hdr also has bits defined for it's flags member. However + * none of these bits are implemented/used by bsg. The bits below are + * allocated to not conflict with sg.h ones anyway. + */ +#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */ + +struct sg_io_v4 { + __s32 guard; /* [i] 'Q' to differentiate from v3 */ + __u32 protocol; /* [i] 0 -> SCSI , .... */ + __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task + management function, .... */ + + __u32 request_len; /* [i] in bytes */ + __u64 request; /* [i], [*i] {SCSI: cdb} */ + __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ + __u32 request_attr; /* [i] {SCSI: task attribute} */ + __u32 request_priority; /* [i] {SCSI: task priority} */ + __u32 request_extra; /* [i] {spare, for padding} */ + __u32 max_response_len; /* [i] in bytes */ + __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ + + /* "dout_": data out (to device); "din_": data in (from device) */ + __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else + dout_xfer points to array of iovec */ + __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ + __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ + __u32 din_xfer_len; /* [i] bytes to be transferred from device */ + __u64 dout_xferp; /* [i], [*i] */ + __u64 din_xferp; /* [i], [*o] */ + + __u32 timeout; /* [i] units: millisecond */ + __u32 flags; /* [i] bit mask */ + __u64 usr_ptr; /* [i->o] unused internally */ + __u32 spare_in; /* [i] */ + + __u32 driver_status; /* [o] 0 -> ok */ + __u32 transport_status; /* [o] 0 -> ok */ + __u32 device_status; /* [o] {SCSI: command completion status} */ + __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */ + __u32 info; /* [o] additional information */ + __u32 duration; /* [o] time to complete, in milliseconds */ + __u32 response_len; /* [o] bytes of response actually written */ + __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ + __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ + __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ + __u32 spare_out; /* [o] */ + + __u32 padding; +}; + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/..install.cmd new file mode 100644 index 0000000..3919ffe --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/byteorder/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/byteorder /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/byteorder mips big_endian.h little_endian.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/byteorder /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/byteorder mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/byteorder/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/big_endian.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/big_endian.h new file mode 100644 index 0000000..a4ef98d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/big_endian.h @@ -0,0 +1,105 @@ +#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H +#define _LINUX_BYTEORDER_BIG_ENDIAN_H + +#ifndef __BIG_ENDIAN +#define __BIG_ENDIAN 4321 +#endif +#ifndef __BIG_ENDIAN_BITFIELD +#define __BIG_ENDIAN_BITFIELD +#endif + +#include +#include + +#define __constant_htonl(x) ((__be32)(__u32)(x)) +#define __constant_ntohl(x) ((__u32)(__be32)(x)) +#define __constant_htons(x) ((__be16)(__u16)(x)) +#define __constant_ntohs(x) ((__u16)(__be16)(x)) +#define __constant_cpu_to_le64(x) ((__le64)___constant_swab64((x))) +#define __constant_le64_to_cpu(x) ___constant_swab64((__u64)(__le64)(x)) +#define __constant_cpu_to_le32(x) ((__le32)___constant_swab32((x))) +#define __constant_le32_to_cpu(x) ___constant_swab32((__u32)(__le32)(x)) +#define __constant_cpu_to_le16(x) ((__le16)___constant_swab16((x))) +#define __constant_le16_to_cpu(x) ___constant_swab16((__u16)(__le16)(x)) +#define __constant_cpu_to_be64(x) ((__be64)(__u64)(x)) +#define __constant_be64_to_cpu(x) ((__u64)(__be64)(x)) +#define __constant_cpu_to_be32(x) ((__be32)(__u32)(x)) +#define __constant_be32_to_cpu(x) ((__u32)(__be32)(x)) +#define __constant_cpu_to_be16(x) ((__be16)(__u16)(x)) +#define __constant_be16_to_cpu(x) ((__u16)(__be16)(x)) +#define __cpu_to_le64(x) ((__le64)__swab64((x))) +#define __le64_to_cpu(x) __swab64((__u64)(__le64)(x)) +#define __cpu_to_le32(x) ((__le32)__swab32((x))) +#define __le32_to_cpu(x) __swab32((__u32)(__le32)(x)) +#define __cpu_to_le16(x) ((__le16)__swab16((x))) +#define __le16_to_cpu(x) __swab16((__u16)(__le16)(x)) +#define __cpu_to_be64(x) ((__be64)(__u64)(x)) +#define __be64_to_cpu(x) ((__u64)(__be64)(x)) +#define __cpu_to_be32(x) ((__be32)(__u32)(x)) +#define __be32_to_cpu(x) ((__u32)(__be32)(x)) +#define __cpu_to_be16(x) ((__be16)(__u16)(x)) +#define __be16_to_cpu(x) ((__u16)(__be16)(x)) + +static __inline__ __le64 __cpu_to_le64p(const __u64 *p) +{ + return (__le64)__swab64p(p); +} +static __inline__ __u64 __le64_to_cpup(const __le64 *p) +{ + return __swab64p((__u64 *)p); +} +static __inline__ __le32 __cpu_to_le32p(const __u32 *p) +{ + return (__le32)__swab32p(p); +} +static __inline__ __u32 __le32_to_cpup(const __le32 *p) +{ + return __swab32p((__u32 *)p); +} +static __inline__ __le16 __cpu_to_le16p(const __u16 *p) +{ + return (__le16)__swab16p(p); +} +static __inline__ __u16 __le16_to_cpup(const __le16 *p) +{ + return __swab16p((__u16 *)p); +} +static __inline__ __be64 __cpu_to_be64p(const __u64 *p) +{ + return (__be64)*p; +} +static __inline__ __u64 __be64_to_cpup(const __be64 *p) +{ + return (__u64)*p; +} +static __inline__ __be32 __cpu_to_be32p(const __u32 *p) +{ + return (__be32)*p; +} +static __inline__ __u32 __be32_to_cpup(const __be32 *p) +{ + return (__u32)*p; +} +static __inline__ __be16 __cpu_to_be16p(const __u16 *p) +{ + return (__be16)*p; +} +static __inline__ __u16 __be16_to_cpup(const __be16 *p) +{ + return (__u16)*p; +} +#define __cpu_to_le64s(x) __swab64s((x)) +#define __le64_to_cpus(x) __swab64s((x)) +#define __cpu_to_le32s(x) __swab32s((x)) +#define __le32_to_cpus(x) __swab32s((x)) +#define __cpu_to_le16s(x) __swab16s((x)) +#define __le16_to_cpus(x) __swab16s((x)) +#define __cpu_to_be64s(x) do { (void)(x); } while (0) +#define __be64_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_be32s(x) do { (void)(x); } while (0) +#define __be32_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_be16s(x) do { (void)(x); } while (0) +#define __be16_to_cpus(x) do { (void)(x); } while (0) + + +#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/little_endian.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/little_endian.h new file mode 100644 index 0000000..74e8a15 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/byteorder/little_endian.h @@ -0,0 +1,105 @@ +#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H +#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H + +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif +#ifndef __LITTLE_ENDIAN_BITFIELD +#define __LITTLE_ENDIAN_BITFIELD +#endif + +#include +#include + +#define __constant_htonl(x) ((__be32)___constant_swab32((x))) +#define __constant_ntohl(x) ___constant_swab32((__be32)(x)) +#define __constant_htons(x) ((__be16)___constant_swab16((x))) +#define __constant_ntohs(x) ___constant_swab16((__be16)(x)) +#define __constant_cpu_to_le64(x) ((__le64)(__u64)(x)) +#define __constant_le64_to_cpu(x) ((__u64)(__le64)(x)) +#define __constant_cpu_to_le32(x) ((__le32)(__u32)(x)) +#define __constant_le32_to_cpu(x) ((__u32)(__le32)(x)) +#define __constant_cpu_to_le16(x) ((__le16)(__u16)(x)) +#define __constant_le16_to_cpu(x) ((__u16)(__le16)(x)) +#define __constant_cpu_to_be64(x) ((__be64)___constant_swab64((x))) +#define __constant_be64_to_cpu(x) ___constant_swab64((__u64)(__be64)(x)) +#define __constant_cpu_to_be32(x) ((__be32)___constant_swab32((x))) +#define __constant_be32_to_cpu(x) ___constant_swab32((__u32)(__be32)(x)) +#define __constant_cpu_to_be16(x) ((__be16)___constant_swab16((x))) +#define __constant_be16_to_cpu(x) ___constant_swab16((__u16)(__be16)(x)) +#define __cpu_to_le64(x) ((__le64)(__u64)(x)) +#define __le64_to_cpu(x) ((__u64)(__le64)(x)) +#define __cpu_to_le32(x) ((__le32)(__u32)(x)) +#define __le32_to_cpu(x) ((__u32)(__le32)(x)) +#define __cpu_to_le16(x) ((__le16)(__u16)(x)) +#define __le16_to_cpu(x) ((__u16)(__le16)(x)) +#define __cpu_to_be64(x) ((__be64)__swab64((x))) +#define __be64_to_cpu(x) __swab64((__u64)(__be64)(x)) +#define __cpu_to_be32(x) ((__be32)__swab32((x))) +#define __be32_to_cpu(x) __swab32((__u32)(__be32)(x)) +#define __cpu_to_be16(x) ((__be16)__swab16((x))) +#define __be16_to_cpu(x) __swab16((__u16)(__be16)(x)) + +static __inline__ __le64 __cpu_to_le64p(const __u64 *p) +{ + return (__le64)*p; +} +static __inline__ __u64 __le64_to_cpup(const __le64 *p) +{ + return (__u64)*p; +} +static __inline__ __le32 __cpu_to_le32p(const __u32 *p) +{ + return (__le32)*p; +} +static __inline__ __u32 __le32_to_cpup(const __le32 *p) +{ + return (__u32)*p; +} +static __inline__ __le16 __cpu_to_le16p(const __u16 *p) +{ + return (__le16)*p; +} +static __inline__ __u16 __le16_to_cpup(const __le16 *p) +{ + return (__u16)*p; +} +static __inline__ __be64 __cpu_to_be64p(const __u64 *p) +{ + return (__be64)__swab64p(p); +} +static __inline__ __u64 __be64_to_cpup(const __be64 *p) +{ + return __swab64p((__u64 *)p); +} +static __inline__ __be32 __cpu_to_be32p(const __u32 *p) +{ + return (__be32)__swab32p(p); +} +static __inline__ __u32 __be32_to_cpup(const __be32 *p) +{ + return __swab32p((__u32 *)p); +} +static __inline__ __be16 __cpu_to_be16p(const __u16 *p) +{ + return (__be16)__swab16p(p); +} +static __inline__ __u16 __be16_to_cpup(const __be16 *p) +{ + return __swab16p((__u16 *)p); +} +#define __cpu_to_le64s(x) do { (void)(x); } while (0) +#define __le64_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_le32s(x) do { (void)(x); } while (0) +#define __le32_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_le16s(x) do { (void)(x); } while (0) +#define __le16_to_cpus(x) do { (void)(x); } while (0) +#define __cpu_to_be64s(x) __swab64s((x)) +#define __be64_to_cpus(x) __swab64s((x)) +#define __cpu_to_be32s(x) __swab32s((x)) +#define __be32_to_cpus(x) __swab32s((x)) +#define __cpu_to_be16s(x) __swab16s((x)) +#define __be16_to_cpus(x) __swab16s((x)) + + +#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can.h new file mode 100644 index 0000000..d183333 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can.h @@ -0,0 +1,111 @@ +/* + * linux/can.h + * + * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) + * + * Authors: Oliver Hartkopp + * Urs Thuermann + * Copyright (c) 2002-2007 Volkswagen Group Electronic Research + * All rights reserved. + * + * Send feedback to + * + */ + +#ifndef CAN_H +#define CAN_H + +#include +#include + +/* controller area network (CAN) kernel definitions */ + +/* special address description flags for the CAN_ID */ +#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ +#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ +#define CAN_ERR_FLAG 0x20000000U /* error frame */ + +/* valid bits in CAN ID for frame formats */ +#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ +#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ +#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ + +/* + * Controller Area Network Identifier structure + * + * bit 0-28 : CAN identifier (11/29 bit) + * bit 29 : error frame flag (0 = data frame, 1 = error frame) + * bit 30 : remote transmission request flag (1 = rtr frame) + * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) + */ +typedef __u32 canid_t; + +/* + * Controller Area Network Error Frame Mask structure + * + * bit 0-28 : error class mask (see include/linux/can/error.h) + * bit 29-31 : set to zero + */ +typedef __u32 can_err_mask_t; + +/** + * struct can_frame - basic CAN frame structure + * @can_id: the CAN ID of the frame and CAN_*_FLAG flags, see above. + * @can_dlc: the data length field of the CAN frame + * @data: the CAN frame payload. + */ +struct can_frame { + canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ + __u8 can_dlc; /* data length code: 0 .. 8 */ + __u8 data[8] __attribute__((aligned(8))); +}; + +/* particular protocols of the protocol family PF_CAN */ +#define CAN_RAW 1 /* RAW sockets */ +#define CAN_BCM 2 /* Broadcast Manager */ +#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ +#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ +#define CAN_MCNET 5 /* Bosch MCNet */ +#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ +#define CAN_NPROTO 7 + +#define SOL_CAN_BASE 100 + +/** + * struct sockaddr_can - the sockaddr structure for CAN sockets + * @can_family: address family number AF_CAN. + * @can_ifindex: CAN network interface index. + * @can_addr: protocol specific address information + */ +struct sockaddr_can { + sa_family_t can_family; + int can_ifindex; + union { + /* transport protocol class address information (e.g. ISOTP) */ + struct { canid_t rx_id, tx_id; } tp; + + /* reserved for future CAN protocols address information */ + } can_addr; +}; + +/** + * struct can_filter - CAN ID based filter in can_register(). + * @can_id: relevant bits of CAN ID which are not masked out. + * @can_mask: CAN mask (see description) + * + * Description: + * A filter matches, when + * + * & mask == can_id & mask + * + * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can + * filter for error frames (CAN_ERR_FLAG bit set in mask). + */ +struct can_filter { + canid_t can_id; + canid_t can_mask; +}; + +#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ + +#endif /* CAN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/..install.cmd new file mode 100644 index 0000000..5ae1a97 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/can/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/can /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/can mips bcm.h error.h raw.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/can /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/can mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/can/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/bcm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/bcm.h new file mode 100644 index 0000000..1432b27 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/bcm.h @@ -0,0 +1,67 @@ +/* + * linux/can/bcm.h + * + * Definitions for CAN Broadcast Manager (BCM) + * + * Author: Oliver Hartkopp + * Copyright (c) 2002-2007 Volkswagen Group Electronic Research + * All rights reserved. + * + * Send feedback to + * + */ + +#ifndef CAN_BCM_H +#define CAN_BCM_H + +#include + +/** + * struct bcm_msg_head - head of messages to/from the broadcast manager + * @opcode: opcode, see enum below. + * @flags: special flags, see below. + * @count: number of frames to send before changing interval. + * @ival1: interval for the first @count frames. + * @ival2: interval for the following frames. + * @can_id: CAN ID of frames to be sent or received. + * @nframes: number of frames appended to the message head. + * @frames: array of CAN frames. + */ +struct bcm_msg_head { + __u32 opcode; + __u32 flags; + __u32 count; + struct timeval ival1, ival2; + canid_t can_id; + __u32 nframes; + struct can_frame frames[0]; +}; + +enum { + TX_SETUP = 1, /* create (cyclic) transmission task */ + TX_DELETE, /* remove (cyclic) transmission task */ + TX_READ, /* read properties of (cyclic) transmission task */ + TX_SEND, /* send one CAN frame */ + RX_SETUP, /* create RX content filter subscription */ + RX_DELETE, /* remove RX content filter subscription */ + RX_READ, /* read properties of RX content filter subscription */ + TX_STATUS, /* reply to TX_READ request */ + TX_EXPIRED, /* notification on performed transmissions (count=0) */ + RX_STATUS, /* reply to RX_READ request */ + RX_TIMEOUT, /* cyclic message is absent */ + RX_CHANGED /* updated CAN frame (detected content change) */ +}; + +#define SETTIMER 0x0001 +#define STARTTIMER 0x0002 +#define TX_COUNTEVT 0x0004 +#define TX_ANNOUNCE 0x0008 +#define TX_CP_CAN_ID 0x0010 +#define RX_FILTER_ID 0x0020 +#define RX_CHECK_DLC 0x0040 +#define RX_NO_AUTOTIMER 0x0080 +#define RX_ANNOUNCE_RESUME 0x0100 +#define TX_RESET_MULTI_IDX 0x0200 +#define RX_RTR_FRAME 0x0400 + +#endif /* CAN_BCM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/error.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/error.h new file mode 100644 index 0000000..d4127fd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/error.h @@ -0,0 +1,93 @@ +/* + * linux/can/error.h + * + * Definitions of the CAN error frame to be filtered and passed to the user. + * + * Author: Oliver Hartkopp + * Copyright (c) 2002-2007 Volkswagen Group Electronic Research + * All rights reserved. + * + * Send feedback to + * + */ + +#ifndef CAN_ERROR_H +#define CAN_ERROR_H + +#define CAN_ERR_DLC 8 /* dlc for error frames */ + +/* error class (mask) in can_id */ +#define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ +#define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */ +#define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */ +#define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */ +#define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */ +#define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */ +#define CAN_ERR_BUSOFF 0x00000040U /* bus off */ +#define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */ +#define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */ + +/* arbitration lost in bit ... / data[0] */ +#define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */ + /* else bit number in bitstream */ + +/* error status of CAN-controller / data[1] */ +#define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */ +#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */ +#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */ +#define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */ +#define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */ +#define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */ +#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ + /* (at least one error counter exceeds */ + /* the protocol-defined level of 127) */ + +/* error in CAN protocol (type) / data[2] */ +#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ +#define CAN_ERR_PROT_BIT 0x01 /* single bit error */ +#define CAN_ERR_PROT_FORM 0x02 /* frame format error */ +#define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */ +#define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */ +#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ +#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ +#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ +#define CAN_ERR_PROT_TX 0x80 /* error occured on transmission */ + +/* error in CAN protocol (location) / data[3] */ +#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ +#define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */ +#define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */ +#define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/ +#define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */ +#define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */ +#define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */ +#define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */ +#define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */ +#define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */ +#define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */ +#define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */ +#define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */ +#define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */ +#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */ +#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */ +#define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */ +#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */ +#define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */ +#define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */ + +/* error status of CAN-transceiver / data[4] */ +/* CANH CANL */ +#define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */ +#define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */ +#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */ +#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */ +#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */ +#define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */ +#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */ +#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */ +#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ +#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ + +/* controller specific additional information / data[5..7] */ + +#endif /* CAN_ERROR_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/raw.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/raw.h new file mode 100644 index 0000000..b2a0f87 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/can/raw.h @@ -0,0 +1,31 @@ +/* + * linux/can/raw.h + * + * Definitions for raw CAN sockets + * + * Authors: Oliver Hartkopp + * Urs Thuermann + * Copyright (c) 2002-2007 Volkswagen Group Electronic Research + * All rights reserved. + * + * Send feedback to + * + */ + +#ifndef CAN_RAW_H +#define CAN_RAW_H + +#include + +#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW) + +/* for socket options affecting the socket (not the global system) */ + +enum { + CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ + CAN_RAW_ERR_FILTER, /* set filter for error frames */ + CAN_RAW_LOOPBACK, /* local loopback (default:on) */ + CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */ +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/capability.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/capability.h new file mode 100644 index 0000000..10761b4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/capability.h @@ -0,0 +1,347 @@ +/* + * This is + * + * Andrew G. Morgan + * Alexander Kjeldaas + * with help from Aleph1, Roland Buresund and Andrew Main. + * + * See here for the libcap library ("POSIX draft" compliance): + * + * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ + */ + +#ifndef _LINUX_CAPABILITY_H +#define _LINUX_CAPABILITY_H + +#include + +struct task_struct; + +/* User-level do most of the mapping between kernel and user + capabilities based on the version tag given by the kernel. The + kernel might be somewhat backwards compatible, but don't bet on + it. */ + +/* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to + a set of three capability sets. The transposition of 3*the + following structure to such a composite is better handled in a user + library since the draft standard requires the use of malloc/free + etc.. */ + +#define _LINUX_CAPABILITY_VERSION_1 0x19980330 +#define _LINUX_CAPABILITY_U32S_1 1 + +#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */ +#define _LINUX_CAPABILITY_U32S_2 2 + +#define _LINUX_CAPABILITY_VERSION_3 0x20080522 +#define _LINUX_CAPABILITY_U32S_3 2 + +typedef struct __user_cap_header_struct { + __u32 version; + int pid; +} *cap_user_header_t; + +typedef struct __user_cap_data_struct { + __u32 effective; + __u32 permitted; + __u32 inheritable; +} *cap_user_data_t; + + +#define XATTR_CAPS_SUFFIX "capability" +#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX + +#define VFS_CAP_REVISION_MASK 0xFF000000 +#define VFS_CAP_REVISION_SHIFT 24 +#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK +#define VFS_CAP_FLAGS_EFFECTIVE 0x000001 + +#define VFS_CAP_REVISION_1 0x01000000 +#define VFS_CAP_U32_1 1 +#define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1)) + +#define VFS_CAP_REVISION_2 0x02000000 +#define VFS_CAP_U32_2 2 +#define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2)) + +#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2 +#define VFS_CAP_U32 VFS_CAP_U32_2 +#define VFS_CAP_REVISION VFS_CAP_REVISION_2 + +struct vfs_cap_data { + __le32 magic_etc; /* Little endian */ + struct { + __le32 permitted; /* Little endian */ + __le32 inheritable; /* Little endian */ + } data[VFS_CAP_U32]; +}; + + +/* + * Backwardly compatible definition for source code - trapped in a + * 32-bit world. If you find you need this, please consider using + * libcap to untrap yourself... + */ +#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1 +#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1 + + + +/** + ** POSIX-draft defined capabilities. + **/ + +/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this + overrides the restriction of changing file ownership and group + ownership. */ + +#define CAP_CHOWN 0 + +/* Override all DAC access, including ACL execute access if + [_POSIX_ACL] is defined. Excluding DAC access covered by + CAP_LINUX_IMMUTABLE. */ + +#define CAP_DAC_OVERRIDE 1 + +/* Overrides all DAC restrictions regarding read and search on files + and directories, including ACL restrictions if [_POSIX_ACL] is + defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */ + +#define CAP_DAC_READ_SEARCH 2 + +/* Overrides all restrictions about allowed operations on files, where + file owner ID must be equal to the user ID, except where CAP_FSETID + is applicable. It doesn't override MAC and DAC restrictions. */ + +#define CAP_FOWNER 3 + +/* Overrides the following restrictions that the effective user ID + shall match the file owner ID when setting the S_ISUID and S_ISGID + bits on that file; that the effective group ID (or one of the + supplementary group IDs) shall match the file owner ID when setting + the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are + cleared on successful return from chown(2) (not implemented). */ + +#define CAP_FSETID 4 + +/* Overrides the restriction that the real or effective user ID of a + process sending a signal must match the real or effective user ID + of the process receiving the signal. */ + +#define CAP_KILL 5 + +/* Allows setgid(2) manipulation */ +/* Allows setgroups(2) */ +/* Allows forged gids on socket credentials passing. */ + +#define CAP_SETGID 6 + +/* Allows set*uid(2) manipulation (including fsuid). */ +/* Allows forged pids on socket credentials passing. */ + +#define CAP_SETUID 7 + + +/** + ** Linux-specific capabilities + **/ + +/* Without VFS support for capabilities: + * Transfer any capability in your permitted set to any pid, + * remove any capability in your permitted set from any pid + * With VFS support for capabilities (neither of above, but) + * Add any capability from current's capability bounding set + * to the current process' inheritable set + * Allow taking bits out of capability bounding set + * Allow modification of the securebits for a process + */ + +#define CAP_SETPCAP 8 + +/* Allow modification of S_IMMUTABLE and S_APPEND file attributes */ + +#define CAP_LINUX_IMMUTABLE 9 + +/* Allows binding to TCP/UDP sockets below 1024 */ +/* Allows binding to ATM VCIs below 32 */ + +#define CAP_NET_BIND_SERVICE 10 + +/* Allow broadcasting, listen to multicast */ + +#define CAP_NET_BROADCAST 11 + +/* Allow interface configuration */ +/* Allow administration of IP firewall, masquerading and accounting */ +/* Allow setting debug option on sockets */ +/* Allow modification of routing tables */ +/* Allow setting arbitrary process / process group ownership on + sockets */ +/* Allow binding to any address for transparent proxying */ +/* Allow setting TOS (type of service) */ +/* Allow setting promiscuous mode */ +/* Allow clearing driver statistics */ +/* Allow multicasting */ +/* Allow read/write of device-specific registers */ +/* Allow activation of ATM control sockets */ + +#define CAP_NET_ADMIN 12 + +/* Allow use of RAW sockets */ +/* Allow use of PACKET sockets */ + +#define CAP_NET_RAW 13 + +/* Allow locking of shared memory segments */ +/* Allow mlock and mlockall (which doesn't really have anything to do + with IPC) */ + +#define CAP_IPC_LOCK 14 + +/* Override IPC ownership checks */ + +#define CAP_IPC_OWNER 15 + +/* Insert and remove kernel modules - modify kernel without limit */ +#define CAP_SYS_MODULE 16 + +/* Allow ioperm/iopl access */ +/* Allow sending USB messages to any device via /proc/bus/usb */ + +#define CAP_SYS_RAWIO 17 + +/* Allow use of chroot() */ + +#define CAP_SYS_CHROOT 18 + +/* Allow ptrace() of any process */ + +#define CAP_SYS_PTRACE 19 + +/* Allow configuration of process accounting */ + +#define CAP_SYS_PACCT 20 + +/* Allow configuration of the secure attention key */ +/* Allow administration of the random device */ +/* Allow examination and configuration of disk quotas */ +/* Allow configuring the kernel's syslog (printk behaviour) */ +/* Allow setting the domainname */ +/* Allow setting the hostname */ +/* Allow calling bdflush() */ +/* Allow mount() and umount(), setting up new smb connection */ +/* Allow some autofs root ioctls */ +/* Allow nfsservctl */ +/* Allow VM86_REQUEST_IRQ */ +/* Allow to read/write pci config on alpha */ +/* Allow irix_prctl on mips (setstacksize) */ +/* Allow flushing all cache on m68k (sys_cacheflush) */ +/* Allow removing semaphores */ +/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores + and shared memory */ +/* Allow locking/unlocking of shared memory segment */ +/* Allow turning swap on/off */ +/* Allow forged pids on socket credentials passing */ +/* Allow setting readahead and flushing buffers on block devices */ +/* Allow setting geometry in floppy driver */ +/* Allow turning DMA on/off in xd driver */ +/* Allow administration of md devices (mostly the above, but some + extra ioctls) */ +/* Allow tuning the ide driver */ +/* Allow access to the nvram device */ +/* Allow administration of apm_bios, serial and bttv (TV) device */ +/* Allow manufacturer commands in isdn CAPI support driver */ +/* Allow reading non-standardized portions of pci configuration space */ +/* Allow DDI debug ioctl on sbpcd driver */ +/* Allow setting up serial ports */ +/* Allow sending raw qic-117 commands */ +/* Allow enabling/disabling tagged queuing on SCSI controllers and sending + arbitrary SCSI commands */ +/* Allow setting encryption key on loopback filesystem */ +/* Allow setting zone reclaim policy */ + +#define CAP_SYS_ADMIN 21 + +/* Allow use of reboot() */ + +#define CAP_SYS_BOOT 22 + +/* Allow raising priority and setting priority on other (different + UID) processes */ +/* Allow use of FIFO and round-robin (realtime) scheduling on own + processes and setting the scheduling algorithm used by another + process. */ +/* Allow setting cpu affinity on other processes */ + +#define CAP_SYS_NICE 23 + +/* Override resource limits. Set resource limits. */ +/* Override quota limits. */ +/* Override reserved space on ext2 filesystem */ +/* Modify data journaling mode on ext3 filesystem (uses journaling + resources) */ +/* NOTE: ext2 honors fsuid when checking for resource overrides, so + you can override using fsuid too */ +/* Override size restrictions on IPC message queues */ +/* Allow more than 64hz interrupts from the real-time clock */ +/* Override max number of consoles on console allocation */ +/* Override max number of keymaps */ + +#define CAP_SYS_RESOURCE 24 + +/* Allow manipulation of system clock */ +/* Allow irix_stime on mips */ +/* Allow setting the real-time clock */ + +#define CAP_SYS_TIME 25 + +/* Allow configuration of tty devices */ +/* Allow vhangup() of tty */ + +#define CAP_SYS_TTY_CONFIG 26 + +/* Allow the privileged aspects of mknod() */ + +#define CAP_MKNOD 27 + +/* Allow taking of leases on files */ + +#define CAP_LEASE 28 + +#define CAP_AUDIT_WRITE 29 + +#define CAP_AUDIT_CONTROL 30 + +#define CAP_SETFCAP 31 + +/* Override MAC access. + The base kernel enforces no MAC policy. + An LSM may enforce a MAC policy, and if it does and it chooses + to implement capability based overrides of that policy, this is + the capability it should use to do so. */ + +#define CAP_MAC_OVERRIDE 32 + +/* Allow MAC configuration or state changes. + The base kernel requires no MAC configuration. + An LSM may enforce a MAC policy, and if it does and it chooses + to implement capability based checks on modifications to that + policy or the data required to maintain it, this is the + capability it should use to do so. */ + +#define CAP_MAC_ADMIN 33 + +#define CAP_LAST_CAP CAP_MAC_ADMIN + +#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) + +/* + * Bit location of each capability (used by user-space library and kernel) + */ + +#define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */ +#define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */ + + +#endif /* !_LINUX_CAPABILITY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/capi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/capi.h new file mode 100644 index 0000000..2e00af4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/capi.h @@ -0,0 +1,131 @@ +/* $Id: capi.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ + * + * CAPI 2.0 Interface for Linux + * + * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#ifndef __LINUX_CAPI_H__ +#define __LINUX_CAPI_H__ + +#include +#include +#include + +/* + * CAPI_REGISTER + */ + +typedef struct capi_register_params { /* CAPI_REGISTER */ + __u32 level3cnt; /* No. of simulatneous user data connections */ + __u32 datablkcnt; /* No. of buffered data messages */ + __u32 datablklen; /* Size of buffered data messages */ +} capi_register_params; + +#define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params) + +/* + * CAPI_GET_MANUFACTURER + */ + +#define CAPI_MANUFACTURER_LEN 64 + +#define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) /* broken: wanted size 64 (CAPI_MANUFACTURER_LEN) */ + +/* + * CAPI_GET_VERSION + */ + +typedef struct capi_version { + __u32 majorversion; + __u32 minorversion; + __u32 majormanuversion; + __u32 minormanuversion; +} capi_version; + +#define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version) + +/* + * CAPI_GET_SERIAL + */ + +#define CAPI_SERIAL_LEN 8 +#define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */ + +/* + * CAPI_GET_PROFILE + */ + +typedef struct capi_profile { + __u16 ncontroller; /* number of installed controller */ + __u16 nbchannel; /* number of B-Channels */ + __u32 goptions; /* global options */ + __u32 support1; /* B1 protocols support */ + __u32 support2; /* B2 protocols support */ + __u32 support3; /* B3 protocols support */ + __u32 reserved[6]; /* reserved */ + __u32 manu[5]; /* manufacturer specific information */ +} capi_profile; + +#define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile) + +typedef struct capi_manufacturer_cmd { + unsigned long cmd; + void *data; +} capi_manufacturer_cmd; + +/* + * CAPI_MANUFACTURER_CMD + */ + +#define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd) + +/* + * CAPI_GET_ERRCODE + * capi errcode is set, * if read, write, or ioctl returns EIO, + * ioctl returns errcode directly, and in arg, if != 0 + */ + +#define CAPI_GET_ERRCODE _IOR('C',0x21, __u16) + +/* + * CAPI_INSTALLED + */ +#define CAPI_INSTALLED _IOR('C',0x22, __u16) + + +/* + * member contr is input for + * CAPI_GET_MANUFACTURER, CAPI_VERSION, CAPI_GET_SERIAL + * and CAPI_GET_PROFILE + */ +typedef union capi_ioctl_struct { + __u32 contr; + capi_register_params rparams; + __u8 manufacturer[CAPI_MANUFACTURER_LEN]; + capi_version version; + __u8 serial[CAPI_SERIAL_LEN]; + capi_profile profile; + capi_manufacturer_cmd cmd; + __u16 errcode; +} capi_ioctl_struct; + +/* + * Middleware extension + */ + +#define CAPIFLAG_HIGHJACKING 0x0001 + +#define CAPI_GET_FLAGS _IOR('C',0x23, unsigned) +#define CAPI_SET_FLAGS _IOR('C',0x24, unsigned) +#define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned) + +#define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned) + +#define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned) + +#endif /* __LINUX_CAPI_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cciss_ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cciss_ioctl.h new file mode 100644 index 0000000..7cbbecb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cciss_ioctl.h @@ -0,0 +1,214 @@ +#ifndef CCISS_IOCTLH +#define CCISS_IOCTLH + +#include +#include + +#define CCISS_IOC_MAGIC 'B' + + +typedef struct _cciss_pci_info_struct +{ + unsigned char bus; + unsigned char dev_fn; + unsigned short domain; + __u32 board_id; +} cciss_pci_info_struct; + +typedef struct _cciss_coalint_struct +{ + __u32 delay; + __u32 count; +} cciss_coalint_struct; + +typedef char NodeName_type[16]; + +typedef __u32 Heartbeat_type; + +#define CISS_PARSCSIU2 0x0001 +#define CISS_PARCSCIU3 0x0002 +#define CISS_FIBRE1G 0x0100 +#define CISS_FIBRE2G 0x0200 +typedef __u32 BusTypes_type; + +typedef char FirmwareVer_type[4]; +typedef __u32 DriverVer_type; + +#define MAX_KMALLOC_SIZE 128000 + +#ifndef CCISS_CMD_H +// This defines are duplicated in cciss_cmd.h in the driver directory + +//general boundary defintions +#define SENSEINFOBYTES 32//note that this value may vary between host implementations + +//Command Status value +#define CMD_SUCCESS 0x0000 +#define CMD_TARGET_STATUS 0x0001 +#define CMD_DATA_UNDERRUN 0x0002 +#define CMD_DATA_OVERRUN 0x0003 +#define CMD_INVALID 0x0004 +#define CMD_PROTOCOL_ERR 0x0005 +#define CMD_HARDWARE_ERR 0x0006 +#define CMD_CONNECTION_LOST 0x0007 +#define CMD_ABORTED 0x0008 +#define CMD_ABORT_FAILED 0x0009 +#define CMD_UNSOLICITED_ABORT 0x000A +#define CMD_TIMEOUT 0x000B +#define CMD_UNABORTABLE 0x000C + +//transfer direction +#define XFER_NONE 0x00 +#define XFER_WRITE 0x01 +#define XFER_READ 0x02 +#define XFER_RSVD 0x03 + +//task attribute +#define ATTR_UNTAGGED 0x00 +#define ATTR_SIMPLE 0x04 +#define ATTR_HEADOFQUEUE 0x05 +#define ATTR_ORDERED 0x06 +#define ATTR_ACA 0x07 + +//cdb type +#define TYPE_CMD 0x00 +#define TYPE_MSG 0x01 + +// Type defs used in the following structs +#define BYTE __u8 +#define WORD __u16 +#define HWORD __u16 +#define DWORD __u32 + +#define CISS_MAX_LUN 1024 + +#define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping +#define LEVEL3LUN 0 + +#pragma pack(1) + +//Command List Structure +typedef union _SCSI3Addr_struct { + struct { + BYTE Dev; + BYTE Bus:6; + BYTE Mode:2; // b00 + } PeripDev; + struct { + BYTE DevLSB; + BYTE DevMSB:6; + BYTE Mode:2; // b01 + } LogDev; + struct { + BYTE Dev:5; + BYTE Bus:3; + BYTE Targ:6; + BYTE Mode:2; // b10 + } LogUnit; +} SCSI3Addr_struct; + +typedef struct _PhysDevAddr_struct { + DWORD TargetId:24; + DWORD Bus:6; + DWORD Mode:2; + SCSI3Addr_struct Target[2]; //2 level target device addr +} PhysDevAddr_struct; + +typedef struct _LogDevAddr_struct { + DWORD VolId:30; + DWORD Mode:2; + BYTE reserved[4]; +} LogDevAddr_struct; + +typedef union _LUNAddr_struct { + BYTE LunAddrBytes[8]; + SCSI3Addr_struct SCSI3Lun[4]; + PhysDevAddr_struct PhysDev; + LogDevAddr_struct LogDev; +} LUNAddr_struct; + +typedef struct _RequestBlock_struct { + BYTE CDBLen; + struct { + BYTE Type:3; + BYTE Attribute:3; + BYTE Direction:2; + } Type; + HWORD Timeout; + BYTE CDB[16]; +} RequestBlock_struct; + +typedef union _MoreErrInfo_struct{ + struct { + BYTE Reserved[3]; + BYTE Type; + DWORD ErrorInfo; + }Common_Info; + struct{ + BYTE Reserved[2]; + BYTE offense_size;//size of offending entry + BYTE offense_num; //byte # of offense 0-base + DWORD offense_value; + }Invalid_Cmd; +}MoreErrInfo_struct; +typedef struct _ErrorInfo_struct { + BYTE ScsiStatus; + BYTE SenseLen; + HWORD CommandStatus; + DWORD ResidualCnt; + MoreErrInfo_struct MoreErrInfo; + BYTE SenseInfo[SENSEINFOBYTES]; +} ErrorInfo_struct; + +#pragma pack() +#endif /* CCISS_CMD_H */ + +typedef struct _IOCTL_Command_struct { + LUNAddr_struct LUN_info; + RequestBlock_struct Request; + ErrorInfo_struct error_info; + WORD buf_size; /* size in bytes of the buf */ + BYTE *buf; +} IOCTL_Command_struct; + +typedef struct _BIG_IOCTL_Command_struct { + LUNAddr_struct LUN_info; + RequestBlock_struct Request; + ErrorInfo_struct error_info; + DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ + DWORD buf_size; /* size in bytes of the buf */ + /* < malloc_size * MAXSGENTRIES */ + BYTE *buf; +} BIG_IOCTL_Command_struct; + +typedef struct _LogvolInfo_struct{ + __u32 LunID; + int num_opens; /* number of opens on the logical volume */ + int num_parts; /* number of partitions configured on logvol */ +} LogvolInfo_struct; + +#define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct) + +#define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct) +#define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct) + +#define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type) +#define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type) + +#define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type) +#define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type) +#define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type) +#define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type) +#define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10) +#define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct) +#define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12) + +/* no longer used... use REGNEWD instead */ +#define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int) + +#define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14) +#define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16) +#define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct) +#define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cdk.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cdk.h new file mode 100644 index 0000000..0908daf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cdk.h @@ -0,0 +1,486 @@ +/*****************************************************************************/ + +/* + * cdk.h -- CDK interface definitions. + * + * Copyright (C) 1996-1998 Stallion Technologies + * Copyright (C) 1994-1996 Greg Ungerer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ +#ifndef _CDK_H +#define _CDK_H +/*****************************************************************************/ + +#pragma pack(2) + +/* + * The following set of definitions is used to communicate with the + * shared memory interface of the Stallion intelligent multiport serial + * boards. The definitions in this file are taken directly from the + * document titled "Generic Stackable Interface, Downloader and + * Communications Development Kit". + */ + +/* + * Define the set of important shared memory addresses. These are + * required to initialize the board and get things started. All of these + * addresses are relative to the start of the shared memory. + */ +#define CDK_SIGADDR 0x200 +#define CDK_FEATADDR 0x280 +#define CDK_CDKADDR 0x300 +#define CDK_RDYADDR 0x262 + +#define CDK_ALIVEMARKER 13 + +/* + * On hardware power up the ROMs located on the EasyConnection 8/64 will + * fill out the following signature information into shared memory. This + * way the host system can quickly determine that the board is present + * and is operational. + */ +typedef struct cdkecpsig { + unsigned long magic; + unsigned short romver; + unsigned short cputype; + unsigned char panelid[8]; +} cdkecpsig_t; + +#define ECP_MAGIC 0x21504345 + +/* + * On hardware power up the ROMs located on the ONboard, Stallion and + * Brumbys will fill out the following signature information into shared + * memory. This way the host system can quickly determine that the board + * is present and is operational. + */ +typedef struct cdkonbsig { + unsigned short magic0; + unsigned short magic1; + unsigned short magic2; + unsigned short magic3; + unsigned short romver; + unsigned short memoff; + unsigned short memseg; + unsigned short amask0; + unsigned short pic; + unsigned short status; + unsigned short btype; + unsigned short clkticks; + unsigned short clkspeed; + unsigned short amask1; + unsigned short amask2; +} cdkonbsig_t; + +#define ONB_MAGIC0 0xf2a7 +#define ONB_MAGIC1 0xa149 +#define ONB_MAGIC2 0x6352 +#define ONB_MAGIC3 0xf121 + +/* + * Define the feature area structure. The feature area is the set of + * startup parameters used by the slave image when it starts executing. + * They allow for the specification of buffer sizes, debug trace, etc. + */ +typedef struct cdkfeature { + unsigned long debug; + unsigned long banner; + unsigned long etype; + unsigned long nrdevs; + unsigned long brdspec; + unsigned long txrqsize; + unsigned long rxrqsize; + unsigned long flags; +} cdkfeature_t; + +#define ETYP_DDK 0 +#define ETYP_CDK 1 + +/* + * Define the CDK header structure. This is the info that the slave + * environment sets up after it has been downloaded and started. It + * essentially provides a memory map for the shared memory interface. + */ +typedef struct cdkhdr { + unsigned short command; + unsigned short status; + unsigned short port; + unsigned short mode; + unsigned long cmd_buf[14]; + unsigned short alive_cnt; + unsigned short intrpt_mode; + unsigned char intrpt_id[8]; + unsigned char ver_release; + unsigned char ver_modification; + unsigned char ver_fix; + unsigned char deadman_restart; + unsigned short deadman; + unsigned short nrdevs; + unsigned long memp; + unsigned long hostp; + unsigned long slavep; + unsigned char hostreq; + unsigned char slavereq; + unsigned char cmd_reserved[30]; +} cdkhdr_t; + +#define MODE_DDK 0 +#define MODE_CDK 1 + +#define IMD_INTR 0x0 +#define IMD_PPINTR 0x1 +#define IMD_POLL 0xff + +/* + * Define the memory mapping structure. This structure is pointed to by + * the memp field in the stlcdkhdr struct. As many as these structures + * as required are layed out in shared memory to define how the rest of + * shared memory is divided up. There will be one for each port. + */ +typedef struct cdkmem { + unsigned short dtype; + unsigned long offset; +} cdkmem_t; + +#define TYP_UNDEFINED 0x0 +#define TYP_ASYNCTRL 0x1 +#define TYP_ASYNC 0x20 +#define TYP_PARALLEL 0x40 +#define TYP_SYNCX21 0x60 + +/*****************************************************************************/ + +/* + * Following is a set of defines and structures used to actually deal + * with the serial ports on the board. Firstly is the set of commands + * that can be applied to ports. + */ +#define ASYCMD (((unsigned long) 'a') << 8) + +#define A_NULL (ASYCMD | 0) +#define A_FLUSH (ASYCMD | 1) +#define A_BREAK (ASYCMD | 2) +#define A_GETPORT (ASYCMD | 3) +#define A_SETPORT (ASYCMD | 4) +#define A_SETPORTF (ASYCMD | 5) +#define A_SETPORTFTX (ASYCMD | 6) +#define A_SETPORTFRX (ASYCMD | 7) +#define A_GETSIGNALS (ASYCMD | 8) +#define A_SETSIGNALS (ASYCMD | 9) +#define A_SETSIGNALSF (ASYCMD | 10) +#define A_SETSIGNALSFTX (ASYCMD | 11) +#define A_SETSIGNALSFRX (ASYCMD | 12) +#define A_GETNOTIFY (ASYCMD | 13) +#define A_SETNOTIFY (ASYCMD | 14) +#define A_NOTIFY (ASYCMD | 15) +#define A_PORTCTRL (ASYCMD | 16) +#define A_GETSTATS (ASYCMD | 17) +#define A_RQSTATE (ASYCMD | 18) +#define A_FLOWSTATE (ASYCMD | 19) +#define A_CLEARSTATS (ASYCMD | 20) + +/* + * Define those arguments used for simple commands. + */ +#define FLUSHRX 0x1 +#define FLUSHTX 0x2 + +#define BREAKON -1 +#define BREAKOFF -2 + +/* + * Define the port setting structure, and all those defines that go along + * with it. Basically this structure defines the characteristics of this + * port: baud rate, chars, parity, input/output char cooking etc. + */ +typedef struct asyport { + unsigned long baudout; + unsigned long baudin; + unsigned long iflag; + unsigned long oflag; + unsigned long lflag; + unsigned long pflag; + unsigned long flow; + unsigned long spare1; + unsigned short vtime; + unsigned short vmin; + unsigned short txlo; + unsigned short txhi; + unsigned short rxlo; + unsigned short rxhi; + unsigned short rxhog; + unsigned short spare2; + unsigned char csize; + unsigned char stopbs; + unsigned char parity; + unsigned char stopin; + unsigned char startin; + unsigned char stopout; + unsigned char startout; + unsigned char parmark; + unsigned char brkmark; + unsigned char cc[11]; +} asyport_t; + +#define PT_STOP1 0x0 +#define PT_STOP15 0x1 +#define PT_STOP2 0x2 + +#define PT_NOPARITY 0x0 +#define PT_ODDPARITY 0x1 +#define PT_EVENPARITY 0x2 +#define PT_MARKPARITY 0x3 +#define PT_SPACEPARITY 0x4 + +#define F_NONE 0x0 +#define F_IXON 0x1 +#define F_IXOFF 0x2 +#define F_IXANY 0x4 +#define F_IOXANY 0x8 +#define F_RTSFLOW 0x10 +#define F_CTSFLOW 0x20 +#define F_DTRFLOW 0x40 +#define F_DCDFLOW 0x80 +#define F_DSROFLOW 0x100 +#define F_DSRIFLOW 0x200 + +#define FI_NORX 0x1 +#define FI_RAW 0x2 +#define FI_ISTRIP 0x4 +#define FI_UCLC 0x8 +#define FI_INLCR 0x10 +#define FI_ICRNL 0x20 +#define FI_IGNCR 0x40 +#define FI_IGNBREAK 0x80 +#define FI_DSCRDBREAK 0x100 +#define FI_1MARKBREAK 0x200 +#define FI_2MARKBREAK 0x400 +#define FI_XCHNGBREAK 0x800 +#define FI_IGNRXERRS 0x1000 +#define FI_DSCDRXERRS 0x2000 +#define FI_1MARKRXERRS 0x4000 +#define FI_2MARKRXERRS 0x8000 +#define FI_XCHNGRXERRS 0x10000 +#define FI_DSCRDNULL 0x20000 + +#define FO_OLCUC 0x1 +#define FO_ONLCR 0x2 +#define FO_OOCRNL 0x4 +#define FO_ONOCR 0x8 +#define FO_ONLRET 0x10 +#define FO_ONL 0x20 +#define FO_OBS 0x40 +#define FO_OVT 0x80 +#define FO_OFF 0x100 +#define FO_OTAB1 0x200 +#define FO_OTAB2 0x400 +#define FO_OTAB3 0x800 +#define FO_OCR1 0x1000 +#define FO_OCR2 0x2000 +#define FO_OCR3 0x4000 +#define FO_OFILL 0x8000 +#define FO_ODELL 0x10000 + +#define P_RTSLOCK 0x1 +#define P_CTSLOCK 0x2 +#define P_MAPRTS 0x4 +#define P_MAPCTS 0x8 +#define P_LOOPBACK 0x10 +#define P_DTRFOLLOW 0x20 +#define P_FAKEDCD 0x40 + +#define P_RXIMIN 0x10000 +#define P_RXITIME 0x20000 +#define P_RXTHOLD 0x40000 + +/* + * Define a structure to communicate serial port signal and data state + * information. + */ +typedef struct asysigs { + unsigned long data; + unsigned long signal; + unsigned long sigvalue; +} asysigs_t; + +#define DT_TXBUSY 0x1 +#define DT_TXEMPTY 0x2 +#define DT_TXLOW 0x4 +#define DT_TXHIGH 0x8 +#define DT_TXFULL 0x10 +#define DT_TXHOG 0x20 +#define DT_TXFLOWED 0x40 +#define DT_TXBREAK 0x80 + +#define DT_RXBUSY 0x100 +#define DT_RXEMPTY 0x200 +#define DT_RXLOW 0x400 +#define DT_RXHIGH 0x800 +#define DT_RXFULL 0x1000 +#define DT_RXHOG 0x2000 +#define DT_RXFLOWED 0x4000 +#define DT_RXBREAK 0x8000 + +#define SG_DTR 0x1 +#define SG_DCD 0x2 +#define SG_RTS 0x4 +#define SG_CTS 0x8 +#define SG_DSR 0x10 +#define SG_RI 0x20 + +/* + * Define the notification setting structure. This is used to tell the + * port what events we want to be informed about. Fields here use the + * same defines as for the asysigs structure above. + */ +typedef struct asynotify { + unsigned long ctrl; + unsigned long data; + unsigned long signal; + unsigned long sigvalue; +} asynotify_t; + +/* + * Define the port control structure. It is used to do fine grain + * control operations on the port. + */ +typedef struct { + unsigned long rxctrl; + unsigned long txctrl; + char rximdch; + char tximdch; + char spare1; + char spare2; +} asyctrl_t; + +#define CT_ENABLE 0x1 +#define CT_DISABLE 0x2 +#define CT_STOP 0x4 +#define CT_START 0x8 +#define CT_STARTFLOW 0x10 +#define CT_STOPFLOW 0x20 +#define CT_SENDCHR 0x40 + +/* + * Define the stats structure kept for each port. This is a useful set + * of data collected for each port on the slave. The A_GETSTATS command + * is used to retrieve this data from the slave. + */ +typedef struct asystats { + unsigned long opens; + unsigned long txchars; + unsigned long rxchars; + unsigned long txringq; + unsigned long rxringq; + unsigned long txmsgs; + unsigned long rxmsgs; + unsigned long txflushes; + unsigned long rxflushes; + unsigned long overruns; + unsigned long framing; + unsigned long parity; + unsigned long ringover; + unsigned long lost; + unsigned long rxstart; + unsigned long rxstop; + unsigned long txstart; + unsigned long txstop; + unsigned long dcdcnt; + unsigned long dtrcnt; + unsigned long ctscnt; + unsigned long rtscnt; + unsigned long dsrcnt; + unsigned long ricnt; + unsigned long txbreaks; + unsigned long rxbreaks; + unsigned long signals; + unsigned long state; + unsigned long hwid; +} asystats_t; + +/*****************************************************************************/ + +/* + * All command and control communication with a device on the slave is + * via a control block in shared memory. Each device has its own control + * block, defined by the following structure. The control block allows + * the host to open, close and control the device on the slave. + */ +typedef struct cdkctrl { + unsigned char open; + unsigned char close; + unsigned long openarg; + unsigned long closearg; + unsigned long cmd; + unsigned long status; + unsigned long args[32]; +} cdkctrl_t; + +/* + * Each device on the slave passes data to and from the host via a ring + * queue in shared memory. Define a ring queue structure to hold the + * vital information about each ring queue. Two ring queues will be + * allocated for each port, one for receive data and one for transmit + * data. + */ +typedef struct cdkasyrq { + unsigned long offset; + unsigned short size; + unsigned short head; + unsigned short tail; +} cdkasyrq_t; + +/* + * Each asynchronous port is defined in shared memory by the following + * structure. It contains a control block to command a device, and also + * the necessary data channel information as well. + */ +typedef struct cdkasy { + cdkctrl_t ctrl; + unsigned short notify; + asynotify_t changed; + unsigned short receive; + cdkasyrq_t rxq; + unsigned short transmit; + cdkasyrq_t txq; +} cdkasy_t; + +#pragma pack() + +/*****************************************************************************/ + +/* + * Define the set of ioctls used by the driver to do special things + * to the board. These include interrupting it, and initializing + * the driver after board startup and shutdown. + */ +#include + +#define STL_BINTR _IO('s',20) +#define STL_BSTART _IO('s',21) +#define STL_BSTOP _IO('s',22) +#define STL_BRESET _IO('s',23) + +/* + * Define a set of ioctl extensions, used to get at special stuff. + */ +#define STL_GETPFLAG _IO('s',80) +#define STL_SETPFLAG _IO('s',81) + +/*****************************************************************************/ +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cdrom.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cdrom.h new file mode 100644 index 0000000..8adcaf1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cdrom.h @@ -0,0 +1,912 @@ +/* + * -- + * General header file for linux CD-ROM drivers + * Copyright (C) 1992 David Giller, rafetmad@oxy.edu + * 1994, 1995 Eberhard Mönkeberg, emoenke@gwdg.de + * 1996 David van Leeuwen, david@tm.tno.nl + * 1997, 1998 Erik Andersen, andersee@debian.org + * 1998-2002 Jens Axboe, axboe@suse.de + */ + +#ifndef _LINUX_CDROM_H +#define _LINUX_CDROM_H + +#include +#include + +/******************************************************* + * As of Linux 2.1.x, all Linux CD-ROM application programs will use this + * (and only this) include file. It is my hope to provide Linux with + * a uniform interface between software accessing CD-ROMs and the various + * device drivers that actually talk to the drives. There may still be + * 23 different kinds of strange CD-ROM drives, but at least there will + * now be one, and only one, Linux CD-ROM interface. + * + * Additionally, as of Linux 2.1.x, all Linux application programs + * should use the O_NONBLOCK option when opening a CD-ROM device + * for subsequent ioctl commands. This allows for neat system errors + * like "No medium found" or "Wrong medium type" upon attempting to + * mount or play an empty slot, mount an audio disc, or play a data disc. + * Generally, changing an application program to support O_NONBLOCK + * is as easy as the following: + * - drive = open("/dev/cdrom", O_RDONLY); + * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); + * It is worth the small change. + * + * Patches for many common CD programs (provided by David A. van Leeuwen) + * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ + * + *******************************************************/ + +/* When a driver supports a certain function, but the cdrom drive we are + * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will + * borrow the "Operation not supported" error from the network folks to + * accomplish this. Maybe someday we will get a more targeted error code, + * but this will do for now... */ +#define EDRIVE_CANT_DO_THIS EOPNOTSUPP + +/******************************************************* + * The CD-ROM IOCTL commands -- these should be supported by + * all the various cdrom drivers. For the CD-ROM ioctls, we + * will commandeer byte 0x53, or 'S'. + *******************************************************/ +#define CDROMPAUSE 0x5301 /* Pause Audio Operation */ +#define CDROMRESUME 0x5302 /* Resume paused Audio Operation */ +#define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ +#define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index + (struct cdrom_ti) */ +#define CDROMREADTOCHDR 0x5305 /* Read TOC header + (struct cdrom_tochdr) */ +#define CDROMREADTOCENTRY 0x5306 /* Read TOC entry + (struct cdrom_tocentry) */ +#define CDROMSTOP 0x5307 /* Stop the cdrom drive */ +#define CDROMSTART 0x5308 /* Start the cdrom drive */ +#define CDROMEJECT 0x5309 /* Ejects the cdrom media */ +#define CDROMVOLCTRL 0x530a /* Control output volume + (struct cdrom_volctrl) */ +#define CDROMSUBCHNL 0x530b /* Read subchannel data + (struct cdrom_subchnl) */ +#define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) + (struct cdrom_read) */ +#define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) + (struct cdrom_read) */ +#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ +#define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ +#define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session + address of multi session disks + (struct cdrom_multisession) */ +#define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" + if available (struct cdrom_mcn) */ +#define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated, + but here anyway for compatibility */ +#define CDROMRESET 0x5312 /* hard-reset the drive */ +#define CDROMVOLREAD 0x5313 /* Get the drive's volume setting + (struct cdrom_volctrl) */ +#define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) + (struct cdrom_read) */ +/* + * These ioctls are used only used in aztcd.c and optcd.c + */ +#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */ +#define CDROMSEEK 0x5316 /* seek msf address */ + +/* + * This ioctl is only used by the scsi-cd driver. + It is for playing audio in logical block addressing mode. + */ +#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ + +/* + * These ioctls are only used in optcd.c + */ +#define CDROMREADALL 0x5318 /* read all 2646 bytes */ + +/* + * These ioctls are (now) only in ide-cd.c for controlling + * drive spindown time. They should be implemented in the + * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, + * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... + * -Erik + */ +#define CDROMGETSPINDOWN 0x531d +#define CDROMSETSPINDOWN 0x531e + +/* + * These ioctls are implemented through the uniform CD-ROM driver + * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM + * drivers are eventually ported to the uniform CD-ROM driver interface. + */ +#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ +#define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ +#define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ +#define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ +#define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ +#define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ +#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ +#define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ +#define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ +#define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ +#define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ +#define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ + +/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. + * Future CDROM ioctls should be kept below 0x537F + */ + +/* This ioctl is only used by sbpcd at the moment */ +#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ + /* conflict with SCSI_IOCTL_GET_IDLUN */ + +/* DVD-ROM Specific ioctls */ +#define DVD_READ_STRUCT 0x5390 /* Read structure */ +#define DVD_WRITE_STRUCT 0x5391 /* Write structure */ +#define DVD_AUTH 0x5392 /* Authentication */ + +#define CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ +#define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ +#define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ + +/******************************************************* + * CDROM IOCTL structures + *******************************************************/ + +/* Address in MSF format */ +struct cdrom_msf0 +{ + __u8 minute; + __u8 second; + __u8 frame; +}; + +/* Address in either MSF or logical format */ +union cdrom_addr +{ + struct cdrom_msf0 msf; + int lba; +}; + +/* This struct is used by the CDROMPLAYMSF ioctl */ +struct cdrom_msf +{ + __u8 cdmsf_min0; /* start minute */ + __u8 cdmsf_sec0; /* start second */ + __u8 cdmsf_frame0; /* start frame */ + __u8 cdmsf_min1; /* end minute */ + __u8 cdmsf_sec1; /* end second */ + __u8 cdmsf_frame1; /* end frame */ +}; + +/* This struct is used by the CDROMPLAYTRKIND ioctl */ +struct cdrom_ti +{ + __u8 cdti_trk0; /* start track */ + __u8 cdti_ind0; /* start index */ + __u8 cdti_trk1; /* end track */ + __u8 cdti_ind1; /* end index */ +}; + +/* This struct is used by the CDROMREADTOCHDR ioctl */ +struct cdrom_tochdr +{ + __u8 cdth_trk0; /* start track */ + __u8 cdth_trk1; /* end track */ +}; + +/* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ +struct cdrom_volctrl +{ + __u8 channel0; + __u8 channel1; + __u8 channel2; + __u8 channel3; +}; + +/* This struct is used by the CDROMSUBCHNL ioctl */ +struct cdrom_subchnl +{ + __u8 cdsc_format; + __u8 cdsc_audiostatus; + __u8 cdsc_adr: 4; + __u8 cdsc_ctrl: 4; + __u8 cdsc_trk; + __u8 cdsc_ind; + union cdrom_addr cdsc_absaddr; + union cdrom_addr cdsc_reladdr; +}; + + +/* This struct is used by the CDROMREADTOCENTRY ioctl */ +struct cdrom_tocentry +{ + __u8 cdte_track; + __u8 cdte_adr :4; + __u8 cdte_ctrl :4; + __u8 cdte_format; + union cdrom_addr cdte_addr; + __u8 cdte_datamode; +}; + +/* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ +struct cdrom_read +{ + int cdread_lba; + char *cdread_bufaddr; + int cdread_buflen; +}; + +/* This struct is used by the CDROMREADAUDIO ioctl */ +struct cdrom_read_audio +{ + union cdrom_addr addr; /* frame address */ + __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ + int nframes; /* number of 2352-byte-frames to read at once */ + __u8 *buf; /* frame buffer (size: nframes*2352 bytes) */ +}; + +/* This struct is used with the CDROMMULTISESSION ioctl */ +struct cdrom_multisession +{ + union cdrom_addr addr; /* frame address: start-of-last-session + (not the new "frame 16"!). Only valid + if the "xa_flag" is true. */ + __u8 xa_flag; /* 1: "is XA disk" */ + __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ +}; + +/* This struct is used with the CDROM_GET_MCN ioctl. + * Very few audio discs actually have Universal Product Code information, + * which should just be the Medium Catalog Number on the box. Also note + * that the way the codeis written on CD is _not_ uniform across all discs! + */ +struct cdrom_mcn +{ + __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ +}; + +/* This is used by the CDROMPLAYBLK ioctl */ +struct cdrom_blk +{ + unsigned from; + unsigned short len; +}; + +#define CDROM_PACKET_SIZE 12 + +#define CGC_DATA_UNKNOWN 0 +#define CGC_DATA_WRITE 1 +#define CGC_DATA_READ 2 +#define CGC_DATA_NONE 3 + +/* for CDROM_PACKET_COMMAND ioctl */ +struct cdrom_generic_command +{ + unsigned char cmd[CDROM_PACKET_SIZE]; + unsigned char *buffer; + unsigned int buflen; + int stat; + struct request_sense *sense; + unsigned char data_direction; + int quiet; + int timeout; + void *reserved[1]; /* unused, actually */ +}; + +/* + * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, + * 2340, or 2352 bytes long. + +* Sector types of the standard CD-ROM data formats: + * + * format sector type user data size (bytes) + * ----------------------------------------------------------------------------- + * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW) + * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE) + * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0) + * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE) + * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) + * + * + * The layout of the standard CD-ROM data formats: + * ----------------------------------------------------------------------------- + * - audio (red): | audio_sample_bytes | + * | 2352 | + * + * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | + * | 12 - 4 - 2048 - 4 - 8 - 276 | + * + * - data (yellow, mode2): | sync - head - data | + * | 12 - 4 - 2336 | + * + * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | + * | 12 - 4 - 8 - 2048 - 4 - 276 | + * + * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | + * | 12 - 4 - 8 - 2324 - 4 | + * + */ + +/* Some generally useful CD-ROM information -- mostly based on the above */ +#define CD_MINS 74 /* max. minutes per CD, not really a limit */ +#define CD_SECS 60 /* seconds per minute */ +#define CD_FRAMES 75 /* frames per second */ +#define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ +#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ +#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ +#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ +#define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ +#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ +#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ +#define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ +#define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ +#define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ +#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ +#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ +#define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ +/* most drives don't deliver everything: */ +#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ +#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ + +#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ +#define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ +#define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */ + +/* CD-ROM address types (cdrom_tocentry.cdte_format) */ +#define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ +#define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ + +/* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ +#define CDROM_DATA_TRACK 0x04 + +/* The leadout track is always 0xAA, regardless of # of tracks on disc */ +#define CDROM_LEADOUT 0xAA + +/* audio states (from SCSI-2, but seen with other drives, too) */ +#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ +#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ +#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ +#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ +#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ +#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ + +/* capability flags used with the uniform CD-ROM driver */ +#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ +#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ +#define CDC_LOCK 0x4 /* disable manual eject */ +#define CDC_SELECT_SPEED 0x8 /* programmable speed */ +#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ +#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ +#define CDC_MCN 0x40 /* Medium Catalog Number */ +#define CDC_MEDIA_CHANGED 0x80 /* media changed */ +#define CDC_PLAY_AUDIO 0x100 /* audio functions */ +#define CDC_RESET 0x200 /* hard reset device */ +#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ +#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ +#define CDC_CD_R 0x2000 /* drive is a CD-R */ +#define CDC_CD_RW 0x4000 /* drive is a CD-RW */ +#define CDC_DVD 0x8000 /* drive is a DVD */ +#define CDC_DVD_R 0x10000 /* drive can write DVD-R */ +#define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */ +#define CDC_MO_DRIVE 0x40000 /* drive is an MO device */ +#define CDC_MRW 0x80000 /* drive can read MRW */ +#define CDC_MRW_W 0x100000 /* drive can write MRW */ +#define CDC_RAM 0x200000 /* ok to open for WRITE */ + +/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ +#define CDS_NO_INFO 0 /* if not implemented */ +#define CDS_NO_DISC 1 +#define CDS_TRAY_OPEN 2 +#define CDS_DRIVE_NOT_READY 3 +#define CDS_DISC_OK 4 + +/* return values for the CDROM_DISC_STATUS ioctl */ +/* can also return CDS_NO_[INFO|DISC], from above */ +#define CDS_AUDIO 100 +#define CDS_DATA_1 101 +#define CDS_DATA_2 102 +#define CDS_XA_2_1 103 +#define CDS_XA_2_2 104 +#define CDS_MIXED 105 + +/* User-configurable behavior options for the uniform CD-ROM driver */ +#define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ +#define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ +#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ +#define CDO_LOCK 0x8 /* lock tray on open files */ +#define CDO_CHECK_TYPE 0x10 /* check type on open for data */ + +/* Special codes used when specifying changer slots. */ +#define CDSL_NONE (INT_MAX-1) +#define CDSL_CURRENT INT_MAX + +/* For partition based multisession access. IDE can handle 64 partitions + * per drive - SCSI CD-ROM's use minors to differentiate between the + * various drives, so we can't do multisessions the same way there. + * Use the -o session=x option to mount on them. + */ +#define CD_PART_MAX 64 +#define CD_PART_MASK (CD_PART_MAX - 1) + +/********************************************************************* + * Generic Packet commands, MMC commands, and such + *********************************************************************/ + + /* The generic packet command opcodes for CD/DVD Logical Units, + * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ +#define GPCMD_BLANK 0xa1 +#define GPCMD_CLOSE_TRACK 0x5b +#define GPCMD_FLUSH_CACHE 0x35 +#define GPCMD_FORMAT_UNIT 0x04 +#define GPCMD_GET_CONFIGURATION 0x46 +#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a +#define GPCMD_GET_PERFORMANCE 0xac +#define GPCMD_INQUIRY 0x12 +#define GPCMD_LOAD_UNLOAD 0xa6 +#define GPCMD_MECHANISM_STATUS 0xbd +#define GPCMD_MODE_SELECT_10 0x55 +#define GPCMD_MODE_SENSE_10 0x5a +#define GPCMD_PAUSE_RESUME 0x4b +#define GPCMD_PLAY_AUDIO_10 0x45 +#define GPCMD_PLAY_AUDIO_MSF 0x47 +#define GPCMD_PLAY_AUDIO_TI 0x48 +#define GPCMD_PLAY_CD 0xbc +#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e +#define GPCMD_READ_10 0x28 +#define GPCMD_READ_12 0xa8 +#define GPCMD_READ_BUFFER 0x3c +#define GPCMD_READ_BUFFER_CAPACITY 0x5c +#define GPCMD_READ_CDVD_CAPACITY 0x25 +#define GPCMD_READ_CD 0xbe +#define GPCMD_READ_CD_MSF 0xb9 +#define GPCMD_READ_DISC_INFO 0x51 +#define GPCMD_READ_DVD_STRUCTURE 0xad +#define GPCMD_READ_FORMAT_CAPACITIES 0x23 +#define GPCMD_READ_HEADER 0x44 +#define GPCMD_READ_TRACK_RZONE_INFO 0x52 +#define GPCMD_READ_SUBCHANNEL 0x42 +#define GPCMD_READ_TOC_PMA_ATIP 0x43 +#define GPCMD_REPAIR_RZONE_TRACK 0x58 +#define GPCMD_REPORT_KEY 0xa4 +#define GPCMD_REQUEST_SENSE 0x03 +#define GPCMD_RESERVE_RZONE_TRACK 0x53 +#define GPCMD_SEND_CUE_SHEET 0x5d +#define GPCMD_SCAN 0xba +#define GPCMD_SEEK 0x2b +#define GPCMD_SEND_DVD_STRUCTURE 0xbf +#define GPCMD_SEND_EVENT 0xa2 +#define GPCMD_SEND_KEY 0xa3 +#define GPCMD_SEND_OPC 0x54 +#define GPCMD_SET_READ_AHEAD 0xa7 +#define GPCMD_SET_STREAMING 0xb6 +#define GPCMD_START_STOP_UNIT 0x1b +#define GPCMD_STOP_PLAY_SCAN 0x4e +#define GPCMD_TEST_UNIT_READY 0x00 +#define GPCMD_VERIFY_10 0x2f +#define GPCMD_WRITE_10 0x2a +#define GPCMD_WRITE_12 0xaa +#define GPCMD_WRITE_AND_VERIFY_10 0x2e +#define GPCMD_WRITE_BUFFER 0x3b +/* This is listed as optional in ATAPI 2.6, but is (curiously) + * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji + * Table 377 as an MMC command for SCSi devices though... Most ATAPI + * drives support it. */ +#define GPCMD_SET_SPEED 0xbb +/* This seems to be a SCSI specific CD-ROM opcode + * to play data at track/index */ +#define GPCMD_PLAYAUDIO_TI 0x48 +/* + * From MS Media Status Notification Support Specification. For + * older drives only. + */ +#define GPCMD_GET_MEDIA_STATUS 0xda + +/* Mode page codes for mode sense/set */ +#define GPMODE_VENDOR_PAGE 0x00 +#define GPMODE_R_W_ERROR_PAGE 0x01 +#define GPMODE_WRITE_PARMS_PAGE 0x05 +#define GPMODE_WCACHING_PAGE 0x08 +#define GPMODE_AUDIO_CTL_PAGE 0x0e +#define GPMODE_POWER_PAGE 0x1a +#define GPMODE_FAULT_FAIL_PAGE 0x1c +#define GPMODE_TO_PROTECT_PAGE 0x1d +#define GPMODE_CAPABILITIES_PAGE 0x2a +#define GPMODE_ALL_PAGES 0x3f +/* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor + * of MODE_SENSE_POWER_PAGE */ +#define GPMODE_CDROM_PAGE 0x0d + + + +/* DVD struct types */ +#define DVD_STRUCT_PHYSICAL 0x00 +#define DVD_STRUCT_COPYRIGHT 0x01 +#define DVD_STRUCT_DISCKEY 0x02 +#define DVD_STRUCT_BCA 0x03 +#define DVD_STRUCT_MANUFACT 0x04 + +struct dvd_layer { + __u8 book_version : 4; + __u8 book_type : 4; + __u8 min_rate : 4; + __u8 disc_size : 4; + __u8 layer_type : 4; + __u8 track_path : 1; + __u8 nlayers : 2; + __u8 track_density : 4; + __u8 linear_density : 4; + __u8 bca : 1; + __u32 start_sector; + __u32 end_sector; + __u32 end_sector_l0; +}; + +#define DVD_LAYERS 4 + +struct dvd_physical { + __u8 type; + __u8 layer_num; + struct dvd_layer layer[DVD_LAYERS]; +}; + +struct dvd_copyright { + __u8 type; + + __u8 layer_num; + __u8 cpst; + __u8 rmi; +}; + +struct dvd_disckey { + __u8 type; + + unsigned agid : 2; + __u8 value[2048]; +}; + +struct dvd_bca { + __u8 type; + + int len; + __u8 value[188]; +}; + +struct dvd_manufact { + __u8 type; + + __u8 layer_num; + int len; + __u8 value[2048]; +}; + +typedef union { + __u8 type; + + struct dvd_physical physical; + struct dvd_copyright copyright; + struct dvd_disckey disckey; + struct dvd_bca bca; + struct dvd_manufact manufact; +} dvd_struct; + +/* + * DVD authentication ioctl + */ + +/* Authentication states */ +#define DVD_LU_SEND_AGID 0 +#define DVD_HOST_SEND_CHALLENGE 1 +#define DVD_LU_SEND_KEY1 2 +#define DVD_LU_SEND_CHALLENGE 3 +#define DVD_HOST_SEND_KEY2 4 + +/* Termination states */ +#define DVD_AUTH_ESTABLISHED 5 +#define DVD_AUTH_FAILURE 6 + +/* Other functions */ +#define DVD_LU_SEND_TITLE_KEY 7 +#define DVD_LU_SEND_ASF 8 +#define DVD_INVALIDATE_AGID 9 +#define DVD_LU_SEND_RPC_STATE 10 +#define DVD_HOST_SEND_RPC_STATE 11 + +/* State data */ +typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */ +typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ + +struct dvd_lu_send_agid { + __u8 type; + unsigned agid : 2; +}; + +struct dvd_host_send_challenge { + __u8 type; + unsigned agid : 2; + + dvd_challenge chal; +}; + +struct dvd_send_key { + __u8 type; + unsigned agid : 2; + + dvd_key key; +}; + +struct dvd_lu_send_challenge { + __u8 type; + unsigned agid : 2; + + dvd_challenge chal; +}; + +#define DVD_CPM_NO_COPYRIGHT 0 +#define DVD_CPM_COPYRIGHTED 1 + +#define DVD_CP_SEC_NONE 0 +#define DVD_CP_SEC_EXIST 1 + +#define DVD_CGMS_UNRESTRICTED 0 +#define DVD_CGMS_SINGLE 2 +#define DVD_CGMS_RESTRICTED 3 + +struct dvd_lu_send_title_key { + __u8 type; + unsigned agid : 2; + + dvd_key title_key; + int lba; + unsigned cpm : 1; + unsigned cp_sec : 1; + unsigned cgms : 2; +}; + +struct dvd_lu_send_asf { + __u8 type; + unsigned agid : 2; + + unsigned asf : 1; +}; + +struct dvd_host_send_rpcstate { + __u8 type; + __u8 pdrc; +}; + +struct dvd_lu_send_rpcstate { + __u8 type : 2; + __u8 vra : 3; + __u8 ucca : 3; + __u8 region_mask; + __u8 rpc_scheme; +}; + +typedef union { + __u8 type; + + struct dvd_lu_send_agid lsa; + struct dvd_host_send_challenge hsc; + struct dvd_send_key lsk; + struct dvd_lu_send_challenge lsc; + struct dvd_send_key hsk; + struct dvd_lu_send_title_key lstk; + struct dvd_lu_send_asf lsasf; + struct dvd_host_send_rpcstate hrpcs; + struct dvd_lu_send_rpcstate lrpcs; +} dvd_authinfo; + +struct request_sense { +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 valid : 1; + __u8 error_code : 7; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 error_code : 7; + __u8 valid : 1; +#endif + __u8 segment_number; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 reserved1 : 2; + __u8 ili : 1; + __u8 reserved2 : 1; + __u8 sense_key : 4; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 sense_key : 4; + __u8 reserved2 : 1; + __u8 ili : 1; + __u8 reserved1 : 2; +#endif + __u8 information[4]; + __u8 add_sense_len; + __u8 command_info[4]; + __u8 asc; + __u8 ascq; + __u8 fruc; + __u8 sks[3]; + __u8 asb[46]; +}; + +/* + * feature profile + */ +#define CDF_RWRT 0x0020 /* "Random Writable" */ +#define CDF_HWDM 0x0024 /* "Hardware Defect Management" */ +#define CDF_MRW 0x0028 + +/* + * media status bits + */ +#define CDM_MRW_NOTMRW 0 +#define CDM_MRW_BGFORMAT_INACTIVE 1 +#define CDM_MRW_BGFORMAT_ACTIVE 2 +#define CDM_MRW_BGFORMAT_COMPLETE 3 + +/* + * mrw address spaces + */ +#define MRW_LBA_DMA 0 +#define MRW_LBA_GAA 1 + +/* + * mrw mode pages (first is deprecated) -- probed at init time and + * cdi->mrw_mode_page is set + */ +#define MRW_MODE_PC_PRE1 0x2c +#define MRW_MODE_PC 0x03 + +struct mrw_feature_desc { + __be16 feature_code; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 reserved1 : 2; + __u8 feature_version : 4; + __u8 persistent : 1; + __u8 curr : 1; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 curr : 1; + __u8 persistent : 1; + __u8 feature_version : 4; + __u8 reserved1 : 2; +#endif + __u8 add_len; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 reserved2 : 7; + __u8 write : 1; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 write : 1; + __u8 reserved2 : 7; +#endif + __u8 reserved3; + __u8 reserved4; + __u8 reserved5; +}; + +/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ +struct rwrt_feature_desc { + __be16 feature_code; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 reserved1 : 2; + __u8 feature_version : 4; + __u8 persistent : 1; + __u8 curr : 1; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 curr : 1; + __u8 persistent : 1; + __u8 feature_version : 4; + __u8 reserved1 : 2; +#endif + __u8 add_len; + __u32 last_lba; + __u32 block_size; + __u16 blocking; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 reserved2 : 7; + __u8 page_present : 1; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 page_present : 1; + __u8 reserved2 : 7; +#endif + __u8 reserved3; +}; + +typedef struct { + __be16 disc_information_length; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 reserved1 : 3; + __u8 erasable : 1; + __u8 border_status : 2; + __u8 disc_status : 2; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 disc_status : 2; + __u8 border_status : 2; + __u8 erasable : 1; + __u8 reserved1 : 3; +#else +#error "Please fix " +#endif + __u8 n_first_track; + __u8 n_sessions_lsb; + __u8 first_track_lsb; + __u8 last_track_lsb; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 did_v : 1; + __u8 dbc_v : 1; + __u8 uru : 1; + __u8 reserved2 : 2; + __u8 dbit : 1; + __u8 mrw_status : 2; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 mrw_status : 2; + __u8 dbit : 1; + __u8 reserved2 : 2; + __u8 uru : 1; + __u8 dbc_v : 1; + __u8 did_v : 1; +#endif + __u8 disc_type; + __u8 n_sessions_msb; + __u8 first_track_msb; + __u8 last_track_msb; + __u32 disc_id; + __u32 lead_in; + __u32 lead_out; + __u8 disc_bar_code[8]; + __u8 reserved3; + __u8 n_opc; +} disc_information; + +typedef struct { + __be16 track_information_length; + __u8 track_lsb; + __u8 session_lsb; + __u8 reserved1; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 reserved2 : 2; + __u8 damage : 1; + __u8 copy : 1; + __u8 track_mode : 4; + __u8 rt : 1; + __u8 blank : 1; + __u8 packet : 1; + __u8 fp : 1; + __u8 data_mode : 4; + __u8 reserved3 : 6; + __u8 lra_v : 1; + __u8 nwa_v : 1; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 track_mode : 4; + __u8 copy : 1; + __u8 damage : 1; + __u8 reserved2 : 2; + __u8 data_mode : 4; + __u8 fp : 1; + __u8 packet : 1; + __u8 blank : 1; + __u8 rt : 1; + __u8 nwa_v : 1; + __u8 lra_v : 1; + __u8 reserved3 : 6; +#endif + __be32 track_start; + __be32 next_writable; + __be32 free_blocks; + __be32 fixed_packet_size; + __be32 track_size; + __be32 last_rec_address; +} track_information; + +struct feature_header { + __u32 data_len; + __u8 reserved1; + __u8 reserved2; + __u16 curr_profile; +}; + +struct mode_page_header { + __be16 mode_data_length; + __u8 medium_type; + __u8 reserved1; + __u8 reserved2; + __u8 reserved3; + __be16 desc_length; +}; + + +#endif /* _LINUX_CDROM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cgroupstats.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cgroupstats.h new file mode 100644 index 0000000..3753c33 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cgroupstats.h @@ -0,0 +1,71 @@ +/* cgroupstats.h - exporting per-cgroup statistics + * + * Copyright IBM Corporation, 2007 + * Author Balbir Singh + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2.1 of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef _LINUX_CGROUPSTATS_H +#define _LINUX_CGROUPSTATS_H + +#include +#include + +/* + * Data shared between user space and kernel space on a per cgroup + * basis. This data is shared using taskstats. + * + * Most of these states are derived by looking at the task->state value + * For the nr_io_wait state, a flag in the delay accounting structure + * indicates that the task is waiting on IO + * + * Each member is aligned to a 8 byte boundary. + */ +struct cgroupstats { + __u64 nr_sleeping; /* Number of tasks sleeping */ + __u64 nr_running; /* Number of tasks running */ + __u64 nr_stopped; /* Number of tasks in stopped state */ + __u64 nr_uninterruptible; /* Number of tasks in uninterruptible */ + /* state */ + __u64 nr_io_wait; /* Number of tasks waiting on IO */ +}; + +/* + * Commands sent from userspace + * Not versioned. New commands should only be inserted at the enum's end + * prior to __CGROUPSTATS_CMD_MAX + */ + +enum { + CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX, /* Reserved */ + CGROUPSTATS_CMD_GET, /* user->kernel request/get-response */ + CGROUPSTATS_CMD_NEW, /* kernel->user event */ + __CGROUPSTATS_CMD_MAX, +}; + +#define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1) + +enum { + CGROUPSTATS_TYPE_UNSPEC = 0, /* Reserved */ + CGROUPSTATS_TYPE_CGROUP_STATS, /* contains name + stats */ + __CGROUPSTATS_TYPE_MAX, +}; + +#define CGROUPSTATS_TYPE_MAX (__CGROUPSTATS_TYPE_MAX - 1) + +enum { + CGROUPSTATS_CMD_ATTR_UNSPEC = 0, + CGROUPSTATS_CMD_ATTR_FD, + __CGROUPSTATS_CMD_ATTR_MAX, +}; + +#define CGROUPSTATS_CMD_ATTR_MAX (__CGROUPSTATS_CMD_ATTR_MAX - 1) + +#endif /* _LINUX_CGROUPSTATS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/chio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/chio.h new file mode 100644 index 0000000..6e0af99 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/chio.h @@ -0,0 +1,168 @@ +/* + * ioctl interface for the scsi media changer driver + */ + +/* changer element types */ +#define CHET_MT 0 /* media transport element (robot) */ +#define CHET_ST 1 /* storage element (media slots) */ +#define CHET_IE 2 /* import/export element */ +#define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */ +#define CHET_V1 4 /* vendor specific #1 */ +#define CHET_V2 5 /* vendor specific #2 */ +#define CHET_V3 6 /* vendor specific #3 */ +#define CHET_V4 7 /* vendor specific #4 */ + + +/* + * CHIOGPARAMS + * query changer properties + * + * CHIOVGPARAMS + * query vendor-specific element types + * + * accessing elements works by specifing type and unit of the element. + * for eample, storage elements are addressed with type = CHET_ST and + * unit = 0 .. cp_nslots-1 + * + */ +struct changer_params { + int cp_curpicker; /* current transport element */ + int cp_npickers; /* number of transport elements (CHET_MT) */ + int cp_nslots; /* number of storage elements (CHET_ST) */ + int cp_nportals; /* number of import/export elements (CHET_IE) */ + int cp_ndrives; /* number of data transfer elements (CHET_DT) */ +}; +struct changer_vendor_params { + int cvp_n1; /* number of vendor specific elems (CHET_V1) */ + char cvp_label1[16]; + int cvp_n2; /* number of vendor specific elems (CHET_V2) */ + char cvp_label2[16]; + int cvp_n3; /* number of vendor specific elems (CHET_V3) */ + char cvp_label3[16]; + int cvp_n4; /* number of vendor specific elems (CHET_V4) */ + char cvp_label4[16]; + int reserved[8]; +}; + + +/* + * CHIOMOVE + * move a medium from one element to another + */ +struct changer_move { + int cm_fromtype; /* type/unit of source element */ + int cm_fromunit; + int cm_totype; /* type/unit of destination element */ + int cm_tounit; + int cm_flags; +}; +#define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */ + + +/* + * CHIOEXCHANGE + * move one medium from element #1 to element #2, + * and another one from element #2 to element #3. + * element #1 and #3 are allowed to be identical. + */ +struct changer_exchange { + int ce_srctype; /* type/unit of element #1 */ + int ce_srcunit; + int ce_fdsttype; /* type/unit of element #2 */ + int ce_fdstunit; + int ce_sdsttype; /* type/unit of element #3 */ + int ce_sdstunit; + int ce_flags; +}; +#define CE_INVERT1 1 +#define CE_INVERT2 2 + + +/* + * CHIOPOSITION + * move the transport element (robot arm) to a specific element. + */ +struct changer_position { + int cp_type; + int cp_unit; + int cp_flags; +}; +#define CP_INVERT 1 + + +/* + * CHIOGSTATUS + * get element status for all elements of a specific type + */ +struct changer_element_status { + int ces_type; + unsigned char *ces_data; +}; +#define CESTATUS_FULL 0x01 /* full */ +#define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ +#define CESTATUS_EXCEPT 0x04 /* error condition */ +#define CESTATUS_ACCESS 0x08 /* access allowed */ +#define CESTATUS_EXENAB 0x10 /* element can export media */ +#define CESTATUS_INENAB 0x20 /* element can import media */ + + +/* + * CHIOGELEM + * get more detailed status information for a single element + */ +struct changer_get_element { + int cge_type; /* type/unit */ + int cge_unit; + int cge_status; /* status */ + int cge_errno; /* errno */ + int cge_srctype; /* source element of the last move/exchange */ + int cge_srcunit; + int cge_id; /* scsi id (for data transfer elements) */ + int cge_lun; /* scsi lun (for data transfer elements) */ + char cge_pvoltag[36]; /* primary volume tag */ + char cge_avoltag[36]; /* alternate volume tag */ + int cge_flags; +}; +/* flags */ +#define CGE_ERRNO 0x01 /* errno available */ +#define CGE_INVERT 0x02 /* media inverted */ +#define CGE_SRC 0x04 /* media src available */ +#define CGE_IDLUN 0x08 /* ID+LUN available */ +#define CGE_PVOLTAG 0x10 /* primary volume tag available */ +#define CGE_AVOLTAG 0x20 /* alternate volume tag available */ + + +/* + * CHIOSVOLTAG + * set volume tag + */ +struct changer_set_voltag { + int csv_type; /* type/unit */ + int csv_unit; + char csv_voltag[36]; /* volume tag */ + int csv_flags; +}; +#define CSV_PVOLTAG 0x01 /* primary volume tag */ +#define CSV_AVOLTAG 0x02 /* alternate volume tag */ +#define CSV_CLEARTAG 0x04 /* clear volume tag */ + +/* ioctls */ +#define CHIOMOVE _IOW('c', 1,struct changer_move) +#define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange) +#define CHIOPOSITION _IOW('c', 3,struct changer_position) +#define CHIOGPICKER _IOR('c', 4,int) /* not impl. */ +#define CHIOSPICKER _IOW('c', 5,int) /* not impl. */ +#define CHIOGPARAMS _IOR('c', 6,struct changer_params) +#define CHIOGSTATUS _IOW('c', 8,struct changer_element_status) +#define CHIOGELEM _IOW('c',16,struct changer_get_element) +#define CHIOINITELEM _IO('c',17) +#define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag) +#define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params) + +/* ---------------------------------------------------------------------- */ + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cm4000_cs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cm4000_cs.h new file mode 100644 index 0000000..2292880 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cm4000_cs.h @@ -0,0 +1,62 @@ +#ifndef _CM4000_H_ +#define _CM4000_H_ + +#include + +#define MAX_ATR 33 + +#define CM4000_MAX_DEV 4 + +/* those two structures are passed via ioctl() from/to userspace. They are + * used by existing userspace programs, so I kepth the awkward "bIFSD" naming + * not to break compilation of userspace apps. -HW */ + +typedef struct atreq { + __s32 atr_len; + unsigned char atr[64]; + __s32 power_act; + unsigned char bIFSD; + unsigned char bIFSC; +} atreq_t; + + +/* what is particularly stupid in the original driver is the arch-dependant + * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace + * will lay out the structure members differently than the 64bit kernel. + * + * I've changed "ptsreq.protocol" from "unsigned long" to "__u32". + * On 32bit this will make no difference. With 64bit kernels, it will make + * 32bit apps work, too. + */ + +typedef struct ptsreq { + __u32 protocol; /*T=0: 2^0, T=1: 2^1*/ + unsigned char flags; + unsigned char pts1; + unsigned char pts2; + unsigned char pts3; +} ptsreq_t; + +#define CM_IOC_MAGIC 'c' +#define CM_IOC_MAXNR 255 + +#define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *) +#define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *) +#define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *) +#define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3) +#define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4) + +#define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*) + +/* card and device states */ +#define CM_CARD_INSERTED 0x01 +#define CM_CARD_POWERED 0x02 +#define CM_ATR_PRESENT 0x04 +#define CM_ATR_VALID 0x08 +#define CM_STATE_VALID 0x0f +/* extra info only from CM4000 */ +#define CM_NO_READER 0x10 +#define CM_BAD_CARD 0x20 + + +#endif /* _CM4000_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cn_proc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cn_proc.h new file mode 100644 index 0000000..d51c7a6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cn_proc.h @@ -0,0 +1,100 @@ +/* + * cn_proc.h - process events connector + * + * Copyright (C) Matt Helsley, IBM Corp. 2005 + * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin + * Copyright (C) 2005 Nguyen Anh Quynh + * Copyright (C) 2005 Guillaume Thouvenin + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2.1 of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef CN_PROC_H +#define CN_PROC_H + +#include + +/* + * Userspace sends this enum to register with the kernel that it is listening + * for events on the connector. + */ +enum proc_cn_mcast_op { + PROC_CN_MCAST_LISTEN = 1, + PROC_CN_MCAST_IGNORE = 2 +}; + +/* + * From the user's point of view, the process + * ID is the thread group ID and thread ID is the internal + * kernel "pid". So, fields are assigned as follow: + * + * In user space - In kernel space + * + * parent process ID = parent->tgid + * parent thread ID = parent->pid + * child process ID = child->tgid + * child thread ID = child->pid + */ + +struct proc_event { + enum what { + /* Use successive bits so the enums can be used to record + * sets of events as well + */ + PROC_EVENT_NONE = 0x00000000, + PROC_EVENT_FORK = 0x00000001, + PROC_EVENT_EXEC = 0x00000002, + PROC_EVENT_UID = 0x00000004, + PROC_EVENT_GID = 0x00000040, + /* "next" should be 0x00000400 */ + /* "last" is the last process event: exit */ + PROC_EVENT_EXIT = 0x80000000 + } what; + __u32 cpu; + __u64 __attribute__((aligned(8))) timestamp_ns; + /* Number of nano seconds since system boot */ + union { /* must be last field of proc_event struct */ + struct { + __u32 err; + } ack; + + struct fork_proc_event { + __kernel_pid_t parent_pid; + __kernel_pid_t parent_tgid; + __kernel_pid_t child_pid; + __kernel_pid_t child_tgid; + } fork; + + struct exec_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; + } exec; + + struct id_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; + union { + __u32 ruid; /* task uid */ + __u32 rgid; /* task gid */ + } r; + union { + __u32 euid; + __u32 egid; + } e; + } id; + + struct exit_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; + __u32 exit_code, exit_signal; + } exit; + } event_data; +}; + +#endif /* CN_PROC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coda.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coda.h new file mode 100644 index 0000000..420c7ea --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coda.h @@ -0,0 +1,737 @@ +/* + You may distribute this file under either of the two licenses that + follow at your discretion. +*/ + +/* BLURB lgpl + + Coda File System + Release 5 + + Copyright (c) 1987-1999 Carnegie Mellon University + Additional copyrights listed below + +This code is distributed "AS IS" without warranty of any kind under +the terms of the GNU Library General Public Licence Version 2, as +shown in the file LICENSE, or under the license shown below. The +technical and financial contributors to Coda are listed in the file +CREDITS. + + Additional copyrights +*/ + +/* + + Coda: an Experimental Distributed File System + Release 4.0 + + Copyright (c) 1987-1999 Carnegie Mellon University + All Rights Reserved + +Permission to use, copy, modify and distribute this software and its +documentation is hereby granted, provided that both the copyright +notice and this permission notice appear in all copies of the +software, derivative works or modified versions, and any portions +thereof, and that both notices appear in supporting documentation, and +that credit is given to Carnegie Mellon University in all documents +and publicity pertaining to direct or indirect use of this code or its +derivatives. + +CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, +SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS +FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON +DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER +RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF +ANY DERIVATIVE WORK. + +Carnegie Mellon encourages users of this software to return any +improvements or extensions that they make, and to grant Carnegie +Mellon the rights to redistribute these changes without encumbrance. +*/ + +/* + * + * Based on cfs.h from Mach, but revamped for increased simplicity. + * Linux modifications by + * Peter Braam, Aug 1996 + */ + +#ifndef _CODA_HEADER_ +#define _CODA_HEADER_ + + +/* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */ +#if defined(__NetBSD__) || \ + ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL)) +#include +#endif + +#ifndef CODA_MAXSYMLINKS +#define CODA_MAXSYMLINKS 10 +#endif + +#if defined(DJGPP) || defined(__CYGWIN32__) +#ifdef KERNEL +typedef unsigned long u_long; +typedef unsigned int u_int; +typedef unsigned short u_short; +typedef u_long ino_t; +typedef u_long dev_t; +typedef void * caddr_t; +#ifdef DOS +typedef unsigned __int64 u_quad_t; +#else +typedef unsigned long long u_quad_t; +#endif + +#define __inline__ + +struct timespec { + long ts_sec; + long ts_nsec; +}; +#else /* DJGPP but not KERNEL */ +#include +typedef unsigned long long u_quad_t; +#endif /* !KERNEL */ +#endif /* !DJGPP */ + + +#if defined(__linux__) +#include +#define cdev_t u_quad_t +#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) +#define _UQUAD_T_ 1 +typedef unsigned long long u_quad_t; +#endif +#else +#define cdev_t dev_t +#endif + +#ifdef __CYGWIN32__ +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; +#endif + +#ifndef __BIT_TYPES_DEFINED__ +#define __BIT_TYPES_DEFINED__ +typedef signed char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +#endif + + +/* + * Cfs constants + */ +#define CODA_MAXNAMLEN 255 +#define CODA_MAXPATHLEN 1024 +#define CODA_MAXSYMLINK 10 + +/* these are Coda's version of O_RDONLY etc combinations + * to deal with VFS open modes + */ +#define C_O_READ 0x001 +#define C_O_WRITE 0x002 +#define C_O_TRUNC 0x010 +#define C_O_EXCL 0x100 +#define C_O_CREAT 0x200 + +/* these are to find mode bits in Venus */ +#define C_M_READ 00400 +#define C_M_WRITE 00200 + +/* for access Venus will use */ +#define C_A_C_OK 8 /* Test for writing upon create. */ +#define C_A_R_OK 4 /* Test for read permission. */ +#define C_A_W_OK 2 /* Test for write permission. */ +#define C_A_X_OK 1 /* Test for execute permission. */ +#define C_A_F_OK 0 /* Test for existence. */ + + + +#ifndef _VENUS_DIRENT_T_ +#define _VENUS_DIRENT_T_ 1 +struct venus_dirent { + u_int32_t d_fileno; /* file number of entry */ + u_int16_t d_reclen; /* length of this record */ + u_int8_t d_type; /* file type, see below */ + u_int8_t d_namlen; /* length of string in d_name */ + char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ +}; +#undef DIRSIZ +#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ + (((dp)->d_namlen+1 + 3) &~ 3)) + +/* + * File types + */ +#define CDT_UNKNOWN 0 +#define CDT_FIFO 1 +#define CDT_CHR 2 +#define CDT_DIR 4 +#define CDT_BLK 6 +#define CDT_REG 8 +#define CDT_LNK 10 +#define CDT_SOCK 12 +#define CDT_WHT 14 + +/* + * Convert between stat structure types and directory types. + */ +#define IFTOCDT(mode) (((mode) & 0170000) >> 12) +#define CDTTOIF(dirtype) ((dirtype) << 12) + +#endif + +#ifndef _VUID_T_ +#define _VUID_T_ +typedef u_int32_t vuid_t; +typedef u_int32_t vgid_t; +#endif /*_VUID_T_ */ + +struct CodaFid { + u_int32_t opaque[4]; +}; + +#define coda_f2i(fid)\ + (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) + +#ifndef _VENUS_VATTR_T_ +#define _VENUS_VATTR_T_ +/* + * Vnode types. VNON means no type. + */ +enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; + +struct coda_vattr { + long va_type; /* vnode type (for create) */ + u_short va_mode; /* files access mode and type */ + short va_nlink; /* number of references to file */ + vuid_t va_uid; /* owner user id */ + vgid_t va_gid; /* owner group id */ + long va_fileid; /* file id */ + u_quad_t va_size; /* file size in bytes */ + long va_blocksize; /* blocksize preferred for i/o */ + struct timespec va_atime; /* time of last access */ + struct timespec va_mtime; /* time of last modification */ + struct timespec va_ctime; /* time file changed */ + u_long va_gen; /* generation number of file */ + u_long va_flags; /* flags defined for file */ + cdev_t va_rdev; /* device special file represents */ + u_quad_t va_bytes; /* bytes of disk space held by file */ + u_quad_t va_filerev; /* file modification number */ +}; + +#endif + +/* structure used by CODA_STATFS for getting cache information from venus */ +struct coda_statfs { + int32_t f_blocks; + int32_t f_bfree; + int32_t f_bavail; + int32_t f_files; + int32_t f_ffree; +}; + +/* + * Kernel <--> Venus communications. + */ + +#define CODA_ROOT 2 +#define CODA_OPEN_BY_FD 3 +#define CODA_OPEN 4 +#define CODA_CLOSE 5 +#define CODA_IOCTL 6 +#define CODA_GETATTR 7 +#define CODA_SETATTR 8 +#define CODA_ACCESS 9 +#define CODA_LOOKUP 10 +#define CODA_CREATE 11 +#define CODA_REMOVE 12 +#define CODA_LINK 13 +#define CODA_RENAME 14 +#define CODA_MKDIR 15 +#define CODA_RMDIR 16 +#define CODA_SYMLINK 18 +#define CODA_READLINK 19 +#define CODA_FSYNC 20 +#define CODA_VGET 22 +#define CODA_SIGNAL 23 +#define CODA_REPLACE 24 /* DOWNCALL */ +#define CODA_FLUSH 25 /* DOWNCALL */ +#define CODA_PURGEUSER 26 /* DOWNCALL */ +#define CODA_ZAPFILE 27 /* DOWNCALL */ +#define CODA_ZAPDIR 28 /* DOWNCALL */ +#define CODA_PURGEFID 30 /* DOWNCALL */ +#define CODA_OPEN_BY_PATH 31 +#define CODA_RESOLVE 32 +#define CODA_REINTEGRATE 33 +#define CODA_STATFS 34 +#define CODA_STORE 35 +#define CODA_RELEASE 36 +#define CODA_NCALLS 37 + +#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) + +#define VC_MAXDATASIZE 8192 +#define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ + VC_MAXDATASIZE + +#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) + +#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ + +/* + * Venus <-> Coda RPC arguments + */ +struct coda_in_hdr { + u_int32_t opcode; + u_int32_t unique; /* Keep multiple outstanding msgs distinct */ + pid_t pid; + pid_t pgid; + vuid_t uid; +}; + +/* Really important that opcode and unique are 1st two fields! */ +struct coda_out_hdr { + u_int32_t opcode; + u_int32_t unique; + u_int32_t result; +}; + +/* coda_root: NO_IN */ +struct coda_root_out { + struct coda_out_hdr oh; + struct CodaFid VFid; +}; + +struct coda_root_in { + struct coda_in_hdr in; +}; + +/* coda_open: */ +struct coda_open_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int flags; +}; + +struct coda_open_out { + struct coda_out_hdr oh; + cdev_t dev; + ino_t inode; +}; + + +/* coda_store: */ +struct coda_store_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int flags; +}; + +struct coda_store_out { + struct coda_out_hdr out; +}; + +/* coda_release: */ +struct coda_release_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int flags; +}; + +struct coda_release_out { + struct coda_out_hdr out; +}; + +/* coda_close: */ +struct coda_close_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int flags; +}; + +struct coda_close_out { + struct coda_out_hdr out; +}; + +/* coda_ioctl: */ +struct coda_ioctl_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int cmd; + int len; + int rwflag; + char *data; /* Place holder for data. */ +}; + +struct coda_ioctl_out { + struct coda_out_hdr oh; + int len; + caddr_t data; /* Place holder for data. */ +}; + + +/* coda_getattr: */ +struct coda_getattr_in { + struct coda_in_hdr ih; + struct CodaFid VFid; +}; + +struct coda_getattr_out { + struct coda_out_hdr oh; + struct coda_vattr attr; +}; + + +/* coda_setattr: NO_OUT */ +struct coda_setattr_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + struct coda_vattr attr; +}; + +struct coda_setattr_out { + struct coda_out_hdr out; +}; + +/* coda_access: NO_OUT */ +struct coda_access_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int flags; +}; + +struct coda_access_out { + struct coda_out_hdr out; +}; + + +/* lookup flags */ +#define CLU_CASE_SENSITIVE 0x01 +#define CLU_CASE_INSENSITIVE 0x02 + +/* coda_lookup: */ +struct coda_lookup_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int name; /* Place holder for data. */ + int flags; +}; + +struct coda_lookup_out { + struct coda_out_hdr oh; + struct CodaFid VFid; + int vtype; +}; + + +/* coda_create: */ +struct coda_create_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + struct coda_vattr attr; + int excl; + int mode; + int name; /* Place holder for data. */ +}; + +struct coda_create_out { + struct coda_out_hdr oh; + struct CodaFid VFid; + struct coda_vattr attr; +}; + + +/* coda_remove: NO_OUT */ +struct coda_remove_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int name; /* Place holder for data. */ +}; + +struct coda_remove_out { + struct coda_out_hdr out; +}; + +/* coda_link: NO_OUT */ +struct coda_link_in { + struct coda_in_hdr ih; + struct CodaFid sourceFid; /* cnode to link *to* */ + struct CodaFid destFid; /* Directory in which to place link */ + int tname; /* Place holder for data. */ +}; + +struct coda_link_out { + struct coda_out_hdr out; +}; + + +/* coda_rename: NO_OUT */ +struct coda_rename_in { + struct coda_in_hdr ih; + struct CodaFid sourceFid; + int srcname; + struct CodaFid destFid; + int destname; +}; + +struct coda_rename_out { + struct coda_out_hdr out; +}; + +/* coda_mkdir: */ +struct coda_mkdir_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + struct coda_vattr attr; + int name; /* Place holder for data. */ +}; + +struct coda_mkdir_out { + struct coda_out_hdr oh; + struct CodaFid VFid; + struct coda_vattr attr; +}; + + +/* coda_rmdir: NO_OUT */ +struct coda_rmdir_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int name; /* Place holder for data. */ +}; + +struct coda_rmdir_out { + struct coda_out_hdr out; +}; + +/* coda_symlink: NO_OUT */ +struct coda_symlink_in { + struct coda_in_hdr ih; + struct CodaFid VFid; /* Directory to put symlink in */ + int srcname; + struct coda_vattr attr; + int tname; +}; + +struct coda_symlink_out { + struct coda_out_hdr out; +}; + +/* coda_readlink: */ +struct coda_readlink_in { + struct coda_in_hdr ih; + struct CodaFid VFid; +}; + +struct coda_readlink_out { + struct coda_out_hdr oh; + int count; + caddr_t data; /* Place holder for data. */ +}; + + +/* coda_fsync: NO_OUT */ +struct coda_fsync_in { + struct coda_in_hdr ih; + struct CodaFid VFid; +}; + +struct coda_fsync_out { + struct coda_out_hdr out; +}; + +/* coda_vget: */ +struct coda_vget_in { + struct coda_in_hdr ih; + struct CodaFid VFid; +}; + +struct coda_vget_out { + struct coda_out_hdr oh; + struct CodaFid VFid; + int vtype; +}; + + +/* CODA_SIGNAL is out-of-band, doesn't need data. */ +/* CODA_INVALIDATE is a venus->kernel call */ +/* CODA_FLUSH is a venus->kernel call */ + +/* coda_purgeuser: */ +/* CODA_PURGEUSER is a venus->kernel call */ +struct coda_purgeuser_out { + struct coda_out_hdr oh; + vuid_t uid; +}; + +/* coda_zapfile: */ +/* CODA_ZAPFILE is a venus->kernel call */ +struct coda_zapfile_out { + struct coda_out_hdr oh; + struct CodaFid CodaFid; +}; + +/* coda_zapdir: */ +/* CODA_ZAPDIR is a venus->kernel call */ +struct coda_zapdir_out { + struct coda_out_hdr oh; + struct CodaFid CodaFid; +}; + +/* coda_purgefid: */ +/* CODA_PURGEFID is a venus->kernel call */ +struct coda_purgefid_out { + struct coda_out_hdr oh; + struct CodaFid CodaFid; +}; + +/* coda_replace: */ +/* CODA_REPLACE is a venus->kernel call */ +struct coda_replace_out { /* coda_replace is a venus->kernel call */ + struct coda_out_hdr oh; + struct CodaFid NewFid; + struct CodaFid OldFid; +}; + +/* coda_open_by_fd: */ +struct coda_open_by_fd_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int flags; +}; + +struct coda_open_by_fd_out { + struct coda_out_hdr oh; + int fd; + +}; + +/* coda_open_by_path: */ +struct coda_open_by_path_in { + struct coda_in_hdr ih; + struct CodaFid VFid; + int flags; +}; + +struct coda_open_by_path_out { + struct coda_out_hdr oh; + int path; +}; + +/* coda_statfs: NO_IN */ +struct coda_statfs_in { + struct coda_in_hdr in; +}; + +struct coda_statfs_out { + struct coda_out_hdr oh; + struct coda_statfs stat; +}; + +/* + * Occasionally, we don't cache the fid returned by CODA_LOOKUP. + * For instance, if the fid is inconsistent. + * This case is handled by setting the top bit of the type result parameter. + */ +#define CODA_NOCACHE 0x80000000 + +union inputArgs { + struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ + struct coda_open_in coda_open; + struct coda_store_in coda_store; + struct coda_release_in coda_release; + struct coda_close_in coda_close; + struct coda_ioctl_in coda_ioctl; + struct coda_getattr_in coda_getattr; + struct coda_setattr_in coda_setattr; + struct coda_access_in coda_access; + struct coda_lookup_in coda_lookup; + struct coda_create_in coda_create; + struct coda_remove_in coda_remove; + struct coda_link_in coda_link; + struct coda_rename_in coda_rename; + struct coda_mkdir_in coda_mkdir; + struct coda_rmdir_in coda_rmdir; + struct coda_symlink_in coda_symlink; + struct coda_readlink_in coda_readlink; + struct coda_fsync_in coda_fsync; + struct coda_vget_in coda_vget; + struct coda_open_by_fd_in coda_open_by_fd; + struct coda_open_by_path_in coda_open_by_path; + struct coda_statfs_in coda_statfs; +}; + +union outputArgs { + struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ + struct coda_root_out coda_root; + struct coda_open_out coda_open; + struct coda_ioctl_out coda_ioctl; + struct coda_getattr_out coda_getattr; + struct coda_lookup_out coda_lookup; + struct coda_create_out coda_create; + struct coda_mkdir_out coda_mkdir; + struct coda_readlink_out coda_readlink; + struct coda_vget_out coda_vget; + struct coda_purgeuser_out coda_purgeuser; + struct coda_zapfile_out coda_zapfile; + struct coda_zapdir_out coda_zapdir; + struct coda_purgefid_out coda_purgefid; + struct coda_replace_out coda_replace; + struct coda_open_by_fd_out coda_open_by_fd; + struct coda_open_by_path_out coda_open_by_path; + struct coda_statfs_out coda_statfs; +}; + +union coda_downcalls { + /* CODA_INVALIDATE is a venus->kernel call */ + /* CODA_FLUSH is a venus->kernel call */ + struct coda_purgeuser_out purgeuser; + struct coda_zapfile_out zapfile; + struct coda_zapdir_out zapdir; + struct coda_purgefid_out purgefid; + struct coda_replace_out replace; +}; + + +/* + * Used for identifying usage of "Control" and pioctls + */ + +#define PIOCPARM_MASK 0x0000ffff +struct ViceIoctl { + void *in; /* Data to be transferred in */ + void *out; /* Data to be transferred out */ + u_short in_size; /* Size of input buffer <= 2K */ + u_short out_size; /* Maximum size of output buffer, <= 2K */ +}; + +struct PioctlData { + const char *path; + int follow; + struct ViceIoctl vi; +}; + +#define CODA_CONTROL ".CONTROL" +#define CODA_CONTROLLEN 8 +#define CTL_INO -1 + +/* Data passed to mount */ + +#define CODA_MOUNT_VERSION 1 + +struct coda_mount_data { + int version; + int fd; /* Opened device */ +}; + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coda_psdev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coda_psdev.h new file mode 100644 index 0000000..3cccd19 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coda_psdev.h @@ -0,0 +1,27 @@ +#ifndef __CODA_PSDEV_H +#define __CODA_PSDEV_H + +#include + +#define CODA_PSDEV_MAJOR 67 +#define MAX_CODADEVS 5 /* how many do we allow */ + + +/* messages between coda filesystem in kernel and Venus */ +struct upc_req { + struct list_head uc_chain; + caddr_t uc_data; + u_short uc_flags; + u_short uc_inSize; /* Size is at most 5000 bytes */ + u_short uc_outSize; + u_short uc_opcode; /* copied from data to save lookup */ + int uc_unique; + wait_queue_head_t uc_sleep; /* process' wait queue */ +}; + +#define REQ_ASYNC 0x1 +#define REQ_READ 0x2 +#define REQ_WRITE 0x4 +#define REQ_ABORT 0x8 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coff.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coff.h new file mode 100644 index 0000000..6354a7f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/coff.h @@ -0,0 +1,351 @@ +/* This file is derived from the GAS 2.1.4 assembler control file. + The GAS product is under the GNU General Public License, version 2 or later. + As such, this file is also under that license. + + If the file format changes in the COFF object, this file should be + subsequently updated to reflect the changes. + + The actual loader module only uses a few of these structures. The full + set is documented here because I received the full set. If you wish + more information about COFF, then O'Reilly has a very excellent book. +*/ + +#define E_SYMNMLEN 8 /* Number of characters in a symbol name */ +#define E_FILNMLEN 14 /* Number of characters in a file name */ +#define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */ + +/* + * These defines are byte order independent. There is no alignment of fields + * permitted in the structures. Therefore they are declared as characters + * and the values loaded from the character positions. It also makes it + * nice to have it "endian" independent. + */ + +/* Load a short int from the following tables with little-endian formats */ +#define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\ + ((unsigned short)((unsigned char)ps[0])))) + +/* Load a long int from the following tables with little-endian formats */ +#define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\ + ((unsigned long)((unsigned char)ps[2])<<16) |\ + ((unsigned long)((unsigned char)ps[1])<<8) |\ + ((unsigned long)((unsigned char)ps[0]))))) + +/* Load a short int from the following tables with big-endian formats */ +#define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\ + ((unsigned short)((unsigned char)ps[1])))) + +/* Load a long int from the following tables with big-endian formats */ +#define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\ + ((unsigned long)((unsigned char)ps[1])<<16) |\ + ((unsigned long)((unsigned char)ps[2])<<8) |\ + ((unsigned long)((unsigned char)ps[3]))))) + +/* These may be overridden later by brain dead implementations which generate + a big-endian header with little-endian data. In that case, generate a + replacement macro which tests a flag and uses either of the two above + as appropriate. */ + +#define COFF_LONG(v) COFF_LONG_L(v) +#define COFF_SHORT(v) COFF_SHORT_L(v) + +/*** coff information for Intel 386/486. */ + +/********************** FILE HEADER **********************/ + +struct COFF_filehdr { + char f_magic[2]; /* magic number */ + char f_nscns[2]; /* number of sections */ + char f_timdat[4]; /* time & date stamp */ + char f_symptr[4]; /* file pointer to symtab */ + char f_nsyms[4]; /* number of symtab entries */ + char f_opthdr[2]; /* sizeof(optional hdr) */ + char f_flags[2]; /* flags */ +}; + +/* + * Bits for f_flags: + * + * F_RELFLG relocation info stripped from file + * F_EXEC file is executable (i.e. no unresolved external + * references) + * F_LNNO line numbers stripped from file + * F_LSYMS local symbols stripped from file + * F_MINMAL this is a minimal object file (".m") output of fextract + * F_UPDATE this is a fully bound update file, output of ogen + * F_SWABD this file has had its bytes swabbed (in names) + * F_AR16WR this file has the byte ordering of an AR16WR + * (e.g. 11/70) machine + * F_AR32WR this file has the byte ordering of an AR32WR machine + * (e.g. vax and iNTEL 386) + * F_AR32W this file has the byte ordering of an AR32W machine + * (e.g. 3b,maxi) + * F_PATCH file contains "patch" list in optional header + * F_NODF (minimal file only) no decision functions for + * replaced functions + */ + +#define COFF_F_RELFLG 0000001 +#define COFF_F_EXEC 0000002 +#define COFF_F_LNNO 0000004 +#define COFF_F_LSYMS 0000010 +#define COFF_F_MINMAL 0000020 +#define COFF_F_UPDATE 0000040 +#define COFF_F_SWABD 0000100 +#define COFF_F_AR16WR 0000200 +#define COFF_F_AR32WR 0000400 +#define COFF_F_AR32W 0001000 +#define COFF_F_PATCH 0002000 +#define COFF_F_NODF 0002000 + +#define COFF_I386MAGIC 0x14c /* Linux's system */ + +#if 0 /* Perhaps, someday, these formats may be used. */ +#define COFF_I386PTXMAGIC 0x154 +#define COFF_I386AIXMAGIC 0x175 /* IBM's AIX system */ +#define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \ + && COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \ + && COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC) +#else +#define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) +#endif + +#define COFF_FILHDR struct COFF_filehdr +#define COFF_FILHSZ sizeof(COFF_FILHDR) + +/********************** AOUT "OPTIONAL HEADER" **********************/ + +/* Linux COFF must have this "optional" header. Standard COFF has no entry + location for the "entry" point. They normally would start with the first + location of the .text section. This is not a good idea for linux. So, + the use of this "optional" header is not optional. It is required. + + Do not be tempted to assume that the size of the optional header is + a constant and simply index the next byte by the size of this structure. + Use the 'f_opthdr' field in the main coff header for the size of the + structure actually written to the file!! +*/ + +typedef struct +{ + char magic[2]; /* type of file */ + char vstamp[2]; /* version stamp */ + char tsize[4]; /* text size in bytes, padded to FW bdry */ + char dsize[4]; /* initialized data " " */ + char bsize[4]; /* uninitialized data " " */ + char entry[4]; /* entry pt. */ + char text_start[4]; /* base of text used for this file */ + char data_start[4]; /* base of data used for this file */ +} +COFF_AOUTHDR; + +#define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) + +#define COFF_STMAGIC 0401 +#define COFF_OMAGIC 0404 +#define COFF_JMAGIC 0407 /* dirty text and data image, can't share */ +#define COFF_DMAGIC 0410 /* dirty text segment, data aligned */ +#define COFF_ZMAGIC 0413 /* The proper magic number for executables */ +#define COFF_SHMAGIC 0443 /* shared library header */ + +/********************** SECTION HEADER **********************/ + +struct COFF_scnhdr { + char s_name[8]; /* section name */ + char s_paddr[4]; /* physical address, aliased s_nlib */ + char s_vaddr[4]; /* virtual address */ + char s_size[4]; /* section size */ + char s_scnptr[4]; /* file ptr to raw data for section */ + char s_relptr[4]; /* file ptr to relocation */ + char s_lnnoptr[4]; /* file ptr to line numbers */ + char s_nreloc[2]; /* number of relocation entries */ + char s_nlnno[2]; /* number of line number entries */ + char s_flags[4]; /* flags */ +}; + +#define COFF_SCNHDR struct COFF_scnhdr +#define COFF_SCNHSZ sizeof(COFF_SCNHDR) + +/* + * names of "special" sections + */ + +#define COFF_TEXT ".text" +#define COFF_DATA ".data" +#define COFF_BSS ".bss" +#define COFF_COMMENT ".comment" +#define COFF_LIB ".lib" + +#define COFF_SECT_TEXT 0 /* Section for instruction code */ +#define COFF_SECT_DATA 1 /* Section for initialized globals */ +#define COFF_SECT_BSS 2 /* Section for un-initialized globals */ +#define COFF_SECT_REQD 3 /* Minimum number of sections for good file */ + +#define COFF_STYP_REG 0x00 /* regular segment */ +#define COFF_STYP_DSECT 0x01 /* dummy segment */ +#define COFF_STYP_NOLOAD 0x02 /* no-load segment */ +#define COFF_STYP_GROUP 0x04 /* group segment */ +#define COFF_STYP_PAD 0x08 /* .pad segment */ +#define COFF_STYP_COPY 0x10 /* copy section */ +#define COFF_STYP_TEXT 0x20 /* .text segment */ +#define COFF_STYP_DATA 0x40 /* .data segment */ +#define COFF_STYP_BSS 0x80 /* .bss segment */ +#define COFF_STYP_INFO 0x200 /* .comment section */ +#define COFF_STYP_OVER 0x400 /* overlay section */ +#define COFF_STYP_LIB 0x800 /* library section */ + +/* + * Shared libraries have the following section header in the data field for + * each library. + */ + +struct COFF_slib { + char sl_entsz[4]; /* Size of this entry */ + char sl_pathndx[4]; /* size of the header field */ +}; + +#define COFF_SLIBHD struct COFF_slib +#define COFF_SLIBSZ sizeof(COFF_SLIBHD) + +/********************** LINE NUMBERS **********************/ + +/* 1 line number entry for every "breakpointable" source line in a section. + * Line numbers are grouped on a per function basis; first entry in a function + * grouping will have l_lnno = 0 and in place of physical address will be the + * symbol table index of the function name. + */ + +struct COFF_lineno { + union { + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ + char l_paddr[4]; /* (physical) address of line number */ + } l_addr; + char l_lnno[2]; /* line number */ +}; + +#define COFF_LINENO struct COFF_lineno +#define COFF_LINESZ 6 + +/********************** SYMBOLS **********************/ + +#define COFF_E_SYMNMLEN 8 /* # characters in a short symbol name */ +#define COFF_E_FILNMLEN 14 /* # characters in a file name */ +#define COFF_E_DIMNUM 4 /* # array dimensions in auxiliary entry */ + +/* + * All symbols and sections have the following definition + */ + +struct COFF_syment +{ + union { + char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */ + struct { + char e_zeroes[4]; /* Leading zeros */ + char e_offset[4]; /* Offset if this is a header section */ + } e; + } e; + + char e_value[4]; /* Value (address) of the segment */ + char e_scnum[2]; /* Section number */ + char e_type[2]; /* Type of section */ + char e_sclass[1]; /* Loader class */ + char e_numaux[1]; /* Number of auxiliary entries which follow */ +}; + +#define COFF_N_BTMASK (0xf) /* Mask for important class bits */ +#define COFF_N_TMASK (0x30) /* Mask for important type bits */ +#define COFF_N_BTSHFT (4) /* # bits to shift class field */ +#define COFF_N_TSHIFT (2) /* # bits to shift type field */ + +/* + * Auxiliary entries because the main table is too limiting. + */ + +union COFF_auxent { + +/* + * Debugger information + */ + + struct { + char x_tagndx[4]; /* str, un, or enum tag indx */ + union { + struct { + char x_lnno[2]; /* declaration line number */ + char x_size[2]; /* str/union/array size */ + } x_lnsz; + char x_fsize[4]; /* size of function */ + } x_misc; + + union { + struct { /* if ISFCN, tag, or .bb */ + char x_lnnoptr[4]; /* ptr to fcn line # */ + char x_endndx[4]; /* entry ndx past block end */ + } x_fcn; + + struct { /* if ISARY, up to 4 dimen. */ + char x_dimen[E_DIMNUM][2]; + } x_ary; + } x_fcnary; + + char x_tvndx[2]; /* tv index */ + } x_sym; + +/* + * Source file names (debugger information) + */ + + union { + char x_fname[E_FILNMLEN]; + struct { + char x_zeroes[4]; + char x_offset[4]; + } x_n; + } x_file; + +/* + * Section information + */ + + struct { + char x_scnlen[4]; /* section length */ + char x_nreloc[2]; /* # relocation entries */ + char x_nlinno[2]; /* # line numbers */ + } x_scn; + +/* + * Transfer vector (branch table) + */ + + struct { + char x_tvfill[4]; /* tv fill value */ + char x_tvlen[2]; /* length of .tv */ + char x_tvran[2][2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ +}; + +#define COFF_SYMENT struct COFF_syment +#define COFF_SYMESZ 18 +#define COFF_AUXENT union COFF_auxent +#define COFF_AUXESZ 18 + +#define COFF_ETEXT "etext" + +/********************** RELOCATION DIRECTIVES **********************/ + +struct COFF_reloc { + char r_vaddr[4]; /* Virtual address of item */ + char r_symndx[4]; /* Symbol index in the symtab */ + char r_type[2]; /* Relocation type */ +}; + +#define COFF_RELOC struct COFF_reloc +#define COFF_RELSZ 10 + +#define COFF_DEF_DATA_SECTION_ALIGNMENT 4 +#define COFF_DEF_BSS_SECTION_ALIGNMENT 4 +#define COFF_DEF_TEXT_SECTION_ALIGNMENT 4 + +/* For new sections we haven't heard of before */ +#define COFF_DEF_SECTION_ALIGNMENT 4 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/comstats.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/comstats.h new file mode 100644 index 0000000..3f5ea8e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/comstats.h @@ -0,0 +1,119 @@ +/*****************************************************************************/ + +/* + * comstats.h -- Serial Port Stats. + * + * Copyright (C) 1996-1998 Stallion Technologies + * Copyright (C) 1994-1996 Greg Ungerer. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ +#ifndef _COMSTATS_H +#define _COMSTATS_H +/*****************************************************************************/ + +/* + * Serial port stats structure. The structure itself is UART + * independent, but some fields may be UART/driver specific (for + * example state). + */ + +typedef struct { + unsigned long brd; + unsigned long panel; + unsigned long port; + unsigned long hwid; + unsigned long type; + unsigned long txtotal; + unsigned long rxtotal; + unsigned long txbuffered; + unsigned long rxbuffered; + unsigned long rxoverrun; + unsigned long rxparity; + unsigned long rxframing; + unsigned long rxlost; + unsigned long txbreaks; + unsigned long rxbreaks; + unsigned long txxon; + unsigned long txxoff; + unsigned long rxxon; + unsigned long rxxoff; + unsigned long txctson; + unsigned long txctsoff; + unsigned long rxrtson; + unsigned long rxrtsoff; + unsigned long modem; + unsigned long state; + unsigned long flags; + unsigned long ttystate; + unsigned long cflags; + unsigned long iflags; + unsigned long oflags; + unsigned long lflags; + unsigned long signals; +} comstats_t; + + +/* + * Board stats structure. Returns useful info about the board. + */ + +#define COM_MAXPANELS 8 + +typedef struct { + unsigned long panel; + unsigned long type; + unsigned long hwid; + unsigned long nrports; +} companel_t; + +typedef struct { + unsigned long brd; + unsigned long type; + unsigned long hwid; + unsigned long state; + unsigned long ioaddr; + unsigned long ioaddr2; + unsigned long memaddr; + unsigned long irq; + unsigned long nrpanels; + unsigned long nrports; + companel_t panels[COM_MAXPANELS]; +} combrd_t; + + +/* + * Define the ioctl operations for stats stuff. + */ +#include + +#define COM_GETPORTSTATS _IO('c',30) +#define COM_CLRPORTSTATS _IO('c',31) +#define COM_GETBRDSTATS _IO('c',32) + + +/* + * Define the set of ioctls that give user level access to the + * private port, panel and board structures. The argument required + * will be driver dependent! + */ +#define COM_READPORT _IO('c',40) +#define COM_READBOARD _IO('c',41) +#define COM_READPANEL _IO('c',42) + +/*****************************************************************************/ +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/connector.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/connector.h new file mode 100644 index 0000000..f47072e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/connector.h @@ -0,0 +1,98 @@ +/* + * connector.h + * + * 2004-2005 Copyright (c) Evgeniy Polyakov + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __CONNECTOR_H +#define __CONNECTOR_H + +#include + +#define CN_IDX_CONNECTOR 0xffffffff +#define CN_VAL_CONNECTOR 0xffffffff + +/* + * Process Events connector unique ids -- used for message routing + */ +#define CN_IDX_PROC 0x1 +#define CN_VAL_PROC 0x1 +#define CN_IDX_CIFS 0x2 +#define CN_VAL_CIFS 0x1 +#define CN_W1_IDX 0x3 /* w1 communication */ +#define CN_W1_VAL 0x1 +#define CN_IDX_V86D 0x4 +#define CN_VAL_V86D_UVESAFB 0x1 +#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ +#define CN_DST_IDX 0x6 +#define CN_DST_VAL 0x1 + +#define CN_NETLINK_USERS 7 + +/* + * Maximum connector's message size. + */ +#define CONNECTOR_MAX_MSG_SIZE 16384 + +/* + * idx and val are unique identifiers which + * are used for message routing and + * must be registered in connector.h for in-kernel usage. + */ + +struct cb_id { + __u32 idx; + __u32 val; +}; + +struct cn_msg { + struct cb_id id; + + __u32 seq; + __u32 ack; + + __u16 len; /* Length of the following data */ + __u16 flags; + __u8 data[0]; +}; + +/* + * Notify structure - requests notification about + * registering/unregistering idx/val in range [first, first+range]. + */ +struct cn_notify_req { + __u32 first; + __u32 range; +}; + +/* + * Main notification control message + * *_notify_num - number of appropriate cn_notify_req structures after + * this struct. + * group - notification receiver's idx. + * len - total length of the attached data. + */ +struct cn_ctl_msg { + __u32 idx_notify_num; + __u32 val_notify_num; + __u32 group; + __u32 len; + __u8 data[0]; +}; + +#endif /* __CONNECTOR_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/const.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/const.h new file mode 100644 index 0000000..c22c707 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/const.h @@ -0,0 +1,24 @@ +/* const.h: Macros for dealing with constants. */ + +#ifndef _LINUX_CONST_H +#define _LINUX_CONST_H + +/* Some constant macros are used in both assembler and + * C code. Therefore we cannot annotate them always with + * 'UL' and other type specifiers unilaterally. We + * use the following macros to deal with this. + * + * Similarly, _AT() will cast an expression with a type in C, but + * leave it unchanged in asm. + */ + +#ifdef __ASSEMBLY__ +#define _AC(X,Y) X +#define _AT(T,X) X +#else +#define __AC(X,Y) (X##Y) +#define _AC(X,Y) __AC(X,Y) +#define _AT(T,X) ((T)(X)) +#endif + +#endif /* !(_LINUX_CONST_H) */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cramfs_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cramfs_fs.h new file mode 100644 index 0000000..3be4e5a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cramfs_fs.h @@ -0,0 +1,93 @@ +#ifndef __CRAMFS_H +#define __CRAMFS_H + +#include + +#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ +#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ +#define CRAMFS_SIGNATURE "Compressed ROMFS" + +/* + * Width of various bitfields in struct cramfs_inode. + * Primarily used to generate warnings in mkcramfs. + */ +#define CRAMFS_MODE_WIDTH 16 +#define CRAMFS_UID_WIDTH 16 +#define CRAMFS_SIZE_WIDTH 24 +#define CRAMFS_GID_WIDTH 8 +#define CRAMFS_NAMELEN_WIDTH 6 +#define CRAMFS_OFFSET_WIDTH 26 + +/* + * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs + * path length is 63 << 2 = 252. + */ +#define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2) + +/* + * Reasonably terse representation of the inode data. + */ +struct cramfs_inode { + __u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH; + /* SIZE for device files is i_rdev */ + __u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH; + /* NAMELEN is the length of the file name, divided by 4 and + rounded up. (cramfs doesn't support hard links.) */ + /* OFFSET: For symlinks and non-empty regular files, this + contains the offset (divided by 4) of the file data in + compressed form (starting with an array of block pointers; + see README). For non-empty directories it is the offset + (divided by 4) of the inode of the first file in that + directory. For anything else, offset is zero. */ + __u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH; +}; + +struct cramfs_info { + __u32 crc; + __u32 edition; + __u32 blocks; + __u32 files; +}; + +/* + * Superblock information at the beginning of the FS. + */ +struct cramfs_super { + __u32 magic; /* 0x28cd3d45 - random number */ + __u32 size; /* length in bytes */ + __u32 flags; /* feature flags */ + __u32 future; /* reserved for future use */ + __u8 signature[16]; /* "Compressed ROMFS" */ + struct cramfs_info fsid; /* unique filesystem info */ + __u8 name[16]; /* user-defined name */ + struct cramfs_inode root; /* root inode data */ +}; + +/* + * Feature flags + * + * 0x00000000 - 0x000000ff: features that work for all past kernels + * 0x00000100 - 0xffffffff: features that don't work for past kernels + */ +#define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */ +#define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */ +#define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */ +#define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */ +#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */ + +/* + * Valid values in super.flags. Currently we refuse to mount + * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be + * changed to test super.future instead. + */ +#define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \ + | CRAMFS_FLAG_HOLES \ + | CRAMFS_FLAG_WRONG_SIGNATURE \ + | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET ) + +/* Uncompression interfaces to the underlying zlib */ +int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen); +int cramfs_uncompress_init(void); +void cramfs_uncompress_exit(void); + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cuda.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cuda.h new file mode 100644 index 0000000..69c8bf0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cuda.h @@ -0,0 +1,28 @@ +/* + * Definitions for talking to the CUDA. The CUDA is a microcontroller + * which controls the ADB, system power, RTC, and various other things. + * + * Copyright (C) 1996 Paul Mackerras. + */ + +/* CUDA commands (2nd byte) */ +#define CUDA_WARM_START 0 +#define CUDA_AUTOPOLL 1 +#define CUDA_GET_6805_ADDR 2 +#define CUDA_GET_TIME 3 +#define CUDA_GET_PRAM 7 +#define CUDA_SET_6805_ADDR 8 +#define CUDA_SET_TIME 9 +#define CUDA_POWERDOWN 0xa +#define CUDA_POWERUP_TIME 0xb +#define CUDA_SET_PRAM 0xc +#define CUDA_MS_RESET 0xd +#define CUDA_SEND_DFAC 0xe +#define CUDA_RESET_SYSTEM 0x11 +#define CUDA_SET_IPL 0x12 +#define CUDA_SET_AUTO_RATE 0x14 +#define CUDA_GET_AUTO_RATE 0x16 +#define CUDA_SET_DEVICE_LIST 0x19 +#define CUDA_GET_DEVICE_LIST 0x1a +#define CUDA_GET_SET_IIC 0x22 + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cyclades.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cyclades.h new file mode 100644 index 0000000..11e08b7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cyclades.h @@ -0,0 +1,506 @@ +/* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $ + * linux/include/linux/cyclades.h + * + * This file was initially written by + * Randolph Bentson and is maintained by + * Ivan Passos . + * + * This file contains the general definitions for the cyclades.c driver + *$Log: cyclades.h,v $ + *Revision 3.1 2002/01/29 11:36:16 henrique + *added throttle field on struct cyclades_port to indicate whether the + *port is throttled or not + * + *Revision 3.1 2000/04/19 18:52:52 ivan + *converted address fields to unsigned long and added fields for physical + *addresses on cyclades_card structure; + * + *Revision 3.0 1998/11/02 14:20:59 ivan + *added nports field on cyclades_card structure; + * + *Revision 2.5 1998/08/03 16:57:01 ivan + *added cyclades_idle_stats structure; + * + *Revision 2.4 1998/06/01 12:09:53 ivan + *removed closing_wait2 from cyclades_port structure; + * + *Revision 2.3 1998/03/16 18:01:12 ivan + *changes in the cyclades_port structure to get it closer to the + *standard serial port structure; + *added constants for new ioctls; + * + *Revision 2.2 1998/02/17 16:50:00 ivan + *changes in the cyclades_port structure (addition of shutdown_wait and + *chip_rev variables); + *added constants for new ioctls and for CD1400 rev. numbers. + * + *Revision 2.1 1997/10/24 16:03:00 ivan + *added rflow (which allows enabling the CD1400 special flow control + *feature) and rtsdtr_inv (which allows DTR/RTS pin inversion) to + *cyclades_port structure; + *added Alpha support + * + *Revision 2.0 1997/06/30 10:30:00 ivan + *added some new doorbell command constants related to IOCTLW and + *UART error signaling + * + *Revision 1.8 1997/06/03 15:30:00 ivan + *added constant ZFIRM_HLT + *added constant CyPCI_Ze_win ( = 2 * Cy_PCI_Zwin) + * + *Revision 1.7 1997/03/26 10:30:00 daniel + *new entries at the end of cyclades_port struct to reallocate + *variables illegally allocated within card memory. + * + *Revision 1.6 1996/09/09 18:35:30 bentson + *fold in changes for Cyclom-Z -- including structures for + *communicating with board as well modest changes to original + *structures to support new features. + * + *Revision 1.5 1995/11/13 21:13:31 bentson + *changes suggested by Michael Chastain + *to support use of this file in non-kernel applications + * + * + */ + +#ifndef _LINUX_CYCLADES_H +#define _LINUX_CYCLADES_H + +#include + +struct cyclades_monitor { + unsigned long int_count; + unsigned long char_count; + unsigned long char_max; + unsigned long char_last; +}; + +/* + * These stats all reflect activity since the device was last initialized. + * (i.e., since the port was opened with no other processes already having it + * open) + */ +struct cyclades_idle_stats { + __kernel_time_t in_use; /* Time device has been in use (secs) */ + __kernel_time_t recv_idle; /* Time since last char received (secs) */ + __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */ + unsigned long recv_bytes; /* Bytes received */ + unsigned long xmit_bytes; /* Bytes transmitted */ + unsigned long overruns; /* Input overruns */ + unsigned long frame_errs; /* Input framing errors */ + unsigned long parity_errs; /* Input parity errors */ +}; + +#define CYCLADES_MAGIC 0x4359 + +#define CYGETMON 0x435901 +#define CYGETTHRESH 0x435902 +#define CYSETTHRESH 0x435903 +#define CYGETDEFTHRESH 0x435904 +#define CYSETDEFTHRESH 0x435905 +#define CYGETTIMEOUT 0x435906 +#define CYSETTIMEOUT 0x435907 +#define CYGETDEFTIMEOUT 0x435908 +#define CYSETDEFTIMEOUT 0x435909 +#define CYSETRFLOW 0x43590a +#define CYGETRFLOW 0x43590b +#define CYSETRTSDTR_INV 0x43590c +#define CYGETRTSDTR_INV 0x43590d +#define CYZSETPOLLCYCLE 0x43590e +#define CYZGETPOLLCYCLE 0x43590f +#define CYGETCD1400VER 0x435910 +#define CYSETWAIT 0x435912 +#define CYGETWAIT 0x435913 + +/*************** CYCLOM-Z ADDITIONS ***************/ + +#define CZIOC ('M' << 8) +#define CZ_NBOARDS (CZIOC|0xfa) +#define CZ_BOOT_START (CZIOC|0xfb) +#define CZ_BOOT_DATA (CZIOC|0xfc) +#define CZ_BOOT_END (CZIOC|0xfd) +#define CZ_TEST (CZIOC|0xfe) + +#define CZ_DEF_POLL (HZ/25) + +#define MAX_BOARD 4 /* Max number of boards */ +#define MAX_DEV 256 /* Max number of ports total */ +#define CYZ_MAX_SPEED 921600 + +#define CYZ_FIFO_SIZE 16 + +#define CYZ_BOOT_NWORDS 0x100 +struct CYZ_BOOT_CTRL { + unsigned short nboard; + int status[MAX_BOARD]; + int nchannel[MAX_BOARD]; + int fw_rev[MAX_BOARD]; + unsigned long offset; + unsigned long data[CYZ_BOOT_NWORDS]; +}; + + +#ifndef DP_WINDOW_SIZE +/* #include "cyclomz.h" */ +/****************** ****************** *******************/ +/* + * The data types defined below are used in all ZFIRM interface + * data structures. They accomodate differences between HW + * architectures and compilers. + */ + +typedef __u64 ucdouble; /* 64 bits, unsigned */ +typedef __u32 uclong; /* 32 bits, unsigned */ +typedef __u16 ucshort; /* 16 bits, unsigned */ +typedef __u8 ucchar; /* 8 bits, unsigned */ + +/* + * Memory Window Sizes + */ + +#define DP_WINDOW_SIZE (0x00080000) /* window size 512 Kb */ +#define ZE_DP_WINDOW_SIZE (0x00100000) /* window size 1 Mb (Ze and + 8Zo V.2 */ +#define CTRL_WINDOW_SIZE (0x00000080) /* runtime regs 128 bytes */ + +/* + * CUSTOM_REG - Cyclom-Z/PCI Custom Registers Set. The driver + * normally will access only interested on the fpga_id, fpga_version, + * start_cpu and stop_cpu. + */ + +struct CUSTOM_REG { + __u32 fpga_id; /* FPGA Identification Register */ + __u32 fpga_version; /* FPGA Version Number Register */ + __u32 cpu_start; /* CPU start Register (write) */ + __u32 cpu_stop; /* CPU stop Register (write) */ + __u32 misc_reg; /* Miscellaneous Register */ + __u32 idt_mode; /* IDT mode Register */ + __u32 uart_irq_status; /* UART IRQ status Register */ + __u32 clear_timer0_irq; /* Clear timer interrupt Register */ + __u32 clear_timer1_irq; /* Clear timer interrupt Register */ + __u32 clear_timer2_irq; /* Clear timer interrupt Register */ + __u32 test_register; /* Test Register */ + __u32 test_count; /* Test Count Register */ + __u32 timer_select; /* Timer select register */ + __u32 pr_uart_irq_status; /* Prioritized UART IRQ stat Reg */ + __u32 ram_wait_state; /* RAM wait-state Register */ + __u32 uart_wait_state; /* UART wait-state Register */ + __u32 timer_wait_state; /* timer wait-state Register */ + __u32 ack_wait_state; /* ACK wait State Register */ +}; + +/* + * RUNTIME_9060 - PLX PCI9060ES local configuration and shared runtime + * registers. This structure can be used to access the 9060 registers + * (memory mapped). + */ + +struct RUNTIME_9060 { + __u32 loc_addr_range; /* 00h - Local Address Range */ + __u32 loc_addr_base; /* 04h - Local Address Base */ + __u32 loc_arbitr; /* 08h - Local Arbitration */ + __u32 endian_descr; /* 0Ch - Big/Little Endian Descriptor */ + __u32 loc_rom_range; /* 10h - Local ROM Range */ + __u32 loc_rom_base; /* 14h - Local ROM Base */ + __u32 loc_bus_descr; /* 18h - Local Bus descriptor */ + __u32 loc_range_mst; /* 1Ch - Local Range for Master to PCI */ + __u32 loc_base_mst; /* 20h - Local Base for Master PCI */ + __u32 loc_range_io; /* 24h - Local Range for Master IO */ + __u32 pci_base_mst; /* 28h - PCI Base for Master PCI */ + __u32 pci_conf_io; /* 2Ch - PCI configuration for Master IO */ + __u32 filler1; /* 30h */ + __u32 filler2; /* 34h */ + __u32 filler3; /* 38h */ + __u32 filler4; /* 3Ch */ + __u32 mail_box_0; /* 40h - Mail Box 0 */ + __u32 mail_box_1; /* 44h - Mail Box 1 */ + __u32 mail_box_2; /* 48h - Mail Box 2 */ + __u32 mail_box_3; /* 4Ch - Mail Box 3 */ + __u32 filler5; /* 50h */ + __u32 filler6; /* 54h */ + __u32 filler7; /* 58h */ + __u32 filler8; /* 5Ch */ + __u32 pci_doorbell; /* 60h - PCI to Local Doorbell */ + __u32 loc_doorbell; /* 64h - Local to PCI Doorbell */ + __u32 intr_ctrl_stat; /* 68h - Interrupt Control/Status */ + __u32 init_ctrl; /* 6Ch - EEPROM control, Init Control, etc */ +}; + +/* Values for the Local Base Address re-map register */ + +#define WIN_RAM 0x00000001L /* set the sliding window to RAM */ +#define WIN_CREG 0x14000001L /* set the window to custom Registers */ + +/* Values timer select registers */ + +#define TIMER_BY_1M 0x00 /* clock divided by 1M */ +#define TIMER_BY_256K 0x01 /* clock divided by 256k */ +#define TIMER_BY_128K 0x02 /* clock divided by 128k */ +#define TIMER_BY_32K 0x03 /* clock divided by 32k */ + +/****************** ****************** *******************/ +#endif + +#ifndef ZFIRM_ID +/* #include "zfwint.h" */ +/****************** ****************** *******************/ +/* + * This file contains the definitions for interfacing with the + * Cyclom-Z ZFIRM Firmware. + */ + +/* General Constant definitions */ + +#define MAX_CHAN 64 /* max number of channels per board */ + +/* firmware id structure (set after boot) */ + +#define ID_ADDRESS 0x00000180L /* signature/pointer address */ +#define ZFIRM_ID 0x5557465AL /* ZFIRM/U signature */ +#define ZFIRM_HLT 0x59505B5CL /* ZFIRM needs external power supply */ +#define ZFIRM_RST 0x56040674L /* RST signal (due to FW reset) */ + +#define ZF_TINACT_DEF 1000 /* default inactivity timeout + (1000 ms) */ +#define ZF_TINACT ZF_TINACT_DEF + +struct FIRM_ID { + __u32 signature; /* ZFIRM/U signature */ + __u32 zfwctrl_addr; /* pointer to ZFW_CTRL structure */ +}; + +/* Op. System id */ + +#define C_OS_LINUX 0x00000030 /* generic Linux system */ + +/* channel op_mode */ + +#define C_CH_DISABLE 0x00000000 /* channel is disabled */ +#define C_CH_TXENABLE 0x00000001 /* channel Tx enabled */ +#define C_CH_RXENABLE 0x00000002 /* channel Rx enabled */ +#define C_CH_ENABLE 0x00000003 /* channel Tx/Rx enabled */ +#define C_CH_LOOPBACK 0x00000004 /* Loopback mode */ + +/* comm_parity - parity */ + +#define C_PR_NONE 0x00000000 /* None */ +#define C_PR_ODD 0x00000001 /* Odd */ +#define C_PR_EVEN 0x00000002 /* Even */ +#define C_PR_MARK 0x00000004 /* Mark */ +#define C_PR_SPACE 0x00000008 /* Space */ +#define C_PR_PARITY 0x000000ff + +#define C_PR_DISCARD 0x00000100 /* discard char with frame/par error */ +#define C_PR_IGNORE 0x00000200 /* ignore frame/par error */ + +/* comm_data_l - data length and stop bits */ + +#define C_DL_CS5 0x00000001 +#define C_DL_CS6 0x00000002 +#define C_DL_CS7 0x00000004 +#define C_DL_CS8 0x00000008 +#define C_DL_CS 0x0000000f +#define C_DL_1STOP 0x00000010 +#define C_DL_15STOP 0x00000020 +#define C_DL_2STOP 0x00000040 +#define C_DL_STOP 0x000000f0 + +/* interrupt enabling/status */ + +#define C_IN_DISABLE 0x00000000 /* zero, disable interrupts */ +#define C_IN_TXBEMPTY 0x00000001 /* tx buffer empty */ +#define C_IN_TXLOWWM 0x00000002 /* tx buffer below LWM */ +#define C_IN_RXHIWM 0x00000010 /* rx buffer above HWM */ +#define C_IN_RXNNDT 0x00000020 /* rx no new data timeout */ +#define C_IN_MDCD 0x00000100 /* modem DCD change */ +#define C_IN_MDSR 0x00000200 /* modem DSR change */ +#define C_IN_MRI 0x00000400 /* modem RI change */ +#define C_IN_MCTS 0x00000800 /* modem CTS change */ +#define C_IN_RXBRK 0x00001000 /* Break received */ +#define C_IN_PR_ERROR 0x00002000 /* parity error */ +#define C_IN_FR_ERROR 0x00004000 /* frame error */ +#define C_IN_OVR_ERROR 0x00008000 /* overrun error */ +#define C_IN_RXOFL 0x00010000 /* RX buffer overflow */ +#define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */ +#define C_IN_MRTS 0x00040000 /* modem RTS drop */ +#define C_IN_ICHAR 0x00080000 + +/* flow control */ + +#define C_FL_OXX 0x00000001 /* output Xon/Xoff flow control */ +#define C_FL_IXX 0x00000002 /* output Xon/Xoff flow control */ +#define C_FL_OIXANY 0x00000004 /* output Xon/Xoff (any xon) */ +#define C_FL_SWFLOW 0x0000000f + +/* flow status */ + +#define C_FS_TXIDLE 0x00000000 /* no Tx data in the buffer or UART */ +#define C_FS_SENDING 0x00000001 /* UART is sending data */ +#define C_FS_SWFLOW 0x00000002 /* Tx is stopped by received Xoff */ + +/* rs_control/rs_status RS-232 signals */ + +#define C_RS_PARAM 0x80000000 /* Indicates presence of parameter in + IOCTLM command */ +#define C_RS_RTS 0x00000001 /* RTS */ +#define C_RS_DTR 0x00000004 /* DTR */ +#define C_RS_DCD 0x00000100 /* CD */ +#define C_RS_DSR 0x00000200 /* DSR */ +#define C_RS_RI 0x00000400 /* RI */ +#define C_RS_CTS 0x00000800 /* CTS */ + +/* commands Host <-> Board */ + +#define C_CM_RESET 0x01 /* reset/flush buffers */ +#define C_CM_IOCTL 0x02 /* re-read CH_CTRL */ +#define C_CM_IOCTLW 0x03 /* re-read CH_CTRL, intr when done */ +#define C_CM_IOCTLM 0x04 /* RS-232 outputs change */ +#define C_CM_SENDXOFF 0x10 /* send Xoff */ +#define C_CM_SENDXON 0x11 /* send Xon */ +#define C_CM_CLFLOW 0x12 /* Clear flow control (resume) */ +#define C_CM_SENDBRK 0x41 /* send break */ +#define C_CM_INTBACK 0x42 /* Interrupt back */ +#define C_CM_SET_BREAK 0x43 /* Tx break on */ +#define C_CM_CLR_BREAK 0x44 /* Tx break off */ +#define C_CM_CMD_DONE 0x45 /* Previous command done */ +#define C_CM_INTBACK2 0x46 /* Alternate Interrupt back */ +#define C_CM_TINACT 0x51 /* set inactivity detection */ +#define C_CM_IRQ_ENBL 0x52 /* enable generation of interrupts */ +#define C_CM_IRQ_DSBL 0x53 /* disable generation of interrupts */ +#define C_CM_ACK_ENBL 0x54 /* enable acknowledged interrupt mode */ +#define C_CM_ACK_DSBL 0x55 /* disable acknowledged intr mode */ +#define C_CM_FLUSH_RX 0x56 /* flushes Rx buffer */ +#define C_CM_FLUSH_TX 0x57 /* flushes Tx buffer */ +#define C_CM_Q_ENABLE 0x58 /* enables queue access from the + driver */ +#define C_CM_Q_DISABLE 0x59 /* disables queue access from the + driver */ + +#define C_CM_TXBEMPTY 0x60 /* Tx buffer is empty */ +#define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */ +#define C_CM_RXHIWM 0x62 /* Rx buffer high water mark */ +#define C_CM_RXNNDT 0x63 /* rx no new data timeout */ +#define C_CM_TXFEMPTY 0x64 +#define C_CM_ICHAR 0x65 +#define C_CM_MDCD 0x70 /* modem DCD change */ +#define C_CM_MDSR 0x71 /* modem DSR change */ +#define C_CM_MRI 0x72 /* modem RI change */ +#define C_CM_MCTS 0x73 /* modem CTS change */ +#define C_CM_MRTS 0x74 /* modem RTS drop */ +#define C_CM_RXBRK 0x84 /* Break received */ +#define C_CM_PR_ERROR 0x85 /* Parity error */ +#define C_CM_FR_ERROR 0x86 /* Frame error */ +#define C_CM_OVR_ERROR 0x87 /* Overrun error */ +#define C_CM_RXOFL 0x88 /* RX buffer overflow */ +#define C_CM_CMDERROR 0x90 /* command error */ +#define C_CM_FATAL 0x91 /* fatal error */ +#define C_CM_HW_RESET 0x92 /* reset board */ + +/* + * CH_CTRL - This per port structure contains all parameters + * that control an specific port. It can be seen as the + * configuration registers of a "super-serial-controller". + */ + +struct CH_CTRL { + __u32 op_mode; /* operation mode */ + __u32 intr_enable; /* interrupt masking */ + __u32 sw_flow; /* SW flow control */ + __u32 flow_status; /* output flow status */ + __u32 comm_baud; /* baud rate - numerically specified */ + __u32 comm_parity; /* parity */ + __u32 comm_data_l; /* data length/stop */ + __u32 comm_flags; /* other flags */ + __u32 hw_flow; /* HW flow control */ + __u32 rs_control; /* RS-232 outputs */ + __u32 rs_status; /* RS-232 inputs */ + __u32 flow_xon; /* xon char */ + __u32 flow_xoff; /* xoff char */ + __u32 hw_overflow; /* hw overflow counter */ + __u32 sw_overflow; /* sw overflow counter */ + __u32 comm_error; /* frame/parity error counter */ + __u32 ichar; + __u32 filler[7]; +}; + + +/* + * BUF_CTRL - This per channel structure contains + * all Tx and Rx buffer control for a given channel. + */ + +struct BUF_CTRL { + __u32 flag_dma; /* buffers are in Host memory */ + __u32 tx_bufaddr; /* address of the tx buffer */ + __u32 tx_bufsize; /* tx buffer size */ + __u32 tx_threshold; /* tx low water mark */ + __u32 tx_get; /* tail index tx buf */ + __u32 tx_put; /* head index tx buf */ + __u32 rx_bufaddr; /* address of the rx buffer */ + __u32 rx_bufsize; /* rx buffer size */ + __u32 rx_threshold; /* rx high water mark */ + __u32 rx_get; /* tail index rx buf */ + __u32 rx_put; /* head index rx buf */ + __u32 filler[5]; /* filler to align structures */ +}; + +/* + * BOARD_CTRL - This per board structure contains all global + * control fields related to the board. + */ + +struct BOARD_CTRL { + + /* static info provided by the on-board CPU */ + __u32 n_channel; /* number of channels */ + __u32 fw_version; /* firmware version */ + + /* static info provided by the driver */ + __u32 op_system; /* op_system id */ + __u32 dr_version; /* driver version */ + + /* board control area */ + __u32 inactivity; /* inactivity control */ + + /* host to FW commands */ + __u32 hcmd_channel; /* channel number */ + __u32 hcmd_param; /* pointer to parameters */ + + /* FW to Host commands */ + __u32 fwcmd_channel; /* channel number */ + __u32 fwcmd_param; /* pointer to parameters */ + __u32 zf_int_queue_addr; /* offset for INT_QUEUE structure */ + + /* filler so the structures are aligned */ + __u32 filler[6]; +}; + +/* Host Interrupt Queue */ + +#define QUEUE_SIZE (10*MAX_CHAN) + +struct INT_QUEUE { + unsigned char intr_code[QUEUE_SIZE]; + unsigned long channel[QUEUE_SIZE]; + unsigned long param[QUEUE_SIZE]; + unsigned long put; + unsigned long get; +}; + +/* + * ZFW_CTRL - This is the data structure that includes all other + * data structures used by the Firmware. + */ + +struct ZFW_CTRL { + struct BOARD_CTRL board_ctrl; + struct CH_CTRL ch_ctrl[MAX_CHAN]; + struct BUF_CTRL buf_ctrl[MAX_CHAN]; +}; + +/****************** ****************** *******************/ +#endif + +#endif /* _LINUX_CYCLADES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cycx_cfm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cycx_cfm.h new file mode 100644 index 0000000..032d26e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/cycx_cfm.h @@ -0,0 +1,101 @@ +/* +* cycx_cfm.h Cyclom 2X WAN Link Driver. +* Definitions for the Cyclom 2X Firmware Module (CFM). +* +* Author: Arnaldo Carvalho de Melo +* +* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo +* +* Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* 1998/08/08 acme Initial version. +*/ +#ifndef _CYCX_CFM_H +#define _CYCX_CFM_H + +/* Defines */ + +#define CFM_VERSION 2 +#define CFM_SIGNATURE "CFM - Cyclades CYCX Firmware Module" + +/* min/max */ +#define CFM_IMAGE_SIZE 0x20000 /* max size of CYCX code image file */ +#define CFM_DESCR_LEN 256 /* max length of description string */ +#define CFM_MAX_CYCX 1 /* max number of compatible adapters */ +#define CFM_LOAD_BUFSZ 0x400 /* buffer size for reset code (buffer_load) */ + +/* Firmware Commands */ +#define GEN_POWER_ON 0x1280 + +#define GEN_SET_SEG 0x1401 /* boot segment setting. */ +#define GEN_BOOT_DAT 0x1402 /* boot data. */ +#define GEN_START 0x1403 /* board start. */ +#define GEN_DEFPAR 0x1404 /* buffer length for boot. */ + +/* Adapter Types */ +#define CYCX_2X 2 +/* for now only the 2X is supported, no plans to support 8X or 16X */ +#define CYCX_8X 8 +#define CYCX_16X 16 + +#define CFID_X25_2X 5200 + +/** + * struct cycx_fw_info - firmware module information. + * @codeid - firmware ID + * @version - firmware version number + * @adapter - compatible adapter types + * @memsize - minimum memory size + * @reserved - reserved + * @startoffs - entry point offset + * @winoffs - dual-port memory window offset + * @codeoffs - code load offset + * @codesize - code size + * @dataoffs - configuration data load offset + * @datasize - configuration data size + */ +struct cycx_fw_info { + unsigned short codeid; + unsigned short version; + unsigned short adapter[CFM_MAX_CYCX]; + unsigned long memsize; + unsigned short reserved[2]; + unsigned short startoffs; + unsigned short winoffs; + unsigned short codeoffs; + unsigned long codesize; + unsigned short dataoffs; + unsigned long datasize; +}; + +/** + * struct cycx_firmware - CYCX firmware file structure + * @signature - CFM file signature + * @version - file format version + * @checksum - info + image + * @reserved - reserved + * @descr - description string + * @info - firmware module info + * @image - code image (variable size) + */ +struct cycx_firmware { + char signature[80]; + unsigned short version; + unsigned short checksum; + unsigned short reserved[6]; + char descr[CFM_DESCR_LEN]; + struct cycx_fw_info info; + unsigned char image[0]; +}; + +struct cycx_fw_header { + unsigned long reset_size; + unsigned long data_size; + unsigned long code_size; +}; +#endif /* _CYCX_CFM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dcbnl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dcbnl.h new file mode 100644 index 0000000..7d2e100 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dcbnl.h @@ -0,0 +1,342 @@ +/* + * Copyright (c) 2008, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * Author: Lucy Liu + */ + +#ifndef __LINUX_DCBNL_H__ +#define __LINUX_DCBNL_H__ + +#include + +#define DCB_PROTO_VERSION 1 + +struct dcbmsg { + __u8 dcb_family; + __u8 cmd; + __u16 dcb_pad; +}; + +/** + * enum dcbnl_commands - supported DCB commands + * + * @DCB_CMD_UNDEFINED: unspecified command to catch errors + * @DCB_CMD_GSTATE: request the state of DCB in the device + * @DCB_CMD_SSTATE: set the state of DCB in the device + * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx + * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx + * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx + * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx + * @DCB_CMD_PFC_GCFG: request the priority flow control configuration + * @DCB_CMD_PFC_SCFG: set the priority flow control configuration + * @DCB_CMD_SET_ALL: apply all changes to the underlying device + * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying + * device. Only useful when using bonding. + * @DCB_CMD_GCAP: request the DCB capabilities of the device + * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported + * @DCB_CMD_SNUMTCS: set the number of traffic classes + * @DCB_CMD_GBCN: set backward congestion notification configuration + * @DCB_CMD_SBCN: get backward congestion notification configration. + */ +enum dcbnl_commands { + DCB_CMD_UNDEFINED, + + DCB_CMD_GSTATE, + DCB_CMD_SSTATE, + + DCB_CMD_PGTX_GCFG, + DCB_CMD_PGTX_SCFG, + DCB_CMD_PGRX_GCFG, + DCB_CMD_PGRX_SCFG, + + DCB_CMD_PFC_GCFG, + DCB_CMD_PFC_SCFG, + + DCB_CMD_SET_ALL, + + DCB_CMD_GPERM_HWADDR, + + DCB_CMD_GCAP, + + DCB_CMD_GNUMTCS, + DCB_CMD_SNUMTCS, + + DCB_CMD_PFC_GSTATE, + DCB_CMD_PFC_SSTATE, + + DCB_CMD_BCN_GCFG, + DCB_CMD_BCN_SCFG, + + __DCB_CMD_ENUM_MAX, + DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, +}; + +/** + * enum dcbnl_attrs - DCB top-level netlink attributes + * + * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors + * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING) + * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8) + * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8) + * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED) + * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8) + * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED) + * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8) + * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED) + * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED) + * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED) + * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED) + */ +enum dcbnl_attrs { + DCB_ATTR_UNDEFINED, + + DCB_ATTR_IFNAME, + DCB_ATTR_STATE, + DCB_ATTR_PFC_STATE, + DCB_ATTR_PFC_CFG, + DCB_ATTR_NUM_TC, + DCB_ATTR_PG_CFG, + DCB_ATTR_SET_ALL, + DCB_ATTR_PERM_HWADDR, + DCB_ATTR_CAP, + DCB_ATTR_NUMTCS, + DCB_ATTR_BCN, + + __DCB_ATTR_ENUM_MAX, + DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, +}; + +/** + * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs + * + * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors + * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8) + * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8) + * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8) + * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8) + * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8) + * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8) + * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8) + * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8) + * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined + * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG) + * + */ +enum dcbnl_pfc_up_attrs { + DCB_PFC_UP_ATTR_UNDEFINED, + + DCB_PFC_UP_ATTR_0, + DCB_PFC_UP_ATTR_1, + DCB_PFC_UP_ATTR_2, + DCB_PFC_UP_ATTR_3, + DCB_PFC_UP_ATTR_4, + DCB_PFC_UP_ATTR_5, + DCB_PFC_UP_ATTR_6, + DCB_PFC_UP_ATTR_7, + DCB_PFC_UP_ATTR_ALL, + + __DCB_PFC_UP_ATTR_ENUM_MAX, + DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1, +}; + +/** + * enum dcbnl_pg_attrs - DCB Priority Group attributes + * + * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors + * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED) + * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED) + * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED) + * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED) + * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED) + * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED) + * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED) + * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED) + * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined + * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED) + * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8) + * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8) + * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8) + * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8) + * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8) + * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8) + * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8) + * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8) + * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined + * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG) + * + */ +enum dcbnl_pg_attrs { + DCB_PG_ATTR_UNDEFINED, + + DCB_PG_ATTR_TC_0, + DCB_PG_ATTR_TC_1, + DCB_PG_ATTR_TC_2, + DCB_PG_ATTR_TC_3, + DCB_PG_ATTR_TC_4, + DCB_PG_ATTR_TC_5, + DCB_PG_ATTR_TC_6, + DCB_PG_ATTR_TC_7, + DCB_PG_ATTR_TC_MAX, + DCB_PG_ATTR_TC_ALL, + + DCB_PG_ATTR_BW_ID_0, + DCB_PG_ATTR_BW_ID_1, + DCB_PG_ATTR_BW_ID_2, + DCB_PG_ATTR_BW_ID_3, + DCB_PG_ATTR_BW_ID_4, + DCB_PG_ATTR_BW_ID_5, + DCB_PG_ATTR_BW_ID_6, + DCB_PG_ATTR_BW_ID_7, + DCB_PG_ATTR_BW_ID_MAX, + DCB_PG_ATTR_BW_ID_ALL, + + __DCB_PG_ATTR_ENUM_MAX, + DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1, +}; + +/** + * enum dcbnl_tc_attrs - DCB Traffic Class attributes + * + * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors + * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to + * Valid values are: 0-7 + * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map + * Some devices may not support changing the + * user priority map of a TC. + * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting + * 0 - none + * 1 - group strict + * 2 - link strict + * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and + * not configured to use link strict priority, + * this is the percentage of bandwidth of the + * priority group this traffic class belongs to + * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters + * + */ +enum dcbnl_tc_attrs { + DCB_TC_ATTR_PARAM_UNDEFINED, + + DCB_TC_ATTR_PARAM_PGID, + DCB_TC_ATTR_PARAM_UP_MAPPING, + DCB_TC_ATTR_PARAM_STRICT_PRIO, + DCB_TC_ATTR_PARAM_BW_PCT, + DCB_TC_ATTR_PARAM_ALL, + + __DCB_TC_ATTR_PARAM_ENUM_MAX, + DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1, +}; + +/** + * enum dcbnl_cap_attrs - DCB Capability attributes + * + * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors + * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters + * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups + * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control + * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to + * traffic class mapping + * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a + * number of traffic classes the device + * can be configured to use for Priority Groups + * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a + * number of traffic classes the device can be + * configured to use for Priority Flow Control + * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority + * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion + * Notification + */ +enum dcbnl_cap_attrs { + DCB_CAP_ATTR_UNDEFINED, + DCB_CAP_ATTR_ALL, + DCB_CAP_ATTR_PG, + DCB_CAP_ATTR_PFC, + DCB_CAP_ATTR_UP2TC, + DCB_CAP_ATTR_PG_TCS, + DCB_CAP_ATTR_PFC_TCS, + DCB_CAP_ATTR_GSP, + DCB_CAP_ATTR_BCN, + + __DCB_CAP_ATTR_ENUM_MAX, + DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1, +}; + +/** + * enum dcbnl_numtcs_attrs - number of traffic classes + * + * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors + * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes + * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for + * priority groups + * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can + * support priority flow control + */ +enum dcbnl_numtcs_attrs { + DCB_NUMTCS_ATTR_UNDEFINED, + DCB_NUMTCS_ATTR_ALL, + DCB_NUMTCS_ATTR_PG, + DCB_NUMTCS_ATTR_PFC, + + __DCB_NUMTCS_ATTR_ENUM_MAX, + DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1, +}; + +enum dcbnl_bcn_attrs{ + DCB_BCN_ATTR_UNDEFINED = 0, + + DCB_BCN_ATTR_RP_0, + DCB_BCN_ATTR_RP_1, + DCB_BCN_ATTR_RP_2, + DCB_BCN_ATTR_RP_3, + DCB_BCN_ATTR_RP_4, + DCB_BCN_ATTR_RP_5, + DCB_BCN_ATTR_RP_6, + DCB_BCN_ATTR_RP_7, + DCB_BCN_ATTR_RP_ALL, + + DCB_BCN_ATTR_BCNA_0, + DCB_BCN_ATTR_BCNA_1, + DCB_BCN_ATTR_ALPHA, + DCB_BCN_ATTR_BETA, + DCB_BCN_ATTR_GD, + DCB_BCN_ATTR_GI, + DCB_BCN_ATTR_TMAX, + DCB_BCN_ATTR_TD, + DCB_BCN_ATTR_RMIN, + DCB_BCN_ATTR_W, + DCB_BCN_ATTR_RD, + DCB_BCN_ATTR_RU, + DCB_BCN_ATTR_WRTT, + DCB_BCN_ATTR_RI, + DCB_BCN_ATTR_C, + DCB_BCN_ATTR_ALL, + + __DCB_BCN_ATTR_ENUM_MAX, + DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1, +}; + +/** + * enum dcb_general_attr_values - general DCB attribute values + * + * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported + * + */ +enum dcb_general_attr_values { + DCB_ATTR_VALUE_UNDEFINED = 0xff +}; + + +#endif /* __LINUX_DCBNL_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dccp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dccp.h new file mode 100644 index 0000000..bdd6d4a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dccp.h @@ -0,0 +1,218 @@ +#ifndef _LINUX_DCCP_H +#define _LINUX_DCCP_H + +#include +#include + +/** + * struct dccp_hdr - generic part of DCCP packet header + * + * @dccph_sport - Relevant port on the endpoint that sent this packet + * @dccph_dport - Relevant port on the other endpoint + * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words + * @dccph_ccval - Used by the HC-Sender CCID + * @dccph_cscov - Parts of the packet that are covered by the Checksum field + * @dccph_checksum - Internet checksum, depends on dccph_cscov + * @dccph_x - 0 = 24 bit sequence number, 1 = 48 + * @dccph_type - packet type, see DCCP_PKT_ prefixed macros + * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x + */ +struct dccp_hdr { + __be16 dccph_sport, + dccph_dport; + __u8 dccph_doff; +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 dccph_cscov:4, + dccph_ccval:4; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 dccph_ccval:4, + dccph_cscov:4; +#else +#error "Adjust your defines" +#endif + __sum16 dccph_checksum; +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 dccph_x:1, + dccph_type:4, + dccph_reserved:3; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 dccph_reserved:3, + dccph_type:4, + dccph_x:1; +#else +#error "Adjust your defines" +#endif + __u8 dccph_seq2; + __be16 dccph_seq; +}; + +/** + * struct dccp_hdr_ext - the low bits of a 48 bit seq packet + * + * @dccph_seq_low - low 24 bits of a 48 bit seq packet + */ +struct dccp_hdr_ext { + __be32 dccph_seq_low; +}; + +/** + * struct dccp_hdr_request - Connection initiation request header + * + * @dccph_req_service - Service to which the client app wants to connect + */ +struct dccp_hdr_request { + __be32 dccph_req_service; +}; +/** + * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets + * + * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR + * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR + */ +struct dccp_hdr_ack_bits { + __be16 dccph_reserved1; + __be16 dccph_ack_nr_high; + __be32 dccph_ack_nr_low; +}; +/** + * struct dccp_hdr_response - Connection initiation response header + * + * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3) + * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request + */ +struct dccp_hdr_response { + struct dccp_hdr_ack_bits dccph_resp_ack; + __be32 dccph_resp_service; +}; + +/** + * struct dccp_hdr_reset - Unconditionally shut down a connection + * + * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6) + * @dccph_reset_code - one of %dccp_reset_codes + * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6 + */ +struct dccp_hdr_reset { + struct dccp_hdr_ack_bits dccph_reset_ack; + __u8 dccph_reset_code, + dccph_reset_data[3]; +}; + +enum dccp_pkt_type { + DCCP_PKT_REQUEST = 0, + DCCP_PKT_RESPONSE, + DCCP_PKT_DATA, + DCCP_PKT_ACK, + DCCP_PKT_DATAACK, + DCCP_PKT_CLOSEREQ, + DCCP_PKT_CLOSE, + DCCP_PKT_RESET, + DCCP_PKT_SYNC, + DCCP_PKT_SYNCACK, + DCCP_PKT_INVALID, +}; + +#define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID + +static __inline__ unsigned int dccp_packet_hdr_len(const __u8 type) +{ + if (type == DCCP_PKT_DATA) + return 0; + if (type == DCCP_PKT_DATAACK || + type == DCCP_PKT_ACK || + type == DCCP_PKT_SYNC || + type == DCCP_PKT_SYNCACK || + type == DCCP_PKT_CLOSE || + type == DCCP_PKT_CLOSEREQ) + return sizeof(struct dccp_hdr_ack_bits); + if (type == DCCP_PKT_REQUEST) + return sizeof(struct dccp_hdr_request); + if (type == DCCP_PKT_RESPONSE) + return sizeof(struct dccp_hdr_response); + return sizeof(struct dccp_hdr_reset); +} +enum dccp_reset_codes { + DCCP_RESET_CODE_UNSPECIFIED = 0, + DCCP_RESET_CODE_CLOSED, + DCCP_RESET_CODE_ABORTED, + DCCP_RESET_CODE_NO_CONNECTION, + DCCP_RESET_CODE_PACKET_ERROR, + DCCP_RESET_CODE_OPTION_ERROR, + DCCP_RESET_CODE_MANDATORY_ERROR, + DCCP_RESET_CODE_CONNECTION_REFUSED, + DCCP_RESET_CODE_BAD_SERVICE_CODE, + DCCP_RESET_CODE_TOO_BUSY, + DCCP_RESET_CODE_BAD_INIT_COOKIE, + DCCP_RESET_CODE_AGGRESSION_PENALTY, + + DCCP_MAX_RESET_CODES /* Leave at the end! */ +}; + +/* DCCP options */ +enum { + DCCPO_PADDING = 0, + DCCPO_MANDATORY = 1, + DCCPO_MIN_RESERVED = 3, + DCCPO_MAX_RESERVED = 31, + DCCPO_CHANGE_L = 32, + DCCPO_CONFIRM_L = 33, + DCCPO_CHANGE_R = 34, + DCCPO_CONFIRM_R = 35, + DCCPO_NDP_COUNT = 37, + DCCPO_ACK_VECTOR_0 = 38, + DCCPO_ACK_VECTOR_1 = 39, + DCCPO_TIMESTAMP = 41, + DCCPO_TIMESTAMP_ECHO = 42, + DCCPO_ELAPSED_TIME = 43, + DCCPO_MAX = 45, + DCCPO_MIN_CCID_SPECIFIC = 128, + DCCPO_MAX_CCID_SPECIFIC = 255, +}; +/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */ +#define DCCP_SINGLE_OPT_MAXLEN 253 + +/* DCCP CCIDS */ +enum { + DCCPC_CCID2 = 2, + DCCPC_CCID3 = 3, +}; + +/* DCCP features (RFC 4340 section 6.4) */ +enum dccp_feature_numbers { + DCCPF_RESERVED = 0, + DCCPF_CCID = 1, + DCCPF_SHORT_SEQNOS = 2, + DCCPF_SEQUENCE_WINDOW = 3, + DCCPF_ECN_INCAPABLE = 4, + DCCPF_ACK_RATIO = 5, + DCCPF_SEND_ACK_VECTOR = 6, + DCCPF_SEND_NDP_COUNT = 7, + DCCPF_MIN_CSUM_COVER = 8, + DCCPF_DATA_CHECKSUM = 9, + /* 10-127 reserved */ + DCCPF_MIN_CCID_SPECIFIC = 128, + DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */ + DCCPF_MAX_CCID_SPECIFIC = 255, +}; + +/* DCCP socket options */ +#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ +#define DCCP_SOCKOPT_SERVICE 2 +#define DCCP_SOCKOPT_CHANGE_L 3 +#define DCCP_SOCKOPT_CHANGE_R 4 +#define DCCP_SOCKOPT_GET_CUR_MPS 5 +#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 +#define DCCP_SOCKOPT_SEND_CSCOV 10 +#define DCCP_SOCKOPT_RECV_CSCOV 11 +#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12 +#define DCCP_SOCKOPT_CCID 13 +#define DCCP_SOCKOPT_TX_CCID 14 +#define DCCP_SOCKOPT_RX_CCID 15 +#define DCCP_SOCKOPT_CCID_RX_INFO 128 +#define DCCP_SOCKOPT_CCID_TX_INFO 192 + +/* maximum number of services provided on the same listening port */ +#define DCCP_SERVICE_LIST_MAX_LEN 32 + + +#endif /* _LINUX_DCCP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm.h new file mode 100644 index 0000000..2293367 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm.h @@ -0,0 +1,77 @@ +/****************************************************************************** +******************************************************************************* +** +** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. +** +** This copyrighted material is made available to anyone wishing to use, +** modify, copy, or redistribute it subject to the terms and conditions +** of the GNU General Public License v.2. +** +******************************************************************************* +******************************************************************************/ + +#ifndef __DLM_DOT_H__ +#define __DLM_DOT_H__ + +/* + * Interface to Distributed Lock Manager (DLM) + * routines and structures to use DLM lockspaces + */ + +/* Lock levels and flags are here */ +#include +#include + +typedef void dlm_lockspace_t; + +/* + * Lock status block + * + * Use this structure to specify the contents of the lock value block. For a + * conversion request, this structure is used to specify the lock ID of the + * lock. DLM writes the status of the lock request and the lock ID assigned + * to the request in the lock status block. + * + * sb_lkid: the returned lock ID. It is set on new (non-conversion) requests. + * It is available when dlm_lock returns. + * + * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules + * shown for the DLM_LKF_VALBLK flag. + * + * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock, + * it was first demoted to NL to avoid conversion deadlock. + * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid. + * + * sb_status: the returned status of the lock request set prior to AST + * execution. Possible return values: + * + * 0 if lock request was successful + * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE + * -ENOMEM if there is no memory to process request + * -EINVAL if there are invalid parameters + * -DLM_EUNLOCK if unlock request was successful + * -DLM_ECANCEL if a cancel completed successfully + */ + +#define DLM_SBF_DEMOTED 0x01 +#define DLM_SBF_VALNOTVALID 0x02 +#define DLM_SBF_ALTMODE 0x04 + +struct dlm_lksb { + int sb_status; + __u32 sb_lkid; + char sb_flags; + char * sb_lvbptr; +}; + +/* dlm_new_lockspace() flags */ + +#define DLM_LSFL_NODIR 0x00000001 +#define DLM_LSFL_TIMEWARN 0x00000002 +#define DLM_LSFL_FS 0x00000004 +#define DLM_LSFL_NEWEXCL 0x00000008 + + +#endif /* __DLM_DOT_H__ */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_device.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_device.h new file mode 100644 index 0000000..62d9ebf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_device.h @@ -0,0 +1,108 @@ +/****************************************************************************** +******************************************************************************* +** +** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +** +** This copyrighted material is made available to anyone wishing to use, +** modify, copy, or redistribute it subject to the terms and conditions +** of the GNU General Public License v.2. +** +******************************************************************************* +******************************************************************************/ + +#ifndef _LINUX_DLM_DEVICE_H +#define _LINUX_DLM_DEVICE_H + +/* This is the device interface for dlm, most users will use a library + * interface. + */ + +#include +#include + +#define DLM_USER_LVB_LEN 32 + +/* Version of the device interface */ +#define DLM_DEVICE_VERSION_MAJOR 6 +#define DLM_DEVICE_VERSION_MINOR 0 +#define DLM_DEVICE_VERSION_PATCH 1 + +/* struct passed to the lock write */ +struct dlm_lock_params { + __u8 mode; + __u8 namelen; + __u16 unused; + __u32 flags; + __u32 lkid; + __u32 parent; + __u64 xid; + __u64 timeout; + void *castparam; + void *castaddr; + void *bastparam; + void *bastaddr; + struct dlm_lksb *lksb; + char lvb[DLM_USER_LVB_LEN]; + char name[0]; +}; + +struct dlm_lspace_params { + __u32 flags; + __u32 minor; + char name[0]; +}; + +struct dlm_purge_params { + __u32 nodeid; + __u32 pid; +}; + +struct dlm_write_request { + __u32 version[3]; + __u8 cmd; + __u8 is64bit; + __u8 unused[2]; + + union { + struct dlm_lock_params lock; + struct dlm_lspace_params lspace; + struct dlm_purge_params purge; + } i; +}; + +struct dlm_device_version { + __u32 version[3]; +}; + +/* struct read from the "device" fd, + consists mainly of userspace pointers for the library to use */ + +struct dlm_lock_result { + __u32 version[3]; + __u32 length; + void * user_astaddr; + void * user_astparam; + struct dlm_lksb * user_lksb; + struct dlm_lksb lksb; + __u8 bast_mode; + __u8 unused[3]; + /* Offsets may be zero if no data is present */ + __u32 lvb_offset; +}; + +/* Commands passed to the device */ +#define DLM_USER_LOCK 1 +#define DLM_USER_UNLOCK 2 +#define DLM_USER_QUERY 3 +#define DLM_USER_CREATE_LOCKSPACE 4 +#define DLM_USER_REMOVE_LOCKSPACE 5 +#define DLM_USER_PURGE 6 +#define DLM_USER_DEADLOCK 7 + +/* Lockspace flags */ +#define DLM_USER_LSFLG_AUTOFREE 1 +#define DLM_USER_LSFLG_FORCEFREE 2 + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_netlink.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_netlink.h new file mode 100644 index 0000000..647c8ef --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_netlink.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + */ + +#ifndef _DLM_NETLINK_H +#define _DLM_NETLINK_H + +#include + +enum { + DLM_STATUS_WAITING = 1, + DLM_STATUS_GRANTED = 2, + DLM_STATUS_CONVERT = 3, +}; + +#define DLM_LOCK_DATA_VERSION 1 + +struct dlm_lock_data { + __u16 version; + __u32 lockspace_id; + int nodeid; + int ownpid; + __u32 id; + __u32 remid; + __u64 xid; + __s8 status; + __s8 grmode; + __s8 rqmode; + unsigned long timestamp; + int resource_namelen; + char resource_name[DLM_RESNAME_MAXLEN]; +}; + +enum { + DLM_CMD_UNSPEC = 0, + DLM_CMD_HELLO, /* user->kernel */ + DLM_CMD_TIMEOUT, /* kernel->user */ + __DLM_CMD_MAX, +}; + +#define DLM_CMD_MAX (__DLM_CMD_MAX - 1) + +enum { + DLM_TYPE_UNSPEC = 0, + DLM_TYPE_LOCK, + __DLM_TYPE_MAX, +}; + +#define DLM_TYPE_MAX (__DLM_TYPE_MAX - 1) + +#define DLM_GENL_VERSION 0x1 +#define DLM_GENL_NAME "DLM" + +#endif /* _DLM_NETLINK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_plock.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_plock.h new file mode 100644 index 0000000..9ea891a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlm_plock.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + */ + +#ifndef __DLM_PLOCK_DOT_H__ +#define __DLM_PLOCK_DOT_H__ + +#include + +#define DLM_PLOCK_MISC_NAME "dlm_plock" + +#define DLM_PLOCK_VERSION_MAJOR 1 +#define DLM_PLOCK_VERSION_MINOR 1 +#define DLM_PLOCK_VERSION_PATCH 0 + +enum { + DLM_PLOCK_OP_LOCK = 1, + DLM_PLOCK_OP_UNLOCK, + DLM_PLOCK_OP_GET, +}; + +struct dlm_plock_info { + __u32 version[3]; + __u8 optype; + __u8 ex; + __u8 wait; + __u8 pad; + __u32 pid; + __s32 nodeid; + __s32 rv; + __u32 fsid; + __u64 number; + __u64 start; + __u64 end; + __u64 owner; +}; + + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlmconstants.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlmconstants.h new file mode 100644 index 0000000..47bf08d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dlmconstants.h @@ -0,0 +1,163 @@ +/****************************************************************************** +******************************************************************************* +** +** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +** +** This copyrighted material is made available to anyone wishing to use, +** modify, copy, or redistribute it subject to the terms and conditions +** of the GNU General Public License v.2. +** +******************************************************************************* +******************************************************************************/ + +#ifndef __DLMCONSTANTS_DOT_H__ +#define __DLMCONSTANTS_DOT_H__ + +/* + * Constants used by DLM interface. + */ + +#define DLM_LOCKSPACE_LEN 64 +#define DLM_RESNAME_MAXLEN 64 + + +/* + * Lock Modes + */ + +#define DLM_LOCK_IV (-1) /* invalid */ +#define DLM_LOCK_NL 0 /* null */ +#define DLM_LOCK_CR 1 /* concurrent read */ +#define DLM_LOCK_CW 2 /* concurrent write */ +#define DLM_LOCK_PR 3 /* protected read */ +#define DLM_LOCK_PW 4 /* protected write */ +#define DLM_LOCK_EX 5 /* exclusive */ + + +/* + * Flags to dlm_lock + * + * DLM_LKF_NOQUEUE + * + * Do not queue the lock request on the wait queue if it cannot be granted + * immediately. If the lock cannot be granted because of this flag, DLM will + * either return -EAGAIN from the dlm_lock call or will return 0 from + * dlm_lock and -EAGAIN in the lock status block when the AST is executed. + * + * DLM_LKF_CANCEL + * + * Used to cancel a pending lock request or conversion. A converting lock is + * returned to its previously granted mode. + * + * DLM_LKF_CONVERT + * + * Indicates a lock conversion request. For conversions the name and namelen + * are ignored and the lock ID in the LKSB is used to identify the lock. + * + * DLM_LKF_VALBLK + * + * Requests DLM to return the current contents of the lock value block in the + * lock status block. When this flag is set in a lock conversion from PW or EX + * modes, DLM assigns the value specified in the lock status block to the lock + * value block of the lock resource. The LVB is a DLM_LVB_LEN size array + * containing application-specific information. + * + * DLM_LKF_QUECVT + * + * Force a conversion request to be queued, even if it is compatible with + * the granted modes of other locks on the same resource. + * + * DLM_LKF_IVVALBLK + * + * Invalidate the lock value block. + * + * DLM_LKF_CONVDEADLK + * + * Allows the dlm to resolve conversion deadlocks internally by demoting the + * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is + * returned for a conversion that's been effected by this. + * + * DLM_LKF_PERSISTENT + * + * Only relevant to locks originating in userspace. A persistent lock will not + * be removed if the process holding the lock exits. + * + * DLM_LKF_NODLCKWT + * + * Do not cancel the lock if it gets into conversion deadlock. + * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN. + * + * DLM_LKF_NODLCKBLK + * + * net yet implemented + * + * DLM_LKF_EXPEDITE + * + * Used only with new requests for NL mode locks. Tells the lock manager + * to grant the lock, ignoring other locks in convert and wait queues. + * + * DLM_LKF_NOQUEUEBAST + * + * Send blocking AST's before returning -EAGAIN to the caller. It is only + * used along with the NOQUEUE flag. Blocking AST's are not sent for failed + * NOQUEUE requests otherwise. + * + * DLM_LKF_HEADQUE + * + * Add a lock to the head of the convert or wait queue rather than the tail. + * + * DLM_LKF_NOORDER + * + * Disregard the standard grant order rules and grant a lock as soon as it + * is compatible with other granted locks. + * + * DLM_LKF_ORPHAN + * + * not yet implemented + * + * DLM_LKF_ALTPR + * + * If the requested mode cannot be granted immediately, try to grant the lock + * in PR mode instead. If this alternate mode is granted instead of the + * requested mode, DLM_SBF_ALTMODE is returned in the lksb. + * + * DLM_LKF_ALTCW + * + * The same as ALTPR, but the alternate mode is CW. + * + * DLM_LKF_FORCEUNLOCK + * + * Unlock the lock even if it is converting or waiting or has sublocks. + * Only really for use by the userland device.c code. + * + */ + +#define DLM_LKF_NOQUEUE 0x00000001 +#define DLM_LKF_CANCEL 0x00000002 +#define DLM_LKF_CONVERT 0x00000004 +#define DLM_LKF_VALBLK 0x00000008 +#define DLM_LKF_QUECVT 0x00000010 +#define DLM_LKF_IVVALBLK 0x00000020 +#define DLM_LKF_CONVDEADLK 0x00000040 +#define DLM_LKF_PERSISTENT 0x00000080 +#define DLM_LKF_NODLCKWT 0x00000100 +#define DLM_LKF_NODLCKBLK 0x00000200 +#define DLM_LKF_EXPEDITE 0x00000400 +#define DLM_LKF_NOQUEUEBAST 0x00000800 +#define DLM_LKF_HEADQUE 0x00001000 +#define DLM_LKF_NOORDER 0x00002000 +#define DLM_LKF_ORPHAN 0x00004000 +#define DLM_LKF_ALTPR 0x00008000 +#define DLM_LKF_ALTCW 0x00010000 +#define DLM_LKF_FORCEUNLOCK 0x00020000 +#define DLM_LKF_TIMEOUT 0x00040000 + +/* + * Some return codes that are not in errno.h + */ + +#define DLM_ECANCEL 0x10001 +#define DLM_EUNLOCK 0x10002 + +#endif /* __DLMCONSTANTS_DOT_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dm-ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dm-ioctl.h new file mode 100644 index 0000000..48e44ee --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dm-ioctl.h @@ -0,0 +1,302 @@ +/* + * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. + * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved. + * + * This file is released under the LGPL. + */ + +#ifndef _LINUX_DM_IOCTL_V4_H +#define _LINUX_DM_IOCTL_V4_H + +#include + +#define DM_DIR "mapper" /* Slashes not supported */ +#define DM_MAX_TYPE_NAME 16 +#define DM_NAME_LEN 128 +#define DM_UUID_LEN 129 + +/* + * A traditional ioctl interface for the device mapper. + * + * Each device can have two tables associated with it, an + * 'active' table which is the one currently used by io passing + * through the device, and an 'inactive' one which is a table + * that is being prepared as a replacement for the 'active' one. + * + * DM_VERSION: + * Just get the version information for the ioctl interface. + * + * DM_REMOVE_ALL: + * Remove all dm devices, destroy all tables. Only really used + * for debug. + * + * DM_LIST_DEVICES: + * Get a list of all the dm device names. + * + * DM_DEV_CREATE: + * Create a new device, neither the 'active' or 'inactive' table + * slots will be filled. The device will be in suspended state + * after creation, however any io to the device will get errored + * since it will be out-of-bounds. + * + * DM_DEV_REMOVE: + * Remove a device, destroy any tables. + * + * DM_DEV_RENAME: + * Rename a device. + * + * DM_SUSPEND: + * This performs both suspend and resume, depending which flag is + * passed in. + * Suspend: This command will not return until all pending io to + * the device has completed. Further io will be deferred until + * the device is resumed. + * Resume: It is no longer an error to issue this command on an + * unsuspended device. If a table is present in the 'inactive' + * slot, it will be moved to the active slot, then the old table + * from the active slot will be _destroyed_. Finally the device + * is resumed. + * + * DM_DEV_STATUS: + * Retrieves the status for the table in the 'active' slot. + * + * DM_DEV_WAIT: + * Wait for a significant event to occur to the device. This + * could either be caused by an event triggered by one of the + * targets of the table in the 'active' slot, or a table change. + * + * DM_TABLE_LOAD: + * Load a table into the 'inactive' slot for the device. The + * device does _not_ need to be suspended prior to this command. + * + * DM_TABLE_CLEAR: + * Destroy any table in the 'inactive' slot (ie. abort). + * + * DM_TABLE_DEPS: + * Return a set of device dependencies for the 'active' table. + * + * DM_TABLE_STATUS: + * Return the targets status for the 'active' table. + * + * DM_TARGET_MSG: + * Pass a message string to the target at a specific offset of a device. + * + * DM_DEV_SET_GEOMETRY: + * Set the geometry of a device by passing in a string in this format: + * + * "cylinders heads sectors_per_track start_sector" + * + * Beware that CHS geometry is nearly obsolete and only provided + * for compatibility with dm devices that can be booted by a PC + * BIOS. See struct hd_geometry for range limits. Also note that + * the geometry is erased if the device size changes. + */ + +/* + * All ioctl arguments consist of a single chunk of memory, with + * this structure at the start. If a uuid is specified any + * lookup (eg. for a DM_INFO) will be done on that, *not* the + * name. + */ +struct dm_ioctl { + /* + * The version number is made up of three parts: + * major - no backward or forward compatibility, + * minor - only backwards compatible, + * patch - both backwards and forwards compatible. + * + * All clients of the ioctl interface should fill in the + * version number of the interface that they were + * compiled with. + * + * All recognised ioctl commands (ie. those that don't + * return -ENOTTY) fill out this field, even if the + * command failed. + */ + __u32 version[3]; /* in/out */ + __u32 data_size; /* total size of data passed in + * including this struct */ + + __u32 data_start; /* offset to start of data + * relative to start of this struct */ + + __u32 target_count; /* in/out */ + __s32 open_count; /* out */ + __u32 flags; /* in/out */ + __u32 event_nr; /* in/out */ + __u32 padding; + + __u64 dev; /* in/out */ + + char name[DM_NAME_LEN]; /* device name */ + char uuid[DM_UUID_LEN]; /* unique identifier for + * the block device */ + char data[7]; /* padding or data */ +}; + +/* + * Used to specify tables. These structures appear after the + * dm_ioctl. + */ +struct dm_target_spec { + __u64 sector_start; + __u64 length; + __s32 status; /* used when reading from kernel only */ + + /* + * Location of the next dm_target_spec. + * - When specifying targets on a DM_TABLE_LOAD command, this value is + * the number of bytes from the start of the "current" dm_target_spec + * to the start of the "next" dm_target_spec. + * - When retrieving targets on a DM_TABLE_STATUS command, this value + * is the number of bytes from the start of the first dm_target_spec + * (that follows the dm_ioctl struct) to the start of the "next" + * dm_target_spec. + */ + __u32 next; + + char target_type[DM_MAX_TYPE_NAME]; + + /* + * Parameter string starts immediately after this object. + * Be careful to add padding after string to ensure correct + * alignment of subsequent dm_target_spec. + */ +}; + +/* + * Used to retrieve the target dependencies. + */ +struct dm_target_deps { + __u32 count; /* Array size */ + __u32 padding; /* unused */ + __u64 dev[0]; /* out */ +}; + +/* + * Used to get a list of all dm devices. + */ +struct dm_name_list { + __u64 dev; + __u32 next; /* offset to the next record from + the _start_ of this */ + char name[0]; +}; + +/* + * Used to retrieve the target versions + */ +struct dm_target_versions { + __u32 next; + __u32 version[3]; + + char name[0]; +}; + +/* + * Used to pass message to a target + */ +struct dm_target_msg { + __u64 sector; /* Device sector */ + + char message[0]; +}; + +/* + * If you change this make sure you make the corresponding change + * to dm-ioctl.c:lookup_ioctl() + */ +enum { + /* Top level cmds */ + DM_VERSION_CMD = 0, + DM_REMOVE_ALL_CMD, + DM_LIST_DEVICES_CMD, + + /* device level cmds */ + DM_DEV_CREATE_CMD, + DM_DEV_REMOVE_CMD, + DM_DEV_RENAME_CMD, + DM_DEV_SUSPEND_CMD, + DM_DEV_STATUS_CMD, + DM_DEV_WAIT_CMD, + + /* Table level cmds */ + DM_TABLE_LOAD_CMD, + DM_TABLE_CLEAR_CMD, + DM_TABLE_DEPS_CMD, + DM_TABLE_STATUS_CMD, + + /* Added later */ + DM_LIST_VERSIONS_CMD, + DM_TARGET_MSG_CMD, + DM_DEV_SET_GEOMETRY_CMD +}; + +#define DM_IOCTL 0xfd + +#define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl) +#define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl) +#define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl) + +#define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl) +#define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl) +#define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl) +#define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl) +#define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl) +#define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl) + +#define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl) +#define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl) +#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl) +#define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl) + +#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) + +#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) +#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) + +#define DM_VERSION_MAJOR 4 +#define DM_VERSION_MINOR 14 +#define DM_VERSION_PATCHLEVEL 0 +#define DM_VERSION_EXTRA "-ioctl (2008-04-23)" + +/* Status bits */ +#define DM_READONLY_FLAG (1 << 0) /* In/Out */ +#define DM_SUSPEND_FLAG (1 << 1) /* In/Out */ +#define DM_PERSISTENT_DEV_FLAG (1 << 3) /* In */ + +/* + * Flag passed into ioctl STATUS command to get table information + * rather than current status. + */ +#define DM_STATUS_TABLE_FLAG (1 << 4) /* In */ + +/* + * Flags that indicate whether a table is present in either of + * the two table slots that a device has. + */ +#define DM_ACTIVE_PRESENT_FLAG (1 << 5) /* Out */ +#define DM_INACTIVE_PRESENT_FLAG (1 << 6) /* Out */ + +/* + * Indicates that the buffer passed in wasn't big enough for the + * results. + */ +#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ + +/* + * This flag is now ignored. + */ +#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ + +/* + * Set this to avoid attempting to freeze any filesystem when suspending. + */ +#define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */ + +/* + * Set this to suspend without flushing queued ios. + */ +#define DM_NOFLUSH_FLAG (1 << 11) /* In */ + +#endif /* _LINUX_DM_IOCTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dn.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dn.h new file mode 100644 index 0000000..fe99908 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dn.h @@ -0,0 +1,149 @@ +#ifndef _LINUX_DN_H +#define _LINUX_DN_H + +#include + +/* + + DECnet Data Structures and Constants + +*/ + +/* + * DNPROTO_NSP can't be the same as SOL_SOCKET, + * so increment each by one (compared to ULTRIX) + */ +#define DNPROTO_NSP 2 /* NSP protocol number */ +#define DNPROTO_ROU 3 /* Routing protocol number */ +#define DNPROTO_NML 4 /* Net mgt protocol number */ +#define DNPROTO_EVL 5 /* Evl protocol number (usr) */ +#define DNPROTO_EVR 6 /* Evl protocol number (evl) */ +#define DNPROTO_NSPT 7 /* NSP trace protocol number */ + + +#define DN_ADDL 2 +#define DN_MAXADDL 2 /* ULTRIX headers have 20 here, but pathworks has 2 */ +#define DN_MAXOPTL 16 +#define DN_MAXOBJL 16 +#define DN_MAXACCL 40 +#define DN_MAXALIASL 128 +#define DN_MAXNODEL 256 +#define DNBUFSIZE 65023 + +/* + * SET/GET Socket options - must match the DSO_ numbers below + */ +#define SO_CONDATA 1 +#define SO_CONACCESS 2 +#define SO_PROXYUSR 3 +#define SO_LINKINFO 7 + +#define DSO_CONDATA 1 /* Set/Get connect data */ +#define DSO_DISDATA 10 /* Set/Get disconnect data */ +#define DSO_CONACCESS 2 /* Set/Get connect access data */ +#define DSO_ACCEPTMODE 4 /* Set/Get accept mode */ +#define DSO_CONACCEPT 5 /* Accept deferred connection */ +#define DSO_CONREJECT 6 /* Reject deferred connection */ +#define DSO_LINKINFO 7 /* Set/Get link information */ +#define DSO_STREAM 8 /* Set socket type to stream */ +#define DSO_SEQPACKET 9 /* Set socket type to sequenced packet */ +#define DSO_MAXWINDOW 11 /* Maximum window size allowed */ +#define DSO_NODELAY 12 /* Turn off nagle */ +#define DSO_CORK 13 /* Wait for more data! */ +#define DSO_SERVICES 14 /* NSP Services field */ +#define DSO_INFO 15 /* NSP Info field */ +#define DSO_MAX 15 /* Maximum option number */ + + +/* LINK States */ +#define LL_INACTIVE 0 +#define LL_CONNECTING 1 +#define LL_RUNNING 2 +#define LL_DISCONNECTING 3 + +#define ACC_IMMED 0 +#define ACC_DEFER 1 + +#define SDF_WILD 1 /* Wild card object */ +#define SDF_PROXY 2 /* Addr eligible for proxy */ +#define SDF_UICPROXY 4 /* Use uic-based proxy */ + +/* Structures */ + + +struct dn_naddr +{ + __le16 a_len; + __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */ +}; + +struct sockaddr_dn +{ + __u16 sdn_family; + __u8 sdn_flags; + __u8 sdn_objnum; + __le16 sdn_objnamel; + __u8 sdn_objname[DN_MAXOBJL]; + struct dn_naddr sdn_add; +}; +#define sdn_nodeaddrl sdn_add.a_len /* Node address length */ +#define sdn_nodeaddr sdn_add.a_addr /* Node address */ + + + +/* + * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure + */ +struct optdata_dn { + __le16 opt_status; /* Extended status return */ +#define opt_sts opt_status + __le16 opt_optl; /* Length of user data */ + __u8 opt_data[16]; /* User data */ +}; + +struct accessdata_dn +{ + __u8 acc_accl; + __u8 acc_acc[DN_MAXACCL]; + __u8 acc_passl; + __u8 acc_pass[DN_MAXACCL]; + __u8 acc_userl; + __u8 acc_user[DN_MAXACCL]; +}; + +/* + * DECnet logical link information structure + */ +struct linkinfo_dn { + __u16 idn_segsize; /* Segment size for link */ + __u8 idn_linkstate; /* Logical link state */ +}; + +/* + * Ethernet address format (for DECnet) + */ +union etheraddress { + __u8 dne_addr[6]; /* Full ethernet address */ + struct { + __u8 dne_hiord[4]; /* DECnet HIORD prefix */ + __u8 dne_nodeaddr[2]; /* DECnet node address */ + } dne_remote; +}; + + +/* + * DECnet physical socket address format + */ +struct dn_addr { + __le16 dna_family; /* AF_DECnet */ + union etheraddress dna_netaddr; /* DECnet ethernet address */ +}; + +#define DECNET_IOCTL_BASE 0x89 /* PROTOPRIVATE range */ + +#define SIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, struct dn_naddr) +#define SIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, struct dn_naddr) +#define OSIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, int) +#define OSIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, int) + +#endif /* _LINUX_DN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dqblk_xfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dqblk_xfs.h new file mode 100644 index 0000000..527504c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dqblk_xfs.h @@ -0,0 +1,157 @@ +/* + * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesset General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef _LINUX_DQBLK_XFS_H +#define _LINUX_DQBLK_XFS_H + +#include + +/* + * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM). + */ + +#define XQM_CMD(x) (('X'<<8)+(x)) /* note: forms first QCMD argument */ +#define XQM_COMMAND(x) (((x) & (0xff<<8)) == ('X'<<8)) /* test if for XFS */ + +#define XQM_USRQUOTA 0 /* system call user quota type */ +#define XQM_GRPQUOTA 1 /* system call group quota type */ +#define XQM_PRJQUOTA 2 /* system call project quota type */ +#define XQM_MAXQUOTAS 3 + +#define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */ +#define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */ +#define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */ +#define Q_XSETQLIM XQM_CMD(4) /* set disk limits */ +#define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ +#define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ +#define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */ + +/* + * fs_disk_quota structure: + * + * This contains the current quota information regarding a user/proj/group. + * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of + * 512 bytes. + */ +#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ +typedef struct fs_disk_quota { + __s8 d_version; /* version of this structure */ + __s8 d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ + __u16 d_fieldmask; /* field specifier */ + __u32 d_id; /* user, project, or group ID */ + __u64 d_blk_hardlimit;/* absolute limit on disk blks */ + __u64 d_blk_softlimit;/* preferred limit on disk blks */ + __u64 d_ino_hardlimit;/* maximum # allocated inodes */ + __u64 d_ino_softlimit;/* preferred inode limit */ + __u64 d_bcount; /* # disk blocks owned by the user */ + __u64 d_icount; /* # inodes owned by the user */ + __s32 d_itimer; /* zero if within inode limits */ + /* if not, we refuse service */ + __s32 d_btimer; /* similar to above; for disk blocks */ + __u16 d_iwarns; /* # warnings issued wrt num inodes */ + __u16 d_bwarns; /* # warnings issued wrt disk blocks */ + __s32 d_padding2; /* padding2 - for future use */ + __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */ + __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */ + __u64 d_rtbcount; /* # realtime blocks owned */ + __s32 d_rtbtimer; /* similar to above; for RT disk blks */ + __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */ + __s16 d_padding3; /* padding3 - for future use */ + char d_padding4[8]; /* yet more padding */ +} fs_disk_quota_t; + +/* + * These fields are sent to Q_XSETQLIM to specify fields that need to change. + */ +#define FS_DQ_ISOFT (1<<0) +#define FS_DQ_IHARD (1<<1) +#define FS_DQ_BSOFT (1<<2) +#define FS_DQ_BHARD (1<<3) +#define FS_DQ_RTBSOFT (1<<4) +#define FS_DQ_RTBHARD (1<<5) +#define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ + FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) +/* + * These timers can only be set in super user's dquot. For others, timers are + * automatically started and stopped. Superusers timer values set the limits + * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values + * defined below are used. + * These values also apply only to the d_fieldmask field for Q_XSETQLIM. + */ +#define FS_DQ_BTIMER (1<<6) +#define FS_DQ_ITIMER (1<<7) +#define FS_DQ_RTBTIMER (1<<8) +#define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) + +/* + * Warning counts are set in both super user's dquot and others. For others, + * warnings are set/cleared by the administrators (or automatically by going + * below the soft limit). Superusers warning values set the warning limits + * for the rest. In case these values are zero, the DQ_{F,B}WARNLIMIT values + * defined below are used. + * These values also apply only to the d_fieldmask field for Q_XSETQLIM. + */ +#define FS_DQ_BWARNS (1<<9) +#define FS_DQ_IWARNS (1<<10) +#define FS_DQ_RTBWARNS (1<<11) +#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) + +/* + * Various flags related to quotactl(2). Only relevant to XFS filesystems. + */ +#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ +#define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ +#define XFS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ +#define XFS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ +#define XFS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */ +#define XFS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */ + +#define XFS_USER_QUOTA (1<<0) /* user quota type */ +#define XFS_PROJ_QUOTA (1<<1) /* project quota type */ +#define XFS_GROUP_QUOTA (1<<2) /* group quota type */ + +/* + * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. + * Provides a centralized way to get meta information about the quota subsystem. + * eg. space taken up for user and group quotas, number of dquots currently + * incore. + */ +#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ + +/* + * Some basic information about 'quota files'. + */ +typedef struct fs_qfilestat { + __u64 qfs_ino; /* inode number */ + __u64 qfs_nblks; /* number of BBs 512-byte-blks */ + __u32 qfs_nextents; /* number of extents */ +} fs_qfilestat_t; + +typedef struct fs_quota_stat { + __s8 qs_version; /* version number for future changes */ + __u16 qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ + __s8 qs_pad; /* unused */ + fs_qfilestat_t qs_uquota; /* user quota storage information */ + fs_qfilestat_t qs_gquota; /* group quota storage information */ + __u32 qs_incoredqs; /* number of dquots incore */ + __s32 qs_btimelimit; /* limit for blks timer */ + __s32 qs_itimelimit; /* limit for inodes timer */ + __s32 qs_rtbtimelimit;/* limit for rt blks timer */ + __u16 qs_bwarnlimit; /* limit for num warnings */ + __u16 qs_iwarnlimit; /* limit for num warnings */ +} fs_quota_stat_t; + +#endif /* _LINUX_DQBLK_XFS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/..install.cmd new file mode 100644 index 0000000..6a49916 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/dvb/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/dvb /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/dvb mips audio.h ca.h dmx.h frontend.h net.h osd.h version.h video.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/dvb /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/dvb mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/dvb/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/audio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/audio.h new file mode 100644 index 0000000..fec66bd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/audio.h @@ -0,0 +1,135 @@ +/* + * audio.h + * + * Copyright (C) 2000 Ralph Metzler + * & Marcus Metzler + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Lesser Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _DVBAUDIO_H_ +#define _DVBAUDIO_H_ + +#include + +typedef enum { + AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */ + AUDIO_SOURCE_MEMORY /* Select internal memory as the main source */ +} audio_stream_source_t; + + +typedef enum { + AUDIO_STOPPED, /* Device is stopped */ + AUDIO_PLAYING, /* Device is currently playing */ + AUDIO_PAUSED /* Device is paused */ +} audio_play_state_t; + + +typedef enum { + AUDIO_STEREO, + AUDIO_MONO_LEFT, + AUDIO_MONO_RIGHT, + AUDIO_MONO, + AUDIO_STEREO_SWAPPED +} audio_channel_select_t; + + +typedef struct audio_mixer { + unsigned int volume_left; + unsigned int volume_right; + // what else do we need? bass, pass-through, ... +} audio_mixer_t; + + +typedef struct audio_status { + int AV_sync_state; /* sync audio and video? */ + int mute_state; /* audio is muted */ + audio_play_state_t play_state; /* current playback state */ + audio_stream_source_t stream_source; /* current stream source */ + audio_channel_select_t channel_select; /* currently selected channel */ + int bypass_mode; /* pass on audio data to */ + audio_mixer_t mixer_state; /* current mixer state */ +} audio_status_t; /* separate decoder hardware */ + + +typedef +struct audio_karaoke{ /* if Vocal1 or Vocal2 are non-zero, they get mixed */ + int vocal1; /* into left and right t at 70% each */ + int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/ + int melody; /* mixed into the left channel and */ + /* Vocal2 into the right channel at 100% each. */ + /* if Melody is non-zero, the melody channel gets mixed*/ +} audio_karaoke_t; /* into left and right */ + + +typedef __u16 audio_attributes_t; +/* bits: descr. */ +/* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */ +/* 12 multichannel extension */ +/* 11-10 audio type (0=not spec, 1=language included) */ +/* 9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) */ +/* 7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit, */ +/* 5- 4 Sample frequency fs (0=48kHz, 1=96kHz) */ +/* 2- 0 number of audio channels (n+1 channels) */ + + +/* for GET_CAPABILITIES and SET_FORMAT, the latter should only set one bit */ +#define AUDIO_CAP_DTS 1 +#define AUDIO_CAP_LPCM 2 +#define AUDIO_CAP_MP1 4 +#define AUDIO_CAP_MP2 8 +#define AUDIO_CAP_MP3 16 +#define AUDIO_CAP_AAC 32 +#define AUDIO_CAP_OGG 64 +#define AUDIO_CAP_SDDS 128 +#define AUDIO_CAP_AC3 256 + +#define AUDIO_STOP _IO('o', 1) +#define AUDIO_PLAY _IO('o', 2) +#define AUDIO_PAUSE _IO('o', 3) +#define AUDIO_CONTINUE _IO('o', 4) +#define AUDIO_SELECT_SOURCE _IO('o', 5) +#define AUDIO_SET_MUTE _IO('o', 6) +#define AUDIO_SET_AV_SYNC _IO('o', 7) +#define AUDIO_SET_BYPASS_MODE _IO('o', 8) +#define AUDIO_CHANNEL_SELECT _IO('o', 9) +#define AUDIO_GET_STATUS _IOR('o', 10, audio_status_t) + +#define AUDIO_GET_CAPABILITIES _IOR('o', 11, unsigned int) +#define AUDIO_CLEAR_BUFFER _IO('o', 12) +#define AUDIO_SET_ID _IO('o', 13) +#define AUDIO_SET_MIXER _IOW('o', 14, audio_mixer_t) +#define AUDIO_SET_STREAMTYPE _IO('o', 15) +#define AUDIO_SET_EXT_ID _IO('o', 16) +#define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t) +#define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t) + +/** + * AUDIO_GET_PTS + * + * Read the 33 bit presentation time stamp as defined + * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. + * + * The PTS should belong to the currently played + * frame if possible, but may also be a value close to it + * like the PTS of the last decoded frame or the last PTS + * extracted by the PES parser. + */ +#define AUDIO_GET_PTS _IOR('o', 19, __u64) +#define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20) + +#endif /* _DVBAUDIO_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/ca.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/ca.h new file mode 100644 index 0000000..c18537f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/ca.h @@ -0,0 +1,90 @@ +/* + * ca.h + * + * Copyright (C) 2000 Ralph Metzler + * & Marcus Metzler + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Lesser Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _DVBCA_H_ +#define _DVBCA_H_ + +/* slot interface types and info */ + +typedef struct ca_slot_info { + int num; /* slot number */ + + int type; /* CA interface this slot supports */ +#define CA_CI 1 /* CI high level interface */ +#define CA_CI_LINK 2 /* CI link layer level interface */ +#define CA_CI_PHYS 4 /* CI physical layer level interface */ +#define CA_DESCR 8 /* built-in descrambler */ +#define CA_SC 128 /* simple smart card interface */ + + unsigned int flags; +#define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */ +#define CA_CI_MODULE_READY 2 +} ca_slot_info_t; + + +/* descrambler types and info */ + +typedef struct ca_descr_info { + unsigned int num; /* number of available descramblers (keys) */ + unsigned int type; /* type of supported scrambling system */ +#define CA_ECD 1 +#define CA_NDS 2 +#define CA_DSS 4 +} ca_descr_info_t; + +typedef struct ca_caps { + unsigned int slot_num; /* total number of CA card and module slots */ + unsigned int slot_type; /* OR of all supported types */ + unsigned int descr_num; /* total number of descrambler slots (keys) */ + unsigned int descr_type; /* OR of all supported types */ +} ca_caps_t; + +/* a message to/from a CI-CAM */ +typedef struct ca_msg { + unsigned int index; + unsigned int type; + unsigned int length; + unsigned char msg[256]; +} ca_msg_t; + +typedef struct ca_descr { + unsigned int index; + unsigned int parity; /* 0 == even, 1 == odd */ + unsigned char cw[8]; +} ca_descr_t; + +typedef struct ca_pid { + unsigned int pid; + int index; /* -1 == disable*/ +} ca_pid_t; + +#define CA_RESET _IO('o', 128) +#define CA_GET_CAP _IOR('o', 129, ca_caps_t) +#define CA_GET_SLOT_INFO _IOR('o', 130, ca_slot_info_t) +#define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t) +#define CA_GET_MSG _IOR('o', 132, ca_msg_t) +#define CA_SEND_MSG _IOW('o', 133, ca_msg_t) +#define CA_SET_DESCR _IOW('o', 134, ca_descr_t) +#define CA_SET_PID _IOW('o', 135, ca_pid_t) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/dmx.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/dmx.h new file mode 100644 index 0000000..a0e0d3f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/dmx.h @@ -0,0 +1,151 @@ +/* + * dmx.h + * + * Copyright (C) 2000 Marcus Metzler + * & Ralph Metzler + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _DVBDMX_H_ +#define _DVBDMX_H_ + +#include +#include + + +#define DMX_FILTER_SIZE 16 + +typedef enum +{ + DMX_OUT_DECODER, /* Streaming directly to decoder. */ + DMX_OUT_TAP, /* Output going to a memory buffer */ + /* (to be retrieved via the read command).*/ + DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */ + /* (to be retrieved by reading from the */ + /* logical DVR device). */ + DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */ +} dmx_output_t; + + +typedef enum +{ + DMX_IN_FRONTEND, /* Input from a front-end device. */ + DMX_IN_DVR /* Input from the logical DVR device. */ +} dmx_input_t; + + +typedef enum +{ + DMX_PES_AUDIO0, + DMX_PES_VIDEO0, + DMX_PES_TELETEXT0, + DMX_PES_SUBTITLE0, + DMX_PES_PCR0, + + DMX_PES_AUDIO1, + DMX_PES_VIDEO1, + DMX_PES_TELETEXT1, + DMX_PES_SUBTITLE1, + DMX_PES_PCR1, + + DMX_PES_AUDIO2, + DMX_PES_VIDEO2, + DMX_PES_TELETEXT2, + DMX_PES_SUBTITLE2, + DMX_PES_PCR2, + + DMX_PES_AUDIO3, + DMX_PES_VIDEO3, + DMX_PES_TELETEXT3, + DMX_PES_SUBTITLE3, + DMX_PES_PCR3, + + DMX_PES_OTHER +} dmx_pes_type_t; + +#define DMX_PES_AUDIO DMX_PES_AUDIO0 +#define DMX_PES_VIDEO DMX_PES_VIDEO0 +#define DMX_PES_TELETEXT DMX_PES_TELETEXT0 +#define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 +#define DMX_PES_PCR DMX_PES_PCR0 + + +typedef struct dmx_filter +{ + __u8 filter[DMX_FILTER_SIZE]; + __u8 mask[DMX_FILTER_SIZE]; + __u8 mode[DMX_FILTER_SIZE]; +} dmx_filter_t; + + +struct dmx_sct_filter_params +{ + __u16 pid; + dmx_filter_t filter; + __u32 timeout; + __u32 flags; +#define DMX_CHECK_CRC 1 +#define DMX_ONESHOT 2 +#define DMX_IMMEDIATE_START 4 +#define DMX_KERNEL_CLIENT 0x8000 +}; + + +struct dmx_pes_filter_params +{ + __u16 pid; + dmx_input_t input; + dmx_output_t output; + dmx_pes_type_t pes_type; + __u32 flags; +}; + +typedef struct dmx_caps { + __u32 caps; + int num_decoders; +} dmx_caps_t; + +typedef enum { + DMX_SOURCE_FRONT0 = 0, + DMX_SOURCE_FRONT1, + DMX_SOURCE_FRONT2, + DMX_SOURCE_FRONT3, + DMX_SOURCE_DVR0 = 16, + DMX_SOURCE_DVR1, + DMX_SOURCE_DVR2, + DMX_SOURCE_DVR3 +} dmx_source_t; + +struct dmx_stc { + unsigned int num; /* input : which STC? 0..N */ + unsigned int base; /* output: divisor for stc to get 90 kHz clock */ + __u64 stc; /* output: stc in 'base'*90 kHz units */ +}; + + +#define DMX_START _IO('o', 41) +#define DMX_STOP _IO('o', 42) +#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) +#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) +#define DMX_SET_BUFFER_SIZE _IO('o', 45) +#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) +#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) +#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) +#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) + +#endif /*_DVBDMX_H_*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/frontend.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/frontend.h new file mode 100644 index 0000000..51c8d2d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/frontend.h @@ -0,0 +1,385 @@ +/* + * frontend.h + * + * Copyright (C) 2000 Marcus Metzler + * Ralph Metzler + * Holger Waechtler + * Andre Draszik + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _DVBFRONTEND_H_ +#define _DVBFRONTEND_H_ + +#include + +typedef enum fe_type { + FE_QPSK, + FE_QAM, + FE_OFDM, + FE_ATSC +} fe_type_t; + + +typedef enum fe_caps { + FE_IS_STUPID = 0, + FE_CAN_INVERSION_AUTO = 0x1, + FE_CAN_FEC_1_2 = 0x2, + FE_CAN_FEC_2_3 = 0x4, + FE_CAN_FEC_3_4 = 0x8, + FE_CAN_FEC_4_5 = 0x10, + FE_CAN_FEC_5_6 = 0x20, + FE_CAN_FEC_6_7 = 0x40, + FE_CAN_FEC_7_8 = 0x80, + FE_CAN_FEC_8_9 = 0x100, + FE_CAN_FEC_AUTO = 0x200, + FE_CAN_QPSK = 0x400, + FE_CAN_QAM_16 = 0x800, + FE_CAN_QAM_32 = 0x1000, + FE_CAN_QAM_64 = 0x2000, + FE_CAN_QAM_128 = 0x4000, + FE_CAN_QAM_256 = 0x8000, + FE_CAN_QAM_AUTO = 0x10000, + FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, + FE_CAN_BANDWIDTH_AUTO = 0x40000, + FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, + FE_CAN_HIERARCHY_AUTO = 0x100000, + FE_CAN_8VSB = 0x200000, + FE_CAN_16VSB = 0x400000, + FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ + FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ + FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ + FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ + FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ +} fe_caps_t; + + +struct dvb_frontend_info { + char name[128]; + fe_type_t type; + __u32 frequency_min; + __u32 frequency_max; + __u32 frequency_stepsize; + __u32 frequency_tolerance; + __u32 symbol_rate_min; + __u32 symbol_rate_max; + __u32 symbol_rate_tolerance; /* ppm */ + __u32 notifier_delay; /* DEPRECATED */ + fe_caps_t caps; +}; + + +/** + * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for + * the meaning of this struct... + */ +struct dvb_diseqc_master_cmd { + __u8 msg [6]; /* { framing, address, command, data [3] } */ + __u8 msg_len; /* valid values are 3...6 */ +}; + + +struct dvb_diseqc_slave_reply { + __u8 msg [4]; /* { framing, data [3] } */ + __u8 msg_len; /* valid values are 0...4, 0 means no msg */ + int timeout; /* return from ioctl after timeout ms with */ +}; /* errorcode when no message was received */ + + +typedef enum fe_sec_voltage { + SEC_VOLTAGE_13, + SEC_VOLTAGE_18, + SEC_VOLTAGE_OFF +} fe_sec_voltage_t; + + +typedef enum fe_sec_tone_mode { + SEC_TONE_ON, + SEC_TONE_OFF +} fe_sec_tone_mode_t; + + +typedef enum fe_sec_mini_cmd { + SEC_MINI_A, + SEC_MINI_B +} fe_sec_mini_cmd_t; + + +typedef enum fe_status { + FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ + FE_HAS_CARRIER = 0x02, /* found a DVB signal */ + FE_HAS_VITERBI = 0x04, /* FEC is stable */ + FE_HAS_SYNC = 0x08, /* found sync bytes */ + FE_HAS_LOCK = 0x10, /* everything's working... */ + FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ + FE_REINIT = 0x40 /* frontend was reinitialized, */ +} fe_status_t; /* application is recommended to reset */ + /* DiSEqC, tone and parameters */ + +typedef enum fe_spectral_inversion { + INVERSION_OFF, + INVERSION_ON, + INVERSION_AUTO +} fe_spectral_inversion_t; + + +typedef enum fe_code_rate { + FEC_NONE = 0, + FEC_1_2, + FEC_2_3, + FEC_3_4, + FEC_4_5, + FEC_5_6, + FEC_6_7, + FEC_7_8, + FEC_8_9, + FEC_AUTO, + FEC_3_5, + FEC_9_10, +} fe_code_rate_t; + + +typedef enum fe_modulation { + QPSK, + QAM_16, + QAM_32, + QAM_64, + QAM_128, + QAM_256, + QAM_AUTO, + VSB_8, + VSB_16, + PSK_8, + APSK_16, + APSK_32, + DQPSK, +} fe_modulation_t; + +typedef enum fe_transmit_mode { + TRANSMISSION_MODE_2K, + TRANSMISSION_MODE_8K, + TRANSMISSION_MODE_AUTO +} fe_transmit_mode_t; + +typedef enum fe_bandwidth { + BANDWIDTH_8_MHZ, + BANDWIDTH_7_MHZ, + BANDWIDTH_6_MHZ, + BANDWIDTH_AUTO +} fe_bandwidth_t; + + +typedef enum fe_guard_interval { + GUARD_INTERVAL_1_32, + GUARD_INTERVAL_1_16, + GUARD_INTERVAL_1_8, + GUARD_INTERVAL_1_4, + GUARD_INTERVAL_AUTO +} fe_guard_interval_t; + + +typedef enum fe_hierarchy { + HIERARCHY_NONE, + HIERARCHY_1, + HIERARCHY_2, + HIERARCHY_4, + HIERARCHY_AUTO +} fe_hierarchy_t; + + +struct dvb_qpsk_parameters { + __u32 symbol_rate; /* symbol rate in Symbols per second */ + fe_code_rate_t fec_inner; /* forward error correction (see above) */ +}; + +struct dvb_qam_parameters { + __u32 symbol_rate; /* symbol rate in Symbols per second */ + fe_code_rate_t fec_inner; /* forward error correction (see above) */ + fe_modulation_t modulation; /* modulation type (see above) */ +}; + +struct dvb_vsb_parameters { + fe_modulation_t modulation; /* modulation type (see above) */ +}; + +struct dvb_ofdm_parameters { + fe_bandwidth_t bandwidth; + fe_code_rate_t code_rate_HP; /* high priority stream code rate */ + fe_code_rate_t code_rate_LP; /* low priority stream code rate */ + fe_modulation_t constellation; /* modulation type (see above) */ + fe_transmit_mode_t transmission_mode; + fe_guard_interval_t guard_interval; + fe_hierarchy_t hierarchy_information; +}; + + +struct dvb_frontend_parameters { + __u32 frequency; /* (absolute) frequency in Hz for QAM/OFDM/ATSC */ + /* intermediate frequency in kHz for QPSK */ + fe_spectral_inversion_t inversion; + union { + struct dvb_qpsk_parameters qpsk; + struct dvb_qam_parameters qam; + struct dvb_ofdm_parameters ofdm; + struct dvb_vsb_parameters vsb; + } u; +}; + + +struct dvb_frontend_event { + fe_status_t status; + struct dvb_frontend_parameters parameters; +}; + +/* S2API Commands */ +#define DTV_UNDEFINED 0 +#define DTV_TUNE 1 +#define DTV_CLEAR 2 +#define DTV_FREQUENCY 3 +#define DTV_MODULATION 4 +#define DTV_BANDWIDTH_HZ 5 +#define DTV_INVERSION 6 +#define DTV_DISEQC_MASTER 7 +#define DTV_SYMBOL_RATE 8 +#define DTV_INNER_FEC 9 +#define DTV_VOLTAGE 10 +#define DTV_TONE 11 +#define DTV_PILOT 12 +#define DTV_ROLLOFF 13 +#define DTV_DISEQC_SLAVE_REPLY 14 + +/* Basic enumeration set for querying unlimited capabilities */ +#define DTV_FE_CAPABILITY_COUNT 15 +#define DTV_FE_CAPABILITY 16 +#define DTV_DELIVERY_SYSTEM 17 + +#define DTV_API_VERSION 35 +#define DTV_API_VERSION 35 +#define DTV_CODE_RATE_HP 36 +#define DTV_CODE_RATE_LP 37 +#define DTV_GUARD_INTERVAL 38 +#define DTV_TRANSMISSION_MODE 39 +#define DTV_HIERARCHY 40 + +#define DTV_MAX_COMMAND DTV_HIERARCHY + +typedef enum fe_pilot { + PILOT_ON, + PILOT_OFF, + PILOT_AUTO, +} fe_pilot_t; + +typedef enum fe_rolloff { + ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ + ROLLOFF_20, + ROLLOFF_25, + ROLLOFF_AUTO, +} fe_rolloff_t; + +typedef enum fe_delivery_system { + SYS_UNDEFINED, + SYS_DVBC_ANNEX_AC, + SYS_DVBC_ANNEX_B, + SYS_DVBT, + SYS_DSS, + SYS_DVBS, + SYS_DVBS2, + SYS_DVBH, + SYS_ISDBT, + SYS_ISDBS, + SYS_ISDBC, + SYS_ATSC, + SYS_ATSCMH, + SYS_DMBTH, + SYS_CMMB, + SYS_DAB, +} fe_delivery_system_t; + +struct dtv_cmds_h { + char *name; /* A display name for debugging purposes */ + + __u32 cmd; /* A unique ID */ + + /* Flags */ + __u32 set:1; /* Either a set or get property */ + __u32 buffer:1; /* Does this property use the buffer? */ + __u32 reserved:30; /* Align */ +}; + +struct dtv_property { + __u32 cmd; + __u32 reserved[3]; + union { + __u32 data; + struct { + __u8 data[32]; + __u32 len; + __u32 reserved1[3]; + void *reserved2; + } buffer; + } u; + int result; +} __attribute__ ((packed)); + +/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ +#define DTV_IOCTL_MAX_MSGS 64 + +struct dtv_properties { + __u32 num; + struct dtv_property *props; +}; + +#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) +#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) + + +/** + * When set, this flag will disable any zigzagging or other "normal" tuning + * behaviour. Additionally, there will be no automatic monitoring of the lock + * status, and hence no frontend events will be generated. If a frontend device + * is closed, this flag will be automatically turned off when the device is + * reopened read-write. + */ +#define FE_TUNE_MODE_ONESHOT 0x01 + + +#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) + +#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) +#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) +#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) +#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ + +#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ +#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ +#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ + +#define FE_READ_STATUS _IOR('o', 69, fe_status_t) +#define FE_READ_BER _IOR('o', 70, __u32) +#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) +#define FE_READ_SNR _IOR('o', 72, __u16) +#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) + +#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) +#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) +#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ +#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) + +#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ + +#endif /*_DVBFRONTEND_H_*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/net.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/net.h new file mode 100644 index 0000000..f451e7e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/net.h @@ -0,0 +1,52 @@ +/* + * net.h + * + * Copyright (C) 2000 Marcus Metzler + * & Ralph Metzler + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _DVBNET_H_ +#define _DVBNET_H_ + +#include + +struct dvb_net_if { + __u16 pid; + __u16 if_num; + __u8 feedtype; +#define DVB_NET_FEEDTYPE_MPE 0 /* multi protocol encapsulation */ +#define DVB_NET_FEEDTYPE_ULE 1 /* ultra lightweight encapsulation */ +}; + + +#define NET_ADD_IF _IOWR('o', 52, struct dvb_net_if) +#define NET_REMOVE_IF _IO('o', 53) +#define NET_GET_IF _IOWR('o', 54, struct dvb_net_if) + + +/* binary compatibility cruft: */ +struct __dvb_net_if_old { + __u16 pid; + __u16 if_num; +}; +#define __NET_ADD_IF_OLD _IOWR('o', 52, struct __dvb_net_if_old) +#define __NET_GET_IF_OLD _IOWR('o', 54, struct __dvb_net_if_old) + + +#endif /*_DVBNET_H_*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/osd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/osd.h new file mode 100644 index 0000000..f28c7cb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/osd.h @@ -0,0 +1,144 @@ +/* + * osd.h + * + * Copyright (C) 2001 Ralph Metzler + * & Marcus Metzler + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Lesser Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _DVBOSD_H_ +#define _DVBOSD_H_ + + + +typedef enum { + // All functions return -2 on "not open" + OSD_Close=1, // () + // Disables OSD and releases the buffers + // returns 0 on success + OSD_Open, // (x0,y0,x1,y1,BitPerPixel[2/4/8](color&0x0F),mix[0..15](color&0xF0)) + // Opens OSD with this size and bit depth + // returns 0 on success, -1 on DRAM allocation error, -2 on "already open" + OSD_Show, // () + // enables OSD mode + // returns 0 on success + OSD_Hide, // () + // disables OSD mode + // returns 0 on success + OSD_Clear, // () + // Sets all pixel to color 0 + // returns 0 on success + OSD_Fill, // (color) + // Sets all pixel to color + // returns 0 on success + OSD_SetColor, // (color,R{x0},G{y0},B{x1},opacity{y1}) + // set palette entry to , and apply + // R,G,B: 0..255 + // R=Red, G=Green, B=Blue + // opacity=0: pixel opacity 0% (only video pixel shows) + // opacity=1..254: pixel opacity as specified in header + // opacity=255: pixel opacity 100% (only OSD pixel shows) + // returns 0 on success, -1 on error + OSD_SetPalette, // (firstcolor{color},lastcolor{x0},data) + // Set a number of entries in the palette + // sets the entries "firstcolor" through "lastcolor" from the array "data" + // data has 4 byte for each color: + // R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel + OSD_SetTrans, // (transparency{color}) + // Sets transparency of mixed pixel (0..15) + // returns 0 on success + OSD_SetPixel, // (x0,y0,color) + // sets pixel , to color number + // returns 0 on success, -1 on error + OSD_GetPixel, // (x0,y0) + // returns color number of pixel ,, or -1 + OSD_SetRow, // (x0,y0,x1,data) + // fills pixels x0,y through x1,y with the content of data[] + // returns 0 on success, -1 on clipping all pixel (no pixel drawn) + OSD_SetBlock, // (x0,y0,x1,y1,increment{color},data) + // fills pixels x0,y0 through x1,y1 with the content of data[] + // inc contains the width of one line in the data block, + // inc<=0 uses blockwidth as linewidth + // returns 0 on success, -1 on clipping all pixel + OSD_FillRow, // (x0,y0,x1,color) + // fills pixels x0,y through x1,y with the color + // returns 0 on success, -1 on clipping all pixel + OSD_FillBlock, // (x0,y0,x1,y1,color) + // fills pixels x0,y0 through x1,y1 with the color + // returns 0 on success, -1 on clipping all pixel + OSD_Line, // (x0,y0,x1,y1,color) + // draw a line from x0,y0 to x1,y1 with the color + // returns 0 on success + OSD_Query, // (x0,y0,x1,y1,xasp{color}}), yasp=11 + // fills parameters with the picture dimensions and the pixel aspect ratio + // returns 0 on success + OSD_Test, // () + // draws a test picture. for debugging purposes only + // returns 0 on success +// TODO: remove "test" in final version + OSD_Text, // (x0,y0,size,color,text) + OSD_SetWindow, // (x0) set window with number 0 + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _DVBVERSION_H_ +#define _DVBVERSION_H_ + +#define DVB_API_VERSION 5 +#define DVB_API_VERSION_MINOR 0 + +#endif /*_DVBVERSION_H_*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/video.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/video.h new file mode 100644 index 0000000..fec79a7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/dvb/video.h @@ -0,0 +1,272 @@ +/* + * video.h + * + * Copyright (C) 2000 Marcus Metzler + * & Ralph Metzler + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef _DVBVIDEO_H_ +#define _DVBVIDEO_H_ + +#include +#include +#include + +typedef enum { + VIDEO_FORMAT_4_3, /* Select 4:3 format */ + VIDEO_FORMAT_16_9, /* Select 16:9 format. */ + VIDEO_FORMAT_221_1 /* 2.21:1 */ +} video_format_t; + + +typedef enum { + VIDEO_SYSTEM_PAL, + VIDEO_SYSTEM_NTSC, + VIDEO_SYSTEM_PALN, + VIDEO_SYSTEM_PALNc, + VIDEO_SYSTEM_PALM, + VIDEO_SYSTEM_NTSC60, + VIDEO_SYSTEM_PAL60, + VIDEO_SYSTEM_PALM60 +} video_system_t; + + +typedef enum { + VIDEO_PAN_SCAN, /* use pan and scan format */ + VIDEO_LETTER_BOX, /* use letterbox format */ + VIDEO_CENTER_CUT_OUT /* use center cut out format */ +} video_displayformat_t; + +typedef struct { + int w; + int h; + video_format_t aspect_ratio; +} video_size_t; + +typedef enum { + VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ + VIDEO_SOURCE_MEMORY /* If this source is selected, the stream + comes from the user through the write + system call */ +} video_stream_source_t; + + +typedef enum { + VIDEO_STOPPED, /* Video is stopped */ + VIDEO_PLAYING, /* Video is currently playing */ + VIDEO_FREEZED /* Video is freezed */ +} video_play_state_t; + + +/* Decoder commands */ +#define VIDEO_CMD_PLAY (0) +#define VIDEO_CMD_STOP (1) +#define VIDEO_CMD_FREEZE (2) +#define VIDEO_CMD_CONTINUE (3) + +/* Flags for VIDEO_CMD_FREEZE */ +#define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0) + +/* Flags for VIDEO_CMD_STOP */ +#define VIDEO_CMD_STOP_TO_BLACK (1 << 0) +#define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1) + +/* Play input formats: */ +/* The decoder has no special format requirements */ +#define VIDEO_PLAY_FMT_NONE (0) +/* The decoder requires full GOPs */ +#define VIDEO_PLAY_FMT_GOP (1) + +/* The structure must be zeroed before use by the application + This ensures it can be extended safely in the future. */ +struct video_command { + __u32 cmd; + __u32 flags; + union { + struct { + __u64 pts; + } stop; + + struct { + /* 0 or 1000 specifies normal speed, + 1 specifies forward single stepping, + -1 specifies backward single stepping, + >1: playback at speed/1000 of the normal speed, + <-1: reverse playback at (-speed/1000) of the normal speed. */ + __s32 speed; + __u32 format; + } play; + + struct { + __u32 data[16]; + } raw; + }; +}; + +/* FIELD_UNKNOWN can be used if the hardware does not know whether + the Vsync is for an odd, even or progressive (i.e. non-interlaced) + field. */ +#define VIDEO_VSYNC_FIELD_UNKNOWN (0) +#define VIDEO_VSYNC_FIELD_ODD (1) +#define VIDEO_VSYNC_FIELD_EVEN (2) +#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) + +struct video_event { + __s32 type; +#define VIDEO_EVENT_SIZE_CHANGED 1 +#define VIDEO_EVENT_FRAME_RATE_CHANGED 2 +#define VIDEO_EVENT_DECODER_STOPPED 3 +#define VIDEO_EVENT_VSYNC 4 + __kernel_time_t timestamp; + union { + video_size_t size; + unsigned int frame_rate; /* in frames per 1000sec */ + unsigned char vsync_field; /* unknown/odd/even/progressive */ + } u; +}; + + +struct video_status { + int video_blank; /* blank video on freeze? */ + video_play_state_t play_state; /* current state of playback */ + video_stream_source_t stream_source; /* current source (demux/memory) */ + video_format_t video_format; /* current aspect ratio of stream*/ + video_displayformat_t display_format;/* selected cropping mode */ +}; + + +struct video_still_picture { + char *iFrame; /* pointer to a single iframe in memory */ + __s32 size; +}; + + +typedef +struct video_highlight { + int active; /* 1=show highlight, 0=hide highlight */ + __u8 contrast1; /* 7- 4 Pattern pixel contrast */ + /* 3- 0 Background pixel contrast */ + __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */ + /* 3- 0 Emphasis pixel-1 contrast */ + __u8 color1; /* 7- 4 Pattern pixel color */ + /* 3- 0 Background pixel color */ + __u8 color2; /* 7- 4 Emphasis pixel-2 color */ + /* 3- 0 Emphasis pixel-1 color */ + __u32 ypos; /* 23-22 auto action mode */ + /* 21-12 start y */ + /* 9- 0 end y */ + __u32 xpos; /* 23-22 button color number */ + /* 21-12 start x */ + /* 9- 0 end x */ +} video_highlight_t; + + +typedef struct video_spu { + int active; + int stream_id; +} video_spu_t; + + +typedef struct video_spu_palette { /* SPU Palette information */ + int length; + __u8 *palette; +} video_spu_palette_t; + + +typedef struct video_navi_pack { + int length; /* 0 ... 1024 */ + __u8 data[1024]; +} video_navi_pack_t; + + +typedef __u16 video_attributes_t; +/* bits: descr. */ +/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ +/* 13-12 TV system (0=525/60, 1=625/50) */ +/* 11-10 Aspect ratio (0=4:3, 3=16:9) */ +/* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */ +/* 7 line 21-1 data present in GOP (1=yes, 0=no) */ +/* 6 line 21-2 data present in GOP (1=yes, 0=no) */ +/* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ +/* 2 source letterboxed (1=yes, 0=no) */ +/* 0 film/camera mode (0=camera, 1=film (625/50 only)) */ + + +/* bit definitions for capabilities: */ +/* can the hardware decode MPEG1 and/or MPEG2? */ +#define VIDEO_CAP_MPEG1 1 +#define VIDEO_CAP_MPEG2 2 +/* can you send a system and/or program stream to video device? + (you still have to open the video and the audio device but only + send the stream to the video device) */ +#define VIDEO_CAP_SYS 4 +#define VIDEO_CAP_PROG 8 +/* can the driver also handle SPU, NAVI and CSS encoded data? + (CSS API is not present yet) */ +#define VIDEO_CAP_SPU 16 +#define VIDEO_CAP_NAVI 32 +#define VIDEO_CAP_CSS 64 + + +#define VIDEO_STOP _IO('o', 21) +#define VIDEO_PLAY _IO('o', 22) +#define VIDEO_FREEZE _IO('o', 23) +#define VIDEO_CONTINUE _IO('o', 24) +#define VIDEO_SELECT_SOURCE _IO('o', 25) +#define VIDEO_SET_BLANK _IO('o', 26) +#define VIDEO_GET_STATUS _IOR('o', 27, struct video_status) +#define VIDEO_GET_EVENT _IOR('o', 28, struct video_event) +#define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29) +#define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture) +#define VIDEO_FAST_FORWARD _IO('o', 31) +#define VIDEO_SLOWMOTION _IO('o', 32) +#define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int) +#define VIDEO_CLEAR_BUFFER _IO('o', 34) +#define VIDEO_SET_ID _IO('o', 35) +#define VIDEO_SET_STREAMTYPE _IO('o', 36) +#define VIDEO_SET_FORMAT _IO('o', 37) +#define VIDEO_SET_SYSTEM _IO('o', 38) +#define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t) +#define VIDEO_SET_SPU _IOW('o', 50, video_spu_t) +#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t) +#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t) +#define VIDEO_SET_ATTRIBUTES _IO('o', 53) +#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) +#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int) + +/** + * VIDEO_GET_PTS + * + * Read the 33 bit presentation time stamp as defined + * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. + * + * The PTS should belong to the currently played + * frame if possible, but may also be a value close to it + * like the PTS of the last decoded frame or the last PTS + * extracted by the PES parser. + */ +#define VIDEO_GET_PTS _IOR('o', 57, __u64) + +/* Read the number of displayed frames since the decoder was started */ +#define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64) + +#define VIDEO_COMMAND _IOWR('o', 59, struct video_command) +#define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command) + +#endif /*_DVBVIDEO_H_*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/edd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/edd.h new file mode 100644 index 0000000..31c2b12 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/edd.h @@ -0,0 +1,191 @@ +/* + * linux/include/linux/edd.h + * Copyright (C) 2002, 2003, 2004 Dell Inc. + * by Matt Domsch + * + * structures and definitions for the int 13h, ax={41,48}h + * BIOS Enhanced Disk Drive Services + * This is based on the T13 group document D1572 Revision 0 (August 14 2002) + * available at http://www.t13.org/docs2002/d1572r0.pdf. It is + * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf + * + * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch + * table in the boot_params that contains a list of BIOS-enumerated + * boot devices. + * In arch/{i386,x86_64}/kernel/setup.c, this information is + * transferred into the edd structure, and in drivers/firmware/edd.c, that + * information is used to identify BIOS boot disk. The code in setup.S + * is very sensitive to the size of these structures. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License v2.0 as published by + * the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#ifndef _LINUX_EDD_H +#define _LINUX_EDD_H + +#include + +#define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF + in boot_params - treat this as 1 byte */ +#define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */ +#define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */ +#define EDDEXTSIZE 8 /* change these if you muck with the structures */ +#define EDDPARMSIZE 74 +#define CHECKEXTENSIONSPRESENT 0x41 +#define GETDEVICEPARAMETERS 0x48 +#define LEGACYGETDEVICEPARAMETERS 0x08 +#define EDDMAGIC1 0x55AA +#define EDDMAGIC2 0xAA55 + + +#define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */ +#define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */ +#define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */ +#define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */ +#define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF + in boot_params - treat this as 1 byte */ + +#ifndef __ASSEMBLY__ + +#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0) +#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1) +#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2) +#define EDD_EXT_64BIT_EXTENSIONS (1 << 3) + +#define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0) +#define EDD_INFO_GEOMETRY_VALID (1 << 1) +#define EDD_INFO_REMOVABLE (1 << 2) +#define EDD_INFO_WRITE_VERIFY (1 << 3) +#define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4) +#define EDD_INFO_LOCKABLE (1 << 5) +#define EDD_INFO_NO_MEDIA_PRESENT (1 << 6) +#define EDD_INFO_USE_INT13_FN50 (1 << 7) + +struct edd_device_params { + __u16 length; + __u16 info_flags; + __u32 num_default_cylinders; + __u32 num_default_heads; + __u32 sectors_per_track; + __u64 number_of_sectors; + __u16 bytes_per_sector; + __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */ + __u16 key; /* = 0xBEDD */ + __u8 device_path_info_length; /* = 44 */ + __u8 reserved2; + __u16 reserved3; + __u8 host_bus_type[4]; + __u8 interface_type[8]; + union { + struct { + __u16 base_address; + __u16 reserved1; + __u32 reserved2; + } __attribute__ ((packed)) isa; + struct { + __u8 bus; + __u8 slot; + __u8 function; + __u8 channel; + __u32 reserved; + } __attribute__ ((packed)) pci; + /* pcix is same as pci */ + struct { + __u64 reserved; + } __attribute__ ((packed)) ibnd; + struct { + __u64 reserved; + } __attribute__ ((packed)) xprs; + struct { + __u64 reserved; + } __attribute__ ((packed)) htpt; + struct { + __u64 reserved; + } __attribute__ ((packed)) unknown; + } interface_path; + union { + struct { + __u8 device; + __u8 reserved1; + __u16 reserved2; + __u32 reserved3; + __u64 reserved4; + } __attribute__ ((packed)) ata; + struct { + __u8 device; + __u8 lun; + __u8 reserved1; + __u8 reserved2; + __u32 reserved3; + __u64 reserved4; + } __attribute__ ((packed)) atapi; + struct { + __u16 id; + __u64 lun; + __u16 reserved1; + __u32 reserved2; + } __attribute__ ((packed)) scsi; + struct { + __u64 serial_number; + __u64 reserved; + } __attribute__ ((packed)) usb; + struct { + __u64 eui; + __u64 reserved; + } __attribute__ ((packed)) i1394; + struct { + __u64 wwid; + __u64 lun; + } __attribute__ ((packed)) fibre; + struct { + __u64 identity_tag; + __u64 reserved; + } __attribute__ ((packed)) i2o; + struct { + __u32 array_number; + __u32 reserved1; + __u64 reserved2; + } __attribute__ ((packed)) raid; + struct { + __u8 device; + __u8 reserved1; + __u16 reserved2; + __u32 reserved3; + __u64 reserved4; + } __attribute__ ((packed)) sata; + struct { + __u64 reserved1; + __u64 reserved2; + } __attribute__ ((packed)) unknown; + } device_path; + __u8 reserved4; + __u8 checksum; +} __attribute__ ((packed)); + +struct edd_info { + __u8 device; + __u8 version; + __u16 interface_support; + __u16 legacy_max_cylinder; + __u8 legacy_max_head; + __u8 legacy_sectors_per_track; + struct edd_device_params params; +} __attribute__ ((packed)); + +struct edd { + unsigned int mbr_signature[EDD_MBR_SIG_MAX]; + struct edd_info edd_info[EDDMAXNR]; + unsigned char mbr_signature_nr; + unsigned char edd_info_nr; +}; + +#endif /*!__ASSEMBLY__ */ + +#endif /* _LINUX_EDD_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/efs_fs_sb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/efs_fs_sb.h new file mode 100644 index 0000000..a01be90 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/efs_fs_sb.h @@ -0,0 +1,62 @@ +/* + * efs_fs_sb.h + * + * Copyright (c) 1999 Al Smith + * + * Portions derived from IRIX header files (c) 1988 Silicon Graphics + */ + +#ifndef __EFS_FS_SB_H__ +#define __EFS_FS_SB_H__ + +#include +#include + +/* EFS superblock magic numbers */ +#define EFS_MAGIC 0x072959 +#define EFS_NEWMAGIC 0x07295a + +#define IS_EFS_MAGIC(x) ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC)) + +#define EFS_SUPER 1 +#define EFS_ROOTINODE 2 + +/* efs superblock on disk */ +struct efs_super { + __be32 fs_size; /* size of filesystem, in sectors */ + __be32 fs_firstcg; /* bb offset to first cg */ + __be32 fs_cgfsize; /* size of cylinder group in bb's */ + __be16 fs_cgisize; /* bb's of inodes per cylinder group */ + __be16 fs_sectors; /* sectors per track */ + __be16 fs_heads; /* heads per cylinder */ + __be16 fs_ncg; /* # of cylinder groups in filesystem */ + __be16 fs_dirty; /* fs needs to be fsck'd */ + __be32 fs_time; /* last super-block update */ + __be32 fs_magic; /* magic number */ + char fs_fname[6]; /* file system name */ + char fs_fpack[6]; /* file system pack name */ + __be32 fs_bmsize; /* size of bitmap in bytes */ + __be32 fs_tfree; /* total free data blocks */ + __be32 fs_tinode; /* total free inodes */ + __be32 fs_bmblock; /* bitmap location. */ + __be32 fs_replsb; /* Location of replicated superblock. */ + __be32 fs_lastialloc; /* last allocated inode */ + char fs_spare[20]; /* space for expansion - MUST BE ZERO */ + __be32 fs_checksum; /* checksum of volume portion of fs */ +}; + +/* efs superblock information in memory */ +struct efs_sb_info { + __u32 fs_magic; /* superblock magic number */ + __u32 fs_start; /* first block of filesystem */ + __u32 first_block; /* first data block in filesystem */ + __u32 total_blocks; /* total number of blocks in filesystem */ + __u32 group_size; /* # of blocks a group consists of */ + __u32 data_free; /* # of free data blocks */ + __u32 inode_free; /* # of free inodes */ + __u16 inode_blocks; /* # of blocks used for inodes in every grp */ + __u16 total_groups; /* # of groups */ +}; + +#endif /* __EFS_FS_SB_H__ */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf-em.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf-em.h new file mode 100644 index 0000000..18bea78 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf-em.h @@ -0,0 +1,55 @@ +#ifndef _LINUX_ELF_EM_H +#define _LINUX_ELF_EM_H + +/* These constants define the various ELF target machines */ +#define EM_NONE 0 +#define EM_M32 1 +#define EM_SPARC 2 +#define EM_386 3 +#define EM_68K 4 +#define EM_88K 5 +#define EM_486 6 /* Perhaps disused */ +#define EM_860 7 +#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ + /* Next two are historical and binaries and + modules of these types will be rejected by + Linux. */ +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ + +#define EM_PARISC 15 /* HPPA */ +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ +#define EM_PPC 20 /* PowerPC */ +#define EM_PPC64 21 /* PowerPC64 */ +#define EM_SPU 23 /* Cell BE SPU */ +#define EM_SH 42 /* SuperH */ +#define EM_SPARCV9 43 /* SPARC v9 64-bit */ +#define EM_IA_64 50 /* HP/Intel IA-64 */ +#define EM_X86_64 62 /* AMD x86-64 */ +#define EM_S390 22 /* IBM S/390 */ +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ +#define EM_V850 87 /* NEC v850 */ +#define EM_M32R 88 /* Renesas M32R */ +#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ +#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ +#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ +#define EM_FRV 0x5441 /* Fujitsu FR-V */ +#define EM_AVR32 0x18ad /* Atmel AVR32 */ + +/* + * This is an interim value that we will use until the committee comes + * up with a final number. + */ +#define EM_ALPHA 0x9026 + +/* Bogus old v850 magic number, used by old tools. */ +#define EM_CYGNUS_V850 0x9080 +/* Bogus old m32r magic number, used by old tools. */ +#define EM_CYGNUS_M32R 0x9041 +/* This is the old interim value for S/390 architecture */ +#define EM_S390_OLD 0xA390 +/* Also Panasonic/MEI MN10300, AM33 */ +#define EM_CYGNUS_MN10300 0xbeef + + +#endif /* _LINUX_ELF_EM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf-fdpic.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf-fdpic.h new file mode 100644 index 0000000..f52f635 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf-fdpic.h @@ -0,0 +1,62 @@ +/* elf-fdpic.h: FDPIC ELF load map + * + * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_ELF_FDPIC_H +#define _LINUX_ELF_FDPIC_H + +#include + +#define PT_GNU_STACK (PT_LOOS + 0x474e551) + +/* segment mappings for ELF FDPIC libraries/executables/interpreters */ +struct elf32_fdpic_loadseg { + Elf32_Addr addr; /* core address to which mapped */ + Elf32_Addr p_vaddr; /* VMA recorded in file */ + Elf32_Word p_memsz; /* allocation size recorded in file */ +}; + +struct elf32_fdpic_loadmap { + Elf32_Half version; /* version of these structures, just in case... */ + Elf32_Half nsegs; /* number of segments */ + struct elf32_fdpic_loadseg segs[]; +}; + +#define ELF32_FDPIC_LOADMAP_VERSION 0x0000 + +/* + * binfmt binary parameters structure + */ +struct elf_fdpic_params { + struct elfhdr hdr; /* ref copy of ELF header */ + struct elf_phdr *phdrs; /* ref copy of PT_PHDR table */ + struct elf32_fdpic_loadmap *loadmap; /* loadmap to be passed to userspace */ + unsigned long elfhdr_addr; /* mapped ELF header user address */ + unsigned long ph_addr; /* mapped PT_PHDR user address */ + unsigned long map_addr; /* mapped loadmap user address */ + unsigned long entry_addr; /* mapped entry user address */ + unsigned long stack_size; /* stack size requested (PT_GNU_STACK) */ + unsigned long dynamic_addr; /* mapped PT_DYNAMIC user address */ + unsigned long load_addr; /* user address at which to map binary */ + unsigned long flags; +#define ELF_FDPIC_FLAG_ARRANGEMENT 0x0000000f /* PT_LOAD arrangement flags */ +#define ELF_FDPIC_FLAG_INDEPENDENT 0x00000000 /* PT_LOADs can be put anywhere */ +#define ELF_FDPIC_FLAG_HONOURVADDR 0x00000001 /* PT_LOAD.vaddr must be honoured */ +#define ELF_FDPIC_FLAG_CONSTDISP 0x00000002 /* PT_LOADs require constant + * displacement */ +#define ELF_FDPIC_FLAG_CONTIGUOUS 0x00000003 /* PT_LOADs should be contiguous */ +#define ELF_FDPIC_FLAG_EXEC_STACK 0x00000010 /* T if stack to be executable */ +#define ELF_FDPIC_FLAG_NOEXEC_STACK 0x00000020 /* T if stack not to be executable */ +#define ELF_FDPIC_FLAG_EXECUTABLE 0x00000040 /* T if this object is the executable */ +#define ELF_FDPIC_FLAG_PRESENT 0x80000000 /* T if this object is present */ +}; + + +#endif /* _LINUX_ELF_FDPIC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf.h new file mode 100644 index 0000000..ac06599 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elf.h @@ -0,0 +1,377 @@ +#ifndef _LINUX_ELF_H +#define _LINUX_ELF_H + +#include +#include + +struct file; + +#ifndef elf_read_implies_exec + /* Executables for which elf_read_implies_exec() returns TRUE will + have the READ_IMPLIES_EXEC personality flag set automatically. + Override in asm/elf.h as needed. */ +# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 +#endif + +/* 32-bit ELF base types. */ +typedef __u32 Elf32_Addr; +typedef __u16 Elf32_Half; +typedef __u32 Elf32_Off; +typedef __s32 Elf32_Sword; +typedef __u32 Elf32_Word; + +/* 64-bit ELF base types. */ +typedef __u64 Elf64_Addr; +typedef __u16 Elf64_Half; +typedef __s16 Elf64_SHalf; +typedef __u64 Elf64_Off; +typedef __s32 Elf64_Sword; +typedef __u32 Elf64_Word; +typedef __u64 Elf64_Xword; +typedef __s64 Elf64_Sxword; + +/* These constants are for the segment types stored in the image headers */ +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_TLS 7 /* Thread local storage segment */ +#define PT_LOOS 0x60000000 /* OS-specific */ +#define PT_HIOS 0x6fffffff /* OS-specific */ +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff +#define PT_GNU_EH_FRAME 0x6474e550 + +#define PT_GNU_STACK (PT_LOOS + 0x474e551) + +/* These constants define the different elf file types */ +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + +/* This is the info that is needed to parse the dynamic section of the file */ +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_ENCODING 32 +#define OLD_DT_LOOS 0x60000000 +#define DT_LOOS 0x6000000d +#define DT_HIOS 0x6ffff000 +#define DT_VALRNGLO 0x6ffffd00 +#define DT_VALRNGHI 0x6ffffdff +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_VERSYM 0x6ffffff0 +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa +#define DT_FLAGS_1 0x6ffffffb +#define DT_VERDEF 0x6ffffffc +#define DT_VERDEFNUM 0x6ffffffd +#define DT_VERNEED 0x6ffffffe +#define DT_VERNEEDNUM 0x6fffffff +#define OLD_DT_HIOS 0x6fffffff +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff + +/* This info is needed when parsing the symbol table */ +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_COMMON 5 +#define STT_TLS 6 + +#define ELF_ST_BIND(x) ((x) >> 4) +#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) +#define ELF32_ST_BIND(x) ELF_ST_BIND(x) +#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) +#define ELF64_ST_BIND(x) ELF_ST_BIND(x) +#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) + +typedef struct dynamic{ + Elf32_Sword d_tag; + union{ + Elf32_Sword d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +typedef struct { + Elf64_Sxword d_tag; /* entry tag value */ + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + +/* The following are used with relocations */ +#define ELF32_R_SYM(x) ((x) >> 8) +#define ELF32_R_TYPE(x) ((x) & 0xff) + +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) + +typedef struct elf32_rel { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct elf64_rel { + Elf64_Addr r_offset; /* Location at which to apply the action */ + Elf64_Xword r_info; /* index and type of relocation */ +} Elf64_Rel; + +typedef struct elf32_rela{ + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +typedef struct elf64_rela { + Elf64_Addr r_offset; /* Location at which to apply the action */ + Elf64_Xword r_info; /* index and type of relocation */ + Elf64_Sxword r_addend; /* Constant addend used to compute value */ +} Elf64_Rela; + +typedef struct elf32_sym{ + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; +} Elf32_Sym; + +typedef struct elf64_sym { + Elf64_Word st_name; /* Symbol name, index in string tbl */ + unsigned char st_info; /* Type and binding attributes */ + unsigned char st_other; /* No defined meaning, 0 */ + Elf64_Half st_shndx; /* Associated section index */ + Elf64_Addr st_value; /* Value of the symbol */ + Elf64_Xword st_size; /* Associated symbol size */ +} Elf64_Sym; + + +#define EI_NIDENT 16 + +typedef struct elf32_hdr{ + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; /* Entry point */ + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +typedef struct elf64_hdr { + unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; /* Entry point virtual address */ + Elf64_Off e_phoff; /* Program header table file offset */ + Elf64_Off e_shoff; /* Section header table file offset */ + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +/* These constants define the permissions on sections in the program + header, p_flags. */ +#define PF_R 0x4 +#define PF_W 0x2 +#define PF_X 0x1 + +typedef struct elf32_phdr{ + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +typedef struct elf64_phdr { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; /* Segment file offset */ + Elf64_Addr p_vaddr; /* Segment virtual address */ + Elf64_Addr p_paddr; /* Segment physical address */ + Elf64_Xword p_filesz; /* Segment size in file */ + Elf64_Xword p_memsz; /* Segment size in memory */ + Elf64_Xword p_align; /* Segment alignment, file & memory */ +} Elf64_Phdr; + +/* sh_type */ +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_NUM 12 +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0xffffffff + +/* sh_flags */ +#define SHF_WRITE 0x1 +#define SHF_ALLOC 0x2 +#define SHF_EXECINSTR 0x4 +#define SHF_MASKPROC 0xf0000000 + +/* special section indexes */ +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_HIPROC 0xff1f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_HIRESERVE 0xffff + +typedef struct { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +typedef struct elf64_shdr { + Elf64_Word sh_name; /* Section name, index in string tbl */ + Elf64_Word sh_type; /* Type of section */ + Elf64_Xword sh_flags; /* Miscellaneous section attributes */ + Elf64_Addr sh_addr; /* Section virtual addr at execution */ + Elf64_Off sh_offset; /* Section file offset */ + Elf64_Xword sh_size; /* Size of section in bytes */ + Elf64_Word sh_link; /* Index of another section */ + Elf64_Word sh_info; /* Additional section information */ + Elf64_Xword sh_addralign; /* Section alignment */ + Elf64_Xword sh_entsize; /* Entry size if section holds table */ +} Elf64_Shdr; + +#define EI_MAG0 0 /* e_ident[] indexes */ +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_OSABI 7 +#define EI_PAD 8 + +#define ELFMAG0 0x7f /* EI_MAG */ +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define ELFCLASSNONE 0 /* EI_CLASS */ +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define ELFDATANONE 0 /* e_ident[EI_DATA] */ +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 + +#define EV_NONE 0 /* e_version, EI_VERSION */ +#define EV_CURRENT 1 +#define EV_NUM 2 + +#define ELFOSABI_NONE 0 +#define ELFOSABI_LINUX 3 + +#ifndef ELF_OSABI +#define ELF_OSABI ELFOSABI_NONE +#endif + +/* Notes used in ET_CORE */ +#define NT_PRSTATUS 1 +#define NT_PRFPREG 2 +#define NT_PRPSINFO 3 +#define NT_TASKSTRUCT 4 +#define NT_AUXV 6 +#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ +#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ +#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ +#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ +#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ +#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ + + +/* Note header in a PT_NOTE section */ +typedef struct elf32_note { + Elf32_Word n_namesz; /* Name size */ + Elf32_Word n_descsz; /* Content size */ + Elf32_Word n_type; /* Content type */ +} Elf32_Nhdr; + +/* Note header in a PT_NOTE section */ +typedef struct elf64_note { + Elf64_Word n_namesz; /* Name size */ + Elf64_Word n_descsz; /* Content size */ + Elf64_Word n_type; /* Content type */ +} Elf64_Nhdr; + +#endif /* _LINUX_ELF_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elfcore.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elfcore.h new file mode 100644 index 0000000..7e58df1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/elfcore.h @@ -0,0 +1,95 @@ +#ifndef _LINUX_ELFCORE_H +#define _LINUX_ELFCORE_H + +#include +#include +#include +#include + +struct elf_siginfo +{ + int si_signo; /* signal number */ + int si_code; /* extra code */ + int si_errno; /* errno */ +}; + + +typedef elf_greg_t greg_t; +typedef elf_gregset_t gregset_t; +typedef elf_fpregset_t fpregset_t; +typedef elf_fpxregset_t fpxregset_t; +#define NGREG ELF_NGREG + +/* + * Definitions to generate Intel SVR4-like core files. + * These mostly have the same names as the SVR4 types with "elf_" + * tacked on the front to prevent clashes with linux definitions, + * and the typedef forms have been avoided. This is mostly like + * the SVR4 structure, but more Linuxy, with things that Linux does + * not support and which gdb doesn't really use excluded. + * Fields present but not used are marked with "XXX". + */ +struct elf_prstatus +{ +#if 0 + long pr_flags; /* XXX Process flags */ + short pr_why; /* XXX Reason for process halt */ + short pr_what; /* XXX More detailed reason */ +#endif + struct elf_siginfo pr_info; /* Info associated with signal */ + short pr_cursig; /* Current signal */ + unsigned long pr_sigpend; /* Set of pending signals */ + unsigned long pr_sighold; /* Set of held signals */ +#if 0 + struct sigaltstack pr_altstack; /* Alternate stack info */ + struct sigaction pr_action; /* Signal action for current sig */ +#endif + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct timeval pr_utime; /* User time */ + struct timeval pr_stime; /* System time */ + struct timeval pr_cutime; /* Cumulative user time */ + struct timeval pr_cstime; /* Cumulative system time */ +#if 0 + long pr_instr; /* Current instruction */ +#endif + elf_gregset_t pr_reg; /* GP registers */ +#ifdef CONFIG_BINFMT_ELF_FDPIC + /* When using FDPIC, the loadmap addresses need to be communicated + * to GDB in order for GDB to do the necessary relocations. The + * fields (below) used to communicate this information are placed + * immediately after ``pr_reg'', so that the loadmap addresses may + * be viewed as part of the register set if so desired. + */ + unsigned long pr_exec_fdpic_loadmap; + unsigned long pr_interp_fdpic_loadmap; +#endif + int pr_fpvalid; /* True if math co-processor being used. */ +}; + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo +{ + char pr_state; /* numeric process state */ + char pr_sname; /* char for pr_state */ + char pr_zomb; /* zombie */ + char pr_nice; /* nice val */ + unsigned long pr_flag; /* flags */ + __kernel_uid_t pr_uid; + __kernel_gid_t pr_gid; + pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* filename of executable */ + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ +}; + +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; +#define PRARGSZ ELF_PRARGSZ + + + +#endif /* _LINUX_ELFCORE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/errno.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/errno.h new file mode 100644 index 0000000..6385fa3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/errno.h @@ -0,0 +1,7 @@ +#ifndef _LINUX_ERRNO_H +#define _LINUX_ERRNO_H + +#include + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/errqueue.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/errqueue.h new file mode 100644 index 0000000..35de665 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/errqueue.h @@ -0,0 +1,26 @@ +#ifndef _LINUX_ERRQUEUE_H +#define _LINUX_ERRQUEUE_H 1 + +#include + +struct sock_extended_err +{ + __u32 ee_errno; + __u8 ee_origin; + __u8 ee_type; + __u8 ee_code; + __u8 ee_pad; + __u32 ee_info; + __u32 ee_data; +}; + +#define SO_EE_ORIGIN_NONE 0 +#define SO_EE_ORIGIN_LOCAL 1 +#define SO_EE_ORIGIN_ICMP 2 +#define SO_EE_ORIGIN_ICMP6 3 +#define SO_EE_ORIGIN_TIMESTAMPING 4 + +#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ethtool.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ethtool.h new file mode 100644 index 0000000..fc48751 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ethtool.h @@ -0,0 +1,530 @@ +/* + * ethtool.h: Defines for Linux ethtool. + * + * Copyright (C) 1998 David S. Miller (davem@redhat.com) + * Copyright 2001 Jeff Garzik + * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) + * Portions Copyright 2002 Intel (eli.kupermann@intel.com, + * christopher.leech@intel.com, + * scott.feldman@intel.com) + * Portions Copyright (C) Sun Microsystems 2008 + */ + +#ifndef _LINUX_ETHTOOL_H +#define _LINUX_ETHTOOL_H + +#include + +/* This should work for both 32 and 64 bit userland. */ +struct ethtool_cmd { + __u32 cmd; + __u32 supported; /* Features this interface supports */ + __u32 advertising; /* Features this interface advertises */ + __u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ + __u8 duplex; /* Duplex, half or full */ + __u8 port; /* Which connector port */ + __u8 phy_address; + __u8 transceiver; /* Which transceiver to use */ + __u8 autoneg; /* Enable or disable autonegotiation */ + __u32 maxtxpkt; /* Tx pkts before generating tx int */ + __u32 maxrxpkt; /* Rx pkts before generating rx int */ + __u16 speed_hi; + __u16 reserved2; + __u32 reserved[3]; +}; + +static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep, + __u32 speed) +{ + + ep->speed = (__u16)speed; + ep->speed_hi = (__u16)(speed >> 16); +} + +static __inline__ __u32 ethtool_cmd_speed(struct ethtool_cmd *ep) +{ + return (ep->speed_hi << 16) | ep->speed; +} + +#define ETHTOOL_BUSINFO_LEN 32 +/* these strings are set to whatever the driver author decides... */ +struct ethtool_drvinfo { + __u32 cmd; + char driver[32]; /* driver short name, "tulip", "eepro100" */ + char version[32]; /* driver version string */ + char fw_version[32]; /* firmware version string, if applicable */ + char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ + /* For PCI devices, use pci_name(pci_dev). */ + char reserved1[32]; + char reserved2[12]; + __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ + __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ + __u32 testinfo_len; + __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ + __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ +}; + +#define SOPASS_MAX 6 +/* wake-on-lan settings */ +struct ethtool_wolinfo { + __u32 cmd; + __u32 supported; + __u32 wolopts; + __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */ +}; + +/* for passing single values */ +struct ethtool_value { + __u32 cmd; + __u32 data; +}; + +/* for passing big chunks of data */ +struct ethtool_regs { + __u32 cmd; + __u32 version; /* driver-specific, indicates different chips/revs */ + __u32 len; /* bytes */ + __u8 data[0]; +}; + +/* for passing EEPROM chunks */ +struct ethtool_eeprom { + __u32 cmd; + __u32 magic; + __u32 offset; /* in bytes */ + __u32 len; /* in bytes */ + __u8 data[0]; +}; + +/* for configuring coalescing parameters of chip */ +struct ethtool_coalesce { + __u32 cmd; /* ETHTOOL_{G,S}COALESCE */ + + /* How many usecs to delay an RX interrupt after + * a packet arrives. If 0, only rx_max_coalesced_frames + * is used. + */ + __u32 rx_coalesce_usecs; + + /* How many packets to delay an RX interrupt after + * a packet arrives. If 0, only rx_coalesce_usecs is + * used. It is illegal to set both usecs and max frames + * to zero as this would cause RX interrupts to never be + * generated. + */ + __u32 rx_max_coalesced_frames; + + /* Same as above two parameters, except that these values + * apply while an IRQ is being serviced by the host. Not + * all cards support this feature and the values are ignored + * in that case. + */ + __u32 rx_coalesce_usecs_irq; + __u32 rx_max_coalesced_frames_irq; + + /* How many usecs to delay a TX interrupt after + * a packet is sent. If 0, only tx_max_coalesced_frames + * is used. + */ + __u32 tx_coalesce_usecs; + + /* How many packets to delay a TX interrupt after + * a packet is sent. If 0, only tx_coalesce_usecs is + * used. It is illegal to set both usecs and max frames + * to zero as this would cause TX interrupts to never be + * generated. + */ + __u32 tx_max_coalesced_frames; + + /* Same as above two parameters, except that these values + * apply while an IRQ is being serviced by the host. Not + * all cards support this feature and the values are ignored + * in that case. + */ + __u32 tx_coalesce_usecs_irq; + __u32 tx_max_coalesced_frames_irq; + + /* How many usecs to delay in-memory statistics + * block updates. Some drivers do not have an in-memory + * statistic block, and in such cases this value is ignored. + * This value must not be zero. + */ + __u32 stats_block_coalesce_usecs; + + /* Adaptive RX/TX coalescing is an algorithm implemented by + * some drivers to improve latency under low packet rates and + * improve throughput under high packet rates. Some drivers + * only implement one of RX or TX adaptive coalescing. Anything + * not implemented by the driver causes these values to be + * silently ignored. + */ + __u32 use_adaptive_rx_coalesce; + __u32 use_adaptive_tx_coalesce; + + /* When the packet rate (measured in packets per second) + * is below pkt_rate_low, the {rx,tx}_*_low parameters are + * used. + */ + __u32 pkt_rate_low; + __u32 rx_coalesce_usecs_low; + __u32 rx_max_coalesced_frames_low; + __u32 tx_coalesce_usecs_low; + __u32 tx_max_coalesced_frames_low; + + /* When the packet rate is below pkt_rate_high but above + * pkt_rate_low (both measured in packets per second) the + * normal {rx,tx}_* coalescing parameters are used. + */ + + /* When the packet rate is (measured in packets per second) + * is above pkt_rate_high, the {rx,tx}_*_high parameters are + * used. + */ + __u32 pkt_rate_high; + __u32 rx_coalesce_usecs_high; + __u32 rx_max_coalesced_frames_high; + __u32 tx_coalesce_usecs_high; + __u32 tx_max_coalesced_frames_high; + + /* How often to do adaptive coalescing packet rate sampling, + * measured in seconds. Must not be zero. + */ + __u32 rate_sample_interval; +}; + +/* for configuring RX/TX ring parameters */ +struct ethtool_ringparam { + __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ + + /* Read only attributes. These indicate the maximum number + * of pending RX/TX ring entries the driver will allow the + * user to set. + */ + __u32 rx_max_pending; + __u32 rx_mini_max_pending; + __u32 rx_jumbo_max_pending; + __u32 tx_max_pending; + + /* Values changeable by the user. The valid values are + * in the range 1 to the "*_max_pending" counterpart above. + */ + __u32 rx_pending; + __u32 rx_mini_pending; + __u32 rx_jumbo_pending; + __u32 tx_pending; +}; + +/* for configuring link flow control parameters */ +struct ethtool_pauseparam { + __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ + + /* If the link is being auto-negotiated (via ethtool_cmd.autoneg + * being true) the user may set 'autonet' here non-zero to have the + * pause parameters be auto-negotiated too. In such a case, the + * {rx,tx}_pause values below determine what capabilities are + * advertised. + * + * If 'autoneg' is zero or the link is not being auto-negotiated, + * then {rx,tx}_pause force the driver to use/not-use pause + * flow control. + */ + __u32 autoneg; + __u32 rx_pause; + __u32 tx_pause; +}; + +#define ETH_GSTRING_LEN 32 +enum ethtool_stringset { + ETH_SS_TEST = 0, + ETH_SS_STATS, + ETH_SS_PRIV_FLAGS, +}; + +/* for passing string sets for data tagging */ +struct ethtool_gstrings { + __u32 cmd; /* ETHTOOL_GSTRINGS */ + __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ + __u32 len; /* number of strings in the string set */ + __u8 data[0]; +}; + +enum ethtool_test_flags { + ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ + ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ +}; + +/* for requesting NIC test and getting results*/ +struct ethtool_test { + __u32 cmd; /* ETHTOOL_TEST */ + __u32 flags; /* ETH_TEST_FL_xxx */ + __u32 reserved; + __u32 len; /* result length, in number of u64 elements */ + __u64 data[0]; +}; + +/* for dumping NIC-specific statistics */ +struct ethtool_stats { + __u32 cmd; /* ETHTOOL_GSTATS */ + __u32 n_stats; /* number of u64's being returned */ + __u64 data[0]; +}; + +struct ethtool_perm_addr { + __u32 cmd; /* ETHTOOL_GPERMADDR */ + __u32 size; + __u8 data[0]; +}; + +/* boolean flags controlling per-interface behavior characteristics. + * When reading, the flag indicates whether or not a certain behavior + * is enabled/present. When writing, the flag indicates whether + * or not the driver should turn on (set) or off (clear) a behavior. + * + * Some behaviors may read-only (unconditionally absent or present). + * If such is the case, return EINVAL in the set-flags operation if the + * flag differs from the read-only value. + */ +enum ethtool_flags { + ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ +}; + +/* The following structures are for supporting RX network flow + * classification configuration. Note, all multibyte fields, e.g., + * ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network + * byte order. + */ +struct ethtool_tcpip4_spec { + __be32 ip4src; + __be32 ip4dst; + __be16 psrc; + __be16 pdst; + __u8 tos; +}; + +struct ethtool_ah_espip4_spec { + __be32 ip4src; + __be32 ip4dst; + __be32 spi; + __u8 tos; +}; + +struct ethtool_rawip4_spec { + __be32 ip4src; + __be32 ip4dst; + __u8 hdata[64]; +}; + +struct ethtool_ether_spec { + __be16 ether_type; + __u8 frame_size; + __u8 eframe[16]; +}; + +#define ETH_RX_NFC_IP4 1 +#define ETH_RX_NFC_IP6 2 + +struct ethtool_usrip4_spec { + __be32 ip4src; + __be32 ip4dst; + __be32 l4_4_bytes; + __u8 tos; + __u8 ip_ver; + __u8 proto; +}; + +struct ethtool_rx_flow_spec { + __u32 flow_type; + union { + struct ethtool_tcpip4_spec tcp_ip4_spec; + struct ethtool_tcpip4_spec udp_ip4_spec; + struct ethtool_tcpip4_spec sctp_ip4_spec; + struct ethtool_ah_espip4_spec ah_ip4_spec; + struct ethtool_ah_espip4_spec esp_ip4_spec; + struct ethtool_rawip4_spec raw_ip4_spec; + struct ethtool_ether_spec ether_spec; + struct ethtool_usrip4_spec usr_ip4_spec; + __u8 hdata[64]; + } h_u, m_u; /* entry, mask */ + __u64 ring_cookie; + __u32 location; +}; + +struct ethtool_rxnfc { + __u32 cmd; + __u32 flow_type; + /* The rx flow hash value or the rule DB size */ + __u64 data; + struct ethtool_rx_flow_spec fs; + __u32 rule_cnt; + __u32 rule_locs[0]; +}; + + +/* CMDs currently supported */ +#define ETHTOOL_GSET 0x00000001 /* Get settings. */ +#define ETHTOOL_SSET 0x00000002 /* Set settings. */ +#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ +#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ +#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ +#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ +#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ +#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ +#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ +#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ +#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ +#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ +#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ +#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ +#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ +#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ +#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ +#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ +#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ +#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ +#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ +#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ +#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable + * (ethtool_value) */ +#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable + * (ethtool_value). */ +#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ +#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ +#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ +#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ +#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ +#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ +#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ +#define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ +#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ +#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ +#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ +#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ +#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ +#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ +#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ + +#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ +#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ +#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ +#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ +#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ +#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ +#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ +#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ +#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ +#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ + +/* compatibility with older code */ +#define SPARC_ETH_GSET ETHTOOL_GSET +#define SPARC_ETH_SSET ETHTOOL_SSET + +/* Indicates what features are supported by the interface. */ +#define SUPPORTED_10baseT_Half (1 << 0) +#define SUPPORTED_10baseT_Full (1 << 1) +#define SUPPORTED_100baseT_Half (1 << 2) +#define SUPPORTED_100baseT_Full (1 << 3) +#define SUPPORTED_1000baseT_Half (1 << 4) +#define SUPPORTED_1000baseT_Full (1 << 5) +#define SUPPORTED_Autoneg (1 << 6) +#define SUPPORTED_TP (1 << 7) +#define SUPPORTED_AUI (1 << 8) +#define SUPPORTED_MII (1 << 9) +#define SUPPORTED_FIBRE (1 << 10) +#define SUPPORTED_BNC (1 << 11) +#define SUPPORTED_10000baseT_Full (1 << 12) +#define SUPPORTED_Pause (1 << 13) +#define SUPPORTED_Asym_Pause (1 << 14) +#define SUPPORTED_2500baseX_Full (1 << 15) + +/* Indicates what features are advertised by the interface. */ +#define ADVERTISED_10baseT_Half (1 << 0) +#define ADVERTISED_10baseT_Full (1 << 1) +#define ADVERTISED_100baseT_Half (1 << 2) +#define ADVERTISED_100baseT_Full (1 << 3) +#define ADVERTISED_1000baseT_Half (1 << 4) +#define ADVERTISED_1000baseT_Full (1 << 5) +#define ADVERTISED_Autoneg (1 << 6) +#define ADVERTISED_TP (1 << 7) +#define ADVERTISED_AUI (1 << 8) +#define ADVERTISED_MII (1 << 9) +#define ADVERTISED_FIBRE (1 << 10) +#define ADVERTISED_BNC (1 << 11) +#define ADVERTISED_10000baseT_Full (1 << 12) +#define ADVERTISED_Pause (1 << 13) +#define ADVERTISED_Asym_Pause (1 << 14) +#define ADVERTISED_2500baseX_Full (1 << 15) + +/* The following are all involved in forcing a particular link + * mode for the device for setting things. When getting the + * devices settings, these indicate the current mode and whether + * it was foced up into this mode or autonegotiated. + */ + +/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */ +#define SPEED_10 10 +#define SPEED_100 100 +#define SPEED_1000 1000 +#define SPEED_2500 2500 +#define SPEED_10000 10000 + +/* Duplex, half or full. */ +#define DUPLEX_HALF 0x00 +#define DUPLEX_FULL 0x01 + +/* Which connector port. */ +#define PORT_TP 0x00 +#define PORT_AUI 0x01 +#define PORT_MII 0x02 +#define PORT_FIBRE 0x03 +#define PORT_BNC 0x04 + +/* Which transceiver to use. */ +#define XCVR_INTERNAL 0x00 +#define XCVR_EXTERNAL 0x01 +#define XCVR_DUMMY1 0x02 +#define XCVR_DUMMY2 0x03 +#define XCVR_DUMMY3 0x04 + +/* Enable or disable autonegotiation. If this is set to enable, + * the forced link modes above are completely ignored. + */ +#define AUTONEG_DISABLE 0x00 +#define AUTONEG_ENABLE 0x01 + +/* Wake-On-Lan options. */ +#define WAKE_PHY (1 << 0) +#define WAKE_UCAST (1 << 1) +#define WAKE_MCAST (1 << 2) +#define WAKE_BCAST (1 << 3) +#define WAKE_ARP (1 << 4) +#define WAKE_MAGIC (1 << 5) +#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ + +/* L3-L4 network traffic flow types */ +#define TCP_V4_FLOW 0x01 +#define UDP_V4_FLOW 0x02 +#define SCTP_V4_FLOW 0x03 +#define AH_ESP_V4_FLOW 0x04 +#define TCP_V6_FLOW 0x05 +#define UDP_V6_FLOW 0x06 +#define SCTP_V6_FLOW 0x07 +#define AH_ESP_V6_FLOW 0x08 +#define AH_V4_FLOW 0x09 +#define ESP_V4_FLOW 0x0a +#define AH_V6_FLOW 0x0b +#define ESP_V6_FLOW 0x0c +#define IP_USER_FLOW 0x0d + +/* L3-L4 network traffic flow hash options */ +#define RXH_L2DA (1 << 1) +#define RXH_VLAN (1 << 2) +#define RXH_L3_PROTO (1 << 3) +#define RXH_IP_SRC (1 << 4) +#define RXH_IP_DST (1 << 5) +#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ +#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ +#define RXH_DISCARD (1 << 31) + +#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL + +#endif /* _LINUX_ETHTOOL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/eventpoll.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/eventpoll.h new file mode 100644 index 0000000..d9d19ae --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/eventpoll.h @@ -0,0 +1,54 @@ +/* + * include/linux/eventpoll.h ( Efficent event polling implementation ) + * Copyright (C) 2001,...,2006 Davide Libenzi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Davide Libenzi + * + */ + +#ifndef _LINUX_EVENTPOLL_H +#define _LINUX_EVENTPOLL_H + +/* For O_CLOEXEC */ +#include +#include + +/* Flags for epoll_create1. */ +#define EPOLL_CLOEXEC O_CLOEXEC + +/* Valid opcodes to issue to sys_epoll_ctl() */ +#define EPOLL_CTL_ADD 1 +#define EPOLL_CTL_DEL 2 +#define EPOLL_CTL_MOD 3 + +/* Set the One Shot behaviour for the target file descriptor */ +#define EPOLLONESHOT (1 << 30) + +/* Set the Edge Triggered behaviour for the target file descriptor */ +#define EPOLLET (1 << 31) + +/* + * On x86-64 make the 64bit structure have the same alignment as the + * 32bit structure. This makes 32bit emulation easier. + * + * UML/x86_64 needs the same packing as x86_64 + */ +#ifdef __x86_64__ +#define EPOLL_PACKED __attribute__((packed)) +#else +#define EPOLL_PACKED +#endif + +struct epoll_event { + __u32 events; + __u64 data; +} EPOLL_PACKED; + + +#endif /* #ifndef _LINUX_EVENTPOLL_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ext2_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ext2_fs.h new file mode 100644 index 0000000..afb7507 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ext2_fs.h @@ -0,0 +1,556 @@ +/* + * linux/include/linux/ext2_fs.h + * + * Copyright (C) 1992, 1993, 1994, 1995 + * Remy Card (card@masi.ibp.fr) + * Laboratoire MASI - Institut Blaise Pascal + * Universite Pierre et Marie Curie (Paris VI) + * + * from + * + * linux/include/linux/minix_fs.h + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#ifndef _LINUX_EXT2_FS_H +#define _LINUX_EXT2_FS_H + +#include +#include + +/* + * The second extended filesystem constants/structures + */ + +/* + * Define EXT2FS_DEBUG to produce debug messages + */ +#undef EXT2FS_DEBUG + +/* + * Define EXT2_RESERVATION to reserve data blocks for expanding files + */ +#define EXT2_DEFAULT_RESERVE_BLOCKS 8 +/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ +#define EXT2_MAX_RESERVE_BLOCKS 1027 +#define EXT2_RESERVE_WINDOW_NOT_ALLOCATED 0 +/* + * The second extended file system version + */ +#define EXT2FS_DATE "95/08/09" +#define EXT2FS_VERSION "0.5b" + +/* + * Debug code + */ +#ifdef EXT2FS_DEBUG +# define ext2_debug(f, a...) { \ + printk ("EXT2-fs DEBUG (%s, %d): %s:", \ + __FILE__, __LINE__, __func__); \ + printk (f, ## a); \ + } +#else +# define ext2_debug(f, a...) /**/ +#endif + +/* + * Special inode numbers + */ +#define EXT2_BAD_INO 1 /* Bad blocks inode */ +#define EXT2_ROOT_INO 2 /* Root inode */ +#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ +#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ + +/* First non-reserved inode for old ext2 filesystems */ +#define EXT2_GOOD_OLD_FIRST_INO 11 + +/* Assume that user mode programs are passing in an ext2fs superblock, not + * a kernel struct super_block. This will allow us to call the feature-test + * macros from user land. */ +#define EXT2_SB(sb) (sb) + +/* + * Maximal count of links to a file + */ +#define EXT2_LINK_MAX 32000 + +/* + * Macro-instructions used to manage several block sizes + */ +#define EXT2_MIN_BLOCK_SIZE 1024 +#define EXT2_MAX_BLOCK_SIZE 4096 +#define EXT2_MIN_BLOCK_LOG_SIZE 10 +# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) +# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ + EXT2_GOOD_OLD_INODE_SIZE : \ + (s)->s_inode_size) +#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ + EXT2_GOOD_OLD_FIRST_INO : \ + (s)->s_first_ino) + +/* + * Macro-instructions used to manage fragments + */ +#define EXT2_MIN_FRAG_SIZE 1024 +#define EXT2_MAX_FRAG_SIZE 4096 +#define EXT2_MIN_FRAG_LOG_SIZE 10 +# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size) +# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s)) + +/* + * Structure of a blocks group descriptor + */ +struct ext2_group_desc +{ + __le32 bg_block_bitmap; /* Blocks bitmap block */ + __le32 bg_inode_bitmap; /* Inodes bitmap block */ + __le32 bg_inode_table; /* Inodes table block */ + __le16 bg_free_blocks_count; /* Free blocks count */ + __le16 bg_free_inodes_count; /* Free inodes count */ + __le16 bg_used_dirs_count; /* Directories count */ + __le16 bg_pad; + __le32 bg_reserved[3]; +}; + +/* + * Macro-instructions used to manage group descriptors + */ +# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) +# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) +# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) + +/* + * Constants relative to the data blocks + */ +#define EXT2_NDIR_BLOCKS 12 +#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS +#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) +#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) +#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) + +/* + * Inode flags (GETFLAGS/SETFLAGS) + */ +#define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */ +#define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */ +#define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */ +#define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */ +#define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */ +#define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */ +#define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */ +#define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */ +/* Reserved for compression usage... */ +#define EXT2_DIRTY_FL FS_DIRTY_FL +#define EXT2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */ +#define EXT2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */ +#define EXT2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */ +/* End compression flags --- maybe not all used */ +#define EXT2_BTREE_FL FS_BTREE_FL /* btree format dir */ +#define EXT2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */ +#define EXT2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */ +#define EXT2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */ +#define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */ +#define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */ +#define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/ +#define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */ + +#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ +#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */ + +/* Flags that should be inherited by new inodes from their parent. */ +#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\ + EXT2_SYNC_FL | EXT2_IMMUTABLE_FL | EXT2_APPEND_FL |\ + EXT2_NODUMP_FL | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL|\ + EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\ + EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL) + +/* Flags that are appropriate for regular files (all but dir-specific ones). */ +#define EXT2_REG_FLMASK (~(EXT2_DIRSYNC_FL | EXT2_TOPDIR_FL)) + +/* Flags that are appropriate for non-directories/regular files. */ +#define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL) + +/* Mask out flags that are inappropriate for the given type of inode. */ +static __inline__ __u32 ext2_mask_flags(umode_t mode, __u32 flags) +{ + if (S_ISDIR(mode)) + return flags; + else if (S_ISREG(mode)) + return flags & EXT2_REG_FLMASK; + else + return flags & EXT2_OTHER_FLMASK; +} + +/* + * ioctl commands + */ +#define EXT2_IOC_GETFLAGS FS_IOC_GETFLAGS +#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS +#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION +#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION +#define EXT2_IOC_GETRSVSZ _IOR('f', 5, long) +#define EXT2_IOC_SETRSVSZ _IOW('f', 6, long) + +/* + * ioctl commands in 32 bit emulation + */ +#define EXT2_IOC32_GETFLAGS FS_IOC32_GETFLAGS +#define EXT2_IOC32_SETFLAGS FS_IOC32_SETFLAGS +#define EXT2_IOC32_GETVERSION FS_IOC32_GETVERSION +#define EXT2_IOC32_SETVERSION FS_IOC32_SETVERSION + +/* + * Structure of an inode on the disk + */ +struct ext2_inode { + __le16 i_mode; /* File mode */ + __le16 i_uid; /* Low 16 bits of Owner Uid */ + __le32 i_size; /* Size in bytes */ + __le32 i_atime; /* Access time */ + __le32 i_ctime; /* Creation time */ + __le32 i_mtime; /* Modification time */ + __le32 i_dtime; /* Deletion Time */ + __le16 i_gid; /* Low 16 bits of Group Id */ + __le16 i_links_count; /* Links count */ + __le32 i_blocks; /* Blocks count */ + __le32 i_flags; /* File flags */ + union { + struct { + __le32 l_i_reserved1; + } linux1; + struct { + __le32 h_i_translator; + } hurd1; + struct { + __le32 m_i_reserved1; + } masix1; + } osd1; /* OS dependent 1 */ + __le32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ + __le32 i_generation; /* File version (for NFS) */ + __le32 i_file_acl; /* File ACL */ + __le32 i_dir_acl; /* Directory ACL */ + __le32 i_faddr; /* Fragment address */ + union { + struct { + __u8 l_i_frag; /* Fragment number */ + __u8 l_i_fsize; /* Fragment size */ + __u16 i_pad1; + __le16 l_i_uid_high; /* these 2 fields */ + __le16 l_i_gid_high; /* were reserved2[0] */ + __u32 l_i_reserved2; + } linux2; + struct { + __u8 h_i_frag; /* Fragment number */ + __u8 h_i_fsize; /* Fragment size */ + __le16 h_i_mode_high; + __le16 h_i_uid_high; + __le16 h_i_gid_high; + __le32 h_i_author; + } hurd2; + struct { + __u8 m_i_frag; /* Fragment number */ + __u8 m_i_fsize; /* Fragment size */ + __u16 m_pad1; + __u32 m_i_reserved2[2]; + } masix2; + } osd2; /* OS dependent 2 */ +}; + +#define i_size_high i_dir_acl + +#if defined(__KERNEL__) || defined(__linux__) +#define i_reserved1 osd1.linux1.l_i_reserved1 +#define i_frag osd2.linux2.l_i_frag +#define i_fsize osd2.linux2.l_i_fsize +#define i_uid_low i_uid +#define i_gid_low i_gid +#define i_uid_high osd2.linux2.l_i_uid_high +#define i_gid_high osd2.linux2.l_i_gid_high +#define i_reserved2 osd2.linux2.l_i_reserved2 +#endif + +#ifdef __hurd__ +#define i_translator osd1.hurd1.h_i_translator +#define i_frag osd2.hurd2.h_i_frag +#define i_fsize osd2.hurd2.h_i_fsize +#define i_uid_high osd2.hurd2.h_i_uid_high +#define i_gid_high osd2.hurd2.h_i_gid_high +#define i_author osd2.hurd2.h_i_author +#endif + +#ifdef __masix__ +#define i_reserved1 osd1.masix1.m_i_reserved1 +#define i_frag osd2.masix2.m_i_frag +#define i_fsize osd2.masix2.m_i_fsize +#define i_reserved2 osd2.masix2.m_i_reserved2 +#endif + +/* + * File system states + */ +#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */ +#define EXT2_ERROR_FS 0x0002 /* Errors detected */ + +/* + * Mount flags + */ +#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */ +#define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */ +#define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */ +#define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */ +#define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */ +#define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */ +#define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */ +#define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */ +#define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */ +#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */ +#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */ +#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */ +#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */ +#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */ +#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */ +#define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */ + + +#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt +#define set_opt(o, opt) o |= EXT2_MOUNT_##opt +#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \ + EXT2_MOUNT_##opt) +/* + * Maximal mount counts between two filesystem checks + */ +#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ +#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */ + +/* + * Behaviour when detecting errors + */ +#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */ +#define EXT2_ERRORS_RO 2 /* Remount fs read-only */ +#define EXT2_ERRORS_PANIC 3 /* Panic */ +#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE + +/* + * Structure of the super block + */ +struct ext2_super_block { + __le32 s_inodes_count; /* Inodes count */ + __le32 s_blocks_count; /* Blocks count */ + __le32 s_r_blocks_count; /* Reserved blocks count */ + __le32 s_free_blocks_count; /* Free blocks count */ + __le32 s_free_inodes_count; /* Free inodes count */ + __le32 s_first_data_block; /* First Data Block */ + __le32 s_log_block_size; /* Block size */ + __le32 s_log_frag_size; /* Fragment size */ + __le32 s_blocks_per_group; /* # Blocks per group */ + __le32 s_frags_per_group; /* # Fragments per group */ + __le32 s_inodes_per_group; /* # Inodes per group */ + __le32 s_mtime; /* Mount time */ + __le32 s_wtime; /* Write time */ + __le16 s_mnt_count; /* Mount count */ + __le16 s_max_mnt_count; /* Maximal mount count */ + __le16 s_magic; /* Magic signature */ + __le16 s_state; /* File system state */ + __le16 s_errors; /* Behaviour when detecting errors */ + __le16 s_minor_rev_level; /* minor revision level */ + __le32 s_lastcheck; /* time of last check */ + __le32 s_checkinterval; /* max. time between checks */ + __le32 s_creator_os; /* OS */ + __le32 s_rev_level; /* Revision level */ + __le16 s_def_resuid; /* Default uid for reserved blocks */ + __le16 s_def_resgid; /* Default gid for reserved blocks */ + /* + * These fields are for EXT2_DYNAMIC_REV superblocks only. + * + * Note: the difference between the compatible feature set and + * the incompatible feature set is that if there is a bit set + * in the incompatible feature set that the kernel doesn't + * know about, it should refuse to mount the filesystem. + * + * e2fsck's requirements are more strict; if it doesn't know + * about a feature in either the compatible or incompatible + * feature set, it must abort and not try to meddle with + * things it doesn't understand... + */ + __le32 s_first_ino; /* First non-reserved inode */ + __le16 s_inode_size; /* size of inode structure */ + __le16 s_block_group_nr; /* block group # of this superblock */ + __le32 s_feature_compat; /* compatible feature set */ + __le32 s_feature_incompat; /* incompatible feature set */ + __le32 s_feature_ro_compat; /* readonly-compatible feature set */ + __u8 s_uuid[16]; /* 128-bit uuid for volume */ + char s_volume_name[16]; /* volume name */ + char s_last_mounted[64]; /* directory where last mounted */ + __le32 s_algorithm_usage_bitmap; /* For compression */ + /* + * Performance hints. Directory preallocation should only + * happen if the EXT2_COMPAT_PREALLOC flag is on. + */ + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ + __u16 s_padding1; + /* + * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. + */ + __u8 s_journal_uuid[16]; /* uuid of journal superblock */ + __u32 s_journal_inum; /* inode number of journal file */ + __u32 s_journal_dev; /* device number of journal file */ + __u32 s_last_orphan; /* start of list of inodes to delete */ + __u32 s_hash_seed[4]; /* HTREE hash seed */ + __u8 s_def_hash_version; /* Default hash version to use */ + __u8 s_reserved_char_pad; + __u16 s_reserved_word_pad; + __le32 s_default_mount_opts; + __le32 s_first_meta_bg; /* First metablock block group */ + __u32 s_reserved[190]; /* Padding to the end of the block */ +}; + +/* + * Codes for operating systems + */ +#define EXT2_OS_LINUX 0 +#define EXT2_OS_HURD 1 +#define EXT2_OS_MASIX 2 +#define EXT2_OS_FREEBSD 3 +#define EXT2_OS_LITES 4 + +/* + * Revision levels + */ +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ + +#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV +#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV + +#define EXT2_GOOD_OLD_INODE_SIZE 128 + +/* + * Feature set definitions + */ + +#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \ + ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) +#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \ + ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) +#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \ + ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) +#define EXT2_SET_COMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) +#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) +#define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) +#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) +#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) +#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) + +#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 +#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 +#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 +#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010 +#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 +#define EXT2_FEATURE_COMPAT_ANY 0xffffffff + +#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 +#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 +#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 +#define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff + +#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 +#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 +#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 +#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 +#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff + +#define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR +#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ + EXT2_FEATURE_INCOMPAT_META_BG) +#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ + EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ + EXT2_FEATURE_RO_COMPAT_BTREE_DIR) +#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP +#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP + +/* + * Default values for user and/or group using reserved blocks + */ +#define EXT2_DEF_RESUID 0 +#define EXT2_DEF_RESGID 0 + +/* + * Default mount options + */ +#define EXT2_DEFM_DEBUG 0x0001 +#define EXT2_DEFM_BSDGROUPS 0x0002 +#define EXT2_DEFM_XATTR_USER 0x0004 +#define EXT2_DEFM_ACL 0x0008 +#define EXT2_DEFM_UID16 0x0010 + /* Not used by ext2, but reserved for use by ext3 */ +#define EXT3_DEFM_JMODE 0x0060 +#define EXT3_DEFM_JMODE_DATA 0x0020 +#define EXT3_DEFM_JMODE_ORDERED 0x0040 +#define EXT3_DEFM_JMODE_WBACK 0x0060 + +/* + * Structure of a directory entry + */ +#define EXT2_NAME_LEN 255 + +struct ext2_dir_entry { + __le32 inode; /* Inode number */ + __le16 rec_len; /* Directory entry length */ + __le16 name_len; /* Name length */ + char name[EXT2_NAME_LEN]; /* File name */ +}; + +/* + * The new version of the directory entry. Since EXT2 structures are + * stored in intel byte order, and the name_len field could never be + * bigger than 255 chars, it's safe to reclaim the extra byte for the + * file_type field. + */ +struct ext2_dir_entry_2 { + __le32 inode; /* Inode number */ + __le16 rec_len; /* Directory entry length */ + __u8 name_len; /* Name length */ + __u8 file_type; + char name[EXT2_NAME_LEN]; /* File name */ +}; + +/* + * Ext2 directory file types. Only the low 3 bits are used. The + * other bits are reserved for now. + */ +enum { + EXT2_FT_UNKNOWN, + EXT2_FT_REG_FILE, + EXT2_FT_DIR, + EXT2_FT_CHRDEV, + EXT2_FT_BLKDEV, + EXT2_FT_FIFO, + EXT2_FT_SOCK, + EXT2_FT_SYMLINK, + EXT2_FT_MAX +}; + +/* + * EXT2_DIR_PAD defines the directory entries boundaries + * + * NOTE: It must be a multiple of 4 + */ +#define EXT2_DIR_PAD 4 +#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) +#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ + ~EXT2_DIR_ROUND) +#define EXT2_MAX_REC_LEN ((1<<16)-1) + +#endif /* _LINUX_EXT2_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fadvise.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fadvise.h new file mode 100644 index 0000000..e8e7471 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fadvise.h @@ -0,0 +1,21 @@ +#ifndef FADVISE_H_INCLUDED +#define FADVISE_H_INCLUDED + +#define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +#define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +#define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +#define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ + +/* + * The advise values for POSIX_FADV_DONTNEED and POSIX_ADV_NOREUSE + * for s390-64 differ from the values for the rest of the world. + */ +#if defined(__s390x__) +#define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */ +#define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */ +#else +#define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +#define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif + +#endif /* FADVISE_H_INCLUDED */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/falloc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/falloc.h new file mode 100644 index 0000000..8e912ab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/falloc.h @@ -0,0 +1,6 @@ +#ifndef _FALLOC_H_ +#define _FALLOC_H_ + +#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ + +#endif /* _FALLOC_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fb.h new file mode 100644 index 0000000..ab4b3dc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fb.h @@ -0,0 +1,393 @@ +#ifndef _LINUX_FB_H +#define _LINUX_FB_H + +#include +#include + +struct dentry; + +/* Definitions of frame buffers */ + +#define FB_MAX 32 /* sufficient for now */ + +/* ioctls + 0x46 is 'F' */ +#define FBIOGET_VSCREENINFO 0x4600 +#define FBIOPUT_VSCREENINFO 0x4601 +#define FBIOGET_FSCREENINFO 0x4602 +#define FBIOGETCMAP 0x4604 +#define FBIOPUTCMAP 0x4605 +#define FBIOPAN_DISPLAY 0x4606 +#define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor) +/* 0x4607-0x460B are defined below */ +/* #define FBIOGET_MONITORSPEC 0x460C */ +/* #define FBIOPUT_MONITORSPEC 0x460D */ +/* #define FBIOSWITCH_MONIBIT 0x460E */ +#define FBIOGET_CON2FBMAP 0x460F +#define FBIOPUT_CON2FBMAP 0x4610 +#define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */ +#define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank) +#define FBIO_ALLOC 0x4613 +#define FBIO_FREE 0x4614 +#define FBIOGET_GLYPH 0x4615 +#define FBIOGET_HWCINFO 0x4616 +#define FBIOPUT_MODEINFO 0x4617 +#define FBIOGET_DISPINFO 0x4618 + + +#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ +#define FB_TYPE_PLANES 1 /* Non interleaved planes */ +#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ +#define FB_TYPE_TEXT 3 /* Text/attributes */ +#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ + +#define FB_AUX_TEXT_MDA 0 /* Monochrome text */ +#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ +#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */ +#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */ +#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */ +#define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */ +#define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */ +#define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */ +#define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */ +#define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */ +#define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */ +#define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */ + +#define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */ +#define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */ +#define FB_AUX_VGA_PLANES_CFB8 2 /* CFB8 in planes (VGA) */ + +#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ +#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ +#define FB_VISUAL_TRUECOLOR 2 /* True color */ +#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ +#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ +#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ + +#define FB_ACCEL_NONE 0 /* no hardware accelerator */ +#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ +#define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */ +#define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */ +#define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */ +#define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */ +#define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */ +#define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */ +#define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */ +#define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */ +#define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */ +#define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */ +#define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */ +#define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */ +#define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */ +#define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */ +#define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */ +#define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */ +#define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */ +#define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */ +#define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */ +#define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */ +#define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */ +#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */ +#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */ +#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */ +#define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */ +#define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */ +#define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */ +#define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */ +#define FB_ACCEL_CT_6555x 30 /* C&T 6555x */ +#define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */ +#define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */ +#define FB_ACCEL_IGS_CYBER2000 33 /* CyberPro 2000 */ +#define FB_ACCEL_IGS_CYBER2010 34 /* CyberPro 2010 */ +#define FB_ACCEL_IGS_CYBER5000 35 /* CyberPro 5000 */ +#define FB_ACCEL_SIS_GLAMOUR 36 /* SiS 300/630/540 */ +#define FB_ACCEL_3DLABS_PERMEDIA3 37 /* 3Dlabs Permedia 3 */ +#define FB_ACCEL_ATI_RADEON 38 /* ATI Radeon family */ +#define FB_ACCEL_I810 39 /* Intel 810/815 */ +#define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */ +#define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */ +#define FB_ACCEL_I830 42 /* Intel 830M/845G/85x/865G */ +#define FB_ACCEL_NV_10 43 /* nVidia Arch 10 */ +#define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ +#define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ +#define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ +#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ +#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ +#define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */ +#define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */ +#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */ +#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */ +#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */ +#define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */ +#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ +#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ +#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ +#define FB_ACCEL_NEOMAGIC_NM2097 93 /* NeoMagic NM2097 */ +#define FB_ACCEL_NEOMAGIC_NM2160 94 /* NeoMagic NM2160 */ +#define FB_ACCEL_NEOMAGIC_NM2200 95 /* NeoMagic NM2200 */ +#define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */ +#define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */ +#define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */ + +#define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */ +#define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */ +#define FB_ACCEL_SAVAGE3D_MV 0x82 /* S3 Savage3D-MV */ +#define FB_ACCEL_SAVAGE2000 0x83 /* S3 Savage2000 */ +#define FB_ACCEL_SAVAGE_MX_MV 0x84 /* S3 Savage/MX-MV */ +#define FB_ACCEL_SAVAGE_MX 0x85 /* S3 Savage/MX */ +#define FB_ACCEL_SAVAGE_IX_MV 0x86 /* S3 Savage/IX-MV */ +#define FB_ACCEL_SAVAGE_IX 0x87 /* S3 Savage/IX */ +#define FB_ACCEL_PROSAVAGE_PM 0x88 /* S3 ProSavage PM133 */ +#define FB_ACCEL_PROSAVAGE_KM 0x89 /* S3 ProSavage KM133 */ +#define FB_ACCEL_S3TWISTER_P 0x8a /* S3 Twister */ +#define FB_ACCEL_S3TWISTER_K 0x8b /* S3 TwisterK */ +#define FB_ACCEL_SUPERSAVAGE 0x8c /* S3 Supersavage */ +#define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */ +#define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */ + +struct fb_fix_screeninfo { + char id[16]; /* identification string eg "TT Builtin" */ + unsigned long smem_start; /* Start of frame buffer mem */ + /* (physical address) */ + __u32 smem_len; /* Length of frame buffer mem */ + __u32 type; /* see FB_TYPE_* */ + __u32 type_aux; /* Interleave for interleaved Planes */ + __u32 visual; /* see FB_VISUAL_* */ + __u16 xpanstep; /* zero if no hardware panning */ + __u16 ypanstep; /* zero if no hardware panning */ + __u16 ywrapstep; /* zero if no hardware ywrap */ + __u32 line_length; /* length of a line in bytes */ + unsigned long mmio_start; /* Start of Memory Mapped I/O */ + /* (physical address) */ + __u32 mmio_len; /* Length of Memory Mapped I/O */ + __u32 accel; /* Indicate to driver which */ + /* specific chip/card we have */ + __u16 reserved[3]; /* Reserved for future compatibility */ +}; + +/* Interpretation of offset for color fields: All offsets are from the right, + * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you + * can use the offset as right argument to <<). A pixel afterwards is a bit + * stream and is written to video memory as that unmodified. + * + * For pseudocolor: offset and length should be the same for all color + * components. Offset specifies the position of the least significant bit + * of the pallette index in a pixel value. Length indicates the number + * of available palette entries (i.e. # of entries = 1 << length). + */ +struct fb_bitfield { + __u32 offset; /* beginning of bitfield */ + __u32 length; /* length of bitfield */ + __u32 msb_right; /* != 0 : Most significant bit is */ + /* right */ +}; + +#define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */ +#define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */ + +#define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/ +#define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */ +#define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */ +#define FB_ACTIVATE_MASK 15 + /* values */ +#define FB_ACTIVATE_VBL 16 /* activate values on next vbl */ +#define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */ +#define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */ +#define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/ +#define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */ + +#define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */ + +#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ +#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ +#define FB_SYNC_EXT 4 /* external sync */ +#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ +#define FB_SYNC_BROADCAST 16 /* broadcast video timings */ + /* vtotal = 144d/288n/576i => PAL */ + /* vtotal = 121d/242n/484i => NTSC */ +#define FB_SYNC_ON_GREEN 32 /* sync on green */ + +#define FB_VMODE_NONINTERLACED 0 /* non interlaced */ +#define FB_VMODE_INTERLACED 1 /* interlaced */ +#define FB_VMODE_DOUBLE 2 /* double scan */ +#define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */ +#define FB_VMODE_MASK 255 + +#define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ +#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ +#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ + +/* + * Display rotation support + */ +#define FB_ROTATE_UR 0 +#define FB_ROTATE_CW 1 +#define FB_ROTATE_UD 2 +#define FB_ROTATE_CCW 3 + +#define PICOS2KHZ(a) (1000000000UL/(a)) +#define KHZ2PICOS(a) (1000000000UL/(a)) + +struct fb_var_screeninfo { + __u32 xres; /* visible resolution */ + __u32 yres; + __u32 xres_virtual; /* virtual resolution */ + __u32 yres_virtual; + __u32 xoffset; /* offset from virtual to visible */ + __u32 yoffset; /* resolution */ + + __u32 bits_per_pixel; /* guess what */ + __u32 grayscale; /* != 0 Graylevels instead of colors */ + + struct fb_bitfield red; /* bitfield in fb mem if true color, */ + struct fb_bitfield green; /* else only length is significant */ + struct fb_bitfield blue; + struct fb_bitfield transp; /* transparency */ + + __u32 nonstd; /* != 0 Non standard pixel format */ + + __u32 activate; /* see FB_ACTIVATE_* */ + + __u32 height; /* height of picture in mm */ + __u32 width; /* width of picture in mm */ + + __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */ + + /* Timing: All values in pixclocks, except pixclock (of course) */ + __u32 pixclock; /* pixel clock in ps (pico seconds) */ + __u32 left_margin; /* time from sync to picture */ + __u32 right_margin; /* time from picture to sync */ + __u32 upper_margin; /* time from sync to picture */ + __u32 lower_margin; + __u32 hsync_len; /* length of horizontal sync */ + __u32 vsync_len; /* length of vertical sync */ + __u32 sync; /* see FB_SYNC_* */ + __u32 vmode; /* see FB_VMODE_* */ + __u32 rotate; /* angle we rotate counter clockwise */ + __u32 reserved[5]; /* Reserved for future compatibility */ +}; + +struct fb_cmap { + __u32 start; /* First entry */ + __u32 len; /* Number of entries */ + __u16 *red; /* Red values */ + __u16 *green; + __u16 *blue; + __u16 *transp; /* transparency, can be NULL */ +}; + +struct fb_con2fbmap { + __u32 console; + __u32 framebuffer; +}; + +/* VESA Blanking Levels */ +#define VESA_NO_BLANKING 0 +#define VESA_VSYNC_SUSPEND 1 +#define VESA_HSYNC_SUSPEND 2 +#define VESA_POWERDOWN 3 + + +enum { + /* screen: unblanked, hsync: on, vsync: on */ + FB_BLANK_UNBLANK = VESA_NO_BLANKING, + + /* screen: blanked, hsync: on, vsync: on */ + FB_BLANK_NORMAL = VESA_NO_BLANKING + 1, + + /* screen: blanked, hsync: on, vsync: off */ + FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1, + + /* screen: blanked, hsync: off, vsync: on */ + FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1, + + /* screen: blanked, hsync: off, vsync: off */ + FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1 +}; + +#define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */ +#define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */ +#define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */ +#define FB_VBLANK_HAVE_HBLANK 0x008 /* horizontal blanks can be detected */ +#define FB_VBLANK_HAVE_COUNT 0x010 /* global retrace counter is available */ +#define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */ +#define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */ +#define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */ +#define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */ + +struct fb_vblank { + __u32 flags; /* FB_VBLANK flags */ + __u32 count; /* counter of retraces since boot */ + __u32 vcount; /* current scanline position */ + __u32 hcount; /* current scandot position */ + __u32 reserved[4]; /* reserved for future compatibility */ +}; + +/* Internal HW accel */ +#define ROP_COPY 0 +#define ROP_XOR 1 + +struct fb_copyarea { + __u32 dx; + __u32 dy; + __u32 width; + __u32 height; + __u32 sx; + __u32 sy; +}; + +struct fb_fillrect { + __u32 dx; /* screen-relative */ + __u32 dy; + __u32 width; + __u32 height; + __u32 color; + __u32 rop; +}; + +struct fb_image { + __u32 dx; /* Where to place image */ + __u32 dy; + __u32 width; /* Size of image */ + __u32 height; + __u32 fg_color; /* Only used when a mono bitmap */ + __u32 bg_color; + __u8 depth; /* Depth of the image */ + const char *data; /* Pointer to image data */ + struct fb_cmap cmap; /* color map info */ +}; + +/* + * hardware cursor control + */ + +#define FB_CUR_SETIMAGE 0x01 +#define FB_CUR_SETPOS 0x02 +#define FB_CUR_SETHOT 0x04 +#define FB_CUR_SETCMAP 0x08 +#define FB_CUR_SETSHAPE 0x10 +#define FB_CUR_SETSIZE 0x20 +#define FB_CUR_SETALL 0xFF + +struct fbcurpos { + __u16 x, y; +}; + +struct fb_cursor { + __u16 set; /* what to set */ + __u16 enable; /* cursor on/off */ + __u16 rop; /* bitop operation */ + const char *mask; /* cursor mask bits */ + struct fbcurpos hot; /* cursor hot spot */ + struct fb_image image; /* Cursor image */ +}; + +#ifdef CONFIG_FB_BACKLIGHT +/* Settings for the generic backlight code */ +#define FB_BACKLIGHT_LEVELS 128 +#define FB_BACKLIGHT_MAX 0xFF +#endif + + +#endif /* _LINUX_FB_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fcntl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fcntl.h new file mode 100644 index 0000000..a4cd365 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fcntl.h @@ -0,0 +1,44 @@ +#ifndef _LINUX_FCNTL_H +#define _LINUX_FCNTL_H + +#include + +#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0) +#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1) + +/* + * Cancel a blocking posix lock; internal use only until we expose an + * asynchronous lock api to userspace: + */ +#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5) + +/* Create a file descriptor with FD_CLOEXEC set. */ +#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) + +/* + * Request nofications on a directory. + * See below for events that may be notified. + */ +#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) + +/* + * Types of directory notifications that may be requested. + */ +#define DN_ACCESS 0x00000001 /* File accessed */ +#define DN_MODIFY 0x00000002 /* File modified */ +#define DN_CREATE 0x00000004 /* File created */ +#define DN_DELETE 0x00000008 /* File removed */ +#define DN_RENAME 0x00000010 /* File renamed */ +#define DN_ATTRIB 0x00000020 /* File changed attibutes */ +#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ + +#define AT_FDCWD -100 /* Special value used to indicate + openat should use the current + working directory. */ +#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ +#define AT_REMOVEDIR 0x200 /* Remove directory instead of + unlinking file. */ +#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fd.h new file mode 100644 index 0000000..d64375a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fd.h @@ -0,0 +1,380 @@ +#ifndef _LINUX_FD_H +#define _LINUX_FD_H + +#include + + +/* New file layout: Now the ioctl definitions immediately follow the + * definitions of the structures that they use */ + +/* + * Geometry + */ +struct floppy_struct { + unsigned int size, /* nr of sectors total */ + sect, /* sectors per track */ + head, /* nr of heads */ + track, /* nr of tracks */ + stretch; /* bit 0 !=0 means double track steps */ + /* bit 1 != 0 means swap sides */ + /* bits 2..9 give the first sector */ + /* number (the LSB is flipped) */ +#define FD_STRETCH 1 +#define FD_SWAPSIDES 2 +#define FD_ZEROBASED 4 +#define FD_SECTBASEMASK 0x3FC +#define FD_MKSECTBASE(s) (((s) ^ 1) << 2) +#define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) + + unsigned char gap, /* gap1 size */ + + rate, /* data rate. |= 0x40 for perpendicular */ +#define FD_2M 0x4 +#define FD_SIZECODEMASK 0x38 +#define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8) +#define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \ + 512 : 128 << FD_SIZECODE(floppy) ) +#define FD_PERP 0x40 + + spec1, /* stepping rate, head unload time */ + fmt_gap; /* gap2 size */ + const char * name; /* used only for predefined formats */ +}; + + +/* commands needing write access have 0x40 set */ +/* commands needing super user access have 0x80 set */ + +#define FDCLRPRM _IO(2, 0x41) +/* clear user-defined parameters */ + +#define FDSETPRM _IOW(2, 0x42, struct floppy_struct) +#define FDSETMEDIAPRM FDSETPRM +/* set user-defined parameters for current media */ + +#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) +#define FDGETPRM _IOR(2, 0x04, struct floppy_struct) +#define FDDEFMEDIAPRM FDDEFPRM +#define FDGETMEDIAPRM FDGETPRM +/* set/get disk parameters */ + + +#define FDMSGON _IO(2,0x45) +#define FDMSGOFF _IO(2,0x46) +/* issue/don't issue kernel messages on media type change */ + + +/* + * Formatting (obsolete) + */ +#define FD_FILL_BYTE 0xF6 /* format fill byte. */ + +struct format_descr { + unsigned int device,head,track; +}; + +#define FDFMTBEG _IO(2,0x47) +/* begin formatting a disk */ +#define FDFMTTRK _IOW(2,0x48, struct format_descr) +/* format the specified track */ +#define FDFMTEND _IO(2,0x49) +/* end formatting a disk */ + + +/* + * Error thresholds + */ +struct floppy_max_errors { + unsigned int + abort, /* number of errors to be reached before aborting */ + read_track, /* maximal number of errors permitted to read an + * entire track at once */ + reset, /* maximal number of errors before a reset is tried */ + recal, /* maximal number of errors before a recalibrate is + * tried */ + + /* + * Threshold for reporting FDC errors to the console. + * Setting this to zero may flood your screen when using + * ultra cheap floppies ;-) + */ + reporting; + +}; + +#define FDSETEMSGTRESH _IO(2,0x4a) +/* set fdc error reporting threshold */ + +#define FDFLUSH _IO(2,0x4b) +/* flush buffers for media; either for verifying media, or for + * handling a media change without closing the file descriptor */ + +#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) +#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) +/* set/get abortion and read_track threshold. See also floppy_drive_params + * structure */ + + +typedef char floppy_drive_name[16]; +#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) +/* get drive type: 5 1/4 or 3 1/2 */ + + +/* + * Drive parameters (user modifiable) + */ +struct floppy_drive_params { + signed char cmos; /* CMOS type */ + + /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms + * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA). + */ + unsigned long max_dtr; /* Step rate, usec */ + unsigned long hlt; /* Head load/settle time, msec */ + unsigned long hut; /* Head unload time (remnant of + * 8" drives) */ + unsigned long srt; /* Step rate, usec */ + + unsigned long spinup; /* time needed for spinup (expressed + * in jiffies) */ + unsigned long spindown; /* timeout needed for spindown */ + unsigned char spindown_offset; /* decides in which position the disk + * will stop */ + unsigned char select_delay; /* delay to wait after select */ + unsigned char rps; /* rotations per second */ + unsigned char tracks; /* maximum number of tracks */ + unsigned long timeout; /* timeout for interrupt requests */ + + unsigned char interleave_sect; /* if there are more sectors, use + * interleave */ + + struct floppy_max_errors max_errors; + + char flags; /* various flags, including ftd_msg */ +/* + * Announce successful media type detection and media information loss after + * disk changes. + * Also used to enable/disable printing of overrun warnings. + */ + +#define FTD_MSG 0x10 +#define FD_BROKEN_DCL 0x20 +#define FD_DEBUG 0x02 +#define FD_SILENT_DCL_CLEAR 0x4 +#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware + considerations */ + + char read_track; /* use readtrack during probing? */ + +/* + * Auto-detection. Each drive type has eight formats which are + * used in succession to try to read the disk. If the FDC cannot lock onto + * the disk, the next format is tried. This uses the variable 'probing'. + */ + short autodetect[8]; /* autodetected formats */ + + int checkfreq; /* how often should the drive be checked for disk + * changes */ + int native_format; /* native format of this drive */ +}; + +enum { + FD_NEED_TWADDLE_BIT, /* more magic */ + FD_VERIFY_BIT, /* inquire for write protection */ + FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet + * to clear media change status */ + FD_UNUSED_BIT, + FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */ + FD_DISK_WRITABLE_BIT /* disk is writable */ +}; + +#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) +#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) +/* set/get drive parameters */ + + +/* + * Current drive state (not directly modifiable by user, readonly) + */ +struct floppy_drive_struct { + unsigned long flags; +/* values for these flags */ +#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) +#define FD_VERIFY (1 << FD_VERIFY_BIT) +#define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) +#define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) +#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) + + unsigned long spinup_date; + unsigned long select_date; + unsigned long first_read_date; + short probed_format; + short track; /* current track */ + short maxblock; /* id of highest block read */ + short maxtrack; /* id of highest half track read */ + int generation; /* how many diskchanges? */ + +/* + * (User-provided) media information is _not_ discarded after a media change + * if the corresponding keep_data flag is non-zero. Positive values are + * decremented after each probe. + */ + int keep_data; + + /* Prevent "aliased" accesses. */ + int fd_ref; + int fd_device; + unsigned long last_checked; /* when was the drive last checked for a disk + * change? */ + + char *dmabuf; + int bufblocks; +}; + +#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) +#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) +/* get drive state: GET returns the cached state, POLL polls for new state */ + + +/* + * reset FDC + */ +enum reset_mode { + FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */ + FD_RESET_IF_RAWCMD, /* obsolete */ + FD_RESET_ALWAYS /* reset always */ +}; +#define FDRESET _IO(2, 0x54) + + +/* + * FDC state + */ +struct floppy_fdc_state { + int spec1; /* spec1 value last used */ + int spec2; /* spec2 value last used */ + int dtr; + unsigned char version; /* FDC version code */ + unsigned char dor; + unsigned long address; /* io address */ + unsigned int rawcmd:2; + unsigned int reset:1; + unsigned int need_configure:1; + unsigned int perp_mode:2; + unsigned int has_fifo:1; + unsigned int driver_version; /* version code for floppy driver */ +#define FD_DRIVER_VERSION 0x100 +/* user programs using the floppy API should use floppy_fdc_state to + * get the version number of the floppy driver that they are running + * on. If this version number is bigger than the one compiled into the + * user program (the FD_DRIVER_VERSION define), it should be prepared + * to bigger structures + */ + + unsigned char track[4]; + /* Position of the heads of the 4 units attached to this FDC, + * as stored on the FDC. In the future, the position as stored + * on the FDC might not agree with the actual physical + * position of these drive heads. By allowing such + * disagreement, it will be possible to reset the FDC without + * incurring the expensive cost of repositioning all heads. + * Right now, these positions are hard wired to 0. */ + +}; + +#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) + + +/* + * Asynchronous Write error tracking + */ +struct floppy_write_errors { + /* Write error logging. + * + * These fields can be cleared with the FDWERRORCLR ioctl. + * Only writes that were attempted but failed due to a physical media + * error are logged. write(2) calls that fail and return an error code + * to the user process are not counted. + */ + + unsigned int write_errors; /* number of physical write errors + * encountered */ + + /* position of first and last write errors */ + unsigned long first_error_sector; + int first_error_generation; + unsigned long last_error_sector; + int last_error_generation; + + unsigned int badness; /* highest retry count for a read or write + * operation */ +}; + +#define FDWERRORCLR _IO(2, 0x56) +/* clear write error and badness information */ +#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) +/* get write error and badness information */ + + +/* + * Raw commands + */ +/* new interface flag: now we can do them in batches */ +#define FDHAVEBATCHEDRAWCMD + +struct floppy_raw_cmd { + unsigned int flags; +#define FD_RAW_READ 1 +#define FD_RAW_WRITE 2 +#define FD_RAW_NO_MOTOR 4 +#define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */ +#define FD_RAW_INTR 8 /* wait for an interrupt */ +#define FD_RAW_SPIN 0x10 /* spin up the disk for this command */ +#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command + * completion */ +#define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */ +#define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */ + +/* more "in" flags */ +#define FD_RAW_MORE 0x100 /* more records follow */ +#define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */ +#define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */ +#define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure + * detection too */ + +/* more "out" flags */ +#define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */ +#define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */ + + void *data; + char *kernel_data; /* location of data buffer in the kernel */ + struct floppy_raw_cmd *next; /* used for chaining of raw cmd's + * within the kernel */ + long length; /* in: length of dma transfer. out: remaining bytes */ + long phys_length; /* physical length, if different from dma length */ + int buffer_length; /* length of allocated buffer */ + + unsigned char rate; + unsigned char cmd_count; + unsigned char cmd[16]; + unsigned char reply_count; + unsigned char reply[16]; + int track; + int resultcode; + + int reserved1; + int reserved2; +}; + +#define FDRAWCMD _IO(2, 0x58) +/* send a raw command to the fdc. Structure size not included, because of + * batches */ + +#define FDTWADDLE _IO(2, 0x59) +/* flicker motor-on bit before reading a sector. Experimental */ + + +#define FDEJECT _IO(2, 0x5a) +/* eject the disk */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fdreg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fdreg.h new file mode 100644 index 0000000..c2eeb63 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fdreg.h @@ -0,0 +1,137 @@ +#ifndef _LINUX_FDREG_H +#define _LINUX_FDREG_H +/* + * This file contains some defines for the floppy disk controller. + * Various sources. Mostly "IBM Microcomputers: A Programmers + * Handbook", Sanches and Canton. + */ + +#ifdef FDPATCHES +#define FD_IOPORT fdc_state[fdc].address +#else +/* It would be a lot saner just to force fdc_state[fdc].address to always + be set ! FIXME */ +#define FD_IOPORT 0x3f0 +#endif + +/* Fd controller regs. S&C, about page 340 */ +#define FD_STATUS (4 + FD_IOPORT ) +#define FD_DATA (5 + FD_IOPORT ) + +/* Digital Output Register */ +#define FD_DOR (2 + FD_IOPORT ) + +/* Digital Input Register (read) */ +#define FD_DIR (7 + FD_IOPORT ) + +/* Diskette Control Register (write)*/ +#define FD_DCR (7 + FD_IOPORT ) + +/* Bits of main status register */ +#define STATUS_BUSYMASK 0x0F /* drive busy mask */ +#define STATUS_BUSY 0x10 /* FDC busy */ +#define STATUS_DMA 0x20 /* 0- DMA mode */ +#define STATUS_DIR 0x40 /* 0- cpu->fdc */ +#define STATUS_READY 0x80 /* Data reg ready */ + +/* Bits of FD_ST0 */ +#define ST0_DS 0x03 /* drive select mask */ +#define ST0_HA 0x04 /* Head (Address) */ +#define ST0_NR 0x08 /* Not Ready */ +#define ST0_ECE 0x10 /* Equipment check error */ +#define ST0_SE 0x20 /* Seek end */ +#define ST0_INTR 0xC0 /* Interrupt code mask */ + +/* Bits of FD_ST1 */ +#define ST1_MAM 0x01 /* Missing Address Mark */ +#define ST1_WP 0x02 /* Write Protect */ +#define ST1_ND 0x04 /* No Data - unreadable */ +#define ST1_OR 0x10 /* OverRun */ +#define ST1_CRC 0x20 /* CRC error in data or addr */ +#define ST1_EOC 0x80 /* End Of Cylinder */ + +/* Bits of FD_ST2 */ +#define ST2_MAM 0x01 /* Missing Address Mark (again) */ +#define ST2_BC 0x02 /* Bad Cylinder */ +#define ST2_SNS 0x04 /* Scan Not Satisfied */ +#define ST2_SEH 0x08 /* Scan Equal Hit */ +#define ST2_WC 0x10 /* Wrong Cylinder */ +#define ST2_CRC 0x20 /* CRC error in data field */ +#define ST2_CM 0x40 /* Control Mark = deleted */ + +/* Bits of FD_ST3 */ +#define ST3_HA 0x04 /* Head (Address) */ +#define ST3_DS 0x08 /* drive is double-sided */ +#define ST3_TZ 0x10 /* Track Zero signal (1=track 0) */ +#define ST3_RY 0x20 /* drive is ready */ +#define ST3_WP 0x40 /* Write Protect */ +#define ST3_FT 0x80 /* Drive Fault */ + +/* Values for FD_COMMAND */ +#define FD_RECALIBRATE 0x07 /* move to track 0 */ +#define FD_SEEK 0x0F /* seek track */ +#define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */ +#define FD_WRITE 0xC5 /* write with MT, MFM */ +#define FD_SENSEI 0x08 /* Sense Interrupt Status */ +#define FD_SPECIFY 0x03 /* specify HUT etc */ +#define FD_FORMAT 0x4D /* format one track */ +#define FD_VERSION 0x10 /* get version code */ +#define FD_CONFIGURE 0x13 /* configure FIFO operation */ +#define FD_PERPENDICULAR 0x12 /* perpendicular r/w mode */ +#define FD_GETSTATUS 0x04 /* read ST3 */ +#define FD_DUMPREGS 0x0E /* dump the contents of the fdc regs */ +#define FD_READID 0xEA /* prints the header of a sector */ +#define FD_UNLOCK 0x14 /* Fifo config unlock */ +#define FD_LOCK 0x94 /* Fifo config lock */ +#define FD_RSEEK_OUT 0x8f /* seek out (i.e. to lower tracks) */ +#define FD_RSEEK_IN 0xcf /* seek in (i.e. to higher tracks) */ + +/* the following commands are new in the 82078. They are not used in the + * floppy driver, except the first three. These commands may be useful for apps + * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at + * http://www-techdoc.intel.com/docs/periph/fd_contr/datasheets/ */ + +#define FD_PARTID 0x18 /* part id ("extended" version cmd) */ +#define FD_SAVE 0x2e /* save fdc regs for later restore */ +#define FD_DRIVESPEC 0x8e /* drive specification: Access to the + * 2 Mbps data transfer rate for tape + * drives */ + +#define FD_RESTORE 0x4e /* later restore */ +#define FD_POWERDOWN 0x27 /* configure FDC's powersave features */ +#define FD_FORMAT_N_WRITE 0xef /* format and write in one go. */ +#define FD_OPTION 0x33 /* ISO format (which is a clean way to + * pack more sectors on a track) */ + +/* DMA commands */ +#define DMA_READ 0x46 +#define DMA_WRITE 0x4A + +/* FDC version return types */ +#define FDC_NONE 0x00 +#define FDC_UNKNOWN 0x10 /* DO NOT USE THIS TYPE EXCEPT IF IDENTIFICATION + FAILS EARLY */ +#define FDC_8272A 0x20 /* Intel 8272a, NEC 765 */ +#define FDC_765ED 0x30 /* Non-Intel 1MB-compatible FDC, can't detect */ +#define FDC_82072 0x40 /* Intel 82072; 8272a + FIFO + DUMPREGS */ +#define FDC_82072A 0x45 /* 82072A (on Sparcs) */ +#define FDC_82077_ORIG 0x51 /* Original version of 82077AA, sans LOCK */ +#define FDC_82077 0x52 /* 82077AA-1 */ +#define FDC_82078_UNKN 0x5f /* Unknown 82078 variant */ +#define FDC_82078 0x60 /* 44pin 82078 or 64pin 82078SL */ +#define FDC_82078_1 0x61 /* 82078-1 (2Mbps fdc) */ +#define FDC_S82078B 0x62 /* S82078B (first seen on Adaptec AVA-2825 VLB + * SCSI/EIDE/Floppy controller) */ +#define FDC_87306 0x63 /* National Semiconductor PC 87306 */ + +/* + * Beware: the fdc type list is roughly sorted by increasing features. + * Presence of features is tested by comparing the FDC version id with the + * "oldest" version that has the needed feature. + * If during FDC detection, an obscure test fails late in the sequence, don't + * assign FDC_UNKNOWN. Else the FDC will be treated as a dumb 8272a, or worse. + * This is especially true if the tests are unneeded. + */ + +#define FD_RESET_DELAY 20 +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fib_rules.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fib_rules.h new file mode 100644 index 0000000..87b606b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fib_rules.h @@ -0,0 +1,71 @@ +#ifndef __LINUX_FIB_RULES_H +#define __LINUX_FIB_RULES_H + +#include +#include + +/* rule is permanent, and cannot be deleted */ +#define FIB_RULE_PERMANENT 0x00000001 +#define FIB_RULE_INVERT 0x00000002 +#define FIB_RULE_UNRESOLVED 0x00000004 +#define FIB_RULE_DEV_DETACHED 0x00000008 + +/* try to find source address in routing lookups */ +#define FIB_RULE_FIND_SADDR 0x00010000 + +struct fib_rule_hdr +{ + __u8 family; + __u8 dst_len; + __u8 src_len; + __u8 tos; + + __u8 table; + __u8 res1; /* reserved */ + __u8 res2; /* reserved */ + __u8 action; + + __u32 flags; +}; + +enum +{ + FRA_UNSPEC, + FRA_DST, /* destination address */ + FRA_SRC, /* source address */ + FRA_IFNAME, /* interface name */ + FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ + FRA_UNUSED2, + FRA_PRIORITY, /* priority/preference */ + FRA_UNUSED3, + FRA_UNUSED4, + FRA_UNUSED5, + FRA_FWMARK, /* mark */ + FRA_FLOW, /* flow/class id */ + FRA_UNUSED6, + FRA_UNUSED7, + FRA_UNUSED8, + FRA_TABLE, /* Extended table id */ + FRA_FWMASK, /* mask for netfilter mark */ + __FRA_MAX +}; + +#define FRA_MAX (__FRA_MAX - 1) + +enum +{ + FR_ACT_UNSPEC, + FR_ACT_TO_TBL, /* Pass to fixed table */ + FR_ACT_GOTO, /* Jump to another rule */ + FR_ACT_NOP, /* No operation */ + FR_ACT_RES3, + FR_ACT_RES4, + FR_ACT_BLACKHOLE, /* Drop without notification */ + FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ + FR_ACT_PROHIBIT, /* Drop with EACCES */ + __FR_ACT_MAX, +}; + +#define FR_ACT_MAX (__FR_ACT_MAX - 1) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fiemap.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fiemap.h new file mode 100644 index 0000000..934e22d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fiemap.h @@ -0,0 +1,66 @@ +/* + * FS_IOC_FIEMAP ioctl infrastructure. + * + * Some portions copyright (C) 2007 Cluster File Systems, Inc + * + * Authors: Mark Fasheh + * Kalpak Shah + * Andreas Dilger + */ + +#ifndef _LINUX_FIEMAP_H +#define _LINUX_FIEMAP_H + +#include + +struct fiemap_extent { + __u64 fe_logical; /* logical offset in bytes for the start of + * the extent from the beginning of the file */ + __u64 fe_physical; /* physical offset in bytes for the start + * of the extent from the beginning of the disk */ + __u64 fe_length; /* length in bytes for this extent */ + __u64 fe_reserved64[2]; + __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */ + __u32 fe_reserved[3]; +}; + +struct fiemap { + __u64 fm_start; /* logical offset (inclusive) at + * which to start mapping (in) */ + __u64 fm_length; /* logical length of mapping which + * userspace wants (in) */ + __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ + __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ + __u32 fm_extent_count; /* size of fm_extents array (in) */ + __u32 fm_reserved; + struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ +}; + +#define FIEMAP_MAX_OFFSET (~0ULL) + +#define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */ +#define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */ + +#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) + +#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */ +#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */ +#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending. + * Sets EXTENT_UNKNOWN. */ +#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read + * while fs is unmounted */ +#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. + * Sets EXTENT_NO_BYPASS. */ +#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be + * block aligned. */ +#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. + * Sets EXTENT_NOT_ALIGNED.*/ +#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. + * Sets EXTENT_NOT_ALIGNED.*/ +#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but + * no data (i.e. zero). */ +#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively + * support extents. Result + * merged for efficiency. */ + +#endif /* _LINUX_FIEMAP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/filter.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/filter.h new file mode 100644 index 0000000..0e4dbed --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/filter.h @@ -0,0 +1,128 @@ +/* + * Linux Socket Filter Data Structures + */ + +#ifndef __LINUX_FILTER_H__ +#define __LINUX_FILTER_H__ + + +#include + + +/* + * Current version of the filter code architecture. + */ +#define BPF_MAJOR_VERSION 1 +#define BPF_MINOR_VERSION 1 + +/* + * Try and keep these values and structures similar to BSD, especially + * the BPF code definitions which need to match so you can share filters + */ + +struct sock_filter /* Filter block */ +{ + __u16 code; /* Actual filter code */ + __u8 jt; /* Jump true */ + __u8 jf; /* Jump false */ + __u32 k; /* Generic multiuse field */ +}; + +struct sock_fprog /* Required for SO_ATTACH_FILTER. */ +{ + unsigned short len; /* Number of filter blocks */ + struct sock_filter *filter; +}; + +/* + * Instruction classes + */ + +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +#define BPF_TXA 0x80 + +#ifndef BPF_MAXINSNS +#define BPF_MAXINSNS 4096 +#endif + +/* + * Macros for filter block array initializers. + */ +#ifndef BPF_STMT +#define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } +#endif +#ifndef BPF_JUMP +#define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } +#endif + +/* + * Number of scratch memory words for: BPF_ST and BPF_STX + */ +#define BPF_MEMWORDS 16 + +/* RATIONALE. Negative offsets are invalid in BPF. + We use them to reference ancillary data. + Unlike introduction new instructions, it does not break + existing compilers/optimizers. + */ +#define SKF_AD_OFF (-0x1000) +#define SKF_AD_PROTOCOL 0 +#define SKF_AD_PKTTYPE 4 +#define SKF_AD_IFINDEX 8 +#define SKF_AD_NLATTR 12 +#define SKF_AD_NLATTR_NEST 16 +#define SKF_AD_MAX 20 +#define SKF_NET_OFF (-0x100000) +#define SKF_LL_OFF (-0x200000) + + +#endif /* __LINUX_FILTER_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/firewire-cdev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/firewire-cdev.h new file mode 100644 index 0000000..c6b3ca3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/firewire-cdev.h @@ -0,0 +1,634 @@ +/* + * Char device interface. + * + * Copyright (C) 2005-2006 Kristian Hoegsberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _LINUX_FIREWIRE_CDEV_H +#define _LINUX_FIREWIRE_CDEV_H + +#include +#include +#include + +#define FW_CDEV_EVENT_BUS_RESET 0x00 +#define FW_CDEV_EVENT_RESPONSE 0x01 +#define FW_CDEV_EVENT_REQUEST 0x02 +#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 +#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 +#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 + +/** + * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types + * @closure: For arbitrary use by userspace + * @type: Discriminates the fw_cdev_event_ types + * + * This struct may be used to access generic members of all fw_cdev_event_ + * types regardless of the specific type. + * + * Data passed in the @closure field for a request will be returned in the + * corresponding event. It is big enough to hold a pointer on all platforms. + * The ioctl used to set @closure depends on the @type of event. + */ +struct fw_cdev_event_common { + __u64 closure; + __u32 type; +}; + +/** + * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred + * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET + * @node_id: New node ID of this node + * @local_node_id: Node ID of the local node, i.e. of the controller + * @bm_node_id: Node ID of the bus manager + * @irm_node_id: Node ID of the iso resource manager + * @root_node_id: Node ID of the root node + * @generation: New bus generation + * + * This event is sent when the bus the device belongs to goes through a bus + * reset. It provides information about the new bus configuration, such as + * new node ID for this device, new root ID, and others. + */ +struct fw_cdev_event_bus_reset { + __u64 closure; + __u32 type; + __u32 node_id; + __u32 local_node_id; + __u32 bm_node_id; + __u32 irm_node_id; + __u32 root_node_id; + __u32 generation; +}; + +/** + * struct fw_cdev_event_response - Sent when a response packet was received + * @closure: See &fw_cdev_event_common; + * set by %FW_CDEV_IOC_SEND_REQUEST ioctl + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE + * @rcode: Response code returned by the remote node + * @length: Data length, i.e. the response's payload size in bytes + * @data: Payload data, if any + * + * This event is sent when the stack receives a response to an outgoing request + * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses + * carrying data (read and lock responses) follows immediately and can be + * accessed through the @data field. + */ +struct fw_cdev_event_response { + __u64 closure; + __u32 type; + __u32 rcode; + __u32 length; + __u32 data[0]; +}; + +/** + * struct fw_cdev_event_request - Sent on incoming request to an address region + * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST + * @tcode: Transaction code of the incoming request + * @offset: The offset into the 48-bit per-node address space + * @handle: Reference to the kernel-side pending request + * @length: Data length, i.e. the request's payload size in bytes + * @data: Incoming data, if any + * + * This event is sent when the stack receives an incoming request to an address + * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is + * guaranteed to be completely contained in the specified region. Userspace is + * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl, + * using the same @handle. + * + * The payload data for requests carrying data (write and lock requests) + * follows immediately and can be accessed through the @data field. + */ +struct fw_cdev_event_request { + __u64 closure; + __u32 type; + __u32 tcode; + __u64 offset; + __u32 handle; + __u32 length; + __u32 data[0]; +}; + +/** + * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed + * @closure: See &fw_cdev_event_common; + * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT + * @cycle: Cycle counter of the interrupt packet + * @header_length: Total length of following headers, in bytes + * @header: Stripped headers, if any + * + * This event is sent when the controller has completed an &fw_cdev_iso_packet + * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers + * stripped of all packets up until and including the interrupt packet are + * returned in the @header field. The amount of header data per packet is as + * specified at iso context creation by &fw_cdev_create_iso_context.header_size. + * + * In version 1 of this ABI, header data consisted of the 1394 isochronous + * packet header, followed by quadlets from the packet payload if + * &fw_cdev_create_iso_context.header_size > 4. + * + * In version 2 of this ABI, header data consist of the 1394 isochronous + * packet header, followed by a timestamp quadlet if + * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the + * packet payload if &fw_cdev_create_iso_context.header_size > 8. + * + * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2. + * + * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel, + * 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp: + * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte + * order. + */ +struct fw_cdev_event_iso_interrupt { + __u64 closure; + __u32 type; + __u32 cycle; + __u32 header_length; + __u32 header[0]; +}; + +/** + * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed + * @closure: See &fw_cdev_event_common; + * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl + * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or + * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED + * @handle: Reference by which an allocated resource can be deallocated + * @channel: Isochronous channel which was (de)allocated, if any + * @bandwidth: Bandwidth allocation units which were (de)allocated, if any + * + * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous + * resource was allocated at the IRM. The client has to check @channel and + * @bandwidth for whether the allocation actually succeeded. + * + * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous + * resource was deallocated at the IRM. It is also sent when automatic + * reallocation after a bus reset failed. + * + * @channel is <0 if no channel was (de)allocated or if reallocation failed. + * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed. + */ +struct fw_cdev_event_iso_resource { + __u64 closure; + __u32 type; + __u32 handle; + __s32 channel; + __s32 bandwidth; +}; + +/** + * union fw_cdev_event - Convenience union of fw_cdev_event_ types + * @common: Valid for all types + * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET + * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE + * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST + * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT + * @iso_resource: Valid if @common.type == + * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or + * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED + * + * Convenience union for userspace use. Events could be read(2) into an + * appropriately aligned char buffer and then cast to this union for further + * processing. Note that for a request, response or iso_interrupt event, + * the data[] or header[] may make the size of the full event larger than + * sizeof(union fw_cdev_event). Also note that if you attempt to read(2) + * an event into a buffer that is not large enough for it, the data that does + * not fit will be discarded so that the next read(2) will return a new event. + */ +union fw_cdev_event { + struct fw_cdev_event_common common; + struct fw_cdev_event_bus_reset bus_reset; + struct fw_cdev_event_response response; + struct fw_cdev_event_request request; + struct fw_cdev_event_iso_interrupt iso_interrupt; + struct fw_cdev_event_iso_resource iso_resource; +}; + +/* available since kernel version 2.6.22 */ +#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) +#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) +#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) +#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) +#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) +#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) +#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) +#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) +#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) +#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) +#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) +#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso) + +/* available since kernel version 2.6.24 */ +#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer) + +/* available since kernel version 2.6.30 */ +#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource) +#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate) +#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource) +#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource) +#define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */ +#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) +#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) + +/* + * FW_CDEV_VERSION History + * 1 (2.6.22) - initial version + * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if + * &fw_cdev_create_iso_context.header_size is 8 or more + */ +#define FW_CDEV_VERSION 2 + +/** + * struct fw_cdev_get_info - General purpose information ioctl + * @version: The version field is just a running serial number. + * We never break backwards compatibility, but may add more + * structs and ioctls in later revisions. + * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration + * ROM will be copied into that user space address. In either + * case, @rom_length is updated with the actual length of the + * configuration ROM. + * @rom: If non-zero, address of a buffer to be filled by a copy of the + * device's configuration ROM + * @bus_reset: If non-zero, address of a buffer to be filled by a + * &struct fw_cdev_event_bus_reset with the current state + * of the bus. This does not cause a bus reset to happen. + * @bus_reset_closure: Value of &closure in this and subsequent bus reset events + * @card: The index of the card this device belongs to + */ +struct fw_cdev_get_info { + __u32 version; + __u32 rom_length; + __u64 rom; + __u64 bus_reset; + __u64 bus_reset_closure; + __u32 card; +}; + +/** + * struct fw_cdev_send_request - Send an asynchronous request packet + * @tcode: Transaction code of the request + * @length: Length of outgoing payload, in bytes + * @offset: 48-bit offset at destination node + * @closure: Passed back to userspace in the response event + * @data: Userspace pointer to payload + * @generation: The bus generation where packet is valid + * + * Send a request to the device. This ioctl implements all outgoing requests. + * Both quadlet and block request specify the payload as a pointer to the data + * in the @data field. Once the transaction completes, the kernel writes an + * &fw_cdev_event_response event back. The @closure field is passed back to + * user space in the response event. + */ +struct fw_cdev_send_request { + __u32 tcode; + __u32 length; + __u64 offset; + __u64 closure; + __u64 data; + __u32 generation; +}; + +/** + * struct fw_cdev_send_response - Send an asynchronous response packet + * @rcode: Response code as determined by the userspace handler + * @length: Length of outgoing payload, in bytes + * @data: Userspace pointer to payload + * @handle: The handle from the &fw_cdev_event_request + * + * Send a response to an incoming request. By setting up an address range using + * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An + * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must + * send a reply using this ioctl. The event has a handle to the kernel-side + * pending transaction, which should be used with this ioctl. + */ +struct fw_cdev_send_response { + __u32 rcode; + __u32 length; + __u64 data; + __u32 handle; +}; + +/** + * struct fw_cdev_allocate - Allocate a CSR address range + * @offset: Start offset of the address range + * @closure: To be passed back to userspace in request events + * @length: Length of the address range, in bytes + * @handle: Handle to the allocation, written by the kernel + * + * Allocate an address range in the 48-bit address space on the local node + * (the controller). This allows userspace to listen for requests with an + * offset within that address range. When the kernel receives a request + * within the range, an &fw_cdev_event_request event will be written back. + * The @closure field is passed back to userspace in the response event. + * The @handle field is an out parameter, returning a handle to the allocated + * range to be used for later deallocation of the range. + */ +struct fw_cdev_allocate { + __u64 offset; + __u64 closure; + __u32 length; + __u32 handle; +}; + +/** + * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource + * @handle: Handle to the address range or iso resource, as returned by the + * kernel when the range or resource was allocated + */ +struct fw_cdev_deallocate { + __u32 handle; +}; + +#define FW_CDEV_LONG_RESET 0 +#define FW_CDEV_SHORT_RESET 1 + +/** + * struct fw_cdev_initiate_bus_reset - Initiate a bus reset + * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET + * + * Initiate a bus reset for the bus this device is on. The bus reset can be + * either the original (long) bus reset or the arbitrated (short) bus reset + * introduced in 1394a-2000. + */ +struct fw_cdev_initiate_bus_reset { + __u32 type; /* FW_CDEV_SHORT_RESET or FW_CDEV_LONG_RESET */ +}; + +/** + * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM + * @immediate: If non-zero, immediate key to insert before pointer + * @key: Upper 8 bits of root directory pointer + * @data: Userspace pointer to contents of descriptor block + * @length: Length of descriptor block data, in bytes + * @handle: Handle to the descriptor, written by the kernel + * + * Add a descriptor block and optionally a preceding immediate key to the local + * node's configuration ROM. + * + * The @key field specifies the upper 8 bits of the descriptor root directory + * pointer and the @data and @length fields specify the contents. The @key + * should be of the form 0xXX000000. The offset part of the root directory entry + * will be filled in by the kernel. + * + * If not 0, the @immediate field specifies an immediate key which will be + * inserted before the root directory pointer. + * + * If successful, the kernel adds the descriptor and writes back a handle to the + * kernel-side object to be used for later removal of the descriptor block and + * immediate key. + * + * This ioctl affects the configuration ROMs of all local nodes. + * The ioctl only succeeds on device files which represent a local node. + */ +struct fw_cdev_add_descriptor { + __u32 immediate; + __u32 key; + __u64 data; + __u32 length; + __u32 handle; +}; + +/** + * struct fw_cdev_remove_descriptor - Remove contents from the configuration ROM + * @handle: Handle to the descriptor, as returned by the kernel when the + * descriptor was added + * + * Remove a descriptor block and accompanying immediate key from the local + * nodes' configuration ROMs. + */ +struct fw_cdev_remove_descriptor { + __u32 handle; +}; + +#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 +#define FW_CDEV_ISO_CONTEXT_RECEIVE 1 + +/** + * struct fw_cdev_create_iso_context - Create a context for isochronous IO + * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE + * @header_size: Header size to strip for receive contexts + * @channel: Channel to bind to + * @speed: Speed to transmit at + * @closure: To be returned in &fw_cdev_event_iso_interrupt + * @handle: Handle to context, written back by kernel + * + * Prior to sending or receiving isochronous I/O, a context must be created. + * The context records information about the transmit or receive configuration + * and typically maps to an underlying hardware resource. A context is set up + * for either sending or receiving. It is bound to a specific isochronous + * channel. + * + * If a context was successfully created, the kernel writes back a handle to the + * context, which must be passed in for subsequent operations on that context. + * + * Note that the effect of a @header_size > 4 depends on + * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt. + */ +struct fw_cdev_create_iso_context { + __u32 type; + __u32 header_size; + __u32 channel; + __u32 speed; + __u64 closure; + __u32 handle; +}; + +#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v) +#define FW_CDEV_ISO_INTERRUPT (1 << 16) +#define FW_CDEV_ISO_SKIP (1 << 17) +#define FW_CDEV_ISO_SYNC (1 << 17) +#define FW_CDEV_ISO_TAG(v) ((v) << 18) +#define FW_CDEV_ISO_SY(v) ((v) << 20) +#define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24) + +/** + * struct fw_cdev_iso_packet - Isochronous packet + * @control: Contains the header length (8 uppermost bits), the sy field + * (4 bits), the tag field (2 bits), a sync flag (1 bit), + * a skip flag (1 bit), an interrupt flag (1 bit), and the + * payload length (16 lowermost bits) + * @header: Header and payload + * + * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. + * + * Use the FW_CDEV_ISO_ macros to fill in @control. The sy and tag fields are + * specified by IEEE 1394a and IEC 61883. + * + * FIXME - finish this documentation + */ +struct fw_cdev_iso_packet { + __u32 control; + __u32 header[0]; +}; + +/** + * struct fw_cdev_queue_iso - Queue isochronous packets for I/O + * @packets: Userspace pointer to packet data + * @data: Pointer into mmap()'ed payload buffer + * @size: Size of packet data in bytes + * @handle: Isochronous context handle + * + * Queue a number of isochronous packets for reception or transmission. + * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, + * which describe how to transmit from or receive into a contiguous region + * of a mmap()'ed payload buffer. As part of the packet descriptors, + * a series of headers can be supplied, which will be prepended to the + * payload during DMA. + * + * The kernel may or may not queue all packets, but will write back updated + * values of the @packets, @data and @size fields, so the ioctl can be + * resubmitted easily. + */ +struct fw_cdev_queue_iso { + __u64 packets; + __u64 data; + __u32 size; + __u32 handle; +}; + +#define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1 +#define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2 +#define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4 +#define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8 +#define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15 + +/** + * struct fw_cdev_start_iso - Start an isochronous transmission or reception + * @cycle: Cycle in which to start I/O. If @cycle is greater than or + * equal to 0, the I/O will start on that cycle. + * @sync: Determines the value to wait for for receive packets that have + * the %FW_CDEV_ISO_SYNC bit set + * @tags: Tag filter bit mask. Only valid for isochronous reception. + * Determines the tag values for which packets will be accepted. + * Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags. + * @handle: Isochronous context handle within which to transmit or receive + */ +struct fw_cdev_start_iso { + __s32 cycle; + __u32 sync; + __u32 tags; + __u32 handle; +}; + +/** + * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception + * @handle: Handle of isochronous context to stop + */ +struct fw_cdev_stop_iso { + __u32 handle; +}; + +/** + * struct fw_cdev_get_cycle_timer - read cycle timer register + * @local_time: system time, in microseconds since the Epoch + * @cycle_timer: isochronous cycle timer, as per OHCI 1.1 clause 5.13 + * + * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer + * and also the system clock. This allows to express the receive time of an + * isochronous packet as a system time with microsecond accuracy. + * + * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and + * 12 bits cycleOffset, in host byte order. + */ +struct fw_cdev_get_cycle_timer { + __u64 local_time; + __u32 cycle_timer; +}; + +/** + * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth + * @closure: Passed back to userspace in correponding iso resource events + * @channels: Isochronous channels of which one is to be (de)allocated + * @bandwidth: Isochronous bandwidth units to be (de)allocated + * @handle: Handle to the allocation, written by the kernel (only valid in + * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls) + * + * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an + * isochronous channel and/or of isochronous bandwidth at the isochronous + * resource manager (IRM). Only one of the channels specified in @channels is + * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after + * communication with the IRM, indicating success or failure in the event data. + * The kernel will automatically reallocate the resources after bus resets. + * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event + * will be sent. The kernel will also automatically deallocate the resources + * when the file descriptor is closed. + * + * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate + * deallocation of resources which were allocated as described above. + * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. + * + * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation + * without automatic re- or deallocation. + * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation, + * indicating success or failure in its data. + * + * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like + * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed + * instead of allocated. + * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. + * + * To summarize, %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE allocates iso resources + * for the lifetime of the fd or handle. + * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources + * for the duration of a bus generation. + * + * @channels is a host-endian bitfield with the least significant bit + * representing channel 0 and the most significant bit representing channel 63: + * 1ULL << c for each channel c that is a candidate for (de)allocation. + * + * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send + * one quadlet of data (payload or header data) at speed S1600. + */ +struct fw_cdev_allocate_iso_resource { + __u64 closure; + __u64 channels; + __u32 bandwidth; + __u32 handle; +}; + +/** + * struct fw_cdev_send_stream_packet - send an asynchronous stream packet + * @length: Length of outgoing payload, in bytes + * @tag: Data format tag + * @channel: Isochronous channel to transmit to + * @sy: Synchronization code + * @closure: Passed back to userspace in the response event + * @data: Userspace pointer to payload + * @generation: The bus generation where packet is valid + * @speed: Speed to transmit at + * + * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet + * to every device which is listening to the specified channel. The kernel + * writes an &fw_cdev_event_response event which indicates success or failure of + * the transmission. + */ +struct fw_cdev_send_stream_packet { + __u32 length; + __u32 tag; + __u32 channel; + __u32 sy; + __u64 closure; + __u64 data; + __u32 generation; + __u32 speed; +}; + +#endif /* _LINUX_FIREWIRE_CDEV_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/firewire-constants.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/firewire-constants.h new file mode 100644 index 0000000..b316770 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/firewire-constants.h @@ -0,0 +1,67 @@ +#ifndef _LINUX_FIREWIRE_CONSTANTS_H +#define _LINUX_FIREWIRE_CONSTANTS_H + +#define TCODE_WRITE_QUADLET_REQUEST 0x0 +#define TCODE_WRITE_BLOCK_REQUEST 0x1 +#define TCODE_WRITE_RESPONSE 0x2 +#define TCODE_READ_QUADLET_REQUEST 0x4 +#define TCODE_READ_BLOCK_REQUEST 0x5 +#define TCODE_READ_QUADLET_RESPONSE 0x6 +#define TCODE_READ_BLOCK_RESPONSE 0x7 +#define TCODE_CYCLE_START 0x8 +#define TCODE_LOCK_REQUEST 0x9 +#define TCODE_STREAM_DATA 0xa +#define TCODE_LOCK_RESPONSE 0xb + +#define EXTCODE_MASK_SWAP 0x1 +#define EXTCODE_COMPARE_SWAP 0x2 +#define EXTCODE_FETCH_ADD 0x3 +#define EXTCODE_LITTLE_ADD 0x4 +#define EXTCODE_BOUNDED_ADD 0x5 +#define EXTCODE_WRAP_ADD 0x6 +#define EXTCODE_VENDOR_DEPENDENT 0x7 + +/* Juju specific tcodes */ +#define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP) +#define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP) +#define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD) +#define TCODE_LOCK_LITTLE_ADD (0x10 | EXTCODE_LITTLE_ADD) +#define TCODE_LOCK_BOUNDED_ADD (0x10 | EXTCODE_BOUNDED_ADD) +#define TCODE_LOCK_WRAP_ADD (0x10 | EXTCODE_WRAP_ADD) +#define TCODE_LOCK_VENDOR_DEPENDENT (0x10 | EXTCODE_VENDOR_DEPENDENT) + +#define RCODE_COMPLETE 0x0 +#define RCODE_CONFLICT_ERROR 0x4 +#define RCODE_DATA_ERROR 0x5 +#define RCODE_TYPE_ERROR 0x6 +#define RCODE_ADDRESS_ERROR 0x7 + +/* Juju specific rcodes */ +#define RCODE_SEND_ERROR 0x10 +#define RCODE_CANCELLED 0x11 +#define RCODE_BUSY 0x12 +#define RCODE_GENERATION 0x13 +#define RCODE_NO_ACK 0x14 + +#define SCODE_100 0x0 +#define SCODE_200 0x1 +#define SCODE_400 0x2 +#define SCODE_800 0x3 +#define SCODE_1600 0x4 +#define SCODE_3200 0x5 +#define SCODE_BETA 0x3 + +#define ACK_COMPLETE 0x1 +#define ACK_PENDING 0x2 +#define ACK_BUSY_X 0x4 +#define ACK_BUSY_A 0x5 +#define ACK_BUSY_B 0x6 +#define ACK_DATA_ERROR 0xd +#define ACK_TYPE_ERROR 0xe + +#define RETRY_1 0x00 +#define RETRY_X 0x01 +#define RETRY_A 0x02 +#define RETRY_B 0x03 + +#endif /* _LINUX_FIREWIRE_CONSTANTS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/flat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/flat.h new file mode 100644 index 0000000..8351bc7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/flat.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2002-2003 David McCullough + * Copyright (C) 1998 Kenneth Albanowski + * The Silver Hammer Group, Ltd. + * + * This file provides the definitions and structures needed to + * support uClinux flat-format executables. + */ + +#ifndef _LINUX_FLAT_H +#define _LINUX_FLAT_H + + +#define FLAT_VERSION 0x00000004L + +#ifdef CONFIG_BINFMT_SHARED_FLAT +#define MAX_SHARED_LIBS (4) +#else +#define MAX_SHARED_LIBS (1) +#endif + +/* + * To make everything easier to port and manage cross platform + * development, all fields are in network byte order. + */ + +struct flat_hdr { + char magic[4]; + unsigned long rev; /* version (as above) */ + unsigned long entry; /* Offset of first executable instruction + with text segment from beginning of file */ + unsigned long data_start; /* Offset of data segment from beginning of + file */ + unsigned long data_end; /* Offset of end of data segment + from beginning of file */ + unsigned long bss_end; /* Offset of end of bss segment from beginning + of file */ + + /* (It is assumed that data_end through bss_end forms the bss segment.) */ + + unsigned long stack_size; /* Size of stack, in bytes */ + unsigned long reloc_start; /* Offset of relocation records from + beginning of file */ + unsigned long reloc_count; /* Number of relocation records */ + unsigned long flags; + unsigned long build_date; /* When the program/library was built */ + unsigned long filler[5]; /* Reservered, set to zero */ +}; + +#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ +#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ +#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ +#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ +#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ + + + +#endif /* _LINUX_FLAT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fs.h new file mode 100644 index 0000000..6461a29 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fs.h @@ -0,0 +1,356 @@ +#ifndef _LINUX_FS_H +#define _LINUX_FS_H + +/* + * This file has definitions for some important file table + * structures etc. + */ + +#include +#include + +/* + * It's silly to have NR_OPEN bigger than NR_FILE, but you can change + * the file limit at runtime and only root can increase the per-process + * nr_file rlimit, so it's safe to set up a ridiculously high absolute + * upper limit on files-per-process. + * + * Some programs (notably those using select()) may have to be + * recompiled to take full advantage of the new limits.. + */ + +/* Fixed constants first: */ +#undef NR_OPEN +#define INR_OPEN 1024 /* Initial setting for nfile rlimits */ + +#define BLOCK_SIZE_BITS 10 +#define BLOCK_SIZE (1<i_sb->s_flags & (flg)) + +#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) +#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ + ((inode)->i_flags & S_SYNC)) +#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ + ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) +#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) +#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) +#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION) + +#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) +#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) +#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) +#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) + +#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) +#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) +#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) +#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) + +/* the read-only stuff doesn't really belong here, but any other place is + probably as bad and I don't want to create yet another include file. */ + +#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ +#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ +#define BLKRRPART _IO(0x12,95) /* re-read partition table */ +#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ +#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ +#define BLKRASET _IO(0x12,98) /* set read ahead for block device */ +#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ +#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ +#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ +#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ +#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ +#define BLKSSZGET _IO(0x12,104)/* get block device sector size */ +#if 0 +#define BLKPG _IO(0x12,105)/* See blkpg.h */ + +/* Some people are morons. Do not use sizeof! */ + +#define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */ +#define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */ +/* This was here just to show that the number is taken - + probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */ +#endif +/* A jump here: 108-111 have been used for various private purposes. */ +#define BLKBSZGET _IOR(0x12,112,size_t) +#define BLKBSZSET _IOW(0x12,113,size_t) +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ +#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) +#define BLKTRACESTART _IO(0x12,116) +#define BLKTRACESTOP _IO(0x12,117) +#define BLKTRACETEARDOWN _IO(0x12,118) +#define BLKDISCARD _IO(0x12,119) + +#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ +#define FIBMAP _IO(0x00,1) /* bmap access */ +#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ +#define FIFREEZE _IOWR('X', 119, int) /* Freeze */ +#define FITHAW _IOWR('X', 120, int) /* Thaw */ + +#define FS_IOC_GETFLAGS _IOR('f', 1, long) +#define FS_IOC_SETFLAGS _IOW('f', 2, long) +#define FS_IOC_GETVERSION _IOR('v', 1, long) +#define FS_IOC_SETVERSION _IOW('v', 2, long) +#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) +#define FS_IOC32_GETFLAGS _IOR('f', 1, int) +#define FS_IOC32_SETFLAGS _IOW('f', 2, int) +#define FS_IOC32_GETVERSION _IOR('v', 1, int) +#define FS_IOC32_SETVERSION _IOW('v', 2, int) + +/* + * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) + */ +#define FS_SECRM_FL 0x00000001 /* Secure deletion */ +#define FS_UNRM_FL 0x00000002 /* Undelete */ +#define FS_COMPR_FL 0x00000004 /* Compress file */ +#define FS_SYNC_FL 0x00000008 /* Synchronous updates */ +#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ +#define FS_APPEND_FL 0x00000020 /* writes to file may only append */ +#define FS_NODUMP_FL 0x00000040 /* do not dump file */ +#define FS_NOATIME_FL 0x00000080 /* do not update atime */ +/* Reserved for compression usage... */ +#define FS_DIRTY_FL 0x00000100 +#define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ +#define FS_NOCOMP_FL 0x00000400 /* Don't compress */ +#define FS_ECOMPR_FL 0x00000800 /* Compression error */ +/* End compression flags --- maybe not all used */ +#define FS_BTREE_FL 0x00001000 /* btree format dir */ +#define FS_INDEX_FL 0x00001000 /* hash-indexed directory */ +#define FS_IMAGIC_FL 0x00002000 /* AFS directory */ +#define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */ +#define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */ +#define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ +#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ +#define FS_EXTENT_FL 0x00080000 /* Extents */ +#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ +#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ + +#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ +#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ + + +#define SYNC_FILE_RANGE_WAIT_BEFORE 1 +#define SYNC_FILE_RANGE_WRITE 2 +#define SYNC_FILE_RANGE_WAIT_AFTER 4 + +#endif /* _LINUX_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fuse.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fuse.h new file mode 100644 index 0000000..162e5de --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/fuse.h @@ -0,0 +1,480 @@ +/* + FUSE: Filesystem in Userspace + Copyright (C) 2001-2008 Miklos Szeredi + + This program can be distributed under the terms of the GNU GPL. + See the file COPYING. +*/ + +/* + * This file defines the kernel interface of FUSE + * + * Protocol changelog: + * + * 7.9: + * - new fuse_getattr_in input argument of GETATTR + * - add lk_flags in fuse_lk_in + * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in + * - add blksize field to fuse_attr + * - add file flags field to fuse_read_in and fuse_write_in + * + * 7.10 + * - add nonseekable open flag + * + * 7.11 + * - add IOCTL message + * - add unsolicited notification support + * - add POLL message and NOTIFY_POLL notification + */ + +#ifndef _LINUX_FUSE_H +#define _LINUX_FUSE_H + +#include + +/** Version number of this interface */ +#define FUSE_KERNEL_VERSION 7 + +/** Minor version number of this interface */ +#define FUSE_KERNEL_MINOR_VERSION 11 + +/** The node ID of the root inode */ +#define FUSE_ROOT_ID 1 + +/* Make sure all structures are padded to 64bit boundary, so 32bit + userspace works under 64bit kernels */ + +struct fuse_attr { + __u64 ino; + __u64 size; + __u64 blocks; + __u64 atime; + __u64 mtime; + __u64 ctime; + __u32 atimensec; + __u32 mtimensec; + __u32 ctimensec; + __u32 mode; + __u32 nlink; + __u32 uid; + __u32 gid; + __u32 rdev; + __u32 blksize; + __u32 padding; +}; + +struct fuse_kstatfs { + __u64 blocks; + __u64 bfree; + __u64 bavail; + __u64 files; + __u64 ffree; + __u32 bsize; + __u32 namelen; + __u32 frsize; + __u32 padding; + __u32 spare[6]; +}; + +struct fuse_file_lock { + __u64 start; + __u64 end; + __u32 type; + __u32 pid; /* tgid */ +}; + +/** + * Bitmasks for fuse_setattr_in.valid + */ +#define FATTR_MODE (1 << 0) +#define FATTR_UID (1 << 1) +#define FATTR_GID (1 << 2) +#define FATTR_SIZE (1 << 3) +#define FATTR_ATIME (1 << 4) +#define FATTR_MTIME (1 << 5) +#define FATTR_FH (1 << 6) +#define FATTR_ATIME_NOW (1 << 7) +#define FATTR_MTIME_NOW (1 << 8) +#define FATTR_LOCKOWNER (1 << 9) + +/** + * Flags returned by the OPEN request + * + * FOPEN_DIRECT_IO: bypass page cache for this open file + * FOPEN_KEEP_CACHE: don't invalidate the data cache on open + * FOPEN_NONSEEKABLE: the file is not seekable + */ +#define FOPEN_DIRECT_IO (1 << 0) +#define FOPEN_KEEP_CACHE (1 << 1) +#define FOPEN_NONSEEKABLE (1 << 2) + +/** + * INIT request/reply flags + * + * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." + */ +#define FUSE_ASYNC_READ (1 << 0) +#define FUSE_POSIX_LOCKS (1 << 1) +#define FUSE_FILE_OPS (1 << 2) +#define FUSE_ATOMIC_O_TRUNC (1 << 3) +#define FUSE_EXPORT_SUPPORT (1 << 4) +#define FUSE_BIG_WRITES (1 << 5) + +/** + * Release flags + */ +#define FUSE_RELEASE_FLUSH (1 << 0) + +/** + * Getattr flags + */ +#define FUSE_GETATTR_FH (1 << 0) + +/** + * Lock flags + */ +#define FUSE_LK_FLOCK (1 << 0) + +/** + * WRITE flags + * + * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed + * FUSE_WRITE_LOCKOWNER: lock_owner field is valid + */ +#define FUSE_WRITE_CACHE (1 << 0) +#define FUSE_WRITE_LOCKOWNER (1 << 1) + +/** + * Read flags + */ +#define FUSE_READ_LOCKOWNER (1 << 1) + +/** + * Ioctl flags + * + * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine + * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed + * FUSE_IOCTL_RETRY: retry with new iovecs + * + * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs + */ +#define FUSE_IOCTL_COMPAT (1 << 0) +#define FUSE_IOCTL_UNRESTRICTED (1 << 1) +#define FUSE_IOCTL_RETRY (1 << 2) + +#define FUSE_IOCTL_MAX_IOV 256 + +/** + * Poll flags + * + * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify + */ +#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) + +enum fuse_opcode { + FUSE_LOOKUP = 1, + FUSE_FORGET = 2, /* no reply */ + FUSE_GETATTR = 3, + FUSE_SETATTR = 4, + FUSE_READLINK = 5, + FUSE_SYMLINK = 6, + FUSE_MKNOD = 8, + FUSE_MKDIR = 9, + FUSE_UNLINK = 10, + FUSE_RMDIR = 11, + FUSE_RENAME = 12, + FUSE_LINK = 13, + FUSE_OPEN = 14, + FUSE_READ = 15, + FUSE_WRITE = 16, + FUSE_STATFS = 17, + FUSE_RELEASE = 18, + FUSE_FSYNC = 20, + FUSE_SETXATTR = 21, + FUSE_GETXATTR = 22, + FUSE_LISTXATTR = 23, + FUSE_REMOVEXATTR = 24, + FUSE_FLUSH = 25, + FUSE_INIT = 26, + FUSE_OPENDIR = 27, + FUSE_READDIR = 28, + FUSE_RELEASEDIR = 29, + FUSE_FSYNCDIR = 30, + FUSE_GETLK = 31, + FUSE_SETLK = 32, + FUSE_SETLKW = 33, + FUSE_ACCESS = 34, + FUSE_CREATE = 35, + FUSE_INTERRUPT = 36, + FUSE_BMAP = 37, + FUSE_DESTROY = 38, + FUSE_IOCTL = 39, + FUSE_POLL = 40, +}; + +enum fuse_notify_code { + FUSE_NOTIFY_POLL = 1, + FUSE_NOTIFY_CODE_MAX, +}; + +/* The read buffer is required to be at least 8k, but may be much larger */ +#define FUSE_MIN_READ_BUFFER 8192 + +#define FUSE_COMPAT_ENTRY_OUT_SIZE 120 + +struct fuse_entry_out { + __u64 nodeid; /* Inode ID */ + __u64 generation; /* Inode generation: nodeid:gen must + be unique for the fs's lifetime */ + __u64 entry_valid; /* Cache timeout for the name */ + __u64 attr_valid; /* Cache timeout for the attributes */ + __u32 entry_valid_nsec; + __u32 attr_valid_nsec; + struct fuse_attr attr; +}; + +struct fuse_forget_in { + __u64 nlookup; +}; + +struct fuse_getattr_in { + __u32 getattr_flags; + __u32 dummy; + __u64 fh; +}; + +#define FUSE_COMPAT_ATTR_OUT_SIZE 96 + +struct fuse_attr_out { + __u64 attr_valid; /* Cache timeout for the attributes */ + __u32 attr_valid_nsec; + __u32 dummy; + struct fuse_attr attr; +}; + +struct fuse_mknod_in { + __u32 mode; + __u32 rdev; +}; + +struct fuse_mkdir_in { + __u32 mode; + __u32 padding; +}; + +struct fuse_rename_in { + __u64 newdir; +}; + +struct fuse_link_in { + __u64 oldnodeid; +}; + +struct fuse_setattr_in { + __u32 valid; + __u32 padding; + __u64 fh; + __u64 size; + __u64 lock_owner; + __u64 atime; + __u64 mtime; + __u64 unused2; + __u32 atimensec; + __u32 mtimensec; + __u32 unused3; + __u32 mode; + __u32 unused4; + __u32 uid; + __u32 gid; + __u32 unused5; +}; + +struct fuse_open_in { + __u32 flags; + __u32 mode; +}; + +struct fuse_open_out { + __u64 fh; + __u32 open_flags; + __u32 padding; +}; + +struct fuse_release_in { + __u64 fh; + __u32 flags; + __u32 release_flags; + __u64 lock_owner; +}; + +struct fuse_flush_in { + __u64 fh; + __u32 unused; + __u32 padding; + __u64 lock_owner; +}; + +struct fuse_read_in { + __u64 fh; + __u64 offset; + __u32 size; + __u32 read_flags; + __u64 lock_owner; + __u32 flags; + __u32 padding; +}; + +#define FUSE_COMPAT_WRITE_IN_SIZE 24 + +struct fuse_write_in { + __u64 fh; + __u64 offset; + __u32 size; + __u32 write_flags; + __u64 lock_owner; + __u32 flags; + __u32 padding; +}; + +struct fuse_write_out { + __u32 size; + __u32 padding; +}; + +#define FUSE_COMPAT_STATFS_SIZE 48 + +struct fuse_statfs_out { + struct fuse_kstatfs st; +}; + +struct fuse_fsync_in { + __u64 fh; + __u32 fsync_flags; + __u32 padding; +}; + +struct fuse_setxattr_in { + __u32 size; + __u32 flags; +}; + +struct fuse_getxattr_in { + __u32 size; + __u32 padding; +}; + +struct fuse_getxattr_out { + __u32 size; + __u32 padding; +}; + +struct fuse_lk_in { + __u64 fh; + __u64 owner; + struct fuse_file_lock lk; + __u32 lk_flags; + __u32 padding; +}; + +struct fuse_lk_out { + struct fuse_file_lock lk; +}; + +struct fuse_access_in { + __u32 mask; + __u32 padding; +}; + +struct fuse_init_in { + __u32 major; + __u32 minor; + __u32 max_readahead; + __u32 flags; +}; + +struct fuse_init_out { + __u32 major; + __u32 minor; + __u32 max_readahead; + __u32 flags; + __u32 unused; + __u32 max_write; +}; + +struct fuse_interrupt_in { + __u64 unique; +}; + +struct fuse_bmap_in { + __u64 block; + __u32 blocksize; + __u32 padding; +}; + +struct fuse_bmap_out { + __u64 block; +}; + +struct fuse_ioctl_in { + __u64 fh; + __u32 flags; + __u32 cmd; + __u64 arg; + __u32 in_size; + __u32 out_size; +}; + +struct fuse_ioctl_out { + __s32 result; + __u32 flags; + __u32 in_iovs; + __u32 out_iovs; +}; + +struct fuse_poll_in { + __u64 fh; + __u64 kh; + __u32 flags; + __u32 padding; +}; + +struct fuse_poll_out { + __u32 revents; + __u32 padding; +}; + +struct fuse_notify_poll_wakeup_out { + __u64 kh; +}; + +struct fuse_in_header { + __u32 len; + __u32 opcode; + __u64 unique; + __u64 nodeid; + __u32 uid; + __u32 gid; + __u32 pid; + __u32 padding; +}; + +struct fuse_out_header { + __u32 len; + __s32 error; + __u64 unique; +}; + +struct fuse_dirent { + __u64 ino; + __u64 off; + __u32 namelen; + __u32 type; + char name[0]; +}; + +#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) +#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) +#define FUSE_DIRENT_SIZE(d) \ + FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) + +#endif /* _LINUX_FUSE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/futex.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/futex.h new file mode 100644 index 0000000..b559b66 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/futex.h @@ -0,0 +1,151 @@ +#ifndef _LINUX_FUTEX_H +#define _LINUX_FUTEX_H + + +#include + +struct inode; +struct mm_struct; +struct task_struct; +union ktime; + +/* Second argument to futex syscall */ + + +#define FUTEX_WAIT 0 +#define FUTEX_WAKE 1 +#define FUTEX_FD 2 +#define FUTEX_REQUEUE 3 +#define FUTEX_CMP_REQUEUE 4 +#define FUTEX_WAKE_OP 5 +#define FUTEX_LOCK_PI 6 +#define FUTEX_UNLOCK_PI 7 +#define FUTEX_TRYLOCK_PI 8 +#define FUTEX_WAIT_BITSET 9 +#define FUTEX_WAKE_BITSET 10 + +#define FUTEX_PRIVATE_FLAG 128 +#define FUTEX_CLOCK_REALTIME 256 +#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) + +#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG) +#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG) +#define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG) +#define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG) +#define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG) +#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) +#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) +#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) +#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITS | FUTEX_PRIVATE_FLAG) +#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITS | FUTEX_PRIVATE_FLAG) + +/* + * Support for robust futexes: the kernel cleans up held futexes at + * thread exit time. + */ + +/* + * Per-lock list entry - embedded in user-space locks, somewhere close + * to the futex field. (Note: user-space uses a double-linked list to + * achieve O(1) list add and remove, but the kernel only needs to know + * about the forward link) + * + * NOTE: this structure is part of the syscall ABI, and must not be + * changed. + */ +struct robust_list { + struct robust_list *next; +}; + +/* + * Per-thread list head: + * + * NOTE: this structure is part of the syscall ABI, and must only be + * changed if the change is first communicated with the glibc folks. + * (When an incompatible change is done, we'll increase the structure + * size, which glibc will detect) + */ +struct robust_list_head { + /* + * The head of the list. Points back to itself if empty: + */ + struct robust_list list; + + /* + * This relative offset is set by user-space, it gives the kernel + * the relative position of the futex field to examine. This way + * we keep userspace flexible, to freely shape its data-structure, + * without hardcoding any particular offset into the kernel: + */ + long futex_offset; + + /* + * The death of the thread may race with userspace setting + * up a lock's links. So to handle this race, userspace first + * sets this field to the address of the to-be-taken lock, + * then does the lock acquire, and then adds itself to the + * list, and then clears this field. Hence the kernel will + * always have full knowledge of all locks that the thread + * _might_ have taken. We check the owner TID in any case, + * so only truly owned locks will be handled. + */ + struct robust_list *list_op_pending; +}; + +/* + * Are there any waiters for this robust futex: + */ +#define FUTEX_WAITERS 0x80000000 + +/* + * The kernel signals via this bit that a thread holding a futex + * has exited without unlocking the futex. The kernel also does + * a FUTEX_WAKE on such futexes, after setting the bit, to wake + * up any possible waiters: + */ +#define FUTEX_OWNER_DIED 0x40000000 + +/* + * The rest of the robust-futex field is for the TID: + */ +#define FUTEX_TID_MASK 0x3fffffff + +/* + * This limit protects against a deliberately circular list. + * (Not worth introducing an rlimit for it) + */ +#define ROBUST_LIST_LIMIT 2048 + +/* + * bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a + * match of any bit. + */ +#define FUTEX_BITSET_MATCH_ANY 0xffffffff + + +#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ +#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */ +#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */ +#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */ +#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */ + +#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */ + +#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */ +#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */ +#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */ +#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */ +#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */ +#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */ + +/* FUTEX_WAKE_OP will perform atomically + int oldval = *(int *)UADDR2; + *(int *)UADDR2 = oldval OP OPARG; + if (oldval CMP CMPARG) + wake UADDR2; */ + +#define FUTEX_OP(op, oparg, cmp, cmparg) \ + (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \ + | ((oparg & 0xfff) << 12) | (cmparg & 0xfff)) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gameport.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gameport.h new file mode 100644 index 0000000..1c33c4a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gameport.h @@ -0,0 +1,28 @@ +#ifndef _GAMEPORT_H +#define _GAMEPORT_H + +/* + * Copyright (c) 1999-2002 Vojtech Pavlik + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + + +#define GAMEPORT_MODE_DISABLED 0 +#define GAMEPORT_MODE_RAW 1 +#define GAMEPORT_MODE_COOKED 2 + +#define GAMEPORT_ID_VENDOR_ANALOG 0x0001 +#define GAMEPORT_ID_VENDOR_MADCATZ 0x0002 +#define GAMEPORT_ID_VENDOR_LOGITECH 0x0003 +#define GAMEPORT_ID_VENDOR_CREATIVE 0x0004 +#define GAMEPORT_ID_VENDOR_GENIUS 0x0005 +#define GAMEPORT_ID_VENDOR_INTERACT 0x0006 +#define GAMEPORT_ID_VENDOR_MICROSOFT 0x0007 +#define GAMEPORT_ID_VENDOR_THRUSTMASTER 0x0008 +#define GAMEPORT_ID_VENDOR_GRAVIS 0x0009 +#define GAMEPORT_ID_VENDOR_GUILLEMOT 0x000a + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gen_stats.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gen_stats.h new file mode 100644 index 0000000..0ffa41d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gen_stats.h @@ -0,0 +1,67 @@ +#ifndef __LINUX_GEN_STATS_H +#define __LINUX_GEN_STATS_H + +#include + +enum { + TCA_STATS_UNSPEC, + TCA_STATS_BASIC, + TCA_STATS_RATE_EST, + TCA_STATS_QUEUE, + TCA_STATS_APP, + __TCA_STATS_MAX, +}; +#define TCA_STATS_MAX (__TCA_STATS_MAX - 1) + +/** + * struct gnet_stats_basic - byte/packet throughput statistics + * @bytes: number of seen bytes + * @packets: number of seen packets + */ +struct gnet_stats_basic +{ + __u64 bytes; + __u32 packets; +} __attribute__ ((packed)); + +/** + * struct gnet_stats_rate_est - rate estimator + * @bps: current byte rate + * @pps: current packet rate + */ +struct gnet_stats_rate_est +{ + __u32 bps; + __u32 pps; +}; + +/** + * struct gnet_stats_queue - queuing statistics + * @qlen: queue length + * @backlog: backlog size of queue + * @drops: number of dropped packets + * @requeues: number of requeues + * @overlimits: number of enqueues over the limit + */ +struct gnet_stats_queue +{ + __u32 qlen; + __u32 backlog; + __u32 drops; + __u32 requeues; + __u32 overlimits; +}; + +/** + * struct gnet_estimator - rate estimator configuration + * @interval: sampling period + * @ewma_log: the log of measurement window weight + */ +struct gnet_estimator +{ + signed char interval; + unsigned char ewma_log; +}; + + +#endif /* __LINUX_GEN_STATS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/generic_serial.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/generic_serial.h new file mode 100644 index 0000000..9f596b4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/generic_serial.h @@ -0,0 +1,36 @@ +/* + * generic_serial.h + * + * Copyright (C) 1998 R.E.Wolff@BitWizard.nl + * + * written for the SX serial driver. + * Contains the code that should be shared over all the serial drivers. + * + * Version 0.1 -- December, 1998. + */ + +#ifndef GENERIC_SERIAL_H +#define GENERIC_SERIAL_H + + +/* Flags */ +/* Warning: serial.h defines some ASYNC_ flags, they say they are "only" + used in serial.c, but they are also used in all other serial drivers. + Make sure they don't clash with these here... */ +#define GS_TX_INTEN 0x00800000 +#define GS_RX_INTEN 0x00400000 +#define GS_ACTIVE 0x00200000 + + + +#define GS_TYPE_NORMAL 1 + +#define GS_DEBUG_FLUSH 0x00000001 +#define GS_DEBUG_BTR 0x00000002 +#define GS_DEBUG_TERMIOS 0x00000004 +#define GS_DEBUG_STUFF 0x00000008 +#define GS_DEBUG_CLOSE 0x00000010 +#define GS_DEBUG_FLOW 0x00000020 +#define GS_DEBUG_WRITE 0x00000040 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/genetlink.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/genetlink.h new file mode 100644 index 0000000..b834ef6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/genetlink.h @@ -0,0 +1,83 @@ +#ifndef __LINUX_GENERIC_NETLINK_H +#define __LINUX_GENERIC_NETLINK_H + +#include +#include + +#define GENL_NAMSIZ 16 /* length of family name */ + +#define GENL_MIN_ID NLMSG_MIN_TYPE +#define GENL_MAX_ID 1023 + +struct genlmsghdr { + __u8 cmd; + __u8 version; + __u16 reserved; +}; + +#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) + +#define GENL_ADMIN_PERM 0x01 +#define GENL_CMD_CAP_DO 0x02 +#define GENL_CMD_CAP_DUMP 0x04 +#define GENL_CMD_CAP_HASPOL 0x08 + +/* + * List of reserved static generic netlink identifiers: + */ +#define GENL_ID_GENERATE 0 +#define GENL_ID_CTRL NLMSG_MIN_TYPE + +/************************************************************************** + * Controller + **************************************************************************/ + +enum { + CTRL_CMD_UNSPEC, + CTRL_CMD_NEWFAMILY, + CTRL_CMD_DELFAMILY, + CTRL_CMD_GETFAMILY, + CTRL_CMD_NEWOPS, + CTRL_CMD_DELOPS, + CTRL_CMD_GETOPS, + CTRL_CMD_NEWMCAST_GRP, + CTRL_CMD_DELMCAST_GRP, + CTRL_CMD_GETMCAST_GRP, /* unused */ + __CTRL_CMD_MAX, +}; + +#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) + +enum { + CTRL_ATTR_UNSPEC, + CTRL_ATTR_FAMILY_ID, + CTRL_ATTR_FAMILY_NAME, + CTRL_ATTR_VERSION, + CTRL_ATTR_HDRSIZE, + CTRL_ATTR_MAXATTR, + CTRL_ATTR_OPS, + CTRL_ATTR_MCAST_GROUPS, + __CTRL_ATTR_MAX, +}; + +#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) + +enum { + CTRL_ATTR_OP_UNSPEC, + CTRL_ATTR_OP_ID, + CTRL_ATTR_OP_FLAGS, + __CTRL_ATTR_OP_MAX, +}; + +#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) + +enum { + CTRL_ATTR_MCAST_GRP_UNSPEC, + CTRL_ATTR_MCAST_GRP_NAME, + CTRL_ATTR_MCAST_GRP_ID, + __CTRL_ATTR_MCAST_GRP_MAX, +}; + +#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) + +#endif /* __LINUX_GENERIC_NETLINK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gfs2_ondisk.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gfs2_ondisk.h new file mode 100644 index 0000000..c56b4bc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gfs2_ondisk.h @@ -0,0 +1,451 @@ +/* + * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. + * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + */ + +#ifndef __GFS2_ONDISK_DOT_H__ +#define __GFS2_ONDISK_DOT_H__ + +#include + +#define GFS2_MAGIC 0x01161970 +#define GFS2_BASIC_BLOCK 512 +#define GFS2_BASIC_BLOCK_SHIFT 9 + +/* Lock numbers of the LM_TYPE_NONDISK type */ + +#define GFS2_MOUNT_LOCK 0 +#define GFS2_LIVE_LOCK 1 +#define GFS2_TRANS_LOCK 2 +#define GFS2_RENAME_LOCK 3 + +/* Format numbers for various metadata types */ + +#define GFS2_FORMAT_NONE 0 +#define GFS2_FORMAT_SB 100 +#define GFS2_FORMAT_RG 200 +#define GFS2_FORMAT_RB 300 +#define GFS2_FORMAT_DI 400 +#define GFS2_FORMAT_IN 500 +#define GFS2_FORMAT_LF 600 +#define GFS2_FORMAT_JD 700 +#define GFS2_FORMAT_LH 800 +#define GFS2_FORMAT_LD 900 +#define GFS2_FORMAT_LB 1000 +#define GFS2_FORMAT_EA 1600 +#define GFS2_FORMAT_ED 1700 +#define GFS2_FORMAT_QC 1400 +/* These are format numbers for entities contained in files */ +#define GFS2_FORMAT_RI 1100 +#define GFS2_FORMAT_DE 1200 +#define GFS2_FORMAT_QU 1500 +/* These are part of the superblock */ +#define GFS2_FORMAT_FS 1801 +#define GFS2_FORMAT_MULTI 1900 + +/* + * An on-disk inode number + */ + +struct gfs2_inum { + __be64 no_formal_ino; + __be64 no_addr; +}; + +/* + * Generic metadata head structure + * Every inplace buffer logged in the journal must start with this. + */ + +#define GFS2_METATYPE_NONE 0 +#define GFS2_METATYPE_SB 1 +#define GFS2_METATYPE_RG 2 +#define GFS2_METATYPE_RB 3 +#define GFS2_METATYPE_DI 4 +#define GFS2_METATYPE_IN 5 +#define GFS2_METATYPE_LF 6 +#define GFS2_METATYPE_JD 7 +#define GFS2_METATYPE_LH 8 +#define GFS2_METATYPE_LD 9 +#define GFS2_METATYPE_LB 12 +#define GFS2_METATYPE_EA 10 +#define GFS2_METATYPE_ED 11 +#define GFS2_METATYPE_QC 14 + +struct gfs2_meta_header { + __be32 mh_magic; + __be32 mh_type; + __be64 __pad0; /* Was generation number in gfs1 */ + __be32 mh_format; + __be32 __pad1; /* Was incarnation number in gfs1 */ +}; + +/* + * super-block structure + * + * It's probably good if SIZEOF_SB <= GFS2_BASIC_BLOCK (512 bytes) + * + * Order is important, need to be able to read old superblocks to do on-disk + * version upgrades. + */ + +/* Address of superblock in GFS2 basic blocks */ +#define GFS2_SB_ADDR 128 + +/* The lock number for the superblock (must be zero) */ +#define GFS2_SB_LOCK 0 + +/* Requirement: GFS2_LOCKNAME_LEN % 8 == 0 + Includes: the fencing zero at the end */ +#define GFS2_LOCKNAME_LEN 64 + +struct gfs2_sb { + struct gfs2_meta_header sb_header; + + __be32 sb_fs_format; + __be32 sb_multihost_format; + __u32 __pad0; /* Was superblock flags in gfs1 */ + + __be32 sb_bsize; + __be32 sb_bsize_shift; + __u32 __pad1; /* Was journal segment size in gfs1 */ + + struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ + struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ + struct gfs2_inum sb_root_dir; + + char sb_lockproto[GFS2_LOCKNAME_LEN]; + char sb_locktable[GFS2_LOCKNAME_LEN]; + + struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ + struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ +#define GFS2_HAS_UUID 1 + __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */ +}; + +/* + * resource index structure + */ + +struct gfs2_rindex { + __be64 ri_addr; /* grp block disk address */ + __be32 ri_length; /* length of rgrp header in fs blocks */ + __u32 __pad; + + __be64 ri_data0; /* first data location */ + __be32 ri_data; /* num of data blocks in rgrp */ + + __be32 ri_bitbytes; /* number of bytes in data bitmaps */ + + __u8 ri_reserved[64]; +}; + +/* + * resource group header structure + */ + +/* Number of blocks per byte in rgrp */ +#define GFS2_NBBY 4 +#define GFS2_BIT_SIZE 2 +#define GFS2_BIT_MASK 0x00000003 + +#define GFS2_BLKST_FREE 0 +#define GFS2_BLKST_USED 1 +#define GFS2_BLKST_UNLINKED 2 +#define GFS2_BLKST_DINODE 3 + +#define GFS2_RGF_JOURNAL 0x00000001 +#define GFS2_RGF_METAONLY 0x00000002 +#define GFS2_RGF_DATAONLY 0x00000004 +#define GFS2_RGF_NOALLOC 0x00000008 + +struct gfs2_rgrp { + struct gfs2_meta_header rg_header; + + __be32 rg_flags; + __be32 rg_free; + __be32 rg_dinodes; + __be32 __pad; + __be64 rg_igeneration; + + __u8 rg_reserved[80]; /* Several fields from gfs1 now reserved */ +}; + +/* + * quota linked list: user quotas and group quotas form two separate + * singly linked lists. ll_next stores uids or gids of next quotas in the + * linked list. + +Given the uid/gid, how to calculate the quota file offsets for the corresponding +gfs2_quota structures on disk: + +for user quotas, given uid, +offset = uid * sizeof(struct gfs2_quota); + +for group quotas, given gid, +offset = (gid * sizeof(struct gfs2_quota)) + sizeof(struct gfs2_quota); + + + uid:0 gid:0 uid:12 gid:12 uid:17 gid:17 uid:5142 gid:5142 ++-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+ +| valid | valid | :: | valid | valid | :: | valid | inval | :: | inval | valid | ++-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+ +next:12 next:12 next:17 next:5142 next:NULL next:NULL + | | | | |<-- user quota list | + \______|___________/ \______|___________/ group quota list -->| + | | | + \__________________/ \_______________________________________/ + +*/ + +/* + * quota structure + */ + +struct gfs2_quota { + __be64 qu_limit; + __be64 qu_warn; + __be64 qu_value; + __be32 qu_ll_next; /* location of next quota in list */ + __u8 qu_reserved[60]; +}; + +/* + * dinode structure + */ + +#define GFS2_MAX_META_HEIGHT 10 +#define GFS2_DIR_MAX_DEPTH 17 + +#define DT2IF(dt) (((dt) << 12) & S_IFMT) +#define IF2DT(sif) (((sif) & S_IFMT) >> 12) + +enum { + gfs2fl_Jdata = 0, + gfs2fl_ExHash = 1, + gfs2fl_Unused = 2, + gfs2fl_EaIndirect = 3, + gfs2fl_Directio = 4, + gfs2fl_Immutable = 5, + gfs2fl_AppendOnly = 6, + gfs2fl_NoAtime = 7, + gfs2fl_Sync = 8, + gfs2fl_System = 9, + gfs2fl_TruncInProg = 29, + gfs2fl_InheritDirectio = 30, + gfs2fl_InheritJdata = 31, +}; + +/* Dinode flags */ +#define GFS2_DIF_JDATA 0x00000001 +#define GFS2_DIF_EXHASH 0x00000002 +#define GFS2_DIF_UNUSED 0x00000004 /* only in gfs1 */ +#define GFS2_DIF_EA_INDIRECT 0x00000008 +#define GFS2_DIF_DIRECTIO 0x00000010 +#define GFS2_DIF_IMMUTABLE 0x00000020 +#define GFS2_DIF_APPENDONLY 0x00000040 +#define GFS2_DIF_NOATIME 0x00000080 +#define GFS2_DIF_SYNC 0x00000100 +#define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */ +#define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */ +#define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 +#define GFS2_DIF_INHERIT_JDATA 0x80000000 + +struct gfs2_dinode { + struct gfs2_meta_header di_header; + + struct gfs2_inum di_num; + + __be32 di_mode; /* mode of file */ + __be32 di_uid; /* owner's user id */ + __be32 di_gid; /* owner's group id */ + __be32 di_nlink; /* number of links to this file */ + __be64 di_size; /* number of bytes in file */ + __be64 di_blocks; /* number of blocks in file */ + __be64 di_atime; /* time last accessed */ + __be64 di_mtime; /* time last modified */ + __be64 di_ctime; /* time last changed */ + __be32 di_major; /* device major number */ + __be32 di_minor; /* device minor number */ + + /* This section varies from gfs1. Padding added to align with + * remainder of dinode + */ + __be64 di_goal_meta; /* rgrp to alloc from next */ + __be64 di_goal_data; /* data block goal */ + __be64 di_generation; /* generation number for NFS */ + + __be32 di_flags; /* GFS2_DIF_... */ + __be32 di_payload_format; /* GFS2_FORMAT_... */ + __u16 __pad1; /* Was ditype in gfs1 */ + __be16 di_height; /* height of metadata */ + __u32 __pad2; /* Unused incarnation number from gfs1 */ + + /* These only apply to directories */ + __u16 __pad3; /* Padding */ + __be16 di_depth; /* Number of bits in the table */ + __be32 di_entries; /* The number of entries in the directory */ + + struct gfs2_inum __pad4; /* Unused even in current gfs1 */ + + __be64 di_eattr; /* extended attribute block number */ + __be32 di_atime_nsec; /* nsec portion of atime */ + __be32 di_mtime_nsec; /* nsec portion of mtime */ + __be32 di_ctime_nsec; /* nsec portion of ctime */ + + __u8 di_reserved[44]; +}; + +/* + * directory structure - many of these per directory file + */ + +#define GFS2_FNAMESIZE 255 +#define GFS2_DIRENT_SIZE(name_len) ((sizeof(struct gfs2_dirent) + (name_len) + 7) & ~7) + +struct gfs2_dirent { + struct gfs2_inum de_inum; + __be32 de_hash; + __be16 de_rec_len; + __be16 de_name_len; + __be16 de_type; + __u8 __pad[14]; +}; + +/* + * Header of leaf directory nodes + */ + +struct gfs2_leaf { + struct gfs2_meta_header lf_header; + + __be16 lf_depth; /* Depth of leaf */ + __be16 lf_entries; /* Number of dirents in leaf */ + __be32 lf_dirent_format; /* Format of the dirents */ + __be64 lf_next; /* Next leaf, if overflow */ + + __u8 lf_reserved[64]; +}; + +/* + * Extended attribute header format + */ + +#define GFS2_EA_MAX_NAME_LEN 255 +#define GFS2_EA_MAX_DATA_LEN 65536 + +#define GFS2_EATYPE_UNUSED 0 +#define GFS2_EATYPE_USR 1 +#define GFS2_EATYPE_SYS 2 +#define GFS2_EATYPE_SECURITY 3 + +#define GFS2_EATYPE_LAST 3 +#define GFS2_EATYPE_VALID(x) ((x) <= GFS2_EATYPE_LAST) + +#define GFS2_EAFLAG_LAST 0x01 /* last ea in block */ + +struct gfs2_ea_header { + __be32 ea_rec_len; + __be32 ea_data_len; + __u8 ea_name_len; /* no NULL pointer after the string */ + __u8 ea_type; /* GFS2_EATYPE_... */ + __u8 ea_flags; /* GFS2_EAFLAG_... */ + __u8 ea_num_ptrs; + __u32 __pad; +}; + +/* + * Log header structure + */ + +#define GFS2_LOG_HEAD_UNMOUNT 0x00000001 /* log is clean */ + +struct gfs2_log_header { + struct gfs2_meta_header lh_header; + + __be64 lh_sequence; /* Sequence number of this transaction */ + __be32 lh_flags; /* GFS2_LOG_HEAD_... */ + __be32 lh_tail; /* Block number of log tail */ + __be32 lh_blkno; + __be32 lh_hash; +}; + +/* + * Log type descriptor + */ + +#define GFS2_LOG_DESC_METADATA 300 +/* ld_data1 is the number of metadata blocks in the descriptor. + ld_data2 is unused. */ + +#define GFS2_LOG_DESC_REVOKE 301 +/* ld_data1 is the number of revoke blocks in the descriptor. + ld_data2 is unused. */ + +#define GFS2_LOG_DESC_JDATA 302 +/* ld_data1 is the number of data blocks in the descriptor. + ld_data2 is unused. */ + +struct gfs2_log_descriptor { + struct gfs2_meta_header ld_header; + + __be32 ld_type; /* GFS2_LOG_DESC_... */ + __be32 ld_length; /* Number of buffers in this chunk */ + __be32 ld_data1; /* descriptor-specific field */ + __be32 ld_data2; /* descriptor-specific field */ + + __u8 ld_reserved[32]; +}; + +/* + * Inum Range + * Describe a range of formal inode numbers allocated to + * one machine to assign to inodes. + */ + +#define GFS2_INUM_QUANTUM 1048576 + +struct gfs2_inum_range { + __be64 ir_start; + __be64 ir_length; +}; + +/* + * Statfs change + * Describes an change to the pool of free and allocated + * blocks. + */ + +struct gfs2_statfs_change { + __be64 sc_total; + __be64 sc_free; + __be64 sc_dinodes; +}; + +/* + * Quota change + * Describes an allocation change for a particular + * user or group. + */ + +#define GFS2_QCF_USER 0x00000001 + +struct gfs2_quota_change { + __be64 qc_change; + __be32 qc_flags; /* GFS2_QCF_... */ + __be32 qc_id; +}; + +struct gfs2_quota_lvb { + __be32 qb_magic; + __u32 __pad; + __be64 qb_limit; /* Hard limit of # blocks to alloc */ + __be64 qb_warn; /* Warn user when alloc is above this # */ + __be64 qb_value; /* Current # blocks allocated */ +}; + +#endif /* __GFS2_ONDISK_DOT_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gigaset_dev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gigaset_dev.h new file mode 100644 index 0000000..5dc4a31 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/gigaset_dev.h @@ -0,0 +1,30 @@ +/* + * interface to user space for the gigaset driver + * + * Copyright (c) 2004 by Hansjoerg Lipp + * + * ===================================================================== + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * ===================================================================== + */ + +#ifndef GIGASET_INTERFACE_H +#define GIGASET_INTERFACE_H + +#include + +#define GIGASET_IOCTL 0x47 + +#define GIGVER_DRIVER 0 +#define GIGVER_COMPAT 1 +#define GIGVER_FWBASE 2 + +#define GIGASET_REDIR _IOWR (GIGASET_IOCTL, 0, int) +#define GIGASET_CONFIG _IOWR (GIGASET_IOCTL, 1, int) +#define GIGASET_BRKCHARS _IOW (GIGASET_IOCTL, 2, unsigned char[6]) //FIXME [6] okay? +#define GIGASET_VERSION _IOWR (GIGASET_IOCTL, 3, unsigned[4]) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hayesesp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hayesesp.h new file mode 100644 index 0000000..59d744d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hayesesp.h @@ -0,0 +1,17 @@ +#ifndef HAYESESP_H +#define HAYESESP_H + +struct hayes_esp_config { + short flow_on; + short flow_off; + short rx_trigger; + short tx_trigger; + short pio_threshold; + unsigned char rx_timeout; + char dma_channel; +}; + + + +#endif /* ESP_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc.h new file mode 100644 index 0000000..89e484d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc.h @@ -0,0 +1,23 @@ +/* + * Generic HDLC support routines for Linux + * + * Copyright (C) 1999-2005 Krzysztof Halasa + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License + * as published by the Free Software Foundation. + */ + +#ifndef __HDLC_H +#define __HDLC_H + + +#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ +#if 0 +#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ +#else +#define HDLC_MAX_MRU 1600 /* as required for FR network */ +#endif + + +#endif /* __HDLC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/..install.cmd new file mode 100644 index 0000000..86e01b0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/hdlc/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/hdlc /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/hdlc mips ioctl.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/hdlc /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/hdlc mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/hdlc/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/ioctl.h new file mode 100644 index 0000000..5839723 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlc/ioctl.h @@ -0,0 +1,81 @@ +#ifndef __HDLC_IOCTL_H__ +#define __HDLC_IOCTL_H__ + + +#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ + +#define CLOCK_DEFAULT 0 /* Default setting */ +#define CLOCK_EXT 1 /* External TX and RX clock - DTE */ +#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ +#define CLOCK_TXINT 3 /* Internal TX and external RX clock */ +#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ + + +#define ENCODING_DEFAULT 0 /* Default setting */ +#define ENCODING_NRZ 1 +#define ENCODING_NRZI 2 +#define ENCODING_FM_MARK 3 +#define ENCODING_FM_SPACE 4 +#define ENCODING_MANCHESTER 5 + + +#define PARITY_DEFAULT 0 /* Default setting */ +#define PARITY_NONE 1 /* No parity */ +#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ +#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ +#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ +#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ +#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ +#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ + +#define LMI_DEFAULT 0 /* Default setting */ +#define LMI_NONE 1 /* No LMI, all PVCs are static */ +#define LMI_ANSI 2 /* ANSI Annex D */ +#define LMI_CCITT 3 /* ITU-T Annex A */ +#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ + +typedef struct { + unsigned int clock_rate; /* bits per second */ + unsigned int clock_type; /* internal, external, TX-internal etc. */ + unsigned short loopback; +} sync_serial_settings; /* V.35, V.24, X.21 */ + +typedef struct { + unsigned int clock_rate; /* bits per second */ + unsigned int clock_type; /* internal, external, TX-internal etc. */ + unsigned short loopback; + unsigned int slot_map; +} te1_settings; /* T1, E1 */ + +typedef struct { + unsigned short encoding; + unsigned short parity; +} raw_hdlc_proto; + +typedef struct { + unsigned int t391; + unsigned int t392; + unsigned int n391; + unsigned int n392; + unsigned int n393; + unsigned short lmi; + unsigned short dce; /* 1 for DCE (network side) operation */ +} fr_proto; + +typedef struct { + unsigned int dlci; +} fr_proto_pvc; /* for creating/deleting FR PVCs */ + +typedef struct { + unsigned int dlci; + char master[IFNAMSIZ]; /* Name of master FRAD device */ +}fr_proto_pvc_info; /* for returning PVC information only */ + +typedef struct { + unsigned int interval; + unsigned int timeout; +} cisco_proto; + +/* PPP doesn't need any info now - supply length = 0 to ioctl */ + +#endif /* __HDLC_IOCTL_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlcdrv.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlcdrv.h new file mode 100644 index 0000000..422d965 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdlcdrv.h @@ -0,0 +1,110 @@ +/* + * hdlcdrv.h -- HDLC packet radio network driver. + * The Linux soundcard driver for 1200 baud and 9600 baud packet radio + * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA + */ + +#ifndef _HDLCDRV_H +#define _HDLCDRV_H + +/* -------------------------------------------------------------------- */ +/* + * structs for the IOCTL commands + */ + +struct hdlcdrv_params { + int iobase; + int irq; + int dma; + int dma2; + int seriobase; + int pariobase; + int midiiobase; +}; + +struct hdlcdrv_channel_params { + int tx_delay; /* the transmitter keyup delay in 10ms units */ + int tx_tail; /* the transmitter keyoff delay in 10ms units */ + int slottime; /* the slottime in 10ms; usually 10 = 100ms */ + int ppersist; /* the p-persistence 0..255 */ + int fulldup; /* some driver do not support full duplex, setting */ + /* this just makes them send even if DCD is on */ +}; + +struct hdlcdrv_old_channel_state { + int ptt; + int dcd; + int ptt_keyed; +}; + +struct hdlcdrv_channel_state { + int ptt; + int dcd; + int ptt_keyed; + unsigned long tx_packets; + unsigned long tx_errors; + unsigned long rx_packets; + unsigned long rx_errors; +}; + +struct hdlcdrv_ioctl { + int cmd; + union { + struct hdlcdrv_params mp; + struct hdlcdrv_channel_params cp; + struct hdlcdrv_channel_state cs; + struct hdlcdrv_old_channel_state ocs; + unsigned int calibrate; + unsigned char bits; + char modename[128]; + char drivername[32]; + } data; +}; + +/* -------------------------------------------------------------------- */ + +/* + * ioctl values + */ +#define HDLCDRVCTL_GETMODEMPAR 0 +#define HDLCDRVCTL_SETMODEMPAR 1 +#define HDLCDRVCTL_MODEMPARMASK 2 /* not handled by hdlcdrv */ +#define HDLCDRVCTL_GETCHANNELPAR 10 +#define HDLCDRVCTL_SETCHANNELPAR 11 +#define HDLCDRVCTL_OLDGETSTAT 20 +#define HDLCDRVCTL_CALIBRATE 21 +#define HDLCDRVCTL_GETSTAT 22 + +/* + * these are mainly for debugging purposes + */ +#define HDLCDRVCTL_GETSAMPLES 30 +#define HDLCDRVCTL_GETBITS 31 + +/* + * not handled by hdlcdrv, but by its depending drivers + */ +#define HDLCDRVCTL_GETMODE 40 +#define HDLCDRVCTL_SETMODE 41 +#define HDLCDRVCTL_MODELIST 42 +#define HDLCDRVCTL_DRIVERNAME 43 + +/* + * mask of needed modem parameters, returned by HDLCDRVCTL_MODEMPARMASK + */ +#define HDLCDRV_PARMASK_IOBASE (1<<0) +#define HDLCDRV_PARMASK_IRQ (1<<1) +#define HDLCDRV_PARMASK_DMA (1<<2) +#define HDLCDRV_PARMASK_DMA2 (1<<3) +#define HDLCDRV_PARMASK_SERIOBASE (1<<4) +#define HDLCDRV_PARMASK_PARIOBASE (1<<5) +#define HDLCDRV_PARMASK_MIDIIOBASE (1<<6) + +/* -------------------------------------------------------------------- */ + + +/* -------------------------------------------------------------------- */ + +#endif /* _HDLCDRV_H */ + +/* -------------------------------------------------------------------- */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdreg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdreg.h new file mode 100644 index 0000000..774173f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hdreg.h @@ -0,0 +1,642 @@ +#ifndef _LINUX_HDREG_H +#define _LINUX_HDREG_H + +#include + +/* + * Command Header sizes for IOCTL commands + */ + +#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8)) +#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) +#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) + +#define IDE_DRIVE_TASK_NO_DATA 0 +#define IDE_DRIVE_TASK_INVALID -1 +#define IDE_DRIVE_TASK_SET_XFER 1 +#define IDE_DRIVE_TASK_IN 2 +#define IDE_DRIVE_TASK_OUT 3 +#define IDE_DRIVE_TASK_RAW_WRITE 4 + +/* + * Define standard taskfile in/out register + */ +#define IDE_TASKFILE_STD_IN_FLAGS 0xFE +#define IDE_HOB_STD_IN_FLAGS 0x3C +#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE +#define IDE_HOB_STD_OUT_FLAGS 0x3C + +typedef unsigned char task_ioreg_t; +typedef unsigned long sata_ioreg_t; + +typedef union ide_reg_valid_s { + unsigned all : 16; + struct { + unsigned data : 1; + unsigned error_feature : 1; + unsigned sector : 1; + unsigned nsector : 1; + unsigned lcyl : 1; + unsigned hcyl : 1; + unsigned select : 1; + unsigned status_command : 1; + + unsigned data_hob : 1; + unsigned error_feature_hob : 1; + unsigned sector_hob : 1; + unsigned nsector_hob : 1; + unsigned lcyl_hob : 1; + unsigned hcyl_hob : 1; + unsigned select_hob : 1; + unsigned control_hob : 1; + } b; +} ide_reg_valid_t; + +typedef struct ide_task_request_s { + __u8 io_ports[8]; + __u8 hob_ports[8]; /* bytes 6 and 7 are unused */ + ide_reg_valid_t out_flags; + ide_reg_valid_t in_flags; + int data_phase; + int req_cmd; + unsigned long out_size; + unsigned long in_size; +} ide_task_request_t; + +typedef struct ide_ioctl_request_s { + ide_task_request_t *task_request; + unsigned char *out_buffer; + unsigned char *in_buffer; +} ide_ioctl_request_t; + +struct hd_drive_cmd_hdr { + __u8 command; + __u8 sector_number; + __u8 feature; + __u8 sector_count; +}; + +typedef struct hd_drive_task_hdr { + __u8 data; + __u8 feature; + __u8 sector_count; + __u8 sector_number; + __u8 low_cylinder; + __u8 high_cylinder; + __u8 device_head; + __u8 command; +} task_struct_t; + +typedef struct hd_drive_hob_hdr { + __u8 data; + __u8 feature; + __u8 sector_count; + __u8 sector_number; + __u8 low_cylinder; + __u8 high_cylinder; + __u8 device_head; + __u8 control; +} hob_struct_t; + +#define TASKFILE_NO_DATA 0x0000 + +#define TASKFILE_IN 0x0001 +#define TASKFILE_MULTI_IN 0x0002 + +#define TASKFILE_OUT 0x0004 +#define TASKFILE_MULTI_OUT 0x0008 +#define TASKFILE_IN_OUT 0x0010 + +#define TASKFILE_IN_DMA 0x0020 +#define TASKFILE_OUT_DMA 0x0040 +#define TASKFILE_IN_DMAQ 0x0080 +#define TASKFILE_OUT_DMAQ 0x0100 + +#define TASKFILE_P_IN 0x0200 +#define TASKFILE_P_OUT 0x0400 +#define TASKFILE_P_IN_DMA 0x0800 +#define TASKFILE_P_OUT_DMA 0x1000 +#define TASKFILE_P_IN_DMAQ 0x2000 +#define TASKFILE_P_OUT_DMAQ 0x4000 +#define TASKFILE_48 0x8000 +#define TASKFILE_INVALID 0x7fff + +/* ATA/ATAPI Commands pre T13 Spec */ +#define WIN_NOP 0x00 +/* + * 0x01->0x02 Reserved + */ +#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */ +/* + * 0x04->0x07 Reserved + */ +#define WIN_SRST 0x08 /* ATAPI soft reset command */ +#define WIN_DEVICE_RESET 0x08 +/* + * 0x09->0x0F Reserved + */ +#define WIN_RECAL 0x10 +#define WIN_RESTORE WIN_RECAL +/* + * 0x10->0x1F Reserved + */ +#define WIN_READ 0x20 /* 28-Bit */ +#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */ +#define WIN_READ_LONG 0x22 /* 28-Bit */ +#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */ +#define WIN_READ_EXT 0x24 /* 48-Bit */ +#define WIN_READDMA_EXT 0x25 /* 48-Bit */ +#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */ +#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */ +/* + * 0x28 + */ +#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */ +/* + * 0x2A->0x2F Reserved + */ +#define WIN_WRITE 0x30 /* 28-Bit */ +#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */ +#define WIN_WRITE_LONG 0x32 /* 28-Bit */ +#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */ +#define WIN_WRITE_EXT 0x34 /* 48-Bit */ +#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */ +#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */ +#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */ +#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */ +#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */ +/* + * 0x3A->0x3B Reserved + */ +#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */ +/* + * 0x3D->0x3F Reserved + */ +#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */ +#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */ +#define WIN_VERIFY_EXT 0x42 /* 48-Bit */ +/* + * 0x43->0x4F Reserved + */ +#define WIN_FORMAT 0x50 +/* + * 0x51->0x5F Reserved + */ +#define WIN_INIT 0x60 +/* + * 0x61->0x5F Reserved + */ +#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */ + +#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */ +#define WIN_DIAGNOSE 0x90 +#define WIN_SPECIFY 0x91 /* set drive geometry translation */ +#define WIN_DOWNLOAD_MICROCODE 0x92 +#define WIN_STANDBYNOW2 0x94 +#define WIN_STANDBY2 0x96 +#define WIN_SETIDLE2 0x97 +#define WIN_CHECKPOWERMODE2 0x98 +#define WIN_SLEEPNOW2 0x99 +/* + * 0x9A VENDOR + */ +#define WIN_PACKETCMD 0xA0 /* Send a packet command. */ +#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */ +#define WIN_QUEUED_SERVICE 0xA2 +#define WIN_SMART 0xB0 /* self-monitoring and reporting */ +#define CFA_ERASE_SECTORS 0xC0 +#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/ +#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ +#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ +#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */ +#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */ +#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */ +#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */ +#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */ +#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */ +#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */ +#define WIN_GETMEDIASTATUS 0xDA +#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */ +#define WIN_POSTBOOT 0xDC +#define WIN_PREBOOT 0xDD +#define WIN_DOORLOCK 0xDE /* lock door on removable drives */ +#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */ +#define WIN_STANDBYNOW1 0xE0 +#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */ +#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */ +#define WIN_SETIDLE1 0xE3 +#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */ +#define WIN_CHECKPOWERMODE1 0xE5 +#define WIN_SLEEPNOW1 0xE6 +#define WIN_FLUSH_CACHE 0xE7 +#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */ +#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */ + /* SET_FEATURES 0x22 or 0xDD */ +#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */ +#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ +#define WIN_MEDIAEJECT 0xED +#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */ +#define WIN_SETFEATURES 0xEF /* set special drive features */ +#define EXABYTE_ENABLE_NEST 0xF0 +#define WIN_SECURITY_SET_PASS 0xF1 +#define WIN_SECURITY_UNLOCK 0xF2 +#define WIN_SECURITY_ERASE_PREPARE 0xF3 +#define WIN_SECURITY_ERASE_UNIT 0xF4 +#define WIN_SECURITY_FREEZE_LOCK 0xF5 +#define WIN_SECURITY_DISABLE 0xF6 +#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */ +#define WIN_SET_MAX 0xF9 +#define DISABLE_SEAGATE 0xFB + +/* WIN_SMART sub-commands */ + +#define SMART_READ_VALUES 0xD0 +#define SMART_READ_THRESHOLDS 0xD1 +#define SMART_AUTOSAVE 0xD2 +#define SMART_SAVE 0xD3 +#define SMART_IMMEDIATE_OFFLINE 0xD4 +#define SMART_READ_LOG_SECTOR 0xD5 +#define SMART_WRITE_LOG_SECTOR 0xD6 +#define SMART_WRITE_THRESHOLDS 0xD7 +#define SMART_ENABLE 0xD8 +#define SMART_DISABLE 0xD9 +#define SMART_STATUS 0xDA +#define SMART_AUTO_OFFLINE 0xDB + +/* Password used in TF4 & TF5 executing SMART commands */ + +#define SMART_LCYL_PASS 0x4F +#define SMART_HCYL_PASS 0xC2 + +/* WIN_SETFEATURES sub-commands */ +#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */ +#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */ +#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */ +#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */ +#define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */ +#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */ +#define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */ +#define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */ +#define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */ +#define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */ +#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */ +#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */ +#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */ +#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */ +#define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */ +#define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */ +#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */ +#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */ +#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */ +#define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */ +#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */ +#define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */ +#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ +#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ +#define SETFEATURES_EN_REST 0xAC /* ATA-1 */ +#define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */ +#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ +#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ +#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ +#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */ +#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */ + +/* WIN_SECURITY sub-commands */ + +#define SECURITY_SET_PASSWORD 0xBA +#define SECURITY_UNLOCK 0xBB +#define SECURITY_ERASE_PREPARE 0xBC +#define SECURITY_ERASE_UNIT 0xBD +#define SECURITY_FREEZE_LOCK 0xBE +#define SECURITY_DISABLE_PASSWORD 0xBF + +struct hd_geometry { + unsigned char heads; + unsigned char sectors; + unsigned short cylinders; + unsigned long start; +}; + +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ +#define HDIO_GETGEO 0x0301 /* get device geometry */ +#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ +#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ +#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */ + +#define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */ + +#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */ +#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ +#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ +#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ +#define HDIO_GET_DMA 0x030b /* get use-dma flag */ +#define HDIO_GET_NICE 0x030c /* get nice flags */ +#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ +#define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */ +#define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */ +#define HDIO_GET_ADDRESS 0x0310 /* */ + +#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */ +#define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */ +#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */ +#define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */ +#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */ +#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ +#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK + +/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ +#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ +#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ +#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ +#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ +#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ +#define HDIO_SET_DMA 0x0326 /* change use-dma flag */ +#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ +#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ +#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ +#define HDIO_SET_NICE 0x0329 /* set nice flags */ +#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ +#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ +#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ +#define HDIO_SET_QDMA 0x032e /* change use-qdma flag */ +#define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */ + +/* bus states */ +enum { + BUSSTATE_OFF = 0, + BUSSTATE_ON, + BUSSTATE_TRISTATE +}; + +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */ +/* 0x330 is reserved - used to be HDIO_GETGEO_BIG */ +/* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */ +/* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */ +/* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */ + +#define __NEW_HD_DRIVE_ID + +/* + * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. + * + * If you change something here, please remember to update fix_driveid() in + * ide/probe.c. + */ +struct hd_driveid { + unsigned short config; /* lots of obsolete bit flags */ + unsigned short cyls; /* Obsolete, "physical" cyls */ + unsigned short reserved2; /* reserved (word 2) */ + unsigned short heads; /* Obsolete, "physical" heads */ + unsigned short track_bytes; /* unformatted bytes per track */ + unsigned short sector_bytes; /* unformatted bytes per sector */ + unsigned short sectors; /* Obsolete, "physical" sectors per track */ + unsigned short vendor0; /* vendor unique */ + unsigned short vendor1; /* vendor unique */ + unsigned short vendor2; /* Retired vendor unique */ + unsigned char serial_no[20]; /* 0 = not_specified */ + unsigned short buf_type; /* Retired */ + unsigned short buf_size; /* Retired, 512 byte increments + * 0 = not_specified + */ + unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */ + unsigned char fw_rev[8]; /* 0 = not_specified */ + unsigned char model[40]; /* 0 = not_specified */ + unsigned char max_multsect; /* 0=not_implemented */ + unsigned char vendor3; /* vendor unique */ + unsigned short dword_io; /* 0=not_implemented; 1=implemented */ + unsigned char vendor4; /* vendor unique */ + unsigned char capability; /* (upper byte of word 49) + * 3: IORDYsup + * 2: IORDYsw + * 1: LBA + * 0: DMA + */ + unsigned short reserved50; /* reserved (word 50) */ + unsigned char vendor5; /* Obsolete, vendor unique */ + unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */ + unsigned char vendor6; /* Obsolete, vendor unique */ + unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */ + unsigned short field_valid; /* (word 53) + * 2: ultra_ok word 88 + * 1: eide_ok words 64-70 + * 0: cur_ok words 54-58 + */ + unsigned short cur_cyls; /* Obsolete, logical cylinders */ + unsigned short cur_heads; /* Obsolete, l heads */ + unsigned short cur_sectors; /* Obsolete, l sectors per track */ + unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */ + unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */ + unsigned char multsect; /* current multiple sector count */ + unsigned char multsect_valid; /* when (bit0==1) multsect is ok */ + unsigned int lba_capacity; /* Obsolete, total number of sectors */ + unsigned short dma_1word; /* Obsolete, single-word dma info */ + unsigned short dma_mword; /* multiple-word dma info */ + unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */ + unsigned short eide_dma_min; /* min mword dma cycle time (ns) */ + unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */ + unsigned short eide_pio; /* min cycle time (ns), no IORDY */ + unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */ + unsigned short words69_70[2]; /* reserved words 69-70 + * future command overlap and queuing + */ + unsigned short words71_74[4]; /* reserved words 71-74 + * for IDENTIFY PACKET DEVICE command + */ + unsigned short queue_depth; /* (word 75) + * 15:5 reserved + * 4:0 Maximum queue depth -1 + */ + unsigned short words76_79[4]; /* reserved words 76-79 */ + unsigned short major_rev_num; /* (word 80) */ + unsigned short minor_rev_num; /* (word 81) */ + unsigned short command_set_1; /* (word 82) supported + * 15: Obsolete + * 14: NOP command + * 13: READ_BUFFER + * 12: WRITE_BUFFER + * 11: Obsolete + * 10: Host Protected Area + * 9: DEVICE Reset + * 8: SERVICE Interrupt + * 7: Release Interrupt + * 6: look-ahead + * 5: write cache + * 4: PACKET Command + * 3: Power Management Feature Set + * 2: Removable Feature Set + * 1: Security Feature Set + * 0: SMART Feature Set + */ + unsigned short command_set_2; /* (word 83) + * 15: Shall be ZERO + * 14: Shall be ONE + * 13: FLUSH CACHE EXT + * 12: FLUSH CACHE + * 11: Device Configuration Overlay + * 10: 48-bit Address Feature Set + * 9: Automatic Acoustic Management + * 8: SET MAX security + * 7: reserved 1407DT PARTIES + * 6: SetF sub-command Power-Up + * 5: Power-Up in Standby Feature Set + * 4: Removable Media Notification + * 3: APM Feature Set + * 2: CFA Feature Set + * 1: READ/WRITE DMA QUEUED + * 0: Download MicroCode + */ + unsigned short cfsse; /* (word 84) + * cmd set-feature supported extensions + * 15: Shall be ZERO + * 14: Shall be ONE + * 13:6 reserved + * 5: General Purpose Logging + * 4: Streaming Feature Set + * 3: Media Card Pass Through + * 2: Media Serial Number Valid + * 1: SMART selt-test supported + * 0: SMART error logging + */ + unsigned short cfs_enable_1; /* (word 85) + * command set-feature enabled + * 15: Obsolete + * 14: NOP command + * 13: READ_BUFFER + * 12: WRITE_BUFFER + * 11: Obsolete + * 10: Host Protected Area + * 9: DEVICE Reset + * 8: SERVICE Interrupt + * 7: Release Interrupt + * 6: look-ahead + * 5: write cache + * 4: PACKET Command + * 3: Power Management Feature Set + * 2: Removable Feature Set + * 1: Security Feature Set + * 0: SMART Feature Set + */ + unsigned short cfs_enable_2; /* (word 86) + * command set-feature enabled + * 15: Shall be ZERO + * 14: Shall be ONE + * 13: FLUSH CACHE EXT + * 12: FLUSH CACHE + * 11: Device Configuration Overlay + * 10: 48-bit Address Feature Set + * 9: Automatic Acoustic Management + * 8: SET MAX security + * 7: reserved 1407DT PARTIES + * 6: SetF sub-command Power-Up + * 5: Power-Up in Standby Feature Set + * 4: Removable Media Notification + * 3: APM Feature Set + * 2: CFA Feature Set + * 1: READ/WRITE DMA QUEUED + * 0: Download MicroCode + */ + unsigned short csf_default; /* (word 87) + * command set-feature default + * 15: Shall be ZERO + * 14: Shall be ONE + * 13:6 reserved + * 5: General Purpose Logging enabled + * 4: Valid CONFIGURE STREAM executed + * 3: Media Card Pass Through enabled + * 2: Media Serial Number Valid + * 1: SMART selt-test supported + * 0: SMART error logging + */ + unsigned short dma_ultra; /* (word 88) */ + unsigned short trseuc; /* time required for security erase */ + unsigned short trsEuc; /* time required for enhanced erase */ + unsigned short CurAPMvalues; /* current APM values */ + unsigned short mprc; /* master password revision code */ + unsigned short hw_config; /* hardware config (word 93) + * 15: Shall be ZERO + * 14: Shall be ONE + * 13: + * 12: + * 11: + * 10: + * 9: + * 8: + * 7: + * 6: + * 5: + * 4: + * 3: + * 2: + * 1: + * 0: Shall be ONE + */ + unsigned short acoustic; /* (word 94) + * 15:8 Vendor's recommended value + * 7:0 current value + */ + unsigned short msrqs; /* min stream request size */ + unsigned short sxfert; /* stream transfer time */ + unsigned short sal; /* stream access latency */ + unsigned int spg; /* stream performance granularity */ + unsigned long long lba_capacity_2;/* 48-bit total number of sectors */ + unsigned short words104_125[22];/* reserved words 104-125 */ + unsigned short last_lun; /* (word 126) */ + unsigned short word127; /* (word 127) Feature Set + * Removable Media Notification + * 15:2 reserved + * 1:0 00 = not supported + * 01 = supported + * 10 = reserved + * 11 = reserved + */ + unsigned short dlf; /* (word 128) + * device lock function + * 15:9 reserved + * 8 security level 1:max 0:high + * 7:6 reserved + * 5 enhanced erase + * 4 expire + * 3 frozen + * 2 locked + * 1 en/disabled + * 0 capability + */ + unsigned short csfo; /* (word 129) + * current set features options + * 15:4 reserved + * 3: auto reassign + * 2: reverting + * 1: read-look-ahead + * 0: write cache + */ + unsigned short words130_155[26];/* reserved vendor words 130-155 */ + unsigned short word156; /* reserved vendor word 156 */ + unsigned short words157_159[3];/* reserved vendor words 157-159 */ + unsigned short cfa_power; /* (word 160) CFA Power Mode + * 15 word 160 supported + * 14 reserved + * 13 + * 12 + * 11:0 + */ + unsigned short words161_175[15];/* Reserved for CFA */ + unsigned short words176_205[30];/* Current Media Serial Number */ + unsigned short words206_254[49];/* reserved words 206-254 */ + unsigned short integrity_word; /* (word 255) + * 15:8 Checksum + * 7:0 Signature + */ +}; + +/* + * IDE "nice" flags. These are used on a per drive basis to determine + * when to be nice and give more bandwidth to the other devices which + * share the same IDE bus. + */ +#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ +#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ +#define IDE_NICE_1 (3) /* when probably won't affect us much */ +#define IDE_NICE_0 (2) /* when sure that it won't affect us */ +#define IDE_NICE_2 (4) /* when we know it's on our expense */ + +#endif /* _LINUX_HDREG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hid.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hid.h new file mode 100644 index 0000000..ca2cefd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hid.h @@ -0,0 +1,67 @@ +#ifndef __HID_H +#define __HID_H + +/* + * Copyright (c) 1999 Andreas Gal + * Copyright (c) 2000-2001 Vojtech Pavlik + * Copyright (c) 2006-2007 Jiri Kosina + */ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Should you need to contact me, the author, you can do so either by + * e-mail - mail your message to , or by paper mail: + * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic + */ + +/* + * USB HID (Human Interface Device) interface class code + */ + +#define USB_INTERFACE_CLASS_HID 3 + +/* + * USB HID interface subclass and protocol codes + */ + +#define USB_INTERFACE_SUBCLASS_BOOT 1 +#define USB_INTERFACE_PROTOCOL_KEYBOARD 1 +#define USB_INTERFACE_PROTOCOL_MOUSE 2 + +/* + * HID class requests + */ + +#define HID_REQ_GET_REPORT 0x01 +#define HID_REQ_GET_IDLE 0x02 +#define HID_REQ_GET_PROTOCOL 0x03 +#define HID_REQ_SET_REPORT 0x09 +#define HID_REQ_SET_IDLE 0x0A +#define HID_REQ_SET_PROTOCOL 0x0B + +/* + * HID class descriptor types + */ + +#define HID_DT_HID (USB_TYPE_CLASS | 0x01) +#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) +#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03) + +#define HID_MAX_DESCRIPTOR_SIZE 4096 + + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hiddev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hiddev.h new file mode 100644 index 0000000..94b36c3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hiddev.h @@ -0,0 +1,212 @@ +#ifndef _HIDDEV_H +#define _HIDDEV_H + +/* + * Copyright (c) 1999-2000 Vojtech Pavlik + * + * Sponsored by SuSE + */ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Should you need to contact me, the author, you can do so either by + * e-mail - mail your message to , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include + +/* + * The event structure itself + */ + +struct hiddev_event { + unsigned hid; + signed int value; +}; + +struct hiddev_devinfo { + __u32 bustype; + __u32 busnum; + __u32 devnum; + __u32 ifnum; + __s16 vendor; + __s16 product; + __s16 version; + __u32 num_applications; +}; + +struct hiddev_collection_info { + __u32 index; + __u32 type; + __u32 usage; + __u32 level; +}; + +#define HID_STRING_SIZE 256 +struct hiddev_string_descriptor { + __s32 index; + char value[HID_STRING_SIZE]; +}; + +struct hiddev_report_info { + __u32 report_type; + __u32 report_id; + __u32 num_fields; +}; + +/* To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and + * report_id. Set report_id to REPORT_ID_UNKNOWN if the rest of the fields + * are unknown. Otherwise use a usage_ref struct filled in from a previous + * successful GUSAGE call to save time. To actually send a value to the + * device, perform a SUSAGE first, followed by a SREPORT. An INITREPORT or a + * GREPORT isn't necessary for a GUSAGE to return valid data. + */ +#define HID_REPORT_ID_UNKNOWN 0xffffffff +#define HID_REPORT_ID_FIRST 0x00000100 +#define HID_REPORT_ID_NEXT 0x00000200 +#define HID_REPORT_ID_MASK 0x000000ff +#define HID_REPORT_ID_MAX 0x000000ff + +#define HID_REPORT_TYPE_INPUT 1 +#define HID_REPORT_TYPE_OUTPUT 2 +#define HID_REPORT_TYPE_FEATURE 3 +#define HID_REPORT_TYPE_MIN 1 +#define HID_REPORT_TYPE_MAX 3 + +struct hiddev_field_info { + __u32 report_type; + __u32 report_id; + __u32 field_index; + __u32 maxusage; + __u32 flags; + __u32 physical; /* physical usage for this field */ + __u32 logical; /* logical usage for this field */ + __u32 application; /* application usage for this field */ + __s32 logical_minimum; + __s32 logical_maximum; + __s32 physical_minimum; + __s32 physical_maximum; + __u32 unit_exponent; + __u32 unit; +}; + +/* Fill in report_type, report_id and field_index to get the information on a + * field. + */ +#define HID_FIELD_CONSTANT 0x001 +#define HID_FIELD_VARIABLE 0x002 +#define HID_FIELD_RELATIVE 0x004 +#define HID_FIELD_WRAP 0x008 +#define HID_FIELD_NONLINEAR 0x010 +#define HID_FIELD_NO_PREFERRED 0x020 +#define HID_FIELD_NULL_STATE 0x040 +#define HID_FIELD_VOLATILE 0x080 +#define HID_FIELD_BUFFERED_BYTE 0x100 + +struct hiddev_usage_ref { + __u32 report_type; + __u32 report_id; + __u32 field_index; + __u32 usage_index; + __u32 usage_code; + __s32 value; +}; + +/* hiddev_usage_ref_multi is used for sending multiple bytes to a control. + * It really manifests itself as setting the value of consecutive usages */ +#define HID_MAX_MULTI_USAGES 1024 +struct hiddev_usage_ref_multi { + struct hiddev_usage_ref uref; + __u32 num_values; + __s32 values[HID_MAX_MULTI_USAGES]; +}; + +/* FIELD_INDEX_NONE is returned in read() data from the kernel when flags + * is set to (HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT) and a new report has + * been sent by the device + */ +#define HID_FIELD_INDEX_NONE 0xffffffff + +/* + * Protocol version. + */ + +#define HID_VERSION 0x010004 + +/* + * IOCTLs (0x00 - 0x7f) + */ + +#define HIDIOCGVERSION _IOR('H', 0x01, int) +#define HIDIOCAPPLICATION _IO('H', 0x02) +#define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo) +#define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor) +#define HIDIOCINITREPORT _IO('H', 0x05) +#define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len) +#define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info) +#define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info) +#define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info) +#define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info) +#define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref) +#define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref) +#define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref) +#define HIDIOCGFLAG _IOR('H', 0x0E, int) +#define HIDIOCSFLAG _IOW('H', 0x0F, int) +#define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref) +#define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info) +#define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len) + +/* For writing/reading to multiple/consecutive usages */ +#define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi) +#define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi) + +/* + * Flags to be used in HIDIOCSFLAG + */ +#define HIDDEV_FLAG_UREF 0x1 +#define HIDDEV_FLAG_REPORT 0x2 +#define HIDDEV_FLAGS 0x3 + +/* To traverse the input report descriptor info for a HID device, perform the + * following: + * + * rinfo.report_type = HID_REPORT_TYPE_INPUT; + * rinfo.report_id = HID_REPORT_ID_FIRST; + * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); + * + * while (ret >= 0) { + * for (i = 0; i < rinfo.num_fields; i++) { + * finfo.report_type = rinfo.report_type; + * finfo.report_id = rinfo.report_id; + * finfo.field_index = i; + * ioctl(fd, HIDIOCGFIELDINFO, &finfo); + * for (j = 0; j < finfo.maxusage; j++) { + * uref.report_type = rinfo.report_type; + * uref.report_id = rinfo.report_id; + * uref.field_index = i; + * uref.usage_index = j; + * ioctl(fd, HIDIOCGUCODE, &uref); + * ioctl(fd, HIDIOCGUSAGE, &uref); + * } + * } + * rinfo.report_id |= HID_REPORT_ID_NEXT; + * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); + * } + */ + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hidraw.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hidraw.h new file mode 100644 index 0000000..9e19979 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hidraw.h @@ -0,0 +1,47 @@ +#ifndef _HIDRAW_H +#define _HIDRAW_H + +/* + * Copyright (c) 2007 Jiri Kosina + */ + +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include + +struct hidraw_report_descriptor { + __u32 size; + __u8 value[HID_MAX_DESCRIPTOR_SIZE]; +}; + +struct hidraw_devinfo { + __u32 bustype; + __s16 vendor; + __s16 product; +}; + +/* ioctl interface */ +#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) +#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) +#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) +#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) +#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) + +#define HIDRAW_FIRST_MINOR 0 +#define HIDRAW_MAX_DEVICES 64 +/* number of reports to buffer */ +#define HIDRAW_BUFFER_SIZE 64 + + +/* kernel-only API declarations */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hpet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hpet.h new file mode 100644 index 0000000..263f7fe --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hpet.h @@ -0,0 +1,23 @@ +#ifndef __HPET__ +#define __HPET__ 1 + + + + +struct hpet_info { + unsigned long hi_ireqfreq; /* Hz */ + unsigned long hi_flags; /* information */ + unsigned short hi_hpet; + unsigned short hi_timer; +}; + +#define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */ + +#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ +#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ +#define HPET_INFO _IOR('h', 0x03, struct hpet_info) +#define HPET_EPI _IO('h', 0x04) /* enable periodic */ +#define HPET_DPI _IO('h', 0x05) /* disable periodic */ +#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ + +#endif /* !__HPET__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hysdn_if.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hysdn_if.h new file mode 100644 index 0000000..00236ae --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/hysdn_if.h @@ -0,0 +1,33 @@ +/* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $ + * + * Linux driver for HYSDN cards + * ioctl definitions shared by hynetmgr and driver. + * + * Author Werner Cornelius (werner@titro.de) for Hypercope GmbH + * Copyright 1999 by Werner Cornelius (werner@titro.de) + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +/****************/ +/* error values */ +/****************/ +#define ERR_NONE 0 /* no error occurred */ +#define ERR_ALREADY_BOOT 1000 /* we are already booting */ +#define EPOF_BAD_MAGIC 1001 /* bad magic in POF header */ +#define ERR_BOARD_DPRAM 1002 /* board DPRAM failed */ +#define EPOF_INTERNAL 1003 /* internal POF handler error */ +#define EPOF_BAD_IMG_SIZE 1004 /* POF boot image size invalid */ +#define ERR_BOOTIMG_FAIL 1005 /* 1. stage boot image did not start */ +#define ERR_BOOTSEQ_FAIL 1006 /* 2. stage boot seq handshake timeout */ +#define ERR_POF_TIMEOUT 1007 /* timeout waiting for card pof ready */ +#define ERR_NOT_BOOTED 1008 /* operation only allowed when booted */ +#define ERR_CONF_LONG 1009 /* conf line is too long */ +#define ERR_INV_CHAN 1010 /* invalid channel number */ +#define ERR_ASYNC_TIME 1011 /* timeout sending async data */ + + + + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2c-dev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2c-dev.h new file mode 100644 index 0000000..271d475 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2c-dev.h @@ -0,0 +1,71 @@ +/* + i2c-dev.h - i2c-bus driver, char device interface + + Copyright (C) 1995-97 Simon G. Vogl + Copyright (C) 1998-99 Frodo Looijaard + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _LINUX_I2C_DEV_H +#define _LINUX_I2C_DEV_H + +#include + + +/* /dev/i2c-X ioctl commands. The ioctl's parameter is always an + * unsigned long, except for: + * - I2C_FUNCS, takes pointer to an unsigned long + * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data + * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data + */ +#define I2C_RETRIES 0x0701 /* number of times a device address should + be polled when not acknowledging */ +#define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ + +/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses + * are NOT supported! (due to code brokenness) + */ +#define I2C_SLAVE 0x0703 /* Use this slave address */ +#define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it + is already in use by a driver! */ +#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ + +#define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ + +#define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ + +#define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ +#define I2C_SMBUS 0x0720 /* SMBus transfer */ + + +/* This is the structure as used in the I2C_SMBUS ioctl call */ +struct i2c_smbus_ioctl_data { + __u8 read_write; + __u8 command; + __u32 size; + union i2c_smbus_data *data; +}; + +/* This is the structure as used in the I2C_RDWR ioctl call */ +struct i2c_rdwr_ioctl_data { + struct i2c_msg *msgs; /* pointers to i2c_msgs */ + __u32 nmsgs; /* number of i2c_msgs */ +}; + +#define I2C_RDRW_IOCTL_MAX_MSGS 42 + + +#endif /* _LINUX_I2C_DEV_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2c.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2c.h new file mode 100644 index 0000000..6d77f1f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2c.h @@ -0,0 +1,149 @@ +/* ------------------------------------------------------------------------- */ +/* */ +/* i2c.h - definitions for the i2c-bus interface */ +/* */ +/* ------------------------------------------------------------------------- */ +/* Copyright (C) 1995-2000 Simon G. Vogl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* ------------------------------------------------------------------------- */ + +/* With some changes from Kyösti Mälkki and + Frodo Looijaard */ + +#ifndef _LINUX_I2C_H +#define _LINUX_I2C_H + +#include + +/** + * struct i2c_msg - an I2C transaction segment beginning with START + * @addr: Slave address, either seven or ten bits. When this is a ten + * bit address, I2C_M_TEN must be set in @flags and the adapter + * must support I2C_FUNC_10BIT_ADDR. + * @flags: I2C_M_RD is handled by all adapters. No other flags may be + * provided unless the adapter exported the relevant I2C_FUNC_* + * flags through i2c_check_functionality(). + * @len: Number of data bytes in @buf being read from or written to the + * I2C slave address. For read transactions where I2C_M_RECV_LEN + * is set, the caller guarantees that this buffer can hold up to + * 32 bytes in addition to the initial length byte sent by the + * slave (plus, if used, the SMBus PEC); and this value will be + * incremented by the number of block data bytes received. + * @buf: The buffer into which data is read, or from which it's written. + * + * An i2c_msg is the low level representation of one segment of an I2C + * transaction. It is visible to drivers in the @i2c_transfer() procedure, + * to userspace from i2c-dev, and to I2C adapter drivers through the + * @i2c_adapter.@master_xfer() method. + * + * Except when I2C "protocol mangling" is used, all I2C adapters implement + * the standard rules for I2C transactions. Each transaction begins with a + * START. That is followed by the slave address, and a bit encoding read + * versus write. Then follow all the data bytes, possibly including a byte + * with SMBus PEC. The transfer terminates with a NAK, or when all those + * bytes have been transferred and ACKed. If this is the last message in a + * group, it is followed by a STOP. Otherwise it is followed by the next + * @i2c_msg transaction segment, beginning with a (repeated) START. + * + * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then + * passing certain @flags may have changed those standard protocol behaviors. + * Those flags are only for use with broken/nonconforming slaves, and with + * adapters which are known to support the specific mangling options they + * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR). + */ +struct i2c_msg { + __u16 addr; /* slave address */ + __u16 flags; +#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ +#define I2C_M_RD 0x0001 /* read data, from slave to master */ +#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ + __u16 len; /* msg length */ + __u8 *buf; /* pointer to msg data */ +}; + +/* To determine what functionality is present */ + +#define I2C_FUNC_I2C 0x00000001 +#define I2C_FUNC_10BIT_ADDR 0x00000002 +#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_NOSTART etc. */ +#define I2C_FUNC_SMBUS_PEC 0x00000008 +#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ +#define I2C_FUNC_SMBUS_QUICK 0x00010000 +#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 +#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 +#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 +#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 +#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 +#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 +#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 +#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 +#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 +#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ +#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ + +#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ + I2C_FUNC_SMBUS_WRITE_BYTE) +#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ + I2C_FUNC_SMBUS_WRITE_BYTE_DATA) +#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ + I2C_FUNC_SMBUS_WRITE_WORD_DATA) +#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) +#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) + +#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ + I2C_FUNC_SMBUS_BYTE | \ + I2C_FUNC_SMBUS_BYTE_DATA | \ + I2C_FUNC_SMBUS_WORD_DATA | \ + I2C_FUNC_SMBUS_PROC_CALL | \ + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ + I2C_FUNC_SMBUS_I2C_BLOCK | \ + I2C_FUNC_SMBUS_PEC) + +/* + * Data for SMBus Messages + */ +#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ +union i2c_smbus_data { + __u8 byte; + __u16 word; + __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ + /* and one more for user-space compatibility */ +}; + +/* i2c_smbus_xfer read or write markers */ +#define I2C_SMBUS_READ 1 +#define I2C_SMBUS_WRITE 0 + +/* SMBus transaction types (size parameter in the above functions) + Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ +#define I2C_SMBUS_QUICK 0 +#define I2C_SMBUS_BYTE 1 +#define I2C_SMBUS_BYTE_DATA 2 +#define I2C_SMBUS_WORD_DATA 3 +#define I2C_SMBUS_PROC_CALL 4 +#define I2C_SMBUS_BLOCK_DATA 5 +#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 +#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ +#define I2C_SMBUS_I2C_BLOCK_DATA 8 + + +#endif /* _LINUX_I2C_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2o-dev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2o-dev.h new file mode 100644 index 0000000..bc580b6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i2o-dev.h @@ -0,0 +1,421 @@ +/* + * I2O user space accessible structures/APIs + * + * (c) Copyright 1999, 2000 Red Hat Software + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + ************************************************************************* + * + * This header file defines the I2O APIs that are available to both + * the kernel and user level applications. Kernel specific structures + * are defined in i2o_osm. OSMs should include _only_ i2o_osm.h which + * automatically includes this file. + * + */ + +#ifndef _I2O_DEV_H +#define _I2O_DEV_H + +/* How many controllers are we allowing */ +#define MAX_I2O_CONTROLLERS 32 + +#include +#include + +/* + * I2O Control IOCTLs and structures + */ +#define I2O_MAGIC_NUMBER 'i' +#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,__u8[MAX_I2O_CONTROLLERS]) +#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) +#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) +#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) +#define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget) +#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) +#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) +#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) +#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,__u32) +#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) +#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) +#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) +#define I2OPASSTHRU _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru) +#define I2OPASSTHRU32 _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru32) + +struct i2o_cmd_passthru32 { + unsigned int iop; /* IOP unit number */ + __u32 msg; /* message */ +}; + +struct i2o_cmd_passthru { + unsigned int iop; /* IOP unit number */ + void *msg; /* message */ +}; + +struct i2o_cmd_hrtlct { + unsigned int iop; /* IOP unit number */ + void *resbuf; /* Buffer for result */ + unsigned int *reslen; /* Buffer length in bytes */ +}; + +struct i2o_cmd_psetget { + unsigned int iop; /* IOP unit number */ + unsigned int tid; /* Target device TID */ + void *opbuf; /* Operation List buffer */ + unsigned int oplen; /* Operation List buffer length in bytes */ + void *resbuf; /* Result List buffer */ + unsigned int *reslen; /* Result List buffer length in bytes */ +}; + +struct i2o_sw_xfer { + unsigned int iop; /* IOP unit number */ + unsigned char flags; /* Flags field */ + unsigned char sw_type; /* Software type */ + unsigned int sw_id; /* Software ID */ + void *buf; /* Pointer to software buffer */ + unsigned int *swlen; /* Length of software data */ + unsigned int *maxfrag; /* Maximum fragment count */ + unsigned int *curfrag; /* Current fragment count */ +}; + +struct i2o_html { + unsigned int iop; /* IOP unit number */ + unsigned int tid; /* Target device ID */ + unsigned int page; /* HTML page */ + void *resbuf; /* Buffer for reply HTML page */ + unsigned int *reslen; /* Length in bytes of reply buffer */ + void *qbuf; /* Pointer to HTTP query string */ + unsigned int qlen; /* Length in bytes of query string buffer */ +}; + +#define I2O_EVT_Q_LEN 32 + +struct i2o_evt_id { + unsigned int iop; + unsigned int tid; + unsigned int evt_mask; +}; + +/* Event data size = frame size - message header + evt indicator */ +#define I2O_EVT_DATA_SIZE 88 + +struct i2o_evt_info { + struct i2o_evt_id id; + unsigned char evt_data[I2O_EVT_DATA_SIZE]; + unsigned int data_size; +}; + +struct i2o_evt_get { + struct i2o_evt_info info; + int pending; + int lost; +}; + +typedef struct i2o_sg_io_hdr { + unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */ +} i2o_sg_io_hdr_t; + +/************************************************************************** + * HRT related constants and structures + **************************************************************************/ +#define I2O_BUS_LOCAL 0 +#define I2O_BUS_ISA 1 +#define I2O_BUS_EISA 2 +#define I2O_BUS_MCA 3 +#define I2O_BUS_PCI 4 +#define I2O_BUS_PCMCIA 5 +#define I2O_BUS_NUBUS 6 +#define I2O_BUS_CARDBUS 7 +#define I2O_BUS_UNKNOWN 0x80 + +typedef struct _i2o_pci_bus { + __u8 PciFunctionNumber; + __u8 PciDeviceNumber; + __u8 PciBusNumber; + __u8 reserved; + __u16 PciVendorID; + __u16 PciDeviceID; +} i2o_pci_bus; + +typedef struct _i2o_local_bus { + __u16 LbBaseIOPort; + __u16 reserved; + __u32 LbBaseMemoryAddress; +} i2o_local_bus; + +typedef struct _i2o_isa_bus { + __u16 IsaBaseIOPort; + __u8 CSN; + __u8 reserved; + __u32 IsaBaseMemoryAddress; +} i2o_isa_bus; + +typedef struct _i2o_eisa_bus_info { + __u16 EisaBaseIOPort; + __u8 reserved; + __u8 EisaSlotNumber; + __u32 EisaBaseMemoryAddress; +} i2o_eisa_bus; + +typedef struct _i2o_mca_bus { + __u16 McaBaseIOPort; + __u8 reserved; + __u8 McaSlotNumber; + __u32 McaBaseMemoryAddress; +} i2o_mca_bus; + +typedef struct _i2o_other_bus { + __u16 BaseIOPort; + __u16 reserved; + __u32 BaseMemoryAddress; +} i2o_other_bus; + +typedef struct _i2o_hrt_entry { + __u32 adapter_id; + __u32 parent_tid:12; + __u32 state:4; + __u32 bus_num:8; + __u32 bus_type:8; + union { + i2o_pci_bus pci_bus; + i2o_local_bus local_bus; + i2o_isa_bus isa_bus; + i2o_eisa_bus eisa_bus; + i2o_mca_bus mca_bus; + i2o_other_bus other_bus; + } bus; +} i2o_hrt_entry; + +typedef struct _i2o_hrt { + __u16 num_entries; + __u8 entry_len; + __u8 hrt_version; + __u32 change_ind; + i2o_hrt_entry hrt_entry[1]; +} i2o_hrt; + +typedef struct _i2o_lct_entry { + __u32 entry_size:16; + __u32 tid:12; + __u32 reserved:4; + __u32 change_ind; + __u32 device_flags; + __u32 class_id:12; + __u32 version:4; + __u32 vendor_id:16; + __u32 sub_class; + __u32 user_tid:12; + __u32 parent_tid:12; + __u32 bios_info:8; + __u8 identity_tag[8]; + __u32 event_capabilities; +} i2o_lct_entry; + +typedef struct _i2o_lct { + __u32 table_size:16; + __u32 boot_tid:12; + __u32 lct_ver:4; + __u32 iop_flags; + __u32 change_ind; + i2o_lct_entry lct_entry[1]; +} i2o_lct; + +typedef struct _i2o_status_block { + __u16 org_id; + __u16 reserved; + __u16 iop_id:12; + __u16 reserved1:4; + __u16 host_unit_id; + __u16 segment_number:12; + __u16 i2o_version:4; + __u8 iop_state; + __u8 msg_type; + __u16 inbound_frame_size; + __u8 init_code; + __u8 reserved2; + __u32 max_inbound_frames; + __u32 cur_inbound_frames; + __u32 max_outbound_frames; + char product_id[24]; + __u32 expected_lct_size; + __u32 iop_capabilities; + __u32 desired_mem_size; + __u32 current_mem_size; + __u32 current_mem_base; + __u32 desired_io_size; + __u32 current_io_size; + __u32 current_io_base; + __u32 reserved3:24; + __u32 cmd_status:8; +} i2o_status_block; + +/* Event indicator mask flags */ +#define I2O_EVT_IND_STATE_CHANGE 0x80000000 +#define I2O_EVT_IND_GENERAL_WARNING 0x40000000 +#define I2O_EVT_IND_CONFIGURATION_FLAG 0x20000000 +#define I2O_EVT_IND_LOCK_RELEASE 0x10000000 +#define I2O_EVT_IND_CAPABILITY_CHANGE 0x08000000 +#define I2O_EVT_IND_DEVICE_RESET 0x04000000 +#define I2O_EVT_IND_EVT_MASK_MODIFIED 0x02000000 +#define I2O_EVT_IND_FIELD_MODIFIED 0x01000000 +#define I2O_EVT_IND_VENDOR_EVT 0x00800000 +#define I2O_EVT_IND_DEVICE_STATE 0x00400000 + +/* Executive event indicitors */ +#define I2O_EVT_IND_EXEC_RESOURCE_LIMITS 0x00000001 +#define I2O_EVT_IND_EXEC_CONNECTION_FAIL 0x00000002 +#define I2O_EVT_IND_EXEC_ADAPTER_FAULT 0x00000004 +#define I2O_EVT_IND_EXEC_POWER_FAIL 0x00000008 +#define I2O_EVT_IND_EXEC_RESET_PENDING 0x00000010 +#define I2O_EVT_IND_EXEC_RESET_IMMINENT 0x00000020 +#define I2O_EVT_IND_EXEC_HW_FAIL 0x00000040 +#define I2O_EVT_IND_EXEC_XCT_CHANGE 0x00000080 +#define I2O_EVT_IND_EXEC_NEW_LCT_ENTRY 0x00000100 +#define I2O_EVT_IND_EXEC_MODIFIED_LCT 0x00000200 +#define I2O_EVT_IND_EXEC_DDM_AVAILABILITY 0x00000400 + +/* Random Block Storage Event Indicators */ +#define I2O_EVT_IND_BSA_VOLUME_LOAD 0x00000001 +#define I2O_EVT_IND_BSA_VOLUME_UNLOAD 0x00000002 +#define I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ 0x00000004 +#define I2O_EVT_IND_BSA_CAPACITY_CHANGE 0x00000008 +#define I2O_EVT_IND_BSA_SCSI_SMART 0x00000010 + +/* Event data for generic events */ +#define I2O_EVT_STATE_CHANGE_NORMAL 0x00 +#define I2O_EVT_STATE_CHANGE_SUSPENDED 0x01 +#define I2O_EVT_STATE_CHANGE_RESTART 0x02 +#define I2O_EVT_STATE_CHANGE_NA_RECOVER 0x03 +#define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER 0x04 +#define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST 0x05 +#define I2O_EVT_STATE_CHANGE_FAILED 0x10 +#define I2O_EVT_STATE_CHANGE_FAULTED 0x11 + +#define I2O_EVT_GEN_WARNING_NORMAL 0x00 +#define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01 +#define I2O_EVT_GEN_WARNING_MEDIA_FAULT 0x02 + +#define I2O_EVT_CAPABILITY_OTHER 0x01 +#define I2O_EVT_CAPABILITY_CHANGED 0x02 + +#define I2O_EVT_SENSOR_STATE_CHANGED 0x01 + +/* + * I2O classes / subclasses + */ + +/* Class ID and Code Assignments + * (LCT.ClassID.Version field) + */ +#define I2O_CLASS_VERSION_10 0x00 +#define I2O_CLASS_VERSION_11 0x01 + +/* Class code names + * (from v1.5 Table 6-1 Class Code Assignments.) + */ + +#define I2O_CLASS_EXECUTIVE 0x000 +#define I2O_CLASS_DDM 0x001 +#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 +#define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 +#define I2O_CLASS_LAN 0x020 +#define I2O_CLASS_WAN 0x030 +#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 +#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 +#define I2O_CLASS_SCSI_PERIPHERAL 0x051 +#define I2O_CLASS_ATE_PORT 0x060 +#define I2O_CLASS_ATE_PERIPHERAL 0x061 +#define I2O_CLASS_FLOPPY_CONTROLLER 0x070 +#define I2O_CLASS_FLOPPY_DEVICE 0x071 +#define I2O_CLASS_BUS_ADAPTER 0x080 +#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 +#define I2O_CLASS_PEER_TRANSPORT 0x091 +#define I2O_CLASS_END 0xfff + +/* + * Rest of 0x092 - 0x09f reserved for peer-to-peer classes + */ + +#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff + +/* + * Subclasses + */ + +#define I2O_SUBCLASS_i960 0x001 +#define I2O_SUBCLASS_HDM 0x020 +#define I2O_SUBCLASS_ISM 0x021 + +/* Operation functions */ + +#define I2O_PARAMS_FIELD_GET 0x0001 +#define I2O_PARAMS_LIST_GET 0x0002 +#define I2O_PARAMS_MORE_GET 0x0003 +#define I2O_PARAMS_SIZE_GET 0x0004 +#define I2O_PARAMS_TABLE_GET 0x0005 +#define I2O_PARAMS_FIELD_SET 0x0006 +#define I2O_PARAMS_LIST_SET 0x0007 +#define I2O_PARAMS_ROW_ADD 0x0008 +#define I2O_PARAMS_ROW_DELETE 0x0009 +#define I2O_PARAMS_TABLE_CLEAR 0x000A + +/* + * I2O serial number conventions / formats + * (circa v1.5) + */ + +#define I2O_SNFORMAT_UNKNOWN 0 +#define I2O_SNFORMAT_BINARY 1 +#define I2O_SNFORMAT_ASCII 2 +#define I2O_SNFORMAT_UNICODE 3 +#define I2O_SNFORMAT_LAN48_MAC 4 +#define I2O_SNFORMAT_WAN 5 + +/* + * Plus new in v2.0 (Yellowstone pdf doc) + */ + +#define I2O_SNFORMAT_LAN64_MAC 6 +#define I2O_SNFORMAT_DDM 7 +#define I2O_SNFORMAT_IEEE_REG64 8 +#define I2O_SNFORMAT_IEEE_REG128 9 +#define I2O_SNFORMAT_UNKNOWN2 0xff + +/* + * I2O Get Status State values + */ + +#define ADAPTER_STATE_INITIALIZING 0x01 +#define ADAPTER_STATE_RESET 0x02 +#define ADAPTER_STATE_HOLD 0x04 +#define ADAPTER_STATE_READY 0x05 +#define ADAPTER_STATE_OPERATIONAL 0x08 +#define ADAPTER_STATE_FAILED 0x10 +#define ADAPTER_STATE_FAULTED 0x11 + +/* + * Software module types + */ +#define I2O_SOFTWARE_MODULE_IRTOS 0x11 +#define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22 +#define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23 + +/* + * Vendors + */ +#define I2O_VENDOR_DPT 0x001b + +/* + * DPT / Adaptec specific values for i2o_sg_io_hdr flags. + */ +#define I2O_DPT_SG_FLAG_INTERPRET 0x00010000 +#define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000 + +#define I2O_DPT_FLASH_FRAG_SIZE 0x10000 +#define I2O_DPT_FLASH_READ 0x0101 +#define I2O_DPT_FLASH_WRITE 0x0102 + +#endif /* _I2O_DEV_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i8k.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i8k.h new file mode 100644 index 0000000..1c45ba5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/i8k.h @@ -0,0 +1,46 @@ +/* + * i8k.h -- Linux driver for accessing the SMM BIOS on Dell laptops + * + * Copyright (C) 2001 Massimo Dal Zotto + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ + +#ifndef _LINUX_I8K_H +#define _LINUX_I8K_H + +#define I8K_PROC "/proc/i8k" +#define I8K_PROC_FMT "1.0" + +#define I8K_BIOS_VERSION _IOR ('i', 0x80, int) /* broken: meant 4 bytes */ +#define I8K_MACHINE_ID _IOR ('i', 0x81, int) /* broken: meant 16 bytes */ +#define I8K_POWER_STATUS _IOR ('i', 0x82, size_t) +#define I8K_FN_STATUS _IOR ('i', 0x83, size_t) +#define I8K_GET_TEMP _IOR ('i', 0x84, size_t) +#define I8K_GET_SPEED _IOWR('i', 0x85, size_t) +#define I8K_GET_FAN _IOWR('i', 0x86, size_t) +#define I8K_SET_FAN _IOWR('i', 0x87, size_t) + +#define I8K_FAN_LEFT 1 +#define I8K_FAN_RIGHT 0 +#define I8K_FAN_OFF 0 +#define I8K_FAN_LOW 1 +#define I8K_FAN_HIGH 2 +#define I8K_FAN_MAX I8K_FAN_HIGH + +#define I8K_VOL_UP 1 +#define I8K_VOL_DOWN 2 +#define I8K_VOL_MUTE 4 + +#define I8K_AC 1 +#define I8K_BATTERY 0 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/icmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/icmp.h new file mode 100644 index 0000000..9eedab5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/icmp.h @@ -0,0 +1,97 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the ICMP protocol. + * + * Version: @(#)icmp.h 1.0.3 04/28/93 + * + * Author: Fred N. van Kempen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_ICMP_H +#define _LINUX_ICMP_H + +#include + +#define ICMP_ECHOREPLY 0 /* Echo Reply */ +#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ +#define ICMP_SOURCE_QUENCH 4 /* Source Quench */ +#define ICMP_REDIRECT 5 /* Redirect (change route) */ +#define ICMP_ECHO 8 /* Echo Request */ +#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ +#define ICMP_PARAMETERPROB 12 /* Parameter Problem */ +#define ICMP_TIMESTAMP 13 /* Timestamp Request */ +#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ +#define ICMP_INFO_REQUEST 15 /* Information Request */ +#define ICMP_INFO_REPLY 16 /* Information Reply */ +#define ICMP_ADDRESS 17 /* Address Mask Request */ +#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ +#define NR_ICMP_TYPES 18 + + +/* Codes for UNREACH. */ +#define ICMP_NET_UNREACH 0 /* Network Unreachable */ +#define ICMP_HOST_UNREACH 1 /* Host Unreachable */ +#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ +#define ICMP_PORT_UNREACH 3 /* Port Unreachable */ +#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ +#define ICMP_SR_FAILED 5 /* Source Route failed */ +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 /* Packet filtered */ +#define ICMP_PREC_VIOLATION 14 /* Precedence violation */ +#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ +#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ + +/* Codes for REDIRECT. */ +#define ICMP_REDIR_NET 0 /* Redirect Net */ +#define ICMP_REDIR_HOST 1 /* Redirect Host */ +#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ +#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ + +/* Codes for TIME_EXCEEDED. */ +#define ICMP_EXC_TTL 0 /* TTL count exceeded */ +#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ + + +struct icmphdr { + __u8 type; + __u8 code; + __sum16 checksum; + union { + struct { + __be16 id; + __be16 sequence; + } echo; + __be32 gateway; + struct { + __be16 __unused; + __be16 mtu; + } frag; + } un; +}; + + +/* + * constants for (set|get)sockopt + */ + +#define ICMP_FILTER 1 + +struct icmp_filter { + __u32 data; +}; + + +#endif /* _LINUX_ICMP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/icmpv6.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/icmpv6.h new file mode 100644 index 0000000..5093dfc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/icmpv6.h @@ -0,0 +1,164 @@ +#ifndef _LINUX_ICMPV6_H +#define _LINUX_ICMPV6_H + +#include +#include + +struct icmp6hdr { + + __u8 icmp6_type; + __u8 icmp6_code; + __sum16 icmp6_cksum; + + + union { + __be32 un_data32[1]; + __be16 un_data16[2]; + __u8 un_data8[4]; + + struct icmpv6_echo { + __be16 identifier; + __be16 sequence; + } u_echo; + + struct icmpv6_nd_advt { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u32 reserved:5, + override:1, + solicited:1, + router:1, + reserved2:24; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u32 router:1, + solicited:1, + override:1, + reserved:29; +#else +#error "Please fix " +#endif + } u_nd_advt; + + struct icmpv6_nd_ra { + __u8 hop_limit; +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 reserved:3, + router_pref:2, + home_agent:1, + other:1, + managed:1; + +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 managed:1, + other:1, + home_agent:1, + router_pref:2, + reserved:3; +#else +#error "Please fix " +#endif + __be16 rt_lifetime; + } u_nd_ra; + + } icmp6_dataun; + +#define icmp6_identifier icmp6_dataun.u_echo.identifier +#define icmp6_sequence icmp6_dataun.u_echo.sequence +#define icmp6_pointer icmp6_dataun.un_data32[0] +#define icmp6_mtu icmp6_dataun.un_data32[0] +#define icmp6_unused icmp6_dataun.un_data32[0] +#define icmp6_maxdelay icmp6_dataun.un_data16[0] +#define icmp6_router icmp6_dataun.u_nd_advt.router +#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited +#define icmp6_override icmp6_dataun.u_nd_advt.override +#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved +#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit +#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed +#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other +#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime +#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref +}; + + +#define ICMPV6_ROUTER_PREF_LOW 0x3 +#define ICMPV6_ROUTER_PREF_MEDIUM 0x0 +#define ICMPV6_ROUTER_PREF_HIGH 0x1 +#define ICMPV6_ROUTER_PREF_INVALID 0x2 + +#define ICMPV6_DEST_UNREACH 1 +#define ICMPV6_PKT_TOOBIG 2 +#define ICMPV6_TIME_EXCEED 3 +#define ICMPV6_PARAMPROB 4 + +#define ICMPV6_INFOMSG_MASK 0x80 + +#define ICMPV6_ECHO_REQUEST 128 +#define ICMPV6_ECHO_REPLY 129 +#define ICMPV6_MGM_QUERY 130 +#define ICMPV6_MGM_REPORT 131 +#define ICMPV6_MGM_REDUCTION 132 + +#define ICMPV6_NI_QUERY 139 +#define ICMPV6_NI_REPLY 140 + +#define ICMPV6_MLD2_REPORT 143 + +#define ICMPV6_DHAAD_REQUEST 144 +#define ICMPV6_DHAAD_REPLY 145 +#define ICMPV6_MOBILE_PREFIX_SOL 146 +#define ICMPV6_MOBILE_PREFIX_ADV 147 + +/* + * Codes for Destination Unreachable + */ +#define ICMPV6_NOROUTE 0 +#define ICMPV6_ADM_PROHIBITED 1 +#define ICMPV6_NOT_NEIGHBOUR 2 +#define ICMPV6_ADDR_UNREACH 3 +#define ICMPV6_PORT_UNREACH 4 + +/* + * Codes for Time Exceeded + */ +#define ICMPV6_EXC_HOPLIMIT 0 +#define ICMPV6_EXC_FRAGTIME 1 + +/* + * Codes for Parameter Problem + */ +#define ICMPV6_HDR_FIELD 0 +#define ICMPV6_UNK_NEXTHDR 1 +#define ICMPV6_UNK_OPTION 2 + +/* + * constants for (set|get)sockopt + */ + +#define ICMPV6_FILTER 1 + +/* + * ICMPV6 filter + */ + +#define ICMPV6_FILTER_BLOCK 1 +#define ICMPV6_FILTER_PASS 2 +#define ICMPV6_FILTER_BLOCKOTHERS 3 +#define ICMPV6_FILTER_PASSONLY 4 + +struct icmp6_filter { + __u32 data[8]; +}; + +/* + * Definitions for MLDv2 + */ +#define MLD2_MODE_IS_INCLUDE 1 +#define MLD2_MODE_IS_EXCLUDE 2 +#define MLD2_CHANGE_TO_INCLUDE 3 +#define MLD2_CHANGE_TO_EXCLUDE 4 +#define MLD2_ALLOW_NEW_SOURCES 5 +#define MLD2_BLOCK_OLD_SOURCES 6 + +#define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if.h new file mode 100644 index 0000000..bc9b122 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if.h @@ -0,0 +1,223 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the INET interface module. + * + * Version: @(#)if.h 1.0.2 04/18/93 + * + * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988 + * Ross Biro + * Fred N. van Kempen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_IF_H +#define _LINUX_IF_H + +#include /* for "__kernel_caddr_t" et al */ +#include /* for "struct sockaddr" et al */ + /* for "__user" et al */ + +#define IFNAMSIZ 16 +#define IFALIASZ 256 +#include + +/* Standard interface flags (netdevice->flags). */ +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ +#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ +#define IFF_RUNNING 0x40 /* interface RFC2863 OPER_UP */ +#define IFF_NOARP 0x80 /* no ARP protocol */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ + +#define IFF_MASTER 0x400 /* master of a load balancer */ +#define IFF_SLAVE 0x800 /* slave of a load balancer */ + +#define IFF_MULTICAST 0x1000 /* Supports multicast */ + +#define IFF_PORTSEL 0x2000 /* can set media type */ +#define IFF_AUTOMEDIA 0x4000 /* auto media select active */ +#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ + +#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ +#define IFF_DORMANT 0x20000 /* driver signals dormant */ + +#define IFF_ECHO 0x40000 /* echo sent packets */ + +#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ + IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) + +/* Private (from user) interface flags (netdevice->priv_flags). */ +#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */ +#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */ +#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ +#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ +#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ +#define IFF_BONDING 0x20 /* bonding master or slave */ +#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ +#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ +#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */ +#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */ + +#define IF_GET_IFACE 0x0001 /* for querying only */ +#define IF_GET_PROTO 0x0002 + +/* For definitions see hdlc.h */ +#define IF_IFACE_V35 0x1000 /* V.35 serial interface */ +#define IF_IFACE_V24 0x1001 /* V.24 serial interface */ +#define IF_IFACE_X21 0x1002 /* X.21 serial interface */ +#define IF_IFACE_T1 0x1003 /* T1 telco serial interface */ +#define IF_IFACE_E1 0x1004 /* E1 telco serial interface */ +#define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */ +#define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */ + +/* For definitions see hdlc.h */ +#define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */ +#define IF_PROTO_PPP 0x2001 /* PPP protocol */ +#define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */ +#define IF_PROTO_FR 0x2003 /* Frame Relay protocol */ +#define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */ +#define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */ +#define IF_PROTO_X25 0x2006 /* X.25 */ +#define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */ +#define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */ +#define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */ +#define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */ +#define IF_PROTO_FR_ETH_PVC 0x200B +#define IF_PROTO_RAW 0x200C /* RAW Socket */ + +/* RFC 2863 operational status */ +enum { + IF_OPER_UNKNOWN, + IF_OPER_NOTPRESENT, + IF_OPER_DOWN, + IF_OPER_LOWERLAYERDOWN, + IF_OPER_TESTING, + IF_OPER_DORMANT, + IF_OPER_UP, +}; + +/* link modes */ +enum { + IF_LINK_MODE_DEFAULT, + IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ +}; + +/* + * Device mapping structure. I'd just gone off and designed a + * beautiful scheme using only loadable modules with arguments + * for driver options and along come the PCMCIA people 8) + * + * Ah well. The get() side of this is good for WDSETUP, and it'll + * be handy for debugging things. The set side is fine for now and + * being very small might be worth keeping for clean configuration. + */ + +struct ifmap +{ + unsigned long mem_start; + unsigned long mem_end; + unsigned short base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; + /* 3 bytes spare */ +}; + +struct if_settings +{ + unsigned int type; /* Type of physical device or protocol */ + unsigned int size; /* Size of the data allocated by the caller */ + union { + /* {atm/eth/dsl}_settings anyone ? */ + raw_hdlc_proto *raw_hdlc; + cisco_proto *cisco; + fr_proto *fr; + fr_proto_pvc *fr_pvc; + fr_proto_pvc_info *fr_pvc_info; + + /* interface settings */ + sync_serial_settings *sync; + te1_settings *te1; + } ifs_ifsu; +}; + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ + +struct ifreq +{ +#define IFHWADDRLEN 6 + union + { + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + } ifr_ifrn; + + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short ifru_flags; + int ifru_ivalue; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; /* Just fits the size */ + char ifru_newname[IFNAMSIZ]; + void * ifru_data; + struct if_settings ifru_settings; + } ifr_ifru; +}; + +#define ifr_name ifr_ifrn.ifrn_name /* interface name */ +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_metric ifr_ifru.ifru_ivalue /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_map ifr_ifru.ifru_map /* device map */ +#define ifr_slave ifr_ifru.ifru_slave /* slave device */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ +#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ +#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ +#define ifr_newname ifr_ifru.ifru_newname /* New name */ +#define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ + +struct ifconf +{ + int ifc_len; /* size of buffer */ + union + { + char *ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +}; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures */ + +#endif /* _LINUX_IF_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_addr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_addr.h new file mode 100644 index 0000000..08ea980 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_addr.h @@ -0,0 +1,61 @@ +#ifndef __LINUX_IF_ADDR_H +#define __LINUX_IF_ADDR_H + +#include +#include + +struct ifaddrmsg +{ + __u8 ifa_family; + __u8 ifa_prefixlen; /* The prefix length */ + __u8 ifa_flags; /* Flags */ + __u8 ifa_scope; /* Address scope */ + __u32 ifa_index; /* Link index */ +}; + +/* + * Important comment: + * IFA_ADDRESS is prefix address, rather than local interface address. + * It makes no difference for normally configured broadcast interfaces, + * but for point-to-point IFA_ADDRESS is DESTINATION address, + * local address is supplied in IFA_LOCAL attribute. + */ +enum +{ + IFA_UNSPEC, + IFA_ADDRESS, + IFA_LOCAL, + IFA_LABEL, + IFA_BROADCAST, + IFA_ANYCAST, + IFA_CACHEINFO, + IFA_MULTICAST, + __IFA_MAX, +}; + +#define IFA_MAX (__IFA_MAX - 1) + +/* ifa_flags */ +#define IFA_F_SECONDARY 0x01 +#define IFA_F_TEMPORARY IFA_F_SECONDARY + +#define IFA_F_NODAD 0x02 +#define IFA_F_OPTIMISTIC 0x04 +#define IFA_F_HOMEADDRESS 0x10 +#define IFA_F_DEPRECATED 0x20 +#define IFA_F_TENTATIVE 0x40 +#define IFA_F_PERMANENT 0x80 + +struct ifa_cacheinfo +{ + __u32 ifa_prefered; + __u32 ifa_valid; + __u32 cstamp; /* created timestamp, hundredths of seconds */ + __u32 tstamp; /* updated timestamp, hundredths of seconds */ +}; + +/* backwards compatibility for userspace */ +#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) +#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_addrlabel.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_addrlabel.h new file mode 100644 index 0000000..89571f6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_addrlabel.h @@ -0,0 +1,34 @@ +/* + * if_addrlabel.h - netlink interface for address labels + * + * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. + * + * Authors: + * YOSHIFUJI Hideaki @ USAGI/WIDE + */ + +#ifndef __LINUX_IF_ADDRLABEL_H +#define __LINUX_IF_ADDRLABEL_H + +#include + +struct ifaddrlblmsg +{ + __u8 ifal_family; /* Address family */ + __u8 __ifal_reserved; /* Reserved */ + __u8 ifal_prefixlen; /* Prefix length */ + __u8 ifal_flags; /* Flags */ + __u32 ifal_index; /* Link index */ + __u32 ifal_seq; /* sequence number */ +}; + +enum +{ + IFAL_ADDRESS = 1, + IFAL_LABEL = 2, + __IFAL_MAX +}; + +#define IFAL_MAX (__IFAL_MAX - 1) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_arcnet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_arcnet.h new file mode 100644 index 0000000..0835deb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_arcnet.h @@ -0,0 +1,138 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the ARCnet interface. + * + * Authors: David Woodhouse and Avery Pennarun + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IF_ARCNET_H +#define _LINUX_IF_ARCNET_H + +#include +#include + + +/* + * These are the defined ARCnet Protocol ID's. + */ + +/* CAP mode */ +/* No macro but uses 1-8 */ + +/* RFC1201 Protocol ID's */ +#define ARC_P_IP 212 /* 0xD4 */ +#define ARC_P_IPV6 196 /* 0xC4: RFC2497 */ +#define ARC_P_ARP 213 /* 0xD5 */ +#define ARC_P_RARP 214 /* 0xD6 */ +#define ARC_P_IPX 250 /* 0xFA */ +#define ARC_P_NOVELL_EC 236 /* 0xEC */ + +/* Old RFC1051 Protocol ID's */ +#define ARC_P_IP_RFC1051 240 /* 0xF0 */ +#define ARC_P_ARP_RFC1051 241 /* 0xF1 */ + +/* MS LanMan/WfWg "NDIS" encapsulation */ +#define ARC_P_ETHER 232 /* 0xE8 */ + +/* Unsupported/indirectly supported protocols */ +#define ARC_P_DATAPOINT_BOOT 0 /* very old Datapoint equipment */ +#define ARC_P_DATAPOINT_MOUNT 1 +#define ARC_P_POWERLAN_BEACON 8 /* Probably ATA-Netbios related */ +#define ARC_P_POWERLAN_BEACON2 243 /* 0xF3 */ +#define ARC_P_LANSOFT 251 /* 0xFB - what is this? */ +#define ARC_P_ATALK 0xDD + +/* Hardware address length */ +#define ARCNET_ALEN 1 + +/* + * The RFC1201-specific components of an arcnet packet header. + */ +struct arc_rfc1201 +{ + __u8 proto; /* protocol ID field - varies */ + __u8 split_flag; /* for use with split packets */ + __be16 sequence; /* sequence number */ + __u8 payload[0]; /* space remaining in packet (504 bytes)*/ +}; +#define RFC1201_HDR_SIZE 4 + + +/* + * The RFC1051-specific components. + */ +struct arc_rfc1051 +{ + __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */ + __u8 payload[0]; /* 507 bytes */ +}; +#define RFC1051_HDR_SIZE 1 + + +/* + * The ethernet-encap-specific components. We have a real ethernet header + * and some data. + */ +struct arc_eth_encap +{ + __u8 proto; /* Always ARC_P_ETHER */ + struct ethhdr eth; /* standard ethernet header (yuck!) */ + __u8 payload[0]; /* 493 bytes */ +}; +#define ETH_ENCAP_HDR_SIZE 14 + + +struct arc_cap +{ + __u8 proto; + __u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */ + union { + __u8 ack; + __u8 raw[0]; /* 507 bytes */ + } mes; +}; + +/* + * The data needed by the actual arcnet hardware. + * + * Now, in the real arcnet hardware, the third and fourth bytes are the + * 'offset' specification instead of the length, and the soft data is at + * the _end_ of the 512-byte buffer. We hide this complexity inside the + * driver. + */ +struct arc_hardware +{ + __u8 source, /* source ARCnet - filled in automagically */ + dest, /* destination ARCnet - 0 for broadcast */ + offset[2]; /* offset bytes (some weird semantics) */ +}; +#define ARC_HDR_SIZE 4 + +/* + * This is an ARCnet frame header, as seen by the kernel (and userspace, + * when you do a raw packet capture). + */ +struct archdr +{ + /* hardware requirements */ + struct arc_hardware hard; + + /* arcnet encapsulation-specific bits */ + union { + struct arc_rfc1201 rfc1201; + struct arc_rfc1051 rfc1051; + struct arc_eth_encap eth_encap; + struct arc_cap cap; + __u8 raw[0]; /* 508 bytes */ + } soft; +}; + +#endif /* _LINUX_IF_ARCNET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_arp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_arp.h new file mode 100644 index 0000000..7dff666 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_arp.h @@ -0,0 +1,156 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the ARP (RFC 826) protocol. + * + * Version: @(#)if_arp.h 1.0.1 04/16/93 + * + * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 + * Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source. + * Ross Biro + * Fred N. van Kempen, + * Florian La Roche, + * Jonathan Layes + * Arnaldo Carvalho de Melo ARPHRD_HWX25 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_IF_ARP_H +#define _LINUX_IF_ARP_H + +#include + +/* ARP protocol HARDWARE identifiers. */ +#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ +#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ +#define ARPHRD_EETHER 2 /* Experimental Ethernet */ +#define ARPHRD_AX25 3 /* AX.25 Level 2 */ +#define ARPHRD_PRONET 4 /* PROnet token ring */ +#define ARPHRD_CHAOS 5 /* Chaosnet */ +#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ +#define ARPHRD_ARCNET 7 /* ARCnet */ +#define ARPHRD_APPLETLK 8 /* APPLEtalk */ +#define ARPHRD_DLCI 15 /* Frame Relay DLCI */ +#define ARPHRD_ATM 19 /* ATM */ +#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ +#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */ +#define ARPHRD_EUI64 27 /* EUI-64 */ +#define ARPHRD_INFINIBAND 32 /* InfiniBand */ + +/* Dummy types for non ARP hardware */ +#define ARPHRD_SLIP 256 +#define ARPHRD_CSLIP 257 +#define ARPHRD_SLIP6 258 +#define ARPHRD_CSLIP6 259 +#define ARPHRD_RSRVD 260 /* Notional KISS type */ +#define ARPHRD_ADAPT 264 +#define ARPHRD_ROSE 270 +#define ARPHRD_X25 271 /* CCITT X.25 */ +#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ +#define ARPHRD_CAN 280 /* Controller Area Network */ +#define ARPHRD_PPP 512 +#define ARPHRD_CISCO 513 /* Cisco HDLC */ +#define ARPHRD_HDLC ARPHRD_CISCO +#define ARPHRD_LAPB 516 /* LAPB */ +#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */ +#define ARPHRD_RAWHDLC 518 /* Raw HDLC */ + +#define ARPHRD_TUNNEL 768 /* IPIP tunnel */ +#define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */ +#define ARPHRD_FRAD 770 /* Frame Relay Access Device */ +#define ARPHRD_SKIP 771 /* SKIP vif */ +#define ARPHRD_LOOPBACK 772 /* Loopback device */ +#define ARPHRD_LOCALTLK 773 /* Localtalk device */ +#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */ +#define ARPHRD_BIF 775 /* AP1000 BIF */ +#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */ +#define ARPHRD_IPDDP 777 /* IP over DDP tunneller */ +#define ARPHRD_IPGRE 778 /* GRE over IP */ +#define ARPHRD_PIMREG 779 /* PIMSM register interface */ +#define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */ +#define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */ +#define ARPHRD_ECONET 782 /* Acorn Econet */ +#define ARPHRD_IRDA 783 /* Linux-IrDA */ +/* ARP works differently on different FC media .. so */ +#define ARPHRD_FCPP 784 /* Point to point fibrechannel */ +#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */ +#define ARPHRD_FCPL 786 /* Fibrechannel public loop */ +#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ + /* 787->799 reserved for fibrechannel media types */ +#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ +#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ +#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ +#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ + +#define ARPHRD_PHONET 820 /* PhoNet media type */ +#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ + +#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ +#define ARPHRD_NONE 0xFFFE /* zero header length */ + +/* ARP protocol opcodes. */ +#define ARPOP_REQUEST 1 /* ARP request */ +#define ARPOP_REPLY 2 /* ARP reply */ +#define ARPOP_RREQUEST 3 /* RARP request */ +#define ARPOP_RREPLY 4 /* RARP reply */ +#define ARPOP_InREQUEST 8 /* InARP request */ +#define ARPOP_InREPLY 9 /* InARP reply */ +#define ARPOP_NAK 10 /* (ATM)ARP NAK */ + + +/* ARP ioctl request. */ +struct arpreq { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ + struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ + char arp_dev[16]; +}; + +struct arpreq_old { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ + struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ +}; + +/* ARP Flag values. */ +#define ATF_COM 0x02 /* completed entry (ha valid) */ +#define ATF_PERM 0x04 /* permanent entry */ +#define ATF_PUBL 0x08 /* publish entry */ +#define ATF_USETRAILERS 0x10 /* has requested trailers */ +#define ATF_NETMASK 0x20 /* want to use a netmask (only + for proxy entries) */ +#define ATF_DONTPUB 0x40 /* don't answer this addresses */ + +/* + * This structure defines an ethernet arp header. + */ + +struct arphdr +{ + __be16 ar_hrd; /* format of hardware address */ + __be16 ar_pro; /* format of protocol address */ + unsigned char ar_hln; /* length of hardware address */ + unsigned char ar_pln; /* length of protocol address */ + __be16 ar_op; /* ARP opcode (command) */ + +#if 0 + /* + * Ethernet looks like this : This bit is variable sized however... + */ + unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ + unsigned char ar_sip[4]; /* sender IP address */ + unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ + unsigned char ar_tip[4]; /* target IP address */ +#endif + +}; + + +#endif /* _LINUX_IF_ARP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_bonding.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_bonding.h new file mode 100644 index 0000000..65c2d24 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_bonding.h @@ -0,0 +1,125 @@ +/* + * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. + * + * + * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes + * NCM: Network and Communications Management, Inc. + * + * BUT, I'm the one who modified it for ethernet, so: + * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov + * + * This software may be used and distributed according to the terms + * of the GNU Public License, incorporated herein by reference. + * + * 2003/03/18 - Amir Noam + * - Added support for getting slave's speed and duplex via ethtool. + * Needed for 802.3ad and other future modes. + * + * 2003/03/18 - Tsippy Mendelson and + * Shmulik Hen + * - Enable support of modes that need to use the unique mac address of + * each slave. + * + * 2003/03/18 - Tsippy Mendelson and + * Amir Noam + * - Moved driver's private data types to bonding.h + * + * 2003/03/18 - Amir Noam , + * Tsippy Mendelson and + * Shmulik Hen + * - Added support for IEEE 802.3ad Dynamic link aggregation mode. + * + * 2003/05/01 - Amir Noam + * - Added ABI version control to restore compatibility between + * new/old ifenslave and new/old bonding. + * + * 2003/12/01 - Shmulik Hen + * - Code cleanup and style changes + * + * 2005/05/05 - Jason Gabler + * - added definitions for various XOR hashing policies + */ + +#ifndef _LINUX_IF_BONDING_H +#define _LINUX_IF_BONDING_H + +#include +#include +#include + +/* userland - kernel ABI version (2003/05/08) */ +#define BOND_ABI_VERSION 2 + +/* + * We can remove these ioctl definitions in 2.5. People should use the + * SIOC*** versions of them instead + */ +#define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE) +#define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1) +#define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2) +#define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11) +#define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12) +#define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13) + +#define BOND_CHECK_MII_STATUS (SIOCGMIIPHY) + +#define BOND_MODE_ROUNDROBIN 0 +#define BOND_MODE_ACTIVEBACKUP 1 +#define BOND_MODE_XOR 2 +#define BOND_MODE_BROADCAST 3 +#define BOND_MODE_8023AD 4 +#define BOND_MODE_TLB 5 +#define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ + +/* each slave's link has 4 states */ +#define BOND_LINK_UP 0 /* link is up and running */ +#define BOND_LINK_FAIL 1 /* link has just gone down */ +#define BOND_LINK_DOWN 2 /* link has been down for too long time */ +#define BOND_LINK_BACK 3 /* link is going back */ + +/* each slave has several states */ +#define BOND_STATE_ACTIVE 0 /* link is active */ +#define BOND_STATE_BACKUP 1 /* link is backup */ + +#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ + +/* hashing types */ +#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ +#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ +#define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */ + +typedef struct ifbond { + __s32 bond_mode; + __s32 num_slaves; + __s32 miimon; +} ifbond; + +typedef struct ifslave +{ + __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ + char slave_name[IFNAMSIZ]; + __s8 link; + __s8 state; + __u32 link_failure_count; +} ifslave; + +struct ad_info { + __u16 aggregator_id; + __u16 ports; + __u16 actor_key; + __u16 partner_key; + __u8 partner_system[ETH_ALEN]; +}; + +#endif /* _LINUX_IF_BONDING_H */ + +/* + * Local variables: + * version-control: t + * kept-new-versions: 5 + * c-indent-level: 8 + * c-basic-offset: 8 + * tab-width: 8 + * End: + */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_bridge.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_bridge.h new file mode 100644 index 0000000..8458963 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_bridge.h @@ -0,0 +1,104 @@ +/* + * Linux ethernet bridge + * + * Authors: + * Lennert Buytenhek + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IF_BRIDGE_H +#define _LINUX_IF_BRIDGE_H + +#include + +#define SYSFS_BRIDGE_ATTR "bridge" +#define SYSFS_BRIDGE_FDB "brforward" +#define SYSFS_BRIDGE_PORT_SUBDIR "brif" +#define SYSFS_BRIDGE_PORT_ATTR "brport" +#define SYSFS_BRIDGE_PORT_LINK "bridge" + +#define BRCTL_VERSION 1 + +#define BRCTL_GET_VERSION 0 +#define BRCTL_GET_BRIDGES 1 +#define BRCTL_ADD_BRIDGE 2 +#define BRCTL_DEL_BRIDGE 3 +#define BRCTL_ADD_IF 4 +#define BRCTL_DEL_IF 5 +#define BRCTL_GET_BRIDGE_INFO 6 +#define BRCTL_GET_PORT_LIST 7 +#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8 +#define BRCTL_SET_BRIDGE_HELLO_TIME 9 +#define BRCTL_SET_BRIDGE_MAX_AGE 10 +#define BRCTL_SET_AGEING_TIME 11 +#define BRCTL_SET_GC_INTERVAL 12 +#define BRCTL_GET_PORT_INFO 13 +#define BRCTL_SET_BRIDGE_STP_STATE 14 +#define BRCTL_SET_BRIDGE_PRIORITY 15 +#define BRCTL_SET_PORT_PRIORITY 16 +#define BRCTL_SET_PATH_COST 17 +#define BRCTL_GET_FDB_ENTRIES 18 + +#define BR_STATE_DISABLED 0 +#define BR_STATE_LISTENING 1 +#define BR_STATE_LEARNING 2 +#define BR_STATE_FORWARDING 3 +#define BR_STATE_BLOCKING 4 + +struct __bridge_info +{ + __u64 designated_root; + __u64 bridge_id; + __u32 root_path_cost; + __u32 max_age; + __u32 hello_time; + __u32 forward_delay; + __u32 bridge_max_age; + __u32 bridge_hello_time; + __u32 bridge_forward_delay; + __u8 topology_change; + __u8 topology_change_detected; + __u8 root_port; + __u8 stp_enabled; + __u32 ageing_time; + __u32 gc_interval; + __u32 hello_timer_value; + __u32 tcn_timer_value; + __u32 topology_change_timer_value; + __u32 gc_timer_value; +}; + +struct __port_info +{ + __u64 designated_root; + __u64 designated_bridge; + __u16 port_id; + __u16 designated_port; + __u32 path_cost; + __u32 designated_cost; + __u8 state; + __u8 top_change_ack; + __u8 config_pending; + __u8 unused0; + __u32 message_age_timer_value; + __u32 forward_delay_timer_value; + __u32 hold_timer_value; +}; + +struct __fdb_entry +{ + __u8 mac_addr[6]; + __u8 port_no; + __u8 is_local; + __u32 ageing_timer_value; + __u8 port_hi; + __u8 pad0; + __u16 unused; +}; + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_cablemodem.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_cablemodem.h new file mode 100644 index 0000000..9ca1007 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_cablemodem.h @@ -0,0 +1,22 @@ +#ifndef _LINUX_CABLEMODEM_H_ +#define _LINUX_CABLEMODEM_H_ +/* + * Author: Franco Venturi + * Copyright 1998 Franco Venturi + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at + * your option) any later version. + */ + +/* some useful defines for sb1000.c e cmconfig.c - fv */ +#define SIOCGCMSTATS SIOCDEVPRIVATE+0 /* get cable modem stats */ +#define SIOCGCMFIRMWARE SIOCDEVPRIVATE+1 /* get cm firmware version */ +#define SIOCGCMFREQUENCY SIOCDEVPRIVATE+2 /* get cable modem frequency */ +#define SIOCSCMFREQUENCY SIOCDEVPRIVATE+3 /* set cable modem frequency */ +#define SIOCGCMPIDS SIOCDEVPRIVATE+4 /* get cable modem PIDs */ +#define SIOCSCMPIDS SIOCDEVPRIVATE+5 /* set cable modem PIDs */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ec.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ec.h new file mode 100644 index 0000000..a8b81f8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ec.h @@ -0,0 +1,36 @@ +/* Definitions for Econet sockets. */ + +#ifndef __LINUX_IF_EC +#define __LINUX_IF_EC + +/* User visible stuff. Glibc provides its own but libc5 folk will use these */ + +struct ec_addr +{ + unsigned char station; /* Station number. */ + unsigned char net; /* Network number. */ +}; + +struct sockaddr_ec +{ + unsigned short sec_family; + unsigned char port; /* Port number. */ + unsigned char cb; /* Control/flag byte. */ + unsigned char type; /* Type of message. */ + struct ec_addr addr; + unsigned long cookie; +}; + +#define ECTYPE_PACKET_RECEIVED 0 /* Packet received */ +#define ECTYPE_TRANSMIT_STATUS 0x10 /* Transmit completed, + low nibble holds status */ + +#define ECTYPE_TRANSMIT_OK 1 +#define ECTYPE_TRANSMIT_NOT_LISTENING 2 +#define ECTYPE_TRANSMIT_NET_ERROR 3 +#define ECTYPE_TRANSMIT_NO_CLOCK 4 +#define ECTYPE_TRANSMIT_LINE_JAMMED 5 +#define ECTYPE_TRANSMIT_NOT_PRESENT 6 + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_eql.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_eql.h new file mode 100644 index 0000000..c0b94ec --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_eql.h @@ -0,0 +1,54 @@ +/* + * Equalizer Load-balancer for serial network interfaces. + * + * (c) Copyright 1995 Simon "Guru Aleph-Null" Janes + * NCM: Network and Communications Management, Inc. + * + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + * The author may be reached as simon@ncm.com, or C/O + * NCM + * Attn: Simon Janes + * 6803 Whittier Ave + * McLean VA 22101 + * Phone: 1-703-847-0040 ext 103 + */ + +#ifndef _LINUX_IF_EQL_H +#define _LINUX_IF_EQL_H + +#define EQL_DEFAULT_SLAVE_PRIORITY 28800 +#define EQL_DEFAULT_MAX_SLAVES 4 +#define EQL_DEFAULT_MTU 576 +#define EQL_DEFAULT_RESCHED_IVAL 100 + +#define EQL_ENSLAVE (SIOCDEVPRIVATE) +#define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1) + +#define EQL_GETSLAVECFG (SIOCDEVPRIVATE + 2) +#define EQL_SETSLAVECFG (SIOCDEVPRIVATE + 3) + +#define EQL_GETMASTRCFG (SIOCDEVPRIVATE + 4) +#define EQL_SETMASTRCFG (SIOCDEVPRIVATE + 5) + + +typedef struct master_config { + char master_name[16]; + int max_slaves; + int min_slaves; +} master_config_t; + +typedef struct slave_config { + char slave_name[16]; + long priority; +} slave_config_t; + +typedef struct slaving_request { + char slave_name[16]; + long priority; +} slaving_request_t; + + +#endif /* _LINUX_EQL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ether.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ether.h new file mode 100644 index 0000000..dde027f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ether.h @@ -0,0 +1,121 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the Ethernet IEEE 802.3 interface. + * + * Version: @(#)if_ether.h 1.0.1a 02/08/94 + * + * Author: Fred N. van Kempen, + * Donald Becker, + * Alan Cox, + * Steve Whitehouse, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IF_ETHER_H +#define _LINUX_IF_ETHER_H + +#include + +/* + * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble + * and FCS/CRC (frame check sequence). + */ + +#define ETH_ALEN 6 /* Octets in one ethernet addr */ +#define ETH_HLEN 14 /* Total octets in header. */ +#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ +#define ETH_DATA_LEN 1500 /* Max. octets in payload */ +#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ +#define ETH_FCS_LEN 4 /* Octets in the FCS */ + +/* + * These are the defined Ethernet Protocol ID's. + */ + +#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ +#define ETH_P_PUP 0x0200 /* Xerox PUP packet */ +#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */ +#define ETH_P_IP 0x0800 /* Internet Protocol packet */ +#define ETH_P_X25 0x0805 /* CCITT X.25 */ +#define ETH_P_ARP 0x0806 /* Address Resolution packet */ +#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ +#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */ +#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */ +#define ETH_P_DEC 0x6000 /* DEC Assigned proto */ +#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ +#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ +#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */ +#define ETH_P_LAT 0x6004 /* DEC LAT */ +#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ +#define ETH_P_CUST 0x6006 /* DEC Customer use */ +#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ +#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ +#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ +#define ETH_P_ATALK 0x809B /* Appletalk DDP */ +#define ETH_P_AARP 0x80F3 /* Appletalk AARP */ +#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ +#define ETH_P_IPX 0x8137 /* IPX over DIX */ +#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ +#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */ +#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ +#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol + * defined in draft-wilson-wrec-wccp-v2-00.txt */ +#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ +#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ +#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ +#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ +#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ +#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport + * over Ethernet + */ +#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ +#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ +#define ETH_P_TIPC 0x88CA /* TIPC */ +#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ +#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ + +/* + * Non DIX types. Won't clash for 1500 types. + */ + +#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ +#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ +#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ +#define ETH_P_802_2 0x0004 /* 802.2 frames */ +#define ETH_P_SNAP 0x0005 /* Internal only */ +#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */ +#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ +#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ +#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ +#define ETH_P_CAN 0x000C /* Controller Area Network */ +#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ +#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ +#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ +#define ETH_P_CONTROL 0x0016 /* Card specific control frames */ +#define ETH_P_IRDA 0x0017 /* Linux-IrDA */ +#define ETH_P_ECONET 0x0018 /* Acorn Econet */ +#define ETH_P_HDLC 0x0019 /* HDLC frames */ +#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ +#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ +#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ +#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ + +/* + * This is an Ethernet frame header. + */ + +struct ethhdr { + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ + unsigned char h_source[ETH_ALEN]; /* source ether addr */ + __be16 h_proto; /* packet type ID field */ +} __attribute__((packed)); + + +#endif /* _LINUX_IF_ETHER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_fc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_fc.h new file mode 100644 index 0000000..6ed7f1b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_fc.h @@ -0,0 +1,51 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for Fibre Channel. + * + * Version: @(#)if_fc.h 0.0 11/20/98 + * + * Author: Fred N. van Kempen, + * Donald Becker, + * Peter De Schrijver, + * Vineet Abraham, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_IF_FC_H +#define _LINUX_IF_FC_H + +#include + +#define FC_ALEN 6 /* Octets in one ethernet addr */ +#define FC_HLEN (sizeof(struct fch_hdr)+sizeof(struct fcllc)) +#define FC_ID_LEN 3 /* Octets in a Fibre Channel Address */ + +/* LLC and SNAP constants */ +#define EXTENDED_SAP 0xAA +#define UI_CMD 0x03 + +/* This is NOT the Fibre Channel frame header. The FC frame header is + * constructed in the driver as the Tachyon needs certain fields in + * certains positions. So, it can't be generalized here.*/ + +struct fch_hdr { + __u8 daddr[FC_ALEN]; /* destination address */ + __u8 saddr[FC_ALEN]; /* source address */ +}; + +/* This is a Fibre Channel LLC structure */ +struct fcllc { + __u8 dsap; /* destination SAP */ + __u8 ssap; /* source SAP */ + __u8 llc; /* LLC control field */ + __u8 protid[3]; /* protocol id */ + __be16 ethertype; /* ether type field */ +}; + +#endif /* _LINUX_IF_FC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_fddi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_fddi.h new file mode 100644 index 0000000..be70f75 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_fddi.h @@ -0,0 +1,108 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the ANSI FDDI interface. + * + * Version: @(#)if_fddi.h 1.0.2 Sep 29 2004 + * + * Author: Lawrence V. Stefani, + * + * if_fddi.h is based on previous if_ether.h and if_tr.h work by + * Fred N. van Kempen, + * Donald Becker, + * Alan Cox, + * Steve Whitehouse, + * Peter De Schrijver, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_IF_FDDI_H +#define _LINUX_IF_FDDI_H + +#include + +/* + * Define max and min legal sizes. The frame sizes do not include + * 4 byte FCS/CRC (frame check sequence). + */ +#define FDDI_K_ALEN 6 /* Octets in one FDDI address */ +#define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */ +#define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */ +#define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans FCS */ +#define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans FCS */ +#define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */ +#define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */ +#define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */ +#define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */ + +/* Define FDDI Frame Control (FC) Byte values */ +#define FDDI_FC_K_VOID 0x00 +#define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80 +#define FDDI_FC_K_RESTRICTED_TOKEN 0xC0 +#define FDDI_FC_K_SMT_MIN 0x41 +#define FDDI_FC_K_SMT_MAX 0x4F +#define FDDI_FC_K_MAC_MIN 0xC1 +#define FDDI_FC_K_MAC_MAX 0xCF +#define FDDI_FC_K_ASYNC_LLC_MIN 0x50 +#define FDDI_FC_K_ASYNC_LLC_DEF 0x54 +#define FDDI_FC_K_ASYNC_LLC_MAX 0x5F +#define FDDI_FC_K_SYNC_LLC_MIN 0xD0 +#define FDDI_FC_K_SYNC_LLC_MAX 0xD7 +#define FDDI_FC_K_IMPLEMENTOR_MIN 0x60 +#define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F +#define FDDI_FC_K_RESERVED_MIN 0x70 +#define FDDI_FC_K_RESERVED_MAX 0x7F + +/* Define LLC and SNAP constants */ +#define FDDI_EXTENDED_SAP 0xAA +#define FDDI_UI_CMD 0x03 + +/* Define 802.2 Type 1 header */ +struct fddi_8022_1_hdr + { + __u8 dsap; /* destination service access point */ + __u8 ssap; /* source service access point */ + __u8 ctrl; /* control byte #1 */ + } __attribute__ ((packed)); + +/* Define 802.2 Type 2 header */ +struct fddi_8022_2_hdr + { + __u8 dsap; /* destination service access point */ + __u8 ssap; /* source service access point */ + __u8 ctrl_1; /* control byte #1 */ + __u8 ctrl_2; /* control byte #2 */ + } __attribute__ ((packed)); + +/* Define 802.2 SNAP header */ +#define FDDI_K_OUI_LEN 3 +struct fddi_snap_hdr + { + __u8 dsap; /* always 0xAA */ + __u8 ssap; /* always 0xAA */ + __u8 ctrl; /* always 0x03 */ + __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ + __be16 ethertype; /* packet type ID field */ + } __attribute__ ((packed)); + +/* Define FDDI LLC frame header */ +struct fddihdr + { + __u8 fc; /* frame control */ + __u8 daddr[FDDI_K_ALEN]; /* destination address */ + __u8 saddr[FDDI_K_ALEN]; /* source address */ + union + { + struct fddi_8022_1_hdr llc_8022_1; + struct fddi_8022_2_hdr llc_8022_2; + struct fddi_snap_hdr llc_snap; + } hdr; + } __attribute__ ((packed)); + + +#endif /* _LINUX_IF_FDDI_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_frad.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_frad.h new file mode 100644 index 0000000..0a4484b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_frad.h @@ -0,0 +1,127 @@ +/* + * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are + * created for each DLCI associated with a FRAD. The FRAD driver + * is not truly a network device, but the lower level device + * handler. This allows other FRAD manufacturers to use the DLCI + * code, including its RFC1490 encapsulation alongside the current + * implementation for the Sangoma cards. + * + * Version: @(#)if_ifrad.h 0.15 31 Mar 96 + * + * Author: Mike McLagan + * + * Changes: + * 0.15 Mike McLagan changed structure defs (packed) + * re-arranged flags + * added DLCI_RET vars + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _FRAD_H_ +#define _FRAD_H_ + +#include + +/* Structures and constants associated with the DLCI device driver */ + +struct dlci_add +{ + char devname[IFNAMSIZ]; + short dlci; +}; + +#define DLCI_GET_CONF (SIOCDEVPRIVATE + 2) +#define DLCI_SET_CONF (SIOCDEVPRIVATE + 3) + +/* + * These are related to the Sangoma SDLA and should remain in order. + * Code within the SDLA module is based on the specifics of this + * structure. Change at your own peril. + */ +struct dlci_conf { + short flags; + short CIR_fwd; + short Bc_fwd; + short Be_fwd; + short CIR_bwd; + short Bc_bwd; + short Be_bwd; + +/* these are part of the status read */ + short Tc_fwd; + short Tc_bwd; + short Tf_max; + short Tb_max; + +/* add any new fields here above is a mirror of sdla_dlci_conf */ +}; + +#define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4) + +/* configuration flags for DLCI */ +#define DLCI_IGNORE_CIR_OUT 0x0001 +#define DLCI_ACCOUNT_CIR_IN 0x0002 +#define DLCI_BUFFER_IF 0x0008 + +#define DLCI_VALID_FLAGS 0x000B + +/* FRAD driver uses these to indicate what it did with packet */ +#define DLCI_RET_OK 0x00 +#define DLCI_RET_ERR 0x01 +#define DLCI_RET_DROP 0x02 + +/* defines for the actual Frame Relay hardware */ +#define FRAD_GET_CONF (SIOCDEVPRIVATE) +#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) + +#define FRAD_LAST_IOCTL FRAD_SET_CONF + +/* + * Based on the setup for the Sangoma SDLA. If changes are + * necessary to this structure, a routine will need to be + * added to that module to copy fields. + */ +struct frad_conf +{ + short station; + short flags; + short kbaud; + short clocking; + short mtu; + short T391; + short T392; + short N391; + short N392; + short N393; + short CIR_fwd; + short Bc_fwd; + short Be_fwd; + short CIR_bwd; + short Bc_bwd; + short Be_bwd; + +/* Add new fields here, above is a mirror of the sdla_conf */ + +}; + +#define FRAD_STATION_CPE 0x0000 +#define FRAD_STATION_NODE 0x0001 + +#define FRAD_TX_IGNORE_CIR 0x0001 +#define FRAD_RX_ACCOUNT_CIR 0x0002 +#define FRAD_DROP_ABORTED 0x0004 +#define FRAD_BUFFERIF 0x0008 +#define FRAD_STATS 0x0010 +#define FRAD_MCI 0x0100 +#define FRAD_AUTODLCI 0x8000 +#define FRAD_VALID_FLAGS 0x811F + +#define FRAD_CLOCK_INT 0x0001 +#define FRAD_CLOCK_EXT 0x0000 + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_hippi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_hippi.h new file mode 100644 index 0000000..4a7c994 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_hippi.h @@ -0,0 +1,158 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the HIPPI interface. + * + * Version: @(#)if_hippi.h 1.0.0 05/26/97 + * + * Author: Fred N. van Kempen, + * Donald Becker, + * Alan Cox, + * Steve Whitehouse, + * Jes Sorensen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IF_HIPPI_H +#define _LINUX_IF_HIPPI_H + +#include +#include + +/* + * HIPPI magic constants. + */ + +#define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */ +#define HIPPI_HLEN sizeof(struct hippi_hdr) +#define HIPPI_ZLEN 0 /* Min. bytes in frame without FCS */ +#define HIPPI_DATA_LEN 65280 /* Max. bytes in payload */ +#define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN) + /* Max. bytes in frame without FCS */ + +/* + * Define LLC and SNAP constants. + */ +#define HIPPI_EXTENDED_SAP 0xAA +#define HIPPI_UI_CMD 0x03 + + +/* + * Do we need to list some sort of ID's here? + */ + +/* + * HIPPI statistics collection data. + */ + +struct hipnet_statistics +{ + int rx_packets; /* total packets received */ + int tx_packets; /* total packets transmitted */ + int rx_errors; /* bad packets received */ + int tx_errors; /* packet transmit problems */ + int rx_dropped; /* no space in linux buffers */ + int tx_dropped; /* no space available in linux */ + + /* detailed rx_errors: */ + int rx_length_errors; + int rx_over_errors; /* receiver ring buff overflow */ + int rx_crc_errors; /* recved pkt with crc error */ + int rx_frame_errors; /* recv'd frame alignment error */ + int rx_fifo_errors; /* recv'r fifo overrun */ + int rx_missed_errors; /* receiver missed packet */ + + /* detailed tx_errors */ + int tx_aborted_errors; + int tx_carrier_errors; + int tx_fifo_errors; + int tx_heartbeat_errors; + int tx_window_errors; +}; + + +struct hippi_fp_hdr +{ +#if 0 + __u8 ulp; /* must contain 4 */ +#if defined (__BIG_ENDIAN_BITFIELD) + __u8 d1_data_present:1; /* must be 1 */ + __u8 start_d2_burst_boundary:1; /* must be zero */ + __u8 reserved:6; /* must be zero */ +#if 0 + __u16 reserved1:5; + __u16 d1_area_size:8; /* must be 3 */ + __u16 d2_offset:3; /* must be zero */ +#endif +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 reserved:6; /* must be zero */ + __u8 start_d2_burst_boundary:1; /* must be zero */ + __u8 d1_data_present:1; /* must be 1 */ +#if 0 + __u16 d2_offset:3; /* must be zero */ + __u16 d1_area_size:8; /* must be 3 */ + __u16 reserved1:5; /* must be zero */ +#endif +#else +#error "Please fix " +#endif +#else + __be32 fixed; +#endif + __be32 d2_size; +} __attribute__ ((packed)); + +struct hippi_le_hdr +{ +#if defined (__BIG_ENDIAN_BITFIELD) + __u8 fc:3; + __u8 double_wide:1; + __u8 message_type:4; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 message_type:4; + __u8 double_wide:1; + __u8 fc:3; +#endif + __u8 dest_switch_addr[3]; +#if defined (__BIG_ENDIAN_BITFIELD) + __u8 dest_addr_type:4, + src_addr_type:4; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 src_addr_type:4, + dest_addr_type:4; +#endif + __u8 src_switch_addr[3]; + __u16 reserved; + __u8 daddr[HIPPI_ALEN]; + __u16 locally_administered; + __u8 saddr[HIPPI_ALEN]; +} __attribute__ ((packed)); + +#define HIPPI_OUI_LEN 3 +/* + * Looks like the dsap and ssap fields have been swapped by mistake in + * RFC 2067 "IP over HIPPI". + */ +struct hippi_snap_hdr +{ + __u8 dsap; /* always 0xAA */ + __u8 ssap; /* always 0xAA */ + __u8 ctrl; /* always 0x03 */ + __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ + __be16 ethertype; /* packet type ID field */ +} __attribute__ ((packed)); + +struct hippi_hdr +{ + struct hippi_fp_hdr fp; + struct hippi_le_hdr le; + struct hippi_snap_hdr snap; +} __attribute__ ((packed)); + +#endif /* _LINUX_IF_HIPPI_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_infiniband.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_infiniband.h new file mode 100644 index 0000000..3e659ec --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_infiniband.h @@ -0,0 +1,29 @@ +/* + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available at + * , or the OpenIB.org BSD + * license, available in the LICENSE.TXT file accompanying this + * software. These details are also available at + * . + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * $Id$ + */ + +#ifndef _LINUX_IF_INFINIBAND_H +#define _LINUX_IF_INFINIBAND_H + +#define INFINIBAND_ALEN 20 /* Octets in IPoIB HW addr */ + +#endif /* _LINUX_IF_INFINIBAND_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_link.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_link.h new file mode 100644 index 0000000..b0b9e8a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_link.h @@ -0,0 +1,191 @@ +#ifndef _LINUX_IF_LINK_H +#define _LINUX_IF_LINK_H + +#include +#include + +/* The struct should be in sync with struct net_device_stats */ +struct rtnl_link_stats +{ + __u32 rx_packets; /* total packets received */ + __u32 tx_packets; /* total packets transmitted */ + __u32 rx_bytes; /* total bytes received */ + __u32 tx_bytes; /* total bytes transmitted */ + __u32 rx_errors; /* bad packets received */ + __u32 tx_errors; /* packet transmit problems */ + __u32 rx_dropped; /* no space in linux buffers */ + __u32 tx_dropped; /* no space available in linux */ + __u32 multicast; /* multicast packets received */ + __u32 collisions; + + /* detailed rx_errors: */ + __u32 rx_length_errors; + __u32 rx_over_errors; /* receiver ring buff overflow */ + __u32 rx_crc_errors; /* recved pkt with crc error */ + __u32 rx_frame_errors; /* recv'd frame alignment error */ + __u32 rx_fifo_errors; /* recv'r fifo overrun */ + __u32 rx_missed_errors; /* receiver missed packet */ + + /* detailed tx_errors */ + __u32 tx_aborted_errors; + __u32 tx_carrier_errors; + __u32 tx_fifo_errors; + __u32 tx_heartbeat_errors; + __u32 tx_window_errors; + + /* for cslip etc */ + __u32 rx_compressed; + __u32 tx_compressed; +}; + +/* The struct should be in sync with struct ifmap */ +struct rtnl_link_ifmap +{ + __u64 mem_start; + __u64 mem_end; + __u64 base_addr; + __u16 irq; + __u8 dma; + __u8 port; +}; + +enum +{ + IFLA_UNSPEC, + IFLA_ADDRESS, + IFLA_BROADCAST, + IFLA_IFNAME, + IFLA_MTU, + IFLA_LINK, + IFLA_QDISC, + IFLA_STATS, + IFLA_COST, +#define IFLA_COST IFLA_COST + IFLA_PRIORITY, +#define IFLA_PRIORITY IFLA_PRIORITY + IFLA_MASTER, +#define IFLA_MASTER IFLA_MASTER + IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ +#define IFLA_WIRELESS IFLA_WIRELESS + IFLA_PROTINFO, /* Protocol specific information for a link */ +#define IFLA_PROTINFO IFLA_PROTINFO + IFLA_TXQLEN, +#define IFLA_TXQLEN IFLA_TXQLEN + IFLA_MAP, +#define IFLA_MAP IFLA_MAP + IFLA_WEIGHT, +#define IFLA_WEIGHT IFLA_WEIGHT + IFLA_OPERSTATE, + IFLA_LINKMODE, + IFLA_LINKINFO, +#define IFLA_LINKINFO IFLA_LINKINFO + IFLA_NET_NS_PID, + IFLA_IFALIAS, + __IFLA_MAX +}; + + +#define IFLA_MAX (__IFLA_MAX - 1) + +/* backwards compatibility for userspace */ +#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) +#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) + +/* ifi_flags. + + IFF_* flags. + + The only change is: + IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are + more not changeable by user. They describe link media + characteristics and set by device driver. + + Comments: + - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid + - If neither of these three flags are set; + the interface is NBMA. + + - IFF_MULTICAST does not mean anything special: + multicasts can be used on all not-NBMA links. + IFF_MULTICAST means that this media uses special encapsulation + for multicast frames. Apparently, all IFF_POINTOPOINT and + IFF_BROADCAST devices are able to use multicasts too. + */ + +/* IFLA_LINK. + For usual devices it is equal ifi_index. + If it is a "virtual interface" (f.e. tunnel), ifi_link + can point to real physical interface (f.e. for bandwidth calculations), + or maybe 0, what means, that real media is unknown (usual + for IPIP tunnels, when route to endpoint is allowed to change) + */ + +/* Subtype attributes for IFLA_PROTINFO */ +enum +{ + IFLA_INET6_UNSPEC, + IFLA_INET6_FLAGS, /* link flags */ + IFLA_INET6_CONF, /* sysctl parameters */ + IFLA_INET6_STATS, /* statistics */ + IFLA_INET6_MCAST, /* MC things. What of them? */ + IFLA_INET6_CACHEINFO, /* time values and max reasm size */ + IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ + __IFLA_INET6_MAX +}; + +#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) + +struct ifla_cacheinfo +{ + __u32 max_reasm_len; + __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ + __u32 reachable_time; + __u32 retrans_time; +}; + +enum +{ + IFLA_INFO_UNSPEC, + IFLA_INFO_KIND, + IFLA_INFO_DATA, + IFLA_INFO_XSTATS, + __IFLA_INFO_MAX, +}; + +#define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) + +/* VLAN section */ + +enum +{ + IFLA_VLAN_UNSPEC, + IFLA_VLAN_ID, + IFLA_VLAN_FLAGS, + IFLA_VLAN_EGRESS_QOS, + IFLA_VLAN_INGRESS_QOS, + __IFLA_VLAN_MAX, +}; + +#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) + +struct ifla_vlan_flags { + __u32 flags; + __u32 mask; +}; + +enum +{ + IFLA_VLAN_QOS_UNSPEC, + IFLA_VLAN_QOS_MAPPING, + __IFLA_VLAN_QOS_MAX +}; + +#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) + +struct ifla_vlan_qos_mapping +{ + __u32 from; + __u32 to; +}; + +#endif /* _LINUX_IF_LINK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ltalk.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ltalk.h new file mode 100644 index 0000000..92c3e30 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ltalk.h @@ -0,0 +1,9 @@ +#ifndef __LINUX_LTALK_H +#define __LINUX_LTALK_H + +#define LTALK_HLEN 1 +#define LTALK_MTU 600 +#define LTALK_ALEN 1 + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_packet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_packet.h new file mode 100644 index 0000000..18db066 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_packet.h @@ -0,0 +1,139 @@ +#ifndef __LINUX_IF_PACKET_H +#define __LINUX_IF_PACKET_H + +#include + +struct sockaddr_pkt +{ + unsigned short spkt_family; + unsigned char spkt_device[14]; + __be16 spkt_protocol; +}; + +struct sockaddr_ll +{ + unsigned short sll_family; + __be16 sll_protocol; + int sll_ifindex; + unsigned short sll_hatype; + unsigned char sll_pkttype; + unsigned char sll_halen; + unsigned char sll_addr[8]; +}; + +/* Packet types */ + +#define PACKET_HOST 0 /* To us */ +#define PACKET_BROADCAST 1 /* To all */ +#define PACKET_MULTICAST 2 /* To group */ +#define PACKET_OTHERHOST 3 /* To someone else */ +#define PACKET_OUTGOING 4 /* Outgoing of any type */ +/* These ones are invisible by user level */ +#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ +#define PACKET_FASTROUTE 6 /* Fastrouted frame */ + +/* Packet socket options */ + +#define PACKET_ADD_MEMBERSHIP 1 +#define PACKET_DROP_MEMBERSHIP 2 +#define PACKET_RECV_OUTPUT 3 +/* Value 4 is still used by obsolete turbo-packet. */ +#define PACKET_RX_RING 5 +#define PACKET_STATISTICS 6 +#define PACKET_COPY_THRESH 7 +#define PACKET_AUXDATA 8 +#define PACKET_ORIGDEV 9 +#define PACKET_VERSION 10 +#define PACKET_HDRLEN 11 +#define PACKET_RESERVE 12 + +struct tpacket_stats +{ + unsigned int tp_packets; + unsigned int tp_drops; +}; + +struct tpacket_auxdata +{ + __u32 tp_status; + __u32 tp_len; + __u32 tp_snaplen; + __u16 tp_mac; + __u16 tp_net; + __u16 tp_vlan_tci; +}; + +struct tpacket_hdr +{ + unsigned long tp_status; +#define TP_STATUS_KERNEL 0 +#define TP_STATUS_USER 1 +#define TP_STATUS_COPY 2 +#define TP_STATUS_LOSING 4 +#define TP_STATUS_CSUMNOTREADY 8 + unsigned int tp_len; + unsigned int tp_snaplen; + unsigned short tp_mac; + unsigned short tp_net; + unsigned int tp_sec; + unsigned int tp_usec; +}; + +#define TPACKET_ALIGNMENT 16 +#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) +#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) + +struct tpacket2_hdr +{ + __u32 tp_status; + __u32 tp_len; + __u32 tp_snaplen; + __u16 tp_mac; + __u16 tp_net; + __u32 tp_sec; + __u32 tp_nsec; + __u16 tp_vlan_tci; +}; + +#define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) + +enum tpacket_versions +{ + TPACKET_V1, + TPACKET_V2, +}; + +/* + Frame structure: + + - Start. Frame must be aligned to TPACKET_ALIGNMENT=16 + - struct tpacket_hdr + - pad to TPACKET_ALIGNMENT=16 + - struct sockaddr_ll + - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16 + - Start+tp_mac: [ Optional MAC header ] + - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. + - Pad to align to TPACKET_ALIGNMENT=16 + */ + +struct tpacket_req +{ + unsigned int tp_block_size; /* Minimal size of contiguous block */ + unsigned int tp_block_nr; /* Number of blocks */ + unsigned int tp_frame_size; /* Size of frame */ + unsigned int tp_frame_nr; /* Total number of frames */ +}; + +struct packet_mreq +{ + int mr_ifindex; + unsigned short mr_type; + unsigned short mr_alen; + unsigned char mr_address[8]; +}; + +#define PACKET_MR_MULTICAST 0 +#define PACKET_MR_PROMISC 1 +#define PACKET_MR_ALLMULTI 2 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_phonet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_phonet.h new file mode 100644 index 0000000..dfb0d4a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_phonet.h @@ -0,0 +1,16 @@ +/* + * File: if_phonet.h + * + * Phonet interface kernel definitions + * + * Copyright (C) 2008 Nokia Corporation. All rights reserved. + */ +#ifndef LINUX_IF_PHONET_H +#define LINUX_IF_PHONET_H + +#define PHONET_MIN_MTU 6 /* pn_length = 0 */ +#define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */ +#define PHONET_DEV_MTU PHONET_MAX_MTU + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_plip.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_plip.h new file mode 100644 index 0000000..153a649 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_plip.h @@ -0,0 +1,28 @@ +/* + * NET3 PLIP tuning facilities for the new Niibe PLIP. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef _LINUX_IF_PLIP_H +#define _LINUX_IF_PLIP_H + +#include + +#define SIOCDEVPLIP SIOCDEVPRIVATE + +struct plipconf +{ + unsigned short pcmd; + unsigned long nibble; + unsigned long trigger; +}; + +#define PLIP_GET_TIMEOUT 0x1 +#define PLIP_SET_TIMEOUT 0x2 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ppp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ppp.h new file mode 100644 index 0000000..c57bd71 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_ppp.h @@ -0,0 +1,173 @@ +/* + * if_ppp.h - Point-to-Point Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +/* + * ==FILEVERSION 20050812== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. + * if_ppp.h is shipped with a PPP distribution as well as with the kernel; + * if everyone increases the FILEVERSION number above, then scripts + * can do the right thing when deciding whether to install a new if_ppp.h + * file. Don't change the format of that line otherwise, so the + * installation script can recognize it. + */ + +#ifndef _IF_PPP_H_ +#define _IF_PPP_H_ + +#include + + +/* + * Packet sizes + */ + +#define PPP_MTU 1500 /* Default MTU (size of Info field) */ +#define PPP_MAXMRU 65000 /* Largest MRU we allow */ +#define PROTO_IPX 0x002b /* protocol numbers */ +#define PROTO_DNA_RT 0x0027 /* DNA Routing */ + + +/* + * Bit definitions for flags. + */ + +#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ +#define SC_COMP_AC 0x00000002 /* header compression (output) */ +#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ +#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ +#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ +#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ +#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ +#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ +#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ +#define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ +#define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ +#define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ +#define SC_COMP_RUN 0x00001000 /* compressor has been inited */ +#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ +#define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ +#define SC_DEBUG 0x00010000 /* enable debug messages */ +#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ +#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ +#define SC_LOG_RAWIN 0x00080000 /* log all chars received */ +#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ +#define SC_SYNC 0x00200000 /* synchronous serial mode */ +#define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ +#define SC_MASK 0x0f600fff /* bits that user can change */ + +/* state bits */ +#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ +#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ +#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ +#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ +#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ +#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ +#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ + +/* + * Ioctl definitions. + */ + +struct npioctl { + int protocol; /* PPP protocol, e.g. PPP_IP */ + enum NPmode mode; +}; + +/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ +struct ppp_option_data { + __u8 *ptr; + __u32 length; + int transmit; +}; + +struct ifpppstatsreq { + struct ifreq b; + struct ppp_stats stats; /* statistic information */ +}; + +struct ifpppcstatsreq { + struct ifreq b; + struct ppp_comp_stats stats; +}; + +/* For PPPIOCGL2TPSTATS */ +struct pppol2tp_ioc_stats { + __u16 tunnel_id; /* redundant */ + __u16 session_id; /* if zero, get tunnel stats */ + __u32 using_ipsec:1; /* valid only for session_id == 0 */ + aligned_u64 tx_packets; + aligned_u64 tx_bytes; + aligned_u64 tx_errors; + aligned_u64 rx_packets; + aligned_u64 rx_bytes; + aligned_u64 rx_seq_discards; + aligned_u64 rx_oos_packets; + aligned_u64 rx_errors; +}; + +#define ifr__name b.ifr_ifrn.ifrn_name +#define stats_ptr b.ifr_ifru.ifru_data + +/* + * Ioctl definitions. + */ + +#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ +#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ +#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ +#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ +#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ +#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ +#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ +#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ +#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ +#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ +#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ +#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ +#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ +#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) +#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ +#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ +#define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ +#define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ +#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ +#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ +#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ +#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ +#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ +#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */ +#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ +#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ +#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ +#define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ +#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ +#define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats) + +#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) +#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ +#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) + +#if !defined(ifr_mtu) +#define ifr_mtu ifr_ifru.ifru_metric +#endif + +#endif /* _IF_PPP_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_pppol2tp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_pppol2tp.h new file mode 100644 index 0000000..cb939b2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_pppol2tp.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661) + * + * This file supplies definitions required by the PPP over L2TP driver + * (pppol2tp.c). All version information wrt this file is located in pppol2tp.c + * + * License: + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef __LINUX_IF_PPPOL2TP_H +#define __LINUX_IF_PPPOL2TP_H + +#include + + +/* Structure used to connect() the socket to a particular tunnel UDP + * socket. + */ +struct pppol2tp_addr +{ + __kernel_pid_t pid; /* pid that owns the fd. + * 0 => current */ + int fd; /* FD of UDP socket to use */ + + struct sockaddr_in addr; /* IP address and port to send to */ + + __u16 s_tunnel, s_session; /* For matching incoming packets */ + __u16 d_tunnel, d_session; /* For sending outgoing packets */ +}; + +/* Socket options: + * DEBUG - bitmask of debug message categories + * SENDSEQ - 0 => don't send packets with sequence numbers + * 1 => send packets with sequence numbers + * RECVSEQ - 0 => receive packet sequence numbers are optional + * 1 => drop receive packets without sequence numbers + * LNSMODE - 0 => act as LAC. + * 1 => act as LNS. + * REORDERTO - reorder timeout (in millisecs). If 0, don't try to reorder. + */ +enum { + PPPOL2TP_SO_DEBUG = 1, + PPPOL2TP_SO_RECVSEQ = 2, + PPPOL2TP_SO_SENDSEQ = 3, + PPPOL2TP_SO_LNSMODE = 4, + PPPOL2TP_SO_REORDERTO = 5, +}; + +/* Debug message categories for the DEBUG socket option */ +enum { + PPPOL2TP_MSG_DEBUG = (1 << 0), /* verbose debug (if + * compiled in) */ + PPPOL2TP_MSG_CONTROL = (1 << 1), /* userspace - kernel + * interface */ + PPPOL2TP_MSG_SEQ = (1 << 2), /* sequence numbers */ + PPPOL2TP_MSG_DATA = (1 << 3), /* data packets */ +}; + + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_pppox.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_pppox.h new file mode 100644 index 0000000..d8e1511 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_pppox.h @@ -0,0 +1,123 @@ +/*************************************************************************** + * Linux PPP over X - Generic PPP transport layer sockets + * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516) + * + * This file supplies definitions required by the PPP over Ethernet driver + * (pppox.c). All version information wrt this file is located in pppox.c + * + * License: + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef __LINUX_IF_PPPOX_H +#define __LINUX_IF_PPPOX_H + + +#include +#include + +#include + +/* For user-space programs to pick up these definitions + * which they wouldn't get otherwise without defining __KERNEL__ + */ +#ifndef AF_PPPOX +#define AF_PPPOX 24 +#define PF_PPPOX AF_PPPOX +#endif /* !(AF_PPPOX) */ + +/************************************************************************ + * PPPoE addressing definition + */ +typedef __be16 sid_t; +struct pppoe_addr{ + sid_t sid; /* Session identifier */ + unsigned char remote[ETH_ALEN]; /* Remote address */ + char dev[IFNAMSIZ]; /* Local device to use */ +}; + +/************************************************************************ + * Protocols supported by AF_PPPOX + */ +#define PX_PROTO_OE 0 /* Currently just PPPoE */ +#define PX_PROTO_OL2TP 1 /* Now L2TP also */ +#define PX_MAX_PROTO 2 + +struct sockaddr_pppox { + sa_family_t sa_family; /* address family, AF_PPPOX */ + unsigned int sa_protocol; /* protocol identifier */ + union{ + struct pppoe_addr pppoe; + }sa_addr; +}__attribute__ ((packed)); + +/* The use of the above union isn't viable because the size of this + * struct must stay fixed over time -- applications use sizeof(struct + * sockaddr_pppox) to fill it. We use a protocol specific sockaddr + * type instead. + */ +struct sockaddr_pppol2tp { + sa_family_t sa_family; /* address family, AF_PPPOX */ + unsigned int sa_protocol; /* protocol identifier */ + struct pppol2tp_addr pppol2tp; +}__attribute__ ((packed)); + +/********************************************************************* + * + * ioctl interface for defining forwarding of connections + * + ********************************************************************/ + +#define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) +#define PPPOEIOCDFWD _IO(0xB1 ,1) +/*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/ + +/* Codes to identify message types */ +#define PADI_CODE 0x09 +#define PADO_CODE 0x07 +#define PADR_CODE 0x19 +#define PADS_CODE 0x65 +#define PADT_CODE 0xa7 +struct pppoe_tag { + __be16 tag_type; + __be16 tag_len; + char tag_data[0]; +} __attribute ((packed)); + +/* Tag identifiers */ +#define PTT_EOL __cpu_to_be16(0x0000) +#define PTT_SRV_NAME __cpu_to_be16(0x0101) +#define PTT_AC_NAME __cpu_to_be16(0x0102) +#define PTT_HOST_UNIQ __cpu_to_be16(0x0103) +#define PTT_AC_COOKIE __cpu_to_be16(0x0104) +#define PTT_VENDOR __cpu_to_be16(0x0105) +#define PTT_RELAY_SID __cpu_to_be16(0x0110) +#define PTT_SRV_ERR __cpu_to_be16(0x0201) +#define PTT_SYS_ERR __cpu_to_be16(0x0202) +#define PTT_GEN_ERR __cpu_to_be16(0x0203) + +struct pppoe_hdr { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 ver : 4; + __u8 type : 4; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 type : 4; + __u8 ver : 4; +#else +#error "Please fix " +#endif + __u8 code; + __be16 sid; + __be16 length; + struct pppoe_tag tag[0]; +} __attribute__ ((packed)); + +/* Length of entire PPPoE + PPP header */ +#define PPPOE_SES_HLEN 8 + + +#endif /* !(__LINUX_IF_PPPOX_H) */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_slip.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_slip.h new file mode 100644 index 0000000..1eb4e3a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_slip.h @@ -0,0 +1,30 @@ +/* + * Swansea University Computer Society NET3 + * + * This file declares the constants of special use with the SLIP/CSLIP/ + * KISS TNC driver. + */ + +#ifndef __LINUX_SLIP_H +#define __LINUX_SLIP_H + +#define SL_MODE_SLIP 0 +#define SL_MODE_CSLIP 1 +#define SL_MODE_KISS 4 + +#define SL_OPT_SIXBIT 2 +#define SL_OPT_ADAPTIVE 8 + +/* + * VSV = ioctl for keepalive & outfill in SLIP driver + */ + +#define SIOCSKEEPALIVE (SIOCDEVPRIVATE) /* Set keepalive timeout in sec */ +#define SIOCGKEEPALIVE (SIOCDEVPRIVATE+1) /* Get keepalive timeout */ +#define SIOCSOUTFILL (SIOCDEVPRIVATE+2) /* Set outfill timeout */ +#define SIOCGOUTFILL (SIOCDEVPRIVATE+3) /* Get outfill timeout */ +#define SIOCSLEASE (SIOCDEVPRIVATE+4) /* Set "leased" line type */ +#define SIOCGLEASE (SIOCDEVPRIVATE+5) /* Get line type */ + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_strip.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_strip.h new file mode 100644 index 0000000..6526a62 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_strip.h @@ -0,0 +1,27 @@ +/* + * if_strip.h -- + * + * Definitions for the STRIP interface + * + * Copyright 1996 The Board of Trustees of The Leland Stanford + * Junior University. All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. Stanford University + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + +#ifndef __LINUX_STRIP_H +#define __LINUX_STRIP_H + +#include + +typedef struct { + __u8 c[6]; +} MetricomAddress; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tr.h new file mode 100644 index 0000000..414bc95 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tr.h @@ -0,0 +1,95 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the Token-Ring IEEE 802.5 interface. + * + * Version: @(#)if_tr.h 0.0 07/11/94 + * + * Author: Fred N. van Kempen, + * Donald Becker, + * Peter De Schrijver, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_IF_TR_H +#define _LINUX_IF_TR_H + +#include +#include /* For __be16 */ + +/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble + and FCS/CRC (frame check sequence). */ +#define TR_ALEN 6 /* Octets in one token-ring addr */ +#define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc)) +#define AC 0x10 +#define LLC_FRAME 0x40 + +/* LLC and SNAP constants */ +#define EXTENDED_SAP 0xAA +#define UI_CMD 0x03 + +/* This is an Token-Ring frame header. */ +struct trh_hdr { + __u8 ac; /* access control field */ + __u8 fc; /* frame control field */ + __u8 daddr[TR_ALEN]; /* destination address */ + __u8 saddr[TR_ALEN]; /* source address */ + __be16 rcf; /* route control field */ + __be16 rseg[8]; /* routing registers */ +}; + + +/* This is an Token-Ring LLC structure */ +struct trllc { + __u8 dsap; /* destination SAP */ + __u8 ssap; /* source SAP */ + __u8 llc; /* LLC control field */ + __u8 protid[3]; /* protocol id */ + __be16 ethertype; /* ether type field */ +}; + +/* Token-Ring statistics collection data. */ +struct tr_statistics { + unsigned long rx_packets; /* total packets received */ + unsigned long tx_packets; /* total packets transmitted */ + unsigned long rx_bytes; /* total bytes received */ + unsigned long tx_bytes; /* total bytes transmitted */ + unsigned long rx_errors; /* bad packets received */ + unsigned long tx_errors; /* packet transmit problems */ + unsigned long rx_dropped; /* no space in linux buffers */ + unsigned long tx_dropped; /* no space available in linux */ + unsigned long multicast; /* multicast packets received */ + unsigned long transmit_collision; + + /* detailed Token-Ring errors. See IBM Token-Ring Network + Architecture for more info */ + + unsigned long line_errors; + unsigned long internal_errors; + unsigned long burst_errors; + unsigned long A_C_errors; + unsigned long abort_delimiters; + unsigned long lost_frames; + unsigned long recv_congest_count; + unsigned long frame_copied_errors; + unsigned long frequency_errors; + unsigned long token_errors; + unsigned long dummy1; +}; + +/* source routing stuff */ +#define TR_RII 0x80 +#define TR_RCF_DIR_BIT 0x80 +#define TR_RCF_LEN_MASK 0x1f00 +#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ +#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ +#define TR_RCF_FRAME2K 0x20 +#define TR_RCF_BROADCAST_MASK 0xC000 +#define TR_MAXRIFLEN 18 + +#endif /* _LINUX_IF_TR_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tun.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tun.h new file mode 100644 index 0000000..049d6c9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tun.h @@ -0,0 +1,87 @@ +/* + * Universal TUN/TAP device driver. + * Copyright (C) 1999-2000 Maxim Krasnyansky + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __IF_TUN_H +#define __IF_TUN_H + +#include +#include + +/* Read queue size */ +#define TUN_READQ_SIZE 500 + +/* TUN device flags */ +#define TUN_TUN_DEV 0x0001 +#define TUN_TAP_DEV 0x0002 +#define TUN_TYPE_MASK 0x000f + +#define TUN_FASYNC 0x0010 +#define TUN_NOCHECKSUM 0x0020 +#define TUN_NO_PI 0x0040 +#define TUN_ONE_QUEUE 0x0080 +#define TUN_PERSIST 0x0100 +#define TUN_VNET_HDR 0x0200 + +/* Ioctl defines */ +#define TUNSETNOCSUM _IOW('T', 200, int) +#define TUNSETDEBUG _IOW('T', 201, int) +#define TUNSETIFF _IOW('T', 202, int) +#define TUNSETPERSIST _IOW('T', 203, int) +#define TUNSETOWNER _IOW('T', 204, int) +#define TUNSETLINK _IOW('T', 205, int) +#define TUNSETGROUP _IOW('T', 206, int) +#define TUNGETFEATURES _IOR('T', 207, unsigned int) +#define TUNSETOFFLOAD _IOW('T', 208, unsigned int) +#define TUNSETTXFILTER _IOW('T', 209, unsigned int) +#define TUNGETIFF _IOR('T', 210, unsigned int) +#define TUNGETSNDBUF _IOR('T', 211, int) +#define TUNSETSNDBUF _IOW('T', 212, int) + +/* TUNSETIFF ifr flags */ +#define IFF_TUN 0x0001 +#define IFF_TAP 0x0002 +#define IFF_NO_PI 0x1000 +#define IFF_ONE_QUEUE 0x2000 +#define IFF_VNET_HDR 0x4000 + +/* Features for GSO (TUNSETOFFLOAD). */ +#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ +#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ +#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ +#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ + +/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ +#define TUN_PKT_STRIP 0x0001 +struct tun_pi { + __u16 flags; + __be16 proto; +}; + +/* + * Filter spec (used for SETXXFILTER ioctls) + * This stuff is applicable only to the TAP (Ethernet) devices. + * If the count is zero the filter is disabled and the driver accepts + * all packets (promisc mode). + * If the filter is enabled in order to accept broadcast packets + * broadcast addr must be explicitly included in the addr list. + */ +#define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */ +struct tun_filter { + __u16 flags; /* TUN_FLT_ flags see above */ + __u16 count; /* Number of addresses */ + __u8 addr[0][ETH_ALEN]; +}; + +#endif /* __IF_TUN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tunnel.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tunnel.h new file mode 100644 index 0000000..3036cec --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_tunnel.h @@ -0,0 +1,69 @@ +#ifndef _IF_TUNNEL_H_ +#define _IF_TUNNEL_H_ + +#include + + +#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) +#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) +#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) +#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) +#define SIOCGETPRL (SIOCDEVPRIVATE + 4) +#define SIOCADDPRL (SIOCDEVPRIVATE + 5) +#define SIOCDELPRL (SIOCDEVPRIVATE + 6) +#define SIOCCHGPRL (SIOCDEVPRIVATE + 7) + +#define GRE_CSUM __cpu_to_be16(0x8000) +#define GRE_ROUTING __cpu_to_be16(0x4000) +#define GRE_KEY __cpu_to_be16(0x2000) +#define GRE_SEQ __cpu_to_be16(0x1000) +#define GRE_STRICT __cpu_to_be16(0x0800) +#define GRE_REC __cpu_to_be16(0x0700) +#define GRE_FLAGS __cpu_to_be16(0x00F8) +#define GRE_VERSION __cpu_to_be16(0x0007) + +struct ip_tunnel_parm +{ + char name[IFNAMSIZ]; + int link; + __be16 i_flags; + __be16 o_flags; + __be32 i_key; + __be32 o_key; + struct iphdr iph; +}; + +/* SIT-mode i_flags */ +#define SIT_ISATAP 0x0001 + +struct ip_tunnel_prl { + __be32 addr; + __u16 flags; + __u16 __reserved; + __u32 datalen; + __u32 __reserved2; + /* data follows */ +}; + +/* PRL flags */ +#define PRL_DEFAULT 0x0001 + +enum +{ + IFLA_GRE_UNSPEC, + IFLA_GRE_LINK, + IFLA_GRE_IFLAGS, + IFLA_GRE_OFLAGS, + IFLA_GRE_IKEY, + IFLA_GRE_OKEY, + IFLA_GRE_LOCAL, + IFLA_GRE_REMOTE, + IFLA_GRE_TTL, + IFLA_GRE_TOS, + IFLA_GRE_PMTUDISC, + __IFLA_GRE_MAX, +}; + +#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) + +#endif /* _IF_TUNNEL_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_vlan.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_vlan.h new file mode 100644 index 0000000..2dc4a57 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/if_vlan.h @@ -0,0 +1,62 @@ +/* + * VLAN An implementation of 802.1Q VLAN tagging. + * + * Authors: Ben Greear + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef _LINUX_IF_VLAN_H_ +#define _LINUX_IF_VLAN_H_ + + +/* VLAN IOCTLs are found in sockios.h */ + +/* Passed in vlan_ioctl_args structure to determine behaviour. */ +enum vlan_ioctl_cmds { + ADD_VLAN_CMD, + DEL_VLAN_CMD, + SET_VLAN_INGRESS_PRIORITY_CMD, + SET_VLAN_EGRESS_PRIORITY_CMD, + GET_VLAN_INGRESS_PRIORITY_CMD, + GET_VLAN_EGRESS_PRIORITY_CMD, + SET_VLAN_NAME_TYPE_CMD, + SET_VLAN_FLAG_CMD, + GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */ + GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ +}; + +enum vlan_flags { + VLAN_FLAG_REORDER_HDR = 0x1, + VLAN_FLAG_GVRP = 0x2, +}; + +enum vlan_name_types { + VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ + VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ + VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */ + VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */ + VLAN_NAME_TYPE_HIGHEST +}; + +struct vlan_ioctl_args { + int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ + char device1[24]; + + union { + char device2[24]; + int VID; + unsigned int skb_priority; + unsigned int name_type; + unsigned int bind_type; + unsigned int flag; /* Matches vlan_dev_info flags */ + } u; + + short vlan_qos; +}; + +#endif /* !(_LINUX_IF_VLAN_H_) */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/igmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/igmp.h new file mode 100644 index 0000000..6c4c5a7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/igmp.h @@ -0,0 +1,129 @@ +/* + * Linux NET3: Internet Group Management Protocol [IGMP] + * + * Authors: + * Alan Cox + * + * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IGMP_H +#define _LINUX_IGMP_H + +#include +#include + +/* + * IGMP protocol structures + */ + +/* + * Header in on cable format + */ + +struct igmphdr +{ + __u8 type; + __u8 code; /* For newer IGMP */ + __sum16 csum; + __be32 group; +}; + +/* V3 group record types [grec_type] */ +#define IGMPV3_MODE_IS_INCLUDE 1 +#define IGMPV3_MODE_IS_EXCLUDE 2 +#define IGMPV3_CHANGE_TO_INCLUDE 3 +#define IGMPV3_CHANGE_TO_EXCLUDE 4 +#define IGMPV3_ALLOW_NEW_SOURCES 5 +#define IGMPV3_BLOCK_OLD_SOURCES 6 + +struct igmpv3_grec { + __u8 grec_type; + __u8 grec_auxwords; + __be16 grec_nsrcs; + __be32 grec_mca; + __be32 grec_src[0]; +}; + +struct igmpv3_report { + __u8 type; + __u8 resv1; + __be16 csum; + __be16 resv2; + __be16 ngrec; + struct igmpv3_grec grec[0]; +}; + +struct igmpv3_query { + __u8 type; + __u8 code; + __be16 csum; + __be32 group; +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 qrv:3, + suppress:1, + resv:4; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 resv:4, + suppress:1, + qrv:3; +#else +#error "Please fix " +#endif + __u8 qqic; + __be16 nsrcs; + __be32 srcs[0]; +}; + +#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ +#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ +#define IGMP_DVMRP 0x13 /* DVMRP routing */ +#define IGMP_PIM 0x14 /* PIM routing */ +#define IGMP_TRACE 0x15 +#define IGMPV2_HOST_MEMBERSHIP_REPORT 0x16 /* V2 version of 0x11 */ +#define IGMP_HOST_LEAVE_MESSAGE 0x17 +#define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22 /* V3 version of 0x11 */ + +#define IGMP_MTRACE_RESP 0x1e +#define IGMP_MTRACE 0x1f + + +/* + * Use the BSD names for these for compatibility + */ + +#define IGMP_DELAYING_MEMBER 0x01 +#define IGMP_IDLE_MEMBER 0x02 +#define IGMP_LAZY_MEMBER 0x03 +#define IGMP_SLEEPING_MEMBER 0x04 +#define IGMP_AWAKENING_MEMBER 0x05 + +#define IGMP_MINLEN 8 + +#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ + /* query (in seconds) */ + +#define IGMP_TIMER_SCALE 10 /* denotes that the igmphdr->timer field */ + /* specifies time in 10th of seconds */ + +#define IGMP_AGE_THRESHOLD 400 /* If this host don't hear any IGMP V1 */ + /* message in this period of time, */ + /* revert to IGMP v2 router. */ + +#define IGMP_ALL_HOSTS htonl(0xE0000001L) +#define IGMP_ALL_ROUTER htonl(0xE0000002L) +#define IGMPV3_ALL_MCR htonl(0xE0000016L) +#define IGMP_LOCAL_GROUP htonl(0xE0000000L) +#define IGMP_LOCAL_GROUP_MASK htonl(0xFFFFFF00L) + +/* + * struct for keeping the multicast list in + */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in.h new file mode 100644 index 0000000..83952be --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in.h @@ -0,0 +1,254 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions of the Internet Protocol. + * + * Version: @(#)in.h 1.0.1 04/21/93 + * + * Authors: Original taken from the GNU Project file. + * Fred N. van Kempen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_IN_H +#define _LINUX_IN_H + +#include +#include + +/* Standard well-defined IP protocols. */ +enum { + IPPROTO_IP = 0, /* Dummy protocol for TCP */ + IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ + IPPROTO_IGMP = 2, /* Internet Group Management Protocol */ + IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ + IPPROTO_TCP = 6, /* Transmission Control Protocol */ + IPPROTO_EGP = 8, /* Exterior Gateway Protocol */ + IPPROTO_PUP = 12, /* PUP protocol */ + IPPROTO_UDP = 17, /* User Datagram Protocol */ + IPPROTO_IDP = 22, /* XNS IDP protocol */ + IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */ + IPPROTO_RSVP = 46, /* RSVP protocol */ + IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ + + IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ + + IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */ + IPPROTO_AH = 51, /* Authentication Header protocol */ + IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */ + IPPROTO_PIM = 103, /* Protocol Independent Multicast */ + + IPPROTO_COMP = 108, /* Compression Header protocol */ + IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ + IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */ + + IPPROTO_RAW = 255, /* Raw IP packets */ + IPPROTO_MAX +}; + + +/* Internet address. */ +struct in_addr { + __be32 s_addr; +}; + +#define IP_TOS 1 +#define IP_TTL 2 +#define IP_HDRINCL 3 +#define IP_OPTIONS 4 +#define IP_ROUTER_ALERT 5 +#define IP_RECVOPTS 6 +#define IP_RETOPTS 7 +#define IP_PKTINFO 8 +#define IP_PKTOPTIONS 9 +#define IP_MTU_DISCOVER 10 +#define IP_RECVERR 11 +#define IP_RECVTTL 12 +#define IP_RECVTOS 13 +#define IP_MTU 14 +#define IP_FREEBIND 15 +#define IP_IPSEC_POLICY 16 +#define IP_XFRM_POLICY 17 +#define IP_PASSSEC 18 +#define IP_TRANSPARENT 19 + +/* BSD compatibility */ +#define IP_RECVRETOPTS IP_RETOPTS + +/* TProxy original addresses */ +#define IP_ORIGDSTADDR 20 +#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR + +/* IP_MTU_DISCOVER values */ +#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ +#define IP_PMTUDISC_WANT 1 /* Use per route hints */ +#define IP_PMTUDISC_DO 2 /* Always DF */ +#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ + +#define IP_MULTICAST_IF 32 +#define IP_MULTICAST_TTL 33 +#define IP_MULTICAST_LOOP 34 +#define IP_ADD_MEMBERSHIP 35 +#define IP_DROP_MEMBERSHIP 36 +#define IP_UNBLOCK_SOURCE 37 +#define IP_BLOCK_SOURCE 38 +#define IP_ADD_SOURCE_MEMBERSHIP 39 +#define IP_DROP_SOURCE_MEMBERSHIP 40 +#define IP_MSFILTER 41 +#define MCAST_JOIN_GROUP 42 +#define MCAST_BLOCK_SOURCE 43 +#define MCAST_UNBLOCK_SOURCE 44 +#define MCAST_LEAVE_GROUP 45 +#define MCAST_JOIN_SOURCE_GROUP 46 +#define MCAST_LEAVE_SOURCE_GROUP 47 +#define MCAST_MSFILTER 48 + +#define MCAST_EXCLUDE 0 +#define MCAST_INCLUDE 1 + +/* These need to appear somewhere around here */ +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 + +/* Request struct for multicast socket ops */ + +struct ip_mreq +{ + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +struct ip_mreqn +{ + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_address; /* local IP address of interface */ + int imr_ifindex; /* Interface index */ +}; + +struct ip_mreq_source { + __be32 imr_multiaddr; + __be32 imr_interface; + __be32 imr_sourceaddr; +}; + +struct ip_msfilter { + __be32 imsf_multiaddr; + __be32 imsf_interface; + __u32 imsf_fmode; + __u32 imsf_numsrc; + __be32 imsf_slist[1]; +}; + +#define IP_MSFILTER_SIZE(numsrc) \ + (sizeof(struct ip_msfilter) - sizeof(__u32) \ + + (numsrc) * sizeof(__u32)) + +struct group_req +{ + __u32 gr_interface; /* interface index */ + struct __kernel_sockaddr_storage gr_group; /* group address */ +}; + +struct group_source_req +{ + __u32 gsr_interface; /* interface index */ + struct __kernel_sockaddr_storage gsr_group; /* group address */ + struct __kernel_sockaddr_storage gsr_source; /* source address */ +}; + +struct group_filter +{ + __u32 gf_interface; /* interface index */ + struct __kernel_sockaddr_storage gf_group; /* multicast address */ + __u32 gf_fmode; /* filter mode */ + __u32 gf_numsrc; /* number of sources */ + struct __kernel_sockaddr_storage gf_slist[1]; /* interface index */ +}; + +#define GROUP_FILTER_SIZE(numsrc) \ + (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ + + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) + +struct in_pktinfo +{ + int ipi_ifindex; + struct in_addr ipi_spec_dst; + struct in_addr ipi_addr; +}; + +/* Structure describing an Internet (IP) socket address. */ +#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ +struct sockaddr_in { + sa_family_t sin_family; /* Address family */ + __be16 sin_port; /* Port number */ + struct in_addr sin_addr; /* Internet address */ + + /* Pad to size of `struct sockaddr'. */ + unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - + sizeof(unsigned short int) - sizeof(struct in_addr)]; +}; +#define sin_zero __pad /* for BSD UNIX comp. -FvK */ + + +/* + * Definitions of the bits in an Internet address integer. + * On subnets, host and network parts are found according + * to the subnet mask, not these masks. + */ +#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) + +#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) +#define IN_MULTICAST_NET 0xF0000000 + +#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) + +/* Address to accept any incoming messages. */ +#define INADDR_ANY ((unsigned long int) 0x00000000) + +/* Address to send to all hosts. */ +#define INADDR_BROADCAST ((unsigned long int) 0xffffffff) + +/* Address indicating an error return. */ +#define INADDR_NONE ((unsigned long int) 0xffffffff) + +/* Network number for local host loopback. */ +#define IN_LOOPBACKNET 127 + +/* Address to loopback in software to local host. */ +#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */ +#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) + +/* Defines for Multicast INADDR */ +#define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ +#define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ +#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ + + +/* contains the htonl type stuff.. */ +#include + + +#endif /* _LINUX_IN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in6.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in6.h new file mode 100644 index 0000000..9536569 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in6.h @@ -0,0 +1,274 @@ +/* + * Types and definitions for AF_INET6 + * Linux INET6 implementation + * + * Authors: + * Pedro Roque + * + * Sources: + * IPv6 Program Interfaces for BSD Systems + * + * + * Advanced Sockets API for IPv6 + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IN6_H +#define _LINUX_IN6_H + +#include + +/* + * IPv6 address structure + */ + +struct in6_addr +{ + union + { + __u8 u6_addr8[16]; + __be16 u6_addr16[8]; + __be32 u6_addr32[4]; + } in6_u; +#define s6_addr in6_u.u6_addr8 +#define s6_addr16 in6_u.u6_addr16 +#define s6_addr32 in6_u.u6_addr32 +}; + +/* IPv6 Wildcard Address (::) and Loopback Address (::1) defined in RFC2553 + * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined + * in network byte order, not in host byte order as are the IPv4 equivalents + */ + +struct sockaddr_in6 { + unsigned short int sin6_family; /* AF_INET6 */ + __be16 sin6_port; /* Transport layer port # */ + __be32 sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + __u32 sin6_scope_id; /* scope id (new in RFC2553) */ +}; + +struct ipv6_mreq { + /* IPv6 multicast address of group */ + struct in6_addr ipv6mr_multiaddr; + + /* local IPv6 address of interface */ + int ipv6mr_ifindex; +}; + +#define ipv6mr_acaddr ipv6mr_multiaddr + +struct in6_flowlabel_req +{ + struct in6_addr flr_dst; + __be32 flr_label; + __u8 flr_action; + __u8 flr_share; + __u16 flr_flags; + __u16 flr_expires; + __u16 flr_linger; + __u32 __flr_pad; + /* Options in format of IPV6_PKTOPTIONS */ +}; + +#define IPV6_FL_A_GET 0 +#define IPV6_FL_A_PUT 1 +#define IPV6_FL_A_RENEW 2 + +#define IPV6_FL_F_CREATE 1 +#define IPV6_FL_F_EXCL 2 + +#define IPV6_FL_S_NONE 0 +#define IPV6_FL_S_EXCL 1 +#define IPV6_FL_S_PROCESS 2 +#define IPV6_FL_S_USER 3 +#define IPV6_FL_S_ANY 255 + + +/* + * Bitmask constant declarations to help applications select out the + * flow label and priority fields. + * + * Note that this are in host byte order while the flowinfo field of + * sockaddr_in6 is in network byte order. + */ + +#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff +#define IPV6_FLOWINFO_PRIORITY 0x0ff00000 + +/* These defintions are obsolete */ +#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 +#define IPV6_PRIORITY_FILLER 0x0100 +#define IPV6_PRIORITY_UNATTENDED 0x0200 +#define IPV6_PRIORITY_RESERVED1 0x0300 +#define IPV6_PRIORITY_BULK 0x0400 +#define IPV6_PRIORITY_RESERVED2 0x0500 +#define IPV6_PRIORITY_INTERACTIVE 0x0600 +#define IPV6_PRIORITY_CONTROL 0x0700 +#define IPV6_PRIORITY_8 0x0800 +#define IPV6_PRIORITY_9 0x0900 +#define IPV6_PRIORITY_10 0x0a00 +#define IPV6_PRIORITY_11 0x0b00 +#define IPV6_PRIORITY_12 0x0c00 +#define IPV6_PRIORITY_13 0x0d00 +#define IPV6_PRIORITY_14 0x0e00 +#define IPV6_PRIORITY_15 0x0f00 + +/* + * IPV6 extension headers + */ +#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ +#define IPPROTO_ROUTING 43 /* IPv6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ +#define IPPROTO_ICMPV6 58 /* ICMPv6 */ +#define IPPROTO_NONE 59 /* IPv6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ +#define IPPROTO_MH 135 /* IPv6 mobility header */ + +/* + * IPv6 TLV options. + */ +#define IPV6_TLV_PAD0 0 +#define IPV6_TLV_PADN 1 +#define IPV6_TLV_ROUTERALERT 5 +#define IPV6_TLV_JUMBO 194 +#define IPV6_TLV_HAO 201 /* home address option */ + +/* + * IPV6 socket options + */ + +#define IPV6_ADDRFORM 1 +#define IPV6_2292PKTINFO 2 +#define IPV6_2292HOPOPTS 3 +#define IPV6_2292DSTOPTS 4 +#define IPV6_2292RTHDR 5 +#define IPV6_2292PKTOPTIONS 6 +#define IPV6_CHECKSUM 7 +#define IPV6_2292HOPLIMIT 8 +#define IPV6_NEXTHOP 9 +#define IPV6_AUTHHDR 10 /* obsolete */ +#define IPV6_FLOWINFO 11 + +#define IPV6_UNICAST_HOPS 16 +#define IPV6_MULTICAST_IF 17 +#define IPV6_MULTICAST_HOPS 18 +#define IPV6_MULTICAST_LOOP 19 +#define IPV6_ADD_MEMBERSHIP 20 +#define IPV6_DROP_MEMBERSHIP 21 +#define IPV6_ROUTER_ALERT 22 +#define IPV6_MTU_DISCOVER 23 +#define IPV6_MTU 24 +#define IPV6_RECVERR 25 +#define IPV6_V6ONLY 26 +#define IPV6_JOIN_ANYCAST 27 +#define IPV6_LEAVE_ANYCAST 28 + +/* IPV6_MTU_DISCOVER values */ +#define IPV6_PMTUDISC_DONT 0 +#define IPV6_PMTUDISC_WANT 1 +#define IPV6_PMTUDISC_DO 2 +#define IPV6_PMTUDISC_PROBE 3 + +/* Flowlabel */ +#define IPV6_FLOWLABEL_MGR 32 +#define IPV6_FLOWINFO_SEND 33 + +#define IPV6_IPSEC_POLICY 34 +#define IPV6_XFRM_POLICY 35 + +/* + * Multicast: + * Following socket options are shared between IPv4 and IPv6. + * + * MCAST_JOIN_GROUP 42 + * MCAST_BLOCK_SOURCE 43 + * MCAST_UNBLOCK_SOURCE 44 + * MCAST_LEAVE_GROUP 45 + * MCAST_JOIN_SOURCE_GROUP 46 + * MCAST_LEAVE_SOURCE_GROUP 47 + * MCAST_MSFILTER 48 + */ + +/* + * Advanced API (RFC3542) (1) + * + * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c. + */ + +#define IPV6_RECVPKTINFO 49 +#define IPV6_PKTINFO 50 +#define IPV6_RECVHOPLIMIT 51 +#define IPV6_HOPLIMIT 52 +#define IPV6_RECVHOPOPTS 53 +#define IPV6_HOPOPTS 54 +#define IPV6_RTHDRDSTOPTS 55 +#define IPV6_RECVRTHDR 56 +#define IPV6_RTHDR 57 +#define IPV6_RECVDSTOPTS 58 +#define IPV6_DSTOPTS 59 +#if 0 /* not yet */ +#define IPV6_RECVPATHMTU 60 +#define IPV6_PATHMTU 61 +#define IPV6_DONTFRAG 62 +#define IPV6_USE_MIN_MTU 63 +#endif + +/* + * Netfilter (1) + * + * Following socket options are used in ip6_tables; + * see include/linux/netfilter_ipv6/ip6_tables.h. + * + * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64 + * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65 + */ + +/* + * Advanced API (RFC3542) (2) + */ +#define IPV6_RECVTCLASS 66 +#define IPV6_TCLASS 67 + +/* + * Netfilter (2) + * + * Following socket options are used in ip6_tables; + * see include/linux/netfilter_ipv6/ip6_tables.h. + * + * IP6T_SO_GET_REVISION_MATCH 68 + * IP6T_SO_GET_REVISION_TARGET 69 + */ + +/* RFC5014: Source address selection */ +#define IPV6_ADDR_PREFERENCES 72 + +#define IPV6_PREFER_SRC_TMP 0x0001 +#define IPV6_PREFER_SRC_PUBLIC 0x0002 +#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 +#define IPV6_PREFER_SRC_COA 0x0004 +#define IPV6_PREFER_SRC_HOME 0x0400 +#define IPV6_PREFER_SRC_CGA 0x0008 +#define IPV6_PREFER_SRC_NONCGA 0x0800 + +/* + * Multicast Routing: + * see include/linux/mroute6.h. + * + * MRT6_INIT 200 + * MRT6_DONE 201 + * MRT6_ADD_MIF 202 + * MRT6_DEL_MIF 203 + * MRT6_ADD_MFC 204 + * MRT6_DEL_MFC 205 + * MRT6_VERSION 206 + * MRT6_ASSERT 207 + * MRT6_PIM 208 + * (reserved) 209 + */ +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in_route.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in_route.h new file mode 100644 index 0000000..b261b8c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/in_route.h @@ -0,0 +1,32 @@ +#ifndef _LINUX_IN_ROUTE_H +#define _LINUX_IN_ROUTE_H + +/* IPv4 routing cache flags */ + +#define RTCF_DEAD RTNH_F_DEAD +#define RTCF_ONLINK RTNH_F_ONLINK + +/* Obsolete flag. About to be deleted */ +#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC + +#define RTCF_NOTIFY 0x00010000 +#define RTCF_DIRECTDST 0x00020000 /* unused */ +#define RTCF_REDIRECTED 0x00040000 +#define RTCF_TPROXY 0x00080000 /* unused */ + +#define RTCF_FAST 0x00200000 /* unused */ +#define RTCF_MASQ 0x00400000 /* unused */ +#define RTCF_SNAT 0x00800000 /* unused */ +#define RTCF_DOREDIRECT 0x01000000 +#define RTCF_DIRECTSRC 0x04000000 +#define RTCF_DNAT 0x08000000 +#define RTCF_BROADCAST 0x10000000 +#define RTCF_MULTICAST 0x20000000 +#define RTCF_REJECT 0x40000000 /* unused */ +#define RTCF_LOCAL 0x80000000 + +#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) + +#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) + +#endif /* _LINUX_IN_ROUTE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/inet_diag.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/inet_diag.h new file mode 100644 index 0000000..1107ed2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/inet_diag.h @@ -0,0 +1,124 @@ +#ifndef _INET_DIAG_H_ +#define _INET_DIAG_H_ 1 + +#include + +/* Just some random number */ +#define TCPDIAG_GETSOCK 18 +#define DCCPDIAG_GETSOCK 19 + +#define INET_DIAG_GETSOCK_MAX 24 + +/* Socket identity */ +struct inet_diag_sockid { + __be16 idiag_sport; + __be16 idiag_dport; + __be32 idiag_src[4]; + __be32 idiag_dst[4]; + __u32 idiag_if; + __u32 idiag_cookie[2]; +#define INET_DIAG_NOCOOKIE (~0U) +}; + +/* Request structure */ + +struct inet_diag_req { + __u8 idiag_family; /* Family of addresses. */ + __u8 idiag_src_len; + __u8 idiag_dst_len; + __u8 idiag_ext; /* Query extended information */ + + struct inet_diag_sockid id; + + __u32 idiag_states; /* States to dump */ + __u32 idiag_dbs; /* Tables to dump (NI) */ +}; + +enum { + INET_DIAG_REQ_NONE, + INET_DIAG_REQ_BYTECODE, +}; + +#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE + +/* Bytecode is sequence of 4 byte commands followed by variable arguments. + * All the commands identified by "code" are conditional jumps forward: + * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be + * length of the command and its arguments. + */ + +struct inet_diag_bc_op { + unsigned char code; + unsigned char yes; + unsigned short no; +}; + +enum { + INET_DIAG_BC_NOP, + INET_DIAG_BC_JMP, + INET_DIAG_BC_S_GE, + INET_DIAG_BC_S_LE, + INET_DIAG_BC_D_GE, + INET_DIAG_BC_D_LE, + INET_DIAG_BC_AUTO, + INET_DIAG_BC_S_COND, + INET_DIAG_BC_D_COND, +}; + +struct inet_diag_hostcond { + __u8 family; + __u8 prefix_len; + int port; + __be32 addr[0]; +}; + +/* Base info structure. It contains socket identity (addrs/ports/cookie) + * and, alas, the information shown by netstat. */ +struct inet_diag_msg { + __u8 idiag_family; + __u8 idiag_state; + __u8 idiag_timer; + __u8 idiag_retrans; + + struct inet_diag_sockid id; + + __u32 idiag_expires; + __u32 idiag_rqueue; + __u32 idiag_wqueue; + __u32 idiag_uid; + __u32 idiag_inode; +}; + +/* Extensions */ + +enum { + INET_DIAG_NONE, + INET_DIAG_MEMINFO, + INET_DIAG_INFO, + INET_DIAG_VEGASINFO, + INET_DIAG_CONG, +}; + +#define INET_DIAG_MAX INET_DIAG_CONG + + +/* INET_DIAG_MEM */ + +struct inet_diag_meminfo { + __u32 idiag_rmem; + __u32 idiag_wmem; + __u32 idiag_fmem; + __u32 idiag_tmem; +}; + +/* INET_DIAG_VEGASINFO */ + +struct tcpvegas_info { + __u32 tcpv_enabled; + __u32 tcpv_rttcnt; + __u32 tcpv_rtt; + __u32 tcpv_minrtt; +}; + + +#endif /* _INET_DIAG_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/inotify.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/inotify.h new file mode 100644 index 0000000..8be5ac5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/inotify.h @@ -0,0 +1,73 @@ +/* + * Inode based directory notification for Linux + * + * Copyright (C) 2005 John McCutchan + */ + +#ifndef _LINUX_INOTIFY_H +#define _LINUX_INOTIFY_H + +/* For O_CLOEXEC and O_NONBLOCK */ +#include +#include + +/* + * struct inotify_event - structure read from the inotify device for each event + * + * When you are watching a directory, you will receive the filename for events + * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd. + */ +struct inotify_event { + __s32 wd; /* watch descriptor */ + __u32 mask; /* watch mask */ + __u32 cookie; /* cookie to synchronize two events */ + __u32 len; /* length (including nulls) of name */ + char name[0]; /* stub for possible name */ +}; + +/* the following are legal, implemented events that user-space can watch for */ +#define IN_ACCESS 0x00000001 /* File was accessed */ +#define IN_MODIFY 0x00000002 /* File was modified */ +#define IN_ATTRIB 0x00000004 /* Metadata changed */ +#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ +#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ +#define IN_OPEN 0x00000020 /* File was opened */ +#define IN_MOVED_FROM 0x00000040 /* File was moved from X */ +#define IN_MOVED_TO 0x00000080 /* File was moved to Y */ +#define IN_CREATE 0x00000100 /* Subfile was created */ +#define IN_DELETE 0x00000200 /* Subfile was deleted */ +#define IN_DELETE_SELF 0x00000400 /* Self was deleted */ +#define IN_MOVE_SELF 0x00000800 /* Self was moved */ + +/* the following are legal events. they are sent as needed to any watch */ +#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ +#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ +#define IN_IGNORED 0x00008000 /* File was ignored */ + +/* helper events */ +#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */ +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ + +/* special flags */ +#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */ +#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */ +#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ +#define IN_ISDIR 0x40000000 /* event occurred against dir */ +#define IN_ONESHOT 0x80000000 /* only send event once */ + +/* + * All of the events - we build the list by hand so that we can add flags in + * the future and not break backward compatibility. Apps will get only the + * events that they originally wanted. Be sure to add new events here! + */ +#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ + IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ + IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ + IN_MOVE_SELF) + +/* Flags for sys_inotify_init1. */ +#define IN_CLOEXEC O_CLOEXEC +#define IN_NONBLOCK O_NONBLOCK + + +#endif /* _LINUX_INOTIFY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/input.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/input.h new file mode 100644 index 0000000..47406fb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/input.h @@ -0,0 +1,982 @@ +#ifndef _INPUT_H +#define _INPUT_H + +/* + * Copyright (c) 1999-2002 Vojtech Pavlik + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include + +/* + * The event structure itself + */ + +struct input_event { + struct timeval time; + __u16 type; + __u16 code; + __s32 value; +}; + +/* + * Protocol version. + */ + +#define EV_VERSION 0x010000 + +/* + * IOCTLs (0x00 - 0x7f) + */ + +struct input_id { + __u16 bustype; + __u16 vendor; + __u16 product; + __u16 version; +}; + +struct input_absinfo { + __s32 value; + __s32 minimum; + __s32 maximum; + __s32 fuzz; + __s32 flat; +}; + +#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ +#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ +#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ +#define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */ +#define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ +#define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ + +#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ +#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ +#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ + +#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */ +#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ +#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ +#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ + +#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ +#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */ +#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */ + +#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ +#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ +#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ + +#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ + +/* + * Event types + */ + +#define EV_SYN 0x00 +#define EV_KEY 0x01 +#define EV_REL 0x02 +#define EV_ABS 0x03 +#define EV_MSC 0x04 +#define EV_SW 0x05 +#define EV_LED 0x11 +#define EV_SND 0x12 +#define EV_REP 0x14 +#define EV_FF 0x15 +#define EV_PWR 0x16 +#define EV_FF_STATUS 0x17 +#define EV_MAX 0x1f +#define EV_CNT (EV_MAX+1) + +/* + * Synchronization events. + */ + +#define SYN_REPORT 0 +#define SYN_CONFIG 1 +#define SYN_MT_REPORT 2 + +/* + * Keys and buttons + * + * Most of the keys/buttons are modeled after USB HUT 1.12 + * (see http://www.usb.org/developers/hidpage). + * Abbreviations in the comments: + * AC - Application Control + * AL - Application Launch Button + * SC - System Control + */ + +#define KEY_RESERVED 0 +#define KEY_ESC 1 +#define KEY_1 2 +#define KEY_2 3 +#define KEY_3 4 +#define KEY_4 5 +#define KEY_5 6 +#define KEY_6 7 +#define KEY_7 8 +#define KEY_8 9 +#define KEY_9 10 +#define KEY_0 11 +#define KEY_MINUS 12 +#define KEY_EQUAL 13 +#define KEY_BACKSPACE 14 +#define KEY_TAB 15 +#define KEY_Q 16 +#define KEY_W 17 +#define KEY_E 18 +#define KEY_R 19 +#define KEY_T 20 +#define KEY_Y 21 +#define KEY_U 22 +#define KEY_I 23 +#define KEY_O 24 +#define KEY_P 25 +#define KEY_LEFTBRACE 26 +#define KEY_RIGHTBRACE 27 +#define KEY_ENTER 28 +#define KEY_LEFTCTRL 29 +#define KEY_A 30 +#define KEY_S 31 +#define KEY_D 32 +#define KEY_F 33 +#define KEY_G 34 +#define KEY_H 35 +#define KEY_J 36 +#define KEY_K 37 +#define KEY_L 38 +#define KEY_SEMICOLON 39 +#define KEY_APOSTROPHE 40 +#define KEY_GRAVE 41 +#define KEY_LEFTSHIFT 42 +#define KEY_BACKSLASH 43 +#define KEY_Z 44 +#define KEY_X 45 +#define KEY_C 46 +#define KEY_V 47 +#define KEY_B 48 +#define KEY_N 49 +#define KEY_M 50 +#define KEY_COMMA 51 +#define KEY_DOT 52 +#define KEY_SLASH 53 +#define KEY_RIGHTSHIFT 54 +#define KEY_KPASTERISK 55 +#define KEY_LEFTALT 56 +#define KEY_SPACE 57 +#define KEY_CAPSLOCK 58 +#define KEY_F1 59 +#define KEY_F2 60 +#define KEY_F3 61 +#define KEY_F4 62 +#define KEY_F5 63 +#define KEY_F6 64 +#define KEY_F7 65 +#define KEY_F8 66 +#define KEY_F9 67 +#define KEY_F10 68 +#define KEY_NUMLOCK 69 +#define KEY_SCROLLLOCK 70 +#define KEY_KP7 71 +#define KEY_KP8 72 +#define KEY_KP9 73 +#define KEY_KPMINUS 74 +#define KEY_KP4 75 +#define KEY_KP5 76 +#define KEY_KP6 77 +#define KEY_KPPLUS 78 +#define KEY_KP1 79 +#define KEY_KP2 80 +#define KEY_KP3 81 +#define KEY_KP0 82 +#define KEY_KPDOT 83 + +#define KEY_ZENKAKUHANKAKU 85 +#define KEY_102ND 86 +#define KEY_F11 87 +#define KEY_F12 88 +#define KEY_RO 89 +#define KEY_KATAKANA 90 +#define KEY_HIRAGANA 91 +#define KEY_HENKAN 92 +#define KEY_KATAKANAHIRAGANA 93 +#define KEY_MUHENKAN 94 +#define KEY_KPJPCOMMA 95 +#define KEY_KPENTER 96 +#define KEY_RIGHTCTRL 97 +#define KEY_KPSLASH 98 +#define KEY_SYSRQ 99 +#define KEY_RIGHTALT 100 +#define KEY_LINEFEED 101 +#define KEY_HOME 102 +#define KEY_UP 103 +#define KEY_PAGEUP 104 +#define KEY_LEFT 105 +#define KEY_RIGHT 106 +#define KEY_END 107 +#define KEY_DOWN 108 +#define KEY_PAGEDOWN 109 +#define KEY_INSERT 110 +#define KEY_DELETE 111 +#define KEY_MACRO 112 +#define KEY_MUTE 113 +#define KEY_VOLUMEDOWN 114 +#define KEY_VOLUMEUP 115 +#define KEY_POWER 116 /* SC System Power Down */ +#define KEY_KPEQUAL 117 +#define KEY_KPPLUSMINUS 118 +#define KEY_PAUSE 119 +#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ + +#define KEY_KPCOMMA 121 +#define KEY_HANGEUL 122 +#define KEY_HANGUEL KEY_HANGEUL +#define KEY_HANJA 123 +#define KEY_YEN 124 +#define KEY_LEFTMETA 125 +#define KEY_RIGHTMETA 126 +#define KEY_COMPOSE 127 + +#define KEY_STOP 128 /* AC Stop */ +#define KEY_AGAIN 129 +#define KEY_PROPS 130 /* AC Properties */ +#define KEY_UNDO 131 /* AC Undo */ +#define KEY_FRONT 132 +#define KEY_COPY 133 /* AC Copy */ +#define KEY_OPEN 134 /* AC Open */ +#define KEY_PASTE 135 /* AC Paste */ +#define KEY_FIND 136 /* AC Search */ +#define KEY_CUT 137 /* AC Cut */ +#define KEY_HELP 138 /* AL Integrated Help Center */ +#define KEY_MENU 139 /* Menu (show menu) */ +#define KEY_CALC 140 /* AL Calculator */ +#define KEY_SETUP 141 +#define KEY_SLEEP 142 /* SC System Sleep */ +#define KEY_WAKEUP 143 /* System Wake Up */ +#define KEY_FILE 144 /* AL Local Machine Browser */ +#define KEY_SENDFILE 145 +#define KEY_DELETEFILE 146 +#define KEY_XFER 147 +#define KEY_PROG1 148 +#define KEY_PROG2 149 +#define KEY_WWW 150 /* AL Internet Browser */ +#define KEY_MSDOS 151 +#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ +#define KEY_SCREENLOCK KEY_COFFEE +#define KEY_DIRECTION 153 +#define KEY_CYCLEWINDOWS 154 +#define KEY_MAIL 155 +#define KEY_BOOKMARKS 156 /* AC Bookmarks */ +#define KEY_COMPUTER 157 +#define KEY_BACK 158 /* AC Back */ +#define KEY_FORWARD 159 /* AC Forward */ +#define KEY_CLOSECD 160 +#define KEY_EJECTCD 161 +#define KEY_EJECTCLOSECD 162 +#define KEY_NEXTSONG 163 +#define KEY_PLAYPAUSE 164 +#define KEY_PREVIOUSSONG 165 +#define KEY_STOPCD 166 +#define KEY_RECORD 167 +#define KEY_REWIND 168 +#define KEY_PHONE 169 /* Media Select Telephone */ +#define KEY_ISO 170 +#define KEY_CONFIG 171 /* AL Consumer Control Configuration */ +#define KEY_HOMEPAGE 172 /* AC Home */ +#define KEY_REFRESH 173 /* AC Refresh */ +#define KEY_EXIT 174 /* AC Exit */ +#define KEY_MOVE 175 +#define KEY_EDIT 176 +#define KEY_SCROLLUP 177 +#define KEY_SCROLLDOWN 178 +#define KEY_KPLEFTPAREN 179 +#define KEY_KPRIGHTPAREN 180 +#define KEY_NEW 181 /* AC New */ +#define KEY_REDO 182 /* AC Redo/Repeat */ + +#define KEY_F13 183 +#define KEY_F14 184 +#define KEY_F15 185 +#define KEY_F16 186 +#define KEY_F17 187 +#define KEY_F18 188 +#define KEY_F19 189 +#define KEY_F20 190 +#define KEY_F21 191 +#define KEY_F22 192 +#define KEY_F23 193 +#define KEY_F24 194 + +#define KEY_PLAYCD 200 +#define KEY_PAUSECD 201 +#define KEY_PROG3 202 +#define KEY_PROG4 203 +#define KEY_DASHBOARD 204 /* AL Dashboard */ +#define KEY_SUSPEND 205 +#define KEY_CLOSE 206 /* AC Close */ +#define KEY_PLAY 207 +#define KEY_FASTFORWARD 208 +#define KEY_BASSBOOST 209 +#define KEY_PRINT 210 /* AC Print */ +#define KEY_HP 211 +#define KEY_CAMERA 212 +#define KEY_SOUND 213 +#define KEY_QUESTION 214 +#define KEY_EMAIL 215 +#define KEY_CHAT 216 +#define KEY_SEARCH 217 +#define KEY_CONNECT 218 +#define KEY_FINANCE 219 /* AL Checkbook/Finance */ +#define KEY_SPORT 220 +#define KEY_SHOP 221 +#define KEY_ALTERASE 222 +#define KEY_CANCEL 223 /* AC Cancel */ +#define KEY_BRIGHTNESSDOWN 224 +#define KEY_BRIGHTNESSUP 225 +#define KEY_MEDIA 226 + +#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video + outputs (Monitor/LCD/TV-out/etc) */ +#define KEY_KBDILLUMTOGGLE 228 +#define KEY_KBDILLUMDOWN 229 +#define KEY_KBDILLUMUP 230 + +#define KEY_SEND 231 /* AC Send */ +#define KEY_REPLY 232 /* AC Reply */ +#define KEY_FORWARDMAIL 233 /* AC Forward Msg */ +#define KEY_SAVE 234 /* AC Save */ +#define KEY_DOCUMENTS 235 + +#define KEY_BATTERY 236 + +#define KEY_BLUETOOTH 237 +#define KEY_WLAN 238 +#define KEY_UWB 239 + +#define KEY_UNKNOWN 240 + +#define KEY_VIDEO_NEXT 241 /* drive next video source */ +#define KEY_VIDEO_PREV 242 /* drive previous video source */ +#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ +#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */ +#define KEY_DISPLAY_OFF 245 /* display device to off state */ + +#define KEY_WIMAX 246 + +/* Range 248 - 255 is reserved for special needs of AT keyboard driver */ + +#define BTN_MISC 0x100 +#define BTN_0 0x100 +#define BTN_1 0x101 +#define BTN_2 0x102 +#define BTN_3 0x103 +#define BTN_4 0x104 +#define BTN_5 0x105 +#define BTN_6 0x106 +#define BTN_7 0x107 +#define BTN_8 0x108 +#define BTN_9 0x109 + +#define BTN_MOUSE 0x110 +#define BTN_LEFT 0x110 +#define BTN_RIGHT 0x111 +#define BTN_MIDDLE 0x112 +#define BTN_SIDE 0x113 +#define BTN_EXTRA 0x114 +#define BTN_FORWARD 0x115 +#define BTN_BACK 0x116 +#define BTN_TASK 0x117 + +#define BTN_JOYSTICK 0x120 +#define BTN_TRIGGER 0x120 +#define BTN_THUMB 0x121 +#define BTN_THUMB2 0x122 +#define BTN_TOP 0x123 +#define BTN_TOP2 0x124 +#define BTN_PINKIE 0x125 +#define BTN_BASE 0x126 +#define BTN_BASE2 0x127 +#define BTN_BASE3 0x128 +#define BTN_BASE4 0x129 +#define BTN_BASE5 0x12a +#define BTN_BASE6 0x12b +#define BTN_DEAD 0x12f + +#define BTN_GAMEPAD 0x130 +#define BTN_A 0x130 +#define BTN_B 0x131 +#define BTN_C 0x132 +#define BTN_X 0x133 +#define BTN_Y 0x134 +#define BTN_Z 0x135 +#define BTN_TL 0x136 +#define BTN_TR 0x137 +#define BTN_TL2 0x138 +#define BTN_TR2 0x139 +#define BTN_SELECT 0x13a +#define BTN_START 0x13b +#define BTN_MODE 0x13c +#define BTN_THUMBL 0x13d +#define BTN_THUMBR 0x13e + +#define BTN_DIGI 0x140 +#define BTN_TOOL_PEN 0x140 +#define BTN_TOOL_RUBBER 0x141 +#define BTN_TOOL_BRUSH 0x142 +#define BTN_TOOL_PENCIL 0x143 +#define BTN_TOOL_AIRBRUSH 0x144 +#define BTN_TOOL_FINGER 0x145 +#define BTN_TOOL_MOUSE 0x146 +#define BTN_TOOL_LENS 0x147 +#define BTN_TOUCH 0x14a +#define BTN_STYLUS 0x14b +#define BTN_STYLUS2 0x14c +#define BTN_TOOL_DOUBLETAP 0x14d +#define BTN_TOOL_TRIPLETAP 0x14e +#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ + +#define BTN_WHEEL 0x150 +#define BTN_GEAR_DOWN 0x150 +#define BTN_GEAR_UP 0x151 + +#define KEY_OK 0x160 +#define KEY_SELECT 0x161 +#define KEY_GOTO 0x162 +#define KEY_CLEAR 0x163 +#define KEY_POWER2 0x164 +#define KEY_OPTION 0x165 +#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ +#define KEY_TIME 0x167 +#define KEY_VENDOR 0x168 +#define KEY_ARCHIVE 0x169 +#define KEY_PROGRAM 0x16a /* Media Select Program Guide */ +#define KEY_CHANNEL 0x16b +#define KEY_FAVORITES 0x16c +#define KEY_EPG 0x16d +#define KEY_PVR 0x16e /* Media Select Home */ +#define KEY_MHP 0x16f +#define KEY_LANGUAGE 0x170 +#define KEY_TITLE 0x171 +#define KEY_SUBTITLE 0x172 +#define KEY_ANGLE 0x173 +#define KEY_ZOOM 0x174 +#define KEY_MODE 0x175 +#define KEY_KEYBOARD 0x176 +#define KEY_SCREEN 0x177 +#define KEY_PC 0x178 /* Media Select Computer */ +#define KEY_TV 0x179 /* Media Select TV */ +#define KEY_TV2 0x17a /* Media Select Cable */ +#define KEY_VCR 0x17b /* Media Select VCR */ +#define KEY_VCR2 0x17c /* VCR Plus */ +#define KEY_SAT 0x17d /* Media Select Satellite */ +#define KEY_SAT2 0x17e +#define KEY_CD 0x17f /* Media Select CD */ +#define KEY_TAPE 0x180 /* Media Select Tape */ +#define KEY_RADIO 0x181 +#define KEY_TUNER 0x182 /* Media Select Tuner */ +#define KEY_PLAYER 0x183 +#define KEY_TEXT 0x184 +#define KEY_DVD 0x185 /* Media Select DVD */ +#define KEY_AUX 0x186 +#define KEY_MP3 0x187 +#define KEY_AUDIO 0x188 +#define KEY_VIDEO 0x189 +#define KEY_DIRECTORY 0x18a +#define KEY_LIST 0x18b +#define KEY_MEMO 0x18c /* Media Select Messages */ +#define KEY_CALENDAR 0x18d +#define KEY_RED 0x18e +#define KEY_GREEN 0x18f +#define KEY_YELLOW 0x190 +#define KEY_BLUE 0x191 +#define KEY_CHANNELUP 0x192 /* Channel Increment */ +#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */ +#define KEY_FIRST 0x194 +#define KEY_LAST 0x195 /* Recall Last */ +#define KEY_AB 0x196 +#define KEY_NEXT 0x197 +#define KEY_RESTART 0x198 +#define KEY_SLOW 0x199 +#define KEY_SHUFFLE 0x19a +#define KEY_BREAK 0x19b +#define KEY_PREVIOUS 0x19c +#define KEY_DIGITS 0x19d +#define KEY_TEEN 0x19e +#define KEY_TWEN 0x19f +#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */ +#define KEY_GAMES 0x1a1 /* Media Select Games */ +#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */ +#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */ +#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */ +#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */ +#define KEY_EDITOR 0x1a6 /* AL Text Editor */ +#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */ +#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */ +#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */ +#define KEY_DATABASE 0x1aa /* AL Database App */ +#define KEY_NEWS 0x1ab /* AL Newsreader */ +#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */ +#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ +#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ +#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ +#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ +#define KEY_LOGOFF 0x1b1 /* AL Logoff */ + +#define KEY_DOLLAR 0x1b2 +#define KEY_EURO 0x1b3 + +#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ +#define KEY_FRAMEFORWARD 0x1b5 +#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ +#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ + +#define KEY_DEL_EOL 0x1c0 +#define KEY_DEL_EOS 0x1c1 +#define KEY_INS_LINE 0x1c2 +#define KEY_DEL_LINE 0x1c3 + +#define KEY_FN 0x1d0 +#define KEY_FN_ESC 0x1d1 +#define KEY_FN_F1 0x1d2 +#define KEY_FN_F2 0x1d3 +#define KEY_FN_F3 0x1d4 +#define KEY_FN_F4 0x1d5 +#define KEY_FN_F5 0x1d6 +#define KEY_FN_F6 0x1d7 +#define KEY_FN_F7 0x1d8 +#define KEY_FN_F8 0x1d9 +#define KEY_FN_F9 0x1da +#define KEY_FN_F10 0x1db +#define KEY_FN_F11 0x1dc +#define KEY_FN_F12 0x1dd +#define KEY_FN_1 0x1de +#define KEY_FN_2 0x1df +#define KEY_FN_D 0x1e0 +#define KEY_FN_E 0x1e1 +#define KEY_FN_F 0x1e2 +#define KEY_FN_S 0x1e3 +#define KEY_FN_B 0x1e4 + +#define KEY_BRL_DOT1 0x1f1 +#define KEY_BRL_DOT2 0x1f2 +#define KEY_BRL_DOT3 0x1f3 +#define KEY_BRL_DOT4 0x1f4 +#define KEY_BRL_DOT5 0x1f5 +#define KEY_BRL_DOT6 0x1f6 +#define KEY_BRL_DOT7 0x1f7 +#define KEY_BRL_DOT8 0x1f8 +#define KEY_BRL_DOT9 0x1f9 +#define KEY_BRL_DOT10 0x1fa + +#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ +#define KEY_NUMERIC_1 0x201 /* and other keypads */ +#define KEY_NUMERIC_2 0x202 +#define KEY_NUMERIC_3 0x203 +#define KEY_NUMERIC_4 0x204 +#define KEY_NUMERIC_5 0x205 +#define KEY_NUMERIC_6 0x206 +#define KEY_NUMERIC_7 0x207 +#define KEY_NUMERIC_8 0x208 +#define KEY_NUMERIC_9 0x209 +#define KEY_NUMERIC_STAR 0x20a +#define KEY_NUMERIC_POUND 0x20b + +/* We avoid low common keys in module aliases so they don't get huge. */ +#define KEY_MIN_INTERESTING KEY_MUTE +#define KEY_MAX 0x2ff +#define KEY_CNT (KEY_MAX+1) + +/* + * Relative axes + */ + +#define REL_X 0x00 +#define REL_Y 0x01 +#define REL_Z 0x02 +#define REL_RX 0x03 +#define REL_RY 0x04 +#define REL_RZ 0x05 +#define REL_HWHEEL 0x06 +#define REL_DIAL 0x07 +#define REL_WHEEL 0x08 +#define REL_MISC 0x09 +#define REL_MAX 0x0f +#define REL_CNT (REL_MAX+1) + +/* + * Absolute axes + */ + +#define ABS_X 0x00 +#define ABS_Y 0x01 +#define ABS_Z 0x02 +#define ABS_RX 0x03 +#define ABS_RY 0x04 +#define ABS_RZ 0x05 +#define ABS_THROTTLE 0x06 +#define ABS_RUDDER 0x07 +#define ABS_WHEEL 0x08 +#define ABS_GAS 0x09 +#define ABS_BRAKE 0x0a +#define ABS_HAT0X 0x10 +#define ABS_HAT0Y 0x11 +#define ABS_HAT1X 0x12 +#define ABS_HAT1Y 0x13 +#define ABS_HAT2X 0x14 +#define ABS_HAT2Y 0x15 +#define ABS_HAT3X 0x16 +#define ABS_HAT3Y 0x17 +#define ABS_PRESSURE 0x18 +#define ABS_DISTANCE 0x19 +#define ABS_TILT_X 0x1a +#define ABS_TILT_Y 0x1b +#define ABS_TOOL_WIDTH 0x1c +#define ABS_VOLUME 0x20 +#define ABS_MISC 0x28 + +#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ +#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ +#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ +#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ +#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ +#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */ +#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ +#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ +#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ +#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ + +#define ABS_MAX 0x3f +#define ABS_CNT (ABS_MAX+1) + +/* + * Switch events + */ + +#define SW_LID 0x00 /* set = lid shut */ +#define SW_TABLET_MODE 0x01 /* set = tablet mode */ +#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ +#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" + set = radio enabled */ +#define SW_RADIO SW_RFKILL_ALL /* deprecated */ +#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ +#define SW_DOCK 0x05 /* set = plugged into dock */ +#define SW_LINEOUT_INSERT 0x06 /* set = inserted */ +#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ +#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ +#define SW_MAX 0x0f +#define SW_CNT (SW_MAX+1) + +/* + * Misc events + */ + +#define MSC_SERIAL 0x00 +#define MSC_PULSELED 0x01 +#define MSC_GESTURE 0x02 +#define MSC_RAW 0x03 +#define MSC_SCAN 0x04 +#define MSC_MAX 0x07 +#define MSC_CNT (MSC_MAX+1) + +/* + * LEDs + */ + +#define LED_NUML 0x00 +#define LED_CAPSL 0x01 +#define LED_SCROLLL 0x02 +#define LED_COMPOSE 0x03 +#define LED_KANA 0x04 +#define LED_SLEEP 0x05 +#define LED_SUSPEND 0x06 +#define LED_MUTE 0x07 +#define LED_MISC 0x08 +#define LED_MAIL 0x09 +#define LED_CHARGING 0x0a +#define LED_MAX 0x0f +#define LED_CNT (LED_MAX+1) + +/* + * Autorepeat values + */ + +#define REP_DELAY 0x00 +#define REP_PERIOD 0x01 +#define REP_MAX 0x01 + +/* + * Sounds + */ + +#define SND_CLICK 0x00 +#define SND_BELL 0x01 +#define SND_TONE 0x02 +#define SND_MAX 0x07 +#define SND_CNT (SND_MAX+1) + +/* + * IDs. + */ + +#define ID_BUS 0 +#define ID_VENDOR 1 +#define ID_PRODUCT 2 +#define ID_VERSION 3 + +#define BUS_PCI 0x01 +#define BUS_ISAPNP 0x02 +#define BUS_USB 0x03 +#define BUS_HIL 0x04 +#define BUS_BLUETOOTH 0x05 +#define BUS_VIRTUAL 0x06 + +#define BUS_ISA 0x10 +#define BUS_I8042 0x11 +#define BUS_XTKBD 0x12 +#define BUS_RS232 0x13 +#define BUS_GAMEPORT 0x14 +#define BUS_PARPORT 0x15 +#define BUS_AMIGA 0x16 +#define BUS_ADB 0x17 +#define BUS_I2C 0x18 +#define BUS_HOST 0x19 +#define BUS_GSC 0x1A +#define BUS_ATARI 0x1B + +/* + * MT_TOOL types + */ +#define MT_TOOL_FINGER 0 +#define MT_TOOL_PEN 1 + +/* + * Values describing the status of a force-feedback effect + */ +#define FF_STATUS_STOPPED 0x00 +#define FF_STATUS_PLAYING 0x01 +#define FF_STATUS_MAX 0x01 + +/* + * Structures used in ioctls to upload effects to a device + * They are pieces of a bigger structure (called ff_effect) + */ + +/* + * All duration values are expressed in ms. Values above 32767 ms (0x7fff) + * should not be used and have unspecified results. + */ + +/** + * struct ff_replay - defines scheduling of the force-feedback effect + * @length: duration of the effect + * @delay: delay before effect should start playing + */ +struct ff_replay { + __u16 length; + __u16 delay; +}; + +/** + * struct ff_trigger - defines what triggers the force-feedback effect + * @button: number of the button triggering the effect + * @interval: controls how soon the effect can be re-triggered + */ +struct ff_trigger { + __u16 button; + __u16 interval; +}; + +/** + * struct ff_envelope - generic force-feedback effect envelope + * @attack_length: duration of the attack (ms) + * @attack_level: level at the beginning of the attack + * @fade_length: duration of fade (ms) + * @fade_level: level at the end of fade + * + * The @attack_level and @fade_level are absolute values; when applying + * envelope force-feedback core will convert to positive/negative + * value based on polarity of the default level of the effect. + * Valid range for the attack and fade levels is 0x0000 - 0x7fff + */ +struct ff_envelope { + __u16 attack_length; + __u16 attack_level; + __u16 fade_length; + __u16 fade_level; +}; + +/** + * struct ff_constant_effect - defines parameters of a constant force-feedback effect + * @level: strength of the effect; may be negative + * @envelope: envelope data + */ +struct ff_constant_effect { + __s16 level; + struct ff_envelope envelope; +}; + +/** + * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect + * @start_level: beginning strength of the effect; may be negative + * @end_level: final strength of the effect; may be negative + * @envelope: envelope data + */ +struct ff_ramp_effect { + __s16 start_level; + __s16 end_level; + struct ff_envelope envelope; +}; + +/** + * struct ff_condition_effect - defines a spring or friction force-feedback effect + * @right_saturation: maximum level when joystick moved all way to the right + * @left_saturation: same for the left side + * @right_coeff: controls how fast the force grows when the joystick moves + * to the right + * @left_coeff: same for the left side + * @deadband: size of the dead zone, where no force is produced + * @center: position of the dead zone + */ +struct ff_condition_effect { + __u16 right_saturation; + __u16 left_saturation; + + __s16 right_coeff; + __s16 left_coeff; + + __u16 deadband; + __s16 center; +}; + +/** + * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect + * @waveform: kind of the effect (wave) + * @period: period of the wave (ms) + * @magnitude: peak value + * @offset: mean value of the wave (roughly) + * @phase: 'horizontal' shift + * @envelope: envelope data + * @custom_len: number of samples (FF_CUSTOM only) + * @custom_data: buffer of samples (FF_CUSTOM only) + * + * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP, + * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined + * for the time being as no driver supports it yet. + * + * Note: the data pointed by custom_data is copied by the driver. + * You can therefore dispose of the memory after the upload/update. + */ +struct ff_periodic_effect { + __u16 waveform; + __u16 period; + __s16 magnitude; + __s16 offset; + __u16 phase; + + struct ff_envelope envelope; + + __u32 custom_len; + __s16 *custom_data; +}; + +/** + * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect + * @strong_magnitude: magnitude of the heavy motor + * @weak_magnitude: magnitude of the light one + * + * Some rumble pads have two motors of different weight. Strong_magnitude + * represents the magnitude of the vibration generated by the heavy one. + */ +struct ff_rumble_effect { + __u16 strong_magnitude; + __u16 weak_magnitude; +}; + +/** + * struct ff_effect - defines force feedback effect + * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING, + * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM) + * @id: an unique id assigned to an effect + * @direction: direction of the effect + * @trigger: trigger conditions (struct ff_trigger) + * @replay: scheduling of the effect (struct ff_replay) + * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect, + * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further + * defining effect parameters + * + * This structure is sent through ioctl from the application to the driver. + * To create a new effect application should set its @id to -1; the kernel + * will return assigned @id which can later be used to update or delete + * this effect. + * + * Direction of the effect is encoded as follows: + * 0 deg -> 0x0000 (down) + * 90 deg -> 0x4000 (left) + * 180 deg -> 0x8000 (up) + * 270 deg -> 0xC000 (right) + */ +struct ff_effect { + __u16 type; + __s16 id; + __u16 direction; + struct ff_trigger trigger; + struct ff_replay replay; + + union { + struct ff_constant_effect constant; + struct ff_ramp_effect ramp; + struct ff_periodic_effect periodic; + struct ff_condition_effect condition[2]; /* One for each axis */ + struct ff_rumble_effect rumble; + } u; +}; + +/* + * Force feedback effect types + */ + +#define FF_RUMBLE 0x50 +#define FF_PERIODIC 0x51 +#define FF_CONSTANT 0x52 +#define FF_SPRING 0x53 +#define FF_FRICTION 0x54 +#define FF_DAMPER 0x55 +#define FF_INERTIA 0x56 +#define FF_RAMP 0x57 + +#define FF_EFFECT_MIN FF_RUMBLE +#define FF_EFFECT_MAX FF_RAMP + +/* + * Force feedback periodic effect types + */ + +#define FF_SQUARE 0x58 +#define FF_TRIANGLE 0x59 +#define FF_SINE 0x5a +#define FF_SAW_UP 0x5b +#define FF_SAW_DOWN 0x5c +#define FF_CUSTOM 0x5d + +#define FF_WAVEFORM_MIN FF_SQUARE +#define FF_WAVEFORM_MAX FF_CUSTOM + +/* + * Set ff device properties + */ + +#define FF_GAIN 0x60 +#define FF_AUTOCENTER 0x61 + +#define FF_MAX 0x7f +#define FF_CNT (FF_MAX+1) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ioctl.h new file mode 100644 index 0000000..aa91eb3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ioctl.h @@ -0,0 +1,7 @@ +#ifndef _LINUX_IOCTL_H +#define _LINUX_IOCTL_H + +#include + +#endif /* _LINUX_IOCTL_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip.h new file mode 100644 index 0000000..56f472a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip.h @@ -0,0 +1,136 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the IP protocol. + * + * Version: @(#)ip.h 1.0.2 04/28/93 + * + * Authors: Fred N. van Kempen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_IP_H +#define _LINUX_IP_H +#include +#include + +#define IPTOS_TOS_MASK 0x1E +#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_MINCOST 0x02 + +#define IPTOS_PREC_MASK 0xE0 +#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + + +/* IP options */ +#define IPOPT_COPY 0x80 +#define IPOPT_CLASS_MASK 0x60 +#define IPOPT_NUMBER_MASK 0x1f + +#define IPOPT_COPIED(o) ((o)&IPOPT_COPY) +#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) +#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_MEASUREMENT 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_END (0 |IPOPT_CONTROL) +#define IPOPT_NOOP (1 |IPOPT_CONTROL) +#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) +#define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_RR (7 |IPOPT_CONTROL) +#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) + +#define IPVERSION 4 +#define MAXTTL 255 +#define IPDEFTTL 64 + +#define IPOPT_OPTVAL 0 +#define IPOPT_OLEN 1 +#define IPOPT_OFFSET 2 +#define IPOPT_MINOFF 4 +#define MAX_IPOPTLEN 40 +#define IPOPT_NOP IPOPT_NOOP +#define IPOPT_EOL IPOPT_END +#define IPOPT_TS IPOPT_TIMESTAMP + +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 3 /* specified modules only */ + +#define IPV4_BEET_PHMAXLEN 8 + +struct iphdr { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 ihl:4, + version:4; +#elif defined (__BIG_ENDIAN_BITFIELD) + __u8 version:4, + ihl:4; +#else +#error "Please fix " +#endif + __u8 tos; + __be16 tot_len; + __be16 id; + __be16 frag_off; + __u8 ttl; + __u8 protocol; + __sum16 check; + __be32 saddr; + __be32 daddr; + /*The options start here. */ +}; + + +struct ip_auth_hdr { + __u8 nexthdr; + __u8 hdrlen; /* This one is measured in 32 bit units! */ + __be16 reserved; + __be32 spi; + __be32 seq_no; /* Sequence number */ + __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ +}; + +struct ip_esp_hdr { + __be32 spi; + __be32 seq_no; /* Sequence number */ + __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ +}; + +struct ip_comp_hdr { + __u8 nexthdr; + __u8 flags; + __be16 cpi; +}; + +struct ip_beet_phdr { + __u8 nexthdr; + __u8 hdrlen; + __u8 padlen; + __u8 reserved; +}; + +#endif /* _LINUX_IP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip6_tunnel.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip6_tunnel.h new file mode 100644 index 0000000..acb9ad6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip6_tunnel.h @@ -0,0 +1,32 @@ +#ifndef _IP6_TUNNEL_H +#define _IP6_TUNNEL_H + +#include + +#define IPV6_TLV_TNL_ENCAP_LIMIT 4 +#define IPV6_DEFAULT_TNL_ENCAP_LIMIT 4 + +/* don't add encapsulation limit if one isn't present in inner packet */ +#define IP6_TNL_F_IGN_ENCAP_LIMIT 0x1 +/* copy the traffic class field from the inner packet */ +#define IP6_TNL_F_USE_ORIG_TCLASS 0x2 +/* copy the flowlabel from the inner packet */ +#define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 +/* being used for Mobile IPv6 */ +#define IP6_TNL_F_MIP6_DEV 0x8 +/* copy DSCP from the outer packet */ +#define IP6_TNL_F_RCV_DSCP_COPY 0x10 + +struct ip6_tnl_parm { + char name[IFNAMSIZ]; /* name of tunnel device */ + int link; /* ifindex of underlying L2 interface */ + __u8 proto; /* tunnel protocol */ + __u8 encap_limit; /* encapsulation limit for tunnel */ + __u8 hop_limit; /* hop limit for tunnel */ + __be32 flowinfo; /* traffic class and flowlabel for tunnel */ + __u32 flags; /* tunnel flags */ + struct in6_addr laddr; /* local tunnel end-point address */ + struct in6_addr raddr; /* remote tunnel end-point address */ +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip_vs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip_vs.h new file mode 100644 index 0000000..148265e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ip_vs.h @@ -0,0 +1,405 @@ +/* + * IP Virtual Server + * data structure and functionality definitions + */ + +#ifndef _IP_VS_H +#define _IP_VS_H + +#include /* For __beXX types in userland */ + +#define IP_VS_VERSION_CODE 0x010201 +#define NVERSION(version) \ + (version >> 16) & 0xFF, \ + (version >> 8) & 0xFF, \ + version & 0xFF + +/* + * Virtual Service Flags + */ +#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ +#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ + +/* + * Destination Server Flags + */ +#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */ +#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */ + +/* + * IPVS sync daemon states + */ +#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */ +#define IP_VS_STATE_MASTER 0x0001 /* started as master */ +#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */ + +/* + * IPVS socket options + */ +#define IP_VS_BASE_CTL (64+1024+64) /* base */ + +#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */ +#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1) +#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2) +#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3) +#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4) +#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5) +#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6) +#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7) +#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8) +#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9) +#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10) +#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11) +#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12) +#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13) +#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14) +#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15) +#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO + +#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL +#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1) +#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2) +#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3) +#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4) +#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */ +#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6) +#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7) +#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON + + +/* + * IPVS Connection Flags + */ +#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */ +#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */ +#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */ +#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */ +#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */ +#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */ +#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */ +#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */ +#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */ +#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */ +#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */ +#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */ +#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */ +#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */ +#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ + +#define IP_VS_SCHEDNAME_MAXLEN 16 +#define IP_VS_IFNAME_MAXLEN 16 + + +/* + * The struct ip_vs_service_user and struct ip_vs_dest_user are + * used to set IPVS rules through setsockopt. + */ +struct ip_vs_service_user { + /* virtual service addresses */ + __u16 protocol; + __be32 addr; /* virtual ip address */ + __be16 port; + __u32 fwmark; /* firwall mark of service */ + + /* virtual service options */ + char sched_name[IP_VS_SCHEDNAME_MAXLEN]; + unsigned flags; /* virtual service flags */ + unsigned timeout; /* persistent timeout in sec */ + __be32 netmask; /* persistent netmask */ +}; + + +struct ip_vs_dest_user { + /* destination server address */ + __be32 addr; + __be16 port; + + /* real server options */ + unsigned conn_flags; /* connection flags */ + int weight; /* destination weight */ + + /* thresholds for active connections */ + __u32 u_threshold; /* upper threshold */ + __u32 l_threshold; /* lower threshold */ +}; + + +/* + * IPVS statistics object (for user space) + */ +struct ip_vs_stats_user +{ + __u32 conns; /* connections scheduled */ + __u32 inpkts; /* incoming packets */ + __u32 outpkts; /* outgoing packets */ + __u64 inbytes; /* incoming bytes */ + __u64 outbytes; /* outgoing bytes */ + + __u32 cps; /* current connection rate */ + __u32 inpps; /* current in packet rate */ + __u32 outpps; /* current out packet rate */ + __u32 inbps; /* current in byte rate */ + __u32 outbps; /* current out byte rate */ +}; + + +/* The argument to IP_VS_SO_GET_INFO */ +struct ip_vs_getinfo { + /* version number */ + unsigned int version; + + /* size of connection hash table */ + unsigned int size; + + /* number of virtual services */ + unsigned int num_services; +}; + + +/* The argument to IP_VS_SO_GET_SERVICE */ +struct ip_vs_service_entry { + /* which service: user fills in these */ + __u16 protocol; + __be32 addr; /* virtual address */ + __be16 port; + __u32 fwmark; /* firwall mark of service */ + + /* service options */ + char sched_name[IP_VS_SCHEDNAME_MAXLEN]; + unsigned flags; /* virtual service flags */ + unsigned timeout; /* persistent timeout */ + __be32 netmask; /* persistent netmask */ + + /* number of real servers */ + unsigned int num_dests; + + /* statistics */ + struct ip_vs_stats_user stats; +}; + + +struct ip_vs_dest_entry { + __be32 addr; /* destination address */ + __be16 port; + unsigned conn_flags; /* connection flags */ + int weight; /* destination weight */ + + __u32 u_threshold; /* upper threshold */ + __u32 l_threshold; /* lower threshold */ + + __u32 activeconns; /* active connections */ + __u32 inactconns; /* inactive connections */ + __u32 persistconns; /* persistent connections */ + + /* statistics */ + struct ip_vs_stats_user stats; +}; + + +/* The argument to IP_VS_SO_GET_DESTS */ +struct ip_vs_get_dests { + /* which service: user fills in these */ + __u16 protocol; + __be32 addr; /* virtual address */ + __be16 port; + __u32 fwmark; /* firwall mark of service */ + + /* number of real servers */ + unsigned int num_dests; + + /* the real servers */ + struct ip_vs_dest_entry entrytable[0]; +}; + + +/* The argument to IP_VS_SO_GET_SERVICES */ +struct ip_vs_get_services { + /* number of virtual services */ + unsigned int num_services; + + /* service table */ + struct ip_vs_service_entry entrytable[0]; +}; + + +/* The argument to IP_VS_SO_GET_TIMEOUT */ +struct ip_vs_timeout_user { + int tcp_timeout; + int tcp_fin_timeout; + int udp_timeout; +}; + + +/* The argument to IP_VS_SO_GET_DAEMON */ +struct ip_vs_daemon_user { + /* sync daemon state (master/backup) */ + int state; + + /* multicast interface name */ + char mcast_ifn[IP_VS_IFNAME_MAXLEN]; + + /* SyncID we belong to */ + int syncid; +}; + +/* + * + * IPVS Generic Netlink interface definitions + * + */ + +/* Generic Netlink family info */ + +#define IPVS_GENL_NAME "IPVS" +#define IPVS_GENL_VERSION 0x1 + +struct ip_vs_flags { + __be32 flags; + __be32 mask; +}; + +/* Generic Netlink command attributes */ +enum { + IPVS_CMD_UNSPEC = 0, + + IPVS_CMD_NEW_SERVICE, /* add service */ + IPVS_CMD_SET_SERVICE, /* modify service */ + IPVS_CMD_DEL_SERVICE, /* delete service */ + IPVS_CMD_GET_SERVICE, /* get service info */ + + IPVS_CMD_NEW_DEST, /* add destination */ + IPVS_CMD_SET_DEST, /* modify destination */ + IPVS_CMD_DEL_DEST, /* delete destination */ + IPVS_CMD_GET_DEST, /* get destination info */ + + IPVS_CMD_NEW_DAEMON, /* start sync daemon */ + IPVS_CMD_DEL_DAEMON, /* stop sync daemon */ + IPVS_CMD_GET_DAEMON, /* get sync daemon status */ + + IPVS_CMD_SET_CONFIG, /* set config settings */ + IPVS_CMD_GET_CONFIG, /* get config settings */ + + IPVS_CMD_SET_INFO, /* only used in GET_INFO reply */ + IPVS_CMD_GET_INFO, /* get general IPVS info */ + + IPVS_CMD_ZERO, /* zero all counters and stats */ + IPVS_CMD_FLUSH, /* flush services and dests */ + + __IPVS_CMD_MAX, +}; + +#define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1) + +/* Attributes used in the first level of commands */ +enum { + IPVS_CMD_ATTR_UNSPEC = 0, + IPVS_CMD_ATTR_SERVICE, /* nested service attribute */ + IPVS_CMD_ATTR_DEST, /* nested destination attribute */ + IPVS_CMD_ATTR_DAEMON, /* nested sync daemon attribute */ + IPVS_CMD_ATTR_TIMEOUT_TCP, /* TCP connection timeout */ + IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, /* TCP FIN wait timeout */ + IPVS_CMD_ATTR_TIMEOUT_UDP, /* UDP timeout */ + __IPVS_CMD_ATTR_MAX, +}; + +#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) + +/* + * Attributes used to describe a service + * + * Used inside nested attribute IPVS_CMD_ATTR_SERVICE + */ +enum { + IPVS_SVC_ATTR_UNSPEC = 0, + IPVS_SVC_ATTR_AF, /* address family */ + IPVS_SVC_ATTR_PROTOCOL, /* virtual service protocol */ + IPVS_SVC_ATTR_ADDR, /* virtual service address */ + IPVS_SVC_ATTR_PORT, /* virtual service port */ + IPVS_SVC_ATTR_FWMARK, /* firewall mark of service */ + + IPVS_SVC_ATTR_SCHED_NAME, /* name of scheduler */ + IPVS_SVC_ATTR_FLAGS, /* virtual service flags */ + IPVS_SVC_ATTR_TIMEOUT, /* persistent timeout */ + IPVS_SVC_ATTR_NETMASK, /* persistent netmask */ + + IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */ + __IPVS_SVC_ATTR_MAX, +}; + +#define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) + +/* + * Attributes used to describe a destination (real server) + * + * Used inside nested attribute IPVS_CMD_ATTR_DEST + */ +enum { + IPVS_DEST_ATTR_UNSPEC = 0, + IPVS_DEST_ATTR_ADDR, /* real server address */ + IPVS_DEST_ATTR_PORT, /* real server port */ + + IPVS_DEST_ATTR_FWD_METHOD, /* forwarding method */ + IPVS_DEST_ATTR_WEIGHT, /* destination weight */ + + IPVS_DEST_ATTR_U_THRESH, /* upper threshold */ + IPVS_DEST_ATTR_L_THRESH, /* lower threshold */ + + IPVS_DEST_ATTR_ACTIVE_CONNS, /* active connections */ + IPVS_DEST_ATTR_INACT_CONNS, /* inactive connections */ + IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */ + + IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */ + __IPVS_DEST_ATTR_MAX, +}; + +#define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1) + +/* + * Attributes describing a sync daemon + * + * Used inside nested attribute IPVS_CMD_ATTR_DAEMON + */ +enum { + IPVS_DAEMON_ATTR_UNSPEC = 0, + IPVS_DAEMON_ATTR_STATE, /* sync daemon state (master/backup) */ + IPVS_DAEMON_ATTR_MCAST_IFN, /* multicast interface name */ + IPVS_DAEMON_ATTR_SYNC_ID, /* SyncID we belong to */ + __IPVS_DAEMON_ATTR_MAX, +}; + +#define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1) + +/* + * Attributes used to describe service or destination entry statistics + * + * Used inside nested attributes IPVS_SVC_ATTR_STATS and IPVS_DEST_ATTR_STATS + */ +enum { + IPVS_STATS_ATTR_UNSPEC = 0, + IPVS_STATS_ATTR_CONNS, /* connections scheduled */ + IPVS_STATS_ATTR_INPKTS, /* incoming packets */ + IPVS_STATS_ATTR_OUTPKTS, /* outgoing packets */ + IPVS_STATS_ATTR_INBYTES, /* incoming bytes */ + IPVS_STATS_ATTR_OUTBYTES, /* outgoing bytes */ + + IPVS_STATS_ATTR_CPS, /* current connection rate */ + IPVS_STATS_ATTR_INPPS, /* current in packet rate */ + IPVS_STATS_ATTR_OUTPPS, /* current out packet rate */ + IPVS_STATS_ATTR_INBPS, /* current in byte rate */ + IPVS_STATS_ATTR_OUTBPS, /* current out byte rate */ + __IPVS_STATS_ATTR_MAX, +}; + +#define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1) + +/* Attributes used in response to IPVS_CMD_GET_INFO command */ +enum { + IPVS_INFO_ATTR_UNSPEC = 0, + IPVS_INFO_ATTR_VERSION, /* IPVS version number */ + IPVS_INFO_ATTR_CONN_TAB_SIZE, /* size of connection hash table */ + __IPVS_INFO_ATTR_MAX, +}; + +#define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1) + +#endif /* _IP_VS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipc.h new file mode 100644 index 0000000..98a53a1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipc.h @@ -0,0 +1,81 @@ +#ifndef _LINUX_IPC_H +#define _LINUX_IPC_H + +#include + +#define IPC_PRIVATE ((__kernel_key_t) 0) + +/* Obsolete, used only for backwards compatibility and libc5 compiles */ +struct ipc_perm +{ + __kernel_key_t key; + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_uid_t cuid; + __kernel_gid_t cgid; + __kernel_mode_t mode; + unsigned short seq; +}; + +/* Include the definition of ipc64_perm */ +#include + +/* resource get request flags */ +#define IPC_CREAT 00001000 /* create if key is nonexistent */ +#define IPC_EXCL 00002000 /* fail if key exists */ +#define IPC_NOWAIT 00004000 /* return error on wait */ + +/* these fields are used by the DIPC package so the kernel as standard + should avoid using them if possible */ + +#define IPC_DIPC 00010000 /* make it distributed */ +#define IPC_OWN 00020000 /* this machine is the DIPC owner */ + +/* + * Control commands used with semctl, msgctl and shmctl + * see also specific commands in sem.h, msg.h and shm.h + */ +#define IPC_RMID 0 /* remove resource */ +#define IPC_SET 1 /* set ipc_perm options */ +#define IPC_STAT 2 /* get ipc_perm options */ +#define IPC_INFO 3 /* see ipcs */ + +/* + * Version flags for semctl, msgctl, and shmctl commands + * These are passed as bitflags or-ed with the actual command + */ +#define IPC_OLD 0 /* Old version (no 32-bit UID support on many + architectures) */ +#define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger + message sizes, etc. */ + +/* + * These are used to wrap system calls. + * + * See architecture code for ugly details.. + */ +struct ipc_kludge { + struct msgbuf *msgp; + long msgtyp; +}; + +#define SEMOP 1 +#define SEMGET 2 +#define SEMCTL 3 +#define SEMTIMEDOP 4 +#define MSGSND 11 +#define MSGRCV 12 +#define MSGGET 13 +#define MSGCTL 14 +#define SHMAT 21 +#define SHMDT 22 +#define SHMGET 23 +#define SHMCTL 24 + +/* Used by the DIPC package, try and avoid reusing it */ +#define DIPC 25 + +#define IPCCALL(version,op) ((version)<<16 | (op)) + + +#endif /* _LINUX_IPC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipmi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipmi.h new file mode 100644 index 0000000..b9ff672 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipmi.h @@ -0,0 +1,456 @@ +/* + * ipmi.h + * + * MontaVista IPMI interface + * + * Author: MontaVista Software, Inc. + * Corey Minyard + * source@mvista.com + * + * Copyright 2002 MontaVista Software Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __LINUX_IPMI_H +#define __LINUX_IPMI_H + +#include + + +/* + * This file describes an interface to an IPMI driver. You have to + * have a fairly good understanding of IPMI to use this, so go read + * the specs first before actually trying to do anything. + * + * With that said, this driver provides a multi-user interface to the + * IPMI driver, and it allows multiple IPMI physical interfaces below + * the driver. The physical interfaces bind as a lower layer on the + * driver. They appear as interfaces to the application using this + * interface. + * + * Multi-user means that multiple applications may use the driver, + * send commands, receive responses, etc. The driver keeps track of + * commands the user sends and tracks the responses. The responses + * will go back to the application that send the command. If the + * response doesn't come back in time, the driver will return a + * timeout error response to the application. Asynchronous events + * from the BMC event queue will go to all users bound to the driver. + * The incoming event queue in the BMC will automatically be flushed + * if it becomes full and it is queried once a second to see if + * anything is in it. Incoming commands to the driver will get + * delivered as commands. + * + * This driver provides two main interfaces: one for in-kernel + * applications and another for userland applications. The + * capabilities are basically the same for both interface, although + * the interfaces are somewhat different. The stuff in the + * #ifdef __KERNEL__ below is the in-kernel interface. The userland + * interface is defined later in the file. */ + + + +/* + * This is an overlay for all the address types, so it's easy to + * determine the actual address type. This is kind of like addresses + * work for sockets. + */ +#define IPMI_MAX_ADDR_SIZE 32 +struct ipmi_addr { + /* Try to take these from the "Channel Medium Type" table + in section 6.5 of the IPMI 1.5 manual. */ + int addr_type; + short channel; + char data[IPMI_MAX_ADDR_SIZE]; +}; + +/* + * When the address is not used, the type will be set to this value. + * The channel is the BMC's channel number for the channel (usually + * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC. + */ +#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c +struct ipmi_system_interface_addr { + int addr_type; + short channel; + unsigned char lun; +}; + +/* An IPMB Address. */ +#define IPMI_IPMB_ADDR_TYPE 0x01 +/* Used for broadcast get device id as described in section 17.9 of the + IPMI 1.5 manual. */ +#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41 +struct ipmi_ipmb_addr { + int addr_type; + short channel; + unsigned char slave_addr; + unsigned char lun; +}; + +/* + * A LAN Address. This is an address to/from a LAN interface bridged + * by the BMC, not an address actually out on the LAN. + * + * A concious decision was made here to deviate slightly from the IPMI + * spec. We do not use rqSWID and rsSWID like it shows in the + * message. Instead, we use remote_SWID and local_SWID. This means + * that any message (a request or response) from another device will + * always have exactly the same address. If you didn't do this, + * requests and responses from the same device would have different + * addresses, and that's not too cool. + * + * In this address, the remote_SWID is always the SWID the remote + * message came from, or the SWID we are sending the message to. + * local_SWID is always our SWID. Note that having our SWID in the + * message is a little weird, but this is required. + */ +#define IPMI_LAN_ADDR_TYPE 0x04 +struct ipmi_lan_addr { + int addr_type; + short channel; + unsigned char privilege; + unsigned char session_handle; + unsigned char remote_SWID; + unsigned char local_SWID; + unsigned char lun; +}; + + +/* + * Channel for talking directly with the BMC. When using this + * channel, This is for the system interface address type only. FIXME + * - is this right, or should we use -1? + */ +#define IPMI_BMC_CHANNEL 0xf +#define IPMI_NUM_CHANNELS 0x10 + +/* + * Used to signify an "all channel" bitmask. This is more than the + * actual number of channels because this is used in userland and + * will cover us if the number of channels is extended. + */ +#define IPMI_CHAN_ALL (~0) + + +/* + * A raw IPMI message without any addressing. This covers both + * commands and responses. The completion code is always the first + * byte of data in the response (as the spec shows the messages laid + * out). + */ +struct ipmi_msg { + unsigned char netfn; + unsigned char cmd; + unsigned short data_len; + unsigned char *data; +}; + +struct kernel_ipmi_msg { + unsigned char netfn; + unsigned char cmd; + unsigned short data_len; + unsigned char *data; +}; + +/* + * Various defines that are useful for IPMI applications. + */ +#define IPMI_INVALID_CMD_COMPLETION_CODE 0xC1 +#define IPMI_TIMEOUT_COMPLETION_CODE 0xC3 +#define IPMI_UNKNOWN_ERR_COMPLETION_CODE 0xff + + +/* + * Receive types for messages coming from the receive interface. This + * is used for the receive in-kernel interface and in the receive + * IOCTL. + * + * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but + * it allows you to get the message results when you send a response + * message. + */ +#define IPMI_RESPONSE_RECV_TYPE 1 /* A response to a command */ +#define IPMI_ASYNC_EVENT_RECV_TYPE 2 /* Something from the event queue */ +#define IPMI_CMD_RECV_TYPE 3 /* A command from somewhere else */ +#define IPMI_RESPONSE_RESPONSE_TYPE 4 /* The response for + a sent response, giving any + error status for sending the + response. When you send a + response message, this will + be returned. */ +#define IPMI_OEM_RECV_TYPE 5 /* The response for OEM Channels */ + +/* Note that async events and received commands do not have a completion + code as the first byte of the incoming data, unlike a response. */ + + +/* + * Modes for ipmi_set_maint_mode() and the userland IOCTL. The AUTO + * setting is the default and means it will be set on certain + * commands. Hard setting it on and off will override automatic + * operation. + */ +#define IPMI_MAINTENANCE_MODE_AUTO 0 +#define IPMI_MAINTENANCE_MODE_OFF 1 +#define IPMI_MAINTENANCE_MODE_ON 2 + + + +/* + * The userland interface + */ + +/* + * The userland interface for the IPMI driver is a standard character + * device, with each instance of an interface registered as a minor + * number under the major character device. + * + * The read and write calls do not work, to get messages in and out + * requires ioctl calls because of the complexity of the data. select + * and poll do work, so you can wait for input using the file + * descriptor, you just can use read to get it. + * + * In general, you send a command down to the interface and receive + * responses back. You can use the msgid value to correlate commands + * and responses, the driver will take care of figuring out which + * incoming messages are for which command and find the proper msgid + * value to report. You will only receive reponses for commands you + * send. Asynchronous events, however, go to all open users, so you + * must be ready to handle these (or ignore them if you don't care). + * + * The address type depends upon the channel type. When talking + * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored + * (IPMI_UNUSED_ADDR_TYPE). When talking to an IPMB channel, you must + * supply a valid IPMB address with the addr_type set properly. + * + * When talking to normal channels, the driver takes care of the + * details of formatting and sending messages on that channel. You do + * not, for instance, have to format a send command, you just send + * whatever command you want to the channel, the driver will create + * the send command, automatically issue receive command and get even + * commands, and pass those up to the proper user. + */ + + +/* The magic IOCTL value for this interface. */ +#define IPMI_IOC_MAGIC 'i' + + +/* Messages sent to the interface are this format. */ +struct ipmi_req { + unsigned char *addr; /* Address to send the message to. */ + unsigned int addr_len; + + long msgid; /* The sequence number for the message. This + exact value will be reported back in the + response to this request if it is a command. + If it is a response, this will be used as + the sequence value for the response. */ + + struct ipmi_msg msg; +}; +/* + * Send a message to the interfaces. error values are: + * - EFAULT - an address supplied was invalid. + * - EINVAL - The address supplied was not valid, or the command + * was not allowed. + * - EMSGSIZE - The message to was too large. + * - ENOMEM - Buffers could not be allocated for the command. + */ +#define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, \ + struct ipmi_req) + +/* Messages sent to the interface with timing parameters are this + format. */ +struct ipmi_req_settime { + struct ipmi_req req; + + /* See ipmi_request_settime() above for details on these + values. */ + int retries; + unsigned int retry_time_ms; +}; +/* + * Send a message to the interfaces with timing parameters. error values + * are: + * - EFAULT - an address supplied was invalid. + * - EINVAL - The address supplied was not valid, or the command + * was not allowed. + * - EMSGSIZE - The message to was too large. + * - ENOMEM - Buffers could not be allocated for the command. + */ +#define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, \ + struct ipmi_req_settime) + +/* Messages received from the interface are this format. */ +struct ipmi_recv { + int recv_type; /* Is this a command, response or an + asyncronous event. */ + + unsigned char *addr; /* Address the message was from is put + here. The caller must supply the + memory. */ + unsigned int addr_len; /* The size of the address buffer. + The caller supplies the full buffer + length, this value is updated to + the actual message length when the + message is received. */ + + long msgid; /* The sequence number specified in the request + if this is a response. If this is a command, + this will be the sequence number from the + command. */ + + struct ipmi_msg msg; /* The data field must point to a buffer. + The data_size field must be set to the + size of the message buffer. The + caller supplies the full buffer + length, this value is updated to the + actual message length when the message + is received. */ +}; + +/* + * Receive a message. error values: + * - EAGAIN - no messages in the queue. + * - EFAULT - an address supplied was invalid. + * - EINVAL - The address supplied was not valid. + * - EMSGSIZE - The message to was too large to fit into the message buffer, + * the message will be left in the buffer. */ +#define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, \ + struct ipmi_recv) + +/* + * Like RECEIVE_MSG, but if the message won't fit in the buffer, it + * will truncate the contents instead of leaving the data in the + * buffer. + */ +#define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, \ + struct ipmi_recv) + +/* Register to get commands from other entities on this interface. */ +struct ipmi_cmdspec { + unsigned char netfn; + unsigned char cmd; +}; + +/* + * Register to receive a specific command. error values: + * - EFAULT - an address supplied was invalid. + * - EBUSY - The netfn/cmd supplied was already in use. + * - ENOMEM - could not allocate memory for the entry. + */ +#define IPMICTL_REGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 14, \ + struct ipmi_cmdspec) +/* + * Unregister a regsitered command. error values: + * - EFAULT - an address supplied was invalid. + * - ENOENT - The netfn/cmd was not found registered for this user. + */ +#define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, \ + struct ipmi_cmdspec) + +/* + * Register to get commands from other entities on specific channels. + * This way, you can only listen on specific channels, or have messages + * from some channels go to one place and other channels to someplace + * else. The chans field is a bitmask, (1 << channel) for each channel. + * It may be IPMI_CHAN_ALL for all channels. + */ +struct ipmi_cmdspec_chans { + unsigned int netfn; + unsigned int cmd; + unsigned int chans; +}; + +/* + * Register to receive a specific command on specific channels. error values: + * - EFAULT - an address supplied was invalid. + * - EBUSY - One of the netfn/cmd/chans supplied was already in use. + * - ENOMEM - could not allocate memory for the entry. + */ +#define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, \ + struct ipmi_cmdspec_chans) +/* + * Unregister some netfn/cmd/chans. error values: + * - EFAULT - an address supplied was invalid. + * - ENOENT - None of the netfn/cmd/chans were found registered for this user. + */ +#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \ + struct ipmi_cmdspec_chans) + +/* + * Set whether this interface receives events. Note that the first + * user registered for events will get all pending events for the + * interface. error values: + * - EFAULT - an address supplied was invalid. + */ +#define IPMICTL_SET_GETS_EVENTS_CMD _IOR(IPMI_IOC_MAGIC, 16, int) + +/* + * Set and get the slave address and LUN that we will use for our + * source messages. Note that this affects the interface, not just + * this user, so it will affect all users of this interface. This is + * so some initialization code can come in and do the OEM-specific + * things it takes to determine your address (if not the BMC) and set + * it for everyone else. You should probably leave the LUN alone. + */ +struct ipmi_channel_lun_address_set { + unsigned short channel; + unsigned char value; +}; +#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \ + _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set) +#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \ + _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set) +#define IPMICTL_SET_MY_CHANNEL_LUN_CMD \ + _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set) +#define IPMICTL_GET_MY_CHANNEL_LUN_CMD \ + _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set) +/* Legacy interfaces, these only set IPMB 0. */ +#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int) +#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) +#define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int) +#define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int) + +/* + * Get/set the default timing values for an interface. You shouldn't + * generally mess with these. + */ +struct ipmi_timing_parms { + int retries; + unsigned int retry_time_ms; +}; +#define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, \ + struct ipmi_timing_parms) +#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \ + struct ipmi_timing_parms) + +/* + * Set the maintenance mode. See ipmi_set_maintenance_mode() above + * for a description of what this does. + */ +#define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int) +#define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int) + +#endif /* __LINUX_IPMI_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipmi_msgdefs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipmi_msgdefs.h new file mode 100644 index 0000000..df97e6e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipmi_msgdefs.h @@ -0,0 +1,121 @@ +/* + * ipmi_smi.h + * + * MontaVista IPMI system management interface + * + * Author: MontaVista Software, Inc. + * Corey Minyard + * source@mvista.com + * + * Copyright 2002 MontaVista Software Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __LINUX_IPMI_MSGDEFS_H +#define __LINUX_IPMI_MSGDEFS_H + +/* Various definitions for IPMI messages used by almost everything in + the IPMI stack. */ + +/* NetFNs and commands used inside the IPMI stack. */ + +#define IPMI_NETFN_SENSOR_EVENT_REQUEST 0x04 +#define IPMI_NETFN_SENSOR_EVENT_RESPONSE 0x05 +#define IPMI_GET_EVENT_RECEIVER_CMD 0x01 + +#define IPMI_NETFN_APP_REQUEST 0x06 +#define IPMI_NETFN_APP_RESPONSE 0x07 +#define IPMI_GET_DEVICE_ID_CMD 0x01 +#define IPMI_COLD_RESET_CMD 0x02 +#define IPMI_WARM_RESET_CMD 0x03 +#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 +#define IPMI_GET_DEVICE_GUID_CMD 0x08 +#define IPMI_GET_MSG_FLAGS_CMD 0x31 +#define IPMI_SEND_MSG_CMD 0x34 +#define IPMI_GET_MSG_CMD 0x33 +#define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e +#define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f +#define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 +#define IPMI_GET_CHANNEL_INFO_CMD 0x42 + +/* Bit for BMC global enables. */ +#define IPMI_BMC_RCV_MSG_INTR 0x01 +#define IPMI_BMC_EVT_MSG_INTR 0x02 +#define IPMI_BMC_EVT_MSG_BUFF 0x04 +#define IPMI_BMC_SYS_LOG 0x08 + +#define IPMI_NETFN_STORAGE_REQUEST 0x0a +#define IPMI_NETFN_STORAGE_RESPONSE 0x0b +#define IPMI_ADD_SEL_ENTRY_CMD 0x44 + +#define IPMI_NETFN_FIRMWARE_REQUEST 0x08 +#define IPMI_NETFN_FIRMWARE_RESPONSE 0x09 + +/* The default slave address */ +#define IPMI_BMC_SLAVE_ADDR 0x20 + +/* The BT interface on high-end HP systems supports up to 255 bytes in + * one transfer. Its "virtual" BMC supports some commands that are longer + * than 128 bytes. Use the full 256, plus NetFn/LUN, Cmd, cCode, plus + * some overhead; it's not worth the effort to dynamically size this based + * on the results of the "Get BT Capabilities" command. */ +#define IPMI_MAX_MSG_LENGTH 272 /* multiple of 16 */ + +#define IPMI_CC_NO_ERROR 0x00 +#define IPMI_NODE_BUSY_ERR 0xc0 +#define IPMI_INVALID_COMMAND_ERR 0xc1 +#define IPMI_TIMEOUT_ERR 0xc3 +#define IPMI_ERR_MSG_TRUNCATED 0xc6 +#define IPMI_REQ_LEN_INVALID_ERR 0xc7 +#define IPMI_REQ_LEN_EXCEEDED_ERR 0xc8 +#define IPMI_NOT_IN_MY_STATE_ERR 0xd5 /* IPMI 2.0 */ +#define IPMI_LOST_ARBITRATION_ERR 0x81 +#define IPMI_BUS_ERR 0x82 +#define IPMI_NAK_ON_WRITE_ERR 0x83 +#define IPMI_ERR_UNSPECIFIED 0xff + +#define IPMI_CHANNEL_PROTOCOL_IPMB 1 +#define IPMI_CHANNEL_PROTOCOL_ICMB 2 +#define IPMI_CHANNEL_PROTOCOL_SMBUS 4 +#define IPMI_CHANNEL_PROTOCOL_KCS 5 +#define IPMI_CHANNEL_PROTOCOL_SMIC 6 +#define IPMI_CHANNEL_PROTOCOL_BT10 7 +#define IPMI_CHANNEL_PROTOCOL_BT15 8 +#define IPMI_CHANNEL_PROTOCOL_TMODE 9 + +#define IPMI_CHANNEL_MEDIUM_IPMB 1 +#define IPMI_CHANNEL_MEDIUM_ICMB10 2 +#define IPMI_CHANNEL_MEDIUM_ICMB09 3 +#define IPMI_CHANNEL_MEDIUM_8023LAN 4 +#define IPMI_CHANNEL_MEDIUM_ASYNC 5 +#define IPMI_CHANNEL_MEDIUM_OTHER_LAN 6 +#define IPMI_CHANNEL_MEDIUM_PCI_SMBUS 7 +#define IPMI_CHANNEL_MEDIUM_SMBUS1 8 +#define IPMI_CHANNEL_MEDIUM_SMBUS2 9 +#define IPMI_CHANNEL_MEDIUM_USB1 10 +#define IPMI_CHANNEL_MEDIUM_USB2 11 +#define IPMI_CHANNEL_MEDIUM_SYSINTF 12 +#define IPMI_CHANNEL_MEDIUM_OEM_MIN 0x60 +#define IPMI_CHANNEL_MEDIUM_OEM_MAX 0x7f + +#endif /* __LINUX_IPMI_MSGDEFS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipsec.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipsec.h new file mode 100644 index 0000000..d17a630 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipsec.h @@ -0,0 +1,47 @@ +#ifndef _LINUX_IPSEC_H +#define _LINUX_IPSEC_H + +/* The definitions, required to talk to KAME racoon IKE. */ + +#include + +#define IPSEC_PORT_ANY 0 +#define IPSEC_ULPROTO_ANY 255 +#define IPSEC_PROTO_ANY 255 + +enum { + IPSEC_MODE_ANY = 0, /* We do not support this for SA */ + IPSEC_MODE_TRANSPORT = 1, + IPSEC_MODE_TUNNEL = 2, + IPSEC_MODE_BEET = 3 +}; + +enum { + IPSEC_DIR_ANY = 0, + IPSEC_DIR_INBOUND = 1, + IPSEC_DIR_OUTBOUND = 2, + IPSEC_DIR_FWD = 3, /* It is our own */ + IPSEC_DIR_MAX = 4, + IPSEC_DIR_INVALID = 5 +}; + +enum { + IPSEC_POLICY_DISCARD = 0, + IPSEC_POLICY_NONE = 1, + IPSEC_POLICY_IPSEC = 2, + IPSEC_POLICY_ENTRUST = 3, + IPSEC_POLICY_BYPASS = 4 +}; + +enum { + IPSEC_LEVEL_DEFAULT = 0, + IPSEC_LEVEL_USE = 1, + IPSEC_LEVEL_REQUIRE = 2, + IPSEC_LEVEL_UNIQUE = 3 +}; + +#define IPSEC_MANUAL_REQID_MAX 0x3fff + +#define IPSEC_REPLAYWSIZE 32 + +#endif /* _LINUX_IPSEC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipv6.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipv6.h new file mode 100644 index 0000000..12dfb33 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipv6.h @@ -0,0 +1,159 @@ +#ifndef _IPV6_H +#define _IPV6_H + +#include +#include +#include + +/* The latest drafts declared increase in minimal mtu up to 1280. */ + +#define IPV6_MIN_MTU 1280 + +/* + * Advanced API + * source interface/address selection, source routing, etc... + * *under construction* + */ + + +struct in6_pktinfo { + struct in6_addr ipi6_addr; + int ipi6_ifindex; +}; + + +struct in6_ifreq { + struct in6_addr ifr6_addr; + __u32 ifr6_prefixlen; + int ifr6_ifindex; +}; + +#define IPV6_SRCRT_STRICT 0x01 /* Deprecated; will be removed */ +#define IPV6_SRCRT_TYPE_0 0 /* Deprecated; will be removed */ +#define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */ + +/* + * routing header + */ +struct ipv6_rt_hdr { + __u8 nexthdr; + __u8 hdrlen; + __u8 type; + __u8 segments_left; + + /* + * type specific data + * variable length field + */ +}; + + +struct ipv6_opt_hdr { + __u8 nexthdr; + __u8 hdrlen; + /* + * TLV encoded option data follows. + */ +} __attribute__ ((packed)); /* required for some archs */ + +#define ipv6_destopt_hdr ipv6_opt_hdr +#define ipv6_hopopt_hdr ipv6_opt_hdr + + +/* + * routing header type 0 (used in cmsghdr struct) + */ + +struct rt0_hdr { + struct ipv6_rt_hdr rt_hdr; + __u32 reserved; + struct in6_addr addr[0]; + +#define rt0_type rt_hdr.type +}; + +/* + * routing header type 2 + */ + +struct rt2_hdr { + struct ipv6_rt_hdr rt_hdr; + __u32 reserved; + struct in6_addr addr; + +#define rt2_type rt_hdr.type +}; + +/* + * home address option in destination options header + */ + +struct ipv6_destopt_hao { + __u8 type; + __u8 length; + struct in6_addr addr; +} __attribute__ ((__packed__)); + +/* + * IPv6 fixed header + * + * BEWARE, it is incorrect. The first 4 bits of flow_lbl + * are glued to priority now, forming "class". + */ + +struct ipv6hdr { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 priority:4, + version:4; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 version:4, + priority:4; +#else +#error "Please fix " +#endif + __u8 flow_lbl[3]; + + __be16 payload_len; + __u8 nexthdr; + __u8 hop_limit; + + struct in6_addr saddr; + struct in6_addr daddr; +}; + + +/* index values for the variables in ipv6_devconf */ +enum { + DEVCONF_FORWARDING = 0, + DEVCONF_HOPLIMIT, + DEVCONF_MTU6, + DEVCONF_ACCEPT_RA, + DEVCONF_ACCEPT_REDIRECTS, + DEVCONF_AUTOCONF, + DEVCONF_DAD_TRANSMITS, + DEVCONF_RTR_SOLICITS, + DEVCONF_RTR_SOLICIT_INTERVAL, + DEVCONF_RTR_SOLICIT_DELAY, + DEVCONF_USE_TEMPADDR, + DEVCONF_TEMP_VALID_LFT, + DEVCONF_TEMP_PREFERED_LFT, + DEVCONF_REGEN_MAX_RETRY, + DEVCONF_MAX_DESYNC_FACTOR, + DEVCONF_MAX_ADDRESSES, + DEVCONF_FORCE_MLD_VERSION, + DEVCONF_ACCEPT_RA_DEFRTR, + DEVCONF_ACCEPT_RA_PINFO, + DEVCONF_ACCEPT_RA_RTR_PREF, + DEVCONF_RTR_PROBE_INTERVAL, + DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, + DEVCONF_PROXY_NDP, + DEVCONF_OPTIMISTIC_DAD, + DEVCONF_ACCEPT_SOURCE_ROUTE, + DEVCONF_MC_FORWARDING, + DEVCONF_DISABLE_IPV6, + DEVCONF_ACCEPT_DAD, + DEVCONF_MAX +}; + + +#endif /* _IPV6_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipv6_route.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipv6_route.h new file mode 100644 index 0000000..45a6d1c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipv6_route.h @@ -0,0 +1,58 @@ +/* + * Linux INET6 implementation + * + * Authors: + * Pedro Roque + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IPV6_ROUTE_H +#define _LINUX_IPV6_ROUTE_H + +#include + +#define RTF_DEFAULT 0x00010000 /* default - learned via ND */ +#define RTF_ALLONLINK 0x00020000 /* (deprecated and will be removed) + fallback, no routers on link */ +#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ +#define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */ +#define RTF_ANYCAST 0x00100000 /* Anycast */ + +#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ +#define RTF_EXPIRES 0x00400000 + +#define RTF_ROUTEINFO 0x00800000 /* route information - RA */ + +#define RTF_CACHE 0x01000000 /* cache entry */ +#define RTF_FLOW 0x02000000 /* flow significant route */ +#define RTF_POLICY 0x04000000 /* policy route */ + +#define RTF_PREF(pref) ((pref) << 27) +#define RTF_PREF_MASK 0x18000000 + +#define RTF_LOCAL 0x80000000 + + +struct in6_rtmsg { + struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_src; + struct in6_addr rtmsg_gateway; + __u32 rtmsg_type; + __u16 rtmsg_dst_len; + __u16 rtmsg_src_len; + __u32 rtmsg_metric; + unsigned long rtmsg_info; + __u32 rtmsg_flags; + int rtmsg_ifindex; +}; + +#define RTMSG_NEWDEVICE 0x11 +#define RTMSG_DELDEVICE 0x12 +#define RTMSG_NEWROUTE 0x21 +#define RTMSG_DELROUTE 0x22 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipx.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipx.h new file mode 100644 index 0000000..aabb1d2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ipx.h @@ -0,0 +1,75 @@ +#ifndef _IPX_H_ +#define _IPX_H_ +#include +#include +#include +#define IPX_NODE_LEN 6 +#define IPX_MTU 576 + +struct sockaddr_ipx { + sa_family_t sipx_family; + __be16 sipx_port; + __be32 sipx_network; + unsigned char sipx_node[IPX_NODE_LEN]; + __u8 sipx_type; + unsigned char sipx_zero; /* 16 byte fill */ +}; + +/* + * So we can fit the extra info for SIOCSIFADDR into the address nicely + */ +#define sipx_special sipx_port +#define sipx_action sipx_zero +#define IPX_DLTITF 0 +#define IPX_CRTITF 1 + +struct ipx_route_definition { + __be32 ipx_network; + __be32 ipx_router_network; + unsigned char ipx_router_node[IPX_NODE_LEN]; +}; + +struct ipx_interface_definition { + __be32 ipx_network; + unsigned char ipx_device[16]; + unsigned char ipx_dlink_type; +#define IPX_FRAME_NONE 0 +#define IPX_FRAME_SNAP 1 +#define IPX_FRAME_8022 2 +#define IPX_FRAME_ETHERII 3 +#define IPX_FRAME_8023 4 +#define IPX_FRAME_TR_8022 5 /* obsolete */ + unsigned char ipx_special; +#define IPX_SPECIAL_NONE 0 +#define IPX_PRIMARY 1 +#define IPX_INTERNAL 2 + unsigned char ipx_node[IPX_NODE_LEN]; +}; + +struct ipx_config_data { + unsigned char ipxcfg_auto_select_primary; + unsigned char ipxcfg_auto_create_interfaces; +}; + +/* + * OLD Route Definition for backward compatibility. + */ + +struct ipx_route_def { + __be32 ipx_network; + __be32 ipx_router_network; +#define IPX_ROUTE_NO_ROUTER 0 + unsigned char ipx_router_node[IPX_NODE_LEN]; + unsigned char ipx_device[16]; + unsigned short ipx_flags; +#define IPX_RT_SNAP 8 +#define IPX_RT_8022 4 +#define IPX_RT_BLUEBOOK 2 +#define IPX_RT_ROUTED 1 +}; + +#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) +#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1) +#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2) +#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3) +#endif /* _IPX_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/irda.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/irda.h new file mode 100644 index 0000000..00bdad0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/irda.h @@ -0,0 +1,254 @@ +/********************************************************************* + * + * Filename: irda.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli + * Created at: Mon Mar 8 14:06:12 1999 + * Modified at: Sat Dec 25 16:06:42 1999 + * Modified by: Dag Brattli + * + * Copyright (c) 1999 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsø admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef KERNEL_IRDA_H +#define KERNEL_IRDA_H + +#include + +/* Please do *not* add any #include in this file, this file is + * included as-is in user space. + * Please fix the calling file to properly included needed files before + * this one, or preferably to include instead. + * Jean II */ + +/* Hint bit positions for first hint byte */ +#define HINT_PNP 0x01 +#define HINT_PDA 0x02 +#define HINT_COMPUTER 0x04 +#define HINT_PRINTER 0x08 +#define HINT_MODEM 0x10 +#define HINT_FAX 0x20 +#define HINT_LAN 0x40 +#define HINT_EXTENSION 0x80 + +/* Hint bit positions for second hint byte (first extension byte) */ +#define HINT_TELEPHONY 0x01 +#define HINT_FILE_SERVER 0x02 +#define HINT_COMM 0x04 +#define HINT_MESSAGE 0x08 +#define HINT_HTTP 0x10 +#define HINT_OBEX 0x20 + +/* IrLMP character code values */ +#define CS_ASCII 0x00 +#define CS_ISO_8859_1 0x01 +#define CS_ISO_8859_2 0x02 +#define CS_ISO_8859_3 0x03 +#define CS_ISO_8859_4 0x04 +#define CS_ISO_8859_5 0x05 +#define CS_ISO_8859_6 0x06 +#define CS_ISO_8859_7 0x07 +#define CS_ISO_8859_8 0x08 +#define CS_ISO_8859_9 0x09 +#define CS_UNICODE 0xff + +/* These are the currently known dongles */ +typedef enum { + IRDA_TEKRAM_DONGLE = 0, + IRDA_ESI_DONGLE = 1, + IRDA_ACTISYS_DONGLE = 2, + IRDA_ACTISYS_PLUS_DONGLE = 3, + IRDA_GIRBIL_DONGLE = 4, + IRDA_LITELINK_DONGLE = 5, + IRDA_AIRPORT_DONGLE = 6, + IRDA_OLD_BELKIN_DONGLE = 7, + IRDA_EP7211_IR = 8, + IRDA_MCP2120_DONGLE = 9, + IRDA_ACT200L_DONGLE = 10, + IRDA_MA600_DONGLE = 11, + IRDA_TOIM3232_DONGLE = 12, + IRDA_EP7211_DONGLE = 13, +} IRDA_DONGLE; + +/* Protocol types to be used for SOCK_DGRAM */ +enum { + IRDAPROTO_UNITDATA = 0, + IRDAPROTO_ULTRA = 1, + IRDAPROTO_MAX +}; + +#define SOL_IRLMP 266 /* Same as SOL_IRDA for now */ +#define SOL_IRTTP 266 /* Same as SOL_IRDA for now */ + +#define IRLMP_ENUMDEVICES 1 /* Return discovery log */ +#define IRLMP_IAS_SET 2 /* Set an attribute in local IAS */ +#define IRLMP_IAS_QUERY 3 /* Query remote IAS for attribute */ +#define IRLMP_HINTS_SET 4 /* Set hint bits advertised */ +#define IRLMP_QOS_SET 5 +#define IRLMP_QOS_GET 6 +#define IRLMP_MAX_SDU_SIZE 7 +#define IRLMP_IAS_GET 8 /* Get an attribute from local IAS */ +#define IRLMP_IAS_DEL 9 /* Remove attribute from local IAS */ +#define IRLMP_HINT_MASK_SET 10 /* Set discovery filter */ +#define IRLMP_WAITDEVICE 11 /* Wait for a new discovery */ + +#define IRTTP_MAX_SDU_SIZE IRLMP_MAX_SDU_SIZE /* Compatibility */ + +#define IAS_MAX_STRING 256 /* See IrLMP 1.1, 4.3.3.2 */ +#define IAS_MAX_OCTET_STRING 1024 /* See IrLMP 1.1, 4.3.3.2 */ +#define IAS_MAX_CLASSNAME 60 /* See IrLMP 1.1, 4.3.1 */ +#define IAS_MAX_ATTRIBNAME 60 /* See IrLMP 1.1, 4.3.3.1 */ +#define IAS_MAX_ATTRIBNUMBER 256 /* See IrLMP 1.1, 4.3.3.1 */ +/* For user space backward compatibility - may be fixed in kernel 2.5.X + * Note : need 60+1 ('\0'), make it 64 for alignement - Jean II */ +#define IAS_EXPORT_CLASSNAME 64 +#define IAS_EXPORT_ATTRIBNAME 256 + +/* Attribute type needed for struct irda_ias_set */ +#define IAS_MISSING 0 +#define IAS_INTEGER 1 +#define IAS_OCT_SEQ 2 +#define IAS_STRING 3 + +#define LSAP_ANY 0xff + +struct sockaddr_irda { + sa_family_t sir_family; /* AF_IRDA */ + __u8 sir_lsap_sel; /* LSAP selector */ + __u32 sir_addr; /* Device address */ + char sir_name[25]; /* Usually :IrDA:TinyTP */ +}; + +struct irda_device_info { + __u32 saddr; /* Address of local interface */ + __u32 daddr; /* Address of remote device */ + char info[22]; /* Description */ + __u8 charset; /* Charset used for description */ + __u8 hints[2]; /* Hint bits */ +}; + +struct irda_device_list { + __u32 len; + struct irda_device_info dev[1]; +}; + +struct irda_ias_set { + char irda_class_name[IAS_EXPORT_CLASSNAME]; + char irda_attrib_name[IAS_EXPORT_ATTRIBNAME]; + unsigned int irda_attrib_type; + union { + unsigned int irda_attrib_int; + struct { + unsigned short len; + __u8 octet_seq[IAS_MAX_OCTET_STRING]; + } irda_attrib_octet_seq; + struct { + __u8 len; + __u8 charset; + __u8 string[IAS_MAX_STRING]; + } irda_attrib_string; + } attribute; + __u32 daddr; /* Address of device (for some queries only) */ +}; + +/* Some private IOCTL's (max 16) */ +#define SIOCSDONGLE (SIOCDEVPRIVATE + 0) +#define SIOCGDONGLE (SIOCDEVPRIVATE + 1) +#define SIOCSBANDWIDTH (SIOCDEVPRIVATE + 2) +#define SIOCSMEDIABUSY (SIOCDEVPRIVATE + 3) +#define SIOCGMEDIABUSY (SIOCDEVPRIVATE + 4) +#define SIOCGRECEIVING (SIOCDEVPRIVATE + 5) +#define SIOCSMODE (SIOCDEVPRIVATE + 6) +#define SIOCGMODE (SIOCDEVPRIVATE + 7) +#define SIOCSDTRRTS (SIOCDEVPRIVATE + 8) +#define SIOCGQOS (SIOCDEVPRIVATE + 9) + +/* No reason to include just because of this one ;-) */ +#define IRNAMSIZ 16 + +/* IrDA quality of service information (must not exceed 16 bytes) */ +struct if_irda_qos { + unsigned long baudrate; + unsigned short data_size; + unsigned short window_size; + unsigned short min_turn_time; + unsigned short max_turn_time; + unsigned char add_bofs; + unsigned char link_disc; +}; + +/* For setting RTS and DTR lines of a dongle */ +struct if_irda_line { + __u8 dtr; + __u8 rts; +}; + +/* IrDA interface configuration (data part must not exceed 16 bytes) */ +struct if_irda_req { + union { + char ifrn_name[IRNAMSIZ]; /* if name, e.g. "irda0" */ + } ifr_ifrn; + + /* Data part */ + union { + struct if_irda_line ifru_line; + struct if_irda_qos ifru_qos; + unsigned short ifru_flags; + unsigned int ifru_receiving; + unsigned int ifru_mode; + unsigned int ifru_dongle; + } ifr_ifru; +}; + +#define ifr_baudrate ifr_ifru.ifru_qos.baudrate +#define ifr_receiving ifr_ifru.ifru_receiving +#define ifr_dongle ifr_ifru.ifru_dongle +#define ifr_mode ifr_ifru.ifru_mode +#define ifr_dtr ifr_ifru.ifru_line.dtr +#define ifr_rts ifr_ifru.ifru_line.rts + + +/* IrDA netlink definitions */ +#define IRDA_NL_NAME "irda" +#define IRDA_NL_VERSION 1 + +enum irda_nl_commands { + IRDA_NL_CMD_UNSPEC, + IRDA_NL_CMD_SET_MODE, + IRDA_NL_CMD_GET_MODE, + + __IRDA_NL_CMD_AFTER_LAST +}; +#define IRDA_NL_CMD_MAX (__IRDA_NL_CMD_AFTER_LAST - 1) + +enum nl80211_attrs { + IRDA_NL_ATTR_UNSPEC, + IRDA_NL_ATTR_IFNAME, + IRDA_NL_ATTR_MODE, + + __IRDA_NL_ATTR_AFTER_LAST +}; +#define IRDA_NL_ATTR_MAX (__IRDA_NL_ATTR_AFTER_LAST - 1) + +/* IrDA modes */ +#define IRDA_MODE_PRIMARY 0x1 +#define IRDA_MODE_SECONDARY 0x2 +#define IRDA_MODE_MONITOR 0x4 + +#endif /* KERNEL_IRDA_H */ + + + + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/irqnr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/irqnr.h new file mode 100644 index 0000000..e0fb63c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/irqnr.h @@ -0,0 +1,8 @@ +#ifndef _LINUX_IRQNR_H +#define _LINUX_IRQNR_H + +/* + * Generic irq_desc iterators: + */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn.h new file mode 100644 index 0000000..596bbec --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn.h @@ -0,0 +1,142 @@ +/* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $ + * + * Main header for the Linux ISDN subsystem (linklevel). + * + * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) + * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg + * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#ifndef __ISDN_H__ +#define __ISDN_H__ + +#include + +#define ISDN_MAX_DRIVERS 32 +#define ISDN_MAX_CHANNELS 64 + +/* New ioctl-codes */ +#define IIOCNETAIF _IO('I',1) +#define IIOCNETDIF _IO('I',2) +#define IIOCNETSCF _IO('I',3) +#define IIOCNETGCF _IO('I',4) +#define IIOCNETANM _IO('I',5) +#define IIOCNETDNM _IO('I',6) +#define IIOCNETGNM _IO('I',7) +#define IIOCGETSET _IO('I',8) /* no longer supported */ +#define IIOCSETSET _IO('I',9) /* no longer supported */ +#define IIOCSETVER _IO('I',10) +#define IIOCNETHUP _IO('I',11) +#define IIOCSETGST _IO('I',12) +#define IIOCSETBRJ _IO('I',13) +#define IIOCSIGPRF _IO('I',14) +#define IIOCGETPRF _IO('I',15) +#define IIOCSETPRF _IO('I',16) +#define IIOCGETMAP _IO('I',17) +#define IIOCSETMAP _IO('I',18) +#define IIOCNETASL _IO('I',19) +#define IIOCNETDIL _IO('I',20) +#define IIOCGETCPS _IO('I',21) +#define IIOCGETDVR _IO('I',22) +#define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */ +#define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */ + +#define IIOCNETALN _IO('I',32) +#define IIOCNETDLN _IO('I',33) + +#define IIOCNETGPN _IO('I',34) + +#define IIOCDBGVAR _IO('I',127) + +#define IIOCDRVCTL _IO('I',128) + +/* cisco hdlck device private ioctls */ +#define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0) +#define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1) +#define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2) +#define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3) + +/* Packet encapsulations for net-interfaces */ +#define ISDN_NET_ENCAP_ETHER 0 +#define ISDN_NET_ENCAP_RAWIP 1 +#define ISDN_NET_ENCAP_IPTYP 2 +#define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */ +#define ISDN_NET_ENCAP_SYNCPPP 4 +#define ISDN_NET_ENCAP_UIHDLC 5 +#define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */ +#define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt*/ +#define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE + +/* Facility which currently uses an ISDN-channel */ +#define ISDN_USAGE_NONE 0 +#define ISDN_USAGE_RAW 1 +#define ISDN_USAGE_MODEM 2 +#define ISDN_USAGE_NET 3 +#define ISDN_USAGE_VOICE 4 +#define ISDN_USAGE_FAX 5 +#define ISDN_USAGE_MASK 7 /* Mask to get plain usage */ +#define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */ +#define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */ +#define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */ + +#define ISDN_MODEM_NUMREG 24 /* Number of Modem-Registers */ +#define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */ +#define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */ + +#define ISDN_MSNLEN 32 +#define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */ +#define TTY_DV 0x06 /* Data version for iprofd etc. */ + +#define INF_DV 0x01 /* Data version for /dev/isdninfo */ + +typedef struct { + char drvid[25]; + unsigned long arg; +} isdn_ioctl_struct; + +typedef struct { + char name[10]; + char phone[ISDN_MSNLEN]; + int outgoing; +} isdn_net_ioctl_phone; + +typedef struct { + char name[10]; /* Name of interface */ + char master[10]; /* Name of Master for Bundling */ + char slave[10]; /* Name of Slave for Bundling */ + char eaz[256]; /* EAZ/MSN */ + char drvid[25]; /* DriverId for Bindings */ + int onhtime; /* Hangup-Timeout */ + int charge; /* Charge-Units */ + int l2_proto; /* Layer-2 protocol */ + int l3_proto; /* Layer-3 protocol */ + int p_encap; /* Encapsulation */ + int exclusive; /* Channel, if bound exclusive */ + int dialmax; /* Dial Retry-Counter */ + int slavedelay; /* Delay until slave starts up */ + int cbdelay; /* Delay before Callback */ + int chargehup; /* Flag: Charge-Hangup */ + int ihup; /* Flag: Hangup-Timeout on incoming line */ + int secure; /* Flag: Secure */ + int callback; /* Flag: Callback */ + int cbhup; /* Flag: Reject Call before Callback */ + int pppbind; /* ippp device for bindings */ + int chargeint; /* Use fixed charge interval length */ + int triggercps; /* BogoCPS needed for triggering slave */ + int dialtimeout; /* Dial-Timeout */ + int dialwait; /* Time to wait after failed dial */ + int dialmode; /* Flag: off / on / auto */ +} isdn_net_ioctl_cfg; + +#define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */ +#define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */ +#define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */ +#define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */ +#define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK) + + +#endif /* __ISDN_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/..install.cmd new file mode 100644 index 0000000..068ff5a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/isdn/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/isdn /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/isdn mips capicmd.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/isdn /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/isdn mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/isdn/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/capicmd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/capicmd.h new file mode 100644 index 0000000..b58635f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn/capicmd.h @@ -0,0 +1,115 @@ +/* $Id: capicmd.h,v 1.2.6.2 2001/09/23 22:24:33 kai Exp $ + * + * CAPI 2.0 Interface for Linux + * + * Copyright 1997 by Carsten Paeth + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#ifndef __CAPICMD_H__ +#define __CAPICMD_H__ + +#define CAPI_MSG_BASELEN 8 +#define CAPI_DATA_B3_REQ_LEN (CAPI_MSG_BASELEN+4+4+2+2+2) +#define CAPI_DATA_B3_RESP_LEN (CAPI_MSG_BASELEN+4+2) + +/*----- CAPI commands -----*/ +#define CAPI_ALERT 0x01 +#define CAPI_CONNECT 0x02 +#define CAPI_CONNECT_ACTIVE 0x03 +#define CAPI_CONNECT_B3_ACTIVE 0x83 +#define CAPI_CONNECT_B3 0x82 +#define CAPI_CONNECT_B3_T90_ACTIVE 0x88 +#define CAPI_DATA_B3 0x86 +#define CAPI_DISCONNECT_B3 0x84 +#define CAPI_DISCONNECT 0x04 +#define CAPI_FACILITY 0x80 +#define CAPI_INFO 0x08 +#define CAPI_LISTEN 0x05 +#define CAPI_MANUFACTURER 0xff +#define CAPI_RESET_B3 0x87 +#define CAPI_SELECT_B_PROTOCOL 0x41 + +/*----- CAPI subcommands -----*/ + +#define CAPI_REQ 0x80 +#define CAPI_CONF 0x81 +#define CAPI_IND 0x82 +#define CAPI_RESP 0x83 + +/*----- CAPI combined commands -----*/ + +#define CAPICMD(cmd,subcmd) (((cmd)<<8)|(subcmd)) + +#define CAPI_DISCONNECT_REQ CAPICMD(CAPI_DISCONNECT,CAPI_REQ) +#define CAPI_DISCONNECT_CONF CAPICMD(CAPI_DISCONNECT,CAPI_CONF) +#define CAPI_DISCONNECT_IND CAPICMD(CAPI_DISCONNECT,CAPI_IND) +#define CAPI_DISCONNECT_RESP CAPICMD(CAPI_DISCONNECT,CAPI_RESP) + +#define CAPI_ALERT_REQ CAPICMD(CAPI_ALERT,CAPI_REQ) +#define CAPI_ALERT_CONF CAPICMD(CAPI_ALERT,CAPI_CONF) + +#define CAPI_CONNECT_REQ CAPICMD(CAPI_CONNECT,CAPI_REQ) +#define CAPI_CONNECT_CONF CAPICMD(CAPI_CONNECT,CAPI_CONF) +#define CAPI_CONNECT_IND CAPICMD(CAPI_CONNECT,CAPI_IND) +#define CAPI_CONNECT_RESP CAPICMD(CAPI_CONNECT,CAPI_RESP) + +#define CAPI_CONNECT_ACTIVE_REQ CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_REQ) +#define CAPI_CONNECT_ACTIVE_CONF CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_CONF) +#define CAPI_CONNECT_ACTIVE_IND CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_IND) +#define CAPI_CONNECT_ACTIVE_RESP CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_RESP) + +#define CAPI_SELECT_B_PROTOCOL_REQ CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_REQ) +#define CAPI_SELECT_B_PROTOCOL_CONF CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_CONF) + +#define CAPI_CONNECT_B3_ACTIVE_REQ CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_REQ) +#define CAPI_CONNECT_B3_ACTIVE_CONF CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_CONF) +#define CAPI_CONNECT_B3_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_IND) +#define CAPI_CONNECT_B3_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_RESP) + +#define CAPI_CONNECT_B3_REQ CAPICMD(CAPI_CONNECT_B3,CAPI_REQ) +#define CAPI_CONNECT_B3_CONF CAPICMD(CAPI_CONNECT_B3,CAPI_CONF) +#define CAPI_CONNECT_B3_IND CAPICMD(CAPI_CONNECT_B3,CAPI_IND) +#define CAPI_CONNECT_B3_RESP CAPICMD(CAPI_CONNECT_B3,CAPI_RESP) + + +#define CAPI_CONNECT_B3_T90_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_IND) +#define CAPI_CONNECT_B3_T90_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_RESP) + +#define CAPI_DATA_B3_REQ CAPICMD(CAPI_DATA_B3,CAPI_REQ) +#define CAPI_DATA_B3_CONF CAPICMD(CAPI_DATA_B3,CAPI_CONF) +#define CAPI_DATA_B3_IND CAPICMD(CAPI_DATA_B3,CAPI_IND) +#define CAPI_DATA_B3_RESP CAPICMD(CAPI_DATA_B3,CAPI_RESP) + +#define CAPI_DISCONNECT_B3_REQ CAPICMD(CAPI_DISCONNECT_B3,CAPI_REQ) +#define CAPI_DISCONNECT_B3_CONF CAPICMD(CAPI_DISCONNECT_B3,CAPI_CONF) +#define CAPI_DISCONNECT_B3_IND CAPICMD(CAPI_DISCONNECT_B3,CAPI_IND) +#define CAPI_DISCONNECT_B3_RESP CAPICMD(CAPI_DISCONNECT_B3,CAPI_RESP) + +#define CAPI_RESET_B3_REQ CAPICMD(CAPI_RESET_B3,CAPI_REQ) +#define CAPI_RESET_B3_CONF CAPICMD(CAPI_RESET_B3,CAPI_CONF) +#define CAPI_RESET_B3_IND CAPICMD(CAPI_RESET_B3,CAPI_IND) +#define CAPI_RESET_B3_RESP CAPICMD(CAPI_RESET_B3,CAPI_RESP) + +#define CAPI_LISTEN_REQ CAPICMD(CAPI_LISTEN,CAPI_REQ) +#define CAPI_LISTEN_CONF CAPICMD(CAPI_LISTEN,CAPI_CONF) + +#define CAPI_MANUFACTURER_REQ CAPICMD(CAPI_MANUFACTURER,CAPI_REQ) +#define CAPI_MANUFACTURER_CONF CAPICMD(CAPI_MANUFACTURER,CAPI_CONF) +#define CAPI_MANUFACTURER_IND CAPICMD(CAPI_MANUFACTURER,CAPI_IND) +#define CAPI_MANUFACTURER_RESP CAPICMD(CAPI_MANUFACTURER,CAPI_RESP) + +#define CAPI_FACILITY_REQ CAPICMD(CAPI_FACILITY,CAPI_REQ) +#define CAPI_FACILITY_CONF CAPICMD(CAPI_FACILITY,CAPI_CONF) +#define CAPI_FACILITY_IND CAPICMD(CAPI_FACILITY,CAPI_IND) +#define CAPI_FACILITY_RESP CAPICMD(CAPI_FACILITY,CAPI_RESP) + +#define CAPI_INFO_REQ CAPICMD(CAPI_INFO,CAPI_REQ) +#define CAPI_INFO_CONF CAPICMD(CAPI_INFO,CAPI_CONF) +#define CAPI_INFO_IND CAPICMD(CAPI_INFO,CAPI_IND) +#define CAPI_INFO_RESP CAPICMD(CAPI_INFO,CAPI_RESP) + +#endif /* __CAPICMD_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn_divertif.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn_divertif.h new file mode 100644 index 0000000..10ff7e7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn_divertif.h @@ -0,0 +1,26 @@ +/* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ + * + * Header for the diversion supplementary interface for i4l. + * + * Author Werner Cornelius (werner@titro.de) + * Copyright by Werner Cornelius (werner@titro.de) + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + + +/***********************************************************/ +/* magic value is also used to control version information */ +/***********************************************************/ +#define DIVERT_IF_MAGIC 0x25873401 +#define DIVERT_CMD_REG 0x00 /* register command */ +#define DIVERT_CMD_REL 0x01 /* release command */ +#define DIVERT_NO_ERR 0x00 /* return value no error */ +#define DIVERT_CMD_ERR 0x01 /* invalid cmd */ +#define DIVERT_VER_ERR 0x02 /* magic/version invalid */ +#define DIVERT_REG_ERR 0x03 /* module already registered */ +#define DIVERT_REL_ERR 0x04 /* module not registered */ +#define DIVERT_REG_NAME isdn_register_divert + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn_ppp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn_ppp.h new file mode 100644 index 0000000..aabb015 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdn_ppp.h @@ -0,0 +1,67 @@ +/* Linux ISDN subsystem, sync PPP, interface to ipppd + * + * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de) + * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg + * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) + * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name) + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#ifndef _LINUX_ISDN_PPP_H +#define _LINUX_ISDN_PPP_H + +#define CALLTYPE_INCOMING 0x1 +#define CALLTYPE_OUTGOING 0x2 +#define CALLTYPE_CALLBACK 0x4 + +#define IPPP_VERSION "2.2.0" + +struct pppcallinfo +{ + int calltype; + unsigned char local_num[64]; + unsigned char remote_num[64]; + int charge_units; +}; + +#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo) +#define PPPIOCBUNDLE _IOW('t',129,int) +#define PPPIOCGMPFLAGS _IOR('t',130,int) +#define PPPIOCSMPFLAGS _IOW('t',131,int) +#define PPPIOCSMPMTU _IOW('t',132,int) +#define PPPIOCSMPMRU _IOW('t',133,int) +#define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8]) +#define PPPIOCSCOMPRESSOR _IOW('t',135,int) +#define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] ) + + +#define SC_MP_PROT 0x00000200 +#define SC_REJ_MP_PROT 0x00000400 +#define SC_OUT_SHORT_SEQ 0x00000800 +#define SC_IN_SHORT_SEQ 0x00004000 + +#define SC_DECOMP_ON 0x01 +#define SC_COMP_ON 0x02 +#define SC_DECOMP_DISCARD 0x04 +#define SC_COMP_DISCARD 0x08 +#define SC_LINK_DECOMP_ON 0x10 +#define SC_LINK_COMP_ON 0x20 +#define SC_LINK_DECOMP_DISCARD 0x40 +#define SC_LINK_COMP_DISCARD 0x80 + +#define ISDN_PPP_COMP_MAX_OPTIONS 16 + +#define IPPP_COMP_FLAG_XMIT 0x1 +#define IPPP_COMP_FLAG_LINK 0x2 + +struct isdn_ppp_comp_data { + int num; + unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS]; + int optlen; + int flags; +}; + +#endif /* _LINUX_ISDN_PPP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdnif.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdnif.h new file mode 100644 index 0000000..1db1b0b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/isdnif.h @@ -0,0 +1,56 @@ +/* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $ + * + * Linux ISDN subsystem + * Definition of the interface between the subsystem and its low-level drivers. + * + * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) + * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#ifndef __ISDNIF_H__ +#define __ISDNIF_H__ + + +/* + * Values for general protocol-selection + */ +#define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */ +#define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */ +#define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */ +#define ISDN_PTYPE_LEASED 3 /* for leased lines */ +#define ISDN_PTYPE_NI1 4 /* US NI-1 protocol */ +#define ISDN_PTYPE_MAX 7 /* Max. 8 Protocols */ + +/* + * Values for Layer-2-protocol-selection + */ +#define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */ +#define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */ +#define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */ +#define ISDN_PROTO_L2_HDLC 3 /* HDLC */ +#define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */ +#define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */ +#define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */ +#define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */ +#define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */ +#define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */ +#define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */ +#define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */ +#define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */ +#define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */ + +/* + * Values for Layer-3-protocol-selection + */ +#define ISDN_PROTO_L3_TRANS 0 /* Transparent */ +#define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */ +#define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */ +#define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */ +#define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */ + + +#endif /* __ISDNIF_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/iso_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/iso_fs.h new file mode 100644 index 0000000..4688ac4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/iso_fs.h @@ -0,0 +1,165 @@ +#ifndef _ISOFS_FS_H +#define _ISOFS_FS_H + +#include +#include + +/* + * The isofs filesystem constants/structures + */ + +/* This part borrowed from the bsd386 isofs */ +#define ISODCL(from, to) (to - from + 1) + +struct iso_volume_descriptor { + char type[ISODCL(1,1)]; /* 711 */ + char id[ISODCL(2,6)]; + char version[ISODCL(7,7)]; + char data[ISODCL(8,2048)]; +}; + +/* volume descriptor types */ +#define ISO_VD_PRIMARY 1 +#define ISO_VD_SUPPLEMENTARY 2 +#define ISO_VD_END 255 + +#define ISO_STANDARD_ID "CD001" + +struct iso_primary_descriptor { + char type [ISODCL ( 1, 1)]; /* 711 */ + char id [ISODCL ( 2, 6)]; + char version [ISODCL ( 7, 7)]; /* 711 */ + char unused1 [ISODCL ( 8, 8)]; + char system_id [ISODCL ( 9, 40)]; /* achars */ + char volume_id [ISODCL ( 41, 72)]; /* dchars */ + char unused2 [ISODCL ( 73, 80)]; + char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ + char unused3 [ISODCL ( 89, 120)]; + char volume_set_size [ISODCL (121, 124)]; /* 723 */ + char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ + char logical_block_size [ISODCL (129, 132)]; /* 723 */ + char path_table_size [ISODCL (133, 140)]; /* 733 */ + char type_l_path_table [ISODCL (141, 144)]; /* 731 */ + char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ + char type_m_path_table [ISODCL (149, 152)]; /* 732 */ + char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ + char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ + char volume_set_id [ISODCL (191, 318)]; /* dchars */ + char publisher_id [ISODCL (319, 446)]; /* achars */ + char preparer_id [ISODCL (447, 574)]; /* achars */ + char application_id [ISODCL (575, 702)]; /* achars */ + char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ + char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ + char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ + char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ + char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ + char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ + char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ + char file_structure_version [ISODCL (882, 882)]; /* 711 */ + char unused4 [ISODCL (883, 883)]; + char application_data [ISODCL (884, 1395)]; + char unused5 [ISODCL (1396, 2048)]; +}; + +/* Almost the same as the primary descriptor but two fields are specified */ +struct iso_supplementary_descriptor { + char type [ISODCL ( 1, 1)]; /* 711 */ + char id [ISODCL ( 2, 6)]; + char version [ISODCL ( 7, 7)]; /* 711 */ + char flags [ISODCL ( 8, 8)]; /* 853 */ + char system_id [ISODCL ( 9, 40)]; /* achars */ + char volume_id [ISODCL ( 41, 72)]; /* dchars */ + char unused2 [ISODCL ( 73, 80)]; + char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ + char escape [ISODCL ( 89, 120)]; /* 856 */ + char volume_set_size [ISODCL (121, 124)]; /* 723 */ + char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ + char logical_block_size [ISODCL (129, 132)]; /* 723 */ + char path_table_size [ISODCL (133, 140)]; /* 733 */ + char type_l_path_table [ISODCL (141, 144)]; /* 731 */ + char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ + char type_m_path_table [ISODCL (149, 152)]; /* 732 */ + char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ + char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ + char volume_set_id [ISODCL (191, 318)]; /* dchars */ + char publisher_id [ISODCL (319, 446)]; /* achars */ + char preparer_id [ISODCL (447, 574)]; /* achars */ + char application_id [ISODCL (575, 702)]; /* achars */ + char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ + char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ + char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ + char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ + char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ + char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ + char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ + char file_structure_version [ISODCL (882, 882)]; /* 711 */ + char unused4 [ISODCL (883, 883)]; + char application_data [ISODCL (884, 1395)]; + char unused5 [ISODCL (1396, 2048)]; +}; + + +#define HS_STANDARD_ID "CDROM" + +struct hs_volume_descriptor { + char foo [ISODCL ( 1, 8)]; /* 733 */ + char type [ISODCL ( 9, 9)]; /* 711 */ + char id [ISODCL ( 10, 14)]; + char version [ISODCL ( 15, 15)]; /* 711 */ + char data[ISODCL(16,2048)]; +}; + + +struct hs_primary_descriptor { + char foo [ISODCL ( 1, 8)]; /* 733 */ + char type [ISODCL ( 9, 9)]; /* 711 */ + char id [ISODCL ( 10, 14)]; + char version [ISODCL ( 15, 15)]; /* 711 */ + char unused1 [ISODCL ( 16, 16)]; /* 711 */ + char system_id [ISODCL ( 17, 48)]; /* achars */ + char volume_id [ISODCL ( 49, 80)]; /* dchars */ + char unused2 [ISODCL ( 81, 88)]; /* 733 */ + char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ + char unused3 [ISODCL ( 97, 128)]; /* 733 */ + char volume_set_size [ISODCL (129, 132)]; /* 723 */ + char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ + char logical_block_size [ISODCL (137, 140)]; /* 723 */ + char path_table_size [ISODCL (141, 148)]; /* 733 */ + char type_l_path_table [ISODCL (149, 152)]; /* 731 */ + char unused4 [ISODCL (153, 180)]; /* 733 */ + char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ +}; + +/* We use this to help us look up the parent inode numbers. */ + +struct iso_path_table{ + unsigned char name_len[2]; /* 721 */ + char extent[4]; /* 731 */ + char parent[2]; /* 721 */ + char name[0]; +} __attribute__((packed)); + +/* high sierra is identical to iso, except that the date is only 6 bytes, and + there is an extra reserved byte after the flags */ + +struct iso_directory_record { + char length [ISODCL (1, 1)]; /* 711 */ + char ext_attr_length [ISODCL (2, 2)]; /* 711 */ + char extent [ISODCL (3, 10)]; /* 733 */ + char size [ISODCL (11, 18)]; /* 733 */ + char date [ISODCL (19, 25)]; /* 7 by 711 */ + char flags [ISODCL (26, 26)]; + char file_unit_size [ISODCL (27, 27)]; /* 711 */ + char interleave [ISODCL (28, 28)]; /* 711 */ + char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ + unsigned char name_len [ISODCL (33, 33)]; /* 711 */ + char name [0]; +} __attribute__((packed)); + +#define ISOFS_BLOCK_BITS 11 +#define ISOFS_BLOCK_SIZE 2048 + +#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) +#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) + +#endif /* _ISOFS_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ivtv.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ivtv.h new file mode 100644 index 0000000..bf3ce85 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ivtv.h @@ -0,0 +1,69 @@ +/* + Public ivtv API header + Copyright (C) 2003-2004 Kevin Thayer + Copyright (C) 2004-2007 Hans Verkuil + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LINUX_IVTV_H__ +#define __LINUX_IVTV_H__ + + +#include +#include + +/* ivtv knows several distinct output modes: MPEG streaming, + YUV streaming, YUV updates through user DMA and the passthrough + mode. + + In order to clearly tell the driver that we are in user DMA + YUV mode you need to call IVTV_IOC_DMA_FRAME with y_source == NULL + first (althrough if you don't then the first time + DMA_FRAME is called the mode switch is done automatically). + + When you close the file handle the user DMA mode is exited again. + + While in one mode, you cannot use another mode (EBUSY is returned). + + All this means that if you want to change the YUV interlacing + for the user DMA YUV mode you first need to do call IVTV_IOC_DMA_FRAME + with y_source == NULL before you can set the correct format using + VIDIOC_S_FMT. + + Eventually all this should be replaced with a proper V4L2 API, + but for now we have to do it this way. */ + +struct ivtv_dma_frame { + enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */ + __u32 pixelformat; /* 0 == same as destination */ + void *y_source; /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT, + then just switch to user DMA YUV output mode */ + void *uv_source; /* Unused for RGB pixelformats */ + struct v4l2_rect src; + struct v4l2_rect dst; + __u32 src_width; + __u32 src_height; +}; + +#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) + +/* Deprecated defines: applications should use the defines from videodev2.h */ +#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B +#define IVTV_SLICED_TYPE_CAPTION_525 V4L2_MPEG_VBI_IVTV_CAPTION_525 +#define IVTV_SLICED_TYPE_WSS_625 V4L2_MPEG_VBI_IVTV_WSS_625 +#define IVTV_SLICED_TYPE_VPS V4L2_MPEG_VBI_IVTV_VPS + +#endif /* _LINUX_IVTV_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ivtvfb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ivtvfb.h new file mode 100644 index 0000000..d9be3ff --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ivtvfb.h @@ -0,0 +1,38 @@ +/* + On Screen Display cx23415 Framebuffer driver + + Copyright (C) 2006, 2007 Ian Armstrong + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LINUX_IVTVFB_H__ +#define __LINUX_IVTVFB_H__ + + +#include + +/* Framebuffer external API */ + +struct ivtvfb_dma_frame { + void *source; + unsigned long dest_offset; + int count; +}; + +#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) +#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ixjuser.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ixjuser.h new file mode 100644 index 0000000..7d8525e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ixjuser.h @@ -0,0 +1,720 @@ +#ifndef __LINUX_IXJUSER_H +#define __LINUX_IXJUSER_H + +/****************************************************************************** + * + * ixjuser.h + * + * Device Driver for Quicknet Technologies, Inc.'s Telephony cards + * including the Internet PhoneJACK, Internet PhoneJACK Lite, + * Internet PhoneJACK PCI, Internet LineJACK, Internet PhoneCARD and + * SmartCABLE + * + * (c) Copyright 1999-2001 Quicknet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Author: Ed Okerson, + * + * Contributors: Greg Herlein, + * David W. Erhart, + * John Sellers, + * Mike Preston, + * + * More information about the hardware related to this driver can be found + * at our website: http://www.quicknet.net + * + * Fixes: + * + * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET + * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION + * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + *****************************************************************************/ + +#include + + +/****************************************************************************** +* +* IOCTL's used for the Quicknet Telephony Cards +* +* If you use the IXJCTL_TESTRAM command, the card must be power cycled to +* reset the SRAM values before futher use. +* +******************************************************************************/ + +#define IXJCTL_DSP_RESET _IO ('q', 0xC0) + +#define IXJCTL_RING PHONE_RING +#define IXJCTL_HOOKSTATE PHONE_HOOKSTATE +#define IXJCTL_MAXRINGS PHONE_MAXRINGS +#define IXJCTL_RING_CADENCE PHONE_RING_CADENCE +#define IXJCTL_RING_START PHONE_RING_START +#define IXJCTL_RING_STOP PHONE_RING_STOP + +#define IXJCTL_CARDTYPE _IOR ('q', 0xC1, int) +#define IXJCTL_SERIAL _IOR ('q', 0xC2, int) +#define IXJCTL_DSP_TYPE _IOR ('q', 0xC3, int) +#define IXJCTL_DSP_VERSION _IOR ('q', 0xC4, int) +#define IXJCTL_VERSION _IOR ('q', 0xDA, char *) +#define IXJCTL_DSP_IDLE _IO ('q', 0xC5) +#define IXJCTL_TESTRAM _IO ('q', 0xC6) + +/****************************************************************************** +* +* This group of IOCTLs deal with the record settings of the DSP +* +* The IXJCTL_REC_DEPTH command sets the internal buffer depth of the DSP. +* Setting a lower depth reduces latency, but increases the demand of the +* application to service the driver without frame loss. The DSP has 480 +* bytes of physical buffer memory for the record channel so the true +* maximum limit is determined by how many frames will fit in the buffer. +* +* 1 uncompressed (480 byte) 16-bit linear frame. +* 2 uncompressed (240 byte) 8-bit A-law/mu-law frames. +* 15 TrueSpeech 8.5 frames. +* 20 TrueSpeech 6.3,5.3,4.8 or 4.1 frames. +* +* The default in the driver is currently set to 2 frames. +* +* The IXJCTL_REC_VOLUME and IXJCTL_PLAY_VOLUME commands both use a Q8 +* number as a parameter, 0x100 scales the signal by 1.0, 0x200 scales the +* signal by 2.0, 0x80 scales the signal by 0.5. No protection is given +* against over-scaling, if the multiplication factor times the input +* signal exceeds 16 bits, overflow distortion will occur. The default +* setting is 0x100 (1.0). +* +* The IXJCTL_REC_LEVEL returns the average signal level (not r.m.s.) on +* the most recently recorded frame as a 16 bit value. +******************************************************************************/ + +#define IXJCTL_REC_CODEC PHONE_REC_CODEC +#define IXJCTL_REC_START PHONE_REC_START +#define IXJCTL_REC_STOP PHONE_REC_STOP +#define IXJCTL_REC_DEPTH PHONE_REC_DEPTH +#define IXJCTL_FRAME PHONE_FRAME +#define IXJCTL_REC_VOLUME PHONE_REC_VOLUME +#define IXJCTL_REC_LEVEL PHONE_REC_LEVEL + +typedef enum { + f300_640 = 4, f300_500, f1100, f350, f400, f480, f440, f620, f20_50, + f133_200, f300, f300_420, f330, f300_425, f330_440, f340, f350_400, + f350_440, f350_450, f360, f380_420, f392, f400_425, f400_440, f400_450, + f420, f425, f425_450, f425_475, f435, f440_450, f440_480, f445, f450, + f452, f475, f480_620, f494, f500, f520, f523, f525, f540_660, f587, + f590, f600, f660, f700, f740, f750, f750_1450, f770, f800, f816, f850, + f857_1645, f900, f900_1300, f935_1215, f941_1477, f942, f950, f950_1400, + f975, f1000, f1020, f1050, f1100_1750, f1140, f1200, f1209, f1330, f1336, + lf1366, f1380, f1400, f1477, f1600, f1633_1638, f1800, f1860 +} IXJ_FILTER_FREQ; + +typedef struct { + unsigned int filter; + IXJ_FILTER_FREQ freq; + char enable; +} IXJ_FILTER; + +typedef struct { + char enable; + char en_filter; + unsigned int filter; + unsigned int on1; + unsigned int off1; + unsigned int on2; + unsigned int off2; + unsigned int on3; + unsigned int off3; +} IXJ_FILTER_CADENCE; + +#define IXJCTL_SET_FILTER _IOW ('q', 0xC7, IXJ_FILTER *) +#define IXJCTL_SET_FILTER_RAW _IOW ('q', 0xDD, IXJ_FILTER_RAW *) +#define IXJCTL_GET_FILTER_HIST _IOW ('q', 0xC8, int) +#define IXJCTL_FILTER_CADENCE _IOW ('q', 0xD6, IXJ_FILTER_CADENCE *) +#define IXJCTL_PLAY_CID _IO ('q', 0xD7) +/****************************************************************************** +* +* This IOCTL allows you to reassign values in the tone index table. The +* tone table has 32 entries (0 - 31), but the driver only allows entries +* 13 - 27 to be modified, entry 0 is reserved for silence and 1 - 12 are +* the standard DTMF digits and 28 - 31 are the DTMF tones for A, B, C & D. +* The positions used internally for Call Progress Tones are as follows: +* Dial Tone - 25 +* Ring Back - 26 +* Busy Signal - 27 +* +* The freq values are calculated as: +* freq = cos(2 * PI * frequency / 8000) +* +* The most commonly needed values are already calculated and listed in the +* enum IXJ_TONE_FREQ. Each tone index can have two frequencies with +* different gains, if you are only using a single frequency set the unused +* one to 0. +* +* The gain values range from 0 to 15 indicating +6dB to -24dB in 2dB +* increments. +* +******************************************************************************/ + +typedef enum { + hz20 = 0x7ffa, + hz50 = 0x7fe5, + hz133 = 0x7f4c, + hz200 = 0x7e6b, + hz261 = 0x7d50, /* .63 C1 */ + hz277 = 0x7cfa, /* .18 CS1 */ + hz293 = 0x7c9f, /* .66 D1 */ + hz300 = 0x7c75, + hz311 = 0x7c32, /* .13 DS1 */ + hz329 = 0x7bbf, /* .63 E1 */ + hz330 = 0x7bb8, + hz340 = 0x7b75, + hz349 = 0x7b37, /* .23 F1 */ + hz350 = 0x7b30, + hz360 = 0x7ae9, + hz369 = 0x7aa8, /* .99 FS1 */ + hz380 = 0x7a56, + hz392 = 0x79fa, /* .00 G1 */ + hz400 = 0x79bb, + hz415 = 0x7941, /* .30 GS1 */ + hz420 = 0x7918, + hz425 = 0x78ee, + hz435 = 0x7899, + hz440 = 0x786d, /* .00 A1 */ + hz445 = 0x7842, + hz450 = 0x7815, + hz452 = 0x7803, + hz466 = 0x7784, /* .16 AS1 */ + hz475 = 0x7731, + hz480 = 0x7701, + hz493 = 0x7685, /* .88 B1 */ + hz494 = 0x767b, + hz500 = 0x7640, + hz520 = 0x7578, + hz523 = 0x7559, /* .25 C2 */ + hz525 = 0x7544, + hz540 = 0x74a7, + hz554 = 0x7411, /* .37 CS2 */ + hz587 = 0x72a1, /* .33 D2 */ + hz590 = 0x727f, + hz600 = 0x720b, + hz620 = 0x711e, + hz622 = 0x7106, /* .25 DS2 */ + hz659 = 0x6f3b, /* .26 E2 */ + hz660 = 0x6f2e, + hz698 = 0x6d3d, /* .46 F2 */ + hz700 = 0x6d22, + hz739 = 0x6b09, /* .99 FS2 */ + hz740 = 0x6afa, + hz750 = 0x6a6c, + hz770 = 0x694b, + hz783 = 0x688b, /* .99 G2 */ + hz800 = 0x678d, + hz816 = 0x6698, + hz830 = 0x65bf, /* .61 GS2 */ + hz850 = 0x6484, + hz857 = 0x6414, + hz880 = 0x629f, /* .00 A2 */ + hz900 = 0x6154, + hz932 = 0x5f35, /* .33 AS2 */ + hz935 = 0x5f01, + hz941 = 0x5e9a, + hz942 = 0x5e88, + hz950 = 0x5dfd, + hz975 = 0x5c44, + hz1000 = 0x5a81, + hz1020 = 0x5912, + hz1050 = 0x56e2, + hz1100 = 0x5320, + hz1140 = 0x5007, + hz1200 = 0x4b3b, + hz1209 = 0x4a80, + hz1215 = 0x4a02, + hz1250 = 0x471c, + hz1300 = 0x42e0, + hz1330 = 0x4049, + hz1336 = 0x3fc4, + hz1366 = 0x3d22, + hz1380 = 0x3be4, + hz1400 = 0x3a1b, + hz1450 = 0x3596, + hz1477 = 0x331c, + hz1500 = 0x30fb, + hz1600 = 0x278d, + hz1633 = 0x2462, + hz1638 = 0x23e7, + hz1645 = 0x233a, + hz1750 = 0x18f8, + hz1800 = 0x1405, + hz1860 = 0xe0b, + hz2100 = 0xf5f6, + hz2130 = 0xf2f5, + hz2450 = 0xd3b3, + hz2750 = 0xb8e4 +} IXJ_FREQ; + +typedef enum { + C1 = hz261, + CS1 = hz277, + D1 = hz293, + DS1 = hz311, + E1 = hz329, + F1 = hz349, + FS1 = hz369, + G1 = hz392, + GS1 = hz415, + A1 = hz440, + AS1 = hz466, + B1 = hz493, + C2 = hz523, + CS2 = hz554, + D2 = hz587, + DS2 = hz622, + E2 = hz659, + F2 = hz698, + FS2 = hz739, + G2 = hz783, + GS2 = hz830, + A2 = hz880, + AS2 = hz932, +} IXJ_NOTE; + +typedef struct { + int tone_index; + int freq0; + int gain0; + int freq1; + int gain1; +} IXJ_TONE; + +#define IXJCTL_INIT_TONE _IOW ('q', 0xC9, IXJ_TONE *) + +/****************************************************************************** +* +* The IXJCTL_TONE_CADENCE ioctl defines tone sequences used for various +* Call Progress Tones (CPT). This is accomplished by setting up an array of +* IXJ_CADENCE_ELEMENT structures that sequentially define the states of +* the tone sequence. The tone_on_time and tone_off time are in +* 250 microsecond intervals. A pointer to this array is passed to the +* driver as the ce element of an IXJ_CADENCE structure. The elements_used +* must be set to the number of IXJ_CADENCE_ELEMENTS in the array. The +* termination variable defines what to do at the end of a cadence, the +* options are to play the cadence once and stop, to repeat the last +* element of the cadence indefinitely, or to repeat the entire cadence +* indefinitely. The ce variable is a pointer to the array of IXJ_TONE +* structures. If the freq0 variable is non-zero, the tone table contents +* for the tone_index are updated to the frequencies and gains defined. It +* should be noted that DTMF tones cannot be reassigned, so if DTMF tone +* table indexes are used in a cadence the frequency and gain variables will +* be ignored. +* +* If the array elements contain frequency parameters the driver will +* initialize the needed tone table elements and begin playing the tone, +* there is no preset limit on the number of elements in the cadence. If +* there is more than one frequency used in the cadence, sequential elements +* of different frequencies MUST use different tone table indexes. Only one +* cadence can be played at a time. It is possible to build complex +* cadences with multiple frequencies using 2 tone table indexes by +* alternating between them. +* +******************************************************************************/ + +typedef struct { + int index; + int tone_on_time; + int tone_off_time; + int freq0; + int gain0; + int freq1; + int gain1; +} IXJ_CADENCE_ELEMENT; + +typedef enum { + PLAY_ONCE, + REPEAT_LAST_ELEMENT, + REPEAT_ALL +} IXJ_CADENCE_TERM; + +typedef struct { + int elements_used; + IXJ_CADENCE_TERM termination; + IXJ_CADENCE_ELEMENT *ce; +} IXJ_CADENCE; + +#define IXJCTL_TONE_CADENCE _IOW ('q', 0xCA, IXJ_CADENCE *) +/****************************************************************************** +* +* This group of IOCTLs deal with the playback settings of the DSP +* +******************************************************************************/ + +#define IXJCTL_PLAY_CODEC PHONE_PLAY_CODEC +#define IXJCTL_PLAY_START PHONE_PLAY_START +#define IXJCTL_PLAY_STOP PHONE_PLAY_STOP +#define IXJCTL_PLAY_DEPTH PHONE_PLAY_DEPTH +#define IXJCTL_PLAY_VOLUME PHONE_PLAY_VOLUME +#define IXJCTL_PLAY_LEVEL PHONE_PLAY_LEVEL + +/****************************************************************************** +* +* This group of IOCTLs deal with the Acoustic Echo Cancellation settings +* of the DSP +* +* Issuing the IXJCTL_AEC_START command with a value of AEC_OFF has the +* same effect as IXJCTL_AEC_STOP. This is to simplify slider bar +* controls. IXJCTL_AEC_GET_LEVEL returns the current setting of the AEC. +******************************************************************************/ +#define IXJCTL_AEC_START _IOW ('q', 0xCB, int) +#define IXJCTL_AEC_STOP _IO ('q', 0xCC) +#define IXJCTL_AEC_GET_LEVEL _IO ('q', 0xCD) + +#define AEC_OFF 0 +#define AEC_LOW 1 +#define AEC_MED 2 +#define AEC_HIGH 3 +#define AEC_AUTO 4 +#define AEC_AGC 5 +/****************************************************************************** +* +* Call Progress Tones, DTMF, etc. +* IXJCTL_DTMF_OOB determines if DTMF signaling is sent as Out-Of-Band +* only. If you pass a 1, DTMF is suppressed from the audio stream. +* Tone on and off times are in 250 microsecond intervals so +* ioctl(ixj1, IXJCTL_SET_TONE_ON_TIME, 360); +* will set the tone on time of board ixj1 to 360 * 250us = 90ms +* the default values of tone on and off times is 840 or 210ms +******************************************************************************/ + +#define IXJCTL_DTMF_READY PHONE_DTMF_READY +#define IXJCTL_GET_DTMF PHONE_GET_DTMF +#define IXJCTL_GET_DTMF_ASCII PHONE_GET_DTMF_ASCII +#define IXJCTL_DTMF_OOB PHONE_DTMF_OOB +#define IXJCTL_EXCEPTION PHONE_EXCEPTION +#define IXJCTL_PLAY_TONE PHONE_PLAY_TONE +#define IXJCTL_SET_TONE_ON_TIME PHONE_SET_TONE_ON_TIME +#define IXJCTL_SET_TONE_OFF_TIME PHONE_SET_TONE_OFF_TIME +#define IXJCTL_GET_TONE_ON_TIME PHONE_GET_TONE_ON_TIME +#define IXJCTL_GET_TONE_OFF_TIME PHONE_GET_TONE_OFF_TIME +#define IXJCTL_GET_TONE_STATE PHONE_GET_TONE_STATE +#define IXJCTL_BUSY PHONE_BUSY +#define IXJCTL_RINGBACK PHONE_RINGBACK +#define IXJCTL_DIALTONE PHONE_DIALTONE +#define IXJCTL_CPT_STOP PHONE_CPT_STOP + +/****************************************************************************** +* LineJACK specific IOCTLs +* +* The lsb 4 bits of the LED argument represent the state of each of the 4 +* LED's on the LineJACK +******************************************************************************/ + +#define IXJCTL_SET_LED _IOW ('q', 0xCE, int) +#define IXJCTL_MIXER _IOW ('q', 0xCF, int) + +/****************************************************************************** +* +* The master volume controls use attenuation with 32 levels from 0 to -62dB +* with steps of 2dB each, the defines should be OR'ed together then sent +* as the parameter to the mixer command to change the mixer settings. +* +******************************************************************************/ +#define MIXER_MASTER_L 0x0000 +#define MIXER_MASTER_R 0x0100 +#define ATT00DB 0x00 +#define ATT02DB 0x01 +#define ATT04DB 0x02 +#define ATT06DB 0x03 +#define ATT08DB 0x04 +#define ATT10DB 0x05 +#define ATT12DB 0x06 +#define ATT14DB 0x07 +#define ATT16DB 0x08 +#define ATT18DB 0x09 +#define ATT20DB 0x0A +#define ATT22DB 0x0B +#define ATT24DB 0x0C +#define ATT26DB 0x0D +#define ATT28DB 0x0E +#define ATT30DB 0x0F +#define ATT32DB 0x10 +#define ATT34DB 0x11 +#define ATT36DB 0x12 +#define ATT38DB 0x13 +#define ATT40DB 0x14 +#define ATT42DB 0x15 +#define ATT44DB 0x16 +#define ATT46DB 0x17 +#define ATT48DB 0x18 +#define ATT50DB 0x19 +#define ATT52DB 0x1A +#define ATT54DB 0x1B +#define ATT56DB 0x1C +#define ATT58DB 0x1D +#define ATT60DB 0x1E +#define ATT62DB 0x1F +#define MASTER_MUTE 0x80 + +/****************************************************************************** +* +* The input volume controls use gain with 32 levels from +12dB to -50dB +* with steps of 2dB each, the defines should be OR'ed together then sent +* as the parameter to the mixer command to change the mixer settings. +* +******************************************************************************/ +#define MIXER_PORT_CD_L 0x0600 +#define MIXER_PORT_CD_R 0x0700 +#define MIXER_PORT_LINE_IN_L 0x0800 +#define MIXER_PORT_LINE_IN_R 0x0900 +#define MIXER_PORT_POTS_REC 0x0C00 +#define MIXER_PORT_MIC 0x0E00 + +#define GAIN12DB 0x00 +#define GAIN10DB 0x01 +#define GAIN08DB 0x02 +#define GAIN06DB 0x03 +#define GAIN04DB 0x04 +#define GAIN02DB 0x05 +#define GAIN00DB 0x06 +#define GAIN_02DB 0x07 +#define GAIN_04DB 0x08 +#define GAIN_06DB 0x09 +#define GAIN_08DB 0x0A +#define GAIN_10DB 0x0B +#define GAIN_12DB 0x0C +#define GAIN_14DB 0x0D +#define GAIN_16DB 0x0E +#define GAIN_18DB 0x0F +#define GAIN_20DB 0x10 +#define GAIN_22DB 0x11 +#define GAIN_24DB 0x12 +#define GAIN_26DB 0x13 +#define GAIN_28DB 0x14 +#define GAIN_30DB 0x15 +#define GAIN_32DB 0x16 +#define GAIN_34DB 0x17 +#define GAIN_36DB 0x18 +#define GAIN_38DB 0x19 +#define GAIN_40DB 0x1A +#define GAIN_42DB 0x1B +#define GAIN_44DB 0x1C +#define GAIN_46DB 0x1D +#define GAIN_48DB 0x1E +#define GAIN_50DB 0x1F +#define INPUT_MUTE 0x80 + +/****************************************************************************** +* +* The POTS volume control use attenuation with 8 levels from 0dB to -28dB +* with steps of 4dB each, the defines should be OR'ed together then sent +* as the parameter to the mixer command to change the mixer settings. +* +******************************************************************************/ +#define MIXER_PORT_POTS_PLAY 0x0F00 + +#define POTS_ATT_00DB 0x00 +#define POTS_ATT_04DB 0x01 +#define POTS_ATT_08DB 0x02 +#define POTS_ATT_12DB 0x03 +#define POTS_ATT_16DB 0x04 +#define POTS_ATT_20DB 0x05 +#define POTS_ATT_24DB 0x06 +#define POTS_ATT_28DB 0x07 +#define POTS_MUTE 0x80 + +/****************************************************************************** +* +* The DAA controls the interface to the PSTN port. The driver loads the +* US coefficients by default, so if you live in a different country you +* need to load the set for your countries phone system. +* +******************************************************************************/ +#define IXJCTL_DAA_COEFF_SET _IOW ('q', 0xD0, int) + +#define DAA_US 1 /*PITA 8kHz */ +#define DAA_UK 2 /*ISAR34 8kHz */ +#define DAA_FRANCE 3 /* */ +#define DAA_GERMANY 4 +#define DAA_AUSTRALIA 5 +#define DAA_JAPAN 6 + +/****************************************************************************** +* +* Use IXJCTL_PORT to set or query the port the card is set to. If the +* argument is set to PORT_QUERY, the return value of the ioctl will +* indicate which port is currently in use, otherwise it will change the +* port. +* +******************************************************************************/ +#define IXJCTL_PORT _IOW ('q', 0xD1, int) + +#define PORT_QUERY 0 +#define PORT_POTS 1 +#define PORT_PSTN 2 +#define PORT_SPEAKER 3 +#define PORT_HANDSET 4 + +#define IXJCTL_PSTN_SET_STATE PHONE_PSTN_SET_STATE +#define IXJCTL_PSTN_GET_STATE PHONE_PSTN_GET_STATE + +#define PSTN_ON_HOOK 0 +#define PSTN_RINGING 1 +#define PSTN_OFF_HOOK 2 +#define PSTN_PULSE_DIAL 3 + +/****************************************************************************** +* +* The DAA Analog GAIN sets 2 parameters at one time, the receive gain (AGRR), +* and the transmit gain (AGX). OR together the components and pass them +* as the parameter to IXJCTL_DAA_AGAIN. The default setting is both at 0dB. +* +******************************************************************************/ +#define IXJCTL_DAA_AGAIN _IOW ('q', 0xD2, int) + +#define AGRR00DB 0x00 /* Analog gain in receive direction 0dB */ +#define AGRR3_5DB 0x10 /* Analog gain in receive direction 3.5dB */ +#define AGRR06DB 0x30 /* Analog gain in receive direction 6dB */ + +#define AGX00DB 0x00 /* Analog gain in transmit direction 0dB */ +#define AGX_6DB 0x04 /* Analog gain in transmit direction -6dB */ +#define AGX3_5DB 0x08 /* Analog gain in transmit direction 3.5dB */ +#define AGX_2_5B 0x0C /* Analog gain in transmit direction -2.5dB */ + +#define IXJCTL_PSTN_LINETEST _IO ('q', 0xD3) + +#define IXJCTL_CID _IOR ('q', 0xD4, PHONE_CID *) +#define IXJCTL_VMWI _IOR ('q', 0xD8, int) +#define IXJCTL_CIDCW _IOW ('q', 0xD9, PHONE_CID *) +/****************************************************************************** +* +* The wink duration is tunable with this ioctl. The default wink duration +* is 320ms. You do not need to use this ioctl if you do not require a +* different wink duration. +* +******************************************************************************/ +#define IXJCTL_WINK_DURATION PHONE_WINK_DURATION + +/****************************************************************************** +* +* This ioctl will connect the POTS port to the PSTN port on the LineJACK +* In order for this to work properly the port selection should be set to +* the PSTN port with IXJCTL_PORT prior to calling this ioctl. This will +* enable conference calls between PSTN callers and network callers. +* Passing a 1 to this ioctl enables the POTS<->PSTN connection while +* passing a 0 turns it back off. +* +******************************************************************************/ +#define IXJCTL_POTS_PSTN _IOW ('q', 0xD5, int) + +/****************************************************************************** +* +* IOCTLs added by request. +* +* IXJCTL_HZ sets the value your Linux kernel uses for HZ as defined in +* /usr/include/asm/param.h, this determines the fundamental +* frequency of the clock ticks on your Linux system. The kernel +* must be rebuilt if you change this value, also all modules you +* use (except this one) must be recompiled. The default value +* is 100, and you only need to use this IOCTL if you use some +* other value. +* +* +* IXJCTL_RATE sets the number of times per second that the driver polls +* the DSP. This value cannot be larger than HZ. By +* increasing both of these values, you may be able to reduce +* latency because the max hang time that can exist between the +* driver and the DSP will be reduced. +* +******************************************************************************/ + +#define IXJCTL_HZ _IOW ('q', 0xE0, int) +#define IXJCTL_RATE _IOW ('q', 0xE1, int) +#define IXJCTL_FRAMES_READ _IOR ('q', 0xE2, unsigned long) +#define IXJCTL_FRAMES_WRITTEN _IOR ('q', 0xE3, unsigned long) +#define IXJCTL_READ_WAIT _IOR ('q', 0xE4, unsigned long) +#define IXJCTL_WRITE_WAIT _IOR ('q', 0xE5, unsigned long) +#define IXJCTL_DRYBUFFER_READ _IOR ('q', 0xE6, unsigned long) +#define IXJCTL_DRYBUFFER_CLEAR _IO ('q', 0xE7) +#define IXJCTL_DTMF_PRESCALE _IOW ('q', 0xE8, int) + +/****************************************************************************** +* +* This ioctl allows the user application to control what events the driver +* will send signals for, and what signals it will send for which event. +* By default, if signaling is enabled, all events will send SIGIO when +* they occur. To disable signals for an event set the signal to 0. +* +******************************************************************************/ +typedef enum { + SIG_DTMF_READY, + SIG_HOOKSTATE, + SIG_FLASH, + SIG_PSTN_RING, + SIG_CALLER_ID, + SIG_PSTN_WINK, + SIG_F0, SIG_F1, SIG_F2, SIG_F3, + SIG_FC0, SIG_FC1, SIG_FC2, SIG_FC3, + SIG_READ_READY = 33, + SIG_WRITE_READY = 34 +} IXJ_SIGEVENT; + +typedef struct { + unsigned int event; + int signal; +} IXJ_SIGDEF; + +#define IXJCTL_SIGCTL _IOW ('q', 0xE9, IXJ_SIGDEF *) + +/****************************************************************************** +* +* These ioctls allow the user application to change the gain in the +* Smart Cable of the Internet Phone Card. Sending -1 as a value will cause +* return value to be the current setting. Valid values to set are 0x00 - 0x1F +* +* 11111 = +12 dB +* 10111 = 0 dB +* 00000 = -34.5 dB +* +* IXJCTL_SC_RXG sets the Receive gain +* IXJCTL_SC_TXG sets the Transmit gain +* +******************************************************************************/ +#define IXJCTL_SC_RXG _IOW ('q', 0xEA, int) +#define IXJCTL_SC_TXG _IOW ('q', 0xEB, int) + +/****************************************************************************** +* +* The intercom IOCTL's short the output from one card to the input of the +* other and vice versa (actually done in the DSP read function). It is only +* necessary to execute the IOCTL on one card, but it is necessary to have +* both devices open to be able to detect hook switch changes. The record +* codec and rate of each card must match the playback codec and rate of +* the other card for this to work properly. +* +******************************************************************************/ + +#define IXJCTL_INTERCOM_START _IOW ('q', 0xFD, int) +#define IXJCTL_INTERCOM_STOP _IOW ('q', 0xFE, int) + +/****************************************************************************** + * + * new structure for accessing raw filter information + * + ******************************************************************************/ + +typedef struct { + unsigned int filter; + char enable; + unsigned int coeff[19]; +} IXJ_FILTER_RAW; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/jffs2.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/jffs2.h new file mode 100644 index 0000000..2b32d63 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/jffs2.h @@ -0,0 +1,222 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright (C) 2001-2003 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in the + * jffs2 directory. + */ + +#ifndef __LINUX_JFFS2_H__ +#define __LINUX_JFFS2_H__ + +#include +#include + +/* You must include something which defines the C99 uintXX_t types. + We don't do it from here because this file is used in too many + different environments. */ + +/* Values we may expect to find in the 'magic' field */ +#define JFFS2_OLD_MAGIC_BITMASK 0x1984 +#define JFFS2_MAGIC_BITMASK 0x1985 +#define KSAMTIB_CIGAM_2SFFJ 0x8519 /* For detecting wrong-endian fs */ +#define JFFS2_EMPTY_BITMASK 0xffff +#define JFFS2_DIRTY_BITMASK 0x0000 + +/* Summary node MAGIC marker */ +#define JFFS2_SUM_MAGIC 0x02851885 + +/* We only allow a single char for length, and 0xFF is empty flash so + we don't want it confused with a real length. Hence max 254. +*/ +#define JFFS2_MAX_NAME_LEN 254 + +/* How small can we sensibly write nodes? */ +#define JFFS2_MIN_DATA_LEN 128 + +#define JFFS2_COMPR_NONE 0x00 +#define JFFS2_COMPR_ZERO 0x01 +#define JFFS2_COMPR_RTIME 0x02 +#define JFFS2_COMPR_RUBINMIPS 0x03 +#define JFFS2_COMPR_COPY 0x04 +#define JFFS2_COMPR_DYNRUBIN 0x05 +#define JFFS2_COMPR_ZLIB 0x06 +#define JFFS2_COMPR_LZO 0x07 +/* Compatibility flags. */ +#define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ +#define JFFS2_NODE_ACCURATE 0x2000 +/* INCOMPAT: Fail to mount the filesystem */ +#define JFFS2_FEATURE_INCOMPAT 0xc000 +/* ROCOMPAT: Mount read-only */ +#define JFFS2_FEATURE_ROCOMPAT 0x8000 +/* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */ +#define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000 +/* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */ +#define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000 + +#define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1) +#define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2) +#define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) +#define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4) + +#define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6) + +#define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8) +#define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9) + +/* XATTR Related */ +#define JFFS2_XPREFIX_USER 1 /* for "user." */ +#define JFFS2_XPREFIX_SECURITY 2 /* for "security." */ +#define JFFS2_XPREFIX_ACL_ACCESS 3 /* for "system.posix_acl_access" */ +#define JFFS2_XPREFIX_ACL_DEFAULT 4 /* for "system.posix_acl_default" */ +#define JFFS2_XPREFIX_TRUSTED 5 /* for "trusted.*" */ + +#define JFFS2_ACL_VERSION 0x0001 + +// Maybe later... +//#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) +//#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) + + +#define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at + mount time, don't wait for it to + happen later */ +#define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific + compression type */ + + +/* These can go once we've made sure we've caught all uses without + byteswapping */ + +typedef struct { + __u32 v32; +} __attribute__((packed)) jint32_t; + +typedef struct { + __u32 m; +} __attribute__((packed)) jmode_t; + +typedef struct { + __u16 v16; +} __attribute__((packed)) jint16_t; + +struct jffs2_unknown_node +{ + /* All start like this */ + jint16_t magic; + jint16_t nodetype; + jint32_t totlen; /* So we can skip over nodes we don't grok */ + jint32_t hdr_crc; +}; + +struct jffs2_raw_dirent +{ + jint16_t magic; + jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t pino; + jint32_t version; + jint32_t ino; /* == zero for unlink */ + jint32_t mctime; + __u8 nsize; + __u8 type; + __u8 unused[2]; + jint32_t node_crc; + jint32_t name_crc; + __u8 name[0]; +}; + +/* The JFFS2 raw inode structure: Used for storage on physical media. */ +/* The uid, gid, atime, mtime and ctime members could be longer, but + are left like this for space efficiency. If and when people decide + they really need them extended, it's simple enough to add support for + a new type of raw node. +*/ +struct jffs2_raw_inode +{ + jint16_t magic; /* A constant magic number. */ + jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */ + jint32_t totlen; /* Total length of this node (inc data, etc.) */ + jint32_t hdr_crc; + jint32_t ino; /* Inode number. */ + jint32_t version; /* Version number. */ + jmode_t mode; /* The file's type or mode. */ + jint16_t uid; /* The file's owner. */ + jint16_t gid; /* The file's group. */ + jint32_t isize; /* Total resultant size of this inode (used for truncations) */ + jint32_t atime; /* Last access time. */ + jint32_t mtime; /* Last modification time. */ + jint32_t ctime; /* Change time. */ + jint32_t offset; /* Where to begin to write. */ + jint32_t csize; /* (Compressed) data size */ + jint32_t dsize; /* Size of the node's data. (after decompression) */ + __u8 compr; /* Compression algorithm used */ + __u8 usercompr; /* Compression algorithm requested by the user */ + jint16_t flags; /* See JFFS2_INO_FLAG_* */ + jint32_t data_crc; /* CRC for the (compressed) data. */ + jint32_t node_crc; /* CRC for the raw inode (excluding data) */ + __u8 data[0]; +}; + +struct jffs2_raw_xattr { + jint16_t magic; + jint16_t nodetype; /* = JFFS2_NODETYPE_XATTR */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t xid; /* XATTR identifier number */ + jint32_t version; + __u8 xprefix; + __u8 name_len; + jint16_t value_len; + jint32_t data_crc; + jint32_t node_crc; + __u8 data[0]; +} __attribute__((packed)); + +struct jffs2_raw_xref +{ + jint16_t magic; + jint16_t nodetype; /* = JFFS2_NODETYPE_XREF */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t ino; /* inode number */ + jint32_t xid; /* XATTR identifier number */ + jint32_t xseqno; /* xref sequencial number */ + jint32_t node_crc; +} __attribute__((packed)); + +struct jffs2_raw_summary +{ + jint16_t magic; + jint16_t nodetype; /* = JFFS2_NODETYPE_SUMMARY */ + jint32_t totlen; + jint32_t hdr_crc; + jint32_t sum_num; /* number of sum entries*/ + jint32_t cln_mkr; /* clean marker size, 0 = no cleanmarker */ + jint32_t padded; /* sum of the size of padding nodes */ + jint32_t sum_crc; /* summary information crc */ + jint32_t node_crc; /* node crc */ + jint32_t sum[0]; /* inode summary info */ +}; + +union jffs2_node_union +{ + struct jffs2_raw_inode i; + struct jffs2_raw_dirent d; + struct jffs2_raw_xattr x; + struct jffs2_raw_xref r; + struct jffs2_raw_summary s; + struct jffs2_unknown_node u; +}; + +/* Data payload for device nodes. */ +union jffs2_device_node { + jint16_t old; + jint32_t new; +}; + +#endif /* __LINUX_JFFS2_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/joystick.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/joystick.h new file mode 100644 index 0000000..0cb947f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/joystick.h @@ -0,0 +1,136 @@ +#ifndef _LINUX_JOYSTICK_H +#define _LINUX_JOYSTICK_H + +/* + * Copyright (C) 1996-2000 Vojtech Pavlik + * + * Sponsored by SuSE + */ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Should you need to contact me, the author, you can do so either by + * e-mail - mail your message to , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include +#include + +/* + * Version + */ + +#define JS_VERSION 0x020100 + +/* + * Types and constants for reading from /dev/js + */ + +#define JS_EVENT_BUTTON 0x01 /* button pressed/released */ +#define JS_EVENT_AXIS 0x02 /* joystick moved */ +#define JS_EVENT_INIT 0x80 /* initial state of device */ + +struct js_event { + __u32 time; /* event timestamp in milliseconds */ + __s16 value; /* value */ + __u8 type; /* event type */ + __u8 number; /* axis/button number */ +}; + +/* + * IOCTL commands for joystick driver + */ + +#define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */ + +#define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */ +#define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */ +#define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */ + +#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ +#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ + +#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_MAX + 1]) /* set axis mapping */ +#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_MAX + 1]) /* get axis mapping */ +#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ +#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ + +/* + * Types and constants for get/set correction + */ + +#define JS_CORR_NONE 0x00 /* returns raw values */ +#define JS_CORR_BROKEN 0x01 /* broken line */ + +struct js_corr { + __s32 coef[8]; + __s16 prec; + __u16 type; +}; + +/* + * v0.x compatibility definitions + */ + +#define JS_RETURN sizeof(struct JS_DATA_TYPE) +#define JS_TRUE 1 +#define JS_FALSE 0 +#define JS_X_0 0x01 +#define JS_Y_0 0x02 +#define JS_X_1 0x04 +#define JS_Y_1 0x08 +#define JS_MAX 2 + +#define JS_DEF_TIMEOUT 0x1300 +#define JS_DEF_CORR 0 +#define JS_DEF_TIMELIMIT 10L + +#define JS_SET_CAL 1 +#define JS_GET_CAL 2 +#define JS_SET_TIMEOUT 3 +#define JS_GET_TIMEOUT 4 +#define JS_SET_TIMELIMIT 5 +#define JS_GET_TIMELIMIT 6 +#define JS_GET_ALL 7 +#define JS_SET_ALL 8 + +struct JS_DATA_TYPE { + __s32 buttons; + __s32 x; + __s32 y; +}; + +struct JS_DATA_SAVE_TYPE_32 { + __s32 JS_TIMEOUT; + __s32 BUSY; + __s32 JS_EXPIRETIME; + __s32 JS_TIMELIMIT; + struct JS_DATA_TYPE JS_SAVE; + struct JS_DATA_TYPE JS_CORR; +}; + +struct JS_DATA_SAVE_TYPE_64 { + __s32 JS_TIMEOUT; + __s32 BUSY; + __s64 JS_EXPIRETIME; + __s64 JS_TIMELIMIT; + struct JS_DATA_TYPE JS_SAVE; + struct JS_DATA_TYPE JS_CORR; +}; + + +#endif /* _LINUX_JOYSTICK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kd.h new file mode 100644 index 0000000..15c8122 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kd.h @@ -0,0 +1,182 @@ +#ifndef _LINUX_KD_H +#define _LINUX_KD_H +#include + + +/* 0x4B is 'K', to avoid collision with termios and vt */ + +#define GIO_FONT 0x4B60 /* gets font in expanded form */ +#define PIO_FONT 0x4B61 /* use font in expanded form */ + +#define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */ +#define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */ +struct consolefontdesc { + unsigned short charcount; /* characters in font (256 or 512) */ + unsigned short charheight; /* scan lines per character (1-32) */ + char *chardata; /* font data in expanded form */ +}; + +#define PIO_FONTRESET 0x4B6D /* reset to default font */ + +#define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */ +#define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */ + +#define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ +#define KDMKTONE 0x4B30 /* generate tone */ + +#define KDGETLED 0x4B31 /* return current led state */ +#define KDSETLED 0x4B32 /* set led state [lights, not flags] */ +#define LED_SCR 0x01 /* scroll lock led */ +#define LED_NUM 0x02 /* num lock led */ +#define LED_CAP 0x04 /* caps lock led */ + +#define KDGKBTYPE 0x4B33 /* get keyboard type */ +#define KB_84 0x01 +#define KB_101 0x02 /* this is what we always answer */ +#define KB_OTHER 0x03 + +#define KDADDIO 0x4B34 /* add i/o port as valid */ +#define KDDELIO 0x4B35 /* del i/o port as valid */ +#define KDENABIO 0x4B36 /* enable i/o to video board */ +#define KDDISABIO 0x4B37 /* disable i/o to video board */ + +#define KDSETMODE 0x4B3A /* set text/graphics mode */ +#define KD_TEXT 0x00 +#define KD_GRAPHICS 0x01 +#define KD_TEXT0 0x02 /* obsolete */ +#define KD_TEXT1 0x03 /* obsolete */ +#define KDGETMODE 0x4B3B /* get current mode */ + +#define KDMAPDISP 0x4B3C /* map display into address space */ +#define KDUNMAPDISP 0x4B3D /* unmap display from address space */ + +typedef char scrnmap_t; +#define E_TABSZ 256 +#define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */ +#define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */ +#define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */ +#define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */ + +#define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */ +struct unipair { + unsigned short unicode; + unsigned short fontpos; +}; +struct unimapdesc { + unsigned short entry_ct; + struct unipair *entries; +}; +#define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */ +#define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */ +struct unimapinit { + unsigned short advised_hashsize; /* 0 if no opinion */ + unsigned short advised_hashstep; /* 0 if no opinion */ + unsigned short advised_hashlevel; /* 0 if no opinion */ +}; + +#define UNI_DIRECT_BASE 0xF000 /* start of Direct Font Region */ +#define UNI_DIRECT_MASK 0x01FF /* Direct Font Region bitmask */ + +#define K_RAW 0x00 +#define K_XLATE 0x01 +#define K_MEDIUMRAW 0x02 +#define K_UNICODE 0x03 +#define KDGKBMODE 0x4B44 /* gets current keyboard mode */ +#define KDSKBMODE 0x4B45 /* sets current keyboard mode */ + +#define K_METABIT 0x03 +#define K_ESCPREFIX 0x04 +#define KDGKBMETA 0x4B62 /* gets meta key handling mode */ +#define KDSKBMETA 0x4B63 /* sets meta key handling mode */ + +#define K_SCROLLLOCK 0x01 +#define K_NUMLOCK 0x02 +#define K_CAPSLOCK 0x04 +#define KDGKBLED 0x4B64 /* get led flags (not lights) */ +#define KDSKBLED 0x4B65 /* set led flags (not lights) */ + +struct kbentry { + unsigned char kb_table; + unsigned char kb_index; + unsigned short kb_value; +}; +#define K_NORMTAB 0x00 +#define K_SHIFTTAB 0x01 +#define K_ALTTAB 0x02 +#define K_ALTSHIFTTAB 0x03 + +#define KDGKBENT 0x4B46 /* gets one entry in translation table */ +#define KDSKBENT 0x4B47 /* sets one entry in translation table */ + +struct kbsentry { + unsigned char kb_func; + unsigned char kb_string[512]; +}; +#define KDGKBSENT 0x4B48 /* gets one function key string entry */ +#define KDSKBSENT 0x4B49 /* sets one function key string entry */ + +struct kbdiacr { + unsigned char diacr, base, result; +}; +struct kbdiacrs { + unsigned int kb_cnt; /* number of entries in following array */ + struct kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */ +}; +#define KDGKBDIACR 0x4B4A /* read kernel accent table */ +#define KDSKBDIACR 0x4B4B /* write kernel accent table */ + +struct kbdiacruc { + unsigned int diacr, base, result; +}; +struct kbdiacrsuc { + unsigned int kb_cnt; /* number of entries in following array */ + struct kbdiacruc kbdiacruc[256]; /* MAX_DIACR from keyboard.h */ +}; +#define KDGKBDIACRUC 0x4BFA /* read kernel accent table - UCS */ +#define KDSKBDIACRUC 0x4BFB /* write kernel accent table - UCS */ + +struct kbkeycode { + unsigned int scancode, keycode; +}; +#define KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */ +#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ + +#define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */ + +struct kbd_repeat { + int delay; /* in msec; <= 0: don't change */ + int period; /* in msec; <= 0: don't change */ + /* earlier this field was misnamed "rate" */ +}; + +#define KDKBDREP 0x4B52 /* set keyboard delay/repeat rate; + * actually used values are returned */ + +#define KDFONTOP 0x4B72 /* font operations */ + +struct console_font_op { + unsigned int op; /* operation code KD_FONT_OP_* */ + unsigned int flags; /* KD_FONT_FLAG_* */ + unsigned int width, height; /* font size */ + unsigned int charcount; + unsigned char *data; /* font data with height fixed to 32 */ +}; + +struct console_font { + unsigned int width, height; /* font size */ + unsigned int charcount; + unsigned char *data; /* font data with height fixed to 32 */ +}; + +#define KD_FONT_OP_SET 0 /* Set font */ +#define KD_FONT_OP_GET 1 /* Get font */ +#define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */ +#define KD_FONT_OP_COPY 3 /* Copy from another console */ + +#define KD_FONT_FLAG_DONT_RECALC 1 /* Don't recalculate hw charcell size [compat] */ + +/* note: 0x4B00-0x4B4E all have had a value at some time; + don't reuse for the time being */ +/* note: 0x4B60-0x4B6D, 0x4B70-0x4B72 used above */ + +#endif /* _LINUX_KD_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kdev_t.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kdev_t.h new file mode 100644 index 0000000..af5551d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kdev_t.h @@ -0,0 +1,11 @@ +#ifndef _LINUX_KDEV_T_H +#define _LINUX_KDEV_T_H + +/* +Some programs want their definitions of MAJOR and MINOR and MKDEV +from the kernel sources. These must be the externally visible ones. +*/ +#define MAJOR(dev) ((dev)>>8) +#define MINOR(dev) ((dev) & 0xff) +#define MKDEV(ma,mi) ((ma)<<8 | (mi)) +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kernel.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kernel.h new file mode 100644 index 0000000..299702e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kernel.h @@ -0,0 +1,51 @@ +#ifndef _LINUX_KERNEL_H +#define _LINUX_KERNEL_H + +/* + * 'kernel.h' contains some often-used function prototypes etc + */ + + +#define SI_LOAD_SHIFT 16 +struct sysinfo { + long uptime; /* Seconds since boot */ + unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ + unsigned long totalram; /* Total usable main memory size */ + unsigned long freeram; /* Available memory size */ + unsigned long sharedram; /* Amount of shared memory */ + unsigned long bufferram; /* Memory used by buffers */ + unsigned long totalswap; /* Total swap space size */ + unsigned long freeswap; /* swap space still available */ + unsigned short procs; /* Number of current processes */ + unsigned short pad; /* explicit padding for m68k */ + unsigned long totalhigh; /* Total high memory size */ + unsigned long freehigh; /* Available high memory size */ + unsigned int mem_unit; /* Memory unit size in bytes */ + char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ +}; + +/* Force a compilation error if condition is true */ +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) + +/* Force a compilation error if condition is true, but also produce a + result (of value 0 and type size_t), so the expression can be used + e.g. in a structure initializer (or where-ever else comma expressions + aren't permitted). */ +#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) + +/* Trap pasters of __FUNCTION__ at compile-time */ +#define __FUNCTION__ (__func__) + +/* This helps us to avoid #ifdef CONFIG_NUMA */ +#ifdef CONFIG_NUMA +#define NUMA_BUILD 1 +#else +#define NUMA_BUILD 0 +#endif + +/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ +#ifdef CONFIG_FTRACE_MCOUNT_RECORD +# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD +#endif + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kernelcapi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kernelcapi.h new file mode 100644 index 0000000..92f6b42 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/kernelcapi.h @@ -0,0 +1,47 @@ +/* + * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $ + * + * Kernel CAPI 2.0 Interface for Linux + * + * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) + * + */ + +#ifndef __KERNELCAPI_H__ +#define __KERNELCAPI_H__ + +#define CAPI_MAXAPPL 240 /* maximum number of applications */ +#define CAPI_MAXCONTR 32 /* maximum number of controller */ +#define CAPI_MAXDATAWINDOW 8 + + +typedef struct kcapi_flagdef { + int contr; + int flag; +} kcapi_flagdef; + +typedef struct kcapi_carddef { + char driver[32]; + unsigned int port; + unsigned irq; + unsigned int membase; + int cardnr; +} kcapi_carddef; + +/* new ioctls >= 10 */ +#define KCAPI_CMD_TRACE 10 +#define KCAPI_CMD_ADDCARD 11 /* OBSOLETE */ + +/* + * flag > 2 => trace also data + * flag & 1 => show trace + */ +#define KCAPI_TRACE_OFF 0 +#define KCAPI_TRACE_SHORT_NO_DATA 1 +#define KCAPI_TRACE_FULL_NO_DATA 2 +#define KCAPI_TRACE_SHORT 3 +#define KCAPI_TRACE_FULL 4 + + + +#endif /* __KERNELCAPI_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/keyboard.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/keyboard.h new file mode 100644 index 0000000..38e399f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/keyboard.h @@ -0,0 +1,442 @@ +#ifndef __LINUX_KEYBOARD_H +#define __LINUX_KEYBOARD_H + +#include + +#define KG_SHIFT 0 +#define KG_CTRL 2 +#define KG_ALT 3 +#define KG_ALTGR 1 +#define KG_SHIFTL 4 +#define KG_KANASHIFT 4 +#define KG_SHIFTR 5 +#define KG_CTRLL 6 +#define KG_CTRLR 7 +#define KG_CAPSSHIFT 8 + +#define NR_SHIFT 9 + +#define NR_KEYS 256 +#define MAX_NR_KEYMAPS 256 +/* This means 128Kb if all keymaps are allocated. Only the superuser + may increase the number of keymaps beyond MAX_NR_OF_USER_KEYMAPS. */ +#define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */ + + +#define MAX_NR_FUNC 256 /* max nr of strings assigned to keys */ + +#define KT_LATIN 0 /* we depend on this being zero */ +#define KT_LETTER 11 /* symbol that can be acted upon by CapsLock */ +#define KT_FN 1 +#define KT_SPEC 2 +#define KT_PAD 3 +#define KT_DEAD 4 +#define KT_CONS 5 +#define KT_CUR 6 +#define KT_SHIFT 7 +#define KT_META 8 +#define KT_ASCII 9 +#define KT_LOCK 10 +#define KT_SLOCK 12 +#define KT_BRL 14 + +#define K(t,v) (((t)<<8)|(v)) +#define KTYP(x) ((x) >> 8) +#define KVAL(x) ((x) & 0xff) + +#define K_F1 K(KT_FN,0) +#define K_F2 K(KT_FN,1) +#define K_F3 K(KT_FN,2) +#define K_F4 K(KT_FN,3) +#define K_F5 K(KT_FN,4) +#define K_F6 K(KT_FN,5) +#define K_F7 K(KT_FN,6) +#define K_F8 K(KT_FN,7) +#define K_F9 K(KT_FN,8) +#define K_F10 K(KT_FN,9) +#define K_F11 K(KT_FN,10) +#define K_F12 K(KT_FN,11) +#define K_F13 K(KT_FN,12) +#define K_F14 K(KT_FN,13) +#define K_F15 K(KT_FN,14) +#define K_F16 K(KT_FN,15) +#define K_F17 K(KT_FN,16) +#define K_F18 K(KT_FN,17) +#define K_F19 K(KT_FN,18) +#define K_F20 K(KT_FN,19) +#define K_FIND K(KT_FN,20) +#define K_INSERT K(KT_FN,21) +#define K_REMOVE K(KT_FN,22) +#define K_SELECT K(KT_FN,23) +#define K_PGUP K(KT_FN,24) /* PGUP is a synonym for PRIOR */ +#define K_PGDN K(KT_FN,25) /* PGDN is a synonym for NEXT */ +#define K_MACRO K(KT_FN,26) +#define K_HELP K(KT_FN,27) +#define K_DO K(KT_FN,28) +#define K_PAUSE K(KT_FN,29) +#define K_F21 K(KT_FN,30) +#define K_F22 K(KT_FN,31) +#define K_F23 K(KT_FN,32) +#define K_F24 K(KT_FN,33) +#define K_F25 K(KT_FN,34) +#define K_F26 K(KT_FN,35) +#define K_F27 K(KT_FN,36) +#define K_F28 K(KT_FN,37) +#define K_F29 K(KT_FN,38) +#define K_F30 K(KT_FN,39) +#define K_F31 K(KT_FN,40) +#define K_F32 K(KT_FN,41) +#define K_F33 K(KT_FN,42) +#define K_F34 K(KT_FN,43) +#define K_F35 K(KT_FN,44) +#define K_F36 K(KT_FN,45) +#define K_F37 K(KT_FN,46) +#define K_F38 K(KT_FN,47) +#define K_F39 K(KT_FN,48) +#define K_F40 K(KT_FN,49) +#define K_F41 K(KT_FN,50) +#define K_F42 K(KT_FN,51) +#define K_F43 K(KT_FN,52) +#define K_F44 K(KT_FN,53) +#define K_F45 K(KT_FN,54) +#define K_F46 K(KT_FN,55) +#define K_F47 K(KT_FN,56) +#define K_F48 K(KT_FN,57) +#define K_F49 K(KT_FN,58) +#define K_F50 K(KT_FN,59) +#define K_F51 K(KT_FN,60) +#define K_F52 K(KT_FN,61) +#define K_F53 K(KT_FN,62) +#define K_F54 K(KT_FN,63) +#define K_F55 K(KT_FN,64) +#define K_F56 K(KT_FN,65) +#define K_F57 K(KT_FN,66) +#define K_F58 K(KT_FN,67) +#define K_F59 K(KT_FN,68) +#define K_F60 K(KT_FN,69) +#define K_F61 K(KT_FN,70) +#define K_F62 K(KT_FN,71) +#define K_F63 K(KT_FN,72) +#define K_F64 K(KT_FN,73) +#define K_F65 K(KT_FN,74) +#define K_F66 K(KT_FN,75) +#define K_F67 K(KT_FN,76) +#define K_F68 K(KT_FN,77) +#define K_F69 K(KT_FN,78) +#define K_F70 K(KT_FN,79) +#define K_F71 K(KT_FN,80) +#define K_F72 K(KT_FN,81) +#define K_F73 K(KT_FN,82) +#define K_F74 K(KT_FN,83) +#define K_F75 K(KT_FN,84) +#define K_F76 K(KT_FN,85) +#define K_F77 K(KT_FN,86) +#define K_F78 K(KT_FN,87) +#define K_F79 K(KT_FN,88) +#define K_F80 K(KT_FN,89) +#define K_F81 K(KT_FN,90) +#define K_F82 K(KT_FN,91) +#define K_F83 K(KT_FN,92) +#define K_F84 K(KT_FN,93) +#define K_F85 K(KT_FN,94) +#define K_F86 K(KT_FN,95) +#define K_F87 K(KT_FN,96) +#define K_F88 K(KT_FN,97) +#define K_F89 K(KT_FN,98) +#define K_F90 K(KT_FN,99) +#define K_F91 K(KT_FN,100) +#define K_F92 K(KT_FN,101) +#define K_F93 K(KT_FN,102) +#define K_F94 K(KT_FN,103) +#define K_F95 K(KT_FN,104) +#define K_F96 K(KT_FN,105) +#define K_F97 K(KT_FN,106) +#define K_F98 K(KT_FN,107) +#define K_F99 K(KT_FN,108) +#define K_F100 K(KT_FN,109) +#define K_F101 K(KT_FN,110) +#define K_F102 K(KT_FN,111) +#define K_F103 K(KT_FN,112) +#define K_F104 K(KT_FN,113) +#define K_F105 K(KT_FN,114) +#define K_F106 K(KT_FN,115) +#define K_F107 K(KT_FN,116) +#define K_F108 K(KT_FN,117) +#define K_F109 K(KT_FN,118) +#define K_F110 K(KT_FN,119) +#define K_F111 K(KT_FN,120) +#define K_F112 K(KT_FN,121) +#define K_F113 K(KT_FN,122) +#define K_F114 K(KT_FN,123) +#define K_F115 K(KT_FN,124) +#define K_F116 K(KT_FN,125) +#define K_F117 K(KT_FN,126) +#define K_F118 K(KT_FN,127) +#define K_F119 K(KT_FN,128) +#define K_F120 K(KT_FN,129) +#define K_F121 K(KT_FN,130) +#define K_F122 K(KT_FN,131) +#define K_F123 K(KT_FN,132) +#define K_F124 K(KT_FN,133) +#define K_F125 K(KT_FN,134) +#define K_F126 K(KT_FN,135) +#define K_F127 K(KT_FN,136) +#define K_F128 K(KT_FN,137) +#define K_F129 K(KT_FN,138) +#define K_F130 K(KT_FN,139) +#define K_F131 K(KT_FN,140) +#define K_F132 K(KT_FN,141) +#define K_F133 K(KT_FN,142) +#define K_F134 K(KT_FN,143) +#define K_F135 K(KT_FN,144) +#define K_F136 K(KT_FN,145) +#define K_F137 K(KT_FN,146) +#define K_F138 K(KT_FN,147) +#define K_F139 K(KT_FN,148) +#define K_F140 K(KT_FN,149) +#define K_F141 K(KT_FN,150) +#define K_F142 K(KT_FN,151) +#define K_F143 K(KT_FN,152) +#define K_F144 K(KT_FN,153) +#define K_F145 K(KT_FN,154) +#define K_F146 K(KT_FN,155) +#define K_F147 K(KT_FN,156) +#define K_F148 K(KT_FN,157) +#define K_F149 K(KT_FN,158) +#define K_F150 K(KT_FN,159) +#define K_F151 K(KT_FN,160) +#define K_F152 K(KT_FN,161) +#define K_F153 K(KT_FN,162) +#define K_F154 K(KT_FN,163) +#define K_F155 K(KT_FN,164) +#define K_F156 K(KT_FN,165) +#define K_F157 K(KT_FN,166) +#define K_F158 K(KT_FN,167) +#define K_F159 K(KT_FN,168) +#define K_F160 K(KT_FN,169) +#define K_F161 K(KT_FN,170) +#define K_F162 K(KT_FN,171) +#define K_F163 K(KT_FN,172) +#define K_F164 K(KT_FN,173) +#define K_F165 K(KT_FN,174) +#define K_F166 K(KT_FN,175) +#define K_F167 K(KT_FN,176) +#define K_F168 K(KT_FN,177) +#define K_F169 K(KT_FN,178) +#define K_F170 K(KT_FN,179) +#define K_F171 K(KT_FN,180) +#define K_F172 K(KT_FN,181) +#define K_F173 K(KT_FN,182) +#define K_F174 K(KT_FN,183) +#define K_F175 K(KT_FN,184) +#define K_F176 K(KT_FN,185) +#define K_F177 K(KT_FN,186) +#define K_F178 K(KT_FN,187) +#define K_F179 K(KT_FN,188) +#define K_F180 K(KT_FN,189) +#define K_F181 K(KT_FN,190) +#define K_F182 K(KT_FN,191) +#define K_F183 K(KT_FN,192) +#define K_F184 K(KT_FN,193) +#define K_F185 K(KT_FN,194) +#define K_F186 K(KT_FN,195) +#define K_F187 K(KT_FN,196) +#define K_F188 K(KT_FN,197) +#define K_F189 K(KT_FN,198) +#define K_F190 K(KT_FN,199) +#define K_F191 K(KT_FN,200) +#define K_F192 K(KT_FN,201) +#define K_F193 K(KT_FN,202) +#define K_F194 K(KT_FN,203) +#define K_F195 K(KT_FN,204) +#define K_F196 K(KT_FN,205) +#define K_F197 K(KT_FN,206) +#define K_F198 K(KT_FN,207) +#define K_F199 K(KT_FN,208) +#define K_F200 K(KT_FN,209) +#define K_F201 K(KT_FN,210) +#define K_F202 K(KT_FN,211) +#define K_F203 K(KT_FN,212) +#define K_F204 K(KT_FN,213) +#define K_F205 K(KT_FN,214) +#define K_F206 K(KT_FN,215) +#define K_F207 K(KT_FN,216) +#define K_F208 K(KT_FN,217) +#define K_F209 K(KT_FN,218) +#define K_F210 K(KT_FN,219) +#define K_F211 K(KT_FN,220) +#define K_F212 K(KT_FN,221) +#define K_F213 K(KT_FN,222) +#define K_F214 K(KT_FN,223) +#define K_F215 K(KT_FN,224) +#define K_F216 K(KT_FN,225) +#define K_F217 K(KT_FN,226) +#define K_F218 K(KT_FN,227) +#define K_F219 K(KT_FN,228) +#define K_F220 K(KT_FN,229) +#define K_F221 K(KT_FN,230) +#define K_F222 K(KT_FN,231) +#define K_F223 K(KT_FN,232) +#define K_F224 K(KT_FN,233) +#define K_F225 K(KT_FN,234) +#define K_F226 K(KT_FN,235) +#define K_F227 K(KT_FN,236) +#define K_F228 K(KT_FN,237) +#define K_F229 K(KT_FN,238) +#define K_F230 K(KT_FN,239) +#define K_F231 K(KT_FN,240) +#define K_F232 K(KT_FN,241) +#define K_F233 K(KT_FN,242) +#define K_F234 K(KT_FN,243) +#define K_F235 K(KT_FN,244) +#define K_F236 K(KT_FN,245) +#define K_F237 K(KT_FN,246) +#define K_F238 K(KT_FN,247) +#define K_F239 K(KT_FN,248) +#define K_F240 K(KT_FN,249) +#define K_F241 K(KT_FN,250) +#define K_F242 K(KT_FN,251) +#define K_F243 K(KT_FN,252) +#define K_F244 K(KT_FN,253) +#define K_F245 K(KT_FN,254) +#define K_UNDO K(KT_FN,255) + + +#define K_HOLE K(KT_SPEC,0) +#define K_ENTER K(KT_SPEC,1) +#define K_SH_REGS K(KT_SPEC,2) +#define K_SH_MEM K(KT_SPEC,3) +#define K_SH_STAT K(KT_SPEC,4) +#define K_BREAK K(KT_SPEC,5) +#define K_CONS K(KT_SPEC,6) +#define K_CAPS K(KT_SPEC,7) +#define K_NUM K(KT_SPEC,8) +#define K_HOLD K(KT_SPEC,9) +#define K_SCROLLFORW K(KT_SPEC,10) +#define K_SCROLLBACK K(KT_SPEC,11) +#define K_BOOT K(KT_SPEC,12) +#define K_CAPSON K(KT_SPEC,13) +#define K_COMPOSE K(KT_SPEC,14) +#define K_SAK K(KT_SPEC,15) +#define K_DECRCONSOLE K(KT_SPEC,16) +#define K_INCRCONSOLE K(KT_SPEC,17) +#define K_SPAWNCONSOLE K(KT_SPEC,18) +#define K_BARENUMLOCK K(KT_SPEC,19) + +#define K_ALLOCATED K(KT_SPEC,126) /* dynamically allocated keymap */ +#define K_NOSUCHMAP K(KT_SPEC,127) /* returned by KDGKBENT */ + +#define K_P0 K(KT_PAD,0) +#define K_P1 K(KT_PAD,1) +#define K_P2 K(KT_PAD,2) +#define K_P3 K(KT_PAD,3) +#define K_P4 K(KT_PAD,4) +#define K_P5 K(KT_PAD,5) +#define K_P6 K(KT_PAD,6) +#define K_P7 K(KT_PAD,7) +#define K_P8 K(KT_PAD,8) +#define K_P9 K(KT_PAD,9) +#define K_PPLUS K(KT_PAD,10) /* key-pad plus */ +#define K_PMINUS K(KT_PAD,11) /* key-pad minus */ +#define K_PSTAR K(KT_PAD,12) /* key-pad asterisk (star) */ +#define K_PSLASH K(KT_PAD,13) /* key-pad slash */ +#define K_PENTER K(KT_PAD,14) /* key-pad enter */ +#define K_PCOMMA K(KT_PAD,15) /* key-pad comma: kludge... */ +#define K_PDOT K(KT_PAD,16) /* key-pad dot (period): kludge... */ +#define K_PPLUSMINUS K(KT_PAD,17) /* key-pad plus/minus */ +#define K_PPARENL K(KT_PAD,18) /* key-pad left parenthesis */ +#define K_PPARENR K(KT_PAD,19) /* key-pad right parenthesis */ + +#define NR_PAD 20 + +#define K_DGRAVE K(KT_DEAD,0) +#define K_DACUTE K(KT_DEAD,1) +#define K_DCIRCM K(KT_DEAD,2) +#define K_DTILDE K(KT_DEAD,3) +#define K_DDIERE K(KT_DEAD,4) +#define K_DCEDIL K(KT_DEAD,5) + +#define NR_DEAD 6 + +#define K_DOWN K(KT_CUR,0) +#define K_LEFT K(KT_CUR,1) +#define K_RIGHT K(KT_CUR,2) +#define K_UP K(KT_CUR,3) + +#define K_SHIFT K(KT_SHIFT,KG_SHIFT) +#define K_CTRL K(KT_SHIFT,KG_CTRL) +#define K_ALT K(KT_SHIFT,KG_ALT) +#define K_ALTGR K(KT_SHIFT,KG_ALTGR) +#define K_SHIFTL K(KT_SHIFT,KG_SHIFTL) +#define K_SHIFTR K(KT_SHIFT,KG_SHIFTR) +#define K_CTRLL K(KT_SHIFT,KG_CTRLL) +#define K_CTRLR K(KT_SHIFT,KG_CTRLR) +#define K_CAPSSHIFT K(KT_SHIFT,KG_CAPSSHIFT) + +#define K_ASC0 K(KT_ASCII,0) +#define K_ASC1 K(KT_ASCII,1) +#define K_ASC2 K(KT_ASCII,2) +#define K_ASC3 K(KT_ASCII,3) +#define K_ASC4 K(KT_ASCII,4) +#define K_ASC5 K(KT_ASCII,5) +#define K_ASC6 K(KT_ASCII,6) +#define K_ASC7 K(KT_ASCII,7) +#define K_ASC8 K(KT_ASCII,8) +#define K_ASC9 K(KT_ASCII,9) +#define K_HEX0 K(KT_ASCII,10) +#define K_HEX1 K(KT_ASCII,11) +#define K_HEX2 K(KT_ASCII,12) +#define K_HEX3 K(KT_ASCII,13) +#define K_HEX4 K(KT_ASCII,14) +#define K_HEX5 K(KT_ASCII,15) +#define K_HEX6 K(KT_ASCII,16) +#define K_HEX7 K(KT_ASCII,17) +#define K_HEX8 K(KT_ASCII,18) +#define K_HEX9 K(KT_ASCII,19) +#define K_HEXa K(KT_ASCII,20) +#define K_HEXb K(KT_ASCII,21) +#define K_HEXc K(KT_ASCII,22) +#define K_HEXd K(KT_ASCII,23) +#define K_HEXe K(KT_ASCII,24) +#define K_HEXf K(KT_ASCII,25) + +#define NR_ASCII 26 + +#define K_SHIFTLOCK K(KT_LOCK,KG_SHIFT) +#define K_CTRLLOCK K(KT_LOCK,KG_CTRL) +#define K_ALTLOCK K(KT_LOCK,KG_ALT) +#define K_ALTGRLOCK K(KT_LOCK,KG_ALTGR) +#define K_SHIFTLLOCK K(KT_LOCK,KG_SHIFTL) +#define K_SHIFTRLOCK K(KT_LOCK,KG_SHIFTR) +#define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL) +#define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR) +#define K_CAPSSHIFTLOCK K(KT_LOCK,KG_CAPSSHIFT) + +#define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT) +#define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL) +#define K_ALT_SLOCK K(KT_SLOCK,KG_ALT) +#define K_ALTGR_SLOCK K(KT_SLOCK,KG_ALTGR) +#define K_SHIFTL_SLOCK K(KT_SLOCK,KG_SHIFTL) +#define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR) +#define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL) +#define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR) +#define K_CAPSSHIFT_SLOCK K(KT_SLOCK,KG_CAPSSHIFT) + +#define NR_LOCK 9 + +#define K_BRL_BLANK K(KT_BRL, 0) +#define K_BRL_DOT1 K(KT_BRL, 1) +#define K_BRL_DOT2 K(KT_BRL, 2) +#define K_BRL_DOT3 K(KT_BRL, 3) +#define K_BRL_DOT4 K(KT_BRL, 4) +#define K_BRL_DOT5 K(KT_BRL, 5) +#define K_BRL_DOT6 K(KT_BRL, 6) +#define K_BRL_DOT7 K(KT_BRL, 7) +#define K_BRL_DOT8 K(KT_BRL, 8) +#define K_BRL_DOT9 K(KT_BRL, 9) +#define K_BRL_DOT10 K(KT_BRL, 10) + +#define NR_BRL 11 + +#define MAX_DIACR 256 +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/keyctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/keyctl.h new file mode 100644 index 0000000..c0688eb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/keyctl.h @@ -0,0 +1,56 @@ +/* keyctl.h: keyctl command IDs + * + * Copyright (C) 2004, 2008 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_KEYCTL_H +#define _LINUX_KEYCTL_H + +/* special process keyring shortcut IDs */ +#define KEY_SPEC_THREAD_KEYRING -1 /* - key ID for thread-specific keyring */ +#define KEY_SPEC_PROCESS_KEYRING -2 /* - key ID for process-specific keyring */ +#define KEY_SPEC_SESSION_KEYRING -3 /* - key ID for session-specific keyring */ +#define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */ +#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ +#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ +#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */ +#define KEY_SPEC_REQUESTOR_KEYRING -8 /* - key ID for request_key() dest keyring */ + +/* request-key default keyrings */ +#define KEY_REQKEY_DEFL_NO_CHANGE -1 +#define KEY_REQKEY_DEFL_DEFAULT 0 +#define KEY_REQKEY_DEFL_THREAD_KEYRING 1 +#define KEY_REQKEY_DEFL_PROCESS_KEYRING 2 +#define KEY_REQKEY_DEFL_SESSION_KEYRING 3 +#define KEY_REQKEY_DEFL_USER_KEYRING 4 +#define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 +#define KEY_REQKEY_DEFL_GROUP_KEYRING 6 +#define KEY_REQKEY_DEFL_REQUESTOR_KEYRING 7 + +/* keyctl commands */ +#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ +#define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ +#define KEYCTL_UPDATE 2 /* update a key */ +#define KEYCTL_REVOKE 3 /* revoke a key */ +#define KEYCTL_CHOWN 4 /* set ownership of a key */ +#define KEYCTL_SETPERM 5 /* set perms on a key */ +#define KEYCTL_DESCRIBE 6 /* describe a key */ +#define KEYCTL_CLEAR 7 /* clear contents of a keyring */ +#define KEYCTL_LINK 8 /* link a key into a keyring */ +#define KEYCTL_UNLINK 9 /* unlink a key from a keyring */ +#define KEYCTL_SEARCH 10 /* search for a key in a keyring */ +#define KEYCTL_READ 11 /* read a key or keyring's contents */ +#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ +#define KEYCTL_NEGATE 13 /* negate a partially constructed key */ +#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ +#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ +#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ +#define KEYCTL_GET_SECURITY 17 /* get key security label */ + +#endif /* _LINUX_KEYCTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/limits.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/limits.h new file mode 100644 index 0000000..2d0f941 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/limits.h @@ -0,0 +1,20 @@ +#ifndef _LINUX_LIMITS_H +#define _LINUX_LIMITS_H + +#define NR_OPEN 1024 + +#define NGROUPS_MAX 65536 /* supplemental group IDs are available */ +#define ARG_MAX 131072 /* # bytes of args + environ for exec() */ +#define LINK_MAX 127 /* # links a file may have */ +#define MAX_CANON 255 /* size of the canonical input queue */ +#define MAX_INPUT 255 /* size of the type-ahead buffer */ +#define NAME_MAX 255 /* # chars in a file name */ +#define PATH_MAX 4096 /* # chars in a path name including nul */ +#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ +#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */ +#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */ +#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ + +#define RTSIG_MAX 32 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/llc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/llc.h new file mode 100644 index 0000000..6bb32fe --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/llc.h @@ -0,0 +1,73 @@ +#ifndef __LINUX_LLC_H +#define __LINUX_LLC_H +/* + * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators. + * + * Copyright (c) 2001 by Jay Schulist + * + * This program can be redistributed or modified under the terms of the + * GNU General Public License as published by the Free Software Foundation. + * This program is distributed without any warranty or implied warranty + * of merchantability or fitness for a particular purpose. + * + * See the GNU General Public License for more details. + */ +#define __LLC_SOCK_SIZE__ 16 /* sizeof(sockaddr_llc), word align. */ +struct sockaddr_llc { + sa_family_t sllc_family; /* AF_LLC */ + sa_family_t sllc_arphrd; /* ARPHRD_ETHER */ + unsigned char sllc_test; + unsigned char sllc_xid; + unsigned char sllc_ua; /* UA data, only for SOCK_STREAM. */ + unsigned char sllc_sap; + unsigned char sllc_mac[IFHWADDRLEN]; + unsigned char __pad[__LLC_SOCK_SIZE__ - sizeof(sa_family_t) * 2 - + sizeof(unsigned char) * 4 - IFHWADDRLEN]; +}; + +/* sockopt definitions. */ +enum llc_sockopts { + LLC_OPT_UNKNOWN = 0, + LLC_OPT_RETRY, /* max retrans attempts. */ + LLC_OPT_SIZE, /* max PDU size (octets). */ + LLC_OPT_ACK_TMR_EXP, /* ack expire time (secs). */ + LLC_OPT_P_TMR_EXP, /* pf cycle expire time (secs). */ + LLC_OPT_REJ_TMR_EXP, /* rej sent expire time (secs). */ + LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ + LLC_OPT_TX_WIN, /* tx window size. */ + LLC_OPT_RX_WIN, /* rx window size. */ + LLC_OPT_MAX +}; + +#define LLC_OPT_MAX_RETRY 100 +#define LLC_OPT_MAX_SIZE 4196 +#define LLC_OPT_MAX_WIN 127 +#define LLC_OPT_MAX_ACK_TMR_EXP 60 +#define LLC_OPT_MAX_P_TMR_EXP 60 +#define LLC_OPT_MAX_REJ_TMR_EXP 60 +#define LLC_OPT_MAX_BUSY_TMR_EXP 60 + +/* LLC SAP types. */ +#define LLC_SAP_NULL 0x00 /* NULL SAP. */ +#define LLC_SAP_LLC 0x02 /* LLC Sublayer Management. */ +#define LLC_SAP_SNA 0x04 /* SNA Path Control. */ +#define LLC_SAP_PNM 0x0E /* Proway Network Management. */ +#define LLC_SAP_IP 0x06 /* TCP/IP. */ +#define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */ +#define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */ +#define LLC_SAP_8208 0x7E /* ISO 8208 */ +#define LLC_SAP_3COM 0x80 /* 3COM. */ +#define LLC_SAP_PRO 0x8E /* Proway Active Station List */ +#define LLC_SAP_SNAP 0xAA /* SNAP. */ +#define LLC_SAP_BANYAN 0xBC /* Banyan. */ +#define LLC_SAP_IPX 0xE0 /* IPX/SPX. */ +#define LLC_SAP_NETBEUI 0xF0 /* NetBEUI. */ +#define LLC_SAP_LANMGR 0xF4 /* LanManager. */ +#define LLC_SAP_IMPL 0xF8 /* IMPL */ +#define LLC_SAP_DISC 0xFC /* Discovery */ +#define LLC_SAP_OSI 0xFE /* OSI Network Layers. */ +#define LLC_SAP_LAR 0xDC /* LAN Address Resolution */ +#define LLC_SAP_RM 0xD4 /* Resource Management */ +#define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ + +#endif /* __LINUX_LLC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/loop.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/loop.h new file mode 100644 index 0000000..988cfed --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/loop.h @@ -0,0 +1,90 @@ +#ifndef _LINUX_LOOP_H +#define _LINUX_LOOP_H + +/* + * include/linux/loop.h + * + * Written by Theodore Ts'o, 3/29/93. + * + * Copyright 1993 by Theodore Ts'o. Redistribution of this file is + * permitted under the GNU General Public License. + */ + +#define LO_NAME_SIZE 64 +#define LO_KEY_SIZE 32 + + +/* + * Loop flags + */ +enum { + LO_FLAGS_READ_ONLY = 1, + LO_FLAGS_USE_AOPS = 2, + LO_FLAGS_AUTOCLEAR = 4, +}; + +#include /* for __kernel_old_dev_t */ +#include /* for __u64 */ + +/* Backwards compatibility version */ +struct loop_info { + int lo_number; /* ioctl r/o */ + __kernel_old_dev_t lo_device; /* ioctl r/o */ + unsigned long lo_inode; /* ioctl r/o */ + __kernel_old_dev_t lo_rdevice; /* ioctl r/o */ + int lo_offset; + int lo_encrypt_type; + int lo_encrypt_key_size; /* ioctl w/o */ + int lo_flags; /* ioctl r/o */ + char lo_name[LO_NAME_SIZE]; + unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ + unsigned long lo_init[2]; + char reserved[4]; +}; + +struct loop_info64 { + __u64 lo_device; /* ioctl r/o */ + __u64 lo_inode; /* ioctl r/o */ + __u64 lo_rdevice; /* ioctl r/o */ + __u64 lo_offset; + __u64 lo_sizelimit;/* bytes, 0 == max available */ + __u32 lo_number; /* ioctl r/o */ + __u32 lo_encrypt_type; + __u32 lo_encrypt_key_size; /* ioctl w/o */ + __u32 lo_flags; /* ioctl r/o */ + __u8 lo_file_name[LO_NAME_SIZE]; + __u8 lo_crypt_name[LO_NAME_SIZE]; + __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ + __u64 lo_init[2]; +}; + +/* + * Loop filter types + */ + +#define LO_CRYPT_NONE 0 +#define LO_CRYPT_XOR 1 +#define LO_CRYPT_DES 2 +#define LO_CRYPT_FISH2 3 /* Twofish encryption */ +#define LO_CRYPT_BLOW 4 +#define LO_CRYPT_CAST128 5 +#define LO_CRYPT_IDEA 6 +#define LO_CRYPT_DUMMY 9 +#define LO_CRYPT_SKIPJACK 10 +#define LO_CRYPT_CRYPTOAPI 18 +#define MAX_LO_CRYPT 20 + +/* + * IOCTL commands --- we will commandeer 0x4C ('L') + */ + +#define LOOP_SET_FD 0x4C00 +#define LOOP_CLR_FD 0x4C01 +#define LOOP_SET_STATUS 0x4C02 +#define LOOP_GET_STATUS 0x4C03 +#define LOOP_SET_STATUS64 0x4C04 +#define LOOP_GET_STATUS64 0x4C05 +#define LOOP_CHANGE_FD 0x4C06 +#define LOOP_SET_CAPACITY 0x4C07 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/lp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/lp.h new file mode 100644 index 0000000..59b1a6f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/lp.h @@ -0,0 +1,100 @@ +#ifndef _LINUX_LP_H +#define _LINUX_LP_H + +/* + * usr/include/linux/lp.h c.1991-1992 James Wiegand + * many modifications copyright (C) 1992 Michael K. Johnson + * Interrupt support added 1993 Nigel Gamble + * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti + */ + +/* + * Per POSIX guidelines, this module reserves the LP and lp prefixes + * These are the lp_table[minor].flags flags... + */ +#define LP_EXIST 0x0001 +#define LP_SELEC 0x0002 +#define LP_BUSY 0x0004 +#define LP_BUSY_BIT_POS 2 +#define LP_OFFL 0x0008 +#define LP_NOPA 0x0010 +#define LP_ERR 0x0020 +#define LP_ABORT 0x0040 +#define LP_CAREFUL 0x0080 /* obsoleted -arca */ +#define LP_ABORTOPEN 0x0100 + +#define LP_TRUST_IRQ_ 0x0200 /* obsolete */ +#define LP_NO_REVERSE 0x0400 /* No reverse mode available. */ +#define LP_DATA_AVAIL 0x0800 /* Data is available. */ + +/* + * bit defines for 8255 status port + * base + 1 + * accessed with LP_S(minor), which gets the byte... + */ +#define LP_PBUSY 0x80 /* inverted input, active high */ +#define LP_PACK 0x40 /* unchanged input, active low */ +#define LP_POUTPA 0x20 /* unchanged input, active high */ +#define LP_PSELECD 0x10 /* unchanged input, active high */ +#define LP_PERRORP 0x08 /* unchanged input, active low */ + +/* timeout for each character. This is relative to bus cycles -- it + * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you + * have extremely slow printing, or if the machine seems to slow down + * a lot when you print. If you have slow printing, increase this + * number and recompile, and if your system gets bogged down, decrease + * this number. This can be changed with the tunelp(8) command as well. + */ + +#define LP_INIT_CHAR 1000 + +/* The parallel port specs apparently say that there needs to be + * a .5usec wait before and after the strobe. + */ + +#define LP_INIT_WAIT 1 + +/* This is the amount of time that the driver waits for the printer to + * catch up when the printer's buffer appears to be filled. If you + * want to tune this and have a fast printer (i.e. HPIIIP), decrease + * this number, and if you have a slow printer, increase this number. + * This is in hundredths of a second, the default 2 being .05 second. + * Or use the tunelp(8) command, which is especially nice if you want + * change back and forth between character and graphics printing, which + * are wildly different... + */ + +#define LP_INIT_TIME 2 + +/* IOCTL numbers */ +#define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */ +#define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */ +#define LPABORT 0x0604 /* call with TRUE arg to abort on error, + FALSE to retry. Default is retry. */ +#define LPSETIRQ 0x0605 /* call with new IRQ number, + or 0 for polling (no IRQ) */ +#define LPGETIRQ 0x0606 /* get the current IRQ number */ +#define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */ +/* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */ +#define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off- + line, and error indicators good on all writes, + FALSE to ignore them. Default is ignore. */ +#define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error, + FALSE to ignore error. Default is ignore. */ +#define LPGETSTATUS 0x060b /* return LP_S(minor) */ +#define LPRESET 0x060c /* reset printer */ +#ifdef LP_STATS +#define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */ +#endif +#define LPGETFLAGS 0x060e /* get status flags */ +#define LPSETTIMEOUT 0x060f /* set parport timeout */ + +/* timeout for printk'ing a timeout, in jiffies (100ths of a second). + This is also used for re-checking error conditions if LP_ABORT is + not set. This is the default behavior. */ + +#define LP_TIMEOUT_INTERRUPT (60 * HZ) +#define LP_TIMEOUT_POLLED (10 * HZ) + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/magic.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/magic.h new file mode 100644 index 0000000..5b4e28b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/magic.h @@ -0,0 +1,53 @@ +#ifndef __LINUX_MAGIC_H__ +#define __LINUX_MAGIC_H__ + +#define ADFS_SUPER_MAGIC 0xadf5 +#define AFFS_SUPER_MAGIC 0xadff +#define AFS_SUPER_MAGIC 0x5346414F +#define AUTOFS_SUPER_MAGIC 0x0187 +#define CODA_SUPER_MAGIC 0x73757245 +#define DEBUGFS_MAGIC 0x64626720 +#define SYSFS_MAGIC 0x62656572 +#define SECURITYFS_MAGIC 0x73636673 +#define TMPFS_MAGIC 0x01021994 +#define SQUASHFS_MAGIC 0x73717368 +#define EFS_SUPER_MAGIC 0x414A53 +#define EXT2_SUPER_MAGIC 0xEF53 +#define EXT3_SUPER_MAGIC 0xEF53 +#define XENFS_SUPER_MAGIC 0xabba1974 +#define EXT4_SUPER_MAGIC 0xEF53 +#define BTRFS_SUPER_MAGIC 0x9123683E +#define HPFS_SUPER_MAGIC 0xf995e849 +#define ISOFS_SUPER_MAGIC 0x9660 +#define JFFS2_SUPER_MAGIC 0x72b6 +#define ANON_INODE_FS_MAGIC 0x09041934 + +#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ +#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ +#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ +#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ +#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */ + +#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ +#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ +#define NFS_SUPER_MAGIC 0x6969 +#define OPENPROM_SUPER_MAGIC 0x9fa1 +#define PROC_SUPER_MAGIC 0x9fa0 +#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ + +#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ + /* used by file system utilities that + look at the superblock, etc. */ +#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" +#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" +#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" + +#define SMB_SUPER_MAGIC 0x517B +#define USBDEVICE_SUPER_MAGIC 0x9fa2 +#define CGROUP_SUPER_MAGIC 0x27e0eb + +#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA +#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA + +#define STACK_END_MAGIC 0x57AC6E9D +#endif /* __LINUX_MAGIC_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/major.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/major.h new file mode 100644 index 0000000..058ec15 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/major.h @@ -0,0 +1,176 @@ +#ifndef _LINUX_MAJOR_H +#define _LINUX_MAJOR_H + +/* + * This file has definitions for major device numbers. + * For the device number assignments, see Documentation/devices.txt. + */ + +#define UNNAMED_MAJOR 0 +#define MEM_MAJOR 1 +#define RAMDISK_MAJOR 1 +#define FLOPPY_MAJOR 2 +#define PTY_MASTER_MAJOR 2 +#define IDE0_MAJOR 3 +#define HD_MAJOR IDE0_MAJOR +#define PTY_SLAVE_MAJOR 3 +#define TTY_MAJOR 4 +#define TTYAUX_MAJOR 5 +#define LP_MAJOR 6 +#define VCS_MAJOR 7 +#define LOOP_MAJOR 7 +#define SCSI_DISK0_MAJOR 8 +#define SCSI_TAPE_MAJOR 9 +#define MD_MAJOR 9 +#define MISC_MAJOR 10 +#define SCSI_CDROM_MAJOR 11 +#define MUX_MAJOR 11 /* PA-RISC only */ +#define XT_DISK_MAJOR 13 +#define INPUT_MAJOR 13 +#define SOUND_MAJOR 14 +#define CDU31A_CDROM_MAJOR 15 +#define JOYSTICK_MAJOR 15 +#define GOLDSTAR_CDROM_MAJOR 16 +#define OPTICS_CDROM_MAJOR 17 +#define SANYO_CDROM_MAJOR 18 +#define CYCLADES_MAJOR 19 +#define CYCLADESAUX_MAJOR 20 +#define MITSUMI_X_CDROM_MAJOR 20 +#define MFM_ACORN_MAJOR 21 /* ARM Linux /dev/mfm */ +#define SCSI_GENERIC_MAJOR 21 +#define IDE1_MAJOR 22 +#define DIGICU_MAJOR 22 +#define DIGI_MAJOR 23 +#define MITSUMI_CDROM_MAJOR 23 +#define CDU535_CDROM_MAJOR 24 +#define STL_SERIALMAJOR 24 +#define MATSUSHITA_CDROM_MAJOR 25 +#define STL_CALLOUTMAJOR 25 +#define MATSUSHITA_CDROM2_MAJOR 26 +#define QIC117_TAPE_MAJOR 27 +#define MATSUSHITA_CDROM3_MAJOR 27 +#define MATSUSHITA_CDROM4_MAJOR 28 +#define STL_SIOMEMMAJOR 28 +#define ACSI_MAJOR 28 +#define AZTECH_CDROM_MAJOR 29 +#define FB_MAJOR 29 /* /dev/fb* framebuffers */ +#define CM206_CDROM_MAJOR 32 +#define IDE2_MAJOR 33 +#define IDE3_MAJOR 34 +#define Z8530_MAJOR 34 +#define XPRAM_MAJOR 35 /* Expanded storage on S/390: "slow ram"*/ +#define NETLINK_MAJOR 36 +#define PS2ESDI_MAJOR 36 +#define IDETAPE_MAJOR 37 +#define Z2RAM_MAJOR 37 +#define APBLOCK_MAJOR 38 /* AP1000 Block device */ +#define DDV_MAJOR 39 /* AP1000 DDV block device */ +#define NBD_MAJOR 43 /* Network block device */ +#define RISCOM8_NORMAL_MAJOR 48 +#define DAC960_MAJOR 48 /* 48..55 */ +#define RISCOM8_CALLOUT_MAJOR 49 +#define MKISS_MAJOR 55 +#define DSP56K_MAJOR 55 /* DSP56001 processor device */ + +#define IDE4_MAJOR 56 +#define IDE5_MAJOR 57 + +#define SCSI_DISK1_MAJOR 65 +#define SCSI_DISK2_MAJOR 66 +#define SCSI_DISK3_MAJOR 67 +#define SCSI_DISK4_MAJOR 68 +#define SCSI_DISK5_MAJOR 69 +#define SCSI_DISK6_MAJOR 70 +#define SCSI_DISK7_MAJOR 71 + +#define COMPAQ_SMART2_MAJOR 72 +#define COMPAQ_SMART2_MAJOR1 73 +#define COMPAQ_SMART2_MAJOR2 74 +#define COMPAQ_SMART2_MAJOR3 75 +#define COMPAQ_SMART2_MAJOR4 76 +#define COMPAQ_SMART2_MAJOR5 77 +#define COMPAQ_SMART2_MAJOR6 78 +#define COMPAQ_SMART2_MAJOR7 79 + +#define SPECIALIX_NORMAL_MAJOR 75 +#define SPECIALIX_CALLOUT_MAJOR 76 + +#define AURORA_MAJOR 79 + +#define I2O_MAJOR 80 /* 80->87 */ + +#define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */ +#define SCSI_CHANGER_MAJOR 86 + +#define IDE6_MAJOR 88 +#define IDE7_MAJOR 89 +#define IDE8_MAJOR 90 +#define IDE9_MAJOR 91 + +#define DASD_MAJOR 94 + +#define MDISK_MAJOR 95 + +#define UBD_MAJOR 98 + +#define PP_MAJOR 99 +#define JSFD_MAJOR 99 + +#define PHONE_MAJOR 100 + +#define COMPAQ_CISS_MAJOR 104 +#define COMPAQ_CISS_MAJOR1 105 +#define COMPAQ_CISS_MAJOR2 106 +#define COMPAQ_CISS_MAJOR3 107 +#define COMPAQ_CISS_MAJOR4 108 +#define COMPAQ_CISS_MAJOR5 109 +#define COMPAQ_CISS_MAJOR6 110 +#define COMPAQ_CISS_MAJOR7 111 + +#define VIODASD_MAJOR 112 +#define VIOCD_MAJOR 113 + +#define ATARAID_MAJOR 114 + +#define SCSI_DISK8_MAJOR 128 +#define SCSI_DISK9_MAJOR 129 +#define SCSI_DISK10_MAJOR 130 +#define SCSI_DISK11_MAJOR 131 +#define SCSI_DISK12_MAJOR 132 +#define SCSI_DISK13_MAJOR 133 +#define SCSI_DISK14_MAJOR 134 +#define SCSI_DISK15_MAJOR 135 + +#define UNIX98_PTY_MASTER_MAJOR 128 +#define UNIX98_PTY_MAJOR_COUNT 8 +#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) + +#define RTF_MAJOR 150 +#define RAW_MAJOR 162 + +#define USB_ACM_MAJOR 166 +#define USB_ACM_AUX_MAJOR 167 +#define USB_CHAR_MAJOR 180 + +#define MMC_BLOCK_MAJOR 179 + +#define VXVM_MAJOR 199 /* VERITAS volume i/o driver */ +#define VXSPEC_MAJOR 200 /* VERITAS volume config driver */ +#define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */ + +#define XENVBD_MAJOR 202 /* Xen virtual block device */ + +#define MSR_MAJOR 202 +#define CPUID_MAJOR 203 + +#define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */ + +#define IBM_TTY3270_MAJOR 227 +#define IBM_FS3270_MAJOR 228 + +#define VIOTAPE_MAJOR 230 + +#define BLOCK_EXT_MAJOR 259 +#define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/map_to_7segment.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/map_to_7segment.h new file mode 100644 index 0000000..12d62a5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/map_to_7segment.h @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2005 Henk Vergonet + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef MAP_TO_7SEGMENT_H +#define MAP_TO_7SEGMENT_H + +/* This file provides translation primitives and tables for the conversion + * of (ASCII) characters to a 7-segments notation. + * + * The 7 segment's wikipedia notation below is used as standard. + * See: http://en.wikipedia.org/wiki/Seven_segment_display + * + * Notation: +-a-+ + * f b + * +-g-+ + * e c + * +-d-+ + * + * Usage: + * + * Register a map variable, and fill it with a character set: + * static SEG7_DEFAULT_MAP(map_seg7); + * + * + * Then use for conversion: + * seg7 = map_to_seg7(&map_seg7, some_char); + * ... + * + * In device drivers it is recommended, if required, to make the char map + * accessible via the sysfs interface using the following scheme: + * + * static ssize_t show_map(struct device *dev, char *buf) { + * memcpy(buf, &map_seg7, sizeof(map_seg7)); + * return sizeof(map_seg7); + * } + * static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) { + * if(cnt != sizeof(map_seg7)) + * return -EINVAL; + * memcpy(&map_seg7, buf, cnt); + * return cnt; + * } + * static DEVICE_ATTR(map_seg7, PERMS_RW, show_map, store_map); + * + * History: + * 2005-05-31 RFC linux-kernel@vger.kernel.org + */ +#include + + +#define BIT_SEG7_A 0 +#define BIT_SEG7_B 1 +#define BIT_SEG7_C 2 +#define BIT_SEG7_D 3 +#define BIT_SEG7_E 4 +#define BIT_SEG7_F 5 +#define BIT_SEG7_G 6 +#define BIT_SEG7_RESERVED 7 + +struct seg7_conversion_map { + unsigned char table[128]; +}; + +static __inline__ int map_to_seg7(struct seg7_conversion_map *map, int c) +{ + return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL; +} + +#define SEG7_CONVERSION_MAP(_name, _map) \ + struct seg7_conversion_map _name = { .table = { _map } } + +/* + * It is recommended to use a facility that allows user space to redefine + * custom character sets for LCD devices. Please use a sysfs interface + * as described above. + */ +#define MAP_TO_SEG7_SYSFS_FILE "map_seg7" + +/******************************************************************************* + * ASCII conversion table + ******************************************************************************/ + +#define _SEG7(l,a,b,c,d,e,f,g) \ + ( a<',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\ + _SEG7('@',1,1,0,1,1,1,1), + +#define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ + _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\ + _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ + _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\ + _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ + _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\ + _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\ + _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\ + _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ + _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), + +#define _MAP_91_96_ASCII_SEG7_SYMBOL \ + _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\ + _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0), + +#define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ + _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\ + _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ + _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\ + _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ + _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\ + _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\ + _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\ + _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ + _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), + +#define _MAP_123_126_ASCII_SEG7_SYMBOL \ + _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\ + _SEG7('~',1,0,0,0,0,0,0), + +/* Maps */ + +/* This set tries to map as close as possible to the visible characteristics + * of the ASCII symbol, lowercase and uppercase letters may differ in + * presentation on the display. + */ +#define MAP_ASCII7SEG_ALPHANUM \ + _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ + _MAP_33_47_ASCII_SEG7_SYMBOL \ + _MAP_48_57_ASCII_SEG7_NUMERIC \ + _MAP_58_64_ASCII_SEG7_SYMBOL \ + _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ + _MAP_91_96_ASCII_SEG7_SYMBOL \ + _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ + _MAP_123_126_ASCII_SEG7_SYMBOL + +/* This set tries to map as close as possible to the symbolic characteristics + * of the ASCII character for maximum discrimination. + * For now this means all alpha chars are in lower case representations. + * (This for example facilitates the use of hex numbers with uppercase input.) + */ +#define MAP_ASCII7SEG_ALPHANUM_LC \ + _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ + _MAP_33_47_ASCII_SEG7_SYMBOL \ + _MAP_48_57_ASCII_SEG7_NUMERIC \ + _MAP_58_64_ASCII_SEG7_SYMBOL \ + _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ + _MAP_91_96_ASCII_SEG7_SYMBOL \ + _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ + _MAP_123_126_ASCII_SEG7_SYMBOL + +#define SEG7_DEFAULT_MAP(_name) \ + SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM) + +#endif /* MAP_TO_7SEGMENT_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/matroxfb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/matroxfb.h new file mode 100644 index 0000000..2203121 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/matroxfb.h @@ -0,0 +1,43 @@ +#ifndef __LINUX_MATROXFB_H__ +#define __LINUX_MATROXFB_H__ + +#include +#include +#include + +struct matroxioc_output_mode { + __u32 output; /* which output */ +#define MATROXFB_OUTPUT_PRIMARY 0x0000 +#define MATROXFB_OUTPUT_SECONDARY 0x0001 +#define MATROXFB_OUTPUT_DFP 0x0002 + __u32 mode; /* which mode */ +#define MATROXFB_OUTPUT_MODE_PAL 0x0001 +#define MATROXFB_OUTPUT_MODE_NTSC 0x0002 +#define MATROXFB_OUTPUT_MODE_MONITOR 0x0080 +}; +#define MATROXFB_SET_OUTPUT_MODE _IOW('n',0xFA,size_t) +#define MATROXFB_GET_OUTPUT_MODE _IOWR('n',0xFA,size_t) + +/* bitfield */ +#define MATROXFB_OUTPUT_CONN_PRIMARY (1 << MATROXFB_OUTPUT_PRIMARY) +#define MATROXFB_OUTPUT_CONN_SECONDARY (1 << MATROXFB_OUTPUT_SECONDARY) +#define MATROXFB_OUTPUT_CONN_DFP (1 << MATROXFB_OUTPUT_DFP) +/* connect these outputs to this framebuffer */ +#define MATROXFB_SET_OUTPUT_CONNECTION _IOW('n',0xF8,size_t) +/* which outputs are connected to this framebuffer */ +#define MATROXFB_GET_OUTPUT_CONNECTION _IOR('n',0xF8,size_t) +/* which outputs are available for this framebuffer */ +#define MATROXFB_GET_AVAILABLE_OUTPUTS _IOR('n',0xF9,size_t) +/* which outputs exist on this framebuffer */ +#define MATROXFB_GET_ALL_OUTPUTS _IOR('n',0xFB,size_t) + +enum matroxfb_ctrl_id { + MATROXFB_CID_TESTOUT = V4L2_CID_PRIVATE_BASE, + MATROXFB_CID_DEFLICKER, + MATROXFB_CID_LAST +}; + +#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mempolicy.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mempolicy.h new file mode 100644 index 0000000..40b072d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mempolicy.h @@ -0,0 +1,56 @@ +#ifndef _LINUX_MEMPOLICY_H +#define _LINUX_MEMPOLICY_H 1 + +#include + +/* + * NUMA memory policies for Linux. + * Copyright 2003,2004 Andi Kleen SuSE Labs + */ + +/* + * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are + * passed by the user to either set_mempolicy() or mbind() in an 'int' actual. + * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags. + */ + +/* Policies */ +enum { + MPOL_DEFAULT, + MPOL_PREFERRED, + MPOL_BIND, + MPOL_INTERLEAVE, + MPOL_MAX, /* always last member of enum */ +}; + +/* Flags for set_mempolicy */ +#define MPOL_F_STATIC_NODES (1 << 15) +#define MPOL_F_RELATIVE_NODES (1 << 14) + +/* + * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to + * either set_mempolicy() or mbind(). + */ +#define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES) + +/* Flags for get_mempolicy */ +#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ +#define MPOL_F_ADDR (1<<1) /* look up vma using address */ +#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ + +/* Flags for mbind */ +#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ +#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */ +#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */ +#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */ + +/* + * Internal flags that share the struct mempolicy flags word with + * "mode flags". These flags are allocated from bit 0 up, as they + * are never OR'ed into the mode in mempolicy API arguments. + */ +#define MPOL_F_SHARED (1 << 0) /* identify shared policies */ +#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */ + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/meye.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/meye.h new file mode 100644 index 0000000..12010ac --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/meye.h @@ -0,0 +1,66 @@ +/* + * Motion Eye video4linux driver for Sony Vaio PictureBook + * + * Copyright (C) 2001-2003 Stelian Pop + * + * Copyright (C) 2001-2002 Alcôve + * + * Copyright (C) 2000 Andrew Tridgell + * + * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. + * + * Some parts borrowed from various video4linux drivers, especially + * bttv-driver.c and zoran.c, see original files for credits. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _MEYE_H_ +#define _MEYE_H_ + +/****************************************************************************/ +/* Private API for handling mjpeg capture / playback. */ +/****************************************************************************/ + +struct meye_params { + unsigned char subsample; + unsigned char quality; + unsigned char sharpness; + unsigned char agc; + unsigned char picture; + unsigned char framerate; +}; + +/* query the extended parameters */ +#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct meye_params) +/* set the extended parameters */ +#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOCPRIVATE+1, struct meye_params) +/* queue a buffer for mjpeg capture */ +#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+2, int) +/* sync a previously queued mjpeg buffer */ +#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOCPRIVATE+3, int) +/* get a still uncompressed snapshot */ +#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOCPRIVATE+4) +/* get a jpeg compressed snapshot */ +#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOCPRIVATE+5, int) + +/* V4L2 private controls */ +#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE +#define V4L2_CID_MEYE_SHARPNESS (V4L2_CID_PRIVATE_BASE + 1) +#define V4L2_CID_PICTURE (V4L2_CID_PRIVATE_BASE + 2) +#define V4L2_CID_JPEGQUAL (V4L2_CID_PRIVATE_BASE + 3) +#define V4L2_CID_FRAMERATE (V4L2_CID_PRIVATE_BASE + 4) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mii.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mii.h new file mode 100644 index 0000000..de1d74e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mii.h @@ -0,0 +1,150 @@ +/* + * linux/mii.h: definitions for MII-compatible transceivers + * Originally drivers/net/sunhme.h. + * + * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com) + */ + +#ifndef __LINUX_MII_H__ +#define __LINUX_MII_H__ + +#include + +/* Generic MII registers. */ + +#define MII_BMCR 0x00 /* Basic mode control register */ +#define MII_BMSR 0x01 /* Basic mode status register */ +#define MII_PHYSID1 0x02 /* PHYS ID 1 */ +#define MII_PHYSID2 0x03 /* PHYS ID 2 */ +#define MII_ADVERTISE 0x04 /* Advertisement control reg */ +#define MII_LPA 0x05 /* Link partner ability reg */ +#define MII_EXPANSION 0x06 /* Expansion register */ +#define MII_CTRL1000 0x09 /* 1000BASE-T control */ +#define MII_STAT1000 0x0a /* 1000BASE-T status */ +#define MII_ESTATUS 0x0f /* Extended Status */ +#define MII_DCOUNTER 0x12 /* Disconnect counter */ +#define MII_FCSCOUNTER 0x13 /* False carrier counter */ +#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */ +#define MII_RERRCOUNTER 0x15 /* Receive error counter */ +#define MII_SREVISION 0x16 /* Silicon revision */ +#define MII_RESV1 0x17 /* Reserved... */ +#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */ +#define MII_PHYADDR 0x19 /* PHY address */ +#define MII_RESV2 0x1a /* Reserved... */ +#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */ +#define MII_NCONFIG 0x1c /* Network interface config */ + +/* Basic mode control register. */ +#define BMCR_RESV 0x003f /* Unused... */ +#define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */ +#define BMCR_CTST 0x0080 /* Collision test */ +#define BMCR_FULLDPLX 0x0100 /* Full duplex */ +#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */ +#define BMCR_ISOLATE 0x0400 /* Disconnect DP83840 from MII */ +#define BMCR_PDOWN 0x0800 /* Powerdown the DP83840 */ +#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */ +#define BMCR_SPEED100 0x2000 /* Select 100Mbps */ +#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */ +#define BMCR_RESET 0x8000 /* Reset the DP83840 */ + +/* Basic mode status register. */ +#define BMSR_ERCAP 0x0001 /* Ext-reg capability */ +#define BMSR_JCD 0x0002 /* Jabber detected */ +#define BMSR_LSTATUS 0x0004 /* Link status */ +#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */ +#define BMSR_RFAULT 0x0010 /* Remote fault detected */ +#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ +#define BMSR_RESV 0x00c0 /* Unused... */ +#define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */ +#define BMSR_100HALF2 0x0200 /* Can do 100BASE-T2 HDX */ +#define BMSR_100FULL2 0x0400 /* Can do 100BASE-T2 FDX */ +#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */ +#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */ +#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */ +#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */ +#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */ + +/* Advertisement control register. */ +#define ADVERTISE_SLCT 0x001f /* Selector bits */ +#define ADVERTISE_CSMA 0x0001 /* Only selector supported */ +#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ +#define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */ +#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ +#define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */ +#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ +#define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */ +#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ +#define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */ +#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ +#define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */ +#define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */ +#define ADVERTISE_RESV 0x1000 /* Unused... */ +#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */ +#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */ +#define ADVERTISE_NPAGE 0x8000 /* Next page bit */ + +#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ + ADVERTISE_CSMA) +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ + ADVERTISE_100HALF | ADVERTISE_100FULL) + +/* Link partner ability register. */ +#define LPA_SLCT 0x001f /* Same as advertise selector */ +#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ +#define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */ +#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ +#define LPA_1000XHALF 0x0040 /* Can do 1000BASE-X half-duplex */ +#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ +#define LPA_1000XPAUSE 0x0080 /* Can do 1000BASE-X pause */ +#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ +#define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/ +#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ +#define LPA_PAUSE_CAP 0x0400 /* Can pause */ +#define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */ +#define LPA_RESV 0x1000 /* Unused... */ +#define LPA_RFAULT 0x2000 /* Link partner faulted */ +#define LPA_LPACK 0x4000 /* Link partner acked us */ +#define LPA_NPAGE 0x8000 /* Next page bit */ + +#define LPA_DUPLEX (LPA_10FULL | LPA_100FULL) +#define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4) + +/* Expansion register for auto-negotiation. */ +#define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */ +#define EXPANSION_LCWP 0x0002 /* Got new RX page code word */ +#define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */ +#define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */ +#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */ +#define EXPANSION_RESV 0xffe0 /* Unused... */ + +#define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */ +#define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */ + +/* N-way test register. */ +#define NWAYTEST_RESV1 0x00ff /* Unused... */ +#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ +#define NWAYTEST_RESV2 0xfe00 /* Unused... */ + +/* 1000BASE-T Control register */ +#define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */ +#define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */ + +/* 1000BASE-T Status register */ +#define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */ +#define LPA_1000REMRXOK 0x1000 /* Link partner remote receiver status */ +#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ +#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */ + +/* Flow control flags */ +#define FLOW_CTRL_TX 0x01 +#define FLOW_CTRL_RX 0x02 + +/* This structure is used in all SIOCxMIIxxx ioctl calls */ +struct mii_ioctl_data { + __u16 phy_id; + __u16 reg_num; + __u16 val_in; + __u16 val_out; +}; + +#endif /* __LINUX_MII_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/minix_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/minix_fs.h new file mode 100644 index 0000000..13fe09e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/minix_fs.h @@ -0,0 +1,106 @@ +#ifndef _LINUX_MINIX_FS_H +#define _LINUX_MINIX_FS_H + +#include +#include + +/* + * The minix filesystem constants/structures + */ + +/* + * Thanks to Kees J Bot for sending me the definitions of the new + * minix filesystem (aka V2) with bigger inodes and 32-bit block + * pointers. + */ + +#define MINIX_ROOT_INO 1 + +/* Not the same as the bogus LINK_MAX in . Oh well. */ +#define MINIX_LINK_MAX 250 +#define MINIX2_LINK_MAX 65530 + +#define MINIX_I_MAP_SLOTS 8 +#define MINIX_Z_MAP_SLOTS 64 +#define MINIX_VALID_FS 0x0001 /* Clean fs. */ +#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ + +#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) + +/* + * This is the original minix inode layout on disk. + * Note the 8-bit gid and atime and ctime. + */ +struct minix_inode { + __u16 i_mode; + __u16 i_uid; + __u32 i_size; + __u32 i_time; + __u8 i_gid; + __u8 i_nlinks; + __u16 i_zone[9]; +}; + +/* + * The new minix inode has all the time entries, as well as + * long block numbers and a third indirect block (7+1+1+1 + * instead of 7+1+1). Also, some previously 8-bit values are + * now 16-bit. The inode is now 64 bytes instead of 32. + */ +struct minix2_inode { + __u16 i_mode; + __u16 i_nlinks; + __u16 i_uid; + __u16 i_gid; + __u32 i_size; + __u32 i_atime; + __u32 i_mtime; + __u32 i_ctime; + __u32 i_zone[10]; +}; + +/* + * minix super-block data on disk + */ +struct minix_super_block { + __u16 s_ninodes; + __u16 s_nzones; + __u16 s_imap_blocks; + __u16 s_zmap_blocks; + __u16 s_firstdatazone; + __u16 s_log_zone_size; + __u32 s_max_size; + __u16 s_magic; + __u16 s_state; + __u32 s_zones; +}; + +/* + * V3 minix super-block data on disk + */ +struct minix3_super_block { + __u32 s_ninodes; + __u16 s_pad0; + __u16 s_imap_blocks; + __u16 s_zmap_blocks; + __u16 s_firstdatazone; + __u16 s_log_zone_size; + __u16 s_pad1; + __u32 s_max_size; + __u32 s_zones; + __u16 s_magic; + __u16 s_pad2; + __u16 s_blocksize; + __u8 s_disk_version; +}; + +struct minix_dir_entry { + __u16 inode; + char name[0]; +}; + +struct minix3_dir_entry { + __u32 inode; + char name[0]; +}; +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mman.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mman.h new file mode 100644 index 0000000..36b3004 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mman.h @@ -0,0 +1,13 @@ +#ifndef _LINUX_MMAN_H +#define _LINUX_MMAN_H + +#include + +#define MREMAP_MAYMOVE 1 +#define MREMAP_FIXED 2 + +#define OVERCOMMIT_GUESS 0 +#define OVERCOMMIT_ALWAYS 1 +#define OVERCOMMIT_NEVER 2 + +#endif /* _LINUX_MMAN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mmtimer.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mmtimer.h new file mode 100644 index 0000000..884cabf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mmtimer.h @@ -0,0 +1,56 @@ +/* + * Intel Multimedia Timer device interface + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. + * + * This file should define an interface compatible with the IA-PC Multimedia + * Timers Draft Specification (rev. 0.97) from Intel. Note that some + * hardware may not be able to safely export its registers to userspace, + * so the ioctl interface should support all necessary functionality. + * + * 11/01/01 - jbarnes - initial revision + * 9/10/04 - Christoph Lameter - remove interrupt support + * 9/17/04 - jbarnes - remove test program, move some #defines to the driver + */ + +#ifndef _LINUX_MMTIMER_H +#define _LINUX_MMTIMER_H + +/* + * Breakdown of the ioctl's available. An 'optional' next to the command + * indicates that supporting this command is optional, while 'required' + * commands must be implemented if conformance is desired. + * + * MMTIMER_GETOFFSET - optional + * Should return the offset (relative to the start of the page where the + * registers are mapped) for the counter in question. + * + * MMTIMER_GETRES - required + * The resolution of the clock in femto (10^-15) seconds + * + * MMTIMER_GETFREQ - required + * Frequency of the clock in Hz + * + * MMTIMER_GETBITS - required + * Number of bits in the clock's counter + * + * MMTIMER_MMAPAVAIL - required + * Returns nonzero if the registers can be mmap'd into userspace, 0 otherwise + * + * MMTIMER_GETCOUNTER - required + * Gets the current value in the counter + */ +#define MMTIMER_IOCTL_BASE 'm' + +#define MMTIMER_GETOFFSET _IO(MMTIMER_IOCTL_BASE, 0) +#define MMTIMER_GETRES _IOR(MMTIMER_IOCTL_BASE, 1, unsigned long) +#define MMTIMER_GETFREQ _IOR(MMTIMER_IOCTL_BASE, 2, unsigned long) +#define MMTIMER_GETBITS _IO(MMTIMER_IOCTL_BASE, 4) +#define MMTIMER_MMAPAVAIL _IO(MMTIMER_IOCTL_BASE, 6) +#define MMTIMER_GETCOUNTER _IOR(MMTIMER_IOCTL_BASE, 9, unsigned long) + +#endif /* _LINUX_MMTIMER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mqueue.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mqueue.h new file mode 100644 index 0000000..8b5a796 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mqueue.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2003 Krzysztof Benedyczak & Michal Wronski + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + It is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this software; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LINUX_MQUEUE_H +#define _LINUX_MQUEUE_H + +#define MQ_PRIO_MAX 32768 +/* per-uid limit of kernel memory used by mqueue, in bytes */ +#define MQ_BYTES_MAX 819200 + +struct mq_attr { + long mq_flags; /* message queue flags */ + long mq_maxmsg; /* maximum number of messages */ + long mq_msgsize; /* maximum message size */ + long mq_curmsgs; /* number of messages currently queued */ + long __reserved[4]; /* ignored for input, zeroed for output */ +}; + +/* + * SIGEV_THREAD implementation: + * SIGEV_THREAD must be implemented in user space. If SIGEV_THREAD is passed + * to mq_notify, then + * - sigev_signo must be the file descriptor of an AF_NETLINK socket. It's not + * necessary that the socket is bound. + * - sigev_value.sival_ptr must point to a cookie that is NOTIFY_COOKIE_LEN + * bytes long. + * If the notification is triggered, then the cookie is sent to the netlink + * socket. The last byte of the cookie is replaced with the NOTIFY_?? codes: + * NOTIFY_WOKENUP if the notification got triggered, NOTIFY_REMOVED if it was + * removed, either due to a close() on the message queue fd or due to a + * mq_notify() that removed the notification. + */ +#define NOTIFY_NONE 0 +#define NOTIFY_WOKENUP 1 +#define NOTIFY_REMOVED 2 + +#define NOTIFY_COOKIE_LEN 32 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mroute.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mroute.h new file mode 100644 index 0000000..ad2289a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mroute.h @@ -0,0 +1,141 @@ +#ifndef __LINUX_MROUTE_H +#define __LINUX_MROUTE_H + +#include +#include + +/* + * Based on the MROUTING 3.5 defines primarily to keep + * source compatibility with BSD. + * + * See the mrouted code for the original history. + * + * Protocol Independent Multicast (PIM) data structures included + * Carlos Picoto (cap@di.fc.ul.pt) + * + */ + +#define MRT_BASE 200 +#define MRT_INIT (MRT_BASE) /* Activate the kernel mroute code */ +#define MRT_DONE (MRT_BASE+1) /* Shutdown the kernel mroute */ +#define MRT_ADD_VIF (MRT_BASE+2) /* Add a virtual interface */ +#define MRT_DEL_VIF (MRT_BASE+3) /* Delete a virtual interface */ +#define MRT_ADD_MFC (MRT_BASE+4) /* Add a multicast forwarding entry */ +#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ +#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ +#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ +#define MRT_PIM (MRT_BASE+8) /* enable PIM code */ + +#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ +#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) +#define SIOCGETRPF (SIOCPROTOPRIVATE+2) + +#define MAXVIFS 32 +typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */ +typedef unsigned short vifi_t; +#define ALL_VIFS ((vifi_t)(-1)) + +/* + * Same idea as select + */ + +#define VIFM_SET(n,m) ((m)|=(1<<(n))) +#define VIFM_CLR(n,m) ((m)&=~(1<<(n))) +#define VIFM_ISSET(n,m) ((m)&(1<<(n))) +#define VIFM_CLRALL(m) ((m)=0) +#define VIFM_COPY(mfrom,mto) ((mto)=(mfrom)) +#define VIFM_SAME(m1,m2) ((m1)==(m2)) + +/* + * Passed by mrouted for an MRT_ADD_VIF - again we use the + * mrouted 3.6 structures for compatibility + */ + +struct vifctl { + vifi_t vifc_vifi; /* Index of VIF */ + unsigned char vifc_flags; /* VIFF_ flags */ + unsigned char vifc_threshold; /* ttl limit */ + unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ + struct in_addr vifc_lcl_addr; /* Our address */ + struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */ +}; + +#define VIFF_TUNNEL 0x1 /* IPIP tunnel */ +#define VIFF_SRCRT 0x2 /* NI */ +#define VIFF_REGISTER 0x4 /* register vif */ + +/* + * Cache manipulation structures for mrouted and PIMd + */ + +struct mfcctl +{ + struct in_addr mfcc_origin; /* Origin of mcast */ + struct in_addr mfcc_mcastgrp; /* Group in question */ + vifi_t mfcc_parent; /* Where it arrived */ + unsigned char mfcc_ttls[MAXVIFS]; /* Where it is going */ + unsigned int mfcc_pkt_cnt; /* pkt count for src-grp */ + unsigned int mfcc_byte_cnt; + unsigned int mfcc_wrong_if; + int mfcc_expire; +}; + +/* + * Group count retrieval for mrouted + */ + +struct sioc_sg_req +{ + struct in_addr src; + struct in_addr grp; + unsigned long pktcnt; + unsigned long bytecnt; + unsigned long wrong_if; +}; + +/* + * To get vif packet counts + */ + +struct sioc_vif_req +{ + vifi_t vifi; /* Which iface */ + unsigned long icount; /* In packets */ + unsigned long ocount; /* Out packets */ + unsigned long ibytes; /* In bytes */ + unsigned long obytes; /* Out bytes */ +}; + +/* + * This is the format the mroute daemon expects to see IGMP control + * data. Magically happens to be like an IP packet as per the original + */ + +struct igmpmsg +{ + __u32 unused1,unused2; + unsigned char im_msgtype; /* What is this */ + unsigned char im_mbz; /* Must be zero */ + unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */ + unsigned char unused3; + struct in_addr im_src,im_dst; +}; + +/* + * That's all usermode folks + */ + + + +#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ + +/* + * Pseudo messages used by mrouted + */ + +#define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */ +#define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ +#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mroute6.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mroute6.h new file mode 100644 index 0000000..fb5843d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mroute6.h @@ -0,0 +1,137 @@ +#ifndef __LINUX_MROUTE6_H +#define __LINUX_MROUTE6_H + +#include +#include + +/* + * Based on the MROUTING 3.5 defines primarily to keep + * source compatibility with BSD. + * + * See the pim6sd code for the original history. + * + * Protocol Independent Multicast (PIM) data structures included + * Carlos Picoto (cap@di.fc.ul.pt) + * + */ + +#define MRT6_BASE 200 +#define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */ +#define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */ +#define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */ +#define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */ +#define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */ +#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */ +#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */ +#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ +#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ + +#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ +#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) +#define SIOCGETRPF (SIOCPROTOPRIVATE+2) + +#define MAXMIFS 32 +typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */ +typedef unsigned short mifi_t; +#define ALL_MIFS ((mifi_t)(-1)) + +#ifndef IF_SETSIZE +#define IF_SETSIZE 256 +#endif + +typedef __u32 if_mask; +#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */ + +#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP) +#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y)) +#endif + +typedef struct if_set { + if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)]; +} if_set; + +#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) +#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS))) +#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS))) +#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f))) +#define IF_ZERO(p) bzero(p, sizeof(*(p))) + +/* + * Passed by mrouted for an MRT_ADD_MIF - again we use the + * mrouted 3.6 structures for compatibility + */ + +struct mif6ctl { + mifi_t mif6c_mifi; /* Index of MIF */ + unsigned char mif6c_flags; /* MIFF_ flags */ + unsigned char vifc_threshold; /* ttl limit */ + __u16 mif6c_pifi; /* the index of the physical IF */ + unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ +}; + +#define MIFF_REGISTER 0x1 /* register vif */ + +/* + * Cache manipulation structures for mrouted and PIMd + */ + +struct mf6cctl +{ + struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */ + struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */ + mifi_t mf6cc_parent; /* Where it arrived */ + struct if_set mf6cc_ifset; /* Where it is going */ +}; + +/* + * Group count retrieval for pim6sd + */ + +struct sioc_sg_req6 +{ + struct sockaddr_in6 src; + struct sockaddr_in6 grp; + unsigned long pktcnt; + unsigned long bytecnt; + unsigned long wrong_if; +}; + +/* + * To get vif packet counts + */ + +struct sioc_mif_req6 +{ + mifi_t mifi; /* Which iface */ + unsigned long icount; /* In packets */ + unsigned long ocount; /* Out packets */ + unsigned long ibytes; /* In bytes */ + unsigned long obytes; /* Out bytes */ +}; + +/* + * That's all usermode folks + */ + + + +/* + * Structure used to communicate from kernel to multicast router. + * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{} + * used for IPv4 implementation). This is because this structure will be passed via an + * IPv6 raw socket, on wich an application will only receiver the payload i.e the data after + * the IPv6 header and all the extension headers. (See section 3 of RFC 3542) + */ + +struct mrt6msg { +#define MRT6MSG_NOCACHE 1 +#define MRT6MSG_WRONGMIF 2 +#define MRT6MSG_WHOLEPKT 3 /* used for use level encap */ + __u8 im6_mbz; /* must be zero */ + __u8 im6_msgtype; /* what type of message */ + __u16 im6_mif; /* mif rec'd on */ + __u32 im6_pad; /* padding for 64 bit arch */ + struct in6_addr im6_src, im6_dst; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/msdos_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/msdos_fs.h new file mode 100644 index 0000000..85470e1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/msdos_fs.h @@ -0,0 +1,165 @@ +#ifndef _LINUX_MSDOS_FS_H +#define _LINUX_MSDOS_FS_H + +#include +#include +#include + +/* + * The MS-DOS filesystem constants/structures + */ + +#define SECTOR_SIZE 512 /* sector size (bytes) */ +#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ +#define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */ +#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */ +#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) +#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ +#define CF_LE_W(v) le16_to_cpu(v) +#define CF_LE_L(v) le32_to_cpu(v) +#define CT_LE_W(v) cpu_to_le16(v) +#define CT_LE_L(v) cpu_to_le32(v) + + +#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */ +#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ + +/* directory limit */ +#define FAT_MAX_DIR_ENTRIES (65536) +#define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS) + +#define ATTR_NONE 0 /* no attribute bits */ +#define ATTR_RO 1 /* read-only */ +#define ATTR_HIDDEN 2 /* hidden */ +#define ATTR_SYS 4 /* system */ +#define ATTR_VOLUME 8 /* volume label */ +#define ATTR_DIR 16 /* directory */ +#define ATTR_ARCH 32 /* archived */ + +/* attribute bits that are copied "as is" */ +#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) +/* bits that are used by the Windows 95/Windows NT extended FAT */ +#define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) + +#define CASE_LOWER_BASE 8 /* base is lower case */ +#define CASE_LOWER_EXT 16 /* extension is lower case */ + +#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ +#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) + +#define MSDOS_NAME 11 /* maximum name length */ +#define MSDOS_LONGNAME 256 /* maximum name length */ +#define MSDOS_SLOTS 21 /* max # of slots for short and long names */ +#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ +#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ + +#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ + MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) + +/* start of data cluster's entry (number of reserved clusters) */ +#define FAT_START_ENT 2 + +/* maximum number of clusters */ +#define MAX_FAT12 0xFF4 +#define MAX_FAT16 0xFFF4 +#define MAX_FAT32 0x0FFFFFF6 +#define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \ + MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12) + +/* bad cluster mark */ +#define BAD_FAT12 0xFF7 +#define BAD_FAT16 0xFFF7 +#define BAD_FAT32 0x0FFFFFF7 + +/* standard EOF */ +#define EOF_FAT12 0xFFF +#define EOF_FAT16 0xFFFF +#define EOF_FAT32 0x0FFFFFFF + +#define FAT_ENT_FREE (0) +#define FAT_ENT_BAD (BAD_FAT32) +#define FAT_ENT_EOF (EOF_FAT32) + +#define FAT_FSINFO_SIG1 0x41615252 +#define FAT_FSINFO_SIG2 0x61417272 +#define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \ + && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2) + +struct __fat_dirent { + long d_ino; + __kernel_off_t d_off; + unsigned short d_reclen; + char d_name[256]; /* We must not include limits.h! */ +}; + +/* + * ioctl commands + */ +#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct __fat_dirent[2]) +#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct __fat_dirent[2]) +/* has used 0x72 ('r') in collision, so skip a few */ +#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) +#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) + +struct fat_boot_sector { + __u8 ignored[3]; /* Boot strap short or near jump */ + __u8 system_id[8]; /* Name - can be used to special case + partition manager volumes */ + __u8 sector_size[2]; /* bytes per logical sector */ + __u8 sec_per_clus; /* sectors/cluster */ + __le16 reserved; /* reserved sectors */ + __u8 fats; /* number of FATs */ + __u8 dir_entries[2]; /* root directory entries */ + __u8 sectors[2]; /* number of sectors */ + __u8 media; /* media code */ + __le16 fat_length; /* sectors/FAT */ + __le16 secs_track; /* sectors per track */ + __le16 heads; /* number of heads */ + __le32 hidden; /* hidden sectors (unused) */ + __le32 total_sect; /* number of sectors (if sectors == 0) */ + + /* The following fields are only used by FAT32 */ + __le32 fat32_length; /* sectors/FAT */ + __le16 flags; /* bit 8: fat mirroring, low 4: active fat */ + __u8 version[2]; /* major, minor filesystem version */ + __le32 root_cluster; /* first cluster in root directory */ + __le16 info_sector; /* filesystem info sector */ + __le16 backup_boot; /* backup boot sector */ + __le16 reserved2[6]; /* Unused */ +}; + +struct fat_boot_fsinfo { + __le32 signature1; /* 0x41615252L */ + __le32 reserved1[120]; /* Nothing as far as I can tell */ + __le32 signature2; /* 0x61417272L */ + __le32 free_clusters; /* Free cluster count. -1 if unknown */ + __le32 next_cluster; /* Most recently allocated cluster */ + __le32 reserved2[4]; +}; + +struct msdos_dir_entry { + __u8 name[MSDOS_NAME];/* name and extension */ + __u8 attr; /* attribute bits */ + __u8 lcase; /* Case for base and extension */ + __u8 ctime_cs; /* Creation time, centiseconds (0-199) */ + __le16 ctime; /* Creation time */ + __le16 cdate; /* Creation date */ + __le16 adate; /* Last access date */ + __le16 starthi; /* High 16 bits of cluster in FAT32 */ + __le16 time,date,start;/* time, date and first cluster */ + __le32 size; /* file size (in bytes) */ +}; + +/* Up to 13 characters of the name */ +struct msdos_dir_slot { + __u8 id; /* sequence number for slot */ + __u8 name0_4[10]; /* first 5 characters in name */ + __u8 attr; /* attribute byte */ + __u8 reserved; /* always 0 */ + __u8 alias_checksum; /* checksum for 8.3 alias */ + __u8 name5_10[12]; /* 6 more characters in name */ + __le16 start; /* starting cluster number, 0 in long slots */ + __u8 name11_12[4]; /* last 2 characters in name */ +}; + +#endif /* !_LINUX_MSDOS_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/msg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/msg.h new file mode 100644 index 0000000..cef8e30 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/msg.h @@ -0,0 +1,75 @@ +#ifndef _LINUX_MSG_H +#define _LINUX_MSG_H + +#include + +/* ipcs ctl commands */ +#define MSG_STAT 11 +#define MSG_INFO 12 + +/* msgrcv options */ +#define MSG_NOERROR 010000 /* no error if message is too big */ +#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/ + +/* Obsolete, used only for backwards compatibility and libc5 compiles */ +struct msqid_ds { + struct ipc_perm msg_perm; + struct msg *msg_first; /* first message on queue,unused */ + struct msg *msg_last; /* last message in queue,unused */ + __kernel_time_t msg_stime; /* last msgsnd time */ + __kernel_time_t msg_rtime; /* last msgrcv time */ + __kernel_time_t msg_ctime; /* last change time */ + unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */ + unsigned long msg_lqbytes; /* ditto */ + unsigned short msg_cbytes; /* current number of bytes on queue */ + unsigned short msg_qnum; /* number of messages in queue */ + unsigned short msg_qbytes; /* max number of bytes on queue */ + __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_ipc_pid_t msg_lrpid; /* last receive pid */ +}; + +/* Include the definition of msqid64_ds */ +#include + +/* message buffer for msgsnd and msgrcv calls */ +struct msgbuf { + long mtype; /* type of message */ + char mtext[1]; /* message text */ +}; + +/* buffer for msgctl calls IPC_INFO, MSG_INFO */ +struct msginfo { + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + unsigned short msgseg; +}; + +/* + * Scaling factor to compute msgmni: + * the memory dedicated to msg queues (msgmni * msgmnb) should occupy + * at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c): + * up to 8MB : msgmni = 16 (MSGMNI) + * 4 GB : msgmni = 8K + * more than 16 GB : msgmni = 32K (IPCMNI) + */ +#define MSG_MEM_SCALE 32 + +#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */ +#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ +#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ + +/* unused */ +#define MSGPOOL (MSGMNI * MSGMNB / 1024) /* size in kbytes of message pool */ +#define MSGTQL MSGMNB /* number of system message headers */ +#define MSGMAP MSGMNB /* number of entries in message map */ +#define MSGSSZ 16 /* message segment size */ +#define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */ +#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) + + +#endif /* _LINUX_MSG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mtio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mtio.h new file mode 100644 index 0000000..ef01d6a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/mtio.h @@ -0,0 +1,206 @@ +/* + * linux/mtio.h header file for Linux. Written by H. Bergman + * + * Modified for special ioctls provided by zftape in September 1997 + * by C.-J. Heine. + */ + +#ifndef _LINUX_MTIO_H +#define _LINUX_MTIO_H + +#include +#include + +/* + * Structures and definitions for mag tape io control commands + */ + +/* structure for MTIOCTOP - mag tape op command */ +struct mtop { + short mt_op; /* operations defined below */ + int mt_count; /* how many of them */ +}; + +/* Magnetic Tape operations [Not all operations supported by all drivers]: */ +#define MTRESET 0 /* +reset drive in case of problems */ +#define MTFSF 1 /* forward space over FileMark, + * position at first record of next file + */ +#define MTBSF 2 /* backward space FileMark (position before FM) */ +#define MTFSR 3 /* forward space record */ +#define MTBSR 4 /* backward space record */ +#define MTWEOF 5 /* write an end-of-file record (mark) */ +#define MTREW 6 /* rewind */ +#define MTOFFL 7 /* rewind and put the drive offline (eject?) */ +#define MTNOP 8 /* no op, set status only (read with MTIOCGET) */ +#define MTRETEN 9 /* retension tape */ +#define MTBSFM 10 /* +backward space FileMark, position at FM */ +#define MTFSFM 11 /* +forward space FileMark, position at FM */ +#define MTEOM 12 /* goto end of recorded media (for appending files). + * MTEOM positions after the last FM, ready for + * appending another file. + */ +#define MTERASE 13 /* erase tape -- be careful! */ + +#define MTRAS1 14 /* run self test 1 (nondestructive) */ +#define MTRAS2 15 /* run self test 2 (destructive) */ +#define MTRAS3 16 /* reserved for self test 3 */ + +#define MTSETBLK 20 /* set block length (SCSI) */ +#define MTSETDENSITY 21 /* set tape density (SCSI) */ +#define MTSEEK 22 /* seek to block (Tandberg, etc.) */ +#define MTTELL 23 /* tell block (Tandberg, etc.) */ +#define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */ + /* ordinary buffered operation with code 1 */ +#define MTFSS 25 /* space forward over setmarks */ +#define MTBSS 26 /* space backward over setmarks */ +#define MTWSM 27 /* write setmarks */ + +#define MTLOCK 28 /* lock the drive door */ +#define MTUNLOCK 29 /* unlock the drive door */ +#define MTLOAD 30 /* execute the SCSI load command */ +#define MTUNLOAD 31 /* execute the SCSI unload command */ +#define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */ +#define MTSETPART 33 /* Change the active tape partition */ +#define MTMKPART 34 /* Format the tape with one or two partitions */ + +/* structure for MTIOCGET - mag tape get status command */ + +struct mtget { + long mt_type; /* type of magtape device */ + long mt_resid; /* residual count: (not sure) + * number of bytes ignored, or + * number of files not skipped, or + * number of records not skipped. + */ + /* the following registers are device dependent */ + long mt_dsreg; /* status register */ + long mt_gstat; /* generic (device independent) status */ + long mt_erreg; /* error register */ + /* The next two fields are not always used */ + __kernel_daddr_t mt_fileno; /* number of current file on tape */ + __kernel_daddr_t mt_blkno; /* current block number */ +}; + + + +/* + * Constants for mt_type. Not all of these are supported, + * and these are not all of the ones that are supported. + */ +#define MT_ISUNKNOWN 0x01 +#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */ +#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */ +#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */ +#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */ +#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */ +#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */ +#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */ +#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L */ +#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller */ +#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */ +#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */ +#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */ +#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */ +#define MT_ISDDS1 0x51 /* DDS device without partitions */ +#define MT_ISDDS2 0x52 /* DDS device with partitions */ +#define MT_ISONSTREAM_SC 0x61 /* OnStream SCSI tape drives (SC-x0) + and SCSI emulated (DI, DP, USB) */ +#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */ +#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */ + +/* QIC-40/80/3010/3020 ftape supported drives. + * 20bit vendor ID + 0x800000 (see ftape-vendors.h) + */ +#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ +#define MT_ISFTAPE_FLAG 0x800000 + + +/* structure for MTIOCPOS - mag tape get position command */ + +struct mtpos { + long mt_blkno; /* current block number */ +}; + + +/* mag tape io control commands */ +#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ +#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ +#define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */ + + +/* Generic Mag Tape (device independent) status macros for examining + * mt_gstat -- HP-UX compatible. + * There is room for more generic status bits here, but I don't + * know which of them are reserved. At least three or so should + * be added to make this really useful. + */ +#define GMT_EOF(x) ((x) & 0x80000000) +#define GMT_BOT(x) ((x) & 0x40000000) +#define GMT_EOT(x) ((x) & 0x20000000) +#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ +#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ +#define GMT_WR_PROT(x) ((x) & 0x04000000) +/* #define GMT_ ? ((x) & 0x02000000) */ +#define GMT_ONLINE(x) ((x) & 0x01000000) +#define GMT_D_6250(x) ((x) & 0x00800000) +#define GMT_D_1600(x) ((x) & 0x00400000) +#define GMT_D_800(x) ((x) & 0x00200000) +/* #define GMT_ ? ((x) & 0x00100000) */ +/* #define GMT_ ? ((x) & 0x00080000) */ +#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */ +/* #define GMT_ ? ((x) & 0x00020000) */ +#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */ +#define GMT_CLN(x) ((x) & 0x00008000) /* cleaning requested */ +/* 15 generic status bits unused */ + + +/* SCSI-tape specific definitions */ +/* Bitfield shifts in the status */ +#define MT_ST_BLKSIZE_SHIFT 0 +#define MT_ST_BLKSIZE_MASK 0xffffff +#define MT_ST_DENSITY_SHIFT 24 +#define MT_ST_DENSITY_MASK 0xff000000 + +#define MT_ST_SOFTERR_SHIFT 0 +#define MT_ST_SOFTERR_MASK 0xffff + +/* Bitfields for the MTSETDRVBUFFER ioctl */ +#define MT_ST_OPTIONS 0xf0000000 +#define MT_ST_BOOLEANS 0x10000000 +#define MT_ST_SETBOOLEANS 0x30000000 +#define MT_ST_CLEARBOOLEANS 0x40000000 +#define MT_ST_WRITE_THRESHOLD 0x20000000 +#define MT_ST_DEF_BLKSIZE 0x50000000 +#define MT_ST_DEF_OPTIONS 0x60000000 +#define MT_ST_TIMEOUTS 0x70000000 +#define MT_ST_SET_TIMEOUT (MT_ST_TIMEOUTS | 0x000000) +#define MT_ST_SET_LONG_TIMEOUT (MT_ST_TIMEOUTS | 0x100000) +#define MT_ST_SET_CLN 0x80000000 + +#define MT_ST_BUFFER_WRITES 0x1 +#define MT_ST_ASYNC_WRITES 0x2 +#define MT_ST_READ_AHEAD 0x4 +#define MT_ST_DEBUGGING 0x8 +#define MT_ST_TWO_FM 0x10 +#define MT_ST_FAST_MTEOM 0x20 +#define MT_ST_AUTO_LOCK 0x40 +#define MT_ST_DEF_WRITES 0x80 +#define MT_ST_CAN_BSR 0x100 +#define MT_ST_NO_BLKLIMS 0x200 +#define MT_ST_CAN_PARTITIONS 0x400 +#define MT_ST_SCSI2LOGICAL 0x800 +#define MT_ST_SYSV 0x1000 +#define MT_ST_NOWAIT 0x2000 +#define MT_ST_SILI 0x4000 + +/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ +#define MT_ST_CLEAR_DEFAULT 0xfffff +#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) +#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) +#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) + +/* The offset for the arguments for the special HP changer load command. */ +#define MT_ST_HPLOADER_OFFSET 10000 + +#endif /* _LINUX_MTIO_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/n_r3964.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/n_r3964.h new file mode 100644 index 0000000..f716807 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/n_r3964.h @@ -0,0 +1,99 @@ +/* r3964 linediscipline for linux + * + * ----------------------------------------------------------- + * Copyright by + * Philips Automation Projects + * Kassel (Germany) + * http://www.pap-philips.de + * ----------------------------------------------------------- + * This software may be used and distributed according to the terms of + * the GNU General Public License, incorporated herein by reference. + * + * Author: + * L. Haag + * + * $Log: r3964.h,v $ + * Revision 1.4 2005/12/21 19:54:24 Kurt Huwig + * Fixed HZ usage on 2.6 kernels + * Removed unnecessary include + * + * Revision 1.3 2001/03/18 13:02:24 dwmw2 + * Fix timer usage, use spinlocks properly. + * + * Revision 1.2 2001/03/18 12:53:15 dwmw2 + * Merge changes in 2.4.2 + * + * Revision 1.1.1.1 1998/10/13 16:43:14 dwmw2 + * This'll screw the version control + * + * Revision 1.6 1998/09/30 00:40:38 dwmw2 + * Updated to use kernel's N_R3964 if available + * + * Revision 1.4 1998/04/02 20:29:44 lhaag + * select, blocking, ... + * + * Revision 1.3 1998/02/12 18:58:43 root + * fixed some memory leaks + * calculation of checksum characters + * + * Revision 1.2 1998/02/07 13:03:17 root + * ioctl read_telegram + * + * Revision 1.1 1998/02/06 19:19:43 root + * Initial revision + * + * + */ + +#ifndef __LINUX_N_R3964_H__ +#define __LINUX_N_R3964_H__ + +/* line disciplines for r3964 protocol */ + + +/* + * Ioctl-commands + */ + +#define R3964_ENABLE_SIGNALS 0x5301 +#define R3964_SETPRIORITY 0x5302 +#define R3964_USE_BCC 0x5303 +#define R3964_READ_TELEGRAM 0x5304 + +/* Options for R3964_SETPRIORITY */ +#define R3964_MASTER 0 +#define R3964_SLAVE 1 + +/* Options for R3964_ENABLE_SIGNALS */ +#define R3964_SIG_ACK 0x0001 +#define R3964_SIG_DATA 0x0002 +#define R3964_SIG_ALL 0x000f +#define R3964_SIG_NONE 0x0000 +#define R3964_USE_SIGIO 0x1000 + +/* + * r3964 operation states: + */ + +/* types for msg_id: */ +enum {R3964_MSG_ACK=1, R3964_MSG_DATA }; + +#define R3964_MAX_MSG_COUNT 32 + +/* error codes for client messages */ +#define R3964_OK 0 /* no error. */ +#define R3964_TX_FAIL -1 /* transmission error, block NOT sent */ +#define R3964_OVERFLOW -2 /* msg queue overflow */ + +/* the client gets this struct when calling read(fd,...): */ +struct r3964_client_message { + int msg_id; + int arg; + int error_code; +}; + +#define R3964_MTU 256 + + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nbd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nbd.h new file mode 100644 index 0000000..6eab0ab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nbd.h @@ -0,0 +1,68 @@ +/* + * 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL. + * 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne) + * Made nbd_end_request() use the io_request_lock + * 2001 Copyright (C) Steven Whitehouse + * New nbd_end_request() for compatibility with new linux block + * layer code. + * 2003/06/24 Louis D. Langholtz + * Removed unneeded blksize_bits field from nbd_device struct. + * Cleanup PARANOIA usage & code. + * 2004/02/19 Paul Clements + * Removed PARANOIA, plus various cleanup and comments + */ + +#ifndef LINUX_NBD_H +#define LINUX_NBD_H + +#include + +#define NBD_SET_SOCK _IO( 0xab, 0 ) +#define NBD_SET_BLKSIZE _IO( 0xab, 1 ) +#define NBD_SET_SIZE _IO( 0xab, 2 ) +#define NBD_DO_IT _IO( 0xab, 3 ) +#define NBD_CLEAR_SOCK _IO( 0xab, 4 ) +#define NBD_CLEAR_QUE _IO( 0xab, 5 ) +#define NBD_PRINT_DEBUG _IO( 0xab, 6 ) +#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) +#define NBD_DISCONNECT _IO( 0xab, 8 ) +#define NBD_SET_TIMEOUT _IO( 0xab, 9 ) + +enum { + NBD_CMD_READ = 0, + NBD_CMD_WRITE = 1, + NBD_CMD_DISC = 2 +}; + +#define nbd_cmd(req) ((req)->cmd[0]) + +/* userspace doesn't need the nbd_device structure */ + +/* These are sent over the network in the request/reply magic fields */ + +#define NBD_REQUEST_MAGIC 0x25609513 +#define NBD_REPLY_MAGIC 0x67446698 +/* Do *not* use magics: 0x12560953 0x96744668. */ + +/* + * This is the packet used for communication between client and + * server. All data are in network byte order. + */ +struct nbd_request { + __be32 magic; + __be32 type; /* == READ || == WRITE */ + char handle[8]; + __be64 from; + __be32 len; +} __attribute__ ((packed)); + +/* + * This is the reply packet that nbd-server sends back to the client after + * it has completed an I/O request (or an error occurs). + */ +struct nbd_reply { + __be32 magic; + __be32 error; /* 0 = ok, else error */ + char handle[8]; /* handle you got from request */ +}; +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp.h new file mode 100644 index 0000000..4482ad7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp.h @@ -0,0 +1,198 @@ +/* + * ncp.h + * + * Copyright (C) 1995 by Volker Lendecke + * Modified for sparc by J.F. Chadima + * Modified for __constant_ntoh by Frank A. Vorstenbosch + * + */ + +#ifndef _LINUX_NCP_H +#define _LINUX_NCP_H + +#include + +#define NCP_PTYPE (0x11) +#define NCP_PORT (0x0451) + +#define NCP_ALLOC_SLOT_REQUEST (0x1111) +#define NCP_REQUEST (0x2222) +#define NCP_DEALLOC_SLOT_REQUEST (0x5555) + +struct ncp_request_header { + __u16 type; + __u8 sequence; + __u8 conn_low; + __u8 task; + __u8 conn_high; + __u8 function; + __u8 data[0]; +} __attribute__((packed)); + +#define NCP_REPLY (0x3333) +#define NCP_WATCHDOG (0x3E3E) +#define NCP_POSITIVE_ACK (0x9999) + +struct ncp_reply_header { + __u16 type; + __u8 sequence; + __u8 conn_low; + __u8 task; + __u8 conn_high; + __u8 completion_code; + __u8 connection_state; + __u8 data[0]; +} __attribute__((packed)); + +#define NCP_VOLNAME_LEN (16) +#define NCP_NUMBER_OF_VOLUMES (256) +struct ncp_volume_info { + __u32 total_blocks; + __u32 free_blocks; + __u32 purgeable_blocks; + __u32 not_yet_purgeable_blocks; + __u32 total_dir_entries; + __u32 available_dir_entries; + __u8 sectors_per_block; + char volume_name[NCP_VOLNAME_LEN + 1]; +}; + +#define AR_READ (cpu_to_le16(1)) +#define AR_WRITE (cpu_to_le16(2)) +#define AR_EXCLUSIVE (cpu_to_le16(0x20)) + +#define NCP_FILE_ID_LEN 6 + +/* Defines for Name Spaces */ +#define NW_NS_DOS 0 +#define NW_NS_MAC 1 +#define NW_NS_NFS 2 +#define NW_NS_FTAM 3 +#define NW_NS_OS2 4 + +/* Defines for ReturnInformationMask */ +#define RIM_NAME (cpu_to_le32(1)) +#define RIM_SPACE_ALLOCATED (cpu_to_le32(2)) +#define RIM_ATTRIBUTES (cpu_to_le32(4)) +#define RIM_DATA_SIZE (cpu_to_le32(8)) +#define RIM_TOTAL_SIZE (cpu_to_le32(0x10)) +#define RIM_EXT_ATTR_INFO (cpu_to_le32(0x20)) +#define RIM_ARCHIVE (cpu_to_le32(0x40)) +#define RIM_MODIFY (cpu_to_le32(0x80)) +#define RIM_CREATION (cpu_to_le32(0x100)) +#define RIM_OWNING_NAMESPACE (cpu_to_le32(0x200)) +#define RIM_DIRECTORY (cpu_to_le32(0x400)) +#define RIM_RIGHTS (cpu_to_le32(0x800)) +#define RIM_ALL (cpu_to_le32(0xFFF)) +#define RIM_COMPRESSED_INFO (cpu_to_le32(0x80000000)) + +/* Defines for NSInfoBitMask */ +#define NSIBM_NFS_NAME 0x0001 +#define NSIBM_NFS_MODE 0x0002 +#define NSIBM_NFS_GID 0x0004 +#define NSIBM_NFS_NLINKS 0x0008 +#define NSIBM_NFS_RDEV 0x0010 +#define NSIBM_NFS_LINK 0x0020 +#define NSIBM_NFS_CREATED 0x0040 +#define NSIBM_NFS_UID 0x0080 +#define NSIBM_NFS_ACSFLAG 0x0100 +#define NSIBM_NFS_MYFLAG 0x0200 + +/* open/create modes */ +#define OC_MODE_OPEN 0x01 +#define OC_MODE_TRUNCATE 0x02 +#define OC_MODE_REPLACE 0x02 +#define OC_MODE_CREATE 0x08 + +/* open/create results */ +#define OC_ACTION_NONE 0x00 +#define OC_ACTION_OPEN 0x01 +#define OC_ACTION_CREATE 0x02 +#define OC_ACTION_TRUNCATE 0x04 +#define OC_ACTION_REPLACE 0x04 + +/* access rights attributes */ +#ifndef AR_READ_ONLY +#define AR_READ_ONLY 0x0001 +#define AR_WRITE_ONLY 0x0002 +#define AR_DENY_READ 0x0004 +#define AR_DENY_WRITE 0x0008 +#define AR_COMPATIBILITY 0x0010 +#define AR_WRITE_THROUGH 0x0040 +#define AR_OPEN_COMPRESSED 0x0100 +#endif + +struct nw_nfs_info { + __u32 mode; + __u32 rdev; +}; + +struct nw_info_struct { + __u32 spaceAlloc; + __le32 attributes; + __u16 flags; + __le32 dataStreamSize; + __le32 totalStreamSize; + __u16 numberOfStreams; + __le16 creationTime; + __le16 creationDate; + __u32 creatorID; + __le16 modifyTime; + __le16 modifyDate; + __u32 modifierID; + __le16 lastAccessDate; + __u16 archiveTime; + __u16 archiveDate; + __u32 archiverID; + __u16 inheritedRightsMask; + __le32 dirEntNum; + __le32 DosDirNum; + __u32 volNumber; + __u32 EADataSize; + __u32 EAKeyCount; + __u32 EAKeySize; + __u32 NSCreator; + __u8 nameLen; + __u8 entryName[256]; + /* libncp may depend on there being nothing after entryName */ +} __attribute__((packed)); + +/* modify mask - use with MODIFY_DOS_INFO structure */ +#define DM_ATTRIBUTES (cpu_to_le32(0x02)) +#define DM_CREATE_DATE (cpu_to_le32(0x04)) +#define DM_CREATE_TIME (cpu_to_le32(0x08)) +#define DM_CREATOR_ID (cpu_to_le32(0x10)) +#define DM_ARCHIVE_DATE (cpu_to_le32(0x20)) +#define DM_ARCHIVE_TIME (cpu_to_le32(0x40)) +#define DM_ARCHIVER_ID (cpu_to_le32(0x80)) +#define DM_MODIFY_DATE (cpu_to_le32(0x0100)) +#define DM_MODIFY_TIME (cpu_to_le32(0x0200)) +#define DM_MODIFIER_ID (cpu_to_le32(0x0400)) +#define DM_LAST_ACCESS_DATE (cpu_to_le32(0x0800)) +#define DM_INHERITED_RIGHTS_MASK (cpu_to_le32(0x1000)) +#define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000)) + +struct nw_modify_dos_info { + __le32 attributes; + __le16 creationDate; + __le16 creationTime; + __u32 creatorID; + __le16 modifyDate; + __le16 modifyTime; + __u32 modifierID; + __u16 archiveDate; + __u16 archiveTime; + __u32 archiverID; + __le16 lastAccessDate; + __u16 inheritanceGrantMask; + __u16 inheritanceRevokeMask; + __u32 maximumSpace; +} __attribute__((packed)); + +struct nw_search_sequence { + __u8 volNumber; + __u32 dirBase; + __u32 sequence; +} __attribute__((packed)); + +#endif /* _LINUX_NCP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_fs.h new file mode 100644 index 0000000..b542047 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_fs.h @@ -0,0 +1,147 @@ +/* + * ncp_fs.h + * + * Copyright (C) 1995, 1996 by Volker Lendecke + * + */ + +#ifndef _LINUX_NCP_FS_H +#define _LINUX_NCP_FS_H + +#include +#include +#include +#include + +#include +#include + +/* + * ioctl commands + */ + +struct ncp_ioctl_request { + unsigned int function; + unsigned int size; + char *data; +}; + +struct ncp_fs_info { + int version; + struct sockaddr_ipx addr; + __kernel_uid_t mounted_uid; + int connection; /* Connection number the server assigned us */ + int buffer_size; /* The negotiated buffer size, to be + used for read/write requests! */ + + int volume_number; + __le32 directory_id; +}; + +struct ncp_fs_info_v2 { + int version; + unsigned long mounted_uid; + unsigned int connection; + unsigned int buffer_size; + + unsigned int volume_number; + __le32 directory_id; + + __u32 dummy1; + __u32 dummy2; + __u32 dummy3; +}; + +struct ncp_sign_init +{ + char sign_root[8]; + char sign_last[16]; +}; + +struct ncp_lock_ioctl +{ +#define NCP_LOCK_LOG 0 +#define NCP_LOCK_SH 1 +#define NCP_LOCK_EX 2 +#define NCP_LOCK_CLEAR 256 + int cmd; + int origin; + unsigned int offset; + unsigned int length; +#define NCP_LOCK_DEFAULT_TIMEOUT 18 +#define NCP_LOCK_MAX_TIMEOUT 180 + int timeout; +}; + +struct ncp_setroot_ioctl +{ + int volNumber; + int namespace; + __le32 dirEntNum; +}; + +struct ncp_objectname_ioctl +{ +#define NCP_AUTH_NONE 0x00 +#define NCP_AUTH_BIND 0x31 +#define NCP_AUTH_NDS 0x32 + int auth_type; + size_t object_name_len; + void * object_name; /* a userspace data, in most cases user name */ +}; + +struct ncp_privatedata_ioctl +{ + size_t len; + void * data; /* ~1000 for NDS */ +}; + +/* NLS charsets by ioctl */ +#define NCP_IOCSNAME_LEN 20 +struct ncp_nls_ioctl +{ + unsigned char codepage[NCP_IOCSNAME_LEN+1]; + unsigned char iocharset[NCP_IOCSNAME_LEN+1]; +}; + +#define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request) +#define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_old_uid_t) +#define NCP_IOC_GETMOUNTUID2 _IOW('n', 2, unsigned long) + +#define NCP_IOC_CONN_LOGGED_IN _IO('n', 3) + +#define NCP_GET_FS_INFO_VERSION (1) +#define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info) +#define NCP_GET_FS_INFO_VERSION_V2 (2) +#define NCP_IOC_GET_FS_INFO_V2 _IOWR('n', 4, struct ncp_fs_info_v2) + +#define NCP_IOC_SIGN_INIT _IOR('n', 5, struct ncp_sign_init) +#define NCP_IOC_SIGN_WANTED _IOR('n', 6, int) +#define NCP_IOC_SET_SIGN_WANTED _IOW('n', 6, int) + +#define NCP_IOC_LOCKUNLOCK _IOR('n', 7, struct ncp_lock_ioctl) + +#define NCP_IOC_GETROOT _IOW('n', 8, struct ncp_setroot_ioctl) +#define NCP_IOC_SETROOT _IOR('n', 8, struct ncp_setroot_ioctl) + +#define NCP_IOC_GETOBJECTNAME _IOWR('n', 9, struct ncp_objectname_ioctl) +#define NCP_IOC_SETOBJECTNAME _IOR('n', 9, struct ncp_objectname_ioctl) +#define NCP_IOC_GETPRIVATEDATA _IOWR('n', 10, struct ncp_privatedata_ioctl) +#define NCP_IOC_SETPRIVATEDATA _IOR('n', 10, struct ncp_privatedata_ioctl) + +#define NCP_IOC_GETCHARSETS _IOWR('n', 11, struct ncp_nls_ioctl) +#define NCP_IOC_SETCHARSETS _IOR('n', 11, struct ncp_nls_ioctl) + +#define NCP_IOC_GETDENTRYTTL _IOW('n', 12, __u32) +#define NCP_IOC_SETDENTRYTTL _IOR('n', 12, __u32) + +/* + * The packet size to allocate. One page should be enough. + */ +#define NCP_PACKET_SIZE 4070 + +#define NCP_MAXPATHLEN 255 +#define NCP_MAXNAMELEN 14 + + +#endif /* _LINUX_NCP_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_mount.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_mount.h new file mode 100644 index 0000000..ebe4a2e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_mount.h @@ -0,0 +1,72 @@ +/* + * ncp_mount.h + * + * Copyright (C) 1995, 1996 by Volker Lendecke + * + */ + +#ifndef _LINUX_NCP_MOUNT_H +#define _LINUX_NCP_MOUNT_H + +#include +#include + +#define NCP_MOUNT_VERSION 3 /* Binary */ + +/* Values for flags */ +#define NCP_MOUNT_SOFT 0x0001 +#define NCP_MOUNT_INTR 0x0002 +#define NCP_MOUNT_STRONG 0x0004 /* enable delete/rename of r/o files */ +#define NCP_MOUNT_NO_OS2 0x0008 /* do not use OS/2 (LONG) namespace */ +#define NCP_MOUNT_NO_NFS 0x0010 /* do not use NFS namespace */ +#define NCP_MOUNT_EXTRAS 0x0020 +#define NCP_MOUNT_SYMLINKS 0x0040 /* enable symlinks */ +#define NCP_MOUNT_NFS_EXTRAS 0x0080 /* Enable use of NFS NS meta-info */ + +struct ncp_mount_data { + int version; + unsigned int ncp_fd; /* The socket to the ncp port */ + __kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */ + __kernel_pid_t wdog_pid; /* Who cares for our watchdog packets? */ + + unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; + unsigned int time_out; /* How long should I wait after + sending a NCP request? */ + unsigned int retry_count; /* And how often should I retry? */ + unsigned int flags; + + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_mode_t file_mode; + __kernel_mode_t dir_mode; +}; + +#define NCP_MOUNT_VERSION_V4 (4) /* Binary or text */ + +struct ncp_mount_data_v4 { + int version; + unsigned long flags; /* NCP_MOUNT_* flags */ + /* MIPS uses long __kernel_uid_t, but... */ + /* we neever pass -1, so it is safe */ + unsigned long mounted_uid; /* Who may umount() this filesystem? */ + /* MIPS uses long __kernel_pid_t */ + long wdog_pid; /* Who cares for our watchdog packets? */ + + unsigned int ncp_fd; /* The socket to the ncp port */ + unsigned int time_out; /* How long should I wait after + sending a NCP request? */ + unsigned int retry_count; /* And how often should I retry? */ + + /* MIPS uses long __kernel_uid_t... */ + /* we never pass -1, so it is safe */ + unsigned long uid; + unsigned long gid; + /* MIPS uses unsigned long __kernel_mode_t */ + unsigned long file_mode; + unsigned long dir_mode; +}; + +#define NCP_MOUNT_VERSION_V5 (5) /* Text only */ + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_no.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_no.h new file mode 100644 index 0000000..cddaa48 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ncp_no.h @@ -0,0 +1,19 @@ +#ifndef _NCP_NO +#define _NCP_NO + +/* these define the attribute byte as seen by NCP */ +#define aRONLY (__cpu_to_le32(1)) +#define aHIDDEN (__cpu_to_le32(2)) +#define aSYSTEM (__cpu_to_le32(4)) +#define aEXECUTE (__cpu_to_le32(8)) +#define aDIR (__cpu_to_le32(0x10)) +#define aARCH (__cpu_to_le32(0x20)) +#define aSHARED (__cpu_to_le32(0x80)) +#define aDONTSUBALLOCATE (__cpu_to_le32(1L<<11)) +#define aTRANSACTIONAL (__cpu_to_le32(1L<<12)) +#define aPURGE (__cpu_to_le32(1L<<16)) +#define aRENAMEINHIBIT (__cpu_to_le32(1L<<17)) +#define aDELETEINHIBIT (__cpu_to_le32(1L<<18)) +#define aDONTCOMPRESS (__cpu_to_le32(1L<<27)) + +#endif /* _NCP_NO */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/neighbour.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/neighbour.h new file mode 100644 index 0000000..12c9de1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/neighbour.h @@ -0,0 +1,161 @@ +#ifndef __LINUX_NEIGHBOUR_H +#define __LINUX_NEIGHBOUR_H + +#include +#include + +struct ndmsg +{ + __u8 ndm_family; + __u8 ndm_pad1; + __u16 ndm_pad2; + __s32 ndm_ifindex; + __u16 ndm_state; + __u8 ndm_flags; + __u8 ndm_type; +}; + +enum +{ + NDA_UNSPEC, + NDA_DST, + NDA_LLADDR, + NDA_CACHEINFO, + NDA_PROBES, + __NDA_MAX +}; + +#define NDA_MAX (__NDA_MAX - 1) + +/* + * Neighbor Cache Entry Flags + */ + +#define NTF_USE 0x01 +#define NTF_PROXY 0x08 /* == ATF_PUBL */ +#define NTF_ROUTER 0x80 + +/* + * Neighbor Cache Entry States. + */ + +#define NUD_INCOMPLETE 0x01 +#define NUD_REACHABLE 0x02 +#define NUD_STALE 0x04 +#define NUD_DELAY 0x08 +#define NUD_PROBE 0x10 +#define NUD_FAILED 0x20 + +/* Dummy states */ +#define NUD_NOARP 0x40 +#define NUD_PERMANENT 0x80 +#define NUD_NONE 0x00 + +/* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change + and make no address resolution or NUD. + NUD_PERMANENT is also cannot be deleted by garbage collectors. + */ + +struct nda_cacheinfo +{ + __u32 ndm_confirmed; + __u32 ndm_used; + __u32 ndm_updated; + __u32 ndm_refcnt; +}; + +/***************************************************************** + * Neighbour tables specific messages. + * + * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the + * NLM_F_DUMP flag set. Every neighbour table configuration is + * spread over multiple messages to avoid running into message + * size limits on systems with many interfaces. The first message + * in the sequence transports all not device specific data such as + * statistics, configuration, and the default parameter set. + * This message is followed by 0..n messages carrying device + * specific parameter sets. + * Although the ordering should be sufficient, NDTA_NAME can be + * used to identify sequences. The initial message can be identified + * by checking for NDTA_CONFIG. The device specific messages do + * not contain this TLV but have NDTPA_IFINDEX set to the + * corresponding interface index. + * + * To change neighbour table attributes, send RTM_SETNEIGHTBL + * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], + * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked + * otherwise. Device specific parameter sets can be changed by + * setting NDTPA_IFINDEX to the interface index of the corresponding + * device. + ****/ + +struct ndt_stats +{ + __u64 ndts_allocs; + __u64 ndts_destroys; + __u64 ndts_hash_grows; + __u64 ndts_res_failed; + __u64 ndts_lookups; + __u64 ndts_hits; + __u64 ndts_rcv_probes_mcast; + __u64 ndts_rcv_probes_ucast; + __u64 ndts_periodic_gc_runs; + __u64 ndts_forced_gc_runs; +}; + +enum { + NDTPA_UNSPEC, + NDTPA_IFINDEX, /* u32, unchangeable */ + NDTPA_REFCNT, /* u32, read-only */ + NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ + NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ + NDTPA_RETRANS_TIME, /* u64, msecs */ + NDTPA_GC_STALETIME, /* u64, msecs */ + NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ + NDTPA_QUEUE_LEN, /* u32 */ + NDTPA_APP_PROBES, /* u32 */ + NDTPA_UCAST_PROBES, /* u32 */ + NDTPA_MCAST_PROBES, /* u32 */ + NDTPA_ANYCAST_DELAY, /* u64, msecs */ + NDTPA_PROXY_DELAY, /* u64, msecs */ + NDTPA_PROXY_QLEN, /* u32 */ + NDTPA_LOCKTIME, /* u64, msecs */ + __NDTPA_MAX +}; +#define NDTPA_MAX (__NDTPA_MAX - 1) + +struct ndtmsg +{ + __u8 ndtm_family; + __u8 ndtm_pad1; + __u16 ndtm_pad2; +}; + +struct ndt_config +{ + __u16 ndtc_key_len; + __u16 ndtc_entry_size; + __u32 ndtc_entries; + __u32 ndtc_last_flush; /* delta to now in msecs */ + __u32 ndtc_last_rand; /* delta to now in msecs */ + __u32 ndtc_hash_rnd; + __u32 ndtc_hash_mask; + __u32 ndtc_hash_chain_gc; + __u32 ndtc_proxy_qlen; +}; + +enum { + NDTA_UNSPEC, + NDTA_NAME, /* char *, unchangeable */ + NDTA_THRESH1, /* u32 */ + NDTA_THRESH2, /* u32 */ + NDTA_THRESH3, /* u32 */ + NDTA_CONFIG, /* struct ndt_config, read-only */ + NDTA_PARMS, /* nested TLV NDTPA_* */ + NDTA_STATS, /* struct ndt_stats, read-only */ + NDTA_GC_INTERVAL, /* u64, msecs */ + __NDTA_MAX +}; +#define NDTA_MAX (__NDTA_MAX - 1) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/net.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/net.h new file mode 100644 index 0000000..2b4120b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/net.h @@ -0,0 +1,55 @@ +/* + * NET An implementation of the SOCKET network access protocol. + * This is the master header file for the Linux NET layer, + * or, in plain English: the networking handling part of the + * kernel. + * + * Version: @(#)net.h 1.0.3 05/25/93 + * + * Authors: Orest Zborowski, + * Ross Biro + * Fred N. van Kempen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_NET_H +#define _LINUX_NET_H + +#include +#include + +#define NPROTO AF_MAX + +#define SYS_SOCKET 1 /* sys_socket(2) */ +#define SYS_BIND 2 /* sys_bind(2) */ +#define SYS_CONNECT 3 /* sys_connect(2) */ +#define SYS_LISTEN 4 /* sys_listen(2) */ +#define SYS_ACCEPT 5 /* sys_accept(2) */ +#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ +#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */ +#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ +#define SYS_SEND 9 /* sys_send(2) */ +#define SYS_RECV 10 /* sys_recv(2) */ +#define SYS_SENDTO 11 /* sys_sendto(2) */ +#define SYS_RECVFROM 12 /* sys_recvfrom(2) */ +#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ +#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ +#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ +#define SYS_SENDMSG 16 /* sys_sendmsg(2) */ +#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ +#define SYS_ACCEPT4 18 /* sys_accept4(2) */ + +typedef enum { + SS_FREE = 0, /* not allocated */ + SS_UNCONNECTED, /* unconnected to any socket */ + SS_CONNECTING, /* in process of connecting */ + SS_CONNECTED, /* connected to socket */ + SS_DISCONNECTING /* in process of disconnecting */ +} socket_state; + +#define __SO_ACCEPTCON (1 << 16) /* performed a listen */ + +#endif /* _LINUX_NET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/net_dropmon.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/net_dropmon.h new file mode 100644 index 0000000..0e2e100 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/net_dropmon.h @@ -0,0 +1,57 @@ +#ifndef __NET_DROPMON_H +#define __NET_DROPMON_H + +#include +#include + +struct net_dm_drop_point { + __u8 pc[8]; + __u32 count; +}; + +#define NET_DM_CFG_VERSION 0 +#define NET_DM_CFG_ALERT_COUNT 1 +#define NET_DM_CFG_ALERT_DELAY 2 +#define NET_DM_CFG_MAX 3 + +struct net_dm_config_entry { + __u32 type; + __u64 data __attribute__((aligned(8))); +}; + +struct net_dm_config_msg { + __u32 entries; + struct net_dm_config_entry options[0]; +}; + +struct net_dm_alert_msg { + __u32 entries; + struct net_dm_drop_point points[0]; +}; + +struct net_dm_user_msg { + union { + struct net_dm_config_msg user; + struct net_dm_alert_msg alert; + } u; +}; + + +/* These are the netlink message types for this protocol */ + +enum { + NET_DM_CMD_UNSPEC = 0, + NET_DM_CMD_ALERT, + NET_DM_CMD_CONFIG, + NET_DM_CMD_START, + NET_DM_CMD_STOP, + _NET_DM_CMD_MAX, +}; + +#define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1) + +/* + * Our group identifiers + */ +#define NET_DM_GRP_ALERT 1 +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netdevice.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netdevice.h new file mode 100644 index 0000000..5e649c0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netdevice.h @@ -0,0 +1,92 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the Interfaces handler. + * + * Version: @(#)dev.h 1.0.10 08/12/93 + * + * Authors: Ross Biro + * Fred N. van Kempen, + * Corey Minyard + * Donald J. Becker, + * Alan Cox, + * Bjorn Ekwall. + * Pekka Riikonen + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Moved to /usr/include/linux for NET3 + */ +#ifndef _LINUX_NETDEVICE_H +#define _LINUX_NETDEVICE_H + +#include +#include +#include + + +#define MAX_ADDR_LEN 32 /* Largest hardware address length */ + +/* Driver transmit return codes */ +#define NETDEV_TX_OK 0 /* driver took care of packet */ +#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ +#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */ + + +/* + * Network device statistics. Akin to the 2.0 ether stats but + * with byte counters. + */ + +struct net_device_stats +{ + unsigned long rx_packets; /* total packets received */ + unsigned long tx_packets; /* total packets transmitted */ + unsigned long rx_bytes; /* total bytes received */ + unsigned long tx_bytes; /* total bytes transmitted */ + unsigned long rx_errors; /* bad packets received */ + unsigned long tx_errors; /* packet transmit problems */ + unsigned long rx_dropped; /* no space in linux buffers */ + unsigned long tx_dropped; /* no space available in linux */ + unsigned long multicast; /* multicast packets received */ + unsigned long collisions; + + /* detailed rx_errors: */ + unsigned long rx_length_errors; + unsigned long rx_over_errors; /* receiver ring buff overflow */ + unsigned long rx_crc_errors; /* recved pkt with crc error */ + unsigned long rx_frame_errors; /* recv'd frame alignment error */ + unsigned long rx_fifo_errors; /* recv'r fifo overrun */ + unsigned long rx_missed_errors; /* receiver missed packet */ + + /* detailed tx_errors */ + unsigned long tx_aborted_errors; + unsigned long tx_carrier_errors; + unsigned long tx_fifo_errors; + unsigned long tx_heartbeat_errors; + unsigned long tx_window_errors; + + /* for cslip etc */ + unsigned long rx_compressed; + unsigned long tx_compressed; +}; + + +/* Media selection options. */ +enum { + IF_PORT_UNKNOWN = 0, + IF_PORT_10BASE2, + IF_PORT_10BASET, + IF_PORT_AUI, + IF_PORT_100BASET, + IF_PORT_100BASETX, + IF_PORT_100BASEFX +}; + + +#endif /* _LINUX_DEV_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter.h new file mode 100644 index 0000000..2eb00b6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter.h @@ -0,0 +1,59 @@ +#ifndef __LINUX_NETFILTER_H +#define __LINUX_NETFILTER_H + +#include + + +/* Responses from hook functions. */ +#define NF_DROP 0 +#define NF_ACCEPT 1 +#define NF_STOLEN 2 +#define NF_QUEUE 3 +#define NF_REPEAT 4 +#define NF_STOP 5 +#define NF_MAX_VERDICT NF_STOP + +/* we overload the higher bits for encoding auxiliary data such as the queue + * number. Not nice, but better than additional function arguments. */ +#define NF_VERDICT_MASK 0x0000ffff +#define NF_VERDICT_BITS 16 + +#define NF_VERDICT_QMASK 0xffff0000 +#define NF_VERDICT_QBITS 16 + +#define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE) + +/* only for userspace compatibility */ +/* Generic cache responses from hook functions. + <= 0x2000 is used for protocol-flags. */ +#define NFC_UNKNOWN 0x4000 +#define NFC_ALTERED 0x8000 + +enum nf_inet_hooks { + NF_INET_PRE_ROUTING, + NF_INET_LOCAL_IN, + NF_INET_FORWARD, + NF_INET_LOCAL_OUT, + NF_INET_POST_ROUTING, + NF_INET_NUMHOOKS +}; + +enum { + NFPROTO_UNSPEC = 0, + NFPROTO_IPV4 = 2, + NFPROTO_ARP = 3, + NFPROTO_BRIDGE = 7, + NFPROTO_IPV6 = 10, + NFPROTO_DECNET = 12, + NFPROTO_NUMPROTO, +}; + +union nf_inet_addr { + __u32 all[4]; + __be32 ip; + __be32 ip6[4]; + struct in_addr in; + struct in6_addr in6; +}; + +#endif /*__LINUX_NETFILTER_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/..install.cmd new file mode 100644 index 0000000..456ff2f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter mips nf_conntrack_common.h nf_conntrack_ftp.h nf_conntrack_sctp.h nf_conntrack_tcp.h nf_conntrack_tuple_common.h nfnetlink.h nfnetlink_compat.h nfnetlink_conntrack.h nfnetlink_log.h nfnetlink_queue.h x_tables.h xt_CLASSIFY.h xt_CONNMARK.h xt_CONNSECMARK.h xt_DSCP.h xt_LED.h xt_MARK.h xt_NFLOG.h xt_NFQUEUE.h xt_RATEEST.h xt_SECMARK.h xt_TCPMSS.h xt_TCPOPTSTRIP.h xt_TPROXY.h xt_cluster.h xt_comment.h xt_connbytes.h xt_connlimit.h xt_connmark.h xt_conntrack.h xt_dccp.h xt_dscp.h xt_esp.h xt_hashlimit.h xt_helper.h xt_iprange.h xt_length.h xt_limit.h xt_mac.h xt_mark.h xt_multiport.h xt_owner.h xt_physdev.h xt_pkttype.h xt_policy.h xt_quota.h xt_rateest.h xt_realm.h xt_recent.h xt_sctp.h xt_state.h xt_statistic.h xt_string.h xt_tcpmss.h xt_tcpudp.h xt_time.h xt_u32.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_common.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_common.h new file mode 100644 index 0000000..d766ef1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_common.h @@ -0,0 +1,148 @@ +#ifndef _NF_CONNTRACK_COMMON_H +#define _NF_CONNTRACK_COMMON_H +/* Connection state tracking for netfilter. This is separated from, + but required by, the NAT layer; it can also be used by an iptables + extension. */ +enum ip_conntrack_info +{ + /* Part of an established connection (either direction). */ + IP_CT_ESTABLISHED, + + /* Like NEW, but related to an existing connection, or ICMP error + (in either direction). */ + IP_CT_RELATED, + + /* Started a new connection to track (only + IP_CT_DIR_ORIGINAL); may be a retransmission. */ + IP_CT_NEW, + + /* >= this indicates reply direction */ + IP_CT_IS_REPLY, + + /* Number of distinct IP_CT types (no NEW in reply dirn). */ + IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1 +}; + +/* Bitset representing status of connection. */ +enum ip_conntrack_status { + /* It's an expected connection: bit 0 set. This bit never changed */ + IPS_EXPECTED_BIT = 0, + IPS_EXPECTED = (1 << IPS_EXPECTED_BIT), + + /* We've seen packets both ways: bit 1 set. Can be set, not unset. */ + IPS_SEEN_REPLY_BIT = 1, + IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT), + + /* Conntrack should never be early-expired. */ + IPS_ASSURED_BIT = 2, + IPS_ASSURED = (1 << IPS_ASSURED_BIT), + + /* Connection is confirmed: originating packet has left box */ + IPS_CONFIRMED_BIT = 3, + IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT), + + /* Connection needs src nat in orig dir. This bit never changed. */ + IPS_SRC_NAT_BIT = 4, + IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT), + + /* Connection needs dst nat in orig dir. This bit never changed. */ + IPS_DST_NAT_BIT = 5, + IPS_DST_NAT = (1 << IPS_DST_NAT_BIT), + + /* Both together. */ + IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT), + + /* Connection needs TCP sequence adjusted. */ + IPS_SEQ_ADJUST_BIT = 6, + IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT), + + /* NAT initialization bits. */ + IPS_SRC_NAT_DONE_BIT = 7, + IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT), + + IPS_DST_NAT_DONE_BIT = 8, + IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT), + + /* Both together */ + IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), + + /* Connection is dying (removed from lists), can not be unset. */ + IPS_DYING_BIT = 9, + IPS_DYING = (1 << IPS_DYING_BIT), + + /* Connection has fixed timeout. */ + IPS_FIXED_TIMEOUT_BIT = 10, + IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), +}; + +/* Connection tracking event bits */ +enum ip_conntrack_events +{ + /* New conntrack */ + IPCT_NEW_BIT = 0, + IPCT_NEW = (1 << IPCT_NEW_BIT), + + /* Expected connection */ + IPCT_RELATED_BIT = 1, + IPCT_RELATED = (1 << IPCT_RELATED_BIT), + + /* Destroyed conntrack */ + IPCT_DESTROY_BIT = 2, + IPCT_DESTROY = (1 << IPCT_DESTROY_BIT), + + /* Timer has been refreshed */ + IPCT_REFRESH_BIT = 3, + IPCT_REFRESH = (1 << IPCT_REFRESH_BIT), + + /* Status has changed */ + IPCT_STATUS_BIT = 4, + IPCT_STATUS = (1 << IPCT_STATUS_BIT), + + /* Update of protocol info */ + IPCT_PROTOINFO_BIT = 5, + IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT), + + /* Volatile protocol info */ + IPCT_PROTOINFO_VOLATILE_BIT = 6, + IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT), + + /* New helper for conntrack */ + IPCT_HELPER_BIT = 7, + IPCT_HELPER = (1 << IPCT_HELPER_BIT), + + /* Update of helper info */ + IPCT_HELPINFO_BIT = 8, + IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT), + + /* Volatile helper info */ + IPCT_HELPINFO_VOLATILE_BIT = 9, + IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT), + + /* NAT info */ + IPCT_NATINFO_BIT = 10, + IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), + + /* Counter highest bit has been set, unused */ + IPCT_COUNTER_FILLING_BIT = 11, + IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), + + /* Mark is set */ + IPCT_MARK_BIT = 12, + IPCT_MARK = (1 << IPCT_MARK_BIT), + + /* NAT sequence adjustment */ + IPCT_NATSEQADJ_BIT = 13, + IPCT_NATSEQADJ = (1 << IPCT_NATSEQADJ_BIT), + + /* Secmark is set */ + IPCT_SECMARK_BIT = 14, + IPCT_SECMARK = (1 << IPCT_SECMARK_BIT), +}; + +enum ip_conntrack_expect_events { + IPEXP_NEW_BIT = 0, + IPEXP_NEW = (1 << IPEXP_NEW_BIT), +}; + + +#endif /* _NF_CONNTRACK_COMMON_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_ftp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_ftp.h new file mode 100644 index 0000000..c0dbb4e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_ftp.h @@ -0,0 +1,19 @@ +#ifndef _NF_CONNTRACK_FTP_H +#define _NF_CONNTRACK_FTP_H +/* FTP tracking. */ + +/* This enum is exposed to userspace */ +enum nf_ct_ftp_type +{ + /* PORT command from client */ + NF_CT_FTP_PORT, + /* PASV response from server */ + NF_CT_FTP_PASV, + /* EPRT command from client */ + NF_CT_FTP_EPRT, + /* EPSV response from server */ + NF_CT_FTP_EPSV, +}; + + +#endif /* _NF_CONNTRACK_FTP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_sctp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_sctp.h new file mode 100644 index 0000000..768f78c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_sctp.h @@ -0,0 +1,26 @@ +#ifndef _NF_CONNTRACK_SCTP_H +#define _NF_CONNTRACK_SCTP_H +/* SCTP tracking. */ + +#include + +enum sctp_conntrack { + SCTP_CONNTRACK_NONE, + SCTP_CONNTRACK_CLOSED, + SCTP_CONNTRACK_COOKIE_WAIT, + SCTP_CONNTRACK_COOKIE_ECHOED, + SCTP_CONNTRACK_ESTABLISHED, + SCTP_CONNTRACK_SHUTDOWN_SENT, + SCTP_CONNTRACK_SHUTDOWN_RECD, + SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, + SCTP_CONNTRACK_MAX +}; + +struct ip_ct_sctp +{ + enum sctp_conntrack state; + + __be32 vtag[IP_CT_DIR_MAX]; +}; + +#endif /* _NF_CONNTRACK_SCTP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_tcp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_tcp.h new file mode 100644 index 0000000..d501596 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_tcp.h @@ -0,0 +1,47 @@ +#ifndef _NF_CONNTRACK_TCP_H +#define _NF_CONNTRACK_TCP_H +/* TCP tracking. */ + +#include + +/* This is exposed to userspace (ctnetlink) */ +enum tcp_conntrack { + TCP_CONNTRACK_NONE, + TCP_CONNTRACK_SYN_SENT, + TCP_CONNTRACK_SYN_RECV, + TCP_CONNTRACK_ESTABLISHED, + TCP_CONNTRACK_FIN_WAIT, + TCP_CONNTRACK_CLOSE_WAIT, + TCP_CONNTRACK_LAST_ACK, + TCP_CONNTRACK_TIME_WAIT, + TCP_CONNTRACK_CLOSE, + TCP_CONNTRACK_LISTEN, + TCP_CONNTRACK_MAX, + TCP_CONNTRACK_IGNORE +}; + +/* Window scaling is advertised by the sender */ +#define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01 + +/* SACK is permitted by the sender */ +#define IP_CT_TCP_FLAG_SACK_PERM 0x02 + +/* This sender sent FIN first */ +#define IP_CT_TCP_FLAG_CLOSE_INIT 0x04 + +/* Be liberal in window checking */ +#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 + +/* Has unacknowledged data */ +#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10 + +/* The field td_maxack has been set */ +#define IP_CT_TCP_FLAG_MAXACK_SET 0x20 + +struct nf_ct_tcp_flags { + __u8 flags; + __u8 mask; +}; + + +#endif /* _NF_CONNTRACK_TCP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_tuple_common.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_tuple_common.h new file mode 100644 index 0000000..8e145f0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nf_conntrack_tuple_common.h @@ -0,0 +1,13 @@ +#ifndef _NF_CONNTRACK_TUPLE_COMMON_H +#define _NF_CONNTRACK_TUPLE_COMMON_H + +enum ip_conntrack_dir +{ + IP_CT_DIR_ORIGINAL, + IP_CT_DIR_REPLY, + IP_CT_DIR_MAX +}; + +#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) + +#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink.h new file mode 100644 index 0000000..034ae90 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink.h @@ -0,0 +1,51 @@ +#ifndef _NFNETLINK_H +#define _NFNETLINK_H +#include +#include + +enum nfnetlink_groups { + NFNLGRP_NONE, +#define NFNLGRP_NONE NFNLGRP_NONE + NFNLGRP_CONNTRACK_NEW, +#define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW + NFNLGRP_CONNTRACK_UPDATE, +#define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE + NFNLGRP_CONNTRACK_DESTROY, +#define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY + NFNLGRP_CONNTRACK_EXP_NEW, +#define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW + NFNLGRP_CONNTRACK_EXP_UPDATE, +#define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE + NFNLGRP_CONNTRACK_EXP_DESTROY, +#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY + __NFNLGRP_MAX, +}; +#define NFNLGRP_MAX (__NFNLGRP_MAX - 1) + +/* General form of address family dependent message. + */ +struct nfgenmsg { + __u8 nfgen_family; /* AF_xxx */ + __u8 version; /* nfnetlink version */ + __be16 res_id; /* resource id */ +}; + +#define NFNETLINK_V0 0 + +/* netfilter netlink message types are split in two pieces: + * 8 bit subsystem, 8bit operation. + */ + +#define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8) +#define NFNL_MSG_TYPE(x) (x & 0x00ff) + +/* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS() + * won't work anymore */ +#define NFNL_SUBSYS_NONE 0 +#define NFNL_SUBSYS_CTNETLINK 1 +#define NFNL_SUBSYS_CTNETLINK_EXP 2 +#define NFNL_SUBSYS_QUEUE 3 +#define NFNL_SUBSYS_ULOG 4 +#define NFNL_SUBSYS_COUNT 5 + +#endif /* _NFNETLINK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_compat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_compat.h new file mode 100644 index 0000000..343ecb7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_compat.h @@ -0,0 +1,62 @@ +#ifndef _NFNETLINK_COMPAT_H +#define _NFNETLINK_COMPAT_H + +#include + +/* Old nfnetlink macros for userspace */ + +/* nfnetlink groups: Up to 32 maximum */ +#define NF_NETLINK_CONNTRACK_NEW 0x00000001 +#define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 +#define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 +#define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 +#define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 +#define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 + +/* Generic structure for encapsulation optional netfilter information. + * It is reminiscent of sockaddr, but with sa_family replaced + * with attribute type. + * ! This should someday be put somewhere generic as now rtnetlink and + * ! nfnetlink use the same attributes methods. - J. Schulist. + */ + +struct nfattr +{ + __u16 nfa_len; + __u16 nfa_type; /* we use 15 bits for the type, and the highest + * bit to indicate whether the payload is nested */ +}; + +/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from + * rtnetlink.h, it's time to put this in a generic file */ + +#define NFNL_NFA_NEST 0x8000 +#define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) + +#define NFA_ALIGNTO 4 +#define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) +#define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ + && (nfa)->nfa_len <= (len)) +#define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ + (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) +#define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) +#define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) +#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) +#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) +#define NFA_NEST(skb, type) \ +({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ + NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ + __start; }) +#define NFA_NEST_END(skb, start) \ +({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ + (skb)->len; }) +#define NFA_NEST_CANCEL(skb, start) \ +({ if (start) \ + skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ + -1; }) + +#define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ + + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) +#define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) + +#endif /* _NFNETLINK_COMPAT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_conntrack.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_conntrack.h new file mode 100644 index 0000000..1a865e4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_conntrack.h @@ -0,0 +1,172 @@ +#ifndef _IPCONNTRACK_NETLINK_H +#define _IPCONNTRACK_NETLINK_H +#include + +enum cntl_msg_types { + IPCTNL_MSG_CT_NEW, + IPCTNL_MSG_CT_GET, + IPCTNL_MSG_CT_DELETE, + IPCTNL_MSG_CT_GET_CTRZERO, + + IPCTNL_MSG_MAX +}; + +enum ctnl_exp_msg_types { + IPCTNL_MSG_EXP_NEW, + IPCTNL_MSG_EXP_GET, + IPCTNL_MSG_EXP_DELETE, + + IPCTNL_MSG_EXP_MAX +}; + + +enum ctattr_type { + CTA_UNSPEC, + CTA_TUPLE_ORIG, + CTA_TUPLE_REPLY, + CTA_STATUS, + CTA_PROTOINFO, + CTA_HELP, + CTA_NAT_SRC, +#define CTA_NAT CTA_NAT_SRC /* backwards compatibility */ + CTA_TIMEOUT, + CTA_MARK, + CTA_COUNTERS_ORIG, + CTA_COUNTERS_REPLY, + CTA_USE, + CTA_ID, + CTA_NAT_DST, + CTA_TUPLE_MASTER, + CTA_NAT_SEQ_ADJ_ORIG, + CTA_NAT_SEQ_ADJ_REPLY, + CTA_SECMARK, + __CTA_MAX +}; +#define CTA_MAX (__CTA_MAX - 1) + +enum ctattr_tuple { + CTA_TUPLE_UNSPEC, + CTA_TUPLE_IP, + CTA_TUPLE_PROTO, + __CTA_TUPLE_MAX +}; +#define CTA_TUPLE_MAX (__CTA_TUPLE_MAX - 1) + +enum ctattr_ip { + CTA_IP_UNSPEC, + CTA_IP_V4_SRC, + CTA_IP_V4_DST, + CTA_IP_V6_SRC, + CTA_IP_V6_DST, + __CTA_IP_MAX +}; +#define CTA_IP_MAX (__CTA_IP_MAX - 1) + +enum ctattr_l4proto { + CTA_PROTO_UNSPEC, + CTA_PROTO_NUM, + CTA_PROTO_SRC_PORT, + CTA_PROTO_DST_PORT, + CTA_PROTO_ICMP_ID, + CTA_PROTO_ICMP_TYPE, + CTA_PROTO_ICMP_CODE, + CTA_PROTO_ICMPV6_ID, + CTA_PROTO_ICMPV6_TYPE, + CTA_PROTO_ICMPV6_CODE, + __CTA_PROTO_MAX +}; +#define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) + +enum ctattr_protoinfo { + CTA_PROTOINFO_UNSPEC, + CTA_PROTOINFO_TCP, + CTA_PROTOINFO_DCCP, + CTA_PROTOINFO_SCTP, + __CTA_PROTOINFO_MAX +}; +#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) + +enum ctattr_protoinfo_tcp { + CTA_PROTOINFO_TCP_UNSPEC, + CTA_PROTOINFO_TCP_STATE, + CTA_PROTOINFO_TCP_WSCALE_ORIGINAL, + CTA_PROTOINFO_TCP_WSCALE_REPLY, + CTA_PROTOINFO_TCP_FLAGS_ORIGINAL, + CTA_PROTOINFO_TCP_FLAGS_REPLY, + __CTA_PROTOINFO_TCP_MAX +}; +#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) + +enum ctattr_protoinfo_dccp { + CTA_PROTOINFO_DCCP_UNSPEC, + CTA_PROTOINFO_DCCP_STATE, + CTA_PROTOINFO_DCCP_ROLE, + __CTA_PROTOINFO_DCCP_MAX, +}; +#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) + +enum ctattr_protoinfo_sctp { + CTA_PROTOINFO_SCTP_UNSPEC, + CTA_PROTOINFO_SCTP_STATE, + CTA_PROTOINFO_SCTP_VTAG_ORIGINAL, + CTA_PROTOINFO_SCTP_VTAG_REPLY, + __CTA_PROTOINFO_SCTP_MAX +}; +#define CTA_PROTOINFO_SCTP_MAX (__CTA_PROTOINFO_SCTP_MAX - 1) + +enum ctattr_counters { + CTA_COUNTERS_UNSPEC, + CTA_COUNTERS_PACKETS, /* 64bit counters */ + CTA_COUNTERS_BYTES, /* 64bit counters */ + CTA_COUNTERS32_PACKETS, /* old 32bit counters, unused */ + CTA_COUNTERS32_BYTES, /* old 32bit counters, unused */ + __CTA_COUNTERS_MAX +}; +#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) + +enum ctattr_nat { + CTA_NAT_UNSPEC, + CTA_NAT_MINIP, + CTA_NAT_MAXIP, + CTA_NAT_PROTO, + __CTA_NAT_MAX +}; +#define CTA_NAT_MAX (__CTA_NAT_MAX - 1) + +enum ctattr_protonat { + CTA_PROTONAT_UNSPEC, + CTA_PROTONAT_PORT_MIN, + CTA_PROTONAT_PORT_MAX, + __CTA_PROTONAT_MAX +}; +#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) + +enum ctattr_natseq { + CTA_NAT_SEQ_UNSPEC, + CTA_NAT_SEQ_CORRECTION_POS, + CTA_NAT_SEQ_OFFSET_BEFORE, + CTA_NAT_SEQ_OFFSET_AFTER, + __CTA_NAT_SEQ_MAX +}; +#define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1) + +enum ctattr_expect { + CTA_EXPECT_UNSPEC, + CTA_EXPECT_MASTER, + CTA_EXPECT_TUPLE, + CTA_EXPECT_MASK, + CTA_EXPECT_TIMEOUT, + CTA_EXPECT_ID, + CTA_EXPECT_HELP_NAME, + __CTA_EXPECT_MAX +}; +#define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) + +enum ctattr_help { + CTA_HELP_UNSPEC, + CTA_HELP_NAME, + __CTA_HELP_MAX +}; +#define CTA_HELP_MAX (__CTA_HELP_MAX - 1) + +#endif /* _IPCONNTRACK_NETLINK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_log.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_log.h new file mode 100644 index 0000000..d3bab7a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_log.h @@ -0,0 +1,96 @@ +#ifndef _NFNETLINK_LOG_H +#define _NFNETLINK_LOG_H + +/* This file describes the netlink messages (i.e. 'protocol packets'), + * and not any kind of function definitions. It is shared between kernel and + * userspace. Don't put kernel specific stuff in here */ + +#include +#include + +enum nfulnl_msg_types { + NFULNL_MSG_PACKET, /* packet from kernel to userspace */ + NFULNL_MSG_CONFIG, /* connect to a particular queue */ + + NFULNL_MSG_MAX +}; + +struct nfulnl_msg_packet_hdr { + __be16 hw_protocol; /* hw protocol (network order) */ + __u8 hook; /* netfilter hook */ + __u8 _pad; +}; + +struct nfulnl_msg_packet_hw { + __be16 hw_addrlen; + __u16 _pad; + __u8 hw_addr[8]; +}; + +struct nfulnl_msg_packet_timestamp { + aligned_be64 sec; + aligned_be64 usec; +}; + +enum nfulnl_attr_type { + NFULA_UNSPEC, + NFULA_PACKET_HDR, + NFULA_MARK, /* __u32 nfmark */ + NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */ + NFULA_IFINDEX_INDEV, /* __u32 ifindex */ + NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */ + NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ + NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ + NFULA_HWADDR, /* nfulnl_msg_packet_hw */ + NFULA_PAYLOAD, /* opaque data payload */ + NFULA_PREFIX, /* string prefix */ + NFULA_UID, /* user id of socket */ + NFULA_SEQ, /* instance-local sequence number */ + NFULA_SEQ_GLOBAL, /* global sequence number */ + NFULA_GID, /* group id of socket */ + NFULA_HWTYPE, /* hardware type */ + NFULA_HWHEADER, /* hardware header */ + NFULA_HWLEN, /* hardware header length */ + + __NFULA_MAX +}; +#define NFULA_MAX (__NFULA_MAX - 1) + +enum nfulnl_msg_config_cmds { + NFULNL_CFG_CMD_NONE, + NFULNL_CFG_CMD_BIND, + NFULNL_CFG_CMD_UNBIND, + NFULNL_CFG_CMD_PF_BIND, + NFULNL_CFG_CMD_PF_UNBIND, +}; + +struct nfulnl_msg_config_cmd { + __u8 command; /* nfulnl_msg_config_cmds */ +} __attribute__ ((packed)); + +struct nfulnl_msg_config_mode { + __be32 copy_range; + __u8 copy_mode; + __u8 _pad; +} __attribute__ ((packed)); + +enum nfulnl_attr_config { + NFULA_CFG_UNSPEC, + NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */ + NFULA_CFG_MODE, /* nfulnl_msg_config_mode */ + NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */ + NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */ + NFULA_CFG_QTHRESH, /* __u32 */ + NFULA_CFG_FLAGS, /* __u16 */ + __NFULA_CFG_MAX +}; +#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) + +#define NFULNL_COPY_NONE 0x00 +#define NFULNL_COPY_META 0x01 +#define NFULNL_COPY_PACKET 0x02 + +#define NFULNL_CFG_F_SEQ 0x0001 +#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002 + +#endif /* _NFNETLINK_LOG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_queue.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_queue.h new file mode 100644 index 0000000..2455fe5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/nfnetlink_queue.h @@ -0,0 +1,90 @@ +#ifndef _NFNETLINK_QUEUE_H +#define _NFNETLINK_QUEUE_H + +#include +#include + +enum nfqnl_msg_types { + NFQNL_MSG_PACKET, /* packet from kernel to userspace */ + NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */ + NFQNL_MSG_CONFIG, /* connect to a particular queue */ + + NFQNL_MSG_MAX +}; + +struct nfqnl_msg_packet_hdr { + __be32 packet_id; /* unique ID of packet in queue */ + __be16 hw_protocol; /* hw protocol (network order) */ + __u8 hook; /* netfilter hook */ +} __attribute__ ((packed)); + +struct nfqnl_msg_packet_hw { + __be16 hw_addrlen; + __u16 _pad; + __u8 hw_addr[8]; +}; + +struct nfqnl_msg_packet_timestamp { + aligned_be64 sec; + aligned_be64 usec; +}; + +enum nfqnl_attr_type { + NFQA_UNSPEC, + NFQA_PACKET_HDR, + NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ + NFQA_MARK, /* __u32 nfmark */ + NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ + NFQA_IFINDEX_INDEV, /* __u32 ifindex */ + NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */ + NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ + NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ + NFQA_HWADDR, /* nfqnl_msg_packet_hw */ + NFQA_PAYLOAD, /* opaque data payload */ + + __NFQA_MAX +}; +#define NFQA_MAX (__NFQA_MAX - 1) + +struct nfqnl_msg_verdict_hdr { + __be32 verdict; + __be32 id; +}; + + +enum nfqnl_msg_config_cmds { + NFQNL_CFG_CMD_NONE, + NFQNL_CFG_CMD_BIND, + NFQNL_CFG_CMD_UNBIND, + NFQNL_CFG_CMD_PF_BIND, + NFQNL_CFG_CMD_PF_UNBIND, +}; + +struct nfqnl_msg_config_cmd { + __u8 command; /* nfqnl_msg_config_cmds */ + __u8 _pad; + __be16 pf; /* AF_xxx for PF_[UN]BIND */ +}; + +enum nfqnl_config_mode { + NFQNL_COPY_NONE, + NFQNL_COPY_META, + NFQNL_COPY_PACKET, +}; + +struct nfqnl_msg_config_params { + __be32 copy_range; + __u8 copy_mode; /* enum nfqnl_config_mode */ +} __attribute__ ((packed)); + + +enum nfqnl_attr_config { + NFQA_CFG_UNSPEC, + NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ + NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ + NFQA_CFG_QUEUE_MAXLEN, /* __u32 */ + __NFQA_CFG_MAX +}; +#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) + +#endif /* _NFNETLINK_QUEUE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/x_tables.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/x_tables.h new file mode 100644 index 0000000..2794d97 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/x_tables.h @@ -0,0 +1,175 @@ +#ifndef _X_TABLES_H +#define _X_TABLES_H + +#include + +#define XT_FUNCTION_MAXNAMELEN 30 +#define XT_TABLE_MAXNAMELEN 32 + +struct xt_entry_match +{ + union { + struct { + __u16 match_size; + + /* Used by userspace */ + char name[XT_FUNCTION_MAXNAMELEN-1]; + + __u8 revision; + } user; + struct { + __u16 match_size; + + /* Used inside the kernel */ + struct xt_match *match; + } kernel; + + /* Total length */ + __u16 match_size; + } u; + + unsigned char data[0]; +}; + +struct xt_entry_target +{ + union { + struct { + __u16 target_size; + + /* Used by userspace */ + char name[XT_FUNCTION_MAXNAMELEN-1]; + + __u8 revision; + } user; + struct { + __u16 target_size; + + /* Used inside the kernel */ + struct xt_target *target; + } kernel; + + /* Total length */ + __u16 target_size; + } u; + + unsigned char data[0]; +}; + +#define XT_TARGET_INIT(__name, __size) \ +{ \ + .target.u.user = { \ + .target_size = XT_ALIGN(__size), \ + .name = __name, \ + }, \ +} + +struct xt_standard_target +{ + struct xt_entry_target target; + int verdict; +}; + +/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision + * kernel supports, if >= revision. */ +struct xt_get_revision +{ + char name[XT_FUNCTION_MAXNAMELEN-1]; + + __u8 revision; +}; + +/* CONTINUE verdict for targets */ +#define XT_CONTINUE 0xFFFFFFFF + +/* For standard target */ +#define XT_RETURN (-NF_REPEAT - 1) + +/* this is a dummy structure to find out the alignment requirement for a struct + * containing all the fundamental data types that are used in ipt_entry, + * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my + * personal pleasure to remove it -HW + */ +struct _xt_align +{ + __u8 u8; + __u16 u16; + __u32 u32; + __u64 u64; +}; + +#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ + & ~(__alignof__(struct _xt_align)-1)) + +/* Standard return verdict, or do jump. */ +#define XT_STANDARD_TARGET "" +/* Error verdict. */ +#define XT_ERROR_TARGET "ERROR" + +#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) +#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) + +struct xt_counters +{ + __u64 pcnt, bcnt; /* Packet and byte counters */ +}; + +/* The argument to IPT_SO_ADD_COUNTERS. */ +struct xt_counters_info +{ + /* Which table. */ + char name[XT_TABLE_MAXNAMELEN]; + + unsigned int num_counters; + + /* The counters (actually `number' of these). */ + struct xt_counters counters[0]; +}; + +#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ + +/* fn returns 0 to continue iteration */ +#define XT_MATCH_ITERATE(type, e, fn, args...) \ +({ \ + unsigned int __i; \ + int __ret = 0; \ + struct xt_entry_match *__m; \ + \ + for (__i = sizeof(type); \ + __i < (e)->target_offset; \ + __i += __m->u.match_size) { \ + __m = (void *)e + __i; \ + \ + __ret = fn(__m , ## args); \ + if (__ret != 0) \ + break; \ + } \ + __ret; \ +}) + +/* fn returns 0 to continue iteration */ +#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \ +({ \ + unsigned int __i, __n; \ + int __ret = 0; \ + type *__entry; \ + \ + for (__i = 0, __n = 0; __i < (size); \ + __i += __entry->next_offset, __n++) { \ + __entry = (void *)(entries) + __i; \ + if (__n < n) \ + continue; \ + \ + __ret = fn(__entry , ## args); \ + if (__ret != 0) \ + break; \ + } \ + __ret; \ +}) + +/* fn returns 0 to continue iteration */ +#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ + XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) + + +#endif /* _X_TABLES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CLASSIFY.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CLASSIFY.h new file mode 100644 index 0000000..a813bf1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CLASSIFY.h @@ -0,0 +1,10 @@ +#ifndef _XT_CLASSIFY_H +#define _XT_CLASSIFY_H + +#include + +struct xt_classify_target_info { + __u32 priority; +}; + +#endif /*_XT_CLASSIFY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CONNMARK.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CONNMARK.h new file mode 100644 index 0000000..7635c8f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CONNMARK.h @@ -0,0 +1,32 @@ +#ifndef _XT_CONNMARK_H_target +#define _XT_CONNMARK_H_target + +#include + +/* Copyright (C) 2002,2004 MARA Systems AB + * by Henrik Nordstrom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +enum { + XT_CONNMARK_SET = 0, + XT_CONNMARK_SAVE, + XT_CONNMARK_RESTORE +}; + +struct xt_connmark_target_info { + unsigned long mark; + unsigned long mask; + __u8 mode; +}; + +struct xt_connmark_tginfo1 { + __u32 ctmark, ctmask, nfmask; + __u8 mode; +}; + +#endif /*_XT_CONNMARK_H_target*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CONNSECMARK.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CONNSECMARK.h new file mode 100644 index 0000000..b973ff8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_CONNSECMARK.h @@ -0,0 +1,15 @@ +#ifndef _XT_CONNSECMARK_H_target +#define _XT_CONNSECMARK_H_target + +#include + +enum { + CONNSECMARK_SAVE = 1, + CONNSECMARK_RESTORE, +}; + +struct xt_connsecmark_target_info { + __u8 mode; +}; + +#endif /*_XT_CONNSECMARK_H_target */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_DSCP.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_DSCP.h new file mode 100644 index 0000000..648e0b3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_DSCP.h @@ -0,0 +1,26 @@ +/* x_tables module for setting the IPv4/IPv6 DSCP field + * + * (C) 2002 Harald Welte + * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh + * This software is distributed under GNU GPL v2, 1991 + * + * See RFC2474 for a description of the DSCP field within the IP Header. + * + * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp +*/ +#ifndef _XT_DSCP_TARGET_H +#define _XT_DSCP_TARGET_H +#include +#include + +/* target info */ +struct xt_DSCP_info { + __u8 dscp; +}; + +struct xt_tos_target_info { + __u8 tos_value; + __u8 tos_mask; +}; + +#endif /* _XT_DSCP_TARGET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_LED.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_LED.h new file mode 100644 index 0000000..f5509e7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_LED.h @@ -0,0 +1,15 @@ +#ifndef _XT_LED_H +#define _XT_LED_H + +#include + +struct xt_led_info { + char id[27]; /* Unique ID for this trigger in the LED class */ + __u8 always_blink; /* Blink even if the LED is already on */ + __u32 delay; /* Delay until LED is switched off after trigger */ + + /* Kernel data used in the module */ + void *internal_data __attribute__((aligned(8))); +}; + +#endif /* _XT_LED_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_MARK.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_MARK.h new file mode 100644 index 0000000..028304b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_MARK.h @@ -0,0 +1,27 @@ +#ifndef _XT_MARK_H_target +#define _XT_MARK_H_target + +#include + +/* Version 0 */ +struct xt_mark_target_info { + unsigned long mark; +}; + +/* Version 1 */ +enum { + XT_MARK_SET=0, + XT_MARK_AND, + XT_MARK_OR, +}; + +struct xt_mark_target_info_v1 { + unsigned long mark; + __u8 mode; +}; + +struct xt_mark_tginfo2 { + __u32 mark, mask; +}; + +#endif /*_XT_MARK_H_target */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_NFLOG.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_NFLOG.h new file mode 100644 index 0000000..87b5831 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_NFLOG.h @@ -0,0 +1,20 @@ +#ifndef _XT_NFLOG_TARGET +#define _XT_NFLOG_TARGET + +#include + +#define XT_NFLOG_DEFAULT_GROUP 0x1 +#define XT_NFLOG_DEFAULT_THRESHOLD 0 + +#define XT_NFLOG_MASK 0x0 + +struct xt_nflog_info { + __u32 len; + __u16 group; + __u16 threshold; + __u16 flags; + __u16 pad; + char prefix[64]; +}; + +#endif /* _XT_NFLOG_TARGET */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_NFQUEUE.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_NFQUEUE.h new file mode 100644 index 0000000..982a89f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_NFQUEUE.h @@ -0,0 +1,18 @@ +/* iptables module for using NFQUEUE mechanism + * + * (C) 2005 Harald Welte + * + * This software is distributed under GNU GPL v2, 1991 + * +*/ +#ifndef _XT_NFQ_TARGET_H +#define _XT_NFQ_TARGET_H + +#include + +/* target info */ +struct xt_NFQ_info { + __u16 queuenum; +}; + +#endif /* _XT_NFQ_TARGET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_RATEEST.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_RATEEST.h new file mode 100644 index 0000000..6605e20 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_RATEEST.h @@ -0,0 +1,15 @@ +#ifndef _XT_RATEEST_TARGET_H +#define _XT_RATEEST_TARGET_H + +#include + +struct xt_rateest_target_info { + char name[IFNAMSIZ]; + __s8 interval; + __u8 ewma_log; + + /* Used internally by the kernel */ + struct xt_rateest *est __attribute__((aligned(8))); +}; + +#endif /* _XT_RATEEST_TARGET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_SECMARK.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_SECMARK.h new file mode 100644 index 0000000..6fcd344 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_SECMARK.h @@ -0,0 +1,28 @@ +#ifndef _XT_SECMARK_H_target +#define _XT_SECMARK_H_target + +#include + +/* + * This is intended for use by various security subsystems (but not + * at the same time). + * + * 'mode' refers to the specific security subsystem which the + * packets are being marked for. + */ +#define SECMARK_MODE_SEL 0x01 /* SELinux */ +#define SECMARK_SELCTX_MAX 256 + +struct xt_secmark_target_selinux_info { + __u32 selsid; + char selctx[SECMARK_SELCTX_MAX]; +}; + +struct xt_secmark_target_info { + __u8 mode; + union { + struct xt_secmark_target_selinux_info sel; + } u; +}; + +#endif /*_XT_SECMARK_H_target */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TCPMSS.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TCPMSS.h new file mode 100644 index 0000000..9a6960a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TCPMSS.h @@ -0,0 +1,12 @@ +#ifndef _XT_TCPMSS_H +#define _XT_TCPMSS_H + +#include + +struct xt_tcpmss_info { + __u16 mss; +}; + +#define XT_TCPMSS_CLAMP_PMTU 0xffff + +#endif /* _XT_TCPMSS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h new file mode 100644 index 0000000..2db5432 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h @@ -0,0 +1,13 @@ +#ifndef _XT_TCPOPTSTRIP_H +#define _XT_TCPOPTSTRIP_H + +#define tcpoptstrip_set_bit(bmap, idx) \ + (bmap[(idx) >> 5] |= 1U << (idx & 31)) +#define tcpoptstrip_test_bit(bmap, idx) \ + (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) + +struct xt_tcpoptstrip_target_info { + u_int32_t strip_bmap[8]; +}; + +#endif /* _XT_TCPOPTSTRIP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TPROXY.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TPROXY.h new file mode 100644 index 0000000..152e8f9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_TPROXY.h @@ -0,0 +1,14 @@ +#ifndef _XT_TPROXY_H_target +#define _XT_TPROXY_H_target + +/* TPROXY target is capable of marking the packet to perform + * redirection. We can get rid of that whenever we get support for + * mutliple targets in the same rule. */ +struct xt_tproxy_target_info { + u_int32_t mark_mask; + u_int32_t mark_value; + __be32 laddr; + __be16 lport; +}; + +#endif /* _XT_TPROXY_H_target */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_cluster.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_cluster.h new file mode 100644 index 0000000..8866826 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_cluster.h @@ -0,0 +1,17 @@ +#ifndef _XT_CLUSTER_MATCH_H +#define _XT_CLUSTER_MATCH_H + +enum xt_cluster_flags { + XT_CLUSTER_F_INV = (1 << 0) +}; + +struct xt_cluster_match_info { + u_int32_t total_nodes; + u_int32_t node_mask; + u_int32_t hash_seed; + u_int32_t flags; +}; + +#define XT_CLUSTER_NODES_MAX 32 + +#endif /* _XT_CLUSTER_MATCH_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_comment.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_comment.h new file mode 100644 index 0000000..eacfedc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_comment.h @@ -0,0 +1,10 @@ +#ifndef _XT_COMMENT_H +#define _XT_COMMENT_H + +#define XT_MAX_COMMENT_LEN 256 + +struct xt_comment_info { + unsigned char comment[XT_MAX_COMMENT_LEN]; +}; + +#endif /* XT_COMMENT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connbytes.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connbytes.h new file mode 100644 index 0000000..52bd615 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connbytes.h @@ -0,0 +1,27 @@ +#ifndef _XT_CONNBYTES_H +#define _XT_CONNBYTES_H + +#include + +enum xt_connbytes_what { + XT_CONNBYTES_PKTS, + XT_CONNBYTES_BYTES, + XT_CONNBYTES_AVGPKT, +}; + +enum xt_connbytes_direction { + XT_CONNBYTES_DIR_ORIGINAL, + XT_CONNBYTES_DIR_REPLY, + XT_CONNBYTES_DIR_BOTH, +}; + +struct xt_connbytes_info +{ + struct { + aligned_u64 from; /* count to be matched */ + aligned_u64 to; /* count to be matched */ + } count; + __u8 what; /* ipt_connbytes_what */ + __u8 direction; /* ipt_connbytes_direction */ +}; +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connlimit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connlimit.h new file mode 100644 index 0000000..9ba54e4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connlimit.h @@ -0,0 +1,20 @@ +#ifndef _XT_CONNLIMIT_H +#define _XT_CONNLIMIT_H + +struct xt_connlimit_data; + +struct xt_connlimit_info { + union { + union nf_inet_addr mask; + union { + __be32 v4_mask; + __be32 v6_mask[4]; + }; + }; + unsigned int limit, inverse; + + /* Used internally by the kernel */ + struct xt_connlimit_data *data __attribute__((aligned(8))); +}; + +#endif /* _XT_CONNLIMIT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connmark.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connmark.h new file mode 100644 index 0000000..571e266 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_connmark.h @@ -0,0 +1,25 @@ +#ifndef _XT_CONNMARK_H +#define _XT_CONNMARK_H + +#include + +/* Copyright (C) 2002,2004 MARA Systems AB + * by Henrik Nordstrom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +struct xt_connmark_info { + unsigned long mark, mask; + __u8 invert; +}; + +struct xt_connmark_mtinfo1 { + __u32 mark, mask; + __u8 invert; +}; + +#endif /*_XT_CONNMARK_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_conntrack.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_conntrack.h new file mode 100644 index 0000000..3430c77 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_conntrack.h @@ -0,0 +1,84 @@ +/* Header file for kernel module to match connection tracking information. + * GPL (C) 2001 Marc Boucher (marc@mbsi.ca). + */ + +#ifndef _XT_CONNTRACK_H +#define _XT_CONNTRACK_H + +#include +#include + +#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) +#define XT_CONNTRACK_STATE_INVALID (1 << 0) + +#define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) +#define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) +#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) + +/* flags, invflags: */ +enum { + XT_CONNTRACK_STATE = 1 << 0, + XT_CONNTRACK_PROTO = 1 << 1, + XT_CONNTRACK_ORIGSRC = 1 << 2, + XT_CONNTRACK_ORIGDST = 1 << 3, + XT_CONNTRACK_REPLSRC = 1 << 4, + XT_CONNTRACK_REPLDST = 1 << 5, + XT_CONNTRACK_STATUS = 1 << 6, + XT_CONNTRACK_EXPIRES = 1 << 7, + XT_CONNTRACK_ORIGSRC_PORT = 1 << 8, + XT_CONNTRACK_ORIGDST_PORT = 1 << 9, + XT_CONNTRACK_REPLSRC_PORT = 1 << 10, + XT_CONNTRACK_REPLDST_PORT = 1 << 11, + XT_CONNTRACK_DIRECTION = 1 << 12, +}; + +/* This is exposed to userspace, so remains frozen in time. */ +struct ip_conntrack_old_tuple +{ + struct { + __be32 ip; + union { + __u16 all; + } u; + } src; + + struct { + __be32 ip; + union { + __u16 all; + } u; + + /* The protocol. */ + __u16 protonum; + } dst; +}; + +struct xt_conntrack_info +{ + unsigned int statemask, statusmask; + + struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX]; + struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX]; + + unsigned long expires_min, expires_max; + + /* Flags word */ + __u8 flags; + /* Inverse flags */ + __u8 invflags; +}; + +struct xt_conntrack_mtinfo1 { + union nf_inet_addr origsrc_addr, origsrc_mask; + union nf_inet_addr origdst_addr, origdst_mask; + union nf_inet_addr replsrc_addr, replsrc_mask; + union nf_inet_addr repldst_addr, repldst_mask; + __u32 expires_min, expires_max; + __u16 l4proto; + __be16 origsrc_port, origdst_port; + __be16 replsrc_port, repldst_port; + __u16 match_flags, invert_flags; + __u8 state_mask, status_mask; +}; + +#endif /*_XT_CONNTRACK_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_dccp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_dccp.h new file mode 100644 index 0000000..a579e1b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_dccp.h @@ -0,0 +1,25 @@ +#ifndef _XT_DCCP_H_ +#define _XT_DCCP_H_ + +#include + +#define XT_DCCP_SRC_PORTS 0x01 +#define XT_DCCP_DEST_PORTS 0x02 +#define XT_DCCP_TYPE 0x04 +#define XT_DCCP_OPTION 0x08 + +#define XT_DCCP_VALID_FLAGS 0x0f + +struct xt_dccp_info { + __u16 dpts[2]; /* Min, Max */ + __u16 spts[2]; /* Min, Max */ + + __u16 flags; + __u16 invflags; + + __u16 typemask; + __u8 option; +}; + +#endif /* _XT_DCCP_H_ */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_dscp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_dscp.h new file mode 100644 index 0000000..15f8932 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_dscp.h @@ -0,0 +1,31 @@ +/* x_tables module for matching the IPv4/IPv6 DSCP field + * + * (C) 2002 Harald Welte + * This software is distributed under GNU GPL v2, 1991 + * + * See RFC2474 for a description of the DSCP field within the IP Header. + * + * xt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp +*/ +#ifndef _XT_DSCP_H +#define _XT_DSCP_H + +#include + +#define XT_DSCP_MASK 0xfc /* 11111100 */ +#define XT_DSCP_SHIFT 2 +#define XT_DSCP_MAX 0x3f /* 00111111 */ + +/* match info */ +struct xt_dscp_info { + __u8 dscp; + __u8 invert; +}; + +struct xt_tos_match_info { + __u8 tos_mask; + __u8 tos_value; + __u8 invert; +}; + +#endif /* _XT_DSCP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_esp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_esp.h new file mode 100644 index 0000000..ef6fa47 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_esp.h @@ -0,0 +1,16 @@ +#ifndef _XT_ESP_H +#define _XT_ESP_H + +#include + +struct xt_esp +{ + __u32 spis[2]; /* Security Parameter Index */ + __u8 invflags; /* Inverse flags */ +}; + +/* Values for "invflags" field in struct xt_esp. */ +#define XT_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ +#define XT_ESP_INV_MASK 0x01 /* All possible flags. */ + +#endif /*_XT_ESP_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_hashlimit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_hashlimit.h new file mode 100644 index 0000000..b1925b5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_hashlimit.h @@ -0,0 +1,68 @@ +#ifndef _XT_HASHLIMIT_H +#define _XT_HASHLIMIT_H + +#include + +/* timings are in milliseconds. */ +#define XT_HASHLIMIT_SCALE 10000 +/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 + seconds, or one every 59 hours. */ + +/* details of this structure hidden by the implementation */ +struct xt_hashlimit_htable; + +enum { + XT_HASHLIMIT_HASH_DIP = 1 << 0, + XT_HASHLIMIT_HASH_DPT = 1 << 1, + XT_HASHLIMIT_HASH_SIP = 1 << 2, + XT_HASHLIMIT_HASH_SPT = 1 << 3, + XT_HASHLIMIT_INVERT = 1 << 4, +}; + +struct hashlimit_cfg { + __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ + __u32 avg; /* Average secs between packets * scale */ + __u32 burst; /* Period multiplier for upper limit. */ + + /* user specified */ + __u32 size; /* how many buckets */ + __u32 max; /* max number of entries */ + __u32 gc_interval; /* gc interval */ + __u32 expire; /* when do entries expire? */ +}; + +struct xt_hashlimit_info { + char name [IFNAMSIZ]; /* name */ + struct hashlimit_cfg cfg; + + /* Used internally by the kernel */ + struct xt_hashlimit_htable *hinfo; + union { + void *ptr; + struct xt_hashlimit_info *master; + } u; +}; + +struct hashlimit_cfg1 { + __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ + __u32 avg; /* Average secs between packets * scale */ + __u32 burst; /* Period multiplier for upper limit. */ + + /* user specified */ + __u32 size; /* how many buckets */ + __u32 max; /* max number of entries */ + __u32 gc_interval; /* gc interval */ + __u32 expire; /* when do entries expire? */ + + __u8 srcmask, dstmask; +}; + +struct xt_hashlimit_mtinfo1 { + char name[IFNAMSIZ]; + struct hashlimit_cfg1 cfg; + + /* Used internally by the kernel */ + struct xt_hashlimit_htable *hinfo __attribute__((aligned(8))); +}; + +#endif /*_XT_HASHLIMIT_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_helper.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_helper.h new file mode 100644 index 0000000..6b42763 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_helper.h @@ -0,0 +1,8 @@ +#ifndef _XT_HELPER_H +#define _XT_HELPER_H + +struct xt_helper_info { + int invert; + char name[30]; +}; +#endif /* _XT_HELPER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_iprange.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_iprange.h new file mode 100644 index 0000000..c1f21a7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_iprange.h @@ -0,0 +1,19 @@ +#ifndef _LINUX_NETFILTER_XT_IPRANGE_H +#define _LINUX_NETFILTER_XT_IPRANGE_H 1 + +#include + +enum { + IPRANGE_SRC = 1 << 0, /* match source IP address */ + IPRANGE_DST = 1 << 1, /* match destination IP address */ + IPRANGE_SRC_INV = 1 << 4, /* negate the condition */ + IPRANGE_DST_INV = 1 << 5, /* -"- */ +}; + +struct xt_iprange_mtinfo { + union nf_inet_addr src_min, src_max; + union nf_inet_addr dst_min, dst_max; + __u8 flags; +}; + +#endif /* _LINUX_NETFILTER_XT_IPRANGE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_length.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_length.h new file mode 100644 index 0000000..b82ed7c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_length.h @@ -0,0 +1,11 @@ +#ifndef _XT_LENGTH_H +#define _XT_LENGTH_H + +#include + +struct xt_length_info { + __u16 min, max; + __u8 invert; +}; + +#endif /*_XT_LENGTH_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_limit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_limit.h new file mode 100644 index 0000000..bb47fc4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_limit.h @@ -0,0 +1,24 @@ +#ifndef _XT_RATE_H +#define _XT_RATE_H + +#include + +/* timings are in milliseconds. */ +#define XT_LIMIT_SCALE 10000 + +struct xt_limit_priv; + +/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 + seconds, or one every 59 hours. */ +struct xt_rateinfo { + __u32 avg; /* Average secs between packets * scale */ + __u32 burst; /* Period multiplier for upper limit. */ + + /* Used internally by the kernel */ + unsigned long prev; /* moved to xt_limit_priv */ + __u32 credit; /* moved to xt_limit_priv */ + __u32 credit_cap, cost; + + struct xt_limit_priv *master; +}; +#endif /*_XT_RATE_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_mac.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_mac.h new file mode 100644 index 0000000..b892cdc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_mac.h @@ -0,0 +1,8 @@ +#ifndef _XT_MAC_H +#define _XT_MAC_H + +struct xt_mac_info { + unsigned char srcaddr[ETH_ALEN]; + int invert; +}; +#endif /*_XT_MAC_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_mark.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_mark.h new file mode 100644 index 0000000..6fa460a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_mark.h @@ -0,0 +1,16 @@ +#ifndef _XT_MARK_H +#define _XT_MARK_H + +#include + +struct xt_mark_info { + unsigned long mark, mask; + __u8 invert; +}; + +struct xt_mark_mtinfo1 { + __u32 mark, mask; + __u8 invert; +}; + +#endif /*_XT_MARK_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_multiport.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_multiport.h new file mode 100644 index 0000000..185db49 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_multiport.h @@ -0,0 +1,32 @@ +#ifndef _XT_MULTIPORT_H +#define _XT_MULTIPORT_H + +#include + +enum xt_multiport_flags +{ + XT_MULTIPORT_SOURCE, + XT_MULTIPORT_DESTINATION, + XT_MULTIPORT_EITHER +}; + +#define XT_MULTI_PORTS 15 + +/* Must fit inside union xt_matchinfo: 16 bytes */ +struct xt_multiport +{ + __u8 flags; /* Type of comparison */ + __u8 count; /* Number of ports */ + __u16 ports[XT_MULTI_PORTS]; /* Ports */ +}; + +struct xt_multiport_v1 +{ + __u8 flags; /* Type of comparison */ + __u8 count; /* Number of ports */ + __u16 ports[XT_MULTI_PORTS]; /* Ports */ + __u8 pflags[XT_MULTI_PORTS]; /* Port flags */ + __u8 invert; /* Invert flag */ +}; + +#endif /*_XT_MULTIPORT_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_owner.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_owner.h new file mode 100644 index 0000000..2081761 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_owner.h @@ -0,0 +1,18 @@ +#ifndef _XT_OWNER_MATCH_H +#define _XT_OWNER_MATCH_H + +#include + +enum { + XT_OWNER_UID = 1 << 0, + XT_OWNER_GID = 1 << 1, + XT_OWNER_SOCKET = 1 << 2, +}; + +struct xt_owner_match_info { + __u32 uid_min, uid_max; + __u32 gid_min, gid_max; + __u8 match, invert; +}; + +#endif /* _XT_OWNER_MATCH_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_physdev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_physdev.h new file mode 100644 index 0000000..7d53660 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_physdev.h @@ -0,0 +1,23 @@ +#ifndef _XT_PHYSDEV_H +#define _XT_PHYSDEV_H + +#include + + +#define XT_PHYSDEV_OP_IN 0x01 +#define XT_PHYSDEV_OP_OUT 0x02 +#define XT_PHYSDEV_OP_BRIDGED 0x04 +#define XT_PHYSDEV_OP_ISIN 0x08 +#define XT_PHYSDEV_OP_ISOUT 0x10 +#define XT_PHYSDEV_OP_MASK (0x20 - 1) + +struct xt_physdev_info { + char physindev[IFNAMSIZ]; + char in_mask[IFNAMSIZ]; + char physoutdev[IFNAMSIZ]; + char out_mask[IFNAMSIZ]; + __u8 invert; + __u8 bitmask; +}; + +#endif /*_XT_PHYSDEV_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_pkttype.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_pkttype.h new file mode 100644 index 0000000..f265cf5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_pkttype.h @@ -0,0 +1,8 @@ +#ifndef _XT_PKTTYPE_H +#define _XT_PKTTYPE_H + +struct xt_pkttype_info { + int pkttype; + int invert; +}; +#endif /*_XT_PKTTYPE_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_policy.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_policy.h new file mode 100644 index 0000000..f8a2690 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_policy.h @@ -0,0 +1,64 @@ +#ifndef _XT_POLICY_H +#define _XT_POLICY_H + +#include + +#define XT_POLICY_MAX_ELEM 4 + +enum xt_policy_flags +{ + XT_POLICY_MATCH_IN = 0x1, + XT_POLICY_MATCH_OUT = 0x2, + XT_POLICY_MATCH_NONE = 0x4, + XT_POLICY_MATCH_STRICT = 0x8, +}; + +enum xt_policy_modes +{ + XT_POLICY_MODE_TRANSPORT, + XT_POLICY_MODE_TUNNEL +}; + +struct xt_policy_spec +{ + __u8 saddr:1, + daddr:1, + proto:1, + mode:1, + spi:1, + reqid:1; +}; + +union xt_policy_addr +{ + struct in_addr a4; + struct in6_addr a6; +}; + +struct xt_policy_elem +{ + union { + struct { + union xt_policy_addr saddr; + union xt_policy_addr smask; + union xt_policy_addr daddr; + union xt_policy_addr dmask; + }; + }; + __be32 spi; + __u32 reqid; + __u8 proto; + __u8 mode; + + struct xt_policy_spec match; + struct xt_policy_spec invert; +}; + +struct xt_policy_info +{ + struct xt_policy_elem pol[XT_POLICY_MAX_ELEM]; + __u16 flags; + __u16 len; +}; + +#endif /* _XT_POLICY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_quota.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_quota.h new file mode 100644 index 0000000..8dc89df --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_quota.h @@ -0,0 +1,20 @@ +#ifndef _XT_QUOTA_H +#define _XT_QUOTA_H + +enum xt_quota_flags { + XT_QUOTA_INVERT = 0x1, +}; +#define XT_QUOTA_MASK 0x1 + +struct xt_quota_priv; + +struct xt_quota_info { + u_int32_t flags; + u_int32_t pad; + + /* Used internally by the kernel */ + aligned_u64 quota; + struct xt_quota_priv *master; +}; + +#endif /* _XT_QUOTA_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_rateest.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_rateest.h new file mode 100644 index 0000000..d40a619 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_rateest.h @@ -0,0 +1,37 @@ +#ifndef _XT_RATEEST_MATCH_H +#define _XT_RATEEST_MATCH_H + +#include + +enum xt_rateest_match_flags { + XT_RATEEST_MATCH_INVERT = 1<<0, + XT_RATEEST_MATCH_ABS = 1<<1, + XT_RATEEST_MATCH_REL = 1<<2, + XT_RATEEST_MATCH_DELTA = 1<<3, + XT_RATEEST_MATCH_BPS = 1<<4, + XT_RATEEST_MATCH_PPS = 1<<5, +}; + +enum xt_rateest_match_mode { + XT_RATEEST_MATCH_NONE, + XT_RATEEST_MATCH_EQ, + XT_RATEEST_MATCH_LT, + XT_RATEEST_MATCH_GT, +}; + +struct xt_rateest_match_info { + char name1[IFNAMSIZ]; + char name2[IFNAMSIZ]; + __u16 flags; + __u16 mode; + __u32 bps1; + __u32 pps1; + __u32 bps2; + __u32 pps2; + + /* Used internally by the kernel */ + struct xt_rateest *est1 __attribute__((aligned(8))); + struct xt_rateest *est2 __attribute__((aligned(8))); +}; + +#endif /* _XT_RATEEST_MATCH_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_realm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_realm.h new file mode 100644 index 0000000..d4a82ee --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_realm.h @@ -0,0 +1,12 @@ +#ifndef _XT_REALM_H +#define _XT_REALM_H + +#include + +struct xt_realm_info { + __u32 id; + __u32 mask; + __u8 invert; +}; + +#endif /* _XT_REALM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_recent.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_recent.h new file mode 100644 index 0000000..d2c2766 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_recent.h @@ -0,0 +1,28 @@ +#ifndef _LINUX_NETFILTER_XT_RECENT_H +#define _LINUX_NETFILTER_XT_RECENT_H 1 + +#include + +enum { + XT_RECENT_CHECK = 1 << 0, + XT_RECENT_SET = 1 << 1, + XT_RECENT_UPDATE = 1 << 2, + XT_RECENT_REMOVE = 1 << 3, + XT_RECENT_TTL = 1 << 4, + + XT_RECENT_SOURCE = 0, + XT_RECENT_DEST = 1, + + XT_RECENT_NAME_LEN = 200, +}; + +struct xt_recent_mtinfo { + __u32 seconds; + __u32 hit_count; + __u8 check_set; + __u8 invert; + char name[XT_RECENT_NAME_LEN]; + __u8 side; +}; + +#endif /* _LINUX_NETFILTER_XT_RECENT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_sctp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_sctp.h new file mode 100644 index 0000000..a501e61 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_sctp.h @@ -0,0 +1,92 @@ +#ifndef _XT_SCTP_H_ +#define _XT_SCTP_H_ + +#include + +#define XT_SCTP_SRC_PORTS 0x01 +#define XT_SCTP_DEST_PORTS 0x02 +#define XT_SCTP_CHUNK_TYPES 0x04 + +#define XT_SCTP_VALID_FLAGS 0x07 + +struct xt_sctp_flag_info { + __u8 chunktype; + __u8 flag; + __u8 flag_mask; +}; + +#define XT_NUM_SCTP_FLAGS 4 + +struct xt_sctp_info { + __u16 dpts[2]; /* Min, Max */ + __u16 spts[2]; /* Min, Max */ + + __u32 chunkmap[256 / sizeof (__u32)]; /* Bit mask of chunks to be matched according to RFC 2960 */ + +#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */ +#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */ +#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */ + + __u32 chunk_match_type; + struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS]; + int flag_count; + + __u32 flags; + __u32 invflags; +}; + +#define bytes(type) (sizeof(type) * 8) + +#define SCTP_CHUNKMAP_SET(chunkmap, type) \ + do { \ + (chunkmap)[type / bytes(__u32)] |= \ + 1 << (type % bytes(__u32)); \ + } while (0) + +#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ + do { \ + (chunkmap)[type / bytes(__u32)] &= \ + ~(1 << (type % bytes(__u32))); \ + } while (0) + +#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ +({ \ + ((chunkmap)[type / bytes (__u32)] & \ + (1 << (type % bytes (__u32)))) ? 1: 0; \ +}) + +#define SCTP_CHUNKMAP_RESET(chunkmap) \ + memset((chunkmap), 0, sizeof(chunkmap)) + +#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ + memset((chunkmap), ~0U, sizeof(chunkmap)) + +#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ + memcpy((destmap), (srcmap), sizeof(srcmap)) + +#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ + __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap)) +static __inline__ bool +__sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n) +{ + unsigned int i; + for (i = 0; i < n; ++i) + if (chunkmap[i]) + return false; + return true; +} + +#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ + __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap)) +static __inline__ bool +__sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n) +{ + unsigned int i; + for (i = 0; i < n; ++i) + if (chunkmap[i] != ~0U) + return false; + return true; +} + +#endif /* _XT_SCTP_H_ */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_state.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_state.h new file mode 100644 index 0000000..c06f32e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_state.h @@ -0,0 +1,13 @@ +#ifndef _XT_STATE_H +#define _XT_STATE_H + +#define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) +#define XT_STATE_INVALID (1 << 0) + +#define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) + +struct xt_state_info +{ + unsigned int statemask; +}; +#endif /*_XT_STATE_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_statistic.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_statistic.h new file mode 100644 index 0000000..4e983ef --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_statistic.h @@ -0,0 +1,36 @@ +#ifndef _XT_STATISTIC_H +#define _XT_STATISTIC_H + +#include + +enum xt_statistic_mode { + XT_STATISTIC_MODE_RANDOM, + XT_STATISTIC_MODE_NTH, + __XT_STATISTIC_MODE_MAX +}; +#define XT_STATISTIC_MODE_MAX (__XT_STATISTIC_MODE_MAX - 1) + +enum xt_statistic_flags { + XT_STATISTIC_INVERT = 0x1, +}; +#define XT_STATISTIC_MASK 0x1 + +struct xt_statistic_priv; + +struct xt_statistic_info { + __u16 mode; + __u16 flags; + union { + struct { + __u32 probability; + } random; + struct { + __u32 every; + __u32 packet; + __u32 count; /* unused */ + } nth; + } u; + struct xt_statistic_priv *master __attribute__((aligned(8))); +}; + +#endif /* _XT_STATISTIC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_string.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_string.h new file mode 100644 index 0000000..ecbb95f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_string.h @@ -0,0 +1,35 @@ +#ifndef _XT_STRING_H +#define _XT_STRING_H + +#include + +#define XT_STRING_MAX_PATTERN_SIZE 128 +#define XT_STRING_MAX_ALGO_NAME_SIZE 16 + +enum { + XT_STRING_FLAG_INVERT = 0x01, + XT_STRING_FLAG_IGNORECASE = 0x02 +}; + +struct xt_string_info +{ + __u16 from_offset; + __u16 to_offset; + char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; + char pattern[XT_STRING_MAX_PATTERN_SIZE]; + __u8 patlen; + union { + struct { + __u8 invert; + } v0; + + struct { + __u8 flags; + } v1; + } u; + + /* Used internally by the kernel */ + struct ts_config __attribute__((aligned(8))) *config; +}; + +#endif /*_XT_STRING_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_tcpmss.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_tcpmss.h new file mode 100644 index 0000000..fbac56b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_tcpmss.h @@ -0,0 +1,11 @@ +#ifndef _XT_TCPMSS_MATCH_H +#define _XT_TCPMSS_MATCH_H + +#include + +struct xt_tcpmss_match_info { + __u16 mss_min, mss_max; + __u8 invert; +}; + +#endif /*_XT_TCPMSS_MATCH_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_tcpudp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_tcpudp.h new file mode 100644 index 0000000..a490a0b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_tcpudp.h @@ -0,0 +1,38 @@ +#ifndef _XT_TCPUDP_H +#define _XT_TCPUDP_H + +#include + +/* TCP matching stuff */ +struct xt_tcp +{ + __u16 spts[2]; /* Source port range. */ + __u16 dpts[2]; /* Destination port range. */ + __u8 option; /* TCP Option iff non-zero*/ + __u8 flg_mask; /* TCP flags mask byte */ + __u8 flg_cmp; /* TCP flags compare byte */ + __u8 invflags; /* Inverse flags */ +}; + +/* Values for "inv" field in struct ipt_tcp. */ +#define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ +#define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ +#define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ +#define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ +#define XT_TCP_INV_MASK 0x0F /* All possible flags. */ + +/* UDP matching stuff */ +struct xt_udp +{ + __u16 spts[2]; /* Source port range. */ + __u16 dpts[2]; /* Destination port range. */ + __u8 invflags; /* Inverse flags */ +}; + +/* Values for "invflags" field in struct ipt_udp. */ +#define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ +#define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ +#define XT_UDP_INV_MASK 0x03 /* All possible flags. */ + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_time.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_time.h new file mode 100644 index 0000000..14b6df4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_time.h @@ -0,0 +1,25 @@ +#ifndef _XT_TIME_H +#define _XT_TIME_H 1 + +struct xt_time_info { + u_int32_t date_start; + u_int32_t date_stop; + u_int32_t daytime_start; + u_int32_t daytime_stop; + u_int32_t monthdays_match; + u_int8_t weekdays_match; + u_int8_t flags; +}; + +enum { + /* Match against local time (instead of UTC) */ + XT_TIME_LOCAL_TZ = 1 << 0, + + /* Shortcuts */ + XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE, + XT_TIME_ALL_WEEKDAYS = 0xFE, + XT_TIME_MIN_DAYTIME = 0, + XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1, +}; + +#endif /* _XT_TIME_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_u32.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_u32.h new file mode 100644 index 0000000..9947f56 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter/xt_u32.h @@ -0,0 +1,40 @@ +#ifndef _XT_U32_H +#define _XT_U32_H 1 + +enum xt_u32_ops { + XT_U32_AND, + XT_U32_LEFTSH, + XT_U32_RIGHTSH, + XT_U32_AT, +}; + +struct xt_u32_location_element { + u_int32_t number; + u_int8_t nextop; +}; + +struct xt_u32_value_element { + u_int32_t min; + u_int32_t max; +}; + +/* + * Any way to allow for an arbitrary number of elements? + * For now, I settle with a limit of 10 each. + */ +#define XT_U32_MAXSIZE 10 + +struct xt_u32_test { + struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; + struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; + u_int8_t nnums; + u_int8_t nvalues; +}; + +struct xt_u32 { + struct xt_u32_test tests[XT_U32_MAXSIZE+1]; + u_int8_t ntests; + u_int8_t invert; +}; + +#endif /* _XT_U32_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp.h new file mode 100644 index 0000000..92bc6dd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp.h @@ -0,0 +1,19 @@ +#ifndef __LINUX_ARP_NETFILTER_H +#define __LINUX_ARP_NETFILTER_H + +/* ARP-specific defines for netfilter. + * (C)2002 Rusty Russell IBM -- This code is GPL. + */ + +#include + +/* There is no PF_ARP. */ +#define NF_ARP 0 + +/* ARP Hooks */ +#define NF_ARP_IN 0 +#define NF_ARP_OUT 1 +#define NF_ARP_FORWARD 2 +#define NF_ARP_NUMHOOKS 3 + +#endif /* __LINUX_ARP_NETFILTER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/..install.cmd new file mode 100644 index 0000000..c21c55b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_arp/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter_arp /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_arp mips arp_tables.h arpt_mangle.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter_arp /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_arp mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_arp/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/arp_tables.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/arp_tables.h new file mode 100644 index 0000000..16ae7c3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/arp_tables.h @@ -0,0 +1,218 @@ +/* + * Format of an ARP firewall descriptor + * + * src, tgt, src_mask, tgt_mask, arpop, arpop_mask are always stored in + * network byte order. + * flags are stored in host byte order (of course). + */ + +#ifndef _ARPTABLES_H +#define _ARPTABLES_H + +#include + +#include + +#include + +#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN +#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN + +#define ARPT_DEV_ADDR_LEN_MAX 16 + +struct arpt_devaddr_info { + char addr[ARPT_DEV_ADDR_LEN_MAX]; + char mask[ARPT_DEV_ADDR_LEN_MAX]; +}; + +/* Yes, Virginia, you have to zero the padding. */ +struct arpt_arp { + /* Source and target IP addr */ + struct in_addr src, tgt; + /* Mask for src and target IP addr */ + struct in_addr smsk, tmsk; + + /* Device hw address length, src+target device addresses */ + u_int8_t arhln, arhln_mask; + struct arpt_devaddr_info src_devaddr; + struct arpt_devaddr_info tgt_devaddr; + + /* ARP operation code. */ + __be16 arpop, arpop_mask; + + /* ARP hardware address and protocol address format. */ + __be16 arhrd, arhrd_mask; + __be16 arpro, arpro_mask; + + /* The protocol address length is only accepted if it is 4 + * so there is no use in offering a way to do filtering on it. + */ + + char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; + unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; + + /* Flags word */ + u_int8_t flags; + /* Inverse flags */ + u_int16_t invflags; +}; + +#define arpt_entry_target xt_entry_target +#define arpt_standard_target xt_standard_target + +/* Values for "flag" field in struct arpt_ip (general arp structure). + * No flags defined yet. + */ +#define ARPT_F_MASK 0x00 /* All possible flag bits mask. */ + +/* Values for "inv" field in struct arpt_arp. */ +#define ARPT_INV_VIA_IN 0x0001 /* Invert the sense of IN IFACE. */ +#define ARPT_INV_VIA_OUT 0x0002 /* Invert the sense of OUT IFACE */ +#define ARPT_INV_SRCIP 0x0004 /* Invert the sense of SRC IP. */ +#define ARPT_INV_TGTIP 0x0008 /* Invert the sense of TGT IP. */ +#define ARPT_INV_SRCDEVADDR 0x0010 /* Invert the sense of SRC DEV ADDR. */ +#define ARPT_INV_TGTDEVADDR 0x0020 /* Invert the sense of TGT DEV ADDR. */ +#define ARPT_INV_ARPOP 0x0040 /* Invert the sense of ARP OP. */ +#define ARPT_INV_ARPHRD 0x0080 /* Invert the sense of ARP HRD. */ +#define ARPT_INV_ARPPRO 0x0100 /* Invert the sense of ARP PRO. */ +#define ARPT_INV_ARPHLN 0x0200 /* Invert the sense of ARP HLN. */ +#define ARPT_INV_MASK 0x03FF /* All possible flag bits mask. */ + +/* This structure defines each of the firewall rules. Consists of 3 + parts which are 1) general ARP header stuff 2) match specific + stuff 3) the target to perform if the rule matches */ +struct arpt_entry +{ + struct arpt_arp arp; + + /* Size of arpt_entry + matches */ + u_int16_t target_offset; + /* Size of arpt_entry + matches + target */ + u_int16_t next_offset; + + /* Back pointer */ + unsigned int comefrom; + + /* Packet and byte counters. */ + struct xt_counters counters; + + /* The matches (if any), then the target. */ + unsigned char elems[0]; +}; + +/* + * New IP firewall options for [gs]etsockopt at the RAW IP level. + * Unlike BSD Linux inherits IP options so you don't have to use a raw + * socket for this. Instead we check rights in the calls. + * + * ATTENTION: check linux/in.h before adding new number here. + */ +#define ARPT_BASE_CTL 96 + +#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) +#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1) +#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS + +#define ARPT_SO_GET_INFO (ARPT_BASE_CTL) +#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) +/* #define ARPT_SO_GET_REVISION_MATCH (APRT_BASE_CTL + 2) */ +#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3) +#define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET) + +/* CONTINUE verdict for targets */ +#define ARPT_CONTINUE XT_CONTINUE + +/* For standard target */ +#define ARPT_RETURN XT_RETURN + +/* The argument to ARPT_SO_GET_INFO */ +struct arpt_getinfo +{ + /* Which table: caller fills this in. */ + char name[ARPT_TABLE_MAXNAMELEN]; + + /* Kernel fills these in. */ + /* Which hook entry points are valid: bitmask */ + unsigned int valid_hooks; + + /* Hook entry points: one per netfilter hook. */ + unsigned int hook_entry[NF_ARP_NUMHOOKS]; + + /* Underflow points. */ + unsigned int underflow[NF_ARP_NUMHOOKS]; + + /* Number of entries */ + unsigned int num_entries; + + /* Size of entries. */ + unsigned int size; +}; + +/* The argument to ARPT_SO_SET_REPLACE. */ +struct arpt_replace +{ + /* Which table. */ + char name[ARPT_TABLE_MAXNAMELEN]; + + /* Which hook entry points are valid: bitmask. You can't + change this. */ + unsigned int valid_hooks; + + /* Number of entries */ + unsigned int num_entries; + + /* Total size of new entries */ + unsigned int size; + + /* Hook entry points. */ + unsigned int hook_entry[NF_ARP_NUMHOOKS]; + + /* Underflow points. */ + unsigned int underflow[NF_ARP_NUMHOOKS]; + + /* Information about old entries: */ + /* Number of counters (must be equal to current number of entries). */ + unsigned int num_counters; + /* The old entries' counters. */ + struct xt_counters *counters; + + /* The entries (hang off end: not really an array). */ + struct arpt_entry entries[0]; +}; + +/* The argument to ARPT_SO_ADD_COUNTERS. */ +#define arpt_counters_info xt_counters_info +#define arpt_counters xt_counters + +/* The argument to ARPT_SO_GET_ENTRIES. */ +struct arpt_get_entries +{ + /* Which table: user fills this in. */ + char name[ARPT_TABLE_MAXNAMELEN]; + + /* User fills this in: total entry size. */ + unsigned int size; + + /* The entries. */ + struct arpt_entry entrytable[0]; +}; + +/* Standard return verdict, or do jump. */ +#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET +/* Error verdict. */ +#define ARPT_ERROR_TARGET XT_ERROR_TARGET + +/* Helper functions */ +static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e) +{ + return (void *)e + e->target_offset; +} + +/* fn returns 0 to continue iteration */ +#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ + XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) + +/* + * Main firewall chains definitions and global var's definitions. + */ +#endif /* _ARPTABLES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/arpt_mangle.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/arpt_mangle.h new file mode 100644 index 0000000..250f502 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_arp/arpt_mangle.h @@ -0,0 +1,26 @@ +#ifndef _ARPT_MANGLE_H +#define _ARPT_MANGLE_H +#include + +#define ARPT_MANGLE_ADDR_LEN_MAX sizeof(struct in_addr) +struct arpt_mangle +{ + char src_devaddr[ARPT_DEV_ADDR_LEN_MAX]; + char tgt_devaddr[ARPT_DEV_ADDR_LEN_MAX]; + union { + struct in_addr src_ip; + } u_s; + union { + struct in_addr tgt_ip; + } u_t; + u_int8_t flags; + int target; +}; + +#define ARPT_MANGLE_SDEV 0x01 +#define ARPT_MANGLE_TDEV 0x02 +#define ARPT_MANGLE_SIP 0x04 +#define ARPT_MANGLE_TIP 0x08 +#define ARPT_MANGLE_MASK 0x0f + +#endif /* _ARPT_MANGLE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge.h new file mode 100644 index 0000000..5094ecc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge.h @@ -0,0 +1,27 @@ +#ifndef __LINUX_BRIDGE_NETFILTER_H +#define __LINUX_BRIDGE_NETFILTER_H + +/* bridge-specific defines for netfilter. + */ + +#include +#include +#include +#include + +/* Bridge Hooks */ +/* After promisc drops, checksum checks. */ +#define NF_BR_PRE_ROUTING 0 +/* If the packet is destined for this box. */ +#define NF_BR_LOCAL_IN 1 +/* If the packet is destined for another interface. */ +#define NF_BR_FORWARD 2 +/* Packets coming from a local process. */ +#define NF_BR_LOCAL_OUT 3 +/* Packets about to hit the wire. */ +#define NF_BR_POST_ROUTING 4 +/* Not really a hook, but used for the ebtables broute table */ +#define NF_BR_BROUTING 5 +#define NF_BR_NUMHOOKS 6 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/..install.cmd new file mode 100644 index 0000000..70e7f9e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_bridge/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter_bridge /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_bridge mips ebt_802_3.h ebt_among.h ebt_arp.h ebt_arpreply.h ebt_ip.h ebt_limit.h ebt_log.h ebt_mark_m.h ebt_mark_t.h ebt_nat.h ebt_pkttype.h ebt_redirect.h ebt_stp.h ebt_ulog.h ebt_vlan.h ebtables.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter_bridge /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_bridge mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_bridge/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_802_3.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_802_3.h new file mode 100644 index 0000000..b61e308 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_802_3.h @@ -0,0 +1,61 @@ +#ifndef __LINUX_BRIDGE_EBT_802_3_H +#define __LINUX_BRIDGE_EBT_802_3_H + +#define EBT_802_3_SAP 0x01 +#define EBT_802_3_TYPE 0x02 + +#define EBT_802_3_MATCH "802_3" + +/* + * If frame has DSAP/SSAP value 0xaa you must check the SNAP type + * to discover what kind of packet we're carrying. + */ +#define CHECK_TYPE 0xaa + +/* + * Control field may be one or two bytes. If the first byte has + * the value 0x03 then the entire length is one byte, otherwise it is two. + * One byte controls are used in Unnumbered Information frames. + * Two byte controls are used in Numbered Information frames. + */ +#define IS_UI 0x03 + +#define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3) + +/* ui has one byte ctrl, ni has two */ +struct hdr_ui { + uint8_t dsap; + uint8_t ssap; + uint8_t ctrl; + uint8_t orig[3]; + __be16 type; +}; + +struct hdr_ni { + uint8_t dsap; + uint8_t ssap; + __be16 ctrl; + uint8_t orig[3]; + __be16 type; +}; + +struct ebt_802_3_hdr { + uint8_t daddr[6]; + uint8_t saddr[6]; + __be16 len; + union { + struct hdr_ui ui; + struct hdr_ni ni; + } llc; +}; + + +struct ebt_802_3_info +{ + uint8_t sap; + __be16 type; + uint8_t bitmask; + uint8_t invflags; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_among.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_among.h new file mode 100644 index 0000000..7654069 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_among.h @@ -0,0 +1,65 @@ +#ifndef __LINUX_BRIDGE_EBT_AMONG_H +#define __LINUX_BRIDGE_EBT_AMONG_H + +#define EBT_AMONG_DST 0x01 +#define EBT_AMONG_SRC 0x02 + +/* Grzegorz Borowiak 2003 + * + * Write-once-read-many hash table, used for checking if a given + * MAC address belongs to a set or not and possibly for checking + * if it is related with a given IPv4 address. + * + * The hash value of an address is its last byte. + * + * In real-world ethernet addresses, values of the last byte are + * evenly distributed and there is no need to consider other bytes. + * It would only slow the routines down. + * + * For MAC address comparison speedup reasons, we introduce a trick. + * MAC address is mapped onto an array of two 32-bit integers. + * This pair of integers is compared with MAC addresses in the + * hash table, which are stored also in form of pairs of integers + * (in `cmp' array). This is quick as it requires only two elementary + * number comparisons in worst case. Further, we take advantage of + * fact that entropy of 3 last bytes of address is larger than entropy + * of 3 first bytes. So first we compare 4 last bytes of addresses and + * if they are the same we compare 2 first. + * + * Yes, it is a memory overhead, but in 2003 AD, who cares? + */ + +struct ebt_mac_wormhash_tuple +{ + uint32_t cmp[2]; + __be32 ip; +}; + +struct ebt_mac_wormhash +{ + int table[257]; + int poolsize; + struct ebt_mac_wormhash_tuple pool[0]; +}; + +#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \ + + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) + +struct ebt_among_info +{ + int wh_dst_ofs; + int wh_src_ofs; + int bitmask; +}; + +#define EBT_AMONG_DST_NEG 0x1 +#define EBT_AMONG_SRC_NEG 0x2 + +#define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \ + (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL) +#define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \ + (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL) + +#define EBT_AMONG_MATCH "among" + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_arp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_arp.h new file mode 100644 index 0000000..cbf4843 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_arp.h @@ -0,0 +1,34 @@ +#ifndef __LINUX_BRIDGE_EBT_ARP_H +#define __LINUX_BRIDGE_EBT_ARP_H + +#define EBT_ARP_OPCODE 0x01 +#define EBT_ARP_HTYPE 0x02 +#define EBT_ARP_PTYPE 0x04 +#define EBT_ARP_SRC_IP 0x08 +#define EBT_ARP_DST_IP 0x10 +#define EBT_ARP_SRC_MAC 0x20 +#define EBT_ARP_DST_MAC 0x40 +#define EBT_ARP_GRAT 0x80 +#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ + EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \ + EBT_ARP_GRAT) +#define EBT_ARP_MATCH "arp" + +struct ebt_arp_info +{ + __be16 htype; + __be16 ptype; + __be16 opcode; + __be32 saddr; + __be32 smsk; + __be32 daddr; + __be32 dmsk; + unsigned char smaddr[ETH_ALEN]; + unsigned char smmsk[ETH_ALEN]; + unsigned char dmaddr[ETH_ALEN]; + unsigned char dmmsk[ETH_ALEN]; + uint8_t bitmask; + uint8_t invflags; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_arpreply.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_arpreply.h new file mode 100644 index 0000000..96a8339 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_arpreply.h @@ -0,0 +1,11 @@ +#ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H +#define __LINUX_BRIDGE_EBT_ARPREPLY_H + +struct ebt_arpreply_info +{ + unsigned char mac[ETH_ALEN]; + int target; +}; +#define EBT_ARPREPLY_TARGET "arpreply" + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_ip.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_ip.h new file mode 100644 index 0000000..d684747 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_ip.h @@ -0,0 +1,43 @@ +/* + * ebt_ip + * + * Authors: + * Bart De Schuymer + * + * April, 2002 + * + * Changes: + * added ip-sport and ip-dport + * Innominate Security Technologies AG + * September, 2002 + */ + +#ifndef __LINUX_BRIDGE_EBT_IP_H +#define __LINUX_BRIDGE_EBT_IP_H + +#define EBT_IP_SOURCE 0x01 +#define EBT_IP_DEST 0x02 +#define EBT_IP_TOS 0x04 +#define EBT_IP_PROTO 0x08 +#define EBT_IP_SPORT 0x10 +#define EBT_IP_DPORT 0x20 +#define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\ + EBT_IP_SPORT | EBT_IP_DPORT ) +#define EBT_IP_MATCH "ip" + +/* the same values are used for the invflags */ +struct ebt_ip_info +{ + __be32 saddr; + __be32 daddr; + __be32 smsk; + __be32 dmsk; + uint8_t tos; + uint8_t protocol; + uint8_t bitmask; + uint8_t invflags; + uint16_t sport[2]; + uint16_t dport[2]; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_limit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_limit.h new file mode 100644 index 0000000..d8b6500 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_limit.h @@ -0,0 +1,23 @@ +#ifndef __LINUX_BRIDGE_EBT_LIMIT_H +#define __LINUX_BRIDGE_EBT_LIMIT_H + +#define EBT_LIMIT_MATCH "limit" + +/* timings are in milliseconds. */ +#define EBT_LIMIT_SCALE 10000 + +/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 + seconds, or one every 59 hours. */ + +struct ebt_limit_info +{ + u_int32_t avg; /* Average secs between packets * scale */ + u_int32_t burst; /* Period multiplier for upper limit. */ + + /* Used internally by the kernel */ + unsigned long prev; + u_int32_t credit; + u_int32_t credit_cap, cost; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_log.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_log.h new file mode 100644 index 0000000..b76e653 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_log.h @@ -0,0 +1,19 @@ +#ifndef __LINUX_BRIDGE_EBT_LOG_H +#define __LINUX_BRIDGE_EBT_LOG_H + +#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ +#define EBT_LOG_ARP 0x02 +#define EBT_LOG_NFLOG 0x04 +#define EBT_LOG_IP6 0x08 +#define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP | EBT_LOG_IP6) +#define EBT_LOG_PREFIX_SIZE 30 +#define EBT_LOG_WATCHER "log" + +struct ebt_log_info +{ + uint8_t loglevel; + uint8_t prefix[EBT_LOG_PREFIX_SIZE]; + uint32_t bitmask; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_mark_m.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_mark_m.h new file mode 100644 index 0000000..301524f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_mark_m.h @@ -0,0 +1,15 @@ +#ifndef __LINUX_BRIDGE_EBT_MARK_M_H +#define __LINUX_BRIDGE_EBT_MARK_M_H + +#define EBT_MARK_AND 0x01 +#define EBT_MARK_OR 0x02 +#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) +struct ebt_mark_m_info +{ + unsigned long mark, mask; + uint8_t invert; + uint8_t bitmask; +}; +#define EBT_MARK_MATCH "mark_m" + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_mark_t.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_mark_t.h new file mode 100644 index 0000000..6270f6f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_mark_t.h @@ -0,0 +1,24 @@ +#ifndef __LINUX_BRIDGE_EBT_MARK_T_H +#define __LINUX_BRIDGE_EBT_MARK_T_H + +/* The target member is reused for adding new actions, the + * value of the real target is -1 to -NUM_STANDARD_TARGETS. + * For backward compatibility, the 4 lsb (2 would be enough, + * but let's play it safe) are kept to designate this target. + * The remaining bits designate the action. By making the set + * action 0xfffffff0, the result will look ok for older + * versions. [September 2006] */ +#define MARK_SET_VALUE (0xfffffff0) +#define MARK_OR_VALUE (0xffffffe0) +#define MARK_AND_VALUE (0xffffffd0) +#define MARK_XOR_VALUE (0xffffffc0) + +struct ebt_mark_t_info +{ + unsigned long mark; + /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ + int target; +}; +#define EBT_MARK_TARGET "mark" + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_nat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_nat.h new file mode 100644 index 0000000..435b886 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_nat.h @@ -0,0 +1,14 @@ +#ifndef __LINUX_BRIDGE_EBT_NAT_H +#define __LINUX_BRIDGE_EBT_NAT_H + +#define NAT_ARP_BIT (0x00000010) +struct ebt_nat_info +{ + unsigned char mac[ETH_ALEN]; + /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ + int target; +}; +#define EBT_SNAT_TARGET "snat" +#define EBT_DNAT_TARGET "dnat" + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_pkttype.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_pkttype.h new file mode 100644 index 0000000..0d64bbb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_pkttype.h @@ -0,0 +1,11 @@ +#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H +#define __LINUX_BRIDGE_EBT_PKTTYPE_H + +struct ebt_pkttype_info +{ + uint8_t pkt_type; + uint8_t invert; +}; +#define EBT_PKTTYPE_MATCH "pkttype" + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_redirect.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_redirect.h new file mode 100644 index 0000000..5c67990 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_redirect.h @@ -0,0 +1,11 @@ +#ifndef __LINUX_BRIDGE_EBT_REDIRECT_H +#define __LINUX_BRIDGE_EBT_REDIRECT_H + +struct ebt_redirect_info +{ + /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ + int target; +}; +#define EBT_REDIRECT_TARGET "redirect" + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_stp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_stp.h new file mode 100644 index 0000000..e5fd678 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_stp.h @@ -0,0 +1,46 @@ +#ifndef __LINUX_BRIDGE_EBT_STP_H +#define __LINUX_BRIDGE_EBT_STP_H + +#define EBT_STP_TYPE 0x0001 + +#define EBT_STP_FLAGS 0x0002 +#define EBT_STP_ROOTPRIO 0x0004 +#define EBT_STP_ROOTADDR 0x0008 +#define EBT_STP_ROOTCOST 0x0010 +#define EBT_STP_SENDERPRIO 0x0020 +#define EBT_STP_SENDERADDR 0x0040 +#define EBT_STP_PORT 0x0080 +#define EBT_STP_MSGAGE 0x0100 +#define EBT_STP_MAXAGE 0x0200 +#define EBT_STP_HELLOTIME 0x0400 +#define EBT_STP_FWDD 0x0800 + +#define EBT_STP_MASK 0x0fff +#define EBT_STP_CONFIG_MASK 0x0ffe + +#define EBT_STP_MATCH "stp" + +struct ebt_stp_config_info +{ + uint8_t flags; + uint16_t root_priol, root_priou; + char root_addr[6], root_addrmsk[6]; + uint32_t root_costl, root_costu; + uint16_t sender_priol, sender_priou; + char sender_addr[6], sender_addrmsk[6]; + uint16_t portl, portu; + uint16_t msg_agel, msg_ageu; + uint16_t max_agel, max_ageu; + uint16_t hello_timel, hello_timeu; + uint16_t forward_delayl, forward_delayu; +}; + +struct ebt_stp_info +{ + uint8_t type; + struct ebt_stp_config_info config; + uint16_t bitmask; + uint16_t invflags; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_ulog.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_ulog.h new file mode 100644 index 0000000..b677e26 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_ulog.h @@ -0,0 +1,36 @@ +#ifndef _EBT_ULOG_H +#define _EBT_ULOG_H + +#define EBT_ULOG_DEFAULT_NLGROUP 0 +#define EBT_ULOG_DEFAULT_QTHRESHOLD 1 +#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */ +#define EBT_ULOG_PREFIX_LEN 32 +#define EBT_ULOG_MAX_QLEN 50 +#define EBT_ULOG_WATCHER "ulog" +#define EBT_ULOG_VERSION 1 + +struct ebt_ulog_info { + uint32_t nlgroup; + unsigned int cprange; + unsigned int qthreshold; + char prefix[EBT_ULOG_PREFIX_LEN]; +}; + +typedef struct ebt_ulog_packet_msg { + int version; + char indev[IFNAMSIZ]; + char outdev[IFNAMSIZ]; + char physindev[IFNAMSIZ]; + char physoutdev[IFNAMSIZ]; + char prefix[EBT_ULOG_PREFIX_LEN]; + struct timeval stamp; + unsigned long mark; + unsigned int hook; + size_t data_len; + /* The complete packet, including Ethernet header and perhaps + * the VLAN header is appended */ + unsigned char data[0] __attribute__ + ((aligned (__alignof__(struct ebt_ulog_info)))); +} ebt_ulog_packet_msg_t; + +#endif /* _EBT_ULOG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_vlan.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_vlan.h new file mode 100644 index 0000000..1d98be4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebt_vlan.h @@ -0,0 +1,20 @@ +#ifndef __LINUX_BRIDGE_EBT_VLAN_H +#define __LINUX_BRIDGE_EBT_VLAN_H + +#define EBT_VLAN_ID 0x01 +#define EBT_VLAN_PRIO 0x02 +#define EBT_VLAN_ENCAP 0x04 +#define EBT_VLAN_MASK (EBT_VLAN_ID | EBT_VLAN_PRIO | EBT_VLAN_ENCAP) +#define EBT_VLAN_MATCH "vlan" + +struct ebt_vlan_info { + uint16_t id; /* VLAN ID {1-4095} */ + uint8_t prio; /* VLAN User Priority {0-7} */ + __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ + uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, + bit 2=1 User-Priority arg, bit 3=1 encap*/ + uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, + bit 2=1 - inversed Pirority arg */ +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebtables.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebtables.h new file mode 100644 index 0000000..1272888 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_bridge/ebtables.h @@ -0,0 +1,275 @@ +/* + * ebtables + * + * Authors: + * Bart De Schuymer + * + * ebtables.c,v 2.0, April, 2002 + * + * This code is stongly inspired on the iptables code which is + * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling + */ + +#ifndef __LINUX_BRIDGE_EFF_H +#define __LINUX_BRIDGE_EFF_H +#include +#include +#include + +#define EBT_TABLE_MAXNAMELEN 32 +#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN +#define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN + +/* verdicts >0 are "branches" */ +#define EBT_ACCEPT -1 +#define EBT_DROP -2 +#define EBT_CONTINUE -3 +#define EBT_RETURN -4 +#define NUM_STANDARD_TARGETS 4 +/* ebtables target modules store the verdict inside an int. We can + * reclaim a part of this int for backwards compatible extensions. + * The 4 lsb are more than enough to store the verdict. */ +#define EBT_VERDICT_BITS 0x0000000F + +struct xt_match; +struct xt_target; + +struct ebt_counter +{ + uint64_t pcnt; + uint64_t bcnt; +}; + +struct ebt_replace +{ + char name[EBT_TABLE_MAXNAMELEN]; + unsigned int valid_hooks; + /* nr of rules in the table */ + unsigned int nentries; + /* total size of the entries */ + unsigned int entries_size; + /* start of the chains */ + struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; + /* nr of counters userspace expects back */ + unsigned int num_counters; + /* where the kernel will put the old counters */ + struct ebt_counter *counters; + char *entries; +}; + +struct ebt_replace_kernel +{ + char name[EBT_TABLE_MAXNAMELEN]; + unsigned int valid_hooks; + /* nr of rules in the table */ + unsigned int nentries; + /* total size of the entries */ + unsigned int entries_size; + /* start of the chains */ + struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; + /* nr of counters userspace expects back */ + unsigned int num_counters; + /* where the kernel will put the old counters */ + struct ebt_counter *counters; + char *entries; +}; + +struct ebt_entries { + /* this field is always set to zero + * See EBT_ENTRY_OR_ENTRIES. + * Must be same size as ebt_entry.bitmask */ + unsigned int distinguisher; + /* the chain name */ + char name[EBT_CHAIN_MAXNAMELEN]; + /* counter offset for this chain */ + unsigned int counter_offset; + /* one standard (accept, drop, return) per hook */ + int policy; + /* nr. of entries */ + unsigned int nentries; + /* entry list */ + char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); +}; + +/* used for the bitmask of struct ebt_entry */ + +/* This is a hack to make a difference between an ebt_entry struct and an + * ebt_entries struct when traversing the entries from start to end. + * Using this simplifies the code alot, while still being able to use + * ebt_entries. + * Contrary, iptables doesn't use something like ebt_entries and therefore uses + * different techniques for naming the policy and such. So, iptables doesn't + * need a hack like this. + */ +#define EBT_ENTRY_OR_ENTRIES 0x01 +/* these are the normal masks */ +#define EBT_NOPROTO 0x02 +#define EBT_802_3 0x04 +#define EBT_SOURCEMAC 0x08 +#define EBT_DESTMAC 0x10 +#define EBT_F_MASK (EBT_NOPROTO | EBT_802_3 | EBT_SOURCEMAC | EBT_DESTMAC \ + | EBT_ENTRY_OR_ENTRIES) + +#define EBT_IPROTO 0x01 +#define EBT_IIN 0x02 +#define EBT_IOUT 0x04 +#define EBT_ISOURCE 0x8 +#define EBT_IDEST 0x10 +#define EBT_ILOGICALIN 0x20 +#define EBT_ILOGICALOUT 0x40 +#define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \ + | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST) + +struct ebt_entry_match +{ + union { + char name[EBT_FUNCTION_MAXNAMELEN]; + struct xt_match *match; + } u; + /* size of data */ + unsigned int match_size; + unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); +}; + +struct ebt_entry_watcher +{ + union { + char name[EBT_FUNCTION_MAXNAMELEN]; + struct xt_target *watcher; + } u; + /* size of data */ + unsigned int watcher_size; + unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); +}; + +struct ebt_entry_target +{ + union { + char name[EBT_FUNCTION_MAXNAMELEN]; + struct xt_target *target; + } u; + /* size of data */ + unsigned int target_size; + unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); +}; + +#define EBT_STANDARD_TARGET "standard" +struct ebt_standard_target +{ + struct ebt_entry_target target; + int verdict; +}; + +/* one entry */ +struct ebt_entry { + /* this needs to be the first field */ + unsigned int bitmask; + unsigned int invflags; + __be16 ethproto; + /* the physical in-dev */ + char in[IFNAMSIZ]; + /* the logical in-dev */ + char logical_in[IFNAMSIZ]; + /* the physical out-dev */ + char out[IFNAMSIZ]; + /* the logical out-dev */ + char logical_out[IFNAMSIZ]; + unsigned char sourcemac[ETH_ALEN]; + unsigned char sourcemsk[ETH_ALEN]; + unsigned char destmac[ETH_ALEN]; + unsigned char destmsk[ETH_ALEN]; + /* sizeof ebt_entry + matches */ + unsigned int watchers_offset; + /* sizeof ebt_entry + matches + watchers */ + unsigned int target_offset; + /* sizeof ebt_entry + matches + watchers + target */ + unsigned int next_offset; + unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); +}; + +/* {g,s}etsockopt numbers */ +#define EBT_BASE_CTL 128 + +#define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) +#define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES+1) +#define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS+1) + +#define EBT_SO_GET_INFO (EBT_BASE_CTL) +#define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO+1) +#define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES+1) +#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1) +#define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1) + + +/* blatently stolen from ip_tables.h + * fn returns 0 to continue iteration */ +#define EBT_MATCH_ITERATE(e, fn, args...) \ +({ \ + unsigned int __i; \ + int __ret = 0; \ + struct ebt_entry_match *__match; \ + \ + for (__i = sizeof(struct ebt_entry); \ + __i < (e)->watchers_offset; \ + __i += __match->match_size + \ + sizeof(struct ebt_entry_match)) { \ + __match = (void *)(e) + __i; \ + \ + __ret = fn(__match , ## args); \ + if (__ret != 0) \ + break; \ + } \ + if (__ret == 0) { \ + if (__i != (e)->watchers_offset) \ + __ret = -EINVAL; \ + } \ + __ret; \ +}) + +#define EBT_WATCHER_ITERATE(e, fn, args...) \ +({ \ + unsigned int __i; \ + int __ret = 0; \ + struct ebt_entry_watcher *__watcher; \ + \ + for (__i = e->watchers_offset; \ + __i < (e)->target_offset; \ + __i += __watcher->watcher_size + \ + sizeof(struct ebt_entry_watcher)) { \ + __watcher = (void *)(e) + __i; \ + \ + __ret = fn(__watcher , ## args); \ + if (__ret != 0) \ + break; \ + } \ + if (__ret == 0) { \ + if (__i != (e)->target_offset) \ + __ret = -EINVAL; \ + } \ + __ret; \ +}) + +#define EBT_ENTRY_ITERATE(entries, size, fn, args...) \ +({ \ + unsigned int __i; \ + int __ret = 0; \ + struct ebt_entry *__entry; \ + \ + for (__i = 0; __i < (size);) { \ + __entry = (void *)(entries) + __i; \ + __ret = fn(__entry , ## args); \ + if (__ret != 0) \ + break; \ + if (__entry->bitmask != 0) \ + __i += __entry->next_offset; \ + else \ + __i += sizeof(struct ebt_entries); \ + } \ + if (__ret == 0) { \ + if (__i != (size)) \ + __ret = -EINVAL; \ + } \ + __ret; \ +}) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_decnet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_decnet.h new file mode 100644 index 0000000..ca70c6c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_decnet.h @@ -0,0 +1,72 @@ +#ifndef __LINUX_DECNET_NETFILTER_H +#define __LINUX_DECNET_NETFILTER_H + +/* DECnet-specific defines for netfilter. + * This file (C) Steve Whitehouse 1999 derived from the + * ipv4 netfilter header file which is + * (C)1998 Rusty Russell -- This code is GPL. + */ + +#include + +/* only for userspace compatibility */ +/* IP Cache bits. */ +/* Src IP address. */ +#define NFC_DN_SRC 0x0001 +/* Dest IP address. */ +#define NFC_DN_DST 0x0002 +/* Input device. */ +#define NFC_DN_IF_IN 0x0004 +/* Output device. */ +#define NFC_DN_IF_OUT 0x0008 + +/* DECnet Hooks */ +/* After promisc drops, checksum checks. */ +#define NF_DN_PRE_ROUTING 0 +/* If the packet is destined for this box. */ +#define NF_DN_LOCAL_IN 1 +/* If the packet is destined for another interface. */ +#define NF_DN_FORWARD 2 +/* Packets coming from a local process. */ +#define NF_DN_LOCAL_OUT 3 +/* Packets about to hit the wire. */ +#define NF_DN_POST_ROUTING 4 +/* Input Hello Packets */ +#define NF_DN_HELLO 5 +/* Input Routing Packets */ +#define NF_DN_ROUTE 6 +#define NF_DN_NUMHOOKS 7 + +enum nf_dn_hook_priorities { + NF_DN_PRI_FIRST = INT_MIN, + NF_DN_PRI_CONNTRACK = -200, + NF_DN_PRI_MANGLE = -150, + NF_DN_PRI_NAT_DST = -100, + NF_DN_PRI_FILTER = 0, + NF_DN_PRI_NAT_SRC = 100, + NF_DN_PRI_DNRTMSG = 200, + NF_DN_PRI_LAST = INT_MAX, +}; + +struct nf_dn_rtmsg { + int nfdn_ifindex; +}; + +#define NFDN_RTMSG(r) ((unsigned char *)(r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg))) + +/* backwards compatibility for userspace */ +#define DNRMG_L1_GROUP 0x01 +#define DNRMG_L2_GROUP 0x02 + +enum { + DNRNG_NLGRP_NONE, +#define DNRNG_NLGRP_NONE DNRNG_NLGRP_NONE + DNRNG_NLGRP_L1, +#define DNRNG_NLGRP_L1 DNRNG_NLGRP_L1 + DNRNG_NLGRP_L2, +#define DNRNG_NLGRP_L2 DNRNG_NLGRP_L2 + __DNRNG_NLGRP_MAX +}; +#define DNRNG_NLGRP_MAX (__DNRNG_NLGRP_MAX - 1) + +#endif /*__LINUX_DECNET_NETFILTER_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4.h new file mode 100644 index 0000000..4d7ba3e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4.h @@ -0,0 +1,75 @@ +#ifndef __LINUX_IP_NETFILTER_H +#define __LINUX_IP_NETFILTER_H + +/* IPv4-specific defines for netfilter. + * (C)1998 Rusty Russell -- This code is GPL. + */ + +#include + +/* only for userspace compatibility */ +/* IP Cache bits. */ +/* Src IP address. */ +#define NFC_IP_SRC 0x0001 +/* Dest IP address. */ +#define NFC_IP_DST 0x0002 +/* Input device. */ +#define NFC_IP_IF_IN 0x0004 +/* Output device. */ +#define NFC_IP_IF_OUT 0x0008 +/* TOS. */ +#define NFC_IP_TOS 0x0010 +/* Protocol. */ +#define NFC_IP_PROTO 0x0020 +/* IP options. */ +#define NFC_IP_OPTIONS 0x0040 +/* Frag & flags. */ +#define NFC_IP_FRAG 0x0080 + +/* Per-protocol information: only matters if proto match. */ +/* TCP flags. */ +#define NFC_IP_TCPFLAGS 0x0100 +/* Source port. */ +#define NFC_IP_SRC_PT 0x0200 +/* Dest port. */ +#define NFC_IP_DST_PT 0x0400 +/* Something else about the proto */ +#define NFC_IP_PROTO_UNKNOWN 0x2000 + +/* IP Hooks */ +/* After promisc drops, checksum checks. */ +#define NF_IP_PRE_ROUTING 0 +/* If the packet is destined for this box. */ +#define NF_IP_LOCAL_IN 1 +/* If the packet is destined for another interface. */ +#define NF_IP_FORWARD 2 +/* Packets coming from a local process. */ +#define NF_IP_LOCAL_OUT 3 +/* Packets about to hit the wire. */ +#define NF_IP_POST_ROUTING 4 +#define NF_IP_NUMHOOKS 5 + +enum nf_ip_hook_priorities { + NF_IP_PRI_FIRST = INT_MIN, + NF_IP_PRI_CONNTRACK_DEFRAG = -400, + NF_IP_PRI_RAW = -300, + NF_IP_PRI_SELINUX_FIRST = -225, + NF_IP_PRI_CONNTRACK = -200, + NF_IP_PRI_MANGLE = -150, + NF_IP_PRI_NAT_DST = -100, + NF_IP_PRI_FILTER = 0, + NF_IP_PRI_SECURITY = 50, + NF_IP_PRI_NAT_SRC = 100, + NF_IP_PRI_SELINUX_LAST = 225, + NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, + NF_IP_PRI_LAST = INT_MAX, +}; + +/* Arguments for setsockopt SOL_IP: */ +/* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */ +/* 2.2 firewalling (+ masq) went from 64 through 76 */ +/* 2.4 firewalling went 64 through 67. */ +#define SO_ORIGINAL_DST 80 + + +#endif /*__LINUX_IP_NETFILTER_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/..install.cmd new file mode 100644 index 0000000..ca329e6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_ipv4/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter_ipv4 /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_ipv4 mips ip_queue.h ip_tables.h ipt_CLASSIFY.h ipt_CLUSTERIP.h ipt_CONNMARK.h ipt_DSCP.h ipt_ECN.h ipt_LOG.h ipt_MARK.h ipt_NFQUEUE.h ipt_REJECT.h ipt_SAME.h ipt_TCPMSS.h ipt_TOS.h ipt_TTL.h ipt_ULOG.h ipt_addrtype.h ipt_ah.h ipt_comment.h ipt_connbytes.h ipt_connmark.h ipt_conntrack.h ipt_dccp.h ipt_dscp.h ipt_ecn.h ipt_esp.h ipt_hashlimit.h ipt_helper.h ipt_iprange.h ipt_length.h ipt_limit.h ipt_mac.h ipt_mark.h ipt_multiport.h ipt_owner.h ipt_physdev.h ipt_pkttype.h ipt_policy.h ipt_realm.h ipt_recent.h ipt_sctp.h ipt_state.h ipt_string.h ipt_tcpmss.h ipt_tos.h ipt_ttl.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter_ipv4 /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_ipv4 mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_ipv4/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ip_queue.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ip_queue.h new file mode 100644 index 0000000..f5229b1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ip_queue.h @@ -0,0 +1,64 @@ +/* + * This is a module which is used for queueing IPv4 packets and + * communicating with userspace via netlink. + * + * (C) 2000 James Morris, this code is GPL. + */ +#ifndef _IP_QUEUE_H +#define _IP_QUEUE_H + +#include + +/* Messages sent from kernel */ +typedef struct ipq_packet_msg { + unsigned long packet_id; /* ID of queued packet */ + unsigned long mark; /* Netfilter mark value */ + long timestamp_sec; /* Packet arrival time (seconds) */ + long timestamp_usec; /* Packet arrvial time (+useconds) */ + unsigned int hook; /* Netfilter hook we rode in on */ + char indev_name[IFNAMSIZ]; /* Name of incoming interface */ + char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ + __be16 hw_protocol; /* Hardware protocol (network order) */ + unsigned short hw_type; /* Hardware type */ + unsigned char hw_addrlen; /* Hardware address length */ + unsigned char hw_addr[8]; /* Hardware address */ + size_t data_len; /* Length of packet data */ + unsigned char payload[0]; /* Optional packet data */ +} ipq_packet_msg_t; + +/* Messages sent from userspace */ +typedef struct ipq_mode_msg { + unsigned char value; /* Requested mode */ + size_t range; /* Optional range of packet requested */ +} ipq_mode_msg_t; + +typedef struct ipq_verdict_msg { + unsigned int value; /* Verdict to hand to netfilter */ + unsigned long id; /* Packet ID for this verdict */ + size_t data_len; /* Length of replacement data */ + unsigned char payload[0]; /* Optional replacement packet */ +} ipq_verdict_msg_t; + +typedef struct ipq_peer_msg { + union { + ipq_verdict_msg_t verdict; + ipq_mode_msg_t mode; + } msg; +} ipq_peer_msg_t; + +/* Packet delivery modes */ +enum { + IPQ_COPY_NONE, /* Initial mode, packets are dropped */ + IPQ_COPY_META, /* Copy metadata */ + IPQ_COPY_PACKET /* Copy metadata + packet (range) */ +}; +#define IPQ_COPY_MAX IPQ_COPY_PACKET + +/* Types of messages */ +#define IPQM_BASE 0x10 /* standard netlink messages below this */ +#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */ +#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */ +#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */ +#define IPQM_MAX (IPQM_BASE + 4) + +#endif /*_IP_QUEUE_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ip_tables.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ip_tables.h new file mode 100644 index 0000000..a9f21c9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ip_tables.h @@ -0,0 +1,236 @@ +/* + * 25-Jul-1998 Major changes to allow for ip chain table + * + * 3-Jan-2000 Named tables to allow packet selection for different uses. + */ + +/* + * Format of an IP firewall descriptor + * + * src, dst, src_mask, dst_mask are always stored in network byte order. + * flags are stored in host byte order (of course). + * Port numbers are stored in HOST byte order. + */ + +#ifndef _IPTABLES_H +#define _IPTABLES_H + +#include + +#include + +#include + +#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN +#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN +#define ipt_match xt_match +#define ipt_target xt_target +#define ipt_table xt_table +#define ipt_get_revision xt_get_revision + +/* Yes, Virginia, you have to zero the padding. */ +struct ipt_ip { + /* Source and destination IP addr */ + struct in_addr src, dst; + /* Mask for src and dest IP addr */ + struct in_addr smsk, dmsk; + char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; + unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; + + /* Protocol, 0 = ANY */ + u_int16_t proto; + + /* Flags word */ + u_int8_t flags; + /* Inverse flags */ + u_int8_t invflags; +}; + +#define ipt_entry_match xt_entry_match +#define ipt_entry_target xt_entry_target +#define ipt_standard_target xt_standard_target + +#define ipt_counters xt_counters + +/* Values for "flag" field in struct ipt_ip (general ip structure). */ +#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ +#define IPT_F_GOTO 0x02 /* Set if jump is a goto */ +#define IPT_F_MASK 0x03 /* All possible flag bits mask. */ + +/* Values for "inv" field in struct ipt_ip. */ +#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ +#define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ +#define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */ +#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ +#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ +#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */ +#define IPT_INV_PROTO XT_INV_PROTO +#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */ + +/* This structure defines each of the firewall rules. Consists of 3 + parts which are 1) general IP header stuff 2) match specific + stuff 3) the target to perform if the rule matches */ +struct ipt_entry +{ + struct ipt_ip ip; + + /* Mark with fields that we care about. */ + unsigned int nfcache; + + /* Size of ipt_entry + matches */ + u_int16_t target_offset; + /* Size of ipt_entry + matches + target */ + u_int16_t next_offset; + + /* Back pointer */ + unsigned int comefrom; + + /* Packet and byte counters. */ + struct xt_counters counters; + + /* The matches (if any), then the target. */ + unsigned char elems[0]; +}; + +/* + * New IP firewall options for [gs]etsockopt at the RAW IP level. + * Unlike BSD Linux inherits IP options so you don't have to use a raw + * socket for this. Instead we check rights in the calls. + * + * ATTENTION: check linux/in.h before adding new number here. + */ +#define IPT_BASE_CTL 64 + +#define IPT_SO_SET_REPLACE (IPT_BASE_CTL) +#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) +#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS + +#define IPT_SO_GET_INFO (IPT_BASE_CTL) +#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) +#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) +#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) +#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET + +#define IPT_CONTINUE XT_CONTINUE +#define IPT_RETURN XT_RETURN + +#include +#define ipt_udp xt_udp +#define ipt_tcp xt_tcp + +#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT +#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT +#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS +#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION +#define IPT_TCP_INV_MASK XT_TCP_INV_MASK + +#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT +#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT +#define IPT_UDP_INV_MASK XT_UDP_INV_MASK + +/* ICMP matching stuff */ +struct ipt_icmp +{ + u_int8_t type; /* type to match */ + u_int8_t code[2]; /* range of code */ + u_int8_t invflags; /* Inverse flags */ +}; + +/* Values for "inv" field for struct ipt_icmp. */ +#define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */ + +/* The argument to IPT_SO_GET_INFO */ +struct ipt_getinfo +{ + /* Which table: caller fills this in. */ + char name[IPT_TABLE_MAXNAMELEN]; + + /* Kernel fills these in. */ + /* Which hook entry points are valid: bitmask */ + unsigned int valid_hooks; + + /* Hook entry points: one per netfilter hook. */ + unsigned int hook_entry[NF_INET_NUMHOOKS]; + + /* Underflow points. */ + unsigned int underflow[NF_INET_NUMHOOKS]; + + /* Number of entries */ + unsigned int num_entries; + + /* Size of entries. */ + unsigned int size; +}; + +/* The argument to IPT_SO_SET_REPLACE. */ +struct ipt_replace +{ + /* Which table. */ + char name[IPT_TABLE_MAXNAMELEN]; + + /* Which hook entry points are valid: bitmask. You can't + change this. */ + unsigned int valid_hooks; + + /* Number of entries */ + unsigned int num_entries; + + /* Total size of new entries */ + unsigned int size; + + /* Hook entry points. */ + unsigned int hook_entry[NF_INET_NUMHOOKS]; + + /* Underflow points. */ + unsigned int underflow[NF_INET_NUMHOOKS]; + + /* Information about old entries: */ + /* Number of counters (must be equal to current number of entries). */ + unsigned int num_counters; + /* The old entries' counters. */ + struct xt_counters *counters; + + /* The entries (hang off end: not really an array). */ + struct ipt_entry entries[0]; +}; + +/* The argument to IPT_SO_ADD_COUNTERS. */ +#define ipt_counters_info xt_counters_info + +/* The argument to IPT_SO_GET_ENTRIES. */ +struct ipt_get_entries +{ + /* Which table: user fills this in. */ + char name[IPT_TABLE_MAXNAMELEN]; + + /* User fills this in: total entry size. */ + unsigned int size; + + /* The entries. */ + struct ipt_entry entrytable[0]; +}; + +/* Standard return verdict, or do jump. */ +#define IPT_STANDARD_TARGET XT_STANDARD_TARGET +/* Error verdict. */ +#define IPT_ERROR_TARGET XT_ERROR_TARGET + +/* Helper functions */ +static __inline__ struct ipt_entry_target * +ipt_get_target(struct ipt_entry *e) +{ + return (void *)e + e->target_offset; +} + +/* fn returns 0 to continue iteration */ +#define IPT_MATCH_ITERATE(e, fn, args...) \ + XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) + +/* fn returns 0 to continue iteration */ +#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ + XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) + +/* + * Main firewall chains definitions and global var's definitions. + */ +#endif /* _IPTABLES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h new file mode 100644 index 0000000..a46d511 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h @@ -0,0 +1,7 @@ +#ifndef _IPT_CLASSIFY_H +#define _IPT_CLASSIFY_H + +#include +#define ipt_classify_target_info xt_classify_target_info + +#endif /*_IPT_CLASSIFY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h new file mode 100644 index 0000000..e5a3687 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h @@ -0,0 +1,34 @@ +#ifndef _IPT_CLUSTERIP_H_target +#define _IPT_CLUSTERIP_H_target + +enum clusterip_hashmode { + CLUSTERIP_HASHMODE_SIP = 0, + CLUSTERIP_HASHMODE_SIP_SPT, + CLUSTERIP_HASHMODE_SIP_SPT_DPT, +}; + +#define CLUSTERIP_HASHMODE_MAX CLUSTERIP_HASHMODE_SIP_SPT_DPT + +#define CLUSTERIP_MAX_NODES 16 + +#define CLUSTERIP_FLAG_NEW 0x00000001 + +struct clusterip_config; + +struct ipt_clusterip_tgt_info { + + u_int32_t flags; + + /* only relevant for new ones */ + u_int8_t clustermac[6]; + u_int16_t num_total_nodes; + u_int16_t num_local_nodes; + u_int16_t local_nodes[CLUSTERIP_MAX_NODES]; + u_int32_t hash_mode; + u_int32_t hash_initval; + + /* Used internally by the kernel */ + struct clusterip_config *config; +}; + +#endif /*_IPT_CLUSTERIP_H_target*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CONNMARK.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CONNMARK.h new file mode 100644 index 0000000..9ecfee0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_CONNMARK.h @@ -0,0 +1,19 @@ +#ifndef _IPT_CONNMARK_H_target +#define _IPT_CONNMARK_H_target + +/* Copyright (C) 2002,2004 MARA Systems AB + * by Henrik Nordstrom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#define IPT_CONNMARK_SET XT_CONNMARK_SET +#define IPT_CONNMARK_SAVE XT_CONNMARK_SAVE +#define IPT_CONNMARK_RESTORE XT_CONNMARK_RESTORE + +#define ipt_connmark_target_info xt_connmark_target_info + +#endif /*_IPT_CONNMARK_H_target*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_DSCP.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_DSCP.h new file mode 100644 index 0000000..3491e52 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_DSCP.h @@ -0,0 +1,18 @@ +/* iptables module for setting the IPv4 DSCP field + * + * (C) 2002 Harald Welte + * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh + * This software is distributed under GNU GPL v2, 1991 + * + * See RFC2474 for a description of the DSCP field within the IP Header. + * + * ipt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp +*/ +#ifndef _IPT_DSCP_TARGET_H +#define _IPT_DSCP_TARGET_H +#include +#include + +#define ipt_DSCP_info xt_DSCP_info + +#endif /* _IPT_DSCP_TARGET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ECN.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ECN.h new file mode 100644 index 0000000..94e0d98 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ECN.h @@ -0,0 +1,31 @@ +/* Header file for iptables ipt_ECN target + * + * (C) 2002 by Harald Welte + * + * This software is distributed under GNU GPL v2, 1991 + * + * ipt_ECN.h,v 1.3 2002/05/29 12:17:40 laforge Exp +*/ +#ifndef _IPT_ECN_TARGET_H +#define _IPT_ECN_TARGET_H +#include + +#define IPT_ECN_IP_MASK (~IPT_DSCP_MASK) + +#define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */ +#define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */ +#define IPT_ECN_OP_SET_CWR 0x20 /* set CWR bit of TCP header */ + +#define IPT_ECN_OP_MASK 0xce + +struct ipt_ECN_info { + u_int8_t operation; /* bitset of operations */ + u_int8_t ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ + union { + struct { + u_int8_t ece:1, cwr:1; /* TCP ECT bits */ + } tcp; + } proto; +}; + +#endif /* _IPT_ECN_TARGET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_LOG.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_LOG.h new file mode 100644 index 0000000..90fa652 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_LOG.h @@ -0,0 +1,18 @@ +#ifndef _IPT_LOG_H +#define _IPT_LOG_H + +/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ +#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ +#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ +#define IPT_LOG_IPOPT 0x04 /* Log IP options */ +#define IPT_LOG_UID 0x08 /* Log UID owning local socket */ +#define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ +#define IPT_LOG_MASK 0x1f + +struct ipt_log_info { + unsigned char level; + unsigned char logflags; + char prefix[30]; +}; + +#endif /*_IPT_LOG_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_MARK.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_MARK.h new file mode 100644 index 0000000..697a486 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_MARK.h @@ -0,0 +1,18 @@ +#ifndef _IPT_MARK_H_target +#define _IPT_MARK_H_target + +/* Backwards compatibility for old userspace */ + +#include + +/* Version 0 */ +#define ipt_mark_target_info xt_mark_target_info + +/* Version 1 */ +#define IPT_MARK_SET XT_MARK_SET +#define IPT_MARK_AND XT_MARK_AND +#define IPT_MARK_OR XT_MARK_OR + +#define ipt_mark_target_info_v1 xt_mark_target_info_v1 + +#endif /*_IPT_MARK_H_target*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h new file mode 100644 index 0000000..97a2a75 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h @@ -0,0 +1,16 @@ +/* iptables module for using NFQUEUE mechanism + * + * (C) 2005 Harald Welte + * + * This software is distributed under GNU GPL v2, 1991 + * +*/ +#ifndef _IPT_NFQ_TARGET_H +#define _IPT_NFQ_TARGET_H + +/* Backwards compatibility for old userspace */ +#include + +#define ipt_NFQ_info xt_NFQ_info + +#endif /* _IPT_DSCP_TARGET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_REJECT.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_REJECT.h new file mode 100644 index 0000000..4293a1a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_REJECT.h @@ -0,0 +1,20 @@ +#ifndef _IPT_REJECT_H +#define _IPT_REJECT_H + +enum ipt_reject_with { + IPT_ICMP_NET_UNREACHABLE, + IPT_ICMP_HOST_UNREACHABLE, + IPT_ICMP_PROT_UNREACHABLE, + IPT_ICMP_PORT_UNREACHABLE, + IPT_ICMP_ECHOREPLY, + IPT_ICMP_NET_PROHIBITED, + IPT_ICMP_HOST_PROHIBITED, + IPT_TCP_RESET, + IPT_ICMP_ADMIN_PROHIBITED +}; + +struct ipt_reject_info { + enum ipt_reject_with with; /* reject type */ +}; + +#endif /*_IPT_REJECT_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_SAME.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_SAME.h new file mode 100644 index 0000000..be6e682 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_SAME.h @@ -0,0 +1,19 @@ +#ifndef _IPT_SAME_H +#define _IPT_SAME_H + +#define IPT_SAME_MAX_RANGE 10 + +#define IPT_SAME_NODST 0x01 + +struct ipt_same_info +{ + unsigned char info; + u_int32_t rangesize; + u_int32_t ipnum; + u_int32_t *iparray; + + /* hangs off end. */ + struct nf_nat_range range[IPT_SAME_MAX_RANGE]; +}; + +#endif /*_IPT_SAME_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h new file mode 100644 index 0000000..7a850f9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h @@ -0,0 +1,9 @@ +#ifndef _IPT_TCPMSS_H +#define _IPT_TCPMSS_H + +#include + +#define ipt_tcpmss_info xt_tcpmss_info +#define IPT_TCPMSS_CLAMP_PMTU XT_TCPMSS_CLAMP_PMTU + +#endif /*_IPT_TCPMSS_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TOS.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TOS.h new file mode 100644 index 0000000..6bf9e1f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TOS.h @@ -0,0 +1,12 @@ +#ifndef _IPT_TOS_H_target +#define _IPT_TOS_H_target + +#ifndef IPTOS_NORMALSVC +#define IPTOS_NORMALSVC 0 +#endif + +struct ipt_tos_target_info { + u_int8_t tos; +}; + +#endif /*_IPT_TOS_H_target*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TTL.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TTL.h new file mode 100644 index 0000000..ee6611e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_TTL.h @@ -0,0 +1,21 @@ +/* TTL modification module for IP tables + * (C) 2000 by Harald Welte */ + +#ifndef _IPT_TTL_H +#define _IPT_TTL_H + +enum { + IPT_TTL_SET = 0, + IPT_TTL_INC, + IPT_TTL_DEC +}; + +#define IPT_TTL_MAXMODE IPT_TTL_DEC + +struct ipt_TTL_info { + u_int8_t mode; + u_int8_t ttl; +}; + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ULOG.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ULOG.h new file mode 100644 index 0000000..417aad2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ULOG.h @@ -0,0 +1,49 @@ +/* Header file for IP tables userspace logging, Version 1.8 + * + * (C) 2000-2002 by Harald Welte + * + * Distributed under the terms of GNU GPL */ + +#ifndef _IPT_ULOG_H +#define _IPT_ULOG_H + +#ifndef NETLINK_NFLOG +#define NETLINK_NFLOG 5 +#endif + +#define ULOG_DEFAULT_NLGROUP 1 +#define ULOG_DEFAULT_QTHRESHOLD 1 + +#define ULOG_MAC_LEN 80 +#define ULOG_PREFIX_LEN 32 + +#define ULOG_MAX_QLEN 50 +/* Why 50? Well... there is a limit imposed by the slab cache 131000 + * bytes. So the multipart netlink-message has to be < 131000 bytes. + * Assuming a standard ethernet-mtu of 1500, we could define this up + * to 80... but even 50 seems to be big enough. */ + +/* private data structure for each rule with a ULOG target */ +struct ipt_ulog_info { + unsigned int nl_group; + size_t copy_range; + size_t qthreshold; + char prefix[ULOG_PREFIX_LEN]; +}; + +/* Format of the ULOG packets passed through netlink */ +typedef struct ulog_packet_msg { + unsigned long mark; + long timestamp_sec; + long timestamp_usec; + unsigned int hook; + char indev_name[IFNAMSIZ]; + char outdev_name[IFNAMSIZ]; + size_t data_len; + char prefix[ULOG_PREFIX_LEN]; + unsigned char mac_len; + unsigned char mac[ULOG_MAC_LEN]; + unsigned char payload[0]; +} ulog_packet_msg_t; + +#endif /*_IPT_ULOG_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_addrtype.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_addrtype.h new file mode 100644 index 0000000..446de6a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_addrtype.h @@ -0,0 +1,25 @@ +#ifndef _IPT_ADDRTYPE_H +#define _IPT_ADDRTYPE_H + +enum { + IPT_ADDRTYPE_INVERT_SOURCE = 0x0001, + IPT_ADDRTYPE_INVERT_DEST = 0x0002, + IPT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004, + IPT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008, +}; + +struct ipt_addrtype_info_v1 { + u_int16_t source; /* source-type mask */ + u_int16_t dest; /* dest-type mask */ + u_int32_t flags; +}; + +/* revision 0 */ +struct ipt_addrtype_info { + u_int16_t source; /* source-type mask */ + u_int16_t dest; /* dest-type mask */ + u_int32_t invert_source; + u_int32_t invert_dest; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ah.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ah.h new file mode 100644 index 0000000..7b9a2ac --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ah.h @@ -0,0 +1,16 @@ +#ifndef _IPT_AH_H +#define _IPT_AH_H + +struct ipt_ah +{ + u_int32_t spis[2]; /* Security Parameter Index */ + u_int8_t invflags; /* Inverse flags */ +}; + + + +/* Values for "invflags" field in struct ipt_ah. */ +#define IPT_AH_INV_SPI 0x01 /* Invert the sense of spi. */ +#define IPT_AH_INV_MASK 0x01 /* All possible flags. */ + +#endif /*_IPT_AH_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_comment.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_comment.h new file mode 100644 index 0000000..ae2afc2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_comment.h @@ -0,0 +1,10 @@ +#ifndef _IPT_COMMENT_H +#define _IPT_COMMENT_H + +#include + +#define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN + +#define ipt_comment_info xt_comment_info + +#endif /* _IPT_COMMENT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_connbytes.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_connbytes.h new file mode 100644 index 0000000..f63e6ee --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_connbytes.h @@ -0,0 +1,18 @@ +#ifndef _IPT_CONNBYTES_H +#define _IPT_CONNBYTES_H + +#include +#define ipt_connbytes_what xt_connbytes_what + +#define IPT_CONNBYTES_PKTS XT_CONNBYTES_PKTS +#define IPT_CONNBYTES_BYTES XT_CONNBYTES_BYTES +#define IPT_CONNBYTES_AVGPKT XT_CONNBYTES_AVGPKT + +#define ipt_connbytes_direction xt_connbytes_direction +#define IPT_CONNBYTES_DIR_ORIGINAL XT_CONNBYTES_DIR_ORIGINAL +#define IPT_CONNBYTES_DIR_REPLY XT_CONNBYTES_DIR_REPLY +#define IPT_CONNBYTES_DIR_BOTH XT_CONNBYTES_DIR_BOTH + +#define ipt_connbytes_info xt_connbytes_info + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_connmark.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_connmark.h new file mode 100644 index 0000000..c7ba656 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_connmark.h @@ -0,0 +1,7 @@ +#ifndef _IPT_CONNMARK_H +#define _IPT_CONNMARK_H + +#include +#define ipt_connmark_info xt_connmark_info + +#endif /*_IPT_CONNMARK_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_conntrack.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_conntrack.h new file mode 100644 index 0000000..cde6762 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_conntrack.h @@ -0,0 +1,28 @@ +/* Header file for kernel module to match connection tracking information. + * GPL (C) 2001 Marc Boucher (marc@mbsi.ca). + */ + +#ifndef _IPT_CONNTRACK_H +#define _IPT_CONNTRACK_H + +#include + +#define IPT_CONNTRACK_STATE_BIT(ctinfo) XT_CONNTRACK_STATE_BIT(ctinfo) +#define IPT_CONNTRACK_STATE_INVALID XT_CONNTRACK_STATE_INVALID + +#define IPT_CONNTRACK_STATE_SNAT XT_CONNTRACK_STATE_SNAT +#define IPT_CONNTRACK_STATE_DNAT XT_CONNTRACK_STATE_DNAT +#define IPT_CONNTRACK_STATE_UNTRACKED XT_CONNTRACK_STATE_UNTRACKED + +/* flags, invflags: */ +#define IPT_CONNTRACK_STATE XT_CONNTRACK_STATE +#define IPT_CONNTRACK_PROTO XT_CONNTRACK_PROTO +#define IPT_CONNTRACK_ORIGSRC XT_CONNTRACK_ORIGSRC +#define IPT_CONNTRACK_ORIGDST XT_CONNTRACK_ORIGDST +#define IPT_CONNTRACK_REPLSRC XT_CONNTRACK_REPLSRC +#define IPT_CONNTRACK_REPLDST XT_CONNTRACK_REPLDST +#define IPT_CONNTRACK_STATUS XT_CONNTRACK_STATUS +#define IPT_CONNTRACK_EXPIRES XT_CONNTRACK_EXPIRES + +#define ipt_conntrack_info xt_conntrack_info +#endif /*_IPT_CONNTRACK_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_dccp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_dccp.h new file mode 100644 index 0000000..e70d11e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_dccp.h @@ -0,0 +1,15 @@ +#ifndef _IPT_DCCP_H_ +#define _IPT_DCCP_H_ + +#include +#define IPT_DCCP_SRC_PORTS XT_DCCP_SRC_PORTS +#define IPT_DCCP_DEST_PORTS XT_DCCP_DEST_PORTS +#define IPT_DCCP_TYPE XT_DCCP_TYPE +#define IPT_DCCP_OPTION XT_DCCP_OPTION + +#define IPT_DCCP_VALID_FLAGS XT_DCCP_VALID_FLAGS + +#define ipt_dccp_info xt_dccp_info + +#endif /* _IPT_DCCP_H_ */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_dscp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_dscp.h new file mode 100644 index 0000000..4b82ca9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_dscp.h @@ -0,0 +1,21 @@ +/* iptables module for matching the IPv4 DSCP field + * + * (C) 2002 Harald Welte + * This software is distributed under GNU GPL v2, 1991 + * + * See RFC2474 for a description of the DSCP field within the IP Header. + * + * ipt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp +*/ +#ifndef _IPT_DSCP_H +#define _IPT_DSCP_H + +#include + +#define IPT_DSCP_MASK XT_DSCP_MASK +#define IPT_DSCP_SHIFT XT_DSCP_SHIFT +#define IPT_DSCP_MAX XT_DSCP_MAX + +#define ipt_dscp_info xt_dscp_info + +#endif /* _IPT_DSCP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ecn.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ecn.h new file mode 100644 index 0000000..1f0d9a4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ecn.h @@ -0,0 +1,33 @@ +/* iptables module for matching the ECN header in IPv4 and TCP header + * + * (C) 2002 Harald Welte + * + * This software is distributed under GNU GPL v2, 1991 + * + * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp +*/ +#ifndef _IPT_ECN_H +#define _IPT_ECN_H +#include + +#define IPT_ECN_IP_MASK (~IPT_DSCP_MASK) + +#define IPT_ECN_OP_MATCH_IP 0x01 +#define IPT_ECN_OP_MATCH_ECE 0x10 +#define IPT_ECN_OP_MATCH_CWR 0x20 + +#define IPT_ECN_OP_MATCH_MASK 0xce + +/* match info */ +struct ipt_ecn_info { + u_int8_t operation; + u_int8_t invert; + u_int8_t ip_ect; + union { + struct { + u_int8_t ect; + } tcp; + } proto; +}; + +#endif /* _IPT_ECN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_esp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_esp.h new file mode 100644 index 0000000..78296e7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_esp.h @@ -0,0 +1,10 @@ +#ifndef _IPT_ESP_H +#define _IPT_ESP_H + +#include + +#define ipt_esp xt_esp +#define IPT_ESP_INV_SPI XT_ESP_INV_SPI +#define IPT_ESP_INV_MASK XT_ESP_INV_MASK + +#endif /*_IPT_ESP_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h new file mode 100644 index 0000000..5662120 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h @@ -0,0 +1,14 @@ +#ifndef _IPT_HASHLIMIT_H +#define _IPT_HASHLIMIT_H + +#include + +#define IPT_HASHLIMIT_SCALE XT_HASHLIMIT_SCALE +#define IPT_HASHLIMIT_HASH_DIP XT_HASHLIMIT_HASH_DIP +#define IPT_HASHLIMIT_HASH_DPT XT_HASHLIMIT_HASH_DPT +#define IPT_HASHLIMIT_HASH_SIP XT_HASHLIMIT_HASH_SIP +#define IPT_HASHLIMIT_HASH_SPT XT_HASHLIMIT_HASH_SPT + +#define ipt_hashlimit_info xt_hashlimit_info + +#endif /* _IPT_HASHLIMIT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_helper.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_helper.h new file mode 100644 index 0000000..80452c2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_helper.h @@ -0,0 +1,7 @@ +#ifndef _IPT_HELPER_H +#define _IPT_HELPER_H + +#include +#define ipt_helper_info xt_helper_info + +#endif /* _IPT_HELPER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_iprange.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_iprange.h new file mode 100644 index 0000000..5f1aebd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_iprange.h @@ -0,0 +1,21 @@ +#ifndef _IPT_IPRANGE_H +#define _IPT_IPRANGE_H + +#include +#include + +struct ipt_iprange { + /* Inclusive: network order. */ + __be32 min_ip, max_ip; +}; + +struct ipt_iprange_info +{ + struct ipt_iprange src; + struct ipt_iprange dst; + + /* Flags from above */ + u_int8_t flags; +}; + +#endif /* _IPT_IPRANGE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_length.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_length.h new file mode 100644 index 0000000..9b45206 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_length.h @@ -0,0 +1,7 @@ +#ifndef _IPT_LENGTH_H +#define _IPT_LENGTH_H + +#include +#define ipt_length_info xt_length_info + +#endif /*_IPT_LENGTH_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_limit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_limit.h new file mode 100644 index 0000000..92f5cd0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_limit.h @@ -0,0 +1,8 @@ +#ifndef _IPT_RATE_H +#define _IPT_RATE_H + +#include +#define IPT_LIMIT_SCALE XT_LIMIT_SCALE +#define ipt_rateinfo xt_rateinfo + +#endif /*_IPT_RATE_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_mac.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_mac.h new file mode 100644 index 0000000..b186008 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_mac.h @@ -0,0 +1,7 @@ +#ifndef _IPT_MAC_H +#define _IPT_MAC_H + +#include +#define ipt_mac_info xt_mac_info + +#endif /*_IPT_MAC_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_mark.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_mark.h new file mode 100644 index 0000000..bfde67c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_mark.h @@ -0,0 +1,9 @@ +#ifndef _IPT_MARK_H +#define _IPT_MARK_H + +/* Backwards compatibility for old userspace */ +#include + +#define ipt_mark_info xt_mark_info + +#endif /*_IPT_MARK_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_multiport.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_multiport.h new file mode 100644 index 0000000..55fe85e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_multiport.h @@ -0,0 +1,15 @@ +#ifndef _IPT_MULTIPORT_H +#define _IPT_MULTIPORT_H + +#include + +#define IPT_MULTIPORT_SOURCE XT_MULTIPORT_SOURCE +#define IPT_MULTIPORT_DESTINATION XT_MULTIPORT_DESTINATION +#define IPT_MULTIPORT_EITHER XT_MULTIPORT_EITHER + +#define IPT_MULTI_PORTS XT_MULTI_PORTS + +#define ipt_multiport xt_multiport +#define ipt_multiport_v1 xt_multiport_v1 + +#endif /*_IPT_MULTIPORT_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_owner.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_owner.h new file mode 100644 index 0000000..a78445b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_owner.h @@ -0,0 +1,20 @@ +#ifndef _IPT_OWNER_H +#define _IPT_OWNER_H + +/* match and invert flags */ +#define IPT_OWNER_UID 0x01 +#define IPT_OWNER_GID 0x02 +#define IPT_OWNER_PID 0x04 +#define IPT_OWNER_SID 0x08 +#define IPT_OWNER_COMM 0x10 + +struct ipt_owner_info { + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_pid_t pid; + __kernel_pid_t sid; + char comm[16]; + u_int8_t match, invert; /* flags */ +}; + +#endif /*_IPT_OWNER_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_physdev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_physdev.h new file mode 100644 index 0000000..2400e71 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_physdev.h @@ -0,0 +1,17 @@ +#ifndef _IPT_PHYSDEV_H +#define _IPT_PHYSDEV_H + +/* Backwards compatibility for old userspace */ + +#include + +#define IPT_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN +#define IPT_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT +#define IPT_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED +#define IPT_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN +#define IPT_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT +#define IPT_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK + +#define ipt_physdev_info xt_physdev_info + +#endif /*_IPT_PHYSDEV_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_pkttype.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_pkttype.h new file mode 100644 index 0000000..ff1fbc9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_pkttype.h @@ -0,0 +1,7 @@ +#ifndef _IPT_PKTTYPE_H +#define _IPT_PKTTYPE_H + +#include +#define ipt_pkttype_info xt_pkttype_info + +#endif /*_IPT_PKTTYPE_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_policy.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_policy.h new file mode 100644 index 0000000..1037fb2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_policy.h @@ -0,0 +1,23 @@ +#ifndef _IPT_POLICY_H +#define _IPT_POLICY_H + +#include + +#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM + +/* ipt_policy_flags */ +#define IPT_POLICY_MATCH_IN XT_POLICY_MATCH_IN +#define IPT_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT +#define IPT_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE +#define IPT_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT + +/* ipt_policy_modes */ +#define IPT_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT +#define IPT_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL + +#define ipt_policy_spec xt_policy_spec +#define ipt_policy_addr xt_policy_addr +#define ipt_policy_elem xt_policy_elem +#define ipt_policy_info xt_policy_info + +#endif /* _IPT_POLICY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_realm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_realm.h new file mode 100644 index 0000000..b3996ea --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_realm.h @@ -0,0 +1,7 @@ +#ifndef _IPT_REALM_H +#define _IPT_REALM_H + +#include +#define ipt_realm_info xt_realm_info + +#endif /* _IPT_REALM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_recent.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_recent.h new file mode 100644 index 0000000..d636cca --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_recent.h @@ -0,0 +1,21 @@ +#ifndef _IPT_RECENT_H +#define _IPT_RECENT_H + +#include + +#define ipt_recent_info xt_recent_mtinfo + +enum { + IPT_RECENT_CHECK = XT_RECENT_CHECK, + IPT_RECENT_SET = XT_RECENT_SET, + IPT_RECENT_UPDATE = XT_RECENT_UPDATE, + IPT_RECENT_REMOVE = XT_RECENT_REMOVE, + IPT_RECENT_TTL = XT_RECENT_TTL, + + IPT_RECENT_SOURCE = XT_RECENT_SOURCE, + IPT_RECENT_DEST = XT_RECENT_DEST, + + IPT_RECENT_NAME_LEN = XT_RECENT_NAME_LEN, +}; + +#endif /*_IPT_RECENT_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_sctp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_sctp.h new file mode 100644 index 0000000..80b3dba --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_sctp.h @@ -0,0 +1,105 @@ +#ifndef _IPT_SCTP_H_ +#define _IPT_SCTP_H_ + +#define IPT_SCTP_SRC_PORTS 0x01 +#define IPT_SCTP_DEST_PORTS 0x02 +#define IPT_SCTP_CHUNK_TYPES 0x04 + +#define IPT_SCTP_VALID_FLAGS 0x07 + + +struct ipt_sctp_flag_info { + u_int8_t chunktype; + u_int8_t flag; + u_int8_t flag_mask; +}; + +#define IPT_NUM_SCTP_FLAGS 4 + +struct ipt_sctp_info { + u_int16_t dpts[2]; /* Min, Max */ + u_int16_t spts[2]; /* Min, Max */ + + u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */ + +#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */ +#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */ +#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */ + + u_int32_t chunk_match_type; + struct ipt_sctp_flag_info flag_info[IPT_NUM_SCTP_FLAGS]; + int flag_count; + + u_int32_t flags; + u_int32_t invflags; +}; + +#define bytes(type) (sizeof(type) * 8) + +#define SCTP_CHUNKMAP_SET(chunkmap, type) \ + do { \ + chunkmap[type / bytes(u_int32_t)] |= \ + 1 << (type % bytes(u_int32_t)); \ + } while (0) + +#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ + do { \ + chunkmap[type / bytes(u_int32_t)] &= \ + ~(1 << (type % bytes(u_int32_t))); \ + } while (0) + +#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ +({ \ + (chunkmap[type / bytes (u_int32_t)] & \ + (1 << (type % bytes (u_int32_t)))) ? 1: 0; \ +}) + +#define SCTP_CHUNKMAP_RESET(chunkmap) \ + do { \ + int i; \ + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ + chunkmap[i] = 0; \ + } while (0) + +#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ + do { \ + int i; \ + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ + chunkmap[i] = ~0; \ + } while (0) + +#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ + do { \ + int i; \ + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ + destmap[i] = srcmap[i]; \ + } while (0) + +#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ +({ \ + int i; \ + int flag = 1; \ + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \ + if (chunkmap[i]) { \ + flag = 0; \ + break; \ + } \ + } \ + flag; \ +}) + +#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ +({ \ + int i; \ + int flag = 1; \ + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \ + if (chunkmap[i] != ~0) { \ + flag = 0; \ + break; \ + } \ + } \ + flag; \ +}) + +#endif /* _IPT_SCTP_H_ */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_state.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_state.h new file mode 100644 index 0000000..a44a99c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_state.h @@ -0,0 +1,15 @@ +#ifndef _IPT_STATE_H +#define _IPT_STATE_H + +/* Backwards compatibility for old userspace */ + +#include + +#define IPT_STATE_BIT XT_STATE_BIT +#define IPT_STATE_INVALID XT_STATE_INVALID + +#define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED + +#define ipt_state_info xt_state_info + +#endif /*_IPT_STATE_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_string.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_string.h new file mode 100644 index 0000000..c26de30 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_string.h @@ -0,0 +1,10 @@ +#ifndef _IPT_STRING_H +#define _IPT_STRING_H + +#include + +#define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE +#define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE +#define ipt_string_info xt_string_info + +#endif /*_IPT_STRING_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_tcpmss.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_tcpmss.h new file mode 100644 index 0000000..18bbc8e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_tcpmss.h @@ -0,0 +1,7 @@ +#ifndef _IPT_TCPMSS_MATCH_H +#define _IPT_TCPMSS_MATCH_H + +#include +#define ipt_tcpmss_match_info xt_tcpmss_match_info + +#endif /*_IPT_TCPMSS_MATCH_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_tos.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_tos.h new file mode 100644 index 0000000..a21f5df --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_tos.h @@ -0,0 +1,13 @@ +#ifndef _IPT_TOS_H +#define _IPT_TOS_H + +struct ipt_tos_info { + u_int8_t tos; + u_int8_t invert; +}; + +#ifndef IPTOS_NORMALSVC +#define IPTOS_NORMALSVC 0 +#endif + +#endif /*_IPT_TOS_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ttl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ttl.h new file mode 100644 index 0000000..ee24fd8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv4/ipt_ttl.h @@ -0,0 +1,21 @@ +/* IP tables module for matching the value of the TTL + * (C) 2000 by Harald Welte */ + +#ifndef _IPT_TTL_H +#define _IPT_TTL_H + +enum { + IPT_TTL_EQ = 0, /* equals */ + IPT_TTL_NE, /* not equals */ + IPT_TTL_LT, /* less than */ + IPT_TTL_GT, /* greater than */ +}; + + +struct ipt_ttl_info { + u_int8_t mode; + u_int8_t ttl; +}; + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6.h new file mode 100644 index 0000000..7430b39 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6.h @@ -0,0 +1,72 @@ +#ifndef __LINUX_IP6_NETFILTER_H +#define __LINUX_IP6_NETFILTER_H + +/* IPv6-specific defines for netfilter. + * (C)1998 Rusty Russell -- This code is GPL. + * (C)1999 David Jeffery + * this header was blatantly ripped from netfilter_ipv4.h + * it's amazing what adding a bunch of 6s can do =8^) + */ + +#include + +/* only for userspace compatibility */ +/* IP Cache bits. */ +/* Src IP address. */ +#define NFC_IP6_SRC 0x0001 +/* Dest IP address. */ +#define NFC_IP6_DST 0x0002 +/* Input device. */ +#define NFC_IP6_IF_IN 0x0004 +/* Output device. */ +#define NFC_IP6_IF_OUT 0x0008 +/* TOS. */ +#define NFC_IP6_TOS 0x0010 +/* Protocol. */ +#define NFC_IP6_PROTO 0x0020 +/* IP options. */ +#define NFC_IP6_OPTIONS 0x0040 +/* Frag & flags. */ +#define NFC_IP6_FRAG 0x0080 + + +/* Per-protocol information: only matters if proto match. */ +/* TCP flags. */ +#define NFC_IP6_TCPFLAGS 0x0100 +/* Source port. */ +#define NFC_IP6_SRC_PT 0x0200 +/* Dest port. */ +#define NFC_IP6_DST_PT 0x0400 +/* Something else about the proto */ +#define NFC_IP6_PROTO_UNKNOWN 0x2000 + +/* IP6 Hooks */ +/* After promisc drops, checksum checks. */ +#define NF_IP6_PRE_ROUTING 0 +/* If the packet is destined for this box. */ +#define NF_IP6_LOCAL_IN 1 +/* If the packet is destined for another interface. */ +#define NF_IP6_FORWARD 2 +/* Packets coming from a local process. */ +#define NF_IP6_LOCAL_OUT 3 +/* Packets about to hit the wire. */ +#define NF_IP6_POST_ROUTING 4 +#define NF_IP6_NUMHOOKS 5 + + +enum nf_ip6_hook_priorities { + NF_IP6_PRI_FIRST = INT_MIN, + NF_IP6_PRI_CONNTRACK_DEFRAG = -400, + NF_IP6_PRI_SELINUX_FIRST = -225, + NF_IP6_PRI_CONNTRACK = -200, + NF_IP6_PRI_MANGLE = -150, + NF_IP6_PRI_NAT_DST = -100, + NF_IP6_PRI_FILTER = 0, + NF_IP6_PRI_SECURITY = 50, + NF_IP6_PRI_NAT_SRC = 100, + NF_IP6_PRI_SELINUX_LAST = 225, + NF_IP6_PRI_LAST = INT_MAX, +}; + + +#endif /*__LINUX_IP6_NETFILTER_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/..install.cmd new file mode 100644 index 0000000..4be891d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_ipv6/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter_ipv6 /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_ipv6 mips ip6_tables.h ip6t_HL.h ip6t_LOG.h ip6t_MARK.h ip6t_REJECT.h ip6t_ah.h ip6t_esp.h ip6t_frag.h ip6t_hl.h ip6t_ipv6header.h ip6t_length.h ip6t_limit.h ip6t_mac.h ip6t_mark.h ip6t_mh.h ip6t_multiport.h ip6t_opts.h ip6t_owner.h ip6t_physdev.h ip6t_policy.h ip6t_rt.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/netfilter_ipv6 /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_ipv6 mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/netfilter_ipv6/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6_tables.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6_tables.h new file mode 100644 index 0000000..70ed8a1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6_tables.h @@ -0,0 +1,297 @@ +/* + * 25-Jul-1998 Major changes to allow for ip chain table + * + * 3-Jan-2000 Named tables to allow packet selection for different uses. + */ + +/* + * Format of an IP6 firewall descriptor + * + * src, dst, src_mask, dst_mask are always stored in network byte order. + * flags are stored in host byte order (of course). + * Port numbers are stored in HOST byte order. + */ + +#ifndef _IP6_TABLES_H +#define _IP6_TABLES_H + +#include + +#include + +#include + +#define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN +#define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN + +#define ip6t_match xt_match +#define ip6t_target xt_target +#define ip6t_table xt_table +#define ip6t_get_revision xt_get_revision + +/* Yes, Virginia, you have to zero the padding. */ +struct ip6t_ip6 { + /* Source and destination IP6 addr */ + struct in6_addr src, dst; + /* Mask for src and dest IP6 addr */ + struct in6_addr smsk, dmsk; + char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; + unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; + + /* Upper protocol number + * - The allowed value is 0 (any) or protocol number of last parsable + * header, which is 50 (ESP), 59 (No Next Header), 135 (MH), or + * the non IPv6 extension headers. + * - The protocol numbers of IPv6 extension headers except of ESP and + * MH do not match any packets. + * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol. + */ + u_int16_t proto; + /* TOS to match iff flags & IP6T_F_TOS */ + u_int8_t tos; + + /* Flags word */ + u_int8_t flags; + /* Inverse flags */ + u_int8_t invflags; +}; + +#define ip6t_entry_match xt_entry_match +#define ip6t_entry_target xt_entry_target +#define ip6t_standard_target xt_standard_target + +#define ip6t_counters xt_counters + +/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ +#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper + protocols */ +#define IP6T_F_TOS 0x02 /* Match the TOS. */ +#define IP6T_F_GOTO 0x04 /* Set if jump is a goto */ +#define IP6T_F_MASK 0x07 /* All possible flag bits mask. */ + +/* Values for "inv" field in struct ip6t_ip6. */ +#define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ +#define IP6T_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ +#define IP6T_INV_TOS 0x04 /* Invert the sense of TOS. */ +#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ +#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ +#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */ +#define IP6T_INV_PROTO XT_INV_PROTO +#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */ + +/* This structure defines each of the firewall rules. Consists of 3 + parts which are 1) general IP header stuff 2) match specific + stuff 3) the target to perform if the rule matches */ +struct ip6t_entry +{ + struct ip6t_ip6 ipv6; + + /* Mark with fields that we care about. */ + unsigned int nfcache; + + /* Size of ipt_entry + matches */ + u_int16_t target_offset; + /* Size of ipt_entry + matches + target */ + u_int16_t next_offset; + + /* Back pointer */ + unsigned int comefrom; + + /* Packet and byte counters. */ + struct xt_counters counters; + + /* The matches (if any), then the target. */ + unsigned char elems[0]; +}; + +/* Standard entry */ +struct ip6t_standard +{ + struct ip6t_entry entry; + struct ip6t_standard_target target; +}; + +struct ip6t_error_target +{ + struct ip6t_entry_target target; + char errorname[IP6T_FUNCTION_MAXNAMELEN]; +}; + +struct ip6t_error +{ + struct ip6t_entry entry; + struct ip6t_error_target target; +}; + +#define IP6T_ENTRY_INIT(__size) \ +{ \ + .target_offset = sizeof(struct ip6t_entry), \ + .next_offset = (__size), \ +} + +#define IP6T_STANDARD_INIT(__verdict) \ +{ \ + .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \ + .target = XT_TARGET_INIT(IP6T_STANDARD_TARGET, \ + sizeof(struct ip6t_standard_target)), \ + .target.verdict = -(__verdict) - 1, \ +} + +#define IP6T_ERROR_INIT \ +{ \ + .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \ + .target = XT_TARGET_INIT(IP6T_ERROR_TARGET, \ + sizeof(struct ip6t_error_target)), \ + .target.errorname = "ERROR", \ +} + +/* + * New IP firewall options for [gs]etsockopt at the RAW IP level. + * Unlike BSD Linux inherits IP options so you don't have to use + * a raw socket for this. Instead we check rights in the calls. + * + * ATTENTION: check linux/in6.h before adding new number here. + */ +#define IP6T_BASE_CTL 64 + +#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL) +#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1) +#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS + +#define IP6T_SO_GET_INFO (IP6T_BASE_CTL) +#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1) +#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4) +#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5) +#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET + +/* CONTINUE verdict for targets */ +#define IP6T_CONTINUE XT_CONTINUE + +/* For standard target */ +#define IP6T_RETURN XT_RETURN + +/* TCP/UDP matching stuff */ +#include + +#define ip6t_tcp xt_tcp +#define ip6t_udp xt_udp + +/* Values for "inv" field in struct ipt_tcp. */ +#define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT +#define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT +#define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS +#define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION +#define IP6T_TCP_INV_MASK XT_TCP_INV_MASK + +/* Values for "invflags" field in struct ipt_udp. */ +#define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT +#define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT +#define IP6T_UDP_INV_MASK XT_UDP_INV_MASK + +/* ICMP matching stuff */ +struct ip6t_icmp +{ + u_int8_t type; /* type to match */ + u_int8_t code[2]; /* range of code */ + u_int8_t invflags; /* Inverse flags */ +}; + +/* Values for "inv" field for struct ipt_icmp. */ +#define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */ + +/* The argument to IP6T_SO_GET_INFO */ +struct ip6t_getinfo +{ + /* Which table: caller fills this in. */ + char name[IP6T_TABLE_MAXNAMELEN]; + + /* Kernel fills these in. */ + /* Which hook entry points are valid: bitmask */ + unsigned int valid_hooks; + + /* Hook entry points: one per netfilter hook. */ + unsigned int hook_entry[NF_INET_NUMHOOKS]; + + /* Underflow points. */ + unsigned int underflow[NF_INET_NUMHOOKS]; + + /* Number of entries */ + unsigned int num_entries; + + /* Size of entries. */ + unsigned int size; +}; + +/* The argument to IP6T_SO_SET_REPLACE. */ +struct ip6t_replace +{ + /* Which table. */ + char name[IP6T_TABLE_MAXNAMELEN]; + + /* Which hook entry points are valid: bitmask. You can't + change this. */ + unsigned int valid_hooks; + + /* Number of entries */ + unsigned int num_entries; + + /* Total size of new entries */ + unsigned int size; + + /* Hook entry points. */ + unsigned int hook_entry[NF_INET_NUMHOOKS]; + + /* Underflow points. */ + unsigned int underflow[NF_INET_NUMHOOKS]; + + /* Information about old entries: */ + /* Number of counters (must be equal to current number of entries). */ + unsigned int num_counters; + /* The old entries' counters. */ + struct xt_counters *counters; + + /* The entries (hang off end: not really an array). */ + struct ip6t_entry entries[0]; +}; + +/* The argument to IP6T_SO_ADD_COUNTERS. */ +#define ip6t_counters_info xt_counters_info + +/* The argument to IP6T_SO_GET_ENTRIES. */ +struct ip6t_get_entries +{ + /* Which table: user fills this in. */ + char name[IP6T_TABLE_MAXNAMELEN]; + + /* User fills this in: total entry size. */ + unsigned int size; + + /* The entries. */ + struct ip6t_entry entrytable[0]; +}; + +/* Standard return verdict, or do jump. */ +#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET +/* Error verdict. */ +#define IP6T_ERROR_TARGET XT_ERROR_TARGET + +/* Helper functions */ +static __inline__ struct ip6t_entry_target * +ip6t_get_target(struct ip6t_entry *e) +{ + return (void *)e + e->target_offset; +} + +/* fn returns 0 to continue iteration */ +#define IP6T_MATCH_ITERATE(e, fn, args...) \ + XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) + +/* fn returns 0 to continue iteration */ +#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ + XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) + +/* + * Main firewall chains definitions and global var's definitions. + */ + +#endif /* _IP6_TABLES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_HL.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_HL.h new file mode 100644 index 0000000..afb7813 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_HL.h @@ -0,0 +1,22 @@ +/* Hop Limit modification module for ip6tables + * Maciej Soltysiak + * Based on HW's TTL module */ + +#ifndef _IP6T_HL_H +#define _IP6T_HL_H + +enum { + IP6T_HL_SET = 0, + IP6T_HL_INC, + IP6T_HL_DEC +}; + +#define IP6T_HL_MAXMODE IP6T_HL_DEC + +struct ip6t_HL_info { + u_int8_t mode; + u_int8_t hop_limit; +}; + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_LOG.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_LOG.h new file mode 100644 index 0000000..0d0119b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_LOG.h @@ -0,0 +1,18 @@ +#ifndef _IP6T_LOG_H +#define _IP6T_LOG_H + +/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ +#define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ +#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ +#define IP6T_LOG_IPOPT 0x04 /* Log IP options */ +#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ +#define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */ +#define IP6T_LOG_MASK 0x1f + +struct ip6t_log_info { + unsigned char level; + unsigned char logflags; + char prefix[30]; +}; + +#endif /*_IPT_LOG_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_MARK.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_MARK.h new file mode 100644 index 0000000..7cf629a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_MARK.h @@ -0,0 +1,9 @@ +#ifndef _IP6T_MARK_H_target +#define _IP6T_MARK_H_target + +/* Backwards compatibility for old userspace */ +#include + +#define ip6t_mark_target_info xt_mark_target_info + +#endif /*_IP6T_MARK_H_target*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h new file mode 100644 index 0000000..6be6504 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h @@ -0,0 +1,18 @@ +#ifndef _IP6T_REJECT_H +#define _IP6T_REJECT_H + +enum ip6t_reject_with { + IP6T_ICMP6_NO_ROUTE, + IP6T_ICMP6_ADM_PROHIBITED, + IP6T_ICMP6_NOT_NEIGHBOUR, + IP6T_ICMP6_ADDR_UNREACH, + IP6T_ICMP6_PORT_UNREACH, + IP6T_ICMP6_ECHOREPLY, + IP6T_TCP_RESET +}; + +struct ip6t_reject_info { + u_int32_t with; /* reject type */ +}; + +#endif /*_IP6T_REJECT_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_ah.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_ah.h new file mode 100644 index 0000000..8531879 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_ah.h @@ -0,0 +1,21 @@ +#ifndef _IP6T_AH_H +#define _IP6T_AH_H + +struct ip6t_ah +{ + u_int32_t spis[2]; /* Security Parameter Index */ + u_int32_t hdrlen; /* Header Length */ + u_int8_t hdrres; /* Test of the Reserved Filed */ + u_int8_t invflags; /* Inverse flags */ +}; + +#define IP6T_AH_SPI 0x01 +#define IP6T_AH_LEN 0x02 +#define IP6T_AH_RES 0x04 + +/* Values for "invflags" field in struct ip6t_ah. */ +#define IP6T_AH_INV_SPI 0x01 /* Invert the sense of spi. */ +#define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ +#define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ + +#endif /*_IP6T_AH_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_esp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_esp.h new file mode 100644 index 0000000..f62eaf5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_esp.h @@ -0,0 +1,10 @@ +#ifndef _IP6T_ESP_H +#define _IP6T_ESP_H + +#include + +#define ip6t_esp xt_esp +#define IP6T_ESP_INV_SPI XT_ESP_INV_SPI +#define IP6T_ESP_INV_MASK XT_ESP_INV_MASK + +#endif /*_IP6T_ESP_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_frag.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_frag.h new file mode 100644 index 0000000..66070a0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_frag.h @@ -0,0 +1,24 @@ +#ifndef _IP6T_FRAG_H +#define _IP6T_FRAG_H + +struct ip6t_frag +{ + u_int32_t ids[2]; /* Security Parameter Index */ + u_int32_t hdrlen; /* Header Length */ + u_int8_t flags; /* */ + u_int8_t invflags; /* Inverse flags */ +}; + +#define IP6T_FRAG_IDS 0x01 +#define IP6T_FRAG_LEN 0x02 +#define IP6T_FRAG_RES 0x04 +#define IP6T_FRAG_FST 0x08 +#define IP6T_FRAG_MF 0x10 +#define IP6T_FRAG_NMF 0x20 + +/* Values for "invflags" field in struct ip6t_frag. */ +#define IP6T_FRAG_INV_IDS 0x01 /* Invert the sense of ids. */ +#define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ +#define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ + +#endif /*_IP6T_FRAG_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_hl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_hl.h new file mode 100644 index 0000000..5ef91b8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_hl.h @@ -0,0 +1,22 @@ +/* ip6tables module for matching the Hop Limit value + * Maciej Soltysiak + * Based on HW's ttl module */ + +#ifndef _IP6T_HL_H +#define _IP6T_HL_H + +enum { + IP6T_HL_EQ = 0, /* equals */ + IP6T_HL_NE, /* not equals */ + IP6T_HL_LT, /* less than */ + IP6T_HL_GT, /* greater than */ +}; + + +struct ip6t_hl_info { + u_int8_t mode; + u_int8_t hop_limit; +}; + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h new file mode 100644 index 0000000..51c53fc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h @@ -0,0 +1,27 @@ +/* ipv6header match - matches IPv6 packets based +on whether they contain certain headers */ + +/* Original idea: Brad Chapman + * Rewritten by: Andras Kis-Szabo */ + + +#ifndef __IPV6HEADER_H +#define __IPV6HEADER_H + +struct ip6t_ipv6header_info +{ + u_int8_t matchflags; + u_int8_t invflags; + u_int8_t modeflag; +}; + +#define MASK_HOPOPTS 128 +#define MASK_DSTOPTS 64 +#define MASK_ROUTING 32 +#define MASK_FRAGMENT 16 +#define MASK_AH 8 +#define MASK_ESP 4 +#define MASK_NONE 2 +#define MASK_PROTO 1 + +#endif /* __IPV6HEADER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_length.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_length.h new file mode 100644 index 0000000..9e9689d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_length.h @@ -0,0 +1,8 @@ +#ifndef _IP6T_LENGTH_H +#define _IP6T_LENGTH_H + +#include +#define ip6t_length_info xt_length_info + +#endif /*_IP6T_LENGTH_H*/ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_limit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_limit.h new file mode 100644 index 0000000..487e5ea --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_limit.h @@ -0,0 +1,8 @@ +#ifndef _IP6T_RATE_H +#define _IP6T_RATE_H + +#include +#define IP6T_LIMIT_SCALE XT_LIMIT_SCALE +#define ip6t_rateinfo xt_rateinfo + +#endif /*_IP6T_RATE_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mac.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mac.h new file mode 100644 index 0000000..ac58e83 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mac.h @@ -0,0 +1,7 @@ +#ifndef _IP6T_MAC_H +#define _IP6T_MAC_H + +#include +#define ip6t_mac_info xt_mac_info + +#endif /*_IP6T_MAC_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mark.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mark.h new file mode 100644 index 0000000..ff20495 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mark.h @@ -0,0 +1,9 @@ +#ifndef _IP6T_MARK_H +#define _IP6T_MARK_H + +/* Backwards compatibility for old userspace */ +#include + +#define ip6t_mark_info xt_mark_info + +#endif /*_IPT_MARK_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mh.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mh.h new file mode 100644 index 0000000..b9ca9a5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_mh.h @@ -0,0 +1,15 @@ +#ifndef _IP6T_MH_H +#define _IP6T_MH_H + +/* MH matching stuff */ +struct ip6t_mh +{ + u_int8_t types[2]; /* MH type range */ + u_int8_t invflags; /* Inverse flags */ +}; + +/* Values for "invflags" field in struct ip6t_mh. */ +#define IP6T_MH_INV_TYPE 0x01 /* Invert the sense of type. */ +#define IP6T_MH_INV_MASK 0x01 /* All possible flags. */ + +#endif /*_IP6T_MH_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_multiport.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_multiport.h new file mode 100644 index 0000000..042c926 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_multiport.h @@ -0,0 +1,14 @@ +#ifndef _IP6T_MULTIPORT_H +#define _IP6T_MULTIPORT_H + +#include + +#define IP6T_MULTIPORT_SOURCE XT_MULTIPORT_SOURCE +#define IP6T_MULTIPORT_DESTINATION XT_MULTIPORT_DESTINATION +#define IP6T_MULTIPORT_EITHER XT_MULTIPORT_EITHER + +#define IP6T_MULTI_PORTS XT_MULTI_PORTS + +#define ip6t_multiport xt_multiport + +#endif /*_IP6T_MULTIPORT_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_opts.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_opts.h new file mode 100644 index 0000000..a07e363 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_opts.h @@ -0,0 +1,23 @@ +#ifndef _IP6T_OPTS_H +#define _IP6T_OPTS_H + +#define IP6T_OPTS_OPTSNR 16 + +struct ip6t_opts +{ + u_int32_t hdrlen; /* Header Length */ + u_int8_t flags; /* */ + u_int8_t invflags; /* Inverse flags */ + u_int16_t opts[IP6T_OPTS_OPTSNR]; /* opts */ + u_int8_t optsnr; /* Nr of OPts */ +}; + +#define IP6T_OPTS_LEN 0x01 +#define IP6T_OPTS_OPTS 0x02 +#define IP6T_OPTS_NSTRICT 0x04 + +/* Values for "invflags" field in struct ip6t_rt. */ +#define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ +#define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ + +#endif /*_IP6T_OPTS_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_owner.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_owner.h new file mode 100644 index 0000000..ec5cc7a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_owner.h @@ -0,0 +1,18 @@ +#ifndef _IP6T_OWNER_H +#define _IP6T_OWNER_H + +/* match and invert flags */ +#define IP6T_OWNER_UID 0x01 +#define IP6T_OWNER_GID 0x02 +#define IP6T_OWNER_PID 0x04 +#define IP6T_OWNER_SID 0x08 + +struct ip6t_owner_info { + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_pid_t pid; + __kernel_pid_t sid; + u_int8_t match, invert; /* flags */ +}; + +#endif /*_IPT_OWNER_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_physdev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_physdev.h new file mode 100644 index 0000000..c161c0a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_physdev.h @@ -0,0 +1,17 @@ +#ifndef _IP6T_PHYSDEV_H +#define _IP6T_PHYSDEV_H + +/* Backwards compatibility for old userspace */ + +#include + +#define IP6T_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN +#define IP6T_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT +#define IP6T_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED +#define IP6T_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN +#define IP6T_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT +#define IP6T_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK + +#define ip6t_physdev_info xt_physdev_info + +#endif /*_IP6T_PHYSDEV_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_policy.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_policy.h new file mode 100644 index 0000000..b1c449d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_policy.h @@ -0,0 +1,23 @@ +#ifndef _IP6T_POLICY_H +#define _IP6T_POLICY_H + +#include + +#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM + +/* ip6t_policy_flags */ +#define IP6T_POLICY_MATCH_IN XT_POLICY_MATCH_IN +#define IP6T_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT +#define IP6T_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE +#define IP6T_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT + +/* ip6t_policy_modes */ +#define IP6T_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT +#define IP6T_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL + +#define ip6t_policy_spec xt_policy_spec +#define ip6t_policy_addr xt_policy_addr +#define ip6t_policy_elem xt_policy_elem +#define ip6t_policy_info xt_policy_info + +#endif /* _IP6T_POLICY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_rt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_rt.h new file mode 100644 index 0000000..5215602 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netfilter_ipv6/ip6t_rt.h @@ -0,0 +1,33 @@ +#ifndef _IP6T_RT_H +#define _IP6T_RT_H + +/*#include */ + +#define IP6T_RT_HOPS 16 + +struct ip6t_rt +{ + u_int32_t rt_type; /* Routing Type */ + u_int32_t segsleft[2]; /* Segments Left */ + u_int32_t hdrlen; /* Header Length */ + u_int8_t flags; /* */ + u_int8_t invflags; /* Inverse flags */ + struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ + u_int8_t addrnr; /* Nr of Addresses */ +}; + +#define IP6T_RT_TYP 0x01 +#define IP6T_RT_SGS 0x02 +#define IP6T_RT_LEN 0x04 +#define IP6T_RT_RES 0x08 +#define IP6T_RT_FST_MASK 0x30 +#define IP6T_RT_FST 0x10 +#define IP6T_RT_FST_NSTRICT 0x20 + +/* Values for "invflags" field in struct ip6t_rt. */ +#define IP6T_RT_INV_TYP 0x01 /* Invert the sense of type. */ +#define IP6T_RT_INV_SGS 0x02 /* Invert the sense of Segments. */ +#define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ +#define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ + +#endif /*_IP6T_RT_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netlink.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netlink.h new file mode 100644 index 0000000..ec780bb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netlink.h @@ -0,0 +1,155 @@ +#ifndef __LINUX_NETLINK_H +#define __LINUX_NETLINK_H + +#include /* for sa_family_t */ +#include + +#define NETLINK_ROUTE 0 /* Routing/device hook */ +#define NETLINK_UNUSED 1 /* Unused number */ +#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ +#define NETLINK_FIREWALL 3 /* Firewalling hook */ +#define NETLINK_INET_DIAG 4 /* INET socket monitoring */ +#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ +#define NETLINK_XFRM 6 /* ipsec */ +#define NETLINK_SELINUX 7 /* SELinux event notifications */ +#define NETLINK_ISCSI 8 /* Open-iSCSI */ +#define NETLINK_AUDIT 9 /* auditing */ +#define NETLINK_FIB_LOOKUP 10 +#define NETLINK_CONNECTOR 11 +#define NETLINK_NETFILTER 12 /* netfilter subsystem */ +#define NETLINK_IP6_FW 13 +#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ +#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ +#define NETLINK_GENERIC 16 +/* leave room for NETLINK_DM (DM Events) */ +#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ +#define NETLINK_ECRYPTFS 19 + +#define MAX_LINKS 32 + +struct net; + +struct sockaddr_nl +{ + sa_family_t nl_family; /* AF_NETLINK */ + unsigned short nl_pad; /* zero */ + __u32 nl_pid; /* port ID */ + __u32 nl_groups; /* multicast groups mask */ +}; + +struct nlmsghdr +{ + __u32 nlmsg_len; /* Length of message including header */ + __u16 nlmsg_type; /* Message content */ + __u16 nlmsg_flags; /* Additional flags */ + __u32 nlmsg_seq; /* Sequence number */ + __u32 nlmsg_pid; /* Sending process port ID */ +}; + +/* Flags values */ + +#define NLM_F_REQUEST 1 /* It is request message. */ +#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */ +#define NLM_F_ACK 4 /* Reply with ack, with zero or error code */ +#define NLM_F_ECHO 8 /* Echo this request */ + +/* Modifiers to GET request */ +#define NLM_F_ROOT 0x100 /* specify tree root */ +#define NLM_F_MATCH 0x200 /* return all matching */ +#define NLM_F_ATOMIC 0x400 /* atomic GET */ +#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) + +/* Modifiers to NEW request */ +#define NLM_F_REPLACE 0x100 /* Override existing */ +#define NLM_F_EXCL 0x200 /* Do not touch, if it exists */ +#define NLM_F_CREATE 0x400 /* Create, if it does not exist */ +#define NLM_F_APPEND 0x800 /* Add to end of list */ + +/* + 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL + 4.4BSD CHANGE NLM_F_REPLACE + + True CHANGE NLM_F_CREATE|NLM_F_REPLACE + Append NLM_F_CREATE + Check NLM_F_EXCL + */ + +#define NLMSG_ALIGNTO 4 +#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) +#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) +#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) +#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) +#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) +#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ + (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) +#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ + (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ + (nlh)->nlmsg_len <= (len)) +#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) + +#define NLMSG_NOOP 0x1 /* Nothing. */ +#define NLMSG_ERROR 0x2 /* Error */ +#define NLMSG_DONE 0x3 /* End of a dump */ +#define NLMSG_OVERRUN 0x4 /* Data lost */ + +#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ + +struct nlmsgerr +{ + int error; + struct nlmsghdr msg; +}; + +#define NETLINK_ADD_MEMBERSHIP 1 +#define NETLINK_DROP_MEMBERSHIP 2 +#define NETLINK_PKTINFO 3 +#define NETLINK_BROADCAST_ERROR 4 +#define NETLINK_NO_ENOBUFS 5 + +struct nl_pktinfo +{ + __u32 group; +}; + +#define NET_MAJOR 36 /* Major 36 is reserved for networking */ + +enum { + NETLINK_UNCONNECTED = 0, + NETLINK_CONNECTED, +}; + +/* + * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)--> + * +---------------------+- - -+- - - - - - - - - -+- - -+ + * | Header | Pad | Payload | Pad | + * | (struct nlattr) | ing | | ing | + * +---------------------+- - -+- - - - - - - - - -+- - -+ + * <-------------- nlattr->nla_len --------------> + */ + +struct nlattr +{ + __u16 nla_len; + __u16 nla_type; +}; + +/* + * nla_type (16 bits) + * +---+---+-------------------------------+ + * | N | O | Attribute Type | + * +---+---+-------------------------------+ + * N := Carries nested attributes + * O := Payload stored in network byte order + * + * Note: The N and O flag are mutually exclusive. + */ +#define NLA_F_NESTED (1 << 15) +#define NLA_F_NET_BYTEORDER (1 << 14) +#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) + +#define NLA_ALIGNTO 4 +#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) +#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) + + +#endif /* __LINUX_NETLINK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netrom.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netrom.h new file mode 100644 index 0000000..6939b32 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/netrom.h @@ -0,0 +1,34 @@ +/* + * These are the public elements of the Linux kernel NET/ROM implementation. + * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the + * definition of the ax25_address structure. + */ + +#ifndef NETROM_KERNEL_H +#define NETROM_KERNEL_H + +#define NETROM_MTU 236 + +#define NETROM_T1 1 +#define NETROM_T2 2 +#define NETROM_N2 3 +#define NETROM_T4 6 +#define NETROM_IDLE 7 + +#define SIOCNRDECOBS (SIOCPROTOPRIVATE+2) + +struct nr_route_struct { +#define NETROM_NEIGH 0 +#define NETROM_NODE 1 + int type; + ax25_address callsign; + char device[16]; + unsigned int quality; + char mnemonic[7]; + ax25_address neighbour; + unsigned int obs_count; + unsigned int ndigis; + ax25_address digipeaters[AX25_MAX_DIGIS]; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs.h new file mode 100644 index 0000000..e683d76 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs.h @@ -0,0 +1,128 @@ +/* + * NFS protocol definitions + * + * This file contains constants mostly for Version 2 of the protocol, + * but also has a couple of NFSv3 bits in (notably the error codes). + */ +#ifndef _LINUX_NFS_H +#define _LINUX_NFS_H + +#define NFS_PROGRAM 100003 +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_MAXGROUPS 16 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define NFS_FIFO_DEV (-1) +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_PORT 627 + +/* + * NFS stats. The good thing with these values is that NFSv3 errors are + * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which + * no-one uses anyway), so we can happily mix code as long as we make sure + * no NFSv3 errors are returned to NFSv2 clients. + * Error codes that have a `--' in the v2 column are not part of the + * standard, but seem to be widely used nevertheless. + */ + enum nfs_stat { + NFS_OK = 0, /* v2 v3 v4 */ + NFSERR_PERM = 1, /* v2 v3 v4 */ + NFSERR_NOENT = 2, /* v2 v3 v4 */ + NFSERR_IO = 5, /* v2 v3 v4 */ + NFSERR_NXIO = 6, /* v2 v3 v4 */ + NFSERR_EAGAIN = 11, /* v2 v3 */ + NFSERR_ACCES = 13, /* v2 v3 v4 */ + NFSERR_EXIST = 17, /* v2 v3 v4 */ + NFSERR_XDEV = 18, /* v3 v4 */ + NFSERR_NODEV = 19, /* v2 v3 v4 */ + NFSERR_NOTDIR = 20, /* v2 v3 v4 */ + NFSERR_ISDIR = 21, /* v2 v3 v4 */ + NFSERR_INVAL = 22, /* v2 v3 v4 */ + NFSERR_FBIG = 27, /* v2 v3 v4 */ + NFSERR_NOSPC = 28, /* v2 v3 v4 */ + NFSERR_ROFS = 30, /* v2 v3 v4 */ + NFSERR_MLINK = 31, /* v3 v4 */ + NFSERR_OPNOTSUPP = 45, /* v2 v3 */ + NFSERR_NAMETOOLONG = 63, /* v2 v3 v4 */ + NFSERR_NOTEMPTY = 66, /* v2 v3 v4 */ + NFSERR_DQUOT = 69, /* v2 v3 v4 */ + NFSERR_STALE = 70, /* v2 v3 v4 */ + NFSERR_REMOTE = 71, /* v2 v3 */ + NFSERR_WFLUSH = 99, /* v2 */ + NFSERR_BADHANDLE = 10001, /* v3 v4 */ + NFSERR_NOT_SYNC = 10002, /* v3 */ + NFSERR_BAD_COOKIE = 10003, /* v3 v4 */ + NFSERR_NOTSUPP = 10004, /* v3 v4 */ + NFSERR_TOOSMALL = 10005, /* v3 v4 */ + NFSERR_SERVERFAULT = 10006, /* v3 v4 */ + NFSERR_BADTYPE = 10007, /* v3 v4 */ + NFSERR_JUKEBOX = 10008, /* v3 v4 */ + NFSERR_SAME = 10009, /* v4 */ + NFSERR_DENIED = 10010, /* v4 */ + NFSERR_EXPIRED = 10011, /* v4 */ + NFSERR_LOCKED = 10012, /* v4 */ + NFSERR_GRACE = 10013, /* v4 */ + NFSERR_FHEXPIRED = 10014, /* v4 */ + NFSERR_SHARE_DENIED = 10015, /* v4 */ + NFSERR_WRONGSEC = 10016, /* v4 */ + NFSERR_CLID_INUSE = 10017, /* v4 */ + NFSERR_RESOURCE = 10018, /* v4 */ + NFSERR_MOVED = 10019, /* v4 */ + NFSERR_NOFILEHANDLE = 10020, /* v4 */ + NFSERR_MINOR_VERS_MISMATCH = 10021, /* v4 */ + NFSERR_STALE_CLIENTID = 10022, /* v4 */ + NFSERR_STALE_STATEID = 10023, /* v4 */ + NFSERR_OLD_STATEID = 10024, /* v4 */ + NFSERR_BAD_STATEID = 10025, /* v4 */ + NFSERR_BAD_SEQID = 10026, /* v4 */ + NFSERR_NOT_SAME = 10027, /* v4 */ + NFSERR_LOCK_RANGE = 10028, /* v4 */ + NFSERR_SYMLINK = 10029, /* v4 */ + NFSERR_RESTOREFH = 10030, /* v4 */ + NFSERR_LEASE_MOVED = 10031, /* v4 */ + NFSERR_ATTRNOTSUPP = 10032, /* v4 */ + NFSERR_NO_GRACE = 10033, /* v4 */ + NFSERR_RECLAIM_BAD = 10034, /* v4 */ + NFSERR_RECLAIM_CONFLICT = 10035,/* v4 */ + NFSERR_BAD_XDR = 10036, /* v4 */ + NFSERR_LOCKS_HELD = 10037, /* v4 */ + NFSERR_OPENMODE = 10038, /* v4 */ + NFSERR_BADOWNER = 10039, /* v4 */ + NFSERR_BADCHAR = 10040, /* v4 */ + NFSERR_BADNAME = 10041, /* v4 */ + NFSERR_BAD_RANGE = 10042, /* v4 */ + NFSERR_LOCK_NOTSUPP = 10043, /* v4 */ + NFSERR_OP_ILLEGAL = 10044, /* v4 */ + NFSERR_DEADLOCK = 10045, /* v4 */ + NFSERR_FILE_OPEN = 10046, /* v4 */ + NFSERR_ADMIN_REVOKED = 10047, /* v4 */ + NFSERR_CB_PATH_DOWN = 10048, /* v4 */ +}; + +/* NFSv2 file types - beware, these are not the same in NFSv3 */ + +enum nfs_ftype { + NFNON = 0, + NFREG = 1, + NFDIR = 2, + NFBLK = 3, + NFCHR = 4, + NFLNK = 5, + NFSOCK = 6, + NFBAD = 7, + NFFIFO = 8 +}; + +#endif /* _LINUX_NFS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs2.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs2.h new file mode 100644 index 0000000..0ed9517 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs2.h @@ -0,0 +1,74 @@ +/* + * NFS protocol definitions + * + * This file contains constants for Version 2 of the protocol. + */ +#ifndef _LINUX_NFS2_H +#define _LINUX_NFS2_H + +#define NFS2_PORT 2049 +#define NFS2_MAXDATA 8192 +#define NFS2_MAXPATHLEN 1024 +#define NFS2_MAXNAMLEN 255 +#define NFS2_MAXGROUPS 16 +#define NFS2_FHSIZE 32 +#define NFS2_COOKIESIZE 4 +#define NFS2_FIFO_DEV (-1) +#define NFS2MODE_FMT 0170000 +#define NFS2MODE_DIR 0040000 +#define NFS2MODE_CHR 0020000 +#define NFS2MODE_BLK 0060000 +#define NFS2MODE_REG 0100000 +#define NFS2MODE_LNK 0120000 +#define NFS2MODE_SOCK 0140000 +#define NFS2MODE_FIFO 0010000 + + +/* NFSv2 file types - beware, these are not the same in NFSv3 */ +enum nfs2_ftype { + NF2NON = 0, + NF2REG = 1, + NF2DIR = 2, + NF2BLK = 3, + NF2CHR = 4, + NF2LNK = 5, + NF2SOCK = 6, + NF2BAD = 7, + NF2FIFO = 8 +}; + +struct nfs2_fh { + char data[NFS2_FHSIZE]; +}; + +/* + * Procedure numbers for NFSv2 + */ +#define NFS2_VERSION 2 +#define NFSPROC_NULL 0 +#define NFSPROC_GETATTR 1 +#define NFSPROC_SETATTR 2 +#define NFSPROC_ROOT 3 +#define NFSPROC_LOOKUP 4 +#define NFSPROC_READLINK 5 +#define NFSPROC_READ 6 +#define NFSPROC_WRITECACHE 7 +#define NFSPROC_WRITE 8 +#define NFSPROC_CREATE 9 +#define NFSPROC_REMOVE 10 +#define NFSPROC_RENAME 11 +#define NFSPROC_LINK 12 +#define NFSPROC_SYMLINK 13 +#define NFSPROC_MKDIR 14 +#define NFSPROC_RMDIR 15 +#define NFSPROC_READDIR 16 +#define NFSPROC_STATFS 17 + +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_VERSION 1 +#define MNTPROC_NULL 0 +#define MNTPROC_MNT 1 +#define MNTPROC_UMNT 3 +#define MNTPROC_UMNTALL 4 + +#endif /* _LINUX_NFS2_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs3.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs3.h new file mode 100644 index 0000000..7d0225a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs3.h @@ -0,0 +1,99 @@ +/* + * NFSv3 protocol definitions + */ +#ifndef _LINUX_NFS3_H +#define _LINUX_NFS3_H + +#define NFS3_PORT 2049 +#define NFS3_MAXDATA 32768 +#define NFS3_MAXPATHLEN PATH_MAX +#define NFS3_MAXNAMLEN NAME_MAX +#define NFS3_MAXGROUPS 16 +#define NFS3_FHSIZE 64 +#define NFS3_COOKIESIZE 4 +#define NFS3_FIFO_DEV (-1) +#define NFS3MODE_FMT 0170000 +#define NFS3MODE_DIR 0040000 +#define NFS3MODE_CHR 0020000 +#define NFS3MODE_BLK 0060000 +#define NFS3MODE_REG 0100000 +#define NFS3MODE_LNK 0120000 +#define NFS3MODE_SOCK 0140000 +#define NFS3MODE_FIFO 0010000 + +/* Flags for access() call */ +#define NFS3_ACCESS_READ 0x0001 +#define NFS3_ACCESS_LOOKUP 0x0002 +#define NFS3_ACCESS_MODIFY 0x0004 +#define NFS3_ACCESS_EXTEND 0x0008 +#define NFS3_ACCESS_DELETE 0x0010 +#define NFS3_ACCESS_EXECUTE 0x0020 +#define NFS3_ACCESS_FULL 0x003f + +/* Flags for create mode */ +enum nfs3_createmode { + NFS3_CREATE_UNCHECKED = 0, + NFS3_CREATE_GUARDED = 1, + NFS3_CREATE_EXCLUSIVE = 2 +}; + +/* NFSv3 file system properties */ +#define NFS3_FSF_LINK 0x0001 +#define NFS3_FSF_SYMLINK 0x0002 +#define NFS3_FSF_HOMOGENEOUS 0x0008 +#define NFS3_FSF_CANSETTIME 0x0010 +/* Some shorthands. See fs/nfsd/nfs3proc.c */ +#define NFS3_FSF_DEFAULT 0x001B +#define NFS3_FSF_BILLYBOY 0x0018 +#define NFS3_FSF_READONLY 0x0008 + +enum nfs3_ftype { + NF3NON = 0, + NF3REG = 1, + NF3DIR = 2, + NF3BLK = 3, + NF3CHR = 4, + NF3LNK = 5, + NF3SOCK = 6, + NF3FIFO = 7, /* changed from NFSv2 (was 8) */ + NF3BAD = 8 +}; + +struct nfs3_fh { + unsigned short size; + unsigned char data[NFS3_FHSIZE]; +}; + +#define NFS3_VERSION 3 +#define NFS3PROC_NULL 0 +#define NFS3PROC_GETATTR 1 +#define NFS3PROC_SETATTR 2 +#define NFS3PROC_LOOKUP 3 +#define NFS3PROC_ACCESS 4 +#define NFS3PROC_READLINK 5 +#define NFS3PROC_READ 6 +#define NFS3PROC_WRITE 7 +#define NFS3PROC_CREATE 8 +#define NFS3PROC_MKDIR 9 +#define NFS3PROC_SYMLINK 10 +#define NFS3PROC_MKNOD 11 +#define NFS3PROC_REMOVE 12 +#define NFS3PROC_RMDIR 13 +#define NFS3PROC_RENAME 14 +#define NFS3PROC_LINK 15 +#define NFS3PROC_READDIR 16 +#define NFS3PROC_READDIRPLUS 17 +#define NFS3PROC_FSSTAT 18 +#define NFS3PROC_FSINFO 19 +#define NFS3PROC_PATHCONF 20 +#define NFS3PROC_COMMIT 21 + +#define NFS_MNT3_PROGRAM 100005 +#define NFS_MNT3_VERSION 3 +#define MOUNTPROC3_NULL 0 +#define MOUNTPROC3_MNT 1 +#define MOUNTPROC3_UMNT 3 +#define MOUNTPROC3_UMNTALL 4 + + +#endif /* _LINUX_NFS3_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs4.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs4.h new file mode 100644 index 0000000..371f21b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs4.h @@ -0,0 +1,146 @@ +/* + * include/linux/nfs4.h + * + * NFSv4 protocol definitions. + * + * Copyright (c) 2002 The Regents of the University of Michigan. + * All rights reserved. + * + * Kendrick Smith + * Andy Adamson + */ + +#ifndef _LINUX_NFS4_H +#define _LINUX_NFS4_H + +#include + +#define NFS4_BITMAP_SIZE 2 +#define NFS4_VERIFIER_SIZE 8 +#define NFS4_STATEID_SIZE 16 +#define NFS4_FHSIZE 128 +#define NFS4_MAXPATHLEN PATH_MAX +#define NFS4_MAXNAMLEN NAME_MAX +#define NFS4_MAX_SESSIONID_LEN 16 + +#define NFS4_ACCESS_READ 0x0001 +#define NFS4_ACCESS_LOOKUP 0x0002 +#define NFS4_ACCESS_MODIFY 0x0004 +#define NFS4_ACCESS_EXTEND 0x0008 +#define NFS4_ACCESS_DELETE 0x0010 +#define NFS4_ACCESS_EXECUTE 0x0020 + +#define NFS4_FH_PERSISTENT 0x0000 +#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 +#define NFS4_FH_VOLATILE_ANY 0x0002 +#define NFS4_FH_VOL_MIGRATION 0x0004 +#define NFS4_FH_VOL_RENAME 0x0008 + +#define NFS4_OPEN_RESULT_CONFIRM 0x0002 +#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 + +#define NFS4_SHARE_ACCESS_MASK 0x000F +#define NFS4_SHARE_ACCESS_READ 0x0001 +#define NFS4_SHARE_ACCESS_WRITE 0x0002 +#define NFS4_SHARE_ACCESS_BOTH 0x0003 +#define NFS4_SHARE_DENY_READ 0x0001 +#define NFS4_SHARE_DENY_WRITE 0x0002 +#define NFS4_SHARE_DENY_BOTH 0x0003 + +/* nfs41 */ +#define NFS4_SHARE_WANT_MASK 0xFF00 +#define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000 +#define NFS4_SHARE_WANT_READ_DELEG 0x0100 +#define NFS4_SHARE_WANT_WRITE_DELEG 0x0200 +#define NFS4_SHARE_WANT_ANY_DELEG 0x0300 +#define NFS4_SHARE_WANT_NO_DELEG 0x0400 +#define NFS4_SHARE_WANT_CANCEL 0x0500 + +#define NFS4_SHARE_WHEN_MASK 0xF0000 +#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000 +#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000 + +#define NFS4_SET_TO_SERVER_TIME 0 +#define NFS4_SET_TO_CLIENT_TIME 1 + +#define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0 +#define NFS4_ACE_ACCESS_DENIED_ACE_TYPE 1 +#define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2 +#define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3 + +#define ACL4_SUPPORT_ALLOW_ACL 0x01 +#define ACL4_SUPPORT_DENY_ACL 0x02 +#define ACL4_SUPPORT_AUDIT_ACL 0x04 +#define ACL4_SUPPORT_ALARM_ACL 0x08 + +#define NFS4_ACE_FILE_INHERIT_ACE 0x00000001 +#define NFS4_ACE_DIRECTORY_INHERIT_ACE 0x00000002 +#define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004 +#define NFS4_ACE_INHERIT_ONLY_ACE 0x00000008 +#define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 +#define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 +#define NFS4_ACE_IDENTIFIER_GROUP 0x00000040 + +#define NFS4_ACE_READ_DATA 0x00000001 +#define NFS4_ACE_LIST_DIRECTORY 0x00000001 +#define NFS4_ACE_WRITE_DATA 0x00000002 +#define NFS4_ACE_ADD_FILE 0x00000002 +#define NFS4_ACE_APPEND_DATA 0x00000004 +#define NFS4_ACE_ADD_SUBDIRECTORY 0x00000004 +#define NFS4_ACE_READ_NAMED_ATTRS 0x00000008 +#define NFS4_ACE_WRITE_NAMED_ATTRS 0x00000010 +#define NFS4_ACE_EXECUTE 0x00000020 +#define NFS4_ACE_DELETE_CHILD 0x00000040 +#define NFS4_ACE_READ_ATTRIBUTES 0x00000080 +#define NFS4_ACE_WRITE_ATTRIBUTES 0x00000100 +#define NFS4_ACE_DELETE 0x00010000 +#define NFS4_ACE_READ_ACL 0x00020000 +#define NFS4_ACE_WRITE_ACL 0x00040000 +#define NFS4_ACE_WRITE_OWNER 0x00080000 +#define NFS4_ACE_SYNCHRONIZE 0x00100000 +#define NFS4_ACE_GENERIC_READ 0x00120081 +#define NFS4_ACE_GENERIC_WRITE 0x00160106 +#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 +#define NFS4_ACE_MASK_ALL 0x001F01FF + +#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001 +#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002 +#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000 +#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000 +#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000 +#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000 +#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 +/* + * Since the validity of these bits depends on whether + * they're set in the argument or response, have separate + * invalid flag masks for arg (_A) and resp (_R). + */ +#define EXCHGID4_FLAG_MASK_A 0x40070003 +#define EXCHGID4_FLAG_MASK_R 0x80070003 + +#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001 +#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002 +#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004 +#define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008 +#define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010 +#define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020 +#define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 +#define SEQ4_STATUS_LEASE_MOVED 0x00000080 +#define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 + +#define NFS4_MAX_UINT64 (~(u64)0) + +enum nfs4_acl_whotype { + NFS4_ACL_WHO_NAMED = 0, + NFS4_ACL_WHO_OWNER, + NFS4_ACL_WHO_GROUP, + NFS4_ACL_WHO_EVERYONE, +}; + +#endif + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs4_mount.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs4_mount.h new file mode 100644 index 0000000..f4ff32d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs4_mount.h @@ -0,0 +1,71 @@ +#ifndef _LINUX_NFS4_MOUNT_H +#define _LINUX_NFS4_MOUNT_H + +/* + * linux/include/linux/nfs4_mount.h + * + * Copyright (C) 2002 Trond Myklebust + * + * structure passed from user-space to kernel-space during an nfsv4 mount + */ + +/* + * WARNING! Do not delete or change the order of these fields. If + * a new field is required then add it to the end. The version field + * tracks which fields are present. This will ensure some measure of + * mount-to-kernel version compatibility. Some of these aren't used yet + * but here they are anyway. + */ +#define NFS4_MOUNT_VERSION 1 + +struct nfs_string { + unsigned int len; + const char * data; +}; + +struct nfs4_mount_data { + int version; /* 1 */ + int flags; /* 1 */ + int rsize; /* 1 */ + int wsize; /* 1 */ + int timeo; /* 1 */ + int retrans; /* 1 */ + int acregmin; /* 1 */ + int acregmax; /* 1 */ + int acdirmin; /* 1 */ + int acdirmax; /* 1 */ + + /* see the definition of 'struct clientaddr4' in RFC3010 */ + struct nfs_string client_addr; /* 1 */ + + /* Mount path */ + struct nfs_string mnt_path; /* 1 */ + + /* Server details */ + struct nfs_string hostname; /* 1 */ + /* Server IP address */ + unsigned int host_addrlen; /* 1 */ + struct sockaddr * host_addr; /* 1 */ + + /* Transport protocol to use */ + int proto; /* 1 */ + + /* Pseudo-flavours to use for authentication. See RFC2623 */ + int auth_flavourlen; /* 1 */ + int *auth_flavours; /* 1 */ +}; + +/* bits in the flags field */ +/* Note: the fields that correspond to existing NFSv2/v3 mount options + * should mirror the values from include/linux/nfs_mount.h + */ + +#define NFS4_MOUNT_SOFT 0x0001 /* 1 */ +#define NFS4_MOUNT_INTR 0x0002 /* 1 */ +#define NFS4_MOUNT_NOCTO 0x0010 /* 1 */ +#define NFS4_MOUNT_NOAC 0x0020 /* 1 */ +#define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */ +#define NFS4_MOUNT_UNSHARED 0x8000 /* 1 */ +#define NFS4_MOUNT_FLAGMASK 0x9033 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_fs.h new file mode 100644 index 0000000..534aeee --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_fs.h @@ -0,0 +1,59 @@ +/* + * linux/include/linux/nfs_fs.h + * + * Copyright (C) 1992 Rick Sladkey + * + * OS-specific nfs filesystem definitions and declarations + */ + +#ifndef _LINUX_NFS_FS_H +#define _LINUX_NFS_FS_H + +#include + +/* Default timeout values */ +#define NFS_DEF_UDP_TIMEO (11) +#define NFS_DEF_UDP_RETRANS (3) +#define NFS_DEF_TCP_TIMEO (600) +#define NFS_DEF_TCP_RETRANS (2) + +#define NFS_MAX_UDP_TIMEOUT (60*HZ) +#define NFS_MAX_TCP_TIMEOUT (600*HZ) + +#define NFS_DEF_ACREGMIN (3) +#define NFS_DEF_ACREGMAX (60) +#define NFS_DEF_ACDIRMIN (30) +#define NFS_DEF_ACDIRMAX (60) + +/* + * When flushing a cluster of dirty pages, there can be different + * strategies: + */ +#define FLUSH_SYNC 1 /* file being synced, or contention */ +#define FLUSH_STABLE 4 /* commit to stable storage */ +#define FLUSH_LOWPRI 8 /* low priority background flush */ +#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ +#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ +#define FLUSH_INVALIDATE 64 /* Invalidate the page cache */ +#define FLUSH_NOWRITEPAGE 128 /* Don't call writepage() */ + + +/* + * NFS debug flags + */ +#define NFSDBG_VFS 0x0001 +#define NFSDBG_DIRCACHE 0x0002 +#define NFSDBG_LOOKUPCACHE 0x0004 +#define NFSDBG_PAGECACHE 0x0008 +#define NFSDBG_PROC 0x0010 +#define NFSDBG_XDR 0x0020 +#define NFSDBG_FILE 0x0040 +#define NFSDBG_ROOT 0x0080 +#define NFSDBG_CALLBACK 0x0100 +#define NFSDBG_CLIENT 0x0200 +#define NFSDBG_MOUNT 0x0400 +#define NFSDBG_FSCACHE 0x0800 +#define NFSDBG_ALL 0xFFFF + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_idmap.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_idmap.h new file mode 100644 index 0000000..05f843c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_idmap.h @@ -0,0 +1,65 @@ +/* + * include/linux/nfs_idmap.h + * + * UID and GID to name mapping for clients. + * + * Copyright (c) 2002 The Regents of the University of Michigan. + * All rights reserved. + * + * Marius Aamodt Eriksen + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NFS_IDMAP_H +#define NFS_IDMAP_H + +#include + +/* XXX from bits/utmp.h */ +#define IDMAP_NAMESZ 128 + +#define IDMAP_TYPE_USER 0 +#define IDMAP_TYPE_GROUP 1 + +#define IDMAP_CONV_IDTONAME 0 +#define IDMAP_CONV_NAMETOID 1 + +#define IDMAP_STATUS_INVALIDMSG 0x01 +#define IDMAP_STATUS_AGAIN 0x02 +#define IDMAP_STATUS_LOOKUPFAIL 0x04 +#define IDMAP_STATUS_SUCCESS 0x08 + +struct idmap_msg { + __u8 im_type; + __u8 im_conv; + char im_name[IDMAP_NAMESZ]; + __u32 im_id; + __u8 im_status; +}; + + +#endif /* NFS_IDMAP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_mount.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_mount.h new file mode 100644 index 0000000..4499016 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfs_mount.h @@ -0,0 +1,73 @@ +#ifndef _LINUX_NFS_MOUNT_H +#define _LINUX_NFS_MOUNT_H + +/* + * linux/include/linux/nfs_mount.h + * + * Copyright (C) 1992 Rick Sladkey + * + * structure passed from user-space to kernel-space during an nfs mount + */ +#include +#include +#include +#include + +/* + * WARNING! Do not delete or change the order of these fields. If + * a new field is required then add it to the end. The version field + * tracks which fields are present. This will ensure some measure of + * mount-to-kernel version compatibility. Some of these aren't used yet + * but here they are anyway. + */ +#define NFS_MOUNT_VERSION 6 +#define NFS_MAX_CONTEXT_LEN 256 + +struct nfs_mount_data { + int version; /* 1 */ + int fd; /* 1 */ + struct nfs2_fh old_root; /* 1 */ + int flags; /* 1 */ + int rsize; /* 1 */ + int wsize; /* 1 */ + int timeo; /* 1 */ + int retrans; /* 1 */ + int acregmin; /* 1 */ + int acregmax; /* 1 */ + int acdirmin; /* 1 */ + int acdirmax; /* 1 */ + struct sockaddr_in addr; /* 1 */ + char hostname[NFS_MAXNAMLEN + 1]; /* 1 */ + int namlen; /* 2 */ + unsigned int bsize; /* 3 */ + struct nfs3_fh root; /* 4 */ + int pseudoflavor; /* 5 */ + char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */ +}; + +/* bits in the flags field visible to user space */ + +#define NFS_MOUNT_SOFT 0x0001 /* 1 */ +#define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */ +#define NFS_MOUNT_SECURE 0x0004 /* 1 */ +#define NFS_MOUNT_POSIX 0x0008 /* 1 */ +#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ +#define NFS_MOUNT_NOAC 0x0020 /* 1 */ +#define NFS_MOUNT_TCP 0x0040 /* 2 */ +#define NFS_MOUNT_VER3 0x0080 /* 3 */ +#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ +#define NFS_MOUNT_NONLM 0x0200 /* 3 */ +#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ +#define NFS_MOUNT_NOACL 0x0800 /* 4 */ +#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ +#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ +#define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ +#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ +#define NFS_MOUNT_FLAGMASK 0xFFFF + +/* The following are for internal use only */ +#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 +#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 +#define NFS_MOUNT_NORESVPORT 0x40000 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsacl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsacl.h new file mode 100644 index 0000000..df5e19f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsacl.h @@ -0,0 +1,29 @@ +/* + * File: linux/nfsacl.h + * + * (C) 2003 Andreas Gruenbacher + */ +#ifndef __LINUX_NFSACL_H +#define __LINUX_NFSACL_H + +#define NFS_ACL_PROGRAM 100227 + +#define ACLPROC2_GETACL 1 +#define ACLPROC2_SETACL 2 +#define ACLPROC2_GETATTR 3 +#define ACLPROC2_ACCESS 4 + +#define ACLPROC3_GETACL 1 +#define ACLPROC3_SETACL 2 + + +/* Flags for the getacl/setacl mode */ +#define NFS_ACL 0x0001 +#define NFS_ACLCNT 0x0002 +#define NFS_DFACL 0x0004 +#define NFS_DFACLCNT 0x0008 + +/* Flag for Default ACL entries */ +#define NFS_ACL_DEFAULT 0x1000 + +#endif /* __LINUX_NFSACL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/..install.cmd new file mode 100644 index 0000000..93ae1ae --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/nfsd/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/nfsd /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/nfsd mips const.h debug.h export.h nfsfh.h stats.h syscall.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/nfsd /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/nfsd mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/nfsd/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/const.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/const.h new file mode 100644 index 0000000..22ffb9a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/const.h @@ -0,0 +1,30 @@ +/* + * include/linux/nfsd/const.h + * + * Various constants related to NFS. + * + * Copyright (C) 1995-1997 Olaf Kirch + */ + +#ifndef _LINUX_NFSD_CONST_H +#define _LINUX_NFSD_CONST_H + +#include +#include +#include +#include + +/* + * Maximum protocol version supported by knfsd + */ +#define NFSSVC_MAXVERS 3 + +/* + * Maximum blocksizes supported by daemon under various circumstances. + */ +#define NFSSVC_MAXBLKSIZE RPCSVC_MAXPAYLOAD +/* NFSv2 is limited by the protocol specification, see RFC 1094 */ +#define NFSSVC_MAXBLKSIZE_V2 (8*1024) + + +#endif /* _LINUX_NFSD_CONST_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/debug.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/debug.h new file mode 100644 index 0000000..7d58c12 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/debug.h @@ -0,0 +1,40 @@ +/* + * linux/include/linux/nfsd/debug.h + * + * Debugging-related stuff for nfsd + * + * Copyright (C) 1995 Olaf Kirch + */ + +#ifndef LINUX_NFSD_DEBUG_H +#define LINUX_NFSD_DEBUG_H + +#include + +/* + * Enable debugging for nfsd. + * Requires RPC_DEBUG. + */ +#ifdef RPC_DEBUG +# define NFSD_DEBUG 1 +#endif + +/* + * knfsd debug flags + */ +#define NFSDDBG_SOCK 0x0001 +#define NFSDDBG_FH 0x0002 +#define NFSDDBG_EXPORT 0x0004 +#define NFSDDBG_SVC 0x0008 +#define NFSDDBG_PROC 0x0010 +#define NFSDDBG_FILEOP 0x0020 +#define NFSDDBG_AUTH 0x0040 +#define NFSDDBG_REPCACHE 0x0080 +#define NFSDDBG_XDR 0x0100 +#define NFSDDBG_LOCKD 0x0200 +#define NFSDDBG_ALL 0x7FFF +#define NFSDDBG_NOCHANGE 0xFFFF + + + +#endif /* LINUX_NFSD_DEBUG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/export.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/export.h new file mode 100644 index 0000000..8429a17 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/export.h @@ -0,0 +1,47 @@ +/* + * include/linux/nfsd/export.h + * + * Public declarations for NFS exports. The definitions for the + * syscall interface are in nfsctl.h + * + * Copyright (C) 1995-1997 Olaf Kirch + */ + +#ifndef NFSD_EXPORT_H +#define NFSD_EXPORT_H + +# include + +/* + * Important limits for the exports stuff. + */ +#define NFSCLNT_IDMAX 1024 +#define NFSCLNT_ADDRMAX 16 +#define NFSCLNT_KEYMAX 32 + +/* + * Export flags. + */ +#define NFSEXP_READONLY 0x0001 +#define NFSEXP_INSECURE_PORT 0x0002 +#define NFSEXP_ROOTSQUASH 0x0004 +#define NFSEXP_ALLSQUASH 0x0008 +#define NFSEXP_ASYNC 0x0010 +#define NFSEXP_GATHERED_WRITES 0x0020 +/* 40 80 100 currently unused */ +#define NFSEXP_NOHIDE 0x0200 +#define NFSEXP_NOSUBTREECHECK 0x0400 +#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ +#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect */ +#define NFSEXP_FSID 0x2000 +#define NFSEXP_CROSSMOUNT 0x4000 +#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ +#define NFSEXP_ALLFLAGS 0xFE3F + +/* The flags that may vary depending on security flavor: */ +#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ + | NFSEXP_ALLSQUASH) + + +#endif /* NFSD_EXPORT_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/nfsfh.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/nfsfh.h new file mode 100644 index 0000000..043273c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/nfsfh.h @@ -0,0 +1,120 @@ +/* + * include/linux/nfsd/nfsfh.h + * + * This file describes the layout of the file handles as passed + * over the wire. + * + * Earlier versions of knfsd used to sign file handles using keyed MD5 + * or SHA. I've removed this code, because it doesn't give you more + * security than blocking external access to port 2049 on your firewall. + * + * Copyright (C) 1995, 1996, 1997 Olaf Kirch + */ + +#ifndef _LINUX_NFSD_FH_H +#define _LINUX_NFSD_FH_H + +# include +#include +#include + +/* + * This is the old "dentry style" Linux NFSv2 file handle. + * + * The xino and xdev fields are currently used to transport the + * ino/dev of the exported inode. + */ +struct nfs_fhbase_old { + __u32 fb_dcookie; /* dentry cookie - always 0xfeebbaca */ + __u32 fb_ino; /* our inode number */ + __u32 fb_dirino; /* dir inode number, 0 for directories */ + __u32 fb_dev; /* our device */ + __u32 fb_xdev; + __u32 fb_xino; + __u32 fb_generation; +}; + +/* + * This is the new flexible, extensible style NFSv2/v3 file handle. + * by Neil Brown - March 2000 + * + * The file handle is seens as a list of 4byte words. + * The first word contains a version number (1) and four descriptor bytes + * that tell how the remaining 3 variable length fields should be handled. + * These three bytes are auth_type, fsid_type and fileid_type. + * + * All 4byte values are in host-byte-order. + * + * The auth_type field specifies how the filehandle can be authenticated + * This might allow a file to be confirmed to be in a writable part of a + * filetree without checking the path from it upto the root. + * Current values: + * 0 - No authentication. fb_auth is 0 bytes long + * Possible future values: + * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle + * prefixed by a secret and with the important export flags. + * + * The fsid_type identifies how the filesystem (or export point) is + * encoded. + * Current values: + * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number + * NOTE: we cannot use the kdev_t device id value, because kdev_t.h + * says we mustn't. We must break it up and reassemble. + * 1 - 4 byte user specified identifier + * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED + * 3 - 4 byte device id, encoded for user-space, 4 byte inode number + * 4 - 4 byte inode number and 4 byte uuid + * 5 - 8 byte uuid + * 6 - 16 byte uuid + * 7 - 8 byte inode number and 16 byte uuid + * + * The fileid_type identified how the file within the filesystem is encoded. + * This is (will be) passed to, and set by, the underlying filesystem if it supports + * filehandle operations. The filesystem must not use the value '0' or '0xff' and may + * only use the values 1 and 2 as defined below: + * Current values: + * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes. + * 1 - 32bit inode number, 32 bit generation number. + * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number. + * + */ +struct nfs_fhbase_new { + __u8 fb_version; /* == 1, even => nfs_fhbase_old */ + __u8 fb_auth_type; + __u8 fb_fsid_type; + __u8 fb_fileid_type; + __u32 fb_auth[1]; +/* __u32 fb_fsid[0]; floating */ +/* __u32 fb_fileid[0]; floating */ +}; + +struct knfsd_fh { + unsigned int fh_size; /* significant for NFSv3. + * Points to the current size while building + * a new file handle + */ + union { + struct nfs_fhbase_old fh_old; + __u32 fh_pad[NFS4_FHSIZE/4]; + struct nfs_fhbase_new fh_new; + } fh_base; +}; + +#define ofh_dcookie fh_base.fh_old.fb_dcookie +#define ofh_ino fh_base.fh_old.fb_ino +#define ofh_dirino fh_base.fh_old.fb_dirino +#define ofh_dev fh_base.fh_old.fb_dev +#define ofh_xdev fh_base.fh_old.fb_xdev +#define ofh_xino fh_base.fh_old.fb_xino +#define ofh_generation fh_base.fh_old.fb_generation + +#define fh_version fh_base.fh_new.fb_version +#define fh_fsid_type fh_base.fh_new.fb_fsid_type +#define fh_auth_type fh_base.fh_new.fb_auth_type +#define fh_fileid_type fh_base.fh_new.fb_fileid_type +#define fh_auth fh_base.fh_new.fb_auth +#define fh_fsid fh_base.fh_new.fb_auth + + + +#endif /* _LINUX_NFSD_FH_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/stats.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/stats.h new file mode 100644 index 0000000..b7024e8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/stats.h @@ -0,0 +1,17 @@ +/* + * linux/include/linux/nfsd/stats.h + * + * Statistics for NFS server. + * + * Copyright (C) 1995, 1996 Olaf Kirch + */ + +#ifndef LINUX_NFSD_STATS_H +#define LINUX_NFSD_STATS_H + +#include + +/* thread usage wraps very million seconds (approx one fortnight) */ +#define NFSD_USAGE_WRAP (HZ*1000000) + +#endif /* LINUX_NFSD_STATS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/syscall.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/syscall.h new file mode 100644 index 0000000..d6004ad --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nfsd/syscall.h @@ -0,0 +1,109 @@ +/* + * include/linux/nfsd/syscall.h + * + * This file holds all declarations for the knfsd syscall interface. + * + * Copyright (C) 1995-1997 Olaf Kirch + */ + +#ifndef NFSD_SYSCALL_H +#define NFSD_SYSCALL_H + +# include +#include +#include +#include +#include + +/* + * Version of the syscall interface + */ +#define NFSCTL_VERSION 0x0201 + +/* + * These are the commands understood by nfsctl(). + */ +#define NFSCTL_SVC 0 /* This is a server process. */ +#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */ +#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */ +#define NFSCTL_EXPORT 3 /* export a file system. */ +#define NFSCTL_UNEXPORT 4 /* unexport a file system. */ +/*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */ +/*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */ +#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */ +#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */ + +/* SVC */ +struct nfsctl_svc { + unsigned short svc_port; + int svc_nthreads; +}; + +/* ADDCLIENT/DELCLIENT */ +struct nfsctl_client { + char cl_ident[NFSCLNT_IDMAX+1]; + int cl_naddr; + struct in_addr cl_addrlist[NFSCLNT_ADDRMAX]; + int cl_fhkeytype; + int cl_fhkeylen; + unsigned char cl_fhkey[NFSCLNT_KEYMAX]; +}; + +/* EXPORT/UNEXPORT */ +struct nfsctl_export { + char ex_client[NFSCLNT_IDMAX+1]; + char ex_path[NFS_MAXPATHLEN+1]; + __kernel_old_dev_t ex_dev; + __kernel_ino_t ex_ino; + int ex_flags; + __kernel_uid_t ex_anon_uid; + __kernel_gid_t ex_anon_gid; +}; + +/* GETFD */ +struct nfsctl_fdparm { + struct sockaddr gd_addr; + char gd_path[NFS_MAXPATHLEN+1]; + int gd_version; +}; + +/* GETFS - GET Filehandle with Size */ +struct nfsctl_fsparm { + struct sockaddr gd_addr; + char gd_path[NFS_MAXPATHLEN+1]; + int gd_maxlen; +}; + +/* + * This is the argument union. + */ +struct nfsctl_arg { + int ca_version; /* safeguard */ + union { + struct nfsctl_svc u_svc; + struct nfsctl_client u_client; + struct nfsctl_export u_export; + struct nfsctl_fdparm u_getfd; + struct nfsctl_fsparm u_getfs; + /* + * The following dummy member is needed to preserve binary compatibility + * on platforms where alignof(void*)>alignof(int). It's needed because + * this union used to contain a member (u_umap) which contained a + * pointer. + */ + void *u_ptr; + } u; +#define ca_svc u.u_svc +#define ca_client u.u_client +#define ca_export u.u_export +#define ca_getfd u.u_getfd +#define ca_getfs u.u_getfs +}; + +union nfsctl_res { + __u8 cr_getfh[NFS_FHSIZE]; + struct knfsd_fh cr_getfs; +}; + + +#endif /* NFSD_SYSCALL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nl80211.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nl80211.h new file mode 100644 index 0000000..cbe8ce3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nl80211.h @@ -0,0 +1,1065 @@ +#ifndef __LINUX_NL80211_H +#define __LINUX_NL80211_H +/* + * 802.11 netlink interface public header + * + * Copyright 2006, 2007, 2008 Johannes Berg + * Copyright 2008 Michael Wu + * Copyright 2008 Luis Carlos Cobo + * Copyright 2008 Michael Buesch + * Copyright 2008 Luis R. Rodriguez + * Copyright 2008 Jouni Malinen + * Copyright 2008 Colin McCabe + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/** + * DOC: Station handling + * + * Stations are added per interface, but a special case exists with VLAN + * interfaces. When a station is bound to an AP interface, it may be moved + * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN). + * The station is still assumed to belong to the AP interface it was added + * to. + * + * TODO: need more info? + */ + +/** + * enum nl80211_commands - supported nl80211 commands + * + * @NL80211_CMD_UNSPEC: unspecified command to catch errors + * + * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request + * to get a list of all present wiphys. + * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or + * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, + * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or + * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. + * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request + * or rename notification. Has attributes %NL80211_ATTR_WIPHY and + * %NL80211_ATTR_WIPHY_NAME. + * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes + * %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME. + * + * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration; + * either a dump request on a %NL80211_ATTR_WIPHY or a specific get + * on an %NL80211_ATTR_IFINDEX is supported. + * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires + * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE. + * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response + * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX, + * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also + * be sent from userspace to request creation of a new virtual interface, + * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and + * %NL80211_ATTR_IFNAME. + * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes + * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from + * userspace to request deletion of a virtual interface, then requires + * attribute %NL80211_ATTR_IFINDEX. + * + * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified + * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. + * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, + * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. + * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, + * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER + * attributes. + * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX + * or %NL80211_ATTR_MAC. + * + * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a + * %NL80222_CMD_NEW_BEACON message) + * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface + * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, + * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. + * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, + * parameters are like for %NL80211_CMD_SET_BEACON. + * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it + * + * @NL80211_CMD_GET_STATION: Get station attributes for station identified by + * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_SET_STATION: Set station attributes for station identified by + * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the + * the interface identified by %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC + * or, if no MAC address given, all stations, on the interface identified + * by %NL80211_ATTR_IFINDEX. + * + * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to + * destination %NL80211_ATTR_MAC on the interface identified by + * %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to + * destination %NL80211_ATTR_MAC on the interface identified by + * %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the + * the interface identified by %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC + * or, if no MAC address given, all mesh paths, on the interface identified + * by %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by + * %NL80211_ATTR_IFINDEX. + * + * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set + * regulatory domain. + * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command + * after being queried by the kernel. CRDA replies by sending a regulatory + * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our + * current alpha2 if it found a match. It also provides + * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each + * regulatory rule is a nested set of attributes given by + * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and + * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by + * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and + * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. + * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain + * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will + * store this as a valid request and then query userspace for it. + * + * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the + * interface identified by %NL80211_ATTR_IFINDEX + * + * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the + * interface identified by %NL80211_ATTR_IFINDEX + * + * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The + * interface is identified with %NL80211_ATTR_IFINDEX and the management + * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be + * added to the end of the specified management frame is specified with + * %NL80211_ATTR_IE. If the command succeeds, the requested data will be + * added to all specified management frames generated by + * kernel/firmware/driver. + * Note: This command has been removed and it is only reserved at this + * point to avoid re-using existing command number. The functionality this + * command was planned for has been provided with cleaner design with the + * option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN, + * NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE, + * NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE. + * + * @NL80211_CMD_GET_SCAN: get scan results + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to + * NL80211_CMD_GET_SCAN and on the "scan" multicast group) + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, + * partial scan results may be available + * + * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain + * has been changed and provides details of the request information + * that caused the change such as who initiated the regulatory request + * (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx + * (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if + * the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or + * %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain + * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is + * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on + * to (%NL80211_ATTR_REG_ALPHA2). + * + * @NL80211_CMD_AUTHENTICATE: authentication request and notification. + * This command is used both as a command (request to authenticate) and + * as an event on the "mlme" multicast group indicating completion of the + * authentication process. + * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the + * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and + * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify + * the SSID (mainly for association, but is included in authentication + * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used + * to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE + * is used to specify the authentication type. %NL80211_ATTR_IE is used to + * define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs) + * to be added to the frame. + * When used as an event, this reports reception of an Authentication + * frame in station and IBSS modes when the local MLME processed the + * frame, i.e., it was for the local STA and was received in correct + * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the + * MLME SAP interface (kernel providing MLME, userspace SME). The + * included NL80211_ATTR_FRAME attribute contains the management frame + * (including both the header and frame body, but not FCS). + * @NL80211_CMD_ASSOCIATE: association request and notification; like + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, + * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication + * primitives). + * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like + * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to + * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). + * + * @NL80211_CMD_MAX: highest used command number + * @__NL80211_CMD_AFTER_LAST: internal use + */ +enum nl80211_commands { +/* don't change the order or add anything inbetween, this is ABI! */ + NL80211_CMD_UNSPEC, + + NL80211_CMD_GET_WIPHY, /* can dump */ + NL80211_CMD_SET_WIPHY, + NL80211_CMD_NEW_WIPHY, + NL80211_CMD_DEL_WIPHY, + + NL80211_CMD_GET_INTERFACE, /* can dump */ + NL80211_CMD_SET_INTERFACE, + NL80211_CMD_NEW_INTERFACE, + NL80211_CMD_DEL_INTERFACE, + + NL80211_CMD_GET_KEY, + NL80211_CMD_SET_KEY, + NL80211_CMD_NEW_KEY, + NL80211_CMD_DEL_KEY, + + NL80211_CMD_GET_BEACON, + NL80211_CMD_SET_BEACON, + NL80211_CMD_NEW_BEACON, + NL80211_CMD_DEL_BEACON, + + NL80211_CMD_GET_STATION, + NL80211_CMD_SET_STATION, + NL80211_CMD_NEW_STATION, + NL80211_CMD_DEL_STATION, + + NL80211_CMD_GET_MPATH, + NL80211_CMD_SET_MPATH, + NL80211_CMD_NEW_MPATH, + NL80211_CMD_DEL_MPATH, + + NL80211_CMD_SET_BSS, + + NL80211_CMD_SET_REG, + NL80211_CMD_REQ_SET_REG, + + NL80211_CMD_GET_MESH_PARAMS, + NL80211_CMD_SET_MESH_PARAMS, + + NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */, + + NL80211_CMD_GET_REG, + + NL80211_CMD_GET_SCAN, + NL80211_CMD_TRIGGER_SCAN, + NL80211_CMD_NEW_SCAN_RESULTS, + NL80211_CMD_SCAN_ABORTED, + + NL80211_CMD_REG_CHANGE, + + NL80211_CMD_AUTHENTICATE, + NL80211_CMD_ASSOCIATE, + NL80211_CMD_DEAUTHENTICATE, + NL80211_CMD_DISASSOCIATE, + + /* add new commands above here */ + + /* used to define NL80211_CMD_MAX below */ + __NL80211_CMD_AFTER_LAST, + NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 +}; + +/* + * Allow user space programs to use #ifdef on new commands by defining them + * here + */ +#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS +#define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE +#define NL80211_CMD_REG_CHANGE NL80211_CMD_REG_CHANGE +#define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE +#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE +#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE +#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE + +/** + * enum nl80211_attrs - nl80211 netlink attributes + * + * @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors + * + * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. + * /sys/class/ieee80211//index + * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) + * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters + * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz + * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ + * if HT20 or HT40 are allowed (i.e., 802.11n disabled if not included): + * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including + * this attribute) + * NL80211_CHAN_HT20 = HT20 only + * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel + * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel + * + * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on + * @NL80211_ATTR_IFNAME: network interface name + * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype + * + * @NL80211_ATTR_MAC: MAC address (various uses) + * + * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of + * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC + * keys + * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3) + * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 + * section 7.3.2.25.1, e.g. 0x000FAC04) + * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and + * CCMP keys, each six bytes in little endian + * + * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU + * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing + * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE + * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE + * + * @NL80211_ATTR_STA_AID: Association ID for the station (u16) + * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of + * &enum nl80211_sta_flags. + * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by + * IEEE 802.11 7.3.1.6 (u16). + * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported + * rates as defined by IEEE 802.11 7.3.2.2 but without the length + * restriction (at most %NL80211_MAX_SUPP_RATES). + * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station + * to, or the AP interface the station was originally added to to. + * @NL80211_ATTR_STA_INFO: information about a station, part of station info + * given for %NL80211_CMD_GET_STATION, nested attribute containing + * info as possible, see &enum nl80211_sta_info. + * + * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands, + * consisting of a nested array. + * + * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). + * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link. + * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. + * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path + * info given for %NL80211_CMD_GET_MPATH, nested attribute described at + * &enum nl80211_mpath_info. + * + * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of + * &enum nl80211_mntr_flags. + * + * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the + * current regulatory domain should be set to or is already set to. + * For example, 'CR', for Costa Rica. This attribute is used by the kernel + * to query the CRDA to retrieve one regulatory domain. This attribute can + * also be used by userspace to query the kernel for the currently set + * regulatory domain. We chose an alpha2 as that is also used by the + * IEEE-802.11d country information element to identify a country. + * Users can also simply ask the wireless core to set regulatory domain + * to a specific alpha2. + * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory + * rules. + * + * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) + * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled + * (u8, 0 or 1) + * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled + * (u8, 0 or 1) + * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic + * rates in format defined by IEEE 802.11 7.3.2.2 but without the length + * restriction (at most %NL80211_MAX_SUPP_RATES). + * + * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from + * association request when used with NL80211_CMD_NEW_STATION) + * + * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all + * supported interface types, each a flag attribute with the number + * of the interface mode. + * + * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for + * %NL80211_CMD_SET_MGMT_EXTRA_IE. + * + * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with + * %NL80211_CMD_SET_MGMT_EXTRA_IE). + * + * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with + * a single scan request, a wiphy attribute. + * + * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) + * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive + * scanning and include a zero-length SSID (wildcard) for wildcard scan + * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the + * scan result list changes (BSS expired or added) so that applications + * can verify that they got a single, consistent snapshot (when all dump + * messages carried the same generation number) + * @NL80211_ATTR_BSS: scan result BSS + * + * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain + * currently in effect. This could be any of the %NL80211_REGDOM_SET_BY_* + * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently + * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*) + * + * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies + * an array of command numbers (i.e. a mapping index to command number) + * that the driver for the given wiphy supports. + * + * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header + * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and + * NL80211_CMD_ASSOCIATE events + * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets) + * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type, + * represented as a u32 + * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and + * %NL80211_CMD_DISASSOCIATE, u16 + * + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use + */ +enum nl80211_attrs { +/* don't change the order or add anything inbetween, this is ABI! */ + NL80211_ATTR_UNSPEC, + + NL80211_ATTR_WIPHY, + NL80211_ATTR_WIPHY_NAME, + + NL80211_ATTR_IFINDEX, + NL80211_ATTR_IFNAME, + NL80211_ATTR_IFTYPE, + + NL80211_ATTR_MAC, + + NL80211_ATTR_KEY_DATA, + NL80211_ATTR_KEY_IDX, + NL80211_ATTR_KEY_CIPHER, + NL80211_ATTR_KEY_SEQ, + NL80211_ATTR_KEY_DEFAULT, + + NL80211_ATTR_BEACON_INTERVAL, + NL80211_ATTR_DTIM_PERIOD, + NL80211_ATTR_BEACON_HEAD, + NL80211_ATTR_BEACON_TAIL, + + NL80211_ATTR_STA_AID, + NL80211_ATTR_STA_FLAGS, + NL80211_ATTR_STA_LISTEN_INTERVAL, + NL80211_ATTR_STA_SUPPORTED_RATES, + NL80211_ATTR_STA_VLAN, + NL80211_ATTR_STA_INFO, + + NL80211_ATTR_WIPHY_BANDS, + + NL80211_ATTR_MNTR_FLAGS, + + NL80211_ATTR_MESH_ID, + NL80211_ATTR_STA_PLINK_ACTION, + NL80211_ATTR_MPATH_NEXT_HOP, + NL80211_ATTR_MPATH_INFO, + + NL80211_ATTR_BSS_CTS_PROT, + NL80211_ATTR_BSS_SHORT_PREAMBLE, + NL80211_ATTR_BSS_SHORT_SLOT_TIME, + + NL80211_ATTR_HT_CAPABILITY, + + NL80211_ATTR_SUPPORTED_IFTYPES, + + NL80211_ATTR_REG_ALPHA2, + NL80211_ATTR_REG_RULES, + + NL80211_ATTR_MESH_PARAMS, + + NL80211_ATTR_BSS_BASIC_RATES, + + NL80211_ATTR_WIPHY_TXQ_PARAMS, + NL80211_ATTR_WIPHY_FREQ, + NL80211_ATTR_WIPHY_CHANNEL_TYPE, + + NL80211_ATTR_KEY_DEFAULT_MGMT, + + NL80211_ATTR_MGMT_SUBTYPE, + NL80211_ATTR_IE, + + NL80211_ATTR_MAX_NUM_SCAN_SSIDS, + + NL80211_ATTR_SCAN_FREQUENCIES, + NL80211_ATTR_SCAN_SSIDS, + NL80211_ATTR_SCAN_GENERATION, + NL80211_ATTR_BSS, + + NL80211_ATTR_REG_INITIATOR, + NL80211_ATTR_REG_TYPE, + + NL80211_ATTR_SUPPORTED_COMMANDS, + + NL80211_ATTR_FRAME, + NL80211_ATTR_SSID, + NL80211_ATTR_AUTH_TYPE, + NL80211_ATTR_REASON_CODE, + + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, + NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 +}; + +/* + * Allow user space programs to use #ifdef on new attributes by defining them + * here + */ +#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY +#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES +#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS +#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ +#define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE +#define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE +#define NL80211_ATTR_IE NL80211_ATTR_IE +#define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR +#define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE +#define NL80211_ATTR_FRAME NL80211_ATTR_FRAME +#define NL80211_ATTR_SSID NL80211_ATTR_SSID +#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE +#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE + +#define NL80211_MAX_SUPP_RATES 32 +#define NL80211_MAX_SUPP_REG_RULES 32 +#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 +#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 +#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 +#define NL80211_HT_CAPABILITY_LEN 26 + +/** + * enum nl80211_iftype - (virtual) interface types + * + * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides + * @NL80211_IFTYPE_ADHOC: independent BSS member + * @NL80211_IFTYPE_STATION: managed BSS member + * @NL80211_IFTYPE_AP: access point + * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points + * @NL80211_IFTYPE_WDS: wireless distribution interface + * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames + * @NL80211_IFTYPE_MESH_POINT: mesh point + * @NL80211_IFTYPE_MAX: highest interface type number currently defined + * @__NL80211_IFTYPE_AFTER_LAST: internal use + * + * These values are used with the %NL80211_ATTR_IFTYPE + * to set the type of an interface. + * + */ +enum nl80211_iftype { + NL80211_IFTYPE_UNSPECIFIED, + NL80211_IFTYPE_ADHOC, + NL80211_IFTYPE_STATION, + NL80211_IFTYPE_AP, + NL80211_IFTYPE_AP_VLAN, + NL80211_IFTYPE_WDS, + NL80211_IFTYPE_MONITOR, + NL80211_IFTYPE_MESH_POINT, + + /* keep last */ + __NL80211_IFTYPE_AFTER_LAST, + NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1 +}; + +/** + * enum nl80211_sta_flags - station flags + * + * Station flags. When a station is added to an AP interface, it is + * assumed to be already associated (and hence authenticated.) + * + * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X) + * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames + * with short barker preamble + * @NL80211_STA_FLAG_WME: station is WME/QoS capable + * @NL80211_STA_FLAG_MFP: station uses management frame protection + */ +enum nl80211_sta_flags { + __NL80211_STA_FLAG_INVALID, + NL80211_STA_FLAG_AUTHORIZED, + NL80211_STA_FLAG_SHORT_PREAMBLE, + NL80211_STA_FLAG_WME, + NL80211_STA_FLAG_MFP, + + /* keep last */ + __NL80211_STA_FLAG_AFTER_LAST, + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 +}; + +/** + * enum nl80211_rate_info - bitrate information + * + * These attribute types are used with %NL80211_STA_INFO_TXRATE + * when getting information about the bitrate of a station. + * + * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved + * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s) + * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8) + * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate + * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval + * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined + * @__NL80211_RATE_INFO_AFTER_LAST: internal use + */ +enum nl80211_rate_info { + __NL80211_RATE_INFO_INVALID, + NL80211_RATE_INFO_BITRATE, + NL80211_RATE_INFO_MCS, + NL80211_RATE_INFO_40_MHZ_WIDTH, + NL80211_RATE_INFO_SHORT_GI, + + /* keep last */ + __NL80211_RATE_INFO_AFTER_LAST, + NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1 +}; + +/** + * enum nl80211_sta_info - station information + * + * These attribute types are used with %NL80211_ATTR_STA_INFO + * when getting information about a station. + * + * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved + * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) + * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) + * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) + * @__NL80211_STA_INFO_AFTER_LAST: internal + * @NL80211_STA_INFO_MAX: highest possible station info attribute + * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) + * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute + * containing info as possible, see &enum nl80211_sta_info_txrate. + * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) + * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this + * station) + */ +enum nl80211_sta_info { + __NL80211_STA_INFO_INVALID, + NL80211_STA_INFO_INACTIVE_TIME, + NL80211_STA_INFO_RX_BYTES, + NL80211_STA_INFO_TX_BYTES, + NL80211_STA_INFO_LLID, + NL80211_STA_INFO_PLID, + NL80211_STA_INFO_PLINK_STATE, + NL80211_STA_INFO_SIGNAL, + NL80211_STA_INFO_TX_BITRATE, + NL80211_STA_INFO_RX_PACKETS, + NL80211_STA_INFO_TX_PACKETS, + + /* keep last */ + __NL80211_STA_INFO_AFTER_LAST, + NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 +}; + +/** + * enum nl80211_mpath_flags - nl80211 mesh path flags + * + * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active + * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running + * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN + * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set + * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded + */ +enum nl80211_mpath_flags { + NL80211_MPATH_FLAG_ACTIVE = 1<<0, + NL80211_MPATH_FLAG_RESOLVING = 1<<1, + NL80211_MPATH_FLAG_DSN_VALID = 1<<2, + NL80211_MPATH_FLAG_FIXED = 1<<3, + NL80211_MPATH_FLAG_RESOLVED = 1<<4, +}; + +/** + * enum nl80211_mpath_info - mesh path information + * + * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting + * information about a mesh path. + * + * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved + * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination + * @NL80211_ATTR_MPATH_DSN: destination sequence number + * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path + * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now + * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in + * &enum nl80211_mpath_flags; + * @NL80211_ATTR_MPATH_DISCOVERY_TIMEOUT: total path discovery timeout, in msec + * @NL80211_ATTR_MPATH_DISCOVERY_RETRIES: mesh path discovery retries + */ +enum nl80211_mpath_info { + __NL80211_MPATH_INFO_INVALID, + NL80211_MPATH_INFO_FRAME_QLEN, + NL80211_MPATH_INFO_DSN, + NL80211_MPATH_INFO_METRIC, + NL80211_MPATH_INFO_EXPTIME, + NL80211_MPATH_INFO_FLAGS, + NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, + NL80211_MPATH_INFO_DISCOVERY_RETRIES, + + /* keep last */ + __NL80211_MPATH_INFO_AFTER_LAST, + NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1 +}; + +/** + * enum nl80211_band_attr - band attributes + * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved + * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band, + * an array of nested frequency attributes + * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, + * an array of nested bitrate attributes + * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as + * defined in 802.11n + * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE + * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n + * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n + */ +enum nl80211_band_attr { + __NL80211_BAND_ATTR_INVALID, + NL80211_BAND_ATTR_FREQS, + NL80211_BAND_ATTR_RATES, + + NL80211_BAND_ATTR_HT_MCS_SET, + NL80211_BAND_ATTR_HT_CAPA, + NL80211_BAND_ATTR_HT_AMPDU_FACTOR, + NL80211_BAND_ATTR_HT_AMPDU_DENSITY, + + /* keep last */ + __NL80211_BAND_ATTR_AFTER_LAST, + NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 +}; + +#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA + +/** + * enum nl80211_frequency_attr - frequency attributes + * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz + * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current + * regulatory domain. + * @NL80211_FREQUENCY_ATTR_PASSIVE_SCAN: Only passive scanning is + * permitted on this channel in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_NO_IBSS: IBSS networks are not permitted + * on this channel in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory + * on this channel in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm + * (100 * dBm). + */ +enum nl80211_frequency_attr { + __NL80211_FREQUENCY_ATTR_INVALID, + NL80211_FREQUENCY_ATTR_FREQ, + NL80211_FREQUENCY_ATTR_DISABLED, + NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, + NL80211_FREQUENCY_ATTR_NO_IBSS, + NL80211_FREQUENCY_ATTR_RADAR, + NL80211_FREQUENCY_ATTR_MAX_TX_POWER, + + /* keep last */ + __NL80211_FREQUENCY_ATTR_AFTER_LAST, + NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 +}; + +#define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER + +/** + * enum nl80211_bitrate_attr - bitrate attributes + * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps + * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported + * in 2.4 GHz band. + */ +enum nl80211_bitrate_attr { + __NL80211_BITRATE_ATTR_INVALID, + NL80211_BITRATE_ATTR_RATE, + NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE, + + /* keep last */ + __NL80211_BITRATE_ATTR_AFTER_LAST, + NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1 +}; + +/** + * enum nl80211_initiator - Indicates the initiator of a reg domain request + * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world + * regulatory domain. + * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the + * regulatory domain. + * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the + * wireless core it thinks its knows the regulatory domain we should be in. + * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an + * 802.11 country information element with regulatory information it + * thinks we should consider. + */ +enum nl80211_reg_initiator { + NL80211_REGDOM_SET_BY_CORE, + NL80211_REGDOM_SET_BY_USER, + NL80211_REGDOM_SET_BY_DRIVER, + NL80211_REGDOM_SET_BY_COUNTRY_IE, +}; + +/** + * enum nl80211_reg_type - specifies the type of regulatory domain + * @NL80211_REGDOM_TYPE_COUNTRY: the regulatory domain set is one that pertains + * to a specific country. When this is set you can count on the + * ISO / IEC 3166 alpha2 country code being valid. + * @NL80211_REGDOM_TYPE_WORLD: the regulatory set domain is the world regulatory + * domain. + * @NL80211_REGDOM_TYPE_CUSTOM_WORLD: the regulatory domain set is a custom + * driver specific world regulatory domain. These do not apply system-wide + * and are only applicable to the individual devices which have requested + * them to be applied. + * @NL80211_REGDOM_TYPE_INTERSECTION: the regulatory domain set is the product + * of an intersection between two regulatory domains -- the previously + * set regulatory domain on the system and the last accepted regulatory + * domain request to be processed. + */ +enum nl80211_reg_type { + NL80211_REGDOM_TYPE_COUNTRY, + NL80211_REGDOM_TYPE_WORLD, + NL80211_REGDOM_TYPE_CUSTOM_WORLD, + NL80211_REGDOM_TYPE_INTERSECTION, +}; + +/** + * enum nl80211_reg_rule_attr - regulatory rule attributes + * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional + * considerations for a given frequency range. These are the + * &enum nl80211_reg_rule_flags. + * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory + * rule in KHz. This is not a center of frequency but an actual regulatory + * band edge. + * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule + * in KHz. This is not a center a frequency but an actual regulatory + * band edge. + * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this + * frequency range, in KHz. + * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain + * for a given frequency range. The value is in mBi (100 * dBi). + * If you don't have one then don't send this. + * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for + * a given frequency range. The value is in mBm (100 * dBm). + */ +enum nl80211_reg_rule_attr { + __NL80211_REG_RULE_ATTR_INVALID, + NL80211_ATTR_REG_RULE_FLAGS, + + NL80211_ATTR_FREQ_RANGE_START, + NL80211_ATTR_FREQ_RANGE_END, + NL80211_ATTR_FREQ_RANGE_MAX_BW, + + NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, + NL80211_ATTR_POWER_RULE_MAX_EIRP, + + /* keep last */ + __NL80211_REG_RULE_ATTR_AFTER_LAST, + NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 +}; + +/** + * enum nl80211_reg_rule_flags - regulatory rule flags + * + * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed + * @NL80211_RRF_NO_CCK: CCK modulation not allowed + * @NL80211_RRF_NO_INDOOR: indoor operation not allowed + * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed + * @NL80211_RRF_DFS: DFS support is required to be used + * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links + * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links + * @NL80211_RRF_PASSIVE_SCAN: passive scan is required + * @NL80211_RRF_NO_IBSS: no IBSS is allowed + */ +enum nl80211_reg_rule_flags { + NL80211_RRF_NO_OFDM = 1<<0, + NL80211_RRF_NO_CCK = 1<<1, + NL80211_RRF_NO_INDOOR = 1<<2, + NL80211_RRF_NO_OUTDOOR = 1<<3, + NL80211_RRF_DFS = 1<<4, + NL80211_RRF_PTP_ONLY = 1<<5, + NL80211_RRF_PTMP_ONLY = 1<<6, + NL80211_RRF_PASSIVE_SCAN = 1<<7, + NL80211_RRF_NO_IBSS = 1<<8, +}; + +/** + * enum nl80211_mntr_flags - monitor configuration flags + * + * Monitor configuration flags. + * + * @__NL80211_MNTR_FLAG_INVALID: reserved + * + * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS + * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP + * @NL80211_MNTR_FLAG_CONTROL: pass control frames + * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering + * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing. + * overrides all other flags. + * + * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use + * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag + */ +enum nl80211_mntr_flags { + __NL80211_MNTR_FLAG_INVALID, + NL80211_MNTR_FLAG_FCSFAIL, + NL80211_MNTR_FLAG_PLCPFAIL, + NL80211_MNTR_FLAG_CONTROL, + NL80211_MNTR_FLAG_OTHER_BSS, + NL80211_MNTR_FLAG_COOK_FRAMES, + + /* keep last */ + __NL80211_MNTR_FLAG_AFTER_LAST, + NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 +}; + +/** + * enum nl80211_meshconf_params - mesh configuration parameters + * + * Mesh configuration parameters + * + * @__NL80211_MESHCONF_INVALID: internal use + * + * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in + * millisecond units, used by the Peer Link Open message + * + * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in + * millisecond units, used by the peer link management to close a peer link + * + * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in + * millisecond units + * + * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed + * on this mesh interface + * + * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link + * open retries that can be sent to establish a new peer link instance in a + * mesh + * + * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh + * point. + * + * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically + * open peer links when we detect compatible mesh peers. + * + * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames + * containing a PREQ that an MP can send to a particular destination (path + * target) + * + * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths + * (in milliseconds) + * + * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait + * until giving up on a path discovery (in milliseconds) + * + * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh + * points receiving a PREQ shall consider the forwarding information from the + * root to be valid. (TU = time unit) + * + * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in + * TUs) during which an MP can send only one action frame containing a PREQ + * reference element + * + * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) + * that it takes for an HWMP information element to propagate across the mesh + * + * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute + * + * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use + */ +enum nl80211_meshconf_params { + __NL80211_MESHCONF_INVALID, + NL80211_MESHCONF_RETRY_TIMEOUT, + NL80211_MESHCONF_CONFIRM_TIMEOUT, + NL80211_MESHCONF_HOLDING_TIMEOUT, + NL80211_MESHCONF_MAX_PEER_LINKS, + NL80211_MESHCONF_MAX_RETRIES, + NL80211_MESHCONF_TTL, + NL80211_MESHCONF_AUTO_OPEN_PLINKS, + NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, + NL80211_MESHCONF_PATH_REFRESH_TIME, + NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, + NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, + NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, + NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, + + /* keep last */ + __NL80211_MESHCONF_ATTR_AFTER_LAST, + NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1 +}; + +/** + * enum nl80211_txq_attr - TX queue parameter attributes + * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved + * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*) + * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning + * disabled + * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form + * 2^n-1 in the range 1..32767] + * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form + * 2^n-1 in the range 1..32767] + * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255] + * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal + * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number + */ +enum nl80211_txq_attr { + __NL80211_TXQ_ATTR_INVALID, + NL80211_TXQ_ATTR_QUEUE, + NL80211_TXQ_ATTR_TXOP, + NL80211_TXQ_ATTR_CWMIN, + NL80211_TXQ_ATTR_CWMAX, + NL80211_TXQ_ATTR_AIFS, + + /* keep last */ + __NL80211_TXQ_ATTR_AFTER_LAST, + NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 +}; + +enum nl80211_txq_q { + NL80211_TXQ_Q_VO, + NL80211_TXQ_Q_VI, + NL80211_TXQ_Q_BE, + NL80211_TXQ_Q_BK +}; + +enum nl80211_channel_type { + NL80211_CHAN_NO_HT, + NL80211_CHAN_HT20, + NL80211_CHAN_HT40MINUS, + NL80211_CHAN_HT40PLUS +}; + +/** + * enum nl80211_bss - netlink attributes for a BSS + * + * @__NL80211_BSS_INVALID: invalid + * @NL80211_BSS_FREQUENCY: frequency in MHz (u32) + * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64) + * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) + * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) + * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the + * raw information elements from the probe response/beacon (bin) + * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon + * in mBm (100 * dBm) (s32) + * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon + * in unspecified units, scaled to 0..100 (u8) + * @__NL80211_BSS_AFTER_LAST: internal + * @NL80211_BSS_MAX: highest BSS attribute + */ +enum nl80211_bss { + __NL80211_BSS_INVALID, + NL80211_BSS_BSSID, + NL80211_BSS_FREQUENCY, + NL80211_BSS_TSF, + NL80211_BSS_BEACON_INTERVAL, + NL80211_BSS_CAPABILITY, + NL80211_BSS_INFORMATION_ELEMENTS, + NL80211_BSS_SIGNAL_MBM, + NL80211_BSS_SIGNAL_UNSPEC, + + /* keep last */ + __NL80211_BSS_AFTER_LAST, + NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1 +}; + +/** + * enum nl80211_auth_type - AuthenticationType + * + * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication + * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) + * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) + * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) + */ +enum nl80211_auth_type { + NL80211_AUTHTYPE_OPEN_SYSTEM, + NL80211_AUTHTYPE_SHARED_KEY, + NL80211_AUTHTYPE_FT, + NL80211_AUTHTYPE_NETWORK_EAP, +}; +#endif /* __LINUX_NL80211_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nubus.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nubus.h new file mode 100644 index 0000000..60b03e4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nubus.h @@ -0,0 +1,244 @@ +/* + nubus.h: various definitions and prototypes for NuBus drivers to use. + + Originally written by Alan Cox. + + Hacked to death by C. Scott Ananian and David Huggins-Daines. + + Some of the constants in here are from the corresponding + NetBSD/OpenBSD header file, by Allen Briggs. We figured out the + rest of them on our own. */ + +#ifndef LINUX_NUBUS_H +#define LINUX_NUBUS_H + +#include + +enum nubus_category { + NUBUS_CAT_BOARD = 0x0001, + NUBUS_CAT_DISPLAY = 0x0003, + NUBUS_CAT_NETWORK = 0x0004, + NUBUS_CAT_COMMUNICATIONS = 0x0006, + NUBUS_CAT_FONT = 0x0009, + NUBUS_CAT_CPU = 0x000A, + /* For lack of a better name */ + NUBUS_CAT_DUODOCK = 0x0020 +}; + +enum nubus_type_network { + NUBUS_TYPE_ETHERNET = 0x0001, + NUBUS_TYPE_RS232 = 0x0002 +}; + +enum nubus_type_display { + NUBUS_TYPE_VIDEO = 0x0001 +}; + +enum nubus_type_cpu { + NUBUS_TYPE_68020 = 0x0003, + NUBUS_TYPE_68030 = 0x0004, + NUBUS_TYPE_68040 = 0x0005 +}; + +/* Known tuples: (according to TattleTech and Slots) + * 68030 motherboards: <10,4,0,24> + * 68040 motherboards: <10,5,0,24> + * DuoDock Plus: <32,1,1,2> + * + * Toby Frame Buffer card: <3,1,1,1> + * RBV built-in video (IIci): <3,1,1,24> + * Valkyrie built-in video (Q630): <3,1,1,46> + * Macintosh Display Card: <3,1,1,25> + * Sonora built-in video (P460): <3,1,1,34> + * Jet framebuffer (DuoDock Plus): <3,1,1,41> + * + * SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272> + * SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271> + * Apple SONIC LC-PDS Ethernet ("Apple Ethernet LC Twisted-Pair Card"): <4,1,0,281> + * Sonic Systems Ethernet A-Series Card: <4,1,268,256> + * Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision) + * ROM on the above card: <2,1,0,0> + * Cabletron ethernet card: <4,1,1,265> + * Farallon ethernet card: <4,1,268,256> (identical to Sonic Systems card) + * Kinetics EtherPort IIN: <4,1,259,262> + * API Engineering EtherRun_LCa PDS enet card: <4,1,282,256> + * + * Add your devices to the list! You can obtain the "Slots" utility + * from Apple's FTP site at: + * ftp://dev.apple.com/devworld/Tool_Chest/Devices_-_Hardware/NuBus_Slot_Manager/ + * + * Alternately, TattleTech can be found at any Info-Mac mirror site. + * or from its distribution site: ftp://ftp.decismkr.com/dms + */ + +/* DrSW: Uniquely identifies the software interface to a board. This + is usually the one you want to look at when writing a driver. It's + not as useful as you think, though, because as we should know by + now (duh), "Apple Compatible" can mean a lot of things... */ + +/* Add known DrSW values here */ +enum nubus_drsw { + /* NUBUS_CAT_DISPLAY */ + NUBUS_DRSW_APPLE = 0x0001, + NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */ + + /* NUBUS_CAT_NETWORK */ + NUBUS_DRSW_3COM = 0x0000, + NUBUS_DRSW_CABLETRON = 0x0001, + NUBUS_DRSW_SONIC_LC = 0x0001, + NUBUS_DRSW_KINETICS = 0x0103, + NUBUS_DRSW_ASANTE = 0x0104, + NUBUS_DRSW_TECHWORKS = 0x0109, + NUBUS_DRSW_DAYNA = 0x010b, + NUBUS_DRSW_FARALLON = 0x010c, + NUBUS_DRSW_APPLE_SN = 0x010f, + NUBUS_DRSW_DAYNA2 = 0x0115, + NUBUS_DRSW_FOCUS = 0x011a, + NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */ + NUBUS_DRSW_DAYNA_LC = 0x011e, + + /* NUBUS_CAT_CPU */ + NUBUS_DRSW_NONE = 0x0000, +}; + +/* DrHW: Uniquely identifies the hardware interface to a board (or at + least, it should... some video cards are known to incorrectly + identify themselves as Toby cards) */ + +/* Add known DrHW values here */ +enum nubus_drhw { + /* NUBUS_CAT_DISPLAY */ + NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */ + NUBUS_DRHW_APPLE_WVC = 0x0006, /* Apple Workstation Video Card */ + NUBUS_DRHW_SIGMA_CLRMAX = 0x0007, /* Sigma Design ColorMax */ + NUBUS_DRHW_APPLE_SE30 = 0x0009, /* Apple SE/30 video */ + NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High-Res Video Card */ + NUBUS_DRHW_APPLE_PVC = 0x0017, /* Mac II Portrait Video Card */ + NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */ + NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */ + NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */ + NUBUS_DRHW_APPLE_24AC = 0x002b, /* Mac 24AC Video Card */ + NUBUS_DRHW_APPLE_VALKYRIE = 0x002e, + NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */ + NUBUS_DRHW_SMAC_GFX = 0x0105, /* SuperMac GFX */ + NUBUS_DRHW_RASTER_CB264 = 0x013B, /* RasterOps ColorBoard 264 */ + NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */ + NUBUS_DRHW_RDIUS_GSC = 0x0153, /* Radius GS/C */ + NUBUS_DRHW_SMAC_SPEC8 = 0x017B, /* SuperMac Spectrum/8 */ + NUBUS_DRHW_SMAC_SPEC24 = 0x017C, /* SuperMac Spectrum/24 */ + NUBUS_DRHW_RASTER_CB364 = 0x026F, /* RasterOps ColorBoard 364 */ + NUBUS_DRHW_RDIUS_DCGX = 0x027C, /* Radius DirectColor/GX */ + NUBUS_DRHW_RDIUS_PC8 = 0x0291, /* Radius PrecisionColor 8 */ + NUBUS_DRHW_LAPIS_PCS8 = 0x0292, /* Lapis ProColorServer 8 */ + NUBUS_DRHW_RASTER_24XLI = 0x02A0, /* RasterOps 8/24 XLi */ + NUBUS_DRHW_RASTER_PBPGT = 0x02A5, /* RasterOps PaintBoard Prism GT */ + NUBUS_DRHW_EMACH_FSX = 0x02AE, /* E-Machines Futura SX */ + NUBUS_DRHW_RASTER_24XLTV = 0x02B7, /* RasterOps 24XLTV */ + NUBUS_DRHW_SMAC_THUND24 = 0x02CB, /* SuperMac Thunder/24 */ + NUBUS_DRHW_SMAC_THUNDLGHT = 0x03D9, /* SuperMac ThunderLight */ + NUBUS_DRHW_RDIUS_PC24XP = 0x0406, /* Radius PrecisionColor 24Xp */ + NUBUS_DRHW_RDIUS_PC24X = 0x040A, /* Radius PrecisionColor 24X */ + NUBUS_DRHW_RDIUS_PC8XJ = 0x040B, /* Radius PrecisionColor 8XJ */ + + /* NUBUS_CAT_NETWORK */ + NUBUS_DRHW_INTERLAN = 0x0100, + NUBUS_DRHW_SMC9194 = 0x0101, + NUBUS_DRHW_KINETICS = 0x0106, + NUBUS_DRHW_CABLETRON = 0x0109, + NUBUS_DRHW_ASANTE_LC = 0x010f, + NUBUS_DRHW_SONIC = 0x0110, + NUBUS_DRHW_TECHWORKS = 0x0112, + NUBUS_DRHW_APPLE_SONIC_NB = 0x0118, + NUBUS_DRHW_APPLE_SONIC_LC = 0x0119, + NUBUS_DRHW_FOCUS = 0x011c, + NUBUS_DRHW_SONNET = 0x011d, +}; + +/* Resource IDs: These are the identifiers for the various weird and + wonderful tidbits of information that may or may not reside in the + NuBus ROM directory. */ +enum nubus_res_id { + NUBUS_RESID_TYPE = 0x0001, + NUBUS_RESID_NAME = 0x0002, + NUBUS_RESID_ICON = 0x0003, + NUBUS_RESID_DRVRDIR = 0x0004, + NUBUS_RESID_LOADREC = 0x0005, + NUBUS_RESID_BOOTREC = 0x0006, + NUBUS_RESID_FLAGS = 0x0007, + NUBUS_RESID_HWDEVID = 0x0008, + NUBUS_RESID_MINOR_BASEOS = 0x000a, + NUBUS_RESID_MINOR_LENGTH = 0x000b, + NUBUS_RESID_MAJOR_BASEOS = 0x000c, + NUBUS_RESID_MAJOR_LENGTH = 0x000d, + NUBUS_RESID_CICN = 0x000f, + NUBUS_RESID_ICL8 = 0x0010, + NUBUS_RESID_ICL4 = 0x0011, +}; + +/* Category-specific resources. */ +enum nubus_board_res_id { + NUBUS_RESID_BOARDID = 0x0020, + NUBUS_RESID_PRAMINITDATA = 0x0021, + NUBUS_RESID_PRIMARYINIT = 0x0022, + NUBUS_RESID_TIMEOUTCONST = 0x0023, + NUBUS_RESID_VENDORINFO = 0x0024, + NUBUS_RESID_BOARDFLAGS = 0x0025, + NUBUS_RESID_SECONDINIT = 0x0026, + + /* Not sure why Apple put these next two in here */ + NUBUS_RESID_VIDNAMES = 0x0041, + NUBUS_RESID_VIDMODES = 0x007e +}; + +/* Fields within the vendor info directory */ +enum nubus_vendor_res_id { + NUBUS_RESID_VEND_ID = 0x0001, + NUBUS_RESID_VEND_SERIAL = 0x0002, + NUBUS_RESID_VEND_REV = 0x0003, + NUBUS_RESID_VEND_PART = 0x0004, + NUBUS_RESID_VEND_DATE = 0x0005 +}; + +enum nubus_net_res_id { + NUBUS_RESID_MAC_ADDRESS = 0x0080 +}; + +enum nubus_cpu_res_id { + NUBUS_RESID_MEMINFO = 0x0081, + NUBUS_RESID_ROMINFO = 0x0082 +}; + +enum nubus_display_res_id { + NUBUS_RESID_GAMMADIR = 0x0040, + NUBUS_RESID_FIRSTMODE = 0x0080, + NUBUS_RESID_SECONDMODE = 0x0081, + NUBUS_RESID_THIRDMODE = 0x0082, + NUBUS_RESID_FOURTHMODE = 0x0083, + NUBUS_RESID_FIFTHMODE = 0x0084, + NUBUS_RESID_SIXTHMODE = 0x0085 +}; + +struct nubus_dir +{ + unsigned char *base; + unsigned char *ptr; + int done; + int mask; +}; + +struct nubus_dirent +{ + unsigned char *base; + unsigned char type; + __u32 data; /* Actually 24bits used */ + int mask; +}; + + +/* We'd like to get rid of this eventually. Only daynaport.c uses it now. */ +static __inline__ void *nubus_slot_addr(int slot) +{ + return (void *)(0xF0000000|(slot<<24)); +} + +#endif /* LINUX_NUBUS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nvram.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nvram.h new file mode 100644 index 0000000..fbaa10e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/nvram.h @@ -0,0 +1,16 @@ +#ifndef _LINUX_NVRAM_H +#define _LINUX_NVRAM_H + +#include + +/* /dev/nvram ioctls */ +#define NVRAM_INIT _IO('p', 0x40) /* initialize NVRAM and set checksum */ +#define NVRAM_SETCKS _IO('p', 0x41) /* recalculate checksum */ + +/* for all current systems, this is where NVRAM starts */ +#define NVRAM_FIRST_BYTE 14 +/* all these functions expect an NVRAM offset, not an absolute */ +#define NVRAM_OFFSET(x) ((x)-NVRAM_FIRST_BYTE) + + +#endif /* _LINUX_NVRAM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/oom.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/oom.h new file mode 100644 index 0000000..d7727b8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/oom.h @@ -0,0 +1,10 @@ +#ifndef __INCLUDE_LINUX_OOM_H +#define __INCLUDE_LINUX_OOM_H + +/* /proc//oom_adj set to -17 protects from the oom-killer */ +#define OOM_DISABLE (-17) +/* inclusive */ +#define OOM_ADJUST_MIN (-16) +#define OOM_ADJUST_MAX 15 + +#endif /* _INCLUDE_LINUX_OOM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/param.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/param.h new file mode 100644 index 0000000..092e92f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/param.h @@ -0,0 +1,6 @@ +#ifndef _LINUX_PARAM_H +#define _LINUX_PARAM_H + +#include + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/parport.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/parport.h new file mode 100644 index 0000000..4cd4442 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/parport.h @@ -0,0 +1,95 @@ +/* + * Any part of this program may be used in documents licensed under + * the GNU Free Documentation License, Version 1.1 or any later version + * published by the Free Software Foundation. + */ + +#ifndef _PARPORT_H_ +#define _PARPORT_H_ + +/* Start off with user-visible constants */ + +/* Maximum of 16 ports per machine */ +#define PARPORT_MAX 16 + +/* Magic numbers */ +#define PARPORT_IRQ_NONE -1 +#define PARPORT_DMA_NONE -1 +#define PARPORT_IRQ_AUTO -2 +#define PARPORT_DMA_AUTO -2 +#define PARPORT_DMA_NOFIFO -3 +#define PARPORT_DISABLE -2 +#define PARPORT_IRQ_PROBEONLY -3 +#define PARPORT_IOHI_AUTO -1 + +#define PARPORT_CONTROL_STROBE 0x1 +#define PARPORT_CONTROL_AUTOFD 0x2 +#define PARPORT_CONTROL_INIT 0x4 +#define PARPORT_CONTROL_SELECT 0x8 + +#define PARPORT_STATUS_ERROR 0x8 +#define PARPORT_STATUS_SELECT 0x10 +#define PARPORT_STATUS_PAPEROUT 0x20 +#define PARPORT_STATUS_ACK 0x40 +#define PARPORT_STATUS_BUSY 0x80 + +/* Type classes for Plug-and-Play probe. */ +typedef enum { + PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */ + PARPORT_CLASS_PRINTER, + PARPORT_CLASS_MODEM, + PARPORT_CLASS_NET, + PARPORT_CLASS_HDC, /* Hard disk controller */ + PARPORT_CLASS_PCMCIA, + PARPORT_CLASS_MEDIA, /* Multimedia device */ + PARPORT_CLASS_FDC, /* Floppy disk controller */ + PARPORT_CLASS_PORTS, + PARPORT_CLASS_SCANNER, + PARPORT_CLASS_DIGCAM, + PARPORT_CLASS_OTHER, /* Anything else */ + PARPORT_CLASS_UNSPEC, /* No CLS field in ID */ + PARPORT_CLASS_SCSIADAPTER +} parport_device_class; + +/* The "modes" entry in parport is a bit field representing the + capabilities of the hardware. */ +#define PARPORT_MODE_PCSPP (1<<0) /* IBM PC registers available. */ +#define PARPORT_MODE_TRISTATE (1<<1) /* Can tristate. */ +#define PARPORT_MODE_EPP (1<<2) /* Hardware EPP. */ +#define PARPORT_MODE_ECP (1<<3) /* Hardware ECP. */ +#define PARPORT_MODE_COMPAT (1<<4) /* Hardware 'printer protocol'. */ +#define PARPORT_MODE_DMA (1<<5) /* Hardware can DMA. */ +#define PARPORT_MODE_SAFEININT (1<<6) /* SPP registers accessible in IRQ. */ + +/* IEEE1284 modes: + Nibble mode, byte mode, ECP, ECPRLE and EPP are their own + 'extensibility request' values. Others are special. + 'Real' ECP modes must have the IEEE1284_MODE_ECP bit set. */ +#define IEEE1284_MODE_NIBBLE 0 +#define IEEE1284_MODE_BYTE (1<<0) +#define IEEE1284_MODE_COMPAT (1<<8) +#define IEEE1284_MODE_BECP (1<<9) /* Bounded ECP mode */ +#define IEEE1284_MODE_ECP (1<<4) +#define IEEE1284_MODE_ECPRLE (IEEE1284_MODE_ECP | (1<<5)) +#define IEEE1284_MODE_ECPSWE (1<<10) /* Software-emulated */ +#define IEEE1284_MODE_EPP (1<<6) +#define IEEE1284_MODE_EPPSL (1<<11) /* EPP 1.7 */ +#define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */ +#define IEEE1284_DEVICEID (1<<2) /* This is a flag */ +#define IEEE1284_EXT_LINK (1<<14) /* This flag causes the + * extensibility link to + * be requested, using + * bits 0-6. */ + +/* For the benefit of parport_read/write, you can use these with + * parport_negotiate to use address operations. They have no effect + * other than to make parport_read/write use address transfers. */ +#define IEEE1284_ADDR (1<<13) /* This is a flag */ +#define IEEE1284_DATA 0 /* So is this */ + +/* Flags for block transfer operations. */ +#define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */ +#define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */ + +/* The rest is for the kernel only */ +#endif /* _PARPORT_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/patchkey.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/patchkey.h new file mode 100644 index 0000000..23810dd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/patchkey.h @@ -0,0 +1,33 @@ +/* + * -- definition of _PATCHKEY macro + * + * Copyright (C) 2005 Stuart Brady + * + * This exists because awe_voice.h defined its own _PATCHKEY and it wasn't + * clear whether removing this would break anything in userspace. + * + * Do not include this file directly. Please use instead. + * For kernel code, use + */ + +#ifndef _LINUX_PATCHKEY_H_INDIRECT +#error "patchkey.h included directly" +#endif + +#ifndef _LINUX_PATCHKEY_H +#define _LINUX_PATCHKEY_H + +/* Endian macros. */ +# include + +#if defined(__BYTE_ORDER) +# if __BYTE_ORDER == __BIG_ENDIAN +# define _PATCHKEY(id) (0xfd00|id) +# elif __BYTE_ORDER == __LITTLE_ENDIAN +# define _PATCHKEY(id) ((id<<8)|0x00fd) +# else +# error "could not determine byte order" +# endif +#endif + +#endif /* _LINUX_PATCHKEY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pci.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pci.h new file mode 100644 index 0000000..a5bb5c7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pci.h @@ -0,0 +1,41 @@ +/* + * pci.h + * + * PCI defines and function prototypes + * Copyright 1994, Drew Eckhardt + * Copyright 1997--1999 Martin Mares + * + * For more information, please consult the following manuals (look at + * http://www.pcisig.com/ for how to get them): + * + * PCI BIOS Specification + * PCI Local Bus Specification + * PCI to PCI Bridge Specification + * PCI System Design Guide + */ + +#ifndef LINUX_PCI_H +#define LINUX_PCI_H + +#include /* The pci register defines */ + +/* + * The PCI interface treats multi-function devices as independent + * devices. The slot/function address of each device is encoded + * in a single byte as follows: + * + * 7:3 = slot + * 2:0 = function + */ +#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) +#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) +#define PCI_FUNC(devfn) ((devfn) & 0x07) + +/* Ioctls for /proc/bus/pci/X/Y nodes. */ +#define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8) +#define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) /* Get controller for PCI device. */ +#define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) /* Set mmap state to I/O space. */ +#define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) /* Set mmap state to MEM space. */ +#define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) /* Enable/disable write-combining. */ + +#endif /* LINUX_PCI_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pci_regs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pci_regs.h new file mode 100644 index 0000000..616bf8b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pci_regs.h @@ -0,0 +1,654 @@ +/* + * pci_regs.h + * + * PCI standard defines + * Copyright 1994, Drew Eckhardt + * Copyright 1997--1999 Martin Mares + * + * For more information, please consult the following manuals (look at + * http://www.pcisig.com/ for how to get them): + * + * PCI BIOS Specification + * PCI Local Bus Specification + * PCI to PCI Bridge Specification + * PCI System Design Guide + * + * For hypertransport information, please consult the following manuals + * from http://www.hypertransport.org + * + * The Hypertransport I/O Link Specification + */ + +#ifndef LINUX_PCI_REGS_H +#define LINUX_PCI_REGS_H + +/* + * Under PCI, each device has 256 bytes of configuration address space, + * of which the first 64 bytes are standardized as follows: + */ +#define PCI_VENDOR_ID 0x00 /* 16 bits */ +#define PCI_DEVICE_ID 0x02 /* 16 bits */ +#define PCI_COMMAND 0x04 /* 16 bits */ +#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ +#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ +#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ +#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ +#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ +#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ +#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ +#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ +#define PCI_COMMAND_SERR 0x100 /* Enable SERR */ +#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ +#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ + +#define PCI_STATUS 0x06 /* 16 bits */ +#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ +#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ +#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ +#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ +#define PCI_STATUS_PARITY 0x100 /* Detected parity error */ +#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ +#define PCI_STATUS_DEVSEL_FAST 0x000 +#define PCI_STATUS_DEVSEL_MEDIUM 0x200 +#define PCI_STATUS_DEVSEL_SLOW 0x400 +#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ +#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ +#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ +#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ +#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ + +#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ +#define PCI_REVISION_ID 0x08 /* Revision ID */ +#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ +#define PCI_CLASS_DEVICE 0x0a /* Device class */ + +#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ +#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ +#define PCI_HEADER_TYPE 0x0e /* 8 bits */ +#define PCI_HEADER_TYPE_NORMAL 0 +#define PCI_HEADER_TYPE_BRIDGE 1 +#define PCI_HEADER_TYPE_CARDBUS 2 + +#define PCI_BIST 0x0f /* 8 bits */ +#define PCI_BIST_CODE_MASK 0x0f /* Return result */ +#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ +#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ + +/* + * Base addresses specify locations in memory or I/O space. + * Decoded size can be determined by writing a value of + * 0xffffffff to the register, and reading it back. Only + * 1 bits are decoded. + */ +#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ +#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ +#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ +#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ +#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ +#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ +#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ +#define PCI_BASE_ADDRESS_SPACE_IO 0x01 +#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 +#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 +#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ +#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ +#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ +#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ +#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) +#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) +/* bit 1 is reserved if address_space = 1 */ + +/* Header type 0 (normal devices) */ +#define PCI_CARDBUS_CIS 0x28 +#define PCI_SUBSYSTEM_VENDOR_ID 0x2c +#define PCI_SUBSYSTEM_ID 0x2e +#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ +#define PCI_ROM_ADDRESS_ENABLE 0x01 +#define PCI_ROM_ADDRESS_MASK (~0x7ffUL) + +#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ + +/* 0x35-0x3b are reserved */ +#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ +#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ +#define PCI_MIN_GNT 0x3e /* 8 bits */ +#define PCI_MAX_LAT 0x3f /* 8 bits */ + +/* Header type 1 (PCI-to-PCI bridges) */ +#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ +#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ +#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ +#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ +#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ +#define PCI_IO_LIMIT 0x1d +#define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ +#define PCI_IO_RANGE_TYPE_16 0x00 +#define PCI_IO_RANGE_TYPE_32 0x01 +#define PCI_IO_RANGE_MASK (~0x0fUL) +#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ +#define PCI_MEMORY_BASE 0x20 /* Memory range behind */ +#define PCI_MEMORY_LIMIT 0x22 +#define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL +#define PCI_MEMORY_RANGE_MASK (~0x0fUL) +#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ +#define PCI_PREF_MEMORY_LIMIT 0x26 +#define PCI_PREF_RANGE_TYPE_MASK 0x0fUL +#define PCI_PREF_RANGE_TYPE_32 0x00 +#define PCI_PREF_RANGE_TYPE_64 0x01 +#define PCI_PREF_RANGE_MASK (~0x0fUL) +#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ +#define PCI_PREF_LIMIT_UPPER32 0x2c +#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ +#define PCI_IO_LIMIT_UPPER16 0x32 +/* 0x34 same as for htype 0 */ +/* 0x35-0x3b is reserved */ +#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ +/* 0x3c-0x3d are same as for htype 0 */ +#define PCI_BRIDGE_CONTROL 0x3e +#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ +#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ +#define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */ +#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ +#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ +#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ +#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ + +/* Header type 2 (CardBus bridges) */ +#define PCI_CB_CAPABILITY_LIST 0x14 +/* 0x15 reserved */ +#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ +#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ +#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ +#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ +#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ +#define PCI_CB_MEMORY_BASE_0 0x1c +#define PCI_CB_MEMORY_LIMIT_0 0x20 +#define PCI_CB_MEMORY_BASE_1 0x24 +#define PCI_CB_MEMORY_LIMIT_1 0x28 +#define PCI_CB_IO_BASE_0 0x2c +#define PCI_CB_IO_BASE_0_HI 0x2e +#define PCI_CB_IO_LIMIT_0 0x30 +#define PCI_CB_IO_LIMIT_0_HI 0x32 +#define PCI_CB_IO_BASE_1 0x34 +#define PCI_CB_IO_BASE_1_HI 0x36 +#define PCI_CB_IO_LIMIT_1 0x38 +#define PCI_CB_IO_LIMIT_1_HI 0x3a +#define PCI_CB_IO_RANGE_MASK (~0x03UL) +/* 0x3c-0x3d are same as for htype 0 */ +#define PCI_CB_BRIDGE_CONTROL 0x3e +#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ +#define PCI_CB_BRIDGE_CTL_SERR 0x02 +#define PCI_CB_BRIDGE_CTL_ISA 0x04 +#define PCI_CB_BRIDGE_CTL_VGA 0x08 +#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 +#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ +#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 +#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 +#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 +#define PCI_CB_SUBSYSTEM_ID 0x42 +#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ +/* 0x48-0x7f reserved */ + +/* Capability lists */ + +#define PCI_CAP_LIST_ID 0 /* Capability ID */ +#define PCI_CAP_ID_PM 0x01 /* Power Management */ +#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ +#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ +#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ +#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ +#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ +#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ +#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ +#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */ +#define PCI_CAP_ID_DBG 0x0A /* Debug port */ +#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ +#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ +#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ +#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ +#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ +#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ +#define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ +#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ +#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ +#define PCI_CAP_SIZEOF 4 + +/* Power Management Registers */ + +#define PCI_PM_PMC 2 /* PM Capabilities Register */ +#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ +#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ +#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ +#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ +#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ +#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ +#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ +#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ +#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ +#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ +#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ +#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ +#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ +#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ +#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */ +#define PCI_PM_CTRL 4 /* PM control and status register */ +#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ +#define PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */ +#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ +#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ +#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ +#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ +#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ +#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ +#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ +#define PCI_PM_DATA_REGISTER 7 /* (??) */ +#define PCI_PM_SIZEOF 8 + +/* AGP registers */ + +#define PCI_AGP_VERSION 2 /* BCD version number */ +#define PCI_AGP_RFU 3 /* Rest of capability flags */ +#define PCI_AGP_STATUS 4 /* Status register */ +#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ +#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ +#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ +#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ +#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ +#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ +#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ +#define PCI_AGP_COMMAND 8 /* Control register */ +#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ +#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ +#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ +#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ +#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ +#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ +#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ +#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ +#define PCI_AGP_SIZEOF 12 + +/* Vital Product Data */ + +#define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ +#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ +#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ +#define PCI_VPD_DATA 4 /* 32-bits of data returned here */ + +/* Slot Identification */ + +#define PCI_SID_ESR 2 /* Expansion Slot Register */ +#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ +#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ +#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ + +/* Message Signalled Interrupts registers */ + +#define PCI_MSI_FLAGS 2 /* Various flags */ +#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ +#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ +#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ +#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ +#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ +#define PCI_MSI_RFU 3 /* Rest of capability flags */ +#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ +#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ +#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ +#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ +#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ + +/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */ +#define PCI_MSIX_FLAGS 2 +#define PCI_MSIX_FLAGS_QSIZE 0x7FF +#define PCI_MSIX_FLAGS_ENABLE (1 << 15) +#define PCI_MSIX_FLAGS_MASKALL (1 << 14) +#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) +#define PCI_MSIX_FLAGS_BITMASK (1 << 0) + +/* CompactPCI Hotswap Register */ + +#define PCI_CHSWP_CSR 2 /* Control and Status Register */ +#define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ +#define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ +#define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ +#define PCI_CHSWP_LOO 0x08 /* LED On / Off */ +#define PCI_CHSWP_PI 0x30 /* Programming Interface */ +#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ +#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ + +/* PCI Advanced Feature registers */ + +#define PCI_AF_LENGTH 2 +#define PCI_AF_CAP 3 +#define PCI_AF_CAP_TP 0x01 +#define PCI_AF_CAP_FLR 0x02 +#define PCI_AF_CTRL 4 +#define PCI_AF_CTRL_FLR 0x01 +#define PCI_AF_STATUS 5 +#define PCI_AF_STATUS_TP 0x01 + +/* PCI-X registers */ + +#define PCI_X_CMD 2 /* Modes & Features */ +#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ +#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ +#define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */ +#define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */ +#define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */ +#define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */ +#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ + /* Max # of outstanding split transactions */ +#define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */ +#define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */ +#define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */ +#define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */ +#define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */ +#define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */ +#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ +#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ +#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ +#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ +#define PCI_X_STATUS 4 /* PCI-X capabilities */ +#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ +#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ +#define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ +#define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ +#define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ +#define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ +#define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ +#define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ +#define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ +#define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ +#define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ +#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ +#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ + +/* PCI Express capability registers */ + +#define PCI_EXP_FLAGS 2 /* Capabilities register */ +#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ +#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ +#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ +#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ +#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ +#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ +#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ +#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ +#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ +#define PCI_EXP_TYPE_RC_EC 0x10 /* Root Complex Event Collector */ +#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ +#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ +#define PCI_EXP_DEVCAP 4 /* Device capabilities */ +#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ +#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ +#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ +#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ +#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ +#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ +#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ +#define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */ +#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ +#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ +#define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */ +#define PCI_EXP_DEVCTL 8 /* Device Control */ +#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ +#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ +#define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ +#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ +#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ +#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ +#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ +#define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */ +#define PCI_EXP_DEVSTA 10 /* Device Status */ +#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ +#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ +#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ +#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ +#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ +#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ +#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ +#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ +#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ +#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ +#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ +#define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */ +#define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* L1 Clock Power Management */ +#define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Suprise Down Error Reporting Capable */ +#define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */ +#define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */ +#define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */ +#define PCI_EXP_LNKCTL 16 /* Link Control */ +#define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */ +#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ +#define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */ +#define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */ +#define PCI_EXP_LNKCTL_CCC 0x0040 /* Common Clock Configuration */ +#define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */ +#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ +#define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */ +#define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */ +#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */ +#define PCI_EXP_LNKSTA 18 /* Link Status */ +#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ +#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */ +#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ +#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ +#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ +#define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */ +#define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */ +#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ +#define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */ +#define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */ +#define PCI_EXP_SLTCAP_MRLSP 0x00000004 /* MRL Sensor Present */ +#define PCI_EXP_SLTCAP_AIP 0x00000008 /* Attention Indicator Present */ +#define PCI_EXP_SLTCAP_PIP 0x00000010 /* Power Indicator Present */ +#define PCI_EXP_SLTCAP_HPS 0x00000020 /* Hot-Plug Surprise */ +#define PCI_EXP_SLTCAP_HPC 0x00000040 /* Hot-Plug Capable */ +#define PCI_EXP_SLTCAP_SPLV 0x00007f80 /* Slot Power Limit Value */ +#define PCI_EXP_SLTCAP_SPLS 0x00018000 /* Slot Power Limit Scale */ +#define PCI_EXP_SLTCAP_EIP 0x00020000 /* Electromechanical Interlock Present */ +#define PCI_EXP_SLTCAP_NCCS 0x00040000 /* No Command Completed Support */ +#define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */ +#define PCI_EXP_SLTCTL 24 /* Slot Control */ +#define PCI_EXP_SLTCTL_ABPE 0x0001 /* Attention Button Pressed Enable */ +#define PCI_EXP_SLTCTL_PFDE 0x0002 /* Power Fault Detected Enable */ +#define PCI_EXP_SLTCTL_MRLSCE 0x0004 /* MRL Sensor Changed Enable */ +#define PCI_EXP_SLTCTL_PDCE 0x0008 /* Presence Detect Changed Enable */ +#define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */ +#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ +#define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */ +#define PCI_EXP_SLTCTL_PIC 0x0300 /* Power Indicator Control */ +#define PCI_EXP_SLTCTL_PCC 0x0400 /* Power Controller Control */ +#define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */ +#define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */ +#define PCI_EXP_SLTSTA 26 /* Slot Status */ +#define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */ +#define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */ +#define PCI_EXP_SLTSTA_MRLSC 0x0004 /* MRL Sensor Changed */ +#define PCI_EXP_SLTSTA_PDC 0x0008 /* Presence Detect Changed */ +#define PCI_EXP_SLTSTA_CC 0x0010 /* Command Completed */ +#define PCI_EXP_SLTSTA_MRLSS 0x0020 /* MRL Sensor State */ +#define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */ +#define PCI_EXP_SLTSTA_EIS 0x0080 /* Electromechanical Interlock Status */ +#define PCI_EXP_SLTSTA_DLLSC 0x0100 /* Data Link Layer State Changed */ +#define PCI_EXP_RTCTL 28 /* Root Control */ +#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ +#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ +#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ +#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ +#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ +#define PCI_EXP_RTCAP 30 /* Root Capabilities */ +#define PCI_EXP_RTSTA 32 /* Root Status */ +#define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ +#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ +#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ +#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ +#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ +#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ + +/* Extended Capabilities (PCI-X 2.0 and Express) */ +#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) +#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) +#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) + +#define PCI_EXT_CAP_ID_ERR 1 +#define PCI_EXT_CAP_ID_VC 2 +#define PCI_EXT_CAP_ID_DSN 3 +#define PCI_EXT_CAP_ID_PWR 4 +#define PCI_EXT_CAP_ID_ARI 14 +#define PCI_EXT_CAP_ID_SRIOV 16 + +/* Advanced Error Reporting */ +#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ +#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ +#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ +#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ +#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ +#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ +#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ +#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ +#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ +#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ +#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ +#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ +#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ + /* Same bits as above */ +#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ + /* Same bits as above */ +#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ +#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ +#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ +#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ +#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ +#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ +#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ + /* Same bits as above */ +#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ +#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ +#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ +#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ +#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ +#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ +#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ +#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ +/* Correctable Err Reporting Enable */ +#define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 +/* Non-fatal Err Reporting Enable */ +#define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 +/* Fatal Err Reporting Enable */ +#define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 +#define PCI_ERR_ROOT_STATUS 48 +#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */ +/* Multi ERR_COR Received */ +#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 +/* ERR_FATAL/NONFATAL Recevied */ +#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 +/* Multi ERR_FATAL/NONFATAL Recevied */ +#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 +#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ +#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ +#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ +#define PCI_ERR_ROOT_COR_SRC 52 +#define PCI_ERR_ROOT_SRC 54 + +/* Virtual Channel */ +#define PCI_VC_PORT_REG1 4 +#define PCI_VC_PORT_REG2 8 +#define PCI_VC_PORT_CTRL 12 +#define PCI_VC_PORT_STATUS 14 +#define PCI_VC_RES_CAP 16 +#define PCI_VC_RES_CTRL 20 +#define PCI_VC_RES_STATUS 26 + +/* Power Budgeting */ +#define PCI_PWR_DSR 4 /* Data Select Register */ +#define PCI_PWR_DATA 8 /* Data Register */ +#define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ +#define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ +#define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ +#define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ +#define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ +#define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ +#define PCI_PWR_CAP 12 /* Capability */ +#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ + +/* + * Hypertransport sub capability types + * + * Unfortunately there are both 3 bit and 5 bit capability types defined + * in the HT spec, catering for that is a little messy. You probably don't + * want to use these directly, just use pci_find_ht_capability() and it + * will do the right thing for you. + */ +#define HT_3BIT_CAP_MASK 0xE0 +#define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */ +#define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */ + +#define HT_5BIT_CAP_MASK 0xF8 +#define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */ +#define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */ +#define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */ +#define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */ +#define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */ +#define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */ +#define HT_MSI_FLAGS 0x02 /* Offset to flags */ +#define HT_MSI_FLAGS_ENABLE 0x1 /* Mapping enable */ +#define HT_MSI_FLAGS_FIXED 0x2 /* Fixed mapping only */ +#define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL /* Fixed addr */ +#define HT_MSI_ADDR_LO 0x04 /* Offset to low addr bits */ +#define HT_MSI_ADDR_LO_MASK 0xFFF00000 /* Low address bit mask */ +#define HT_MSI_ADDR_HI 0x08 /* Offset to high addr bits */ +#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ +#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ +#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ +#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ +#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ + +/* Alternative Routing-ID Interpretation */ +#define PCI_ARI_CAP 0x04 /* ARI Capability Register */ +#define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */ +#define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */ +#define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */ +#define PCI_ARI_CTRL 0x06 /* ARI Control Register */ +#define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ +#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ +#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ + +/* Single Root I/O Virtualization */ +#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ +#define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */ +#define PCI_SRIOV_CAP_INTR(x) ((x) >> 21) /* Interrupt Message Number */ +#define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */ +#define PCI_SRIOV_CTRL_VFE 0x01 /* VF Enable */ +#define PCI_SRIOV_CTRL_VFM 0x02 /* VF Migration Enable */ +#define PCI_SRIOV_CTRL_INTR 0x04 /* VF Migration Interrupt Enable */ +#define PCI_SRIOV_CTRL_MSE 0x08 /* VF Memory Space Enable */ +#define PCI_SRIOV_CTRL_ARI 0x10 /* ARI Capable Hierarchy */ +#define PCI_SRIOV_STATUS 0x0a /* SR-IOV Status */ +#define PCI_SRIOV_STATUS_VFM 0x01 /* VF Migration Status */ +#define PCI_SRIOV_INITIAL_VF 0x0c /* Initial VFs */ +#define PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */ +#define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs */ +#define PCI_SRIOV_FUNC_LINK 0x12 /* Function Dependency Link */ +#define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */ +#define PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */ +#define PCI_SRIOV_VF_DID 0x1a /* VF Device ID */ +#define PCI_SRIOV_SUP_PGSIZE 0x1c /* Supported Page Sizes */ +#define PCI_SRIOV_SYS_PGSIZE 0x20 /* System Page Size */ +#define PCI_SRIOV_BAR 0x24 /* VF BAR0 */ +#define PCI_SRIOV_NUM_BARS 6 /* Number of VF BARs */ +#define PCI_SRIOV_VFM 0x3c /* VF Migration State Array Offset*/ +#define PCI_SRIOV_VFM_BIR(x) ((x) & 7) /* State BIR */ +#define PCI_SRIOV_VFM_OFFSET(x) ((x) & ~7) /* State Offset */ +#define PCI_SRIOV_VFM_UA 0x0 /* Inactive.Unavailable */ +#define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */ +#define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ +#define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ + +#endif /* LINUX_PCI_REGS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/personality.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/personality.h new file mode 100644 index 0000000..9f1ab5e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/personality.h @@ -0,0 +1,65 @@ +#ifndef _LINUX_PERSONALITY_H +#define _LINUX_PERSONALITY_H + + +/* + * Flags for bug emulation. + * + * These occupy the top three bytes. + */ +enum { + ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ + FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors + * (signal handling) + */ + MMAP_PAGE_ZERO = 0x0100000, + ADDR_COMPAT_LAYOUT = 0x0200000, + READ_IMPLIES_EXEC = 0x0400000, + ADDR_LIMIT_32BIT = 0x0800000, + SHORT_INODE = 0x1000000, + WHOLE_SECONDS = 0x2000000, + STICKY_TIMEOUTS = 0x4000000, + ADDR_LIMIT_3GB = 0x8000000, +}; + +/* + * Security-relevant compatibility flags that must be + * cleared upon setuid or setgid exec: + */ +#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE) + +/* + * Personality types. + * + * These go in the low byte. Avoid using the top bit, it will + * conflict with error returns. + */ +enum { + PER_LINUX = 0x0000, + PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, + PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, + PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, + PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, + PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | + WHOLE_SECONDS | SHORT_INODE, + PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, + PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, + PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, + PER_BSD = 0x0006, + PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, + PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, + PER_LINUX32 = 0x0008, + PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, + PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */ + PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */ + PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */ + PER_RISCOS = 0x000c, + PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, + PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, + PER_OSF4 = 0x000f, /* OSF/1 v4 */ + PER_HPUX = 0x0010, + PER_MASK = 0x00ff, +}; + + +#endif /* _LINUX_PERSONALITY_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pfkeyv2.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pfkeyv2.h new file mode 100644 index 0000000..228b0b6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pfkeyv2.h @@ -0,0 +1,369 @@ +/* PF_KEY user interface, this is defined by rfc2367 so + * do not make arbitrary modifications or else this header + * file will not be compliant. + */ + +#ifndef _LINUX_PFKEY2_H +#define _LINUX_PFKEY2_H + +#include + +#define PF_KEY_V2 2 +#define PFKEYV2_REVISION 199806L + +struct sadb_msg { + __u8 sadb_msg_version; + __u8 sadb_msg_type; + __u8 sadb_msg_errno; + __u8 sadb_msg_satype; + __u16 sadb_msg_len; + __u16 sadb_msg_reserved; + __u32 sadb_msg_seq; + __u32 sadb_msg_pid; +} __attribute__((packed)); +/* sizeof(struct sadb_msg) == 16 */ + +struct sadb_ext { + __u16 sadb_ext_len; + __u16 sadb_ext_type; +} __attribute__((packed)); +/* sizeof(struct sadb_ext) == 4 */ + +struct sadb_sa { + __u16 sadb_sa_len; + __u16 sadb_sa_exttype; + __be32 sadb_sa_spi; + __u8 sadb_sa_replay; + __u8 sadb_sa_state; + __u8 sadb_sa_auth; + __u8 sadb_sa_encrypt; + __u32 sadb_sa_flags; +} __attribute__((packed)); +/* sizeof(struct sadb_sa) == 16 */ + +struct sadb_lifetime { + __u16 sadb_lifetime_len; + __u16 sadb_lifetime_exttype; + __u32 sadb_lifetime_allocations; + __u64 sadb_lifetime_bytes; + __u64 sadb_lifetime_addtime; + __u64 sadb_lifetime_usetime; +} __attribute__((packed)); +/* sizeof(struct sadb_lifetime) == 32 */ + +struct sadb_address { + __u16 sadb_address_len; + __u16 sadb_address_exttype; + __u8 sadb_address_proto; + __u8 sadb_address_prefixlen; + __u16 sadb_address_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_address) == 8 */ + +struct sadb_key { + __u16 sadb_key_len; + __u16 sadb_key_exttype; + __u16 sadb_key_bits; + __u16 sadb_key_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_key) == 8 */ + +struct sadb_ident { + __u16 sadb_ident_len; + __u16 sadb_ident_exttype; + __u16 sadb_ident_type; + __u16 sadb_ident_reserved; + __u64 sadb_ident_id; +} __attribute__((packed)); +/* sizeof(struct sadb_ident) == 16 */ + +struct sadb_sens { + __u16 sadb_sens_len; + __u16 sadb_sens_exttype; + __u32 sadb_sens_dpd; + __u8 sadb_sens_sens_level; + __u8 sadb_sens_sens_len; + __u8 sadb_sens_integ_level; + __u8 sadb_sens_integ_len; + __u32 sadb_sens_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_sens) == 16 */ + +/* followed by: + __u64 sadb_sens_bitmap[sens_len]; + __u64 sadb_integ_bitmap[integ_len]; */ + +struct sadb_prop { + __u16 sadb_prop_len; + __u16 sadb_prop_exttype; + __u8 sadb_prop_replay; + __u8 sadb_prop_reserved[3]; +} __attribute__((packed)); +/* sizeof(struct sadb_prop) == 8 */ + +/* followed by: + struct sadb_comb sadb_combs[(sadb_prop_len + + sizeof(__u64) - sizeof(struct sadb_prop)) / + sizeof(struct sadb_comb)]; */ + +struct sadb_comb { + __u8 sadb_comb_auth; + __u8 sadb_comb_encrypt; + __u16 sadb_comb_flags; + __u16 sadb_comb_auth_minbits; + __u16 sadb_comb_auth_maxbits; + __u16 sadb_comb_encrypt_minbits; + __u16 sadb_comb_encrypt_maxbits; + __u32 sadb_comb_reserved; + __u32 sadb_comb_soft_allocations; + __u32 sadb_comb_hard_allocations; + __u64 sadb_comb_soft_bytes; + __u64 sadb_comb_hard_bytes; + __u64 sadb_comb_soft_addtime; + __u64 sadb_comb_hard_addtime; + __u64 sadb_comb_soft_usetime; + __u64 sadb_comb_hard_usetime; +} __attribute__((packed)); +/* sizeof(struct sadb_comb) == 72 */ + +struct sadb_supported { + __u16 sadb_supported_len; + __u16 sadb_supported_exttype; + __u32 sadb_supported_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_supported) == 8 */ + +/* followed by: + struct sadb_alg sadb_algs[(sadb_supported_len + + sizeof(__u64) - sizeof(struct sadb_supported)) / + sizeof(struct sadb_alg)]; */ + +struct sadb_alg { + __u8 sadb_alg_id; + __u8 sadb_alg_ivlen; + __u16 sadb_alg_minbits; + __u16 sadb_alg_maxbits; + __u16 sadb_alg_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_alg) == 8 */ + +struct sadb_spirange { + __u16 sadb_spirange_len; + __u16 sadb_spirange_exttype; + __u32 sadb_spirange_min; + __u32 sadb_spirange_max; + __u32 sadb_spirange_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_spirange) == 16 */ + +struct sadb_x_kmprivate { + __u16 sadb_x_kmprivate_len; + __u16 sadb_x_kmprivate_exttype; + __u32 sadb_x_kmprivate_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_x_kmprivate) == 8 */ + +struct sadb_x_sa2 { + __u16 sadb_x_sa2_len; + __u16 sadb_x_sa2_exttype; + __u8 sadb_x_sa2_mode; + __u8 sadb_x_sa2_reserved1; + __u16 sadb_x_sa2_reserved2; + __u32 sadb_x_sa2_sequence; + __u32 sadb_x_sa2_reqid; +} __attribute__((packed)); +/* sizeof(struct sadb_x_sa2) == 16 */ + +struct sadb_x_policy { + __u16 sadb_x_policy_len; + __u16 sadb_x_policy_exttype; + __u16 sadb_x_policy_type; + __u8 sadb_x_policy_dir; + __u8 sadb_x_policy_reserved; + __u32 sadb_x_policy_id; + __u32 sadb_x_policy_priority; +} __attribute__((packed)); +/* sizeof(struct sadb_x_policy) == 16 */ + +struct sadb_x_ipsecrequest { + __u16 sadb_x_ipsecrequest_len; + __u16 sadb_x_ipsecrequest_proto; + __u8 sadb_x_ipsecrequest_mode; + __u8 sadb_x_ipsecrequest_level; + __u16 sadb_x_ipsecrequest_reserved1; + __u32 sadb_x_ipsecrequest_reqid; + __u32 sadb_x_ipsecrequest_reserved2; +} __attribute__((packed)); +/* sizeof(struct sadb_x_ipsecrequest) == 16 */ + +/* This defines the TYPE of Nat Traversal in use. Currently only one + * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 + */ +struct sadb_x_nat_t_type { + __u16 sadb_x_nat_t_type_len; + __u16 sadb_x_nat_t_type_exttype; + __u8 sadb_x_nat_t_type_type; + __u8 sadb_x_nat_t_type_reserved[3]; +} __attribute__((packed)); +/* sizeof(struct sadb_x_nat_t_type) == 8 */ + +/* Pass a NAT Traversal port (Source or Dest port) */ +struct sadb_x_nat_t_port { + __u16 sadb_x_nat_t_port_len; + __u16 sadb_x_nat_t_port_exttype; + __be16 sadb_x_nat_t_port_port; + __u16 sadb_x_nat_t_port_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_x_nat_t_port) == 8 */ + +/* Generic LSM security context */ +struct sadb_x_sec_ctx { + __u16 sadb_x_sec_len; + __u16 sadb_x_sec_exttype; + __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ + __u8 sadb_x_ctx_doi; + __u16 sadb_x_ctx_len; +} __attribute__((packed)); +/* sizeof(struct sadb_sec_ctx) = 8 */ + +/* Used by MIGRATE to pass addresses IKE will use to perform + * negotiation with the peer */ +struct sadb_x_kmaddress { + __u16 sadb_x_kmaddress_len; + __u16 sadb_x_kmaddress_exttype; + __u32 sadb_x_kmaddress_reserved; +} __attribute__((packed)); +/* sizeof(struct sadb_x_kmaddress) == 8 */ + +/* Message types */ +#define SADB_RESERVED 0 +#define SADB_GETSPI 1 +#define SADB_UPDATE 2 +#define SADB_ADD 3 +#define SADB_DELETE 4 +#define SADB_GET 5 +#define SADB_ACQUIRE 6 +#define SADB_REGISTER 7 +#define SADB_EXPIRE 8 +#define SADB_FLUSH 9 +#define SADB_DUMP 10 +#define SADB_X_PROMISC 11 +#define SADB_X_PCHANGE 12 +#define SADB_X_SPDUPDATE 13 +#define SADB_X_SPDADD 14 +#define SADB_X_SPDDELETE 15 +#define SADB_X_SPDGET 16 +#define SADB_X_SPDACQUIRE 17 +#define SADB_X_SPDDUMP 18 +#define SADB_X_SPDFLUSH 19 +#define SADB_X_SPDSETIDX 20 +#define SADB_X_SPDEXPIRE 21 +#define SADB_X_SPDDELETE2 22 +#define SADB_X_NAT_T_NEW_MAPPING 23 +#define SADB_X_MIGRATE 24 +#define SADB_MAX 24 + +/* Security Association flags */ +#define SADB_SAFLAGS_PFS 1 +#define SADB_SAFLAGS_NOPMTUDISC 0x20000000 +#define SADB_SAFLAGS_DECAP_DSCP 0x40000000 +#define SADB_SAFLAGS_NOECN 0x80000000 + +/* Security Association states */ +#define SADB_SASTATE_LARVAL 0 +#define SADB_SASTATE_MATURE 1 +#define SADB_SASTATE_DYING 2 +#define SADB_SASTATE_DEAD 3 +#define SADB_SASTATE_MAX 3 + +/* Security Association types */ +#define SADB_SATYPE_UNSPEC 0 +#define SADB_SATYPE_AH 2 +#define SADB_SATYPE_ESP 3 +#define SADB_SATYPE_RSVP 5 +#define SADB_SATYPE_OSPFV2 6 +#define SADB_SATYPE_RIPV2 7 +#define SADB_SATYPE_MIP 8 +#define SADB_X_SATYPE_IPCOMP 9 +#define SADB_SATYPE_MAX 9 + +/* Authentication algorithms */ +#define SADB_AALG_NONE 0 +#define SADB_AALG_MD5HMAC 2 +#define SADB_AALG_SHA1HMAC 3 +#define SADB_X_AALG_SHA2_256HMAC 5 +#define SADB_X_AALG_SHA2_384HMAC 6 +#define SADB_X_AALG_SHA2_512HMAC 7 +#define SADB_X_AALG_RIPEMD160HMAC 8 +#define SADB_X_AALG_AES_XCBC_MAC 9 +#define SADB_X_AALG_NULL 251 /* kame */ +#define SADB_AALG_MAX 251 + +/* Encryption algorithms */ +#define SADB_EALG_NONE 0 +#define SADB_EALG_DESCBC 2 +#define SADB_EALG_3DESCBC 3 +#define SADB_X_EALG_CASTCBC 6 +#define SADB_X_EALG_BLOWFISHCBC 7 +#define SADB_EALG_NULL 11 +#define SADB_X_EALG_AESCBC 12 +#define SADB_X_EALG_AESCTR 13 +#define SADB_X_EALG_AES_CCM_ICV8 14 +#define SADB_X_EALG_AES_CCM_ICV12 15 +#define SADB_X_EALG_AES_CCM_ICV16 16 +#define SADB_X_EALG_AES_GCM_ICV8 18 +#define SADB_X_EALG_AES_GCM_ICV12 19 +#define SADB_X_EALG_AES_GCM_ICV16 20 +#define SADB_X_EALG_CAMELLIACBC 22 +#define SADB_EALG_MAX 253 /* last EALG */ +/* private allocations should use 249-255 (RFC2407) */ +#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ +#define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ + +/* Compression algorithms */ +#define SADB_X_CALG_NONE 0 +#define SADB_X_CALG_OUI 1 +#define SADB_X_CALG_DEFLATE 2 +#define SADB_X_CALG_LZS 3 +#define SADB_X_CALG_LZJH 4 +#define SADB_X_CALG_MAX 4 + +/* Extension Header values */ +#define SADB_EXT_RESERVED 0 +#define SADB_EXT_SA 1 +#define SADB_EXT_LIFETIME_CURRENT 2 +#define SADB_EXT_LIFETIME_HARD 3 +#define SADB_EXT_LIFETIME_SOFT 4 +#define SADB_EXT_ADDRESS_SRC 5 +#define SADB_EXT_ADDRESS_DST 6 +#define SADB_EXT_ADDRESS_PROXY 7 +#define SADB_EXT_KEY_AUTH 8 +#define SADB_EXT_KEY_ENCRYPT 9 +#define SADB_EXT_IDENTITY_SRC 10 +#define SADB_EXT_IDENTITY_DST 11 +#define SADB_EXT_SENSITIVITY 12 +#define SADB_EXT_PROPOSAL 13 +#define SADB_EXT_SUPPORTED_AUTH 14 +#define SADB_EXT_SUPPORTED_ENCRYPT 15 +#define SADB_EXT_SPIRANGE 16 +#define SADB_X_EXT_KMPRIVATE 17 +#define SADB_X_EXT_POLICY 18 +#define SADB_X_EXT_SA2 19 +/* The next four entries are for setting up NAT Traversal */ +#define SADB_X_EXT_NAT_T_TYPE 20 +#define SADB_X_EXT_NAT_T_SPORT 21 +#define SADB_X_EXT_NAT_T_DPORT 22 +#define SADB_X_EXT_NAT_T_OA 23 +#define SADB_X_EXT_SEC_CTX 24 +/* Used with MIGRATE to pass @ to IKE for negotiation */ +#define SADB_X_EXT_KMADDRESS 25 +#define SADB_EXT_MAX 25 + +/* Identity Extension values */ +#define SADB_IDENTTYPE_RESERVED 0 +#define SADB_IDENTTYPE_PREFIX 1 +#define SADB_IDENTTYPE_FQDN 2 +#define SADB_IDENTTYPE_USERFQDN 3 +#define SADB_IDENTTYPE_MAX 3 + +#endif /* !(_LINUX_PFKEY2_H) */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pg.h new file mode 100644 index 0000000..db994bb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pg.h @@ -0,0 +1,63 @@ +/* pg.h (c) 1998 Grant R. Guenther + Under the terms of the GNU General Public License + + + pg.h defines the user interface to the generic ATAPI packet + command driver for parallel port ATAPI devices (pg). The + driver is loosely modelled after the generic SCSI driver, sg, + although the actual interface is different. + + The pg driver provides a simple character device interface for + sending ATAPI commands to a device. With the exception of the + ATAPI reset operation, all operations are performed by a pair + of read and write operations to the appropriate /dev/pgN device. + A write operation delivers a command and any outbound data in + a single buffer. Normally, the write will succeed unless the + device is offline or malfunctioning, or there is already another + command pending. If the write succeeds, it should be followed + immediately by a read operation, to obtain any returned data and + status information. A read will fail if there is no operation + in progress. + + As a special case, the device can be reset with a write operation, + and in this case, no following read is expected, or permitted. + + There are no ioctl() operations. Any single operation + may transfer at most PG_MAX_DATA bytes. Note that the driver must + copy the data through an internal buffer. In keeping with all + current ATAPI devices, command packets are assumed to be exactly + 12 bytes in length. + + To permit future changes to this interface, the headers in the + read and write buffers contain a single character "magic" flag. + Currently this flag must be the character "P". + +*/ + +#define PG_MAGIC 'P' +#define PG_RESET 'Z' +#define PG_COMMAND 'C' + +#define PG_MAX_DATA 32768 + +struct pg_write_hdr { + + char magic; /* == PG_MAGIC */ + char func; /* PG_RESET or PG_COMMAND */ + int dlen; /* number of bytes expected to transfer */ + int timeout; /* number of seconds before timeout */ + char packet[12]; /* packet command */ + +}; + +struct pg_read_hdr { + + char magic; /* == PG_MAGIC */ + char scsi; /* "scsi" status == sense key */ + int dlen; /* size of device transfer request */ + int duration; /* time in seconds command took */ + char pad[12]; /* not used */ + +}; + +/* end of pg.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/phantom.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/phantom.h new file mode 100644 index 0000000..94dd664 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/phantom.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2005-2007 Jiri Slaby + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __PHANTOM_H +#define __PHANTOM_H + +#include + +/* PHN_(G/S)ET_REG param */ +struct phm_reg { + __u32 reg; + __u32 value; +}; + +/* PHN_(G/S)ET_REGS param */ +struct phm_regs { + __u32 count; + __u32 mask; + __u32 values[8]; +}; + +#define PH_IOC_MAGIC 'p' +#define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) +#define PHN_SET_REG _IOW(PH_IOC_MAGIC, 1, struct phm_reg *) +#define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) +#define PHN_SET_REGS _IOW(PH_IOC_MAGIC, 3, struct phm_regs *) +/* this ioctl tells the driver, that the caller is not OpenHaptics and might + * use improved registers update (no more phantom switchoffs when using + * libphantom) */ +#define PHN_NOT_OH _IO(PH_IOC_MAGIC, 4) +#define PHN_GETREG _IOWR(PH_IOC_MAGIC, 5, struct phm_reg) +#define PHN_SETREG _IOW(PH_IOC_MAGIC, 6, struct phm_reg) +#define PHN_GETREGS _IOWR(PH_IOC_MAGIC, 7, struct phm_regs) +#define PHN_SETREGS _IOW(PH_IOC_MAGIC, 8, struct phm_regs) + +#define PHN_CONTROL 0x6 /* control byte in iaddr space */ +#define PHN_CTL_AMP 0x1 /* switch after torques change */ +#define PHN_CTL_BUT 0x2 /* is button switched */ +#define PHN_CTL_IRQ 0x10 /* is irq enabled */ + +#define PHN_ZERO_FORCE 2048 /* zero torque on motor */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/phonet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/phonet.h new file mode 100644 index 0000000..3ad3eea --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/phonet.h @@ -0,0 +1,173 @@ +/** + * file phonet.h + * + * Phonet sockets kernel interface + * + * Copyright (C) 2008 Nokia Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef LINUX_PHONET_H +#define LINUX_PHONET_H + +#include + +/* Automatic protocol selection */ +#define PN_PROTO_TRANSPORT 0 +/* Phonet datagram socket */ +#define PN_PROTO_PHONET 1 +/* Phonet pipe */ +#define PN_PROTO_PIPE 2 +#define PHONET_NPROTO 3 + +/* Socket options for SOL_PNPIPE level */ +#define PNPIPE_ENCAP 1 +#define PNPIPE_IFINDEX 2 + +#define PNADDR_ANY 0 +#define PNPORT_RESOURCE_ROUTING 0 + +/* Values for PNPIPE_ENCAP option */ +#define PNPIPE_ENCAP_NONE 0 +#define PNPIPE_ENCAP_IP 1 + +/* ioctls */ +#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) + +/* Phonet protocol header */ +struct phonethdr { + __u8 pn_rdev; + __u8 pn_sdev; + __u8 pn_res; + __be16 pn_length; + __u8 pn_robj; + __u8 pn_sobj; +} __attribute__((packed)); + +/* Common Phonet payload header */ +struct phonetmsg { + __u8 pn_trans_id; /* transaction ID */ + __u8 pn_msg_id; /* message type */ + union { + struct { + __u8 pn_submsg_id; /* message subtype */ + __u8 pn_data[5]; + } base; + struct { + __u16 pn_e_res_id; /* extended resource ID */ + __u8 pn_e_submsg_id; /* message subtype */ + __u8 pn_e_data[3]; + } ext; + } pn_msg_u; +}; +#define PN_COMMON_MESSAGE 0xF0 +#define PN_COMMGR 0x10 +#define PN_PREFIX 0xE0 /* resource for extended messages */ +#define pn_submsg_id pn_msg_u.base.pn_submsg_id +#define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id +#define pn_e_res_id pn_msg_u.ext.pn_e_res_id +#define pn_data pn_msg_u.base.pn_data +#define pn_e_data pn_msg_u.ext.pn_e_data + +/* data for unreachable errors */ +#define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01 +#define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14 +#define pn_orig_msg_id pn_data[0] +#define pn_status pn_data[1] +#define pn_e_orig_msg_id pn_e_data[0] +#define pn_e_status pn_e_data[1] + +/* Phonet socket address structure */ +struct sockaddr_pn { + sa_family_t spn_family; + __u8 spn_obj; + __u8 spn_dev; + __u8 spn_resource; + __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3]; +} __attribute__ ((packed)); + +static __inline__ __u16 pn_object(__u8 addr, __u16 port) +{ + return (addr << 8) | (port & 0x3ff); +} + +static __inline__ __u8 pn_obj(__u16 handle) +{ + return handle & 0xff; +} + +static __inline__ __u8 pn_dev(__u16 handle) +{ + return handle >> 8; +} + +static __inline__ __u16 pn_port(__u16 handle) +{ + return handle & 0x3ff; +} + +static __inline__ __u8 pn_addr(__u16 handle) +{ + return (handle >> 8) & 0xfc; +} + +static __inline__ void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr) +{ + spn->spn_dev &= 0x03; + spn->spn_dev |= addr & 0xfc; +} + +static __inline__ void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port) +{ + spn->spn_dev &= 0xfc; + spn->spn_dev |= (port >> 8) & 0x03; + spn->spn_obj = port & 0xff; +} + +static __inline__ void pn_sockaddr_set_object(struct sockaddr_pn *spn, + __u16 handle) +{ + spn->spn_dev = pn_dev(handle); + spn->spn_obj = pn_obj(handle); +} + +static __inline__ void pn_sockaddr_set_resource(struct sockaddr_pn *spn, + __u8 resource) +{ + spn->spn_resource = resource; +} + +static __inline__ __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn) +{ + return spn->spn_dev & 0xfc; +} + +static __inline__ __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn) +{ + return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj; +} + +static __inline__ __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn) +{ + return pn_object(spn->spn_dev, spn->spn_obj); +} + +static __inline__ __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn) +{ + return spn->spn_resource; +} + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pkt_cls.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pkt_cls.h new file mode 100644 index 0000000..3c842ed --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pkt_cls.h @@ -0,0 +1,494 @@ +#ifndef __LINUX_PKT_CLS_H +#define __LINUX_PKT_CLS_H + +#include +#include + +/* I think i could have done better macros ; for now this is stolen from + * some arch/mips code - jhs +*/ +#define _TC_MAKE32(x) ((x)) + +#define _TC_MAKEMASK1(n) (_TC_MAKE32(1) << _TC_MAKE32(n)) +#define _TC_MAKEMASK(v,n) (_TC_MAKE32((_TC_MAKE32(1)<<(v))-1) << _TC_MAKE32(n)) +#define _TC_MAKEVALUE(v,n) (_TC_MAKE32(v) << _TC_MAKE32(n)) +#define _TC_GETVALUE(v,n,m) ((_TC_MAKE32(v) & _TC_MAKE32(m)) >> _TC_MAKE32(n)) + +/* verdict bit breakdown + * +bit 0: when set -> this packet has been munged already + +bit 1: when set -> It is ok to munge this packet + +bit 2,3,4,5: Reclassify counter - sort of reverse TTL - if exceeded +assume loop + +bit 6,7: Where this packet was last seen +0: Above the transmit example at the socket level +1: on the Ingress +2: on the Egress + +bit 8: when set --> Request not to classify on ingress. + +bits 9,10,11: redirect counter - redirect TTL. Loop avoidance + + * + * */ + +#define TC_MUNGED _TC_MAKEMASK1(0) +#define SET_TC_MUNGED(v) ( TC_MUNGED | (v & ~TC_MUNGED)) +#define CLR_TC_MUNGED(v) ( v & ~TC_MUNGED) + +#define TC_OK2MUNGE _TC_MAKEMASK1(1) +#define SET_TC_OK2MUNGE(v) ( TC_OK2MUNGE | (v & ~TC_OK2MUNGE)) +#define CLR_TC_OK2MUNGE(v) ( v & ~TC_OK2MUNGE) + +#define S_TC_VERD _TC_MAKE32(2) +#define M_TC_VERD _TC_MAKEMASK(4,S_TC_VERD) +#define G_TC_VERD(x) _TC_GETVALUE(x,S_TC_VERD,M_TC_VERD) +#define V_TC_VERD(x) _TC_MAKEVALUE(x,S_TC_VERD) +#define SET_TC_VERD(v,n) ((V_TC_VERD(n)) | (v & ~M_TC_VERD)) + +#define S_TC_FROM _TC_MAKE32(6) +#define M_TC_FROM _TC_MAKEMASK(2,S_TC_FROM) +#define G_TC_FROM(x) _TC_GETVALUE(x,S_TC_FROM,M_TC_FROM) +#define V_TC_FROM(x) _TC_MAKEVALUE(x,S_TC_FROM) +#define SET_TC_FROM(v,n) ((V_TC_FROM(n)) | (v & ~M_TC_FROM)) +#define AT_STACK 0x0 +#define AT_INGRESS 0x1 +#define AT_EGRESS 0x2 + +#define TC_NCLS _TC_MAKEMASK1(8) +#define SET_TC_NCLS(v) ( TC_NCLS | (v & ~TC_NCLS)) +#define CLR_TC_NCLS(v) ( v & ~TC_NCLS) + +#define S_TC_RTTL _TC_MAKE32(9) +#define M_TC_RTTL _TC_MAKEMASK(3,S_TC_RTTL) +#define G_TC_RTTL(x) _TC_GETVALUE(x,S_TC_RTTL,M_TC_RTTL) +#define V_TC_RTTL(x) _TC_MAKEVALUE(x,S_TC_RTTL) +#define SET_TC_RTTL(v,n) ((V_TC_RTTL(n)) | (v & ~M_TC_RTTL)) + +#define S_TC_AT _TC_MAKE32(12) +#define M_TC_AT _TC_MAKEMASK(2,S_TC_AT) +#define G_TC_AT(x) _TC_GETVALUE(x,S_TC_AT,M_TC_AT) +#define V_TC_AT(x) _TC_MAKEVALUE(x,S_TC_AT) +#define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) + +/* Action attributes */ +enum +{ + TCA_ACT_UNSPEC, + TCA_ACT_KIND, + TCA_ACT_OPTIONS, + TCA_ACT_INDEX, + TCA_ACT_STATS, + __TCA_ACT_MAX +}; + +#define TCA_ACT_MAX __TCA_ACT_MAX +#define TCA_OLD_COMPAT (TCA_ACT_MAX+1) +#define TCA_ACT_MAX_PRIO 32 +#define TCA_ACT_BIND 1 +#define TCA_ACT_NOBIND 0 +#define TCA_ACT_UNBIND 1 +#define TCA_ACT_NOUNBIND 0 +#define TCA_ACT_REPLACE 1 +#define TCA_ACT_NOREPLACE 0 +#define MAX_REC_LOOP 4 +#define MAX_RED_LOOP 4 + +#define TC_ACT_UNSPEC (-1) +#define TC_ACT_OK 0 +#define TC_ACT_RECLASSIFY 1 +#define TC_ACT_SHOT 2 +#define TC_ACT_PIPE 3 +#define TC_ACT_STOLEN 4 +#define TC_ACT_QUEUED 5 +#define TC_ACT_REPEAT 6 +#define TC_ACT_JUMP 0x10000000 + +/* Action type identifiers*/ +enum +{ + TCA_ID_UNSPEC=0, + TCA_ID_POLICE=1, + /* other actions go here */ + __TCA_ID_MAX=255 +}; + +#define TCA_ID_MAX __TCA_ID_MAX + +struct tc_police +{ + __u32 index; + int action; +#define TC_POLICE_UNSPEC TC_ACT_UNSPEC +#define TC_POLICE_OK TC_ACT_OK +#define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY +#define TC_POLICE_SHOT TC_ACT_SHOT +#define TC_POLICE_PIPE TC_ACT_PIPE + + __u32 limit; + __u32 burst; + __u32 mtu; + struct tc_ratespec rate; + struct tc_ratespec peakrate; + int refcnt; + int bindcnt; + __u32 capab; +}; + +struct tcf_t +{ + __u64 install; + __u64 lastuse; + __u64 expires; +}; + +struct tc_cnt +{ + int refcnt; + int bindcnt; +}; + +#define tc_gen \ + __u32 index; \ + __u32 capab; \ + int action; \ + int refcnt; \ + int bindcnt + +enum +{ + TCA_POLICE_UNSPEC, + TCA_POLICE_TBF, + TCA_POLICE_RATE, + TCA_POLICE_PEAKRATE, + TCA_POLICE_AVRATE, + TCA_POLICE_RESULT, + __TCA_POLICE_MAX +#define TCA_POLICE_RESULT TCA_POLICE_RESULT +}; + +#define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) + +/* U32 filters */ + +#define TC_U32_HTID(h) ((h)&0xFFF00000) +#define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) +#define TC_U32_HASH(h) (((h)>>12)&0xFF) +#define TC_U32_NODE(h) ((h)&0xFFF) +#define TC_U32_KEY(h) ((h)&0xFFFFF) +#define TC_U32_UNSPEC 0 +#define TC_U32_ROOT (0xFFF00000) + +enum +{ + TCA_U32_UNSPEC, + TCA_U32_CLASSID, + TCA_U32_HASH, + TCA_U32_LINK, + TCA_U32_DIVISOR, + TCA_U32_SEL, + TCA_U32_POLICE, + TCA_U32_ACT, + TCA_U32_INDEV, + TCA_U32_PCNT, + TCA_U32_MARK, + __TCA_U32_MAX +}; + +#define TCA_U32_MAX (__TCA_U32_MAX - 1) + +struct tc_u32_key +{ + __be32 mask; + __be32 val; + int off; + int offmask; +}; + +struct tc_u32_sel +{ + unsigned char flags; + unsigned char offshift; + unsigned char nkeys; + + __be16 offmask; + __u16 off; + short offoff; + + short hoff; + __be32 hmask; + struct tc_u32_key keys[0]; +}; + +struct tc_u32_mark +{ + __u32 val; + __u32 mask; + __u32 success; +}; + +struct tc_u32_pcnt +{ + __u64 rcnt; + __u64 rhit; + __u64 kcnts[0]; +}; + +/* Flags */ + +#define TC_U32_TERMINAL 1 +#define TC_U32_OFFSET 2 +#define TC_U32_VAROFFSET 4 +#define TC_U32_EAT 8 + +#define TC_U32_MAXDEPTH 8 + + +/* RSVP filter */ + +enum +{ + TCA_RSVP_UNSPEC, + TCA_RSVP_CLASSID, + TCA_RSVP_DST, + TCA_RSVP_SRC, + TCA_RSVP_PINFO, + TCA_RSVP_POLICE, + TCA_RSVP_ACT, + __TCA_RSVP_MAX +}; + +#define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) + +struct tc_rsvp_gpi +{ + __u32 key; + __u32 mask; + int offset; +}; + +struct tc_rsvp_pinfo +{ + struct tc_rsvp_gpi dpi; + struct tc_rsvp_gpi spi; + __u8 protocol; + __u8 tunnelid; + __u8 tunnelhdr; + __u8 pad; +}; + +/* ROUTE filter */ + +enum +{ + TCA_ROUTE4_UNSPEC, + TCA_ROUTE4_CLASSID, + TCA_ROUTE4_TO, + TCA_ROUTE4_FROM, + TCA_ROUTE4_IIF, + TCA_ROUTE4_POLICE, + TCA_ROUTE4_ACT, + __TCA_ROUTE4_MAX +}; + +#define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) + + +/* FW filter */ + +enum +{ + TCA_FW_UNSPEC, + TCA_FW_CLASSID, + TCA_FW_POLICE, + TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ + TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ + TCA_FW_MASK, + __TCA_FW_MAX +}; + +#define TCA_FW_MAX (__TCA_FW_MAX - 1) + +/* TC index filter */ + +enum +{ + TCA_TCINDEX_UNSPEC, + TCA_TCINDEX_HASH, + TCA_TCINDEX_MASK, + TCA_TCINDEX_SHIFT, + TCA_TCINDEX_FALL_THROUGH, + TCA_TCINDEX_CLASSID, + TCA_TCINDEX_POLICE, + TCA_TCINDEX_ACT, + __TCA_TCINDEX_MAX +}; + +#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) + +/* Flow filter */ + +enum +{ + FLOW_KEY_SRC, + FLOW_KEY_DST, + FLOW_KEY_PROTO, + FLOW_KEY_PROTO_SRC, + FLOW_KEY_PROTO_DST, + FLOW_KEY_IIF, + FLOW_KEY_PRIORITY, + FLOW_KEY_MARK, + FLOW_KEY_NFCT, + FLOW_KEY_NFCT_SRC, + FLOW_KEY_NFCT_DST, + FLOW_KEY_NFCT_PROTO_SRC, + FLOW_KEY_NFCT_PROTO_DST, + FLOW_KEY_RTCLASSID, + FLOW_KEY_SKUID, + FLOW_KEY_SKGID, + FLOW_KEY_VLAN_TAG, + __FLOW_KEY_MAX, +}; + +#define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) + +enum +{ + FLOW_MODE_MAP, + FLOW_MODE_HASH, +}; + +enum +{ + TCA_FLOW_UNSPEC, + TCA_FLOW_KEYS, + TCA_FLOW_MODE, + TCA_FLOW_BASECLASS, + TCA_FLOW_RSHIFT, + TCA_FLOW_ADDEND, + TCA_FLOW_MASK, + TCA_FLOW_XOR, + TCA_FLOW_DIVISOR, + TCA_FLOW_ACT, + TCA_FLOW_POLICE, + TCA_FLOW_EMATCHES, + TCA_FLOW_PERTURB, + __TCA_FLOW_MAX +}; + +#define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) + +/* Basic filter */ + +enum +{ + TCA_BASIC_UNSPEC, + TCA_BASIC_CLASSID, + TCA_BASIC_EMATCHES, + TCA_BASIC_ACT, + TCA_BASIC_POLICE, + __TCA_BASIC_MAX +}; + +#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) + + +/* Cgroup classifier */ + +enum +{ + TCA_CGROUP_UNSPEC, + TCA_CGROUP_ACT, + TCA_CGROUP_POLICE, + TCA_CGROUP_EMATCHES, + __TCA_CGROUP_MAX, +}; + +#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) + +/* Extended Matches */ + +struct tcf_ematch_tree_hdr +{ + __u16 nmatches; + __u16 progid; +}; + +enum +{ + TCA_EMATCH_TREE_UNSPEC, + TCA_EMATCH_TREE_HDR, + TCA_EMATCH_TREE_LIST, + __TCA_EMATCH_TREE_MAX +}; +#define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) + +struct tcf_ematch_hdr +{ + __u16 matchid; + __u16 kind; + __u16 flags; + __u16 pad; /* currently unused */ +}; + +/* 0 1 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + * +-----------------------+-+-+---+ + * | Unused |S|I| R | + * +-----------------------+-+-+---+ + * + * R(2) ::= relation to next ematch + * where: 0 0 END (last ematch) + * 0 1 AND + * 1 0 OR + * 1 1 Unused (invalid) + * I(1) ::= invert result + * S(1) ::= simple payload + */ +#define TCF_EM_REL_END 0 +#define TCF_EM_REL_AND (1<<0) +#define TCF_EM_REL_OR (1<<1) +#define TCF_EM_INVERT (1<<2) +#define TCF_EM_SIMPLE (1<<3) + +#define TCF_EM_REL_MASK 3 +#define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) + +enum +{ + TCF_LAYER_LINK, + TCF_LAYER_NETWORK, + TCF_LAYER_TRANSPORT, + __TCF_LAYER_MAX +}; +#define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) + +/* Ematch type assignments + * 1..32767 Reserved for ematches inside kernel tree + * 32768..65535 Free to use, not reliable + */ +#define TCF_EM_CONTAINER 0 +#define TCF_EM_CMP 1 +#define TCF_EM_NBYTE 2 +#define TCF_EM_U32 3 +#define TCF_EM_META 4 +#define TCF_EM_TEXT 5 +#define TCF_EM_VLAN 6 +#define TCF_EM_MAX 6 + +enum +{ + TCF_EM_PROG_TC +}; + +enum +{ + TCF_EM_OPND_EQ, + TCF_EM_OPND_GT, + TCF_EM_OPND_LT +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pkt_sched.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pkt_sched.h new file mode 100644 index 0000000..d51a2b3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pkt_sched.h @@ -0,0 +1,521 @@ +#ifndef __LINUX_PKT_SCHED_H +#define __LINUX_PKT_SCHED_H + +#include + +/* Logical priority bands not depending on specific packet scheduler. + Every scheduler will map them to real traffic classes, if it has + no more precise mechanism to classify packets. + + These numbers have no special meaning, though their coincidence + with obsolete IPv6 values is not occasional :-). New IPv6 drafts + preferred full anarchy inspired by diffserv group. + + Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy + class, actually, as rule it will be handled with more care than + filler or even bulk. + */ + +#define TC_PRIO_BESTEFFORT 0 +#define TC_PRIO_FILLER 1 +#define TC_PRIO_BULK 2 +#define TC_PRIO_INTERACTIVE_BULK 4 +#define TC_PRIO_INTERACTIVE 6 +#define TC_PRIO_CONTROL 7 + +#define TC_PRIO_MAX 15 + +/* Generic queue statistics, available for all the elements. + Particular schedulers may have also their private records. + */ + +struct tc_stats +{ + __u64 bytes; /* NUmber of enqueues bytes */ + __u32 packets; /* Number of enqueued packets */ + __u32 drops; /* Packets dropped because of lack of resources */ + __u32 overlimits; /* Number of throttle events when this + * flow goes out of allocated bandwidth */ + __u32 bps; /* Current flow byte rate */ + __u32 pps; /* Current flow packet rate */ + __u32 qlen; + __u32 backlog; +}; + +struct tc_estimator +{ + signed char interval; + unsigned char ewma_log; +}; + +/* "Handles" + --------- + + All the traffic control objects have 32bit identifiers, or "handles". + + They can be considered as opaque numbers from user API viewpoint, + but actually they always consist of two fields: major and + minor numbers, which are interpreted by kernel specially, + that may be used by applications, though not recommended. + + F.e. qdisc handles always have minor number equal to zero, + classes (or flows) have major equal to parent qdisc major, and + minor uniquely identifying class inside qdisc. + + Macros to manipulate handles: + */ + +#define TC_H_MAJ_MASK (0xFFFF0000U) +#define TC_H_MIN_MASK (0x0000FFFFU) +#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) +#define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) +#define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) + +#define TC_H_UNSPEC (0U) +#define TC_H_ROOT (0xFFFFFFFFU) +#define TC_H_INGRESS (0xFFFFFFF1U) + +struct tc_ratespec +{ + unsigned char cell_log; + unsigned char __reserved; + unsigned short overhead; + short cell_align; + unsigned short mpu; + __u32 rate; +}; + +#define TC_RTAB_SIZE 1024 + +struct tc_sizespec { + unsigned char cell_log; + unsigned char size_log; + short cell_align; + int overhead; + unsigned int linklayer; + unsigned int mpu; + unsigned int mtu; + unsigned int tsize; +}; + +enum { + TCA_STAB_UNSPEC, + TCA_STAB_BASE, + TCA_STAB_DATA, + __TCA_STAB_MAX +}; + +#define TCA_STAB_MAX (__TCA_STAB_MAX - 1) + +/* FIFO section */ + +struct tc_fifo_qopt +{ + __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ +}; + +/* PRIO section */ + +#define TCQ_PRIO_BANDS 16 +#define TCQ_MIN_PRIO_BANDS 2 + +struct tc_prio_qopt +{ + int bands; /* Number of bands */ + __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ +}; + +/* MULTIQ section */ + +struct tc_multiq_qopt { + __u16 bands; /* Number of bands */ + __u16 max_bands; /* Maximum number of queues */ +}; + +/* TBF section */ + +struct tc_tbf_qopt +{ + struct tc_ratespec rate; + struct tc_ratespec peakrate; + __u32 limit; + __u32 buffer; + __u32 mtu; +}; + +enum +{ + TCA_TBF_UNSPEC, + TCA_TBF_PARMS, + TCA_TBF_RTAB, + TCA_TBF_PTAB, + __TCA_TBF_MAX, +}; + +#define TCA_TBF_MAX (__TCA_TBF_MAX - 1) + + +/* TEQL section */ + +/* TEQL does not require any parameters */ + +/* SFQ section */ + +struct tc_sfq_qopt +{ + unsigned quantum; /* Bytes per round allocated to flow */ + int perturb_period; /* Period of hash perturbation */ + __u32 limit; /* Maximal packets in queue */ + unsigned divisor; /* Hash divisor */ + unsigned flows; /* Maximal number of flows */ +}; + +struct tc_sfq_xstats +{ + __s32 allot; +}; + +/* + * NOTE: limit, divisor and flows are hardwired to code at the moment. + * + * limit=flows=128, divisor=1024; + * + * The only reason for this is efficiency, it is possible + * to change these parameters in compile time. + */ + +/* RED section */ + +enum +{ + TCA_RED_UNSPEC, + TCA_RED_PARMS, + TCA_RED_STAB, + __TCA_RED_MAX, +}; + +#define TCA_RED_MAX (__TCA_RED_MAX - 1) + +struct tc_red_qopt +{ + __u32 limit; /* HARD maximal queue length (bytes) */ + __u32 qth_min; /* Min average length threshold (bytes) */ + __u32 qth_max; /* Max average length threshold (bytes) */ + unsigned char Wlog; /* log(W) */ + unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ + unsigned char Scell_log; /* cell size for idle damping */ + unsigned char flags; +#define TC_RED_ECN 1 +#define TC_RED_HARDDROP 2 +}; + +struct tc_red_xstats +{ + __u32 early; /* Early drops */ + __u32 pdrop; /* Drops due to queue limits */ + __u32 other; /* Drops due to drop() calls */ + __u32 marked; /* Marked packets */ +}; + +/* GRED section */ + +#define MAX_DPs 16 + +enum +{ + TCA_GRED_UNSPEC, + TCA_GRED_PARMS, + TCA_GRED_STAB, + TCA_GRED_DPS, + __TCA_GRED_MAX, +}; + +#define TCA_GRED_MAX (__TCA_GRED_MAX - 1) + +struct tc_gred_qopt +{ + __u32 limit; /* HARD maximal queue length (bytes) */ + __u32 qth_min; /* Min average length threshold (bytes) */ + __u32 qth_max; /* Max average length threshold (bytes) */ + __u32 DP; /* upto 2^32 DPs */ + __u32 backlog; + __u32 qave; + __u32 forced; + __u32 early; + __u32 other; + __u32 pdrop; + __u8 Wlog; /* log(W) */ + __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ + __u8 Scell_log; /* cell size for idle damping */ + __u8 prio; /* prio of this VQ */ + __u32 packets; + __u32 bytesin; +}; + +/* gred setup */ +struct tc_gred_sopt +{ + __u32 DPs; + __u32 def_DP; + __u8 grio; + __u8 flags; + __u16 pad1; +}; + +/* HTB section */ +#define TC_HTB_NUMPRIO 8 +#define TC_HTB_MAXDEPTH 8 +#define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ + +struct tc_htb_opt +{ + struct tc_ratespec rate; + struct tc_ratespec ceil; + __u32 buffer; + __u32 cbuffer; + __u32 quantum; + __u32 level; /* out only */ + __u32 prio; +}; +struct tc_htb_glob +{ + __u32 version; /* to match HTB/TC */ + __u32 rate2quantum; /* bps->quantum divisor */ + __u32 defcls; /* default class number */ + __u32 debug; /* debug flags */ + + /* stats */ + __u32 direct_pkts; /* count of non shapped packets */ +}; +enum +{ + TCA_HTB_UNSPEC, + TCA_HTB_PARMS, + TCA_HTB_INIT, + TCA_HTB_CTAB, + TCA_HTB_RTAB, + __TCA_HTB_MAX, +}; + +#define TCA_HTB_MAX (__TCA_HTB_MAX - 1) + +struct tc_htb_xstats +{ + __u32 lends; + __u32 borrows; + __u32 giants; /* too big packets (rate will not be accurate) */ + __u32 tokens; + __u32 ctokens; +}; + +/* HFSC section */ + +struct tc_hfsc_qopt +{ + __u16 defcls; /* default class */ +}; + +struct tc_service_curve +{ + __u32 m1; /* slope of the first segment in bps */ + __u32 d; /* x-projection of the first segment in us */ + __u32 m2; /* slope of the second segment in bps */ +}; + +struct tc_hfsc_stats +{ + __u64 work; /* total work done */ + __u64 rtwork; /* work done by real-time criteria */ + __u32 period; /* current period */ + __u32 level; /* class level in hierarchy */ +}; + +enum +{ + TCA_HFSC_UNSPEC, + TCA_HFSC_RSC, + TCA_HFSC_FSC, + TCA_HFSC_USC, + __TCA_HFSC_MAX, +}; + +#define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) + + +/* CBQ section */ + +#define TC_CBQ_MAXPRIO 8 +#define TC_CBQ_MAXLEVEL 8 +#define TC_CBQ_DEF_EWMA 5 + +struct tc_cbq_lssopt +{ + unsigned char change; + unsigned char flags; +#define TCF_CBQ_LSS_BOUNDED 1 +#define TCF_CBQ_LSS_ISOLATED 2 + unsigned char ewma_log; + unsigned char level; +#define TCF_CBQ_LSS_FLAGS 1 +#define TCF_CBQ_LSS_EWMA 2 +#define TCF_CBQ_LSS_MAXIDLE 4 +#define TCF_CBQ_LSS_MINIDLE 8 +#define TCF_CBQ_LSS_OFFTIME 0x10 +#define TCF_CBQ_LSS_AVPKT 0x20 + __u32 maxidle; + __u32 minidle; + __u32 offtime; + __u32 avpkt; +}; + +struct tc_cbq_wrropt +{ + unsigned char flags; + unsigned char priority; + unsigned char cpriority; + unsigned char __reserved; + __u32 allot; + __u32 weight; +}; + +struct tc_cbq_ovl +{ + unsigned char strategy; +#define TC_CBQ_OVL_CLASSIC 0 +#define TC_CBQ_OVL_DELAY 1 +#define TC_CBQ_OVL_LOWPRIO 2 +#define TC_CBQ_OVL_DROP 3 +#define TC_CBQ_OVL_RCLASSIC 4 + unsigned char priority2; + __u16 pad; + __u32 penalty; +}; + +struct tc_cbq_police +{ + unsigned char police; + unsigned char __res1; + unsigned short __res2; +}; + +struct tc_cbq_fopt +{ + __u32 split; + __u32 defmap; + __u32 defchange; +}; + +struct tc_cbq_xstats +{ + __u32 borrows; + __u32 overactions; + __s32 avgidle; + __s32 undertime; +}; + +enum +{ + TCA_CBQ_UNSPEC, + TCA_CBQ_LSSOPT, + TCA_CBQ_WRROPT, + TCA_CBQ_FOPT, + TCA_CBQ_OVL_STRATEGY, + TCA_CBQ_RATE, + TCA_CBQ_RTAB, + TCA_CBQ_POLICE, + __TCA_CBQ_MAX, +}; + +#define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) + +/* dsmark section */ + +enum { + TCA_DSMARK_UNSPEC, + TCA_DSMARK_INDICES, + TCA_DSMARK_DEFAULT_INDEX, + TCA_DSMARK_SET_TC_INDEX, + TCA_DSMARK_MASK, + TCA_DSMARK_VALUE, + __TCA_DSMARK_MAX, +}; + +#define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) + +/* ATM section */ + +enum { + TCA_ATM_UNSPEC, + TCA_ATM_FD, /* file/socket descriptor */ + TCA_ATM_PTR, /* pointer to descriptor - later */ + TCA_ATM_HDR, /* LL header */ + TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ + TCA_ATM_ADDR, /* PVC address (for output only) */ + TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ + __TCA_ATM_MAX, +}; + +#define TCA_ATM_MAX (__TCA_ATM_MAX - 1) + +/* Network emulator */ + +enum +{ + TCA_NETEM_UNSPEC, + TCA_NETEM_CORR, + TCA_NETEM_DELAY_DIST, + TCA_NETEM_REORDER, + TCA_NETEM_CORRUPT, + __TCA_NETEM_MAX, +}; + +#define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) + +struct tc_netem_qopt +{ + __u32 latency; /* added delay (us) */ + __u32 limit; /* fifo limit (packets) */ + __u32 loss; /* random packet loss (0=none ~0=100%) */ + __u32 gap; /* re-ordering gap (0 for none) */ + __u32 duplicate; /* random packet dup (0=none ~0=100%) */ + __u32 jitter; /* random jitter in latency (us) */ +}; + +struct tc_netem_corr +{ + __u32 delay_corr; /* delay correlation */ + __u32 loss_corr; /* packet loss correlation */ + __u32 dup_corr; /* duplicate correlation */ +}; + +struct tc_netem_reorder +{ + __u32 probability; + __u32 correlation; +}; + +struct tc_netem_corrupt +{ + __u32 probability; + __u32 correlation; +}; + +#define NETEM_DIST_SCALE 8192 + +/* DRR */ + +enum +{ + TCA_DRR_UNSPEC, + TCA_DRR_QUANTUM, + __TCA_DRR_MAX +}; + +#define TCA_DRR_MAX (__TCA_DRR_MAX - 1) + +struct tc_drr_stats +{ + __u32 deficit; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pktcdvd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pktcdvd.h new file mode 100644 index 0000000..eb6805f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pktcdvd.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2000 Jens Axboe + * Copyright (C) 2001-2004 Peter Osterlund + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * Packet writing layer for ATAPI and SCSI CD-R, CD-RW, DVD-R, and + * DVD-RW devices. + * + */ +#ifndef __PKTCDVD_H +#define __PKTCDVD_H + +#include + +/* + * 1 for normal debug messages, 2 is very verbose. 0 to turn it off. + */ +#define PACKET_DEBUG 1 + +#define MAX_WRITERS 8 + +#define PKT_RB_POOL_SIZE 512 + +/* + * How long we should hold a non-full packet before starting data gathering. + */ +#define PACKET_WAIT_TIME (HZ * 5 / 1000) + +/* + * use drive write caching -- we need deferred error handling to be + * able to sucessfully recover with this option (drive will return good + * status as soon as the cdb is validated). + */ +#if defined(CONFIG_CDROM_PKTCDVD_WCACHE) +#define USE_WCACHING 1 +#else +#define USE_WCACHING 0 +#endif + +/* + * No user-servicable parts beyond this point -> + */ + +/* + * device types + */ +#define PACKET_CDR 1 +#define PACKET_CDRW 2 +#define PACKET_DVDR 3 +#define PACKET_DVDRW 4 + +/* + * flags + */ +#define PACKET_WRITABLE 1 /* pd is writable */ +#define PACKET_NWA_VALID 2 /* next writable address valid */ +#define PACKET_LRA_VALID 3 /* last recorded address valid */ +#define PACKET_MERGE_SEGS 4 /* perform segment merging to keep */ + /* underlying cdrom device happy */ + +/* + * Disc status -- from READ_DISC_INFO + */ +#define PACKET_DISC_EMPTY 0 +#define PACKET_DISC_INCOMPLETE 1 +#define PACKET_DISC_COMPLETE 2 +#define PACKET_DISC_OTHER 3 + +/* + * write type, and corresponding data block type + */ +#define PACKET_MODE1 1 +#define PACKET_MODE2 2 +#define PACKET_BLOCK_MODE1 8 +#define PACKET_BLOCK_MODE2 10 + +/* + * Last session/border status + */ +#define PACKET_SESSION_EMPTY 0 +#define PACKET_SESSION_INCOMPLETE 1 +#define PACKET_SESSION_RESERVED 2 +#define PACKET_SESSION_COMPLETE 3 + +#define PACKET_MCN "4a656e734178626f65323030300000" + +#undef PACKET_USE_LS + +#define PKT_CTRL_CMD_SETUP 0 +#define PKT_CTRL_CMD_TEARDOWN 1 +#define PKT_CTRL_CMD_STATUS 2 + +struct pkt_ctrl_command { + __u32 command; /* in: Setup, teardown, status */ + __u32 dev_index; /* in/out: Device index */ + __u32 dev; /* in/out: Device nr for cdrw device */ + __u32 pkt_dev; /* in/out: Device nr for packet device */ + __u32 num_devices; /* out: Largest device index + 1 */ + __u32 padding; /* Not used */ +}; + +/* + * packet ioctls + */ +#define PACKET_IOCTL_MAGIC ('X') +#define PACKET_CTRL_CMD _IOWR(PACKET_IOCTL_MAGIC, 1, struct pkt_ctrl_command) + + +#endif /* __PKTCDVD_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pmu.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pmu.h new file mode 100644 index 0000000..5a77399 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/pmu.h @@ -0,0 +1,135 @@ +/* + * Definitions for talking to the PMU. The PMU is a microcontroller + * which controls battery charging and system power on PowerBook 3400 + * and 2400 models as well as the RTC and various other things. + * + * Copyright (C) 1998 Paul Mackerras. + */ + + +#define PMU_DRIVER_VERSION 2 + +/* + * PMU commands + */ +#define PMU_POWER_CTRL0 0x10 /* control power of some devices */ +#define PMU_POWER_CTRL 0x11 /* control power of some devices */ +#define PMU_ADB_CMD 0x20 /* send ADB packet */ +#define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */ +#define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */ +#define PMU_READ_NVRAM 0x3b /* read non-volatile RAM */ +#define PMU_SET_RTC 0x30 /* set real-time clock */ +#define PMU_READ_RTC 0x38 /* read real-time clock */ +#define PMU_SET_VOLBUTTON 0x40 /* set volume up/down position */ +#define PMU_BACKLIGHT_BRIGHT 0x41 /* set backlight brightness */ +#define PMU_GET_VOLBUTTON 0x48 /* get volume up/down position */ +#define PMU_PCEJECT 0x4c /* eject PC-card from slot */ +#define PMU_BATTERY_STATE 0x6b /* report battery state etc. */ +#define PMU_SMART_BATTERY_STATE 0x6f /* report battery state (new way) */ +#define PMU_SET_INTR_MASK 0x70 /* set PMU interrupt mask */ +#define PMU_INT_ACK 0x78 /* read interrupt bits */ +#define PMU_SHUTDOWN 0x7e /* turn power off */ +#define PMU_CPU_SPEED 0x7d /* control CPU speed on some models */ +#define PMU_SLEEP 0x7f /* put CPU to sleep */ +#define PMU_POWER_EVENTS 0x8f /* Send power-event commands to PMU */ +#define PMU_I2C_CMD 0x9a /* I2C operations */ +#define PMU_RESET 0xd0 /* reset CPU */ +#define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */ +#define PMU_GET_COVER 0xdc /* report cover open/closed */ +#define PMU_SYSTEM_READY 0xdf /* tell PMU we are awake */ +#define PMU_GET_VERSION 0xea /* read the PMU version */ + +/* Bits to use with the PMU_POWER_CTRL0 command */ +#define PMU_POW0_ON 0x80 /* OR this to power ON the device */ +#define PMU_POW0_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ +#define PMU_POW0_HARD_DRIVE 0x04 /* Hard drive power (on wallstreet/lombard ?) */ + +/* Bits to use with the PMU_POWER_CTRL command */ +#define PMU_POW_ON 0x80 /* OR this to power ON the device */ +#define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ +#define PMU_POW_BACKLIGHT 0x01 /* backlight power */ +#define PMU_POW_CHARGER 0x02 /* battery charger power */ +#define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) */ +#define PMU_POW_MEDIABAY 0x08 /* media bay power (wallstreet/lombard ?) */ + +/* Bits in PMU interrupt and interrupt mask bytes */ +#define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */ +#define PMU_INT_SNDBRT 0x08 /* sound/brightness up/down buttons */ +#define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */ +#define PMU_INT_BATTERY 0x20 /* Battery state change */ +#define PMU_INT_ENVIRONMENT 0x40 /* Environment interrupts */ +#define PMU_INT_TICK 0x80 /* 1-second tick interrupt */ + +/* Other bits in PMU interrupt valid when PMU_INT_ADB is set */ +#define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */ +#define PMU_INT_WAITING_CHARGER 0x01 /* ??? */ +#define PMU_INT_AUTO_SRQ_POLL 0x02 /* ??? */ + +/* Bits in the environement message (either obtained via PMU_GET_COVER, + * or via PMU_INT_ENVIRONMENT on core99 */ +#define PMU_ENV_LID_CLOSED 0x01 /* The lid is closed */ + +/* I2C related definitions */ +#define PMU_I2C_MODE_SIMPLE 0 +#define PMU_I2C_MODE_STDSUB 1 +#define PMU_I2C_MODE_COMBINED 2 + +#define PMU_I2C_BUS_STATUS 0 +#define PMU_I2C_BUS_SYSCLK 1 +#define PMU_I2C_BUS_POWER 2 + +#define PMU_I2C_STATUS_OK 0 +#define PMU_I2C_STATUS_DATAREAD 1 +#define PMU_I2C_STATUS_BUSY 0xfe + + +/* Kind of PMU (model) */ +enum { + PMU_UNKNOWN, + PMU_OHARE_BASED, /* 2400, 3400, 3500 (old G3 powerbook) */ + PMU_HEATHROW_BASED, /* PowerBook G3 series */ + PMU_PADDINGTON_BASED, /* 1999 PowerBook G3 */ + PMU_KEYLARGO_BASED, /* Core99 motherboard (PMU99) */ + PMU_68K_V1, /* 68K PMU, version 1 */ + PMU_68K_V2, /* 68K PMU, version 2 */ +}; + +/* PMU PMU_POWER_EVENTS commands */ +enum { + PMU_PWR_GET_POWERUP_EVENTS = 0x00, + PMU_PWR_SET_POWERUP_EVENTS = 0x01, + PMU_PWR_CLR_POWERUP_EVENTS = 0x02, + PMU_PWR_GET_WAKEUP_EVENTS = 0x03, + PMU_PWR_SET_WAKEUP_EVENTS = 0x04, + PMU_PWR_CLR_WAKEUP_EVENTS = 0x05, +}; + +/* Power events wakeup bits */ +enum { + PMU_PWR_WAKEUP_KEY = 0x01, /* Wake on key press */ + PMU_PWR_WAKEUP_AC_INSERT = 0x02, /* Wake on AC adapter plug */ + PMU_PWR_WAKEUP_AC_CHANGE = 0x04, + PMU_PWR_WAKEUP_LID_OPEN = 0x08, + PMU_PWR_WAKEUP_RING = 0x10, +}; + +/* + * Ioctl commands for the /dev/pmu device + */ +#include + +/* no param */ +#define PMU_IOC_SLEEP _IO('B', 0) +/* out param: u32* backlight value: 0 to 15 */ +#define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, size_t) +/* in param: u32 backlight value: 0 to 15 */ +#define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, size_t) +/* out param: u32* PMU model */ +#define PMU_IOC_GET_MODEL _IOR('B', 3, size_t) +/* out param: u32* has_adb: 0 or 1 */ +#define PMU_IOC_HAS_ADB _IOR('B', 4, size_t) +/* out param: u32* can_sleep: 0 or 1 */ +#define PMU_IOC_CAN_SLEEP _IOR('B', 5, size_t) +/* no param, but historically was _IOR('B', 6, 0), meaning 4 bytes */ +#define PMU_IOC_GRAB_BACKLIGHT _IOR('B', 6, size_t) + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/poll.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/poll.h new file mode 100644 index 0000000..421b305 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/poll.h @@ -0,0 +1,7 @@ +#ifndef _LINUX_POLL_H +#define _LINUX_POLL_H + +#include + + +#endif /* _LINUX_POLL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/posix_types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/posix_types.h new file mode 100644 index 0000000..f04c98c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/posix_types.h @@ -0,0 +1,49 @@ +#ifndef _LINUX_POSIX_TYPES_H +#define _LINUX_POSIX_TYPES_H + +#include + +/* + * This allows for 1024 file descriptors: if NR_OPEN is ever grown + * beyond that you'll have to change this too. But 1024 fd's seem to be + * enough even for such "real" unices like OSF/1, so hopefully this is + * one limit that doesn't have to be changed [again]. + * + * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in + * (and thus ) - but this is a more logical + * place for them. Solved by having dummy defines in . + */ + +/* + * Those macros may have been defined in . But we always + * use the ones here. + */ +#undef __NFDBITS +#define __NFDBITS (8 * sizeof(unsigned long)) + +#undef __FD_SETSIZE +#define __FD_SETSIZE 1024 + +#undef __FDSET_LONGS +#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS) + +#undef __FDELT +#define __FDELT(d) ((d) / __NFDBITS) + +#undef __FDMASK +#define __FDMASK(d) (1UL << ((d) % __NFDBITS)) + +typedef struct { + unsigned long fds_bits [__FDSET_LONGS]; +} __kernel_fd_set; + +/* Type of a signal handler. */ +typedef void (*__kernel_sighandler_t)(int); + +/* Type of a SYSV IPC key. */ +typedef int __kernel_key_t; +typedef int __kernel_mqd_t; + +#include + +#endif /* _LINUX_POSIX_TYPES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppdev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppdev.h new file mode 100644 index 0000000..dc18c5d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppdev.h @@ -0,0 +1,99 @@ +/* + * linux/include/linux/ppdev.h + * + * User-space parallel port device driver (header file). + * + * Copyright (C) 1998-9 Tim Waugh + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Added PPGETTIME/PPSETTIME, Fred Barnes, 1999 + * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes , 03/01/2001 + */ + +#define PP_IOCTL 'p' + +/* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ +#define PPSETMODE _IOW(PP_IOCTL, 0x80, int) + +/* Read status */ +#define PPRSTATUS _IOR(PP_IOCTL, 0x81, unsigned char) +#define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char) + +/* Read/write control */ +#define PPRCONTROL _IOR(PP_IOCTL, 0x83, unsigned char) +#define PPWCONTROL _IOW(PP_IOCTL, 0x84, unsigned char) + +struct ppdev_frob_struct { + unsigned char mask; + unsigned char val; +}; +#define PPFCONTROL _IOW(PP_IOCTL, 0x8e, struct ppdev_frob_struct) + +/* Read/write data */ +#define PPRDATA _IOR(PP_IOCTL, 0x85, unsigned char) +#define PPWDATA _IOW(PP_IOCTL, 0x86, unsigned char) + +/* Read/write econtrol (not used) */ +#define PPRECONTROL OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char) +#define PPWECONTROL OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char) + +/* Read/write FIFO (not used) */ +#define PPRFIFO OBSOLETE__IOR(PP_IOCTL, 0x89, unsigned char) +#define PPWFIFO OBSOLETE__IOW(PP_IOCTL, 0x8a, unsigned char) + +/* Claim the port to start using it */ +#define PPCLAIM _IO(PP_IOCTL, 0x8b) + +/* Release the port when you aren't using it */ +#define PPRELEASE _IO(PP_IOCTL, 0x8c) + +/* Yield the port (release it if another driver is waiting, + * then reclaim) */ +#define PPYIELD _IO(PP_IOCTL, 0x8d) + +/* Register device exclusively (must be before PPCLAIM). */ +#define PPEXCL _IO(PP_IOCTL, 0x8f) + +/* Data line direction: non-zero for input mode. */ +#define PPDATADIR _IOW(PP_IOCTL, 0x90, int) + +/* Negotiate a particular IEEE 1284 mode. */ +#define PPNEGOT _IOW(PP_IOCTL, 0x91, int) + +/* Set control lines when an interrupt occurs. */ +#define PPWCTLONIRQ _IOW(PP_IOCTL, 0x92, unsigned char) + +/* Clear (and return) interrupt count. */ +#define PPCLRIRQ _IOR(PP_IOCTL, 0x93, int) + +/* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */ +#define PPSETPHASE _IOW(PP_IOCTL, 0x94, int) + +/* Set and get port timeout (struct timeval's) */ +#define PPGETTIME _IOR(PP_IOCTL, 0x95, struct timeval) +#define PPSETTIME _IOW(PP_IOCTL, 0x96, struct timeval) + +/* Get available modes (what the hardware can do) */ +#define PPGETMODES _IOR(PP_IOCTL, 0x97, unsigned int) + +/* Get the current mode and phaze */ +#define PPGETMODE _IOR(PP_IOCTL, 0x98, int) +#define PPGETPHASE _IOR(PP_IOCTL, 0x99, int) + +/* get/set flags */ +#define PPGETFLAGS _IOR(PP_IOCTL, 0x9a, int) +#define PPSETFLAGS _IOW(PP_IOCTL, 0x9b, int) + +/* flags visible to the world */ +#define PP_FASTWRITE (1<<2) +#define PP_FASTREAD (1<<3) +#define PP_W91284PIC (1<<4) + +/* only masks user-visible flags */ +#define PP_FLAGMASK (PP_FASTWRITE | PP_FASTREAD | PP_W91284PIC) + + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppp-comp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppp-comp.h new file mode 100644 index 0000000..0748d39 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppp-comp.h @@ -0,0 +1,210 @@ +/* + * ppp-comp.h - Definitions for doing PPP packet compression. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + */ + +/* + * ==FILEVERSION 980319== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. + * ppp-comp.h is shipped with a PPP distribution as well as with the kernel; + * if everyone increases the FILEVERSION number above, then scripts + * can do the right thing when deciding whether to install a new ppp-comp.h + * file. Don't change the format of that line otherwise, so the + * installation script can recognize it. + */ + +#ifndef _NET_PPP_COMP_H +#define _NET_PPP_COMP_H + +struct module; + +/* + * The following symbols control whether we include code for + * various compression methods. + */ + +#ifndef DO_BSD_COMPRESS +#define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */ +#endif +#ifndef DO_DEFLATE +#define DO_DEFLATE 1 /* by default, include Deflate */ +#endif +#define DO_PREDICTOR_1 0 +#define DO_PREDICTOR_2 0 + +/* + * Structure giving methods for compression/decompression. + */ + +struct compressor { + int compress_proto; /* CCP compression protocol number */ + + /* Allocate space for a compressor (transmit side) */ + void *(*comp_alloc) (unsigned char *options, int opt_len); + + /* Free space used by a compressor */ + void (*comp_free) (void *state); + + /* Initialize a compressor */ + int (*comp_init) (void *state, unsigned char *options, + int opt_len, int unit, int opthdr, int debug); + + /* Reset a compressor */ + void (*comp_reset) (void *state); + + /* Compress a packet */ + int (*compress) (void *state, unsigned char *rptr, + unsigned char *obuf, int isize, int osize); + + /* Return compression statistics */ + void (*comp_stat) (void *state, struct compstat *stats); + + /* Allocate space for a decompressor (receive side) */ + void *(*decomp_alloc) (unsigned char *options, int opt_len); + + /* Free space used by a decompressor */ + void (*decomp_free) (void *state); + + /* Initialize a decompressor */ + int (*decomp_init) (void *state, unsigned char *options, + int opt_len, int unit, int opthdr, int mru, + int debug); + + /* Reset a decompressor */ + void (*decomp_reset) (void *state); + + /* Decompress a packet. */ + int (*decompress) (void *state, unsigned char *ibuf, int isize, + unsigned char *obuf, int osize); + + /* Update state for an incompressible packet received */ + void (*incomp) (void *state, unsigned char *ibuf, int icnt); + + /* Return decompression statistics */ + void (*decomp_stat) (void *state, struct compstat *stats); + + /* Used in locking compressor modules */ + struct module *owner; + /* Extra skb space needed by the compressor algorithm */ + unsigned int comp_extra; +}; + +/* + * The return value from decompress routine is the length of the + * decompressed packet if successful, otherwise DECOMP_ERROR + * or DECOMP_FATALERROR if an error occurred. + * + * We need to make this distinction so that we can disable certain + * useful functionality, namely sending a CCP reset-request as a result + * of an error detected after decompression. This is to avoid infringing + * a patent held by Motorola. + * Don't you just lurve software patents. + */ + +#define DECOMP_ERROR -1 /* error detected before decomp. */ +#define DECOMP_FATALERROR -2 /* error detected after decomp. */ + +/* + * CCP codes. + */ + +#define CCP_CONFREQ 1 +#define CCP_CONFACK 2 +#define CCP_TERMREQ 5 +#define CCP_TERMACK 6 +#define CCP_RESETREQ 14 +#define CCP_RESETACK 15 + +/* + * Max # bytes for a CCP option + */ + +#define CCP_MAX_OPTION_LENGTH 32 + +/* + * Parts of a CCP packet. + */ + +#define CCP_CODE(dp) ((dp)[0]) +#define CCP_ID(dp) ((dp)[1]) +#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) +#define CCP_HDRLEN 4 + +#define CCP_OPT_CODE(dp) ((dp)[0]) +#define CCP_OPT_LENGTH(dp) ((dp)[1]) +#define CCP_OPT_MINLEN 2 + +/* + * Definitions for BSD-Compress. + */ + +#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ +#define CILEN_BSD_COMPRESS 3 /* length of config. option */ + +/* Macros for handling the 3rd byte of the BSD-Compress config option. */ +#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ +#define BSD_VERSION(x) ((x) >> 5) /* version of option format */ +#define BSD_CURRENT_VERSION 1 /* current version number */ +#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) + +#define BSD_MIN_BITS 9 /* smallest code size supported */ +#define BSD_MAX_BITS 15 /* largest code size supported */ + +/* + * Definitions for Deflate. + */ + +#define CI_DEFLATE 26 /* config option for Deflate */ +#define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */ +#define CILEN_DEFLATE 4 /* length of its config option */ + +#define DEFLATE_MIN_SIZE 9 +#define DEFLATE_MAX_SIZE 15 +#define DEFLATE_METHOD_VAL 8 +#define DEFLATE_SIZE(x) (((x) >> 4) + 8) +#define DEFLATE_METHOD(x) ((x) & 0x0F) +#define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL) +#define DEFLATE_CHK_SEQUENCE 0 + +/* + * Definitions for MPPE. + */ + +#define CI_MPPE 18 /* config option for MPPE */ +#define CILEN_MPPE 6 /* length of config option */ + +/* + * Definitions for other, as yet unsupported, compression methods. + */ + +#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ +#define CILEN_PREDICTOR_1 2 /* length of its config option */ +#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ +#define CILEN_PREDICTOR_2 2 /* length of its config option */ + + +#endif /* _NET_PPP_COMP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppp_defs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppp_defs.h new file mode 100644 index 0000000..4114e5f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ppp_defs.h @@ -0,0 +1,180 @@ +/* + * ppp_defs.h - PPP definitions. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + */ + +#include + +/* + * ==FILEVERSION 20000114== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. + * ppp_defs.h is shipped with a PPP distribution as well as with the kernel; + * if everyone increases the FILEVERSION number above, then scripts + * can do the right thing when deciding whether to install a new ppp_defs.h + * file. Don't change the format of that line otherwise, so the + * installation script can recognize it. + */ + +#ifndef _PPP_DEFS_H_ +#define _PPP_DEFS_H_ + +/* + * The basic PPP frame. + */ +#define PPP_HDRLEN 4 /* octets for standard ppp header */ +#define PPP_FCSLEN 2 /* octets for FCS */ +#define PPP_MRU 1500 /* default MRU = max length of info field */ + +#define PPP_ADDRESS(p) (((__u8 *)(p))[0]) +#define PPP_CONTROL(p) (((__u8 *)(p))[1]) +#define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3]) + +/* + * Significant octet values. + */ +#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ +#define PPP_UI 0x03 /* Unnumbered Information */ +#define PPP_FLAG 0x7e /* Flag Sequence */ +#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ +#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ + +/* + * Protocol field values. + */ +#define PPP_IP 0x21 /* Internet Protocol */ +#define PPP_AT 0x29 /* AppleTalk Protocol */ +#define PPP_IPX 0x2b /* IPX protocol */ +#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ +#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ +#define PPP_MP 0x3d /* Multilink protocol */ +#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ +#define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */ +#define PPP_COMP 0xfd /* compressed packet */ +#define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */ +#define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */ +#define PPP_IPCP 0x8021 /* IP Control Protocol */ +#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ +#define PPP_IPXCP 0x802b /* IPX Control Protocol */ +#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ +#define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */ +#define PPP_CCP 0x80fd /* Compression Control Protocol */ +#define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */ +#define PPP_LCP 0xc021 /* Link Control Protocol */ +#define PPP_PAP 0xc023 /* Password Authentication Protocol */ +#define PPP_LQR 0xc025 /* Link Quality Report protocol */ +#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ +#define PPP_CBCP 0xc029 /* Callback Control Protocol */ + +/* + * Values for FCS calculations. + */ + +#define PPP_INITFCS 0xffff /* Initial FCS value */ +#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ + + +/* + * Extended asyncmap - allows any character to be escaped. + */ + +typedef __u32 ext_accm[8]; + +/* + * What to do with network protocol (NP) packets. + */ +enum NPmode { + NPMODE_PASS, /* pass the packet through */ + NPMODE_DROP, /* silently drop the packet */ + NPMODE_ERROR, /* return an error */ + NPMODE_QUEUE /* save it up for later. */ +}; + +/* + * Statistics for LQRP and pppstats + */ +struct pppstat { + __u32 ppp_discards; /* # frames discarded */ + + __u32 ppp_ibytes; /* bytes received */ + __u32 ppp_ioctects; /* bytes received not in error */ + __u32 ppp_ipackets; /* packets received */ + __u32 ppp_ierrors; /* receive errors */ + __u32 ppp_ilqrs; /* # LQR frames received */ + + __u32 ppp_obytes; /* raw bytes sent */ + __u32 ppp_ooctects; /* frame bytes sent */ + __u32 ppp_opackets; /* packets sent */ + __u32 ppp_oerrors; /* transmit errors */ + __u32 ppp_olqrs; /* # LQR frames sent */ +}; + +struct vjstat { + __u32 vjs_packets; /* outbound packets */ + __u32 vjs_compressed; /* outbound compressed packets */ + __u32 vjs_searches; /* searches for connection state */ + __u32 vjs_misses; /* times couldn't find conn. state */ + __u32 vjs_uncompressedin; /* inbound uncompressed packets */ + __u32 vjs_compressedin; /* inbound compressed packets */ + __u32 vjs_errorin; /* inbound unknown type packets */ + __u32 vjs_tossed; /* inbound packets tossed because of error */ +}; + +struct compstat { + __u32 unc_bytes; /* total uncompressed bytes */ + __u32 unc_packets; /* total uncompressed packets */ + __u32 comp_bytes; /* compressed bytes */ + __u32 comp_packets; /* compressed packets */ + __u32 inc_bytes; /* incompressible bytes */ + __u32 inc_packets; /* incompressible packets */ + + /* the compression ratio is defined as in_count / bytes_out */ + __u32 in_count; /* Bytes received */ + __u32 bytes_out; /* Bytes transmitted */ + + double ratio; /* not computed in kernel. */ +}; + +struct ppp_stats { + struct pppstat p; /* basic PPP statistics */ + struct vjstat vj; /* VJ header compression statistics */ +}; + +struct ppp_comp_stats { + struct compstat c; /* packet compression statistics */ + struct compstat d; /* packet decompression statistics */ +}; + +/* + * The following structure records the time in seconds since + * the last NP packet was sent or received. + */ +struct ppp_idle { + __kernel_time_t xmit_idle; /* time since last NP packet sent */ + __kernel_time_t recv_idle; /* time since last NP packet received */ +}; + +#endif /* _PPP_DEFS_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/prctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/prctl.h new file mode 100644 index 0000000..48d887e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/prctl.h @@ -0,0 +1,88 @@ +#ifndef _LINUX_PRCTL_H +#define _LINUX_PRCTL_H + +/* Values to pass as first argument to prctl() */ + +#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */ +#define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */ + +/* Get/set current->mm->dumpable */ +#define PR_GET_DUMPABLE 3 +#define PR_SET_DUMPABLE 4 + +/* Get/set unaligned access control bits (if meaningful) */ +#define PR_GET_UNALIGN 5 +#define PR_SET_UNALIGN 6 +# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ +# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ + +/* Get/set whether or not to drop capabilities on setuid() away from + * uid 0 (as per security/commoncap.c) */ +#define PR_GET_KEEPCAPS 7 +#define PR_SET_KEEPCAPS 8 + +/* Get/set floating-point emulation control bits (if meaningful) */ +#define PR_GET_FPEMU 9 +#define PR_SET_FPEMU 10 +# define PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */ +# define PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */ + +/* Get/set floating-point exception mode (if meaningful) */ +#define PR_GET_FPEXC 11 +#define PR_SET_FPEXC 12 +# define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */ +# define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */ +# define PR_FP_EXC_OVF 0x020000 /* floating point overflow */ +# define PR_FP_EXC_UND 0x040000 /* floating point underflow */ +# define PR_FP_EXC_RES 0x080000 /* floating point inexact result */ +# define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */ +# define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */ +# define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */ +# define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */ +# define PR_FP_EXC_PRECISE 3 /* precise exception mode */ + +/* Get/set whether we use statistical process timing or accurate timestamp + * based process timing */ +#define PR_GET_TIMING 13 +#define PR_SET_TIMING 14 +# define PR_TIMING_STATISTICAL 0 /* Normal, traditional, + statistical process timing */ +# define PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based + process timing */ + +#define PR_SET_NAME 15 /* Set process name */ +#define PR_GET_NAME 16 /* Get process name */ + +/* Get/set process endian */ +#define PR_GET_ENDIAN 19 +#define PR_SET_ENDIAN 20 +# define PR_ENDIAN_BIG 0 +# define PR_ENDIAN_LITTLE 1 /* True little endian mode */ +# define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ + +/* Get/set process seccomp mode */ +#define PR_GET_SECCOMP 21 +#define PR_SET_SECCOMP 22 + +/* Get/set the capability bounding set (as per security/commoncap.c) */ +#define PR_CAPBSET_READ 23 +#define PR_CAPBSET_DROP 24 + +/* Get/set the process' ability to use the timestamp counter instruction */ +#define PR_GET_TSC 25 +#define PR_SET_TSC 26 +# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ +# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ + +/* Get/set securebits (as per security/commoncap.c) */ +#define PR_GET_SECUREBITS 27 +#define PR_SET_SECUREBITS 28 + +/* + * Get/set the timerslack as used by poll/select/nanosleep + * A value of 0 means "use default" + */ +#define PR_SET_TIMERSLACK 29 +#define PR_GET_TIMERSLACK 30 + +#endif /* _LINUX_PRCTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ptrace.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ptrace.h new file mode 100644 index 0000000..6e66b68 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ptrace.h @@ -0,0 +1,52 @@ +#ifndef _LINUX_PTRACE_H +#define _LINUX_PTRACE_H +/* ptrace.h */ +/* structs and defines to help the user use the ptrace system call. */ + +/* has the defines to get at the registers. */ + +#define PTRACE_TRACEME 0 +#define PTRACE_PEEKTEXT 1 +#define PTRACE_PEEKDATA 2 +#define PTRACE_PEEKUSR 3 +#define PTRACE_POKETEXT 4 +#define PTRACE_POKEDATA 5 +#define PTRACE_POKEUSR 6 +#define PTRACE_CONT 7 +#define PTRACE_KILL 8 +#define PTRACE_SINGLESTEP 9 + +#define PTRACE_ATTACH 16 +#define PTRACE_DETACH 17 + +#define PTRACE_SYSCALL 24 + +/* 0x4200-0x4300 are reserved for architecture-independent additions. */ +#define PTRACE_SETOPTIONS 0x4200 +#define PTRACE_GETEVENTMSG 0x4201 +#define PTRACE_GETSIGINFO 0x4202 +#define PTRACE_SETSIGINFO 0x4203 + +/* options set using PTRACE_SETOPTIONS */ +#define PTRACE_O_TRACESYSGOOD 0x00000001 +#define PTRACE_O_TRACEFORK 0x00000002 +#define PTRACE_O_TRACEVFORK 0x00000004 +#define PTRACE_O_TRACECLONE 0x00000008 +#define PTRACE_O_TRACEEXEC 0x00000010 +#define PTRACE_O_TRACEVFORKDONE 0x00000020 +#define PTRACE_O_TRACEEXIT 0x00000040 + +#define PTRACE_O_MASK 0x0000007f + +/* Wait extended result codes for the above trace options. */ +#define PTRACE_EVENT_FORK 1 +#define PTRACE_EVENT_VFORK 2 +#define PTRACE_EVENT_CLONE 3 +#define PTRACE_EVENT_EXEC 4 +#define PTRACE_EVENT_VFORK_DONE 5 +#define PTRACE_EVENT_EXIT 6 + +#include + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/qnx4_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/qnx4_fs.h new file mode 100644 index 0000000..e2bd543 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/qnx4_fs.h @@ -0,0 +1,89 @@ +/* + * Name : qnx4_fs.h + * Author : Richard Frowijn + * Function : qnx4 global filesystem definitions + * History : 23-03-1998 created + */ +#ifndef _LINUX_QNX4_FS_H +#define _LINUX_QNX4_FS_H + +#include +#include +#include + +#define QNX4_ROOT_INO 1 + +#define QNX4_MAX_XTNTS_PER_XBLK 60 +/* for di_status */ +#define QNX4_FILE_USED 0x01 +#define QNX4_FILE_MODIFIED 0x02 +#define QNX4_FILE_BUSY 0x04 +#define QNX4_FILE_LINK 0x08 +#define QNX4_FILE_INODE 0x10 +#define QNX4_FILE_FSYSCLEAN 0x20 + +#define QNX4_I_MAP_SLOTS 8 +#define QNX4_Z_MAP_SLOTS 64 +#define QNX4_VALID_FS 0x0001 /* Clean fs. */ +#define QNX4_ERROR_FS 0x0002 /* fs has errors. */ +#define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */ +#define QNX4_BLOCK_SIZE_BITS 9 /* blocksize shift */ +#define QNX4_DIR_ENTRY_SIZE 0x040 /* dir entry size of 64 bytes */ +#define QNX4_DIR_ENTRY_SIZE_BITS 6 /* dir entry size shift */ +#define QNX4_XBLK_ENTRY_SIZE 0x200 /* xblk entry size */ +#define QNX4_INODES_PER_BLOCK 0x08 /* 512 / 64 */ + +/* for filenames */ +#define QNX4_SHORT_NAME_MAX 16 +#define QNX4_NAME_MAX 48 + +/* + * This is the original qnx4 inode layout on disk. + */ +struct qnx4_inode_entry { + char di_fname[QNX4_SHORT_NAME_MAX]; + qnx4_off_t di_size; + qnx4_xtnt_t di_first_xtnt; + __le32 di_xblk; + __le32 di_ftime; + __le32 di_mtime; + __le32 di_atime; + __le32 di_ctime; + qnx4_nxtnt_t di_num_xtnts; + qnx4_mode_t di_mode; + qnx4_muid_t di_uid; + qnx4_mgid_t di_gid; + qnx4_nlink_t di_nlink; + __u8 di_zero[4]; + qnx4_ftype_t di_type; + __u8 di_status; +}; + +struct qnx4_link_info { + char dl_fname[QNX4_NAME_MAX]; + __le32 dl_inode_blk; + __u8 dl_inode_ndx; + __u8 dl_spare[10]; + __u8 dl_status; +}; + +struct qnx4_xblk { + __le32 xblk_next_xblk; + __le32 xblk_prev_xblk; + __u8 xblk_num_xtnts; + __u8 xblk_spare[3]; + __le32 xblk_num_blocks; + qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; + char xblk_signature[8]; + qnx4_xtnt_t xblk_first_xtnt; +}; + +struct qnx4_super_block { + struct qnx4_inode_entry RootDir; + struct qnx4_inode_entry Inode; + struct qnx4_inode_entry Boot; + struct qnx4_inode_entry AltBoot; +}; + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/qnxtypes.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/qnxtypes.h new file mode 100644 index 0000000..bebbe5c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/qnxtypes.h @@ -0,0 +1,28 @@ +/* + * Name : qnxtypes.h + * Author : Richard Frowijn + * Function : standard qnx types + * History : 22-03-1998 created + * + */ + +#ifndef _QNX4TYPES_H +#define _QNX4TYPES_H + +#include + +typedef __le16 qnx4_nxtnt_t; +typedef __u8 qnx4_ftype_t; + +typedef struct { + __le32 xtnt_blk; + __le32 xtnt_size; +} qnx4_xtnt_t; + +typedef __le16 qnx4_mode_t; +typedef __le16 qnx4_muid_t; +typedef __le16 qnx4_mgid_t; +typedef __le32 qnx4_off_t; +typedef __le16 qnx4_nlink_t; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/quota.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/quota.h new file mode 100644 index 0000000..3218a95 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/quota.h @@ -0,0 +1,176 @@ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Elz at The University of Melbourne. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUX_QUOTA_ +#define _LINUX_QUOTA_ + +#include +#include + +#define __DQUOT_VERSION__ "dquot_6.5.2" + +#define MAXQUOTAS 2 +#define USRQUOTA 0 /* element used for user quotas */ +#define GRPQUOTA 1 /* element used for group quotas */ + +/* + * Definitions for the default names of the quotas files. + */ +#define INITQFNAMES { \ + "user", /* USRQUOTA */ \ + "group", /* GRPQUOTA */ \ + "undefined", \ +}; + +/* + * Command definitions for the 'quotactl' system call. + * The commands are broken into a main command defined below + * and a subcommand that is used to convey the type of + * quota that is being manipulated (see above). + */ +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) + +#define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ +#define Q_QUOTAON 0x800002 /* turn quotas on */ +#define Q_QUOTAOFF 0x800003 /* turn quotas off */ +#define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ +#define Q_GETINFO 0x800005 /* get information about quota files */ +#define Q_SETINFO 0x800006 /* set information about quota files */ +#define Q_GETQUOTA 0x800007 /* get user quota structure */ +#define Q_SETQUOTA 0x800008 /* set user quota structure */ + +/* Quota format type IDs */ +#define QFMT_VFS_OLD 1 +#define QFMT_VFS_V0 2 + +/* Size of block in which space limits are passed through the quota + * interface */ +#define QIF_DQBLKSIZE_BITS 10 +#define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS) + +/* + * Quota structure used for communication with userspace via quotactl + * Following flags are used to specify which fields are valid + */ +enum { + QIF_BLIMITS_B = 0, + QIF_SPACE_B, + QIF_ILIMITS_B, + QIF_INODES_B, + QIF_BTIME_B, + QIF_ITIME_B, +}; + +#define QIF_BLIMITS (1 << QIF_BLIMITS_B) +#define QIF_SPACE (1 << QIF_SPACE_B) +#define QIF_ILIMITS (1 << QIF_ILIMITS_B) +#define QIF_INODES (1 << QIF_INODES_B) +#define QIF_BTIME (1 << QIF_BTIME_B) +#define QIF_ITIME (1 << QIF_ITIME_B) +#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) +#define QIF_USAGE (QIF_SPACE | QIF_INODES) +#define QIF_TIMES (QIF_BTIME | QIF_ITIME) +#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) + +struct if_dqblk { + __u64 dqb_bhardlimit; + __u64 dqb_bsoftlimit; + __u64 dqb_curspace; + __u64 dqb_ihardlimit; + __u64 dqb_isoftlimit; + __u64 dqb_curinodes; + __u64 dqb_btime; + __u64 dqb_itime; + __u32 dqb_valid; +}; + +/* + * Structure used for setting quota information about file via quotactl + * Following flags are used to specify which fields are valid + */ +#define IIF_BGRACE 1 +#define IIF_IGRACE 2 +#define IIF_FLAGS 4 +#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) + +struct if_dqinfo { + __u64 dqi_bgrace; + __u64 dqi_igrace; + __u32 dqi_flags; + __u32 dqi_valid; +}; + +/* + * Definitions for quota netlink interface + */ +#define QUOTA_NL_NOWARN 0 +#define QUOTA_NL_IHARDWARN 1 /* Inode hardlimit reached */ +#define QUOTA_NL_ISOFTLONGWARN 2 /* Inode grace time expired */ +#define QUOTA_NL_ISOFTWARN 3 /* Inode softlimit reached */ +#define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */ +#define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */ +#define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */ +#define QUOTA_NL_IHARDBELOW 7 /* Usage got below inode hardlimit */ +#define QUOTA_NL_ISOFTBELOW 8 /* Usage got below inode softlimit */ +#define QUOTA_NL_BHARDBELOW 9 /* Usage got below block hardlimit */ +#define QUOTA_NL_BSOFTBELOW 10 /* Usage got below block softlimit */ + +enum { + QUOTA_NL_C_UNSPEC, + QUOTA_NL_C_WARNING, + __QUOTA_NL_C_MAX, +}; +#define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1) + +enum { + QUOTA_NL_A_UNSPEC, + QUOTA_NL_A_QTYPE, + QUOTA_NL_A_EXCESS_ID, + QUOTA_NL_A_WARNING, + QUOTA_NL_A_DEV_MAJOR, + QUOTA_NL_A_DEV_MINOR, + QUOTA_NL_A_CAUSED_ID, + __QUOTA_NL_A_MAX, +}; +#define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1) + + + +# /* nodep */ include + +__BEGIN_DECLS +long quotactl __P ((unsigned int, const char *, int, caddr_t)); +__END_DECLS + +#endif /* _QUOTA_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/radeonfb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/radeonfb.h new file mode 100644 index 0000000..8c4bbde --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/radeonfb.h @@ -0,0 +1,15 @@ +#ifndef __LINUX_RADEONFB_H__ +#define __LINUX_RADEONFB_H__ + +#include +#include + +#define ATY_RADEON_LCD_ON 0x00000001 +#define ATY_RADEON_CRT_ON 0x00000002 + + +#define FBIO_RADEON_GET_MIRROR _IOR('@', 3, size_t) +#define FBIO_RADEON_SET_MIRROR _IOW('@', 4, size_t) + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/..install.cmd new file mode 100644 index 0000000..421358e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/raid/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/raid /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/raid mips md_p.h md_u.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/raid /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/raid mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/raid/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/md_p.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/md_p.h new file mode 100644 index 0000000..53a2545 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/md_p.h @@ -0,0 +1,277 @@ +/* + md_p.h : physical layout of Linux RAID devices + Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + You should have received a copy of the GNU General Public License + (for example /usr/src/linux/COPYING); if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _MD_P_H +#define _MD_P_H + +#include + +/* + * RAID superblock. + * + * The RAID superblock maintains some statistics on each RAID configuration. + * Each real device in the RAID set contains it near the end of the device. + * Some of the ideas are copied from the ext2fs implementation. + * + * We currently use 4096 bytes as follows: + * + * word offset function + * + * 0 - 31 Constant generic RAID device information. + * 32 - 63 Generic state information. + * 64 - 127 Personality specific information. + * 128 - 511 12 32-words descriptors of the disks in the raid set. + * 512 - 911 Reserved. + * 912 - 1023 Disk specific descriptor. + */ + +/* + * If x is the real device size in bytes, we return an apparent size of: + * + * y = (x & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES + * + * and place the 4kB superblock at offset y. + */ +#define MD_RESERVED_BYTES (64 * 1024) +#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) + +#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) + +#define MD_SB_BYTES 4096 +#define MD_SB_WORDS (MD_SB_BYTES / 4) +#define MD_SB_SECTORS (MD_SB_BYTES / 512) + +/* + * The following are counted in 32-bit words + */ +#define MD_SB_GENERIC_OFFSET 0 +#define MD_SB_PERSONALITY_OFFSET 64 +#define MD_SB_DISKS_OFFSET 128 +#define MD_SB_DESCRIPTOR_OFFSET 992 + +#define MD_SB_GENERIC_CONSTANT_WORDS 32 +#define MD_SB_GENERIC_STATE_WORDS 32 +#define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS) +#define MD_SB_PERSONALITY_WORDS 64 +#define MD_SB_DESCRIPTOR_WORDS 32 +#define MD_SB_DISKS 27 +#define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS) +#define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS) +#define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS) + +/* + * Device "operational" state bits + */ +#define MD_DISK_FAULTY 0 /* disk is faulty / operational */ +#define MD_DISK_ACTIVE 1 /* disk is running or spare disk */ +#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ +#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ + +#define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. + * read requests will only be sent here in + * dire need + */ + +typedef struct mdp_device_descriptor_s { + __u32 number; /* 0 Device number in the entire set */ + __u32 major; /* 1 Device major number */ + __u32 minor; /* 2 Device minor number */ + __u32 raid_disk; /* 3 The role of the device in the raid set */ + __u32 state; /* 4 Operational state */ + __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5]; +} mdp_disk_t; + +#define MD_SB_MAGIC 0xa92b4efc + +/* + * Superblock state bits + */ +#define MD_SB_CLEAN 0 +#define MD_SB_ERRORS 1 + +#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ + +/* + * Notes: + * - if an array is being reshaped (restriped) in order to change the + * the number of active devices in the array, 'raid_disks' will be + * the larger of the old and new numbers. 'delta_disks' will + * be the "new - old". So if +ve, raid_disks is the new value, and + * "raid_disks-delta_disks" is the old. If -ve, raid_disks is the + * old value and "raid_disks+delta_disks" is the new (smaller) value. + */ + + +typedef struct mdp_superblock_s { + /* + * Constant generic information + */ + __u32 md_magic; /* 0 MD identifier */ + __u32 major_version; /* 1 major version to which the set conforms */ + __u32 minor_version; /* 2 minor version ... */ + __u32 patch_version; /* 3 patchlevel version ... */ + __u32 gvalid_words; /* 4 Number of used words in this section */ + __u32 set_uuid0; /* 5 Raid set identifier */ + __u32 ctime; /* 6 Creation time */ + __u32 level; /* 7 Raid personality */ + __u32 size; /* 8 Apparent size of each individual disk */ + __u32 nr_disks; /* 9 total disks in the raid set */ + __u32 raid_disks; /* 10 disks in a fully functional raid set */ + __u32 md_minor; /* 11 preferred MD minor device number */ + __u32 not_persistent; /* 12 does it have a persistent superblock */ + __u32 set_uuid1; /* 13 Raid set identifier #2 */ + __u32 set_uuid2; /* 14 Raid set identifier #3 */ + __u32 set_uuid3; /* 15 Raid set identifier #4 */ + __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16]; + + /* + * Generic state information + */ + __u32 utime; /* 0 Superblock update time */ + __u32 state; /* 1 State bits (clean, ...) */ + __u32 active_disks; /* 2 Number of currently active disks */ + __u32 working_disks; /* 3 Number of working disks */ + __u32 failed_disks; /* 4 Number of failed disks */ + __u32 spare_disks; /* 5 Number of spare disks */ + __u32 sb_csum; /* 6 checksum of the whole superblock */ +#ifdef __BIG_ENDIAN + __u32 events_hi; /* 7 high-order of superblock update count */ + __u32 events_lo; /* 8 low-order of superblock update count */ + __u32 cp_events_hi; /* 9 high-order of checkpoint update count */ + __u32 cp_events_lo; /* 10 low-order of checkpoint update count */ +#else + __u32 events_lo; /* 7 low-order of superblock update count */ + __u32 events_hi; /* 8 high-order of superblock update count */ + __u32 cp_events_lo; /* 9 low-order of checkpoint update count */ + __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ +#endif + __u32 recovery_cp; /* 11 recovery checkpoint sector count */ + /* There are only valid for minor_version > 90 */ + __u64 reshape_position; /* 12,13 next address in array-space for reshape */ + __u32 new_level; /* 14 new level we are reshaping to */ + __u32 delta_disks; /* 15 change in number of raid_disks */ + __u32 new_layout; /* 16 new layout */ + __u32 new_chunk; /* 17 new chunk size (bytes) */ + __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18]; + + /* + * Personality information + */ + __u32 layout; /* 0 the array's physical layout */ + __u32 chunk_size; /* 1 chunk size in bytes */ + __u32 root_pv; /* 2 LV root PV */ + __u32 root_block; /* 3 LV root block */ + __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4]; + + /* + * Disks information + */ + mdp_disk_t disks[MD_SB_DISKS]; + + /* + * Reserved + */ + __u32 reserved[MD_SB_RESERVED_WORDS]; + + /* + * Active descriptor + */ + mdp_disk_t this_disk; + +} mdp_super_t; + +static __inline__ __u64 md_event(mdp_super_t *sb) { + __u64 ev = sb->events_hi; + return (ev<<32)| sb->events_lo; +} + +#define MD_SUPERBLOCK_1_TIME_SEC_MASK ((1ULL<<40) - 1) + +/* + * The version-1 superblock : + * All numeric fields are little-endian. + * + * total size: 256 bytes plus 2 per device. + * 1K allows 384 devices. + */ +struct mdp_superblock_1 { + /* constant array information - 128 bytes */ + __le32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ + __le32 major_version; /* 1 */ + __le32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */ + __le32 pad0; /* always set to 0 when writing */ + + __u8 set_uuid[16]; /* user-space generated. */ + char set_name[32]; /* set and interpreted by user-space */ + + __le64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ + __le32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ + __le32 layout; /* only for raid5 and raid10 currently */ + __le64 size; /* used size of component devices, in 512byte sectors */ + + __le32 chunksize; /* in 512byte sectors */ + __le32 raid_disks; + __le32 bitmap_offset; /* sectors after start of superblock that bitmap starts + * NOTE: signed, so bitmap can be before superblock + * only meaningful of feature_map[0] is set. + */ + + /* These are only valid with feature bit '4' */ + __le32 new_level; /* new level we are reshaping to */ + __le64 reshape_position; /* next address in array-space for reshape */ + __le32 delta_disks; /* change in number of raid_disks */ + __le32 new_layout; /* new layout */ + __le32 new_chunk; /* new chunk size (bytes) */ + __u8 pad1[128-124]; /* set to 0 when written */ + + /* constant this-device information - 64 bytes */ + __le64 data_offset; /* sector start of data, often 0 */ + __le64 data_size; /* sectors in this device that can be used for data */ + __le64 super_offset; /* sector start of this superblock */ + __le64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */ + __le32 dev_number; /* permanent identifier of this device - not role in raid */ + __le32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ + __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ + __u8 devflags; /* per-device flags. Only one defined...*/ +#define WriteMostly1 1 /* mask for writemostly flag in above */ + __u8 pad2[64-57]; /* set to 0 when writing */ + + /* array state information - 64 bytes */ + __le64 utime; /* 40 bits second, 24 btes microseconds */ + __le64 events; /* incremented when superblock updated */ + __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */ + __le32 sb_csum; /* checksum upto devs[max_dev] */ + __le32 max_dev; /* size of devs[] array to consider */ + __u8 pad3[64-32]; /* set to 0 when writing */ + + /* device state information. Indexed by dev_number. + * 2 bytes per device + * Note there are no per-device state flags. State information is rolled + * into the 'roles' value. If a device is spare or faulty, then it doesn't + * have a meaningful role. + */ + __le16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ +}; + +/* feature_map bits */ +#define MD_FEATURE_BITMAP_OFFSET 1 +#define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and + * must be honoured + */ +#define MD_FEATURE_RESHAPE_ACTIVE 4 + +#define MD_FEATURE_ALL (1|2|4) + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/md_u.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/md_u.h new file mode 100644 index 0000000..1185a7d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raid/md_u.h @@ -0,0 +1,156 @@ +/* + md_u.h : user <=> kernel API between Linux raidtools and RAID drivers + Copyright (C) 1998 Ingo Molnar + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + You should have received a copy of the GNU General Public License + (for example /usr/src/linux/COPYING); if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _MD_U_H +#define _MD_U_H + +/* + * Different major versions are not compatible. + * Different minor versions are only downward compatible. + * Different patchlevel versions are downward and upward compatible. + */ +#define MD_MAJOR_VERSION 0 +#define MD_MINOR_VERSION 90 +/* + * MD_PATCHLEVEL_VERSION indicates kernel functionality. + * >=1 means different superblock formats are selectable using SET_ARRAY_INFO + * and major_version/minor_version accordingly + * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT + * in the super status byte + * >=3 means that bitmap superblock version 4 is supported, which uses + * little-ending representation rather than host-endian + */ +#define MD_PATCHLEVEL_VERSION 3 + +/* ioctls */ + +/* status */ +#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) +#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) +#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) +#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) +#define RAID_AUTORUN _IO (MD_MAJOR, 0x14) +#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) + +/* configuration */ +#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) +#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) +#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) +#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) +#define SET_DISK_INFO _IO (MD_MAJOR, 0x24) +#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) +#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) +#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) +#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) +#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) +#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) +#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) + +/* usage */ +#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) +/* 0x31 was START_ARRAY */ +#define STOP_ARRAY _IO (MD_MAJOR, 0x32) +#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) +#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) + +/* 63 partitions with the alternate major number (mdp) */ +#define MdpMinorShift 6 + +typedef struct mdu_version_s { + int major; + int minor; + int patchlevel; +} mdu_version_t; + +typedef struct mdu_array_info_s { + /* + * Generic constant information + */ + int major_version; + int minor_version; + int patch_version; + int ctime; + int level; + int size; + int nr_disks; + int raid_disks; + int md_minor; + int not_persistent; + + /* + * Generic state information + */ + int utime; /* 0 Superblock update time */ + int state; /* 1 State bits (clean, ...) */ + int active_disks; /* 2 Number of currently active disks */ + int working_disks; /* 3 Number of working disks */ + int failed_disks; /* 4 Number of failed disks */ + int spare_disks; /* 5 Number of spare disks */ + + /* + * Personality information + */ + int layout; /* 0 the array's physical layout */ + int chunk_size; /* 1 chunk size in bytes */ + +} mdu_array_info_t; + +/* non-obvious values for 'level' */ +#define LEVEL_MULTIPATH (-4) +#define LEVEL_LINEAR (-1) +#define LEVEL_FAULTY (-5) + +/* we need a value for 'no level specified' and 0 + * means 'raid0', so we need something else. This is + * for internal use only + */ +#define LEVEL_NONE (-1000000) + +typedef struct mdu_disk_info_s { + /* + * configuration/status of one particular disk + */ + int number; + int major; + int minor; + int raid_disk; + int state; + +} mdu_disk_info_t; + +typedef struct mdu_start_info_s { + /* + * configuration/status of one particular disk + */ + int major; + int minor; + int raid_disk; + int state; + +} mdu_start_info_t; + +typedef struct mdu_bitmap_file_s +{ + char pathname[4096]; +} mdu_bitmap_file_t; + +typedef struct mdu_param_s +{ + int personality; /* 1,2,3,4 */ + int chunk_size; /* in bytes */ + int max_fault; /* unused for now */ +} mdu_param_t; + +#endif + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/random.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/random.h new file mode 100644 index 0000000..912f4ff --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/random.h @@ -0,0 +1,46 @@ +/* + * include/linux/random.h + * + * Include file for the random number generator. + */ + +#ifndef _LINUX_RANDOM_H +#define _LINUX_RANDOM_H + +#include +#include +#include + +/* ioctl()'s for the random number generator */ + +/* Get the entropy count. */ +#define RNDGETENTCNT _IOR( 'R', 0x00, int ) + +/* Add to (or subtract from) the entropy count. (Superuser only.) */ +#define RNDADDTOENTCNT _IOW( 'R', 0x01, int ) + +/* Get the contents of the entropy pool. (Superuser only.) */ +#define RNDGETPOOL _IOR( 'R', 0x02, int [2] ) + +/* + * Write bytes into the entropy pool and add to the entropy count. + * (Superuser only.) + */ +#define RNDADDENTROPY _IOW( 'R', 0x03, int [2] ) + +/* Clear entropy count to 0. (Superuser only.) */ +#define RNDZAPENTCNT _IO( 'R', 0x04 ) + +/* Clear the entropy pool and associated counters. (Superuser only.) */ +#define RNDCLEARPOOL _IO( 'R', 0x06 ) + +struct rand_pool_info { + int entropy_count; + int buf_size; + __u32 buf[0]; +}; + +/* Exported functions */ + + +#endif /* _LINUX_RANDOM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raw.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raw.h new file mode 100644 index 0000000..62d543e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/raw.h @@ -0,0 +1,18 @@ +#ifndef __LINUX_RAW_H +#define __LINUX_RAW_H + +#include + +#define RAW_SETBIND _IO( 0xac, 0 ) +#define RAW_GETBIND _IO( 0xac, 1 ) + +struct raw_config_request +{ + int raw_minor; + __u64 block_major; + __u64 block_minor; +}; + +#define MAX_RAW_MINORS CONFIG_MAX_RAW_DEVS + +#endif /* __LINUX_RAW_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reboot.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reboot.h new file mode 100644 index 0000000..aa33674 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reboot.h @@ -0,0 +1,39 @@ +#ifndef _LINUX_REBOOT_H +#define _LINUX_REBOOT_H + +/* + * Magic values required to use _reboot() system call. + */ + +#define LINUX_REBOOT_MAGIC1 0xfee1dead +#define LINUX_REBOOT_MAGIC2 672274793 +#define LINUX_REBOOT_MAGIC2A 85072278 +#define LINUX_REBOOT_MAGIC2B 369367448 +#define LINUX_REBOOT_MAGIC2C 537993216 + + +/* + * Commands accepted by the _reboot() system call. + * + * RESTART Restart system using default command and mode. + * HALT Stop OS and give system control to ROM monitor, if any. + * CAD_ON Ctrl-Alt-Del sequence causes RESTART command. + * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task. + * POWER_OFF Stop OS and remove all power from system, if possible. + * RESTART2 Restart system using given command string. + * SW_SUSPEND Suspend system using software suspend if compiled in. + * KEXEC Restart system using a previously loaded Linux kernel + */ + +#define LINUX_REBOOT_CMD_RESTART 0x01234567 +#define LINUX_REBOOT_CMD_HALT 0xCDEF0123 +#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF +#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 +#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC +#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 +#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2 +#define LINUX_REBOOT_CMD_KEXEC 0x45584543 + + + +#endif /* _LINUX_REBOOT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reiserfs_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reiserfs_fs.h new file mode 100644 index 0000000..43a2251 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reiserfs_fs.h @@ -0,0 +1,35 @@ +/* + * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details + */ + + /* this file has an amazingly stupid + name, yura please fix it to be + reiserfs.h, and merge all the rest + of our .h files that are in this + directory into it. */ + +#ifndef _LINUX_REISER_FS_H +#define _LINUX_REISER_FS_H + +#include +#include + + +/* + * include/linux/reiser_fs.h + * + * Reiser File System constants and structures + * + */ + +/* ioctl's command */ +#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) +/* define following flags to be the same as in ext2, so that chattr(1), + lsattr(1) will work with us. */ +#define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS +#define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS +#define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION +#define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION + + +#endif /* _LINUX_REISER_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reiserfs_xattr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reiserfs_xattr.h new file mode 100644 index 0000000..38fff2e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/reiserfs_xattr.h @@ -0,0 +1,25 @@ +/* + File: linux/reiserfs_xattr.h +*/ + +#ifndef _LINUX_REISERFS_XATTR_H +#define _LINUX_REISERFS_XATTR_H + +#include + +/* Magic value in header */ +#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ + +struct reiserfs_xattr_header { + __le32 h_magic; /* magic number for identification */ + __le32 h_hash; /* hash of the value */ +}; + +struct reiserfs_security_handle { + char *name; + void *value; + size_t length; +}; + + +#endif /* _LINUX_REISERFS_XATTR_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/resource.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/resource.h new file mode 100644 index 0000000..7ef7a15 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/resource.h @@ -0,0 +1,75 @@ +#ifndef _LINUX_RESOURCE_H +#define _LINUX_RESOURCE_H + +#include + +struct task_struct; + +/* + * Resource control/accounting header file for linux + */ + +/* + * Definition of struct rusage taken from BSD 4.3 Reno + * + * We don't support all of these yet, but we might as well have them.... + * Otherwise, each time we add new items, programs which depend on this + * structure will lose. This reduces the chances of that happening. + */ +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN (-1) +#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */ +#define RUSAGE_THREAD 1 /* only the calling thread */ + +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ + long ru_maxrss; /* maximum resident set size */ + long ru_ixrss; /* integral shared memory size */ + long ru_idrss; /* integral unshared data size */ + long ru_isrss; /* integral unshared stack size */ + long ru_minflt; /* page reclaims */ + long ru_majflt; /* page faults */ + long ru_nswap; /* swaps */ + long ru_inblock; /* block input operations */ + long ru_oublock; /* block output operations */ + long ru_msgsnd; /* messages sent */ + long ru_msgrcv; /* messages received */ + long ru_nsignals; /* signals received */ + long ru_nvcsw; /* voluntary context switches */ + long ru_nivcsw; /* involuntary " */ +}; + +struct rlimit { + unsigned long rlim_cur; + unsigned long rlim_max; +}; + +#define PRIO_MIN (-20) +#define PRIO_MAX 20 + +#define PRIO_PROCESS 0 +#define PRIO_PGRP 1 +#define PRIO_USER 2 + +/* + * Limit the stack by to some sane default: root can always + * increase this limit if needed.. 8MB seems reasonable. + */ +#define _STK_LIM (8*1024*1024) + +/* + * GPG2 wants 64kB of mlocked memory, to make sure pass phrases + * and other sensitive information are never written to disk. + */ +#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) + +/* + * Due to binary compatibility, the actual resource numbers + * may be different for different linux versions.. + */ +#include + +int getrusage(struct task_struct *p, int who, struct rusage *ru); + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/romfs_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/romfs_fs.h new file mode 100644 index 0000000..c490fbc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/romfs_fs.h @@ -0,0 +1,56 @@ +#ifndef __LINUX_ROMFS_FS_H +#define __LINUX_ROMFS_FS_H + +/* The basic structures of the romfs filesystem */ + +#define ROMBSIZE BLOCK_SIZE +#define ROMBSBITS BLOCK_SIZE_BITS +#define ROMBMASK (ROMBSIZE-1) +#define ROMFS_MAGIC 0x7275 + +#define ROMFS_MAXFN 128 + +#define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff)) +#define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff)) +#define __mk4(a,b,c,d) cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d))) +#define ROMSB_WORD0 __mk4('-','r','o','m') +#define ROMSB_WORD1 __mk4('1','f','s','-') + +/* On-disk "super block" */ + +struct romfs_super_block { + __be32 word0; + __be32 word1; + __be32 size; + __be32 checksum; + char name[0]; /* volume name */ +}; + +/* On disk inode */ + +struct romfs_inode { + __be32 next; /* low 4 bits see ROMFH_ */ + __be32 spec; + __be32 size; + __be32 checksum; + char name[0]; +}; + +#define ROMFH_TYPE 7 +#define ROMFH_HRD 0 +#define ROMFH_DIR 1 +#define ROMFH_REG 2 +#define ROMFH_SYM 3 +#define ROMFH_BLK 4 +#define ROMFH_CHR 5 +#define ROMFH_SCK 6 +#define ROMFH_FIF 7 +#define ROMFH_EXEC 8 + +/* Alignment */ + +#define ROMFH_SIZE 16 +#define ROMFH_PAD (ROMFH_SIZE-1) +#define ROMFH_MASK (~ROMFH_PAD) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rose.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rose.h new file mode 100644 index 0000000..c7b4b18 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rose.h @@ -0,0 +1,87 @@ +/* + * These are the public elements of the Linux kernel Rose implementation. + * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the + * definition of the ax25_address structure. + */ + +#ifndef ROSE_KERNEL_H +#define ROSE_KERNEL_H + +#define ROSE_MTU 251 + +#define ROSE_MAX_DIGIS 6 + +#define ROSE_DEFER 1 +#define ROSE_T1 2 +#define ROSE_T2 3 +#define ROSE_T3 4 +#define ROSE_IDLE 5 +#define ROSE_QBITINCL 6 +#define ROSE_HOLDBACK 7 + +#define SIOCRSGCAUSE (SIOCPROTOPRIVATE+0) +#define SIOCRSSCAUSE (SIOCPROTOPRIVATE+1) +#define SIOCRSL2CALL (SIOCPROTOPRIVATE+2) +#define SIOCRSSL2CALL (SIOCPROTOPRIVATE+2) +#define SIOCRSACCEPT (SIOCPROTOPRIVATE+3) +#define SIOCRSCLRRT (SIOCPROTOPRIVATE+4) +#define SIOCRSGL2CALL (SIOCPROTOPRIVATE+5) +#define SIOCRSGFACILITIES (SIOCPROTOPRIVATE+6) + +#define ROSE_DTE_ORIGINATED 0x00 +#define ROSE_NUMBER_BUSY 0x01 +#define ROSE_INVALID_FACILITY 0x03 +#define ROSE_NETWORK_CONGESTION 0x05 +#define ROSE_OUT_OF_ORDER 0x09 +#define ROSE_ACCESS_BARRED 0x0B +#define ROSE_NOT_OBTAINABLE 0x0D +#define ROSE_REMOTE_PROCEDURE 0x11 +#define ROSE_LOCAL_PROCEDURE 0x13 +#define ROSE_SHIP_ABSENT 0x39 + +typedef struct { + char rose_addr[5]; +} rose_address; + +struct sockaddr_rose { + sa_family_t srose_family; + rose_address srose_addr; + ax25_address srose_call; + int srose_ndigis; + ax25_address srose_digi; +}; + +struct full_sockaddr_rose { + sa_family_t srose_family; + rose_address srose_addr; + ax25_address srose_call; + unsigned int srose_ndigis; + ax25_address srose_digis[ROSE_MAX_DIGIS]; +}; + +struct rose_route_struct { + rose_address address; + unsigned short mask; + ax25_address neighbour; + char device[16]; + unsigned char ndigis; + ax25_address digipeaters[AX25_MAX_DIGIS]; +}; + +struct rose_cause_struct { + unsigned char cause; + unsigned char diagnostic; +}; + +struct rose_facilities_struct { + rose_address source_addr, dest_addr; + ax25_address source_call, dest_call; + unsigned char source_ndigis, dest_ndigis; + ax25_address source_digis[ROSE_MAX_DIGIS]; + ax25_address dest_digis[ROSE_MAX_DIGIS]; + unsigned int rand; + rose_address fail_addr; + ax25_address fail_call; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/route.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/route.h new file mode 100644 index 0000000..c96ff9e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/route.h @@ -0,0 +1,68 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the IP router interface. + * + * Version: @(#)route.h 1.0.3 05/27/93 + * + * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 + * for the purposes of compatibility only. + * + * Fred N. van Kempen, + * + * Changes: + * Mike McLagan : Routing by source + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_ROUTE_H +#define _LINUX_ROUTE_H + +#include + + +/* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ +struct rtentry +{ + unsigned long rt_pad1; + struct sockaddr rt_dst; /* target address */ + struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ + struct sockaddr rt_genmask; /* target network mask (IP) */ + unsigned short rt_flags; + short rt_pad2; + unsigned long rt_pad3; + void *rt_pad4; + short rt_metric; /* +1 for binary compatibility! */ + char *rt_dev; /* forcing the device at add */ + unsigned long rt_mtu; /* per route MTU/Window */ +#define rt_mss rt_mtu /* Compatibility :-( */ + unsigned long rt_window; /* Window clamping */ + unsigned short rt_irtt; /* Initial RTT */ +}; + + +#define RTF_UP 0x0001 /* route usable */ +#define RTF_GATEWAY 0x0002 /* destination is a gateway */ +#define RTF_HOST 0x0004 /* host entry (net otherwise) */ +#define RTF_REINSTATE 0x0008 /* reinstate route after tmout */ +#define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */ +#define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */ +#define RTF_MTU 0x0040 /* specific MTU for this route */ +#define RTF_MSS RTF_MTU /* Compatibility :-( */ +#define RTF_WINDOW 0x0080 /* per route window clamping */ +#define RTF_IRTT 0x0100 /* Initial round trip time */ +#define RTF_REJECT 0x0200 /* Reject route */ + +/* + * uses RTF values >= 64k + */ + + + +#endif /* _LINUX_ROUTE_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rtc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rtc.h new file mode 100644 index 0000000..4aae894 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rtc.h @@ -0,0 +1,101 @@ +/* + * Generic RTC interface. + * This version contains the part of the user interface to the Real Time Clock + * service. It is used with both the legacy mc146818 and also EFI + * Struct rtc_time and first 12 ioctl by Paul Gortmaker, 1996 - separated out + * from to this file for 2.4 kernels. + * + * Copyright (C) 1999 Hewlett-Packard Co. + * Copyright (C) 1999 Stephane Eranian + */ +#ifndef _LINUX_RTC_H_ +#define _LINUX_RTC_H_ + +/* + * The struct used to pass data via the following ioctl. Similar to the + * struct tm in , but it needs to be here so that the kernel + * source is self contained, allowing cross-compiles, etc. etc. + */ + +struct rtc_time { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +/* + * This data structure is inspired by the EFI (v0.92) wakeup + * alarm API. + */ +struct rtc_wkalrm { + unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */ + unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */ + struct rtc_time time; /* time the alarm is set to */ +}; + +/* + * Data structure to control PLL correction some better RTC feature + * pll_value is used to get or set current value of correction, + * the rest of the struct is used to query HW capabilities. + * This is modeled after the RTC used in Q40/Q60 computers but + * should be sufficiently flexible for other devices + * + * +ve pll_value means clock will run faster by + * pll_value*pll_posmult/pll_clock + * -ve pll_value means clock will run slower by + * pll_value*pll_negmult/pll_clock + */ + +struct rtc_pll_info { + int pll_ctrl; /* placeholder for fancier control */ + int pll_value; /* get/set correction value */ + int pll_max; /* max +ve (faster) adjustment value */ + int pll_min; /* max -ve (slower) adjustment value */ + int pll_posmult; /* factor for +ve correction */ + int pll_negmult; /* factor for -ve correction */ + long pll_clock; /* base PLL frequency */ +}; + +/* + * ioctl calls that are permitted to the /dev/rtc interface, if + * any of the RTC drivers are enabled. + */ + +#define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */ +#define RTC_AIE_OFF _IO('p', 0x02) /* ... off */ +#define RTC_UIE_ON _IO('p', 0x03) /* Update int. enable on */ +#define RTC_UIE_OFF _IO('p', 0x04) /* ... off */ +#define RTC_PIE_ON _IO('p', 0x05) /* Periodic int. enable on */ +#define RTC_PIE_OFF _IO('p', 0x06) /* ... off */ +#define RTC_WIE_ON _IO('p', 0x0f) /* Watchdog int. enable on */ +#define RTC_WIE_OFF _IO('p', 0x10) /* ... off */ + +#define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time) /* Set alarm time */ +#define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time) /* Read alarm time */ +#define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time) /* Read RTC time */ +#define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */ +#define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long) /* Read IRQ rate */ +#define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long) /* Set IRQ rate */ +#define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long) /* Read epoch */ +#define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long) /* Set epoch */ + +#define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/ +#define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/ + +#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ +#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ + +/* interrupt flags */ +#define RTC_IRQF 0x80 /* any of the following is active */ +#define RTC_PF 0x40 +#define RTC_AF 0x20 +#define RTC_UF 0x10 + + +#endif /* _LINUX_RTC_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rtnetlink.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rtnetlink.h new file mode 100644 index 0000000..63d1c69 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/rtnetlink.h @@ -0,0 +1,614 @@ +#ifndef __LINUX_RTNETLINK_H +#define __LINUX_RTNETLINK_H + +#include +#include +#include +#include +#include + +/**** + * Routing/neighbour discovery messages. + ****/ + +/* Types of messages */ + +enum { + RTM_BASE = 16, +#define RTM_BASE RTM_BASE + + RTM_NEWLINK = 16, +#define RTM_NEWLINK RTM_NEWLINK + RTM_DELLINK, +#define RTM_DELLINK RTM_DELLINK + RTM_GETLINK, +#define RTM_GETLINK RTM_GETLINK + RTM_SETLINK, +#define RTM_SETLINK RTM_SETLINK + + RTM_NEWADDR = 20, +#define RTM_NEWADDR RTM_NEWADDR + RTM_DELADDR, +#define RTM_DELADDR RTM_DELADDR + RTM_GETADDR, +#define RTM_GETADDR RTM_GETADDR + + RTM_NEWROUTE = 24, +#define RTM_NEWROUTE RTM_NEWROUTE + RTM_DELROUTE, +#define RTM_DELROUTE RTM_DELROUTE + RTM_GETROUTE, +#define RTM_GETROUTE RTM_GETROUTE + + RTM_NEWNEIGH = 28, +#define RTM_NEWNEIGH RTM_NEWNEIGH + RTM_DELNEIGH, +#define RTM_DELNEIGH RTM_DELNEIGH + RTM_GETNEIGH, +#define RTM_GETNEIGH RTM_GETNEIGH + + RTM_NEWRULE = 32, +#define RTM_NEWRULE RTM_NEWRULE + RTM_DELRULE, +#define RTM_DELRULE RTM_DELRULE + RTM_GETRULE, +#define RTM_GETRULE RTM_GETRULE + + RTM_NEWQDISC = 36, +#define RTM_NEWQDISC RTM_NEWQDISC + RTM_DELQDISC, +#define RTM_DELQDISC RTM_DELQDISC + RTM_GETQDISC, +#define RTM_GETQDISC RTM_GETQDISC + + RTM_NEWTCLASS = 40, +#define RTM_NEWTCLASS RTM_NEWTCLASS + RTM_DELTCLASS, +#define RTM_DELTCLASS RTM_DELTCLASS + RTM_GETTCLASS, +#define RTM_GETTCLASS RTM_GETTCLASS + + RTM_NEWTFILTER = 44, +#define RTM_NEWTFILTER RTM_NEWTFILTER + RTM_DELTFILTER, +#define RTM_DELTFILTER RTM_DELTFILTER + RTM_GETTFILTER, +#define RTM_GETTFILTER RTM_GETTFILTER + + RTM_NEWACTION = 48, +#define RTM_NEWACTION RTM_NEWACTION + RTM_DELACTION, +#define RTM_DELACTION RTM_DELACTION + RTM_GETACTION, +#define RTM_GETACTION RTM_GETACTION + + RTM_NEWPREFIX = 52, +#define RTM_NEWPREFIX RTM_NEWPREFIX + + RTM_GETMULTICAST = 58, +#define RTM_GETMULTICAST RTM_GETMULTICAST + + RTM_GETANYCAST = 62, +#define RTM_GETANYCAST RTM_GETANYCAST + + RTM_NEWNEIGHTBL = 64, +#define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL + RTM_GETNEIGHTBL = 66, +#define RTM_GETNEIGHTBL RTM_GETNEIGHTBL + RTM_SETNEIGHTBL, +#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL + + RTM_NEWNDUSEROPT = 68, +#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT + + RTM_NEWADDRLABEL = 72, +#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL + RTM_DELADDRLABEL, +#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL + RTM_GETADDRLABEL, +#define RTM_GETADDRLABEL RTM_GETADDRLABEL + + RTM_GETDCB = 78, +#define RTM_GETDCB RTM_GETDCB + RTM_SETDCB, +#define RTM_SETDCB RTM_SETDCB + + __RTM_MAX, +#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) +}; + +#define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE) +#define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2) +#define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2) + +/* + Generic structure for encapsulation of optional route information. + It is reminiscent of sockaddr, but with sa_family replaced + with attribute type. + */ + +struct rtattr +{ + unsigned short rta_len; + unsigned short rta_type; +}; + +/* Macros to handle rtattributes */ + +#define RTA_ALIGNTO 4 +#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) +#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ + (rta)->rta_len >= sizeof(struct rtattr) && \ + (rta)->rta_len <= (len)) +#define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ + (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) +#define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) +#define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) +#define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) +#define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) + + + + +/****************************************************************************** + * Definitions used in routing table administration. + ****/ + +struct rtmsg +{ + unsigned char rtm_family; + unsigned char rtm_dst_len; + unsigned char rtm_src_len; + unsigned char rtm_tos; + + unsigned char rtm_table; /* Routing table id */ + unsigned char rtm_protocol; /* Routing protocol; see below */ + unsigned char rtm_scope; /* See below */ + unsigned char rtm_type; /* See below */ + + unsigned rtm_flags; +}; + +/* rtm_type */ + +enum +{ + RTN_UNSPEC, + RTN_UNICAST, /* Gateway or direct route */ + RTN_LOCAL, /* Accept locally */ + RTN_BROADCAST, /* Accept locally as broadcast, + send as broadcast */ + RTN_ANYCAST, /* Accept locally as broadcast, + but send as unicast */ + RTN_MULTICAST, /* Multicast route */ + RTN_BLACKHOLE, /* Drop */ + RTN_UNREACHABLE, /* Destination is unreachable */ + RTN_PROHIBIT, /* Administratively prohibited */ + RTN_THROW, /* Not in this table */ + RTN_NAT, /* Translate this address */ + RTN_XRESOLVE, /* Use external resolver */ + __RTN_MAX +}; + +#define RTN_MAX (__RTN_MAX - 1) + + +/* rtm_protocol */ + +#define RTPROT_UNSPEC 0 +#define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects; + not used by current IPv4 */ +#define RTPROT_KERNEL 2 /* Route installed by kernel */ +#define RTPROT_BOOT 3 /* Route installed during boot */ +#define RTPROT_STATIC 4 /* Route installed by administrator */ + +/* Values of protocol >= RTPROT_STATIC are not interpreted by kernel; + they are just passed from user and back as is. + It will be used by hypothetical multiple routing daemons. + Note that protocol values should be standardized in order to + avoid conflicts. + */ + +#define RTPROT_GATED 8 /* Apparently, GateD */ +#define RTPROT_RA 9 /* RDISC/ND router advertisements */ +#define RTPROT_MRT 10 /* Merit MRT */ +#define RTPROT_ZEBRA 11 /* Zebra */ +#define RTPROT_BIRD 12 /* BIRD */ +#define RTPROT_DNROUTED 13 /* DECnet routing daemon */ +#define RTPROT_XORP 14 /* XORP */ +#define RTPROT_NTK 15 /* Netsukuku */ +#define RTPROT_DHCP 16 /* DHCP client */ + +/* rtm_scope + + Really it is not scope, but sort of distance to the destination. + NOWHERE are reserved for not existing destinations, HOST is our + local addresses, LINK are destinations, located on directly attached + link and UNIVERSE is everywhere in the Universe. + + Intermediate values are also possible f.e. interior routes + could be assigned a value between UNIVERSE and LINK. +*/ + +enum rt_scope_t +{ + RT_SCOPE_UNIVERSE=0, +/* User defined values */ + RT_SCOPE_SITE=200, + RT_SCOPE_LINK=253, + RT_SCOPE_HOST=254, + RT_SCOPE_NOWHERE=255 +}; + +/* rtm_flags */ + +#define RTM_F_NOTIFY 0x100 /* Notify user of route change */ +#define RTM_F_CLONED 0x200 /* This route is cloned */ +#define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */ +#define RTM_F_PREFIX 0x800 /* Prefix addresses */ + +/* Reserved table identifiers */ + +enum rt_class_t +{ + RT_TABLE_UNSPEC=0, +/* User defined values */ + RT_TABLE_COMPAT=252, + RT_TABLE_DEFAULT=253, + RT_TABLE_MAIN=254, + RT_TABLE_LOCAL=255, + RT_TABLE_MAX=0xFFFFFFFF +}; + + +/* Routing message attributes */ + +enum rtattr_type_t +{ + RTA_UNSPEC, + RTA_DST, + RTA_SRC, + RTA_IIF, + RTA_OIF, + RTA_GATEWAY, + RTA_PRIORITY, + RTA_PREFSRC, + RTA_METRICS, + RTA_MULTIPATH, + RTA_PROTOINFO, /* no longer used */ + RTA_FLOW, + RTA_CACHEINFO, + RTA_SESSION, /* no longer used */ + RTA_MP_ALGO, /* no longer used */ + RTA_TABLE, + __RTA_MAX +}; + +#define RTA_MAX (__RTA_MAX - 1) + +#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) +#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) + +/* RTM_MULTIPATH --- array of struct rtnexthop. + * + * "struct rtnexthop" describes all necessary nexthop information, + * i.e. parameters of path to a destination via this nexthop. + * + * At the moment it is impossible to set different prefsrc, mtu, window + * and rtt for different paths from multipath. + */ + +struct rtnexthop +{ + unsigned short rtnh_len; + unsigned char rtnh_flags; + unsigned char rtnh_hops; + int rtnh_ifindex; +}; + +/* rtnh_flags */ + +#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ +#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ +#define RTNH_F_ONLINK 4 /* Gateway is forced on link */ + +/* Macros to handle hexthops */ + +#define RTNH_ALIGNTO 4 +#define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) +#define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ + ((int)(rtnh)->rtnh_len) <= (len)) +#define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) +#define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) +#define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) +#define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) + +/* RTM_CACHEINFO */ + +struct rta_cacheinfo +{ + __u32 rta_clntref; + __u32 rta_lastuse; + __s32 rta_expires; + __u32 rta_error; + __u32 rta_used; + +#define RTNETLINK_HAVE_PEERINFO 1 + __u32 rta_id; + __u32 rta_ts; + __u32 rta_tsage; +}; + +/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ + +enum +{ + RTAX_UNSPEC, +#define RTAX_UNSPEC RTAX_UNSPEC + RTAX_LOCK, +#define RTAX_LOCK RTAX_LOCK + RTAX_MTU, +#define RTAX_MTU RTAX_MTU + RTAX_WINDOW, +#define RTAX_WINDOW RTAX_WINDOW + RTAX_RTT, +#define RTAX_RTT RTAX_RTT + RTAX_RTTVAR, +#define RTAX_RTTVAR RTAX_RTTVAR + RTAX_SSTHRESH, +#define RTAX_SSTHRESH RTAX_SSTHRESH + RTAX_CWND, +#define RTAX_CWND RTAX_CWND + RTAX_ADVMSS, +#define RTAX_ADVMSS RTAX_ADVMSS + RTAX_REORDERING, +#define RTAX_REORDERING RTAX_REORDERING + RTAX_HOPLIMIT, +#define RTAX_HOPLIMIT RTAX_HOPLIMIT + RTAX_INITCWND, +#define RTAX_INITCWND RTAX_INITCWND + RTAX_FEATURES, +#define RTAX_FEATURES RTAX_FEATURES + RTAX_RTO_MIN, +#define RTAX_RTO_MIN RTAX_RTO_MIN + __RTAX_MAX +}; + +#define RTAX_MAX (__RTAX_MAX - 1) + +#define RTAX_FEATURE_ECN 0x00000001 +#define RTAX_FEATURE_SACK 0x00000002 +#define RTAX_FEATURE_TIMESTAMP 0x00000004 +#define RTAX_FEATURE_ALLFRAG 0x00000008 + +struct rta_session +{ + __u8 proto; + __u8 pad1; + __u16 pad2; + + union { + struct { + __u16 sport; + __u16 dport; + } ports; + + struct { + __u8 type; + __u8 code; + __u16 ident; + } icmpt; + + __u32 spi; + } u; +}; + +/**** + * General form of address family dependent message. + ****/ + +struct rtgenmsg +{ + unsigned char rtgen_family; +}; + +/***************************************************************** + * Link layer specific messages. + ****/ + +/* struct ifinfomsg + * passes link level specific information, not dependent + * on network protocol. + */ + +struct ifinfomsg +{ + unsigned char ifi_family; + unsigned char __ifi_pad; + unsigned short ifi_type; /* ARPHRD_* */ + int ifi_index; /* Link index */ + unsigned ifi_flags; /* IFF_* flags */ + unsigned ifi_change; /* IFF_* change mask */ +}; + +/******************************************************************** + * prefix information + ****/ + +struct prefixmsg +{ + unsigned char prefix_family; + unsigned char prefix_pad1; + unsigned short prefix_pad2; + int prefix_ifindex; + unsigned char prefix_type; + unsigned char prefix_len; + unsigned char prefix_flags; + unsigned char prefix_pad3; +}; + +enum +{ + PREFIX_UNSPEC, + PREFIX_ADDRESS, + PREFIX_CACHEINFO, + __PREFIX_MAX +}; + +#define PREFIX_MAX (__PREFIX_MAX - 1) + +struct prefix_cacheinfo +{ + __u32 preferred_time; + __u32 valid_time; +}; + + +/***************************************************************** + * Traffic control messages. + ****/ + +struct tcmsg +{ + unsigned char tcm_family; + unsigned char tcm__pad1; + unsigned short tcm__pad2; + int tcm_ifindex; + __u32 tcm_handle; + __u32 tcm_parent; + __u32 tcm_info; +}; + +enum +{ + TCA_UNSPEC, + TCA_KIND, + TCA_OPTIONS, + TCA_STATS, + TCA_XSTATS, + TCA_RATE, + TCA_FCNT, + TCA_STATS2, + TCA_STAB, + __TCA_MAX +}; + +#define TCA_MAX (__TCA_MAX - 1) + +#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) +#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) + +/******************************************************************** + * Neighbor Discovery userland options + ****/ + +struct nduseroptmsg +{ + unsigned char nduseropt_family; + unsigned char nduseropt_pad1; + unsigned short nduseropt_opts_len; /* Total length of options */ + int nduseropt_ifindex; + __u8 nduseropt_icmp_type; + __u8 nduseropt_icmp_code; + unsigned short nduseropt_pad2; + unsigned int nduseropt_pad3; + /* Followed by one or more ND options */ +}; + +enum +{ + NDUSEROPT_UNSPEC, + NDUSEROPT_SRCADDR, + __NDUSEROPT_MAX +}; + +#define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1) + +/* RTnetlink multicast groups - backwards compatibility for userspace */ +#define RTMGRP_LINK 1 +#define RTMGRP_NOTIFY 2 +#define RTMGRP_NEIGH 4 +#define RTMGRP_TC 8 + +#define RTMGRP_IPV4_IFADDR 0x10 +#define RTMGRP_IPV4_MROUTE 0x20 +#define RTMGRP_IPV4_ROUTE 0x40 +#define RTMGRP_IPV4_RULE 0x80 + +#define RTMGRP_IPV6_IFADDR 0x100 +#define RTMGRP_IPV6_MROUTE 0x200 +#define RTMGRP_IPV6_ROUTE 0x400 +#define RTMGRP_IPV6_IFINFO 0x800 + +#define RTMGRP_DECnet_IFADDR 0x1000 +#define RTMGRP_DECnet_ROUTE 0x4000 + +#define RTMGRP_IPV6_PREFIX 0x20000 + +/* RTnetlink multicast groups */ +enum rtnetlink_groups { + RTNLGRP_NONE, +#define RTNLGRP_NONE RTNLGRP_NONE + RTNLGRP_LINK, +#define RTNLGRP_LINK RTNLGRP_LINK + RTNLGRP_NOTIFY, +#define RTNLGRP_NOTIFY RTNLGRP_NOTIFY + RTNLGRP_NEIGH, +#define RTNLGRP_NEIGH RTNLGRP_NEIGH + RTNLGRP_TC, +#define RTNLGRP_TC RTNLGRP_TC + RTNLGRP_IPV4_IFADDR, +#define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR + RTNLGRP_IPV4_MROUTE, +#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE + RTNLGRP_IPV4_ROUTE, +#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE + RTNLGRP_IPV4_RULE, +#define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE + RTNLGRP_IPV6_IFADDR, +#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR + RTNLGRP_IPV6_MROUTE, +#define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE + RTNLGRP_IPV6_ROUTE, +#define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE + RTNLGRP_IPV6_IFINFO, +#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO + RTNLGRP_DECnet_IFADDR, +#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR + RTNLGRP_NOP2, + RTNLGRP_DECnet_ROUTE, +#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE + RTNLGRP_DECnet_RULE, +#define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE + RTNLGRP_NOP4, + RTNLGRP_IPV6_PREFIX, +#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX + RTNLGRP_IPV6_RULE, +#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE + RTNLGRP_ND_USEROPT, +#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT + RTNLGRP_PHONET_IFADDR, +#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR + RTNLGRP_PHONET_ROUTE, +#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE + __RTNLGRP_MAX +}; +#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) + +/* TC action piece */ +struct tcamsg +{ + unsigned char tca_family; + unsigned char tca__pad1; + unsigned short tca__pad2; +}; +#define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) +#define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) +#define TCA_ACT_TAB 1 /* attr type must be >=1 */ +#define TCAA_MAX 1 + +/* End of information exported to user level */ + + + +#endif /* __LINUX_RTNETLINK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/scc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/scc.h new file mode 100644 index 0000000..167cc03 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/scc.h @@ -0,0 +1,172 @@ +/* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */ + +#ifndef _SCC_H +#define _SCC_H + + +/* selection of hardware types */ + +#define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */ +#define EAGLE 0x01 /* hardware type for EAGLE card */ +#define PC100 0x02 /* hardware type for PC100 card */ +#define PRIMUS 0x04 /* hardware type for PRIMUS-PC (DG9BL) card */ +#define DRSI 0x08 /* hardware type for DRSI PC*Packet card */ +#define BAYCOM 0x10 /* hardware type for BayCom (U)SCC */ + +/* DEV ioctl() commands */ + +enum SCC_ioctl_cmds { + SIOCSCCRESERVED = SIOCDEVPRIVATE, + SIOCSCCCFG, + SIOCSCCINI, + SIOCSCCCHANINI, + SIOCSCCSMEM, + SIOCSCCGKISS, + SIOCSCCSKISS, + SIOCSCCGSTAT, + SIOCSCCCAL +}; + +/* Device parameter control (from WAMPES) */ + +enum L1_params { + PARAM_DATA, + PARAM_TXDELAY, + PARAM_PERSIST, + PARAM_SLOTTIME, + PARAM_TXTAIL, + PARAM_FULLDUP, + PARAM_SOFTDCD, /* was: PARAM_HW */ + PARAM_MUTE, /* ??? */ + PARAM_DTR, + PARAM_RTS, + PARAM_SPEED, + PARAM_ENDDELAY, /* ??? */ + PARAM_GROUP, + PARAM_IDLE, + PARAM_MIN, + PARAM_MAXKEY, + PARAM_WAIT, + PARAM_MAXDEFER, + PARAM_TX, + PARAM_HWEVENT = 31, + PARAM_RETURN = 255 /* reset kiss mode */ +}; + +/* fulldup parameter */ + +enum FULLDUP_modes { + KISS_DUPLEX_HALF, /* normal CSMA operation */ + KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */ + KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */ + KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */ +}; + +/* misc. parameters */ + +#define TIMER_OFF 65535U /* to switch off timers */ +#define NO_SUCH_PARAM 65534U /* param not implemented */ + +/* HWEVENT parameter */ + +enum HWEVENT_opts { + HWEV_DCD_ON, + HWEV_DCD_OFF, + HWEV_ALL_SENT +}; + +/* channel grouping */ + +#define RXGROUP 0100 /* if set, only tx when all channels clear */ +#define TXGROUP 0200 /* if set, don't transmit simultaneously */ + +/* Tx/Rx clock sources */ + +enum CLOCK_sources { + CLK_DPLL, /* normal halfduplex operation */ + CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */ + CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */ + /* modems without clock regeneration */ + CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */ + /* MODEMs without clock recovery */ +}; + +/* Tx state */ + +enum TX_state { + TXS_IDLE, /* Transmitter off, no data pending */ + TXS_BUSY, /* waiting for permission to send / tailtime */ + TXS_ACTIVE, /* Transmitter on, sending data */ + TXS_NEWFRAME, /* reset CRC and send (next) frame */ + TXS_IDLE2, /* Transmitter on, no data pending */ + TXS_WAIT, /* Waiting for Mintime to expire */ + TXS_TIMEOUT /* We had a transmission timeout */ +}; + +typedef unsigned long io_port; /* type definition for an 'io port address' */ + +/* SCC statistical information */ + +struct scc_stat { + long rxints; /* Receiver interrupts */ + long txints; /* Transmitter interrupts */ + long exints; /* External/status interrupts */ + long spints; /* Special receiver interrupts */ + + long txframes; /* Packets sent */ + long rxframes; /* Number of Frames Actually Received */ + long rxerrs; /* CRC Errors */ + long txerrs; /* KISS errors */ + + unsigned int nospace; /* "Out of buffers" */ + unsigned int rx_over; /* Receiver Overruns */ + unsigned int tx_under; /* Transmitter Underruns */ + + unsigned int tx_state; /* Transmitter state */ + int tx_queued; /* tx frames enqueued */ + + unsigned int maxqueue; /* allocated tx_buffers */ + unsigned int bufsize; /* used buffersize */ +}; + +struct scc_modem { + long speed; /* Line speed, bps */ + char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */ + char nrz; /* NRZ instead of NRZI */ +}; + +struct scc_kiss_cmd { + int command; /* one of the KISS-Commands defined above */ + unsigned param; /* KISS-Param */ +}; + +struct scc_hw_config { + io_port data_a; /* data port channel A */ + io_port ctrl_a; /* control port channel A */ + io_port data_b; /* data port channel B */ + io_port ctrl_b; /* control port channel B */ + io_port vector_latch; /* INTACK-Latch (#) */ + io_port special; /* special function port */ + + int irq; /* irq */ + long clock; /* clock */ + char option; /* command for function port */ + + char brand; /* hardware type */ + char escc; /* use ext. features of a 8580/85180/85280 */ +}; + +/* (#) only one INTACK latch allowed. */ + + +struct scc_mem_config { + unsigned int dummy; + unsigned int bufsize; +}; + +struct scc_calibrate { + unsigned int time; + unsigned char pattern; +}; + +#endif /* defined(_SCC_H) */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sched.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sched.h new file mode 100644 index 0000000..95ec7c2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sched.h @@ -0,0 +1,43 @@ +#ifndef _LINUX_SCHED_H +#define _LINUX_SCHED_H + +/* + * cloning flags: + */ +#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ +#define CLONE_VM 0x00000100 /* set if VM shared between processes */ +#define CLONE_FS 0x00000200 /* set if fs info shared between processes */ +#define CLONE_FILES 0x00000400 /* set if open files shared between processes */ +#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ +#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ +#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ +#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ +#define CLONE_THREAD 0x00010000 /* Same thread group? */ +#define CLONE_NEWNS 0x00020000 /* New namespace group? */ +#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ +#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ +#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ +#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ +#define CLONE_DETACHED 0x00400000 /* Unused, ignored */ +#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ +#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ +#define CLONE_STOPPED 0x02000000 /* Start in stopped state */ +#define CLONE_NEWUTS 0x04000000 /* New utsname group? */ +#define CLONE_NEWIPC 0x08000000 /* New ipcs */ +#define CLONE_NEWUSER 0x10000000 /* New user namespace */ +#define CLONE_NEWPID 0x20000000 /* New pid namespace */ +#define CLONE_NEWNET 0x40000000 /* New network namespace */ +#define CLONE_IO 0x80000000 /* Clone io context */ + +/* + * Scheduling policies + */ +#define SCHED_NORMAL 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 +#define SCHED_BATCH 3 +/* SCHED_ISO: reserved but not implemented yet */ +#define SCHED_IDLE 5 + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/screen_info.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/screen_info.h new file mode 100644 index 0000000..4885982 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/screen_info.h @@ -0,0 +1,69 @@ +#ifndef _SCREEN_INFO_H +#define _SCREEN_INFO_H + +#include + +/* + * These are set up by the setup-routine at boot-time: + */ + +struct screen_info { + __u8 orig_x; /* 0x00 */ + __u8 orig_y; /* 0x01 */ + __u16 ext_mem_k; /* 0x02 */ + __u16 orig_video_page; /* 0x04 */ + __u8 orig_video_mode; /* 0x06 */ + __u8 orig_video_cols; /* 0x07 */ + __u16 unused2; /* 0x08 */ + __u16 orig_video_ega_bx;/* 0x0a */ + __u16 unused3; /* 0x0c */ + __u8 orig_video_lines; /* 0x0e */ + __u8 orig_video_isVGA; /* 0x0f */ + __u16 orig_video_points;/* 0x10 */ + + /* VESA graphic mode -- linear frame buffer */ + __u16 lfb_width; /* 0x12 */ + __u16 lfb_height; /* 0x14 */ + __u16 lfb_depth; /* 0x16 */ + __u32 lfb_base; /* 0x18 */ + __u32 lfb_size; /* 0x1c */ + __u16 cl_magic, cl_offset; /* 0x20 */ + __u16 lfb_linelength; /* 0x24 */ + __u8 red_size; /* 0x26 */ + __u8 red_pos; /* 0x27 */ + __u8 green_size; /* 0x28 */ + __u8 green_pos; /* 0x29 */ + __u8 blue_size; /* 0x2a */ + __u8 blue_pos; /* 0x2b */ + __u8 rsvd_size; /* 0x2c */ + __u8 rsvd_pos; /* 0x2d */ + __u16 vesapm_seg; /* 0x2e */ + __u16 vesapm_off; /* 0x30 */ + __u16 pages; /* 0x32 */ + __u16 vesa_attributes; /* 0x34 */ + __u32 capabilities; /* 0x36 */ + __u8 _reserved[6]; /* 0x3a */ +} __attribute__((packed)); + +#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */ +#define VIDEO_TYPE_CGA 0x11 /* CGA Display */ +#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */ +#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */ +#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */ +#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */ + +#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */ +#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */ +#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */ + +#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */ + +#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */ +#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */ + +#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ + +#define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ + + +#endif /* _SCREEN_INFO_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sdla.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sdla.h new file mode 100644 index 0000000..303b4fa --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sdla.h @@ -0,0 +1,119 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the Frame relay interface. + * + * Version: @(#)if_ifrad.h 0.20 13 Apr 96 + * + * Author: Mike McLagan + * + * Changes: + * 0.15 Mike McLagan Structure packing + * + * 0.20 Mike McLagan New flags for S508 buffer handling + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef SDLA_H +#define SDLA_H + +/* adapter type */ +#define SDLA_TYPES +#define SDLA_S502A 5020 +#define SDLA_S502E 5021 +#define SDLA_S503 5030 +#define SDLA_S507 5070 +#define SDLA_S508 5080 +#define SDLA_S509 5090 +#define SDLA_UNKNOWN -1 + +/* port selection flags for the S508 */ +#define SDLA_S508_PORT_V35 0x00 +#define SDLA_S508_PORT_RS232 0x02 + +/* Z80 CPU speeds */ +#define SDLA_CPU_3M 0x00 +#define SDLA_CPU_5M 0x01 +#define SDLA_CPU_7M 0x02 +#define SDLA_CPU_8M 0x03 +#define SDLA_CPU_10M 0x04 +#define SDLA_CPU_16M 0x05 +#define SDLA_CPU_12M 0x06 + +/* some private IOCTLs */ +#define SDLA_IDENTIFY (FRAD_LAST_IOCTL + 1) +#define SDLA_CPUSPEED (FRAD_LAST_IOCTL + 2) +#define SDLA_PROTOCOL (FRAD_LAST_IOCTL + 3) + +#define SDLA_CLEARMEM (FRAD_LAST_IOCTL + 4) +#define SDLA_WRITEMEM (FRAD_LAST_IOCTL + 5) +#define SDLA_READMEM (FRAD_LAST_IOCTL + 6) + +struct sdla_mem { + int addr; + int len; + void *data; +}; + +#define SDLA_START (FRAD_LAST_IOCTL + 7) +#define SDLA_STOP (FRAD_LAST_IOCTL + 8) + +/* some offsets in the Z80's memory space */ +#define SDLA_NMIADDR 0x0000 +#define SDLA_CONF_ADDR 0x0010 +#define SDLA_S502A_NMIADDR 0x0066 +#define SDLA_CODE_BASEADDR 0x0100 +#define SDLA_WINDOW_SIZE 0x2000 +#define SDLA_ADDR_MASK 0x1FFF + +/* largest handleable block of data */ +#define SDLA_MAX_DATA 4080 +#define SDLA_MAX_MTU 4072 /* MAX_DATA - sizeof(fradhdr) */ +#define SDLA_MAX_DLCI 24 + +/* this should be the same as frad_conf */ +struct sdla_conf { + short station; + short config; + short kbaud; + short clocking; + short max_frm; + short T391; + short T392; + short N391; + short N392; + short N393; + short CIR_fwd; + short Bc_fwd; + short Be_fwd; + short CIR_bwd; + short Bc_bwd; + short Be_bwd; +}; + +/* this should be the same as dlci_conf */ +struct sdla_dlci_conf { + short config; + short CIR_fwd; + short Bc_fwd; + short Be_fwd; + short CIR_bwd; + short Bc_bwd; + short Be_bwd; + short Tc_fwd; + short Tc_bwd; + short Tf_max; + short Tb_max; +}; + + +void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet); + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/selinux_netlink.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/selinux_netlink.h new file mode 100644 index 0000000..7a9bf6a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/selinux_netlink.h @@ -0,0 +1,48 @@ +/* + * Netlink event notifications for SELinux. + * + * Author: James Morris + * + * Copyright (C) 2004 Red Hat, Inc., James Morris + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + */ +#ifndef _LINUX_SELINUX_NETLINK_H +#define _LINUX_SELINUX_NETLINK_H + +#include + +/* Message types. */ +#define SELNL_MSG_BASE 0x10 +enum { + SELNL_MSG_SETENFORCE = SELNL_MSG_BASE, + SELNL_MSG_POLICYLOAD, + SELNL_MSG_MAX +}; + +/* Multicast groups - backwards compatiblility for userspace */ +#define SELNL_GRP_NONE 0x00000000 +#define SELNL_GRP_AVC 0x00000001 /* AVC notifications */ +#define SELNL_GRP_ALL 0xffffffff + +enum selinux_nlgroups { + SELNLGRP_NONE, +#define SELNLGRP_NONE SELNLGRP_NONE + SELNLGRP_AVC, +#define SELNLGRP_AVC SELNLGRP_AVC + __SELNLGRP_MAX +}; +#define SELNLGRP_MAX (__SELNLGRP_MAX - 1) + +/* Message structures */ +struct selnl_msg_setenforce { + __s32 val; +}; + +struct selnl_msg_policyload { + __u32 seqno; +}; + +#endif /* _LINUX_SELINUX_NETLINK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sem.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sem.h new file mode 100644 index 0000000..9f1974c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sem.h @@ -0,0 +1,80 @@ +#ifndef _LINUX_SEM_H +#define _LINUX_SEM_H + +#include + +/* semop flags */ +#define SEM_UNDO 0x1000 /* undo the operation on exit */ + +/* semctl Command Definitions. */ +#define GETPID 11 /* get sempid */ +#define GETVAL 12 /* get semval */ +#define GETALL 13 /* get all semval's */ +#define GETNCNT 14 /* get semncnt */ +#define GETZCNT 15 /* get semzcnt */ +#define SETVAL 16 /* set semval */ +#define SETALL 17 /* set all semval's */ + +/* ipcs ctl cmds */ +#define SEM_STAT 18 +#define SEM_INFO 19 + +/* Obsolete, used only for backwards compatibility and libc5 compiles */ +struct semid_ds { + struct ipc_perm sem_perm; /* permissions .. see ipc.h */ + __kernel_time_t sem_otime; /* last semop time */ + __kernel_time_t sem_ctime; /* last change time */ + struct sem *sem_base; /* ptr to first semaphore in array */ + struct sem_queue *sem_pending; /* pending operations to be processed */ + struct sem_queue **sem_pending_last; /* last pending operation */ + struct sem_undo *undo; /* undo requests on this array */ + unsigned short sem_nsems; /* no. of semaphores in array */ +}; + +/* Include the definition of semid64_ds */ +#include + +/* semop system calls takes an array of these. */ +struct sembuf { + unsigned short sem_num; /* semaphore index in array */ + short sem_op; /* semaphore operation */ + short sem_flg; /* operation flags */ +}; + +/* arg for semctl system calls. */ +union semun { + int val; /* value for SETVAL */ + struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ + unsigned short *array; /* array for GETALL & SETALL */ + struct seminfo *__buf; /* buffer for IPC_INFO */ + void *__pad; +}; + +struct seminfo { + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; +}; + +#define SEMMNI 128 /* <= IPCMNI max # of semaphore identifiers */ +#define SEMMSL 250 /* <= 8 000 max num of semaphores per id */ +#define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */ +#define SEMOPM 32 /* <= 1 000 max num of ops per semop call */ +#define SEMVMX 32767 /* <= 32767 semaphore maximum value */ +#define SEMAEM SEMVMX /* adjust on exit max value */ + +/* unused */ +#define SEMUME SEMOPM /* max num of undo entries per process */ +#define SEMMNU SEMMNS /* num of undo structures system wide */ +#define SEMMAP SEMMNS /* # of entries in semaphore map */ +#define SEMUSZ 20 /* sizeof struct sem_undo */ + + +#endif /* _LINUX_SEM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial.h new file mode 100644 index 0000000..a9a9ac4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial.h @@ -0,0 +1,175 @@ +/* + * include/linux/serial.h + * + * Copyright (C) 1992 by Theodore Ts'o. + * + * Redistribution of this file is permitted under the terms of the GNU + * Public License (GPL) + */ + +#ifndef _LINUX_SERIAL_H +#define _LINUX_SERIAL_H + +#include + + +struct serial_struct { + int type; + int line; + unsigned int port; + int irq; + int flags; + int xmit_fifo_size; + int custom_divisor; + int baud_base; + unsigned short close_delay; + char io_type; + char reserved_char[1]; + int hub6; + unsigned short closing_wait; /* time to wait before closing */ + unsigned short closing_wait2; /* no longer used... */ + unsigned char *iomem_base; + unsigned short iomem_reg_shift; + unsigned int port_high; + unsigned long iomap_base; /* cookie passed into ioremap */ +}; + +/* + * For the close wait times, 0 means wait forever for serial port to + * flush its output. 65535 means don't wait at all. + */ +#define ASYNC_CLOSING_WAIT_INF 0 +#define ASYNC_CLOSING_WAIT_NONE 65535 + +/* + * These are the supported serial types. + */ +#define PORT_UNKNOWN 0 +#define PORT_8250 1 +#define PORT_16450 2 +#define PORT_16550 3 +#define PORT_16550A 4 +#define PORT_CIRRUS 5 /* usurped by cyclades.c */ +#define PORT_16650 6 +#define PORT_16650V2 7 +#define PORT_16750 8 +#define PORT_STARTECH 9 /* usurped by cyclades.c */ +#define PORT_16C950 10 /* Oxford Semiconductor */ +#define PORT_16654 11 +#define PORT_16850 12 +#define PORT_RSA 13 /* RSA-DV II/S card */ +#define PORT_MAX 13 + +#define SERIAL_IO_PORT 0 +#define SERIAL_IO_HUB6 1 +#define SERIAL_IO_MEM 2 + +struct serial_uart_config { + char *name; + int dfl_xmit_fifo_size; + int flags; +}; + +#define UART_CLEAR_FIFO 0x01 +#define UART_USE_FIFO 0x02 +#define UART_STARTECH 0x04 +#define UART_NATSEMI 0x08 + +/* + * Definitions for async_struct (and serial_struct) flags field + */ +#define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes + on the callout port */ +#define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */ +#define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ +#define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ + +#define ASYNC_SPD_MASK 0x1030 +#define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ + +#define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ +#define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */ + +#define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ +#define ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ +#define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ +#define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ +#define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ + +#define ASYNC_HARDPPS_CD 0x0800 /* Call hardpps when CD goes high */ + +#define ASYNC_SPD_SHI 0x1000 /* Use 230400 instead of 38400 bps */ +#define ASYNC_SPD_WARP 0x1010 /* Use 460800 instead of 38400 bps */ + +#define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */ + +#define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety + * checks. Note: can be dangerous! */ + +#define ASYNC_AUTOPROBE 0x8000 /* Port was autoprobed by PCI or PNP code */ + +#define ASYNC_FLAGS 0x7FFF /* Possible legal async flags */ +#define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged + * users can set or reset */ + +/* Internal flags used only by kernel/chr_drv/serial.c */ +#define ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */ +#define ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ +#define ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ +#define ASYNC_CLOSING 0x08000000 /* Serial port is closing */ +#define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ +#define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ +#define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards + --- no longer used */ +#define ASYNC_CONS_FLOW 0x00800000 /* flow control for console */ + +#define ASYNC_BOOT_ONLYMCA 0x00400000 /* Probe only if MCA bus */ +#define ASYNC_INTERNAL_FLAGS 0xFFC00000 /* Internal flags */ + +/* + * Multiport serial configuration structure --- external structure + */ +struct serial_multiport_struct { + int irq; + int port1; + unsigned char mask1, match1; + int port2; + unsigned char mask2, match2; + int port3; + unsigned char mask3, match3; + int port4; + unsigned char mask4, match4; + int port_monitor; + int reserved[32]; +}; + +/* + * Serial input interrupt line counters -- external structure + * Four lines can interrupt: CTS, DSR, RI, DCD + */ +struct serial_icounter_struct { + int cts, dsr, rng, dcd; + int rx, tx; + int frame, overrun, parity, brk; + int buf_overrun; + int reserved[9]; +}; + +/* + * Serial interface for controlling RS485 settings on chips with suitable + * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your + * platform. The set function returns the new state, with any unsupported bits + * reverted appropriately. + */ + +struct serial_rs485 { + __u32 flags; /* RS485 feature flags */ +#define SER_RS485_ENABLED (1 << 0) +#define SER_RS485_RTS_ON_SEND (1 << 1) +#define SER_RS485_RTS_AFTER_SEND (1 << 2) + __u32 delay_rts_before_send; /* Milliseconds */ + __u32 padding[6]; /* Memory is cheap, new structs + are a royal PITA .. */ +}; + +#endif /* _LINUX_SERIAL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial_core.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial_core.h new file mode 100644 index 0000000..b46cc41 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial_core.h @@ -0,0 +1,171 @@ +/* + * linux/drivers/char/serial_core.h + * + * Copyright (C) 2000 Deep Blue Solutions Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef LINUX_SERIAL_CORE_H +#define LINUX_SERIAL_CORE_H + +/* + * The type definitions. These are from Ted Ts'o's serial.h + */ +#define PORT_UNKNOWN 0 +#define PORT_8250 1 +#define PORT_16450 2 +#define PORT_16550 3 +#define PORT_16550A 4 +#define PORT_CIRRUS 5 +#define PORT_16650 6 +#define PORT_16650V2 7 +#define PORT_16750 8 +#define PORT_STARTECH 9 +#define PORT_16C950 10 +#define PORT_16654 11 +#define PORT_16850 12 +#define PORT_RSA 13 +#define PORT_NS16550A 14 +#define PORT_XSCALE 15 +#define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */ +#define PORT_OCTEON 17 /* Cavium OCTEON internal UART */ +#define PORT_MAX_8250 17 /* max port ID */ + +/* + * ARM specific type numbers. These are not currently guaranteed + * to be implemented, and will change in the future. These are + * separate so any additions to the old serial.c that occur before + * we are merged can be easily merged here. + */ +#define PORT_PXA 31 +#define PORT_AMBA 32 +#define PORT_CLPS711X 33 +#define PORT_SA1100 34 +#define PORT_UART00 35 +#define PORT_21285 37 + +/* Sparc type numbers. */ +#define PORT_SUNZILOG 38 +#define PORT_SUNSAB 39 + +/* DEC */ +#define PORT_DZ 46 +#define PORT_ZS 47 + +/* Parisc type numbers. */ +#define PORT_MUX 48 + +/* Atmel AT91 / AT32 SoC */ +#define PORT_ATMEL 49 + +/* Macintosh Zilog type numbers */ +#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ +#define PORT_PMAC_ZILOG 51 + +/* SH-SCI */ +#define PORT_SCI 52 +#define PORT_SCIF 53 +#define PORT_IRDA 54 + +/* Samsung S3C2410 SoC and derivatives thereof */ +#define PORT_S3C2410 55 + +/* SGI IP22 aka Indy / Challenge S / Indigo 2 */ +#define PORT_IP22ZILOG 56 + +/* Sharp LH7a40x -- an ARM9 SoC series */ +#define PORT_LH7A40X 57 + +/* PPC CPM type number */ +#define PORT_CPM 58 + +/* MPC52xx type numbers */ +#define PORT_MPC52xx 59 + +/* IBM icom */ +#define PORT_ICOM 60 + +/* Samsung S3C2440 SoC */ +#define PORT_S3C2440 61 + +/* Motorola i.MX SoC */ +#define PORT_IMX 62 + +/* Marvell MPSC */ +#define PORT_MPSC 63 + +/* TXX9 type number */ +#define PORT_TXX9 64 + +/* NEC VR4100 series SIU/DSIU */ +#define PORT_VR41XX_SIU 65 +#define PORT_VR41XX_DSIU 66 + +/* Samsung S3C2400 SoC */ +#define PORT_S3C2400 67 + +/* M32R SIO */ +#define PORT_M32R_SIO 68 + +/*Digi jsm */ +#define PORT_JSM 69 + +#define PORT_PNX8XXX 70 + +/* Hilscher netx */ +#define PORT_NETX 71 + +/* SUN4V Hypervisor Console */ +#define PORT_SUNHV 72 + +#define PORT_S3C2412 73 + +/* Xilinx uartlite */ +#define PORT_UARTLITE 74 + +/* Blackfin bf5xx */ +#define PORT_BFIN 75 + +/* Micrel KS8695 */ +#define PORT_KS8695 76 + +/* Broadcom SB1250, etc. SOC */ +#define PORT_SB1250_DUART 77 + +/* Freescale ColdFire */ +#define PORT_MCF 78 + +/* Blackfin SPORT */ +#define PORT_BFIN_SPORT 79 + +/* MN10300 on-chip UART numbers */ +#define PORT_MN10300 80 +#define PORT_MN10300_CTS 81 + +#define PORT_SC26XX 82 + +/* SH-SCI */ +#define PORT_SCIFA 83 + +#define PORT_S3C6400 84 + +/* NWPSERIAL */ +#define PORT_NWPSERIAL 85 + +/* MAX3100 */ +#define PORT_MAX3100 86 + + +#endif /* LINUX_SERIAL_CORE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial_reg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial_reg.h new file mode 100644 index 0000000..96c0d93 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serial_reg.h @@ -0,0 +1,328 @@ +/* + * include/linux/serial_reg.h + * + * Copyright (C) 1992, 1994 by Theodore Ts'o. + * + * Redistribution of this file is permitted under the terms of the GNU + * Public License (GPL) + * + * These are the UART port assignments, expressed as offsets from the base + * register. These assignments should hold for any serial port based on + * a 8250, 16450, or 16550(A). + */ + +#ifndef _LINUX_SERIAL_REG_H +#define _LINUX_SERIAL_REG_H + +/* + * DLAB=0 + */ +#define UART_RX 0 /* In: Receive buffer */ +#define UART_TX 0 /* Out: Transmit buffer */ + +#define UART_IER 1 /* Out: Interrupt Enable Register */ +#define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ +#define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */ +#define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */ +#define UART_IER_RDI 0x01 /* Enable receiver data interrupt */ +/* + * Sleep mode for ST16650 and TI16750. For the ST16650, EFR[4]=1 + */ +#define UART_IERX_SLEEP 0x10 /* Enable sleep mode */ + +#define UART_IIR 2 /* In: Interrupt ID Register */ +#define UART_IIR_NO_INT 0x01 /* No interrupts pending */ +#define UART_IIR_ID 0x06 /* Mask for the interrupt ID */ +#define UART_IIR_MSI 0x00 /* Modem status interrupt */ +#define UART_IIR_THRI 0x02 /* Transmitter holding register empty */ +#define UART_IIR_RDI 0x04 /* Receiver data interrupt */ +#define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */ + +#define UART_IIR_BUSY 0x07 /* DesignWare APB Busy Detect */ + +#define UART_FCR 2 /* Out: FIFO Control Register */ +#define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */ +#define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */ +#define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */ +#define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */ +/* + * Note: The FIFO trigger levels are chip specific: + * RX:76 = 00 01 10 11 TX:54 = 00 01 10 11 + * PC16550D: 1 4 8 14 xx xx xx xx + * TI16C550A: 1 4 8 14 xx xx xx xx + * TI16C550C: 1 4 8 14 xx xx xx xx + * ST16C550: 1 4 8 14 xx xx xx xx + * ST16C650: 8 16 24 28 16 8 24 30 PORT_16650V2 + * NS16C552: 1 4 8 14 xx xx xx xx + * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 + * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 + * TI16C752: 8 16 56 60 8 16 32 56 + */ +#define UART_FCR_R_TRIG_00 0x00 +#define UART_FCR_R_TRIG_01 0x40 +#define UART_FCR_R_TRIG_10 0x80 +#define UART_FCR_R_TRIG_11 0xc0 +#define UART_FCR_T_TRIG_00 0x00 +#define UART_FCR_T_TRIG_01 0x10 +#define UART_FCR_T_TRIG_10 0x20 +#define UART_FCR_T_TRIG_11 0x30 + +#define UART_FCR_TRIGGER_MASK 0xC0 /* Mask for the FIFO trigger range */ +#define UART_FCR_TRIGGER_1 0x00 /* Mask for trigger set at 1 */ +#define UART_FCR_TRIGGER_4 0x40 /* Mask for trigger set at 4 */ +#define UART_FCR_TRIGGER_8 0x80 /* Mask for trigger set at 8 */ +#define UART_FCR_TRIGGER_14 0xC0 /* Mask for trigger set at 14 */ +/* 16650 definitions */ +#define UART_FCR6_R_TRIGGER_8 0x00 /* Mask for receive trigger set at 1 */ +#define UART_FCR6_R_TRIGGER_16 0x40 /* Mask for receive trigger set at 4 */ +#define UART_FCR6_R_TRIGGER_24 0x80 /* Mask for receive trigger set at 8 */ +#define UART_FCR6_R_TRIGGER_28 0xC0 /* Mask for receive trigger set at 14 */ +#define UART_FCR6_T_TRIGGER_16 0x00 /* Mask for transmit trigger set at 16 */ +#define UART_FCR6_T_TRIGGER_8 0x10 /* Mask for transmit trigger set at 8 */ +#define UART_FCR6_T_TRIGGER_24 0x20 /* Mask for transmit trigger set at 24 */ +#define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ +#define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode (TI16C750) */ + +#define UART_LCR 3 /* Out: Line Control Register */ +/* + * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting + * UART_LCR_STOP will select 1.5 stop bits, not 2 stop bits. + */ +#define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ +#define UART_LCR_SBC 0x40 /* Set break control */ +#define UART_LCR_SPAR 0x20 /* Stick parity (?) */ +#define UART_LCR_EPAR 0x10 /* Even parity select */ +#define UART_LCR_PARITY 0x08 /* Parity Enable */ +#define UART_LCR_STOP 0x04 /* Stop bits: 0=1 bit, 1=2 bits */ +#define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */ +#define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */ +#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ +#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ + +#define UART_MCR 4 /* Out: Modem Control Register */ +#define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */ +#define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */ +#define UART_MCR_XONANY 0x20 /* Enable Xon Any (TI16C752, EFR[4]=1) */ +#define UART_MCR_AFE 0x20 /* Enable auto-RTS/CTS (TI16C550C/TI16C750) */ +#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ +#define UART_MCR_OUT2 0x08 /* Out2 complement */ +#define UART_MCR_OUT1 0x04 /* Out1 complement */ +#define UART_MCR_RTS 0x02 /* RTS complement */ +#define UART_MCR_DTR 0x01 /* DTR complement */ + +#define UART_LSR 5 /* In: Line Status Register */ +#define UART_LSR_TEMT 0x40 /* Transmitter empty */ +#define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */ +#define UART_LSR_BI 0x10 /* Break interrupt indicator */ +#define UART_LSR_FE 0x08 /* Frame error indicator */ +#define UART_LSR_PE 0x04 /* Parity error indicator */ +#define UART_LSR_OE 0x02 /* Overrun error indicator */ +#define UART_LSR_DR 0x01 /* Receiver data ready */ +#define UART_LSR_BRK_ERROR_BITS 0x1E /* BI, FE, PE, OE bits */ + +#define UART_MSR 6 /* In: Modem Status Register */ +#define UART_MSR_DCD 0x80 /* Data Carrier Detect */ +#define UART_MSR_RI 0x40 /* Ring Indicator */ +#define UART_MSR_DSR 0x20 /* Data Set Ready */ +#define UART_MSR_CTS 0x10 /* Clear to Send */ +#define UART_MSR_DDCD 0x08 /* Delta DCD */ +#define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */ +#define UART_MSR_DDSR 0x02 /* Delta DSR */ +#define UART_MSR_DCTS 0x01 /* Delta CTS */ +#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ + +#define UART_SCR 7 /* I/O: Scratch Register */ + +/* + * DLAB=1 + */ +#define UART_DLL 0 /* Out: Divisor Latch Low */ +#define UART_DLM 1 /* Out: Divisor Latch High */ + +/* + * LCR=0xBF (or DLAB=1 for 16C660) + */ +#define UART_EFR 2 /* I/O: Extended Features Register */ +#define UART_EFR_CTS 0x80 /* CTS flow control */ +#define UART_EFR_RTS 0x40 /* RTS flow control */ +#define UART_EFR_SCD 0x20 /* Special character detect */ +#define UART_EFR_ECB 0x10 /* Enhanced control bit */ +/* + * the low four bits control software flow control + */ + +/* + * LCR=0xBF, TI16C752, ST16650, ST16650A, ST16654 + */ +#define UART_XON1 4 /* I/O: Xon character 1 */ +#define UART_XON2 5 /* I/O: Xon character 2 */ +#define UART_XOFF1 6 /* I/O: Xoff character 1 */ +#define UART_XOFF2 7 /* I/O: Xoff character 2 */ + +/* + * EFR[4]=1 MCR[6]=1, TI16C752 + */ +#define UART_TI752_TCR 6 /* I/O: transmission control register */ +#define UART_TI752_TLR 7 /* I/O: trigger level register */ + +/* + * LCR=0xBF, XR16C85x + */ +#define UART_TRG 0 /* FCTR bit 7 selects Rx or Tx + * In: Fifo count + * Out: Fifo custom trigger levels */ +/* + * These are the definitions for the Programmable Trigger Register + */ +#define UART_TRG_1 0x01 +#define UART_TRG_4 0x04 +#define UART_TRG_8 0x08 +#define UART_TRG_16 0x10 +#define UART_TRG_32 0x20 +#define UART_TRG_64 0x40 +#define UART_TRG_96 0x60 +#define UART_TRG_120 0x78 +#define UART_TRG_128 0x80 + +#define UART_FCTR 1 /* Feature Control Register */ +#define UART_FCTR_RTS_NODELAY 0x00 /* RTS flow control delay */ +#define UART_FCTR_RTS_4DELAY 0x01 +#define UART_FCTR_RTS_6DELAY 0x02 +#define UART_FCTR_RTS_8DELAY 0x03 +#define UART_FCTR_IRDA 0x04 /* IrDa data encode select */ +#define UART_FCTR_TX_INT 0x08 /* Tx interrupt type select */ +#define UART_FCTR_TRGA 0x00 /* Tx/Rx 550 trigger table select */ +#define UART_FCTR_TRGB 0x10 /* Tx/Rx 650 trigger table select */ +#define UART_FCTR_TRGC 0x20 /* Tx/Rx 654 trigger table select */ +#define UART_FCTR_TRGD 0x30 /* Tx/Rx 850 programmable trigger select */ +#define UART_FCTR_SCR_SWAP 0x40 /* Scratch pad register swap */ +#define UART_FCTR_RX 0x00 /* Programmable trigger mode select */ +#define UART_FCTR_TX 0x80 /* Programmable trigger mode select */ + +/* + * LCR=0xBF, FCTR[6]=1 + */ +#define UART_EMSR 7 /* Extended Mode Select Register */ +#define UART_EMSR_FIFO_COUNT 0x01 /* Rx/Tx select */ +#define UART_EMSR_ALT_COUNT 0x02 /* Alternating count select */ + +/* + * The Intel XScale on-chip UARTs define these bits + */ +#define UART_IER_DMAE 0x80 /* DMA Requests Enable */ +#define UART_IER_UUE 0x40 /* UART Unit Enable */ +#define UART_IER_NRZE 0x20 /* NRZ coding Enable */ +#define UART_IER_RTOIE 0x10 /* Receiver Time Out Interrupt Enable */ + +#define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ + +#define UART_FCR_PXAR1 0x00 /* receive FIFO treshold = 1 */ +#define UART_FCR_PXAR8 0x40 /* receive FIFO treshold = 8 */ +#define UART_FCR_PXAR16 0x80 /* receive FIFO treshold = 16 */ +#define UART_FCR_PXAR32 0xc0 /* receive FIFO treshold = 32 */ + + + + +/* + * These register definitions are for the 16C950 + */ +#define UART_ASR 0x01 /* Additional Status Register */ +#define UART_RFL 0x03 /* Receiver FIFO level */ +#define UART_TFL 0x04 /* Transmitter FIFO level */ +#define UART_ICR 0x05 /* Index Control Register */ + +/* The 16950 ICR registers */ +#define UART_ACR 0x00 /* Additional Control Register */ +#define UART_CPR 0x01 /* Clock Prescalar Register */ +#define UART_TCR 0x02 /* Times Clock Register */ +#define UART_CKS 0x03 /* Clock Select Register */ +#define UART_TTL 0x04 /* Transmitter Interrupt Trigger Level */ +#define UART_RTL 0x05 /* Receiver Interrupt Trigger Level */ +#define UART_FCL 0x06 /* Flow Control Level Lower */ +#define UART_FCH 0x07 /* Flow Control Level Higher */ +#define UART_ID1 0x08 /* ID #1 */ +#define UART_ID2 0x09 /* ID #2 */ +#define UART_ID3 0x0A /* ID #3 */ +#define UART_REV 0x0B /* Revision */ +#define UART_CSR 0x0C /* Channel Software Reset */ +#define UART_NMR 0x0D /* Nine-bit Mode Register */ +#define UART_CTR 0xFF + +/* + * The 16C950 Additional Control Register + */ +#define UART_ACR_RXDIS 0x01 /* Receiver disable */ +#define UART_ACR_TXDIS 0x02 /* Transmitter disable */ +#define UART_ACR_DSRFC 0x04 /* DSR Flow Control */ +#define UART_ACR_TLENB 0x20 /* 950 trigger levels enable */ +#define UART_ACR_ICRRD 0x40 /* ICR Read enable */ +#define UART_ACR_ASREN 0x80 /* Additional status enable */ + + + +/* + * These definitions are for the RSA-DV II/S card, from + * + * Kiyokazu SUTO + */ + +#define UART_RSA_BASE (-8) + +#define UART_RSA_MSR ((UART_RSA_BASE) + 0) /* I/O: Mode Select Register */ + +#define UART_RSA_MSR_SWAP (1 << 0) /* Swap low/high 8 bytes in I/O port addr */ +#define UART_RSA_MSR_FIFO (1 << 2) /* Enable the external FIFO */ +#define UART_RSA_MSR_FLOW (1 << 3) /* Enable the auto RTS/CTS flow control */ +#define UART_RSA_MSR_ITYP (1 << 4) /* Level (1) / Edge triger (0) */ + +#define UART_RSA_IER ((UART_RSA_BASE) + 1) /* I/O: Interrupt Enable Register */ + +#define UART_RSA_IER_Rx_FIFO_H (1 << 0) /* Enable Rx FIFO half full int. */ +#define UART_RSA_IER_Tx_FIFO_H (1 << 1) /* Enable Tx FIFO half full int. */ +#define UART_RSA_IER_Tx_FIFO_E (1 << 2) /* Enable Tx FIFO empty int. */ +#define UART_RSA_IER_Rx_TOUT (1 << 3) /* Enable char receive timeout int */ +#define UART_RSA_IER_TIMER (1 << 4) /* Enable timer interrupt */ + +#define UART_RSA_SRR ((UART_RSA_BASE) + 2) /* IN: Status Read Register */ + +#define UART_RSA_SRR_Tx_FIFO_NEMP (1 << 0) /* Tx FIFO is not empty (1) */ +#define UART_RSA_SRR_Tx_FIFO_NHFL (1 << 1) /* Tx FIFO is not half full (1) */ +#define UART_RSA_SRR_Tx_FIFO_NFUL (1 << 2) /* Tx FIFO is not full (1) */ +#define UART_RSA_SRR_Rx_FIFO_NEMP (1 << 3) /* Rx FIFO is not empty (1) */ +#define UART_RSA_SRR_Rx_FIFO_NHFL (1 << 4) /* Rx FIFO is not half full (1) */ +#define UART_RSA_SRR_Rx_FIFO_NFUL (1 << 5) /* Rx FIFO is not full (1) */ +#define UART_RSA_SRR_Rx_TOUT (1 << 6) /* Character reception timeout occurred (1) */ +#define UART_RSA_SRR_TIMER (1 << 7) /* Timer interrupt occurred */ + +#define UART_RSA_FRR ((UART_RSA_BASE) + 2) /* OUT: FIFO Reset Register */ + +#define UART_RSA_TIVSR ((UART_RSA_BASE) + 3) /* I/O: Timer Interval Value Set Register */ + +#define UART_RSA_TCR ((UART_RSA_BASE) + 4) /* OUT: Timer Control Register */ + +#define UART_RSA_TCR_SWITCH (1 << 0) /* Timer on */ + +/* + * The RSA DSV/II board has two fixed clock frequencies. One is the + * standard rate, and the other is 8 times faster. + */ +#define SERIAL_RSA_BAUD_BASE (921600) +#define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8) + +/* + * Extra serial register definitions for the internal UARTs + * in TI OMAP processors. + */ +#define UART_OMAP_MDR1 0x08 /* Mode definition register */ +#define UART_OMAP_MDR2 0x09 /* Mode definition register 2 */ +#define UART_OMAP_SCR 0x10 /* Supplementary control register */ +#define UART_OMAP_SSR 0x11 /* Supplementary status register */ +#define UART_OMAP_EBLR 0x12 /* BOF length register */ +#define UART_OMAP_OSC_12M_SEL 0x13 /* OMAP1510 12MHz osc select */ +#define UART_OMAP_MVER 0x14 /* Module version register */ +#define UART_OMAP_SYSC 0x15 /* System configuration register */ +#define UART_OMAP_SYSS 0x16 /* System status register */ + +#endif /* _LINUX_SERIAL_REG_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serio.h new file mode 100644 index 0000000..b2d73ea --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/serio.h @@ -0,0 +1,76 @@ +#ifndef _SERIO_H +#define _SERIO_H + +/* + * Copyright (C) 1999-2002 Vojtech Pavlik +* + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include + +#define SPIOCSTYPE _IOW('q', 0x01, unsigned long) + + +/* + * bit masks for use in "interrupt" flags (3rd argument) + */ +#define SERIO_TIMEOUT 1 +#define SERIO_PARITY 2 +#define SERIO_FRAME 4 + +/* + * Serio types + */ +#define SERIO_XT 0x00 +#define SERIO_8042 0x01 +#define SERIO_RS232 0x02 +#define SERIO_HIL_MLC 0x03 +#define SERIO_PS_PSTHRU 0x05 +#define SERIO_8042_XL 0x06 + +/* + * Serio protocols + */ +#define SERIO_UNKNOWN 0x00 +#define SERIO_MSC 0x01 +#define SERIO_SUN 0x02 +#define SERIO_MS 0x03 +#define SERIO_MP 0x04 +#define SERIO_MZ 0x05 +#define SERIO_MZP 0x06 +#define SERIO_MZPP 0x07 +#define SERIO_VSXXXAA 0x08 +#define SERIO_SUNKBD 0x10 +#define SERIO_WARRIOR 0x18 +#define SERIO_SPACEORB 0x19 +#define SERIO_MAGELLAN 0x1a +#define SERIO_SPACEBALL 0x1b +#define SERIO_GUNZE 0x1c +#define SERIO_IFORCE 0x1d +#define SERIO_STINGER 0x1e +#define SERIO_NEWTON 0x1f +#define SERIO_STOWAWAY 0x20 +#define SERIO_H3600 0x21 +#define SERIO_PS2SER 0x22 +#define SERIO_TWIDKBD 0x23 +#define SERIO_TWIDJOY 0x24 +#define SERIO_HIL 0x25 +#define SERIO_SNES232 0x26 +#define SERIO_SEMTECH 0x27 +#define SERIO_LKKBD 0x28 +#define SERIO_ELO 0x29 +#define SERIO_MICROTOUCH 0x30 +#define SERIO_PENMOUNT 0x31 +#define SERIO_TOUCHRIGHT 0x32 +#define SERIO_TOUCHWIN 0x33 +#define SERIO_TAOSEVM 0x34 +#define SERIO_FUJITSU 0x35 +#define SERIO_ZHENHUA 0x36 +#define SERIO_INEXIO 0x37 +#define SERIO_TOUCHIT213 0x38 +#define SERIO_W8001 0x39 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/shm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/shm.h new file mode 100644 index 0000000..c99cef0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/shm.h @@ -0,0 +1,75 @@ +#ifndef _LINUX_SHM_H_ +#define _LINUX_SHM_H_ + +#include +#include +#include + +/* + * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can + * be increased by sysctl + */ + +#define SHMMAX 0x2000000 /* max shared seg size (bytes) */ +#define SHMMIN 1 /* min shared seg size (bytes) */ +#define SHMMNI 4096 /* max num of segs system wide */ +#define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16)) +#define SHMSEG SHMMNI /* max shared segs per process */ + + +/* Obsolete, used only for backwards compatibility and libc5 compiles */ +struct shmid_ds { + struct ipc_perm shm_perm; /* operation perms */ + int shm_segsz; /* size of segment (bytes) */ + __kernel_time_t shm_atime; /* last attach time */ + __kernel_time_t shm_dtime; /* last detach time */ + __kernel_time_t shm_ctime; /* last change time */ + __kernel_ipc_pid_t shm_cpid; /* pid of creator */ + __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ + unsigned short shm_nattch; /* no. of current attaches */ + unsigned short shm_unused; /* compatibility */ + void *shm_unused2; /* ditto - used by DIPC */ + void *shm_unused3; /* unused */ +}; + +/* Include the definition of shmid64_ds and shminfo64 */ +#include + +/* permission flag for shmget */ +#define SHM_R 0400 /* or S_IRUGO from */ +#define SHM_W 0200 /* or S_IWUGO from */ + +/* mode for attach */ +#define SHM_RDONLY 010000 /* read-only access */ +#define SHM_RND 020000 /* round attach address to SHMLBA boundary */ +#define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_EXEC 0100000 /* execution access */ + +/* super user shmctl commands */ +#define SHM_LOCK 11 +#define SHM_UNLOCK 12 + +/* ipcs ctl commands */ +#define SHM_STAT 13 +#define SHM_INFO 14 + +/* Obsolete, used only for backwards compatibility */ +struct shminfo { + int shmmax; + int shmmin; + int shmmni; + int shmseg; + int shmall; +}; + +struct shm_info { + int used_ids; + unsigned long shm_tot; /* total allocated shm */ + unsigned long shm_rss; /* total resident shm */ + unsigned long shm_swp; /* total swapped shm */ + unsigned long swap_attempts; + unsigned long swap_successes; +}; + + +#endif /* _LINUX_SHM_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/signal.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/signal.h new file mode 100644 index 0000000..0bb69d8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/signal.h @@ -0,0 +1,8 @@ +#ifndef _LINUX_SIGNAL_H +#define _LINUX_SIGNAL_H + +#include +#include + + +#endif /* _LINUX_SIGNAL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/signalfd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/signalfd.h new file mode 100644 index 0000000..cd7325f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/signalfd.h @@ -0,0 +1,52 @@ +/* + * include/linux/signalfd.h + * + * Copyright (C) 2007 Davide Libenzi + * + */ + +#ifndef _LINUX_SIGNALFD_H +#define _LINUX_SIGNALFD_H + +#include +/* For O_CLOEXEC and O_NONBLOCK */ +#include + +/* Flags for signalfd4. */ +#define SFD_CLOEXEC O_CLOEXEC +#define SFD_NONBLOCK O_NONBLOCK + +struct signalfd_siginfo { + __u32 ssi_signo; + __s32 ssi_errno; + __s32 ssi_code; + __u32 ssi_pid; + __u32 ssi_uid; + __s32 ssi_fd; + __u32 ssi_tid; + __u32 ssi_band; + __u32 ssi_overrun; + __u32 ssi_trapno; + __s32 ssi_status; + __s32 ssi_int; + __u64 ssi_ptr; + __u64 ssi_utime; + __u64 ssi_stime; + __u64 ssi_addr; + + /* + * Pad strcture to 128 bytes. Remember to update the + * pad size when you add new members. We use a fixed + * size structure to avoid compatibility problems with + * future versions, and we leave extra space for additional + * members. We use fixed size members because this strcture + * comes out of a read(2) and we really don't want to have + * a compat on read(2). + */ + __u8 __pad[48]; +}; + + + +#endif /* _LINUX_SIGNALFD_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb.h new file mode 100644 index 0000000..9c94ad5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb.h @@ -0,0 +1,64 @@ +/* + * smb.h + * + * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1997 by Volker Lendecke + * + */ + +#ifndef _LINUX_SMB_H +#define _LINUX_SMB_H + +#include +#include + +enum smb_protocol { + SMB_PROTOCOL_NONE, + SMB_PROTOCOL_CORE, + SMB_PROTOCOL_COREPLUS, + SMB_PROTOCOL_LANMAN1, + SMB_PROTOCOL_LANMAN2, + SMB_PROTOCOL_NT1 +}; + +enum smb_case_hndl { + SMB_CASE_DEFAULT, + SMB_CASE_LOWER, + SMB_CASE_UPPER +}; + +struct smb_dskattr { + __u16 total; + __u16 allocblocks; + __u16 blocksize; + __u16 free; +}; + +struct smb_conn_opt { + + /* The socket */ + unsigned int fd; + + enum smb_protocol protocol; + enum smb_case_hndl case_handling; + + /* Connection-Options */ + + __u32 max_xmit; + __u16 server_uid; + __u16 tid; + + /* The following are LANMAN 1.0 options */ + __u16 secmode; + __u16 maxmux; + __u16 maxvcs; + __u16 rawmode; + __u32 sesskey; + + /* The following are NT LM 0.12 options */ + __u32 maxraw; + __u32 capabilities; + __s16 serverzone; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb_fs.h new file mode 100644 index 0000000..b7e9450 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb_fs.h @@ -0,0 +1,25 @@ +/* + * smb_fs.h + * + * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1997 by Volker Lendecke + * + */ + +#ifndef _LINUX_SMB_FS_H +#define _LINUX_SMB_FS_H + +#include + +/* + * ioctl commands + */ +#define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_old_uid_t) +#define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt) + +/* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */ +#define SMB_IOC_GETMOUNTUID32 _IOR('u', 3, __kernel_uid32_t) + + + +#endif /* _LINUX_SMB_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb_mount.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb_mount.h new file mode 100644 index 0000000..82956ba --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smb_mount.h @@ -0,0 +1,27 @@ +/* + * smb_mount.h + * + * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke + * Copyright (C) 1997 by Volker Lendecke + * + */ + +#ifndef _LINUX_SMB_MOUNT_H +#define _LINUX_SMB_MOUNT_H + +#include + +#define SMB_MOUNT_VERSION 6 + +struct smb_mount_data { + int version; + __kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */ + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_mode_t file_mode; + __kernel_mode_t dir_mode; +}; + + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smbno.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smbno.h new file mode 100644 index 0000000..f99e02d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/smbno.h @@ -0,0 +1,363 @@ +#ifndef _SMBNO_H_ +#define _SMBNO_H_ + +/* these define the attribute byte as seen by DOS */ +#define aRONLY (1L<<0) +#define aHIDDEN (1L<<1) +#define aSYSTEM (1L<<2) +#define aVOLID (1L<<3) +#define aDIR (1L<<4) +#define aARCH (1L<<5) + +/* error classes */ +#define SUCCESS 0 /* The request was successful. */ +#define ERRDOS 0x01 /* Error is from the core DOS operating system set. */ +#define ERRSRV 0x02 /* Error is generated by the server network file manager.*/ +#define ERRHRD 0x03 /* Error is an hardware error. */ +#define ERRCMD 0xFF /* Command was not in the "SMB" format. */ + +/* SMB X/Open error codes for the ERRdos error class */ + +#define ERRbadfunc 1 /* Invalid function (or system call) */ +#define ERRbadfile 2 /* File not found (pathname error) */ +#define ERRbadpath 3 /* Directory not found */ +#define ERRnofids 4 /* Too many open files */ +#define ERRnoaccess 5 /* Access denied */ +#define ERRbadfid 6 /* Invalid fid */ +#define ERRbadmcb 7 /* Memory control blocks destroyed */ +#define ERRnomem 8 /* Out of memory */ +#define ERRbadmem 9 /* Invalid memory block address */ +#define ERRbadenv 10 /* Invalid environment */ +#define ERRbadformat 11 /* Invalid format */ +#define ERRbadaccess 12 /* Invalid open mode */ +#define ERRbaddata 13 /* Invalid data (only from ioctl call) */ +#define ERRres 14 /* reserved */ +#define ERRbaddrive 15 /* Invalid drive */ +#define ERRremcd 16 /* Attempt to delete current directory */ +#define ERRdiffdevice 17 /* rename/move across different filesystems */ +#define ERRnofiles 18 /* no more files found in file search */ +#define ERRbadshare 32 /* Share mode on file conflict with open mode */ +#define ERRlock 33 /* Lock request conflicts with existing lock */ +#define ERRfilexists 80 /* File in operation already exists */ +#define ERRbadpipe 230 /* Named pipe invalid */ +#define ERRpipebusy 231 /* All instances of pipe are busy */ +#define ERRpipeclosing 232 /* named pipe close in progress */ +#define ERRnotconnected 233 /* No process on other end of named pipe */ +#define ERRmoredata 234 /* More data to be returned */ + +#define ERROR_INVALID_PARAMETER 87 +#define ERROR_DISK_FULL 112 +#define ERROR_INVALID_NAME 123 +#define ERROR_DIR_NOT_EMPTY 145 +#define ERROR_NOT_LOCKED 158 +#define ERROR_ALREADY_EXISTS 183 /* see also 80 ? */ +#define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */ +#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */ + +/* Error codes for the ERRSRV class */ + +#define ERRerror 1 /* Non specific error code */ +#define ERRbadpw 2 /* Bad password */ +#define ERRbadtype 3 /* reserved */ +#define ERRaccess 4 /* No permissions to do the requested operation */ +#define ERRinvnid 5 /* tid invalid */ +#define ERRinvnetname 6 /* Invalid servername */ +#define ERRinvdevice 7 /* Invalid device */ +#define ERRqfull 49 /* Print queue full */ +#define ERRqtoobig 50 /* Queued item too big */ +#define ERRinvpfid 52 /* Invalid print file in smb_fid */ +#define ERRsmbcmd 64 /* Unrecognised command */ +#define ERRsrverror 65 /* smb server internal error */ +#define ERRfilespecs 67 /* fid and pathname invalid combination */ +#define ERRbadlink 68 /* reserved */ +#define ERRbadpermits 69 /* Access specified for a file is not valid */ +#define ERRbadpid 70 /* reserved */ +#define ERRsetattrmode 71 /* attribute mode invalid */ +#define ERRpaused 81 /* Message server paused */ +#define ERRmsgoff 82 /* Not receiving messages */ +#define ERRnoroom 83 /* No room for message */ +#define ERRrmuns 87 /* too many remote usernames */ +#define ERRtimeout 88 /* operation timed out */ +#define ERRnoresource 89 /* No resources currently available for request. */ +#define ERRtoomanyuids 90 /* too many userids */ +#define ERRbaduid 91 /* bad userid */ +#define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */ +#define ERRuseSTD 251 /* temporarily unable to use raw mode, use std.mode */ +#define ERRcontMPX 252 /* resume MPX mode */ +#define ERRbadPW /* reserved */ +#define ERRnosupport 0xFFFF + +/* Error codes for the ERRHRD class */ + +#define ERRnowrite 19 /* read only media */ +#define ERRbadunit 20 /* Unknown device */ +#define ERRnotready 21 /* Drive not ready */ +#define ERRbadcmd 22 /* Unknown command */ +#define ERRdata 23 /* Data (CRC) error */ +#define ERRbadreq 24 /* Bad request structure length */ +#define ERRseek 25 +#define ERRbadmedia 26 +#define ERRbadsector 27 +#define ERRnopaper 28 +#define ERRwrite 29 /* write fault */ +#define ERRread 30 /* read fault */ +#define ERRgeneral 31 /* General hardware failure */ +#define ERRwrongdisk 34 +#define ERRFCBunavail 35 +#define ERRsharebufexc 36 /* share buffer exceeded */ +#define ERRdiskfull 39 + +/* + * Access modes when opening a file + */ +#define SMB_ACCMASK 0x0003 +#define SMB_O_RDONLY 0x0000 +#define SMB_O_WRONLY 0x0001 +#define SMB_O_RDWR 0x0002 + +/* offsets into message for common items */ +#define smb_com 8 +#define smb_rcls 9 +#define smb_reh 10 +#define smb_err 11 +#define smb_flg 13 +#define smb_flg2 14 +#define smb_reb 13 +#define smb_tid 28 +#define smb_pid 30 +#define smb_uid 32 +#define smb_mid 34 +#define smb_wct 36 +#define smb_vwv 37 +#define smb_vwv0 37 +#define smb_vwv1 39 +#define smb_vwv2 41 +#define smb_vwv3 43 +#define smb_vwv4 45 +#define smb_vwv5 47 +#define smb_vwv6 49 +#define smb_vwv7 51 +#define smb_vwv8 53 +#define smb_vwv9 55 +#define smb_vwv10 57 +#define smb_vwv11 59 +#define smb_vwv12 61 +#define smb_vwv13 63 +#define smb_vwv14 65 + +/* these are the trans2 sub fields for primary requests */ +#define smb_tpscnt smb_vwv0 +#define smb_tdscnt smb_vwv1 +#define smb_mprcnt smb_vwv2 +#define smb_mdrcnt smb_vwv3 +#define smb_msrcnt smb_vwv4 +#define smb_flags smb_vwv5 +#define smb_timeout smb_vwv6 +#define smb_pscnt smb_vwv9 +#define smb_psoff smb_vwv10 +#define smb_dscnt smb_vwv11 +#define smb_dsoff smb_vwv12 +#define smb_suwcnt smb_vwv13 +#define smb_setup smb_vwv14 +#define smb_setup0 smb_setup +#define smb_setup1 (smb_setup+2) +#define smb_setup2 (smb_setup+4) + +/* these are for the secondary requests */ +#define smb_spscnt smb_vwv2 +#define smb_spsoff smb_vwv3 +#define smb_spsdisp smb_vwv4 +#define smb_sdscnt smb_vwv5 +#define smb_sdsoff smb_vwv6 +#define smb_sdsdisp smb_vwv7 +#define smb_sfid smb_vwv8 + +/* and these for responses */ +#define smb_tprcnt smb_vwv0 +#define smb_tdrcnt smb_vwv1 +#define smb_prcnt smb_vwv3 +#define smb_proff smb_vwv4 +#define smb_prdisp smb_vwv5 +#define smb_drcnt smb_vwv6 +#define smb_droff smb_vwv7 +#define smb_drdisp smb_vwv8 + +/* the complete */ +#define SMBmkdir 0x00 /* create directory */ +#define SMBrmdir 0x01 /* delete directory */ +#define SMBopen 0x02 /* open file */ +#define SMBcreate 0x03 /* create file */ +#define SMBclose 0x04 /* close file */ +#define SMBflush 0x05 /* flush file */ +#define SMBunlink 0x06 /* delete file */ +#define SMBmv 0x07 /* rename file */ +#define SMBgetatr 0x08 /* get file attributes */ +#define SMBsetatr 0x09 /* set file attributes */ +#define SMBread 0x0A /* read from file */ +#define SMBwrite 0x0B /* write to file */ +#define SMBlock 0x0C /* lock byte range */ +#define SMBunlock 0x0D /* unlock byte range */ +#define SMBctemp 0x0E /* create temporary file */ +#define SMBmknew 0x0F /* make new file */ +#define SMBchkpth 0x10 /* check directory path */ +#define SMBexit 0x11 /* process exit */ +#define SMBlseek 0x12 /* seek */ +#define SMBtcon 0x70 /* tree connect */ +#define SMBtconX 0x75 /* tree connect and X*/ +#define SMBtdis 0x71 /* tree disconnect */ +#define SMBnegprot 0x72 /* negotiate protocol */ +#define SMBdskattr 0x80 /* get disk attributes */ +#define SMBsearch 0x81 /* search directory */ +#define SMBsplopen 0xC0 /* open print spool file */ +#define SMBsplwr 0xC1 /* write to print spool file */ +#define SMBsplclose 0xC2 /* close print spool file */ +#define SMBsplretq 0xC3 /* return print queue */ +#define SMBsends 0xD0 /* send single block message */ +#define SMBsendb 0xD1 /* send broadcast message */ +#define SMBfwdname 0xD2 /* forward user name */ +#define SMBcancelf 0xD3 /* cancel forward */ +#define SMBgetmac 0xD4 /* get machine name */ +#define SMBsendstrt 0xD5 /* send start of multi-block message */ +#define SMBsendend 0xD6 /* send end of multi-block message */ +#define SMBsendtxt 0xD7 /* send text of multi-block message */ + +/* Core+ protocol */ +#define SMBlockread 0x13 /* Lock a range and read */ +#define SMBwriteunlock 0x14 /* Unlock a range then write */ +#define SMBreadbraw 0x1a /* read a block of data with no smb header */ +#define SMBwritebraw 0x1d /* write a block of data with no smb header */ +#define SMBwritec 0x20 /* secondary write request */ +#define SMBwriteclose 0x2c /* write a file then close it */ + +/* dos extended protocol */ +#define SMBreadBraw 0x1A /* read block raw */ +#define SMBreadBmpx 0x1B /* read block multiplexed */ +#define SMBreadBs 0x1C /* read block (secondary response) */ +#define SMBwriteBraw 0x1D /* write block raw */ +#define SMBwriteBmpx 0x1E /* write block multiplexed */ +#define SMBwriteBs 0x1F /* write block (secondary request) */ +#define SMBwriteC 0x20 /* write complete response */ +#define SMBsetattrE 0x22 /* set file attributes expanded */ +#define SMBgetattrE 0x23 /* get file attributes expanded */ +#define SMBlockingX 0x24 /* lock/unlock byte ranges and X */ +#define SMBtrans 0x25 /* transaction - name, bytes in/out */ +#define SMBtranss 0x26 /* transaction (secondary request/response) */ +#define SMBioctl 0x27 /* IOCTL */ +#define SMBioctls 0x28 /* IOCTL (secondary request/response) */ +#define SMBcopy 0x29 /* copy */ +#define SMBmove 0x2A /* move */ +#define SMBecho 0x2B /* echo */ +#define SMBopenX 0x2D /* open and X */ +#define SMBreadX 0x2E /* read and X */ +#define SMBwriteX 0x2F /* write and X */ +#define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */ +#define SMBtconX 0x75 /* tree connect and X */ +#define SMBffirst 0x82 /* find first */ +#define SMBfunique 0x83 /* find unique */ +#define SMBfclose 0x84 /* find close */ +#define SMBinvalid 0xFE /* invalid command */ + + +/* Extended 2.0 protocol */ +#define SMBtrans2 0x32 /* TRANS2 protocol set */ +#define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */ +#define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */ +#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */ +#define SMBulogoffX 0x74 /* user logoff */ + +/* these are the TRANS2 sub commands */ +#define TRANSACT2_OPEN 0 +#define TRANSACT2_FINDFIRST 1 +#define TRANSACT2_FINDNEXT 2 +#define TRANSACT2_QFSINFO 3 +#define TRANSACT2_SETFSINFO 4 +#define TRANSACT2_QPATHINFO 5 +#define TRANSACT2_SETPATHINFO 6 +#define TRANSACT2_QFILEINFO 7 +#define TRANSACT2_SETFILEINFO 8 +#define TRANSACT2_FSCTL 9 +#define TRANSACT2_IOCTL 10 +#define TRANSACT2_FINDNOTIFYFIRST 11 +#define TRANSACT2_FINDNOTIFYNEXT 12 +#define TRANSACT2_MKDIR 13 + +/* Information Levels - Shared? */ +#define SMB_INFO_STANDARD 1 +#define SMB_INFO_QUERY_EA_SIZE 2 +#define SMB_INFO_QUERY_EAS_FROM_LIST 3 +#define SMB_INFO_QUERY_ALL_EAS 4 +#define SMB_INFO_IS_NAME_VALID 6 + +/* Information Levels - TRANSACT2_FINDFIRST */ +#define SMB_FIND_FILE_DIRECTORY_INFO 0x101 +#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 +#define SMB_FIND_FILE_NAMES_INFO 0x103 +#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 + +/* Information Levels - TRANSACT2_QPATHINFO */ +#define SMB_QUERY_FILE_BASIC_INFO 0x101 +#define SMB_QUERY_FILE_STANDARD_INFO 0x102 +#define SMB_QUERY_FILE_EA_INFO 0x103 +#define SMB_QUERY_FILE_NAME_INFO 0x104 +#define SMB_QUERY_FILE_ALL_INFO 0x107 +#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108 +#define SMB_QUERY_FILE_STREAM_INFO 0x109 +#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10b + +/* Information Levels - TRANSACT2_SETFILEINFO */ +#define SMB_SET_FILE_BASIC_INFO 0x101 +#define SMB_SET_FILE_DISPOSITION_INFO 0x102 +#define SMB_SET_FILE_ALLOCATION_INFO 0x103 +#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 + +/* smb_flg field flags */ +#define SMB_FLAGS_SUPPORT_LOCKREAD 0x01 +#define SMB_FLAGS_CLIENT_BUF_AVAIL 0x02 +#define SMB_FLAGS_RESERVED 0x04 +#define SMB_FLAGS_CASELESS_PATHNAMES 0x08 +#define SMB_FLAGS_CANONICAL_PATHNAMES 0x10 +#define SMB_FLAGS_REQUEST_OPLOCK 0x20 +#define SMB_FLAGS_REQUEST_BATCH_OPLOCK 0x40 +#define SMB_FLAGS_REPLY 0x80 + +/* smb_flg2 field flags (samba-2.2.0/source/include/smb.h) */ +#define SMB_FLAGS2_LONG_PATH_COMPONENTS 0x0001 +#define SMB_FLAGS2_EXTENDED_ATTRIBUTES 0x0002 +#define SMB_FLAGS2_DFS_PATHNAMES 0x1000 +#define SMB_FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000 +#define SMB_FLAGS2_32_BIT_ERROR_CODES 0x4000 +#define SMB_FLAGS2_UNICODE_STRINGS 0x8000 + + +/* + * UNIX stuff (from samba trans2.h) + */ +#define MIN_UNIX_INFO_LEVEL 0x200 +#define MAX_UNIX_INFO_LEVEL 0x2FF +#define SMB_FIND_FILE_UNIX 0x202 +#define SMB_QUERY_FILE_UNIX_BASIC 0x200 +#define SMB_QUERY_FILE_UNIX_LINK 0x201 +#define SMB_QUERY_FILE_UNIX_HLINK 0x202 +#define SMB_SET_FILE_UNIX_BASIC 0x200 +#define SMB_SET_FILE_UNIX_LINK 0x201 +#define SMB_SET_FILE_UNIX_HLINK 0x203 +#define SMB_QUERY_CIFS_UNIX_INFO 0x200 + +/* values which means "don't change it" */ +#define SMB_MODE_NO_CHANGE 0xFFFFFFFF +#define SMB_UID_NO_CHANGE 0xFFFFFFFF +#define SMB_GID_NO_CHANGE 0xFFFFFFFF +#define SMB_TIME_NO_CHANGE 0xFFFFFFFFFFFFFFFFULL +#define SMB_SIZE_NO_CHANGE 0xFFFFFFFFFFFFFFFFULL + +/* UNIX filetype mappings. */ +#define UNIX_TYPE_FILE 0 +#define UNIX_TYPE_DIR 1 +#define UNIX_TYPE_SYMLINK 2 +#define UNIX_TYPE_CHARDEV 3 +#define UNIX_TYPE_BLKDEV 4 +#define UNIX_TYPE_FIFO 5 +#define UNIX_TYPE_SOCKET 6 +#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF + +#endif /* _SMBNO_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/snmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/snmp.h new file mode 100644 index 0000000..aee3f1e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/snmp.h @@ -0,0 +1,257 @@ +/* + * Definitions for MIBs + * + * Author: Hideaki YOSHIFUJI + */ + +#ifndef _LINUX_SNMP_H +#define _LINUX_SNMP_H + +/* ipstats mib definitions */ +/* + * RFC 1213: MIB-II + * RFC 2011 (updates 1213): SNMPv2-MIB-IP + * RFC 2863: Interfaces Group MIB + * RFC 2465: IPv6 MIB: General Group + * draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables + */ +enum +{ + IPSTATS_MIB_NUM = 0, + IPSTATS_MIB_INRECEIVES, /* InReceives */ + IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ + IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ + IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ + IPSTATS_MIB_INADDRERRORS, /* InAddrErrors */ + IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */ + IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */ + IPSTATS_MIB_INDISCARDS, /* InDiscards */ + IPSTATS_MIB_INDELIVERS, /* InDelivers */ + IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ + IPSTATS_MIB_OUTREQUESTS, /* OutRequests */ + IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ + IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ + IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ + IPSTATS_MIB_REASMREQDS, /* ReasmReqds */ + IPSTATS_MIB_REASMOKS, /* ReasmOKs */ + IPSTATS_MIB_REASMFAILS, /* ReasmFails */ + IPSTATS_MIB_FRAGOKS, /* FragOKs */ + IPSTATS_MIB_FRAGFAILS, /* FragFails */ + IPSTATS_MIB_FRAGCREATES, /* FragCreates */ + IPSTATS_MIB_INMCASTPKTS, /* InMcastPkts */ + IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ + IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ + IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ + __IPSTATS_MIB_MAX +}; + +/* icmp mib definitions */ +/* + * RFC 1213: MIB-II ICMP Group + * RFC 2011 (updates 1213): SNMPv2 MIB for IP: ICMP group + */ +enum +{ + ICMP_MIB_NUM = 0, + ICMP_MIB_INMSGS, /* InMsgs */ + ICMP_MIB_INERRORS, /* InErrors */ + ICMP_MIB_INDESTUNREACHS, /* InDestUnreachs */ + ICMP_MIB_INTIMEEXCDS, /* InTimeExcds */ + ICMP_MIB_INPARMPROBS, /* InParmProbs */ + ICMP_MIB_INSRCQUENCHS, /* InSrcQuenchs */ + ICMP_MIB_INREDIRECTS, /* InRedirects */ + ICMP_MIB_INECHOS, /* InEchos */ + ICMP_MIB_INECHOREPS, /* InEchoReps */ + ICMP_MIB_INTIMESTAMPS, /* InTimestamps */ + ICMP_MIB_INTIMESTAMPREPS, /* InTimestampReps */ + ICMP_MIB_INADDRMASKS, /* InAddrMasks */ + ICMP_MIB_INADDRMASKREPS, /* InAddrMaskReps */ + ICMP_MIB_OUTMSGS, /* OutMsgs */ + ICMP_MIB_OUTERRORS, /* OutErrors */ + ICMP_MIB_OUTDESTUNREACHS, /* OutDestUnreachs */ + ICMP_MIB_OUTTIMEEXCDS, /* OutTimeExcds */ + ICMP_MIB_OUTPARMPROBS, /* OutParmProbs */ + ICMP_MIB_OUTSRCQUENCHS, /* OutSrcQuenchs */ + ICMP_MIB_OUTREDIRECTS, /* OutRedirects */ + ICMP_MIB_OUTECHOS, /* OutEchos */ + ICMP_MIB_OUTECHOREPS, /* OutEchoReps */ + ICMP_MIB_OUTTIMESTAMPS, /* OutTimestamps */ + ICMP_MIB_OUTTIMESTAMPREPS, /* OutTimestampReps */ + ICMP_MIB_OUTADDRMASKS, /* OutAddrMasks */ + ICMP_MIB_OUTADDRMASKREPS, /* OutAddrMaskReps */ + __ICMP_MIB_MAX +}; + +#define __ICMPMSG_MIB_MAX 512 /* Out+In for all 8-bit ICMP types */ + +/* icmp6 mib definitions */ +/* + * RFC 2466: ICMPv6-MIB + */ +enum +{ + ICMP6_MIB_NUM = 0, + ICMP6_MIB_INMSGS, /* InMsgs */ + ICMP6_MIB_INERRORS, /* InErrors */ + ICMP6_MIB_OUTMSGS, /* OutMsgs */ + __ICMP6_MIB_MAX +}; + +#define __ICMP6MSG_MIB_MAX 512 /* Out+In for all 8-bit ICMPv6 types */ + +/* tcp mib definitions */ +/* + * RFC 1213: MIB-II TCP group + * RFC 2012 (updates 1213): SNMPv2-MIB-TCP + */ +enum +{ + TCP_MIB_NUM = 0, + TCP_MIB_RTOALGORITHM, /* RtoAlgorithm */ + TCP_MIB_RTOMIN, /* RtoMin */ + TCP_MIB_RTOMAX, /* RtoMax */ + TCP_MIB_MAXCONN, /* MaxConn */ + TCP_MIB_ACTIVEOPENS, /* ActiveOpens */ + TCP_MIB_PASSIVEOPENS, /* PassiveOpens */ + TCP_MIB_ATTEMPTFAILS, /* AttemptFails */ + TCP_MIB_ESTABRESETS, /* EstabResets */ + TCP_MIB_CURRESTAB, /* CurrEstab */ + TCP_MIB_INSEGS, /* InSegs */ + TCP_MIB_OUTSEGS, /* OutSegs */ + TCP_MIB_RETRANSSEGS, /* RetransSegs */ + TCP_MIB_INERRS, /* InErrs */ + TCP_MIB_OUTRSTS, /* OutRsts */ + __TCP_MIB_MAX +}; + +/* udp mib definitions */ +/* + * RFC 1213: MIB-II UDP group + * RFC 2013 (updates 1213): SNMPv2-MIB-UDP + */ +enum +{ + UDP_MIB_NUM = 0, + UDP_MIB_INDATAGRAMS, /* InDatagrams */ + UDP_MIB_NOPORTS, /* NoPorts */ + UDP_MIB_INERRORS, /* InErrors */ + UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ + UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ + UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ + __UDP_MIB_MAX +}; + +/* linux mib definitions */ +enum +{ + LINUX_MIB_NUM = 0, + LINUX_MIB_SYNCOOKIESSENT, /* SyncookiesSent */ + LINUX_MIB_SYNCOOKIESRECV, /* SyncookiesRecv */ + LINUX_MIB_SYNCOOKIESFAILED, /* SyncookiesFailed */ + LINUX_MIB_EMBRYONICRSTS, /* EmbryonicRsts */ + LINUX_MIB_PRUNECALLED, /* PruneCalled */ + LINUX_MIB_RCVPRUNED, /* RcvPruned */ + LINUX_MIB_OFOPRUNED, /* OfoPruned */ + LINUX_MIB_OUTOFWINDOWICMPS, /* OutOfWindowIcmps */ + LINUX_MIB_LOCKDROPPEDICMPS, /* LockDroppedIcmps */ + LINUX_MIB_ARPFILTER, /* ArpFilter */ + LINUX_MIB_TIMEWAITED, /* TimeWaited */ + LINUX_MIB_TIMEWAITRECYCLED, /* TimeWaitRecycled */ + LINUX_MIB_TIMEWAITKILLED, /* TimeWaitKilled */ + LINUX_MIB_PAWSPASSIVEREJECTED, /* PAWSPassiveRejected */ + LINUX_MIB_PAWSACTIVEREJECTED, /* PAWSActiveRejected */ + LINUX_MIB_PAWSESTABREJECTED, /* PAWSEstabRejected */ + LINUX_MIB_DELAYEDACKS, /* DelayedACKs */ + LINUX_MIB_DELAYEDACKLOCKED, /* DelayedACKLocked */ + LINUX_MIB_DELAYEDACKLOST, /* DelayedACKLost */ + LINUX_MIB_LISTENOVERFLOWS, /* ListenOverflows */ + LINUX_MIB_LISTENDROPS, /* ListenDrops */ + LINUX_MIB_TCPPREQUEUED, /* TCPPrequeued */ + LINUX_MIB_TCPDIRECTCOPYFROMBACKLOG, /* TCPDirectCopyFromBacklog */ + LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE, /* TCPDirectCopyFromPrequeue */ + LINUX_MIB_TCPPREQUEUEDROPPED, /* TCPPrequeueDropped */ + LINUX_MIB_TCPHPHITS, /* TCPHPHits */ + LINUX_MIB_TCPHPHITSTOUSER, /* TCPHPHitsToUser */ + LINUX_MIB_TCPPUREACKS, /* TCPPureAcks */ + LINUX_MIB_TCPHPACKS, /* TCPHPAcks */ + LINUX_MIB_TCPRENORECOVERY, /* TCPRenoRecovery */ + LINUX_MIB_TCPSACKRECOVERY, /* TCPSackRecovery */ + LINUX_MIB_TCPSACKRENEGING, /* TCPSACKReneging */ + LINUX_MIB_TCPFACKREORDER, /* TCPFACKReorder */ + LINUX_MIB_TCPSACKREORDER, /* TCPSACKReorder */ + LINUX_MIB_TCPRENOREORDER, /* TCPRenoReorder */ + LINUX_MIB_TCPTSREORDER, /* TCPTSReorder */ + LINUX_MIB_TCPFULLUNDO, /* TCPFullUndo */ + LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */ + LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */ + LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */ + LINUX_MIB_TCPLOSS, /* TCPLoss */ + LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */ + LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */ + LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */ + LINUX_MIB_TCPLOSSFAILURES, /* TCPLossFailures */ + LINUX_MIB_TCPFASTRETRANS, /* TCPFastRetrans */ + LINUX_MIB_TCPFORWARDRETRANS, /* TCPForwardRetrans */ + LINUX_MIB_TCPSLOWSTARTRETRANS, /* TCPSlowStartRetrans */ + LINUX_MIB_TCPTIMEOUTS, /* TCPTimeouts */ + LINUX_MIB_TCPRENORECOVERYFAIL, /* TCPRenoRecoveryFail */ + LINUX_MIB_TCPSACKRECOVERYFAIL, /* TCPSackRecoveryFail */ + LINUX_MIB_TCPSCHEDULERFAILED, /* TCPSchedulerFailed */ + LINUX_MIB_TCPRCVCOLLAPSED, /* TCPRcvCollapsed */ + LINUX_MIB_TCPDSACKOLDSENT, /* TCPDSACKOldSent */ + LINUX_MIB_TCPDSACKOFOSENT, /* TCPDSACKOfoSent */ + LINUX_MIB_TCPDSACKRECV, /* TCPDSACKRecv */ + LINUX_MIB_TCPDSACKOFORECV, /* TCPDSACKOfoRecv */ + LINUX_MIB_TCPABORTONSYN, /* TCPAbortOnSyn */ + LINUX_MIB_TCPABORTONDATA, /* TCPAbortOnData */ + LINUX_MIB_TCPABORTONCLOSE, /* TCPAbortOnClose */ + LINUX_MIB_TCPABORTONMEMORY, /* TCPAbortOnMemory */ + LINUX_MIB_TCPABORTONTIMEOUT, /* TCPAbortOnTimeout */ + LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */ + LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */ + LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */ + LINUX_MIB_TCPSACKDISCARD, /* TCPSACKDiscard */ + LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ + LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ + LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ + LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ + LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ + LINUX_MIB_SACKSHIFTED, + LINUX_MIB_SACKMERGED, + LINUX_MIB_SACKSHIFTFALLBACK, + __LINUX_MIB_MAX +}; + +/* linux Xfrm mib definitions */ +enum +{ + LINUX_MIB_XFRMNUM = 0, + LINUX_MIB_XFRMINERROR, /* XfrmInError */ + LINUX_MIB_XFRMINBUFFERERROR, /* XfrmInBufferError */ + LINUX_MIB_XFRMINHDRERROR, /* XfrmInHdrError */ + LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */ + LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */ + LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */ + LINUX_MIB_XFRMINSTATESEQERROR, /* XfrmInStateSeqError */ + LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */ + LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */ + LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */ + LINUX_MIB_XFRMINTMPLMISMATCH, /* XfrmInTmplMismatch */ + LINUX_MIB_XFRMINNOPOLS, /* XfrmInNoPols */ + LINUX_MIB_XFRMINPOLBLOCK, /* XfrmInPolBlock */ + LINUX_MIB_XFRMINPOLERROR, /* XfrmInPolError */ + LINUX_MIB_XFRMOUTERROR, /* XfrmOutError */ + LINUX_MIB_XFRMOUTBUNDLEGENERROR, /* XfrmOutBundleGenError */ + LINUX_MIB_XFRMOUTBUNDLECHECKERROR, /* XfrmOutBundleCheckError */ + LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */ + LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */ + LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */ + LINUX_MIB_XFRMOUTSTATESEQERROR, /* XfrmOutStateSeqError */ + LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */ + LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ + LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ + LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ + __LINUX_MIB_XFRMMAX +}; + +#endif /* _LINUX_SNMP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/socket.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/socket.h new file mode 100644 index 0000000..038c98a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/socket.h @@ -0,0 +1,303 @@ +#ifndef _LINUX_SOCKET_H +#define _LINUX_SOCKET_H + +/* + * Desired design of maximum size and alignment (see RFC2553) + */ +#define _K_SS_MAXSIZE 128 /* Implementation specific max size */ +#define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) + /* Implementation specific desired alignment */ + +struct __kernel_sockaddr_storage { + unsigned short ss_family; /* address family */ + /* Following field(s) are implementation specific */ + char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; + /* space to achieve desired size, */ + /* _SS_MAXSIZE value minus size of ss_family */ +} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + +#include /* arch-dependent defines */ +#include /* the SIOCxxx I/O controls */ +#include /* iovec support */ +#include /* pid_t */ + /* */ + + +typedef unsigned short sa_family_t; + +/* + * 1003.1g requires sa_family_t and that sa_data is char. + */ + +struct sockaddr { + sa_family_t sa_family; /* address family, AF_xxx */ + char sa_data[14]; /* 14 bytes of protocol address */ +}; + +struct linger { + int l_onoff; /* Linger active */ + int l_linger; /* How long to linger for */ +}; + +#define sockaddr_storage __kernel_sockaddr_storage + +/* + * As we do 4.4BSD message passing we use a 4.4BSD message passing + * system, not 4.3. Thus msg_accrights(len) are now missing. They + * belong in an obscure libc emulation or the bin. + */ + +struct msghdr { + void * msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + struct iovec * msg_iov; /* Data blocks */ + __kernel_size_t msg_iovlen; /* Number of blocks */ + void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ + __kernel_size_t msg_controllen; /* Length of cmsg list */ + unsigned msg_flags; +}; + +/* + * POSIX 1003.1g - ancillary data object information + * Ancillary data consits of a sequence of pairs of + * (cmsghdr, cmsg_data[]) + */ + +struct cmsghdr { + __kernel_size_t cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +}; + +/* + * Ancilliary data object information MACROS + * Table 5-14 of POSIX 1003.1g + */ + +#define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg)) +#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg)) + +#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) + +#define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)))) +#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) +#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) + +#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? \ + (struct cmsghdr *)(ctl) : \ + (struct cmsghdr *)NULL) +#define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen) +#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \ + (cmsg)->cmsg_len <= (unsigned long) \ + ((mhdr)->msg_controllen - \ + ((char *)(cmsg) - (char *)(mhdr)->msg_control))) + +/* + * This mess will go away with glibc + */ + +#if defined(__GNUC__) +#define __KINLINE static __inline__ +#elif defined(__cplusplus) +#define __KINLINE static __inline__ +#else +#define __KINLINE static +#endif + + +/* + * Get the next cmsg header + * + * PLEASE, do not touch this function. If you think, that it is + * incorrect, grep kernel sources and think about consequences + * before trying to improve it. + * + * Now it always returns valid, not truncated ancillary object + * HEADER. But caller still MUST check, that cmsg->cmsg_len is + * inside range, given by msg->msg_controllen before using + * ancillary object DATA. --ANK (980731) + */ + +__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, + struct cmsghdr *__cmsg) +{ + struct cmsghdr * __ptr; + + __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len)); + if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size) + return (struct cmsghdr *)0; + + return __ptr; +} + +__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) +{ + return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); +} + +/* "Socket"-level control message types: */ + +#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ +#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */ +#define SCM_SECURITY 0x03 /* rw: security label */ + +struct ucred { + __u32 pid; + __u32 uid; + __u32 gid; +}; + +/* Supported address families. */ +#define AF_UNSPEC 0 +#define AF_UNIX 1 /* Unix domain sockets */ +#define AF_LOCAL 1 /* POSIX name for AF_UNIX */ +#define AF_INET 2 /* Internet IP Protocol */ +#define AF_AX25 3 /* Amateur Radio AX.25 */ +#define AF_IPX 4 /* Novell IPX */ +#define AF_APPLETALK 5 /* AppleTalk DDP */ +#define AF_NETROM 6 /* Amateur Radio NET/ROM */ +#define AF_BRIDGE 7 /* Multiprotocol bridge */ +#define AF_ATMPVC 8 /* ATM PVCs */ +#define AF_X25 9 /* Reserved for X.25 project */ +#define AF_INET6 10 /* IP version 6 */ +#define AF_ROSE 11 /* Amateur Radio X.25 PLP */ +#define AF_DECnet 12 /* Reserved for DECnet project */ +#define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/ +#define AF_SECURITY 14 /* Security callback pseudo AF */ +#define AF_KEY 15 /* PF_KEY key management API */ +#define AF_NETLINK 16 +#define AF_ROUTE AF_NETLINK /* Alias to emulate 4.4BSD */ +#define AF_PACKET 17 /* Packet family */ +#define AF_ASH 18 /* Ash */ +#define AF_ECONET 19 /* Acorn Econet */ +#define AF_ATMSVC 20 /* ATM SVCs */ +#define AF_RDS 21 /* RDS sockets */ +#define AF_SNA 22 /* Linux SNA Project (nutters!) */ +#define AF_IRDA 23 /* IRDA sockets */ +#define AF_PPPOX 24 /* PPPoX sockets */ +#define AF_WANPIPE 25 /* Wanpipe API Sockets */ +#define AF_LLC 26 /* Linux LLC */ +#define AF_CAN 29 /* Controller Area Network */ +#define AF_TIPC 30 /* TIPC sockets */ +#define AF_BLUETOOTH 31 /* Bluetooth sockets */ +#define AF_IUCV 32 /* IUCV sockets */ +#define AF_RXRPC 33 /* RxRPC sockets */ +#define AF_ISDN 34 /* mISDN sockets */ +#define AF_PHONET 35 /* Phonet sockets */ +#define AF_MAX 36 /* For now.. */ + +/* Protocol families, same as address families. */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_LOCAL AF_LOCAL +#define PF_INET AF_INET +#define PF_AX25 AF_AX25 +#define PF_IPX AF_IPX +#define PF_APPLETALK AF_APPLETALK +#define PF_NETROM AF_NETROM +#define PF_BRIDGE AF_BRIDGE +#define PF_ATMPVC AF_ATMPVC +#define PF_X25 AF_X25 +#define PF_INET6 AF_INET6 +#define PF_ROSE AF_ROSE +#define PF_DECnet AF_DECnet +#define PF_NETBEUI AF_NETBEUI +#define PF_SECURITY AF_SECURITY +#define PF_KEY AF_KEY +#define PF_NETLINK AF_NETLINK +#define PF_ROUTE AF_ROUTE +#define PF_PACKET AF_PACKET +#define PF_ASH AF_ASH +#define PF_ECONET AF_ECONET +#define PF_ATMSVC AF_ATMSVC +#define PF_RDS AF_RDS +#define PF_SNA AF_SNA +#define PF_IRDA AF_IRDA +#define PF_PPPOX AF_PPPOX +#define PF_WANPIPE AF_WANPIPE +#define PF_LLC AF_LLC +#define PF_CAN AF_CAN +#define PF_TIPC AF_TIPC +#define PF_BLUETOOTH AF_BLUETOOTH +#define PF_IUCV AF_IUCV +#define PF_RXRPC AF_RXRPC +#define PF_ISDN AF_ISDN +#define PF_PHONET AF_PHONET +#define PF_MAX AF_MAX + +/* Maximum queue length specifiable by listen. */ +#define SOMAXCONN 128 + +/* Flags we can use with send/ and recv. + Added those for 1003.1g not all are supported yet + */ + +#define MSG_OOB 1 +#define MSG_PEEK 2 +#define MSG_DONTROUTE 4 +#define MSG_TRYHARD 4 /* Synonym for MSG_DONTROUTE for DECnet */ +#define MSG_CTRUNC 8 +#define MSG_PROBE 0x10 /* Do not send. Only probe path f.e. for MTU */ +#define MSG_TRUNC 0x20 +#define MSG_DONTWAIT 0x40 /* Nonblocking io */ +#define MSG_EOR 0x80 /* End of record */ +#define MSG_WAITALL 0x100 /* Wait for a full request */ +#define MSG_FIN 0x200 +#define MSG_SYN 0x400 +#define MSG_CONFIRM 0x800 /* Confirm path validity */ +#define MSG_RST 0x1000 +#define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */ +#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ +#define MSG_MORE 0x8000 /* Sender will send more */ + +#define MSG_EOF MSG_FIN + +#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file + descriptor received through + SCM_RIGHTS */ +#if defined(CONFIG_COMPAT) +#define MSG_CMSG_COMPAT 0x80000000 /* This message needs 32 bit fixups */ +#else +#define MSG_CMSG_COMPAT 0 /* We never have 32 bit fixups */ +#endif + + +/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ +#define SOL_IP 0 +/* #define SOL_ICMP 1 No-no-no! Due to Linux :-) we cannot use SOL_ICMP=1 */ +#define SOL_TCP 6 +#define SOL_UDP 17 +#define SOL_IPV6 41 +#define SOL_ICMPV6 58 +#define SOL_SCTP 132 +#define SOL_UDPLITE 136 /* UDP-Lite (RFC 3828) */ +#define SOL_RAW 255 +#define SOL_IPX 256 +#define SOL_AX25 257 +#define SOL_ATALK 258 +#define SOL_NETROM 259 +#define SOL_ROSE 260 +#define SOL_DECNET 261 +#define SOL_X25 262 +#define SOL_PACKET 263 +#define SOL_ATM 264 /* ATM layer (cell level) */ +#define SOL_AAL 265 /* ATM Adaption Layer (packet level) */ +#define SOL_IRDA 266 +#define SOL_NETBEUI 267 +#define SOL_LLC 268 +#define SOL_DCCP 269 +#define SOL_NETLINK 270 +#define SOL_TIPC 271 +#define SOL_RXRPC 272 +#define SOL_PPPOL2TP 273 +#define SOL_BLUETOOTH 274 +#define SOL_PNPIPE 275 +#define SOL_RDS 276 + +/* IPX options */ +#define IPX_TYPE 1 + +#endif /* not kernel and not glibc */ +#endif /* _LINUX_SOCKET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sockios.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sockios.h new file mode 100644 index 0000000..241f179 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sockios.h @@ -0,0 +1,146 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions of the socket-level I/O control calls. + * + * Version: @(#)sockios.h 1.0.2 03/09/93 + * + * Authors: Ross Biro + * Fred N. van Kempen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_SOCKIOS_H +#define _LINUX_SOCKIOS_H + +#include + +/* Linux-specific socket ioctls */ +#define SIOCINQ FIONREAD +#define SIOCOUTQ TIOCOUTQ + +/* Routing table calls. */ +#define SIOCADDRT 0x890B /* add routing table entry */ +#define SIOCDELRT 0x890C /* delete routing table entry */ +#define SIOCRTMSG 0x890D /* call to routing system */ + +/* Socket configuration controls. */ +#define SIOCGIFNAME 0x8910 /* get iface name */ +#define SIOCSIFLINK 0x8911 /* set iface channel */ +#define SIOCGIFCONF 0x8912 /* get iface list */ +#define SIOCGIFFLAGS 0x8913 /* get flags */ +#define SIOCSIFFLAGS 0x8914 /* set flags */ +#define SIOCGIFADDR 0x8915 /* get PA address */ +#define SIOCSIFADDR 0x8916 /* set PA address */ +#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ +#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ +#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ +#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ +#define SIOCGIFNETMASK 0x891b /* get network PA mask */ +#define SIOCSIFNETMASK 0x891c /* set network PA mask */ +#define SIOCGIFMETRIC 0x891d /* get metric */ +#define SIOCSIFMETRIC 0x891e /* set metric */ +#define SIOCGIFMEM 0x891f /* get memory address (BSD) */ +#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ +#define SIOCGIFMTU 0x8921 /* get MTU size */ +#define SIOCSIFMTU 0x8922 /* set MTU size */ +#define SIOCSIFNAME 0x8923 /* set interface name */ +#define SIOCSIFHWADDR 0x8924 /* set hardware address */ +#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 /* Get hardware address */ +#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 /* Multicast address lists */ +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ +#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ +#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 /* delete PA address */ +#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ +#define SIOCGIFCOUNT 0x8938 /* get number of devices */ + +#define SIOCGIFBR 0x8940 /* Bridging support */ +#define SIOCSIFBR 0x8941 /* Set bridging options */ + +#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ +#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ + +/* SIOCGIFDIVERT was: 0x8944 Frame diversion support */ +/* SIOCSIFDIVERT was: 0x8945 Set frame diversion options */ + +#define SIOCETHTOOL 0x8946 /* Ethtool interface */ + +#define SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */ +#define SIOCGMIIREG 0x8948 /* Read MII PHY register. */ +#define SIOCSMIIREG 0x8949 /* Write MII PHY register. */ + +#define SIOCWANDEV 0x894A /* get/set netdev parameters */ + +/* ARP cache control calls. */ + /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ +#define SIOCDARP 0x8953 /* delete ARP table entry */ +#define SIOCGARP 0x8954 /* get ARP table entry */ +#define SIOCSARP 0x8955 /* set ARP table entry */ + +/* RARP cache control calls. */ +#define SIOCDRARP 0x8960 /* delete RARP table entry */ +#define SIOCGRARP 0x8961 /* get RARP table entry */ +#define SIOCSRARP 0x8962 /* set RARP table entry */ + +/* Driver configuration calls */ + +#define SIOCGIFMAP 0x8970 /* Get device parameters */ +#define SIOCSIFMAP 0x8971 /* Set device parameters */ + +/* DLCI configuration calls */ + +#define SIOCADDDLCI 0x8980 /* Create new DLCI device */ +#define SIOCDELDLCI 0x8981 /* Delete DLCI device */ + +#define SIOCGIFVLAN 0x8982 /* 802.1Q VLAN support */ +#define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ + +/* bonding calls */ + +#define SIOCBONDENSLAVE 0x8990 /* enslave a device to the bond */ +#define SIOCBONDRELEASE 0x8991 /* release a slave from the bond*/ +#define SIOCBONDSETHWADDR 0x8992 /* set the hw addr of the bond */ +#define SIOCBONDSLAVEINFOQUERY 0x8993 /* rtn info about slave state */ +#define SIOCBONDINFOQUERY 0x8994 /* rtn info about bond state */ +#define SIOCBONDCHANGEACTIVE 0x8995 /* update to a new active slave */ + +/* bridge calls */ +#define SIOCBRADDBR 0x89a0 /* create new bridge device */ +#define SIOCBRDELBR 0x89a1 /* remove bridge device */ +#define SIOCBRADDIF 0x89a2 /* add interface to bridge */ +#define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ + +/* hardware time stamping: parameters in linux/net_tstamp.h */ +#define SIOCSHWTSTAMP 0x89b0 + +/* Device private ioctl calls */ + +/* + * These 16 ioctls are available to devices via the do_ioctl() device + * vector. Each device should include this file and redefine these names + * as their own. Because these are device dependent it is a good idea + * _NOT_ to issue them to random objects and hope. + * + * THESE IOCTLS ARE _DEPRECATED_ AND WILL DISAPPEAR IN 2.5.X -DaveM + */ + +#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ + +/* + * These 16 ioctl calls are protocol private + */ + +#define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ +#endif /* _LINUX_SOCKIOS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/som.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/som.h new file mode 100644 index 0000000..166594e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/som.h @@ -0,0 +1,154 @@ +#ifndef _LINUX_SOM_H +#define _LINUX_SOM_H + +/* File format definition for SOM executables / shared libraries */ + +/* we need struct timespec */ +#include + +#define SOM_PAGESIZE 4096 + +/* this is the SOM header */ +struct som_hdr { + short system_id; /* magic number - system */ + short a_magic; /* magic number - file type */ + unsigned int version_id; /* versiod ID: YYMMDDHH */ + struct timespec file_time; /* system clock */ + unsigned int entry_space; /* space for entry point */ + unsigned int entry_subspace; /* subspace for entry point */ + unsigned int entry_offset; /* offset of entry point */ + unsigned int aux_header_location; /* auxiliary header location */ + unsigned int aux_header_size; /* auxiliary header size */ + unsigned int som_length; /* length of entire SOM */ + unsigned int presumed_dp; /* compiler's DP value */ + unsigned int space_location; /* space dictionary location */ + unsigned int space_total; /* number of space entries */ + unsigned int subspace_location; /* subspace entries location */ + unsigned int subspace_total; /* number of subspace entries */ + unsigned int loader_fixup_location; /* MPE/iX loader fixup */ + unsigned int loader_fixup_total; /* number of fixup records */ + unsigned int space_strings_location; /* (sub)space names */ + unsigned int space_strings_size; /* size of strings area */ + unsigned int init_array_location; /* reserved */ + unsigned int init_array_total; /* reserved */ + unsigned int compiler_location; /* module dictionary */ + unsigned int compiler_total; /* number of modules */ + unsigned int symbol_location; /* symbol dictionary */ + unsigned int symbol_total; /* number of symbols */ + unsigned int fixup_request_location; /* fixup requests */ + unsigned int fixup_request_total; /* number of fixup requests */ + unsigned int symbol_strings_location;/* module & symbol names area */ + unsigned int symbol_strings_size; /* size of strings area */ + unsigned int unloadable_sp_location; /* unloadable spaces location */ + unsigned int unloadable_sp_size; /* size of data */ + unsigned int checksum; +}; + +/* values for system_id */ + +#define SOM_SID_PARISC_1_0 0x020b +#define SOM_SID_PARISC_1_1 0x0210 +#define SOM_SID_PARISC_2_0 0x0214 + +/* values for a_magic */ + +#define SOM_LIB_EXEC 0x0104 +#define SOM_RELOCATABLE 0x0106 +#define SOM_EXEC_NONSHARE 0x0107 +#define SOM_EXEC_SHARE 0x0108 +#define SOM_EXEC_DEMAND 0x010B +#define SOM_LIB_DYN 0x010D +#define SOM_LIB_SHARE 0x010E +#define SOM_LIB_RELOC 0x0619 + +/* values for version_id. Decimal not hex, yes. Grr. */ + +#define SOM_ID_OLD 85082112 +#define SOM_ID_NEW 87102412 + +struct aux_id { + unsigned int mandatory :1; /* the linker must understand this */ + unsigned int copy :1; /* Must be copied by the linker */ + unsigned int append :1; /* Must be merged by the linker */ + unsigned int ignore :1; /* Discard section if unknown */ + unsigned int reserved :12; + unsigned int type :16; /* Header type */ + unsigned int length; /* length of _following_ data */ +}; + +/* The Exec Auxiliary Header. Called The HP-UX Header within HP apparently. */ +struct som_exec_auxhdr { + struct aux_id som_auxhdr; + int exec_tsize; /* Text size in bytes */ + int exec_tmem; /* Address to load text at */ + int exec_tfile; /* Location of text in file */ + int exec_dsize; /* Data size in bytes */ + int exec_dmem; /* Address to load data at */ + int exec_dfile; /* Location of data in file */ + int exec_bsize; /* Uninitialised data (bss) */ + int exec_entry; /* Address to start executing */ + int exec_flags; /* loader flags */ + int exec_bfill; /* initialisation value for bss */ +}; + +/* Oh, the things people do to avoid casts. Shame it'll break with gcc's + * new aliasing rules really. + */ +union name_pt { + char * n_name; + unsigned int n_strx; +}; + +/* The Space Dictionary */ +struct space_dictionary_record { + union name_pt name; /* index to subspace name */ + unsigned int is_loadable :1; /* loadable */ + unsigned int is_defined :1; /* defined within file */ + unsigned int is_private :1; /* not sharable */ + unsigned int has_intermediate_code :1; /* contains intermediate code */ + unsigned int is_tspecific :1; /* thread specific */ + unsigned int reserved :11; /* for future expansion */ + unsigned int sort_key :8; /* for linker */ + unsigned int reserved2 :8; /* for future expansion */ + + int space_number; /* index */ + int subspace_index; /* index into subspace dict */ + unsigned int subspace_quantity; /* number of subspaces */ + int loader_fix_index; /* for loader */ + unsigned int loader_fix_quantity; /* for loader */ + int init_pointer_index; /* data pointer array index */ + unsigned int init_pointer_quantity; /* number of data pointers */ +}; + +/* The Subspace Dictionary */ +struct subspace_dictionary_record { + int space_index; + unsigned int access_control_bits :7; + unsigned int memory_resident :1; + unsigned int dup_common :1; + unsigned int is_common :1; + unsigned int quadrant :2; + unsigned int initially_frozen :1; + unsigned int is_first :1; + unsigned int code_only :1; + unsigned int sort_key :8; + unsigned int replicate_init :1; + unsigned int continuation :1; + unsigned int is_tspecific :1; + unsigned int is_comdat :1; + unsigned int reserved :4; + + int file_loc_init_value; + unsigned int initialization_length; + unsigned int subspace_start; + unsigned int subspace_length; + + unsigned int reserved2 :5; + unsigned int alignment :27; + + union name_pt name; + int fixup_request_index; + unsigned int fixup_request_quantity; +}; + +#endif /* _LINUX_SOM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sonet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sonet.h new file mode 100644 index 0000000..cd68293 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sonet.h @@ -0,0 +1,60 @@ +/* sonet.h - SONET/SHD physical layer control */ + +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ + + +#ifndef LINUX_SONET_H +#define LINUX_SONET_H + +#define __SONET_ITEMS \ + __HANDLE_ITEM(section_bip); /* section parity errors (B1) */ \ + __HANDLE_ITEM(line_bip); /* line parity errors (B2) */ \ + __HANDLE_ITEM(path_bip); /* path parity errors (B3) */ \ + __HANDLE_ITEM(line_febe); /* line parity errors at remote */ \ + __HANDLE_ITEM(path_febe); /* path parity errors at remote */ \ + __HANDLE_ITEM(corr_hcs); /* correctable header errors */ \ + __HANDLE_ITEM(uncorr_hcs); /* uncorrectable header errors */ \ + __HANDLE_ITEM(tx_cells); /* cells sent */ \ + __HANDLE_ITEM(rx_cells); /* cells received */ + +struct sonet_stats { +#define __HANDLE_ITEM(i) int i + __SONET_ITEMS +#undef __HANDLE_ITEM +} __attribute__ ((packed)); + + +#define SONET_GETSTAT _IOR('a',ATMIOC_PHYTYP,struct sonet_stats) + /* get statistics */ +#define SONET_GETSTATZ _IOR('a',ATMIOC_PHYTYP+1,struct sonet_stats) + /* ... and zero counters */ +#define SONET_SETDIAG _IOWR('a',ATMIOC_PHYTYP+2,int) + /* set error insertion */ +#define SONET_CLRDIAG _IOWR('a',ATMIOC_PHYTYP+3,int) + /* clear error insertion */ +#define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int) + /* query error insertion */ +#define SONET_SETFRAMING _IOW('a',ATMIOC_PHYTYP+5,int) + /* set framing mode (SONET/SDH) */ +#define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int) + /* get framing mode */ +#define SONET_GETFRSENSE _IOR('a',ATMIOC_PHYTYP+7, \ + unsigned char[SONET_FRSENSE_SIZE]) /* get framing sense information */ + +#define SONET_INS_SBIP 1 /* section BIP */ +#define SONET_INS_LBIP 2 /* line BIP */ +#define SONET_INS_PBIP 4 /* path BIP */ +#define SONET_INS_FRAME 8 /* out of frame */ +#define SONET_INS_LOS 16 /* set line to zero */ +#define SONET_INS_LAIS 32 /* line alarm indication signal */ +#define SONET_INS_PAIS 64 /* path alarm indication signal */ +#define SONET_INS_HCS 128 /* insert HCS error */ + +#define SONET_FRAME_SONET 0 /* SONET STS-3 framing */ +#define SONET_FRAME_SDH 1 /* SDH STM-1 framing */ + +#define SONET_FRSENSE_SIZE 6 /* C1[3],H1[3] (0xff for unknown) */ + + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sonypi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sonypi.h new file mode 100644 index 0000000..a6f2c90 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sonypi.h @@ -0,0 +1,143 @@ +/* + * Sony Programmable I/O Control Device driver for VAIO + * + * Copyright (C) 2001-2005 Stelian Pop + * + * Copyright (C) 2005 Narayanan R S + + * Copyright (C) 2001-2002 Alcôve + * + * Copyright (C) 2001 Michael Ashley + * + * Copyright (C) 2001 Junichi Morita + * + * Copyright (C) 2000 Takaya Kinjo + * + * Copyright (C) 2000 Andrew Tridgell + * + * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef _SONYPI_H_ +#define _SONYPI_H_ + +#include + +/* events the user application reading /dev/sonypi can use */ + +#define SONYPI_EVENT_JOGDIAL_DOWN 1 +#define SONYPI_EVENT_JOGDIAL_UP 2 +#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3 +#define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4 +#define SONYPI_EVENT_JOGDIAL_PRESSED 5 +#define SONYPI_EVENT_JOGDIAL_RELEASED 6 /* obsolete */ +#define SONYPI_EVENT_CAPTURE_PRESSED 7 +#define SONYPI_EVENT_CAPTURE_RELEASED 8 /* obsolete */ +#define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9 +#define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10 +#define SONYPI_EVENT_FNKEY_ESC 11 +#define SONYPI_EVENT_FNKEY_F1 12 +#define SONYPI_EVENT_FNKEY_F2 13 +#define SONYPI_EVENT_FNKEY_F3 14 +#define SONYPI_EVENT_FNKEY_F4 15 +#define SONYPI_EVENT_FNKEY_F5 16 +#define SONYPI_EVENT_FNKEY_F6 17 +#define SONYPI_EVENT_FNKEY_F7 18 +#define SONYPI_EVENT_FNKEY_F8 19 +#define SONYPI_EVENT_FNKEY_F9 20 +#define SONYPI_EVENT_FNKEY_F10 21 +#define SONYPI_EVENT_FNKEY_F11 22 +#define SONYPI_EVENT_FNKEY_F12 23 +#define SONYPI_EVENT_FNKEY_1 24 +#define SONYPI_EVENT_FNKEY_2 25 +#define SONYPI_EVENT_FNKEY_D 26 +#define SONYPI_EVENT_FNKEY_E 27 +#define SONYPI_EVENT_FNKEY_F 28 +#define SONYPI_EVENT_FNKEY_S 29 +#define SONYPI_EVENT_FNKEY_B 30 +#define SONYPI_EVENT_BLUETOOTH_PRESSED 31 +#define SONYPI_EVENT_PKEY_P1 32 +#define SONYPI_EVENT_PKEY_P2 33 +#define SONYPI_EVENT_PKEY_P3 34 +#define SONYPI_EVENT_BACK_PRESSED 35 +#define SONYPI_EVENT_LID_CLOSED 36 +#define SONYPI_EVENT_LID_OPENED 37 +#define SONYPI_EVENT_BLUETOOTH_ON 38 +#define SONYPI_EVENT_BLUETOOTH_OFF 39 +#define SONYPI_EVENT_HELP_PRESSED 40 +#define SONYPI_EVENT_FNKEY_ONLY 41 +#define SONYPI_EVENT_JOGDIAL_FAST_DOWN 42 +#define SONYPI_EVENT_JOGDIAL_FAST_UP 43 +#define SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED 44 +#define SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED 45 +#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN 46 +#define SONYPI_EVENT_JOGDIAL_VFAST_UP 47 +#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED 48 +#define SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED 49 +#define SONYPI_EVENT_ZOOM_PRESSED 50 +#define SONYPI_EVENT_THUMBPHRASE_PRESSED 51 +#define SONYPI_EVENT_MEYE_FACE 52 +#define SONYPI_EVENT_MEYE_OPPOSITE 53 +#define SONYPI_EVENT_MEMORYSTICK_INSERT 54 +#define SONYPI_EVENT_MEMORYSTICK_EJECT 55 +#define SONYPI_EVENT_ANYBUTTON_RELEASED 56 +#define SONYPI_EVENT_BATTERY_INSERT 57 +#define SONYPI_EVENT_BATTERY_REMOVE 58 +#define SONYPI_EVENT_FNKEY_RELEASED 59 +#define SONYPI_EVENT_WIRELESS_ON 60 +#define SONYPI_EVENT_WIRELESS_OFF 61 +#define SONYPI_EVENT_ZOOM_IN_PRESSED 62 +#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 +#define SONYPI_EVENT_CD_EJECT_PRESSED 64 +#define SONYPI_EVENT_MODEKEY_PRESSED 65 +#define SONYPI_EVENT_PKEY_P4 66 +#define SONYPI_EVENT_PKEY_P5 67 +#define SONYPI_EVENT_SETTINGKEY_PRESSED 68 +#define SONYPI_EVENT_VOLUME_INC_PRESSED 69 +#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 +#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 + +/* get/set brightness */ +#define SONYPI_IOCGBRT _IOR('v', 0, __u8) +#define SONYPI_IOCSBRT _IOW('v', 0, __u8) + +/* get battery full capacity/remaining capacity */ +#define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16) +#define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16) +#define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16) +#define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16) + +/* get battery flags: battery1/battery2/ac adapter present */ +#define SONYPI_BFLAGS_B1 0x01 +#define SONYPI_BFLAGS_B2 0x02 +#define SONYPI_BFLAGS_AC 0x04 +#define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8) + +/* get/set bluetooth subsystem state on/off */ +#define SONYPI_IOCGBLUE _IOR('v', 8, __u8) +#define SONYPI_IOCSBLUE _IOW('v', 9, __u8) + +/* get/set fan state on/off */ +#define SONYPI_IOCGFAN _IOR('v', 10, __u8) +#define SONYPI_IOCSFAN _IOW('v', 11, __u8) + +/* get temperature (C) */ +#define SONYPI_IOCGTEMP _IOR('v', 12, __u8) + + +#endif /* _SONYPI_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sound.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sound.h new file mode 100644 index 0000000..fdd842e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sound.h @@ -0,0 +1,27 @@ + +/* + * Minor numbers for the sound driver. + */ + +#include + +#define SND_DEV_CTL 0 /* Control port /dev/mixer */ +#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM + synthesizer and MIDI output) */ +#define SND_DEV_MIDIN 2 /* Raw midi access */ +#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */ +#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ +#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ +/* #define SND_DEV_STATUS 6 */ /* /dev/sndstat (obsolete) */ +#define SND_DEV_UNUSED 6 +#define SND_DEV_AWFM 7 /* Reserved */ +#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */ +/* #define SND_DEV_SNDPROC 9 */ /* /dev/sndproc for programmable devices (not used) */ +/* #define SND_DEV_DMMIDI 9 */ +#define SND_DEV_SYNTH 9 /* Raw synth access /dev/synth (same as /dev/dmfm) */ +#define SND_DEV_DMFM 10 /* Raw synth access /dev/dmfm */ +#define SND_DEV_UNKNOWN11 11 +#define SND_DEV_ADSP 12 /* Like /dev/dsp (obsolete) */ +#define SND_DEV_AMIDI 13 /* Like /dev/midi (obsolete) */ +#define SND_DEV_ADMMIDI 14 /* Like /dev/dmmidi (onsolete) */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/soundcard.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/soundcard.h new file mode 100644 index 0000000..ba3dea7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/soundcard.h @@ -0,0 +1,1278 @@ +#ifndef SOUNDCARD_H +#define SOUNDCARD_H +/* + * Copyright by Hannu Savolainen 1993-1997 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. 2. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +/* + * OSS interface version. With versions earlier than 3.6 this value is + * an integer with value less than 361. In versions 3.6 and later + * it's a six digit hexadecimal value. For example value + * of 0x030600 represents OSS version 3.6.0. + * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of + * the currently active driver. + */ +#define SOUND_VERSION 0x030802 +#define OPEN_SOUND_SYSTEM + +/* In Linux we need to be prepared for cross compiling */ +#include + +/* Endian macros. */ +# include + +/* + * Supported card ID numbers (Should be somewhere else?) + */ + +#define SNDCARD_ADLIB 1 +#define SNDCARD_SB 2 +#define SNDCARD_PAS 3 +#define SNDCARD_GUS 4 +#define SNDCARD_MPU401 5 +#define SNDCARD_SB16 6 +#define SNDCARD_SB16MIDI 7 +#define SNDCARD_UART6850 8 +#define SNDCARD_GUS16 9 +#define SNDCARD_MSS 10 +#define SNDCARD_PSS 11 +#define SNDCARD_SSCAPE 12 +#define SNDCARD_PSS_MPU 13 +#define SNDCARD_PSS_MSS 14 +#define SNDCARD_SSCAPE_MSS 15 +#define SNDCARD_TRXPRO 16 +#define SNDCARD_TRXPRO_SB 17 +#define SNDCARD_TRXPRO_MPU 18 +#define SNDCARD_MAD16 19 +#define SNDCARD_MAD16_MPU 20 +#define SNDCARD_CS4232 21 +#define SNDCARD_CS4232_MPU 22 +#define SNDCARD_MAUI 23 +#define SNDCARD_PSEUDO_MSS 24 +#define SNDCARD_GUSPNP 25 +#define SNDCARD_UART401 26 +/* Sound card numbers 27 to N are reserved. Don't add more numbers here. */ + +/*********************************** + * IOCTL Commands for /dev/sequencer + */ + +#ifndef _SIOWR +#if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__))) +/* Use already defined ioctl defines if they exist (except with Sun or Sparc) */ +#define SIOCPARM_MASK IOCPARM_MASK +#define SIOC_VOID IOC_VOID +#define SIOC_OUT IOC_OUT +#define SIOC_IN IOC_IN +#define SIOC_INOUT IOC_INOUT +#define _SIOC_SIZE _IOC_SIZE +#define _SIOC_DIR _IOC_DIR +#define _SIOC_NONE _IOC_NONE +#define _SIOC_READ _IOC_READ +#define _SIOC_WRITE _IOC_WRITE +#define _SIO _IO +#define _SIOR _IOR +#define _SIOW _IOW +#define _SIOWR _IOWR +#else + +/* Ioctl's have the command encoded in the lower word, + * and the size of any in or out parameters in the upper + * word. The high 2 bits of the upper word are used + * to encode the in/out status of the parameter; for now + * we restrict parameters to at most 8191 bytes. + */ +/* #define SIOCTYPE (0xff<<8) */ +#define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */ +#define SIOC_VOID 0x00000000 /* no parameters */ +#define SIOC_OUT 0x20000000 /* copy out parameters */ +#define SIOC_IN 0x40000000 /* copy in parameters */ +#define SIOC_INOUT (SIOC_IN|SIOC_OUT) +/* the 0x20000000 is so we can distinguish new ioctl's from old */ +#define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y)) +#define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +/* this should be _SIORW, but stdio got there first */ +#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK) +#define _SIOC_DIR(x) (x & 0xf0000000) +#define _SIOC_NONE SIOC_VOID +#define _SIOC_READ SIOC_OUT +#define _SIOC_WRITE SIOC_IN +# endif /* _IOWR */ +#endif /* !_SIOWR */ + +#define SNDCTL_SEQ_RESET _SIO ('Q', 0) +#define SNDCTL_SEQ_SYNC _SIO ('Q', 1) +#define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info) +#define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */ +#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int) +#define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int) +#define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int) +#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */ +#define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int) +#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int) +#define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int) +#define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int) +#define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info) +#define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int) +#define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */ +#define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */ +#define SNDCTL_SEQ_PANIC _SIO ('Q',17) +#define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec) +#define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int) +#define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info) +#define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control) +#define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample) + +typedef struct synth_control +{ + int devno; /* Synthesizer # */ + char data[4000]; /* Device spesific command/data record */ +}synth_control; + +typedef struct remove_sample +{ + int devno; /* Synthesizer # */ + int bankno; /* MIDI bank # (0=General MIDI) */ + int instrno; /* MIDI instrument number */ +} remove_sample; + +typedef struct seq_event_rec { + unsigned char arr[8]; +} seq_event_rec; + +#define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int) +#define SNDCTL_TMR_START _SIO ('T', 2) +#define SNDCTL_TMR_STOP _SIO ('T', 3) +#define SNDCTL_TMR_CONTINUE _SIO ('T', 4) +#define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int) +#define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int) +# define TMR_INTERNAL 0x00000001 +# define TMR_EXTERNAL 0x00000002 +# define TMR_MODE_MIDI 0x00000010 +# define TMR_MODE_FSK 0x00000020 +# define TMR_MODE_CLS 0x00000040 +# define TMR_MODE_SMPTE 0x00000080 +#define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int) +#define SNDCTL_TMR_SELECT _SIOW ('T', 8, int) + +/* + * Some big endian/little endian handling macros + */ + +#define _LINUX_PATCHKEY_H_INDIRECT +#include +#undef _LINUX_PATCHKEY_H_INDIRECT + +#if defined(__BYTE_ORDER) +# if __BYTE_ORDER == __BIG_ENDIAN +# define AFMT_S16_NE AFMT_S16_BE +# elif __BYTE_ORDER == __LITTLE_ENDIAN +# define AFMT_S16_NE AFMT_S16_LE +# else +# error "could not determine byte order" +# endif +#endif + +/* + * Sample loading mechanism for internal synthesizers (/dev/sequencer) + * The following patch_info structure has been designed to support + * Gravis UltraSound. It tries to be universal format for uploading + * sample based patches but is probably too limited. + * + * (PBD) As Hannu guessed, the GUS structure is too limited for + * the WaveFront, but this is the right place for a constant definition. + */ + +struct patch_info { + unsigned short key; /* Use WAVE_PATCH here */ +#define WAVE_PATCH _PATCHKEY(0x04) +#define GUS_PATCH WAVE_PATCH +#define WAVEFRONT_PATCH _PATCHKEY(0x06) + + short device_no; /* Synthesizer number */ + short instr_no; /* Midi pgm# */ + + unsigned int mode; +/* + * The least significant byte has the same format than the GUS .PAT + * files + */ +#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */ +#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */ +#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */ +#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */ +#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */ +#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/ +#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */ +#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */ + /* (use the env_rate/env_offs fields). */ +/* Linux specific bits */ +#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ +#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ +#define WAVE_SCALE 0x00040000 /* The scaling info is valid */ +#define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */ +/* Reserved bits */ +#define WAVE_ROM 0x40000000 /* For future use */ +#define WAVE_MULAW 0x20000000 /* For future use */ +/* Other bits must be zeroed */ + + int len; /* Size of the wave data in bytes */ + int loop_start, loop_end; /* Byte offsets from the beginning */ + +/* + * The base_freq and base_note fields are used when computing the + * playback speed for a note. The base_note defines the tone frequency + * which is heard if the sample is played using the base_freq as the + * playback speed. + * + * The low_note and high_note fields define the minimum and maximum note + * frequencies for which this sample is valid. It is possible to define + * more than one samples for an instrument number at the same time. The + * low_note and high_note fields are used to select the most suitable one. + * + * The fields base_note, high_note and low_note should contain + * the note frequency multiplied by 1000. For example value for the + * middle A is 440*1000. + */ + + unsigned int base_freq; + unsigned int base_note; + unsigned int high_note; + unsigned int low_note; + int panning; /* -128=left, 127=right */ + int detuning; + +/* New fields introduced in version 1.99.5 */ + + /* Envelope. Enabled by mode bit WAVE_ENVELOPES */ + unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */ + unsigned char env_offset[ 6 ]; /* 255 == 100% */ + + /* + * The tremolo, vibrato and scale info are not supported yet. + * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or + * WAVE_SCALE + */ + + unsigned char tremolo_sweep; + unsigned char tremolo_rate; + unsigned char tremolo_depth; + + unsigned char vibrato_sweep; + unsigned char vibrato_rate; + unsigned char vibrato_depth; + + int scale_frequency; + unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */ + + int volume; + int fractions; + int reserved1; + int spare[2]; + char data[1]; /* The waveform data starts here */ + }; + +struct sysex_info { + short key; /* Use SYSEX_PATCH or MAUI_PATCH here */ +#define SYSEX_PATCH _PATCHKEY(0x05) +#define MAUI_PATCH _PATCHKEY(0x06) + short device_no; /* Synthesizer number */ + int len; /* Size of the sysex data in bytes */ + unsigned char data[1]; /* Sysex data starts here */ + }; + +/* + * /dev/sequencer input events. + * + * The data written to the /dev/sequencer is a stream of events. Events + * are records of 4 or 8 bytes. The first byte defines the size. + * Any number of events can be written with a write call. There + * is a set of macros for sending these events. Use these macros if you + * want to maximize portability of your program. + * + * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. + * (All input events are currently 4 bytes long. Be prepared to support + * 8 byte events also. If you receive any event having first byte >= 128, + * it's a 8 byte event. + * + * The events are documented at the end of this file. + * + * Normal events (4 bytes) + * There is also a 8 byte version of most of the 4 byte events. The + * 8 byte one is recommended. + */ +#define SEQ_NOTEOFF 0 +#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */ +#define SEQ_NOTEON 1 +#define SEQ_FMNOTEON SEQ_NOTEON +#define SEQ_WAIT TMR_WAIT_ABS +#define SEQ_PGMCHANGE 3 +#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE +#define SEQ_SYNCTIMER TMR_START +#define SEQ_MIDIPUTC 5 +#define SEQ_DRUMON 6 /*** OBSOLETE ***/ +#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/ +#define SEQ_ECHO TMR_ECHO /* For synching programs with output */ +#define SEQ_AFTERTOUCH 9 +#define SEQ_CONTROLLER 10 + +/******************************************* + * Midi controller numbers + ******************************************* + * Controllers 0 to 31 (0x00 to 0x1f) and + * 32 to 63 (0x20 to 0x3f) are continuous + * controllers. + * In the MIDI 1.0 these controllers are sent using + * two messages. Controller numbers 0 to 31 are used + * to send the MSB and the controller numbers 32 to 63 + * are for the LSB. Note that just 7 bits are used in MIDI bytes. + */ + +#define CTL_BANK_SELECT 0x00 +#define CTL_MODWHEEL 0x01 +#define CTL_BREATH 0x02 +/* undefined 0x03 */ +#define CTL_FOOT 0x04 +#define CTL_PORTAMENTO_TIME 0x05 +#define CTL_DATA_ENTRY 0x06 +#define CTL_MAIN_VOLUME 0x07 +#define CTL_BALANCE 0x08 +/* undefined 0x09 */ +#define CTL_PAN 0x0a +#define CTL_EXPRESSION 0x0b +/* undefined 0x0c */ +/* undefined 0x0d */ +/* undefined 0x0e */ +/* undefined 0x0f */ +#define CTL_GENERAL_PURPOSE1 0x10 +#define CTL_GENERAL_PURPOSE2 0x11 +#define CTL_GENERAL_PURPOSE3 0x12 +#define CTL_GENERAL_PURPOSE4 0x13 +/* undefined 0x14 - 0x1f */ + +/* undefined 0x20 */ +/* The controller numbers 0x21 to 0x3f are reserved for the */ +/* least significant bytes of the controllers 0x00 to 0x1f. */ +/* These controllers are not recognised by the driver. */ + +/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */ +/* 0=OFF and 127=ON (intermediate values are possible) */ +#define CTL_DAMPER_PEDAL 0x40 +#define CTL_SUSTAIN 0x40 /* Alias */ +#define CTL_HOLD 0x40 /* Alias */ +#define CTL_PORTAMENTO 0x41 +#define CTL_SOSTENUTO 0x42 +#define CTL_SOFT_PEDAL 0x43 +/* undefined 0x44 */ +#define CTL_HOLD2 0x45 +/* undefined 0x46 - 0x4f */ + +#define CTL_GENERAL_PURPOSE5 0x50 +#define CTL_GENERAL_PURPOSE6 0x51 +#define CTL_GENERAL_PURPOSE7 0x52 +#define CTL_GENERAL_PURPOSE8 0x53 +/* undefined 0x54 - 0x5a */ +#define CTL_EXT_EFF_DEPTH 0x5b +#define CTL_TREMOLO_DEPTH 0x5c +#define CTL_CHORUS_DEPTH 0x5d +#define CTL_DETUNE_DEPTH 0x5e +#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */ +#define CTL_PHASER_DEPTH 0x5f +#define CTL_DATA_INCREMENT 0x60 +#define CTL_DATA_DECREMENT 0x61 +#define CTL_NONREG_PARM_NUM_LSB 0x62 +#define CTL_NONREG_PARM_NUM_MSB 0x63 +#define CTL_REGIST_PARM_NUM_LSB 0x64 +#define CTL_REGIST_PARM_NUM_MSB 0x65 +/* undefined 0x66 - 0x78 */ +/* reserved 0x79 - 0x7f */ + +/* Pseudo controllers (not midi compatible) */ +#define CTRL_PITCH_BENDER 255 +#define CTRL_PITCH_BENDER_RANGE 254 +#define CTRL_EXPRESSION 253 /* Obsolete */ +#define CTRL_MAIN_VOLUME 252 /* Obsolete */ +#define SEQ_BALANCE 11 +#define SEQ_VOLMODE 12 + +/* + * Volume mode decides how volumes are used + */ + +#define VOL_METHOD_ADAGIO 1 +#define VOL_METHOD_LINEAR 2 + +/* + * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as + * input events. + */ + +/* + * Event codes 0xf0 to 0xfc are reserved for future extensions. + */ + +#define SEQ_FULLSIZE 0xfd /* Long events */ +/* + * SEQ_FULLSIZE events are used for loading patches/samples to the + * synthesizer devices. These events are passed directly to the driver + * of the associated synthesizer device. There is no limit to the size + * of the extended events. These events are not queued but executed + * immediately when the write() is called (execution can take several + * seconds of time). + * + * When a SEQ_FULLSIZE message is written to the device, it must + * be written using exactly one write() call. Other events cannot + * be mixed to the same write. + * + * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the + * /dev/sequencer. Don't write other data together with the instrument structure + * Set the key field of the structure to FM_PATCH. The device field is used to + * route the patch to the corresponding device. + * + * For wave table use struct patch_info. Initialize the key field + * to WAVE_PATCH. + */ +#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */ +#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */ + +/* + * Record for FM patches + */ + +typedef unsigned char sbi_instr_data[32]; + +struct sbi_instrument { + unsigned short key; /* FM_PATCH or OPL3_PATCH */ +#define FM_PATCH _PATCHKEY(0x01) +#define OPL3_PATCH _PATCHKEY(0x03) + short device; /* Synth# (0-4) */ + int channel; /* Program# to be initialized */ + sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */ + }; + +struct synth_info { /* Read only */ + char name[30]; + int device; /* 0-N. INITIALIZE BEFORE CALLING */ + int synth_type; +#define SYNTH_TYPE_FM 0 +#define SYNTH_TYPE_SAMPLE 1 +#define SYNTH_TYPE_MIDI 2 /* Midi interface */ + + int synth_subtype; +#define FM_TYPE_ADLIB 0x00 +#define FM_TYPE_OPL3 0x01 +#define MIDI_TYPE_MPU401 0x401 + +#define SAMPLE_TYPE_BASIC 0x10 +#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC +#define SAMPLE_TYPE_WAVEFRONT 0x11 + + int perc_mode; /* No longer supported */ + int nr_voices; + int nr_drums; /* Obsolete field */ + int instr_bank_size; + unsigned int capabilities; +#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */ +#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */ +#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ + int dummies[19]; /* Reserve space */ + }; + +struct sound_timer_info { + char name[32]; + int caps; + }; + +#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */ + +struct midi_info { + char name[30]; + int device; /* 0-N. INITIALIZE BEFORE CALLING */ + unsigned int capabilities; /* To be defined later */ + int dev_type; + int dummies[18]; /* Reserve space */ + }; + +/******************************************** + * ioctl commands for the /dev/midi## + */ +typedef struct { + unsigned char cmd; + char nr_args, nr_returns; + unsigned char data[30]; + } mpu_command_rec; + +#define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int) +#define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int) +#define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec) + +/******************************************** + * IOCTL commands for /dev/dsp and /dev/audio + */ + +#define SNDCTL_DSP_RESET _SIO ('P', 0) +#define SNDCTL_DSP_SYNC _SIO ('P', 1) +#define SNDCTL_DSP_SPEED _SIOWR('P', 2, int) +#define SNDCTL_DSP_STEREO _SIOWR('P', 3, int) +#define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int) +#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT +#define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int) +#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS +#define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int) +#define SNDCTL_DSP_POST _SIO ('P', 8) +#define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int) +#define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int) + +/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */ +#define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) /* Returns a mask */ +#define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) /* Selects ONE fmt*/ +# define AFMT_QUERY 0x00000000 /* Return current fmt */ +# define AFMT_MU_LAW 0x00000001 +# define AFMT_A_LAW 0x00000002 +# define AFMT_IMA_ADPCM 0x00000004 +# define AFMT_U8 0x00000008 +# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/ +# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */ +# define AFMT_S8 0x00000040 +# define AFMT_U16_LE 0x00000080 /* Little endian U16 */ +# define AFMT_U16_BE 0x00000100 /* Big endian U16 */ +# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ +# define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ + +/* + * Buffer status queries. + */ +typedef struct audio_buf_info { + int fragments; /* # of available fragments (partially usend ones not counted) */ + int fragstotal; /* Total # of fragments allocated */ + int fragsize; /* Size of a fragment in bytes */ + + int bytes; /* Available space in bytes (includes partially used fragments) */ + /* Note! 'bytes' could be more than fragments*fragsize */ + } audio_buf_info; + +#define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info) +#define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info) +#define SNDCTL_DSP_NONBLOCK _SIO ('P',14) +#define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int) +# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */ +# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */ +# define DSP_CAP_REALTIME 0x00000200 /* Real time capability */ +# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */ + /* internal buffers which may */ + /* cause some delays and */ + /* decrease precision of timing */ +# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */ + /* Sometimes it's a DSP */ + /* but usually not */ +# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */ +# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */ +# define DSP_CAP_MULTI 0x00004000 /* support multiple open */ +# define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */ + + +#define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int) +#define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int) +# define PCM_ENABLE_INPUT 0x00000001 +# define PCM_ENABLE_OUTPUT 0x00000002 + +typedef struct count_info { + int bytes; /* Total # of bytes processed */ + int blocks; /* # of fragment transitions since last time */ + int ptr; /* Current DMA pointer value */ + } count_info; + +#define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info) +#define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info) + +typedef struct buffmem_desc { + unsigned *buffer; + int size; + } buffmem_desc; +#define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc) +#define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc) +#define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21) +#define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22) +#define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int) + +#define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int) +#define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int) +# define DSP_BIND_QUERY 0x00000000 +# define DSP_BIND_FRONT 0x00000001 +# define DSP_BIND_SURR 0x00000002 +# define DSP_BIND_CENTER_LFE 0x00000004 +# define DSP_BIND_HANDSET 0x00000008 +# define DSP_BIND_MIC 0x00000010 +# define DSP_BIND_MODEM1 0x00000020 +# define DSP_BIND_MODEM2 0x00000040 +# define DSP_BIND_I2S 0x00000080 +# define DSP_BIND_SPDIF 0x00000100 + +#define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int) +#define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int) +# define SPDIF_PRO 0x0001 +# define SPDIF_N_AUD 0x0002 +# define SPDIF_COPY 0x0004 +# define SPDIF_PRE 0x0008 +# define SPDIF_CC 0x07f0 +# define SPDIF_L 0x0800 +# define SPDIF_DRS 0x4000 +# define SPDIF_V 0x8000 + +/* + * Application's profile defines the way how playback underrun situations should be handled. + * + * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the + * playback buffer whenever an underrun occurs. This consumes some time + * prevents looping the existing buffer. + * APF_CPUINTENS is intended to be set by CPU intensive applications which + * are likely to run out of time occasionally. In this mode the buffer cleanup is + * disabled which saves CPU time but also let's the previous buffer content to + * be played during the "pause" after the underrun. + */ +#define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int) +#define APF_NORMAL 0 /* Normal applications */ +#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */ +#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */ + +#define SOUND_PCM_READ_RATE _SIOR ('P', 2, int) +#define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int) +#define SOUND_PCM_READ_BITS _SIOR ('P', 5, int) +#define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int) + +/* Some alias names */ +#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT +#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED +#define SOUND_PCM_POST SNDCTL_DSP_POST +#define SOUND_PCM_RESET SNDCTL_DSP_RESET +#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC +#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE +#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT +#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS +#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT +#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE +#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE +#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK +#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS +#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER +#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER +#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO +#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR +#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR +#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF +#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF + +/* + * ioctl calls to be used in communication with coprocessors and + * DSP chips. + */ + +typedef struct copr_buffer { + int command; /* Set to 0 if not used */ + int flags; +#define CPF_NONE 0x0000 +#define CPF_FIRST 0x0001 /* First block */ +#define CPF_LAST 0x0002 /* Last block */ + int len; + int offs; /* If required by the device (0 if not used) */ + + unsigned char data[4000]; /* NOTE! 4000 is not 4k */ + } copr_buffer; + +typedef struct copr_debug_buf { + int command; /* Used internally. Set to 0 */ + int parm1; + int parm2; + int flags; + int len; /* Length of data in bytes */ + } copr_debug_buf; + +typedef struct copr_msg { + int len; + unsigned char data[4000]; + } copr_msg; + +#define SNDCTL_COPR_RESET _SIO ('C', 0) +#define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer) +#define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf) +#define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf) +#define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf) +#define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf) +#define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf) +#define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf) +#define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg) +#define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg) + +/********************************************* + * IOCTL commands for /dev/mixer + */ + +/* + * Mixer devices + * + * There can be up to 20 different analog mixer channels. The + * SOUND_MIXER_NRDEVICES gives the currently supported maximum. + * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells + * the devices supported by the particular mixer. + */ + +#define SOUND_MIXER_NRDEVICES 25 +#define SOUND_MIXER_VOLUME 0 +#define SOUND_MIXER_BASS 1 +#define SOUND_MIXER_TREBLE 2 +#define SOUND_MIXER_SYNTH 3 +#define SOUND_MIXER_PCM 4 +#define SOUND_MIXER_SPEAKER 5 +#define SOUND_MIXER_LINE 6 +#define SOUND_MIXER_MIC 7 +#define SOUND_MIXER_CD 8 +#define SOUND_MIXER_IMIX 9 /* Recording monitor */ +#define SOUND_MIXER_ALTPCM 10 +#define SOUND_MIXER_RECLEV 11 /* Recording level */ +#define SOUND_MIXER_IGAIN 12 /* Input gain */ +#define SOUND_MIXER_OGAIN 13 /* Output gain */ +/* + * The AD1848 codec and compatibles have three line level inputs + * (line, aux1 and aux2). Since each card manufacturer have assigned + * different meanings to these inputs, it's inpractical to assign + * specific meanings (line, cd, synth etc.) to them. + */ +#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ +#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ +#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ +#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ +#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ +#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ +#define SOUND_MIXER_PHONEIN 20 /* Phone input */ +#define SOUND_MIXER_PHONEOUT 21 /* Phone output */ +#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ +#define SOUND_MIXER_RADIO 23 /* Radio in */ +#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ + +/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */ +/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */ +#define SOUND_ONOFF_MIN 28 +#define SOUND_ONOFF_MAX 30 + +/* Note! Number 31 cannot be used since the sign bit is reserved */ +#define SOUND_MIXER_NONE 31 + +/* + * The following unsupported macros are no longer functional. + * Use SOUND_MIXER_PRIVATE# macros in future. + */ +#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE +#define SOUND_MIXER_MUTE SOUND_MIXER_NONE +#define SOUND_MIXER_LOUD SOUND_MIXER_NONE + + +#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ + "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ + "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ + "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} + +#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ + "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ + "line1", "line2", "line3", "dig1", "dig2", "dig3", \ + "phin", "phout", "video", "radio", "monitor"} + +/* Device bitmask identifiers */ + +#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */ +#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */ +#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */ +#define SOUND_MIXER_CAPS 0xfc +# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */ +#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */ +#define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */ +#define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */ + +/* Device mask bits */ + +#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) +#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) +#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) +#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) +#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) +#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) +#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) +#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) +#define SOUND_MASK_CD (1 << SOUND_MIXER_CD) +#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) +#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) +#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) +#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) +#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) +#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) +#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) +#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) +#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) +#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) +#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) +#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) +#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) +#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) +#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) +#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) + +/* Obsolete macros */ +#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) +#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) +#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) + +#define MIXER_READ(dev) _SIOR('M', dev, int) +#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) +#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) +#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) +#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) +#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) +#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) +#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) +#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) +#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) +#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) +#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) +#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) +#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) +#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) + +/* Obsolete macros */ +#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) +#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) +#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) + +#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) +#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) +#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) +#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) +#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) + +#define MIXER_WRITE(dev) _SIOWR('M', dev, int) +#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) +#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) +#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) +#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) +#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) +#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) +#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) +#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) +#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) +#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) +#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) +#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) +#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) +#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) + +/* Obsolete macros */ +#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) +#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) +#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) + +#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) + +typedef struct mixer_info +{ + char id[16]; + char name[32]; + int modify_counter; + int fillers[10]; +} mixer_info; + +typedef struct _old_mixer_info /* Obsolete */ +{ + char id[16]; + char name[32]; +} _old_mixer_info; + +#define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info) +#define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info) + +/* + * A mechanism for accessing "proprietary" mixer features. This method + * permits passing 128 bytes of arbitrary data between a mixer application + * and the mixer driver. Interpretation of the record is defined by + * the particular mixer driver. + */ +typedef unsigned char mixer_record[128]; + +#define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record) + +/* + * Two ioctls for special souncard function + */ +#define SOUND_MIXER_AGC _SIOWR('M', 103, int) +#define SOUND_MIXER_3DSE _SIOWR('M', 104, int) + +/* + * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers. + * These features can be used when accessing device specific features. + */ +#define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int) +#define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int) +#define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int) +#define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int) +#define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int) + +/* + * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used + * for querying current mixer settings from the driver and for loading + * default volume settings _prior_ activating the mixer (loading + * doesn't affect current state of the mixer hardware). These calls + * are for internal use only. + */ + +typedef struct mixer_vol_table { + int num; /* Index to volume table */ + char name[32]; + int levels[32]; +} mixer_vol_table; + +#define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table) +#define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table) + +/* + * An ioctl for identifying the driver version. It will return value + * of the SOUND_VERSION macro used when compiling the driver. + * This call was introduced in OSS version 3.6 and it will not work + * with earlier versions (returns EINVAL). + */ +#define OSS_GETVERSION _SIOR ('M', 118, int) + +/* + * Level 2 event types for /dev/sequencer + */ + +/* + * The 4 most significant bits of byte 0 specify the class of + * the event: + * + * 0x8X = system level events, + * 0x9X = device/port specific events, event[1] = device/port, + * The last 4 bits give the subtype: + * 0x02 = Channel event (event[3] = chn). + * 0x01 = note event (event[4] = note). + * (0x01 is not used alone but always with bit 0x02). + * event[2] = MIDI message code (0x80=note off etc.) + * + */ + +#define EV_SEQ_LOCAL 0x80 +#define EV_TIMING 0x81 +#define EV_CHN_COMMON 0x92 +#define EV_CHN_VOICE 0x93 +#define EV_SYSEX 0x94 +/* + * Event types 200 to 220 are reserved for application use. + * These numbers will not be used by the driver. + */ + +/* + * Events for event type EV_CHN_VOICE + */ + +#define MIDI_NOTEOFF 0x80 +#define MIDI_NOTEON 0x90 +#define MIDI_KEY_PRESSURE 0xA0 + +/* + * Events for event type EV_CHN_COMMON + */ + +#define MIDI_CTL_CHANGE 0xB0 +#define MIDI_PGM_CHANGE 0xC0 +#define MIDI_CHN_PRESSURE 0xD0 +#define MIDI_PITCH_BEND 0xE0 + +#define MIDI_SYSTEM_PREFIX 0xF0 + +/* + * Timer event types + */ +#define TMR_WAIT_REL 1 /* Time relative to the prev time */ +#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ +#define TMR_STOP 3 +#define TMR_START 4 +#define TMR_CONTINUE 5 +#define TMR_TEMPO 6 +#define TMR_ECHO 8 +#define TMR_CLOCK 9 /* MIDI clock */ +#define TMR_SPP 10 /* Song position pointer */ +#define TMR_TIMESIG 11 /* Time signature */ + +/* + * Local event types + */ +#define LOCL_STARTAUDIO 1 + +#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS) +/* + * Some convenience macros to simplify programming of the + * /dev/sequencer interface + * + * This is a legacy interface for applications written against + * the OSSlib-3.8 style interface. It is no longer possible + * to actually link against OSSlib with this header, but we + * still provide these macros for programs using them. + * + * If you want to use OSSlib, it is recommended that you get + * the GPL version of OSS-4.x and build against that version + * of the header. + * + * We redefine the extern keyword so that make headers_check + * does not complain about SEQ_USE_EXTBUF. + */ +#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() + +void seqbuf_dump(void); /* This function must be provided by programs */ + +#define SEQ_PM_DEFINES int __foo_bar___ + +#define SEQ_LOAD_GMINSTR(dev, instr) +#define SEQ_LOAD_GMDRUM(dev, drum) + +#define _SEQ_EXTERN extern +#define SEQ_USE_EXTBUF() \ + _SEQ_EXTERN unsigned char _seqbuf[]; \ + _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr + +#ifndef USE_SIMPLE_MACROS +/* Sample seqbuf_dump() implementation: + * + * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes + * + * int seqfd; -- The file descriptor for /dev/sequencer. + * + * void + * seqbuf_dump () + * { + * if (_seqbufptr) + * if (write (seqfd, _seqbuf, _seqbufptr) == -1) + * { + * perror ("write /dev/sequencer"); + * exit (-1); + * } + * _seqbufptr = 0; + * } + */ + +#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 +#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() +#define _SEQ_ADVBUF(len) _seqbufptr += len +#define SEQ_DUMPBUF seqbuf_dump +#else +/* + * This variation of the sequencer macros is used just to format one event + * using fixed buffer. + * + * The program using the macro library must define the following macros before + * using this library. + * + * #define _seqbuf name of the buffer (unsigned char[]) + * #define _SEQ_ADVBUF(len) If the applic needs to know the exact + * size of the event, this macro can be used. + * Otherwise this must be defined as empty. + * #define _seqbufptr Define the name of index variable or 0 if + * not required. + */ +#define _SEQ_NEEDBUF(len) /* empty */ +#endif + +#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ + _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ + _seqbuf[_seqbufptr+2] = (dev);\ + _seqbuf[_seqbufptr+3] = (mode);\ + _seqbuf[_seqbufptr+4] = 0;\ + _seqbuf[_seqbufptr+5] = 0;\ + _seqbuf[_seqbufptr+6] = 0;\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} + +/* + * Midi voice messages + */ + +#define _CHN_VOICE(dev, event, chn, note, parm) \ + {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_CHN_VOICE;\ + _seqbuf[_seqbufptr+1] = (dev);\ + _seqbuf[_seqbufptr+2] = (event);\ + _seqbuf[_seqbufptr+3] = (chn);\ + _seqbuf[_seqbufptr+4] = (note);\ + _seqbuf[_seqbufptr+5] = (parm);\ + _seqbuf[_seqbufptr+6] = (0);\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} + +#define SEQ_START_NOTE(dev, chn, note, vol) \ + _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) + +#define SEQ_STOP_NOTE(dev, chn, note, vol) \ + _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) + +#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \ + _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) + +/* + * Midi channel messages + */ + +#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \ + {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_CHN_COMMON;\ + _seqbuf[_seqbufptr+1] = (dev);\ + _seqbuf[_seqbufptr+2] = (event);\ + _seqbuf[_seqbufptr+3] = (chn);\ + _seqbuf[_seqbufptr+4] = (p1);\ + _seqbuf[_seqbufptr+5] = (p2);\ + *(short *)&_seqbuf[_seqbufptr+6] = (w14);\ + _SEQ_ADVBUF(8);} +/* + * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits + * sending any MIDI bytes but it's absolutely not possible. Trying to do + * so _will_ cause problems with MPU401 intelligent mode). + * + * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be + * sent by calling SEQ_SYSEX() several times (there must be no other events + * between them). First sysex fragment must have 0xf0 in the first byte + * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte + * between these sysex start and end markers cannot be larger than 0x7f. Also + * lengths of each fragments (except the last one) must be 6. + * + * Breaking the above rules may work with some MIDI ports but is likely to + * cause fatal problems with some other devices (such as MPU401). + */ +#define SEQ_SYSEX(dev, buf, len) \ + {int ii, ll=(len); \ + unsigned char *bufp=buf;\ + if (ll>6)ll=6;\ + _SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_SYSEX;\ + _seqbuf[_seqbufptr+1] = (dev);\ + for(ii=0;ii>8)&0xff);\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} +/* + * The following 5 macros are incorrectly implemented and obsolete. + * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead. + */ +#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) +#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) +#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) +#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) +#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) + +/* + * Timing and syncronization macros + */ + +#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr+0] = EV_TIMING; \ + _seqbuf[_seqbufptr+1] = (ev); \ + _seqbuf[_seqbufptr+2] = 0;\ + _seqbuf[_seqbufptr+3] = 0;\ + *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ + _SEQ_ADVBUF(8);} + +#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) +#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) +#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) +#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) +#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) +#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) +#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) +#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) +#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) + +/* + * Local control events + */ + +#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ + _seqbuf[_seqbufptr+1] = (ev); \ + _seqbuf[_seqbufptr+2] = 0;\ + _seqbuf[_seqbufptr+3] = 0;\ + *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ + _SEQ_ADVBUF(8);} + +#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) +/* + * Events for the level 1 interface only + */ + +#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\ + _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\ + _seqbuf[_seqbufptr+1] = (byte);\ + _seqbuf[_seqbufptr+2] = (device);\ + _seqbuf[_seqbufptr+3] = 0;\ + _SEQ_ADVBUF(4);} + +/* + * Patch loading. + */ +#define SEQ_WRPATCH(patchx, len) \ + {if (_seqbufptr) SEQ_DUMPBUF();\ + if (write(seqfd, (char*)(patchx), len)==-1) \ + perror("Write patch: /dev/sequencer");} +#define SEQ_WRPATCH2(patchx, len) \ + (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) + +#endif +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/..install.cmd new file mode 100644 index 0000000..12e42dd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/spi/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/spi /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/spi mips spidev.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/spi /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/spi mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/spi/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/spidev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/spidev.h new file mode 100644 index 0000000..95251cc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/spi/spidev.h @@ -0,0 +1,129 @@ +/* + * include/linux/spi/spidev.h + * + * Copyright (C) 2006 SWAPP + * Andrea Paterniani + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef SPIDEV_H +#define SPIDEV_H + +#include + +/* User space versions of kernel symbols for SPI clocking modes, + * matching + */ + +#define SPI_CPHA 0x01 +#define SPI_CPOL 0x02 + +#define SPI_MODE_0 (0|0) +#define SPI_MODE_1 (0|SPI_CPHA) +#define SPI_MODE_2 (SPI_CPOL|0) +#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) + +#define SPI_CS_HIGH 0x04 +#define SPI_LSB_FIRST 0x08 +#define SPI_3WIRE 0x10 +#define SPI_LOOP 0x20 + +/*---------------------------------------------------------------------------*/ + +/* IOCTL commands */ + +#define SPI_IOC_MAGIC 'k' + +/** + * struct spi_ioc_transfer - describes a single SPI transfer + * @tx_buf: Holds pointer to userspace buffer with transmit data, or null. + * If no data is provided, zeroes are shifted out. + * @rx_buf: Holds pointer to userspace buffer for receive data, or null. + * @len: Length of tx and rx buffers, in bytes. + * @speed_hz: Temporary override of the device's bitrate. + * @bits_per_word: Temporary override of the device's wordsize. + * @delay_usecs: If nonzero, how long to delay after the last bit transfer + * before optionally deselecting the device before the next transfer. + * @cs_change: True to deselect device before starting the next transfer. + * + * This structure is mapped directly to the kernel spi_transfer structure; + * the fields have the same meanings, except of course that the pointers + * are in a different address space (and may be of different sizes in some + * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel). + * Zero-initialize the structure, including currently unused fields, to + * accomodate potential future updates. + * + * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync(). + * Pass it an array of related transfers, they'll execute together. + * Each transfer may be half duplex (either direction) or full duplex. + * + * struct spi_ioc_transfer mesg[4]; + * ... + * status = ioctl(fd, SPI_IOC_MESSAGE(4), mesg); + * + * So for example one transfer might send a nine bit command (right aligned + * in a 16-bit word), the next could read a block of 8-bit data before + * terminating that command by temporarily deselecting the chip; the next + * could send a different nine bit command (re-selecting the chip), and the + * last transfer might write some register values. + */ +struct spi_ioc_transfer { + __u64 tx_buf; + __u64 rx_buf; + + __u32 len; + __u32 speed_hz; + + __u16 delay_usecs; + __u8 bits_per_word; + __u8 cs_change; + __u32 pad; + + /* If the contents of 'struct spi_ioc_transfer' ever change + * incompatibly, then the ioctl number (currently 0) must change; + * ioctls with constant size fields get a bit more in the way of + * error checking than ones (like this) where that field varies. + * + * NOTE: struct layout is the same in 64bit and 32bit userspace. + */ +}; + +/* not all platforms use or _IOC_TYPECHECK() ... */ +#define SPI_MSGSIZE(N) \ + ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ + ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) +#define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) + + +/* Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) */ +#define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8) +#define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8) + +/* Read / Write SPI bit justification */ +#define SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, __u8) +#define SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, __u8) + +/* Read / Write SPI device word length (1..N) */ +#define SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, __u8) +#define SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, __u8) + +/* Read / Write SPI device default max speed hz */ +#define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32) +#define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32) + + + +#endif /* SPIDEV_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/stat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/stat.h new file mode 100644 index 0000000..0a9f037 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/stat.h @@ -0,0 +1,45 @@ +#ifndef _LINUX_STAT_H +#define _LINUX_STAT_H + + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + +#define S_IFMT 00170000 +#define S_IFSOCK 0140000 +#define S_IFLNK 0120000 +#define S_IFREG 0100000 +#define S_IFBLK 0060000 +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFIFO 0010000 +#define S_ISUID 0004000 +#define S_ISGID 0002000 +#define S_ISVTX 0001000 + +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) + +#define S_IRWXU 00700 +#define S_IRUSR 00400 +#define S_IWUSR 00200 +#define S_IXUSR 00100 + +#define S_IRWXG 00070 +#define S_IRGRP 00040 +#define S_IWGRP 00020 +#define S_IXGRP 00010 + +#define S_IRWXO 00007 +#define S_IROTH 00004 +#define S_IWOTH 00002 +#define S_IXOTH 00001 + +#endif + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/stddef.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/stddef.h new file mode 100644 index 0000000..d12ce1b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/stddef.h @@ -0,0 +1,14 @@ +#ifndef _LINUX_STDDEF_H +#define _LINUX_STDDEF_H + + + +#undef NULL +#if defined(__cplusplus) +#define NULL 0 +#else +#define NULL ((void *)0) +#endif + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/string.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/string.h new file mode 100644 index 0000000..d7ed844 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/string.h @@ -0,0 +1,7 @@ +#ifndef _LINUX_STRING_H_ +#define _LINUX_STRING_H_ + +/* We don't want strings.h stuff being used by user stuff by accident */ + +#include +#endif /* _LINUX_STRING_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/..install.cmd new file mode 100644 index 0000000..58bc60a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/sunrpc/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/sunrpc /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/sunrpc mips debug.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/sunrpc /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/sunrpc mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/sunrpc/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/debug.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/debug.h new file mode 100644 index 0000000..4ead318 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sunrpc/debug.h @@ -0,0 +1,48 @@ +/* + * linux/include/linux/sunrpc/debug.h + * + * Debugging support for sunrpc module + * + * Copyright (C) 1996, Olaf Kirch + */ + +#ifndef _LINUX_SUNRPC_DEBUG_H_ +#define _LINUX_SUNRPC_DEBUG_H_ + +/* + * RPC debug facilities + */ +#define RPCDBG_XPRT 0x0001 +#define RPCDBG_CALL 0x0002 +#define RPCDBG_DEBUG 0x0004 +#define RPCDBG_NFS 0x0008 +#define RPCDBG_AUTH 0x0010 +#define RPCDBG_BIND 0x0020 +#define RPCDBG_SCHED 0x0040 +#define RPCDBG_TRANS 0x0080 +#define RPCDBG_SVCXPRT 0x0100 +#define RPCDBG_SVCDSP 0x0200 +#define RPCDBG_MISC 0x0400 +#define RPCDBG_CACHE 0x0800 +#define RPCDBG_ALL 0x7fff + + +/* + * Declarations for the sysctl debug interface, which allows to read or + * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc + * module currently registers its sysctl table dynamically, the sysctl path + * for module FOO is . + */ + +enum { + CTL_RPCDEBUG = 1, + CTL_NFSDEBUG, + CTL_NFSDDEBUG, + CTL_NLMDEBUG, + CTL_SLOTTABLE_UDP, + CTL_SLOTTABLE_TCP, + CTL_MIN_RESVPORT, + CTL_MAX_RESVPORT, +}; + +#endif /* _LINUX_SUNRPC_DEBUG_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/suspend_ioctls.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/suspend_ioctls.h new file mode 100644 index 0000000..0b30382 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/suspend_ioctls.h @@ -0,0 +1,33 @@ +#ifndef _LINUX_SUSPEND_IOCTLS_H +#define _LINUX_SUSPEND_IOCTLS_H + +#include +/* + * This structure is used to pass the values needed for the identification + * of the resume swap area from a user space to the kernel via the + * SNAPSHOT_SET_SWAP_AREA ioctl + */ +struct resume_swap_area { + __kernel_loff_t offset; + __u32 dev; +} __attribute__((packed)); + +#define SNAPSHOT_IOC_MAGIC '3' +#define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1) +#define SNAPSHOT_UNFREEZE _IO(SNAPSHOT_IOC_MAGIC, 2) +#define SNAPSHOT_ATOMIC_RESTORE _IO(SNAPSHOT_IOC_MAGIC, 4) +#define SNAPSHOT_FREE _IO(SNAPSHOT_IOC_MAGIC, 5) +#define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9) +#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) +#define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \ + struct resume_swap_area) +#define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, __kernel_loff_t) +#define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15) +#define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16) +#define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int) +#define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18) +#define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, __kernel_loff_t) +#define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, __kernel_loff_t) +#define SNAPSHOT_IOC_MAXNR 20 + +#endif /* _LINUX_SUSPEND_IOCTLS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/swab.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/swab.h new file mode 100644 index 0000000..aa4afdd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/swab.h @@ -0,0 +1,282 @@ +#ifndef _LINUX_SWAB_H +#define _LINUX_SWAB_H + +#include + +#include + +/* + * casts are necessary for constants, because we never know how for sure + * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. + */ +#define ___constant_swab16(x) ((__u16)( \ + (((__u16)(x) & (__u16)0x00ffU) << 8) | \ + (((__u16)(x) & (__u16)0xff00U) >> 8))) + +#define ___constant_swab32(x) ((__u32)( \ + (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ + (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ + (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ + (((__u32)(x) & (__u32)0xff000000UL) >> 24))) + +#define ___constant_swab64(x) ((__u64)( \ + (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ + (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ + (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ + (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \ + (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \ + (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ + (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ + (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) + +#define ___constant_swahw32(x) ((__u32)( \ + (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ + (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) + +#define ___constant_swahb32(x) ((__u32)( \ + (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ + (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) + +/* + * Implement the following as inlines, but define the interface using + * macros to allow constant folding when possible: + * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 + */ + +static __inline__ __u16 __fswab16(__u16 val) +{ +#ifdef __arch_swab16 + return __arch_swab16(val); +#else + return ___constant_swab16(val); +#endif +} + +static __inline__ __u32 __fswab32(__u32 val) +{ +#ifdef __arch_swab32 + return __arch_swab32(val); +#else + return ___constant_swab32(val); +#endif +} + +static __inline__ __u64 __fswab64(__u64 val) +{ +#ifdef __arch_swab64 + return __arch_swab64(val); +#elif defined(__SWAB_64_THRU_32__) + __u32 h = val >> 32; + __u32 l = val & ((1ULL << 32) - 1); + return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h))); +#else + return ___constant_swab64(val); +#endif +} + +static __inline__ __u32 __fswahw32(__u32 val) +{ +#ifdef __arch_swahw32 + return __arch_swahw32(val); +#else + return ___constant_swahw32(val); +#endif +} + +static __inline__ __u32 __fswahb32(__u32 val) +{ +#ifdef __arch_swahb32 + return __arch_swahb32(val); +#else + return ___constant_swahb32(val); +#endif +} + +/** + * __swab16 - return a byteswapped 16-bit value + * @x: value to byteswap + */ +#define __swab16(x) \ + (__builtin_constant_p((__u16)(x)) ? \ + ___constant_swab16(x) : \ + __fswab16(x)) + +/** + * __swab32 - return a byteswapped 32-bit value + * @x: value to byteswap + */ +#define __swab32(x) \ + (__builtin_constant_p((__u32)(x)) ? \ + ___constant_swab32(x) : \ + __fswab32(x)) + +/** + * __swab64 - return a byteswapped 64-bit value + * @x: value to byteswap + */ +#define __swab64(x) \ + (__builtin_constant_p((__u64)(x)) ? \ + ___constant_swab64(x) : \ + __fswab64(x)) + +/** + * __swahw32 - return a word-swapped 32-bit value + * @x: value to wordswap + * + * __swahw32(0x12340000) is 0x00001234 + */ +#define __swahw32(x) \ + (__builtin_constant_p((__u32)(x)) ? \ + ___constant_swahw32(x) : \ + __fswahw32(x)) + +/** + * __swahb32 - return a high and low byte-swapped 32-bit value + * @x: value to byteswap + * + * __swahb32(0x12345678) is 0x34127856 + */ +#define __swahb32(x) \ + (__builtin_constant_p((__u32)(x)) ? \ + ___constant_swahb32(x) : \ + __fswahb32(x)) + +/** + * __swab16p - return a byteswapped 16-bit value from a pointer + * @p: pointer to a naturally-aligned 16-bit value + */ +static __inline__ __u16 __swab16p(const __u16 *p) +{ +#ifdef __arch_swab16p + return __arch_swab16p(p); +#else + return __swab16(*p); +#endif +} + +/** + * __swab32p - return a byteswapped 32-bit value from a pointer + * @p: pointer to a naturally-aligned 32-bit value + */ +static __inline__ __u32 __swab32p(const __u32 *p) +{ +#ifdef __arch_swab32p + return __arch_swab32p(p); +#else + return __swab32(*p); +#endif +} + +/** + * __swab64p - return a byteswapped 64-bit value from a pointer + * @p: pointer to a naturally-aligned 64-bit value + */ +static __inline__ __u64 __swab64p(const __u64 *p) +{ +#ifdef __arch_swab64p + return __arch_swab64p(p); +#else + return __swab64(*p); +#endif +} + +/** + * __swahw32p - return a wordswapped 32-bit value from a pointer + * @p: pointer to a naturally-aligned 32-bit value + * + * See __swahw32() for details of wordswapping. + */ +static __inline__ __u32 __swahw32p(const __u32 *p) +{ +#ifdef __arch_swahw32p + return __arch_swahw32p(p); +#else + return __swahw32(*p); +#endif +} + +/** + * __swahb32p - return a high and low byteswapped 32-bit value from a pointer + * @p: pointer to a naturally-aligned 32-bit value + * + * See __swahb32() for details of high/low byteswapping. + */ +static __inline__ __u32 __swahb32p(const __u32 *p) +{ +#ifdef __arch_swahb32p + return __arch_swahb32p(p); +#else + return __swahb32(*p); +#endif +} + +/** + * __swab16s - byteswap a 16-bit value in-place + * @p: pointer to a naturally-aligned 16-bit value + */ +static __inline__ void __swab16s(__u16 *p) +{ +#ifdef __arch_swab16s + __arch_swab16s(p); +#else + *p = __swab16p(p); +#endif +} +/** + * __swab32s - byteswap a 32-bit value in-place + * @p: pointer to a naturally-aligned 32-bit value + */ +static __inline__ void __swab32s(__u32 *p) +{ +#ifdef __arch_swab32s + __arch_swab32s(p); +#else + *p = __swab32p(p); +#endif +} + +/** + * __swab64s - byteswap a 64-bit value in-place + * @p: pointer to a naturally-aligned 64-bit value + */ +static __inline__ void __swab64s(__u64 *p) +{ +#ifdef __arch_swab64s + __arch_swab64s(p); +#else + *p = __swab64p(p); +#endif +} + +/** + * __swahw32s - wordswap a 32-bit value in-place + * @p: pointer to a naturally-aligned 32-bit value + * + * See __swahw32() for details of wordswapping + */ +static __inline__ void __swahw32s(__u32 *p) +{ +#ifdef __arch_swahw32s + __arch_swahw32s(p); +#else + *p = __swahw32p(p); +#endif +} + +/** + * __swahb32s - high and low byteswap a 32-bit value in-place + * @p: pointer to a naturally-aligned 32-bit value + * + * See __swahb32() for details of high and low byte swapping + */ +static __inline__ void __swahb32s(__u32 *p) +{ +#ifdef __arch_swahb32s + __arch_swahb32s(p); +#else + *p = __swahb32p(p); +#endif +} + + +#endif /* _LINUX_SWAB_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/synclink.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/synclink.h new file mode 100644 index 0000000..b95874b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/synclink.h @@ -0,0 +1,295 @@ +/* + * SyncLink Multiprotocol Serial Adapter Driver + * + * $Id: synclink.h,v 3.14 2006/07/17 20:15:43 paulkf Exp $ + * + * Copyright (C) 1998-2000 by Microgate Corporation + * + * Redistribution of this file is permitted under + * the terms of the GNU Public License (GPL) + */ + +#ifndef _SYNCLINK_H_ +#define _SYNCLINK_H_ +#define SYNCLINK_H_VERSION 3.6 + +#include + +#define BIT0 0x0001 +#define BIT1 0x0002 +#define BIT2 0x0004 +#define BIT3 0x0008 +#define BIT4 0x0010 +#define BIT5 0x0020 +#define BIT6 0x0040 +#define BIT7 0x0080 +#define BIT8 0x0100 +#define BIT9 0x0200 +#define BIT10 0x0400 +#define BIT11 0x0800 +#define BIT12 0x1000 +#define BIT13 0x2000 +#define BIT14 0x4000 +#define BIT15 0x8000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 + + +#define HDLC_MAX_FRAME_SIZE 65535 +#define MAX_ASYNC_TRANSMIT 4096 +#define MAX_ASYNC_BUFFER_SIZE 4096 + +#define ASYNC_PARITY_NONE 0 +#define ASYNC_PARITY_EVEN 1 +#define ASYNC_PARITY_ODD 2 +#define ASYNC_PARITY_SPACE 3 + +#define HDLC_FLAG_UNDERRUN_ABORT7 0x0000 +#define HDLC_FLAG_UNDERRUN_ABORT15 0x0001 +#define HDLC_FLAG_UNDERRUN_FLAG 0x0002 +#define HDLC_FLAG_UNDERRUN_CRC 0x0004 +#define HDLC_FLAG_SHARE_ZERO 0x0010 +#define HDLC_FLAG_AUTO_CTS 0x0020 +#define HDLC_FLAG_AUTO_DCD 0x0040 +#define HDLC_FLAG_AUTO_RTS 0x0080 +#define HDLC_FLAG_RXC_DPLL 0x0100 +#define HDLC_FLAG_RXC_BRG 0x0200 +#define HDLC_FLAG_RXC_TXCPIN 0x8000 +#define HDLC_FLAG_RXC_RXCPIN 0x0000 +#define HDLC_FLAG_TXC_DPLL 0x0400 +#define HDLC_FLAG_TXC_BRG 0x0800 +#define HDLC_FLAG_TXC_TXCPIN 0x0000 +#define HDLC_FLAG_TXC_RXCPIN 0x0008 +#define HDLC_FLAG_DPLL_DIV8 0x1000 +#define HDLC_FLAG_DPLL_DIV16 0x2000 +#define HDLC_FLAG_DPLL_DIV32 0x0000 +#define HDLC_FLAG_HDLC_LOOPMODE 0x4000 + +#define HDLC_CRC_NONE 0 +#define HDLC_CRC_16_CCITT 1 +#define HDLC_CRC_32_CCITT 2 +#define HDLC_CRC_MASK 0x00ff +#define HDLC_CRC_RETURN_EX 0x8000 + +#define RX_OK 0 +#define RX_CRC_ERROR 1 + +#define HDLC_TXIDLE_FLAGS 0 +#define HDLC_TXIDLE_ALT_ZEROS_ONES 1 +#define HDLC_TXIDLE_ZEROS 2 +#define HDLC_TXIDLE_ONES 3 +#define HDLC_TXIDLE_ALT_MARK_SPACE 4 +#define HDLC_TXIDLE_SPACE 5 +#define HDLC_TXIDLE_MARK 6 +#define HDLC_TXIDLE_CUSTOM_8 0x10000000 +#define HDLC_TXIDLE_CUSTOM_16 0x20000000 + +#define HDLC_ENCODING_NRZ 0 +#define HDLC_ENCODING_NRZB 1 +#define HDLC_ENCODING_NRZI_MARK 2 +#define HDLC_ENCODING_NRZI_SPACE 3 +#define HDLC_ENCODING_NRZI HDLC_ENCODING_NRZI_SPACE +#define HDLC_ENCODING_BIPHASE_MARK 4 +#define HDLC_ENCODING_BIPHASE_SPACE 5 +#define HDLC_ENCODING_BIPHASE_LEVEL 6 +#define HDLC_ENCODING_DIFF_BIPHASE_LEVEL 7 + +#define HDLC_PREAMBLE_LENGTH_8BITS 0 +#define HDLC_PREAMBLE_LENGTH_16BITS 1 +#define HDLC_PREAMBLE_LENGTH_32BITS 2 +#define HDLC_PREAMBLE_LENGTH_64BITS 3 + +#define HDLC_PREAMBLE_PATTERN_NONE 0 +#define HDLC_PREAMBLE_PATTERN_ZEROS 1 +#define HDLC_PREAMBLE_PATTERN_FLAGS 2 +#define HDLC_PREAMBLE_PATTERN_10 3 +#define HDLC_PREAMBLE_PATTERN_01 4 +#define HDLC_PREAMBLE_PATTERN_ONES 5 + +#define MGSL_MODE_ASYNC 1 +#define MGSL_MODE_HDLC 2 +#define MGSL_MODE_MONOSYNC 3 +#define MGSL_MODE_BISYNC 4 +#define MGSL_MODE_RAW 6 +#define MGSL_MODE_BASE_CLOCK 7 + +#define MGSL_BUS_TYPE_ISA 1 +#define MGSL_BUS_TYPE_EISA 2 +#define MGSL_BUS_TYPE_PCI 5 + +#define MGSL_INTERFACE_MASK 0xf +#define MGSL_INTERFACE_DISABLE 0 +#define MGSL_INTERFACE_RS232 1 +#define MGSL_INTERFACE_V35 2 +#define MGSL_INTERFACE_RS422 3 +#define MGSL_INTERFACE_RTS_EN 0x10 +#define MGSL_INTERFACE_LL 0x20 +#define MGSL_INTERFACE_RL 0x40 +#define MGSL_INTERFACE_MSB_FIRST 0x80 + +typedef struct _MGSL_PARAMS +{ + /* Common */ + + unsigned long mode; /* Asynchronous or HDLC */ + unsigned char loopback; /* internal loopback mode */ + + /* HDLC Only */ + + unsigned short flags; + unsigned char encoding; /* NRZ, NRZI, etc. */ + unsigned long clock_speed; /* external clock speed in bits per second */ + unsigned char addr_filter; /* receive HDLC address filter, 0xFF = disable */ + unsigned short crc_type; /* None, CRC16-CCITT, or CRC32-CCITT */ + unsigned char preamble_length; + unsigned char preamble; + + /* Async Only */ + + unsigned long data_rate; /* bits per second */ + unsigned char data_bits; /* 7 or 8 data bits */ + unsigned char stop_bits; /* 1 or 2 stop bits */ + unsigned char parity; /* none, even, or odd */ + +} MGSL_PARAMS, *PMGSL_PARAMS; + +#define MICROGATE_VENDOR_ID 0x13c0 +#define SYNCLINK_DEVICE_ID 0x0010 +#define MGSCC_DEVICE_ID 0x0020 +#define SYNCLINK_SCA_DEVICE_ID 0x0030 +#define SYNCLINK_GT_DEVICE_ID 0x0070 +#define SYNCLINK_GT4_DEVICE_ID 0x0080 +#define SYNCLINK_AC_DEVICE_ID 0x0090 +#define SYNCLINK_GT2_DEVICE_ID 0x00A0 +#define MGSL_MAX_SERIAL_NUMBER 30 + +/* +** device diagnostics status +*/ + +#define DiagStatus_OK 0 +#define DiagStatus_AddressFailure 1 +#define DiagStatus_AddressConflict 2 +#define DiagStatus_IrqFailure 3 +#define DiagStatus_IrqConflict 4 +#define DiagStatus_DmaFailure 5 +#define DiagStatus_DmaConflict 6 +#define DiagStatus_PciAdapterNotFound 7 +#define DiagStatus_CantAssignPciResources 8 +#define DiagStatus_CantAssignPciMemAddr 9 +#define DiagStatus_CantAssignPciIoAddr 10 +#define DiagStatus_CantAssignPciIrq 11 +#define DiagStatus_MemoryError 12 + +#define SerialSignal_DCD 0x01 /* Data Carrier Detect */ +#define SerialSignal_TXD 0x02 /* Transmit Data */ +#define SerialSignal_RI 0x04 /* Ring Indicator */ +#define SerialSignal_RXD 0x08 /* Receive Data */ +#define SerialSignal_CTS 0x10 /* Clear to Send */ +#define SerialSignal_RTS 0x20 /* Request to Send */ +#define SerialSignal_DSR 0x40 /* Data Set Ready */ +#define SerialSignal_DTR 0x80 /* Data Terminal Ready */ + + +/* + * Counters of the input lines (CTS, DSR, RI, CD) interrupts + */ +struct mgsl_icount { + __u32 cts, dsr, rng, dcd, tx, rx; + __u32 frame, parity, overrun, brk; + __u32 buf_overrun; + __u32 txok; + __u32 txunder; + __u32 txabort; + __u32 txtimeout; + __u32 rxshort; + __u32 rxlong; + __u32 rxabort; + __u32 rxover; + __u32 rxcrc; + __u32 rxok; + __u32 exithunt; + __u32 rxidle; +}; + +struct gpio_desc { + __u32 state; + __u32 smask; + __u32 dir; + __u32 dmask; +}; + +#define DEBUG_LEVEL_DATA 1 +#define DEBUG_LEVEL_ERROR 2 +#define DEBUG_LEVEL_INFO 3 +#define DEBUG_LEVEL_BH 4 +#define DEBUG_LEVEL_ISR 5 + +/* +** Event bit flags for use with MgslWaitEvent +*/ + +#define MgslEvent_DsrActive 0x0001 +#define MgslEvent_DsrInactive 0x0002 +#define MgslEvent_Dsr 0x0003 +#define MgslEvent_CtsActive 0x0004 +#define MgslEvent_CtsInactive 0x0008 +#define MgslEvent_Cts 0x000c +#define MgslEvent_DcdActive 0x0010 +#define MgslEvent_DcdInactive 0x0020 +#define MgslEvent_Dcd 0x0030 +#define MgslEvent_RiActive 0x0040 +#define MgslEvent_RiInactive 0x0080 +#define MgslEvent_Ri 0x00c0 +#define MgslEvent_ExitHuntMode 0x0100 +#define MgslEvent_IdleReceived 0x0200 + +/* Private IOCTL codes: + * + * MGSL_IOCSPARAMS set MGSL_PARAMS structure values + * MGSL_IOCGPARAMS get current MGSL_PARAMS structure values + * MGSL_IOCSTXIDLE set current transmit idle mode + * MGSL_IOCGTXIDLE get current transmit idle mode + * MGSL_IOCTXENABLE enable or disable transmitter + * MGSL_IOCRXENABLE enable or disable receiver + * MGSL_IOCTXABORT abort transmitting frame (HDLC) + * MGSL_IOCGSTATS return current statistics + * MGSL_IOCWAITEVENT wait for specified event to occur + * MGSL_LOOPTXDONE transmit in HDLC LoopMode done + * MGSL_IOCSIF set the serial interface type + * MGSL_IOCGIF get the serial interface type + */ +#define MGSL_MAGIC_IOC 'm' +#define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS) +#define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS) +#define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2) +#define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3) +#define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4) +#define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5) +#define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6) +#define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7) +#define MGSL_IOCWAITEVENT _IOWR(MGSL_MAGIC_IOC,8,int) +#define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15) +#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9) +#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10) +#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11) +#define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc) +#define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc) +#define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc) + + +#endif /* _SYNCLINK_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sysctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sysctl.h new file mode 100644 index 0000000..3e56945 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/sysctl.h @@ -0,0 +1,940 @@ +/* + * sysctl.h: General linux system control interface + * + * Begun 24 March 1995, Stephen Tweedie + * + **************************************************************** + **************************************************************** + ** + ** WARNING: + ** The values in this file are exported to user space via + ** the sysctl() binary interface. Do *NOT* change the + ** numbering of any existing values here, and do not change + ** any numbers within any one set of values. If you have to + ** redefine an existing interface, use a new number for it. + ** The kernel will then return -ENOTDIR to any application using + ** the old binary interface. + ** + ** For new interfaces unless you really need a binary number + ** please use CTL_UNNUMBERED. + ** + **************************************************************** + **************************************************************** + */ + +#ifndef _LINUX_SYSCTL_H +#define _LINUX_SYSCTL_H + +#include +#include + + +struct file; +struct completion; + +#define CTL_MAXNAME 10 /* how many path components do we allow in a + call to sysctl? In other words, what is + the largest acceptable value for the nlen + member of a struct __sysctl_args to have? */ + +struct __sysctl_args { + int *name; + int nlen; + void *oldval; + size_t *oldlenp; + void *newval; + size_t newlen; + unsigned long __unused[4]; +}; + +/* Define sysctl names first */ + +/* Top-level names: */ + +/* For internal pattern-matching use only: */ + +enum +{ + CTL_KERN=1, /* General kernel info and control */ + CTL_VM=2, /* VM management */ + CTL_NET=3, /* Networking */ + CTL_PROC=4, /* removal breaks strace(1) compilation */ + CTL_FS=5, /* Filesystems */ + CTL_DEBUG=6, /* Debugging */ + CTL_DEV=7, /* Devices */ + CTL_BUS=8, /* Busses */ + CTL_ABI=9, /* Binary emulation */ + CTL_CPU=10, /* CPU stuff (speed scaling, etc) */ + CTL_ARLAN=254, /* arlan wireless driver */ + CTL_S390DBF=5677, /* s390 debug */ + CTL_SUNRPC=7249, /* sunrpc debug */ + CTL_PM=9899, /* frv power management */ + CTL_FRV=9898, /* frv specific sysctls */ +}; + +/* CTL_BUS names: */ +enum +{ + CTL_BUS_ISA=1 /* ISA */ +}; + +/* /proc/sys/fs/inotify/ */ +enum +{ + INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */ + INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */ + INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */ +}; + +/* CTL_KERN names: */ +enum +{ + KERN_OSTYPE=1, /* string: system version */ + KERN_OSRELEASE=2, /* string: system release */ + KERN_OSREV=3, /* int: system revision */ + KERN_VERSION=4, /* string: compile time info */ + KERN_SECUREMASK=5, /* struct: maximum rights mask */ + KERN_PROF=6, /* table: profiling information */ + KERN_NODENAME=7, + KERN_DOMAINNAME=8, + + KERN_PANIC=15, /* int: panic timeout */ + KERN_REALROOTDEV=16, /* real root device to mount after initrd */ + + KERN_SPARC_REBOOT=21, /* reboot command on Sparc */ + KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */ + KERN_PRINTK=23, /* struct: control printk logging parameters */ + KERN_NAMETRANS=24, /* Name translation */ + KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */ + KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */ + KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */ + KERN_MODPROBE=28, + KERN_SG_BIG_BUFF=29, + KERN_ACCT=30, /* BSD process accounting parameters */ + KERN_PPC_L2CR=31, /* l2cr register on PPC */ + + KERN_RTSIGNR=32, /* Number of rt sigs queued */ + KERN_RTSIGMAX=33, /* Max queuable */ + + KERN_SHMMAX=34, /* long: Maximum shared memory segment */ + KERN_MSGMAX=35, /* int: Maximum size of a messege */ + KERN_MSGMNB=36, /* int: Maximum message queue size */ + KERN_MSGPOOL=37, /* int: Maximum system message pool size */ + KERN_SYSRQ=38, /* int: Sysreq enable */ + KERN_MAX_THREADS=39, /* int: Maximum nr of threads in the system */ + KERN_RANDOM=40, /* Random driver */ + KERN_SHMALL=41, /* int: Maximum size of shared memory */ + KERN_MSGMNI=42, /* int: msg queue identifiers */ + KERN_SEM=43, /* struct: sysv semaphore limits */ + KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */ + KERN_SHMMNI=45, /* int: shm array identifiers */ + KERN_OVERFLOWUID=46, /* int: overflow UID */ + KERN_OVERFLOWGID=47, /* int: overflow GID */ + KERN_SHMPATH=48, /* string: path to shm fs */ + KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */ + KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */ + KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */ + KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ + KERN_TAINTED=53, /* int: various kernel tainted flags */ + KERN_CADPID=54, /* int: PID of the process to notify on CAD */ + KERN_PIDMAX=55, /* int: PID # limit */ + KERN_CORE_PATTERN=56, /* string: pattern for core-file names */ + KERN_PANIC_ON_OOPS=57, /* int: whether we will panic on an oops */ + KERN_HPPA_PWRSW=58, /* int: hppa soft-power enable */ + KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */ + KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */ + KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */ + KERN_PTY=62, /* dir: pty driver */ + KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */ + KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */ + KERN_HZ_TIMER=65, /* int: hz timer on or off */ + KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ + KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ + KERN_RANDOMIZE=68, /* int: randomize virtual address space */ + KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ + KERN_SPIN_RETRY=70, /* int: number of spinlock retries */ + KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ + KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ + KERN_COMPAT_LOG=73, /* int: print compat layer messages */ + KERN_MAX_LOCK_DEPTH=74, + KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ + KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ +}; + + + +/* CTL_VM names: */ +enum +{ + VM_UNUSED1=1, /* was: struct: Set vm swapping control */ + VM_UNUSED2=2, /* was; int: Linear or sqrt() swapout for hogs */ + VM_UNUSED3=3, /* was: struct: Set free page thresholds */ + VM_UNUSED4=4, /* Spare */ + VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */ + VM_UNUSED5=6, /* was: struct: Set buffer memory thresholds */ + VM_UNUSED7=7, /* was: struct: Set cache memory thresholds */ + VM_UNUSED8=8, /* was: struct: Control kswapd behaviour */ + VM_UNUSED9=9, /* was: struct: Set page table cache parameters */ + VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */ + VM_DIRTY_BACKGROUND=11, /* dirty_background_ratio */ + VM_DIRTY_RATIO=12, /* dirty_ratio */ + VM_DIRTY_WB_CS=13, /* dirty_writeback_centisecs */ + VM_DIRTY_EXPIRE_CS=14, /* dirty_expire_centisecs */ + VM_NR_PDFLUSH_THREADS=15, /* nr_pdflush_threads */ + VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */ + VM_PAGEBUF=17, /* struct: Control pagebuf parameters */ + VM_HUGETLB_PAGES=18, /* int: Number of available Huge Pages */ + VM_SWAPPINESS=19, /* Tendency to steal mapped memory */ + VM_LOWMEM_RESERVE_RATIO=20,/* reservation ratio for lower memory zones */ + VM_MIN_FREE_KBYTES=21, /* Minimum free kilobytes to maintain */ + VM_MAX_MAP_COUNT=22, /* int: Maximum number of mmaps/address-space */ + VM_LAPTOP_MODE=23, /* vm laptop mode */ + VM_BLOCK_DUMP=24, /* block dump mode */ + VM_HUGETLB_GROUP=25, /* permitted hugetlb group */ + VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */ + VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */ + VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */ + VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */ + VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */ + VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ + VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */ + VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ + VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ + VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ +}; + + +/* CTL_NET names: */ +enum +{ + NET_CORE=1, + NET_ETHER=2, + NET_802=3, + NET_UNIX=4, + NET_IPV4=5, + NET_IPX=6, + NET_ATALK=7, + NET_NETROM=8, + NET_AX25=9, + NET_BRIDGE=10, + NET_ROSE=11, + NET_IPV6=12, + NET_X25=13, + NET_TR=14, + NET_DECNET=15, + NET_ECONET=16, + NET_SCTP=17, + NET_LLC=18, + NET_NETFILTER=19, + NET_DCCP=20, + NET_IRDA=412, +}; + +/* /proc/sys/kernel/random */ +enum +{ + RANDOM_POOLSIZE=1, + RANDOM_ENTROPY_COUNT=2, + RANDOM_READ_THRESH=3, + RANDOM_WRITE_THRESH=4, + RANDOM_BOOT_ID=5, + RANDOM_UUID=6 +}; + +/* /proc/sys/kernel/pty */ +enum +{ + PTY_MAX=1, + PTY_NR=2 +}; + +/* /proc/sys/bus/isa */ +enum +{ + BUS_ISA_MEM_BASE=1, + BUS_ISA_PORT_BASE=2, + BUS_ISA_PORT_SHIFT=3 +}; + +/* /proc/sys/net/core */ +enum +{ + NET_CORE_WMEM_MAX=1, + NET_CORE_RMEM_MAX=2, + NET_CORE_WMEM_DEFAULT=3, + NET_CORE_RMEM_DEFAULT=4, +/* was NET_CORE_DESTROY_DELAY */ + NET_CORE_MAX_BACKLOG=6, + NET_CORE_FASTROUTE=7, + NET_CORE_MSG_COST=8, + NET_CORE_MSG_BURST=9, + NET_CORE_OPTMEM_MAX=10, + NET_CORE_HOT_LIST_LENGTH=11, + NET_CORE_DIVERT_VERSION=12, + NET_CORE_NO_CONG_THRESH=13, + NET_CORE_NO_CONG=14, + NET_CORE_LO_CONG=15, + NET_CORE_MOD_CONG=16, + NET_CORE_DEV_WEIGHT=17, + NET_CORE_SOMAXCONN=18, + NET_CORE_BUDGET=19, + NET_CORE_AEVENT_ETIME=20, + NET_CORE_AEVENT_RSEQTH=21, + NET_CORE_WARNINGS=22, +}; + +/* /proc/sys/net/ethernet */ + +/* /proc/sys/net/802 */ + +/* /proc/sys/net/unix */ + +enum +{ + NET_UNIX_DESTROY_DELAY=1, + NET_UNIX_DELETE_DELAY=2, + NET_UNIX_MAX_DGRAM_QLEN=3, +}; + +/* /proc/sys/net/netfilter */ +enum +{ + NET_NF_CONNTRACK_MAX=1, + NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, + NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, + NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, + NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, + NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, + NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, + NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, + NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, + NET_NF_CONNTRACK_UDP_TIMEOUT=10, + NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, + NET_NF_CONNTRACK_ICMP_TIMEOUT=12, + NET_NF_CONNTRACK_GENERIC_TIMEOUT=13, + NET_NF_CONNTRACK_BUCKETS=14, + NET_NF_CONNTRACK_LOG_INVALID=15, + NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, + NET_NF_CONNTRACK_TCP_LOOSE=17, + NET_NF_CONNTRACK_TCP_BE_LIBERAL=18, + NET_NF_CONNTRACK_TCP_MAX_RETRANS=19, + NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, + NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, + NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, + NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, + NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, + NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, + NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, + NET_NF_CONNTRACK_COUNT=27, + NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28, + NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, + NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, + NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, + NET_NF_CONNTRACK_CHECKSUM=32, +}; + +/* /proc/sys/net/ipv4 */ +enum +{ + /* v2.0 compatibile variables */ + NET_IPV4_FORWARD=8, + NET_IPV4_DYNADDR=9, + + NET_IPV4_CONF=16, + NET_IPV4_NEIGH=17, + NET_IPV4_ROUTE=18, + NET_IPV4_FIB_HASH=19, + NET_IPV4_NETFILTER=20, + + NET_IPV4_TCP_TIMESTAMPS=33, + NET_IPV4_TCP_WINDOW_SCALING=34, + NET_IPV4_TCP_SACK=35, + NET_IPV4_TCP_RETRANS_COLLAPSE=36, + NET_IPV4_DEFAULT_TTL=37, + NET_IPV4_AUTOCONFIG=38, + NET_IPV4_NO_PMTU_DISC=39, + NET_IPV4_TCP_SYN_RETRIES=40, + NET_IPV4_IPFRAG_HIGH_THRESH=41, + NET_IPV4_IPFRAG_LOW_THRESH=42, + NET_IPV4_IPFRAG_TIME=43, + NET_IPV4_TCP_MAX_KA_PROBES=44, + NET_IPV4_TCP_KEEPALIVE_TIME=45, + NET_IPV4_TCP_KEEPALIVE_PROBES=46, + NET_IPV4_TCP_RETRIES1=47, + NET_IPV4_TCP_RETRIES2=48, + NET_IPV4_TCP_FIN_TIMEOUT=49, + NET_IPV4_IP_MASQ_DEBUG=50, + NET_TCP_SYNCOOKIES=51, + NET_TCP_STDURG=52, + NET_TCP_RFC1337=53, + NET_TCP_SYN_TAILDROP=54, + NET_TCP_MAX_SYN_BACKLOG=55, + NET_IPV4_LOCAL_PORT_RANGE=56, + NET_IPV4_ICMP_ECHO_IGNORE_ALL=57, + NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58, + NET_IPV4_ICMP_SOURCEQUENCH_RATE=59, + NET_IPV4_ICMP_DESTUNREACH_RATE=60, + NET_IPV4_ICMP_TIMEEXCEED_RATE=61, + NET_IPV4_ICMP_PARAMPROB_RATE=62, + NET_IPV4_ICMP_ECHOREPLY_RATE=63, + NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64, + NET_IPV4_IGMP_MAX_MEMBERSHIPS=65, + NET_TCP_TW_RECYCLE=66, + NET_IPV4_ALWAYS_DEFRAG=67, + NET_IPV4_TCP_KEEPALIVE_INTVL=68, + NET_IPV4_INET_PEER_THRESHOLD=69, + NET_IPV4_INET_PEER_MINTTL=70, + NET_IPV4_INET_PEER_MAXTTL=71, + NET_IPV4_INET_PEER_GC_MINTIME=72, + NET_IPV4_INET_PEER_GC_MAXTIME=73, + NET_TCP_ORPHAN_RETRIES=74, + NET_TCP_ABORT_ON_OVERFLOW=75, + NET_TCP_SYNACK_RETRIES=76, + NET_TCP_MAX_ORPHANS=77, + NET_TCP_MAX_TW_BUCKETS=78, + NET_TCP_FACK=79, + NET_TCP_REORDERING=80, + NET_TCP_ECN=81, + NET_TCP_DSACK=82, + NET_TCP_MEM=83, + NET_TCP_WMEM=84, + NET_TCP_RMEM=85, + NET_TCP_APP_WIN=86, + NET_TCP_ADV_WIN_SCALE=87, + NET_IPV4_NONLOCAL_BIND=88, + NET_IPV4_ICMP_RATELIMIT=89, + NET_IPV4_ICMP_RATEMASK=90, + NET_TCP_TW_REUSE=91, + NET_TCP_FRTO=92, + NET_TCP_LOW_LATENCY=93, + NET_IPV4_IPFRAG_SECRET_INTERVAL=94, + NET_IPV4_IGMP_MAX_MSF=96, + NET_TCP_NO_METRICS_SAVE=97, + NET_TCP_DEFAULT_WIN_SCALE=105, + NET_TCP_MODERATE_RCVBUF=106, + NET_TCP_TSO_WIN_DIVISOR=107, + NET_TCP_BIC_BETA=108, + NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, + NET_TCP_CONG_CONTROL=110, + NET_TCP_ABC=111, + NET_IPV4_IPFRAG_MAX_DIST=112, + NET_TCP_MTU_PROBING=113, + NET_TCP_BASE_MSS=114, + NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, + NET_TCP_DMA_COPYBREAK=116, + NET_TCP_SLOW_START_AFTER_IDLE=117, + NET_CIPSOV4_CACHE_ENABLE=118, + NET_CIPSOV4_CACHE_BUCKET_SIZE=119, + NET_CIPSOV4_RBM_OPTFMT=120, + NET_CIPSOV4_RBM_STRICTVALID=121, + NET_TCP_AVAIL_CONG_CONTROL=122, + NET_TCP_ALLOWED_CONG_CONTROL=123, + NET_TCP_MAX_SSTHRESH=124, + NET_TCP_FRTO_RESPONSE=125, +}; + +enum { + NET_IPV4_ROUTE_FLUSH=1, + NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */ + NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */ + NET_IPV4_ROUTE_GC_THRESH=4, + NET_IPV4_ROUTE_MAX_SIZE=5, + NET_IPV4_ROUTE_GC_MIN_INTERVAL=6, + NET_IPV4_ROUTE_GC_TIMEOUT=7, + NET_IPV4_ROUTE_GC_INTERVAL=8, + NET_IPV4_ROUTE_REDIRECT_LOAD=9, + NET_IPV4_ROUTE_REDIRECT_NUMBER=10, + NET_IPV4_ROUTE_REDIRECT_SILENCE=11, + NET_IPV4_ROUTE_ERROR_COST=12, + NET_IPV4_ROUTE_ERROR_BURST=13, + NET_IPV4_ROUTE_GC_ELASTICITY=14, + NET_IPV4_ROUTE_MTU_EXPIRES=15, + NET_IPV4_ROUTE_MIN_PMTU=16, + NET_IPV4_ROUTE_MIN_ADVMSS=17, + NET_IPV4_ROUTE_SECRET_INTERVAL=18, + NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19, +}; + +enum +{ + NET_PROTO_CONF_ALL=-2, + NET_PROTO_CONF_DEFAULT=-3 + + /* And device ifindices ... */ +}; + +enum +{ + NET_IPV4_CONF_FORWARDING=1, + NET_IPV4_CONF_MC_FORWARDING=2, + NET_IPV4_CONF_PROXY_ARP=3, + NET_IPV4_CONF_ACCEPT_REDIRECTS=4, + NET_IPV4_CONF_SECURE_REDIRECTS=5, + NET_IPV4_CONF_SEND_REDIRECTS=6, + NET_IPV4_CONF_SHARED_MEDIA=7, + NET_IPV4_CONF_RP_FILTER=8, + NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9, + NET_IPV4_CONF_BOOTP_RELAY=10, + NET_IPV4_CONF_LOG_MARTIANS=11, + NET_IPV4_CONF_TAG=12, + NET_IPV4_CONF_ARPFILTER=13, + NET_IPV4_CONF_MEDIUM_ID=14, + NET_IPV4_CONF_NOXFRM=15, + NET_IPV4_CONF_NOPOLICY=16, + NET_IPV4_CONF_FORCE_IGMP_VERSION=17, + NET_IPV4_CONF_ARP_ANNOUNCE=18, + NET_IPV4_CONF_ARP_IGNORE=19, + NET_IPV4_CONF_PROMOTE_SECONDARIES=20, + NET_IPV4_CONF_ARP_ACCEPT=21, + NET_IPV4_CONF_ARP_NOTIFY=22, + __NET_IPV4_CONF_MAX +}; + +/* /proc/sys/net/ipv4/netfilter */ +enum +{ + NET_IPV4_NF_CONNTRACK_MAX=1, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, + NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10, + NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, + NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12, + NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13, + NET_IPV4_NF_CONNTRACK_BUCKETS=14, + NET_IPV4_NF_CONNTRACK_LOG_INVALID=15, + NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, + NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17, + NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18, + NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19, + NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, + NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, + NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, + NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, + NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, + NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, + NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, + NET_IPV4_NF_CONNTRACK_COUNT=27, + NET_IPV4_NF_CONNTRACK_CHECKSUM=28, +}; + +/* /proc/sys/net/ipv6 */ +enum { + NET_IPV6_CONF=16, + NET_IPV6_NEIGH=17, + NET_IPV6_ROUTE=18, + NET_IPV6_ICMP=19, + NET_IPV6_BINDV6ONLY=20, + NET_IPV6_IP6FRAG_HIGH_THRESH=21, + NET_IPV6_IP6FRAG_LOW_THRESH=22, + NET_IPV6_IP6FRAG_TIME=23, + NET_IPV6_IP6FRAG_SECRET_INTERVAL=24, + NET_IPV6_MLD_MAX_MSF=25, +}; + +enum { + NET_IPV6_ROUTE_FLUSH=1, + NET_IPV6_ROUTE_GC_THRESH=2, + NET_IPV6_ROUTE_MAX_SIZE=3, + NET_IPV6_ROUTE_GC_MIN_INTERVAL=4, + NET_IPV6_ROUTE_GC_TIMEOUT=5, + NET_IPV6_ROUTE_GC_INTERVAL=6, + NET_IPV6_ROUTE_GC_ELASTICITY=7, + NET_IPV6_ROUTE_MTU_EXPIRES=8, + NET_IPV6_ROUTE_MIN_ADVMSS=9, + NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10 +}; + +enum { + NET_IPV6_FORWARDING=1, + NET_IPV6_HOP_LIMIT=2, + NET_IPV6_MTU=3, + NET_IPV6_ACCEPT_RA=4, + NET_IPV6_ACCEPT_REDIRECTS=5, + NET_IPV6_AUTOCONF=6, + NET_IPV6_DAD_TRANSMITS=7, + NET_IPV6_RTR_SOLICITS=8, + NET_IPV6_RTR_SOLICIT_INTERVAL=9, + NET_IPV6_RTR_SOLICIT_DELAY=10, + NET_IPV6_USE_TEMPADDR=11, + NET_IPV6_TEMP_VALID_LFT=12, + NET_IPV6_TEMP_PREFERED_LFT=13, + NET_IPV6_REGEN_MAX_RETRY=14, + NET_IPV6_MAX_DESYNC_FACTOR=15, + NET_IPV6_MAX_ADDRESSES=16, + NET_IPV6_FORCE_MLD_VERSION=17, + NET_IPV6_ACCEPT_RA_DEFRTR=18, + NET_IPV6_ACCEPT_RA_PINFO=19, + NET_IPV6_ACCEPT_RA_RTR_PREF=20, + NET_IPV6_RTR_PROBE_INTERVAL=21, + NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, + NET_IPV6_PROXY_NDP=23, + NET_IPV6_ACCEPT_SOURCE_ROUTE=25, + __NET_IPV6_MAX +}; + +/* /proc/sys/net/ipv6/icmp */ +enum { + NET_IPV6_ICMP_RATELIMIT=1 +}; + +/* /proc/sys/net//neigh/ */ +enum { + NET_NEIGH_MCAST_SOLICIT=1, + NET_NEIGH_UCAST_SOLICIT=2, + NET_NEIGH_APP_SOLICIT=3, + NET_NEIGH_RETRANS_TIME=4, + NET_NEIGH_REACHABLE_TIME=5, + NET_NEIGH_DELAY_PROBE_TIME=6, + NET_NEIGH_GC_STALE_TIME=7, + NET_NEIGH_UNRES_QLEN=8, + NET_NEIGH_PROXY_QLEN=9, + NET_NEIGH_ANYCAST_DELAY=10, + NET_NEIGH_PROXY_DELAY=11, + NET_NEIGH_LOCKTIME=12, + NET_NEIGH_GC_INTERVAL=13, + NET_NEIGH_GC_THRESH1=14, + NET_NEIGH_GC_THRESH2=15, + NET_NEIGH_GC_THRESH3=16, + NET_NEIGH_RETRANS_TIME_MS=17, + NET_NEIGH_REACHABLE_TIME_MS=18, + __NET_NEIGH_MAX +}; + +/* /proc/sys/net/dccp */ +enum { + NET_DCCP_DEFAULT=1, +}; + +/* /proc/sys/net/ipx */ +enum { + NET_IPX_PPROP_BROADCASTING=1, + NET_IPX_FORWARDING=2 +}; + +/* /proc/sys/net/llc */ +enum { + NET_LLC2=1, + NET_LLC_STATION=2, +}; + +/* /proc/sys/net/llc/llc2 */ +enum { + NET_LLC2_TIMEOUT=1, +}; + +/* /proc/sys/net/llc/station */ +enum { + NET_LLC_STATION_ACK_TIMEOUT=1, +}; + +/* /proc/sys/net/llc/llc2/timeout */ +enum { + NET_LLC2_ACK_TIMEOUT=1, + NET_LLC2_P_TIMEOUT=2, + NET_LLC2_REJ_TIMEOUT=3, + NET_LLC2_BUSY_TIMEOUT=4, +}; + +/* /proc/sys/net/appletalk */ +enum { + NET_ATALK_AARP_EXPIRY_TIME=1, + NET_ATALK_AARP_TICK_TIME=2, + NET_ATALK_AARP_RETRANSMIT_LIMIT=3, + NET_ATALK_AARP_RESOLVE_TIME=4 +}; + + +/* /proc/sys/net/netrom */ +enum { + NET_NETROM_DEFAULT_PATH_QUALITY=1, + NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2, + NET_NETROM_NETWORK_TTL_INITIALISER=3, + NET_NETROM_TRANSPORT_TIMEOUT=4, + NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5, + NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6, + NET_NETROM_TRANSPORT_BUSY_DELAY=7, + NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, + NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, + NET_NETROM_ROUTING_CONTROL=10, + NET_NETROM_LINK_FAILS_COUNT=11, + NET_NETROM_RESET=12 +}; + +/* /proc/sys/net/ax25 */ +enum { + NET_AX25_IP_DEFAULT_MODE=1, + NET_AX25_DEFAULT_MODE=2, + NET_AX25_BACKOFF_TYPE=3, + NET_AX25_CONNECT_MODE=4, + NET_AX25_STANDARD_WINDOW=5, + NET_AX25_EXTENDED_WINDOW=6, + NET_AX25_T1_TIMEOUT=7, + NET_AX25_T2_TIMEOUT=8, + NET_AX25_T3_TIMEOUT=9, + NET_AX25_IDLE_TIMEOUT=10, + NET_AX25_N2=11, + NET_AX25_PACLEN=12, + NET_AX25_PROTOCOL=13, + NET_AX25_DAMA_SLAVE_TIMEOUT=14 +}; + +/* /proc/sys/net/rose */ +enum { + NET_ROSE_RESTART_REQUEST_TIMEOUT=1, + NET_ROSE_CALL_REQUEST_TIMEOUT=2, + NET_ROSE_RESET_REQUEST_TIMEOUT=3, + NET_ROSE_CLEAR_REQUEST_TIMEOUT=4, + NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5, + NET_ROSE_ROUTING_CONTROL=6, + NET_ROSE_LINK_FAIL_TIMEOUT=7, + NET_ROSE_MAX_VCS=8, + NET_ROSE_WINDOW_SIZE=9, + NET_ROSE_NO_ACTIVITY_TIMEOUT=10 +}; + +/* /proc/sys/net/x25 */ +enum { + NET_X25_RESTART_REQUEST_TIMEOUT=1, + NET_X25_CALL_REQUEST_TIMEOUT=2, + NET_X25_RESET_REQUEST_TIMEOUT=3, + NET_X25_CLEAR_REQUEST_TIMEOUT=4, + NET_X25_ACK_HOLD_BACK_TIMEOUT=5, + NET_X25_FORWARD=6 +}; + +/* /proc/sys/net/token-ring */ +enum +{ + NET_TR_RIF_TIMEOUT=1 +}; + +/* /proc/sys/net/decnet/ */ +enum { + NET_DECNET_NODE_TYPE = 1, + NET_DECNET_NODE_ADDRESS = 2, + NET_DECNET_NODE_NAME = 3, + NET_DECNET_DEFAULT_DEVICE = 4, + NET_DECNET_TIME_WAIT = 5, + NET_DECNET_DN_COUNT = 6, + NET_DECNET_DI_COUNT = 7, + NET_DECNET_DR_COUNT = 8, + NET_DECNET_DST_GC_INTERVAL = 9, + NET_DECNET_CONF = 10, + NET_DECNET_NO_FC_MAX_CWND = 11, + NET_DECNET_MEM = 12, + NET_DECNET_RMEM = 13, + NET_DECNET_WMEM = 14, + NET_DECNET_DEBUG_LEVEL = 255 +}; + +/* /proc/sys/net/decnet/conf/ */ +enum { + NET_DECNET_CONF_LOOPBACK = -2, + NET_DECNET_CONF_DDCMP = -3, + NET_DECNET_CONF_PPP = -4, + NET_DECNET_CONF_X25 = -5, + NET_DECNET_CONF_GRE = -6, + NET_DECNET_CONF_ETHER = -7 + + /* ... and ifindex of devices */ +}; + +/* /proc/sys/net/decnet/conf// */ +enum { + NET_DECNET_CONF_DEV_PRIORITY = 1, + NET_DECNET_CONF_DEV_T1 = 2, + NET_DECNET_CONF_DEV_T2 = 3, + NET_DECNET_CONF_DEV_T3 = 4, + NET_DECNET_CONF_DEV_FORWARDING = 5, + NET_DECNET_CONF_DEV_BLKSIZE = 6, + NET_DECNET_CONF_DEV_STATE = 7 +}; + +/* /proc/sys/net/sctp */ +enum { + NET_SCTP_RTO_INITIAL = 1, + NET_SCTP_RTO_MIN = 2, + NET_SCTP_RTO_MAX = 3, + NET_SCTP_RTO_ALPHA = 4, + NET_SCTP_RTO_BETA = 5, + NET_SCTP_VALID_COOKIE_LIFE = 6, + NET_SCTP_ASSOCIATION_MAX_RETRANS = 7, + NET_SCTP_PATH_MAX_RETRANS = 8, + NET_SCTP_MAX_INIT_RETRANSMITS = 9, + NET_SCTP_HB_INTERVAL = 10, + NET_SCTP_PRESERVE_ENABLE = 11, + NET_SCTP_MAX_BURST = 12, + NET_SCTP_ADDIP_ENABLE = 13, + NET_SCTP_PRSCTP_ENABLE = 14, + NET_SCTP_SNDBUF_POLICY = 15, + NET_SCTP_SACK_TIMEOUT = 16, + NET_SCTP_RCVBUF_POLICY = 17, +}; + +/* /proc/sys/net/bridge */ +enum { + NET_BRIDGE_NF_CALL_ARPTABLES = 1, + NET_BRIDGE_NF_CALL_IPTABLES = 2, + NET_BRIDGE_NF_CALL_IP6TABLES = 3, + NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, + NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5, +}; + +/* proc/sys/net/irda */ +enum { + NET_IRDA_DISCOVERY=1, + NET_IRDA_DEVNAME=2, + NET_IRDA_DEBUG=3, + NET_IRDA_FAST_POLL=4, + NET_IRDA_DISCOVERY_SLOTS=5, + NET_IRDA_DISCOVERY_TIMEOUT=6, + NET_IRDA_SLOT_TIMEOUT=7, + NET_IRDA_MAX_BAUD_RATE=8, + NET_IRDA_MIN_TX_TURN_TIME=9, + NET_IRDA_MAX_TX_DATA_SIZE=10, + NET_IRDA_MAX_TX_WINDOW=11, + NET_IRDA_MAX_NOREPLY_TIME=12, + NET_IRDA_WARN_NOREPLY_TIME=13, + NET_IRDA_LAP_KEEPALIVE_TIME=14, +}; + + +/* CTL_FS names: */ +enum +{ + FS_NRINODE=1, /* int:current number of allocated inodes */ + FS_STATINODE=2, + FS_MAXINODE=3, /* int:maximum number of inodes that can be allocated */ + FS_NRDQUOT=4, /* int:current number of allocated dquots */ + FS_MAXDQUOT=5, /* int:maximum number of dquots that can be allocated */ + FS_NRFILE=6, /* int:current number of allocated filedescriptors */ + FS_MAXFILE=7, /* int:maximum number of filedescriptors that can be allocated */ + FS_DENTRY=8, + FS_NRSUPER=9, /* int:current number of allocated super_blocks */ + FS_MAXSUPER=10, /* int:maximum number of super_blocks that can be allocated */ + FS_OVERFLOWUID=11, /* int: overflow UID */ + FS_OVERFLOWGID=12, /* int: overflow GID */ + FS_LEASES=13, /* int: leases enabled */ + FS_DIR_NOTIFY=14, /* int: directory notification enabled */ + FS_LEASE_TIME=15, /* int: maximum time to wait for a lease break */ + FS_DQSTATS=16, /* disc quota usage statistics and control */ + FS_XFS=17, /* struct: control xfs parameters */ + FS_AIO_NR=18, /* current system-wide number of aio requests */ + FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ + FS_INOTIFY=20, /* inotify submenu */ + FS_OCFS2=988, /* ocfs2 */ +}; + +/* /proc/sys/fs/quota/ */ +enum { + FS_DQ_LOOKUPS = 1, + FS_DQ_DROPS = 2, + FS_DQ_READS = 3, + FS_DQ_WRITES = 4, + FS_DQ_CACHE_HITS = 5, + FS_DQ_ALLOCATED = 6, + FS_DQ_FREE = 7, + FS_DQ_SYNCS = 8, + FS_DQ_WARNINGS = 9, +}; + +/* CTL_DEBUG names: */ + +/* CTL_DEV names: */ +enum { + DEV_CDROM=1, + DEV_HWMON=2, + DEV_PARPORT=3, + DEV_RAID=4, + DEV_MAC_HID=5, + DEV_SCSI=6, + DEV_IPMI=7, +}; + +/* /proc/sys/dev/cdrom */ +enum { + DEV_CDROM_INFO=1, + DEV_CDROM_AUTOCLOSE=2, + DEV_CDROM_AUTOEJECT=3, + DEV_CDROM_DEBUG=4, + DEV_CDROM_LOCK=5, + DEV_CDROM_CHECK_MEDIA=6 +}; + +/* /proc/sys/dev/parport */ +enum { + DEV_PARPORT_DEFAULT=-3 +}; + +/* /proc/sys/dev/raid */ +enum { + DEV_RAID_SPEED_LIMIT_MIN=1, + DEV_RAID_SPEED_LIMIT_MAX=2 +}; + +/* /proc/sys/dev/parport/default */ +enum { + DEV_PARPORT_DEFAULT_TIMESLICE=1, + DEV_PARPORT_DEFAULT_SPINTIME=2 +}; + +/* /proc/sys/dev/parport/parport n */ +enum { + DEV_PARPORT_SPINTIME=1, + DEV_PARPORT_BASE_ADDR=2, + DEV_PARPORT_IRQ=3, + DEV_PARPORT_DMA=4, + DEV_PARPORT_MODES=5, + DEV_PARPORT_DEVICES=6, + DEV_PARPORT_AUTOPROBE=16 +}; + +/* /proc/sys/dev/parport/parport n/devices/ */ +enum { + DEV_PARPORT_DEVICES_ACTIVE=-3, +}; + +/* /proc/sys/dev/parport/parport n/devices/device n */ +enum { + DEV_PARPORT_DEVICE_TIMESLICE=1, +}; + +/* /proc/sys/dev/mac_hid */ +enum { + DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1, + DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2, + DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3, + DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4, + DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5, + DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6 +}; + +/* /proc/sys/dev/scsi */ +enum { + DEV_SCSI_LOGGING_LEVEL=1, +}; + +/* /proc/sys/dev/ipmi */ +enum { + DEV_IPMI_POWEROFF_POWERCYCLE=1, +}; + +/* /proc/sys/abi */ +enum +{ + ABI_DEFHANDLER_COFF=1, /* default handler for coff binaries */ + ABI_DEFHANDLER_ELF=2, /* default handler for ELF binaries */ + ABI_DEFHANDLER_LCALL7=3,/* default handler for procs using lcall7 */ + ABI_DEFHANDLER_LIBCSO=4,/* default handler for an libc.so ELF interp */ + ABI_TRACE=5, /* tracing flags */ + ABI_FAKE_UTSNAME=6, /* fake target utsname information */ +}; + + +#endif /* _LINUX_SYSCTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/taskstats.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/taskstats.h new file mode 100644 index 0000000..341dddb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/taskstats.h @@ -0,0 +1,212 @@ +/* taskstats.h - exporting per-task statistics + * + * Copyright (C) Shailabh Nagar, IBM Corp. 2006 + * (C) Balbir Singh, IBM Corp. 2006 + * (C) Jay Lan, SGI, 2006 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2.1 of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef _LINUX_TASKSTATS_H +#define _LINUX_TASKSTATS_H + +#include + +/* Format for per-task data returned to userland when + * - a task exits + * - listener requests stats for a task + * + * The struct is versioned. Newer versions should only add fields to + * the bottom of the struct to maintain backward compatibility. + * + * + * To add new fields + * a) bump up TASKSTATS_VERSION + * b) add comment indicating new version number at end of struct + * c) add new fields after version comment; maintain 64-bit alignment + */ + + +#define TASKSTATS_VERSION 7 +#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN + * in linux/sched.h */ + +struct taskstats { + + /* The version number of this struct. This field is always set to + * TAKSTATS_VERSION, which is defined in . + * Each time the struct is changed, the value should be incremented. + */ + __u16 version; + __u32 ac_exitcode; /* Exit status */ + + /* The accounting flags of a task as defined in + * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG. + */ + __u8 ac_flag; /* Record flags */ + __u8 ac_nice; /* task_nice */ + + /* Delay accounting fields start + * + * All values, until comment "Delay accounting fields end" are + * available only if delay accounting is enabled, even though the last + * few fields are not delays + * + * xxx_count is the number of delay values recorded + * xxx_delay_total is the corresponding cumulative delay in nanoseconds + * + * xxx_delay_total wraps around to zero on overflow + * xxx_count incremented regardless of overflow + */ + + /* Delay waiting for cpu, while runnable + * count, delay_total NOT updated atomically + */ + __u64 cpu_count __attribute__((aligned(8))); + __u64 cpu_delay_total; + + /* Following four fields atomically updated using task->delays->lock */ + + /* Delay waiting for synchronous block I/O to complete + * does not account for delays in I/O submission + */ + __u64 blkio_count; + __u64 blkio_delay_total; + + /* Delay waiting for page fault I/O (swap in only) */ + __u64 swapin_count; + __u64 swapin_delay_total; + + /* cpu "wall-clock" running time + * On some architectures, value will adjust for cpu time stolen + * from the kernel in involuntary waits due to virtualization. + * Value is cumulative, in nanoseconds, without a corresponding count + * and wraps around to zero silently on overflow + */ + __u64 cpu_run_real_total; + + /* cpu "virtual" running time + * Uses time intervals seen by the kernel i.e. no adjustment + * for kernel's involuntary waits due to virtualization. + * Value is cumulative, in nanoseconds, without a corresponding count + * and wraps around to zero silently on overflow + */ + __u64 cpu_run_virtual_total; + /* Delay accounting fields end */ + /* version 1 ends here */ + + /* Basic Accounting Fields start */ + char ac_comm[TS_COMM_LEN]; /* Command name */ + __u8 ac_sched __attribute__((aligned(8))); + /* Scheduling discipline */ + __u8 ac_pad[3]; + __u32 ac_uid __attribute__((aligned(8))); + /* User ID */ + __u32 ac_gid; /* Group ID */ + __u32 ac_pid; /* Process ID */ + __u32 ac_ppid; /* Parent process ID */ + __u32 ac_btime; /* Begin time [sec since 1970] */ + __u64 ac_etime __attribute__((aligned(8))); + /* Elapsed time [usec] */ + __u64 ac_utime; /* User CPU time [usec] */ + __u64 ac_stime; /* SYstem CPU time [usec] */ + __u64 ac_minflt; /* Minor Page Fault Count */ + __u64 ac_majflt; /* Major Page Fault Count */ + /* Basic Accounting Fields end */ + + /* Extended accounting fields start */ + /* Accumulated RSS usage in duration of a task, in MBytes-usecs. + * The current rss usage is added to this counter every time + * a tick is charged to a task's system time. So, at the end we + * will have memory usage multiplied by system time. Thus an + * average usage per system time unit can be calculated. + */ + __u64 coremem; /* accumulated RSS usage in MB-usec */ + /* Accumulated virtual memory usage in duration of a task. + * Same as acct_rss_mem1 above except that we keep track of VM usage. + */ + __u64 virtmem; /* accumulated VM usage in MB-usec */ + + /* High watermark of RSS and virtual memory usage in duration of + * a task, in KBytes. + */ + __u64 hiwater_rss; /* High-watermark of RSS usage, in KB */ + __u64 hiwater_vm; /* High-water VM usage, in KB */ + + /* The following four fields are I/O statistics of a task. */ + __u64 read_char; /* bytes read */ + __u64 write_char; /* bytes written */ + __u64 read_syscalls; /* read syscalls */ + __u64 write_syscalls; /* write syscalls */ + /* Extended accounting fields end */ + +#define TASKSTATS_HAS_IO_ACCOUNTING + /* Per-task storage I/O accounting starts */ + __u64 read_bytes; /* bytes of read I/O */ + __u64 write_bytes; /* bytes of write I/O */ + __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */ + + __u64 nvcsw; /* voluntary_ctxt_switches */ + __u64 nivcsw; /* nonvoluntary_ctxt_switches */ + + /* time accounting for SMT machines */ + __u64 ac_utimescaled; /* utime scaled on frequency etc */ + __u64 ac_stimescaled; /* stime scaled on frequency etc */ + __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ + + /* Delay waiting for memory reclaim */ + __u64 freepages_count; + __u64 freepages_delay_total; +}; + + +/* + * Commands sent from userspace + * Not versioned. New commands should only be inserted at the enum's end + * prior to __TASKSTATS_CMD_MAX + */ + +enum { + TASKSTATS_CMD_UNSPEC = 0, /* Reserved */ + TASKSTATS_CMD_GET, /* user->kernel request/get-response */ + TASKSTATS_CMD_NEW, /* kernel->user event */ + __TASKSTATS_CMD_MAX, +}; + +#define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1) + +enum { + TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */ + TASKSTATS_TYPE_PID, /* Process id */ + TASKSTATS_TYPE_TGID, /* Thread group id */ + TASKSTATS_TYPE_STATS, /* taskstats structure */ + TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */ + TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */ + __TASKSTATS_TYPE_MAX, +}; + +#define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1) + +enum { + TASKSTATS_CMD_ATTR_UNSPEC = 0, + TASKSTATS_CMD_ATTR_PID, + TASKSTATS_CMD_ATTR_TGID, + TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, + TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, + __TASKSTATS_CMD_ATTR_MAX, +}; + +#define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1) + +/* NETLINK_GENERIC related info */ + +#define TASKSTATS_GENL_NAME "TASKSTATS" +#define TASKSTATS_GENL_VERSION 0x1 + +#endif /* _LINUX_TASKSTATS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/..install.cmd new file mode 100644 index 0000000..1ab211c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/tc_act/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/tc_act /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/tc_act mips tc_gact.h tc_ipt.h tc_mirred.h tc_nat.h tc_pedit.h tc_skbedit.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/tc_act /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/tc_act mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/tc_act/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_gact.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_gact.h new file mode 100644 index 0000000..e895c0a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_gact.h @@ -0,0 +1,35 @@ +#ifndef __LINUX_TC_GACT_H +#define __LINUX_TC_GACT_H + +#include +#include + +#define TCA_ACT_GACT 5 +struct tc_gact +{ + tc_gen; + +}; + +struct tc_gact_p +{ +#define PGACT_NONE 0 +#define PGACT_NETRAND 1 +#define PGACT_DETERM 2 +#define MAX_RAND (PGACT_DETERM + 1 ) + __u16 ptype; + __u16 pval; + int paction; +}; + +enum +{ + TCA_GACT_UNSPEC, + TCA_GACT_TM, + TCA_GACT_PARMS, + TCA_GACT_PROB, + __TCA_GACT_MAX +}; +#define TCA_GACT_MAX (__TCA_GACT_MAX - 1) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_ipt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_ipt.h new file mode 100644 index 0000000..4b6f7b6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_ipt.h @@ -0,0 +1,21 @@ +#ifndef __LINUX_TC_IPT_H +#define __LINUX_TC_IPT_H + +#include + +#define TCA_ACT_IPT 6 + +enum +{ + TCA_IPT_UNSPEC, + TCA_IPT_TABLE, + TCA_IPT_HOOK, + TCA_IPT_INDEX, + TCA_IPT_CNT, + TCA_IPT_TM, + TCA_IPT_TARG, + __TCA_IPT_MAX +}; +#define TCA_IPT_MAX (__TCA_IPT_MAX - 1) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_mirred.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_mirred.h new file mode 100644 index 0000000..0a99ab6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_mirred.h @@ -0,0 +1,29 @@ +#ifndef __LINUX_TC_MIR_H +#define __LINUX_TC_MIR_H + +#include +#include + +#define TCA_ACT_MIRRED 8 +#define TCA_EGRESS_REDIR 1 /* packet redirect to EGRESS*/ +#define TCA_EGRESS_MIRROR 2 /* mirror packet to EGRESS */ +#define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ +#define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ + +struct tc_mirred +{ + tc_gen; + int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ + __u32 ifindex; /* ifindex of egress port */ +}; + +enum +{ + TCA_MIRRED_UNSPEC, + TCA_MIRRED_TM, + TCA_MIRRED_PARMS, + __TCA_MIRRED_MAX +}; +#define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_nat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_nat.h new file mode 100644 index 0000000..e7cf31e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_nat.h @@ -0,0 +1,29 @@ +#ifndef __LINUX_TC_NAT_H +#define __LINUX_TC_NAT_H + +#include +#include + +#define TCA_ACT_NAT 9 + +enum +{ + TCA_NAT_UNSPEC, + TCA_NAT_PARMS, + TCA_NAT_TM, + __TCA_NAT_MAX +}; +#define TCA_NAT_MAX (__TCA_NAT_MAX - 1) + +#define TCA_NAT_FLAG_EGRESS 1 + +struct tc_nat +{ + tc_gen; + __be32 old_addr; + __be32 new_addr; + __be32 mask; + __u32 flags; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_pedit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_pedit.h new file mode 100644 index 0000000..54ce906 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_pedit.h @@ -0,0 +1,37 @@ +#ifndef __LINUX_TC_PED_H +#define __LINUX_TC_PED_H + +#include +#include + +#define TCA_ACT_PEDIT 7 + +enum +{ + TCA_PEDIT_UNSPEC, + TCA_PEDIT_TM, + TCA_PEDIT_PARMS, + __TCA_PEDIT_MAX +}; +#define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) + +struct tc_pedit_key +{ + __u32 mask; /* AND */ + __u32 val; /*XOR */ + __u32 off; /*offset */ + __u32 at; + __u32 offmask; + __u32 shift; +}; + +struct tc_pedit_sel +{ + tc_gen; + unsigned char nkeys; + unsigned char flags; + struct tc_pedit_key keys[0]; +}; +#define tc_pedit tc_pedit_sel + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_skbedit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_skbedit.h new file mode 100644 index 0000000..a14e461 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_act/tc_skbedit.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2008, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * Author: Alexander Duyck + */ + +#ifndef __LINUX_TC_SKBEDIT_H +#define __LINUX_TC_SKBEDIT_H + +#include + +#define TCA_ACT_SKBEDIT 11 + +#define SKBEDIT_F_PRIORITY 0x1 +#define SKBEDIT_F_QUEUE_MAPPING 0x2 + +struct tc_skbedit { + tc_gen; +}; + +enum { + TCA_SKBEDIT_UNSPEC, + TCA_SKBEDIT_TM, + TCA_SKBEDIT_PARMS, + TCA_SKBEDIT_PRIORITY, + TCA_SKBEDIT_QUEUE_MAPPING, + __TCA_SKBEDIT_MAX +}; +#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/..install.cmd new file mode 100644 index 0000000..1e775be --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/tc_ematch/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/tc_ematch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/tc_ematch mips tc_em_cmp.h tc_em_meta.h tc_em_nbyte.h tc_em_text.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/tc_ematch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/tc_ematch mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/tc_ematch/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_cmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_cmp.h new file mode 100644 index 0000000..38e7f7b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_cmp.h @@ -0,0 +1,27 @@ +#ifndef __LINUX_TC_EM_CMP_H +#define __LINUX_TC_EM_CMP_H + +#include +#include + +struct tcf_em_cmp +{ + __u32 val; + __u32 mask; + __u16 off; + __u8 align:4; + __u8 flags:4; + __u8 layer:4; + __u8 opnd:4; +}; + +enum +{ + TCF_EM_ALIGN_U8 = 1, + TCF_EM_ALIGN_U16 = 2, + TCF_EM_ALIGN_U32 = 4 +}; + +#define TCF_EM_CMP_TRANS 1 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_meta.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_meta.h new file mode 100644 index 0000000..dcfb733 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_meta.h @@ -0,0 +1,96 @@ +#ifndef __LINUX_TC_EM_META_H +#define __LINUX_TC_EM_META_H + +#include +#include + +enum +{ + TCA_EM_META_UNSPEC, + TCA_EM_META_HDR, + TCA_EM_META_LVALUE, + TCA_EM_META_RVALUE, + __TCA_EM_META_MAX +}; +#define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) + +struct tcf_meta_val +{ + __u16 kind; + __u8 shift; + __u8 op; +}; + +#define TCF_META_TYPE_MASK (0xf << 12) +#define TCF_META_TYPE(kind) (((kind) & TCF_META_TYPE_MASK) >> 12) +#define TCF_META_ID_MASK 0x7ff +#define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) + +enum +{ + TCF_META_TYPE_VAR, + TCF_META_TYPE_INT, + __TCF_META_TYPE_MAX +}; +#define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) + +enum +{ + TCF_META_ID_VALUE, + TCF_META_ID_RANDOM, + TCF_META_ID_LOADAVG_0, + TCF_META_ID_LOADAVG_1, + TCF_META_ID_LOADAVG_2, + TCF_META_ID_DEV, + TCF_META_ID_PRIORITY, + TCF_META_ID_PROTOCOL, + TCF_META_ID_PKTTYPE, + TCF_META_ID_PKTLEN, + TCF_META_ID_DATALEN, + TCF_META_ID_MACLEN, + TCF_META_ID_NFMARK, + TCF_META_ID_TCINDEX, + TCF_META_ID_RTCLASSID, + TCF_META_ID_RTIIF, + TCF_META_ID_SK_FAMILY, + TCF_META_ID_SK_STATE, + TCF_META_ID_SK_REUSE, + TCF_META_ID_SK_BOUND_IF, + TCF_META_ID_SK_REFCNT, + TCF_META_ID_SK_SHUTDOWN, + TCF_META_ID_SK_PROTO, + TCF_META_ID_SK_TYPE, + TCF_META_ID_SK_RCVBUF, + TCF_META_ID_SK_RMEM_ALLOC, + TCF_META_ID_SK_WMEM_ALLOC, + TCF_META_ID_SK_OMEM_ALLOC, + TCF_META_ID_SK_WMEM_QUEUED, + TCF_META_ID_SK_RCV_QLEN, + TCF_META_ID_SK_SND_QLEN, + TCF_META_ID_SK_ERR_QLEN, + TCF_META_ID_SK_FORWARD_ALLOCS, + TCF_META_ID_SK_SNDBUF, + TCF_META_ID_SK_ALLOCS, + TCF_META_ID_SK_ROUTE_CAPS, + TCF_META_ID_SK_HASH, + TCF_META_ID_SK_LINGERTIME, + TCF_META_ID_SK_ACK_BACKLOG, + TCF_META_ID_SK_MAX_ACK_BACKLOG, + TCF_META_ID_SK_PRIO, + TCF_META_ID_SK_RCVLOWAT, + TCF_META_ID_SK_RCVTIMEO, + TCF_META_ID_SK_SNDTIMEO, + TCF_META_ID_SK_SENDMSG_OFF, + TCF_META_ID_SK_WRITE_PENDING, + TCF_META_ID_VLAN_TAG, + __TCF_META_ID_MAX +}; +#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) + +struct tcf_meta_hdr +{ + struct tcf_meta_val left; + struct tcf_meta_val right; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_nbyte.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_nbyte.h new file mode 100644 index 0000000..9ed8c2e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_nbyte.h @@ -0,0 +1,14 @@ +#ifndef __LINUX_TC_EM_NBYTE_H +#define __LINUX_TC_EM_NBYTE_H + +#include +#include + +struct tcf_em_nbyte +{ + __u16 off; + __u16 len:12; + __u8 layer:4; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_text.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_text.h new file mode 100644 index 0000000..d12a73a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tc_ematch/tc_em_text.h @@ -0,0 +1,20 @@ +#ifndef __LINUX_TC_EM_TEXT_H +#define __LINUX_TC_EM_TEXT_H + +#include +#include + +#define TC_EM_TEXT_ALGOSIZ 16 + +struct tcf_em_text +{ + char algo[TC_EM_TEXT_ALGOSIZ]; + __u16 from_offset; + __u16 to_offset; + __u16 pattern_len; + __u8 from_layer:4; + __u8 to_layer:4; + __u8 pad; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tcp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tcp.h new file mode 100644 index 0000000..959231d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tcp.h @@ -0,0 +1,174 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the TCP protocol. + * + * Version: @(#)tcp.h 1.0.2 04/28/93 + * + * Author: Fred N. van Kempen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_TCP_H +#define _LINUX_TCP_H + +#include +#include +#include + +struct tcphdr { + __be16 source; + __be16 dest; + __be32 seq; + __be32 ack_seq; +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u16 res1:4, + doff:4, + fin:1, + syn:1, + rst:1, + psh:1, + ack:1, + urg:1, + ece:1, + cwr:1; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u16 doff:4, + res1:4, + cwr:1, + ece:1, + urg:1, + ack:1, + psh:1, + rst:1, + syn:1, + fin:1; +#else +#error "Adjust your defines" +#endif + __be16 window; + __sum16 check; + __be16 urg_ptr; +}; + +/* + * The union cast uses a gcc extension to avoid aliasing problems + * (union is compatible to any of its members) + * This means this part of the code is -fstrict-aliasing safe now. + */ +union tcp_word_hdr { + struct tcphdr hdr; + __be32 words[5]; +}; + +#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) + +enum { + TCP_FLAG_CWR = __cpu_to_be32(0x00800000), + TCP_FLAG_ECE = __cpu_to_be32(0x00400000), + TCP_FLAG_URG = __cpu_to_be32(0x00200000), + TCP_FLAG_ACK = __cpu_to_be32(0x00100000), + TCP_FLAG_PSH = __cpu_to_be32(0x00080000), + TCP_FLAG_RST = __cpu_to_be32(0x00040000), + TCP_FLAG_SYN = __cpu_to_be32(0x00020000), + TCP_FLAG_FIN = __cpu_to_be32(0x00010000), + TCP_RESERVED_BITS = __cpu_to_be32(0x0F000000), + TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000) +}; + +/* TCP socket options */ +#define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ +#define TCP_MAXSEG 2 /* Limit MSS */ +#define TCP_CORK 3 /* Never send partially complete segments */ +#define TCP_KEEPIDLE 4 /* Start keeplives after this period */ +#define TCP_KEEPINTVL 5 /* Interval between keepalives */ +#define TCP_KEEPCNT 6 /* Number of keepalives before death */ +#define TCP_SYNCNT 7 /* Number of SYN retransmits */ +#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ +#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ +#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ +#define TCP_INFO 11 /* Information about this connection. */ +#define TCP_QUICKACK 12 /* Block/reenable quick acks */ +#define TCP_CONGESTION 13 /* Congestion control algorithm */ +#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ + +#define TCPI_OPT_TIMESTAMPS 1 +#define TCPI_OPT_SACK 2 +#define TCPI_OPT_WSCALE 4 +#define TCPI_OPT_ECN 8 + +enum tcp_ca_state +{ + TCP_CA_Open = 0, +#define TCPF_CA_Open (1< + * Greg Herlein, + * + * Contributors: Alan Cox, + * David W. Erhart, + * + * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET + * TECHNOLOGIES, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION + * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + *****************************************************************************/ + +#ifndef TELEPHONY_H +#define TELEPHONY_H + +#define TELEPHONY_VERSION 3013 + +#define PHONE_VENDOR_IXJ 1 +#define PHONE_VENDOR_QUICKNET PHONE_VENDOR_IXJ +#define PHONE_VENDOR_VOICETRONIX 2 +#define PHONE_VENDOR_ACULAB 3 +#define PHONE_VENDOR_DIGI 4 +#define PHONE_VENDOR_FRANKLIN 5 + +/****************************************************************************** + * Vendor Summary Information Area + * + * Quicknet Technologies, Inc. - makes low density analog telephony cards + * with audio compression, POTS and PSTN interfaces (www.quicknet.net) + * + * (other vendors following this API shuld add a short description of + * the telephony products they support under Linux) + * + *****************************************************************************/ +#define QTI_PHONEJACK 100 +#define QTI_LINEJACK 300 +#define QTI_PHONEJACK_LITE 400 +#define QTI_PHONEJACK_PCI 500 +#define QTI_PHONECARD 600 + +/****************************************************************************** +* +* The capabilities ioctls can inform you of the capabilities of each phone +* device installed in your system. The PHONECTL_CAPABILITIES ioctl +* returns an integer value indicating the number of capabilities the +* device has. The PHONECTL_CAPABILITIES_LIST will fill an array of +* capability structs with all of its capabilities. The +* PHONECTL_CAPABILITIES_CHECK takes a single capability struct and returns +* a TRUE if the device has that capability, otherwise it returns false. +* +******************************************************************************/ +typedef enum { + vendor = 0, + device, + port, + codec, + dsp +} phone_cap; + +struct phone_capability { + char desc[80]; + phone_cap captype; + int cap; + int handle; +}; + +typedef enum { + pots = 0, + pstn, + handset, + speaker +} phone_ports; + +#define PHONE_CAPABILITIES _IO ('q', 0x80) +#define PHONE_CAPABILITIES_LIST _IOR ('q', 0x81, struct phone_capability *) +#define PHONE_CAPABILITIES_CHECK _IOW ('q', 0x82, struct phone_capability *) + +typedef struct { + char month[3]; + char day[3]; + char hour[3]; + char min[3]; + int numlen; + char number[11]; + int namelen; + char name[80]; +} PHONE_CID; + +#define PHONE_RING _IO ('q', 0x83) +#define PHONE_HOOKSTATE _IO ('q', 0x84) +#define PHONE_MAXRINGS _IOW ('q', 0x85, char) +#define PHONE_RING_CADENCE _IOW ('q', 0x86, short) +#define OLD_PHONE_RING_START _IO ('q', 0x87) +#define PHONE_RING_START _IOW ('q', 0x87, PHONE_CID *) +#define PHONE_RING_STOP _IO ('q', 0x88) + +#define USA_RING_CADENCE 0xC0C0 + +#define PHONE_REC_CODEC _IOW ('q', 0x89, int) +#define PHONE_REC_START _IO ('q', 0x8A) +#define PHONE_REC_STOP _IO ('q', 0x8B) +#define PHONE_REC_DEPTH _IOW ('q', 0x8C, int) +#define PHONE_FRAME _IOW ('q', 0x8D, int) +#define PHONE_REC_VOLUME _IOW ('q', 0x8E, int) +#define PHONE_REC_VOLUME_LINEAR _IOW ('q', 0xDB, int) +#define PHONE_REC_LEVEL _IO ('q', 0x8F) + +#define PHONE_PLAY_CODEC _IOW ('q', 0x90, int) +#define PHONE_PLAY_START _IO ('q', 0x91) +#define PHONE_PLAY_STOP _IO ('q', 0x92) +#define PHONE_PLAY_DEPTH _IOW ('q', 0x93, int) +#define PHONE_PLAY_VOLUME _IOW ('q', 0x94, int) +#define PHONE_PLAY_VOLUME_LINEAR _IOW ('q', 0xDC, int) +#define PHONE_PLAY_LEVEL _IO ('q', 0x95) +#define PHONE_DTMF_READY _IOR ('q', 0x96, int) +#define PHONE_GET_DTMF _IOR ('q', 0x97, int) +#define PHONE_GET_DTMF_ASCII _IOR ('q', 0x98, int) +#define PHONE_DTMF_OOB _IOW ('q', 0x99, int) +#define PHONE_EXCEPTION _IOR ('q', 0x9A, int) +#define PHONE_PLAY_TONE _IOW ('q', 0x9B, char) +#define PHONE_SET_TONE_ON_TIME _IOW ('q', 0x9C, int) +#define PHONE_SET_TONE_OFF_TIME _IOW ('q', 0x9D, int) +#define PHONE_GET_TONE_ON_TIME _IO ('q', 0x9E) +#define PHONE_GET_TONE_OFF_TIME _IO ('q', 0x9F) +#define PHONE_GET_TONE_STATE _IO ('q', 0xA0) +#define PHONE_BUSY _IO ('q', 0xA1) +#define PHONE_RINGBACK _IO ('q', 0xA2) +#define PHONE_DIALTONE _IO ('q', 0xA3) +#define PHONE_CPT_STOP _IO ('q', 0xA4) + +#define PHONE_PSTN_SET_STATE _IOW ('q', 0xA4, int) +#define PHONE_PSTN_GET_STATE _IO ('q', 0xA5) + +#define PSTN_ON_HOOK 0 +#define PSTN_RINGING 1 +#define PSTN_OFF_HOOK 2 +#define PSTN_PULSE_DIAL 3 + +/****************************************************************************** +* +* The wink duration is tunable with this ioctl. The default wink duration +* is 320ms. You do not need to use this ioctl if you do not require a +* different wink duration. +* +******************************************************************************/ +#define PHONE_WINK_DURATION _IOW ('q', 0xA6, int) +#define PHONE_WINK _IOW ('q', 0xAA, int) + +/****************************************************************************** +* +* Codec Definitions +* +******************************************************************************/ +typedef enum { + G723_63 = 1, + G723_53 = 2, + TS85 = 3, + TS48 = 4, + TS41 = 5, + G728 = 6, + G729 = 7, + ULAW = 8, + ALAW = 9, + LINEAR16 = 10, + LINEAR8 = 11, + WSS = 12, + G729B = 13 +} phone_codec; + +struct phone_codec_data +{ + phone_codec type; + unsigned short buf_min, buf_opt, buf_max; +}; + +#define PHONE_QUERY_CODEC _IOWR ('q', 0xA7, struct phone_codec_data *) +#define PHONE_PSTN_LINETEST _IO ('q', 0xA8) + +/****************************************************************************** +* +* This controls the VAD/CNG functionality of G.723.1. The driver will +* always pass full size frames, any unused bytes will be padded with zeros, +* and frames passed to the driver should also be padded with zeros. The +* frame type is encoded in the least significant two bits of the first +* WORD of the frame as follows: +* +* bits 1-0 Frame Type Data Rate Significant Words +* 00 0 G.723.1 6.3 12 +* 01 1 G.723.1 5.3 10 +* 10 2 VAD/CNG 2 +* 11 3 Repeat last CNG 2 bits +* +******************************************************************************/ +#define PHONE_VAD _IOW ('q', 0xA9, int) + + +/****************************************************************************** +* +* The exception structure allows us to multiplex multiple events onto the +* select() exception set. If any of these flags are set select() will +* return with a positive indication on the exception set. The dtmf_ready +* bit indicates if there is data waiting in the DTMF buffer. The +* hookstate bit is set if there is a change in hookstate status, it does not +* indicate the current state of the hookswitch. The pstn_ring bit +* indicates that the DAA on a LineJACK card has detected ring voltage on +* the PSTN port. The caller_id bit indicates that caller_id data has been +* received and is available. The pstn_wink bit indicates that the DAA on +* the LineJACK has received a wink from the telco switch. The f0, f1, f2 +* and f3 bits indicate that the filter has been triggered by detecting the +* frequency programmed into that filter. +* +* The remaining bits should be set to zero. They will become defined over time +* for other interface cards and their needs. +* +******************************************************************************/ +struct phone_except +{ + unsigned int dtmf_ready:1; + unsigned int hookstate:1; + unsigned int pstn_ring:1; + unsigned int caller_id:1; + unsigned int pstn_wink:1; + unsigned int f0:1; + unsigned int f1:1; + unsigned int f2:1; + unsigned int f3:1; + unsigned int flash:1; + unsigned int fc0:1; + unsigned int fc1:1; + unsigned int fc2:1; + unsigned int fc3:1; + unsigned int reserved:18; +}; + +union telephony_exception { + struct phone_except bits; + unsigned int bytes; +}; + + +#endif /* TELEPHONY_H */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/termios.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/termios.h new file mode 100644 index 0000000..2acd0c1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/termios.h @@ -0,0 +1,22 @@ +#ifndef _LINUX_TERMIOS_H +#define _LINUX_TERMIOS_H + +#include +#include + +#define NFF 5 + +struct termiox +{ + __u16 x_hflag; + __u16 x_cflag; + __u16 x_rflag[NFF]; + __u16 x_sflag; +}; + +#define RTSXOFF 0x0001 /* RTS flow control on input */ +#define CTSXON 0x0002 /* CTS flow control on output */ +#define DTRXOFF 0x0004 /* DTR flow control on input */ +#define DSRXON 0x0008 /* DCD flow control on output */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/time.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/time.h new file mode 100644 index 0000000..12d8c89 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/time.h @@ -0,0 +1,74 @@ +#ifndef _LINUX_TIME_H +#define _LINUX_TIME_H + +#include + + +#ifndef _STRUCT_TIMESPEC +#define _STRUCT_TIMESPEC +struct timespec { + __kernel_time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; +#endif + +struct timeval { + __kernel_time_t tv_sec; /* seconds */ + __kernel_suseconds_t tv_usec; /* microseconds */ +}; + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + + +#define NFDBITS __NFDBITS + +#define FD_SETSIZE __FD_SETSIZE +#define FD_SET(fd,fdsetp) __FD_SET(fd,fdsetp) +#define FD_CLR(fd,fdsetp) __FD_CLR(fd,fdsetp) +#define FD_ISSET(fd,fdsetp) __FD_ISSET(fd,fdsetp) +#define FD_ZERO(fdsetp) __FD_ZERO(fdsetp) + +/* + * Names of the interval timers, and structure + * defining a timer setting: + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerspec { + struct timespec it_interval; /* timer period */ + struct timespec it_value; /* timer expiration */ +}; + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +/* + * The IDs of the various system clocks (for POSIX.1b interval timers): + */ +#define CLOCK_REALTIME 0 +#define CLOCK_MONOTONIC 1 +#define CLOCK_PROCESS_CPUTIME_ID 2 +#define CLOCK_THREAD_CPUTIME_ID 3 +#define CLOCK_MONOTONIC_RAW 4 + +/* + * The IDs of various hardware clocks: + */ +#define CLOCK_SGI_CYCLE 10 +#define MAX_CLOCKS 16 +#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) +#define CLOCKS_MONO CLOCK_MONOTONIC + +/* + * The various flags for setting POSIX.1b interval timers: + */ +#define TIMER_ABSTIME 0x01 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/times.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/times.h new file mode 100644 index 0000000..87b6261 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/times.h @@ -0,0 +1,13 @@ +#ifndef _LINUX_TIMES_H +#define _LINUX_TIMES_H + +#include + +struct tms { + __kernel_clock_t tms_utime; + __kernel_clock_t tms_stime; + __kernel_clock_t tms_cutime; + __kernel_clock_t tms_cstime; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/timex.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/timex.h new file mode 100644 index 0000000..43789d9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/timex.h @@ -0,0 +1,160 @@ +/***************************************************************************** + * * + * Copyright (c) David L. Mills 1993 * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appears in all copies and that both the * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name University of Delaware not be used in * + * advertising or publicity pertaining to distribution of the software * + * without specific, written prior permission. The University of Delaware * + * makes no representations about the suitability this software for any * + * purpose. It is provided "as is" without express or implied warranty. * + * * + *****************************************************************************/ + +/* + * Modification history timex.h + * + * 29 Dec 97 Russell King + * Moved CLOCK_TICK_RATE, CLOCK_TICK_FACTOR and FINETUNE to asm/timex.h + * for ARM machines + * + * 9 Jan 97 Adrian Sun + * Shifted LATCH define to allow access to alpha machines. + * + * 26 Sep 94 David L. Mills + * Added defines for hybrid phase/frequency-lock loop. + * + * 19 Mar 94 David L. Mills + * Moved defines from kernel routines to header file and added new + * defines for PPS phase-lock loop. + * + * 20 Feb 94 David L. Mills + * Revised status codes and structures for external clock and PPS + * signal discipline. + * + * 28 Nov 93 David L. Mills + * Adjusted parameters to improve stability and increase poll + * interval. + * + * 17 Sep 93 David L. Mills + * Created file $NTP/include/sys/timex.h + * 07 Oct 93 Torsten Duwe + * Derived linux/timex.h + * 1995-08-13 Torsten Duwe + * kernel PLL updated to 1994-12-13 specs (rfc-1589) + * 1997-08-30 Ulrich Windl + * Added new constant NTP_PHASE_LIMIT + * 2004-08-12 Christoph Lameter + * Reworked time interpolation logic + */ +#ifndef _LINUX_TIMEX_H +#define _LINUX_TIMEX_H + +#include + +#define NTP_API 4 /* NTP API version */ + +/* + * syscall interface - used (mainly by NTP daemon) + * to discipline kernel clock oscillator + */ +struct timex { + unsigned int modes; /* mode selector */ + long offset; /* time offset (usec) */ + long freq; /* frequency offset (scaled ppm) */ + long maxerror; /* maximum error (usec) */ + long esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + long constant; /* pll time constant */ + long precision; /* clock precision (usec) (read only) */ + long tolerance; /* clock frequency tolerance (ppm) + * (read only) + */ + struct timeval time; /* (read only) */ + long tick; /* (modified) usecs between clock ticks */ + + long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + long stabil; /* pps stability (scaled ppm) (ro) */ + long jitcnt; /* jitter limit exceeded (ro) */ + long calcnt; /* calibration intervals (ro) */ + long errcnt; /* calibration errors (ro) */ + long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; +}; + +/* + * Mode codes (timex.mode) + */ +#define ADJ_OFFSET 0x0001 /* time offset */ +#define ADJ_FREQUENCY 0x0002 /* frequency offset */ +#define ADJ_MAXERROR 0x0004 /* maximum time error */ +#define ADJ_ESTERROR 0x0008 /* estimated time error */ +#define ADJ_STATUS 0x0010 /* clock status */ +#define ADJ_TIMECONST 0x0020 /* pll time constant */ +#define ADJ_TAI 0x0080 /* set TAI offset */ +#define ADJ_MICRO 0x1000 /* select microsecond resolution */ +#define ADJ_NANO 0x2000 /* select nanosecond resolution */ +#define ADJ_TICK 0x4000 /* tick value */ + +#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ +#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ + +/* xntp 3.4 compatibility names */ +#define MOD_OFFSET ADJ_OFFSET +#define MOD_FREQUENCY ADJ_FREQUENCY +#define MOD_MAXERROR ADJ_MAXERROR +#define MOD_ESTERROR ADJ_ESTERROR +#define MOD_STATUS ADJ_STATUS +#define MOD_TIMECONST ADJ_TIMECONST + + +/* + * Status codes (timex.status) + */ +#define STA_PLL 0x0001 /* enable PLL updates (rw) */ +#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ +#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ +#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ + +#define STA_INS 0x0010 /* insert leap (rw) */ +#define STA_DEL 0x0020 /* delete leap (rw) */ +#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ +#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ + +#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ +#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ +#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ +#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ + +#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ +#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ +#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ +#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ + +/* read-only bits */ +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ + STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) + +/* + * Clock states (time_state) + */ +#define TIME_OK 0 /* clock synchronized, no leap second */ +#define TIME_INS 1 /* insert leap second */ +#define TIME_DEL 2 /* delete leap second */ +#define TIME_OOP 3 /* leap second in progress */ +#define TIME_WAIT 4 /* leap second has occurred */ +#define TIME_ERROR 5 /* clock not synchronized */ +#define TIME_BAD TIME_ERROR /* bw compat */ + + +#endif /* LINUX_TIMEX_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tiocl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tiocl.h new file mode 100644 index 0000000..4756862 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tiocl.h @@ -0,0 +1,39 @@ +#ifndef _LINUX_TIOCL_H +#define _LINUX_TIOCL_H + +#define TIOCL_SETSEL 2 /* set a selection */ +#define TIOCL_SELCHAR 0 /* select characters */ +#define TIOCL_SELWORD 1 /* select whole words */ +#define TIOCL_SELLINE 2 /* select whole lines */ +#define TIOCL_SELPOINTER 3 /* show the pointer */ +#define TIOCL_SELCLEAR 4 /* clear visibility of selection */ +#define TIOCL_SELMOUSEREPORT 16 /* report beginning of selection */ +#define TIOCL_SELBUTTONMASK 15 /* button mask for report */ +/* selection extent */ +struct tiocl_selection { + unsigned short xs; /* X start */ + unsigned short ys; /* Y start */ + unsigned short xe; /* X end */ + unsigned short ye; /* Y end */ + unsigned short sel_mode; /* selection mode */ +}; + +#define TIOCL_PASTESEL 3 /* paste previous selection */ +#define TIOCL_UNBLANKSCREEN 4 /* unblank screen */ + +#define TIOCL_SELLOADLUT 5 + /* set characters to be considered alphabetic when selecting */ + /* u32[8] bit array, 4 bytes-aligned with type */ + +/* these two don't return a value: they write it back in the type */ +#define TIOCL_GETSHIFTSTATE 6 /* write shift state */ +#define TIOCL_GETMOUSEREPORTING 7 /* write whether mouse event are reported */ +#define TIOCL_SETVESABLANK 10 /* set vesa blanking mode */ +#define TIOCL_SETKMSGREDIRECT 11 /* restrict kernel messages to a vt */ +#define TIOCL_GETFGCONSOLE 12 /* get foreground vt */ +#define TIOCL_SCROLLCONSOLE 13 /* scroll console */ +#define TIOCL_BLANKSCREEN 14 /* keep screen blank even if a key is pressed */ +#define TIOCL_BLANKEDSCREEN 15 /* return which vt was blanked */ +#define TIOCL_GETKMSGREDIRECT 17 /* get the vt the kernel messages are restricted to */ + +#endif /* _LINUX_TIOCL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tipc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tipc.h new file mode 100644 index 0000000..3ef026d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tipc.h @@ -0,0 +1,213 @@ +/* + * include/linux/tipc.h: Include file for TIPC socket interface + * + * Copyright (c) 2003-2006, Ericsson AB + * Copyright (c) 2005, Wind River Systems + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_TIPC_H_ +#define _LINUX_TIPC_H_ + +#include + +/* + * TIPC addressing primitives + */ + +struct tipc_portid { + __u32 ref; + __u32 node; +}; + +struct tipc_name { + __u32 type; + __u32 instance; +}; + +struct tipc_name_seq { + __u32 type; + __u32 lower; + __u32 upper; +}; + +static __inline__ __u32 tipc_addr(unsigned int zone, + unsigned int cluster, + unsigned int node) +{ + return (zone << 24) | (cluster << 12) | node; +} + +static __inline__ unsigned int tipc_zone(__u32 addr) +{ + return addr >> 24; +} + +static __inline__ unsigned int tipc_cluster(__u32 addr) +{ + return (addr >> 12) & 0xfff; +} + +static __inline__ unsigned int tipc_node(__u32 addr) +{ + return addr & 0xfff; +} + +/* + * Application-accessible port name types + */ + +#define TIPC_CFG_SRV 0 /* configuration service name type */ +#define TIPC_TOP_SRV 1 /* topology service name type */ +#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */ + +/* + * Publication scopes when binding port names and port name sequences + */ + +#define TIPC_ZONE_SCOPE 1 +#define TIPC_CLUSTER_SCOPE 2 +#define TIPC_NODE_SCOPE 3 + +/* + * Limiting values for messages + */ + +#define TIPC_MAX_USER_MSG_SIZE 66000 + +/* + * Message importance levels + */ + +#define TIPC_LOW_IMPORTANCE 0 /* default */ +#define TIPC_MEDIUM_IMPORTANCE 1 +#define TIPC_HIGH_IMPORTANCE 2 +#define TIPC_CRITICAL_IMPORTANCE 3 + +/* + * Msg rejection/connection shutdown reasons + */ + +#define TIPC_OK 0 +#define TIPC_ERR_NO_NAME 1 +#define TIPC_ERR_NO_PORT 2 +#define TIPC_ERR_NO_NODE 3 +#define TIPC_ERR_OVERLOAD 4 +#define TIPC_CONN_SHUTDOWN 5 + +/* + * TIPC topology subscription service definitions + */ + +#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ +#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ +#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ +#if 0 +/* The following filter options are not currently implemented */ +#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */ +#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */ +#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */ +#endif + +#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */ + +struct tipc_subscr { + struct tipc_name_seq seq; /* name sequence of interest */ + __u32 timeout; /* subscription duration (in ms) */ + __u32 filter; /* bitmask of filter options */ + char usr_handle[8]; /* available for subscriber use */ +}; + +#define TIPC_PUBLISHED 1 /* publication event */ +#define TIPC_WITHDRAWN 2 /* withdraw event */ +#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ + +struct tipc_event { + __u32 event; /* event type */ + __u32 found_lower; /* matching name seq instances */ + __u32 found_upper; /* " " " " */ + struct tipc_portid port; /* associated port */ + struct tipc_subscr s; /* associated subscription */ +}; + +/* + * Socket API + */ + +#ifndef AF_TIPC +#define AF_TIPC 30 +#endif + +#ifndef PF_TIPC +#define PF_TIPC AF_TIPC +#endif + +#ifndef SOL_TIPC +#define SOL_TIPC 271 +#endif + +#define TIPC_ADDR_NAMESEQ 1 +#define TIPC_ADDR_MCAST 1 +#define TIPC_ADDR_NAME 2 +#define TIPC_ADDR_ID 3 + +struct sockaddr_tipc { + unsigned short family; + unsigned char addrtype; + signed char scope; + union { + struct tipc_portid id; + struct tipc_name_seq nameseq; + struct { + struct tipc_name name; + __u32 domain; /* 0: own zone */ + } name; + } addr; +}; + +/* + * Ancillary data objects supported by recvmsg() + */ + +#define TIPC_ERRINFO 1 /* error info */ +#define TIPC_RETDATA 2 /* returned data */ +#define TIPC_DESTNAME 3 /* destination name */ + +/* + * TIPC-specific socket option values + */ + +#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ +#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */ +#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ +#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tipc_config.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tipc_config.h new file mode 100644 index 0000000..a4b59c1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tipc_config.h @@ -0,0 +1,418 @@ +/* + * include/linux/tipc_config.h: Include file for TIPC configuration interface + * + * Copyright (c) 2003-2006, Ericsson AB + * Copyright (c) 2005-2007, Wind River Systems + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_TIPC_CONFIG_H_ +#define _LINUX_TIPC_CONFIG_H_ + +#include +#include +#include + +/* + * Configuration + * + * All configuration management messaging involves sending a request message + * to the TIPC configuration service on a node, which sends a reply message + * back. (In the future multi-message replies may be supported.) + * + * Both request and reply messages consist of a transport header and payload. + * The transport header contains info about the desired operation; + * the payload consists of zero or more type/length/value (TLV) items + * which specify parameters or results for the operation. + * + * For many operations, the request and reply messages have a fixed number + * of TLVs (usually zero or one); however, some reply messages may return + * a variable number of TLVs. A failed request is denoted by the presence + * of an "error string" TLV in the reply message instead of the TLV(s) the + * reply should contain if the request succeeds. + */ + +/* + * Public commands: + * May be issued by any process. + * Accepted by own node, or by remote node only if remote management enabled. + */ + +#define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */ +#define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */ +#define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */ +#define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */ +#define TIPC_CMD_GET_LINKS 0x0004 /* tx net_addr, rx link_info(s) */ +#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ +#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ +#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ + +#if 0 +#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ +#define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */ +#define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */ +#define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */ +#endif + +/* + * Protected commands: + * May only be issued by "network administration capable" process. + * Accepted by own node, or by remote node only if remote management enabled + * and this node is zone manager. + */ + +#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* tx none, rx unsigned */ +#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ + +#define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */ +#define TIPC_CMD_DISABLE_BEARER 0x4102 /* tx bearer_name, rx none */ +#define TIPC_CMD_SET_LINK_TOL 0x4107 /* tx link_config, rx none */ +#define TIPC_CMD_SET_LINK_PRI 0x4108 /* tx link_config, rx none */ +#define TIPC_CMD_SET_LINK_WINDOW 0x4109 /* tx link_config, rx none */ +#define TIPC_CMD_SET_LOG_SIZE 0x410A /* tx unsigned, rx none */ +#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ +#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ + +#if 0 +#define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */ +#define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */ +#define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */ +#define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */ +#endif + +/* + * Private commands: + * May only be issued by "network administration capable" process. + * Accepted by own node only; cannot be used on a remote node. + */ + +#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ +#if 0 +#define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */ +#endif +#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* tx unsigned, rx none */ +#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ + +/* + * Reserved commands: + * May not be issued by any process. + * Used internally by TIPC. + */ + +#define TIPC_CMD_NOT_NET_ADMIN 0xC001 /* tx none, rx none */ + +/* + * TLV types defined for TIPC + */ + +#define TIPC_TLV_NONE 0 /* no TLV present */ +#define TIPC_TLV_VOID 1 /* empty TLV (0 data bytes)*/ +#define TIPC_TLV_UNSIGNED 2 /* 32-bit integer */ +#define TIPC_TLV_STRING 3 /* char[128] (max) */ +#define TIPC_TLV_LARGE_STRING 4 /* char[2048] (max) */ +#define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */ + +#define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */ +#define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting */ +#define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */ +#define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */ +#define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */ +#define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */ +#define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */ +#define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */ +#define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */ +#define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */ +#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */ + +/* + * Maximum sizes of TIPC bearer-related names (including terminating NUL) + */ + +#define TIPC_MAX_MEDIA_NAME 16 /* format = media */ +#define TIPC_MAX_IF_NAME 16 /* format = interface */ +#define TIPC_MAX_BEARER_NAME 32 /* format = media:interface */ +#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */ + +/* + * Link priority limits (min, default, max, media default) + */ + +#define TIPC_MIN_LINK_PRI 0 +#define TIPC_DEF_LINK_PRI 10 +#define TIPC_MAX_LINK_PRI 31 +#define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1) + +/* + * Link tolerance limits (min, default, max), in ms + */ + +#define TIPC_MIN_LINK_TOL 50 +#define TIPC_DEF_LINK_TOL 1500 +#define TIPC_MAX_LINK_TOL 30000 + +/* + * Link window limits (min, default, max), in packets + */ + +#define TIPC_MIN_LINK_WIN 16 +#define TIPC_DEF_LINK_WIN 50 +#define TIPC_MAX_LINK_WIN 150 + + +struct tipc_node_info { + __be32 addr; /* network address of node */ + __be32 up; /* 0=down, 1= up */ +}; + +struct tipc_link_info { + __be32 dest; /* network address of peer node */ + __be32 up; /* 0=down, 1=up */ + char str[TIPC_MAX_LINK_NAME]; /* link name */ +}; + +struct tipc_bearer_config { + __be32 priority; /* Range [1,31]. Override per link */ + __be32 detect_scope; + char name[TIPC_MAX_BEARER_NAME]; +}; + +struct tipc_link_config { + __be32 value; + char name[TIPC_MAX_LINK_NAME]; +}; + +#define TIPC_NTQ_ALLTYPES 0x80000000 + +struct tipc_name_table_query { + __be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ + __be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ + __be32 lowbound; /* (i.e. displays all entries of name table) */ + __be32 upbound; +}; + +/* + * The error string TLV is a null-terminated string describing the cause + * of the request failure. To simplify error processing (and to save space) + * the first character of the string can be a special error code character + * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason. + */ + +#define TIPC_CFG_TLV_ERROR "\x80" /* request contains incorrect TLV(s) */ +#define TIPC_CFG_NOT_NET_ADMIN "\x81" /* must be network administrator */ +#define TIPC_CFG_NOT_ZONE_MSTR "\x82" /* must be zone master */ +#define TIPC_CFG_NO_REMOTE "\x83" /* remote management not enabled */ +#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ +#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ + +#if 0 +/* prototypes TLV structures for proposed commands */ +struct tipc_link_create { + __u32 domain; + struct tipc_media_addr peer_addr; + char bearer_name[TIPC_MAX_BEARER_NAME]; +}; + +struct tipc_route_info { + __u32 dest; + __u32 router; +}; +#endif + +/* + * A TLV consists of a descriptor, followed by the TLV value. + * TLV descriptor fields are stored in network byte order; + * TLV values must also be stored in network byte order (where applicable). + * TLV descriptors must be aligned to addresses which are multiple of 4, + * so up to 3 bytes of padding may exist at the end of the TLV value area. + * There must not be any padding between the TLV descriptor and its value. + */ + +struct tlv_desc { + __be16 tlv_len; /* TLV length (descriptor + value) */ + __be16 tlv_type; /* TLV identifier */ +}; + +#define TLV_ALIGNTO 4 + +#define TLV_ALIGN(datalen) (((datalen)+(TLV_ALIGNTO-1)) & ~(TLV_ALIGNTO-1)) +#define TLV_LENGTH(datalen) (sizeof(struct tlv_desc) + (datalen)) +#define TLV_SPACE(datalen) (TLV_ALIGN(TLV_LENGTH(datalen))) +#define TLV_DATA(tlv) ((void *)((char *)(tlv) + TLV_LENGTH(0))) + +static __inline__ int TLV_OK(const void *tlv, __u16 space) +{ + /* + * Would also like to check that "tlv" is a multiple of 4, + * but don't know how to do this in a portable way. + * - Tried doing (!(tlv & (TLV_ALIGNTO-1))), but GCC compiler + * won't allow binary "&" with a pointer. + * - Tried casting "tlv" to integer type, but causes warning about size + * mismatch when pointer is bigger than chosen type (int, long, ...). + */ + + return (space >= TLV_SPACE(0)) && + (ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space); +} + +static __inline__ int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type) +{ + return TLV_OK(tlv, space) && + (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type); +} + +static __inline__ int TLV_SET(void *tlv, __u16 type, void *data, __u16 len) +{ + struct tlv_desc *tlv_ptr; + int tlv_len; + + tlv_len = TLV_LENGTH(len); + tlv_ptr = (struct tlv_desc *)tlv; + tlv_ptr->tlv_type = htons(type); + tlv_ptr->tlv_len = htons(tlv_len); + if (len && data) + memcpy(TLV_DATA(tlv_ptr), data, tlv_len); + return TLV_SPACE(len); +} + +/* + * A TLV list descriptor simplifies processing of messages + * containing multiple TLVs. + */ + +struct tlv_list_desc { + struct tlv_desc *tlv_ptr; /* ptr to current TLV */ + __u32 tlv_space; /* # bytes from curr TLV to list end */ +}; + +static __inline__ void TLV_LIST_INIT(struct tlv_list_desc *list, + void *data, __u32 space) +{ + list->tlv_ptr = (struct tlv_desc *)data; + list->tlv_space = space; +} + +static __inline__ int TLV_LIST_EMPTY(struct tlv_list_desc *list) +{ + return (list->tlv_space == 0); +} + +static __inline__ int TLV_LIST_CHECK(struct tlv_list_desc *list, __u16 exp_type) +{ + return TLV_CHECK(list->tlv_ptr, list->tlv_space, exp_type); +} + +static __inline__ void *TLV_LIST_DATA(struct tlv_list_desc *list) +{ + return TLV_DATA(list->tlv_ptr); +} + +static __inline__ void TLV_LIST_STEP(struct tlv_list_desc *list) +{ + __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len)); + + list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space); + list->tlv_space -= tlv_space; +} + +/* + * Configuration messages exchanged via NETLINK_GENERIC use the following + * family id, name, version and command. + */ +#define TIPC_GENL_NAME "TIPC" +#define TIPC_GENL_VERSION 0x1 +#define TIPC_GENL_CMD 0x1 + +/* + * TIPC specific header used in NETLINK_GENERIC requests. + */ +struct tipc_genlmsghdr { + __u32 dest; /* Destination address */ + __u16 cmd; /* Command */ + __u16 reserved; /* Unused */ +}; + +#define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr)) + +/* + * Configuration messages exchanged via TIPC sockets use the TIPC configuration + * message header, which is defined below. This structure is analogous + * to the Netlink message header, but fields are stored in network byte order + * and no padding is permitted between the header and the message data + * that follows. + */ + +struct tipc_cfg_msg_hdr +{ + __be32 tcm_len; /* Message length (including header) */ + __be16 tcm_type; /* Command type */ + __be16 tcm_flags; /* Additional flags */ + char tcm_reserved[8]; /* Unused */ +}; + +#define TCM_F_REQUEST 0x1 /* Flag: Request message */ +#define TCM_F_MORE 0x2 /* Flag: Message to be continued */ + +#define TCM_ALIGN(datalen) (((datalen)+3) & ~3) +#define TCM_LENGTH(datalen) (sizeof(struct tipc_cfg_msg_hdr) + datalen) +#define TCM_SPACE(datalen) (TCM_ALIGN(TCM_LENGTH(datalen))) +#define TCM_DATA(tcm_hdr) ((void *)((char *)(tcm_hdr) + TCM_LENGTH(0))) + +static __inline__ int TCM_SET(void *msg, __u16 cmd, __u16 flags, + void *data, __u16 data_len) +{ + struct tipc_cfg_msg_hdr *tcm_hdr; + int msg_len; + + msg_len = TCM_LENGTH(data_len); + tcm_hdr = (struct tipc_cfg_msg_hdr *)msg; + tcm_hdr->tcm_len = htonl(msg_len); + tcm_hdr->tcm_type = htons(cmd); + tcm_hdr->tcm_flags = htons(flags); + if (data_len && data) + memcpy(TCM_DATA(msg), data, data_len); + return TCM_SPACE(data_len); +} + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/toshiba.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/toshiba.h new file mode 100644 index 0000000..6a7c4ed --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/toshiba.h @@ -0,0 +1,38 @@ +/* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops + * + * Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk) + * + * Thanks to Juergen Heinzl for the pointers + * on making sure the structure is aligned and packed. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef _LINUX_TOSHIBA_H +#define _LINUX_TOSHIBA_H + +#define TOSH_PROC "/proc/toshiba" +#define TOSH_DEVICE "/dev/toshiba" +#define TOSH_SMM _IOWR('t', 0x90, int) /* broken: meant 24 bytes */ + +typedef struct { + unsigned int eax; + unsigned int ebx __attribute__ ((packed)); + unsigned int ecx __attribute__ ((packed)); + unsigned int edx __attribute__ ((packed)); + unsigned int esi __attribute__ ((packed)); + unsigned int edi __attribute__ ((packed)); +} SMMRegisters; + +int tosh_smm(SMMRegisters *regs); + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tty.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tty.h new file mode 100644 index 0000000..98996ba --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/tty.h @@ -0,0 +1,8 @@ +#ifndef _LINUX_TTY_H +#define _LINUX_TTY_H + +/* + * 'tty.h' defines some structures used by tty_io.c and some defines. + */ + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/types.h new file mode 100644 index 0000000..8b483c8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/types.h @@ -0,0 +1,38 @@ +#ifndef _LINUX_TYPES_H +#define _LINUX_TYPES_H + +#include + +#ifndef __ASSEMBLY__ + +#include + + +/* + * Below are truly Linux-specific types that should never collide with + * any application/library that wants linux/types.h. + */ + +#ifdef __CHECKER__ +#define __bitwise__ __attribute__((bitwise)) +#else +#define __bitwise__ +#endif +#ifdef __CHECK_ENDIAN__ +#define __bitwise __bitwise__ +#else +#define __bitwise +#endif + +typedef __u16 __bitwise __le16; +typedef __u16 __bitwise __be16; +typedef __u32 __bitwise __le32; +typedef __u32 __bitwise __be32; +typedef __u64 __bitwise __le64; +typedef __u64 __bitwise __be64; + +typedef __u16 __bitwise __sum16; +typedef __u32 __bitwise __wsum; + +#endif /* __ASSEMBLY__ */ +#endif /* _LINUX_TYPES_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/udf_fs_i.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/udf_fs_i.h new file mode 100644 index 0000000..3536965 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/udf_fs_i.h @@ -0,0 +1,21 @@ +/* + * udf_fs_i.h + * + * This file is intended for the Linux kernel/module. + * + * COPYRIGHT + * This file is distributed under the terms of the GNU General Public + * License (GPL). Copies of the GPL can be obtained from: + * ftp://prep.ai.mit.edu/pub/gnu/GPL + * Each contributing author retains all rights to their own work. + */ +#ifndef _UDF_FS_I_H +#define _UDF_FS_I_H 1 + +/* exported IOCTLs, we have 'l', 0x40-0x7f */ +#define UDF_GETEASIZE _IOR('l', 0x40, int) +#define UDF_GETEABLOCK _IOR('l', 0x41, void *) +#define UDF_GETVOLIDENT _IOR('l', 0x42, void *) +#define UDF_RELOCATE_BLOCKS _IOWR('l', 0x43, long) + +#endif /* _UDF_FS_I_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/udp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/udp.h new file mode 100644 index 0000000..13cf21a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/udp.h @@ -0,0 +1,39 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the UDP protocol. + * + * Version: @(#)udp.h 1.0.2 04/28/93 + * + * Author: Fred N. van Kempen, + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_UDP_H +#define _LINUX_UDP_H + +#include + +struct udphdr { + __be16 source; + __be16 dest; + __be16 len; + __sum16 check; +}; + +/* UDP socket options */ +#define UDP_CORK 1 /* Never send partially complete segments */ +#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ + +/* UDP encapsulation types */ +#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ +#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ +#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ + + +#endif /* _LINUX_UDP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/uinput.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/uinput.h new file mode 100644 index 0000000..8ffd7da --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/uinput.h @@ -0,0 +1,136 @@ +#ifndef __UINPUT_H_ +#define __UINPUT_H_ +/* + * User level driver support for input subsystem + * + * Heavily based on evdev.c by Vojtech Pavlik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Aristeu Sergio Rozanski Filho + * + * Changes/Revisions: + * 0.3 24/05/2006 (Anssi Hannula ) + * - update ff support for the changes in kernel interface + * - add UINPUT_VERSION + * 0.2 16/10/2004 (Micah Dowty ) + * - added force feedback support + * - added UI_SET_PHYS + * 0.1 20/06/2002 + * - first public version + */ + +#include + +#define UINPUT_VERSION 3 + + +struct uinput_ff_upload { + int request_id; + int retval; + struct ff_effect effect; + struct ff_effect old; +}; + +struct uinput_ff_erase { + int request_id; + int retval; + int effect_id; +}; + +/* ioctl */ +#define UINPUT_IOCTL_BASE 'U' +#define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1) +#define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2) + +#define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int) +#define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int) +#define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int) +#define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int) +#define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int) +#define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int) +#define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int) +#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int) +#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*) +#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int) + +#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload) +#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload) +#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase) +#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase) + +/* + * To write a force-feedback-capable driver, the upload_effect + * and erase_effect callbacks in input_dev must be implemented. + * The uinput driver will generate a fake input event when one of + * these callbacks are invoked. The userspace code then uses + * ioctls to retrieve additional parameters and send the return code. + * The callback blocks until this return code is sent. + * + * The described callback mechanism is only used if ff_effects_max + * is set. + * + * To implement upload_effect(): + * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD. + * A request ID will be given in 'value'. + * 2. Allocate a uinput_ff_upload struct, fill in request_id with + * the 'value' from the EV_UINPUT event. + * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the + * uinput_ff_upload struct. It will be filled in with the + * ff_effects passed to upload_effect(). + * 4. Perform the effect upload, and place a return code back into + the uinput_ff_upload struct. + * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the + * uinput_ff_upload_effect struct. This will complete execution + * of our upload_effect() handler. + * + * To implement erase_effect(): + * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE. + * A request ID will be given in 'value'. + * 2. Allocate a uinput_ff_erase struct, fill in request_id with + * the 'value' from the EV_UINPUT event. + * 3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the + * uinput_ff_erase struct. It will be filled in with the + * effect ID passed to erase_effect(). + * 4. Perform the effect erasure, and place a return code back + * into the uinput_ff_erase struct. + * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the + * uinput_ff_erase_effect struct. This will complete execution + * of our erase_effect() handler. + */ + +/* + * This is the new event type, used only by uinput. + * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value' + * is the unique request ID. This number was picked + * arbitrarily, above EV_MAX (since the input system + * never sees it) but in the range of a 16-bit int. + */ +#define EV_UINPUT 0x0101 +#define UI_FF_UPLOAD 1 +#define UI_FF_ERASE 2 + +#define UINPUT_MAX_NAME_SIZE 80 +struct uinput_user_dev { + char name[UINPUT_MAX_NAME_SIZE]; + struct input_id id; + int ff_effects_max; + int absmax[ABS_MAX + 1]; + int absmin[ABS_MAX + 1]; + int absfuzz[ABS_MAX + 1]; + int absflat[ABS_MAX + 1]; +}; +#endif /* __UINPUT_H_ */ + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/uio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/uio.h new file mode 100644 index 0000000..f1cf625 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/uio.h @@ -0,0 +1,49 @@ +#ifndef __LINUX_UIO_H +#define __LINUX_UIO_H + + +#include + +/* + * Berkeley style UIO structures - Alan Cox 1994. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +struct iovec +{ + void *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ + __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ +}; + + +/* + * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1) + */ + +#define UIO_FASTIOV 8 +#define UIO_MAXIOV 1024 + +/* + * Total number of bytes covered by an iovec. + * + * NOTE that it is not safe to use this function until all the iovec's + * segment lengths have been validated. Because the individual lengths can + * overflow a size_t when added together. + */ +static __inline__ size_t iov_length(const struct iovec *iov, unsigned long nr_segs) +{ + unsigned long seg; + size_t ret = 0; + + for (seg = 0; seg < nr_segs; seg++) + ret += iov[seg].iov_len; + return ret; +} + +unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ultrasound.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ultrasound.h new file mode 100644 index 0000000..6b7703e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/ultrasound.h @@ -0,0 +1,103 @@ +#ifndef _ULTRASOUND_H_ +#define _ULTRASOUND_H_ +/* + * ultrasound.h - Macros for programming the Gravis Ultrasound + * These macros are extremely device dependent + * and not portable. + */ +/* + * Copyright (C) by Hannu Savolainen 1993-1997 + * + * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) + * Version 2 (June 1991). See the "COPYING" file distributed with this software + * for more info. + */ + + +/* + * Private events for Gravis Ultrasound (GUS) + * + * Format: + * byte 0 - SEQ_PRIVATE (0xfe) + * byte 1 - Synthesizer device number (0-N) + * byte 2 - Command (see below) + * byte 3 - Voice number (0-31) + * bytes 4 and 5 - parameter P1 (unsigned short) + * bytes 6 and 7 - parameter P2 (unsigned short) + * + * Commands: + * Each command affects one voice defined in byte 3. + * Unused parameters (P1 and/or P2 *MUST* be initialized to zero). + * _GUS_NUMVOICES - Sets max. number of concurrent voices (P1=14-31, default 16) + * _GUS_VOICESAMPLE- ************ OBSOLETE ************* + * _GUS_VOICEON - Starts voice (P1=voice mode) + * _GUS_VOICEOFF - Stops voice (no parameters) + * _GUS_VOICEFADE - Stops the voice smoothly. + * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) + * _GUS_VOICEBALA - Sets voice balence (P1, 0=left, 7=middle and 15=right, default 7) + * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) + * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) + * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) + * (Like GUS_VOICEVOL but doesn't change the hw + * volume. It just updates volume in the voice table). + * + * _GUS_RAMPRANGE - Sets limits for volume ramping (P1=low volume, P2=high volume) + * _GUS_RAMPRATE - Sets the speed for volume ramping (P1=scale, P2=rate) + * _GUS_RAMPMODE - Sets the volume ramping mode (P1=ramping mode) + * _GUS_RAMPON - Starts volume ramping (no parameters) + * _GUS_RAMPOFF - Stops volume ramping (no parameters) + * _GUS_VOLUME_SCALE - Changes the volume calculation constants + * for all voices. + */ + +#define _GUS_NUMVOICES 0x00 +#define _GUS_VOICESAMPLE 0x01 /* OBSOLETE */ +#define _GUS_VOICEON 0x02 +#define _GUS_VOICEOFF 0x03 +#define _GUS_VOICEMODE 0x04 +#define _GUS_VOICEBALA 0x05 +#define _GUS_VOICEFREQ 0x06 +#define _GUS_VOICEVOL 0x07 +#define _GUS_RAMPRANGE 0x08 +#define _GUS_RAMPRATE 0x09 +#define _GUS_RAMPMODE 0x0a +#define _GUS_RAMPON 0x0b +#define _GUS_RAMPOFF 0x0c +#define _GUS_VOICEFADE 0x0d +#define _GUS_VOLUME_SCALE 0x0e +#define _GUS_VOICEVOL2 0x0f +#define _GUS_VOICE_POS 0x10 + +/* + * GUS API macros + */ + +#define _GUS_CMD(chn, voice, cmd, p1, p2) \ + {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\ + _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\ + _seqbuf[_seqbufptr+3] = voice;\ + *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\ + *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\ + _SEQ_ADVBUF(8);} + +#define GUS_NUMVOICES(chn, p1) _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0) +#define GUS_VOICESAMPLE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */ +#define GUS_VOICEON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0) +#define GUS_VOICEOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0) +#define GUS_VOICEFADE(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0) +#define GUS_VOICEMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0) +#define GUS_VOICEBALA(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0) +#define GUS_VOICEFREQ(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \ + (p) & 0xffff, ((p) >> 16) & 0xffff) +#define GUS_VOICEVOL(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0) +#define GUS_VOICEVOL2(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0) +#define GUS_RAMPRANGE(chn, voice, low, high) _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high)) +#define GUS_RAMPRATE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2)) +#define GUS_RAMPMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0) +#define GUS_RAMPON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0) +#define GUS_RAMPOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0) +#define GUS_VOLUME_SCALE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2)) +#define GUS_VOICE_POS(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICE_POS, \ + (p) & 0xffff, ((p) >> 16) & 0xffff) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/un.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/un.h new file mode 100644 index 0000000..45561c5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/un.h @@ -0,0 +1,11 @@ +#ifndef _LINUX_UN_H +#define _LINUX_UN_H + +#define UNIX_PATH_MAX 108 + +struct sockaddr_un { + sa_family_t sun_family; /* AF_UNIX */ + char sun_path[UNIX_PATH_MAX]; /* pathname */ +}; + +#endif /* _LINUX_UN_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/unistd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/unistd.h new file mode 100644 index 0000000..aa8d5b5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/unistd.h @@ -0,0 +1,9 @@ +#ifndef _LINUX_UNISTD_H_ +#define _LINUX_UNISTD_H_ + +/* + * Include machine specific syscall numbers + */ +#include + +#endif /* _LINUX_UNISTD_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/..install.cmd new file mode 100644 index 0000000..66d4ead --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/usb/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/usb /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/usb mips audio.h cdc.h ch9.h g_printer.h gadgetfs.h midi.h tmc.h vstusb.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/usb /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/usb mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/usb/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/audio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/audio.h new file mode 100644 index 0000000..8cb025f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/audio.h @@ -0,0 +1,53 @@ +/* + * -- USB Audio definitions. + * + * Copyright (C) 2006 Thumtronics Pty Ltd. + * Developed for Thumtronics by Grey Innovation + * Ben Williamson + * + * This software is distributed under the terms of the GNU General Public + * License ("GPL") version 2, as published by the Free Software Foundation. + * + * This file holds USB constants and structures defined + * by the USB Device Class Definition for Audio Devices. + * Comments below reference relevant sections of that document: + * + * http://www.usb.org/developers/devclass_docs/audio10.pdf + */ + +#ifndef __LINUX_USB_AUDIO_H +#define __LINUX_USB_AUDIO_H + +#include + +/* A.2 Audio Interface Subclass Codes */ +#define USB_SUBCLASS_AUDIOCONTROL 0x01 +#define USB_SUBCLASS_AUDIOSTREAMING 0x02 +#define USB_SUBCLASS_MIDISTREAMING 0x03 + +/* 4.3.2 Class-Specific AC Interface Descriptor */ +struct usb_ac_header_descriptor { + __u8 bLength; /* 8+n */ + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ + __u8 bDescriptorSubtype; /* USB_MS_HEADER */ + __le16 bcdADC; /* 0x0100 */ + __le16 wTotalLength; /* includes Unit and Terminal desc. */ + __u8 bInCollection; /* n */ + __u8 baInterfaceNr[]; /* [n] */ +} __attribute__ ((packed)); + +#define USB_DT_AC_HEADER_SIZE(n) (8+(n)) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ +struct usb_ac_header_descriptor_##n { \ + __u8 bLength; \ + __u8 bDescriptorType; \ + __u8 bDescriptorSubtype; \ + __le16 bcdADC; \ + __le16 wTotalLength; \ + __u8 bInCollection; \ + __u8 baInterfaceNr[n]; \ +} __attribute__ ((packed)) + +#endif /* __LINUX_USB_AUDIO_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/cdc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/cdc.h new file mode 100644 index 0000000..c24124a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/cdc.h @@ -0,0 +1,250 @@ +/* + * USB Communications Device Class (CDC) definitions + * + * CDC says how to talk to lots of different types of network adapters, + * notably ethernet adapters and various modems. It's used mostly with + * firmware based USB peripherals. + */ + +#ifndef __LINUX_USB_CDC_H +#define __LINUX_USB_CDC_H + +#include + +#define USB_CDC_SUBCLASS_ACM 0x02 +#define USB_CDC_SUBCLASS_ETHERNET 0x06 +#define USB_CDC_SUBCLASS_WHCM 0x08 +#define USB_CDC_SUBCLASS_DMM 0x09 +#define USB_CDC_SUBCLASS_MDLM 0x0a +#define USB_CDC_SUBCLASS_OBEX 0x0b +#define USB_CDC_SUBCLASS_EEM 0x0c + +#define USB_CDC_PROTO_NONE 0 + +#define USB_CDC_ACM_PROTO_AT_V25TER 1 +#define USB_CDC_ACM_PROTO_AT_PCCA101 2 +#define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE 3 +#define USB_CDC_ACM_PROTO_AT_GSM 4 +#define USB_CDC_ACM_PROTO_AT_3G 5 +#define USB_CDC_ACM_PROTO_AT_CDMA 6 +#define USB_CDC_ACM_PROTO_VENDOR 0xff + +#define USB_CDC_PROTO_EEM 7 + +/*-------------------------------------------------------------------------*/ + +/* + * Class-Specific descriptors ... there are a couple dozen of them + */ + +#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ +#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ +#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ +#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ +#define USB_CDC_COUNTRY_TYPE 0x07 +#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ +#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ +#define USB_CDC_WHCM_TYPE 0x11 +#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ +#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ +#define USB_CDC_DMM_TYPE 0x14 +#define USB_CDC_OBEX_TYPE 0x15 + +/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ +struct usb_cdc_header_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __le16 bcdCDC; +} __attribute__ ((packed)); + +/* "Call Management Descriptor" from CDC spec 5.2.3.2 */ +struct usb_cdc_call_mgmt_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __u8 bmCapabilities; +#define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01 +#define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02 + + __u8 bDataInterface; +} __attribute__ ((packed)); + +/* "Abstract Control Management Descriptor" from CDC spec 5.2.3.3 */ +struct usb_cdc_acm_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __u8 bmCapabilities; +} __attribute__ ((packed)); + +/* capabilities from 5.2.3.3 */ + +#define USB_CDC_COMM_FEATURE 0x01 +#define USB_CDC_CAP_LINE 0x02 +#define USB_CDC_CAP_BRK 0x04 +#define USB_CDC_CAP_NOTIFY 0x08 + +/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ +struct usb_cdc_union_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __u8 bMasterInterface0; + __u8 bSlaveInterface0; + /* ... and there could be other slave interfaces */ +} __attribute__ ((packed)); + +/* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */ +struct usb_cdc_country_functional_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __u8 iCountryCodeRelDate; + __le16 wCountyCode0; + /* ... and there can be a lot of country codes */ +} __attribute__ ((packed)); + +/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ +struct usb_cdc_network_terminal_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __u8 bEntityId; + __u8 iName; + __u8 bChannelIndex; + __u8 bPhysicalInterface; +} __attribute__ ((packed)); + +/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ +struct usb_cdc_ether_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __u8 iMACAddress; + __le32 bmEthernetStatistics; + __le16 wMaxSegmentSize; + __le16 wNumberMCFilters; + __u8 bNumberPowerFilters; +} __attribute__ ((packed)); + +/* "Telephone Control Model Functional Descriptor" from CDC WMC spec 6.3..3 */ +struct usb_cdc_dmm_desc { + __u8 bFunctionLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u16 bcdVersion; + __le16 wMaxCommand; +} __attribute__ ((packed)); + +/* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */ +struct usb_cdc_mdlm_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __le16 bcdVersion; + __u8 bGUID[16]; +} __attribute__ ((packed)); + +/* "MDLM Detail Functional Descriptor" from CDC WMC spec 6.7.2.4 */ +struct usb_cdc_mdlm_detail_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + /* type is associated with mdlm_desc.bGUID */ + __u8 bGuidDescriptorType; + __u8 bDetailData[0]; +} __attribute__ ((packed)); + +/* "OBEX Control Model Functional Descriptor" */ +struct usb_cdc_obex_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __le16 bcdVersion; +} __attribute__ ((packed)); + +/*-------------------------------------------------------------------------*/ + +/* + * Class-Specific Control Requests (6.2) + * + * section 3.6.2.1 table 4 has the ACM profile, for modems. + * section 3.8.2 table 10 has the ethernet profile. + * + * Microsoft's RNDIS stack for Ethernet is a vendor-specific CDC ACM variant, + * heavily dependent on the encapsulated (proprietary) command mechanism. + */ + +#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 +#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 +#define USB_CDC_REQ_SET_LINE_CODING 0x20 +#define USB_CDC_REQ_GET_LINE_CODING 0x21 +#define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22 +#define USB_CDC_REQ_SEND_BREAK 0x23 +#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 +#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41 +#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 +#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 +#define USB_CDC_GET_ETHERNET_STATISTIC 0x44 + +/* Line Coding Structure from CDC spec 6.2.13 */ +struct usb_cdc_line_coding { + __le32 dwDTERate; + __u8 bCharFormat; +#define USB_CDC_1_STOP_BITS 0 +#define USB_CDC_1_5_STOP_BITS 1 +#define USB_CDC_2_STOP_BITS 2 + + __u8 bParityType; +#define USB_CDC_NO_PARITY 0 +#define USB_CDC_ODD_PARITY 1 +#define USB_CDC_EVEN_PARITY 2 +#define USB_CDC_MARK_PARITY 3 +#define USB_CDC_SPACE_PARITY 4 + + __u8 bDataBits; +} __attribute__ ((packed)); + +/* table 62; bits in multicast filter */ +#define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0) +#define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */ +#define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2) +#define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3) +#define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) /* filtered */ + + +/*-------------------------------------------------------------------------*/ + +/* + * Class-Specific Notifications (6.3) sent by interrupt transfers + * + * section 3.8.2 table 11 of the CDC spec lists Ethernet notifications + * section 3.6.2.1 table 5 specifies ACM notifications, accepted by RNDIS + * RNDIS also defines its own bit-incompatible notifications + */ + +#define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00 +#define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01 +#define USB_CDC_NOTIFY_SERIAL_STATE 0x20 +#define USB_CDC_NOTIFY_SPEED_CHANGE 0x2a + +struct usb_cdc_notification { + __u8 bmRequestType; + __u8 bNotificationType; + __le16 wValue; + __le16 wIndex; + __le16 wLength; +} __attribute__ ((packed)); + +#endif /* __LINUX_USB_CDC_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/ch9.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/ch9.h new file mode 100644 index 0000000..59718b5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/ch9.h @@ -0,0 +1,782 @@ +/* + * This file holds USB constants and structures that are needed for + * USB device APIs. These are used by the USB device model, which is + * defined in chapter 9 of the USB 2.0 specification and in the + * Wireless USB 1.0 (spread around). Linux has several APIs in C that + * need these: + * + * - the master/host side Linux-USB kernel driver API; + * - the "usbfs" user space API; and + * - the Linux "gadget" slave/device/peripheral side driver API. + * + * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems + * act either as a USB master/host or as a USB slave/device. That means + * the master and slave side APIs benefit from working well together. + * + * There's also "Wireless USB", using low power short range radios for + * peripheral interconnection but otherwise building on the USB framework. + * + * Note all descriptors are declared '__attribute__((packed))' so that: + * + * [a] they never get padded, either internally (USB spec writers + * probably handled that) or externally; + * + * [b] so that accessing bigger-than-a-bytes fields will never + * generate bus errors on any platform, even when the location of + * its descriptor inside a bundle isn't "naturally aligned", and + * + * [c] for consistency, removing all doubt even when it appears to + * someone that the two other points are non-issues for that + * particular descriptor type. + */ + +#ifndef __LINUX_USB_CH9_H +#define __LINUX_USB_CH9_H + +#include /* __u8 etc */ + +/*-------------------------------------------------------------------------*/ + +/* CONTROL REQUEST SUPPORT */ + +/* + * USB directions + * + * This bit flag is used in endpoint descriptors' bEndpointAddress field. + * It's also one of three fields in control requests bRequestType. + */ +#define USB_DIR_OUT 0 /* to device */ +#define USB_DIR_IN 0x80 /* to host */ + +/* + * USB types, the second of three bRequestType fields + */ +#define USB_TYPE_MASK (0x03 << 5) +#define USB_TYPE_STANDARD (0x00 << 5) +#define USB_TYPE_CLASS (0x01 << 5) +#define USB_TYPE_VENDOR (0x02 << 5) +#define USB_TYPE_RESERVED (0x03 << 5) + +/* + * USB recipients, the third of three bRequestType fields + */ +#define USB_RECIP_MASK 0x1f +#define USB_RECIP_DEVICE 0x00 +#define USB_RECIP_INTERFACE 0x01 +#define USB_RECIP_ENDPOINT 0x02 +#define USB_RECIP_OTHER 0x03 +/* From Wireless USB 1.0 */ +#define USB_RECIP_PORT 0x04 +#define USB_RECIP_RPIPE 0x05 + +/* + * Standard requests, for the bRequest field of a SETUP packet. + * + * These are qualified by the bRequestType field, so that for example + * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved + * by a GET_STATUS request. + */ +#define USB_REQ_GET_STATUS 0x00 +#define USB_REQ_CLEAR_FEATURE 0x01 +#define USB_REQ_SET_FEATURE 0x03 +#define USB_REQ_SET_ADDRESS 0x05 +#define USB_REQ_GET_DESCRIPTOR 0x06 +#define USB_REQ_SET_DESCRIPTOR 0x07 +#define USB_REQ_GET_CONFIGURATION 0x08 +#define USB_REQ_SET_CONFIGURATION 0x09 +#define USB_REQ_GET_INTERFACE 0x0A +#define USB_REQ_SET_INTERFACE 0x0B +#define USB_REQ_SYNCH_FRAME 0x0C + +#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ +#define USB_REQ_GET_ENCRYPTION 0x0E +#define USB_REQ_RPIPE_ABORT 0x0E +#define USB_REQ_SET_HANDSHAKE 0x0F +#define USB_REQ_RPIPE_RESET 0x0F +#define USB_REQ_GET_HANDSHAKE 0x10 +#define USB_REQ_SET_CONNECTION 0x11 +#define USB_REQ_SET_SECURITY_DATA 0x12 +#define USB_REQ_GET_SECURITY_DATA 0x13 +#define USB_REQ_SET_WUSB_DATA 0x14 +#define USB_REQ_LOOPBACK_DATA_WRITE 0x15 +#define USB_REQ_LOOPBACK_DATA_READ 0x16 +#define USB_REQ_SET_INTERFACE_DS 0x17 + +/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command, + * used by hubs to put ports into a new L1 suspend state, except that it + * forgot to define its number ... + */ + +/* + * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and + * are read as a bit array returned by USB_REQ_GET_STATUS. (So there + * are at most sixteen features of each type.) Hubs may also support a + * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend. + */ +#define USB_DEVICE_SELF_POWERED 0 /* (read only) */ +#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ +#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */ +#define USB_DEVICE_BATTERY 2 /* (wireless) */ +#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */ +#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/ +#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */ +#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */ +#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ + +#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ + + +/** + * struct usb_ctrlrequest - SETUP data for a USB device control request + * @bRequestType: matches the USB bmRequestType field + * @bRequest: matches the USB bRequest field + * @wValue: matches the USB wValue field (le16 byte order) + * @wIndex: matches the USB wIndex field (le16 byte order) + * @wLength: matches the USB wLength field (le16 byte order) + * + * This structure is used to send control requests to a USB device. It matches + * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the + * USB spec for a fuller description of the different fields, and what they are + * used for. + * + * Note that the driver for any interface can issue control requests. + * For most devices, interfaces don't coordinate with each other, so + * such requests may be made at any time. + */ +struct usb_ctrlrequest { + __u8 bRequestType; + __u8 bRequest; + __le16 wValue; + __le16 wIndex; + __le16 wLength; +} __attribute__ ((packed)); + +/*-------------------------------------------------------------------------*/ + +/* + * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or + * (rarely) accepted by SET_DESCRIPTOR. + * + * Note that all multi-byte values here are encoded in little endian + * byte order "on the wire". Within the kernel and when exposed + * through the Linux-USB APIs, they are not converted to cpu byte + * order; it is the responsibility of the client code to do this. + * The single exception is when device and configuration descriptors (but + * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD); + * in this case the fields are converted to host endianness by the kernel. + */ + +/* + * Descriptor types ... USB 2.0 spec table 9.5 + */ +#define USB_DT_DEVICE 0x01 +#define USB_DT_CONFIG 0x02 +#define USB_DT_STRING 0x03 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 +#define USB_DT_DEVICE_QUALIFIER 0x06 +#define USB_DT_OTHER_SPEED_CONFIG 0x07 +#define USB_DT_INTERFACE_POWER 0x08 +/* these are from a minor usb 2.0 revision (ECN) */ +#define USB_DT_OTG 0x09 +#define USB_DT_DEBUG 0x0a +#define USB_DT_INTERFACE_ASSOCIATION 0x0b +/* these are from the Wireless USB spec */ +#define USB_DT_SECURITY 0x0c +#define USB_DT_KEY 0x0d +#define USB_DT_ENCRYPTION_TYPE 0x0e +#define USB_DT_BOS 0x0f +#define USB_DT_DEVICE_CAPABILITY 0x10 +#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 +#define USB_DT_WIRE_ADAPTER 0x21 +#define USB_DT_RPIPE 0x22 +#define USB_DT_CS_RADIO_CONTROL 0x23 + +/* Conventional codes for class-specific descriptors. The convention is + * defined in the USB "Common Class" Spec (3.11). Individual class specs + * are authoritative for their usage, not the "common class" writeup. + */ +#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE) +#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG) +#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING) +#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE) +#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT) + +/* All standard descriptors have these 2 fields at the beginning */ +struct usb_descriptor_header { + __u8 bLength; + __u8 bDescriptorType; +} __attribute__ ((packed)); + + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_DEVICE: Device descriptor */ +struct usb_device_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __le16 bcdUSB; + __u8 bDeviceClass; + __u8 bDeviceSubClass; + __u8 bDeviceProtocol; + __u8 bMaxPacketSize0; + __le16 idVendor; + __le16 idProduct; + __le16 bcdDevice; + __u8 iManufacturer; + __u8 iProduct; + __u8 iSerialNumber; + __u8 bNumConfigurations; +} __attribute__ ((packed)); + +#define USB_DT_DEVICE_SIZE 18 + + +/* + * Device and/or Interface Class codes + * as found in bDeviceClass or bInterfaceClass + * and defined by www.usb.org documents + */ +#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ +#define USB_CLASS_AUDIO 1 +#define USB_CLASS_COMM 2 +#define USB_CLASS_HID 3 +#define USB_CLASS_PHYSICAL 5 +#define USB_CLASS_STILL_IMAGE 6 +#define USB_CLASS_PRINTER 7 +#define USB_CLASS_MASS_STORAGE 8 +#define USB_CLASS_HUB 9 +#define USB_CLASS_CDC_DATA 0x0a +#define USB_CLASS_CSCID 0x0b /* chip+ smart card */ +#define USB_CLASS_CONTENT_SEC 0x0d /* content security */ +#define USB_CLASS_VIDEO 0x0e +#define USB_CLASS_WIRELESS_CONTROLLER 0xe0 +#define USB_CLASS_MISC 0xef +#define USB_CLASS_APP_SPEC 0xfe +#define USB_CLASS_VENDOR_SPEC 0xff + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_CONFIG: Configuration descriptor information. + * + * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the + * descriptor type is different. Highspeed-capable devices can look + * different depending on what speed they're currently running. Only + * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG + * descriptors. + */ +struct usb_config_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __le16 wTotalLength; + __u8 bNumInterfaces; + __u8 bConfigurationValue; + __u8 iConfiguration; + __u8 bmAttributes; + __u8 bMaxPower; +} __attribute__ ((packed)); + +#define USB_DT_CONFIG_SIZE 9 + +/* from config descriptor bmAttributes */ +#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */ +#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */ +#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */ +#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */ + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_STRING: String descriptor */ +struct usb_string_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __le16 wData[1]; /* UTF-16LE encoded */ +} __attribute__ ((packed)); + +/* note that "string" zero is special, it holds language codes that + * the device supports, not Unicode characters. + */ + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_INTERFACE: Interface descriptor */ +struct usb_interface_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __u8 bInterfaceNumber; + __u8 bAlternateSetting; + __u8 bNumEndpoints; + __u8 bInterfaceClass; + __u8 bInterfaceSubClass; + __u8 bInterfaceProtocol; + __u8 iInterface; +} __attribute__ ((packed)); + +#define USB_DT_INTERFACE_SIZE 9 + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_ENDPOINT: Endpoint descriptor */ +struct usb_endpoint_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __u8 bEndpointAddress; + __u8 bmAttributes; + __le16 wMaxPacketSize; + __u8 bInterval; + + /* NOTE: these two are _only_ in audio endpoints. */ + /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */ + __u8 bRefresh; + __u8 bSynchAddress; +} __attribute__ ((packed)); + +#define USB_DT_ENDPOINT_SIZE 7 +#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ + + +/* + * Endpoints + */ +#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */ +#define USB_ENDPOINT_DIR_MASK 0x80 + +#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ +#define USB_ENDPOINT_XFER_CONTROL 0 +#define USB_ENDPOINT_XFER_ISOC 1 +#define USB_ENDPOINT_XFER_BULK 2 +#define USB_ENDPOINT_XFER_INT 3 +#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 + +/*-------------------------------------------------------------------------*/ + +/** + * usb_endpoint_num - get the endpoint's number + * @epd: endpoint to be checked + * + * Returns @epd's number: 0 to 15. + */ +static __inline__ int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) +{ + return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; +} + +/** + * usb_endpoint_type - get the endpoint's transfer type + * @epd: endpoint to be checked + * + * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according + * to @epd's transfer type. + */ +static __inline__ int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) +{ + return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; +} + +/** + * usb_endpoint_dir_in - check if the endpoint has IN direction + * @epd: endpoint to be checked + * + * Returns true if the endpoint is of type IN, otherwise it returns false. + */ +static __inline__ int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) +{ + return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN); +} + +/** + * usb_endpoint_dir_out - check if the endpoint has OUT direction + * @epd: endpoint to be checked + * + * Returns true if the endpoint is of type OUT, otherwise it returns false. + */ +static __inline__ int usb_endpoint_dir_out( + const struct usb_endpoint_descriptor *epd) +{ + return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); +} + +/** + * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type + * @epd: endpoint to be checked + * + * Returns true if the endpoint is of type bulk, otherwise it returns false. + */ +static __inline__ int usb_endpoint_xfer_bulk( + const struct usb_endpoint_descriptor *epd) +{ + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_BULK); +} + +/** + * usb_endpoint_xfer_control - check if the endpoint has control transfer type + * @epd: endpoint to be checked + * + * Returns true if the endpoint is of type control, otherwise it returns false. + */ +static __inline__ int usb_endpoint_xfer_control( + const struct usb_endpoint_descriptor *epd) +{ + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_CONTROL); +} + +/** + * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type + * @epd: endpoint to be checked + * + * Returns true if the endpoint is of type interrupt, otherwise it returns + * false. + */ +static __inline__ int usb_endpoint_xfer_int( + const struct usb_endpoint_descriptor *epd) +{ + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_INT); +} + +/** + * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type + * @epd: endpoint to be checked + * + * Returns true if the endpoint is of type isochronous, otherwise it returns + * false. + */ +static __inline__ int usb_endpoint_xfer_isoc( + const struct usb_endpoint_descriptor *epd) +{ + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_ISOC); +} + +/** + * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN + * @epd: endpoint to be checked + * + * Returns true if the endpoint has bulk transfer type and IN direction, + * otherwise it returns false. + */ +static __inline__ int usb_endpoint_is_bulk_in( + const struct usb_endpoint_descriptor *epd) +{ + return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); +} + +/** + * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT + * @epd: endpoint to be checked + * + * Returns true if the endpoint has bulk transfer type and OUT direction, + * otherwise it returns false. + */ +static __inline__ int usb_endpoint_is_bulk_out( + const struct usb_endpoint_descriptor *epd) +{ + return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); +} + +/** + * usb_endpoint_is_int_in - check if the endpoint is interrupt IN + * @epd: endpoint to be checked + * + * Returns true if the endpoint has interrupt transfer type and IN direction, + * otherwise it returns false. + */ +static __inline__ int usb_endpoint_is_int_in( + const struct usb_endpoint_descriptor *epd) +{ + return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); +} + +/** + * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT + * @epd: endpoint to be checked + * + * Returns true if the endpoint has interrupt transfer type and OUT direction, + * otherwise it returns false. + */ +static __inline__ int usb_endpoint_is_int_out( + const struct usb_endpoint_descriptor *epd) +{ + return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); +} + +/** + * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN + * @epd: endpoint to be checked + * + * Returns true if the endpoint has isochronous transfer type and IN direction, + * otherwise it returns false. + */ +static __inline__ int usb_endpoint_is_isoc_in( + const struct usb_endpoint_descriptor *epd) +{ + return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); +} + +/** + * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT + * @epd: endpoint to be checked + * + * Returns true if the endpoint has isochronous transfer type and OUT direction, + * otherwise it returns false. + */ +static __inline__ int usb_endpoint_is_isoc_out( + const struct usb_endpoint_descriptor *epd) +{ + return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); +} + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ +struct usb_qualifier_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __le16 bcdUSB; + __u8 bDeviceClass; + __u8 bDeviceSubClass; + __u8 bDeviceProtocol; + __u8 bMaxPacketSize0; + __u8 bNumConfigurations; + __u8 bRESERVED; +} __attribute__ ((packed)); + + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_OTG (from OTG 1.0a supplement) */ +struct usb_otg_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __u8 bmAttributes; /* support for HNP, SRP, etc */ +} __attribute__ ((packed)); + +/* from usb_otg_descriptor.bmAttributes */ +#define USB_OTG_SRP (1 << 0) +#define USB_OTG_HNP (1 << 1) /* swap host/device roles */ + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */ +struct usb_debug_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + /* bulk endpoints with 8 byte maxpacket */ + __u8 bDebugInEndpoint; + __u8 bDebugOutEndpoint; +} __attribute__((packed)); + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */ +struct usb_interface_assoc_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __u8 bFirstInterface; + __u8 bInterfaceCount; + __u8 bFunctionClass; + __u8 bFunctionSubClass; + __u8 bFunctionProtocol; + __u8 iFunction; +} __attribute__ ((packed)); + + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_SECURITY: group of wireless security descriptors, including + * encryption types available for setting up a CC/association. + */ +struct usb_security_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __le16 wTotalLength; + __u8 bNumEncryptionTypes; +} __attribute__((packed)); + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys + * may be retrieved. + */ +struct usb_key_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __u8 tTKID[3]; + __u8 bReserved; + __u8 bKeyData[0]; +} __attribute__((packed)); + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */ +struct usb_encryption_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __u8 bEncryptionType; +#define USB_ENC_TYPE_UNSECURE 0 +#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */ +#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */ +#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */ + __u8 bEncryptionValue; /* use in SET_ENCRYPTION */ + __u8 bAuthKeyIndex; +} __attribute__((packed)); + + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_BOS: group of device-level capabilities */ +struct usb_bos_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __le16 wTotalLength; + __u8 bNumDeviceCaps; +} __attribute__((packed)); + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ +struct usb_dev_cap_header { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; +} __attribute__((packed)); + +#define USB_CAP_TYPE_WIRELESS_USB 1 + +struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; + + __u8 bmAttributes; +#define USB_WIRELESS_P2P_DRD (1 << 1) +#define USB_WIRELESS_BEACON_MASK (3 << 2) +#define USB_WIRELESS_BEACON_SELF (1 << 2) +#define USB_WIRELESS_BEACON_DIRECTED (2 << 2) +#define USB_WIRELESS_BEACON_NONE (3 << 2) + __le16 wPHYRates; /* bit rates, Mbps */ +#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */ +#define USB_WIRELESS_PHY_80 (1 << 1) +#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */ +#define USB_WIRELESS_PHY_160 (1 << 3) +#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */ +#define USB_WIRELESS_PHY_320 (1 << 5) +#define USB_WIRELESS_PHY_400 (1 << 6) +#define USB_WIRELESS_PHY_480 (1 << 7) + __u8 bmTFITXPowerInfo; /* TFI power levels */ + __u8 bmFFITXPowerInfo; /* FFI power levels */ + __le16 bmBandGroup; + __u8 bReserved; +} __attribute__((packed)); + +#define USB_CAP_TYPE_EXT 2 + +struct usb_ext_cap_descriptor { /* Link Power Management */ + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; + __u8 bmAttributes; +#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ +} __attribute__((packed)); + +/*-------------------------------------------------------------------------*/ + +/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with + * each endpoint descriptor for a wireless device + */ +struct usb_wireless_ep_comp_descriptor { + __u8 bLength; + __u8 bDescriptorType; + + __u8 bMaxBurst; + __u8 bMaxSequence; + __le16 wMaxStreamDelay; + __le16 wOverTheAirPacketSize; + __u8 bOverTheAirInterval; + __u8 bmCompAttributes; +#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */ +#define USB_ENDPOINT_SWITCH_NO 0 +#define USB_ENDPOINT_SWITCH_SWITCH 1 +#define USB_ENDPOINT_SWITCH_SCALE 2 +} __attribute__((packed)); + +/*-------------------------------------------------------------------------*/ + +/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless + * host and a device for connection set up, mutual authentication, and + * exchanging short lived session keys. The handshake depends on a CC. + */ +struct usb_handshake { + __u8 bMessageNumber; + __u8 bStatus; + __u8 tTKID[3]; + __u8 bReserved; + __u8 CDID[16]; + __u8 nonce[16]; + __u8 MIC[8]; +} __attribute__((packed)); + +/*-------------------------------------------------------------------------*/ + +/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC). + * A CC may also be set up using non-wireless secure channels (including + * wired USB!), and some devices may support CCs with multiple hosts. + */ +struct usb_connection_context { + __u8 CHID[16]; /* persistent host id */ + __u8 CDID[16]; /* device id (unique w/in host context) */ + __u8 CK[16]; /* connection key */ +} __attribute__((packed)); + +/*-------------------------------------------------------------------------*/ + +/* USB 2.0 defines three speeds, here's how Linux identifies them */ + +enum usb_device_speed { + USB_SPEED_UNKNOWN = 0, /* enumerating */ + USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ + USB_SPEED_HIGH, /* usb 2.0 */ + USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ +}; + +enum usb_device_state { + /* NOTATTACHED isn't in the USB spec, and this state acts + * the same as ATTACHED ... but it's clearer this way. + */ + USB_STATE_NOTATTACHED = 0, + + /* chapter 9 and authentication (wireless) device states */ + USB_STATE_ATTACHED, + USB_STATE_POWERED, /* wired */ + USB_STATE_RECONNECTING, /* auth */ + USB_STATE_UNAUTHENTICATED, /* auth */ + USB_STATE_DEFAULT, /* limited function */ + USB_STATE_ADDRESS, + USB_STATE_CONFIGURED, /* most functions */ + + USB_STATE_SUSPENDED + + /* NOTE: there are actually four different SUSPENDED + * states, returning to POWERED, DEFAULT, ADDRESS, or + * CONFIGURED respectively when SOF tokens flow again. + * At this level there's no difference between L1 and L2 + * suspend states. (L2 being original USB 1.1 suspend.) + */ +}; + +#endif /* __LINUX_USB_CH9_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/g_printer.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/g_printer.h new file mode 100644 index 0000000..6178fde --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/g_printer.h @@ -0,0 +1,35 @@ +/* + * g_printer.h -- Header file for USB Printer gadget driver + * + * Copyright (C) 2007 Craig W. Nadler + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LINUX_USB_G_PRINTER_H +#define __LINUX_USB_G_PRINTER_H + +#define PRINTER_NOT_ERROR 0x08 +#define PRINTER_SELECTED 0x10 +#define PRINTER_PAPER_EMPTY 0x20 + +/* The 'g' code is also used by gadgetfs ioctl requests. + * Don't add any colliding codes to either driver, and keep + * them in unique ranges (size 0x20 for now). + */ +#define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) +#define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) + +#endif /* __LINUX_USB_G_PRINTER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/gadgetfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/gadgetfs.h new file mode 100644 index 0000000..612102e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/gadgetfs.h @@ -0,0 +1,88 @@ +/* + * Filesystem based user-mode API to USB Gadget controller hardware + * + * Other than ep0 operations, most things are done by read() and write() + * on endpoint files found in one directory. They are configured by + * writing descriptors, and then may be used for normal stream style + * i/o requests. When ep0 is configured, the device can enumerate; + * when it's closed, the device disconnects from usb. Operations on + * ep0 require ioctl() operations. + * + * Configuration and device descriptors get written to /dev/gadget/$CHIP, + * which may then be used to read usb_gadgetfs_event structs. The driver + * may activate endpoints as it handles SET_CONFIGURATION setup events, + * or earlier; writing endpoint descriptors to /dev/gadget/$ENDPOINT + * then performing data transfers by reading or writing. + */ + +#ifndef __LINUX_USB_GADGETFS_H +#define __LINUX_USB_GADGETFS_H + +#include +#include + +#include + +/* + * Events are delivered on the ep0 file descriptor, when the user mode driver + * reads from this file descriptor after writing the descriptors. Don't + * stop polling this descriptor. + */ + +enum usb_gadgetfs_event_type { + GADGETFS_NOP = 0, + + GADGETFS_CONNECT, + GADGETFS_DISCONNECT, + GADGETFS_SETUP, + GADGETFS_SUSPEND, + /* and likely more ! */ +}; + +/* NOTE: this structure must stay the same size and layout on + * both 32-bit and 64-bit kernels. + */ +struct usb_gadgetfs_event { + union { + /* NOP, DISCONNECT, SUSPEND: nothing + * ... some hardware can't report disconnection + */ + + /* CONNECT: just the speed */ + enum usb_device_speed speed; + + /* SETUP: packet; DATA phase i/o precedes next event + *(setup.bmRequestType & USB_DIR_IN) flags direction + * ... includes SET_CONFIGURATION, SET_INTERFACE + */ + struct usb_ctrlrequest setup; + } u; + enum usb_gadgetfs_event_type type; +}; + + +/* The 'g' code is also used by printer gadget ioctl requests. + * Don't add any colliding codes to either driver, and keep + * them in unique ranges (size 0x20 for now). + */ + +/* endpoint ioctls */ + +/* IN transfers may be reported to the gadget driver as complete + * when the fifo is loaded, before the host reads the data; + * OUT transfers may be reported to the host's "client" driver as + * complete when they're sitting in the FIFO unread. + * THIS returns how many bytes are "unclaimed" in the endpoint fifo + * (needed for precise fault handling, when the hardware allows it) + */ +#define GADGETFS_FIFO_STATUS _IO('g', 1) + +/* discards any unclaimed data in the fifo. */ +#define GADGETFS_FIFO_FLUSH _IO('g', 2) + +/* resets endpoint halt+toggle; used to implement set_interface. + * some hardware (like pxa2xx) can't support this. + */ +#define GADGETFS_CLEAR_HALT _IO('g', 3) + +#endif /* __LINUX_USB_GADGETFS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/midi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/midi.h new file mode 100644 index 0000000..1d10408 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/midi.h @@ -0,0 +1,112 @@ +/* + * -- USB MIDI definitions. + * + * Copyright (C) 2006 Thumtronics Pty Ltd. + * Developed for Thumtronics by Grey Innovation + * Ben Williamson + * + * This software is distributed under the terms of the GNU General Public + * License ("GPL") version 2, as published by the Free Software Foundation. + * + * This file holds USB constants and structures defined + * by the USB Device Class Definition for MIDI Devices. + * Comments below reference relevant sections of that document: + * + * http://www.usb.org/developers/devclass_docs/midi10.pdf + */ + +#ifndef __LINUX_USB_MIDI_H +#define __LINUX_USB_MIDI_H + +#include + +/* A.1 MS Class-Specific Interface Descriptor Subtypes */ +#define USB_MS_HEADER 0x01 +#define USB_MS_MIDI_IN_JACK 0x02 +#define USB_MS_MIDI_OUT_JACK 0x03 +#define USB_MS_ELEMENT 0x04 + +/* A.2 MS Class-Specific Endpoint Descriptor Subtypes */ +#define USB_MS_GENERAL 0x01 + +/* A.3 MS MIDI IN and OUT Jack Types */ +#define USB_MS_EMBEDDED 0x01 +#define USB_MS_EXTERNAL 0x02 + +/* 6.1.2.1 Class-Specific MS Interface Header Descriptor */ +struct usb_ms_header_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __le16 bcdMSC; + __le16 wTotalLength; +} __attribute__ ((packed)); + +#define USB_DT_MS_HEADER_SIZE 7 + +/* 6.1.2.2 MIDI IN Jack Descriptor */ +struct usb_midi_in_jack_descriptor { + __u8 bLength; + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ + __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */ + __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ + __u8 bJackID; + __u8 iJack; +} __attribute__ ((packed)); + +#define USB_DT_MIDI_IN_SIZE 6 + +struct usb_midi_source_pin { + __u8 baSourceID; + __u8 baSourcePin; +} __attribute__ ((packed)); + +/* 6.1.2.3 MIDI OUT Jack Descriptor */ +struct usb_midi_out_jack_descriptor { + __u8 bLength; + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ + __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */ + __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ + __u8 bJackID; + __u8 bNrInputPins; /* p */ + struct usb_midi_source_pin pins[]; /* [p] */ + /*__u8 iJack; -- ommitted due to variable-sized pins[] */ +} __attribute__ ((packed)); + +#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p)) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \ +struct usb_midi_out_jack_descriptor_##p { \ + __u8 bLength; \ + __u8 bDescriptorType; \ + __u8 bDescriptorSubtype; \ + __u8 bJackType; \ + __u8 bJackID; \ + __u8 bNrInputPins; \ + struct usb_midi_source_pin pins[p]; \ + __u8 iJack; \ +} __attribute__ ((packed)) + +/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ +struct usb_ms_endpoint_descriptor { + __u8 bLength; /* 4+n */ + __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ + __u8 bDescriptorSubtype; /* USB_MS_GENERAL */ + __u8 bNumEmbMIDIJack; /* n */ + __u8 baAssocJackID[]; /* [n] */ +} __attribute__ ((packed)); + +#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \ +struct usb_ms_endpoint_descriptor_##n { \ + __u8 bLength; \ + __u8 bDescriptorType; \ + __u8 bDescriptorSubtype; \ + __u8 bNumEmbMIDIJack; \ + __u8 baAssocJackID[n]; \ +} __attribute__ ((packed)) + +#endif /* __LINUX_USB_MIDI_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/tmc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/tmc.h new file mode 100644 index 0000000..c045ae1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/tmc.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany + * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2008 Greg Kroah-Hartman + * + * This file holds USB constants defined by the USB Device Class + * Definition for Test and Measurement devices published by the USB-IF. + * + * It also has the ioctl definitions for the usbtmc kernel driver that + * userspace needs to know about. + */ + +#ifndef __LINUX_USB_TMC_H +#define __LINUX_USB_TMC_H + +/* USB TMC status values */ +#define USBTMC_STATUS_SUCCESS 0x01 +#define USBTMC_STATUS_PENDING 0x02 +#define USBTMC_STATUS_FAILED 0x80 +#define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81 +#define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82 +#define USBTMC_STATUS_SPLIT_IN_PROGRESS 0x83 + +/* USB TMC requests values */ +#define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT 1 +#define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS 2 +#define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN 3 +#define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS 4 +#define USBTMC_REQUEST_INITIATE_CLEAR 5 +#define USBTMC_REQUEST_CHECK_CLEAR_STATUS 6 +#define USBTMC_REQUEST_GET_CAPABILITIES 7 +#define USBTMC_REQUEST_INDICATOR_PULSE 64 + +/* Request values for USBTMC driver's ioctl entry point */ +#define USBTMC_IOC_NR 91 +#define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1) +#define USBTMC_IOCTL_CLEAR _IO(USBTMC_IOC_NR, 2) +#define USBTMC_IOCTL_ABORT_BULK_OUT _IO(USBTMC_IOC_NR, 3) +#define USBTMC_IOCTL_ABORT_BULK_IN _IO(USBTMC_IOC_NR, 4) +#define USBTMC_IOCTL_CLEAR_OUT_HALT _IO(USBTMC_IOC_NR, 6) +#define USBTMC_IOCTL_CLEAR_IN_HALT _IO(USBTMC_IOC_NR, 7) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/vstusb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/vstusb.h new file mode 100644 index 0000000..c44e16c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usb/vstusb.h @@ -0,0 +1,71 @@ +/***************************************************************************** + * File: drivers/usb/misc/vstusb.h + * + * Purpose: Support for the bulk USB Vernier Spectrophotometers + * + * Author: EQware Engineering, Inc. + * Oregon City, OR, USA 97045 + * + * Copyright: 2007, 2008 + * Vernier Software & Technology + * Beaverton, OR, USA 97005 + * + * Web: www.vernier.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + *****************************************************************************/ +/***************************************************************************** + * + * The vstusb module is a standard usb 'client' driver running on top of the + * standard usb host controller stack. + * + * In general, vstusb supports standard bulk usb pipes. It supports multiple + * devices and multiple pipes per device. + * + * The vstusb driver supports two interfaces: + * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg + * interface to any pipe with timeout support; + * 2 - standard read/write with ioctl config - offers standard read/write + * interface with ioctl configured pipes and timeouts. + * + * Both interfaces can be signal from other process and will abort its i/o + * operation. + * + * A timeout of 0 means NO timeout. The user can still terminate the read via + * signal. + * + * If using multiple threads with this driver, the user should ensure that + * any reads, writes, or ioctls are complete before closing the device. + * Changing read/write timeouts or pipes takes effect on next read/write. + * + *****************************************************************************/ + +struct vstusb_args { + union { + /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, * + * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */ + struct { + void *buffer; + size_t count; + unsigned int timeout_ms; + int pipe; + }; + + /* this one is used for IOCTL_VSTUSB_CONFIG_RW */ + struct { + int rd_pipe; + int rd_timeout_ms; + int wr_pipe; + int wr_timeout_ms; + }; + }; +}; + +#define VST_IOC_MAGIC 'L' +#define VST_IOC_FIRST 0x20 +#define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST) +#define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1) +#define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2) diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usbdevice_fs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usbdevice_fs.h new file mode 100644 index 0000000..6411839 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/usbdevice_fs.h @@ -0,0 +1,152 @@ +/*****************************************************************************/ + +/* + * usbdevice_fs.h -- USB device file system. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * History: + * 0.1 04.01.2000 Created + */ + +/*****************************************************************************/ + +#ifndef _LINUX_USBDEVICE_FS_H +#define _LINUX_USBDEVICE_FS_H + +#include +#include + +/* --------------------------------------------------------------------- */ + +/* usbdevfs ioctl codes */ + +struct usbdevfs_ctrltransfer { + __u8 bRequestType; + __u8 bRequest; + __u16 wValue; + __u16 wIndex; + __u16 wLength; + __u32 timeout; /* in milliseconds */ + void *data; +}; + +struct usbdevfs_bulktransfer { + unsigned int ep; + unsigned int len; + unsigned int timeout; /* in milliseconds */ + void *data; +}; + +struct usbdevfs_setinterface { + unsigned int interface; + unsigned int altsetting; +}; + +struct usbdevfs_disconnectsignal { + unsigned int signr; + void *context; +}; + +#define USBDEVFS_MAXDRIVERNAME 255 + +struct usbdevfs_getdriver { + unsigned int interface; + char driver[USBDEVFS_MAXDRIVERNAME + 1]; +}; + +struct usbdevfs_connectinfo { + unsigned int devnum; + unsigned char slow; +}; + +#define USBDEVFS_URB_SHORT_NOT_OK 0x01 +#define USBDEVFS_URB_ISO_ASAP 0x02 +#define USBDEVFS_URB_NO_FSBR 0x20 +#define USBDEVFS_URB_ZERO_PACKET 0x40 +#define USBDEVFS_URB_NO_INTERRUPT 0x80 + +#define USBDEVFS_URB_TYPE_ISO 0 +#define USBDEVFS_URB_TYPE_INTERRUPT 1 +#define USBDEVFS_URB_TYPE_CONTROL 2 +#define USBDEVFS_URB_TYPE_BULK 3 + +struct usbdevfs_iso_packet_desc { + unsigned int length; + unsigned int actual_length; + unsigned int status; +}; + +struct usbdevfs_urb { + unsigned char type; + unsigned char endpoint; + int status; + unsigned int flags; + void *buffer; + int buffer_length; + int actual_length; + int start_frame; + int number_of_packets; + int error_count; + unsigned int signr; /* signal to be sent on completion, + or 0 if none should be sent. */ + void *usercontext; + struct usbdevfs_iso_packet_desc iso_frame_desc[0]; +}; + +/* ioctls for talking directly to drivers */ +struct usbdevfs_ioctl { + int ifno; /* interface 0..N ; negative numbers reserved */ + int ioctl_code; /* MUST encode size + direction of data so the + * macros in give correct values */ + void *data; /* param buffer (in, or out) */ +}; + +/* You can do most things with hubs just through control messages, + * except find out what device connects to what port. */ +struct usbdevfs_hub_portinfo { + char nports; /* number of downstream ports in this hub */ + char port [127]; /* e.g. port 3 connects to device 27 */ +}; + + +#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) +#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) +#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) +#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) +#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) +#define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver) +#define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) +#define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32) +#define USBDEVFS_DISCARDURB _IO('U', 11) +#define USBDEVFS_REAPURB _IOW('U', 12, void *) +#define USBDEVFS_REAPURB32 _IOW('U', 12, __u32) +#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) +#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) +#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) +#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) +#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) +#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) +#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) +#define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32) +#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) +#define USBDEVFS_RESET _IO('U', 20) +#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) +#define USBDEVFS_DISCONNECT _IO('U', 22) +#define USBDEVFS_CONNECT _IO('U', 23) +#endif /* _LINUX_USBDEVICE_FS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/utime.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/utime.h new file mode 100644 index 0000000..5cdf673 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/utime.h @@ -0,0 +1,11 @@ +#ifndef _LINUX_UTIME_H +#define _LINUX_UTIME_H + +#include + +struct utimbuf { + __kernel_time_t actime; + __kernel_time_t modtime; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/utsname.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/utsname.h new file mode 100644 index 0000000..ff71a1a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/utsname.h @@ -0,0 +1,34 @@ +#ifndef _LINUX_UTSNAME_H +#define _LINUX_UTSNAME_H + +#define __OLD_UTS_LEN 8 + +struct oldold_utsname { + char sysname[9]; + char nodename[9]; + char release[9]; + char version[9]; + char machine[9]; +}; + +#define __NEW_UTS_LEN 64 + +struct old_utsname { + char sysname[65]; + char nodename[65]; + char release[65]; + char version[65]; + char machine[65]; +}; + +struct new_utsname { + char sysname[65]; + char nodename[65]; + char release[65]; + char version[65]; + char machine[65]; + char domainname[65]; +}; + + +#endif /* _LINUX_UTSNAME_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/version.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/version.h new file mode 100644 index 0000000..e6a89ef --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/version.h @@ -0,0 +1,2 @@ +#define LINUX_VERSION_CODE 132638 +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/veth.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/veth.h new file mode 100644 index 0000000..3354c1e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/veth.h @@ -0,0 +1,12 @@ +#ifndef __NET_VETH_H_ +#define __NET_VETH_H_ + +enum { + VETH_INFO_UNSPEC, + VETH_INFO_PEER, + + __VETH_INFO_MAX +#define VETH_INFO_MAX (__VETH_INFO_MAX - 1) +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videodev.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videodev.h new file mode 100644 index 0000000..5983d6b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videodev.h @@ -0,0 +1,340 @@ +/* + * Video for Linux version 1 - OBSOLETE + * + * Header file for v4l1 drivers and applications, for + * Linux kernels 2.2.x or 2.4.x. + * + * Provides header for legacy drivers and applications + * + * See http://linuxtv.org for more info + * + */ +#ifndef __LINUX_VIDEODEV_H +#define __LINUX_VIDEODEV_H + +#include +#include +#include + +#if defined(__MIN_V4L1) && defined (__KERNEL__) + +/* + * Used by those V4L2 core functions that need a minimum V4L1 support, + * in order to allow V4L1 Compatibilty code compilation. + */ + +struct video_mbuf +{ + int size; /* Total memory to map */ + int frames; /* Frames */ + int offsets[VIDEO_MAX_FRAME]; +}; + +#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ + +#else +#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) + +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ + +struct video_capability +{ + char name[32]; + int type; + int channels; /* Num channels */ + int audios; /* Num audio devices */ + int maxwidth; /* Supported width */ + int maxheight; /* And height */ + int minwidth; /* Supported width */ + int minheight; /* And height */ +}; + + +struct video_channel +{ + int channel; + char name[32]; + int tuners; + __u32 flags; +#define VIDEO_VC_TUNER 1 /* Channel has a tuner */ +#define VIDEO_VC_AUDIO 2 /* Channel has audio */ + __u16 type; +#define VIDEO_TYPE_TV 1 +#define VIDEO_TYPE_CAMERA 2 + __u16 norm; /* Norm set by channel */ +}; + +struct video_tuner +{ + int tuner; + char name[32]; + unsigned long rangelow, rangehigh; /* Tuner range */ + __u32 flags; +#define VIDEO_TUNER_PAL 1 +#define VIDEO_TUNER_NTSC 2 +#define VIDEO_TUNER_SECAM 4 +#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */ +#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */ +#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */ +#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */ +#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */ + __u16 mode; /* PAL/NTSC/SECAM/OTHER */ +#define VIDEO_MODE_PAL 0 +#define VIDEO_MODE_NTSC 1 +#define VIDEO_MODE_SECAM 2 +#define VIDEO_MODE_AUTO 3 + __u16 signal; /* Signal strength 16bit scale */ +}; + +struct video_picture +{ + __u16 brightness; + __u16 hue; + __u16 colour; + __u16 contrast; + __u16 whiteness; /* Black and white only */ + __u16 depth; /* Capture depth */ + __u16 palette; /* Palette in use */ +#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */ +#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */ +#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */ +#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ +#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ +#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */ +#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */ +#define VIDEO_PALETTE_YUYV 8 +#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */ +#define VIDEO_PALETTE_YUV420 10 +#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */ +#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ +#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ +#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ +#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ +#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ +#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ +#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ +}; + +struct video_audio +{ + int audio; /* Audio channel */ + __u16 volume; /* If settable */ + __u16 bass, treble; + __u32 flags; +#define VIDEO_AUDIO_MUTE 1 +#define VIDEO_AUDIO_MUTABLE 2 +#define VIDEO_AUDIO_VOLUME 4 +#define VIDEO_AUDIO_BASS 8 +#define VIDEO_AUDIO_TREBLE 16 +#define VIDEO_AUDIO_BALANCE 32 + char name[16]; +#define VIDEO_SOUND_MONO 1 +#define VIDEO_SOUND_STEREO 2 +#define VIDEO_SOUND_LANG1 4 +#define VIDEO_SOUND_LANG2 8 + __u16 mode; + __u16 balance; /* Stereo balance */ + __u16 step; /* Step actual volume uses */ +}; + +struct video_clip +{ + __s32 x,y; + __s32 width, height; + struct video_clip *next; /* For user use/driver use only */ +}; + +struct video_window +{ + __u32 x,y; /* Position of window */ + __u32 width,height; /* Its size */ + __u32 chromakey; + __u32 flags; + struct video_clip *clips; /* Set only */ + int clipcount; +#define VIDEO_WINDOW_INTERLACE 1 +#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ +#define VIDEO_CLIP_BITMAP -1 +/* bitmap is 1024x625, a '1' bit represents a clipped pixel */ +#define VIDEO_CLIPMAP_SIZE (128 * 625) +}; + +struct video_capture +{ + __u32 x,y; /* Offsets into image */ + __u32 width, height; /* Area to capture */ + __u16 decimation; /* Decimation divider */ + __u16 flags; /* Flags for capture */ +#define VIDEO_CAPTURE_ODD 0 /* Temporal */ +#define VIDEO_CAPTURE_EVEN 1 +}; + +struct video_buffer +{ + void *base; + int height,width; + int depth; + int bytesperline; +}; + +struct video_mmap +{ + unsigned int frame; /* Frame (0 - n) for double buffer */ + int height,width; + unsigned int format; /* should be VIDEO_PALETTE_* */ +}; + +struct video_key +{ + __u8 key[8]; + __u32 flags; +}; + +struct video_mbuf +{ + int size; /* Total memory to map */ + int frames; /* Frames */ + int offsets[VIDEO_MAX_FRAME]; +}; + +#define VIDEO_NO_UNIT (-1) + +struct video_unit +{ + int video; /* Video minor */ + int vbi; /* VBI minor */ + int radio; /* Radio minor */ + int audio; /* Audio minor */ + int teletext; /* Teletext minor */ +}; + +struct vbi_format { + __u32 sampling_rate; /* in Hz */ + __u32 samples_per_line; + __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */ + __s32 start[2]; /* starting line for each frame */ + __u32 count[2]; /* count of lines for each frame */ + __u32 flags; +#define VBI_UNSYNC 1 /* can distingues between top/bottom field */ +#define VBI_INTERLACED 2 /* lines are interlaced */ +}; + +/* video_info is biased towards hardware mpeg encode/decode */ +/* but it could apply generically to any hardware compressor/decompressor */ +struct video_info +{ + __u32 frame_count; /* frames output since decode/encode began */ + __u32 h_size; /* current unscaled horizontal size */ + __u32 v_size; /* current unscaled veritcal size */ + __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */ + __u32 picture_type; /* current picture type */ + __u32 temporal_reference; /* current temporal reference */ + __u8 user_data[256]; /* user data last found in compressed stream */ + /* user_data[0] contains user data flags, user_data[1] has count */ +}; + +/* generic structure for setting playback modes */ +struct video_play_mode +{ + int mode; + int p1; + int p2; +}; + +/* for loading microcode / fpga programming */ +struct video_code +{ + char loadwhat[16]; /* name or tag of file being passed */ + int datasize; + __u8 *data; +}; + +#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */ +#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */ +#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */ +#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */ +#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */ +#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */ +#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */ +#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */ +#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */ +#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */ +#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */ +#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */ +#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */ +#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */ +#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */ +#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */ +#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */ +#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */ +#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */ +#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ +#define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */ +#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */ +#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */ +#define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */ +#define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */ +#define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */ +#define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */ +#define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */ +#define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */ + + +#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */ + +/* VIDIOCSWRITEMODE */ +#define VID_WRITE_MPEG_AUD 0 +#define VID_WRITE_MPEG_VID 1 +#define VID_WRITE_OSD 2 +#define VID_WRITE_TTX 3 +#define VID_WRITE_CC 4 +#define VID_WRITE_MJPEG 5 + +/* VIDIOCSPLAYMODE */ +#define VID_PLAY_VID_OUT_MODE 0 + /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */ +#define VID_PLAY_GENLOCK 1 + /* p1: 0 = OFF, 1 = ON */ + /* p2: GENLOCK FINE DELAY value */ +#define VID_PLAY_NORMAL 2 +#define VID_PLAY_PAUSE 3 +#define VID_PLAY_SINGLE_FRAME 4 +#define VID_PLAY_FAST_FORWARD 5 +#define VID_PLAY_SLOW_MOTION 6 +#define VID_PLAY_IMMEDIATE_NORMAL 7 +#define VID_PLAY_SWITCH_CHANNELS 8 +#define VID_PLAY_FREEZE_FRAME 9 +#define VID_PLAY_STILL_MODE 10 +#define VID_PLAY_MASTER_MODE 11 + /* p1: see below */ +#define VID_PLAY_MASTER_NONE 1 +#define VID_PLAY_MASTER_VIDEO 2 +#define VID_PLAY_MASTER_AUDIO 3 +#define VID_PLAY_ACTIVE_SCANLINES 12 + /* p1 = first active; p2 = last active */ +#define VID_PLAY_RESET 13 +#define VID_PLAY_END_MARK 14 + +#endif /* CONFIG_VIDEO_V4L1_COMPAT */ +#endif /* __MIN_V4L1 */ + +#endif /* __LINUX_VIDEODEV_H */ + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videodev2.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videodev2.h new file mode 100644 index 0000000..3f88bb7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videodev2.h @@ -0,0 +1,1557 @@ +/* + * Video for Linux Two header file + * + * Copyright (C) 1999-2007 the contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Alternatively you can redistribute this file under the terms of the + * BSD license as stated below: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. The names of its contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Header file for v4l or V4L2 drivers and applications + * with public API. + * All kernel-specific stuff were moved to media/v4l2-dev.h, so + * no #if __KERNEL tests are allowed here + * + * See http://linuxtv.org for more info + * + * Author: Bill Dirks + * Justin Schoeman + * Hans Verkuil + * et al. + */ +#ifndef __LINUX_VIDEODEV2_H +#define __LINUX_VIDEODEV2_H + +#include + +#include +#include + +/* + * Common stuff for both V4L1 and V4L2 + * Moved from videodev.h + */ +#define VIDEO_MAX_FRAME 32 + + +/* These defines are V4L1 specific and should not be used with the V4L2 API! + They will be removed from this header in the future. */ + +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ + +/* + * M I S C E L L A N E O U S + */ + +/* Four-character-code (FOURCC) */ +#define v4l2_fourcc(a, b, c, d)\ + ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) + +/* + * E N U M S + */ +enum v4l2_field { + V4L2_FIELD_ANY = 0, /* driver can choose from none, + top, bottom, interlaced + depending on whatever it thinks + is approximate ... */ + V4L2_FIELD_NONE = 1, /* this device has no fields ... */ + V4L2_FIELD_TOP = 2, /* top field only */ + V4L2_FIELD_BOTTOM = 3, /* bottom field only */ + V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ + V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one + buffer, top-bottom order */ + V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ + V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into + separate buffers */ + V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field + first and the top field is + transmitted first */ + V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field + first and the bottom field is + transmitted first */ +}; +#define V4L2_FIELD_HAS_TOP(field) \ + ((field) == V4L2_FIELD_TOP ||\ + (field) == V4L2_FIELD_INTERLACED ||\ + (field) == V4L2_FIELD_INTERLACED_TB ||\ + (field) == V4L2_FIELD_INTERLACED_BT ||\ + (field) == V4L2_FIELD_SEQ_TB ||\ + (field) == V4L2_FIELD_SEQ_BT) +#define V4L2_FIELD_HAS_BOTTOM(field) \ + ((field) == V4L2_FIELD_BOTTOM ||\ + (field) == V4L2_FIELD_INTERLACED ||\ + (field) == V4L2_FIELD_INTERLACED_TB ||\ + (field) == V4L2_FIELD_INTERLACED_BT ||\ + (field) == V4L2_FIELD_SEQ_TB ||\ + (field) == V4L2_FIELD_SEQ_BT) +#define V4L2_FIELD_HAS_BOTH(field) \ + ((field) == V4L2_FIELD_INTERLACED ||\ + (field) == V4L2_FIELD_INTERLACED_TB ||\ + (field) == V4L2_FIELD_INTERLACED_BT ||\ + (field) == V4L2_FIELD_SEQ_TB ||\ + (field) == V4L2_FIELD_SEQ_BT) + +enum v4l2_buf_type { + V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, + V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, + V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, + V4L2_BUF_TYPE_VBI_CAPTURE = 4, + V4L2_BUF_TYPE_VBI_OUTPUT = 5, + V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, + V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, +#if 1 + /* Experimental */ + V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, +#endif + V4L2_BUF_TYPE_PRIVATE = 0x80, +}; + +enum v4l2_ctrl_type { + V4L2_CTRL_TYPE_INTEGER = 1, + V4L2_CTRL_TYPE_BOOLEAN = 2, + V4L2_CTRL_TYPE_MENU = 3, + V4L2_CTRL_TYPE_BUTTON = 4, + V4L2_CTRL_TYPE_INTEGER64 = 5, + V4L2_CTRL_TYPE_CTRL_CLASS = 6, +}; + +enum v4l2_tuner_type { + V4L2_TUNER_RADIO = 1, + V4L2_TUNER_ANALOG_TV = 2, + V4L2_TUNER_DIGITAL_TV = 3, +}; + +enum v4l2_memory { + V4L2_MEMORY_MMAP = 1, + V4L2_MEMORY_USERPTR = 2, + V4L2_MEMORY_OVERLAY = 3, +}; + +/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ +enum v4l2_colorspace { + /* ITU-R 601 -- broadcast NTSC/PAL */ + V4L2_COLORSPACE_SMPTE170M = 1, + + /* 1125-Line (US) HDTV */ + V4L2_COLORSPACE_SMPTE240M = 2, + + /* HD and modern captures. */ + V4L2_COLORSPACE_REC709 = 3, + + /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ + V4L2_COLORSPACE_BT878 = 4, + + /* These should be useful. Assume 601 extents. */ + V4L2_COLORSPACE_470_SYSTEM_M = 5, + V4L2_COLORSPACE_470_SYSTEM_BG = 6, + + /* I know there will be cameras that send this. So, this is + * unspecified chromaticities and full 0-255 on each of the + * Y'CbCr components + */ + V4L2_COLORSPACE_JPEG = 7, + + /* For RGB colourspaces, this is probably a good start. */ + V4L2_COLORSPACE_SRGB = 8, +}; + +enum v4l2_priority { + V4L2_PRIORITY_UNSET = 0, /* not initialized */ + V4L2_PRIORITY_BACKGROUND = 1, + V4L2_PRIORITY_INTERACTIVE = 2, + V4L2_PRIORITY_RECORD = 3, + V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, +}; + +struct v4l2_rect { + __s32 left; + __s32 top; + __s32 width; + __s32 height; +}; + +struct v4l2_fract { + __u32 numerator; + __u32 denominator; +}; + +/* + * D R I V E R C A P A B I L I T I E S + */ +struct v4l2_capability { + __u8 driver[16]; /* i.e. "bttv" */ + __u8 card[32]; /* i.e. "Hauppauge WinTV" */ + __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ + __u32 version; /* should use KERNEL_VERSION() */ + __u32 capabilities; /* Device capabilities */ + __u32 reserved[4]; +}; + +/* Values for 'capabilities' field */ +#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ +#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ +#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ +#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ +#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ +#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ +#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ +#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ +#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ +#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ + +#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ +#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ +#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ + +#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ +#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ +#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ + +/* + * V I D E O I M A G E F O R M A T + */ +struct v4l2_pix_format { + __u32 width; + __u32 height; + __u32 pixelformat; + enum v4l2_field field; + __u32 bytesperline; /* for padding, zero if unused */ + __u32 sizeimage; + enum v4l2_colorspace colorspace; + __u32 priv; /* private data, depends on pixelformat */ +}; + +/* Pixel format FOURCC depth Description */ +#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ +#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ +#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ +#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ +#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ +#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ +#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ +#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ +#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ +#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ +#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ +#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ +#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ +#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ +#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ +#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ +#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ +#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ +#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ +#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */ +#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ +#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */ +#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ +#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ +#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ + +/* two planes -- one Y, one Cr + Cb interleaved */ +#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ +#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ +#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ +#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ + +/* The following formats are not defined in the V4L2 specification */ +#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ +#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ +#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */ +#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */ +#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */ + +/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ +#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ +#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ +/* + * 10bit raw bayer, expanded to 16 bits + * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... + */ +#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') +/* 10bit raw bayer DPCM compressed to 8 bits */ +#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') +#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ + +/* compressed formats */ +#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ +#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ +#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ +#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ + +/* Vendor-specific formats */ +#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ +#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ +#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */ +#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */ +#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */ +#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */ +#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */ +#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ +#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ +#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ +#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ +#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ +#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ +#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ + +/* + * F O R M A T E N U M E R A T I O N + */ +struct v4l2_fmtdesc { + __u32 index; /* Format number */ + enum v4l2_buf_type type; /* buffer type */ + __u32 flags; + __u8 description[32]; /* Description string */ + __u32 pixelformat; /* Format fourcc */ + __u32 reserved[4]; +}; + +#define V4L2_FMT_FLAG_COMPRESSED 0x0001 + +#if 1 + /* Experimental Frame Size and frame rate enumeration */ +/* + * F R A M E S I Z E E N U M E R A T I O N + */ +enum v4l2_frmsizetypes { + V4L2_FRMSIZE_TYPE_DISCRETE = 1, + V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, + V4L2_FRMSIZE_TYPE_STEPWISE = 3, +}; + +struct v4l2_frmsize_discrete { + __u32 width; /* Frame width [pixel] */ + __u32 height; /* Frame height [pixel] */ +}; + +struct v4l2_frmsize_stepwise { + __u32 min_width; /* Minimum frame width [pixel] */ + __u32 max_width; /* Maximum frame width [pixel] */ + __u32 step_width; /* Frame width step size [pixel] */ + __u32 min_height; /* Minimum frame height [pixel] */ + __u32 max_height; /* Maximum frame height [pixel] */ + __u32 step_height; /* Frame height step size [pixel] */ +}; + +struct v4l2_frmsizeenum { + __u32 index; /* Frame size number */ + __u32 pixel_format; /* Pixel format */ + __u32 type; /* Frame size type the device supports. */ + + union { /* Frame size */ + struct v4l2_frmsize_discrete discrete; + struct v4l2_frmsize_stepwise stepwise; + }; + + __u32 reserved[2]; /* Reserved space for future use */ +}; + +/* + * F R A M E R A T E E N U M E R A T I O N + */ +enum v4l2_frmivaltypes { + V4L2_FRMIVAL_TYPE_DISCRETE = 1, + V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, + V4L2_FRMIVAL_TYPE_STEPWISE = 3, +}; + +struct v4l2_frmival_stepwise { + struct v4l2_fract min; /* Minimum frame interval [s] */ + struct v4l2_fract max; /* Maximum frame interval [s] */ + struct v4l2_fract step; /* Frame interval step size [s] */ +}; + +struct v4l2_frmivalenum { + __u32 index; /* Frame format index */ + __u32 pixel_format; /* Pixel format */ + __u32 width; /* Frame width */ + __u32 height; /* Frame height */ + __u32 type; /* Frame interval type the device supports. */ + + union { /* Frame interval */ + struct v4l2_fract discrete; + struct v4l2_frmival_stepwise stepwise; + }; + + __u32 reserved[2]; /* Reserved space for future use */ +}; +#endif + +/* + * T I M E C O D E + */ +struct v4l2_timecode { + __u32 type; + __u32 flags; + __u8 frames; + __u8 seconds; + __u8 minutes; + __u8 hours; + __u8 userbits[4]; +}; + +/* Type */ +#define V4L2_TC_TYPE_24FPS 1 +#define V4L2_TC_TYPE_25FPS 2 +#define V4L2_TC_TYPE_30FPS 3 +#define V4L2_TC_TYPE_50FPS 4 +#define V4L2_TC_TYPE_60FPS 5 + +/* Flags */ +#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ +#define V4L2_TC_FLAG_COLORFRAME 0x0002 +#define V4L2_TC_USERBITS_field 0x000C +#define V4L2_TC_USERBITS_USERDEFINED 0x0000 +#define V4L2_TC_USERBITS_8BITCHARS 0x0008 +/* The above is based on SMPTE timecodes */ + +struct v4l2_jpegcompression { + int quality; + + int APPn; /* Number of APP segment to be written, + * must be 0..15 */ + int APP_len; /* Length of data in JPEG APPn segment */ + char APP_data[60]; /* Data in the JPEG APPn segment. */ + + int COM_len; /* Length of data in JPEG COM segment */ + char COM_data[60]; /* Data in JPEG COM segment */ + + __u32 jpeg_markers; /* Which markers should go into the JPEG + * output. Unless you exactly know what + * you do, leave them untouched. + * Inluding less markers will make the + * resulting code smaller, but there will + * be fewer aplications which can read it. + * The presence of the APP and COM marker + * is influenced by APP_len and COM_len + * ONLY, not by this property! */ + +#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ +#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ +#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ +#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ +#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will + * allways use APP0 */ +}; + +/* + * M E M O R Y - M A P P I N G B U F F E R S + */ +struct v4l2_requestbuffers { + __u32 count; + enum v4l2_buf_type type; + enum v4l2_memory memory; + __u32 reserved[2]; +}; + +struct v4l2_buffer { + __u32 index; + enum v4l2_buf_type type; + __u32 bytesused; + __u32 flags; + enum v4l2_field field; + struct timeval timestamp; + struct v4l2_timecode timecode; + __u32 sequence; + + /* memory location */ + enum v4l2_memory memory; + union { + __u32 offset; + unsigned long userptr; + } m; + __u32 length; + __u32 input; + __u32 reserved; +}; + +/* Flags for 'flags' field */ +#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ +#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ +#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ +#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ +#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ +#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ +#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ +#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ + +/* + * O V E R L A Y P R E V I E W + */ +struct v4l2_framebuffer { + __u32 capability; + __u32 flags; +/* FIXME: in theory we should pass something like PCI device + memory + * region + offset instead of some physical address */ + void *base; + struct v4l2_pix_format fmt; +}; +/* Flags for the 'capability' field. Read only */ +#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 +#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 +#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 +#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 +#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 +#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 +#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 +/* Flags for the 'flags' field. */ +#define V4L2_FBUF_FLAG_PRIMARY 0x0001 +#define V4L2_FBUF_FLAG_OVERLAY 0x0002 +#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 +#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 +#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 +#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 + +struct v4l2_clip { + struct v4l2_rect c; + struct v4l2_clip *next; +}; + +struct v4l2_window { + struct v4l2_rect w; + enum v4l2_field field; + __u32 chromakey; + struct v4l2_clip *clips; + __u32 clipcount; + void *bitmap; + __u8 global_alpha; +}; + +/* + * C A P T U R E P A R A M E T E R S + */ +struct v4l2_captureparm { + __u32 capability; /* Supported modes */ + __u32 capturemode; /* Current mode */ + struct v4l2_fract timeperframe; /* Time per frame in .1us units */ + __u32 extendedmode; /* Driver-specific extensions */ + __u32 readbuffers; /* # of buffers for read */ + __u32 reserved[4]; +}; + +/* Flags for 'capability' and 'capturemode' fields */ +#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ +#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ + +struct v4l2_outputparm { + __u32 capability; /* Supported modes */ + __u32 outputmode; /* Current mode */ + struct v4l2_fract timeperframe; /* Time per frame in seconds */ + __u32 extendedmode; /* Driver-specific extensions */ + __u32 writebuffers; /* # of buffers for write */ + __u32 reserved[4]; +}; + +/* + * I N P U T I M A G E C R O P P I N G + */ +struct v4l2_cropcap { + enum v4l2_buf_type type; + struct v4l2_rect bounds; + struct v4l2_rect defrect; + struct v4l2_fract pixelaspect; +}; + +struct v4l2_crop { + enum v4l2_buf_type type; + struct v4l2_rect c; +}; + +/* + * A N A L O G V I D E O S T A N D A R D + */ + +typedef __u64 v4l2_std_id; + +/* one bit for each */ +#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) +#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) +#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) +#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) +#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) +#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) +#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) +#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) + +#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) +#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) +#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) +#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) + +#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) +#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) +#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) +#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) + +#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) +#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) +#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) +#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) +#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) +#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) +#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) +#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) + +/* ATSC/HDTV */ +#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) +#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) + +/* FIXME: + Although std_id is 64 bits, there is an issue on PPC32 architecture that + makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding + this value to 32 bits. + As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), + it should work fine. However, if needed to add more than two standards, + v4l2-common.c should be fixed. + */ + +/* some merged standards */ +#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) +#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B) +#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H) +#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK) + +/* some common needed stuff */ +#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ + V4L2_STD_PAL_B1 |\ + V4L2_STD_PAL_G) +#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ + V4L2_STD_PAL_D1 |\ + V4L2_STD_PAL_K) +#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ + V4L2_STD_PAL_DK |\ + V4L2_STD_PAL_H |\ + V4L2_STD_PAL_I) +#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ + V4L2_STD_NTSC_M_JP |\ + V4L2_STD_NTSC_M_KR) +#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ + V4L2_STD_SECAM_K |\ + V4L2_STD_SECAM_K1) +#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ + V4L2_STD_SECAM_G |\ + V4L2_STD_SECAM_H |\ + V4L2_STD_SECAM_DK |\ + V4L2_STD_SECAM_L |\ + V4L2_STD_SECAM_LC) + +#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ + V4L2_STD_PAL_60 |\ + V4L2_STD_NTSC |\ + V4L2_STD_NTSC_443) +#define V4L2_STD_625_50 (V4L2_STD_PAL |\ + V4L2_STD_PAL_N |\ + V4L2_STD_PAL_Nc |\ + V4L2_STD_SECAM) +#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ + V4L2_STD_ATSC_16_VSB) + +#define V4L2_STD_UNKNOWN 0 +#define V4L2_STD_ALL (V4L2_STD_525_60 |\ + V4L2_STD_625_50) + +struct v4l2_standard { + __u32 index; + v4l2_std_id id; + __u8 name[24]; + struct v4l2_fract frameperiod; /* Frames, not fields */ + __u32 framelines; + __u32 reserved[4]; +}; + +/* + * V I D E O I N P U T S + */ +struct v4l2_input { + __u32 index; /* Which input */ + __u8 name[32]; /* Label */ + __u32 type; /* Type of input */ + __u32 audioset; /* Associated audios (bitfield) */ + __u32 tuner; /* Associated tuner */ + v4l2_std_id std; + __u32 status; + __u32 reserved[4]; +}; + +/* Values for the 'type' field */ +#define V4L2_INPUT_TYPE_TUNER 1 +#define V4L2_INPUT_TYPE_CAMERA 2 + +/* field 'status' - general */ +#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ +#define V4L2_IN_ST_NO_SIGNAL 0x00000002 +#define V4L2_IN_ST_NO_COLOR 0x00000004 + +/* field 'status' - sensor orientation */ +/* If sensor is mounted upside down set both bits */ +#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ +#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ + +/* field 'status' - analog */ +#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ +#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ + +/* field 'status' - digital */ +#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ +#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ +#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ + +/* field 'status' - VCR and set-top box */ +#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ +#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ +#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ + +/* + * V I D E O O U T P U T S + */ +struct v4l2_output { + __u32 index; /* Which output */ + __u8 name[32]; /* Label */ + __u32 type; /* Type of output */ + __u32 audioset; /* Associated audios (bitfield) */ + __u32 modulator; /* Associated modulator */ + v4l2_std_id std; + __u32 reserved[4]; +}; +/* Values for the 'type' field */ +#define V4L2_OUTPUT_TYPE_MODULATOR 1 +#define V4L2_OUTPUT_TYPE_ANALOG 2 +#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 + +/* + * C O N T R O L S + */ +struct v4l2_control { + __u32 id; + __s32 value; +}; + +struct v4l2_ext_control { + __u32 id; + __u32 reserved2[2]; + union { + __s32 value; + __s64 value64; + void *reserved; + }; +} __attribute__ ((packed)); + +struct v4l2_ext_controls { + __u32 ctrl_class; + __u32 count; + __u32 error_idx; + __u32 reserved[2]; + struct v4l2_ext_control *controls; +}; + +/* Values for ctrl_class field */ +#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ +#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ +#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ + +#define V4L2_CTRL_ID_MASK (0x0fffffff) +#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) +#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) + +/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ +struct v4l2_queryctrl { + __u32 id; + enum v4l2_ctrl_type type; + __u8 name[32]; /* Whatever */ + __s32 minimum; /* Note signedness */ + __s32 maximum; + __s32 step; + __s32 default_value; + __u32 flags; + __u32 reserved[2]; +}; + +/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ +struct v4l2_querymenu { + __u32 id; + __u32 index; + __u8 name[32]; /* Whatever */ + __u32 reserved; +}; + +/* Control flags */ +#define V4L2_CTRL_FLAG_DISABLED 0x0001 +#define V4L2_CTRL_FLAG_GRABBED 0x0002 +#define V4L2_CTRL_FLAG_READ_ONLY 0x0004 +#define V4L2_CTRL_FLAG_UPDATE 0x0008 +#define V4L2_CTRL_FLAG_INACTIVE 0x0010 +#define V4L2_CTRL_FLAG_SLIDER 0x0020 +#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 + +/* Query flag, to be ORed with the control ID */ +#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 + +/* User-class control IDs defined by V4L2 */ +#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) +#define V4L2_CID_USER_BASE V4L2_CID_BASE +/* IDs reserved for driver specific controls */ +#define V4L2_CID_PRIVATE_BASE 0x08000000 + +#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) +#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) +#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) +#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) +#define V4L2_CID_HUE (V4L2_CID_BASE+3) +#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) +#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) +#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) +#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) +#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) +#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) +#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */ +#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) +#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) +#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) +#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) +#define V4L2_CID_GAMMA (V4L2_CID_BASE+16) +#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */ +#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) +#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) +#define V4L2_CID_GAIN (V4L2_CID_BASE+19) +#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) +#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) + +/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */ +#define V4L2_CID_HCENTER (V4L2_CID_BASE+22) +#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) + +#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) +enum v4l2_power_line_frequency { + V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0, + V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1, + V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2, +}; +#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) +#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) +#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) +#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) +#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) +#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) +#define V4L2_CID_COLORFX (V4L2_CID_BASE+31) +enum v4l2_colorfx { + V4L2_COLORFX_NONE = 0, + V4L2_COLORFX_BW = 1, + V4L2_COLORFX_SEPIA = 2, +}; + +/* last CID + 1 */ +#define V4L2_CID_LASTP1 (V4L2_CID_BASE+32) + +/* MPEG-class control IDs defined by V4L2 */ +#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) +#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) + +/* MPEG streams */ +#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) +enum v4l2_mpeg_stream_type { + V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ + V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ + V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */ + V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */ + V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ + V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ +}; +#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) +#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) +#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) +#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) +#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) +#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) +#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) +enum v4l2_mpeg_stream_vbi_fmt { + V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ + V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ +}; + +/* MPEG audio */ +#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) +enum v4l2_mpeg_audio_sampling_freq { + V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, + V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, + V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, +}; +#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) +enum v4l2_mpeg_audio_encoding { + V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, + V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, + V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, + V4L2_MPEG_AUDIO_ENCODING_AAC = 3, + V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, +}; +#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) +enum v4l2_mpeg_audio_l1_bitrate { + V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, + V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, + V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, + V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, + V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, + V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, + V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, + V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, + V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, + V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, + V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, + V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, + V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, + V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, +}; +#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) +enum v4l2_mpeg_audio_l2_bitrate { + V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, + V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, + V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, + V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, + V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, + V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, + V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, + V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, + V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, + V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, + V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, + V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, + V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, + V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, +}; +#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) +enum v4l2_mpeg_audio_l3_bitrate { + V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, + V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, + V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, + V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, + V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, + V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, + V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, + V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, + V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, + V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, + V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, + V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, + V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, + V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, +}; +#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) +enum v4l2_mpeg_audio_mode { + V4L2_MPEG_AUDIO_MODE_STEREO = 0, + V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, + V4L2_MPEG_AUDIO_MODE_DUAL = 2, + V4L2_MPEG_AUDIO_MODE_MONO = 3, +}; +#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) +enum v4l2_mpeg_audio_mode_extension { + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, +}; +#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) +enum v4l2_mpeg_audio_emphasis { + V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, + V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, + V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, +}; +#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) +enum v4l2_mpeg_audio_crc { + V4L2_MPEG_AUDIO_CRC_NONE = 0, + V4L2_MPEG_AUDIO_CRC_CRC16 = 1, +}; +#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) +#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) +#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) +enum v4l2_mpeg_audio_ac3_bitrate { + V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, + V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, + V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, + V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, + V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, + V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, + V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, + V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, + V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, + V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, + V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, + V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, + V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, + V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, + V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, + V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, + V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, + V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, + V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, +}; + +/* MPEG video */ +#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) +enum v4l2_mpeg_video_encoding { + V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, + V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, + V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, +}; +#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) +enum v4l2_mpeg_video_aspect { + V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, + V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, + V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, + V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, +}; +#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) +#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) +#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) +#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) +#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) +enum v4l2_mpeg_video_bitrate_mode { + V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, + V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, +}; +#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) +#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) +#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) +#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) +#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) + +/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ +#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) +#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) +enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { + V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, + V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) +enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) +enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { + V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, + V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) +enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { + V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, + V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) +#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) +enum v4l2_mpeg_cx2341x_video_median_filter_type { + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) +#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) +#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) +#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) + +/* Camera class control IDs */ +#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) +#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) + +#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) +enum v4l2_exposure_auto_type { + V4L2_EXPOSURE_AUTO = 0, + V4L2_EXPOSURE_MANUAL = 1, + V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, + V4L2_EXPOSURE_APERTURE_PRIORITY = 3 +}; +#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) +#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) + +#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) +#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) +#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) +#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) + +#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) +#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) + +#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) +#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) +#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) + +#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13) +#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14) +#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15) + +#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) + +/* + * T U N I N G + */ +struct v4l2_tuner { + __u32 index; + __u8 name[32]; + enum v4l2_tuner_type type; + __u32 capability; + __u32 rangelow; + __u32 rangehigh; + __u32 rxsubchans; + __u32 audmode; + __s32 signal; + __s32 afc; + __u32 reserved[4]; +}; + +struct v4l2_modulator { + __u32 index; + __u8 name[32]; + __u32 capability; + __u32 rangelow; + __u32 rangehigh; + __u32 txsubchans; + __u32 reserved[4]; +}; + +/* Flags for the 'capability' field */ +#define V4L2_TUNER_CAP_LOW 0x0001 +#define V4L2_TUNER_CAP_NORM 0x0002 +#define V4L2_TUNER_CAP_STEREO 0x0010 +#define V4L2_TUNER_CAP_LANG2 0x0020 +#define V4L2_TUNER_CAP_SAP 0x0020 +#define V4L2_TUNER_CAP_LANG1 0x0040 + +/* Flags for the 'rxsubchans' field */ +#define V4L2_TUNER_SUB_MONO 0x0001 +#define V4L2_TUNER_SUB_STEREO 0x0002 +#define V4L2_TUNER_SUB_LANG2 0x0004 +#define V4L2_TUNER_SUB_SAP 0x0004 +#define V4L2_TUNER_SUB_LANG1 0x0008 + +/* Values for the 'audmode' field */ +#define V4L2_TUNER_MODE_MONO 0x0000 +#define V4L2_TUNER_MODE_STEREO 0x0001 +#define V4L2_TUNER_MODE_LANG2 0x0002 +#define V4L2_TUNER_MODE_SAP 0x0002 +#define V4L2_TUNER_MODE_LANG1 0x0003 +#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 + +struct v4l2_frequency { + __u32 tuner; + enum v4l2_tuner_type type; + __u32 frequency; + __u32 reserved[8]; +}; + +struct v4l2_hw_freq_seek { + __u32 tuner; + enum v4l2_tuner_type type; + __u32 seek_upward; + __u32 wrap_around; + __u32 reserved[8]; +}; + +/* + * A U D I O + */ +struct v4l2_audio { + __u32 index; + __u8 name[32]; + __u32 capability; + __u32 mode; + __u32 reserved[2]; +}; + +/* Flags for the 'capability' field */ +#define V4L2_AUDCAP_STEREO 0x00001 +#define V4L2_AUDCAP_AVL 0x00002 + +/* Flags for the 'mode' field */ +#define V4L2_AUDMODE_AVL 0x00001 + +struct v4l2_audioout { + __u32 index; + __u8 name[32]; + __u32 capability; + __u32 mode; + __u32 reserved[2]; +}; + +/* + * M P E G S E R V I C E S + * + * NOTE: EXPERIMENTAL API + */ +#if 1 +#define V4L2_ENC_IDX_FRAME_I (0) +#define V4L2_ENC_IDX_FRAME_P (1) +#define V4L2_ENC_IDX_FRAME_B (2) +#define V4L2_ENC_IDX_FRAME_MASK (0xf) + +struct v4l2_enc_idx_entry { + __u64 offset; + __u64 pts; + __u32 length; + __u32 flags; + __u32 reserved[2]; +}; + +#define V4L2_ENC_IDX_ENTRIES (64) +struct v4l2_enc_idx { + __u32 entries; + __u32 entries_cap; + __u32 reserved[4]; + struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; +}; + + +#define V4L2_ENC_CMD_START (0) +#define V4L2_ENC_CMD_STOP (1) +#define V4L2_ENC_CMD_PAUSE (2) +#define V4L2_ENC_CMD_RESUME (3) + +/* Flags for V4L2_ENC_CMD_STOP */ +#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) + +struct v4l2_encoder_cmd { + __u32 cmd; + __u32 flags; + union { + struct { + __u32 data[8]; + } raw; + }; +}; + +#endif + + +/* + * D A T A S E R V I C E S ( V B I ) + * + * Data services API by Michael Schimek + */ + +/* Raw VBI */ +struct v4l2_vbi_format { + __u32 sampling_rate; /* in 1 Hz */ + __u32 offset; + __u32 samples_per_line; + __u32 sample_format; /* V4L2_PIX_FMT_* */ + __s32 start[2]; + __u32 count[2]; + __u32 flags; /* V4L2_VBI_* */ + __u32 reserved[2]; /* must be zero */ +}; + +/* VBI flags */ +#define V4L2_VBI_UNSYNC (1 << 0) +#define V4L2_VBI_INTERLACED (1 << 1) + +/* Sliced VBI + * + * This implements is a proposal V4L2 API to allow SLICED VBI + * required for some hardware encoders. It should change without + * notice in the definitive implementation. + */ + +struct v4l2_sliced_vbi_format { + __u16 service_set; + /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field + service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ + __u16 service_lines[2][24]; + __u32 io_size; + __u32 reserved[2]; /* must be zero */ +}; + +/* Teletext World System Teletext + (WST), defined on ITU-R BT.653-2 */ +#define V4L2_SLICED_TELETEXT_B (0x0001) +/* Video Program System, defined on ETS 300 231*/ +#define V4L2_SLICED_VPS (0x0400) +/* Closed Caption, defined on EIA-608 */ +#define V4L2_SLICED_CAPTION_525 (0x1000) +/* Wide Screen System, defined on ITU-R BT1119.1 */ +#define V4L2_SLICED_WSS_625 (0x4000) + +#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) +#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) + +struct v4l2_sliced_vbi_cap { + __u16 service_set; + /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field + service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ + __u16 service_lines[2][24]; + enum v4l2_buf_type type; + __u32 reserved[3]; /* must be 0 */ +}; + +struct v4l2_sliced_vbi_data { + __u32 id; + __u32 field; /* 0: first field, 1: second field */ + __u32 line; /* 1-23 */ + __u32 reserved; /* must be 0 */ + __u8 data[48]; +}; + +/* + * Sliced VBI data inserted into MPEG Streams + */ + +/* + * V4L2_MPEG_STREAM_VBI_FMT_IVTV: + * + * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an + * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI + * data + * + * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header + * definitions are not included here. See the MPEG-2 specifications for details + * on these headers. + */ + +/* Line type IDs */ +#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1) +#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4) +#define V4L2_MPEG_VBI_IVTV_WSS_625 (5) +#define V4L2_MPEG_VBI_IVTV_VPS (7) + +struct v4l2_mpeg_vbi_itv0_line { + __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */ + __u8 data[42]; /* Sliced VBI data for the line */ +} __attribute__ ((packed)); + +struct v4l2_mpeg_vbi_itv0 { + __le32 linemask[2]; /* Bitmasks of VBI service lines present */ + struct v4l2_mpeg_vbi_itv0_line line[35]; +} __attribute__ ((packed)); + +struct v4l2_mpeg_vbi_ITV0 { + struct v4l2_mpeg_vbi_itv0_line line[36]; +} __attribute__ ((packed)); + +#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0" +#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0" + +struct v4l2_mpeg_vbi_fmt_ivtv { + __u8 magic[4]; + union { + struct v4l2_mpeg_vbi_itv0 itv0; + struct v4l2_mpeg_vbi_ITV0 ITV0; + }; +} __attribute__ ((packed)); + +/* + * A G G R E G A T E S T R U C T U R E S + */ + +/* Stream data format + */ +struct v4l2_format { + enum v4l2_buf_type type; + union { + struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ + struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ + struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ + struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ + __u8 raw_data[200]; /* user-defined */ + } fmt; +}; + + +/* Stream type-dependent parameters + */ +struct v4l2_streamparm { + enum v4l2_buf_type type; + union { + struct v4l2_captureparm capture; + struct v4l2_outputparm output; + __u8 raw_data[200]; /* user-defined */ + } parm; +}; + +/* + * A D V A N C E D D E B U G G I N G + * + * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! + * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY! + */ + +/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ + +#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ +#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ +#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ +#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ + +struct v4l2_dbg_match { + __u32 type; /* Match type */ + union { /* Match this chip, meaning determined by type */ + __u32 addr; + char name[32]; + }; +} __attribute__ ((packed)); + +struct v4l2_dbg_register { + struct v4l2_dbg_match match; + __u32 size; /* register size in bytes */ + __u64 reg; + __u64 val; +} __attribute__ ((packed)); + +/* VIDIOC_DBG_G_CHIP_IDENT */ +struct v4l2_dbg_chip_ident { + struct v4l2_dbg_match match; + __u32 ident; /* chip identifier as specified in */ + __u32 revision; /* chip revision, chip specific */ +} __attribute__ ((packed)); + +/* + * I O C T L C O D E S F O R V I D E O D E V I C E S + * + */ +#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) +#define VIDIOC_RESERVED _IO('V', 1) +#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) +#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) +#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) +#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) +#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) +#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) +#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) +#define VIDIOC_OVERLAY _IOW('V', 14, int) +#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) +#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) +#define VIDIOC_STREAMON _IOW('V', 18, int) +#define VIDIOC_STREAMOFF _IOW('V', 19, int) +#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) +#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) +#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) +#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) +#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) +#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) +#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) +#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) +#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) +#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) +#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) +#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) +#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) +#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) +#define VIDIOC_G_INPUT _IOR('V', 38, int) +#define VIDIOC_S_INPUT _IOWR('V', 39, int) +#define VIDIOC_G_OUTPUT _IOR('V', 46, int) +#define VIDIOC_S_OUTPUT _IOWR('V', 47, int) +#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) +#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) +#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) +#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) +#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) +#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) +#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) +#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) +#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) +#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) +#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) +#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) +#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) +#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) +#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) +#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) +#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) +#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) +#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) +#define VIDIOC_LOG_STATUS _IO('V', 70) +#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) +#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) +#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) +#if 1 +#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) +#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) +#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) +#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) +#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) +#endif + +#if 1 +/* Experimental, meant for debugging, testing and internal use. + Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. + You must be root to use these ioctls. Never use these in applications! */ +#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) +#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) + +/* Experimental, meant for debugging, testing and internal use. + Never use this ioctl in applications! */ +#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) +#endif + +#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) +/* Reminder: when adding new ioctls please add support for them to + drivers/media/video/v4l2-compat-ioctl32.c as well! */ + +#ifdef __OLD_VIDIOC_ +/* for compatibility, will go away some day */ +#define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int) +#define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm) +#define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control) +#define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio) +#define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout) +#define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap) +#endif + +#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ + +#endif /* __LINUX_VIDEODEV2_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videotext.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videotext.h new file mode 100644 index 0000000..6afaaf1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/videotext.h @@ -0,0 +1,125 @@ +#ifndef _VTX_H +#define _VTX_H + +/* + * Teletext (=Videotext) hardware decoders using interface /dev/vtx + * Do not confuse with drivers using /dev/vbi which decode videotext by software + * + * Videotext IOCTLs changed in order to use _IO() macros defined in , + * unused tuner IOCTLs cleaned up by + * Michael Geng + * + * Copyright (c) 1994-97 Martin Buck + * Read COPYING for more information + * + */ + + +/* + * Videotext ioctls + */ +#define VTXIOCGETINFO _IOR (0x81, 1, vtx_info_t) +#define VTXIOCCLRPAGE _IOW (0x81, 2, vtx_pagereq_t) +#define VTXIOCCLRFOUND _IOW (0x81, 3, vtx_pagereq_t) +#define VTXIOCPAGEREQ _IOW (0x81, 4, vtx_pagereq_t) +#define VTXIOCGETSTAT _IOW (0x81, 5, vtx_pagereq_t) +#define VTXIOCGETPAGE _IOW (0x81, 6, vtx_pagereq_t) +#define VTXIOCSTOPDAU _IOW (0x81, 7, vtx_pagereq_t) +#define VTXIOCPUTPAGE _IO (0x81, 8) +#define VTXIOCSETDISP _IO (0x81, 9) +#define VTXIOCPUTSTAT _IO (0x81, 10) +#define VTXIOCCLRCACHE _IO (0x81, 11) +#define VTXIOCSETVIRT _IOW (0x81, 12, long) + +/* for compatibility, will go away some day */ +#define VTXIOCGETINFO_OLD 0x7101 /* get version of driver & capabilities of vtx-chipset */ +#define VTXIOCCLRPAGE_OLD 0x7102 /* clear page-buffer */ +#define VTXIOCCLRFOUND_OLD 0x7103 /* clear bits indicating that page was found */ +#define VTXIOCPAGEREQ_OLD 0x7104 /* search for page */ +#define VTXIOCGETSTAT_OLD 0x7105 /* get status of page-buffer */ +#define VTXIOCGETPAGE_OLD 0x7106 /* get contents of page-buffer */ +#define VTXIOCSTOPDAU_OLD 0x7107 /* stop data acquisition unit */ +#define VTXIOCPUTPAGE_OLD 0x7108 /* display page on TV-screen */ +#define VTXIOCSETDISP_OLD 0x7109 /* set TV-mode */ +#define VTXIOCPUTSTAT_OLD 0x710a /* set status of TV-output-buffer */ +#define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */ +#define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */ + +/* + * Definitions for VTXIOCGETINFO + */ + +#define SAA5243 0 +#define SAA5246 1 +#define SAA5249 2 +#define SAA5248 3 +#define XSTV5346 4 + +typedef struct { + int version_major, version_minor; /* version of driver; if version_major changes, driver */ + /* is not backward compatible!!! CHECK THIS!!! */ + int numpages; /* number of page-buffers of vtx-chipset */ + int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or + * SAA5249) */ +} +vtx_info_t; + + +/* + * Definitions for VTXIOC{CLRPAGE,CLRFOUND,PAGEREQ,GETSTAT,GETPAGE,STOPDAU,PUTPAGE,SETDISP} + */ + +#define MIN_UNIT (1<<0) +#define MIN_TEN (1<<1) +#define HR_UNIT (1<<2) +#define HR_TEN (1<<3) +#define PG_UNIT (1<<4) +#define PG_TEN (1<<5) +#define PG_HUND (1<<6) +#define PGMASK_MAX (1<<7) +#define PGMASK_PAGE (PG_HUND | PG_TEN | PG_UNIT) +#define PGMASK_HOUR (HR_TEN | HR_UNIT) +#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT) + +typedef struct +{ + int page; /* number of requested page (hexadecimal) */ + int hour; /* requested hour (hexadecimal) */ + int minute; /* requested minute (hexadecimal) */ + int pagemask; /* mask defining which values of the above are set */ + int pgbuf; /* buffer where page will be stored */ + int start; /* start of requested part of page */ + int end; /* end of requested part of page */ + void *buffer; /* pointer to beginning of destination buffer */ +} +vtx_pagereq_t; + + +/* + * Definitions for VTXIOC{GETSTAT,PUTSTAT} + */ + +#define VTX_PAGESIZE (40 * 24) +#define VTX_VIRTUALSIZE (40 * 49) + +typedef struct +{ + int pagenum; /* number of page (hexadecimal) */ + int hour; /* hour (hexadecimal) */ + int minute; /* minute (hexadecimal) */ + int charset; /* national charset */ + unsigned delete : 1; /* delete page (C4) */ + unsigned headline : 1; /* insert headline (C5) */ + unsigned subtitle : 1; /* insert subtitle (C6) */ + unsigned supp_header : 1; /* suppress header (C7) */ + unsigned update : 1; /* update page (C8) */ + unsigned inter_seq : 1; /* interrupted sequence (C9) */ + unsigned dis_disp : 1; /* disable/suppress display (C10) */ + unsigned serial : 1; /* serial mode (C11) */ + unsigned notfound : 1; /* /FOUND */ + unsigned pblf : 1; /* PBLF */ + unsigned hamming : 1; /* hamming-error occurred */ +} +vtx_pageinfo_t; + +#endif /* _VTX_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_9p.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_9p.h new file mode 100644 index 0000000..b3c4a60 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_9p.h @@ -0,0 +1,12 @@ +#ifndef _LINUX_VIRTIO_9P_H +#define _LINUX_VIRTIO_9P_H +/* This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. */ +#include + +/* The ID for virtio console */ +#define VIRTIO_ID_9P 9 +/* Maximum number of virtio channels per partition (1 for now) */ +#define MAX_9P_CHAN 1 + +#endif /* _LINUX_VIRTIO_9P_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_balloon.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_balloon.h new file mode 100644 index 0000000..8726ff7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_balloon.h @@ -0,0 +1,23 @@ +#ifndef _LINUX_VIRTIO_BALLOON_H +#define _LINUX_VIRTIO_BALLOON_H +/* This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. */ +#include + +/* The ID for virtio_balloon */ +#define VIRTIO_ID_BALLOON 5 + +/* The feature bitmap for virtio balloon */ +#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ + +/* Size of a PFN in the balloon interface. */ +#define VIRTIO_BALLOON_PFN_SHIFT 12 + +struct virtio_balloon_config +{ + /* Number of pages host wants Guest to give up. */ + __le32 num_pages; + /* Number of pages we've actually got in balloon. */ + __le32 actual; +}; +#endif /* _LINUX_VIRTIO_BALLOON_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_blk.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_blk.h new file mode 100644 index 0000000..94c56d2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_blk.h @@ -0,0 +1,62 @@ +#ifndef _LINUX_VIRTIO_BLK_H +#define _LINUX_VIRTIO_BLK_H +/* This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. */ +#include +#include + +/* The ID for virtio_block */ +#define VIRTIO_ID_BLOCK 2 + +/* Feature bits */ +#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ +#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ +#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ +#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ +#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ +#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ + +struct virtio_blk_config +{ + /* The capacity (in 512-byte sectors). */ + __u64 capacity; + /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ + __u32 size_max; + /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ + __u32 seg_max; + /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ + struct virtio_blk_geometry { + __u16 cylinders; + __u8 heads; + __u8 sectors; + } geometry; + /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ + __u32 blk_size; +} __attribute__((packed)); + +/* These two define direction. */ +#define VIRTIO_BLK_T_IN 0 +#define VIRTIO_BLK_T_OUT 1 + +/* This bit says it's a scsi command, not an actual read or write. */ +#define VIRTIO_BLK_T_SCSI_CMD 2 + +/* Barrier before this op. */ +#define VIRTIO_BLK_T_BARRIER 0x80000000 + +/* This is the first element of the read scatter-gather list. */ +struct virtio_blk_outhdr +{ + /* VIRTIO_BLK_T* */ + __u32 type; + /* io priority. */ + __u32 ioprio; + /* Sector (ie. 512 byte offset) */ + __u64 sector; +}; + +/* And this is the final byte of the write scatter-gather list. */ +#define VIRTIO_BLK_S_OK 0 +#define VIRTIO_BLK_S_IOERR 1 +#define VIRTIO_BLK_S_UNSUPP 2 +#endif /* _LINUX_VIRTIO_BLK_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_config.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_config.h new file mode 100644 index 0000000..26f45f1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_config.h @@ -0,0 +1,31 @@ +#ifndef _LINUX_VIRTIO_CONFIG_H +#define _LINUX_VIRTIO_CONFIG_H +/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so + * anyone can use the definitions to implement compatible drivers/servers. */ + +/* Virtio devices use a standardized configuration space to define their + * features and pass configuration information, but each implementation can + * store and access that space differently. */ +#include + +/* Status byte for guest to report progress, and synchronize features. */ +/* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */ +#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 +/* We have found a driver for the device. */ +#define VIRTIO_CONFIG_S_DRIVER 2 +/* Driver has used its parts of the config, and is happy */ +#define VIRTIO_CONFIG_S_DRIVER_OK 4 +/* We've given up on this device. */ +#define VIRTIO_CONFIG_S_FAILED 0x80 + +/* Some virtio feature bits (currently bits 28 through 31) are reserved for the + * transport being used (eg. virtio_ring), the rest are per-device feature + * bits. */ +#define VIRTIO_TRANSPORT_F_START 28 +#define VIRTIO_TRANSPORT_F_END 32 + +/* Do we get callbacks when the ring is completely used, even if we've + * suppressed them? */ +#define VIRTIO_F_NOTIFY_ON_EMPTY 24 + +#endif /* _LINUX_VIRTIO_CONFIG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_console.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_console.h new file mode 100644 index 0000000..06d638d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_console.h @@ -0,0 +1,23 @@ +#ifndef _LINUX_VIRTIO_CONSOLE_H +#define _LINUX_VIRTIO_CONSOLE_H +#include +#include +/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so + * anyone can use the definitions to implement compatible drivers/servers. */ + +/* The ID for virtio console */ +#define VIRTIO_ID_CONSOLE 3 + +/* Feature bits */ +#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ + +struct virtio_console_config { + /* colums of the screens */ + __u16 cols; + /* rows of the screens */ + __u16 rows; +} __attribute__((packed)); + + + +#endif /* _LINUX_VIRTIO_CONSOLE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_net.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_net.h new file mode 100644 index 0000000..cec79ad --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_net.h @@ -0,0 +1,129 @@ +#ifndef _LINUX_VIRTIO_NET_H +#define _LINUX_VIRTIO_NET_H +/* This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. */ +#include +#include +#include + +/* The ID for virtio_net */ +#define VIRTIO_ID_NET 1 + +/* The feature bitmap for virtio net */ +#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ +#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ +#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ +#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ +#define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ +#define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ +#define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */ +#define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */ +#define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */ +#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ +#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ +#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ +#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ +#define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */ +#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */ +#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ +#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ + +#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ + +struct virtio_net_config +{ + /* The config defining mac address (if VIRTIO_NET_F_MAC) */ + __u8 mac[6]; + /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ + __u16 status; +} __attribute__((packed)); + +/* This is the first element of the scatter-gather list. If you don't + * specify GSO or CSUM features, you can simply ignore the header. */ +struct virtio_net_hdr +{ +#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset + __u8 flags; +#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame +#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) +#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) +#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP +#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set + __u8 gso_type; + __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ + __u16 gso_size; /* Bytes to append to hdr_len per frame */ + __u16 csum_start; /* Position to start checksumming from */ + __u16 csum_offset; /* Offset after that to place checksum */ +}; + +/* This is the version of the header to use when the MRG_RXBUF + * feature has been negotiated. */ +struct virtio_net_hdr_mrg_rxbuf { + struct virtio_net_hdr hdr; + __u16 num_buffers; /* Number of merged rx buffers */ +}; + +/* + * Control virtqueue data structures + * + * The control virtqueue expects a header in the first sg entry + * and an ack/status response in the last entry. Data for the + * command goes in between. + */ +struct virtio_net_ctrl_hdr { + __u8 class; + __u8 cmd; +} __attribute__((packed)); + +typedef __u8 virtio_net_ctrl_ack; + +#define VIRTIO_NET_OK 0 +#define VIRTIO_NET_ERR 1 + +/* + * Control the RX mode, ie. promisucous and allmulti. PROMISC and + * ALLMULTI commands require an "out" sg entry containing a 1 byte + * state value, zero = disable, non-zero = enable. These commands + * are supported with the VIRTIO_NET_F_CTRL_RX feature. + */ +#define VIRTIO_NET_CTRL_RX 0 + #define VIRTIO_NET_CTRL_RX_PROMISC 0 + #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 + +/* + * Control the MAC filter table. + * + * The MAC filter table is managed by the hypervisor, the guest should + * assume the size is infinite. Filtering should be considered + * non-perfect, ie. based on hypervisor resources, the guest may + * received packets from sources not specified in the filter list. + * + * In addition to the class/cmd header, the TABLE_SET command requires + * two out scatterlists. Each contains a 4 byte count of entries followed + * by a concatenated byte stream of the ETH_ALEN MAC addresses. The + * first sg list contains unicast addresses, the second is for multicast. + * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature + * is available. + */ +struct virtio_net_ctrl_mac { + __u32 entries; + __u8 macs[][ETH_ALEN]; +} __attribute__((packed)); + +#define VIRTIO_NET_CTRL_MAC 1 + #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 + +/* + * Control VLAN filtering + * + * The VLAN filter table is controlled via a simple ADD/DEL interface. + * VLAN IDs not added may be filterd by the hypervisor. Del is the + * opposite of add. Both commands expect an out entry containing a 2 + * byte VLAN ID. VLAN filterting is available with the + * VIRTIO_NET_F_CTRL_VLAN feature bit. + */ +#define VIRTIO_NET_CTRL_VLAN 2 + #define VIRTIO_NET_CTRL_VLAN_ADD 0 + #define VIRTIO_NET_CTRL_VLAN_DEL 1 + +#endif /* _LINUX_VIRTIO_NET_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_pci.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_pci.h new file mode 100644 index 0000000..cd0fd5d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_pci.h @@ -0,0 +1,64 @@ +/* + * Virtio PCI driver + * + * This module allows virtio devices to be used over a virtual PCI device. + * This can be used with QEMU based VMMs like KVM or Xen. + * + * Copyright IBM Corp. 2007 + * + * Authors: + * Anthony Liguori + * + * This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + */ + +#ifndef _LINUX_VIRTIO_PCI_H +#define _LINUX_VIRTIO_PCI_H + +#include + +/* A 32-bit r/o bitmask of the features supported by the host */ +#define VIRTIO_PCI_HOST_FEATURES 0 + +/* A 32-bit r/w bitmask of features activated by the guest */ +#define VIRTIO_PCI_GUEST_FEATURES 4 + +/* A 32-bit r/w PFN for the currently selected queue */ +#define VIRTIO_PCI_QUEUE_PFN 8 + +/* A 16-bit r/o queue size for the currently selected queue */ +#define VIRTIO_PCI_QUEUE_NUM 12 + +/* A 16-bit r/w queue selector */ +#define VIRTIO_PCI_QUEUE_SEL 14 + +/* A 16-bit r/w queue notifier */ +#define VIRTIO_PCI_QUEUE_NOTIFY 16 + +/* An 8-bit device status register. */ +#define VIRTIO_PCI_STATUS 18 + +/* An 8-bit r/o interrupt status register. Reading the value will return the + * current contents of the ISR and will also clear it. This is effectively + * a read-and-acknowledge. */ +#define VIRTIO_PCI_ISR 19 + +/* The bit of the ISR which indicates a device configuration change. */ +#define VIRTIO_PCI_ISR_CONFIG 0x2 + +/* The remaining space is defined by each driver as the per-driver + * configuration space */ +#define VIRTIO_PCI_CONFIG 20 + +/* Virtio ABI version, this must match exactly */ +#define VIRTIO_PCI_ABI_VERSION 0 + +/* How many bits to shift physical queue address written to QUEUE_PFN. + * 12 is historical, and due to x86 page size. */ +#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12 + +/* The alignment to use between consumer and producer parts of vring. + * x86 pagesize again. */ +#define VIRTIO_PCI_VRING_ALIGN 4096 +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_ring.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_ring.h new file mode 100644 index 0000000..6bb00c6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_ring.h @@ -0,0 +1,112 @@ +#ifndef _LINUX_VIRTIO_RING_H +#define _LINUX_VIRTIO_RING_H +/* An interface for efficient virtio implementation, currently for use by KVM + * and lguest, but hopefully others soon. Do NOT change this since it will + * break existing servers and clients. + * + * This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + * + * Copyright Rusty Russell IBM Corporation 2007. */ +#include + +/* This marks a buffer as continuing via the next field. */ +#define VRING_DESC_F_NEXT 1 +/* This marks a buffer as write-only (otherwise read-only). */ +#define VRING_DESC_F_WRITE 2 + +/* The Host uses this in used->flags to advise the Guest: don't kick me when + * you add a buffer. It's unreliable, so it's simply an optimization. Guest + * will still kick if it's out of buffers. */ +#define VRING_USED_F_NO_NOTIFY 1 +/* The Guest uses this in avail->flags to advise the Host: don't interrupt me + * when you consume a buffer. It's unreliable, so it's simply an + * optimization. */ +#define VRING_AVAIL_F_NO_INTERRUPT 1 + +/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ +struct vring_desc +{ + /* Address (guest-physical). */ + __u64 addr; + /* Length. */ + __u32 len; + /* The flags as indicated above. */ + __u16 flags; + /* We chain unused descriptors via this, too */ + __u16 next; +}; + +struct vring_avail +{ + __u16 flags; + __u16 idx; + __u16 ring[]; +}; + +/* u32 is used here for ids for padding reasons. */ +struct vring_used_elem +{ + /* Index of start of used descriptor chain. */ + __u32 id; + /* Total length of the descriptor chain which was used (written to) */ + __u32 len; +}; + +struct vring_used +{ + __u16 flags; + __u16 idx; + struct vring_used_elem ring[]; +}; + +struct vring { + unsigned int num; + + struct vring_desc *desc; + + struct vring_avail *avail; + + struct vring_used *used; +}; + +/* The standard layout for the ring is a continuous chunk of memory which looks + * like this. We assume num is a power of 2. + * + * struct vring + * { + * // The actual descriptors (16 bytes each) + * struct vring_desc desc[num]; + * + * // A ring of available descriptor heads with free-running index. + * __u16 avail_flags; + * __u16 avail_idx; + * __u16 available[num]; + * + * // Padding to the next align boundary. + * char pad[]; + * + * // A ring of used descriptor heads with free-running index. + * __u16 used_flags; + * __u16 used_idx; + * struct vring_used_elem used[num]; + * }; + */ +static __inline__ void vring_init(struct vring *vr, unsigned int num, void *p, + unsigned long align) +{ + vr->num = num; + vr->desc = p; + vr->avail = p + num*sizeof(struct vring_desc); + vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + align-1) + & ~(align - 1)); +} + +static __inline__ unsigned vring_size(unsigned int num, unsigned long align) +{ + return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) + + align - 1) & ~(align - 1)) + + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num; +} + +#endif /* _LINUX_VIRTIO_RING_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_rng.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_rng.h new file mode 100644 index 0000000..1a85dab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/virtio_rng.h @@ -0,0 +1,10 @@ +#ifndef _LINUX_VIRTIO_RNG_H +#define _LINUX_VIRTIO_RNG_H +/* This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. */ +#include + +/* The ID for virtio_rng */ +#define VIRTIO_ID_RNG 4 + +#endif /* _LINUX_VIRTIO_RNG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/vt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/vt.h new file mode 100644 index 0000000..bbf9f8e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/vt.h @@ -0,0 +1,66 @@ +#ifndef _LINUX_VT_H +#define _LINUX_VT_H + + +/* + * These constants are also useful for user-level apps (e.g., VC + * resizing). + */ +#define MIN_NR_CONSOLES 1 /* must be at least 1 */ +#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */ +#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */ + /* Note: the ioctl VT_GETSTATE does not work for + consoles 16 and higher (since it returns a short) */ + +/* 0x56 is 'V', to avoid collision with termios and kd */ + +#define VT_OPENQRY 0x5600 /* find available vt */ + +struct vt_mode { + char mode; /* vt mode */ + char waitv; /* if set, hang on writes if not active */ + short relsig; /* signal to raise on release req */ + short acqsig; /* signal to raise on acquisition */ + short frsig; /* unused (set to 0) */ +}; +#define VT_GETMODE 0x5601 /* get mode of active vt */ +#define VT_SETMODE 0x5602 /* set mode of active vt */ +#define VT_AUTO 0x00 /* auto vt switching */ +#define VT_PROCESS 0x01 /* process controls switching */ +#define VT_ACKACQ 0x02 /* acknowledge switch */ + +struct vt_stat { + unsigned short v_active; /* active vt */ + unsigned short v_signal; /* signal to send */ + unsigned short v_state; /* vt bitmask */ +}; +#define VT_GETSTATE 0x5603 /* get global vt state info */ +#define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */ + +#define VT_RELDISP 0x5605 /* release display */ + +#define VT_ACTIVATE 0x5606 /* make vt active */ +#define VT_WAITACTIVE 0x5607 /* wait for vt active */ +#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ + +struct vt_sizes { + unsigned short v_rows; /* number of rows */ + unsigned short v_cols; /* number of columns */ + unsigned short v_scrollsize; /* number of lines of scrollback */ +}; +#define VT_RESIZE 0x5609 /* set kernel's idea of screensize */ + +struct vt_consize { + unsigned short v_rows; /* number of rows */ + unsigned short v_cols; /* number of columns */ + unsigned short v_vlin; /* number of pixel rows on screen */ + unsigned short v_clin; /* number of pixel rows per character */ + unsigned short v_vcol; /* number of pixel columns on screen */ + unsigned short v_ccol; /* number of pixel columns per character */ +}; +#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */ +#define VT_LOCKSWITCH 0x560B /* disallow vt switching */ +#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ +#define VT_GETHIFONTMASK 0x560D /* return hi font mask */ + +#endif /* _LINUX_VT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wait.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wait.h new file mode 100644 index 0000000..03dbdc2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wait.h @@ -0,0 +1,21 @@ +#ifndef _LINUX_WAIT_H +#define _LINUX_WAIT_H + +#define WNOHANG 0x00000001 +#define WUNTRACED 0x00000002 +#define WSTOPPED WUNTRACED +#define WEXITED 0x00000004 +#define WCONTINUED 0x00000008 +#define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ + +#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */ +#define __WALL 0x40000000 /* Wait on all children, regardless of type */ +#define __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */ + +/* First argument to waitid: */ +#define P_ALL 0 +#define P_PID 1 +#define P_PGID 2 + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wanrouter.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wanrouter.h new file mode 100644 index 0000000..45615ab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wanrouter.h @@ -0,0 +1,452 @@ +/***************************************************************************** +* wanrouter.h Definitions for the WAN Multiprotocol Router Module. +* This module provides API and common services for WAN Link +* Drivers and is completely hardware-independent. +* +* Author: Nenad Corbic +* Gideon Hack +* Additions: Arnaldo Melo +* +* Copyright: (c) 1995-2000 Sangoma Technologies Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* Jul 21, 2000 Nenad Corbic Added WAN_FT1_READY State +* Feb 24, 2000 Nenad Corbic Added support for socket based x25api +* Jan 28, 2000 Nenad Corbic Added support for the ASYNC protocol. +* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release +* Jun 02, 1999 Gideon Hack Added support for the S514 adapter. +* May 23, 1999 Arnaldo Melo Added local_addr to wanif_conf_t +* WAN_DISCONNECTING state added +* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t' +* Jun 12, 1998 David Fong Added Cisco HDLC support. +* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to +* 'wanif_conf_t' +* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t' +* Added 'authenticator' to 'wan_ppp_conf_t' +* Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0 +* Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t' +* Added 'enable_IPX' and 'network_number' to +* 'wan_device_t'. Also added defines for +* UDP PACKET TYPE, Interrupt test, critical values +* for RACE conditions. +* Oct 05, 1997 Jaspreet Singh Added 'dlci_num' and 'dlci[100]' to +* 'wan_fr_conf_t' to configure a list of dlci(s) +* for a NODE +* Jul 07, 1997 Jaspreet Singh Added 'ttl' to 'wandev_conf_t' & 'wan_device_t' +* May 29, 1997 Jaspreet Singh Added 'tx_int_enabled' to 'wan_device_t' +* May 21, 1997 Jaspreet Singh Added 'udp_port' to 'wan_device_t' +* Apr 25, 1997 Farhan Thawar Added 'udp_port' to 'wandev_conf_t' +* Jan 16, 1997 Gene Kozin router_devlist made public +* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h). +*****************************************************************************/ + +#ifndef _ROUTER_H +#define _ROUTER_H + +#define ROUTER_NAME "wanrouter" /* in case we ever change it */ +#define ROUTER_VERSION 1 /* version number */ +#define ROUTER_RELEASE 1 /* release (minor version) number */ +#define ROUTER_IOCTL 'W' /* for IOCTL calls */ +#define ROUTER_MAGIC 0x524D4157L /* signature: 'WANR' reversed */ + +/* IOCTL codes for /proc/router/ entries (up to 255) */ +enum router_ioctls +{ + ROUTER_SETUP = ROUTER_IOCTL<<8, /* configure device */ + ROUTER_DOWN, /* shut down device */ + ROUTER_STAT, /* get device status */ + ROUTER_IFNEW, /* add interface */ + ROUTER_IFDEL, /* delete interface */ + ROUTER_IFSTAT, /* get interface status */ + ROUTER_USER = (ROUTER_IOCTL<<8)+16, /* driver-specific calls */ + ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31 +}; + +/* identifiers for displaying proc file data for dual port adapters */ +#define PROC_DATA_PORT_0 0x8000 /* the data is for port 0 */ +#define PROC_DATA_PORT_1 0x8001 /* the data is for port 1 */ + +/* NLPID for packet encapsulation (ISO/IEC TR 9577) */ +#define NLPID_IP 0xCC /* Internet Protocol Datagram */ +#define NLPID_SNAP 0x80 /* IEEE Subnetwork Access Protocol */ +#define NLPID_CLNP 0x81 /* ISO/IEC 8473 */ +#define NLPID_ESIS 0x82 /* ISO/IEC 9542 */ +#define NLPID_ISIS 0x83 /* ISO/IEC ISIS */ +#define NLPID_Q933 0x08 /* CCITT Q.933 */ + +/* Miscellaneous */ +#define WAN_IFNAME_SZ 15 /* max length of the interface name */ +#define WAN_DRVNAME_SZ 15 /* max length of the link driver name */ +#define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */ +#define USED_BY_FIELD 8 /* max length of the used by field */ + +/* Defines for UDP PACKET TYPE */ +#define UDP_PTPIPE_TYPE 0x01 +#define UDP_FPIPE_TYPE 0x02 +#define UDP_CPIPE_TYPE 0x03 +#define UDP_DRVSTATS_TYPE 0x04 +#define UDP_INVALID_TYPE 0x05 + +/* Command return code */ +#define CMD_OK 0 /* normal firmware return code */ +#define CMD_TIMEOUT 0xFF /* firmware command timed out */ + +/* UDP Packet Management */ +#define UDP_PKT_FRM_STACK 0x00 +#define UDP_PKT_FRM_NETWORK 0x01 + +/* Maximum interrupt test counter */ +#define MAX_INTR_TEST_COUNTER 100 + +/* Critical Values for RACE conditions*/ +#define CRITICAL_IN_ISR 0xA1 +#define CRITICAL_INTR_HANDLED 0xB1 + +/****** Data Types **********************************************************/ + +/*---------------------------------------------------------------------------- + * X.25-specific link-level configuration. + */ +typedef struct wan_x25_conf +{ + unsigned lo_pvc; /* lowest permanent circuit number */ + unsigned hi_pvc; /* highest permanent circuit number */ + unsigned lo_svc; /* lowest switched circuit number */ + unsigned hi_svc; /* highest switched circuit number */ + unsigned hdlc_window; /* HDLC window size (1..7) */ + unsigned pkt_window; /* X.25 packet window size (1..7) */ + unsigned t1; /* HDLC timer T1, sec (1..30) */ + unsigned t2; /* HDLC timer T2, sec (0..29) */ + unsigned t4; /* HDLC supervisory frame timer = T4 * T1 */ + unsigned n2; /* HDLC retransmission limit (1..30) */ + unsigned t10_t20; /* X.25 RESTART timeout, sec (1..255) */ + unsigned t11_t21; /* X.25 CALL timeout, sec (1..255) */ + unsigned t12_t22; /* X.25 RESET timeout, sec (1..255) */ + unsigned t13_t23; /* X.25 CLEAR timeout, sec (1..255) */ + unsigned t16_t26; /* X.25 INTERRUPT timeout, sec (1..255) */ + unsigned t28; /* X.25 REGISTRATION timeout, sec (1..255) */ + unsigned r10_r20; /* RESTART retransmission limit (0..250) */ + unsigned r12_r22; /* RESET retransmission limit (0..250) */ + unsigned r13_r23; /* CLEAR retransmission limit (0..250) */ + unsigned ccitt_compat; /* compatibility mode: 1988/1984/1980 */ + unsigned x25_conf_opt; /* User defined x25 config optoins */ + unsigned char LAPB_hdlc_only; /* Run in HDLC only mode */ + unsigned char logging; /* Control connection logging */ + unsigned char oob_on_modem; /* Whether to send modem status to the user app */ +} wan_x25_conf_t; + +/*---------------------------------------------------------------------------- + * Frame relay specific link-level configuration. + */ +typedef struct wan_fr_conf +{ + unsigned signalling; /* local in-channel signalling type */ + unsigned t391; /* link integrity verification timer */ + unsigned t392; /* polling verification timer */ + unsigned n391; /* full status polling cycle counter */ + unsigned n392; /* error threshold counter */ + unsigned n393; /* monitored events counter */ + unsigned dlci_num; /* number of DLCs (access node) */ + unsigned dlci[100]; /* List of all DLCIs */ +} wan_fr_conf_t; + +/*---------------------------------------------------------------------------- + * PPP-specific link-level configuration. + */ +typedef struct wan_ppp_conf +{ + unsigned restart_tmr; /* restart timer */ + unsigned auth_rsrt_tmr; /* authentication timer */ + unsigned auth_wait_tmr; /* authentication timer */ + unsigned mdm_fail_tmr; /* modem failure timer */ + unsigned dtr_drop_tmr; /* DTR drop timer */ + unsigned connect_tmout; /* connection timeout */ + unsigned conf_retry; /* max. retry */ + unsigned term_retry; /* max. retry */ + unsigned fail_retry; /* max. retry */ + unsigned auth_retry; /* max. retry */ + unsigned auth_options; /* authentication opt. */ + unsigned ip_options; /* IP options */ + char authenticator; /* AUTHENTICATOR or not */ + char ip_mode; /* Static/Host/Peer */ +} wan_ppp_conf_t; + +/*---------------------------------------------------------------------------- + * CHDLC-specific link-level configuration. + */ +typedef struct wan_chdlc_conf +{ + unsigned char ignore_dcd; /* Protocol options: */ + unsigned char ignore_cts; /* Ignore these to determine */ + unsigned char ignore_keepalive; /* link status (Yes or No) */ + unsigned char hdlc_streaming; /* hdlc_streaming mode (Y/N) */ + unsigned char receive_only; /* no transmit buffering (Y/N) */ + unsigned keepalive_tx_tmr; /* transmit keepalive timer */ + unsigned keepalive_rx_tmr; /* receive keepalive timer */ + unsigned keepalive_err_margin; /* keepalive_error_tolerance */ + unsigned slarp_timer; /* SLARP request timer */ +} wan_chdlc_conf_t; + + +/*---------------------------------------------------------------------------- + * WAN device configuration. Passed to ROUTER_SETUP IOCTL. + */ +typedef struct wandev_conf +{ + unsigned magic; /* magic number (for verification) */ + unsigned config_id; /* configuration structure identifier */ + /****** hardware configuration ******/ + unsigned ioport; /* adapter I/O port base */ + unsigned long maddr; /* dual-port memory address */ + unsigned msize; /* dual-port memory size */ + int irq; /* interrupt request level */ + int dma; /* DMA request level */ + char S514_CPU_no[1]; /* S514 PCI adapter CPU number ('A' or 'B') */ + unsigned PCI_slot_no; /* S514 PCI adapter slot number */ + char auto_pci_cfg; /* S515 PCI automatic slot detection */ + char comm_port; /* Communication Port (PRI=0, SEC=1) */ + unsigned bps; /* data transfer rate */ + unsigned mtu; /* maximum transmit unit size */ + unsigned udp_port; /* UDP port for management */ + unsigned char ttl; /* Time To Live for UDP security */ + unsigned char ft1; /* FT1 Configurator Option */ + char interface; /* RS-232/V.35, etc. */ + char clocking; /* external/internal */ + char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ + char station; /* DTE/DCE, primary/secondary, etc. */ + char connection; /* permanent/switched/on-demand */ + char read_mode; /* read mode: Polling or interrupt */ + char receive_only; /* disable tx buffers */ + char tty; /* Create a fake tty device */ + unsigned tty_major; /* Major number for wanpipe tty device */ + unsigned tty_minor; /* Minor number for wanpipe tty device */ + unsigned tty_mode; /* TTY operation mode SYNC or ASYNC */ + char backup; /* Backup Mode */ + unsigned hw_opt[4]; /* other hardware options */ + unsigned reserved[4]; + /****** arbitrary data ***************/ + unsigned data_size; /* data buffer size */ + void* data; /* data buffer, e.g. firmware */ + union /****** protocol-specific ************/ + { + wan_x25_conf_t x25; /* X.25 configuration */ + wan_ppp_conf_t ppp; /* PPP configuration */ + wan_fr_conf_t fr; /* frame relay configuration */ + wan_chdlc_conf_t chdlc; /* Cisco HDLC configuration */ + } u; +} wandev_conf_t; + +/* 'config_id' definitions */ +#define WANCONFIG_X25 101 /* X.25 link */ +#define WANCONFIG_FR 102 /* frame relay link */ +#define WANCONFIG_PPP 103 /* synchronous PPP link */ +#define WANCONFIG_CHDLC 104 /* Cisco HDLC Link */ +#define WANCONFIG_BSC 105 /* BiSync Streaming */ +#define WANCONFIG_HDLC 106 /* HDLC Support */ +#define WANCONFIG_MPPP 107 /* Multi Port PPP over RAW CHDLC */ + +/* + * Configuration options defines. + */ +/* general options */ +#define WANOPT_OFF 0 +#define WANOPT_ON 1 +#define WANOPT_NO 0 +#define WANOPT_YES 1 + +/* intercace options */ +#define WANOPT_RS232 0 +#define WANOPT_V35 1 + +/* data encoding options */ +#define WANOPT_NRZ 0 +#define WANOPT_NRZI 1 +#define WANOPT_FM0 2 +#define WANOPT_FM1 3 + +/* link type options */ +#define WANOPT_POINTTOPOINT 0 /* RTS always active */ +#define WANOPT_MULTIDROP 1 /* RTS is active when transmitting */ + +/* clocking options */ +#define WANOPT_EXTERNAL 0 +#define WANOPT_INTERNAL 1 + +/* station options */ +#define WANOPT_DTE 0 +#define WANOPT_DCE 1 +#define WANOPT_CPE 0 +#define WANOPT_NODE 1 +#define WANOPT_SECONDARY 0 +#define WANOPT_PRIMARY 1 + +/* connection options */ +#define WANOPT_PERMANENT 0 /* DTR always active */ +#define WANOPT_SWITCHED 1 /* use DTR to setup link (dial-up) */ +#define WANOPT_ONDEMAND 2 /* activate DTR only before sending */ + +/* frame relay in-channel signalling */ +#define WANOPT_FR_ANSI 1 /* ANSI T1.617 Annex D */ +#define WANOPT_FR_Q933 2 /* ITU Q.933A */ +#define WANOPT_FR_LMI 3 /* LMI */ + +/* PPP IP Mode Options */ +#define WANOPT_PPP_STATIC 0 +#define WANOPT_PPP_HOST 1 +#define WANOPT_PPP_PEER 2 + +/* ASY Mode Options */ +#define WANOPT_ONE 1 +#define WANOPT_TWO 2 +#define WANOPT_ONE_AND_HALF 3 + +#define WANOPT_NONE 0 +#define WANOPT_ODD 1 +#define WANOPT_EVEN 2 + +/* CHDLC Protocol Options */ +/* DF Commmented out for now. + +#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT +#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT +#define WANOPT_CHDLC_NO_KEEPALIVE IGNORE_KPALV_FOR_LINK_STAT +*/ + +/* Port options */ +#define WANOPT_PRI 0 +#define WANOPT_SEC 1 +/* read mode */ +#define WANOPT_INTR 0 +#define WANOPT_POLL 1 + + +#define WANOPT_TTY_SYNC 0 +#define WANOPT_TTY_ASYNC 1 +/*---------------------------------------------------------------------------- + * WAN Link Status Info (for ROUTER_STAT IOCTL). + */ +typedef struct wandev_stat +{ + unsigned state; /* link state */ + unsigned ndev; /* number of configured interfaces */ + + /* link/interface configuration */ + unsigned connection; /* permanent/switched/on-demand */ + unsigned media_type; /* Frame relay/PPP/X.25/SDLC, etc. */ + unsigned mtu; /* max. transmit unit for this device */ + + /* physical level statistics */ + unsigned modem_status; /* modem status */ + unsigned rx_frames; /* received frames count */ + unsigned rx_overruns; /* receiver overrun error count */ + unsigned rx_crc_err; /* receive CRC error count */ + unsigned rx_aborts; /* received aborted frames count */ + unsigned rx_bad_length; /* unexpetedly long/short frames count */ + unsigned rx_dropped; /* frames discarded at device level */ + unsigned tx_frames; /* transmitted frames count */ + unsigned tx_underruns; /* aborted transmissions (underruns) count */ + unsigned tx_timeouts; /* transmission timeouts */ + unsigned tx_rejects; /* other transmit errors */ + + /* media level statistics */ + unsigned rx_bad_format; /* frames with invalid format */ + unsigned rx_bad_addr; /* frames with invalid media address */ + unsigned tx_retries; /* frames re-transmitted */ + unsigned reserved[16]; /* reserved for future use */ +} wandev_stat_t; + +/* 'state' defines */ +enum wan_states +{ + WAN_UNCONFIGURED, /* link/channel is not configured */ + WAN_DISCONNECTED, /* link/channel is disconnected */ + WAN_CONNECTING, /* connection is in progress */ + WAN_CONNECTED, /* link/channel is operational */ + WAN_LIMIT, /* for verification only */ + WAN_DUALPORT, /* for Dual Port cards */ + WAN_DISCONNECTING, + WAN_FT1_READY /* FT1 Configurator Ready */ +}; + +enum { + WAN_LOCAL_IP, + WAN_POINTOPOINT_IP, + WAN_NETMASK_IP, + WAN_BROADCAST_IP +}; + +/* 'modem_status' masks */ +#define WAN_MODEM_CTS 0x0001 /* CTS line active */ +#define WAN_MODEM_DCD 0x0002 /* DCD line active */ +#define WAN_MODEM_DTR 0x0010 /* DTR line active */ +#define WAN_MODEM_RTS 0x0020 /* RTS line active */ + +/*---------------------------------------------------------------------------- + * WAN interface (logical channel) configuration (for ROUTER_IFNEW IOCTL). + */ +typedef struct wanif_conf +{ + unsigned magic; /* magic number */ + unsigned config_id; /* configuration identifier */ + char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */ + char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */ + char usedby[USED_BY_FIELD]; /* used by API or WANPIPE */ + unsigned idle_timeout; /* sec, before disconnecting */ + unsigned hold_timeout; /* sec, before re-connecting */ + unsigned cir; /* Committed Information Rate fwd,bwd*/ + unsigned bc; /* Committed Burst Size fwd, bwd */ + unsigned be; /* Excess Burst Size fwd, bwd */ + unsigned char enable_IPX; /* Enable or Disable IPX */ + unsigned char inarp; /* Send Inverse ARP requests Y/N */ + unsigned inarp_interval; /* sec, between InARP requests */ + unsigned long network_number; /* Network Number for IPX */ + char mc; /* Multicast on or off */ + char local_addr[WAN_ADDRESS_SZ+1];/* local media address, ASCIIZ */ + unsigned char port; /* board port */ + unsigned char protocol; /* prococol used in this channel (TCPOX25 or X25) */ + char pap; /* PAP enabled or disabled */ + char chap; /* CHAP enabled or disabled */ + unsigned char userid[511]; /* List of User Id */ + unsigned char passwd[511]; /* List of passwords */ + unsigned char sysname[31]; /* Name of the system */ + unsigned char ignore_dcd; /* Protocol options: */ + unsigned char ignore_cts; /* Ignore these to determine */ + unsigned char ignore_keepalive; /* link status (Yes or No) */ + unsigned char hdlc_streaming; /* Hdlc streaming mode (Y/N) */ + unsigned keepalive_tx_tmr; /* transmit keepalive timer */ + unsigned keepalive_rx_tmr; /* receive keepalive timer */ + unsigned keepalive_err_margin; /* keepalive_error_tolerance */ + unsigned slarp_timer; /* SLARP request timer */ + unsigned char ttl; /* Time To Live for UDP security */ + char interface; /* RS-232/V.35, etc. */ + char clocking; /* external/internal */ + unsigned bps; /* data transfer rate */ + unsigned mtu; /* maximum transmit unit size */ + unsigned char if_down; /* brind down interface when disconnected */ + unsigned char gateway; /* Is this interface a gateway */ + unsigned char true_if_encoding; /* Set the dev->type to true board protocol */ + + unsigned char asy_data_trans; /* async API options */ + unsigned char rts_hs_for_receive; /* async Protocol options */ + unsigned char xon_xoff_hs_for_receive; + unsigned char xon_xoff_hs_for_transmit; + unsigned char dcd_hs_for_transmit; + unsigned char cts_hs_for_transmit; + unsigned char async_mode; + unsigned tx_bits_per_char; + unsigned rx_bits_per_char; + unsigned stop_bits; + unsigned char parity; + unsigned break_timer; + unsigned inter_char_timer; + unsigned rx_complete_length; + unsigned xon_char; + unsigned xoff_char; + unsigned char receive_only; /* no transmit buffering (Y/N) */ +} wanif_conf_t; + +#endif /* _ROUTER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/watchdog.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/watchdog.h new file mode 100644 index 0000000..5bc0c62 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/watchdog.h @@ -0,0 +1,55 @@ +/* + * Generic watchdog defines. Derived from.. + * + * Berkshire PC Watchdog Defines + * by Ken Hollis + * + */ + +#ifndef _LINUX_WATCHDOG_H +#define _LINUX_WATCHDOG_H + +#include +#include + +#define WATCHDOG_IOCTL_BASE 'W' + +struct watchdog_info { + __u32 options; /* Options the card/driver supports */ + __u32 firmware_version; /* Firmware version of the card */ + __u8 identity[32]; /* Identity of the board */ +}; + +#define WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info) +#define WDIOC_GETSTATUS _IOR(WATCHDOG_IOCTL_BASE, 1, int) +#define WDIOC_GETBOOTSTATUS _IOR(WATCHDOG_IOCTL_BASE, 2, int) +#define WDIOC_GETTEMP _IOR(WATCHDOG_IOCTL_BASE, 3, int) +#define WDIOC_SETOPTIONS _IOR(WATCHDOG_IOCTL_BASE, 4, int) +#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) +#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) +#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) +#define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int) +#define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int) +#define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int) + +#define WDIOF_UNKNOWN -1 /* Unknown flag error */ +#define WDIOS_UNKNOWN -1 /* Unknown status error */ + +#define WDIOF_OVERHEAT 0x0001 /* Reset due to CPU overheat */ +#define WDIOF_FANFAULT 0x0002 /* Fan failed */ +#define WDIOF_EXTERN1 0x0004 /* External relay 1 */ +#define WDIOF_EXTERN2 0x0008 /* External relay 2 */ +#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ +#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ +#define WDIOF_POWEROVER 0x0040 /* Power over voltage */ +#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ +#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ +#define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */ +#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ + +#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ +#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ +#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ + + +#endif /* ifndef _LINUX_WATCHDOG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax.h new file mode 100644 index 0000000..c89de7f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax.h @@ -0,0 +1,234 @@ +/* + * Linux WiMax + * API for user space + * + * + * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Intel Corporation + * Inaky Perez-Gonzalez + * - Initial implementation + * + * + * This file declares the user/kernel protocol that is spoken over + * Generic Netlink, as well as any type declaration that is to be used + * by kernel and user space. + * + * It is intended for user space to clone it verbatim to use it as a + * primary reference for definitions. + * + * Stuff intended for kernel usage as well as full protocol and stack + * documentation is rooted in include/net/wimax.h. + */ + +#ifndef __LINUX__WIMAX_H__ +#define __LINUX__WIMAX_H__ + +#include + +enum { + /** + * Version of the interface (unsigned decimal, MMm, max 25.5) + * M - Major: change if removing or modifying an existing call. + * m - minor: change when adding a new call + */ + WIMAX_GNL_VERSION = 00, + /* Generic NetLink attributes */ + WIMAX_GNL_ATTR_INVALID = 0x00, + WIMAX_GNL_ATTR_MAX = 10, +}; + + +/* + * Generic NetLink operations + * + * Most of these map to an API call; _OP_ stands for operation, _RP_ + * for reply and _RE_ for report (aka: signal). + */ +enum { + WIMAX_GNL_OP_MSG_FROM_USER, /* User to kernel message */ + WIMAX_GNL_OP_MSG_TO_USER, /* Kernel to user message */ + WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */ + WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */ + WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */ +}; + + +/* Message from user / to user */ +enum { + WIMAX_GNL_MSG_IFIDX = 1, + WIMAX_GNL_MSG_PIPE_NAME, + WIMAX_GNL_MSG_DATA, +}; + + +/* + * wimax_rfkill() + * + * The state of the radio (ON/OFF) is mapped to the rfkill subsystem's + * switch state (DISABLED/ENABLED). + */ +enum wimax_rf_state { + WIMAX_RF_OFF = 0, /* Radio is off, rfkill on/enabled */ + WIMAX_RF_ON = 1, /* Radio is on, rfkill off/disabled */ + WIMAX_RF_QUERY = 2, +}; + +/* Attributes */ +enum { + WIMAX_GNL_RFKILL_IFIDX = 1, + WIMAX_GNL_RFKILL_STATE, +}; + + +/* Attributes for wimax_reset() */ +enum { + WIMAX_GNL_RESET_IFIDX = 1, +}; + + +/* + * Attributes for the Report State Change + * + * For now we just have the old and new states; new attributes might + * be added later on. + */ +enum { + WIMAX_GNL_STCH_IFIDX = 1, + WIMAX_GNL_STCH_STATE_OLD, + WIMAX_GNL_STCH_STATE_NEW, +}; + + +/** + * enum wimax_st - The different states of a WiMAX device + * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed, + * but still wimax_dev_add() hasn't been called. There is no state. + * + * @WIMAX_ST_DOWN: The device has been registered with the WiMAX and + * networking stacks, but it is not initialized (normally that is + * done with 'ifconfig DEV up' [or equivalent], which can upload + * firmware and enable communications with the device). + * In this state, the device is powered down and using as less + * power as possible. + * This state is the default after a call to wimax_dev_add(). It + * is ok to have drivers move directly to %WIMAX_ST_UNINITIALIZED + * or %WIMAX_ST_RADIO_OFF in _probe() after the call to + * wimax_dev_add(). + * It is recommended that the driver leaves this state when + * calling 'ifconfig DEV up' and enters it back on 'ifconfig DEV + * down'. + * + * @__WIMAX_ST_QUIESCING: The device is being torn down, so no API + * operations are allowed to proceed except the ones needed to + * complete the device clean up process. + * + * @WIMAX_ST_UNINITIALIZED: [optional] Communication with the device + * is setup, but the device still requires some configuration + * before being operational. + * Some WiMAX API calls might work. + * + * @WIMAX_ST_RADIO_OFF: The device is fully up; radio is off (wether + * by hardware or software switches). + * It is recommended to always leave the device in this state + * after initialization. + * + * @WIMAX_ST_READY: The device is fully up and radio is on. + * + * @WIMAX_ST_SCANNING: [optional] The device has been instructed to + * scan. In this state, the device cannot be actively connected to + * a network. + * + * @WIMAX_ST_CONNECTING: The device is connecting to a network. This + * state exists because in some devices, the connect process can + * include a number of negotiations between user space, kernel + * space and the device. User space needs to know what the device + * is doing. If the connect sequence in a device is atomic and + * fast, the device can transition directly to CONNECTED + * + * @WIMAX_ST_CONNECTED: The device is connected to a network. + * + * @__WIMAX_ST_INVALID: This is an invalid state used to mark the + * maximum numeric value of states. + * + * Description: + * + * Transitions from one state to another one are atomic and can only + * be caused in kernel space with wimax_state_change(). To read the + * state, use wimax_state_get(). + * + * States starting with __ are internal and shall not be used or + * referred to by drivers or userspace. They look ugly, but that's the + * point -- if any use is made non-internal to the stack, it is easier + * to catch on review. + * + * All API operations [with well defined exceptions] will take the + * device mutex before starting and then check the state. If the state + * is %__WIMAX_ST_NULL, %WIMAX_ST_DOWN, %WIMAX_ST_UNINITIALIZED or + * %__WIMAX_ST_QUIESCING, it will drop the lock and quit with + * -%EINVAL, -%ENOMEDIUM, -%ENOTCONN or -%ESHUTDOWN. + * + * The order of the definitions is important, so we can do numerical + * comparisons (eg: < %WIMAX_ST_RADIO_OFF means the device is not ready + * to operate). + */ +/* + * The allowed state transitions are described in the table below + * (states in rows can go to states in columns where there is an X): + * + * UNINI RADIO READY SCAN CONNEC CONNEC + * NULL DOWN QUIESCING TIALIZED OFF NING TING TED + * NULL - x + * DOWN - x x x + * QUIESCING x - + * UNINITIALIZED x - x + * RADIO_OFF x - x + * READY x x - x x x + * SCANNING x x x - x x + * CONNECTING x x x x - x + * CONNECTED x x x - + * + * This table not available in kernel-doc because the formatting messes it up. + */ + enum wimax_st { + __WIMAX_ST_NULL = 0, + WIMAX_ST_DOWN, + __WIMAX_ST_QUIESCING, + WIMAX_ST_UNINITIALIZED, + WIMAX_ST_RADIO_OFF, + WIMAX_ST_READY, + WIMAX_ST_SCANNING, + WIMAX_ST_CONNECTING, + WIMAX_ST_CONNECTED, + __WIMAX_ST_INVALID /* Always keep last */ +}; + + +#endif /* #ifndef __LINUX__WIMAX_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/..install.cmd new file mode 100644 index 0000000..234ef58 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/wimax/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/wimax /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/wimax mips i2400m.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/linux/wimax /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/wimax mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/linux/wimax/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/i2400m.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/i2400m.h new file mode 100644 index 0000000..d5148a7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wimax/i2400m.h @@ -0,0 +1,581 @@ +/* + * Intel Wireless WiMax Connection 2400m + * Host-Device protocol interface definitions + * + * + * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Intel Corporation + * Inaky Perez-Gonzalez + * - Initial implementation + * + * + * This header defines the data structures and constants used to + * communicate with the device. + * + * BOOTMODE/BOOTROM/FIRMWARE UPLOAD PROTOCOL + * + * The firmware upload protocol is quite simple and only requires a + * handful of commands. See drivers/net/wimax/i2400m/fw.c for more + * details. + * + * The BCF data structure is for the firmware file header. + * + * + * THE DATA / CONTROL PROTOCOL + * + * This is the normal protocol spoken with the device once the + * firmware is uploaded. It transports data payloads and control + * messages back and forth. + * + * It consists 'messages' that pack one or more payloads each. The + * format is described in detail in drivers/net/wimax/i2400m/rx.c and + * tx.c. + * + * + * THE L3L4 PROTOCOL + * + * The term L3L4 refers to Layer 3 (the device), Layer 4 (the + * driver/host software). + * + * This is the control protocol used by the host to control the i2400m + * device (scan, connect, disconnect...). This is sent to / received + * as control frames. These frames consist of a header and zero or + * more TLVs with information. We call each control frame a "message". + * + * Each message is composed of: + * + * HEADER + * [TLV0 + PAYLOAD0] + * [TLV1 + PAYLOAD1] + * [...] + * [TLVN + PAYLOADN] + * + * The HEADER is defined by 'struct i2400m_l3l4_hdr'. The payloads are + * defined by a TLV structure (Type Length Value) which is a 'header' + * (struct i2400m_tlv_hdr) and then the payload. + * + * All integers are represented as Little Endian. + * + * - REQUESTS AND EVENTS + * + * The requests can be clasified as follows: + * + * COMMAND: implies a request from the host to the device requesting + * an action being performed. The device will reply with a + * message (with the same type as the command), status and + * no (TLV) payload. Execution of a command might cause + * events (of different type) to be sent later on as + * device's state changes. + * + * GET/SET: similar to COMMAND, but will not cause other + * EVENTs. The reply, in the case of GET, will contain + * TLVs with the requested information. + * + * EVENT: asynchronous messages sent from the device, maybe as a + * consequence of previous COMMANDs but disassociated from + * them. + * + * Only one request might be pending at the same time (ie: don't + * parallelize nor post another GET request before the previous + * COMMAND has been acknowledged with it's corresponding reply by the + * device). + * + * The different requests and their formats are described below: + * + * I2400M_MT_* Message types + * I2400M_MS_* Message status (for replies, events) + * i2400m_tlv_* TLVs + * + * data types are named 'struct i2400m_msg_OPNAME', OPNAME matching the + * operation. + */ + +#ifndef __LINUX__WIMAX__I2400M_H__ +#define __LINUX__WIMAX__I2400M_H__ + +#include + + +/* + * Host Device Interface (HDI) common to all busses + */ + +/* Boot-mode (firmware upload mode) commands */ + +/* Header for the firmware file */ +struct i2400m_bcf_hdr { + __le32 module_type; + __le32 header_len; + __le32 header_version; + __le32 module_id; + __le32 module_vendor; + __le32 date; /* BCD YYYMMDD */ + __le32 size; + __le32 key_size; /* in dwords */ + __le32 modulus_size; /* in dwords */ + __le32 exponent_size; /* in dwords */ + __u8 reserved[88]; +} __attribute__ ((packed)); + +/* Boot mode opcodes */ +enum i2400m_brh_opcode { + I2400M_BRH_READ = 1, + I2400M_BRH_WRITE = 2, + I2400M_BRH_JUMP = 3, + I2400M_BRH_SIGNED_JUMP = 8, + I2400M_BRH_HASH_PAYLOAD_ONLY = 9, +}; + +/* Boot mode command masks and stuff */ +enum i2400m_brh { + I2400M_BRH_SIGNATURE = 0xcbbc0000, + I2400M_BRH_SIGNATURE_MASK = 0xffff0000, + I2400M_BRH_SIGNATURE_SHIFT = 16, + I2400M_BRH_OPCODE_MASK = 0x0000000f, + I2400M_BRH_RESPONSE_MASK = 0x000000f0, + I2400M_BRH_RESPONSE_SHIFT = 4, + I2400M_BRH_DIRECT_ACCESS = 0x00000400, + I2400M_BRH_RESPONSE_REQUIRED = 0x00000200, + I2400M_BRH_USE_CHECKSUM = 0x00000100, +}; + + +/* Constants for bcf->module_id */ +enum i2400m_bcf_mod_id { + /* Firmware file carries its own pokes -- pokes are a set of + * magical values that have to be written in certain memory + * addresses to get the device up and ready for firmware + * download when it is in non-signed boot mode. */ + I2400M_BCF_MOD_ID_POKES = 0x000000001, +}; + + +/** + * i2400m_bootrom_header - Header for a boot-mode command + * + * @cmd: the above command descriptor + * @target_addr: where on the device memory should the action be performed. + * @data_size: for read/write, amount of data to be read/written + * @block_checksum: checksum value (if applicable) + * @payload: the beginning of data attached to this header + */ +struct i2400m_bootrom_header { + __le32 command; /* Compose with enum i2400_brh */ + __le32 target_addr; + __le32 data_size; + __le32 block_checksum; + char payload[0]; +} __attribute__ ((packed)); + + +/* + * Data / control protocol + */ + +/* Packet types for the host-device interface */ +enum i2400m_pt { + I2400M_PT_DATA = 0, + I2400M_PT_CTRL, + I2400M_PT_TRACE, /* For device debug */ + I2400M_PT_RESET_WARM, /* device reset */ + I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */ + I2400M_PT_EDATA, /* Extended RX data */ + I2400M_PT_ILLEGAL +}; + + +/* + * Payload for a data packet + * + * This is prefixed to each and every outgoing DATA type. + */ +struct i2400m_pl_data_hdr { + __le32 reserved; +} __attribute__((packed)); + + +/* + * Payload for an extended data packet + * + * New in fw v1.4 + * + * @reorder: if this payload has to be reorder or not (and how) + * @cs: the type of data in the packet, as defined per (802.16e + * T11.13.19.1). Currently only 2 (IPv4 packet) supported. + * + * This is prefixed to each and every INCOMING DATA packet. + */ +struct i2400m_pl_edata_hdr { + __le32 reorder; /* bits defined in i2400m_ro */ + __u8 cs; + __u8 reserved[11]; +} __attribute__((packed)); + +enum i2400m_cs { + I2400M_CS_IPV4_0 = 0, + I2400M_CS_IPV4 = 2, +}; + +enum i2400m_ro { + I2400M_RO_NEEDED = 0x01, + I2400M_RO_TYPE = 0x03, + I2400M_RO_TYPE_SHIFT = 1, + I2400M_RO_CIN = 0x0f, + I2400M_RO_CIN_SHIFT = 4, + I2400M_RO_FBN = 0x07ff, + I2400M_RO_FBN_SHIFT = 8, + I2400M_RO_SN = 0x07ff, + I2400M_RO_SN_SHIFT = 21, +}; + +enum i2400m_ro_type { + I2400M_RO_TYPE_RESET = 0, + I2400M_RO_TYPE_PACKET, + I2400M_RO_TYPE_WS, + I2400M_RO_TYPE_PACKET_WS, +}; + + +/* Misc constants */ +enum { + I2400M_PL_PAD = 16, /* Payload data size alignment */ + I2400M_PL_SIZE_MAX = 0x3EFF, + I2400M_MAX_PLS_IN_MSG = 60, + /* protocol barkers: sync sequences; for notifications they + * are sent in groups of four. */ + I2400M_H2D_PREVIEW_BARKER = 0xcafe900d, + I2400M_COLD_RESET_BARKER = 0xc01dc01d, + I2400M_WARM_RESET_BARKER = 0x50f750f7, + I2400M_NBOOT_BARKER = 0xdeadbeef, + I2400M_SBOOT_BARKER = 0x0ff1c1a1, + I2400M_ACK_BARKER = 0xfeedbabe, + I2400M_D2H_MSG_BARKER = 0xbeefbabe, +}; + + +/* + * Hardware payload descriptor + * + * Bitfields encoded in a struct to enforce typing semantics. + * + * Look in rx.c and tx.c for a full description of the format. + */ +struct i2400m_pld { + __le32 val; +} __attribute__ ((packed)); + +#define I2400M_PLD_SIZE_MASK 0x00003fff +#define I2400M_PLD_TYPE_SHIFT 16 +#define I2400M_PLD_TYPE_MASK 0x000f0000 + +/* + * Header for a TX message or RX message + * + * @barker: preamble + * @size: used for management of the FIFO queue buffer; before + * sending, this is converted to be a real preamble. This + * indicates the real size of the TX message that starts at this + * point. If the highest bit is set, then this message is to be + * skipped. + * @sequence: sequence number of this message + * @offset: offset where the message itself starts -- see the comments + * in the file header about message header and payload descriptor + * alignment. + * @num_pls: number of payloads in this message + * @padding: amount of padding bytes at the end of the message to make + * it be of block-size aligned + * + * Look in rx.c and tx.c for a full description of the format. + */ +struct i2400m_msg_hdr { + union { + __le32 barker; + __u32 size; /* same size type as barker!! */ + }; + union { + __le32 sequence; + __u32 offset; /* same size type as barker!! */ + }; + __le16 num_pls; + __le16 rsv1; + __le16 padding; + __le16 rsv2; + struct i2400m_pld pld[0]; +} __attribute__ ((packed)); + + + +/* + * L3/L4 control protocol + */ + +enum { + /* Interface version */ + I2400M_L3L4_VERSION = 0x0100, +}; + +/* Message types */ +enum i2400m_mt { + I2400M_MT_RESERVED = 0x0000, + I2400M_MT_INVALID = 0xffff, + I2400M_MT_REPORT_MASK = 0x8000, + + I2400M_MT_GET_SCAN_RESULT = 0x4202, + I2400M_MT_SET_SCAN_PARAM = 0x4402, + I2400M_MT_CMD_RF_CONTROL = 0x4602, + I2400M_MT_CMD_SCAN = 0x4603, + I2400M_MT_CMD_CONNECT = 0x4604, + I2400M_MT_CMD_DISCONNECT = 0x4605, + I2400M_MT_CMD_EXIT_IDLE = 0x4606, + I2400M_MT_GET_LM_VERSION = 0x5201, + I2400M_MT_GET_DEVICE_INFO = 0x5202, + I2400M_MT_GET_LINK_STATUS = 0x5203, + I2400M_MT_GET_STATISTICS = 0x5204, + I2400M_MT_GET_STATE = 0x5205, + I2400M_MT_GET_MEDIA_STATUS = 0x5206, + I2400M_MT_SET_INIT_CONFIG = 0x5404, + I2400M_MT_CMD_INIT = 0x5601, + I2400M_MT_CMD_TERMINATE = 0x5602, + I2400M_MT_CMD_MODE_OF_OP = 0x5603, + I2400M_MT_CMD_RESET_DEVICE = 0x5604, + I2400M_MT_CMD_MONITOR_CONTROL = 0x5605, + I2400M_MT_CMD_ENTER_POWERSAVE = 0x5606, + I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201, + I2400M_MT_SET_EAP_SUCCESS = 0x6402, + I2400M_MT_SET_EAP_FAIL = 0x6403, + I2400M_MT_SET_EAP_KEY = 0x6404, + I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602, + I2400M_MT_REPORT_SCAN_RESULT = 0xc002, + I2400M_MT_REPORT_STATE = 0xd002, + I2400M_MT_REPORT_POWERSAVE_READY = 0xd005, + I2400M_MT_REPORT_EAP_REQUEST = 0xe002, + I2400M_MT_REPORT_EAP_RESTART = 0xe003, + I2400M_MT_REPORT_ALT_ACCEPT = 0xe004, + I2400M_MT_REPORT_KEY_REQUEST = 0xe005, +}; + + +/* + * Message Ack Status codes + * + * When a message is replied-to, this status is reported. + */ +enum i2400m_ms { + I2400M_MS_DONE_OK = 0, + I2400M_MS_DONE_IN_PROGRESS = 1, + I2400M_MS_INVALID_OP = 2, + I2400M_MS_BAD_STATE = 3, + I2400M_MS_ILLEGAL_VALUE = 4, + I2400M_MS_MISSING_PARAMS = 5, + I2400M_MS_VERSION_ERROR = 6, + I2400M_MS_ACCESSIBILITY_ERROR = 7, + I2400M_MS_BUSY = 8, + I2400M_MS_CORRUPTED_TLV = 9, + I2400M_MS_UNINITIALIZED = 10, + I2400M_MS_UNKNOWN_ERROR = 11, + I2400M_MS_PRODUCTION_ERROR = 12, + I2400M_MS_NO_RF = 13, + I2400M_MS_NOT_READY_FOR_POWERSAVE = 14, + I2400M_MS_THERMAL_CRITICAL = 15, + I2400M_MS_MAX +}; + + +/** + * i2400m_tlv - enumeration of the different types of TLVs + * + * TLVs stand for type-length-value and are the header for a payload + * composed of almost anything. Each payload has a type assigned + * and a length. + */ +enum i2400m_tlv { + I2400M_TLV_L4_MESSAGE_VERSIONS = 129, + I2400M_TLV_SYSTEM_STATE = 141, + I2400M_TLV_MEDIA_STATUS = 161, + I2400M_TLV_RF_OPERATION = 162, + I2400M_TLV_RF_STATUS = 163, + I2400M_TLV_DEVICE_RESET_TYPE = 132, + I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601, + I2400M_TLV_CONFIG_IDLE_TIMEOUT = 611, + I2400M_TLV_CONFIG_D2H_DATA_FORMAT = 614, + I2400M_TLV_CONFIG_DL_HOST_REORDER = 615, +}; + + +struct i2400m_tlv_hdr { + __le16 type; + __le16 length; /* payload's */ + __u8 pl[0]; +} __attribute__((packed)); + + +struct i2400m_l3l4_hdr { + __le16 type; + __le16 length; /* payload's */ + __le16 version; + __le16 resv1; + __le16 status; + __le16 resv2; + struct i2400m_tlv_hdr pl[0]; +} __attribute__((packed)); + + +/** + * i2400m_system_state - different states of the device + */ +enum i2400m_system_state { + I2400M_SS_UNINITIALIZED = 1, + I2400M_SS_INIT, + I2400M_SS_READY, + I2400M_SS_SCAN, + I2400M_SS_STANDBY, + I2400M_SS_CONNECTING, + I2400M_SS_WIMAX_CONNECTED, + I2400M_SS_DATA_PATH_CONNECTED, + I2400M_SS_IDLE, + I2400M_SS_DISCONNECTING, + I2400M_SS_OUT_OF_ZONE, + I2400M_SS_SLEEPACTIVE, + I2400M_SS_PRODUCTION, + I2400M_SS_CONFIG, + I2400M_SS_RF_OFF, + I2400M_SS_RF_SHUTDOWN, + I2400M_SS_DEVICE_DISCONNECT, + I2400M_SS_MAX, +}; + + +/** + * i2400m_tlv_system_state - report on the state of the system + * + * @state: see enum i2400m_system_state + */ +struct i2400m_tlv_system_state { + struct i2400m_tlv_hdr hdr; + __le32 state; +} __attribute__((packed)); + + +struct i2400m_tlv_l4_message_versions { + struct i2400m_tlv_hdr hdr; + __le16 major; + __le16 minor; + __le16 branch; + __le16 reserved; +} __attribute__((packed)); + + +struct i2400m_tlv_detailed_device_info { + struct i2400m_tlv_hdr hdr; + __u8 reserved1[400]; + __u8 mac_address[6]; + __u8 reserved2[2]; +} __attribute__((packed)); + + +enum i2400m_rf_switch_status { + I2400M_RF_SWITCH_ON = 1, + I2400M_RF_SWITCH_OFF = 2, +}; + +struct i2400m_tlv_rf_switches_status { + struct i2400m_tlv_hdr hdr; + __u8 sw_rf_switch; /* 1 ON, 2 OFF */ + __u8 hw_rf_switch; /* 1 ON, 2 OFF */ + __u8 reserved[2]; +} __attribute__((packed)); + + +enum { + i2400m_rf_operation_on = 1, + i2400m_rf_operation_off = 2 +}; + +struct i2400m_tlv_rf_operation { + struct i2400m_tlv_hdr hdr; + __le32 status; /* 1 ON, 2 OFF */ +} __attribute__((packed)); + + +enum i2400m_tlv_reset_type { + I2400M_RESET_TYPE_COLD = 1, + I2400M_RESET_TYPE_WARM +}; + +struct i2400m_tlv_device_reset_type { + struct i2400m_tlv_hdr hdr; + __le32 reset_type; +} __attribute__((packed)); + + +struct i2400m_tlv_config_idle_parameters { + struct i2400m_tlv_hdr hdr; + __le32 idle_timeout; /* 100 to 300000 ms [5min], 100 increments + * 0 disabled */ + __le32 idle_paging_interval; /* frames */ +} __attribute__((packed)); + + +enum i2400m_media_status { + I2400M_MEDIA_STATUS_LINK_UP = 1, + I2400M_MEDIA_STATUS_LINK_DOWN, + I2400M_MEDIA_STATUS_LINK_RENEW, +}; + +struct i2400m_tlv_media_status { + struct i2400m_tlv_hdr hdr; + __le32 media_status; +} __attribute__((packed)); + + +/* New in v1.4 */ +struct i2400m_tlv_config_idle_timeout { + struct i2400m_tlv_hdr hdr; + __le32 timeout; /* 100 to 300000 ms [5min], 100 increments + * 0 disabled */ +} __attribute__((packed)); + +/* New in v1.4 -- for backward compat, will be removed */ +struct i2400m_tlv_config_d2h_data_format { + struct i2400m_tlv_hdr hdr; + __u8 format; /* 0 old format, 1 enhanced */ + __u8 reserved[3]; +} __attribute__((packed)); + +/* New in v1.4 */ +struct i2400m_tlv_config_dl_host_reorder { + struct i2400m_tlv_hdr hdr; + __u8 reorder; /* 0 disabled, 1 enabled */ + __u8 reserved[3]; +} __attribute__((packed)); + + +#endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wireless.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wireless.h new file mode 100644 index 0000000..fc1fec0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/wireless.h @@ -0,0 +1,1126 @@ +/* + * This file define a set of standard wireless extensions + * + * Version : 22 16.3.07 + * + * Authors : Jean Tourrilhes - HPL - + * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. + */ + +#ifndef _LINUX_WIRELESS_H +#define _LINUX_WIRELESS_H + +/************************** DOCUMENTATION **************************/ +/* + * Initial APIs (1996 -> onward) : + * ----------------------------- + * Basically, the wireless extensions are for now a set of standard ioctl + * call + /proc/net/wireless + * + * The entry /proc/net/wireless give statistics and information on the + * driver. + * This is better than having each driver having its entry because + * its centralised and we may remove the driver module safely. + * + * Ioctl are used to configure the driver and issue commands. This is + * better than command line options of insmod because we may want to + * change dynamically (while the driver is running) some parameters. + * + * The ioctl mechanimsm are copied from standard devices ioctl. + * We have the list of command plus a structure descibing the + * data exchanged... + * Note that to add these ioctl, I was obliged to modify : + * # net/core/dev.c (two place + add include) + * # net/ipv4/af_inet.c (one place + add include) + * + * /proc/net/wireless is a copy of /proc/net/dev. + * We have a structure for data passed from the driver to /proc/net/wireless + * Too add this, I've modified : + * # net/core/dev.c (two other places) + * # include/linux/netdevice.h (one place) + * # include/linux/proc_fs.h (one place) + * + * New driver API (2002 -> onward) : + * ------------------------------- + * This file is only concerned with the user space API and common definitions. + * The new driver API is defined and documented in : + * # include/net/iw_handler.h + * + * Note as well that /proc/net/wireless implementation has now moved in : + * # net/core/wireless.c + * + * Wireless Events (2002 -> onward) : + * -------------------------------- + * Events are defined at the end of this file, and implemented in : + * # net/core/wireless.c + * + * Other comments : + * -------------- + * Do not add here things that are redundant with other mechanisms + * (drivers init, ifconfig, /proc/net/dev, ...) and with are not + * wireless specific. + * + * These wireless extensions are not magic : each driver has to provide + * support for them... + * + * IMPORTANT NOTE : As everything in the kernel, this is very much a + * work in progress. Contact me if you have ideas of improvements... + */ + +/***************************** INCLUDES *****************************/ + +#include /* for __u* and __s* typedefs */ +#include /* for "struct sockaddr" et al */ +#include /* for IFNAMSIZ and co... */ + +/***************************** VERSION *****************************/ +/* + * This constant is used to know the availability of the wireless + * extensions and to know which version of wireless extensions it is + * (there is some stuff that will be added in the future...) + * I just plan to increment with each new version. + */ +#define WIRELESS_EXT 22 + +/* + * Changes : + * + * V2 to V3 + * -------- + * Alan Cox start some incompatibles changes. I've integrated a bit more. + * - Encryption renamed to Encode to avoid US regulation problems + * - Frequency changed from float to struct to avoid problems on old 386 + * + * V3 to V4 + * -------- + * - Add sensitivity + * + * V4 to V5 + * -------- + * - Missing encoding definitions in range + * - Access points stuff + * + * V5 to V6 + * -------- + * - 802.11 support (ESSID ioctls) + * + * V6 to V7 + * -------- + * - define IW_ESSID_MAX_SIZE and IW_MAX_AP + * + * V7 to V8 + * -------- + * - Changed my e-mail address + * - More 802.11 support (nickname, rate, rts, frag) + * - List index in frequencies + * + * V8 to V9 + * -------- + * - Support for 'mode of operation' (ad-hoc, managed...) + * - Support for unicast and multicast power saving + * - Change encoding to support larger tokens (>64 bits) + * - Updated iw_params (disable, flags) and use it for NWID + * - Extracted iw_point from iwreq for clarity + * + * V9 to V10 + * --------- + * - Add PM capability to range structure + * - Add PM modifier : MAX/MIN/RELATIVE + * - Add encoding option : IW_ENCODE_NOKEY + * - Add TxPower ioctls (work like TxRate) + * + * V10 to V11 + * ---------- + * - Add WE version in range (help backward/forward compatibility) + * - Add retry ioctls (work like PM) + * + * V11 to V12 + * ---------- + * - Add SIOCSIWSTATS to get /proc/net/wireless programatically + * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space + * - Add new statistics (frag, retry, beacon) + * - Add average quality (for user space calibration) + * + * V12 to V13 + * ---------- + * - Document creation of new driver API. + * - Extract union iwreq_data from struct iwreq (for new driver API). + * - Rename SIOCSIWNAME as SIOCSIWCOMMIT + * + * V13 to V14 + * ---------- + * - Wireless Events support : define struct iw_event + * - Define additional specific event numbers + * - Add "addr" and "param" fields in union iwreq_data + * - AP scanning stuff (SIOCSIWSCAN and friends) + * + * V14 to V15 + * ---------- + * - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg + * - Make struct iw_freq signed (both m & e), add explicit padding + * - Add IWEVCUSTOM for driver specific event/scanning token + * - Add IW_MAX_GET_SPY for driver returning a lot of addresses + * - Add IW_TXPOW_RANGE for range of Tx Powers + * - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points + * - Add IW_MODE_MONITOR for passive monitor + * + * V15 to V16 + * ---------- + * - Increase the number of bitrates in iw_range to 32 (for 802.11g) + * - Increase the number of frequencies in iw_range to 32 (for 802.11b+a) + * - Reshuffle struct iw_range for increases, add filler + * - Increase IW_MAX_AP to 64 for driver returning a lot of addresses + * - Remove IW_MAX_GET_SPY because conflict with enhanced spy support + * - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy" + * - Add IW_ENCODE_TEMP and iw_range->encoding_login_index + * + * V16 to V17 + * ---------- + * - Add flags to frequency -> auto/fixed + * - Document (struct iw_quality *)->updated, add new flags (INVALID) + * - Wireless Event capability in struct iw_range + * - Add support for relative TxPower (yick !) + * + * V17 to V18 (From Jouni Malinen ) + * ---------- + * - Add support for WPA/WPA2 + * - Add extended encoding configuration (SIOCSIWENCODEEXT and + * SIOCGIWENCODEEXT) + * - Add SIOCSIWGENIE/SIOCGIWGENIE + * - Add SIOCSIWMLME + * - Add SIOCSIWPMKSA + * - Add struct iw_range bit field for supported encoding capabilities + * - Add optional scan request parameters for SIOCSIWSCAN + * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA + * related parameters (extensible up to 4096 parameter values) + * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE, + * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND + * + * V18 to V19 + * ---------- + * - Remove (struct iw_point *)->pointer from events and streams + * - Remove header includes to help user space + * - Increase IW_ENCODING_TOKEN_MAX from 32 to 64 + * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros + * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM + * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros + * + * V19 to V20 + * ---------- + * - RtNetlink requests support (SET/GET) + * + * V20 to V21 + * ---------- + * - Remove (struct net_device *)->get_wireless_stats() + * - Change length in ESSID and NICK to strlen() instead of strlen()+1 + * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers + * - Power/Retry relative values no longer * 100000 + * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI + * + * V21 to V22 + * ---------- + * - Prevent leaking of kernel space in stream on 64 bits. + */ + +/**************************** CONSTANTS ****************************/ + +/* -------------------------- IOCTL LIST -------------------------- */ + +/* Wireless Identification */ +#define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */ +#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ +/* SIOCGIWNAME is used to verify the presence of Wireless Extensions. + * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"... + * Don't put the name of your driver there, it's useless. */ + +/* Basic operations */ +#define SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */ +#define SIOCGIWNWID 0x8B03 /* get network id (the cell) */ +#define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */ +#define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */ +#define SIOCSIWMODE 0x8B06 /* set operation mode */ +#define SIOCGIWMODE 0x8B07 /* get operation mode */ +#define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */ +#define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */ + +/* Informative stuff */ +#define SIOCSIWRANGE 0x8B0A /* Unused */ +#define SIOCGIWRANGE 0x8B0B /* Get range of parameters */ +#define SIOCSIWPRIV 0x8B0C /* Unused */ +#define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */ +#define SIOCSIWSTATS 0x8B0E /* Unused */ +#define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */ +/* SIOCGIWSTATS is strictly used between user space and the kernel, and + * is never passed to the driver (i.e. the driver will never see it). */ + +/* Spy support (statistics per MAC address - used for Mobile IP support) */ +#define SIOCSIWSPY 0x8B10 /* set spy addresses */ +#define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */ +#define SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */ +#define SIOCGIWTHRSPY 0x8B13 /* get spy threshold */ + +/* Access Point manipulation */ +#define SIOCSIWAP 0x8B14 /* set access point MAC addresses */ +#define SIOCGIWAP 0x8B15 /* get access point MAC addresses */ +#define SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */ +#define SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */ +#define SIOCGIWSCAN 0x8B19 /* get scanning results */ + +/* 802.11 specific support */ +#define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */ +#define SIOCGIWESSID 0x8B1B /* get ESSID */ +#define SIOCSIWNICKN 0x8B1C /* set node name/nickname */ +#define SIOCGIWNICKN 0x8B1D /* get node name/nickname */ +/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit + * within the 'iwreq' structure, so we need to use the 'data' member to + * point to a string in user space, like it is done for RANGE... */ + +/* Other parameters useful in 802.11 and some other devices */ +#define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */ +#define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ +#define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */ +#define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */ +#define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ +#define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ +#define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */ +#define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */ +#define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */ +#define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */ + +/* Encoding stuff (scrambling, hardware security, WEP...) */ +#define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ +#define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ +/* Power saving stuff (power management, unicast and multicast) */ +#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ +#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ + +/* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). + * This ioctl uses struct iw_point and data buffer that includes IE id and len + * fields. More than one IE may be included in the request. Setting the generic + * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers + * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers + * are required to report the used IE as a wireless event, e.g., when + * associating with an AP. */ +#define SIOCSIWGENIE 0x8B30 /* set generic IE */ +#define SIOCGIWGENIE 0x8B31 /* get generic IE */ + +/* WPA : IEEE 802.11 MLME requests */ +#define SIOCSIWMLME 0x8B16 /* request MLME operation; uses + * struct iw_mlme */ +/* WPA : Authentication mode parameters */ +#define SIOCSIWAUTH 0x8B32 /* set authentication mode params */ +#define SIOCGIWAUTH 0x8B33 /* get authentication mode params */ + +/* WPA : Extended version of encoding configuration */ +#define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */ +#define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */ + +/* WPA2 : PMKSA cache management */ +#define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */ + +/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ + +/* These 32 ioctl are wireless device private, for 16 commands. + * Each driver is free to use them for whatever purpose it chooses, + * however the driver *must* export the description of those ioctls + * with SIOCGIWPRIV and *must* use arguments as defined below. + * If you don't follow those rules, DaveM is going to hate you (reason : + * it make mixed 32/64bit operation impossible). + */ +#define SIOCIWFIRSTPRIV 0x8BE0 +#define SIOCIWLASTPRIV 0x8BFF +/* Previously, we were using SIOCDEVPRIVATE, but we now have our + * separate range because of collisions with other tools such as + * 'mii-tool'. + * We now have 32 commands, so a bit more space ;-). + * Also, all 'even' commands are only usable by root and don't return the + * content of ifr/iwr to user (but you are not obliged to use the set/get + * convention, just use every other two command). More details in iwpriv.c. + * And I repeat : you are not forced to use them with iwpriv, but you + * must be compliant with it. + */ + +/* ------------------------- IOCTL STUFF ------------------------- */ + +/* The first and the last (range) */ +#define SIOCIWFIRST 0x8B00 +#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ +#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) + +/* Odd : get (world access), even : set (root access) */ +#define IW_IS_SET(cmd) (!((cmd) & 0x1)) +#define IW_IS_GET(cmd) ((cmd) & 0x1) + +/* ----------------------- WIRELESS EVENTS ----------------------- */ +/* Those are *NOT* ioctls, do not issue request on them !!! */ +/* Most events use the same identifier as ioctl requests */ + +#define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */ +#define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */ +#define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ +#define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ +#define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ +#define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..) + * (scan results); This includes id and + * length fields. One IWEVGENIE may + * contain more than one IE. Scan + * results may contain one or more + * IWEVGENIE events. */ +#define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure + * (struct iw_michaelmicfailure) + */ +#define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request. + * The data includes id and length + * fields and may contain more than one + * IE. This event is required in + * Managed mode if the driver + * generates its own WPA/RSN IE. This + * should be sent just before + * IWEVREGISTERED event for the + * association. */ +#define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association + * Response. The data includes id and + * length fields and may contain more + * than one IE. This may be sent + * between IWEVASSOCREQIE and + * IWEVREGISTERED events for the + * association. */ +#define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN + * pre-authentication + * (struct iw_pmkid_cand) */ + +#define IWEVFIRST 0x8C00 +#define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST) + +/* ------------------------- PRIVATE INFO ------------------------- */ +/* + * The following is used with SIOCGIWPRIV. It allow a driver to define + * the interface (name, type of data) for its private ioctl. + * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV + */ + +#define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */ +#define IW_PRIV_TYPE_NONE 0x0000 +#define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */ +#define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */ +#define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */ +#define IW_PRIV_TYPE_FLOAT 0x5000 /* struct iw_freq */ +#define IW_PRIV_TYPE_ADDR 0x6000 /* struct sockaddr */ + +#define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed number of args */ + +#define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */ + +/* + * Note : if the number of args is fixed and the size < 16 octets, + * instead of passing a pointer we will put args in the iwreq struct... + */ + +/* ----------------------- OTHER CONSTANTS ----------------------- */ + +/* Maximum frequencies in the range struct */ +#define IW_MAX_FREQUENCIES 32 +/* Note : if you have something like 80 frequencies, + * don't increase this constant and don't fill the frequency list. + * The user will be able to set by channel anyway... */ + +/* Maximum bit rates in the range struct */ +#define IW_MAX_BITRATES 32 + +/* Maximum tx powers in the range struct */ +#define IW_MAX_TXPOWER 8 +/* Note : if you more than 8 TXPowers, just set the max and min or + * a few of them in the struct iw_range. */ + +/* Maximum of address that you may set with SPY */ +#define IW_MAX_SPY 8 + +/* Maximum of address that you may get in the + list of access points in range */ +#define IW_MAX_AP 64 + +/* Maximum size of the ESSID and NICKN strings */ +#define IW_ESSID_MAX_SIZE 32 + +/* Modes of operation */ +#define IW_MODE_AUTO 0 /* Let the driver decides */ +#define IW_MODE_ADHOC 1 /* Single cell network */ +#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ +#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */ +#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ +#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ +#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ +#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */ + +/* Statistics flags (bitmask in updated) */ +#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */ +#define IW_QUAL_LEVEL_UPDATED 0x02 +#define IW_QUAL_NOISE_UPDATED 0x04 +#define IW_QUAL_ALL_UPDATED 0x07 +#define IW_QUAL_DBM 0x08 /* Level + Noise are dBm */ +#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ +#define IW_QUAL_LEVEL_INVALID 0x20 +#define IW_QUAL_NOISE_INVALID 0x40 +#define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */ +#define IW_QUAL_ALL_INVALID 0x70 + +/* Frequency flags */ +#define IW_FREQ_AUTO 0x00 /* Let the driver decides */ +#define IW_FREQ_FIXED 0x01 /* Force a specific value */ + +/* Maximum number of size of encoding token available + * they are listed in the range structure */ +#define IW_MAX_ENCODING_SIZES 8 + +/* Maximum size of the encoding token in bytes */ +#define IW_ENCODING_TOKEN_MAX 64 /* 512 bits (for now) */ + +/* Flags for encoding (along with the token) */ +#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ +#define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */ +#define IW_ENCODE_MODE 0xF000 /* Modes defined below */ +#define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */ +#define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */ +#define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */ +#define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */ +#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */ +#define IW_ENCODE_TEMP 0x0400 /* Temporary key */ + +/* Power management flags available (along with the value, if any) */ +#define IW_POWER_ON 0x0000 /* No details... */ +#define IW_POWER_TYPE 0xF000 /* Type of parameter */ +#define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ +#define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ +#define IW_POWER_MODE 0x0F00 /* Power Management mode */ +#define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */ +#define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */ +#define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */ +#define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */ +#define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */ +#define IW_POWER_MODIFIER 0x000F /* Modify a parameter */ +#define IW_POWER_MIN 0x0001 /* Value is a minimum */ +#define IW_POWER_MAX 0x0002 /* Value is a maximum */ +#define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ + +/* Transmit Power flags available */ +#define IW_TXPOW_TYPE 0x00FF /* Type of value */ +#define IW_TXPOW_DBM 0x0000 /* Value is in dBm */ +#define IW_TXPOW_MWATT 0x0001 /* Value is in mW */ +#define IW_TXPOW_RELATIVE 0x0002 /* Value is in arbitrary units */ +#define IW_TXPOW_RANGE 0x1000 /* Range of value between min/max */ + +/* Retry limits and lifetime flags available */ +#define IW_RETRY_ON 0x0000 /* No details... */ +#define IW_RETRY_TYPE 0xF000 /* Type of parameter */ +#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ +#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ +#define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */ +#define IW_RETRY_MIN 0x0001 /* Value is a minimum */ +#define IW_RETRY_MAX 0x0002 /* Value is a maximum */ +#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ +#define IW_RETRY_SHORT 0x0010 /* Value is for short packets */ +#define IW_RETRY_LONG 0x0020 /* Value is for long packets */ + +/* Scanning request flags */ +#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ +#define IW_SCAN_ALL_ESSID 0x0001 /* Scan all ESSIDs */ +#define IW_SCAN_THIS_ESSID 0x0002 /* Scan only this ESSID */ +#define IW_SCAN_ALL_FREQ 0x0004 /* Scan all Frequencies */ +#define IW_SCAN_THIS_FREQ 0x0008 /* Scan only this Frequency */ +#define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */ +#define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ +#define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ +#define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ +/* struct iw_scan_req scan_type */ +#define IW_SCAN_TYPE_ACTIVE 0 +#define IW_SCAN_TYPE_PASSIVE 1 +/* Maximum size of returned data */ +#define IW_SCAN_MAX_DATA 4096 /* In bytes */ + +/* Scan capability flags - in (struct iw_range *)->scan_capa */ +#define IW_SCAN_CAPA_NONE 0x00 +#define IW_SCAN_CAPA_ESSID 0x01 +#define IW_SCAN_CAPA_BSSID 0x02 +#define IW_SCAN_CAPA_CHANNEL 0x04 +#define IW_SCAN_CAPA_MODE 0x08 +#define IW_SCAN_CAPA_RATE 0x10 +#define IW_SCAN_CAPA_TYPE 0x20 +#define IW_SCAN_CAPA_TIME 0x40 + +/* Max number of char in custom event - use multiple of them if needed */ +#define IW_CUSTOM_MAX 256 /* In bytes */ + +/* Generic information element */ +#define IW_GENERIC_IE_MAX 1024 + +/* MLME requests (SIOCSIWMLME / struct iw_mlme) */ +#define IW_MLME_DEAUTH 0 +#define IW_MLME_DISASSOC 1 +#define IW_MLME_AUTH 2 +#define IW_MLME_ASSOC 3 + +/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ +#define IW_AUTH_INDEX 0x0FFF +#define IW_AUTH_FLAGS 0xF000 +/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) + * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the + * parameter that is being set/get to; value will be read/written to + * struct iw_param value field) */ +#define IW_AUTH_WPA_VERSION 0 +#define IW_AUTH_CIPHER_PAIRWISE 1 +#define IW_AUTH_CIPHER_GROUP 2 +#define IW_AUTH_KEY_MGMT 3 +#define IW_AUTH_TKIP_COUNTERMEASURES 4 +#define IW_AUTH_DROP_UNENCRYPTED 5 +#define IW_AUTH_80211_AUTH_ALG 6 +#define IW_AUTH_WPA_ENABLED 7 +#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 +#define IW_AUTH_ROAMING_CONTROL 9 +#define IW_AUTH_PRIVACY_INVOKED 10 +#define IW_AUTH_CIPHER_GROUP_MGMT 11 +#define IW_AUTH_MFP 12 + +/* IW_AUTH_WPA_VERSION values (bit field) */ +#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 +#define IW_AUTH_WPA_VERSION_WPA 0x00000002 +#define IW_AUTH_WPA_VERSION_WPA2 0x00000004 + +/* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT + * values (bit field) */ +#define IW_AUTH_CIPHER_NONE 0x00000001 +#define IW_AUTH_CIPHER_WEP40 0x00000002 +#define IW_AUTH_CIPHER_TKIP 0x00000004 +#define IW_AUTH_CIPHER_CCMP 0x00000008 +#define IW_AUTH_CIPHER_WEP104 0x00000010 +#define IW_AUTH_CIPHER_AES_CMAC 0x00000020 + +/* IW_AUTH_KEY_MGMT values (bit field) */ +#define IW_AUTH_KEY_MGMT_802_1X 1 +#define IW_AUTH_KEY_MGMT_PSK 2 + +/* IW_AUTH_80211_AUTH_ALG values (bit field) */ +#define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 +#define IW_AUTH_ALG_SHARED_KEY 0x00000002 +#define IW_AUTH_ALG_LEAP 0x00000004 + +/* IW_AUTH_ROAMING_CONTROL values */ +#define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */ +#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming + * control */ + +/* IW_AUTH_MFP (management frame protection) values */ +#define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */ +#define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */ +#define IW_AUTH_MFP_REQUIRED 2 /* MFP required */ + +/* SIOCSIWENCODEEXT definitions */ +#define IW_ENCODE_SEQ_MAX_SIZE 8 +/* struct iw_encode_ext ->alg */ +#define IW_ENCODE_ALG_NONE 0 +#define IW_ENCODE_ALG_WEP 1 +#define IW_ENCODE_ALG_TKIP 2 +#define IW_ENCODE_ALG_CCMP 3 +#define IW_ENCODE_ALG_PMK 4 +#define IW_ENCODE_ALG_AES_CMAC 5 +/* struct iw_encode_ext ->ext_flags */ +#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 +#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 +#define IW_ENCODE_EXT_GROUP_KEY 0x00000004 +#define IW_ENCODE_EXT_SET_TX_KEY 0x00000008 + +/* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */ +#define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */ +#define IW_MICFAILURE_GROUP 0x00000004 +#define IW_MICFAILURE_PAIRWISE 0x00000008 +#define IW_MICFAILURE_STAKEY 0x00000010 +#define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported) + */ + +/* Bit field values for enc_capa in struct iw_range */ +#define IW_ENC_CAPA_WPA 0x00000001 +#define IW_ENC_CAPA_WPA2 0x00000002 +#define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 +#define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 +#define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010 + +/* Event capability macros - in (struct iw_range *)->event_capa + * Because we have more than 32 possible events, we use an array of + * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ +#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \ + (cmd - SIOCIWFIRSTPRIV + 0x60) : \ + (cmd - SIOCSIWCOMMIT)) +#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) +#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) +/* Event capability constants - event autogenerated by the kernel + * This list is valid for most 802.11 devices, customise as needed... */ +#define IW_EVENT_CAPA_K_0 (IW_EVENT_CAPA_MASK(0x8B04) | \ + IW_EVENT_CAPA_MASK(0x8B06) | \ + IW_EVENT_CAPA_MASK(0x8B1A)) +#define IW_EVENT_CAPA_K_1 (IW_EVENT_CAPA_MASK(0x8B2A)) +/* "Easy" macro to set events in iw_range (less efficient) */ +#define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd)) +#define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; } + + +/****************************** TYPES ******************************/ + +/* --------------------------- SUBTYPES --------------------------- */ +/* + * Generic format for most parameters that fit in an int + */ +struct iw_param +{ + __s32 value; /* The value of the parameter itself */ + __u8 fixed; /* Hardware should not use auto select */ + __u8 disabled; /* Disable the feature */ + __u16 flags; /* Various specifc flags (if any) */ +}; + +/* + * For all data larger than 16 octets, we need to use a + * pointer to memory allocated in user space. + */ +struct iw_point +{ + void *pointer; /* Pointer to the data (in user space) */ + __u16 length; /* number of fields or size in bytes */ + __u16 flags; /* Optional params */ +}; + + +/* + * A frequency + * For numbers lower than 10^9, we encode the number in 'm' and + * set 'e' to 0 + * For number greater than 10^9, we divide it by the lowest power + * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')... + * The power of 10 is in 'e', the result of the division is in 'm'. + */ +struct iw_freq +{ + __s32 m; /* Mantissa */ + __s16 e; /* Exponent */ + __u8 i; /* List index (when in range struct) */ + __u8 flags; /* Flags (fixed/auto) */ +}; + +/* + * Quality of the link + */ +struct iw_quality +{ + __u8 qual; /* link quality (%retries, SNR, + %missed beacons or better...) */ + __u8 level; /* signal level (dBm) */ + __u8 noise; /* noise level (dBm) */ + __u8 updated; /* Flags to know if updated */ +}; + +/* + * Packet discarded in the wireless adapter due to + * "wireless" specific problems... + * Note : the list of counter and statistics in net_device_stats + * is already pretty exhaustive, and you should use that first. + * This is only additional stats... + */ +struct iw_discarded +{ + __u32 nwid; /* Rx : Wrong nwid/essid */ + __u32 code; /* Rx : Unable to code/decode (WEP) */ + __u32 fragment; /* Rx : Can't perform MAC reassembly */ + __u32 retries; /* Tx : Max MAC retries num reached */ + __u32 misc; /* Others cases */ +}; + +/* + * Packet/Time period missed in the wireless adapter due to + * "wireless" specific problems... + */ +struct iw_missed +{ + __u32 beacon; /* Missed beacons/superframe */ +}; + +/* + * Quality range (for spy threshold) + */ +struct iw_thrspy +{ + struct sockaddr addr; /* Source address (hw/mac) */ + struct iw_quality qual; /* Quality of the link */ + struct iw_quality low; /* Low threshold */ + struct iw_quality high; /* High threshold */ +}; + +/* + * Optional data for scan request + * + * Note: these optional parameters are controlling parameters for the + * scanning behavior, these do not apply to getting scan results + * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and + * provide a merged results with all BSSes even if the previous scan + * request limited scanning to a subset, e.g., by specifying an SSID. + * Especially, scan results are required to include an entry for the + * current BSS if the driver is in Managed mode and associated with an AP. + */ +struct iw_scan_req +{ + __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */ + __u8 essid_len; + __u8 num_channels; /* num entries in channel_list; + * 0 = scan all allowed channels */ + __u8 flags; /* reserved as padding; use zero, this may + * be used in the future for adding flags + * to request different scan behavior */ + struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or + * individual address of a specific BSS */ + + /* + * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using + * the current ESSID. This allows scan requests for specific ESSID + * without having to change the current ESSID and potentially breaking + * the current association. + */ + __u8 essid[IW_ESSID_MAX_SIZE]; + + /* + * Optional parameters for changing the default scanning behavior. + * These are based on the MLME-SCAN.request from IEEE Std 802.11. + * TU is 1.024 ms. If these are set to 0, driver is expected to use + * reasonable default values. min_channel_time defines the time that + * will be used to wait for the first reply on each channel. If no + * replies are received, next channel will be scanned after this. If + * replies are received, total time waited on the channel is defined by + * max_channel_time. + */ + __u32 min_channel_time; /* in TU */ + __u32 max_channel_time; /* in TU */ + + struct iw_freq channel_list[IW_MAX_FREQUENCIES]; +}; + +/* ------------------------- WPA SUPPORT ------------------------- */ + +/* + * Extended data structure for get/set encoding (this is used with + * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_* + * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and + * only the data contents changes (key data -> this structure, including + * key data). + * + * If the new key is the first group key, it will be set as the default + * TX key. Otherwise, default TX key index is only changed if + * IW_ENCODE_EXT_SET_TX_KEY flag is set. + * + * Key will be changed with SIOCSIWENCODEEXT in all cases except for + * special "change TX key index" operation which is indicated by setting + * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY. + * + * tx_seq/rx_seq are only used when respective + * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal + * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start + * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally + * used only by an Authenticator (AP or an IBSS station) to get the + * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and + * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for + * debugging/testing. + */ +struct iw_encode_ext +{ + __u32 ext_flags; /* IW_ENCODE_EXT_* */ + __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ + __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ + struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast + * (group) keys or unicast address for + * individual keys */ + __u16 alg; /* IW_ENCODE_ALG_* */ + __u16 key_len; + __u8 key[0]; +}; + +/* SIOCSIWMLME data */ +struct iw_mlme +{ + __u16 cmd; /* IW_MLME_* */ + __u16 reason_code; + struct sockaddr addr; +}; + +/* SIOCSIWPMKSA data */ +#define IW_PMKSA_ADD 1 +#define IW_PMKSA_REMOVE 2 +#define IW_PMKSA_FLUSH 3 + +#define IW_PMKID_LEN 16 + +struct iw_pmksa +{ + __u32 cmd; /* IW_PMKSA_* */ + struct sockaddr bssid; + __u8 pmkid[IW_PMKID_LEN]; +}; + +/* IWEVMICHAELMICFAILURE data */ +struct iw_michaelmicfailure +{ + __u32 flags; + struct sockaddr src_addr; + __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ +}; + +/* IWEVPMKIDCAND data */ +#define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */ +struct iw_pmkid_cand +{ + __u32 flags; /* IW_PMKID_CAND_* */ + __u32 index; /* the smaller the index, the higher the + * priority */ + struct sockaddr bssid; +}; + +/* ------------------------ WIRELESS STATS ------------------------ */ +/* + * Wireless statistics (used for /proc/net/wireless) + */ +struct iw_statistics +{ + __u16 status; /* Status + * - device dependent for now */ + + struct iw_quality qual; /* Quality of the link + * (instant/mean/max) */ + struct iw_discarded discard; /* Packet discarded counts */ + struct iw_missed miss; /* Packet missed counts */ +}; + +/* ------------------------ IOCTL REQUEST ------------------------ */ +/* + * This structure defines the payload of an ioctl, and is used + * below. + * + * Note that this structure should fit on the memory footprint + * of iwreq (which is the same as ifreq), which mean a max size of + * 16 octets = 128 bits. Warning, pointers might be 64 bits wide... + * You should check this when increasing the structures defined + * above in this file... + */ +union iwreq_data +{ + /* Config - generic */ + char name[IFNAMSIZ]; + /* Name : used to verify the presence of wireless extensions. + * Name of the protocol/provider... */ + + struct iw_point essid; /* Extended network name */ + struct iw_param nwid; /* network id (or domain - the cell) */ + struct iw_freq freq; /* frequency or channel : + * 0-1000 = channel + * > 1000 = frequency in Hz */ + + struct iw_param sens; /* signal level threshold */ + struct iw_param bitrate; /* default bit rate */ + struct iw_param txpower; /* default transmit power */ + struct iw_param rts; /* RTS threshold threshold */ + struct iw_param frag; /* Fragmentation threshold */ + __u32 mode; /* Operation mode */ + struct iw_param retry; /* Retry limits & lifetime */ + + struct iw_point encoding; /* Encoding stuff : tokens */ + struct iw_param power; /* PM duration/timeout */ + struct iw_quality qual; /* Quality part of statistics */ + + struct sockaddr ap_addr; /* Access point address */ + struct sockaddr addr; /* Destination address (hw/mac) */ + + struct iw_param param; /* Other small parameters */ + struct iw_point data; /* Other large parameters */ +}; + +/* + * The structure to exchange data for ioctl. + * This structure is the same as 'struct ifreq', but (re)defined for + * convenience... + * Do I need to remind you about structure size (32 octets) ? + */ +struct iwreq +{ + union + { + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */ + } ifr_ifrn; + + /* Data part (defined just above) */ + union iwreq_data u; +}; + +/* -------------------------- IOCTL DATA -------------------------- */ +/* + * For those ioctl which want to exchange mode data that what could + * fit in the above structure... + */ + +/* + * Range of parameters + */ + +struct iw_range +{ + /* Informative stuff (to choose between different interface) */ + __u32 throughput; /* To give an idea... */ + /* In theory this value should be the maximum benchmarked + * TCP/IP throughput, because with most of these devices the + * bit rate is meaningless (overhead an co) to estimate how + * fast the connection will go and pick the fastest one. + * I suggest people to play with Netperf or any benchmark... + */ + + /* NWID (or domain id) */ + __u32 min_nwid; /* Minimal NWID we are able to set */ + __u32 max_nwid; /* Maximal NWID we are able to set */ + + /* Old Frequency (backward compat - moved lower ) */ + __u16 old_num_channels; + __u8 old_num_frequency; + + /* Scan capabilities */ + __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */ + + /* Wireless event capability bitmasks */ + __u32 event_capa[6]; + + /* signal level threshold range */ + __s32 sensitivity; + + /* Quality of link & SNR stuff */ + /* Quality range (link, level, noise) + * If the quality is absolute, it will be in the range [0 ; max_qual], + * if the quality is dBm, it will be in the range [max_qual ; 0]. + * Don't forget that we use 8 bit arithmetics... */ + struct iw_quality max_qual; /* Quality of the link */ + /* This should contain the average/typical values of the quality + * indicator. This should be the threshold between a "good" and + * a "bad" link (example : monitor going from green to orange). + * Currently, user space apps like quality monitors don't have any + * way to calibrate the measurement. With this, they can split + * the range between 0 and max_qual in different quality level + * (using a geometric subdivision centered on the average). + * I expect that people doing the user space apps will feedback + * us on which value we need to put in each driver... */ + struct iw_quality avg_qual; /* Quality of the link */ + + /* Rates */ + __u8 num_bitrates; /* Number of entries in the list */ + __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */ + + /* RTS threshold */ + __s32 min_rts; /* Minimal RTS threshold */ + __s32 max_rts; /* Maximal RTS threshold */ + + /* Frag threshold */ + __s32 min_frag; /* Minimal frag threshold */ + __s32 max_frag; /* Maximal frag threshold */ + + /* Power Management duration & timeout */ + __s32 min_pmp; /* Minimal PM period */ + __s32 max_pmp; /* Maximal PM period */ + __s32 min_pmt; /* Minimal PM timeout */ + __s32 max_pmt; /* Maximal PM timeout */ + __u16 pmp_flags; /* How to decode max/min PM period */ + __u16 pmt_flags; /* How to decode max/min PM timeout */ + __u16 pm_capa; /* What PM options are supported */ + + /* Encoder stuff */ + __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */ + __u8 num_encoding_sizes; /* Number of entry in the list */ + __u8 max_encoding_tokens; /* Max number of tokens */ + /* For drivers that need a "login/passwd" form */ + __u8 encoding_login_index; /* token index for login token */ + + /* Transmit power */ + __u16 txpower_capa; /* What options are supported */ + __u8 num_txpower; /* Number of entries in the list */ + __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */ + + /* Wireless Extension version info */ + __u8 we_version_compiled; /* Must be WIRELESS_EXT */ + __u8 we_version_source; /* Last update of source */ + + /* Retry limits and lifetime */ + __u16 retry_capa; /* What retry options are supported */ + __u16 retry_flags; /* How to decode max/min retry limit */ + __u16 r_time_flags; /* How to decode max/min retry life */ + __s32 min_retry; /* Minimal number of retries */ + __s32 max_retry; /* Maximal number of retries */ + __s32 min_r_time; /* Minimal retry lifetime */ + __s32 max_r_time; /* Maximal retry lifetime */ + + /* Frequency */ + __u16 num_channels; /* Number of channels [0; num - 1] */ + __u8 num_frequency; /* Number of entry in the list */ + struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ + /* Note : this frequency list doesn't need to fit channel numbers, + * because each entry contain its channel index */ + + __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ +}; + +/* + * Private ioctl interface information + */ + +struct iw_priv_args +{ + __u32 cmd; /* Number of the ioctl to issue */ + __u16 set_args; /* Type and number of args */ + __u16 get_args; /* Type and number of args */ + char name[IFNAMSIZ]; /* Name of the extension */ +}; + +/* ----------------------- WIRELESS EVENTS ----------------------- */ +/* + * Wireless events are carried through the rtnetlink socket to user + * space. They are encapsulated in the IFLA_WIRELESS field of + * a RTM_NEWLINK message. + */ + +/* + * A Wireless Event. Contains basically the same data as the ioctl... + */ +struct iw_event +{ + __u16 len; /* Real length of this stuff */ + __u16 cmd; /* Wireless IOCTL */ + union iwreq_data u; /* IOCTL fixed payload */ +}; + +/* Size of the Event prefix (including padding and alignement junk) */ +#define IW_EV_LCP_LEN (sizeof(struct iw_event) - sizeof(union iwreq_data)) +/* Size of the various events */ +#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ) +#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32)) +#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq)) +#define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param)) +#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr)) +#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) + +/* iw_point events are special. First, the payload (extra data) come at + * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second, + * we omit the pointer, so start at an offset. */ +#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \ + (char *) NULL) +#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ + IW_EV_POINT_OFF) + + +/* Size of the Event prefix when packed in stream */ +#define IW_EV_LCP_PK_LEN (4) +/* Size of the various events when packed in stream */ +#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ) +#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32)) +#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq)) +#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param)) +#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr)) +#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality)) +#define IW_EV_POINT_PK_LEN (IW_EV_LCP_LEN + 4) + +#endif /* _LINUX_WIRELESS_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/x25.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/x25.h new file mode 100644 index 0000000..d035e4e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/x25.h @@ -0,0 +1,150 @@ +/* + * These are the public elements of the Linux kernel X.25 implementation. + * + * History + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * negotiation. + * apr/02/05 Shaun Pereira Selective sub address matching with + * call user data + */ + +#ifndef X25_KERNEL_H +#define X25_KERNEL_H + +#include + +#define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0) +#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1) +#define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2) +#define SIOCX25SFACILITIES (SIOCPROTOPRIVATE + 3) +#define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4) +#define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5) +#define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6) +#define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7) +#define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8) +#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) +#define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) +#define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) + +/* + * Values for {get,set}sockopt. + */ +#define X25_QBITINCL 1 + +/* + * X.25 Packet Size values. + */ +#define X25_PS16 4 +#define X25_PS32 5 +#define X25_PS64 6 +#define X25_PS128 7 +#define X25_PS256 8 +#define X25_PS512 9 +#define X25_PS1024 10 +#define X25_PS2048 11 +#define X25_PS4096 12 + +/* + * An X.121 address, it is held as ASCII text, null terminated, up to 15 + * digits and a null terminator. + */ +struct x25_address { + char x25_addr[16]; +}; + +/* + * Linux X.25 Address structure, used for bind, and connect mostly. + */ +struct sockaddr_x25 { + sa_family_t sx25_family; /* Must be AF_X25 */ + struct x25_address sx25_addr; /* X.121 Address */ +}; + +/* + * DTE/DCE subscription options. + * + * As this is missing lots of options, user should expect major + * changes of this structure in 2.5.x which might break compatibilty. + * The somewhat ugly dimension 200-sizeof() is needed to maintain + * backward compatibility. + */ +struct x25_subscrip_struct { + char device[200-sizeof(unsigned long)]; + unsigned long global_facil_mask; /* 0 to disable negotiation */ + unsigned int extended; +}; + +/* values for above global_facil_mask */ + +#define X25_MASK_REVERSE 0x01 +#define X25_MASK_THROUGHPUT 0x02 +#define X25_MASK_PACKET_SIZE 0x04 +#define X25_MASK_WINDOW_SIZE 0x08 + +#define X25_MASK_CALLING_AE 0x10 +#define X25_MASK_CALLED_AE 0x20 + + +/* + * Routing table control structure. + */ +struct x25_route_struct { + struct x25_address address; + unsigned int sigdigits; + char device[200]; +}; + +/* + * Facilities structure. + */ +struct x25_facilities { + unsigned int winsize_in, winsize_out; + unsigned int pacsize_in, pacsize_out; + unsigned int throughput; + unsigned int reverse; +}; + +/* +* ITU DTE facilities +* Only the called and calling address +* extension are currently implemented. +* The rest are in place to avoid the struct +* changing size if someone needs them later +*/ + +struct x25_dte_facilities { + __u16 delay_cumul; + __u16 delay_target; + __u16 delay_max; + __u8 min_throughput; + __u8 expedited; + __u8 calling_len; + __u8 called_len; + __u8 calling_ae[20]; + __u8 called_ae[20]; +}; + +/* + * Call User Data structure. + */ +struct x25_calluserdata { + unsigned int cudlength; + unsigned char cuddata[128]; +}; + +/* + * Call clearing Cause and Diagnostic structure. + */ +struct x25_causediag { + unsigned char cause; + unsigned char diagnostic; +}; + +/* + * Further optional call user data match length selection + */ +struct x25_subaddr { + unsigned int cudmatchlength; +}; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/xattr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/xattr.h new file mode 100644 index 0000000..82ca33c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/xattr.h @@ -0,0 +1,17 @@ +/* + File: linux/xattr.h + + Extended attributes handling. + + Copyright (C) 2001 by Andreas Gruenbacher + Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved. + Copyright (c) 2004 Red Hat, Inc., James Morris +*/ +#ifndef _LINUX_XATTR_H +#define _LINUX_XATTR_H + +#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ +#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ + + +#endif /* _LINUX_XATTR_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/xfrm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/xfrm.h new file mode 100644 index 0000000..a59bc4a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/linux/xfrm.h @@ -0,0 +1,483 @@ +#ifndef _LINUX_XFRM_H +#define _LINUX_XFRM_H + +#include + +/* All of the structures in this file may not change size as they are + * passed into the kernel from userspace via netlink sockets. + */ + +/* Structure to encapsulate addresses. I do not want to use + * "standard" structure. My apologies. + */ +typedef union +{ + __be32 a4; + __be32 a6[4]; +} xfrm_address_t; + +/* Ident of a specific xfrm_state. It is used on input to lookup + * the state by (spi,daddr,ah/esp) or to store information about + * spi, protocol and tunnel address on output. + */ +struct xfrm_id +{ + xfrm_address_t daddr; + __be32 spi; + __u8 proto; +}; + +struct xfrm_sec_ctx { + __u8 ctx_doi; + __u8 ctx_alg; + __u16 ctx_len; + __u32 ctx_sid; + char ctx_str[0]; +}; + +/* Security Context Domains of Interpretation */ +#define XFRM_SC_DOI_RESERVED 0 +#define XFRM_SC_DOI_LSM 1 + +/* Security Context Algorithms */ +#define XFRM_SC_ALG_RESERVED 0 +#define XFRM_SC_ALG_SELINUX 1 + +/* Selector, used as selector both on policy rules (SPD) and SAs. */ + +struct xfrm_selector +{ + xfrm_address_t daddr; + xfrm_address_t saddr; + __be16 dport; + __be16 dport_mask; + __be16 sport; + __be16 sport_mask; + __u16 family; + __u8 prefixlen_d; + __u8 prefixlen_s; + __u8 proto; + int ifindex; + __kernel_uid32_t user; +}; + +#define XFRM_INF (~(__u64)0) + +struct xfrm_lifetime_cfg +{ + __u64 soft_byte_limit; + __u64 hard_byte_limit; + __u64 soft_packet_limit; + __u64 hard_packet_limit; + __u64 soft_add_expires_seconds; + __u64 hard_add_expires_seconds; + __u64 soft_use_expires_seconds; + __u64 hard_use_expires_seconds; +}; + +struct xfrm_lifetime_cur +{ + __u64 bytes; + __u64 packets; + __u64 add_time; + __u64 use_time; +}; + +struct xfrm_replay_state +{ + __u32 oseq; + __u32 seq; + __u32 bitmap; +}; + +struct xfrm_algo { + char alg_name[64]; + unsigned int alg_key_len; /* in bits */ + char alg_key[0]; +}; + +struct xfrm_algo_aead { + char alg_name[64]; + unsigned int alg_key_len; /* in bits */ + unsigned int alg_icv_len; /* in bits */ + char alg_key[0]; +}; + +struct xfrm_stats { + __u32 replay_window; + __u32 replay; + __u32 integrity_failed; +}; + +enum +{ + XFRM_POLICY_TYPE_MAIN = 0, + XFRM_POLICY_TYPE_SUB = 1, + XFRM_POLICY_TYPE_MAX = 2, + XFRM_POLICY_TYPE_ANY = 255 +}; + +enum +{ + XFRM_POLICY_IN = 0, + XFRM_POLICY_OUT = 1, + XFRM_POLICY_FWD = 2, + XFRM_POLICY_MASK = 3, + XFRM_POLICY_MAX = 3 +}; + +enum +{ + XFRM_SHARE_ANY, /* No limitations */ + XFRM_SHARE_SESSION, /* For this session only */ + XFRM_SHARE_USER, /* For this user only */ + XFRM_SHARE_UNIQUE /* Use once */ +}; + +#define XFRM_MODE_TRANSPORT 0 +#define XFRM_MODE_TUNNEL 1 +#define XFRM_MODE_ROUTEOPTIMIZATION 2 +#define XFRM_MODE_IN_TRIGGER 3 +#define XFRM_MODE_BEET 4 +#define XFRM_MODE_MAX 5 + +/* Netlink configuration messages. */ +enum { + XFRM_MSG_BASE = 0x10, + + XFRM_MSG_NEWSA = 0x10, +#define XFRM_MSG_NEWSA XFRM_MSG_NEWSA + XFRM_MSG_DELSA, +#define XFRM_MSG_DELSA XFRM_MSG_DELSA + XFRM_MSG_GETSA, +#define XFRM_MSG_GETSA XFRM_MSG_GETSA + + XFRM_MSG_NEWPOLICY, +#define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY + XFRM_MSG_DELPOLICY, +#define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY + XFRM_MSG_GETPOLICY, +#define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY + + XFRM_MSG_ALLOCSPI, +#define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI + XFRM_MSG_ACQUIRE, +#define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE + XFRM_MSG_EXPIRE, +#define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE + + XFRM_MSG_UPDPOLICY, +#define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY + XFRM_MSG_UPDSA, +#define XFRM_MSG_UPDSA XFRM_MSG_UPDSA + + XFRM_MSG_POLEXPIRE, +#define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE + + XFRM_MSG_FLUSHSA, +#define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA + XFRM_MSG_FLUSHPOLICY, +#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY + + XFRM_MSG_NEWAE, +#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE + XFRM_MSG_GETAE, +#define XFRM_MSG_GETAE XFRM_MSG_GETAE + + XFRM_MSG_REPORT, +#define XFRM_MSG_REPORT XFRM_MSG_REPORT + + XFRM_MSG_MIGRATE, +#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE + + XFRM_MSG_NEWSADINFO, +#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO + XFRM_MSG_GETSADINFO, +#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO + + XFRM_MSG_NEWSPDINFO, +#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO + XFRM_MSG_GETSPDINFO, +#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO + + XFRM_MSG_MAPPING, +#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING + __XFRM_MSG_MAX +}; +#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) + +#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) + +/* + * Generic LSM security context for comunicating to user space + * NOTE: Same format as sadb_x_sec_ctx + */ +struct xfrm_user_sec_ctx { + __u16 len; + __u16 exttype; + __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ + __u8 ctx_doi; + __u16 ctx_len; +}; + +struct xfrm_user_tmpl { + struct xfrm_id id; + __u16 family; + xfrm_address_t saddr; + __u32 reqid; + __u8 mode; + __u8 share; + __u8 optional; + __u32 aalgos; + __u32 ealgos; + __u32 calgos; +}; + +struct xfrm_encap_tmpl { + __u16 encap_type; + __be16 encap_sport; + __be16 encap_dport; + xfrm_address_t encap_oa; +}; + +/* AEVENT flags */ +enum xfrm_ae_ftype_t { + XFRM_AE_UNSPEC, + XFRM_AE_RTHR=1, /* replay threshold*/ + XFRM_AE_RVAL=2, /* replay value */ + XFRM_AE_LVAL=4, /* lifetime value */ + XFRM_AE_ETHR=8, /* expiry timer threshold */ + XFRM_AE_CR=16, /* Event cause is replay update */ + XFRM_AE_CE=32, /* Event cause is timer expiry */ + XFRM_AE_CU=64, /* Event cause is policy update */ + __XFRM_AE_MAX + +#define XFRM_AE_MAX (__XFRM_AE_MAX - 1) +}; + +struct xfrm_userpolicy_type { + __u8 type; + __u16 reserved1; + __u8 reserved2; +}; + +/* Netlink message attributes. */ +enum xfrm_attr_type_t { + XFRMA_UNSPEC, + XFRMA_ALG_AUTH, /* struct xfrm_algo */ + XFRMA_ALG_CRYPT, /* struct xfrm_algo */ + XFRMA_ALG_COMP, /* struct xfrm_algo */ + XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ + XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ + XFRMA_SA, + XFRMA_POLICY, + XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ + XFRMA_LTIME_VAL, + XFRMA_REPLAY_VAL, + XFRMA_REPLAY_THRESH, + XFRMA_ETIMER_THRESH, + XFRMA_SRCADDR, /* xfrm_address_t */ + XFRMA_COADDR, /* xfrm_address_t */ + XFRMA_LASTUSED, + XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ + XFRMA_MIGRATE, + XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ + XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ + __XFRMA_MAX + +#define XFRMA_MAX (__XFRMA_MAX - 1) +}; + +enum xfrm_sadattr_type_t { + XFRMA_SAD_UNSPEC, + XFRMA_SAD_CNT, + XFRMA_SAD_HINFO, + __XFRMA_SAD_MAX + +#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) +}; + +struct xfrmu_sadhinfo { + __u32 sadhcnt; /* current hash bkts */ + __u32 sadhmcnt; /* max allowed hash bkts */ +}; + +enum xfrm_spdattr_type_t { + XFRMA_SPD_UNSPEC, + XFRMA_SPD_INFO, + XFRMA_SPD_HINFO, + __XFRMA_SPD_MAX + +#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) +}; + +struct xfrmu_spdinfo { + __u32 incnt; + __u32 outcnt; + __u32 fwdcnt; + __u32 inscnt; + __u32 outscnt; + __u32 fwdscnt; +}; + +struct xfrmu_spdhinfo { + __u32 spdhcnt; + __u32 spdhmcnt; +}; + +struct xfrm_usersa_info { + struct xfrm_selector sel; + struct xfrm_id id; + xfrm_address_t saddr; + struct xfrm_lifetime_cfg lft; + struct xfrm_lifetime_cur curlft; + struct xfrm_stats stats; + __u32 seq; + __u32 reqid; + __u16 family; + __u8 mode; /* XFRM_MODE_xxx */ + __u8 replay_window; + __u8 flags; +#define XFRM_STATE_NOECN 1 +#define XFRM_STATE_DECAP_DSCP 2 +#define XFRM_STATE_NOPMTUDISC 4 +#define XFRM_STATE_WILDRECV 8 +#define XFRM_STATE_ICMP 16 +#define XFRM_STATE_AF_UNSPEC 32 +}; + +struct xfrm_usersa_id { + xfrm_address_t daddr; + __be32 spi; + __u16 family; + __u8 proto; +}; + +struct xfrm_aevent_id { + struct xfrm_usersa_id sa_id; + xfrm_address_t saddr; + __u32 flags; + __u32 reqid; +}; + +struct xfrm_userspi_info { + struct xfrm_usersa_info info; + __u32 min; + __u32 max; +}; + +struct xfrm_userpolicy_info { + struct xfrm_selector sel; + struct xfrm_lifetime_cfg lft; + struct xfrm_lifetime_cur curlft; + __u32 priority; + __u32 index; + __u8 dir; + __u8 action; +#define XFRM_POLICY_ALLOW 0 +#define XFRM_POLICY_BLOCK 1 + __u8 flags; +#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ + /* Automatically expand selector to include matching ICMP payloads. */ +#define XFRM_POLICY_ICMP 2 + __u8 share; +}; + +struct xfrm_userpolicy_id { + struct xfrm_selector sel; + __u32 index; + __u8 dir; +}; + +struct xfrm_user_acquire { + struct xfrm_id id; + xfrm_address_t saddr; + struct xfrm_selector sel; + struct xfrm_userpolicy_info policy; + __u32 aalgos; + __u32 ealgos; + __u32 calgos; + __u32 seq; +}; + +struct xfrm_user_expire { + struct xfrm_usersa_info state; + __u8 hard; +}; + +struct xfrm_user_polexpire { + struct xfrm_userpolicy_info pol; + __u8 hard; +}; + +struct xfrm_usersa_flush { + __u8 proto; +}; + +struct xfrm_user_report { + __u8 proto; + struct xfrm_selector sel; +}; + +/* Used by MIGRATE to pass addresses IKE should use to perform + * SA negotiation with the peer */ +struct xfrm_user_kmaddress { + xfrm_address_t local; + xfrm_address_t remote; + __u32 reserved; + __u16 family; +}; + +struct xfrm_user_migrate { + xfrm_address_t old_daddr; + xfrm_address_t old_saddr; + xfrm_address_t new_daddr; + xfrm_address_t new_saddr; + __u8 proto; + __u8 mode; + __u16 reserved; + __u32 reqid; + __u16 old_family; + __u16 new_family; +}; + +struct xfrm_user_mapping { + struct xfrm_usersa_id id; + __u32 reqid; + xfrm_address_t old_saddr; + xfrm_address_t new_saddr; + __be16 old_sport; + __be16 new_sport; +}; + +/* backwards compatibility for userspace */ +#define XFRMGRP_ACQUIRE 1 +#define XFRMGRP_EXPIRE 2 +#define XFRMGRP_SA 4 +#define XFRMGRP_POLICY 8 +#define XFRMGRP_REPORT 0x20 + +enum xfrm_nlgroups { + XFRMNLGRP_NONE, +#define XFRMNLGRP_NONE XFRMNLGRP_NONE + XFRMNLGRP_ACQUIRE, +#define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE + XFRMNLGRP_EXPIRE, +#define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE + XFRMNLGRP_SA, +#define XFRMNLGRP_SA XFRMNLGRP_SA + XFRMNLGRP_POLICY, +#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY + XFRMNLGRP_AEVENTS, +#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS + XFRMNLGRP_REPORT, +#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT + XFRMNLGRP_MIGRATE, +#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE + XFRMNLGRP_MAPPING, +#define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING + __XFRMNLGRP_MAX +}; +#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) + +#endif /* _LINUX_XFRM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/locale.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/locale.h new file mode 100644 index 0000000..02d33a0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/locale.h @@ -0,0 +1,225 @@ +/* Copyright (C) 1991,92,95-99,2000,01,02 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.11 Localization + */ + +#ifndef _LOCALE_H +#define _LOCALE_H 1 + +#include + +#define __need_NULL +#include +#include + +__BEGIN_DECLS + +/* These are the possibilities for the first argument to setlocale. + The code assumes that the lowest LC_* symbol has the value zero. */ +#define LC_CTYPE __LC_CTYPE +#define LC_NUMERIC __LC_NUMERIC +#define LC_TIME __LC_TIME +#define LC_COLLATE __LC_COLLATE +#define LC_MONETARY __LC_MONETARY +#define LC_MESSAGES __LC_MESSAGES +#if 0 +#define LC_PAPER __LC_PAPER +#define LC_NAME __LC_NAME +#define LC_ADDRESS __LC_ADDRESS +#define LC_TELEPHONE __LC_TELEPHONE +#define LC_MEASUREMENT __LC_MEASUREMENT +#define LC_IDENTIFICATION __LC_IDENTIFICATION +#endif +#define LC_ALL __LC_ALL + + +/* Structure giving information about numeric and monetary notation. */ +struct lconv +{ + /* Numeric (non-monetary) information. */ + + char *decimal_point; /* Decimal point character. */ + char *thousands_sep; /* Thousands separator. */ + /* Each element is the number of digits in each group; + elements with higher indices are farther left. + An element with value CHAR_MAX means that no further grouping is done. + An element with value 0 means that the previous element is used + for all groups farther left. */ + char *grouping; + + /* Monetary information. */ + + /* First three chars are a currency symbol from ISO 4217. + Fourth char is the separator. Fifth char is '\0'. */ + char *int_curr_symbol; + char *currency_symbol; /* Local currency symbol. */ + char *mon_decimal_point; /* Decimal point character. */ + char *mon_thousands_sep; /* Thousands separator. */ + char *mon_grouping; /* Like `grouping' element (above). */ + char *positive_sign; /* Sign for positive values. */ + char *negative_sign; /* Sign for negative values. */ + char int_frac_digits; /* Int'l fractional digits. */ + char frac_digits; /* Local fractional digits. */ + /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */ + char p_cs_precedes; + /* 1 iff a space separates currency_symbol from a positive value. */ + char p_sep_by_space; + /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */ + char n_cs_precedes; + /* 1 iff a space separates currency_symbol from a negative value. */ + char n_sep_by_space; + /* Positive and negative sign positions: + 0 Parentheses surround the quantity and currency_symbol. + 1 The sign string precedes the quantity and currency_symbol. + 2 The sign string follows the quantity and currency_symbol. + 3 The sign string immediately precedes the currency_symbol. + 4 The sign string immediately follows the currency_symbol. */ + char p_sign_posn; + char n_sign_posn; +#ifdef __USE_ISOC99 + /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */ + char int_p_cs_precedes; + /* 1 iff a space separates int_curr_symbol from a positive value. */ + char int_p_sep_by_space; + /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */ + char int_n_cs_precedes; + /* 1 iff a space separates int_curr_symbol from a negative value. */ + char int_n_sep_by_space; + /* Positive and negative sign positions: + 0 Parentheses surround the quantity and int_curr_symbol. + 1 The sign string precedes the quantity and int_curr_symbol. + 2 The sign string follows the quantity and int_curr_symbol. + 3 The sign string immediately precedes the int_curr_symbol. + 4 The sign string immediately follows the int_curr_symbol. */ + char int_p_sign_posn; + char int_n_sign_posn; +#else + char __int_p_cs_precedes; + char __int_p_sep_by_space; + char __int_n_cs_precedes; + char __int_n_sep_by_space; + char __int_p_sign_posn; + char __int_n_sign_posn; +#endif +}; + + +__BEGIN_NAMESPACE_STD + +/* Set and/or return the current locale. */ +extern char *setlocale (int __category, __const char *__locale) __THROW; + +/* Return the numeric/monetary information for the current locale. */ +extern struct lconv *localeconv (void) __THROW; + +__END_NAMESPACE_STD + + +#if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__) +/* The concept of one static locale per category is not very well + thought out. Many applications will need to process its data using + information from several different locales. Another application is + the implementation of the internationalization handling in the + upcoming ISO C++ standard library. To support this another set of + the functions using locale data exist which have an additional + argument. + + Attention: all these functions are *not* standardized in any form. + This is a proof-of-concept implementation. */ + +/* Get locale datatype definition. */ +# include + +typedef __locale_t locale_t; + +/* Return a reference to a data structure representing a set of locale + datasets. Unlike for the CATEGORY parameter for `setlocale' the + CATEGORY_MASK parameter here uses a single bit for each category, + made by OR'ing together LC_*_MASK bits above. */ +extern __locale_t newlocale (int __category_mask, __const char *__locale, + __locale_t __base) __THROW; + +/* These are the bits that can be set in the CATEGORY_MASK argument to + `newlocale'. In the GNU implementation, LC_FOO_MASK has the value + of (1 << LC_FOO), but this is not a part of the interface that + callers can assume will be true. */ +# define LC_CTYPE_MASK (1 << __LC_CTYPE) +# define LC_NUMERIC_MASK (1 << __LC_NUMERIC) +# define LC_TIME_MASK (1 << __LC_TIME) +# define LC_COLLATE_MASK (1 << __LC_COLLATE) +# define LC_MONETARY_MASK (1 << __LC_MONETARY) +# define LC_MESSAGES_MASK (1 << __LC_MESSAGES) +#ifdef L_newlocale +#warning mask defines for extra locale categories +#endif /* L_newlocale - uClibc note */ +#ifdef LC_PAPER +# define LC_PAPER_MASK (1 << __LC_PAPER) +# define LC_NAME_MASK (1 << __LC_NAME) +# define LC_ADDRESS_MASK (1 << __LC_ADDRESS) +# define LC_TELEPHONE_MASK (1 << __LC_TELEPHONE) +# define LC_MEASUREMENT_MASK (1 << __LC_MEASUREMENT) +# define LC_IDENTIFICATION_MASK (1 << __LC_IDENTIFICATION) +# define LC_ALL_MASK (LC_CTYPE_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK \ + | LC_COLLATE_MASK \ + | LC_MONETARY_MASK \ + | LC_MESSAGES_MASK \ + | LC_PAPER_MASK \ + | LC_NAME_MASK \ + | LC_ADDRESS_MASK \ + | LC_TELEPHONE_MASK \ + | LC_MEASUREMENT_MASK \ + | LC_IDENTIFICATION_MASK \ + ) +#else /* LC_PAPER */ +# define LC_ALL_MASK (LC_CTYPE_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK \ + | LC_COLLATE_MASK \ + | LC_MONETARY_MASK \ + | LC_MESSAGES_MASK \ + ) +#endif /* LC_PAPER */ + +/* Return a duplicate of the set of locale in DATASET. All usage + counters are increased if necessary. */ +extern __locale_t duplocale (__locale_t __dataset) __THROW; + +/* Free the data associated with a locale dataset previously returned + by a call to `setlocale_r'. */ +extern void freelocale (__locale_t __dataset) __THROW; + +/* Switch the current thread's locale to DATASET. + If DATASET is null, instead just return the current setting. + The special value LC_GLOBAL_LOCALE is the initial setting + for all threads and can also be installed any time, meaning + the thread uses the global settings controlled by `setlocale'. */ +extern __locale_t uselocale (__locale_t __dataset) __THROW; + +/* This value can be passed to `uselocale' and may be returned by it. + Passing this value to any other function has undefined behavior. */ +# define LC_GLOBAL_LOCALE ((__locale_t) -1L) + +#endif + +__END_DECLS + +#endif /* locale.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/malloc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/malloc.h new file mode 100644 index 0000000..354f153 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/malloc.h @@ -0,0 +1,191 @@ +/* Prototypes and definition for malloc implementation. + Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MALLOC_H +#define _MALLOC_H 1 + +#include + +/* + `ptmalloc', a malloc implementation for multiple threads without + lock contention, by Wolfram Gloger . + See the files `ptmalloc.c' or `COPYRIGHT' for copying conditions. + + VERSION 2.6.4-pt Wed Dec 4 00:35:54 MET 1996 + + This work is mainly derived from malloc-2.6.4 by Doug Lea + , which is available from: + + ftp://g.oswego.edu/pub/misc/malloc.c + + This trimmed-down header file only provides function prototypes and + the exported data structures. For more detailed function + descriptions and compile-time options, see the source file + `ptmalloc.c'. +*/ + +#if defined(__STDC__) || defined (__cplusplus) +# include +# define __malloc_ptr_t void * +#else +# undef size_t +# define size_t unsigned int +# undef ptrdiff_t +# define ptrdiff_t int +# define __malloc_ptr_t char * +#endif + +#ifdef _LIBC +/* Used by GNU libc internals. */ +# define __malloc_size_t size_t +# define __malloc_ptrdiff_t ptrdiff_t +#elif !defined __attribute_malloc__ +# define __attribute_malloc__ +#endif + +#ifdef __GNUC__ + +/* GCC can always grok prototypes. For C++ programs we add throw() + to help it optimize the function calls. But this works only with + gcc 2.8.x and egcs. */ +#ifndef __THROW +# if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif +# define __MALLOC_P(args) args __THROW +/* This macro will be used for functions which might take C++ callback + functions. */ +# define __MALLOC_PMT(args) args + +#else /* Not GCC. */ + +# define __THROW + +# if (defined __STDC__ && __STDC__) || defined __cplusplus + +# define __MALLOC_P(args) args +# define __MALLOC_PMT(args) args + +# else /* Not ANSI C or C++. */ + +# define __MALLOC_P(args) () /* No prototypes. */ +# define __MALLOC_PMT(args) () + +# endif /* ANSI C or C++. */ + +#endif /* GCC. */ + +#ifndef NULL +# ifdef __cplusplus +# define NULL 0 +# else +# define NULL ((__malloc_ptr_t) 0) +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Allocate SIZE bytes of memory. */ +extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size)) __attribute_malloc__; + +/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ +extern __malloc_ptr_t calloc __MALLOC_P ((size_t __nmemb, size_t __size)) + __attribute_malloc__; + +/* Re-allocate the previously allocated block in __ptr, making the new + block SIZE bytes long. */ +extern __malloc_ptr_t realloc __MALLOC_P ((__malloc_ptr_t __ptr, + size_t __size)) + __attribute_malloc__; + +/* Free a block allocated by `malloc', `realloc' or `calloc'. */ +extern void free __MALLOC_P ((__malloc_ptr_t __ptr)); + +/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ +extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size)); + +/* Allocate SIZE bytes on a page boundary. */ +extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__; + +#ifdef __MALLOC_STANDARD__ + +/* SVID2/XPG mallinfo structure */ +struct mallinfo { + int arena; /* total space allocated from system */ + int ordblks; /* number of non-inuse chunks */ + int smblks; /* unused -- always zero */ + int hblks; /* number of mmapped regions */ + int hblkhd; /* total space in mmapped regions */ + int usmblks; /* unused -- always zero */ + int fsmblks; /* unused -- always zero */ + int uordblks; /* total allocated space */ + int fordblks; /* total non-inuse space */ + int keepcost; /* top-most, releasable (via malloc_trim) space */ +}; + +/* Returns a copy of the updated current mallinfo. */ +extern struct mallinfo mallinfo __MALLOC_P ((void)); + +/* Release all but __pad bytes of freed top-most memory back to the + system. Return 1 if successful, else 0. */ +extern int malloc_trim(size_t pad); + +#include +/* Prints brief summary statistics to the specified file. + * Writes to stderr if file is NULL. */ +extern void malloc_stats(FILE *file); + +/* SVID2/XPG mallopt options */ +#ifndef M_MXFAST +# define M_MXFAST 1 /* UNUSED in this malloc */ +#endif +#ifndef M_NLBLKS +# define M_NLBLKS 2 /* UNUSED in this malloc */ +#endif +#ifndef M_GRAIN +# define M_GRAIN 3 /* UNUSED in this malloc */ +#endif +#ifndef M_KEEP +# define M_KEEP 4 /* UNUSED in this malloc */ +#endif + +/* mallopt options that actually do something */ +#define M_TRIM_THRESHOLD -1 +#define M_TOP_PAD -2 +#define M_MMAP_THRESHOLD -3 +#define M_MMAP_MAX -4 +#define M_CHECK_ACTION -5 +#define M_PERTURB -6 + +/* General SVID/XPG interface to tunable parameters. */ +extern int mallopt __MALLOC_P ((int __param, int __val)); + +#endif /* __MALLOC_STANDARD__ */ + + +#ifdef __cplusplus +} /* end of extern "C" */ +#endif + +#endif /* malloc.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/math.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/math.h new file mode 100644 index 0000000..c50b2e7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/math.h @@ -0,0 +1,468 @@ +/* Declarations for math functions. + Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.12 Mathematics + */ + +#ifndef _MATH_H +#define _MATH_H 1 + +#include + +__BEGIN_DECLS + +/* Get machine-dependent HUGE_VAL value (returned on overflow). + On all IEEE754 machines, this is +Infinity. */ +#include +#ifdef __USE_ISOC99 +# include +# include + +/* Get machine-dependent INFINITY value. */ +# include + +/* Get machine-dependent NAN value (returned for some domain errors). */ +# include +#endif /* __USE_ISOC99 */ + +/* Get general and ISO C99 specific information. */ +#include + +/* The file contains the prototypes for all the + actual math functions. These macros are used for those prototypes, + so we can easily declare each function as both `name' and `__name', + and can declare the float versions `namef' and `__namef'. */ + +#define __MATHCALL(function,suffix, args) \ + __MATHDECL (_Mdouble_,function,suffix, args) +#define __MATHDECL(type, function,suffix, args) \ + __MATHDECL_1(type, function,suffix, args); \ + __MATHDECL_1(type, __CONCAT(__,function),suffix, args) +#define __MATHCALLX(function,suffix, args, attrib) \ + __MATHDECLX (_Mdouble_,function,suffix, args, attrib) +#define __MATHDECLX(type, function,suffix, args, attrib) \ + __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \ + __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib) +#define __MATHDECL_1(type, function,suffix, args) \ + extern type __MATH_PRECNAME(function,suffix) args __THROW + +#define _Mdouble_ double +#define __MATH_PRECNAME(name,r) __CONCAT(name,r) +# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD +# define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD +#include +#undef _Mdouble_ +#undef _Mdouble_BEGIN_NAMESPACE +#undef _Mdouble_END_NAMESPACE +#undef __MATH_PRECNAME + +#if defined __USE_MISC || defined __USE_ISOC99 + + +/* Include the file of declarations again, this time using `float' + instead of `double' and appending f to each function name. */ + +# ifndef _Mfloat_ +# define _Mfloat_ float +# endif +# define _Mdouble_ _Mfloat_ +# ifdef __STDC__ +# define __MATH_PRECNAME(name,r) name##f##r +# else +# define __MATH_PRECNAME(name,r) name/**/f/**/r +# endif +# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99 +# define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99 +# include +# undef _Mdouble_ +# undef _Mdouble_BEGIN_NAMESPACE +# undef _Mdouble_END_NAMESPACE +# undef __MATH_PRECNAME + +# if (__STDC__ - 0 || __GNUC__ - 0) \ + && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT) +# ifdef __LDBL_COMPAT + +# ifdef __USE_ISOC99 +extern float __nldbl_nexttowardf (float __x, long double __y) + __THROW __attribute__ ((__const__)); +# ifdef __REDIRECT_NTH +extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y), + __nldbl_nexttowardf) + __attribute__ ((__const__)); +extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), + nextafter) __attribute__ ((__const__)); +extern long double __REDIRECT_NTH (nexttowardl, + (long double __x, long double __y), + nextafter) __attribute__ ((__const__)); +# endif +# endif + +/* Include the file of declarations again, this time using `long double' + instead of `double' and appending l to each function name. */ + +# undef __MATHDECL_1 +# define __MATHDECL_2(type, function,suffix, args, alias) \ + extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix), \ + args, alias) +# define __MATHDECL_1(type, function,suffix, args) \ + __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix)) +# endif + +# ifndef _Mlong_double_ +# define _Mlong_double_ long double +# endif +# define _Mdouble_ _Mlong_double_ +# ifdef __STDC__ +# define __MATH_PRECNAME(name,r) name##l##r +# else +# define __MATH_PRECNAME(name,r) name/**/l/**/r +# endif +# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99 +# define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99 +# include +# undef _Mdouble_ +# undef _Mdouble_BEGIN_NAMESPACE +# undef _Mdouble_END_NAMESPACE +# undef __MATH_PRECNAME + +# endif /* __STDC__ || __GNUC__ */ + +#endif /* Use misc or ISO C99. */ +#undef __MATHDECL_1 +#undef __MATHDECL +#undef __MATHCALL + + +#if defined __USE_MISC || defined __USE_XOPEN +/* This variable is used by `gamma' and `lgamma'. */ +extern int signgam; +#endif + + +/* ISO C99 defines some generic macros which work on any data type. */ +#ifdef __USE_ISOC99 + +/* Get the architecture specific values describing the floating-point + evaluation. The following symbols will get defined: + + float_t floating-point type at least as wide as `float' used + to evaluate `float' expressions + double_t floating-point type at least as wide as `double' used + to evaluate `double' expressions + + FLT_EVAL_METHOD + Defined to + 0 if `float_t' is `float' and `double_t' is `double' + 1 if `float_t' and `double_t' are `double' + 2 if `float_t' and `double_t' are `long double' + else `float_t' and `double_t' are unspecified + + INFINITY representation of the infinity value of type `float' + + FP_FAST_FMA + FP_FAST_FMAF + FP_FAST_FMAL + If defined it indicates that the `fma' function + generally executes about as fast as a multiply and an add. + This macro is defined only iff the `fma' function is + implemented directly with a hardware multiply-add instructions. + + FP_ILOGB0 Expands to a value returned by `ilogb (0.0)'. + FP_ILOGBNAN Expands to a value returned by `ilogb (NAN)'. + + DECIMAL_DIG Number of decimal digits supported by conversion between + decimal and all internal floating-point formats. + +*/ + +/* All floating-point numbers can be put in one of these categories. */ +enum + { + FP_NAN, +# define FP_NAN FP_NAN + FP_INFINITE, +# define FP_INFINITE FP_INFINITE + FP_ZERO, +# define FP_ZERO FP_ZERO + FP_SUBNORMAL, +# define FP_SUBNORMAL FP_SUBNORMAL + FP_NORMAL +# define FP_NORMAL FP_NORMAL + }; + +/* Return number of classification appropriate for X. */ +# ifdef __NO_LONG_DOUBLE_MATH +# define fpclassify(x) \ + (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x)) +# else +# define fpclassify(x) \ + (sizeof (x) == sizeof (float) \ + ? __fpclassifyf (x) \ + : sizeof (x) == sizeof (double) \ + ? __fpclassify (x) : __fpclassifyl (x)) +# endif + +/* Return nonzero value if sign of X is negative. */ +# ifdef __NO_LONG_DOUBLE_MATH +# define signbit(x) \ + (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x)) +# else +# define signbit(x) \ + (sizeof (x) == sizeof (float) \ + ? __signbitf (x) \ + : sizeof (x) == sizeof (double) \ + ? __signbit (x) : __signbitl (x)) +# endif + +/* Return nonzero value if X is not +-Inf or NaN. */ +# ifdef __NO_LONG_DOUBLE_MATH +# define isfinite(x) \ + (sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x)) +# else +# define isfinite(x) \ + (sizeof (x) == sizeof (float) \ + ? __finitef (x) \ + : sizeof (x) == sizeof (double) \ + ? __finite (x) : __finitel (x)) +# endif + +/* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */ +# define isnormal(x) (fpclassify (x) == FP_NORMAL) + +/* Return nonzero value if X is a NaN. We could use `fpclassify' but + we already have this functions `__isnan' and it is faster. */ +# ifdef __NO_LONG_DOUBLE_MATH +# define isnan(x) \ + (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x)) +# else +# define isnan(x) \ + (sizeof (x) == sizeof (float) \ + ? __isnanf (x) \ + : sizeof (x) == sizeof (double) \ + ? __isnan (x) : __isnanl (x)) +# endif + +/* Return nonzero value is X is positive or negative infinity. */ +# ifdef __NO_LONG_DOUBLE_MATH +# define isinf(x) \ + (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x)) +# else +# define isinf(x) \ + (sizeof (x) == sizeof (float) \ + ? __isinff (x) \ + : sizeof (x) == sizeof (double) \ + ? __isinf (x) : __isinfl (x)) +# endif + +/* Bitmasks for the math_errhandling macro. */ +# define MATH_ERRNO 1 /* errno set by math functions. */ +# define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */ + +#endif /* Use ISO C99. */ + +#ifdef __USE_MISC +/* Support for various different standard error handling behaviors. */ +typedef enum +{ + _IEEE_ = -1, /* According to IEEE 754/IEEE 854. */ + _SVID_, /* According to System V, release 4. */ + _XOPEN_, /* Nowadays also Unix98. */ + _POSIX_, + _ISOC_ /* Actually this is ISO C99. */ +} _LIB_VERSION_TYPE; + +/* This variable can be changed at run-time to any of the values above to + affect floating point error handling behavior (it may also be necessary + to change the hardware FPU exception settings). */ +extern _LIB_VERSION_TYPE _LIB_VERSION; +#endif + + +#ifdef __USE_SVID +/* In SVID error handling, `matherr' is called with this description + of the exceptional condition. + + We have a problem when using C++ since `exception' is a reserved + name in C++. */ +# ifdef __cplusplus +struct __exception +# else +struct exception +# endif + { + int type; + char *name; + double arg1; + double arg2; + double retval; + }; + +# ifdef __cplusplus +extern int matherr (struct __exception *__exc) throw (); +# else +extern int matherr (struct exception *__exc); +# endif + +# define X_TLOSS 1.41484755040568800000e+16 + +/* Types of exceptions in the `type' field. */ +# define DOMAIN 1 +# define SING 2 +# define OVERFLOW 3 +# define UNDERFLOW 4 +# define TLOSS 5 +# define PLOSS 6 + +/* SVID mode specifies returning this large value instead of infinity. */ +# define HUGE 3.40282347e+38F + +#else /* !SVID */ + +# ifdef __USE_XOPEN +/* X/Open wants another strange constant. */ +# define MAXFLOAT 3.40282347e+38F +# endif + +#endif /* SVID */ + + +/* Some useful constants. */ +#if defined __USE_BSD || defined __USE_XOPEN +# define M_E 2.7182818284590452354 /* e */ +# define M_LOG2E 1.4426950408889634074 /* log_2 e */ +# define M_LOG10E 0.43429448190325182765 /* log_10 e */ +# define M_LN2 0.69314718055994530942 /* log_e 2 */ +# define M_LN10 2.30258509299404568402 /* log_e 10 */ +# define M_PI 3.14159265358979323846 /* pi */ +# define M_PI_2 1.57079632679489661923 /* pi/2 */ +# define M_PI_4 0.78539816339744830962 /* pi/4 */ +# define M_1_PI 0.31830988618379067154 /* 1/pi */ +# define M_2_PI 0.63661977236758134308 /* 2/pi */ +# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#endif + +/* The above constants are not adequate for computation using `long double's. + Therefore we provide as an extension constants with similar names as a + GNU extension. Provide enough digits for the 128-bit IEEE quad. */ +#ifdef __USE_GNU +# define M_El 2.7182818284590452353602874713526625L /* e */ +# define M_LOG2El 1.4426950408889634073599246810018921L /* log_2 e */ +# define M_LOG10El 0.4342944819032518276511289189166051L /* log_10 e */ +# define M_LN2l 0.6931471805599453094172321214581766L /* log_e 2 */ +# define M_LN10l 2.3025850929940456840179914546843642L /* log_e 10 */ +# define M_PIl 3.1415926535897932384626433832795029L /* pi */ +# define M_PI_2l 1.5707963267948966192313216916397514L /* pi/2 */ +# define M_PI_4l 0.7853981633974483096156608458198757L /* pi/4 */ +# define M_1_PIl 0.3183098861837906715377675267450287L /* 1/pi */ +# define M_2_PIl 0.6366197723675813430755350534900574L /* 2/pi */ +# define M_2_SQRTPIl 1.1283791670955125738961589031215452L /* 2/sqrt(pi) */ +# define M_SQRT2l 1.4142135623730950488016887242096981L /* sqrt(2) */ +# define M_SQRT1_2l 0.7071067811865475244008443621048490L /* 1/sqrt(2) */ +#endif + + +/* When compiling in strict ISO C compatible mode we must not use the + inline functions since they, among other things, do not set the + `errno' variable correctly. */ +#if defined __STRICT_ANSI__ && !defined __NO_MATH_INLINES +# define __NO_MATH_INLINES 1 +#endif + +#if defined __USE_ISOC99 && __GNUC_PREREQ(2,97) +/* ISO C99 defines some macros to compare number while taking care for + unordered numbers. Many FPUs provide special instructions to support + these operations. Generic support in GCC for these as builtins went + in before 3.0.0, but not all cpus added their patterns. We define + versions that use the builtins here, and will + undef/redefine as appropriate for the specific GCC version in use. */ +# define isgreater(x, y) __builtin_isgreater(x, y) +# define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) +# define isless(x, y) __builtin_isless(x, y) +# define islessequal(x, y) __builtin_islessequal(x, y) +# define islessgreater(x, y) __builtin_islessgreater(x, y) +# define isunordered(u, v) __builtin_isunordered(u, v) +#endif + +/* Get machine-dependent inline versions (if there are any). */ +#ifdef __USE_EXTERN_INLINES +# include +#endif + +#ifdef __USE_ISOC99 +/* If we've still got undefined comparison macros, provide defaults. */ + +/* Return nonzero value if X is greater than Y. */ +# ifndef isgreater +# define isgreater(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x > __y; })) +# endif + +/* Return nonzero value if X is greater than or equal to Y. */ +# ifndef isgreaterequal +# define isgreaterequal(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x >= __y; })) +# endif + +/* Return nonzero value if X is less than Y. */ +# ifndef isless +# define isless(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x < __y; })) +# endif + +/* Return nonzero value if X is less than or equal to Y. */ +# ifndef islessequal +# define islessequal(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x <= __y; })) +# endif + +/* Return nonzero value if either X is less than Y or Y is less than X. */ +# ifndef islessgreater +# define islessgreater(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && (__x < __y || __y < __x); })) +# endif + +/* Return nonzero value if arguments are unordered. */ +# ifndef isunordered +# define isunordered(u, v) \ + (__extension__ \ + ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \ + fpclassify (__u) == FP_NAN || fpclassify (__v) == FP_NAN; })) +# endif + +#endif + +__END_DECLS + + +#endif /* math.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/memory.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/memory.h new file mode 100644 index 0000000..743fa6a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/memory.h @@ -0,0 +1,34 @@ +/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * SVID + */ + +#ifndef _MEMORY_H +#define _MEMORY_H 1 + +#include + + +#ifndef _STRING_H +# include +#endif /* string.h */ + + +#endif /* memory.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mntent.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mntent.h new file mode 100644 index 0000000..a82e953 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mntent.h @@ -0,0 +1,98 @@ +/* Utilities for reading/writing fstab, mtab, etc. + Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MNTENT_H +#define _MNTENT_H 1 + +#include +#define __need_FILE +#include +#include + + +/* File listing canonical interesting mount points. */ +#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */ + +/* File listing currently active mount points. */ +#define MOUNTED _PATH_MOUNTED /* Deprecated alias. */ + + +/* General filesystem types. */ +#define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */ +#define MNTTYPE_NFS "nfs" /* Network file system. */ +#define MNTTYPE_SWAP "swap" /* Swap device. */ + + +/* Generic mount options. */ +#define MNTOPT_DEFAULTS "defaults" /* Use all default options. */ +#define MNTOPT_RO "ro" /* Read only. */ +#define MNTOPT_RW "rw" /* Read/write. */ +#define MNTOPT_SUID "suid" /* Set uid allowed. */ +#define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */ +#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */ + + +__BEGIN_DECLS + +/* Structure describing a mount table entry. */ +struct mntent + { + char *mnt_fsname; /* Device or server for filesystem. */ + char *mnt_dir; /* Directory mounted on. */ + char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */ + char *mnt_opts; /* Comma-separated options for fs. */ + int mnt_freq; /* Dump frequency (in days). */ + int mnt_passno; /* Pass number for `fsck'. */ + }; + + +/* Prepare to begin reading and/or writing mount table entries from the + beginning of FILE. MODE is as for `fopen'. */ +extern FILE *setmntent (__const char *__file, __const char *__mode) __THROW; + +/* Read one mount table entry from STREAM. Returns a pointer to storage + reused on the next call, or null for EOF or error (use feof/ferror to + check). */ +extern struct mntent *getmntent (FILE *__stream) __THROW; + +#ifdef __USE_MISC +/* Reentrant version of the above function. */ +extern struct mntent *getmntent_r (FILE *__restrict __stream, + struct mntent *__restrict __result, + char *__restrict __buffer, + int __bufsize) __THROW; +#endif + +/* Write the mount table entry described by MNT to STREAM. + Return zero on success, nonzero on failure. */ +extern int addmntent (FILE *__restrict __stream, + __const struct mntent *__restrict __mnt) __THROW; + +/* Close a stream opened with `setmntent'. */ +extern int endmntent (FILE *__stream) __THROW; + +/* Search MNT->mnt_opts for an option matching OPT. + Returns the address of the substring, or null if none found. */ +extern char *hasmntopt (__const struct mntent *__mnt, + __const char *__opt) __THROW; + + +__END_DECLS + +#endif /* mntent.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mqueue.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mqueue.h new file mode 100644 index 0000000..1ccad5b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mqueue.h @@ -0,0 +1,90 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MQUEUE_H +#define _MQUEUE_H 1 + +#include +#include +#include +#define __need_sigevent_t +#include +#define __need_timespec +#include +/* Get the definition of mqd_t and struct mq_attr. */ +#include + +__BEGIN_DECLS + +/* Establish connection between a process and a message queue NAME and + return message queue descriptor or (mqd_t) -1 on error. OFLAG determines + the type of access used. If O_CREAT is on OFLAG, the third argument is + taken as a `mode_t', the mode of the created message queue, and the fourth + argument is taken as `struct mq_attr *', pointer to message queue + attributes. If the fourth argument is NULL, default attributes are + used. */ +extern mqd_t mq_open (const char *__name, int __oflag, ...) __THROW; + +/* Removes the association between message queue descriptor MQDES and its + message queue. */ +extern int mq_close (mqd_t __mqdes) __THROW; + +/* Query status and attributes of message queue MQDES. */ +extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat) __THROW; + +/* Set attributes associated with message queue MQDES and if OMQSTAT is + not NULL also query its old attributes. */ +extern int mq_setattr (mqd_t __mqdes, + const struct mq_attr *__restrict __mqstat, + struct mq_attr *__restrict __omqstat) __THROW; + +/* Remove message queue named NAME. */ +extern int mq_unlink (const char *__name) __THROW; + +/* Register notification issued upon message arrival to an empty + message queue MQDES. */ +extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification) + __THROW; + +/* Receive the oldest from highest priority messages in message queue + MQDES. */ +extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len, + unsigned int *__msg_prio); + +/* Add message pointed by MSG_PTR to message queue MQDES. */ +extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, + unsigned int __msg_prio); + +#ifdef __USE_XOPEN2K +/* Receive the oldest from highest priority messages in message queue + MQDES, stop waiting if ABS_TIMEOUT expires. */ +extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, + size_t __msg_len, + unsigned int *__restrict __msg_prio, + const struct timespec *__restrict __abs_timeout); + +/* Add message pointed by MSG_PTR to message queue MQDES, stop blocking + on full message queue if ABS_TIMEOUT expires. */ +extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr, + size_t __msg_len, unsigned int __msg_prio, + const struct timespec *__abs_timeout); +#endif + +__END_DECLS + +#endif /* mqueue.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/..install.cmd new file mode 100644 index 0000000..a7bd1c4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/mtd/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/mtd /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/mtd mips inftl-user.h jffs2-user.h mtd-abi.h mtd-user.h nftl-user.h ubi-user.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/mtd /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/mtd mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/mtd/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/inftl-user.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/inftl-user.h new file mode 100644 index 0000000..8376bd1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/inftl-user.h @@ -0,0 +1,91 @@ +/* + * Parts of INFTL headers shared with userspace + * + */ + +#ifndef __MTD_INFTL_USER_H__ +#define __MTD_INFTL_USER_H__ + +#include + +#define OSAK_VERSION 0x5120 +#define PERCENTUSED 98 + +#define SECTORSIZE 512 + +/* Block Control Information */ + +struct inftl_bci { + __u8 ECCsig[6]; + __u8 Status; + __u8 Status1; +} __attribute__((packed)); + +struct inftl_unithead1 { + __u16 virtualUnitNo; + __u16 prevUnitNo; + __u8 ANAC; + __u8 NACs; + __u8 parityPerField; + __u8 discarded; +} __attribute__((packed)); + +struct inftl_unithead2 { + __u8 parityPerField; + __u8 ANAC; + __u16 prevUnitNo; + __u16 virtualUnitNo; + __u8 NACs; + __u8 discarded; +} __attribute__((packed)); + +struct inftl_unittail { + __u8 Reserved[4]; + __u16 EraseMark; + __u16 EraseMark1; +} __attribute__((packed)); + +union inftl_uci { + struct inftl_unithead1 a; + struct inftl_unithead2 b; + struct inftl_unittail c; +}; + +struct inftl_oob { + struct inftl_bci b; + union inftl_uci u; +}; + + +/* INFTL Media Header */ + +struct INFTLPartition { + __u32 virtualUnits; + __u32 firstUnit; + __u32 lastUnit; + __u32 flags; + __u32 spareUnits; + __u32 Reserved0; + __u32 Reserved1; +} __attribute__((packed)); + +struct INFTLMediaHeader { + char bootRecordID[8]; + __u32 NoOfBootImageBlocks; + __u32 NoOfBinaryPartitions; + __u32 NoOfBDTLPartitions; + __u32 BlockMultiplierBits; + __u32 FormatFlags; + __u32 OsakVersion; + __u32 PercentUsed; + struct INFTLPartition Partitions[4]; +} __attribute__((packed)); + +/* Partition flag types */ +#define INFTL_BINARY 0x20000000 +#define INFTL_BDTL 0x40000000 +#define INFTL_LAST 0x80000000 + +#endif /* __MTD_INFTL_USER_H__ */ + + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/jffs2-user.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/jffs2-user.h new file mode 100644 index 0000000..fa94b0e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/jffs2-user.h @@ -0,0 +1,34 @@ +/* + * JFFS2 definitions for use in user space only + */ + +#ifndef __JFFS2_USER_H__ +#define __JFFS2_USER_H__ + +/* This file is blessed for inclusion by userspace */ +#include +#include +#include +#include + +#undef cpu_to_je16 +#undef cpu_to_je32 +#undef cpu_to_jemode +#undef je16_to_cpu +#undef je32_to_cpu +#undef jemode_to_cpu + +extern int target_endian; + +#define t16(x) ({ __u16 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) +#define t32(x) ({ __u32 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) + +#define cpu_to_je16(x) ((jint16_t){t16(x)}) +#define cpu_to_je32(x) ((jint32_t){t32(x)}) +#define cpu_to_jemode(x) ((jmode_t){t32(x)}) + +#define je16_to_cpu(x) (t16((x).v16)) +#define je32_to_cpu(x) (t32((x).v32)) +#define jemode_to_cpu(x) (t32((x).m)) + +#endif /* __JFFS2_USER_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/mtd-abi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/mtd-abi.h new file mode 100644 index 0000000..bda76db --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/mtd-abi.h @@ -0,0 +1,152 @@ +/* + * Portions of MTD ABI definition which are shared by kernel and user space + */ + +#ifndef __MTD_ABI_H__ +#define __MTD_ABI_H__ + +#include + +struct erase_info_user { + __u32 start; + __u32 length; +}; + +struct mtd_oob_buf { + __u32 start; + __u32 length; + unsigned char *ptr; +}; + +#define MTD_ABSENT 0 +#define MTD_RAM 1 +#define MTD_ROM 2 +#define MTD_NORFLASH 3 +#define MTD_NANDFLASH 4 +#define MTD_DATAFLASH 6 +#define MTD_UBIVOLUME 7 + +#define MTD_WRITEABLE 0x400 /* Device is writeable */ +#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ +#define MTD_NO_ERASE 0x1000 /* No erase necessary */ +#define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */ + +// Some common devices / combinations of capabilities +#define MTD_CAP_ROM 0 +#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) +#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) +#define MTD_CAP_NANDFLASH (MTD_WRITEABLE) + +/* ECC byte placement */ +#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended) +#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode) +#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme +#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read) +#define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default + +/* OTP mode selection */ +#define MTD_OTP_OFF 0 +#define MTD_OTP_FACTORY 1 +#define MTD_OTP_USER 2 + +struct mtd_info_user { + __u8 type; + __u32 flags; + __u32 size; // Total size of the MTD + __u32 erasesize; + __u32 writesize; + __u32 oobsize; // Amount of OOB data per block (e.g. 16) + /* The below two fields are obsolete and broken, do not use them + * (TODO: remove at some point) */ + __u32 ecctype; + __u32 eccsize; +}; + +struct region_info_user { + __u32 offset; /* At which this region starts, + * from the beginning of the MTD */ + __u32 erasesize; /* For this region */ + __u32 numblocks; /* Number of blocks in this region */ + __u32 regionindex; +}; + +struct otp_info { + __u32 start; + __u32 length; + __u32 locked; +}; + +#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) +#define MEMERASE _IOW('M', 2, struct erase_info_user) +#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) +#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) +#define MEMLOCK _IOW('M', 5, struct erase_info_user) +#define MEMUNLOCK _IOW('M', 6, struct erase_info_user) +#define MEMGETREGIONCOUNT _IOR('M', 7, int) +#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) +#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo) +#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) +#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t) +#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t) +#define OTPSELECT _IOR('M', 13, int) +#define OTPGETREGIONCOUNT _IOW('M', 14, int) +#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) +#define OTPLOCK _IOR('M', 16, struct otp_info) +#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout) +#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) +#define MTDFILEMODE _IO('M', 19) + +/* + * Obsolete legacy interface. Keep it in order not to break userspace + * interfaces + */ +struct nand_oobinfo { + __u32 useecc; + __u32 eccbytes; + __u32 oobfree[8][2]; + __u32 eccpos[32]; +}; + +struct nand_oobfree { + __u32 offset; + __u32 length; +}; + +#define MTD_MAX_OOBFREE_ENTRIES 8 +/* + * ECC layout control structure. Exported to userspace for + * diagnosis and to allow creation of raw images + */ +struct nand_ecclayout { + __u32 eccbytes; + __u32 eccpos[64]; + __u32 oobavail; + struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; +}; + +/** + * struct mtd_ecc_stats - error correction stats + * + * @corrected: number of corrected bits + * @failed: number of uncorrectable errors + * @badblocks: number of bad blocks in this partition + * @bbtblocks: number of blocks reserved for bad block tables + */ +struct mtd_ecc_stats { + __u32 corrected; + __u32 failed; + __u32 badblocks; + __u32 bbtblocks; +}; + +/* + * Read/write file modes for access to MTD + */ +enum mtd_file_modes { + MTD_MODE_NORMAL = MTD_OTP_OFF, + MTD_MODE_OTP_FACTORY = MTD_OTP_FACTORY, + MTD_MODE_OTP_USER = MTD_OTP_USER, + MTD_MODE_RAW, +}; + +#endif /* __MTD_ABI_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/mtd-user.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/mtd-user.h new file mode 100644 index 0000000..170ceca --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/mtd-user.h @@ -0,0 +1,19 @@ +/* + * MTD ABI header for use by user space only. + */ + +#ifndef __MTD_USER_H__ +#define __MTD_USER_H__ + +#include + +/* This file is blessed for inclusion by userspace */ +#include + +typedef struct mtd_info_user mtd_info_t; +typedef struct erase_info_user erase_info_t; +typedef struct region_info_user region_info_t; +typedef struct nand_oobinfo nand_oobinfo_t; +typedef struct nand_ecclayout nand_ecclayout_t; + +#endif /* __MTD_USER_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/nftl-user.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/nftl-user.h new file mode 100644 index 0000000..98e9e57 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/nftl-user.h @@ -0,0 +1,76 @@ +/* + * Parts of NFTL headers shared with userspace + * + */ + +#ifndef __MTD_NFTL_USER_H__ +#define __MTD_NFTL_USER_H__ + +#include + +/* Block Control Information */ + +struct nftl_bci { + unsigned char ECCSig[6]; + __u8 Status; + __u8 Status1; +}__attribute__((packed)); + +/* Unit Control Information */ + +struct nftl_uci0 { + __u16 VirtUnitNum; + __u16 ReplUnitNum; + __u16 SpareVirtUnitNum; + __u16 SpareReplUnitNum; +} __attribute__((packed)); + +struct nftl_uci1 { + __u32 WearInfo; + __u16 EraseMark; + __u16 EraseMark1; +} __attribute__((packed)); + +struct nftl_uci2 { + __u16 FoldMark; + __u16 FoldMark1; + __u32 unused; +} __attribute__((packed)); + +union nftl_uci { + struct nftl_uci0 a; + struct nftl_uci1 b; + struct nftl_uci2 c; +}; + +struct nftl_oob { + struct nftl_bci b; + union nftl_uci u; +}; + +/* NFTL Media Header */ + +struct NFTLMediaHeader { + char DataOrgID[6]; + __u16 NumEraseUnits; + __u16 FirstPhysicalEUN; + __u32 FormattedSize; + unsigned char UnitSizeFactor; +} __attribute__((packed)); + +#define MAX_ERASE_ZONES (8192 - 512) + +#define ERASE_MARK 0x3c69 +#define SECTOR_FREE 0xff +#define SECTOR_USED 0x55 +#define SECTOR_IGNORE 0x11 +#define SECTOR_DELETED 0x00 + +#define FOLD_MARK_IN_PROGRESS 0x5555 + +#define ZONE_GOOD 0xff +#define ZONE_BAD_ORIGINAL 0 +#define ZONE_BAD_MARKED 7 + + +#endif /* __MTD_NFTL_USER_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/ubi-user.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/ubi-user.h new file mode 100644 index 0000000..466a832 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/mtd/ubi-user.h @@ -0,0 +1,412 @@ +/* + * Copyright (c) International Business Machines Corp., 2006 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Artem Bityutskiy (Битюцкий Ðртём) + */ + +#ifndef __UBI_USER_H__ +#define __UBI_USER_H__ + +#include + +/* + * UBI device creation (the same as MTD device attachment) + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * MTD devices may be attached using %UBI_IOCATT ioctl command of the UBI + * control device. The caller has to properly fill and pass + * &struct ubi_attach_req object - UBI will attach the MTD device specified in + * the request and return the newly created UBI device number as the ioctl + * return value. + * + * UBI device deletion (the same as MTD device detachment) + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * An UBI device maybe deleted with %UBI_IOCDET ioctl command of the UBI + * control device. + * + * UBI volume creation + * ~~~~~~~~~~~~~~~~~~~ + * + * UBI volumes are created via the %UBI_IOCMKVOL ioctl command of UBI character + * device. A &struct ubi_mkvol_req object has to be properly filled and a + * pointer to it has to be passed to the ioctl. + * + * UBI volume deletion + * ~~~~~~~~~~~~~~~~~~~ + * + * To delete a volume, the %UBI_IOCRMVOL ioctl command of the UBI character + * device should be used. A pointer to the 32-bit volume ID hast to be passed + * to the ioctl. + * + * UBI volume re-size + * ~~~~~~~~~~~~~~~~~~ + * + * To re-size a volume, the %UBI_IOCRSVOL ioctl command of the UBI character + * device should be used. A &struct ubi_rsvol_req object has to be properly + * filled and a pointer to it has to be passed to the ioctl. + * + * UBI volumes re-name + * ~~~~~~~~~~~~~~~~~~~ + * + * To re-name several volumes atomically at one go, the %UBI_IOCRNVOL command + * of the UBI character device should be used. A &struct ubi_rnvol_req object + * has to be properly filled and a pointer to it has to be passed to the ioctl. + * + * UBI volume update + * ~~~~~~~~~~~~~~~~~ + * + * Volume update should be done via the %UBI_IOCVOLUP ioctl command of the + * corresponding UBI volume character device. A pointer to a 64-bit update + * size should be passed to the ioctl. After this, UBI expects user to write + * this number of bytes to the volume character device. The update is finished + * when the claimed number of bytes is passed. So, the volume update sequence + * is something like: + * + * fd = open("/dev/my_volume"); + * ioctl(fd, UBI_IOCVOLUP, &image_size); + * write(fd, buf, image_size); + * close(fd); + * + * Logical eraseblock erase + * ~~~~~~~~~~~~~~~~~~~~~~~~ + * + * To erase a logical eraseblock, the %UBI_IOCEBER ioctl command of the + * corresponding UBI volume character device should be used. This command + * unmaps the requested logical eraseblock, makes sure the corresponding + * physical eraseblock is successfully erased, and returns. + * + * Atomic logical eraseblock change + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * Atomic logical eraseblock change operation is called using the %UBI_IOCEBCH + * ioctl command of the corresponding UBI volume character device. A pointer to + * a &struct ubi_leb_change_req object has to be passed to the ioctl. Then the + * user is expected to write the requested amount of bytes (similarly to what + * should be done in case of the "volume update" ioctl). + * + * Logical eraseblock map + * ~~~~~~~~~~~~~~~~~~~~~ + * + * To map a logical eraseblock to a physical eraseblock, the %UBI_IOCEBMAP + * ioctl command should be used. A pointer to a &struct ubi_map_req object is + * expected to be passed. The ioctl maps the requested logical eraseblock to + * a physical eraseblock and returns. Only non-mapped logical eraseblocks can + * be mapped. If the logical eraseblock specified in the request is already + * mapped to a physical eraseblock, the ioctl fails and returns error. + * + * Logical eraseblock unmap + * ~~~~~~~~~~~~~~~~~~~~~~~~ + * + * To unmap a logical eraseblock to a physical eraseblock, the %UBI_IOCEBUNMAP + * ioctl command should be used. The ioctl unmaps the logical eraseblocks, + * schedules corresponding physical eraseblock for erasure, and returns. Unlike + * the "LEB erase" command, it does not wait for the physical eraseblock being + * erased. Note, the side effect of this is that if an unclean reboot happens + * after the unmap ioctl returns, you may find the LEB mapped again to the same + * physical eraseblock after the UBI is run again. + * + * Check if logical eraseblock is mapped + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * To check if a logical eraseblock is mapped to a physical eraseblock, the + * %UBI_IOCEBISMAP ioctl command should be used. It returns %0 if the LEB is + * not mapped, and %1 if it is mapped. + * + * Set an UBI volume property + * ~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be + * used. A pointer to a &struct ubi_set_prop_req object is expected to be + * passed. The object describes which property should be set, and to which value + * it should be set. + */ + +/* + * When a new UBI volume or UBI device is created, users may either specify the + * volume/device number they want to create or to let UBI automatically assign + * the number using these constants. + */ +#define UBI_VOL_NUM_AUTO (-1) +#define UBI_DEV_NUM_AUTO (-1) + +/* Maximum volume name length */ +#define UBI_MAX_VOLUME_NAME 127 + +/* ioctl commands of UBI character devices */ + +#define UBI_IOC_MAGIC 'o' + +/* Create an UBI volume */ +#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) +/* Remove an UBI volume */ +#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32) +/* Re-size an UBI volume */ +#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) +/* Re-name volumes */ +#define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req) + +/* ioctl commands of the UBI control character device */ + +#define UBI_CTRL_IOC_MAGIC 'o' + +/* Attach an MTD device */ +#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) +/* Detach an MTD device */ +#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32) + +/* ioctl commands of UBI volume character devices */ + +#define UBI_VOL_IOC_MAGIC 'O' + +/* Start UBI volume update */ +#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64) +/* LEB erasure command, used for debugging, disabled by default */ +#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32) +/* Atomic LEB change command */ +#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32) +/* Map LEB command */ +#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) +/* Unmap LEB command */ +#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32) +/* Check if LEB is mapped command */ +#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32) +/* Set an UBI volume property */ +#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req) + +/* Maximum MTD device name length supported by UBI */ +#define MAX_UBI_MTD_NAME_LEN 127 + +/* Maximum amount of UBI volumes that can be re-named at one go */ +#define UBI_MAX_RNVOL 32 + +/* + * UBI data type hint constants. + * + * UBI_LONGTERM: long-term data + * UBI_SHORTTERM: short-term data + * UBI_UNKNOWN: data persistence is unknown + * + * These constants are used when data is written to UBI volumes in order to + * help the UBI wear-leveling unit to find more appropriate physical + * eraseblocks. + */ +enum { + UBI_LONGTERM = 1, + UBI_SHORTTERM = 2, + UBI_UNKNOWN = 3, +}; + +/* + * UBI volume type constants. + * + * @UBI_DYNAMIC_VOLUME: dynamic volume + * @UBI_STATIC_VOLUME: static volume + */ +enum { + UBI_DYNAMIC_VOLUME = 3, + UBI_STATIC_VOLUME = 4, +}; + +/* + * UBI set property ioctl constants + * + * @UBI_PROP_DIRECT_WRITE: allow / disallow user to directly write and + * erase individual eraseblocks on dynamic volumes + */ +enum { + UBI_PROP_DIRECT_WRITE = 1, +}; + +/** + * struct ubi_attach_req - attach MTD device request. + * @ubi_num: UBI device number to create + * @mtd_num: MTD device number to attach + * @vid_hdr_offset: VID header offset (use defaults if %0) + * @padding: reserved for future, not used, has to be zeroed + * + * This data structure is used to specify MTD device UBI has to attach and the + * parameters it has to use. The number which should be assigned to the new UBI + * device is passed in @ubi_num. UBI may automatically assign the number if + * @UBI_DEV_NUM_AUTO is passed. In this case, the device number is returned in + * @ubi_num. + * + * Most applications should pass %0 in @vid_hdr_offset to make UBI use default + * offset of the VID header within physical eraseblocks. The default offset is + * the next min. I/O unit after the EC header. For example, it will be offset + * 512 in case of a 512 bytes page NAND flash with no sub-page support. Or + * it will be 512 in case of a 2KiB page NAND flash with 4 512-byte sub-pages. + * + * But in rare cases, if this optimizes things, the VID header may be placed to + * a different offset. For example, the boot-loader might do things faster if + * the VID header sits at the end of the first 2KiB NAND page with 4 sub-pages. + * As the boot-loader would not normally need to read EC headers (unless it + * needs UBI in RW mode), it might be faster to calculate ECC. This is weird + * example, but it real-life example. So, in this example, @vid_hdr_offer would + * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes + * aligned, which is OK, as UBI is clever enough to realize this is 4th + * sub-page of the first page and add needed padding. + */ +struct ubi_attach_req { + __s32 ubi_num; + __s32 mtd_num; + __s32 vid_hdr_offset; + __s8 padding[12]; +}; + +/** + * struct ubi_mkvol_req - volume description data structure used in + * volume creation requests. + * @vol_id: volume number + * @alignment: volume alignment + * @bytes: volume size in bytes + * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) + * @padding1: reserved for future, not used, has to be zeroed + * @name_len: volume name length + * @padding2: reserved for future, not used, has to be zeroed + * @name: volume name + * + * This structure is used by user-space programs when creating new volumes. The + * @used_bytes field is only necessary when creating static volumes. + * + * The @alignment field specifies the required alignment of the volume logical + * eraseblock. This means, that the size of logical eraseblocks will be aligned + * to this number, i.e., + * (UBI device logical eraseblock size) mod (@alignment) = 0. + * + * To put it differently, the logical eraseblock of this volume may be slightly + * shortened in order to make it properly aligned. The alignment has to be + * multiple of the flash minimal input/output unit, or %1 to utilize the entire + * available space of logical eraseblocks. + * + * The @alignment field may be useful, for example, when one wants to maintain + * a block device on top of an UBI volume. In this case, it is desirable to fit + * an integer number of blocks in logical eraseblocks of this UBI volume. With + * alignment it is possible to update this volume using plane UBI volume image + * BLOBs, without caring about how to properly align them. + */ +struct ubi_mkvol_req { + __s32 vol_id; + __s32 alignment; + __s64 bytes; + __s8 vol_type; + __s8 padding1; + __s16 name_len; + __s8 padding2[4]; + char name[UBI_MAX_VOLUME_NAME + 1]; +} __attribute__ ((packed)); + +/** + * struct ubi_rsvol_req - a data structure used in volume re-size requests. + * @vol_id: ID of the volume to re-size + * @bytes: new size of the volume in bytes + * + * Re-sizing is possible for both dynamic and static volumes. But while dynamic + * volumes may be re-sized arbitrarily, static volumes cannot be made to be + * smaller than the number of bytes they bear. To arbitrarily shrink a static + * volume, it must be wiped out first (by means of volume update operation with + * zero number of bytes). + */ +struct ubi_rsvol_req { + __s64 bytes; + __s32 vol_id; +} __attribute__ ((packed)); + +/** + * struct ubi_rnvol_req - volumes re-name request. + * @count: count of volumes to re-name + * @padding1: reserved for future, not used, has to be zeroed + * @vol_id: ID of the volume to re-name + * @name_len: name length + * @padding2: reserved for future, not used, has to be zeroed + * @name: new volume name + * + * UBI allows to re-name up to %32 volumes at one go. The count of volumes to + * re-name is specified in the @count field. The ID of the volumes to re-name + * and the new names are specified in the @vol_id and @name fields. + * + * The UBI volume re-name operation is atomic, which means that should power cut + * happen, the volumes will have either old name or new name. So the possible + * use-cases of this command is atomic upgrade. Indeed, to upgrade, say, volumes + * A and B one may create temporary volumes %A1 and %B1 with the new contents, + * then atomically re-name A1->A and B1->B, in which case old %A and %B will + * be removed. + * + * If it is not desirable to remove old A and B, the re-name request has to + * contain 4 entries: A1->A, A->A1, B1->B, B->B1, in which case old A1 and B1 + * become A and B, and old A and B will become A1 and B1. + * + * It is also OK to request: A1->A, A1->X, B1->B, B->Y, in which case old A1 + * and B1 become A and B, and old A and B become X and Y. + * + * In other words, in case of re-naming into an existing volume name, the + * existing volume is removed, unless it is re-named as well at the same + * re-name request. + */ +struct ubi_rnvol_req { + __s32 count; + __s8 padding1[12]; + struct { + __s32 vol_id; + __s16 name_len; + __s8 padding2[2]; + char name[UBI_MAX_VOLUME_NAME + 1]; + } ents[UBI_MAX_RNVOL]; +} __attribute__ ((packed)); + +/** + * struct ubi_leb_change_req - a data structure used in atomic LEB change + * requests. + * @lnum: logical eraseblock number to change + * @bytes: how many bytes will be written to the logical eraseblock + * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN) + * @padding: reserved for future, not used, has to be zeroed + */ +struct ubi_leb_change_req { + __s32 lnum; + __s32 bytes; + __s8 dtype; + __s8 padding[7]; +} __attribute__ ((packed)); + +/** + * struct ubi_map_req - a data structure used in map LEB requests. + * @lnum: logical eraseblock number to unmap + * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN) + * @padding: reserved for future, not used, has to be zeroed + */ +struct ubi_map_req { + __s32 lnum; + __s8 dtype; + __s8 padding[3]; +} __attribute__ ((packed)); + + +/** + * struct ubi_set_prop_req - a data structure used to set an ubi volume + * property. + * @property: property to set (%UBI_PROP_DIRECT_WRITE) + * @padding: reserved for future, not used, has to be zeroed + * @value: value to set + */ +struct ubi_set_prop_req { + __u8 property; + __u8 padding[7]; + __u64 value; +} __attribute__ ((packed)); + +#endif /* __UBI_USER_H__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ethernet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ethernet.h new file mode 100644 index 0000000..7ca8e83 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ethernet.h @@ -0,0 +1,76 @@ +/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Based on the FreeBSD version of this file. Curiously, that file + lacks a copyright in the header. */ + +#ifndef __NET_ETHERNET_H +#define __NET_ETHERNET_H 1 + +#include +#include +#include /* IEEE 802.3 Ethernet constants */ + +__BEGIN_DECLS + +/* This is a name for the 48 bit ethernet address available on many + systems. */ +struct ether_addr +{ + u_int8_t ether_addr_octet[ETH_ALEN]; +} __attribute__ ((__packed__)); + +/* 10Mb/s ethernet header */ +struct ether_header +{ + u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ + u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */ + u_int16_t ether_type; /* packet type ID field */ +} __attribute__ ((__packed__)); + +/* Ethernet protocol ID's */ +#define ETHERTYPE_PUP 0x0200 /* Xerox PUP */ +#define ETHERTYPE_IP 0x0800 /* IP */ +#define ETHERTYPE_ARP 0x0806 /* Address resolution */ +#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */ + +#define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */ +#define ETHER_TYPE_LEN 2 /* bytes in type field */ +#define ETHER_CRC_LEN 4 /* bytes in CRC field */ +#define ETHER_HDR_LEN ETH_HLEN /* total octets in header */ +#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) /* min packet length */ +#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) /* max packet length */ + +/* make sure ethenet length is valid */ +#define ETHER_IS_VALID_LEN(foo) \ + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +/* + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed + * by an ETHER type (as given above) and then the (variable-length) header. + */ +#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU ETH_DATA_LEN +#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) + +__END_DECLS + +#endif /* net/ethernet.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if.h new file mode 100644 index 0000000..ebb3e9f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if.h @@ -0,0 +1,205 @@ +/* net/if.h -- declarations for inquiring about network interfaces + Copyright (C) 1997,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NET_IF_H +#define _NET_IF_H 1 + +#include + +#ifdef __USE_MISC +# include +# include +#endif + + +/* Length of interface name. */ +#define IF_NAMESIZE 16 + +struct if_nameindex + { + unsigned int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "eth0", ... */ + }; + + +#ifdef __USE_MISC +/* Standard interface flags. */ +enum + { + IFF_UP = 0x1, /* Interface is up. */ +# define IFF_UP IFF_UP + IFF_BROADCAST = 0x2, /* Broadcast address valid. */ +# define IFF_BROADCAST IFF_BROADCAST + IFF_DEBUG = 0x4, /* Turn on debugging. */ +# define IFF_DEBUG IFF_DEBUG + IFF_LOOPBACK = 0x8, /* Is a loopback net. */ +# define IFF_LOOPBACK IFF_LOOPBACK + IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */ +# define IFF_POINTOPOINT IFF_POINTOPOINT + IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */ +# define IFF_NOTRAILERS IFF_NOTRAILERS + IFF_RUNNING = 0x40, /* Resources allocated. */ +# define IFF_RUNNING IFF_RUNNING + IFF_NOARP = 0x80, /* No address resolution protocol. */ +# define IFF_NOARP IFF_NOARP + IFF_PROMISC = 0x100, /* Receive all packets. */ +# define IFF_PROMISC IFF_PROMISC + + /* Not supported */ + IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */ +# define IFF_ALLMULTI IFF_ALLMULTI + + IFF_MASTER = 0x400, /* Master of a load balancer. */ +# define IFF_MASTER IFF_MASTER + IFF_SLAVE = 0x800, /* Slave of a load balancer. */ +# define IFF_SLAVE IFF_SLAVE + + IFF_MULTICAST = 0x1000, /* Supports multicast. */ +# define IFF_MULTICAST IFF_MULTICAST + + IFF_PORTSEL = 0x2000, /* Can set media type. */ +# define IFF_PORTSEL IFF_PORTSEL + IFF_AUTOMEDIA = 0x4000, /* Auto media select active. */ +# define IFF_AUTOMEDIA IFF_AUTOMEDIA + IFF_DYNAMIC = 0x8000 /* Dialup device with changing addresses. */ +# define IFF_DYNAMIC IFF_DYNAMIC + }; + +/* The ifaddr structure contains information about one address of an + interface. They are maintained by the different address families, + are allocated and attached when an address is set, and are linked + together so all addresses for an interface can be located. */ + +struct ifaddr + { + struct sockaddr ifa_addr; /* Address of interface. */ + union + { + struct sockaddr ifu_broadaddr; + struct sockaddr ifu_dstaddr; + } ifa_ifu; + struct iface *ifa_ifp; /* Back-pointer to interface. */ + struct ifaddr *ifa_next; /* Next address for interface. */ + }; + +# define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ +# define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */ + +/* Device mapping structure. I'd just gone off and designed a + beautiful scheme using only loadable modules with arguments for + driver options and along come the PCMCIA people 8) + + Ah well. The get() side of this is good for WDSETUP, and it'll be + handy for debugging things. The set side is fine for now and being + very small might be worth keeping for clean configuration. */ + +struct ifmap + { + unsigned long int mem_start; + unsigned long int mem_end; + unsigned short int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; + /* 3 bytes spare */ + }; + +/* Interface request structure used for socket ioctl's. All interface + ioctl's must have parameter definitions which begin with ifr_name. + The remainder may be interface specific. */ + +struct ifreq + { +# define IFHWADDRLEN 6 +# define IFNAMSIZ IF_NAMESIZE + union + { + char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */ + } ifr_ifrn; + + union + { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_ivalue; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; /* Just fits the size */ + char ifru_newname[IFNAMSIZ]; + __caddr_t ifru_data; + } ifr_ifru; + }; +# define ifr_name ifr_ifrn.ifrn_name /* interface name */ +# define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +# define ifr_addr ifr_ifru.ifru_addr /* address */ +# define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ +# define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +# define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +# define ifr_flags ifr_ifru.ifru_flags /* flags */ +# define ifr_metric ifr_ifru.ifru_ivalue /* metric */ +# define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +# define ifr_map ifr_ifru.ifru_map /* device map */ +# define ifr_slave ifr_ifru.ifru_slave /* slave device */ +# define ifr_data ifr_ifru.ifru_data /* for use by interface */ +# define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ +# define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ +# define ifr_qlen ifr_ifru.ifru_ivalue /* queue length */ +# define ifr_newname ifr_ifru.ifru_newname /* New name */ +# define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0) +# define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0) +# define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0) + + +/* Structure used in SIOCGIFCONF request. Used to retrieve interface + configuration for machine (useful for programs which must know all + networks accessible). */ + +struct ifconf + { + int ifc_len; /* Size of buffer. */ + union + { + __caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; + }; +# define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */ +# define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */ +# define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) /* not right */ +#endif /* Misc. */ + +__BEGIN_DECLS + +/* Convert an interface name to an index, and vice versa. */ +extern unsigned int if_nametoindex (__const char *__ifname) __THROW; +extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW; + +/* Return a list of all interfaces and their indices. */ +extern struct if_nameindex *if_nameindex (void) __THROW; + +/* Free the data returned from if_nameindex. */ +extern void if_freenameindex (struct if_nameindex *__ptr) __THROW; + +__END_DECLS + +#endif /* net/if.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_arp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_arp.h new file mode 100644 index 0000000..46f035b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_arp.h @@ -0,0 +1,176 @@ +/* Definitions for Address Resolution Protocol. + Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Based on the 4.4BSD and Linux version of this file. */ + +#ifndef _NET_IF_ARP_H + +#define _NET_IF_ARP_H 1 +#include + +#include +#include + +__BEGIN_DECLS + +/* Some internals from deep down in the kernel. */ +#define MAX_ADDR_LEN 7 + + +/* This structure defines an ethernet arp header. */ + +/* ARP protocol opcodes. */ +#define ARPOP_REQUEST 1 /* ARP request. */ +#define ARPOP_REPLY 2 /* ARP reply. */ +#define ARPOP_RREQUEST 3 /* RARP request. */ +#define ARPOP_RREPLY 4 /* RARP reply. */ +#define ARPOP_InREQUEST 8 /* InARP request. */ +#define ARPOP_InREPLY 9 /* InARP reply. */ +#define ARPOP_NAK 10 /* (ATM)ARP NAK. */ + +/* See RFC 826 for protocol description. ARP packets are variable + in size; the arphdr structure defines the fixed-length portion. + Protocol type values are the same as those for 10 Mb/s Ethernet. + It is followed by the variable-sized fields ar_sha, arp_spa, + arp_tha and arp_tpa in that order, according to the lengths + specified. Field names used correspond to RFC 826. */ + +struct arphdr + { + unsigned short int ar_hrd; /* Format of hardware address. */ + unsigned short int ar_pro; /* Format of protocol address. */ + unsigned char ar_hln; /* Length of hardware address. */ + unsigned char ar_pln; /* Length of protocol address. */ + unsigned short int ar_op; /* ARP opcode (command). */ +#if 0 + /* Ethernet looks like this : This bit is variable sized + however... */ + unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */ + unsigned char __ar_sip[4]; /* Sender IP address. */ + unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */ + unsigned char __ar_tip[4]; /* Target IP address. */ +#endif + }; + + +/* ARP protocol HARDWARE identifiers. */ +#define ARPHRD_NETROM 0 /* From KA9Q: NET/ROM pseudo. */ +#define ARPHRD_ETHER 1 /* Ethernet 10/100Mbps. */ +#define ARPHRD_EETHER 2 /* Experimental Ethernet. */ +#define ARPHRD_AX25 3 /* AX.25 Level 2. */ +#define ARPHRD_PRONET 4 /* PROnet token ring. */ +#define ARPHRD_CHAOS 5 /* Chaosnet. */ +#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB. */ +#define ARPHRD_ARCNET 7 /* ARCnet. */ +#define ARPHRD_APPLETLK 8 /* APPLEtalk. */ +#define ARPHRD_DLCI 15 /* Frame Relay DLCI. */ +#define ARPHRD_ATM 19 /* ATM. */ +#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id). */ +#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734. */ +#define ARPHRD_EUI64 27 /* EUI-64. */ +#define ARPHRD_INFINIBAND 32 /* InfiniBand. */ + +/* Dummy types for non ARP hardware */ +#define ARPHRD_SLIP 256 +#define ARPHRD_CSLIP 257 +#define ARPHRD_SLIP6 258 +#define ARPHRD_CSLIP6 259 +#define ARPHRD_RSRVD 260 /* Notional KISS type. */ +#define ARPHRD_ADAPT 264 +#define ARPHRD_ROSE 270 +#define ARPHRD_X25 271 /* CCITT X.25. */ +#define ARPHDR_HWX25 272 /* Boards with X.25 in firmware. */ +#define ARPHRD_PPP 512 +#define ARPHRD_CISCO 513 /* Cisco HDLC. */ +#define ARPHRD_HDLC ARPHRD_CISCO +#define ARPHRD_LAPB 516 /* LAPB. */ +#define ARPHRD_DDCMP 517 /* Digital's DDCMP. */ +#define ARPHRD_RAWHDLC 518 /* Raw HDLC. */ + +#define ARPHRD_TUNNEL 768 /* IPIP tunnel. */ +#define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */ +#define ARPHRD_FRAD 770 /* Frame Relay Access Device. */ +#define ARPHRD_SKIP 771 /* SKIP vif. */ +#define ARPHRD_LOOPBACK 772 /* Loopback device. */ +#define ARPHRD_LOCALTLK 773 /* Localtalk device. */ +#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface. */ +#define ARPHRD_BIF 775 /* AP1000 BIF. */ +#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4. */ +#define ARPHRD_IPDDP 777 /* IP-in-DDP tunnel. */ +#define ARPHRD_IPGRE 778 /* GRE over IP. */ +#define ARPHRD_PIMREG 779 /* PIMSM register interface. */ +#define ARPHRD_HIPPI 780 /* High Performance Parallel I'face. */ +#define ARPHRD_ASH 781 /* (Nexus Electronics) Ash. */ +#define ARPHRD_ECONET 782 /* Acorn Econet. */ +#define ARPHRD_IRDA 783 /* Linux-IrDA. */ +#define ARPHRD_FCPP 784 /* Point to point fibrechanel. */ +#define ARPHRD_FCAL 785 /* Fibrechanel arbitrated loop. */ +#define ARPHRD_FCPL 786 /* Fibrechanel public loop. */ +#define ARPHRD_FCFABRIC 787 /* Fibrechanel fabric. */ +#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR. */ +#define ARPHRD_IEEE80211 801 /* IEEE 802.11. */ + +/* ARP ioctl request. */ +struct arpreq + { + struct sockaddr arp_pa; /* Protocol address. */ + struct sockaddr arp_ha; /* Hardware address. */ + int arp_flags; /* Flags. */ + struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */ + char arp_dev[16]; + }; + +struct arpreq_old + { + struct sockaddr arp_pa; /* Protocol address. */ + struct sockaddr arp_ha; /* Hardware address. */ + int arp_flags; /* Flags. */ + struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */ + }; + +/* ARP Flag values. */ +#define ATF_COM 0x02 /* Completed entry (ha valid). */ +#define ATF_PERM 0x04 /* Permanent entry. */ +#define ATF_PUBL 0x08 /* Publish entry. */ +#define ATF_USETRAILERS 0x10 /* Has requested trailers. */ +#define ATF_NETMASK 0x20 /* Want to use a netmask (only + for proxy entries). */ +#define ATF_DONTPUB 0x40 /* Don't answer this addresses. */ +#define ATF_MAGIC 0x80 /* Automatically added entry. */ + + +/* Support for the user space arp daemon, arpd. */ +#define ARPD_UPDATE 0x01 +#define ARPD_LOOKUP 0x02 +#define ARPD_FLUSH 0x03 + +struct arpd_request + { + unsigned short int req; /* Request type. */ + u_int32_t ip; /* IP address of entry. */ + unsigned long int dev; /* Device entry is tied to. */ + unsigned long int stamp; + unsigned long int updated; + unsigned char ha[MAX_ADDR_LEN]; /* Hardware address. */ + }; + +__END_DECLS + +#endif /* net/if_arp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_packet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_packet.h new file mode 100644 index 0000000..e5184e7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_packet.h @@ -0,0 +1,37 @@ +/* Definitions for use with Linux SOCK_PACKET sockets. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __IF_PACKET_H +#define __IF_PACKET_H + +#include +#include + +/* This is the SOCK_PACKET address structure as used in Linux 2.0. + From Linux 2.1 the AF_PACKET interface is preferred and you should + consider using it in place of this one. */ + +struct sockaddr_pkt + { + __SOCKADDR_COMMON (spkt_); + unsigned char spkt_device[14]; + unsigned short spkt_protocol; + }; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_ppp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_ppp.h new file mode 100644 index 0000000..bf5ec83 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_ppp.h @@ -0,0 +1,169 @@ +/* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */ + +/* + * if_ppp.h - Point-to-Point Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + * ==FILEVERSION 960926== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. + * if_ppp.h is shipped with a PPP distribution as well as with the kernel; + * if everyone increases the FILEVERSION number above, then scripts + * can do the right thing when deciding whether to install a new if_ppp.h + * file. Don't change the format of that line otherwise, so the + * installation script can recognize it. + */ + + +#ifndef __NET_IF_PPP_H +#define __NET_IF_PPP_H 1 + +#include +#include + +#include +#include +#include + +__BEGIN_DECLS + +/* + * Packet sizes + */ + +#define PPP_MTU 1500 /* Default MTU (size of Info field) */ +#define PPP_MAXMRU 65000 /* Largest MRU we allow */ +#define PPP_VERSION "2.2.0" +#define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */ +#define PROTO_IPX 0x002b /* protocol numbers */ +#define PROTO_DNA_RT 0x0027 /* DNA Routing */ + + +/* + * Bit definitions for flags. + */ + +#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ +#define SC_COMP_AC 0x00000002 /* header compression (output) */ +#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ +#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ +#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ +#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ +#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ +#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ +#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ +#define SC_COMP_RUN 0x00001000 /* compressor has been inited */ +#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ +#define SC_DEBUG 0x00010000 /* enable debug messages */ +#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ +#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ +#define SC_LOG_RAWIN 0x00080000 /* log all chars received */ +#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ +#define SC_MASK 0x0fE0ffff /* bits that user can change */ + +/* state bits */ +#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ +#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ +#define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */ +#define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */ +#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ +#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ +#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ +#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ +#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ +#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ + +/* + * Ioctl definitions. + */ + +struct npioctl { + int protocol; /* PPP protocol, e.g. PPP_IP */ + enum NPmode mode; +}; + +/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ +struct ppp_option_data { + u_int8_t *ptr; + u_int32_t length; + int transmit; +}; + +struct ifpppstatsreq { + struct ifreq b; + struct ppp_stats stats; /* statistic information */ +}; + +struct ifpppcstatsreq { + struct ifreq b; + struct ppp_comp_stats stats; +}; + +#define ifr__name b.ifr_ifrn.ifrn_name +#define stats_ptr b.ifr_ifru.ifru_data + +/* + * Ioctl definitions. + */ + +#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ +#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ +#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ +#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ +#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ +#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ +#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ +#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ +#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ +#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ +#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ +#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ +#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ +#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) +#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ +#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ +#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ +#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ +#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ + +#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) +#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ +#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) + +#if !defined(ifr_mtu) +#define ifr_mtu ifr_ifru.ifru_metric +#endif + +__END_DECLS + +#endif /* net/if_ppp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_shaper.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_shaper.h new file mode 100644 index 0000000..7060af3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_shaper.h @@ -0,0 +1,59 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NET_IF_SHAPER_H +#define _NET_IF_SHAPER_H 1 + +#include +#include +#include +#include + +__BEGIN_DECLS + +#define SHAPER_QLEN 10 +/* + * This is a bit speed dependant (read it shouldnt be a constant!) + * + * 5 is about right for 28.8 upwards. Below that double for every + * halving of speed or so. - ie about 20 for 9600 baud. + */ +#define SHAPER_LATENCY (5 * HZ) +#define SHAPER_MAXSLIP 2 +#define SHAPER_BURST (HZ / 50) /* Good for >128K then */ + +#define SHAPER_SET_DEV 0x0001 +#define SHAPER_SET_SPEED 0x0002 +#define SHAPER_GET_DEV 0x0003 +#define SHAPER_GET_SPEED 0x0004 + +struct shaperconf +{ + u_int16_t ss_cmd; + union + { + char ssu_name[14]; + u_int32_t ssu_speed; + } ss_u; +#define ss_speed ss_u.ssu_speed +#define ss_name ss_u.ssu_name +}; + +__END_DECLS + +#endif /* net/if_shaper.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_slip.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_slip.h new file mode 100644 index 0000000..66bd7f3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/if_slip.h @@ -0,0 +1,25 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NET_IF_SLIP_H +#define _NET_IF_SLIP_H 1 + +/* We can use the kernel header. */ +#include + +#endif /* net/if_slip.h. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ppp-comp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ppp-comp.h new file mode 100644 index 0000000..4a992d5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ppp-comp.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ppp_defs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ppp_defs.h new file mode 100644 index 0000000..f8924c4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/ppp_defs.h @@ -0,0 +1,10 @@ +#ifndef _NET_PPP_DEFS_H +#define _NET_PPP_DEFS_H 1 + +#define __need_time_t +#include + +#include +#include + +#endif /* net/ppp_defs.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/route.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/route.h new file mode 100644 index 0000000..da5c810 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/net/route.h @@ -0,0 +1,145 @@ +/* Copyright (C) 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Based on the 4.4BSD and Linux version of this file. */ + +#ifndef _NET_ROUTE_H +#define _NET_ROUTE_H 1 + +#include +#include +#include +#include +#include + + +/* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ +struct rtentry + { + unsigned long int rt_pad1; + struct sockaddr rt_dst; /* Target address. */ + struct sockaddr rt_gateway; /* Gateway addr (RTF_GATEWAY). */ + struct sockaddr rt_genmask; /* Target network mask (IP). */ + unsigned short int rt_flags; + short int rt_pad2; + unsigned long int rt_pad3; + unsigned char rt_tos; + unsigned char rt_class; +#if __WORDSIZE == 64 + short int rt_pad4[3]; +#else + short int rt_pad4; +#endif + short int rt_metric; /* +1 for binary compatibility! */ + char *rt_dev; /* Forcing the device at add. */ + unsigned long int rt_mtu; /* Per route MTU/Window. */ + unsigned long int rt_window; /* Window clamping. */ + unsigned short int rt_irtt; /* Initial RTT. */ + }; +/* Compatibility hack. */ +#define rt_mss rt_mtu + + +struct in6_rtmsg + { + struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_src; + struct in6_addr rtmsg_gateway; + u_int32_t rtmsg_type; + u_int16_t rtmsg_dst_len; + u_int16_t rtmsg_src_len; + u_int32_t rtmsg_metric; + unsigned long int rtmsg_info; + u_int32_t rtmsg_flags; + int rtmsg_ifindex; + }; + + +#define RTF_UP 0x0001 /* Route usable. */ +#define RTF_GATEWAY 0x0002 /* Destination is a gateway. */ + +#define RTF_HOST 0x0004 /* Host entry (net otherwise). */ +#define RTF_REINSTATE 0x0008 /* Reinstate route after timeout. */ +#define RTF_DYNAMIC 0x0010 /* Created dyn. (by redirect). */ +#define RTF_MODIFIED 0x0020 /* Modified dyn. (by redirect). */ +#define RTF_MTU 0x0040 /* Specific MTU for this route. */ +#define RTF_MSS RTF_MTU /* Compatibility. */ +#define RTF_WINDOW 0x0080 /* Per route window clamping. */ +#define RTF_IRTT 0x0100 /* Initial round trip time. */ +#define RTF_REJECT 0x0200 /* Reject route. */ +#define RTF_STATIC 0x0400 /* Manually injected route. */ +#define RTF_XRESOLVE 0x0800 /* External resolver. */ +#define RTF_NOFORWARD 0x1000 /* Forwarding inhibited. */ +#define RTF_THROW 0x2000 /* Go to next class. */ +#define RTF_NOPMTUDISC 0x4000 /* Do not send packets with DF. */ + +/* for IPv6 */ +#define RTF_DEFAULT 0x00010000 /* default - learned via ND */ +#define RTF_ALLONLINK 0x00020000 /* fallback, no routers on link */ +#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ + +#define RTF_LINKRT 0x00100000 /* link specific - device match */ +#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ + +#define RTF_CACHE 0x01000000 /* cache entry */ +#define RTF_FLOW 0x02000000 /* flow significant route */ +#define RTF_POLICY 0x04000000 /* policy route */ + +#define RTCF_VALVE 0x00200000 +#define RTCF_MASQ 0x00400000 +#define RTCF_NAT 0x00800000 +#define RTCF_DOREDIRECT 0x01000000 +#define RTCF_LOG 0x02000000 +#define RTCF_DIRECTSRC 0x04000000 + +#define RTF_LOCAL 0x80000000 +#define RTF_INTERFACE 0x40000000 +#define RTF_MULTICAST 0x20000000 +#define RTF_BROADCAST 0x10000000 +#define RTF_NAT 0x08000000 + +#define RTF_ADDRCLASSMASK 0xF8000000 +#define RT_ADDRCLASS(flags) ((__u_int32_t) flags >> 23) + +#define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) + +#define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \ + == (RTF_LOCAL|RTF_INTERFACE)) + +#define RT_CLASS_UNSPEC 0 +#define RT_CLASS_DEFAULT 253 + +#define RT_CLASS_MAIN 254 +#define RT_CLASS_LOCAL 255 +#define RT_CLASS_MAX 255 + + +#define RTMSG_ACK NLMSG_ACK +#define RTMSG_OVERRUN NLMSG_OVERRUN + +#define RTMSG_NEWDEVICE 0x11 +#define RTMSG_DELDEVICE 0x12 +#define RTMSG_NEWROUTE 0x21 +#define RTMSG_DELROUTE 0x22 +#define RTMSG_NEWRULE 0x31 +#define RTMSG_DELRULE 0x32 +#define RTMSG_CONTROL 0x40 + +#define RTMSG_AR_FAILED 0x51 /* Address Resolution failed. */ + +#endif /* net/route.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netax25/ax25.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netax25/ax25.h new file mode 100644 index 0000000..ce3c7ab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netax25/ax25.h @@ -0,0 +1,171 @@ +/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETAX25_AX25_H +#define _NETAX25_AX25_H 1 + +#include +#include + +/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx. */ +#define SOL_AX25 257 + +/* AX.25 flags: */ +#define AX25_WINDOW 1 +#define AX25_T1 2 +#define AX25_T2 5 +#define AX25_T3 4 +#define AX25_N2 3 +#define AX25_BACKOFF 6 +#define AX25_EXTSEQ 7 +#define AX25_PIDINCL 8 +#define AX25_IDLE 9 +#define AX25_PACLEN 10 +#define AX25_IPMAXQUEUE 11 +#define AX25_IAMDIGI 12 +#define AX25_KILL 99 + +/* AX.25 socket ioctls: */ +#define SIOCAX25GETUID (SIOCPROTOPRIVATE) +#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) +#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) +#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) +#define SIOCAX25BPQADDR (SIOCPROTOPRIVATE+4) +#define SIOCAX25GETPARMS (SIOCPROTOPRIVATE+5) +#define SIOCAX25SETPARMS (SIOCPROTOPRIVATE+6) +#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) +#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) +#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+9) +#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) +#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) + +/* unknown: */ +#define AX25_NOUID_DEFAULT 0 +#define AX25_NOUID_BLOCK 1 +#define AX25_SET_RT_IPMODE 2 + +/* Digipeating flags: */ +#define AX25_DIGI_INBAND 0x01 /* Allow digipeating within port */ +#define AX25_DIGI_XBAND 0x02 /* Allow digipeating across ports */ + +/* Maximim number of digipeaters: */ +#define AX25_MAX_DIGIS 8 + + +typedef struct + { + char ax25_call[7]; /* 6 call + SSID (shifted ascii) */ + } +ax25_address; + +struct sockaddr_ax25 + { + sa_family_t sax25_family; + ax25_address sax25_call; + int sax25_ndigis; + }; + +/* + * The sockaddr struct with the digipeater adresses: + */ +struct full_sockaddr_ax25 + { + struct sockaddr_ax25 fsa_ax25; + ax25_address fsa_digipeater[AX25_MAX_DIGIS]; + }; +#define sax25_uid sax25_ndigis + +struct ax25_routes_struct + { + ax25_address port_addr; + ax25_address dest_addr; + unsigned char digi_count; + ax25_address digi_addr[AX25_MAX_DIGIS]; + }; + +/* The AX.25 ioctl structure: */ +struct ax25_ctl_struct + { + ax25_address port_addr; + ax25_address source_addr; + ax25_address dest_addr; + unsigned int cmd; + unsigned long arg; + unsigned char digi_count; + ax25_address digi_addr[AX25_MAX_DIGIS]; + }; + +struct ax25_info_struct + { + unsigned int n2, n2count; + unsigned int t1, t1timer; + unsigned int t2, t2timer; + unsigned int t3, t3timer; + unsigned int idle, idletimer; + unsigned int state; + unsigned int rcv_q, snd_q; + }; + +struct ax25_fwd_struct + { + ax25_address port_from; + ax25_address port_to; + }; + +/* AX.25 route structure: */ +struct ax25_route_opt_struct + { + ax25_address port_addr; + ax25_address dest_addr; + int cmd; + int arg; + }; + +/* AX.25 BPQ stuff: */ +struct ax25_bpqaddr_struct + { + char dev[16]; + ax25_address addr; + }; + +/* Definitions for the AX.25 `values' fields: */ +#define AX25_VALUES_IPDEFMODE 0 /* 'D'=DG 'V'=VC */ +#define AX25_VALUES_AXDEFMODE 1 /* 8=Normal 128=Extended Seq Nos */ +#define AX25_VALUES_NETROM 2 /* Allow NET/ROM - 0=No 1=Yes */ +#define AX25_VALUES_TEXT 3 /* Allow PID=Text - 0=No 1=Yes */ +#define AX25_VALUES_BACKOFF 4 /* 'E'=Exponential 'L'=Linear */ +#define AX25_VALUES_CONMODE 5 /* Allow connected modes - 0=No 1=Yes */ +#define AX25_VALUES_WINDOW 6 /* Default window size for standard AX.25 */ +#define AX25_VALUES_EWINDOW 7 /* Default window size for extended AX.25 */ +#define AX25_VALUES_T1 8 /* Default T1 timeout value */ +#define AX25_VALUES_T2 9 /* Default T2 timeout value */ +#define AX25_VALUES_T3 10 /* Default T3 timeout value */ +#define AX25_VALUES_N2 11 /* Default N2 value */ +#define AX25_VALUES_DIGI 12 /* Digipeat mode */ +#define AX25_VALUES_IDLE 13 /* mode vc idle timer */ +#define AX25_VALUES_PACLEN 14 /* AX.25 MTU */ +#define AX25_VALUES_IPMAXQUEUE 15 /* Maximum number of buffers enqueued */ +#define AX25_MAX_VALUES 20 + +struct ax25_parms_struct + { + ax25_address port_addr; + unsigned short values[AX25_MAX_VALUES]; + }; + +#endif /* netax25/ax25.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netdb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netdb.h new file mode 100644 index 0000000..fe3da82 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netdb.h @@ -0,0 +1,658 @@ +/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* All data returned by the network data base library are supplied in + host order and returned in network order (suitable for use in + system calls). */ + +#ifndef _NETDB_H +#define _NETDB_H 1 + +#include + +#include +#include +#ifdef __USE_MISC +/* This is necessary to make this include file properly replace the + Sun version. */ +# include +#endif + +#ifdef __USE_GNU +# define __need_sigevent_t +# include +# define __need_timespec +# include +#endif + +#include + +/* Absolute file name for network data base files. */ +#define _PATH_HEQUIV "/etc/hosts.equiv" +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" + + +__BEGIN_DECLS + +/* Error status for non-reentrant lookup functions. + We use a macro to access always the thread-specific `h_errno' variable. + We always need the extern int here in case internal libc code undefines + the macro because it needs access to the underlying storage. */ +extern int h_errno; +#ifdef __UCLIBC_HAS_THREADS__ +# define h_errno (*__h_errno_location ()) +#endif + +/* Function to get address of global `h_errno' variable. */ +extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); + +#ifdef _LIBC +# define __set_h_errno(x) (h_errno = (x)) +#endif + +/* Possible values left in `h_errno'. */ +#define NETDB_INTERNAL -1 /* See errno. */ +#define NETDB_SUCCESS 0 /* No problem. */ +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */ +#define TRY_AGAIN 2 /* Non-Authoritative Host not found, + or SERVERFAIL. */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, + NOTIMP. */ +#define NO_DATA 4 /* Valid name, no data record of requested + type. */ +#define NO_ADDRESS NO_DATA /* No address, look for MX record. */ + +#ifdef __USE_XOPEN2K +/* Highest reserved Internet port number. */ +# define IPPORT_RESERVED 1024 +#endif + +#ifdef __USE_GNU +/* Scope delimiter for getaddrinfo(), getnameinfo(). */ +# define SCOPE_DELIMITER '%' +#endif + +/* Print error indicated by `h_errno' variable on standard error. STR + if non-null is printed before the error string. */ +extern void herror (__const char *__str) __THROW; + +/* Return string associated with error ERR_NUM. */ +extern __const char *hstrerror (int __err_num) __THROW; + + + +/* Description of data base entry for a single host. */ +struct hostent +{ + char *h_name; /* Official name of host. */ + char **h_aliases; /* Alias list. */ + int h_addrtype; /* Host address type. */ + int h_length; /* Length of address. */ + char **h_addr_list; /* List of addresses from name server. */ +#define h_addr h_addr_list[0] /* Address, for backward compatibility. */ +}; + +/* Open host data base files and mark them as staying open even after + a later search if STAY_OPEN is non-zero. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void sethostent (int __stay_open); + +/* Close host data base files and clear `stay open' flag. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endhostent (void); + +/* Get next entry from host data base file. Open data base if + necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct hostent *gethostent (void); + +/* Return entry from host data base which address match ADDR with + length LEN and type TYPE. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct hostent *gethostbyaddr (__const void *__addr, __socklen_t __len, + int __type); + +/* Return entry from host data base for host with NAME. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct hostent *gethostbyname (__const char *__name); + +#ifdef __USE_MISC +/* Return entry from host data base for host with NAME. AF must be + set to the address type which is `AF_INET' for IPv4 or `AF_INET6' + for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct hostent *gethostbyname2 (__const char *__name, int __af); + +/* Reentrant versions of the functions above. The additional + arguments specify a buffer of BUFLEN starting at BUF. The last + argument is a pointer to a variable which gets the value which + would be stored in the global variable `herrno' by the + non-reentrant functions. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern int gethostent_r (struct hostent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct hostent **__restrict __result, + int *__restrict __h_errnop); + +extern int gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len, + int __type, + struct hostent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct hostent **__restrict __result, + int *__restrict __h_errnop); + +extern int gethostbyname_r (__const char *__restrict __name, + struct hostent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct hostent **__restrict __result, + int *__restrict __h_errnop); + +extern int gethostbyname2_r (__const char *__restrict __name, int __af, + struct hostent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct hostent **__restrict __result, + int *__restrict __h_errnop); +#endif /* misc */ + + +/* Open network data base files and mark them as staying open even + after a later search if STAY_OPEN is non-zero. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setnetent (int __stay_open); + +/* Close network data base files and clear `stay open' flag. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endnetent (void); + +/* Get next entry from network data base file. Open data base if + necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct netent *getnetent (void); + +/* Return entry from network data base which address match NET and + type TYPE. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct netent *getnetbyaddr (uint32_t __net, int __type); + +/* Return entry from network data base for network with NAME. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct netent *getnetbyname (__const char *__name); + +#if 0 +/* FIXME */ +#ifdef __USE_MISC +/* Reentrant versions of the functions above. The additional + arguments specify a buffer of BUFLEN starting at BUF. The last + argument is a pointer to a variable which gets the value which + would be stored in the global variable `herrno' by the + non-reentrant functions. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern int getnetent_r (struct netent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct netent **__restrict __result, + int *__restrict __h_errnop); + +extern int getnetbyaddr_r (uint32_t __net, int __type, + struct netent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct netent **__restrict __result, + int *__restrict __h_errnop); + +extern int getnetbyname_r (__const char *__restrict __name, + struct netent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct netent **__restrict __result, + int *__restrict __h_errnop); +#endif /* misc */ +#endif + + +/* Description of data base entry for a single service. */ +struct servent +{ + char *s_name; /* Official service name. */ + char **s_aliases; /* Alias list. */ + int s_port; /* Port number. */ + char *s_proto; /* Protocol to use. */ +}; + +/* Open service data base files and mark them as staying open even + after a later search if STAY_OPEN is non-zero. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setservent (int __stay_open); + +/* Close service data base files and clear `stay open' flag. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endservent (void); + +/* Get next entry from service data base file. Open data base if + necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct servent *getservent (void); + +/* Return entry from network data base for network with NAME and + protocol PROTO. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct servent *getservbyname (__const char *__name, + __const char *__proto); + +/* Return entry from service data base which matches port PORT and + protocol PROTO. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct servent *getservbyport (int __port, __const char *__proto); + + +#ifdef __USE_MISC +/* Reentrant versions of the functions above. The additional + arguments specify a buffer of BUFLEN starting at BUF. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern int getservent_r (struct servent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct servent **__restrict __result); + +extern int getservbyname_r (__const char *__restrict __name, + __const char *__restrict __proto, + struct servent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct servent **__restrict __result); + +extern int getservbyport_r (int __port, __const char *__restrict __proto, + struct servent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct servent **__restrict __result); +#endif /* misc */ + + +/* Description of data base entry for a single service. */ +struct protoent +{ + char *p_name; /* Official protocol name. */ + char **p_aliases; /* Alias list. */ + int p_proto; /* Protocol number. */ +}; + +/* Open protocol data base files and mark them as staying open even + after a later search if STAY_OPEN is non-zero. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setprotoent (int __stay_open); + +/* Close protocol data base files and clear `stay open' flag. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endprotoent (void); + +/* Get next entry from protocol data base file. Open data base if + necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct protoent *getprotoent (void); + +/* Return entry from protocol data base for network with NAME. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct protoent *getprotobyname (__const char *__name); + +/* Return entry from protocol data base which number is PROTO. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct protoent *getprotobynumber (int __proto); + + +#ifdef __USE_MISC +/* Reentrant versions of the functions above. The additional + arguments specify a buffer of BUFLEN starting at BUF. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern int getprotoent_r (struct protoent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct protoent **__restrict __result); + +extern int getprotobyname_r (__const char *__restrict __name, + struct protoent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct protoent **__restrict __result); + +extern int getprotobynumber_r (int __proto, + struct protoent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct protoent **__restrict __result); + + +#ifdef __UCLIBC_HAS_NETGROUP__ +/* Establish network group NETGROUP for enumeration. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int setnetgrent (__const char *__netgroup); + +/* Free all space allocated by previous `setnetgrent' call. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void endnetgrent (void); + +/* Get next member of netgroup established by last `setnetgrent' call + and return pointers to elements in HOSTP, USERP, and DOMAINP. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int getnetgrent (char **__restrict __hostp, + char **__restrict __userp, + char **__restrict __domainp); + + +/* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int innetgr (__const char *__netgroup, __const char *__host, + __const char *__user, __const char *domain); + +/* Reentrant version of `getnetgrent' where result is placed in BUFFER. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int getnetgrent_r (char **__restrict __hostp, + char **__restrict __userp, + char **__restrict __domainp, + char *__restrict __buffer, size_t __buflen); +#endif /* UCLIBC_HAS_NETGROUP */ +#endif /* misc */ + + +#ifdef __USE_BSD +/* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. + The local user is LOCUSER, on the remote machine the command is + executed as REMUSER. In *FD2P the descriptor to the socket for the + connection is returned. The caller must have the right to use a + reserved port. When the function returns *AHOST contains the + official host name. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int rcmd (char **__restrict __ahost, unsigned short int __rport, + __const char *__restrict __locuser, + __const char *__restrict __remuser, + __const char *__restrict __cmd, int *__restrict __fd2p); + +#if 0 +/* FIXME */ +/* This is the equivalent function where the protocol can be selected + and which therefore can be used for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport, + __const char *__restrict __locuser, + __const char *__restrict __remuser, + __const char *__restrict __cmd, int *__restrict __fd2p, + sa_family_t __af); +#endif + +/* Call `rexecd' at port RPORT on remote machine *AHOST to execute + CMD. The process runs at the remote machine using the ID of user + NAME whose cleartext password is PASSWD. In *FD2P the descriptor + to the socket for the connection is returned. When the function + returns *AHOST contains the official host name. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int rexec (char **__restrict __ahost, int __rport, + __const char *__restrict __name, + __const char *__restrict __pass, + __const char *__restrict __cmd, int *__restrict __fd2p); + +/* This is the equivalent function where the protocol can be selected + and which therefore can be used for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int rexec_af (char **__restrict __ahost, int __rport, + __const char *__restrict __name, + __const char *__restrict __pass, + __const char *__restrict __cmd, int *__restrict __fd2p, + sa_family_t __af); + +/* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. + If SUSER is not zero the user tries to become superuser. Return 0 if + it is possible. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int ruserok (__const char *__rhost, int __suser, + __const char *__remuser, __const char *__locuser); + +#if 0 +/* FIXME */ +/* This is the equivalent function where the protocol can be selected + and which therefore can be used for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int ruserok_af (__const char *__rhost, int __suser, + __const char *__remuser, __const char *__locuser, + sa_family_t __af); +#endif + +/* Try to allocate reserved port, returning a descriptor for a socket opened + at this port or -1 if unsuccessful. The search for an available port + will start at ALPORT and continues with lower numbers. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int rresvport (int *__alport); + +#if 0 +/* FIXME */ +/* This is the equivalent function where the protocol can be selected + and which therefore can be used for IPv6. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int rresvport_af (int *__alport, sa_family_t __af); +#endif +#endif + + +/* Extension from POSIX.1g. */ +#ifdef __USE_POSIX +/* Structure to contain information about address of a service provider. */ +struct addrinfo +{ + int ai_flags; /* Input flags. */ + int ai_family; /* Protocol family for socket. */ + int ai_socktype; /* Socket type. */ + int ai_protocol; /* Protocol for socket. */ + socklen_t ai_addrlen; /* Length of socket address. */ + struct sockaddr *ai_addr; /* Socket address for socket. */ + char *ai_canonname; /* Canonical name for service location. */ + struct addrinfo *ai_next; /* Pointer to next in list. */ +}; + +/* Possible values for `ai_flags' field in `addrinfo' structure. */ +# define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ +# define AI_CANONNAME 0x0002 /* Request for canonical name. */ +# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ +# define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ +# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ +# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose + returned address type.. */ +# ifdef __USE_GNU +# define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded + in the current locale's character set) + before looking it up. */ +# define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */ +# define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode + code points. */ +# define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to + STD3 rules. */ +# endif +# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ + +/* Error values for `getaddrinfo' function. */ +# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ +# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ +# define EAI_AGAIN -3 /* Temporary failure in name resolution. */ +# define EAI_FAIL -4 /* Non-recoverable failure in name res. */ +# define EAI_NODATA -5 /* No address associated with NAME. */ +# define EAI_FAMILY -6 /* `ai_family' not supported. */ +# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ +# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ +# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ +# define EAI_MEMORY -10 /* Memory allocation failure. */ +# define EAI_SYSTEM -11 /* System error returned in `errno'. */ +# define EAI_OVERFLOW -12 /* Argument buffer overflow. */ +# ifdef __USE_GNU +# define EAI_INPROGRESS -100 /* Processing request in progress. */ +# define EAI_CANCELED -101 /* Request canceled. */ +# define EAI_NOTCANCELED -102 /* Request not canceled. */ +# define EAI_ALLDONE -103 /* All requests done. */ +# define EAI_INTR -104 /* Interrupted by a signal. */ +# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ +# endif + +# define NI_MAXHOST 1025 +# define NI_MAXSERV 32 + +# define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ +# define NI_NUMERICSERV 2 /* Don't convert port number to name. */ +# define NI_NOFQDN 4 /* Only return nodename portion. */ +# define NI_NAMEREQD 8 /* Don't return numeric addresses. */ +# define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ +# ifdef __USE_GNU +# define NI_IDN 32 /* Convert name from IDN format. */ +# define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode + code points. */ +# define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to + STD3 rules. */ +# endif + +/* Translate name of a service location and/or a service name to set of + socket addresses. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int getaddrinfo (__const char *__restrict __name, + __const char *__restrict __service, + __const struct addrinfo *__restrict __req, + struct addrinfo **__restrict __pai); + +/* Free `addrinfo' structure AI including associated storage. */ +extern void freeaddrinfo (struct addrinfo *__ai) __THROW; + +/* Convert error return from getaddrinfo() to a string. */ +extern __const char *gai_strerror (int __ecode) __THROW; + +/* Translate a socket address to a location and service name. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int getnameinfo (__const struct sockaddr *__restrict __sa, + socklen_t __salen, char *__restrict __host, + socklen_t __hostlen, char *__restrict __serv, + socklen_t __servlen, unsigned int __flags); +#endif /* POSIX */ + +__END_DECLS + +#endif /* netdb.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/neteconet/ec.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/neteconet/ec.h new file mode 100644 index 0000000..f21601c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/neteconet/ec.h @@ -0,0 +1,52 @@ +/* Definitions for use with Linux AF_ECONET sockets. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETECONET_EC_H +#define _NETECONET_EC_H 1 + +#include +#include + +struct ec_addr + { + unsigned char station; /* Station number. */ + unsigned char net; /* Network number. */ + }; + +struct sockaddr_ec + { + __SOCKADDR_COMMON (sec_); + unsigned char port; /* Port number. */ + unsigned char cb; /* Control/flag byte. */ + unsigned char type; /* Type of message. */ + struct ec_addr addr; + unsigned long cookie; + }; + +#define ECTYPE_PACKET_RECEIVED 0 /* Packet received */ +#define ECTYPE_TRANSMIT_STATUS 0x10 /* Transmit completed */ + +#define ECTYPE_TRANSMIT_OK 1 +#define ECTYPE_TRANSMIT_NOT_LISTENING 2 +#define ECTYPE_TRANSMIT_NET_ERROR 3 +#define ECTYPE_TRANSMIT_NO_CLOCK 4 +#define ECTYPE_TRANSMIT_LINE_JAMMED 5 +#define ECTYPE_TRANSMIT_NOT_PRESENT 6 + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ether.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ether.h new file mode 100644 index 0000000..ca780e2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ether.h @@ -0,0 +1,54 @@ +/* Functions for storing Ethernet addresses in ASCII and mapping to hostnames. + Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETINET_ETHER_H +#define _NETINET_ETHER_H 1 + +#include + +/* Get definition of `struct ether_addr'. */ +#include + +__BEGIN_DECLS + +/* Convert 48 bit Ethernet ADDRess to ASCII. */ +extern char *ether_ntoa (__const struct ether_addr *__addr) __THROW; +extern char *ether_ntoa_r (__const struct ether_addr *__addr, char *__buf) + __THROW; + +/* Convert ASCII string S to 48 bit Ethernet address. */ +extern struct ether_addr *ether_aton (__const char *__asc) __THROW; +extern struct ether_addr *ether_aton_r (__const char *__asc, + struct ether_addr *__addr) __THROW; + +/* Map 48 bit Ethernet number ADDR to HOSTNAME. */ +extern int ether_ntohost (char *__hostname, __const struct ether_addr *__addr) + __THROW; + +/* Map HOSTNAME to 48 bit Ethernet address. */ +extern int ether_hostton (__const char *__hostname, struct ether_addr *__addr) + __THROW; + +/* Scan LINE and set ADDR and HOSTNAME. */ +extern int ether_line (__const char *__line, struct ether_addr *__addr, + char *__hostname) __THROW; + +__END_DECLS + +#endif /* netinet/ether.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/icmp6.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/icmp6.h new file mode 100644 index 0000000..c5138a3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/icmp6.h @@ -0,0 +1,346 @@ +/* Copyright (C) 1991,92,93,94,95,96,97,2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETINET_ICMP6_H +#define _NETINET_ICMP6_H 1 + +#include +#include +#include +#include + +#define ICMP6_FILTER 1 + +#define ICMP6_FILTER_BLOCK 1 +#define ICMP6_FILTER_PASS 2 +#define ICMP6_FILTER_BLOCKOTHERS 3 +#define ICMP6_FILTER_PASSONLY 4 + +struct icmp6_filter + { + uint32_t icmp6_filt[8]; + }; + +struct icmp6_hdr + { + uint8_t icmp6_type; /* type field */ + uint8_t icmp6_code; /* code field */ + uint16_t icmp6_cksum; /* checksum field */ + union + { + uint32_t icmp6_un_data32[1]; /* type-specific field */ + uint16_t icmp6_un_data16[2]; /* type-specific field */ + uint8_t icmp6_un_data8[4]; /* type-specific field */ + } icmp6_dataun; + }; + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] /* parameter prob */ +#define icmp6_mtu icmp6_data32[0] /* packet too big */ +#define icmp6_id icmp6_data16[0] /* echo request/reply */ +#define icmp6_seq icmp6_data16[1] /* echo request/reply */ +#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ + +#define ICMP6_DST_UNREACH 1 +#define ICMP6_PACKET_TOO_BIG 2 +#define ICMP6_TIME_EXCEEDED 3 +#define ICMP6_PARAM_PROB 4 + +#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ + +#define ICMP6_ECHO_REQUEST 128 +#define ICMP6_ECHO_REPLY 129 +#define MLD_LISTENER_QUERY 130 +#define MLD_LISTENER_REPORT 131 +#define MLD_LISTENER_REDUCTION 132 + +#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ +#define ICMP6_DST_UNREACH_ADMIN 1 /* communication with destination */ + /* administratively prohibited */ +#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ +#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ +#define ICMP6_DST_UNREACH_NOPORT 4 /* bad port */ + +#define ICMP6_TIME_EXCEED_TRANSIT 0 /* Hop Limit == 0 in transit */ +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* Reassembly time out */ + +#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ +#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized Next Header */ +#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized IPv6 option */ + +#define ICMP6_FILTER_WILLPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) + +#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) + +#define ICMP6_FILTER_SETPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))) + +#define ICMP6_FILTER_SETBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))) + +#define ICMP6_FILTER_SETPASSALL(filterp) \ + memset (filterp, 0, sizeof (struct icmp6_filter)); + +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + memset (filterp, 0xFF, sizeof (struct icmp6_filter)); + +#define ND_ROUTER_SOLICIT 133 +#define ND_ROUTER_ADVERT 134 +#define ND_NEIGHBOR_SOLICIT 135 +#define ND_NEIGHBOR_ADVERT 136 +#define ND_REDIRECT 137 + +struct nd_router_solicit /* router solicitation */ + { + struct icmp6_hdr nd_rs_hdr; + /* could be followed by options */ + }; + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert /* router advertisement */ + { + struct icmp6_hdr nd_ra_hdr; + uint32_t nd_ra_reachable; /* reachable time */ + uint32_t nd_ra_retransmit; /* retransmit timer */ + /* could be followed by options */ + }; + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define ND_RA_FLAG_HOME_AGENT 0x20 +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit /* neighbor solicitation */ + { + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; /* target address */ + /* could be followed by options */ + }; + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert /* neighbor advertisement */ + { + struct icmp6_hdr nd_na_hdr; + struct in6_addr nd_na_target; /* target address */ + /* could be followed by options */ + }; + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if BYTE_ORDER == BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +#define ND_NA_FLAG_ROUTER 0x00000080 +#define ND_NA_FLAG_SOLICITED 0x00000040 +#define ND_NA_FLAG_OVERRIDE 0x00000020 +#endif + +struct nd_redirect /* redirect */ + { + struct icmp6_hdr nd_rd_hdr; + struct in6_addr nd_rd_target; /* target address */ + struct in6_addr nd_rd_dst; /* destination address */ + /* could be followed by options */ + }; + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct nd_opt_hdr /* Neighbor discovery option header */ + { + uint8_t nd_opt_type; + uint8_t nd_opt_len; /* in units of 8 octets */ + /* followed by option specific data */ + }; + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 +#define ND_OPT_RTR_ADV_INTERVAL 7 +#define ND_OPT_HOME_AGENT_INFO 8 + +struct nd_opt_prefix_info /* prefix information */ + { + uint8_t nd_opt_pi_type; + uint8_t nd_opt_pi_len; + uint8_t nd_opt_pi_prefix_len; + uint8_t nd_opt_pi_flags_reserved; + uint32_t nd_opt_pi_valid_time; + uint32_t nd_opt_pi_preferred_time; + uint32_t nd_opt_pi_reserved2; + struct in6_addr nd_opt_pi_prefix; + }; + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 +#define ND_OPT_PI_FLAG_RADDR 0x20 + +struct nd_opt_rd_hdr /* redirected header */ + { + uint8_t nd_opt_rh_type; + uint8_t nd_opt_rh_len; + uint16_t nd_opt_rh_reserved1; + uint32_t nd_opt_rh_reserved2; + /* followed by IP header and data */ + }; + +struct nd_opt_mtu /* MTU option */ + { + uint8_t nd_opt_mtu_type; + uint8_t nd_opt_mtu_len; + uint16_t nd_opt_mtu_reserved; + uint32_t nd_opt_mtu_mtu; + }; + +struct mld_hdr + { + struct icmp6_hdr mld_icmp6_hdr; + struct in6_addr mld_addr; /* multicast address */ + }; + +#define mld_type mld_icmp6_hdr.icmp6_type +#define mld_code mld_icmp6_hdr.icmp6_code +#define mld_cksum mld_icmp6_hdr.icmp6_cksum +#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] +#define mld_reserved mld_icmp6_hdr.icmp6_data16[1] + +#define ICMP6_ROUTER_RENUMBERING 138 + +struct icmp6_router_renum /* router renumbering header */ + { + struct icmp6_hdr rr_hdr; + uint8_t rr_segnum; + uint8_t rr_flags; + uint16_t rr_maxdelay; + uint32_t rr_reserved; + }; + +#define rr_type rr_hdr.icmp6_type +#define rr_code rr_hdr.icmp6_code +#define rr_cksum rr_hdr.icmp6_cksum +#define rr_seqnum rr_hdr.icmp6_data32[0] + +/* Router renumbering flags */ +#define ICMP6_RR_FLAGS_TEST 0x80 +#define ICMP6_RR_FLAGS_REQRESULT 0x40 +#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 +#define ICMP6_RR_FLAGS_SPECSITE 0x10 +#define ICMP6_RR_FLAGS_PREVDONE 0x08 + +struct rr_pco_match /* match prefix part */ + { + uint8_t rpm_code; + uint8_t rpm_len; + uint8_t rpm_ordinal; + uint8_t rpm_matchlen; + uint8_t rpm_minlen; + uint8_t rpm_maxlen; + uint16_t rpm_reserved; + struct in6_addr rpm_prefix; + }; + +/* PCO code values */ +#define RPM_PCO_ADD 1 +#define RPM_PCO_CHANGE 2 +#define RPM_PCO_SETGLOBAL 3 + +struct rr_pco_use /* use prefix part */ + { + uint8_t rpu_uselen; + uint8_t rpu_keeplen; + uint8_t rpu_ramask; + uint8_t rpu_raflags; + uint32_t rpu_vltime; + uint32_t rpu_pltime; + uint32_t rpu_flags; + struct in6_addr rpu_prefix; + }; + +#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20 +#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 + +#if BYTE_ORDER == BIG_ENDIAN +# define ICMP6_RR_PCOUSE_DECRVLTIME 0x80000000 +# define ICMP6_RR_PCOUSE_DECRPLTIME 0x40000000 +#elif BYTE_ORDER == LITTLE_ENDIAN +# define ICMP6_RR_PCOUSE_DECRVLTIME 0x80 +# define ICMP6_RR_PCOUSE_DECRPLTIME 0x40 +#endif + +struct rr_result /* router renumbering result message */ + { + uint16_t rrr_flags; + uint8_t rrr_ordinal; + uint8_t rrr_matchedlen; + uint32_t rrr_ifid; + struct in6_addr rrr_prefix; + }; + +#if BYTE_ORDER == BIG_ENDIAN +# define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 +# define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 +#elif BYTE_ORDER == LITTLE_ENDIAN +# define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 +# define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 +#endif + +/* Mobile IPv6 extension: Advertisement Interval. */ +struct nd_opt_adv_interval + { + uint8_t nd_opt_adv_interval_type; + uint8_t nd_opt_adv_interval_len; + uint16_t nd_opt_adv_interval_reserved; + uint32_t nd_opt_adv_interval_ival; + }; + +/* Mobile IPv6 extension: Home Agent Info. */ +struct nd_opt_home_agent_info + { + uint8_t nd_opt_home_agent_info_type; + uint8_t nd_opt_home_agent_info_len; + uint16_t nd_opt_home_agent_info_reserved; + int16_t nd_opt_home_agent_info_preference; + uint16_t nd_opt_home_agent_info_lifetime; + }; + +#endif /* netinet/icmpv6.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_ether.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_ether.h new file mode 100644 index 0000000..aadb59b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_ether.h @@ -0,0 +1,105 @@ +/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __NETINET_IF_ETHER_H + +#define __NETINET_IF_ETHER_H 1 +#include +#include + +/* Get definitions from kernel header file. */ +#include + +#ifdef __USE_BSD +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 + * $FreeBSD$ + */ + +#include +#include + +__BEGIN_DECLS +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_int8_t arp_sha[ETH_ALEN]; /* sender hardware address */ + u_int8_t arp_spa[4]; /* sender protocol address */ + u_int8_t arp_tha[ETH_ALEN]; /* target hardware address */ + u_int8_t arp_tpa[4]; /* target protocol address */ +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +/* + * Macro to map an IP multicast address to an Ethernet multicast address. + * The high-order 25 bits of the Ethernet address are statically assigned, + * and the low-order 23 bits are taken from the low end of the IP address. + */ +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ + /* struct in_addr *ipaddr; */ \ + /* u_char enaddr[ETH_ALEN]; */ \ +{ \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \ + (enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \ +} + +__END_DECLS +#endif /* __USE_BSD */ + +#endif /* netinet/if_ether.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_fddi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_fddi.h new file mode 100644 index 0000000..1a0ec92 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_fddi.h @@ -0,0 +1,37 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETINET_IF_FDDI_H +#define _NETINET_IF_FDDI_H 1 + +#include +#include +#include + +#include + +#ifdef __USE_BSD + +struct fddi_header { + u_int8_t fddi_fc; /* Frame Control (FC) value */ + u_int8_t fddi_dhost[FDDI_K_ALEN]; /* Destination host */ + u_int8_t fddi_shost[FDDI_K_ALEN]; /* Source host */ +}; +#endif + +#endif /* netinet/if_fddi.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_tr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_tr.h new file mode 100644 index 0000000..1a7bc68 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/if_tr.h @@ -0,0 +1,41 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETINET_IF_TR_H +#define _NETINET_IF_TR_H 1 + +#include +#include +#include + +#include + +#ifdef __USE_BSD + +struct trn_hdr { + u_int8_t trn_ac; /* access control field */ + u_int8_t trn_fc; /* field control field */ + u_int8_t trn_dhost[TR_ALEN]; /* destination host */ + u_int8_t trn_shost[TR_ALEN]; /* source host */ + u_int16_t trn_rcf; /* route control field */ + u_int16_t trn_rseg[8]; /* routing registers */ +}; + +#endif + +#endif /* netinet/if_tr.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/igmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/igmp.h new file mode 100644 index 0000000..67396ba --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/igmp.h @@ -0,0 +1,126 @@ +/* Copyright (C) 1997, 1999, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETINET_IGMP_H +#define _NETINET_IGMP_H 1 + +#include +#include + +#ifdef __USE_BSD + +#include + +__BEGIN_DECLS + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)igmp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD$ + */ + +struct igmp { + u_int8_t igmp_type; /* IGMP type */ + u_int8_t igmp_code; /* routing code */ + u_int16_t igmp_cksum; /* checksum */ + struct in_addr igmp_group; /* group address */ +}; + +#define IGMP_MINLEN 8 + +/* + * Message types, including version number. + */ +#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ + +#define IGMP_DVMRP 0x13 /* DVMRP routing message */ +#define IGMP_PIM 0x14 /* PIM routing message */ +#define IGMP_TRACE 0x15 + +#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/ +#define IGMP_MTRACE 0x1f /* mcast traceroute messages */ + +#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ + /* query (in seconds) according */ + /* to RFC1112 */ +#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */ + /* specifies time in 10th of seconds*/ + +/* + * States for the IGMP v2 state table. + */ +#define IGMP_DELAYING_MEMBER 1 +#define IGMP_IDLE_MEMBER 2 +#define IGMP_LAZY_MEMBER 3 +#define IGMP_SLEEPING_MEMBER 4 +#define IGMP_AWAKENING_MEMBER 5 + +/* + * States for IGMP router version cache. + */ +#define IGMP_v1_ROUTER 1 +#define IGMP_v2_ROUTER 2 + +/* + * The following four defininitions are for backwards compatibility. + * They should be removed as soon as all applications are updated to + * use the new constant names. + */ +#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY +#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP + +__END_DECLS + +#endif + +#endif /* netinet/igmp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/in.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/in.h new file mode 100644 index 0000000..935886e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/in.h @@ -0,0 +1,512 @@ +/* Copyright (C) 1991-2001, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETINET_IN_H +#define _NETINET_IN_H 1 + +#include +#include +#include +#include + + +__BEGIN_DECLS + +/* Standard well-defined IP protocols. */ +enum + { + IPPROTO_IP = 0, /* Dummy protocol for TCP. */ +#define IPPROTO_IP IPPROTO_IP + IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ +#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS + IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ +#define IPPROTO_ICMP IPPROTO_ICMP + IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ +#define IPPROTO_IGMP IPPROTO_IGMP + IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */ +#define IPPROTO_IPIP IPPROTO_IPIP + IPPROTO_TCP = 6, /* Transmission Control Protocol. */ +#define IPPROTO_TCP IPPROTO_TCP + IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */ +#define IPPROTO_EGP IPPROTO_EGP + IPPROTO_PUP = 12, /* PUP protocol. */ +#define IPPROTO_PUP IPPROTO_PUP + IPPROTO_UDP = 17, /* User Datagram Protocol. */ +#define IPPROTO_UDP IPPROTO_UDP + IPPROTO_IDP = 22, /* XNS IDP protocol. */ +#define IPPROTO_IDP IPPROTO_IDP + IPPROTO_TP = 29, /* SO Transport Protocol Class 4. */ +#define IPPROTO_TP IPPROTO_TP + IPPROTO_IPV6 = 41, /* IPv6 header. */ +#define IPPROTO_IPV6 IPPROTO_IPV6 + IPPROTO_ROUTING = 43, /* IPv6 routing header. */ +#define IPPROTO_ROUTING IPPROTO_ROUTING + IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */ +#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT + IPPROTO_RSVP = 46, /* Reservation Protocol. */ +#define IPPROTO_RSVP IPPROTO_RSVP + IPPROTO_GRE = 47, /* General Routing Encapsulation. */ +#define IPPROTO_GRE IPPROTO_GRE + IPPROTO_ESP = 50, /* encapsulating security payload. */ +#define IPPROTO_ESP IPPROTO_ESP + IPPROTO_AH = 51, /* authentication header. */ +#define IPPROTO_AH IPPROTO_AH + IPPROTO_ICMPV6 = 58, /* ICMPv6. */ +#define IPPROTO_ICMPV6 IPPROTO_ICMPV6 + IPPROTO_NONE = 59, /* IPv6 no next header. */ +#define IPPROTO_NONE IPPROTO_NONE + IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */ +#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS + IPPROTO_MTP = 92, /* Multicast Transport Protocol. */ +#define IPPROTO_MTP IPPROTO_MTP + IPPROTO_ENCAP = 98, /* Encapsulation Header. */ +#define IPPROTO_ENCAP IPPROTO_ENCAP + IPPROTO_PIM = 103, /* Protocol Independent Multicast. */ +#define IPPROTO_PIM IPPROTO_PIM + IPPROTO_COMP = 108, /* Compression Header Protocol. */ +#define IPPROTO_COMP IPPROTO_COMP + IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */ +#define IPPROTO_SCTP IPPROTO_SCTP + IPPROTO_RAW = 255, /* Raw IP packets. */ +#define IPPROTO_RAW IPPROTO_RAW + IPPROTO_MAX + }; + + +/* Type to represent a port. */ +typedef uint16_t in_port_t; + +/* Standard well-known ports. */ +enum + { + IPPORT_ECHO = 7, /* Echo service. */ + IPPORT_DISCARD = 9, /* Discard transmissions service. */ + IPPORT_SYSTAT = 11, /* System status service. */ + IPPORT_DAYTIME = 13, /* Time of day service. */ + IPPORT_NETSTAT = 15, /* Network status service. */ + IPPORT_FTP = 21, /* File Transfer Protocol. */ + IPPORT_TELNET = 23, /* Telnet protocol. */ + IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */ + IPPORT_TIMESERVER = 37, /* Timeserver service. */ + IPPORT_NAMESERVER = 42, /* Domain Name Service. */ + IPPORT_WHOIS = 43, /* Internet Whois service. */ + IPPORT_MTP = 57, + + IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */ + IPPORT_RJE = 77, + IPPORT_FINGER = 79, /* Finger service. */ + IPPORT_TTYLINK = 87, + IPPORT_SUPDUP = 95, /* SUPDUP protocol. */ + + + IPPORT_EXECSERVER = 512, /* execd service. */ + IPPORT_LOGINSERVER = 513, /* rlogind service. */ + IPPORT_CMDSERVER = 514, + IPPORT_EFSSERVER = 520, + + /* UDP ports. */ + IPPORT_BIFFUDP = 512, + IPPORT_WHOSERVER = 513, + IPPORT_ROUTESERVER = 520, + + /* Ports less than this value are reserved for privileged processes. */ + IPPORT_RESERVED = 1024, + + /* Ports greater this value are reserved for (non-privileged) servers. */ + IPPORT_USERRESERVED = 5000 + }; + + +/* Internet address. */ +typedef uint32_t in_addr_t; +struct in_addr + { + in_addr_t s_addr; + }; + + +/* Definitions of the bits in an Internet address integer. + + On subnets, host and network parts are found according to + the subnet mask, not these masks. */ + +#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) + +#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) + +#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) + +/* Address to accept any incoming messages. */ +#define INADDR_ANY ((in_addr_t) 0x00000000) +/* Address to send to all hosts. */ +#define INADDR_BROADCAST ((in_addr_t) 0xffffffff) +/* Address indicating an error return. */ +#define INADDR_NONE ((in_addr_t) 0xffffffff) + +/* Network number for local host loopback. */ +#define IN_LOOPBACKNET 127 +/* Address to loopback in software to local host. */ +#ifndef INADDR_LOOPBACK +# define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1. */ +#endif + +/* Defines for Multicast INADDR. */ +#define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) /* 224.0.0.1 */ +#define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */ +#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */ + + +/* IPv6 address */ +struct in6_addr + { + union + { + uint8_t u6_addr8[16]; + uint16_t u6_addr16[8]; + uint32_t u6_addr32[4]; + } in6_u; +#define s6_addr in6_u.u6_addr8 +#define s6_addr16 in6_u.u6_addr16 +#define s6_addr32 in6_u.u6_addr32 + }; + +extern const struct in6_addr in6addr_any; /* :: */ +extern const struct in6_addr in6addr_loopback; /* ::1 */ +#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } +#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } + +#define INET_ADDRSTRLEN 16 +#define INET6_ADDRSTRLEN 46 + +/* Get the definition of the macro to define the common sockaddr members. */ +#include + + +/* Structure describing an Internet socket address. */ +struct sockaddr_in + { + __SOCKADDR_COMMON (sin_); + in_port_t sin_port; /* Port number. */ + struct in_addr sin_addr; /* Internet address. */ + + /* Pad to size of `struct sockaddr'. */ + unsigned char sin_zero[sizeof (struct sockaddr) - + __SOCKADDR_COMMON_SIZE - + sizeof (in_port_t) - + sizeof (struct in_addr)]; + }; + +/* Ditto, for IPv6. */ +struct sockaddr_in6 + { + __SOCKADDR_COMMON (sin6_); + in_port_t sin6_port; /* Transport layer port # */ + uint32_t sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + uint32_t sin6_scope_id; /* IPv6 scope-id */ + }; + + +/* IPv4 multicast request. */ +struct ip_mreq + { + /* IP multicast address of group. */ + struct in_addr imr_multiaddr; + + /* Local IP address of interface. */ + struct in_addr imr_interface; + }; + +struct ip_mreq_source + { + /* IP multicast address of group. */ + struct in_addr imr_multiaddr; + + /* IP address of source. */ + struct in_addr imr_interface; + + /* IP address of interface. */ + struct in_addr imr_sourceaddr; + }; + +/* Likewise, for IPv6. */ +struct ipv6_mreq + { + /* IPv6 multicast address of group */ + struct in6_addr ipv6mr_multiaddr; + + /* local interface */ + unsigned int ipv6mr_interface; + }; + + +/* Multicast group request. */ +struct group_req + { + /* Interface index. */ + uint32_t gr_interface; + + /* Group address. */ + struct sockaddr_storage gr_group; + }; + +struct group_source_req + { + /* Interface index. */ + uint32_t gsr_interface; + + /* Group address. */ + struct sockaddr_storage gsr_group; + + /* Source address. */ + struct sockaddr_storage gsr_source; + }; + + +/* Full-state filter operations. */ +struct ip_msfilter + { + /* IP multicast address of group. */ + struct in_addr imsf_multiaddr; + + /* Local IP address of interface. */ + struct in_addr imsf_interface; + + /* Filter mode. */ + uint32_t imsf_fmode; + + /* Number of source addresses. */ + uint32_t imsf_numsrc; + /* Source addresses. */ + struct in_addr imsf_slist[1]; + }; + +#define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \ + - sizeof (struct in_addr) \ + + (numsrc) * sizeof (struct in_addr)) + +struct group_filter + { + /* Interface index. */ + uint32_t gf_interface; + + /* Group address. */ + struct sockaddr_storage gf_group; + + /* Filter mode. */ + uint32_t gf_fmode; + + /* Number of source addresses. */ + uint32_t gf_numsrc; + /* Source addresses. */ + struct sockaddr_storage gf_slist[1]; +}; + +#define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \ + - sizeof (struct sockaddr_storage) \ + + ((numsrc) \ + * sizeof (struct sockaddr_storage))) + + +/* Get system-specific definitions. */ +#include + +/* Functions to convert between host and network byte order. + + Please note that these functions normally take `unsigned long int' or + `unsigned short int' values as arguments and also return them. But + this was a short-sighted decision since on different systems the types + may have different representations but the values are always the same. */ + +extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__)); +extern uint16_t ntohs (uint16_t __netshort) + __THROW __attribute__ ((__const__)); +extern uint32_t htonl (uint32_t __hostlong) + __THROW __attribute__ ((__const__)); +extern uint16_t htons (uint16_t __hostshort) + __THROW __attribute__ ((__const__)); + +#include + +/* Get machine dependent optimized versions of byte swapping functions. */ +#include + +#ifdef __OPTIMIZE__ +/* We can optimize calls to the conversion functions. Either nothing has + to be done or we are using directly the byte-swapping functions which + often can be inlined. */ +# if __BYTE_ORDER == __BIG_ENDIAN +/* The host byte order is the same as network byte order, + so these functions are all just identity. */ +# define ntohl(x) (x) +# define ntohs(x) (x) +# define htonl(x) (x) +# define htons(x) (x) +# else +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define ntohl(x) __bswap_32 (x) +# define ntohs(x) __bswap_16 (x) +# define htonl(x) __bswap_32 (x) +# define htons(x) __bswap_16 (x) +# endif +# endif +#endif + +#define IN6_IS_ADDR_UNSPECIFIED(a) \ + (((__const uint32_t *) (a))[0] == 0 \ + && ((__const uint32_t *) (a))[1] == 0 \ + && ((__const uint32_t *) (a))[2] == 0 \ + && ((__const uint32_t *) (a))[3] == 0) + +#define IN6_IS_ADDR_LOOPBACK(a) \ + (((__const uint32_t *) (a))[0] == 0 \ + && ((__const uint32_t *) (a))[1] == 0 \ + && ((__const uint32_t *) (a))[2] == 0 \ + && ((__const uint32_t *) (a))[3] == htonl (1)) + +#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff) + +#define IN6_IS_ADDR_LINKLOCAL(a) \ + ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \ + == htonl (0xfe800000)) + +#define IN6_IS_ADDR_SITELOCAL(a) \ + ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \ + == htonl (0xfec00000)) + +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((((__const uint32_t *) (a))[0] == 0) \ + && (((__const uint32_t *) (a))[1] == 0) \ + && (((__const uint32_t *) (a))[2] == htonl (0xffff))) + +#define IN6_IS_ADDR_V4COMPAT(a) \ + ((((__const uint32_t *) (a))[0] == 0) \ + && (((__const uint32_t *) (a))[1] == 0) \ + && (((__const uint32_t *) (a))[2] == 0) \ + && (ntohl (((__const uint32_t *) (a))[3]) > 1)) + +#define IN6_ARE_ADDR_EQUAL(a,b) \ + ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \ + && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \ + && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \ + && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3])) + +/* Bind socket to a privileged IP port. */ +extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW; + +/* The IPv6 version of this function. */ +extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) + __THROW; + + +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) \ + && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1)) + +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) \ + && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2)) + +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) \ + && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5)) + +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) \ + && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8)) + +#define IN6_IS_ADDR_MC_GLOBAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) \ + && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe)) + +/* IPv6 packet information. */ +struct in6_pktinfo + { + struct in6_addr ipi6_addr; /* src/dst IPv6 address */ + unsigned int ipi6_ifindex; /* send/recv interface index */ + }; + + +#if 0 /*def __USE_GNU*/ +/* Hop-by-Hop and Destination Options Processing. */ +extern int inet6_option_space (int __nbytes) __THROW; +extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp, + int __type) __THROW; +extern int inet6_option_append (struct cmsghdr *__cmsg, + __const uint8_t *__typep, int __multx, + int __plusy) __THROW; +extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen, + int __multx, int __plusy) __THROW; +extern int inet6_option_next (__const struct cmsghdr *__cmsg, + uint8_t **__tptrp) __THROW; +extern int inet6_option_find (__const struct cmsghdr *__cmsg, + uint8_t **__tptrp, int __type) __THROW; + + +/* Multicast source filter support. */ + +/* Get IPv4 source filter. */ +extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr, + struct in_addr __group, uint32_t *__fmode, + uint32_t *__numsrc, struct in_addr *__slist) + __THROW; + +/* Set IPv4 source filter. */ +extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr, + struct in_addr __group, uint32_t __fmode, + uint32_t __numsrc, + __const struct in_addr *__slist) + __THROW; + + +/* Get source filter. */ +extern int getsourcefilter (int __s, uint32_t __interface_addr, + __const struct sockaddr *__group, + socklen_t __grouplen, uint32_t *__fmode, + uint32_t *__numsrc, + struct sockaddr_storage *__slist) __THROW; + +/* Set source filter. */ +extern int setsourcefilter (int __s, uint32_t __interface_addr, + __const struct sockaddr *__group, + socklen_t __grouplen, uint32_t __fmode, + uint32_t __numsrc, + __const struct sockaddr_storage *__slist) __THROW; +#endif /* use GNU */ + +__END_DECLS + +#endif /* netinet/in.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/in_systm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/in_systm.h new file mode 100644 index 0000000..51a08e1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/in_systm.h @@ -0,0 +1,41 @@ +/* System specific type definitions for networking code. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETINET_IN_SYSTM_H +#define _NETINET_IN_SYSTM_H 1 + +#include +#include + +__BEGIN_DECLS + +/* + * Network order versions of various data types. Unfortunately, BSD + * assumes specific sizes for shorts (16 bit) and longs (32 bit) which + * don't hold in general. As a consequence, the network order versions + * may not reflect the actual size of the native data types. + */ + +typedef u_int16_t n_short; /* short as received from the net */ +typedef u_int32_t n_long; /* long as received from the net */ +typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */ + +__END_DECLS + +#endif /* netinet/in_systm.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip.h new file mode 100644 index 0000000..fc91440 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip.h @@ -0,0 +1,249 @@ +/* Copyright (C) 1991,92,93,95,96,97,98,99,2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __NETINET_IP_H +#define __NETINET_IP_H 1 + +#include +#include + +#include + +__BEGIN_DECLS + +struct timestamp + { + u_int8_t len; + u_int8_t ptr; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int flags:4; + unsigned int overflow:4; +#elif __BYTE_ORDER == __BIG_ENDIAN + unsigned int overflow:4; + unsigned int flags:4; +#else +# error "Please fix " +#endif + u_int32_t data[9]; + }; + +struct iphdr + { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ihl:4; + unsigned int version:4; +#elif __BYTE_ORDER == __BIG_ENDIAN + unsigned int version:4; + unsigned int ihl:4; +#else +# error "Please fix " +#endif + u_int8_t tos; + u_int16_t tot_len; + u_int16_t id; + u_int16_t frag_off; + u_int8_t ttl; + u_int8_t protocol; + u_int16_t check; + u_int32_t saddr; + u_int32_t daddr; + /*The options start here. */ + }; + +#ifdef __USE_BSD +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ + +/* + * Structure of an internet header, naked of options. + */ +struct ip + { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ip_hl:4; /* header length */ + unsigned int ip_v:4; /* version */ +#endif +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int ip_v:4; /* version */ + unsigned int ip_hl:4; /* header length */ +#endif + u_int8_t ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_int8_t ip_ttl; /* time to live */ + u_int8_t ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ + }; + +/* + * Time stamp option structure. + */ +struct ip_timestamp + { + u_int8_t ipt_code; /* IPOPT_TS */ + u_int8_t ipt_len; /* size of structure (variable) */ + u_int8_t ipt_ptr; /* index of current entry */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ipt_flg:4; /* flags, see below */ + unsigned int ipt_oflw:4; /* overflow counter */ +#endif +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int ipt_oflw:4; /* overflow counter */ + unsigned int ipt_flg:4; /* flags, see below */ +#endif + u_int32_t data[9]; + }; +#endif /* __USE_BSD */ + +#define IPVERSION 4 /* IP version number */ +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for IP type of service (ip_tos) + */ +#define IPTOS_TOS_MASK 0x1E +#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK) +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_LOWCOST 0x02 +#define IPTOS_MINCOST IPTOS_LOWCOST + +/* + * Definitions for IP precedence (also in ip_tos) (hopefully unused) + */ +#define IPTOS_PREC_MASK 0xe0 +#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK) +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +/* + * Definitions for options. + */ +#define IPOPT_COPY 0x80 +#define IPOPT_CLASS_MASK 0x60 +#define IPOPT_NUMBER_MASK 0x1f + +#define IPOPT_COPIED(o) ((o) & IPOPT_COPY) +#define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK) +#define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_MEASUREMENT IPOPT_DEBMEAS +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_END IPOPT_EOL +#define IPOPT_NOP 1 /* no operation */ +#define IPOPT_NOOP IPOPT_NOP + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_TIMESTAMP IPOPT_TS +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_SEC IPOPT_SECURITY +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SID IPOPT_SATID +#define IPOPT_SSRR 137 /* strict source route */ +#define IPOPT_RA 148 /* router alert */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +#define MAX_IPOPTLEN 40 + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 3 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +__END_DECLS + +#endif /* netinet/ip.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip6.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip6.h new file mode 100644 index 0000000..0ad62f8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip6.h @@ -0,0 +1,188 @@ +/* Copyright (C) 1991-1997, 2001, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETINET_IP6_H +#define _NETINET_IP6_H 1 + +#include +#include + +struct ip6_hdr + { + union + { + struct ip6_hdrctl + { + uint32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, + 20 bits flow-ID */ + uint16_t ip6_un1_plen; /* payload length */ + uint8_t ip6_un1_nxt; /* next header */ + uint8_t ip6_un1_hlim; /* hop limit */ + } ip6_un1; + uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ + } ip6_ctlun; + struct in6_addr ip6_src; /* source address */ + struct in6_addr ip6_dst; /* destination address */ + }; + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +/* Generic extension header. */ +struct ip6_ext + { + uint8_t ip6e_nxt; /* next header. */ + uint8_t ip6e_len; /* length in units of 8 octets. */ + }; + +/* Hop-by-Hop options header. */ +struct ip6_hbh + { + uint8_t ip6h_nxt; /* next header. */ + uint8_t ip6h_len; /* length in units of 8 octets. */ + /* followed by options */ + }; + +/* Destination options header */ +struct ip6_dest + { + uint8_t ip6d_nxt; /* next header */ + uint8_t ip6d_len; /* length in units of 8 octets */ + /* followed by options */ + }; + +/* Routing header */ +struct ip6_rthdr + { + uint8_t ip6r_nxt; /* next header */ + uint8_t ip6r_len; /* length in units of 8 octets */ + uint8_t ip6r_type; /* routing type */ + uint8_t ip6r_segleft; /* segments left */ + /* followed by routing type specific data */ + }; + +/* Type 0 Routing header */ +struct ip6_rthdr0 + { + uint8_t ip6r0_nxt; /* next header */ + uint8_t ip6r0_len; /* length in units of 8 octets */ + uint8_t ip6r0_type; /* always zero */ + uint8_t ip6r0_segleft; /* segments left */ + uint8_t ip6r0_reserved; /* reserved field */ + uint8_t ip6r0_slmap[3]; /* strict/loose bit map */ + struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */ + }; + +/* Fragment header */ +struct ip6_frag + { + uint8_t ip6f_nxt; /* next header */ + uint8_t ip6f_reserved; /* reserved field */ + uint16_t ip6f_offlg; /* offset, reserved, and flag */ + uint32_t ip6f_ident; /* identification */ + }; + +#if BYTE_ORDER == BIG_ENDIAN +#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ +#endif + +/* IPv6 options */ +struct ip6_opt + { + uint8_t ip6o_type; + uint8_t ip6o_len; + }; + +/* The high-order 3 bits of the option type define the behavior + * when processing an unknown option and whether or not the option + * content changes in flight. + */ +#define IP6OPT_TYPE(o) ((o) & 0xc0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xc0 +#define IP6OPT_TYPE_MUTABLE 0x20 + +/* Special option types for padding. */ +#define IP6OPT_PAD1 0 +#define IP6OPT_PADN 1 + +#define IP6OPT_JUMBO 0xc2 +#define IP6OPT_NSAP_ADDR 0xc3 +#define IP6OPT_TUNNEL_LIMIT 0x04 +#define IP6OPT_ROUTER_ALERT 0x05 + +/* Jumbo Payload Option */ +struct ip6_opt_jumbo + { + uint8_t ip6oj_type; + uint8_t ip6oj_len; + uint8_t ip6oj_jumbo_len[4]; + }; +#define IP6OPT_JUMBO_LEN 6 + +/* NSAP Address Option */ +struct ip6_opt_nsap + { + uint8_t ip6on_type; + uint8_t ip6on_len; + uint8_t ip6on_src_nsap_len; + uint8_t ip6on_dst_nsap_len; + /* followed by source NSAP */ + /* followed by destination NSAP */ + }; + +/* Tunnel Limit Option */ +struct ip6_opt_tunnel + { + uint8_t ip6ot_type; + uint8_t ip6ot_len; + uint8_t ip6ot_encap_limit; + }; + +/* Router Alert Option */ +struct ip6_opt_router + { + uint8_t ip6or_type; + uint8_t ip6or_len; + uint8_t ip6or_value[2]; + }; + +/* Router alert values (in network byte order) */ +#if BYTE_ORDER == BIG_ENDIAN +# define IP6_ALERT_MLD 0x0000 +# define IP6_ALERT_RSVP 0x0001 +# define IP6_ALERT_AN 0x0002 +#else /* BYTE_ORDER == LITTLE_ENDING */ +# define IP6_ALERT_MLD 0x0000 +# define IP6_ALERT_RSVP 0x0100 +# define IP6_ALERT_AN 0x0200 +#endif + +#endif /* netinet/ip6.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_fw.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_fw.h new file mode 100644 index 0000000..278a039 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_fw.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_icmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_icmp.h new file mode 100644 index 0000000..2fc8e9c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_icmp.h @@ -0,0 +1,283 @@ +/* Copyright (C) 1991, 92, 93, 95, 96, 97, 99 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __NETINET_IP_ICMP_H +#define __NETINET_IP_ICMP_H 1 + +#include +#include + +__BEGIN_DECLS + +struct icmphdr +{ + u_int8_t type; /* message type */ + u_int8_t code; /* type sub-code */ + u_int16_t checksum; + union + { + struct + { + u_int16_t id; + u_int16_t sequence; + } echo; /* echo datagram */ + u_int32_t gateway; /* gateway address */ + struct + { + u_int16_t __unused; + u_int16_t mtu; + } frag; /* path mtu discovery */ + } un; +}; + +#define ICMP_ECHOREPLY 0 /* Echo Reply */ +#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ +#define ICMP_SOURCE_QUENCH 4 /* Source Quench */ +#define ICMP_REDIRECT 5 /* Redirect (change route) */ +#define ICMP_ECHO 8 /* Echo Request */ +#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ +#define ICMP_PARAMETERPROB 12 /* Parameter Problem */ +#define ICMP_TIMESTAMP 13 /* Timestamp Request */ +#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ +#define ICMP_INFO_REQUEST 15 /* Information Request */ +#define ICMP_INFO_REPLY 16 /* Information Reply */ +#define ICMP_ADDRESS 17 /* Address Mask Request */ +#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ +#define NR_ICMP_TYPES 18 + + +/* Codes for UNREACH. */ +#define ICMP_NET_UNREACH 0 /* Network Unreachable */ +#define ICMP_HOST_UNREACH 1 /* Host Unreachable */ +#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ +#define ICMP_PORT_UNREACH 3 /* Port Unreachable */ +#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ +#define ICMP_SR_FAILED 5 /* Source Route failed */ +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 /* Packet filtered */ +#define ICMP_PREC_VIOLATION 14 /* Precedence violation */ +#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ +#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ + +/* Codes for REDIRECT. */ +#define ICMP_REDIR_NET 0 /* Redirect Net */ +#define ICMP_REDIR_HOST 1 /* Redirect Host */ +#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ +#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ + +/* Codes for TIME_EXCEEDED. */ +#define ICMP_EXC_TTL 0 /* TTL count exceeded */ +#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ + + +#ifdef __USE_BSD +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +#include +#include + +/* + * Internal of an ICMP Router Advertisement + */ +struct icmp_ra_addr +{ + u_int32_t ira_addr; + u_int32_t ira_preference; +}; + +struct icmp +{ + u_int8_t icmp_type; /* type of message, see below */ + u_int8_t icmp_code; /* type sub code */ + u_int16_t icmp_cksum; /* ones complement checksum of struct */ + union + { + u_char ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* gateway address */ + struct ih_idseq /* echo datagram */ + { + u_int16_t icd_id; + u_int16_t icd_seq; + } ih_idseq; + u_int32_t ih_void; + + /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ + struct ih_pmtu + { + u_int16_t ipm_void; + u_int16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv + { + u_int8_t irt_num_addrs; + u_int8_t irt_wpa; + u_int16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime + union + { + struct + { + u_int32_t its_otime; + u_int32_t its_rtime; + u_int32_t its_ttime; + } id_ts; + struct + { + struct ip idi_ip; + /* options and then 64 bits of data */ + } id_ip; + struct icmp_ra_addr id_radv; + u_int32_t id_mask; + u_int8_t id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enough to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#ifndef _IP_VHL +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ +#else +#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8) + /* N.B.: must separately check that header length >= 5 */ +#endif + +/* Definition of type and code fields. */ +/* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +/* UNREACH codes */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* net denied */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* host denied */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ +#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */ +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ + +/* REDIRECT codes */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ + +/* TIMEXCEED codes */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ + +/* PARAMPROB code */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ + (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ + (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ + (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + +#endif /* __USE_BSD */ + +__END_DECLS + +#endif /* netinet/ip_icmp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_tcp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_tcp.h new file mode 100644 index 0000000..600aebc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_tcp.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)tcp.h 7.5 (Berkeley) 6/29/88 + */ + +#ifndef _NETINET_IP_TCP_H +#define _NETINET_IP_TCP_H + +#include +#include +#include + +typedef u_int32_t tcp_seq; +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + u_short th_sport; /* source port */ + u_short th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + u_char th_x2:4, /* (unused) */ + th_off:4; /* data offset */ +#endif +#if __BYTE_ORDER == __BIG_ENDIAN + u_char th_off:4, /* data offset */ + th_x2:4; /* (unused) */ +#endif + u_char th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + u_short th_win; /* window */ + u_short th_sum; /* checksum */ + u_short th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + */ +#ifdef lint +#define TCP_MSS 536 +#else +#define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) +#endif + +#endif /* _NETINET_TCP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_udp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_udp.h new file mode 100644 index 0000000..3f0d8ef --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/ip_udp.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/protocols.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/protocols.h new file mode 100644 index 0000000..1a619c4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/protocols.h @@ -0,0 +1,62 @@ +/* protocols.h */ +#ifndef _NETINET_PROTOCOLS_H +#define _NETINET_PROTOCOLS_H + +#define IP_ICMP 1 +#define IP_IGMP 2 +#define IP_GGP 3 +#define IP_ST 5 +#define IP_TCP 6 +#define IP_UCL 7 +#define IP_EGP 8 +#define IP_IGP 9 +#define IP_BBN_RCC_MON 10 +#define IP_NVP_II 11 +#define IP_PUP 12 +#define IP_ARGUS 13 +#define IP_EMCON 14 +#define IP_XNET 15 +#define IP_CHAOS 16 +#define IP_UDP 17 +#define IP_MUX 18 +#define IP_DCN_MEAS 19 +#define IP_HMP 20 +#define IP_PRM 21 +#define IP_XNS_IDP 22 +#define IP_TRUNK1 23 +#define IP_TRUNK2 24 +#define IP_LEAF1 25 +#define IP_LEAF2 26 +#define IP_RDP 27 +#define IP_IRTP 28 +#define IP_ISO_TP4 29 +#define IP_NETBLT 30 +#define IP_MFE_NSP 31 +#define IP_MERIT_INP 32 +#define IP_SEP 33 +#define IP_3PC 34 +#define IP_CFTP 62 +#define SAT_EXPAK 64 +#define IP_RVD 66 +#define IP_IPPC 67 +#define IP_SAT_MON 69 +#define IP_VISA 70 +#define IP_IPCV 71 +#define IP_BR_SAT_MON 76 +#define IP_SUN_ND 77 +#define IP_WB_MON 78 +#define IP_WB_EXPAK 79 +#define IP_ISO_IP 80 +#define IP_VMTP 81 +#define IP_SECURE_VMTP 82 +#define IP_VINES 83 +#define IP_TTP 84 +#define NSFNET_IGP 85 +#define IP_DGP 86 +#define IP_TCF 87 +#define IP_IGRP 88 +#define IP_OSPFIGP 89 +#define IP_SPRITE_RPG 90 +#define IP_LARP 91 + +#endif /* _NETINET_PROTOCOLS_H*/ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/tcp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/tcp.h new file mode 100644 index 0000000..87099ec --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/tcp.h @@ -0,0 +1,225 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_TCP_H +#define _NETINET_TCP_H 1 + +#include + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY 1 /* Don't delay send to coalesce packets */ +#define TCP_MAXSEG 2 /* Set maximum segment size */ +#define TCP_CORK 3 /* Control sending of partial frames */ +#define TCP_KEEPIDLE 4 /* Start keeplives after this period */ +#define TCP_KEEPINTVL 5 /* Interval between keepalives */ +#define TCP_KEEPCNT 6 /* Number of keepalives before death */ +#define TCP_SYNCNT 7 /* Number of SYN retransmits */ +#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ +#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ +#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ +#define TCP_INFO 11 /* Information about this connection. */ +#define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */ + +#ifdef __USE_MISC +# include + +# ifdef __FAVOR_BSD +typedef u_int32_t tcp_seq; +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr + { + u_int16_t th_sport; /* source port */ + u_int16_t th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +# if __BYTE_ORDER == __LITTLE_ENDIAN + u_int8_t th_x2:4; /* (unused) */ + u_int8_t th_off:4; /* data offset */ +# endif +# if __BYTE_ORDER == __BIG_ENDIAN + u_int8_t th_off:4; /* data offset */ + u_int8_t th_x2:4; /* (unused) */ +# endif + u_int8_t th_flags; +# define TH_FIN 0x01 +# define TH_SYN 0x02 +# define TH_RST 0x04 +# define TH_PUSH 0x08 +# define TH_ACK 0x10 +# define TH_URG 0x20 + u_int16_t th_win; /* window */ + u_int16_t th_sum; /* checksum */ + u_int16_t th_urp; /* urgent pointer */ +}; + +# else /* !__FAVOR_BSD */ +struct tcphdr + { + u_int16_t source; + u_int16_t dest; + u_int32_t seq; + u_int32_t ack_seq; +# if __BYTE_ORDER == __LITTLE_ENDIAN + u_int16_t res1:4; + u_int16_t doff:4; + u_int16_t fin:1; + u_int16_t syn:1; + u_int16_t rst:1; + u_int16_t psh:1; + u_int16_t ack:1; + u_int16_t urg:1; + u_int16_t res2:2; +# elif __BYTE_ORDER == __BIG_ENDIAN + u_int16_t doff:4; + u_int16_t res1:4; + u_int16_t res2:2; + u_int16_t urg:1; + u_int16_t ack:1; + u_int16_t psh:1; + u_int16_t rst:1; + u_int16_t syn:1; + u_int16_t fin:1; +# else +# error "Adjust your defines" +# endif + u_int16_t window; + u_int16_t check; + u_int16_t urg_ptr; +}; +# endif /* __FAVOR_BSD */ + +enum +{ + TCP_ESTABLISHED = 1, + TCP_SYN_SENT, + TCP_SYN_RECV, + TCP_FIN_WAIT1, + TCP_FIN_WAIT2, + TCP_TIME_WAIT, + TCP_CLOSE, + TCP_CLOSE_WAIT, + TCP_LAST_ACK, + TCP_LISTEN, + TCP_CLOSING /* now a valid state */ +}; + +# define TCPOPT_EOL 0 +# define TCPOPT_NOP 1 +# define TCPOPT_MAXSEG 2 +# define TCPOLEN_MAXSEG 4 +# define TCPOPT_WINDOW 3 +# define TCPOLEN_WINDOW 3 +# define TCPOPT_SACK_PERMITTED 4 /* Experimental */ +# define TCPOLEN_SACK_PERMITTED 2 +# define TCPOPT_SACK 5 /* Experimental */ +# define TCPOPT_TIMESTAMP 8 +# define TCPOLEN_TIMESTAMP 10 +# define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ + +# define TCPOPT_TSTAMP_HDR \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). + */ +# define TCP_MSS 512 + +# define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ + +# define TCP_MAX_WINSHIFT 14 /* maximum window shift */ + +# define SOL_TCP 6 /* TCP level */ + + +# define TCPI_OPT_TIMESTAMPS 1 +# define TCPI_OPT_SACK 2 +# define TCPI_OPT_WSCALE 4 +# define TCPI_OPT_ECN 8 + +/* Values for tcpi_state. */ +enum tcp_ca_state +{ + TCP_CA_Open = 0, + TCP_CA_Disorder = 1, + TCP_CA_CWR = 2, + TCP_CA_Recovery = 3, + TCP_CA_Loss = 4 +}; + +struct tcp_info +{ + u_int8_t tcpi_state; + u_int8_t tcpi_ca_state; + u_int8_t tcpi_retransmits; + u_int8_t tcpi_probes; + u_int8_t tcpi_backoff; + u_int8_t tcpi_options; + u_int8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + + u_int32_t tcpi_rto; + u_int32_t tcpi_ato; + u_int32_t tcpi_snd_mss; + u_int32_t tcpi_rcv_mss; + + u_int32_t tcpi_unacked; + u_int32_t tcpi_sacked; + u_int32_t tcpi_lost; + u_int32_t tcpi_retrans; + u_int32_t tcpi_fackets; + + /* Times. */ + u_int32_t tcpi_last_data_sent; + u_int32_t tcpi_last_ack_sent; /* Not remembered, sorry. */ + u_int32_t tcpi_last_data_recv; + u_int32_t tcpi_last_ack_recv; + + /* Metrics. */ + u_int32_t tcpi_pmtu; + u_int32_t tcpi_rcv_ssthresh; + u_int32_t tcpi_rtt; + u_int32_t tcpi_rttvar; + u_int32_t tcpi_snd_ssthresh; + u_int32_t tcpi_snd_cwnd; + u_int32_t tcpi_advmss; + u_int32_t tcpi_reordering; +}; + +#endif /* Misc. */ + +#endif /* netinet/tcp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/udp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/udp.h new file mode 100644 index 0000000..5be4bbd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netinet/udp.h @@ -0,0 +1,55 @@ +/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __NETINET_UDP_H +#define __NETINET_UDP_H 1 + +#include +#include + +__BEGIN_DECLS + +/* UDP header as specified by RFC 768, August 1980. */ +#ifdef __FAVOR_BSD +struct udphdr { + u_int16_t uh_sport; /* source port */ + u_int16_t uh_dport; /* destination port */ + u_int16_t uh_ulen; /* udp length */ + u_int16_t uh_sum; /* udp checksum */ +}; +#else + +struct udphdr { + u_int16_t source; + u_int16_t dest; + u_int16_t len; + u_int16_t check; +}; +#endif + +#define SOL_UDP 17 /* sockopt level for UDP */ + +__END_DECLS + +#endif /* netinet/udp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netipx/ipx.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netipx/ipx.h new file mode 100644 index 0000000..7eb42ef --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netipx/ipx.h @@ -0,0 +1,113 @@ +/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __NETIPX_IPX_H +#define __NETIPX_IPX_H 1 + +#include + +#include +#include + +__BEGIN_DECLS + +#define SOL_IPX 256 /* sockopt level */ + +#define IPX_TYPE 1 +#define IPX_NODE_LEN 6 +#define IPX_MTU 576 + +struct sockaddr_ipx + { + sa_family_t sipx_family; + u_int16_t sipx_port; + u_int32_t sipx_network; + unsigned char sipx_node[IPX_NODE_LEN]; + u_int8_t sipx_type; + unsigned char sipx_zero; /* 16 byte fill */ + }; + +/* + * So we can fit the extra info for SIOCSIFADDR into the address nicely + */ + +#define sipx_special sipx_port +#define sipx_action sipx_zero +#define IPX_DLTITF 0 +#define IPX_CRTITF 1 + +typedef struct ipx_route_definition + { + unsigned long ipx_network; + unsigned long ipx_router_network; + unsigned char ipx_router_node[IPX_NODE_LEN]; + } +ipx_route_definition; + +typedef struct ipx_interface_definition + { + unsigned long ipx_network; + unsigned char ipx_device[16]; + unsigned char ipx_dlink_type; +#define IPX_FRAME_NONE 0 +#define IPX_FRAME_SNAP 1 +#define IPX_FRAME_8022 2 +#define IPX_FRAME_ETHERII 3 +#define IPX_FRAME_8023 4 +#define IPX_FRAME_TR_8022 5 + unsigned char ipx_special; +#define IPX_SPECIAL_NONE 0 +#define IPX_PRIMARY 1 +#define IPX_INTERNAL 2 + unsigned char ipx_node[IPX_NODE_LEN]; + } +ipx_interface_definition; + +typedef struct ipx_config_data + { + unsigned char ipxcfg_auto_select_primary; + unsigned char ipxcfg_auto_create_interfaces; + } +ipx_config_data; + +/* + * OLD Route Definition for backward compatibility. + */ + +struct ipx_route_def + { + unsigned long ipx_network; + unsigned long ipx_router_network; +#define IPX_ROUTE_NO_ROUTER 0 + unsigned char ipx_router_node[IPX_NODE_LEN]; + unsigned char ipx_device[16]; + unsigned short ipx_flags; +#define IPX_RT_SNAP 8 +#define IPX_RT_8022 4 +#define IPX_RT_BLUEBOOK 2 +#define IPX_RT_ROUTED 1 + }; + +#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) +#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1) +#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2) +#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3) + +__END_DECLS + +#endif /* netipx/ipx.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/netpacket/packet.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netpacket/packet.h new file mode 100644 index 0000000..6c63428 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/netpacket/packet.h @@ -0,0 +1,64 @@ +/* Definitions for use with Linux AF_PACKET sockets. + Copyright (C) 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef __NETPACKET_PACKET_H +#define __NETPACKET_PACKET_H 1 + +struct sockaddr_ll + { + unsigned short int sll_family; + unsigned short int sll_protocol; + int sll_ifindex; + unsigned short int sll_hatype; + unsigned char sll_pkttype; + unsigned char sll_halen; + unsigned char sll_addr[8]; + }; + +/* Packet types. */ + +#define PACKET_HOST 0 /* To us. */ +#define PACKET_BROADCAST 1 /* To all. */ +#define PACKET_MULTICAST 2 /* To group. */ +#define PACKET_OTHERHOST 3 /* To someone else. */ +#define PACKET_OUTGOING 4 /* Originated by us . */ +#define PACKET_LOOPBACK 5 +#define PACKET_FASTROUTE 6 + +/* Packet socket options. */ + +#define PACKET_ADD_MEMBERSHIP 1 +#define PACKET_DROP_MEMBERSHIP 2 +#define PACKET_RECV_OUTPUT 3 +#define PACKET_RX_RING 5 +#define PACKET_STATISTICS 6 + +struct packet_mreq + { + int mr_ifindex; + unsigned short int mr_type; + unsigned short int mr_alen; + unsigned char mr_address[8]; + }; + +#define PACKET_MR_MULTICAST 0 +#define PACKET_MR_PROMISC 1 +#define PACKET_MR_ALLMULTI 2 + +#endif /* netpacket/packet.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/nl_types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/nl_types.h new file mode 100644 index 0000000..74e7621 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/nl_types.h @@ -0,0 +1,59 @@ +/* Copyright (C) 1996, 1997, 1999, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NL_TYPES_H +#define _NL_TYPES_H 1 + +#include + +/* The default message set used by the gencat program. */ +#define NL_SETD 1 + +/* Value for FLAG parameter of `catgets' to say we want XPG4 compliance. */ +#define NL_CAT_LOCALE 1 + + +__BEGIN_DECLS + +#ifdef __UCLIBC_MJN3_ONLY__ +#warning "mjn3 FIXME: None of these prototypes have implementations." +#endif + +/* Message catalog descriptor type. */ +typedef void *nl_catd; + +/* Type used by `nl_langinfo'. */ +typedef int nl_item; + +/* Open message catalog for later use, returning descriptor. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern nl_catd catopen (__const char *__cat_name, int __flag) __nonnull ((1)); + +/* Return translation with NUMBER in SET of CATALOG; if not found + return STRING. */ +extern char *catgets (nl_catd __catalog, int __set, int __number, + __const char *__string) __THROW __nonnull ((1)); + +/* Close message CATALOG. */ +extern int catclose (nl_catd __catalog) __THROW __nonnull ((1)); + +__END_DECLS + +#endif /* nl_types.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/obstack.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/obstack.h new file mode 100644 index 0000000..071acaf --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/obstack.h @@ -0,0 +1,605 @@ +/* obstack.h - object stack macros + Copyright (C) 1988,89,90,91,92,93,94,96,97,98,99 Free Software Foundation, Inc. + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in /gd/gnu/lib. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Summary: + +All the apparent functions defined here are macros. The idea +is that you would use these pre-tested macros to solve a +very specific set of problems, and they would run fast. +Caution: no side-effects in arguments please!! They may be +evaluated MANY times!! + +These macros operate a stack of objects. Each object starts life +small, and may grow to maturity. (Consider building a word syllable +by syllable.) An object can move while it is growing. Once it has +been "finished" it never changes address again. So the "top of the +stack" is typically an immature growing object, while the rest of the +stack is of mature, fixed size and fixed address objects. + +These routines grab large chunks of memory, using a function you +supply, called `obstack_chunk_alloc'. On occasion, they free chunks, +by calling `obstack_chunk_free'. You must define them and declare +them before using any obstack macros. + +Each independent stack is represented by a `struct obstack'. +Each of the obstack macros expects a pointer to such a structure +as the first argument. + +One motivation for this package is the problem of growing char strings +in symbol tables. Unless you are "fascist pig with a read-only mind" +--Gosper's immortal quote from HAKMEM item 154, out of context--you +would not like to put any arbitrary upper limit on the length of your +symbols. + +In practice this often means you will build many short symbols and a +few long symbols. At the time you are reading a symbol you don't know +how long it is. One traditional method is to read a symbol into a +buffer, realloc()ating the buffer every time you try to read a symbol +that is longer than the buffer. This is beaut, but you still will +want to copy the symbol from the buffer to a more permanent +symbol-table entry say about half the time. + +With obstacks, you can work differently. Use one obstack for all symbol +names. As you read a symbol, grow the name in the obstack gradually. +When the name is complete, finalize it. Then, if the symbol exists already, +free the newly read name. + +The way we do this is to take a large chunk, allocating memory from +low addresses. When you want to build a symbol in the chunk you just +add chars above the current "high water mark" in the chunk. When you +have finished adding chars, because you got to the end of the symbol, +you know how long the chars are, and you can create a new object. +Mostly the chars will not burst over the highest address of the chunk, +because you would typically expect a chunk to be (say) 100 times as +long as an average object. + +In case that isn't clear, when we have enough chars to make up +the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) +so we just point to it where it lies. No moving of chars is +needed and this is the second win: potentially long strings need +never be explicitly shuffled. Once an object is formed, it does not +change its address during its lifetime. + +When the chars burst over a chunk boundary, we allocate a larger +chunk, and then copy the partly formed object from the end of the old +chunk to the beginning of the new larger chunk. We then carry on +accreting characters to the end of the object as we normally would. + +A special macro is provided to add a single char at a time to a +growing object. This allows the use of register variables, which +break the ordinary 'growth' macro. + +Summary: + We allocate large chunks. + We carve out one object at a time from the current chunk. + Once carved, an object never moves. + We are free to append data of any size to the currently + growing object. + Exactly one object is growing in an obstack at any one time. + You can run one obstack per control block. + You may have as many control blocks as you dare. + Because of the way we do it, you can `unwind' an obstack + back to a previous state. (You may remove objects much + as you would with a stack.) +*/ + + +/* Don't do the contents of this file more than once. */ + +#ifndef _OBSTACK_H +#define _OBSTACK_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* We use subtraction of (char *) 0 instead of casting to int + because on word-addressable machines a simple cast to int + may ignore the byte-within-word field of the pointer. */ + +#ifndef __PTR_TO_INT +# define __PTR_TO_INT(P) ((P) - (char *) 0) +#endif + +#ifndef __INT_TO_PTR +# define __INT_TO_PTR(P) ((P) + (char *) 0) +#endif + +/* We need the type of the resulting object. If __PTRDIFF_TYPE__ is + defined, as with GNU C, use that; that way we don't pollute the + namespace with 's symbols. Otherwise, if is + available, include it and use ptrdiff_t. In traditional C, long is + the best that we can do. */ + +#ifdef __PTRDIFF_TYPE__ +# define PTR_INT_TYPE __PTRDIFF_TYPE__ +#else +# ifdef HAVE_STDDEF_H +# include +# define PTR_INT_TYPE ptrdiff_t +# else +# define PTR_INT_TYPE long +# endif +#endif + +#if defined _LIBC || defined HAVE_STRING_H +# include +# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +#else +# ifdef memcpy +# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +# else +# define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N)) +# endif +#endif + +struct _obstack_chunk /* Lives at front of each chunk. */ +{ + char *limit; /* 1 past end of this chunk */ + struct _obstack_chunk *prev; /* address of prior chunk or NULL */ + char contents[4]; /* objects begin here */ +}; + +struct obstack /* control current object in current chunk */ +{ + long chunk_size; /* preferred size to allocate chunks in */ + struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ + char *object_base; /* address of object we are building */ + char *next_free; /* where to add next char to current object */ + char *chunk_limit; /* address of char after current chunk */ + PTR_INT_TYPE temp; /* Temporary for some macros. */ + int alignment_mask; /* Mask of alignment for each object. */ +#if defined __STDC__ && __STDC__ + /* These prototypes vary based on `use_extra_arg', and we use + casts to the prototypeless function type in all assignments, + but having prototypes here quiets -Wstrict-prototypes. */ + struct _obstack_chunk *(*chunkfun) (void *, long); + void (*freefun) (void *, struct _obstack_chunk *); + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ +#else + struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */ + void (*freefun) (); /* User's function to free a chunk. */ + char *extra_arg; /* first arg for chunk alloc/dealloc funcs */ +#endif + unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ + unsigned maybe_empty_object:1;/* There is a possibility that the current + chunk contains a zero-length object. This + prevents freeing the chunk if we allocate + a bigger chunk to replace it. */ + unsigned alloc_failed:1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ +}; + +/* Declare the external functions we use; they are in obstack.c. */ + +#if defined __STDC__ && __STDC__ +extern void _obstack_newchunk (struct obstack *, int); +extern void _obstack_free (struct obstack *, void *); +extern int _obstack_begin (struct obstack *, int, int, + void *(*) (long), void (*) (void *)); +extern int _obstack_begin_1 (struct obstack *, int, int, + void *(*) (void *, long), + void (*) (void *, void *), void *); +extern int _obstack_memory_used (struct obstack *); +#else +extern void _obstack_newchunk (); +extern void _obstack_free (); +extern int _obstack_begin (); +extern int _obstack_begin_1 (); +extern int _obstack_memory_used (); +#endif + +#if defined __STDC__ && __STDC__ + +/* Do the function-declarations after the structs + but before defining the macros. */ + +void obstack_init (struct obstack *obstack); + +void * obstack_alloc (struct obstack *obstack, int size); + +void * obstack_copy (struct obstack *obstack, const void *address, int size); +void * obstack_copy0 (struct obstack *obstack, const void *address, int size); + +void obstack_free (struct obstack *obstack, void *block); + +void obstack_blank (struct obstack *obstack, int size); + +void obstack_grow (struct obstack *obstack, const void *data, int size); +void obstack_grow0 (struct obstack *obstack, const void *data, int size); + +void obstack_1grow (struct obstack *obstack, int data_char); +void obstack_ptr_grow (struct obstack *obstack, const void *data); +void obstack_int_grow (struct obstack *obstack, int data); + +void * obstack_finish (struct obstack *obstack); + +int obstack_object_size (struct obstack *obstack); + +int obstack_room (struct obstack *obstack); +void obstack_make_room (struct obstack *obstack, int size); +void obstack_1grow_fast (struct obstack *obstack, int data_char); +void obstack_ptr_grow_fast (struct obstack *obstack, const void *data); +void obstack_int_grow_fast (struct obstack *obstack, int data); +void obstack_blank_fast (struct obstack *obstack, int size); + +void * obstack_base (struct obstack *obstack); +void * obstack_next_free (struct obstack *obstack); +int obstack_alignment_mask (struct obstack *obstack); +int obstack_chunk_size (struct obstack *obstack); +int obstack_memory_used (struct obstack *obstack); + +#endif /* __STDC__ */ + +/* Non-ANSI C cannot really support alternative functions for these macros, + so we do not declare them. */ + +/* Error handler called when `obstack_chunk_alloc' failed to allocate + more memory. This can be set to a user defined function which + should either abort gracefully or use longjump - but shouldn't + return. The default action is to print a message and abort. */ +#if defined __STDC__ && __STDC__ +extern void (*obstack_alloc_failed_handler) (void); +#else +extern void (*obstack_alloc_failed_handler) (); +#endif + +/* Exit value used when `print_and_abort' is used. */ +extern int obstack_exit_failure; + +/* Pointer to beginning of object being allocated or to be allocated next. + Note that this might not be the final address of the object + because a new chunk might be needed to hold the final size. */ + +#define obstack_base(h) ((h)->object_base) + +/* Size for allocating ordinary chunks. */ + +#define obstack_chunk_size(h) ((h)->chunk_size) + +/* Pointer to next byte not yet allocated in current chunk. */ + +#define obstack_next_free(h) ((h)->next_free) + +/* Mask specifying low bits that should be clear in address of an object. */ + +#define obstack_alignment_mask(h) ((h)->alignment_mask) + +/* To prevent prototype warnings provide complete argument list in + standard C version. */ +#if defined __STDC__ && __STDC__ + +# define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + (void *(*) (long)) obstack_chunk_alloc, \ + (void (*) (void *)) obstack_chunk_free) + +# define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + (void *(*) (long)) obstack_chunk_alloc, \ + (void (*) (void *)) obstack_chunk_free) + +# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + (void *(*) (long)) (chunkfun), \ + (void (*) (void *)) (freefun)) + +# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + (void *(*) (void *, long)) (chunkfun), \ + (void (*) (void *, void *)) (freefun), (arg)) + +# define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) + +# define obstack_freefun(h, newfreefun) \ + ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) + +#else + +# define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + (void *(*) ()) obstack_chunk_alloc, \ + (void (*) ()) obstack_chunk_free) + +# define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + (void *(*) ()) obstack_chunk_alloc, \ + (void (*) ()) obstack_chunk_free) + +# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + (void *(*) ()) (chunkfun), \ + (void (*) ()) (freefun)) + +# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + (void *(*) ()) (chunkfun), \ + (void (*) ()) (freefun), (arg)) + +# define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun)) + +# define obstack_freefun(h, newfreefun) \ + ((h) -> freefun = (void (*)()) (newfreefun)) + +#endif + +#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar) + +#define obstack_blank_fast(h,n) ((h)->next_free += (n)) + +#define obstack_memory_used(h) _obstack_memory_used (h) + +#if defined __GNUC__ && defined __STDC__ && __STDC__ +/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ +# if __GNUC__ < 2 || (defined __NeXT__ && __NeXT__ && !__GNUC_MINOR__) +# define __extension__ +# endif + +/* For GNU C, if not -traditional, + we can define these macros to compute all args only once + without using a global variable. + Also, we can avoid using the `temp' slot, to make faster code. */ + +# define obstack_object_size(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (unsigned) (__o->next_free - __o->object_base); }) + +# define obstack_room(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (unsigned) (__o->chunk_limit - __o->next_free); }) + +# define obstack_make_room(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->chunk_limit - __o->next_free < __len) \ + _obstack_newchunk (__o, __len); \ + (void) 0; }) + +# define obstack_empty_p(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); }) + +# define obstack_grow(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->next_free + __len > __o->chunk_limit) \ + _obstack_newchunk (__o, __len); \ + _obstack_memcpy (__o->next_free, (where), __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_grow0(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->next_free + __len + 1 > __o->chunk_limit) \ + _obstack_newchunk (__o, __len + 1); \ + _obstack_memcpy (__o->next_free, (where), __len); \ + __o->next_free += __len; \ + *(__o->next_free)++ = 0; \ + (void) 0; }) + +# define obstack_1grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + 1 > __o->chunk_limit) \ + _obstack_newchunk (__o, 1); \ + *(__o->next_free)++ = (datum); \ + (void) 0; }) + +/* These assume that the obstack alignment is good enough for pointers + or ints, and that the data added so far to the current object + shares that much alignment. */ + +# define obstack_ptr_grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ + _obstack_newchunk (__o, sizeof (void *)); \ + *((void **)__o->next_free)++ = (datum); \ + (void) 0; }) + +# define obstack_int_grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + sizeof (int) > __o->chunk_limit) \ + _obstack_newchunk (__o, sizeof (int)); \ + *((int *)__o->next_free)++ = (datum); \ + (void) 0; }) + +# define obstack_ptr_grow_fast(h,aptr) \ + (*((void **) (h)->next_free)++ = (aptr)) + +# define obstack_int_grow_fast(h,aint) \ + (*((int *) (h)->next_free)++ = (aint)) + +# define obstack_blank(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->chunk_limit - __o->next_free < __len) \ + _obstack_newchunk (__o, __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_alloc(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_blank (__h, (length)); \ + obstack_finish (__h); }) + +# define obstack_copy(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_grow (__h, (where), (length)); \ + obstack_finish (__h); }) + +# define obstack_copy0(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_grow0 (__h, (where), (length)); \ + obstack_finish (__h); }) + +/* The local variable is named __o1 to avoid a name conflict + when obstack_blank is called. */ +# define obstack_finish(OBSTACK) \ +__extension__ \ +({ struct obstack *__o1 = (OBSTACK); \ + void *value; \ + value = (void *) __o1->object_base; \ + if (__o1->next_free == value) \ + __o1->maybe_empty_object = 1; \ + __o1->next_free \ + = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\ + & ~ (__o1->alignment_mask)); \ + if (__o1->next_free - (char *)__o1->chunk \ + > __o1->chunk_limit - (char *)__o1->chunk) \ + __o1->next_free = __o1->chunk_limit; \ + __o1->object_base = __o1->next_free; \ + value; }) + +# define obstack_free(OBSTACK, OBJ) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + void *__obj = (OBJ); \ + if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ + __o->next_free = __o->object_base = (char *)__obj; \ + else (obstack_free) (__o, __obj); }) + +#else /* not __GNUC__ or not __STDC__ */ + +# define obstack_object_size(h) \ + (unsigned) ((h)->next_free - (h)->object_base) + +# define obstack_room(h) \ + (unsigned) ((h)->chunk_limit - (h)->next_free) + +# define obstack_empty_p(h) \ + ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0) + +/* Note that the call to _obstack_newchunk is enclosed in (..., 0) + so that we can avoid having void expressions + in the arms of the conditional expression. + Casting the third operand to void was tried before, + but some compilers won't accept it. */ + +# define obstack_make_room(h,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0)) + +# define obstack_grow(h,where,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ + _obstack_memcpy ((h)->next_free, (where), (h)->temp), \ + (h)->next_free += (h)->temp) + +# define obstack_grow0(h,where,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ + _obstack_memcpy ((h)->next_free, (where), (h)->temp), \ + (h)->next_free += (h)->temp, \ + *((h)->next_free)++ = 0) + +# define obstack_1grow(h,datum) \ +( (((h)->next_free + 1 > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), 1), 0) : 0), \ + (*((h)->next_free)++ = (datum))) + +# define obstack_ptr_grow(h,datum) \ +( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ + (*((const char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = (datum))) + +# define obstack_int_grow(h,datum) \ +( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ + (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = (datum))) + +# define obstack_ptr_grow_fast(h,aptr) \ + (*((const char **) (h)->next_free)++ = (aptr)) + +# define obstack_int_grow_fast(h,aint) \ + (*((int *) (h)->next_free)++ = (aint)) + +# define obstack_blank(h,length) \ +( (h)->temp = (length), \ + (((h)->chunk_limit - (h)->next_free < (h)->temp) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ + ((h)->next_free += (h)->temp)) + +# define obstack_alloc(h,length) \ + (obstack_blank ((h), (length)), obstack_finish ((h))) + +# define obstack_copy(h,where,length) \ + (obstack_grow ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_copy0(h,where,length) \ + (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_finish(h) \ +( ((h)->next_free == (h)->object_base \ + ? (((h)->maybe_empty_object = 1), 0) \ + : 0), \ + (h)->temp = __PTR_TO_INT ((h)->object_base), \ + (h)->next_free \ + = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \ + & ~ ((h)->alignment_mask)), \ + (((h)->next_free - (char *) (h)->chunk \ + > (h)->chunk_limit - (char *) (h)->chunk) \ + ? ((h)->next_free = (h)->chunk_limit) : 0), \ + (h)->object_base = (h)->next_free, \ + __INT_TO_PTR ((h)->temp)) + +# if defined __STDC__ && __STDC__ +# define obstack_free(h,obj) \ +( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ + (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ + ? (int) ((h)->next_free = (h)->object_base \ + = (h)->temp + (char *) (h)->chunk) \ + : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) +# else +# define obstack_free(h,obj) \ +( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ + (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ + ? (int) ((h)->next_free = (h)->object_base \ + = (h)->temp + (char *) (h)->chunk) \ + : (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0))) +# endif + +#endif /* not __GNUC__ or not __STDC__ */ + +#ifdef __cplusplus +} /* C++ */ +#endif + +#endif /* obstack.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/paths.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/paths.h new file mode 100644 index 0000000..ae892c4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/paths.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)paths.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PATHS_H_ +#define _PATHS_H_ + +/* Default search path. */ +#define _PATH_DEFPATH "/usr/bin:/bin" +/* All standard utilities path. */ +#define _PATH_STDPATH \ + "/usr/bin:/bin:/usr/sbin:/sbin" + +#define _PATH_BSHELL "/bin/sh" +#define _PATH_CONSOLE "/dev/console" +#define _PATH_CSHELL "/bin/csh" +#define _PATH_DEVDB "/var/run/dev.db" +#define _PATH_DEVNULL "/dev/null" +#define _PATH_DRUM "/dev/drum" +#define _PATH_KLOG "/proc/kmsg" +#define _PATH_KMEM "/dev/kmem" +#define _PATH_LASTLOG "/var/log/lastlog" +#define _PATH_MAILDIR "/var/mail" +#define _PATH_MAN "/usr/share/man" +#define _PATH_MEM "/dev/mem" +#define _PATH_MNTTAB "/etc/fstab" +#define _PATH_MOUNTED "/etc/mtab" +#define _PATH_NOLOGIN "/etc/nologin" +#define _PATH_PRESERVE "/var/lib" +#define _PATH_RWHODIR "/var/spool/rwho" +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#define _PATH_SHADOW "/etc/shadow" +#define _PATH_SHELLS "/etc/shells" +#define _PATH_TTY "/dev/tty" +#define _PATH_UNIX "/boot/vmlinux" +#define _PATH_UTMP "/var/run/utmp" +#define _PATH_VI "/usr/bin/vi" +#define _PATH_WTMP "/var/log/wtmp" + +/* uClibc */ +#ifdef _LIBC +#define _PATH_PASSWD "/etc/passwd" +#define _PATH_GROUP "/etc/group" +#endif + +/* Provide trailing slash, since mostly used for building pathnames. */ +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_VARDB "/var/db/" +#define _PATH_VARRUN "/var/run/" +#define _PATH_VARTMP "/var/tmp/" + +#endif /* !_PATHS_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/poll.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/poll.h new file mode 100644 index 0000000..06fb41a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/poll.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/routed.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/routed.h new file mode 100644 index 0000000..befd865 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/routed.h @@ -0,0 +1,101 @@ +/*- + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)routed.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PROTOCOLS_ROUTED_H +#define _PROTOCOLS_ROUTED_H 1 + +#include +/* + * Routing Information Protocol + * + * Derived from Xerox NS Routing Information Protocol + * by changing 32-bit net numbers to sockaddr's and + * padding stuff to 32-bit boundaries. + */ +#define RIPVERSION 1 + +struct netinfo { + struct sockaddr rip_dst; /* destination net/host */ + int rip_metric; /* cost of route */ +}; + +struct rip { + u_char rip_cmd; /* request/response */ + u_char rip_vers; /* protocol version # */ + u_char rip_res1[2]; /* pad to 32-bit boundary */ + union { + struct netinfo ru_nets[1]; /* variable length... */ + char ru_tracefile[1]; /* ditto ... */ + } ripun; +#define rip_nets ripun.ru_nets +#define rip_tracefile ripun.ru_tracefile +}; + +/* + * Packet types. + */ +#define RIPCMD_REQUEST 1 /* want info */ +#define RIPCMD_RESPONSE 2 /* responding to request */ +#define RIPCMD_TRACEON 3 /* turn tracing on */ +#define RIPCMD_TRACEOFF 4 /* turn it off */ + +#define RIPCMD_MAX 5 +#ifdef RIPCMDS +char *ripcmds[RIPCMD_MAX] = + { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" }; +#endif + +#define HOPCNT_INFINITY 16 /* per Xerox NS */ +#define MAXPACKETSIZE 512 /* max broadcast size */ + +/* + * Timer values used in managing the routing table. + * Complete tables are broadcast every SUPPLY_INTERVAL seconds. + * If changes occur between updates, dynamic updates containing only changes + * may be sent. When these are sent, a timer is set for a random value + * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates + * are sent until the timer expires. + * + * Every update of a routing entry forces an entry's timer to be reset. + * After EXPIRE_TIME without updates, the entry is marked invalid, + * but held onto until GARBAGE_TIME so that others may + * see it "be deleted". + */ +#define TIMER_RATE 30 /* alarm clocks every 30 seconds */ + +#define SUPPLY_INTERVAL 30 /* time to supply tables */ +#define MIN_WAITTIME 2 /* min. interval to broadcast changes */ +#define MAX_WAITTIME 5 /* max. time to delay changes */ + +#define EXPIRE_TIME 180 /* time to mark entry invalid */ +#define GARBAGE_TIME 240 /* time to garbage collect */ + +#endif /* protocols/routed.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/rwhod.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/rwhod.h new file mode 100644 index 0000000..446d6f9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/rwhod.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)rwhod.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PROTOCOLS_RWHOD_H +#define _PROTOCOLS_RWHOD_H 1 + +#include + +/* + * rwho protocol packet format. + */ +struct outmp { + char out_line[8]; /* tty name */ + char out_name[8]; /* user id */ + int32_t out_time; /* time on */ +}; + +struct whod { + char wd_vers; /* protocol version # */ + char wd_type; /* packet type, see below */ + char wd_pad[2]; + int wd_sendtime; /* time stamp by sender */ + int wd_recvtime; /* time stamp applied by receiver */ + char wd_hostname[32]; /* hosts's name */ + int wd_loadav[3]; /* load average as in uptime */ + int wd_boottime; /* time system booted */ + struct whoent { + struct outmp we_utmp; /* active tty info */ + int we_idle; /* tty idle time */ + } wd_we[1024 / sizeof (struct whoent)]; +}; + +#define WHODVERSION 1 +#define WHODTYPE_STATUS 1 /* host status */ + +/* We used to define _PATH_RWHODIR here but it's now in . */ +#include + +#endif /* protocols/rwhod.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/talkd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/talkd.h new file mode 100644 index 0000000..a8f33b1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/talkd.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)talkd.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PROTOCOLS_TALKD_H +#define _PROTOCOLS_TALKD_H 1 + +/* + * This describes the protocol used by the talk server and clients. + * + * The talk server acts a repository of invitations, responding to + * requests by clients wishing to rendezvous for the purpose of + * holding a conversation. In normal operation, a client, the caller, + * initiates a rendezvous by sending a CTL_MSG to the server of + * type LOOK_UP. This causes the server to search its invitation + * tables to check if an invitation currently exists for the caller + * (to speak to the callee specified in the message). If the lookup + * fails, the caller then sends an ANNOUNCE message causing the server + * to broadcast an announcement on the callee's login ports requesting + * contact. When the callee responds, the local server uses the + * recorded invitation to respond with the appropriate rendezvous + * address and the caller and callee client programs establish a + * stream connection through which the conversation takes place. + */ + +#include +#include + +/* + * Client->server request message format. + */ +typedef struct { + u_char vers; /* protocol version */ + u_char type; /* request type, see below */ + u_char answer; /* not used */ + u_char pad; + u_int32_t id_num; /* message id */ + struct osockaddr addr; /* old (4.3) style */ + struct osockaddr ctl_addr; /* old (4.3) style */ + int32_t pid; /* caller's process id */ +#define NAME_SIZE 12 + char l_name[NAME_SIZE];/* caller's name */ + char r_name[NAME_SIZE];/* callee's name */ +#define TTY_SIZE 16 + char r_tty[TTY_SIZE];/* callee's tty name */ +} CTL_MSG; + +/* + * Server->client response message format. + */ +typedef struct { + u_char vers; /* protocol version */ + u_char type; /* type of request message, see below */ + u_char answer; /* response to request message, see below */ + u_char pad; + u_int32_t id_num; /* message id */ + struct osockaddr addr; /* address for establishing conversation */ +} CTL_RESPONSE; + +#define TALK_VERSION 1 /* protocol version */ + +/* message type values */ +#define LEAVE_INVITE 0 /* leave invitation with server */ +#define LOOK_UP 1 /* check for invitation by callee */ +#define DELETE 2 /* delete invitation by caller */ +#define ANNOUNCE 3 /* announce invitation by caller */ + +/* answer values */ +#define SUCCESS 0 /* operation completed properly */ +#define NOT_HERE 1 /* callee not logged in */ +#define FAILED 2 /* operation failed for unexplained reason */ +#define MACHINE_UNKNOWN 3 /* caller's machine name unknown */ +#define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */ +#define UNKNOWN_REQUEST 5 /* request has invalid type value */ +#define BADVERSION 6 /* request has invalid protocol version */ +#define BADADDR 7 /* request has invalid addr value */ +#define BADCTLADDR 8 /* request has invalid ctl_addr value */ + +/* + * Operational parameters. + */ +#define MAX_LIFE 60 /* max time daemon saves invitations */ +/* RING_WAIT should be 10's of seconds less than MAX_LIFE */ +#define RING_WAIT 30 /* time to wait before resending invitation */ + +#endif /* protocols/talkd.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/timed.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/timed.h new file mode 100644 index 0000000..4345bed --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/protocols/timed.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)timed.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PROTOCOLS_TIMED_H +#define _PROTOCOLS_TIMED_H 1 + +#include + +/* + * Time Synchronization Protocol + */ + +#define TSPVERSION 1 +#define ANYADDR NULL + +struct tsp { + u_char tsp_type; + u_char tsp_vers; + u_short tsp_seq; + union { + struct timeval tspu_time; + char tspu_hopcnt; + } tsp_u; + char tsp_name[MAXHOSTNAMELEN]; +}; + +#define tsp_time tsp_u.tspu_time +#define tsp_hopcnt tsp_u.tspu_hopcnt + +/* + * Command types. + */ +#define TSP_ANY 0 /* match any types */ +#define TSP_ADJTIME 1 /* send adjtime */ +#define TSP_ACK 2 /* generic acknowledgement */ +#define TSP_MASTERREQ 3 /* ask for master's name */ +#define TSP_MASTERACK 4 /* acknowledge master request */ +#define TSP_SETTIME 5 /* send network time */ +#define TSP_MASTERUP 6 /* inform slaves that master is up */ +#define TSP_SLAVEUP 7 /* slave is up but not polled */ +#define TSP_ELECTION 8 /* advance candidature for master */ +#define TSP_ACCEPT 9 /* support candidature of master */ +#define TSP_REFUSE 10 /* reject candidature of master */ +#define TSP_CONFLICT 11 /* two or more masters present */ +#define TSP_RESOLVE 12 /* masters' conflict resolution */ +#define TSP_QUIT 13 /* reject candidature if master is up */ +#define TSP_DATE 14 /* reset the time (date command) */ +#define TSP_DATEREQ 15 /* remote request to reset the time */ +#define TSP_DATEACK 16 /* acknowledge time setting */ +#define TSP_TRACEON 17 /* turn tracing on */ +#define TSP_TRACEOFF 18 /* turn tracing off */ +#define TSP_MSITE 19 /* find out master's site */ +#define TSP_MSITEREQ 20 /* remote master's site request */ +#define TSP_TEST 21 /* for testing election algo */ +#define TSP_SETDATE 22 /* New from date command */ +#define TSP_SETDATEREQ 23 /* New remote for above */ +#define TSP_LOOP 24 /* loop detection packet */ + +#define TSPTYPENUMBER 25 + +#ifdef TSPTYPES +char *tsptype[TSPTYPENUMBER] = + { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP", + "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT", + "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ", + "TEST", "SETDATE", "SETDATEREQ", "LOOP" }; +#endif + +#endif /* protocols/timed.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/pthread.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/pthread.h new file mode 100644 index 0000000..69aa2f8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/pthread.h @@ -0,0 +1,691 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +#ifndef _PTHREAD_H +#define _PTHREAD_H 1 + +#include + +#include +#include + +#define __need_sigset_t +#include +#include +#include + + +__BEGIN_DECLS + +/* Initializers. */ + +#define PTHREAD_MUTEX_INITIALIZER \ + {0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __LOCK_INITIALIZER} +#ifdef __USE_GNU +# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ + {0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __LOCK_INITIALIZER} +# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ + {0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, __LOCK_INITIALIZER} +# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ + {0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __LOCK_INITIALIZER} +#endif + +#define PTHREAD_COND_INITIALIZER {__LOCK_INITIALIZER, 0} + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +# define PTHREAD_RWLOCK_INITIALIZER \ + { __LOCK_INITIALIZER, 0, NULL, NULL, NULL, \ + PTHREAD_RWLOCK_DEFAULT_NP, PTHREAD_PROCESS_PRIVATE } +#endif +#ifdef __USE_GNU +# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ + { __LOCK_INITIALIZER, 0, NULL, NULL, NULL, \ + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, PTHREAD_PROCESS_PRIVATE } +#endif + +/* Values for attributes. */ + +enum +{ + PTHREAD_CREATE_JOINABLE, +#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE + PTHREAD_CREATE_DETACHED +#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED +}; + +enum +{ + PTHREAD_INHERIT_SCHED, +#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED + PTHREAD_EXPLICIT_SCHED +#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED +}; + +enum +{ + PTHREAD_SCOPE_SYSTEM, +#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM + PTHREAD_SCOPE_PROCESS +#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS +}; + +enum +{ + PTHREAD_MUTEX_ADAPTIVE_NP, + PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_TIMED_NP +#ifdef __USE_UNIX98 + , + PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_ADAPTIVE_NP, + PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL +#endif +#ifdef __USE_GNU + /* For compatibility. */ + , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_ADAPTIVE_NP +#endif +}; + +enum +{ + PTHREAD_PROCESS_PRIVATE, +#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE + PTHREAD_PROCESS_SHARED +#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED +}; + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +enum +{ + PTHREAD_RWLOCK_PREFER_READER_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, + PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_WRITER_NP +}; +#endif /* Unix98 */ + +#define PTHREAD_ONCE_INIT 0 + +/* Special constants */ + +#ifdef __USE_XOPEN2K +/* -1 is distinct from 0 and all errno constants */ +# define PTHREAD_BARRIER_SERIAL_THREAD -1 +#endif + +/* Cleanup buffers */ + +struct _pthread_cleanup_buffer +{ + void (*__routine) (void *); /* Function to call. */ + void *__arg; /* Its argument. */ + int __canceltype; /* Saved cancellation type. */ + struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */ +}; + +/* Cancellation */ + +enum +{ + PTHREAD_CANCEL_ENABLE, +#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE + PTHREAD_CANCEL_DISABLE +#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE +}; +enum +{ + PTHREAD_CANCEL_DEFERRED, +#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED + PTHREAD_CANCEL_ASYNCHRONOUS +#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS +}; +#define PTHREAD_CANCELED ((void *) -1) + + +/* Function for handling threads. */ + +/* Create a thread with given attributes ATTR (or default attributes + if ATTR is NULL), and call function START_ROUTINE with given + arguments ARG. */ +extern int pthread_create (pthread_t *__restrict __threadp, + __const pthread_attr_t *__restrict __attr, + void *(*__start_routine) (void *), + void *__restrict __arg) __THROW; + +/* Obtain the identifier of the current thread. */ +extern pthread_t pthread_self (void) __THROW; + +/* Compare two thread identifiers. */ +extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW; + +/* Terminate calling thread. */ +extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); + +/* Make calling thread wait for termination of the thread TH. The + exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN + is not NULL. */ +extern int pthread_join (pthread_t __th, void **__thread_return); + +/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. + The resources of TH will therefore be freed immediately when it + terminates, instead of waiting for another thread to perform PTHREAD_JOIN + on it. */ +extern int pthread_detach (pthread_t __th) __THROW; + + +/* Functions for handling attributes. */ + +/* Initialize thread attribute *ATTR with default attributes + (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER, + no user-provided stack). */ +extern int pthread_attr_init (pthread_attr_t *__attr) __THROW; + +/* Destroy thread attribute *ATTR. */ +extern int pthread_attr_destroy (pthread_attr_t *__attr) __THROW; + +/* Set the `detachstate' attribute in *ATTR according to DETACHSTATE. */ +extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, + int __detachstate) __THROW; + +/* Return in *DETACHSTATE the `detachstate' attribute in *ATTR. */ +extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr, + int *__detachstate) __THROW; + +/* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */ +extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, + __const struct sched_param *__restrict + __param) __THROW; + +/* Return in *PARAM the scheduling parameters of *ATTR. */ +extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict + __attr, + struct sched_param *__restrict __param) + __THROW; + +/* Set scheduling policy in *ATTR according to POLICY. */ +extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) + __THROW; + +/* Return in *POLICY the scheduling policy of *ATTR. */ +extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict + __attr, int *__restrict __policy) + __THROW; + +/* Set scheduling inheritance mode in *ATTR according to INHERIT. */ +extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, + int __inherit) __THROW; + +/* Return in *INHERIT the scheduling inheritance mode of *ATTR. */ +extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict + __attr, int *__restrict __inherit) + __THROW; + +/* Set scheduling contention scope in *ATTR according to SCOPE. */ +extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) + __THROW; + +/* Return in *SCOPE the scheduling contention scope of *ATTR. */ +extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr, + int *__restrict __scope) __THROW; + +#ifdef __USE_UNIX98 +/* Set the size of the guard area at the bottom of the thread. */ +extern int pthread_attr_setguardsize (pthread_attr_t *__attr, + size_t __guardsize) __THROW; + +/* Get the size of the guard area at the bottom of the thread. */ +extern int pthread_attr_getguardsize (__const pthread_attr_t *__restrict + __attr, size_t *__restrict __guardsize) + __THROW; +#endif + +/* Set the starting address of the stack of the thread to be created. + Depending on whether the stack grows up or down the value must either + be higher or lower than all the address in the memory block. The + minimal size of the block must be PTHREAD_STACK_SIZE. */ +extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, + void *__stackaddr) __THROW; + +/* Return the previously set address for the stack. */ +extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict + __attr, void **__restrict __stackaddr) + __THROW; + +#ifdef __USE_XOPEN2K +/* The following two interfaces are intended to replace the last two. They + require setting the address as well as the size since only setting the + address will make the implementation on some architectures impossible. */ +extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, + size_t __stacksize) __THROW; + +/* Return the previously set address for the stack. */ +extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr, + void **__restrict __stackaddr, + size_t *__restrict __stacksize) __THROW; +#endif + +/* Add information about the minimum stack size needed for the thread + to be started. This size must never be less than PTHREAD_STACK_SIZE + and must also not exceed the system limits. */ +extern int pthread_attr_setstacksize (pthread_attr_t *__attr, + size_t __stacksize) __THROW; + +/* Return the currently used minimal stack size. */ +extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict + __attr, size_t *__restrict __stacksize) + __THROW; + +#ifdef __USE_GNU +/* Initialize thread attribute *ATTR with attributes corresponding to the + already running thread TH. It shall be called on unitialized ATTR + and destroyed with pthread_attr_destroy when no longer needed. */ +extern void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr); +#endif + +/* Functions for scheduling control. */ + +/* Set the scheduling parameters for TARGET_THREAD according to POLICY + and *PARAM. */ +extern int pthread_setschedparam (pthread_t __target_thread, int __policy, + __const struct sched_param *__param) + __THROW; + +/* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */ +extern int pthread_getschedparam (pthread_t __target_thread, + int *__restrict __policy, + struct sched_param *__restrict __param) + __THROW; + +#ifdef __USE_UNIX98 +/* Determine level of concurrency. */ +extern int pthread_getconcurrency (void) __THROW; + +/* Set new concurrency level to LEVEL. */ +extern int pthread_setconcurrency (int __level) __THROW; +#endif + +/* Functions for mutex handling. */ + +/* Initialize MUTEX using attributes in *MUTEX_ATTR, or use the + default values if later is NULL. */ +extern int pthread_mutex_init (pthread_mutex_t *__restrict __mutex, + __const pthread_mutexattr_t *__restrict + __mutex_attr) __THROW; + +/* Destroy MUTEX. */ +extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) __THROW; + +/* Try to lock MUTEX. */ +extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROW; + +/* Wait until lock for MUTEX becomes available and lock it. */ +extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROW; + +#ifdef __USE_XOPEN2K +/* Wait until lock becomes available, or specified time passes. */ +extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, + __const struct timespec *__restrict + __abstime) __THROW; +#endif + +/* Unlock MUTEX. */ +extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW; + + +/* Functions for handling mutex attributes. */ + +/* Initialize mutex attribute object ATTR with default attributes + (kind is PTHREAD_MUTEX_TIMED_NP). */ +extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) __THROW; + +/* Destroy mutex attribute object ATTR. */ +extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) __THROW; + +/* Get the process-shared flag of the mutex attribute ATTR. */ +extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t * + __restrict __attr, + int *__restrict __pshared) __THROW; + +/* Set the process-shared flag of the mutex attribute ATTR. */ +extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, + int __pshared) __THROW; + +#ifdef __USE_UNIX98 +/* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL, + PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or + PTHREAD_MUTEX_DEFAULT). */ +extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) + __THROW; + +/* Return in *KIND the mutex kind attribute in *ATTR. */ +extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict + __attr, int *__restrict __kind) __THROW; +#endif + + +/* Functions for handling conditional variables. */ + +/* Initialize condition variable COND using attributes ATTR, or use + the default values if later is NULL. */ +extern int pthread_cond_init (pthread_cond_t *__restrict __cond, + __const pthread_condattr_t *__restrict + __cond_attr) __THROW; + +/* Destroy condition variable COND. */ +extern int pthread_cond_destroy (pthread_cond_t *__cond) __THROW; + +/* Wake up one thread waiting for condition variable COND. */ +extern int pthread_cond_signal (pthread_cond_t *__cond) __THROW; + +/* Wake up all threads waiting for condition variables COND. */ +extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW; + +/* Wait for condition variable COND to be signaled or broadcast. + MUTEX is assumed to be locked before. */ +extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex); + +/* Wait for condition variable COND to be signaled or broadcast until + ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an + absolute time specification; zero is the beginning of the epoch + (00:00:00 GMT, January 1, 1970). */ +extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + __const struct timespec *__restrict + __abstime); + +/* Functions for handling condition variable attributes. */ + +/* Initialize condition variable attribute ATTR. */ +extern int pthread_condattr_init (pthread_condattr_t *__attr) __THROW; + +/* Destroy condition variable attribute ATTR. */ +extern int pthread_condattr_destroy (pthread_condattr_t *__attr) __THROW; + +/* Get the process-shared flag of the condition variable attribute ATTR. */ +extern int pthread_condattr_getpshared (__const pthread_condattr_t * + __restrict __attr, + int *__restrict __pshared) __THROW; + +/* Set the process-shared flag of the condition variable attribute ATTR. */ +extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, + int __pshared) __THROW; + + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +/* Functions for handling read-write locks. */ + +/* Initialize read-write lock RWLOCK using attributes ATTR, or use + the default values if later is NULL. */ +extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, + __const pthread_rwlockattr_t *__restrict + __attr) __THROW; + +/* Destroy read-write lock RWLOCK. */ +extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) __THROW; + +/* Acquire read lock for RWLOCK. */ +extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROW; + +/* Try to acquire read lock for RWLOCK. */ +extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROW; + +# ifdef __USE_XOPEN2K +/* Try to acquire read lock for RWLOCK or return after specfied time. */ +extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, + __const struct timespec *__restrict + __abstime) __THROW; +# endif + +/* Acquire write lock for RWLOCK. */ +extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROW; + +/* Try to acquire write lock for RWLOCK. */ +extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROW; + +# ifdef __USE_XOPEN2K +/* Try to acquire write lock for RWLOCK or return after specfied time. */ +extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, + __const struct timespec *__restrict + __abstime) __THROW; +# endif + +/* Unlock RWLOCK. */ +extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROW; + + +/* Functions for handling read-write lock attributes. */ + +/* Initialize attribute object ATTR with default values. */ +extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) __THROW; + +/* Destroy attribute object ATTR. */ +extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) __THROW; + +/* Return current setting of process-shared attribute of ATTR in PSHARED. */ +extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t * + __restrict __attr, + int *__restrict __pshared) __THROW; + +/* Set process-shared attribute of ATTR to PSHARED. */ +extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, + int __pshared) __THROW; + +/* Return current setting of reader/writer preference. */ +extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *__attr, + int *__pref) __THROW; + +/* Set reader/write preference. */ +extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, + int __pref) __THROW; +#endif + +#if 0 +/* Not yet implemented in uClibc! */ + +#ifdef __USE_XOPEN2K +/* The IEEE Std. 1003.1j-2000 introduces functions to implement + spinlocks. */ + +/* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can + be shared between different processes. */ +extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) + __THROW; + +/* Destroy the spinlock LOCK. */ +extern int pthread_spin_destroy (pthread_spinlock_t *__lock) __THROW; + +/* Wait until spinlock LOCK is retrieved. */ +extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROW; + +/* Try to lock spinlock LOCK. */ +extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROW; + +/* Release spinlock LOCK. */ +extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW; + + +/* Barriers are a also a new feature in 1003.1j-2000. */ + +extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier, + __const pthread_barrierattr_t *__restrict + __attr, unsigned int __count) __THROW; + +extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) __THROW; + +extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) __THROW; + +extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) __THROW; + +extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t * + __restrict __attr, + int *__restrict __pshared) __THROW; + +extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, + int __pshared) __THROW; + +extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROW; +#endif +#endif + + +/* Functions for handling thread-specific data. */ + +/* Create a key value identifying a location in the thread-specific + data area. Each thread maintains a distinct thread-specific data + area. DESTR_FUNCTION, if non-NULL, is called with the value + associated to that key when the key is destroyed. + DESTR_FUNCTION is not called if the value associated is NULL when + the key is destroyed. */ +extern int pthread_key_create (pthread_key_t *__key, + void (*__destr_function) (void *)) __THROW; + +/* Destroy KEY. */ +extern int pthread_key_delete (pthread_key_t __key) __THROW; + +/* Store POINTER in the thread-specific data slot identified by KEY. */ +extern int pthread_setspecific (pthread_key_t __key, + __const void *__pointer) __THROW; + +/* Return current value of the thread-specific data slot identified by KEY. */ +extern void *pthread_getspecific (pthread_key_t __key) __THROW; + + +/* Functions for handling initialization. */ + +/* Guarantee that the initialization function INIT_ROUTINE will be called + only once, even if pthread_once is executed several times with the + same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or + extern variable initialized to PTHREAD_ONCE_INIT. + + The initialization functions might throw exception which is why + this function is not marked with __THROW. */ +extern int pthread_once (pthread_once_t *__once_control, + void (*__init_routine) (void)); + + +/* Functions for handling cancellation. */ + +/* Set cancelability state of current thread to STATE, returning old + state in *OLDSTATE if OLDSTATE is not NULL. */ +extern int pthread_setcancelstate (int __state, int *__oldstate); + +/* Set cancellation state of current thread to TYPE, returning the old + type in *OLDTYPE if OLDTYPE is not NULL. */ +extern int pthread_setcanceltype (int __type, int *__oldtype); + +/* Cancel THREAD immediately or at the next possibility. */ +extern int pthread_cancel (pthread_t __cancelthread); + +/* Test for pending cancellation for the current thread and terminate + the thread as per pthread_exit(PTHREAD_CANCELED) if it has been + cancelled. */ +extern void pthread_testcancel (void); + +/* Return the previously set address for the stack. */ +extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr, + void **__restrict __stackaddr, + size_t *__restrict __stacksize) __THROW; + + +/* Install a cleanup handler: ROUTINE will be called with arguments ARG + when the thread is cancelled or calls pthread_exit. ROUTINE will also + be called with arguments ARG when the matching pthread_cleanup_pop + is executed with non-zero EXECUTE argument. + pthread_cleanup_push and pthread_cleanup_pop are macros and must always + be used in matching pairs at the same nesting level of braces. */ + +#define pthread_cleanup_push(routine,arg) \ + { struct _pthread_cleanup_buffer _buffer; \ + _pthread_cleanup_push (&_buffer, (routine), (arg)); + +extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer, + void (*__routine) (void *), + void *__arg) __THROW; + +/* Remove a cleanup handler installed by the matching pthread_cleanup_push. + If EXECUTE is non-zero, the handler function is called. */ + +#define pthread_cleanup_pop(execute) \ + _pthread_cleanup_pop (&_buffer, (execute)); } + +extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer, + int __execute) __THROW; + +/* Install a cleanup handler as pthread_cleanup_push does, but also + saves the current cancellation type and set it to deferred cancellation. */ + +#ifdef __USE_GNU +# define pthread_cleanup_push_defer_np(routine,arg) \ + { struct _pthread_cleanup_buffer _buffer; \ + _pthread_cleanup_push_defer (&_buffer, (routine), (arg)); + +extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer, + void (*__routine) (void *), + void *__arg) __THROW; + +/* Remove a cleanup handler as pthread_cleanup_pop does, but also + restores the cancellation type that was in effect when the matching + pthread_cleanup_push_defer was called. */ + +# define pthread_cleanup_pop_restore_np(execute) \ + _pthread_cleanup_pop_restore (&_buffer, (execute)); } + +extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer, + int __execute) __THROW; +#endif + + +#if 0 +/* Not yet implemented in uClibc! */ + +#ifdef __USE_XOPEN2K +/* Get ID of CPU-time clock for thread THREAD_ID. */ +extern int pthread_getcpuclockid (pthread_t __thread_id, + clockid_t *__clock_id) __THROW; +#endif +#endif + + +/* Functions for handling signals. */ +#include + + +/* Functions for handling process creation and process execution. */ + +/* Install handlers to be called when a new process is created with FORK. + The PREPARE handler is called in the parent process just before performing + FORK. The PARENT handler is called in the parent process just after FORK. + The CHILD handler is called in the child process. Each of the three + handlers can be NULL, meaning that no handler needs to be called at that + point. + PTHREAD_ATFORK can be called several times, in which case the PREPARE + handlers are called in LIFO order (last added with PTHREAD_ATFORK, + first called before FORK), and the PARENT and CHILD handlers are called + in FIFO (first added, first called). */ + +extern int pthread_atfork (void (*__prepare) (void), + void (*__parent) (void), + void (*__child) (void)) __THROW; + +/* Terminate all threads in the program except the calling process. + Should be called just before invoking one of the exec*() functions. */ + +extern void pthread_kill_other_threads_np (void) __THROW; + +__END_DECLS + +#endif /* pthread.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/pty.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/pty.h new file mode 100644 index 0000000..2d4b5e2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/pty.h @@ -0,0 +1,44 @@ +/* Functions for pseudo TTY handling. + Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _PTY_H +#define _PTY_H 1 + +#include + +#include +#include + + +__BEGIN_DECLS + +/* Create pseudo tty master slave pair with NAME and set terminal + attributes according to TERMP and WINP and return handles for both + ends in AMASTER and ASLAVE. */ +extern int openpty (int *__amaster, int *__aslave, char *__name, + struct termios *__termp, struct winsize *__winp) __THROW; + +/* Create child process and establish the slave pseudo terminal as the + child's controlling terminal. */ +extern int forkpty (int *__amaster, char *__name, + struct termios *__termp, struct winsize *__winp) __THROW; + +__END_DECLS + +#endif /* pty.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/pwd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/pwd.h new file mode 100644 index 0000000..e874133 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/pwd.h @@ -0,0 +1,186 @@ +/* Copyright (C) 1991,1992,1995-2001,2003,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 9.2.2 User Database Access + */ + +#ifndef _PWD_H +#define _PWD_H 1 + +#include + +__BEGIN_DECLS + +#include + +#define __need_size_t +#include + +#if defined __USE_XOPEN || defined __USE_XOPEN2K +/* The Single Unix specification says that some more types are + available here. */ +# ifndef __gid_t_defined +typedef __gid_t gid_t; +# define __gid_t_defined +# endif + +# ifndef __uid_t_defined +typedef __uid_t uid_t; +# define __uid_t_defined +# endif +#endif + +/* The passwd structure. */ +struct passwd +{ + char *pw_name; /* Username. */ + char *pw_passwd; /* Password. */ + __uid_t pw_uid; /* User ID. */ + __gid_t pw_gid; /* Group ID. */ + char *pw_gecos; /* Real name. */ + char *pw_dir; /* Home directory. */ + char *pw_shell; /* Shell program. */ +}; + + +#if defined __USE_SVID || defined __USE_GNU +# define __need_FILE +# include +#endif + + +#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED +/* Rewind the password-file stream. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setpwent (void); + +/* Close the password-file stream. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endpwent (void); + +/* Read an entry from the password-file stream, opening it if necessary. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct passwd *getpwent (void); +#endif + +#ifdef __USE_SVID +/* Read an entry from STREAM. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct passwd *fgetpwent (FILE *__stream); + +/* Write the given entry onto the given stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int putpwent (__const struct passwd *__restrict __p, + FILE *__restrict __f); +#endif + +/* Search for an entry with a matching user ID. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct passwd *getpwuid (__uid_t __uid); + +/* Search for an entry with a matching username. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct passwd *getpwnam (__const char *__name); + +#if defined __USE_POSIX || defined __USE_MISC + +# ifdef __USE_MISC +/* Reasonable value for the buffer sized used in the reentrant + functions below. But better use `sysconf'. */ +# define NSS_BUFLEN_PASSWD 1024 +# endif + +/* Reentrant versions of some of the functions above. + + PLEASE NOTE: the `getpwent_r' function is not (yet) standardized. + The interface may change in later versions of this library. But + the interface is designed following the principals used for the + other reentrant functions so the chances are good this is what the + POSIX people would choose. */ + +# if defined __USE_SVID || defined __USE_MISC +/* This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int getpwent_r (struct passwd *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct passwd **__restrict __result); +# endif + +extern int getpwuid_r (__uid_t __uid, + struct passwd *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct passwd **__restrict __result); + +extern int getpwnam_r (__const char *__restrict __name, + struct passwd *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct passwd **__restrict __result); + + +# ifdef __USE_SVID +/* Read an entry from STREAM. This function is not standardized and + probably never will. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fgetpwent_r (FILE *__restrict __stream, + struct passwd *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct passwd **__restrict __result); +# endif + +#endif /* POSIX or reentrant */ + +#ifdef __USE_GNU +/* Re-construct the password-file line for the given uid + in the given buffer. This knows the format that the caller + will expect, but this need not be the format of the password file. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int getpw (__uid_t __uid, char *__buffer); +#endif + +__END_DECLS + +#endif /* pwd.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/..install.cmd new file mode 100644 index 0000000..6cefd63 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/rdma/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/rdma /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/rdma mips ib_user_mad.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/rdma /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/rdma mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/rdma/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/ib_user_mad.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/ib_user_mad.h new file mode 100644 index 0000000..d6fce1c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rdma/ib_user_mad.h @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * Copyright (c) 2005 Voltaire, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef IB_USER_MAD_H +#define IB_USER_MAD_H + +#include +#include + +/* + * Increment this value if any changes that break userspace ABI + * compatibility are made. + */ +#define IB_USER_MAD_ABI_VERSION 5 + +/* + * Make sure that all structs defined in this file remain laid out so + * that they pack the same way on 32-bit and 64-bit architectures (to + * avoid incompatibility between 32-bit userspace and 64-bit kernels). + */ + +/** + * ib_user_mad_hdr_old - Old version of MAD packet header without pkey_index + * @id - ID of agent MAD received with/to be sent with + * @status - 0 on successful receive, ETIMEDOUT if no response + * received (transaction ID in data[] will be set to TID of original + * request) (ignored on send) + * @timeout_ms - Milliseconds to wait for response (unset on receive) + * @retries - Number of automatic retries to attempt + * @qpn - Remote QP number received from/to be sent to + * @qkey - Remote Q_Key to be sent with (unset on receive) + * @lid - Remote lid received from/to be sent to + * @sl - Service level received with/to be sent with + * @path_bits - Local path bits received with/to be sent with + * @grh_present - If set, GRH was received/should be sent + * @gid_index - Local GID index to send with (unset on receive) + * @hop_limit - Hop limit in GRH + * @traffic_class - Traffic class in GRH + * @gid - Remote GID in GRH + * @flow_label - Flow label in GRH + */ +struct ib_user_mad_hdr_old { + __u32 id; + __u32 status; + __u32 timeout_ms; + __u32 retries; + __u32 length; + __be32 qpn; + __be32 qkey; + __be16 lid; + __u8 sl; + __u8 path_bits; + __u8 grh_present; + __u8 gid_index; + __u8 hop_limit; + __u8 traffic_class; + __u8 gid[16]; + __be32 flow_label; +}; + +/** + * ib_user_mad_hdr - MAD packet header + * This layout allows specifying/receiving the P_Key index. To use + * this capability, an application must call the + * IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before + * any other actions with the file handle. + * @id - ID of agent MAD received with/to be sent with + * @status - 0 on successful receive, ETIMEDOUT if no response + * received (transaction ID in data[] will be set to TID of original + * request) (ignored on send) + * @timeout_ms - Milliseconds to wait for response (unset on receive) + * @retries - Number of automatic retries to attempt + * @qpn - Remote QP number received from/to be sent to + * @qkey - Remote Q_Key to be sent with (unset on receive) + * @lid - Remote lid received from/to be sent to + * @sl - Service level received with/to be sent with + * @path_bits - Local path bits received with/to be sent with + * @grh_present - If set, GRH was received/should be sent + * @gid_index - Local GID index to send with (unset on receive) + * @hop_limit - Hop limit in GRH + * @traffic_class - Traffic class in GRH + * @gid - Remote GID in GRH + * @flow_label - Flow label in GRH + * @pkey_index - P_Key index + */ +struct ib_user_mad_hdr { + __u32 id; + __u32 status; + __u32 timeout_ms; + __u32 retries; + __u32 length; + __be32 qpn; + __be32 qkey; + __be16 lid; + __u8 sl; + __u8 path_bits; + __u8 grh_present; + __u8 gid_index; + __u8 hop_limit; + __u8 traffic_class; + __u8 gid[16]; + __be32 flow_label; + __u16 pkey_index; + __u8 reserved[6]; +}; + +/** + * ib_user_mad - MAD packet + * @hdr - MAD packet header + * @data - Contents of MAD + * + */ +struct ib_user_mad { + struct ib_user_mad_hdr hdr; + __u64 data[0]; +}; + +/* + * Earlier versions of this interface definition declared the + * method_mask[] member as an array of __u32 but treated it as a + * bitmap made up of longs in the kernel. This ambiguity meant that + * 32-bit big-endian applications that can run on both 32-bit and + * 64-bit kernels had no consistent ABI to rely on, and 64-bit + * big-endian applications that treated method_mask as being made up + * of 32-bit words would have their bitmap misinterpreted. + * + * To clear up this confusion, we change the declaration of + * method_mask[] to use unsigned long and handle the conversion from + * 32-bit userspace to 64-bit kernel for big-endian systems in the + * compat_ioctl method. Unfortunately, to keep the structure layout + * the same, we need the method_mask[] array to be aligned only to 4 + * bytes even when long is 64 bits, which forces us into this ugly + * typedef. + */ +typedef unsigned long __attribute__((aligned(4))) packed_ulong; +#define IB_USER_MAD_LONGS_PER_METHOD_MASK (128 / (8 * sizeof (long))) + +/** + * ib_user_mad_reg_req - MAD registration request + * @id - Set by the kernel; used to identify agent in future requests. + * @qpn - Queue pair number; must be 0 or 1. + * @method_mask - The caller will receive unsolicited MADs for any method + * where @method_mask = 1. + * @mgmt_class - Indicates which management class of MADs should be receive + * by the caller. This field is only required if the user wishes to + * receive unsolicited MADs, otherwise it should be 0. + * @mgmt_class_version - Indicates which version of MADs for the given + * management class to receive. + * @oui: Indicates IEEE OUI when mgmt_class is a vendor class + * in the range from 0x30 to 0x4f. Otherwise not used. + * @rmpp_version: If set, indicates the RMPP version used. + * + */ +struct ib_user_mad_reg_req { + __u32 id; + packed_ulong method_mask[IB_USER_MAD_LONGS_PER_METHOD_MASK]; + __u8 qpn; + __u8 mgmt_class; + __u8 mgmt_class_version; + __u8 oui[3]; + __u8 rmpp_version; +}; + +#define IB_IOCTL_MAGIC 0x1b + +#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ + struct ib_user_mad_reg_req) + +#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32) + +#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) + +#endif /* IB_USER_MAD_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/regex.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/regex.h new file mode 100644 index 0000000..2209f2b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/regex.h @@ -0,0 +1,580 @@ +/* Definitions for data structures and routines for the regular + expression library. + Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _REGEX_H +#define _REGEX_H 1 + +#include + +/* Allow the use in C++ code. */ +#ifdef __cplusplus +extern "C" { +#endif + +/* POSIX says that must be included (by the caller) before + . */ + +#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS +/* VMS doesn't have `size_t' in , even though POSIX says it + should be there. */ +# include +#endif + +/* The following two types have to be signed and unsigned integer type + wide enough to hold a value of a pointer. For most ANSI compilers + ptrdiff_t and size_t should be likely OK. Still size of these two + types is 2 for Microsoft C. Ugh... */ +typedef long int s_reg_t; +typedef unsigned long int active_reg_t; + +/* The following bits are used to determine the regexp syntax we + recognize. The set/not-set meanings are chosen so that Emacs syntax + remains the value 0. The bits are given in alphabetical order, and + the definitions shifted by one from the previous bit; thus, when we + add or remove a bit, only one other definition need change. */ +typedef unsigned long int reg_syntax_t; + +/* If this bit is not set, then \ inside a bracket expression is literal. + If set, then such a \ quotes the following character. */ +#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) + +/* If this bit is not set, then + and ? are operators, and \+ and \? are + literals. + If set, then \+ and \? are operators and + and ? are literals. */ +#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) + +/* If this bit is set, then character classes are supported. They are: + [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], + [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. + If not set, then character classes are not supported. */ +#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) + +/* If this bit is set, then ^ and $ are always anchors (outside bracket + expressions, of course). + If this bit is not set, then it depends: + ^ is an anchor if it is at the beginning of a regular + expression or after an open-group or an alternation operator; + $ is an anchor if it is at the end of a regular expression, or + before a close-group or an alternation operator. + + This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because + POSIX draft 11.2 says that * etc. in leading positions is undefined. + We already implemented a previous draft which made those constructs + invalid, though, so we haven't changed the code back. */ +#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) + +/* If this bit is set, then special characters are always special + regardless of where they are in the pattern. + If this bit is not set, then special characters are special only in + some contexts; otherwise they are ordinary. Specifically, + * + ? and intervals are only special when not after the beginning, + open-group, or alternation operator. */ +#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) + +/* If this bit is set, then *, +, ?, and { cannot be first in an re or + immediately after an alternation or begin-group operator. */ +#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) + +/* If this bit is set, then . matches newline. + If not set, then it doesn't. */ +#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) + +/* If this bit is set, then . doesn't match NUL. + If not set, then it does. */ +#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) + +/* If this bit is set, nonmatching lists [^...] do not match newline. + If not set, they do. */ +#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) + +/* If this bit is set, either \{...\} or {...} defines an + interval, depending on RE_NO_BK_BRACES. + If not set, \{, \}, {, and } are literals. */ +#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) + +/* If this bit is set, +, ? and | aren't recognized as operators. + If not set, they are. */ +#define RE_LIMITED_OPS (RE_INTERVALS << 1) + +/* If this bit is set, newline is an alternation operator. + If not set, newline is literal. */ +#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) + +/* If this bit is set, then `{...}' defines an interval, and \{ and \} + are literals. + If not set, then `\{...\}' defines an interval. */ +#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) + +/* If this bit is set, (...) defines a group, and \( and \) are literals. + If not set, \(...\) defines a group, and ( and ) are literals. */ +#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) + +/* If this bit is set, then \ matches . + If not set, then \ is a back-reference. */ +#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) + +/* If this bit is set, then | is an alternation operator, and \| is literal. + If not set, then \| is an alternation operator, and | is literal. */ +#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) + +/* If this bit is set, then an ending range point collating higher + than the starting range point, as in [z-a], is invalid. + If not set, then when ending range point collates higher than the + starting range point, the range is ignored. */ +#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) + +/* If this bit is set, then an unmatched ) is ordinary. + If not set, then an unmatched ) is invalid. */ +#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) + +/* If this bit is set, succeed as soon as we match the whole pattern, + without further backtracking. */ +#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) + +/* If this bit is set, do not process the GNU regex operators. + If not set, then the GNU regex operators are recognized. */ +#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1) + +/* If this bit is set, turn on internal regex debugging. + If not set, and debugging was on, turn it off. + This only works if regex.c is compiled -DDEBUG. + We define this bit always, so that all that's needed to turn on + debugging is to recompile regex.c; the calling code can always have + this bit set, and it won't affect anything in the normal case. */ +#define RE_DEBUG (RE_NO_GNU_OPS << 1) + +/* If this bit is set, a syntactically invalid interval is treated as + a string of ordinary characters. For example, the ERE 'a{1' is + treated as 'a\{1'. */ +#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1) + +/* If this bit is set, then ignore case when matching. + If not set, then case is significant. */ +#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) + +/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only + for ^, because it is difficult to scan the regex backwards to find + whether ^ should be special. */ +#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1) + +/* If this bit is set, then \{ cannot be first in an bre or + immediately after an alternation or begin-group operator. */ +#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1) + +/* If this bit is set, then no_sub will be set to 1 during + re_compile_pattern. */ +#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1) + +/* This global variable defines the particular regexp syntax to use (for + some interfaces). When a regexp is compiled, the syntax used is + stored in the pattern buffer, so changing this does not affect + already-compiled regexps. */ +extern reg_syntax_t re_syntax_options; + +/* Define combinations of the above bits for the standard possibilities. + (The [[[ comments delimit what gets put into the Texinfo file, so + don't delete them!) */ +/* [[[begin syntaxes]]] */ +#define RE_SYNTAX_EMACS 0 + +#define RE_SYNTAX_AWK \ + (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ + | RE_NO_BK_PARENS | RE_NO_BK_REFS \ + | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ + | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ + | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) + +#define RE_SYNTAX_GNU_AWK \ + ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ + & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \ + | RE_CONTEXT_INVALID_OPS )) + +#define RE_SYNTAX_POSIX_AWK \ + (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ + | RE_INTERVALS | RE_NO_GNU_OPS) + +#define RE_SYNTAX_GREP \ + (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ + | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ + | RE_NEWLINE_ALT) + +#define RE_SYNTAX_EGREP \ + (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ + | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ + | RE_NO_BK_VBAR) + +#define RE_SYNTAX_POSIX_EGREP \ + (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \ + | RE_INVALID_INTERVAL_ORD) + +/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ +#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC + +#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC + +/* Syntax bits common to both basic and extended POSIX regex syntax. */ +#define _RE_SYNTAX_POSIX_COMMON \ + (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ + | RE_INTERVALS | RE_NO_EMPTY_RANGES) + +#define RE_SYNTAX_POSIX_BASIC \ + (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP) + +/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes + RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this + isn't minimal, since other operators, such as \`, aren't disabled. */ +#define RE_SYNTAX_POSIX_MINIMAL_BASIC \ + (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) + +#define RE_SYNTAX_POSIX_EXTENDED \ + (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ + | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ + | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD) + +/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is + removed and RE_NO_BK_REFS is added. */ +#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ + (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ + | RE_NO_BK_PARENS | RE_NO_BK_REFS \ + | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) +/* [[[end syntaxes]]] */ + +/* Maximum number of duplicates an interval can allow. Some systems + (erroneously) define this in other header files, but we want our + value, so remove any previous define. */ +#ifdef RE_DUP_MAX +# undef RE_DUP_MAX +#endif +/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */ +#define RE_DUP_MAX (0x7fff) + + +/* POSIX `cflags' bits (i.e., information for `regcomp'). */ + +/* If this bit is set, then use extended regular expression syntax. + If not set, then use basic regular expression syntax. */ +#define REG_EXTENDED 1 + +/* If this bit is set, then ignore case when matching. + If not set, then case is significant. */ +#define REG_ICASE (REG_EXTENDED << 1) + +/* If this bit is set, then anchors do not match at newline + characters in the string. + If not set, then anchors do match at newlines. */ +#define REG_NEWLINE (REG_ICASE << 1) + +/* If this bit is set, then report only success or fail in regexec. + If not set, then returns differ between not matching and errors. */ +#define REG_NOSUB (REG_NEWLINE << 1) + + +/* POSIX `eflags' bits (i.e., information for regexec). */ + +/* If this bit is set, then the beginning-of-line operator doesn't match + the beginning of the string (presumably because it's not the + beginning of a line). + If not set, then the beginning-of-line operator does match the + beginning of the string. */ +#define REG_NOTBOL 1 + +/* Like REG_NOTBOL, except for the end-of-line. */ +#define REG_NOTEOL (1 << 1) + +/* Use PMATCH[0] to delimit the start and end of the search in the + buffer. */ +#define REG_STARTEND (1 << 2) + + +/* If any error codes are removed, changed, or added, update the + `re_error_msg' table in regex.c. */ +typedef enum +{ +#ifdef _XOPEN_SOURCE + REG_ENOSYS = -1, /* This will never happen for this implementation. */ +#endif + + REG_NOERROR = 0, /* Success. */ + REG_NOMATCH, /* Didn't find a match (for regexec). */ + + /* POSIX regcomp return error codes. (In the order listed in the + standard.) */ + REG_BADPAT, /* Invalid pattern. */ + REG_ECOLLATE, /* Invalid collating element. */ + REG_ECTYPE, /* Invalid character class name. */ + REG_EESCAPE, /* Trailing backslash. */ + REG_ESUBREG, /* Invalid back reference. */ + REG_EBRACK, /* Unmatched left bracket. */ + REG_EPAREN, /* Parenthesis imbalance. */ + REG_EBRACE, /* Unmatched \{. */ + REG_BADBR, /* Invalid contents of \{\}. */ + REG_ERANGE, /* Invalid range end. */ + REG_ESPACE, /* Ran out of memory. */ + REG_BADRPT, /* No preceding re for repetition op. */ + + /* Error codes we've added. */ + REG_EEND, /* Premature end. */ + REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ + REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ +} reg_errcode_t; + +/* This data structure represents a compiled pattern. Before calling + the pattern compiler, the fields `buffer', `allocated', `fastmap', + `translate', and `no_sub' can be set. After the pattern has been + compiled, the `re_nsub' field is available. All other fields are + private to the regex routines. */ + +#ifndef RE_TRANSLATE_TYPE +# define RE_TRANSLATE_TYPE unsigned char * +#endif + +struct re_pattern_buffer +{ + /* Space that holds the compiled pattern. It is declared as + `unsigned char *' because its elements are sometimes used as + array indexes. */ + unsigned char *buffer; + + /* Number of bytes to which `buffer' points. */ + unsigned long int allocated; + + /* Number of bytes actually used in `buffer'. */ + unsigned long int used; + + /* Syntax setting with which the pattern was compiled. */ + reg_syntax_t syntax; + + /* Pointer to a fastmap, if any, otherwise zero. re_search uses the + fastmap, if there is one, to skip over impossible starting points + for matches. */ + char *fastmap; + + /* Either a translate table to apply to all characters before + comparing them, or zero for no translation. The translation is + applied to a pattern when it is compiled and to a string when it + is matched. */ + RE_TRANSLATE_TYPE translate; + + /* Number of subexpressions found by the compiler. */ + size_t re_nsub; + + /* Zero if this pattern cannot match the empty string, one else. + Well, in truth it's used only in `re_search_2', to see whether or + not we should use the fastmap, so we don't set this absolutely + perfectly; see `re_compile_fastmap' (the `duplicate' case). */ + unsigned can_be_null : 1; + + /* If REGS_UNALLOCATED, allocate space in the `regs' structure + for `max (RE_NREGS, re_nsub + 1)' groups. + If REGS_REALLOCATE, reallocate space if necessary. + If REGS_FIXED, use what's there. */ +#define REGS_UNALLOCATED 0 +#define REGS_REALLOCATE 1 +#define REGS_FIXED 2 + unsigned regs_allocated : 2; + + /* Set to zero when `regex_compile' compiles a pattern; set to one + by `re_compile_fastmap' if it updates the fastmap. */ + unsigned fastmap_accurate : 1; + + /* If set, `re_match_2' does not return information about + subexpressions. */ + unsigned no_sub : 1; + + /* If set, a beginning-of-line anchor doesn't match at the beginning + of the string. */ + unsigned not_bol : 1; + + /* Similarly for an end-of-line anchor. */ + unsigned not_eol : 1; + + /* If true, an anchor at a newline matches. */ + unsigned newline_anchor : 1; +}; + +typedef struct re_pattern_buffer regex_t; + +/* Type for byte offsets within the string. POSIX mandates this. */ +typedef int regoff_t; + + +/* This is the structure we store register match data in. See + regex.texinfo for a full description of what registers match. */ +struct re_registers +{ + unsigned num_regs; + regoff_t *start; + regoff_t *end; +}; + + +/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, + `re_match_2' returns information about at least this many registers + the first time a `regs' structure is passed. */ +#ifndef RE_NREGS +# define RE_NREGS 30 +#endif + + +/* POSIX specification for registers. Aside from the different names than + `re_registers', POSIX uses an array of structures, instead of a + structure of arrays. */ +typedef struct +{ + regoff_t rm_so; /* Byte offset from string's start to substring's start. */ + regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ +} regmatch_t; + +/* Declarations for routines. */ + +/* To avoid duplicating every routine declaration -- once with a + prototype (if we are ANSI), and once without (if we aren't) -- we + use the following macro to declare argument types. This + unfortunately clutters up the declarations a bit, but I think it's + worth it. */ + +#if __STDC__ + +# define _RE_ARGS(args) args + +#else /* not __STDC__ */ + +# define _RE_ARGS(args) () + +#endif /* not __STDC__ */ + +/* Sets the current default syntax to SYNTAX, and return the old syntax. + You can also simply assign to the `re_syntax_options' variable. */ +extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t __syntax)); + +/* Compile the regular expression PATTERN, with length LENGTH + and syntax given by the global `re_syntax_options', into the buffer + BUFFER. Return NULL if successful, and an error string if not. */ +extern const char *re_compile_pattern _RE_ARGS ((const char *__pattern, size_t __length, + struct re_pattern_buffer *__buffer)); + + +/* Compile a fastmap for the compiled pattern in BUFFER; used to + accelerate searches. Return 0 if successful and -2 if was an + internal error. */ +extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *__buffer)); + + +/* Search in the string STRING (with length LENGTH) for the pattern + compiled into BUFFER. Start searching at position START, for RANGE + characters. Return the starting position of the match, -1 for no + match, or -2 for an internal error. Also return register + information in REGS (if REGS and BUFFER->no_sub are nonzero). */ +extern int re_search _RE_ARGS ((struct re_pattern_buffer *__buffer, const char *__string, + int __length, int __start, int __range, + struct re_registers *__regs)); + + +/* Like `re_search', but search in the concatenation of STRING1 and + STRING2. Also, stop searching at index START + STOP. */ +extern int re_search_2 _RE_ARGS ((struct re_pattern_buffer *__buffer, + const char *__string1, int __length1, + const char *__string2, int __length2, int __start, + int __range, struct re_registers *__regs, int __stop)); + + +/* Like `re_search', but return how many characters in STRING the regexp + in BUFFER matched, starting at position START. */ +extern int re_match _RE_ARGS ((struct re_pattern_buffer *__buffer, const char *__string, + int __length, int __start, struct re_registers *__regs)); + + +/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ +extern int re_match_2 _RE_ARGS ((struct re_pattern_buffer *__buffer, + const char *__string1, int __length1, + const char *__string2, int __length2, int __start, + struct re_registers *__regs, int __stop)); + + +/* Set REGS to hold NUM_REGS registers, storing them in STARTS and + ENDS. Subsequent matches using BUFFER and REGS will use this memory + for recording register information. STARTS and ENDS must be + allocated with malloc, and must each be at least `NUM_REGS * sizeof + (regoff_t)' bytes long. + + If NUM_REGS == 0, then subsequent matches should allocate their own + register data. + + Unless this function is called, the first search or match using + PATTERN_BUFFER will allocate its own register data, without + freeing the old data. */ +extern void re_set_registers _RE_ARGS ((struct re_pattern_buffer *__buffer, + struct re_registers *__regs, + unsigned int __num_regs, + regoff_t *__starts, regoff_t *__ends)); + +#if defined _REGEX_RE_COMP || defined _LIBC +# ifndef _CRAY +/* 4.2 bsd compatibility. */ +extern char *re_comp _RE_ARGS ((const char *)); +extern int re_exec _RE_ARGS ((const char *)); +# endif +#endif + +/* GCC 2.95 and later have "__restrict"; C99 compilers have + "restrict", and "configure" may have defined "restrict". */ +#ifndef __restrict +# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) +# if defined restrict || 199901L <= __STDC_VERSION__ +# define __restrict restrict +# else +# define __restrict +# endif +# endif +#endif +/* gcc 3.1 and up support the [restrict] syntax. */ +#ifndef __restrict_arr +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +# define __restrict_arr __restrict +# else +# define __restrict_arr +# endif +#endif + +/* POSIX compatibility. */ +extern int regcomp _RE_ARGS ((regex_t *__restrict __preg, + const char *__restrict __pattern, + int __cflags)); + +extern int regexec _RE_ARGS ((const regex_t *__restrict __preg, + const char *__restrict __string, size_t __nmatch, + regmatch_t __pmatch[__restrict_arr], + int __eflags)); + +extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__restrict __preg, + char *__restrict __errbuf, size_t __errbuf_size)); + +extern void regfree _RE_ARGS ((regex_t *__preg)); + + +#ifdef __cplusplus +} +#endif /* C++ */ + +#endif /* regex.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/regexp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/regexp.h new file mode 100644 index 0000000..b7b50b7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/regexp.h @@ -0,0 +1,222 @@ +/* Copyright (C) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _REGEXP_H +#define _REGEXP_H 1 + +/* The contents of this header file was first standardized in X/Open + System Interface and Headers Issue 2, originally coming from SysV. + In issue 4, version 2, it is marked as TO BE WITDRAWN, and it has + been withdrawn in SUSv3. + + This code shouldn't be used in any newly written code. It is + included only for compatibility reasons. Use the POSIX definition + in for portable applications and a reasonable interface. */ + +#include +#include +#include +#include +#include + +/* The implementation provided here emulates the needed functionality + by mapping to the POSIX regular expression matcher. The interface + for the here included function is weird (this really is a harmless + word). + + The user has to provide six macros before this header file can be + included: + + INIT Declarations vor variables which can be used by the + other macros. + + GETC() Return the value of the next character in the regular + expression pattern. Successive calls should return + successive characters. + + PEEKC() Return the value of the next character in the regular + expression pattern. Immediately successive calls to + PEEKC() should return the same character which should + also be the next character returned by GETC(). + + UNGETC(c) Cause `c' to be returned by the next call to GETC() and + PEEKC(). + + RETURN(ptr) Used for normal exit of the `compile' function. `ptr' + is a pointer to the character after the last character of + the compiled regular expression. + + ERROR(val) Used for abnormal return from `compile'. `val' is the + error number. The error codes are: + 11 Range endpoint too large. + 16 Bad number. + 25 \digit out of range. + 36 Illegal or missing delimiter. + 41 No remembered search string. + 42 \( \) imbalance. + 43 Too many \(. + 44 More tan two numbers given in \{ \}. + 45 } expected after \. + 46 First number exceeds second in \{ \}. + 49 [ ] imbalance. + 50 Regular expression overflow. + + */ + +__BEGIN_DECLS + +/* Interface variables. They contain the results of the successful + calls to `setp' and `advance'. */ +extern char *loc1; +extern char *loc2; + +/* The use of this variable in the `advance' function is not + supported. */ +extern char *locs; + + +#ifndef __DO_NOT_DEFINE_COMPILE +/* Get and compile the user supplied pattern up to end of line or + string or until EOF is seen, whatever happens first. The result is + placed in the buffer starting at EXPBUF and delimited by ENDBUF. + + This function cannot be defined in the libc itself since it depends + on the macros. */ +char * +compile (char *__restrict instring, char *__restrict expbuf, + __const char *__restrict endbuf, int eof) +{ + char *__input_buffer = NULL; + size_t __input_size = 0; + size_t __current_size = 0; + int __ch; + int __error; + INIT + + /* Align the expression buffer according to the needs for an object + of type `regex_t'. Then check for minimum size of the buffer for + the compiled regular expression. */ + regex_t *__expr_ptr; +# if defined __GNUC__ && __GNUC__ >= 2 + const size_t __req = __alignof__ (regex_t *); +# else + /* How shall we find out? We simply guess it and can change it is + this really proofs to be wrong. */ + const size_t __req = 8; +# endif + expbuf += __req; + expbuf -= (expbuf - ((char *) 0)) % __req; + if (endbuf < expbuf + sizeof (regex_t)) + { + ERROR (50); + } + __expr_ptr = (regex_t *) expbuf; + /* The remaining space in the buffer can be used for the compiled + pattern. */ + __expr_ptr->buffer = expbuf + sizeof (regex_t); + __expr_ptr->allocated = endbuf - (char *) __expr_ptr->buffer; + + while ((__ch = (GETC ())) != eof) + { + if (__ch == '\0' || __ch == '\n') + { + UNGETC (__ch); + break; + } + + if (__current_size + 1 >= __input_size) + { + size_t __new_size = __input_size ? 2 * __input_size : 128; + char *__new_room = (char *) alloca (__new_size); + /* See whether we can use the old buffer. */ + if (__new_room + __new_size == __input_buffer) + { + __input_size += __new_size; + __input_buffer = (char *) memcpy (__new_room, __input_buffer, + __current_size); + } + else if (__input_buffer + __input_size == __new_room) + __input_size += __new_size; + else + { + __input_size = __new_size; + __input_buffer = (char *) memcpy (__new_room, __input_buffer, + __current_size); + } + } + __input_buffer[__current_size++] = __ch; + } + __input_buffer[__current_size++] = '\0'; + + /* Now compile the pattern. */ + __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE); + if (__error != 0) + /* Oh well, we have to translate POSIX error codes. */ + switch (__error) + { + case REG_BADPAT: + case REG_ECOLLATE: + case REG_ECTYPE: + case REG_EESCAPE: + case REG_BADRPT: + case REG_EEND: + case REG_ERPAREN: + default: + /* There is no matching error code. */ + RETURN (36); + case REG_ESUBREG: + RETURN (25); + case REG_EBRACK: + RETURN (49); + case REG_EPAREN: + RETURN (42); + case REG_EBRACE: + RETURN (44); + case REG_BADBR: + RETURN (46); + case REG_ERANGE: + RETURN (11); + case REG_ESPACE: + case REG_ESIZE: + ERROR (50); + } + + /* Everything is ok. */ + RETURN ((char *) (__expr_ptr->buffer + __expr_ptr->used)); +} +#endif + + +/* Find the next match in STRING. The compiled regular expression is + found in the buffer starting at EXPBUF. `loc1' will return the + first character matched and `loc2' points to the next unmatched + character. */ +extern int step (__const char *__restrict __string, + __const char *__restrict __expbuf) __THROW; + +/* Match the beginning of STRING with the compiled regular expression + in EXPBUF. If the match is successful `loc2' will contain the + position of the first unmatched character. */ +extern int advance (__const char *__restrict __string, + __const char *__restrict __expbuf) __THROW; + + +__END_DECLS + +#endif /* regexp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/resolv.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/resolv.h new file mode 100644 index 0000000..3434f5d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/resolv.h @@ -0,0 +1,395 @@ +/* + * Copyright (c) 1983, 1987, 1989 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * @(#)resolv.h 8.1 (Berkeley) 6/2/93 + * $BINDId: resolv.h,v 8.31 2000/03/30 20:16:50 vixie Exp $ + */ + +#ifndef _RESOLV_H_ + +/* These headers are needed for types used in the `struct res_state' + declaration. */ +#include +#include + +#ifndef __need_res_state +# define _RESOLV_H_ + +# include +# include +# include +# include +#endif + +#ifndef __res_state_defined +# define __res_state_defined + +typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } + res_sendhookact; + +typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *ns, + const u_char **query, + int *querylen, + u_char *ans, + int anssiz, + int *resplen); + +typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *ns, + const u_char *query, + int querylen, + u_char *ans, + int anssiz, + int *resplen); + +/* + * Global defines and variables for resolver stub. + */ +# define MAXNS 3 /* max # name servers we'll track */ +# define MAXDFLSRCH 3 /* # default domain levels to try */ +# define MAXDNSRCH 6 /* max # domains in search path */ +# define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ + +# define RES_TIMEOUT 5 /* min. seconds between retries */ +# define MAXRESOLVSORT 10 /* number of net to sort on */ +# define RES_MAXNDOTS 15 /* should reflect bit field size */ +# define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ +# define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ +# define RES_DFLRETRY 2 /* Default #/tries. */ +# define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ + +struct __res_state { + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + u_long options; /* option flags - see below. */ + int nscount; /* number of name servers */ + struct sockaddr_in + nsaddr_list[MAXNS]; /* address of name server */ +# define nsaddr nsaddr_list[0] /* for backward compatibility */ + u_short id; /* current message id */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + char defdname[256]; /* default domain (deprecated) */ + u_long pfcode; /* RES_PRF_ flags - see below. */ + unsigned ndots:4; /* threshold for initial abs. query */ + unsigned nsort:4; /* number of elements in sort_list[] */ + char unused[3]; + struct { + struct in_addr addr; + u_int32_t mask; + } sort_list[MAXRESOLVSORT]; + res_send_qhook qhook; /* query hook */ + res_send_rhook rhook; /* response hook */ + int res_h_errno; /* last one set for this context */ + int _vcsock; /* PRIVATE: for res_send VC i/o */ + u_int _flags; /* PRIVATE: see below */ + union { + char pad[52]; /* On an i386 this means 512b total. */ + struct { + u_int16_t nscount; +#if 0 + u_int16_t nsmap[MAXNS]; +#else + u_int16_t nstimes[MAXNS]; /* ms. */ +#endif + int nssocks[MAXNS]; + u_int16_t nscount6; + u_int16_t nsinit; + struct sockaddr_in6 *nsaddrs[MAXNS]; +#if 0 +#ifdef _LIBC + unsigned long long int initstamp + __attribute__((packed)); +#else + unsigned int _initstamp[2]; +#endif +#endif + } _ext; + } _u; +}; + +typedef struct __res_state *res_state; +# undef __need_res_state +#endif + +#ifdef _RESOLV_H_ +/* + * Revision information. This is the release date in YYYYMMDD format. + * It can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__RES > 19931104)". Do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#if 0 +#define __RES 19991006 +#else +#define __RES 19960801 +#endif + +/* + * Resolver configuration file. + * Normally not present, but may contain the address of the + * inital name server(s) to query and the domain search list. + */ + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +struct res_sym { + int number; /* Identifying number, like T_MX */ + char * name; /* Its symbolic name, like "MX" */ + char * humanname; /* Its fun name, like "mail exchanger" */ +}; + +/* + * Resolver flags (used to be discrete per-module statics ints). + */ +#define RES_F_VC 0x00000001 /* socket is TCP */ +#define RES_F_CONN 0x00000002 /* socket is connected */ + +/* res_findzonecut() options */ +#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ + +/* + * Resolver options (keep these in synch with res_debug.c, please) + */ +#define RES_INIT 0x00000001 /* address initialized */ +#define RES_DEBUG 0x00000002 /* print debug messages */ +#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ +#define RES_USEVC 0x00000008 /* use virtual circuit */ +#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ +#define RES_IGNTC 0x00000020 /* ignore trucation errors */ +#define RES_RECURSE 0x00000040 /* recursion desired */ +#define RES_DEFNAMES 0x00000080 /* use default domain name */ +#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x00000200 /* search up local domain tree */ +#define RES_INSECURE1 0x00000400 /* type 1 security disabled */ +#define RES_INSECURE2 0x00000800 /* type 2 security disabled */ +#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ +#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ +#define RES_ROTATE 0x00004000 /* rotate ns list after each query */ +#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */ +#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */ +#define RES_BLAST 0x00020000 /* blast all recursive servers */ +#if 0 +#define RES_USEBSTRING 0x00040000 /* IPv6 reverse lookup with byte + strings */ +#define RES_NOIP6DOTINT 0x00080000 /* Do not use .ip6.int in IPv6 + reverse lookup */ + +#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT) +#else +#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH) +#endif + +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x00000001 +#define RES_PRF_UPDATE 0x00000002 +#define RES_PRF_CLASS 0x00000004 +#define RES_PRF_CMD 0x00000008 +#define RES_PRF_QUES 0x00000010 +#define RES_PRF_ANS 0x00000020 +#define RES_PRF_AUTH 0x00000040 +#define RES_PRF_ADD 0x00000080 +#define RES_PRF_HEAD1 0x00000100 +#define RES_PRF_HEAD2 0x00000200 +#define RES_PRF_TTLID 0x00000400 +#define RES_PRF_HEADX 0x00000800 +#define RES_PRF_QUERY 0x00001000 +#define RES_PRF_REPLY 0x00002000 +#define RES_PRF_INIT 0x00004000 +/* 0x00008000 */ + +/* Things involving an internal (static) resolver context. */ +#if 0 +__BEGIN_DECLS +extern struct __res_state *__res_state(void) __attribute__ ((__const__)); +__END_DECLS +#define _res (*__res_state()) +#else +extern struct __res_state _res; +#endif + +#define fp_nquery __fp_nquery +#define fp_query __fp_query +#define hostalias __hostalias +#define p_query __p_query +#define res_close __res_close +#define res_init __res_init +#define res_isourserver __res_isourserver +#define res_mkquery __res_mkquery +#define res_query __res_query +#define res_querydomain __res_querydomain +#define res_search __res_search +#define res_send __res_send + +__BEGIN_DECLS +void fp_nquery (const u_char *, int, FILE *) __THROW; +void fp_query (const u_char *, FILE *) __THROW; +const char * hostalias (const char *) __THROW; +void p_query (const u_char *) __THROW; +#ifdef __UCLIBC_HAS_BSD_RES_CLOSE__ +void res_close (void) __THROW; +#endif +int res_init (void) __THROW; +int res_isourserver (const struct sockaddr_in *) __THROW; +int res_mkquery (int, const char *, int, int, const u_char *, + int, const u_char *, u_char *, int) __THROW; +int res_query (const char *, int, int, u_char *, int) __THROW; +int res_querydomain (const char *, const char *, int, int, + u_char *, int) __THROW; +int res_search (const char *, int, int, u_char *, int) __THROW; +int res_send (const u_char *, int, u_char *, int) __THROW; +__END_DECLS + +#define b64_ntop __b64_ntop +#define b64_pton __b64_pton +#define dn_comp __dn_comp +#define dn_count_labels __dn_count_labels +#define dn_expand __dn_expand +#define dn_skipname __dn_skipname +#define fp_resstat __fp_resstat +#define loc_aton __loc_aton +#define loc_ntoa __loc_ntoa +#define p_cdname __p_cdname +#define p_cdnname __p_cdnname +#define p_class __p_class +#define p_fqname __p_fqname +#define p_fqnname __p_fqnname +#define p_option __p_option +#define p_secstodate __p_secstodate +#define p_section __p_section +#define p_time __p_time +#define p_type __p_type +#define p_rcode __p_rcode +#define putlong __putlong +#define putshort __putshort +#define res_dnok __res_dnok +#define res_hnok __res_hnok +#define res_hostalias __res_hostalias +#define res_mailok __res_mailok +#define res_nameinquery __res_nameinquery +#define res_nclose __res_nclose +#define res_ninit __res_ninit +#define res_nmkquery __res_nmkquery +#define res_npquery __res_npquery +#define res_nquery __res_nquery +#define res_nquerydomain __res_nquerydomain +#define res_nsearch __res_nsearch +#define res_nsend __res_nsend +#define res_nisourserver __res_nisourserver +#define res_ownok __res_ownok +#define res_queriesmatch __res_queriesmatch +#define res_randomid __res_randomid +#define sym_ntop __sym_ntop +#define sym_ntos __sym_ntos +#define sym_ston __sym_ston +__BEGIN_DECLS +int res_hnok (const char *) __THROW; +int res_ownok (const char *) __THROW; +int res_mailok (const char *) __THROW; +int res_dnok (const char *) __THROW; +int sym_ston (const struct res_sym *, const char *, int *) __THROW; +const char * sym_ntos (const struct res_sym *, int, int *) __THROW; +const char * sym_ntop (const struct res_sym *, int, int *) __THROW; +int b64_ntop (u_char const *, size_t, char *, size_t) __THROW; +int b64_pton (char const *, u_char *, size_t) __THROW; +int loc_aton (const char *ascii, u_char *binary) __THROW; +const char * loc_ntoa (const u_char *binary, char *ascii) __THROW; +int dn_skipname (const u_char *, const u_char *) __THROW; +void putlong (u_int32_t, u_char *) __THROW; +void putshort (u_int16_t, u_char *) __THROW; +const char * p_class (int) __THROW; +const char * p_time (u_int32_t) __THROW; +const char * p_type (int) __THROW; +const char * p_rcode (int) __THROW; +const u_char * p_cdnname (const u_char *, const u_char *, int, FILE *) + __THROW; +const u_char * p_cdname (const u_char *, const u_char *, FILE *) __THROW; +const u_char * p_fqnname (const u_char *cp, const u_char *msg, + int, char *, int) __THROW; +const u_char * p_fqname (const u_char *, const u_char *, FILE *) __THROW; +const char * p_option (u_long option) __THROW; +char * p_secstodate (u_long) __THROW; +int dn_count_labels (const char *) __THROW; +int dn_comp (const char *, u_char *, int, u_char **, u_char **) + __THROW; +int dn_expand (const u_char *, const u_char *, const u_char *, + char *, int) __THROW; +u_int res_randomid (void) __THROW; +int res_nameinquery (const char *, int, int, + const u_char *, const u_char *) __THROW; +int res_queriesmatch (const u_char *, const u_char *, + const u_char *, const u_char *) __THROW; +const char * p_section (int section, int opcode) __THROW; +/* Things involving a resolver context. */ +int res_ninit (res_state) __THROW; +int res_nisourserver (const res_state, + const struct sockaddr_in *) __THROW; +void fp_resstat (const res_state, FILE *) __THROW; +void res_npquery (const res_state, const u_char *, int, FILE *) + __THROW; +const char * res_hostalias (const res_state, const char *, char *, size_t) + __THROW; +int res_nquery (res_state, const char *, int, int, u_char *, int) + __THROW; +int res_nsearch (res_state, const char *, int, int, u_char *, int) + __THROW; +int res_nquerydomain (res_state, const char *, const char *, int, + int, u_char *, int) __THROW; +int res_nmkquery (res_state, int, const char *, int, int, + const u_char *, int, const u_char *, u_char *, + int) __THROW; +int res_nsend (res_state, const u_char *, int, u_char *, int) + __THROW; +void res_nclose (res_state) __THROW; +__END_DECLS +#endif + +#endif /* !_RESOLV_H_ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth.h new file mode 100644 index 0000000..17eb59f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth.h @@ -0,0 +1,224 @@ +/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * auth.h, Authentication interface. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + * + * The data structures are completely opaque to the client. The client + * is required to pass a AUTH * to routines that create rpc + * "sessions". + */ + +#ifndef _RPC_AUTH_H + +#define _RPC_AUTH_H 1 +#ifdef _LIBC +/* Some adjustments to make the libc source from glibc + * compile more easily with uClibc... */ +#ifndef __FORCE_GLIBC +#define __FORCE_GLIBC +#endif +#ifndef _GNU_SOUCE +#define _GNU_SOUCE +#endif +#define _(X) X +#endif +#include +#include + +__BEGIN_DECLS + +#define MAX_AUTH_BYTES 400 +#define MAXNETNAMELEN 255 /* maximum length of network user's name */ + +/* + * Status returned from authentication check + */ +enum auth_stat { + AUTH_OK=0, + /* + * failed at remote end + */ + AUTH_BADCRED=1, /* bogus credentials (seal broken) */ + AUTH_REJECTEDCRED=2, /* client should begin new session */ + AUTH_BADVERF=3, /* bogus verifier (seal broken) */ + AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ + AUTH_TOOWEAK=5, /* rejected due to security reasons */ + /* + * failed locally + */ + AUTH_INVALIDRESP=6, /* bogus response verifier */ + AUTH_FAILED=7 /* some unknown reason */ +}; + +union des_block { + struct { + u_int32_t high; + u_int32_t low; + } key; + char c[8]; +}; +typedef union des_block des_block; +extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW; + +/* + * Authentication info. Opaque to client. + */ +struct opaque_auth { + enum_t oa_flavor; /* flavor of auth */ + caddr_t oa_base; /* address of more auth stuff */ + u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ +}; + +/* + * Auth handle, interface to client side authenticators. + */ +typedef struct AUTH AUTH; +struct AUTH { + struct opaque_auth ah_cred; + struct opaque_auth ah_verf; + union des_block ah_key; + struct auth_ops { + void (*ah_nextverf) (AUTH *); + int (*ah_marshal) (AUTH *, XDR *); /* nextverf & serialize */ + int (*ah_validate) (AUTH *, struct opaque_auth *); + /* validate verifier */ + int (*ah_refresh) (AUTH *); /* refresh credentials */ + void (*ah_destroy) (AUTH *); /* destroy this structure */ + } *ah_ops; + caddr_t ah_private; +}; + + +/* + * Authentication ops. + * The ops and the auth handle provide the interface to the authenticators. + * + * AUTH *auth; + * XDR *xdrs; + * struct opaque_auth verf; + */ +#define AUTH_NEXTVERF(auth) \ + ((*((auth)->ah_ops->ah_nextverf))(auth)) +#define auth_nextverf(auth) \ + ((*((auth)->ah_ops->ah_nextverf))(auth)) + +#define AUTH_MARSHALL(auth, xdrs) \ + ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) +#define auth_marshall(auth, xdrs) \ + ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) + +#define AUTH_VALIDATE(auth, verfp) \ + ((*((auth)->ah_ops->ah_validate))((auth), verfp)) +#define auth_validate(auth, verfp) \ + ((*((auth)->ah_ops->ah_validate))((auth), verfp)) + +#define AUTH_REFRESH(auth) \ + ((*((auth)->ah_ops->ah_refresh))(auth)) +#define auth_refresh(auth) \ + ((*((auth)->ah_ops->ah_refresh))(auth)) + +#define AUTH_DESTROY(auth) \ + ((*((auth)->ah_ops->ah_destroy))(auth)) +#define auth_destroy(auth) \ + ((*((auth)->ah_ops->ah_destroy))(auth)) + + +extern struct opaque_auth _null_auth; + + +/* + * These are the various implementations of client side authenticators. + */ + +/* + * Unix style authentication + * AUTH *authunix_create(machname, uid, gid, len, aup_gids) + * char *machname; + * int uid; + * int gid; + * int len; + * int *aup_gids; + */ +extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid, + int __len, __gid_t *__aup_gids); +extern AUTH *authunix_create_default (void); +extern AUTH *authnone_create (void) __THROW; +extern AUTH *authdes_create (const char *__servername, u_int __window, + struct sockaddr *__syncaddr, des_block *__ckey) + __THROW; +extern AUTH *authdes_pk_create (const char *, netobj *, u_int, + struct sockaddr *, des_block *) __THROW; + + +#define AUTH_NONE 0 /* no authentication */ +#define AUTH_NULL 0 /* backward compatibility */ +#define AUTH_SYS 1 /* unix style (uid, gids) */ +#define AUTH_UNIX AUTH_SYS +#define AUTH_SHORT 2 /* short hand unix style */ +#define AUTH_DES 3 /* des style (encrypted timestamps) */ +#define AUTH_DH AUTH_DES /* Diffie-Hellman (this is DES) */ +#define AUTH_KERB 4 /* kerberos style */ + +/* + * Netname manipulating functions + * + */ +extern int getnetname (char *) __THROW; +extern int host2netname (char *, __const char *, __const char *) __THROW; +extern int user2netname (char *, __const uid_t, __const char *) __THROW; +extern int netname2user (__const char *, uid_t *, gid_t *, int *, gid_t *) + __THROW; +extern int netname2host (__const char *, char *, __const int) __THROW; + +/* + * + * These routines interface to the keyserv daemon + * + */ +extern int key_decryptsession (char *, des_block *); +extern int key_decryptsession_pk (char *, netobj *, des_block *); +extern int key_encryptsession (char *, des_block *); +extern int key_encryptsession_pk (char *, netobj *, des_block *); +extern int key_gendes (des_block *); +extern int key_setsecret (char *); +extern int key_secretkey_is_set (void); +extern int key_get_conv (char *, des_block *); + +/* + * XDR an opaque authentication struct. + */ +extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *) __THROW; + +__END_DECLS + +#endif /* rpc/auth.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth_des.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth_des.h new file mode 100644 index 0000000..12ada84 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth_des.h @@ -0,0 +1,112 @@ +/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _RPC_AUTH_DES_H +#define _RPC_AUTH_DES_H 1 + +#include +#include + +__BEGIN_DECLS + +/* There are two kinds of "names": fullnames and nicknames */ +enum authdes_namekind + { + ADN_FULLNAME, + ADN_NICKNAME + }; + +/* A fullname contains the network name of the client, + a conversation key and the window */ +struct authdes_fullname + { + char *name; /* network name of client, up to MAXNETNAMELEN */ + des_block key; /* conversation key */ + uint32_t window; /* associated window */ + }; + +/* A credential */ +struct authdes_cred + { + enum authdes_namekind adc_namekind; + struct authdes_fullname adc_fullname; + uint32_t adc_nickname; + }; + +/* A timeval replacement for !32bit platforms */ +struct rpc_timeval + { + uint32_t tv_sec; /* Seconds. */ + uint32_t tv_usec; /* Microseconds. */ + }; + +/* A des authentication verifier */ +struct authdes_verf + { + union + { + struct rpc_timeval adv_ctime; /* clear time */ + des_block adv_xtime; /* crypt time */ + } + adv_time_u; + uint32_t adv_int_u; + }; + +/* des authentication verifier: client variety + + adv_timestamp is the current time. + adv_winverf is the credential window + 1. + Both are encrypted using the conversation key. */ +#define adv_timestamp adv_time_u.adv_ctime +#define adv_xtimestamp adv_time_u.adv_xtime +#define adv_winverf adv_int_u + +/* des authentication verifier: server variety + + adv_timeverf is the client's timestamp + client's window + adv_nickname is the server's nickname for the client. + adv_timeverf is encrypted using the conversation key. */ +#define adv_timeverf adv_time_u.adv_ctime +#define adv_xtimeverf adv_time_u.adv_xtime +#define adv_nickname adv_int_u + +/* Map a des credential into a unix cred. */ +extern int authdes_getucred (__const struct authdes_cred * __adc, + uid_t * __uid, gid_t * __gid, + short *__grouplen, gid_t * __groups) __THROW; + +/* Get the public key for NAME and place it in KEY. NAME can only be + up to MAXNETNAMELEN bytes long and the destination buffer KEY should + have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */ +extern int getpublickey (__const char *__name, char *__key) __THROW; + +/* Get the secret key for NAME and place it in KEY. PASSWD is used to + decrypt the encrypted key stored in the database. NAME can only be + up to MAXNETNAMELEN bytes long and the destination buffer KEY + should have HEXKEYBYTES + 1 bytes long to fit all characters from + the key. */ +extern int getsecretkey (__const char *__name, char *__key, + __const char *__passwd) __THROW; + +extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep, + struct rpc_timeval *__timeout) __THROW; + +__END_DECLS + + +#endif /* rpc/auth_des.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth_unix.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth_unix.h new file mode 100644 index 0000000..424661d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/auth_unix.h @@ -0,0 +1,90 @@ +/* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)auth_unix.h 1.5 86/07/16 SMI */ + +/* + * auth_unix.h, Protocol for UNIX style authentication parameters for RPC + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* + * The system is very weak. The client uses no encryption for it + * credentials and only sends null verifiers. The server sends backs + * null verifiers or optionally a verifier that suggests a new short hand + * for the credentials. + */ + +#ifndef _RPC_AUTH_UNIX_H +#define _RPC_AUTH_UNIX_H 1 + +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +/* The machine name is part of a credential; it may not exceed 255 bytes */ +#define MAX_MACHINE_NAME 255 + +/* gids compose part of a credential; there may not be more than 16 of them */ +#define NGRPS 16 + +/* + * Unix style credentials. + */ +struct authunix_parms + { + u_long aup_time; + char *aup_machname; + __uid_t aup_uid; + __gid_t aup_gid; + u_int aup_len; + __gid_t *aup_gids; + }; + +extern bool_t xdr_authunix_parms (XDR *__xdrs, struct authunix_parms *__p) + __THROW; + +/* + * If a response verifier has flavor AUTH_SHORT, + * then the body of the response verifier encapsulates the following structure; + * again it is serialized in the obvious fashion. + */ +struct short_hand_verf + { + struct opaque_auth new_cred; + }; + +__END_DECLS + +#endif /* rpc/auth_unix.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/clnt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/clnt.h new file mode 100644 index 0000000..cf271c5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/clnt.h @@ -0,0 +1,421 @@ +/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * clnt.h - Client side remote procedure call interface. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_CLNT_H +#define _RPC_CLNT_H 1 + +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +/* + * Rpc calls return an enum clnt_stat. This should be looked at more, + * since each implementation is required to live with this (implementation + * independent) list of errors. + */ +enum clnt_stat { + RPC_SUCCESS=0, /* call succeeded */ + /* + * local errors + */ + RPC_CANTENCODEARGS=1, /* can't encode arguments */ + RPC_CANTDECODERES=2, /* can't decode results */ + RPC_CANTSEND=3, /* failure in sending call */ + RPC_CANTRECV=4, /* failure in receiving result */ + RPC_TIMEDOUT=5, /* call timed out */ + /* + * remote errors + */ + RPC_VERSMISMATCH=6, /* rpc versions not compatible */ + RPC_AUTHERROR=7, /* authentication error */ + RPC_PROGUNAVAIL=8, /* program not available */ + RPC_PROGVERSMISMATCH=9, /* program version mismatched */ + RPC_PROCUNAVAIL=10, /* procedure unavailable */ + RPC_CANTDECODEARGS=11, /* decode arguments error */ + RPC_SYSTEMERROR=12, /* generic "other problem" */ + RPC_NOBROADCAST = 21, /* Broadcasting not supported */ + /* + * callrpc & clnt_create errors + */ + RPC_UNKNOWNHOST=13, /* unknown host name */ + RPC_UNKNOWNPROTO=17, /* unknown protocol */ + RPC_UNKNOWNADDR = 19, /* Remote address unknown */ + + /* + * rpcbind errors + */ + RPC_RPCBFAILURE=14, /* portmapper failed in its call */ +#define RPC_PMAPFAILURE RPC_RPCBFAILURE + RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ + RPC_N2AXLATEFAILURE = 22, /* Name to addr translation failed */ + /* + * unspecified error + */ + RPC_FAILED=16, + RPC_INTR=18, + RPC_TLIERROR=20, + RPC_UDERROR=23, + /* + * asynchronous errors + */ + RPC_INPROGRESS = 24, + RPC_STALERACHANDLE = 25 +}; + + +/* + * Error info. + */ +struct rpc_err { + enum clnt_stat re_status; + union { + int RE_errno; /* related system error */ + enum auth_stat RE_why; /* why the auth error occurred */ + struct { + u_long low; /* lowest verion supported */ + u_long high; /* highest verion supported */ + } RE_vers; + struct { /* maybe meaningful if RPC_FAILED */ + long s1; + long s2; + } RE_lb; /* life boot & debugging only */ + } ru; +#define re_errno ru.RE_errno +#define re_why ru.RE_why +#define re_vers ru.RE_vers +#define re_lb ru.RE_lb +}; + + +/* + * Client rpc handle. + * Created by individual implementations, see e.g. rpc_udp.c. + * Client is responsible for initializing auth, see e.g. auth_none.c. + */ +typedef struct CLIENT CLIENT; +struct CLIENT { + AUTH *cl_auth; /* authenticator */ + struct clnt_ops { + enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t, + caddr_t, struct timeval); + /* call remote procedure */ + void (*cl_abort) (void); /* abort a call */ + void (*cl_geterr) (CLIENT *, struct rpc_err *); + /* get specific error code */ + bool_t (*cl_freeres) (CLIENT *, xdrproc_t, caddr_t); + /* frees results */ + void (*cl_destroy) (CLIENT *); /* destroy this structure */ + bool_t (*cl_control) (CLIENT *, int, char *); + /* the ioctl() of rpc */ + } *cl_ops; + caddr_t cl_private; /* private stuff */ +}; + + +/* + * client side rpc interface ops + * + * Parameter types are: + * + */ + +/* + * enum clnt_stat + * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) + * CLIENT *rh; + * u_long proc; + * xdrproc_t xargs; + * caddr_t argsp; + * xdrproc_t xres; + * caddr_t resp; + * struct timeval timeout; + */ +#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) +#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) + +/* + * void + * CLNT_ABORT(rh); + * CLIENT *rh; + */ +#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) +#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) + +/* + * struct rpc_err + * CLNT_GETERR(rh); + * CLIENT *rh; + */ +#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) +#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) + + +/* + * bool_t + * CLNT_FREERES(rh, xres, resp); + * CLIENT *rh; + * xdrproc_t xres; + * caddr_t resp; + */ +#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) +#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) + +/* + * bool_t + * CLNT_CONTROL(cl, request, info) + * CLIENT *cl; + * u_int request; + * char *info; + */ +#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) +#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) + +/* + * control operations that apply to all transports + * + * Note: options marked XXX are no-ops in this implementation of RPC. + * The are present in TI-RPC but can't be implemented here since they + * depend on the presence of STREAMS/TLI, which we don't have. + */ +#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ +#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ +#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ +#define CLGET_FD 6 /* get connections file descriptor */ +#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) XXX */ +#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ +#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy*/ +#define CLGET_XID 10 /* Get xid */ +#define CLSET_XID 11 /* Set xid */ +#define CLGET_VERS 12 /* Get version number */ +#define CLSET_VERS 13 /* Set version number */ +#define CLGET_PROG 14 /* Get program number */ +#define CLSET_PROG 15 /* Set program number */ +#define CLSET_SVC_ADDR 16 /* get server's address (netbuf) XXX */ +#define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */ +#define CLSET_POP_TIMOD 18 /* pop timod XXX */ +/* + * Connectionless only control operations + */ +#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ +#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ + +/* + * void + * CLNT_DESTROY(rh); + * CLIENT *rh; + */ +#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) +#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) + + +/* + * RPCTEST is a test program which is accessible on every rpc + * transport/port. It is used for testing, performance evaluation, + * and network administration. + */ + +#define RPCTEST_PROGRAM ((u_long)1) +#define RPCTEST_VERSION ((u_long)1) +#define RPCTEST_NULL_PROC ((u_long)2) +#define RPCTEST_NULL_BATCH_PROC ((u_long)3) + +/* + * By convention, procedure 0 takes null arguments and returns them + */ + +#define NULLPROC ((u_long)0) + +/* + * Below are the client handle creation routines for the various + * implementations of client side rpc. They can return NULL if a + * creation failure occurs. + */ + +/* + * Memory based rpc (for speed check and testing) + * CLIENT * + * clntraw_create(prog, vers) + * u_long prog; + * u_long vers; + */ +extern CLIENT *clntraw_create (__const u_long __prog, __const u_long __vers) + __THROW; + + +/* + * Generic client creation routine. Supported protocols are "udp", "tcp" and + * "unix" + * CLIENT * + * clnt_create(host, prog, vers, prot) + * char *host; -- hostname + * u_long prog; -- program number + * u_ong vers; -- version number + * char *prot; -- protocol + */ +extern CLIENT *clnt_create (__const char *__host, __const u_long __prog, + __const u_long __vers, __const char *__prot) + __THROW; + + +/* + * TCP based rpc + * CLIENT * + * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) + * struct sockaddr_in *raddr; + * u_long prog; + * u_long version; + * register int *sockp; + * u_int sendsz; + * u_int recvsz; + */ +extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog, + u_long __version, int *__sockp, u_int __sendsz, + u_int __recvsz) __THROW; + +/* + * UDP based rpc. + * CLIENT * + * clntudp_create(raddr, program, version, wait, sockp) + * struct sockaddr_in *raddr; + * u_long program; + * u_long version; + * struct timeval wait_resend; + * int *sockp; + * + * Same as above, but you specify max packet sizes. + * CLIENT * + * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) + * struct sockaddr_in *raddr; + * u_long program; + * u_long version; + * struct timeval wait_resend; + * int *sockp; + * u_int sendsz; + * u_int recvsz; + */ +extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, u_long __program, + u_long __version, struct timeval __wait_resend, + int *__sockp) __THROW; +extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr, + u_long __program, u_long __version, + struct timeval __wait_resend, int *__sockp, + u_int __sendsz, u_int __recvsz) __THROW; + + + + +/* + * AF_UNIX based rpc + * CLIENT * + * clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz) + * struct sockaddr_un *raddr; + * u_long prog; + * u_long version; + * register int *sockp; + * u_int sendsz; + * u_int recvsz; + */ +extern CLIENT *clntunix_create (struct sockaddr_un *__raddr, u_long __program, + u_long __version, int *__sockp, + u_int __sendsz, u_int __recvsz) __THROW; + + +extern int callrpc (__const char *__host, __const u_long __prognum, + __const u_long __versnum, __const u_long __procnum, + __const xdrproc_t __inproc, __const char *__in, + __const xdrproc_t __outproc, char *__out) __THROW; +extern int _rpc_dtablesize (void) __THROW; + +/* + * Print why creation failed + */ +extern void clnt_pcreateerror (__const char *__msg); /* stderr */ +extern char *clnt_spcreateerror(__const char *__msg) __THROW; /* string */ + +/* + * Like clnt_perror(), but is more verbose in its output + */ +extern void clnt_perrno (enum clnt_stat __num); /* stderr */ + +/* + * Print an English error message, given the client error code + */ +extern void clnt_perror (CLIENT *__clnt, __const char *__msg); + /* stderr */ +extern char *clnt_sperror (CLIENT *__clnt, __const char *__msg) __THROW; + /* string */ + +/* + * If a creation fails, the following allows the user to figure out why. + */ +struct rpc_createerr { + enum clnt_stat cf_stat; + struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ +}; + +extern struct rpc_createerr rpc_createerr; + + + +/* + * Copy error message to buffer. + */ +extern char *clnt_sperrno (enum clnt_stat __num) __THROW; /* string */ + +/* + * get the port number on the host for the rpc program,version and proto + */ +extern int getrpcport (__const char * __host, u_long __prognum, + u_long __versnum, u_int proto) __THROW; + +/* + * get the local host's IP address without consulting + * name service library functions + */ +extern void get_myaddress (struct sockaddr_in *) __THROW; + +#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ +#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ + +__END_DECLS + +#endif /* rpc/clnt.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/des_crypt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/des_crypt.h new file mode 100644 index 0000000..6a65887 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/des_crypt.h @@ -0,0 +1,97 @@ +/* + * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI + * + * des_crypt.h, des library routine interface + * Copyright (C) 1986, Sun Microsystems, Inc. + */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +#ifndef __DES_CRYPT_H__ +#define __DES_CRYPT_H__ 1 + +#include + +__BEGIN_DECLS + +#define DES_MAXDATA 8192 /* max bytes encrypted in one call */ +#define DES_DIRMASK (1 << 0) +#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */ +#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */ + + +#define DES_DEVMASK (1 << 1) +#define DES_HW (0*DES_DEVMASK) /* Use hardware device */ +#define DES_SW (1*DES_DEVMASK) /* Use software device */ + + +#define DESERR_NONE 0 /* succeeded */ +#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */ +#define DESERR_HWERROR 2 /* failed, hardware/driver error */ +#define DESERR_BADPARAM 3 /* failed, bad parameter to call */ + +#define DES_FAILED(err) \ + ((err) > DESERR_NOHWDEVICE) + +/* + * cbc_crypt() + * ecb_crypt() + * + * Encrypt (or decrypt) len bytes of a buffer buf. + * The length must be a multiple of eight. + * The key should have odd parity in the low bit of each byte. + * ivec is the input vector, and is updated to the new one (cbc only). + * The mode is created by oring together the appropriate parameters. + * DESERR_NOHWDEVICE is returned if DES_HW was specified but + * there was no hardware to do it on (the data will still be + * encrypted though, in software). + */ + + +/* + * Cipher Block Chaining mode + */ +extern int cbc_crypt (char *__key, char *__buf, unsigned __len, + unsigned __mode, char *__ivec) __THROW; + +/* + * Electronic Code Book mode + */ +extern int ecb_crypt (char *__key, char *__buf, unsigned __len, + unsigned __mode) __THROW; + +/* + * Set des parity for a key. + * DES parity is odd and in the low bit of each byte + */ +extern void des_setparity (char *__key) __THROW; + +__END_DECLS + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/key_prot.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/key_prot.h new file mode 100644 index 0000000..3e2eb72 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/key_prot.h @@ -0,0 +1,346 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _KEY_PROT_H_RPCGEN +#define _KEY_PROT_H_RPCGEN + +#include + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +#if 0 +#pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI" +#endif +/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ + +/* + * Compiled from key_prot.x using rpcgen. + * DO NOT EDIT THIS FILE! + * This is NOT source code! + */ +#define PROOT 3 +#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b" +#define HEXKEYBYTES 48 +#define KEYSIZE 192 +#define KEYBYTES 24 +#define KEYCHECKSUMSIZE 16 + +enum keystatus { + KEY_SUCCESS = 0, + KEY_NOSECRET = 1, + KEY_UNKNOWN = 2, + KEY_SYSTEMERR = 3, +}; +typedef enum keystatus keystatus; +#ifdef __cplusplus +extern "C" bool_t xdr_keystatus(XDR *, keystatus*); +#elif __STDC__ +extern bool_t xdr_keystatus(XDR *, keystatus*); +#else /* Old Style C */ +bool_t xdr_keystatus(); +#endif /* Old Style C */ + + +typedef char keybuf[HEXKEYBYTES]; +#ifdef __cplusplus +extern "C" bool_t xdr_keybuf(XDR *, keybuf); +#elif __STDC__ +extern bool_t xdr_keybuf(XDR *, keybuf); +#else /* Old Style C */ +bool_t xdr_keybuf(); +#endif /* Old Style C */ + + +typedef char *netnamestr; +#ifdef __cplusplus +extern "C" bool_t xdr_netnamestr(XDR *, netnamestr*); +#elif __STDC__ +extern bool_t xdr_netnamestr(XDR *, netnamestr*); +#else /* Old Style C */ +bool_t xdr_netnamestr(); +#endif /* Old Style C */ + + +struct cryptkeyarg { + netnamestr remotename; + des_block deskey; +}; +typedef struct cryptkeyarg cryptkeyarg; +#ifdef __cplusplus +extern "C" bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*); +#elif __STDC__ +extern bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*); +#else /* Old Style C */ +bool_t xdr_cryptkeyarg(); +#endif /* Old Style C */ + + +struct cryptkeyarg2 { + netnamestr remotename; + netobj remotekey; + des_block deskey; +}; +typedef struct cryptkeyarg2 cryptkeyarg2; +#ifdef __cplusplus +extern "C" bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*); +#elif __STDC__ +extern bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*); +#else /* Old Style C */ +bool_t xdr_cryptkeyarg2(); +#endif /* Old Style C */ + + +struct cryptkeyres { + keystatus status; + union { + des_block deskey; + } cryptkeyres_u; +}; +typedef struct cryptkeyres cryptkeyres; +#ifdef __cplusplus +extern "C" bool_t xdr_cryptkeyres(XDR *, cryptkeyres*); +#elif __STDC__ +extern bool_t xdr_cryptkeyres(XDR *, cryptkeyres*); +#else /* Old Style C */ +bool_t xdr_cryptkeyres(); +#endif /* Old Style C */ + +#define MAXGIDS 16 + +struct unixcred { + u_int uid; + u_int gid; + struct { + u_int gids_len; + u_int *gids_val; + } gids; +}; +typedef struct unixcred unixcred; +#ifdef __cplusplus +extern "C" bool_t xdr_unixcred(XDR *, unixcred*); +#elif __STDC__ +extern bool_t xdr_unixcred(XDR *, unixcred*); +#else /* Old Style C */ +bool_t xdr_unixcred(); +#endif /* Old Style C */ + + +struct getcredres { + keystatus status; + union { + unixcred cred; + } getcredres_u; +}; +typedef struct getcredres getcredres; +#ifdef __cplusplus +extern "C" bool_t xdr_getcredres(XDR *, getcredres*); +#elif __STDC__ +extern bool_t xdr_getcredres(XDR *, getcredres*); +#else /* Old Style C */ +bool_t xdr_getcredres(); +#endif /* Old Style C */ + + +struct key_netstarg { + keybuf st_priv_key; + keybuf st_pub_key; + netnamestr st_netname; +}; +typedef struct key_netstarg key_netstarg; +#ifdef __cplusplus +extern "C" bool_t xdr_key_netstarg(XDR *, key_netstarg*); +#elif __STDC__ +extern bool_t xdr_key_netstarg(XDR *, key_netstarg*); +#else /* Old Style C */ +bool_t xdr_key_netstarg(); +#endif /* Old Style C */ + + +struct key_netstres { + keystatus status; + union { + key_netstarg knet; + } key_netstres_u; +}; +typedef struct key_netstres key_netstres; +#ifdef __cplusplus +extern "C" bool_t xdr_key_netstres(XDR *, key_netstres*); +#elif __STDC__ +extern bool_t xdr_key_netstres(XDR *, key_netstres*); +#else /* Old Style C */ +bool_t xdr_key_netstres(); +#endif /* Old Style C */ + + +#ifndef opaque +#define opaque char +#endif + + +#define KEY_PROG ((u_long)100029) +#define KEY_VERS ((u_long)1) + +#ifdef __cplusplus +#define KEY_SET ((u_long)1) +extern "C" keystatus * key_set_1(opaque *, CLIENT *); +extern "C" keystatus * key_set_1_svc(opaque *, struct svc_req *); +#define KEY_ENCRYPT ((u_long)2) +extern "C" cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *); +extern "C" cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *); +#define KEY_DECRYPT ((u_long)3) +extern "C" cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *); +extern "C" cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *); +#define KEY_GEN ((u_long)4) +extern "C" des_block * key_gen_1(void *, CLIENT *); +extern "C" des_block * key_gen_1_svc(void *, struct svc_req *); +#define KEY_GETCRED ((u_long)5) +extern "C" getcredres * key_getcred_1(netnamestr *, CLIENT *); +extern "C" getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *); + +#elif __STDC__ +#define KEY_SET ((u_long)1) +extern keystatus * key_set_1(opaque *, CLIENT *); +extern keystatus * key_set_1_svc(opaque *, struct svc_req *); +#define KEY_ENCRYPT ((u_long)2) +extern cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *); +extern cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *); +#define KEY_DECRYPT ((u_long)3) +extern cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *); +extern cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *); +#define KEY_GEN ((u_long)4) +extern des_block * key_gen_1(void *, CLIENT *); +extern des_block * key_gen_1_svc(void *, struct svc_req *); +#define KEY_GETCRED ((u_long)5) +extern getcredres * key_getcred_1(netnamestr *, CLIENT *); +extern getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *); + +#else /* Old Style C */ +#define KEY_SET ((u_long)1) +extern keystatus * key_set_1(); +extern keystatus * key_set_1_svc(); +#define KEY_ENCRYPT ((u_long)2) +extern cryptkeyres * key_encrypt_1(); +extern cryptkeyres * key_encrypt_1_svc(); +#define KEY_DECRYPT ((u_long)3) +extern cryptkeyres * key_decrypt_1(); +extern cryptkeyres * key_decrypt_1_svc(); +#define KEY_GEN ((u_long)4) +extern des_block * key_gen_1(); +extern des_block * key_gen_1_svc(); +#define KEY_GETCRED ((u_long)5) +extern getcredres * key_getcred_1(); +extern getcredres * key_getcred_1_svc(); +#endif /* Old Style C */ +#define KEY_VERS2 ((u_long)2) + +#ifdef __cplusplus +extern "C" keystatus * key_set_2(opaque *, CLIENT *); +extern "C" keystatus * key_set_2_svc(opaque *, struct svc_req *); +extern "C" cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *); +extern "C" cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *); +extern "C" cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *); +extern "C" cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *); +extern "C" des_block * key_gen_2(void *, CLIENT *); +extern "C" des_block * key_gen_2_svc(void *, struct svc_req *); +extern "C" getcredres * key_getcred_2(netnamestr *, CLIENT *); +extern "C" getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *); +#define KEY_ENCRYPT_PK ((u_long)6) +extern "C" cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *); +extern "C" cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); +#define KEY_DECRYPT_PK ((u_long)7) +extern "C" cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *); +extern "C" cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); +#define KEY_NET_PUT ((u_long)8) +extern "C" keystatus * key_net_put_2(key_netstarg *, CLIENT *); +extern "C" keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *); +#define KEY_NET_GET ((u_long)9) +extern "C" key_netstres * key_net_get_2(void *, CLIENT *); +extern "C" key_netstres * key_net_get_2_svc(void *, struct svc_req *); +#define KEY_GET_CONV ((u_long)10) +extern "C" cryptkeyres * key_get_conv_2(opaque *, CLIENT *); +extern "C" cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *); + +#elif __STDC__ +extern keystatus * key_set_2(opaque *, CLIENT *); +extern keystatus * key_set_2_svc(opaque *, struct svc_req *); +extern cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *); +extern cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *); +extern cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *); +extern cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *); +extern des_block * key_gen_2(void *, CLIENT *); +extern des_block * key_gen_2_svc(void *, struct svc_req *); +extern getcredres * key_getcred_2(netnamestr *, CLIENT *); +extern getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *); +#define KEY_ENCRYPT_PK ((u_long)6) +extern cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *); +extern cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); +#define KEY_DECRYPT_PK ((u_long)7) +extern cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *); +extern cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); +#define KEY_NET_PUT ((u_long)8) +extern keystatus * key_net_put_2(key_netstarg *, CLIENT *); +extern keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *); +#define KEY_NET_GET ((u_long)9) +extern key_netstres * key_net_get_2(void *, CLIENT *); +extern key_netstres * key_net_get_2_svc(void *, struct svc_req *); +#define KEY_GET_CONV ((u_long)10) +extern cryptkeyres * key_get_conv_2(opaque *, CLIENT *); +extern cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *); + +#else /* Old Style C */ +extern keystatus * key_set_2(); +extern keystatus * key_set_2_svc(); +extern cryptkeyres * key_encrypt_2(); +extern cryptkeyres * key_encrypt_2_svc(); +extern cryptkeyres * key_decrypt_2(); +extern cryptkeyres * key_decrypt_2_svc(); +extern des_block * key_gen_2(); +extern des_block * key_gen_2_svc(); +extern getcredres * key_getcred_2(); +extern getcredres * key_getcred_2_svc(); +#define KEY_ENCRYPT_PK ((u_long)6) +extern cryptkeyres * key_encrypt_pk_2(); +extern cryptkeyres * key_encrypt_pk_2_svc(); +#define KEY_DECRYPT_PK ((u_long)7) +extern cryptkeyres * key_decrypt_pk_2(); +extern cryptkeyres * key_decrypt_pk_2_svc(); +#define KEY_NET_PUT ((u_long)8) +extern keystatus * key_net_put_2(); +extern keystatus * key_net_put_2_svc(); +#define KEY_NET_GET ((u_long)9) +extern key_netstres * key_net_get_2(); +extern key_netstres * key_net_get_2_svc(); +#define KEY_GET_CONV ((u_long)10) +extern cryptkeyres * key_get_conv_2(); +extern cryptkeyres * key_get_conv_2_svc(); +#endif /* Old Style C */ + +#endif /* !_KEY_PROT_H_RPCGEN */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/netdb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/netdb.h new file mode 100644 index 0000000..8671737 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/netdb.h @@ -0,0 +1,74 @@ +/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)rpc.h 1.8 87/07/24 SMI */ + +/* Cleaned up for GNU C library roland@gnu.ai.mit.edu: + added multiple inclusion protection and use of . + In GNU this file is #include'd by . */ + +#ifndef _RPC_NETDB_H +#define _RPC_NETDB_H 1 + +#include + +#define __need_size_t +#include + +__BEGIN_DECLS + +struct rpcent +{ + char *r_name; /* Name of server for this rpc program. */ + char **r_aliases; /* Alias list. */ + int r_number; /* RPC program number. */ +}; + +extern void setrpcent (int __stayopen) __THROW; +extern void endrpcent (void) __THROW; +extern struct rpcent *getrpcbyname (__const char *__name) __THROW; +extern struct rpcent *getrpcbynumber (int __number) __THROW; +extern struct rpcent *getrpcent (void) __THROW; + +#if defined __USE_MISC && defined __UCLIBC_HAS_REENTRANT_RPC__ +extern int getrpcbyname_r (__const char *__name, struct rpcent *__result_buf, + char *__buffer, size_t __buflen, + struct rpcent **__result) __THROW; + +extern int getrpcbynumber_r (int __number, struct rpcent *__result_buf, + char *__buffer, size_t __buflen, + struct rpcent **__result) __THROW; + +extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer, + size_t __buflen, struct rpcent **__result) __THROW; +#endif + +__END_DECLS + +#endif /* rpc/netdb.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_clnt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_clnt.h new file mode 100644 index 0000000..1b1c452 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_clnt.h @@ -0,0 +1,98 @@ +/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * pmap_clnt.h + * Supplies C routines to get to portmap services. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_PMAP_CLNT_H +#define _RPC_PMAP_CLNT_H 1 + +#include +#include +#include +#include + +__BEGIN_DECLS + +typedef bool_t (*resultproc_t) (caddr_t resp, struct sockaddr_in *raddr); + +/* + * Usage: + * success = pmap_set(program, version, protocol, port); + * success = pmap_unset(program, version); + * port = pmap_getport(address, program, version, protocol); + * head = pmap_getmaps(address); + * clnt_stat = pmap_rmtcall(address, program, version, procedure, + * xdrargs, argsp, xdrres, resp, tout, port_ptr) + * (works for udp only.) + * clnt_stat = clnt_broadcast(program, version, procedure, + * xdrargs, argsp, xdrres, resp, eachresult) + * (like pmap_rmtcall, except the call is broadcasted to all + * locally connected nets. For each valid response received, + * the procedure eachresult is called. Its form is: + * done = eachresult(resp, raddr) + * bool_t done; + * caddr_t resp; + * struct sockaddr_in raddr; + * where resp points to the results of the call and raddr is the + * address if the responder to the broadcast. + */ + +extern bool_t pmap_set (__const u_long __program, __const u_long __vers, + int __protocol, u_short __port) __THROW; +extern bool_t pmap_unset (__const u_long __program, __const u_long __vers) + __THROW; +extern struct pmaplist *pmap_getmaps (struct sockaddr_in *__address) __THROW; +extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *__addr, + __const u_long __prog, + __const u_long __vers, + __const u_long __proc, + xdrproc_t __xdrargs, + caddr_t __argsp, xdrproc_t __xdrres, + caddr_t __resp, struct timeval __tout, + u_long *__port_ptr) __THROW; +extern enum clnt_stat clnt_broadcast (__const u_long __prog, + __const u_long __vers, + __const u_long __proc, xdrproc_t __xargs, + caddr_t __argsp, xdrproc_t __xresults, + caddr_t __resultsp, + resultproc_t __eachresult) __THROW; +extern u_short pmap_getport (struct sockaddr_in *__address, + __const u_long __program, + __const u_long __version, u_int __protocol) + __THROW; + +__END_DECLS + +#endif /* rpc/pmap_clnt.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_prot.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_prot.h new file mode 100644 index 0000000..cd64e36 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_prot.h @@ -0,0 +1,108 @@ +/* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * pmap_prot.h + * Protocol for the local binder service, or pmap. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_PMAP_PROT_H +#define _RPC_PMAP_PROT_H 1 + +#include + +#include + +__BEGIN_DECLS + +/* The following procedures are supported by the protocol: + * + * PMAPPROC_NULL() returns () + * takes nothing, returns nothing + * + * PMAPPROC_SET(struct pmap) returns (bool_t) + * TRUE is success, FALSE is failure. Registers the tuple + * [prog, vers, prot, port]. + * + * PMAPPROC_UNSET(struct pmap) returns (bool_t) + * TRUE is success, FALSE is failure. Un-registers pair + * [prog, vers]. prot and port are ignored. + * + * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). + * 0 is failure. Otherwise returns the port number where the pair + * [prog, vers] is registered. It may lie! + * + * PMAPPROC_DUMP() RETURNS (struct pmaplist *) + * + * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) + * RETURNS (port, string<>); + * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); + * Calls the procedure on the local machine. If it is not registered, + * this procedure is quite; ie it does not return error information!!! + * This procedure only is supported on rpc/udp and calls via + * rpc/udp. This routine only passes null authentication parameters. + * This file has no interface to xdr routines for PMAPPROC_CALLIT. + * + * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. + */ + +#define PMAPPORT ((u_short)111) +#define PMAPPROG ((u_long)100000) +#define PMAPVERS ((u_long)2) +#define PMAPVERS_PROTO ((u_long)2) +#define PMAPVERS_ORIG ((u_long)1) +#define PMAPPROC_NULL ((u_long)0) +#define PMAPPROC_SET ((u_long)1) +#define PMAPPROC_UNSET ((u_long)2) +#define PMAPPROC_GETPORT ((u_long)3) +#define PMAPPROC_DUMP ((u_long)4) +#define PMAPPROC_CALLIT ((u_long)5) + +struct pmap { + long unsigned pm_prog; + long unsigned pm_vers; + long unsigned pm_prot; + long unsigned pm_port; +}; + +extern bool_t xdr_pmap (XDR *__xdrs, struct pmap *__regs) __THROW; + +struct pmaplist { + struct pmap pml_map; + struct pmaplist *pml_next; +}; + +extern bool_t xdr_pmaplist (XDR *__xdrs, struct pmaplist **__rp) __THROW; + +__END_DECLS + +#endif /* rpc/pmap_prot.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_rmt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_rmt.h new file mode 100644 index 0000000..7a38b5f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/pmap_rmt.h @@ -0,0 +1,68 @@ +/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * Structures and XDR routines for parameters to and replies from + * the portmapper remote-call-service. + * + * Copyright (C) 1986, Sun Microsystems, Inc. + */ + +#ifndef _RPC_PMAP_RMT_H +#define _RPC_PMAP_RMT_H 1 + +#include +#include +#include +#include + +__BEGIN_DECLS + +struct rmtcallargs { + u_long prog, vers, proc, arglen; + caddr_t args_ptr; + xdrproc_t xdr_args; +}; + +extern bool_t xdr_rmtcall_args (XDR *__xdrs, struct rmtcallargs *__crp) + __THROW; + +struct rmtcallres { + u_long *port_ptr; + u_long resultslen; + caddr_t results_ptr; + xdrproc_t xdr_results; +}; + +extern bool_t xdr_rmtcallres (XDR *__xdrs, struct rmtcallres *__crp) __THROW; + +__END_DECLS + +#endif /* rpc/pmap_rmt.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc.h new file mode 100644 index 0000000..9236e72 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc.h @@ -0,0 +1,110 @@ +/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * rpc.h, Just includes the billions of rpc header files necessary to + * do remote procedure calling. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_RPC_H +#define _RPC_RPC_H 1 + +#ifdef _LIBC +/* Some adjustments to make the libc source from glibc + * compile more easily with uClibc... */ +#ifndef __FORCE_GLIBC +#define __FORCE_GLIBC +#endif +#ifndef _GNU_SOUCE +#define _GNU_SOUCE +#endif +#define _(X) X +#include +#endif + +#include /* some typedefs */ +#include + +/* external data representation interfaces */ +#include /* generic (de)serializer */ + +/* Client side only authentication */ +#include /* generic authenticator (client side) */ + +/* Client side (mostly) remote procedure call */ +#include /* generic rpc stuff */ + +/* semi-private protocol headers */ +#include /* protocol for rpc messages */ +#include /* protocol for unix style cred */ +#include /* protocol for des style cred */ + +/* Server side only remote procedure callee */ +#include /* service manager and multiplexer */ +#include /* service side authenticator */ + +/* + * COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION + * OF UNIX BASED ON NFSSRC. These systems will already have the structures + * defined by included in . + */ +/* routines for parsing /etc/rpc */ +#include /* structures and routines to parse /etc/rpc */ + +__BEGIN_DECLS + +/* Global variables, protected for multi-threaded applications. */ +extern fd_set *__rpc_thread_svc_fdset (void) __attribute__ ((__const__)); +#define svc_fdset (*__rpc_thread_svc_fdset ()) + +extern struct rpc_createerr *__rpc_thread_createerr (void) + __attribute__ ((__const__)); +#define get_rpc_createerr() (*__rpc_thread_createerr ()) +/* The people who "engineered" RPC should bee punished for naming the + data structure and the variable the same. We cannot always define the + macro 'rpc_createerr' because this would prevent people from defining + object of type 'struct rpc_createerr'. So we leave it up to the user + to select transparent replacement also of this variable. */ +#ifdef _RPC_MT_VARS +# define rpc_createerr (*__rpc_thread_createerr ()) +#endif + +extern struct pollfd **__rpc_thread_svc_pollfd (void) + __attribute__ ((__const__)); +#define svc_pollfd (*__rpc_thread_svc_pollfd ()) + +extern int *__rpc_thread_svc_max_pollfd (void) __attribute__ ((__const__)); +#define svc_max_pollfd (*__rpc_thread_svc_max_pollfd ()) + +__END_DECLS + +#endif /* rpc/rpc.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc_des.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc_des.h new file mode 100644 index 0000000..0f36d16 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc_des.h @@ -0,0 +1,72 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * Generic DES driver interface + * Keep this file hardware independent! + * Copyright (c) 1986 by Sun Microsystems, Inc. + */ + +#ifndef _DES_H +#define _DES_H + +#include + +#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */ +#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */ + +enum desdir + { + ENCRYPT, DECRYPT + }; +enum desmode + { + CBC, ECB + }; + +/* + * parameters to ioctl call + */ +struct desparams + { + u_char des_key[8]; /* key (with low bit parity) */ + enum desdir des_dir; /* direction */ + enum desmode des_mode; /* mode */ + u_char des_ivec[8]; /* input vector */ + unsigned des_len; /* number of bytes to crypt */ + union + { + u_char UDES_data[DES_QUICKLEN]; + u_char *UDES_buf; + } + UDES; +#define des_data UDES.UDES_data /* direct data here if quick */ +#define des_buf UDES.UDES_buf /* otherwise, pointer to data */ + }; + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc_msg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc_msg.h new file mode 100644 index 0000000..636d60e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/rpc_msg.h @@ -0,0 +1,202 @@ +/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)rpc_msg.h 1.7 86/07/16 SMI */ + +#ifndef _RPC_MSG_H +#define _RPC_MSG_H 1 + +#include + +#include +#include + +/* + * rpc_msg.h + * rpc message definition + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#define RPC_MSG_VERSION ((u_long) 2) +#define RPC_SERVICE_PORT ((u_short) 2048) + +__BEGIN_DECLS + +/* + * Bottom up definition of an rpc message. + * NOTE: call and reply use the same overall struct but + * different parts of unions within it. + */ + +enum msg_type { + CALL=0, + REPLY=1 +}; + +enum reply_stat { + MSG_ACCEPTED=0, + MSG_DENIED=1 +}; + +enum accept_stat { + SUCCESS=0, + PROG_UNAVAIL=1, + PROG_MISMATCH=2, + PROC_UNAVAIL=3, + GARBAGE_ARGS=4, + SYSTEM_ERR=5 +}; + +enum reject_stat { + RPC_MISMATCH=0, + AUTH_ERROR=1 +}; + +/* + * Reply part of an rpc exchange + */ + +/* + * Reply to an rpc request that was accepted by the server. + * Note: there could be an error even though the request was + * accepted. + */ +struct accepted_reply { + struct opaque_auth ar_verf; + enum accept_stat ar_stat; + union { + struct { + u_long low; + u_long high; + } AR_versions; + struct { + caddr_t where; + xdrproc_t proc; + } AR_results; + /* and many other null cases */ + } ru; +#define ar_results ru.AR_results +#define ar_vers ru.AR_versions +}; + +/* + * Reply to an rpc request that was rejected by the server. + */ +struct rejected_reply { + enum reject_stat rj_stat; + union { + struct { + u_long low; + u_long high; + } RJ_versions; + enum auth_stat RJ_why; /* why authentication did not work */ + } ru; +#define rj_vers ru.RJ_versions +#define rj_why ru.RJ_why +}; + +/* + * Body of a reply to an rpc request. + */ +struct reply_body { + enum reply_stat rp_stat; + union { + struct accepted_reply RP_ar; + struct rejected_reply RP_dr; + } ru; +#define rp_acpt ru.RP_ar +#define rp_rjct ru.RP_dr +}; + +/* + * Body of an rpc request call. + */ +struct call_body { + u_long cb_rpcvers; /* must be equal to two */ + u_long cb_prog; + u_long cb_vers; + u_long cb_proc; + struct opaque_auth cb_cred; + struct opaque_auth cb_verf; /* protocol specific - provided by client */ +}; + +/* + * The rpc message + */ +struct rpc_msg { + u_long rm_xid; + enum msg_type rm_direction; + union { + struct call_body RM_cmb; + struct reply_body RM_rmb; + } ru; +#define rm_call ru.RM_cmb +#define rm_reply ru.RM_rmb +}; +#define acpted_rply ru.RM_rmb.ru.RP_ar +#define rjcted_rply ru.RM_rmb.ru.RP_dr + + +/* + * XDR routine to handle a rpc message. + * xdr_callmsg(xdrs, cmsg) + * XDR *xdrs; + * struct rpc_msg *cmsg; + */ +extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW; + +/* + * XDR routine to pre-serialize the static part of a rpc message. + * xdr_callhdr(xdrs, cmsg) + * XDR *xdrs; + * struct rpc_msg *cmsg; + */ +extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW; + +/* + * XDR routine to handle a rpc reply. + * xdr_replymsg(xdrs, rmsg) + * XDR *xdrs; + * struct rpc_msg *rmsg; + */ +extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW; + +/* + * Fills in the error part of a reply message. + * _seterr_reply(msg, error) + * struct rpc_msg *msg; + * struct rpc_err *error; + */ +extern void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error) + __THROW; + +__END_DECLS + +#endif /* rpc/rpc_msg.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/svc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/svc.h new file mode 100644 index 0000000..3ffca50 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/svc.h @@ -0,0 +1,316 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * svc.h, Server-side remote procedure call interface. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_SVC_H +#define _RPC_SVC_H 1 + +#include +#include + +__BEGIN_DECLS + +/* + * This interface must manage two items concerning remote procedure calling: + * + * 1) An arbitrary number of transport connections upon which rpc requests + * are received. The two most notable transports are TCP and UDP; they are + * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; + * they in turn call xprt_register and xprt_unregister. + * + * 2) An arbitrary number of locally registered services. Services are + * described by the following four data: program number, version number, + * "service dispatch" function, a transport handle, and a boolean that + * indicates whether or not the exported program should be registered with a + * local binder service; if true the program's number and version and the + * port number from the transport handle are registered with the binder. + * These data are registered with the rpc svc system via svc_register. + * + * A service's dispatch function is called whenever an rpc request comes in + * on a transport. The request's program and version numbers must match + * those of the registered service. The dispatch function is passed two + * parameters, struct svc_req * and SVCXPRT *, defined below. + */ + +enum xprt_stat { + XPRT_DIED, + XPRT_MOREREQS, + XPRT_IDLE +}; + +/* + * Server side transport handle + */ +typedef struct SVCXPRT SVCXPRT; +struct SVCXPRT { + int xp_sock; + u_short xp_port; /* associated port number */ + const struct xp_ops { + bool_t (*xp_recv) (SVCXPRT *__xprt, struct rpc_msg *__msg); + /* receive incoming requests */ + enum xprt_stat (*xp_stat) (SVCXPRT *__xprt); + /* get transport status */ + bool_t (*xp_getargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args, + caddr_t args_ptr); /* get arguments */ + bool_t (*xp_reply) (SVCXPRT *__xprt, struct rpc_msg *__msg); + /* send reply */ + bool_t (*xp_freeargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args, + caddr_t args_ptr); + /* free mem allocated for args */ + void (*xp_destroy) (SVCXPRT *__xprt); + /* destroy this struct */ + } *xp_ops; + int xp_addrlen; /* length of remote address */ + struct sockaddr_in xp_raddr; /* remote address */ + struct opaque_auth xp_verf; /* raw response verifier */ + caddr_t xp_p1; /* private */ + caddr_t xp_p2; /* private */ + char xp_pad [256]; /* padding, internal use */ +}; + +/* + * Approved way of getting address of caller + */ +#define svc_getcaller(x) (&(x)->xp_raddr) + +/* + * Operations defined on an SVCXPRT handle + * + * SVCXPRT *xprt; + * struct rpc_msg *msg; + * xdrproc_t xargs; + * caddr_t argsp; + */ +#define SVC_RECV(xprt, msg) \ + (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) +#define svc_recv(xprt, msg) \ + (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) + +#define SVC_STAT(xprt) \ + (*(xprt)->xp_ops->xp_stat)(xprt) +#define svc_stat(xprt) \ + (*(xprt)->xp_ops->xp_stat)(xprt) + +#define SVC_GETARGS(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) +#define svc_getargs(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) + +#define SVC_REPLY(xprt, msg) \ + (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) +#define svc_reply(xprt, msg) \ + (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) + +#define SVC_FREEARGS(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) +#define svc_freeargs(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) + +#define SVC_DESTROY(xprt) \ + (*(xprt)->xp_ops->xp_destroy)(xprt) +#define svc_destroy(xprt) \ + (*(xprt)->xp_ops->xp_destroy)(xprt) + + +/* + * Service request + */ +struct svc_req { + rpcprog_t rq_prog; /* service program number */ + rpcvers_t rq_vers; /* service protocol version */ + rpcproc_t rq_proc; /* the desired procedure */ + struct opaque_auth rq_cred; /* raw creds from the wire */ + caddr_t rq_clntcred; /* read only cooked cred */ + SVCXPRT *rq_xprt; /* associated transport */ +}; + +#ifndef __DISPATCH_FN_T +#define __DISPATCH_FN_T +typedef void (*__dispatch_fn_t) (struct svc_req*, SVCXPRT*); +#endif + +/* + * Service registration + * + * svc_register(xprt, prog, vers, dispatch, protocol) + * SVCXPRT *xprt; + * rpcprog_t prog; + * rpcvers_t vers; + * void (*dispatch)(struct svc_req*, SVCXPRT*); + * rpcprot_t protocol; like TCP or UDP, zero means do not register + */ +extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog, + rpcvers_t __vers, __dispatch_fn_t __dispatch, + rpcprot_t __protocol) __THROW; + +/* + * Service un-registration + * + * svc_unregister(prog, vers) + * rpcprog_t prog; + * rpcvers_t vers; + */ +extern void svc_unregister (rpcprog_t __prog, rpcvers_t __vers) __THROW; + +/* + * Transport registration. + * + * xprt_register(xprt) + * SVCXPRT *xprt; + */ +extern void xprt_register (SVCXPRT *__xprt) __THROW; + +/* + * Transport un-register + * + * xprt_unregister(xprt) + * SVCXPRT *xprt; + */ +extern void xprt_unregister (SVCXPRT *__xprt) __THROW; + + +/* + * When the service routine is called, it must first check to see if it + * knows about the procedure; if not, it should call svcerr_noproc + * and return. If so, it should deserialize its arguments via + * SVC_GETARGS (defined above). If the deserialization does not work, + * svcerr_decode should be called followed by a return. Successful + * decoding of the arguments should be followed the execution of the + * procedure's code and a call to svc_sendreply. + * + * Also, if the service refuses to execute the procedure due to too- + * weak authentication parameters, svcerr_weakauth should be called. + * Note: do not confuse access-control failure with weak authentication! + * + * NB: In pure implementations of rpc, the caller always waits for a reply + * msg. This message is sent when svc_sendreply is called. + * Therefore pure service implementations should always call + * svc_sendreply even if the function logically returns void; use + * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows + * for the abuse of pure rpc via batched calling or pipelining. In the + * case of a batched call, svc_sendreply should NOT be called since + * this would send a return message, which is what batching tries to avoid. + * It is the service/protocol writer's responsibility to know which calls are + * batched and which are not. Warning: responding to batch calls may + * deadlock the caller and server processes! + */ + +extern bool_t svc_sendreply (SVCXPRT *xprt, xdrproc_t __xdr_results, + caddr_t __xdr_location) __THROW; + +extern void svcerr_decode (SVCXPRT *__xprt) __THROW; + +extern void svcerr_weakauth (SVCXPRT *__xprt) __THROW; + +extern void svcerr_noproc (SVCXPRT *__xprt) __THROW; + +extern void svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers, + rpcvers_t __high_vers) __THROW; + +extern void svcerr_auth (SVCXPRT *__xprt, enum auth_stat __why) __THROW; + +extern void svcerr_noprog (SVCXPRT *__xprt) __THROW; + +extern void svcerr_systemerr (SVCXPRT *__xprt) __THROW; + +/* + * Lowest level dispatching -OR- who owns this process anyway. + * Somebody has to wait for incoming requests and then call the correct + * service routine. The routine svc_run does infinite waiting; i.e., + * svc_run never returns. + * Since another (coexistent) package may wish to selectively wait for + * incoming calls or other events outside of the rpc architecture, the + * routine svc_getreq is provided. It must be passed readfds, the + * "in-place" results of a select system call (see select, section 2). + */ + +/* + * Global keeper of rpc service descriptors in use + * dynamic; must be inspected before each call to select + */ + +extern struct pollfd *svc_pollfd; +extern int svc_max_pollfd; +extern fd_set svc_fdset; +#define svc_fds svc_fdset.fds_bits[0] /* compatibility */ + +/* + * a small program implemented by the svc_rpc implementation itself; + * also see clnt.h for protocol numbers. + */ +extern void svc_getreq (int __rdfds) __THROW; +extern void svc_getreq_common (const int __fd) __THROW; +extern void svc_getreqset (fd_set *__readfds) __THROW; +extern void svc_getreq_poll (struct pollfd *, const int) __THROW; +extern void svc_exit (void) __THROW; +extern void svc_run (void) __THROW; + +/* + * Socket to use on svcxxx_create call to get default socket + */ +#define RPC_ANYSOCK -1 + +/* + * These are the existing service side transport implementations + */ + +/* + * Memory based rpc for testing and timing. + */ +extern SVCXPRT *svcraw_create (void) __THROW; + +/* + * Udp based rpc. + */ +extern SVCXPRT *svcudp_create (int __sock) __THROW; +extern SVCXPRT *svcudp_bufcreate (int __sock, u_int __sendsz, u_int __recvsz) + __THROW; + +/* + * Tcp based rpc. + */ +extern SVCXPRT *svctcp_create (int __sock, u_int __sendsize, u_int __recvsize) + __THROW; + + +/* + * Unix based rpc. + */ +extern SVCXPRT *svcunix_create (int __sock, u_int __sendsize, u_int __recvsize, + char *__path) __THROW; + + +__END_DECLS + +#endif /* rpc/svc.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/svc_auth.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/svc_auth.h new file mode 100644 index 0000000..1c1a715 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/svc_auth.h @@ -0,0 +1,54 @@ +/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)svc_auth.h 1.6 86/07/16 SMI */ + +/* + * svc_auth.h, Service side of rpc authentication. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_SVC_AUTH_H +#define _RPC_SVC_AUTH_H 1 + +#include +#include + +__BEGIN_DECLS + +/* + * Server side authenticator + */ +extern enum auth_stat _authenticate (struct svc_req *__rqst, + struct rpc_msg *__msg) __THROW; + +__END_DECLS + +#endif /* rpc/svc_auth.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/types.h new file mode 100644 index 0000000..469576e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/types.h @@ -0,0 +1,108 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* fixincludes should not add extern "C" to this file */ +/* + * Rpc additions to + */ +#ifndef _RPC_TYPES_H +#define _RPC_TYPES_H 1 + +#ifdef _LIBC +/* Some adjustments to make the libc source from glibc + * compile more easily with uClibc... */ +#ifndef __FORCE_GLIBC +#define __FORCE_GLIBC +#endif +#ifndef _GNU_SOUCE +#define _GNU_SOUCE +#endif +#define _(X) X +#endif +#include + +typedef int bool_t; +typedef int enum_t; +/* This needs to be changed to uint32_t in the future */ +typedef unsigned long rpcprog_t; +typedef unsigned long rpcvers_t; +typedef unsigned long rpcproc_t; +typedef unsigned long rpcprot_t; +typedef unsigned long rpcport_t; + +#define __dontcare__ -1 + +#ifndef FALSE +# define FALSE (0) +#endif + +#ifndef TRUE +# define TRUE (1) +#endif + +#ifndef NULL +# define NULL 0 +#endif + +#include /* For malloc decl. */ +#define mem_alloc(bsize) malloc(bsize) +#define mem_free(ptr, bsize) free(ptr) + +#ifndef makedev /* ie, we haven't already included it */ +#include +#endif + +#ifndef __u_char_defined +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; +# define __u_char_defined +#endif +#ifndef __daddr_t_defined +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; +# define __daddr_t_defined +#endif + +#include +#include + +#include + +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK (u_long)0x7F000001 +#endif +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + +#endif /* rpc/types.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/xdr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/xdr.h new file mode 100644 index 0000000..25dd214 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/rpc/xdr.h @@ -0,0 +1,385 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * xdr.h, External Data Representation Serialization Routines. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +#ifndef _RPC_XDR_H +#define _RPC_XDR_H 1 + +#ifdef _LIBC +/* Some adjustments to make the libc source from glibc + * compile more easily with uClibc... */ +# ifndef __FORCE_GLIBC +# define __FORCE_GLIBC +# endif +# define _(X) X +#endif +#include +#include +#include + +/* We need FILE. */ +#include + +__BEGIN_DECLS + +/* + * XDR provides a conventional way for converting between C data + * types and an external bit-string representation. Library supplied + * routines provide for the conversion on built-in C data types. These + * routines and utility routines defined here are used to help implement + * a type encode/decode routine for each user-defined type. + * + * Each data type provides a single procedure which takes two arguments: + * + * bool_t + * xdrproc(xdrs, argresp) + * XDR *xdrs; + * *argresp; + * + * xdrs is an instance of a XDR handle, to which or from which the data + * type is to be converted. argresp is a pointer to the structure to be + * converted. The XDR handle contains an operation field which indicates + * which of the operations (ENCODE, DECODE * or FREE) is to be performed. + * + * XDR_DECODE may allocate space if the pointer argresp is null. This + * data can be freed with the XDR_FREE operation. + * + * We write only one procedure per data type to make it easy + * to keep the encode and decode procedures for a data type consistent. + * In many cases the same code performs all operations on a user defined type, + * because all the hard work is done in the component type routines. + * decode as a series of calls on the nested data types. + */ + +/* + * Xdr operations. XDR_ENCODE causes the type to be encoded into the + * stream. XDR_DECODE causes the type to be extracted from the stream. + * XDR_FREE can be used to release the space allocated by an XDR_DECODE + * request. + */ +enum xdr_op { + XDR_ENCODE = 0, + XDR_DECODE = 1, + XDR_FREE = 2 +}; + +/* + * This is the number of bytes per unit of external data. + */ +#define BYTES_PER_XDR_UNIT (4) +/* + * This only works if the above is a power of 2. But it's defined to be + * 4 by the appropriate RFCs. So it will work. And it's normally quicker + * than the old routine. + */ +#if 1 +#define RNDUP(x) (((x) + BYTES_PER_XDR_UNIT - 1) & ~(BYTES_PER_XDR_UNIT - 1)) +#else /* this is the old routine */ +#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ + * BYTES_PER_XDR_UNIT) +#endif + +/* + * The XDR handle. + * Contains operation which is being applied to the stream, + * an operations vector for the particular implementation (e.g. see xdr_mem.c), + * and two private fields for the use of the particular implementation. + */ +typedef struct XDR XDR; +struct XDR + { + enum xdr_op x_op; /* operation; fast additional param */ + struct xdr_ops + { + bool_t (*x_getlong) (XDR *__xdrs, long *__lp); + /* get a long from underlying stream */ + bool_t (*x_putlong) (XDR *__xdrs, __const long *__lp); + /* put a long to " */ + bool_t (*x_getbytes) (XDR *__xdrs, caddr_t __addr, u_int __len); + /* get some bytes from " */ + bool_t (*x_putbytes) (XDR *__xdrs, __const char *__addr, u_int __len); + /* put some bytes to " */ + u_int (*x_getpostn) (__const XDR *__xdrs); + /* returns bytes off from beginning */ + bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos); + /* lets you reposition the stream */ + int32_t *(*x_inline) (XDR *__xdrs, u_int __len); + /* buf quick ptr to buffered data */ + void (*x_destroy) (XDR *__xdrs); + /* free privates of this xdr_stream */ + bool_t (*x_getint32) (XDR *__xdrs, int32_t *__ip); + /* get a int from underlying stream */ + bool_t (*x_putint32) (XDR *__xdrs, __const int32_t *__ip); + /* put a int to " */ + } + *x_ops; + caddr_t x_public; /* users' data */ + caddr_t x_private; /* pointer to private data */ + caddr_t x_base; /* private used for position info */ + u_int x_handy; /* extra private word */ + }; + +/* + * A xdrproc_t exists for each data type which is to be encoded or decoded. + * + * The second argument to the xdrproc_t is a pointer to an opaque pointer. + * The opaque pointer generally points to a structure of the data type + * to be decoded. If this pointer is 0, then the type routines should + * allocate dynamic storage of the appropriate size and return it. + * bool_t (*xdrproc_t)(XDR *, caddr_t *); + */ +typedef bool_t (*xdrproc_t) (XDR *, void *,...); + + +/* + * Operations defined on a XDR handle + * + * XDR *xdrs; + * int32_t *int32p; + * long *longp; + * caddr_t addr; + * u_int len; + * u_int pos; + */ +#define XDR_GETINT32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) +#define xdr_getint32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) + +#define XDR_PUTINT32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) +#define xdr_putint32(xdrs, int32p) \ + (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) + +#define XDR_GETLONG(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlong)(xdrs, longp) +#define xdr_getlong(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlong)(xdrs, longp) + +#define XDR_PUTLONG(xdrs, longp) \ + (*(xdrs)->x_ops->x_putlong)(xdrs, longp) +#define xdr_putlong(xdrs, longp) \ + (*(xdrs)->x_ops->x_putlong)(xdrs, longp) + +#define XDR_GETBYTES(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) +#define xdr_getbytes(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) + +#define XDR_PUTBYTES(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) +#define xdr_putbytes(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) + +#define XDR_GETPOS(xdrs) \ + (*(xdrs)->x_ops->x_getpostn)(xdrs) +#define xdr_getpos(xdrs) \ + (*(xdrs)->x_ops->x_getpostn)(xdrs) + +#define XDR_SETPOS(xdrs, pos) \ + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) +#define xdr_setpos(xdrs, pos) \ + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) + +#define XDR_INLINE(xdrs, len) \ + (*(xdrs)->x_ops->x_inline)(xdrs, len) +#define xdr_inline(xdrs, len) \ + (*(xdrs)->x_ops->x_inline)(xdrs, len) + +#define XDR_DESTROY(xdrs) \ + do { \ + if ((xdrs)->x_ops->x_destroy) \ + (*(xdrs)->x_ops->x_destroy)(xdrs); \ + } while (0) +#define xdr_destroy(xdrs) \ + do { \ + if ((xdrs)->x_ops->x_destroy) \ + (*(xdrs)->x_ops->x_destroy)(xdrs); \ + } while (0) + +/* + * Support struct for discriminated unions. + * You create an array of xdrdiscrim structures, terminated with + * a entry with a null procedure pointer. The xdr_union routine gets + * the discriminant value and then searches the array of structures + * for a matching value. If a match is found the associated xdr routine + * is called to handle that part of the union. If there is + * no match, then a default routine may be called. + * If there is no match and no default routine it is an error. + */ +#define NULL_xdrproc_t ((xdrproc_t)0) +struct xdr_discrim +{ + int value; + xdrproc_t proc; +}; + +/* + * Inline routines for fast encode/decode of primitive data types. + * Caveat emptor: these use single memory cycles to get the + * data from the underlying buffer, and will fail to operate + * properly if the data is not aligned. The standard way to use these + * is to say: + * if ((buf = XDR_INLINE(xdrs, count)) == NULL) + * return (FALSE); + * <<< macro calls >>> + * where ``count'' is the number of bytes of data occupied + * by the primitive data types. + * + * N.B. and frozen for all time: each data type here uses 4 bytes + * of external representation. + */ + +#define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++)) +#define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)(v))) +#define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf)) +#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32(buf, (int32_t)(v)) + +/* WARNING: The IXDR_*_LONG defines are removed by Sun for new platforms + * and shouldn't be used any longer. Code which use this defines or longs + * in the RPC code will not work on 64bit Solaris platforms ! + */ +#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf)) +#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v))) +#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) +#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v)) + + +#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) +#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) +#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) +#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) + +#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG(buf, (long)(v)) +#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG(buf, (long)(v)) +#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v)) +#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v)) + +/* + * These are the "generic" xdr routines. + * None of these can have const applied because it's not possible to + * know whether the call is a read or a write to the passed parameter + * also, the XDR structure is always updated by some of these calls. + */ +extern bool_t xdr_void (void) __THROW; +extern bool_t xdr_short (XDR *__xdrs, short *__sp) __THROW; +extern bool_t xdr_u_short (XDR *__xdrs, u_short *__usp) __THROW; +extern bool_t xdr_int (XDR *__xdrs, int *__ip) __THROW; +extern bool_t xdr_u_int (XDR *__xdrs, u_int *__up) __THROW; +extern bool_t xdr_long (XDR *__xdrs, long *__lp) __THROW; +extern bool_t xdr_u_long (XDR *__xdrs, u_long *__ulp) __THROW; +extern bool_t xdr_hyper (XDR *__xdrs, quad_t *__llp) __THROW; +extern bool_t xdr_u_hyper (XDR *__xdrs, u_quad_t *__ullp) __THROW; +extern bool_t xdr_longlong_t (XDR *__xdrs, quad_t *__llp) __THROW; +extern bool_t xdr_u_longlong_t (XDR *__xdrs, u_quad_t *__ullp) __THROW; +extern bool_t xdr_int8_t (XDR *__xdrs, int8_t *__ip) __THROW; +extern bool_t xdr_uint8_t (XDR *__xdrs, uint8_t *__up) __THROW; +extern bool_t xdr_int16_t (XDR *__xdrs, int16_t *__ip) __THROW; +extern bool_t xdr_uint16_t (XDR *__xdrs, uint16_t *__up) __THROW; +extern bool_t xdr_int32_t (XDR *__xdrs, int32_t *__ip) __THROW; +extern bool_t xdr_uint32_t (XDR *__xdrs, uint32_t *__up) __THROW; +extern bool_t xdr_int64_t (XDR *__xdrs, int64_t *__ip) __THROW; +extern bool_t xdr_uint64_t (XDR *__xdrs, uint64_t *__up) __THROW; +extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp) __THROW; +extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep) __THROW; +extern bool_t xdr_array (XDR * _xdrs, caddr_t *__addrp, u_int *__sizep, + u_int __maxsize, u_int __elsize, xdrproc_t __elproc) + __THROW; +extern bool_t xdr_bytes (XDR *__xdrs, char **__cpp, u_int *__sizep, + u_int __maxsize) __THROW; +extern bool_t xdr_opaque (XDR *__xdrs, caddr_t __cp, u_int __cnt) __THROW; +extern bool_t xdr_string (XDR *__xdrs, char **__cpp, u_int __maxsize) __THROW; +extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp, + __const struct xdr_discrim *__choices, + xdrproc_t dfault) __THROW; +extern bool_t xdr_char (XDR *__xdrs, char *__cp) __THROW; +extern bool_t xdr_u_char (XDR *__xdrs, u_char *__cp) __THROW; +extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem, + u_int __elemsize, xdrproc_t __xdr_elem) __THROW; +extern bool_t xdr_float (XDR *__xdrs, float *__fp) __THROW; +extern bool_t xdr_double (XDR *__xdrs, double *__dp) __THROW; +extern bool_t xdr_reference (XDR *__xdrs, caddr_t *__xpp, u_int __size, + xdrproc_t __proc) __THROW; +extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp, + u_int __obj_size, xdrproc_t __xdr_obj) __THROW; +extern bool_t xdr_wrapstring (XDR *__xdrs, char **__cpp) __THROW; +extern u_long xdr_sizeof (xdrproc_t, void *) __THROW; + +/* + * Common opaque bytes objects used by many rpc protocols; + * declared here due to commonality. + */ +#define MAX_NETOBJ_SZ 1024 +struct netobj +{ + u_int n_len; + char *n_bytes; +}; +typedef struct netobj netobj; +extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW; + +/* + * These are the public routines for the various implementations of + * xdr streams. + */ + +/* XDR using memory buffers */ +extern void xdrmem_create (XDR *__xdrs, __const caddr_t __addr, + u_int __size, enum xdr_op __xop) __THROW; + +/* XDR using stdio library */ +extern void xdrstdio_create (XDR *__xdrs, FILE *__file, enum xdr_op __xop) + __THROW; + +/* XDR pseudo records for tcp */ +extern void xdrrec_create (XDR *__xdrs, u_int __sendsize, + u_int __recvsize, caddr_t __tcp_handle, + int (*__readit) (char *, char *, int), + int (*__writeit) (char *, char *, int)) __THROW; + +/* make end of xdr record */ +extern bool_t xdrrec_endofrecord (XDR *__xdrs, bool_t __sendnow) __THROW; + +/* move to beginning of next record */ +extern bool_t xdrrec_skiprecord (XDR *__xdrs) __THROW; + +/* true if no more input */ +extern bool_t xdrrec_eof (XDR *__xdrs) __THROW; + +/* free memory buffers for xdr */ +extern void xdr_free (xdrproc_t __proc, char *__objp) __THROW; + +__END_DECLS + +#endif /* rpc/xdr.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sched.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sched.h new file mode 100644 index 0000000..7cfdbf1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sched.h @@ -0,0 +1,86 @@ +/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface. + Copyright (C) 1996,1997,1999,2001-2003,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SCHED_H +#define _SCHED_H 1 + +#include + +/* Get type definitions. */ +#include + +#define __need_timespec +#include + +/* Get system specific constant and data structure definitions. */ +#include +/* Define the real names for the elements of `struct sched_param'. */ +#define sched_priority __sched_priority + + +__BEGIN_DECLS + +/* Set scheduling parameters for a process. */ +extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param) + __THROW; + +/* Retrieve scheduling parameters for a particular process. */ +extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __THROW; + +/* Set scheduling algorithm and/or parameters for a process. */ +extern int sched_setscheduler (__pid_t __pid, int __policy, + __const struct sched_param *__param) __THROW; + +/* Retrieve scheduling algorithm for a particular purpose. */ +extern int sched_getscheduler (__pid_t __pid) __THROW; + +/* Yield the processor. */ +extern int sched_yield (void) __THROW; + +/* Get maximum priority value for a scheduler. */ +extern int sched_get_priority_max (int __algorithm) __THROW; + +/* Get minimum priority value for a scheduler. */ +extern int sched_get_priority_min (int __algorithm) __THROW; + +/* Get the SCHED_RR interval for the named process. */ +extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; + + +#ifdef __USE_GNU +/* Access macros for `cpu_set'. */ +#define CPU_SETSIZE __CPU_SETSIZE +#define CPU_SET(cpu, cpusetp) __CPU_SET (cpu, cpusetp) +#define CPU_CLR(cpu, cpusetp) __CPU_CLR (cpu, cpusetp) +#define CPU_ISSET(cpu, cpusetp) __CPU_ISSET (cpu, cpusetp) +#define CPU_ZERO(cpusetp) __CPU_ZERO (cpusetp) + + +/* Set the CPU affinity for a task */ +extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize, + __const cpu_set_t *__cpuset) __THROW; + +/* Get the CPU affinity for a task */ +extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize, + cpu_set_t *__cpuset) __THROW; +#endif + +__END_DECLS + +#endif /* sched.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/scsi.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/scsi.h new file mode 100644 index 0000000..49ab758 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/scsi.h @@ -0,0 +1,226 @@ +/* Copyright (C) 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * This header file contains public constants and structures used by + * the scsi code for linux. + */ + +#ifndef _SCSI_SCSI_H +#define _SCSI_SCSI_H 1 + +#include + +/* + * SCSI opcodes + */ + +#define TEST_UNIT_READY 0x00 +#define REZERO_UNIT 0x01 +#define REQUEST_SENSE 0x03 +#define FORMAT_UNIT 0x04 +#define READ_BLOCK_LIMITS 0x05 +#define REASSIGN_BLOCKS 0x07 +#define READ_6 0x08 +#define WRITE_6 0x0a +#define SEEK_6 0x0b +#define READ_REVERSE 0x0f +#define WRITE_FILEMARKS 0x10 +#define SPACE 0x11 +#define INQUIRY 0x12 +#define RECOVER_BUFFERED_DATA 0x14 +#define MODE_SELECT 0x15 +#define RESERVE 0x16 +#define RELEASE 0x17 +#define COPY 0x18 +#define ERASE 0x19 +#define MODE_SENSE 0x1a +#define START_STOP 0x1b +#define RECEIVE_DIAGNOSTIC 0x1c +#define SEND_DIAGNOSTIC 0x1d +#define ALLOW_MEDIUM_REMOVAL 0x1e + +#define SET_WINDOW 0x24 +#define READ_CAPACITY 0x25 +#define READ_10 0x28 +#define WRITE_10 0x2a +#define SEEK_10 0x2b +#define WRITE_VERIFY 0x2e +#define VERIFY 0x2f +#define SEARCH_HIGH 0x30 +#define SEARCH_EQUAL 0x31 +#define SEARCH_LOW 0x32 +#define SET_LIMITS 0x33 +#define PRE_FETCH 0x34 +#define READ_POSITION 0x34 +#define SYNCHRONIZE_CACHE 0x35 +#define LOCK_UNLOCK_CACHE 0x36 +#define READ_DEFECT_DATA 0x37 +#define MEDIUM_SCAN 0x38 +#define COMPARE 0x39 +#define COPY_VERIFY 0x3a +#define WRITE_BUFFER 0x3b +#define READ_BUFFER 0x3c +#define UPDATE_BLOCK 0x3d +#define READ_LONG 0x3e +#define WRITE_LONG 0x3f +#define CHANGE_DEFINITION 0x40 +#define WRITE_SAME 0x41 +#define READ_TOC 0x43 +#define LOG_SELECT 0x4c +#define LOG_SENSE 0x4d +#define MODE_SELECT_10 0x55 +#define RESERVE_10 0x56 +#define RELEASE_10 0x57 +#define MODE_SENSE_10 0x5a +#define PERSISTENT_RESERVE_IN 0x5e +#define PERSISTENT_RESERVE_OUT 0x5f +#define MOVE_MEDIUM 0xa5 +#define READ_12 0xa8 +#define WRITE_12 0xaa +#define WRITE_VERIFY_12 0xae +#define SEARCH_HIGH_12 0xb0 +#define SEARCH_EQUAL_12 0xb1 +#define SEARCH_LOW_12 0xb2 +#define READ_ELEMENT_STATUS 0xb8 +#define SEND_VOLUME_TAG 0xb6 +#define WRITE_LONG_2 0xea + +/* + * Status codes + */ + +#define GOOD 0x00 +#define CHECK_CONDITION 0x01 +#define CONDITION_GOOD 0x02 +#define BUSY 0x04 +#define INTERMEDIATE_GOOD 0x08 +#define INTERMEDIATE_C_GOOD 0x0a +#define RESERVATION_CONFLICT 0x0c +#define COMMAND_TERMINATED 0x11 +#define QUEUE_FULL 0x14 + +#define STATUS_MASK 0x3e + +/* + * SENSE KEYS + */ + +#define NO_SENSE 0x00 +#define RECOVERED_ERROR 0x01 +#define NOT_READY 0x02 +#define MEDIUM_ERROR 0x03 +#define HARDWARE_ERROR 0x04 +#define ILLEGAL_REQUEST 0x05 +#define UNIT_ATTENTION 0x06 +#define DATA_PROTECT 0x07 +#define BLANK_CHECK 0x08 +#define COPY_ABORTED 0x0a +#define ABORTED_COMMAND 0x0b +#define VOLUME_OVERFLOW 0x0d +#define MISCOMPARE 0x0e + + +/* + * DEVICE TYPES + */ + +#define TYPE_DISK 0x00 +#define TYPE_TAPE 0x01 +#define TYPE_PROCESSOR 0x03 /* HP scanners use this */ +#define TYPE_WORM 0x04 /* Treated as ROM by our system */ +#define TYPE_ROM 0x05 +#define TYPE_SCANNER 0x06 +#define TYPE_MOD 0x07 /* Magneto-optical disk - + * - treated as TYPE_DISK */ +#define TYPE_MEDIUM_CHANGER 0x08 +#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ +#define TYPE_NO_LUN 0x7f + +/* + * standard mode-select header prepended to all mode-select commands + * + * moved here from cdrom.h -- kraxel + */ + +struct ccs_modesel_head + { + unsigned char _r1; /* reserved. */ + unsigned char medium; /* device-specific medium type. */ + unsigned char _r2; /* reserved. */ + unsigned char block_desc_length; /* block descriptor length. */ + unsigned char density; /* device-specific density code. */ + unsigned char number_blocks_hi; /* number of blocks in this block + desc. */ + unsigned char number_blocks_med; + unsigned char number_blocks_lo; + unsigned char _r3; + unsigned char block_length_hi; /* block length for blocks in this + desc. */ + unsigned char block_length_med; + unsigned char block_length_lo; + }; + +/* + * MESSAGE CODES + */ + +#define COMMAND_COMPLETE 0x00 +#define EXTENDED_MESSAGE 0x01 +#define EXTENDED_MODIFY_DATA_POINTER 0x00 +#define EXTENDED_SDTR 0x01 +#define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */ +#define EXTENDED_WDTR 0x03 +#define SAVE_POINTERS 0x02 +#define RESTORE_POINTERS 0x03 +#define DISCONNECT 0x04 +#define INITIATOR_ERROR 0x05 +#define ABORT 0x06 +#define MESSAGE_REJECT 0x07 +#define NOP 0x08 +#define MSG_PARITY_ERROR 0x09 +#define LINKED_CMD_COMPLETE 0x0a +#define LINKED_FLG_CMD_COMPLETE 0x0b +#define BUS_DEVICE_RESET 0x0c + +#define INITIATE_RECOVERY 0x0f /* SCSI-II only */ +#define RELEASE_RECOVERY 0x10 /* SCSI-II only */ + +#define SIMPLE_QUEUE_TAG 0x20 +#define HEAD_OF_QUEUE_TAG 0x21 +#define ORDERED_QUEUE_TAG 0x22 + +/* + * Here are some scsi specific ioctl commands which are sometimes useful. + */ +/* These are a few other constants only used by scsi devices. */ + +#define SCSI_IOCTL_GET_IDLUN 0x5382 + +/* Used to turn on and off tagged queuing for scsi devices. */ + +#define SCSI_IOCTL_TAGGED_ENABLE 0x5383 +#define SCSI_IOCTL_TAGGED_DISABLE 0x5384 + +/* Used to obtain the host number of a device. */ +#define SCSI_IOCTL_PROBE_HOST 0x5385 + +/* Used to get the bus number for a device. */ +#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 + +#endif /* scsi/scsi.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/scsi_ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/scsi_ioctl.h new file mode 100644 index 0000000..11f0161 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/scsi_ioctl.h @@ -0,0 +1,34 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SCSI_IOCTL_H +#define _SCSI_IOCTL_H + +/* IOCTLs for SCSI. */ +#define SCSI_IOCTL_SEND_COMMAND 1 /* Send a command to the SCSI host. */ +#define SCSI_IOCTL_TEST_UNIT_READY 2 /* Test if unit is ready. */ +#define SCSI_IOCTL_BENCHMARK_COMMAND 3 +#define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters. */ +#define SCSI_IOCTL_START_UNIT 5 +#define SCSI_IOCTL_STOP_UNIT 6 +#define SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */ +#define SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */ + +#endif + + diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/sg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/sg.h new file mode 100644 index 0000000..b0dc0ad --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/scsi/sg.h @@ -0,0 +1,275 @@ +/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + History: + Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user + process control of SCSI devices. + Development Sponsored by Killy Corp. NY NY +*/ + +#ifndef _SCSI_SG_H +#define _SCSI_SG_H 1 + +#include + + +/* New interface introduced in the 3.x SG drivers follows */ + +/* Same structure as used by readv() Linux system call. It defines one + scatter-gather element. */ +typedef struct sg_iovec +{ + void * iov_base; /* Starting address */ + size_t iov_len; /* Length in bytes */ +} sg_iovec_t; + + +typedef struct sg_io_hdr +{ + int interface_id; /* [i] 'S' for SCSI generic (required) */ + int dxfer_direction; /* [i] data transfer direction */ + unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ + unsigned char mx_sb_len; /* [i] max length to write to sbp */ + unsigned short int iovec_count; /* [i] 0 implies no scatter gather */ + unsigned int dxfer_len; /* [i] byte count of data transfer */ + void * dxferp; /* [i], [*io] points to data transfer memory + or scatter gather list */ + unsigned char * cmdp; /* [i], [*i] points to command to perform */ + unsigned char * sbp; /* [i], [*o] points to sense_buffer memory */ + unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ + unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */ + int pack_id; /* [i->o] unused internally (normally) */ + void * usr_ptr; /* [i->o] unused internally */ + unsigned char status; /* [o] scsi status */ + unsigned char masked_status;/* [o] shifted, masked scsi status */ + unsigned char msg_status; /* [o] messaging level data (optional) */ + unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ + unsigned short int host_status; /* [o] errors from host adapter */ + unsigned short int driver_status;/* [o] errors from software driver */ + int resid; /* [o] dxfer_len - actual_transferred */ + unsigned int duration; /* [o] time taken by cmd (unit: millisec) */ + unsigned int info; /* [o] auxiliary information */ +} sg_io_hdr_t; + + +/* Use negative values to flag difference from original sg_header structure. */ +#define SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */ +#define SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */ +#define SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */ +#define SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the + additional property than during indirect + IO the user buffer is copied into the + kernel buffers before the transfer */ + + +/* following flag values can be "or"-ed together */ +#define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */ +#define SG_FLAG_LUN_INHIBIT 2 /* default is to put device's lun into */ + /* the 2nd byte of SCSI command */ +#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ + /* user space (debug indirect IO) */ + +/* The following 'info' values are "or"-ed together. */ +#define SG_INFO_OK_MASK 0x1 +#define SG_INFO_OK 0x0 /* no sense, host nor driver "noise" */ +#define SG_INFO_CHECK 0x1 /* something abnormal happened */ + +#define SG_INFO_DIRECT_IO_MASK 0x6 +#define SG_INFO_INDIRECT_IO 0x0 /* data xfer via kernel buffers (or no xfer) */ +#define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */ +#define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */ + + +/* Request information about a specific SG device, used by + SG_GET_SCSI_ID ioctl (). */ +struct sg_scsi_id { + /* Host number as in "scsi" where 'n' is one of 0, 1, 2 etc. */ + int host_no; + int channel; + /* SCSI id of target device. */ + int scsi_id; + int lun; + /* TYPE_... defined in . */ + int scsi_type; + /* Host (adapter) maximum commands per lun. */ + short int h_cmd_per_lun; + /* Device (or adapter) maximum queue length. */ + short int d_queue_depth; + /* Unused, set to 0 for now. */ + int unused[2]; +}; + +/* Used by SG_GET_REQUEST_TABLE ioctl(). */ +typedef struct sg_req_info { + char req_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */ + char orphan; /* 0 -> normal request, 1 -> from interruped SG_IO */ + char sg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */ + char problem; /* 0 -> no problem detected, 1 -> error to report */ + int pack_id; /* pack_id associated with request */ + void * usr_ptr; /* user provided pointer (in new interface) */ + unsigned int duration; /* millisecs elapsed since written (req_state==1) + or request duration (req_state==2) */ + int unused; +} sg_req_info_t; + + +/* IOCTLs: Those ioctls that are relevant to the SG 3.x drivers follow. + [Those that only apply to the SG 2.x drivers are at the end of the file.] + (_GET_s yield result via 'int *' 3rd argument unless otherwise indicated) */ + +#define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */ + +/* Used to configure SCSI command transformation layer for ATAPI devices */ +/* Only supported by the ide-scsi driver */ +#define SG_SET_TRANSFORM 0x2204 /* N.B. 3rd arg is not pointer but value: */ + /* 3rd arg = 0 to disable transform, 1 to enable it */ +#define SG_GET_TRANSFORM 0x2205 + +#define SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */ +#define SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */ + +/* The following ioctl has a 'sg_scsi_id_t *' object as its 3rd argument. */ +#define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */ +/* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */ + +/* Override host setting and always DMA using low memory ( <16MB on i386) */ +#define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */ +#define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */ + +/* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which + tries to fetch a packet with a matching pack_id, waits, or returns EAGAIN. + If pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0 + then pack_id ignored by read() and oldest readable fetched. */ +#define SG_SET_FORCE_PACK_ID 0x227b +#define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */ + +#define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */ + +/* Yields max scatter gather tablesize allowed by current host adapter */ +#define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */ + +#define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */ + +/* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */ +#define SG_SCSI_RESET 0x2284 +/* Associated values that can be given to SG_SCSI_RESET follow */ +#define SG_SCSI_RESET_NOTHING 0 +#define SG_SCSI_RESET_DEVICE 1 +#define SG_SCSI_RESET_BUS 2 +#define SG_SCSI_RESET_HOST 3 + +/* synchronous SCSI command ioctl, (only in version 3 interface) */ +#define SG_IO 0x2285 /* similar effect as write() followed by read() */ + +#define SG_GET_REQUEST_TABLE 0x2286 /* yields table of active requests */ + +/* How to treat EINTR during SG_IO ioctl(), only in SG 3.x series */ +#define SG_SET_KEEP_ORPHAN 0x2287 /* 1 -> hold for read(), 0 -> drop (def) */ +#define SG_GET_KEEP_ORPHAN 0x2288 + + +#define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ +/* Largest size (in bytes) a single scatter-gather list element can have. + The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on + i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported + by adapter then this value is the largest data block that can be + read/written by a single scsi command. The user can find the value of + PAGE_SIZE by calling getpagesize() defined in unistd.h . */ + +#define SG_DEFAULT_RETRIES 1 + +/* Defaults, commented if they differ from original sg driver */ +#define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */ +#define SG_DEF_FORCE_PACK_ID 0 +#define SG_DEF_KEEP_ORPHAN 0 +#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ /* load time option */ + +/* maximum outstanding requests, write() yields EDOM if exceeded */ +#define SG_MAX_QUEUE 16 + +#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE /* for backward compatibility */ + +/* Alternate style type names, "..._t" variants preferred */ +typedef struct sg_io_hdr Sg_io_hdr; +typedef struct sg_io_vec Sg_io_vec; +typedef struct sg_scsi_id Sg_scsi_id; +typedef struct sg_req_info Sg_req_info; + + +/* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ +/* The older SG interface based on the 'sg_header' structure follows. */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ + +#define SG_MAX_SENSE 16 /* this only applies to the sg_header interface */ + +struct sg_header + { + /* Length of incoming packet (including header). */ + int pack_len; + /* Maximal length of expected reply. */ + int reply_len; + /* Id number of packet. */ + int pack_id; + /* 0==ok, otherwise error number. */ + int result; + /* Force 12 byte command length for group 6 & 7 commands. */ + unsigned int twelve_byte:1; + /* SCSI status from target. */ + unsigned int target_status:5; + /* Host status (see "DID" codes). */ + unsigned int host_status:8; + /* Driver status+suggestion. */ + unsigned int driver_status:8; + /* Unused. */ + unsigned int other_flags:10; + /* Output in 3 cases: + when target_status is CHECK_CONDITION or + when target_status is COMMAND_TERMINATED or + when (driver_status & DRIVER_SENSE) is true. */ + unsigned char sense_buffer[SG_MAX_SENSE]; + }; + + +/* IOCTLs: The following are not required (or ignored) when the sg_io_hdr_t + interface is used. They are kept for backward compatibility with + the original and version 2 drivers. */ + +#define SG_SET_TIMEOUT 0x2201 /* Set timeout; *(int *)arg==timeout. */ +#define SG_GET_TIMEOUT 0x2202 /* Get timeout; return timeout. */ + +/* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q). */ +#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on). */ +#define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1. */ + +/* Turn on error sense trace (1..8), dump this device to log/console (9) + or dump all sg device states ( >9 ) to log/console. */ +#define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */ + +#define SG_NEXT_CMD_LEN 0x2283 /* Override SCSI command length with given + number on the next write() on this file + descriptor. */ + +/* Defaults, commented if they differ from original sg driver */ +#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ +#define SG_DEF_COMMAND_Q 0 /* command queuing is always on when + the new interface is used */ +#define SG_DEF_UNDERRUN_FLAG 0 + + +#endif /* scsi/sg.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/search.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/search.h new file mode 100644 index 0000000..2ffba69 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/search.h @@ -0,0 +1,175 @@ +/* Declarations for System V style searching functions. + Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SEARCH_H +#define _SEARCH_H 1 + +#include + +#define __need_size_t +#include + +__BEGIN_DECLS + +#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED +/* Prototype structure for a linked-list data structure. + This is the type used by the `insque' and `remque' functions. */ + +# ifdef __USE_GNU +struct qelem + { + struct qelem *q_forw; + struct qelem *q_back; + char q_data[1]; + }; +# endif + + +/* Insert ELEM into a doubly-linked list, after PREV. */ +extern void insque (void *__elem, void *__prev) __THROW; + +/* Unlink ELEM from the doubly-linked list that it is in. */ +extern void remque (void *__elem) __THROW; +#endif + + +/* For use with hsearch(3). */ +#ifndef __COMPAR_FN_T +# define __COMPAR_FN_T +typedef int (*__compar_fn_t) (__const void *, __const void *); + +# ifdef __USE_GNU +typedef __compar_fn_t comparison_fn_t; +# endif +#endif + +/* Action which shall be performed in the call the hsearch. */ +typedef enum + { + FIND, + ENTER + } +ACTION; + +typedef struct entry + { + char *key; + void *data; + } +ENTRY; + +/* Opaque type for internal use. */ +struct _ENTRY; + +/* Family of hash table handling functions. The functions also + have reentrant counterparts ending with _r. The non-reentrant + functions all work on a signle internal hashing table. */ + +/* Search for entry matching ITEM.key in internal hash table. If + ACTION is `FIND' return found entry or signal error by returning + NULL. If ACTION is `ENTER' replace existing data (if any) with + ITEM.data. */ +extern ENTRY *hsearch (ENTRY __item, ACTION __action) __THROW; + +/* Create a new hashing table which will at most contain NEL elements. */ +extern int hcreate (size_t __nel) __THROW; + +/* Destroy current internal hashing table. */ +extern void hdestroy (void) __THROW; + +#ifdef __USE_GNU +/* Data type for reentrant functions. */ +struct hsearch_data + { + struct _ENTRY *table; + unsigned int size; + unsigned int filled; + }; + +/* Reentrant versions which can handle multiple hashing tables at the + same time. */ +extern int hsearch_r (ENTRY __item, ACTION __action, ENTRY **__retval, + struct hsearch_data *__htab) __THROW; +extern int hcreate_r (size_t __nel, struct hsearch_data *__htab) __THROW; +extern void hdestroy_r (struct hsearch_data *__htab) __THROW; +#endif + + +/* The tsearch routines are very interesting. They make many + assumptions about the compiler. It assumes that the first field + in node must be the "key" field, which points to the datum. + Everything depends on that. */ +/* For tsearch */ +typedef enum +{ + preorder, + postorder, + endorder, + leaf +} +VISIT; + +/* Search for an entry matching the given KEY in the tree pointed to + by *ROOTP and insert a new element if not found. */ +extern void *tsearch (__const void *__key, void **__rootp, + __compar_fn_t __compar); + +/* Search for an entry matching the given KEY in the tree pointed to + by *ROOTP. If no matching entry is available return NULL. */ +extern void *tfind (__const void *__key, void *__const *__rootp, + __compar_fn_t __compar); + +/* Remove the element matching KEY from the tree pointed to by *ROOTP. */ +extern void *tdelete (__const void *__restrict __key, + void **__restrict __rootp, + __compar_fn_t __compar); + +#ifndef __ACTION_FN_T +# define __ACTION_FN_T +typedef void (*__action_fn_t) (__const void *__nodep, VISIT __value, + int __level); +#endif + +/* Walk through the whole tree and call the ACTION callback for every node + or leaf. */ +extern void twalk (__const void *__root, __action_fn_t __action); + +#ifdef __USE_GNU +/* Callback type for function to free a tree node. If the keys are atomic + data this function should do nothing. */ +typedef void (*__free_fn_t) (void *__nodep); + +/* Destroy the whole tree, call FREEFCT for each node or leaf. */ +extern void tdestroy (void *__root, __free_fn_t __freefct); +#endif + + +/* Perform linear search for KEY by comparing by COMPAR in an array + [BASE,BASE+NMEMB*SIZE). */ +extern void *lfind (__const void *__key, __const void *__base, + size_t *__nmemb, size_t __size, __compar_fn_t __compar); + +/* Perform linear search for KEY by comparing by COMPAR function in + array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ +extern void *lsearch (__const void *__key, void *__base, + size_t *__nmemb, size_t __size, __compar_fn_t __compar); + +__END_DECLS + +#endif /* search.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/semaphore.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/semaphore.h new file mode 100644 index 0000000..7b09ea9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/semaphore.h @@ -0,0 +1,87 @@ +/* Linuxthreads - a simple clone()-based implementation of Posix */ +/* threads for Linux. */ +/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */ +/* */ +/* This program is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public License */ +/* as published by the Free Software Foundation; either version 2 */ +/* of the License, or (at your option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Library General Public License for more details. */ + +#ifndef _SEMAPHORE_H +#define _SEMAPHORE_H 1 + +#include +#include +#ifdef __USE_XOPEN2K +# define __need_timespec +# include +#endif + +#ifndef _PTHREAD_DESCR_DEFINED +/* Thread descriptors. Needed for `sem_t' definition. */ +typedef struct _pthread_descr_struct *_pthread_descr; +# define _PTHREAD_DESCR_DEFINED +#endif + +/* System specific semaphore definition. */ +typedef struct +{ + struct _pthread_fastlock __sem_lock; + int __sem_value; + _pthread_descr __sem_waiting; +} sem_t; + + + +/* Value returned if `sem_open' failed. */ +#define SEM_FAILED ((sem_t *) 0) + +/* Maximum value the semaphore can have. */ +#define SEM_VALUE_MAX ((int) ((~0u) >> 1)) + + +__BEGIN_DECLS + +/* Initialize semaphore object SEM to VALUE. If PSHARED then share it + with other processes. */ +extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value) __THROW; + +/* Free resources associated with semaphore object SEM. */ +extern int sem_destroy (sem_t *__sem) __THROW; + +/* Open a named semaphore NAME with open flaot OFLAG. */ +extern sem_t *sem_open (__const char *__name, int __oflag, ...) __THROW; + +/* Close descriptor for named semaphore SEM. */ +extern int sem_close (sem_t *__sem) __THROW; + +/* Remove named semaphore NAME. */ +extern int sem_unlink (__const char *__name) __THROW; + +/* Wait for SEM being posted. */ +extern int sem_wait (sem_t *__sem); + +#ifdef __USE_XOPEN2K +/* Similar to `sem_wait' but wait only until ABSTIME. */ +extern int sem_timedwait (sem_t *__restrict __sem, + __const struct timespec *__restrict __abstime); +#endif + +/* Test whether SEM is posted. */ +extern int sem_trywait (sem_t *__sem) __THROW; + +/* Post SEM. */ +extern int sem_post (sem_t *__sem) __THROW; + +/* Get current value of SEM and store it in *SVAL. */ +extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval) + __THROW; + +__END_DECLS + +#endif /* semaphore.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/setjmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/setjmp.h new file mode 100644 index 0000000..99e3dc8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/setjmp.h @@ -0,0 +1,104 @@ +/* Copyright (C) 1991-1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.13 Nonlocal jumps + */ + +#ifndef _SETJMP_H +#define _SETJMP_H 1 + +#include + +__BEGIN_DECLS + +#include /* Get `__jmp_buf'. */ +#include /* Get `__sigset_t'. */ + +/* Calling environment, plus possibly a saved signal mask. */ +typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */ + { + /* NOTE: The machine-dependent definitions of `__sigsetjmp' + assume that a `jmp_buf' begins with a `__jmp_buf' and that + `__mask_was_saved' follows it. Do not move these members + or add others before it. */ + __jmp_buf __jmpbuf; /* Calling environment. */ + int __mask_was_saved; /* Saved the signal mask? */ + __sigset_t __saved_mask; /* Saved signal mask. */ + } jmp_buf[1]; + + +/* Store the calling environment in ENV, also saving the signal mask. + Return 0. */ +extern int setjmp (jmp_buf __env) __THROW; + +/* Store the calling environment in ENV, not saving the signal mask. + Return 0. */ +extern int _setjmp (jmp_buf __env) __THROW; + +/* Store the calling environment in ENV, also saving the + signal mask if SAVEMASK is nonzero. Return 0. + This is the internal name for `sigsetjmp'. */ +extern int __sigsetjmp (jmp_buf __env, int __savemask) __THROW; + +#ifndef __FAVOR_BSD +/* Do not save the signal mask. This is equivalent to the `_setjmp' + BSD function. */ +# define setjmp(env) _setjmp (env) +#else +/* We are in 4.3 BSD-compatibility mode in which `setjmp' + saves the signal mask like `sigsetjmp (ENV, 1)'. We have to + define a macro since ISO C says `setjmp' is one. */ +# define setjmp(env) setjmp (env) +#endif /* Favor BSD. */ + + +/* Jump to the environment saved in ENV, making the + `setjmp' call there return VAL, or 1 if VAL is 0. */ +extern void longjmp (jmp_buf __env, int __val) + __THROW __attribute__ ((__noreturn__)); +#if defined __USE_BSD || defined __USE_XOPEN +/* Same. Usually `_longjmp' is used with `_setjmp', which does not save + the signal mask. But it is how ENV was saved that determines whether + `longjmp' restores the mask; `_longjmp' is just an alias. */ +extern void _longjmp (jmp_buf __env, int __val) + __THROW __attribute__ ((__noreturn__)); +#endif + + +#ifdef __USE_POSIX +/* Use the same type for `jmp_buf' and `sigjmp_buf'. + The `__mask_was_saved' flag determines whether + or not `longjmp' will restore the signal mask. */ +typedef jmp_buf sigjmp_buf; + +/* Store the calling environment in ENV, also saving the + signal mask if SAVEMASK is nonzero. Return 0. */ +# define sigsetjmp(env, savemask) __sigsetjmp (env, savemask) + +/* Jump to the environment saved in ENV, making the + sigsetjmp call there return VAL, or 1 if VAL is 0. + Restore the signal mask if that sigsetjmp call saved it. + This is just an alias `longjmp'. */ +extern void siglongjmp (sigjmp_buf __env, int __val) + __THROW __attribute__ ((__noreturn__)); +#endif /* Use POSIX. */ + +__END_DECLS + +#endif /* setjmp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sgidefs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sgidefs.h new file mode 100644 index 0000000..74509fd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sgidefs.h @@ -0,0 +1,73 @@ +/* Copyright (C) 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ralf Baechle . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SGIDEFS_H +#define _SGIDEFS_H 1 + +/* + * A crude hack to stop + */ +#undef __ASM_SGIDEFS_H +#define __ASM_SGIDEFS_H + +/* + * And remove any damage it might have already done + */ +#undef _MIPS_ISA_MIPS1 +#undef _MIPS_ISA_MIPS2 +#undef _MIPS_ISA_MIPS3 +#undef _MIPS_ISA_MIPS4 +#undef _MIPS_ISA_MIPS5 +#undef _MIPS_ISA_MIPS32 +#undef _MIPS_ISA_MIPS64 + +#undef _MIPS_SIM_ABI32 +#undef _MIPS_SIM_NABI32 +#undef _MIPS_SIM_ABI64 + +/* + * Definitions for the ISA level + */ +#define _MIPS_ISA_MIPS1 1 +#define _MIPS_ISA_MIPS2 2 +#define _MIPS_ISA_MIPS3 3 +#define _MIPS_ISA_MIPS4 4 +#define _MIPS_ISA_MIPS5 5 +#define _MIPS_ISA_MIPS32 6 +#define _MIPS_ISA_MIPS64 7 + +/* + * Subprogram calling convention + */ +#ifndef _ABIO32 +# define _ABIO32 1 +#endif +#define _MIPS_SIM_ABI32 _ABIO32 + +#ifndef _ABIN32 +# define _ABIN32 2 +#endif +#define _MIPS_SIM_NABI32 _ABIN32 + +#ifndef _ABI64 +# define _ABI64 3 +#endif +#define _MIPS_SIM_ABI64 _ABI64 + +#endif /* sgidefs.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sgtty.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sgtty.h new file mode 100644 index 0000000..5b2bc41 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sgtty.h @@ -0,0 +1,41 @@ +/* Copyright (C) 1991, 1992, 1996, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SGTTY_H +#define _SGTTY_H 1 + +#include + +#include + +/* On some systems this type is not defined by ; + in that case, the functions are just stubs that return ENOSYS. */ +struct sgttyb; + +__BEGIN_DECLS + +/* Fill in *PARAMS with terminal parameters associated with FD. */ +extern int gtty (int __fd, struct sgttyb *__params) __THROW; + +/* Set the terminal parameters associated with FD to *PARAMS. */ +extern int stty (int __fd, __const struct sgttyb *__params) __THROW; + + +__END_DECLS + +#endif /* sgtty.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/shadow.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/shadow.h new file mode 100644 index 0000000..778df52 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/shadow.h @@ -0,0 +1,149 @@ +/* Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Declaration of types and functions for shadow password suite. */ + +#ifndef _SHADOW_H +#define _SHADOW_H 1 + +#include + +#include + +#define __need_FILE +#include +#define __need_size_t +#include + +/* Paths to the user database files. */ +#define SHADOW _PATH_SHADOW + + +__BEGIN_DECLS + +/* Structure of the password file. */ +struct spwd + { + char *sp_namp; /* Login name. */ + char *sp_pwdp; /* Encrypted password. */ + long int sp_lstchg; /* Date of last change. */ + long int sp_min; /* Minimum number of days between changes. */ + long int sp_max; /* Maximum number of days between changes. */ + long int sp_warn; /* Number of days to warn user to change + the password. */ + long int sp_inact; /* Number of days the account may be + inactive. */ + long int sp_expire; /* Number of days since 1970-01-01 until + account expires. */ + unsigned long int sp_flag; /* Reserved. */ + }; + + +/* Open database for reading. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void setspent (void); + +/* Close database. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void endspent (void); + +/* Get next entry from database, perhaps after opening the file. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct spwd *getspent (void); + +/* Get shadow entry matching NAME. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct spwd *getspnam (__const char *__name); + +/* Read shadow entry from STRING. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct spwd *sgetspent (__const char *__string); + +/* Read next shadow entry from STREAM. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern struct spwd *fgetspent (FILE *__stream); + +/* Write line containing shadow password entry to stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int putspent (__const struct spwd *__p, FILE *__stream); + + +#ifdef __USE_MISC +/* Reentrant versions of some of the functions above. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern int getspent_r (struct spwd *__result_buf, char *__buffer, + size_t __buflen, struct spwd **__result); + +extern int getspnam_r (__const char *__name, struct spwd *__result_buf, + char *__buffer, size_t __buflen, + struct spwd **__result); + +extern int sgetspent_r (__const char *__string, struct spwd *__result_buf, + char *__buffer, size_t __buflen, + struct spwd **__result); + +extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf, + char *__buffer, size_t __buflen, + struct spwd **__result); +#endif /* misc */ + + +/* The simple locking functionality provided here is not suitable for + multi-threaded applications. */ + +/* Protect password file against multi writers. */ +extern int lckpwdf (void) __THROW; + +/* Unlock password file. */ +extern int ulckpwdf (void) __THROW; + +__END_DECLS + +#endif /* shadow.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/signal.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/signal.h new file mode 100644 index 0000000..288febd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/signal.h @@ -0,0 +1,401 @@ +/* Copyright (C) 1991-2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.14 Signal handling + */ + +#ifndef _SIGNAL_H + +#if !defined __need_sig_atomic_t && !defined __need_sigset_t +# define _SIGNAL_H +#endif + +#include + +__BEGIN_DECLS + +#include /* __sigset_t, __sig_atomic_t. */ + +/* An integral type that can be modified atomically, without the + possibility of a signal arriving in the middle of the operation. */ +#if defined __need_sig_atomic_t || defined _SIGNAL_H +# ifndef __sig_atomic_t_defined +# define __sig_atomic_t_defined +__BEGIN_NAMESPACE_STD +typedef __sig_atomic_t sig_atomic_t; +__END_NAMESPACE_STD +# endif +# undef __need_sig_atomic_t +#endif + +#if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX) +# ifndef __sigset_t_defined +# define __sigset_t_defined +typedef __sigset_t sigset_t; +# endif +# undef __need_sigset_t +#endif + +#ifdef _SIGNAL_H + +#include +#include + +#if defined __USE_XOPEN || defined __USE_XOPEN2K +# ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +#endif +#ifdef __USE_XOPEN +# endif +# ifndef __uid_t_defined +typedef __uid_t uid_t; +# define __uid_t_defined +# endif +#endif /* Unix98 */ + + +/* Type of a signal handler. */ +typedef void (*__sighandler_t) (int); + +/* The X/Open definition of `signal' specifies the SVID semantic. Use + the additional function `sysv_signal' when X/Open compatibility is + requested. */ +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __THROW; +#ifdef __USE_GNU +extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler) + __THROW; +#endif + +/* Set the handler for the signal SIG to HANDLER, returning the old + handler, or SIG_ERR on error. + By default `signal' has the BSD semantic. */ +__BEGIN_NAMESPACE_STD +#ifdef __USE_BSD +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __THROW; +#else +/* Make sure the used `signal' implementation is the SVID version. */ +# ifdef __REDIRECT_NTH +extern __sighandler_t __REDIRECT_NTH (signal, + (int __sig, __sighandler_t __handler), + __sysv_signal); +# else +# define signal __sysv_signal +# endif +#endif +__END_NAMESPACE_STD + +#ifdef __USE_XOPEN +/* The X/Open definition of `signal' conflicts with the BSD version. + So they defined another function `bsd_signal'. */ +extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler) + __THROW; +#endif + +/* Send signal SIG to process number PID. If PID is zero, + send SIG to all processes in the current process's process group. + If PID is < -1, send SIG to all processes in process group - PID. */ +#ifdef __USE_POSIX +extern int kill (__pid_t __pid, int __sig) __THROW; +#endif /* Use POSIX. */ + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Send SIG to all processes in process group PGRP. + If PGRP is zero, send SIG to all processes in + the current process's process group. */ +extern int killpg (__pid_t __pgrp, int __sig) __THROW; +#endif /* Use BSD || X/Open Unix. */ + +__BEGIN_NAMESPACE_STD +/* Raise signal SIG, i.e., send SIG to yourself. */ +extern int raise (int __sig) __THROW; +__END_NAMESPACE_STD + +#ifdef __USE_SVID +/* SVID names for the same things. */ +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __THROW; +extern int gsignal (int __sig) __THROW; +#endif /* Use SVID. */ + +#ifdef __USE_MISC +/* Print a message describing the meaning of the given signal number. */ +extern void psignal (int __sig, __const char *__s); +#endif /* Use misc. */ + + +/* The `sigpause' function has two different interfaces. The original + BSD definition defines the argument as a mask of the signal, while + the more modern interface in X/Open defines it as the signal + number. We go with the BSD version unless the user explicitly + selects the X/Open version. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int __sigpause (int __sig_or_mask, int __is_sig); + +#ifdef __FAVOR_BSD +/* Set the mask of blocked signals to MASK, + wait for a signal to arrive, and then restore the mask. */ +extern int sigpause (int __mask) __THROW __attribute_deprecated__; +# define sigpause(mask) __sigpause ((mask), 0) +#else +# ifdef __USE_XOPEN +/* Remove a signal from the signal mask and suspend the process. */ +# define sigpause(sig) __sigpause ((sig), 1) +# endif +#endif + + +#ifdef __USE_BSD +/* None of the following functions should be used anymore. They are here + only for compatibility. A single word (`int') is not guaranteed to be + enough to hold a complete signal mask and therefore these functions + simply do not work in many situations. Use `sigprocmask' instead. */ + +/* Compute mask for signal SIG. */ +# define sigmask(sig) __sigmask(sig) + +/* Block signals in MASK, returning the old mask. */ +extern int sigblock (int __mask) __THROW __attribute_deprecated__; + +/* Set the mask of blocked signals to MASK, returning the old mask. */ +extern int sigsetmask (int __mask) __THROW __attribute_deprecated__; + +/* Return currently selected signal mask. */ +extern int siggetmask (void) __THROW __attribute_deprecated__; +#endif /* Use BSD. */ + + +#ifdef __USE_MISC +# define NSIG _NSIG +#endif + +#ifdef __USE_GNU +typedef __sighandler_t sighandler_t; +#endif + +/* 4.4 BSD uses the name `sig_t' for this. */ +#ifdef __USE_BSD +typedef __sighandler_t sig_t; +#endif + +#ifdef __USE_POSIX + +# ifdef __USE_POSIX199309 +/* We need `struct timespec' later on. */ +# define __need_timespec +# include + +/* Get the `siginfo_t' type plus the needed symbols. */ +# include +# endif + +/* Clear all signals from SET. */ +extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1)); + +/* Set all signals in SET. */ +extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1)); + +/* Add SIGNO to SET. */ +extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1)); + +/* Remove SIGNO from SET. */ +extern int sigdelset (sigset_t *__set, int __signo) __THROW __nonnull ((1)); + +/* Return 1 if SIGNO is in SET, 0 if not. */ +extern int sigismember (__const sigset_t *__set, int __signo) + __THROW __nonnull ((1)); + +# ifdef __USE_GNU +/* Return non-empty value is SET is not empty. */ +extern int sigisemptyset (__const sigset_t *__set) __THROW __nonnull ((1)); + +/* Build new signal set by combining the two inputs set using logical AND. */ +extern int sigandset (sigset_t *__set, __const sigset_t *__left, + __const sigset_t *__right) __THROW __nonnull ((1, 2, 3)); + +/* Build new signal set by combining the two inputs set using logical OR. */ +extern int sigorset (sigset_t *__set, __const sigset_t *__left, + __const sigset_t *__right) __THROW __nonnull ((1, 2, 3)); +# endif /* GNU */ + +/* Get the system-specific definitions of `struct sigaction' + and the `SA_*' and `SIG_*'. constants. */ +# include + +/* Get and/or change the set of blocked signals. */ +extern int sigprocmask (int __how, __const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __THROW; + +/* Change the set of blocked signals to SET, + wait until a signal arrives, and restore the set of blocked signals. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sigsuspend (__const sigset_t *__set) __nonnull ((1)); + +/* Get and/or set the action for signal SIG. */ +extern int sigaction (int __sig, __const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __THROW; + +/* Put in SET all signals that are blocked and waiting to be delivered. */ +extern int sigpending (sigset_t *__set) __THROW __nonnull ((1)); + + +/* Select any of pending signals from SET or wait for any to arrive. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig) + __nonnull ((1, 2)); + +# ifdef __USE_POSIX199309 +/* Select any of pending signals from SET and place information in INFO. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sigwaitinfo (__const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __nonnull ((1)); + +/* Select any of pending signals from SET and place information in INFO. + Wait the time specified by TIMEOUT if no signal is pending. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sigtimedwait (__const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + __const struct timespec *__restrict __timeout) + __nonnull ((1)); + +/* Send signal SIG to the process PID. Associate data in VAL with the + signal. */ +extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val) + __THROW; +# endif /* Use POSIX 199306. */ + +#endif /* Use POSIX. */ + +#ifdef __USE_BSD + +#ifdef __UCLIBC_HAS_SYS_SIGLIST__ +/* Names of the signals. This variable exists only for compatibility. + Use `strsignal' instead (see ). */ +#define _sys_siglist sys_siglist +extern __const char *__const sys_siglist[_NSIG]; +#endif /* __UCLIBC_HAS_SYS_SIGLIST__ */ + +/* Structure passed to `sigvec'. */ +struct sigvec + { + __sighandler_t sv_handler; /* Signal handler. */ + int sv_mask; /* Mask of signals to be blocked. */ + + int sv_flags; /* Flags (see below). */ +# define sv_onstack sv_flags /* 4.2 BSD compatibility. */ + }; + +/* Bits in `sv_flags'. */ +# define SV_ONSTACK (1 << 0)/* Take the signal on the signal stack. */ +# define SV_INTERRUPT (1 << 1)/* Do not restart system calls. */ +# define SV_RESETHAND (1 << 2)/* Reset handler to SIG_DFL on receipt. */ + + +/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member + of VEC. The signals in `sv_mask' will be blocked while the handler runs. + If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be + reset to SIG_DFL before `sv_handler' is entered. If OVEC is non-NULL, + it is filled in with the old information for SIG. */ +extern int sigvec (int __sig, __const struct sigvec *__vec, + struct sigvec *__ovec) __THROW; + + +/* Get machine-dependent `struct sigcontext' and signal subcodes. */ +# include + +/* Restore the state saved in SCP. */ +extern int sigreturn (struct sigcontext *__scp) __THROW; + +#endif /* use BSD. */ + + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED + +/* If INTERRUPT is nonzero, make signal SIG interrupt system calls + (causing them to fail with EINTR); if INTERRUPT is zero, make system + calls be restarted after signal SIG. */ +extern int siginterrupt (int __sig, int __interrupt) __THROW; + +# include +# ifdef __USE_XOPEN +/* This will define `ucontext_t' and `mcontext_t'. */ +# include +# endif + +/* Run signals handlers on the stack specified by SS (if not NULL). + If OSS is not NULL, it is filled in with the old signal stack status. + This interface is obsolete and on many platform not implemented. */ +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __THROW __attribute_deprecated__; + +/* Alternate signal handler stack interface. + This interface should always be preferred over `sigstack'. */ +extern int sigaltstack (__const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __THROW; + +#endif /* use BSD or X/Open Unix. */ + +#ifdef __USE_XOPEN_EXTENDED +/* Simplified interface for signal management. */ + +/* Add SIG to the calling process' signal mask. */ +extern int sighold (int __sig) __THROW; + +/* Remove SIG from the calling process' signal mask. */ +extern int sigrelse (int __sig) __THROW; + +/* Set the disposition of SIG to SIG_IGN. */ +extern int sigignore (int __sig) __THROW; + +/* Set the disposition of SIG. */ +extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW; +#endif + +#if defined __UCLIBC_HAS_THREADS__ && (defined __USE_POSIX199506 || defined __USE_UNIX98) +/* Some of the functions for handling signals in threaded programs must + be defined here. */ +# include +# include +#endif /* use Unix98 */ + +/* The following functions are used internally in the C library and in + other code which need deep insights. */ + +/* Return number of available real-time signal with highest priority. */ +extern int __libc_current_sigrtmin (void) __THROW; +/* Return number of available real-time signal with lowest priority. */ +extern int __libc_current_sigrtmax (void) __THROW; + +#endif /* signal.h */ + +__END_DECLS + +#endif /* not signal.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/..install.cmd new file mode 100644 index 0000000..69bf1be --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/sound/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/sound /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/sound mips asequencer.h asound.h asound_fm.h emu10k1.h hdsp.h hdspm.h sb16_csp.h sfnt_info.h sscape_ioctl.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/sound /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/sound mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/sound/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asequencer.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asequencer.h new file mode 100644 index 0000000..2be4da5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asequencer.h @@ -0,0 +1,614 @@ +/* + * Main header file for the ALSA sequencer + * Copyright (c) 1998-1999 by Frank van de Pol + * (c) 1998-1999 by Jaroslav Kysela + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef __SOUND_ASEQUENCER_H +#define __SOUND_ASEQUENCER_H + + +/** version of the sequencer */ +#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) + +/** + * definition of sequencer event types + */ + +/** system messages + * event data type = #snd_seq_result + */ +#define SNDRV_SEQ_EVENT_SYSTEM 0 +#define SNDRV_SEQ_EVENT_RESULT 1 + +/** note messages (channel specific) + * event data type = #snd_seq_ev_note + */ +#define SNDRV_SEQ_EVENT_NOTE 5 +#define SNDRV_SEQ_EVENT_NOTEON 6 +#define SNDRV_SEQ_EVENT_NOTEOFF 7 +#define SNDRV_SEQ_EVENT_KEYPRESS 8 + +/** control messages (channel specific) + * event data type = #snd_seq_ev_ctrl + */ +#define SNDRV_SEQ_EVENT_CONTROLLER 10 +#define SNDRV_SEQ_EVENT_PGMCHANGE 11 +#define SNDRV_SEQ_EVENT_CHANPRESS 12 +#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ +#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ +#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ +#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ + +/** synchronisation messages + * event data type = #snd_seq_ev_ctrl + */ +#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ +#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ +#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ +#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ +#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ + +/** timer messages + * event data type = snd_seq_ev_queue_control + */ +#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ +#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ +#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ +#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ +#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ +#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ +#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ +#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ +#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ + +/** others + * event data type = none + */ +#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ +#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ +#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ + +/** echo back, kernel private messages + * event data type = any type + */ +#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ +#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ + +/** system status messages (broadcast for subscribers) + * event data type = snd_seq_addr + */ +#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ +#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ +#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ +#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ +#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ +#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ + +/** port connection changes + * event data type = snd_seq_connect + */ +#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ +#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ + +/* 70-89: synthesizer events - obsoleted */ + +/** user-defined events with fixed length + * event data type = any + */ +#define SNDRV_SEQ_EVENT_USR0 90 +#define SNDRV_SEQ_EVENT_USR1 91 +#define SNDRV_SEQ_EVENT_USR2 92 +#define SNDRV_SEQ_EVENT_USR3 93 +#define SNDRV_SEQ_EVENT_USR4 94 +#define SNDRV_SEQ_EVENT_USR5 95 +#define SNDRV_SEQ_EVENT_USR6 96 +#define SNDRV_SEQ_EVENT_USR7 97 +#define SNDRV_SEQ_EVENT_USR8 98 +#define SNDRV_SEQ_EVENT_USR9 99 + +/* 100-118: instrument layer - obsoleted */ +/* 119-129: reserved */ + +/* 130-139: variable length events + * event data type = snd_seq_ev_ext + * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) + */ +#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ +#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ +/* 132-134: reserved */ +#define SNDRV_SEQ_EVENT_USR_VAR0 135 +#define SNDRV_SEQ_EVENT_USR_VAR1 136 +#define SNDRV_SEQ_EVENT_USR_VAR2 137 +#define SNDRV_SEQ_EVENT_USR_VAR3 138 +#define SNDRV_SEQ_EVENT_USR_VAR4 139 + +/* 150-151: kernel events with quote - DO NOT use in user clients */ +#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 +#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ + +/* 152-191: reserved */ + +/* 192-254: hardware specific events */ + +/* 255: special event */ +#define SNDRV_SEQ_EVENT_NONE 255 + + +typedef unsigned char snd_seq_event_type_t; + +/** event address */ +struct snd_seq_addr { + unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ + unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ +}; + +/** port connection */ +struct snd_seq_connect { + struct snd_seq_addr sender; + struct snd_seq_addr dest; +}; + + +#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ +#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ +#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ +#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ + + /* event mode flag - NOTE: only 8 bits available! */ +#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ +#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ +#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) + +#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ +#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ +#define SNDRV_SEQ_TIME_MODE_MASK (1<<1) + +#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ +#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ +#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ +#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) + +#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ +#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ +#define SNDRV_SEQ_PRIORITY_MASK (1<<4) + + + /* note event */ +struct snd_seq_ev_note { + unsigned char channel; + unsigned char note; + unsigned char velocity; + unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ + unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ +}; + + /* controller event */ +struct snd_seq_ev_ctrl { + unsigned char channel; + unsigned char unused1, unused2, unused3; /* pad */ + unsigned int param; + signed int value; +}; + + /* generic set of bytes (12x8 bit) */ +struct snd_seq_ev_raw8 { + unsigned char d[12]; /* 8 bit value */ +}; + + /* generic set of integers (3x32 bit) */ +struct snd_seq_ev_raw32 { + unsigned int d[3]; /* 32 bit value */ +}; + + /* external stored data */ +struct snd_seq_ev_ext { + unsigned int len; /* length of data */ + void *ptr; /* pointer to data (note: maybe 64-bit) */ +} __attribute__((packed)); + +struct snd_seq_result { + int event; /* processed event type */ + int result; +}; + + +struct snd_seq_real_time { + unsigned int tv_sec; /* seconds */ + unsigned int tv_nsec; /* nanoseconds */ +}; + +typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ + +union snd_seq_timestamp { + snd_seq_tick_time_t tick; + struct snd_seq_real_time time; +}; + +struct snd_seq_queue_skew { + unsigned int value; + unsigned int base; +}; + + /* queue timer control */ +struct snd_seq_ev_queue_control { + unsigned char queue; /* affected queue */ + unsigned char pad[3]; /* reserved */ + union { + signed int value; /* affected value (e.g. tempo) */ + union snd_seq_timestamp time; /* time */ + unsigned int position; /* sync position */ + struct snd_seq_queue_skew skew; + unsigned int d32[2]; + unsigned char d8[8]; + } param; +}; + + /* quoted event - inside the kernel only */ +struct snd_seq_ev_quote { + struct snd_seq_addr origin; /* original sender */ + unsigned short value; /* optional data */ + struct snd_seq_event *event; /* quoted event */ +} __attribute__((packed)); + + + /* sequencer event */ +struct snd_seq_event { + snd_seq_event_type_t type; /* event type */ + unsigned char flags; /* event flags */ + char tag; + + unsigned char queue; /* schedule queue */ + union snd_seq_timestamp time; /* schedule time */ + + + struct snd_seq_addr source; /* source address */ + struct snd_seq_addr dest; /* destination address */ + + union { /* event data... */ + struct snd_seq_ev_note note; + struct snd_seq_ev_ctrl control; + struct snd_seq_ev_raw8 raw8; + struct snd_seq_ev_raw32 raw32; + struct snd_seq_ev_ext ext; + struct snd_seq_ev_queue_control queue; + union snd_seq_timestamp time; + struct snd_seq_addr addr; + struct snd_seq_connect connect; + struct snd_seq_result result; + struct snd_seq_ev_quote quote; + } data; +}; + + +/* + * bounce event - stored as variable size data + */ +struct snd_seq_event_bounce { + int err; + struct snd_seq_event event; + /* external data follows here. */ +}; + + + /* system information */ +struct snd_seq_system_info { + int queues; /* maximum queues count */ + int clients; /* maximum clients count */ + int ports; /* maximum ports per client */ + int channels; /* maximum channels per port */ + int cur_clients; /* current clients */ + int cur_queues; /* current queues */ + char reserved[24]; +}; + + + /* system running information */ +struct snd_seq_running_info { + unsigned char client; /* client id */ + unsigned char big_endian; /* 1 = big-endian */ + unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ + unsigned char pad; /* reserved */ + unsigned char reserved[12]; +}; + + + /* known client numbers */ +#define SNDRV_SEQ_CLIENT_SYSTEM 0 + /* internal client numbers */ +#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ +#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ + + + /* client types */ +typedef int __bitwise snd_seq_client_type_t; +#define NO_CLIENT ((snd_seq_client_type_t) 0) +#define USER_CLIENT ((snd_seq_client_type_t) 1) +#define KERNEL_CLIENT ((snd_seq_client_type_t) 2) + + /* event filter flags */ +#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ +#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */ +#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ +#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ + +struct snd_seq_client_info { + int client; /* client number to inquire */ + snd_seq_client_type_t type; /* client type */ + char name[64]; /* client name */ + unsigned int filter; /* filter flags */ + unsigned char multicast_filter[8]; /* multicast filter bitmap */ + unsigned char event_filter[32]; /* event filter bitmap */ + int num_ports; /* RO: number of ports */ + int event_lost; /* number of lost events */ + char reserved[64]; /* for future use */ +}; + + +/* client pool size */ +struct snd_seq_client_pool { + int client; /* client number to inquire */ + int output_pool; /* outgoing (write) pool size */ + int input_pool; /* incoming (read) pool size */ + int output_room; /* minimum free pool size for select/blocking mode */ + int output_free; /* unused size */ + int input_free; /* unused size */ + char reserved[64]; +}; + + +/* Remove events by specified criteria */ + +#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ +#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ +#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ +#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ +#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ +#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ +#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ +#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ +#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ +#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ + +struct snd_seq_remove_events { + unsigned int remove_mode; /* Flags that determine what gets removed */ + + union snd_seq_timestamp time; + + unsigned char queue; /* Queue for REMOVE_DEST */ + struct snd_seq_addr dest; /* Address for REMOVE_DEST */ + unsigned char channel; /* Channel for REMOVE_DEST */ + + int type; /* For REMOVE_EVENT_TYPE */ + char tag; /* Tag for REMOVE_TAG */ + + int reserved[10]; /* To allow for future binary compatibility */ + +}; + + + /* known port numbers */ +#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 +#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 + + /* port capabilities (32 bits) */ +#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ +#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ + +#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) +#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) + +#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) + +#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ +#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ +#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ + + /* port type */ +#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ +#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ +#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ +#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ +#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ +#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ +#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ + +/* other standards...*/ +#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ +#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ +#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ +/*...*/ +#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ +#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ +#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ +#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ +#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ + +/* misc. conditioning flags */ +#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) +#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) +#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) + +struct snd_seq_port_info { + struct snd_seq_addr addr; /* client/port numbers */ + char name[64]; /* port name */ + + unsigned int capability; /* port capability bits */ + unsigned int type; /* port type bits */ + int midi_channels; /* channels per MIDI port */ + int midi_voices; /* voices per MIDI port */ + int synth_voices; /* voices per SYNTH port */ + + int read_use; /* R/O: subscribers for output (from this port) */ + int write_use; /* R/O: subscribers for input (to this port) */ + + void *kernel; /* reserved for kernel use (must be NULL) */ + unsigned int flags; /* misc. conditioning */ + unsigned char time_queue; /* queue # for timestamping */ + char reserved[59]; /* for future use */ +}; + + +/* queue flags */ +#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ + +/* queue information */ +struct snd_seq_queue_info { + int queue; /* queue id */ + + /* + * security settings, only owner of this queue can start/stop timer + * etc. if the queue is locked for other clients + */ + int owner; /* client id for owner of the queue */ + unsigned locked:1; /* timing queue locked for other queues */ + char name[64]; /* name of this queue */ + unsigned int flags; /* flags */ + char reserved[60]; /* for future use */ + +}; + +/* queue info/status */ +struct snd_seq_queue_status { + int queue; /* queue id */ + int events; /* read-only - queue size */ + snd_seq_tick_time_t tick; /* current tick */ + struct snd_seq_real_time time; /* current time */ + int running; /* running state of queue */ + int flags; /* various flags */ + char reserved[64]; /* for the future */ +}; + + +/* queue tempo */ +struct snd_seq_queue_tempo { + int queue; /* sequencer queue */ + unsigned int tempo; /* current tempo, us/tick */ + int ppq; /* time resolution, ticks/quarter */ + unsigned int skew_value; /* queue skew */ + unsigned int skew_base; /* queue skew base */ + char reserved[24]; /* for the future */ +}; + + +/* sequencer timer sources */ +#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ +#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ +#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ + +/* queue timer info */ +struct snd_seq_queue_timer { + int queue; /* sequencer queue */ + int type; /* source timer type */ + union { + struct { + struct snd_timer_id id; /* ALSA's timer ID */ + unsigned int resolution; /* resolution in Hz */ + } alsa; + } u; + char reserved[64]; /* for the future use */ +}; + + +struct snd_seq_queue_client { + int queue; /* sequencer queue */ + int client; /* sequencer client */ + int used; /* queue is used with this client + (must be set for accepting events) */ + /* per client watermarks */ + char reserved[64]; /* for future use */ +}; + + +#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ +#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) +#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) + +struct snd_seq_port_subscribe { + struct snd_seq_addr sender; /* sender address */ + struct snd_seq_addr dest; /* destination address */ + unsigned int voices; /* number of voices to be allocated (0 = don't care) */ + unsigned int flags; /* modes */ + unsigned char queue; /* input time-stamp queue (optional) */ + unsigned char pad[3]; /* reserved */ + char reserved[64]; +}; + +/* type of query subscription */ +#define SNDRV_SEQ_QUERY_SUBS_READ 0 +#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 + +struct snd_seq_query_subs { + struct snd_seq_addr root; /* client/port id to be searched */ + int type; /* READ or WRITE */ + int index; /* 0..N-1 */ + int num_subs; /* R/O: number of subscriptions on this port */ + struct snd_seq_addr addr; /* R/O: result */ + unsigned char queue; /* R/O: result */ + unsigned int flags; /* R/O: result */ + char reserved[64]; /* for future use */ +}; + + +/* + * IOCTL commands + */ + +#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) +#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) +#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) +#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) + +#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) +#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) + +#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) +#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) +#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) +#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) + +#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) +#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) + +#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner) +#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) +/* XXX +#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync) +*/ +#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) +#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) +#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) +#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) +#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) +#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) +#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) +#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) +#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) + +#endif /* __SOUND_ASEQUENCER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asound.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asound.h new file mode 100644 index 0000000..19cb233 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asound.h @@ -0,0 +1,894 @@ +/* + * Advanced Linux Sound Architecture - ALSA - Driver + * Copyright (c) 1994-2003 by Jaroslav Kysela , + * Abramo Bagnara + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __SOUND_ASOUND_H +#define __SOUND_ASOUND_H + +#include + + +/* + * protocol version + */ + +#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) +#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) +#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) +#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) +#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ + (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ + (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ + SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) + +/**************************************************************************** + * * + * Digital audio interface * + * * + ****************************************************************************/ + +struct snd_aes_iec958 { + unsigned char status[24]; /* AES/IEC958 channel status bits */ + unsigned char subcode[147]; /* AES/IEC958 subcode bits */ + unsigned char pad; /* nothing */ + unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ +}; + +/**************************************************************************** + * * + * Section for driver hardware dependent interface - /dev/snd/hw? * + * * + ****************************************************************************/ + +#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) + +enum { + SNDRV_HWDEP_IFACE_OPL2 = 0, + SNDRV_HWDEP_IFACE_OPL3, + SNDRV_HWDEP_IFACE_OPL4, + SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ + SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ + SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ + SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ + SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ + SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ + SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ + SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ + SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ + SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ + SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ + SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ + SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ + SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ + SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ + + /* Don't forget to change the following: */ + SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM +}; + +struct snd_hwdep_info { + unsigned int device; /* WR: device number */ + int card; /* R: card number */ + unsigned char id[64]; /* ID (user selectable) */ + unsigned char name[80]; /* hwdep name */ + int iface; /* hwdep interface */ + unsigned char reserved[64]; /* reserved for future */ +}; + +/* generic DSP loader */ +struct snd_hwdep_dsp_status { + unsigned int version; /* R: driver-specific version */ + unsigned char id[32]; /* R: driver-specific ID string */ + unsigned int num_dsps; /* R: number of DSP images to transfer */ + unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ + unsigned int chip_ready; /* R: 1 = initialization finished */ + unsigned char reserved[16]; /* reserved for future use */ +}; + +struct snd_hwdep_dsp_image { + unsigned int index; /* W: DSP index */ + unsigned char name[64]; /* W: ID (e.g. file name) */ + unsigned char *image; /* W: binary image */ + size_t length; /* W: size of image in bytes */ + unsigned long driver_data; /* W: driver-specific data */ +}; + +#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int) +#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info) +#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status) +#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image) + +/***************************************************************************** + * * + * Digital Audio (PCM) interface - /dev/snd/pcm?? * + * * + *****************************************************************************/ + +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9) + +typedef unsigned long snd_pcm_uframes_t; +typedef signed long snd_pcm_sframes_t; + +enum { + SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ + SNDRV_PCM_CLASS_MULTI, /* multichannel device */ + SNDRV_PCM_CLASS_MODEM, /* software modem class */ + SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ + /* Don't forget to change the following: */ + SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, +}; + +enum { + SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ + SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ + /* Don't forget to change the following: */ + SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, +}; + +enum { + SNDRV_PCM_STREAM_PLAYBACK = 0, + SNDRV_PCM_STREAM_CAPTURE, + SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, +}; + +typedef int __bitwise snd_pcm_access_t; +#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((snd_pcm_access_t) 0) /* interleaved mmap */ +#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((snd_pcm_access_t) 1) /* noninterleaved mmap */ +#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((snd_pcm_access_t) 2) /* complex mmap */ +#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((snd_pcm_access_t) 3) /* readi/writei */ +#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((snd_pcm_access_t) 4) /* readn/writen */ +#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED + +typedef int __bitwise snd_pcm_format_t; +#define SNDRV_PCM_FORMAT_S8 ((snd_pcm_format_t) 0) +#define SNDRV_PCM_FORMAT_U8 ((snd_pcm_format_t) 1) +#define SNDRV_PCM_FORMAT_S16_LE ((snd_pcm_format_t) 2) +#define SNDRV_PCM_FORMAT_S16_BE ((snd_pcm_format_t) 3) +#define SNDRV_PCM_FORMAT_U16_LE ((snd_pcm_format_t) 4) +#define SNDRV_PCM_FORMAT_U16_BE ((snd_pcm_format_t) 5) +#define SNDRV_PCM_FORMAT_S24_LE ((snd_pcm_format_t) 6) /* low three bytes */ +#define SNDRV_PCM_FORMAT_S24_BE ((snd_pcm_format_t) 7) /* low three bytes */ +#define SNDRV_PCM_FORMAT_U24_LE ((snd_pcm_format_t) 8) /* low three bytes */ +#define SNDRV_PCM_FORMAT_U24_BE ((snd_pcm_format_t) 9) /* low three bytes */ +#define SNDRV_PCM_FORMAT_S32_LE ((snd_pcm_format_t) 10) +#define SNDRV_PCM_FORMAT_S32_BE ((snd_pcm_format_t) 11) +#define SNDRV_PCM_FORMAT_U32_LE ((snd_pcm_format_t) 12) +#define SNDRV_PCM_FORMAT_U32_BE ((snd_pcm_format_t) 13) +#define SNDRV_PCM_FORMAT_FLOAT_LE ((snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ +#define SNDRV_PCM_FORMAT_FLOAT_BE ((snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ +#define SNDRV_PCM_FORMAT_FLOAT64_LE ((snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ +#define SNDRV_PCM_FORMAT_FLOAT64_BE ((snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ +#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ +#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ +#define SNDRV_PCM_FORMAT_MU_LAW ((snd_pcm_format_t) 20) +#define SNDRV_PCM_FORMAT_A_LAW ((snd_pcm_format_t) 21) +#define SNDRV_PCM_FORMAT_IMA_ADPCM ((snd_pcm_format_t) 22) +#define SNDRV_PCM_FORMAT_MPEG ((snd_pcm_format_t) 23) +#define SNDRV_PCM_FORMAT_GSM ((snd_pcm_format_t) 24) +#define SNDRV_PCM_FORMAT_SPECIAL ((snd_pcm_format_t) 31) +#define SNDRV_PCM_FORMAT_S24_3LE ((snd_pcm_format_t) 32) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S24_3BE ((snd_pcm_format_t) 33) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U24_3LE ((snd_pcm_format_t) 34) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U24_3BE ((snd_pcm_format_t) 35) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S20_3LE ((snd_pcm_format_t) 36) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S20_3BE ((snd_pcm_format_t) 37) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U20_3LE ((snd_pcm_format_t) 38) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U20_3BE ((snd_pcm_format_t) 39) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S18_3LE ((snd_pcm_format_t) 40) /* in three bytes */ +#define SNDRV_PCM_FORMAT_S18_3BE ((snd_pcm_format_t) 41) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U18_3LE ((snd_pcm_format_t) 42) /* in three bytes */ +#define SNDRV_PCM_FORMAT_U18_3BE ((snd_pcm_format_t) 43) /* in three bytes */ +#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE + +#ifdef SNDRV_LITTLE_ENDIAN +#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE +#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE +#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE +#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE +#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE +#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE +#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE +#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE +#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE +#endif +#ifdef SNDRV_BIG_ENDIAN +#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE +#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE +#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE +#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE +#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE +#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE +#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE +#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE +#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE +#endif + +typedef int __bitwise snd_pcm_subformat_t; +#define SNDRV_PCM_SUBFORMAT_STD ((snd_pcm_subformat_t) 0) +#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD + +#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ +#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ +#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ +#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ +#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ +#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ +#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ +#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ +#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ +#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ +#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ +#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ +#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ +#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ + +typedef int __bitwise snd_pcm_state_t; +#define SNDRV_PCM_STATE_OPEN ((snd_pcm_state_t) 0) /* stream is open */ +#define SNDRV_PCM_STATE_SETUP ((snd_pcm_state_t) 1) /* stream has a setup */ +#define SNDRV_PCM_STATE_PREPARED ((snd_pcm_state_t) 2) /* stream is ready to start */ +#define SNDRV_PCM_STATE_RUNNING ((snd_pcm_state_t) 3) /* stream is running */ +#define SNDRV_PCM_STATE_XRUN ((snd_pcm_state_t) 4) /* stream reached an xrun */ +#define SNDRV_PCM_STATE_DRAINING ((snd_pcm_state_t) 5) /* stream is draining */ +#define SNDRV_PCM_STATE_PAUSED ((snd_pcm_state_t) 6) /* stream is paused */ +#define SNDRV_PCM_STATE_SUSPENDED ((snd_pcm_state_t) 7) /* hardware is suspended */ +#define SNDRV_PCM_STATE_DISCONNECTED ((snd_pcm_state_t) 8) /* hardware is disconnected */ +#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED + +enum { + SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, + SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, + SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, +}; + +union snd_pcm_sync_id { + unsigned char id[16]; + unsigned short id16[8]; + unsigned int id32[4]; +}; + +struct snd_pcm_info { + unsigned int device; /* RO/WR (control): device number */ + unsigned int subdevice; /* RO/WR (control): subdevice number */ + int stream; /* RO/WR (control): stream direction */ + int card; /* R: card number */ + unsigned char id[64]; /* ID (user selectable) */ + unsigned char name[80]; /* name of this device */ + unsigned char subname[32]; /* subdevice name */ + int dev_class; /* SNDRV_PCM_CLASS_* */ + int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ + unsigned int subdevices_count; + unsigned int subdevices_avail; + union snd_pcm_sync_id sync; /* hardware synchronization ID */ + unsigned char reserved[64]; /* reserved for future... */ +}; + +typedef int snd_pcm_hw_param_t; +#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */ +#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */ +#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */ +#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS +#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT + +#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */ +#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */ +#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */ +#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */ +#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between + * interrupts in us + */ +#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between + * interrupts + */ +#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between + * interrupts + */ +#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per + * buffer + */ +#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer + * in us + */ +#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */ +#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */ +#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */ +#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS +#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME + +#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ + +struct snd_interval { + unsigned int min, max; + unsigned int openmin:1, + openmax:1, + integer:1, + empty:1; +}; + +#define SNDRV_MASK_MAX 256 + +struct snd_mask { + __u32 bits[(SNDRV_MASK_MAX+31)/32]; +}; + +struct snd_pcm_hw_params { + unsigned int flags; + struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - + SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; + struct snd_mask mres[5]; /* reserved masks */ + struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - + SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; + struct snd_interval ires[9]; /* reserved intervals */ + unsigned int rmask; /* W: requested masks */ + unsigned int cmask; /* R: changed masks */ + unsigned int info; /* R: Info flags for returned setup */ + unsigned int msbits; /* R: used most significant bits */ + unsigned int rate_num; /* R: rate numerator */ + unsigned int rate_den; /* R: rate denominator */ + snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ + unsigned char reserved[64]; /* reserved for future */ +}; + +enum { + SNDRV_PCM_TSTAMP_NONE = 0, + SNDRV_PCM_TSTAMP_ENABLE, + SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, +}; + +struct snd_pcm_sw_params { + int tstamp_mode; /* timestamp mode */ + unsigned int period_step; + unsigned int sleep_min; /* min ticks to sleep */ + snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ + snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ + snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ + snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ + snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ + snd_pcm_uframes_t silence_size; /* silence block size */ + snd_pcm_uframes_t boundary; /* pointers wrap point */ + unsigned char reserved[64]; /* reserved for future */ +}; + +struct snd_pcm_channel_info { + unsigned int channel; + __kernel_off_t offset; /* mmap offset */ + unsigned int first; /* offset to first sample in bits */ + unsigned int step; /* samples distance in bits */ +}; + +struct snd_pcm_status { + snd_pcm_state_t state; /* stream state */ + struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ + struct timespec tstamp; /* reference timestamp */ + snd_pcm_uframes_t appl_ptr; /* appl ptr */ + snd_pcm_uframes_t hw_ptr; /* hw ptr */ + snd_pcm_sframes_t delay; /* current delay in frames */ + snd_pcm_uframes_t avail; /* number of frames available */ + snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ + snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ + snd_pcm_state_t suspended_state; /* suspended stream state */ + unsigned char reserved[60]; /* must be filled with zero */ +}; + +struct snd_pcm_mmap_status { + snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ + int pad1; /* Needed for 64 bit alignment */ + snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ + struct timespec tstamp; /* Timestamp */ + snd_pcm_state_t suspended_state; /* RO: suspended stream state */ +}; + +struct snd_pcm_mmap_control { + snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ + snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ +}; + +#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ +#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ +#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ + +struct snd_pcm_sync_ptr { + unsigned int flags; + union { + struct snd_pcm_mmap_status status; + unsigned char reserved[64]; + } s; + union { + struct snd_pcm_mmap_control control; + unsigned char reserved[64]; + } c; +}; + +struct snd_xferi { + snd_pcm_sframes_t result; + void *buf; + snd_pcm_uframes_t frames; +}; + +struct snd_xfern { + snd_pcm_sframes_t result; + void * *bufs; + snd_pcm_uframes_t frames; +}; + +enum { + SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ + SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ + SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, +}; + +#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) +#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) +#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) +#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int) +#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params) +#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params) +#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12) +#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params) +#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) +#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) +#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) +#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) +#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) +#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) +#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) +#define SNDRV_PCM_IOCTL_START _IO('A', 0x42) +#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43) +#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44) +#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int) +#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t) +#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47) +#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48) +#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t) +#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi) +#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi) +#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern) +#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) +#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) +#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) + +/***************************************************************************** + * * + * MIDI v1.0 interface * + * * + *****************************************************************************/ + +/* + * Raw MIDI section - /dev/snd/midi?? + */ + +#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) + +enum { + SNDRV_RAWMIDI_STREAM_OUTPUT = 0, + SNDRV_RAWMIDI_STREAM_INPUT, + SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, +}; + +#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 +#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 +#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 + +struct snd_rawmidi_info { + unsigned int device; /* RO/WR (control): device number */ + unsigned int subdevice; /* RO/WR (control): subdevice number */ + int stream; /* WR: stream */ + int card; /* R: card number */ + unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ + unsigned char id[64]; /* ID (user selectable) */ + unsigned char name[80]; /* name of device */ + unsigned char subname[32]; /* name of active or selected subdevice */ + unsigned int subdevices_count; + unsigned int subdevices_avail; + unsigned char reserved[64]; /* reserved for future use */ +}; + +struct snd_rawmidi_params { + int stream; + size_t buffer_size; /* queue size in bytes */ + size_t avail_min; /* minimum avail bytes for wakeup */ + unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ + unsigned char reserved[16]; /* reserved for future use */ +}; + +struct snd_rawmidi_status { + int stream; + struct timespec tstamp; /* Timestamp */ + size_t avail; /* available bytes */ + size_t xruns; /* count of overruns since last status (in bytes) */ + unsigned char reserved[16]; /* reserved for future use */ +}; + +#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) +#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) +#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params) +#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status) +#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int) +#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int) + +/* + * Timer section - /dev/snd/timer + */ + +#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) + +enum { + SNDRV_TIMER_CLASS_NONE = -1, + SNDRV_TIMER_CLASS_SLAVE = 0, + SNDRV_TIMER_CLASS_GLOBAL, + SNDRV_TIMER_CLASS_CARD, + SNDRV_TIMER_CLASS_PCM, + SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, +}; + +/* slave timer classes */ +enum { + SNDRV_TIMER_SCLASS_NONE = 0, + SNDRV_TIMER_SCLASS_APPLICATION, + SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ + SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ + SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, +}; + +/* global timers (device member) */ +#define SNDRV_TIMER_GLOBAL_SYSTEM 0 +#define SNDRV_TIMER_GLOBAL_RTC 1 +#define SNDRV_TIMER_GLOBAL_HPET 2 +#define SNDRV_TIMER_GLOBAL_HRTIMER 3 + +/* info flags */ +#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ + +struct snd_timer_id { + int dev_class; + int dev_sclass; + int card; + int device; + int subdevice; +}; + +struct snd_timer_ginfo { + struct snd_timer_id tid; /* requested timer ID */ + unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ + int card; /* card number */ + unsigned char id[64]; /* timer identification */ + unsigned char name[80]; /* timer name */ + unsigned long reserved0; /* reserved for future use */ + unsigned long resolution; /* average period resolution in ns */ + unsigned long resolution_min; /* minimal period resolution in ns */ + unsigned long resolution_max; /* maximal period resolution in ns */ + unsigned int clients; /* active timer clients */ + unsigned char reserved[32]; +}; + +struct snd_timer_gparams { + struct snd_timer_id tid; /* requested timer ID */ + unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ + unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ + unsigned char reserved[32]; +}; + +struct snd_timer_gstatus { + struct snd_timer_id tid; /* requested timer ID */ + unsigned long resolution; /* current period resolution in ns */ + unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ + unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ + unsigned char reserved[32]; +}; + +struct snd_timer_select { + struct snd_timer_id id; /* bind to timer ID */ + unsigned char reserved[32]; /* reserved */ +}; + +struct snd_timer_info { + unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ + int card; /* card number */ + unsigned char id[64]; /* timer identificator */ + unsigned char name[80]; /* timer name */ + unsigned long reserved0; /* reserved for future use */ + unsigned long resolution; /* average period resolution in ns */ + unsigned char reserved[64]; /* reserved */ +}; + +#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ +#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ +#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ + +struct snd_timer_params { + unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ + unsigned int ticks; /* requested resolution in ticks */ + unsigned int queue_size; /* total size of queue (32-1024) */ + unsigned int reserved0; /* reserved, was: failure locations */ + unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ + unsigned char reserved[60]; /* reserved */ +}; + +struct snd_timer_status { + struct timespec tstamp; /* Timestamp - last update */ + unsigned int resolution; /* current period resolution in ns */ + unsigned int lost; /* counter of master tick lost */ + unsigned int overrun; /* count of read queue overruns */ + unsigned int queue; /* used queue size */ + unsigned char reserved[64]; /* reserved */ +}; + +#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) +#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) +#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) +#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) +#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) +#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) +#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select) +#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info) +#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params) +#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status) +/* The following four ioctls are changed since 1.0.9 due to confliction */ +#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0) +#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) +#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) +#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) + +struct snd_timer_read { + unsigned int resolution; + unsigned int ticks; +}; + +enum { + SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ + SNDRV_TIMER_EVENT_TICK, /* val = ticks */ + SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ + SNDRV_TIMER_EVENT_STOP, /* val = 0 */ + SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ + SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ + SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ + SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ + SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ + /* master timer events for slave timer instances */ + SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, + SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, + SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, + SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, + SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, + SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, +}; + +struct snd_timer_tread { + int event; + struct timespec tstamp; + unsigned int val; +}; + +/**************************************************************************** + * * + * Section for driver control interface - /dev/snd/control? * + * * + ****************************************************************************/ + +#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) + +struct snd_ctl_card_info { + int card; /* card number */ + int pad; /* reserved for future (was type) */ + unsigned char id[16]; /* ID of card (user selectable) */ + unsigned char driver[16]; /* Driver name */ + unsigned char name[32]; /* Short name of soundcard */ + unsigned char longname[80]; /* name + info text about soundcard */ + unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ + unsigned char mixername[80]; /* visual mixer identification */ + unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ +}; + +typedef int __bitwise snd_ctl_elem_type_t; +#define SNDRV_CTL_ELEM_TYPE_NONE ((snd_ctl_elem_type_t) 0) /* invalid */ +#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((snd_ctl_elem_type_t) 1) /* boolean type */ +#define SNDRV_CTL_ELEM_TYPE_INTEGER ((snd_ctl_elem_type_t) 2) /* integer type */ +#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((snd_ctl_elem_type_t) 3) /* enumerated type */ +#define SNDRV_CTL_ELEM_TYPE_BYTES ((snd_ctl_elem_type_t) 4) /* byte array */ +#define SNDRV_CTL_ELEM_TYPE_IEC958 ((snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ +#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((snd_ctl_elem_type_t) 6) /* 64-bit integer type */ +#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 + +typedef int __bitwise snd_ctl_elem_iface_t; +#define SNDRV_CTL_ELEM_IFACE_CARD ((snd_ctl_elem_iface_t) 0) /* global control */ +#define SNDRV_CTL_ELEM_IFACE_HWDEP ((snd_ctl_elem_iface_t) 1) /* hardware dependent device */ +#define SNDRV_CTL_ELEM_IFACE_MIXER ((snd_ctl_elem_iface_t) 2) /* virtual mixer device */ +#define SNDRV_CTL_ELEM_IFACE_PCM ((snd_ctl_elem_iface_t) 3) /* PCM device */ +#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((snd_ctl_elem_iface_t) 4) /* RawMidi device */ +#define SNDRV_CTL_ELEM_IFACE_TIMER ((snd_ctl_elem_iface_t) 5) /* timer device */ +#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((snd_ctl_elem_iface_t) 6) /* sequencer client */ +#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER + +#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) +#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) +#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) +#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ +#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ +#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ +#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ +#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) +#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ +#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ +#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ +#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ +#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ +#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ +/* bits 30 and 31 are obsoleted (for indirect access) */ + +/* for further details see the ACPI and PCI power management specification */ +#define SNDRV_CTL_POWER_D0 0x0000 /* full On */ +#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ +#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ +#define SNDRV_CTL_POWER_D3 0x0300 /* Off */ +#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ +#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ + +struct snd_ctl_elem_id { + unsigned int numid; /* numeric identifier, zero = invalid */ + snd_ctl_elem_iface_t iface; /* interface identifier */ + unsigned int device; /* device/client number */ + unsigned int subdevice; /* subdevice (substream) number */ + unsigned char name[44]; /* ASCII name of item */ + unsigned int index; /* index of item */ +}; + +struct snd_ctl_elem_list { + unsigned int offset; /* W: first element ID to get */ + unsigned int space; /* W: count of element IDs to get */ + unsigned int used; /* R: count of element IDs set */ + unsigned int count; /* R: count of all elements */ + struct snd_ctl_elem_id *pids; /* R: IDs */ + unsigned char reserved[50]; +}; + +struct snd_ctl_elem_info { + struct snd_ctl_elem_id id; /* W: element ID */ + snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ + unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ + unsigned int count; /* count of values */ + __kernel_pid_t owner; /* owner's PID of this control */ + union { + struct { + long min; /* R: minimum value */ + long max; /* R: maximum value */ + long step; /* R: step (0 variable) */ + } integer; + struct { + long long min; /* R: minimum value */ + long long max; /* R: maximum value */ + long long step; /* R: step (0 variable) */ + } integer64; + struct { + unsigned int items; /* R: number of items */ + unsigned int item; /* W: item number */ + char name[64]; /* R: value name */ + } enumerated; + unsigned char reserved[128]; + } value; + union { + unsigned short d[4]; /* dimensions */ + unsigned short *d_ptr; /* indirect - obsoleted */ + } dimen; + unsigned char reserved[64-4*sizeof(unsigned short)]; +}; + +struct snd_ctl_elem_value { + struct snd_ctl_elem_id id; /* W: element ID */ + unsigned int indirect: 1; /* W: indirect access - obsoleted */ + union { + union { + long value[128]; + long *value_ptr; /* obsoleted */ + } integer; + union { + long long value[64]; + long long *value_ptr; /* obsoleted */ + } integer64; + union { + unsigned int item[128]; + unsigned int *item_ptr; /* obsoleted */ + } enumerated; + union { + unsigned char data[512]; + unsigned char *data_ptr; /* obsoleted */ + } bytes; + struct snd_aes_iec958 iec958; + } value; /* RO */ + struct timespec tstamp; + unsigned char reserved[128-sizeof(struct timespec)]; +}; + +struct snd_ctl_tlv { + unsigned int numid; /* control element numeric identification */ + unsigned int length; /* in bytes aligned to 4 */ + unsigned int tlv[0]; /* first TLV */ +}; + +#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) +#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info) +#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list) +#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info) +#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value) +#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value) +#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id) +#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id) +#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int) +#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info) +#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info) +#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id) +#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv) +#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv) +#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv) +#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int) +#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info) +#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int) +#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info) +#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int) +#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int) +#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info) +#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int) +#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int) +#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int) + +/* + * Read interface. + */ + +enum sndrv_ctl_event_type { + SNDRV_CTL_EVENT_ELEM = 0, + SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, +}; + +#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ +#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ +#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ +#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ +#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ + +struct snd_ctl_event { + int type; /* event type - SNDRV_CTL_EVENT_* */ + union { + struct { + unsigned int mask; + struct snd_ctl_elem_id id; + } elem; + unsigned char data8[60]; + } data; +}; + +/* + * Control names + */ + +#define SNDRV_CTL_NAME_NONE "" +#define SNDRV_CTL_NAME_PLAYBACK "Playback " +#define SNDRV_CTL_NAME_CAPTURE "Capture " + +#define SNDRV_CTL_NAME_IEC958_NONE "" +#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" +#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" +#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" +#define SNDRV_CTL_NAME_IEC958_MASK "Mask" +#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" +#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" +#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" +#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what + +#endif /* __SOUND_ASOUND_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asound_fm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asound_fm.h new file mode 100644 index 0000000..c2a4b96 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/asound_fm.h @@ -0,0 +1,134 @@ +#ifndef __SOUND_ASOUND_FM_H +#define __SOUND_ASOUND_FM_H + +/* + * Advanced Linux Sound Architecture - ALSA + * + * Interface file between ALSA driver & user space + * Copyright (c) 1994-98 by Jaroslav Kysela , + * 4Front Technologies + * + * Direct FM control + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#define SNDRV_DM_FM_MODE_OPL2 0x00 +#define SNDRV_DM_FM_MODE_OPL3 0x01 + +struct snd_dm_fm_info { + unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ + unsigned char rhythm; /* percussion mode flag */ +}; + +/* + * Data structure composing an FM "note" or sound event. + */ + +struct snd_dm_fm_voice { + unsigned char op; /* operator cell (0 or 1) */ + unsigned char voice; /* FM voice (0 to 17) */ + + unsigned char am; /* amplitude modulation */ + unsigned char vibrato; /* vibrato effect */ + unsigned char do_sustain; /* sustain phase */ + unsigned char kbd_scale; /* keyboard scaling */ + unsigned char harmonic; /* 4 bits: harmonic and multiplier */ + unsigned char scale_level; /* 2 bits: decrease output freq rises */ + unsigned char volume; /* 6 bits: volume */ + + unsigned char attack; /* 4 bits: attack rate */ + unsigned char decay; /* 4 bits: decay rate */ + unsigned char sustain; /* 4 bits: sustain level */ + unsigned char release; /* 4 bits: release rate */ + + unsigned char feedback; /* 3 bits: feedback for op0 */ + unsigned char connection; /* 0 for serial, 1 for parallel */ + unsigned char left; /* stereo left */ + unsigned char right; /* stereo right */ + unsigned char waveform; /* 3 bits: waveform shape */ +}; + +/* + * This describes an FM note by its voice, octave, frequency number (10bit) + * and key on/off. + */ + +struct snd_dm_fm_note { + unsigned char voice; /* 0-17 voice channel */ + unsigned char octave; /* 3 bits: what octave to play */ + unsigned int fnum; /* 10 bits: frequency number */ + unsigned char key_on; /* set for active, clear for silent */ +}; + +/* + * FM parameters that apply globally to all voices, and thus are not "notes" + */ + +struct snd_dm_fm_params { + unsigned char am_depth; /* amplitude modulation depth (1=hi) */ + unsigned char vib_depth; /* vibrato depth (1=hi) */ + unsigned char kbd_split; /* keyboard split */ + unsigned char rhythm; /* percussion mode select */ + + /* This block is the percussion instrument data */ + unsigned char bass; + unsigned char snare; + unsigned char tomtom; + unsigned char cymbal; + unsigned char hihat; +}; + +/* + * FM mode ioctl settings + */ + +#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) +#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) +#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) +#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) +#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) +#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) +/* for OPL3 only */ +#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) +/* SBI patch management */ +#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) + +#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 +#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 +#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 +#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 +#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 +#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 + +/* + * Patch Record - fixed size for write + */ + +#define FM_KEY_SBI "SBI\032" +#define FM_KEY_2OP "2OP\032" +#define FM_KEY_4OP "4OP\032" + +struct sbi_patch { + unsigned char prog; + unsigned char bank; + char key[4]; + char name[25]; + char extension[7]; + unsigned char data[32]; +}; + +#endif /* __SOUND_ASOUND_FM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/emu10k1.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/emu10k1.h new file mode 100644 index 0000000..3524a84 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/emu10k1.h @@ -0,0 +1,371 @@ +#ifndef __SOUND_EMU10K1_H +#define __SOUND_EMU10K1_H + +#include + +/* + * Copyright (c) by Jaroslav Kysela , + * Creative Labs, Inc. + * Definitions for EMU10K1 (SB Live!) chips + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +/* + * ---- FX8010 ---- + */ + +#define EMU10K1_CARD_CREATIVE 0x00000000 +#define EMU10K1_CARD_EMUAPS 0x00000001 + +#define EMU10K1_FX8010_PCM_COUNT 8 + +/* instruction set */ +#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */ +#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */ +#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */ +#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */ +#define iMACINT0 0x04 /* R = A + X * Y ; saturation */ +#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */ +#define iACC3 0x06 /* R = A + X + Y ; saturation */ +#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */ +#define iANDXOR 0x08 /* R = (A & X) ^ Y */ +#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */ +#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */ +#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */ +#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */ +#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */ +#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */ +#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */ + +/* GPRs */ +#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */ +#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */ +#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */ +#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */ + /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */ + +#define C_00000000 0x40 +#define C_00000001 0x41 +#define C_00000002 0x42 +#define C_00000003 0x43 +#define C_00000004 0x44 +#define C_00000008 0x45 +#define C_00000010 0x46 +#define C_00000020 0x47 +#define C_00000100 0x48 +#define C_00010000 0x49 +#define C_00080000 0x4a +#define C_10000000 0x4b +#define C_20000000 0x4c +#define C_40000000 0x4d +#define C_80000000 0x4e +#define C_7fffffff 0x4f +#define C_ffffffff 0x50 +#define C_fffffffe 0x51 +#define C_c0000000 0x52 +#define C_4f1bbcdc 0x53 +#define C_5a7ef9db 0x54 +#define C_00100000 0x55 /* ?? */ +#define GPR_ACCU 0x56 /* ACCUM, accumulator */ +#define GPR_COND 0x57 /* CCR, condition register */ +#define GPR_NOISE0 0x58 /* noise source */ +#define GPR_NOISE1 0x59 /* noise source */ +#define GPR_IRQ 0x5a /* IRQ register */ +#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */ +#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ +#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ +#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ +#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ +#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ + +#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ +#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ +#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ +#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ +#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ +#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ + +#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */ +#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */ +#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */ +#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */ +#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */ +#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */ +#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */ +#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */ +#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */ +#define A_GPR(x) (A_FXGPREGBASE + (x)) + +/* cc_reg constants */ +#define CC_REG_NORMALIZED C_00000001 +#define CC_REG_BORROW C_00000002 +#define CC_REG_MINUS C_00000004 +#define CC_REG_ZERO C_00000008 +#define CC_REG_SATURATE C_00000010 +#define CC_REG_NONZERO C_00000100 + +/* FX buses */ +#define FXBUS_PCM_LEFT 0x00 +#define FXBUS_PCM_RIGHT 0x01 +#define FXBUS_PCM_LEFT_REAR 0x02 +#define FXBUS_PCM_RIGHT_REAR 0x03 +#define FXBUS_MIDI_LEFT 0x04 +#define FXBUS_MIDI_RIGHT 0x05 +#define FXBUS_PCM_CENTER 0x06 +#define FXBUS_PCM_LFE 0x07 +#define FXBUS_PCM_LEFT_FRONT 0x08 +#define FXBUS_PCM_RIGHT_FRONT 0x09 +#define FXBUS_MIDI_REVERB 0x0c +#define FXBUS_MIDI_CHORUS 0x0d +#define FXBUS_PCM_LEFT_SIDE 0x0e +#define FXBUS_PCM_RIGHT_SIDE 0x0f +#define FXBUS_PT_LEFT 0x14 +#define FXBUS_PT_RIGHT 0x15 + +/* Inputs */ +#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ +#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ +#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */ +#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */ +#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */ +#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */ +#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */ +#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */ +#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */ +#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */ +#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */ +#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */ +#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */ +#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */ + +/* Outputs */ +#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */ +#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */ +#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */ +#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */ +#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */ +#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */ +#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */ +#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */ +#define EXTOUT_REAR_L 0x08 /* Rear channel - left */ +#define EXTOUT_REAR_R 0x09 /* Rear channel - right */ +#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */ +#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */ +#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */ +#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */ +#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */ +#define EXTOUT_ACENTER 0x11 /* Analog Center */ +#define EXTOUT_ALFE 0x12 /* Analog LFE */ + +/* Audigy Inputs */ +#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ +#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ +#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ +#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ +#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ +#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ +#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ +#define A_EXTIN_LINE2_R 0x09 /* right */ +#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ +#define A_EXTIN_ADC_R 0x0b /* right */ +#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */ +#define A_EXTIN_AUX2_R 0x0d /* - right */ + +/* Audigiy Outputs */ +#define A_EXTOUT_FRONT_L 0x00 /* digital front left */ +#define A_EXTOUT_FRONT_R 0x01 /* right */ +#define A_EXTOUT_CENTER 0x02 /* digital front center */ +#define A_EXTOUT_LFE 0x03 /* digital front lfe */ +#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */ +#define A_EXTOUT_HEADPHONE_R 0x05 /* right */ +#define A_EXTOUT_REAR_L 0x06 /* digital rear left */ +#define A_EXTOUT_REAR_R 0x07 /* right */ +#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */ +#define A_EXTOUT_AFRONT_R 0x09 /* right */ +#define A_EXTOUT_ACENTER 0x0a /* analog center */ +#define A_EXTOUT_ALFE 0x0b /* analog LFE */ +#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */ +#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */ +#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */ +#define A_EXTOUT_AREAR_R 0x0f /* right */ +#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */ +#define A_EXTOUT_AC97_R 0x11 /* right */ +#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */ +#define A_EXTOUT_ADC_CAP_R 0x17 /* right */ +#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */ + +/* Audigy constants */ +#define A_C_00000000 0xc0 +#define A_C_00000001 0xc1 +#define A_C_00000002 0xc2 +#define A_C_00000003 0xc3 +#define A_C_00000004 0xc4 +#define A_C_00000008 0xc5 +#define A_C_00000010 0xc6 +#define A_C_00000020 0xc7 +#define A_C_00000100 0xc8 +#define A_C_00010000 0xc9 +#define A_C_00000800 0xca +#define A_C_10000000 0xcb +#define A_C_20000000 0xcc +#define A_C_40000000 0xcd +#define A_C_80000000 0xce +#define A_C_7fffffff 0xcf +#define A_C_ffffffff 0xd0 +#define A_C_fffffffe 0xd1 +#define A_C_c0000000 0xd2 +#define A_C_4f1bbcdc 0xd3 +#define A_C_5a7ef9db 0xd4 +#define A_C_00100000 0xd5 +#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */ +#define A_GPR_COND 0xd7 /* CCR, condition register */ +#define A_GPR_NOISE0 0xd8 /* noise source */ +#define A_GPR_NOISE1 0xd9 /* noise source */ +#define A_GPR_IRQ 0xda /* IRQ register */ +#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */ +#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */ + +/* definitions for debug register */ +#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */ +#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */ +#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */ +#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */ +#define EMU10K1_DBG_STEP 0x00004000 /* start single step */ +#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */ +#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */ + +/* tank memory address line */ +#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */ +#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */ +#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */ +#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */ +#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ + +struct snd_emu10k1_fx8010_info { + unsigned int internal_tram_size; /* in samples */ + unsigned int external_tram_size; /* in samples */ + char fxbus_names[16][32]; /* names of FXBUSes */ + char extin_names[16][32]; /* names of external inputs */ + char extout_names[32][32]; /* names of external outputs */ + unsigned int gpr_controls; /* count of GPR controls */ +}; + +#define EMU10K1_GPR_TRANSLATION_NONE 0 +#define EMU10K1_GPR_TRANSLATION_TABLE100 1 +#define EMU10K1_GPR_TRANSLATION_BASS 2 +#define EMU10K1_GPR_TRANSLATION_TREBLE 3 +#define EMU10K1_GPR_TRANSLATION_ONOFF 4 + +struct snd_emu10k1_fx8010_control_gpr { + struct snd_ctl_elem_id id; /* full control ID definition */ + unsigned int vcount; /* visible count */ + unsigned int count; /* count of GPR (1..16) */ + unsigned short gpr[32]; /* GPR number(s) */ + unsigned int value[32]; /* initial values */ + unsigned int min; /* minimum range */ + unsigned int max; /* maximum range */ + unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ + const unsigned int *tlv; +}; + +/* old ABI without TLV support */ +struct snd_emu10k1_fx8010_control_old_gpr { + struct snd_ctl_elem_id id; + unsigned int vcount; + unsigned int count; + unsigned short gpr[32]; + unsigned int value[32]; + unsigned int min; + unsigned int max; + unsigned int translation; +}; + +struct snd_emu10k1_fx8010_code { + char name[128]; + + DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ + __u32 *gpr_map; /* initializers */ + + unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ + struct snd_emu10k1_fx8010_control_gpr *gpr_add_controls; /* GPR controls to add/replace */ + + unsigned int gpr_del_control_count; /* count of GPR controls to remove */ + struct snd_ctl_elem_id *gpr_del_controls; /* IDs of GPR controls to remove */ + + unsigned int gpr_list_control_count; /* count of GPR controls to list */ + unsigned int gpr_list_control_total; /* total count of GPR controls */ + struct snd_emu10k1_fx8010_control_gpr *gpr_list_controls; /* listed GPR controls */ + + DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ + __u32 *tram_data_map; /* data initializers */ + __u32 *tram_addr_map; /* map initializers */ + + DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ + __u32 *code; /* one instruction - 64 bits */ +}; + +struct snd_emu10k1_fx8010_tram { + unsigned int address; /* 31.bit == 1 -> external TRAM */ + unsigned int size; /* size in samples (4 bytes) */ + unsigned int *samples; /* pointer to samples (20-bit) */ + /* NULL->clear memory */ +}; + +struct snd_emu10k1_fx8010_pcm_rec { + unsigned int substream; /* substream number */ + unsigned int res1; /* reserved */ + unsigned int channels; /* 16-bit channels count, zero = remove this substream */ + unsigned int tram_start; /* ring buffer position in TRAM (in samples) */ + unsigned int buffer_size; /* count of buffered samples */ + unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */ + unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */ + unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */ + unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */ + unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ + unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ + unsigned char pad; /* reserved */ + unsigned char etram[32]; /* external TRAM address & data (one per channel) */ + unsigned int res2; /* reserved */ +}; + +#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) + +#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) +#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) +#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) +#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) +#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram) +#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) +#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) +#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) +#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int) +#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) +#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) +#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) +#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) +#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) + +/* typedefs for compatibility to user-space */ +typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t; +typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t; +typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t; +typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t; +typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t; + +#endif /* __SOUND_EMU10K1_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/hdsp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/hdsp.h new file mode 100644 index 0000000..ec6fa56 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/hdsp.h @@ -0,0 +1,109 @@ +#ifndef __SOUND_HDSP_H +#define __SOUND_HDSP_H + +/* + * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#define HDSP_MATRIX_MIXER_SIZE 2048 + +enum HDSP_IO_Type { + Digiface, + Multiface, + H9652, + H9632, + Undefined, +}; + +struct hdsp_peak_rms { + __u32 input_peaks[26]; + __u32 playback_peaks[26]; + __u32 output_peaks[28]; + __u64 input_rms[26]; + __u64 playback_rms[26]; + /* These are only used for H96xx cards */ + __u64 output_rms[26]; +}; + +#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms) + +struct hdsp_config_info { + unsigned char pref_sync_ref; + unsigned char wordclock_sync_check; + unsigned char spdif_sync_check; + unsigned char adatsync_sync_check; + unsigned char adat_sync_check[3]; + unsigned char spdif_in; + unsigned char spdif_out; + unsigned char spdif_professional; + unsigned char spdif_emphasis; + unsigned char spdif_nonaudio; + unsigned int spdif_sample_rate; + unsigned int system_sample_rate; + unsigned int autosync_sample_rate; + unsigned char system_clock_mode; + unsigned char clock_source; + unsigned char autosync_ref; + unsigned char line_out; + unsigned char passthru; + unsigned char da_gain; + unsigned char ad_gain; + unsigned char phone_gain; + unsigned char xlr_breakout_cable; + unsigned char analog_extension_board; +}; + +#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info) + +struct hdsp_firmware { + void *firmware_data; /* 24413 x 4 bytes */ +}; + +#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware) + +struct hdsp_version { + enum HDSP_IO_Type io_type; + unsigned short firmware_rev; +}; + +#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version) + +struct hdsp_mixer { + unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; +}; + +#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer) + +struct hdsp_9632_aeb { + int aebi; + int aebo; +}; + +#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) + +/* typedefs for compatibility to user-space */ +typedef enum HDSP_IO_Type HDSP_IO_Type; +typedef struct hdsp_peak_rms hdsp_peak_rms_t; +typedef struct hdsp_config_info hdsp_config_info_t; +typedef struct hdsp_firmware hdsp_firmware_t; +typedef struct hdsp_version hdsp_version_t; +typedef struct hdsp_mixer hdsp_mixer_t; +typedef struct hdsp_9632_aeb hdsp_9632_aeb_t; + +#endif /* __SOUND_HDSP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/hdspm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/hdspm.h new file mode 100644 index 0000000..81990b2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/hdspm.h @@ -0,0 +1,134 @@ +#ifndef __SOUND_HDSPM_H +#define __SOUND_HDSPM_H +/* + * Copyright (C) 2003 Winfried Ritsch (IEM) + * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ +#define HDSPM_MAX_CHANNELS 64 + +/* -------------------- IOCTL Peak/RMS Meters -------------------- */ + +/* peam rms level structure like we get from hardware + + maybe in future we can memory map it so I just copy it + to user on ioctl call now an dont change anything + rms are made out of low and high values + where (long) ????_rms = (????_rms_l >> 8) + ((????_rms_h & 0xFFFFFF00)<<24) + (i asume so from the code) +*/ + +struct hdspm_peak_rms { + + unsigned int level_offset[1024]; + + unsigned int input_peak[64]; + unsigned int playback_peak[64]; + unsigned int output_peak[64]; + unsigned int xxx_peak[64]; /* not used */ + + unsigned int reserved[256]; /* not used */ + + unsigned int input_rms_l[64]; + unsigned int playback_rms_l[64]; + unsigned int output_rms_l[64]; + unsigned int xxx_rms_l[64]; /* not used */ + + unsigned int input_rms_h[64]; + unsigned int playback_rms_h[64]; + unsigned int output_rms_h[64]; + unsigned int xxx_rms_h[64]; /* not used */ +}; + +struct hdspm_peak_rms_ioctl { + struct hdspm_peak_rms *peak; +}; + +/* use indirect access due to the limit of ioctl bit size */ +#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ + _IOR('H', 0x40, struct hdspm_peak_rms_ioctl) + +/* ------------ CONFIG block IOCTL ---------------------- */ + +struct hdspm_config_info { + unsigned char pref_sync_ref; + unsigned char wordclock_sync_check; + unsigned char madi_sync_check; + unsigned int system_sample_rate; + unsigned int autosync_sample_rate; + unsigned char system_clock_mode; + unsigned char clock_source; + unsigned char autosync_ref; + unsigned char line_out; + unsigned int passthru; + unsigned int analog_out; +}; + +#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO \ + _IOR('H', 0x41, struct hdspm_config_info) + + +/* get Soundcard Version */ + +struct hdspm_version { + unsigned short firmware_rev; +}; + +#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version) + + +/* ------------- get Matrix Mixer IOCTL --------------- */ + +/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = + * 32768 Bytes + */ + +/* organisation is 64 channelfader in a continous memory block */ +/* equivalent to hardware definition, maybe for future feature of mmap of + * them + */ +/* each of 64 outputs has 64 infader and 64 outfader: + Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ + +#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS + +struct hdspm_channelfader { + unsigned int in[HDSPM_MIXER_CHANNELS]; + unsigned int pb[HDSPM_MIXER_CHANNELS]; +}; + +struct hdspm_mixer { + struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; +}; + +struct hdspm_mixer_ioctl { + struct hdspm_mixer *mixer; +}; + +/* use indirect access due to the limit of ioctl bit size */ +#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) + +/* typedefs for compatibility to user-space */ +typedef struct hdspm_peak_rms hdspm_peak_rms_t; +typedef struct hdspm_config_info hdspm_config_info_t; +typedef struct hdspm_version hdspm_version_t; +typedef struct hdspm_channelfader snd_hdspm_channelfader_t; +typedef struct hdspm_mixer hdspm_mixer_t; + +#endif /* __SOUND_HDSPM_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sb16_csp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sb16_csp.h new file mode 100644 index 0000000..50a351f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sb16_csp.h @@ -0,0 +1,115 @@ +#ifndef __SOUND_SB16_CSP_H +#define __SOUND_SB16_CSP_H + +/* + * Copyright (c) 1999 by Uros Bizjak + * Takashi Iwai + * + * SB16ASP/AWE32 CSP control + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* CSP modes */ +#define SNDRV_SB_CSP_MODE_NONE 0x00 +#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */ +#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */ +#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */ + +/* CSP load flags */ +#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01 +#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02 + +/* CSP sample width */ +#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01 +#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02 + +/* CSP channels */ +#define SNDRV_SB_CSP_MONO 0x01 +#define SNDRV_SB_CSP_STEREO 0x02 + +/* CSP rates */ +#define SNDRV_SB_CSP_RATE_8000 0x01 +#define SNDRV_SB_CSP_RATE_11025 0x02 +#define SNDRV_SB_CSP_RATE_22050 0x04 +#define SNDRV_SB_CSP_RATE_44100 0x08 +#define SNDRV_SB_CSP_RATE_ALL 0x0f + +/* CSP running state */ +#define SNDRV_SB_CSP_ST_IDLE 0x00 +#define SNDRV_SB_CSP_ST_LOADED 0x01 +#define SNDRV_SB_CSP_ST_RUNNING 0x02 +#define SNDRV_SB_CSP_ST_PAUSED 0x04 +#define SNDRV_SB_CSP_ST_AUTO 0x08 +#define SNDRV_SB_CSP_ST_QSOUND 0x10 + +/* maximum QSound value (180 degrees right) */ +#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20 + +/* maximum microcode RIFF file size */ +#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 + +/* microcode header */ +struct snd_sb_csp_mc_header { + char codec_name[16]; /* id name of codec */ + unsigned short func_req; /* requested function */ +}; + +/* microcode to be loaded */ +struct snd_sb_csp_microcode { + struct snd_sb_csp_mc_header info; + unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; +}; + +/* start CSP with sample_width in mono/stereo */ +struct snd_sb_csp_start { + int sample_width; /* sample width, look above */ + int channels; /* channels, look above */ +}; + +/* CSP information */ +struct snd_sb_csp_info { + char codec_name[16]; /* id name of codec */ + unsigned short func_nr; /* function number */ + unsigned int acc_format; /* accepted PCM formats */ + unsigned short acc_channels; /* accepted channels */ + unsigned short acc_width; /* accepted sample width */ + unsigned short acc_rates; /* accepted sample rates */ + unsigned short csp_mode; /* CSP mode, see above */ + unsigned short run_channels; /* current channels */ + unsigned short run_width; /* current sample width */ + unsigned short version; /* version id: 0x10 - 0x1f */ + unsigned short state; /* state bits */ +}; + +/* HWDEP controls */ +/* get CSP information */ +#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) +/* load microcode to CSP */ +#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, struct snd_sb_csp_microcode) +/* unload microcode from CSP */ +#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) +/* start CSP */ +#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) +/* stop CSP */ +#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) +/* pause CSP and DMA transfer */ +#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15) +/* restart CSP and DMA transfer */ +#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) + + +#endif /* __SOUND_SB16_CSP */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sfnt_info.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sfnt_info.h new file mode 100644 index 0000000..1bce7fd --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sfnt_info.h @@ -0,0 +1,212 @@ +#ifndef __SOUND_SFNT_INFO_H +#define __SOUND_SFNT_INFO_H + +/* + * Patch record compatible with AWE driver on OSS + * + * Copyright (C) 1999-2000 Takashi Iwai + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include + +/* + * patch information record + */ + +#ifdef SNDRV_BIG_ENDIAN +#define SNDRV_OSS_PATCHKEY(id) (0xfd00|id) +#else +#define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd) +#endif + +/* patch interface header: 16 bytes */ +struct soundfont_patch_info { + unsigned short key; /* use the key below */ +#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) + + short device_no; /* synthesizer number */ + unsigned short sf_id; /* file id (should be zero) */ + short optarg; /* optional argument */ + int len; /* data length (without this header) */ + + short type; /* patch operation type */ +#define SNDRV_SFNT_LOAD_INFO 0 /* awe_voice_rec */ +#define SNDRV_SFNT_LOAD_DATA 1 /* awe_sample_info */ +#define SNDRV_SFNT_OPEN_PATCH 2 /* awe_open_parm */ +#define SNDRV_SFNT_CLOSE_PATCH 3 /* none */ + /* 4 is obsolete */ +#define SNDRV_SFNT_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/ +#define SNDRV_SFNT_MAP_PRESET 6 /* awe_voice_map */ + /* 7 is not used */ +#define SNDRV_SFNT_PROBE_DATA 8 /* optarg=sample */ +#define SNDRV_SFNT_REMOVE_INFO 9 /* optarg=(bank<<8)|instr */ + + short reserved; /* word alignment data */ + + /* the actual patch data begins after this */ +}; + + +/* + * open patch + */ + +#define SNDRV_SFNT_PATCH_NAME_LEN 32 + +struct soundfont_open_parm { + unsigned short type; /* sample type */ +#define SNDRV_SFNT_PAT_TYPE_MISC 0 +#define SNDRV_SFNT_PAT_TYPE_GUS 6 +#define SNDRV_SFNT_PAT_TYPE_MAP 7 +#define SNDRV_SFNT_PAT_LOCKED 0x100 /* lock the samples */ +#define SNDRV_SFNT_PAT_SHARED 0x200 /* sample is shared */ + + short reserved; + char name[SNDRV_SFNT_PATCH_NAME_LEN]; +}; + + +/* + * raw voice information record + */ + +/* wave table envelope & effect parameters to control EMU8000 */ +struct soundfont_voice_parm { + unsigned short moddelay; /* modulation delay (0x8000) */ + unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ + unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ + unsigned short modrelease; /* modulation release time (0x807f) */ + short modkeyhold, modkeydecay; /* envelope change per key (not used) */ + unsigned short voldelay; /* volume delay (0x8000) */ + unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */ + unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */ + unsigned short volrelease; /* volume release time (0x807f) */ + short volkeyhold, volkeydecay; /* envelope change per key (not used) */ + unsigned short lfo1delay; /* LFO1 delay (0x8000) */ + unsigned short lfo2delay; /* LFO2 delay (0x8000) */ + unsigned short pefe; /* modulation pitch & cutoff (0x0000) */ + unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */ + unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */ + unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */ + unsigned char cutoff; /* initial cutoff (0xff) */ + unsigned char filterQ; /* initial filter Q [0-15] (0x0) */ + unsigned char chorus; /* chorus send (0x00) */ + unsigned char reverb; /* reverb send (0x00) */ + unsigned short reserved[4]; /* not used */ +}; + + +/* wave table parameters: 92 bytes */ +struct soundfont_voice_info { + unsigned short sf_id; /* file id (should be zero) */ + unsigned short sample; /* sample id */ + int start, end; /* sample offset correction */ + int loopstart, loopend; /* loop offset correction */ + short rate_offset; /* sample rate pitch offset */ + unsigned short mode; /* sample mode */ +#define SNDRV_SFNT_MODE_ROMSOUND 0x8000 +#define SNDRV_SFNT_MODE_STEREO 1 +#define SNDRV_SFNT_MODE_LOOPING 2 +#define SNDRV_SFNT_MODE_NORELEASE 4 /* obsolete */ +#define SNDRV_SFNT_MODE_INIT_PARM 8 + + short root; /* midi root key */ + short tune; /* pitch tuning (in cents) */ + unsigned char low, high; /* key note range */ + unsigned char vellow, velhigh; /* velocity range */ + signed char fixkey, fixvel; /* fixed key, velocity */ + signed char pan, fixpan; /* panning, fixed panning */ + short exclusiveClass; /* exclusive class (0 = none) */ + unsigned char amplitude; /* sample volume (127 max) */ + unsigned char attenuation; /* attenuation (0.375dB) */ + short scaleTuning; /* pitch scale tuning(%), normally 100 */ + struct soundfont_voice_parm parm; /* voice envelope parameters */ + unsigned short sample_mode; /* sample mode_flag (set by driver) */ +}; + + +/* instrument info header: 4 bytes */ +struct soundfont_voice_rec_hdr { + unsigned char bank; /* midi bank number */ + unsigned char instr; /* midi preset number */ + char nvoices; /* number of voices */ + char write_mode; /* write mode; normally 0 */ +#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ +#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ +#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ +}; + + +/* + * sample wave information + */ + +/* wave table sample header: 32 bytes */ +struct soundfont_sample_info { + unsigned short sf_id; /* file id (should be zero) */ + unsigned short sample; /* sample id */ + int start, end; /* start & end offset */ + int loopstart, loopend; /* loop start & end offset */ + int size; /* size (0 = ROM) */ + short dummy; /* not used */ + unsigned short mode_flags; /* mode flags */ +#define SNDRV_SFNT_SAMPLE_8BITS 1 /* wave data is 8bits */ +#define SNDRV_SFNT_SAMPLE_UNSIGNED 2 /* wave data is unsigned */ +#define SNDRV_SFNT_SAMPLE_NO_BLANK 4 /* no blank loop is attached */ +#define SNDRV_SFNT_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */ +#define SNDRV_SFNT_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */ +#define SNDRV_SFNT_SAMPLE_STEREO_LEFT 32 /* stereo left sound */ +#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ +#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ + unsigned int truesize; /* used memory size (set by driver) */ +}; + + +/* + * voice preset mapping (aliasing) + */ + +struct soundfont_voice_map { + int map_bank, map_instr, map_key; /* key = -1 means all keys */ + int src_bank, src_instr, src_key; +}; + + +/* + * ioctls for hwdep + */ + +#define SNDRV_EMUX_HWDEP_NAME "Emux WaveTable" + +#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ + +struct snd_emux_misc_mode { + int port; /* -1 = all */ + int mode; + int value; + int value2; /* reserved */ +}; + +#define SNDRV_EMUX_IOCTL_VERSION _IOR('H', 0x80, unsigned int) +#define SNDRV_EMUX_IOCTL_LOAD_PATCH _IOWR('H', 0x81, struct soundfont_patch_info) +#define SNDRV_EMUX_IOCTL_RESET_SAMPLES _IO('H', 0x82) +#define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83) +#define SNDRV_EMUX_IOCTL_MEM_AVAIL _IOW('H', 0x84, int) +#define SNDRV_EMUX_IOCTL_MISC_MODE _IOWR('H', 0x84, struct snd_emux_misc_mode) + +#endif /* __SOUND_SFNT_INFO_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sscape_ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sscape_ioctl.h new file mode 100644 index 0000000..c6653eb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sound/sscape_ioctl.h @@ -0,0 +1,21 @@ +#ifndef SSCAPE_IOCTL_H +#define SSCAPE_IOCTL_H + + +struct sscape_bootblock +{ + unsigned char code[256]; + unsigned version; +}; + +#define SSCAPE_MICROCODE_SIZE 65536 + +struct sscape_microcode +{ + unsigned char *code; +}; + +#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock) +#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode) + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdint.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdint.h new file mode 100644 index 0000000..2f4020e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdint.h @@ -0,0 +1,332 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99: 7.18 Integer types + */ + +#ifndef _STDINT_H +#define _STDINT_H 1 + +#include +#ifdef __UCLIBC_HAS_WCHAR__ +#include +#endif /* __UCLIBC_HAS_WCHAR__ */ +#include + +/* Exact integral types. */ + +/* Signed. */ + +/* There is some amount of overlap with as known by inet code */ +#ifndef __int8_t_defined +# define __int8_t_defined +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +# if __WORDSIZE == 64 +typedef long int int64_t; +# else +__extension__ +typedef long long int int64_t; +# endif +#endif + +/* Unsigned. */ +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +# define __uint32_t_defined +#endif +#if __WORDSIZE == 64 +typedef unsigned long int uint64_t; +#else +__extension__ +typedef unsigned long long int uint64_t; +#endif + + +/* Small types. */ + +/* Signed. */ +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; +#if __WORDSIZE == 64 +typedef long int int_least64_t; +#else +__extension__ +typedef long long int int_least64_t; +#endif + +/* Unsigned. */ +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; +#if __WORDSIZE == 64 +typedef unsigned long int uint_least64_t; +#else +__extension__ +typedef unsigned long long int uint_least64_t; +#endif + + +/* Fast types. */ + +/* Signed. */ +typedef signed char int_fast8_t; +#if __WORDSIZE == 64 +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +#else +typedef int int_fast16_t; +typedef int int_fast32_t; +__extension__ +typedef long long int int_fast64_t; +#endif + +/* Unsigned. */ +typedef unsigned char uint_fast8_t; +#if __WORDSIZE == 64 +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +#else +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; +__extension__ +typedef unsigned long long int uint_fast64_t; +#endif + + +/* Types for `void *' pointers. */ +#if __WORDSIZE == 64 +# ifndef __intptr_t_defined +typedef long int intptr_t; +# define __intptr_t_defined +# endif +typedef unsigned long int uintptr_t; +#else +# ifndef __intptr_t_defined +typedef int intptr_t; +# define __intptr_t_defined +# endif +typedef unsigned int uintptr_t; +#endif + + +/* Largest integral types. */ +#if __WORDSIZE == 64 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +#else +__extension__ +typedef long long int intmax_t; +__extension__ +typedef unsigned long long int uintmax_t; +#endif + + +/* The ISO C99 standard specifies that in C++ implementations these + macros should only be defined if explicitly requested. */ +#if !defined __cplusplus || defined __STDC_LIMIT_MACROS + +# if __WORDSIZE == 64 +# define __INT64_C(c) c ## L +# define __UINT64_C(c) c ## UL +# else +# define __INT64_C(c) c ## LL +# define __UINT64_C(c) c ## ULL +# endif + +/* Limits of integral types. */ + +/* Minimum of signed integral types. */ +# define INT8_MIN (-128) +# define INT16_MIN (-32767-1) +# define INT32_MIN (-2147483647-1) +# define INT64_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum of signed integral types. */ +# define INT8_MAX (127) +# define INT16_MAX (32767) +# define INT32_MAX (2147483647) +# define INT64_MAX (__INT64_C(9223372036854775807)) + +/* Maximum of unsigned integral types. */ +# define UINT8_MAX (255) +# define UINT16_MAX (65535) +# define UINT32_MAX (4294967295U) +# define UINT64_MAX (__UINT64_C(18446744073709551615)) + + +/* Minimum of signed integral types having a minimum size. */ +# define INT_LEAST8_MIN (-128) +# define INT_LEAST16_MIN (-32767-1) +# define INT_LEAST32_MIN (-2147483647-1) +# define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum of signed integral types having a minimum size. */ +# define INT_LEAST8_MAX (127) +# define INT_LEAST16_MAX (32767) +# define INT_LEAST32_MAX (2147483647) +# define INT_LEAST64_MAX (__INT64_C(9223372036854775807)) + +/* Maximum of unsigned integral types having a minimum size. */ +# define UINT_LEAST8_MAX (255) +# define UINT_LEAST16_MAX (65535) +# define UINT_LEAST32_MAX (4294967295U) +# define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615)) + + +/* Minimum of fast signed integral types having a minimum size. */ +# define INT_FAST8_MIN (-128) +# if __WORDSIZE == 64 +# define INT_FAST16_MIN (-9223372036854775807L-1) +# define INT_FAST32_MIN (-9223372036854775807L-1) +# else +# define INT_FAST16_MIN (-2147483647-1) +# define INT_FAST32_MIN (-2147483647-1) +# endif +# define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum of fast signed integral types having a minimum size. */ +# define INT_FAST8_MAX (127) +# if __WORDSIZE == 64 +# define INT_FAST16_MAX (9223372036854775807L) +# define INT_FAST32_MAX (9223372036854775807L) +# else +# define INT_FAST16_MAX (2147483647) +# define INT_FAST32_MAX (2147483647) +# endif +# define INT_FAST64_MAX (__INT64_C(9223372036854775807)) + +/* Maximum of fast unsigned integral types having a minimum size. */ +# define UINT_FAST8_MAX (255) +# if __WORDSIZE == 64 +# define UINT_FAST16_MAX (18446744073709551615UL) +# define UINT_FAST32_MAX (18446744073709551615UL) +# else +# define UINT_FAST16_MAX (4294967295U) +# define UINT_FAST32_MAX (4294967295U) +# endif +# define UINT_FAST64_MAX (__UINT64_C(18446744073709551615)) + + +/* Values to test for integral types holding `void *' pointer. */ +# if __WORDSIZE == 64 +# define INTPTR_MIN (-9223372036854775807L-1) +# define INTPTR_MAX (9223372036854775807L) +# define UINTPTR_MAX (18446744073709551615UL) +# else +# define INTPTR_MIN (-2147483647-1) +# define INTPTR_MAX (2147483647) +# define UINTPTR_MAX (4294967295U) +# endif + +#if !defined(__H8300H__) && !defined(__H8300S__) +/* Minimum for largest signed integral type. */ +# define INTMAX_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum for largest signed integral type. */ +# define INTMAX_MAX (__INT64_C(9223372036854775807)) + +/* Maximum for largest unsigned integral type. */ +# define UINTMAX_MAX (__UINT64_C(18446744073709551615)) +#else +/* Minimum for largest signed integral type. */ +# define INTMAX_MIN (-LONG_LONG_MAX-1) +/* Maximum for largest signed integral type. */ +# define INTMAX_MAX (LONG_LONG_MAX) + +/* Maximum for largest unsigned integral type. */ +# define UINTMAX_MAX (LONG_LONG_MAX<<1+1) +#endif + +/* Limits of other integer types. */ + +/* Limits of `ptrdiff_t' type. */ +# if __WORDSIZE == 64 +# define PTRDIFF_MIN (-9223372036854775807L-1) +# define PTRDIFF_MAX (9223372036854775807L) +# else +# define PTRDIFF_MIN (-2147483647-1) +# define PTRDIFF_MAX (2147483647) +# endif + +/* Limits of `sig_atomic_t'. */ +# define SIG_ATOMIC_MIN (-2147483647-1) +# define SIG_ATOMIC_MAX (2147483647) + +/* Limit of `size_t' type. */ +# if __WORDSIZE == 64 +# define SIZE_MAX (18446744073709551615UL) +# else +# define SIZE_MAX (4294967295U) +# endif + +#ifdef __UCLIBC_HAS_WCHAR__ +/* Limits of `wchar_t'. */ +# ifndef WCHAR_MIN +/* These constants might also be defined in . */ +# define WCHAR_MIN __WCHAR_MIN +# define WCHAR_MAX __WCHAR_MAX +# endif + +/* Limits of `wint_t'. */ +# define WINT_MIN (0u) +# define WINT_MAX (4294967295u) +#endif /* __UCLIBC_HAS_WCHAR__ */ + +#endif /* C++ && limit macros */ + + +/* The ISO C99 standard specifies that in C++ implementations these + should only be defined if explicitly requested. */ +#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS + +/* Signed. */ +# define INT8_C(c) c +# define INT16_C(c) c +# define INT32_C(c) c +# if __WORDSIZE == 64 +# define INT64_C(c) c ## L +# else +# define INT64_C(c) c ## LL +# endif + +/* Unsigned. */ +# define UINT8_C(c) c ## U +# define UINT16_C(c) c ## U +# define UINT32_C(c) c ## U +# if __WORDSIZE == 64 +# define UINT64_C(c) c ## UL +# else +# define UINT64_C(c) c ## ULL +# endif + +/* Maximal type. */ +# if __WORDSIZE == 64 +# define INTMAX_C(c) c ## L +# define UINTMAX_C(c) c ## UL +# else +# define INTMAX_C(c) c ## LL +# define UINTMAX_C(c) c ## ULL +# endif + +#endif /* C++ && constant macros */ + +#endif /* stdint.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio.h new file mode 100644 index 0000000..fd2a738 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio.h @@ -0,0 +1,873 @@ +/* + Copyright (C) 1991,1994-2002,2003,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.19 Input/output + */ + +#ifndef _STDIO_H + +#if !defined __need_FILE && !defined __need___FILE +# define _STDIO_H 1 +# include + +__BEGIN_DECLS + +# define __need_size_t +# define __need_NULL +# include + +# include +# define __need_FILE +# define __need___FILE +#endif /* Don't need FILE. */ + + +#if !defined __FILE_defined && defined __need_FILE + +__BEGIN_NAMESPACE_STD +/* The opaque type of streams. This is the definition used elsewhere. */ +typedef struct __STDIO_FILE_STRUCT FILE; +__END_NAMESPACE_STD +#if defined __USE_LARGEFILE64 || defined __USE_SVID || defined __USE_POSIX \ + || defined __USE_BSD || defined __USE_ISOC99 || defined __USE_XOPEN \ + || defined __USE_POSIX2 +__USING_NAMESPACE_STD(FILE) +#endif + +# define __FILE_defined 1 +#endif /* FILE not defined. */ +#undef __need_FILE + + +#if !defined ____FILE_defined && defined __need___FILE + +/* The opaque type of streams. This is the definition used elsewhere. */ +typedef struct __STDIO_FILE_STRUCT __FILE; + +# define ____FILE_defined 1 +#endif /* __FILE not defined. */ +#undef __need___FILE + + +#ifdef _STDIO_H +#undef _STDIO_USES_IOSTREAM + +#include + +/* This define avoids name pollution if we're using GNU stdarg.h */ +# define __need___va_list +#include + +/* The type of the second argument to `fgetpos' and `fsetpos'. */ +__BEGIN_NAMESPACE_STD +#ifndef __USE_FILE_OFFSET64 +typedef __STDIO_fpos_t fpos_t; +#else +typedef __STDIO_fpos64_t fpos_t; +#endif +__END_NAMESPACE_STD +#ifdef __USE_LARGEFILE64 +typedef __STDIO_fpos64_t fpos64_t; +#endif + +/* The possibilities for the third argument to `setvbuf'. */ +#define _IOFBF __STDIO_IOFBF /* Fully buffered. */ +#define _IOLBF __STDIO_IOLBF /* Line buffered. */ +#define _IONBF __STDIO_IONBF /* No buffering. */ + + +/* Default buffer size. */ +#ifndef BUFSIZ +# define BUFSIZ __STDIO_BUFSIZ +#endif + + +/* End of file character. + Some things throughout the library rely on this being -1. */ +#ifndef EOF +# define EOF (-1) +#endif + + +/* The possibilities for the third argument to `fseek'. + These values should not be changed. */ +#define SEEK_SET 0 /* Seek from beginning of file. */ +#define SEEK_CUR 1 /* Seek from current position. */ +#define SEEK_END 2 /* Seek from end of file. */ + + +#if defined __USE_SVID || defined __USE_XOPEN +/* Default path prefix for `tempnam' and `tmpnam'. */ +# define P_tmpdir "/tmp" +#endif + + +/* Get the values: + L_tmpnam How long an array of chars must be to be passed to `tmpnam'. + TMP_MAX The minimum number of unique filenames generated by tmpnam + (and tempnam when it uses tmpnam's name space), + or tempnam (the two are separate). + L_ctermid How long an array to pass to `ctermid'. + L_cuserid How long an array to pass to `cuserid'. + FOPEN_MAX Minimum number of files that can be open at once. + FILENAME_MAX Maximum length of a filename. */ +#include + + +/* Standard streams. */ +extern FILE *stdin; /* Standard input stream. */ +extern FILE *stdout; /* Standard output stream. */ +extern FILE *stderr; /* Standard error output stream. */ +/* C89/C99 say they're macros. Make them happy. */ +#define stdin stdin +#define stdout stdout +#define stderr stderr + +__BEGIN_NAMESPACE_STD +/* Remove file FILENAME. */ +extern int remove (__const char *__filename) __THROW; +/* Rename file OLD to NEW. */ +extern int rename (__const char *__old, __const char *__new) __THROW; +__END_NAMESPACE_STD + + +__BEGIN_NAMESPACE_STD +/* Create a temporary file and open it read/write. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +#ifndef __USE_FILE_OFFSET64 +extern FILE *tmpfile (void); +#else +# ifdef __REDIRECT +extern FILE *__REDIRECT (tmpfile, (void), tmpfile64); +# else +# define tmpfile tmpfile64 +# endif +#endif + +#ifdef __USE_LARGEFILE64 +extern FILE *tmpfile64 (void); +#endif + +/* Generate a temporary filename. */ +extern char *tmpnam (char *__s) __THROW; +__END_NAMESPACE_STD + +#ifdef __USE_MISC +/* This is the reentrant variant of `tmpnam'. The only difference is + that it does not allow S to be NULL. */ +extern char *tmpnam_r (char *__s) __THROW; +#endif + + +#if defined __USE_SVID || defined __USE_XOPEN +/* Generate a unique temporary filename using up to five characters of PFX + if it is not NULL. The directory to put this file in is searched for + as follows: First the environment variable "TMPDIR" is checked. + If it contains the name of a writable directory, that directory is used. + If not and if DIR is not NULL, that value is checked. If that fails, + P_tmpdir is tried and finally "/tmp". The storage for the filename + is allocated by `malloc'. */ +extern char *tempnam (__const char *__dir, __const char *__pfx) + __THROW __attribute_malloc__; +#endif + + +__BEGIN_NAMESPACE_STD +/* Close STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fclose (FILE *__stream); +/* Flush STREAM, or all streams if STREAM is NULL. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fflush (FILE *__stream); +__END_NAMESPACE_STD + +#ifdef __USE_MISC +/* Faster versions when locking is not required. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fflush_unlocked (FILE *__stream); +#endif + +#ifdef __USE_GNU +/* Close all streams. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fcloseall (void); +#endif + + +__BEGIN_NAMESPACE_STD +#ifndef __USE_FILE_OFFSET64 +/* Open a file and create a new stream for it. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern FILE *fopen (__const char *__restrict __filename, + __const char *__restrict __modes); +/* Open a file, replacing an existing stream with it. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern FILE *freopen (__const char *__restrict __filename, + __const char *__restrict __modes, + FILE *__restrict __stream); +#else +# ifdef __REDIRECT +extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename, + __const char *__restrict __modes), fopen64); +extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename, + __const char *__restrict __modes, + FILE *__restrict __stream), freopen64); +# else +# define fopen fopen64 +# define freopen freopen64 +# endif +#endif +__END_NAMESPACE_STD +#ifdef __USE_LARGEFILE64 +extern FILE *fopen64 (__const char *__restrict __filename, + __const char *__restrict __modes); +extern FILE *freopen64 (__const char *__restrict __filename, + __const char *__restrict __modes, + FILE *__restrict __stream); +#endif + +#ifdef __USE_POSIX +/* Create a new stream that refers to an existing system file descriptor. */ +extern FILE *fdopen (int __fd, __const char *__modes) __THROW; +#endif + +#ifdef __USE_GNU +#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ +/* Create a new stream that refers to the given magic cookie, + and uses the given functions for input and output. */ +extern FILE *fopencookie (void *__restrict __magic_cookie, + __const char *__restrict __modes, + _IO_cookie_io_functions_t __io_funcs) __THROW; + +/* Create a new stream that refers to a memory buffer. */ +extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW; + +/* Open a stream that writes into a malloc'd buffer that is expanded as + necessary. *BUFLOC and *SIZELOC are updated with the buffer's location + and the number of characters written on fflush or fclose. */ +extern FILE *open_memstream (char **__restrict __bufloc, + size_t *__restrict __sizeloc) __THROW; +#endif +#endif + + +__BEGIN_NAMESPACE_STD +/* If BUF is NULL, make STREAM unbuffered. + Else make it use buffer BUF, of size BUFSIZ. */ +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW; +/* Make STREAM use buffering mode MODE. + If BUF is not NULL, use N bytes of it for buffering; + else allocate an internal buffer N bytes long. */ +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __THROW; +__END_NAMESPACE_STD + +#ifdef __USE_BSD +/* If BUF is NULL, make STREAM unbuffered. + Else make it use SIZE bytes of BUF for buffering. */ +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __THROW; + +/* Make STREAM line-buffered. */ +extern void setlinebuf (FILE *__stream) __THROW; +#endif + + +__BEGIN_NAMESPACE_STD +/* Write formatted output to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fprintf (FILE *__restrict __stream, + __const char *__restrict __format, ...); +/* Write formatted output to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int printf (__const char *__restrict __format, ...); +/* Write formatted output to S. */ +extern int sprintf (char *__restrict __s, + __const char *__restrict __format, ...) __THROW; + +/* Write formatted output to S from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format, + __gnuc_va_list __arg); +/* Write formatted output to stdout from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg); +/* Write formatted output to S from argument list ARG. */ +extern int vsprintf (char *__restrict __s, __const char *__restrict __format, + __gnuc_va_list __arg) __THROW; +__END_NAMESPACE_STD + +#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 +__BEGIN_NAMESPACE_C99 +/* Maximum chars of output to write in MAXLEN. */ +extern int snprintf (char *__restrict __s, size_t __maxlen, + __const char *__restrict __format, ...) + __THROW __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + __const char *__restrict __format, __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__printf__, 3, 0))); +__END_NAMESPACE_C99 +#endif + +#ifdef __USE_GNU +/* Write formatted output to a string dynamically allocated with `malloc'. + Store the address of the string in *PTR. */ +extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f, + __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__printf__, 2, 0))); +#if 0 /* uClibc: disabled */ +extern int __asprintf (char **__restrict __ptr, + __const char *__restrict __fmt, ...) + __THROW __attribute__ ((__format__ (__printf__, 2, 3))); +#endif +extern int asprintf (char **__restrict __ptr, + __const char *__restrict __fmt, ...) + __THROW __attribute__ ((__format__ (__printf__, 2, 3))); + +/* Write formatted output to a file descriptor. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern int vdprintf (int __fd, __const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, __const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +#endif + + +__BEGIN_NAMESPACE_STD +/* Read formatted input from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fscanf (FILE *__restrict __stream, + __const char *__restrict __format, ...); +/* Read formatted input from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int scanf (__const char *__restrict __format, ...); +/* Read formatted input from S. */ +extern int sscanf (__const char *__restrict __s, + __const char *__restrict __format, ...) __THROW; +__END_NAMESPACE_STD + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Read formatted input from S into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))); + +/* Read formatted input from stdin into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))); + +/* Read formatted input from S into argument list ARG. */ +extern int vsscanf (__const char *__restrict __s, + __const char *__restrict __format, __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); +__END_NAMESPACE_C99 +#endif /* Use ISO C9x. */ + + +__BEGIN_NAMESPACE_STD +/* Read a character from STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + +/* Read a character from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int getchar (void); +__END_NAMESPACE_STD + +/* The C standard explicitly says this is a macro, so we always do the + optimization for it. */ +#define getc(_fp) __GETC(_fp) + +#if defined __USE_POSIX || defined __USE_MISC +/* These are defined in POSIX.1:1996. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); + +/* SUSv3 allows getc_unlocked to be a macro */ +#define getc_unlocked(_fp) __GETC_UNLOCKED(_fp) +#endif /* Use POSIX or MISC. */ + +#ifdef __USE_MISC +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fgetc_unlocked (FILE *__stream); +#endif /* Use MISC. */ + + +__BEGIN_NAMESPACE_STD +/* Write a character to STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. + + These functions is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + +/* Write a character to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int putchar (int __c); +__END_NAMESPACE_STD + +/* The C standard explicitly says this can be a macro, + so we always do the optimization for it. */ +#define putc(_ch, _fp) __PUTC(_ch, _fp) + +#ifdef __USE_MISC +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fputc_unlocked (int __c, FILE *__stream); +#endif /* Use MISC. */ + +#if defined __USE_POSIX || defined __USE_MISC +/* These are defined in POSIX.1:1996. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + +/* SUSv3 allows putc_unlocked to be a macro */ +#define putc_unlocked(_ch, _fp) __PUTC_UNLOCKED(_ch, _fp) +#endif /* Use POSIX or MISC. */ + + +#if defined __USE_SVID || defined __USE_MISC \ + || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +/* Get a word (int) from STREAM. */ +extern int getw (FILE *__stream); + +/* Write a word (int) to STREAM. */ +extern int putw (int __w, FILE *__stream); +#endif + + +__BEGIN_NAMESPACE_STD +/* Get a newline-terminated string of finite length from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream); + +/* Get a newline-terminated string from stdin, removing the newline. + DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern char *gets (char *__s); +__END_NAMESPACE_STD + +#ifdef __USE_GNU +/* This function does the same as `fgets' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern char *fgets_unlocked (char *__restrict __s, int __n, + FILE *__restrict __stream); +#endif + + +#ifdef __USE_GNU +/* Read up to (and including) a DELIMITER from STREAM into *LINEPTR + (and null-terminate it). *LINEPTR is a pointer returned from malloc (or + NULL), pointing to *N characters of space. It is realloc'd as + necessary. Returns the number of characters read (not including the + null terminator), or -1 on error or EOF. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +#if 0 /* uClibc: disabled */ +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream); +#endif +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream); + +/* Like `getdelim', but reads up to a newline. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream); +#endif + + +__BEGIN_NAMESPACE_STD +/* Write a string to STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int fputs (__const char *__restrict __s, FILE *__restrict __stream); + +/* Write a string, followed by a newline, to stdout. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int puts (__const char *__s); + + +/* Push a character back onto the input buffer of STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int ungetc (int __c, FILE *__stream); + + +/* Read chunks of generic data from STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); +/* Write chunks of generic data to STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern size_t fwrite (__const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); +__END_NAMESPACE_STD + +#ifdef __USE_GNU +/* This function does the same as `fputs' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fputs_unlocked (__const char *__restrict __s, + FILE *__restrict __stream); +#endif + +#ifdef __USE_MISC +/* Faster versions when locking is not necessary. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); +extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); +#endif + + +__BEGIN_NAMESPACE_STD +/* Seek to a certain position on STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fseek (FILE *__stream, long int __off, int __whence); +/* Return the current position of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern long int ftell (FILE *__stream); +/* Rewind to the beginning of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void rewind (FILE *__stream); +__END_NAMESPACE_STD + +/* The Single Unix Specification, Version 2, specifies an alternative, + more adequate interface for the two functions above which deal with + file offset. `long int' is not the right type. These definitions + are originally defined in the Large File Support API. */ + +#if defined __USE_LARGEFILE || defined __USE_XOPEN2K +# ifndef __USE_FILE_OFFSET64 +/* Seek to a certain position on STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fseeko (FILE *__stream, __off_t __off, int __whence); +/* Return the current position of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern __off_t ftello (FILE *__stream); +# else +# ifdef __REDIRECT +extern int __REDIRECT (fseeko, + (FILE *__stream, __off64_t __off, int __whence), + fseeko64); +extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64); +# else +# define fseeko fseeko64 +# define ftello ftello64 +# endif +# endif +#endif + +__BEGIN_NAMESPACE_STD +#ifndef __USE_FILE_OFFSET64 +/* Get STREAM's position. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); +/* Set STREAM's position. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fsetpos (FILE *__stream, __const fpos_t *__pos); +#else +# ifdef __REDIRECT +extern int __REDIRECT (fgetpos, (FILE *__restrict __stream, + fpos_t *__restrict __pos), fgetpos64); +extern int __REDIRECT (fsetpos, + (FILE *__stream, __const fpos_t *__pos), fsetpos64); +# else +# define fgetpos fgetpos64 +# define fsetpos fsetpos64 +# endif +#endif +__END_NAMESPACE_STD + +#ifdef __USE_LARGEFILE64 +extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence); +extern __off64_t ftello64 (FILE *__stream); +extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos); +extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos); +#endif + +__BEGIN_NAMESPACE_STD +/* Clear the error and EOF indicators for STREAM. */ +extern void clearerr (FILE *__stream) __THROW; +/* Return the EOF indicator for STREAM. */ +extern int feof (FILE *__stream) __THROW; +/* Return the error indicator for STREAM. */ +extern int ferror (FILE *__stream) __THROW; +__END_NAMESPACE_STD + +#ifdef __USE_MISC +/* Faster versions when locking is not required. */ +extern void clearerr_unlocked (FILE *__stream) __THROW; +extern int feof_unlocked (FILE *__stream) __THROW; +extern int ferror_unlocked (FILE *__stream) __THROW; +#endif + + +__BEGIN_NAMESPACE_STD +/* Print a message describing the meaning of the value of errno. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void perror (__const char *__s); +__END_NAMESPACE_STD + +#ifdef __UCLIBC_HAS_SYS_ERRLIST__ +/* These variables normally should not be used directly. The `strerror' + function provides all the needed functionality. */ +#ifdef __USE_BSD +extern int sys_nerr; +extern __const char *__const sys_errlist[]; +#endif +#endif /* __UCLIBC_HAS_SYS_ERRLIST__ */ + + +#ifdef __USE_POSIX +/* Return the system file descriptor for STREAM. */ +extern int fileno (FILE *__stream) __THROW; +#endif /* Use POSIX. */ + +#ifdef __USE_MISC +/* Faster version when locking is not required. */ +extern int fileno_unlocked (FILE *__stream) __THROW; +#endif + + +#if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \ + defined __USE_MISC) +/* Create a new stream connected to a pipe running the given command. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern FILE *popen (__const char *__command, __const char *__modes); + +/* Close a stream opened by popen and return the status of its child. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int pclose (FILE *__stream); +#endif + + +#ifdef __USE_POSIX +/* Return the name of the controlling terminal. */ +extern char *ctermid (char *__s) __THROW; +#endif /* Use POSIX. */ + + +#ifdef __USE_XOPEN +/* Return the name of the current user. */ +extern char *cuserid (char *__s); +#endif /* Use X/Open, but not issue 6. */ + + +#if 0 /* def __USE_GNU uClibc note: not supported */ +struct obstack; /* See . */ + +/* Write formatted output to an obstack. */ +extern int obstack_printf (struct obstack *__restrict __obstack, + __const char *__restrict __format, ...) + __THROW __attribute__ ((__format__ (__printf__, 2, 3))); +extern int obstack_vprintf (struct obstack *__restrict __obstack, + __const char *__restrict __format, + __gnuc_va_list __args) + __THROW __attribute__ ((__format__ (__printf__, 2, 0))); +#endif /* Use GNU. */ + + +#if defined __USE_POSIX || defined __USE_MISC +/* These are defined in POSIX.1:1996. */ + +/* Acquire ownership of STREAM. */ +extern void flockfile (FILE *__stream) __THROW; + +/* Try to acquire ownership of STREAM but do not block if it is not + possible. */ +extern int ftrylockfile (FILE *__stream) __THROW; + +/* Relinquish the ownership granted for STREAM. */ +extern void funlockfile (FILE *__stream) __THROW; +#endif /* POSIX || misc */ + +#if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU +/* The X/Open standard requires some functions and variables to be + declared here which do not belong into this header. But we have to + follow. In GNU mode we don't do this nonsense. */ +# define __need_getopt +# include +#endif /* X/Open, but not issue 6 and not for GNU. */ + +/* If we are compiling with optimizing read this file. It contains + several optimizing inline functions and macros. */ +#define fgetc(_fp) __FGETC(_fp) +#define fputc(_ch, _fp) __FPUTC(_ch, _fp) + +#ifdef __USE_MISC +#define fgetc_unlocked(_fp) __FGETC_UNLOCKED(_fp) +#define fputc_unlocked(_ch, _fp) __FPUTC_UNLOCKED(_ch, _fp) +#endif + +#ifndef __STDIO_GETC_MACRO +#define __stdin stdin +#endif +#define getchar() __GETC(__stdin) + +#ifndef __STDIO_PUTC_MACRO +#define __stdout stdout +#endif +#define putchar(_ch) __PUTC((_ch), __stdout) + +#if defined __USE_POSIX || defined __USE_MISC +#define getchar_unlocked() __GETC_UNLOCKED(__stdin) +#define putchar_unlocked(_ch) __PUTC_UNLOCKED((_ch), __stdout) +#endif + +/* Clear the error and EOF indicators for STREAM. */ +#define clearerr(_fp) __CLEARERR(_fp) +#define feof(_fp) __FEOF(_fp) +#define ferror(_fp) __FERROR(_fp) + +#ifdef __USE_MISC +#define clearerr_unlocked(_fp) __CLEARERR_UNLOCKED(_fp) +#define feof_unlocked(_fp) __FEOF_UNLOCKED(_fp) +#define ferror_unlocked(_fp) __FERROR_UNLOCKED(_fp) +#endif + +__END_DECLS + +#endif /* included. */ + +#endif /* !_STDIO_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio_ext.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio_ext.h new file mode 100644 index 0000000..23d12e0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdio_ext.h @@ -0,0 +1,87 @@ +/* Functions to access FILE structure internals. + Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This header contains the same definitions as the header of the same name + on Sun's Solaris OS. */ + +#ifndef _STDIO_EXT_H +#define _STDIO_EXT_H 1 + +#include + +enum +{ + /* Query current state of the locking status. */ + FSETLOCKING_QUERY = 0, +#define FSETLOCKING_QUERY FSETLOCKING_QUERY + /* The library protects all uses of the stream functions, except for + uses of the *_unlocked functions, by calls equivalent to flockfile(). */ + FSETLOCKING_INTERNAL, +#define FSETLOCKING_INTERNAL FSETLOCKING_INTERNAL + /* The user will take care of locking. */ + FSETLOCKING_BYCALLER +#define FSETLOCKING_BYCALLER FSETLOCKING_BYCALLER +}; + + +__BEGIN_DECLS + +/* Return the size of the buffer of FP in bytes currently in use by + the given stream. */ +extern size_t __fbufsize (FILE *__fp) __THROW; + + +/* Return non-zero value iff the stream FP is opened readonly, or if the + last operation on the stream was a read operation. */ +extern int __freading (FILE *__fp) __THROW; + +/* Return non-zero value iff the stream FP is opened write-only or + append-only, or if the last operation on the stream was a write + operation. */ +extern int __fwriting (FILE *__fp) __THROW; + + +/* Return non-zero value iff stream FP is not opened write-only or + append-only. */ +extern int __freadable (FILE *__fp) __THROW; + +/* Return non-zero value iff stream FP is not opened read-only. */ +extern int __fwritable (FILE *__fp) __THROW; + + +/* Return non-zero value iff the stream FP is line-buffered. */ +extern int __flbf (FILE *__fp) __THROW; + + +/* Discard all pending buffered I/O on the stream FP. */ +extern void __fpurge (FILE *__fp) __THROW; + +/* Return amount of output in bytes pending on a stream FP. */ +extern size_t __fpending (FILE *__fp) __THROW; + +/* Flush all line-buffered files. */ +extern void _flushlbf (void); + + +/* Set locking status of stream FP to TYPE. */ +extern int __fsetlocking (FILE *__fp, int __type) __THROW; + +__END_DECLS + +#endif /* stdio_ext.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdlib.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdlib.h new file mode 100644 index 0000000..276f1ba --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/stdlib.h @@ -0,0 +1,865 @@ +/* Copyright (C) 1991-2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.20 General utilities + */ + +#ifndef _STDLIB_H + +#include + +/* Get size_t, wchar_t and NULL from . */ +#define __need_size_t +#ifndef __need_malloc_and_calloc +# ifdef __UCLIBC_HAS_WCHAR__ +# define __need_wchar_t +# endif +# define __need_NULL +#endif +#include + +__BEGIN_DECLS + +#ifndef __need_malloc_and_calloc +#define _STDLIB_H 1 + +#if defined __USE_XOPEN && !defined _SYS_WAIT_H +/* XPG requires a few symbols from being defined. */ +# include +# include + +# ifdef __USE_BSD + +/* Lots of hair to allow traditional BSD use of `union wait' + as well as POSIX.1 use of `int' for the status word. */ + +# if defined __GNUC__ && !defined __cplusplus +# define __WAIT_INT(status) \ + (__extension__ ({ union { __typeof(status) __in; int __i; } __u; \ + __u.__in = (status); __u.__i; })) +# else +# define __WAIT_INT(status) (*(int *) &(status)) +# endif + +/* This is the type of the argument to `wait'. The funky union + causes redeclarations with ether `int *' or `union wait *' to be + allowed without complaint. __WAIT_STATUS_DEFN is the type used in + the actual function definitions. */ + +# if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus +# define __WAIT_STATUS void * +# define __WAIT_STATUS_DEFN void * +# else +/* This works in GCC 2.6.1 and later. */ +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# define __WAIT_STATUS_DEFN int * +# endif + +# else /* Don't use BSD. */ + +# define __WAIT_INT(status) (status) +# define __WAIT_STATUS int * +# define __WAIT_STATUS_DEFN int * + +# endif /* Use BSD. */ + +/* Define the macros also would define this way. */ +# define WEXITSTATUS(status) __WEXITSTATUS(__WAIT_INT(status)) +# define WTERMSIG(status) __WTERMSIG(__WAIT_INT(status)) +# define WSTOPSIG(status) __WSTOPSIG(__WAIT_INT(status)) +# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status)) +# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status)) +# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status)) +# if 0 /* def __WIFCONTINUED */ +# define WIFCONTINUED(status) __WIFCONTINUED(__WAIT_INT(status)) +# endif +#endif /* X/Open and not included. */ + +__BEGIN_NAMESPACE_STD +/* Returned by `div'. */ +typedef struct + { + int quot; /* Quotient. */ + int rem; /* Remainder. */ + } div_t; + +/* Returned by `ldiv'. */ +#ifndef __ldiv_t_defined +typedef struct + { + long int quot; /* Quotient. */ + long int rem; /* Remainder. */ + } ldiv_t; +# define __ldiv_t_defined 1 +#endif +__END_NAMESPACE_STD + +#if defined __USE_ISOC99 && !defined __lldiv_t_defined +__BEGIN_NAMESPACE_C99 +/* Returned by `lldiv'. */ +__extension__ typedef struct + { + long long int quot; /* Quotient. */ + long long int rem; /* Remainder. */ + } lldiv_t; +# define __lldiv_t_defined 1 +__END_NAMESPACE_C99 +#endif + + +/* The largest number rand will return (same as INT_MAX). */ +#define RAND_MAX 2147483647 + + +/* We define these the same for all machines. + Changes from this to the outside world should be done in `_exit'. */ +#define EXIT_FAILURE 1 /* Failing exit status. */ +#define EXIT_SUCCESS 0 /* Successful exit status. */ + + +/* Maximum length of a multibyte character in the current locale. */ +#if 0 +#define MB_CUR_MAX (__ctype_get_mb_cur_max ()) +extern size_t __ctype_get_mb_cur_max (void) __THROW __wur; +#endif +#ifdef __UCLIBC_HAS_WCHAR__ +#define MB_CUR_MAX (_stdlib_mb_cur_max ()) +extern size_t _stdlib_mb_cur_max (void) __THROW __wur; +#endif + + +__BEGIN_NAMESPACE_STD +#ifdef __UCLIBC_HAS_FLOATS__ +/* Convert a string to a floating-point number. */ +extern double atof (__const char *__nptr) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +#endif /* __UCLIBC_HAS_FLOATS__ */ +/* Convert a string to an integer. */ +extern int atoi (__const char *__nptr) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +/* Convert a string to a long integer. */ +extern long int atol (__const char *__nptr) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +__END_NAMESPACE_STD + +#if defined __USE_ISOC99 || defined __USE_MISC +__BEGIN_NAMESPACE_C99 +/* Convert a string to a long long integer. */ +__extension__ extern long long int atoll (__const char *__nptr) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +__END_NAMESPACE_C99 +#endif + +#ifdef __UCLIBC_HAS_FLOATS__ +__BEGIN_NAMESPACE_STD +/* Convert a string to a floating-point number. */ +extern double strtod (__const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)) __wur; +__END_NAMESPACE_STD + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Likewise for `float' and `long double' sizes of floating-point numbers. */ +extern float strtof (__const char *__restrict __nptr, + char **__restrict __endptr) __THROW __nonnull ((1)) __wur; + +extern long double strtold (__const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)) __wur; +__END_NAMESPACE_C99 +#endif +#endif /* __UCLIBC_HAS_FLOATS__ */ + +__BEGIN_NAMESPACE_STD +/* Convert a string to a long integer. */ +extern long int strtol (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur; +/* Convert a string to an unsigned long integer. */ +extern unsigned long int strtoul (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur; +__END_NAMESPACE_STD + +#ifdef __USE_BSD +/* Convert a string to a quadword integer. */ +__extension__ +extern long long int strtoq (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur; +/* Convert a string to an unsigned quadword integer. */ +__extension__ +extern unsigned long long int strtouq (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur; +#endif /* GCC and use BSD. */ + +#if defined __USE_ISOC99 || defined __USE_MISC +__BEGIN_NAMESPACE_C99 +/* Convert a string to a quadword integer. */ +__extension__ +extern long long int strtoll (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur; +/* Convert a string to an unsigned quadword integer. */ +__extension__ +extern unsigned long long int strtoull (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur; +__END_NAMESPACE_C99 +#endif /* ISO C99 or GCC and use MISC. */ + + +#ifdef __UCLIBC_HAS_XLOCALE__ +#ifdef __USE_GNU +/* The concept of one static locale per category is not very well + thought out. Many applications will need to process its data using + information from several different locales. Another application is + the implementation of the internationalization handling in the + upcoming ISO C++ standard library. To support this another set of + the functions using locale data exist which have an additional + argument. + + Attention: all these functions are *not* standardized in any form. + This is a proof-of-concept implementation. */ + +/* Structure for reentrant locale using functions. This is an + (almost) opaque type for the user level programs. */ +# include + +/* Special versions of the functions above which take the locale to + use as an additional parameter. */ +extern long int strtol_l (__const char *__restrict __nptr, + char **__restrict __endptr, int __base, + __locale_t __loc) __THROW __nonnull ((1, 4)) __wur; + +extern unsigned long int strtoul_l (__const char *__restrict __nptr, + char **__restrict __endptr, + int __base, __locale_t __loc) + __THROW __nonnull ((1, 4)) __wur; + +__extension__ +extern long long int strtoll_l (__const char *__restrict __nptr, + char **__restrict __endptr, int __base, + __locale_t __loc) + __THROW __nonnull ((1, 4)) __wur; + +__extension__ +extern unsigned long long int strtoull_l (__const char *__restrict __nptr, + char **__restrict __endptr, + int __base, __locale_t __loc) + __THROW __nonnull ((1, 4)) __wur; + +#ifdef __UCLIBC_HAS_FLOATS__ +extern double strtod_l (__const char *__restrict __nptr, + char **__restrict __endptr, __locale_t __loc) + __THROW __nonnull ((1, 3)) __wur; + +extern float strtof_l (__const char *__restrict __nptr, + char **__restrict __endptr, __locale_t __loc) + __THROW __nonnull ((1, 3)) __wur; + +extern long double strtold_l (__const char *__restrict __nptr, + char **__restrict __endptr, + __locale_t __loc) + __THROW __nonnull ((1, 3)) __wur; +#endif /* __UCLIBC_HAS_FLOATS__ */ + +#endif /* GNU */ +#endif /* __UCLIBC_HAS_XLOCALE__ */ + + +#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED +/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant + digit first. Returns a pointer to static storage overwritten by the + next call. */ +extern char *l64a (long int __n) __THROW __wur; + +/* Read a number from a string S in base 64 as above. */ +extern long int a64l (__const char *__s) + __THROW __attribute_pure__ __nonnull ((1)) __wur; + +#endif /* Use SVID || extended X/Open. */ + +#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD +# include /* we need int32_t... */ + +/* These are the functions that actually do things. The `random', `srandom', + `initstate' and `setstate' functions are those from BSD Unices. + The `rand' and `srand' functions are required by the ANSI standard. + We provide both interfaces to the same random number generator. */ +/* Return a random long integer between 0 and RAND_MAX inclusive. */ +extern long int random (void) __THROW; + +/* Seed the random number generator with the given number. */ +extern void srandom (unsigned int __seed) __THROW; + +/* Initialize the random number generator to use state buffer STATEBUF, + of length STATELEN, and seed it with SEED. Optimal lengths are 8, 16, + 32, 64, 128 and 256, the bigger the better; values less than 8 will + cause an error and values greater than 256 will be rounded down. */ +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __THROW __nonnull ((2)); + +/* Switch the random number generator to state buffer STATEBUF, + which should have been previously initialized by `initstate'. */ +extern char *setstate (char *__statebuf) __THROW __nonnull ((1)); + + +# ifdef __USE_MISC +/* Reentrant versions of the `random' family of functions. + These functions all use the following data structure to contain + state, rather than global state variables. */ + +struct random_data + { + int32_t *fptr; /* Front pointer. */ + int32_t *rptr; /* Rear pointer. */ + int32_t *state; /* Array of state values. */ + int rand_type; /* Type of random number generator. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ + int32_t *end_ptr; /* Pointer behind state table. */ + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __THROW __nonnull ((1, 2)); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __THROW __nonnull ((2)); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __THROW __nonnull ((2, 4)); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __THROW __nonnull ((1, 2)); +# endif /* Use misc. */ +#endif /* Use SVID || extended X/Open || BSD. */ + + +__BEGIN_NAMESPACE_STD +/* Return a random integer between 0 and RAND_MAX inclusive. */ +extern int rand (void) __THROW; +/* Seed the random number generator with the given number. */ +extern void srand (unsigned int __seed) __THROW; +__END_NAMESPACE_STD + +#ifdef __USE_POSIX +/* Reentrant interface according to POSIX.1. */ +extern int rand_r (unsigned int *__seed) __THROW; +#endif + + +#if defined __USE_SVID || defined __USE_XOPEN +/* System V style 48-bit random number generator functions. */ + +#ifdef __UCLIBC_HAS_FLOATS__ +/* Return non-negative, double-precision floating-point value in [0.0,1.0). */ +extern double drand48 (void) __THROW; +extern double erand48 (unsigned short int __xsubi[3]) __THROW __nonnull ((1)); +#endif /* __UCLIBC_HAS_FLOATS__ */ + +/* Return non-negative, long integer in [0,2^31). */ +extern long int lrand48 (void) __THROW; +extern long int nrand48 (unsigned short int __xsubi[3]) + __THROW __nonnull ((1)); + +/* Return signed, long integers in [-2^31,2^31). */ +extern long int mrand48 (void) __THROW; +extern long int jrand48 (unsigned short int __xsubi[3]) + __THROW __nonnull ((1)); + +/* Seed random number generator. */ +extern void srand48 (long int __seedval) __THROW; +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __THROW __nonnull ((1)); +extern void lcong48 (unsigned short int __param[7]) __THROW __nonnull ((1)); + +# ifdef __USE_MISC +/* Data structure for communication with thread safe versions. This + type is to be regarded as opaque. It's only exported because users + have to allocate objects of this type. */ +struct drand48_data + { + unsigned short int __x[3]; /* Current state. */ + unsigned short int __old_x[3]; /* Old state. */ + unsigned short int __c; /* Additive const. in congruential formula. */ + unsigned short int __init; /* Flag for initializing. */ + unsigned long long int __a; /* Factor in congruential formula. */ + }; + +#ifdef __UCLIBC_HAS_FLOATS__ +/* Return non-negative, double-precision floating-point value in [0.0,1.0). */ +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __THROW __nonnull ((1, 2)); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __THROW __nonnull ((1, 2)); +#endif /* __UCLIBC_HAS_FLOATS__ */ + +/* Return non-negative, long integer in [0,2^31). */ +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __THROW __nonnull ((1, 2)); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __THROW __nonnull ((1, 2)); + +/* Return signed, long integers in [-2^31,2^31). */ +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __THROW __nonnull ((1, 2)); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __THROW __nonnull ((1, 2)); + +/* Seed random number generator. */ +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __THROW __nonnull ((2)); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __THROW __nonnull ((1, 2)); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __THROW __nonnull ((1, 2)); +# endif /* Use misc. */ +#endif /* Use SVID or X/Open. */ + +#endif /* don't just need malloc and calloc */ + +#ifndef __malloc_and_calloc_defined +# define __malloc_and_calloc_defined +__BEGIN_NAMESPACE_STD +/* Allocate SIZE bytes of memory. */ +extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur; +/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ +extern void *calloc (size_t __nmemb, size_t __size) + __THROW __attribute_malloc__ __wur; +__END_NAMESPACE_STD +#endif + +#ifndef __need_malloc_and_calloc +__BEGIN_NAMESPACE_STD +/* Re-allocate the previously allocated block + in PTR, making the new block SIZE bytes long. */ +extern void *realloc (void *__ptr, size_t __size) + __THROW __attribute_malloc__ __attribute_warn_unused_result__; +/* Free a block allocated by `malloc', `realloc' or `calloc'. */ +extern void free (void *__ptr) __THROW; +__END_NAMESPACE_STD + +#ifdef __USE_MISC +/* Free a block. An alias for `free'. (Sun Unices). */ +extern void cfree (void *__ptr) __THROW; +#endif /* Use misc. */ + +#if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC +# include +#endif /* Use GNU, BSD, or misc. */ + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */ +extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; +#endif + +#ifdef __USE_XOPEN2K +/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */ +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __THROW __nonnull ((1)) __wur; +#endif + +__BEGIN_NAMESPACE_STD +/* Abort execution and generate a core-dump. */ +extern void abort (void) __THROW __attribute__ ((__noreturn__)); + + +/* Register a function to be called when `exit' is called. */ +extern int atexit (void (*__func) (void)) __THROW __nonnull ((1)); +__END_NAMESPACE_STD + +#ifdef __USE_MISC +/* Register a function to be called with the status + given to `exit' and the given argument. */ +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __THROW __nonnull ((1)); +#endif + +__BEGIN_NAMESPACE_STD +/* Call all functions registered with `atexit' and `on_exit', + in the reverse of the order in which they were registered + perform stdio cleanup, and terminate program execution with STATUS. */ +extern void exit (int __status) __THROW __attribute__ ((__noreturn__)); +__END_NAMESPACE_STD + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +/* Terminate the program with STATUS without calling any of the + functions registered with `atexit' or `on_exit'. */ +extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__)); +__END_NAMESPACE_C99 +#endif + + +__BEGIN_NAMESPACE_STD +/* Return the value of envariable NAME, or NULL if it doesn't exist. */ +extern char *getenv (__const char *__name) __THROW __nonnull ((1)) __wur; +__END_NAMESPACE_STD + +/* This function is similar to the above but returns NULL if the + programs is running with SUID or SGID enabled. */ +extern char *__secure_getenv (__const char *__name) + __THROW __nonnull ((1)) __wur; + +#if defined __USE_SVID || defined __USE_XOPEN +/* The SVID says this is in , but this seems a better place. */ +/* Put STRING, which is of the form "NAME=VALUE", in the environment. + If there is no `=', remove NAME from the environment. */ +extern int putenv (char *__string) __THROW __nonnull ((1)); +#endif + +#if defined __USE_BSD || defined __USE_XOPEN2K +/* Set NAME to VALUE in the environment. + If REPLACE is nonzero, overwrite an existing value. */ +extern int setenv (__const char *__name, __const char *__value, int __replace) + __THROW __nonnull ((2)); + +/* Remove the variable NAME from the environment. */ +extern int unsetenv (__const char *__name) __THROW; +#endif + +/* The following is used by uClibc in atexit.c and sysconf.c */ +/* We have no limit when __UCLIBC_DYNAMIC_ATEXIT__ is enabled. */ +#ifdef __UCLIBC_DYNAMIC_ATEXIT__ +# define __UCLIBC_MAX_ATEXIT INT_MAX +#else +# define __UCLIBC_MAX_ATEXIT 20 +#endif + + +#ifdef __USE_MISC +/* The `clearenv' was planned to be added to POSIX.1 but probably + never made it. Nevertheless the POSIX.9 standard (POSIX bindings + for Fortran 77) requires this function. */ +extern int clearenv (void) __THROW; +#endif + + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +/* Generate a unique temporary file name from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + Returns TEMPLATE, or a null pointer if it cannot get a unique file name. */ +extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur; + +/* Generate a unique temporary file name from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the filename unique. + Returns a file descriptor open on the file for reading and writing, + or -1 if it cannot create a uniquely-named file. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int mkstemp (char *__template) __nonnull ((1)) __wur; +# else +# ifdef __REDIRECT +extern int __REDIRECT (mkstemp, (char *__template), mkstemp64) + __nonnull ((1)) __wur; +# else +# define mkstemp mkstemp64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; +# endif +#endif + +#ifdef __USE_BSD +/* Create a unique temporary directory from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the directory name unique. + Returns TEMPLATE, or a null pointer if it cannot get a unique name. + The directory is created mode 700. */ +extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur; +#endif + + +__BEGIN_NAMESPACE_STD +/* Execute the given line as a shell command. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int system (__const char *__command) __wur; +__END_NAMESPACE_STD + + +#if 0 /* def __USE_GNU */ +/* Return a malloc'd string containing the canonical absolute name of the + named file. The last file name component need not exist, and may be a + symlink to a nonexistent file. */ +extern char *canonicalize_file_name (__const char *__name) + __THROW __nonnull ((1)) __wur; +#endif + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Return the canonical absolute name of file NAME. The last file name + component need not exist, and may be a symlink to a nonexistent file. + If RESOLVED is null, the result is malloc'd; otherwise, if the canonical + name is PATH_MAX chars or more, returns null with `errno' set to + ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, returns the + name in RESOLVED. */ +/* we choose to handle __resolved==NULL as crash :) */ +extern char *realpath (__const char *__restrict __name, + char *__restrict __resolved) __THROW __wur __nonnull((2)); +#endif + + +/* Shorthand for type of comparison functions. */ +#ifndef __COMPAR_FN_T +# define __COMPAR_FN_T +typedef int (*__compar_fn_t) (__const void *, __const void *); + +# ifdef __USE_GNU +typedef __compar_fn_t comparison_fn_t; +# endif +#endif + +__BEGIN_NAMESPACE_STD +/* Do a binary search for KEY in BASE, which consists of NMEMB elements + of SIZE bytes each, using COMPAR to perform the comparisons. */ +extern void *bsearch (__const void *__key, __const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __nonnull ((1, 2, 5)) __wur; + +/* Sort NMEMB elements of BASE, of SIZE bytes each, + using COMPAR to perform the comparisons. */ +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __nonnull ((1, 4)); + + +/* Return the absolute value of X. */ +extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; +extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur; +__END_NAMESPACE_STD + +#ifdef __USE_ISOC99 +__extension__ extern long long int llabs (long long int __x) + __THROW __attribute__ ((__const__)) __wur; +#endif + + +__BEGIN_NAMESPACE_STD +/* Return the `div_t', `ldiv_t' or `lldiv_t' representation + of the value of NUMER over DENOM. */ +/* GCC may have built-ins for these someday. */ +extern div_t div (int __numer, int __denom) + __THROW __attribute__ ((__const__)) __wur; +extern ldiv_t ldiv (long int __numer, long int __denom) + __THROW __attribute__ ((__const__)) __wur; +__END_NAMESPACE_STD + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __THROW __attribute__ ((__const__)) __wur; +__END_NAMESPACE_C99 +#endif + + +#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD +/* Convert floating point numbers to strings. The returned values are + valid only until another call to the same function. */ + +# ifdef __UCLIBC_SUSV3_LEGACY__ + +#if 0 +/* Convert VALUE to a string with NDIGIT digits and return a pointer to + this. Set *DECPT with the position of the decimal character and *SIGN + with the sign of the number. */ +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; + +/* Convert VALUE to a string rounded to NDIGIT decimal digits. Set *DECPT + with the position of the decimal character and *SIGN with the sign of + the number. */ +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; +#endif + +/* If possible convert VALUE to a string with NDIGIT significant digits. + Otherwise use exponential representation. The resulting string will + be written to BUF. */ +extern char *gcvt (double __value, int __ndigit, char *__buf) + __THROW __nonnull ((3)) __wur; +# endif /* __UCLIBC_SUSV3_LEGACY__ */ + +# if 0 /*def __USE_MISC*/ +/* Long double versions of above functions. */ +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __THROW __nonnull ((3, 4)) __wur; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __THROW __nonnull ((3, 4)) __wur; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __THROW __nonnull ((3)) __wur; + + +/* Reentrant version of the functions above which provide their own + buffers. */ +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __THROW __nonnull ((3, 4, 5)); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __THROW __nonnull ((3, 4, 5)); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __THROW __nonnull ((3, 4, 5)); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __THROW __nonnull ((3, 4, 5)); +# endif /* misc */ +#endif /* use MISC || use X/Open Unix */ + +#ifdef __UCLIBC_HAS_WCHAR__ +__BEGIN_NAMESPACE_STD +/* Return the length of the multibyte character + in S, which is no longer than N. */ +extern int mblen (__const char *__s, size_t __n) __THROW __wur; +/* Return the length of the given multibyte character, + putting its `wchar_t' representation in *PWC. */ +extern int mbtowc (wchar_t *__restrict __pwc, + __const char *__restrict __s, size_t __n) __THROW __wur; +/* Put the multibyte character represented + by WCHAR in S, returning its length. */ +extern int wctomb (char *__s, wchar_t __wchar) __THROW __wur; + + +/* Convert a multibyte string to a wide char string. */ +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + __const char *__restrict __s, size_t __n) __THROW; +/* Convert a wide char string to multibyte string. */ +extern size_t wcstombs (char *__restrict __s, + __const wchar_t *__restrict __pwcs, size_t __n) + __THROW; +__END_NAMESPACE_STD +#endif /* __UCLIBC_HAS_WCHAR__ */ + + +#ifdef __USE_SVID +/* Determine whether the string value of RESPONSE matches the affirmation + or negative response expression as specified by the LC_MESSAGES category + in the program's current locale. Returns 1 if affirmative, 0 if + negative, and -1 if not matching. */ +extern int rpmatch (__const char *__response) __THROW __nonnull ((1)) __wur; +#endif + + +#ifdef __USE_XOPEN_EXTENDED +/* Parse comma separated suboption from *OPTIONP and match against + strings in TOKENS. If found return index and set *VALUEP to + optional value introduced by an equal sign. If the suboption is + not part of TOKENS return in *VALUEP beginning of unknown + suboption. On exit *OPTIONP is set to the beginning of the next + token or at the terminating NUL character. */ +extern int getsubopt (char **__restrict __optionp, + char *__const *__restrict __tokens, + char **__restrict __valuep) + __THROW __nonnull ((1, 2, 3)) __wur; +#endif + + +#ifdef __USE_XOPEN +/* Setup DES tables according KEY. */ +extern void setkey (__const char *__key) __THROW __nonnull ((1)); +#endif + + +/* X/Open pseudo terminal handling. */ + +#ifdef __USE_XOPEN2K +/* Return a master pseudo-terminal handle. */ +extern int posix_openpt (int __oflag) __wur; +#endif + +#ifdef __USE_XOPEN +/* The next four functions all take a master pseudo-tty fd and + perform an operation on the associated slave: */ + +/* Chown the slave to the calling user. */ +extern int grantpt (int __fd) __THROW; + +/* Release an internal lock so the slave can be opened. + Call after grantpt(). */ +extern int unlockpt (int __fd) __THROW; + +/* Return the pathname of the pseudo terminal slave assoicated with + the master FD is open on, or NULL on errors. + The returned storage is good until the next call to this function. */ +extern char *ptsname (int __fd) __THROW __wur; +#endif + +#ifdef __USE_GNU +/* Store at most BUFLEN characters of the pathname of the slave pseudo + terminal associated with the master FD is open on in BUF. + Return 0 on success, otherwise an error number. */ +extern int ptsname_r (int __fd, char *__buf, size_t __buflen) + __THROW __nonnull ((2)); + +/* Open a master pseudo terminal and return its file descriptor. */ +extern int getpt (void); +#endif + +#if 0 /* def __USE_BSD */ +/* Put the 1 minute, 5 minute and 15 minute load averages into the first + NELEM elements of LOADAVG. Return the number written (never more than + three, but may be less than NELEM), or -1 if an error occurred. */ +extern int getloadavg (double __loadavg[], int __nelem) + __THROW __nonnull ((1)); +#endif + +#ifdef __UCLIBC_HAS_ARC4RANDOM__ +#include +extern uint32_t arc4random(void); +extern void arc4random_stir(void); +extern void arc4random_addrandom(unsigned char *, int); +#endif + +#endif /* don't just need malloc and calloc */ +#undef __need_malloc_and_calloc + +__END_DECLS + +#endif /* stdlib.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/string.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/string.h new file mode 100644 index 0000000..87d9534 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/string.h @@ -0,0 +1,437 @@ +/* Copyright (C) 1991-1993, 1995-2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.21 String handling + */ + +#ifndef _STRING_H +#define _STRING_H 1 + +#include + +__BEGIN_DECLS + +/* Get size_t and NULL from . */ +#define __need_size_t +#define __need_NULL +#include + + +__BEGIN_NAMESPACE_STD +/* Copy N bytes of SRC to DEST. */ +extern void *memcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)); +/* Copy N bytes of SRC to DEST, guaranteeing + correct behavior for overlapping strings. */ +extern void *memmove (void *__dest, __const void *__src, size_t __n) + __THROW __nonnull ((1, 2)); +__END_NAMESPACE_STD + +/* Copy no more than N bytes of SRC to DEST, stopping when C is found. + Return the position in DEST one byte past where C was copied, + or NULL if C was not found in the first N bytes of SRC. */ +#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN +extern void *memccpy (void *__restrict __dest, __const void *__restrict __src, + int __c, size_t __n) + __THROW __nonnull ((1, 2)); +#endif /* SVID. */ + + +__BEGIN_NAMESPACE_STD +/* Set N bytes of S to C. */ +extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); + +/* Compare N bytes of S1 and S2. */ +extern int memcmp (__const void *__s1, __const void *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +/* Search N bytes of S for C. */ +extern void *memchr (__const void *__s, int __c, size_t __n) + __THROW __attribute_pure__ __nonnull ((1)); +__END_NAMESPACE_STD + +#ifdef __USE_GNU +/* Search in S for C. This is similar to `memchr' but there is no + length limit. */ +extern void *rawmemchr (__const void *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); + +/* Search N bytes of S for the final occurrence of C. */ +extern void *memrchr (__const void *__s, int __c, size_t __n) + __THROW __attribute_pure__ __nonnull ((1)); +#endif + + +__BEGIN_NAMESPACE_STD +/* Copy SRC to DEST. */ +extern char *strcpy (char *__restrict __dest, __const char *__restrict __src) + __THROW __nonnull ((1, 2)); +/* Copy no more than N characters of SRC to DEST. */ +extern char *strncpy (char *__restrict __dest, + __const char *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)); + +/* Append SRC onto DEST. */ +extern char *strcat (char *__restrict __dest, __const char *__restrict __src) + __THROW __nonnull ((1, 2)); +/* Append no more than N characters from SRC onto DEST. */ +extern char *strncat (char *__restrict __dest, __const char *__restrict __src, + size_t __n) __THROW __nonnull ((1, 2)); + +/* Compare S1 and S2. */ +extern int strcmp (__const char *__s1, __const char *__s2) + __THROW __attribute_pure__ __nonnull ((1, 2)); +/* Compare N characters of S1 and S2. */ +extern int strncmp (__const char *__s1, __const char *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +/* Compare the collated forms of S1 and S2. */ +extern int strcoll (__const char *__s1, __const char *__s2) + __THROW __attribute_pure__ __nonnull ((1, 2)); +/* Put a transformation of SRC into no more than N bytes of DEST. */ +extern size_t strxfrm (char *__restrict __dest, + __const char *__restrict __src, size_t __n) + __THROW __nonnull ((2)); +__END_NAMESPACE_STD + +#if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__ +/* The following functions are equivalent to the both above but they + take the locale they use for the collation as an extra argument. + This is not standardsized but something like will come. */ +# include + +/* Compare the collated forms of S1 and S2 using rules from L. */ +extern int strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l) + __THROW __attribute_pure__ __nonnull ((1, 2, 3)); +/* Put a transformation of SRC into no more than N bytes of DEST. */ +extern size_t strxfrm_l (char *__dest, __const char *__src, size_t __n, + __locale_t __l) __THROW __nonnull ((2, 4)); +#endif + +#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Duplicate S, returning an identical malloc'd string. */ +extern char *strdup (__const char *__s) + __THROW __attribute_malloc__ __nonnull ((1)); +#endif + +/* Return a malloc'd copy of at most N bytes of STRING. The + resultant string is terminated even if no null terminator + appears before STRING[N]. */ +#if defined __USE_GNU +extern char *strndup (__const char *__string, size_t __n) + __THROW __attribute_malloc__ __nonnull ((1)); +#endif + +#if defined __USE_GNU && defined __GNUC__ +/* Duplicate S, returning an identical alloca'd string. */ +# define strdupa(s) \ + (__extension__ \ + ({ \ + __const char *__old = (s); \ + size_t __len = strlen (__old) + 1; \ + char *__new = (char *) __builtin_alloca (__len); \ + (char *) memcpy (__new, __old, __len); \ + })) + +/* Return an alloca'd copy of at most N bytes of string. */ +# define strndupa(s, n) \ + (__extension__ \ + ({ \ + __const char *__old = (s); \ + size_t __len = strnlen (__old, (n)); \ + char *__new = (char *) __builtin_alloca (__len + 1); \ + __new[__len] = '\0'; \ + (char *) memcpy (__new, __old, __len); \ + })) +#endif + +__BEGIN_NAMESPACE_STD +/* Find the first occurrence of C in S. */ +extern char *strchr (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); +/* Find the last occurrence of C in S. */ +extern char *strrchr (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); +__END_NAMESPACE_STD + +#ifdef __USE_GNU +/* This function is similar to `strchr'. But it returns a pointer to + the closing NUL byte in case C is not found in S. */ +extern char *strchrnul (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); +#endif + +__BEGIN_NAMESPACE_STD +/* Return the length of the initial segment of S which + consists entirely of characters not in REJECT. */ +extern size_t strcspn (__const char *__s, __const char *__reject) + __THROW __attribute_pure__ __nonnull ((1, 2)); +/* Return the length of the initial segment of S which + consists entirely of characters in ACCEPT. */ +extern size_t strspn (__const char *__s, __const char *__accept) + __THROW __attribute_pure__ __nonnull ((1, 2)); +/* Find the first occurrence in S of any character in ACCEPT. */ +extern char *strpbrk (__const char *__s, __const char *__accept) + __THROW __attribute_pure__ __nonnull ((1, 2)); +/* Find the first occurrence of NEEDLE in HAYSTACK. */ +extern char *strstr (__const char *__haystack, __const char *__needle) + __THROW __attribute_pure__ __nonnull ((1, 2)); + + +/* Divide S into tokens separated by characters in DELIM. */ +extern char *strtok (char *__restrict __s, __const char *__restrict __delim) + __THROW __nonnull ((2)); +__END_NAMESPACE_STD + +/* Divide S into tokens separated by characters in DELIM. Information + passed between calls are stored in SAVE_PTR. */ +#if 0 /* uClibc: disabled */ +extern char *__strtok_r (char *__restrict __s, + __const char *__restrict __delim, + char **__restrict __save_ptr) + __THROW __nonnull ((2, 3)); +#endif +#if defined __USE_POSIX || defined __USE_MISC +extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim, + char **__restrict __save_ptr) + __THROW __nonnull ((2, 3)); +#endif + +#ifdef __USE_GNU +/* Similar to `strstr' but this function ignores the case of both strings. */ +extern char *strcasestr (__const char *__haystack, __const char *__needle) + __THROW __attribute_pure__ __nonnull ((1, 2)); +#endif + +#ifdef __USE_GNU +/* Find the first occurrence of NEEDLE in HAYSTACK. + NEEDLE is NEEDLELEN bytes long; + HAYSTACK is HAYSTACKLEN bytes long. */ +extern void *memmem (__const void *__haystack, size_t __haystacklen, + __const void *__needle, size_t __needlelen) + __THROW __attribute_pure__ __nonnull ((1, 3)); + +/* Copy N bytes of SRC to DEST, return pointer to bytes after the + last written byte. */ +#if 0 /* uClibc: disabled */ +extern void *__mempcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)); +#endif +extern void *mempcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)); +#endif + + +__BEGIN_NAMESPACE_STD +/* Return the length of S. */ +extern size_t strlen (__const char *__s) + __THROW __attribute_pure__ __nonnull ((1)); +__END_NAMESPACE_STD + +#ifdef __USE_GNU +/* Find the length of STRING, but scan at most MAXLEN characters. + If no '\0' terminator is found in that many characters, return MAXLEN. */ +extern size_t strnlen (__const char *__string, size_t __maxlen) + __THROW __attribute_pure__ __nonnull ((1)); +#endif + + +__BEGIN_NAMESPACE_STD +/* Return a string describing the meaning of the `errno' code in ERRNUM. */ +extern char *strerror (int __errnum) __THROW; +__END_NAMESPACE_STD +#if defined __USE_XOPEN2K || defined __USE_MISC +/* Reentrant version of `strerror'. + There are 2 flavors of `strerror_r', GNU which returns the string + and may or may not use the supplied temporary buffer and POSIX one + which fills the string into the buffer. + To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L + without -D_GNU_SOURCE is needed, otherwise the GNU version is + preferred. */ +# if defined __USE_XOPEN2K && !defined __USE_GNU +/* Fill BUF with a string describing the meaning of the `errno' code in + ERRNUM. */ +extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen) + __THROW __nonnull ((2)); +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (strerror_r, + (int __errnum, char *__buf, size_t __buflen), + __xpg_strerror_r) __nonnull ((2)); +# else +# define strerror_r __xpg_strerror_r +# endif +# else +/* If a temporary buffer is required, at most BUFLEN bytes of BUF will be + used. */ +extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen) + __THROW __nonnull ((2)); +# ifdef __REDIRECT_NTH +extern char * __REDIRECT_NTH (strerror_r, + (int __errnum, char *__buf, size_t __buflen), + __glibc_strerror_r) __nonnull ((2)); +# else +# define strerror_r __glibc_strerror_r +# endif +# endif +#endif + +/* We define this function always since `bzero' is sometimes needed when + the namespace rules does not allow this. */ +#if 0 /* uClibc: disabled */ +extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); +#endif + +#ifdef __USE_BSD +# ifdef __UCLIBC_SUSV3_LEGACY__ +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ +extern void bcopy (__const void *__src, void *__dest, size_t __n) + __THROW __nonnull ((1, 2)); + +/* Set N bytes of S to 0. */ +extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); + +/* Compare N bytes of S1 and S2 (same as memcmp). */ +extern int bcmp (__const void *__s1, __const void *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +/* Find the first occurrence of C in S (same as strchr). */ +extern char *index (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); + +/* Find the last occurrence of C in S (same as strrchr). */ +extern char *rindex (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); +# else +# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__ +/* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3. + * They are replaced as proposed by SuSv3. Don't sync this part + * with glibc and keep it in sync with strings.h. */ + +# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0) +# define bzero(s,n) (memset((s), '\0', (n)), (void) 0) +# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n)) +# define index(s,c) strchr((s), (c)) +# define rindex(s,c) strrchr((s), (c)) +# endif +# endif + +/* Return the position of the first bit set in I, or 0 if none are set. + The least-significant bit is position 1, the most-significant 32. */ +extern int ffs (int __i) __THROW __attribute__ ((__const__)); + +/* The following two functions are non-standard but necessary for non-32 bit + platforms. */ +#if 0 /*def __USE_GNU*/ +extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); +# ifdef __GNUC__ +__extension__ extern int ffsll (long long int __ll) + __THROW __attribute__ ((__const__)); +# endif +# endif + +/* Compare S1 and S2, ignoring case. */ +extern int strcasecmp (__const char *__s1, __const char *__s2) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +/* Compare no more than N chars of S1 and S2, ignoring case. */ +extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); +#endif /* Use BSD. */ + +#if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__ +/* Again versions of a few functions which use the given locale instead + of the global one. */ +extern int strcasecmp_l (__const char *__s1, __const char *__s2, + __locale_t __loc) + __THROW __attribute_pure__ __nonnull ((1, 2, 3)); + +extern int strncasecmp_l (__const char *__s1, __const char *__s2, + size_t __n, __locale_t __loc) + __THROW __attribute_pure__ __nonnull ((1, 2, 4)); +#endif + +#ifdef __USE_BSD +/* Return the next DELIM-delimited token from *STRINGP, + terminating it with a '\0', and update *STRINGP to point past it. */ +extern char *strsep (char **__restrict __stringp, + __const char *__restrict __delim) + __THROW __nonnull ((1, 2)); +#endif + +#ifdef __USE_GNU +/* Compare S1 and S2 as strings holding name & indices/version numbers. */ +#if 0 +extern int strverscmp (__const char *__s1, __const char *__s2) + __THROW __attribute_pure__ __nonnull ((1, 2)); +#endif + +/* Return a string describing the meaning of the signal number in SIG. */ +extern char *strsignal (int __sig) __THROW; + +/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */ +#if 0 /* uClibc: disabled */ +extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src) + __THROW __nonnull ((1, 2)); +#endif +extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src) + __THROW __nonnull ((1, 2)); + +/* Copy no more than N characters of SRC to DEST, returning the address of + the last character written into DEST. */ +#if 0 /* uClibc: disabled */ +extern char *__stpncpy (char *__restrict __dest, + __const char *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)); +#endif +extern char *stpncpy (char *__restrict __dest, + __const char *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)); + +#if 0 /* uClibc does not support strfry or memfrob. */ +/* Sautee STRING briskly. */ +extern char *strfry (char *__string) __THROW __nonnull ((1)); + +/* Frobnicate N bytes of S. */ +extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1)); +#endif + +# ifndef basename +/* Return the file name within directory of FILENAME. We don't + declare the function if the `basename' macro is available (defined + in ) which makes the XPG version of this function + available. */ +extern char *basename (__const char *__filename) __THROW __nonnull ((1)); +# endif +#endif + + +#ifdef __USE_BSD +/* Two OpenBSD extension functions. */ +extern size_t strlcat(char *__restrict dst, const char *__restrict src, + size_t n) __THROW __nonnull ((1, 2)); +extern size_t strlcpy(char *__restrict dst, const char *__restrict src, + size_t n) __THROW __nonnull ((1, 2)); +#endif + +__END_DECLS + +#endif /* string.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/strings.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/strings.h new file mode 100644 index 0000000..107c53a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/strings.h @@ -0,0 +1,95 @@ +/* Copyright (C) 1991,92,96,97,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _STRINGS_H +#define _STRINGS_H 1 + +/* We don't need and should not read this file if was already + read. The one exception being that if __USE_BSD isn't defined, then + these aren't defined in string.h, so we need to define them here. */ + +/* keep this file in sync w/ string.h, the glibc version is out of date */ + +#if !defined _STRING_H || !defined __USE_BSD + +# include +# define __need_size_t +# include + +__BEGIN_DECLS + +# ifdef __UCLIBC_SUSV3_LEGACY__ +/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ +extern void bcopy (__const void *__src, void *__dest, size_t __n) + __THROW __nonnull ((1, 2)); + +/* Set N bytes of S to 0. */ +extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); + +/* Compare N bytes of S1 and S2 (same as memcmp). */ +extern int bcmp (__const void *__s1, __const void *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +/* Find the first occurrence of C in S (same as strchr). */ +extern char *index (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); + +/* Find the last occurrence of C in S (same as strrchr). */ +extern char *rindex (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); +# else +# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__ +/* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3. + * They are replaced as proposed by SuSv3. Don't sync this part + * with glibc and keep it in sync with string.h. */ + +# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0) +# define bzero(s,n) (memset((s), '\0', (n)), (void) 0) +# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n)) +# define index(s,c) strchr((s), (c)) +# define rindex(s,c) strrchr((s), (c)) +# endif +# endif + +/* Return the position of the first bit set in I, or 0 if none are set. + The least-significant bit is position 1, the most-significant 32. */ +extern int ffs (int __i) __THROW __attribute__ ((__const__)); + +/* The following two functions are non-standard but necessary for non-32 bit + platforms. */ +#if 0 /*def __USE_GNU*/ +extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); +# ifdef __GNUC__ +__extension__ extern int ffsll (long long int __ll) + __THROW __attribute__ ((__const__)); +# endif +# endif + +/* Compare S1 and S2, ignoring case. */ +extern int strcasecmp (__const char *__s1, __const char *__s2) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +/* Compare no more than N chars of S1 and S2, ignoring case. */ +extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +__END_DECLS + +#endif /* string.h */ + +#endif /* strings.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/acct.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/acct.h new file mode 100644 index 0000000..9ee8564 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/acct.h @@ -0,0 +1,77 @@ +/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_ACCT_H +#define _SYS_ACCT_H 1 + +#include + +#define __need_time_t +#include +#include + +__BEGIN_DECLS + +#define ACCT_COMM 16 + +/* + comp_t is a 16-bit "floating" point number with a 3-bit base 8 + exponent and a 13-bit fraction. See linux/kernel/acct.c for the + specific encoding system used. +*/ + +typedef u_int16_t comp_t; + +struct acct + { + char ac_flag; /* Accounting flags. */ + u_int16_t ac_uid; /* Accounting user ID. */ + u_int16_t ac_gid; /* Accounting group ID. */ + u_int16_t ac_tty; /* Controlling tty. */ + u_int32_t ac_btime; /* Beginning time. */ + comp_t ac_utime; /* Accounting user time. */ + comp_t ac_stime; /* Accounting system time. */ + comp_t ac_etime; /* Accounting elapsed time. */ + comp_t ac_mem; /* Accounting average memory usage. */ + comp_t ac_io; /* Accounting chars transferred. */ + comp_t ac_rw; /* Accounting blocks read or written. */ + comp_t ac_minflt; /* Accounting minor pagefaults. */ + comp_t ac_majflt; /* Accounting major pagefaults. */ + comp_t ac_swaps; /* Accounting number of swaps. */ + u_int32_t ac_exitcode; /* Accounting process exitcode. */ + char ac_comm[ACCT_COMM+1]; /* Accounting command name. */ + char ac_pad[10]; /* Accounting padding bytes. */ + }; + +enum + { + AFORK = 0x01, /* Has executed fork, but no exec. */ + ASU = 0x02, /* Used super-user privileges. */ + ACORE = 0x08, /* Dumped core. */ + AXSIG = 0x10 /* Killed by a signal. */ + }; + +#define AHZ 100 + + +/* Switch process accounting on and off. */ +extern int acct (__const char *__filename) __THROW; + +__END_DECLS + +#endif /* sys/acct.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/asm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/asm.h new file mode 100644 index 0000000..76f6af3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/asm.h @@ -0,0 +1,473 @@ +/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ralf Baechle . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_ASM_H +#define _SYS_ASM_H + +#include + +#ifndef CAT +# ifdef __STDC__ +# define __CAT(str1,str2) str1##str2 +# else +# define __CAT(str1,str2) str1/**/str2 +# endif +# define CAT(str1,str2) __CAT(str1,str2) +#endif + +/* + * Macros to handle different pointer/register sizes for 32/64-bit code + * + * 64 bit address space isn't used yet, so we may use the R3000 32 bit + * defines for now. + */ +#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32) +# define PTR .word +# define PTRSIZE 4 +# define PTRLOG 2 +#elif (_MIPS_SIM == _MIPS_SIM_ABI64) +# define PTR .dword +# define PTRSIZE 8 +# define PTRLOG 3 +#endif + +/* + * PIC specific declarations + */ +#if (_MIPS_SIM == _MIPS_SIM_ABI32) +# ifdef __PIC__ +# define CPRESTORE(register) \ + .cprestore register +# define CPLOAD(register) \ + .cpload register +# else +# define CPRESTORE(register) +# define CPLOAD(register) +# endif + +# define CPADD(register) \ + .cpadd register + +/* + * Set gp when at 1st instruction + */ +# define SETUP_GP \ + .set noreorder; \ + .cpload $25; \ + .set reorder +/* Set gp when not at 1st instruction */ +# define SETUP_GPX(r) \ + .set noreorder; \ + move r, $31; /* Save old ra. */ \ + bal 10f; /* Find addr of cpload. */ \ + nop; \ +10: \ + .cpload $31; \ + move $31, r; \ + .set reorder +# define SETUP_GPX_L(r, l) \ + .set noreorder; \ + move r, $31; /* Save old ra. */ \ + bal l; /* Find addr of cpload. */ \ + nop; \ +l: \ + .cpload $31; \ + move $31, r; \ + .set reorder +# define SAVE_GP(x) \ + .cprestore x /* Save gp trigger t9/jalr conversion. */ +# define SETUP_GP64(a, b) +# define SETUP_GPX64(a, b) +# define SETUP_GPX64_L(cp_reg, ra_save, l) +# define RESTORE_GP64 +# define USE_ALT_CP(a) +#else /* (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) */ +/* + * For callee-saved gp calling convention: + */ +# define SETUP_GP +# define SETUP_GPX(r) +# define SETUP_GPX_L(r, l) +# define SAVE_GP(x) + +# define SETUP_GP64(gpoffset, proc) \ + .cpsetup $25, gpoffset, proc +# define SETUP_GPX64(cp_reg, ra_save) \ + move ra_save, $31; /* Save old ra. */ \ + .set noreorder; \ + bal 10f; /* Find addr of .cpsetup. */ \ + nop; \ +10: \ + .set reorder; \ + .cpsetup $31, cp_reg, 10b; \ + move $31, ra_save +# define SETUP_GPX64_L(cp_reg, ra_save, l) \ + move ra_save, $31; /* Save old ra. */ \ + .set noreorder; \ + bal l; /* Find addr of .cpsetup. */ \ + nop; \ +l: \ + .set reorder; \ + .cpsetup $31, cp_reg, l; \ + move $31, ra_save +# define RESTORE_GP64 \ + .cpreturn +/* Use alternate register for context pointer. */ +# define USE_ALT_CP(reg) \ + .cplocal reg +#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */ + +/* + * Stack Frame Definitions + */ +#if (_MIPS_SIM == _MIPS_SIM_ABI32) +# define NARGSAVE 4 /* Space for 4 argument registers must be allocated. */ +#endif +#if (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32) +# define NARGSAVE 0 /* No caller responsibilities. */ +#endif + + +/* + * LEAF - declare leaf routine + */ +#define LEAF(symbol) \ + .globl symbol; \ + .align 2; \ + .type symbol,@function; \ + .ent symbol,0; \ +symbol: .frame sp,0,ra + +/* + * NESTED - declare nested routine entry point + */ +#define NESTED(symbol, framesize, rpc) \ + .globl symbol; \ + .align 2; \ + .type symbol,@function; \ + .ent symbol,0; \ +symbol: .frame sp, framesize, rpc + +/* + * END - mark end of function + */ +#ifndef END +# define END(function) \ + .end function; \ + .size function,.-function +#endif + +/* + * EXPORT - export definition of symbol + */ +#define EXPORT(symbol) \ + .globl symbol; \ +symbol: + +/* + * ABS - export absolute symbol + */ +#define ABS(symbol,value) \ + .globl symbol; \ +symbol = value + +#define PANIC(msg) \ + .set push; \ + .set reorder; \ + la a0,8f; \ + jal panic; \ +9: b 9b; \ + .set pop; \ + TEXT(msg) + +/* + * Print formated string + */ +#define PRINT(string) \ + .set push; \ + .set reorder; \ + la a0,8f; \ + jal printk; \ + .set pop; \ + TEXT(string) + +#define TEXT(msg) \ + .data; \ +8: .asciiz msg; \ + .previous; + +/* + * Build text tables + */ +#define TTABLE(string) \ + .text; \ + .word 1f; \ + .previous; \ + .data; \ +1: .asciz string; \ + .previous + +/* + * MIPS IV pref instruction. + * Use with .set noreorder only! + * + * MIPS IV implementations are free to treat this as a nop. The R5000 + * is one of them. So we should have an option not to use this instruction. + */ +#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \ + (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64) +# define PREF(hint,addr) \ + pref hint,addr +# define PREFX(hint,addr) \ + prefx hint,addr +#else +# define PREF +# define PREFX +#endif + +/* + * MIPS ISA IV/V movn/movz instructions and equivalents for older CPUs. + */ +#if _MIPS_ISA == _MIPS_ISA_MIPS1 +# define MOVN(rd,rs,rt) \ + .set push; \ + .set reorder; \ + beqz rt,9f; \ + move rd,rs; \ + .set pop; \ +9: +# define MOVZ(rd,rs,rt) \ + .set push; \ + .set reorder; \ + bnez rt,9f; \ + move rd,rt; \ + .set pop; \ +9: +#endif /* _MIPS_ISA == _MIPS_ISA_MIPS1 */ +#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) +# define MOVN(rd,rs,rt) \ + .set push; \ + .set noreorder; \ + bnezl rt,9f; \ + move rd,rs; \ + .set pop; \ +9: +# define MOVZ(rd,rs,rt) \ + .set push; \ + .set noreorder; \ + beqzl rt,9f; \ + movz rd,rs; \ + .set pop; \ +9: +#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */ +#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \ + (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64) +# define MOVN(rd,rs,rt) \ + movn rd,rs,rt +# define MOVZ(rd,rs,rt) \ + movz rd,rs,rt +#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) */ + +/* + * Stack alignment + */ +#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) +# define ALSZ 15 +# define ALMASK ~15 +#else +# define ALSZ 7 +# define ALMASK ~7 +#endif + +/* + * Size of a register + */ +#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) +# define SZREG 8 +#else +# define SZREG 4 +#endif + +/* + * Use the following macros in assemblercode to load/store registers, + * pointers etc. + */ +#if (SZREG == 4) +# define REG_S sw +# define REG_L lw +#else +# define REG_S sd +# define REG_L ld +#endif + +/* + * How to add/sub/load/store/shift C int variables. + */ +#if (_MIPS_SZINT == 32) +# define INT_ADD add +# define INT_ADDI addi +# define INT_ADDU addu +# define INT_ADDIU addiu +# define INT_SUB add +# define INT_SUBI subi +# define INT_SUBU subu +# define INT_SUBIU subu +# define INT_L lw +# define INT_S sw +#endif + +#if (_MIPS_SZINT == 64) +# define INT_ADD dadd +# define INT_ADDI daddi +# define INT_ADDU daddu +# define INT_ADDIU daddiu +# define INT_SUB dadd +# define INT_SUBI dsubi +# define INT_SUBU dsubu +# define INT_SUBIU dsubu +# define INT_L ld +# define INT_S sd +#endif + +/* + * How to add/sub/load/store/shift C long variables. + */ +#if (_MIPS_SZLONG == 32) +# define LONG_ADD add +# define LONG_ADDI addi +# define LONG_ADDU addu +# define LONG_ADDIU addiu +# define LONG_SUB add +# define LONG_SUBI subi +# define LONG_SUBU subu +# define LONG_SUBIU subu +# define LONG_L lw +# define LONG_S sw +# define LONG_SLL sll +# define LONG_SLLV sllv +# define LONG_SRL srl +# define LONG_SRLV srlv +# define LONG_SRA sra +# define LONG_SRAV srav +#endif + +#if (_MIPS_SZLONG == 64) +# define LONG_ADD dadd +# define LONG_ADDI daddi +# define LONG_ADDU daddu +# define LONG_ADDIU daddiu +# define LONG_SUB dadd +# define LONG_SUBI dsubi +# define LONG_SUBU dsubu +# define LONG_SUBIU dsubu +# define LONG_L ld +# define LONG_S sd +# define LONG_SLL dsll +# define LONG_SLLV dsllv +# define LONG_SRL dsrl +# define LONG_SRLV dsrlv +# define LONG_SRA dsra +# define LONG_SRAV dsrav +#endif + +/* + * How to add/sub/load/store/shift pointers. + */ +#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 32) +# define PTR_ADD add +# define PTR_ADDI addi +# define PTR_ADDU addu +# define PTR_ADDIU addiu +# define PTR_SUB add +# define PTR_SUBI subi +# define PTR_SUBU subu +# define PTR_SUBIU subu +# define PTR_L lw +# define PTR_LA la +# define PTR_S sw +# define PTR_SLL sll +# define PTR_SLLV sllv +# define PTR_SRL srl +# define PTR_SRLV srlv +# define PTR_SRA sra +# define PTR_SRAV srav + +# define PTR_SCALESHIFT 2 +#endif + +#if _MIPS_SIM == _MIPS_SIM_NABI32 +# define PTR_ADD add +# define PTR_ADDI addi +# define PTR_ADDU add /* no u */ +# define PTR_ADDIU addi /* no u */ +# define PTR_SUB add +# define PTR_SUBI subi +# define PTR_SUBU sub /* no u */ +# define PTR_SUBIU sub /* no u */ +# define PTR_L lw +# define PTR_LA la +# define PTR_S sw +# define PTR_SLL sll +# define PTR_SLLV sllv +# define PTR_SRL srl +# define PTR_SRLV srlv +# define PTR_SRA sra +# define PTR_SRAV srav + +# define PTR_SCALESHIFT 2 +#endif + +#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 64 /* o64??? */) \ + || _MIPS_SIM == _MIPS_SIM_ABI64 +# define PTR_ADD dadd +# define PTR_ADDI daddi +# define PTR_ADDU daddu +# define PTR_ADDIU daddiu +# define PTR_SUB dadd +# define PTR_SUBI dsubi +# define PTR_SUBU dsubu +# define PTR_SUBIU dsubu +# define PTR_L ld +# define PTR_LA dla +# define PTR_S sd +# define PTR_SLL dsll +# define PTR_SLLV dsllv +# define PTR_SRL dsrl +# define PTR_SRLV dsrlv +# define PTR_SRA dsra +# define PTR_SRAV dsrav + +# define PTR_SCALESHIFT 3 +#endif + +/* + * Some cp0 registers were extended to 64bit for MIPS III. + */ +#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \ + (_MIPS_ISA == _MIPS_ISA_MIPS32) +# define MFC0 mfc0 +# define MTC0 mtc0 +#endif +#if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \ + (_MIPS_ISA == _MIPS_ISA_MIPS5) || (_MIPS_ISA == _MIPS_ISA_MIPS64) +# define MFC0 dmfc0 +# define MTC0 dmtc0 +#endif + +#endif /* sys/asm.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/bitypes.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/bitypes.h new file mode 100644 index 0000000..3a9860f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/bitypes.h @@ -0,0 +1,3 @@ +/* The GNU defines all the necessary types. */ + +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/cachectl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/cachectl.h new file mode 100644 index 0000000..a93e1fb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/cachectl.h @@ -0,0 +1,42 @@ +/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_CACHECTL_H +#define _SYS_CACHECTL_H 1 + +#include + +/* + * Get the kernel definition for the op bits. + */ +#include + +__BEGIN_DECLS + +#ifdef __USE_MISC +extern int cachectl (void *addr, __const int nbytes, __const int op) __THROW; +#endif +extern int __cachectl (void *addr, __const int nbytes, __const int op) __THROW; +#ifdef __USE_MISC +extern int cacheflush (void *addr, __const int nbytes, __const int op) __THROW; +#endif +extern int _flush_cache (char *addr, __const int nbytes, __const int op) __THROW; + +__END_DECLS + +#endif /* sys/cachectl.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/cdefs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/cdefs.h new file mode 100644 index 0000000..8daac15 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/cdefs.h @@ -0,0 +1,320 @@ +/* Copyright (C) 1992-2001, 2002, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_CDEFS_H +#define _SYS_CDEFS_H 1 + +/* We are almost always included from features.h. */ +#ifndef _FEATURES_H +# include +#endif + +/* The GNU libc does not support any K&R compilers or the traditional mode + of ISO C compilers anymore. Check for some of the combinations not + anymore supported. */ +#if defined __GNUC__ && !defined __STDC__ +# error "You need a ISO C conforming compiler to use the glibc headers" +#endif + +/* Some user header file might have defined this before. */ +#undef __P +#undef __PMT + +#ifdef __GNUC__ + +/* GCC can always grok prototypes. For C++ programs we add throw() + to help it optimize the function calls. But this works only with + gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions + as non-throwing using a function attribute since programs can use + the -fexceptions options for C code as well. */ +# if !defined __cplusplus && __GNUC_PREREQ (3, 3) +# define __THROW __attribute__ ((__nothrow__)) +# define __NTH(fct) __attribute__ ((__nothrow__)) fct +# else +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# define __NTH(fct) fct throw () +# else +# define __THROW +# define __NTH(fct) fct +# endif +# endif + +#else /* Not GCC. */ + +# define __inline /* No inline functions. */ + +# define __THROW +# define __NTH(fct) fct + +# define __const const +# define __signed signed +# define __volatile volatile + +#endif /* GCC. */ + +/* These two macros are not used in glibc anymore. They are kept here + only because some other projects expect the macros to be defined. */ +#define __P(args) args +#define __PMT(args) args + +/* For these things, GCC behaves the ANSI way normally, + and the non-ANSI way under -traditional. */ + +#define __CONCAT(x,y) x ## y +#define __STRING(x) #x + +/* This is not a typedef so `const __ptr_t' does the right thing. */ +#define __ptr_t void * +#define __long_double_t long double + + +/* C++ needs to know that types and declarations are C, not C++. */ +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS +#endif + + +/* The standard library needs the functions from the ISO C90 standard + in the std namespace. At the same time we want to be safe for + future changes and we include the ISO C99 code in the non-standard + namespace __c99. The C++ wrapper header take case of adding the + definitions to the global namespace. */ +#if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES +# define __BEGIN_NAMESPACE_STD namespace std { +# define __END_NAMESPACE_STD } +# define __USING_NAMESPACE_STD(name) using std::name; +# define __BEGIN_NAMESPACE_C99 namespace __c99 { +# define __END_NAMESPACE_C99 } +# define __USING_NAMESPACE_C99(name) using __c99::name; +#else +/* For compatibility we do not add the declarations into any + namespace. They will end up in the global namespace which is what + old code expects. */ +# define __BEGIN_NAMESPACE_STD +# define __END_NAMESPACE_STD +# define __USING_NAMESPACE_STD(name) +# define __BEGIN_NAMESPACE_C99 +# define __END_NAMESPACE_C99 +# define __USING_NAMESPACE_C99(name) +#endif + + +/* Support for bounded pointers. */ +#ifndef __BOUNDED_POINTERS__ +# define __bounded /* nothing */ +# define __unbounded /* nothing */ +# define __ptrvalue /* nothing */ +#endif + + +/* Fortify support. */ +#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) +#define __bos0(ptr) __builtin_object_size (ptr, 0) +#define __warndecl(name, msg) extern void name (void) + + +/* Support for flexible arrays. */ +#if __GNUC_PREREQ (2,97) +/* GCC 2.97 supports C99 flexible array members. */ +# define __flexarr [] +#else +# ifdef __GNUC__ +# define __flexarr [0] +# else +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __flexarr [] +# else +/* Some other non-C99 compiler. Approximate with [1]. */ +# define __flexarr [1] +# endif +# endif +#endif + + +/* __asm__ ("xyz") is used throughout the headers to rename functions + at the assembly language level. This is wrapped by the __REDIRECT + macro, in order to support compilers that can do this some other + way. When compilers don't support asm-names at all, we have to do + preprocessor tricks instead (which don't have exactly the right + semantics, but it's the best we can do). + + Example: + int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ + +#if defined __GNUC__ && __GNUC__ >= 2 + +# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) +# ifdef __cplusplus +# define __REDIRECT_NTH(name, proto, alias) \ + name proto __THROW __asm__ (__ASMNAME (#alias)) +# else +# define __REDIRECT_NTH(name, proto, alias) \ + name proto __asm__ (__ASMNAME (#alias)) __THROW +# endif +# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) +# define __ASMNAME2(prefix, cname) __STRING (prefix) cname + +/* +#elif __SOME_OTHER_COMPILER__ + +# define __REDIRECT(name, proto, alias) name proto; \ + _Pragma("let " #name " = " #alias) +*/ +#endif + +/* GCC has various useful declarations that can be made with the + `__attribute__' syntax. All of the ways we use this do fine if + they are omitted for compilers that don't understand it. */ +#if !defined __GNUC__ || __GNUC__ < 2 +# define __attribute__(xyz) /* Ignore */ +#endif + +/* We make this a no-op unless it can be used as both a variable and + a type attribute. gcc 2.8 is known to support both. */ +#if __GNUC_PREREQ (2,8) +# define __attribute_aligned__(size) __attribute__ ((__aligned__ (size))) +#else +# define __attribute_aligned__(size) /* Ignore */ +#endif + +/* At some point during the gcc 2.96 development the `malloc' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (2,96) +# define __attribute_malloc__ __attribute__ ((__malloc__)) +#else +# define __attribute_malloc__ /* Ignore */ +#endif + +/* At some point during the gcc 2.96 development the `pure' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (2,96) +# define __attribute_pure__ __attribute__ ((__pure__)) +#else +# define __attribute_pure__ /* Ignore */ +#endif + +/* At some point during the gcc 3.1 development the `used' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (3,1) +# define __attribute_used__ __attribute__ ((__used__)) +# define __attribute_noinline__ __attribute__ ((__noinline__)) +#else +# define __attribute_used__ __attribute__ ((__unused__)) +# define __attribute_noinline__ /* Ignore */ +#endif + +/* gcc allows marking deprecated functions. */ +#if __GNUC_PREREQ (3,2) && !defined(__UCLIBC_HIDE_DEPRECATED__) +# define __attribute_deprecated__ __attribute__ ((__deprecated__)) +#else +# define __attribute_deprecated__ /* Ignore */ +#endif + +/* At some point during the gcc 2.8 development the `format_arg' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. + If several `format_arg' attributes are given for the same function, in + gcc-3.0 and older, all but the last one are ignored. In newer gccs, + all designated arguments are considered. */ +#if __GNUC_PREREQ (2,8) +# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) +#else +# define __attribute_format_arg__(x) /* Ignore */ +#endif + +/* At some point during the gcc 2.97 development the `strfmon' format + attribute for functions was introduced. We don't want to use it + unconditionally (although this would be possible) since it + generates warnings. */ +#if __GNUC_PREREQ (2,97) +# define __attribute_format_strfmon__(a,b) \ + __attribute__ ((__format__ (__strfmon__, a, b))) +#else +# define __attribute_format_strfmon__(a,b) /* Ignore */ +#endif + +/* The nonull function attribute allows to mark pointer parameters which + must not be NULL. */ +#if __GNUC_PREREQ (3,3) +# define __nonnull(params) __attribute__ ((__nonnull__ params)) +#else +# define __nonnull(params) +#endif + +/* If fortification mode, we warn about unused results of certain + function calls which can lead to problems. */ +#if __GNUC_PREREQ (3,4) +# define __attribute_warn_unused_result__ \ + __attribute__ ((__warn_unused_result__)) +# if __USE_FORTIFY_LEVEL > 0 +# define __wur __attribute_warn_unused_result__ +# endif +#else +# define __attribute_warn_unused_result__ /* empty */ +#endif +#ifndef __wur +# define __wur /* Ignore */ +#endif + +/* Forces a function to be always inlined. */ +#if __GNUC_PREREQ (3,2) +# define __always_inline __inline __attribute__ ((__always_inline__)) +#else +# define __always_inline __inline +#endif + +/* It is possible to compile containing GCC extensions even if GCC is + run in pedantic mode if the uses are carefully marked using the + `__extension__' keyword. But this is not generally available before + version 2.8. */ +#if !__GNUC_PREREQ (2,8) +# define __extension__ /* Ignore */ +#endif + +/* __restrict is known in EGCS 1.2 and above. */ +#if !__GNUC_PREREQ (2,92) +# define __restrict /* Ignore */ +#endif + +/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is + array_name[restrict] + GCC 3.1 supports this. */ +#if __GNUC_PREREQ (3,1) && !defined __GNUG__ +# define __restrict_arr __restrict +#else +# ifdef __GNUC__ +# define __restrict_arr /* Not supported in old GCC. */ +# else +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __restrict_arr restrict +# else +/* Some other non-C99 compiler. */ +# define __restrict_arr /* Not supported. */ +# endif +# endif +#endif + +#endif /* sys/cdefs.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/dir.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/dir.h new file mode 100644 index 0000000..2611d6c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/dir.h @@ -0,0 +1,28 @@ +/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_DIR_H +#define _SYS_DIR_H 1 + +#include + +#include + +#define direct dirent + +#endif /* sys/dir.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/epoll.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/epoll.h new file mode 100644 index 0000000..68f173a --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/epoll.h @@ -0,0 +1,110 @@ +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_EPOLL_H +#define _SYS_EPOLL_H 1 + +#include +#include + + +enum EPOLL_EVENTS + { + EPOLLIN = 0x001, +#define EPOLLIN EPOLLIN + EPOLLPRI = 0x002, +#define EPOLLPRI EPOLLPRI + EPOLLOUT = 0x004, +#define EPOLLOUT EPOLLOUT + EPOLLRDNORM = 0x040, +#define EPOLLRDNORM EPOLLRDNORM + EPOLLRDBAND = 0x080, +#define EPOLLRDBAND EPOLLRDBAND + EPOLLWRNORM = 0x100, +#define EPOLLWRNORM EPOLLWRNORM + EPOLLWRBAND = 0x200, +#define EPOLLWRBAND EPOLLWRBAND + EPOLLMSG = 0x400, +#define EPOLLMSG EPOLLMSG + EPOLLERR = 0x008, +#define EPOLLERR EPOLLERR + EPOLLHUP = 0x010, +#define EPOLLHUP EPOLLHUP + EPOLLONESHOT = (1 << 30), +#define EPOLLONESHOT EPOLLONESHOT + EPOLLET = (1 << 31) +#define EPOLLET EPOLLET + }; + + +/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ +#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */ +#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */ +#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */ + + +typedef union epoll_data +{ + void *ptr; + int fd; + uint32_t u32; + uint64_t u64; +} epoll_data_t; + +struct epoll_event +{ + uint32_t events; /* Epoll events */ + epoll_data_t data; /* User data variable */ +}; + + +__BEGIN_DECLS + +/* Creates an epoll instance. Returns an fd for the new instance. + The "size" parameter is a hint specifying the number of file + descriptors to be associated with the new instance. The fd + returned by epoll_create() should be closed with close(). */ +extern int epoll_create (int __size) __THROW; + + +/* Manipulate an epoll instance "epfd". Returns 0 in case of success, + -1 in case of error ( the "errno" variable will contain the + specific error code ) The "op" parameter is one of the EPOLL_CTL_* + constants defined above. The "fd" parameter is the target of the + operation. The "event" parameter describes which events the caller + is interested in and any associated user data. */ +extern int epoll_ctl (int __epfd, int __op, int __fd, + struct epoll_event *__event) __THROW; + + +/* Wait for events on an epoll instance "epfd". Returns the number of + triggered events returned in "events" buffer. Or -1 in case of + error with the "errno" variable set to the specific error code. The + "events" parameter is a buffer that will contain triggered + events. The "maxevents" is the maximum number of events to be + returned ( usually size of "events" ). The "timeout" parameter + specifies the maximum wait time in milliseconds (-1 == infinite). + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int epoll_wait (int __epfd, struct epoll_event *__events, + int __maxevents, int __timeout); + +__END_DECLS + +#endif /* sys/epoll.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/errno.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/errno.h new file mode 100644 index 0000000..339f4fc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/errno.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fcntl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fcntl.h new file mode 100644 index 0000000..cd30455 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fcntl.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/file.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/file.h new file mode 100644 index 0000000..93b3635 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/file.h @@ -0,0 +1,56 @@ +/* Copyright (C) 1991, 92, 96, 97, 98, 99 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_FILE_H +#define _SYS_FILE_H 1 + +#include + +#ifndef _FCNTL_H +# include +#endif + +__BEGIN_DECLS + + +/* Alternate names for values for the WHENCE argument to `lseek'. + These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */ +#ifndef L_SET +# define L_SET 0 /* Seek from beginning of file. */ +# define L_INCR 1 /* Seek from current position. */ +# define L_XTND 2 /* Seek from end of file. */ +#endif + + +/* Operations for the `flock' call. */ +#define LOCK_SH 1 /* Shared lock. */ +#define LOCK_EX 2 /* Exclusive lock. */ +#define LOCK_UN 8 /* Unlock. */ + +/* Can be OR'd in to one of the above. */ +#define LOCK_NB 4 /* Don't block when locking. */ + + +/* Apply or remove an advisory lock, according to OPERATION, + on the file FD refers to. */ +extern int flock (int __fd, int __operation) __THROW; + + +__END_DECLS + +#endif /* sys/file.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fpregdef.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fpregdef.h new file mode 100644 index 0000000..3781152 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fpregdef.h @@ -0,0 +1,61 @@ +/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_FPREGDEF_H +#define _SYS_FPREGDEF_H + +/* + * These definitions only cover the R3000-ish 16/32 register model. + * But we're trying to be R3000 friendly anyway ... + */ +#define fv0 $f0 /* return value */ +#define fv0f $f1 +#define fv1 $f2 +#define fv1f $f3 +#define fa0 $f12 /* argument registers */ +#define fa0f $f13 +#define fa1 $f14 +#define fa1f $f15 +#define ft0 $f4 /* caller saved */ +#define ft0f $f5 +#define ft1 $f6 +#define ft1f $f7 +#define ft2 $f8 +#define ft2f $f9 +#define ft3 $f10 +#define ft3f $f11 +#define ft4 $f16 +#define ft4f $f17 +#define ft5 $f18 +#define ft5f $f19 +#define fs0 $f20 /* callee saved */ +#define fs0f $f21 +#define fs1 $f22 +#define fs1f $f23 +#define fs2 $f24 +#define fs2f $f25 +#define fs3 $f26 +#define fs3f $f27 +#define fs4 $f28 +#define fs4f $f29 +#define fs5 $f30 +#define fs5f $f31 + +#define fcr31 $31 /* FPU status register */ + +#endif /* sys/fpregdef.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fsuid.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fsuid.h new file mode 100644 index 0000000..4ecb199 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/fsuid.h @@ -0,0 +1,36 @@ +/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_FSUID_H +#define _SYS_FSUID_H 1 + +#include +#include + +__BEGIN_DECLS + +/* Change uid used for file access control to UID, without affecting + other privileges (such as who can send signals at the process). */ +extern int setfsuid (__uid_t __uid) __THROW; + +/* Ditto for group id. */ +extern int setfsgid (__gid_t __gid) __THROW; + +__END_DECLS + +#endif /* fsuid.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/inotify.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/inotify.h new file mode 100644 index 0000000..0131db9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/inotify.h @@ -0,0 +1,92 @@ +/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_INOTIFY_H +#define _SYS_INOTIFY_H 1 + +#include + + +/* Structure describing an inotify event. */ +struct inotify_event +{ + int wd; /* Watch descriptor. */ + uint32_t mask; /* Watch mask. */ + uint32_t cookie; /* Cookie to synchronize two events. */ + uint32_t len; /* Length (including NULs) of name. */ + char name __flexarr; /* Name. */ +}; + + +/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */ +#define IN_ACCESS 0x00000001 /* File was accessed. */ +#define IN_MODIFY 0x00000002 /* File was modified. */ +#define IN_ATTRIB 0x00000004 /* Metadata changed. */ +#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */ +#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */ +#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ +#define IN_OPEN 0x00000020 /* File was opened. */ +#define IN_MOVED_FROM 0x00000040 /* File was moved from X. */ +#define IN_MOVED_TO 0x00000080 /* File was moved to Y. */ +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ +#define IN_CREATE 0x00000100 /* Subfile was created. */ +#define IN_DELETE 0x00000200 /* Subfile was deleted. */ +#define IN_DELETE_SELF 0x00000400 /* Self was deleted. */ +#define IN_MOVE_SELF 0x00000800 /* Self was moved. */ + +/* Events sent by the kernel. */ +#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */ +#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */ +#define IN_IGNORED 0x00008000 /* File was ignored. */ + +/* Helper events. */ +#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ + +/* Special flags. */ +#define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a + directory. */ +#define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */ +#define IN_MASK_ADD 0x20000000 /* Add to the mask of an already + existing watch. */ +#define IN_ISDIR 0x40000000 /* Event occurred against dir. */ +#define IN_ONESHOT 0x80000000 /* Only send event once. */ + +/* All events which a program can wait on. */ +#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \ + | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \ + | IN_MOVED_TO | IN_CREATE | IN_DELETE \ + | IN_DELETE_SELF | IN_MOVE_SELF) + + +__BEGIN_DECLS + +/* Create and initialize inotify instance. */ +extern int inotify_init (void) __THROW; + +/* Add watch of object NAME to inotify instance FD. Notify about + events specified by MASK. */ +extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) + __THROW; + +/* Remove the watch specified by WD from the inotify instance FD. */ +extern int inotify_rm_watch (int __fd, uint32_t __wd) __THROW; + +__END_DECLS + +#endif /* sys/inotify.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ioctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ioctl.h new file mode 100644 index 0000000..6d8a0f4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ioctl.h @@ -0,0 +1,46 @@ +/* Copyright (C) 1991, 92, 93, 94, 96, 98, 99 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H 1 + +#include + +__BEGIN_DECLS + +/* Get the list of `ioctl' requests and related constants. */ +#include + +/* Define some types used by `ioctl' requests. */ +#include + +/* On a Unix system, the system probably defines some of + the symbols we define in (usually with the same + values). The code to generate has omitted these + symbols to avoid the conflict, but a Unix program expects + to define them, so we must include here. */ +#include + +/* Perform the I/O control operation specified by REQUEST on FD. + One argument may follow; its presence and type depend on REQUEST. + Return value depends on REQUEST. Usually -1 indicates error. */ +extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; + +__END_DECLS + +#endif /* sys/ioctl.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ipc.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ipc.h new file mode 100644 index 0000000..42806db --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ipc.h @@ -0,0 +1,58 @@ +/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IPC_H +#define _SYS_IPC_H 1 + +#include + +#if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2 +# warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE" +#endif + +/* Get system dependent definition of `struct ipc_perm' and more. */ +#include + +#ifndef __uid_t_defined +typedef __uid_t uid_t; +# define __uid_t_defined +#endif + +#ifndef __gid_t_defined +typedef __gid_t gid_t; +# define __gid_t_defined +#endif + +#ifndef __mode_t_defined +typedef __mode_t mode_t; +# define __mode_t_defined +#endif + +#ifndef __key_t_defined +typedef __key_t key_t; +# define __key_t_defined +#endif + +__BEGIN_DECLS + +/* Generates key for System V style IPC. */ +extern key_t ftok (__const char *__pathname, int __proj_id) __THROW; + +__END_DECLS + +#endif /* sys/ipc.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kd.h new file mode 100644 index 0000000..d459c07 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kd.h @@ -0,0 +1,35 @@ +/* Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_KD_H +#define _SYS_KD_H 1 + +/* Make sure the header is not loaded. */ +#ifndef _LINUX_TYPES_H +# define _LINUX_TYPES_H 1 +# define __undef_LINUX_TYPES_H +#endif + +#include + +#ifdef __undef_LINUX_TYPES_H +# undef _LINUX_TYPES_H +# undef __undef_LINUX_TYPES_H +#endif + +#endif /* sys/kd.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kdaemon.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kdaemon.h new file mode 100644 index 0000000..61491f9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/kdaemon.h @@ -0,0 +1,33 @@ +/* Copyright (C) 1996, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Interfaces to control the various kernel daemons. */ + +#ifndef _SYS_KDAEMON_H + +#define _SYS_KDAEMON_H 1 +#include + +__BEGIN_DECLS + +/* Start, flush, or tune the kernel's buffer flushing daemon. */ +extern int bdflush (int __func, long int __data) __THROW; + +__END_DECLS + +#endif /* _SYS_KDAEMON_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/klog.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/klog.h new file mode 100644 index 0000000..35f5fe4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/klog.h @@ -0,0 +1,34 @@ +/* Copyright (C) 1996, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_KLOG_H + +#define _SYS_KLOG_H 1 +#include + +__BEGIN_DECLS + +/* Control the kernel's logging facility. This corresponds exactly to + the kernel's syslog system call, but that name is easily confused + with the user-level syslog facility, which is something completely + different. */ +extern int klogctl (int __type, char *__bufp, int __len) __THROW; + +__END_DECLS + +#endif /* _SYS_KLOG_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mman.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mman.h new file mode 100644 index 0000000..76c2009 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mman.h @@ -0,0 +1,174 @@ +/* Definitions for BSD-style memory management. + Copyright (C) 1994-2000, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_MMAN_H +#define _SYS_MMAN_H 1 + +#include +#include +#define __need_size_t +#include + +#ifndef __off_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __off_t off_t; +# else +typedef __off64_t off_t; +# endif +# define __off_t_defined +#endif + +#ifndef __mode_t_defined +typedef __mode_t mode_t; +# define __mode_t_defined +#endif + +#include + +/* Return value of `mmap' in case of an error. */ +#define MAP_FAILED ((void *) -1) + +__BEGIN_DECLS +/* Map addresses starting near ADDR and extending for LEN bytes. from + OFFSET into the file FD describes according to PROT and FLAGS. If ADDR + is nonzero, it is the desired mapping address. If the MAP_FIXED bit is + set in FLAGS, the mapping will be at ADDR exactly (which must be + page-aligned); otherwise the system chooses a convenient nearby address. + The return value is the actual mapping address chosen or MAP_FAILED + for errors (in which case `errno' is set). A successful `mmap' call + deallocates any previous mapping for the affected region. */ + +#ifndef __USE_FILE_OFFSET64 +extern void *mmap (void *__addr, size_t __len, int __prot, + int __flags, int __fd, __off_t __offset) __THROW; +#else +# ifdef __REDIRECT +extern void * __REDIRECT (mmap, + (void *__addr, size_t __len, int __prot, + int __flags, int __fd, __off64_t __offset), + mmap64); +# else +# define mmap mmap64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern void *mmap64 (void *__addr, size_t __len, int __prot, + int __flags, int __fd, __off64_t __offset) __THROW; +#endif + +/* Deallocate any mapping for the region starting at ADDR and extending LEN + bytes. Returns 0 if successful, -1 for errors (and sets errno). */ +extern int munmap (void *__addr, size_t __len) __THROW; + +/* Change the memory protection of the region starting at ADDR and + extending LEN bytes to PROT. Returns 0 if successful, -1 for errors + (and sets errno). */ +extern int mprotect (void *__addr, size_t __len, int __prot) __THROW; + +#ifdef __ARCH_USE_MMU__ + +/* Synchronize the region starting at ADDR and extending LEN bytes with the + file it maps. Filesystem operations on a file being mapped are + unpredictable before this is done. Flags are from the MS_* set. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int msync (void *__addr, size_t __len, int __flags); + +#else + +/* On no-mmu systems you can't have real private mappings. */ +static inline int msync (void *__addr, size_t __len, int __flags) { return 0; } + +#endif + +#ifdef __USE_BSD +/* Advise the system about particular usage patterns the program follows + for the region starting at ADDR and extending LEN bytes. */ +extern int madvise (void *__addr, size_t __len, int __advice) __THROW; +#endif +#ifdef __USE_XOPEN2K +/* This is the POSIX name for this function. */ +extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW; +#endif + +#ifdef __ARCH_USE_MMU__ + +/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to + be memory resident. */ +extern int mlock (__const void *__addr, size_t __len) __THROW; + +/* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */ +extern int munlock (__const void *__addr, size_t __len) __THROW; + +/* Cause all currently mapped pages of the process to be memory resident + until unlocked by a call to the `munlockall', until the process exits, + or until the process calls `execve'. */ +extern int mlockall (int __flags) __THROW; + +/* All currently mapped pages of the process' address space become + unlocked. */ +extern int munlockall (void) __THROW; + +#else + +/* On no-mmu systems, memory cannot be swapped out, so + * these functions will always succeed. */ +static inline int mlock (__const void *__addr, size_t __len) { return 0; } +static inline int munlock (__const void *__addr, size_t __len) { return 0; } +static inline int mlockall (int __flags) { return 0; } +static inline int munlockall (void) { return 0; } + +#endif + +#ifdef __USE_MISC +/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length + NEW_LEN. If MREMAP_MAYMOVE is set in FLAGS the returned address + may differ from ADDR. If MREMAP_FIXED is set in FLAGS the function + takes another paramter which is a fixed address at which the block + resides after a successful call. */ +extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, + int __flags, ...) __THROW; + +/* mincore returns the memory residency status of the pages in the + current process's address space specified by [start, start + len). + The status is returned in a vector of bytes. The least significant + bit of each byte is 1 if the referenced page is in memory, otherwise + it is zero. */ +extern int mincore (void *__start, size_t __len, unsigned char *__vec) + __THROW; + +#if 0 +/* Remap arbitrary pages of a shared backing store within an existing + VMA. */ +extern int remap_file_pages (void *__start, size_t __size, int __prot, + size_t __pgoff, int __flags) __THROW; +#endif +#endif + + +/* Open shared memory segment. */ +extern int shm_open (__const char *__name, int __oflag, mode_t __mode); + +/* Remove shared memory segment. */ +extern int shm_unlink (__const char *__name); + +__END_DECLS + +#endif /* sys/mman.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mount.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mount.h new file mode 100644 index 0000000..b305549 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mount.h @@ -0,0 +1,119 @@ +/* Header file for mounting/unmount Linux filesystems. + Copyright (C) 1996,1997,1998,1999,2000,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This is taken from /usr/include/linux/fs.h. */ + +#ifndef _SYS_MOUNT_H +#define _SYS_MOUNT_H 1 + +#include +#include + +#define BLOCK_SIZE 1024 +#define BLOCK_SIZE_BITS 10 + + +/* These are the fs-independent mount-flags: up to 16 flags are + supported */ +enum +{ + MS_RDONLY = 1, /* Mount read-only. */ +#define MS_RDONLY MS_RDONLY + MS_NOSUID = 2, /* Ignore suid and sgid bits. */ +#define MS_NOSUID MS_NOSUID + MS_NODEV = 4, /* Disallow access to device special files. */ +#define MS_NODEV MS_NODEV + MS_NOEXEC = 8, /* Disallow program execution. */ +#define MS_NOEXEC MS_NOEXEC + MS_SYNCHRONOUS = 16, /* Writes are synced at once. */ +#define MS_SYNCHRONOUS MS_SYNCHRONOUS + MS_REMOUNT = 32, /* Alter flags of a mounted FS. */ +#define MS_REMOUNT MS_REMOUNT + MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ +#define MS_MANDLOCK MS_MANDLOCK + S_WRITE = 128, /* Write on file/directory/symlink. */ +#define S_WRITE S_WRITE + S_APPEND = 256, /* Append-only file. */ +#define S_APPEND S_APPEND + S_IMMUTABLE = 512, /* Immutable file. */ +#define S_IMMUTABLE S_IMMUTABLE + MS_NOATIME = 1024, /* Do not update access times. */ +#define MS_NOATIME MS_NOATIME + MS_NODIRATIME = 2048, /* Do not update directory access times. */ +#define MS_NODIRATIME MS_NODIRATIME + MS_BIND = 4096, /* Bind directory at different place. */ +#define MS_BIND MS_BIND +}; + +/* Flags that can be altered by MS_REMOUNT */ +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME \ + |MS_NODIRATIME) + + +/* Magic mount flag number. Has to be or-ed to the flag values. */ + +#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */ +#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ + + +/* The read-only stuff doesn't really belong here, but any other place + is probably as bad and I don't want to create yet another include + file. */ + +#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */ +#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */ +#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */ +#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */ +#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */ +#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */ +#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */ +#define BLKFRASET _IO(0x12,100) /* Set filesystem read-ahead. */ +#define BLKFRAGET _IO(0x12,101) /* Get filesystem read-ahead. */ +#define BLKSECTSET _IO(0x12,102) /* Set max sectors per request. */ +#define BLKSECTGET _IO(0x12,103) /* Get max sectors per request. */ +#define BLKSSZGET _IO(0x12,104) /* Get block device sector size. */ +#define BLKBSZGET _IOR(0x12,112,size_t) +#define BLKBSZSET _IOW(0x12,113,size_t) +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size. */ + + +/* Possible value for FLAGS parameter of `umount2'. */ +enum +{ + MNT_FORCE = 1 /* Force unmounting. */ +#define MNT_FORCE MNT_FORCE +}; + + +__BEGIN_DECLS + +/* Mount a filesystem. */ +extern int mount (__const char *__special_file, __const char *__dir, + __const char *__fstype, unsigned long int __rwflag, + __const void *__data) __THROW; + +/* Unmount a filesystem. */ +extern int umount (__const char *__special_file) __THROW; + +/* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */ +extern int umount2 (__const char *__special_file, int __flags) __THROW; + +__END_DECLS + +#endif /* _SYS_MOUNT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/msg.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/msg.h new file mode 100644 index 0000000..1fd64b2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/msg.h @@ -0,0 +1,81 @@ +/* Copyright (C) 1995,1996,1997,1999,2000,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_MSG_H +#define _SYS_MSG_H + +#include + +/* Get common definition of System V style IPC. */ +#include + +/* Get system dependent definition of `struct msqid_ds' and more. */ +#include + +/* Define types required by the standard. */ +#define __need_time_t +#include + +#ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +#endif + +#ifndef __ssize_t_defined +typedef __ssize_t ssize_t; +# define __ssize_t_defined +#endif + +/* The following System V style IPC functions implement a message queue + system. The definition is found in XPG2. */ + +#ifdef __USE_GNU +/* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */ +struct msgbuf + { + long int mtype; /* type of received/sent message */ + char mtext[1]; /* text of the message */ + }; +#endif + + +__BEGIN_DECLS + +/* Message queue control operation. */ +extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; + +/* Get messages queue. */ +extern int msgget (key_t __key, int __msgflg) __THROW; + +/* Receive message from message queue. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int msgrcv (int __msqid, void *__msgp, size_t __msgsz, + long int __msgtyp, int __msgflg); + +/* Send message to message queue. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int msgsnd (int __msqid, __const void *__msgp, size_t __msgsz, + int __msgflg); + +__END_DECLS + +#endif /* sys/msg.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mtio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mtio.h new file mode 100644 index 0000000..51fa550 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/mtio.h @@ -0,0 +1,277 @@ +/* Structures and definitions for magnetic tape I/O control commands. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Written by H. Bergman . */ + +#ifndef _SYS_MTIO_H +#define _SYS_MTIO_H 1 + +/* Get necessary definitions from system and kernel headers. */ +#include +#include + + +/* Structure for MTIOCTOP - magnetic tape operation command. */ +struct mtop + { + short int mt_op; /* Operations defined below. */ + int mt_count; /* How many of them. */ + }; +#define _IOT_mtop /* Hurd ioctl type field. */ \ + _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0) + +/* Magnetic Tape operations [Not all operations supported by all drivers]. */ +#define MTRESET 0 /* +reset drive in case of problems. */ +#define MTFSF 1 /* Forward space over FileMark, + * position at first record of next file. */ +#define MTBSF 2 /* Backward space FileMark (position before FM). */ +#define MTFSR 3 /* Forward space record. */ +#define MTBSR 4 /* Backward space record. */ +#define MTWEOF 5 /* Write an end-of-file record (mark). */ +#define MTREW 6 /* Rewind. */ +#define MTOFFL 7 /* Rewind and put the drive offline (eject?). */ +#define MTNOP 8 /* No op, set status only (read with MTIOCGET). */ +#define MTRETEN 9 /* Retension tape. */ +#define MTBSFM 10 /* +backward space FileMark, position at FM. */ +#define MTFSFM 11 /* +forward space FileMark, position at FM. */ +#define MTEOM 12 /* Goto end of recorded media (for appending files). + MTEOM positions after the last FM, ready for + appending another file. */ +#define MTERASE 13 /* Erase tape -- be careful! */ + +#define MTRAS1 14 /* Run self test 1 (nondestructive). */ +#define MTRAS2 15 /* Run self test 2 (destructive). */ +#define MTRAS3 16 /* Reserved for self test 3. */ + +#define MTSETBLK 20 /* Set block length (SCSI). */ +#define MTSETDENSITY 21 /* Set tape density (SCSI). */ +#define MTSEEK 22 /* Seek to block (Tandberg, etc.). */ +#define MTTELL 23 /* Tell block (Tandberg, etc.). */ +#define MTSETDRVBUFFER 24 /* Set the drive buffering according to SCSI-2. + Ordinary buffered operation with code 1. */ +#define MTFSS 25 /* Space forward over setmarks. */ +#define MTBSS 26 /* Space backward over setmarks. */ +#define MTWSM 27 /* Write setmarks. */ + +#define MTLOCK 28 /* Lock the drive door. */ +#define MTUNLOCK 29 /* Unlock the drive door. */ +#define MTLOAD 30 /* Execute the SCSI load command. */ +#define MTUNLOAD 31 /* Execute the SCSI unload command. */ +#define MTCOMPRESSION 32/* Control compression with SCSI mode page 15. */ +#define MTSETPART 33 /* Change the active tape partition. */ +#define MTMKPART 34 /* Format the tape with one or two partitions. */ + +/* structure for MTIOCGET - mag tape get status command */ + +struct mtget + { + long int mt_type; /* Type of magtape device. */ + long int mt_resid; /* Residual count: (not sure) + number of bytes ignored, or + number of files not skipped, or + number of records not skipped. */ + /* The following registers are device dependent. */ + long int mt_dsreg; /* Status register. */ + long int mt_gstat; /* Generic (device independent) status. */ + long int mt_erreg; /* Error register. */ + /* The next two fields are not always used. */ + __daddr_t mt_fileno; /* Number of current file on tape. */ + __daddr_t mt_blkno; /* Current block number. */ + }; +#define _IOT_mtget /* Hurd ioctl type field. */ \ + _IOT (_IOTS (long), 7, 0, 0, 0, 0) + + +/* Constants for mt_type. Not all of these are supported, and + these are not all of the ones that are supported. */ +#define MT_ISUNKNOWN 0x01 +#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer. */ +#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02. */ +#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02?. */ +#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?). */ +#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24. */ +#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02. */ +#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L. */ +#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L. */ +#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller. */ +#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features. */ +#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24. */ +#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, + Teac DC-1 card (Wangtek type). */ +#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40). */ +#define MT_ISDDS1 0x51 /* DDS device without partitions. */ +#define MT_ISDDS2 0x52 /* DDS device with partitions. */ +#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit. */ +#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit. */ + +/* QIC-40/80/3010/3020 ftape supported drives. + 20bit vendor ID + 0x800000 (see vendors.h in ftape distribution). */ +#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ +#define MT_ISFTAPE_FLAG 0x800000 + +struct mt_tape_info + { + long int t_type; /* Device type id (mt_type). */ + char *t_name; /* Descriptive name. */ + }; + +#define MT_TAPE_INFO \ + { \ + {MT_ISUNKNOWN, "Unknown type of tape device"}, \ + {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ + {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \ + {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ + {MT_ISCMSJ500, "CMS Jumbo 500"}, \ + {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ + {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ + {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \ + {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ + {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ + {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ + {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ + {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ + {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ + {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ + {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ + {0, NULL} \ + } + + +/* Structure for MTIOCPOS - mag tape get position command. */ + +struct mtpos + { + long int mt_blkno; /* Current block number. */ + }; +#define _IOT_mtpos /* Hurd ioctl type field. */ \ + _IOT_SIMPLE (long) + + +/* Structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended + as an interim solution for QIC-02 until DDI is fully implemented. */ +struct mtconfiginfo + { + long int mt_type; /* Drive type. */ + long int ifc_type; /* Interface card type. */ + unsigned short int irqnr; /* IRQ number to use. */ + unsigned short int dmanr; /* DMA channel to use. */ + unsigned short int port; /* IO port base address. */ + + unsigned long int debug; /* Debugging flags. */ + + unsigned have_dens:1; + unsigned have_bsf:1; + unsigned have_fsr:1; + unsigned have_bsr:1; + unsigned have_eod:1; + unsigned have_seek:1; + unsigned have_tell:1; + unsigned have_ras1:1; + unsigned have_ras2:1; + unsigned have_ras3:1; + unsigned have_qfa:1; + + unsigned pad1:5; + char reserved[10]; + }; +#define _IOT_mtconfiginfo /* Hurd ioctl type field. */ \ + _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1) /* XXX wrong */ + + +/* Magnetic tape I/O control commands. */ +#define MTIOCTOP _IOW('m', 1, struct mtop) /* Do a mag tape op. */ +#define MTIOCGET _IOR('m', 2, struct mtget) /* Get tape status. */ +#define MTIOCPOS _IOR('m', 3, struct mtpos) /* Get tape position.*/ + +/* The next two are used by the QIC-02 driver for runtime reconfiguration. + See tpqic02.h for struct mtconfiginfo. */ +#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* Get tape config.*/ +#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* Set tape config.*/ + +/* Generic Mag Tape (device independent) status macros for examining + mt_gstat -- HP-UX compatible. + There is room for more generic status bits here, but I don't + know which of them are reserved. At least three or so should + be added to make this really useful. */ +#define GMT_EOF(x) ((x) & 0x80000000) +#define GMT_BOT(x) ((x) & 0x40000000) +#define GMT_EOT(x) ((x) & 0x20000000) +#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ +#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ +#define GMT_WR_PROT(x) ((x) & 0x04000000) +/* #define GMT_ ? ((x) & 0x02000000) */ +#define GMT_ONLINE(x) ((x) & 0x01000000) +#define GMT_D_6250(x) ((x) & 0x00800000) +#define GMT_D_1600(x) ((x) & 0x00400000) +#define GMT_D_800(x) ((x) & 0x00200000) +/* #define GMT_ ? ((x) & 0x00100000) */ +/* #define GMT_ ? ((x) & 0x00080000) */ +#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* Door open (no tape). */ +/* #define GMT_ ? ((x) & 0x00020000) */ +#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* Immediate report mode.*/ +/* 16 generic status bits unused. */ + + +/* SCSI-tape specific definitions. Bitfield shifts in the status */ +#define MT_ST_BLKSIZE_SHIFT 0 +#define MT_ST_BLKSIZE_MASK 0xffffff +#define MT_ST_DENSITY_SHIFT 24 +#define MT_ST_DENSITY_MASK 0xff000000 + +#define MT_ST_SOFTERR_SHIFT 0 +#define MT_ST_SOFTERR_MASK 0xffff + +/* Bitfields for the MTSETDRVBUFFER ioctl. */ +#define MT_ST_OPTIONS 0xf0000000 +#define MT_ST_BOOLEANS 0x10000000 +#define MT_ST_SETBOOLEANS 0x30000000 +#define MT_ST_CLEARBOOLEANS 0x40000000 +#define MT_ST_WRITE_THRESHOLD 0x20000000 +#define MT_ST_DEF_BLKSIZE 0x50000000 +#define MT_ST_DEF_OPTIONS 0x60000000 + +#define MT_ST_BUFFER_WRITES 0x1 +#define MT_ST_ASYNC_WRITES 0x2 +#define MT_ST_READ_AHEAD 0x4 +#define MT_ST_DEBUGGING 0x8 +#define MT_ST_TWO_FM 0x10 +#define MT_ST_FAST_MTEOM 0x20 +#define MT_ST_AUTO_LOCK 0x40 +#define MT_ST_DEF_WRITES 0x80 +#define MT_ST_CAN_BSR 0x100 +#define MT_ST_NO_BLKLIMS 0x200 +#define MT_ST_CAN_PARTITIONS 0x400 +#define MT_ST_SCSI2LOGICAL 0x800 + +/* The mode parameters to be controlled. Parameter chosen with bits 20-28. */ +#define MT_ST_CLEAR_DEFAULT 0xfffff +#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) +#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) +#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) + +/* The offset for the arguments for the special HP changer load command. */ +#define MT_ST_HPLOADER_OFFSET 10000 + + +/* Specify default tape device. */ +#ifndef DEFTAPE +# define DEFTAPE "/dev/tape" +#endif + +#endif /* mtio.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/param.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/param.h new file mode 100644 index 0000000..0b0424e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/param.h @@ -0,0 +1,72 @@ +/* Copyright (C) 1995,1996,1997,2000,2001,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H 1 + +#include +#include +#include + +/* BSD names for some values. */ + +#define NBBY CHAR_BIT +#ifndef NGROUPS +# define NGROUPS NGROUPS_MAX +#endif +#define MAXSYMLINKS 20 +#define CANBSIZ MAX_CANON +#define NCARGS ARG_MAX +#define MAXPATHLEN PATH_MAX +/* The following is not really correct but it is a value we used for a + long time and which seems to be usable. People should not use NOFILE + anyway. */ +#define NOFILE 256 + + +#include + +/* Bit map related macros. */ +#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) + +/* Macros for counting and rounding. */ +#ifndef howmany +# define howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif +#ifdef __GNUC__ +# define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \ + ? (((x) + (y) - 1) & ~((y) - 1)) \ + : ((((x) + ((y) - 1)) / (y)) * (y))) +#else +# define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#endif +#define powerof2(x) ((((x) - 1) & (x)) == 0) + +/* Macros for min/max. */ +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) + + +/* Unit of `st_blocks'. */ +#define DEV_BSIZE 512 + + +#endif /* sys/param.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/personality.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/personality.h new file mode 100644 index 0000000..5d14a9b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/personality.h @@ -0,0 +1,73 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Taken verbatim from Linux 2.4 (include/linux/personality.h). */ + +#ifndef _SYS_PERSONALITY_H +#define _SYS_PERSONALITY_H 1 + +#include + +/* Flags for bug emulation. + These occupy the top three bytes. */ +enum + { + MMAP_PAGE_ZERO = 0x0100000, + ADDR_LIMIT_32BIT = 0x0800000, + SHORT_INODE = 0x1000000, + WHOLE_SECONDS = 0x2000000, + STICKY_TIMEOUTS = 0x4000000, + }; + +/* Personality types. + + These go in the low byte. Avoid using the top bit, it will + conflict with error returns. */ +enum + { + PER_LINUX = 0x0000, + PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, + PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, + PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, + PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, + PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, + PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, + PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, + PER_BSD = 0x0006, + PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, + PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, + PER_LINUX32 = 0x0008, + PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, /* IRIX5 32-bit */ + PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, /* IRIX6 new 32-bit */ + PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, /* IRIX6 64-bit */ + PER_RISCOS = 0x000c, + PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, + PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, + PER_HPUX = 0x000f, + PER_OSF4 = 0x0010, + PER_MASK = 0x00ff, + }; + +__BEGIN_DECLS + +/* Set different ABIs (personalities). */ +extern int personality (unsigned long int __persona) __THROW; + +__END_DECLS + +#endif /* sys/personality.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/poll.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/poll.h new file mode 100644 index 0000000..70f0d31 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/poll.h @@ -0,0 +1,76 @@ +/* Compatibility definitions for System V `poll' interface. + Copyright (C) 1994,1996-2001,2004,2005,2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_POLL_H +#define _SYS_POLL_H 1 + +#include + +/* Get the platform dependent bits of `poll'. */ +#include +#ifdef __USE_GNU +/* Get the __sigset_t definition. */ +# include +/* Get the timespec definition. */ +# define __need_timespec +# include +/* get NULL definition. */ +# include +#endif + + +/* Type used for the number of file descriptors. */ +typedef unsigned long int nfds_t; + +/* Data structure describing a polling request. */ +struct pollfd + { + int fd; /* File descriptor to poll. */ + short int events; /* Types of events poller cares about. */ + short int revents; /* Types of events that actually occurred. */ + }; + + +__BEGIN_DECLS + +/* Poll the file descriptors described by the NFDS structures starting at + FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for + an event to occur; if TIMEOUT is -1, block until an event occurs. + Returns the number of file descriptors with events, zero if timed out, + or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); + +#ifdef __USE_GNU +/* Like poll, but before waiting the threads signal mask is replaced + with that specified in the fourth parameter. For better usability, + the timeout value is specified using a TIMESPEC object. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int ppoll (struct pollfd *__fds, nfds_t __nfds, + __const struct timespec *__timeout, + __const __sigset_t *__ss); +#endif + +__END_DECLS + +#endif /* sys/poll.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/prctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/prctl.h new file mode 100644 index 0000000..7e9b72d --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/prctl.h @@ -0,0 +1,32 @@ +/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PRCTL_H +#define _SYS_PRCTL_H 1 + +#include +#include /* The magic values come from here */ + +__BEGIN_DECLS + +/* Control process execution. */ +extern int prctl (int __option, ...) __THROW; + +__END_DECLS + +#endif /* sys/prctl.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/procfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/procfs.h new file mode 100644 index 0000000..a21652e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/procfs.h @@ -0,0 +1,112 @@ +/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somehow modelled after the file of the same name on SysVr4 + systems. It provides a definition of the core file format for ELF + used on Linux. */ + +#include +#include +#include +#include + +/* ELF register definitions */ +#define ELF_NGREG 45 +#define ELF_NFPREG 33 + +typedef unsigned long elf_greg_t; +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef double elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +__BEGIN_DECLS + +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + gdb doesn't really use excluded. Fields present but not used are + marked with "XXX". */ +struct elf_prstatus + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + long pr_uid; + long pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore habe only ine PID type. */ +typedef __pid_t lwpid_t; + + +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ptrace.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ptrace.h new file mode 100644 index 0000000..b4aec4f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ptrace.h @@ -0,0 +1,129 @@ +/* `ptrace' debugger support interface. Linux version. + Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PTRACE_H +#define _SYS_PTRACE_H 1 + +#include + +__BEGIN_DECLS + +/* Type of the REQUEST argument to `ptrace.' */ +enum __ptrace_request +{ + /* Indicate that the process making this request should be traced. + All signals received by this process can be intercepted by its + parent, and its parent can use the other `ptrace' requests. */ + PTRACE_TRACEME = 0, +#define PT_TRACE_ME PTRACE_TRACEME + + /* Return the word in the process's text space at address ADDR. */ + PTRACE_PEEKTEXT = 1, +#define PT_READ_I PTRACE_PEEKTEXT + + /* Return the word in the process's data space at address ADDR. */ + PTRACE_PEEKDATA = 2, +#define PT_READ_D PTRACE_PEEKDATA + + /* Return the word in the process's user area at offset ADDR. */ + PTRACE_PEEKUSER = 3, +#define PT_READ_U PTRACE_PEEKUSER + + /* Write the word DATA into the process's text space at address ADDR. */ + PTRACE_POKETEXT = 4, +#define PT_WRITE_I PTRACE_POKETEXT + + /* Write the word DATA into the process's data space at address ADDR. */ + PTRACE_POKEDATA = 5, +#define PT_WRITE_D PTRACE_POKEDATA + + /* Write the word DATA into the process's user area at offset ADDR. */ + PTRACE_POKEUSER = 6, +#define PT_WRITE_U PTRACE_POKEUSER + + /* Continue the process. */ + PTRACE_CONT = 7, +#define PT_CONTINUE PTRACE_CONT + + /* Kill the process. */ + PTRACE_KILL = 8, +#define PT_KILL PTRACE_KILL + + /* Single step the process. + This is not supported on all machines. */ + PTRACE_SINGLESTEP = 9, +#define PT_STEP PTRACE_SINGLESTEP + + /* Get all general purpose registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETREGS = 12, +#define PT_GETREGS PTRACE_GETREGS + + /* Set all general purpose registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETREGS = 13, +#define PT_SETREGS PTRACE_SETREGS + + /* Get all floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETFPREGS = 14, +#define PT_GETFPREGS PTRACE_GETFPREGS + + /* Set all floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETFPREGS = 15, +#define PT_SETFPREGS PTRACE_SETFPREGS + + /* Attach to a process that is already running. */ + PTRACE_ATTACH = 16, +#define PT_ATTACH PTRACE_ATTACH + + /* Detach from a process attached to with PTRACE_ATTACH. */ + PTRACE_DETACH = 17, +#define PT_DETACH PTRACE_DETACH + + /* Get all extended floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETFPXREGS = 18, +#define PT_GETFPXREGS PTRACE_GETFPXREGS + + /* Set all extended floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETFPXREGS = 19, +#define PT_SETFPXREGS PTRACE_SETFPXREGS + + /* Continue and stop at the next (return from) syscall. */ + PTRACE_SYSCALL = 24 +#define PT_SYSCALL PTRACE_SYSCALL +}; + +/* Perform process tracing functions. REQUEST is one of the values + above, and determines the action to be taken. + For all requests except PTRACE_TRACEME, PID specifies the process to be + traced. + + PID and the other arguments described above for the various requests should + appear (those that are used for the particular request) as: + pid_t PID, void *ADDR, int DATA, void *ADDR2 + after REQUEST. */ +extern long int ptrace (enum __ptrace_request __request, ...) __THROW; + +__END_DECLS + +#endif /* _SYS_PTRACE_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/queue.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/queue.h new file mode 100644 index 0000000..b0e6b38 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/queue.h @@ -0,0 +1,557 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * This file defines five types of data structures: singly-linked lists, + * lists, simple queues, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The + * elements are singly linked for minimum space and pointer manipulation + * overhead at the expense of O(n) removal for arbitrary elements. New + * elements can be added to the list after an existing element or at the + * head of the list. Elements being removed from the head of the list + * should use the explicit macro for this purpose for optimum + * efficiency. A singly-linked list may only be traversed in the forward + * direction. Singly-linked lists are ideal for applications with large + * datasets and few or no removals or for implementing a LIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A simple queue is headed by a pair of pointers, one the head of the + * list and the other to the tail of the list. The elements are singly + * linked to save space, so elements can only be removed from the + * head of the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A simple queue may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ +#define LIST_INIT(head) do { \ + (head)->lh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (/*CONSTCOND*/0) + +#define LIST_REMOVE(elm, field) do { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = ((head)->lh_first); \ + (var); \ + (var) = ((var)->field.le_next)) + +/* + * List access methods. + */ +#define LIST_EMPTY(head) ((head)->lh_first == NULL) +#define LIST_FIRST(head) ((head)->lh_first) +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_INIT(head) do { \ + (head)->slh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while(curelm->field.sle_next != (elm)) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) + +/* + * Singly-linked List access methods. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) +#define SLIST_FIRST(head) ((head)->slh_first) +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first; /* first element */ \ + struct type **stqh_last; /* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (listelm)->field.stqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->stqh_first; \ + while (curelm->field.stqe_next != (elm)) \ + curelm = curelm->field.stqe_next; \ + if ((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->stqh_first); \ + (var); \ + (var) = ((var)->field.stqe_next)) + +/* + * Singly-linked Tail queue access methods. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) +#define STAILQ_FIRST(head) ((head)->stqh_first) +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + + +/* + * Simple queue definitions. + */ +#define SIMPLEQ_HEAD(name, type) \ +struct name { \ + struct type *sqh_first; /* first element */ \ + struct type **sqh_last; /* addr of last next element */ \ +} + +#define SIMPLEQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).sqh_first } + +#define SIMPLEQ_ENTRY(type) \ +struct { \ + struct type *sqe_next; /* next element */ \ +} + +/* + * Simple queue functions. + */ +#define SIMPLEQ_INIT(head) do { \ + (head)->sqh_first = NULL; \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (head)->sqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.sqe_next = NULL; \ + *(head)->sqh_last = (elm); \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (listelm)->field.sqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ + if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ + if ((head)->sqh_first == (elm)) { \ + SIMPLEQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->sqh_first; \ + while (curelm->field.sqe_next != (elm)) \ + curelm = curelm->field.sqe_next; \ + if ((curelm->field.sqe_next = \ + curelm->field.sqe_next->field.sqe_next) == NULL) \ + (head)->sqh_last = &(curelm)->field.sqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->sqh_first); \ + (var); \ + (var) = ((var)->field.sqe_next)) + +/* + * Simple queue access methods. + */ +#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) +#define SIMPLEQ_FIRST(head) ((head)->sqh_first) +#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) + + +/* + * Tail queue definitions. + */ +#define _TAILQ_HEAD(name, type, qual) \ +struct name { \ + qual type *tqh_first; /* first element */ \ + qual type *qual *tqh_last; /* addr of last next element */ \ +} +#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define _TAILQ_ENTRY(type, qual) \ +struct { \ + qual type *tqe_next; /* next element */ \ + qual type *qual *tqe_prev; /* address of previous next element */\ +} +#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) + +/* + * Tail queue functions. + */ +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->tqh_first); \ + (var); \ + (var) = ((var)->field.tqe_next)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ + (var); \ + (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + +/* + * Tail queue access methods. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) +#define TAILQ_FIRST(head) ((head)->tqh_first) +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_HEAD_INITIALIZER(head) \ + { (void *)&head, (void *)&head } + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->cqh_first); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_next)) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = ((head)->cqh_last); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_prev)) + +/* + * Circular queue access methods. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) +#define CIRCLEQ_LAST(head) ((head)->cqh_last) +#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) +#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ + (((elm)->field.cqe_next == (void *)(head)) \ + ? ((head)->cqh_first) \ + : (elm->field.cqe_next)) +#define CIRCLEQ_LOOP_PREV(head, elm, field) \ + (((elm)->field.cqe_prev == (void *)(head)) \ + ? ((head)->cqh_last) \ + : (elm->field.cqe_prev)) + +#endif /* sys/queue.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/quota.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/quota.h new file mode 100644 index 0000000..a6afdbe --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/quota.h @@ -0,0 +1,158 @@ +/* This just represents the non-kernel parts of . + * + * here's the corresponding copyright: + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Elz at The University of Melbourne. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Version: $Id: quota.h,v 1.1 2002/01/03 04:00:09 andersen Exp $ + */ + +#ifndef _SYS_QUOTA_H +#define _SYS_QUOTA_H 1 + +#include +#include + +/* + * Convert diskblocks to blocks and the other way around. + * currently only to fool the BSD source. :-) + */ +#define dbtob(num) ((num) << 10) +#define btodb(num) ((num) >> 10) + +/* + * Convert count of filesystem blocks to diskquota blocks, meant + * for filesystems where i_blksize != BLOCK_SIZE + */ +#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / BLOCK_SIZE) + +/* + * Definitions for disk quotas imposed on the average user + * (big brother finally hits Linux). + * + * The following constants define the amount of time given a user + * before the soft limits are treated as hard limits (usually resulting + * in an allocation failure). The timer is started when the user crosses + * their soft limit, it is reset when they go below their soft limit. + */ +#define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */ +#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */ + +#define MAXQUOTAS 2 +#define USRQUOTA 0 /* element used for user quotas */ +#define GRPQUOTA 1 /* element used for group quotas */ + +/* + * Definitions for the default names of the quotas files. + */ +#define INITQFNAMES { \ + "user", /* USRQUOTA */ \ + "group", /* GRPQUOTA */ \ + "undefined", \ +}; + +#define QUOTAFILENAME "quota" +#define QUOTAGROUP "staff" + +#define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */ +#define NR_DQUOTS 256 /* Number of quotas active at one time */ + +/* + * Command definitions for the 'quotactl' system call. + * The commands are broken into a main command defined below + * and a subcommand that is used to convey the type of + * quota that is being manipulated (see above). + */ +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) + +#define Q_QUOTAON 0x0100 /* enable quotas */ +#define Q_QUOTAOFF 0x0200 /* disable quotas */ +#define Q_GETQUOTA 0x0300 /* get limits and usage */ +#define Q_SETQUOTA 0x0400 /* set limits and usage */ +#define Q_SETUSE 0x0500 /* set usage */ +#define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ +#define Q_SETQLIM 0x0700 /* set limits */ +#define Q_GETSTATS 0x0800 /* get collected stats */ +#define Q_RSQUASH 0x1000 /* set root_squash option */ + +/* + * The following structure defines the format of the disk quota file + * (as it appears on disk) - the file is an array of these structures + * indexed by user or group number. + */ +struct dqblk + { + u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ + u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ + u_int32_t dqb_curblocks; /* current block count */ + u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ + u_int32_t dqb_isoftlimit; /* preferred inode limit */ + u_int32_t dqb_curinodes; /* current # allocated inodes */ + time_t dqb_btime; /* time limit for excessive disk use */ + time_t dqb_itime; /* time limit for excessive files */ + }; + +/* + * Shorthand notation. + */ +#define dq_bhardlimit dq_dqb.dqb_bhardlimit +#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit +#define dq_curblocks dq_dqb.dqb_curblocks +#define dq_ihardlimit dq_dqb.dqb_ihardlimit +#define dq_isoftlimit dq_dqb.dqb_isoftlimit +#define dq_curinodes dq_dqb.dqb_curinodes +#define dq_btime dq_dqb.dqb_btime +#define dq_itime dq_dqb.dqb_itime + +#define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk))) + +struct dqstats + { + u_int32_t lookups; + u_int32_t drops; + u_int32_t reads; + u_int32_t writes; + u_int32_t cache_hits; + u_int32_t pages_allocated; + u_int32_t allocated_dquots; + u_int32_t free_dquots; + u_int32_t syncs; + }; + +__BEGIN_DECLS + +extern int quotactl (int __cmd, const char *__special, int __id, + caddr_t __addr) __THROW; + +__END_DECLS + +#endif /* sys/quota.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/reboot.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/reboot.h new file mode 100644 index 0000000..2a719c7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/reboot.h @@ -0,0 +1,49 @@ +/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file should define RB_* macros to be used as flag + bits in the argument to the `reboot' system call. */ + +#ifndef _SYS_REBOOT_H +#define _SYS_REBOOT_H 1 + +#include + +/* Perform a hard reset now. */ +#define RB_AUTOBOOT 0x01234567 + +/* Halt the system. */ +#define RB_HALT_SYSTEM 0xcdef0123 + +/* Enable reboot using Ctrl-Alt-Delete keystroke. */ +#define RB_ENABLE_CAD 0x89abcdef + +/* Disable reboot using Ctrl-Alt-Delete keystroke. */ +#define RB_DISABLE_CAD 0 + +/* Stop system and switch power off if possible. */ +#define RB_POWER_OFF 0x4321fedc + +__BEGIN_DECLS + +/* Reboot or halt the system. */ +extern int reboot (int __howto) __THROW; + +__END_DECLS + +#endif /* _SYS_REBOOT_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/regdef.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/regdef.h new file mode 100644 index 0000000..9d2c4c1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/regdef.h @@ -0,0 +1,80 @@ +/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ralf Baechle . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_REGDEF_H +#define _SYS_REGDEF_H + +/* + * Symbolic register names for 32 bit ABI + */ +#define zero $0 /* wired zero */ +#define AT $1 /* assembler temp - uppercase because of ".set at" */ +#define v0 $2 /* return value */ +#define v1 $3 +#define a0 $4 /* argument registers */ +#define a1 $5 +#define a2 $6 +#define a3 $7 +#if _MIPS_SIM != _MIPS_SIM_ABI32 +#define a4 $8 +#define a5 $9 +#define a6 $10 +#define a7 $11 +#define t0 $12 +#define t1 $13 +#define t2 $14 +#define t3 $15 +#define ta0 a4 +#define ta1 a5 +#define ta2 a6 +#define ta3 a7 +#else /* if _MIPS_SIM == _MIPS_SIM_ABI32 */ +#define t0 $8 /* caller saved */ +#define t1 $9 +#define t2 $10 +#define t3 $11 +#define t4 $12 +#define t5 $13 +#define t6 $14 +#define t7 $15 +#define ta0 t4 +#define ta1 t5 +#define ta2 t6 +#define ta3 t7 +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ +#define s0 $16 /* callee saved */ +#define s1 $17 +#define s2 $18 +#define s3 $19 +#define s4 $20 +#define s5 $21 +#define s6 $22 +#define s7 $23 +#define t8 $24 /* caller saved */ +#define t9 $25 +#define jp $25 /* PIC jump register */ +#define k0 $26 /* kernel scratch */ +#define k1 $27 +#define gp $28 /* global pointer */ +#define sp $29 /* stack pointer */ +#define fp $30 /* frame pointer */ +#define s8 $30 /* same like fp! */ +#define ra $31 /* return address */ + +#endif /* _SYS_REGDEF_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/resource.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/resource.h new file mode 100644 index 0000000..3912741 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/resource.h @@ -0,0 +1,103 @@ +/* Copyright (C) 1992,94,1996-2000,2002,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_RESOURCE_H +#define _SYS_RESOURCE_H 1 + +#include + +/* Get the system-dependent definitions of structures and bit values. */ +#include + +#ifndef __id_t_defined +typedef __id_t id_t; +# define __id_t_defined +#endif + +__BEGIN_DECLS + +/* The X/Open standard defines that all the functions below must use + `int' as the type for the first argument. When we are compiling with + GNU extensions we change this slightly to provide better error + checking. */ +#if defined __USE_GNU && !defined __cplusplus +typedef enum __rlimit_resource __rlimit_resource_t; +typedef enum __rusage_who __rusage_who_t; +typedef enum __priority_which __priority_which_t; +#else +typedef int __rlimit_resource_t; +typedef int __rusage_who_t; +typedef int __priority_which_t; +#endif + +/* Put the soft and hard limits for RESOURCE in *RLIMITS. + Returns 0 if successful, -1 if not (and sets errno). */ +#ifndef __USE_FILE_OFFSET64 +extern int getrlimit (__rlimit_resource_t __resource, + struct rlimit *__rlimits) __THROW; +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource, + struct rlimit *__rlimits), getrlimit64); +# else +# define getrlimit getrlimit64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int getrlimit64 (__rlimit_resource_t __resource, + struct rlimit64 *__rlimits) __THROW; +#endif + +/* Set the soft and hard limits for RESOURCE to *RLIMITS. + Only the super-user can increase hard limits. + Return 0 if successful, -1 if not (and sets errno). */ +#ifndef __USE_FILE_OFFSET64 +extern int setrlimit (__rlimit_resource_t __resource, + __const struct rlimit *__rlimits) __THROW; +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource, + __const struct rlimit *__rlimits), + setrlimit64); +# else +# define setrlimit setrlimit64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int setrlimit64 (__rlimit_resource_t __resource, + __const struct rlimit64 *__rlimits) __THROW; +#endif + +/* Return resource usage information on process indicated by WHO + and put it in *USAGE. Returns 0 for success, -1 for failure. */ +extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; + +/* Return the highest priority of any process specified by WHICH and WHO + (see above); if WHO is zero, the current process, process group, or user + (as specified by WHO) is used. A lower priority number means higher + priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */ +extern int getpriority (__priority_which_t __which, id_t __who) __THROW; + +/* Set the priority of all processes specified by WHICH and WHO (see above) + to PRIO. Returns 0 on success, -1 on errors. */ +extern int setpriority (__priority_which_t __which, id_t __who, int __prio) + __THROW; + +__END_DECLS + +#endif /* sys/resource.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/select.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/select.h new file mode 100644 index 0000000..2a40843 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/select.h @@ -0,0 +1,130 @@ +/* `fd_set' type and related macros, and `select'/`pselect' declarations. + Copyright (C) 1996,97,98,99,2000,01,02,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* POSIX 1003.1g: 6.2 Select from File Descriptor Sets */ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H 1 + +#include + +/* Get definition of needed basic types. */ +#include + +/* Get __FD_* definitions. */ +#include + +/* Get __sigset_t. */ +#include + +#ifndef __sigset_t_defined +# define __sigset_t_defined +typedef __sigset_t sigset_t; +#endif + +/* Get definition of timer specification structures. */ +#define __need_time_t +#define __need_timespec +#include +#define __need_timeval +#include + +#ifndef __suseconds_t_defined +typedef __suseconds_t suseconds_t; +# define __suseconds_t_defined +#endif + + +/* The fd_set member is required to be an array of longs. */ +typedef long int __fd_mask; + +/* Some versions of define these macros. */ +#undef __NFDBITS +#undef __FDELT +#undef __FDMASK +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NFDBITS (8 * sizeof (__fd_mask)) +#define __FDELT(d) ((d) / __NFDBITS) +#define __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS)) + +/* fd_set for select and pselect. */ +typedef struct + { + /* XPG4.2 requires this member name. Otherwise avoid the name + from the global namespace. */ +#ifdef __USE_XOPEN + __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; +# define __FDS_BITS(set) ((set)->fds_bits) +#else + __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; +# define __FDS_BITS(set) ((set)->__fds_bits) +#endif + } fd_set; + +/* Maximum number of file descriptors in `fd_set'. */ +#define FD_SETSIZE __FD_SETSIZE + +#ifdef __USE_MISC +/* Sometimes the fd_set member is assumed to have this type. */ +typedef __fd_mask fd_mask; + +/* Number of bits per word of `fd_set' (some code assumes this is 32). */ +# define NFDBITS __NFDBITS +#endif + + +/* Access macros for `fd_set'. */ +#define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp) +#define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp) +#define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp) +#define FD_ZERO(fdsetp) __FD_ZERO (fdsetp) + + +__BEGIN_DECLS + +/* Check the first NFDS descriptors each in READFDS (if not NULL) for read + readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS + (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out + after waiting the interval specified therein. Returns the number of ready + descriptors, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); + +#ifdef __USE_XOPEN2K +/* Same as above only that the TIMEOUT value is given with higher + resolution and a sigmask which is been set temporarily. This version + should be used. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +#endif + +__END_DECLS + +#endif /* sys/select.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sem.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sem.h new file mode 100644 index 0000000..5b1d38f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sem.h @@ -0,0 +1,58 @@ +/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SEM_H +#define _SYS_SEM_H 1 + +#include + +#define __need_size_t +#include + +/* Get common definition of System V style IPC. */ +#include + +/* Get system dependent definition of `struct semid_ds' and more. */ +#include + +/* The following System V style IPC functions implement a semaphore + handling. The definition is found in XPG2. */ + +/* Structure used for argument to `semop' to describe operations. */ +struct sembuf +{ + unsigned short int sem_num; /* semaphore number */ + short int sem_op; /* semaphore operation */ + short int sem_flg; /* operation flag */ +}; + + +__BEGIN_DECLS + +/* Semaphore control operation. */ +extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; + +/* Get semaphore. */ +extern int semget (key_t __key, int __nsems, int __semflg) __THROW; + +/* Operate on semaphore. */ +extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; + +__END_DECLS + +#endif /* sys/sem.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sendfile.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sendfile.h new file mode 100644 index 0000000..4c1367b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sendfile.h @@ -0,0 +1,52 @@ +/* sendfile -- copy data directly from one file descriptor to another + Copyright (C) 1998,99,01,2002,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SENDFILE_H +#define _SYS_SENDFILE_H 1 + +#include +#include + +__BEGIN_DECLS + +/* Send up to COUNT bytes from file associated with IN_FD starting at + *OFFSET to descriptor OUT_FD. Set *OFFSET to the IN_FD's file position + following the read bytes. If OFFSET is a null pointer, use the normal + file position instead. Return the number of written bytes, or -1 in + case of error. */ +#ifndef __USE_FILE_OFFSET64 +extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset, + size_t __count) __THROW; +#else +# ifdef __REDIRECT_NTH +extern ssize_t __REDIRECT_NTH (sendfile, + (int __out_fd, int __in_fd, __off64_t *__offset, + size_t __count), sendfile64); +# else +# define sendfile sendfile64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset, + size_t __count) __THROW; +#endif + +__END_DECLS + +#endif /* sys/sendfile.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/shm.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/shm.h new file mode 100644 index 0000000..8ec30b4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/shm.h @@ -0,0 +1,64 @@ +/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SHM_H +#define _SYS_SHM_H 1 + +#include + +#define __need_size_t +#include + +/* Get common definition of System V style IPC. */ +#include + +/* Get system dependent definition of `struct shmid_ds' and more. */ +#include + +/* Define types required by the standard. */ +#define __need_time_t +#include + +#ifdef __USE_XOPEN +# ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +# endif +#endif /* X/Open */ + +__BEGIN_DECLS + +/* The following System V style IPC functions implement a shared memory + facility. The definition is found in XPG4.2. */ + +/* Shared memory control operation. */ +extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; + +/* Get shared memory segment. */ +extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW; + +/* Attach shared memory segment. */ +extern void *shmat (int __shmid, __const void *__shmaddr, int __shmflg) + __THROW; + +/* Detach shared memory segment. */ +extern int shmdt (__const void *__shmaddr) __THROW; + +__END_DECLS + +#endif /* sys/shm.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/signal.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/signal.h new file mode 100644 index 0000000..2e602da --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/signal.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/socket.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/socket.h new file mode 100644 index 0000000..4ae1ea9 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/socket.h @@ -0,0 +1,236 @@ +/* Declarations of socket constants, types, and functions. + Copyright (C) 1991,92,1994-2001,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H 1 + +#include + +__BEGIN_DECLS + +#include +#define __need_size_t +#include + + +/* This operating system-specific header file defines the SOCK_*, PF_*, + AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', + `struct msghdr', and `struct linger' types. */ +#include + +#ifdef __USE_BSD +/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire + format in the grotty old 4.3 `talk' protocol. */ +struct osockaddr + { + unsigned short int sa_family; + unsigned char sa_data[14]; + }; +#endif + +/* The following constants should be used for the second parameter of + `shutdown'. */ +enum +{ + SHUT_RD = 0, /* No more receptions. */ +#define SHUT_RD SHUT_RD + SHUT_WR, /* No more transmissions. */ +#define SHUT_WR SHUT_WR + SHUT_RDWR /* No more receptions or transmissions. */ +#define SHUT_RDWR SHUT_RDWR +}; + +/* This is the type we use for generic socket address arguments. + + With GCC 2.7 and later, the funky union causes redeclarations or + uses with any of the listed types to be allowed without complaint. + G++ 2.7 does not support transparent unions so there we want the + old-style declaration, too. */ +#if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU +# define __SOCKADDR_ARG struct sockaddr *__restrict +# define __CONST_SOCKADDR_ARG __const struct sockaddr * +#else +/* Add more `struct sockaddr_AF' types here as necessary. + These are all the ones I found on NetBSD and Linux. */ +# define __SOCKADDR_ALLTYPES \ + __SOCKADDR_ONETYPE (sockaddr) \ + __SOCKADDR_ONETYPE (sockaddr_at) \ + __SOCKADDR_ONETYPE (sockaddr_ax25) \ + __SOCKADDR_ONETYPE (sockaddr_dl) \ + __SOCKADDR_ONETYPE (sockaddr_eon) \ + __SOCKADDR_ONETYPE (sockaddr_in) \ + __SOCKADDR_ONETYPE (sockaddr_in6) \ + __SOCKADDR_ONETYPE (sockaddr_inarp) \ + __SOCKADDR_ONETYPE (sockaddr_ipx) \ + __SOCKADDR_ONETYPE (sockaddr_iso) \ + __SOCKADDR_ONETYPE (sockaddr_ns) \ + __SOCKADDR_ONETYPE (sockaddr_un) \ + __SOCKADDR_ONETYPE (sockaddr_x25) + +# define __SOCKADDR_ONETYPE(type) struct type *__restrict __##type##__; +typedef union { __SOCKADDR_ALLTYPES + } __SOCKADDR_ARG __attribute__ ((__transparent_union__)); +# undef __SOCKADDR_ONETYPE +# define __SOCKADDR_ONETYPE(type) __const struct type *__restrict __##type##__; +typedef union { __SOCKADDR_ALLTYPES + } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__)); +# undef __SOCKADDR_ONETYPE +#endif + + +/* Create a new socket of type TYPE in domain DOMAIN, using + protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. + Returns a file descriptor for the new socket, or -1 for errors. */ +extern int socket (int __domain, int __type, int __protocol) __THROW; + +/* Create two new sockets, of type TYPE in domain DOMAIN and using + protocol PROTOCOL, which are connected to each other, and put file + descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, + one will be chosen automatically. Returns 0 on success, -1 for errors. */ +extern int socketpair (int __domain, int __type, int __protocol, + int __fds[2]) __THROW; + +/* Give the socket FD the local address ADDR (which is LEN bytes long). */ +extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) + __THROW; + +/* Put the local address of FD into *ADDR and its length in *LEN. */ +extern int getsockname (int __fd, __SOCKADDR_ARG __addr, + socklen_t *__restrict __len) __THROW; + +/* Open a connection on socket FD to peer at ADDR (which LEN bytes long). + For connectionless socket types, just set the default address to send to + and the only address from which to accept transmissions. + Return 0 on success, -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len); + +/* Put the address of the peer connected to socket FD into *ADDR + (which is *LEN bytes long), and its actual length into *LEN. */ +extern int getpeername (int __fd, __SOCKADDR_ARG __addr, + socklen_t *__restrict __len) __THROW; + + +/* Send N bytes of BUF to socket FD. Returns the number sent or -1. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags); + +/* Read N bytes into BUF from socket FD. + Returns the number read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags); + +/* Send N bytes of BUF on socket FD to peer at address ADDR (which is + ADDR_LEN bytes long). Returns the number sent, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t sendto (int __fd, __const void *__buf, size_t __n, + int __flags, __CONST_SOCKADDR_ARG __addr, + socklen_t __addr_len); + +/* Read N bytes into BUF through socket FD. + If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of + the sender, and store the actual size of the address in *ADDR_LEN. + Returns the number of bytes read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, + int __flags, __SOCKADDR_ARG __addr, + socklen_t *__restrict __addr_len); + + +/* Send a message described MESSAGE on socket FD. + Returns the number of bytes sent, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t sendmsg (int __fd, __const struct msghdr *__message, + int __flags); + +/* Receive a message as described by MESSAGE from socket FD. + Returns the number of bytes read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); + + +/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL + into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's + actual length. Returns 0 on success, -1 for errors. */ +extern int getsockopt (int __fd, int __level, int __optname, + void *__restrict __optval, + socklen_t *__restrict __optlen) __THROW; + +/* Set socket FD's option OPTNAME at protocol level LEVEL + to *OPTVAL (which is OPTLEN bytes long). + Returns 0 on success, -1 for errors. */ +extern int setsockopt (int __fd, int __level, int __optname, + __const void *__optval, socklen_t __optlen) __THROW; + + +/* Prepare to accept connections on socket FD. + N connection requests will be queued before further requests are refused. + Returns 0 on success, -1 for errors. */ +extern int listen (int __fd, int __n) __THROW; + +/* Await a connection on socket FD. + When a connection arrives, open a new socket to communicate with it, + set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting + peer and *ADDR_LEN to the address's actual length, and return the + new socket's descriptor, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int accept (int __fd, __SOCKADDR_ARG __addr, + socklen_t *__restrict __addr_len); + +/* Shut down all or part of the connection open on socket FD. + HOW determines what to shut down: + SHUT_RD = No more receptions; + SHUT_WR = No more transmissions; + SHUT_RDWR = No more receptions or transmissions. + Returns 0 on success, -1 for errors. */ +extern int shutdown (int __fd, int __how) __THROW; + + +#ifdef __USE_XOPEN2K +/* Determine wheter socket is at a out-of-band mark. */ +extern int sockatmark (int __fd) __THROW; +#endif + + +#ifdef __USE_MISC +/* FDTYPE is S_IFSOCK or another S_IF* macro defined in ; + returns 1 if FD is open on an object of the indicated type, 0 if not, + or -1 for errors (setting errno). */ +extern int isfdtype (int __fd, int __fdtype) __THROW; +#endif + +__END_DECLS + +#endif /* sys/socket.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/socketvar.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/socketvar.h new file mode 100644 index 0000000..b177158 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/socketvar.h @@ -0,0 +1,3 @@ +/* This header is used on many systems but for GNU we have everything + already defined in the standard header. */ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/soundcard.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/soundcard.h new file mode 100644 index 0000000..fade986 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/soundcard.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/stat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/stat.h new file mode 100644 index 0000000..5082390 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/stat.h @@ -0,0 +1,366 @@ +/* Copyright (C) 1991,1992,1995-2004,2005,2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 5.6 File Characteristics + */ + +#ifndef _SYS_STAT_H +#define _SYS_STAT_H 1 + +#include + +#include /* For __mode_t and __dev_t. */ + +#if defined __USE_XOPEN || defined __USE_MISC +# if defined __USE_XOPEN || defined __USE_XOPEN2K +# define __need_time_t +# endif +# ifdef __USE_MISC +# define __need_timespec +# endif +# include /* For time_t resp. timespec. */ +#endif + +#if defined __USE_XOPEN || defined __USE_XOPEN2K +/* The Single Unix specification says that some more types are + available here. */ +# ifndef __dev_t_defined +typedef __dev_t dev_t; +# define __dev_t_defined +# endif + +# ifndef __gid_t_defined +typedef __gid_t gid_t; +# define __gid_t_defined +# endif + +# ifndef __ino_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __ino_t ino_t; +# else +typedef __ino64_t ino_t; +# endif +# define __ino_t_defined +# endif + +# ifndef __mode_t_defined +typedef __mode_t mode_t; +# define __mode_t_defined +# endif + +# ifndef __nlink_t_defined +typedef __nlink_t nlink_t; +# define __nlink_t_defined +# endif + +# ifndef __off_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __off_t off_t; +# else +typedef __off64_t off_t; +# endif +# define __off_t_defined +# endif + +# ifndef __uid_t_defined +typedef __uid_t uid_t; +# define __uid_t_defined +# endif +#endif /* X/Open */ + +#ifdef __USE_UNIX98 +# ifndef __blkcnt_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __blkcnt_t blkcnt_t; +# else +typedef __blkcnt64_t blkcnt_t; +# endif +# define __blkcnt_t_defined +# endif + +# ifndef __blksize_t_defined +typedef __blksize_t blksize_t; +# define __blksize_t_defined +# endif +#endif /* Unix98 */ + +__BEGIN_DECLS + +#include + +#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN +# define S_IFMT __S_IFMT +# define S_IFDIR __S_IFDIR +# define S_IFCHR __S_IFCHR +# define S_IFBLK __S_IFBLK +# define S_IFREG __S_IFREG +# ifdef __S_IFIFO +# define S_IFIFO __S_IFIFO +# endif +# ifdef __S_IFLNK +# define S_IFLNK __S_IFLNK +# endif +# if (defined __USE_BSD || defined __USE_MISC || defined __USE_UNIX98) \ + && defined __S_IFSOCK +# define S_IFSOCK __S_IFSOCK +# endif +#endif + +/* Test macros for file types. */ + +#define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask)) + +#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) +#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR) +#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK) +#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG) +#ifdef __S_IFIFO +# define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO) +#endif +#ifdef __S_IFLNK +# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) +#endif + +#if defined __USE_BSD && !defined __S_IFLNK +# define S_ISLNK(mode) 0 +#endif + +#if (defined __USE_BSD || defined __USE_UNIX98) \ + && defined __S_IFSOCK +# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK) +#endif + +/* These are from POSIX.1b. If the objects are not implemented using separate + distinct file types, the macros always will evaluate to zero. Unlike the + other S_* macros the following three take a pointer to a `struct stat' + object as the argument. */ +#ifdef __USE_POSIX199309 +# define S_TYPEISMQ(buf) __S_TYPEISMQ(buf) +# define S_TYPEISSEM(buf) __S_TYPEISSEM(buf) +# define S_TYPEISSHM(buf) __S_TYPEISSHM(buf) +#endif + + +/* Protection bits. */ + +#define S_ISUID __S_ISUID /* Set user ID on execution. */ +#define S_ISGID __S_ISGID /* Set group ID on execution. */ + +#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN +/* Save swapped text after use (sticky bit). This is pretty well obsolete. */ +# define S_ISVTX __S_ISVTX +#endif + +#define S_IRUSR __S_IREAD /* Read by owner. */ +#define S_IWUSR __S_IWRITE /* Write by owner. */ +#define S_IXUSR __S_IEXEC /* Execute by owner. */ +/* Read, write, and execute by owner. */ +#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) + +#if defined __USE_MISC && defined __USE_BSD +# define S_IREAD S_IRUSR +# define S_IWRITE S_IWUSR +# define S_IEXEC S_IXUSR +#endif + +#define S_IRGRP (S_IRUSR >> 3) /* Read by group. */ +#define S_IWGRP (S_IWUSR >> 3) /* Write by group. */ +#define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */ +/* Read, write, and execute by group. */ +#define S_IRWXG (S_IRWXU >> 3) + +#define S_IROTH (S_IRGRP >> 3) /* Read by others. */ +#define S_IWOTH (S_IWGRP >> 3) /* Write by others. */ +#define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */ +/* Read, write, and execute by others. */ +#define S_IRWXO (S_IRWXG >> 3) + + +#ifdef __USE_BSD +/* Macros for common mode bit masks. */ +# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ +# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */ +# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/ + +# define S_BLKSIZE 512 /* Block size for `st_blocks'. */ +#endif + + +#ifndef __USE_FILE_OFFSET64 +/* Get file attributes for FILE and put them in BUF. */ +extern int stat (__const char *__restrict __file, + struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); + +/* Get file attributes for the file, device, pipe, or socket + that file descriptor FD is open on and put them in BUF. */ +extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (stat, (__const char *__restrict __file, + struct stat *__restrict __buf), stat64) + __nonnull ((1, 2)); +extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) + __nonnull ((2)); +# else +# define stat stat64 +# define fstat fstat64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int stat64 (__const char *__restrict __file, + struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); +extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); +#endif + +#ifdef __USE_ATFILE +/* Similar to stat, get the attributes for FILE and put them in BUF. + Relative path names are interpreted relative to FD unless FD is + AT_FDCWD. */ +# ifndef __USE_FILE_OFFSET64 +extern int fstatat (int __fd, __const char *__restrict __file, + struct stat *__restrict __buf, int __flag) + __THROW __nonnull ((2, 3)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (fstatat, (int __fd, __const char *__restrict __file, + struct stat *__restrict __buf, + int __flag), + fstatat64) __nonnull ((2, 3)); +# else +# define fstatat fstatat64 +# endif +# endif + +extern int fstatat64 (int __fd, __const char *__restrict __file, + struct stat64 *__restrict __buf, int __flag) + __THROW __nonnull ((2, 3)); +#endif + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +# ifndef __USE_FILE_OFFSET64 +/* Get file attributes about FILE and put them in BUF. + If FILE is a symbolic link, do not follow it. */ +extern int lstat (__const char *__restrict __file, + struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (lstat, + (__const char *__restrict __file, + struct stat *__restrict __buf), lstat64) + __nonnull ((1, 2)); +# else +# define lstat lstat64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int lstat64 (__const char *__restrict __file, + struct stat64 *__restrict __buf) + __THROW __nonnull ((1, 2)); +# endif +#endif + +/* Set file access permissions for FILE to MODE. + If FILE is a symbolic link, this affects its target instead. */ +extern int chmod (__const char *__file, __mode_t __mode) + __THROW __nonnull ((1)); + +#if 0 /*def __USE_BSD*/ +/* Set file access permissions for FILE to MODE. + If FILE is a symbolic link, this affects the link itself + rather than its target. */ +extern int lchmod (__const char *__file, __mode_t __mode) + __THROW __nonnull ((1)); +#endif + +/* Set file access permissions of the file FD is open on to MODE. */ +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +extern int fchmod (int __fd, __mode_t __mode) __THROW; +#endif + +#ifdef __USE_ATFILE +/* Set file access permissions of FILE relative to + the directory FD is open on. */ +extern int fchmodat (int __fd, __const char *__file, __mode_t mode, int __flag) + __THROW __nonnull ((2)) __wur; +#endif /* Use ATFILE. */ + + + +/* Set the file creation mask of the current process to MASK, + and return the old creation mask. */ +extern __mode_t umask (__mode_t __mask) __THROW; + +#if 0 /*def __USE_GNU*/ +/* Get the current `umask' value without changing it. + This function is only available under the GNU Hurd. */ +extern __mode_t getumask (void) __THROW; +#endif + +/* Create a new directory named PATH, with permission bits MODE. */ +extern int mkdir (__const char *__path, __mode_t __mode) + __THROW __nonnull ((1)); + +#ifdef __USE_ATFILE +/* Like mkdir, create a new directory with permission bits MODE. But + interpret relative PATH names relative to the directory associated + with FD. */ +extern int mkdirat (int __fd, __const char *__path, __mode_t __mode) + __THROW __nonnull ((2)); +#endif + +/* Create a device file named PATH, with permission and special bits MODE + and device number DEV (which can be constructed from major and minor + device numbers with the `makedev' macro above). */ +#if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED +extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev) + __THROW __nonnull ((1)); +#endif + +#ifdef __USE_ATFILE +/* Like mknod, create a new device file with permission bits MODE and + device number DEV. But interpret relative PATH names relative to + the directory associated with FD. */ +extern int mknodat (int __fd, __const char *__path, __mode_t __mode, + __dev_t __dev) __THROW __nonnull ((2)); +#endif + + +/* Create a new FIFO named PATH, with permission bits MODE. */ +extern int mkfifo (__const char *__path, __mode_t __mode) + __THROW __nonnull ((1)); + +#ifdef __USE_ATFILE +/* Like mkfifo, create a new FIFO with permission bits MODE. But + interpret relative PATH names relative to the directory associated + with FD. */ +extern int mkfifoat (int __fd, __const char *__path, __mode_t __mode) + __THROW __nonnull ((2)); +#endif + +/* on uClibc we have unversioned struct stat and mknod. + * bits/stat.h is filled with wrong info, so we undo it here. */ +#undef _STAT_VER +#define _STAT_VER 0 +#undef _MKNOD_VER +#define _MKNOD_VER 0 + +__END_DECLS + + +#endif /* sys/stat.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/statfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/statfs.h new file mode 100644 index 0000000..3b2226b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/statfs.h @@ -0,0 +1,68 @@ +/* Definitions for getting information about a filesystem. + Copyright (C) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STATFS_H +#define _SYS_STATFS_H 1 + +#include + +/* Get the system-specific definition of `struct statfs'. */ +#include + +__BEGIN_DECLS + +/* Return information about the filesystem on which FILE resides. */ +#ifndef __USE_FILE_OFFSET64 +extern int statfs (__const char *__file, struct statfs *__buf) + __THROW __nonnull ((1, 2)); +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (statfs, + (__const char *__file, struct statfs *__buf), + statfs64) __nonnull ((1, 2)); +# else +# define statfs statfs64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int statfs64 (__const char *__file, struct statfs64 *__buf) + __THROW __nonnull ((1, 2)); +#endif + +/* Return information about the filesystem containing the file FILDES + refers to. */ +#ifndef __USE_FILE_OFFSET64 +extern int fstatfs (int __fildes, struct statfs *__buf) + __THROW __nonnull ((2)); +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf), + fstatfs64) __nonnull ((2)); +# else +# define fstatfs fstatfs64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int fstatfs64 (int __fildes, struct statfs64 *__buf) + __THROW __nonnull ((2)); +#endif + +__END_DECLS + +#endif /* sys/statfs.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/statvfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/statvfs.h new file mode 100644 index 0000000..685dd26 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/statvfs.h @@ -0,0 +1,91 @@ +/* Definitions for getting information about a filesystem. + Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STATVFS_H +#define _SYS_STATVFS_H 1 + +#include + +/* Get the system-specific definition of `struct statfs'. */ +#include + +#ifndef __USE_FILE_OFFSET64 +# ifndef __fsblkcnt_t_defined +typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ +# define __fsblkcnt_t_defined +# endif +# ifndef __fsfilcnt_t_defined +typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ +# define __fsfilcnt_t_defined +# endif +#else +# ifndef __fsblkcnt_t_defined +typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ +# define __fsblkcnt_t_defined +# endif +# ifndef __fsfilcnt_t_defined +typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ +# define __fsfilcnt_t_defined +# endif +#endif + +__BEGIN_DECLS + +/* Return information about the filesystem on which FILE resides. */ +#ifndef __USE_FILE_OFFSET64 +extern int statvfs (__const char *__restrict __file, + struct statvfs *__restrict __buf) + __THROW __nonnull ((1, 2)); +#else +# ifdef __REDIRECT +extern int __REDIRECT (statvfs, + (__const char *__restrict __file, + struct statvfs *__restrict __buf), statvfs64) + __nonnull ((1, 2)); +# else +# define statvfs statvfs64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int statvfs64 (__const char *__restrict __file, + struct statvfs64 *__restrict __buf) + __THROW __nonnull ((1, 2)); +#endif + +/* Return information about the filesystem containing the file FILDES + refers to. */ +#ifndef __USE_FILE_OFFSET64 +extern int fstatvfs (int __fildes, struct statvfs *__buf) + __THROW __nonnull ((2)); +#else +# ifdef __REDIRECT +extern int __REDIRECT (fstatvfs, (int __fildes, struct statvfs *__buf), + fstatvfs64) __nonnull ((2)); +# else +# define fstatvfs fstatvfs64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern int fstatvfs64 (int __fildes, struct statvfs64 *__buf) + __THROW __nonnull ((2)); +#endif + +__END_DECLS + +#endif /* sys/statvfs.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/swap.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/swap.h new file mode 100644 index 0000000..b6e7bef --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/swap.h @@ -0,0 +1,43 @@ +/* Calls to enable and disable swapping on specified locations. Linux version. + Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SWAP_H + +#define _SYS_SWAP_H 1 +#include + +/* The swap priority is encoded as: + (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK +*/ +#define SWAP_FLAG_PREFER 0x8000 /* Set if swap priority is specified. */ +#define SWAP_FLAG_PRIO_MASK 0x7fff +#define SWAP_FLAG_PRIO_SHIFT 0 + +__BEGIN_DECLS + +/* Make the block special device PATH available to the system for swapping. + This call is restricted to the super-user. */ +extern int swapon (__const char *__path, int __flags) __THROW; + +/* Stop using block special device PATH for swapping. */ +extern int swapoff (__const char *__path) __THROW; + +__END_DECLS + +#endif /* _SYS_SWAP_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/syscall.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/syscall.h new file mode 100644 index 0000000..4c8ede8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/syscall.h @@ -0,0 +1,37 @@ +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYSCALL_H +#define _SYSCALL_H 1 + +/* The _syscall#() macros are for uClibc internal use only. + * User application code should use syscall() instead. + * + * The kernel provided _syscall[0-6] macros from asm/unistd.h are not suitable + * for use in uClibc as they lack PIC support etc, so for uClibc we use our own + * local _syscall# macros to be certain all such variations are handled + * properly. + */ + +#include +#include +#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) +# include +#endif + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysctl.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysctl.h new file mode 100644 index 0000000..110efaa --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysctl.h @@ -0,0 +1,72 @@ +/* Copyright (C) 1996, 1999, 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SYSCTL_H +#define _SYS_SYSCTL_H 1 + +#include +#define __need_size_t +#include +/* Prevent more kernel headers than necessary to be included. */ +#ifndef _LINUX_KERNEL_H +# define _LINUX_KERNEL_H 1 +# define __undef_LINUX_KERNEL_H +#endif +#ifndef _LINUX_TYPES_H +# define _LINUX_TYPES_H 1 +# define __undef_LINUX_TYPES_H +#endif +#ifndef _LINUX_LIST_H +# define _LINUX_LIST_H 1 +# define __undef_LINUX_LIST_H +#endif +#ifndef __LINUX_COMPILER_H +# define __LINUX_COMPILER_H 1 +# define __user +# define __undef__LINUX_COMPILER_H +#endif + +#include + +#ifdef __undef_LINUX_KERNEL_H +# undef _LINUX_KERNEL_H +# undef __undef_LINUX_KERNEL_H +#endif +#ifdef __undef_LINUX_TYPES_H +# undef _LINUX_TYPES_H +# undef __undef_LINUX_TYPES_H +#endif +#ifdef __undef_LINUX_LIST_H +# undef _LINUX_LIST_H +# undef __undef_LINUX_LIST_H +#endif +#ifdef __undef__LINUX_COMPILER_H +# undef __LINUX_COMPILER_H +# undef __user +# undef __undef__LINUX_COMPILER_H +#endif + +__BEGIN_DECLS + +/* Read or write system parameters. */ +extern int sysctl (int *__name, int __nlen, void *__oldval, + size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; + +__END_DECLS + +#endif /* _SYS_SYSCTL_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysinfo.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysinfo.h new file mode 100644 index 0000000..9fd4fa8 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysinfo.h @@ -0,0 +1,67 @@ +/* Copyright (C) 1996, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SYSINFO_H +#define _SYS_SYSINFO_H 1 + +#include + +#ifndef _LINUX_KERNEL_H +/* Include our own copy of struct sysinfo to avoid binary compatability + * problems with Linux 2.4, which changed things. Grumble, grumble. */ +#define SI_LOAD_SHIFT 16 +struct sysinfo { + long uptime; /* Seconds since boot */ + unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ + unsigned long totalram; /* Total usable main memory size */ + unsigned long freeram; /* Available memory size */ + unsigned long sharedram; /* Amount of shared memory */ + unsigned long bufferram; /* Memory used by buffers */ + unsigned long totalswap; /* Total swap space size */ + unsigned long freeswap; /* swap space still available */ + unsigned short procs; /* Number of current processes */ + unsigned short pad; /* Padding needed for m68k */ + unsigned long totalhigh; /* Total high memory size */ + unsigned long freehigh; /* Available high memory size */ + unsigned int mem_unit; /* Memory unit size in bytes */ + char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ +}; +#endif + +__BEGIN_DECLS + +/* Returns information on overall system statistics. */ +extern int sysinfo (struct sysinfo *__info) __THROW; + + +/* Return number of configured processors. */ +extern int get_nprocs_conf (void) __THROW; + +/* Return number of available processors. */ +extern int get_nprocs (void) __THROW; + + +/* Return number of physical pages of memory in the system. */ +extern long int get_phys_pages (void) __THROW; + +/* Return number of available physical pages of memory in the system. */ +extern long int get_avphys_pages (void) __THROW; + +__END_DECLS + +#endif /* sys/sysinfo.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/syslog.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/syslog.h new file mode 100644 index 0000000..cbbc31e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/syslog.h @@ -0,0 +1,206 @@ +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)syslog.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _SYS_SYSLOG_H +#define _SYS_SYSLOG_H 1 + +#include +#define __need___va_list +#include + + +#define _PATH_LOG "/dev/log" + +/* + * priorities/facilities are encoded into a single 32-bit quantity, where the + * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility + * (0-big number). Both the priorities and the facilities map roughly + * one-to-one to strings in the syslogd(8) source code. This mapping is + * included in this file. + * + * priorities (these are ordered) + */ +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but significant condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ + /* extract priority */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#ifdef SYSLOG_NAMES +#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ + /* mark "facility" */ +#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) +typedef struct _code { + char *c_name; + int c_val; +} CODE; + +CODE prioritynames[] = + { + { "alert", LOG_ALERT }, + { "crit", LOG_CRIT }, + { "debug", LOG_DEBUG }, + { "emerg", LOG_EMERG }, + { "err", LOG_ERR }, + { "error", LOG_ERR }, /* DEPRECATED */ + { "info", LOG_INFO }, + { "none", INTERNAL_NOPRI }, /* INTERNAL */ + { "notice", LOG_NOTICE }, + { "panic", LOG_EMERG }, /* DEPRECATED */ + { "warn", LOG_WARNING }, /* DEPRECATED */ + { "warning", LOG_WARNING }, + { NULL, -1 } + }; +#endif + +/* facility codes */ +#define LOG_KERN (0<<3) /* kernel messages */ +#define LOG_USER (1<<3) /* random user-level messages */ +#define LOG_MAIL (2<<3) /* mail system */ +#define LOG_DAEMON (3<<3) /* system daemons */ +#define LOG_AUTH (4<<3) /* security/authorization messages */ +#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define LOG_LPR (6<<3) /* line printer subsystem */ +#define LOG_NEWS (7<<3) /* network news subsystem */ +#define LOG_UUCP (8<<3) /* UUCP subsystem */ +#define LOG_CRON (9<<3) /* clock daemon */ +#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ +#define LOG_FTP (11<<3) /* ftp daemon */ + + /* other codes through 15 reserved for system use */ +#define LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define LOG_LOCAL7 (23<<3) /* reserved for local use */ + +#define LOG_NFACILITIES 24 /* current number of facilities */ +#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ + /* facility of pri */ +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +#ifdef SYSLOG_NAMES +CODE facilitynames[] = + { + { "auth", LOG_AUTH }, + { "authpriv", LOG_AUTHPRIV }, + { "cron", LOG_CRON }, + { "daemon", LOG_DAEMON }, + { "ftp", LOG_FTP }, + { "kern", LOG_KERN }, + { "lpr", LOG_LPR }, + { "mail", LOG_MAIL }, + { "mark", INTERNAL_MARK }, /* INTERNAL */ + { "news", LOG_NEWS }, + { "security", LOG_AUTH }, /* DEPRECATED */ + { "syslog", LOG_SYSLOG }, + { "user", LOG_USER }, + { "uucp", LOG_UUCP }, + { "local0", LOG_LOCAL0 }, + { "local1", LOG_LOCAL1 }, + { "local2", LOG_LOCAL2 }, + { "local3", LOG_LOCAL3 }, + { "local4", LOG_LOCAL4 }, + { "local5", LOG_LOCAL5 }, + { "local6", LOG_LOCAL6 }, + { "local7", LOG_LOCAL7 }, + { NULL, -1 } + }; +#endif + +/* + * arguments to setlogmask. + */ +#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything. + * LOG_NDELAY is the inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ +#define LOG_PERROR 0x20 /* log to stderr as well */ + +__BEGIN_DECLS + +/* Close descriptor used to write to system logger. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void closelog (void); + +/* Open connection to system logger. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void openlog (__const char *__ident, int __option, int __facility); + +/* Set the log mask level. */ +extern int setlogmask (int __mask) __THROW; + +/* Generate a log message using FMT string and option arguments. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void syslog (int __pri, __const char *__fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + +#ifdef __USE_BSD +/* Generate a log message using FMT and using arguments pointed to by AP. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap) + __attribute__ ((__format__ (__printf__, 2, 0))); +#endif + +__END_DECLS + +#endif /* sys/syslog.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysmacros.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysmacros.h new file mode 100644 index 0000000..c5efca4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysmacros.h @@ -0,0 +1,69 @@ +/* Definitions of macros to access `dev_t' values. + Copyright (C) 1996, 1997, 1999, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SYSMACROS_H +#define _SYS_SYSMACROS_H 1 + +#include + +/* If the compiler does not know long long it is out of luck. We are + not going to hack weird hacks to support the dev_t representation + they need. */ +#if 1 /*def __GLIBC_HAVE_LONG_LONG uClibc note: always enable */ +__extension__ +static __inline unsigned int gnu_dev_major (unsigned long long int __dev) + __THROW; +__extension__ +static __inline unsigned int gnu_dev_minor (unsigned long long int __dev) + __THROW; +__extension__ +static __inline unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __THROW; + +# if defined __GNUC__ && __GNUC__ >= 2 +__extension__ static __inline unsigned int +__NTH (gnu_dev_major (unsigned long long int __dev)) +{ + return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); +} + +__extension__ static __inline unsigned int +__NTH (gnu_dev_minor (unsigned long long int __dev)) +{ + return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); +} + +__extension__ static __inline unsigned long long int +__NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor)) +{ + return ((__minor & 0xff) | ((__major & 0xfff) << 8) + | (((unsigned long long int) (__minor & ~0xff)) << 12) + | (((unsigned long long int) (__major & ~0xfff)) << 32)); +} +# endif + + +/* Access the functions with their traditional names. */ +# define major(dev) gnu_dev_major (dev) +# define minor(dev) gnu_dev_minor (dev) +# define makedev(maj, min) gnu_dev_makedev (maj, min) +#endif + +#endif /* sys/sysmacros.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysmips.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysmips.h new file mode 100644 index 0000000..6a63dc2 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/sysmips.h @@ -0,0 +1,44 @@ +/* Copyright (C) 1991, 92, 94, 95, 96, 97, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SYSMIPS_H +#define _SYS_SYSMIPS_H 1 + +#include + +/* + * Commands for the sysmips(2) call + * + * sysmips(2) is deprecated - though some existing software uses it. + * We only support the following commands. Sysmips exists for compatibility + * purposes only so new software should avoid it. + */ +#define SETNAME 1 /* set hostname */ +#define FLUSH_CACHE 3 /* writeback and invalidate caches */ +#define MIPS_FIXADE 7 /* control address error fixing */ +#define MIPS_RDNVRAM 10 /* read NVRAM */ +#define MIPS_ATOMIC_SET 2001 /* atomically set variable */ + +__BEGIN_DECLS + +extern int sysmips (__const int cmd, __const long arg1, + __const int arg2, __const int arg3) __THROW; + +__END_DECLS + +#endif /* sys/sysmips.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/tas.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/tas.h new file mode 100644 index 0000000..1183b86 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/tas.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Maciej W. Rozycki , 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_TAS_H +#define _SYS_TAS_H 1 + +#include +#include + +__BEGIN_DECLS + +extern int _test_and_set (int *p, int v) __THROW; + +#ifdef __USE_EXTERN_INLINES + +# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE extern __inline +# endif + +_EXTERN_INLINE int +__NTH (_test_and_set (int *p, int v)) +{ + int r, t; + + __asm__ __volatile__ + ("/* Inline test and set */\n" + "1:\n\t" + ".set push\n\t" +#if _MIPS_SIM == _ABIO32 + ".set mips2\n\t" +#endif + "ll %0,%3\n\t" + "move %1,%4\n\t" + "beq %0,%4,2f\n\t" + "sc %1,%2\n\t" + ".set pop\n\t" + "beqz %1,1b\n" + "2:\n\t" + "/* End test and set */" + : "=&r" (r), "=&r" (t), "=m" (*p) + : "m" (*p), "r" (v) + : "memory"); + + return r; +} + +#endif /* __USE_EXTERN_INLINES */ + +__END_DECLS + +#endif /* sys/tas.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/termios.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/termios.h new file mode 100644 index 0000000..3e18805 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/termios.h @@ -0,0 +1,4 @@ +#ifndef _SYS_TERMIOS_H +#define _SYS_TERMIOS_H +#include +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/time.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/time.h new file mode 100644 index 0000000..66fb9e0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/time.h @@ -0,0 +1,192 @@ +/* Copyright (C) 1991-1994,1996-2002,2003,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_TIME_H +#define _SYS_TIME_H 1 + +#include + +#include +#define __need_time_t +#include +#define __need_timeval +#include + +#include + +#ifndef __suseconds_t_defined +typedef __suseconds_t suseconds_t; +# define __suseconds_t_defined +#endif + + +__BEGIN_DECLS + +#ifdef __USE_GNU +/* Macros for converting between `struct timeval' and `struct timespec'. */ +# define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +# define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} +#endif + + +#ifdef __USE_BSD +/* Structure crudely representing a timezone. + This is obsolete and should never be used. */ +struct timezone + { + int tz_minuteswest; /* Minutes west of GMT. */ + int tz_dsttime; /* Nonzero if DST is ever in effect. */ + }; + +typedef struct timezone *__restrict __timezone_ptr_t; +#else +typedef void *__restrict __timezone_ptr_t; +#endif + +/* Get the current time of day and timezone information, + putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. + Returns 0 on success, -1 on errors. + NOTE: This form of timezone information is obsolete. + Use the functions and variables declared in instead. */ +extern int gettimeofday (struct timeval *__restrict __tv, + __timezone_ptr_t __tz) __THROW __nonnull ((1)); + +#ifdef __USE_BSD +/* Set the current time of day and timezone information. + This call is restricted to the super-user. */ +extern int settimeofday (__const struct timeval *__tv, + __const struct timezone *__tz) + __THROW __nonnull ((1)); + +/* Adjust the current time of day by the amount in DELTA. + If OLDDELTA is not NULL, it is filled in with the amount + of time adjustment remaining to be done from the last `adjtime' call. + This call is restricted to the super-user. */ +extern int adjtime (__const struct timeval *__delta, + struct timeval *__olddelta) __THROW; +#endif + + +/* Values for the first argument to `getitimer' and `setitimer'. */ +enum __itimer_which + { + /* Timers run in real time. */ + ITIMER_REAL = 0, +#define ITIMER_REAL ITIMER_REAL + /* Timers run only when the process is executing. */ + ITIMER_VIRTUAL = 1, +#define ITIMER_VIRTUAL ITIMER_VIRTUAL + /* Timers run when the process is executing and when + the system is executing on behalf of the process. */ + ITIMER_PROF = 2 +#define ITIMER_PROF ITIMER_PROF + }; + +/* Type of the second argument to `getitimer' and + the second and third arguments `setitimer'. */ +struct itimerval + { + /* Value to put into `it_value' when the timer expires. */ + struct timeval it_interval; + /* Time to the next timer expiration. */ + struct timeval it_value; + }; + +#if defined __USE_GNU && !defined __cplusplus +/* Use the nicer parameter type only in GNU mode and not for C++ since the + strict C++ rules prevent the automatic promotion. */ +typedef enum __itimer_which __itimer_which_t; +#else +typedef int __itimer_which_t; +#endif + +/* Set *VALUE to the current setting of timer WHICH. + Return 0 on success, -1 on errors. */ +extern int getitimer (__itimer_which_t __which, + struct itimerval *__value) __THROW; + +/* Set the timer WHICH to *NEW. If OLD is not NULL, + set *OLD to the old value of timer WHICH. + Returns 0 on success, -1 on errors. */ +extern int setitimer (__itimer_which_t __which, + __const struct itimerval *__restrict __new, + struct itimerval *__restrict __old) __THROW; + +/* Change the access time of FILE to TVP[0] and the modification time of + FILE to TVP[1]. If TVP is a null pointer, use the current time instead. + Returns 0 on success, -1 on errors. */ +extern int utimes (__const char *__file, __const struct timeval __tvp[2]) + __THROW __nonnull ((1)); + +#if 0 /*def __USE_BSD*/ +/* Same as `utimes', but does not follow symbolic links. */ +extern int lutimes (__const char *__file, __const struct timeval __tvp[2]) + __THROW __nonnull ((1)); + +/* Same as `utimes', but takes an open file descriptor instead of a name. */ +extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW; +#endif + +#if 0 /*def __USE_GNU*/ +/* Change the access time of FILE relative to FD to TVP[0] and the + modification time of FILE to TVP[1]. If TVP is a null pointer, use + the current time instead. Returns 0 on success, -1 on errors. */ +extern int futimesat (int __fd, __const char *__file, + __const struct timeval __tvp[2]) __THROW; +#endif + + +#ifdef __USE_BSD +/* Convenience macros for operations on timevals. + NOTE: `timercmp' does not work for >= or <=. */ +# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) +# define timercmp(a, b, CMP) \ + (((a)->tv_sec == (b)->tv_sec) ? \ + ((a)->tv_usec CMP (b)->tv_usec) : \ + ((a)->tv_sec CMP (b)->tv_sec)) +# define timeradd(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ + if ((result)->tv_usec >= 1000000) \ + { \ + ++(result)->tv_sec; \ + (result)->tv_usec -= 1000000; \ + } \ + } while (0) +# define timersub(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ + } while (0) +#endif /* BSD */ + +__END_DECLS + +#endif /* sys/time.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/timeb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/timeb.h new file mode 100644 index 0000000..dbdbf45 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/timeb.h @@ -0,0 +1,46 @@ +/* Copyright (C) 1994, 1995, 1996, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_TIMEB_H +#define _SYS_TIMEB_H 1 + +#include + +#define __need_time_t +#include + + +__BEGIN_DECLS + +/* Structure returned by the `ftime' function. */ + +struct timeb + { + time_t time; /* Seconds since epoch, as from `time'. */ + unsigned short int millitm; /* Additional milliseconds. */ + short int timezone; /* Minutes west of GMT. */ + short int dstflag; /* Nonzero if Daylight Savings Time used. */ + }; + +/* Fill in TIMEBUF with information about the current time. */ + +extern int ftime (struct timeb *__timebuf); + +__END_DECLS + +#endif /* sys/timeb.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/times.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/times.h new file mode 100644 index 0000000..6022f2f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/times.h @@ -0,0 +1,53 @@ +/* Copyright (C) 1991, 1992, 1996, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 4.5.2 Process Times + */ + +#ifndef _SYS_TIMES_H +#define _SYS_TIMES_H 1 + +#include + +#define __need_clock_t +#include + + +__BEGIN_DECLS + +/* Structure describing CPU time used by a process and its children. */ +struct tms + { + clock_t tms_utime; /* User CPU time. */ + clock_t tms_stime; /* System CPU time. */ + + clock_t tms_cutime; /* User CPU time of dead children. */ + clock_t tms_cstime; /* System CPU time of dead children. */ + }; + + +/* Store the CPU time used by this process and all its + dead children (and their dead children) in BUFFER. + Return the elapsed real time, or (clock_t) -1 for errors. + All times are in CLK_TCKths of a second. */ +extern clock_t times (struct tms *__buffer) __THROW; + +__END_DECLS + +#endif /* sys/times.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/timex.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/timex.h new file mode 100644 index 0000000..773a5ab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/timex.h @@ -0,0 +1,127 @@ +/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_TIMEX_H +#define _SYS_TIMEX_H 1 + +#include +#include + +/* These definitions from linux/timex.h as of 2.2.0. */ + +struct ntptimeval +{ + struct timeval time; /* current time (ro) */ + long int maxerror; /* maximum error (us) (ro) */ + long int esterror; /* estimated error (us) (ro) */ +}; + +struct timex +{ + unsigned int modes; /* mode selector */ + long int offset; /* time offset (usec) */ + long int freq; /* frequency offset (scaled ppm) */ + long int maxerror; /* maximum error (usec) */ + long int esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + long int constant; /* pll time constant */ + long int precision; /* clock precision (usec) (read only) */ + long int tolerance; /* clock frequency tolerance (ppm) (read only) */ + struct timeval time; /* (read only) */ + long int tick; /* (modified) usecs between clock ticks */ + + long int ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long int jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + long int stabil; /* pps stability (scaled ppm) (ro) */ + long int jitcnt; /* jitter limit exceeded (ro) */ + long int calcnt; /* calibration intervals (ro) */ + long int errcnt; /* calibration errors (ro) */ + long int stbcnt; /* stability limit exceeded (ro) */ + + /* ??? */ + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; +}; + +/* Mode codes (timex.mode) */ +#define ADJ_OFFSET 0x0001 /* time offset */ +#define ADJ_FREQUENCY 0x0002 /* frequency offset */ +#define ADJ_MAXERROR 0x0004 /* maximum time error */ +#define ADJ_ESTERROR 0x0008 /* estimated time error */ +#define ADJ_STATUS 0x0010 /* clock status */ +#define ADJ_TIMECONST 0x0020 /* pll time constant */ +#define ADJ_TICK 0x4000 /* tick value */ +#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ + +/* xntp 3.4 compatibility names */ +#define MOD_OFFSET ADJ_OFFSET +#define MOD_FREQUENCY ADJ_FREQUENCY +#define MOD_MAXERROR ADJ_MAXERROR +#define MOD_ESTERROR ADJ_ESTERROR +#define MOD_STATUS ADJ_STATUS +#define MOD_TIMECONST ADJ_TIMECONST +#define MOD_CLKB ADJ_TICK +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ + + +/* Status codes (timex.status) */ +#define STA_PLL 0x0001 /* enable PLL updates (rw) */ +#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ +#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ +#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ + +#define STA_INS 0x0010 /* insert leap (rw) */ +#define STA_DEL 0x0020 /* delete leap (rw) */ +#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ +#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ + +#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ +#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ +#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ +#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ + +#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ + +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ + STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ + +/* Clock states (time_state) */ +#define TIME_OK 0 /* clock synchronized, no leap second */ +#define TIME_INS 1 /* insert leap second */ +#define TIME_DEL 2 /* delete leap second */ +#define TIME_OOP 3 /* leap second in progress */ +#define TIME_WAIT 4 /* leap second has occurred */ +#define TIME_ERROR 5 /* clock not synchronized */ +#define TIME_BAD TIME_ERROR /* bw compat */ + +/* Maximum time constant of the PLL. */ +#define MAXTC 6 + +__BEGIN_DECLS + +extern int __adjtimex (struct timex *__ntx) __THROW; +extern int adjtimex (struct timex *__ntx) __THROW; + +extern int ntp_gettime (struct ntptimeval *__ntv) __THROW; +extern int ntp_adjtime (struct timex *__tntx) __THROW; + +__END_DECLS + +#endif /* sys/timex.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ttydefaults.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ttydefaults.h new file mode 100644 index 0000000..9be168b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ttydefaults.h @@ -0,0 +1,100 @@ +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 + */ + +/* + * System wide defaults for terminal state. Linux version. + */ +#ifndef _SYS_TTYDEFAULTS_H_ +#define _SYS_TTYDEFAULTS_H_ + +/* + * Defaults on "first" open. + */ +#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) +#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) +#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) +#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) +#define TTYDEF_SPEED (B9600) + +/* + * Control Character Defaults + */ +#define CTRL(x) (x&037) +#define CEOF CTRL('d') +#ifdef _POSIX_VDISABLE +# define CEOL _POSIX_VDISABLE +#else +# define CEOL '\0' /* XXX avoid _POSIX_VDISABLE */ +#endif +#define CERASE 0177 +#define CINTR CTRL('c') +#ifdef _POSIX_VDISABLE +# define CSTATUS _POSIX_VDISABLE +#else +# define CSTATUS '\0' /* XXX avoid _POSIX_VDISABLE */ +#endif +#define CKILL CTRL('u') +#define CMIN 1 +#define CQUIT 034 /* FS, ^\ */ +#define CSUSP CTRL('z') +#define CTIME 0 +#define CDSUSP CTRL('y') +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CLNEXT CTRL('v') +#define CDISCARD CTRL('o') +#define CWERASE CTRL('w') +#define CREPRINT CTRL('r') +#define CEOT CEOF +/* compat */ +#define CBRK CEOL +#define CRPRNT CREPRINT +#define CFLUSH CDISCARD + +/* PROTECTED INCLUSION ENDS HERE */ +#endif /* !_SYS_TTYDEFAULTS_H_ */ + +/* + * #define TTYDEFCHARS to include an array of default control characters. + */ +#ifdef TTYDEFCHARS +cc_t ttydefchars[NCCS] = { + CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, + _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, + CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE +}; +#undef TTYDEFCHARS +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/types.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/types.h new file mode 100644 index 0000000..8c0b5dc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/types.h @@ -0,0 +1,275 @@ +/* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 2.6 Primitive System Data Types + */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H 1 + +#include + +__BEGIN_DECLS + +#include + +#ifdef __USE_BSD +# ifndef __u_char_defined +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; +# define __u_char_defined +# endif +#endif + +typedef __loff_t loff_t; + +#ifndef __ino_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __ino_t ino_t; +# else +typedef __ino64_t ino_t; +# endif +# define __ino_t_defined +#endif +#if defined __USE_LARGEFILE64 && !defined __ino64_t_defined +typedef __ino64_t ino64_t; +# define __ino64_t_defined +#endif + +#ifndef __dev_t_defined +typedef __dev_t dev_t; +# define __dev_t_defined +#endif + +#ifndef __gid_t_defined +typedef __gid_t gid_t; +# define __gid_t_defined +#endif + +#ifndef __mode_t_defined +typedef __mode_t mode_t; +# define __mode_t_defined +#endif + +#ifndef __nlink_t_defined +typedef __nlink_t nlink_t; +# define __nlink_t_defined +#endif + +#ifndef __uid_t_defined +typedef __uid_t uid_t; +# define __uid_t_defined +#endif + +#ifndef __off_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __off_t off_t; +# else +typedef __off64_t off_t; +# endif +# define __off_t_defined +#endif +#if defined __USE_LARGEFILE64 && !defined __off64_t_defined +typedef __off64_t off64_t; +# define __off64_t_defined +#endif + +#ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +#endif + +#if (defined __USE_SVID || defined __USE_XOPEN) && !defined __id_t_defined +typedef __id_t id_t; +# define __id_t_defined +#endif + +#ifndef __ssize_t_defined +typedef __ssize_t ssize_t; +# define __ssize_t_defined +#endif + +#ifdef __USE_BSD +# ifndef __daddr_t_defined +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; +# define __daddr_t_defined +# endif +#endif + +#if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined +typedef __key_t key_t; +# define __key_t_defined +#endif + +#ifdef __USE_XOPEN +# define __need_clock_t +#endif +#define __need_time_t +#define __need_timer_t +#define __need_clockid_t +#include + +#ifdef __USE_XOPEN +# ifndef __useconds_t_defined +typedef __useconds_t useconds_t; +# define __useconds_t_defined +# endif +# ifndef __suseconds_t_defined +typedef __suseconds_t suseconds_t; +# define __suseconds_t_defined +# endif +#endif + +#define __need_size_t +#include + +#ifdef __USE_MISC +/* Old compatibility names for C types. */ +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +#endif + +/* These size-specific names are used by some of the inet code. */ + +#if !__GNUC_PREREQ (2, 7) + +/* These types are defined by the ISO C99 header . */ +# ifndef __int8_t_defined +# define __int8_t_defined +typedef char int8_t; +typedef short int int16_t; +typedef int int32_t; +# if __WORDSIZE == 64 +typedef long int int64_t; +# elif defined __GNUC__ || defined __ICC +__extension__ typedef long long int int64_t; +# endif +# endif + +/* But these were defined by ISO C without the first `_'. */ +typedef unsigned char u_int8_t; +typedef unsigned short int u_int16_t; +typedef unsigned int u_int32_t; +# if __WORDSIZE == 64 +typedef unsigned long int u_int64_t; +# elif defined __GNUC__ || defined __ICC +__extension__ typedef unsigned long long int u_int64_t; +# endif + +typedef int register_t; + +#else + +/* For GCC 2.7 and later, we can use specific type-size attributes. */ +# define __intN_t(N, MODE) \ + typedef int int##N##_t __attribute__ ((__mode__ (MODE))) +# define __u_intN_t(N, MODE) \ + typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE))) + +# ifndef __int8_t_defined +# define __int8_t_defined +__intN_t (8, __QI__); +__intN_t (16, __HI__); +__intN_t (32, __SI__); +__intN_t (64, __DI__); +# endif + +__u_intN_t (8, __QI__); +__u_intN_t (16, __HI__); +__u_intN_t (32, __SI__); +__u_intN_t (64, __DI__); + +typedef int register_t __attribute__ ((__mode__ (__word__))); + + +/* Some code from BIND tests this macro to see if the types above are + defined. */ +#endif +#define __BIT_TYPES_DEFINED__ 1 + + +#ifdef __USE_BSD +/* In BSD is expected to define BYTE_ORDER. */ +# include + +/* It also defines `fd_set' and the FD_* macros for `select'. */ +# include + +/* BSD defines these symbols, so we follow. */ +# include +#endif /* Use BSD. */ + + +#if defined __USE_UNIX98 && !defined __blksize_t_defined +typedef __blksize_t blksize_t; +# define __blksize_t_defined +#endif + +/* Types from the Large File Support interface. */ +#ifndef __USE_FILE_OFFSET64 +# ifndef __blkcnt_t_defined +typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ +# define __blkcnt_t_defined +# endif +# ifndef __fsblkcnt_t_defined +typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ +# define __fsblkcnt_t_defined +# endif +# ifndef __fsfilcnt_t_defined +typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ +# define __fsfilcnt_t_defined +# endif +#else +# ifndef __blkcnt_t_defined +typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ +# define __blkcnt_t_defined +# endif +# ifndef __fsblkcnt_t_defined +typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ +# define __fsblkcnt_t_defined +# endif +# ifndef __fsfilcnt_t_defined +typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ +# define __fsfilcnt_t_defined +# endif +#endif + +#ifdef __USE_LARGEFILE64 +typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */ +typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */ +typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */ +#endif + + +/* Now add the thread types. */ +#if (defined __USE_POSIX199506 || defined __USE_UNIX98) && defined __UCLIBC_HAS_THREADS__ +# include +#endif + +__END_DECLS + +#endif /* sys/types.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ucontext.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ucontext.h new file mode 100644 index 0000000..ac496f3 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ucontext.h @@ -0,0 +1,117 @@ +/* Copyright (C) 1997, 1998, 2000, 2003, 2004, 2006 Free Software + Foundation, Inc. This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Don't rely on this, the interface is currently messed up and may need to + be broken to be fixed. */ +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include +#include +#include + +/* We need the signal context definitions even if they are not used + included in . */ +#include + +/* Type for general register. Even in o32 we assume 64-bit registers, + like the kernel. */ +__extension__ typedef unsigned long long int greg_t; + +/* Number of general registers. */ +#define NGREG 32 +#define NFPREG 32 + +/* Container for all general registers. */ +typedef greg_t gregset_t[NGREG]; + +/* Container for all FPU registers. */ +typedef struct fpregset { + union { + double fp_dregs[NFPREG]; + struct { + float _fp_fregs; + unsigned int _fp_pad; + } fp_fregs[NFPREG]; + } fp_r; +} fpregset_t; + + +/* Context to describe whole processor state. */ +#if _MIPS_SIM == _ABIO32 +/* Earlier versions of glibc for mips had an entirely different + definition of mcontext_t, that didn't even resemble the + corresponding kernel data structure. Since all legitimate uses of + ucontext_t in glibc mustn't have accessed anything beyond + uc_mcontext and, even then, taking a pointer to it, casting it to + sigcontext_t, and accessing it as such, which is what it has always + been, this can still be rectified. Fortunately, makecontext, + [gs]etcontext et all have never been implemented. */ +typedef struct + { + unsigned int regmask; + unsigned int status; + greg_t pc; + gregset_t gregs; + fpregset_t fpregs; + unsigned int fp_owned; + unsigned int fpc_csr; + unsigned int fpc_eir; + unsigned int used_math; + unsigned int dsp; + greg_t mdhi; + greg_t mdlo; + unsigned long hi1; + unsigned long lo1; + unsigned long hi2; + unsigned long lo2; + unsigned long hi3; + unsigned long lo3; + } mcontext_t; +#else +typedef struct + { + gregset_t gregs; + fpregset_t fpregs; + greg_t mdhi; + greg_t hi1; + greg_t hi2; + greg_t hi3; + greg_t mdlo; + greg_t lo1; + greg_t lo2; + greg_t lo3; + greg_t pc; + unsigned int fpc_csr; + unsigned int used_math; + unsigned int dsp; + unsigned int reserved; + } mcontext_t; +#endif + +/* Userlevel context. */ +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + } ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/uio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/uio.h new file mode 100644 index 0000000..1b203f7 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/uio.h @@ -0,0 +1,54 @@ +/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UIO_H +#define _SYS_UIO_H 1 + +#include + +#include + +__BEGIN_DECLS + +/* This file defines `struct iovec'. */ +#include + + +/* Read data from file descriptor FD, and put the result in the + buffers described by IOVEC, which is a vector of COUNT `struct iovec's. + The buffers are filled in the order specified. + Operates just like `read' (see ) except that data are + put in IOVEC instead of a contiguous buffer. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t readv (int __fd, __const struct iovec *__iovec, int __count); + +/* Write data pointed by the buffers described by IOVEC, which + is a vector of COUNT `struct iovec's, to file descriptor FD. + The data is written in the order specified. + Operates just like `write' (see ) except that the data + are taken from IOVEC instead of a contiguous buffer. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t writev (int __fd, __const struct iovec *__iovec, int __count); + +__END_DECLS + +#endif /* sys/uio.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/un.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/un.h new file mode 100644 index 0000000..1fa10e4 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/un.h @@ -0,0 +1,47 @@ +/* Copyright (C) 1991, 1995, 1996, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UN_H +#define _SYS_UN_H 1 + +#include + +/* Get the definition of the macro to define the common sockaddr members. */ +#include + +__BEGIN_DECLS + +/* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */ +struct sockaddr_un + { + __SOCKADDR_COMMON (sun_); + char sun_path[108]; /* Path name. */ + }; + + +#ifdef __USE_MISC +# include /* For prototype of `strlen'. */ + +/* Evaluate to actual length of the `sockaddr_un' structure. */ +# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ + + strlen ((ptr)->sun_path)) +#endif + +__END_DECLS + +#endif /* sys/un.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/unistd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/unistd.h new file mode 100644 index 0000000..1e823fb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/unistd.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/user.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/user.h new file mode 100644 index 0000000..5d88094 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/user.h @@ -0,0 +1,217 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + +#include + +/* The whole purpose of this file is for GDB and GDB only. Don't read + too much into it. Don't use it for anything other than GDB unless + you know what you are doing. */ + +/* #include */ +/* Instead of including the kernel header, that will vary depending on + whether the 32- or the 64-bit kernel is installed, we paste its + contents here. Note that the fact that the file is inline here, + instead of included separately, doesn't change in any way the + licensing status of a program that includes user.h. Since this is + for gdb alone, and gdb is GPLed, no surprises here. */ +#if _MIPS_SIM == _ABIO32 +/* + * Various register offset definitions for debuggers, core file + * examiners and whatnot. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1999 by Ralf Baechle + */ +#ifndef __ASM_MIPS_REG_H +#define __ASM_MIPS_REG_H + +/* + * This defines/structures correspond to the register layout on stack - + * if the order here is changed, it needs to be updated in + * include/asm-mips/stackframe.h + */ +#define EF_REG0 6 +#define EF_REG1 7 +#define EF_REG2 8 +#define EF_REG3 9 +#define EF_REG4 10 +#define EF_REG5 11 +#define EF_REG6 12 +#define EF_REG7 13 +#define EF_REG8 14 +#define EF_REG9 15 +#define EF_REG10 16 +#define EF_REG11 17 +#define EF_REG12 18 +#define EF_REG13 19 +#define EF_REG14 20 +#define EF_REG15 21 +#define EF_REG16 22 +#define EF_REG17 23 +#define EF_REG18 24 +#define EF_REG19 25 +#define EF_REG20 26 +#define EF_REG21 27 +#define EF_REG22 28 +#define EF_REG23 29 +#define EF_REG24 30 +#define EF_REG25 31 +/* + * k0/k1 unsaved + */ +#define EF_REG28 34 +#define EF_REG29 35 +#define EF_REG30 36 +#define EF_REG31 37 + +/* + * Saved special registers + */ +#define EF_LO 38 +#define EF_HI 39 + +#define EF_CP0_EPC 40 +#define EF_CP0_BADVADDR 41 +#define EF_CP0_STATUS 42 +#define EF_CP0_CAUSE 43 + +#define EF_SIZE 180 /* size in bytes */ + +#endif /* __ASM_MIPS_REG_H */ + +#else /* _MIPS_SIM != _ABIO32 */ + +/* + * Various register offset definitions for debuggers, core file + * examiners and whatnot. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1999 Ralf Baechle + * Copyright (C) 1995, 1999 Silicon Graphics + */ +#ifndef _ASM_REG_H +#define _ASM_REG_H + +/* + * This defines/structures correspond to the register layout on stack - + * if the order here is changed, it needs to be updated in + * include/asm-mips/stackframe.h + */ +#define EF_REG0 0 +#define EF_REG1 1 +#define EF_REG2 2 +#define EF_REG3 3 +#define EF_REG4 4 +#define EF_REG5 5 +#define EF_REG6 6 +#define EF_REG7 7 +#define EF_REG8 8 +#define EF_REG9 9 +#define EF_REG10 10 +#define EF_REG11 11 +#define EF_REG12 12 +#define EF_REG13 13 +#define EF_REG14 14 +#define EF_REG15 15 +#define EF_REG16 16 +#define EF_REG17 17 +#define EF_REG18 18 +#define EF_REG19 19 +#define EF_REG20 20 +#define EF_REG21 21 +#define EF_REG22 22 +#define EF_REG23 23 +#define EF_REG24 24 +#define EF_REG25 25 +/* + * k0/k1 unsaved + */ +#define EF_REG28 28 +#define EF_REG29 29 +#define EF_REG30 30 +#define EF_REG31 31 + +/* + * Saved special registers + */ +#define EF_LO 32 +#define EF_HI 33 + +#define EF_CP0_EPC 34 +#define EF_CP0_BADVADDR 35 +#define EF_CP0_STATUS 36 +#define EF_CP0_CAUSE 37 + +#define EF_SIZE 304 /* size in bytes */ + +#endif /* _ASM_REG_H */ + +#endif /* _MIPS_SIM != _ABIO32 */ + +#if _MIPS_SIM == _ABIO32 + +struct user +{ + unsigned long regs[EF_SIZE/4+64]; /* integer and fp regs */ + size_t u_tsize; /* text size (pages) */ + size_t u_dsize; /* data size (pages) */ + size_t u_ssize; /* stack size (pages) */ + unsigned long start_code; /* text starting address */ + unsigned long start_data; /* data starting address */ + unsigned long start_stack; /* stack starting address */ + long int signal; /* signal causing core dump */ + void* u_ar0; /* help gdb find registers */ + unsigned long magic; /* identifies a core file */ + char u_comm[32]; /* user command name */ +}; + +#else + +struct user { + __extension__ unsigned long regs[EF_SIZE/8+64]; /* integer and fp regs */ + __extension__ unsigned long u_tsize; /* text size (pages) */ + __extension__ unsigned long u_dsize; /* data size (pages) */ + __extension__ unsigned long u_ssize; /* stack size (pages) */ + __extension__ unsigned long long start_code; /* text starting address */ + __extension__ unsigned long long start_data; /* data starting address */ + __extension__ unsigned long long start_stack; /* stack starting address */ + __extension__ long long signal; /* signal causing core dump */ + __extension__ unsigned long long u_ar0; /* help gdb find registers */ + __extension__ unsigned long long magic; /* identifies a core file */ + char u_comm[32]; /* user command name */ +}; + +#endif + +#include +#define NBPG PAGE_SIZE +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_DATA_START_ADDR (u.start_data) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +#endif /* _SYS_USER_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ustat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ustat.h new file mode 100644 index 0000000..7a9cdac --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/ustat.h @@ -0,0 +1,38 @@ +/* Header describing obsolete `ustat' interface. + Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * This interface is obsolete. Use instead. + */ + +#ifndef _SYS_USTAT_H +#define _SYS_USTAT_H 1 + +#include + +#include +#include + +__BEGIN_DECLS + +extern int ustat (__dev_t __dev, struct ustat *__ubuf) __THROW; + +__END_DECLS + +#endif /* sys/ustat.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/utsname.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/utsname.h new file mode 100644 index 0000000..ca195cb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/utsname.h @@ -0,0 +1,74 @@ +/* Copyright (C) 1991, 92, 94, 96, 97, 99 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 4.4 System Identification + */ + +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H 1 + +#include + +__BEGIN_DECLS + +#include + +#ifndef _UTSNAME_NODENAME_LENGTH +# define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH +#endif + +/* Structure describing the system and machine. */ +struct utsname + { + /* Name of the implementation of the operating system. */ + char sysname[_UTSNAME_LENGTH]; + + /* Name of this node on the network. */ + char nodename[_UTSNAME_NODENAME_LENGTH]; + + /* Current release level of this implementation. */ + char release[_UTSNAME_LENGTH]; + /* Current version level of this release. */ + char version[_UTSNAME_LENGTH]; + + /* Name of the hardware type the system is running on. */ + char machine[_UTSNAME_LENGTH]; + +#if _UTSNAME_DOMAIN_LENGTH - 0 + /* Name of the domain of this node on the network. */ +# ifdef __USE_GNU + char domainname[_UTSNAME_DOMAIN_LENGTH]; +# else + char __domainname[_UTSNAME_DOMAIN_LENGTH]; +# endif +#endif + }; + +#ifdef __USE_SVID +# define SYS_NMLN _UTSNAME_LENGTH +#endif + + +/* Put information about the system in NAME. */ +extern int uname (struct utsname *__name) __THROW; + + +__END_DECLS + +#endif /* sys/utsname.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vfs.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vfs.h new file mode 100644 index 0000000..fa22d31 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vfs.h @@ -0,0 +1,4 @@ +/* Other systems declare `struct statfs' et al in , + so we have this file to be compatible with programs expecting it. */ + +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vt.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vt.h new file mode 100644 index 0000000..834abfb --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/vt.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/wait.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/wait.h new file mode 100644 index 0000000..81a54fc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/wait.h @@ -0,0 +1,186 @@ +/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 3.2.1 Wait for Process Termination + */ + +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H 1 + +#include + +__BEGIN_DECLS + +#include +#include + +/* These macros could also be defined in . */ +#if !defined _STDLIB_H || !defined __USE_XOPEN +/* This will define the `W*' macros for the flag + bits to `waitpid', `wait3', and `wait4'. */ +# include + +# ifdef __USE_BSD + +/* Lots of hair to allow traditional BSD use of `union wait' + as well as POSIX.1 use of `int' for the status word. */ + +# if defined __GNUC__ && !defined __cplusplus +# define __WAIT_INT(status) \ + (__extension__ (((union { __typeof(status) __in; int __i; }) \ + { .__in = (status) }).__i)) +# else +# define __WAIT_INT(status) (*(__const int *) &(status)) +# endif + +/* This is the type of the argument to `wait'. The funky union + causes redeclarations with ether `int *' or `union wait *' to be + allowed without complaint. __WAIT_STATUS_DEFN is the type used in + the actual function definitions. */ + +# if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus +# define __WAIT_STATUS void * +# define __WAIT_STATUS_DEFN void * +# else +/* This works in GCC 2.6.1 and later. */ +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# define __WAIT_STATUS_DEFN int * +# endif + +# else /* Don't use BSD. */ + +# define __WAIT_INT(status) (status) +# define __WAIT_STATUS int * +# define __WAIT_STATUS_DEFN int * + +# endif /* Use BSD. */ + +/* This will define all the `__W*' macros. */ +# include + +# define WEXITSTATUS(status) __WEXITSTATUS(__WAIT_INT(status)) +# define WTERMSIG(status) __WTERMSIG(__WAIT_INT(status)) +# define WSTOPSIG(status) __WSTOPSIG(__WAIT_INT(status)) +# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status)) +# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status)) +# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status)) +# if 0 /*def __WIFCONTINUED*/ +# define WIFCONTINUED(status) __WIFCONTINUED(__WAIT_INT(status)) +# endif +#endif /* not included. */ + +#ifdef __USE_BSD +# define WCOREFLAG __WCOREFLAG +# define WCOREDUMP(status) __WCOREDUMP(__WAIT_INT(status)) +# define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig) +# define W_STOPCODE(sig) __W_STOPCODE(sig) +#endif + +/* The following values are used by the `waitid' function. */ +#if defined __USE_SVID || defined __USE_XOPEN +typedef enum +{ + P_ALL, /* Wait for any child. */ + P_PID, /* Wait for specified process. */ + P_PGID /* Wait for members of process group. */ +} idtype_t; +#endif + + +/* Wait for a child to die. When one does, put its status in *STAT_LOC + and return its process ID. For errors, return (pid_t) -1. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern __pid_t wait (__WAIT_STATUS __stat_loc); + +#ifdef __USE_BSD +/* Special values for the PID argument to `waitpid' and `wait4'. */ +# define WAIT_ANY (-1) /* Any process. */ +# define WAIT_MYPGRP 0 /* Any process in my process group. */ +#endif + +/* Wait for a child matching PID to die. + If PID is greater than 0, match any process whose process ID is PID. + If PID is (pid_t) -1, match any process. + If PID is (pid_t) 0, match any process with the + same process group as the current process. + If PID is less than -1, match any process whose + process group is the absolute value of PID. + If the WNOHANG bit is set in OPTIONS, and that child + is not already dead, return (pid_t) 0. If successful, + return PID and store the dead child's status in STAT_LOC. + Return (pid_t) -1 for errors. If the WUNTRACED bit is + set in OPTIONS, return status for stopped children; otherwise don't. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); + +#if defined __USE_SVID || defined __USE_XOPEN +# define __need_siginfo_t +# include +/* Wait for a childing matching IDTYPE and ID to change the status and + place appropriate information in *INFOP. + If IDTYPE is P_PID, match any process whose process ID is ID. + If IDTYPE is P_PGID, match any process whose process group is ID. + If IDTYPE is P_ALL, match any process. + If the WNOHANG bit is set in OPTIONS, and that child + is not already dead, clear *INFOP and return 0. If successful, store + exit code and status in *INFOP. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop, + int __options); +#endif + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* This being here makes the prototypes valid whether or not + we have already included to define `struct rusage'. */ +struct rusage; + +/* Wait for a child to exit. When one does, put its status in *STAT_LOC and + return its process ID. For errors return (pid_t) -1. If USAGE is not + nil, store information about the child's resource usage there. If the + WUNTRACED bit is set in OPTIONS, return status for stopped children; + otherwise don't. */ +extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options, + struct rusage * __usage) __THROW; +#endif + +#ifdef __USE_BSD +/* This being here makes the prototypes valid whether or not + we have already included to define `struct rusage'. */ +struct rusage; + +/* PID is like waitpid. Other args are like wait3. */ +extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, + struct rusage *__usage) __THROW; +#endif /* Use BSD. */ + + +__END_DECLS + +#endif /* sys/wait.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/xattr.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/xattr.h new file mode 100644 index 0000000..2737f90 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sys/xattr.h @@ -0,0 +1,104 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_XATTR_H +#define _SYS_XATTR_H 1 + +#include +#include + + +__BEGIN_DECLS + +/* The following constants should be used for the fifth parameter of + `*setxattr'. */ +enum +{ + XATTR_CREATE = 1, /* set value, fail if attr already exists. */ +#define XATTR_CREATE XATTR_CREATE + XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */ +#define XATTR_REPLACE XATTR_REPLACE +}; + +/* Set the attribute NAME of the file pointed to by PATH to VALUE (which + is SIZE bytes long). Return 0 on success, -1 for errors. */ +extern int setxattr (__const char *__path, __const char *__name, + __const void *__value, size_t __size, int __flags) + __THROW; + +/* Set the attribute NAME of the file pointed to by PATH to VALUE (which is + SIZE bytes long), not following symlinks for the last pathname component. + Return 0 on success, -1 for errors. */ +extern int lsetxattr (__const char *__path, __const char *__name, + __const void *__value, size_t __size, int __flags) + __THROW; + +/* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE + bytes long). Return 0 on success, -1 for errors. */ +extern int fsetxattr (int __fd, __const char *__name, __const void *__value, + size_t __size, int __flags) __THROW; + +/* Get the attribute NAME of the file pointed to by PATH to VALUE (which is + SIZE bytes long). Return 0 on success, -1 for errors. */ +extern ssize_t getxattr (__const char *__path, __const char *__name, + void *__value, size_t __size) __THROW; + +/* Get the attribute NAME of the file pointed to by PATH to VALUE (which is + SIZE bytes long), not following symlinks for the last pathname component. + Return 0 on success, -1 for errors. */ +extern ssize_t lgetxattr (__const char *__path, __const char *__name, + void *__value, size_t __size) __THROW; + +/* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE + bytes long). Return 0 on success, -1 for errors. */ +extern ssize_t fgetxattr (int __fd, __const char *__name, void *__value, + size_t __size) __THROW; + +/* List attributes of the file pointed to by PATH into the user-supplied + buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for + errors. */ +extern ssize_t listxattr (__const char *__path, char *__list, size_t __size) + __THROW; + +/* List attributes of the file pointed to by PATH into the user-supplied + buffer LIST (which is SIZE bytes big), not following symlinks for the + last pathname component. Return 0 on success, -1 for errors. */ +extern ssize_t llistxattr (__const char *__path, char *__list, size_t __size) + __THROW; + +/* List attributes of the file descriptor FD into the user-supplied buffer + LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */ +extern ssize_t flistxattr (int __fd, char *__list, size_t __size) + __THROW; + +/* Remove the attribute NAME from the file pointed to by PATH. Return 0 + on success, -1 for errors. */ +extern int removexattr (__const char *__path, __const char *__name) __THROW; + +/* Remove the attribute NAME from the file pointed to by PATH, not + following symlinks for the last pathname component. Return 0 on + success, -1 for errors. */ +extern int lremovexattr (__const char *__path, __const char *__name) __THROW; + +/* Remove the attribute NAME from the file descriptor FD. Return 0 on + success, -1 for errors. */ +extern int fremovexattr (int __fd, __const char *__name) __THROW; + +__END_DECLS + +#endif /* sys/xattr.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/syscall.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/syscall.h new file mode 100644 index 0000000..4c30578 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/syscall.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/sysexits.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sysexits.h new file mode 100644 index 0000000..37246b6 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/sysexits.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sysexits.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _SYSEXITS_H +#define _SYSEXITS_H 1 + +/* + * SYSEXITS.H -- Exit status codes for system programs. + * + * This include file attempts to categorize possible error + * exit statuses for system programs, notably delivermail + * and the Berkeley network. + * + * Error numbers begin at EX__BASE to reduce the possibility of + * clashing with other exit statuses that random programs may + * already return. The meaning of the codes is approximately + * as follows: + * + * EX_USAGE -- The command was used incorrectly, e.g., with + * the wrong number of arguments, a bad flag, a bad + * syntax in a parameter, or whatever. + * EX_DATAERR -- The input data was incorrect in some way. + * This should only be used for user's data & not + * system files. + * EX_NOINPUT -- An input file (not a system file) did not + * exist or was not readable. This could also include + * errors like "No message" to a mailer (if it cared + * to catch it). + * EX_NOUSER -- The user specified did not exist. This might + * be used for mail addresses or remote logins. + * EX_NOHOST -- The host specified did not exist. This is used + * in mail addresses or network requests. + * EX_UNAVAILABLE -- A service is unavailable. This can occur + * if a support program or file does not exist. This + * can also be used as a catchall message when something + * you wanted to do doesn't work, but you don't know + * why. + * EX_SOFTWARE -- An internal software error has been detected. + * This should be limited to non-operating system related + * errors as possible. + * EX_OSERR -- An operating system error has been detected. + * This is intended to be used for such things as "cannot + * fork", "cannot create pipe", or the like. It includes + * things like getuid returning a user that does not + * exist in the passwd file. + * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, + * etc.) does not exist, cannot be opened, or has some + * sort of error (e.g., syntax error). + * EX_CANTCREAT -- A (user specified) output file cannot be + * created. + * EX_IOERR -- An error occurred while doing I/O on some file. + * EX_TEMPFAIL -- temporary failure, indicating something that + * is not really an error. In sendmail, this means + * that a mailer (e.g.) could not create a connection, + * and the request should be reattempted later. + * EX_PROTOCOL -- the remote system returned something that + * was "not possible" during a protocol exchange. + * EX_NOPERM -- You did not have sufficient permission to + * perform the operation. This is not intended for + * file system problems, which should use NOINPUT or + * CANTCREAT, but rather for higher level permissions. + */ + +#define EX_OK 0 /* successful termination */ + +#define EX__BASE 64 /* base value for error messages */ + +#define EX_USAGE 64 /* command line usage error */ +#define EX_DATAERR 65 /* data format error */ +#define EX_NOINPUT 66 /* cannot open input */ +#define EX_NOUSER 67 /* addressee unknown */ +#define EX_NOHOST 68 /* host name unknown */ +#define EX_UNAVAILABLE 69 /* service unavailable */ +#define EX_SOFTWARE 70 /* internal software error */ +#define EX_OSERR 71 /* system error (e.g., can't fork) */ +#define EX_OSFILE 72 /* critical OS file missing */ +#define EX_CANTCREAT 73 /* can't create (user) output file */ +#define EX_IOERR 74 /* input/output error */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ +#define EX_PROTOCOL 76 /* remote error in protocol */ +#define EX_NOPERM 77 /* permission denied */ +#define EX_CONFIG 78 /* configuration error */ + +#define EX__MAX 78 /* maximum listed value */ + +#endif /* sysexits.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/syslog.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/syslog.h new file mode 100644 index 0000000..830b492 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/syslog.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/tar.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/tar.h new file mode 100644 index 0000000..ddfef75 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/tar.h @@ -0,0 +1,108 @@ +/* Extended tar format from POSIX.1. + Copyright (C) 1992, 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by David J. MacKenzie. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _TAR_H +#define _TAR_H 1 + +/* A tar archive consists of 512-byte blocks. + Each file in the archive has a header block followed by 0+ data blocks. + Two blocks of NUL bytes indicate the end of the archive. */ + +/* The fields of header blocks: + All strings are stored as ISO 646 (approximately ASCII) strings. + + Fields are numeric unless otherwise noted below; numbers are ISO 646 + representations of octal numbers, with leading zeros as needed. + + linkname is only valid when typeflag==LNKTYPE. It doesn't use prefix; + files that are links to pathnames >100 chars long can not be stored + in a tar archive. + + If typeflag=={LNKTYPE,SYMTYPE,DIRTYPE} then size must be 0. + + devmajor and devminor are only valid for typeflag=={BLKTYPE,CHRTYPE}. + + chksum contains the sum of all 512 bytes in the header block, + treating each byte as an 8-bit unsigned value and treating the + 8 bytes of chksum as blank characters. + + uname and gname are used in preference to uid and gid, if those + names exist locally. + + Field Name Byte Offset Length in Bytes Field Type + name 0 100 NUL-terminated if NUL fits + mode 100 8 + uid 108 8 + gid 116 8 + size 124 12 + mtime 136 12 + chksum 148 8 + typeflag 156 1 see below + linkname 157 100 NUL-terminated if NUL fits + magic 257 6 must be TMAGIC (NUL term.) + version 263 2 must be TVERSION + uname 265 32 NUL-terminated + gname 297 32 NUL-terminated + devmajor 329 8 + devminor 337 8 + prefix 345 155 NUL-terminated if NUL fits + + If the first character of prefix is '\0', the file name is name; + otherwise, it is prefix/name. Files whose pathnames don't fit in that + length can not be stored in a tar archive. */ + +/* The bits in mode: */ +#define TSUID 04000 +#define TSGID 02000 +#define TSVTX 01000 +#define TUREAD 00400 +#define TUWRITE 00200 +#define TUEXEC 00100 +#define TGREAD 00040 +#define TGWRITE 00020 +#define TGEXEC 00010 +#define TOREAD 00004 +#define TOWRITE 00002 +#define TOEXEC 00001 + +/* The values for typeflag: + Values 'A'-'Z' are reserved for custom implementations. + All other values are reserved for future POSIX.1 revisions. */ + +#define REGTYPE '0' /* Regular file (preferred code). */ +#define AREGTYPE '\0' /* Regular file (alternate code). */ +#define LNKTYPE '1' /* Hard link. */ +#define SYMTYPE '2' /* Symbolic link (hard if not supported). */ +#define CHRTYPE '3' /* Character special. */ +#define BLKTYPE '4' /* Block special. */ +#define DIRTYPE '5' /* Directory. */ +#define FIFOTYPE '6' /* Named pipe. */ +#define CONTTYPE '7' /* Contiguous file */ + /* (regular file if not supported). */ + +/* Contents of magic field and its length. */ +#define TMAGIC "ustar" +#define TMAGLEN 6 + +/* Contents of the version field and its length. */ +#define TVERSION "00" +#define TVERSLEN 2 + +#endif /* tar.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/termio.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/termio.h new file mode 100644 index 0000000..0e610f0 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/termio.h @@ -0,0 +1,6 @@ +/* Compatible for old `struct termio' ioctl interface. + This is obsolete; use the POSIX.1 `struct termios' interface + defined in instead. */ + +#include +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/termios.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/termios.h new file mode 100644 index 0000000..9698b1f --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/termios.h @@ -0,0 +1,110 @@ +/* Copyright (C) 1991,92,93,94,96,97,98,99, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 7.1-2 General Terminal Interface + */ + +#ifndef _TERMIOS_H +#define _TERMIOS_H 1 + +#include +#ifdef __USE_UNIX98 +/* We need `pid_t'. */ +# include +# ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +# endif +#endif + +__BEGIN_DECLS + +/* Get the system-dependent definitions of `struct termios', `tcflag_t', + `cc_t', `speed_t', and all the macros specifying the flag bits. */ +#include + +#ifdef __USE_BSD +/* Compare a character C to a value VAL from the `c_cc' array in a + `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */ +# define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) +#endif + +/* Return the output baud rate stored in *TERMIOS_P. */ +extern speed_t cfgetospeed (__const struct termios *__termios_p) __THROW; + +/* Return the input baud rate stored in *TERMIOS_P. */ +extern speed_t cfgetispeed (__const struct termios *__termios_p) __THROW; + +/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ +extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW; + +/* Set the input baud rate stored in *TERMIOS_P to SPEED. */ +extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW; + +#ifdef __USE_BSD +/* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */ +extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; +#endif + + +/* Put the state of FD into *TERMIOS_P. */ +extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW; + +/* Set the state of FD to *TERMIOS_P. + Values for OPTIONAL_ACTIONS (TCSA*) are in . */ +extern int tcsetattr (int __fd, int __optional_actions, + __const struct termios *__termios_p) __THROW; + + +#ifdef __USE_BSD +/* Set *TERMIOS_P to indicate raw mode. */ +extern void cfmakeraw (struct termios *__termios_p) __THROW; +#endif + +/* Send zero bits on FD. */ +extern int tcsendbreak (int __fd, int __duration) __THROW; + +/* Wait for pending output to be written on FD. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int tcdrain (int __fd); + +/* Flush pending data on FD. + Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . */ +extern int tcflush (int __fd, int __queue_selector) __THROW; + +/* Suspend or restart transmission on FD. + Values for ACTION (TC[IO]{OFF,ON}) are in . */ +extern int tcflow (int __fd, int __action) __THROW; + + +#ifdef __USE_UNIX98 +/* Get process group ID for session leader for controlling terminal FD. */ +extern __pid_t tcgetsid (int __fd) __THROW; +#endif + + +#ifdef __USE_BSD +# include +#endif + +__END_DECLS + +#endif /* termios.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/tgmath.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/tgmath.h new file mode 100644 index 0000000..b146121 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/tgmath.h @@ -0,0 +1,430 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.22 Type-generic math + */ + +#ifndef _TGMATH_H +#define _TGMATH_H 1 + +/* Include the needed headers. */ +#include +#include + + +/* Since `complex' is currently not really implemented in most C compilers + and if it is implemented, the implementations differ. This makes it + quite difficult to write a generic implementation of this header. We + do not try this for now and instead concentrate only on GNU CC. Once + we have more information support for other compilers might follow. */ + +#if __GNUC_PREREQ(2, 7) + +# ifdef __NO_LONG_DOUBLE_MATH +# define __tgml(fct) fct +# else +# define __tgml(fct) fct ## l +# endif + +/* This is ugly but unless gcc gets appropriate builtins we have to do + something like this. Don't ask how it works. */ + +/* 1 if 'type' is a floating type, 0 if 'type' is an integer type. + Allows for _Bool. Expands to an integer constant expression. */ +# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1)) + +/* The tgmath real type for T, where E is 0 if T is an integer type and + 1 for a floating type. */ +# define __tgmath_real_type_sub(T, E) \ + __typeof__(*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0 \ + : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0)) + +/* The tgmath real type of EXPR. */ +# define __tgmath_real_type(expr) \ + __tgmath_real_type_sub(__typeof__(expr), __floating_type(__typeof__(expr))) + + +/* We have two kinds of generic macros: to support functions which are + only defined on real valued parameters and those which are defined + for complex functions as well. */ +# define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \ + (__extension__ ({ __tgmath_real_type (Val) __tgmres; \ + if (sizeof (Val) == sizeof (double) \ + || __builtin_classify_type (Val) != 8) \ + __tgmres = Fct (Val); \ + else if (sizeof (Val) == sizeof (float)) \ + __tgmres = Fct##f (Val); \ + else \ + __tgmres = __tgml(Fct) (Val); \ + __tgmres; })) + +# define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \ + (__extension__ ({ __tgmath_real_type (Val1) __tgmres; \ + if (sizeof (Val1) == sizeof (double) \ + || __builtin_classify_type (Val1) != 8) \ + __tgmres = Fct (Val1, Val2); \ + else if (sizeof (Val1) == sizeof (float)) \ + __tgmres = Fct##f (Val1, Val2); \ + else \ + __tgmres = __tgml(Fct) (Val1, Val2); \ + __tgmres; })) + +# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \ + (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \ + if ((sizeof (Val1) > sizeof (double) \ + || sizeof (Val2) > sizeof (double)) \ + && __builtin_classify_type ((Val1) + (Val2)) == 8) \ + __tgmres = __tgml(Fct) (Val1, Val2); \ + else if (sizeof (Val1) == sizeof (double) \ + || sizeof (Val2) == sizeof (double) \ + || __builtin_classify_type (Val1) != 8 \ + || __builtin_classify_type (Val2) != 8) \ + __tgmres = Fct (Val1, Val2); \ + else \ + __tgmres = Fct##f (Val1, Val2); \ + __tgmres; })) + +# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \ + (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \ + if ((sizeof (Val1) > sizeof (double) \ + || sizeof (Val2) > sizeof (double)) \ + && __builtin_classify_type ((Val1) + (Val2)) == 8) \ + __tgmres = __tgml(Fct) (Val1, Val2, Val3); \ + else if (sizeof (Val1) == sizeof (double) \ + || sizeof (Val2) == sizeof (double) \ + || __builtin_classify_type (Val1) != 8 \ + || __builtin_classify_type (Val2) != 8) \ + __tgmres = Fct (Val1, Val2, Val3); \ + else \ + __tgmres = Fct##f (Val1, Val2, Val3); \ + __tgmres; })) + +# define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \ + (__extension__ ({ __tgmath_real_type ((Val1) + (Val2) + (Val3)) __tgmres;\ + if ((sizeof (Val1) > sizeof (double) \ + || sizeof (Val2) > sizeof (double) \ + || sizeof (Val3) > sizeof (double)) \ + && __builtin_classify_type ((Val1) + (Val2) \ + + (Val3)) == 8) \ + __tgmres = __tgml(Fct) (Val1, Val2, Val3); \ + else if (sizeof (Val1) == sizeof (double) \ + || sizeof (Val2) == sizeof (double) \ + || sizeof (Val3) == sizeof (double) \ + || __builtin_classify_type (Val1) != 8 \ + || __builtin_classify_type (Val2) != 8 \ + || __builtin_classify_type (Val3) != 8) \ + __tgmres = Fct (Val1, Val2, Val3); \ + else \ + __tgmres = Fct##f (Val1, Val2, Val3); \ + __tgmres; })) + +/* XXX This definition has to be changed as soon as the compiler understands + the imaginary keyword. */ +# define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \ + (__extension__ ({ __tgmath_real_type (Val) __tgmres; \ + if (sizeof (__real__ (Val)) > sizeof (double) \ + && __builtin_classify_type (__real__ (Val)) == 8) \ + { \ + if (sizeof (__real__ (Val)) == sizeof (Val)) \ + __tgmres = __tgml(Fct) (Val); \ + else \ + __tgmres = __tgml(Cfct) (Val); \ + } \ + else if (sizeof (__real__ (Val)) == sizeof (double) \ + || __builtin_classify_type (__real__ (Val)) \ + != 8) \ + { \ + if (sizeof (__real__ (Val)) == sizeof (Val)) \ + __tgmres = Fct (Val); \ + else \ + __tgmres = Cfct (Val); \ + } \ + else \ + { \ + if (sizeof (__real__ (Val)) == sizeof (Val)) \ + __tgmres = Fct##f (Val); \ + else \ + __tgmres = Cfct##f (Val); \ + } \ + __tgmres; })) + +/* XXX This definition has to be changed as soon as the compiler understands + the imaginary keyword. */ +# define __TGMATH_UNARY_IMAG_ONLY(Val, Fct) \ + (__extension__ ({ __tgmath_real_type (Val) __tgmres; \ + if (sizeof (Val) == sizeof (__complex__ double) \ + || __builtin_classify_type (__real__ (Val)) != 8) \ + __tgmres = Fct (Val); \ + else if (sizeof (Val) == sizeof (__complex__ float)) \ + __tgmres = Fct##f (Val); \ + else \ + __tgmres = __tgml(Fct) (Val); \ + __tgmres; })) + +/* XXX This definition has to be changed as soon as the compiler understands + the imaginary keyword. */ +# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \ + (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \ + if ((sizeof (__real__ (Val1)) > sizeof (double) \ + || sizeof (__real__ (Val2)) > sizeof (double)) \ + && __builtin_classify_type (__real__ (Val1) \ + + __real__ (Val2)) \ + == 8) \ + { \ + if (sizeof (__real__ (Val1)) == sizeof (Val1) \ + && sizeof (__real__ (Val2)) == sizeof (Val2)) \ + __tgmres = __tgml(Fct) (Val1, Val2); \ + else \ + __tgmres = __tgml(Cfct) (Val1, Val2); \ + } \ + else if (sizeof (__real__ (Val1)) == sizeof (double) \ + || sizeof (__real__ (Val2)) == sizeof(double) \ + || (__builtin_classify_type (__real__ (Val1)) \ + != 8) \ + || (__builtin_classify_type (__real__ (Val2)) \ + != 8)) \ + { \ + if (sizeof (__real__ (Val1)) == sizeof (Val1) \ + && sizeof (__real__ (Val2)) == sizeof (Val2)) \ + __tgmres = Fct (Val1, Val2); \ + else \ + __tgmres = Cfct (Val1, Val2); \ + } \ + else \ + { \ + if (sizeof (__real__ (Val1)) == sizeof (Val1) \ + && sizeof (__real__ (Val2)) == sizeof (Val2)) \ + __tgmres = Fct##f (Val1, Val2); \ + else \ + __tgmres = Cfct##f (Val1, Val2); \ + } \ + __tgmres; })) +#else +# error "Unsupported compiler; you cannot use " +#endif + + +/* Unary functions defined for real and complex values. */ + + +/* Trigonometric functions. */ + +/* Arc cosine of X. */ +#define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos) +/* Arc sine of X. */ +#define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin) +/* Arc tangent of X. */ +#define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan) +/* Arc tangent of Y/X. */ +#define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2) + +/* Cosine of X. */ +#define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos) +/* Sine of X. */ +#define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin) +/* Tangent of X. */ +#define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan) + + +/* Hyperbolic functions. */ + +/* Hyperbolic arc cosine of X. */ +#define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh) +/* Hyperbolic arc sine of X. */ +#define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh) +/* Hyperbolic arc tangent of X. */ +#define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh) + +/* Hyperbolic cosine of X. */ +#define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh) +/* Hyperbolic sine of X. */ +#define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh) +/* Hyperbolic tangent of X. */ +#define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh) + + +/* Exponential and logarithmic functions. */ + +/* Exponential function of X. */ +#define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp) + +/* Break VALUE into a normalized fraction and an integral power of 2. */ +#define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp) + +/* X times (two to the EXP power). */ +#define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp) + +/* Natural logarithm of X. */ +#define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog) + +/* Base-ten logarithm of X. */ +#ifdef __USE_GNU +# define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10) +#else +# define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10) +#endif + +/* Return exp(X) - 1. */ +#define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1) + +/* Return log(1 + X). */ +#define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p) + +/* Return the base 2 signed integral exponent of X. */ +#define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb) + +/* Compute base-2 exponential of X. */ +#define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2) + +/* Compute base-2 logarithm of X. */ +#define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2) + + +/* Power functions. */ + +/* Return X to the Y power. */ +#define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow) + +/* Return the square root of X. */ +#define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt) + +/* Return `sqrt(X*X + Y*Y)'. */ +#define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot) + +/* Return the cube root of X. */ +#define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt) + + +/* Nearest integer, absolute value, and remainder functions. */ + +/* Smallest integral value not less than X. */ +#define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil) + +/* Absolute value of X. */ +#define fabs(Val) __TGMATH_UNARY_REAL_IMAG (Val, fabs, cabs) + +/* Largest integer not greater than X. */ +#define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor) + +/* Floating-point modulo remainder of X/Y. */ +#define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod) + +/* Round X to integral valuein floating-point format using current + rounding direction, but do not raise inexact exception. */ +#define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint) + +/* Round X to nearest integral value, rounding halfway cases away from + zero. */ +#define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round) + +/* Round X to the integral value in floating-point format nearest but + not larger in magnitude. */ +#define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc) + +/* Compute remainder of X and Y and put in *QUO a value with sign of x/y + and magnitude congruent `mod 2^n' to the magnitude of the integral + quotient x/y, with n >= 3. */ +#define remquo(Val1, Val2, Val3) \ + __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo) + +/* Round X to nearest integral value according to current rounding + direction. */ +#define lrint(Val) __TGMATH_UNARY_REAL_ONLY (Val, lrint) +#define llrint(Val) __TGMATH_UNARY_REAL_ONLY (Val, llrint) + +/* Round X to nearest integral value, rounding halfway cases away from + zero. */ +#define lround(Val) __TGMATH_UNARY_REAL_ONLY (Val, lround) +#define llround(Val) __TGMATH_UNARY_REAL_ONLY (Val, llround) + + +/* Return X with its signed changed to Y's. */ +#define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign) + +/* Error and gamma functions. */ +#define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf) +#define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc) +#define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma) +#define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma) + + +/* Return the integer nearest X in the direction of the + prevailing rounding mode. */ +#define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint) + +/* Return X + epsilon if X < Y, X - epsilon if X > Y. */ +#define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter) +#define nexttoward(Val1, Val2) \ + __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, nexttoward) + +/* Return the remainder of integer divison X / Y with infinite precision. */ +#define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder) + +/* Return X times (2 to the Nth power). */ +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +# define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb) +#endif + +/* Return X times (2 to the Nth power). */ +#define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn) + +/* Return X times (2 to the Nth power). */ +#define scalbln(Val1, Val2) \ + __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln) + +/* Return the binary exponent of X, which must be nonzero. */ +#define ilogb(Val) __TGMATH_UNARY_REAL_ONLY (Val, ilogb) + + +/* Return positive difference between X and Y. */ +#define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim) + +/* Return maximum numeric value from X and Y. */ +#define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax) + +/* Return minimum numeric value from X and Y. */ +#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin) + + +/* Multiply-add function computed as a ternary operation. */ +#define fma(Val1, Val2, Val3) \ + __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma) + + +/* Absolute value, conjugates, and projection. */ + +/* Argument value of Z. */ +#define carg(Val) __TGMATH_UNARY_IMAG_ONLY (Val, carg) + +/* Complex conjugate of Z. */ +#define conj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, conj) + +/* Projection of Z onto the Riemann sphere. */ +#define cproj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cproj) + + +/* Decomposing complex values. */ + +/* Imaginary part of Z. */ +#define cimag(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cimag) + +/* Real part of Z. */ +#define creal(Val) __TGMATH_UNARY_IMAG_ONLY (Val, creal) + +#endif /* tgmath.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/thread_db.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/thread_db.h new file mode 100644 index 0000000..c115399 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/thread_db.h @@ -0,0 +1,459 @@ +/* thread_db.h -- interface to libthread_db.so library for debugging -lpthread + Copyright (C) 1999,2001,2002,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _THREAD_DB_H +#define _THREAD_DB_H 1 + +/* This is the debugger interface for the LinuxThreads library. It is + modelled closely after the interface with same names in Solaris with + the goal to share the same code in the debugger. */ +#include +#include +#include +#include + + +/* Error codes of the library. */ +typedef enum +{ + TD_OK, /* No error. */ + TD_ERR, /* No further specified error. */ + TD_NOTHR, /* No matching thread found. */ + TD_NOSV, /* No matching synchronization handle found. */ + TD_NOLWP, /* No matching light-weighted process found. */ + TD_BADPH, /* Invalid process handle. */ + TD_BADTH, /* Invalid thread handle. */ + TD_BADSH, /* Invalid synchronization handle. */ + TD_BADTA, /* Invalid thread agent. */ + TD_BADKEY, /* Invalid key. */ + TD_NOMSG, /* No event available. */ + TD_NOFPREGS, /* No floating-point register content available. */ + TD_NOLIBTHREAD, /* Application not linked with thread library. */ + TD_NOEVENT, /* Requested event is not supported. */ + TD_NOCAPAB, /* Capability not available. */ + TD_DBERR, /* Internal debug library error. */ + TD_NOAPLIC, /* Operation is not applicable. */ + TD_NOTSD, /* No thread-specific data available. */ + TD_MALLOC, /* Out of memory. */ + TD_PARTIALREG, /* Not entire register set was read or written. */ + TD_NOXREGS, /* X register set not available for given thread. */ + TD_TLSDEFER, /* Thread has not yet allocated TLS for given module. */ + TD_NOTALLOC = TD_TLSDEFER, + TD_VERSION, /* Version if libpthread and libthread_db do not match. */ + TD_NOTLS /* There is TLS segment in the given module. */ +} td_err_e; + + +/* Possible thread states. TD_THR_ANY_STATE is a pseudo-state used to + select threads regardless of state in td_ta_thr_iter(). */ +typedef enum +{ + TD_THR_ANY_STATE, + TD_THR_UNKNOWN, + TD_THR_STOPPED, + TD_THR_RUN, + TD_THR_ACTIVE, + TD_THR_ZOMBIE, + TD_THR_SLEEP, + TD_THR_STOPPED_ASLEEP +} td_thr_state_e; + +/* Thread type: user or system. TD_THR_ANY_TYPE is a pseudo-type used + to select threads regardless of type in td_ta_thr_iter(). */ +typedef enum +{ + TD_THR_ANY_TYPE, + TD_THR_USER, + TD_THR_SYSTEM +} td_thr_type_e; + + +/* Types of the debugging library. */ + +/* Handle for a process. This type is opaque. */ +typedef struct td_thragent td_thragent_t; + +/* The actual thread handle type. This is also opaque. */ +typedef struct td_thrhandle +{ + td_thragent_t *th_ta_p; + psaddr_t th_unique; +} td_thrhandle_t; + + +/* Forward declaration of a type defined by and for the dynamic linker. */ +struct link_map; + + +/* Flags for `td_ta_thr_iter'. */ +#define TD_THR_ANY_USER_FLAGS 0xffffffff +#define TD_THR_LOWEST_PRIORITY -20 +#define TD_SIGNO_MASK NULL + + +#define TD_EVENTSIZE 2 +#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */ +#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */ +#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */ + +/* Bitmask of enabled events. */ +typedef struct td_thr_events +{ + uint32_t event_bits[TD_EVENTSIZE]; +} td_thr_events_t; + +/* Event set manipulation macros. */ +#define __td_eventmask(n) \ + (UINT32_C (1) << (((n) - 1) & BT_UIMASK)) +#define __td_eventword(n) \ + ((UINT32_C ((n) - 1)) >> BT_UISHIFT) + +#define td_event_emptyset(setp) \ + do { \ + int __i; \ + for (__i = TD_EVENTSIZE; __i > 0; --__i) \ + (setp)->event_bits[__i - 1] = 0; \ + } while (0) + +#define td_event_fillset(setp) \ + do { \ + int __i; \ + for (__i = TD_EVENTSIZE; __i > 0; --__i) \ + (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \ + } while (0) + +#define td_event_addset(setp, n) \ + (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n)) +#define td_event_delset(setp, n) \ + (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n)) +#define td_eventismember(setp, n) \ + (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)])) +#if TD_EVENTSIZE == 2 +# define td_eventisempty(setp) \ + (!((setp)->event_bits[0]) && !((setp)->event_bits[1])) +#else +# error "td_eventisempty must be changed to match TD_EVENTSIZE" +#endif + +/* Events reportable by the thread implementation. */ +typedef enum +{ + TD_ALL_EVENTS, /* Pseudo-event number. */ + TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context. */ + TD_READY, /* Is executable now. */ + TD_SLEEP, /* Blocked in a synchronization obj. */ + TD_SWITCHTO, /* Now assigned to a process. */ + TD_SWITCHFROM, /* Not anymore assigned to a process. */ + TD_LOCK_TRY, /* Trying to get an unavailable lock. */ + TD_CATCHSIG, /* Signal posted to the thread. */ + TD_IDLE, /* Process getting idle. */ + TD_CREATE, /* New thread created. */ + TD_DEATH, /* Thread terminated. */ + TD_PREEMPT, /* Preempted. */ + TD_PRI_INHERIT, /* Inherited elevated priority. */ + TD_REAP, /* Reaped. */ + TD_CONCURRENCY, /* Number of processes changing. */ + TD_TIMEOUT, /* Conditional variable wait timed out. */ + TD_MIN_EVENT_NUM = TD_READY, + TD_MAX_EVENT_NUM = TD_TIMEOUT, + TD_EVENTS_ENABLE = 31 /* Event reporting enabled. */ +} td_event_e; + +/* Values representing the different ways events are reported. */ +typedef enum +{ + NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */ + NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically + inserted. */ + NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */ +} td_notify_e; + +/* Description how event type is reported. */ +typedef struct td_notify +{ + td_notify_e type; /* Way the event is reported. */ + union + { + psaddr_t bptaddr; /* Address of breakpoint. */ + int syscallno; /* Number of system call used. */ + } u; +} td_notify_t; + +/* Structure used to report event. */ +typedef struct td_event_msg +{ + td_event_e event; /* Event type being reported. */ + const td_thrhandle_t *th_p; /* Thread reporting the event. */ + union + { +# if 0 + td_synchandle_t *sh; /* Handle of synchronization object. */ +#endif + uintptr_t data; /* Event specific data. */ + } msg; +} td_event_msg_t; + +/* Structure containing event data available in each thread structure. */ +typedef struct +{ + td_thr_events_t eventmask; /* Mask of enabled events. */ + td_event_e eventnum; /* Number of last event. */ + void *eventdata; /* Data associated with event. */ +} td_eventbuf_t; + + +/* Gathered statistics about the process. */ +typedef struct td_ta_stats +{ + int nthreads; /* Total number of threads in use. */ + int r_concurrency; /* Concurrency level requested by user. */ + int nrunnable_num; /* Average runnable threads, numerator. */ + int nrunnable_den; /* Average runnable threads, denominator. */ + int a_concurrency_num; /* Achieved concurrency level, numerator. */ + int a_concurrency_den; /* Achieved concurrency level, denominator. */ + int nlwps_num; /* Average number of processes in use, + numerator. */ + int nlwps_den; /* Average number of processes in use, + denominator. */ + int nidle_num; /* Average number of idling processes, + numerator. */ + int nidle_den; /* Average number of idling processes, + denominator. */ +} td_ta_stats_t; + + +/* Since Sun's library is based on Solaris threads we have to define a few + types to map them to POSIX threads. */ +typedef pthread_t thread_t; +typedef pthread_key_t thread_key_t; + + +/* Callback for iteration over threads. */ +typedef int td_thr_iter_f (const td_thrhandle_t *, void *); + +/* Callback for iteration over thread local data. */ +typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *); + + + +/* Forward declaration. This has to be defined by the user. */ +struct ps_prochandle; + + +/* Information about the thread. */ +typedef struct td_thrinfo +{ + td_thragent_t *ti_ta_p; /* Process handle. */ + unsigned int ti_user_flags; /* Unused. */ + thread_t ti_tid; /* Thread ID returned by + pthread_create(). */ + char *ti_tls; /* Pointer to thread-local data. */ + psaddr_t ti_startfunc; /* Start function passed to + pthread_create(). */ + psaddr_t ti_stkbase; /* Base of thread's stack. */ + long int ti_stksize; /* Size of thread's stack. */ + psaddr_t ti_ro_area; /* Unused. */ + int ti_ro_size; /* Unused. */ + td_thr_state_e ti_state; /* Thread state. */ + unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */ + td_thr_type_e ti_type; /* Type of the thread (system vs + user thread). */ + intptr_t ti_pc; /* Unused. */ + intptr_t ti_sp; /* Unused. */ + short int ti_flags; /* Unused. */ + int ti_pri; /* Thread priority. */ + lwpid_t ti_lid; /* Unused. */ + sigset_t ti_sigmask; /* Signal mask. */ + unsigned char ti_traceme; /* Nonzero if event reporting + enabled. */ + unsigned char ti_preemptflag; /* Unused. */ + unsigned char ti_pirecflag; /* Unused. */ + sigset_t ti_pending; /* Set of pending signals. */ + td_thr_events_t ti_events; /* Set of enabled events. */ +} td_thrinfo_t; + + + +/* Prototypes for exported library functions. */ + +/* Initialize the thread debug support library. */ +extern td_err_e td_init (void); + +/* Historical relict. Should not be used anymore. */ +extern td_err_e td_log (void); + +/* Return list of symbols the library can request. */ +extern const char **td_symbol_list (void); + +/* Generate new thread debug library handle for process PS. */ +extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta); + +/* Free resources allocated for TA. */ +extern td_err_e td_ta_delete (td_thragent_t *__ta); + +/* Get number of currently running threads in process associated with TA. */ +extern td_err_e td_ta_get_nthreads (const td_thragent_t *__ta, int *__np); + +/* Return process handle passed in `td_ta_new' for process associated with + TA. */ +extern td_err_e td_ta_get_ph (const td_thragent_t *__ta, + struct ps_prochandle **__ph); + +/* Map thread library handle PT to thread debug library handle for process + associated with TA and store result in *TH. */ +extern td_err_e td_ta_map_id2thr (const td_thragent_t *__ta, pthread_t __pt, + td_thrhandle_t *__th); + +/* Map process ID LWPID to thread debug library handle for process + associated with TA and store result in *TH. */ +extern td_err_e td_ta_map_lwp2thr (const td_thragent_t *__ta, lwpid_t __lwpid, + td_thrhandle_t *__th); + + +/* Call for each thread in a process associated with TA the callback function + CALLBACK. */ +extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta, + td_thr_iter_f *__callback, void *__cbdata_p, + td_thr_state_e __state, int __ti_pri, + sigset_t *__ti_sigmask_p, + unsigned int __ti_user_flags); + +/* Call for each defined thread local data entry the callback function KI. */ +extern td_err_e td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki, + void *__p); + + +/* Get event address for EVENT. */ +extern td_err_e td_ta_event_addr (const td_thragent_t *__ta, + td_event_e __event, td_notify_t *__ptr); + +/* Enable EVENT in global mask. */ +extern td_err_e td_ta_set_event (const td_thragent_t *__ta, + td_thr_events_t *__event); + +/* Disable EVENT in global mask. */ +extern td_err_e td_ta_clear_event (const td_thragent_t *__ta, + td_thr_events_t *__event); + +/* Return information about last event. */ +extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta, + td_event_msg_t *__msg); + + +/* Set suggested concurrency level for process associated with TA. */ +extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level); + + +/* Enable collecting statistics for process associated with TA. */ +extern td_err_e td_ta_enable_stats (const td_thragent_t *__ta, int __enable); + +/* Reset statistics. */ +extern td_err_e td_ta_reset_stats (const td_thragent_t *__ta); + +/* Retrieve statistics from process associated with TA. */ +extern td_err_e td_ta_get_stats (const td_thragent_t *__ta, + td_ta_stats_t *__statsp); + + +/* Validate that TH is a thread handle. */ +extern td_err_e td_thr_validate (const td_thrhandle_t *__th); + +/* Return information about thread TH. */ +extern td_err_e td_thr_get_info (const td_thrhandle_t *__th, + td_thrinfo_t *__infop); + +/* Retrieve floating-point register contents of process running thread TH. */ +extern td_err_e td_thr_getfpregs (const td_thrhandle_t *__th, + prfpregset_t *__regset); + +/* Retrieve general register contents of process running thread TH. */ +extern td_err_e td_thr_getgregs (const td_thrhandle_t *__th, + prgregset_t __gregs); + +/* Retrieve extended register contents of process running thread TH. */ +extern td_err_e td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs); + +/* Get size of extended register set of process running thread TH. */ +extern td_err_e td_thr_getxregsize (const td_thrhandle_t *__th, int *__sizep); + +/* Set floating-point register contents of process running thread TH. */ +extern td_err_e td_thr_setfpregs (const td_thrhandle_t *__th, + const prfpregset_t *__fpregs); + +/* Set general register contents of process running thread TH. */ +extern td_err_e td_thr_setgregs (const td_thrhandle_t *__th, + prgregset_t __gregs); + +/* Set extended register contents of process running thread TH. */ +extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th, + const void *__addr); + + +/* Get address of the given module's TLS storage area for the given thread. */ +extern td_err_e td_thr_tlsbase (const td_thrhandle_t *__th, + unsigned long int __modid, + psaddr_t *__base); + +/* Get address of thread local variable. */ +extern td_err_e td_thr_tls_get_addr (const td_thrhandle_t *__th, + void *__map_address, size_t __offset, + void **__address); + + +/* Enable reporting for EVENT for thread TH. */ +extern td_err_e td_thr_event_enable (const td_thrhandle_t *__th, int __event); + +/* Enable EVENT for thread TH. */ +extern td_err_e td_thr_set_event (const td_thrhandle_t *__th, + td_thr_events_t *__event); + +/* Disable EVENT for thread TH. */ +extern td_err_e td_thr_clear_event (const td_thrhandle_t *__th, + td_thr_events_t *__event); + +/* Get event message for thread TH. */ +extern td_err_e td_thr_event_getmsg (const td_thrhandle_t *__th, + td_event_msg_t *__msg); + + +/* Set priority of thread TH. */ +extern td_err_e td_thr_setprio (const td_thrhandle_t *__th, int __prio); + + +/* Set pending signals for thread TH. */ +extern td_err_e td_thr_setsigpending (const td_thrhandle_t *__th, + unsigned char __n, const sigset_t *__ss); + +/* Set signal mask for thread TH. */ +extern td_err_e td_thr_sigsetmask (const td_thrhandle_t *__th, + const sigset_t *__ss); + + +/* Return thread local data associated with key TK in thread TH. */ +extern td_err_e td_thr_tsd (const td_thrhandle_t *__th, + const thread_key_t __tk, void **__data); + + +/* Suspend execution of thread TH. */ +extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th); + +/* Resume execution of thread TH. */ +extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th); + +#endif /* thread_db.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/time.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/time.h new file mode 100644 index 0000000..425b71b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/time.h @@ -0,0 +1,435 @@ +/* Copyright (C) 1991-1999,2000,2001,2002,2003,2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.23 Date and time + */ + +#ifndef _TIME_H + +#if (! defined __need_time_t && !defined __need_clock_t && \ + ! defined __need_timespec) +# define _TIME_H 1 +# include + +__BEGIN_DECLS + +#endif + +#ifdef _TIME_H +/* Get size_t and NULL from . */ +# define __need_size_t +# define __need_NULL +# include + +/* This defines CLOCKS_PER_SEC, which is the number of processor clock + ticks per second. */ +# include + +/* This is the obsolete POSIX.1-1988 name for the same constant. */ +# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K +# ifndef CLK_TCK +# define CLK_TCK CLOCKS_PER_SEC +# endif +# endif + +#endif /* included. */ + +#if !defined __clock_t_defined && (defined _TIME_H || defined __need_clock_t) +# define __clock_t_defined 1 + +# include + +__BEGIN_NAMESPACE_STD +/* Returned by `clock'. */ +typedef __clock_t clock_t; +__END_NAMESPACE_STD +#if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC +__USING_NAMESPACE_STD(clock_t) +#endif + +#endif /* clock_t not defined and or need clock_t. */ +#undef __need_clock_t + +#if !defined __time_t_defined && (defined _TIME_H || defined __need_time_t) +# define __time_t_defined 1 + +# include + +__BEGIN_NAMESPACE_STD +/* Returned by `time'. */ +typedef __time_t time_t; +__END_NAMESPACE_STD +#if defined __USE_POSIX || defined __USE_MISC || defined __USE_SVID +__USING_NAMESPACE_STD(time_t) +#endif + +#endif /* time_t not defined and or need time_t. */ +#undef __need_time_t + +#if !defined __clockid_t_defined && \ + ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_clockid_t) +# define __clockid_t_defined 1 + +# include + +/* Clock ID used in clock and timer functions. */ +typedef __clockid_t clockid_t; + +#endif /* clockid_t not defined and or need clockid_t. */ +#undef __clockid_time_t + +#if !defined __timer_t_defined && \ + ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timer_t) +# define __timer_t_defined 1 + +# include + +/* Timer ID returned by `timer_create'. */ +typedef __timer_t timer_t; + +#endif /* timer_t not defined and or need timer_t. */ +#undef __need_timer_t + + +#if !defined __timespec_defined && \ + ((defined _TIME_H && \ + (defined __USE_POSIX199309 || defined __USE_MISC)) || \ + defined __need_timespec) +# define __timespec_defined 1 + +# include /* This defines __time_t for us. */ + +/* POSIX.1b structure for a time value. This is like a `struct timeval' but + has nanoseconds instead of microseconds. */ +struct timespec + { + __time_t tv_sec; /* Seconds. */ + long int tv_nsec; /* Nanoseconds. */ + }; + +#endif /* timespec not defined and or need timespec. */ +#undef __need_timespec + + +#ifdef _TIME_H +__BEGIN_NAMESPACE_STD +/* Used by other time functions. */ +struct tm +{ + int tm_sec; /* Seconds. [0-60] (1 leap second) */ + int tm_min; /* Minutes. [0-59] */ + int tm_hour; /* Hours. [0-23] */ + int tm_mday; /* Day. [1-31] */ + int tm_mon; /* Month. [0-11] */ + int tm_year; /* Year - 1900. */ + int tm_wday; /* Day of week. [0-6] */ + int tm_yday; /* Days in year.[0-365] */ + int tm_isdst; /* DST. [-1/0/1]*/ + +#ifdef __UCLIBC_HAS_TM_EXTENSIONS__ +#ifdef __USE_BSD + long int tm_gmtoff; /* Seconds east of UTC. */ + __const char *tm_zone; /* Timezone abbreviation. */ +#else + long int __tm_gmtoff; /* Seconds east of UTC. */ + __const char *__tm_zone; /* Timezone abbreviation. */ +#endif +#endif /* __UCLIBC_HAS_TM_EXTENSIONS__ */ +}; +__END_NAMESPACE_STD +#if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC +__USING_NAMESPACE_STD(tm) +#endif + + +#ifdef __USE_POSIX199309 +/* POSIX.1b structure for timer start values and intervals. */ +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + +/* We can use a simple forward declaration. */ +struct sigevent; + +#endif /* POSIX.1b */ + +#ifdef __USE_XOPEN2K +# ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +# endif +#endif + + +__BEGIN_NAMESPACE_STD +/* Time used by the program so far (user time + system time). + The result / CLOCKS_PER_SECOND is program time in seconds. */ +extern clock_t clock (void) __THROW; + +/* Return the current time and put it in *TIMER if TIMER is not NULL. */ +extern time_t time (time_t *__timer) __THROW; + +#ifdef __UCLIBC_HAS_FLOATS__ +/* Return the difference between TIME1 and TIME0. */ +extern double difftime (time_t __time1, time_t __time0) + __THROW __attribute__ ((__const__)); +#endif /* __UCLIBC_HAS_FLOATS__ */ + +/* Return the `time_t' representation of TP and normalize TP. */ +extern time_t mktime (struct tm *__tp) __THROW; + + +/* Format TP into S according to FORMAT. + Write no more than MAXSIZE characters and return the number + of characters written, or 0 if it would exceed MAXSIZE. */ +extern size_t strftime (char *__restrict __s, size_t __maxsize, + __const char *__restrict __format, + __const struct tm *__restrict __tp) __THROW; +__END_NAMESPACE_STD + +# ifdef __USE_XOPEN +/* Parse S according to FORMAT and store binary time information in TP. + The return value is a pointer to the first unparsed character in S. */ +extern char *strptime (__const char *__restrict __s, + __const char *__restrict __fmt, struct tm *__tp) + __THROW; +# endif + +#ifdef __UCLIBC_HAS_XLOCALE__ +# ifdef __USE_GNU +/* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ +# include + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + __const char *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW; + +extern char *strptime_l (__const char *__restrict __s, + __const char *__restrict __fmt, struct tm *__tp, + __locale_t __loc) __THROW; +# endif +#endif + + +__BEGIN_NAMESPACE_STD +/* Return the `struct tm' representation of *TIMER + in Universal Coordinated Time (aka Greenwich Mean Time). */ +extern struct tm *gmtime (__const time_t *__timer) __THROW; + +/* Return the `struct tm' representation + of *TIMER in the local timezone. */ +extern struct tm *localtime (__const time_t *__timer) __THROW; +__END_NAMESPACE_STD + +# if defined __USE_POSIX || defined __USE_MISC +/* Return the `struct tm' representation of *TIMER in UTC, + using *TP to store the result. */ +extern struct tm *gmtime_r (__const time_t *__restrict __timer, + struct tm *__restrict __tp) __THROW; + +/* Return the `struct tm' representation of *TIMER in local time, + using *TP to store the result. */ +extern struct tm *localtime_r (__const time_t *__restrict __timer, + struct tm *__restrict __tp) __THROW; +# endif /* POSIX or misc */ + +__BEGIN_NAMESPACE_STD +/* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n" + that is the representation of TP in this format. */ +extern char *asctime (__const struct tm *__tp) __THROW; + +/* Equivalent to `asctime (localtime (timer))'. */ +extern char *ctime (__const time_t *__timer) __THROW; +__END_NAMESPACE_STD + +# if defined __USE_POSIX || defined __USE_MISC +/* Reentrant versions of the above functions. */ + +/* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n" + that is the representation of TP in this format. */ +extern char *asctime_r (__const struct tm *__restrict __tp, + char *__restrict __buf) __THROW; + +/* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ +extern char *ctime_r (__const time_t *__restrict __timer, + char *__restrict __buf) __THROW; +# endif /* POSIX or misc */ + + +/* Defined in localtime.c. */ +#ifdef __UCLIBC_MJN3_ONLY__ +#warning "mjn3 FIXME: __tzname, __daylight, and __timezone have a prototype but are not defined." +extern char *__tzname[2]; /* Current timezone names. */ +extern int __daylight; /* If daylight-saving time is ever in use. */ +extern long int __timezone; /* Seconds west of UTC. */ +#endif /* __UCLIBC_MJN3_ONLY__ */ + + +# ifdef __USE_POSIX +/* Same as above. */ +extern char *tzname[2]; + +/* Set time conversion information from the TZ environment variable. + If TZ is not defined, a locale-dependent default is used. */ +extern void tzset (void) __THROW; +# endif + +# if defined __USE_SVID || defined __USE_XOPEN +extern int daylight; +extern long int timezone; +# endif + +# ifdef __USE_SVID +/* Set the system time to *WHEN. + This call is restricted to the superuser. */ +extern int stime (__const time_t *__when) __THROW; +# endif + + +/* Nonzero if YEAR is a leap year (every 4 years, + except every 100th isn't, and every 400th is). */ +# define __isleap(year) \ + ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) + + +# ifdef __USE_MISC +/* Miscellaneous functions many Unices inherited from the public domain + localtime package. These are included only for compatibility. */ + +/* Like `mktime', but for TP represents Universal Time, not local time. */ +extern time_t timegm (struct tm *__tp) __THROW; + +/* Another name for `mktime'. */ +extern time_t timelocal (struct tm *__tp) __THROW; + +/* Return the number of days in YEAR. */ +extern int dysize (int __year) __THROW __attribute__ ((__const__)); +# endif + + +# ifdef __USE_POSIX199309 +/* Pause execution for a number of nanoseconds. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int nanosleep (__const struct timespec *__requested_time, + struct timespec *__remaining); + + +/* Get resolution of clock CLOCK_ID. */ +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; + +/* Get current value of clock CLOCK_ID and store it in TP. */ +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; + +/* Set clock CLOCK_ID to value TP. */ +extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp) + __THROW; + +#ifdef __UCLIBC_MJN3_ONLY__ +#warning "mjn3 FIXME: a bunch of unimplemented function prototypes." +# ifdef __USE_XOPEN2K +/* High-resolution sleep with the specified clock. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + __const struct timespec *__req, + struct timespec *__rem); + +/* Return clock ID for CPU-time clock. */ +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; +# endif +#endif /* __UCLIBC_MJN3_ONLY__ */ + + +/* Create new per-process timer using CLOCK_ID. */ +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __THROW; + +/* Delete timer TIMERID. */ +extern int timer_delete (timer_t __timerid) __THROW; + +/* Set timer TIMERID to VALUE, returning old value in OVLAUE. */ +extern int timer_settime (timer_t __timerid, int __flags, + __const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __THROW; + +/* Get current value of timer TIMERID and store it in VLAUE. */ +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __THROW; + +/* Get expiration overrun for timer TIMERID. */ +extern int timer_getoverrun (timer_t __timerid) __THROW; +# endif + + +#ifdef __UCLIBC_MJN3_ONLY__ +#warning "mjn3 FIXME: a bunch of unimplemented function prototypes." +# ifdef __USE_XOPEN_EXTENDED +/* Set to one of the following values to indicate an error. + 1 the DATEMSK environment variable is null or undefined, + 2 the template file cannot be opened for reading, + 3 failed to get file status information, + 4 the template file is not a regular file, + 5 an error is encountered while reading the template file, + 6 memory allication failed (not enough memory available), + 7 there is no line in the template that matches the input, + 8 invalid input specification Example: February 31 or a time is + specified that can not be represented in a time_t (representing + the time in seconds since 00:00:00 UTC, January 1, 1970) */ +extern int getdate_err; + +/* Parse the given string as a date specification and return a value + representing the value. The templates from the file identified by + the environment variable DATEMSK are used. In case of an error + `getdate_err' is set. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern struct tm *getdate (__const char *__string); +# endif + +# ifdef __USE_GNU +/* Since `getdate' is not reentrant because of the use of `getdate_err' + and the static buffer to return the result in, we provide a thread-safe + variant. The functionality is the same. The result is returned in + the buffer pointed to by RESBUFP and in case of an error the return + value is != 0 with the same values as given above for `getdate_err'. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int getdate_r (__const char *__restrict __string, + struct tm *__restrict __resbufp); +# endif +#endif /* __UCLIBC_MJN3_ONLY__ */ + +__END_DECLS + +#endif /* included. */ + +#endif /* not already included. */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/ttyent.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ttyent.h new file mode 100644 index 0000000..0b221bc --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ttyent.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ttyent.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _TTYENT_H +#define _TTYENT_H 1 + +#include + +#define _PATH_TTYS "/etc/ttys" + +#define _TTYS_OFF "off" +#define _TTYS_ON "on" +#define _TTYS_SECURE "secure" +#define _TTYS_WINDOW "window" + +struct ttyent { + char *ty_name; /* terminal device name */ + char *ty_getty; /* command to execute, usually getty */ + char *ty_type; /* terminal type for termcap */ +#define TTY_ON 0x01 /* enable logins (start ty_getty program) */ +#define TTY_SECURE 0x02 /* allow uid of 0 to login */ + int ty_status; /* status flags */ + char *ty_window; /* command to start up window manager */ + char *ty_comment; /* comment field */ +}; + + +__BEGIN_DECLS + +extern struct ttyent *getttyent (void) __THROW; +extern struct ttyent *getttynam (__const char *__tty) __THROW; +extern int setttyent (void) __THROW; +extern int endttyent (void) __THROW; + +__END_DECLS + +#endif /* ttyent.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/ucontext.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ucontext.h new file mode 100644 index 0000000..5bd4645 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ucontext.h @@ -0,0 +1,32 @@ +/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UCONTEXT_H +#define _UCONTEXT_H 1 + +#include + +/* Get machine dependent definition of data structures. */ +#include + +/* The System V ABI user-level context switching support functions + * are marked obsolescent by SuSv3, and are not implemented by + * uClibc. This header is therefore empty. */ + + +#endif /* ucontext.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/ulimit.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ulimit.h new file mode 100644 index 0000000..93b5f37 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ulimit.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ULIMIT_H +#define _ULIMIT_H 1 + +#include + +/* Constants used as the first parameter for `ulimit'. They denote limits + which can be set or retrieved using this function. */ +enum +{ + UL_GETFSIZE = 1, /* Return limit on the size of a file, + in units of 512 bytes. */ +#define UL_GETFSIZE UL_GETFSIZE + UL_SETFSIZE, /* Set limit on the size of a file to + second argument. */ +#define UL_SETFSIZE UL_SETFSIZE + __UL_GETMAXBRK, /* Return the maximum possible address + of the data segment. */ + __UL_GETOPENMAX /* Return the maximum number of files + that the calling process can open.*/ +}; + + +__BEGIN_DECLS + +/* Control process limits according to CMD. */ +extern long int ulimit (int __cmd, ...) __THROW; + +__END_DECLS + +#endif /* ulimit.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/unistd.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/unistd.h new file mode 100644 index 0000000..7590640 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/unistd.h @@ -0,0 +1,1110 @@ +/* Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 2.10 Symbolic Constants + */ + +#ifndef _UNISTD_H +#define _UNISTD_H 1 + +#include + +__BEGIN_DECLS + +/* These may be used to determine what facilities are present at compile time. + Their values can be obtained at run time from `sysconf'. */ + +/* POSIX Standard approved as ISO/IEC 9945-1 as of December 2001. */ +#define _POSIX_VERSION 200112L + +/* These are not #ifdef __USE_POSIX2 because they are + in the theoretically application-owned namespace. */ + +/* The utilities on GNU systems also correspond to this version. */ +#define _POSIX2_VERSION 200112L + +/* If defined, the implementation supports the + C Language Bindings Option. */ +#define _POSIX2_C_BIND 200112L + +/* If defined, the implementation supports the + C Language Development Utilities Option. */ +#define _POSIX2_C_DEV 200112L + +/* If defined, the implementation supports the + Software Development Utilities Option. */ +#define _POSIX2_SW_DEV 200112L + +/* If defined, the implementation supports the + creation of locales with the localedef utility. */ +#define _POSIX2_LOCALEDEF 200112L + +/* X/Open version number to which the library conforms. It is selectable. */ +#ifdef __USE_UNIX98 +# define _XOPEN_VERSION 500 +#else +# define _XOPEN_VERSION 4 +#endif + +/* Commands and utilities from XPG4 are available. */ +#define _XOPEN_XCU_VERSION 4 + +/* We are compatible with the old published standards as well. */ +#define _XOPEN_XPG2 1 +#define _XOPEN_XPG3 1 +#define _XOPEN_XPG4 1 + +/* The X/Open Unix extensions are available. */ +#define _XOPEN_UNIX 1 + +/* Encryption is present. */ +#define _XOPEN_CRYPT 1 + +/* The enhanced internationalization capabilities according to XPG4.2 + are present. */ +#define _XOPEN_ENH_I18N 1 + +/* The legacy interfaces are also available. */ +#define _XOPEN_LEGACY 1 + + +/* Get values of POSIX options: + + If these symbols are defined, the corresponding features are + always available. If not, they may be available sometimes. + The current values can be obtained with `sysconf'. + + _POSIX_JOB_CONTROL Job control is supported. + _POSIX_SAVED_IDS Processes have a saved set-user-ID + and a saved set-group-ID. + _POSIX_REALTIME_SIGNALS Real-time, queued signals are supported. + _POSIX_PRIORITY_SCHEDULING Priority scheduling is supported. + _POSIX_TIMERS POSIX.4 clocks and timers are supported. + _POSIX_ASYNCHRONOUS_IO Asynchronous I/O is supported. + _POSIX_PRIORITIZED_IO Prioritized asynchronous I/O is supported. + _POSIX_SYNCHRONIZED_IO Synchronizing file data is supported. + _POSIX_FSYNC The fsync function is present. + _POSIX_MAPPED_FILES Mapping of files to memory is supported. + _POSIX_MEMLOCK Locking of all memory is supported. + _POSIX_MEMLOCK_RANGE Locking of ranges of memory is supported. + _POSIX_MEMORY_PROTECTION Setting of memory protections is supported. + _POSIX_MESSAGE_PASSING POSIX.4 message queues are supported. + _POSIX_SEMAPHORES POSIX.4 counting semaphores are supported. + _POSIX_SHARED_MEMORY_OBJECTS POSIX.4 shared memory objects are supported. + _POSIX_THREADS POSIX.1c pthreads are supported. + _POSIX_THREAD_ATTR_STACKADDR Thread stack address attribute option supported. + _POSIX_THREAD_ATTR_STACKSIZE Thread stack size attribute option supported. + _POSIX_THREAD_SAFE_FUNCTIONS Thread-safe functions are supported. + _POSIX_THREAD_PRIORITY_SCHEDULING + POSIX.1c thread execution scheduling supported. + _POSIX_THREAD_PRIO_INHERIT Thread priority inheritance option supported. + _POSIX_THREAD_PRIO_PROTECT Thread priority protection option supported. + _POSIX_THREAD_PROCESS_SHARED Process-shared synchronization supported. + _POSIX_PII Protocol-independent interfaces are supported. + _POSIX_PII_XTI XTI protocol-indep. interfaces are supported. + _POSIX_PII_SOCKET Socket protocol-indep. interfaces are supported. + _POSIX_PII_INTERNET Internet family of protocols supported. + _POSIX_PII_INTERNET_STREAM Connection-mode Internet protocol supported. + _POSIX_PII_INTERNET_DGRAM Connectionless Internet protocol supported. + _POSIX_PII_OSI ISO/OSI family of protocols supported. + _POSIX_PII_OSI_COTS Connection-mode ISO/OSI service supported. + _POSIX_PII_OSI_CLTS Connectionless ISO/OSI service supported. + _POSIX_POLL Implementation supports `poll' function. + _POSIX_SELECT Implementation supports `select' and `pselect'. + + _XOPEN_REALTIME X/Open realtime support is available. + _XOPEN_REALTIME_THREADS X/Open realtime thread support is available. + _XOPEN_SHM Shared memory interface according to XPG4.2. + + _XBS5_ILP32_OFF32 Implementation provides environment with 32-bit + int, long, pointer, and off_t types. + _XBS5_ILP32_OFFBIG Implementation provides environment with 32-bit + int, long, and pointer and off_t with at least + 64 bits. + _XBS5_LP64_OFF64 Implementation provides environment with 32-bit + int, and 64-bit long, pointer, and off_t types. + _XBS5_LPBIG_OFFBIG Implementation provides environment with at + least 32 bits int and long, pointer, and off_t + with at least 64 bits. + + If any of these symbols is defined as -1, the corresponding option is not + true for any file. If any is defined as other than -1, the corresponding + option is true for all files. If a symbol is not defined at all, the value + for a specific file can be obtained from `pathconf' and `fpathconf'. + + _POSIX_CHOWN_RESTRICTED Only the super user can use `chown' to change + the owner of a file. `chown' can only be used + to change the group ID of a file to a group of + which the calling process is a member. + _POSIX_NO_TRUNC Pathname components longer than + NAME_MAX generate an error. + _POSIX_VDISABLE If defined, if the value of an element of the + `c_cc' member of `struct termios' is + _POSIX_VDISABLE, no character will have the + effect associated with that element. + _POSIX_SYNC_IO Synchronous I/O may be performed. + _POSIX_ASYNC_IO Asynchronous I/O may be performed. + _POSIX_PRIO_IO Prioritized Asynchronous I/O may be performed. + + Support for the Large File Support interface is not generally available. + If it is available the following constants are defined to one. + _LFS64_LARGEFILE Low-level I/O supports large files. + _LFS64_STDIO Standard I/O supports large files. + */ + +#include + +/* Get the environment definitions from Unix98. */ +#ifdef __USE_UNIX98 +# include +#endif + +/* Standard file descriptors. */ +#define STDIN_FILENO 0 /* Standard input. */ +#define STDOUT_FILENO 1 /* Standard output. */ +#define STDERR_FILENO 2 /* Standard error output. */ + + +/* All functions that are not declared anywhere else. */ + +#include + +#ifndef __ssize_t_defined +typedef __ssize_t ssize_t; +# define __ssize_t_defined +#endif + +#define __need_size_t +#define __need_NULL +#include + +#if defined __USE_XOPEN || defined __USE_XOPEN2K +/* The Single Unix specification says that some more types are + available here. */ +# ifndef __gid_t_defined +typedef __gid_t gid_t; +# define __gid_t_defined +# endif + +# ifndef __uid_t_defined +typedef __uid_t uid_t; +# define __uid_t_defined +# endif + +# ifndef __off_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __off_t off_t; +# else +typedef __off64_t off_t; +# endif +# define __off_t_defined +# endif +# if defined __USE_LARGEFILE64 && !defined __off64_t_defined +typedef __off64_t off64_t; +# define __off64_t_defined +# endif + +# ifndef __useconds_t_defined +typedef __useconds_t useconds_t; +# define __useconds_t_defined +# endif + +# ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +# endif +#endif /* X/Open */ + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +# ifndef __intptr_t_defined +typedef __intptr_t intptr_t; +# define __intptr_t_defined +# endif +#endif + +#if defined __USE_BSD || defined __USE_XOPEN +# ifndef __socklen_t_defined +typedef __socklen_t socklen_t; +# define __socklen_t_defined +# endif +#endif + +/* Values for the second argument to access. + These may be OR'd together. */ +#define R_OK 4 /* Test for read permission. */ +#define W_OK 2 /* Test for write permission. */ +#define X_OK 1 /* Test for execute permission. */ +#define F_OK 0 /* Test for existence. */ + +/* Test for access to NAME using the real UID and real GID. */ +extern int access (__const char *__name, int __type) __THROW __nonnull ((1)); + +#if 0 /*def __USE_GNU*/ +/* Test for access to NAME using the effective UID and GID + (as normal file operations use). */ +extern int euidaccess (__const char *__name, int __type) + __THROW __nonnull ((1)); + +/* An alias for `euidaccess', used by some other systems. */ +extern int eaccess (__const char *__name, int __type) + __THROW __nonnull ((1)); +#endif + +#ifdef __USE_ATFILE +/* Test for access to FILE relative to the directory FD is open on. + If AT_EACCESS is set in FLAG, then use effective IDs like `eaccess', + otherwise use real IDs like `access'. */ +extern int faccessat (int __fd, __const char *__file, int __type, int __flag) + __THROW __nonnull ((2)) __wur; +#endif /* Use GNU. */ + + +/* Values for the WHENCE argument to lseek. */ +#ifndef _STDIO_H /* has the same definitions. */ +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Seek from end of file. */ +#endif + +#if defined __USE_BSD && !defined L_SET +/* Old BSD names for the same constants; just for compatibility. */ +# define L_SET SEEK_SET +# define L_INCR SEEK_CUR +# define L_XTND SEEK_END +#endif + + +/* Move FD's file position to OFFSET bytes from the + beginning of the file (if WHENCE is SEEK_SET), + the current position (if WHENCE is SEEK_CUR), + or the end of the file (if WHENCE is SEEK_END). + Return the new file position. */ +#ifndef __USE_FILE_OFFSET64 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW; +#else +# ifdef __REDIRECT_NTH +extern __off64_t __REDIRECT_NTH (lseek, + (int __fd, __off64_t __offset, int __whence), + lseek64); +# else +# define lseek lseek64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) + __THROW; +#endif + +/* Close the file descriptor FD. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int close (int __fd); + +/* Read NBYTES into BUF from FD. Return the + number read, -1 for errors or 0 for EOF. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur; + +/* Write N bytes of BUF to FD. Return the number written, or -1. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t write (int __fd, __const void *__buf, size_t __n) __wur; + +#ifdef __USE_UNIX98 +# ifndef __USE_FILE_OFFSET64 +/* Read NBYTES into BUF from FD at the given position OFFSET without + changing the file pointer. Return the number read, -1 for errors + or 0 for EOF. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) __wur; + +/* Write N bytes of BUF to FD at the given position OFFSET without + changing the file pointer. Return the number written, or -1. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n, + __off_t __offset) __wur; +# else +# ifdef __REDIRECT +extern ssize_t __REDIRECT (pread, (int __fd, void *__buf, size_t __nbytes, + __off64_t __offset), + pread64) __wur; +extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf, + size_t __nbytes, __off64_t __offset), + pwrite64) __wur; +# else +# define pread pread64 +# define pwrite pwrite64 +# endif +# endif + +# ifdef __USE_LARGEFILE64 +/* Read NBYTES into BUF from FD at the given position OFFSET without + changing the file pointer. Return the number read, -1 for errors + or 0 for EOF. */ +extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, + __off64_t __offset) __wur; +/* Write N bytes of BUF to FD at the given position OFFSET without + changing the file pointer. Return the number written, or -1. */ +extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n, + __off64_t __offset) __wur; +# endif +#endif + +/* Create a one-way communication channel (pipe). + If successful, two file descriptors are stored in PIPEDES; + bytes written on PIPEDES[1] can be read from PIPEDES[0]. + Returns 0 if successful, -1 if not. */ +extern int pipe (int __pipedes[2]) __THROW __wur; + +/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. + If SECONDS is zero, any currently scheduled alarm will be cancelled. + The function returns the number of seconds remaining until the last + alarm scheduled would have signaled, or zero if there wasn't one. + There is no return value to indicate an error, but you can set `errno' + to 0 and check its value after calling `alarm', and this might tell you. + The signal may come late due to processor scheduling. */ +extern unsigned int alarm (unsigned int __seconds) __THROW; + +/* Make the process sleep for SECONDS seconds, or until a signal arrives + and is not ignored. The function returns the number of seconds less + than SECONDS which it actually slept (thus zero if it slept the full time). + If a signal handler does a `longjmp' or modifies the handling of the + SIGALRM signal while inside `sleep' call, the handling of the SIGALRM + signal afterwards is undefined. There is no return value to indicate + error, but if `sleep' returns SECONDS, it probably didn't work. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern unsigned int sleep (unsigned int __seconds); + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Set an alarm to go off (generating a SIGALRM signal) in VALUE + microseconds. If INTERVAL is nonzero, when the alarm goes off, the + timer is reset to go off every INTERVAL microseconds thereafter. + Returns the number of microseconds remaining before the alarm. */ +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __THROW; + +/* Sleep USECONDS microseconds, or until a signal arrives that is not blocked + or ignored. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int usleep (__useconds_t __useconds); +#endif + + +/* Suspend the process until a signal arrives. + This always returns -1 and sets `errno' to EINTR. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pause (void); + + +/* Change the owner and group of FILE. */ +extern int chown (__const char *__file, __uid_t __owner, __gid_t __group) + __THROW __nonnull ((1)) __wur; + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Change the owner and group of the file that FD is open on. */ +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur; + + +/* Change owner and group of FILE, if it is a symbolic + link the ownership of the symbolic link is changed. */ +extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group) + __THROW __nonnull ((1)) __wur; + +#endif /* Use BSD || X/Open Unix. */ + +#ifdef __USE_ATFILE +/* Change the owner and group of FILE relative to the directory FD is open + on. */ +extern int fchownat (int __fd, __const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __THROW __nonnull ((2)) __wur; +#endif /* Use GNU. */ + +/* Change the process's working directory to PATH. */ +extern int chdir (__const char *__path) __THROW __nonnull ((1)) __wur; + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Change the process's working directory to the one FD is open on. */ +extern int fchdir (int __fd) __THROW __wur; +#endif + +/* Get the pathname of the current working directory, + and put it in SIZE bytes of BUF. Returns NULL if the + directory couldn't be determined or SIZE was too small. + If successful, returns BUF. In GNU, if BUF is NULL, + an array is allocated with `malloc'; the array is SIZE + bytes long, unless SIZE == 0, in which case it is as + big as necessary. */ +extern char *getcwd (char *__buf, size_t __size) __THROW __wur; + +#ifdef __USE_GNU +/* Return a malloc'd string containing the current directory name. + If the environment variable `PWD' is set, and its value is correct, + that value is used. */ +extern char *get_current_dir_name (void) __THROW; +#endif + +#if 0 /*defined __USE_BSD || defined __USE_XOPEN_EXTENDED*/ +/* Put the absolute pathname of the current working directory in BUF. + If successful, return BUF. If not, put an error message in + BUF and return NULL. BUF should be at least PATH_MAX bytes long. */ +extern char *getwd (char *__buf) + __THROW __nonnull ((1)) __attribute_deprecated__ __wur; +#endif + + +/* Duplicate FD, returning a new file descriptor on the same file. */ +extern int dup (int __fd) __THROW __wur; + +/* Duplicate FD to FD2, closing FD2 and making it open on the same file. */ +extern int dup2 (int __fd, int __fd2) __THROW; + +/* NULL-terminated array of "NAME=VALUE" environment variables. */ +extern char **__environ; +#ifdef __USE_GNU +extern char **environ; +#endif + + +/* Replace the current process, executing PATH with arguments ARGV and + environment ENVP. ARGV and ENVP are terminated by NULL pointers. */ +extern int execve (__const char *__path, char *__const __argv[], + char *__const __envp[]) __THROW __nonnull ((1)); + +#if 0 /*def __USE_GNU*/ +/* Execute the file FD refers to, overlaying the running program image. + ARGV and ENVP are passed to the new program, as for `execve'. */ +extern int fexecve (int __fd, char *__const __argv[], char *__const __envp[]) + __THROW; +#endif + + +/* Execute PATH with arguments ARGV and environment from `environ'. */ +extern int execv (__const char *__path, char *__const __argv[]) + __THROW __nonnull ((1)); + +/* Execute PATH with all arguments after PATH until a NULL pointer, + and the argument after that for environment. */ +extern int execle (__const char *__path, __const char *__arg, ...) + __THROW __nonnull ((1)); + +/* Execute PATH with all arguments after PATH until + a NULL pointer and environment from `environ'. */ +extern int execl (__const char *__path, __const char *__arg, ...) + __THROW __nonnull ((1)); + +/* Execute FILE, searching in the `PATH' environment variable if it contains + no slashes, with arguments ARGV and environment from `environ'. */ +extern int execvp (__const char *__file, char *__const __argv[]) + __THROW __nonnull ((1)); + +/* Execute FILE, searching in the `PATH' environment variable if + it contains no slashes, with all arguments after FILE until a + NULL pointer and environment from `environ'. */ +extern int execlp (__const char *__file, __const char *__arg, ...) + __THROW __nonnull ((1)); + + +#if defined __USE_MISC || defined __USE_XOPEN +/* Add INC to priority of the current process. */ +extern int nice (int __inc) __THROW __wur; +#endif + + +/* Terminate program execution with the low-order 8 bits of STATUS. */ +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + +/* Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf'; + the `_SC_*' symbols for the NAME argument to `sysconf'; + and the `_CS_*' symbols for the NAME argument to `confstr'. */ +#include + +/* Get file-specific configuration information about PATH. */ +extern long int pathconf (__const char *__path, int __name) + __THROW __nonnull ((1)); + +/* Get file-specific configuration about descriptor FD. */ +extern long int fpathconf (int __fd, int __name) __THROW; + +/* Get the value of the system variable NAME. */ +extern long int sysconf (int __name) __THROW; + +#ifdef __USE_POSIX2 +/* Get the value of the string-valued system variable NAME. */ +extern size_t confstr (int __name, char *__buf, size_t __len) __THROW; +#endif + + +/* Get the process ID of the calling process. */ +extern __pid_t getpid (void) __THROW; + +/* Get the process ID of the calling process's parent. */ +extern __pid_t getppid (void) __THROW; + +/* Get the process group ID of the calling process. + This function is different on old BSD. */ +#ifndef __FAVOR_BSD +extern __pid_t getpgrp (void) __THROW; +#else +# ifdef __REDIRECT_NTH +extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid); +# else +# define getpgrp __getpgid +# endif +#endif + +/* Get the process group ID of process PID. */ +extern __pid_t __getpgid (__pid_t __pid) __THROW; +#ifdef __USE_XOPEN_EXTENDED +extern __pid_t getpgid (__pid_t __pid) __THROW; +#endif + + +/* Set the process group ID of the process matching PID to PGID. + If PID is zero, the current process's process group ID is set. + If PGID is zero, the process ID of the process is used. */ +extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW; + +#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Both System V and BSD have `setpgrp' functions, but with different + calling conventions. The BSD function is the same as POSIX.1 `setpgid' + (above). The System V function takes no arguments and puts the calling + process in its on group like `setpgid (0, 0)'. + + New programs should always use `setpgid' instead. + + The default in GNU is to provide the System V function. The BSD + function is available under -D_BSD_SOURCE. */ + +# ifndef __FAVOR_BSD + +/* Set the process group ID of the calling process to its own PID. + This is exactly the same as `setpgid (0, 0)'. */ +extern int setpgrp (void) __THROW; + +# else + +/* Another name for `setpgid' (above). */ +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid); +# else +# define setpgrp setpgid +# endif + +# endif /* Favor BSD. */ +#endif /* Use SVID or BSD. */ + +/* Create a new session with the calling process as its leader. + The process group IDs of the session and the calling process + are set to the process ID of the calling process, which is returned. */ +extern __pid_t setsid (void) __THROW; + +#ifdef __USE_XOPEN_EXTENDED +/* Return the session ID of the given process. */ +extern __pid_t getsid (__pid_t __pid) __THROW; +#endif + +/* Get the real user ID of the calling process. */ +extern __uid_t getuid (void) __THROW; + +/* Get the effective user ID of the calling process. */ +extern __uid_t geteuid (void) __THROW; + +/* Get the real group ID of the calling process. */ +extern __gid_t getgid (void) __THROW; + +/* Get the effective group ID of the calling process. */ +extern __gid_t getegid (void) __THROW; + +/* If SIZE is zero, return the number of supplementary groups + the calling process is in. Otherwise, fill in the group IDs + of its supplementary groups in LIST and return the number written. */ +extern int getgroups (int __size, __gid_t __list[]) __THROW __wur; + +#if 0 /*def __USE_GNU*/ +/* Return nonzero iff the calling process is in group GID. */ +extern int group_member (__gid_t __gid) __THROW; +#endif + +/* Set the user ID of the calling process to UID. + If the calling process is the super-user, set the real + and effective user IDs, and the saved set-user-ID to UID; + if not, the effective user ID is set to UID. */ +extern int setuid (__uid_t __uid) __THROW; + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Set the real user ID of the calling process to RUID, + and the effective user ID of the calling process to EUID. */ +extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW; +#endif + +#if defined __USE_BSD || defined __USE_XOPEN2K +/* Set the effective user ID of the calling process to UID. */ +extern int seteuid (__uid_t __uid) __THROW; +#endif /* Use BSD. */ + +/* Set the group ID of the calling process to GID. + If the calling process is the super-user, set the real + and effective group IDs, and the saved set-group-ID to GID; + if not, the effective group ID is set to GID. */ +extern int setgid (__gid_t __gid) __THROW; + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Set the real group ID of the calling process to RGID, + and the effective group ID of the calling process to EGID. */ +extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW; +#endif + +#if defined __USE_BSD || defined __USE_XOPEN2K +/* Set the effective group ID of the calling process to GID. */ +extern int setegid (__gid_t __gid) __THROW; +#endif /* Use BSD. */ + +#ifdef __USE_GNU +/* Fetch the real user ID, effective user ID, and saved-set user ID, + of the calling process. */ +extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid) + __THROW; + +/* Fetch the real group ID, effective group ID, and saved-set group ID, + of the calling process. */ +extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid) + __THROW; + +/* Set the real user ID, effective user ID, and saved-set user ID, + of the calling process to RUID, EUID, and SUID, respectively. */ +extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid) + __THROW; + +/* Set the real group ID, effective group ID, and saved-set group ID, + of the calling process to RGID, EGID, and SGID, respectively. */ +extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid) + __THROW; +#endif + + +#ifdef __ARCH_USE_MMU__ +/* Clone the calling process, creating an exact copy. + Return -1 for errors, 0 to the new process, + and the process ID of the new process to the old process. */ +extern __pid_t fork (void) __THROW; +#endif + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Clone the calling process, but without copying the whole address space. + The calling process is suspended until the new process exits or is + replaced by a call to `execve'. Return -1 for errors, 0 to the new process, + and the process ID of the new process to the old process. */ +extern __pid_t vfork (void) __THROW; +#endif /* Use BSD. */ + + +/* Return the pathname of the terminal FD is open on, or NULL on errors. + The returned storage is good only until the next call to this function. */ +extern char *ttyname (int __fd) __THROW; + +/* Store at most BUFLEN characters of the pathname of the terminal FD is + open on in BUF. Return 0 on success, otherwise an error number. */ +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __THROW __nonnull ((2)) __wur; + +/* Return 1 if FD is a valid descriptor associated + with a terminal, zero if not. */ +extern int isatty (int __fd) __THROW; + +#if 0 /*defined __USE_BSD \ + || (defined __USE_XOPEN_EXTENDED && !defined __USE_UNIX98)*/ +/* Return the index into the active-logins file (utmp) for + the controlling terminal. */ +extern int ttyslot (void) __THROW; +#endif + + +/* Make a link to FROM named TO. */ +extern int link (__const char *__from, __const char *__to) + __THROW __nonnull ((1, 2)) __wur; + +#ifdef __USE_ATFILE +/* Like link but relative paths in TO and FROM are interpreted relative + to FROMFD and TOFD respectively. */ +extern int linkat (int __fromfd, __const char *__from, int __tofd, + __const char *__to, int __flags) + __THROW __nonnull ((2, 4)) __wur; +#endif + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K +/* Make a symbolic link to FROM named TO. */ +extern int symlink (__const char *__from, __const char *__to) + __THROW __nonnull ((1, 2)) __wur; + +/* Read the contents of the symbolic link PATH into no more than + LEN bytes of BUF. The contents are not null-terminated. + Returns the number of characters read, or -1 for errors. */ +extern ssize_t readlink (__const char *__restrict __path, + char *__restrict __buf, size_t __len) + __THROW __nonnull ((1, 2)) __wur; +#endif /* Use BSD. */ + +#ifdef __USE_ATFILE +/* Like symlink but a relative path in TO is interpreted relative to TOFD. */ +extern int symlinkat (__const char *__from, int __tofd, + __const char *__to) __THROW __nonnull ((1, 3)) __wur; + +/* Like readlink but a relative PATH is interpreted relative to FD. */ +extern ssize_t readlinkat (int __fd, __const char *__restrict __path, + char *__restrict __buf, size_t __len) + __THROW __nonnull ((2, 3)) __wur; +#endif + +/* Remove the link NAME. */ +extern int unlink (__const char *__name) __THROW __nonnull ((1)); + +#ifdef __USE_ATFILE +/* Remove the link NAME relative to FD. */ +extern int unlinkat (int __fd, __const char *__name, int __flag) + __THROW __nonnull ((2)); +#endif + +/* Remove the directory PATH. */ +extern int rmdir (__const char *__path) __THROW __nonnull ((1)); + + +/* Return the foreground process group ID of FD. */ +extern __pid_t tcgetpgrp (int __fd) __THROW; + +/* Set the foreground process group ID of FD set PGRP_ID. */ +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW; + + +/* Return the login name of the user. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern char *getlogin (void); +#if defined __USE_REENTRANT || defined __USE_POSIX199506 +/* Return at most NAME_LEN characters of the login name of the user in NAME. + If it cannot be determined or some other error occurred, return the error + code. Otherwise return 0. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int getlogin_r (char *__name, size_t __name_len) __nonnull ((1)); +#endif + +#if 0 /*def __USE_BSD*/ +/* Set the login name returned by `getlogin'. */ +extern int setlogin (__const char *__name) __THROW __nonnull ((1)); +#endif + + +#ifdef __USE_POSIX2 +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. */ +# define __need_getopt +/* keep this for uClibc in bits/, we need it when GNU_GETOPT is disabled */ +# include +#endif + + +#if defined __USE_BSD || defined __USE_UNIX98 +/* Put the name of the current host in no more than LEN bytes of NAME. + The result is null-terminated if LEN is large enough for the full + name and the terminator. */ +extern int gethostname (char *__name, size_t __len) __THROW __nonnull ((1)); +#endif + + +#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98) +/* Set the name of the current host to NAME, which is LEN bytes long. + This call is restricted to the super-user. */ +extern int sethostname (__const char *__name, size_t __len) + __THROW __nonnull ((1)) __wur; + +/* Set the current machine's Internet number to ID. + This call is restricted to the super-user. */ +extern int sethostid (long int __id) __THROW __wur; + + +/* Get and set the NIS (aka YP) domain name, if any. + Called just like `gethostname' and `sethostname'. + The NIS domain name is usually the empty string when not using NIS. */ +extern int getdomainname (char *__name, size_t __len) + __THROW __nonnull ((1)) __wur; +extern int setdomainname (__const char *__name, size_t __len) + __THROW __nonnull ((1)) __wur; + + +/* Revoke access permissions to all processes currently communicating + with the control terminal, and then send a SIGHUP signal to the process + group of the control terminal. */ +extern int vhangup (void) __THROW; + +#if 0 +/* Revoke the access of all descriptors currently open on FILE. */ +extern int revoke (__const char *__file) __THROW __nonnull ((1)) __wur; + + +/* Enable statistical profiling, writing samples of the PC into at most + SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling + is enabled, the system examines the user PC and increments + SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, + disable profiling. Returns zero on success, -1 on error. */ +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __THROW __nonnull ((1)); +#endif + + +/* Turn accounting on if NAME is an existing file. The system will then write + a record for each process as it terminates, to this file. If NAME is NULL, + turn accounting off. This call is restricted to the super-user. */ +extern int acct (__const char *__name) __THROW; + + +/* Successive calls return the shells listed in `/etc/shells'. */ +extern char *getusershell (void) __THROW; +extern void endusershell (void) __THROW; /* Discard cached info. */ +extern void setusershell (void) __THROW; /* Rewind and re-read the file. */ + + +#ifdef __ARCH_USE_MMU__ +/* Put the program in the background, and dissociate from the controlling + terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, + redirects stdin, stdout, and stderr to /dev/null. */ +extern int daemon (int __nochdir, int __noclose) __THROW __wur; +#endif +#endif /* Use BSD || X/Open. */ + + +#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +/* Make PATH be the root directory (the starting point for absolute paths). + This call is restricted to the super-user. */ +extern int chroot (__const char *__path) __THROW __nonnull ((1)) __wur; + +/* Prompt with PROMPT and read a string from the terminal without echoing. + Uses /dev/tty if possible; otherwise stderr and stdin. */ +extern char *getpass (__const char *__prompt) __nonnull ((1)); +#endif /* Use BSD || X/Open. */ + + +#if defined __USE_BSD || defined __USE_XOPEN +/* Make all changes done to FD actually appear on disk. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int fsync (int __fd); +#endif /* Use BSD || X/Open. */ + + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED + +/* Return identifier for the current host. */ +extern long int gethostid (void); + +/* Make all changes done to all files actually appear on disk. */ +extern void sync (void) __THROW; + + +/* Return the number of bytes in a page. This is the system's page size, + which is not necessarily the same as the hardware page size. */ +extern int getpagesize (void) __THROW __attribute__ ((__const__)); + + +/* Return the maximum number of file descriptors + the current process could possibly have. */ +extern int getdtablesize (void) __THROW; + + +/* Truncate FILE to LENGTH bytes. */ +# ifndef __USE_FILE_OFFSET64 +extern int truncate (__const char *__file, __off_t __length) + __THROW __nonnull ((1)) __wur; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (truncate, + (__const char *__file, __off64_t __length), + truncate64) __nonnull ((1)) __wur; +# else +# define truncate truncate64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int truncate64 (__const char *__file, __off64_t __length) + __THROW __nonnull ((1)) __wur; +# endif + +#endif /* Use BSD || X/Open Unix. */ + +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K + +/* Truncate the file FD is open on to LENGTH bytes. */ +# ifndef __USE_FILE_OFFSET64 +extern int ftruncate (int __fd, __off_t __length) __THROW __wur; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length), + ftruncate64) __wur; +# else +# define ftruncate ftruncate64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur; +# endif + +#endif /* Use BSD || X/Open Unix || POSIX 2003. */ + + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED + +/* Set the end of accessible data space (aka "the break") to ADDR. + Returns zero on success and -1 for errors (with errno set). */ +extern int brk (void *__addr) __THROW __wur; + +/* Increase or decrease the end of accessible data space by DELTA bytes. + If successful, returns the address the previous end of data space + (i.e. the beginning of the new space, if DELTA > 0); + returns (void *) -1 for errors (with errno set). */ +extern void *sbrk (intptr_t __delta) __THROW; +#endif + + +#ifdef __USE_MISC +/* Invoke `system call' number SYSNO, passing it the remaining arguments. + This is completely system-dependent, and not often useful. + + In Unix, `syscall' sets `errno' for all errors and most calls return -1 + for errors; in many systems you cannot pass arguments or get return + values for all system calls (`pipe', `fork', and `getppid' typically + among them). + + In Mach, all system calls take normal arguments and always return an + error code (zero for success). */ +extern long int syscall (long int __sysno, ...) __THROW; + +#endif /* Use misc. */ + + +#if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) && !defined F_LOCK +/* NOTE: These declarations also appear in ; be sure to keep both + files consistent. Some systems have them there and some here, and some + software depends on the macros being defined without including both. */ + +/* `lockf' is a simpler interface to the locking facilities of `fcntl'. + LEN is always relative to the current file position. + The CMD argument is one of the following. + + This function is a cancellation point and therefore not marked with + __THROW. */ + +# define F_ULOCK 0 /* Unlock a previously locked region. */ +# define F_LOCK 1 /* Lock a region for exclusive use. */ +# define F_TLOCK 2 /* Test and lock a region for exclusive use. */ +# define F_TEST 3 /* Test a region for other processes locks. */ + +# ifndef __USE_FILE_OFFSET64 +extern int lockf (int __fd, int __cmd, __off_t __len) __wur; +# else +# ifdef __REDIRECT +extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), + lockf64) __wur; +# else +# define lockf lockf64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int lockf64 (int __fd, int __cmd, __off64_t __len) __wur; +# endif +#endif /* Use misc and F_LOCK not already defined. */ + + +#ifdef __USE_GNU + +/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno' + set to EINTR. */ + +# define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) +#endif + +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +/* Synchronize at least the data part of a file with the underlying + media. */ +extern int fdatasync (int __fildes) __THROW; +#endif /* Use POSIX199309 */ + + +/* XPG4.2 specifies that prototypes for the encryption functions must + be defined here. */ +#ifdef __USE_XOPEN +/* Encrypt at most 8 characters from KEY using salt to perturb DES. */ +extern char *crypt (__const char *__key, __const char *__salt) + __THROW __nonnull ((1, 2)); + +/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt + block in place. */ +extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1)); + + +/* Swab pairs bytes in the first N bytes of the area pointed to by + FROM and copy the result to TO. The value of TO must not be in the + range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM + is without partner. */ +extern void swab (__const void *__restrict __from, void *__restrict __to, + ssize_t __n) __THROW __nonnull ((1, 2)); +#endif + + +/* The Single Unix specification demands this prototype to be here. + It is also found in . */ +#ifdef __USE_XOPEN +/* Return the name of the controlling terminal. */ +extern char *ctermid (char *__s) __THROW; +#endif + + +/* Define some macros helping to catch buffer overflows. */ +#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus +# include +#endif + +__END_DECLS + +#endif /* unistd.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/ustat.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ustat.h new file mode 100644 index 0000000..cba150e --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/ustat.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/utime.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/utime.h new file mode 100644 index 0000000..dd5d265 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/utime.h @@ -0,0 +1,52 @@ +/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * POSIX Standard: 5.6.6 Set File Access and Modification Times + */ + +#ifndef _UTIME_H +#define _UTIME_H 1 + +#include + +__BEGIN_DECLS + +#include + +#if defined __USE_XOPEN || defined __USE_XOPEN2K +# define __need_time_t +# include +#endif + +/* Structure describing file times. */ +struct utimbuf + { + __time_t actime; /* Access time. */ + __time_t modtime; /* Modification time. */ + }; + +/* Set the access and modification times of FILE to those given in + *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ +extern int utime (__const char *__file, + __const struct utimbuf *__file_times) + __THROW __nonnull ((1)); + +__END_DECLS + +#endif /* utime.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/utmp.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/utmp.h new file mode 100644 index 0000000..585aad1 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/utmp.h @@ -0,0 +1,97 @@ +/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _UTMP_H +#define _UTMP_H 1 + +#include + +#include + + +__BEGIN_DECLS + +/* Get system dependent values and data structures. */ +#include + +/* Compatibility names for the strings of the canonical file names. */ +#define UTMP_FILE _PATH_UTMP +#define UTMP_FILENAME _PATH_UTMP +#define WTMP_FILE _PATH_WTMP +#define WTMP_FILENAME _PATH_WTMP + + + +/* Make FD be the controlling terminal, stdin, stdout, and stderr; + then close FD. Returns 0 on success, nonzero on error. */ +extern int login_tty (int __fd) __THROW; + + +/* Write the given entry into utmp and wtmp. */ +extern void login (__const struct utmp *__entry) __THROW; + +/* Write the utmp entry to say the user on UT_LINE has logged out. */ +extern int logout (__const char *__ut_line) __THROW; + +/* Append to wtmp an entry for the current time and the given info. */ +extern void logwtmp (__const char *__ut_line, __const char *__ut_name, + __const char *__ut_host) __THROW; + +/* Append entry UTMP to the wtmp-like file WTMP_FILE. */ +extern void updwtmp (__const char *__wtmp_file, __const struct utmp *__utmp) + __THROW; + +/* Change name of the utmp file to be examined. */ +extern int utmpname (__const char *__file) __THROW; + +/* Read next entry from a utmp-like file. */ +extern struct utmp *getutent (void) __THROW; + +/* Reset the input stream to the beginning of the file. */ +extern void setutent (void) __THROW; + +/* Close the current open file. */ +extern void endutent (void) __THROW; + +/* Search forward from the current point in the utmp file until the + next entry with a ut_type matching ID->ut_type. */ +extern struct utmp *getutid (__const struct utmp *__id) __THROW; + +/* Search forward from the current point in the utmp file until the + next entry with a ut_line matching LINE->ut_line. */ +extern struct utmp *getutline (__const struct utmp *__line) __THROW; + +/* Write out entry pointed to by UTMP_PTR into the utmp file. */ +extern struct utmp *pututline (__const struct utmp *__utmp_ptr) __THROW; + + +#if 0 /* def __USE_MISC */ +/* Reentrant versions of the file for handling utmp files. */ +extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW; + +extern int getutid_r (__const struct utmp *__id, struct utmp *__buffer, + struct utmp **__result) __THROW; + +extern int getutline_r (__const struct utmp *__line, + struct utmp *__buffer, struct utmp **__result) __THROW; + +#endif /* Use misc. */ + +__END_DECLS + +#endif /* utmp.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/values.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/values.h new file mode 100644 index 0000000..d8bd8b5 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/values.h @@ -0,0 +1,71 @@ +/* Old compatibility names for and constants. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This interface is obsolete. New programs should use + and/or instead of . */ + +#ifndef _VALUES_H +#define _VALUES_H 1 + +#include + +#include + +#define _TYPEBITS(type) (sizeof (type) * CHAR_BIT) + +#define CHARBITS _TYPEBITS (char) +#define SHORTBITS _TYPEBITS (short int) +#define INTBITS _TYPEBITS (int) +#define LONGBITS _TYPEBITS (long int) +#define PTRBITS _TYPEBITS (char *) +#define DOUBLEBITS _TYPEBITS (double) +#define FLOATBITS _TYPEBITS (float) + +#define MINSHORT SHRT_MIN +#define MININT INT_MIN +#define MINLONG LONG_MIN + +#define MAXSHORT SHRT_MAX +#define MAXINT INT_MAX +#define MAXLONG LONG_MAX + +#define HIBITS MINSHORT +#define HIBITL MINLONG + + +#ifdef __UCLIBC_HAS_FLOATS__ +#include + +#define MAXDOUBLE DBL_MAX +#define MAXFLOAT FLT_MAX +#define MINDOUBLE DBL_MIN +#define MINFLOAT FLT_MIN +#define DMINEXP DBL_MIN_EXP +#define FMINEXP FLT_MIN_EXP +#define DMAXEXP DBL_MAX_EXP +#define FMAXEXP FLT_MAX_EXP +#endif /* __UCLIBC_HAS_FLOATS__ */ + + +#ifdef __USE_MISC +/* Some systems define this name instead of CHAR_BIT or CHARBITS. */ +# define BITSPERBYTE CHAR_BIT +#endif + +#endif /* values.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/..install.cmd b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/..install.cmd new file mode 100644 index 0000000..7bed870 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/..install.cmd @@ -0,0 +1 @@ +cmd_/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/video/.install := perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/video /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/video mips edid.h sisfb.h uvesafb.h; perl scripts/headers_install.pl /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux-2.6.30/include/video /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/video mips ; touch /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/linux/include/video/.install diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/.install b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/.install new file mode 100644 index 0000000..e69de29 diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/edid.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/edid.h new file mode 100644 index 0000000..4905b1b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/edid.h @@ -0,0 +1,13 @@ +#ifndef __linux_video_edid_h__ +#define __linux_video_edid_h__ + +#if !defined(__KERNEL__) || defined(CONFIG_X86) + +struct edid_info { + unsigned char dummy[128]; +}; + + +#endif + +#endif /* __linux_video_edid_h__ */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/sisfb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/sisfb.h new file mode 100644 index 0000000..0b01f0c --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/sisfb.h @@ -0,0 +1,209 @@ +/* + * sisfb.h - definitions for the SiS framebuffer driver + * + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the named License, + * or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _LINUX_SISFB_H_ +#define _LINUX_SISFB_H_ + +#include +#include + +/**********************************************/ +/* PUBLIC */ +/**********************************************/ + +/* vbflags, public (others in sis.h) */ +#define CRT2_DEFAULT 0x00000001 +#define CRT2_LCD 0x00000002 +#define CRT2_TV 0x00000004 +#define CRT2_VGA 0x00000008 +#define TV_NTSC 0x00000010 +#define TV_PAL 0x00000020 +#define TV_HIVISION 0x00000040 +#define TV_YPBPR 0x00000080 +#define TV_AVIDEO 0x00000100 +#define TV_SVIDEO 0x00000200 +#define TV_SCART 0x00000400 +#define TV_PALM 0x00001000 +#define TV_PALN 0x00002000 +#define TV_NTSCJ 0x00001000 +#define TV_CHSCART 0x00008000 +#define TV_CHYPBPR525I 0x00010000 +#define CRT1_VGA 0x00000000 +#define CRT1_LCDA 0x00020000 +#define VGA2_CONNECTED 0x00040000 +#define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ +#define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ +#define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ +#define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ + +/* Aliases: */ +#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) +#define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) +#define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) + +/* Only if TV_YPBPR is set: */ +#define TV_YPBPR525I TV_NTSC +#define TV_YPBPR525P TV_PAL +#define TV_YPBPR750P TV_PALM +#define TV_YPBPR1080I TV_PALN +#define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) + +#define VB_DISPTYPE_DISP2 CRT2_ENABLE +#define VB_DISPTYPE_CRT2 CRT2_ENABLE +#define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1 +#define VB_DISPMODE_SINGLE VB_SINGLE_MODE +#define VB_DISPMODE_MIRROR VB_MIRROR_MODE +#define VB_DISPMODE_DUAL VB_DUALVIEW_MODE +#define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) + +/* Structure argument for SISFB_GET_INFO ioctl */ +struct sisfb_info { + __u32 sisfb_id; /* for identifying sisfb */ +#ifndef SISFB_ID +#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ +#endif + __u32 chip_id; /* PCI-ID of detected chip */ + __u32 memory; /* total video memory in KB */ + __u32 heapstart; /* heap start offset in KB */ + __u8 fbvidmode; /* current sisfb mode */ + + __u8 sisfb_version; + __u8 sisfb_revision; + __u8 sisfb_patchlevel; + + __u8 sisfb_caps; /* sisfb capabilities */ + + __u32 sisfb_tqlen; /* turbo queue length (in KB) */ + + __u32 sisfb_pcibus; /* The card's PCI ID */ + __u32 sisfb_pcislot; + __u32 sisfb_pcifunc; + + __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ + + __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ + + __u32 sisfb_vbflags; + __u32 sisfb_currentvbflags; + + __u32 sisfb_scalelcd; + __u32 sisfb_specialtiming; + + __u8 sisfb_haveemi; + __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; + __u8 sisfb_haveemilcd; + + __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ + + __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ + + __u32 sisfb_heapsize; /* heap size (in KB) */ + __u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */ + + __u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */ + __u32 sisfb_curdstn; + + __u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */ + + __u32 sisfb_vbflags2; /* ivideo->vbflags2 */ + + __u8 sisfb_can_post; /* sisfb can POST this card */ + __u8 sisfb_card_posted; /* card is POSTED */ + __u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */ + + __u8 reserved[183]; /* for future use */ +}; + +#define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */ +#define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */ +/* more to come */ + +#define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */ +#define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */ +#define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */ +#define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */ +#define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */ +/* more to come */ +#define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */ +#define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */ + +/* Argument for SISFB_CMD ioctl */ +struct sisfb_cmd { + __u32 sisfb_cmd; + __u32 sisfb_arg[16]; + __u32 sisfb_result[4]; +}; + +/* Addtional IOCTLs for communication sisfb <> X driver */ +/* If changing this, vgatypes.h must also be changed (for X driver) */ + +/* ioctl for identifying and giving some info (esp. memory heap start) */ +#define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) +#define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info) + +/* ioctrl to get current vertical retrace status */ +#define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) + +/* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ +#define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) +#define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) + +/* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/ +#define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) +#define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) + +/* ioctl for internal sisfb commands (sisfbctrl) */ +#define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd) + +/* ioctl for locking sisfb (no register access during lock) */ +/* As of now, only used to avoid register access during + * the ioctls listed above. + */ +#define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) + +/* ioctls 0xF3 up to 0x3F reserved for sisfb */ + +/****************************************************************/ +/* The following are deprecated and should not be used anymore: */ +/****************************************************************/ +/* ioctl for identifying and giving some info (esp. memory heap start) */ +#define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) +/* ioctrl to get current vertical retrace status */ +#define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32) +/* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ +#define SISFB_GET_AUTOMAXIMIZE_OLD _IOR('n',0xFA,__u32) +#define SISFB_SET_AUTOMAXIMIZE_OLD _IOW('n',0xFA,__u32) +/****************************************************************/ +/* End of deprecated ioctl numbers */ +/****************************************************************/ + +/* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */ +struct sis_memreq { + __u32 offset; + __u32 size; +}; + +/**********************************************/ +/* PRIVATE */ +/* (for IN-KERNEL usage only) */ +/**********************************************/ + + +#endif diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/uvesafb.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/uvesafb.h new file mode 100644 index 0000000..79e281b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/video/uvesafb.h @@ -0,0 +1,60 @@ +#ifndef _UVESAFB_H +#define _UVESAFB_H + +#include + +struct v86_regs { + __u32 ebx; + __u32 ecx; + __u32 edx; + __u32 esi; + __u32 edi; + __u32 ebp; + __u32 eax; + __u32 eip; + __u32 eflags; + __u32 esp; + __u16 cs; + __u16 ss; + __u16 es; + __u16 ds; + __u16 fs; + __u16 gs; +}; + +/* Task flags */ +#define TF_VBEIB 0x01 +#define TF_BUF_ESDI 0x02 +#define TF_BUF_ESBX 0x04 +#define TF_BUF_RET 0x08 +#define TF_EXIT 0x10 + +struct uvesafb_task { + __u8 flags; + int buf_len; + struct v86_regs regs; +}; + +/* Constants for the capabilities field + * in vbe_ib */ +#define VBE_CAP_CAN_SWITCH_DAC 0x01 +#define VBE_CAP_VGACOMPAT 0x02 + +/* The VBE Info Block */ +struct vbe_ib { + char vbe_signature[4]; + __u16 vbe_version; + __u32 oem_string_ptr; + __u32 capabilities; + __u32 mode_list_ptr; + __u16 total_memory; + __u16 oem_software_rev; + __u32 oem_vendor_name_ptr; + __u32 oem_product_name_ptr; + __u32 oem_product_rev_ptr; + __u8 reserved[222]; + char oem_data[256]; + char misc_data[512]; +} __attribute__ ((packed)); + +#endif /* _UVESAFB_H */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/wait.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/wait.h new file mode 100644 index 0000000..d01b811 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/wait.h @@ -0,0 +1 @@ +#include diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/wchar.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/wchar.h new file mode 100644 index 0000000..e461f71 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/wchar.h @@ -0,0 +1,752 @@ +/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.24 + * Extended multibyte and wide character utilities + */ + +#ifndef _WCHAR_H + +#ifndef __need_mbstate_t +# define _WCHAR_H 1 +# include +#endif + +#ifndef __UCLIBC_HAS_WCHAR__ +#error Attempted to include wchar.h when uClibc built without wide char support. +#endif + +#ifdef _WCHAR_H +/* Get FILE definition. */ +# define __need___FILE +# ifdef __USE_UNIX98 +# define __need_FILE +# endif +# include +/* Get va_list definition. */ +# define __need___va_list +# include + +/* Get size_t, wchar_t, wint_t and NULL from . */ +# define __need_size_t +# define __need_wchar_t +# define __need_NULL +#endif +#define __need_wint_t +#include + +#include + +/* We try to get wint_t from , but not all GCC versions define it + there. So define it ourselves if it remains undefined. */ +#ifndef _WINT_T +/* Integral type unchanged by default argument promotions that can + hold any value corresponding to members of the extended character + set, as well as at least one value that does not correspond to any + member of the extended character set. */ +# define _WINT_T +typedef unsigned int wint_t; +#else +/* Work around problems with the file which doesn't put + wint_t in the std namespace. */ +# if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \ + && defined __WINT_TYPE__ +__BEGIN_NAMESPACE_STD +typedef __WINT_TYPE__ wint_t; +__END_NAMESPACE_STD +# endif +#endif + + +#ifndef __mbstate_t_defined +# define __mbstate_t_defined 1 +/* Conversion state information. */ +#if 1 +typedef struct +{ + wchar_t __mask; + wchar_t __wc; +} __mbstate_t; +#else +typedef struct +{ + int __count; + union + { + wint_t __wch; + char __wchb[4]; + } __value; /* Value so far. */ +} __mbstate_t; +#endif +#endif +#undef __need_mbstate_t + + +/* The rest of the file is only used if used if __need_mbstate_t is not + defined. */ +#ifdef _WCHAR_H + +__BEGIN_NAMESPACE_C99 +/* Public type. */ +typedef __mbstate_t mbstate_t; +__END_NAMESPACE_C99 +#ifdef __USE_GNU +__USING_NAMESPACE_C99(mbstate_t) +#endif + +#ifndef WCHAR_MIN +/* These constants might also be defined in . */ +# define WCHAR_MIN __WCHAR_MIN +# define WCHAR_MAX __WCHAR_MAX +#endif + +#ifndef WEOF +# define WEOF (0xffffffffu) +#endif + +/* For XPG4 compliance we have to define the stuff from here + as well. */ +#if defined __USE_XOPEN && !defined __USE_UNIX98 +# include +#endif + + +__BEGIN_DECLS + +__BEGIN_NAMESPACE_STD +/* This incomplete type is defined in but needed here because + of `wcsftime'. */ +struct tm; +/* XXX We have to clean this up at some point. Since tm is in the std + namespace but wcsftime is in __c99 the type wouldn't be found + without inserting it in the global namespace. */ +__USING_NAMESPACE_STD(tm) +__END_NAMESPACE_STD + + +__BEGIN_NAMESPACE_C99 +/* Copy SRC to DEST. */ +extern wchar_t *wcscpy (wchar_t *__restrict __dest, + __const wchar_t *__restrict __src) __THROW; +/* Copy no more than N wide-characters of SRC to DEST. */ +extern wchar_t *wcsncpy (wchar_t *__restrict __dest, + __const wchar_t *__restrict __src, size_t __n) + __THROW; + +/* Append SRC onto DEST. */ +extern wchar_t *wcscat (wchar_t *__restrict __dest, + __const wchar_t *__restrict __src) __THROW; +/* Append no more than N wide-characters of SRC onto DEST. */ +extern wchar_t *wcsncat (wchar_t *__restrict __dest, + __const wchar_t *__restrict __src, size_t __n) + __THROW; + +/* Compare S1 and S2. */ +extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2) + __THROW __attribute_pure__; +/* Compare N wide-characters of S1 and S2. */ +extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n) + __THROW __attribute_pure__; +__END_NAMESPACE_C99 + +#ifdef __USE_GNU +/* Compare S1 and S2, ignoring case. */ +extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; + +/* Compare no more than N chars of S1 and S2, ignoring case. */ +extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2, + size_t __n) __THROW; + +#ifdef __UCLIBC_HAS_XLOCALE__ +/* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ +# include + +extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, + __locale_t __loc) __THROW; + +extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, + size_t __n, __locale_t __loc) __THROW; +#endif /* __UCLIBC_HAS_XLOCALE__ */ +#endif + +__BEGIN_NAMESPACE_C99 +/* Compare S1 and S2, both interpreted as appropriate to the + LC_COLLATE category of the current locale. */ +extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; +/* Transform S2 into array pointed to by S1 such that if wcscmp is + applied to two transformed strings the result is the as applying + `wcscoll' to the original strings. */ +extern size_t wcsxfrm (wchar_t *__restrict __s1, + __const wchar_t *__restrict __s2, size_t __n) __THROW; +__END_NAMESPACE_C99 + +#ifdef __USE_GNU +#ifdef __UCLIBC_HAS_XLOCALE__ +/* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ + +/* Compare S1 and S2, both interpreted as appropriate to the + LC_COLLATE category of the given locale. */ +extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, + __locale_t __loc) __THROW; + +/* Transform S2 into array pointed to by S1 such that if wcscmp is + applied to two transformed strings the result is the as applying + `wcscoll' to the original strings. */ +extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, + size_t __n, __locale_t __loc) __THROW; + +#endif /* __UCLIBC_HAS_XLOCALE__ */ + +/* Duplicate S, returning an identical malloc'd string. */ +extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__; +#endif + +__BEGIN_NAMESPACE_C99 +/* Find the first occurrence of WC in WCS. */ +extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc) + __THROW __attribute_pure__; +/* Find the last occurrence of WC in WCS. */ +extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc) + __THROW __attribute_pure__; +__END_NAMESPACE_C99 + +#ifdef __USE_GNU +/* This function is similar to `wcschr'. But it returns a pointer to + the closing NUL wide character in case C is not found in S. */ +extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc) + __THROW __attribute_pure__; +#endif + +__BEGIN_NAMESPACE_C99 +/* Return the length of the initial segmet of WCS which + consists entirely of wide characters not in REJECT. */ +extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject) + __THROW __attribute_pure__; +/* Return the length of the initial segmet of WCS which + consists entirely of wide characters in ACCEPT. */ +extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept) + __THROW __attribute_pure__; +/* Find the first occurrence in WCS of any character in ACCEPT. */ +extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept) + __THROW __attribute_pure__; +/* Find the first occurrence of NEEDLE in HAYSTACK. */ +extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle) + __THROW __attribute_pure__; + +/* Divide WCS into tokens separated by characters in DELIM. */ +extern wchar_t *wcstok (wchar_t *__restrict __s, + __const wchar_t *__restrict __delim, + wchar_t **__restrict __ptr) __THROW; + +/* Return the number of wide characters in S. */ +extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__; +__END_NAMESPACE_C99 + +#ifdef __USE_XOPEN +/* Another name for `wcsstr' from XPG4. */ +extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle) + __THROW __attribute_pure__; +#endif + +#ifdef __USE_GNU +/* Return the number of wide characters in S, but at most MAXLEN. */ +extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen) + __THROW __attribute_pure__; +#endif + + +__BEGIN_NAMESPACE_C99 +/* Search N wide characters of S for C. */ +extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n) + __THROW __attribute_pure__; + +/* Compare N wide characters of S1 and S2. */ +extern int wmemcmp (__const wchar_t *__restrict __s1, + __const wchar_t *__restrict __s2, size_t __n) + __THROW __attribute_pure__; + +/* Copy N wide characters of SRC to DEST. */ +extern wchar_t *wmemcpy (wchar_t *__restrict __s1, + __const wchar_t *__restrict __s2, size_t __n) __THROW; + +/* Copy N wide characters of SRC to DEST, guaranteeing + correct behavior for overlapping strings. */ +extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n) + __THROW; + +/* Set N wide characters of S to C. */ +extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW; +__END_NAMESPACE_C99 + +#ifdef __USE_GNU +/* Copy N wide characters of SRC to DEST and return pointer to following + wide character. */ +extern wchar_t *wmempcpy (wchar_t *__restrict __s1, + __const wchar_t *__restrict __s2, size_t __n) + __THROW; +#endif + + +__BEGIN_NAMESPACE_C99 +/* Determine whether C constitutes a valid (one-byte) multibyte + character. */ +extern wint_t btowc (int __c) __THROW; + +/* Determine whether C corresponds to a member of the extended + character set whose multibyte representation is a single byte. */ +extern int wctob (wint_t __c) __THROW; + +/* Determine whether PS points to an object representing the initial + state. */ +extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__; + +/* Write wide character representation of multibyte character pointed + to by S to PWC. */ +extern size_t mbrtowc (wchar_t *__restrict __pwc, + __const char *__restrict __s, size_t __n, + mbstate_t *__p) __THROW; + +/* Write multibyte representation of wide character WC to S. */ +extern size_t wcrtomb (char *__restrict __s, wchar_t __wc, + mbstate_t *__restrict __ps) __THROW; + +/* Return number of bytes in multibyte character pointed to by S. */ +#if 0 /* uClibc: disabled */ +extern size_t __mbrlen (__const char *__restrict __s, size_t __n, + mbstate_t *__restrict __ps) __THROW; +#endif +extern size_t mbrlen (__const char *__restrict __s, size_t __n, + mbstate_t *__restrict __ps) __THROW; + +/* Write wide character representation of multibyte character string + SRC to DST. */ +extern size_t mbsrtowcs (wchar_t *__restrict __dst, + __const char **__restrict __src, size_t __len, + mbstate_t *__restrict __ps) __THROW; + +/* Write multibyte character representation of wide character string + SRC to DST. */ +extern size_t wcsrtombs (char *__restrict __dst, + __const wchar_t **__restrict __src, size_t __len, + mbstate_t *__restrict __ps) __THROW; +__END_NAMESPACE_C99 + + +#ifdef __USE_GNU +/* Write wide character representation of at most NMC bytes of the + multibyte character string SRC to DST. */ +extern size_t mbsnrtowcs (wchar_t *__restrict __dst, + __const char **__restrict __src, size_t __nmc, + size_t __len, mbstate_t *__restrict __ps) __THROW; + +/* Write multibyte character representation of at most NWC characters + from the wide character string SRC to DST. */ +extern size_t wcsnrtombs (char *__restrict __dst, + __const wchar_t **__restrict __src, + size_t __nwc, size_t __len, + mbstate_t *__restrict __ps) __THROW; +#endif /* use GNU */ + + +/* The following functions are extensions found in X/Open CAE. */ +#ifdef __USE_XOPEN +/* Determine number of column positions required for C. */ +extern int wcwidth (wchar_t __c) __THROW; + +/* Determine number of column positions required for first N wide + characters (or fewer if S ends before this) in S. */ +extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW; +#endif /* Use X/Open. */ + + +__BEGIN_NAMESPACE_C99 +#ifdef __UCLIBC_HAS_FLOATS__ +/* Convert initial portion of the wide string NPTR to `double' + representation. */ +extern double wcstod (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; + +#ifdef __USE_ISOC99 +/* Likewise for `float' and `long double' sizes of floating-point numbers. */ +extern float wcstof (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +extern long double wcstold (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +#endif /* C99 */ +#endif /* __UCLIBC_HAS_FLOATS__ */ + + +/* Convert initial portion of wide string NPTR to `long int' + representation. */ +extern long int wcstol (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) __THROW; + +/* Convert initial portion of wide string NPTR to `unsigned long int' + representation. */ +extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + __THROW; + +#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU) +/* Convert initial portion of wide string NPTR to `long int' + representation. */ +__extension__ +extern long long int wcstoll (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + __THROW; + +/* Convert initial portion of wide string NPTR to `unsigned long long int' + representation. */ +__extension__ +extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) __THROW; +#endif /* ISO C99 or GCC and GNU. */ +__END_NAMESPACE_C99 + +#if defined __GNUC__ && defined __USE_GNU +/* Convert initial portion of wide string NPTR to `long int' + representation. */ +__extension__ +extern long long int wcstoq (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + __THROW; + +/* Convert initial portion of wide string NPTR to `unsigned long long int' + representation. */ +__extension__ +extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) __THROW; +#endif /* GCC and use GNU. */ + +#ifdef __USE_GNU +#ifdef __UCLIBC_HAS_XLOCALE__ +/* The concept of one static locale per category is not very well + thought out. Many applications will need to process its data using + information from several different locales. Another application is + the implementation of the internationalization handling in the + upcoming ISO C++ standard library. To support this another set of + the functions using locale data exist which have an additional + argument. + + Attention: all these functions are *not* standardized in any form. + This is a proof-of-concept implementation. */ + +/* Structure for reentrant locale using functions. This is an + (almost) opaque type for the user level programs. */ +# include + +/* Special versions of the functions above which take the locale to + use as an additional parameter. */ +extern long int wcstol_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base, + __locale_t __loc) __THROW; + +extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, __locale_t __loc) __THROW; + +__extension__ +extern long long int wcstoll_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, __locale_t __loc) __THROW; + +__extension__ +extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, __locale_t __loc) + __THROW; + +#ifdef __UCLIBC_HAS_FLOATS__ +extern double wcstod_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, __locale_t __loc) + __THROW; + +extern float wcstof_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, __locale_t __loc) + __THROW; + +extern long double wcstold_l (__const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + __locale_t __loc) __THROW; +#endif /* __UCLIBC_HAS_FLOATS__ */ +#endif /* __UCLIBC_HAS_XLOCALE__ */ +#endif /* GNU */ + + +#ifdef __USE_GNU +/* Copy SRC to DEST, returning the address of the terminating L'\0' in + DEST. */ +extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW; + +/* Copy no more than N characters of SRC to DEST, returning the address of + the last character written into DEST. */ +extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n) + __THROW; +#endif /* use GNU */ + + +/* Wide character I/O functions. */ +#if defined __USE_ISOC99 || defined __USE_UNIX98 +__BEGIN_NAMESPACE_C99 + +/* Select orientation for stream. */ +extern int fwide (__FILE *__fp, int __mode) __THROW; + + +/* Write formatted output to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fwprintf (__FILE *__restrict __stream, + __const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; +/* Write formatted output to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int wprintf (__const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; +/* Write formatted output of at most N characters to S. */ +extern int swprintf (wchar_t *__restrict __s, size_t __n, + __const wchar_t *__restrict __format, ...) + __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */; + +/* Write formatted output to S from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vfwprintf (__FILE *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; +/* Write formatted output to stdout from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vwprintf (__const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; +/* Write formatted output of at most N character to S from argument + list ARG. */ +extern int vswprintf (wchar_t *__restrict __s, size_t __n, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) + __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; + + +/* Read formatted input from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fwscanf (__FILE *__restrict __stream, + __const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +/* Read formatted input from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int wscanf (__const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; +/* Read formatted input from S. */ +extern int swscanf (__const wchar_t *__restrict __s, + __const wchar_t *__restrict __format, ...) + __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; + +__END_NAMESPACE_C99 +#endif /* Use ISO C99 and Unix98. */ + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 + +/* Read formatted input from S into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vfwscanf (__FILE *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +/* Read formatted input from stdin into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vwscanf (__const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; +/* Read formatted input from S into argument list ARG. */ +extern int vswscanf (__const wchar_t *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) + __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; + +__END_NAMESPACE_C99 +#endif /* Use ISO C99. */ + + +__BEGIN_NAMESPACE_C99 +/* Read a character from STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t fgetwc (__FILE *__stream); +extern wint_t getwc (__FILE *__stream); + +/* Read a character from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern wint_t getwchar (void); + + +/* Write a character to STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t fputwc (wchar_t __wc, __FILE *__stream); +extern wint_t putwc (wchar_t __wc, __FILE *__stream); + +/* Write a character to stdout. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t putwchar (wchar_t __wc); + + +/* Get a newline-terminated wide character string of finite length + from STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, + __FILE *__restrict __stream); + +/* Write a string to STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern int fputws (__const wchar_t *__restrict __ws, + __FILE *__restrict __stream); + + +/* Push a character back onto the input buffer of STREAM. + + This function is a possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t ungetwc (wint_t __wc, __FILE *__stream); +__END_NAMESPACE_C99 + + +#ifdef __USE_GNU +/* These are defined to be equivalent to the `char' functions defined + in POSIX.1:1996. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern wint_t getwc_unlocked (__FILE *__stream); +extern wint_t getwchar_unlocked (void); + +/* This is the wide character version of a GNU extension. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wint_t fgetwc_unlocked (__FILE *__stream); + +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream); + +/* These are defined to be equivalent to the `char' functions defined + in POSIX.1:1996. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream); +extern wint_t putwchar_unlocked (wchar_t __wc); + + +/* This function does the same as `fgetws' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n, + __FILE *__restrict __stream); + +/* This function does the same as `fputws' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fputws_unlocked (__const wchar_t *__restrict __ws, + __FILE *__restrict __stream); +#endif + + +__BEGIN_NAMESPACE_C99 +/* Format TP into S according to FORMAT. + Write no more than MAXSIZE wide characters and return the number + of wide characters written, or 0 if it would exceed MAXSIZE. */ +extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, + __const wchar_t *__restrict __format, + __const struct tm *__restrict __tp) __THROW; +__END_NAMESPACE_C99 + +# if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__ +# include + +/* Similar to `wcsftime' but takes the information from + the provided locale and not the global locale. */ +extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, + __const wchar_t *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW; +# endif + +/* The X/Open standard demands that most of the functions defined in + the header must also appear here. This is probably + because some X/Open members wrote their implementation before the + ISO C standard was published and introduced the better solution. + We have to provide these definitions for compliance reasons but we + do this nonsense only if really necessary. */ +#if defined __USE_UNIX98 && !defined __USE_GNU +# define __need_iswxxx +# include +#endif + +__END_DECLS + +#endif /* _WCHAR_H defined */ + +#endif /* wchar.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/include/wctype.h b/uclibc-crosstools-gcc-4.4.2-1/usr/include/wctype.h new file mode 100644 index 0000000..266ffab --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/include/wctype.h @@ -0,0 +1,330 @@ +/* Copyright (C) 1996,97,98,99,2000,01,02 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + * ISO C99 Standard: 7.25 + * Wide character classification and mapping utilities + */ + +#ifndef _WCTYPE_H + +#include +#include + +#ifndef __UCLIBC_HAS_WCHAR__ +#error Attempted to include wctype.h when uClibc built without wide char support. +#endif + +#ifndef __need_iswxxx +# define _WCTYPE_H 1 + +/* We try to get wint_t from , but not all GCC versions define it + there. So define it ourselves if it remains undefined. */ +# define __need_wint_t +# include +# ifndef _WINT_T +/* Integral type unchanged by default argument promotions that can + hold any value corresponding to members of the extended character + set, as well as at least one value that does not correspond to any + member of the extended character set. */ +# define _WINT_T +typedef unsigned int wint_t; +# else +# ifdef __USE_ISOC99 +__USING_NAMESPACE_C99(wint_t) +# endif +# endif + +/* Constant expression of type `wint_t' whose value does not correspond + to any member of the extended character set. */ +# ifndef WEOF +# define WEOF (0xffffffffu) +# endif +#endif +#undef __need_iswxxx + + +/* The following part is also used in the header when compiled + in the Unix98 compatibility mode. */ +#ifndef __iswxxx_defined +# define __iswxxx_defined 1 + +__BEGIN_NAMESPACE_C99 +/* Scalar type that can hold values which represent locale-specific + character classifications. */ +/* uClibc note: glibc uses - typedef unsigned long int wctype_t; */ +typedef unsigned int wctype_t; +__END_NAMESPACE_C99 + +# ifndef _ISwbit +# define _ISwbit(bit) (1 << (bit)) + +enum +{ + __ISwupper = 0, /* UPPERCASE. */ + __ISwlower = 1, /* lowercase. */ + __ISwalpha = 2, /* Alphabetic. */ + __ISwdigit = 3, /* Numeric. */ + __ISwxdigit = 4, /* Hexadecimal numeric. */ + __ISwspace = 5, /* Whitespace. */ + __ISwprint = 6, /* Printing. */ + __ISwgraph = 7, /* Graphical. */ + __ISwblank = 8, /* Blank (usually SPC and TAB). */ + __ISwcntrl = 9, /* Control character. */ + __ISwpunct = 10, /* Punctuation. */ + __ISwalnum = 11, /* Alphanumeric. */ + + _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */ + _ISwlower = _ISwbit (__ISwlower), /* lowercase. */ + _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */ + _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */ + _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */ + _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */ + _ISwprint = _ISwbit (__ISwprint), /* Printing. */ + _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */ + _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */ + _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */ + _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */ + _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */ +}; +# else +# if defined(__UCLIBC_MJN3_ONLY__) && defined(L_iswctype) +#warning remove _ISwbit already defined check? +#error _ISwbit already defined! +# endif +# endif /* Not _ISwbit */ + + +__BEGIN_DECLS + +__BEGIN_NAMESPACE_C99 +/* + * Wide-character classification functions: 7.15.2.1. + */ + +/* Test for any wide character for which `iswalpha' or `iswdigit' is + true. */ +extern int iswalnum (wint_t __wc) __THROW; + +/* Test for any wide character for which `iswupper' or 'iswlower' is + true, or any wide character that is one of a locale-specific set of + wide-characters for which none of `iswcntrl', `iswdigit', + `iswpunct', or `iswspace' is true. */ +extern int iswalpha (wint_t __wc) __THROW; + +/* Test for any control wide character. */ +extern int iswcntrl (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a decimal-digit + character. */ +extern int iswdigit (wint_t __wc) __THROW; + +/* Test for any wide character for which `iswprint' is true and + `iswspace' is false. */ +extern int iswgraph (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a lowercase letter + or is one of a locale-specific set of wide characters for which + none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +extern int iswlower (wint_t __wc) __THROW; + +/* Test for any printing wide character. */ +extern int iswprint (wint_t __wc) __THROW; + +/* Test for any printing wide character that is one of a + locale-specific et of wide characters for which neither `iswspace' + nor `iswalnum' is true. */ +extern int iswpunct (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a locale-specific + set of wide characters for which none of `iswalnum', `iswgraph', or + `iswpunct' is true. */ +extern int iswspace (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to an uppercase letter + or is one of a locale-specific set of wide character for which none + of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +extern int iswupper (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a hexadecimal-digit + character equivalent to that performed be the functions described + in the previous subclause. */ +extern int iswxdigit (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a standard blank + wide character or a locale-specific set of wide characters for + which `iswalnum' is false. */ +# ifdef __USE_ISOC99 +extern int iswblank (wint_t __wc) __THROW; +# endif + +/* + * Extensible wide-character classification functions: 7.15.2.2. + */ + +/* Construct value that describes a class of wide characters identified + by the string argument PROPERTY. */ +extern wctype_t wctype (__const char *__property) __THROW; + +/* Determine whether the wide-character WC has the property described by + DESC. */ +extern int iswctype (wint_t __wc, wctype_t __desc) __THROW; +__END_NAMESPACE_C99 + + +/* + * Wide-character case-mapping functions: 7.15.3.1. + */ + +__BEGIN_NAMESPACE_C99 +/* Scalar type that can hold values which represent locale-specific + character mappings. */ +/* uClibc note: glibc uses - typedef __const __int32_t *wctrans_t; */ +typedef unsigned int wctrans_t; +__END_NAMESPACE_C99 +#ifdef __USE_GNU +__USING_NAMESPACE_C99(wctrans_t) +#endif + +__BEGIN_NAMESPACE_C99 +/* Converts an uppercase letter to the corresponding lowercase letter. */ +extern wint_t towlower (wint_t __wc) __THROW; + +/* Converts an lowercase letter to the corresponding uppercase letter. */ +extern wint_t towupper (wint_t __wc) __THROW; +__END_NAMESPACE_C99 + +__END_DECLS + +#endif /* need iswxxx. */ + + +/* The remaining definitions and declarations must not appear in the + header. */ +#ifdef _WCTYPE_H + +/* + * Extensible wide-character mapping functions: 7.15.3.2. + */ + +__BEGIN_DECLS + +__BEGIN_NAMESPACE_C99 +/* Construct value that describes a mapping between wide characters + identified by the string argument PROPERTY. */ +extern wctrans_t wctrans (__const char *__property) __THROW; + +/* Map the wide character WC using the mapping described by DESC. */ +extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW; +__END_NAMESPACE_C99 + +#if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__) +/* Declare the interface to extended locale model. */ +# include + +/* Test for any wide character for which `iswalpha' or `iswdigit' is + true. */ +extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any wide character for which `iswupper' or 'iswlower' is + true, or any wide character that is one of a locale-specific set of + wide-characters for which none of `iswcntrl', `iswdigit', + `iswpunct', or `iswspace' is true. */ +extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any control wide character. */ +extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a decimal-digit + character. */ +extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any wide character for which `iswprint' is true and + `iswspace' is false. */ +extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a lowercase letter + or is one of a locale-specific set of wide characters for which + none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any printing wide character. */ +extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any printing wide character that is one of a + locale-specific et of wide characters for which neither `iswspace' + nor `iswalnum' is true. */ +extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a locale-specific + set of wide characters for which none of `iswalnum', `iswgraph', or + `iswpunct' is true. */ +extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to an uppercase letter + or is one of a locale-specific set of wide character for which none + of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a hexadecimal-digit + character equivalent to that performed be the functions described + in the previous subclause. */ +extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a standard blank + wide character or a locale-specific set of wide characters for + which `iswalnum' is false. */ +extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Construct value that describes a class of wide characters identified + by the string argument PROPERTY. */ +extern wctype_t wctype_l (__const char *__property, __locale_t __locale) + __THROW; + +/* Determine whether the wide-character WC has the property described by + DESC. */ +extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) + __THROW; + + +/* + * Wide-character case-mapping functions. + */ + +/* Converts an uppercase letter to the corresponding lowercase letter. */ +extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Converts an lowercase letter to the corresponding uppercase letter. */ +extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW; + +/* Construct value that describes a mapping between wide characters + identified by the string argument PROPERTY. */ +extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale) + __THROW; + +/* Map the wide character WC using the mapping described by DESC. */ +extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, + __locale_t __locale) __THROW; + +# endif /* Use GNU. */ + +__END_DECLS + +#endif /* __WCTYPE_H defined. */ + +#endif /* wctype.h */ diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/info/cpp.info b/uclibc-crosstools-gcc-4.4.2-1/usr/info/cpp.info new file mode 100644 index 0000000..221bf81 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/info/cpp.info @@ -0,0 +1,5351 @@ +This is doc/cpp.info, produced by makeinfo version 4.9 from +/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/gcc-4.4.2/gcc/doc/cpp.texi. + + Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, +1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free +Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation. A copy of +the license is included in the section entitled "GNU Free Documentation +License". + + This manual contains no Invariant Sections. The Front-Cover Texts +are (a) (see below), and the Back-Cover Texts are (b) (see below). + + (a) The FSF's Front-Cover Text is: + + A GNU Manual + + (b) The FSF's Back-Cover Text is: + + You have freedom to copy and modify this GNU Manual, like GNU +software. Copies published by the Free Software Foundation raise +funds for GNU development. + +INFO-DIR-SECTION Software development +START-INFO-DIR-ENTRY +* Cpp: (cpp). The GNU C preprocessor. +END-INFO-DIR-ENTRY + + +File: cpp.info, Node: Top, Next: Overview, Up: (dir) + +The C Preprocessor +****************** + +The C preprocessor implements the macro language used to transform C, +C++, and Objective-C programs before they are compiled. It can also be +useful on its own. + +* Menu: + +* Overview:: +* Header Files:: +* Macros:: +* Conditionals:: +* Diagnostics:: +* Line Control:: +* Pragmas:: +* Other Directives:: +* Preprocessor Output:: +* Traditional Mode:: +* Implementation Details:: +* Invocation:: +* Environment Variables:: +* GNU Free Documentation License:: +* Index of Directives:: +* Option Index:: +* Concept Index:: + + --- The Detailed Node Listing --- + +Overview + +* Character sets:: +* Initial processing:: +* Tokenization:: +* The preprocessing language:: + +Header Files + +* Include Syntax:: +* Include Operation:: +* Search Path:: +* Once-Only Headers:: +* Alternatives to Wrapper #ifndef:: +* Computed Includes:: +* Wrapper Headers:: +* System Headers:: + +Macros + +* Object-like Macros:: +* Function-like Macros:: +* Macro Arguments:: +* Stringification:: +* Concatenation:: +* Variadic Macros:: +* Predefined Macros:: +* Undefining and Redefining Macros:: +* Directives Within Macro Arguments:: +* Macro Pitfalls:: + +Predefined Macros + +* Standard Predefined Macros:: +* Common Predefined Macros:: +* System-specific Predefined Macros:: +* C++ Named Operators:: + +Macro Pitfalls + +* Misnesting:: +* Operator Precedence Problems:: +* Swallowing the Semicolon:: +* Duplication of Side Effects:: +* Self-Referential Macros:: +* Argument Prescan:: +* Newlines in Arguments:: + +Conditionals + +* Conditional Uses:: +* Conditional Syntax:: +* Deleted Code:: + +Conditional Syntax + +* Ifdef:: +* If:: +* Defined:: +* Else:: +* Elif:: + +Implementation Details + +* Implementation-defined behavior:: +* Implementation limits:: +* Obsolete Features:: +* Differences from previous versions:: + +Obsolete Features + +* Obsolete Features:: + + Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, +1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free +Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation. A copy of +the license is included in the section entitled "GNU Free Documentation +License". + + This manual contains no Invariant Sections. The Front-Cover Texts +are (a) (see below), and the Back-Cover Texts are (b) (see below). + + (a) The FSF's Front-Cover Text is: + + A GNU Manual + + (b) The FSF's Back-Cover Text is: + + You have freedom to copy and modify this GNU Manual, like GNU +software. Copies published by the Free Software Foundation raise +funds for GNU development. + + +File: cpp.info, Node: Overview, Next: Header Files, Prev: Top, Up: Top + +1 Overview +********** + +The C preprocessor, often known as "cpp", is a "macro processor" that +is used automatically by the C compiler to transform your program +before compilation. It is called a macro processor because it allows +you to define "macros", which are brief abbreviations for longer +constructs. + + The C preprocessor is intended to be used only with C, C++, and +Objective-C source code. In the past, it has been abused as a general +text processor. It will choke on input which does not obey C's lexical +rules. For example, apostrophes will be interpreted as the beginning of +character constants, and cause errors. Also, you cannot rely on it +preserving characteristics of the input which are not significant to +C-family languages. If a Makefile is preprocessed, all the hard tabs +will be removed, and the Makefile will not work. + + Having said that, you can often get away with using cpp on things +which are not C. Other Algol-ish programming languages are often safe +(Pascal, Ada, etc.) So is assembly, with caution. `-traditional-cpp' +mode preserves more white space, and is otherwise more permissive. Many +of the problems can be avoided by writing C or C++ style comments +instead of native language comments, and keeping macros simple. + + Wherever possible, you should use a preprocessor geared to the +language you are writing in. Modern versions of the GNU assembler have +macro facilities. Most high level programming languages have their own +conditional compilation and inclusion mechanism. If all else fails, +try a true general text processor, such as GNU M4. + + C preprocessors vary in some details. This manual discusses the GNU +C preprocessor, which provides a small superset of the features of ISO +Standard C. In its default mode, the GNU C preprocessor does not do a +few things required by the standard. These are features which are +rarely, if ever, used, and may cause surprising changes to the meaning +of a program which does not expect them. To get strict ISO Standard C, +you should use the `-std=c89' or `-std=c99' options, depending on which +version of the standard you want. To get all the mandatory +diagnostics, you must also use `-pedantic'. *Note Invocation::. + + This manual describes the behavior of the ISO preprocessor. To +minimize gratuitous differences, where the ISO preprocessor's behavior +does not conflict with traditional semantics, the traditional +preprocessor should behave the same way. The various differences that +do exist are detailed in the section *Note Traditional Mode::. + + For clarity, unless noted otherwise, references to `CPP' in this +manual refer to GNU CPP. + +* Menu: + +* Character sets:: +* Initial processing:: +* Tokenization:: +* The preprocessing language:: + + +File: cpp.info, Node: Character sets, Next: Initial processing, Up: Overview + +1.1 Character sets +================== + +Source code character set processing in C and related languages is +rather complicated. The C standard discusses two character sets, but +there are really at least four. + + The files input to CPP might be in any character set at all. CPP's +very first action, before it even looks for line boundaries, is to +convert the file into the character set it uses for internal +processing. That set is what the C standard calls the "source" +character set. It must be isomorphic with ISO 10646, also known as +Unicode. CPP uses the UTF-8 encoding of Unicode. + + The character sets of the input files are specified using the +`-finput-charset=' option. + + All preprocessing work (the subject of the rest of this manual) is +carried out in the source character set. If you request textual output +from the preprocessor with the `-E' option, it will be in UTF-8. + + After preprocessing is complete, string and character constants are +converted again, into the "execution" character set. This character +set is under control of the user; the default is UTF-8, matching the +source character set. Wide string and character constants have their +own character set, which is not called out specifically in the +standard. Again, it is under control of the user. The default is +UTF-16 or UTF-32, whichever fits in the target's `wchar_t' type, in the +target machine's byte order.(1) Octal and hexadecimal escape sequences +do not undergo conversion; '\x12' has the value 0x12 regardless of the +currently selected execution character set. All other escapes are +replaced by the character in the source character set that they +represent, then converted to the execution character set, just like +unescaped characters. + + Unless the experimental `-fextended-identifiers' option is used, GCC +does not permit the use of characters outside the ASCII range, nor `\u' +and `\U' escapes, in identifiers. Even with that option, characters +outside the ASCII range can only be specified with the `\u' and `\U' +escapes, not used directly in identifiers. + + ---------- Footnotes ---------- + + (1) UTF-16 does not meet the requirements of the C standard for a +wide character set, but the choice of 16-bit `wchar_t' is enshrined in +some system ABIs so we cannot fix this. + + +File: cpp.info, Node: Initial processing, Next: Tokenization, Prev: Character sets, Up: Overview + +1.2 Initial processing +====================== + +The preprocessor performs a series of textual transformations on its +input. These happen before all other processing. Conceptually, they +happen in a rigid order, and the entire file is run through each +transformation before the next one begins. CPP actually does them all +at once, for performance reasons. These transformations correspond +roughly to the first three "phases of translation" described in the C +standard. + + 1. The input file is read into memory and broken into lines. + + Different systems use different conventions to indicate the end of + a line. GCC accepts the ASCII control sequences `LF', `CR LF' and + `CR' as end-of-line markers. These are the canonical sequences + used by Unix, DOS and VMS, and the classic Mac OS (before OSX) + respectively. You may therefore safely copy source code written + on any of those systems to a different one and use it without + conversion. (GCC may lose track of the current line number if a + file doesn't consistently use one convention, as sometimes happens + when it is edited on computers with different conventions that + share a network file system.) + + If the last line of any input file lacks an end-of-line marker, + the end of the file is considered to implicitly supply one. The C + standard says that this condition provokes undefined behavior, so + GCC will emit a warning message. + + 2. If trigraphs are enabled, they are replaced by their corresponding + single characters. By default GCC ignores trigraphs, but if you + request a strictly conforming mode with the `-std' option, or you + specify the `-trigraphs' option, then it converts them. + + These are nine three-character sequences, all starting with `??', + that are defined by ISO C to stand for single characters. They + permit obsolete systems that lack some of C's punctuation to use + C. For example, `??/' stands for `\', so '??/n' is a character + constant for a newline. + + Trigraphs are not popular and many compilers implement them + incorrectly. Portable code should not rely on trigraphs being + either converted or ignored. With `-Wtrigraphs' GCC will warn you + when a trigraph may change the meaning of your program if it were + converted. *Note Wtrigraphs::. + + In a string constant, you can prevent a sequence of question marks + from being confused with a trigraph by inserting a backslash + between the question marks, or by separating the string literal at + the trigraph and making use of string literal concatenation. + "(??\?)" is the string `(???)', not `(?]'. Traditional C + compilers do not recognize these idioms. + + The nine trigraphs and their replacements are + + Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- + Replacement: [ ] { } # \ ^ | ~ + + 3. Continued lines are merged into one long line. + + A continued line is a line which ends with a backslash, `\'. The + backslash is removed and the following line is joined with the + current one. No space is inserted, so you may split a line + anywhere, even in the middle of a word. (It is generally more + readable to split lines only at white space.) + + The trailing backslash on a continued line is commonly referred to + as a "backslash-newline". + + If there is white space between a backslash and the end of a line, + that is still a continued line. However, as this is usually the + result of an editing mistake, and many compilers will not accept + it as a continued line, GCC will warn you about it. + + 4. All comments are replaced with single spaces. + + There are two kinds of comments. "Block comments" begin with `/*' + and continue until the next `*/'. Block comments do not nest: + + /* this is /* one comment */ text outside comment + + "Line comments" begin with `//' and continue to the end of the + current line. Line comments do not nest either, but it does not + matter, because they would end in the same place anyway. + + // this is // one comment + text outside comment + + It is safe to put line comments inside block comments, or vice versa. + + /* block comment + // contains line comment + yet more comment + */ outside comment + + // line comment /* contains block comment */ + + But beware of commenting out one end of a block comment with a line +comment. + + // l.c. /* block comment begins + oops! this isn't a comment anymore */ + + Comments are not recognized within string literals. "/* blah */" is +the string constant `/* blah */', not an empty string. + + Line comments are not in the 1989 edition of the C standard, but they +are recognized by GCC as an extension. In C++ and in the 1999 edition +of the C standard, they are an official part of the language. + + Since these transformations happen before all other processing, you +can split a line mechanically with backslash-newline anywhere. You can +comment out the end of a line. You can continue a line comment onto the +next line with backslash-newline. You can even split `/*', `*/', and +`//' onto multiple lines with backslash-newline. For example: + + /\ + * + */ # /* + */ defi\ + ne FO\ + O 10\ + 20 + +is equivalent to `#define FOO 1020'. All these tricks are extremely +confusing and should not be used in code intended to be readable. + + There is no way to prevent a backslash at the end of a line from +being interpreted as a backslash-newline. This cannot affect any +correct program, however. + + +File: cpp.info, Node: Tokenization, Next: The preprocessing language, Prev: Initial processing, Up: Overview + +1.3 Tokenization +================ + +After the textual transformations are finished, the input file is +converted into a sequence of "preprocessing tokens". These mostly +correspond to the syntactic tokens used by the C compiler, but there are +a few differences. White space separates tokens; it is not itself a +token of any kind. Tokens do not have to be separated by white space, +but it is often necessary to avoid ambiguities. + + When faced with a sequence of characters that has more than one +possible tokenization, the preprocessor is greedy. It always makes +each token, starting from the left, as big as possible before moving on +to the next token. For instance, `a+++++b' is interpreted as +`a ++ ++ + b', not as `a ++ + ++ b', even though the latter +tokenization could be part of a valid C program and the former could +not. + + Once the input file is broken into tokens, the token boundaries never +change, except when the `##' preprocessing operator is used to paste +tokens together. *Note Concatenation::. For example, + + #define foo() bar + foo()baz + ==> bar baz + _not_ + ==> barbaz + + The compiler does not re-tokenize the preprocessor's output. Each +preprocessing token becomes one compiler token. + + Preprocessing tokens fall into five broad classes: identifiers, +preprocessing numbers, string literals, punctuators, and other. An +"identifier" is the same as an identifier in C: any sequence of +letters, digits, or underscores, which begins with a letter or +underscore. Keywords of C have no significance to the preprocessor; +they are ordinary identifiers. You can define a macro whose name is a +keyword, for instance. The only identifier which can be considered a +preprocessing keyword is `defined'. *Note Defined::. + + This is mostly true of other languages which use the C preprocessor. +However, a few of the keywords of C++ are significant even in the +preprocessor. *Note C++ Named Operators::. + + In the 1999 C standard, identifiers may contain letters which are not +part of the "basic source character set", at the implementation's +discretion (such as accented Latin letters, Greek letters, or Chinese +ideograms). This may be done with an extended character set, or the +`\u' and `\U' escape sequences. The implementation of this feature in +GCC is experimental; such characters are only accepted in the `\u' and +`\U' forms and only if `-fextended-identifiers' is used. + + As an extension, GCC treats `$' as a letter. This is for +compatibility with some systems, such as VMS, where `$' is commonly +used in system-defined function and object names. `$' is not a letter +in strictly conforming mode, or if you specify the `-$' option. *Note +Invocation::. + + A "preprocessing number" has a rather bizarre definition. The +category includes all the normal integer and floating point constants +one expects of C, but also a number of other things one might not +initially recognize as a number. Formally, preprocessing numbers begin +with an optional period, a required decimal digit, and then continue +with any sequence of letters, digits, underscores, periods, and +exponents. Exponents are the two-character sequences `e+', `e-', `E+', +`E-', `p+', `p-', `P+', and `P-'. (The exponents that begin with `p' +or `P' are new to C99. They are used for hexadecimal floating-point +constants.) + + The purpose of this unusual definition is to isolate the preprocessor +from the full complexity of numeric constants. It does not have to +distinguish between lexically valid and invalid floating-point numbers, +which is complicated. The definition also permits you to split an +identifier at any position and get exactly two tokens, which can then be +pasted back together with the `##' operator. + + It's possible for preprocessing numbers to cause programs to be +misinterpreted. For example, `0xE+12' is a preprocessing number which +does not translate to any valid numeric constant, therefore a syntax +error. It does not mean `0xE + 12', which is what you might have +intended. + + "String literals" are string constants, character constants, and +header file names (the argument of `#include').(1) String constants +and character constants are straightforward: "..." or '...'. In either +case embedded quotes should be escaped with a backslash: '\'' is the +character constant for `''. There is no limit on the length of a +character constant, but the value of a character constant that contains +more than one character is implementation-defined. *Note +Implementation Details::. + + Header file names either look like string constants, "...", or are +written with angle brackets instead, <...>. In either case, backslash +is an ordinary character. There is no way to escape the closing quote +or angle bracket. The preprocessor looks for the header file in +different places depending on which form you use. *Note Include +Operation::. + + No string literal may extend past the end of a line. Older versions +of GCC accepted multi-line string constants. You may use continued +lines instead, or string constant concatenation. *Note Differences +from previous versions::. + + "Punctuators" are all the usual bits of punctuation which are +meaningful to C and C++. All but three of the punctuation characters in +ASCII are C punctuators. The exceptions are `@', `$', and ``'. In +addition, all the two- and three-character operators are punctuators. +There are also six "digraphs", which the C++ standard calls +"alternative tokens", which are merely alternate ways to spell other +punctuators. This is a second attempt to work around missing +punctuation in obsolete systems. It has no negative side effects, +unlike trigraphs, but does not cover as much ground. The digraphs and +their corresponding normal punctuators are: + + Digraph: <% %> <: :> %: %:%: + Punctuator: { } [ ] # ## + + Any other single character is considered "other". It is passed on to +the preprocessor's output unmolested. The C compiler will almost +certainly reject source code containing "other" tokens. In ASCII, the +only other characters are `@', `$', ``', and control characters other +than NUL (all bits zero). (Note that `$' is normally considered a +letter.) All characters with the high bit set (numeric range +0x7F-0xFF) are also "other" in the present implementation. This will +change when proper support for international character sets is added to +GCC. + + NUL is a special case because of the high probability that its +appearance is accidental, and because it may be invisible to the user +(many terminals do not display NUL at all). Within comments, NULs are +silently ignored, just as any other character would be. In running +text, NUL is considered white space. For example, these two directives +have the same meaning. + + #define X^@1 + #define X 1 + +(where `^@' is ASCII NUL). Within string or character constants, NULs +are preserved. In the latter two cases the preprocessor emits a +warning message. + + ---------- Footnotes ---------- + + (1) The C standard uses the term "string literal" to refer only to +what we are calling "string constants". + + +File: cpp.info, Node: The preprocessing language, Prev: Tokenization, Up: Overview + +1.4 The preprocessing language +============================== + +After tokenization, the stream of tokens may simply be passed straight +to the compiler's parser. However, if it contains any operations in the +"preprocessing language", it will be transformed first. This stage +corresponds roughly to the standard's "translation phase 4" and is what +most people think of as the preprocessor's job. + + The preprocessing language consists of "directives" to be executed +and "macros" to be expanded. Its primary capabilities are: + + * Inclusion of header files. These are files of declarations that + can be substituted into your program. + + * Macro expansion. You can define "macros", which are abbreviations + for arbitrary fragments of C code. The preprocessor will replace + the macros with their definitions throughout the program. Some + macros are automatically defined for you. + + * Conditional compilation. You can include or exclude parts of the + program according to various conditions. + + * Line control. If you use a program to combine or rearrange source + files into an intermediate file which is then compiled, you can + use line control to inform the compiler where each source line + originally came from. + + * Diagnostics. You can detect problems at compile time and issue + errors or warnings. + + There are a few more, less useful, features. + + Except for expansion of predefined macros, all these operations are +triggered with "preprocessing directives". Preprocessing directives +are lines in your program that start with `#'. Whitespace is allowed +before and after the `#'. The `#' is followed by an identifier, the +"directive name". It specifies the operation to perform. Directives +are commonly referred to as `#NAME' where NAME is the directive name. +For example, `#define' is the directive that defines a macro. + + The `#' which begins a directive cannot come from a macro expansion. +Also, the directive name is not macro expanded. Thus, if `foo' is +defined as a macro expanding to `define', that does not make `#foo' a +valid preprocessing directive. + + The set of valid directive names is fixed. Programs cannot define +new preprocessing directives. + + Some directives require arguments; these make up the rest of the +directive line and must be separated from the directive name by +whitespace. For example, `#define' must be followed by a macro name +and the intended expansion of the macro. + + A preprocessing directive cannot cover more than one line. The line +may, however, be continued with backslash-newline, or by a block comment +which extends past the end of the line. In either case, when the +directive is processed, the continuations have already been merged with +the first line to make one long line. + + +File: cpp.info, Node: Header Files, Next: Macros, Prev: Overview, Up: Top + +2 Header Files +************** + +A header file is a file containing C declarations and macro definitions +(*note Macros::) to be shared between several source files. You request +the use of a header file in your program by "including" it, with the C +preprocessing directive `#include'. + + Header files serve two purposes. + + * System header files declare the interfaces to parts of the + operating system. You include them in your program to supply the + definitions and declarations you need to invoke system calls and + libraries. + + * Your own header files contain declarations for interfaces between + the source files of your program. Each time you have a group of + related declarations and macro definitions all or most of which + are needed in several different source files, it is a good idea to + create a header file for them. + + Including a header file produces the same results as copying the +header file into each source file that needs it. Such copying would be +time-consuming and error-prone. With a header file, the related +declarations appear in only one place. If they need to be changed, they +can be changed in one place, and programs that include the header file +will automatically use the new version when next recompiled. The header +file eliminates the labor of finding and changing all the copies as well +as the risk that a failure to find one copy will result in +inconsistencies within a program. + + In C, the usual convention is to give header files names that end +with `.h'. It is most portable to use only letters, digits, dashes, and +underscores in header file names, and at most one dot. + +* Menu: + +* Include Syntax:: +* Include Operation:: +* Search Path:: +* Once-Only Headers:: +* Alternatives to Wrapper #ifndef:: +* Computed Includes:: +* Wrapper Headers:: +* System Headers:: + + +File: cpp.info, Node: Include Syntax, Next: Include Operation, Up: Header Files + +2.1 Include Syntax +================== + +Both user and system header files are included using the preprocessing +directive `#include'. It has two variants: + +`#include ' + This variant is used for system header files. It searches for a + file named FILE in a standard list of system directories. You can + prepend directories to this list with the `-I' option (*note + Invocation::). + +`#include "FILE"' + This variant is used for header files of your own program. It + searches for a file named FILE first in the directory containing + the current file, then in the quote directories and then the same + directories used for `'. You can prepend directories to the + list of quote directories with the `-iquote' option. + + The argument of `#include', whether delimited with quote marks or +angle brackets, behaves like a string constant in that comments are not +recognized, and macro names are not expanded. Thus, `#include ' +specifies inclusion of a system header file named `x/*y'. + + However, if backslashes occur within FILE, they are considered +ordinary text characters, not escape characters. None of the character +escape sequences appropriate to string constants in C are processed. +Thus, `#include "x\n\\y"' specifies a filename containing three +backslashes. (Some systems interpret `\' as a pathname separator. All +of these also interpret `/' the same way. It is most portable to use +only `/'.) + + It is an error if there is anything (other than comments) on the line +after the file name. + + +File: cpp.info, Node: Include Operation, Next: Search Path, Prev: Include Syntax, Up: Header Files + +2.2 Include Operation +===================== + +The `#include' directive works by directing the C preprocessor to scan +the specified file as input before continuing with the rest of the +current file. The output from the preprocessor contains the output +already generated, followed by the output resulting from the included +file, followed by the output that comes from the text after the +`#include' directive. For example, if you have a header file +`header.h' as follows, + + char *test (void); + +and a main program called `program.c' that uses the header file, like +this, + + int x; + #include "header.h" + + int + main (void) + { + puts (test ()); + } + +the compiler will see the same token stream as it would if `program.c' +read + + int x; + char *test (void); + + int + main (void) + { + puts (test ()); + } + + Included files are not limited to declarations and macro definitions; +those are merely the typical uses. Any fragment of a C program can be +included from another file. The include file could even contain the +beginning of a statement that is concluded in the containing file, or +the end of a statement that was started in the including file. However, +an included file must consist of complete tokens. Comments and string +literals which have not been closed by the end of an included file are +invalid. For error recovery, they are considered to end at the end of +the file. + + To avoid confusion, it is best if header files contain only complete +syntactic units--function declarations or definitions, type +declarations, etc. + + The line following the `#include' directive is always treated as a +separate line by the C preprocessor, even if the included file lacks a +final newline. + + +File: cpp.info, Node: Search Path, Next: Once-Only Headers, Prev: Include Operation, Up: Header Files + +2.3 Search Path +=============== + +GCC looks in several different places for headers. On a normal Unix +system, if you do not instruct it otherwise, it will look for headers +requested with `#include ' in: + + /usr/local/include + LIBDIR/gcc/TARGET/VERSION/include + /usr/TARGET/include + /usr/include + + For C++ programs, it will also look in `/usr/include/g++-v3', first. +In the above, TARGET is the canonical name of the system GCC was +configured to compile code for; often but not always the same as the +canonical name of the system it runs on. VERSION is the version of GCC +in use. + + You can add to this list with the `-IDIR' command line option. All +the directories named by `-I' are searched, in left-to-right order, +_before_ the default directories. The only exception is when `dir' is +already searched by default. In this case, the option is ignored and +the search order for system directories remains unchanged. + + Duplicate directories are removed from the quote and bracket search +chains before the two chains are merged to make the final search chain. +Thus, it is possible for a directory to occur twice in the final search +chain if it was specified in both the quote and bracket chains. + + You can prevent GCC from searching any of the default directories +with the `-nostdinc' option. This is useful when you are compiling an +operating system kernel or some other program that does not use the +standard C library facilities, or the standard C library itself. `-I' +options are not ignored as described above when `-nostdinc' is in +effect. + + GCC looks for headers requested with `#include "FILE"' first in the +directory containing the current file, then in the directories as +specified by `-iquote' options, then in the same places it would have +looked for a header requested with angle brackets. For example, if +`/usr/include/sys/stat.h' contains `#include "types.h"', GCC looks for +`types.h' first in `/usr/include/sys', then in its usual search path. + + `#line' (*note Line Control::) does not change GCC's idea of the +directory containing the current file. + + You may put `-I-' at any point in your list of `-I' options. This +has two effects. First, directories appearing before the `-I-' in the +list are searched only for headers requested with quote marks. +Directories after `-I-' are searched for all headers. Second, the +directory containing the current file is not searched for anything, +unless it happens to be one of the directories named by an `-I' switch. +`-I-' is deprecated, `-iquote' should be used instead. + + `-I. -I-' is not the same as no `-I' options at all, and does not +cause the same behavior for `<>' includes that `""' includes get with +no special options. `-I.' searches the compiler's current working +directory for header files. That may or may not be the same as the +directory containing the current file. + + If you need to look for headers in a directory named `-', write +`-I./-'. + + There are several more ways to adjust the header search path. They +are generally less useful. *Note Invocation::. + + +File: cpp.info, Node: Once-Only Headers, Next: Alternatives to Wrapper #ifndef, Prev: Search Path, Up: Header Files + +2.4 Once-Only Headers +===================== + +If a header file happens to be included twice, the compiler will process +its contents twice. This is very likely to cause an error, e.g. when +the compiler sees the same structure definition twice. Even if it does +not, it will certainly waste time. + + The standard way to prevent this is to enclose the entire real +contents of the file in a conditional, like this: + + /* File foo. */ + #ifndef FILE_FOO_SEEN + #define FILE_FOO_SEEN + + THE ENTIRE FILE + + #endif /* !FILE_FOO_SEEN */ + + This construct is commonly known as a "wrapper #ifndef". When the +header is included again, the conditional will be false, because +`FILE_FOO_SEEN' is defined. The preprocessor will skip over the entire +contents of the file, and the compiler will not see it twice. + + CPP optimizes even further. It remembers when a header file has a +wrapper `#ifndef'. If a subsequent `#include' specifies that header, +and the macro in the `#ifndef' is still defined, it does not bother to +rescan the file at all. + + You can put comments outside the wrapper. They will not interfere +with this optimization. + + The macro `FILE_FOO_SEEN' is called the "controlling macro" or +"guard macro". In a user header file, the macro name should not begin +with `_'. In a system header file, it should begin with `__' to avoid +conflicts with user programs. In any kind of header file, the macro +name should contain the name of the file and some additional text, to +avoid conflicts with other header files. + + +File: cpp.info, Node: Alternatives to Wrapper #ifndef, Next: Computed Includes, Prev: Once-Only Headers, Up: Header Files + +2.5 Alternatives to Wrapper #ifndef +=================================== + +CPP supports two more ways of indicating that a header file should be +read only once. Neither one is as portable as a wrapper `#ifndef' and +we recommend you do not use them in new programs, with the caveat that +`#import' is standard practice in Objective-C. + + CPP supports a variant of `#include' called `#import' which includes +a file, but does so at most once. If you use `#import' instead of +`#include', then you don't need the conditionals inside the header file +to prevent multiple inclusion of the contents. `#import' is standard +in Objective-C, but is considered a deprecated extension in C and C++. + + `#import' is not a well designed feature. It requires the users of +a header file to know that it should only be included once. It is much +better for the header file's implementor to write the file so that users +don't need to know this. Using a wrapper `#ifndef' accomplishes this +goal. + + In the present implementation, a single use of `#import' will +prevent the file from ever being read again, by either `#import' or +`#include'. You should not rely on this; do not use both `#import' and +`#include' to refer to the same header file. + + Another way to prevent a header file from being included more than +once is with the `#pragma once' directive. If `#pragma once' is seen +when scanning a header file, that file will never be read again, no +matter what. + + `#pragma once' does not have the problems that `#import' does, but +it is not recognized by all preprocessors, so you cannot rely on it in +a portable program. + + +File: cpp.info, Node: Computed Includes, Next: Wrapper Headers, Prev: Alternatives to Wrapper #ifndef, Up: Header Files + +2.6 Computed Includes +===================== + +Sometimes it is necessary to select one of several different header +files to be included into your program. They might specify +configuration parameters to be used on different sorts of operating +systems, for instance. You could do this with a series of conditionals, + + #if SYSTEM_1 + # include "system_1.h" + #elif SYSTEM_2 + # include "system_2.h" + #elif SYSTEM_3 + ... + #endif + + That rapidly becomes tedious. Instead, the preprocessor offers the +ability to use a macro for the header name. This is called a "computed +include". Instead of writing a header name as the direct argument of +`#include', you simply put a macro name there instead: + + #define SYSTEM_H "system_1.h" + ... + #include SYSTEM_H + +`SYSTEM_H' will be expanded, and the preprocessor will look for +`system_1.h' as if the `#include' had been written that way originally. +`SYSTEM_H' could be defined by your Makefile with a `-D' option. + + You must be careful when you define the macro. `#define' saves +tokens, not text. The preprocessor has no way of knowing that the macro +will be used as the argument of `#include', so it generates ordinary +tokens, not a header name. This is unlikely to cause problems if you +use double-quote includes, which are close enough to string constants. +If you use angle brackets, however, you may have trouble. + + The syntax of a computed include is actually a bit more general than +the above. If the first non-whitespace character after `#include' is +not `"' or `<', then the entire line is macro-expanded like running +text would be. + + If the line expands to a single string constant, the contents of that +string constant are the file to be included. CPP does not re-examine +the string for embedded quotes, but neither does it process backslash +escapes in the string. Therefore + + #define HEADER "a\"b" + #include HEADER + +looks for a file named `a\"b'. CPP searches for the file according to +the rules for double-quoted includes. + + If the line expands to a token stream beginning with a `<' token and +including a `>' token, then the tokens between the `<' and the first +`>' are combined to form the filename to be included. Any whitespace +between tokens is reduced to a single space; then any space after the +initial `<' is retained, but a trailing space before the closing `>' is +ignored. CPP searches for the file according to the rules for +angle-bracket includes. + + In either case, if there are any tokens on the line after the file +name, an error occurs and the directive is not processed. It is also +an error if the result of expansion does not match either of the two +expected forms. + + These rules are implementation-defined behavior according to the C +standard. To minimize the risk of different compilers interpreting your +computed includes differently, we recommend you use only a single +object-like macro which expands to a string constant. This will also +minimize confusion for people reading your program. + + +File: cpp.info, Node: Wrapper Headers, Next: System Headers, Prev: Computed Includes, Up: Header Files + +2.7 Wrapper Headers +=================== + +Sometimes it is necessary to adjust the contents of a system-provided +header file without editing it directly. GCC's `fixincludes' operation +does this, for example. One way to do that would be to create a new +header file with the same name and insert it in the search path before +the original header. That works fine as long as you're willing to +replace the old header entirely. But what if you want to refer to the +old header from the new one? + + You cannot simply include the old header with `#include'. That will +start from the beginning, and find your new header again. If your +header is not protected from multiple inclusion (*note Once-Only +Headers::), it will recurse infinitely and cause a fatal error. + + You could include the old header with an absolute pathname: + #include "/usr/include/old-header.h" + This works, but is not clean; should the system headers ever move, +you would have to edit the new headers to match. + + There is no way to solve this problem within the C standard, but you +can use the GNU extension `#include_next'. It means, "Include the +_next_ file with this name". This directive works like `#include' +except in searching for the specified file: it starts searching the +list of header file directories _after_ the directory in which the +current file was found. + + Suppose you specify `-I /usr/local/include', and the list of +directories to search also includes `/usr/include'; and suppose both +directories contain `signal.h'. Ordinary `#include ' finds +the file under `/usr/local/include'. If that file contains +`#include_next ', it starts searching after that directory, +and finds the file in `/usr/include'. + + `#include_next' does not distinguish between `' and `"FILE"' +inclusion, nor does it check that the file you specify has the same +name as the current file. It simply looks for the file named, starting +with the directory in the search path after the one where the current +file was found. + + The use of `#include_next' can lead to great confusion. We +recommend it be used only when there is no other alternative. In +particular, it should not be used in the headers belonging to a specific +program; it should be used only to make global corrections along the +lines of `fixincludes'. + + +File: cpp.info, Node: System Headers, Prev: Wrapper Headers, Up: Header Files + +2.8 System Headers +================== + +The header files declaring interfaces to the operating system and +runtime libraries often cannot be written in strictly conforming C. +Therefore, GCC gives code found in "system headers" special treatment. +All warnings, other than those generated by `#warning' (*note +Diagnostics::), are suppressed while GCC is processing a system header. +Macros defined in a system header are immune to a few warnings +wherever they are expanded. This immunity is granted on an ad-hoc +basis, when we find that a warning generates lots of false positives +because of code in macros defined in system headers. + + Normally, only the headers found in specific directories are +considered system headers. These directories are determined when GCC +is compiled. There are, however, two ways to make normal headers into +system headers. + + The `-isystem' command line option adds its argument to the list of +directories to search for headers, just like `-I'. Any headers found +in that directory will be considered system headers. + + All directories named by `-isystem' are searched _after_ all +directories named by `-I', no matter what their order was on the +command line. If the same directory is named by both `-I' and +`-isystem', the `-I' option is ignored. GCC provides an informative +message when this occurs if `-v' is used. + + There is also a directive, `#pragma GCC system_header', which tells +GCC to consider the rest of the current include file a system header, +no matter where it was found. Code that comes before the `#pragma' in +the file will not be affected. `#pragma GCC system_header' has no +effect in the primary source file. + + On very old systems, some of the pre-defined system header +directories get even more special treatment. GNU C++ considers code in +headers found in those directories to be surrounded by an `extern "C"' +block. There is no way to request this behavior with a `#pragma', or +from the command line. + + +File: cpp.info, Node: Macros, Next: Conditionals, Prev: Header Files, Up: Top + +3 Macros +******** + +A "macro" is a fragment of code which has been given a name. Whenever +the name is used, it is replaced by the contents of the macro. There +are two kinds of macros. They differ mostly in what they look like +when they are used. "Object-like" macros resemble data objects when +used, "function-like" macros resemble function calls. + + You may define any valid identifier as a macro, even if it is a C +keyword. The preprocessor does not know anything about keywords. This +can be useful if you wish to hide a keyword such as `const' from an +older compiler that does not understand it. However, the preprocessor +operator `defined' (*note Defined::) can never be defined as a macro, +and C++'s named operators (*note C++ Named Operators::) cannot be +macros when you are compiling C++. + +* Menu: + +* Object-like Macros:: +* Function-like Macros:: +* Macro Arguments:: +* Stringification:: +* Concatenation:: +* Variadic Macros:: +* Predefined Macros:: +* Undefining and Redefining Macros:: +* Directives Within Macro Arguments:: +* Macro Pitfalls:: + + +File: cpp.info, Node: Object-like Macros, Next: Function-like Macros, Up: Macros + +3.1 Object-like Macros +====================== + +An "object-like macro" is a simple identifier which will be replaced by +a code fragment. It is called object-like because it looks like a data +object in code that uses it. They are most commonly used to give +symbolic names to numeric constants. + + You create macros with the `#define' directive. `#define' is +followed by the name of the macro and then the token sequence it should +be an abbreviation for, which is variously referred to as the macro's +"body", "expansion" or "replacement list". For example, + + #define BUFFER_SIZE 1024 + +defines a macro named `BUFFER_SIZE' as an abbreviation for the token +`1024'. If somewhere after this `#define' directive there comes a C +statement of the form + + foo = (char *) malloc (BUFFER_SIZE); + +then the C preprocessor will recognize and "expand" the macro +`BUFFER_SIZE'. The C compiler will see the same tokens as it would if +you had written + + foo = (char *) malloc (1024); + + By convention, macro names are written in uppercase. Programs are +easier to read when it is possible to tell at a glance which names are +macros. + + The macro's body ends at the end of the `#define' line. You may +continue the definition onto multiple lines, if necessary, using +backslash-newline. When the macro is expanded, however, it will all +come out on one line. For example, + + #define NUMBERS 1, \ + 2, \ + 3 + int x[] = { NUMBERS }; + ==> int x[] = { 1, 2, 3 }; + +The most common visible consequence of this is surprising line numbers +in error messages. + + There is no restriction on what can go in a macro body provided it +decomposes into valid preprocessing tokens. Parentheses need not +balance, and the body need not resemble valid C code. (If it does not, +you may get error messages from the C compiler when you use the macro.) + + The C preprocessor scans your program sequentially. Macro +definitions take effect at the place you write them. Therefore, the +following input to the C preprocessor + + foo = X; + #define X 4 + bar = X; + +produces + + foo = X; + bar = 4; + + When the preprocessor expands a macro name, the macro's expansion +replaces the macro invocation, then the expansion is examined for more +macros to expand. For example, + + #define TABLESIZE BUFSIZE + #define BUFSIZE 1024 + TABLESIZE + ==> BUFSIZE + ==> 1024 + +`TABLESIZE' is expanded first to produce `BUFSIZE', then that macro is +expanded to produce the final result, `1024'. + + Notice that `BUFSIZE' was not defined when `TABLESIZE' was defined. +The `#define' for `TABLESIZE' uses exactly the expansion you +specify--in this case, `BUFSIZE'--and does not check to see whether it +too contains macro names. Only when you _use_ `TABLESIZE' is the +result of its expansion scanned for more macro names. + + This makes a difference if you change the definition of `BUFSIZE' at +some point in the source file. `TABLESIZE', defined as shown, will +always expand using the definition of `BUFSIZE' that is currently in +effect: + + #define BUFSIZE 1020 + #define TABLESIZE BUFSIZE + #undef BUFSIZE + #define BUFSIZE 37 + +Now `TABLESIZE' expands (in two stages) to `37'. + + If the expansion of a macro contains its own name, either directly or +via intermediate macros, it is not expanded again when the expansion is +examined for more macros. This prevents infinite recursion. *Note +Self-Referential Macros::, for the precise details. + + +File: cpp.info, Node: Function-like Macros, Next: Macro Arguments, Prev: Object-like Macros, Up: Macros + +3.2 Function-like Macros +======================== + +You can also define macros whose use looks like a function call. These +are called "function-like macros". To define a function-like macro, +you use the same `#define' directive, but you put a pair of parentheses +immediately after the macro name. For example, + + #define lang_init() c_init() + lang_init() + ==> c_init() + + A function-like macro is only expanded if its name appears with a +pair of parentheses after it. If you write just the name, it is left +alone. This can be useful when you have a function and a macro of the +same name, and you wish to use the function sometimes. + + extern void foo(void); + #define foo() /* optimized inline version */ + ... + foo(); + funcptr = foo; + + Here the call to `foo()' will use the macro, but the function +pointer will get the address of the real function. If the macro were to +be expanded, it would cause a syntax error. + + If you put spaces between the macro name and the parentheses in the +macro definition, that does not define a function-like macro, it defines +an object-like macro whose expansion happens to begin with a pair of +parentheses. + + #define lang_init () c_init() + lang_init() + ==> () c_init()() + + The first two pairs of parentheses in this expansion come from the +macro. The third is the pair that was originally after the macro +invocation. Since `lang_init' is an object-like macro, it does not +consume those parentheses. + + +File: cpp.info, Node: Macro Arguments, Next: Stringification, Prev: Function-like Macros, Up: Macros + +3.3 Macro Arguments +=================== + +Function-like macros can take "arguments", just like true functions. +To define a macro that uses arguments, you insert "parameters" between +the pair of parentheses in the macro definition that make the macro +function-like. The parameters must be valid C identifiers, separated +by commas and optionally whitespace. + + To invoke a macro that takes arguments, you write the name of the +macro followed by a list of "actual arguments" in parentheses, separated +by commas. The invocation of the macro need not be restricted to a +single logical line--it can cross as many lines in the source file as +you wish. The number of arguments you give must match the number of +parameters in the macro definition. When the macro is expanded, each +use of a parameter in its body is replaced by the tokens of the +corresponding argument. (You need not use all of the parameters in the +macro body.) + + As an example, here is a macro that computes the minimum of two +numeric values, as it is defined in many C programs, and some uses. + + #define min(X, Y) ((X) < (Y) ? (X) : (Y)) + x = min(a, b); ==> x = ((a) < (b) ? (a) : (b)); + y = min(1, 2); ==> y = ((1) < (2) ? (1) : (2)); + z = min(a + 28, *p); ==> z = ((a + 28) < (*p) ? (a + 28) : (*p)); + +(In this small example you can already see several of the dangers of +macro arguments. *Note Macro Pitfalls::, for detailed explanations.) + + Leading and trailing whitespace in each argument is dropped, and all +whitespace between the tokens of an argument is reduced to a single +space. Parentheses within each argument must balance; a comma within +such parentheses does not end the argument. However, there is no +requirement for square brackets or braces to balance, and they do not +prevent a comma from separating arguments. Thus, + + macro (array[x = y, x + 1]) + +passes two arguments to `macro': `array[x = y' and `x + 1]'. If you +want to supply `array[x = y, x + 1]' as an argument, you can write it +as `array[(x = y, x + 1)]', which is equivalent C code. + + All arguments to a macro are completely macro-expanded before they +are substituted into the macro body. After substitution, the complete +text is scanned again for macros to expand, including the arguments. +This rule may seem strange, but it is carefully designed so you need +not worry about whether any function call is actually a macro +invocation. You can run into trouble if you try to be too clever, +though. *Note Argument Prescan::, for detailed discussion. + + For example, `min (min (a, b), c)' is first expanded to + + min (((a) < (b) ? (a) : (b)), (c)) + +and then to + + ((((a) < (b) ? (a) : (b))) < (c) + ? (((a) < (b) ? (a) : (b))) + : (c)) + +(Line breaks shown here for clarity would not actually be generated.) + + You can leave macro arguments empty; this is not an error to the +preprocessor (but many macros will then expand to invalid code). You +cannot leave out arguments entirely; if a macro takes two arguments, +there must be exactly one comma at the top level of its argument list. +Here are some silly examples using `min': + + min(, b) ==> (( ) < (b) ? ( ) : (b)) + min(a, ) ==> ((a ) < ( ) ? (a ) : ( )) + min(,) ==> (( ) < ( ) ? ( ) : ( )) + min((,),) ==> (((,)) < ( ) ? ((,)) : ( )) + + min() error--> macro "min" requires 2 arguments, but only 1 given + min(,,) error--> macro "min" passed 3 arguments, but takes just 2 + + Whitespace is not a preprocessing token, so if a macro `foo' takes +one argument, `foo ()' and `foo ( )' both supply it an empty argument. +Previous GNU preprocessor implementations and documentation were +incorrect on this point, insisting that a function-like macro that +takes a single argument be passed a space if an empty argument was +required. + + Macro parameters appearing inside string literals are not replaced by +their corresponding actual arguments. + + #define foo(x) x, "x" + foo(bar) ==> bar, "x" + + +File: cpp.info, Node: Stringification, Next: Concatenation, Prev: Macro Arguments, Up: Macros + +3.4 Stringification +=================== + +Sometimes you may want to convert a macro argument into a string +constant. Parameters are not replaced inside string constants, but you +can use the `#' preprocessing operator instead. When a macro parameter +is used with a leading `#', the preprocessor replaces it with the +literal text of the actual argument, converted to a string constant. +Unlike normal parameter replacement, the argument is not macro-expanded +first. This is called "stringification". + + There is no way to combine an argument with surrounding text and +stringify it all together. Instead, you can write a series of adjacent +string constants and stringified arguments. The preprocessor will +replace the stringified arguments with string constants. The C +compiler will then combine all the adjacent string constants into one +long string. + + Here is an example of a macro definition that uses stringification: + + #define WARN_IF(EXP) \ + do { if (EXP) \ + fprintf (stderr, "Warning: " #EXP "\n"); } \ + while (0) + WARN_IF (x == 0); + ==> do { if (x == 0) + fprintf (stderr, "Warning: " "x == 0" "\n"); } while (0); + +The argument for `EXP' is substituted once, as-is, into the `if' +statement, and once, stringified, into the argument to `fprintf'. If +`x' were a macro, it would be expanded in the `if' statement, but not +in the string. + + The `do' and `while (0)' are a kludge to make it possible to write +`WARN_IF (ARG);', which the resemblance of `WARN_IF' to a function +would make C programmers want to do; see *Note Swallowing the +Semicolon::. + + Stringification in C involves more than putting double-quote +characters around the fragment. The preprocessor backslash-escapes the +quotes surrounding embedded string constants, and all backslashes +within string and character constants, in order to get a valid C string +constant with the proper contents. Thus, stringifying `p = "foo\n";' +results in "p = \"foo\\n\";". However, backslashes that are not inside +string or character constants are not duplicated: `\n' by itself +stringifies to "\n". + + All leading and trailing whitespace in text being stringified is +ignored. Any sequence of whitespace in the middle of the text is +converted to a single space in the stringified result. Comments are +replaced by whitespace long before stringification happens, so they +never appear in stringified text. + + There is no way to convert a macro argument into a character +constant. + + If you want to stringify the result of expansion of a macro argument, +you have to use two levels of macros. + + #define xstr(s) str(s) + #define str(s) #s + #define foo 4 + str (foo) + ==> "foo" + xstr (foo) + ==> xstr (4) + ==> str (4) + ==> "4" + + `s' is stringified when it is used in `str', so it is not +macro-expanded first. But `s' is an ordinary argument to `xstr', so it +is completely macro-expanded before `xstr' itself is expanded (*note +Argument Prescan::). Therefore, by the time `str' gets to its +argument, it has already been macro-expanded. + + +File: cpp.info, Node: Concatenation, Next: Variadic Macros, Prev: Stringification, Up: Macros + +3.5 Concatenation +================= + +It is often useful to merge two tokens into one while expanding macros. +This is called "token pasting" or "token concatenation". The `##' +preprocessing operator performs token pasting. When a macro is +expanded, the two tokens on either side of each `##' operator are +combined into a single token, which then replaces the `##' and the two +original tokens in the macro expansion. Usually both will be +identifiers, or one will be an identifier and the other a preprocessing +number. When pasted, they make a longer identifier. This isn't the +only valid case. It is also possible to concatenate two numbers (or a +number and a name, such as `1.5' and `e3') into a number. Also, +multi-character operators such as `+=' can be formed by token pasting. + + However, two tokens that don't together form a valid token cannot be +pasted together. For example, you cannot concatenate `x' with `+' in +either order. If you try, the preprocessor issues a warning and emits +the two tokens. Whether it puts white space between the tokens is +undefined. It is common to find unnecessary uses of `##' in complex +macros. If you get this warning, it is likely that you can simply +remove the `##'. + + Both the tokens combined by `##' could come from the macro body, but +you could just as well write them as one token in the first place. +Token pasting is most useful when one or both of the tokens comes from a +macro argument. If either of the tokens next to an `##' is a parameter +name, it is replaced by its actual argument before `##' executes. As +with stringification, the actual argument is not macro-expanded first. +If the argument is empty, that `##' has no effect. + + Keep in mind that the C preprocessor converts comments to whitespace +before macros are even considered. Therefore, you cannot create a +comment by concatenating `/' and `*'. You can put as much whitespace +between `##' and its operands as you like, including comments, and you +can put comments in arguments that will be concatenated. However, it +is an error if `##' appears at either end of a macro body. + + Consider a C program that interprets named commands. There probably +needs to be a table of commands, perhaps an array of structures declared +as follows: + + struct command + { + char *name; + void (*function) (void); + }; + + struct command commands[] = + { + { "quit", quit_command }, + { "help", help_command }, + ... + }; + + It would be cleaner not to have to give each command name twice, +once in the string constant and once in the function name. A macro +which takes the name of a command as an argument can make this +unnecessary. The string constant can be created with stringification, +and the function name by concatenating the argument with `_command'. +Here is how it is done: + + #define COMMAND(NAME) { #NAME, NAME ## _command } + + struct command commands[] = + { + COMMAND (quit), + COMMAND (help), + ... + }; + + +File: cpp.info, Node: Variadic Macros, Next: Predefined Macros, Prev: Concatenation, Up: Macros + +3.6 Variadic Macros +=================== + +A macro can be declared to accept a variable number of arguments much as +a function can. The syntax for defining the macro is similar to that of +a function. Here is an example: + + #define eprintf(...) fprintf (stderr, __VA_ARGS__) + + This kind of macro is called "variadic". When the macro is invoked, +all the tokens in its argument list after the last named argument (this +macro has none), including any commas, become the "variable argument". +This sequence of tokens replaces the identifier `__VA_ARGS__' in the +macro body wherever it appears. Thus, we have this expansion: + + eprintf ("%s:%d: ", input_file, lineno) + ==> fprintf (stderr, "%s:%d: ", input_file, lineno) + + The variable argument is completely macro-expanded before it is +inserted into the macro expansion, just like an ordinary argument. You +may use the `#' and `##' operators to stringify the variable argument +or to paste its leading or trailing token with another token. (But see +below for an important special case for `##'.) + + If your macro is complicated, you may want a more descriptive name +for the variable argument than `__VA_ARGS__'. CPP permits this, as an +extension. You may write an argument name immediately before the +`...'; that name is used for the variable argument. The `eprintf' +macro above could be written + + #define eprintf(args...) fprintf (stderr, args) + +using this extension. You cannot use `__VA_ARGS__' and this extension +in the same macro. + + You can have named arguments as well as variable arguments in a +variadic macro. We could define `eprintf' like this, instead: + + #define eprintf(format, ...) fprintf (stderr, format, __VA_ARGS__) + +This formulation looks more descriptive, but unfortunately it is less +flexible: you must now supply at least one argument after the format +string. In standard C, you cannot omit the comma separating the named +argument from the variable arguments. Furthermore, if you leave the +variable argument empty, you will get a syntax error, because there +will be an extra comma after the format string. + + eprintf("success!\n", ); + ==> fprintf(stderr, "success!\n", ); + + GNU CPP has a pair of extensions which deal with this problem. +First, you are allowed to leave the variable argument out entirely: + + eprintf ("success!\n") + ==> fprintf(stderr, "success!\n", ); + +Second, the `##' token paste operator has a special meaning when placed +between a comma and a variable argument. If you write + + #define eprintf(format, ...) fprintf (stderr, format, ##__VA_ARGS__) + +and the variable argument is left out when the `eprintf' macro is used, +then the comma before the `##' will be deleted. This does _not_ happen +if you pass an empty argument, nor does it happen if the token +preceding `##' is anything other than a comma. + + eprintf ("success!\n") + ==> fprintf(stderr, "success!\n"); + +The above explanation is ambiguous about the case where the only macro +parameter is a variable arguments parameter, as it is meaningless to +try to distinguish whether no argument at all is an empty argument or a +missing argument. In this case the C99 standard is clear that the +comma must remain, however the existing GCC extension used to swallow +the comma. So CPP retains the comma when conforming to a specific C +standard, and drops it otherwise. + + C99 mandates that the only place the identifier `__VA_ARGS__' can +appear is in the replacement list of a variadic macro. It may not be +used as a macro name, macro argument name, or within a different type +of macro. It may also be forbidden in open text; the standard is +ambiguous. We recommend you avoid using it except for its defined +purpose. + + Variadic macros are a new feature in C99. GNU CPP has supported them +for a long time, but only with a named variable argument (`args...', +not `...' and `__VA_ARGS__'). If you are concerned with portability to +previous versions of GCC, you should use only named variable arguments. +On the other hand, if you are concerned with portability to other +conforming implementations of C99, you should use only `__VA_ARGS__'. + + Previous versions of CPP implemented the comma-deletion extension +much more generally. We have restricted it in this release to minimize +the differences from C99. To get the same effect with both this and +previous versions of GCC, the token preceding the special `##' must be +a comma, and there must be white space between that comma and whatever +comes immediately before it: + + #define eprintf(format, args...) fprintf (stderr, format , ##args) + +*Note Differences from previous versions::, for the gory details. + + +File: cpp.info, Node: Predefined Macros, Next: Undefining and Redefining Macros, Prev: Variadic Macros, Up: Macros + +3.7 Predefined Macros +===================== + +Several object-like macros are predefined; you use them without +supplying their definitions. They fall into three classes: standard, +common, and system-specific. + + In C++, there is a fourth category, the named operators. They act +like predefined macros, but you cannot undefine them. + +* Menu: + +* Standard Predefined Macros:: +* Common Predefined Macros:: +* System-specific Predefined Macros:: +* C++ Named Operators:: + + +File: cpp.info, Node: Standard Predefined Macros, Next: Common Predefined Macros, Up: Predefined Macros + +3.7.1 Standard Predefined Macros +-------------------------------- + +The standard predefined macros are specified by the relevant language +standards, so they are available with all compilers that implement +those standards. Older compilers may not provide all of them. Their +names all start with double underscores. + +`__FILE__' + This macro expands to the name of the current input file, in the + form of a C string constant. This is the path by which the + preprocessor opened the file, not the short name specified in + `#include' or as the input file name argument. For example, + `"/usr/local/include/myheader.h"' is a possible expansion of this + macro. + +`__LINE__' + This macro expands to the current input line number, in the form + of a decimal integer constant. While we call it a predefined + macro, it's a pretty strange macro, since its "definition" changes + with each new line of source code. + + `__FILE__' and `__LINE__' are useful in generating an error message +to report an inconsistency detected by the program; the message can +state the source line at which the inconsistency was detected. For +example, + + fprintf (stderr, "Internal error: " + "negative string length " + "%d at %s, line %d.", + length, __FILE__, __LINE__); + + An `#include' directive changes the expansions of `__FILE__' and +`__LINE__' to correspond to the included file. At the end of that +file, when processing resumes on the input file that contained the +`#include' directive, the expansions of `__FILE__' and `__LINE__' +revert to the values they had before the `#include' (but `__LINE__' is +then incremented by one as processing moves to the line after the +`#include'). + + A `#line' directive changes `__LINE__', and may change `__FILE__' as +well. *Note Line Control::. + + C99 introduces `__func__', and GCC has provided `__FUNCTION__' for a +long time. Both of these are strings containing the name of the +current function (there are slight semantic differences; see the GCC +manual). Neither of them is a macro; the preprocessor does not know the +name of the current function. They tend to be useful in conjunction +with `__FILE__' and `__LINE__', though. + +`__DATE__' + This macro expands to a string constant that describes the date on + which the preprocessor is being run. The string constant contains + eleven characters and looks like `"Feb 12 1996"'. If the day of + the month is less than 10, it is padded with a space on the left. + + If GCC cannot determine the current date, it will emit a warning + message (once per compilation) and `__DATE__' will expand to + `"??? ?? ????"'. + +`__TIME__' + This macro expands to a string constant that describes the time at + which the preprocessor is being run. The string constant contains + eight characters and looks like `"23:59:01"'. + + If GCC cannot determine the current time, it will emit a warning + message (once per compilation) and `__TIME__' will expand to + `"??:??:??"'. + +`__STDC__' + In normal operation, this macro expands to the constant 1, to + signify that this compiler conforms to ISO Standard C. If GNU CPP + is used with a compiler other than GCC, this is not necessarily + true; however, the preprocessor always conforms to the standard + unless the `-traditional-cpp' option is used. + + This macro is not defined if the `-traditional-cpp' option is used. + + On some hosts, the system compiler uses a different convention, + where `__STDC__' is normally 0, but is 1 if the user specifies + strict conformance to the C Standard. CPP follows the host + convention when processing system header files, but when + processing user files `__STDC__' is always 1. This has been + reported to cause problems; for instance, some versions of Solaris + provide X Windows headers that expect `__STDC__' to be either + undefined or 1. *Note Invocation::. + +`__STDC_VERSION__' + This macro expands to the C Standard's version number, a long + integer constant of the form `YYYYMML' where YYYY and MM are the + year and month of the Standard version. This signifies which + version of the C Standard the compiler conforms to. Like + `__STDC__', this is not necessarily accurate for the entire + implementation, unless GNU CPP is being used with GCC. + + The value `199409L' signifies the 1989 C standard as amended in + 1994, which is the current default; the value `199901L' signifies + the 1999 revision of the C standard. Support for the 1999 + revision is not yet complete. + + This macro is not defined if the `-traditional-cpp' option is + used, nor when compiling C++ or Objective-C. + +`__STDC_HOSTED__' + This macro is defined, with value 1, if the compiler's target is a + "hosted environment". A hosted environment has the complete + facilities of the standard C library available. + +`__cplusplus' + This macro is defined when the C++ compiler is in use. You can use + `__cplusplus' to test whether a header is compiled by a C compiler + or a C++ compiler. This macro is similar to `__STDC_VERSION__', in + that it expands to a version number. A fully conforming + implementation of the 1998 C++ standard will define this macro to + `199711L'. The GNU C++ compiler is not yet fully conforming, so + it uses `1' instead. It is hoped to complete the implementation + of standard C++ in the near future. + +`__OBJC__' + This macro is defined, with value 1, when the Objective-C compiler + is in use. You can use `__OBJC__' to test whether a header is + compiled by a C compiler or a Objective-C compiler. + +`__ASSEMBLER__' + This macro is defined with value 1 when preprocessing assembly + language. + + + +File: cpp.info, Node: Common Predefined Macros, Next: System-specific Predefined Macros, Prev: Standard Predefined Macros, Up: Predefined Macros + +3.7.2 Common Predefined Macros +------------------------------ + +The common predefined macros are GNU C extensions. They are available +with the same meanings regardless of the machine or operating system on +which you are using GNU C or GNU Fortran. Their names all start with +double underscores. + +`__COUNTER__' + This macro expands to sequential integral values starting from 0. + In conjunction with the `##' operator, this provides a convenient + means to generate unique identifiers. Care must be taken to + ensure that `__COUNTER__' is not expanded prior to inclusion of + precompiled headers which use it. Otherwise, the precompiled + headers will not be used. + +`__GFORTRAN__' + The GNU Fortran compiler defines this. + +`__GNUC__' +`__GNUC_MINOR__' +`__GNUC_PATCHLEVEL__' + These macros are defined by all GNU compilers that use the C + preprocessor: C, C++, Objective-C and Fortran. Their values are + the major version, minor version, and patch level of the compiler, + as integer constants. For example, GCC 3.2.1 will define + `__GNUC__' to 3, `__GNUC_MINOR__' to 2, and `__GNUC_PATCHLEVEL__' + to 1. These macros are also defined if you invoke the + preprocessor directly. + + `__GNUC_PATCHLEVEL__' is new to GCC 3.0; it is also present in the + widely-used development snapshots leading up to 3.0 (which identify + themselves as GCC 2.96 or 2.97, depending on which snapshot you + have). + + If all you need to know is whether or not your program is being + compiled by GCC, or a non-GCC compiler that claims to accept the + GNU C dialects, you can simply test `__GNUC__'. If you need to + write code which depends on a specific version, you must be more + careful. Each time the minor version is increased, the patch + level is reset to zero; each time the major version is increased + (which happens rarely), the minor version and patch level are + reset. If you wish to use the predefined macros directly in the + conditional, you will need to write it like this: + + /* Test for GCC > 3.2.0 */ + #if __GNUC__ > 3 || \ + (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || \ + (__GNUC_MINOR__ == 2 && \ + __GNUC_PATCHLEVEL__ > 0)) + + Another approach is to use the predefined macros to calculate a + single number, then compare that against a threshold: + + #define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) + ... + /* Test for GCC > 3.2.0 */ + #if GCC_VERSION > 30200 + + Many people find this form easier to understand. + +`__GNUG__' + The GNU C++ compiler defines this. Testing it is equivalent to + testing `(__GNUC__ && __cplusplus)'. + +`__STRICT_ANSI__' + GCC defines this macro if and only if the `-ansi' switch, or a + `-std' switch specifying strict conformance to some version of ISO + C, was specified when GCC was invoked. It is defined to `1'. + This macro exists primarily to direct GNU libc's header files to + restrict their definitions to the minimal set found in the 1989 C + standard. + +`__BASE_FILE__' + This macro expands to the name of the main input file, in the form + of a C string constant. This is the source file that was specified + on the command line of the preprocessor or C compiler. + +`__INCLUDE_LEVEL__' + This macro expands to a decimal integer constant that represents + the depth of nesting in include files. The value of this macro is + incremented on every `#include' directive and decremented at the + end of every included file. It starts out at 0, its value within + the base file specified on the command line. + +`__ELF__' + This macro is defined if the target uses the ELF object format. + +`__VERSION__' + This macro expands to a string constant which describes the + version of the compiler in use. You should not rely on its + contents having any particular form, but it can be counted on to + contain at least the release number. + +`__OPTIMIZE__' +`__OPTIMIZE_SIZE__' +`__NO_INLINE__' + These macros describe the compilation mode. `__OPTIMIZE__' is + defined in all optimizing compilations. `__OPTIMIZE_SIZE__' is + defined if the compiler is optimizing for size, not speed. + `__NO_INLINE__' is defined if no functions will be inlined into + their callers (when not optimizing, or when inlining has been + specifically disabled by `-fno-inline'). + + These macros cause certain GNU header files to provide optimized + definitions, using macros or inline functions, of system library + functions. You should not use these macros in any way unless you + make sure that programs will execute with the same effect whether + or not they are defined. If they are defined, their value is 1. + +`__GNUC_GNU_INLINE__' + GCC defines this macro if functions declared `inline' will be + handled in GCC's traditional gnu89 mode. Object files will contain + externally visible definitions of all functions declared `inline' + without `extern' or `static'. They will not contain any + definitions of any functions declared `extern inline'. + +`__GNUC_STDC_INLINE__' + GCC defines this macro if functions declared `inline' will be + handled according to the ISO C99 standard. Object files will + contain externally visible definitions of all functions declared + `extern inline'. They will not contain definitions of any + functions declared `inline' without `extern'. + + If this macro is defined, GCC supports the `gnu_inline' function + attribute as a way to always get the gnu89 behavior. Support for + this and `__GNUC_GNU_INLINE__' was added in GCC 4.1.3. If neither + macro is defined, an older version of GCC is being used: `inline' + functions will be compiled in gnu89 mode, and the `gnu_inline' + function attribute will not be recognized. + +`__CHAR_UNSIGNED__' + GCC defines this macro if and only if the data type `char' is + unsigned on the target machine. It exists to cause the standard + header file `limits.h' to work correctly. You should not use this + macro yourself; instead, refer to the standard macros defined in + `limits.h'. + +`__WCHAR_UNSIGNED__' + Like `__CHAR_UNSIGNED__', this macro is defined if and only if the + data type `wchar_t' is unsigned and the front-end is in C++ mode. + +`__REGISTER_PREFIX__' + This macro expands to a single token (not a string constant) which + is the prefix applied to CPU register names in assembly language + for this target. You can use it to write assembly that is usable + in multiple environments. For example, in the `m68k-aout' + environment it expands to nothing, but in the `m68k-coff' + environment it expands to a single `%'. + +`__USER_LABEL_PREFIX__' + This macro expands to a single token which is the prefix applied to + user labels (symbols visible to C code) in assembly. For example, + in the `m68k-aout' environment it expands to an `_', but in the + `m68k-coff' environment it expands to nothing. + + This macro will have the correct definition even if + `-f(no-)underscores' is in use, but it will not be correct if + target-specific options that adjust this prefix are used (e.g. the + OSF/rose `-mno-underscores' option). + +`__SIZE_TYPE__' +`__PTRDIFF_TYPE__' +`__WCHAR_TYPE__' +`__WINT_TYPE__' +`__INTMAX_TYPE__' +`__UINTMAX_TYPE__' + These macros are defined to the correct underlying types for the + `size_t', `ptrdiff_t', `wchar_t', `wint_t', `intmax_t', and + `uintmax_t' typedefs, respectively. They exist to make the + standard header files `stddef.h' and `wchar.h' work correctly. + You should not use these macros directly; instead, include the + appropriate headers and use the typedefs. + +`__CHAR_BIT__' + Defined to the number of bits used in the representation of the + `char' data type. It exists to make the standard header given + numerical limits work correctly. You should not use this macro + directly; instead, include the appropriate headers. + +`__SCHAR_MAX__' +`__WCHAR_MAX__' +`__SHRT_MAX__' +`__INT_MAX__' +`__LONG_MAX__' +`__LONG_LONG_MAX__' +`__INTMAX_MAX__' + Defined to the maximum value of the `signed char', `wchar_t', + `signed short', `signed int', `signed long', `signed long long', + and `intmax_t' types respectively. They exist to make the + standard header given numerical limits work correctly. You should + not use these macros directly; instead, include the appropriate + headers. + +`__SIZEOF_INT__' +`__SIZEOF_LONG__' +`__SIZEOF_LONG_LONG__' +`__SIZEOF_SHORT__' +`__SIZEOF_POINTER__' +`__SIZEOF_FLOAT__' +`__SIZEOF_DOUBLE__' +`__SIZEOF_LONG_DOUBLE__' +`__SIZEOF_SIZE_T__' +`__SIZEOF_WCHAR_T__' +`__SIZEOF_WINT_T__' +`__SIZEOF_PTRDIFF_T__' + Defined to the number of bytes of the C standard data types: `int', + `long', `long long', `short', `void *', `float', `double', `long + double', `size_t', `wchar_t', `wint_t' and `ptrdiff_t'. + +`__DEPRECATED' + This macro is defined, with value 1, when compiling a C++ source + file with warnings about deprecated constructs enabled. These + warnings are enabled by default, but can be disabled with + `-Wno-deprecated'. + +`__EXCEPTIONS' + This macro is defined, with value 1, when compiling a C++ source + file with exceptions enabled. If `-fno-exceptions' is used when + compiling the file, then this macro is not defined. + +`__GXX_RTTI' + This macro is defined, with value 1, when compiling a C++ source + file with runtime type identification enabled. If `-fno-rtti' is + used when compiling the file, then this macro is not defined. + +`__USING_SJLJ_EXCEPTIONS__' + This macro is defined, with value 1, if the compiler uses the old + mechanism based on `setjmp' and `longjmp' for exception handling. + +`__GXX_EXPERIMENTAL_CXX0X__' + This macro is defined when compiling a C++ source file with the + option `-std=c++0x' or `-std=gnu++0x'. It indicates that some + features likely to be included in C++0x are available. Note that + these features are experimental, and may change or be removed in + future versions of GCC. + +`__GXX_WEAK__' + This macro is defined when compiling a C++ source file. It has the + value 1 if the compiler will use weak symbols, COMDAT sections, or + other similar techniques to collapse symbols with "vague linkage" + that are defined in multiple translation units. If the compiler + will not collapse such symbols, this macro is defined with value + 0. In general, user code should not need to make use of this + macro; the purpose of this macro is to ease implementation of the + C++ runtime library provided with G++. + +`__NEXT_RUNTIME__' + This macro is defined, with value 1, if (and only if) the NeXT + runtime (as in `-fnext-runtime') is in use for Objective-C. If + the GNU runtime is used, this macro is not defined, so that you + can use this macro to determine which runtime (NeXT or GNU) is + being used. + +`__LP64__' +`_LP64' + These macros are defined, with value 1, if (and only if) the + compilation is for a target where `long int' and pointer both use + 64-bits and `int' uses 32-bit. + +`__SSP__' + This macro is defined, with value 1, when `-fstack-protector' is in + use. + +`__SSP_ALL__' + This macro is defined, with value 2, when `-fstack-protector-all' + is in use. + +`__TIMESTAMP__' + This macro expands to a string constant that describes the date + and time of the last modification of the current source file. The + string constant contains abbreviated day of the week, month, day + of the month, time in hh:mm:ss form, year and looks like + `"Sun Sep 16 01:03:52 1973"'. If the day of the month is less + than 10, it is padded with a space on the left. + + If GCC cannot determine the current date, it will emit a warning + message (once per compilation) and `__TIMESTAMP__' will expand to + `"??? ??? ?? ??:??:?? ????"'. + +`__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1' +`__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2' +`__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4' +`__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8' +`__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16' + These macros are defined when the target processor supports atomic + compare and swap operations on operands 1, 2, 4, 8 or 16 bytes in + length, respectively. + +`__GCC_HAVE_DWARF2_CFI_ASM' + This macro is defined when the compiler is emitting Dwarf2 CFI + directives to the assembler. When this is defined, it is possible + to emit those same directives in inline assembly. + + +File: cpp.info, Node: System-specific Predefined Macros, Next: C++ Named Operators, Prev: Common Predefined Macros, Up: Predefined Macros + +3.7.3 System-specific Predefined Macros +--------------------------------------- + +The C preprocessor normally predefines several macros that indicate what +type of system and machine is in use. They are obviously different on +each target supported by GCC. This manual, being for all systems and +machines, cannot tell you what their names are, but you can use `cpp +-dM' to see them all. *Note Invocation::. All system-specific +predefined macros expand to the constant 1, so you can test them with +either `#ifdef' or `#if'. + + The C standard requires that all system-specific macros be part of +the "reserved namespace". All names which begin with two underscores, +or an underscore and a capital letter, are reserved for the compiler and +library to use as they wish. However, historically system-specific +macros have had names with no special prefix; for instance, it is common +to find `unix' defined on Unix systems. For all such macros, GCC +provides a parallel macro with two underscores added at the beginning +and the end. If `unix' is defined, `__unix__' will be defined too. +There will never be more than two underscores; the parallel of `_mips' +is `__mips__'. + + When the `-ansi' option, or any `-std' option that requests strict +conformance, is given to the compiler, all the system-specific +predefined macros outside the reserved namespace are suppressed. The +parallel macros, inside the reserved namespace, remain defined. + + We are slowly phasing out all predefined macros which are outside the +reserved namespace. You should never use them in new programs, and we +encourage you to correct older code to use the parallel macros whenever +you find it. We don't recommend you use the system-specific macros that +are in the reserved namespace, either. It is better in the long run to +check specifically for features you need, using a tool such as +`autoconf'. + + +File: cpp.info, Node: C++ Named Operators, Prev: System-specific Predefined Macros, Up: Predefined Macros + +3.7.4 C++ Named Operators +------------------------- + +In C++, there are eleven keywords which are simply alternate spellings +of operators normally written with punctuation. These keywords are +treated as such even in the preprocessor. They function as operators in +`#if', and they cannot be defined as macros or poisoned. In C, you can +request that those keywords take their C++ meaning by including +`iso646.h'. That header defines each one as a normal object-like macro +expanding to the appropriate punctuator. + + These are the named operators and their corresponding punctuators: + +Named Operator Punctuator +`and' `&&' +`and_eq' `&=' +`bitand' `&' +`bitor' `|' +`compl' `~' +`not' `!' +`not_eq' `!=' +`or' `||' +`or_eq' `|=' +`xor' `^' +`xor_eq' `^=' + + +File: cpp.info, Node: Undefining and Redefining Macros, Next: Directives Within Macro Arguments, Prev: Predefined Macros, Up: Macros + +3.8 Undefining and Redefining Macros +==================================== + +If a macro ceases to be useful, it may be "undefined" with the `#undef' +directive. `#undef' takes a single argument, the name of the macro to +undefine. You use the bare macro name, even if the macro is +function-like. It is an error if anything appears on the line after +the macro name. `#undef' has no effect if the name is not a macro. + + #define FOO 4 + x = FOO; ==> x = 4; + #undef FOO + x = FOO; ==> x = FOO; + + Once a macro has been undefined, that identifier may be "redefined" +as a macro by a subsequent `#define' directive. The new definition +need not have any resemblance to the old definition. + + However, if an identifier which is currently a macro is redefined, +then the new definition must be "effectively the same" as the old one. +Two macro definitions are effectively the same if: + * Both are the same type of macro (object- or function-like). + + * All the tokens of the replacement list are the same. + + * If there are any parameters, they are the same. + + * Whitespace appears in the same places in both. It need not be + exactly the same amount of whitespace, though. Remember that + comments count as whitespace. + +These definitions are effectively the same: + #define FOUR (2 + 2) + #define FOUR (2 + 2) + #define FOUR (2 /* two */ + 2) + but these are not: + #define FOUR (2 + 2) + #define FOUR ( 2+2 ) + #define FOUR (2 * 2) + #define FOUR(score,and,seven,years,ago) (2 + 2) + + If a macro is redefined with a definition that is not effectively the +same as the old one, the preprocessor issues a warning and changes the +macro to use the new definition. If the new definition is effectively +the same, the redefinition is silently ignored. This allows, for +instance, two different headers to define a common macro. The +preprocessor will only complain if the definitions do not match. + + +File: cpp.info, Node: Directives Within Macro Arguments, Next: Macro Pitfalls, Prev: Undefining and Redefining Macros, Up: Macros + +3.9 Directives Within Macro Arguments +===================================== + +Occasionally it is convenient to use preprocessor directives within the +arguments of a macro. The C and C++ standards declare that behavior in +these cases is undefined. + + Versions of CPP prior to 3.2 would reject such constructs with an +error message. This was the only syntactic difference between normal +functions and function-like macros, so it seemed attractive to remove +this limitation, and people would often be surprised that they could +not use macros in this way. Moreover, sometimes people would use +conditional compilation in the argument list to a normal library +function like `printf', only to find that after a library upgrade +`printf' had changed to be a function-like macro, and their code would +no longer compile. So from version 3.2 we changed CPP to successfully +process arbitrary directives within macro arguments in exactly the same +way as it would have processed the directive were the function-like +macro invocation not present. + + If, within a macro invocation, that macro is redefined, then the new +definition takes effect in time for argument pre-expansion, but the +original definition is still used for argument replacement. Here is a +pathological example: + + #define f(x) x x + f (1 + #undef f + #define f 2 + f) + +which expands to + + 1 2 1 2 + +with the semantics described above. + + +File: cpp.info, Node: Macro Pitfalls, Prev: Directives Within Macro Arguments, Up: Macros + +3.10 Macro Pitfalls +=================== + +In this section we describe some special rules that apply to macros and +macro expansion, and point out certain cases in which the rules have +counter-intuitive consequences that you must watch out for. + +* Menu: + +* Misnesting:: +* Operator Precedence Problems:: +* Swallowing the Semicolon:: +* Duplication of Side Effects:: +* Self-Referential Macros:: +* Argument Prescan:: +* Newlines in Arguments:: + + +File: cpp.info, Node: Misnesting, Next: Operator Precedence Problems, Up: Macro Pitfalls + +3.10.1 Misnesting +----------------- + +When a macro is called with arguments, the arguments are substituted +into the macro body and the result is checked, together with the rest of +the input file, for more macro calls. It is possible to piece together +a macro call coming partially from the macro body and partially from the +arguments. For example, + + #define twice(x) (2*(x)) + #define call_with_1(x) x(1) + call_with_1 (twice) + ==> twice(1) + ==> (2*(1)) + + Macro definitions do not have to have balanced parentheses. By +writing an unbalanced open parenthesis in a macro body, it is possible +to create a macro call that begins inside the macro body but ends +outside of it. For example, + + #define strange(file) fprintf (file, "%s %d", + ... + strange(stderr) p, 35) + ==> fprintf (stderr, "%s %d", p, 35) + + The ability to piece together a macro call can be useful, but the +use of unbalanced open parentheses in a macro body is just confusing, +and should be avoided. + + +File: cpp.info, Node: Operator Precedence Problems, Next: Swallowing the Semicolon, Prev: Misnesting, Up: Macro Pitfalls + +3.10.2 Operator Precedence Problems +----------------------------------- + +You may have noticed that in most of the macro definition examples shown +above, each occurrence of a macro argument name had parentheses around +it. In addition, another pair of parentheses usually surround the +entire macro definition. Here is why it is best to write macros that +way. + + Suppose you define a macro as follows, + + #define ceil_div(x, y) (x + y - 1) / y + +whose purpose is to divide, rounding up. (One use for this operation is +to compute how many `int' objects are needed to hold a certain number +of `char' objects.) Then suppose it is used as follows: + + a = ceil_div (b & c, sizeof (int)); + ==> a = (b & c + sizeof (int) - 1) / sizeof (int); + +This does not do what is intended. The operator-precedence rules of C +make it equivalent to this: + + a = (b & (c + sizeof (int) - 1)) / sizeof (int); + +What we want is this: + + a = ((b & c) + sizeof (int) - 1)) / sizeof (int); + +Defining the macro as + + #define ceil_div(x, y) ((x) + (y) - 1) / (y) + +provides the desired result. + + Unintended grouping can result in another way. Consider `sizeof +ceil_div(1, 2)'. That has the appearance of a C expression that would +compute the size of the type of `ceil_div (1, 2)', but in fact it means +something very different. Here is what it expands to: + + sizeof ((1) + (2) - 1) / (2) + +This would take the size of an integer and divide it by two. The +precedence rules have put the division outside the `sizeof' when it was +intended to be inside. + + Parentheses around the entire macro definition prevent such problems. +Here, then, is the recommended way to define `ceil_div': + + #define ceil_div(x, y) (((x) + (y) - 1) / (y)) + + +File: cpp.info, Node: Swallowing the Semicolon, Next: Duplication of Side Effects, Prev: Operator Precedence Problems, Up: Macro Pitfalls + +3.10.3 Swallowing the Semicolon +------------------------------- + +Often it is desirable to define a macro that expands into a compound +statement. Consider, for example, the following macro, that advances a +pointer (the argument `p' says where to find it) across whitespace +characters: + + #define SKIP_SPACES(p, limit) \ + { char *lim = (limit); \ + while (p < lim) { \ + if (*p++ != ' ') { \ + p--; break; }}} + +Here backslash-newline is used to split the macro definition, which must +be a single logical line, so that it resembles the way such code would +be laid out if not part of a macro definition. + + A call to this macro might be `SKIP_SPACES (p, lim)'. Strictly +speaking, the call expands to a compound statement, which is a complete +statement with no need for a semicolon to end it. However, since it +looks like a function call, it minimizes confusion if you can use it +like a function call, writing a semicolon afterward, as in `SKIP_SPACES +(p, lim);' + + This can cause trouble before `else' statements, because the +semicolon is actually a null statement. Suppose you write + + if (*p != 0) + SKIP_SPACES (p, lim); + else ... + +The presence of two statements--the compound statement and a null +statement--in between the `if' condition and the `else' makes invalid C +code. + + The definition of the macro `SKIP_SPACES' can be altered to solve +this problem, using a `do ... while' statement. Here is how: + + #define SKIP_SPACES(p, limit) \ + do { char *lim = (limit); \ + while (p < lim) { \ + if (*p++ != ' ') { \ + p--; break; }}} \ + while (0) + + Now `SKIP_SPACES (p, lim);' expands into + + do {...} while (0); + +which is one statement. The loop executes exactly once; most compilers +generate no extra code for it. + + +File: cpp.info, Node: Duplication of Side Effects, Next: Self-Referential Macros, Prev: Swallowing the Semicolon, Up: Macro Pitfalls + +3.10.4 Duplication of Side Effects +---------------------------------- + +Many C programs define a macro `min', for "minimum", like this: + + #define min(X, Y) ((X) < (Y) ? (X) : (Y)) + + When you use this macro with an argument containing a side effect, +as shown here, + + next = min (x + y, foo (z)); + +it expands as follows: + + next = ((x + y) < (foo (z)) ? (x + y) : (foo (z))); + +where `x + y' has been substituted for `X' and `foo (z)' for `Y'. + + The function `foo' is used only once in the statement as it appears +in the program, but the expression `foo (z)' has been substituted twice +into the macro expansion. As a result, `foo' might be called two times +when the statement is executed. If it has side effects or if it takes +a long time to compute, the results might not be what you intended. We +say that `min' is an "unsafe" macro. + + The best solution to this problem is to define `min' in a way that +computes the value of `foo (z)' only once. The C language offers no +standard way to do this, but it can be done with GNU extensions as +follows: + + #define min(X, Y) \ + ({ typeof (X) x_ = (X); \ + typeof (Y) y_ = (Y); \ + (x_ < y_) ? x_ : y_; }) + + The `({ ... })' notation produces a compound statement that acts as +an expression. Its value is the value of its last statement. This +permits us to define local variables and assign each argument to one. +The local variables have underscores after their names to reduce the +risk of conflict with an identifier of wider scope (it is impossible to +avoid this entirely). Now each argument is evaluated exactly once. + + If you do not wish to use GNU C extensions, the only solution is to +be careful when _using_ the macro `min'. For example, you can +calculate the value of `foo (z)', save it in a variable, and use that +variable in `min': + + #define min(X, Y) ((X) < (Y) ? (X) : (Y)) + ... + { + int tem = foo (z); + next = min (x + y, tem); + } + +(where we assume that `foo' returns type `int'). + + +File: cpp.info, Node: Self-Referential Macros, Next: Argument Prescan, Prev: Duplication of Side Effects, Up: Macro Pitfalls + +3.10.5 Self-Referential Macros +------------------------------ + +A "self-referential" macro is one whose name appears in its definition. +Recall that all macro definitions are rescanned for more macros to +replace. If the self-reference were considered a use of the macro, it +would produce an infinitely large expansion. To prevent this, the +self-reference is not considered a macro call. It is passed into the +preprocessor output unchanged. Consider an example: + + #define foo (4 + foo) + +where `foo' is also a variable in your program. + + Following the ordinary rules, each reference to `foo' will expand +into `(4 + foo)'; then this will be rescanned and will expand into `(4 ++ (4 + foo))'; and so on until the computer runs out of memory. + + The self-reference rule cuts this process short after one step, at +`(4 + foo)'. Therefore, this macro definition has the possibly useful +effect of causing the program to add 4 to the value of `foo' wherever +`foo' is referred to. + + In most cases, it is a bad idea to take advantage of this feature. A +person reading the program who sees that `foo' is a variable will not +expect that it is a macro as well. The reader will come across the +identifier `foo' in the program and think its value should be that of +the variable `foo', whereas in fact the value is four greater. + + One common, useful use of self-reference is to create a macro which +expands to itself. If you write + + #define EPERM EPERM + +then the macro `EPERM' expands to `EPERM'. Effectively, it is left +alone by the preprocessor whenever it's used in running text. You can +tell that it's a macro with `#ifdef'. You might do this if you want to +define numeric constants with an `enum', but have `#ifdef' be true for +each constant. + + If a macro `x' expands to use a macro `y', and the expansion of `y' +refers to the macro `x', that is an "indirect self-reference" of `x'. +`x' is not expanded in this case either. Thus, if we have + + #define x (4 + y) + #define y (2 * x) + +then `x' and `y' expand as follows: + + x ==> (4 + y) + ==> (4 + (2 * x)) + + y ==> (2 * x) + ==> (2 * (4 + y)) + +Each macro is expanded when it appears in the definition of the other +macro, but not when it indirectly appears in its own definition. + + +File: cpp.info, Node: Argument Prescan, Next: Newlines in Arguments, Prev: Self-Referential Macros, Up: Macro Pitfalls + +3.10.6 Argument Prescan +----------------------- + +Macro arguments are completely macro-expanded before they are +substituted into a macro body, unless they are stringified or pasted +with other tokens. After substitution, the entire macro body, including +the substituted arguments, is scanned again for macros to be expanded. +The result is that the arguments are scanned _twice_ to expand macro +calls in them. + + Most of the time, this has no effect. If the argument contained any +macro calls, they are expanded during the first scan. The result +therefore contains no macro calls, so the second scan does not change +it. If the argument were substituted as given, with no prescan, the +single remaining scan would find the same macro calls and produce the +same results. + + You might expect the double scan to change the results when a +self-referential macro is used in an argument of another macro (*note +Self-Referential Macros::): the self-referential macro would be +expanded once in the first scan, and a second time in the second scan. +However, this is not what happens. The self-references that do not +expand in the first scan are marked so that they will not expand in the +second scan either. + + You might wonder, "Why mention the prescan, if it makes no +difference? And why not skip it and make the preprocessor faster?" +The answer is that the prescan does make a difference in three special +cases: + + * Nested calls to a macro. + + We say that "nested" calls to a macro occur when a macro's argument + contains a call to that very macro. For example, if `f' is a macro + that expects one argument, `f (f (1))' is a nested pair of calls to + `f'. The desired expansion is made by expanding `f (1)' and + substituting that into the definition of `f'. The prescan causes + the expected result to happen. Without the prescan, `f (1)' itself + would be substituted as an argument, and the inner use of `f' would + appear during the main scan as an indirect self-reference and + would not be expanded. + + * Macros that call other macros that stringify or concatenate. + + If an argument is stringified or concatenated, the prescan does not + occur. If you _want_ to expand a macro, then stringify or + concatenate its expansion, you can do that by causing one macro to + call another macro that does the stringification or concatenation. + For instance, if you have + + #define AFTERX(x) X_ ## x + #define XAFTERX(x) AFTERX(x) + #define TABLESIZE 1024 + #define BUFSIZE TABLESIZE + + then `AFTERX(BUFSIZE)' expands to `X_BUFSIZE', and + `XAFTERX(BUFSIZE)' expands to `X_1024'. (Not to `X_TABLESIZE'. + Prescan always does a complete expansion.) + + * Macros used in arguments, whose expansions contain unshielded + commas. + + This can cause a macro expanded on the second scan to be called + with the wrong number of arguments. Here is an example: + + #define foo a,b + #define bar(x) lose(x) + #define lose(x) (1 + (x)) + + We would like `bar(foo)' to turn into `(1 + (foo))', which would + then turn into `(1 + (a,b))'. Instead, `bar(foo)' expands into + `lose(a,b)', and you get an error because `lose' requires a single + argument. In this case, the problem is easily solved by the same + parentheses that ought to be used to prevent misnesting of + arithmetic operations: + + #define foo (a,b) + or + #define bar(x) lose((x)) + + The extra pair of parentheses prevents the comma in `foo''s + definition from being interpreted as an argument separator. + + + +File: cpp.info, Node: Newlines in Arguments, Prev: Argument Prescan, Up: Macro Pitfalls + +3.10.7 Newlines in Arguments +---------------------------- + +The invocation of a function-like macro can extend over many logical +lines. However, in the present implementation, the entire expansion +comes out on one line. Thus line numbers emitted by the compiler or +debugger refer to the line the invocation started on, which might be +different to the line containing the argument causing the problem. + + Here is an example illustrating this: + + #define ignore_second_arg(a,b,c) a; c + + ignore_second_arg (foo (), + ignored (), + syntax error); + +The syntax error triggered by the tokens `syntax error' results in an +error message citing line three--the line of ignore_second_arg-- even +though the problematic code comes from line five. + + We consider this a bug, and intend to fix it in the near future. + + +File: cpp.info, Node: Conditionals, Next: Diagnostics, Prev: Macros, Up: Top + +4 Conditionals +************** + +A "conditional" is a directive that instructs the preprocessor to +select whether or not to include a chunk of code in the final token +stream passed to the compiler. Preprocessor conditionals can test +arithmetic expressions, or whether a name is defined as a macro, or both +simultaneously using the special `defined' operator. + + A conditional in the C preprocessor resembles in some ways an `if' +statement in C, but it is important to understand the difference between +them. The condition in an `if' statement is tested during the +execution of your program. Its purpose is to allow your program to +behave differently from run to run, depending on the data it is +operating on. The condition in a preprocessing conditional directive is +tested when your program is compiled. Its purpose is to allow different +code to be included in the program depending on the situation at the +time of compilation. + + However, the distinction is becoming less clear. Modern compilers +often do test `if' statements when a program is compiled, if their +conditions are known not to vary at run time, and eliminate code which +can never be executed. If you can count on your compiler to do this, +you may find that your program is more readable if you use `if' +statements with constant conditions (perhaps determined by macros). Of +course, you can only use this to exclude code, not type definitions or +other preprocessing directives, and you can only do it if the code +remains syntactically valid when it is not to be used. + + GCC version 3 eliminates this kind of never-executed code even when +not optimizing. Older versions did it only when optimizing. + +* Menu: + +* Conditional Uses:: +* Conditional Syntax:: +* Deleted Code:: + + +File: cpp.info, Node: Conditional Uses, Next: Conditional Syntax, Up: Conditionals + +4.1 Conditional Uses +==================== + +There are three general reasons to use a conditional. + + * A program may need to use different code depending on the machine + or operating system it is to run on. In some cases the code for + one operating system may be erroneous on another operating system; + for example, it might refer to data types or constants that do not + exist on the other system. When this happens, it is not enough to + avoid executing the invalid code. Its mere presence will cause + the compiler to reject the program. With a preprocessing + conditional, the offending code can be effectively excised from + the program when it is not valid. + + * You may want to be able to compile the same source file into two + different programs. One version might make frequent time-consuming + consistency checks on its intermediate data, or print the values of + those data for debugging, and the other not. + + * A conditional whose condition is always false is one way to + exclude code from the program but keep it as a sort of comment for + future reference. + + Simple programs that do not need system-specific logic or complex +debugging hooks generally will not need to use preprocessing +conditionals. + + +File: cpp.info, Node: Conditional Syntax, Next: Deleted Code, Prev: Conditional Uses, Up: Conditionals + +4.2 Conditional Syntax +====================== + +A conditional in the C preprocessor begins with a "conditional +directive": `#if', `#ifdef' or `#ifndef'. + +* Menu: + +* Ifdef:: +* If:: +* Defined:: +* Else:: +* Elif:: + + +File: cpp.info, Node: Ifdef, Next: If, Up: Conditional Syntax + +4.2.1 Ifdef +----------- + +The simplest sort of conditional is + + #ifdef MACRO + + CONTROLLED TEXT + + #endif /* MACRO */ + + This block is called a "conditional group". CONTROLLED TEXT will be +included in the output of the preprocessor if and only if MACRO is +defined. We say that the conditional "succeeds" if MACRO is defined, +"fails" if it is not. + + The CONTROLLED TEXT inside of a conditional can include +preprocessing directives. They are executed only if the conditional +succeeds. You can nest conditional groups inside other conditional +groups, but they must be completely nested. In other words, `#endif' +always matches the nearest `#ifdef' (or `#ifndef', or `#if'). Also, +you cannot start a conditional group in one file and end it in another. + + Even if a conditional fails, the CONTROLLED TEXT inside it is still +run through initial transformations and tokenization. Therefore, it +must all be lexically valid C. Normally the only way this matters is +that all comments and string literals inside a failing conditional group +must still be properly ended. + + The comment following the `#endif' is not required, but it is a good +practice if there is a lot of CONTROLLED TEXT, because it helps people +match the `#endif' to the corresponding `#ifdef'. Older programs +sometimes put MACRO directly after the `#endif' without enclosing it in +a comment. This is invalid code according to the C standard. CPP +accepts it with a warning. It never affects which `#ifndef' the +`#endif' matches. + + Sometimes you wish to use some code if a macro is _not_ defined. +You can do this by writing `#ifndef' instead of `#ifdef'. One common +use of `#ifndef' is to include code only the first time a header file +is included. *Note Once-Only Headers::. + + Macro definitions can vary between compilations for several reasons. +Here are some samples. + + * Some macros are predefined on each kind of machine (*note + System-specific Predefined Macros::). This allows you to provide + code specially tuned for a particular machine. + + * System header files define more macros, associated with the + features they implement. You can test these macros with + conditionals to avoid using a system feature on a machine where it + is not implemented. + + * Macros can be defined or undefined with the `-D' and `-U' command + line options when you compile the program. You can arrange to + compile the same source file into two different programs by + choosing a macro name to specify which program you want, writing + conditionals to test whether or how this macro is defined, and + then controlling the state of the macro with command line options, + perhaps set in the Makefile. *Note Invocation::. + + * Your program might have a special header file (often called + `config.h') that is adjusted when the program is compiled. It can + define or not define macros depending on the features of the + system and the desired capabilities of the program. The + adjustment can be automated by a tool such as `autoconf', or done + by hand. + + +File: cpp.info, Node: If, Next: Defined, Prev: Ifdef, Up: Conditional Syntax + +4.2.2 If +-------- + +The `#if' directive allows you to test the value of an arithmetic +expression, rather than the mere existence of one macro. Its syntax is + + #if EXPRESSION + + CONTROLLED TEXT + + #endif /* EXPRESSION */ + + EXPRESSION is a C expression of integer type, subject to stringent +restrictions. It may contain + + * Integer constants. + + * Character constants, which are interpreted as they would be in + normal code. + + * Arithmetic operators for addition, subtraction, multiplication, + division, bitwise operations, shifts, comparisons, and logical + operations (`&&' and `||'). The latter two obey the usual + short-circuiting rules of standard C. + + * Macros. All macros in the expression are expanded before actual + computation of the expression's value begins. + + * Uses of the `defined' operator, which lets you check whether macros + are defined in the middle of an `#if'. + + * Identifiers that are not macros, which are all considered to be the + number zero. This allows you to write `#if MACRO' instead of + `#ifdef MACRO', if you know that MACRO, when defined, will always + have a nonzero value. Function-like macros used without their + function call parentheses are also treated as zero. + + In some contexts this shortcut is undesirable. The `-Wundef' + option causes GCC to warn whenever it encounters an identifier + which is not a macro in an `#if'. + + The preprocessor does not know anything about types in the language. +Therefore, `sizeof' operators are not recognized in `#if', and neither +are `enum' constants. They will be taken as identifiers which are not +macros, and replaced by zero. In the case of `sizeof', this is likely +to cause the expression to be invalid. + + The preprocessor calculates the value of EXPRESSION. It carries out +all calculations in the widest integer type known to the compiler; on +most machines supported by GCC this is 64 bits. This is not the same +rule as the compiler uses to calculate the value of a constant +expression, and may give different results in some cases. If the value +comes out to be nonzero, the `#if' succeeds and the CONTROLLED TEXT is +included; otherwise it is skipped. + + +File: cpp.info, Node: Defined, Next: Else, Prev: If, Up: Conditional Syntax + +4.2.3 Defined +------------- + +The special operator `defined' is used in `#if' and `#elif' expressions +to test whether a certain name is defined as a macro. `defined NAME' +and `defined (NAME)' are both expressions whose value is 1 if NAME is +defined as a macro at the current point in the program, and 0 +otherwise. Thus, `#if defined MACRO' is precisely equivalent to +`#ifdef MACRO'. + + `defined' is useful when you wish to test more than one macro for +existence at once. For example, + + #if defined (__vax__) || defined (__ns16000__) + +would succeed if either of the names `__vax__' or `__ns16000__' is +defined as a macro. + + Conditionals written like this: + + #if defined BUFSIZE && BUFSIZE >= 1024 + +can generally be simplified to just `#if BUFSIZE >= 1024', since if +`BUFSIZE' is not defined, it will be interpreted as having the value +zero. + + If the `defined' operator appears as a result of a macro expansion, +the C standard says the behavior is undefined. GNU cpp treats it as a +genuine `defined' operator and evaluates it normally. It will warn +wherever your code uses this feature if you use the command-line option +`-pedantic', since other compilers may handle it differently. + + +File: cpp.info, Node: Else, Next: Elif, Prev: Defined, Up: Conditional Syntax + +4.2.4 Else +---------- + +The `#else' directive can be added to a conditional to provide +alternative text to be used if the condition fails. This is what it +looks like: + + #if EXPRESSION + TEXT-IF-TRUE + #else /* Not EXPRESSION */ + TEXT-IF-FALSE + #endif /* Not EXPRESSION */ + +If EXPRESSION is nonzero, the TEXT-IF-TRUE is included and the +TEXT-IF-FALSE is skipped. If EXPRESSION is zero, the opposite happens. + + You can use `#else' with `#ifdef' and `#ifndef', too. + + +File: cpp.info, Node: Elif, Prev: Else, Up: Conditional Syntax + +4.2.5 Elif +---------- + +One common case of nested conditionals is used to check for more than +two possible alternatives. For example, you might have + + #if X == 1 + ... + #else /* X != 1 */ + #if X == 2 + ... + #else /* X != 2 */ + ... + #endif /* X != 2 */ + #endif /* X != 1 */ + + Another conditional directive, `#elif', allows this to be +abbreviated as follows: + + #if X == 1 + ... + #elif X == 2 + ... + #else /* X != 2 and X != 1*/ + ... + #endif /* X != 2 and X != 1*/ + + `#elif' stands for "else if". Like `#else', it goes in the middle +of a conditional group and subdivides it; it does not require a +matching `#endif' of its own. Like `#if', the `#elif' directive +includes an expression to be tested. The text following the `#elif' is +processed only if the original `#if'-condition failed and the `#elif' +condition succeeds. + + More than one `#elif' can go in the same conditional group. Then +the text after each `#elif' is processed only if the `#elif' condition +succeeds after the original `#if' and all previous `#elif' directives +within it have failed. + + `#else' is allowed after any number of `#elif' directives, but +`#elif' may not follow `#else'. + + +File: cpp.info, Node: Deleted Code, Prev: Conditional Syntax, Up: Conditionals + +4.3 Deleted Code +================ + +If you replace or delete a part of the program but want to keep the old +code around for future reference, you often cannot simply comment it +out. Block comments do not nest, so the first comment inside the old +code will end the commenting-out. The probable result is a flood of +syntax errors. + + One way to avoid this problem is to use an always-false conditional +instead. For instance, put `#if 0' before the deleted code and +`#endif' after it. This works even if the code being turned off +contains conditionals, but they must be entire conditionals (balanced +`#if' and `#endif'). + + Some people use `#ifdef notdef' instead. This is risky, because +`notdef' might be accidentally defined as a macro, and then the +conditional would succeed. `#if 0' can be counted on to fail. + + Do not use `#if 0' for comments which are not C code. Use a real +comment, instead. The interior of `#if 0' must consist of complete +tokens; in particular, single-quote characters must balance. Comments +often contain unbalanced single-quote characters (known in English as +apostrophes). These confuse `#if 0'. They don't confuse `/*'. + + +File: cpp.info, Node: Diagnostics, Next: Line Control, Prev: Conditionals, Up: Top + +5 Diagnostics +************* + +The directive `#error' causes the preprocessor to report a fatal error. +The tokens forming the rest of the line following `#error' are used as +the error message. + + You would use `#error' inside of a conditional that detects a +combination of parameters which you know the program does not properly +support. For example, if you know that the program will not run +properly on a VAX, you might write + + #ifdef __vax__ + #error "Won't work on VAXen. See comments at get_last_object." + #endif + + If you have several configuration parameters that must be set up by +the installation in a consistent way, you can use conditionals to detect +an inconsistency and report it with `#error'. For example, + + #if !defined(UNALIGNED_INT_ASM_OP) && defined(DWARF2_DEBUGGING_INFO) + #error "DWARF2_DEBUGGING_INFO requires UNALIGNED_INT_ASM_OP." + #endif + + The directive `#warning' is like `#error', but causes the +preprocessor to issue a warning and continue preprocessing. The tokens +following `#warning' are used as the warning message. + + You might use `#warning' in obsolete header files, with a message +directing the user to the header file which should be used instead. + + Neither `#error' nor `#warning' macro-expands its argument. +Internal whitespace sequences are each replaced with a single space. +The line must consist of complete tokens. It is wisest to make the +argument of these directives be a single string constant; this avoids +problems with apostrophes and the like. + + +File: cpp.info, Node: Line Control, Next: Pragmas, Prev: Diagnostics, Up: Top + +6 Line Control +************** + +The C preprocessor informs the C compiler of the location in your source +code where each token came from. Presently, this is just the file name +and line number. All the tokens resulting from macro expansion are +reported as having appeared on the line of the source file where the +outermost macro was used. We intend to be more accurate in the future. + + If you write a program which generates source code, such as the +`bison' parser generator, you may want to adjust the preprocessor's +notion of the current file name and line number by hand. Parts of the +output from `bison' are generated from scratch, other parts come from a +standard parser file. The rest are copied verbatim from `bison''s +input. You would like compiler error messages and symbolic debuggers +to be able to refer to `bison''s input file. + + `bison' or any such program can arrange this by writing `#line' +directives into the output file. `#line' is a directive that specifies +the original line number and source file name for subsequent input in +the current preprocessor input file. `#line' has three variants: + +`#line LINENUM' + LINENUM is a non-negative decimal integer constant. It specifies + the line number which should be reported for the following line of + input. Subsequent lines are counted from LINENUM. + +`#line LINENUM FILENAME' + LINENUM is the same as for the first form, and has the same + effect. In addition, FILENAME is a string constant. The + following line and all subsequent lines are reported to come from + the file it specifies, until something else happens to change that. + FILENAME is interpreted according to the normal rules for a string + constant: backslash escapes are interpreted. This is different + from `#include'. + + Previous versions of CPP did not interpret escapes in `#line'; we + have changed it because the standard requires they be interpreted, + and most other compilers do. + +`#line ANYTHING ELSE' + ANYTHING ELSE is checked for macro calls, which are expanded. The + result should match one of the above two forms. + + `#line' directives alter the results of the `__FILE__' and +`__LINE__' predefined macros from that point on. *Note Standard +Predefined Macros::. They do not have any effect on `#include''s idea +of the directory containing the current file. This is a change from +GCC 2.95. Previously, a file reading + + #line 1 "../src/gram.y" + #include "gram.h" + + would search for `gram.h' in `../src', then the `-I' chain; the +directory containing the physical source file would not be searched. +In GCC 3.0 and later, the `#include' is not affected by the presence of +a `#line' referring to a different directory. + + We made this change because the old behavior caused problems when +generated source files were transported between machines. For instance, +it is common practice to ship generated parsers with a source release, +so that people building the distribution do not need to have yacc or +Bison installed. These files frequently have `#line' directives +referring to the directory tree of the system where the distribution was +created. If GCC tries to search for headers in those directories, the +build is likely to fail. + + The new behavior can cause failures too, if the generated file is not +in the same directory as its source and it attempts to include a header +which would be visible searching from the directory containing the +source file. However, this problem is easily solved with an additional +`-I' switch on the command line. The failures caused by the old +semantics could sometimes be corrected only by editing the generated +files, which is difficult and error-prone. + + +File: cpp.info, Node: Pragmas, Next: Other Directives, Prev: Line Control, Up: Top + +7 Pragmas +********* + +The `#pragma' directive is the method specified by the C standard for +providing additional information to the compiler, beyond what is +conveyed in the language itself. Three forms of this directive +(commonly known as "pragmas") are specified by the 1999 C standard. A +C compiler is free to attach any meaning it likes to other pragmas. + + GCC has historically preferred to use extensions to the syntax of the +language, such as `__attribute__', for this purpose. However, GCC does +define a few pragmas of its own. These mostly have effects on the +entire translation unit or source file. + + In GCC version 3, all GNU-defined, supported pragmas have been given +a `GCC' prefix. This is in line with the `STDC' prefix on all pragmas +defined by C99. For backward compatibility, pragmas which were +recognized by previous versions are still recognized without the `GCC' +prefix, but that usage is deprecated. Some older pragmas are +deprecated in their entirety. They are not recognized with the `GCC' +prefix. *Note Obsolete Features::. + + C99 introduces the `_Pragma' operator. This feature addresses a +major problem with `#pragma': being a directive, it cannot be produced +as the result of macro expansion. `_Pragma' is an operator, much like +`sizeof' or `defined', and can be embedded in a macro. + + Its syntax is `_Pragma (STRING-LITERAL)', where STRING-LITERAL can +be either a normal or wide-character string literal. It is +destringized, by replacing all `\\' with a single `\' and all `\"' with +a `"'. The result is then processed as if it had appeared as the right +hand side of a `#pragma' directive. For example, + + _Pragma ("GCC dependency \"parse.y\"") + +has the same effect as `#pragma GCC dependency "parse.y"'. The same +effect could be achieved using macros, for example + + #define DO_PRAGMA(x) _Pragma (#x) + DO_PRAGMA (GCC dependency "parse.y") + + The standard is unclear on where a `_Pragma' operator can appear. +The preprocessor does not accept it within a preprocessing conditional +directive like `#if'. To be safe, you are probably best keeping it out +of directives other than `#define', and putting it on a line of its own. + + This manual documents the pragmas which are meaningful to the +preprocessor itself. Other pragmas are meaningful to the C or C++ +compilers. They are documented in the GCC manual. + +`#pragma GCC dependency' + `#pragma GCC dependency' allows you to check the relative dates of + the current file and another file. If the other file is more + recent than the current file, a warning is issued. This is useful + if the current file is derived from the other file, and should be + regenerated. The other file is searched for using the normal + include search path. Optional trailing text can be used to give + more information in the warning message. + + #pragma GCC dependency "parse.y" + #pragma GCC dependency "/usr/include/time.h" rerun fixincludes + +`#pragma GCC poison' + Sometimes, there is an identifier that you want to remove + completely from your program, and make sure that it never creeps + back in. To enforce this, you can "poison" the identifier with + this pragma. `#pragma GCC poison' is followed by a list of + identifiers to poison. If any of those identifiers appears + anywhere in the source after the directive, it is a hard error. + For example, + + #pragma GCC poison printf sprintf fprintf + sprintf(some_string, "hello"); + + will produce an error. + + If a poisoned identifier appears as part of the expansion of a + macro which was defined before the identifier was poisoned, it + will _not_ cause an error. This lets you poison an identifier + without worrying about system headers defining macros that use it. + + For example, + + #define strrchr rindex + #pragma GCC poison rindex + strrchr(some_string, 'h'); + + will not produce an error. + +`#pragma GCC system_header' + This pragma takes no arguments. It causes the rest of the code in + the current file to be treated as if it came from a system header. + *Note System Headers::. + + + +File: cpp.info, Node: Other Directives, Next: Preprocessor Output, Prev: Pragmas, Up: Top + +8 Other Directives +****************** + +The `#ident' directive takes one argument, a string constant. On some +systems, that string constant is copied into a special segment of the +object file. On other systems, the directive is ignored. The `#sccs' +directive is a synonym for `#ident'. + + These directives are not part of the C standard, but they are not +official GNU extensions either. What historical information we have +been able to find, suggests they originated with System V. + + Both `#ident' and `#sccs' are deprecated extensions. + + The "null directive" consists of a `#' followed by a newline, with +only whitespace (including comments) in between. A null directive is +understood as a preprocessing directive but has no effect on the +preprocessor output. The primary significance of the existence of the +null directive is that an input line consisting of just a `#' will +produce no output, rather than a line of output containing just a `#'. +Supposedly some old C programs contain such lines. + + +File: cpp.info, Node: Preprocessor Output, Next: Traditional Mode, Prev: Other Directives, Up: Top + +9 Preprocessor Output +********************* + +When the C preprocessor is used with the C, C++, or Objective-C +compilers, it is integrated into the compiler and communicates a stream +of binary tokens directly to the compiler's parser. However, it can +also be used in the more conventional standalone mode, where it produces +textual output. + + The output from the C preprocessor looks much like the input, except +that all preprocessing directive lines have been replaced with blank +lines and all comments with spaces. Long runs of blank lines are +discarded. + + The ISO standard specifies that it is implementation defined whether +a preprocessor preserves whitespace between tokens, or replaces it with +e.g. a single space. In GNU CPP, whitespace between tokens is collapsed +to become a single space, with the exception that the first token on a +non-directive line is preceded with sufficient spaces that it appears in +the same column in the preprocessed output that it appeared in the +original source file. This is so the output is easy to read. *Note +Differences from previous versions::. CPP does not insert any +whitespace where there was none in the original source, except where +necessary to prevent an accidental token paste. + + Source file name and line number information is conveyed by lines of +the form + + # LINENUM FILENAME FLAGS + +These are called "linemarkers". They are inserted as needed into the +output (but never within a string or character constant). They mean +that the following line originated in file FILENAME at line LINENUM. +FILENAME will never contain any non-printing characters; they are +replaced with octal escape sequences. + + After the file name comes zero or more flags, which are `1', `2', +`3', or `4'. If there are multiple flags, spaces separate them. Here +is what the flags mean: + +`1' + This indicates the start of a new file. + +`2' + This indicates returning to a file (after having included another + file). + +`3' + This indicates that the following text comes from a system header + file, so certain warnings should be suppressed. + +`4' + This indicates that the following text should be treated as being + wrapped in an implicit `extern "C"' block. + + As an extension, the preprocessor accepts linemarkers in +non-assembler input files. They are treated like the corresponding +`#line' directive, (*note Line Control::), except that trailing flags +are permitted, and are interpreted with the meanings described above. +If multiple flags are given, they must be in ascending order. + + Some directives may be duplicated in the output of the preprocessor. +These are `#ident' (always), `#pragma' (only if the preprocessor does +not handle the pragma itself), and `#define' and `#undef' (with certain +debugging options). If this happens, the `#' of the directive will +always be in the first column, and there will be no space between the +`#' and the directive name. If macro expansion happens to generate +tokens which might be mistaken for a duplicated directive, a space will +be inserted between the `#' and the directive name. + + +File: cpp.info, Node: Traditional Mode, Next: Implementation Details, Prev: Preprocessor Output, Up: Top + +10 Traditional Mode +******************* + +Traditional (pre-standard) C preprocessing is rather different from the +preprocessing specified by the standard. When GCC is given the +`-traditional-cpp' option, it attempts to emulate a traditional +preprocessor. + + GCC versions 3.2 and later only support traditional mode semantics in +the preprocessor, and not in the compiler front ends. This chapter +outlines the traditional preprocessor semantics we implemented. + + The implementation does not correspond precisely to the behavior of +earlier versions of GCC, nor to any true traditional preprocessor. +After all, inconsistencies among traditional implementations were a +major motivation for C standardization. However, we intend that it +should be compatible with true traditional preprocessors in all ways +that actually matter. + +* Menu: + +* Traditional lexical analysis:: +* Traditional macros:: +* Traditional miscellany:: +* Traditional warnings:: + + +File: cpp.info, Node: Traditional lexical analysis, Next: Traditional macros, Up: Traditional Mode + +10.1 Traditional lexical analysis +================================= + +The traditional preprocessor does not decompose its input into tokens +the same way a standards-conforming preprocessor does. The input is +simply treated as a stream of text with minimal internal form. + + This implementation does not treat trigraphs (*note trigraphs::) +specially since they were an invention of the standards committee. It +handles arbitrarily-positioned escaped newlines properly and splices +the lines as you would expect; many traditional preprocessors did not +do this. + + The form of horizontal whitespace in the input file is preserved in +the output. In particular, hard tabs remain hard tabs. This can be +useful if, for example, you are preprocessing a Makefile. + + Traditional CPP only recognizes C-style block comments, and treats +the `/*' sequence as introducing a comment only if it lies outside +quoted text. Quoted text is introduced by the usual single and double +quotes, and also by an initial `<' in a `#include' directive. + + Traditionally, comments are completely removed and are not replaced +with a space. Since a traditional compiler does its own tokenization +of the output of the preprocessor, this means that comments can +effectively be used as token paste operators. However, comments behave +like separators for text handled by the preprocessor itself, since it +doesn't re-lex its input. For example, in + + #if foo/**/bar + +`foo' and `bar' are distinct identifiers and expanded separately if +they happen to be macros. In other words, this directive is equivalent +to + + #if foo bar + +rather than + + #if foobar + + Generally speaking, in traditional mode an opening quote need not +have a matching closing quote. In particular, a macro may be defined +with replacement text that contains an unmatched quote. Of course, if +you attempt to compile preprocessed output containing an unmatched quote +you will get a syntax error. + + However, all preprocessing directives other than `#define' require +matching quotes. For example: + + #define m This macro's fine and has an unmatched quote + "/* This is not a comment. */ + /* This is a comment. The following #include directive + is ill-formed. */ + #include ++foo; + + Function-like macros are similar in form but quite different in +behavior to their ISO counterparts. Their arguments are contained +within parentheses, are comma-separated, and can cross physical lines. +Commas within nested parentheses are not treated as argument +separators. Similarly, a quote in an argument cannot be left unclosed; +a following comma or parenthesis that comes before the closing quote is +treated like any other character. There is no facility for handling +variadic macros. + + This implementation removes all comments from macro arguments, unless +the `-C' option is given. The form of all other horizontal whitespace +in arguments is preserved, including leading and trailing whitespace. +In particular + + f( ) + +is treated as an invocation of the macro `f' with a single argument +consisting of a single space. If you want to invoke a function-like +macro that takes no arguments, you must not leave any whitespace +between the parentheses. + + If a macro argument crosses a new line, the new line is replaced with +a space when forming the argument. If the previous line contained an +unterminated quote, the following line inherits the quoted state. + + Traditional preprocessors replace parameters in the replacement text +with their arguments regardless of whether the parameters are within +quotes or not. This provides a way to stringize arguments. For example + + #define str(x) "x" + str(/* A comment */some text ) + ==> "some text " + +Note that the comment is removed, but that the trailing space is +preserved. Here is an example of using a comment to effect token +pasting. + + #define suffix(x) foo_/**/x + suffix(bar) + ==> foo_bar + + +File: cpp.info, Node: Traditional miscellany, Next: Traditional warnings, Prev: Traditional macros, Up: Traditional Mode + +10.3 Traditional miscellany +=========================== + +Here are some things to be aware of when using the traditional +preprocessor. + + * Preprocessing directives are recognized only when their leading + `#' appears in the first column. There can be no whitespace + between the beginning of the line and the `#', but whitespace can + follow the `#'. + + * A true traditional C preprocessor does not recognize `#error' or + `#pragma', and may not recognize `#elif'. CPP supports all the + directives in traditional mode that it supports in ISO mode, + including extensions, with the exception that the effects of + `#pragma GCC poison' are undefined. + + * __STDC__ is not defined. + + * If you use digraphs the behavior is undefined. + + * If a line that looks like a directive appears within macro + arguments, the behavior is undefined. + + + +File: cpp.info, Node: Traditional warnings, Prev: Traditional miscellany, Up: Traditional Mode + +10.4 Traditional warnings +========================= + +You can request warnings about features that did not exist, or worked +differently, in traditional C with the `-Wtraditional' option. GCC +does not warn about features of ISO C which you must use when you are +using a conforming compiler, such as the `#' and `##' operators. + + Presently `-Wtraditional' warns about: + + * Macro parameters that appear within string literals in the macro + body. In traditional C macro replacement takes place within + string literals, but does not in ISO C. + + * In traditional C, some preprocessor directives did not exist. + Traditional preprocessors would only consider a line to be a + directive if the `#' appeared in column 1 on the line. Therefore + `-Wtraditional' warns about directives that traditional C + understands but would ignore because the `#' does not appear as the + first character on the line. It also suggests you hide directives + like `#pragma' not understood by traditional C by indenting them. + Some traditional implementations would not recognize `#elif', so it + suggests avoiding it altogether. + + * A function-like macro that appears without an argument list. In + some traditional preprocessors this was an error. In ISO C it + merely means that the macro is not expanded. + + * The unary plus operator. This did not exist in traditional C. + + * The `U' and `LL' integer constant suffixes, which were not + available in traditional C. (Traditional C does support the `L' + suffix for simple long integer constants.) You are not warned + about uses of these suffixes in macros defined in system headers. + For instance, `UINT_MAX' may well be defined as `4294967295U', but + you will not be warned if you use `UINT_MAX'. + + You can usually avoid the warning, and the related warning about + constants which are so large that they are unsigned, by writing the + integer constant in question in hexadecimal, with no U suffix. + Take care, though, because this gives the wrong result in exotic + cases. + + +File: cpp.info, Node: Implementation Details, Next: Invocation, Prev: Traditional Mode, Up: Top + +11 Implementation Details +************************* + +Here we document details of how the preprocessor's implementation +affects its user-visible behavior. You should try to avoid undue +reliance on behavior described here, as it is possible that it will +change subtly in future implementations. + + Also documented here are obsolete features and changes from previous +versions of CPP. + +* Menu: + +* Implementation-defined behavior:: +* Implementation limits:: +* Obsolete Features:: +* Differences from previous versions:: + + +File: cpp.info, Node: Implementation-defined behavior, Next: Implementation limits, Up: Implementation Details + +11.1 Implementation-defined behavior +==================================== + +This is how CPP behaves in all the cases which the C standard describes +as "implementation-defined". This term means that the implementation +is free to do what it likes, but must document its choice and stick to +it. + + * The mapping of physical source file multi-byte characters to the + execution character set. + + The input character set can be specified using the + `-finput-charset' option, while the execution character set may be + controlled using the `-fexec-charset' and `-fwide-exec-charset' + options. + + * Identifier characters. + + The C and C++ standards allow identifiers to be composed of `_' + and the alphanumeric characters. C++ and C99 also allow universal + character names, and C99 further permits implementation-defined + characters. GCC currently only permits universal character names + if `-fextended-identifiers' is used, because the implementation of + universal character names in identifiers is experimental. + + GCC allows the `$' character in identifiers as an extension for + most targets. This is true regardless of the `std=' switch, since + this extension cannot conflict with standards-conforming programs. + When preprocessing assembler, however, dollars are not identifier + characters by default. + + Currently the targets that by default do not permit `$' are AVR, + IP2K, MMIX, MIPS Irix 3, ARM aout, and PowerPC targets for the AIX + operating system. + + You can override the default with `-fdollars-in-identifiers' or + `fno-dollars-in-identifiers'. *Note fdollars-in-identifiers::. + + * Non-empty sequences of whitespace characters. + + In textual output, each whitespace sequence is collapsed to a + single space. For aesthetic reasons, the first token on each + non-directive line of output is preceded with sufficient spaces + that it appears in the same column as it did in the original + source file. + + * The numeric value of character constants in preprocessor + expressions. + + The preprocessor and compiler interpret character constants in the + same way; i.e. escape sequences such as `\a' are given the values + they would have on the target machine. + + The compiler values a multi-character character constant a + character at a time, shifting the previous value left by the + number of bits per target character, and then or-ing in the + bit-pattern of the new character truncated to the width of a + target character. The final bit-pattern is given type `int', and + is therefore signed, regardless of whether single characters are + signed or not (a slight change from versions 3.1 and earlier of + GCC). If there are more characters in the constant than would fit + in the target `int' the compiler issues a warning, and the excess + leading characters are ignored. + + For example, `'ab'' for a target with an 8-bit `char' would be + interpreted as + `(int) ((unsigned char) 'a' * 256 + (unsigned char) 'b')', and + `'\234a'' as + `(int) ((unsigned char) '\234' * 256 + (unsigned char) 'a')'. + + * Source file inclusion. + + For a discussion on how the preprocessor locates header files, + *Note Include Operation::. + + * Interpretation of the filename resulting from a macro-expanded + `#include' directive. + + *Note Computed Includes::. + + * Treatment of a `#pragma' directive that after macro-expansion + results in a standard pragma. + + No macro expansion occurs on any `#pragma' directive line, so the + question does not arise. + + Note that GCC does not yet implement any of the standard pragmas. + + + +File: cpp.info, Node: Implementation limits, Next: Obsolete Features, Prev: Implementation-defined behavior, Up: Implementation Details + +11.2 Implementation limits +========================== + +CPP has a small number of internal limits. This section lists the +limits which the C standard requires to be no lower than some minimum, +and all the others known. It is intended that there should be as few +limits as possible. If you encounter an undocumented or inconvenient +limit, please report that as a bug. *Note Reporting Bugs: (gcc)Bugs. + + Where we say something is limited "only by available memory", that +means that internal data structures impose no intrinsic limit, and space +is allocated with `malloc' or equivalent. The actual limit will +therefore depend on many things, such as the size of other things +allocated by the compiler at the same time, the amount of memory +consumed by other processes on the same computer, etc. + + * Nesting levels of `#include' files. + + We impose an arbitrary limit of 200 levels, to avoid runaway + recursion. The standard requires at least 15 levels. + + * Nesting levels of conditional inclusion. + + The C standard mandates this be at least 63. CPP is limited only + by available memory. + + * Levels of parenthesized expressions within a full expression. + + The C standard requires this to be at least 63. In preprocessor + conditional expressions, it is limited only by available memory. + + * Significant initial characters in an identifier or macro name. + + The preprocessor treats all characters as significant. The C + standard requires only that the first 63 be significant. + + * Number of macros simultaneously defined in a single translation + unit. + + The standard requires at least 4095 be possible. CPP is limited + only by available memory. + + * Number of parameters in a macro definition and arguments in a + macro call. + + We allow `USHRT_MAX', which is no smaller than 65,535. The minimum + required by the standard is 127. + + * Number of characters on a logical source line. + + The C standard requires a minimum of 4096 be permitted. CPP places + no limits on this, but you may get incorrect column numbers + reported in diagnostics for lines longer than 65,535 characters. + + * Maximum size of a source file. + + The standard does not specify any lower limit on the maximum size + of a source file. GNU cpp maps files into memory, so it is + limited by the available address space. This is generally at + least two gigabytes. Depending on the operating system, the size + of physical memory may or may not be a limitation. + + + +File: cpp.info, Node: Obsolete Features, Next: Differences from previous versions, Prev: Implementation limits, Up: Implementation Details + +11.3 Obsolete Features +====================== + +CPP has some features which are present mainly for compatibility with +older programs. We discourage their use in new code. In some cases, +we plan to remove the feature in a future version of GCC. + +11.3.1 Assertions +----------------- + +"Assertions" are a deprecated alternative to macros in writing +conditionals to test what sort of computer or system the compiled +program will run on. Assertions are usually predefined, but you can +define them with preprocessing directives or command-line options. + + Assertions were intended to provide a more systematic way to describe +the compiler's target system. However, in practice they are just as +unpredictable as the system-specific predefined macros. In addition, +they are not part of any standard, and only a few compilers support +them. Therefore, the use of assertions is *less* portable than the use +of system-specific predefined macros. We recommend you do not use them +at all. + + An assertion looks like this: + + #PREDICATE (ANSWER) + +PREDICATE must be a single identifier. ANSWER can be any sequence of +tokens; all characters are significant except for leading and trailing +whitespace, and differences in internal whitespace sequences are +ignored. (This is similar to the rules governing macro redefinition.) +Thus, `(x + y)' is different from `(x+y)' but equivalent to +`( x + y )'. Parentheses do not nest inside an answer. + + To test an assertion, you write it in an `#if'. For example, this +conditional succeeds if either `vax' or `ns16000' has been asserted as +an answer for `machine'. + + #if #machine (vax) || #machine (ns16000) + +You can test whether _any_ answer is asserted for a predicate by +omitting the answer in the conditional: + + #if #machine + + Assertions are made with the `#assert' directive. Its sole argument +is the assertion to make, without the leading `#' that identifies +assertions in conditionals. + + #assert PREDICATE (ANSWER) + +You may make several assertions with the same predicate and different +answers. Subsequent assertions do not override previous ones for the +same predicate. All the answers for any given predicate are +simultaneously true. + + Assertions can be canceled with the `#unassert' directive. It has +the same syntax as `#assert'. In that form it cancels only the answer +which was specified on the `#unassert' line; other answers for that +predicate remain true. You can cancel an entire predicate by leaving +out the answer: + + #unassert PREDICATE + +In either form, if no such assertion has been made, `#unassert' has no +effect. + + You can also make or cancel assertions using command line options. +*Note Invocation::. + + +File: cpp.info, Node: Differences from previous versions, Prev: Obsolete Features, Up: Implementation Details + +11.4 Differences from previous versions +======================================= + +This section details behavior which has changed from previous versions +of CPP. We do not plan to change it again in the near future, but we +do not promise not to, either. + + The "previous versions" discussed here are 2.95 and before. The +behavior of GCC 3.0 is mostly the same as the behavior of the widely +used 2.96 and 2.97 development snapshots. Where there are differences, +they generally represent bugs in the snapshots. + + * -I- deprecated + + This option has been deprecated in 4.0. `-iquote' is meant to + replace the need for this option. + + * Order of evaluation of `#' and `##' operators + + The standard does not specify the order of evaluation of a chain of + `##' operators, nor whether `#' is evaluated before, after, or at + the same time as `##'. You should therefore not write any code + which depends on any specific ordering. It is possible to + guarantee an ordering, if you need one, by suitable use of nested + macros. + + An example of where this might matter is pasting the arguments `1', + `e' and `-2'. This would be fine for left-to-right pasting, but + right-to-left pasting would produce an invalid token `e-2'. + + GCC 3.0 evaluates `#' and `##' at the same time and strictly left + to right. Older versions evaluated all `#' operators first, then + all `##' operators, in an unreliable order. + + * The form of whitespace between tokens in preprocessor output + + *Note Preprocessor Output::, for the current textual format. This + is also the format used by stringification. Normally, the + preprocessor communicates tokens directly to the compiler's + parser, and whitespace does not come up at all. + + Older versions of GCC preserved all whitespace provided by the + user and inserted lots more whitespace of their own, because they + could not accurately predict when extra spaces were needed to + prevent accidental token pasting. + + * Optional argument when invoking rest argument macros + + As an extension, GCC permits you to omit the variable arguments + entirely when you use a variable argument macro. This is + forbidden by the 1999 C standard, and will provoke a pedantic + warning with GCC 3.0. Previous versions accepted it silently. + + * `##' swallowing preceding text in rest argument macros + + Formerly, in a macro expansion, if `##' appeared before a variable + arguments parameter, and the set of tokens specified for that + argument in the macro invocation was empty, previous versions of + CPP would back up and remove the preceding sequence of + non-whitespace characters (*not* the preceding token). This + extension is in direct conflict with the 1999 C standard and has + been drastically pared back. + + In the current version of the preprocessor, if `##' appears between + a comma and a variable arguments parameter, and the variable + argument is omitted entirely, the comma will be removed from the + expansion. If the variable argument is empty, or the token before + `##' is not a comma, then `##' behaves as a normal token paste. + + * `#line' and `#include' + + The `#line' directive used to change GCC's notion of the + "directory containing the current file", used by `#include' with a + double-quoted header file name. In 3.0 and later, it does not. + *Note Line Control::, for further explanation. + + * Syntax of `#line' + + In GCC 2.95 and previous, the string constant argument to `#line' + was treated the same way as the argument to `#include': backslash + escapes were not honored, and the string ended at the second `"'. + This is not compliant with the C standard. In GCC 3.0, an attempt + was made to correct the behavior, so that the string was treated + as a real string constant, but it turned out to be buggy. In 3.1, + the bugs have been fixed. (We are not fixing the bugs in 3.0 + because they affect relatively few people and the fix is quite + invasive.) + + + +File: cpp.info, Node: Invocation, Next: Environment Variables, Prev: Implementation Details, Up: Top + +12 Invocation +************* + +Most often when you use the C preprocessor you will not have to invoke +it explicitly: the C compiler will do so automatically. However, the +preprocessor is sometimes useful on its own. All the options listed +here are also acceptable to the C compiler and have the same meaning, +except that the C compiler has different rules for specifying the output +file. + + _Note:_ Whether you use the preprocessor by way of `gcc' or `cpp', +the "compiler driver" is run first. This program's purpose is to +translate your command into invocations of the programs that do the +actual work. Their command line interfaces are similar but not +identical to the documented interface, and may change without notice. + + The C preprocessor expects two file names as arguments, INFILE and +OUTFILE. The preprocessor reads INFILE together with any other files +it specifies with `#include'. All the output generated by the combined +input files is written in OUTFILE. + + Either INFILE or OUTFILE may be `-', which as INFILE means to read +from standard input and as OUTFILE means to write to standard output. +Also, if either file is omitted, it means the same as if `-' had been +specified for that file. + + Unless otherwise noted, or the option ends in `=', all options which +take an argument may have that argument appear either immediately after +the option, or with a space between option and argument: `-Ifoo' and +`-I foo' have the same effect. + + Many options have multi-letter names; therefore multiple +single-letter options may _not_ be grouped: `-dM' is very different from +`-d -M'. + +`-D NAME' + Predefine NAME as a macro, with definition `1'. + +`-D NAME=DEFINITION' + The contents of DEFINITION are tokenized and processed as if they + appeared during translation phase three in a `#define' directive. + In particular, the definition will be truncated by embedded + newline characters. + + If you are invoking the preprocessor from a shell or shell-like + program you may need to use the shell's quoting syntax to protect + characters such as spaces that have a meaning in the shell syntax. + + If you wish to define a function-like macro on the command line, + write its argument list with surrounding parentheses before the + equals sign (if any). Parentheses are meaningful to most shells, + so you will need to quote the option. With `sh' and `csh', + `-D'NAME(ARGS...)=DEFINITION'' works. + + `-D' and `-U' options are processed in the order they are given on + the command line. All `-imacros FILE' and `-include FILE' options + are processed after all `-D' and `-U' options. + +`-U NAME' + Cancel any previous definition of NAME, either built in or + provided with a `-D' option. + +`-undef' + Do not predefine any system-specific or GCC-specific macros. The + standard predefined macros remain defined. *Note Standard + Predefined Macros::. + +`-I DIR' + Add the directory DIR to the list of directories to be searched + for header files. *Note Search Path::. Directories named by `-I' + are searched before the standard system include directories. If + the directory DIR is a standard system include directory, the + option is ignored to ensure that the default search order for + system directories and the special treatment of system headers are + not defeated (*note System Headers::) . If DIR begins with `=', + then the `=' will be replaced by the sysroot prefix; see + `--sysroot' and `-isysroot'. + +`-o FILE' + Write output to FILE. This is the same as specifying FILE as the + second non-option argument to `cpp'. `gcc' has a different + interpretation of a second non-option argument, so you must use + `-o' to specify the output file. + +`-Wall' + Turns on all optional warnings which are desirable for normal code. + At present this is `-Wcomment', `-Wtrigraphs', `-Wmultichar' and a + warning about integer promotion causing a change of sign in `#if' + expressions. Note that many of the preprocessor's warnings are on + by default and have no options to control them. + +`-Wcomment' +`-Wcomments' + Warn whenever a comment-start sequence `/*' appears in a `/*' + comment, or whenever a backslash-newline appears in a `//' comment. + (Both forms have the same effect.) + +`-Wtrigraphs' + Most trigraphs in comments cannot affect the meaning of the + program. However, a trigraph that would form an escaped newline + (`??/' at the end of a line) can, by changing where the comment + begins or ends. Therefore, only trigraphs that would form escaped + newlines produce warnings inside a comment. + + This option is implied by `-Wall'. If `-Wall' is not given, this + option is still enabled unless trigraphs are enabled. To get + trigraph conversion without warnings, but get the other `-Wall' + warnings, use `-trigraphs -Wall -Wno-trigraphs'. + +`-Wtraditional' + Warn about certain constructs that behave differently in + traditional and ISO C. Also warn about ISO C constructs that have + no traditional C equivalent, and problematic constructs which + should be avoided. *Note Traditional Mode::. + +`-Wundef' + Warn whenever an identifier which is not a macro is encountered in + an `#if' directive, outside of `defined'. Such identifiers are + replaced with zero. + +`-Wunused-macros' + Warn about macros defined in the main file that are unused. A + macro is "used" if it is expanded or tested for existence at least + once. The preprocessor will also warn if the macro has not been + used at the time it is redefined or undefined. + + Built-in macros, macros defined on the command line, and macros + defined in include files are not warned about. + + _Note:_ If a macro is actually used, but only used in skipped + conditional blocks, then CPP will report it as unused. To avoid + the warning in such a case, you might improve the scope of the + macro's definition by, for example, moving it into the first + skipped block. Alternatively, you could provide a dummy use with + something like: + + #if defined the_macro_causing_the_warning + #endif + +`-Wendif-labels' + Warn whenever an `#else' or an `#endif' are followed by text. + This usually happens in code of the form + + #if FOO + ... + #else FOO + ... + #endif FOO + + The second and third `FOO' should be in comments, but often are not + in older programs. This warning is on by default. + +`-Werror' + Make all warnings into hard errors. Source code which triggers + warnings will be rejected. + +`-Wsystem-headers' + Issue warnings for code in system headers. These are normally + unhelpful in finding bugs in your own code, therefore suppressed. + If you are responsible for the system library, you may want to see + them. + +`-w' + Suppress all warnings, including those which GNU CPP issues by + default. + +`-pedantic' + Issue all the mandatory diagnostics listed in the C standard. + Some of them are left out by default, since they trigger + frequently on harmless code. + +`-pedantic-errors' + Issue all the mandatory diagnostics, and make all mandatory + diagnostics into errors. This includes mandatory diagnostics that + GCC issues without `-pedantic' but treats as warnings. + +`-M' + Instead of outputting the result of preprocessing, output a rule + suitable for `make' describing the dependencies of the main source + file. The preprocessor outputs one `make' rule containing the + object file name for that source file, a colon, and the names of + all the included files, including those coming from `-include' or + `-imacros' command line options. + + Unless specified explicitly (with `-MT' or `-MQ'), the object file + name consists of the name of the source file with any suffix + replaced with object file suffix and with any leading directory + parts removed. If there are many included files then the rule is + split into several lines using `\'-newline. The rule has no + commands. + + This option does not suppress the preprocessor's debug output, + such as `-dM'. To avoid mixing such debug output with the + dependency rules you should explicitly specify the dependency + output file with `-MF', or use an environment variable like + `DEPENDENCIES_OUTPUT' (*note Environment Variables::). Debug + output will still be sent to the regular output stream as normal. + + Passing `-M' to the driver implies `-E', and suppresses warnings + with an implicit `-w'. + +`-MM' + Like `-M' but do not mention header files that are found in system + header directories, nor header files that are included, directly + or indirectly, from such a header. + + This implies that the choice of angle brackets or double quotes in + an `#include' directive does not in itself determine whether that + header will appear in `-MM' dependency output. This is a slight + change in semantics from GCC versions 3.0 and earlier. + +`-MF FILE' + When used with `-M' or `-MM', specifies a file to write the + dependencies to. If no `-MF' switch is given the preprocessor + sends the rules to the same place it would have sent preprocessed + output. + + When used with the driver options `-MD' or `-MMD', `-MF' overrides + the default dependency output file. + +`-MG' + In conjunction with an option such as `-M' requesting dependency + generation, `-MG' assumes missing header files are generated files + and adds them to the dependency list without raising an error. + The dependency filename is taken directly from the `#include' + directive without prepending any path. `-MG' also suppresses + preprocessed output, as a missing header file renders this useless. + + This feature is used in automatic updating of makefiles. + +`-MP' + This option instructs CPP to add a phony target for each dependency + other than the main file, causing each to depend on nothing. These + dummy rules work around errors `make' gives if you remove header + files without updating the `Makefile' to match. + + This is typical output: + + test.o: test.c test.h + + test.h: + +`-MT TARGET' + Change the target of the rule emitted by dependency generation. By + default CPP takes the name of the main input file, deletes any + directory components and any file suffix such as `.c', and appends + the platform's usual object suffix. The result is the target. + + An `-MT' option will set the target to be exactly the string you + specify. If you want multiple targets, you can specify them as a + single argument to `-MT', or use multiple `-MT' options. + + For example, `-MT '$(objpfx)foo.o'' might give + + $(objpfx)foo.o: foo.c + +`-MQ TARGET' + Same as `-MT', but it quotes any characters which are special to + Make. `-MQ '$(objpfx)foo.o'' gives + + $$(objpfx)foo.o: foo.c + + The default target is automatically quoted, as if it were given + with `-MQ'. + +`-MD' + `-MD' is equivalent to `-M -MF FILE', except that `-E' is not + implied. The driver determines FILE based on whether an `-o' + option is given. If it is, the driver uses its argument but with + a suffix of `.d', otherwise it takes the name of the input file, + removes any directory components and suffix, and applies a `.d' + suffix. + + If `-MD' is used in conjunction with `-E', any `-o' switch is + understood to specify the dependency output file (*note -MF: + dashMF.), but if used without `-E', each `-o' is understood to + specify a target object file. + + Since `-E' is not implied, `-MD' can be used to generate a + dependency output file as a side-effect of the compilation process. + +`-MMD' + Like `-MD' except mention only user header files, not system + header files. + +`-x c' +`-x c++' +`-x objective-c' +`-x assembler-with-cpp' + Specify the source language: C, C++, Objective-C, or assembly. + This has nothing to do with standards conformance or extensions; + it merely selects which base syntax to expect. If you give none + of these options, cpp will deduce the language from the extension + of the source file: `.c', `.cc', `.m', or `.S'. Some other common + extensions for C++ and assembly are also recognized. If cpp does + not recognize the extension, it will treat the file as C; this is + the most generic mode. + + _Note:_ Previous versions of cpp accepted a `-lang' option which + selected both the language and the standards conformance level. + This option has been removed, because it conflicts with the `-l' + option. + +`-std=STANDARD' +`-ansi' + Specify the standard to which the code should conform. Currently + CPP knows about C and C++ standards; others may be added in the + future. + + STANDARD may be one of: + `iso9899:1990' + `c89' + The ISO C standard from 1990. `c89' is the customary + shorthand for this version of the standard. + + The `-ansi' option is equivalent to `-std=c89'. + + `iso9899:199409' + The 1990 C standard, as amended in 1994. + + `iso9899:1999' + `c99' + `iso9899:199x' + `c9x' + The revised ISO C standard, published in December 1999. + Before publication, this was known as C9X. + + `gnu89' + The 1990 C standard plus GNU extensions. This is the default. + + `gnu99' + `gnu9x' + The 1999 C standard plus GNU extensions. + + `c++98' + The 1998 ISO C++ standard plus amendments. + + `gnu++98' + The same as `-std=c++98' plus GNU extensions. This is the + default for C++ code. + +`-I-' + Split the include path. Any directories specified with `-I' + options before `-I-' are searched only for headers requested with + `#include "FILE"'; they are not searched for `#include '. + If additional directories are specified with `-I' options after + the `-I-', those directories are searched for all `#include' + directives. + + In addition, `-I-' inhibits the use of the directory of the current + file directory as the first search directory for `#include "FILE"'. + *Note Search Path::. This option has been deprecated. + +`-nostdinc' + Do not search the standard system directories for header files. + Only the directories you have specified with `-I' options (and the + directory of the current file, if appropriate) are searched. + +`-nostdinc++' + Do not search for header files in the C++-specific standard + directories, but do still search the other standard directories. + (This option is used when building the C++ library.) + +`-include FILE' + Process FILE as if `#include "file"' appeared as the first line of + the primary source file. However, the first directory searched + for FILE is the preprocessor's working directory _instead of_ the + directory containing the main source file. If not found there, it + is searched for in the remainder of the `#include "..."' search + chain as normal. + + If multiple `-include' options are given, the files are included + in the order they appear on the command line. + +`-imacros FILE' + Exactly like `-include', except that any output produced by + scanning FILE is thrown away. Macros it defines remain defined. + This allows you to acquire all the macros from a header without + also processing its declarations. + + All files specified by `-imacros' are processed before all files + specified by `-include'. + +`-idirafter DIR' + Search DIR for header files, but do it _after_ all directories + specified with `-I' and the standard system directories have been + exhausted. DIR is treated as a system include directory. If DIR + begins with `=', then the `=' will be replaced by the sysroot + prefix; see `--sysroot' and `-isysroot'. + +`-iprefix PREFIX' + Specify PREFIX as the prefix for subsequent `-iwithprefix' + options. If the prefix represents a directory, you should include + the final `/'. + +`-iwithprefix DIR' +`-iwithprefixbefore DIR' + Append DIR to the prefix specified previously with `-iprefix', and + add the resulting directory to the include search path. + `-iwithprefixbefore' puts it in the same place `-I' would; + `-iwithprefix' puts it where `-idirafter' would. + +`-isysroot DIR' + This option is like the `--sysroot' option, but applies only to + header files. See the `--sysroot' option for more information. + +`-imultilib DIR' + Use DIR as a subdirectory of the directory containing + target-specific C++ headers. + +`-isystem DIR' + Search DIR for header files, after all directories specified by + `-I' but before the standard system directories. Mark it as a + system directory, so that it gets the same special treatment as is + applied to the standard system directories. *Note System + Headers::. If DIR begins with `=', then the `=' will be replaced + by the sysroot prefix; see `--sysroot' and `-isysroot'. + +`-iquote DIR' + Search DIR only for header files requested with `#include "FILE"'; + they are not searched for `#include ', before all + directories specified by `-I' and before the standard system + directories. *Note Search Path::. If DIR begins with `=', then + the `=' will be replaced by the sysroot prefix; see `--sysroot' + and `-isysroot'. + +`-fdirectives-only' + When preprocessing, handle directives, but do not expand macros. + + The option's behavior depends on the `-E' and `-fpreprocessed' + options. + + With `-E', preprocessing is limited to the handling of directives + such as `#define', `#ifdef', and `#error'. Other preprocessor + operations, such as macro expansion and trigraph conversion are + not performed. In addition, the `-dD' option is implicitly + enabled. + + With `-fpreprocessed', predefinition of command line and most + builtin macros is disabled. Macros such as `__LINE__', which are + contextually dependent, are handled normally. This enables + compilation of files previously preprocessed with `-E + -fdirectives-only'. + + With both `-E' and `-fpreprocessed', the rules for + `-fpreprocessed' take precedence. This enables full preprocessing + of files previously preprocessed with `-E -fdirectives-only'. + +`-fdollars-in-identifiers' + Accept `$' in identifiers. *Note Identifier characters::. + +`-fextended-identifiers' + Accept universal character names in identifiers. This option is + experimental; in a future version of GCC, it will be enabled by + default for C99 and C++. + +`-fpreprocessed' + Indicate to the preprocessor that the input file has already been + preprocessed. This suppresses things like macro expansion, + trigraph conversion, escaped newline splicing, and processing of + most directives. The preprocessor still recognizes and removes + comments, so that you can pass a file preprocessed with `-C' to + the compiler without problems. In this mode the integrated + preprocessor is little more than a tokenizer for the front ends. + + `-fpreprocessed' is implicit if the input file has one of the + extensions `.i', `.ii' or `.mi'. These are the extensions that + GCC uses for preprocessed files created by `-save-temps'. + +`-ftabstop=WIDTH' + Set the distance between tab stops. This helps the preprocessor + report correct column numbers in warnings or errors, even if tabs + appear on the line. If the value is less than 1 or greater than + 100, the option is ignored. The default is 8. + +`-fexec-charset=CHARSET' + Set the execution character set, used for string and character + constants. The default is UTF-8. CHARSET can be any encoding + supported by the system's `iconv' library routine. + +`-fwide-exec-charset=CHARSET' + Set the wide execution character set, used for wide string and + character constants. The default is UTF-32 or UTF-16, whichever + corresponds to the width of `wchar_t'. As with `-fexec-charset', + CHARSET can be any encoding supported by the system's `iconv' + library routine; however, you will have problems with encodings + that do not fit exactly in `wchar_t'. + +`-finput-charset=CHARSET' + Set the input character set, used for translation from the + character set of the input file to the source character set used + by GCC. If the locale does not specify, or GCC cannot get this + information from the locale, the default is UTF-8. This can be + overridden by either the locale or this command line option. + Currently the command line option takes precedence if there's a + conflict. CHARSET can be any encoding supported by the system's + `iconv' library routine. + +`-fworking-directory' + Enable generation of linemarkers in the preprocessor output that + will let the compiler know the current working directory at the + time of preprocessing. When this option is enabled, the + preprocessor will emit, after the initial linemarker, a second + linemarker with the current working directory followed by two + slashes. GCC will use this directory, when it's present in the + preprocessed input, as the directory emitted as the current + working directory in some debugging information formats. This + option is implicitly enabled if debugging information is enabled, + but this can be inhibited with the negated form + `-fno-working-directory'. If the `-P' flag is present in the + command line, this option has no effect, since no `#line' + directives are emitted whatsoever. + +`-fno-show-column' + Do not print column numbers in diagnostics. This may be necessary + if diagnostics are being scanned by a program that does not + understand the column numbers, such as `dejagnu'. + +`-A PREDICATE=ANSWER' + Make an assertion with the predicate PREDICATE and answer ANSWER. + This form is preferred to the older form `-A PREDICATE(ANSWER)', + which is still supported, because it does not use shell special + characters. *Note Obsolete Features::. + +`-A -PREDICATE=ANSWER' + Cancel an assertion with the predicate PREDICATE and answer ANSWER. + +`-dCHARS' + CHARS is a sequence of one or more of the following characters, + and must not be preceded by a space. Other characters are + interpreted by the compiler proper, or reserved for future + versions of GCC, and so are silently ignored. If you specify + characters whose behavior conflicts, the result is undefined. + + `M' + Instead of the normal output, generate a list of `#define' + directives for all the macros defined during the execution of + the preprocessor, including predefined macros. This gives + you a way of finding out what is predefined in your version + of the preprocessor. Assuming you have no file `foo.h', the + command + + touch foo.h; cpp -dM foo.h + + will show all the predefined macros. + + If you use `-dM' without the `-E' option, `-dM' is + interpreted as a synonym for `-fdump-rtl-mach'. *Note + Debugging Options: (gcc)Debugging Options. + + `D' + Like `M' except in two respects: it does _not_ include the + predefined macros, and it outputs _both_ the `#define' + directives and the result of preprocessing. Both kinds of + output go to the standard output file. + + `N' + Like `D', but emit only the macro names, not their expansions. + + `I' + Output `#include' directives in addition to the result of + preprocessing. + + `U' + Like `D' except that only macros that are expanded, or whose + definedness is tested in preprocessor directives, are output; + the output is delayed until the use or test of the macro; and + `#undef' directives are also output for macros tested but + undefined at the time. + +`-P' + Inhibit generation of linemarkers in the output from the + preprocessor. This might be useful when running the preprocessor + on something that is not C code, and will be sent to a program + which might be confused by the linemarkers. *Note Preprocessor + Output::. + +`-C' + Do not discard comments. All comments are passed through to the + output file, except for comments in processed directives, which + are deleted along with the directive. + + You should be prepared for side effects when using `-C'; it causes + the preprocessor to treat comments as tokens in their own right. + For example, comments appearing at the start of what would be a + directive line have the effect of turning that line into an + ordinary source line, since the first token on the line is no + longer a `#'. + +`-CC' + Do not discard comments, including during macro expansion. This is + like `-C', except that comments contained within macros are also + passed through to the output file where the macro is expanded. + + In addition to the side-effects of the `-C' option, the `-CC' + option causes all C++-style comments inside a macro to be + converted to C-style comments. This is to prevent later use of + that macro from inadvertently commenting out the remainder of the + source line. + + The `-CC' option is generally used to support lint comments. + +`-traditional-cpp' + Try to imitate the behavior of old-fashioned C preprocessors, as + opposed to ISO C preprocessors. *Note Traditional Mode::. + +`-trigraphs' + Process trigraph sequences. *Note Initial processing::. + +`-remap' + Enable special code to work around file systems which only permit + very short file names, such as MS-DOS. + +`--help' +`--target-help' + Print text describing all the command line options instead of + preprocessing anything. + +`-v' + Verbose mode. Print out GNU CPP's version number at the beginning + of execution, and report the final form of the include path. + +`-H' + Print the name of each header file used, in addition to other + normal activities. Each name is indented to show how deep in the + `#include' stack it is. Precompiled header files are also + printed, even if they are found to be invalid; an invalid + precompiled header file is printed with `...x' and a valid one + with `...!' . + +`-version' +`--version' + Print out GNU CPP's version number. With one dash, proceed to + preprocess as normal. With two dashes, exit immediately. + + +File: cpp.info, Node: Environment Variables, Next: GNU Free Documentation License, Prev: Invocation, Up: Top + +13 Environment Variables +************************ + +This section describes the environment variables that affect how CPP +operates. You can use them to specify directories or prefixes to use +when searching for include files, or to control dependency output. + + Note that you can also specify places to search using options such as +`-I', and control dependency output with options like `-M' (*note +Invocation::). These take precedence over environment variables, which +in turn take precedence over the configuration of GCC. + +`CPATH' +`C_INCLUDE_PATH' +`CPLUS_INCLUDE_PATH' +`OBJC_INCLUDE_PATH' + Each variable's value is a list of directories separated by a + special character, much like `PATH', in which to look for header + files. The special character, `PATH_SEPARATOR', is + target-dependent and determined at GCC build time. For Microsoft + Windows-based targets it is a semicolon, and for almost all other + targets it is a colon. + + `CPATH' specifies a list of directories to be searched as if + specified with `-I', but after any paths given with `-I' options + on the command line. This environment variable is used regardless + of which language is being preprocessed. + + The remaining environment variables apply only when preprocessing + the particular language indicated. Each specifies a list of + directories to be searched as if specified with `-isystem', but + after any paths given with `-isystem' options on the command line. + + In all these variables, an empty element instructs the compiler to + search its current working directory. Empty elements can appear + at the beginning or end of a path. For instance, if the value of + `CPATH' is `:/special/include', that has the same effect as + `-I. -I/special/include'. + + See also *Note Search Path::. + +`DEPENDENCIES_OUTPUT' + If this variable is set, its value specifies how to output + dependencies for Make based on the non-system header files + processed by the compiler. System header files are ignored in the + dependency output. + + The value of `DEPENDENCIES_OUTPUT' can be just a file name, in + which case the Make rules are written to that file, guessing the + target name from the source file name. Or the value can have the + form `FILE TARGET', in which case the rules are written to file + FILE using TARGET as the target name. + + In other words, this environment variable is equivalent to + combining the options `-MM' and `-MF' (*note Invocation::), with + an optional `-MT' switch too. + +`SUNPRO_DEPENDENCIES' + This variable is the same as `DEPENDENCIES_OUTPUT' (see above), + except that system header files are not ignored, so it implies + `-M' rather than `-MM'. However, the dependence on the main input + file is omitted. *Note Invocation::. + + +File: cpp.info, Node: GNU Free Documentation License, Next: Index of Directives, Prev: Environment Variables, Up: Top + +GNU Free Documentation License +****************************** + + Version 1.2, November 2002 + + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document "free" in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it + can be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + "Document", below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as "you". You + accept the license if you copy, modify or distribute the work in a + way requiring permission under copyright law. + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document's overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. If a section does not fit the above definition of + Secondary then it is not allowed to be designated as Invariant. + The Document may contain zero Invariant Sections. If the Document + does not identify any Invariant Sections then there are none. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup, or absence of + markup, has been arranged to thwart or discourage subsequent + modification by readers is not Transparent. An image format is + not Transparent if used for any substantial amount of text. A + copy that is not "Transparent" is called "Opaque". + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML, PostScript or PDF designed for + human modification. Examples of transparent image formats include + PNG, XCF and JPG. Opaque formats include proprietary formats that + can be read and edited only by proprietary word processors, SGML or + XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML, PostScript or PDF + produced by some word processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + A section "Entitled XYZ" means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + "Acknowledgements", "Dedications", "Endorsements", or "History".) + To "Preserve the Title" of such a section when you modify the + Document means that it remains a section "Entitled XYZ" according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document's license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a computer-network location from + which the general network-using public has access to download + using public-standard network protocols a complete Transparent + copy of the Document, free of added material. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of + previous versions (which should, if there were any, be listed + in the History section of the Document). You may use the + same title as a previous version if the original publisher of + that version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled "History", Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on + the Title Page. If there is no section Entitled "History" in + the Document, create one stating the title, year, authors, + and publisher of the Document as given on its Title Page, + then add an item describing the Modified Version as stated in + the previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in + the "History" section. You may omit a network location for a + work that was published at least four years before the + Document itself, or if the original publisher of the version + it refers to gives permission. + + K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the + section all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section + titles. + + M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + "Endorsements" or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section Entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties--for example, statements of peer review or that the text + has been approved by an organization as the authoritative + definition of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + "History" in the various original documents, forming one section + Entitled "History"; likewise combine any sections Entitled + "Acknowledgements", and any sections Entitled "Dedications". You + must delete all sections Entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, is called an "aggregate" if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation's users beyond what the individual + works permit. When the Document is included in an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document's Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled "Acknowledgements", + "Dedications", or "History", the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document is + void, and will automatically terminate your rights under this + License. However, parties who have received copies, or rights, + from you under this License will not have their licenses + terminated so long as such parties remain in full compliance. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + `http://www.gnu.org/copyleft/'. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + +File: cpp.info, Node: Index of Directives, Next: Option Index, Prev: GNU Free Documentation License, Up: Top + +Index of Directives +******************* + +[index] +* Menu: + +* #assert: Obsolete Features. (line 48) +* #define: Object-like Macros. (line 11) +* #elif: Elif. (line 6) +* #else: Else. (line 6) +* #endif: Ifdef. (line 6) +* #error: Diagnostics. (line 6) +* #ident: Other Directives. (line 6) +* #if: Conditional Syntax. (line 6) +* #ifdef: Ifdef. (line 6) +* #ifndef: Ifdef. (line 40) +* #import: Alternatives to Wrapper #ifndef. + (line 11) +* #include: Include Syntax. (line 6) +* #include_next: Wrapper Headers. (line 6) +* #line: Line Control. (line 20) +* #pragma GCC dependency: Pragmas. (line 53) +* #pragma GCC poison: Pragmas. (line 65) +* #pragma GCC system_header <1>: Pragmas. (line 92) +* #pragma GCC system_header: System Headers. (line 31) +* #sccs: Other Directives. (line 6) +* #unassert: Obsolete Features. (line 59) +* #undef: Undefining and Redefining Macros. + (line 6) +* #warning: Diagnostics. (line 27) + + +File: cpp.info, Node: Option Index, Next: Concept Index, Prev: Index of Directives, Up: Top + +Option Index +************ + +CPP's command line options and environment variables are indexed here +without any initial `-' or `--'. + +[index] +* Menu: + +* A: Invocation. (line 522) +* ansi: Invocation. (line 308) +* C: Invocation. (line 581) +* C_INCLUDE_PATH: Environment Variables. + (line 16) +* CPATH: Environment Variables. + (line 15) +* CPLUS_INCLUDE_PATH: Environment Variables. + (line 17) +* D: Invocation. (line 39) +* dD: Invocation. (line 554) +* DEPENDENCIES_OUTPUT: Environment Variables. + (line 44) +* dI: Invocation. (line 563) +* dM: Invocation. (line 538) +* dN: Invocation. (line 560) +* dU: Invocation. (line 567) +* fdirectives-only: Invocation. (line 430) +* fdollars-in-identifiers: Invocation. (line 452) +* fexec-charset: Invocation. (line 479) +* fextended-identifiers: Invocation. (line 455) +* finput-charset: Invocation. (line 492) +* fno-show-column: Invocation. (line 517) +* fno-working-directory: Invocation. (line 502) +* fpreprocessed: Invocation. (line 460) +* ftabstop: Invocation. (line 473) +* fwide-exec-charset: Invocation. (line 484) +* fworking-directory: Invocation. (line 502) +* H: Invocation. (line 626) +* help: Invocation. (line 618) +* I: Invocation. (line 71) +* I-: Invocation. (line 345) +* idirafter: Invocation. (line 387) +* imacros: Invocation. (line 378) +* imultilib: Invocation. (line 410) +* include: Invocation. (line 367) +* iprefix: Invocation. (line 394) +* iquote: Invocation. (line 422) +* isysroot: Invocation. (line 406) +* isystem: Invocation. (line 414) +* iwithprefix: Invocation. (line 400) +* iwithprefixbefore: Invocation. (line 400) +* M: Invocation. (line 180) +* MD: Invocation. (line 269) +* MF: Invocation. (line 215) +* MG: Invocation. (line 224) +* MM: Invocation. (line 205) +* MMD: Invocation. (line 285) +* MP: Invocation. (line 234) +* MQ: Invocation. (line 260) +* MT: Invocation. (line 246) +* nostdinc: Invocation. (line 357) +* nostdinc++: Invocation. (line 362) +* o: Invocation. (line 82) +* OBJC_INCLUDE_PATH: Environment Variables. + (line 18) +* P: Invocation. (line 574) +* pedantic: Invocation. (line 170) +* pedantic-errors: Invocation. (line 175) +* remap: Invocation. (line 613) +* std=: Invocation. (line 308) +* SUNPRO_DEPENDENCIES: Environment Variables. + (line 60) +* target-help: Invocation. (line 618) +* traditional-cpp: Invocation. (line 606) +* trigraphs: Invocation. (line 610) +* U: Invocation. (line 62) +* undef: Invocation. (line 66) +* v: Invocation. (line 622) +* version: Invocation. (line 635) +* w: Invocation. (line 166) +* Wall: Invocation. (line 88) +* Wcomment: Invocation. (line 96) +* Wcomments: Invocation. (line 96) +* Wendif-labels: Invocation. (line 143) +* Werror: Invocation. (line 156) +* Wsystem-headers: Invocation. (line 160) +* Wtraditional: Invocation. (line 113) +* Wtrigraphs: Invocation. (line 101) +* Wundef: Invocation. (line 119) +* Wunused-macros: Invocation. (line 124) +* x: Invocation. (line 292) + + +File: cpp.info, Node: Concept Index, Prev: Option Index, Up: Top + +Concept Index +************* + +[index] +* Menu: + +* # operator: Stringification. (line 6) +* ## operator: Concatenation. (line 6) +* _Pragma: Pragmas. (line 25) +* alternative tokens: Tokenization. (line 106) +* arguments: Macro Arguments. (line 6) +* arguments in macro definitions: Macro Arguments. (line 6) +* assertions: Obsolete Features. (line 13) +* assertions, canceling: Obsolete Features. (line 59) +* backslash-newline: Initial processing. (line 61) +* block comments: Initial processing. (line 77) +* C++ named operators: C++ Named Operators. (line 6) +* character constants: Tokenization. (line 85) +* character set, execution: Invocation. (line 479) +* character set, input: Invocation. (line 492) +* character set, wide execution: Invocation. (line 484) +* command line: Invocation. (line 6) +* commenting out code: Deleted Code. (line 6) +* comments: Initial processing. (line 77) +* common predefined macros: Common Predefined Macros. + (line 6) +* computed includes: Computed Includes. (line 6) +* concatenation: Concatenation. (line 6) +* conditional group: Ifdef. (line 14) +* conditionals: Conditionals. (line 6) +* continued lines: Initial processing. (line 61) +* controlling macro: Once-Only Headers. (line 35) +* defined: Defined. (line 6) +* dependencies for make as output: Environment Variables. + (line 45) +* dependencies, make: Invocation. (line 180) +* diagnostic: Diagnostics. (line 6) +* differences from previous versions: Differences from previous versions. + (line 6) +* digraphs: Tokenization. (line 106) +* directive line: The preprocessing language. + (line 6) +* directive name: The preprocessing language. + (line 6) +* directives: The preprocessing language. + (line 6) +* empty macro arguments: Macro Arguments. (line 66) +* environment variables: Environment Variables. + (line 6) +* expansion of arguments: Argument Prescan. (line 6) +* FDL, GNU Free Documentation License: GNU Free Documentation License. + (line 6) +* function-like macros: Function-like Macros. + (line 6) +* grouping options: Invocation. (line 34) +* guard macro: Once-Only Headers. (line 35) +* header file: Header Files. (line 6) +* header file names: Tokenization. (line 85) +* identifiers: Tokenization. (line 34) +* implementation limits: Implementation limits. + (line 6) +* implementation-defined behavior: Implementation-defined behavior. + (line 6) +* including just once: Once-Only Headers. (line 6) +* invocation: Invocation. (line 6) +* iso646.h: C++ Named Operators. (line 6) +* line comments: Initial processing. (line 77) +* line control: Line Control. (line 6) +* line endings: Initial processing. (line 14) +* linemarkers: Preprocessor Output. (line 28) +* macro argument expansion: Argument Prescan. (line 6) +* macro arguments and directives: Directives Within Macro Arguments. + (line 6) +* macros in include: Computed Includes. (line 6) +* macros with arguments: Macro Arguments. (line 6) +* macros with variable arguments: Variadic Macros. (line 6) +* make: Invocation. (line 180) +* manifest constants: Object-like Macros. (line 6) +* named operators: C++ Named Operators. (line 6) +* newlines in macro arguments: Newlines in Arguments. + (line 6) +* null directive: Other Directives. (line 17) +* numbers: Tokenization. (line 61) +* object-like macro: Object-like Macros. (line 6) +* options: Invocation. (line 38) +* options, grouping: Invocation. (line 34) +* other tokens: Tokenization. (line 120) +* output format: Preprocessor Output. (line 12) +* overriding a header file: Wrapper Headers. (line 6) +* parentheses in macro bodies: Operator Precedence Problems. + (line 6) +* pitfalls of macros: Macro Pitfalls. (line 6) +* predefined macros: Predefined Macros. (line 6) +* predefined macros, system-specific: System-specific Predefined Macros. + (line 6) +* predicates: Obsolete Features. (line 26) +* preprocessing directives: The preprocessing language. + (line 6) +* preprocessing numbers: Tokenization. (line 61) +* preprocessing tokens: Tokenization. (line 6) +* prescan of macro arguments: Argument Prescan. (line 6) +* problems with macros: Macro Pitfalls. (line 6) +* punctuators: Tokenization. (line 106) +* redefining macros: Undefining and Redefining Macros. + (line 6) +* repeated inclusion: Once-Only Headers. (line 6) +* reporting errors: Diagnostics. (line 6) +* reporting warnings: Diagnostics. (line 6) +* reserved namespace: System-specific Predefined Macros. + (line 6) +* self-reference: Self-Referential Macros. + (line 6) +* semicolons (after macro calls): Swallowing the Semicolon. + (line 6) +* side effects (in macro arguments): Duplication of Side Effects. + (line 6) +* standard predefined macros.: Standard Predefined Macros. + (line 6) +* string constants: Tokenization. (line 85) +* string literals: Tokenization. (line 85) +* stringification: Stringification. (line 6) +* symbolic constants: Object-like Macros. (line 6) +* system header files <1>: System Headers. (line 6) +* system header files: Header Files. (line 13) +* system-specific predefined macros: System-specific Predefined Macros. + (line 6) +* testing predicates: Obsolete Features. (line 37) +* token concatenation: Concatenation. (line 6) +* token pasting: Concatenation. (line 6) +* tokens: Tokenization. (line 6) +* trigraphs: Initial processing. (line 32) +* undefining macros: Undefining and Redefining Macros. + (line 6) +* unsafe macros: Duplication of Side Effects. + (line 6) +* variable number of arguments: Variadic Macros. (line 6) +* variadic macros: Variadic Macros. (line 6) +* wrapper #ifndef: Once-Only Headers. (line 6) +* wrapper headers: Wrapper Headers. (line 6) + + + +Tag Table: +Node: Top1141 +Node: Overview3855 +Node: Character sets6676 +Ref: Character sets-Footnote-18859 +Node: Initial processing9040 +Ref: trigraphs10599 +Node: Tokenization14801 +Ref: Tokenization-Footnote-121937 +Node: The preprocessing language22048 +Node: Header Files24926 +Node: Include Syntax26842 +Node: Include Operation28479 +Node: Search Path30327 +Node: Once-Only Headers33517 +Node: Alternatives to Wrapper #ifndef35176 +Node: Computed Includes36919 +Node: Wrapper Headers40077 +Node: System Headers42503 +Node: Macros44553 +Node: Object-like Macros45694 +Node: Function-like Macros49284 +Node: Macro Arguments50900 +Node: Stringification55045 +Node: Concatenation58251 +Node: Variadic Macros61359 +Node: Predefined Macros66146 +Node: Standard Predefined Macros66734 +Node: Common Predefined Macros72670 +Node: System-specific Predefined Macros85580 +Node: C++ Named Operators87601 +Node: Undefining and Redefining Macros88565 +Node: Directives Within Macro Arguments90669 +Node: Macro Pitfalls92217 +Node: Misnesting92750 +Node: Operator Precedence Problems93862 +Node: Swallowing the Semicolon95728 +Node: Duplication of Side Effects97751 +Node: Self-Referential Macros99934 +Node: Argument Prescan102343 +Node: Newlines in Arguments106097 +Node: Conditionals107048 +Node: Conditional Uses108878 +Node: Conditional Syntax110236 +Node: Ifdef110556 +Node: If113717 +Node: Defined116021 +Node: Else117304 +Node: Elif117874 +Node: Deleted Code119163 +Node: Diagnostics120410 +Node: Line Control122027 +Node: Pragmas125831 +Node: Other Directives130101 +Node: Preprocessor Output131208 +Node: Traditional Mode134409 +Node: Traditional lexical analysis135467 +Node: Traditional macros137970 +Node: Traditional miscellany141772 +Node: Traditional warnings142769 +Node: Implementation Details144966 +Node: Implementation-defined behavior145587 +Ref: Identifier characters146339 +Node: Implementation limits149414 +Node: Obsolete Features152088 +Node: Differences from previous versions154925 +Node: Invocation159133 +Ref: Wtrigraphs163585 +Ref: dashMF168360 +Ref: fdollars-in-identifiers177743 +Node: Environment Variables185906 +Node: GNU Free Documentation License188872 +Node: Index of Directives211305 +Node: Option Index213239 +Node: Concept Index219423 + +End Tag Table diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/info/cppinternals.info b/uclibc-crosstools-gcc-4.4.2-1/usr/info/cppinternals.info new file mode 100644 index 0000000..05b9424 --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/info/cppinternals.info @@ -0,0 +1,1036 @@ +This is doc/cppinternals.info, produced by makeinfo version 4.9 from +/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/gcc-4.4.2/gcc/doc/cppinternals.texi. + +INFO-DIR-SECTION Software development +START-INFO-DIR-ENTRY +* Cpplib: (cppinternals). Cpplib internals. +END-INFO-DIR-ENTRY + + This file documents the internals of the GNU C Preprocessor. + + Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007 Free Software +Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided also +that the entire resulting derived work is distributed under the terms +of a permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions. + + +File: cppinternals.info, Node: Top, Next: Conventions, Up: (dir) + +The GNU C Preprocessor Internals +******************************** + +1 Cpplib--the GNU C Preprocessor +******************************** + +The GNU C preprocessor is implemented as a library, "cpplib", so it can +be easily shared between a stand-alone preprocessor, and a preprocessor +integrated with the C, C++ and Objective-C front ends. It is also +available for use by other programs, though this is not recommended as +its exposed interface has not yet reached a point of reasonable +stability. + + The library has been written to be re-entrant, so that it can be used +to preprocess many files simultaneously if necessary. It has also been +written with the preprocessing token as the fundamental unit; the +preprocessor in previous versions of GCC would operate on text strings +as the fundamental unit. + + This brief manual documents the internals of cpplib, and explains +some of the tricky issues. It is intended that, along with the +comments in the source code, a reasonably competent C programmer should +be able to figure out what the code is doing, and why things have been +implemented the way they have. + +* Menu: + +* Conventions:: Conventions used in the code. +* Lexer:: The combined C, C++ and Objective-C Lexer. +* Hash Nodes:: All identifiers are entered into a hash table. +* Macro Expansion:: Macro expansion algorithm. +* Token Spacing:: Spacing and paste avoidance issues. +* Line Numbering:: Tracking location within files. +* Guard Macros:: Optimizing header files with guard macros. +* Files:: File handling. +* Concept Index:: Index. + + +File: cppinternals.info, Node: Conventions, Next: Lexer, Prev: Top, Up: Top + +Conventions +*********** + +cpplib has two interfaces--one is exposed internally only, and the +other is for both internal and external use. + + The convention is that functions and types that are exposed to +multiple files internally are prefixed with `_cpp_', and are to be +found in the file `internal.h'. Functions and types exposed to external +clients are in `cpplib.h', and prefixed with `cpp_'. For historical +reasons this is no longer quite true, but we should strive to stick to +it. + + We are striving to reduce the information exposed in `cpplib.h' to +the bare minimum necessary, and then to keep it there. This makes clear +exactly what external clients are entitled to assume, and allows us to +change internals in the future without worrying whether library clients +are perhaps relying on some kind of undocumented implementation-specific +behavior. + + +File: cppinternals.info, Node: Lexer, Next: Hash Nodes, Prev: Conventions, Up: Top + +The Lexer +********* + +Overview +======== + +The lexer is contained in the file `lex.c'. It is a hand-coded lexer, +and not implemented as a state machine. It can understand C, C++ and +Objective-C source code, and has been extended to allow reasonably +successful preprocessing of assembly language. The lexer does not make +an initial pass to strip out trigraphs and escaped newlines, but handles +them as they are encountered in a single pass of the input file. It +returns preprocessing tokens individually, not a line at a time. + + It is mostly transparent to users of the library, since the library's +interface for obtaining the next token, `cpp_get_token', takes care of +lexing new tokens, handling directives, and expanding macros as +necessary. However, the lexer does expose some functionality so that +clients of the library can easily spell a given token, such as +`cpp_spell_token' and `cpp_token_len'. These functions are useful when +generating diagnostics, and for emitting the preprocessed output. + +Lexing a token +============== + +Lexing of an individual token is handled by `_cpp_lex_direct' and its +subroutines. In its current form the code is quite complicated, with +read ahead characters and such-like, since it strives to not step back +in the character stream in preparation for handling non-ASCII file +encodings. The current plan is to convert any such files to UTF-8 +before processing them. This complexity is therefore unnecessary and +will be removed, so I'll not discuss it further here. + + The job of `_cpp_lex_direct' is simply to lex a token. It is not +responsible for issues like directive handling, returning lookahead +tokens directly, multiple-include optimization, or conditional block +skipping. It necessarily has a minor ro^le to play in memory +management of lexed lines. I discuss these issues in a separate section +(*note Lexing a line::). + + The lexer places the token it lexes into storage pointed to by the +variable `cur_token', and then increments it. This variable is +important for correct diagnostic positioning. Unless a specific line +and column are passed to the diagnostic routines, they will examine the +`line' and `col' values of the token just before the location that +`cur_token' points to, and use that location to report the diagnostic. + + The lexer does not consider whitespace to be a token in its own +right. If whitespace (other than a new line) precedes a token, it sets +the `PREV_WHITE' bit in the token's flags. Each token has its `line' +and `col' variables set to the line and column of the first character +of the token. This line number is the line number in the translation +unit, and can be converted to a source (file, line) pair using the line +map code. + + The first token on a logical, i.e. unescaped, line has the flag +`BOL' set for beginning-of-line. This flag is intended for internal +use, both to distinguish a `#' that begins a directive from one that +doesn't, and to generate a call-back to clients that want to be +notified about the start of every non-directive line with tokens on it. +Clients cannot reliably determine this for themselves: the first token +might be a macro, and the tokens of a macro expansion do not have the +`BOL' flag set. The macro expansion may even be empty, and the next +token on the line certainly won't have the `BOL' flag set. + + New lines are treated specially; exactly how the lexer handles them +is context-dependent. The C standard mandates that directives are +terminated by the first unescaped newline character, even if it appears +in the middle of a macro expansion. Therefore, if the state variable +`in_directive' is set, the lexer returns a `CPP_EOF' token, which is +normally used to indicate end-of-file, to indicate end-of-directive. +In a directive a `CPP_EOF' token never means end-of-file. +Conveniently, if the caller was `collect_args', it already handles +`CPP_EOF' as if it were end-of-file, and reports an error about an +unterminated macro argument list. + + The C standard also specifies that a new line in the middle of the +arguments to a macro is treated as whitespace. This white space is +important in case the macro argument is stringified. The state variable +`parsing_args' is nonzero when the preprocessor is collecting the +arguments to a macro call. It is set to 1 when looking for the opening +parenthesis to a function-like macro, and 2 when collecting the actual +arguments up to the closing parenthesis, since these two cases need to +be distinguished sometimes. One such time is here: the lexer sets the +`PREV_WHITE' flag of a token if it meets a new line when `parsing_args' +is set to 2. It doesn't set it if it meets a new line when +`parsing_args' is 1, since then code like + + #define foo() bar + foo + baz + +would be output with an erroneous space before `baz': + + foo + baz + + This is a good example of the subtlety of getting token spacing +correct in the preprocessor; there are plenty of tests in the testsuite +for corner cases like this. + + The lexer is written to treat each of `\r', `\n', `\r\n' and `\n\r' +as a single new line indicator. This allows it to transparently +preprocess MS-DOS, Macintosh and Unix files without their needing to +pass through a special filter beforehand. + + We also decided to treat a backslash, either `\' or the trigraph +`??/', separated from one of the above newline indicators by +non-comment whitespace only, as intending to escape the newline. It +tends to be a typing mistake, and cannot reasonably be mistaken for +anything else in any of the C-family grammars. Since handling it this +way is not strictly conforming to the ISO standard, the library issues a +warning wherever it encounters it. + + Handling newlines like this is made simpler by doing it in one place +only. The function `handle_newline' takes care of all newline +characters, and `skip_escaped_newlines' takes care of arbitrarily long +sequences of escaped newlines, deferring to `handle_newline' to handle +the newlines themselves. + + The most painful aspect of lexing ISO-standard C and C++ is handling +trigraphs and backlash-escaped newlines. Trigraphs are processed before +any interpretation of the meaning of a character is made, and +unfortunately there is a trigraph representation for a backslash, so it +is possible for the trigraph `??/' to introduce an escaped newline. + + Escaped newlines are tedious because theoretically they can occur +anywhere--between the `+' and `=' of the `+=' token, within the +characters of an identifier, and even between the `*' and `/' that +terminates a comment. Moreover, you cannot be sure there is just +one--there might be an arbitrarily long sequence of them. + + So, for example, the routine that lexes a number, `parse_number', +cannot assume that it can scan forwards until the first non-number +character and be done with it, because this could be the `\' +introducing an escaped newline, or the `?' introducing the trigraph +sequence that represents the `\' of an escaped newline. If it +encounters a `?' or `\', it calls `skip_escaped_newlines' to skip over +any potential escaped newlines before checking whether the number has +been finished. + + Similarly code in the main body of `_cpp_lex_direct' cannot simply +check for a `=' after a `+' character to determine whether it has a +`+=' token; it needs to be prepared for an escaped newline of some +sort. Such cases use the function `get_effective_char', which returns +the first character after any intervening escaped newlines. + + The lexer needs to keep track of the correct column position, +including counting tabs as specified by the `-ftabstop=' option. This +should be done even within C-style comments; they can appear in the +middle of a line, and we want to report diagnostics in the correct +position for text appearing after the end of the comment. + + Some identifiers, such as `__VA_ARGS__' and poisoned identifiers, +may be invalid and require a diagnostic. However, if they appear in a +macro expansion we don't want to complain with each use of the macro. +It is therefore best to catch them during the lexing stage, in +`parse_identifier'. In both cases, whether a diagnostic is needed or +not is dependent upon the lexer's state. For example, we don't want to +issue a diagnostic for re-poisoning a poisoned identifier, or for using +`__VA_ARGS__' in the expansion of a variable-argument macro. Therefore +`parse_identifier' makes use of state flags to determine whether a +diagnostic is appropriate. Since we change state on a per-token basis, +and don't lex whole lines at a time, this is not a problem. + + Another place where state flags are used to change behavior is whilst +lexing header names. Normally, a `<' would be lexed as a single token. +After a `#include' directive, though, it should be lexed as a single +token as far as the nearest `>' character. Note that we don't allow +the terminators of header names to be escaped; the first `"' or `>' +terminates the header name. + + Interpretation of some character sequences depends upon whether we +are lexing C, C++ or Objective-C, and on the revision of the standard in +force. For example, `::' is a single token in C++, but in C it is two +separate `:' tokens and almost certainly a syntax error. Such cases +are handled by `_cpp_lex_direct' based upon command-line flags stored +in the `cpp_options' structure. + + Once a token has been lexed, it leads an independent existence. The +spelling of numbers, identifiers and strings is copied to permanent +storage from the original input buffer, so a token remains valid and +correct even if its source buffer is freed with `_cpp_pop_buffer'. The +storage holding the spellings of such tokens remains until the client +program calls cpp_destroy, probably at the end of the translation unit. + +Lexing a line +============= + +When the preprocessor was changed to return pointers to tokens, one +feature I wanted was some sort of guarantee regarding how long a +returned pointer remains valid. This is important to the stand-alone +preprocessor, the future direction of the C family front ends, and even +to cpplib itself internally. + + Occasionally the preprocessor wants to be able to peek ahead in the +token stream. For example, after the name of a function-like macro, it +wants to check the next token to see if it is an opening parenthesis. +Another example is that, after reading the first few tokens of a +`#pragma' directive and not recognizing it as a registered pragma, it +wants to backtrack and allow the user-defined handler for unknown +pragmas to access the full `#pragma' token stream. The stand-alone +preprocessor wants to be able to test the current token with the +previous one to see if a space needs to be inserted to preserve their +separate tokenization upon re-lexing (paste avoidance), so it needs to +be sure the pointer to the previous token is still valid. The +recursive-descent C++ parser wants to be able to perform tentative +parsing arbitrarily far ahead in the token stream, and then to be able +to jump back to a prior position in that stream if necessary. + + The rule I chose, which is fairly natural, is to arrange that the +preprocessor lex all tokens on a line consecutively into a token buffer, +which I call a "token run", and when meeting an unescaped new line +(newlines within comments do not count either), to start lexing back at +the beginning of the run. Note that we do _not_ lex a line of tokens +at once; if we did that `parse_identifier' would not have state flags +available to warn about invalid identifiers (*note Invalid +identifiers::). + + In other words, accessing tokens that appeared earlier in the current +line is valid, but since each logical line overwrites the tokens of the +previous line, tokens from prior lines are unavailable. In particular, +since a directive only occupies a single logical line, this means that +the directive handlers like the `#pragma' handler can jump around in +the directive's tokens if necessary. + + Two issues remain: what about tokens that arise from macro +expansions, and what happens when we have a long line that overflows +the token run? + + Since we promise clients that we preserve the validity of pointers +that we have already returned for tokens that appeared earlier in the +line, we cannot reallocate the run. Instead, on overflow it is +expanded by chaining a new token run on to the end of the existing one. + + The tokens forming a macro's replacement list are collected by the +`#define' handler, and placed in storage that is only freed by +`cpp_destroy'. So if a macro is expanded in the line of tokens, the +pointers to the tokens of its expansion that are returned will always +remain valid. However, macros are a little trickier than that, since +they give rise to three sources of fresh tokens. They are the built-in +macros like `__LINE__', and the `#' and `##' operators for +stringification and token pasting. I handled this by allocating space +for these tokens from the lexer's token run chain. This means they +automatically receive the same lifetime guarantees as lexed tokens, and +we don't need to concern ourselves with freeing them. + + Lexing into a line of tokens solves some of the token memory +management issues, but not all. The opening parenthesis after a +function-like macro name might lie on a different line, and the front +ends definitely want the ability to look ahead past the end of the +current line. So cpplib only moves back to the start of the token run +at the end of a line if the variable `keep_tokens' is zero. +Line-buffering is quite natural for the preprocessor, and as a result +the only time cpplib needs to increment this variable is whilst looking +for the opening parenthesis to, and reading the arguments of, a +function-like macro. In the near future cpplib will export an +interface to increment and decrement this variable, so that clients can +share full control over the lifetime of token pointers too. + + The routine `_cpp_lex_token' handles moving to new token runs, +calling `_cpp_lex_direct' to lex new tokens, or returning +previously-lexed tokens if we stepped back in the token stream. It also +checks each token for the `BOL' flag, which might indicate a directive +that needs to be handled, or require a start-of-line call-back to be +made. `_cpp_lex_token' also handles skipping over tokens in failed +conditional blocks, and invalidates the control macro of the +multiple-include optimization if a token was successfully lexed outside +a directive. In other words, its callers do not need to concern +themselves with such issues. + + +File: cppinternals.info, Node: Hash Nodes, Next: Macro Expansion, Prev: Lexer, Up: Top + +Hash Nodes +********** + +When cpplib encounters an "identifier", it generates a hash code for it +and stores it in the hash table. By "identifier" we mean tokens with +type `CPP_NAME'; this includes identifiers in the usual C sense, as +well as keywords, directive names, macro names and so on. For example, +all of `pragma', `int', `foo' and `__GNUC__' are identifiers and hashed +when lexed. + + Each node in the hash table contain various information about the +identifier it represents. For example, its length and type. At any one +time, each identifier falls into exactly one of three categories: + + * Macros + + These have been declared to be macros, either on the command line + or with `#define'. A few, such as `__TIME__' are built-ins + entered in the hash table during initialization. The hash node + for a normal macro points to a structure with more information + about the macro, such as whether it is function-like, how many + arguments it takes, and its expansion. Built-in macros are + flagged as special, and instead contain an enum indicating which + of the various built-in macros it is. + + * Assertions + + Assertions are in a separate namespace to macros. To enforce + this, cpp actually prepends a `#' character before hashing and + entering it in the hash table. An assertion's node points to a + chain of answers to that assertion. + + * Void + + Everything else falls into this category--an identifier that is not + currently a macro, or a macro that has since been undefined with + `#undef'. + + When preprocessing C++, this category also includes the named + operators, such as `xor'. In expressions these behave like the + operators they represent, but in contexts where the spelling of a + token matters they are spelt differently. This spelling + distinction is relevant when they are operands of the stringizing + and pasting macro operators `#' and `##'. Named operator hash + nodes are flagged, both to catch the spelling distinction and to + prevent them from being defined as macros. + + The same identifiers share the same hash node. Since each identifier +token, after lexing, contains a pointer to its hash node, this is used +to provide rapid lookup of various information. For example, when +parsing a `#define' statement, CPP flags each argument's identifier +hash node with the index of that argument. This makes duplicated +argument checking an O(1) operation for each argument. Similarly, for +each identifier in the macro's expansion, lookup to see if it is an +argument, and which argument it is, is also an O(1) operation. Further, +each directive name, such as `endif', has an associated directive enum +stored in its hash node, so that directive lookup is also O(1). + + +File: cppinternals.info, Node: Macro Expansion, Next: Token Spacing, Prev: Hash Nodes, Up: Top + +Macro Expansion Algorithm +************************* + +Macro expansion is a tricky operation, fraught with nasty corner cases +and situations that render what you thought was a nifty way to optimize +the preprocessor's expansion algorithm wrong in quite subtle ways. + + I strongly recommend you have a good grasp of how the C and C++ +standards require macros to be expanded before diving into this +section, let alone the code!. If you don't have a clear mental picture +of how things like nested macro expansion, stringification and token +pasting are supposed to work, damage to your sanity can quickly result. + +Internal representation of macros +================================= + +The preprocessor stores macro expansions in tokenized form. This saves +repeated lexing passes during expansion, at the cost of a small +increase in memory consumption on average. The tokens are stored +contiguously in memory, so a pointer to the first one and a token count +is all you need to get the replacement list of a macro. + + If the macro is a function-like macro the preprocessor also stores +its parameters, in the form of an ordered list of pointers to the hash +table entry of each parameter's identifier. Further, in the macro's +stored expansion each occurrence of a parameter is replaced with a +special token of type `CPP_MACRO_ARG'. Each such token holds the index +of the parameter it represents in the parameter list, which allows +rapid replacement of parameters with their arguments during expansion. +Despite this optimization it is still necessary to store the original +parameters to the macro, both for dumping with e.g., `-dD', and to warn +about non-trivial macro redefinitions when the parameter names have +changed. + +Macro expansion overview +======================== + +The preprocessor maintains a "context stack", implemented as a linked +list of `cpp_context' structures, which together represent the macro +expansion state at any one time. The `struct cpp_reader' member +variable `context' points to the current top of this stack. The top +normally holds the unexpanded replacement list of the innermost macro +under expansion, except when cpplib is about to pre-expand an argument, +in which case it holds that argument's unexpanded tokens. + + When there are no macros under expansion, cpplib is in "base +context". All contexts other than the base context contain a +contiguous list of tokens delimited by a starting and ending token. +When not in base context, cpplib obtains the next token from the list +of the top context. If there are no tokens left in the list, it pops +that context off the stack, and subsequent ones if necessary, until an +unexhausted context is found or it returns to base context. In base +context, cpplib reads tokens directly from the lexer. + + If it encounters an identifier that is both a macro and enabled for +expansion, cpplib prepares to push a new context for that macro on the +stack by calling the routine `enter_macro_context'. When this routine +returns, the new context will contain the unexpanded tokens of the +replacement list of that macro. In the case of function-like macros, +`enter_macro_context' also replaces any parameters in the replacement +list, stored as `CPP_MACRO_ARG' tokens, with the appropriate macro +argument. If the standard requires that the parameter be replaced with +its expanded argument, the argument will have been fully macro expanded +first. + + `enter_macro_context' also handles special macros like `__LINE__'. +Although these macros expand to a single token which cannot contain any +further macros, for reasons of token spacing (*note Token Spacing::) +and simplicity of implementation, cpplib handles these special macros +by pushing a context containing just that one token. + + The final thing that `enter_macro_context' does before returning is +to mark the macro disabled for expansion (except for special macros +like `__TIME__'). The macro is re-enabled when its context is later +popped from the context stack, as described above. This strict +ordering ensures that a macro is disabled whilst its expansion is being +scanned, but that it is _not_ disabled whilst any arguments to it are +being expanded. + +Scanning the replacement list for macros to expand +================================================== + +The C standard states that, after any parameters have been replaced +with their possibly-expanded arguments, the replacement list is scanned +for nested macros. Further, any identifiers in the replacement list +that are not expanded during this scan are never again eligible for +expansion in the future, if the reason they were not expanded is that +the macro in question was disabled. + + Clearly this latter condition can only apply to tokens resulting from +argument pre-expansion. Other tokens never have an opportunity to be +re-tested for expansion. It is possible for identifiers that are +function-like macros to not expand initially but to expand during a +later scan. This occurs when the identifier is the last token of an +argument (and therefore originally followed by a comma or a closing +parenthesis in its macro's argument list), and when it replaces its +parameter in the macro's replacement list, the subsequent token happens +to be an opening parenthesis (itself possibly the first token of an +argument). + + It is important to note that when cpplib reads the last token of a +given context, that context still remains on the stack. Only when +looking for the _next_ token do we pop it off the stack and drop to a +lower context. This makes backing up by one token easy, but more +importantly ensures that the macro corresponding to the current context +is still disabled when we are considering the last token of its +replacement list for expansion (or indeed expanding it). As an +example, which illustrates many of the points above, consider + + #define foo(x) bar x + foo(foo) (2) + +which fully expands to `bar foo (2)'. During pre-expansion of the +argument, `foo' does not expand even though the macro is enabled, since +it has no following parenthesis [pre-expansion of an argument only uses +tokens from that argument; it cannot take tokens from whatever follows +the macro invocation]. This still leaves the argument token `foo' +eligible for future expansion. Then, when re-scanning after argument +replacement, the token `foo' is rejected for expansion, and marked +ineligible for future expansion, since the macro is now disabled. It +is disabled because the replacement list `bar foo' of the macro is +still on the context stack. + + If instead the algorithm looked for an opening parenthesis first and +then tested whether the macro were disabled it would be subtly wrong. +In the example above, the replacement list of `foo' would be popped in +the process of finding the parenthesis, re-enabling `foo' and expanding +it a second time. + +Looking for a function-like macro's opening parenthesis +======================================================= + +Function-like macros only expand when immediately followed by a +parenthesis. To do this cpplib needs to temporarily disable macros and +read the next token. Unfortunately, because of spacing issues (*note +Token Spacing::), there can be fake padding tokens in-between, and if +the next real token is not a parenthesis cpplib needs to be able to +back up that one token as well as retain the information in any +intervening padding tokens. + + Backing up more than one token when macros are involved is not +permitted by cpplib, because in general it might involve issues like +restoring popped contexts onto the context stack, which are too hard. +Instead, searching for the parenthesis is handled by a special +function, `funlike_invocation_p', which remembers padding information +as it reads tokens. If the next real token is not an opening +parenthesis, it backs up that one token, and then pushes an extra +context just containing the padding information if necessary. + +Marking tokens ineligible for future expansion +============================================== + +As discussed above, cpplib needs a way of marking tokens as +unexpandable. Since the tokens cpplib handles are read-only once they +have been lexed, it instead makes a copy of the token and adds the flag +`NO_EXPAND' to the copy. + + For efficiency and to simplify memory management by avoiding having +to remember to free these tokens, they are allocated as temporary tokens +from the lexer's current token run (*note Lexing a line::) using the +function `_cpp_temp_token'. The tokens are then re-used once the +current line of tokens has been read in. + + This might sound unsafe. However, tokens runs are not re-used at the +end of a line if it happens to be in the middle of a macro argument +list, and cpplib only wants to back-up more than one lexer token in +situations where no macro expansion is involved, so the optimization is +safe. + + +File: cppinternals.info, Node: Token Spacing, Next: Line Numbering, Prev: Macro Expansion, Up: Top + +Token Spacing +************* + +First, consider an issue that only concerns the stand-alone +preprocessor: there needs to be a guarantee that re-reading its +preprocessed output results in an identical token stream. Without +taking special measures, this might not be the case because of macro +substitution. For example: + + #define PLUS + + #define EMPTY + #define f(x) =x= + +PLUS -EMPTY- PLUS+ f(=) + ==> + + - - + + = = = + _not_ + ==> ++ -- ++ === + + One solution would be to simply insert a space between all adjacent +tokens. However, we would like to keep space insertion to a minimum, +both for aesthetic reasons and because it causes problems for people who +still try to abuse the preprocessor for things like Fortran source and +Makefiles. + + For now, just notice that when tokens are added (or removed, as +shown by the `EMPTY' example) from the original lexed token stream, we +need to check for accidental token pasting. We call this "paste +avoidance". Token addition and removal can only occur because of macro +expansion, but accidental pasting can occur in many places: both before +and after each macro replacement, each argument replacement, and +additionally each token created by the `#' and `##' operators. + + Look at how the preprocessor gets whitespace output correct +normally. The `cpp_token' structure contains a flags byte, and one of +those flags is `PREV_WHITE'. This is flagged by the lexer, and +indicates that the token was preceded by whitespace of some form other +than a new line. The stand-alone preprocessor can use this flag to +decide whether to insert a space between tokens in the output. + + Now consider the result of the following macro expansion: + + #define add(x, y, z) x + y +z; + sum = add (1,2, 3); + ==> sum = 1 + 2 +3; + + The interesting thing here is that the tokens `1' and `2' are output +with a preceding space, and `3' is output without a preceding space, +but when lexed none of these tokens had that property. Careful +consideration reveals that `1' gets its preceding whitespace from the +space preceding `add' in the macro invocation, _not_ replacement list. +`2' gets its whitespace from the space preceding the parameter `y' in +the macro replacement list, and `3' has no preceding space because +parameter `z' has none in the replacement list. + + Once lexed, tokens are effectively fixed and cannot be altered, since +pointers to them might be held in many places, in particular by +in-progress macro expansions. So instead of modifying the two tokens +above, the preprocessor inserts a special token, which I call a +"padding token", into the token stream to indicate that spacing of the +subsequent token is special. The preprocessor inserts padding tokens +in front of every macro expansion and expanded macro argument. These +point to a "source token" from which the subsequent real token should +inherit its spacing. In the above example, the source tokens are `add' +in the macro invocation, and `y' and `z' in the macro replacement list, +respectively. + + It is quite easy to get multiple padding tokens in a row, for +example if a macro's first replacement token expands straight into +another macro. + + #define foo bar + #define bar baz + [foo] + ==> [baz] + + Here, two padding tokens are generated with sources the `foo' token +between the brackets, and the `bar' token from foo's replacement list, +respectively. Clearly the first padding token is the one to use, so +the output code should contain a rule that the first padding token in a +sequence is the one that matters. + + But what if a macro expansion is left? Adjusting the above example +slightly: + + #define foo bar + #define bar EMPTY baz + #define EMPTY + [foo] EMPTY; + ==> [ baz] ; + + As shown, now there should be a space before `baz' and the semicolon +in the output. + + The rules we decided above fail for `baz': we generate three padding +tokens, one per macro invocation, before the token `baz'. We would +then have it take its spacing from the first of these, which carries +source token `foo' with no leading space. + + It is vital that cpplib get spacing correct in these examples since +any of these macro expansions could be stringified, where spacing +matters. + + So, this demonstrates that not just entering macro and argument +expansions, but leaving them requires special handling too. I made +cpplib insert a padding token with a `NULL' source token when leaving +macro expansions, as well as after each replaced argument in a macro's +replacement list. It also inserts appropriate padding tokens on either +side of tokens created by the `#' and `##' operators. I expanded the +rule so that, if we see a padding token with a `NULL' source token, +_and_ that source token has no leading space, then we behave as if we +have seen no padding tokens at all. A quick check shows this rule will +then get the above example correct as well. + + Now a relationship with paste avoidance is apparent: we have to be +careful about paste avoidance in exactly the same locations we have +padding tokens in order to get white space correct. This makes +implementation of paste avoidance easy: wherever the stand-alone +preprocessor is fixing up spacing because of padding tokens, and it +turns out that no space is needed, it has to take the extra step to +check that a space is not needed after all to avoid an accidental paste. +The function `cpp_avoid_paste' advises whether a space is required +between two consecutive tokens. To avoid excessive spacing, it tries +hard to only require a space if one is likely to be necessary, but for +reasons of efficiency it is slightly conservative and might recommend a +space where one is not strictly needed. + + +File: cppinternals.info, Node: Line Numbering, Next: Guard Macros, Prev: Token Spacing, Up: Top + +Line numbering +************** + +Just which line number anyway? +============================== + +There are three reasonable requirements a cpplib client might have for +the line number of a token passed to it: + + * The source line it was lexed on. + + * The line it is output on. This can be different to the line it was + lexed on if, for example, there are intervening escaped newlines or + C-style comments. For example: + + foo /* A long + comment */ bar \ + baz + => + foo bar baz + + * If the token results from a macro expansion, the line of the macro + name, or possibly the line of the closing parenthesis in the case + of function-like macro expansion. + + The `cpp_token' structure contains `line' and `col' members. The +lexer fills these in with the line and column of the first character of +the token. Consequently, but maybe unexpectedly, a token from the +replacement list of a macro expansion carries the location of the token +within the `#define' directive, because cpplib expands a macro by +returning pointers to the tokens in its replacement list. The current +implementation of cpplib assigns tokens created from built-in macros +and the `#' and `##' operators the location of the most recently lexed +token. This is a because they are allocated from the lexer's token +runs, and because of the way the diagnostic routines infer the +appropriate location to report. + + The diagnostic routines in cpplib display the location of the most +recently _lexed_ token, unless they are passed a specific line and +column to report. For diagnostics regarding tokens that arise from +macro expansions, it might also be helpful for the user to see the +original location in the macro definition that the token came from. +Since that is exactly the information each token carries, such an +enhancement could be made relatively easily in future. + + The stand-alone preprocessor faces a similar problem when determining +the correct line to output the token on: the position attached to a +token is fairly useless if the token came from a macro expansion. All +tokens on a logical line should be output on its first physical line, so +the token's reported location is also wrong if it is part of a physical +line other than the first. + + To solve these issues, cpplib provides a callback that is generated +whenever it lexes a preprocessing token that starts a new logical line +other than a directive. It passes this token (which may be a `CPP_EOF' +token indicating the end of the translation unit) to the callback +routine, which can then use the line and column of this token to +produce correct output. + +Representation of line numbers +============================== + +As mentioned above, cpplib stores with each token the line number that +it was lexed on. In fact, this number is not the number of the line in +the source file, but instead bears more resemblance to the number of the +line in the translation unit. + + The preprocessor maintains a monotonic increasing line count, which +is incremented at every new line character (and also at the end of any +buffer that does not end in a new line). Since a line number of zero is +useful to indicate certain special states and conditions, this variable +starts counting from one. + + This variable therefore uniquely enumerates each line in the +translation unit. With some simple infrastructure, it is straight +forward to map from this to the original source file and line number +pair, saving space whenever line number information needs to be saved. +The code the implements this mapping lies in the files `line-map.c' and +`line-map.h'. + + Command-line macros and assertions are implemented by pushing a +buffer containing the right hand side of an equivalent `#define' or +`#assert' directive. Some built-in macros are handled similarly. +Since these are all processed before the first line of the main input +file, it will typically have an assigned line closer to twenty than to +one. + + +File: cppinternals.info, Node: Guard Macros, Next: Files, Prev: Line Numbering, Up: Top + +The Multiple-Include Optimization +********************************* + +Header files are often of the form + + #ifndef FOO + #define FOO + ... + #endif + +to prevent the compiler from processing them more than once. The +preprocessor notices such header files, so that if the header file +appears in a subsequent `#include' directive and `FOO' is defined, then +it is ignored and it doesn't preprocess or even re-open the file a +second time. This is referred to as the "multiple include +optimization". + + Under what circumstances is such an optimization valid? If the file +were included a second time, it can only be optimized away if that +inclusion would result in no tokens to return, and no relevant +directives to process. Therefore the current implementation imposes +requirements and makes some allowances as follows: + + 1. There must be no tokens outside the controlling `#if'-`#endif' + pair, but whitespace and comments are permitted. + + 2. There must be no directives outside the controlling directive + pair, but the "null directive" (a line containing nothing other + than a single `#' and possibly whitespace) is permitted. + + 3. The opening directive must be of the form + + #ifndef FOO + + or + + #if !defined FOO [equivalently, #if !defined(FOO)] + + 4. In the second form above, the tokens forming the `#if' expression + must have come directly from the source file--no macro expansion + must have been involved. This is because macro definitions can + change, and tracking whether or not a relevant change has been + made is not worth the implementation cost. + + 5. There can be no `#else' or `#elif' directives at the outer + conditional block level, because they would probably contain + something of interest to a subsequent pass. + + First, when pushing a new file on the buffer stack, +`_stack_include_file' sets the controlling macro `mi_cmacro' to `NULL', +and sets `mi_valid' to `true'. This indicates that the preprocessor +has not yet encountered anything that would invalidate the +multiple-include optimization. As described in the next few +paragraphs, these two variables having these values effectively +indicates top-of-file. + + When about to return a token that is not part of a directive, +`_cpp_lex_token' sets `mi_valid' to `false'. This enforces the +constraint that tokens outside the controlling conditional block +invalidate the optimization. + + The `do_if', when appropriate, and `do_ifndef' directive handlers +pass the controlling macro to the function `push_conditional'. cpplib +maintains a stack of nested conditional blocks, and after processing +every opening conditional this function pushes an `if_stack' structure +onto the stack. In this structure it records the controlling macro for +the block, provided there is one and we're at top-of-file (as described +above). If an `#elif' or `#else' directive is encountered, the +controlling macro for that block is cleared to `NULL'. Otherwise, it +survives until the `#endif' closing the block, upon which `do_endif' +sets `mi_valid' to true and stores the controlling macro in `mi_cmacro'. + + `_cpp_handle_directive' clears `mi_valid' when processing any +directive other than an opening conditional and the null directive. +With this, and requiring top-of-file to record a controlling macro, and +no `#else' or `#elif' for it to survive and be copied to `mi_cmacro' by +`do_endif', we have enforced the absence of directives outside the main +conditional block for the optimization to be on. + + Note that whilst we are inside the conditional block, `mi_valid' is +likely to be reset to `false', but this does not matter since the +closing `#endif' restores it to `true' if appropriate. + + Finally, since `_cpp_lex_direct' pops the file off the buffer stack +at `EOF' without returning a token, if the `#endif' directive was not +followed by any tokens, `mi_valid' is `true' and `_cpp_pop_file_buffer' +remembers the controlling macro associated with the file. Subsequent +calls to `stack_include_file' result in no buffer being pushed if the +controlling macro is defined, effecting the optimization. + + A quick word on how we handle the + + #if !defined FOO + +case. `_cpp_parse_expr' and `parse_defined' take steps to see whether +the three stages `!', `defined-expression' and `end-of-directive' occur +in order in a `#if' expression. If so, they return the guard macro to +`do_if' in the variable `mi_ind_cmacro', and otherwise set it to `NULL'. +`enter_macro_context' sets `mi_valid' to false, so if a macro was +expanded whilst parsing any part of the expression, then the +top-of-file test in `push_conditional' fails and the optimization is +turned off. + + +File: cppinternals.info, Node: Files, Next: Concept Index, Prev: Guard Macros, Up: Top + +File Handling +************* + +Fairly obviously, the file handling code of cpplib resides in the file +`files.c'. It takes care of the details of file searching, opening, +reading and caching, for both the main source file and all the headers +it recursively includes. + + The basic strategy is to minimize the number of system calls. On +many systems, the basic `open ()' and `fstat ()' system calls can be +quite expensive. For every `#include'-d file, we need to try all the +directories in the search path until we find a match. Some projects, +such as glibc, pass twenty or thirty include paths on the command line, +so this can rapidly become time consuming. + + For a header file we have not encountered before we have little +choice but to do this. However, it is often the case that the same +headers are repeatedly included, and in these cases we try to avoid +repeating the filesystem queries whilst searching for the correct file. + + For each file we try to open, we store the constructed path in a +splay tree. This path first undergoes simplification by the function +`_cpp_simplify_pathname'. For example, `/usr/include/bits/../foo.h' is +simplified to `/usr/include/foo.h' before we enter it in the splay tree +and try to `open ()' the file. CPP will then find subsequent uses of +`foo.h', even as `/usr/include/foo.h', in the splay tree and save +system calls. + + Further, it is likely the file contents have also been cached, +saving a `read ()' system call. We don't bother caching the contents of +header files that are re-inclusion protected, and whose re-inclusion +macro is defined when we leave the header file for the first time. If +the host supports it, we try to map suitably large files into memory, +rather than reading them in directly. + + The include paths are internally stored on a null-terminated +singly-linked list, starting with the `"header.h"' directory search +chain, which then links into the `' directory chain. + + Files included with the `' syntax start the lookup directly +in the second half of this chain. However, files included with the +`"foo.h"' syntax start at the beginning of the chain, but with one +extra directory prepended. This is the directory of the current file; +the one containing the `#include' directive. Prepending this directory +on a per-file basis is handled by the function `search_from'. + + Note that a header included with a directory component, such as +`#include "mydir/foo.h"' and opened as +`/usr/local/include/mydir/foo.h', will have the complete path minus the +basename `foo.h' as the current directory. + + Enough information is stored in the splay tree that CPP can +immediately tell whether it can skip the header file because of the +multiple include optimization, whether the file didn't exist or +couldn't be opened for some reason, or whether the header was flagged +not to be re-used, as it is with the obsolete `#import' directive. + + For the benefit of MS-DOS filesystems with an 8.3 filename +limitation, CPP offers the ability to treat various include file names +as aliases for the real header files with shorter names. The map from +one to the other is found in a special file called `header.gcc', stored +in the command line (or system) include directories to which the mapping +applies. This may be higher up the directory tree than the full path to +the file minus the base name. + + +File: cppinternals.info, Node: Concept Index, Prev: Files, Up: Top + +Concept Index +************* + +[index] +* Menu: + +* assertions: Hash Nodes. (line 6) +* controlling macros: Guard Macros. (line 6) +* escaped newlines: Lexer. (line 6) +* files: Files. (line 6) +* guard macros: Guard Macros. (line 6) +* hash table: Hash Nodes. (line 6) +* header files: Conventions. (line 6) +* identifiers: Hash Nodes. (line 6) +* interface: Conventions. (line 6) +* lexer: Lexer. (line 6) +* line numbers: Line Numbering. (line 6) +* macro expansion: Macro Expansion. (line 6) +* macro representation (internal): Macro Expansion. (line 19) +* macros: Hash Nodes. (line 6) +* multiple-include optimization: Guard Macros. (line 6) +* named operators: Hash Nodes. (line 6) +* newlines: Lexer. (line 6) +* paste avoidance: Token Spacing. (line 6) +* spacing: Token Spacing. (line 6) +* token run: Lexer. (line 192) +* token spacing: Token Spacing. (line 6) + + + +Tag Table: +Node: Top1018 +Node: Conventions2703 +Node: Lexer3645 +Ref: Invalid identifiers11558 +Ref: Lexing a line13507 +Node: Hash Nodes18280 +Node: Macro Expansion21159 +Node: Token Spacing30106 +Node: Line Numbering35966 +Node: Guard Macros40051 +Node: Files44842 +Node: Concept Index48308 + +End Tag Table diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/info/dir b/uclibc-crosstools-gcc-4.4.2-1/usr/info/dir new file mode 100644 index 0000000..dc7aa4b --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/info/dir @@ -0,0 +1,26 @@ +This is the file .../info/dir, which contains the +topmost node of the Info hierarchy, called (dir)Top. +The first time you invoke Info you start off looking at this node. + +File: dir, Node: Top This is the top of the INFO tree + + This (the Directory node) gives a menu of major topics. + Typing "q" exits, "?" lists all Info commands, "d" returns here, + "h" gives a primer for first-timers, + "mEmacs" visits the Emacs manual, etc. + + In Emacs, you can click mouse button 2 on a menu item or cross reference + to select it. + +* Menu: + +Software development +* Cpp: (cpp). The GNU C preprocessor. +* Cpplib: (cppinternals). Cpplib internals. +* g++: (gcc). The GNU C++ compiler. +* gcc: (gcc). The GNU Compiler Collection. +* gccinstall: (gccinstall). Installing the GNU Compiler Collection. +* gccint: (gccint). Internals of the GNU Compiler Collection. + +GNU Libraries +* libgomp: (libgomp). GNU OpenMP runtime library diff --git a/uclibc-crosstools-gcc-4.4.2-1/usr/info/gcc.info b/uclibc-crosstools-gcc-4.4.2-1/usr/info/gcc.info new file mode 100644 index 0000000..6ec34ce --- /dev/null +++ b/uclibc-crosstools-gcc-4.4.2-1/usr/info/gcc.info @@ -0,0 +1,44027 @@ +This is doc/gcc.info, produced by makeinfo version 4.9 from +/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/gcc-4.4.2/gcc/doc/gcc.texi. + + Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, +1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free +Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Funding Free Software", the Front-Cover Texts +being (a) (see below), and with the Back-Cover Texts being (b) (see +below). A copy of the license is included in the section entitled "GNU +Free Documentation License". + + (a) The FSF's Front-Cover Text is: + + A GNU Manual + + (b) The FSF's Back-Cover Text is: + + You have freedom to copy and modify this GNU Manual, like GNU +software. Copies published by the Free Software Foundation raise +funds for GNU development. + +INFO-DIR-SECTION Software development +START-INFO-DIR-ENTRY +* gcc: (gcc). The GNU Compiler Collection. +* g++: (gcc). The GNU C++ compiler. +END-INFO-DIR-ENTRY + This file documents the use of the GNU compilers. + + Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, +1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free +Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Funding Free Software", the Front-Cover Texts +being (a) (see below), and with the Back-Cover Texts being (b) (see +below). A copy of the license is included in the section entitled "GNU +Free Documentation License". + + (a) The FSF's Front-Cover Text is: + + A GNU Manual + + (b) The FSF's Back-Cover Text is: + + You have freedom to copy and modify this GNU Manual, like GNU +software. Copies published by the Free Software Foundation raise +funds for GNU development. + + + +File: gcc.info, Node: Top, Next: G++ and GCC, Up: (DIR) + +Introduction +************ + +This manual documents how to use the GNU compilers, as well as their +features and incompatibilities, and how to report bugs. It corresponds +to the compilers (Buildroot 2010.02-git) version 4.4.2. The internals +of the GNU compilers, including how to port them to new targets and +some information about how to write front ends for new languages, are +documented in a separate manual. *Note Introduction: (gccint)Top. + +* Menu: + +* G++ and GCC:: You can compile C or C++ programs. +* Standards:: Language standards supported by GCC. +* Invoking GCC:: Command options supported by `gcc'. +* C Implementation:: How GCC implements the ISO C specification. +* C Extensions:: GNU extensions to the C language family. +* C++ Extensions:: GNU extensions to the C++ language. +* Objective-C:: GNU Objective-C runtime features. +* Compatibility:: Binary Compatibility +* Gcov:: `gcov'---a test coverage program. +* Trouble:: If you have trouble using GCC. +* Bugs:: How, why and where to report bugs. +* Service:: How to find suppliers of support for GCC. +* Contributing:: How to contribute to testing and developing GCC. + +* Funding:: How to help assure funding for free software. +* GNU Project:: The GNU Project and GNU/Linux. + +* Copying:: GNU General Public License says + how you can copy and share GCC. +* GNU Free Documentation License:: How you can copy and share this manual. +* Contributors:: People who have contributed to GCC. + +* Option Index:: Index to command line options. +* Keyword Index:: Index of concepts and symbol names. + + +File: gcc.info, Node: G++ and GCC, Next: Standards, Prev: Top, Up: Top + +1 Programming Languages Supported by GCC +**************************************** + +GCC stands for "GNU Compiler Collection". GCC is an integrated +distribution of compilers for several major programming languages. +These languages currently include C, C++, Objective-C, Objective-C++, +Java, Fortran, and Ada. + + The abbreviation "GCC" has multiple meanings in common use. The +current official meaning is "GNU Compiler Collection", which refers +generically to the complete suite of tools. The name historically stood +for "GNU C Compiler", and this usage is still common when the emphasis +is on compiling C programs. Finally, the name is also used when +speaking of the "language-independent" component of GCC: code shared +among the compilers for all supported languages. + + The language-independent component of GCC includes the majority of the +optimizers, as well as the "back ends" that generate machine code for +various processors. + + The part of a compiler that is specific to a particular language is +called the "front end". In addition to the front ends that are +integrated components of GCC, there are several other front ends that +are maintained separately. These support languages such as Pascal, +Mercury, and COBOL. To use these, they must be built together with GCC +proper. + + Most of the compilers for languages other than C have their own names. +The C++ compiler is G++, the Ada compiler is GNAT, and so on. When we +talk about compiling one of those languages, we might refer to that +compiler by its own name, or as GCC. Either is correct. + + Historically, compilers for many languages, including C++ and Fortran, +have been implemented as "preprocessors" which emit another high level +language such as C. None of the compilers included in GCC are +implemented this way; they all generate machine code directly. This +sort of preprocessor should not be confused with the "C preprocessor", +which is an integral feature of the C, C++, Objective-C and +Objective-C++ languages. + + +File: gcc.info, Node: Standards, Next: Invoking GCC, Prev: G++ and GCC, Up: Top + +2 Language Standards Supported by GCC +************************************* + +For each language compiled by GCC for which there is a standard, GCC +attempts to follow one or more versions of that standard, possibly with +some exceptions, and possibly with some extensions. + +2.1 C language +============== + +GCC supports three versions of the C standard, although support for the +most recent version is not yet complete. + + The original ANSI C standard (X3.159-1989) was ratified in 1989 and +published in 1990. This standard was ratified as an ISO standard +(ISO/IEC 9899:1990) later in 1990. There were no technical differences +between these publications, although the sections of the ANSI standard +were renumbered and became clauses in the ISO standard. This standard, +in both its forms, is commonly known as "C89", or occasionally as +"C90", from the dates of ratification. The ANSI standard, but not the +ISO standard, also came with a Rationale document. To select this +standard in GCC, use one of the options `-ansi', `-std=c89' or +`-std=iso9899:1990'; to obtain all the diagnostics required by the +standard, you should also specify `-pedantic' (or `-pedantic-errors' if +you want them to be errors rather than warnings). *Note Options +Controlling C Dialect: C Dialect Options. + + Errors in the 1990 ISO C standard were corrected in two Technical +Corrigenda published in 1994 and 1996. GCC does not support the +uncorrected version. + + An amendment to the 1990 standard was published in 1995. This +amendment added digraphs and `__STDC_VERSION__' to the language, but +otherwise concerned the library. This amendment is commonly known as +"AMD1"; the amended standard is sometimes known as "C94" or "C95". To +select this standard in GCC, use the option `-std=iso9899:199409' +(with, as for other standard versions, `-pedantic' to receive all +required diagnostics). + + A new edition of the ISO C standard was published in 1999 as ISO/IEC +9899:1999, and is commonly known as "C99". GCC has incomplete support +for this standard version; see +`http://gcc.gnu.org/gcc-4.4/c99status.html' for details. To select this +standard, use `-std=c99' or `-std=iso9899:1999'. (While in +development, drafts of this standard version were referred to as "C9X".) + + Errors in the 1999 ISO C standard were corrected in three Technical +Corrigenda published in 2001, 2004 and 2007. GCC does not support the +uncorrected version. + + By default, GCC provides some extensions to the C language that on +rare occasions conflict with the C standard. *Note Extensions to the C +Language Family: C Extensions. Use of the `-std' options listed above +will disable these extensions where they conflict with the C standard +version selected. You may also select an extended version of the C +language explicitly with `-std=gnu89' (for C89 with GNU extensions) or +`-std=gnu99' (for C99 with GNU extensions). The default, if no C +language dialect options are given, is `-std=gnu89'; this will change to +`-std=gnu99' in some future release when the C99 support is complete. +Some features that are part of the C99 standard are accepted as +extensions in C89 mode. + + The ISO C standard defines (in clause 4) two classes of conforming +implementation. A "conforming hosted implementation" supports the +whole standard including all the library facilities; a "conforming +freestanding implementation" is only required to provide certain +library facilities: those in `', `', `', +and `'; since AMD1, also those in `'; and in C99, +also those in `' and `'. In addition, complex +types, added in C99, are not required for freestanding implementations. +The standard also defines two environments for programs, a +"freestanding environment", required of all implementations and which +may not have library facilities beyond those required of freestanding +implementations, where the handling of program startup and termination +are implementation-defined, and a "hosted environment", which is not +required, in which all the library facilities are provided and startup +is through a function `int main (void)' or `int main (int, char *[])'. +An OS kernel would be a freestanding environment; a program using the +facilities of an operating system would normally be in a hosted +implementation. + + GCC aims towards being usable as a conforming freestanding +implementation, or as the compiler for a conforming hosted +implementation. By default, it will act as the compiler for a hosted +implementation, defining `__STDC_HOSTED__' as `1' and presuming that +when the names of ISO C functions are used, they have the semantics +defined in the standard. To make it act as a conforming freestanding +implementation for a freestanding environment, use the option +`-ffreestanding'; it will then define `__STDC_HOSTED__' to `0' and not +make assumptions about the meanings of function names from the standard +library, with exceptions noted below. To build an OS kernel, you may +well still need to make your own arrangements for linking and startup. +*Note Options Controlling C Dialect: C Dialect Options. + + GCC does not provide the library facilities required only of hosted +implementations, nor yet all the facilities required by C99 of +freestanding implementations; to use the facilities of a hosted +environment, you will need to find them elsewhere (for example, in the +GNU C library). *Note Standard Libraries: Standard Libraries. + + Most of the compiler support routines used by GCC are present in +`libgcc', but there are a few exceptions. GCC requires the +freestanding environment provide `memcpy', `memmove', `memset' and +`memcmp'. Finally, if `__builtin_trap' is used, and the target does +not implement the `trap' pattern, then GCC will emit a call to `abort'. + + For references to Technical Corrigenda, Rationale documents and +information concerning the history of C that is available online, see +`http://gcc.gnu.org/readings.html' + +2.2 C++ language +================ + +GCC supports the ISO C++ standard (1998) and contains experimental +support for the upcoming ISO C++ standard (200x). + + The original ISO C++ standard was published as the ISO standard +(ISO/IEC 14882:1998) and amended by a Technical Corrigenda published in +2003 (ISO/IEC 14882:2003). These standards are referred to as C++98 and +C++03, respectively. GCC implements the majority of C++98 (`export' is +a notable exception) and most of the changes in C++03. To select this +standard in GCC, use one of the options `-ansi' or `-std=c++98'; to +obtain all the diagnostics required by the standard, you should also +specify `-pedantic' (or `-pedantic-errors' if you want them to be +errors rather than warnings). + + The ISO C++ committee is working on a new ISO C++ standard, dubbed +C++0x, that is intended to be published by 2009. C++0x contains several +changes to the C++ language, some of which have been implemented in an +experimental C++0x mode in GCC. The C++0x mode in GCC tracks the draft +working paper for the C++0x standard; the latest working paper is +available on the ISO C++ committee's web site at +`http://www.open-std.org/jtc1/sc22/wg21/'. For information regarding +the C++0x features available in the experimental C++0x mode, see +`http://gcc.gnu.org/gcc-4.3/cxx0x_status.html'. To select this standard +in GCC, use the option `-std=c++0x'; to obtain all the diagnostics +required by the standard, you should also specify `-pedantic' (or +`-pedantic-errors' if you want them to be errors rather than warnings). + + By default, GCC provides some extensions to the C++ language; *Note +Options Controlling C++ Dialect: C++ Dialect Options. Use of the +`-std' option listed above will disable these extensions. You may also +select an extended version of the C++ language explicitly with +`-std=gnu++98' (for C++98 with GNU extensions) or `-std=gnu++0x' (for +C++0x with GNU extensions). The default, if no C++ language dialect +options are given, is `-std=gnu++98'. + +2.3 Objective-C and Objective-C++ languages +=========================================== + +There is no formal written standard for Objective-C or Objective-C++. +The most authoritative manual is "Object-Oriented Programming and the +Objective-C Language", available at a number of web sites: + + * + `http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/' + is a recent (and periodically updated) version; + + * `http://www.toodarkpark.org/computers/objc/' is an older example; + + * `http://www.gnustep.org' and `http://gcc.gnu.org/readings.html' + have additional useful information. + + *Note GNAT Reference Manual: (gnat_rm)Top, for information on standard +conformance and compatibility of the Ada compiler. + + *Note Standards: (gfortran)Standards, for details of standards +supported by GNU Fortran. + + *Note Compatibility with the Java Platform: (gcj)Compatibility, for +details of compatibility between `gcj' and the Java Platform. + + +File: gcc.info, Node: Invoking GCC, Next: C Implementation, Prev: Standards, Up: Top + +3 GCC Command Options +********************* + +When you invoke GCC, it normally does preprocessing, compilation, +assembly and linking. The "overall options" allow you to stop this +process at an intermediate stage. For example, the `-c' option says +not to run the linker. Then the output consists of object files output +by the assembler. + + Other options are passed on to one stage of processing. Some options +control the preprocessor and others the compiler itself. Yet other +options control the assembler and linker; most of these are not +documented here, since you rarely need to use any of them. + + Most of the command line options that you can use with GCC are useful +for C programs; when an option is only useful with another language +(usually C++), the explanation says so explicitly. If the description +for a particular option does not mention a source language, you can use +that option with all supported languages. + + *Note Compiling C++ Programs: Invoking G++, for a summary of special +options for compiling C++ programs. + + The `gcc' program accepts options and file names as operands. Many +options have multi-letter names; therefore multiple single-letter +options may _not_ be grouped: `-dv' is very different from `-d -v'. + + You can mix options and other arguments. For the most part, the order +you use doesn't matter. Order does matter when you use several options +of the same kind; for example, if you specify `-L' more than once, the +directories are searched in the order specified. Also, the placement +of the `-l' option is significant. + + Many options have long names starting with `-f' or with `-W'--for +example, `-fmove-loop-invariants', `-Wformat' and so on. Most of these +have both positive and negative forms; the negative form of `-ffoo' +would be `-fno-foo'. This manual documents only one of these two +forms, whichever one is not the default. + + *Note Option Index::, for an index to GCC's options. + +* Menu: + +* Option Summary:: Brief list of all options, without explanations. +* Overall Options:: Controlling the kind of output: + an executable, object files, assembler files, + or preprocessed source. +* Invoking G++:: Compiling C++ programs. +* C Dialect Options:: Controlling the variant of C language compiled. +* C++ Dialect Options:: Variations on C++. +* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C + and Objective-C++. +* Language Independent Options:: Controlling how diagnostics should be + formatted. +* Warning Options:: How picky should the compiler be? +* Debugging Options:: Symbol tables, measurements, and debugging dumps. +* Optimize Options:: How much optimization? +* Preprocessor Options:: Controlling header files and macro definitions. + Also, getting dependency information for Make. +* Assembler Options:: Passing options to the assembler. +* Link Options:: Specifying libraries and so on. +* Directory Options:: Where to find header files and libraries. + Where to find the compiler executable files. +* Spec Files:: How to pass switches to sub-processes. +* Target Options:: Running a cross-compiler, or an old version of GCC. +* Submodel Options:: Specifying minor hardware or convention variations, + such as 68010 vs 68020. +* Code Gen Options:: Specifying conventions for function calls, data layout + and register usage. +* Environment Variables:: Env vars that affect GCC. +* Precompiled Headers:: Compiling a header once, and using it many times. +* Running Protoize:: Automatically adding or removing function prototypes. + + +File: gcc.info, Node: Option Summary, Next: Overall Options, Up: Invoking GCC + +3.1 Option Summary +================== + +Here is a summary of all the options, grouped by type. Explanations are +in the following sections. + +_Overall Options_ + *Note Options Controlling the Kind of Output: Overall Options. + -c -S -E -o FILE -combine -pipe -pass-exit-codes + -x LANGUAGE -v -### --help[=CLASS[,...]] --target-help + --version -wrapper@FILE + +_C Language Options_ + *Note Options Controlling C Dialect: C Dialect Options. + -ansi -std=STANDARD -fgnu89-inline + -aux-info FILENAME + -fno-asm -fno-builtin -fno-builtin-FUNCTION + -fhosted -ffreestanding -fopenmp -fms-extensions + -trigraphs -no-integrated-cpp -traditional -traditional-cpp + -fallow-single-precision -fcond-mismatch -flax-vector-conversions + -fsigned-bitfields -fsigned-char + -funsigned-bitfields -funsigned-char + +_C++ Language Options_ + *Note Options Controlling C++ Dialect: C++ Dialect Options. + -fabi-version=N -fno-access-control -fcheck-new + -fconserve-space -ffriend-injection + -fno-elide-constructors + -fno-enforce-eh-specs + -ffor-scope -fno-for-scope -fno-gnu-keywords + -fno-implicit-templates + -fno-implicit-inline-templates + -fno-implement-inlines -fms-extensions + -fno-nonansi-builtins -fno-operator-names + -fno-optional-diags -fpermissive + -frepo -fno-rtti -fstats -ftemplate-depth-N + -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ + -fno-default-inline -fvisibility-inlines-hidden + -fvisibility-ms-compat + -Wabi -Wctor-dtor-privacy + -Wnon-virtual-dtor -Wreorder + -Weffc++ -Wstrict-null-sentinel + -Wno-non-template-friend -Wold-style-cast + -Woverloaded-virtual -Wno-pmf-conversions + -Wsign-promo + +_Objective-C and Objective-C++ Language Options_ + *Note Options Controlling Objective-C and Objective-C++ Dialects: + Objective-C and Objective-C++ Dialect Options. + -fconstant-string-class=CLASS-NAME + -fgnu-runtime -fnext-runtime + -fno-nil-receivers + -fobjc-call-cxx-cdtors + -fobjc-direct-dispatch + -fobjc-exceptions + -fobjc-gc + -freplace-objc-classes + -fzero-link + -gen-decls + -Wassign-intercept + -Wno-protocol -Wselector + -Wstrict-selector-match + -Wundeclared-selector + +_Language Independent Options_ + *Note Options to Control Diagnostic Messages Formatting: Language + Independent Options. + -fmessage-length=N + -fdiagnostics-show-location=[once|every-line] + -fdiagnostics-show-option + +_Warning Options_ + *Note Options to Request or Suppress Warnings: Warning Options. + -fsyntax-only -pedantic -pedantic-errors + -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds + -Wno-attributes -Wno-builtin-macro-redefined + -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual + -Wchar-subscripts -Wclobbered -Wcomment + -Wconversion -Wcoverage-mismatch -Wno-deprecated + -Wno-deprecated-declarations -Wdisabled-optimization + -Wno-div-by-zero -Wempty-body -Wenum-compare -Wno-endif-labels + -Werror -Werror=* + -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 + -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral + -Wformat-security -Wformat-y2k + -Wframe-larger-than=LEN -Wignored-qualifiers + -Wimplicit -Wimplicit-function-declaration -Wimplicit-int + -Winit-self -Winline + -Wno-int-to-pointer-cast -Wno-invalid-offsetof + -Winvalid-pch -Wlarger-than=LEN -Wunsafe-loop-optimizations + -Wlogical-op -Wlong-long + -Wmain -Wmissing-braces -Wmissing-field-initializers + -Wmissing-format-attribute -Wmissing-include-dirs + -Wmissing-noreturn -Wno-mudflap + -Wno-multichar -Wnonnull -Wno-overflow + -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded + -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format + -Wpointer-arith -Wno-pointer-to-int-cast + -Wredundant-decls + -Wreturn-type -Wsequence-point -Wshadow + -Wsign-compare -Wsign-conversion -Wstack-protector + -Wstrict-aliasing -Wstrict-aliasing=n + -Wstrict-overflow -Wstrict-overflow=N + -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand + -Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized + -Wunknown-pragmas -Wno-pragmas -Wunreachable-code + -Wunused -Wunused-function -Wunused-label -Wunused-parameter + -Wunused-value -Wunused-variable + -Wvariadic-macros -Wvla + -Wvolatile-register-var -Wwrite-strings + +_C and Objective-C-only Warning Options_ + -Wbad-function-cast -Wmissing-declarations + -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs + -Wold-style-declaration -Wold-style-definition + -Wstrict-prototypes -Wtraditional -Wtraditional-conversion + -Wdeclaration-after-statement -Wpointer-sign + +_Debugging Options_ + *Note Options for Debugging Your Program or GCC: Debugging Options. + -dLETTERS -dumpspecs -dumpmachine -dumpversion + -fdbg-cnt-list -fdbg-cnt=COUNTER-VALUE-LIST + -fdump-noaddr -fdump-unnumbered + -fdump-translation-unit[-N] + -fdump-class-hierarchy[-N] + -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline + -fdump-statistics + -fdump-tree-all + -fdump-tree-original[-N] + -fdump-tree-optimized[-N] + -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias + -fdump-tree-ch + -fdump-tree-ssa[-N] -fdump-tree-pre[-N] + -fdump-tree-ccp[-N] -fdump-tree-dce[-N] + -fdump-tree-gimple[-raw] -fdump-tree-mudflap[-N] + -fdump-tree-dom[-N] + -fdump-tree-dse[-N] + -fdump-tree-phiopt[-N] + -fdump-tree-forwprop[-N] + -fdump-tree-copyrename[-N] + -fdump-tree-nrv -fdump-tree-vect + -fdump-tree-sink + -fdump-tree-sra[-N] + -fdump-tree-fre[-N] + -fdump-tree-vrp[-N] + -ftree-vectorizer-verbose=N + -fdump-tree-storeccp[-N] + -feliminate-dwarf2-dups -feliminate-unused-debug-types + -feliminate-unused-debug-symbols -femit-class-debug-always + -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs + -frandom-seed=STRING -fsched-verbose=N + -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose + -ftest-coverage -ftime-report -fvar-tracking + -g -gLEVEL -gcoff -gdwarf-2 + -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ + -fno-merge-debug-strings -fno-dwarf2-cfi-asm + -fdebug-prefix-map=OLD=NEW + -femit-struct-debug-baseonly -femit-struct-debug-reduced + -femit-struct-debug-detailed[=SPEC-LIST] + -p -pg -print-file-name=LIBRARY -print-libgcc-file-name + -print-multi-directory -print-multi-lib + -print-prog-name=PROGRAM -print-search-dirs -Q + -print-sysroot -print-sysroot-headers-suffix + -save-temps -time + +_Optimization Options_ + *Note Options that Control Optimization: Optimize Options. + -falign-functions[=N] -falign-jumps[=N] + -falign-labels[=N] -falign-loops[=N] -fassociative-math + -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize + -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves + -fcheck-data-deps -fconserve-stack -fcprop-registers -fcrossjumping + -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range + -fdata-sections -fdce -fdce + -fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse + -fearly-inlining -fexpensive-optimizations -ffast-math + -ffinite-math-only -ffloat-store -fforward-propagate + -ffunction-sections -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm + -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining + -finline-functions -finline-functions-called-once -finline-limit=N + -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg -fipa-pta + -fipa-pure-const -fipa-reference -fipa-struct-reorg + -fipa-type-escape -fira-algorithm=ALGORITHM + -fira-region=REGION -fira-coalesce -fno-ira-share-save-slots + -fno-ira-share-spill-slots -fira-verbose=N + -fivopts -fkeep-inline-functions -fkeep-static-consts + -floop-block -floop-interchange -floop-strip-mine + -fmerge-all-constants -fmerge-constants -fmodulo-sched + -fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap + -fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline + -fno-defer-pop -fno-function-cse -fno-guess-branch-probability + -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 + -fno-sched-interblock -fno-sched-spec -fno-signed-zeros + -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss + -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls + -fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays + -fprofile-correction -fprofile-dir=PATH -fprofile-generate + -fprofile-generate=PATH + -fprofile-use -fprofile-use=PATH -fprofile-values + -freciprocal-math -fregmove -frename-registers -freorder-blocks + -freorder-blocks-and-partition -freorder-functions + -frerun-cse-after-loop -freschedule-modulo-scheduled-loops + -frounding-math -frtl-abstract-sequences -fsched2-use-superblocks + -fsched2-use-traces -fsched-spec-load -fsched-spec-load-dangerous + -fsched-stalled-insns-dep[=N] -fsched-stalled-insns[=N] + -fschedule-insns -fschedule-insns2 -fsection-anchors -fsee + -fselective-scheduling -fselective-scheduling2 + -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops + -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller + -fsplit-wide-types -fstack-protector -fstack-protector-all + -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer + -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop + -ftree-copyrename -ftree-dce + -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-loop-im + -ftree-loop-distribution + -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize + -ftree-parallelize-loops=N -ftree-pre -ftree-reassoc + -ftree-sink -ftree-sra -ftree-switch-conversion + -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp + -funit-at-a-time -funroll-all-loops -funroll-loops + -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops + -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb + -fwhole-program + --param NAME=VALUE + -O -O0 -O1 -O2 -O3 -Os + +_Preprocessor Options_ + *Note Options Controlling the Preprocessor: Preprocessor Options. + -AQUESTION=ANSWER + -A-QUESTION[=ANSWER] + -C -dD -dI -dM -dN + -DMACRO[=DEFN] -E -H + -idirafter DIR + -include FILE -imacros FILE + -iprefix FILE -iwithprefix DIR + -iwithprefixbefore DIR -isystem DIR + -imultilib DIR -isysroot DIR + -M -MM -MF -MG -MP -MQ -MT -nostdinc + -P -fworking-directory -remap + -trigraphs -undef -UMACRO -Wp,OPTION + -Xpreprocessor OPTION + +_Assembler Option_ + *Note Passing Options to the Assembler: Assembler Options. + -Wa,OPTION -Xassembler OPTION + +_Linker Options_ + *Note Options for Linking: Link Options. + OBJECT-FILE-NAME -lLIBRARY + -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic + -s -static -static-libgcc -shared -shared-libgcc -symbolic + -T SCRIPT -Wl,OPTION -Xlinker OPTION + -u SYMBOL + +_Directory Options_ + *Note Options for Directory Search: Directory Options. + -BPREFIX -IDIR -iquoteDIR -LDIR + -specs=FILE -I- --sysroot=DIR + +_Target Options_ + *Note Target Options::. + -V VERSION -b MACHINE + +_Machine Dependent Options_ + *Note Hardware Models and Configurations: Submodel Options. + + _ARC Options_ + -EB -EL + -mmangle-cpu -mcpu=CPU -mtext=TEXT-SECTION + -mdata=DATA-SECTION -mrodata=READONLY-DATA-SECTION + + _ARM Options_ + -mapcs-frame -mno-apcs-frame + -mabi=NAME + -mapcs-stack-check -mno-apcs-stack-check + -mapcs-float -mno-apcs-float + -mapcs-reentrant -mno-apcs-reentrant + -msched-prolog -mno-sched-prolog + -mlittle-endian -mbig-endian -mwords-little-endian + -mfloat-abi=NAME -msoft-float -mhard-float -mfpe + -mthumb-interwork -mno-thumb-interwork + -mcpu=NAME -march=NAME -mfpu=NAME + -mstructure-size-boundary=N + -mabort-on-noreturn + -mlong-calls -mno-long-calls + -msingle-pic-base -mno-single-pic-base + -mpic-register=REG + -mnop-fun-dllimport + -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns + -mpoke-function-name + -mthumb -marm + -mtpcs-frame -mtpcs-leaf-frame + -mcaller-super-interworking -mcallee-super-interworking + -mtp=NAME + -mword-relocations + -mfix-cortex-m3-ldrd + + _AVR Options_ + -mmcu=MCU -msize -mno-interrupts + -mcall-prologues -mno-tablejump -mtiny-stack -mint8 + + _Blackfin Options_ + -mcpu=CPU[-SIREVISION] + -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer + -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly + -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library + -mno-id-shared-library -mshared-library-id=N + -mleaf-id-shared-library -mno-leaf-id-shared-library + -msep-data -mno-sep-data -mlong-calls -mno-long-calls + -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram + -micplb + + _CRIS Options_ + -mcpu=CPU -march=CPU -mtune=CPU + -mmax-stack-frame=N -melinux-stacksize=N + -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects + -mstack-align -mdata-align -mconst-align + -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt + -melf -maout -melinux -mlinux -sim -sim2 + -mmul-bug-workaround -mno-mul-bug-workaround + + _CRX Options_ + -mmac -mpush-args + + _Darwin Options_ + -all_load -allowable_client -arch -arch_errors_fatal + -arch_only -bind_at_load -bundle -bundle_loader + -client_name -compatibility_version -current_version + -dead_strip + -dependency-file -dylib_file -dylinker_install_name + -dynamic -dynamiclib -exported_symbols_list + -filelist -flat_namespace -force_cpusubtype_ALL + -force_flat_namespace -headerpad_max_install_names + -iframework + -image_base -init -install_name -keep_private_externs + -multi_module -multiply_defined -multiply_defined_unused + -noall_load -no_dead_strip_inits_and_terms + -nofixprebinding -nomultidefs -noprebind -noseglinkedit + -pagezero_size -prebind -prebind_all_twolevel_modules + -private_bundle -read_only_relocs -sectalign + -sectobjectsymbols -whyload -seg1addr + -sectcreate -sectobjectsymbols -sectorder + -segaddr -segs_read_only_addr -segs_read_write_addr + -seg_addr_table -seg_addr_table_filename -seglinkedit + -segprot -segs_read_only_addr -segs_read_write_addr + -single_module -static -sub_library -sub_umbrella + -twolevel_namespace -umbrella -undefined + -unexported_symbols_list -weak_reference_mismatches + -whatsloaded -F -gused -gfull -mmacosx-version-min=VERSION + -mkernel -mone-byte-bool + + _DEC Alpha Options_ + -mno-fp-regs -msoft-float -malpha-as -mgas + -mieee -mieee-with-inexact -mieee-conformant + -mfp-trap-mode=MODE -mfp-rounding-mode=MODE + -mtrap-precision=MODE -mbuild-constants + -mcpu=CPU-TYPE -mtune=CPU-TYPE + -mbwx -mmax -mfix -mcix + -mfloat-vax -mfloat-ieee + -mexplicit-relocs -msmall-data -mlarge-data + -msmall-text -mlarge-text + -mmemory-latency=TIME + + _DEC Alpha/VMS Options_ + -mvms-return-codes + + _FR30 Options_ + -msmall-model -mno-lsim + + _FRV Options_ + -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 + -mhard-float -msoft-float + -malloc-cc -mfixed-cc -mdword -mno-dword + -mdouble -mno-double + -mmedia -mno-media -mmuladd -mno-muladd + -mfdpic -minline-plt -mgprel-ro -multilib-library-pic + -mlinked-fp -mlong-calls -malign-labels + -mlibrary-pic -macc-4 -macc-8 + -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move + -moptimize-membar -mno-optimize-membar + -mscc -mno-scc -mcond-exec -mno-cond-exec + -mvliw-branch -mno-vliw-branch + -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec + -mno-nested-cond-exec -mtomcat-stats + -mTLS -mtls + -mcpu=CPU + + _GNU/Linux Options_ + -muclibc + + _H8/300 Options_ + -mrelax -mh -ms -mn -mint32 -malign-300 + + _HPPA Options_ + -march=ARCHITECTURE-TYPE + -mbig-switch -mdisable-fpregs -mdisable-indexing + -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld + -mfixed-range=REGISTER-RANGE + -mjump-in-delay -mlinker-opt -mlong-calls + -mlong-load-store -mno-big-switch -mno-disable-fpregs + -mno-disable-indexing -mno-fast-indirect-calls -mno-gas + -mno-jump-in-delay -mno-long-load-store + -mno-portable-runtime -mno-soft-float + -mno-space-regs -msoft-float -mpa-risc-1-0 + -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime + -mschedule=CPU-TYPE -mspace-regs -msio -mwsio + -munix=UNIX-STD -nolibdld -static -threads + + _i386 and x86-64 Options_ + -mtune=CPU-TYPE -march=CPU-TYPE + -mfpmath=UNIT + -masm=DIALECT -mno-fancy-math-387 + -mno-fp-ret-in-387 -msoft-float + -mno-wide-multiply -mrtd -malign-double + -mpreferred-stack-boundary=NUM + -mincoming-stack-boundary=NUM + -mcld -mcx16 -msahf -mrecip + -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx + -maes -mpclmul + -msse4a -m3dnow -mpopcnt -mabm -msse5 + -mthreads -mno-align-stringops -minline-all-stringops + -minline-stringops-dynamically -mstringop-strategy=ALG + -mpush-args -maccumulate-outgoing-args -m128bit-long-double + -m96bit-long-double -mregparm=NUM -msseregparm + -mveclibabi=TYPE -mpc32 -mpc64 -mpc80 -mstackrealign + -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs + -mcmodel=CODE-MODEL + -m32 -m64 -mlarge-data-threshold=NUM + -mfused-madd -mno-fused-madd -msse2avx + + _IA-64 Options_ + -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic + -mvolatile-asm-stop -mregister-names -mno-sdata + -mconstant-gp -mauto-pic -minline-float-divide-min-latency + -minline-float-divide-max-throughput + -minline-int-divide-min-latency + -minline-int-divide-max-throughput + -minline-sqrt-min-latency -minline-sqrt-max-throughput + -mno-dwarf2-asm -mearly-stop-bits + -mfixed-range=REGISTER-RANGE -mtls-size=TLS-SIZE + -mtune=CPU-TYPE -mt -pthread -milp32 -mlp64 + -mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec + -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec + -msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose + -mno-sched-prefer-non-data-spec-insns + -mno-sched-prefer-non-control-spec-insns + -mno-sched-count-spec-in-critical-path + + _M32R/D Options_ + -m32r2 -m32rx -m32r + -mdebug + -malign-loops -mno-align-loops + -missue-rate=NUMBER + -mbranch-cost=NUMBER + -mmodel=CODE-SIZE-MODEL-TYPE + -msdata=SDATA-TYPE + -mno-flush-func -mflush-func=NAME + -mno-flush-trap -mflush-trap=NUMBER + -G NUM + + _M32C Options_ + -mcpu=CPU -msim -memregs=NUMBER + + _M680x0 Options_ + -march=ARCH -mcpu=CPU -mtune=TUNE + -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 + -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 + -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 + -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort + -mno-short -mhard-float -m68881 -msoft-float -mpcrel + -malign-int -mstrict-align -msep-data -mno-sep-data + -mshared-library-id=n -mid-shared-library -mno-id-shared-library + -mxgot -mno-xgot + + _M68hc1x Options_ + -m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 + -mauto-incdec -minmax -mlong-calls -mshort + -msoft-reg-count=COUNT + + _MCore Options_ + -mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates + -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields + -m4byte-functions -mno-4byte-functions -mcallgraph-data + -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim + -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment + + _MIPS Options_ + -EL -EB -march=ARCH -mtune=ARCH + -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 + -mips64 -mips64r2 + -mips16 -mno-mips16 -mflip-mips16 + -minterlink-mips16 -mno-interlink-mips16 + -mabi=ABI -mabicalls -mno-abicalls + -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot + -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float + -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 + -mfpu=FPU-TYPE + -msmartmips -mno-smartmips + -mpaired-single -mno-paired-single -mdmx -mno-mdmx + -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc + -mlong64 -mlong32 -msym32 -mno-sym32 + -GNUM -mlocal-sdata -mno-local-sdata + -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt + -membedded-data -mno-embedded-data + -muninit-const-in-rodata -mno-uninit-const-in-rodata + -mcode-readable=SETTING + -msplit-addresses -mno-split-addresses + -mexplicit-relocs -mno-explicit-relocs + -mcheck-zero-division -mno-check-zero-division + -mdivide-traps -mdivide-breaks + -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls + -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp + -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 + -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 + -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 + -mflush-func=FUNC -mno-flush-func + -mbranch-cost=NUM -mbranch-likely -mno-branch-likely + -mfp-exceptions -mno-fp-exceptions + -mvr4130-align -mno-vr4130-align + + _MMIX Options_ + -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu + -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols + -melf -mbranch-predict -mno-branch-predict -mbase-addresses + -mno-base-addresses -msingle-exit -mno-single-exit + + _MN10300 Options_ + -mmult-bug -mno-mult-bug + -mam33 -mno-am33 + -mam33-2 -mno-am33-2 + -mreturn-pointer-on-d0 + -mno-crt0 -mrelax + + _PDP-11 Options_ + -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 + -mbcopy -mbcopy-builtin -mint32 -mno-int16 + -mint16 -mno-int32 -mfloat32 -mno-float64 + -mfloat64 -mno-float32 -mabshi -mno-abshi + -mbranch-expensive -mbranch-cheap + -msplit -mno-split -munix-asm -mdec-asm + + _picoChip Options_ + -mae=AE_TYPE -mvliw-lookahead=N + -msymbol-as-address -mno-inefficient-warnings + + _PowerPC Options_ See RS/6000 and PowerPC Options. + + _RS/6000 and PowerPC Options_ + -mcpu=CPU-TYPE + -mtune=CPU-TYPE + -mpower -mno-power -mpower2 -mno-power2 + -mpowerpc -mpowerpc64 -mno-powerpc + -maltivec -mno-altivec + -mpowerpc-gpopt -mno-powerpc-gpopt + -mpowerpc-gfxopt -mno-powerpc-gfxopt + -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd + -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp + -mnew-mnemonics -mold-mnemonics + -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc + -m64 -m32 -mxl-compat -mno-xl-compat -mpe + -malign-power -malign-natural + -msoft-float -mhard-float -mmultiple -mno-multiple + -msingle-float -mdouble-float -msimple-fpu + -mstring -mno-string -mupdate -mno-update + -mavoid-indexed-addresses -mno-avoid-indexed-addresses + -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align + -mstrict-align -mno-strict-align -mrelocatable + -mno-relocatable -mrelocatable-lib -mno-relocatable-lib + -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian + -mdynamic-no-pic -maltivec -mswdiv + -mprioritize-restricted-insns=PRIORITY + -msched-costly-dep=DEPENDENCE_TYPE + -minsert-sched-nops=SCHEME + -mcall-sysv -mcall-netbsd + -maix-struct-return -msvr4-struct-return + -mabi=ABI-TYPE -msecure-plt -mbss-plt + -misel -mno-isel + -misel=yes -misel=no + -mspe -mno-spe + -mspe=yes -mspe=no + -mpaired + -mgen-cell-microcode -mwarn-cell-microcode + -mvrsave -mno-vrsave + -mmulhw -mno-mulhw + -mdlmzb -mno-dlmzb + -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double + -mprototype -mno-prototype + -msim -mmvme -mads -myellowknife -memb -msdata + -msdata=OPT -mvxworks -G NUM -pthread + + _S/390 and zSeries Options_ + -mtune=CPU-TYPE -march=CPU-TYPE + -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp + -mlong-double-64 -mlong-double-128 + -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack + -msmall-exec -mno-small-exec -mmvcle -mno-mvcle + -m64 -m31 -mdebug -mno-debug -mesa -mzarch + -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd + -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard + + _Score Options_ + -meb -mel + -mnhwloop + -muls + -mmac + -mscore5 -mscore5u -mscore7 -mscore7d + + _SH Options_ + -m1 -m2 -m2e -m3 -m3e + -m4-nofpu -m4-single-only -m4-single -m4 + -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al + -m5-64media -m5-64media-nofpu + -m5-32media -m5-32media-nofpu + -m5-compact -m5-compact-nofpu + -mb -ml -mdalign -mrelax + -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave + -mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace + -mprefergot -musermode -multcost=NUMBER -mdiv=STRATEGY + -mdivsi3_libfunc=NAME -mfixed-range=REGISTER-RANGE + -madjust-unroll -mindexed-addressing -mgettrcost=NUMBER -mpt-fixed + -minvalid-symbols + + _SPARC Options_ + -mcpu=CPU-TYPE + -mtune=CPU-TYPE + -mcmodel=CODE-MODEL + -m32 -m64 -mapp-regs -mno-app-regs + -mfaster-structs -mno-faster-structs + -mfpu -mno-fpu -mhard-float -msoft-float + -mhard-quad-float -msoft-quad-float + -mimpure-text -mno-impure-text -mlittle-endian + -mstack-bias -mno-stack-bias + -munaligned-doubles -mno-unaligned-doubles + -mv8plus -mno-v8plus -mvis -mno-vis + -threads -pthreads -pthread + + _SPU Options_ + -mwarn-reloc -merror-reloc + -msafe-dma -munsafe-dma + -mbranch-hints + -msmall-mem -mlarge-mem -mstdmain + -mfixed-range=REGISTER-RANGE + + _System V Options_ + -Qy -Qn -YP,PATHS -Ym,DIR + + _V850 Options_ + -mlong-calls -mno-long-calls -mep -mno-ep + -mprolog-function -mno-prolog-function -mspace + -mtda=N -msda=N -mzda=N + -mapp-regs -mno-app-regs + -mdisable-callt -mno-disable-callt + -mv850e1 + -mv850e + -mv850 -mbig-switch + + _VAX Options_ + -mg -mgnu -munix + + _VxWorks Options_ + -mrtp -non-static -Bstatic -Bdynamic + -Xbind-lazy -Xbind-now + + _x86-64 Options_ See i386 and x86-64 Options. + + _i386 and x86-64 Windows Options_ + -mconsole -mcygwin -mno-cygwin -mdll + -mnop-fun-dllimport -mthread -mwin32 -mwindows + + _Xstormy16 Options_ + -msim + + _Xtensa Options_ + -mconst16 -mno-const16 + -mfused-madd -mno-fused-madd + -mserialize-volatile -mno-serialize-volatile + -mtext-section-literals -mno-text-section-literals + -mtarget-align -mno-target-align + -mlongcalls -mno-longcalls + + _zSeries Options_ See S/390 and zSeries Options. + +_Code Generation Options_ + *Note Options for Code Generation Conventions: Code Gen Options. + -fcall-saved-REG -fcall-used-REG + -ffixed-REG -fexceptions + -fnon-call-exceptions -funwind-tables + -fasynchronous-unwind-tables + -finhibit-size-directive -finstrument-functions + -finstrument-functions-exclude-function-list=SYM,SYM,... + -finstrument-functions-exclude-file-list=FILE,FILE,... + -fno-common -fno-ident + -fpcc-struct-return -fpic -fPIC -fpie -fPIE + -fno-jump-tables + -frecord-gcc-switches + -freg-struct-return -fshort-enums + -fshort-double -fshort-wchar + -fverbose-asm -fpack-struct[=N] -fstack-check + -fstack-limit-register=REG -fstack-limit-symbol=SYM + -fno-stack-limit -fargument-alias -fargument-noalias + -fargument-noalias-global -fargument-noalias-anything + -fleading-underscore -ftls-model=MODEL + -ftrapv -fwrapv -fbounds-check + -fvisibility + + +* Menu: + +* Overall Options:: Controlling the kind of output: + an executable, object files, assembler files, + or preprocessed source. +* C Dialect Options:: Controlling the variant of C language compiled. +* C++ Dialect Options:: Variations on C++. +* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C + and Objective-C++. +* Language Independent Options:: Controlling how diagnostics should be + formatted. +* Warning Options:: How picky should the compiler be? +* Debugging Options:: Symbol tables, measurements, and debugging dumps. +* Optimize Options:: How much optimization? +* Preprocessor Options:: Controlling header files and macro definitions. + Also, getting dependency information for Make. +* Assembler Options:: Passing options to the assembler. +* Link Options:: Specifying libraries and so on. +* Directory Options:: Where to find header files and libraries. + Where to find the compiler executable files. +* Spec Files:: How to pass switches to sub-processes. +* Target Options:: Running a cross-compiler, or an old version of GCC. + + +File: gcc.info, Node: Overall Options, Next: Invoking G++, Prev: Option Summary, Up: Invoking GCC + +3.2 Options Controlling the Kind of Output +========================================== + +Compilation can involve up to four stages: preprocessing, compilation +proper, assembly and linking, always in that order. GCC is capable of +preprocessing and compiling several files either into several assembler +input files, or into one assembler input file; then each assembler +input file produces an object file, and linking combines all the object +files (those newly compiled, and those specified as input) into an +executable file. + + For any given input file, the file name suffix determines what kind of +compilation is done: + +`FILE.c' + C source code which must be preprocessed. + +`FILE.i' + C source code which should not be preprocessed. + +`FILE.ii' + C++ source code which should not be preprocessed. + +`FILE.m' + Objective-C source code. Note that you must link with the + `libobjc' library to make an Objective-C program work. + +`FILE.mi' + Objective-C source code which should not be preprocessed. + +`FILE.mm' +`FILE.M' + Objective-C++ source code. Note that you must link with the + `libobjc' library to make an Objective-C++ program work. Note + that `.M' refers to a literal capital M. + +`FILE.mii' + Objective-C++ source code which should not be preprocessed. + +`FILE.h' + C, C++, Objective-C or Objective-C++ header file to be turned into + a precompiled header. + +`FILE.cc' +`FILE.cp' +`FILE.cxx' +`FILE.cpp' +`FILE.CPP' +`FILE.c++' +`FILE.C' + C++ source code which must be preprocessed. Note that in `.cxx', + the last two letters must both be literally `x'. Likewise, `.C' + refers to a literal capital C. + +`FILE.mm' +`FILE.M' + Objective-C++ source code which must be preprocessed. + +`FILE.mii' + Objective-C++ source code which should not be preprocessed. + +`FILE.hh' +`FILE.H' +`FILE.hp' +`FILE.hxx' +`FILE.hpp' +`FILE.HPP' +`FILE.h++' +`FILE.tcc' + C++ header file to be turned into a precompiled header. + +`FILE.f' +`FILE.for' +`FILE.ftn' + Fixed form Fortran source code which should not be preprocessed. + +`FILE.F' +`FILE.FOR' +`FILE.fpp' +`FILE.FPP' +`FILE.FTN' + Fixed form Fortran source code which must be preprocessed (with + the traditional preprocessor). + +`FILE.f90' +`FILE.f95' +`FILE.f03' +`FILE.f08' + Free form Fortran source code which should not be preprocessed. + +`FILE.F90' +`FILE.F95' +`FILE.F03' +`FILE.F08' + Free form Fortran source code which must be preprocessed (with the + traditional preprocessor). + +`FILE.ads' + Ada source code file which contains a library unit declaration (a + declaration of a package, subprogram, or generic, or a generic + instantiation), or a library unit renaming declaration (a package, + generic, or subprogram renaming declaration). Such files are also + called "specs". + +`FILE.adb' + Ada source code file containing a library unit body (a subprogram + or package body). Such files are also called "bodies". + +`FILE.s' + Assembler code. + +`FILE.S' +`FILE.sx' + Assembler code which must be preprocessed. + +`OTHER' + An object file to be fed straight into linking. Any file name + with no recognized suffix is treated this way. + + You can specify the input language explicitly with the `-x' option: + +`-x LANGUAGE' + Specify explicitly the LANGUAGE for the following input files + (rather than letting the compiler choose a default based on the + file name suffix). This option applies to all following input + files until the next `-x' option. Possible values for LANGUAGE + are: + c c-header c-cpp-output + c++ c++-header c++-cpp-output + objective-c objective-c-header objective-c-cpp-output + objective-c++ objective-c++-header objective-c++-cpp-output + assembler assembler-with-cpp + ada + f77 f77-cpp-input f95 f95-cpp-input + java + +`-x none' + Turn off any specification of a language, so that subsequent files + are handled according to their file name suffixes (as they are if + `-x' has not been used at all). + +`-pass-exit-codes' + Normally the `gcc' program will exit with the code of 1 if any + phase of the compiler returns a non-success return code. If you + specify `-pass-exit-codes', the `gcc' program will instead return + with numerically highest error produced by any phase that returned + an error indication. The C, C++, and Fortran frontends return 4, + if an internal compiler error is encountered. + + If you only want some of the stages of compilation, you can use `-x' +(or filename suffixes) to tell `gcc' where to start, and one of the +options `-c', `-S', or `-E' to say where `gcc' is to stop. Note that +some combinations (for example, `-x cpp-output -E') instruct `gcc' to +do nothing at all. + +`-c' + Compile or assemble the source files, but do not link. The linking + stage simply is not done. The ultimate output is in the form of an + object file for each source file. + + By default, the object file name for a source file is made by + replacing the suffix `.c', `.i', `.s', etc., with `.o'. + + Unrecognized input files, not requiring compilation or assembly, + are ignored. + +`-S' + Stop after the stage of compilation proper; do not assemble. The + output is in the form of an assembler code file for each + non-assembler input file specified. + + By default, the assembler file name for a source file is made by + replacing the suffix `.c', `.i', etc., with `.s'. + + Input files that don't require compilation are ignored. + +`-E' + Stop after the preprocessing stage; do not run the compiler + proper. The output is in the form of preprocessed source code, + which is sent to the standard output. + + Input files which don't require preprocessing are ignored. + +`-o FILE' + Place output in file FILE. This applies regardless to whatever + sort of output is being produced, whether it be an executable file, + an object file, an assembler file or preprocessed C code. + + If `-o' is not specified, the default is to put an executable file + in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its + assembler file in `SOURCE.s', a precompiled header file in + `SOURCE.SUFFIX.gch', and all preprocessed C source on standard + output. + +`-v' + Print (on standard error output) the commands executed to run the + stages of compilation. Also print the version number of the + compiler driver program and of the preprocessor and the compiler + proper. + +`-###' + Like `-v' except the commands are not executed and all command + arguments are quoted. This is useful for shell scripts to capture + the driver-generated command lines. + +`-pipe' + Use pipes rather than temporary files for communication between the + various stages of compilation. This fails to work on some systems + where the assembler is unable to read from a pipe; but the GNU + assembler has no trouble. + +`-combine' + If you are compiling multiple source files, this option tells the + driver to pass all the source files to the compiler at once (for + those languages for which the compiler can handle this). This + will allow intermodule analysis (IMA) to be performed by the + compiler. Currently the only language for which this is supported + is C. If you pass source files for multiple languages to the + driver, using this option, the driver will invoke the compiler(s) + that support IMA once each, passing each compiler all the source + files appropriate for it. For those languages that do not support + IMA this option will be ignored, and the compiler will be invoked + once for each source file in that language. If you use this + option in conjunction with `-save-temps', the compiler will + generate multiple pre-processed files (one for each source file), + but only one (combined) `.o' or `.s' file. + +`--help' + Print (on the standard output) a description of the command line + options understood by `gcc'. If the `-v' option is also specified + then `--help' will also be passed on to the various processes + invoked by `gcc', so that they can display the command line options + they accept. If the `-Wextra' option has also been specified + (prior to the `--help' option), then command line options which + have no documentation associated with them will also be displayed. + +`--target-help' + Print (on the standard output) a description of target-specific + command line options for each tool. For some targets extra + target-specific information may also be printed. + +`--help={CLASS|[^]QUALIFIER}[,...]' + Print (on the standard output) a description of the command line + options understood by the compiler that fit into all specified + classes and qualifiers. These are the supported classes: + + `optimizers' + This will display all of the optimization options supported + by the compiler. + + `warnings' + This will display all of the options controlling warning + messages produced by the compiler. + + `target' + This will display target-specific options. Unlike the + `--target-help' option however, target-specific options of the + linker and assembler will not be displayed. This is because + those tools do not currently support the extended `--help=' + syntax. + + `params' + This will display the values recognized by the `--param' + option. + + LANGUAGE + This will display the options supported for LANGUAGE, where + LANGUAGE is the name of one of the languages supported in this + version of GCC. + + `common' + This will display the options that are common to all + languages. + + These are the supported qualifiers: + + `undocumented' + Display only those options which are undocumented. + + `joined' + Display options which take an argument that appears after an + equal sign in the same continuous piece of text, such as: + `--help=target'. + + `separate' + Display options which take an argument that appears as a + separate word following the original option, such as: `-o + output-file'. + + Thus for example to display all the undocumented target-specific + switches supported by the compiler the following can be used: + + --help=target,undocumented + + The sense of a qualifier can be inverted by prefixing it with the + `^' character, so for example to display all binary warning + options (i.e., ones that are either on or off and that do not take + an argument), which have a description the following can be used: + + --help=warnings,^joined,^undocumented + + The argument to `--help=' should not consist solely of inverted + qualifiers. + + Combining several classes is possible, although this usually + restricts the output by so much that there is nothing to display. + One case where it does work however is when one of the classes is + TARGET. So for example to display all the target-specific + optimization options the following can be used: + + --help=target,optimizers + + The `--help=' option can be repeated on the command line. Each + successive use will display its requested class of options, + skipping those that have already been displayed. + + If the `-Q' option appears on the command line before the + `--help=' option, then the descriptive text displayed by `--help=' + is changed. Instead of describing the displayed options, an + indication is given as to whether the option is enabled, disabled + or set to a specific value (assuming that the compiler knows this + at the point where the `--help=' option is used). + + Here is a truncated example from the ARM port of `gcc': + + % gcc -Q -mabi=2 --help=target -c + The following options are target specific: + -mabi= 2 + -mabort-on-noreturn [disabled] + -mapcs [disabled] + + The output is sensitive to the effects of previous command line + options, so for example it is possible to find out which + optimizations are enabled at `-O2' by using: + + -Q -O2 --help=optimizers + + Alternatively you can discover which binary optimizations are + enabled by `-O3' by using: + + gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts + gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts + diff /tmp/O2-opts /tmp/O3-opts | grep enabled + +`--version' + Display the version number and copyrights of the invoked GCC. + +`-wrapper' + Invoke all subcommands under a wrapper program. It takes a single + comma separated list as an argument, which will be used to invoke + the wrapper: + + gcc -c t.c -wrapper gdb,--args + + This will invoke all subprograms of gcc under "gdb -args", thus + cc1 invocation will be "gdb -args cc1 ...". + +`@FILE' + Read command-line options from FILE. The options read are + inserted in place of the original @FILE option. If FILE does not + exist, or cannot be read, then the option will be treated + literally, and not removed. + + Options in FILE are separated by whitespace. A whitespace + character may be included in an option by surrounding the entire + option in either single or double quotes. Any character + (including a backslash) may be included by prefixing the character + to be included with a backslash. The FILE may itself contain + additional @FILE options; any such options will be processed + recursively. + + +File: gcc.info, Node: Invoking G++, Next: C Dialect Options, Prev: Overall Options, Up: Invoking GCC + +3.3 Compiling C++ Programs +========================== + +C++ source files conventionally use one of the suffixes `.C', `.cc', +`.cpp', `.CPP', `.c++', `.cp', or `.cxx'; C++ header files often use +`.hh', `.hpp', `.H', or (for shared template code) `.tcc'; and +preprocessed C++ files use the suffix `.ii'. GCC recognizes files with +these names and compiles them as C++ programs even if you call the +compiler the same way as for compiling C programs (usually with the +name `gcc'). + + However, the use of `gcc' does not add the C++ library. `g++' is a +program that calls GCC and treats `.c', `.h' and `.i' files as C++ +source files instead of C source files unless `-x' is used, and +automatically specifies linking against the C++ library. This program +is also useful when precompiling a C header file with a `.h' extension +for use in C++ compilations. On many systems, `g++' is also installed +with the name `c++'. + + When you compile C++ programs, you may specify many of the same +command-line options that you use for compiling programs in any +language; or command-line options meaningful for C and related +languages; or options that are meaningful only for C++ programs. *Note +Options Controlling C Dialect: C Dialect Options, for explanations of +options for languages related to C. *Note Options Controlling C++ +Dialect: C++ Dialect Options, for explanations of options that are +meaningful only for C++ programs. + + +File: gcc.info, Node: C Dialect Options, Next: C++ Dialect Options, Prev: Invoking G++, Up: Invoking GCC + +3.4 Options Controlling C Dialect +================================= + +The following options control the dialect of C (or languages derived +from C, such as C++, Objective-C and Objective-C++) that the compiler +accepts: + +`-ansi' + In C mode, this is equivalent to `-std=c89'. In C++ mode, it is + equivalent to `-std=c++98'. + + This turns off certain features of GCC that are incompatible with + ISO C90 (when compiling C code), or of standard C++ (when + compiling C++ code), such as the `asm' and `typeof' keywords, and + predefined macros such as `unix' and `vax' that identify the type + of system you are using. It also enables the undesirable and + rarely used ISO trigraph feature. For the C compiler, it disables + recognition of C++ style `//' comments as well as the `inline' + keyword. + + The alternate keywords `__asm__', `__extension__', `__inline__' + and `__typeof__' continue to work despite `-ansi'. You would not + want to use them in an ISO C program, of course, but it is useful + to put them in header files that might be included in compilations + done with `-ansi'. Alternate predefined macros such as `__unix__' + and `__vax__' are also available, with or without `-ansi'. + + The `-ansi' option does not cause non-ISO programs to be rejected + gratuitously. For that, `-pedantic' is required in addition to + `-ansi'. *Note Warning Options::. + + The macro `__STRICT_ANSI__' is predefined when the `-ansi' option + is used. Some header files may notice this macro and refrain from + declaring certain functions or defining certain macros that the + ISO standard doesn't call for; this is to avoid interfering with + any programs that might use these names for other things. + + Functions that would normally be built in but do not have semantics + defined by ISO C (such as `alloca' and `ffs') are not built-in + functions when `-ansi' is used. *Note Other built-in functions + provided by GCC: Other Builtins, for details of the functions + affected. + +`-std=' + Determine the language standard. *Note Language Standards + Supported by GCC: Standards, for details of these standard + versions. This option is currently only supported when compiling + C or C++. + + The compiler can accept several base standards, such as `c89' or + `c++98', and GNU dialects of those standards, such as `gnu89' or + `gnu++98'. By specifying a base standard, the compiler will + accept all programs following that standard and those using GNU + extensions that do not contradict it. For example, `-std=c89' + turns off certain features of GCC that are incompatible with ISO + C90, such as the `asm' and `typeof' keywords, but not other GNU + extensions that do not have a meaning in ISO C90, such as omitting + the middle term of a `?:' expression. On the other hand, by + specifying a GNU dialect of a standard, all features the compiler + support are enabled, even when those features change the meaning + of the base standard and some strict-conforming programs may be + rejected. The particular standard is used by `-pedantic' to + identify which features are GNU extensions given that version of + the standard. For example `-std=gnu89 -pedantic' would warn about + C++ style `//' comments, while `-std=gnu99 -pedantic' would not. + + A value for this option must be provided; possible values are + + `c89' + `iso9899:1990' + Support all ISO C90 programs (certain GNU extensions that + conflict with ISO C90 are disabled). Same as `-ansi' for C + code. + + `iso9899:199409' + ISO C90 as modified in amendment 1. + + `c99' + `c9x' + `iso9899:1999' + `iso9899:199x' + ISO C99. Note that this standard is not yet fully supported; + see `http://gcc.gnu.org/gcc-4.4/c99status.html' for more + information. The names `c9x' and `iso9899:199x' are + deprecated. + + `gnu89' + GNU dialect of ISO C90 (including some C99 features). This is + the default for C code. + + `gnu99' + `gnu9x' + GNU dialect of ISO C99. When ISO C99 is fully implemented in + GCC, this will become the default. The name `gnu9x' is + deprecated. + + `c++98' + The 1998 ISO C++ standard plus amendments. Same as `-ansi' for + C++ code. + + `gnu++98' + GNU dialect of `-std=c++98'. This is the default for C++ + code. + + `c++0x' + The working draft of the upcoming ISO C++0x standard. This + option enables experimental features that are likely to be + included in C++0x. The working draft is constantly changing, + and any feature that is enabled by this flag may be removed + from future versions of GCC if it is not part of the C++0x + standard. + + `gnu++0x' + GNU dialect of `-std=c++0x'. This option enables experimental + features that may be removed in future versions of GCC. + +`-fgnu89-inline' + The option `-fgnu89-inline' tells GCC to use the traditional GNU + semantics for `inline' functions when in C99 mode. *Note An + Inline Function is As Fast As a Macro: Inline. This option is + accepted and ignored by GCC versions 4.1.3 up to but not including + 4.3. In GCC versions 4.3 and later it changes the behavior of GCC + in C99 mode. Using this option is roughly equivalent to adding the + `gnu_inline' function attribute to all inline functions (*note + Function Attributes::). + + The option `-fno-gnu89-inline' explicitly tells GCC to use the C99 + semantics for `inline' when in C99 or gnu99 mode (i.e., it + specifies the default behavior). This option was first supported + in GCC 4.3. This option is not supported in C89 or gnu89 mode. + + The preprocessor macros `__GNUC_GNU_INLINE__' and + `__GNUC_STDC_INLINE__' may be used to check which semantics are in + effect for `inline' functions. *Note Common Predefined Macros: + (cpp)Common Predefined Macros. + +`-aux-info FILENAME' + Output to the given filename prototyped declarations for all + functions declared and/or defined in a translation unit, including + those in header files. This option is silently ignored in any + language other than C. + + Besides declarations, the file indicates, in comments, the origin + of each declaration (source file and line), whether the + declaration was implicit, prototyped or unprototyped (`I', `N' for + new or `O' for old, respectively, in the first character after the + line number and the colon), and whether it came from a declaration + or a definition (`C' or `F', respectively, in the following + character). In the case of function definitions, a K&R-style list + of arguments followed by their declarations is also provided, + inside comments, after the declaration. + +`-fno-asm' + Do not recognize `asm', `inline' or `typeof' as a keyword, so that + code can use these words as identifiers. You can use the keywords + `__asm__', `__inline__' and `__typeof__' instead. `-ansi' implies + `-fno-asm'. + + In C++, this switch only affects the `typeof' keyword, since `asm' + and `inline' are standard keywords. You may want to use the + `-fno-gnu-keywords' flag instead, which has the same effect. In + C99 mode (`-std=c99' or `-std=gnu99'), this switch only affects + the `asm' and `typeof' keywords, since `inline' is a standard + keyword in ISO C99. + +`-fno-builtin' +`-fno-builtin-FUNCTION' + Don't recognize built-in functions that do not begin with + `__builtin_' as prefix. *Note Other built-in functions provided + by GCC: Other Builtins, for details of the functions affected, + including those which are not built-in functions when `-ansi' or + `-std' options for strict ISO C conformance are used because they + do not have an ISO standard meaning. + + GCC normally generates special code to handle certain built-in + functions more efficiently; for instance, calls to `alloca' may + become single instructions that adjust the stack directly, and + calls to `memcpy' may become inline copy loops. The resulting + code is often both smaller and faster, but since the function + calls no longer appear as such, you cannot set a breakpoint on + those calls, nor can you change the behavior of the functions by + linking with a different library. In addition, when a function is + recognized as a built-in function, GCC may use information about + that function to warn about problems with calls to that function, + or to generate more efficient code, even if the resulting code + still contains calls to that function. For example, warnings are + given with `-Wformat' for bad calls to `printf', when `printf' is + built in, and `strlen' is known not to modify global memory. + + With the `-fno-builtin-FUNCTION' option only the built-in function + FUNCTION is disabled. FUNCTION must not begin with `__builtin_'. + If a function is named that is not built-in in this version of + GCC, this option is ignored. There is no corresponding + `-fbuiltin-FUNCTION' option; if you wish to enable built-in + functions selectively when using `-fno-builtin' or + `-ffreestanding', you may define macros such as: + + #define abs(n) __builtin_abs ((n)) + #define strcpy(d, s) __builtin_strcpy ((d), (s)) + +`-fhosted' + Assert that compilation takes place in a hosted environment. This + implies `-fbuiltin'. A hosted environment is one in which the + entire standard library is available, and in which `main' has a + return type of `int'. Examples are nearly everything except a + kernel. This is equivalent to `-fno-freestanding'. + +`-ffreestanding' + Assert that compilation takes place in a freestanding environment. + This implies `-fno-builtin'. A freestanding environment is one + in which the standard library may not exist, and program startup + may not necessarily be at `main'. The most obvious example is an + OS kernel. This is equivalent to `-fno-hosted'. + + *Note Language Standards Supported by GCC: Standards, for details + of freestanding and hosted environments. + +`-fopenmp' + Enable handling of OpenMP directives `#pragma omp' in C/C++ and + `!$omp' in Fortran. When `-fopenmp' is specified, the compiler + generates parallel code according to the OpenMP Application + Program Interface v2.5 `http://www.openmp.org/'. This option + implies `-pthread', and thus is only supported on targets that + have support for `-pthread'. + +`-fms-extensions' + Accept some non-standard constructs used in Microsoft header files. + + Some cases of unnamed fields in structures and unions are only + accepted with this option. *Note Unnamed struct/union fields + within structs/unions: Unnamed Fields, for details. + +`-trigraphs' + Support ISO C trigraphs. The `-ansi' option (and `-std' options + for strict ISO C conformance) implies `-trigraphs'. + +`-no-integrated-cpp' + Performs a compilation in two passes: preprocessing and compiling. + This option allows a user supplied "cc1", "cc1plus", or "cc1obj" + via the `-B' option. The user supplied compilation step can then + add in an additional preprocessing step after normal preprocessing + but before compiling. The default is to use the integrated cpp + (internal cpp) + + The semantics of this option will change if "cc1", "cc1plus", and + "cc1obj" are merged. + +`-traditional' +`-traditional-cpp' + Formerly, these options caused GCC to attempt to emulate a + pre-standard C compiler. They are now only supported with the + `-E' switch. The preprocessor continues to support a pre-standard + mode. See the GNU CPP manual for details. + +`-fcond-mismatch' + Allow conditional expressions with mismatched types in the second + and third arguments. The value of such an expression is void. + This option is not supported for C++. + +`-flax-vector-conversions' + Allow implicit conversions between vectors with differing numbers + of elements and/or incompatible element types. This option should + not be used for new code. + +`-funsigned-char' + Let the type `char' be unsigned, like `unsigned char'. + + Each kind of machine has a default for what `char' should be. It + is either like `unsigned char' by default or like `signed char' by + default. + + Ideally, a portable program should always use `signed char' or + `unsigned char' when it depends on the signedness of an object. + But many programs have been written to use plain `char' and expect + it to be signed, or expect it to be unsigned, depending on the + machines they were written for. This option, and its inverse, let + you make such a program work with the opposite default. + + The type `char' is always a distinct type from each of `signed + char' or `unsigned char', even though its behavior is always just + like one of those two. + +`-fsigned-char' + Let the type `char' be signed, like `signed char'. + + Note that this is equivalent to `-fno-unsigned-char', which is the + negative form of `-funsigned-char'. Likewise, the option + `-fno-signed-char' is equivalent to `-funsigned-char'. + +`-fsigned-bitfields' +`-funsigned-bitfields' +`-fno-signed-bitfields' +`-fno-unsigned-bitfields' + These options control whether a bit-field is signed or unsigned, + when the declaration does not use either `signed' or `unsigned'. + By default, such a bit-field is signed, because this is + consistent: the basic integer types such as `int' are signed types. + + +File: gcc.info, Node: C++ Dialect Options, Next: Objective-C and Objective-C++ Dialect Options, Prev: C Dialect Options, Up: Invoking GCC + +3.5 Options Controlling C++ Dialect +=================================== + +This section describes the command-line options that are only meaningful +for C++ programs; but you can also use most of the GNU compiler options +regardless of what language your program is in. For example, you might +compile a file `firstClass.C' like this: + + g++ -g -frepo -O -c firstClass.C + +In this example, only `-frepo' is an option meant only for C++ +programs; you can use the other options with any language supported by +GCC. + + Here is a list of options that are _only_ for compiling C++ programs: + +`-fabi-version=N' + Use version N of the C++ ABI. Version 2 is the version of the C++ + ABI that first appeared in G++ 3.4. Version 1 is the version of + the C++ ABI that first appeared in G++ 3.2. Version 0 will always + be the version that conforms most closely to the C++ ABI + specification. Therefore, the ABI obtained using version 0 will + change as ABI bugs are fixed. + + The default is version 2. + +`-fno-access-control' + Turn off all access checking. This switch is mainly useful for + working around bugs in the access control code. + +`-fcheck-new' + Check that the pointer returned by `operator new' is non-null + before attempting to modify the storage allocated. This check is + normally unnecessary because the C++ standard specifies that + `operator new' will only return `0' if it is declared `throw()', + in which case the compiler will always check the return value even + without this option. In all other cases, when `operator new' has + a non-empty exception specification, memory exhaustion is + signalled by throwing `std::bad_alloc'. See also `new (nothrow)'. + +`-fconserve-space' + Put uninitialized or runtime-initialized global variables into the + common segment, as C does. This saves space in the executable at + the cost of not diagnosing duplicate definitions. If you compile + with this flag and your program mysteriously crashes after + `main()' has completed, you may have an object that is being + destroyed twice because two definitions were merged. + + This option is no longer useful on most targets, now that support + has been added for putting variables into BSS without making them + common. + +`-fno-deduce-init-list' + Disable deduction of a template type parameter as + std::initializer_list from a brace-enclosed initializer list, i.e. + + template auto forward(T t) -> decltype (realfn (t)) + { + return realfn (t); + } + + void f() + { + forward({1,2}); // call forward> + } + + This option is present because this deduction is an extension to + the current specification in the C++0x working draft, and there was + some concern about potential overload resolution problems. + +`-ffriend-injection' + Inject friend functions into the enclosing namespace, so that they + are visible outside the scope of the class in which they are + declared. Friend functions were documented to work this way in + the old Annotated C++ Reference Manual, and versions of G++ before + 4.1 always worked that way. However, in ISO C++ a friend function + which is not declared in an enclosing scope can only be found + using argument dependent lookup. This option causes friends to be + injected as they were in earlier releases. + + This option is for compatibility, and may be removed in a future + release of G++. + +`-fno-elide-constructors' + The C++ standard allows an implementation to omit creating a + temporary which is only used to initialize another object of the + same type. Specifying this option disables that optimization, and + forces G++ to call the copy constructor in all cases. + +`-fno-enforce-eh-specs' + Don't generate code to check for violation of exception + specifications at runtime. This option violates the C++ standard, + but may be useful for reducing code size in production builds, + much like defining `NDEBUG'. This does not give user code + permission to throw exceptions in violation of the exception + specifications; the compiler will still optimize based on the + specifications, so throwing an unexpected exception will result in + undefined behavior. + +`-ffor-scope' +`-fno-for-scope' + If `-ffor-scope' is specified, the scope of variables declared in + a for-init-statement is limited to the `for' loop itself, as + specified by the C++ standard. If `-fno-for-scope' is specified, + the scope of variables declared in a for-init-statement extends to + the end of the enclosing scope, as was the case in old versions of + G++, and other (traditional) implementations of C++. + + The default if neither flag is given to follow the standard, but + to allow and give a warning for old-style code that would + otherwise be invalid, or have different behavior. + +`-fno-gnu-keywords' + Do not recognize `typeof' as a keyword, so that code can use this + word as an identifier. You can use the keyword `__typeof__' + instead. `-ansi' implies `-fno-gnu-keywords'. + +`-fno-implicit-templates' + Never emit code for non-inline templates which are instantiated + implicitly (i.e. by use); only emit code for explicit + instantiations. *Note Template Instantiation::, for more + information. + +`-fno-implicit-inline-templates' + Don't emit code for implicit instantiations of inline templates, + either. The default is to handle inlines differently so that + compiles with and without optimization will need the same set of + explicit instantiations. + +`-fno-implement-inlines' + To save space, do not emit out-of-line copies of inline functions + controlled by `#pragma implementation'. This will cause linker + errors if these functions are not inlined everywhere they are + called. + +`-fms-extensions' + Disable pedantic warnings about constructs used in MFC, such as + implicit int and getting a pointer to member function via + non-standard syntax. + +`-fno-nonansi-builtins' + Disable built-in declarations of functions that are not mandated by + ANSI/ISO C. These include `ffs', `alloca', `_exit', `index', + `bzero', `conjf', and other related functions. + +`-fno-operator-names' + Do not treat the operator name keywords `and', `bitand', `bitor', + `compl', `not', `or' and `xor' as synonyms as keywords. + +`-fno-optional-diags' + Disable diagnostics that the standard says a compiler does not + need to issue. Currently, the only such diagnostic issued by G++ + is the one for a name having multiple meanings within a class. + +`-fpermissive' + Downgrade some diagnostics about nonconformant code from errors to + warnings. Thus, using `-fpermissive' will allow some + nonconforming code to compile. + +`-frepo' + Enable automatic template instantiation at link time. This option + also implies `-fno-implicit-templates'. *Note Template + Instantiation::, for more information. + +`-fno-rtti' + Disable generation of information about every class with virtual + functions for use by the C++ runtime type identification features + (`dynamic_cast' and `typeid'). If you don't use those parts of + the language, you can save some space by using this flag. Note + that exception handling uses the same information, but it will + generate it as needed. The `dynamic_cast' operator can still be + used for casts that do not require runtime type information, i.e. + casts to `void *' or to unambiguous base classes. + +`-fstats' + Emit statistics about front-end processing at the end of the + compilation. This information is generally only useful to the G++ + development team. + +`-ftemplate-depth-N' + Set the maximum instantiation depth for template classes to N. A + limit on the template instantiation depth is needed to detect + endless recursions during template class instantiation. ANSI/ISO + C++ conforming programs must not rely on a maximum depth greater + than 17. + +`-fno-threadsafe-statics' + Do not emit the extra code to use the routines specified in the C++ + ABI for thread-safe initialization of local statics. You can use + this option to reduce code size slightly in code that doesn't need + to be thread-safe. + +`-fuse-cxa-atexit' + Register destructors for objects with static storage duration with + the `__cxa_atexit' function rather than the `atexit' function. + This option is required for fully standards-compliant handling of + static destructors, but will only work if your C library supports + `__cxa_atexit'. + +`-fno-use-cxa-get-exception-ptr' + Don't use the `__cxa_get_exception_ptr' runtime routine. This + will cause `std::uncaught_exception' to be incorrect, but is + necessary if the runtime routine is not available. + +`-fvisibility-inlines-hidden' + This switch declares that the user does not attempt to compare + pointers to inline methods where the addresses of the two functions + were taken in different shared objects. + + The effect of this is that GCC may, effectively, mark inline + methods with `__attribute__ ((visibility ("hidden")))' so that + they do not appear in the export table of a DSO and do not require + a PLT indirection when used within the DSO. Enabling this option + can have a dramatic effect on load and link times of a DSO as it + massively reduces the size of the dynamic export table when the + library makes heavy use of templates. + + The behavior of this switch is not quite the same as marking the + methods as hidden directly, because it does not affect static + variables local to the function or cause the compiler to deduce + that the function is defined in only one shared object. + + You may mark a method as having a visibility explicitly to negate + the effect of the switch for that method. For example, if you do + want to compare pointers to a particular inline method, you might + mark it as having default visibility. Marking the enclosing class + with explicit visibility will have no effect. + + Explicitly instantiated inline methods are unaffected by this + option as their linkage might otherwise cross a shared library + boundary. *Note Template Instantiation::. + +`-fvisibility-ms-compat' + This flag attempts to use visibility settings to make GCC's C++ + linkage model compatible with that of Microsoft Visual Studio. + + The flag makes these changes to GCC's linkage model: + + 1. It sets the default visibility to `hidden', like + `-fvisibility=hidden'. + + 2. Types, but not their members, are not hidden by default. + + 3. The One Definition Rule is relaxed for types without explicit + visibility specifications which are defined in more than one + different shared object: those declarations are permitted if + they would have been permitted when this option was not used. + + In new code it is better to use `-fvisibility=hidden' and export + those classes which are intended to be externally visible. + Unfortunately it is possible for code to rely, perhaps + accidentally, on the Visual Studio behavior. + + Among the consequences of these changes are that static data + members of the same type with the same name but defined in + different shared objects will be different, so changing one will + not change the other; and that pointers to function members + defined in different shared objects may not compare equal. When + this flag is given, it is a violation of the ODR to define types + with the same name differently. + +`-fno-weak' + Do not use weak symbol support, even if it is provided by the + linker. By default, G++ will use weak symbols if they are + available. This option exists only for testing, and should not be + used by end-users; it will result in inferior code and has no + benefits. This option may be removed in a future release of G++. + +`-nostdinc++' + Do not search for header files in the standard directories + specific to C++, but do still search the other standard + directories. (This option is used when building the C++ library.) + + In addition, these optimization, warning, and code generation options +have meanings only for C++ programs: + +`-fno-default-inline' + Do not assume `inline' for functions defined inside a class scope. + *Note Options That Control Optimization: Optimize Options. Note + that these functions will have linkage like inline functions; they + just won't be inlined by default. + +`-Wabi (C, Objective-C, C++ and Objective-C++ only)' + Warn when G++ generates code that is probably not compatible with + the vendor-neutral C++ ABI. Although an effort has been made to + warn about all such cases, there are probably some cases that are + not warned about, even though G++ is generating incompatible code. + There may also be cases where warnings are emitted even though + the code that is generated will be compatible. + + You should rewrite your code to avoid these warnings if you are + concerned about the fact that code generated by G++ may not be + binary compatible with code generated by other compilers. + + The known incompatibilities at this point include: + + * Incorrect handling of tail-padding for bit-fields. G++ may + attempt to pack data into the same byte as a base class. For + example: + + struct A { virtual void f(); int f1 : 1; }; + struct B : public A { int f2 : 1; }; + + In this case, G++ will place `B::f2' into the same byte + as`A::f1'; other compilers will not. You can avoid this + problem by explicitly padding `A' so that its size is a + multiple of the byte size on your platform; that will cause + G++ and other compilers to layout `B' identically. + + * Incorrect handling of tail-padding for virtual bases. G++ + does not use tail padding when laying out virtual bases. For + example: + + struct A { virtual void f(); char c1; }; + struct B { B(); char c2; }; + struct C : public A, public virtual B {}; + + In this case, G++ will not place `B' into the tail-padding for + `A'; other compilers will. You can avoid this problem by + explicitly padding `A' so that its size is a multiple of its + alignment (ignoring virtual base classes); that will cause + G++ and other compilers to layout `C' identically. + + * Incorrect handling of bit-fields with declared widths greater + than that of their underlying types, when the bit-fields + appear in a union. For example: + + union U { int i : 4096; }; + + Assuming that an `int' does not have 4096 bits, G++ will make + the union too small by the number of bits in an `int'. + + * Empty classes can be placed at incorrect offsets. For + example: + + struct A {}; + + struct B { + A a; + virtual void f (); + }; + + struct C : public B, public A {}; + + G++ will place the `A' base class of `C' at a nonzero offset; + it should be placed at offset zero. G++ mistakenly believes + that the `A' data member of `B' is already at offset zero. + + * Names of template functions whose types involve `typename' or + template template parameters can be mangled incorrectly. + + template + void f(typename Q::X) {} + + template